Skip to content

We built a CPU. Then it ran Doom.

A 5-stage pipelined MIPS processor in Verilog, designed from scratch by four students, running the original Doom on a DE10-Lite FPGA.
Doom on our MIPS, on the DE10-Lite’s VGA output (Nov 26): title screen, demo, menus and a new game in E1M1. Bottom left: the board, played with its switches. The CPU, the caches, the memory system and the video are ours; the game is the original, compiled with GCC.
CPU Our own 5-stage pipeline (IF, ID, EX, MEM, WB), hazard unit, branch delay slot, 25 MHz
Instruction set MIPS I integer (~50 instructions), big-endian, no FPU: enough for GCC
Memory 64 MB SDRAM for Doom and its 4 MB WAD, 8 KB instruction cache + 16 KB data cache
Video 320 × 200, 256-color palette, doubled to 640 × 400 on VGA
Doom Title screen 1.15 s after KEY0, demo at ~8 frames per second, playable with the switches
FPGA Intel MAX 10: 8,018 logic elements (16 %), 147 of 182 memory blocks, 5.4 ns of setup slack

How Doom fits on a board with 182 KB of memory

Section titled “How Doom fits on a board with 182 KB of memory”

SDRAM and caches

Doom needs ~11 MB, so it runs from the board’s 64 MB SDRAM. Two caches answer most accesses; the data cache alone took the demo from 4.2 to 7.8 fps. How Doom runs

A palette video mode

One byte per pixel and a 256-color palette in hardware: 64 KB instead of 256 KB, and Doom’s red flash is just a palette change. Video mode B

GCC and our own C library

The original source via doomgeneric, compiled for MIPS I with soft float. The build refuses any instruction our CPU doesn’t run. Compiled with GCC

Proven in simulation first

Verilator ran our RTL until it drew Doom’s title screen identical to the PC’s. On the board it worked on the first try. Simulation and the board

It started as the final project of a Computer Architecture course. The same CPU and the same system (rtl/life_system.v) run all three levels; each one only adds what the previous one didn’t need.

1. The professor's spec

Datapath, control and the 12 required instructions, our own assembler, and the graded algorithm (frequency of a value) with its tests and traces. Datapath and control

2. Game of Life

Conway’s Game of Life in assembly on VGA, controlled with the switches and keys. Everything the CPU talks to is just memory. Game of Life

3. Doom

The original Doom, compiled with GCC, running from the board’s SDRAM on the same CPU, with caches, a 256-color video mode and a boot loader. Doom

Every case of the professor’s test list passes: tests and traces.

The version we hand in is the tag final-submission: the code, the memory images and this report exactly as they were graded. main may keep changing after that; the tag doesn’t.

Member GitHub Role Main folders
Ariel @Rxjaz FPGA platform lead: top levels, video, MMIO, SDRAM, Doom on the board rtl/ (platform), quartus/
Victor @VictorManuA CPU core lead: datapath, control, pipeline, hazard unit rtl/ (CPU), verif/
Uriel @moonlight9515l Toolchain lead: assembler, reference simulator, GCC, Doom build src/assembler/, src/tools/, src/doom/
Yocelyn @altamirayocelyn Software and website lead: Game of Life, test programs, report src/programs/, web/, docs/