Search code examples
system-veriloguvm

Is there a way to fix the warning related to the support of string-based lookup for the factory?


I often get this warning message:

UVM_WARNING @ 0: reporter [TPRGED] Type name 'packet2mem_comp_Str' already registered with factory. No string-based lookup support for multiple types with the same type name.

I did not register any class with the same name, unless the parent one which, I suppose, does not present any problem.

My class is an inherited parametrized class declared as follows:

class packet2mem_comp #(string S = "MEM") extends mem_comp;
  typedef packet2mem_comp #(S) packet2mem_comp_Str;
  `uvm_object_utils(packet2mem_comp_Str)

  function new (string name = "packet2mem_comp");
    super.new(name);
  endfunction : new


... //rest of my code


endclass: packet2mem_comp

Does anyone know how to fix this warning?


Solution

  • There are special versions of the macros for parameterised classes. Instead of

    `uvm_object_utils(packet2mem_comp_Str)
    

    try

    `uvm_object_param_utils(packet2mem_comp_Str)
    

    or perhaps

    `uvm_object_param_utils(packet2mem_comp #(S))
    

    You have not posted an MCVE, so I have not tested this.