yosys/examples/cmos/counter.v

13 lines
216 B
Verilog
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;
2015-07-02 04:14:30 -05:00
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