ivtest: regress class property queue push/pop methods

Add vvp regression for push_front, push_back, pop_front, pop_back on
queue-typed class fields. Catches vvp opcode_table sort regressions that
surface as Invalid opcode at runtime.

Made-with: Cursor
This commit is contained in:
mjoekhan 2026-04-13 23:25:34 +05:00
parent d19b989212
commit 1a10f9d57b
3 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,39 @@
// Regression: queue-typed class properties push_front/push_back and
// pop_front/pop_back. (VVP asm must recognize %store/prop/qf/* and
// %qpop/prop/*; opcode_table must stay lexicographically sorted.)
module test;
bit failed = 1'b0;
`define check(val, exp) do \
if (val !== exp) begin \
$display("FAILED(%0d). expected %0d, got %0d", `__LINE__, exp, val); \
failed = 1'b1; \
end \
while(0)
class C;
int q[$];
endclass
C c;
int t;
initial begin
c = new;
c.q.push_back(1);
c.q.push_front(0);
c.q.push_back(2);
t = c.q.pop_back();
`check(t, 32'd2);
`check(c.q.size(), 32'd2);
t = c.q.pop_front();
`check(t, 32'd0);
`check(c.q[0], 32'd1);
if (!failed) begin
$display("PASSED");
end
end
endmodule

View File

@ -235,6 +235,7 @@ sv_class_prop_nest_obj1 vvp_tests/sv_class_prop_nest_obj1.json
sv_class_prop_nest_real1 vvp_tests/sv_class_prop_nest_str1.json
sv_class_prop_nest_str1 vvp_tests/sv_class_prop_nest_real1.json
sv_class_prop_nest_vec1 vvp_tests/sv_class_prop_nest_vec1.json
sv_class_queue_prop_methods vvp_tests/sv_class_queue_prop_methods.json
sv_const1 vvp_tests/sv_const1.json
sv_const2 vvp_tests/sv_const2.json
sv_const3 vvp_tests/sv_const3.json

View File

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