0
votes

I don't really understand what is wrong :

I have an unconstrained type

type int_matrix_type is array (natural range <>, natural range <>) of integer;

that I'm using to create different sizes of matrices, even I want a matrix with the range (0 to 1, 0 to 0) which I consider will give a matrix of 2 lines and 1 column (right?), like in this example signal example2_matrix :

library ieee;
use ieee.std_logic_1164.all;

entity toto is
    port (
        clk : in std_logic
    );
end entity;

architecture test of toto is

    -- type declaration
    type int_matrix_type is array (natural range <> ,natural range <>) of integer;
    -- examples of matrix signals
    signal example1_matrix : int_matrix_type (0 to 1, 0 to 1) 
    := ((0, 1),
        (2, 3)
        );
    signal example2_matrix : int_matrix_type (0 to 1, 0 to 0)
    := ((0), -- here line 20
        (2)  --      line 21
        );  
        
begin

end test;

But when I compile, Quartus returns errors

enter image description here

So what is wrong ?

Thanks in advance !

Your line 20 and 21 aggregates are not compatible with the subtype of example2_matrix. signal example2_matrix : int_matrix_type (0 to 1, 0 to 0) := (0 => (0 => 0),1 => (0 => 1)); Note the second dimension (the subaggregates have only one element while the aggregate of the type has two. This can also be positional signal example2_matrix : int_matrix_type (0 to 1, 0 to 0) := ((0 => 0),(0 => 1)); where the sub aggregate has a single element and must use named association (the name can be others). - user16145658
The semantic rule is found in IEEE Std 1076-2008 9.3.3 Aggregates, 9.3.3.1 General "Aggregates containing a single element association shall always be specified using named association in order to distinguish them from parenthesized expressions." The rest is poor error messages. - user16145658