title: How to filter keyboard events?
body: <p>I'm writing an pong game vhdl code for spartan 3E starter kit. I want to control the game pad with my PS2 keyboard. For this i need to generate up and down signals from the keyboard received scan code.</p>
  
  <p>Here's sample code</p>
  
  <pre><code>   -- Instantiate key_board controller
      my_keyobard : entity work.ps2_key(Behavioral)
                      port map( ps2_clk =&gt; ps2_clk, ps2_data =&gt; ps2_data, clk =&gt; clk,
                      data_out =&gt; data);
  
     process(data)
     begin
            case data is
                   when X"15" =&gt; up &lt;= '1'; -- Q key for UP
                   when X"1C' =&gt; down &lt;= '1'; -- A key for DOWN
                   when others =&gt; up &lt;= '0'; down &lt;= '0';
            end case;
     end process;
  </code></pre>
  
  <p>But if I use this code the up key will remain '1' HIGH always, even after relesing the Q key on the keyboard. I want up signal to remain to high only till i hold the Q button down if I release it then up signal must return to '0'. <strong>Basically i want my keyboard keys to function like normal button. 
  If i press and hold then it must give HIGH signal else if released it must give LOW signal.</strong></p>