# My env's build\_phase function not invoked

**URL:** <https://verificationacademy.com/forums/t/my-envs-build-phase-function-not-invoked/33784>\
**Category:** UVM\
**Tags:** UVM\
**Created:** [December 5, 2017, 1:57pm UTC](https://verificationacademy.com/forums/t/my-envs-build-phase-function-not-invoked/33784 "2017-12-05T13:57:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![naveensv](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/naveensv/32/2371_2.png) [@naveensv](https://verificationacademy.com/forums/u/naveensv)\
**Post date:** [December 5, 2017, 1:57pm UTC](https://verificationacademy.com/forums/t/my-envs-build-phase-function-not-invoked/33784/1 "2017-12-05T13:57:45Z")

</div>

Hi,

Trying to integrate an UVM based verification collateral in a verilog based environment.  
I have a env by name “local\_env” and I create this “local\_env” in a top level env’s build phase. (tb\_env is the name for top level env).  
This verification infrastructure is compile and elab clean.

The problem being faced is, I am unable to see build\_phase method of local\_env getting called at all!  
I do see the print messages from build\_phase of tb\_env but not local\_env.

Can someone help me understand what I might have missed here.

---

<div class="post-metadata">

**Author:** ![graeme\_jessiman](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/graeme_jessiman/32/1201_2.png) [@graeme\_jessiman](https://verificationacademy.com/forums/u/graeme_jessiman)\
**Post date:** [December 5, 2017, 3:28pm UTC](https://verificationacademy.com/forums/t/my-envs-build-phase-function-not-invoked/33784/2 "2017-12-05T15:28:25Z")

</div>

Are you creating the lower level environment in your top level env ?

the build phase for the top level env should create any lower level env(s)

e.g.

virtual function void build\_phase(uvm\_phase phase);  
super.build\_phase(phase);  
block\_a\_env = block\_a\_env\_t::type\_id::create(“block\_a\_env”,this);  
block\_a\_env.set\_config(configuration.block\_a\_env\_config);  
block\_b\_env = block\_b\_env\_t::type\_id::create(“block\_b\_env”,this);  
block\_b\_env.set\_config(configuration.block\_b\_env\_config);  
endfunction

---

<div class="post-metadata">

**Author:** ![naveensv](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/naveensv/32/2371_2.png) [@naveensv](https://verificationacademy.com/forums/u/naveensv)\
**Post date:** [December 5, 2017, 3:48pm UTC](https://verificationacademy.com/forums/t/my-envs-build-phase-function-not-invoked/33784/3 "2017-12-05T15:48:33Z")

</div>

_In reply to [graeme\_jessiman](https://verificationacademy.com/forums/t/my-envs-build-phase-function-not-invoked/33784/2):_

Hi Jessiman,  
Yes I’m creating lower level environment in top level environment.

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [December 5, 2017, 4:12pm UTC](https://verificationacademy.com/forums/t/my-envs-build-phase-function-not-invoked/33784/4 "2017-12-05T16:12:50Z")

</div>

_In reply to [naveensv](https://verificationacademy.com/forums/t/my-envs-build-phase-function-not-invoked/33784/3):_  
If your local\_env is not an extension of uvm\_env it is not part of the env chain and outside of the UVM phased-approach.

---

<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:** [December 6, 2017, 12:20am UTC](https://verificationacademy.com/forums/t/my-envs-build-phase-function-not-invoked/33784/5 "2017-12-06T00:20:43Z")

</div>

_In reply to [naveensv](https://verificationacademy.com/forums/t/my-envs-build-phase-function-not-invoked/33784/4):_

If “local\_env” is extended from uvm\_component (which uvm\_env is), then its build\_phase should be called at some point. Without seeing any code, it is difficult to guess why. The only thing I can offer is:

Put a print statement inside the constructor of local\_env to make sure it is being constructed.  
Double check that you spelled build\_phase() correctly — there is no error message if you misspell it.

---

<div class="post-metadata">

**Author:** ![naveensv](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/naveensv/32/2371_2.png) [@naveensv](https://verificationacademy.com/forums/u/naveensv)\
**Post date:** [December 6, 2017, 5:12am UTC](https://verificationacademy.com/forums/t/my-envs-build-phase-function-not-invoked/33784/6 "2017-12-06T05:12:20Z")

</div>

Figured out the problem.  
This was my new method in tb\_env.

function new (string name, uvm\_component parent);  
super.new();  
endfunction

After passing name and parent arguments to super.new(), it is working fine for me.

Thanks all for your valuable time.
