📄 xiaodou.vhd
字号:
//键盘消抖电路的程序,自己觉得和别人的是不一样的 哈哈。
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity xiaodou is
port( clk: in std_logic;
row: in std_logic_vector(3 downto 0);
key_pre: out std_logic);
end entity;
architecture trl of xiaodou is
signal sig_1,counter: std_logic_vector(3 downto 0);
signal temp1,sig_2,sig_3: std_logic;
begin
sig_1<=row;
temp1<=sig_1(0) and sig_1(1) and sig_1(2) and sig_1(3);
key_pre<=counter(0) and counter(1) and counter(2) and counter(3);
process(clk)
begin
if(clk'event and clk='1')then
if(sig_3='0')then
counter<="0000";
else
counter<=counter+1;
end if;
end if;
end process;
process(clk)
begin
if(clk'event and clk='1')then
if(temp1='0')then
if(sig_2='0')then
sig_2<='1';
end if;
elsif(sig_3='0')then
sig_2<='0';
end if;
end if;
end process;
process(sig_2,counter)
begin
if(sig_2='1')then
if(counter="1111")then
sig_3<='0';
else
sig_3<='1';
end if;
end if;
end process;
end architecture;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -