antishakeswitchprocedure.txt

来自「这是一个很好的VHDL防抖程序」· 文本 代码 · 共 31 行

TXT
31
字号
开关防抖程序
library ieee;
use ieee.std_logic_1164.all;

entity dou is
port(din,clk: in std_logic;
              dout: out std_logic);
end dou;

architecture beha of dou is
signal x,y:std_logic;
begin
process(clk)
begin
        if clk'event and clk='1' then
               x<=din;
               y<=x;
end if;
dout<=x and (not y);
end process;
end beha;

_____________________________________________

此程序,针对1位dout,对于多位dout可采用STD_LOGIC_VECTOR(n to 0)来定义(高位到低位)

dout为Low有效,假设x输出为Low,当存在开关抖动的时候,x瞬时为High,y则为not(y=x) Low;而dout为Low.消除了抖动产生的影响.

可以作为消除glitch的电路
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?