这是完整的代码
library ieee;
use ieee.std_logic_1164.all;
entity move_key_detector is
PORT(
clk : IN STD_LOGIC;
done : IN STD_LOGIC;
hex : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
up, down : out std_logic
);
END move_key_detector;
architecture arch of move_key_detector is
type statetype is (IDLE, RECEIVED_BREAK);
signal next_state, current_state : statetype :=IDLE;
begin
process (Clk) begin
if(rising_edge(Clk)) then
current_state <= next_state;
end if;
end process;
process(done) begin
next_state <= current_state;
case current_state is
when IDLE=>
if(done = '1') then
if (hex = "00011101") then up <= '1';
elsif(hex = "00011011") then down <= '1';
--check to see if a break code is sent
elsif (hex = "11110000") then next_state <= RECEIVED_BREAK;
end if;
end if;
when RECEIVED_BREAK=>
if(done ='1') then
if (hex = "00011101") then up <= '0';
elsif(hex="00011011") then down <= '0';
end if;
next_state <= IDLE;
end if;
end case;
end process;
错误是:
错误 (10821):move_key_detector.vhd(31) 处的 HDL 错误:无法推断“down”的寄存器,因为它的行为与任何支持的寄存器模型都不匹配
信息 (10041):在 move_key_detector.vhd(29) 中推断“向下”的锁存器
错误 (10821):move_key_detector.vhd(31) 处的 HDL 错误:无法推断“向上”的寄存器,因为它的行为与任何支持的寄存器模型都不匹配
信息 (10041):在 move_key_detector.vhd(29) 处推断“向上”的锁存器
错误 (10818):无法推断 move_key_detector.vhd(41) 处的“next_state”寄存器,因为它在时钟边沿之外不保持其值
错误 (10818): 无法推断 move_key_detector.vhd(33) 处的“next_state”寄存器,因为它没有在时钟沿之外保持其值
我一直收到这种错误。我遵循了这个建议,阅读了 HDL 手册,但我仍然不知道如何解决这个问题。
谁能帮我?非常感谢你!