I am trying to override a parameterized base sequence item with item which was inherited from the base class.
Base sequence item:
*class rra_item#(int REQ_WD = 16) extends uvm_sequence_item;
…
endclass
class rra_item_8 extends rra_item#(8);
…
endclass*
In the test case, The base item is overriden by inherited item by following way function void build_phase(uvm_phase phase);
uvm_factory factory;
factory.set_type_override_by_type(rra_item#(16)::get_type(),rra_item_8::get_type());
endfunction : build_phase
The code compiles without an issue but during simulation, the simulator stopped due to BAD HANDLE REFERENCE
UVM_INFO @ 0: reporter [RNTST] Running test multi_req_test…
Fatal error in Function uvm_pkg/uvm_factory::set_type_override_by_type at /stec/apps/mentor/questa_sim_10.4c/questasim/linux_x86_64/../verilog_src/uvm-1.1d/src/base/uvm_factory.svh line 807
HDL call sequence:
Stopped at /stec/apps/mentor/questa_sim_10.4c/questasim/linux_x86_64/../verilog_src/uvm-1.1d/src/base/uvm_factory.svh 807 Function uvm_pkg/uvm_factory::set_type_override_by_type
called from /stec/proj/asic/cwm3/verification/users/mahi/rra_uvc/test.sv 80 Function rra_pkg/multi_req_test::build_phase
Please help me to get rid of this error.
Thanks in Advance.
You declared a variable
factory, but you never initialized it with a handle to the global factory. But there’s no need to do this as uvm_component already has this method. So call
set_type_override_by_type() directly.
Thank you for a quick and appropriate reply. It solved the above-mentioned issue.
but i am getting into “type casting issue”.
_
The code changed:_ virtual function void end_of_elaboration();
set_type_override_by_type(rra_item#(16)::get_type(),rra_item_8::get_type());
endfunction : end_of_elaboration
_
sequence declaration:_
the simulator shows the following error message,
*####
UVM_INFO verilog_src/questa_uvm_pkg-1.2/src/questa_uvm_pkg.sv(272) @ 0: reporter [Questa UVM] End Of Elaboration
** Error: (vsim-3971) $cast to type ‘class work.rra_pkg::rra_item #(16)’ from ‘class work.rra_pkg::rra_item #(8)’ failed in file /stec/proj/asic/cwm3/verification/users/mahi/rra_uvc/rra_seq_lib.sv at line 64.
UVM_FATAL @ 0: uvm_test_top.o_rra_env.o_rra_agent.o_rra_sequencer@@seq [NULLITM] attempting to start a null item from sequence ‘uvm_test_top.o_rra_env.o_rra_agent.o_rra_sequencer.seq’
#*
can you please point me out what i am missing here?