Consider the above interface. I want to make sure that reqBus changes only when the clk is running. Say reqBus changes from 1 to 2 or 2 to 0, clock must have been running prior to that change if not flag an assertion.
You could keep a log in a module variable of the time of clk transition.
At a Change od req, test that the current time is within range of the last clk.
realtime t:
let limit=10ns;
always @(posedge clk t <=$realtime;
ap_req: assert property(@($change(reqbus)
$realtime-t <= limit);
In reply to Sai Raghavendran :
let limit=10ns;
ap_req: assert property(@($change(reqbus)
$realtime-t <= limit); // limit is the period of the clock
t is sampled, thus if the clock period is 10ns and $change(reqbus) occurred on a clocking event at time 1010ns then the assertion checks that there was a clocking event at tome 1000ns.
The assertion would fail if the clock stopped at t=200ns and then restarted at t=1010ns.
Thus, for the assertion to work, you would have to assume that the clock was running one cycle before the change of reqbus.