In reply to ben@SystemVerilog.us:
Hi Ben ,
As per your 2nd reply in vathread :
If you have a function that return a value, e.g., (seq, v=f(v)), the f(v) is considered
an expression and is evaluated in the Observed Region. If the function is void,
e.g., (seq, f_void(v) then f_void is executed in the Reactive Region. The task or void function
once started can complete after the assertion that called is done.
The same is confirmed in LRM Section 16.10 Local variables :
Initialization assignments shall be performed in the Observed region in the order that they appear in the sequence or property declaration.
In the above case as the function returns a value , won’t the function execute in Observed region ?
The returned value is checked via $isunknown( return_value ) which also executes in Observed region ( since property/sequence is evaluated in Observed region )
[2] A better solution logically ( w/o worrying about SV regions ) would be :
function automatic logic sample(); // Called in Observed Region
return a ; // Updated value sampled even if 'a' were assigned in NBA region
endfunction
property prop;
logic val ;
@( a ) ( 1 , val = sample() ) ##0 !$isunknown( val );
endproperty
x_prop_on_d_assert3 : assert property ( prop )
else $display("%t proprIs3 unknown in a", $realtime);
As the subroutine returns a value , sample() is called in Observed region .
After local variable ‘val’ is assigned in Observed region, !$isunknown( val ) executes ( in Observed Region as well )