Jump to content

Parameterized interfaces


Recommended Posts

a usual way to do it is to create a wrapper object and push the wrapper into config_db. Then get this wrapper object from config_db and assign it to the virtual interface pointer (not mentioning the details here)

 

Creating the virtual interface container wrapper parameterized to the strongly typed interface helps here. but in the uvm component, a pointer needs to be created for the parameterised interface. 

 

If not wanting the classes to be parameterized, how the virtual interface handle can be created without specifying the parameter as either a default parameter in base class or override is necessary for creating handle?.  The component will get the wrapper object from config_db and assign it (the virtual interface in the object)  to the virtual interface pointer

 

Thanks.

Link to comment
Share on other sites

It's for this reason that I never use parameterized interfaces. I know that probably sounds a bit ridiculous, but I find that it's easier to make an interface wide/large enough to contain all the necessary bits for all types of instantiations.

 

Say you have a 64-bit interface that is sometimes driven at 32-bits. In my drivers and monitors I use configurable fields to tell how wide the bus is and work from there. In the interface, I might create a field called 'bus_width' and assign it such that I can use what is there to control assertions or any other active logic. From there, I can plunk down the interface and let random constraints or configuration options choose how wide my interface is today.

 

It may get a little complicated in places, but I've found this approach to be worth the effort. Most importantly, it eliminates me having to type my_pkg::drv_c#(BUS_WIDTH), my_pkg::agent_c#(BUS_WIDTH), and on and on and on.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...