Reply To: Using types defined in generic package for entity ports

Why OSVVM™? Forums VHDL Using types defined in generic package for entity ports Reply To: Using types defined in generic package for entity ports

#1173
Jim Lewis
Member

Hi Torsten,

I would have to know more about what you are trying to do to give you a good answer.  Here are a couple of ideas that may help.

1)  With VHDL-2008, composites (records and arrays) are permitted to have elements that are unconstrained.   With this capability, you constrain the array when you create a signal or variable.  Hence, you would not need to put a generic on the package.   For what I see, I would try this path first.   

Note, I have not used this in the OSVVM project as I am trying to minimize the amount of VHDL-2008 that I am using so I can get OSVVM working on more tools. 

2) With VHDL-2008, you can instantiate a package within an architecture and make it visible to the corresponding architecture.   If you must pass an entity generic to a package, this will help you accomplish it. The package instance looks like a normal package instance, other than it is in the architecture declarative area.  The use clause references the package as being local.  IE:  no library name because it is only visible locally (here  or to anything you pass the generic package to).

    use <PkgName>.all ;

This was what Martin was suggesting in his answer on stack overflow. 

If using a record with unconstrained elements (solution 1) works for you, it seems like it could be the simplest and most general approach.  

To use either of these, I would make sure you are using the most current release of your simulator. 

Best Regards,

Jim