Add regression test for continuous assignment to 2-state arrays

Check that continuous assignments to both signed and unsigned 2-state
arrays are supported.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2023-10-15 09:57:42 -07:00
parent 52a8b31ac3
commit b7ef0b5d88
3 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,30 @@
// Check that continuous assignments to 2-state arrays are supported.
module test;
bit failed = 1'b0;
`define check(expr, val) do \
if (expr !== val) begin \
$display("FAILED(%0d): `%s`, expected %0d, got %0d", `__LINE__, `"expr`", val, expr); \
failed = 1'b1; \
end \
while (0)
int a1[0:1];
bit [31:0] a2[0:1];
assign a1[0] = -10;
assign a2[0] = 20;
initial begin
#0
`check(a1[0], -10);
`check(a2[0], 20);
if (!failed) begin
$display("PASSED");
end
end
endmodule

View File

@ -62,6 +62,7 @@ sv_array_assign_fail1 vvp_tests/sv_array_assign_fail1.json
sv_array_assign_fail2 vvp_tests/sv_array_assign_fail2.json
sv_array_cassign6 vvp_tests/sv_array_cassign6.json
sv_array_cassign7 vvp_tests/sv_array_cassign7.json
sv_array_cassign8 vvp_tests/sv_array_cassign8.json
sv_automatic_2state vvp_tests/sv_automatic_2state.json
sv_chained_constructor1 vvp_tests/sv_chained_constructor1.json
sv_chained_constructor2 vvp_tests/sv_chained_constructor2.json

View File

@ -0,0 +1,5 @@
{
"type" : "normal",
"source" : "sv_array_cassign8.v",
"iverilog-args" : [ "-g2009" ]
}