In reply to ABD_91:
Hi,
I did create it in the agent. my code from the agent is as below.
agent.sv:
`include "uvm_macros.svh"
import uvm_pkg::*;
class Agent extends uvm_agent;
`uvm_component_utils(Agent)
uvm_analysis_port #(SequenceItem) analysis_port;
Config m_config;
Sequencer m_seqr;
Driver m_drvr;
Monitor m_mon;
bit m_is_active;
extern function new(string name, uvm_component parent);
extern function void build_phase(uvm_phase phase);
extern function void connect_phase(uvm_phase phase);
extern function uvm_active_passive_enum get_is_active();
endclass: Agent
function uvm_active_passive_enum Agent::get_is_active();
if(m_is_active == -1) m_is_active = m_config.is_active;
return uvm_active_passive_enum'(m_is_active);
endfunction: get_is_active
function Agent::new(string name, uvm_component parent);
super.new(name, parent);
analysis_port = new("analysis_port",this);
endfunction: new
function void Agent::build_phase(uvm_phase phase);
if(!uvm_config_db#(Config)::get(this,"","Config",m_config))
`uvm_error(get_type_name(),$sformatf("config not found"))
m_mon = Monitor::type_id::create("m_mon",this);
if(get_is_active() == UVM_ACTIVE)
begin
m_drvr = Driver::type_id::create("m_drvr",this);
m_seqr = Sequencer::type_id::create("m_seqr",this);
end
endfunction: build_phase
function void Agent::connect_phase(uvm_phase phase);
if(m_config.vif == null)
`uvm_fatal(get_type_name(),$sformatf("virtual interface is not set!"))
m_mon.Intf_vi=m_config.vif;
m_mon.analysis_port.connect(analysis_port);
if(get_is_active() == UVM_ACTIVE)
begin
m_drvr.seq_item_port.connect(m_seqr.seq_item_export);
m_drvr.Intf_vi = m_config.vif;
end
endfunction: connect_phase
Thanks for your time.