右移 (srl) 在 VHDL Quartus II 上出错

Shift Right (srl) going wrong on VHDL Quartus II

我正在尝试在 Quartus II 上制作一个 8 位顺序乘法器。我对所有块进行了所有模拟,但其中一个在 VWF 模拟中显示错误。 sum_reg 块在非常小的时间间隔内进行无限移动。

在波形仿真的 "dark blue" 部分,在 o_DOUT 上,是在 MSB 到达 LSB 之前移动无限大的时候。下图显示了模拟中深蓝色部分发生的情况:

有人知道发生了什么事吗?

代码下方:

求和寄存器(模拟出错的地方):

 library IEEE;
 use IEEE.std_logic_1164.all;
 use IEEE.numeric_std.all;

 entity sum_register is 
 port (
     i_DIN   : in UNSIGNED(8 DOWNTO 0);
     i_LOAD  : in STD_LOGIC;
     i_CLEAR : in STD_LOGIC;
     i_SHIFT : in STD_LOGIC;
     o_DOUT  : buffer UNSIGNED(15 downto 0)
 );
 end sum_register;

 architecture arch_1 of sum_register is 
 begin 
     process(i_CLEAR,i_LOAD,i_SHIFT, i_DIN)
     begin
        IF (i_CLEAR = '1') THEN
            o_DOUT <= "0000000000000000";
        ELSIF (i_LOAD = '1') THEN
            o_DOUT(15 downto 7) <= i_DIN;
        ELSIF (i_SHIFT = '1') THEN
             o_DOUT <= o_DOUT SRL 1;
        END IF;
      end process;
end arch_1;

您需要在电路中使用时钟信号来实现同步,您需要在您的实体中输入一个这样的输入:

i_CLOCK : in STD_ULOGIC;

在此之后,您需要使您的进程对时钟敏感:

process(i_CLOCK)

并且您的架构将更改为:

 architecture arch_1 of sum_register is
  SIGNAL r_DOUT : unsigned(15 downto 0);
 begin
     process(i_CLOCK)
     begin
     IF rising_edge(i_CLOCK) THEN
        IF (i_CLEAR = '1') THEN
            r_DOUT <= "0000000000000000";
        ELSIF (i_LOAD = '1') THEN
            r_DOUT(15 downto 8) <= i_DIN;
        ELSIF (i_SHIFT = '1') THEN
              r_DOUT <= r_DOUT SRL 1;
        END IF;
      END IF;
      end process;
      o_DOUT <= r_DOUT;
end arch_1;

使用此架构,您将需要一个无符号信号来为您的输出 o_DOUT 分配属性,这样您可以再次将 o_DOUT 输出更改为输出类型(不是缓冲区)。

注意:所有块的时钟信号必须相同!