User guide
24-170
SystemVerilog Testbench Constructs
find_last()
The find_last() method returns a queue with the last element
satisfying the expression. 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
function array_type[$] array_name.last() with (expression);
Example 24-34
value = array1.last() with (item == 5);
object = array1.last() with (item.x == 5);
In the first example, the last element which is equal to 5 is returned.
In the second example, the last element that has its member variable
x equal to 5 is returned.
find_last_index()
The find_last_index() method returns a queue with the last index
satisfying the expression. If the array is empty or no match is found with the
expression then an empty queue is returned. The with expression is
required and is not optional.
Syntax
function int_or_index_type[$] array_name.find_last_index()
with (expression);
Example 24-35
value = array1. find_last_index() with (item > 5);
value = array1. find_last_index() with (item.x == 5);