While using Parameterised Class , i am getting this error
reporter [TPRGED] Type name ‘driver#(NO_OF_DEVICE)’ already registered with factory. No string-based lookup support for multiple types with the same type name.
Most likely because you used uvm_component_utils instead of
uvm_component_param_utils to register with the factory. See Not registered in factory....Error message in parameterized class | Verification Academy for more details.
In reply to sidharth.sankar77:
Hi Dave,
Now I am getting problem, when i used uvm_component_param_utils and i extended another driver from this driver and in test case try to override the new driver with the old one, it is not working.
If i only use uvm_component_utils ,it is working but the warning is still there. Pls help me to remove the warning.
In reply to sidharth.sankar77:
You will need to show us how you pass the parameters in your class definitions, and how you use `uvm_component_utils
In reply to dave_59:
`define param_value
parameter value= `param_value
class driver1#(int W = 1 ) extends uvm_component;
`uvm_component_utils(driver1#(W))
function new ( string name = "driver1" , uvm_component p = null);
super.new(name, p);
endfunction
function void build_phase(uvm_phase phase);
..... some statements .....
endfunction
task reset_phase(uvm_phase phase);
endtask : reset_phase
task main_phase(uvm_phase phase);
......... some statements .....
endtask : main_phase
endclass
class driver2#(int W= 0) extends driver1;
`uvm_component_utils(driver2#(W))
function new ( string name = "driver2" , uvm_component p = null);
super.new(name, p);
endfunction
function void build_phase(uvm_phase phase);
...... some statements .....
endfunction
task reset_phase(uvm_phase phase);
endtask : reset_phase
task main_phase(uvm_phase phase);
......... some statements .....
endtask : main_phase
endclass
class agent#(int W= 0) extends uvm_agent;
`uvm_component_utils(agent#(W))
driver1#(value) c3;
function new ( string name ="agent", uvm_component p = null);
super.new(name, p);
endfunction
virtual function void build_phase(uvm_phase phase);
c3 = driver1#(value)::type_id::create("c3", this);
endfunction
endclass
class env#(int W= 0) extends uvm_env;
`uvm_component_utils(env#(W))
agent#(value) a;
function new ( string name ="env", uvm_component p = null);
super.new(name, p);
endfunction
virtual function void build_phase(uvm_phase phase);
a = agent#(value)::type_id::create("a", this);
endfunction
endclass
class base_test extends uvm_test;
`uvm_component_utils(base_test)
env e;
function new ( string name = "test", uvm_component p = null);
super.new(name, p);
endfunction
virtual function void build_phase(uvm_phase phase);
e = env#(value)::type_id::create("e", this);
endfunction
endclass
class test extends base_test;
`uvm_component_utils(test)
function new ( string name = "test", uvm_component p = null);
super.new(name, p);
endfunction
virtual function void build_phase(uvm_phase phase);
set_type_override_by_type( driver1#()::get_type(), driver2#()::get_type());
super.build_phase(phase);
endfunction
endclass
module top;
initial begin
run_test("test");
end
endmodule
I am passing param_value from command line.
if i am using uvm_component_param_utils driver2 is not overiding driver1. But if i use
uvm_component_utils it working but the warning comes.
In reply to sidharth.sankar77:
You never showed me what value you passed to param_value. But I’ll assume its something other than the default value 1 used to declare the class driver1. Let’s say param_value is 3.
If you are using Questa, you should have gotten a warning message for this line:
class driver2#(int W= 0) extends driver1;
(vlog-2181) Use of a parameterized class 'driver1' as a type creates a default specialization.
This means driver2 is really an extension of driver1#(1).
In your agent, you declared c3 as
driver1#(value) c3;
c3 = driver1#(value)::type_id::create("c3", this);
If value is 3, you are asking to create an object of type driver1#(3).
However your override statement is
set_type_override_by_type( driver1#()::get_type(), driver2#()::get_type());
which will set an override for driver#(1), not driver#(3). There is no override for driver#(3). Remember that ‘driver1’ by itself is not an actual type. ‘driver1’ plus a specific set(implicit or explicit) of parameters is a type. Please read http://go.mentor.com/yin-and-yang