1 |
2 |
idiolatrie |
--------------------------------------------------------------------------------
|
2 |
|
|
-- PS2 Keyboard Controller - German Keyboard Layout --
|
3 |
|
|
--------------------------------------------------------------------------------
|
4 |
|
|
-- Copyright (C)2011 Mathias Hörtnagl <mathias.hoertnagl@gmail.comt> --
|
5 |
|
|
-- --
|
6 |
|
|
-- This program is free software: you can redistribute it and/or modify --
|
7 |
|
|
-- it under the terms of the GNU General Public License as published by --
|
8 |
|
|
-- the Free Software Foundation, either version 3 of the License, or --
|
9 |
|
|
-- (at your option) any later version. --
|
10 |
|
|
-- --
|
11 |
|
|
-- This program is distributed in the hope that it will be useful, --
|
12 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
|
13 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --
|
14 |
|
|
-- GNU General Public License for more details. --
|
15 |
|
|
-- --
|
16 |
|
|
-- You should have received a copy of the GNU General Public License --
|
17 |
|
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>. --
|
18 |
|
|
--------------------------------------------------------------------------------
|
19 |
|
|
library ieee;
|
20 |
|
|
use ieee.std_logic_1164.all;
|
21 |
|
|
use ieee.numeric_std.all;
|
22 |
|
|
|
23 |
|
|
entity ascii is
|
24 |
|
|
port(
|
25 |
|
|
clk : in std_logic;
|
26 |
|
|
shft : in std_logic;
|
27 |
|
|
altgr : in std_logic;
|
28 |
|
|
code : in std_logic_vector(7 downto 0);
|
29 |
|
|
char : out std_logic_vector(7 downto 0)
|
30 |
|
|
);
|
31 |
|
|
end ascii;
|
32 |
|
|
|
33 |
|
|
architecture rtl of ascii is
|
34 |
|
|
begin
|
35 |
|
|
conv : process(clk)
|
36 |
|
|
begin
|
37 |
|
|
if rising_edge(clk) then
|
38 |
|
|
case code is
|
39 |
|
|
--------------------------------------------------------------------
|
40 |
|
|
-- Keys that are independend of the state of SHFT and ALTGR. --
|
41 |
|
|
--------------------------------------------------------------------
|
42 |
|
|
when X"66" => char <= X"08"; -- BS (BACKSPACE)
|
43 |
|
|
when X"0d" => char <= X"09"; -- HT (TAB)
|
44 |
|
|
when X"5a" => char <= X"0d"; -- CR (ENTER)
|
45 |
|
|
when X"76" => char <= X"1b"; -- ESC (ESCAPE)
|
46 |
|
|
when X"29" => char <= X"20"; -- SP (SPACE)
|
47 |
|
|
when X"71" => char <= X"7f"; -- DEL (DELETE)
|
48 |
|
|
when X"7e" => char <= X"80"; -- SCROLL
|
49 |
|
|
when X"75" => char <= X"f0"; -- UP ARROW
|
50 |
|
|
when X"6b" => char <= X"f1"; -- LEFT ARROW
|
51 |
|
|
when X"72" => char <= X"f2"; -- DOWN ARROW
|
52 |
|
|
when X"74" => char <= X"f3"; -- RIGHT ARROW
|
53 |
|
|
--when X"" => char <= X""
|
54 |
|
|
|
55 |
|
|
when others =>
|
56 |
|
|
case (altgr & shft & code) is
|
57 |
|
|
--------------------------------------------------------------
|
58 |
|
|
-- SHFT and ALTGR not pressed. --
|
59 |
|
|
--------------------------------------------------------------
|
60 |
|
|
when "00" & X"0e" => char <= X"5e"; -- ^
|
61 |
|
|
when "00" & X"15" => char <= X"71"; -- q
|
62 |
|
|
when "00" & X"16" => char <= X"31"; -- 1
|
63 |
|
|
when "00" & X"1a" => char <= X"79"; -- y
|
64 |
|
|
when "00" & X"1b" => char <= X"73"; -- s
|
65 |
|
|
when "00" & X"1c" => char <= X"61"; -- a
|
66 |
|
|
when "00" & X"1d" => char <= X"77"; -- w
|
67 |
|
|
when "00" & X"1e" => char <= X"32"; -- 2
|
68 |
|
|
when "00" & X"21" => char <= X"63"; -- c
|
69 |
|
|
when "00" & X"22" => char <= X"78"; -- x
|
70 |
|
|
when "00" & X"23" => char <= X"64"; -- d
|
71 |
|
|
when "00" & X"24" => char <= X"65"; -- e
|
72 |
|
|
when "00" & X"25" => char <= X"34"; -- 4
|
73 |
|
|
when "00" & X"26" => char <= X"33"; -- 3
|
74 |
|
|
when "00" & X"2a" => char <= X"76"; -- v
|
75 |
|
|
when "00" & X"2b" => char <= X"66"; -- f
|
76 |
|
|
when "00" & X"2c" => char <= X"74"; -- t
|
77 |
|
|
when "00" & X"2d" => char <= X"72"; -- r
|
78 |
|
|
when "00" & X"2e" => char <= X"35"; -- 5
|
79 |
|
|
when "00" & X"31" => char <= X"6e"; -- n
|
80 |
|
|
when "00" & X"32" => char <= X"62"; -- b
|
81 |
|
|
when "00" & X"33" => char <= X"68"; -- h
|
82 |
|
|
when "00" & X"34" => char <= X"67"; -- g
|
83 |
|
|
when "00" & X"35" => char <= X"7a"; -- z
|
84 |
|
|
when "00" & X"36" => char <= X"36"; -- 6
|
85 |
|
|
when "00" & X"3a" => char <= X"6d"; -- m
|
86 |
|
|
when "00" & X"3b" => char <= X"6a"; -- j
|
87 |
|
|
when "00" & X"3c" => char <= X"75"; -- u
|
88 |
|
|
when "00" & X"3d" => char <= X"37"; -- 7
|
89 |
|
|
when "00" & X"3e" => char <= X"38"; -- 8
|
90 |
|
|
when "00" & X"41" => char <= X"2c"; -- ,
|
91 |
|
|
when "00" & X"42" => char <= X"6b"; -- k
|
92 |
|
|
when "00" & X"43" => char <= X"69"; -- i
|
93 |
|
|
when "00" & X"44" => char <= X"6f"; -- o
|
94 |
|
|
when "00" & X"45" => char <= X"30"; -- 0
|
95 |
|
|
when "00" & X"46" => char <= X"39"; -- 9
|
96 |
|
|
when "00" & X"49" => char <= X"2e"; -- .
|
97 |
|
|
when "00" & X"4a" => char <= X"2d"; -- -
|
98 |
|
|
when "00" & X"4b" => char <= X"6c"; -- l
|
99 |
|
|
when "00" & X"4d" => char <= X"70"; -- p
|
100 |
|
|
when "00" & X"5b" => char <= X"2b"; -- +
|
101 |
|
|
when "00" & X"5d" => char <= X"23"; -- #
|
102 |
|
|
when "00" & X"61" => char <= X"3c"; -- <
|
103 |
|
|
--------------------------------------------------------------
|
104 |
|
|
-- SHFT pressed. --
|
105 |
|
|
--------------------------------------------------------------
|
106 |
|
|
when "01" & X"15" => char <= X"51"; -- Q
|
107 |
|
|
when "01" & X"16" => char <= X"21"; -- !
|
108 |
|
|
when "01" & X"1a" => char <= X"59"; -- Y
|
109 |
|
|
when "01" & X"1b" => char <= X"53"; -- S
|
110 |
|
|
when "01" & X"1c" => char <= X"41"; -- A
|
111 |
|
|
when "01" & X"1d" => char <= X"57"; -- W
|
112 |
|
|
when "01" & X"1e" => char <= X"22"; -- "
|
113 |
|
|
when "01" & X"21" => char <= X"43"; -- C
|
114 |
|
|
when "01" & X"22" => char <= X"58"; -- X
|
115 |
|
|
when "01" & X"23" => char <= X"44"; -- D
|
116 |
|
|
when "01" & X"24" => char <= X"45"; -- E
|
117 |
|
|
when "01" & X"25" => char <= X"24"; -- $
|
118 |
|
|
when "01" & X"2a" => char <= X"56"; -- V
|
119 |
|
|
when "01" & X"2b" => char <= X"46"; -- F
|
120 |
|
|
when "01" & X"2c" => char <= X"54"; -- T
|
121 |
|
|
when "01" & X"2d" => char <= X"52"; -- R
|
122 |
|
|
when "01" & X"2e" => char <= X"25"; -- %
|
123 |
|
|
when "01" & X"31" => char <= X"4e"; -- N
|
124 |
|
|
when "01" & X"32" => char <= X"42"; -- B
|
125 |
|
|
when "01" & X"33" => char <= X"48"; -- H
|
126 |
|
|
when "01" & X"34" => char <= X"47"; -- G
|
127 |
|
|
when "01" & X"35" => char <= X"5a"; -- Z
|
128 |
|
|
when "01" & X"36" => char <= X"26"; -- &
|
129 |
|
|
when "01" & X"3a" => char <= X"4d"; -- M
|
130 |
|
|
when "01" & X"3b" => char <= X"4a"; -- J
|
131 |
|
|
when "01" & X"3c" => char <= X"55"; -- U
|
132 |
|
|
when "01" & X"3d" => char <= X"2f"; -- /
|
133 |
|
|
when "01" & X"3e" => char <= X"28"; -- (
|
134 |
|
|
when "01" & X"41" => char <= X"3b"; -- ;
|
135 |
|
|
when "01" & X"42" => char <= X"4b"; -- K
|
136 |
|
|
when "01" & X"43" => char <= X"49"; -- I
|
137 |
|
|
when "01" & X"44" => char <= X"4f"; -- O
|
138 |
|
|
when "01" & X"45" => char <= X"3d"; -- =
|
139 |
|
|
when "01" & X"46" => char <= X"29"; -- )
|
140 |
|
|
when "01" & X"49" => char <= X"3a"; -- :
|
141 |
|
|
when "01" & X"4a" => char <= X"5f"; -- _
|
142 |
|
|
when "01" & X"4b" => char <= X"4c"; -- L
|
143 |
|
|
when "01" & X"4d" => char <= X"50"; -- P
|
144 |
|
|
when "01" & X"4e" => char <= X"3f"; -- ?
|
145 |
|
|
when "01" & X"55" => char <= X"60"; -- `
|
146 |
|
|
when "01" & X"5b" => char <= X"2a"; -- *
|
147 |
|
|
when "01" & X"5d" => char <= X"27"; -- '
|
148 |
|
|
when "01" & X"61" => char <= X"3e"; -- >
|
149 |
|
|
--------------------------------------------------------------
|
150 |
|
|
-- ALTGR pressed. --
|
151 |
|
|
--------------------------------------------------------------
|
152 |
|
|
when "10" & X"15" => char <= X"40"; -- @
|
153 |
|
|
when "10" & X"3d" => char <= X"7b"; -- {
|
154 |
|
|
when "10" & X"3e" => char <= X"5b"; -- [
|
155 |
|
|
when "10" & X"45" => char <= X"7d"; -- }
|
156 |
|
|
when "10" & X"46" => char <= X"5d"; -- ]
|
157 |
|
|
when "10" & X"4e" => char <= X"5c"; -- \
|
158 |
|
|
when "10" & X"5b" => char <= X"7e"; -- ~
|
159 |
|
|
when "10" & X"61" => char <= X"7c"; -- |
|
160 |
|
|
--------------------------------------------------------------
|
161 |
|
|
-- SHFT and ALTGR pressed. --
|
162 |
|
|
--------------------------------------------------------------
|
163 |
|
|
--------------------------------------------------------------
|
164 |
|
|
-- Everything else returns the empty key X"00". --
|
165 |
|
|
--------------------------------------------------------------
|
166 |
|
|
when others => char <= X"00";
|
167 |
|
|
end case;
|
168 |
|
|
end case;
|
169 |
|
|
end if;
|
170 |
|
|
end process;
|
171 |
|
|
end rtl;
|