import java.io.*; import byucc.jhdl.base.*; import byucc.jhdl.Xilinx.*; import byucc.jhdl.Xilinx.XC4000.*; import byucc.jhdl.Logic.*; public class left_edge2 extends Logic { public static CellInterface[] cell_interface = { in( "char_in", 4 ), out( "src_dist_out", 1 ), out( "reset", 1 ), out( "char_out", 4 ) }; public left_edge2(Node parent, Wire char_in, Wire src_dist_out, Wire reset, Wire char_out) { super(parent); connect("char_in", char_in); connect("char_out", char_out); connect("src_dist_out", src_dist_out); connect("reset", reset); Wire src_null = wire(1, "src_null"); // the source character is null if all bits of the one_hot encoded character // are zero. not_o(or(char_in.getWire(0),char_in.getWire(1),char_in.getWire(2),char_in.getWire(3)),src_null); // Pass the source character through and assert reset if character is null. reg_o(char_in, char_out); reg_o(src_null, reset); // This initializes the horizontal distance. // 1 == greater than the diagonal // 0 == less than the diagonal vcc_o(src_dist_out); } }