Pong on Assembly
Interactive Pong on FPGA (Duke ECE 550). Hardware VGA/PS2 implementation plus full assembly version (pong.s) for custom 32-bit processor ISA.
View on GitHub →Overview
Fully interactive Pong on FPGA: game logic runs in the VGA controller with PS/2 keyboard (W/S/O/L); the processor is a stub. The repo also includes pong.s, a full assembly version for the custom ISA with MMIO at 2000 (keyboard) and 3000–3003 (ball/paddles).
Description
Hardware implementation
vga_controller.v holds game state in registers: ball position and direction, paddle Y positions, and scores. Tunable parameters include BALL_SIZE=10, PADDLE_H=40, BALL_SPEED=3, PADDLE_SPEED=4. On each vertical sync (cVS) edge, the controller updates paddles from keyboard inputs (W/S left, O/L right, clamped to the play area), advances the ball, handles wall bounce and paddle collision, and applies scoring (ball past paddle resets position; first to 5 wins and freezes the game). Pixel output is derived from the sync generator and game registers. PS2_Interface.v receives scan codes and maps W/S/O/L to key-down state; skeleton.v wires the PLL, stub processor, PS/2, LCD, and VGA controller so that keyboard inputs drive the game directly—the processor is not used for gameplay in this design.Assembly version (pong.s) The assembly program uses MMIO: $20=2000 (keyboard), $21=3000 (VGA base). Registers hold ball position ($1,$2), velocity ($3,$4), and paddle Y ($5,$6). The main game loop reads the keyboard, moves paddles (with clamping), updates ball position, handles bounces and paddle hits, checks for goals and resets the ball, then writes ball and paddle data to 3000–3003 and branches back. This version is the software counterpart to the hardware Pong and runs on the custom processor from the Custom-Single-Cycle-32-Bit-Processor repo.
Demo
No live demo available for this project. See the repo for setup and run instructions.
Tech & tools
- Verilog
- RISC-V / custom ISA assembly
- FPGA
- VGA
- PS/2 keyboard
Highlights
- Hardware implementation: VGA controller, PS/2 interface, game FSM
- Playable on FPGA with keyboard input
- Software equivalent: pong.s assembly for custom 32-bit ISA
- Duke ECE 550 project
More projects
WorldWide Rover
HackUMass XII — Best Embedded System. Autonomous, globally accessible rover: web interface for real-time control, maze navigation, obstacle avoidance. Python/Flask backend, Raspberry Pi, Arduino, React, ngrok.
Buffet
Trading AI: paper and live trading on Alpaca, strategy optimization, signal processing, and Qiskit-based quantum optimization. Python, TensorFlow, Alpaca API.
Custom Single-Cycle 32-Bit Processor
Custom ISA and single-cycle datapath in Verilog; synthesis-ready design used as the execution target for Pong assembly (Pong-on-Assembly repo).
Baretag iOS App
iOS app (Swift) for real-time device tracking and management; Flask/Ngrok backend and 3D localization validated in Blender.
Multilateration 3D Positioning
3D multilateration and localization algorithms with Python implementation and Blender-based simulation; feeds into Baretag device positioning.
RISC-V Encryption
Low-level encryption on RISC-V: assembly and C implementations for algorithms and analysis on a RISC-V toolchain.
PUF Tester
Hardware tooling for testing and characterizing Physically Unclonable Functions (PUFs); supports security and fingerprinting use cases.
tinyTemp
Temperature display on ATtiny85: reads sensor via ADC and shows °F and °C on SSD1306 OLED (ECE 304, Spring 2024).
WorldWide Rover
HackUMass XII — Best Embedded System. Autonomous, globally accessible rover: web interface for real-time control, maze navigation, obstacle avoidance. Python/Flask backend, Raspberry Pi, Arduino, React, ngrok.
Buffet
Trading AI: paper and live trading on Alpaca, strategy optimization, signal processing, and Qiskit-based quantum optimization. Python, TensorFlow, Alpaca API.