Saturday, November 3, 2012

Adding user defined phase using uvm_phase !!!


In addition to the predefined phases available in uvm , the user has the option to add his own phase to a component. This is typically done by extending the uvm_phase class the constructor needs to call super.new which has three arguments 
  1. name of the phase task or function
  2. top down or bottom up phase
  3. task or function
The call_task  or call_func and get_type_name need to be implemented to complete the addition of new phase.

Example

class custom_phase extends uvm_phase;

   function new();
      super.new(“custom”,1,1);
   endfunction

   task call_task  ( uvm_component parent);
    
     my_comp_type comp;
      
     if ( $cast(comp,parent) )
             comp.custom_phase();
    
   endtask

   virtual function string get_type_name();
      return “custom”;
   endfunction

endclass