Parameterized class extends uvm_component

Consider the class definition below,

   class A #(int unsigned s=10) extends uvm_component;
      
      `uvm_component_utils_begin(A #(int unsigned s=10))
      `uvm_component_utils_end
      
      function new(string name="", uvm_component parent);
         super.new(name, parent);
      endfunction
      
   endclass // A

It seems there would be errors during compilation. Is there any way to declare a parameterized class which extends uvm_component?

Thanks.

Hi Kooder,

uvm_component_utils macro is for non-parameterized classes. For Parameterized classes, you need to use uvm_component_param_utils macro to register it to factory.

Thanks

In reply to Sanathkrishna:
The correct syntax is

 class A #(int unsigned s=10) extends uvm_component;
 
      `uvm_component_param_utils(A #(s))

      function new(string name="", uvm_component parent);
         super.new(name, parent);
      endfunction
 
   endclass : A

In reply to dave_59:

Thanks Sanathkrishna & Dave! It works now!