z386: Open-Source 80386 FPGA CPU Runs Doom Using Original Intel Microcode
This FPGA recreation of Intel's 80386 boots DOS and plays classic games using recovered microcode.
Z386 is an open-source 386-class CPU implemented on FPGA that recreates Intel's original microarchitecture using recovered microcode. The design boots DOS 6 and DOS 7, runs protected-mode software like DOS/4GW and DOS/32A, and plays games such as Doom and Cannon Fodder. It achieves 85 MHz clock speed with 16 KB unified 4-way set-associative L1 cache, performing like a fast cached 386 or low-end 486. Compared to the existing ao486 core, z386 uses fewer resources: 8K vs 17.6K lines of code, 18K vs 21K ALUTs, 5K vs 6.5K registers, and 116K vs 131K BRAM. While ao486 achieves slightly higher frame rates (21 vs 16.5 Doom FPS at max detail), z386 offers a more authentic microarchitectural recreation.
The project builds on earlier work with the z8086, which demonstrated that a CPU could operate using recovered microcode. For the 386, the microcode is denser and more complex, requiring careful disassembly by reenigne and other contributors. Z386 follows the original eight-unit organization (prefetch, decoder, microcode sequencer, ALU and shifter, segmentation, protection, etc.) but uses FPGA-friendly shortcuts like DSP blocks for multiplication and a small fast cache. Key features include a 32-entry paging TLB, a barrel shifter modeled after the original, ROM/PLA-style decoding, and the 2,560-entry 37-bit-wide microcode ROM. This recreation is both educationally valuable for understanding 386 internals and practically usable for retro computing.
- Uses original Intel 80386 microcode recovered from the chip, not an emulation.
- Boots DOS 6/7, runs protected-mode programs, and plays Doom at 16.5 FPS on FPGA.
- More resource-efficient than ao486: 8K lines vs 17.6K, 18K ALUTs vs 21K.
Why It Matters
Revives vintage x86 computing with an authentic open-source FPGA implementation, preserving Intel's microarchitecture for education and retro fans.