# Is it sensible to yield a delay of zero?

**URL:** <https://discourse.myhdl.org/t/is-it-sensible-to-yield-a-delay-of-zero/317>\
**Category:** Support\
**Created:** [July 29, 2018, 5:12am UTC](https://discourse.myhdl.org/t/is-it-sensible-to-yield-a-delay-of-zero/317 "2018-07-29T05:12:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![meowsqueak](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/meowsqueak/32/97_2.png) [@meowsqueak](https://discourse.myhdl.org/u/meowsqueak)\
**Post date:** [July 29, 2018, 5:12am UTC](https://discourse.myhdl.org/t/is-it-sensible-to-yield-a-delay-of-zero/317/1 "2018-07-29T05:12:32Z")

</div>

I’m writing a unit test for some simple MyHDL and I’d like to know if it’s valid to call `yield delay(0)` at the start of a test generator in order to make a combinatorial `@always_comb` evaluate its outputs? If I don’t do this, then I find I need to delay for some arbitrary time until I can test the combinatorial output. Normally I could delay 1ns but then when I have a clock I’ll need a corresponding delay(N-1) to get back in sync with the clock.

---

<div class="post-metadata">

**Author:** ![cfelton](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/cfelton/32/3_2.png) [@cfelton](https://discourse.myhdl.org/u/cfelton)\
**Post date:** [July 29, 2018, 11:03pm UTC](https://discourse.myhdl.org/t/is-it-sensible-to-yield-a-delay-of-zero/317/2 "2018-07-29T23:03:05Z")

</div>

An easy way to sync with a clock in a testbench is `yield clock.posedge`

---

<div class="post-metadata">

**Author:** ![meowsqueak](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/meowsqueak/32/97_2.png) [@meowsqueak](https://discourse.myhdl.org/u/meowsqueak)\
**Post date:** [July 31, 2018, 10:35pm UTC](https://discourse.myhdl.org/t/is-it-sensible-to-yield-a-delay-of-zero/317/3 "2018-07-31T22:35:02Z")

</div>

Thanks, that makes sense when waiting for the next clock. How about in a purely combinatorial design where there is no clock? What’s the best way to get the simulator to actually run a step and generate the driven outputs? `yield delay(0)` does seem to work and propagate the assignments. I’m just not sure if it has some side-effects I’m not aware of yet.

---

<div class="post-metadata">

**Author:** ![josyb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/josyb/32/5_2.png) [@josyb](https://discourse.myhdl.org/u/josyb)\
**Post date:** [August 1, 2018, 9:44am UTC](https://discourse.myhdl.org/t/is-it-sensible-to-yield-a-delay-of-zero/317/4 "2018-08-01T09:44:48Z")

</div>

`yield delay(0)` will work fine, without side effects. You can see it as a delay with an infinitesimal small time …  
The simulator will append a scheduled event with the same time.
