SystemVerilog Assertions
Write executable temporal properties that detect protocol and interface violations at the cycle where they occur.
Learning objectives
- Explain what SystemVerilog Assertions (SVA) check that scoreboards and functional coverage do not.
- Distinguish immediate assertions from concurrent assertions.
- Read and write basic SVA sequences and properties.
- Use implication, cycle delays,
$past,$stable, anddisable iffcorrectly. - Place assertions at an appropriate interface or DUT boundary.
- Integrate assertion failures with a UVM environment without moving temporal checking into a scoreboard.
- Recognize common SVA mistakes involving sampling, reset, vacuous success, and incorrect temporal relationships.
Step 1: Why assertions belong beside coverage and scoreboards
The previous lessons built a functional-coverage workflow: plan the behavior, sample it, analyze holes, and close the important scenarios.
Coverage answers: "Did this scenario occur?"
A scoreboard answers questions such as: "Did the observed transaction match the expected transaction?"
An assertion answers a different question: "Did a required relationship between signals remain true over time?"
This distinction is important. Many protocol rules are naturally expressed in terms of clock cycles:
- If a request is accepted, a response must eventually occur.
- If
validis high whilereadyis low, the payload must remain stable. - If reset is active, a protocol output must remain inactive.
- If a command is accepted, an acknowledgement must occur on a specified later cycle.
These are temporal properties. Encoding them as assertions makes the requirement executable and lets the simulator identify the failing clock cycle directly.
Step 2: Immediate assertions versus concurrent assertions
SystemVerilog provides two major assertion styles.
Immediate assertion
An immediate assertion behaves much like a procedural if check. It evaluates when execution
reaches it.
assert (addr[1:0] == 2'b00)
else $error("Address is not word aligned");
This is useful for checking a condition at a particular point in procedural code.
Concurrent assertion
A concurrent assertion describes behavior across clocked sampling events. This is where SVA becomes particularly useful for protocol verification.
assert property (
@(posedge clk)
valid && !ready |=> $stable(data)
);
This property says that when the antecedent is true on a sampled clock edge, the consequent must be true on the next sampled clock edge.
The distinction is:
Immediate assertion:
evaluate now
|
v
pass / fail
Concurrent assertion:
sample at clock
|
v
track temporal relationship
|
v
pass / fail Step 3: Understand the anatomy of a concurrent assertion
A basic concurrent assertion commonly looks like:
assert property (
@(posedge clk)
request |-> grant
);
Break it into three parts:
-
Clocking event:
@(posedge clk)defines when signals are sampled. -
Antecedent:
requestdescribes the condition that starts the property attempt. -
Consequent:
grantdescribes what must happen as a result.
Conceptually:
clock edge N
|
+-- request = 1
|
v
property starts
|
v
clock edge N
|
+-- grant must be 1
The exact timing depends on the implication operator and any sequence delays used in the property.
Step 4: Learn the two implication operators
Two implication operators are especially important for intermediate SVA:
|->— overlapped implication|=>— non-overlapped implication
Overlapped implication
assert property (
@(posedge clk)
request |-> grant
);
If request is true at a sampling edge, grant is checked in the consequent's
first cycle at that same sampling point.
Non-overlapped implication
assert property (
@(posedge clk)
request |=> grant
);
Here, the consequent begins on the next sampling edge.
This one-cycle difference is critical. Choosing the wrong implication operator can make a property appear correct while checking the wrong protocol timing.
Step 5: Express multi-cycle behavior with sequences
A sequence describes a temporal pattern across sampled clock cycles.
sequence req_then_ack;
req ##2 ack;
endsequence
assert property (
@(posedge clk)
req_then_ack
);
The ##2 operator means that ack must occur two sampling cycles after
req in this sequence.
Sequences become valuable when the protocol requirement contains several temporal steps.
sequence request_completion;
req_accept ##1 busy ##[1:4] done;
endsequence
assert property (
@(posedge clk)
request_completion
);
The range ##[1:4] allows the next sequence element to occur within the specified
range of cycles.
Do not use a flexible delay merely because the exact protocol timing is unclear. The delay should come from the specification.
Step 6: Check stalled interfaces with $stable
A common ready/valid rule is:
When valid is asserted but ready is not, the sender must hold the
transfer information stable until acceptance.
A basic assertion is:
assert property (
@(posedge clk)
valid && !ready |=> $stable(data)
);
This checks that data remains stable at the next sampling edge after a stalled cycle.
In a real protocol, you may need to include every field that must remain stable:
assert property (
@(posedge clk)
valid && !ready
|=> $stable({data, addr, write, byte_en})
);
The important design question is not simply "what signal changed?" It is: which protocol fields are required to remain stable while the transfer is stalled?
Step 7: Use $past to compare with a previous cycle
$past(expression) returns the sampled value of an expression from a previous clocking
event.
assert property (
@(posedge clk)
$past(req) |-> ack
);
This expresses a relationship between the current cycle and the previous sampled cycle.
A more explicit example:
assert property (
@(posedge clk)
$past(start) |-> busy
);
This can be read as:
"If start was sampled high on the previous clock, busy must be high now."
Be careful around reset and the beginning of simulation. A property using historical values needs a meaningful history before those values can represent normal protocol operation.
Step 8: Disable properties during reset
Reset is one of the most common reasons a seemingly correct assertion produces confusing failures.
If a protocol property should not be evaluated while reset is active, use
disable iff.
assert property (
@(posedge clk)
disable iff (!rst_n)
valid |-> ready
);
Here, the property is disabled whenever rst_n is low.
This is usually preferable to adding reset conditions independently to every antecedent and consequent.
Step 9: Write assertions at the right abstraction level
Assertions are most useful when placed close to the signals and protocol rule they describe.
| Requirement | Good checking mechanism |
|---|---|
| Payload equals predicted result | Scoreboard |
| Read/write transactions cover required regions | Functional coverage |
| Valid remains stable until acceptance | SVA |
| Request is followed by response within a cycle range | SVA or a transaction-level timeout/checker, depending on the requirement |
| Every expected response matches its transaction ID | Scoreboard |
| Illegal signal combination occurs | SVA |
This does not mean one mechanism is forbidden from checking another kind of behavior. The point is to choose the mechanism that expresses the requirement clearly and gives useful failure diagnostics.
Step 10: Put assertions inside a reusable interface checker
Assertions do not have to be scattered throughout a test. A useful intermediate architecture is to package protocol assertions with the interface they verify.
module ready_valid_checker (
input logic clk,
input logic rst_n,
input logic valid,
input logic ready,
input logic [31:0] data
);
assert property (
@(posedge clk)
disable iff (!rst_n)
valid && !ready |=> $stable(data)
)
else $error(
"READY/VALID protocol violation: data changed while stalled"
);
endmodule
This checker is independent of a particular UVM test. It observes the interface and checks a protocol property wherever the checker is instantiated.
Later, Lesson 38 will show how assertions can be attached to an existing DUT interface using binding, avoiding changes to the RTL source.
Step 11: Understand assertion failure reporting
An assertion can report a failure using an action block:
assert property (
@(posedge clk)
disable iff (!rst_n)
req |=> ack
)
else $error(
"ACK missing after request at time %0t",
$time
);
The simulator identifies the assertion failure at the relevant sampled event. This is one of the major advantages of SVA over manually checking temporal behavior with scattered procedural code.
In a UVM environment, the simulator's assertion report can coexist with UVM reports. Depending on the integration and simulator, projects may use assertion reporting directly, convert assertion events into UVM reporting, or collect assertion failures for regression analysis.
Step 12: Watch for vacuous success
Consider:
assert property (
@(posedge clk)
req |=> ack
);
What happens if req is never asserted?
The property does not fail simply because no request occurred. There was no antecedent on which to start an obligation. This is commonly called vacuous success.
This is not necessarily a bug in the assertion. It means the assertion answers: "Whenever a request occurs, is it followed by an acknowledgement?"
It does not answer: "Did the test actually generate a request?"
That is where functional coverage remains important.
Functional coverage:
Did request happen?
+
Assertion:
If request happened, was ack produced correctly?
+
Scoreboard:
Was the response data correct? Step 13: Assertions and UVM work together
A practical UVM environment can use all three mechanisms simultaneously:
+------------------+
| UVM Sequence |
+--------+---------+
|
v
+-----------+
| Driver |
+-----+-----+
|
v
+-----+
| DUT |
+--+--+
|
+------------+------------+
| |
v v
+---------+ +-------------+
| Monitor | | SVA Checker |
+----+----+ +-------------+
|
+-----+------+
| |
v v
+-----------+ +----------+
| Scoreboard| | Coverage |
+-----------+ +----------+
Each mechanism sees a different aspect of the same behavior:
- Monitor: reconstructs meaningful transactions.
- Scoreboard: checks expected versus actual behavior.
- Coverage: measures whether planned scenarios occurred.
- SVA: checks temporal and protocol properties directly on sampled signals.
This separation makes failures easier to interpret.
Step 14: A complete small example
Consider a simple request/acknowledge interface. The requirement is:
- when a request is asserted, an acknowledgement must occur on the following cycle;
- while waiting, the request payload must remain stable;
- reset disables normal protocol checking.
module req_ack_checker #(
parameter int DATA_WIDTH = 32
) (
input logic clk,
input logic rst_n,
input logic req,
input logic ack,
input logic [DATA_WIDTH-1:0] data
);
// Request must be acknowledged one cycle later.
assert property (
@(posedge clk)
disable iff (!rst_n)
req |=> ack
)
else $error(
"REQ_ACK: missing acknowledgement at time %0t",
$time
);
// If a request is made and acknowledgement has not arrived,
// the payload must remain stable on the next cycle.
assert property (
@(posedge clk)
disable iff (!rst_n)
req && !ack |=> $stable(data)
)
else $error(
"REQ_ACK: request data changed while waiting at time %0t",
$time
);
endmodule
Notice what this checker does not do. It does not calculate the expected response data, correlate transaction IDs, or maintain an expected queue. Those are transaction-level checking problems better handled by the scoreboard architecture developed in Lessons 21–30.
Step 15: Build assertions incrementally
- Write the requirement in plain language. Example: "A request must be acknowledged on the next clock."
- Identify the sampling clock. Determine which clock defines protocol cycles.
- Identify the triggering event. For example, request acceptance rather than merely request intent.
- Determine the exact timing relationship. Same cycle, next cycle, fixed number of cycles, or a range?
- Write the smallest property that expresses the rule.
- Add reset handling. Decide whether reset disables the property or has its own property.
- Create an intentional failure. Temporarily violate the rule and verify that the assertion detects it.
- Run a legal scenario. Confirm that the property passes for valid behavior.
Common mistakes
- Using the wrong implication operator. A one-cycle timing error can completely change the property.
-
Checking the wrong event.
A request signal may indicate intent, while
valid && readyindicates actual acceptance. - Ignoring reset. Normal protocol properties may be meaningless while reset is active.
- Assuming a passing assertion proves the scenario occurred. An implication property may pass vacuously when its antecedent never happens.
- Putting transaction prediction into SVA. Complex expected-value computation and ID correlation generally belong in the predictor/reference model/scoreboard architecture.
- Testing only the passing case. An assertion that has never been intentionally violated has not been adequately validated.
- Using arbitrary delays. Temporal operators should represent protocol timing, not compensate for uncertainty in the environment.
Debugging strategy
When an assertion fails, debug the property and the DUT behavior separately.
Assertion failure
|
+--> Which property failed?
|
+--> Which clock edge triggered the check?
|
+--> What was the antecedent?
|
+--> What did the consequent require?
|
+--> Was reset active?
|
+--> Was the sampling event correct?
|
+--> Does the waveform match the protocol specification?
|
+--> Is the assertion wrong, or is the DUT wrong?
A waveform is especially useful for temporal assertions because it lets you align the property with the exact sampled clock edges.
Also check whether the assertion itself was exercised. If it never triggers its antecedent, a lack of failures is not evidence that the property is useful.
Try it yourself
-
Write an assertion stating that
validmust remain high until a transfer is accepted. -
Write an assertion that checks payload stability while
valid && !ready. -
Add
disable ifffor an active-low reset. - Create a legal waveform that satisfies the assertions.
- Modify one signal to intentionally violate each property.
- Observe the assertion failure and identify the exact clock edge reported.
Challenge: Build a small protocol checker
Create an SVA checker for a simple request/response interface with these requirements:
- A request accepted on cycle
Nmust receive a response between cyclesN+1andN+4. - The request payload must remain stable while the request is outstanding.
- No protocol checking should occur while reset is asserted.
- The checker should report which property failed and the simulation time.
Then intentionally introduce:
- a missing response;
- a response that arrives too early;
- a payload change while waiting;
- a reset transition while an assertion attempt is active.
Advanced extension: Determine which requirement is better expressed as SVA and which should remain a transaction-level scoreboard or timeout check. Explain why.
Knowledge check
-
What is the main difference between an immediate and concurrent assertion?
An immediate assertion evaluates procedurally at a point in execution; a concurrent assertion describes temporal behavior sampled across clocking events. -
What is the practical difference between
|->and|=>?
Overlapped implication starts the consequent in the same sampling cycle; non-overlapped implication starts it on the following sampling cycle. -
Why is
disable iffuseful?
It prevents a property from being evaluated while its disabling condition, commonly reset, is true. -
What does
$stable(data)check?
It checks whether the sampled value ofdataremained stable over the relevant sampled interval defined by the property. -
Can an assertion pass even when its antecedent never occurs?
Yes. An implication property can succeed vacuously when no property attempt is triggered. -
Should an SVA property replace an out-of-order scoreboard?
No. Temporal signal relationships and transaction correlation solve different verification problems.
Key takeaways
- SVA is particularly effective for clocked temporal and protocol rules.
- Concurrent assertions describe relationships across sampled clock cycles.
|->,|=>,##,$past, and$stableare fundamental building blocks for intermediate protocol properties.- Always define the correct sampling clock and protocol event before writing the property.
- Use
disable iffwhen normal protocol properties should not apply during reset. - A passing implication can be vacuous, so pair assertions with coverage when scenario occurrence matters.
- Keep temporal signal checking in assertions and transaction prediction/correlation in the appropriate UVM components.
- Validate assertions with both legal behavior and intentional violations.
What comes next?
You have now added temporal checking to the verification toolbox:
Lesson 31 Coverage planning
↓
Lesson 32 Coverpoints and bins
↓
Lesson 33 Cross coverage
↓
Lesson 34 Sampling architecture
↓
Lesson 35 Coverage analysis
↓
Lesson 36 Coverage closure
↓
Lesson 37 SystemVerilog Assertions
The next challenge is placement. Assertions are most reusable when they can be attached to the relevant interface or DUT logic without modifying the design source.
Lesson 38: Assertion Binding introduces SystemVerilog
bind, allowing assertion modules or checkers to be attached to existing DUT instances.
You will learn how this supports reusable protocol checking while keeping verification logic separate from
RTL implementation.