Drain time is not getting set

I have set the drain time using the following in base test.but it is not effecting .could you please let me know what could be the reason.I have started the sequence using uvm_config_db default sequence option not through the sequence.start(sequencer) method.



  function void end_of_elaboration_phase(uvm_phase phase);
   uvm_phase main_phase = phase.find(uvm_main_phase::get(), 0);
   main_phase.phase_done.set_drain_time(this, 500ns);
  `
  endfunction: end_of_elaboration_phase


In reply to srbeeram:

set_drain_time belongs to an uvm_object but not a phase.
A typical application is in the toplevel module:

uvm_top.set_drain_time(<drain time>);
1 Like

In reply to chr_sue:

Hi chr_sue,

I am getting the following error if I follow that

UVM/TEST/pcie_base_test.sv, 141
“uvm_top.”
Could not find member ‘set_drain_time’ in class ‘uvm_root’,

In reply to srbeeram:
uvm_objection class has set_drain_time method.
uvm_objection phase_done = phase.get_objection() ;
phase_done.set_drain_time(<drain_time>) ;

// time out can be set .
uvm_root::get().set_timeout();

In reply to kddholak:

we are not using uvm objections as we are calling the sequence using uvm_config_db default sequence option not through the sequence.start(sequencer) method.

In reply to srbeeram:
AFAIK , UVM IEEE version set_drain_time method is inside uvm_objection.
Updated your code :


function void end_of_elaboration_phase(uvm_phase phase);
   uvm_phase main_phase = phase.find_by_name("main", 0);
   uvm_objection phase_done = main_phase.get_objection();
   phase_done.set_drain_time(this, 500ns);
  `
  endfunction: end_of_elaboration_phase

In reply to srbeeram:

In reply to chr_sue:
Hi chr_sue,
I am getting the following error if I follow that
UVM/TEST/pcie_base_test.sv, 141
“uvm_top.”
Could not find member ‘set_drain_time’ in class ‘uvm_root’,

I guess you are using UVM-1.2.
In this version uvm_top disappeared. You have to take care to get uvm_top like this:

uvm_root uvm_top = uvm_root::get();
uvm_top.set_drain_time(<drain time>);

In reply to chr_sue:

still same issue.may be some other issue checking.I am using UVM-1.2 only. but I am able to print uvm_top.print_topology();

In reply to srbeeram:

Your issue is not using objections. The drain time is used after all objections have been dropped. If you haven’t raised/dropped any objections for a phase, then the drain time does nothing.

1 Like

In reply to cgales:

ok Thanks cgales