SVA Sequences

A Sequence is a linear series of events. It is the fundamental reusable block of SVA. Sequences describe "what happens" (e.g., A then B then C) which can then be used in properties.

Defining a Sequence

Use the sequence keyword. Sequences can be declared in modules, interfaces, programs, or packages.

Basic Sequence
sequence s_burst_start;
    // req goes high, then 2 cycles later ack is high
    req ##2 ack;
endsequence

Parameterized Sequences

Sequences are like functions—you can pass arguments to them. This makes them highly reusable across different signals in your design.

Reusable Pulse Check
// Sequence to check if 'sig' holds value 'val' for 'N' cycles
sequence s_hold_value(signal, val, N);
    (signal == val) [*N];
endsequence

property p_reset_check;
    @(posedge clk) $rose(reset) |-> s_hold_value(enable, 0, 5);
endproperty

Combining Sequences

You can combine sequences using logical operators.

  • seq1 and seq2: Both start at same time. Both must succeed (can end at different times). Global success is when the last one finishes.
  • seq1 or seq2: At least one must succeed.
  • seq1 intersect seq2: Both must start together AND end together.

Common Interview Questions

Q: Can a sequence fail on its own?
A sequence describes a pattern. If it's used as a "check" (in assertions), failure results in an error. If used as a condition (antecedent), failure just means "condition not met". A sequence itself is just a definition.
Q: What is the difference between 'and' and 'intersect'?
intersect requires the two sequences to be of equal length (start and end together). and only requires them to start and succeed, regardless of length (the composite sequence ends when the longer one ends).