Files
iverilog/ivtest/ivltests/pr3011327.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

43 lines
883 B
Verilog

module main;
reg pass;
genvar i;
generate
for( i=1; i<3; i=i+1 )
begin : U
reg [1:0] x;
end
for( i=0; i<2; i=i+1 )
begin : V
initial begin
U[(i+1)%4].x = 2'd0;
#5;
U[(i+1)%4].x = i;
end
end
endgenerate
initial begin
pass = 1'b1;
#4;
if (U[1].x != 2'd0) begin
$display("Failed to clear U[1].x, got %b", U[1].x);
pass = 1'b0;
end
if (U[2].x != 2'd0) begin
$display("Failed to clear U[2].x, got %b", U[1].x);
pass = 1'b0;
end
#2;
if (U[1].x != 2'd0) begin
$display("Failed to set U[1].x, expected 2'd0, got %b", U[1].x);
pass = 1'b0;
end
if (U[2].x != 2'd1) begin
$display("Failed to set U[2].x, expected 2'd1, got %b", U[1].x);
pass = 1'b0;
end
if (pass) $display("PASSED");
end
endmodule