User guide

24-167
SystemVerilog Testbench Constructs
In the first example the elements in the queue1 are sorted in
descending order of their values provided they are of a integral type.
In the second example queue2 is a queue of class objects and the
class contains an element i and r, now the objects are sorted in
descending order depending on the product value of the member
variable i and r.
Array locator methods
- Array locator methods
- Array index locator methods
The array locator methods are used to search all the element in an
array that satisfies a given expression. These methods return a queue
containing all element that satisfy the expression.
The array index locator methods are used to search an array for all
the indices that satisfies a given expression and returns an integer
queue with the indices of all elements that satisfy the expression.
Note: For associative arrays the array index locator methods return
a queue of their index type with the indices of all elements that
satisfy the expression..
find()
The find() method finds all the elements satisfying the expression using
the with construct. If the match fails or if the array is empty an empty
queue is returned. The with expression is required and is not optional.
Syntax
function array_type[$] array_name.find() with (expression);