Why is the build() phase in UVM executed in a Top - Down fashion and the other phases in Bottom - Up fashion?

In reply to dave_59:

Hi Dave,

I wrote some tests to try to understand the order. I added printed messages in both build_phases in the test case and the test env respectively. The one in the test case printed the message first, which makes sense as the test case is actually instantiate the test env (so top down for the build_phase). So my intention is if the test case has already had the m_abc set by config_db, then the test_env should not set m_abc any more. Therefore, I have the code something like this:

in the test case:
uvm_config_db#(int)::set(this, “m_env.m_uvc.m_virtual_sequencer”, “m_abc”, 123);

in the test env (ie. m_uvc):
if (!(uvm_config_db#(int)::get(this, “”,“m_virtual_sequencer”, m_abc))) begin
uvm_config_db#(int)::set(this, “m_virtual_sequencer”, “m_abc”, 456); —> however, this code is still being executed
end

However, looks like the set in the test env is still getting executed, do you see what’s the problem here?

Thanks!