hn.today

Building z86: Lessons from Implementing an Out-of-Order x86 CPU on FPGA

nand2mario.github.io29 points12 comments
Screenshot of Building z86: Lessons from Implementing an Out-of-Order x86 CPU on FPGA

z86 is an Apache-2.0 open-source, out-of-order IA-32 processor designed for FPGA, intended both to preserve 1990s PC software and to provide a real x86 implementation for learning about processor design. Developed over three months using Intel P6 documentation and a Pentium Pro as references, it targets the Xilinx ZCU104 and Kria KV260. The resulting system boots MS-DOS, Windows 95, 98 SE and NT 4.0, as well as 32-bit Linux; at 150 MHz it runs DOOM at 85 FPS and Quake at 35 FPS. Its central advantage over the earlier in-order z486 is that it can run independent instructions while an earlier operation waits on memory or arithmetic. Register renaming removes false dependencies, while a reorder buffer preserves in-order commitment and precise recovery from faults.

The full design has an in-order front end that decodes variable-length x86 instructions into micro-ops, an out-of-order execution core, and an in-order retirement engine. It includes three-wide decoding, a 40-entry reorder buffer, a 16-entry reservation station, five execution ports, 16 KiB instruction and data L1 caches, and a 512 KiB FPGA-URAM L2 cache. The author reports roughly three times z486’s performance per MHz, while emphasizing the extra complexity of x86 features such as partial-register writes, x87, self-modifying code and precise exceptions. FPGA-specific choices include BRAM-based branch prediction and DSP-assisted division. To reduce debugging risk, the project first built a sequential C simulator that executed the same micro-ops; it validated system and instruction semantics before those operations were integrated into the speculative RTL.

Read on nand2mario.github.io12 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Hardware

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.