User guide
24-168
SystemVerilog Testbench Constructs
Example 24-30
queue2 = queue1.find() with (queue1.leg() > 5);
In the example, queue1 contains a set of strings, all the elements
whose string length is greater than 5 are returned and they are
assigned in the same order to the queue queue2.
find_index()
The find_index() method returns the indexes of 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 int_or_index_type[$] array_name.find_index()
with (expression);
Example 24-31
indices1 = queue1.find_index() with (item > 5);
In the example, all the indices of the elements that are greater than
5 are returned and they are assigned in the same order to the queue
indices1.
find_first()
The find_first()method finds the first element satisfying the
expression using the with construct. If the array is empty, a warning
message is issued and an empty queue is returned. The with expression is
required and is not optional.
Syntax