SVA Sequences III – Other Operators

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 my_seq1;
  x ##2 y;
endsequence: my_seq1

sequence my_seq2;
  z ##4 y;
endsequence: my_seq2

sequence seq_AND;
  my_seq1 and my_seq2;
endsequence: seq_AND

The seq_AND will match only if both my_seq1 and my_seq2 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 my_seq1;
  x ##2 y;
endsequence: my_seq1

sequence my_seq2;
  z ##4 y;
endsequence: my_seq2

sequence seq_OR;
  my_seq1 or my_seq2;
endsequence: seq_OR

The seq_OR will match if one of the sequences (my_seq1 or my_seq2) 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 my_seq1;
  x ##[1:5] y;
endsequence: my_seq1

sequence my_seq2;
  x ##3 y;
endsequence: my_seq2

sequence seq;
  my_seq1 intersect my_seq2;
endsequence: seq

Operator first_match

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 my_seq1;
  (x ##[1:4] y) and (x ##[1:3] z); 
endsequence: my_seq1

sequence my_seq2;
  first_match( my_seq1 ); 
endsequence: my_seq2

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 my_seq1;
   req ##[1:5] ack ##[1:7] done; 
endsequence: my_seq1

sequence my_seq2;
   en throughout my_seq1;
endsequence: my_seq2;

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 my_seq1;
 read[=8] within (rdy ##[9:15] done); 
endsequence: my_seq1

Operator Precedence [high to low]

  • repetition [*] [=] [->]
  • delay ##
  • throughout
  • within
  • intersect
  • and
  • or

Leave a Reply

Your email address will not be published. Required fields are marked *