Where are all the function (phases) called in UVM , like build phase , connect phase?

The task of run_phase is called in sqr of uvm and main method but where are all the other phase function called in Uvm ??

like build_phase();
connect_phase();

In reply to milin parekh:

The run_test task that you call from an initial block in your top-level testbench calls all the phases. I can show you n extremely simplified model of how it works (removing hierarchy, factory, and objections)

class component;
  static component all_components[$];
  function new;
    all_components.push_back(this);
  endfunction
  virtual function void build_phase();
  endfunction
  virtual function void connect_phase();
  endfunction
  virtual task run_phase;
  endtask
  virtual function void report_phase;
  endfunction
endclass
task automatic run_test;
  foreach(all_components[comp]) all_components[comp].build_phase();
  foreach(all_components[comp]) all_components[comp].connect_phase();
  foreach(all_components[comp]) fork
                                  int I = comp;
                                  all_components[I].run_phase();
                                join_none
   wait fork;
  foreach(all_components[comp]) all_components[comp].report_phase();
endtask : run_test

Every class extended from uvm_component, like a sequencer, driver, monitor, etc. have these virtual phase methods declared in the base class. They are called regardless of whether you have declared overriding methods in your class or not.

In reply to dave_59:

Hi Dave,

Thanks for providing this simplifying example. What I have seen that m_run_phases task of -vm-hase is calling static method of get_common_domain and pushing a singleton Phase object to mailbox. And then there is a forever loop which is executing execute_phase method. How this execute_phase method is calling all children’s build_phase and then connect_phase and so on and so forth are called from this execute_phase method?

In reply to dave_59:

Yah that explanation was fine. But my doubt is other than build_phase and final_phase … like connect_phase must run in bottom up approach… so we should traverse foreach in reverse…?

In reply to Rozz:

You should not have code that depends on the order within a phase, other than the build_phase.

See Calling of build phase? | Verification Academy