User guide
24-175
SystemVerilog Testbench Constructs
and()
The and() method computes the bitwise AND (&) 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
bitwise AND (&) of the member variables specified using the with
expression.
Syntax
function expression_or_array_type array_name.and() [with (expression)];
Example 24-42
value = Qint.and(); // Calculates bitwise AND of all elements
value = QPacket.and() with (item.pkt_size ); // Computes bitwise
// AND of member pkt_size for all elements of queue QPacket.
In the first example the bitwise AND of all the elements of the queue
Qint is calculated. The second example computes bitwise AND of
member variable pkt_size for all elements of queue QPacket is
calculated.
or()
The or() method computes the bitwise OR (|) 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
bitwise OR (|) of the member variables specified using the with
expression.
Syntax
function expression_or_array_type array_name.or() [with (expression)];