Module 6 — Assertions
SystemVerilog Assertions (SVA): immediate vs concurrent assertions, properties, sequences, and the implication and repetition operators that let you describe complex temporal protocol behavior declaratively.
📑 Table of Contents
50Immediate Assertions
Immediate assertions are procedural, executed like a statement inside always/initial blocks — they check a boolean expression at the instant they execute, with no notion of time or clocking.
| Aspect | Immediate Assertion | Concurrent Assertion |
|---|---|---|
| Evaluation | Instant, procedural (like an if-statement) | Clock-based, over multiple cycles |
| Can Describe Sequences? | No — single point-in-time check | Yes — temporal/multi-cycle behavior |
| Placement | Inside procedural blocks only | Module-level, procedural blocks, or interfaces |
| Typical Use | Simple sanity/legality checks (no X, in-range) | Protocol compliance (req-ack handshakes, pipeline timing) |
51Concurrent Assertions
Concurrent assertions describe behavior over time, sampled on a clock edge — they can express "if X happens, then Y must happen within N cycles," making them the tool of choice for protocol checking.
disable iff (!rst_n) is the standard way to suppress assertion checking during reset — without it, assertions often fire spuriously while the DUT is still in an undefined post-reset state.
52Properties
A property is a named, reusable temporal specification built from boolean expressions, sequences, and implication/logical operators — it's the thing that assert/cover/assume statements check.
The same property can be used three ways: assert property(p) checks it must hold (bug if violated); assume property(p) tells formal tools/simulators to treat it as a constraint on the environment (used heavily in formal verification); cover property(p) just records whether the scenario ever happened.
53Sequences
A sequence describes an ordered pattern of boolean expressions across clock cycles — the temporal "phrase" building block that properties are constructed from.
Think of a sequence as a noun phrase ("req followed 2 cycles later by grant") and a property as the full sentence built from one or more sequences plus implication logic ("IF this sequence happens, THEN that must follow"). Sequences alone can't be directly asserted — they need to be wrapped in a property (or used with a bare assert property(seq), which SV allows as shorthand).
54Implication Operators
Implication operators (|-> and |=>) express "if the antecedent (left side) matches, then the consequent (right side) must hold" — the core mechanism for conditional protocol checking.
| Operator | Name | Consequent Checked |
|---|---|---|
|-> | Overlapped implication | Same clock cycle as the antecedent match |
|=> | Non-overlapped implication | Starting one cycle after the antecedent match |
"Explain the difference between |-> and |=>" is one of the single most common SVA interview questions. Remember: |=> is exactly equivalent to |-> ##1 — non-overlapped just adds one implicit cycle of delay before checking the consequent.
55Repetition Operators
Repetition operators let a sequence match a signal holding a value (or matching a sub-sequence) a specific or variable number of times — essential for expressing burst/back-pressure protocol behavior concisely.
| Operator | Name | Meaning |
|---|---|---|
[*n] | Consecutive repetition | Expression true for exactly n consecutive cycles |
[*n:m] | Consecutive range repetition | True for between n and m consecutive cycles |
[->n] | Goto repetition | Matches at the nth occurrence, non-consecutive allowed |
[=n] | Non-consecutive repetition | Expression true exactly n times, non-consecutively, without anchoring sequence end there |
"Difference between [->n] and [=n]?" — Both allow non-consecutive matches, but [->n] anchors the sequence's completion to the exact cycle of the nth match (so anything chained after it with ## counts from there), while [=n] just requires n occurrences somewhere within the overall sequence window, without anchoring.
🎯 Module 6 Recap
- Immediate assertions check a condition instantly and procedurally; concurrent assertions check temporal behavior over clock cycles.
propertyis the full checkable specification;sequenceis a reusable temporal building block used inside properties.|->checks the consequent in the same cycle;|=>checks it starting the next cycle (equivalent to|-> ##1).- Repetition operators (
[*n],[*n:m],[->n],[=n]) compactly express consecutive vs non-consecutive repeated matches. - The same property can be used with
assert(must hold),assume(treat as environment constraint, esp. in formal), orcover(just record occurrence).
📚 Next up — Module 7: Interfaces (interface, modports, clocking blocks, virtual interface)
↑ Back to Table of Contents
Comments
Post a Comment