Skip to content

Commit

Permalink
Add regression test for issue #703.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinwhitaker committed Feb 9, 2024
1 parent 855dd3a commit 72e86d3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
44 changes: 44 additions & 0 deletions ivtest/ivltests/br_gh703.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
module test;

logic [7:0] dout;
logic [7:0] sel;

for (genvar i = 0; i < 8; i++) begin
if (i == 0) begin

assign dout[i] = 1'b0;

end else if (i == 1) begin

assign dout[i] = 1'b1;

end else begin

// using always block reports error
always @(*) begin
if (sel[i]) dout[i] = 1'b1;
else dout[i] = 1'b0;
end

end
end

logic [7:0] expected;

reg failed = 0;

initial begin
sel = 8'd1;
repeat (8) begin
#1 $display("%b %b", sel, dout);
expected = sel & 8'b11111100 | 8'b00000010;
if (dout !== expected) failed = 1;
sel = sel << 1;
end
if (failed)
$display("FAILED");
else
$display("PASSED");
end

endmodule
1 change: 1 addition & 0 deletions ivtest/regress-vvp.list
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ br_gh383d vvp_tests/br_gh383d.json
br_gh440 vvp_tests/br_gh440.json
br_gh552 vvp_tests/br_gh552.json
br_gh687 vvp_tests/br_gh687.json
br_gh703 vvp_tests/br_gh703.json
br_gh710a vvp_tests/br_gh710a.json
br_gh710b vvp_tests/br_gh710b.json
br_gh710c vvp_tests/br_gh710c.json
Expand Down
5 changes: 5 additions & 0 deletions ivtest/vvp_tests/br_gh703.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type" : "normal",
"source" : "br_gh703.v",
"iverilog-args" : [ "-g2009" ]
}

0 comments on commit 72e86d3

Please sign in to comment.