Add regression test for functions with bounded queue return type

Check that the maximum size of a bounded queue is properly handled when
being used as the return type for a function.

Elements beyond the maximum size should be ignored.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-04-16 11:42:57 +02:00
parent 724d7d4282
commit f42ab248a4
4 changed files with 28 additions and 2 deletions

View File

@ -0,0 +1,24 @@
// Check that bounded queues are supported as function return types.
module test;
typedef int Q[$:1];
function automatic Q f();
// The last element should be discarded
return '{1, 2, 3};
endfunction
initial begin
int q[$];
q = f();
if (q.size() == 2 && q[0] == 1 && q[1] == 2) begin
$display("PASSED");
end else begin
$display("FAILED");
end
end
endmodule

View File

@ -582,7 +582,8 @@ sv_port_default14 CE,-g2009 ivltests
sv_queue1 normal,-g2009 ivltests
sv_queue2 normal,-g2009 ivltests
sv_queue3 normal,-g2009 ivltests
sv_queue_function normal,-g2009 ivltests
sv_queue_function1 normal,-g2009 ivltests
sv_queue_function2 normal,-g2009 ivltests
sv_queue_parray normal,-g2009,-pfileline=1 ivltests gold=sv_queue_parray.gold
sv_queue_parray_bounded normal,-g2009,-pfileline=1 ivltests gold=sv_queue_parray_bounded.gold
sv_queue_parray_fail CE,-g2009 ivltests gold=sv_queue_parray_fail.gold

View File

@ -470,7 +470,8 @@ pr3390385b CE,-g2009 ivltests # ++
pr3390385c CE,-g2009 ivltests # ++
pr3390385d CE,-g2009 ivltests # ++
pr3462145 CE,-g2009 ivltests # ++
sv_queue_function CE,-g2009,-pallowsigned=1 ivltests # queue
sv_queue_function1 CE,-g2009,-pallowsigned=1 ivltests # queue
sv_queue_function2 CE,-g2009,-pallowsigned=1 ivltests # queue
sv_typedef_darray_base1 CE,-g2009 ivltests # Dyanmic array
sv_typedef_darray_base2 CE,-g2009 ivltests # Dyanmic array
sv_typedef_darray_base3 CE,-g2009 ivltests # Dyanmic array