hello:
I want to override parameterized base driver with a driver extended from it by type. but i get some strange error in questa sim.
I have a base driver defined like this:
//////////////
class eth_rx_driver#(type CHILD_RW=eth_rw) extends uvm_driver #(CHILD_RW);
`uvm_component_param_utils_begin(eth_rx_driver#(CHILD_RW))
…
endclass: eth_rx_driver
/////////
and I extend another driver from it .
/////////
class ipv4_rx_driver extends eth_rx_driver #(ipv4_rw) ;
`uvm_component_utils(ipv4_rx_driver)
…
endclass: ipv4_rx_driver
//////
in the agent i created the eth_rx_driver like this.
/////////
class eth_rx_agent extends uvm_agent;
eth_rx_driver #(eth_rw) drv;
virtual function void build_phase(uvm_phase phase);
drv = eth_rx_driver#(eth_rw)::type_id::create(“drv”, this);
…
endclass: eth_rx_agent
//////
I included all these drivers and agent in one SV package.
and in the test I try to override the driver like this.
//////
class ipv4_test extends uvm_test;
…
virtual function void build_phase(uvm_phase phase);
begin
set_type_override_by_type(eth_rx_driver#()::get_type(), ipv4_rx_driver::get_type());
super.build_phase(phase);
factory.print();
end
…
endfunction : build_phase
////
when I try to compile the code in questasim, there is no error. but in build phase, it shows
///////
UVM_FATAL @ 0: reporter [FCTTYP] Factory did not return a component of type ‘eth_rx_driver’. A component of type ‘ipv4_rx_driver’ was returned instead. Name=drv Parent=eth_rx_agent contxt=uvm_test_top.eth_example_tb0.eth0.masters[0]
///////
I want to use the ipv4 driver to replace the eth driver, but how this error comes? is there anything wrong with my factory operation ?