FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > VHDL

VHDL comp.lang.vhdl newsgroup / Usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-12-2006, 09:27 AM
Guest
 
Posts: n/a
Default Generic package

hi,

is it possible to define a package with a generic option

i would like to have this :

package decoder is

generic (N : natural)

type POLY_TAB is array(0 to N) of std_logic_vector(7 downto 0);
....


thanks

Reply With Quote
  #2 (permalink)  
Old 09-12-2006, 11:34 AM
KJ
Guest
 
Posts: n/a
Default Re: Generic package


<[email protected]> wrote in message
news:[email protected] oups.com...
> hi,
>
> is it possible to define a package with a generic option
>
> i would like to have this :
>
> package decoder is
>
> generic (N : natural)
>
> type POLY_TAB is array(0 to N) of std_logic_vector(7 downto 0);
> ...
>


The short answer is 'no you can't put the generic in the package'. But the
following might work for you instead...

package decoder is
type POLY_TAB is array(natural range <>) of std_logic_vector(7 downto 0);
end package decoder;

Now type 'POLY_TAB' is an unconstrained array. At some point you'll want to
use it and you would declare a signal as...

signal My_Poly_Tab: POLY_TAB(0 to 5);

KJ


Reply With Quote
  #3 (permalink)  
Old 09-12-2006, 01:47 PM
Andy
Guest
 
Posts: n/a
Default Re: Generic package

For now, KJ's approach is a close as you can get. But I believe the
next balloted revision of VHDL is due to have generic packages. Then
the vendors will have to update their tools to support it...

Andy


KJ wrote:
> <[email protected]> wrote in message
> news:[email protected] oups.com...
> > hi,
> >
> > is it possible to define a package with a generic option
> >
> > i would like to have this :
> >
> > package decoder is
> >
> > generic (N : natural)
> >
> > type POLY_TAB is array(0 to N) of std_logic_vector(7 downto 0);
> > ...
> >

>
> The short answer is 'no you can't put the generic in the package'. But the
> following might work for you instead...
>
> package decoder is
> type POLY_TAB is array(natural range <>) of std_logic_vector(7 downto 0);
> end package decoder;
>
> Now type 'POLY_TAB' is an unconstrained array. At some point you'll want to
> use it and you would declare a signal as...
>
> signal My_Poly_Tab: POLY_TAB(0 to 5);
>
> KJ


Reply With Quote
  #4 (permalink)  
Old 09-12-2006, 03:37 PM
Guest
 
Posts: n/a
Default Re: Generic package

thank you KJ

the solution you give works fine....

Reply With Quote
  #5 (permalink)  
Old 09-13-2006, 03:08 AM
David Bishop
Guest
 
Posts: n/a
Default Re: Generic package

patr[email protected] wrote:
> hi,
>
> is it possible to define a package with a generic option
>
> i would like to have this :
>
> package decoder is
>
> generic (N : natural)
>
> type POLY_TAB is array(0 to N) of std_logic_vector(7 downto 0);
> ...


It turns out that this is a feature of VHDL-2006.

Take a look at the code at:
http://www.vhdl.org/vhdl-200x/vhdl-200x-ft/files.html
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
generic pipelined comparator and package My Name VHDL 2 11-20-2005 04:14 AM
generic KCL FPGA 1 02-25-2005 08:03 AM
FC II & Generic Marek Ponca VHDL 1 11-22-2003 05:03 AM
FC II & Generic Marek Ponca FPGA 0 11-21-2003 03:34 PM


All times are GMT +1. The time now is 09:13 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved