All projects
03 / Engineering — retro game on FPGA
Les Bleuets
A retro game whose graphics card is written from scratch in VHDL: a tile-and-sprite PPU in a Zynq's FPGA, all the way to the HDMI output.
Context
Fourth-semester computer engineering project at UdeS. The challenge: design the architecture of a game engine the way 8-bit consoles did it, where rendering isn't done by software but by hardware described in VHDL.
- mapBram: Which tile, for this (x, y)? → tile, 6 bits
- tileBram: Which colour in the 8 × 8 tile? → index, 4 bits
- pixelBram: The palette gives the colour → RGB, 24 bits
- foregroundRender: Is an actor in front? → final pixel
Approach
- The Zynq's ARM core runs the game logic and object positions. It writes the camera and eight actors into registers, over an AXI bus.
- For every pixel, the PPU walks a chain of BRAM memories: the map gives the tile and the position inside it, the tile gives a colour index, the palette gives the RGB.
- A foreground module checks whether an actor covers that pixel and, if so, replaces the background: that's the sprite system.
- Input comes from a Pmod joystick read over SPI, and the picture goes out over HDMI.
Outcome
A fully hardware graphics engine, and a hands-on understanding of what happens under every frame: clocks, memories, buses and bits.
Tools
- VHDL
- Zynq
- Vivado
- Vitis
- C
- AXI
- BRAM
- HDMI
- SPI