# Assume for formal verification

**URL:** <https://verificationacademy.com/forums/t/assume-for-formal-verification/41717>\
**Category:** SystemVerilog\
**Tags:** Formal-Verification, SystemVerilog, system-verilog-assertions-disable-iff, assertion\
**Created:** [May 28, 2023, 1:08pm UTC](https://verificationacademy.com/forums/t/assume-for-formal-verification/41717 "2023-05-28T13:08:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ViVer](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/v/a6a055/32.png) [@ViVer](https://verificationacademy.com/forums/u/ViVer)\
**Post date:** [May 28, 2023, 1:08pm UTC](https://verificationacademy.com/forums/t/assume-for-formal-verification/41717/1 "2023-05-28T13:08:17Z")

</div>

Hi, I am trying to write an assume as per following assumption:

> for every change in a data bus there should be only one corresponding valid signal ($rose), something like the image added. I tried writing this way but it is not working:

sequence valid\_cond;  
@(posedge clk)  
changed(Data) ##[0:] $changed(Data);  
endsequence

valid\_assume: assume property (  
@(posedge clk) disable iff(disable)  
1’b1 |-\> $rose(valid) and valid\_cond  
)  
Tried above with throughout also.

Tool says constraint conflict.

Is there any alternative to this?

More info:  
This valid can come anytime during the complete duration but we should definitely see one and only one valid rise

---

<div class="post-metadata">

**Author:** ![ViVer](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/v/a6a055/32.png) [@ViVer](https://verificationacademy.com/forums/u/ViVer)\
**Post date:** [May 28, 2023, 1:14pm UTC](https://verificationacademy.com/forums/t/assume-for-formal-verification/41717/2 "2023-05-28T13:14:22Z")

</div>

_In reply to [ViVer](https://verificationacademy.com/forums/t/assume-for-formal-verification/41717):_

> Hi, I am trying to write an assume as per following assumption:  
> for every change in a data bus there should be only one corresponding valid signal ($rose), something like the image added. I tried writing this way but it is not working:  
> sequence valid\_cond;  
> @(posedge clk)  
> changed(Data) ##[0:] $changed(Data);  
> endsequence  
> valid\_assume: assume property (  
> @(posedge clk) disable iff(disable)  
> 1’b1 |-\> $rose(valid) and valid\_cond  
> )  
> Tried above with throughout also.  
> Tool says constraint conflict.  
> Is there any alternative to this?  
> More info:  
> This valid can come anytime during the complete duration but we should definitely see one and only one valid rise

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

---

<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:** [May 30, 2023, 5:15am UTC](https://verificationacademy.com/forums/t/assume-for-formal-verification/41717/3 "2023-05-30T05:15:02Z")

</div>

_In reply to [ViVer](https://verificationacademy.com/forums/t/assume-for-formal-verification/41717/2):_  
For every change in a data bus there should be only one corresponding valid signal ($rose),

```verilog

valid_assume: assume property (
     @(posedge clk) disable iff(disable)
     $changed(Data) |-> $rose(valid)); // May not be what you want

// This may be what you need
// If a change in data then ONE valid within this change and the next change 
valid_assume2: assume property (
     @(posedge clk) disable iff(disable)
// $changed(Data) |-> valid[->1] within $changed(Data)[->2]
$changed(Data) |-> valid[=1] intersect $changed(Data)[->2]
);

```

Ben Cohen  
[Ben@systemverilog.us](mailto:Ben@systemverilog.us)  
Link to the list of papers and books that I wrote, many are now donated.

> **[Cohen\_Links\_to\_papers\_books.pdf](https://systemverilog.us/vf/Cohen_Links_to_papers_books.pdf)**
>
> 141.16 KB

or [Cohen\_Links\_to\_papers\_books - Google Docs](https://rb.gy/ibks5p)

Getting started with verification with SystemVerilog

> **[Ben Cohen on LinkedIn: Road map to start with verification: SV, SVA , UVM and TB](https://www.linkedin.com/posts/ben-cohen-1172a0_road-map-to-start-with-verification-sv-activity-7050267628208062464-wnzN?utm_source=share&utm_medium=member_desktop)**
>
> Got this question: 
> Q: I need your advice in getting started with verification with systemverilog. I 've built various projects using Verilog and they was…

---

<div class="post-metadata">

**Author:** ![ViVer](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/v/a6a055/32.png) [@ViVer](https://verificationacademy.com/forums/u/ViVer)\
**Post date:** [May 30, 2023, 10:38am UTC](https://verificationacademy.com/forums/t/assume-for-formal-verification/41717/4 "2023-05-30T10:38:56Z")

</div>

_In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/assume-for-formal-verification/41717/3):_

Difference between within/and/intersect: the change is w.r.t. the matching start and end point, right?  
I mean if we use “and” that means valid is 1 at the same clock when $changed(data) is detected and if we use “within” that means valid can be 1 anywhere between two changes in data and with “intersect” both valid and data change detection points should match which means the duration of valid is equal to duration between two changes.

am I getting it right?

the problem however is a bit complex it doesn’t say there is any relation of valid high duration with change in data. The more descriptive problem is there should be one valid per data change and that valid should remain asserted until it sees an ack after which it falls. maybe better to break into two assumes.

---

<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:** [May 30, 2023, 7:32pm UTC](https://verificationacademy.com/forums/t/assume-for-formal-verification/41717/5 "2023-05-30T19:32:29Z")

</div>

_In reply to [ViVer](https://verificationacademy.com/forums/t/assume-for-formal-verification/41717/4):_

> _In reply to [ben@SystemVerilog.us](https://verificationacademy.com/forums/t/assume-for-formal-verification/41717/4):_  
> Difference between within/and/intersect: the change is w.r.t. the matching start and end point, right?  
> I mean if we use “and” that means valid is 1 at the same clock when $changed(data) is detected and if we use “within” that means valid can be 1 anywhere between two changes in data and with “intersect” both valid and data change detection points should match which means the duration of valid is equal to duration between two changes.  
> am I getting it right?

[Ben] NO. You are missing the goto operator.

```verilog

$changed(Data) |-> valid[->1] within $changed(Data)[->2]
// I am shying away from the "within" because a second valid would be missed. 
// 1800'2017: The construct seq1 within seq2 is an abbreviation for the following: 
(1[*0:$] ##1 seq1 ##1 1[*0:$]) intersect seq2 

// This property 
$changed(Data) |-> valid[=1] intersect $changed(Data)[->2]
// is same as 
$changed(Data) |-> !valid[*0:$] ##1 valid ##1 !valid[*0:$] intersect $changed(Data)[->2]
// Thus, after a change in data there can be ONE valid between that change (at the attempt time) 
// and (including) the next change in data

```

> the problem however is a bit complex it doesn’t say there is any relation of valid high duration with change in data.

[Ben] Above assertion does require valid to be true for only one cycle.

> The more descriptive problem is there should be one valid per data change and that valid should remain asserted until it sees an ack after which it falls. maybe better to break into two assumes.

```verilog

valid_assume2: assume property (
     @(posedge clk) disable iff(disable) 
        $changed(Data) |-> 
              valid[*1:$] ##1 ack ##1 !valid[*1:$] ##1 $changed(Data);
valid_assume3: assume property ( // valid can come in after a few cycles
     @(posedge clk) disable iff(disable) 
        $changed(Data) |-> 
             valid[->1] ##0 valid[*1:$] ##1 ack ##1 !valid[*1:$] ##1 $changed(Data);

```

Let me know if this works out for you.  
Ben
