Jump to content
anming

phase jump to function phases

Recommended Posts

Hi.

  in UVM, It is legal to have phase jump to any function phases.  but it seems in below demonstration code it does not work as I expected.  I expected the flag build_agt2 = 1 after the phase.jump(build_phase).

 

    class mycomponent extends uvm_component;

      .......

     bit build_agt2;

     function void build_phase(uvm_phase phase); 

           `create_agt1();

           if ( build_agt2)  

              `create_ag2() ; or

              // `override_agt1_by_agt2();  

     endfunction

 

    task run_phase;     

             // change flag build_agt2 to 1;

   endtask

 

   function void phase_ready_to_end;

          // if the imp phase  is in shutdown_phase

          // then phase.jump to build_phase

 endfunction

 

 

  

          

        

           

Share this post


Link to post
Share on other sites

I do not believe that it is "legal" to jump back to the function phases. You can jump forward to the check phase, for example, and you can jump back to the reset phase. But you definitely cannot go back and redo the build phase.

Share this post


Link to post
Share on other sites

Thank you Bhunter1972 for response.  I have created a stright forward testcase. By running it, you will see the build_phase does get called 4 times. I might miss something.

  

`include "uvm_macros.svh"
import uvm_pkg ::*;

class test extends uvm_test;
   int count;
  `uvm_component_utils(test)
  function new ( string name ="test", uvm_component p = null);
    super.new(name, p);
  endfunction
  virtual function void build_phase(uvm_phase phase);
    `uvm_info(get_full_name(), "i am in build_phase", UVM_MEDIUM)
  endfunction
  virtual function void connect_phase(uvm_phase phase);
    `uvm_info(get_full_name(), "I am in connect_phase", UVM_MEDIUM)
  endfunction
  virtual task pre_reset_phase(uvm_phase phase);
    `uvm_info(get_full_name(), "i am in test pre_reset_phase", UVM_MEDIUM)
  endtask
  virtual task main_phase ( uvm_phase phase);
    phase.raise_objection(this);
    `uvm_info(get_full_name(), " i am in test main_phase ", UVM_MEDIUM)
    phase.drop_objection(this);
  endtask
  function void phase_ready_to_end(uvm_phase phase);
    super.phase_ready_to_end(phase);
    if ( phase.get_imp() == uvm_shutdown_phase::get() && count < 3) begin
      phase.jump(uvm_build_phase::get());
      count++;
    end
  endfunction
endclass

 

module test;
  initial begin
   run_test("test");
  end
endmodule

 

thanks

andrwe

 

 

 

Share this post


Link to post
Share on other sites

Based on what the developers have told me, phase jumping to a pre-run phase might "kinda-sorta work so don't do it."

 

Put more simply, phase jumping was not intended to go back to a pre-run phase, so even though the functions may get called again this will lead to issues.

 

Probably they should have more clearly made it NOT work, but whatever.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×