- During run phase of uvm, who calls the uvm_build phase of testclass and then who calls for build_phase method of environment. Please explain the execution of build phase for all component hierarchy.
- What is the role of create method in build phase
Plesae see the UVM Cookbook for an explanation of the Testbench Build process. Please note that you should never call build_phase() [or any of the phase methods] directly. They are all called automatically once you call run_test.
Your create() question has been answered in a previous forum thread.
In reply to tfitz:
Hi Tom,
Thanks for your reply. I read the UVM Cookbook and clearly understood the Build process. But it is not giving explanation that who calls the build method for child components. In cookbook it mentioned that “the components are created during build phase by create method”.
Which means that object of environment is created during the build phase of test class. which forces me to conclude that when build method of environment is getting called, then the object of environment class is already present, but objects of other components which are at lower level of hierarchy are not create yet.
But this observation does not explain that who is calling build_phase method of environment class??
In reply to vishalghama:
The build_phase() method is called top-down by the UVM infrastructure [actually from uvm_root]. Here’s what happens:
When you call run_test(), an instance of your top-level uvm_test is created from the factory and added to a component list. Then build_phase() is called automatically (it really doesn’t matter from where) on all components in the list, which initially is just your uvm_test. In uvm_test.build_phase(), you create your uvm_env, which gets added to the list. When uvm_test.build_phase() is complete, the system looks at the component list and sees that there’s now a uvm_env whose build_phase() hasn’t been called yet, so it calls uvm_env.build_phase(). This happens all the way down until all created classes have their build_phase() method called and there are no longer any components in the list whose build_phase() hasn’t been called.
which forces me to conclude that when build method of environment is getting called, then the object of environment class is already present, but objects of other components which are at lower level of hierarchy are not create yet.
You are correct. In order to call uvm_env.build_phase(), the uvm_env object must exist or you wouldn’t be able to call uvm_env.build_phase(). The uvm_env was created during uvm_test.build_phase(). When uvm_env.build_phase() is called, no subcomponents exist, because they get created during the execution of uvm_env.build_phase().
In reply to tfitz:
Hi Tom
Thank you very much. This reply resolved a lot of doubts which were there in my mind.