Skip to content

Instantly share code, notes, and snippets.

@fbegyn
Created November 8, 2017 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fbegyn/0c8fd8f20330425b116407dbaf718722 to your computer and use it in GitHub Desktop.
Save fbegyn/0c8fd8f20330425b116407dbaf718722 to your computer and use it in GitHub Desktop.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.ALL;
entity keyboard is
port(
clk : in std_ulogic;
one : in std_ulogic;
rst : in std_ulogic;
one_pressed : in std_ulogic
);
end;
architecture behavioral of keyboard is
signal one_latched : std_ulogic;
begin
process(clk,rst)
variable one_latched : std_ulogic;
begin
if rising_edge(clk) then
if one='1' then
one_latched := '1';
elsif one = '0' and one_latched = '1' then
one_latched := '0';
one_pressed <= '1';
end if;
elsif rst = '1' then
one_latched := '0';
one_pressed <= '0';
end if;
end process;
end architecture;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment