Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

decalaring many constant in 1 name...

Status
Not open for further replies.

energy_baz

Junior Member level 1
Junior Member level 1
Joined
Nov 24, 2010
Messages
18
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,413
hi,

I have question on how to use array to declare my constant values. I want to use all the constant value in generic map. So, should I declare all the constant in generic..? As example :

constant ( z : integer := 3);
type a is array (0 to z-1) of integer;
constant b : a := (3,5,7)

I need to use all these value in generic map..thanks in advance...
 

you need to declare the type in a package if you want to use that type as a generic.
 

No you cant, which is one of the problems - you need to then declare the constant in the package.
But the code you posted you dont need the constant.

Code:
package type_pkg is
  type a_t is array(integer range <>) of integer;
end package type_pkg.


entity some_ent is
  generic (
    a : a_t(0 to 2); --you dont need Z anymore, because you can declare the size of the array here
  );
 

true, but the type can be defined

sorry posts crossed each other
 

how about the constant value 5,6,7? Do i have to declare it in the package as well? I need to include all these value later in generate statement..which it will be call in my generic map..
 

no, you can just declare the constant when you need it, or just define it on the generic map:

generic map (
a => (3,5,7),
....
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top