我们正在为我们的项目使用 OR1200,我们想为 FPGA 板的第 8 个按钮分配一个中断。下面是产生中断的代码:
inrpt: process(CLK_I, RST_I)
begin
if RST_I = '1' then
butt_int_pul <= '0';
butt_int_tmp <= '0';
elsif rising_edge(CLK_I) then
if(DATA_I(8) = '1' and butt_int_tmp = '0') then
butt_int_pul <= '1';
else
butt_int_pul <= '0';
end if;
butt_int_tmp <= DATA_I(8);
end if;
end process inrpt;
process(CLK_I, RST_I)
begin
if RST_I = '1' then
butt_int <= '0';
elsif butt_int_pul = '1' then
butt_int <= '1';
elsif clear_int = '1' then
butt_int <= '0';
end if;
end process;
我们只希望这个中断只被处理一次(按住按钮不应该再次调用中断),这就是为什么我们包含一个标志来检查这个(butt_int_tmp
)。
问题是中断调用不稳定。每次我们按下按钮时它都不会调用。当我们删除标志时,它会起作用,但在这种情况下,它的处理次数与我们按住按钮的次数一样多。
我们做错了什么?