2D Unconstrained Nx1 Array

后端 未结 2 1479
小蘑菇
小蘑菇 2020-12-21 18:41

I\'m trying to create a flexible array of constants. I want to use a 2D array which may sometimes be for example a 2x1, 2x2, 3x2 array etc. For example:

type         


        
2条回答
  •  时光取名叫无心
    2020-12-21 19:35

    I managed to compile the first example in the following ugly way:

    type int_2d_array is array (integer range<>, integer range<>) of integer;
      constant M : positive := 2;
      constant nMax : positive := 1;
      constant n : int_2d_array(M - 1 downto 0, nMax - 1 downto 0) := ( (others => 1) , (others => 2) ); 
    

    Strange behavior, indeed.

提交回复
热议问题