Tetris |
This site hit
since March 29, 1999
Introduction
Our project is to design and implement a Tetris game by using FPGA. Tetris is a puzzle game that uses 4 square blocks joining edge to edge to form various combinations of shapes. There are 7 unique shapes. The shapes are controlled with the arrow keys from keypad or joystick. Both keypad and joystick are used to control the rotation of the shape. The reason we use both keypad and joystick as controller tool is that the players can have two options to control the game conveniently. However, we may use either keypad or joystick in our presentation to make the best effect.
Features
Our project consists of a VGA display, and keypad. The VGA monitor displays the graphic images to
the player. The VGA output simply displays shapes, scores, and status information. The user can
press the buttons on the keypad or move the joystick to play the game. The aim is to erase rows of
blocks. As the shape drops, each shape partially covers first to fourth rows. The rows are erased,
when enough shapes cover first to fourth rows. To stay in the game, the players have to erase rows
to make room for the dropping shape. Those are our basic features. Comparing with other Tetris
games, we just simplify the score so that the player can get one point for each dropping shape.
Addition options will be implemented when time allows. Those basic features that currently
implemented in the VHDL code are attached in the appendix. The codes include tetrisdemo, keypad,
count_xy, syncgen, synlatch, colorlatch, and tetris.
The top-level design code of the basic features is tetrisdemo. Tetrisdemo includes seven
components. They are keypad, count_xy, syncgen, synlatch, colorlatch, and tetris. Keypad component
is to decode user inputs from the keypad and send to tetris component. The tetris component is the
main game model. It controls the movement of the shape based on the keypad data and triggers the
color to display on the VGA monitor. It also registers how the shape forms at the bottom of game
area. The other components, count_xy, syncgen, synlatch, and colorlatch, are strongly related to
VGA display. Syncgen component is to send horizontal (vga_h_sync) and vertical (vga_v_sync)
synchronization to the VGA monitor. It also sends Hsync and Vsync to the count_xy component. Due to
the functional complexity of the VGA, we shall not discuss the nature of the signals. Count_xy
component is to use the two input signals from syncgen to generate CountX and CountY for tetris
component. CountX and CountY are the pixel position counters. The top-level design code of the
basic features is tetrisdemo. Tetrisdemo includes seven components. They are keypad, count_xy,
syncgen, synlatch, colorlatch, and tetris. Keypad component is to decode user inputs from the
keypad and send to tetris component. The tetris component is the main game model. It controls the
movement of the shape based on the keypad data.
Group Member
If you have any questions or concerns, you are welcome to reach Feng Gui, Tao Zhi Peng, and Khern Yang Twang.
Software
In our project, we use Altera Maxplus2 to build our system.
Total Logic Cell
Chip POF |
Device |
Input Pins |
Output Pins |
Bidir Pins |
Memory Bits |
Memory %Utilized |
LCs |
LCs %Utilized |
Tetrisdemo |
EPF10K20RC240-4 |
7 |
9 |
0 |
8570 |
91% |
564 |
49% |
Student Application Notes
Players have a choice for user input. They can choose either keypad or joystick.
Final Report
Please click on our final report for design detail.
Source Code
tetris.vhd
tetrisdemo.vhd
tetris.mif
tetris_set.mif
message.vhd
colorlatch.vhd
synlatch.vhd
count_xy.vhd
syncgen.vhd