Created
November 8, 2017 14:08
-
-
Save fbegyn/0c8fd8f20330425b116407dbaf718722 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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