Assertion for D Flip Flop

In reply to navjeet1503:
1800 16.9.3 Sampled value functions states: If there do not exist k strictly prior time steps in which the event ev iff expression2 occurred, then the value returned from the $past function is the default sampled value of expression1 (see 16.5.1).
Thus, on the very first clocking event, $past(d) is the default value of d.
Therefore, in the very first clocking event, (q ==$past(d)) will fail if q=='X.
To fix this, do the following


property check_d;
  @(posedge clk) disable iff (reset)
   (##1 q ==$past(d));
endproperty 

Meaning that every assertion test of q is delayed by 1 clock. In other words, at clock 3, q is tested at clock 4, and its value should be the value of d at clock 3.

Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact Home - My cvcblr


  1. VF Horizons:PAPER: SVA Alternative for Complex Assertions | Verification Academy
  2. http://systemverilog.us/vf/SolvingComplexUsersAssertions.pdf
  3. “Using SVA for scoreboarding and TB designs”
    http://systemverilog.us/papers/sva4scoreboarding.pdf
  4. “Assertions Instead of FSMs/logic for Scoreboarding and Verification”
    October 2013 | Volume 9, Issue 3 | Verification Academy
  5. SVA in a UVM Class-based Environment
    SVA in a UVM Class-based Environment | Verification Horizons | Verification Academy