prevent_flutter.vhd

来自「多功能电子琴 可以实现人性化界面 同时可以根据按键选择播放模式」· VHDL 代码 · 共 31 行

VHD
31
字号
--Prevent Flutter Module
--消抖模块
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity Prevent_Flutter is
	port(
		clk : in std_logic;		--clock
		in1: in std_logic_vector(3 downto 0);		--input signal
		out1 : out std_logic_vector(3 downto 0)    --output signal
		);		
end Prevent_Flutter;

architecture code of Prevent_Flutter is
signal x,y:std_logic_vector(3 downto 0);
begin
	process(clk,x,y)
	begin
		if clk'event and clk='1' then
			for i in 0 to 3 loop
				x(i)<=in1(i);
				y(i)<=x(i);
			end loop;			
		end if;
		for j in 0 to 3 loop
			out1(j)<=x(j) or (not y(j));
		end loop;
	end process;
end code;

⌨️ 快捷键说明

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