yosys/techlibs/cmos/counter.v

13 lines
219 B
Coq
Raw Normal View History

2013-09-14 04:23:45 -05:00
module counter (clk, rst, en, count);
input clk, rst, en;
2013-09-14 06:29:11 -05:00
output reg [2:0] count;
2013-09-14 04:23:45 -05:00
always @(posedge clk)
if (rst)
2013-09-14 06:29:11 -05:00
count <= 3'd0;
2013-09-14 04:23:45 -05:00
else if (en)
2013-09-14 06:29:11 -05:00
count <= count + 3'd1;
2013-09-14 04:23:45 -05:00
endmodule