使用vhdl中的类型创建2d数组

问题描述 投票:0回答:1

您能帮我在VHDL中使用类型进行此矩阵声明吗?

-- A    B     Q    Y
(('0', '0', "000", 0),
 ('0', '1', "ZZ1", 1),
 ('1', '0', "Z1Z", 1),
 ('1', '1', "1ZZ", 2))


vhdl
1个回答
0
投票

类型声明可能看起来像这样:

type element_t is record
  A : std_logic;
  B : std_logic;
  Q : std_logic_vector(2 downto 0);
  Y : natural;
end record;

type array_t is array (0 to 3) of element_t;

constant VALUE : array_t :=
  -- A    B     Q    Y
  (('0', '0', "000", 0),
   ('0', '1', "ZZ1", 1),
   ('1', '0', "Z1Z", 1),
   ('1', '1', "1ZZ", 2));
© www.soinside.com 2019 - 2024. All rights reserved.