Jump to content

UVM phase singletons

Recommended Posts



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?




Link to comment
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");
    tmp = phase.find_by_name("run",0);
    $display("get phase node in end_of_elaboration");

  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");
    $display("From param in run");
    $cast(m_run_phase , phase.get_imp);
    $display("get imp from param is equal to uvm_run_phase::get");
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...