Jump to content

uvm_scoreboard requires analysis import to compile. why?


Recommended Posts

 

Below I define a uvm_scoreboard.  Why will this not compile when I remove the (3) lines THIS AND THAT?  Should it?

`uvm_analysis_imp_decl(_rcvd_pkt)  //THIS
class dpx_rr_scoreboard extends uvm_scoreboard;

   `uvm_component_utils(dpx_rr_scoreboard)

   virtual function void write_rcvd_pkt(input some_trans t);  //AND THAT
   endfunction : write_rcvd_pkt                               //AND THAT

endclass : dpx_rr_scoreboard
I am using irun 12.X and get the following error when I remove the aforementioned lines:
 
class dpx_rr_scoreboard extends uvm_scoreboard;
                                              |
ncvlog: *E,FAABP1 (/user/posedgeclk/tb/dpx_rr_scoreboard.svh,25|46): task, function, or assertion instance does not specify all required formal arguments [10.2.2][10\
.3(IEEE)].

 

 

I poked around in the uvm class library just a bit, but did not figure this out.

 

Any ideas?  Is this a uvm thing or Cadence thing (trying to enforce that I write sensible code) or just fooling thing on my part?

 

I am asking Cadence directly as well, but wanted to throw this out to the crowd.

 

 

 

**I am just trying to get a shell of a scoreboard compiling, and don't care that it doesn't do anything yet.  Let's ignore the fact that I don't have uvm_analysis_imp_rcvd_pkt created.

Link to post
Share on other sites
Ok. I am still obviously climbing up the UVM/SV learning curve.
 
Adding an implementation of new allows my shell of a scoreboard to compile.  I did not need to do anything with analysis import.   (This makes me ponder deleting this entire post right now.)
class dpx_rr_scoreboard extends uvm_scoreboard;

   `uvm_component_utils(dpx_rr_scoreboard)

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

endclass : dpx_rr_scoreboard

 

 

 

I see now that
uvm_scoreboard is an abstract class, as specified by the "virtual" in front of the first line of its definition:  "virtual class uvm_scoreboard extends uvm_component;"
 
I have read that
classes extended from an abstract class must provide implementations for all of the abstract class' pure virtual methods.  
 
However, "new" is not a pure virtual method.  So, I am a bit confused about this.  Can anyone enlighten me? 
Link to post
Share on other sites

Hi, declaring a class virtual means that the class itself cannot be instanced - it must be extended. So you can't make an instance of uvm_scoreboard on its own.

 

However uvm_scoreboard is itself derived from uvm_component. uvm_component has a constructor (new function) which needs the two arguments (name and parent).

 

If you derive from a base class and don't write your own constructor in the derived class, then the default constructor will get called. If the default constructor is called, then  the standard says

 

(1800-2012 p145)

 

"super.new call shall be the first statement executed in the constructor. This is because the superclass
shall be initialized before the current class and, if the user code does not provide an initialization, the
compiler shall insert a call to super.new automatically
."

 

When the compiler calls super.new for you automatically, it will not supply any arguments. Hence your original error message, which is telling you the call to new in uvm_component is not being given the correct number of arguments.

 

regards

Alan

 

P.S. constructors are not virtual.

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...