Add regression test for assignment patterns as queue method arguments

Check that assignment patterns are evaluated in the queue element type
context when they are passed to the queue `push_front()`, `push_back()` and
`insert()` methods.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2026-05-25 20:25:07 -07:00
parent 21d09f71c8
commit 5f4bf3c2e8
3 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,33 @@
// Check that assignment patterns are supported for queue method arguments.
module test;
bit failed;
bit [1:0][3:0] q[$];
`define check(val, exp) do begin \
if (val !== exp) begin \
$display("FAILED(%0d). '%s' expected %0h, got %0h", `__LINE__, \
`"val`", exp, val); \
failed = 1'b1; \
end \
end while (0)
initial begin
failed = 1'b0;
q.push_back('{4'h1, 4'h2});
q.push_front('{4'h3, 4'h4});
q.insert(1, '{4'h5, 4'h6});
`check(q.size(), 3);
`check(q[0], 8'h34);
`check(q[1], 8'h56);
`check(q[2], 8'h12);
if (!failed) begin
$display("PASSED");
end
end
endmodule

View File

@ -349,6 +349,7 @@ sv_net_decl_assign vvp_tests/sv_net_decl_assign.json
sv_package_lifetime vvp_tests/sv_package_lifetime.json
sv_package_lifetime_fail vvp_tests/sv_package_lifetime_fail.json
sv_parameter_type vvp_tests/sv_parameter_type.json
sv_queue_ap_method vvp_tests/sv_queue_ap_method.json
sv_queue_assign_op vvp_tests/sv_queue_assign_op.json
sv_soft_packed_union vvp_tests/sv_soft_packed_union.json
sv_soft_packed_union_fail1 vvp_tests/sv_soft_packed_union_fail1.json

View File

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