0

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?

toolic
  • 57,801
  • 17
  • 75
  • 117
bradpin
  • 9
  • 5

1 Answers1

0

You can use the uvm_object_registry(T,S) or uvm_component_registry(T,S) registration macros. These macros can appear anywhere in the declaration space of the class declaration of T and will associate the string S to the object type T. These macros are called by the corresponding uvm_*_utils macros, so you may only use them if you do not use the uvm_*_utils macros. For Example:

package A;
  import uvm_pkg::*;
  `include "uvm_macros.svh"
  class myclass extends uvm_component;
    // `uvm_component_utils(myclass)
    `uvm_component_registry(myclass, "A::myclass")
    function new(string name="myclass", uvm_component parent=null);
      super.new(name, parent);
    endfunction
  endclass
endpackage

package B;
  import uvm_pkg::*;
  `include "uvm_macros.svh"
  class myclass extends uvm_component;
    // `uvm_component_utils(myclass)
    `uvm_component_registry(myclass, "B::myclass")
    function new(string name="myclass", uvm_component parent=null);
      super.new(name, parent);
    endfunction
  endclass
endpackage

module test;
  A::myclass a;
  B::myclass b;
  initial begin
    a = A::myclass::type_id::create("a", null);
    b = B::myclass::type_id::create("b", null);
  end
endmodule

For details to see Docs of Utility and Field Macros or Source Code.

Rocco
  • 471
  • 1
  • 3
  • 7