wrong index type for array?

Joined
Jul 8, 2008
Messages
1
Reaction score
0
hello... i think i read all the stuff about arrays and converting into integer or naturals... but my problem seems to be different.

i have made my own package to get the log 2 value of an integer value.
this package includes following code:

package body LOG_BINARY is
function log2 (x : positive) return natural is
variable temp, log: natural;
begin
temp := x / 2;
log := 0;
while (temp /= 0) loop
temp := temp/2;
log := log + 1;
end loop;
return log;
end function log2;
end LOG_BINARY;

when i check the syntax no error occures.

in my main entity i declare my array in this way:

subtype inter_stage is std_logic_vector(DATABUS downto 0);
type int_busses is array (log2(DATABUS) downto 0) of inter_stage;
signal internal_shift : int_busses;

... no error here.

component MUXCY
port ( CI : in std_logic;
DI : in std_logic;
S : in std_logic;
O : out std_logic);
end component;

--for build_mux_stages:MUXCY use entity UNISIM.Vcomponents.MUXCY;

begin
-- the logarithmic shifter needs shift stages according to the shift_number bus width
build_mux_stages:
for stage_index in 0 to log2(DATABUS) generate
build_mux_rows:
for width_index in 0 to DATABUS generate

STAGE1: if stage_index = 0 generate
MUX: MUXCY
port map
(CI=>UNSHIFTED((width_index)+1), DI=>UNSHIFTED(width_index),
S=>SHIFT_NUMBER(stage_index),
O=>internal_shift(width_index, stage_index)
);
end generate build_mux_rows;
end generate build_mux_stages;

the error occures in the line "O=>internal_shift(width_index, stage_index)"
"Wrong index type for internal_shift."

how can i find out what indextype is required for internal_shift?

thanks for reading all this
and for your answers!
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top