Skip to content

Commit

Permalink
Add regression test for return type of $bits (issue #1163).
Browse files Browse the repository at this point in the history
  • Loading branch information
martinwhitaker committed Sep 7, 2024
1 parent 0136db7 commit 2ab57a2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ivtest/ivltests/br_gh1163.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
`define check(expr) \
result = expr; \
$display("%b", result); \
if (result !== 32'b11111111111111111111111111011111) failed = 1;

module top;
integer x;
localparam Y = 1'sb1;
localparam integer Z = 1'sb1;
reg [31:0] result;
reg failed = 0;
initial begin
`check($bits(x) ^ 1'sb1);
`check($bits(x) ^ Y);
`check($bits(x) ^ Z);
`check($signed($bits(x)) ^ 1'sb1);
`check($signed($bits(x)) ^ Y);
`check($signed($bits(x)) ^ Z);
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 @@ -59,6 +59,7 @@ br_gh1143f vvp_tests/br_gh1143f.json
br_gh1143g vvp_tests/br_gh1143g.json
br_gh1143h vvp_tests/br_gh1143h.json
br_gh1155 vvp_tests/br_gh1155.json
br_gh1163 vvp_tests/br_gh1163.json
ca_time_real` vvp_tests/ca_time_real.json
case1 vvp_tests/case1.json
case2 vvp_tests/case2.json
Expand Down
4 changes: 4 additions & 0 deletions ivtest/vvp_tests/br_gh1163.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type" : "normal",
"source" : "br_gh1163.v"
}

0 comments on commit 2ab57a2

Please sign in to comment.