构建 Z86:在 FPGA 上实现乱序执行 x86 CPU 的经验和教训
Building Z86: Lessons from Implementing an Out-of-Order x86 CPU on FPGA

原始链接: https://nand2mario.github.io/posts/2026/z86/

z86 是一个采用 Apache-2.0 许可的开源 IA-32 CPU 和 PC 平台,面向 UltraScale+ FPGA,旨在弥补缺少可检查的超标量乱序 x86 核心的不足。其设计参考 Intel P6 资料和真实 Pentium Pro 测试,采用 14 级流水线,包含 4-1-1 解码器、寄存器重命名、保留站、ROB、按序退休、80 位 x87 FPU、L1/L2 缓存、分页、VM86 和净室微码。它可启动 MS-DOS、Windows 95/98 SE/NT 4.0 和 32 位 Linux;在 ZCU104 上以 150 MHz 运行时,DOOM 达到 84.8 FPS,Quake 达到 35.2 FPS。开发过程依赖顺序 C 语言微操作模拟器、真实 Pentium Pro 探测、与 86Box 的锁步协同仿真以及片上调试器。两个 FPGA 配置面向 ZCU104 和 Kria KV260,每 MHz 性能约为 z486 的 3 倍,在 150 MHz 时性能接近 Pentium Pro 200。CPU 和 PC SoC 均为开源,并提供现成的 SD 卡镜像和桌面仿真。

一篇 Hacker News 帖子讨论了《构建 Z86:在 FPGA 上实现乱序 x86 CPU 的经验教训》,这是 nand2mario 的文章。该帖子获得了 74 分和三条评论。发帖者链接到了另一个更大规模的讨论串。评论者称赞了这个项目,尤其是其参数化的总线、缓冲区和队列;其中一人建议可以针对游戏引擎工作负载进行优化。另一位希望微码模拟器(`p6.c`)能够发布,以便更容易学习。第三人称这篇文章是对乱序指令执行的一次出色的实操讲解。
相关文章

原文

My previous x86 cores, z386 and z486, were built primarily for retro gaming on FPGA. z86 and its companion PC platform z86_pc are a bit different. They certainly serve 1990s PC preservation (running DOOM at 85 FPS, Quake at 35 FPS, and booting Windows 95, 98 SE, and NT 4.0 on live hardware), but they also aim to fill a gap: there has never been an open-source superscalar out-of-order x86 CPU core, even though out-of-order x86 processors became mainstream more than 30 years ago and still dominate modern PCs. Universities teach Tomasulo's algorithm, register renaming, and reorder buffers out of textbooks without real x86 RTL to inspect or modify, and open-source FPGA/ASIC CPU work has focused almost entirely on RISC-V. My hope is that an Apache-2.0, Linux-booting out-of-order IA-32 implementation can serve both as a teaching artifact and as a practical foundation for future open-source FPGA or chip projects.

The project started in June 2026, when I began collecting Intel P6 materials (the Intel IA-32 Software Developer's Manuals, Shen & Lipasti's Modern Processor Design, P6 patents, and community microcode notes). After releasing z486 in August, a vintage Dell OptiPlex GXpro (Pentium Pro stepping 0619) arrived on my desk in early September. Over the next three months, the project grew into a dual-board v0.1 release targeting both the Xilinx ZCU104 and the $250 Kria KV260.

This post discusses the architectural mechanisms, engineering challenges, and lessons from taking an out-of-order x86 CPU from a blank slate to booting MS-DOS, Windows 95/98/NT 4.0, and 32-bit Linux on FPGA.

Live ZCU104 FPGA DisplayPort captures from z86_pc v0.1: Quake (35.2 FPS @ 150 MHz), Windows NT 4.0 Workstation, SpeedSys 4.78, and 32-bit i686 Linux 6.18 running CoreMark-PRO.

1. In-Order and Out-of-Order Are Very Different Animals

Moving from z486 to z86 is not a matter of widening a pipeline or adding a few more ALUs. In-order and out-of-order processors are fundamentally different machines.

  • z486 is a classic 5-stage in-order pipeline. Every instruction marches in lockstep from fetch to writeback. When a load misses L1 cache or a multi-cycle x87 divide starts, the entire pipeline simply stalls until the result returns. Control is centralized, state is small, and there is no speculative architectural state to unwind.
  • A P6-class CPU is a 14-stage out-of-order machine composed of three loosely coupled pipelines joined by queues and buses: an in-order front end (fetch, variable-length decode into µops, register rename, and resource allocation), an out-of-order execution core (reservation station wakeup/select, multi-port dispatch, and dataflow writeback), and an in-order retirement engine (reorder buffer commit, fault/branch recovery, and committing stores to memory).

Dynamic scheduling buys huge real-world performance—especially on x86, where compilers only have eight integer GPRs and memory latency dominates.

Why Out-of-Order? ILP and Register Renaming

First, a short refresher on how out-of-order execution works. At its core, OOO exists to exploit instruction-level parallelism (ILP)—finding independent work in a sequential instruction stream and running it while earlier instructions are stuck waiting on memory or slow arithmetic.

Consider a short, everyday x86 sequence made of two completely independent computations (Chain A and Chain B). Because x86 only gives the compiler eight general-purpose registers, the compiler naturally reuses EAX for both:

; Chain A — starts with a cache miss
1: mov  eax, [ebx]      ; slow load (cache miss)
2: add  eax, 1          ; true dependency on (1)
3: mov  [esi], eax      ; true dependency on (2)

; Chain B — logically independent work, but reuses EAX:
4: mov  eax, [ecx]      ; fast load (cache hit!)
5: add  eax, edx        ; depends on (4), NOT on (1)-(3)
6: mov  [edi], eax      ; depends on (5)
  • On an in-order CPU (z486): Instruction 1 misses cache and stalls the pipeline for many cycles. Even though [ecx] is sitting hot in the cache and the ALU is idle, instructions 4–6 cannot pass instruction 1. Chain A and Chain B execute strictly back-to-back.
  • Reordering alone isn't enough: Even if the CPU tried to run instruction 4 early, 4 writes to EAX! Overwriting EAX before instruction 2 reads the old value corrupts Chain A, and having 1 finish after 4 would clobber Chain B's EAX. Neither is a real data dependency—they are false dependencies caused purely by reusing the register name EAX.
  • How register renaming unlocks ILP: As instructions pass through the Register Alias Table (RAT) in program order, the hardware quietly gives every write its own private physical storage slot in the Reorder Buffer (ROB), turning the two chains into:
1: ROB1 = load [ebx]    ; misses cache -> waits in Reservation Station
2: ROB2 = ROB1 + 1      ; waits for ROB1
3: store [esi], ROB2    ; waits for ROB2

4: ROB4 = load [ecx]    ; fresh slot ROB4! Hits cache immediately
5: ROB5 = ROB4 + edx    ; executes right away while (1) is still waiting!
6: store [edi], ROB5    ; finishes early; waits to commit in order

With the false dependency on EAX gone, Chain B executes in parallel while Chain A is still waiting on memory—hiding latency and keeping multiple execution units busy at once. Crucially, the ROB still commits registers and releases stores to memory in strict program order (1 → 2 → 3 → 4 → 5 → 6), so if instruction 1 triggers a page fault (#PF), the CPU simply discards ROB4–ROB6 as if Chain B never ran.

3× Performance Jump from z486 to z86

That ability to look dozens of instructions ahead, rename away false hazards, and overlap slow memory or FPU work with independent math is what drives the 3× per-MHz jump from z486 to z86—and why an out-of-order core needs all that extra bookkeeping hardware:

Dimension z486 (MiSTer) z86 (FULL profile)
Pipeline 5-stage in-order 3-wide OOO (4-1-1 decode)
Bookkeeping None 40-ROB, 16-RS, 5 ports, 3 WB
x87 FPU 53-bit x87 Full 80-bit (86b datapath)
Caches L1 only 16K/16K L1 + 512K URAM L2
Footprint* 21.9k CPU ALMs 183.6k PC LUTs
Per-MHz IPC 0.33 DMIPS/MHz 1.03 DMIPS/MHz
DOOM / Quake 31.3 / 6.8 FPS 84.8 / 35.2 FPS (150 MHz)

*Cyclone V uses 8-input ALMs (~1.5–2× Xilinx 6-LUTs); z86's 183.6k LUTs include ~16.2k LUTs of PC peripherals (167.4k CPU+L2 alone).

And x86 heaps extra complexity onto out-of-order execution compared with textbook RISC:

  1. Variable-length instructions (1–15 bytes) that cross 16-byte fetch boundaries and require parallel length decoding before steering.
  2. Partial-register updates (AL/AH/AX/EAX) and split EFLAGS (where instructions like shifts or INC modify only a subset of condition flags)—naive renaming stalls constantly on partial writes.
  3. An 8-deep x87 register stack (ST(0)–ST(7)) where FXCH swaps stack pointers rather than moving 80-bit data.
  4. Complex CISC instructions, split stores, and Self-Modifying Code (SMC) that must remain strictly precise when a page fault (#PF) or hardware interrupt hits mid-stream.

2. How Does x86 Out-of-Order Execution Work?

If you want the full stage-by-stage breakdown of the P6 pipeline, I have written up a detailed pipeline overview on the wiki at P6 Pipelines. Alongside Shen & Lipasti Chapter 7 and Intel's P6 patents, Martin Hinner's P6 Microcode Wiki is also an extraordinary resource documenting many of the concrete mechanisms and internal data structures (micro-op encodings, register aliases, MAR macros, and sequencer flows).

At a high level, z86 follows the same three-pipeline architecture—turning variable-length x86 instructions into fixed-format internal micro-ops (µops) so the out-of-order engine never has to see CISC encoding quirks:

z86 superscalar out-of-order microarchitecture diagram
z86 (Z86_PROFILE_FULL) microarchitecture
  1. In-Order Front End: Fetches 16-byte blocks from the L1 instruction cache into a 48-byte stream buffer, finds instruction boundaries in parallel, and feeds a 4-1-1 decoder—one complex decoder (D0, emitting up to 4 µops or handing off to the microcode ROM) alongside two simple 1-µop decoders (D1 and D2).
  2. Rename, Allocate & Out-of-Order Core: Up to 3 µops per cycle pass through the integer and floating-point Register Alias Tables (RAT / fRAT), receive a Reorder Buffer (ROB) slot, and enter the Reservation Station (RS) alongside load/store queues in the Memory Order Buffer (MOB). Ready µops dispatch out of order across 5 execution ports—with stores split into separate address and data ports—and broadcast results back over 3 writeback buses.
  3. In-Order Retirement: The retirement unit scans the oldest 3 ROB entries in program order, copies committed results into the Retirement Register File (RRF), checks for faults or branch mispredictions (rolling back speculative state cleanly), and releases committed stores (senior stores) to the L1D/L2 cache hierarchy.

Again, the core is fully open source, so anyone interested in the details is encouraged to read the RTL directly. For readability, many source files are annotated with the relevant US patent numbers, Shen & Lipasti section references, and pipeline stage numbers (such as 31, 92, etc.)—though out-of-order hardware is still inherently messy.

Where z86 Intentionally Adapts for UltraScale+ FPGAs

While inspired by P6's structure, z86 also exploits modern FPGA silicon primitives where they pay off:

  • BRAM-backed branch prediction: Instead of P6's 512-entry Branch Target Buffer (BTB), z86 uses a 2,048-entry 4-way BRAM BTB, an 8,192-entry BRAM Gshare/Tournament predictor with checkpointed 11-bit global history, an 8-entry loop predictor, and a 16-entry return stack—costing almost no logic LUTs.
  • Eliminating partial-register stalls: By tracking when the upper bytes of a register are known to be zero and merging partial writes directly in the ALU and load paths, z86 avoids most x86 partial-register stalls without emitting extra merge µops.
  • DSP-accelerated division: Using three FPGA DSP blocks to retire 7 quotient bits per clock completes a 64-bit floating-point divide (FDIV) in 13–14.5 cycles (2.6× faster than a real Pentium Pro), alongside faster square root (FSQRT) and integer divide (DIV, 3.3× faster).
  • URAM L2 Cache: A 512 KiB 4-way L2 cache built out of UltraScale+ UltraRAM (with 4 outstanding miss buffers and a hardware stride prefetcher) costs only 3,802 LUTs.
  • 100% clean-room open-source microcode: Written from scratch in a unified symbolic microcode assembly (1,526 three-µop lines across 12 .asm files), paired with a Python-generated polynomial floating-point ROM (FPROM) achieving < 0.75 ULP (units in the last place) accuracy across all 8 IA-32 x87 transcendentals.

3. The Sequential C Simulator (p6.c): Proving µops Before Speculation

One key decision was pausing RTL work for three weeks in October to build a fast, sequential functional C simulator (p6.c). Why take a three-week detour when we already had a real-mode out-of-order CPU booting MS-DOS on the KV260 in early October?

Because IA-32's full system architecture—Protected Mode descriptor checks, call/task/interrupt gates, Virtual-8086 mode, paging, and x87—has thousands of semantic rules. Trying to implement and debug all of those directly inside a 3-wide speculative core was simply too inefficient. p6.c was created to separate those two problems. It executed the exact same micro-op ISA sequentially, with no OOO machinery (RAT, RS, ROB, speculative fetch, or caches), and validated every micro-op strictly by opcode, fields, aliases, and explicit processor state.

DOOM running in the sequential p6.c micro-op C simulator
DOOM running inside the sequential p6.c micro-op C simulator—verifying Protected Mode, DOS/4GW, and the full micro-op ISA before writing the out-of-order SystemVerilog.

By early November, p6.c booted MS-DOS and started DOOM in SDL—proving the micro-op architecture end-to-end before returning to Verilog. With the micro-op semantics proven, the full out-of-order machine—including Protected Mode, Virtual-8086 mode, paging, and the 86-bit x87 FPU—came together in SystemVerilog within a month.


4. Live Experiments on the Pentium Pro

The vintage Dell OptiPlex GXpro (Pentium Pro stepping 0619) that arrived in early September turned out to be worth its weight in gold for two reasons.

4.1 Pinpointing Subtle IA-32 & µop Semantics on Real Silicon

Even the official Intel manuals leave grey areas around fault priorities, reserved control and debug register bits, how x87 masked exceptions update status flags, whether a locked read-modify-write page fault sets the write bit, and obscure shift/rotate flag behavior. Early on, I wrote a lightweight DOS serial monitor (P6MON.COM) for the GXpro—paired with a USB relay on its reset header—so we could upload and execute targeted assembly micro-tests directly on real Pentium Pro silicon over RS-232 in real time.

p6mon takes over the machine with private IDTs and a dedicated 64 KiB test arena, letting the host Python client configure Real Mode, Protected Mode (ring 0 or ring 3, with independent 16/32-bit code and stack sizes), Virtual-8086 mode, 4 KiB paging, and custom GDT descriptors before running any flat assembly snippet until INT 0x60 (or capturing the exact hardware exception frame). A typical probe takes less than a second end-to-end:

; probe.asm — test a protected-mode instruction sequence and return via INT 60h
bits 32
org 0
    mov eax, 0x12345678
    add eax, 1
    mov [0x2000], eax
    int 0x60
# Configure a read-only paged alias or custom descriptor, run on live GXpro, and capture state:
$ python3 client.py map-page 0 0x4000 --read-only
$ python3 client.py run probe.bin --mode pm32 --ss32 --paging --eax 0x12345678 --journal run.jsonl
{
  "classification": "normal",
  "result": {
    "eip": 14, "eflags": 2, "vector": 96, "error": 0,
    "cr0": 2147483665, "cr2": 0,
    "registers": { "eax": 305419897, "ebx": 0, "ecx": 0, "edx": 0, "esp": 65520 }
  }
}

Here the live Pentium Pro reports eax = 305419897 (0x12345679) and cr0 = 2147483665 (0x80000011, Protected Mode + Paging enabled) after trapping back cleanly on INT 0x60 (vector 96).

The other key job of p6mon was clarifying and discovering P6 µop semantics directly on hardware. Building on the community's microcode tooling (utools by Rudolf Marek) and P6 µop documentation by Martin Hinner and Peter Bosch, we could upload small, reviewed microcode test patches on the GXpro and invoke them via a custom CPUID leaf. Instead of guessing how an unknown µop works, we could isolate a single micro-op or control field, sweep its inputs over RS-232, and read back exact hardware outputs—resolving questions such as operand- and address-size aliasing, privilege checks, internal control-bus (CRBUS) and conditional-select (PSELECT) behavior, x87 rounding controls, and fault priorities.

Edge cases we pinned down on the GXpro went straight into our regression suites—first validating p6.c, and later validating z86's RTL and clean-room open microcode.

4.2 Timing Data & Hardware PMU Tuning

The other payoff was performance profiling. Having a real Pentium Pro on the desk let us measure exact instruction latencies via micro-benchmark kernels and collect per-MHz DOS benchmark baselines (DOOM, Quake, 3DBench, PC Player, Chris's 3D) on real hardware.

When z86 first booted Quake on ZCU104, it was only running at ~65% of the GXpro's per-MHz speed (11.4–13.5 FPS at 79 MHz). Hardware performance counters revealed that the execution backend was actually starving—the Instruction Decode Queue was empty (IDQ_EMPTY) for 34%–42% of all cycles! Targeted optimizations to the instruction stream buffer, RAT, and L1D cache lifted Quake performance by 40% to 18.9 FPS at 79 MHz, matching or beating the GXpro per MHz across all 7 DOS benchmarks.


5. RTL: From Real Mode to Protected Mode, Paging, and VM86

Just like z386 and z486, the RTL was brought up incrementally along the natural x86 complexity ladder:

  1. Real Mode: The first SystemVerilog out-of-order core booted MS-DOS COMMAND.COM in Verilator mid-September, running DOS, 3DBench, SysInfo, and Landmark.
  2. Protected Mode, Segmentation & Task Switching: Full 32-bit execution with a cached segment descriptor table, privilege rings (CPL 0–3), interrupt and call gates, ring stack switches, hardware task switching via the TSS, and x86 debug registers (DR0–DR7).
  3. Virtual-8086 Mode: Running 16-bit real-mode code safely inside a 32-bit protected-mode OS—including virtual mode extensions and TSS I/O permission bitmaps—which unlocked DOS extenders (DOS/4GW), EMM386, and 32-bit DOOM.
  4. IA-32 Paging & Self-Modifying Code: Virtual memory required instruction and data TLBs backed by a 1,024-entry L2 TLB and a hardware page-table walker supporting both 4 KiB and 4 MiB pages (which Windows NT and Linux rely on). On an out-of-order core, the real challenge is keeping faults precise—handling unaligned loads and stores that cross a page boundary, honoring TLB invalidations (INVLPG), and flushing the pipeline whenever a store overwrites nearby code.
  5. Complete 86-bit x87 FPU: All 140 x87 instruction forms, hardware stack renaming for zero-cycle FXCH, 80-bit and BCD memory formats, full FPU state save/restore (FSAVE/FRSTOR for OS context switches), transcendentals, and transparent microcode assists for rare numeric edge cases.
  6. Clean-Room Open Microcode: During the process, we wrote the entire IA-32 and x87 microcode from scratch in clean-room symbolic assembly (1,526 three-µop lines) paired with our < 0.75 ULP Remez floating-point ROM—matching or beating our earlier benchmark speed.

Because ZCU104 is an expensive development board, we also parameterized decode, issue, queue, and cache widths at compile time so the exact same RTL and microcode scale down to the $250 Kria KV260 (Z86_PROFILE_LITE: 1-decode/2-issue out-of-order, 8K/8K L1, 256K L2, 94.5k LUTs—keeping the full 80-bit x87 FPU).


6. Verification: Lockstep Co-Simulation, Portable Snapshots, and a Hardware Debugger

In addition to directed unit tests and single-step instruction suites like in z386 and z486, two techniques became vital in getting z86 across the finish line: lockstep co-simulation and live on-chip hardware debugging.

6.1 Full-System Lockstep --cosim Against 86Box

Late in z486's development, I added full-system lockstep co-simulation (--cosim) against 86Box's CPU core. For z86, it became our main workhorse for hunting down subtle ISA, paging, and OS bugs. The harness lives in the z86_pc repository: instead of chasing a crash millions of cycles after the actual mistake, it runs the RTL CPU in lockstep with 86Box and halts on the exact first instruction that diverges. Because there is surprisingly little practical documentation online about how to build this for a full system, I wrote up the general technique and portable snapshot mechanism on a wiki page: Lockstep Co-Simulation for Debugging CPUs.

Every divergence is triaged against the Intel IA-32 manuals and live Pentium Pro behavior into three buckets: a real z86 RTL/microcode bug, a real 86Box emulator bug (patched cleanly in sim/cosim_patch.py—we actually caught missing CMOV read-before-select faults, CMPXCHG mismatch writebacks, LAR/LSL descriptor rules, and P6 DR6/DR7/LMSW masks in 86Box), or an architecturally undefined/P6-specific bit.

6.2 Adding the Hardware Debugger

As good as --cosim is, Verilator runs at tens of kHz—more than a thousand times slower than a 100–150 MHz FPGA. When we moved on to 32-bit i686 Linux 6.18, Windows 98 SE, and Windows NT 4.0 Workstation, we ran into bugs that only manifested 30–60 seconds into a live boot on 64–128 MiB of RAM, or under live IRQ/VGA timing. Waiting hours in Verilator to reach them was painful.

Late in the project, I built a lightweight on-chip hardware debugger (z86-dbg, ~470 LUTs, 1 BRAM36—just 0.2% of the ZCU104). In hindsight, I should have added it on day one.

The debugger uses Xilinx UltraScale+'s dedicated BUFGCE global clock-gate primitive to freeze the CPU clock glitch-free right at the root—adding zero logic to any CPU critical path. Before stopping the clock, a small AXI4 shim drains any in-flight DRAM bursts so the ZynqMP memory bus never wedges, while the debugger's control registers stay on an always-running clock so the Linux host remains completely responsive while the entire x86 PC is frozen in time.

From the ZCU104 Linux shell, you get instant live inspection:

z86-dbg halt                         # AXI4-safe clock-gated freeze
z86-dbg regs                         # GPRs, EIP, EFLAGS, segments, CR0-CR4
z86-dbg pipe                         # IFU, ROB, RS, MOB, PMH, L1/L2 stall state
z86-dbg trace 32                     # 512-entry BRAM retired-PC / event ring
z86-dbg stepi                        # single-step 1 retired macro-instruction
z86-dbg bp 0 0008:fe546654           # hardware CS:EIP breakpoint
z86-dbg watchdog 50000000 ign_hlt    # auto-freeze on pipeline deadlock

It paid off immediately during Windows NT 4.0 bring-up, catching a live VGA.DLL fetch/BTB deadlock on silicon in two minutes—a bug that would have taken hours just to reach in Verilator.


7. Evaluations

7.1 Methodology

All FPGA numbers below are measured on ZCU104 (Z86_PROFILE_FULL) and Kria KV260 (Z86_PROFILE_LITE) using the v0.1 bitstreams:

Platform Profile CLB LUTs FFs RAMB36 eq. URAM288 DSP48E2 Worst-Case Fmax
ZCU104 (XCZU7EV) Z86_PROFILE_FULL 183,627 (79.7%) 62,071 125.0 / 312 24 / 96 23 108.1 MHz
Kria KV260 (XCK26) Z86_PROFILE_LITE 94,513 (80.7%) 46,209 109.0 / 144 16 / 64 20 111.8 MHz

While static timing closes > 100 MHz at worst-case slow-corner process, voltage, and temperature (108.1 / 111.8 MHz), both bitstreams run stably at 150 MHz at room temperature via z86-run --clock 150 (with a dynamic clock-rate register keeping the PIT, RTC, and Sound Blaster audio exact across frequencies). Real-hardware DOS reference medians are from Phil's Ultimate VGA Benchmark Database; Linux benchmarks were compiled with GCC 14.3 (-O2 -march=pentiumpro -mfpmath=387 -mno-mmx -mno-sse) and executed live under 32-bit i686 Linux 6.18.54-z86 (128 MiB RAM).

7.2 Performance vs. Historical x86 CPUs & Linux

At 150 MHz, z86 LITE on the $250 KV260 sits between a Pentium 100 and a Pentium 133, while z86 FULL on ZCU104 runs close to a Pentium Pro 200 (matching or beating it on VGA-heavy 3DBench, PC Player, and DOOM, while Quake reflects pure CPU + x87 throughput):

z86 live FPGA benchmarks vs historical x86 CPUs and Linux 6.18 benchmarks
Live ZCU104 (FULL) and Kria KV260 (LITE) DOS benchmarks at 100 and 150 MHz vs. Phil's VGA Database medians, plus live 32-bit i686 Linux 6.18 scores.
System / CPU Clock 3DBench 1.0c PC Player (320×200) DOOM demo3 (MAX) Quake demo1 (320×200)
i486DX4-100 (median) 100 MHz 62.6 15.8 36.4 9.4
z86 LITE (KV260) 100 MHz 66.1 24.4 37.0 13.0
Intel Pentium 100 (median) 100 MHz 91.3 27.5 54.2 23.0
z86 LITE (KV260) 150 MHz 99.4 36.4 54.8 19.3
Intel Pentium 133 (median) 133 MHz 101.2 31.5 50.7 24.2
z86 FULL (ZCU104) 100 MHz 99.8 40.0 57.7 23.8
Intel Pentium 166 (median) 166 MHz 113.5 34.8 65.3 28.1
z86 FULL (ZCU104) 150 MHz 150.0 59.8 84.8 35.2
Intel Pentium Pro 200 (median) 200 MHz 144.0 60.1 71.2 41.9

Live 32-bit i686 Linux 6.18 benchmarks on ZCU104 (Z86_PROFILE_FULL, 128 MiB RAM):

Benchmark 100 MHz 150 MHz Per-MHz (150 MHz)
CoreMark 1.01 (-O2, CRC validated) 253.79 383.34 2.56 / MHz
CoreMark-PRO Overall (9/9 workloads) 65.31 98.04 0.65 / MHz
↳ Integer (5 workloads) / FP (4 workloads) 67.08 / 63.17 101.20 / 94.24 0.67 / 0.63
Dhrystone 2.1 (DMIPS) 101.8 153.8 1.03 DMIPS/MHz
Whetstone (Double x87, MWIPS) 66.7 100.0 667 KWIPS/MHz
LINPACK (Double x87 N=200, MFLOPS) 29.63 44.70 0.298 FLOP/clk

7.3 Comparison Against Open-Source x86 FPGA Cores

Compared to prior open-source x86 FPGA cores, z86 delivers 3×–5× the per-MHz integer performance of in-order z486 and ao486, 4.0× the DOOM frame rate of ao486, and 4.3×–5.2× the Quake frame rate of z486 / z486 XL:

z86 compared against open-source FPGA x86 cores
z86 (LITE & FULL) vs. open-source FPGA x86 cores (ao486, z386, z486, TetriumSX, z486 XL) with real Pentium Pro 200 reference lines.
Processor Pipeline & FPU Target FPGA Area Clock DMIPS/MHz 3DBench DOOM demo3 Quake demo1
ao486 (MiSTer) 486SX in-order, no FPU Cyclone V 15.2k CPU ALMs 90 MHz 0.19 43.6 21.0 FPS —
z386 (MiSTer) 80386 microcoded, no FPU Cyclone V 15.5k CPU ALMs 85 MHz 0.23 34.0 23.0 FPS —
z486 (MiSTer) 486DX in-order + 53-bit x87 Cyclone V 21.9k CPU ALMs 85 MHz 0.33 53.1 31.3 FPS 6.8 FPS
z486 XL (KV260) 486DX in-order + 53-bit x87 + L2 UltraScale+ XCK26 50.3k PC LUTs 100 MHz — 65.1 38.5 FPS 8.1 FPS
TetriumSX (MiSTer) High-IPC 486SX in-order, no FPU Cyclone V 18.5k CPU ALMs 69 MHz — 100.1 37.5 FPS —
z86 (LITE) 1-dec/2-issue OOO IA-32 + 80-bit x87 UltraScale+ XCK26 94.5k PC LUTs 100 / 150 MHz 0.52 66.1 / 99.4 37.0 / 54.8 FPS 13.0 / 19.3 FPS
z86 (FULL) 3-wide OOO IA-32 + 80-bit x87 UltraScale+ XCZU7EV 183.6k PC LUTs 100 / 150 MHz 1.03 99.8 / 150.0 57.7 / 84.8 FPS 23.8 / 35.2 FPS

7.4 How Does an OOO x86 Compare to Open-Source OOO RISC-V on FPGA?

It is also interesting to place z86 next to Linux-capable, hardware-FP open-source out-of-order RISC-V cores on UltraScale+ FPGAs. Despite carrying variable-length CISC decode, microcode, segmentation, and an 80-bit x87 FPU, z86's higher FPGA clock rate puts its effective FPGA CoreMark roughly in line with academic OOO RISC-V cores like SonicBOOM (while trailing huge commercial ASIC-targeted cores like OpenC910):

Core ISA & FPU Issue Width Target FPGA LUTs FPGA Clock CoreMark/MHz Effective FPGA CoreMark
z86 (LITE) IA-32 + 80-bit x87 1-decode / 2-issue XCK26 78.3k (CPU+L2) 100–150 MHz 1.70* ~170–255
z86 (FULL) IA-32 + 80-bit x87 3-wide (4-1-1) XCZU7EV 167.4k (CPU+L2) 100–150 MHz 2.56–2.83* 254 @ 100 / 383 @ 150
SonicBOOM Small RV64GC + IEEE F/D 1-wide ZCU106 ~96k 50–75 MHz 2.41 ~120–180
SonicBOOM Medium RV64GC + IEEE F/D 2-wide ZCU106 ~144k 50–75 MHz 3.90 ~195–290
SonicBOOM Large RV64GC + IEEE F/D 3-wide ZCU106 / VU9P ~238k 50–75 MHz 4.9–5.0 ~245–375
OpenC910 (XuanTie C910) RV64GC(V) + IEEE F/D 3-wide (12-stage) VU9P / VCU128 ~670k ~50–100 MHz (2.5 GHz ASIC) 4.9–7.1 ~250–710

*z86 CoreMark/MHz: 2.56 is live -O2 on i686 Linux (254 @ 100 MHz, 383 @ 150 MHz); 2.83 (FULL) and 1.70 (LITE) are bare-metal -O3 RTL simulation.


Conclusion

Building z86 was by far the most ambitious CPU project I have taken on, and a few lessons stood out above everything else: separate complex ISA semantics from speculative RTL early (p6.c), measure against real silicon rather than guessing (p6mon and hardware PMUs), and lean heavily on lockstep --cosim with portable snapshots.

Both z86 (CPU RTL and clean-room microcode) and z86_pc (full PC SoC, Verilator/SDL2 simulator, and FPGA builds) are open source under the Apache 2.0 license. If you have a ZCU104 or Kria KV260, a single 42 MiB universal SD card image is ready on the z86_pc Releases page; without an FPGA, you can clone z86_pc with --recursive and run make sim DISK=your_disk.img to boot interactively on your desktop.

Big thanks to the 86Box authors, z486_MiSTer testers, and the x86 microcode research community—especially Martin Hinner, Rudolf Marek, and Peter Bosch—whose work and documentation made a project like this possible.

联系我们 contact @ memedata.com