An FPGA (Field-Programmable Gate Array) is an interesting class of device. Like a microcontroller, FPGAs can be used to interface directly with other hardware components, but they can also do a lot more. That’s because the key feature of an FPGA is that they can be programmatically reconfigured to act as any kind of circuit — including ICs and processors. Originally they were used for tasks like prototyping chips, but Skip Hansen is using one to play Pac-Man.
FPGAs are gaining popularity in the maker community because they can be used to create just about any kind of integrated circuit, and are only limited by how many transistors they can reproduce. With a modern FPGA like the Pano Logic Thin Client G1, there are enough blocks to recreate both modern and retro processors, which is what Hansen’s Pac-Man project relies on.
To make this work, Hansen stitched together code from multiple sources. Those include: Tom Verbue’s ray tracer and bring up code, Mike J’s VHDL Pac-Man simulation model for a Spartan 3E FPGA, Daniel Wallner’s Verilog Z80 CPU core, and the SpinalHDL project to tie it all together. This uses the FPGA to create both a Z80 processor and a RISC-V in order to run the game.
The Pano Logic Thin Client G1 has a built-in VGA output for a monitor, but Hansen still needed to build a joystick to play the game. He started with an Atari joystick, but the challenge was getting it connected to the FPGA (the USB ports don’t work). The solution he came up with was to use pins that act sort of like GPIOs: two meant for LEDs, one meant for the “Pano” button, and two meant for the VGA’s DDC (Display Data Channel). The result may be the most hacked-together version of Pac-Man in history, but it works!