# Help needed for an assertion question

**URL:** <https://verificationacademy.com/forums/t/help-needed-for-an-assertion-question/32435>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, system-verilog-assertion-SVA\
**Created:** [October 18, 2016, 11:44pm UTC](https://verificationacademy.com/forums/t/help-needed-for-an-assertion-question/32435 "2016-10-18T23:44:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sk9](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/e79b87/32.png) [@sk9](https://verificationacademy.com/forums/u/sk9)\
**Post date:** [October 18, 2016, 11:44pm UTC](https://verificationacademy.com/forums/t/help-needed-for-an-assertion-question/32435/1 "2016-10-18T23:44:26Z")

</div>

Hi, I am trying to write an assertion for the following question.

A high for 5 cycles and B high after 4 non-continuous highs of A and finally both A and B are high.  
Can you please help me write an assertion for this.

---

<div class="post-metadata">

**Author:** ![kddholak](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/kddholak/32/1363_2.png) [@kddholak](https://verificationacademy.com/forums/u/kddholak)\
**Post date:** [October 19, 2016, 12:32am UTC](https://verificationacademy.com/forums/t/help-needed-for-an-assertion-question/32435/2 "2016-10-19T00:32:17Z")

</div>

_In reply to [sruthikrapa](https://verificationacademy.com/forums/t/help-needed-for-an-assertion-question/32435):_

```auto
If there is a clock for this particular check simple way to write this one. 

property abcheck ;
@(posedge clk) a |-> a[->4] ##0 b ##1 a ##0 b;
endproperty

```

---

<div class="post-metadata">

**Author:** ![yourcheers](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/y/5f9b8f/32.png) [@yourcheers](https://verificationacademy.com/forums/u/yourcheers)\
**Post date:** [October 19, 2016, 12:32am UTC](https://verificationacademy.com/forums/t/help-needed-for-an-assertion-question/32435/3 "2016-10-19T00:32:53Z")

</div>

_In reply to [sruthikrapa](https://verificationacademy.com/forums/t/help-needed-for-an-assertion-question/32435/2):_

sequence s1;  
A[=4];  
endsequence

property p1;  
@(posedge clk) s1 |=\> [0:$] (A&&B == 1) ##1 (A||B == 0) ;  
endproperty

Is this what you needed?

---

<div class="post-metadata">

**Author:** ![sk9](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/e79b87/32.png) [@sk9](https://verificationacademy.com/forums/u/sk9)\
**Post date:** [October 19, 2016, 5:30pm UTC](https://verificationacademy.com/forums/t/help-needed-for-an-assertion-question/32435/4 "2016-10-19T17:30:31Z")

</div>

Thank you yourcheers and kddholak for your answers.  
They are useful.

-Sruthi.

---

<div class="post-metadata">

**Author:** ![Kumar9822](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/k/e8c25b/32.png) [@Kumar9822](https://verificationacademy.com/forums/u/Kumar9822)\
**Post date:** [June 19, 2024, 7:28am UTC](https://verificationacademy.com/forums/t/help-needed-for-an-assertion-question/32435/5 "2024-06-19T07:28:27Z")

</div>

I was asked this assertion in an interview,  
Property ppt;  
@(posedge clk) $rose(a)|-\>a[-\>4]|-\>b##1$stable(a)&&b;  
endproperty.  
Can anyone please validate my answer, i am a beginner stage in assertions.  
That would mean a lot

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [June 19, 2024, 10:45am UTC](https://verificationacademy.com/forums/t/help-needed-for-an-assertion-question/32435/6 "2024-06-19T10:45:54Z")

</div>

There can be only 1 implication poperator in a property. You have 2 ones.

---

<div class="post-metadata">

**Author:** ![Have\_A\_Doubt](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Have\_A\_Doubt](https://verificationacademy.com/forums/u/Have_A_Doubt)\
**Post date:** [June 20, 2024, 6:49am UTC](https://verificationacademy.com/forums/t/help-needed-for-an-assertion-question/32435/7 "2024-06-20T06:49:52Z")

</div>

> [@Kumar9822](#):
>
> I was asked this assertion in an interview,  
> Property ppt;  
> @(posedge clk) $rose(a)|-\>a[-\>4]|-\>b##1$stable(a)&&b;  
> endproperty.  
> Can anyone please validate my answer, i am a beginner stage in assertions.  
> That would mean a lot

A few things ::  
(1) Please reiterate the question. The one at the top is ambiguous.  
Give a few examples of passing and failing scenarios  
(2) **B high after 4 non-continuous highs of A**  
It specifically says **4 non-continuous**. A[-\>4] matches when A is true 4 continuous times or when A is true 4 non-continuous times  
(3) **A high for 5 cycles and B high after 4 non-continuous highs of A.**  
Out of the 5 cycles , A must be high 4 non-continuous times before b is high ?  
Is B high on the same 4 non-consecutive occurrence of A or the next clock ?  
(4) **finally both A and B are high.**  
So A is high for the 5th time whereas B is high for the 1st time ?

---

<div class="post-metadata">

**Author:** ![Allurer](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/e19b73/32.png) [@Allurer](https://verificationacademy.com/forums/u/Allurer)\
**Post date:** [June 20, 2024, 7:54am UTC](https://verificationacademy.com/forums/t/help-needed-for-an-assertion-question/32435/8 "2024-06-20T07:54:59Z")

</div>

@chr_sue  
Please clarify, Will this work?

> 1’b1 |-\> ( A[-\>4] ##[0:$] (A&&B) ##1 ((A||B)==0) ) ;

---

<div class="post-metadata">

**Author:** ![Kumar9822](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/k/e8c25b/32.png) [@Kumar9822](https://verificationacademy.com/forums/u/Kumar9822)\
**Post date:** [July 18, 2024, 3:24am UTC](https://verificationacademy.com/forums/t/help-needed-for-an-assertion-question/32435/9 "2024-07-18T03:24:49Z")

</div>

thank you for response ,will definitely look into that.

---

<div class="post-metadata">

**Author:** ![Kumar9822](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/k/e8c25b/32.png) [@Kumar9822](https://verificationacademy.com/forums/u/Kumar9822)\
**Post date:** [July 18, 2024, 3:26am UTC](https://verificationacademy.com/forums/t/help-needed-for-an-assertion-question/32435/10 "2024-07-18T03:26:44Z")

</div>

thank you for response sir,this would help me learn more about assertions more.
