【发布时间】:2015-09-14 10:25:05
【问题描述】:
我应该在 VHDL 中创建一个具有可变数量的输入和输出的实体。该引脚数应从 GENERIC 构造中给出。让我们假设有这个代码:
entity HELLO is
GENERIC(NUM_INPUT: integer:=4;
NUM_OUTPUT: integer:=2
);
port(
input1 : in std_logic_vector(31 downto 0);
input2 : in std_logic_vector(31 downto 0);
input3 : in std_logic_vector(31 downto 0);
input4 : in std_logic_vector(31 downto 0);
out1 : out std_logic_vector(31 downto 0);
out2 : out std_logic_vector(31 downto 0)
);
end entity HELLO;
显然,手动编写它们(如上例所示)会使 GENERIC 构造无用。
我希望根据 GENERIC 信息自动生成这 4 个输入和 2 个输出。怎么做?
【问题讨论】:
-
您的实体标头在
out2接口元素声明之后的端口子句中有一个额外的分号。分号用作界面列表中的界面元素分隔符。从实用上讲,这允许单个词法元素(标记)在解析中向前看,以确定接口列表的末尾出现在哪里,分支上的分号或右括号。 -
已更正,是分心错误