# Coverpoint for consecutive edge sequence

**URL:** <https://verificationacademy.com/forums/t/coverpoint-for-consecutive-edge-sequence/40587>\
**Category:** Coverage\
**Tags:** SystemVerilog, Coverage, systemverilog-coverage\
**Created:** [June 27, 2022, 3:21pm UTC](https://verificationacademy.com/forums/t/coverpoint-for-consecutive-edge-sequence/40587 "2022-06-27T15:21:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![atashinchi](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@atashinchi](https://verificationacademy.com/forums/u/atashinchi)\
**Post date:** [June 27, 2022, 3:21pm UTC](https://verificationacademy.com/forums/t/coverpoint-for-consecutive-edge-sequence/40587/1 "2022-06-27T15:21:49Z")

</div>

I would like to write a coverpoint to capture a sequence of edge events: two toggles of A followed by two toggles of B. There is no predictability in terms of when the second A comes wrt to first A. Similarly, there is no predictability on the two B’s. They can also each stay high for any number of cycles.

 ![](https://verificationacademy.com/forums/uploads/default/original/1X/75b5009efa10951148c85ecb3e1e41fe6b2a262a.png)

I’m thinking to write something like:

```verilog
cover property (@(posedge clk) !B ##1 $rose(A) ##[1:$] $rose(A) |-> !A ##1 $rose(B) ##[1:$] $rose(B));

```

But it looks like this won’t work since it does not guarantee that B stays low throughout the first two $rose of A and similarly, A stays low during the two $rose of B. How can I enforce this?

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [June 28, 2022, 4:34pm UTC](https://verificationacademy.com/forums/t/coverpoint-for-consecutive-edge-sequence/40587/2 "2022-06-28T16:34:17Z")

</div>

_In reply to [atashinchi](https://verificationacademy.com/forums/t/coverpoint-for-consecutive-edge-sequence/40587):_

Didn’t test but how about

```verilog
cover property (@(posedge clk) $rose(a) ##0 !b throughout a[->2] |=> !a throughout b[->2] );

```

---

<div class="post-metadata">

**Author:** ![atashinchi](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@atashinchi](https://verificationacademy.com/forums/u/atashinchi)\
**Post date:** [June 28, 2022, 7:36pm UTC](https://verificationacademy.com/forums/t/coverpoint-for-consecutive-edge-sequence/40587/3 "2022-06-28T19:36:06Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/coverpoint-for-consecutive-edge-sequence/40587/2):_

> _In reply to [atashinchi](https://verificationacademy.com/forums/t/coverpoint-for-consecutive-edge-sequence/40587/2):_  
> Didn’t test but how about

```verilog
cover property (@(posedge clk) $rose(a) ##0 !b throughout a[->2] |=> !a throughout b[->2] );

```

Hi Dave,

Thank you. I tested this as an assertion and I think for the most part it did the trick. I fixed a minor syntax issue:

```verilog
cover property (@(posedge clk) $rose(a) ##0 (!b throughout a[->2]) |=> !a throughout b[->2] )

```

However, I think

```verilog
[->2]

```

will include the cases where A is high for two consecutive clocks followed by B high for two consecutive clocks. Is there any way to ensure that both A and B each have two $rose?

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [June 28, 2022, 9:23pm UTC](https://verificationacademy.com/forums/t/coverpoint-for-consecutive-edge-sequence/40587/4 "2022-06-28T21:23:04Z")

</div>

_In reply to [atashinchi](https://verificationacademy.com/forums/t/coverpoint-for-consecutive-edge-sequence/40587/3):_

```verilog
a[->2] 

```

is the same as

```verilog
(!a[*0:$] ##1 a) [*2]

```

is the same as

```verilog
!a[*0:$] ##1 a ##1 !a[*0:$] ##1 a

```

---

<div class="post-metadata">

**Author:** ![rag123](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/r/eada6e/32.png) [@rag123](https://verificationacademy.com/forums/u/rag123)\
**Post date:** [June 29, 2022, 5:48am UTC](https://verificationacademy.com/forums/t/coverpoint-for-consecutive-edge-sequence/40587/5 "2022-06-29T05:48:35Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/coverpoint-for-consecutive-edge-sequence/40587/4):_

Hi Dave,

Isnt it a[-\>1], you are already checking $rose(A) in the antecedent? In the waveform there is two highs of A not 3.

```verilog

cover property (@(posedge clk) $rose(a) ##0 (!b throughout a[->1) |=> !a throughout b[->2] ) 

```

]

---

<div class="post-metadata">

**Author:** ![hisingh](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/97f17d/32.png) [@hisingh](https://verificationacademy.com/forums/u/hisingh)\
**Post date:** [June 29, 2022, 11:39am UTC](https://verificationacademy.com/forums/t/coverpoint-for-consecutive-edge-sequence/40587/6 "2022-06-29T11:39:33Z")

</div>

_In reply to [rag123](https://verificationacademy.com/forums/t/coverpoint-for-consecutive-edge-sequence/40587/5):_

Based on the pic I think it should be ::

```verilog

cover property (@(posedge clk) ( $rose(a) && !b ) ##1 ( !b throughout ( $rose( a )[->1] ##1 $fell( a ) [->1] ) ) |-> !a throughout $rose(b)[->2] ) 

```

Another way could be ( May Need some modifications )

```verilog

cover property (@(posedge clk) (!b throughout ( $rose(a)[->2] ##1 $fell(a)[->1] ) |-> !a throughout $rose(b)[->2] ) 

```
