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 
//External interfaces
virtual dut_if dut_ifs;
//Internal interfaces 
       monitor mon;
        driver drv;
//Boiler plate code start

     function new(string name, uvm_component parent);, parent);
//Boiler plate code end
//Standard phase methods
function void 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);

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

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

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

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

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

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


-Happy Reading

No comments:

Post a Comment