2

尝试将组件连接到 VHDL 中父层次结构的两个输出端口时遇到问题。由于物理连接只能通过“端口映射”语句完成,因此无法将本地信号连接到多个输出端口。这是一个例子:

在此处输入图像描述

上述电路的描述应该是smth。像这样:

entity HIER is
port (
    IN1 : in bit;
    OUT1, OUT2 : out bit);
end hier;

architecture HIER_IMPL of HIER is 
   component BUF is 
      port (a : in bit; o : out bit);
   end component;
begin
   BUF1 : BUF port map (a => IN1, o => OUT1, o => OUT2);
end HIER_IMPL;

但是,将输出端口“o”双重分配给 OUT1 和 OUT2 将不起作用,因为它在 VHDL 中被禁止。

4

1 回答 1

9

您是否有理由不能创建内部信号并使用该信号来驱动这样的两个输出端口?

entity HIER is
port (
    IN1 : in bit;
    OUT1, OUT2 : out bit);
end hier;

architecture HIER_IMPL of HIER is 
   signal temp : bit;
   component BUF is 
      port (a : in bit; o : out bit);
   end component;
begin
   BUF1 : BUF port map (a => IN1, o => temp);
   OUT1 <= temp;
   OUT2 <= temp;

end HIER_IMPL;

如果这是不可能的,那怎么办?

entity HIER is
port (
    IN1 : in bit;
    OUT1, OUT2 : out bit);
end hier;

architecture HIER_IMPL of HIER is 
   component BUF is 
      port (a : in bit; o : out bit);
   end component;
begin
   BUF1 : BUF port map (a => IN1, o => OUT1);
   BUF2 : BUF port map (a => IN1, o => OUT2);
end HIER_IMPL;
于 2012-08-27T14:50:58.267 回答