mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-09-03 03:23:31 +02:00
By adding ivtest to the iverilog source tree, it is easier to keep the regression test synchronized with the source that is being tested. This should be especially helpful for PRs that add a new feature, and have a matching ivtest PR with the regression test for that feature.
41 lines
895 B
Verilog
41 lines
895 B
Verilog
/*
|
|
* From PR#379
|
|
*/
|
|
`define IDLE 2'b00
|
|
`define COUNT 2'b01
|
|
`define DONE 2'b10
|
|
|
|
module Counter56 (POR, CLK, VoltageOK, ChargeDone );
|
|
input POR;
|
|
input CLK;
|
|
input VoltageOK;
|
|
output ChargeDone;
|
|
|
|
reg [1:0] CounterState, nextCounterState;
|
|
|
|
wire [8:0] nextMinuteCounter;
|
|
|
|
always @(posedge CLK or negedge POR)
|
|
if (!POR)
|
|
CounterState = 2'b00;
|
|
else
|
|
CounterState = nextCounterState;
|
|
|
|
always @(VoltageOK or CounterReset) // CounterReset should make an error
|
|
casez (CounterState)
|
|
`IDLE: begin
|
|
nextCounterState = (VoltageOK) ? `COUNT : `IDLE;
|
|
end
|
|
`COUNT: begin
|
|
nextCounterState = (VoltageOK) ? `COUNT : `IDLE;
|
|
end
|
|
`DONE: begin
|
|
nextCounterState = `DONE;
|
|
end
|
|
default: begin
|
|
nextCounterState = 2'bxx;
|
|
end
|
|
endcase
|
|
|
|
endmodule
|