# SV. Assertion for this scenario

**URL:** <https://verificationacademy.com/forums/t/sv-assertion-for-this-scenario/49724>\
**Category:** SystemVerilog\
**Tags:** assertion\
**Created:** [February 26, 2025, 4:12pm UTC](https://verificationacademy.com/forums/t/sv-assertion-for-this-scenario/49724 "2025-02-26T16:12:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Angadp98](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ba9def/32.png) [@Angadp98](https://verificationacademy.com/forums/u/Angadp98)\
**Post date:** [February 26, 2025, 4:12pm UTC](https://verificationacademy.com/forums/t/sv-assertion-for-this-scenario/49724/1 "2025-02-26T16:12:07Z")

</div>

I have two signals X and Y.  
X is a 10 bit signal  
How to write an assertion to check X changes (toggles) atleast once before every positive edge of Y. There is no requirement on how many cycles before positive edge of Y , X should toggle.

I was thinking of a forward looking assertion of this type

```auto
  property toggle_check;
    @(posedge clk) disable iff (0)
    $changed(x) [*1:$] ##1 $rose(y);
  endproperty : toggle_check

```

However if this gets satisfied once and then post that we never have a toggle of X before $rose(y) then i think the assertion wont catch it. Am I right ?

Any better way/suggestions on how to write this assertion ?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![hdlcohen](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/b5e925/32.png) [@hdlcohen](https://verificationacademy.com/forums/u/hdlcohen)\
**Post date:** [February 26, 2025, 11:20pm UTC](https://verificationacademy.com/forums/t/sv-assertion-for-this-scenario/49724/2 "2025-02-26T23:20:22Z")

</div>

Use always\_ff to set a tag when X changes value.  
Reset the tag when rose of Y.

```auto
$rose(Y) |-> tag

```

---

<div class="post-metadata">

**Author:** ![Angadp98](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ba9def/32.png) [@Angadp98](https://verificationacademy.com/forums/u/Angadp98)\
**Post date:** [February 27, 2025, 4:03am UTC](https://verificationacademy.com/forums/t/sv-assertion-for-this-scenario/49724/3 "2025-02-27T04:03:04Z")

</div>

Got it

The reseting of tag will happen in NBA  
tag \<= 0

but the assertion will use the preponed value of tag (which would be !=0)

---

<div class="post-metadata">

**Author:** ![hdlcohen](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/b5e925/32.png) [@hdlcohen](https://verificationacademy.com/forums/u/hdlcohen)\
**Post date:** [February 27, 2025, 5:34am UTC](https://verificationacademy.com/forums/t/sv-assertion-for-this-scenario/49724/4 "2025-02-27T05:34:48Z")

</div>

Req: X changes (toggles) atleast once before every positive edge of Y  
$rose(Y) |-\> tag  
Y, tag values are the sampled values at the Preponed region.  
// support logic  
@(posedge clk) if($rose(Y)) tag \<=0;  
tag is 0 in NBA

What issues do you see?  
Need to think about how to handle tag when rose of Y and change of X occur in the same cycle.  
Do that in the support logic.

---

<div class="post-metadata">

**Author:** ![Angadp98](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ba9def/32.png) [@Angadp98](https://verificationacademy.com/forums/u/Angadp98)\
**Post date:** [February 27, 2025, 6:40am UTC](https://verificationacademy.com/forums/t/sv-assertion-for-this-scenario/49724/5 "2025-02-27T06:40:24Z")

</div>

I dont see any issues. I just mentioned the rationale behind why your mentioned solution works.  
Thanks
