The objective of this project is to a game called “tank duel” that could be displayed on the VGA monitor and controlled by two players by one PS2 keyboard.
The tanks are realized as square boxes on the VGA monitor. They keep continuously moving back and forth on a horizontal line on the screen. Each tank can move with three different speeds. The direction of the tanks can be controlled using left and right keys. Both tanks shoot one bullet at a time; if it hits the opponent’s tank, it scores one point. A tank can shoot the second bullet only when the previous bullet goes out of the screen or hits the opponent. The score of both players is displayed on the LEDs. Whoever first scores 3 points wins. When a player wins, only the winner’s tank is displayed and the winner message is displayed in the LCD screen. The game resets on pressing the reset button.
– Two square shaped tanks facing each other on VGA screen with different colors (red and green). One tank appears on the top of the screen and the other appears on the bottom.
– Both tanks continuously move back and forth on a horizontal line on the screen. The directions of the tanks can be changed by pressing a button on the keyboard.
– Both tanks have 3 different moving speeds that are adjusted by keyboard inputs by the player.
-Both tanks shoot one bullet at a time; if it hits the opponent’s tank, it scores one point. A tank can shoot the second bullet only when the previous bullet goes out of the screen or hits the opponent.
– The score of both players are displayed on the 7-segment display. Whoever first scores 3 points wins.
-When one player reaches three points: Only the winner’s tank is displayed on the screen. A message declaring the winner should print out on the 16X2 screen.
– There is a reset button to resart the game
1. VGA Monitor
2. PS/2 Keyboard
3. 16X2 LCD Display (On Board)
4. 7-Segment Display (On Board)
5. Push Button and LEDs (On board)
The project was designed and developed on the ALTERA DE-2 FPGA board. The coding was done using VHDL. The details of the entities are as follows:
VGA_top_level: This is the top level entity that structurally connects the VGA, LED and LCD components that display the output.
lcd : The lcd component maps de2lcd component and displays the winner message based on a_win and b_win values.
leddcd: This component decodes the hexadecimal score into seven-segment display for both the tanks.
pixelGenerator : The provided pixelGenerator component was modified to map ps2 component to read keyboard press values, decode them accordingly and make changes in the pixel values sent to the VGA control. To indentify keyboard values, scan_readyo, scan_code and hist1 signals were compared. As the clock speed is too high for human eye perception, counters were used to reduce the speed at which the bullet moves.
procedure: MY package was used to store two procedures SQ and SQ_B that display the tanks and bullet respectively.