Assertions Reference
Implication |-> and |=>
An implication checks its right side only when its left side matches. |-> starts the check in the same cycle, |=> one cycle later.
Syntax
assert property (@(posedge clk) req |-> gnt); // gnt in the same cycle
assert property (@(posedge clk) req |=> gnt); // gnt in the next cycleRules
- The left side is the antecedent. The right side is the consequent.
a |=> bmeans the same asa ##1 1 |-> b.- When the antecedent does not match, the attempt passes. This is a vacuous pass.
- A property that only ever passes vacuously has checked nothing. Add a
coverfor the antecedent. - A new attempt starts at every clock edge.
Example
module tb;
logic clk = 0, req = 0, gnt = 0;
always #5 clk = ~clk;
a_same: assert property (@(posedge clk) req |-> gnt)
else $display("t=%0t a_same fails", $time);
a_next: assert property (@(posedge clk) req |=> gnt)
else $display("t=%0t a_next fails", $time);
initial begin
@(negedge clk) req = 1; // gnt is low in this cycle
@(negedge clk) req = 0; gnt = 1; // gnt arrives one cycle later
@(negedge clk) gnt = 0;
@(negedge clk) $display("done");
$finish;
end
endmodulet=15 a_same fails
doneCommon Mistake
Using |-> when the response comes a cycle later
// The design answers one cycle after req.
assert property (@(posedge clk) req |-> gnt); // fails on every request|-> checks gnt on the same edge that sees req. The answer has not arrived yet.
Fix: Use req |=> gnt, or write the delay out: req |-> ##1 gnt.
Learn It Properly
These lessons teach it step by step, with practice problems.
Standard
IEEE 1800-2023, 16.12.7.