I wish to measure the delay between an enable signal and the clock signal's edge
which occurred just before the rise of the enable signal.I want this measurement to be accurate, therefore I use the last_crossing() function
I thought of this code, but it does not give the desired results due to order of execution. Apparently the simulator first calculates the expressions inside the cross block , and only then it calculates the last_crossing() block.
Therefore, when calculating
dly ,
en_time equals -1.
Code: @(cross(V(clk)-vth,1));
clk_time=last_crossing(V(clk)-vth,1);
@(cross(V(en)-vth,1)) begin
dly=en_time-clk_time;
end
en_time=last_crossing(V(en)-vth,1);
Is there a different way to have accurate time calculation using last_crossing() and yet get the behavioral I need?
Regards,
Ari