RE: [vhdl-200x-ft] generics in packages

From: Peter Ashenden <peter@ashenden.com.au>
Date: Thu Aug 26 2004 - 17:10:07 PDT

Folks,

David asked me to review his suggestion before he posted, but I didn't get
chance to, since I've been ill. I apologise for that.

John is right, that two instances of the package declare distinct types. To
avoid the problem, a design would need to instantiate the package globally
and have all other design units use the single instance. For example:

package numeric_std_nowarn is new numeric_std
  generic map (no_warning => true);

architecture rtl of whatever
  use work.numeric_std_nowarn.all;
  ...
begin
  ...
end architecture rtl;

I guess this could be problematic when a design makes use of IP that
references a separate instance of the package. There are circumstances
where a similar problem arises in Ada. It deals with the problem through
formal package generics (that is, generics that denote package instances).
Essentially, you parameterize a design unit with a generic that specifies
what instance of a given package you want the design unit to use. It would
solve the problem for us, but is adding complexity that we sought to avoid.

Cheers,

PA

--
Dr. Peter J. Ashenden                        peter@ashenden.com.au
Ashenden Designs Pty. Ltd.                   www.ashenden.com.au
PO Box 640                                   Ph:  +61 8 8339 7532
Stirling, SA 5152                            Fax: +61 8 8339 2616
Australia                                    Mobile: +61 414 70 9106
> -----Original Message-----
> From: owner-vhdl-200x-ft@eda.org 
> [mailto:owner-vhdl-200x-ft@eda.org] On Behalf Of John Ries
> Sent: Friday, 27 August 2004 08:40
> To: vhdl-200x-ft@eda.org
> Subject: Re: [vhdl-200x-ft] generics in packages
> 
> 
> I'm not up to much on the generic package stuff but I would 
> think that the line package numeric_std_nowarn is .... makes 
> a new copy of the package and as a result new copies of 
> SIGNED and UNSIGNED which are different from SIGNED and 
> UNSIGNED in the regular package numeric_std.  If this is the 
> case then one would have problems connecting to modules 
> together because the type would be different.
> 
> 
> David Bishop wrote:
> > One of the proposals at the bottom of our proposals page is: 
> > 
> http://www.eda-twiki.org/vhdl-200x/vhdl-200x-> ft/proposals/dta_type_genericit
> > y.pdf
> > Which describes how to add generics to packages.
> > 
> > In NUMERIC_STD there is a constant called "NO_WARNING".
> > This constant turned out to be very useful to us while 
> debugging the 
> > packages.  It is also useful to the users, but there is no way for 
> > them to get at it.
> > 
> > Some vendors have even implemented special options to turn this 
> > "no_warning" boolean on.
> > 
> > Now, why can't we do the following:
> > 
> > packages numeric_std is
> >   generic (no_warning : boolean := false);
> > 
> > Then the user could say:
> > 
> > use ieee.numeric_std.all;
> > architecture rtl of whatever
> >   package numeric_std_nowarn is new numeric_std
> >     generic map (no_warning => true);
> >   ...
> > begin
> > 
> > and warnings would be shut off.  (If I read this proposal
> > correctly)
> > 
> > This also helps out with the fixed and floating point packages to 
> > control rounding and overflow.
> > 
> > Shall I or Shall I not?  I know I'm sending out lots of 
> e-mails, but I 
> > will not make a major change to the packages without checking first.
> > 
> 
> 
> -- 
> -- mailto: johnr@model.com     phone: (503)685-0864
> --   http://www.model.com        fax: (503)685-0921
> --
> 
> 
Received on Thu Aug 26 17:09:56 2004

This archive was generated by hypermail 2.1.8 : Thu Aug 26 2004 - 17:10:00 PDT