Files
iverilog/ivtest/ivltests/wait3.v
T
Stephen Williams cea237b407 Add ivtest to the iverilog source tree
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.
2022-01-15 10:18:50 -08:00

57 lines
799 B
Verilog

/*
* this test attempts to show a problem with the waits. This skip
* and skip2 modules should have identical behavior.
*/
module skip(r,a);
input r;
output a;
wire r;
reg a;
initial
a=0;
always begin
wait(r);
#1 a=1;
wait(!r);
#1 a=0;
end
endmodule
module skip2(r,a);
input r;
output a;
wire r;
reg a;
initial
a=0;
always @ (r or a) begin
case ({r,a})
00: ; // idle
10: #1 a=1;
11: ; // idle
01: #1 a=0;
endcase
end
endmodule
module test;
reg r1;
wire a1;
reg clk;
// skip2 skip1(r1,a1); // simulates as expected
skip skip1(r1,a1); // simulation hangs
always #50 clk= !clk;
initial begin
$monitor($time," ",r1,a1);
$display("starting");
#100 r1=0;
#100 r1=1;
wait(a1);
#100 r1=0;
#1000 $display("timeout"); $finish(0);
end
endmodule