Question on executing reset_phase before run_phase

Hi,

I have a requirement to drive default values on the interface pins before the actual driver begins the activity of driving on the interface.
There is no explicit reset input.
I am using the 3 tasks viz. pre_reset_phase and post_reset_phase and run_phase in the driver.
pre_reset_phase - default values are driven on the interface.
post_reset_phase - an event is triggered(-> post_rst)
run_phase - Blocks on the event triggered in post_reset_phase(@ post_rst). This is phase where seq_item is driven on the interface.

Since reset_phase and run_phase start at the same time, I am using event to control the order of execution.
My doubt is, if this is the right way to do. Please let me know if there is any other efficient way of coding the same.

Thanks,
Pratibha

In reply to Pratibhamd:

You should only use the run_phase() in your driver. When the driver initializes at time 0, the interface pins should be set to the default values. As transactions are received from the sequencer, the interface should be driven appropriately. If there is an idle state between transactions, then revert the interface pins to the default values.

In reply to cgales:

I am using all the three tasks in the driver.Here is the code snippet

class driver extends uvm_driver#(req_item);


//Methods
task pre_reset_phase(uvm_phase phase)
//Drive default values of the interface
endtask

task post_reset_phase(uvm_phase phase)
->post_rst;
endtask

task run_phase(uvm_phase phase);
@ post_rst;
// begin the driver sequencer mechanism and drive on the interface according to protocol

endtask

endclass :driver

In reply to Pratibhamd:

You asked if what you are doing is correct. As I previously stated, you should only use the run_phase() in your driver. You do not want to mix different phases. My previous response describes the most efficient way to code a driver.

In reply to Pratibhamd:

Why bother using the phasing mechanism if you are going to create explicit events to enforce a specific ordering?

You can just put the defaults at then beginning of the run_phase and then go into a loop

task run_phase(uvm_phase phase);
 //Drive default values of the interface
 ...
 // begin the driver sequencer mechanism and drive on the interface according to protocol
 forever begin
   ...
 end
endtask

In reply to cgales:

Hi Mr.gales,
I have one doubt, is it really compulsary to use only ‘run_phase’ in driver.
I had the same requirement in one of my assignment, where I used

  1. reset_phase
  2. post_reset- where I initialize the values of signals sent to dut via intf.
  3. main_phase- drive the pkts.

rgds,
Prince

In reply to PrinceMB:

Yes, you should only use the run_phase() in your driver (or any other uvm component). The reason why is to provide compatibility across multiple UVCs.

If different teams interpret the use of the phases in different manners, you will end up with UVCs that will be out of sync with each other. Your issue of wanting to delay the run_phase() until after the reset_phase() is a perfect example of this.

The best approach is to stick with only the run_phase() for every component and use sequences as your phasing mechanism.