Latency between 2 signals

In reply to verif4ravi:

How does the $display display the latency values when there is a failure, I am only seeing values in log during the passing of assertion. In the failure case it did not show in log what value was the latency.

The assertion local variables are not carried into the action block.
You’ll have to use some support logic; something like the following where
the property sets the latency into a module/checker variable and the action block flips a bit to display the latency error.


// untested, but I think it is syntatically accurate
bit freq_error; 
reatime latency; 
function automatic void set_latency(realtime t); 
    latency=t;
endfunction
always (@(posedge freq_error)) begin 
    $display("%t latency error=", $realtime, latency); 
    #1 freq_error=0; 
end
property p_min_time();  
   realtime start_time;
   @(posedge sig1) (1,start_time = $realtime) |->
   @(posedge sig2) (($realtime - start_time) == duration, set_latency($realtime - start_time), 
    $display("\t **Latency_checker**= %d ",$realtime - start_time));
endproperty

assert property (p_min_time)
else begin 
 freq_error=1; 
`uvm_error ("p_min_time,$sformat("%m FAIL p_min_time"));
 end ;