View difference between Paste ID: BSefSPfk and
SHOW: | | - or go back to the newest paste.
1-
1+
library IEEE;
2
use IEEE.STD_LOGIC_1164.ALL;
3
use IEEE.STD_LOGIC_ARITH.ALL;
4
use IEEE.STD_LOGIC_UNSIGNED.ALL;
5
6
entity KBD_decode is
7
    Port ( clk : in STD_LOGIC;
8
	  DataIn : in  STD_LOGIC_VECTOR (7 downto 0);
9
           Enable : in  STD_LOGIC;
10
           DataOut : out  STD_LOGIC_VECTOR (15 downto 0));
11
end KBD_decode;
12
13
architecture Behavioral of KBD_decode is
14
15
signal reg : std_logic_vector (15 downto 0);
16
signal temp : std_logic_vector(3 downto 0);
17
signal checkf0 : std_logic_vector(7 downto 0);
18
signal keyrealase : std_logic;
19
begin
20
21
checkf0 <= DataIn when rising_edge(clk) and enable = '1';
22
23
with DataIn select 
24
temp <=  '1' & x"0" when x"45",
25
			'1' &	x"1" when x"16",
26
			'1' & x"2" when x"1E",
27
			'1' & x"3" when x"26",
28
			'1' & x"4" when x"25",
29
			'1' & x"5" when x"2E",
30
			'1' & x"6" when x"36",
31
			'1' & x"7" when x"3D",
32
			'1' & x"8" when x"3E",
33
			'1' & x"9" when x"49",
34
			'1' & x"A" when x"1C",
35
			'1' & x"B" when x"32",
36
			'1' & x"C" when x"21",
37
			'1' & x"D" when x"23",
38
			'1' & x"E" when x"24",
39
			'1' & x"F" when x"2B",
40
			'0' & "----" when others;
41
42
		process (clk, Enable,F0,E0,DataIn,reg)
43
		begin
44
					if rising_edge(clk) then
45
						if Enable = '1' then
46
									if checkf0 = x"f0" then
47
										reg <= reg(15 downto 4) & temp;
48
									end if;
49
						end if;
50
					end if;
51
		end process;
52
		
53
		DataOut <= reg;
54
55
		
56
57
58
end Behavioral;