Pages

Monday 14 October 2013

Dear Readers

Lets see how we can customize the factory and how you construct the agents
For constructing the agents we should use the create method,create checks for the factory over ride and constructs for the objects accordingly.

From the previous post lets get started without getting into if agent is active/passive, the sample code as below. 

******************************************************************************

class my_agent extends uvm_agent;
//Factory registration
// Using uvm_component_utils as agent is a TB component 
`uvm_component_utils(my_agent)
//External interfaces
virtual dut_if dut_ifs;
//Internal interfaces 
       monitor mon;
        driver drv;
//Boiler plate code start

     function new(string name, uvm_component parent);
         super.new(name, parent);
     endfunction
//Boiler plate code end
//Standard phase methods
function void build();
super.build();
//As the agent contains sequencer, driver, monitor we can construct the agent as below
uvm_report_info(get_full_name(),"Build", UVM_LOW);
//Customization using the factory
 my_seq_1  = my_seq ::type_id::create("my_seq_1", this);  
 my_driv_1 = my_driv::type_id::create("my_driv_1", this);   
my_mon_1  = my_mon ::type_id::create("my_mon_1", this);
 endfunction: build 

//Other Standard phase methods

     function void connect();
         uvm_report_info(get_full_name(),"Connect", UVM_LOW);
     endfunction

     function void end_of_elaboration();
         uvm_report_info(get_full_name(),"End_of_elaboration", UVM_LOW);
     endfunction

     function void start_of_simulation();
         uvm_report_info(get_full_name(),"Start_of_simulation", UVM_LOW);
     endfunction

     task run();
         uvm_report_info(get_full_name(),"Run", UVM_LOW);
     endtask

     function void extract();
         uvm_report_info(get_full_name(),"Extract", UVM_LOW);
     endfunction

     function void check();
         uvm_report_info(get_full_name(),"Check", UVM_LOW);
     endfunction

     function void report();
         uvm_report_info(get_full_name(),"Report", UVM_LOW);
     endfunction

endclass
*********************************************************************************

-Happy Reading
Hash

No comments:

Post a Comment