CDL Modules
input_devices.h
Go to the documentation of this file.
1 
22 /*a Key codes
23 The PS2 codes are:
24 
25 Extended:
26 //Prt Scr E012E07C
27 //Pause/Break E11477E1F014E077
28 
29 Alt (right) E011
30 Ctrl E014
31 Windows (right) E027
32 Menus E02F
33 KP/ E04A
34 KPEnter E05A
35 End E069
36 Left Arrow E06B
37 Home E06C
38 Insert E070
39 Delete E071
40 Down Arrow E072
41 Right Arrow E074
42 Up Arrow E075
43 Page Down E07A
44 Page Up E07D
45 Windows E01F
46 
47 01 F9
48 03 F5
49 04 F3
50 05 F1
51 06 F2
52 07 F12
53 09 F10
54 0A F8
55 0B F6
56 0C F4
57 0D Tab
58 0E `
59 11 Alt (left)
60 12 Shift
61 14 Ctrl
62 15 Q
63 16 1
64 1A Z
65 1B S
66 1C A
67 1D W
68 1E 2
69 21 C
70 22 X
71 23 D
72 24 E
73 25 4
74 26 3
75 29 Spacebar
76 2A V
77 2B F
78 2C T
79 2D R
80 2E 5
81 31 N
82 32 B
83 33 H
84 34 G
85 35 Y
86 36 6
87 3A M
88 3B J
89 3C U
90 3D 7
91 3E 8
92 41 ,
93 42 K
94 43 I
95 44 O
96 45 0
97 46 9
98 49 .
99 4A /
100 4B L
101 4C ;
102 4D P
103 4E -
104 52 '
105 54 [
106 55 =
107 58 Caps Lock
108 59 RtShift
109 5A Enter
110 5B ]
111 5D \
112 66 Backspace
113 69 KP1
114 6B KP4
115 6C KP7
116 70 KP0
117 71 KP.
118 72 KP2
119 73 KP5
120 74 KP6
121 75 KP8
122 76 ESC
123 77 Num Lock
124 78 F11
125 79 KP+
126 7A KP3
127 7B KP-
128 7C KP*
129 7D KP9
130 7E Scroll Lock
131 83 F7
132 
133  */
134 
135 /*a Types */
136 /*t t_ps2_pins */
137 typedef struct {
138  bit data;
139  bit clk;
140 } t_ps2_pins;
141 
142 /*t t_ps2_rx_data */
143 typedef struct {
144  bit valid;
145  bit[8] data;
148  bit timeout;
149 } t_ps2_rx_data;
150 
151 /*t t_ps2_key_state */
152 typedef struct {
153  bit valid;
154  bit extended;
155  bit release;
156  bit[8] key_number;
158 
159 /*a Modules */
160 /*m ps2_host */
161 extern module ps2_host( clock clk "Clock",
162  input bit reset_n,
163  input t_ps2_pins ps2_in "Pin values from the outside",
164  output t_ps2_pins ps2_out "Pin values to drive - 1 means float high, 0 means pull low",
165 
166  output t_ps2_rx_data ps2_rx_data,
167  input bit[16] divider
168  )
169 {
170  timing to rising clock clk ps2_in, divider;
171  timing from rising clock clk ps2_out, ps2_rx_data;
172 }
173 
174 /*m ps2_host_keyboard */
175 extern module ps2_host_keyboard( clock clk "Clock",
176  input bit reset_n,
177  input t_ps2_rx_data ps2_rx_data,
178  output t_ps2_key_state ps2_key
179  )
180 {
181  timing to rising clock clk ps2_rx_data;
182  timing from rising clock clk ps2_key;
183 }
184 
bit timeout
Definition: input_devices.h:148
bit data
Definition: input_devices.h:138
bit valid
Definition: input_devices.h:144
bit clk
Definition: input_devices.h:139
bit protocol_error
Definition: input_devices.h:147
bit[8] key_number
Definition: input_devices.h:156
bit parity_error
Definition: input_devices.h:146
Definition: input_devices.h:137
Definition: input_devices.h:152
bit release
Definition: input_devices.h:155
Definition: input_devices.h:143
bit valid
Definition: input_devices.h:153
bit[8] data
Definition: input_devices.h:145
module ps2_host(clock clk, input bit reset_n, input t_ps2_pins ps2_in, output t_ps2_pins ps2_out, output t_ps2_rx_data ps2_rx_data, input bit[16] divider)
Definition: input_devices.h:161
bit extended
Definition: input_devices.h:154
module ps2_host_keyboard(clock clk, input bit reset_n, input t_ps2_rx_data ps2_rx_data, output t_ps2_key_state ps2_key)
Definition: input_devices.h:175