Jump to content
tudor.timi

UVM phase singletons

Recommended Posts

Hi,

 

I remember back in the day in OVM it was possible to say uvm_test_done.set_drain_time(...). With UVM, when compiling with +UVM_NO_DEPRECATED, it's not possible to do this. Phases have their own drain times now. The cool thing about the OVM approach was that I could set the drain time from the end_of_elaboration phase somewhere in my base test and be done with it. I dug around a bit in UVM and found that all phases have singletons. I tried to get a handle to the run phase singleton during the end_of_elaboration phase and set the drain time on that. It didn't work.

 

All phase methods get a "phase" argument passed to them. I would have expected that this parameter contains already a handle to the phase singleton. I made a small example on EDA Playground (http://www.edaplayground.com/x/2PL) where I get the run phase singleton and print it and also print the argument. They are different objects. Does anyone know what the phase argument getting passed to phase methods is and why it's not the singleton?

 

Thanks,

Tudor

Share this post


Link to post
Share on other sites

There is always a pair of phases in UVM with the same name.

One act as implementation, 2nd as a node in uvm phase schedule graph

You can obtain both see below I've modify part of yours example:

  function void end_of_elaboration_phase(uvm_phase phase);
    // get handle to run phase
    uvm_phase tmp;
    uvm_run_phase m_run_phase = uvm_run_phase::get();
    $display("From handle in end_of_elaboration");
    m_run_phase.print();
    
    tmp = phase.find_by_name("run",0);
    $display("get phase node in end_of_elaboration");
    tmp.print();
  endfunction

  task run_phase(uvm_phase phase);
    // get handle to run phase
    uvm_phase _phase;
    uvm_run_phase m_run_phase = uvm_run_phase::get();
    $display("From handle in run");
    m_run_phase.print();
    
    $display("From param in run");
    phase.print();
    
    $cast(m_run_phase , phase.get_imp);
    $display("get imp from param is equal to uvm_run_phase::get");
    m_run_phase.print();
    
  endtask

Share this post


Link to post
Share on other sites

So just to make it more clear to me, calling uvm_run_phase::get() will return the implementation node and the handle getting passed to run_phase() or the result of phase.find_by_name("run",0) is the node used for scheduling, right?

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

×