Tutorials

SEQUENCES

Boolean logic doenot have the concept of time. Temporal logic is boolean logic with time as one more dimention. Sequence allows us to define temporal nature of the signals using temporal expressions.

Sequences can be composed by concatenation, analogous to a concatenation of lists. The concatenation specifies a delay, using ##, from the end of the first sequence until the beginning of the second sequence.
## indicates cycle delay.

Fixed Delay:

A ## followed by a number specifies the delay from the current clock tick to the beginning of the sequence that follows.

EXAMPLE:
req ##2 gnt

This specifies that req shall be true on the current clock tick, and gnt shall be true on the second subsequent clock tick

Zero Delay:

The delay ##0 indicates that the beginning of the second sequence is at the same clock tick as the end of the first sequence. This can also be archived using boolean expressions && .

EXAMPLE:
sig1 ##0 sig2

This specifies that sig1 shall be true on the current clock tick, and sig2 shall be true on the same clock tick.

Constant Range Delay:

A ##[n:m] followed by a range specifies the delay from the current clock tick to the beginning of the sequence that follows.

EXAMPLE:
req ##[2:5] ack

This specifies that ack shall be true ,2-5 cycles after req. It creates multiple subsequence threads. This resulst in multiple hits or fails.
Sub sequences created by range delay in above expressions:
req ##2 ack
req ##3 ack
req ##4 ack
req ##5 ack

Unbounded Delay Range:

The \$ token is used to indicate the end of simulation.
##[n:\$] specifies that delay from between n cycles later and till the end of simulation.

EXAMPLE:
req##[4:\$] ack;

This specifies that ack must be true atleast 4 cycles later .

Repetation Operators:

The number of iterations of a repetition can either be specified by exact count or be required to fall within a finite range. If specified by exact count, then the number of iterations is defined by a non-negative integer constant expression. If required to fall within a finite range, then the minimum number of iterations is defined by a non-negative integer constant expression; and the maximum number of iterations either is defined by a non-negative integer constant expression or is \$, indicating a finite, but unbounded, maximum.

Consecutive Repetition:

Consecutive repetition specifies finitely many iterative matches of the operand sequence, with a delay of one clock tick from the end of one match to the beginning of the next. The overall repetition sequence matches at the end of the last iterative match of the operand.

EXAMPLE:
REQ[*4]

This example specifies that ack shell come after req comes 4 times consecutively.

Goto Repetition :

Goto repetition specifies finitely many iterative matches of the operand boolean expression, with a delay of one or more clock ticks from one match of the operand to the next successive match and no match of the operand strictly in between. The overall repetition sequence matches at the last iterative match of the operand.

EXAMPLE:
req[->3]##1 ack

This example specifies that ack shell come after req comes 3 times with no gap between thw last req and ack.

Nonconsecutive Repetition:

Nonconsecutive repetition specifies finitely many iterative matches of the operand boolean expression, with a delay of one or more clock ticks from one match
of the operand to the next successive match and no match of the operand strictly in between. The overall repetition sequence matches at or after the last iterative match of the operand, but before any later match of the operand.

EXAMPLE:
req[=3]##1 ack

This example specifies that ack shell come after req comes 4 times with gap between thw last req and ack.

Sequence And :

Sequence must start and can end at the any time. Match is done after last sequence is ended.

EXAMPLE:
Seq1 and seq2

Sequence Or:

Sequence must start at the same time and can end at any time. Match is done at both the sequences ends.

EXAMPLE:
seq1 or seq2

Sequence Intersect:

sequences must start at the same time and end at same tine. Match is done at the end time.

EXAMPLE:
Seq1 intersect seq2

Sequence Within

One sequence can fully contain another sequence

EXAMPLE:
Seq1 within seq2

Sequence First_match:

Matches only the first match and ignores other matches.

EXAMPLE:
first_match(seq1)

Sequence Throughout

The throughout operator requires a boolean to be true throughout a sequence.

EXAMPLE:
A throughout seq1

Sequence Ended:

The end point of a sequence is reached whenever the ending clock tick of a match of the sequence is reached, regardless of the starting lock tick of the match. The reaching of the end point can be tested by using the method ended.

EXAMPLE:
sequence e1;
@(posedge sysclk) \$rose(ready) ##1 proc1 ##1 proc2 ;
endsequence
sequence rule;
@(posedge sysclk) reset ##1 inst ##1 e1.ended ##1 branch_back;
endsequence

Operator Precedence Associativy:

Operator precedence and associativity are listed in the following Table . The highest precedence is listed first.

Index
Introduction
Event Simulation
Assertion Types
Concurrent Assertion Layers
Sequences
Properties
Verification Directive

Report a Bug or Comment on This section - Your input is what keeps Testbench.in improving with time!

 << PREVIOUS PAGE TOP NEXT PAGE >>