The use of $sampled in a disable iff clause is meaningful since the disable condition by default is not sampled (see 16.12).
Section 16.12 further mentions
The disable condition is tested independently for different evaluation attempts of the property_spec.
The values of variables used in the disable condition are those in the current simulation cycle, i.e., not sampled.
[Q1] I am not clear on the above 3 lines.
I am aware of the following ::
(a) Expression within disable iff is evaluated asynchronous to the clocking event and when found true the evaluation is disabled i.e no property_expr evaluation, no action block execution.
(b) $sampled returns the pre-poned value of it’s argument.
[Q2] Doesn’t this imply that the clocking event ( when explicitly specified ) should precede the disable iff clause ?
[Ben] It does seem so. However, in the property_spec the following are optional:
[clocking_event ] [ disable iff ( expression_or_dist ) ]
Thus, I could write:
property p; @(posedge clk) a; endproperty // legal
// Also legal
sva3: assert property (disable iff (rst_n) p);
// Now if I expand "p", SVA3 becomes
sva3: assert property (disable iff (rst_n) @(posedge clk) a;
// THUS, going back to your Q:
sva1:assert property( @(posedge clk) disable iff(!rst_n) a );
// sva1 is per the definition nof the
property_spec ::=
[clocking_event ] [ disable iff ( expression_or_dist ) ] property_expr
// sva2 is like my sva3 where property "p" is the (@(posedge clk) a) and the clocking event is optional.
sva2:assert property( disable iff(!rst_n) @(posedge clk) a );
https://www.edaplayground.com/x/EF2a
All vendors compile and simulate the code
Q1 answer tomorrow
On the disable iff:
From my new book:
• Asynchronous disable iff: Uses an expression (e.g., 0 for no disable) or a module variable (e.g., reset). The variable’s value is NOT sampled and represents the value in the Observed region when the assertion is evaluated.
• Synchronous disable iff: Two common techniques for synchronous reset implementation:
o Explicit clock specification