# Assertion to check for signal propagation

**URL:** <https://verificationacademy.com/forums/t/assertion-to-check-for-signal-propagation/45613>\
**Category:** SystemVerilog\
**Tags:** assertion\
**Created:** [January 11, 2024, 3:11pm UTC](https://verificationacademy.com/forums/t/assertion-to-check-for-signal-propagation/45613 "2024-01-11T15:11:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dannyg](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/9fc29f/32.png) [@dannyg](https://verificationacademy.com/forums/u/dannyg)\
**Post date:** [January 11, 2024, 3:11pm UTC](https://verificationacademy.com/forums/t/assertion-to-check-for-signal-propagation/45613/1 "2024-01-11T15:11:29Z")

</div>

Hi,  
I am trying to write an assertion to check signal propagation. I want to see that if a “src” signal changes, then after some constant number of local clk cycles, the “dest” signal is equal to the “src” signal.

I tried writing the following way:

```auto
module try();
    logic clk = 0;
    logic src_s; 
    logic src_stable;
    logic src;
    logic dest;
    initial begin
        clk = 0;
        src = 0;
        dest = 0;
        #100;
        src = 1;
        #100;
        dest = 1;
        #20
        $finish;
    end
    initial forever begin
        #20;
        clk = ~clk;
    end

    always_ff @(negedge clk) begin       
        src_s <= src;
    end 

    assign src_stable = (src == src_s);

    MY_PROP: assert property ( 
        @(posedge clk)
        disable iff (src_stable)
        (1) |=> ##10 (src == dest))
    else $error("Propagation check failed");
endmodule

```

I expect this assertion to fail - but it does not fail.  
Seems like the “disable\_iff” argument is always 1, and I do not understand why, since src signal indeed toggles.

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [January 11, 2024, 6:34pm UTC](https://verificationacademy.com/forums/t/assertion-to-check-for-signal-propagation/45613/2 "2024-01-11T18:34:39Z")

</div>

Indeed your property stays all the time ‘INACTIVE’ because src and src\_s have on each rising edge of clk the same value.  
Additionally your simulation is too short (shorter than 10 clk cycles. If you are disabling the condition the property becomes ACTIVE. But it completes never.

---

<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:** [January 11, 2024, 10:56pm UTC](https://verificationacademy.com/forums/t/assertion-to-check-for-signal-propagation/45613/3 "2024-01-11T22:56:50Z")

</div>

> [@dannyg](#):
>
> if a “src” signal changes, then after some constant number of local clk cycles, the “dest” signal is equal to the “src” signal.

1. Your assertion does not meet your requirements for  
// if a “src” signal changes, then after some constant number of local clk  
// cycles, the “dest” signal is equal to the “src” signal.  
I corrected it below.

```auto
let n=2; // constant
property p_src_dest; 
  bit v;
  @(posedge clk) ($changed(src), v=src) |-> ##n v== dest; 
endproperty : p_src_dest
ap_src_dest: assert property(p_src_dest) p1++;
else f1++; // $error("Propagation check failed");

```

// [https://www.edaplayground.com/x/NxVL](https://www.edaplayground.com/x/NxVL) code  
// [EPWave Waveform Viewer](https://www.edaplayground.com/w/x/Mkt) wave  
2) Your TB should use nonblocking assignments as a good practice rule.  
3) Aside from directed rtest, you should consider randomization.  
4) U strongly suggest that you read my reply on “Getting started with verification with SystemVerilog”  
[https://rb.gy/f3zhh](https://rb.gy/f3zhh)  
file is also attached.  
Ben Cohen  
[Ben@systemverilog.us](mailto:Ben@systemverilog.us)  
Link to the list of papers and books that I wrote, many are now donated.  
[https://systemveri](https://systemveri)  
[roadmaptosva.pdf](https://verificationacademy.com/forums/uploads/short-url/4xMEHVZKkPjMAjeVIdQmMpH06kZ.pdf) (172.0 KB)

---

<div class="post-metadata">

**Author:** ![user60](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/user60/32/1096_2.png) [@user60](https://verificationacademy.com/forums/u/user60)\
**Post date:** [January 12, 2024, 9:10am UTC](https://verificationacademy.com/forums/t/assertion-to-check-for-signal-propagation/45613/4 "2024-01-12T09:10:01Z")

</div>

I prefer to use $past in this scenario - it is FV friendly besides other aspects:

```verilog
property p_src_dest; 
  bit v;
  @(posedge clk) ($changed(src) ) |-> ##n $past(src, n) == dest; 
endproperty : p_src_dest
ap_src_dest: assert property(p_src_dest)

```

---

<div class="post-metadata">

**Author:** ![dannyg](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/9fc29f/32.png) [@dannyg](https://verificationacademy.com/forums/u/dannyg)\
**Post date:** [January 13, 2024, 7:41pm UTC](https://verificationacademy.com/forums/t/assertion-to-check-for-signal-propagation/45613/8 "2024-01-13T19:41:30Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![dannyg](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/9fc29f/32.png) [@dannyg](https://verificationacademy.com/forums/u/dannyg)\
**Post date:** [January 13, 2024, 7:41pm UTC](https://verificationacademy.com/forums/t/assertion-to-check-for-signal-propagation/45613/9 "2024-01-13T19:41:58Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![dannyg](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/9fc29f/32.png) [@dannyg](https://verificationacademy.com/forums/u/dannyg)\
**Post date:** [January 13, 2024, 7:42pm UTC](https://verificationacademy.com/forums/t/assertion-to-check-for-signal-propagation/45613/10 "2024-01-13T19:42:04Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![Jarno](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/j/67e7ee/32.png) [@Jarno](https://verificationacademy.com/forums/u/Jarno)\
**Post date:** [January 15, 2024, 7:37am UTC](https://verificationacademy.com/forums/t/assertion-to-check-for-signal-propagation/45613/11 "2024-01-15T07:37:55Z")

</div>

If the property is:

`($changed(src), v=src) |-> ##n v== dest; `

You’re basically saying _“when **src** changes, **dest** will be at the same value after **n** clocks”_.

I think the problem is that if **src** doesn’t change, then **dest** can be wiggling randomly but the property would still be happy. And I guess this is not the point of the test. So, I would maybe change the property to check **src** vs **dest** on every clock cycle (and hope that there’s are no glitches that fall between **clk** edges).

---

<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:** [January 15, 2024, 10:41am UTC](https://verificationacademy.com/forums/t/assertion-to-check-for-signal-propagation/45613/12 "2024-01-15T10:41:58Z")

</div>

> [@dannyg](#):
>
> I want to see that if a “src” signal changes, then after some constant number of local clk cycles, the “dest” signal is equal to the “src” signal.

That was the original requirement. Yes, the following meets that req.

```auto
($changed(src), v=src) |-> ##n v== dest;

```

You’re basically saying “when src changes, dest will be at the same value after n clocks”.  
[YOU] think the problem is that if **src** doesn’t change, then **dest** can be wiggling randomly but the property would still be happy. And I guess this is not the point of the test. So, I would maybe change the property to check **src** vs **dest** on every clock cycle (and hope that there’s are no glitches that fall between **clk** edges).  
[Ben] then you have to redefine the requirements if this is what you want.  
See Reflections on Users’ Experiences with SVA, part 1

> **[Reflections on Users’ Experiences with SVA](https://verificationacademy.com/verification-horizons/march-2022-volume-18-issue-1/reflections-on-users-experiences-with-systemverilog-assertions-sva)**
>
> Reflections on Users’ Experiences with SVA is a Verification Academy page

Important concepts on EXPRESSING REQUIREMENTS,  
Terminology, threads in ranges and repeats in antecedents, multiple antecedents.

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.32 KB
