我一直试图在一个单独的"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请注意,问题在于我试图在实体中定义一个standard_logic_vector数组,即多维数组。如果我定义了一个std_logic数组,这段代码就能正常工作。
发布于 2012-06-05 11:34:36
您提到您正在使用Quartus,它在使用std_logic_vectors作为其他项的基类型时可能会很挑剔。
我使用子类型在Quartus中做了我想要做的事情:
mytypes.vhd文件:
library ieee;
use ieee.std_logic_1164.all;
package mytypes is
subtype BYTE_T is std_logic_vector(7 downto 0);
type BYTE_A is array (natural range <>) of BYTE_T;
type my_bus_array_type is array (0 to 3) of BYTE_T;
end package mytypes;my_entity.vhd文件:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.mytypes.all
entity my_entity is
port (
my_bus_array1 : in BYTE_A(0 to 3);
my_bus_array2 : in my_bus_array_type;
...是在实体中定义数组范围(可能使用泛型)还是在包中定义数组范围由您决定。
发布于 2012-06-04 17:33:19
我不是VHDL专家,但我认为你必须这样写你的代码:
我编辑过:试试这个:
package mytypes is
type my_bus_array_type is array (0 to 3) of std_logic_vector(7 downto 0);
end package mytypes;
entity my_entity is
port ( my_bus_array : in my_bus_array_type;
...);
end my_entity发布于 2012-06-04 19:19:38
您必须告诉编译器使用您在mytypes包中创建的类型:
use work.mytypes.all
entity my_entity is
port ( my_bus_array : in my_bus_array_type;
...https://stackoverflow.com/questions/10879044
复制相似问题