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.
Here's sample code
-- Instantiate key_board controller
my_keyobard : entity work.ps2_key(Behavioral)
port map( ps2_clk => ps2_clk, ps2_data => ps2_data, clk => clk,
data_out => data);
process(data)
begin
case data is
when X"15" => up <= '1'; -- Q key for UP
when X"1C' => down <= '1'; -- A key for DOWN
when others => up <= '0'; down <= '0';
end case;
end process;
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'. 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.
othersclauses are ignored by synthesis (usually, unless you tell them not to)Have you simulated - it should work fine in simulation the way you had it.