This project is a part of term project of Hardware Synthesis Laboratory 1/2023.
We created pong game that can play with 2 players in BASYS 3 board. The objective of this game is to get highest score as much as possible by passing a ball into opponent's goal. The graphic is shown in VGA and players can control using UART serial terminal.
- Players can control their paddle by using serial terminal.
- For player 1, player can control by pressing
W
for moving up andS
for moving down. - For player 2, player can control by pressing
I
for moving up andK
for moving down.
- For player 1, player can control by pressing
- The score for each player is in a range of 0 to 99. If score is exceed from 99, it will go back to 0.
- You can reset the game by pressing
btnC
(center button) in BASYS 3 board. The score of both players will be reset to 0. - Player can activate "Faster Ball" mode by toggling switch 0 (
sw[0]
) in BASYS 3 board. The ball's speed will be double. - Player can activate "Shorter Paddle" mode by toggling switch 1 (
sw[1]
) in BASYS 3 board. The paddle will be shorter by 33.33%.
RsRx
- For receiving data from UART interfacesw[0]
- For toggling “faster ball” modesw[1]
- For toggling “shorter paddle” modebtnC
- For resetting game
RsTx
- Echo data from received dataHsync
,Vsync
- For VGA outputvgaBlue
,vgaGreen
,vgaRed
- Graphic color for VGA outputan
,seg
,dp
- Showing score in 7-segment display
Module | Description |
---|---|
animation_gen.v | Generate graphic and animation in game that will show in VGA |
baudrate_gen.v | Generate baud rate for serial communication |
binToBCD.v | Convert 7-bit binary to 2 digits of BCD |
clockDivider.v | Divide clock frequency by 2 |
font_rom.v | ROM that stores text for mapping ASCII codes to 8x16 bits output |
game_clock.v | Generate game clock (20Hz) from 100MHz clock |
game_control.v | Logic circuit of game including paddle control, ball, and score |
sevenSegmentEncoder.v | Encode 4-bit binary to 7-segment output |
sevenSegmentTDM.v | Time-division multiplexing for seven segment display |
singlePulser.v | Create single pulse output |
system.v | Top-level system (connect game controller, UART, VGA, and seven segment together) |
uart.v | Top-level system of UART including receiver and transmitter |
uart_rx.v | UART receiver that receive input from serial terminal |
uart_tx.v | UART transmitter that echo data from receiver |
vga_sync.v | Synchronization circuit for VGA |