Z8086: Rebuilding the 8086 from Original Microcode

https://news.ycombinator.com/rss Hits: 4
Summary

After 486Tang, I wanted to go back to where x86 started. The result is z8086: a 8086/8088 core that runs the original Intel microcode. Instead of hand‑coding hundreds of instructions, the core loads the recovered 512x21 ROM and recreates the micro‑architecture the ROM expects.z8086 is compact and FPGA‑friendly: it runs on a single clock domain, avoids vendor-specific primitives, and offers a simple external bus interface. Version 0.1 is about 2000 lines of SystemVerilog, and on a Gowin GW5A device, it uses around 2500 LUTs with a maximum clock speed of 60 MHz. The core passes all ISA test vectors, boots small programs, and can directly control peripherals like an SPI display. While it doesn’t boot DOS yet, it’s getting close.Why another x86?The 8086 is where the x86 story began. If you want to understand why x86 feels like x86 — segmented addressing, ModR/M, the prefetch queue, the oddball string instructions — this is the chip to study.Also, reverse-engineering of the 8086 has reached a surprisingly level of maturity. We now have Ken Shirriff’s massive 8086 blog series and Andrew Jenner’s disassembled microcode. Combined with the original 8086 patent, these resources make it possible to rebuild a faithful core instead of a functional approximation.My goals were simple:Faithful where it counts. Accurately replicate the microarchitectural behavior of the original 8086 wherever it matters most.Designed to be explorable and educational. The code is thoroughly commented to make it clear and easy to understand. Aims to be a good teaching resource.FPGA-friendly and practical. z8086 is built to be an effective, useful CPU IP core for real FPGA projects.Re‑creating the 8086Here’s the high‑level view:(You can cross-reference function blocks against the die shot.)At a bird’s‑eye level the pipeline is:Prefetch queue → Loader (FC/SC) → Microcode sequencer → EU/BIU datapathThis is like the original chip’s split. The BIU (bus interface unit) runs ahead, fetching bytes into a 6‑by...

First seen: 2025-12-13 17:52

Last seen: 2025-12-13 20:52