# Need to Use Variable in Assertions ## Delay

**URL:** <https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog\
**Created:** [August 30, 2013, 7:27pm UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779 "2013-08-30T19:27:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dharak](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/3be4f8/32.png) [@Dharak](https://verificationacademy.com/forums/u/Dharak)\
**Post date:** [August 30, 2013, 7:27pm UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/1 "2013-08-30T19:27:06Z")

</div>

Hi,  
I am working on some assertions and I came across some specific requirement.

Here is sample code.

```auto
logic [3:0] delay,a,b;

property assert_check;
  @(posedge clk) disable iff(disable_assertion)
  $rose(a) |-> ##(delay) b == 1;
endproperty : assert_check

```

Now SVA is not allowing a variable in ## delay.  
Can anybody please suggest any alternative?

I can’t use defines. I have to use the variable because its coming from design and it can also change later in the same simulation.

Thanks in Advance…  
Dharak

---

<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:** [August 30, 2013, 8:09pm UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/2 "2013-08-30T20:09:11Z")

</div>

If you really want a 0 delay when “delay”==0, you could write this

```auto
property assert_check;
    int v; // variable "delay" can be >0
           // If set to "0", then no delay, 
  @(posedge clk) disable iff(disable_assertion)
  ($rose(a), v=delay+1'b1) |-> (1, v=v-1'b1)[*0:$] ##1 v==0 ##0 b == 1;
endproperty : assert_check

```

---

<div class="post-metadata">

**Author:** ![Dharak](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/3be4f8/32.png) [@Dharak](https://verificationacademy.com/forums/u/Dharak)\
**Post date:** [August 30, 2013, 9:14pm UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/3 "2013-08-30T21:14:49Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/2):_

Thanks for your reply Ben…  
But I have a question on this.  
I want something like…  
Assertion should start with $rose(a)  
Then after “Delay” value ‘b’ should be high. ‘b’ must be high only after specific “Delay”. {Delay is a variable".

I am trying to inject an error but it is not firing.  
Can you please confirm that its doing same thing.

Thanks,  
Dharak

---

<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:** [August 30, 2013, 11:01pm UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/4 "2013-08-30T23:01:02Z")

</div>

_In reply to [Dharak](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/3):_

```auto
property assert_check;
    int v; // variable "delay" can be >0
           // If set to "0", then no delay, 
  @(posedge clk) disable iff(disable_assertion)
  ($rose(a), v=delay+1'b1) |-> (1, v=v-1'b1)[*0:$] ##1 v==0 ##0 b == 1;
endproperty : assert_check

```

> I want something like…  
> Assertion should start with $rose(a)  
> Then after “Delay” value ‘b’ should be high. ‘b’ must be high only after specific “Delay”. {Delay is a variable".  
> I am trying to inject an error but it is not firing.  
> Can you please confirm that its doing same thing.

When I first looked at your code, I concentrated on the property. Looking again at your code, I see that your “a” is a 4-bit vector. So if “a” goes from 4’b1000 to 4’b0100 the $rose(a) is 0, no change. In my first look, I assumed that “a” was a single bit.  
Thus, the point I am making is that our $rose(a) is ambiguous. If you mean a change in “a”, you could use " $changed(a) " or " !$statble(a) " instead of " $rose(a) ".  
What I wrote says that if a rose of a (i.e., vector goes from a value of 0 to a value of 1, then if the dealy has a value of 3, v=4; then in the same cycle, v gets decremented immediately, and then after every cycle until v==0. So, in 3 cycles, v==0, and at that time. b vector should be ==1 (i.e., the “b” should be greater than 0.

Watch your “bits” and “bit vectors”, there is a difference. If your vector b should be equal to your original vector a after a delay, you can do the following:

```auto
logic [3:0] delay,a,b;
property assert_check;
    int v_delay, v_b; // variable "delay" can be 0
  @(posedge clk) disable iff(disable_assertion)
  ($changed(a), v=delay+1'b1, v_b=a) |-> (1, v_delay=v_delay-1'b1)[*0:$] 
                                       ##1 v_delay==0 ##0 b == v_b;
endproperty : assert_check

```

---

<div class="post-metadata">

**Author:** ![Dharak](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/3be4f8/32.png) [@Dharak](https://verificationacademy.com/forums/u/Dharak)\
**Post date:** [September 26, 2013, 6:42pm UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/5 "2013-09-26T18:42:49Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/4):_

Thanks Ben…  
Actually by mistake I have added [3:0] a . It is 1 bit only. Your first solution is working. But I had to add one condition in that.

```auto
($rose(a), v=delay+1'b1) |-> ( **v>0**** , v=v-1'b1)[*0:$] ##1 v==0 ##0 b == 1;

```

---

<div class="post-metadata">

**Author:** ![aravindbhat](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ce73a5/32.png) [@aravindbhat](https://verificationacademy.com/forums/u/aravindbhat)\
**Post date:** [August 13, 2014, 11:42am UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/6 "2014-08-13T11:42:53Z")

</div>

_In reply to [Dharak](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/5):_

can we apply the same delay concept inside a sequence ? without the -\> operator

---

<div class="post-metadata">

**Author:** ![Mukesh\_Saha](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/mukesh_saha/32/2856_2.png) [@Mukesh\_Saha](https://verificationacademy.com/forums/u/Mukesh_Saha)\
**Post date:** [January 29, 2015, 7:42am UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/7 "2015-01-29T07:42:24Z")

</div>

_In reply to [aravindbhat](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/6):_

Hi Ben,  
I tried your code but its not working while I want to check for a error condition.

Here is the snippet code for the same,

```verilog
int delay=3;
property txeidle_0;
   int x;
   @(posedge clk) ($fell(sig),x=y) |-> ((1,x=x-1) [*0:$] ##1 (x==0)) ##0 ((xp != xn) [*0:$] ##1 $rose(sig));
endproperty

Here the delay is 3, means 3 clock cycle or what ?
2.If I check for the scenario where xp != xn will assert after delay times means I want to check for the error condition.

help me out from this.
```

---

<div class="post-metadata">

**Author:** ![tirumalrao\_m](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/t/4bbf92/32.png) [@tirumalrao\_m](https://verificationacademy.com/forums/u/tirumalrao_m)\
**Post date:** [March 12, 2015, 1:37pm UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/8 "2015-03-12T13:37:01Z")

</div>

_In reply to [mukeshkumar.saha@reliabletechsys.com](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/7):_

Thank you, Good discussion,which helped me.

(rose(a), v=delay+1'b1) |-\> (v\>0, v=v-1'b1)[\*0:] ##1 v==0 ##0 b == 1;

---

<div class="post-metadata">

**Author:** ![Elbosily](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/e/43a26b/32.png) [@Elbosily](https://verificationacademy.com/forums/u/Elbosily)\
**Post date:** [November 7, 2015, 1:40pm UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/9 "2015-11-07T13:40:14Z")

</div>

_In reply to [Dharak](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/8):_

Hello!

I have faced the same problem :)

let’s say for example the interface is parametrized with parameter “sva\_parameter”

and you want to wait no. of clock cycles equal to this parameter, then using ##sva\_parameter will not be allowed!  
then you need to make a sequence, this sequence will take the generic or the parameter as an input and it works!  
Kindly check the following example:

sequence dummy\_seq\_1 (delay);  
1 ##delay 1;  
endsequence

property p1;  
@(posedge clk)  
(!signal\_a ##2 signal\_b) |-\> dummy\_seq\_1(sva\_parameter) |-\> !signal\_c ;  
endproperty

assert property (p1)  
uvm\_report\_info(“\>\> P1 \<\< Pass”,“Check Pass”,UVM\_NONE);  
else  
uvm\_report\_error(“\>\> P1 \<\< Fail”,“Check Fail”,UVM\_NONE);

It works :)

---

<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:** [November 7, 2015, 5:46pm UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/10 "2015-11-07T17:46:16Z")

</div>

_In reply to [Elbosily](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/9):_  
Some comments

```verilog

// 1) Following assertion can never fail because if the *0:$] and b==0
($rose(a), v=delay+1'b1) |-> (v>0, v=v-1'b1)[*0:$] ##1 v==0 ##0 b == 1;

// 2) Following assertion CAN fail because of the first_match() if b==0
($rose(a), v=delay+1'b1) |-> 
     first_match((v>0, v=v-1'b1)[*0:$] ##1 v==0) ##0 b == 1;

// 3) Consider the following example 
int v=5;
ap_1: assert property( x|-> ##2 b ##v c); // illegal in 1800'2012

/* If the variable used to define the delay has values that are within a constraint
range, such as between 0 and 7 (or 15, or at most 32) one can use the generate statement, which appears much simpler than the use of local variables and the sequence_match_item. Example: */
generate for (genvar g_i=0; g_i<8; g_i++) begin
  ap_delay_gen: assert property (v==g_i && $rose(a) |-> ##g_i b);
end endgenerate 

// 4) When a parameter is used, the value is static (and does not change) after elaboration, prior to sim. 
                    

```

Ben [SystemVerilog.us](http://SystemVerilog.us)

---

<div class="post-metadata">

**Author:** ![UVM\_learner6](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/u/a8b319/32.png) [@UVM\_learner6](https://verificationacademy.com/forums/u/UVM_learner6)\
**Post date:** [December 10, 2015, 12:01am UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/11 "2015-12-10T00:01:08Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/10):_

(rose(a), v=delay+1'b1) |-\> first\_match((v\>0, v=v-1'b1)[\*0:] ##1 v==0) ##0 b == 1;

This worked.

---

<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:** [December 10, 2015, 1:13am UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/12 "2015-12-10T01:13:31Z")

</div>

_In reply to [sharadha](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/11):_  
I put a lot of thought into Mantis 5067 (for 1800’2018) where delays and repeat operators can use module variables as the value for the delays or repeat. I now believe that the best approach would be to specify something like the following:

1. The range for the ​delay or ​repeat cannot be greater than 32, as specified by a bit vector of no more than 5 bits.
2. The delay or repeat statement is in a sequence that is used as a property, and not as a sequence (e.g., no end points, no implication operator after the sequence).

Thus,

```verilog

  bit[2:0] v=3;
  ap_delay: assert property( $rose(a) |-> d ##v b); 
// The compiler would automatically implement something like the following:
generate for (genvar g_i=0; g_i<8; g_i++) begin
      ap_delay_gen: assert property ($rose(a) |-> d ##0 v==g_i |-> ##g_i b);    
end endgenerate   

```

The above approach is simple to implement, fits most application​s, and is more generic conceptually.  
​The use of local variables is complex, but feasible. But the use of the generate statement is much easier to express and understand.  
Ben Cohen [http://www.systemverilog.us/](http://www.systemverilog.us/)

- SystemVerilog Assertions Handbook, 3rd Edition, 2013
- A Pragmatic Approach to VMM Adoption
- Using PSL/SUGAR … 2nd Edition
- Real Chip Design and Verification
- Cmpt Design by Example
- VHDL books

---

<div class="post-metadata">

**Author:** ![tirumalrao\_m](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/t/4bbf92/32.png) [@tirumalrao\_m](https://verificationacademy.com/forums/u/tirumalrao_m)\
**Post date:** [December 28, 2015, 6:06am UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/13 "2015-12-28T06:06:51Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/12):_

(rose(a), v=delay+1'b1) |-\> (v\>0, v=v-1'b1)[\*0:] ##1 v==0 ##0 $rose(b);

I want to check b rose 6 cycle after a raises, and during 6 cycle b should be zero, should not toggle.  
Please help me to implement this in assertion.

---

<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:** [December 28, 2015, 8:08pm UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/14 "2015-12-28T20:08:37Z")

</div>

_In reply to [tirumalrao\_m](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/13):_

> I want to check b rose 6 cycle after a raises, and during 6 cycle b should be zero, should not toggle.

Two solutions:

1. fixed 6 cycles for rose(b)
2. Delay-based on a variable

```verilog
module m_rose; 
	bit clk, a, b; 
	bit[3:0] delay=6; 
	default clocking @(posedge clk); endclocking
	initial forever #10 clk=!clk;   
	// I want to check b rose 6 cycle after a raises, 
        // and during 6 cycle b should be zero, should not toggle. 
	ap_ab: assert property(
			$rose(a) |=> !b[*5] ##1 $rose(b));  
	
	generate for (genvar g_i=0; g_i<16; g_i++) begin
	 if(g_i ==0)
                ap_delay_gen: assert property ($rose(a) && g_i==delay
      		|=> !b[*g_i] ##1 $rose(b)); // same as |=> $rose(b)
	 else 
	 	ap_delay_gen: assert property ($rose(a) && g_i==delay
      		|=> !b[*g_i-1'b1] ##1 $rose(b));    
        end endgenerate 

```

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

[http://systemverilog.us/m\_rose.sv](http://systemverilog.us/m_rose.sv) with simple testbench

Ben Cohen  
[http://www.systemverilog.us/](http://www.systemverilog.us/) [ben@systemverilog.us](mailto:ben@systemverilog.us)

- SystemVerilog Assertions Handbook 4th Edition, 2016 ISBN 978-1518681448
- 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 0-9705394-2-8
- 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

* * *

---

<div class="post-metadata">

**Author:** ![tirumalrao\_m](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/t/4bbf92/32.png) [@tirumalrao\_m](https://verificationacademy.com/forums/u/tirumalrao_m)\
**Post date:** [December 29, 2015, 4:30am UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/15 "2015-12-29T04:30:05Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/14):_

Thank you, for your help.

I tried above thing but for me g\_i is not fixed It will changes during run.  
It depends on some other variable in the simulation and that variable changes based on setting.

---

<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:** [December 29, 2015, 5:30am UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/16 "2015-12-29T05:30:21Z")

</div>

_In reply to [tirumalrao\_m](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/15):_

> _In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/15):_  
> I tried above thing but for me g\_i is not fixed It will changes during run.  
> It depends on some other variable in the simulation and that variable changes based on setting.

You missed my main point on the **generate**. The following code generates 16 separate assertions: Thus, the variable can change value. Note that in eh antecedent I have  
$rose(a) && g\_i==delay, thus, if among those 16 assertions, the ones that don’t match the delay create vacuous assertions. The only one that matches and has a successful $rose fire.

```verilog

generate for (genvar g_i=0; g_i<16; g_i++) begin
	 if(g_i ==0)
                ap_delay_gen: assert property ($rose(a) && g_i==delay
      		|=> !b[*g_i] ##1 $rose(b)); // same as |=> $rose(b)
	 else 
	 	ap_delay_gen: assert property ($rose(a) && g_i==delay
      		|=> !b[*g_i-1'b1] ##1 $rose(b));    
        end 
endgenerate 

```

Specifically, you would get

```verilog

 genblock(0)ap_delay_gen: assert property ($rose(a) && 0==delay
      		|=> !b[*0] ##1 $rose(b)); // same as |=> $rose(b)
 genblock(1)ap_delay_gen: assert property ($rose(a) && 1==delay
      		|=> !b[*1-1'b1] ##1 $rose(b)); 
...
genblock(15)ap_delay_gen: assert property ($rose(a) && 15==delay
      		|=> !b[*15-1'b1] ##1 $rose(b)); 

```

Here is the code and simulation results.

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

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

[Code used for simulation](http://SystemVerilog.us/m_rose.sv)

It looks like I could have done this instead, I don’t need the 0 case in this case. :

```verilog

generate for (genvar g_i=1; g_i<16; g_i++) begin
	 ap_delay_gen: assert property ($rose(a) && g_i==delay
      		|=> !b[*g_i-1'b1] ##1 $rose(b));    
        end 
endgenerate 

```

Ben Cohen  
[http://www.systemverilog.us/](http://www.systemverilog.us/) [ben@systemverilog.us](mailto:ben@systemverilog.us)

- SystemVerilog Assertions Handbook 4th Edition, 2016 ISBN 978-1518681448

---

<div class="post-metadata">

**Author:** ![tirumalrao\_m](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/t/4bbf92/32.png) [@tirumalrao\_m](https://verificationacademy.com/forums/u/tirumalrao_m)\
**Post date:** [December 29, 2015, 6:15am UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/17 "2015-12-29T06:15:45Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/16):_

Thank you, I think you are right, I Missed that condition in generator block.  
I can use this.

But I Have around 102 to 203 clocks variable. this will generate around 203 assertion for single assertion.

---

<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:** [December 29, 2015, 6:33am UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/18 "2015-12-29T06:33:54Z")

</div>

_In reply to [tirumalrao\_m](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/17):_

The use of the generate is good for a small number of assertions.  
You should be able to use a property with a local variable. Clarify your requirements and do a trial on a case. I’ll see if I can optimize it for you. Right now it is late for me, I can look at it in the morning.  
Ben

---

<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:** [December 29, 2015, 8:48pm UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/19 "2015-12-29T20:48:36Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/18):_  
If you don’t want to use the generate, you can do the following:

```verilog

property p_delay; 
  int v; 
   ($rose(a), v=delay+1'b1) |-> 
     first_match((v>0 && !b, v=v-1'b1)[*0:$] ##1 v==0) ##0 $rose(b);
// New comment: No need for the first_match because of the v>0 test
// Need of first_match() if we use the following instead 
// first_match((!b, v=v-1'b1)[*0:$] ##1 v==0) ##0 $rose(b);
endproperty 
// You need the first_match() because without it, id no $rose(b) 
// the repeats keeps on counting forever. 

```

Ben Cohen  
[http://www.systemverilog.us/](http://www.systemverilog.us/) [ben@systemverilog.us](mailto:ben@systemverilog.us)

- SystemVerilog Assertions Handbook 4th Edition, 2016 ISBN 978-1518681448
- 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 0-9705394-2-8
- 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

* * *

---

<div class="post-metadata">

**Author:** ![tirumalrao\_m](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/t/4bbf92/32.png) [@tirumalrao\_m](https://verificationacademy.com/forums/u/tirumalrao_m)\
**Post date:** [December 30, 2015, 5:03am UTC](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/20 "2015-12-30T05:03:50Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779/19):_

I think this should work.  
If first cycle value of b is zero, then b should have zero till end of count. at end it will check for rose of b.other wise assertion fails,(If I understood correctly)

correct me please.

[Next page](https://verificationacademy.com/forums/t/need-to-use-variable-in-assertions-delay/28779.md?page=2)
