I am using throughout construct in the snippet shown below:
@posedge(clk)
( (z==3|| z==4 || z==6) && ($changed(c) && (c==0)) ) → ##3 !a ##2 b ##1 ( !a && b throughout !c);
Here
after ##3 + ##2 = ##5ns I see my assertion working fine till b is high.
Now
after ##5 + ##1 = ##6ns, I am checking for ( !a && b throughout !c);
I want a=0 and b=1 to stay the same until c=0 (Correction: while c=0), so I used throughout but it doesn’t seem to be working.
In my simulation b changed its value to 0 at approximately ##8ns while c was still==0, and my assertion still didn’t fail. The assertion should have failed.
Is this the right way of handling throughout construct?
In reply to ben@SystemVerilog.us:
Hi Ben,
Could you please explain why the absence of goto operator does not make the assertion fail when b==0 and c==0?
!a && b throughout !c)
// states that you want (!a && b) to be True during the ONE-CYCLE sequence (!c)
// Which is then the same as
!a && b && !c
// However,
!c[->1] is equivalent to c[*0:$] ##1 c // OOPS, that should be ..##1!c
!c[->1] is equivalent to c[*0:$] ##1 !c
// "I want a=0 and b=1 to stay the same until c=0 so I used throughout."
// (!a && b throughout !c[->1]); does the same check right?
( b throughout R ) is equivalent to ( b [*0:$] intersect R )
/* thus !a && b is true at al cycles until (and inclusive) !c
// !c[->1] is equivalent to c[*0:$] ##1 !c // Updated my error in previous reply
// I meant I want a=0 and b=1 when c=0. */
// If you mean a and b can be anything until c==0, at which cycle you expect a=0 and b=1
( (z==3|| z==4 || z==6) && $fell(c) ) ->
##3 !a ##2 b ( ##1:$] [!a && b && !c);
// BTW
($changed(c) && (c==0)) is same as $fell(c)