DIY Projects

Doom Runs on a Scratch-Built RISC-V CPU on an FPGA

Doom Runs on a Scratch-Built RISC-V CPU on an FPGA

Two weeks after wiring up a processor that existed only as logic gates, an MIT student team watched Doom crawl to life on it. The 1993 shooter has already been forced onto calculators, cameras, and printers, but this port lands somewhere rarer: a CPU the team designed themselves, gate by gate, then dropped onto an FPGA.

Armaan Gomes led the build. The group wrote a five-stage pipelined CPU around the open RISC-V instruction set, wired it to peripherals, and adapted the Doom engine source id Software released years ago so it would compile for their machine. Before this, the chip had only run their own small programs, a Pong clone and some Mandelbrot sets. Jumping from those to a full commercial game engine is a large leap, and it surfaced bugs that could live in either the game code or the silicon. As Gomes puts it, when it breaks “you don’t know if the code is wrong, or if your CPU is incorrect.”

From 0.7 FPS to actually playable

The first working build ran at 0.7 frames per second, technically Doom but practically a slideshow. Gomes refused to leave it there. Overclocking the core by 25 percent and tightening the instruction fetch stage pushed it to 2.5 FPS. Adding hardware multiply instructions the CPU had been missing took it to 3.5 FPS. Writing video data straight to block RAM while pipelining cache reads landed 6.7 FPS. The biggest jump came from software, not hardware: compiler optimization alone dragged the game up to 15–20 FPS, which Gomes calls “very playable and quite fun.”

Want to design a CPU yourself?

You don’t need an MIT lab to start. A hobby FPGA board and an open toolchain are enough to begin writing your own logic:

  • Pick up a low-cost FPGA dev board and learn Verilog or VHDL. Blink an LED first, then build a counter, then a simple RISC-V core.
  • Port a tiny program before a big one. Gomes ran Pong and Mandelbrot sets long before Doom, and each caught real bugs in the pipeline.
  • Doom already runs on a $4 RP2040 Pico, so you have a cheap yardstick to benchmark your homebrew chip against a stock microcontroller.

For the pipeline diagrams and the exact optimizations behind each frame-rate gain, read the full breakdown of the build on Hackster.

Frequently Asked Questions

What hardware runs Doom in this project?

A custom five-stage pipelined CPU built around the open RISC-V instruction set, designed at the logic-gate level and deployed onto an FPGA. It is not an off-the-shelf chip; the team wired the processor and its peripherals themselves.

How did the team get from 0.7 FPS to a playable frame rate?

They overclocked the core 25 percent, tightened the fetch stage, added missing hardware multiply instructions, and wrote video straight to block RAM. Compiler optimization gave the biggest lift, taking the game to 15-20 FPS.

What will I learn if I build this?

You will pick up digital logic design, pipelining, and how a CPU fetches and executes instructions, plus Verilog or VHDL and FPGA toolchains. Porting real software also teaches you to debug across the hardware-software boundary, a core skill for embedded and computer engineering.

This article was inspired by reporting from Hackster. Find the parts and modules to build it at Circuitrocks.

// written by Ann Arandia

Ann Arandia covers community projects and maker events for the Circuitrocks blog. She writes about local workshops, kid-friendly electronics, and the Philippine maker scene — the people, the meet-ups, the projects that come out of them.