# UVM scheduling and the need for Clocking Blocks

**URL:** <https://verificationacademy.com/forums/t/uvm-scheduling-and-the-need-for-clocking-blocks/40325>\
**Category:** UVM\
**Tags:** UVM, Race-condition, Clocking-Block\
**Created:** [April 29, 2022, 2:35pm UTC](https://verificationacademy.com/forums/t/uvm-scheduling-and-the-need-for-clocking-blocks/40325 "2022-04-29T14:35:44Z")\
**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:** [April 29, 2022, 4:36pm UTC](https://verificationacademy.com/forums/t/uvm-scheduling-and-the-need-for-clocking-blocks/40325/2 "2022-04-29T16:36:35Z")

</div>

_In reply to [Francesco Colonna](https://verificationacademy.com/forums/t/uvm-scheduling-and-the-need-for-clocking-blocks/40325):_

Assuming   
clk and   
clock are indeed the same “clock” generating a posedge in the same delta cycle, then you are correct that the monitor samples the “old” value of out\_a.

I’m not sure if you indented to use two different clock signals, but that’'s where problems can be introduced, especially in gate-level simulations with delays. If   
clock gets delayed more than a delta cycle from   
clk, you get the “new” value of out\_a.

A clocking block helps by guaranteeing that you use the sampled value out\_a before the the clock edge and removing any skew between clocks. But if you do not plan on doing any gate-level simulation and have made sure all your synchronized clocks have no delta delays, you can avoid using clocking blocks.

All of what I just wrote assumes you start your UVM testbench with run\_test() called in a module. All of the “old” verses “new” races get flipped around if you start your testbench in a program block ([which I strongly recommend you avoid](https://blogs.sw.siemens.com/verificationhorizons/2009/05/07/programblocks/)). In that case your monitor reads the “new” value of out\_a, assuming there are no delays in the RTL. And now if   
clk gets delayed more than a delta cycle from   
clock, the monitor see the “old” instead of the “new” value. Add a clocking block makes sure you read the “old” values out\_a in your monitor.

---

_[View the full topic](https://verificationacademy.com/forums/t/uvm-scheduling-and-the-need-for-clocking-blocks/40325)._
