SystemVerilog Assertions: Interactive Playground & Studio
Master concurrent assertions, temporal logic, sequences, and properties. Interactive multi-track waveform editor, real-time SVA evaluation engine, cycle-by-cycle antecedent/consequent trace inspector, and synthesizable verification checker library.
SVA Interactive Verification Studio
Click any bit in the timing diagram below to toggle signal levels between 0 and 1. The built-in SVA evaluation engine re-verifies the assertion on every posedge clk and reports passes, violations, and vacuous successes in real time.
Cycle-by-Cycle SVA Execution Trace
Synthesizable SystemVerilog SVA Code
SystemVerilog Assertions (IEEE 1800) provides rich temporal operators to express complex protocol rules concisely.
| Operator / Construct | Syntax | Temporal Meaning | Example Use Case |
|---|---|---|---|
| Overlapping Implication | A |-> B |
If antecedent A holds at clock tick $T$, consequent B must start evaluating at the exact same tick $T$. |
Combinational protocol rule, immediate bus grant. |
| Non-Overlapping Implication | A |=> B |
Equivalent to A |-> ##1 B. If A holds at $T$, B must start at tick $T+1$. |
Pipelined registers, next-cycle handshake responses. |
| Cycle Delay | ##N |
Exact delay of $N$ clock edges. | req |=> ##2 ack (2 cycles after req). |
| Bounded Delay Range | ##[min:max] |
Consequent must match anywhere between min and max cycles (inclusive). |
req |-> ##[1:5] ack (ACK within 5 cycles). |
| Consecutive Repetition | expr [*N] |
Expression must remain true for exactly $N$ consecutive clock ticks. | valid [*4] (Burst transfer of 4 beats). |
| Non-Consecutive Repetition | expr [=N] |
Expression matches $N$ times overall, with arbitrary gaps, ending at any cycle. | Packet counter matches $N$ errors. |
| Goto Repetition | expr [->N] |
Like non-consecutive repetition, but the sequence completes on the exact cycle of the $N$-th match. | Waiting for the $N$-th valid packet. |
| Rose Edge Detector | $rose(sig) |
Returns true if sig transitioned from 0 to 1 between previous and current posedge. |
Detecting start of packet, interrupt assertion. |
| Fell Edge Detector | $fell(sig) |
Returns true if sig transitioned from 1 to 0. |
Detecting de-assertion of reset or busy flags. |
| Signal Stability | $stable(sig) |
Returns true if sig maintained the exact same value as previous clock tick. |
Ensuring AXI data payload doesn't mutate while waiting. |
| Historical Past Sampling | $past(sig, N) |
Returns value of sig exactly $N$ clock ticks in the past. |
Comparing FIFO pop data with previously pushed word. |
| One-Hot Check | $onehot(sig) |
Returns true if exactly one bit is set in bitvector (or $onehot0 for 0 or 1 bit). |
Arbiter grant vectors, state machine one-hot states. |
In Verilog simulators, concurrent assertions sample signals in the Preponed region of the Stratified Event Queue (immediately before the active posedge clock edge triggers). This guarantees zero race conditions with RTL non-blocking (<=) assignments executed in the Active/NBA regions.
Production-grade, reusable SystemVerilog assertion (SVA) bind modules for industry-standard digital interfaces. Copy and bind directly into your design testbenches.
1. SystemVerilog Assertions Architecture: Immediate vs Concurrent
SystemVerilog Assertions (SVA) was standardized in IEEE 1800 to bring formal temporal specification directly into hardware description language. Rather than writing thousands of lines of procedural Verilog checking tasks, SVA allows verification engineers to specify protocol invariants and temporal relationships declaratively.
| Metric | Immediate Assertions | Concurrent Assertions |
|---|---|---|
| Evaluation Mode | Procedural (executes inside always or initial blocks) | Clock-driven (sampled on clock edges: @(posedge clk)) |
| Simulation Region | Active region (susceptible to simulation delta-cycle race glitches) | Preponed region (stable values sampled before clock edge) |
| Temporal Capabilities | Single time-step only (combinational check) | Multi-cycle temporal sequences (##N, [*N], throughout) |
| Formal Verification | Limited synthesis | Full support for Model Checking & Formal Property Verification |
| Syntax | assert (req == 1'b0); | assert property (@(posedge clk) req |-> ##1 ack); |
2. Anatomy of a Concurrent Assertion: Booleans, Sequences & Properties
A concurrent assertion is constructed hierarchically across three distinct layers:
- Boolean Layer: Simple expressions that evaluate to true or false in a single cycle (e.g.,
req && !ack,data == 8'hAA). - Sequence Layer: Groups boolean expressions over one or more clock cycles using temporal operators (e.g.,
sequence s_req_ack; req ##[1:3] ack; endsequence). - Property Layer: Encapsulates sequences and specifies temporal causality using implication operators (
|->or|=>), clocking domains, and disable conditions (such as reset).
disable iff Reset Guard:
Always protect concurrent assertions from false violations during system reset by applying disable iff (!rst_n). When reset is asserted active-low, all pending sequence threads are immediately terminated cleanly without reporting errors.
3. Understanding Vacuous Success in Assertions
One of the most common pitfalls in formal and dynamic verification is the Vacuous Success. In an implication assertion:
If req is 0 (low), the antecedent does NOT match. Because the precondition was never met, the consequent (##1 ack) is never tested, and the simulator marks the assertion as vacuously passed.
If an RTL bug prevents req from ever asserting during a 10-million cycle testbench simulation, the assertion will report a 100% pass rate! To catch this insidious bug, verification engineers always pair assert property with a corresponding cover property to guarantee that the antecedent was actually exercised in simulation.
4. SVA Frequently Asked Questions
What is the difference between |-> and |=> in SVA?
Overlapping Implication (|->): The consequent is evaluated in the same clock cycle that the antecedent succeeds. For example, req |-> ack means if req is high at clock tick 4, ack must also be high at clock tick 4.
Non-Overlapping Implication (|=>): The consequent is evaluated in the next clock cycle. req |=> ack is functionally identical to req |-> ##1 ack.
Why must signals be sampled in the Preponed region?
In digital simulation, sequential logic updates on clock edges via Non-Blocking Assignments (<=) in the NBA region. If assertions evaluated concurrently in the Active or NBA region, race conditions would occur between the clock edge and the data transition. Sampling in the Preponed region (before any clock events occur) captures the clean, settled values from immediately before the clock edge, mirroring physical flip-flop setup-time behavior.
How do $onehot and $onehot0 differ?
$onehot(expr) returns true only if exactly 1 bit is set in the expression vector (e.g. 4'b0010). If all bits are zero (4'b0000), it returns false.
$onehot0(expr) returns true if at most 1 bit is set (i.e. all bits zero or exactly one bit set). This is ideal for arbiters where no master may have an active grant in idle cycles.
How can I bind SVA modules into existing RTL without touching the source code?
SystemVerilog provides the bind construct. For example:
bind fifo_core fifo_assertions_sva u_sva_inst (.*);
This automatically instantiates and connects the assertion module inside all instances of fifo_core at compile time without altering golden production RTL.
Explore Verification & Protocol Tools
Accelerate your verification, protocols, and timing analysis workflow: