gpt4 book ai didi

vhdl - Altera Qsys和具有std_logic_vector数组的顶级实体

转载 作者:行者123 更新时间:2023-12-01 05:58:52 24 4
gpt4 key购买 nike

我一直试图在一个单独的“ 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数组,则此代码可以正常工作。

最佳答案

您提到您正在使用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;
...


是否要在实体中定义数组范围(也许使用泛型)还是在包中决定。

关于vhdl - Altera Qsys和具有std_logic_vector数组的顶级实体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10879044/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com