Thanks dave, it works fine. I actually wanted the task to be inteligent enough to not hang if the clock is either 0 or 1.
So i had used the following way
fork
begin
repeat(2) @(posedge clk);
end_time = $time / 1ns; // normalize to ns;
period = end_time -start_time;
ovm_info(....) end begin #50us; period = 0;
ovm_error(…)
end
join_any
I get a syntax error for this saying that I can not have a reference variable inside a fork join block.
What would be alternate way of doing this ?