mirror of
https://github.com/myhdl/myhdl.git
synced 2025-01-24 21:52:56 +08:00
23 lines
402 B
Coq
23 lines
402 B
Coq
|
module inc(count, enable, clock, reset);
|
||
|
|
||
|
parameter n = 8;
|
||
|
input enable;
|
||
|
input clock;
|
||
|
input reset;
|
||
|
output [15:0] count;
|
||
|
reg [15:0] count;
|
||
|
|
||
|
always @(posedge clock or negedge reset) begin
|
||
|
if (reset == 0) begin
|
||
|
count <= 0;
|
||
|
end
|
||
|
else begin
|
||
|
if (enable) begin
|
||
|
count <= (count + 1) % n;
|
||
|
end
|
||
|
// $display("count %d", count);
|
||
|
end
|
||
|
end
|
||
|
|
||
|
endmodule // inc
|