vhdl将块的输出反馈到其输入

vhdl将块的输出反馈到其输入,vhdl,feedback,Vhdl,Feedback,我有一个加法器块,我需要将输出(std_logic_vector)反馈到加法器的一个输入端口,以添加另一个数字(这将在使用加法器的另一个实体中完成)。我试图通过敏感度列表的过程来实现这一点,但没有成功。有没有办法做到这一点? 注:不使用时钟 这是我的密码: library IEEE; use IEEE.std_logic_1164.all; entity example is port ( X: IN std_logic_vector(15 downto 0); Y: IN

我有一个加法器块,我需要将输出(
std_logic_vector
)反馈到加法器的一个输入端口,以添加另一个数字(这将在使用加法器的另一个实体中完成)。我试图通过
敏感度列表的
过程
来实现这一点,但没有成功。有没有办法做到这一点? 注:不使用时钟

这是我的密码:

library IEEE;
use IEEE.std_logic_1164.all;

entity example is
port ( 
    X: IN std_logic_vector(15 downto 0);
    Y: IN std_logic_vector(15 downto 0);
    Z: OUT std_logic_vector(15 downto 0)
    );
end example;

architecture arch_example of example is
    component adder is
    port(a: in std_logic_vector(15 downto 0);
        b: in std_logic_vector(15 downto 0);
        cin: in std_logic;
        s: out std_logic_vector(15 downto 0);
        overflow: out std_logic);
    end component;
    signal s, ain, bin: std_logic_vector(15 downto 0);
    signal cin, overflow, useless: std_logic;
begin
    process(x, y) is
    begin
        ain <= x;
        bin <= y;
        cin <= '0';
    end process;
    process(s, overflow) is
    begin
        ain <= s;
        bin <= "1111111110000001";
        cin <= overflow;
    end process;
    U1: adder port map (ain, bin, cin, s, overflow);
    z <= s;
end arch_example;
IEEE库;
使用IEEE.std_logic_1164.all;
实体示例是
港口(
X:标准逻辑向量(15到0);
Y:标准逻辑向量(15到0);
Z:输出标准逻辑向量(15到0)
);
结束示例;
建筑拱门的例子是
元件加法器
端口(a:标准逻辑向量(15到0);
b:标准逻辑向量(15到0);
cin:标准逻辑;
s:输出标准逻辑向量(15到0);
溢出:输出标准(U逻辑);
端部元件;
信号s、ain、bin:std_逻辑_向量(15到0);
信号cin,溢出,无用:std_逻辑;
开始
过程(x,y)为
开始

ain在您的代码中,您有多个信号驱动程序
ain
bin
cin
,因为两个进程同时驱动这些信号。你可以把它想象成两个门驱动同一根电线

要在完全组合设计中向中间结果添加另一个数字,需要第二个加法器。第一个加法器不能重复使用,因为您无法轻松判断何时使用多路复用器切换到新输入。(异步逻辑的概念是可能的,但这要复杂得多。)

一个简单的解决方案是实例化加法器组件两次:

architecture arch_example of example is
    component adder is
    port(a: in std_logic_vector(15 downto 0);
        b: in std_logic_vector(15 downto 0);
        cin: in std_logic;
        s: out std_logic_vector(15 downto 0);
        overflow: out std_logic);
    end component;
    signal s : std_logic_vector(15 downto 0);
    signal overflow : std_logic;
begin
    U1: adder port map (x, y, '0', s, overflow);
    U2: adder port map (s, "1111111110000001", overflow, z, open);
end arch_example;
上面的代码段使用组件端口的位置分配。这应该避免,因为很容易混淆端口的顺序。我建议改为使用命名作业。这里可以清楚地看到哪个端口(在
=>
的左侧)被分配给哪个信号(在右侧):


你需要给我们一些代码或图表来解释你想要实现的目标。但是说“不使用时钟”有点令人担忧——组合反馈不是同步设计,因此不应该这样做。上面的代码解释了我想做什么,有什么建议吗@Matthewtayolas据我所知,第一个
过程将在输入
X
Y
更改时执行,第二个过程将在
s
溢出
更改时执行。因此,在第一个
进程中,
ain@mhmdhsenkamal但是,来自第一个进程的信号分配将保持不变,即使进程在最后暂停。每个进程在模拟启动后执行一次,因此两个进程将在模拟启动->多个驱动程序时分配不同的值。非常感谢!我试图不添加其他加法器,但似乎我没有其他选择。
architecture arch_example of example is
    component adder is
    port(a: in std_logic_vector(15 downto 0);
        b: in std_logic_vector(15 downto 0);
        cin: in std_logic;
        s: out std_logic_vector(15 downto 0);
        overflow: out std_logic);
    end component;
    signal s : std_logic_vector(15 downto 0);
    signal overflow : std_logic;
begin
    U1: adder port map (
      a => x,
      b => y,
      cin => '0',
      s => s,
      overflow => overflow);

    U2: adder port map (
      a => s,
      b => "1111111110000001",
      cin => overflow,
      s => z,
      overflow => open);
end arch_example;