OpenCores
URL https://opencores.org/ocsvn/keyboardcontroller/keyboardcontroller/trunk

Subversion Repositories keyboardcontroller

[/] [keyboardcontroller/] [trunk/] [Constants.vhd] - Blame information for rev 8

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wouterw
library ieee;
2
use ieee.std_logic_1164.all;
3
 
4
library work;
5
 
6
package Constants is
7
 
8
 
9
        constant number_of_rows : natural := 6;
10
        constant number_of_cols : natural  := 12;
11
        constant scancode_width : natural  := 8;
12
        constant max_keys_pressed : natural  := 3;
13
 
14
        constant number_of_keys : natural  := number_of_rows * number_of_cols;
15
 
16
        -- internal clock of 50 Mhz divided by 512 gives about 100 kHz, 1 clock-cycle is about 10 us
17
        -- 100 ticks is about 1 ms.
18
        constant debounce_count : natural  := 100;
19
 
20
        subtype row is std_logic_vector(number_of_cols-1 downto 0);
21
        subtype col is std_logic_vector(number_of_rows-1 downto 0);
22
 
23
        --3 bits
24
        subtype col_number is natural range 0 to number_of_rows-1;
25
        --4 bits
26
        subtype row_number is natural range 0 to number_of_cols-1;
27
        --number of keys pressed
28
        subtype key_number is natural range 0 to max_keys_pressed ;
29
 
30
 
31
        subtype states is std_logic_vector(6 downto 0);
32
 
33
    --last bit is to differentiate between idle and storing_stage2
34
        --output-lines : strobe, sample, analyse, store, produce, release
35
        constant idle : states := "0000000";
36
        constant strobing : states := "1000000";
37
        constant sampling : states := "0100000";
38
        constant analysing : states := "0110000";
39
        constant storing : states := "0001000";
40
        constant storing_stage2 : states := "0000001";
41
        constant producenormal : states := "0000100";
42
        constant producerelease : states := "0000110";
43
 
44
 
45
        type keymap is array (number_of_rows-1 downto 0) of row;
46
 
47
        subtype scancode is std_logic_vector(scancode_width-1 downto 0);
48
        -- we need 4 bits to encode the columns and 3 bits for the rows, gives an address of 7 bits
49
        -- that makes 128 possibilities of which 70 are used 
50
        type set1_scancodes_lut_type is array (0 to 93) of std_logic_vector(scancode_width-1 downto 0);
51
        constant set1_scancodes_lut : set1_scancodes_lut_type :=
52
        (0 => X"01", --esc
53
        1 => X"10", --q
54
        2 => X"1e", --a
55
        3 => X"2a", --lshi
56
        4 => X"33", --,<
57
        5 => X"1d", --ctrl
58
 
59
        8 => X"3b", --f1
60
        9 => X"11", --w
61
        10 => X"1f", --s
62
        11 => X"2c", --z
63
        12 => X"1c", --enter
64
        13 => X"38", --alt
65
 
66
        16 => X"3c", --f2
67
        17 => X"12", --e
68
        18 => X"20", --d
69
        19 => X"2d", --x
70
        20 => X"48", --up
71
        21 => X"39", --space
72
 
73
        24 => X"3d", --f3
74
        25 => X"13", --r
75
        26 => X"21", --f
76
        27 => X"2e", --c
77
        28 => X"50", --down
78
 
79
        32 => X"3e", --f4
80
        33 => X"14", --t
81
        34 => X"22", --g
82
        35 => X"2f", --v
83
        36 => X"4b", --left
84
 
85
        40 => X"3f", --f5
86
        41 => X"15", --y
87
        42 => X"23", --h
88
        43 => X"30", --b
89
        44 => X"4d", --right
90
        45 => X"39", --space
91
 
92
        48 => X"28", --'"
93
        49 => X"16", --u
94
        50 => X"24", --j
95
        51 => X"31", --n
96
        53 => X"0f", --tab
97
 
98
        56 => X"1a", --[{
99
        57 => X"17", --i
100
        58 => X"25", --k
101
        59 => X"32", --m
102
        60 => X"34", --.>
103
        61 => X"3a", --caps
104
 
105
        64 => X"1b", --]}
106
        65 => X"18", --o
107
        66 => X"26", --l
108
        67 => X"36", --rshi
109
        68 => X"0e", --backspace
110
        69 => X"27", --;:
111
 
112
        72 => X"0c", ---_
113
        73 => X"19", --p
114
        74 => X"08", --7&
115
        75 => X"05", --4$
116
        76 => X"52", --ins
117
        77 => X"02", --1!
118
 
119
        80 => X"0d", --=+
120
        81 => X"29", --`~
121
        82 => X"09", --8*
122
        83 => X"06", --5%
123
        84 => X"0b", --0)
124
        85 => X"03", --2@
125
 
126
        88 => X"2b", --\|
127
        89 => X"35", --/?
128
        90 => X"0a", --9(
129
        91 => X"07", --6^
130
        92 => X"53", --del
131
        93 => X"04", --3#
132
 
133
        others => X"00" --error
134
        );
135
 
136
 
137
end Constants;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.