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

📄 keywatch.vhd

📁 many application on kit SP-3: VGA, digital clock, counter, interface PS2....
💻 VHD
字号:
library IEEE, unisim;use IEEE.std_logic_1164.all;use IEEE.NUMERIC_STD.all;use unisim.vcomponents.all;use work.key_Inter_pckg.all;entity KeyWatch is --100_000  generic(FREQ : natural := 50000 );   -- frequency of main clock (KHz)  port(clk  : in  std_logic;     -- main clock		rdy  : buffer  std_logic;  		 ps2_clk  : in  std_logic;           -- keyboard clock		 ps2_data : in  std_logic;           -- keyboard data		 s        : out std_logic_vector(7 downto 0);  -- LED display		 sccode  : out std_logic_vector(7 downto 0));end keyWatch ;architecture behave of keyWatch  is    constant YES : std_logic := '1';  constant NO  : std_logic := '0';  signal scancode  : std_logic_vector(7 downto 0);  -- scancode from keyboard--  signal rdy       : std_logic;         -- indicates when scancode is available  signal s_x       : std_logic_vector(7 downto 0);  -- next state of LED segments  signal kbd_error : std_logic;         -- error receiving scancode from keyboard  -- LED segment activation patterns for various numbers and lettersbegin  u400 : key_interface    generic map( FREQ  => FREQ   )    port map(      clk      => clk,                  -- clock for the keyboard interface      rst      => kbd_error,            -- reset the keyboard intfc whenever there is an error receiving a scancode      ps2_clk  => ps2_clk,              -- clock from the keyboard      ps2_data => ps2_data,             -- serial data from the keyboard (valid on falling edge of ps2_clk)      scancode => scancode,             -- the scancode received from the keyboard      rdy      => rdy,                  -- indicates when a scancode from the keyboard is available      error    => kbd_error             -- indicates an error in receiving a scancode from the keyboard      );   -- update the LED display  process(clk)  begin	  if rising_edge(clk) then						if rdy = YES then			  s <= s_x;                       -- update the display each time a scancode is received						sccode <= scancode;			end if;		 end if;  end process;end behave;

⌨️ 快捷键说明

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