对vhdl中的相同信号进行多重写操作

问题描述 投票:0回答:1

我有n个计算特定哈希值的组件,我不知道它们何时完成。完成后,他们应该将找到的哈希发送到主组件,在哪个哈希先到达主都无所谓,只要他收到一个即可。

是否有一种实现此方法的方法,可以避免在两个或更多个组件在完全相同的时间完成哈希计算而又不需要n个信号(每个哈希一个)进入主机的情况下避免竞争情况?

我试图实现将在主组件和n个组件​​之间放置的以下内容,但意识到这没有多大意义,因为在所有组件都写入同一hash_in信号的情况下仍然存在竞争条件。

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

-- System to connect multiple components to one master
-- When a component finds a hash, it writes to hash_in. Bus saves hash_in to an internal signal
-- and waits until master_ready is set to 1 to pass it the next signal
-- (Master sets master_ready to 0 while it's processing the last hash).

entity connector is
  port(
    -- The signal that all n components write to
    hash_in             : in    std_logic_vector(255 downto 0);
    -- Signal indicating if master is ready for the next hash
    master_ready        : in    std_logic;
    -- Hash we give to master
    hash_out            : out   std_logic_vector(255 downto 0)
  );
end connector;

architecture arch of connector is

  signal hash_internal : std_logic_vector(255 downto 0) := (others => '0');

begin

  hash_out <= hash_internal;

  process(master_ready, hash_in)
  begin

    if(master_ready) then
      hash_internal <= hash_in;
    end if;

  end process;

end architecture;

提前感谢一吨!

signals vhdl
1个回答
0
投票

根据您的问题,我认为您必须最小化最终设计的大小。

VHDL(仅)是描述硬件设计的一种方法。因此,在编写任何VHDL之前,应确定如何以目标技术中的最小大小实现该功能。

目标技术不太可能支持具有多个驱动程序的信号,因此这意味着您无法在尝试使用该功能的VHDL中编写设计,因为综合工具将无法将VHDL设计映射到目标技术。

可能是最小的设计是通过使用多路复用器来进行的,该多路复用器可以根据所有就绪信号的解码来选择适当的分量,就像Tricky在评论中写道。

它可能是一个相当大的解决方案,但是,如果这是目标技术所允许的最佳解决方案,那么它就是最小的解决方案。

因此按钮行:了解目标技术允许的内容,编写VHDL,以便综合工具将设计有效地映射到目标技术,并最终检查所实现的实现是否符合预期。

© www.soinside.com 2019 - 2024. All rights reserved.