Skip to content

Commit c7530db

Browse files
committed
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>
1 parent e47160c commit c7530db

3 files changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Check that assignment patterns are supported for queue method arguments.
2+
3+
module test;
4+
5+
bit failed;
6+
bit [1:0][3:0] q[$];
7+
8+
`define check(val, exp) do begin \
9+
if (val !== exp) begin \
10+
$display("FAILED(%0d). '%s' expected %0h, got %0h", `__LINE__, \
11+
`"val`", exp, val); \
12+
failed = 1'b1; \
13+
end \
14+
end while (0)
15+
16+
initial begin
17+
failed = 1'b0;
18+
19+
q.push_back('{4'h1, 4'h2});
20+
q.push_front('{4'h3, 4'h4});
21+
q.insert(1, '{4'h5, 4'h6});
22+
23+
`check(q.size(), 3);
24+
`check(q[0], 8'h34);
25+
`check(q[1], 8'h56);
26+
`check(q[2], 8'h12);
27+
28+
if (!failed) begin
29+
$display("PASSED");
30+
end
31+
end
32+
33+
endmodule

ivtest/regress-vvp.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ sv_net_decl_assign vvp_tests/sv_net_decl_assign.json
349349
sv_package_lifetime vvp_tests/sv_package_lifetime.json
350350
sv_package_lifetime_fail vvp_tests/sv_package_lifetime_fail.json
351351
sv_parameter_type vvp_tests/sv_parameter_type.json
352+
sv_queue_ap_method vvp_tests/sv_queue_ap_method.json
352353
sv_queue_assign_op vvp_tests/sv_queue_assign_op.json
353354
sv_soft_packed_union vvp_tests/sv_soft_packed_union.json
354355
sv_soft_packed_union_fail1 vvp_tests/sv_soft_packed_union_fail1.json
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type" : "normal",
3+
"source" : "sv_queue_ap_method.v",
4+
"iverilog-args" : [ "-g2005-sv" ],
5+
"vlog95" : {
6+
"__comment" : "Queues are not supported",
7+
"type" : "CE"
8+
}
9+
}

0 commit comments

Comments
 (0)