Hi,
In my testbench, I have a class called nspi_master_agent and a parameterized class nspi_master_agent_param#(SOME_PARAMS_HERE) which is derived from nspi_master_agent. And this nspi_master_agent has a uvm_sequencer in it.
typedef uvm_sequencer #(payload_data) nspi_sequencer;
class nspi_master_agent extends uvm_agent;
...
nspi_sequencer m_seqr;
...
`uvm_component_utils(nspi_master_agent)
...
endclass
class nspi_master_agent_param#(VARIOUS_PARAMETERS_HERE) extends nspi_master_agent;
nspi_sequencer m_seqr;
...
`uvm_component_param_utils(nspi_master_agent_param#(VARIOUS_PARAMETERS_HERE))
...
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
...
m_seqr = nspi_sequencer::type_id::create("m_seqr", this);
...
endfunction
...
endclass
In my uvm_test class, I overrode nspi_master_agent with nspi_master_agent_param class
for (int i=0;i!=NUM_ETH_PORT; i++) begin
set_inst_override_by_type(($sformatf("ne_buf_env.ne_buf_nspi_agt_ne_wrch[%0d]", i)), nspi_master_agent::get_type(), nspi_master_agent_param#(PASSING_PARAM_VALUE)::get_type() );
end
In my uvm_env class, I created several nspi_master_agent objects
for (int i=0; i!=NUM_ETH_PORT; i++) begin
ne_buf_nspi_agt_ne_wrch[i] = nspi_master_agent::type_id::create($sformatf("ne_buf_nspi_agt_ne_wrch[%0d]", i), this);
end
Also in my test class, I would like to pass the sequencer handle inside a nspi_master_agent object to a uvm_sequencer_base handle inside my test class.
virtual task main_phase(uvm_phase phase);
uvm_sequencer_base nspi_msqr;
...
nspi_msqr=ne_buf_env.ne_buf_nspi_agt_ne_wrch[0].m_seqr;
...
endtask
However, after running the simulation, the nspi_msqr will get a null value, and after some debug, I found that
“ne_buf_env.ne_buf_nspi_agt_ne_wrch[0]” is actually referring to the original nspi_master_agent which never got created (I tried to access a property which only exists in the derived nspi_master_agent_param class and VCS give me a compilation error saying that property doesn’t exist in ne_buf_env.ne_buf_nspi_agt_ne_wrch[0] object)
Thus I wonder why am I referring to the original class in
nspi_msqr=ne_buf_env.ne_buf_nspi_agt_ne_wrch[0].m_seqr;
And how should I correcty pass the m_seqr handle to my test class?
Thanks so much in advance!!