I have a class of interfaces.
I create 2 instances of this interface in the top by:
//Interface declaration
pakmx_if_out vif_out[2](clk, rst);
//Registers the Interface in the configuration block
//so that other blocks can use it
uvm_resource_db#(virtual pakmx_if_out)::set(.scope("ifs"), .name("pakmx_if_out0"), .val(vif_out[0]));
uvm_resource_db#(virtual pakmx_if_out)::set(.scope("ifs"), .name("pakmx_if_out1"), .val(vif_out[1]));
In the monitor I verate cirtual interface by:
//interface
virtual pakmx_if_out vif_out;
In addition I have in the monitor a task which access the sinals of the above interface.
How can I create 2 instances of the monitor in the agenct class so each monitor will refer to a different instance of interface?
I create instance of monitor and connect in in the build pahse and run phase of the agent:
//build phase
function void build_phase(uvm_phase phase);
super.build_phase(phase);
agent_ap = new (.name("agent_ap"), .parent(this));
pm_seqr = pakmx_sequencer::type_id::create(.name("pm_seqr"), .parent(this));
pm_drvr = pakmx_driver::type_id::create(.name("pm_drvr"), .parent(this));
pm_mon = pakmx_monitor::type_id::create(.name("pm_mon"), .parent(this));
endfunction: build_phase
//connevt phase
function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
pm_drvr.seq_item_port.connect(pm_seqr.seq_item_export);
pm_mon.mon_ap.connect(agent_ap);
endfunction: connect_phase