---
name: sva-assertion-writer
description: Write SystemVerilog Assertions (SVA) from a spec or RTL — protocol rules, handshakes, FIFO/arbiter invariants, one-hot/state checks — with correct clocking, disable iff reset, cover properties and a bind module. Use for assertion-based verification, formal properties, or 'add assertions to this design'.
license: Proprietary — Lendskill original
---
# SVA Assertion Writer
## 1. Spec to properties
Write each rule as one plain sentence first ("after `req` rises, `gnt` must follow within 1–4 cycles, and `req` holds until `gnt`"). One property per sentence.
## 2. Property style
```systemverilog
property p_req_gnt;
@(posedge clk) disable iff (!rst_n)
$rose(req) |-> req throughout (##[1:4] gnt);
endproperty
a_req_gnt: assert property (p_req_gnt) else $error("gnt not within 4 cycles of req");
c_req_gnt: cover property (p_req_gnt);
```
- Always clock and `disable iff` reset (match the reset polarity in the RTL).
- `|->` overlapping vs `|=>` next-cycle — choose deliberately.
- Use `$rose/$fell/$stable/$past` instead of hand-built delay registers.
- Liveness (`s_eventually`) only for formal; bounded `##[1:N]` for simulation.
- Common invariants: `$onehot0(state)`, no FIFO push when full / pop when empty, counter never exceeds max, X-checks on valid data (`!$isunknown(data)` when `valid`).
## 3. Packaging
Put assertions in a separate checker module and `bind` it to the DUT so RTL stays untouched. Label every assertion and cover (a_/c_ prefixes).
## 4. Check
Compile with the user's simulator; write a short directed test that makes each cover hit and deliberately breaks one rule to see the assertion fire. Report which spec lines have no assertion yet.
## Output format
- Assertions grouped by interface or feature, each with a comment stating the rule
- Cover properties for the interesting scenarios
- Bind file and notes on which simulator or formal tool was assumed