---------------------------------------------------------- -- keyValidator -- Author : Gautam Karnik -- Date : March 30, 2001 -- Filename : keyValidator.vhd -- Architecture : Behavioral -- Description : This entity determines when we have -- valid keypad data. This occurs when: -- the key is pressed and -- the channel is ready and -- either user 1 or user 2 is online. ---------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; library work; use work.CDMA_pkg.all; entity keyValidator is port ( resetn, clock : in std_logic; channel_status : in std_logic; usr1_online, usr2_online : in std_logic; keyPressed : in std_logic; keyValid : out std_logic ); end entity keyValidator; architecture behavioral of keyValidator is signal high : std_logic; signal keyPressed_delay1, keyPressed_delay2, key : std_logic; begin high <= '1'; delay1 : dff_en port map ( resetn => resetn, clock => clock, enable => high, d => keyPressed, q => keyPressed_delay1 ); delay2 : dff_en port map ( resetn => resetn, clock => clock, enable => high, d => keyPressed_delay1, q => keyPressed_delay2 ); delays : process (resetn, keyPressed, keyPressed_delay2) is begin if resetn = '0' then key <= '0'; elsif keyPressed = '1' then key <= '1'; elsif keyPressed_delay2 = '1' then key <= '0'; else key <= key; end if; end process delays; keyValid <= (key and channel_status) and (usr1_online or usr2_online); end behavioral;