User guide

24-165
SystemVerilog Testbench Constructs
Array manipulation methods
VCS-NTB provides the following types of built-in methods for
analyzing and manipulating arrays.
- Array ordering methods
- Array locator methods
- Array reduction methods
Note: For the integral types the with construct is not required but for
non integral type like class objects, mailbox or semaphores using
the with construct enhances the array manipulation methods
ability to deliver.
Array ordering methods
The array ordering methods are used to change the order and
rearrange the elements of any arrays.
reverse()
The reverse() method puts all the elements in the reverse order.
Specifying a with construct here will result in a compiler error.
Syntax
task array_name.reverse();
Example 24-27
int SQint[$] = {1, 2, 3, 4}; //SQint contains 1, 2, 3, 4
SQint.reverse(); // SQint contains 4, 3, 2, 1