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

📄 js.vhd

📁 四人抢答器
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity js is 
  port (clr, en,clk:in std_logic;
		sp:out std_logic;
        qa:out std_logic_vector (3 downto 0);
        qb:out std_logic_vector (3 downto 0));
end entity js;
architecture art of js is
begin 
process(clk,clr)is
  variable tmpa:std_logic_vector (3 downto 0);
  variable tmpb:std_logic_vector (3 downto 0);
  begin 
if tmpa="0000"and tmpb="0000"then
sp<='1';
else sp<='0';
end if;
  if clr='1'then tmpa:= "0010";tmpb:= "0000";
     elsif clk'event and clk='1'then
    	if  en='1'then
          if tmpb="0000" then tmpb:="1001";tmpa:=tmpa-1;
          else tmpb:=tmpb-1;
          end if ;
       end if;
      end if;
qa<=tmpa;qb<=tmpb;
end process;
end;

⌨️ 快捷键说明

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