# Assertion to ensure a signal comes up only few number of times in 100 clocks

**URL:** <https://verificationacademy.com/forums/t/assertion-to-ensure-a-signal-comes-up-only-few-number-of-times-in-100-clocks/32440>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, assetions\
**Created:** [October 19, 2016, 6:52pm UTC](https://verificationacademy.com/forums/t/assertion-to-ensure-a-signal-comes-up-only-few-number-of-times-in-100-clocks/32440 "2016-10-19T18:52:53Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [October 19, 2016, 8:04pm UTC](https://verificationacademy.com/forums/t/assertion-to-ensure-a-signal-comes-up-only-few-number-of-times-in-100-clocks/32440/2 "2016-10-19T20:04:59Z")

</div>

_In reply to [sphen](https://verificationacademy.com/forums/t/assertion-to-ensure-a-signal-comes-up-only-few-number-of-times-in-100-clocks/32440):_  
The reason your assertion always fails is that the Boolean expression (ck2==1) uses the sampled value of ck2, which is the value it has at the beginning of the of the time slot when @(posedge cl2) happens. So that will always be 0 (or X).

You need to be more specific about your condition, but I’ll assume you meant to say you want to check when signal is true n time in _any overlapping_ 100 clock cycles. The most efficient way to do that would be to create 100 bit shift register with a 1 set each time your signal is true and assert that the count of ones is 5.

bit [1:100] count5;

always @(posedge ck) count5 = {count5,signal==1};

property  
@(posedge ck2) enable |-\> $countones(count5) == 5;  
endproperty

You’ll need to enable the assertion after the first 100 clock cycles.

If the 100 clocks cycles is not overlapping, you can do something similar, but you’ll need to be more specific about how the period starts.

---

_[View the full topic](https://verificationacademy.com/forums/t/assertion-to-ensure-a-signal-comes-up-only-few-number-of-times-in-100-clocks/32440)._
