In reply to dave_59:
In reply to dave_59:
Hi Dave,
Thanks for the suggestion!
Yes, naxi_magent.m_mon is already created before calling set(). And after some further debug, I start to wonder if the problem is related with factory type override.
In my testbench, both naxi_magent and m_mon is factory overrode.
For naxi_magent
class naxi_master_agent extends uvm_agent; //parent class
naxi_master_monitor m_mon;
...
endclass
class naxi_master_agent_param#(PARAM) extends naxi_master_agent; //child class
naxi_master_monitor_param #(PARAM) m_mon;
...
virtual function build_phase(uvm_phase phase);
m_mon = naxi_master_monitor_param#(PARAM)::type_id::create("m_mon", this);
endfunction
...
endclass
For m_mon, this is class is extended two times
class naxi_master_monitor extends uvm_monitor; //parent class
...
endclass
class naxi_master_monitor_param#(PARAM) extends naxi_master_monitor; //child class
...
endclass
class l2_naxi_master_monitor#(PARAM)extends naxi_master_monitor_param#(PARAM);//grand-child class
...
endclass
Place where override happens (In env’s build phase)
set_type_override_by_type(naxi_master_agent::get_type(), naxi_master_agent_param#(PARAM)::get_type() );
set_type_override_by_type(naxi_master_monitor_param#(PARAM)::get_type(),l2_naxi_master_monitor#(PARAM)::get_type());
naxi_magent = naxi_master_agent::type_id::create("naxi_magent",this);
naxi_sagent = naxi_slave_agent::type_id::create("naxi_sagent", this);
In the test_class, I tried to directly assign the monitor handle to end-test-checking sequence. In the following code, naxi_msqr is a non-factory overriden type.
virtual task shutdown_phase(uvm_phase phase);
...
eot_seq = l2_eot_sequence::type_id::create("eot_seq");//creating the end_test_checking sequence
eot_seq.naxi_msqr=l2m_env.naxi_magent.m_seqr; //this assignment is good
eot_seq.mmon=l2m_env.naxi_magent.m_mon; //this handle assignment is bad
eot_seq.start(null);
...
endtask
However, as we can see from vcs’s simulator, mmon handle in end_test_checking sequence is still null. In contrast, the handle assignment of naxi_msqr, that non-overriden class, is good. (Plase let me know if the picture behind it doesn’t display)
In eot_seq
class l2_eot_sequence extends uvm_sequence #(uvm_sequence_item);
uvm_sequencer_base naxi_msqr;
uvm_monitor mmon;
l2_naxi_master_monitor#(PARAM) grandchild_mmon;
...
task body();
$cast(ref_handle_mmon,mmon);
...
endtask
...
endclass
I wonder if the bad handle assignment issue is caused by factory override?
Thanks a lot for your help!
Hao