// Build an 8-bit counter // Display low 4 bits on LED's // Send high 4 bits to the right port import byucc.jhdl.Logic.*; import byucc.jhdl.platforms.slaac1.*; import byucc.jhdl.Xilinx.*; import byucc.jhdl.base.*; import byucc.jhdl.Xilinx.*; import byucc.jhdl.modgen.*; public class cnt8 extends pelca { public static CellInterface[] cell_interface = { in("RESET", 1), out("RIGHT", 4), out("LED", 4), }; public cnt8( pe parent) { super(parent); Wire RESET = connect("RESET", wa("Reset")); Wire RIGHT = connect("RIGHT", wa("Right", 3, 0)); Wire LED = connect("LED", wa("LED")); Wire cnt = wire(8, "cnt"); new upcnt(this, vcc(), // Clock enable RESET, // If asserted, load the value stored in load_data constant(8,0), // Value to be loaded when load is asserted cnt); // The output of the up counter buf_o(cnt.range(3, 0), LED); // Route 4 lower bits of cnt to LED's buf_o(cnt.range(7, 4), RIGHT); // Route 4 upper bits of cnt to RIGHT port } }