User guide
24-176
SystemVerilog Testbench Constructs
Example 24-43
value = Qint.or(); // Calculates sum of all elements
value = QPacket.or()with (item.pkt_size ); // Computes bitwise
// OR of member pkt_size for all elements of queue QPacket.
In the first example the bitwise OR of all the elements of the queue
Qint is calculated. The second example computes bitwise OR of
member variable pkt_size for all elements of queue QPacket is
calculated.
xor()
The xor() method computes the logical xor (^) of all the array
elements for integral types. The with expression is optional for integral
types. When the with expression is specified for non-integral types they
returns the logical xor (^) of the member variables specified using the
with expression.
Syntax
function expression_or_array_type array_name.xor() [with (expression)];
Example 24-44
value = Qint.xor(); // Calculates XOR of all elements
value = QPacket.xor()with (item.pkt_size ); // Computes bitwise
// XOR of member pkt_size for all elements of queue QPacket.
In the first example the logical XOR of all the elements of the queue
Qint is calculated. The second example computes logical XOR of
member variable pkt_size for all elements of queue QPacket is
calculated.