Considering a verification environment that imports 2 packages, pkg_A and pkg_B.
Both packages contain some common class definitions (i.e. same class name, class properties, etc.):
pkg_A.sv
class *some_name*;
`uvm_object_utils(*some_name*)
pkg_B.sv
class *some_name*;
`uvm_object_utils(*some_name*)
This makes the same class name to be registered to the factory twice, leading to:
UVM_WARNING @ 0: reporter [TPRGED] Type name some_name already registered with factory. No string-based lookup support for multiple types with the same type name.
Consider that both pkg_A and pkg_B have numerous class with same name. How can this be fixed?
You can use the
uvm_object_registry(T,S)oruvm_component_registry(T,S)registration macros. These macros can appear anywhere in the declaration space of the class declaration ofTand will associate the stringSto the object typeT. These macros are called by the correspondinguvm_*_utilsmacros, so you may only use them if you do not use theuvm_*_utilsmacros. For Example:For details to see Docs of Utility and Field Macros or Source Code.