final stuff
Post on 21-Apr-2017
81 Views
Preview:
TRANSCRIPT
Copy
right
201
3-20
14
Multiplayer Ping-Pong On VGA Display Using VHDL
Submitted by:Amritangshu
Roll no.101306020BE-3rd Year
Thapar UniversityPatiala
Under the guidance of : Ms Vemu Sulochana Project engineer
CDAC
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR 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 Spartan 3 board.
INTRODUCTION
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 3
VGA
• VGA is an analogue video standard that is mostly used in personal computers. VGA can also refer to a piece of display hardware developed by IBM (Video Graphics Array) or a display mode, that uses 640 x 480 pixels resolution. VGA connector uses a total of 15 pins, but only 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
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 4
Components of the program
MainContains all the
components and their definitions
Sync module
Generates h sync and v sync signals
Pixel generation
moduleGenerates rgb signal
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 5
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
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 6
Horizontal synchronization
• 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 counter’s output is between 656
and 751.
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 7
Vertical synchronization
• The vsync signal can be obtained by a special mod-525 counter and a decoding circuit.
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 8
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
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 9
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.
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 10
Design of the ball• The ball will bounce back and forth from one player’s 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).
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 11
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.
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 12
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.
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 13
Implimentation
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 14
Lab setup
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 15
Actual lab setup used
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 16
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.
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 17
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.
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 18
FSM based vending machine
Copy
right
201
3-20
14
• 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
Copy
right
201
3-20
14
Tuesday, May 2, 2023THAPAR UNIVERSITY, PATIALA 20
Copy
right
201
3-20
14
Case1 : snacks selected
Copy
right
201
3-20
14
Case2 : cofee selected
Copy
right
201
3-20
14
Case3 : cold drinks selected
Copy
right
201
3-20
14
Case4 : candy selected
Copy
right
201
3-20
14
Case5 : purchase cancel
top related