Using code in main_phase when entire env is in run_phase

Hi,
I am trying to call a checker code in main_phase, while the entire environment is in run_phase. I am observing that the main_phase() code is not getting executed at all and kind stuck (only the 1st display statement is printed and post that nothing is going on), whereas the other task called inside the run_phase is proceeding.

Is there any reason why the main_phase() is not getting executed?

Example :

  • In the below sample code, only 1st display statement is getting printed and not the 2nd one. Other Env code is proceeding in a normal way.
  • Instead of main_phase, if I change it to run_phase(), then things are working fine. Why is it so?
class checker1 extends uvm_...
task main_phase()
  super.main_phase();
  
  $display("Inside Main ");
  #4000ps;
  $display("Inside Main post delay ");

  fork
    <task call 1>;
    <task call 2>;
    ...
    ...
  join_none
endtask
endclass


In reply to verif_user:

The main_phase is getting executed, it’s just that without raising objections, it terminates in zero time.

We strongly suggest you stick to using just the run_phase.

Hi,
Thanks for the response Dave. 2 questions here

  1. The main_phase is getting executed, it’s just that without raising objections, it terminates in zero time.

Why would it terminate in 0-time here? main_phase() is one of the sub-phase of run_phase and is it not supposed to run along with other code which is called in run_phase()?. I am not able to change it from main->run phase, as these checkers are used across different env’s (which supports sub-phases of run_phase).

  1. Is it recommended practice in our industry to use of the different phases of UVM or does most of them stick to usage of only run_phase()?

Hi,
Thanks for the response Dave. 2 questions here

  1. The main_phase is getting executed, it’s just that without raising objections, it terminates in zero time.

Why would it terminate in 0-time here? main_phase() is one of the sub-phase of run_phase and is it not supposed to run along with other code which is called in run_phase()?. I am not able to change it from main->run phase, as these checkers are used across different env’s (which supports sub-phases of run_phase).

  1. Is it recommended practice in our industry to use of the different phases of UVM or does most of them stick to usage of only run_phase()?

In reply to verif_user:

Each sub-phase will get terminated as soon as there are no more objections to it, regardless of whether run phase still running or not. Otherwise, individual sub-phases can not make progress.

In reply to Siva Sengottuvelappan:

Thanks Siva for the clarification

In reply to verif_user:

Commonly it should not cause serious problems when you are using run_phase and main_phase in your UVM testbench. But it is a bad coding style… You’ll get serious problems when you are using other sub_phases like reset _phase etc.
In your case I believe you aremeent in the main_phase. This is not needed, because you do not have any time dependency on the TL. causing some trouble wih your delay statem