RE: [vhdl-200x-ft] Question on Type and Package Generics

From: <tgingold@free.fr>
Date: Fri Dec 24 2004 - 01:54:17 PST

Quoting Peter Ashenden <peter@ashenden.com.au>:

> Jim,
>
> > I have a question on instantiating packages.
> > If I create a generic package as follows:
> > package MuxPkg is
> > generic( type array_type) ;
> >
> > function Mux4 (
> > Sel : array_type(1 downto 0) ;
> > A : array_type ;
> > B : array_type ;
> > C : array_type ;
> > D : array_type
> > ) return array_type ;
> > end MuxPkg ;
>
> Actually, you wouldn't be able to apply an index constraint to the formal
> type, since you don't know that the actual will be an unconstrained array
> type. The actual could be any type. For example, if you instantiated the
> package with type BIT as the actual for array_type, applying an index
> constraint wouldn't make sense.
>
> In the proposal we're working with, we don't provide a way of adding
> information to the formal about the kind of type that can be supplied as an
> actual. So let's proceed with the example revised as:
Again, we should look on Ada generic, they are more powerful than what is
proposed in VHDL.

Tristan.
Received on Fri Dec 24 01:54:21 2004

This archive was generated by hypermail 2.1.8 : Fri Dec 24 2004 - 01:55:34 PST