⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 an_switch.vhd

📁 消抖程序
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity an_switch is

--实现按键脉冲变换成固定的‘0’‘1’信号

   port
	(  star_in       : in  std_logic;
	   waiten_in       : in  std_logic;
	   switch_in     : in  std_logic;
        star         : out  std_logic;
	   wait_en       : out  std_logic;
	   switch        : out  std_logic:='0'
	);
end entity;

architecture arc of an_switch is
signal flag0 :std_logic:='0';
signal flag1 :std_logic:='0';
signal flag2 :std_logic:='0';

begin
process(star_in) is 
begin
if(star_in'event and star_in='1')then         --有一个信号就变换一次
   flag0<=not flag0;
end if;
end process;

process(waiten_in) is 
begin
if(waiten_in'event and waiten_in='1')then
    flag1<=not flag1;
end if;
end process;

process( switch_in ) is 
begin
if(switch_in'event and switch_in='1')then
  flag2<=not flag2;
end if;
end process;
star<=flag0;         --信号输出
wait_en<=flag1;
switch<=flag2;

end arc;



⌨️ 快捷键说明

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