aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-02-14 18:47:20 +0100
committerlonkaars <loek@pipeframe.xyz>2023-02-14 18:47:20 +0100
commitc1d77b6b9225dd242fd8472da6149f9399345bfe (patch)
tree0cac5247b33acb1a8f833c6237064bda7932eeb1 /src
parent060325a4a68ac0da58a2d17e5dbb5c36b68300f4 (diff)
merge #1
Diffstat (limited to 'src')
-rw-r--r--src/dispshift.vhd26
-rw-r--r--src/scancodefilter.vhd64
2 files changed, 85 insertions, 5 deletions
diff --git a/src/dispshift.vhd b/src/dispshift.vhd
index 5669641..4c4093b 100644
--- a/src/dispshift.vhd
+++ b/src/dispshift.vhd
@@ -11,7 +11,29 @@ end dispshift;
architecture Behavioral of dispshift is
-begin
-
+-- init as empty display
+signal sD: std_logic_vector(11 downto 0) := x"aaa";
+signal SLastValue: std_logic := '0';
+begin
+ process(CLK)
+ begin
+ if (rising_edge (clk)) then
+ -- set default values
+ SLastValue <= S;
+ sD <= sD;
+
+ -- when S does go high update output
+ if (SLastValue = '0' and S = '1') then
+ -- set data on output
+ N3 <= sD(11 downto 8);
+ N2 <= sD(7 downto 4);
+ N1 <= sD(3 downto 0);
+ N0 <= D;
+
+ -- store new data
+ sD <= sD(7 downto 0) & D;
+ end if;
+ end if;
+ end process;
end Behavioral;
diff --git a/src/scancodefilter.vhd b/src/scancodefilter.vhd
index 518c3aa..dbdf7b7 100644
--- a/src/scancodefilter.vhd
+++ b/src/scancodefilter.vhd
@@ -1,6 +1,6 @@
library ieee;
use ieee.std_logic_1164.all;
---use ieee.numeric_std.all;
+use ieee.numeric_std.all;
entity scancodefilter is port(
CLK: in std_logic; -- system clock
@@ -12,7 +12,65 @@ end scancodefilter;
architecture Behavioral of scancodefilter is
-begin
-
+-- init as empty key
+--signal lastKey: std_logic_vector(3 downto 0) := x"a";
+signal lastNEW_DAT: std_logic := '0';
+signal DAT_OLD: std_logic_vector(7 downto 0); -- scancode preveouse input
+begin
+ process(CLK)
+ begin
+ if (rising_edge (clk)) then
+ -- always set data on output
+ BCD <= x"a";
+ SHIFT <= '0';
+ lastNEW_DAT <= NEW_DAT;
+ DAT_OLD <= DAT_OLD;
+
+ -- when NEW_DAT does go high
+ if ((lastNEW_DAT = '0') and (NEW_DAT = '1')) then
+ -- set DAT_OLD
+ DAT_OLD <= DAT;
+
+ -- only is pervioause data is not release of key scancode and currend data
+ if (DAT_OLD /= x"F0" and DAT /= x"F0") then
+ case DAT is
+ when x"45" =>
+ BCD <= std_logic_vector(to_unsigned(0, BCD'length));
+ SHIFT <= '1';
+ when x"16" =>
+ BCD <= std_logic_vector(to_unsigned(1, BCD'length));
+ SHIFT <= '1';
+ when x"1E" =>
+ BCD <= std_logic_vector(to_unsigned(2, BCD'length));
+ SHIFT <= '1';
+ when x"26" =>
+ BCD <= std_logic_vector(to_unsigned(3, BCD'length));
+ SHIFT <= '1';
+ when x"25" =>
+ BCD <= std_logic_vector(to_unsigned(4, BCD'length));
+ SHIFT <= '1';
+ when x"2E" =>
+ BCD <= std_logic_vector(to_unsigned(5, BCD'length));
+ SHIFT <= '1';
+ when x"36" =>
+ BCD <= std_logic_vector(to_unsigned(6, BCD'length));
+ SHIFT <= '1';
+ when x"3D" =>
+ BCD <= std_logic_vector(to_unsigned(7, BCD'length));
+ SHIFT <= '1';
+ when x"3E" =>
+ BCD <= std_logic_vector(to_unsigned(8, BCD'length));
+ SHIFT <= '1';
+ when x"46" =>
+ BCD <= std_logic_vector(to_unsigned(9, BCD'length));
+ SHIFT <= '1';
+ when others =>
+ BCD <= x"b";
+ SHIFT <= '1';
+ end case;
+ end if;
+ end if;
+ end if;
+ end process;
end Behavioral;