Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

Need multi-dimension syntax help.

I have 2 2-dimension signals:

type signed_2d is array (0 to 7) of signed(13 downto 0);

type signed_2dx2 is array (0 to 7) of signed(27 downto 0);

signal short_x: signed_2d;

signal long_x: signed_2dx2;

Could someone show me how to point to the sub-elements of those signal please?

For more obvious: I would like to signed-extend short_x and store it as long_x:

long_y(0 to 7)(13 downto 0) <= short_x(0 to 7); <<=== the error is here :(

long_y(0 to 7)(27 downto 14) <= (others => short_x(0 to 7)'high);

and the error:

Error (10381): VHDL Type Mismatch error at Normalized_LMS.vhd(47): indexed name returns a value whose type does not match "signed_2dx2", the type of the target expression

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    I have 2 2-dimension signals:

    type signed_2d is array (0 to 7) of signed(13 downto 0);

    type signed_2dx2 is array (0 to 7) of signed(27 downto 0);

    signal short_x: signed_2d;

    signal long_x: signed_2dx2;

    Could someone show me how to point to the sub-elements of those signal please?

    For more obvious: I would like to signed-extend short_x and store it as long_x:

    long_y(0 to 7)(13 downto 0) <= short_x(0 to 7); <<=== the error is here :(

    long_y(0 to 7)(27 downto 14) <= (others => short_x(0 to 7)'high);

    and the error:

    Error (10381): VHDL Type Mismatch error at Normalized_LMS.vhd(47): indexed name returns a value whose type does not match "signed_2dx2", the type of the target expression

    --- Quote End ---

    
    signal long_y : signed_2dx2
    process(short_x)
    begin
    for i in 0 to 7 loop
        long_y(i) <= resize(short_x(i),28);
    end loop;
    end process;