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
- SVA Handbook 4th Edition, 2016 ISBN 978-1518681448
- Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn 978-1539769712
- A Pragmatic Approach to VMM Adoption 2006 ISBN 0-9705394-9-5
- Using PSL/SUGAR for Formal and Dynamic Verification 2nd Edition, 2004, ISBN 0-9705394-6-0
- Component Design by Example ", 2001 ISBN 0-9705394-0-1
- VHDL Coding Styles and Methodologies, 2nd Edition, 1999 ISBN 0-7923-8474-1
- VHDL Answers to Frequently Asked Questions, 2nd Edition ISBN 0-7923-8115
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.