# Assertion for signal stability inside a window

**URL:** <https://verificationacademy.com/forums/t/assertion-for-signal-stability-inside-a-window/37358>\
**Category:** SystemVerilog\
**Tags:** SVA, throughout, SystemVerilog, rose, assert, stable\
**Created:** [March 25, 2020, 1:37pm UTC](https://verificationacademy.com/forums/t/assertion-for-signal-stability-inside-a-window/37358 "2020-03-25T13:37:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexkidd84](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/alexkidd84/32/1540_2.png) [@alexkidd84](https://verificationacademy.com/forums/u/alexkidd84)\
**Post date:** [March 25, 2020, 1:37pm UTC](https://verificationacademy.com/forums/t/assertion-for-signal-stability-inside-a-window/37358/1 "2020-03-25T13:37:07Z")

</div>

Hi all,  
my purpose is to check that ‘c’ is stable since a fell down (and b is low) and until a goes high again.

I wrote this SVA:

```verilog

assert property (@(posedge clk) disable iff (!reset_n) (!a && !b |=> ($stable(c) throughout (a) [-> 1])))

```

[I’ve uploaded the image here…](https://gifyu.com/image/dvwd)

The problem is that the assertion fails because it’s checking the clock next a returns high  
Can anyone help me with this?

---

<div class="post-metadata">

**Author:** ![user49](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/user49/32/4533_2.png) [@user49](https://verificationacademy.com/forums/u/user49)\
**Post date:** [March 25, 2020, 6:28pm UTC](https://verificationacademy.com/forums/t/assertion-for-signal-stability-inside-a-window/37358/2 "2020-03-25T18:28:46Z")

</div>

_In reply to [alexkidd84](https://verificationacademy.com/forums/t/assertion-for-signal-stability-inside-a-window/37358):_

Your requirements are not clear; I believe that this is what you are trying to express:  
At (fell(a) && !b) then starting from the next clock “c” holds the value it had at the fell(a)  
until a rose(a). At the rose(a), “c” can change value.

```verilog

//my purpose is to check that 'c' is stable since a fell down (and b is low) 
    //and until a goes high again. 
    property p_cstable;
        bit v; 
        @(posedge clk) disable iff (!reset_n)
        ($fell(a) && !b, v=c )|=> c==v s_until $rose(a);
    endproperty 
    ap_c_stable: assert property(p_cstable);  

```

If this is not your requirements, then please re-express them again.  
Ben Cohen  
[http://www.systemverilog.us/](http://www.systemverilog.us/) [ben@systemverilog.us](mailto:ben@systemverilog.us)  
For training, consulting, services: contact [Home - My cvcblr](http://cvcblr.com/home)

- [SVA Handbook 4th Edition, 2016 ISBN 978-1518681448](http://goo.gl/JOfuEB)
- A Pragmatic Approach to VMM Adoption 2006 ISBN 0-9705394-9-5
- Using PSL/SUGAR for Formal and Dynamic Verification 2nd Edition, 2004, ISBN 0-9705394-6-0
- [Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn 978-1539769712](https://goo.gl/d10QHh)
- Component Design by Example ", 2001 ISBN 0-9705394-0-1
- VHDL Coding Styles and Methodologies, 2nd Edition, 1999 ISBN 0-7923-8474-1
- VHDL Answers to Frequently Asked Questions, 2nd Edition ISBN 0-7923-8115

* * *

1. SVA Alternative for Complex Assertions  
[Verification Horizons - March 2018 Issue | Verification Academy](https://verificationacademy.com/news/verification-horizons-march-2018-issue)
2. [SVA: Package for dynamic and range delays and repeats | Verification Academy](https://verificationacademy.com/forums/systemverilog/sva-package-dynamic-and-range-delays-and-repeats)
3. SVA in a UVM Class-based Environment  
[SVA in a UVM Class-based Environment | Verification Horizons | Verification Academy](https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment)

---

<div class="post-metadata">

**Author:** ![user49](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/user49/32/4533_2.png) [@user49](https://verificationacademy.com/forums/u/user49)\
**Post date:** [March 25, 2020, 8:45pm UTC](https://verificationacademy.com/forums/t/assertion-for-signal-stability-inside-a-window/37358/3 "2020-03-25T20:45:56Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/assertion-for-signal-stability-inside-a-window/37358/2):_

```verilog

// Ths is equivalent to the property p_cstable
ap_c_stable2: assert property(@ (posedge clk) disable iff (!reset_n)
       ($fell(a) && !b)|=> $stable(c) s_until $rose(a));  

    property p_cstable;
        bit v; 
        @(posedge clk) disable iff (!reset_n)
        ($fell(a) && !b, v=c )|=> c==v s_until $rose(a);
    endproperty  
    ap_c_stable: assert property(p_cstable);  
      

```

---

<div class="post-metadata">

**Author:** ![alexkidd84](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/alexkidd84/32/1540_2.png) [@alexkidd84](https://verificationacademy.com/forums/u/alexkidd84)\
**Post date:** [March 26, 2020, 9:45am UTC](https://verificationacademy.com/forums/t/assertion-for-signal-stability-inside-a-window/37358/4 "2020-03-26T09:45:38Z")

</div>

Thanks Ben!!  
I was using 2005 sv version and I didn’t know the construct s\_until.
