RTL Design / Module 10: Verification for RTL Designers
Lesson 10.3

Assertions (SVA lite) for RTL owners

Assertions are executable spec comments — they watch your design 24/7 during simulation and scream the moment an invariant breaks. RTL owners don't need full formal verification fluency; a handful of immediate and concurrent SVA patterns cover 80% of real blocks.

Definition

An assertion states a property that must always hold (or hold after a trigger). assert(condition) is the immediate form. assert property (@(posedge clk) ...) is the concurrent form — it monitors signals across clock cycles.

1

Two flavors — immediate vs concurrent

Immediate vs concurrent assertions

Start with immediate asserts in your RTL. Add concurrent properties for protocol timing you can't express in one line.

TypeSyntaxWhen to useSynth?
Immediateassert (expr) else $error(...)One-cycle invariants inside alwaysOften yes
Concurrentassert property (p) else $error(...)Multi-cycle protocol rulesDepends on tool
Assumeassume property (p)Constrain inputs (formal/sim)Sim / formal
Covercover property (p)Did this scenario ever happen?Sim only
2

Immediate asserts — RTL owners write these

Drop these inside your always blocks or at the end of a combinational block. They catch logic bugs during simulation and can sometimes synthesize into hardware checkers.

immediate_asserts.v
// Inside an always @(posedge clk) block:
always @(posedge clk) begin
  if (en && !full)
    wr_ptr <= wr_ptr + 1;

  // One-hot FSM check (sim + some synth flows)
  assert ($onehot(state))
    else $error("FSM state not one-hot: %b", state);

  // Mutually exclusive controls
  assert (!(wr_en && rd_en && empty))
    else $error("Read and write when empty");
end

// Combinational range check
always @(*) begin
  assert (addr < DEPTH)
    else $error("Address out of range: %0d", addr);
end
Trap

Don't assert on signals that are X during reset unless you guard with if (rst_n). Unconditional asserts during reset cause false failures and teach you to ignore assertion noise.

3

Concurrent SVA lite — the essentials

Concurrent assertions use properties — temporal expressions evaluated every clock edge. Three operators cover most RTL owner needs:

  • |-> (overlapping implication): if antecedent is true now, consequent must hold.
  • ##N (delay): wait N clock cycles.
  • $rose(sig) / $fell(sig): detect edges.
concurrent_sva.v — valid-ready protocol
// Valid-ready handshake: transfer only when both high
property p_xfer;
  @(posedge clk) disable iff (!rst_n)
    (s_valid && s_ready) |-> ##1 (data_captured);
endproperty
assert property (p_xfer) else $error("Transfer handshake violated");

// After reset release, FSM must reach IDLE within 3 cycles
property p_reset_to_idle;
  @(posedge clk) $rose(rst_n) |-> ##[1:3] (state == IDLE);
endproperty
assert property (p_reset_to_idle)
  else $error("FSM did not return to IDLE after reset");

// m_valid must stay high until m_ready
property p_valid_hold;
  @(posedge clk) disable iff (!rst_n)
    (m_valid && !m_ready) |=> m_valid;  // |=> non-overlapping next cycle
endproperty
assert property (p_valid_hold)
  else $error("m_valid dropped before handshake");

p_xfer checks data captured at cycle 3
p_valid_hold checks m_valid stays 1 after cycle 3

4

SVA operator cheat sheet

OperatorMeaningExample
|->If A now, then B (same cycle start)a |-> b
|=>If A now, then B next cyclea |=> b
##1Delay exactly 1 cyclea |-> ##1 b
##[1:5]Delay 1 to 5 cyclesa |-> ##[1:5] b
$rose(x)x went 0→1 this cycle$rose(req)
$fell(x)x went 1→0 this cycle$fell(ack)
disable iffSkip check when condition truedisable iff (!rst_n)
5

Synthesizable vs simulation-only

🔧

Synthesizable

Simple immediate asserts, one-hot checks, range checks. Some flows map these to hardware error flags.

🖥️

Sim-only

Complex ##[m:n] ranges, cover property, sequences with repetition. Keep in ifdef SIM or bind file.

📎

Bind file pattern

Put sim-only assertions in a separate *_assert.sv bound to DUT — keeps RTL clean for synthesis.

bind_assertions.sv — sim-only wrapper
// assertions bind file — not synthesized
`ifdef SIM
bind sync_fifo fifo_assertions #(
  .DEPTH(DEPTH)
) u_assert (
  .clk   (clk),
  .rst_n (rst_n),
  .wr_en (wr_en),
  .rd_en (rd_en),
  .full  (full),
  .empty (empty),
  .count (count)
);

module fifo_assertions #(parameter DEPTH=16) (
  input clk, rst_n, wr_en, rd_en, full, empty,
  input [$clog2(DEPTH+1)-1:0] count
);
  assert property (@(posedge clk) disable iff (!rst_n)
    full |-> !wr_en)
    else $error("Write when full!");

  assert property (@(posedge clk) disable iff (!rst_n)
    empty |-> !rd_en)
    else $error("Read when empty!");
endmodule
`endif
▶ Test assertions in simulator
6

FSM assertion example — RTL owner pattern

FSMs are the #1 place RTL owners add assertions. Encode legal transitions directly from your state diagram:

fsm_assertions.v
// States: IDLE=0, BUSY=1, DONE=2
localparam IDLE=0, BUSY=1, DONE=2;

// Only legal transitions (from state diagram)
property p_idle_to_busy;
  @(posedge clk) disable iff (!rst_n)
    (state == IDLE && start) |-> ##1 (state == BUSY);
endproperty

property p_busy_to_done;
  @(posedge clk) disable iff (!rst_n)
    (state == BUSY && done_flag) |-> ##1 (state == DONE);
endproperty

property p_done_to_idle;
  @(posedge clk) disable iff (!rst_n)
    (state == DONE && ack) |-> ##1 (state == IDLE);
endproperty

assert property (p_idle_to_busy)  else $error("Illegal: IDLE->? (not BUSY)");
assert property (p_busy_to_done)  else $error("Illegal: BUSY->? (not DONE)");
assert property (p_done_to_idle)  else $error("Illegal: DONE->? (not IDLE)");

// Cover: did we ever reach DONE? (functional coverage tie-in)
cover property (@(posedge clk) (state == DONE));
Legal FSM transitions (assert these): IDLE --(start)--> BUSY --(done_flag)--> DONE --(ack)--> IDLE Illegal (assertions catch): IDLE --?> DONE (skipped BUSY) BUSY --?> IDLE (without done_flag) DONE --?> BUSY (wrong direction)
7

What RTL owners should assert

  • Handshake invariants: valid held until ready; no transfer when not ready.
  • FSM legality: one-hot encoding; only legal transitions occur.
  • Pointer safety: no read when empty, no write when full.
  • Reset behavior: outputs deassert within N cycles of reset release.
  • X prevention: critical outputs never X after reset (where tool supports).

Rule of thumb: if you wrote it in the spec as "must never" or "shall always", it belongs in an assertion. If you wrote it as "output equals X when Y", it belongs in the testbench checker.

8

Assertion checklist

  • Immediate asserts for one-cycle invariants inside RTL or bind file
  • All asserts guarded with disable iff (!rst_n) or equivalent
  • Concurrent properties for multi-cycle protocol rules (valid-ready, req-ack)
  • Sim-only assertions wrapped in `ifdef SIM or placed in bind files
  • Every assertion has a descriptive $error message with signal values
  • Assertions reviewed against spec — not copy-pasted from TB checks

🎯 What to remember

  • Immediate asserts = "right now" checks. Concurrent = "over time" checks.
  • |->, ##N, $rose cover most RTL-owner protocol needs.
  • Guard assertions during reset; unguarded asserts create noise.
  • Keep sim-only SVA in bind files — synthesis stays clean.
Advertisement