SVA implication, disable iff, $past and repetition
Write clocked SystemVerilog assertions using overlapped and non-overlapped implication, reset disabling, sampled values and repetition.
Clocked property structure
A concurrent assertion samples signals on its clocking event. |-> is overlapped implication: the consequent starts in the same sampled cycle as the antecedent. |=> is non-overlapped implication: the consequent starts on the next sampled cycle.
property request_gets_grant;
@(posedge clk) request |=> grant;
endproperty
assert property (request_gets_grant);
If request is false, the implication passes vacuously. Add cover properties or antecedent coverage so a test cannot appear successful without exercising the request.
Reset disabling
assert property (@(posedge clk)
disable iff (!rst_n) request |-> ##[1:3] grant);
disable iff aborts active attempts while its expression is true. Its reset expression is asynchronous to property sampling, so align the polarity and reset-release assumptions with the design.
Sampled values
$past(signal) returns the previously sampled value for the property clock. Guard its first meaningful use after reset or initialization.
assert property (@(posedge clk) disable iff (!rst_n)
enable |=> q == $past(d));
Other useful sampled-value functions include $rose, $fell, $stable and $changed.
Repetition
Consecutive repetition [*3] requires a sequence for three consecutive samples. Nonconsecutive [=3] requires three matches with gaps permitted, while goto repetition [->3] ends on the third match. Use bounded delays and repetition ranges when possible; unbounded properties can be difficult to complete in simulation.
Give every assertion a requirement-based name and a failure message that includes relevant sampled values.