|
消抖程序如下:
library ieee ;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity debounce is
port(
key_pressed : in std_logic;--key_pressed?
clk : in std_logic;--clock for synchrony
key_valid : out std_logic);--key_valid?
end debounce;
architecture behavior of debounce is
begin
debounce:process(clk,key_pressed)
variable dbnq : std_logic_vector(5 downto 0);
begin
if (key_pressed='1') then
dbnq:="111111";--unkey_pressed,counter reset at 63
elsif (clk'event and clk='1') then
if dbnq/=1 then
dbnq:=dbnq-1;--key_pressed not enough long time
end if; --counter still subtract one
end if;
if dbnq=2 then
key_valid<='1';--key_valid after key_pressed 1/63k second
else
key_valid<='0';--key_invalid
end if;
end process;
end behavior;
然后我想请问:dbnq/=1这句话是什么意思?特别是/=这个语法没见过,我是初学VHDL,
如果那位高手有空的话,帮忙写一下每一行的具体意思?谢谢了 |
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|