yosys/examples/cmos/counter.v

13 lines
216 B
Coq
Raw Permalink Normal View History

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