Main_phase and run_phases in uvm TB

Can we have an UVM tb with one component say test with main_phase declared and other components run_phase declared? How will main_phase run wrt to other components run_phase and is it legal to declare main_phase without declaring run_phase?

In reply to Sv-hustler:

Using main_phase and run_phase in the same UVM testbench together is a bad coding style and might cause problems.
In parallel to run_phase sub-phases are executed, starting with the pre_reset_phase and finishing with the post_shutdown_phase. run_phase starts with the pre_reset_phase and finishes with the post_shutdown_phase.
See the details here Phasing | Verification Academy

In reply to chr_sue:

In reply to Sv-hustler:
Using main_phase and run_phase in the same UVM testbench together is a bad coding style and might cause problems.

Could you please elaborate on the previous quote, why is this a bad coding style? And what concrete problems or situations can be produced?

Thanks,
-R

In reply to rgarcia07:

main_phase is a sub-phase which runs during the run_phase. But there are more sub-phases running prior or after the main_phase. For details see the phasing article of the cookbook from my post above.

In reply to chr_sue:

In reply to Sv-hustler:
Using main_phase and run_phase in the same UVM testbench together is a bad coding style and might cause problems.
In parallel to run_phase sub-phases are executed, starting with the pre_reset_phase and finishing with the post_shutdown_phase. run_phase starts with the pre_reset_phase and finishes with the post_shutdown_phase.
See the details here Phasing | UVM Cookbook

Why using main_phase and run_phase is a problem?
Can you provide any example, artical for that problem?

Subphases are normally used to handle particular traffic to DUT such as:

  • Handle reset in reset_phase
  • Handle configuration (register) in configure_phase
  • Handle stimulus in main_phase

While run_phase is useful specially in driver, monitor, scoreboard where we need to handle every type of traffic from pre_reset to post_shutdown.

In reply to chris90:

This is not really true, because what you are saying you can implement using corresponding sequences like rest_seq, config_seq, operations_seq etc.
There are specific relationships between the sub_phases and this might generate problems. I did not say and mean using a mixture of main_phase and run_phase results in all cases in confusion.

In reply to chr_sue:

The biggest problem is when people start using the main_phase as a synonym for the run_phase. That only works until some else add time-consuming phases before or after the main_phase and the main_phase no longer starts at time 0 or ends at the same time as the run_phase.

In reply to dave_59:

Thank you very much for your inputs, now is clear to me.