1 |
99 |
davidgb |
--===========================================================================--
|
2 |
|
|
-- --
|
3 |
|
|
-- Synthesizable PS/2 Keyboard Key map ROM for Spartan3 --
|
4 |
|
|
-- --
|
5 |
|
|
--===========================================================================--
|
6 |
|
|
--
|
7 |
|
|
-- File name : keymap_rom2k_b16.vhd
|
8 |
|
|
--
|
9 |
|
|
-- Entity name : keymap_rom
|
10 |
|
|
--
|
11 |
|
|
-- Purpose : Key code look up table for PS/2 Keyboard
|
12 |
|
|
-- Converts 7 bit key code to ASCII
|
13 |
|
|
-- Address bit 8 = Shift
|
14 |
|
|
-- Address bit 7 = CAPS Lock
|
15 |
|
|
-- Address bits 6 - 0 = Key code
|
16 |
|
|
-- Data bits 6 - 0 = ASCII code
|
17 |
|
|
-- Intended for Spartan 3/3E
|
18 |
|
|
--
|
19 |
|
|
-- Dependencies : ieee.std_logic_1164
|
20 |
|
|
-- ieee.std_logic_arith
|
21 |
|
|
-- unisim.vcomponents
|
22 |
|
|
--
|
23 |
|
|
-- Uses : RAMB16_S9
|
24 |
|
|
--
|
25 |
|
|
-- Author : John E. Kent
|
26 |
|
|
--
|
27 |
|
|
-- Email : dilbert57@opencores.org
|
28 |
|
|
--
|
29 |
|
|
-- Web : http://opencores.org/project,system09
|
30 |
|
|
--
|
31 |
|
|
-- Copyright (C) 2004 - 2010 John Kent
|
32 |
|
|
--
|
33 |
|
|
-- This program is free software: you can redistribute it and/or modify
|
34 |
|
|
-- it under the terms of the GNU General Public License as published by
|
35 |
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
36 |
|
|
-- (at your option) any later version.
|
37 |
|
|
--
|
38 |
|
|
-- This program is distributed in the hope that it will be useful,
|
39 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
40 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
41 |
|
|
-- GNU General Public License for more details.
|
42 |
|
|
--
|
43 |
|
|
-- You should have received a copy of the GNU General Public License
|
44 |
|
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
45 |
|
|
--
|
46 |
|
|
--===========================================================================--
|
47 |
|
|
-- --
|
48 |
|
|
-- Revision History --
|
49 |
|
|
-- --
|
50 |
|
|
--===========================================================================--
|
51 |
|
|
--
|
52 |
|
|
-- Version Date Author Changes
|
53 |
|
|
--
|
54 |
|
|
-- 0.1 ????-??-?? John Kent Initial version
|
55 |
|
|
-- 0.2 2010-06-17 John Kent Revised Header, renamed data pins
|
56 |
|
|
--
|
57 |
|
|
|
58 |
19 |
dilbert57 |
library IEEE;
|
59 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
60 |
|
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
61 |
|
|
library unisim;
|
62 |
|
|
use unisim.vcomponents.all;
|
63 |
|
|
|
64 |
99 |
davidgb |
entity keymap_rom is
|
65 |
19 |
dilbert57 |
Port (
|
66 |
99 |
davidgb |
clk : in std_logic;
|
67 |
|
|
rst : in std_logic;
|
68 |
|
|
cs : in std_logic;
|
69 |
|
|
rw : in std_logic;
|
70 |
|
|
addr : in std_logic_vector (8 downto 0);
|
71 |
|
|
data_in : in std_logic_vector (7 downto 0);
|
72 |
|
|
data_out : out std_logic_vector (7 downto 0)
|
73 |
19 |
dilbert57 |
);
|
74 |
99 |
davidgb |
end keymap_rom;
|
75 |
19 |
dilbert57 |
|
76 |
99 |
davidgb |
architecture rtl of keymap_rom is
|
77 |
19 |
dilbert57 |
|
78 |
|
|
|
79 |
|
|
signal we : std_logic;
|
80 |
|
|
signal dp : std_logic;
|
81 |
99 |
davidgb |
signal ad : std_logic_vector(10 downto 0);
|
82 |
19 |
dilbert57 |
|
83 |
|
|
begin
|
84 |
|
|
|
85 |
|
|
ROM : RAMB16_S9
|
86 |
|
|
generic map (
|
87 |
|
|
INIT_00 => x"00327761737a0000003171000000000000600900000000000000000000000000",
|
88 |
|
|
INIT_01 => x"003837756a6d00000036796768626e0000357274667620000033346564786300",
|
89 |
|
|
INIT_02 => x"00005c005d0d000000003d5b00270000002d703b6c2f2e000039306f696b2c00",
|
90 |
|
|
INIT_03 => x"0000000000000000001b000000007f0000000000000000000008000000000000",
|
91 |
|
|
INIT_04 => x"00121701131a0000001111000000000000000900000000000000000000000000",
|
92 |
|
|
INIT_05 => x"001817150a0d00000016190708020e0000151214061600000013140504180300",
|
93 |
|
|
INIT_06 => x"00001c001d0d000000001d1b00070000000d101b0c0f0e000019100f090b0c00",
|
94 |
|
|
INIT_07 => x"0000000000000000001b000000001f0000000000000000000008000000000000",
|
95 |
|
|
INIT_08 => x"00405741535a00000021510000000000007e0900000000000000000000000000",
|
96 |
|
|
INIT_09 => x"002a26554a4d0000005e594748424e0000255254465620000023244544584300",
|
97 |
|
|
INIT_0A => x"00007c007d0d000000002b7b00220000005f503a4c3f3e000028294f494b3c00",
|
98 |
|
|
INIT_0B => x"0000000000000000001b000000007f0000000000000000000008000000000000",
|
99 |
|
|
INIT_0C => x"00001701131a00000001110000000000001e0900000000000000000000000000",
|
100 |
|
|
INIT_0D => x"000a06150a0d0000001e190708020e0000051214061600000003040504180300",
|
101 |
|
|
INIT_0E => x"00001c001d0d000000001d1b00020000001f101a0c1f1e000008090f090b1c00",
|
102 |
|
|
INIT_0F => x"0000000000000000001b000000001f0000000000000000000008000000000000",
|
103 |
|
|
INIT_10 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
104 |
|
|
INIT_11 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
105 |
|
|
INIT_12 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
106 |
|
|
INIT_13 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
107 |
|
|
INIT_14 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
108 |
|
|
INIT_15 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
109 |
|
|
INIT_16 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
110 |
|
|
INIT_17 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
111 |
|
|
INIT_18 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
112 |
|
|
INIT_19 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
113 |
|
|
INIT_1A => x"0000000000000000000000000000000000000000000000000000000000000000",
|
114 |
|
|
INIT_1B => x"0000000000000000000000000000000000000000000000000000000000000000",
|
115 |
|
|
INIT_1C => x"0000000000000000000000000000000000000000000000000000000000000000",
|
116 |
|
|
INIT_1D => x"0000000000000000000000000000000000000000000000000000000000000000",
|
117 |
|
|
INIT_1E => x"0000000000000000000000000000000000000000000000000000000000000000",
|
118 |
|
|
INIT_1F => x"0000000000000000000000000000000000000000000000000000000000000000",
|
119 |
|
|
INIT_20 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
120 |
|
|
INIT_21 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
121 |
|
|
INIT_22 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
122 |
|
|
INIT_23 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
123 |
|
|
INIT_24 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
124 |
|
|
INIT_25 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
125 |
|
|
INIT_26 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
126 |
|
|
INIT_27 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
127 |
|
|
INIT_28 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
128 |
|
|
INIT_29 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
129 |
|
|
INIT_2A => x"0000000000000000000000000000000000000000000000000000000000000000",
|
130 |
|
|
INIT_2B => x"0000000000000000000000000000000000000000000000000000000000000000",
|
131 |
|
|
INIT_2C => x"0000000000000000000000000000000000000000000000000000000000000000",
|
132 |
|
|
INIT_2D => x"0000000000000000000000000000000000000000000000000000000000000000",
|
133 |
|
|
INIT_2E => x"0000000000000000000000000000000000000000000000000000000000000000",
|
134 |
|
|
INIT_2F => x"0000000000000000000000000000000000000000000000000000000000000000",
|
135 |
|
|
INIT_30 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
136 |
|
|
INIT_31 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
137 |
|
|
INIT_32 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
138 |
|
|
INIT_33 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
139 |
|
|
INIT_34 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
140 |
|
|
INIT_35 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
141 |
|
|
INIT_36 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
142 |
|
|
INIT_37 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
143 |
|
|
INIT_38 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
144 |
|
|
INIT_39 => x"0000000000000000000000000000000000000000000000000000000000000000",
|
145 |
|
|
INIT_3A => x"0000000000000000000000000000000000000000000000000000000000000000",
|
146 |
|
|
INIT_3B => x"0000000000000000000000000000000000000000000000000000000000000000",
|
147 |
|
|
INIT_3C => x"0000000000000000000000000000000000000000000000000000000000000000",
|
148 |
|
|
INIT_3D => x"0000000000000000000000000000000000000000000000000000000000000000",
|
149 |
|
|
INIT_3E => x"0000000000000000000000000000000000000000000000000000000000000000",
|
150 |
|
|
INIT_3F => x"0000000000000000000000000000000000000000000000000000000000000000"
|
151 |
|
|
)
|
152 |
|
|
|
153 |
|
|
port map (
|
154 |
99 |
davidgb |
do => data_out,
|
155 |
19 |
dilbert57 |
dop(0) => dp,
|
156 |
99 |
davidgb |
addr => ad,
|
157 |
19 |
dilbert57 |
clk => clk,
|
158 |
99 |
davidgb |
di => data_in,
|
159 |
19 |
dilbert57 |
dip(0) => dp,
|
160 |
|
|
en => cs,
|
161 |
|
|
ssr => rst,
|
162 |
|
|
we => we
|
163 |
|
|
);
|
164 |
|
|
|
165 |
99 |
davidgb |
my_keymap_rom_b16 : process ( rw, addr )
|
166 |
19 |
dilbert57 |
begin
|
167 |
99 |
davidgb |
we <= not rw;
|
168 |
|
|
ad(8 downto 0) = addr;
|
169 |
|
|
ad(10 downto 9) = "00";
|
170 |
19 |
dilbert57 |
end process;
|
171 |
|
|
|
172 |
|
|
end architecture rtl;
|
173 |
|
|
|