Files
iverilog/ivtest/ivltests/sv_queue_function2.v
T
Lars-Peter Clausen f42ab248a4 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 <[email protected]>
2022-04-18 09:58:02 +02:00

25 lines
413 B
Verilog

// 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