Forever loop break

In reply to rbasnet:

The run_phase will be terminated by following reasons:

  • The post_shutdown_phase is finished (all objection are dropped)
  • Timeout 9200s.

In your example, the forever loop in run_phase will be terminated if all objections (from pre_reset to post_shutdown phase) are dropped. Let’s see the following example:


  class phase_test extends uvm_test;
    `uvm_component_utils(phase_test)
    function new(string name, uvm_component parent);
      super.new(name, parent);
    endfunction : new
    
    task main_phase(uvm_phase phase);
      phase.raise_objection(this);
      #5;
      phase.drop_objection(this);
    endtask
    
    task run_phase(uvm_phase phase);
      forever begin
        #1;
        `uvm_info("PHASE_TEST", "Printed forever loop", UVM_NONE)
      end
    endtask
  endclass 

Can you guess, how many line “Printed forever loop” will be displayed in forever loop of run_phase? It will never stuck forever because in main_phase, the objection is dropped after 5ns delay.