SVA evaluation

In reply to hisingh:

In reply to ben@SystemVerilog.us:


function automatic int getq(); 
return k ;  // Simply  return ' k '  without  defining  variables .
endfunction : getq

I observe the updated value of k is assigned to local variable w .


   function bit test();
    $display("%t sampled(w)= %b", $realtime, $sampled(w));
    $display("%t Observed(w)= %b",$realtime,  w);
    return w;      
   endfunction
   property p; 
    bit v; 
    @(posedge clk) (a, v=test()) |-> b; // test(b);  
   endproperty 
   ap_p: assert property(p);  

Properties are executed in the Observed region. The function should return the value of w in the Observed Region, which could have been updated in the NBA Region.

Are there any additional advantages of defining the variables within the subroutine as automatic ?

NO. BTW, it is bad practice to do what you are proposing.

My understanding is that if the subroutine were to be called in parallel from
multiple places each call will have their own copy .
So if I pass different values as input to the subroutine from different places
at the same time , each invocation would return an appropriate value due to the automatic variables defined within the subroutine .

Function will return the value seen in the Observed Region.
Any, bad practice.