Reputation: 239
I tried to write a assertion:
Once A is asserted, A remains HIGH until B is de-asserted. After that, A will finally de-asserted.
The assertion I wrote was:
my_assertion : assert property(
@(posedge clk) disable iff(reset)
$rose(A) |-> A throughout !B [->1] ## [0:$] !A)
else $display("Assertion failed")
The assertion failed at the time when A is de-asserted. Guys, can you please tell me where I did wrong in my_assertion? Was " [0:$] " not used correctly?
Upvotes: 2
Views: 2913
Reputation: 13937
I think you're problem is due to operator precedence. This does not fail when A is deasserted:
$rose(A) |-> (A throughout !B [->1]) ## [0:$] !A
whereas what you have written is the same as:
$rose(A) |-> A throughout (!B [->1] ## [0:$] !A)
which can never pass, because A
cannot be true and false at the same time.
https://www.edaplayground.com/x/4Vv9
Upvotes: 3
Reputation: 19094
##
has a higher priority than throughout
; See IEEE1800-2012 § 16.9 Sequence operations Table 16-1.
Therefore A throughout !B [->1] ## [0:$] !A
is the sample a A throughout (!B [->1] ## [0:$] !A)
. This fails because A
is required be high (left side of throughout
) and low (right side of throughout
) for the last cycle, which will always evaluate as false.
I believe the desired behavior is: (A throughout !B [->1]) ## [0:$] !A
Upvotes: 4