要实现按键去抖功能,不知道中间定义的过程能否实现延时功能,麻烦帮忙看下程序,多谢!!!
library ieee;
use ieee.std_logic_1164.all;
--主体
entity exp5 is
port
(
clc_sys,input : in std_logic;
output : out std_logic
);
end exp5;
-- 结构体
architecture qudou of exp5 is
signal out_signal: std_logic;
--延时过程
procedure yanshi(constant n:in integer)is
variable i:integer:=0;
begin
if clc_sys'event and clc_sys='1' then
i:=i+1;
end if;
if i=n then
return;
end if;
end procedure yanshi;
--主进程
begin
process(input)
begin
if input'event and input='0' then
yanshi(1000000);
if input='0' then
out_signal<=not out_signal;
output<=out_signal;
end if;
end if;
end process;
end qudou;