# Assigning a bit in SV Assertion

**URL:** <https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810>\
**Category:** SystemVerilog\
**Tags:** Assertion-Based-Verification, assert-property, SystemVerilog, assertion\
**Created:** [November 16, 2019, 8:23am UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810 "2019-11-16T08:23:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![atanu.biswas](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/9de0a6/32.png) [@atanu.biswas](https://verificationacademy.com/forums/u/atanu.biswas)\
**Post date:** [November 16, 2019, 8:23am UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/1 "2019-11-16T08:23:54Z")

</div>

Hello Everyone,

I have written the below assertion in which I want to a reset a bit when the signal named **write\_cycle** goes high.  
But the issue is that the bit is getting reset at the **next positive edge of the clock and not on the same edge on which the signal write\_cycle goes high**. The subroutine **reset\_match\_found()** resets the bit.

property data\_check;  
@(posedge clk)  
($rose(write\_cycle),reset\_match\_found()) |-\> ##[0:2] (first\_match(/_comparision statement_/),set\_match\_found());  
endproperty

function void reset\_match\_found();  
match\_found = 0;  
endfunction

Can anyone please help me with 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:** [November 16, 2019, 3:53pm UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/2 "2019-11-16T15:53:54Z")

</div>

_In reply to [atanu.biswas](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810):_

You cannot know that write\_cycle has risen until after the clock edge has passed in an assertion. There’s no way to go back in time to set match\_found.

You need to explain what you are attempting to accomplish with match\_found before anyone can suggest a workaround.

---

<div class="post-metadata">

**Author:** ![atanu.biswas](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/9de0a6/32.png) [@atanu.biswas](https://verificationacademy.com/forums/u/atanu.biswas)\
**Post date:** [November 16, 2019, 5:39pm UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/3 "2019-11-16T17:39:49Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/2):_

Hi Dave,

The match\_found bit should be set whenever a first match occurs depending upon the comparison statement in the consequent expression. The bit should be reset again when a write\_cycle is detected. This is the behaviour that I want. The match\_found bit is used to check that the comparison statement that was used inside the first\_match() remains valid as long as next write\_cycle is detected. That bit is used in an always\_comb procedural block.

---

<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 16, 2019, 10:02pm UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/4 "2019-11-16T22:02:09Z")

</div>

_In reply to [atanu.biswas](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/3):_

Your assertion looks OK to me. See my reply on SV evaluation regions.  
[https://verificationacademy.com/forums/systemverilog/sampling-point-assertions](https://verificationacademy.com/forums/systemverilog/sampling-point-assertions)

Your function changes the value of your variable in the Observed region, way past the Preponed region where the signals are sampled.  
I didn’t understand your last explanation.  
Ben [systemverilog.us](http://systemverilog.us)

---

<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:** [November 16, 2019, 11:08pm UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/5 "2019-11-16T23:08:58Z")

</div>

_In reply to [atanu.biswas](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/4):_

You cannot use an assertion for this. Assertions are meant to be passive and mot modify signals going back into your design. Your explanation is still not clear enough to know what you plan to do with the match\_found bit. How is an alaways\_comb involved with clock cycles??

---

<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 16, 2019, 11:28pm UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/6 "2019-11-16T23:28:19Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/5):_

Instead of SVA, consider using SV tasks, as described in my paper:  
SVA Alternative for Complex Assertions  
[https://verificationacademy.com/news/verification-horizons-march-2018-issue](https://verificationacademy.com/news/verification-horizons-march-2018-issue)

I agree with Dave in that assertions are meant to be passive and not modify design signals.  
However, SVA can be used to modify support verification variables.

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
- 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
- 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:** ![atanu.biswas](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/9de0a6/32.png) [@atanu.biswas](https://verificationacademy.com/forums/u/atanu.biswas)\
**Post date:** [November 17, 2019, 6:04am UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/7 "2019-11-17T06:04:55Z")

</div>

Hi Dave and Ben,

I went through the discussion in the threads. Understood that the $rose(write\_cycle) is being sampled in the preponed region and evaluated in the observed region, hence the behaviour. I am not trying to modify any DUT signal in the assertion. **match\_found is Not a DUT signal but a verification support signal whose scope is limited to the checker block in which the assertion is written.** Actually the entire code is written inside a checker block. Extremely sorry for not being able to convey my intent clearly. Below is my intent.

Bit write\_cycle goes HIGH whenever an APB write cycle is detected. When a write\_cycle is detected, within 0 to 2 APB clocks first match occurs according to the comparison statement written inside first\_match() construct. So when the first match occurs a bit match\_found is set HIGH. This match\_found bit remains HIGH until the next write\_cycle is detected. On detection of a write\_cyle the match\_found is reset. Also this match\_found bit is used in a always\_comb to check that comparison which was written inside the first\_match() remains valid until the next write\_cycle is detected.

The code that I had written is as follows:

property data\_check;  
@(posedge clk)  
($rose(write\_cycle),reset\_match\_found()) |-\> ##[0:2] (first\_match(/_comparision statement_/),set\_match\_found());  
endproperty

function void reset\_match\_found();  
match\_found = 0;  
endfunction

function set\_match\_found();  
match\_found = 1;  
endfunction

always\_comb  
if (match\_found)  
if (/_comparison statement is invalid_/)  
$error();

The intent of using an always\_comb block is to ensure the comparison happens independent of any clock.

---

<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 17, 2019, 9:05pm UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/8 "2019-11-17T21:05:07Z")

</div>

> The intent of using an always\_comb block is to ensure the comparison happens independent of any clock.

You have a clocked system. There is NO treason to have a continuous check between clocking events.

```verilog

// Check that comparison which was written inside the first_match() 
// remains valid until the next write_cycle is detected
ap_found_compare: assert property(@ (posedge clk)
  (match_found) |-> comparision_statemen );   

```

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

---

<div class="post-metadata">

**Author:** ![atanu.biswas](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/9de0a6/32.png) [@atanu.biswas](https://verificationacademy.com/forums/u/atanu.biswas)\
**Post date:** [November 18, 2019, 8:01am UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/9 "2019-11-18T08:01:39Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/8):_

Hi Ben,

I understood your point and I definitely agree with it. But the issue is that in my project there are multiple clock domains that are being used. There are internal registers that are written via the APB interface. There is one to one mapping of those registers with RTL’s output signals. The output is sampled at a clock which runs at a much higher frequency than that of the APB. So the issue is that if there is some glitch sampled by the RTL at that high frequency clock, I fear that the assertion wont be able to catch it. Hence to make it fool proof I am using the always\_comb block for the data check.

---

<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 18, 2019, 8:50am UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/10 "2019-11-18T08:50:14Z")

</div>

_In reply to [atanu.biswas](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/9):_

> So the issue is that if there is some glitch sampled by the RTL at that high frequency clock, I fear that the assertion wont be able to catch it. Hence to make it fool proof I am using the always\_comb block for the data check.

I don’t see how the always\_comb prevents any glitch in the signal from triggering a false error. Maybe I am missing something here. SVA allows for multiclocking. For example:

```verilog

ap_found_compare: assert property(@ (posedge clk1)
  (match_found) |-> @ (posedge clk2)comparision_statement );  

```

In your testbench environment you could construct a safe clk2 to do your sampling of the comparision\_statement. That build of clk2 could be combinational logic, or simply a delayed (e.g., # 2ns) off a known clock.  
an always\_comb triggers at every change of signals in the block, including glitches.  
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  
[https://verificationacademy.com/news/verification-horizons-march-2018-issue](https://verificationacademy.com/news/verification-horizons-march-2018-issue)
2. [SVA: Package for dynamic and range delays and repeats - SystemVerilog - Verification Academy](https://verificationacademy.com/forums/systemverilog/sva-package-dynamic-and-range-delays-and-repeats)
3. SVA in a UVM Class-based Environment  
[https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment](https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment)

---

<div class="post-metadata">

**Author:** ![atanu.biswas](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/9de0a6/32.png) [@atanu.biswas](https://verificationacademy.com/forums/u/atanu.biswas)\
**Post date:** [November 23, 2019, 4:48am UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/11 "2019-11-23T04:48:14Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/10):_

Hi Ben,

Finally decided to go with the clock. I wrote the assertion as below:

```verilog
property data_check;
@(clk) @rose(write_cycle) |-> ##[1:5] first_match(signal_to_check == write_data) |-> ((signal_to_check == write_data) until $rose(write_cycle));
endproperty

```

Basically I want that when the bit write\_cycle goes high, the check should begin when the first match occurs and should continue till the next rise of the bit write\_cycle.  
To check the assertion I forced “signal\_to\_check” to be zero. Still the assertion passes. Seems to be a vacuous pass. What could be the reason here?

---

<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 23, 2019, 5:36am UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/12 "2019-11-23T05:36:26Z")

</div>

_In reply to [atanu.biswas](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/11):_

You are incorrectly applying the first\_match  
Should be

```verilog
 
property data_check;
@(clk) @rose(write_cycle) ##0 first_match(##[1:5] signal_to_check == write_data) |-> ((signal_to_check == write_data) until $rose(write_cycle));
endproperty

```

1. you don’t need the |-\> after the 1st rose because if there is no match then the assertion is vacuous.
2. ##[1:5] first\_match(expr) is same as  
##[1:5] expr because expr sequence is of one cycle.  
Actually it is ##1 first\_match(expr) or ##2 first\_match(expr) or…

Whereas first\_match(##[1:5] expr) picks the 1st match of the sequence (##[1:5] expr)  
Thus, it picks the first\_match of the sequence  
##1 expr or ##2 expr or… ##5 expr.

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

---

<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 23, 2019, 2:09pm UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/13 "2019-11-23T14:09:57Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/12):_

To avoid vacuity after the rise of the write, use the followed-by operator that represents a sequence followed by a property

```verilog

property data_check;
@(clk) @rose(write_cycle) |->
 first_match(##[1:5] signal_to_check == write_data) #-# 
((signal_to_check == write_data) until $rose(write_cycle));
endproperty

// another option 
property data_check;
@(clk) @rose(write_cycle) |->
 first_match(##[1:5] signal_to_check == write_data) ##1
 ((signal_to_check == write_data)[*1:$] ##1 $rose(write_cycle));
endproperty

```

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

---

<div class="post-metadata">

**Author:** ![atanu.biswas](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/9de0a6/32.png) [@atanu.biswas](https://verificationacademy.com/forums/u/atanu.biswas)\
**Post date:** [November 25, 2019, 6:36am UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/14 "2019-11-25T06:36:12Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/13):_

Hi Ben,

Thanks a lot. That really helped. I tried it out and its working perfectly fine.

Also I did a small experiment. I write ##0 instead of |-\> after $rose as shown below:

property data\_check;  
@(clk) @rose(write\_cycle) ##0  
first\_match(##[1:5] signal\_to\_check == write\_data) #-#  
((signal\_to\_check == write\_data) until $rose(write\_cycle));  
endproperty

Ended up with Assertion errors at every point of time. Why does it happen? Also I need some fundamental understanding regarding the working of |-\> , ##0 and #-#. Is there any relevant article for this? That shall be of great help for me.

---

<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 25, 2019, 7:06am UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/15 "2019-11-25T07:06:00Z")

</div>

_In reply to [atanu.biswas](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/14):_

You really need to understand vacuity in SVA. Of course,my book explains all these concepts and operators with lots of examples. If you are in India,  
contact [Home - My cvcblr](http://cvcblr.com/home) for a better price.

You can also study 1800’2017 and do searches on Sva, there are many articles and training sites.

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
- 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
- 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:** ![atanu.biswas](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/9de0a6/32.png) [@atanu.biswas](https://verificationacademy.com/forums/u/atanu.biswas)\
**Post date:** [November 25, 2019, 9:47am UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/16 "2019-11-25T09:47:28Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/15):_

Also when the assertion fails it shouts error just once when it occurs for the first time. Why doest it shout error at every edge of the clk?

---

<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 25, 2019, 10:05am UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/17 "2019-11-25T10:05:49Z")

</div>

_In reply to [atanu.biswas](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/16):_

An assertion is attempted at every clocking event. Read my paper on the modeling of an assertion using SV only.

1. SVA Alternative for Complex Assertions  
[Verification Horizons - March 2018 Issue | Verification Academy](https://verificationacademy.com/news/verification-horizons-march-2018-issue)

If you understand the fork join\_any and tasks, then you’ll understand the modeling of an assertion, including the concept of antecedent / consequent and why you have errors without the implication operator.  
Ben [Ben@systemverilog.us](mailto:Ben@systemverilog.us)

---

<div class="post-metadata">

**Author:** ![atanubiswas](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/a183cd/32.png) [@atanubiswas](https://verificationacademy.com/forums/u/atanubiswas)\
**Post date:** [December 16, 2019, 8:30am UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/18 "2019-12-16T08:30:06Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/17):_

> _In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/17):_  
> // another option  
> property data\_check;  
> @(clk) @rose(write\_cycle) |-\>  
> first\_match(##[1:5] signal\_to\_check == write\_data) ##1  
> ((signal\_to\_check == write\_data)[\*1:$] ##1 $rose(write\_cycle));  
> endproperty

```auto

Ben systemverilog.us

Hi Ben,

I intentionally rewrote the assertion as below:
property data_check;
@(clk) @rose(write_cycle) |->
 first_match(##[1:5] signal_to_check == write_data) |->
 ((signal_to_check == write_data) until $rose(write_cycle));
endproperty

**initial $assertvacuousoff(0);**

**assert property (data_check) $display ("Assertion Pass") else $error();**

**and forced the "signal_to_check" to 0** in the testcase. Now this is a case of vacuous success and the pass block should have been turned off. But still the pass block remains on. Why this kind of behaviour?
```

---

<div class="post-metadata">

**Author:** ![atanubiswas](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/a183cd/32.png) [@atanubiswas](https://verificationacademy.com/forums/u/atanubiswas)\
**Post date:** [December 16, 2019, 9:17am UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/19 "2019-12-16T09:17:08Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/18):_

> _In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/18):_  
> To avoid vacuity after the rise of the write, use the followed-by operator that represents a sequence followed by a property

```verilog

// another option 
property data_check;
@(clk) @rose(write_cycle) |->
first_match(##[1:5] signal_to_check == write_data) ##1
((signal_to_check == write_data)[*1:$] ##1 $rose(write_cycle));
endproperty

```

I have one more query. I am using the above mentioned assertion. I am asserting the property as below:

assert property (data\_check) $display (“Assertion Pass”); else error

But the pass statement is not showing up on each and every clock edge at which the assertion passes. Instead it shows up only once. Dont know the reason for 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:** [December 16, 2019, 8:54pm UTC](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/20 "2019-12-16T20:54:39Z")

</div>

_In reply to [atanubiswas](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810/19):_

> and forced the “signal\_to\_check” to 0 in the testcase. Now this is a case of vacuous success and the pass block should have been turned off. But still the pass block remains on. Why this kind of behaviour?

See [(1) - EDA Playground](https://www.edaplayground.com/x/3AtL#_=_)

```verilog
property data_check;
    @(posedge clk) $rose(a) |->
    first_match(##[1:5] 0) |-> 1;   
  endproperty    
    // initial $assertvacuousoff(0);
  assert property (data_check) $display ("Assertion Pass"); else $error(); 

```

In simulation the PASS action block is not displayed, even with the $assertvacuousoff(0); commented out. Users do not want the pass action block on vacuity. I believe that tools autmatically set a switch to do that. If the use of $assertvacuousoff(0); does not turn off the pass acton on vacuity, you’ll need to contact your vendor.

> But the pass statement is not showing up on each and every clock edge at which the assertion passes. Instead it shows up only once. Dont know the reason for this.

Is your concurrent assertion in an initial block?

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  
[https://verificationacademy.com/news/verification-horizons-march-2018-issue](https://verificationacademy.com/news/verification-horizons-march-2018-issue)
2. [SVA: Package for dynamic and range delays and repeats - SystemVerilog - Verification Academy](https://verificationacademy.com/forums/systemverilog/sva-package-dynamic-and-range-delays-and-repeats)
3. SVA in a UVM Class-based Environment  
[https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment](https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment)

[Next page](https://verificationacademy.com/forums/t/assigning-a-bit-in-sv-assertion/36810.md?page=2)
