In reply to Dilip Bagadi:
Good point, forgot about that condition. This should address this. BTW, you may want to add action blocks.
For UVM reports in assertions, see Can we detect SVA in DUT under UVM? | Verification Academy
module asn_delay2;
// I have a requirement for writing an assertion for a protocol where after transmitting a signal x,
// within 3.5ms to 10ms I have to transmit another signal y. Since we can't use time delays directly
// in writing assertion property, can you please, tell me how to write assertions for such cases.
timeunit 1ns; timeprecision 100ps;
bit x, y;
always @(posedge x) begin
automatic realtime t_atx; //
t_atx= $realtime;
fork
begin
wait(y);
assert(($realtime-t_atx >= 3.5ms) && ($realtime-t_atx < 10ms));
end
begin
# 10.0ms;
assert(1'b0);
end
join any;
end
endmodule