Full Array Row

Discussion in 'VHDL' started by a_Conan, Aug 29, 2005.

  1. a_Conan

    a_Conan Guest

    Hi everyone,

    Suppose I have this code

    type AR is array(6 downto 0, 6 downto 0) of unsigned(7 downto 0);
    type FR is array(6 downto 0) of unsigned(7 downto 0);


    signal AR_1 : AR;
    signal FR_1 : FR;

    I try to assign a full row from AR_1 to FR_1 like as aslice:

    FR_1 <= AR_1(0, 6 downto 0);

    but it doesn't work :(

    Can anyone help me please?
     
    a_Conan, Aug 29, 2005
    #1
    1. Advertisements

  2. --type AR is array(6 downto 0, 6 downto 0) of unsigned(7 downto 0);
    This is someting i've never seen before!
    I think you should switch to a better approach...

    something like
    subtype OneDimensionArray is std_logic_vector (7 downto 0); -- here's the
    starting point
    type TwoDimensionArray is is array (6 downto 0) of
    OneDimensionArray; --then build your FR
    type ThreeDimensionArray is array (1 downto 0) of TwoDimensionArray; -- and
    finally your AR

    then declare FR as TwoDimensionArray and AR as ThreeDimensionArray, You can
    then make a direct assignment to FR by slicing the AR like you've been
    trying to do.
    Ben
     
    Benjamin Todd, Aug 29, 2005
    #2
    1. Advertisements

  3. Ah merde, I was wrong to suggest that change would completely solve your
    problems, thing is I hardly ever Use 2d arrays like you have, maybe I should
    change my ways.
    What I should be commenting on is the
    FR_1 <= AR_1(0, 6 downto 0);
    Should this not be FR_1 <= AR_1(0) or something similar?
    Just my 2p.
    Ben
     
    Benjamin Todd, Aug 29, 2005
    #3
  4. a_Conan

    a_Conan Guest

    FR_1 <= AR_1(0, 6 downto 0); not notworks : (
     
    a_Conan, Aug 30, 2005
    #4
  5. a_Conan

    crazyrdx Guest

    Maybe you would be better off using a FOR loop to assign each element
    in row instead of

    FR_1 <= AR_1(0, 6 downto 0);

    you might try

    FR_1 <= AR_1(0, i ); with i in a FOR loop
     
    crazyrdx, Aug 30, 2005
    #5
  6. a_Conan

    crazyrdx Guest

    actually i think you would also need another variable for the FR_1 part.
     
    crazyrdx, Aug 30, 2005
    #6
  7. a_Conan

    a_Conan Guest

    Thank you : )
     
    a_Conan, Aug 31, 2005
    #7
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.