Noureddine RAMDI / Recreating the 3dfx Voodoo GPU in SpinalHDL for FPGA and cycle-accurate simulation

Created Mon, 04 May 2026 10:23:02 +0000 Modified Sat, 23 May 2026 20:41:27 +0000

fayalalebrun/SpinalVoodoo

SpinalVoodoo is a deep dive into hardware-level GPU architecture by recreating the 3dfx Voodoo Graphics GPU using SpinalHDL, a Scala-based HDL. This project isn’t just an academic exercise; it targets FPGA synthesis and achieves cycle-accurate simulation via Verilator, demonstrating how to bridge classic silicon designs with modern hardware description and verification tools.

what SpinalVoodoo implements and its architecture

At its core, SpinalVoodoo replicates the functionality of the 3dfx Voodoo Graphics GPU, an influential 3D accelerator from the mid-1990s known for pioneering hardware-accelerated texture mapping and rasterization. The project focuses on implementing the Frame Buffer Interface (FBI) and the Texture Mapping Unit (TMU), which are critical for rendering textured triangles.

The design is written in SpinalHDL, a high-level hardware description language embedded in Scala, which allows for more expressive and maintainable hardware designs compared to traditional Verilog or VHDL. Targeting FPGA synthesis means the design can be deployed onto reconfigurable hardware, while the cycle-accurate simulation via Verilator ensures detailed timing and functional correctness.

Technically, the pipeline includes triangle rasterization using edge-function testing, a well-known algorithm for determining pixel coverage inside a triangle. Gradient interpolation for texture coordinates and depth uses fixed-point formats with various bit widths (12.12, 20.12, 14.18, 2.30), carefully chosen to balance precision and hardware resource usage.

Texture mapping is perspective-corrected using a 257-entry reciprocal lookup table (LUT) for dividing texture coordinates by depth (S/W and T/W). This LUT approach is a hardware-friendly compromise to avoid costly division operations. Framebuffer read blending employs a fork-queue-join pattern known as BMB (probably a custom synchronization pattern), optimizing concurrent framebuffer accesses during alpha blending.

Verification is comprehensive, combining screenshot-based regression testing against the Glide2x test suite (the official 3dfx driver), waveform tracing with FST format, and integration with DOSBox-X to run real DOS games like Tomb Raider using the simulated hardware. This mix of simulation and real-world testing adds confidence in the design’s fidelity.

technical details that set SpinalVoodoo apart

What stands out is the use of fixed-point math with varying fractional bit widths tailored to different interpolation needs. This is a classic tradeoff in hardware design where floating-point units are expensive or unavailable. The choice of formats (for example, 12.12 or 14.18) reflects an intimate understanding of the precision required at each stage of the graphics pipeline.

The perspective correction for texture mapping is another highlight. Instead of performing division directly, which is costly in hardware, the use of a 257-entry reciprocal LUT enables fast lookup to approximate 1/W. Then, multiplication replaces division, a common hardware optimization. This approach is faithful to the original silicon’s strategy and fits well into FPGA constraints.

The fork-queue-join BMB pattern for framebuffer blending is less common in open-source GPU projects. It suggests a careful design to handle memory access latency and concurrency in the framebuffer, which is crucial for blending operations that must be atomic and consistent.

From a code quality perspective, the project benefits from SpinalHDL’s expressive power, which likely results in cleaner and more modular code compared to raw Verilog. The verification infrastructure is solid and uses real-world benchmarks (Glide2x tests and DOSBox-X games), which goes beyond typical unit tests or simulation-only checks.

That said, the project is specialized and complex. It demands familiarity with hardware design, fixed-point arithmetic, and FPGA toolchains. The tradeoff is a steep learning curve and a niche audience, but for those invested, it offers a rare glimpse into recreating a historically significant GPU with modern HDL tooling.

quick start with tomb raider simulation

The repo includes helper scripts to set up and run simulations with the Tomb Raider game running inside DOSBox-X with the SpinalVoodoo GPU emulation. This isn’t plug-and-play gaming but a targeted test environment for hardware verification.

The main setup command prepares the source tree required for simulation:

make tomb/prepare ARGS='--game-dir /path/to/TOMBRAID --patch /path/to/3dfx-patch.zip --iso /path/to/tr1disc01.iso'

This copies your game directory, overlays the 3dfx patch, and arranges the files under a default tree (/tmp/tr1-3dfx). You can customize paths with environment variables like DOSBOX_TOMB_SRC and DOSBOX_TOMB_STAGE_ROOT.

After preparation, you can run the simulation or headless tests with:

make tomb/sim/run

or

make tomb/sim/headless

The scripts handle renaming overlays and configuring DOSBox-X to use the internal Glide2x guest bridge, enabling real-time interaction with the emulated GPU.

verdict: who should dig into SpinalVoodoo

If you’re a hardware engineer, FPGA enthusiast, or retro GPU architect, SpinalVoodoo is worth exploring. It’s a solid example of how to recreate a classic GPU architecture with modern HDL tooling, including detailed attention to fixed-point precision and hardware-friendly math approximations.

The project’s verification strategy is practical and thorough, integrating real software tests rather than just simulations, which is a strong point for anyone interested in GPU validation.

However, the complexity and niche focus mean it’s not suitable for casual FPGA beginners or those looking for general-purpose GPU designs. The code assumes familiarity with hardware concepts and the SpinalHDL framework.

Overall, SpinalVoodoo is a rare, hands-on window into historical GPU design recreated with today’s tools, blending software and hardware verification in a way that’s both educational and functional.


→ GitHub Repo: fayalalebrun/SpinalVoodoo ⭐ 286 · C