我一直在尝试在单独的“mytypes.vhd”文件中声明我的类型,如下所示:
library ieee;
use ieee.std_logic_1164.all;
package mytypes is
type my_bus_array_type is array (0 to 3) of std_logic_vector(7 downto 0);
end package mytypes;
然后定义一个实体如下:
library ieee;
use ieee.std_logic_1164.all;
library work;
use work.mytypes.all;
entity my_entity is
port(
bus_array : in my_bus_array_type;
...
);
end my_entity;
好吧,这行不通。当我尝试使用 Altera Qsys 工具将组件添加到我的库时,我收到以下错误:
Error: Verilog HDL or VHDL XML Interface error at my_entity.vhd(41): port "bus_array" has an unsupported type File: /home/project/my_entity.vhd Line: 41
请注意,问题在于我试图在实体内部定义一个标准逻辑向量数组,即多维数组。如果我改为定义一个 std_logic 数组,则此代码可以正常工作。