Other Operators
Last modified 2013-10-16
Sini
Operator AND
The binary operator AND is used when both operands are expected to match, but the end times of the operand sequences may be different. That means, when one of the operand sequence match, it waits for the other to match. Please note that both sequence must start at the same time.
sequence myseq1; x ##2 y; endsequence: myseq1
sequence myseq2; z ##4 y; endsequence: myseq2
sequence seqAND; myseq1 and myseq2; endsequence: seqAND
The seqAND will match only if both myseq1 and myseq2 match.
Operator OR
The binary operator or is used when at least one of the two operand sequences is expected to match. Both of the sequences start at the same time and end times may be different.
sequence myseq1; x ##2 y; endsequence: myseq1
sequence myseq2; z ##4 y; endsequence: myseq2
sequence seqOR; myseq1 or myseq2; endsequence: seqOR
The seqOR will match if one of the sequences (myseq1 or myseq2) match.
Operator INTERSECT
The binary operator intersect is used when both operand sequences are expected to match, and the end times of the operand sequences must be the same. The end time of resulting sequence is the common end time of the two operand sequences.
The intersect operator is very similar to the and operator with the difference that both sequences complete at the same time.
sequence myseq1; x ##[1:5] y; endsequence: myseq1
sequence myseq2; x ##3 y; endsequence: myseq2
sequence seq; myseq1 intersect myseq2; endsequence: seq
Operator firstmatch
This operator matches only the first of possibly multiple matches for an evaluation attempt of its operand sequence and it returns a sequence.
This allows all subsequent matches to be discarded from consideration.
sequence myseq1; (x ##[1:4] y) and (x ##[1:3] z); endsequence: myseq1
sequence myseq2; firstmatch( myseq1 ); endsequence: myseq2
Operator throughout
Sometimes a sequence is only valid under the assumption that a certain condition is true during this sequence. In such cases, use the throughout operator in order to check a boolean expression in parallel to a sequence. The expression must evaluate to true at each clock tick of the sequence.
For example, the signal enable must be asserted during the entire req-ack-done handshaking.
sequence myseq1; req ##[1:5] ack ##[1:7] done; endsequence: myseq1
sequence myseq2; en throughout myseq1; endsequence: myseq2;
Operator within
The containment of a sequence within another sequence can be expressed using within operator.
seq1 within seq2 -start point of the match of seq1 shall be no earlier than the start point of the match of seq2. -end point of the match of seq1 shall be no later than the end point of the match of seq2 -seq2 matches along the interval and seq1 matches along some subinterval of consecutive clockticks.
In the window, start with "rdy" and end with "done", the design must have 8 "read"s.
sequence myseq1; read[=8] within (rdy ##[9:15] done); endsequence: myseq1
Operator Precedence [high to low]
- repetition [*] [=] [->]
- delay ##
- throughout
- within
- intersect
- and
- or