[sv-ec] How do I make a "Virtual Port"

From: Alsop, Thomas R <thomas.r.alsop_at_.....>
Date: Thu Oct 02 2008 - 13:20:29 PDT
Hi, 

 

I have another question for the sv-ec team.  I have dug through through
the 2005 LRM and I don't see a method to create something like a
"virtual port".  I want to create a class that passes in via object
construction, the name of a port, which is then treated as the property.
Then I can use my methods on that specific port. 

 

Here is what I am trying to do:

 

class RegisterAccess ; 

   logic        myPwrUp;

   logic [15:0] myRegWr;

   logic [15:0] myRegRd;

 

   function new(logic myPwrUp, [15:0] myRegWr, [15:0] myRegRd);

      this.myPwrUp = myPwrUp;

      this.myRegWr = myRegWr;

      this.myRegRd = myRegRd;

   endfunction

 

And here is the construction code:

 

   RegisterAccess RA;

 

   initial begin

 

      RA = new(cb.mu2mlcrwrpwrup, cb.mu2mlcrwr, cb.ml2mucrrd);

 

Where the signals mu2mlcrwrpwrup, mu2mlcrwr, and ml2mucrrd would be
either real interface, clocking block interface, or packaged in a SV
interface.  It really doesn't matter to me, I'm just trying to find a
way to make this work.  I just want a way to pass in an interface, even
if it has to be XMR, via an object construction and have it assigned to
the property.  That way all the methods can act on that signal or group
of signals.

 

Now, I did research virtual interfaces.  This seemed ideal from the
explanations, but if I understand things correctly, even if I set up
virtual interfaces to work, like it explains in clause 20.8 of the spec,
I must still refer to the actual name of the signal in the interface
package.  For example if I had:

 

interface myifc ();

 

   logic mu2mlcrwrpwrup;

   ...

 

endinterface

 

In my method if I am using virtual interfaces I have to use the explicit
name listed:

 

   task Write ();

 

      MyVirIfcInst.mu2mlcrwrpwrup   <= 1'b1;

      ... 

   endtask

 

But, my interfaces don't necessarily have "generic" names in them.  They
use the port names for connecting to a specific DUT. In other words, the
only real benefit is virtual interfaces is to use a whole interface over
and over again, there is no virtualization of any specific signal in
that package.  Is there any way to pass in the name of a port and have
it be the property that the methods of a class will use? 

 

Thanks, -Tom


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Oct 2 13:22:11 2008

This archive was generated by hypermail 2.1.8 : Thu Oct 02 2008 - 13:22:58 PDT