嗨,我正在尝试使用 VHDL 实现一台机器,但我需要消除按钮按下的抖动。我的问题是我不确定应该在哪里实现去抖动。我现在的工作是这样的:
process(clk)
begin
if(clk' event and clk = '1') then
if rst = '1' then
curr_state <= state0;
else
curr_state <= next_state;
end if;
end if;
end process;
process(curr_state, op1,op0,rst) --here op1,op0 and rst are all physical buttons and I need to debounce op1 and op0
begin
if rst = '1' then
...some implementation
else
...implement the debounce logic first
...process some input
case curr_state is
when state0=>...implementation
...similar stuff
end case;
end process;
我不确定我是否以正确的方式做事。在第二个过程中,我应该像这样放置第一个处理,还是应该在 state0 阻塞时将它放在里面?另外,由于去抖动的处理需要计数,我是否像这样把它放在 case 块之外?谢谢!