wrong index type for array?

Discussion in 'VHDL' started by ieee.sucks.all, Jul 8, 2008.

  1. ieee.sucks.all

    ieee.sucks.all

    Joined:
    Jul 8, 2008
    Messages:
    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;
    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!
    ieee.sucks.all, Jul 8, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. eeh

    Wrong index type

    eeh, Oct 4, 2005, in forum: VHDL
    Replies:
    4
    Views:
    4,840
    Nicolas Matringe
    Oct 5, 2005
  2. dancar

    vhdl: wrong index type

    dancar, Sep 21, 2009, in forum: VHDL
    Replies:
    1
    Views:
    1,600
    joris
    Sep 26, 2009
  3. Shawn W_
    Replies:
    5
    Views:
    261
    Aldric Giacomoni
    Sep 16, 2009
  4. Tomasz Chmielewski

    sorting index-15, index-9, index-110 "the human way"?

    Tomasz Chmielewski, Mar 4, 2008, in forum: Perl Misc
    Replies:
    4
    Views:
    266
    Tomasz Chmielewski
    Mar 4, 2008
  5. Stefan Mueller
    Replies:
    7
    Views:
    175
    Thomas 'PointedEars' Lahn
    Nov 28, 2005
Loading...

Share This Page