Checking frequency of a signal or time betwen two "events"

Have a UVM testbench and I want to check the time between two events occurring in the UUT. i.e. rising edge to rising edge, and convert that to a frequency and fail the test if the frequency doesn’t meet spec, i.e. ±1%

In reply to solosys:

real time_period, frequency, current_time1,current_time2;

@event_occurs;
current_time1= $time;
@event_occurs;
current_time2= $time;

time_period = current_time2-current_time1;
frequency = 1/time_period;

You may try something like this as per your requirement.

In reply to debashis_paul:

Ok, I’ll give it a try. Thanks