1. Naming Conventions
| Target |
Pattern |
Example |
| Assert label |
a_{signal}_{condition} |
a_valid_hold, a_data_stable |
| Assume label |
m_{signal}_{constraint} |
m_valid_no_x, m_addr_aligned |
| Cover label |
c_{scenario} |
c_back_to_back, c_max_burst |
| Sequence |
seq_{name} |
seq_handshake, seq_burst_complete |
| Property |
prop_{name} |
prop_valid_hold, prop_fifo_no_overflow |
| SVA file |
sva_{module}.sv |
sva_axi_slave.sv |
| SVA bind module |
sva_{module}_checker |
sva_axi_slave_checker |
2. Clock/Reset Patterns
2.1 Basic Structure
// All concurrent assertions use default clocking + disable iff
default clocking cb @(posedge sys_clk); endclocking
default disable iff (!sys_rst_n);
2.2 Past-Valid Guard
The $past() value is invalid on the first cycle after reset, so use a guard:
logic past_valid;
always_ff @(posedge sys_clk or negedge sys_rst_n) begin
if (!sys_rst_n) past_valid <= 1'b0;
else past_valid <= 1'b1;
end
// Always check past_valid when using $past
a_data_stable: assert property (
past_valid && $rose(i_valid) |-> ##1 $stable(i_data)
) else $error("Data must be stable after valid rises");
3. Assertion Hygiene (Project Requirements)
- Every assertion has a label (per §1 naming) AND a failure message:
else $error("[%m] ... at %0t", $time)
- Concurrent asserts at module scope only — never
assert property inside always_comb,
never bare immediate assert(sig) inside always_ff (simulation-only, invisible to formal)
- Unknown checks use
$isunknown; verify assertion reachability with cover property
- Minimize
assume property (over-constraining discards traces); validate assumes with cover
- One-hot/mutex:
a_onehot_grant: assert property ($onehot0(o_grant)); — mutual exclusion:
assert property (!(o_read_en && o_write_en));
- Bounded liveness:
a_req_ack: assert property (i_req |-> ##[1:MAX_LATENCY] o_ack);
(unbounded eventually is unprovable by BMC — see §5.3)
- Handshake pattern reference:
templates/sva-bind-template.sv; FIFO safety/liveness:
examples/fifo-sva-example.sv
4. Bind-File-First Policy
Attach assertions externally via a sva_{module}_checker module + bind statement — do NOT
modify the RTL module. The checker module ports mirror the RTL port names verbatim
(i_/o_ prefixes, sys_clk, sys_rst_n), so the bind uses (.*):
bind my_module sva_my_module_checker u_sva_checker (.*);
Complete scaffold (checker module + default clocking/disable + bind): templates/sva-bind-template.sv.
5. SymbiYosys Integration
5.0 sv2v Conversion (Mandatory for SymbiYosys/Yosys)
SymbiYosys uses Yosys internally, which has limited SystemVerilog support.
RTL .sv files must be converted to Verilog via sv2v before running sby:
sv2v rtl/{module}/*.sv -o rtl/{module}/{module}_v2v.v
- The
.sby config [files] section must list the converted _v2v.v file, not .sv
- OSS SymbiYosys uses a generated immediate-assert harness top read with
-formal -sv
so Yosys keeps real $assert / $cover cells.
- SVA bind files / property files (
sva_*.sv) do NOT need conversion — they remain the
commercial/full-SVA path and are read with -formal -sv by tools that support bind.
- The RTL that the SVA binds to needs sv2v conversion
5.1 Formal Verification Modes
| Mode |
Purpose |
SBY Config |
| BMC (Bounded Model Check) |
Search for counterexamples within finite depth |
mode bmc, depth 20-50 |
| Induction (prove) |
Mathematical proof at unbounded depth |
mode prove |
| Cover |
Verify reachability of cover points |
mode cover |
5.2 assume vs assert
assume: input constraint for formal tool (behaves like assert in simulation)
assert: property under verification
- In formal, traces violating assume are discarded (beware of over-constraining!)
5.3 Liveness Caution
- BMC cannot prove liveness properties (eventually) — use prove mode
- Even in prove mode, infinite waits may cause induction failure → add bounds
1---2name: systemverilog-assertion3description: systemverilog-assertion project conventions (loaded by writer agents; do not invoke).4---56<Purpose>7SVA project conventions and formal-flow rules for .sva files and SVA blocks in .sv files.8Standard SVA semantics (property/sequence operators, assert/assume/cover/restrict usage) are9assumed known. Target standard: **IEEE 1800-2012** for SVA and verification code10(2012 adds checker, restrict property, sequence methods; 2017 was errata-only).11</Purpose>1213<Use_When>14- Writing .sva files, SVA bind files, or protocol assertions (AXI/APB/AHB); preparing for `rtl-p5s-sva-check`15- Agents: sva-extractor, testbench-dev, protocol-checker16</Use_When>1718<Do_Not_Use_When>19- Synthesizable RTL → `systemverilog` skill; cocotb verification → `rtl-p5s-func-verify` skill; UVM environments → `uvm` skill20</Do_Not_Use_When>2122<Execution_Policy>23- **Bind-file-first**: prefer bind files over embedding assertions inside RTL modules24- Every assertion is labeled and carries a failure message (`else $error(...)`)25- New SVA file scaffold + handshake (valid-hold/data-stable) patterns: `templates/sva-bind-template.sv`;26 FIFO safety/liveness/coverage patterns: `examples/fifo-sva-example.sv`27</Execution_Policy>2829<Steps>3031## 1. Naming Conventions3233| Target | Pattern | Example |34|--------|---------|---------|35| Assert label | `a_{signal}_{condition}` | `a_valid_hold`, `a_data_stable` |36| Assume label | `m_{signal}_{constraint}` | `m_valid_no_x`, `m_addr_aligned` |37| Cover label | `c_{scenario}` | `c_back_to_back`, `c_max_burst` |38| Sequence | `seq_{name}` | `seq_handshake`, `seq_burst_complete` |39| Property | `prop_{name}` | `prop_valid_hold`, `prop_fifo_no_overflow` |40| SVA file | `sva_{module}.sv` | `sva_axi_slave.sv` |41| SVA bind module | `sva_{module}_checker` | `sva_axi_slave_checker` |4243## 2. Clock/Reset Patterns4445### 2.1 Basic Structure46```systemverilog47// All concurrent assertions use default clocking + disable iff48default clocking cb @(posedge sys_clk); endclocking49default disable iff (!sys_rst_n);50```5152### 2.2 Past-Valid Guard53The $past() value is invalid on the first cycle after reset, so use a guard:54```systemverilog55logic past_valid;56always_ff @(posedge sys_clk or negedge sys_rst_n) begin57 if (!sys_rst_n) past_valid <= 1'b0;58 else past_valid <= 1'b1;59end6061// Always check past_valid when using $past62a_data_stable: assert property (63 past_valid && $rose(i_valid) |-> ##1 $stable(i_data)64) else $error("Data must be stable after valid rises");65```6667## 3. Assertion Hygiene (Project Requirements)6869- Every assertion has a label (per §1 naming) AND a failure message: `else $error("[%m] ... at %0t", $time)`70- Concurrent asserts at module scope only — never `assert property` inside `always_comb`,71 never bare immediate `assert(sig)` inside `always_ff` (simulation-only, invisible to formal)72- Unknown checks use `$isunknown`; verify assertion reachability with `cover property`73- Minimize `assume property` (over-constraining discards traces); validate assumes with cover74- One-hot/mutex: `a_onehot_grant: assert property ($onehot0(o_grant));` — mutual exclusion:75 `assert property (!(o_read_en && o_write_en));`76- Bounded liveness: `a_req_ack: assert property (i_req |-> ##[1:MAX_LATENCY] o_ack);`77 (unbounded eventually is unprovable by BMC — see §5.3)78- Handshake pattern reference: `templates/sva-bind-template.sv`; FIFO safety/liveness:79 `examples/fifo-sva-example.sv`8081## 4. Bind-File-First Policy8283Attach assertions externally via a `sva_{module}_checker` module + `bind` statement — do NOT84modify the RTL module. The checker module ports mirror the RTL port names verbatim85(`i_`/`o_` prefixes, `sys_clk`, `sys_rst_n`), so the bind uses `(.*)`:86```systemverilog87bind my_module sva_my_module_checker u_sva_checker (.*);88```89Complete scaffold (checker module + default clocking/disable + bind): `templates/sva-bind-template.sv`.9091## 5. SymbiYosys Integration9293### 5.0 sv2v Conversion (Mandatory for SymbiYosys/Yosys)94SymbiYosys uses Yosys internally, which has limited SystemVerilog support.95**RTL `.sv` files must be converted to Verilog via sv2v before running sby:**96```bash97sv2v rtl/{module}/*.sv -o rtl/{module}/{module}_v2v.v98```99- The `.sby` config `[files]` section must list the converted `_v2v.v` file, not `.sv`100- OSS SymbiYosys uses a generated immediate-assert harness top read with `-formal -sv`101 so Yosys keeps real `$assert` / `$cover` cells.102- SVA bind files / property files (`sva_*.sv`) do **NOT** need conversion — they remain the103 commercial/full-SVA path and are read with `-formal -sv` by tools that support bind.104- The RTL that the SVA binds **to** needs sv2v conversion105106### 5.1 Formal Verification Modes107| Mode | Purpose | SBY Config |108|------|---------|------------|109| BMC (Bounded Model Check) | Search for counterexamples within finite depth | `mode bmc`, `depth 20-50` |110| Induction (prove) | Mathematical proof at unbounded depth | `mode prove` |111| Cover | Verify reachability of cover points | `mode cover` |112113### 5.2 assume vs assert114- `assume`: input constraint for formal tool (behaves like assert in simulation)115- `assert`: property under verification116- In formal, traces violating assume are discarded (beware of over-constraining!)117118### 5.3 Liveness Caution119- BMC cannot prove liveness properties (eventually) — use prove mode120- Even in prove mode, infinite waits may cause induction failure → add bounds121122</Steps>123124<Tool_Usage>125This skill is not executed directly. It is referenced by agents that generate SVA126(e.g., sva-extractor, protocol-checker). Agents should follow the conventions defined here.127</Tool_Usage>128129<Examples>130Bind file with default clocking/disable, past_valid guard, and labeled+messaged assertions:131`templates/sva-bind-template.sv` and `examples/fifo-sva-example.sv`.132</Examples>133134<Escalation_And_Stop_Conditions>135- SymbiYosys BMC/prove FAIL → have sva-extractor analyze counterexample, request RTL fix from rtl-coder136- Over-constrained (cover FAIL) → review assume conditions137- Protocol spec unclear → request clarification from spec-analyst138</Escalation_And_Stop_Conditions>139140<Final_Checklist>141- [ ] Use bind file approach (minimize direct insertion inside RTL)142- [ ] `default clocking` / `default disable iff` configured143- [ ] past_valid guard present when using $past144- [ ] `else $error(...)` failure message on all asserts145- [ ] Label naming: `a_` (assert), `m_` (assume), `c_` (cover)146- [ ] Unknown check: use `$isunknown`147- [ ] Verify assertion reachability with cover properties148- [ ] Port names match RTL (i_/o_, sys_clk, sys_rst_n)149</Final_Checklist>