ECE448 Lecture8 VGA 2
ECE448 Lecture8 VGA 2
Lecture 8
VGA Display
Part 2
Required Reading
P. Chu, FPGA Prototyping by VHDL Examples
Chapter 12, VGA Controller I: Graphic
Chapter 13, VGA Controller II: Text
Source Codes of Examples
http://academic.csuohio.edu/chu_p/rtl/fpga_vhdl.html
Nexys3 Reference Manual
VGA Port, pages 15-17
ECE 448 FPGA and ASIC Design with VHDL
Animation
Animation Basics
Animation is achieved by an object changing
its location gradually in each frame
We use signals, instead of constants,
to determine boundaries of an object
VGA monitor is refreshed 60 times per second
The boundary signals need to be updated
at this rate
We create a 60 Hz enable tick, refr_tick, which
is asserted for 1 clock cycle every 1/60th of a second
ECE 448 FPGA and ASIC Design with VHDL
10
Ball Velocity
The ball may change direction by hitting the wall,
the paddle, or the bottom or top of the screen
We decompose velocity into an x-component
and a y-component
Each component can have either a positive value
BALL_V_P or a negative value BALL_V_N
The current value of each component is kept
in x_delta_reg and y_delta_reg
11
12
13
14
15
16
17
18
19
Vertical Synchronization
20
Text Generation
21
22
Font Pattern of A
23
24
25
rom_type:=(
-- 0
-- 1
-- 2
-- 3
-- 4
-- 5
-- 6
-- 7
-- 8
-- 9
-- a
-- b
-- c
-- d
-- e
-- f
-- 2^11-by-8
26
27
"00000000" -- f
);
begin
-- addr register to infer block RAM
process (clk)
begin
if (clk'event and clk = '1') then
addr_reg <= addr;
end if;
end process;
data <= ROM(to_integer(unsigned(addr_reg)));
end arch;
ECE 448 FPGA and ASIC Design with VHDL
28
29
[0..2047]
[0..79]
[0..7]
30
31
32
33
34
35
36
37
[0..7]
[0..2047]
[0..7]
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Text Subsystem
Score: DD Ball: D in a font scaled by a factor of 2
(16 by 32)
PONG logo in a font scaled by a factor of 8
(64 by 128)
The rule message in regular font (8 by 16), only
at the beginning of the game
The end-of-game message (Game Over)
in a font scaled by a factor of 4 (32 by 64)
ECE 448 FPGA and ASIC Design with VHDL
52
53
Auxiliary Counters
m100count is a two-digit BCD counter
counting from 00 to 99, used to keep track
of the score of the game
The timer module uses the 60 Hz tick, timer_tick,
to generate a 2-second interval.
Its purpose is to pause video for a small interval
between transitions of the screen.
54
ASM Chart
55
ASCII Code
56
57
Source Codes
of all Subsystems
58
59
60
61
62
63
64
65
66
67
68
ASCII Code
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
ASM Chart
100
101
102
103
104
105