A Game Boy (DMG) implemented in SystemVerilog on the Sipeed Tang Nano 20K (Gowin GW2AR-18 FPGA). Built from first principles using the Pan Docs as the primary reference.
Work in progress — following a tutorial-driven development approach.
| Component | Status |
|---|---|
| CPU (LR35902) | Registers, ALU, decoder, full instruction execution |
| Memory bus | Address decoder with ROM, WRAM, HRAM, I/O, IE |
| Memory primitives | Single-port RAM, dual-port RAM, ROM |
| PPU | Not started |
| APU | Not started |
| Timer | Not started |
| Joypad | Not started |
| LCD (ST7789) | Not started |
| Cartridge / MBC | Not started |
Fully open-source:
- Synthesis: Yosys
- Place & Route: nextpnr-himbaechel (Gowin backend)
- Bitstream: Apicula (
gowin_pack) - Flash: openFPGALoader
- Simulation: Verilator
- Task runner: mise
# Install dependencies (Arch/CachyOS)
mise run deps
# Run all testbenches
mise run sim
# Build and flash to Tang Nano 20K
mise run flashrtl/
core/cpu/ CPU — regfile, ALU, decoder, execution engine
core/bus.sv Address decoder / memory bus
memory/ RAM and ROM primitives (BSRAM-inferred)
platform/ Board-specific (constraints, blinky)
sim/
tb/ Verilator C++ testbenches
common/ Testbench helper class
data/ Test ROM hex files
docs/
tutorials/ Step-by-step build tutorials (00–23)
The project is developed through a series of tutorials in docs/tutorials/:
- Toolchain Setup
- FPGA Fundamentals
- Blinky
- Simulation and Testbenches
- Memory Primitives
- CPU: Registers and ALU
- CPU: Instruction Decoder
- CPU: Instruction Execution
- Memory Bus
See docs/tutorials/TODO.md for the full roadmap.
- Board: Tang Nano 20K
- FPGA: Gowin GW2AR-18 (20,736 LUT4s, 828K BSRAM, 64Mbit SDRAM)
- Display: ST7789 SPI LCD (240×240, on-board)
- Input: Pushbuttons on breadboard (8 GPIO)
- Audio: PWM on GPIO pin
Apache 2.0