-
Notifications
You must be signed in to change notification settings - Fork 0
/
CharacterRom.vhd
99 lines (95 loc) · 1.87 KB
/
CharacterRom.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.NUMERIC_STD.ALL;
LIBRARY WORK;
USE WORK.PongPkg.ALL;
ENTITY CharacterRom IS
PORT (
i_Clk : IN STD_LOGIC;
i_Char_Select : IN INTEGER RANGE 0 TO c_SCORE_LIMIT;
i_Row_Select : IN INTEGER RANGE 0 TO c_SCORE_HEIGHT - 1;
o_Char_Row : OUT STD_LOGIC_VECTOR(c_SCORE_WIDTH - 1 DOWNTO 0)
);
END ENTITY;
ARCHITECTURE RTL OF CharacterRom IS
TYPE t_Rom IS ARRAY (0 TO c_SCORE_LIMIT, 0 TO c_SCORE_HEIGHT - 1) OF STD_LOGIC_VECTOR(c_SCORE_WIDTH - 1 DOWNTO 0);
CONSTANT c_CHAR_ROM : t_Rom := (
-- Number 0
( "111",
"101",
"101",
"101",
"111"
),
-- Number 1
( "010",
"110",
"010",
"010",
"111"
),
-- Number 2
( "111",
"001",
"111",
"100",
"111"
),
-- Number 3
( "111",
"001",
"111",
"001",
"111"
),
-- Number 4
( "101",
"101",
"111",
"001",
"001"
),
-- Number 5
( "111",
"100",
"111",
"001",
"111"
),
-- Number 6
( "111",
"100",
"111",
"101",
"111"
),
-- Number 7
( "111",
"001",
"001",
"001",
"001"
),
-- Number 8
( "111",
"101",
"111",
"101",
"111"
),
-- Number 9
( "111",
"101",
"111",
"001",
"111"
)
);
BEGIN
PROCESS(i_Clk)
BEGIN
IF (RISING_EDGE(i_Clk)) THEN
o_Char_Row <= c_CHAR_ROM(i_Char_Select, i_Row_Select);
END IF;
END PROCESS;
END ARCHITECTURE;