Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > wrong index type for array?

Thread Tools

wrong index type for array? is offline
Junior Member
Join Date: Jul 2008
Posts: 1
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;
temp := x / 2;
log := 0;
while (temp /= 0) loop
temp := temp/2;
log := log + 1;
end loop;
return log;
end function log2;

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;

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

STAGE1: if stage_index = 0 generate
port map
(CI=>UNSHIFTED((width_index)+1), DI=>UNSHIFTED(width_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!
Reply With Quote

Thread Tools

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 Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
vhdl: wrong index type dancar VHDL 1 09-26-2009 09:29 PM
sorting index-15, index-9, index-110 "the human way"? Tomasz Chmielewski Perl Misc 4 03-04-2008 05:01 PM
Index of selection is wrong after setting a new index within Mozilla Stefan Mueller Javascript 7 11-28-2005 05:24 PM
Wrong index type eeh VHDL 4 10-05-2005 08:13 AM
problem with index.html .(page is automatically gettin redirected to index.html) karthikeyavenkat Java 2 03-17-2005 10:01 PM