如何在依赖的多个进程中使用敏感列表

how to use sensitivity list in multiple processes that are dependent

我正在为一个简单的算术方程 d=1+(k*o) 编写代码。我的 code.the 中有三个进程,第三个进程依赖于第二个进程,第二个进程依赖于 first.I 我无法保持敏感度列表正确。输出未定义。

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;

entity dcalc is
    Port ( k : in  STD_LOGIC_VECTOR (7 downto 0);
           o : in  STD_LOGIC_VECTOR (7 downto 0);
           e : in  STD_LOGIC_VECTOR (7 downto 0);
           d : out  STD_LOGIC_VECTOR (7 downto 0);
              clk: in  STD_LOGIC);
end dcalc;

architecture Behavioral of dcalc is
COMPONENT divd
    PORT(
         d1 : IN  std_logic_vector(7 downto 0);
         e : IN  std_logic_vector(7 downto 0);
         remi : OUT  std_logic_vector(7 downto 0);
         clk : IN  std_logic
        );
    END COMPONENT;
signal  endp1,d2,k1,o1,e1,d3: unsigned (7 downto 0);
--signal d3:std_logic_vector(7 downto 0);
begin

--process 1
process(k,o,e)
begin
if(clk'event and clk='1') then
k1<=unsigned(k);
o1<=unsigned(o);
e1<=unsigned(e);
endp1<=x"01";
end if;
end process; 

--process 2
process(endp1)
begin
if(clk'event and clk='1') then
d2<=1+(k1*o1);
end if;
end process;

--process 3
process(d2)
begin
if(clk'event and clk='1') then
d<=std_logic_vector(d2);
end if;
end process;

end Behavioral;

在第一个过程中,转换完成。当过程 1 完成后,d2 应该在过程 2 中计算。当 d2 在过程 2 中计算时,d 应该在过程 3 中更新。这是我的测试台代码:

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;

ENTITY ccalctb IS
END ccalctb;

ARCHITECTURE behavior OF ccalctb IS 

    -- Component Declaration for the Unit Under Test (UUT)

    COMPONENT dcalc
    PORT(
         k : IN  std_logic_vector(7 downto 0);
         o : IN  std_logic_vector(7 downto 0);
         e : IN  std_logic_vector(7 downto 0);
         d : OUT  std_logic_vector(7 downto 0);
         clk : IN  std_logic
        );
    END COMPONENT;


   --Inputs
   signal k : std_logic_vector(7 downto 0) := (others => '0');
   signal o : std_logic_vector(7 downto 0) := (others => '0');
   signal e : std_logic_vector(7 downto 0) := (others => '0');
   signal clk : std_logic := '0';

    --Outputs
   signal d : std_logic_vector(7 downto 0);

   -- Clock period definitions
   constant clk_period : time := 10 ns;

BEGIN

    -- Instantiate the Unit Under Test (UUT)
   uut: dcalc PORT MAP (
          k => k,
          o => o,
          e => e,
          d => d,
          clk => clk
        );

   -- Clock process definitions
   clk_process :process
   begin
        clk <= '0';
        wait for clk_period/2;
        clk <= '1';
        wait for clk_period/2;
   end process;


   -- Stimulus process
   stim_proc: process
   begin        
      -- hold reset state for 100 ns.
      wait for 100 ns;  
k<=x"07";
o<=x"08";
e<=x"07";
      wait for clk_period*10;

      -- insert stimulus here 

      wait;
   end process;

END;

请帮忙。 这是将所有过程敏感列表更改为仅 clk 后的仿真结果:

在同步(时钟)过程中,敏感列表只需要时钟(可能还有异步复位):

process(clk)
begin
  if RISING_EDGE(clk) then
    k1<=unsigned(k);
    o1<=unsigned(o);
    e1<=unsigned(e);
    endp1<=x"01";
  end if;
end process;

使用您的原始敏感度列表,D 触发器(或作为 D 触发器向量的寄存器)输入的变化触发了进程执行,但正如我们所知,输出不会立即改变,它会等待对于时钟边沿。然后当时钟沿到来时,clk 不在敏感列表中,因此模拟将其忽略。因此,您的输出永远不会在模拟中更新。

(相比之下,综合往往会忽略您的灵敏度列表,而只是放置一个配置为真正的 D 触发器的逻辑元件,它将在时钟边沿正确更新)