2012-08-27 21 views
0

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

enter image description here

上述电路的描述应不便。像这样:

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和它在VHDL禁止OUT2将无法正常工作的双重分配。

+0

如果只有一个OUT端口并将OUT连接到OUT1和OUT2连接的两个端口,会不会更好? – simon

回答

7

是否有一个原因,你不能创建一个内部信号,并使用该信号来驱动这样的两个输出端口?

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; 
+2

第一段代码应该工作得很好。一个只需要一个信号来连接两个以上的IO。 –

+0

谢谢!我的意图是无需任务的解决方案。看起来不可能不分配任务。第二种选择是不可接受的,因为它涉及两个缓冲区。 – mkostya

+0

@mkostya请接受这个答案,如果它解决了你的问题。 – Josh