# Does a wait statement in a test main phase block the main phase execution of other testbench component's phases?

**URL:** <https://verificationacademy.com/forums/t/does-a-wait-statement-in-a-test-main-phase-block-the-main-phase-execution-of-other-testbench-components-phases/47752>\
**Category:** UVM\
**Tags:** phase, wait-statement, phasing\
**Created:** [July 2, 2024, 3:48am UTC](https://verificationacademy.com/forums/t/does-a-wait-statement-in-a-test-main-phase-block-the-main-phase-execution-of-other-testbench-components-phases/47752 "2024-07-02T03:48:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vk7715](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/v/8edcca/32.png) [@vk7715](https://verificationacademy.com/forums/u/vk7715)\
**Post date:** [July 2, 2024, 3:48am UTC](https://verificationacademy.com/forums/t/does-a-wait-statement-in-a-test-main-phase-block-the-main-phase-execution-of-other-testbench-components-phases/47752/1 "2024-07-02T03:48:46Z")

</div>

Suppose I have the following code:

```auto
class abc_test extends base_test;
   `uvm_component_utils(abc_test)
   
    function new(string name, uvm_component parent);
      super.new(name);
    endfunction

  // configure_phase defined here
  
  task main_phase(uvm_phase);

    // wait for a DUT cnt to hit 100
    `uvm_info("MSG", $sformatf("Inside test main_phase: waiting for DUT counter to hit 100"), UVM_MEDIUM)
    
    wait(TB.DUT.modA.cnt == 'd100);

   `uvm_info("MSG", $sformatf("Inside test main_phase: DUT counter hit 100"), UVM_MEDIUM)

endtask

endclass
```

My questions are:

1. Will the blocking wait statement in the test’s main phase also block execution of the driver’s main phase, or the sequencer’s main phase, or the env’s main phase etc.?

2. When the test has a wait statement for a condition, is it just the test that waits for the condition?

3. And is it true vice versa? Will a wait statement in the driver main phase block the execution of a monitor’s/test’s main phase?

---

<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:** [July 2, 2024, 6:17am UTC](https://verificationacademy.com/forums/t/does-a-wait-statement-in-a-test-main-phase-block-the-main-phase-execution-of-other-testbench-components-phases/47752/2 "2024-07-02T06:17:03Z")

</div>

The `main_phase`, or any task based phase of all `uvm_component`s are forked as concurrent processes. A blocking statement in the main\_phase task of a component only blocks that task.

At least one component must raise an objection to the phase ending for some period of time, otherwise , the phase will be terminated by killing all the tasks.

See [End of Test | UVM Cookbook](https://verificationacademy.com/cookbook/uvm-universal-verification-methodology/end-of-test/)

---

<div class="post-metadata">

**Author:** ![vk7715](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/v/8edcca/32.png) [@vk7715](https://verificationacademy.com/forums/u/vk7715)\
**Post date:** [July 2, 2024, 7:36am UTC](https://verificationacademy.com/forums/t/does-a-wait-statement-in-a-test-main-phase-block-the-main-phase-execution-of-other-testbench-components-phases/47752/3 "2024-07-02T07:36:03Z")

</div>

Hi Dave, thank you for your reply.

If my test’s main\_phase does not raise or drop any objection, but just has a wait statement as shown in the code above, and if all other components drop their objections in the main\_phase, the test’s main\_phase is killed and thus the wait statement is also killed.

Can you please let me know if my understanding is right?

---

<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:** [July 2, 2024, 2:33pm UTC](https://verificationacademy.com/forums/t/does-a-wait-statement-in-a-test-main-phase-block-the-main-phase-execution-of-other-testbench-components-phases/47752/4 "2024-07-02T14:33:39Z")

</div>

Rather than telling you, I think you should make an example that will reinforce your understanding.

---

<div class="post-metadata">

**Author:** ![vk7715](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/v/8edcca/32.png) [@vk7715](https://verificationacademy.com/forums/u/vk7715)\
**Post date:** [July 3, 2024, 3:22am UTC](https://verificationacademy.com/forums/t/does-a-wait-statement-in-a-test-main-phase-block-the-main-phase-execution-of-other-testbench-components-phases/47752/5 "2024-07-03T03:22:02Z")

</div>

That’s true. Thank you Dave!
