Problem in creating derived uvm_scbd object

Hi sharvil111,

Thank you for helping! So I simplified my code before putting it on the forum, and compilation error was gone after that. Here’s the complete code:


class a extends uvm_object;
   `uvm_object_utils(a)

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

class b extends uvm_object;
   `uvm_object_utils(b)

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

class my_scbd #(type T = uvm_object, type COMP = uvm_comparer) extends uvm_scoreboard;
   typedef T queue [$];
   queue     scbd[int unsigned];
   COMP      comparer;

   function new(string name="my_scbd", uvm_component parent = null);
      super.new(name, parent);
      comparer = new();
   endfunction

   `uvm_component_utils(my_scbd)

   virtual function int unsigned get_index(T item);
      return 0;
   endfunction: get_index

   function void match_in_scbd (T rhs);
      int unsigned index = get_index(rhs);
      T lhs = scbd[index].pop_front();
   endfunction: match_in_scbd
endclass: my_scbd

class scbd_a#(type COMP = uvm_comparer) extends my_scbd #(a, COMP);
   int x, y;

   function new(string name="scbd_a", uvm_component parent = null);
      super.new(name, parent);
   endfunction

   `uvm_component_utils(scbd_a)

   virtual function int unsigned get_index(T item);
      return x*y;
   endfunction: get_index
endclass: scbd_a

class scbd_b#(type COMP = uvm_comparer) extends my_scbd #(b, COMP);
   int x, y;

   function new(string name="scbd_b", uvm_component parent = null);
      super.new(name, parent);
   endfunction

   `uvm_component_utils(scbd_b)

   virtual function int unsigned get_index(T item);
      return x*y;
   endfunction: get_index
endclass: scbd_b


I also found that if I do a type casting as below, it compiles fine.


   function void match_in_scbd (T rhs);
      int unsigned index = get_index(rhs);
      T lhs;
      $cast(lhs, scbd[index].pop_front());
   endfunction: match_in_scbd

Any idea why? I tried registering the factory using `uvm_component_param_utils() but still seeing the error.