Assertion using $stable with |-> #[...]

Hi

I have this scenario

After rising edge of a pulse signal named A a bus signal named B must be stable for at least 2 clocks after.

I am not sure if this is good in how I use $stable:
assert property(@(posedge clock) $rose(A) |-> ##[1:2] $stable(B));

Or which is a better way?

In reply to ingamara:
Your code will be checked as below.

assert property(@(posedge clock) $rose(A) |-> ##[1:2] $stable(B));

Once $rose(A) is true $stable(B) can be true either in the first or second cycle after $rose(A) is true.

You can write the code as below using continuous repetition operator[*n]. Using this operator $stable(B) will be checked for true condition continuously for two cycles after $rose(A) is true.


 property p1;
    @(posedge clk) $rose(A)|=> $stable(B)[*2];
endproperty

In reply to shanthi:

The check should fail also when bus B changes on the rising edge of A. Is this working on this case also?
Or instead of
@(posedge clk) $rose(A)|=> $stable(B)[*2];

shoud is use overlaping β€œ|->” ? Like this:
@(posedge clk) $rose(A)|-> $stable(B)[*2];

In reply to ingamara:

yes if B should be stable on rising edge of A also then same cycle implication operator should be used instead of next cycle implication operator.

In reply to ingamara:

Your original question said β€œB must be stable for at least 2 clocks after”. If it also needs to be stable the same cycle that A rises (meaning B not changed from the cycle before A rose), AND β€œB must be stable for at least 2 clocks after” then you need to use the overlapping implication operator with a 3 cycle repetition

@(posedge clk) $rose(A)|-> $stable(B)[*3];

1 Like

Thanks shanthi, Dave for your help and clarification on this one.

In reply to dave_59:

i cant use variable which changes its value after some time
@(posedge clk) $rose(A) |-> $stable(B)[*count];
if my count varies then it shows compilation error says range should be bounded by constant values
My question is how to check the property if it should be stable for count cycles when count varies from time to time?

In reply to Adharsh_07:

You need to create a local variable that samples the count for each assertion attempt.

Here are links to several solutions: sva repetition using variable | Verification Academy