# SVA to check a N-stage synchronizer output

**URL:** <https://verificationacademy.com/forums/t/sva-to-check-a-n-stage-synchronizer-output/51497>\
**Category:** SystemVerilog\
**Tags:** SVA, SVA-Assertion, SystemVerilog, System-Verilog, assertion\
**Created:** [December 15, 2025, 6:07pm UTC](https://verificationacademy.com/forums/t/sva-to-check-a-n-stage-synchronizer-output/51497 "2025-12-15T18:07:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![liviareis](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/l/8c91f0/32.png) [@liviareis](https://verificationacademy.com/forums/u/liviareis)\
**Post date:** [December 15, 2025, 6:07pm UTC](https://verificationacademy.com/forums/t/sva-to-check-a-n-stage-synchronizer-output/51497/1 "2025-12-15T18:07:47Z")

</div>

Hi all! I want to write an assertion for an N-stage synchronizer output (this synchronizer accounts for metastability modeling, so its delay is non-deterministic and it ranges in between N and M cycles).

This assertion needs to check that: _a signal **B** can only change (from 0 to 1, or from 1 to 0) **if and only if** a signal **A** has changed (from 0 to 1, or from 1 to 0) in between [N:M] cycles in the past_.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![lala12345](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/l/e47c2d/32.png) [@lala12345](https://verificationacademy.com/forums/u/lala12345)\
**Post date:** [December 15, 2025, 6:24pm UTC](https://verificationacademy.com/forums/t/sva-to-check-a-n-stage-synchronizer-output/51497/2 "2025-12-15T18:24:12Z")

</div>

property check\_signal\_b\_change;

@(posedge clk)

($fell(signal\_b) || $rose(signal\_b)) |-\>

( ##[N:N+1] $changed(signal\_a) );

endproperty

---

<div class="post-metadata">

**Author:** ![arshi582](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/c77e96/32.png) [@arshi582](https://verificationacademy.com/forums/u/arshi582)\
**Post date:** [December 16, 2025, 6:09am UTC](https://verificationacademy.com/forums/t/sva-to-check-a-n-stage-synchronizer-output/51497/3 "2025-12-16T06:09:44Z")

</div>

Hi @liviareis,

Assuming the clock edges occur at T0 ( 1st clock edge ) , T1 , T2 , T3 , … Tx,

N & M are constants with values 3 & 5 respectively.

**If signal A changes at T2 then signal B should change at T5 or T6 or T7 ,**

**is this the expectation ?**

---

<div class="post-metadata">

**Author:** ![liviareis](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/l/8c91f0/32.png) [@liviareis](https://verificationacademy.com/forums/u/liviareis)\
**Post date:** [December 16, 2025, 9:15am UTC](https://verificationacademy.com/forums/t/sva-to-check-a-n-stage-synchronizer-output/51497/4 "2025-12-16T09:15:38Z")

</div>

Hi arshi582! No, according to your example, the assertion should check that: **If signal B changes at T6 then signal A should have changed at T3 or T2 or T1**.

```auto
        T0 T1 T2 T3 T4 T5 T6 T7    
CLK __/‾‾\__ /‾‾\ __/‾‾\__ /‾‾\ __/‾‾\__ /‾‾\ __/‾‾\__ /‾‾\__
         ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊     
B ____________________________________ /‾‾‾‾‾‾‾‾‾‾‾‾‾
         ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊     
A ________________ /‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
         ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊     
               <===========> *
              -5 -4 -3 -2 -1 0

```

---

<div class="post-metadata">

**Author:** ![liviareis](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/l/8c91f0/32.png) [@liviareis](https://verificationacademy.com/forums/u/liviareis)\
**Post date:** [December 16, 2025, 9:18am UTC](https://verificationacademy.com/forums/t/sva-to-check-a-n-stage-synchronizer-output/51497/5 "2025-12-16T09:18:58Z")

</div>

> property check\_signal\_b\_change;
> 
> @(posedge clk)
> 
> ($fell(signal\_b) || $rose(signal\_b)) |-\>
> 
> ( ##[N:M] $changed(signal\_a) );
> 
> endproperty

This is checking that, if B changes, then A should change from N to M cycles later.

What I want to check is: _if B changes, then A should have changed in between [N:M] cycles in the past._

---

<div class="post-metadata">

**Author:** ![liviareis](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/l/8c91f0/32.png) [@liviareis](https://verificationacademy.com/forums/u/liviareis)\
**Post date:** [December 16, 2025, 10:13am UTC](https://verificationacademy.com/forums/t/sva-to-check-a-n-stage-synchronizer-output/51497/6 "2025-12-16T10:13:00Z")

</div>

Currently this is what I have:

```verilog
sequence A_rose;
  @(posedge clk) $rose(A) ##[N:M] 1'b1;
endsequence

sequence A_fell;
  @(posedge clk) $fell(A) ##[N:M] 1'b1;
endsequence

property B_CHANGED_DUE_TO_A;
  @(posedge clk) disable iff (~rst_n)
  $changed(B) |-> (B && A_rose.triggered) or (~B && A_fell.triggered);
endproperty

assert property (B_CHANGED_DUE_TO_A);

```

---

<div class="post-metadata">

**Author:** ![Have\_A\_Doubt](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Have\_A\_Doubt](https://verificationacademy.com/forums/u/Have_A_Doubt)\
**Post date:** [December 16, 2025, 10:23am UTC](https://verificationacademy.com/forums/t/sva-to-check-a-n-stage-synchronizer-output/51497/7 "2025-12-16T10:23:41Z")

</div>

**If signal A changes at T6 then signal B should have changed at T3 or T2 or T1**.

```verilog
sequence b2a_change( N , M );
 $changed(b) ##[N:M] $changed(a);
endsequence

property b_2_a( N , M );
  @(posedge clk) disable iff (!rst_n)
    $changed(a) |→ b2a_change(N,M).triggered;
endproperty

b2a:assert property( b_2_a(3,5) ) else `uvm_error(..)

```

---

<div class="post-metadata">

**Author:** ![liviareis](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/l/8c91f0/32.png) [@liviareis](https://verificationacademy.com/forums/u/liviareis)\
**Post date:** [December 16, 2025, 12:10pm UTC](https://verificationacademy.com/forums/t/sva-to-check-a-n-stage-synchronizer-output/51497/8 "2025-12-16T12:10:49Z")

</div>

Hi [Have\_A\_Doubt](https://verificationacademy.com/forums/t/sva-to-check-a-n-stage-synchronizer-output/51497/7), thanks for you reply but I didn’t see a big difference between your solution and the one I already have.

BTW, the issue I have with this solution is that during simulation, when B changes too close to the rising edge of the clock, the design and the sequence samples different values; the design samples 1 and the sequence samples 0.

```auto
 

    D[0] _______Q[0]_______ Q[1]
A ------->|D Q|------->|D Q|-------> B
          | | | |
          | FF0 | | FF1 |
          | | | |
CLK ----->|>CK | -->|>CK |
           ‾‾‾‾‾‾‾ ‾‾‾‾‾‾‾

           T0 T1 T2 T3 T4 T5 T6 T7    
    CLK __/‾‾\__ /‾‾\ __/‾‾\__ /‾‾\ __/‾‾\__ /‾‾\ __/‾‾\__ /‾‾\__
           ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊     
A, D[0] ______________ /‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
           ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊       
   Q[0] _______________ /‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
           ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊     
B, Q[1] ____________________ /‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

```

At T2, D[0] is 1 and Q[0] goes to 1. I’d expect that $rose(A) is true at T2, but it isn’t - it is only true at T3.

In this example, N=M=2 and the assertion fails at T4 (in which $rose(B) is true, but sequence A\_rose is not triggered.

Anyone has an alternative solution or a solution for the issue I am having?

Thanks!

---

<div class="post-metadata">

**Author:** ![Have\_A\_Doubt](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Have\_A\_Doubt](https://verificationacademy.com/forums/u/Have_A_Doubt)\
**Post date:** [December 17, 2025, 5:02pm UTC](https://verificationacademy.com/forums/t/sva-to-check-a-n-stage-synchronizer-output/51497/9 "2025-12-17T17:02:43Z")

</div>

> [@liviareis](#):
>
> ```auto
> 
> D[0] _______Q[0]_______ Q[1]
> A ------->|D Q|------->|D Q|-------> B
> | | | |
> | FF0 | | FF1 |
> | | | |
> CLK ----->|>CK | -->|>CK |
> ‾‾‾‾‾‾‾ ‾‾‾‾‾‾‾
> 
> T0 T1 T2 T3 T4 T5 T6 T7    
> CLK __/‾‾\__ /‾‾\ __/‾‾\__ /‾‾\ __/‾‾\__ /‾‾\ __/‾‾\__ /‾‾\__
> ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊     
> A, D[0] ______________ /‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
> ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊       
> Q[0] _______________ /‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
> ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊     
> B, Q[1] ____________________ /‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
> 
> ```
> 
> At T2, D[0] is 1 and Q[0] goes to 1. I’d expect that $rose(A) is true at T2, but it isn’t - it is only true at T3.

**Considering that both design and concurrent assertions use sampled value** ,

why is it that Q[0] is 1 just after T2 ?. Sampled value of D[0] at T2 would be 0

---

<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:** [December 18, 2025, 9:57am UTC](https://verificationacademy.com/forums/t/sva-to-check-a-n-stage-synchronizer-output/51497/10 "2025-12-18T09:57:07Z")

</div>

@liviareis: I’d sample your assertions on the falling edge of your clock. This avoids the prblems you are facing.
