# Assertion failure at every clk

**URL:** <https://verificationacademy.com/forums/t/assertion-failure-at-every-clk/39570>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, systemverilog-ASSERTION-bind, antecedent\
**Created:** [September 16, 2021, 6:22am UTC](https://verificationacademy.com/forums/t/assertion-failure-at-every-clk/39570 "2021-09-16T06:22:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timus](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/t/ce73a5/32.png) [@Timus](https://verificationacademy.com/forums/u/Timus)\
**Post date:** [September 16, 2021, 6:22am UTC](https://verificationacademy.com/forums/t/assertion-failure-at-every-clk/39570/1 "2021-09-16T06:22:42Z")

</div>

I have written assertion

```verilog
property state_chnge;
 @(posedge clk)
  (reset1 && reset2) && 
  (state==2'h0)|=> (state==2'h2);
endproperty
Assert_chnage : assert property(state_change);

```

I am writing this assertion to check when reset1 and reset2 are high  
State moves from 2’h0 to 2’h2. But after I run it, it shows failed at every Clk tick even when it is in state 2’h2. that is it shows assertion failed even if antecedent fails. I don’t understand this part.  
Is there a way to write this in such a way that. Assertion should not be shown as failed if antecedent fails.  
Please correct me if I am wrong somewhere.

---

<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:** [September 16, 2021, 3:26pm UTC](https://verificationacademy.com/forums/t/assertion-failure-at-every-clk/39570/2 "2021-09-16T15:26:59Z")

</div>

_In reply to [Satputesb](https://verificationacademy.com/forums/t/assertion-failure-at-every-clk/39570):_

Your assertions works for me. It would really help to show a complete example, like below. This produces a single pass and single fail.

```verilog
module top;
  bit clk=1,reset1=1,reset2=1;
  logic [1:0] state;

  always #5 clk=!clk;
  
  initial begin
    @(posedge clk) state = 1;
    @(posedge clk) state = 2;
    @(posedge clk) state = 0; 
    @(posedge clk) state = 2; // pass
    @(posedge clk) state = 2;
    @(posedge clk) state = 0;
    @(posedge clk) state = 0; // fail
    @(posedge clk) state = 2;
    @(posedge clk) state = 1;
    $finish;
  end
  
  property state_change;
    @(posedge clk)
    (reset1 && reset2) && (state==2'h0)|=> (state==2'h2);
  endproperty
  Assert_change : assert property(state_change) $info("pass"); else $error("fail");
endmodule

```
