anagnorisis.cloudSign in

← Hourlies

Hourly ·

Students Build a Custom CPU From Scratch, Port DOOM to Run at 20 FPS

Armaan Gomes and a friend designed a pipelined RISC-V CPU with DDR3 memory, cache, and VGA output on an FPGA — then ported the classic 1993 shooter DOOM to it. Starting at 0.7 frames per second, they optimized through clock bumps, instruction additions, and compiler tricks to achieve a playable 15-20 FPS. A 9-second demo video racked up 2 million views on Instagram.

Students Build a Custom CPU From Scratch, Port DOOM to Run at 20 FPS

Two undergraduate students have demonstrated that the legendary challenge of running DOOM on anything now includes hardware built from the ground up.

Armaan Gomes and his collaborator Liam designed a custom 5-stage pipelined RISC-V CPU at the logic-gate level, implementing instruction fetch, decode, register read, execute, and writeback stages on an FPGA. They added a DDR3 memory controller with two independent caches (instruction and data), a memory arbiter to prevent deadlocks, and a VGA controller for video output — all in hardware description language.

The CPU started with just 1 MB of FPGA Block RAM, but DOOM's shareware WAD file alone is 14 MB. The team integrated off-chip DDR3 memory, implemented a direct-mapped cache with 2,048 lines, and built clock-domain crossing bridges to make it all work on real silicon.

Porting DOOM was a brutal debugging experience. The game would crash in hardware but not in simulation. After days of head-scratching, they discovered the culprit: uninitialized DDR3 memory contained random values, while the simulation assumed zeroed-out RAM. DOOM's code was making assumptions about memory state that held in sim but broke on the real FPGA.

Starting at a slideshow-like 0.7 FPS, the pair methodically optimized their way up: bumping the clock from 100 MHz to 125 MHz (+20%), fixing an inefficient fetch stage (3× improvement), adding hardware multiplication instructions, and switching from a buffered framebuffer to direct VGA writes. The biggest win came from enabling compiler optimizations — but only after discovering they'd forgotten to mark a memory-mapped I/O pointer as volatile, causing the compiler to optimize away the hardware timer entirely.

The final result: DOOM running at a smooth 15-20 FPS on a homebrew CPU, with out-of-order execution planned next. The team posted a 9-second clip to Instagram that hit 2 million views. Commenters on Hacker News praised the deep systems engineering on display, with several noting it as one of the cleanest "DOOM on X" projects in recent memory.

Sources: Armaan Gomes Blog Hacker News Discussion

More Hourlies Stories

Content on Anagnorisis is summarized, paraphrased, and editorialized from publicly available sources for length and clarity. Original sources are linked where available. All trademarks belong to their respective owners.

More from Anagnorisis