Files
iverilog/ivtest/ivltests/sv_darray_reverse.v
T
mjoekhan afe849249c SV: reverse(), sort(), rsort(), shuffle() for queues/darrays
Add ordering methods for queues and dynamic arrays.  Update ivtest gold
files for always_*_warn, br1005, and br_gh710b LXT per review.

Split from steveicarus/iverilog#1330 (part 06/6).
2026-07-21 11:01:29 +05:00

33 lines
539 B
Verilog

// Regression: dynamic array reverse() ordering method.
module top;
bit failed = 0;
`define CHK(cond) \
if (!(cond)) begin \
$display("FAILED line %0d", `__LINE__); \
failed = 1; \
end
int a[];
initial begin
a = '{1, 2, 3, 4};
a.reverse();
`CHK(a[0] === 4 && a[1] === 3 && a[2] === 2 && a[3] === 1);
a = new [1];
a[0] = 42;
a.reverse();
`CHK(a[0] === 42);
a = new [0];
a.reverse();
`CHK(a.size() === 0);
if (!failed)
$display("PASSED");
end
endmodule