Proper index type to access an std_logic array

Joined
Apr 18, 2011
Messages
2
Reaction score
0
Hi !

I get the error "Line 65. Wrong index type for pipeline." when I try to synthesize.
Concerned line is : "pipeline(index) <= input;"

Here is my snippet :

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
package pck_justToDeclareANewType is
type arrayOfLogicVector is array (natural range <>, natural range <>) of STD_LOGIC;
--type arrayOfLogicVector is array (natural range <>) of STD_LOGIC_vector(0 to 3);
end pck_justToDeclareANewType;

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use WORK.pck_justToDeclareANewType.all;

entity genericDelay is
generic ( busWidth : positive range 1 to 32 := 1;
delay_in_clocks : natural range 0 to 1024 := 0 );
Port ( inClock : in STD_LOGIC;
input : in STD_LOGIC_VECTOR (busWidth-1 downto 0);
-- o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-
output : out STD_LOGIC_VECTOR (busWidth-1 downto 0) );
end genericDelay;

architecture Behavioral of genericDelay is

signal pipeline : arrayOfLogicVector (delay_in_clocks downto 0, busWidth-1 downto 0);
begin

-- main synchrone process
delayer : process (inClock )
begin
if rising_edge( inClock ) then
L1 : for index in 0 to delay_in_clocks loop
pipeline(index) <= input;
end loop L1;
end if;
end process;

end Behavioral;

May I ask you some help please ?

Regards

Sylvain
 
Joined
Jan 30, 2009
Messages
42
Reaction score
0
Indexing

You have 2 indices on your array, but you are trying to access it with a single index.
 
Joined
Apr 18, 2011
Messages
2
Reaction score
0
Indexing

Many thanks eliascm !
I thought that if I used only the first index, I could access to a full vector of bits.

I went wrong with such following type :
type arrayOfLogicVector is array (natural range <> ) of STD_LOGIC_vector( busWidth - 1 downto 0) ;

where only one index is enough to access to a full vector of bits.

Cheers !

Sylvain
 

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,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top