Add regression tests for unpacked array continuous assignment strength and delay

Check that continuous assignments to unpacked net arrays preserve delay and
drive strength on the generated element drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2026-05-17 12:06:44 -07:00
parent ab6a0e0799
commit 635bdd8eb8
5 changed files with 103 additions and 0 deletions

View File

@ -0,0 +1,39 @@
// Check that continuous assignments to unpacked arrays preserve drive strength.
module test;
reg failed;
reg [8*3-1:0] s;
wire driven[0:1];
wire resolved[0:1];
assign (weak1, weak0) driven = '{1'b1, 1'b0};
assign resolved[0] = 1'b0;
assign resolved[1] = 1'b1;
assign (weak1, weak0) resolved = '{1'b1, 1'b0};
`define check_str(val, exp) begin \
$swrite(s, "%v", val); \
if (s != exp) begin \
$display("FAILED(%0d). '%s' expected %s, got %s", `__LINE__, \
`"val`", exp, s); \
failed = 1'b1; \
end \
end
initial begin
failed = 1'b0;
#0;
`check_str(driven[0], "We1");
`check_str(driven[1], "We0");
`check_str(resolved[0], "St0");
`check_str(resolved[1], "St1");
if (!failed) begin
$display("PASSED");
end
end
endmodule

View File

@ -0,0 +1,44 @@
// Check that continuous assignments to unpacked arrays preserve delay.
module test;
reg failed;
wire delayed[0:1];
reg value[0:1];
assign #5 delayed = value;
`define check(val, exp) \
if (val !== exp) begin \
$display("FAILED(%0d). '%s' expected %b, got %b", `__LINE__, \
`"val`", exp, val); \
failed = 1'b1; \
end
initial begin
failed = 1'b0;
value[0] = 1'b1;
value[1] = 1'b0;
#5;
`check(delayed[0], 1'b1)
`check(delayed[1], 1'b0)
value[0] = 1'b0;
value[1] = 1'b1;
#4;
`check(delayed[0], 1'b1)
`check(delayed[1], 1'b0)
#1;
`check(delayed[0], 1'b0)
`check(delayed[1], 1'b1)
if (!failed) begin
$display("PASSED");
end
end
endmodule

View File

@ -242,6 +242,8 @@ sv_array_assign_single_fail1 vvp_tests/sv_array_assign_single_fail1.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_array_cassign9 vvp_tests/sv_array_cassign9.json
sv_array_cassign10 vvp_tests/sv_array_cassign10.json
sv_array_cassign_single vvp_tests/sv_array_cassign_single.json
sv_array_cassign_single_fail1 vvp_tests/sv_array_cassign_single_fail1.json
sv_automatic_2state vvp_tests/sv_automatic_2state.json

View File

@ -0,0 +1,9 @@
{
"type" : "normal",
"source" : "sv_array_cassign10.v",
"iverilog-args" : [ "-g2005-sv" ],
"vlog95" : {
"__comment" : "Array nets are not supported",
"type" : "CE"
}
}

View File

@ -0,0 +1,9 @@
{
"type" : "normal",
"source" : "sv_array_cassign9.v",
"iverilog-args" : [ "-g2005-sv" ],
"vlog95" : {
"__comment" : "Array nets are not supported",
"type" : "CE"
}
}