Why use uvm_config_db to pass vif or configuration object is recommended?

In reply to seabeam:

Your code won’t work how it is written. When your environment calls create() for your agent, the agent will be new’d() and have the build_phase() called immediately. There is no way for the environment to set the value of the agent’s config object. The agent will need to get the value of its config object via the uvm_config_db.

When the build_phase() is noted as top down, it doesn’t mean that the environment’s build phase will complete and then the sub-component(s) build_phase() will be called. The build_phase() of a component is called as part of the create() call.