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.
The simplest way is to write an immediate assertion that compares the time delay between x and y against your requirements. As you experienced, concurrent assertions will not work since you don’t have a clock.
module asn_delay;
// 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;
wait(y);
assert(($realtime-t_atx >= 3.5ms) && ($realtime-t_atx <= 10ms));
end
endmodule
// integer_atom_type ::= byte | shortint | int | longint | integer | time
// non_integer_type ::= shortreal | real | realtime
Hi Ben,
From the above code we can check for the time between x and y but, if ‘y’ didn’t get asserted, it won’t give assertion fail.
How to check whether ‘Y’ is asserted or not between 3.5 to 10ms?
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
Hello,
I have a question. Since I am new to system verilog assertion, can you please tell me how to verify design using real time delay in clock(Formal verification). For example, if the clock period is 5ns, then at posedge the property should be verified from 2.3 to 2.7ns instead of exactly at 2.5ns.Is this possible? If possible can you give me an example of how to verify it