Sampling point of Assertions

In reply to ben@SystemVerilog.us:

In reply to wiki458:
A lot of thoughts went into the processing in the various regions.
If the assertions were evaluated before the NBA, the action block could change the values of variables that are used in the NBA. Consider the following example:
b==1 at initial. Assertion action block changes b to 0. In the always_ff you have a <= b.
What value of “b” should be used? the initial 1’b1’, or the modified 0 by the action block?


bit clk, a, b=1'b1; 
default clocking @(posedge clk); endclocking
always_ff  @(posedge clk)  a <= b; 
ap: assert property( 0) else b=1'b0;   

http://SystemVerilog.us/fv/tassert.sv

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


Hi, I don’t think this is a good example. The value that a use will for sure be 1 if the assertion is evaluated and updates b just before the NBA region. Since the evaluation of the RHS of a <= b is already done in active region and the value used is 1. Changing b right before the NBA will not affect the outcome. The value used in NBA is determined during the evaluation in active region (it’s not a variable)

Consider running:

initial begin
b = 1;
a <= b;
b = 0;
#1 $display(" a = %0d",a);
end

You will see that the value of a is 1.