# Is there any difference between @cb and @posedge IF.clk

**URL:** <https://verificationacademy.com/forums/t/is-there-any-difference-between-cb-and-posedge-if-clk/30032>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, clocking-block-event\
**Created:** [October 15, 2014, 4:46am UTC](https://verificationacademy.com/forums/t/is-there-any-difference-between-cb-and-posedge-if-clk/30032 "2014-10-15T04:46:27Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [October 15, 2014, 5:37am UTC](https://verificationacademy.com/forums/t/is-there-any-difference-between-cb-and-posedge-if-clk/30032/2 "2014-10-15T05:37:46Z")

</div>

Yes there is a difference, and my recommendation is: when interacting with clocking blocks, only use the clocking block event **@IF.cb** as the synchronizing event. That includes not using the **wait()** statement or any other **@IF.cb.variable** expressions.

There are two reasons fort this recommendation.

There is a race condition if you use the @(posedge clk) and try to read a sampled clocking block variable. The race is between reading the old sampled value and the new sampled value. This is describe in a note in section _14.4 Input and output skews_ of the 1800-2012 LRM.

Although not explicitly stated in the LRM, a consequence of eliminating the above race is that because clocking block event comes after all clocking block variables are updated, if you wait on a clock block variable followed by a wait on a clocking block event, both event may occur in the same time slot. so write your code as

```verilog
@(IF.cb iff !IF.CB.reset); // instead of wait (!IF.cb.reset)
...
@(IF.cb) // guaranteed to be 1 cycle later.

```

---

_[View the full topic](https://verificationacademy.com/forums/t/is-there-any-difference-between-cb-and-posedge-if-clk/30032)._
