Array pipeline

Discussion in 'VHDL' started by hssig, Apr 1, 2011.

  1. hssig

    hssig Guest

    Hi,

    I want to declare an array "vecarr " which consists of
    std_logic_vector, and a second
    array "arr3d " to pipeline the first array.
    When simuating the following test code Modelsim complains:
    ** Fatal: (vsim-3734) Index value 0 is out of range 4 downto 1.


    ------------------------------------------------------------------------------------------------
    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.numeric_std.all;

    entity arr_pipe is
    end entity;

    architecture xy of arr_pipe is

    type t_vecarr is array(natural range <>) of std_logic_vector(7 downto
    0);
    signal vecarr : t_vecarr(15 downto 0) := (others => (others => '1'));
    type t_arr3d is array(natural range <>) of t_vecarr(15 downto 0);
    signal arr3d : t_arr3d(4 downto 0);
    signal clk : std_logic;

    begin

    process
    begin
    clk <= '1'; wait for 5 ns;
    clk <= '0'; wait for 5 ns;
    end process;

    process(clk)
    begin
    if rising_edge(clk) then
    for m in 0 to 15 loop
    arr3d(arr3d'high)(m) <= vecarr(m);
    arr3d(arr3d'high-1 downto 0)(m) <= arr3d(arr3d'high
    downto 1)(m); --** ERROR
    end loop;
    end if;
    end process;

    end xy;
    ------------------------------------------------------------------------------------------------


    Can someone explain to me what is wrong about that shift register ?

    Cheers,
    hssig
     
    hssig, Apr 1, 2011
    #1
    1. Advertising

  2. On Apr 1, 7:50 am, hssig wrote:

    > arr3d(arr3d'high-1 downto 0)(m)
    > <= arr3d(arr3d'high downto 1)(m);  --** ERROR


    Huh? You're taking a slice of an array, and then
    trying to subscript it? I didn't think that was
    possible, but it seems that maybe it is (must go
    check the LRM!) and the (m) is being used as a
    subscript into the slice arr3d(arr3d'high-1 downto 0).

    You need an inner for-loop to do that copy,
    scanning over the first subscript of arr3d.

    I don't see why you need the m-loop at all,
    since you're just copying bits broadside.
    What's wrong with this:

    arr3d(arr3d'high) <= vecarr;
    arr3d(arr3d'high-1 downto 0)
    <= arr3d(arr3d'high downto 1);

    Or something like this...

    for i in arr3d'range loop
    if i = arr3d'high then
    arr3d(i) <= vecarr;
    else
    arr3d(i) <= arr3d(i+1);
    end if;
    end loop;

    I don't see the need for a loop scanning over
    the subcomponents of the t_vecarr objects.
    --
    Jonathan Bromley
     
    Jonathan Bromley, Apr 1, 2011
    #2
    1. Advertising

  3. hssig

    hssig Guest

    Hi Jonathan,

    thank you for your alternative description. I have just been curious
    about the reason why my solution does
    not work. Now it is clear.

    Cheers,
    hssig
     
    hssig, Apr 4, 2011
    #3
    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. Ingmar Seifert
    Replies:
    10
    Views:
    17,283
    swatig29
    Nov 4, 2009
  2. Eqbal Z
    Replies:
    1
    Views:
    1,282
  3. Replies:
    3
    Views:
    1,449
  4. Replies:
    3
    Views:
    669
  5. ghanta

    Pipeline

    ghanta, Jul 17, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    536
    Teemu Keiski
    Jul 17, 2003
Loading...

Share This Page