因此,当端口映射组件在“顶级文件”上时,是否可以在端口映射时反转重置输入,如下面的示例所示?
假设顶级文件代码是:
entity topfile is
port(
clk : in std_logic;
reset : in std_logic
--Other input and outputs
);
architecture arch of topfile is
begin
c1: entity work.component1(behavioral)
port map(
clk => clk,
reset => not reset,
.
.
.
);
c2: entity work.component2(behavioral)
port map(
clk => clk,
reset => not reset,
.
.
.
);
end arch;发布于 2017-03-01 08:58:44
是的,你可以,但你必须使用VHDL 2008。在VHDL 2008之前,端口映射中的所谓表达式是不允许的。
不要轻易决定使用VHDL 2008。并不是所有的工具都支持VHDL 2008,即使你发现你目前使用的所有工具都支持它,你能确定你将来可能想要使用的任何工具也会支持它吗?
考虑到使用VHDL 2008来解决这个特定问题的优势是有限的,我建议使用这样的虚拟信号:
entity topfile is
port(
clk : in std_logic;
reset : in std_logic
--Other input and outputs
);
architecture arch of topfile is
signal resetn : std_logic
begin
resetn <= not reset;
c1: entity work.component1(behavioral)
port map(
clk => clk,
reset => resetn,
.
.
.
);
c2: entity work.component2(behavioral)
port map(
clk => clk,
reset => resetn,
.
.
.
);端口映射中的表达式会添加额外的增量延迟,因此上面的表达式将与原始代码完全相同。
发布于 2017-03-01 09:16:42
正如Matthew指出的,2008年之前的端口映射中不允许使用表达式,但转换函数在2008年之前是支持的,至少由Vivado、ISE和ModelSim支持。您可以编写一个简单的invert函数,并将其放入在其他源文件中获取used的包中。就像这样:
function invert (input : std_logic) return std_logic is
begin
return not input;
end function;然后,您可以在端口映射中使用reset => invert(reset),,而无需在工具中支持VHDL2008。这仍然是相当可读的,没有使用任何“额外”的信号。
在一个相关的问题上,我建议不要在FPGA中使用有源低内部信号。在设备中启用和重置物理块的时钟通常不是活动低的,因此将它们写为活动低会导致额外的反转逻辑。
发布于 2017-03-01 06:58:09
可以,停那儿吧。只要“操纵”信号的类型和长度与端口匹配即可。
https://stackoverflow.com/questions/42525008
复制相似问题