Module 9: SystemVerilog for Design & Verification · 9.3 Assertions — SVA

Concurrent Assertions and Temporal Logic

Immediate assertions evaluate conditions at a single point in simulation time. However, hardware protocols define requirements across multiple clock cycles. For example, a bus protocol mandates that a request must receive an acknowledgment within four cycles. SystemVerilog concurrent assertions (SVA) evaluate temporal expressions across successive clock cycles.

Cycle Delays with the ## Operator

The ##N operator specifies a delay of exactly $N$ clock cycles between events:

// Sequence: req is true on one cycle, and ack is true two cycles later
sequence req_then_ack_2;
    req ##2 ack;
endsequence

Concurrent assertions require an explicit clocking event, such as @(posedge clk). The clock defines discrete sampling points for temporal logic evaluation.

Implication Operators: |-> and |=>

A sequence by itself triggers checks on every clock cycle. Hardware specifications usually require conditional checking: when a trigger condition occurs, a response must follow. SystemVerilog provides two implication operators:

  • Overlapping implication (|->): If the antecedent matches, the consequent evaluation begins on the identical clock cycle.
  • Non-overlapping implication (|=>): If the antecedent matches, the consequent evaluation begins on the subsequent clock cycle. The expression a |=> b is functionally equivalent to a |-> ##1 b.
// Overlapping: req triggers; ack must assert exactly two cycles later
property req_ack_overlapping;
    @(posedge clk) req |-> ##2 ack;
endproperty

assert property (req_ack_overlapping);

// Non-overlapping: req triggers; ack must assert on the next clock cycle
property ack_next_cycle;
    @(posedge clk) req |=> ack;
endproperty

assert property (ack_next_cycle);

req |-> ##2 ack on a waveform, and where |-> and |=> each check the consequent
Figure 1: Implication and the ## delay on a timing diagram

Built-In Sampled Value Functions

SystemVerilog provides built-in functions to detect signal transitions:

  • $rose(sig): Evaluates to true if the signal transitioned from 0 to 1.
  • $fell(sig): Evaluates to true if the signal transitioned from 1 to 0.
  • $stable(sig): Evaluates to true if the signal maintained its previous value.

Consider a synchronous FIFO. When the full flag asserts, it must remain high until a read occurs:

property full_is_stable;
    @(posedge clk) $rose(full) && !rd_en |=> full;
endproperty

assert property (full_is_stable)
else $error("FIFO full flag dropped without a read operation");

This multi-cycle assertion monitors the FIFO continuously throughout simulation. Industry bus specifications like AXI and PCIe use concurrent assertions to enforce interface rules formally.

Practice Exercise

Write a concurrent assertion for an SPI bus. When active-low chip select (cs_n) falls, serial clock (sclk) must remain unchanged on the next cycle. Assume signal cs_n_falling evaluates to true on the cycle cs_n transitions low.

Solution
property cs_settle_before_clock;
    @(posedge clk) cs_n_falling |=> $stable(sclk);
endproperty

assert property (cs_settle_before_clock)
else $error("sclk toggled immediately after cs_n assertion: settling time violated");

The $stable(sclk) function verifies that sclk does not toggle on the subsequent cycle. The non-overlapping implication operator |=> evaluates the stability rule one clock cycle after chip select asserts.

Concurrent assertions monitor temporal relationships across multiple clock edges. The ##N operator defines cycle delays, while |-> and |=> define conditional implication. Built-in functions like $rose, $fell, and $stable track signal transitions across clock boundaries. The next article explains how to encapsulate temporal rules into reusable sequences and properties.

← Immediate Assertions Writing Properties and Sequences →