The document describes a project to implement multiplayer ping pong on a VGA display using VHDL. It was done by a student at Thapar University under the guidance of a project engineer. The project involved developing VHDL code to simulate the classic pong game on an FPGA board with a VGA connector. It describes generating the video signals, designing the paddles and ball to move and bounce, and a lab setup with additional game ideas like Breakout.
1 of 25
Download to read offline
More Related Content
final stuff
1. Copyright2013-2014
Multiplayer Ping-Pong On VGA Display Using VHDL
Submitted by:
Amritangshu
Roll no.101306020
BE-3rd Year
Thapar University
Patiala
Under the guidance of :
Ms Vemu Sulochana
Project engineer
CDAC
2. Copyright2013-2014
Wednesday, September 14,
THAPAR UNIVERSITY, PATIALA 2
VHDL implementation of the classic Pong game was the
first major task of the project.
The game Pong is one of the first complete, standalone
digital arcade games to reach mainstream popularity.
Pong, released in 1972, is a simple tennis-like game that
pits two players against each other on an almost-empty
screen.
A small, square ball bounces back and forth between
paddles controlled by two players, who attempt to bounce
it back at their opponent.
If either player fails to hit the ball (it goes off the edge of
their screen), that player loses the round, and their
opponent gets a point
The main objective of the project is to understand the
concept of Hardware Software co-design in system
design. The hardware platform used for this project was
Xilinx Spartan3 board.
INTRODUCTION
3. Copyright2013-2014
VGA
VGA is an analogue video standard
that is mostly used in personal computers. V
GA can also refer to a piece of display hardw
are developed by IBM (Video Graphics Array
) or a display mode, that uses 640 x 480 pixe
ls resolution.
VGA connector uses a total of 15 pins, but o
nly 5 signals are needed for operation:
HSYNC
horizontal synchronization signal.
VSYNC- vertical synchronization signal
RED red colour channel
GREEN green colour channel
BLUE blue colour channel
Wednesday, September 14,
THAPAR UNIVERSITY, PATIALA 3
4. Copyright2013-2014
Components of the program
Wednesday, September 14,
THAPAR UNIVERSITY, PATIALA 4
Main
Contains all the
components and their
definitions
Sync
module
Generates h sync and
v sync signals
Pixel
generation
module
Generates rgb signal
5. Copyright2013-2014
Sync module
This module will generate the horizontal sync and vertical sync
for VGA video. In addition, sync module also produce control
signals for the IMG GEN (image Generation) module
SYNC module has 3 inputs and 2 output signals. The following
shows the definition of these signals.
Input Signals
start: is used to activate/deactivate the module
clk: system clock
reset: is used to reset the module
Output Signals
H_S: Horizontal sync
V_S: Vertical sync
X_counter: output of a counter which placed in the sync module.
it counts from 0 to 639 (horizontal resolution of the VGA
Y_counter: output of a counter which placed in the sync module.
It counts from 0 to 479(vertical resolution of the VGA video )
Video_on: is used to enable/disable the video
Wednesday, September 14,
THAPAR UNIVERSITY, PATIALA 5
6. Copyright2013-2014
Horizontal synchronization
Wednesday, September 14,
THAPAR UNIVERSITY, PATIALA 6
The hsync signal can be obtained by
a special mod-800 counter and a
decoding circuit.
We intentionally start the counting
from the beginning of the display
region.
This allows us to use the counter
output as the horizontal (x-axis)
coordinate. This output constitutes
the pixel-x signal.
The hsync signal goes low when the
counters output is between 656
and 751.
8. Copyright2013-2014
Pixel generation module
The pixel generation circuit generates the 3-bit rgb signal for
the VGA port.
The external control and data signals specify the content of
the screen, and the pixel-x and pixel-y signals from the vga-
sync circuit provide the current coordinates of the pixel
Wednesday, September 14,
THAPAR UNIVERSITY, PATIALA 8
9. Copyright2013-2014
Design of the Paddle
Each paddle has a fixed X-coordinate on the screen, and the only thing
that will change is the Y-coordinate as the user moves the paddle up and
down.
The paddle module will take two one-bit inputs: U, telling the paddle to
move up, and D, to move down.
If the U input is 1, the paddle will move up by 4 (decrease Y by 4).
If the D input is 1, the paddle will move down by 4 (increase Y by 4).
If both are 1, the paddle should stay in position.
Wednesday, September 14,
THAPAR UNIVERSITY, PATIALA 9
10. Copyright2013-2014
Design of the ball
The ball will bounce back and forth from one players side to the other.
For the ball, we will track the current direction it is traveling in separate X
and Y-components, or its velocity.
We will store the velocity using two flip-flops, one for X and the other for Y.
One flip-flop will tell us whether the ball is moving in the positive-X direction
(1, right) or the negative-X direction (0, left), and the other will do the same
for Y (1 is down, 0 is up).
Wednesday, September 14,
THAPAR UNIVERSITY, PATIALA 10
11. Copyright2013-2014
Ball collisions
When the ball collides with a paddle or the border of the
screen, the ball will bounce away from the object it collides
with. This will be done by reversing direction away from the
collision.
Wednesday, September 14,
THAPAR UNIVERSITY, PATIALA 11
12. Copyright2013-2014
Animation of the ball
When an object changes its location gradually in each scan, it
creates the illusion of motion and becomes animated.
To achieve this, we can use registers to store the boundaries
of an object and update its value in each scan.
In the pong game, the paddle is controlled by two
pushbuttons and can move up and down, and the ball can
move and bounce in all directions.
Wednesday, September 14,
THAPAR UNIVERSITY, PATIALA 12
16. Copyright2013-2014
Additional projects
Breakout game
The breakout game is a somewhat like the pong game. In this game, the
left wall is replaced by several layers of bricks. When the ball hits a
brick, the ball bounces back and the brick disappears.
Wednesday, September 14,
THAPAR UNIVERSITY, PATIALA 16
17. Copyright2013-2014
Background colour options
Colour multiplexing circuit
This provides 9 colour options in multiplayer ping pong to change
the background of the screen through switches on the spartan 3.
Wednesday, September 14,
THAPAR UNIVERSITY, PATIALA 17
19. Copyright2013-2014
INTRODUCTION Vending
Machines are used to dispense
various products like Coffee,
Snacks, and Cold Drink etc. when
money is inserted into it.
Vending Machines have been in
existence since 1880s. The first
commercial coin operated
machine was introduced in
London and England used for
selling post cards.
The vending machines are more
accessible and practical than the
convention purchasing method