Multidimentional arrays of std_logic

W

willem

I have declared in a package:

type Silly_In is array (natural range <>) of std_logic_vector;

I want to use generics in a entity to define the ranges:

entity test_Gates is
generic
( InBits : integer := 3
);
port
( clk : in std_logic;
Din : in Silly_In(2**Inbits-1 downto 0)(Inbits-1 downto 0); --??????
Q : out std_logic_vector(2**Inbits-1 downto 0)
);
end test_Gates;

The Din line gives errors. How do I code it correctly so that Din is a
array (255 downto 0) of std_logic_vector(2 downto 0) ? or I will want to
try for different InBits sizes.
 
W

willem

Small mistake:
How do I code it correctly so that Din is a array (255 downto 0) of
std_logic_vector(2 downto 0) ?

Should be:

How do I code it correctly so that Din is a
array (7 downto 0) of std_logic_vector(2 downto 0) ?
 
C

cristian

Willem,

I'd declare the type in the pacakge as:

constant Inbits: constant:=3;
type Silly_In is array (2**Inbits-1 downto 0) of
std_logic_vector(Inbits-1 downto 0); --

and use the Silly_In type in the entity for both Din and Q.

regards,

cristian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top