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

📄 qiangda.txt

📁 < 四人抢答器>>绝对好用的EDA程序!已经通过测试
💻 TXT
字号:
-- 四人抢答器

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity qiangda is
    port(
	        clk,clr,start:in std_logic;   -- clock
		    a:in std_logic;   
			b:in std_logic;
			c:in std_logic;
			d:in std_logic;
			output: out std_logic_vector(3 downto 0);
			flag:out std_logic
			);
end qiangda;

architecture Behavioral of qiangda is
signal flagf:std_logic;

begin




     qiangda:process(clk,a,b,c,d,clr,start)

	  begin                  -- 实际按键速度不能跟扫描频率相比,
	                         -- 所以此处虽有优先级,也不影响结果
	  if (clk'event and clk='1') then
	      if clr='1' then
	           output<="0000";
	         ELSIF start='1' then 
	             if   (a='0') then flagf<='1';output<="0001";
				 elsif(b='0') then flagf<='1';output<="0010";
				 elsif(c='0') then flagf<='1';output<="0100";
			     elsif(d='0') then flagf<='1';output<="1000";
			     else flagf<='0'; output<="0000";
			    end if;
           end if;
     end if;

end process;

flag<=flagf;
	
end Behavioral;



⌨️ 快捷键说明

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