1 |
99 |
davidgb |
--===========================================================================--
|
2 |
|
|
-- --
|
3 |
|
|
-- Synthesizable PS/2 Keyboard Key map ROM --
|
4 |
|
|
-- --
|
5 |
|
|
--===========================================================================--
|
6 |
19 |
dilbert57 |
--
|
7 |
99 |
davidgb |
-- File name : keymap_rom_slice.vhd
|
8 |
|
|
--
|
9 |
|
|
-- Entity name : keymap_rom
|
10 |
19 |
dilbert57 |
--
|
11 |
99 |
davidgb |
-- Purpose : PS/2 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 |
|
|
-- Using constant array look up.
|
18 |
|
|
--
|
19 |
|
|
-- Dependencies : ieee.std_logic_1164
|
20 |
|
|
-- ieee.std_logic_arith
|
21 |
|
|
-- ieee.std_logic_unsigned
|
22 |
|
|
--
|
23 |
|
|
-- Uses : None
|
24 |
19 |
dilbert57 |
--
|
25 |
99 |
davidgb |
-- 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 2004-10-18 John Kent Initial version
|
55 |
|
|
--
|
56 |
|
|
-- 0.2 2007-01-28 John Kent Made entity compatible with block RAM versions
|
57 |
|
|
--
|
58 |
|
|
-- 0.3 2007-02-03 John Kent Initialized with bit_vector
|
59 |
|
|
--
|
60 |
|
|
-- 0.4 2010-06-17 John Kent Updated header and added GPL
|
61 |
|
|
-- Renamed data_in and data_out signals
|
62 |
|
|
--
|
63 |
|
|
--
|
64 |
19 |
dilbert57 |
library IEEE;
|
65 |
|
|
use ieee.std_logic_1164.all;
|
66 |
|
|
use ieee.std_logic_arith.all;
|
67 |
|
|
use ieee.std_logic_unsigned.all;
|
68 |
|
|
|
69 |
|
|
entity keymap_rom is
|
70 |
|
|
Port (
|
71 |
99 |
davidgb |
clk : in std_logic;
|
72 |
|
|
rst : in std_logic;
|
73 |
|
|
cs : in std_logic;
|
74 |
|
|
rw : in std_logic;
|
75 |
|
|
addr : in std_logic_vector (8 downto 0);
|
76 |
|
|
data_in : in std_logic_vector (7 downto 0);
|
77 |
|
|
data_out : out std_logic_vector (7 downto 0)
|
78 |
19 |
dilbert57 |
);
|
79 |
|
|
end keymap_rom;
|
80 |
|
|
|
81 |
|
|
architecture rtl of keymap_rom is
|
82 |
99 |
davidgb |
|
83 |
19 |
dilbert57 |
type rom_array is array(0 to 15) of std_logic_vector (255 downto 0);
|
84 |
99 |
davidgb |
|
85 |
19 |
dilbert57 |
constant rom_data : rom_array :=
|
86 |
|
|
(
|
87 |
|
|
x"00327761737a0000003171000000000000600900000000000000000000000000", -- 1F - 00
|
88 |
|
|
x"003837756a6d00000036796768626e0000357274667620000033346564786300", -- 3F - 20
|
89 |
|
|
x"00005c005d0d000000003d5b00270000002d703b6c2f2e000039306f696b2c00", -- 5F - 40
|
90 |
|
|
x"0000000000000000001b000000007f0000000000000000000008000000000000", -- 7F - 60
|
91 |
|
|
|
92 |
|
|
x"00325741535a00000031510000000000007e0900000000000000000000000000", -- 9F - 80
|
93 |
|
|
x"003837554a4d00000036594748424e0000355254465620000033344544584300", -- BF - A0
|
94 |
|
|
x"00005c005d0d000000003d5b00270000002d503b4c2f2e000039304f494b2c00", -- DF - C0
|
95 |
|
|
x"0000000000000000001b000000007f0000000000000000000008000000000000", -- FF - E0
|
96 |
|
|
|
97 |
|
|
x"00405741535a00000021510000000000007e0900000000000000000000000000", -- 1F - 00
|
98 |
|
|
x"002a26554a4d0000005e594748424e0000255254465620000023244544584300", -- 3F - 20
|
99 |
|
|
x"00007c007d0d000000002b7b00220000005f503a4c3f3e000028294f494b3c00", -- 5F - 40
|
100 |
|
|
x"0000000000000000001b000000007f0000000000000000000008000000000000", -- 7F - 60
|
101 |
|
|
|
102 |
|
|
x"00407761737a0000002171000000000000600900000000000000000000000000", -- 9F - 80
|
103 |
|
|
x"002a26756a6d0000005e796768626e0000257274667620000023246564786300", -- BF - A0
|
104 |
|
|
x"00007c007d0d000000002b7b00220000005f703a6c3f3e000028296f696b3c00", -- DF - C0
|
105 |
|
|
x"0000000000000000001b000000007f0000000000000000000008000000000000" -- FF - E0
|
106 |
|
|
);
|
107 |
99 |
davidgb |
|
108 |
|
|
signal rom_out : std_logic_vector(255 downto 0);
|
109 |
|
|
|
110 |
19 |
dilbert57 |
begin
|
111 |
99 |
davidgb |
|
112 |
118 |
dilbert57 |
process( addr, rom_out )
|
113 |
99 |
davidgb |
begin
|
114 |
|
|
rom_out <= rom_data(conv_integer(addr(8 downto 5)));
|
115 |
|
|
data_out <= rom_out( conv_integer(addr(4 downto 0))*8+7 downto conv_integer(addr(4 downto 0))*8);
|
116 |
118 |
dilbert57 |
end process;
|
117 |
99 |
davidgb |
|
118 |
19 |
dilbert57 |
end architecture rtl;
|
119 |
|
|
|