FPGA goes Arcade

A Tron like light cycle race implemented on a Xilinx Spartan 3 FPGA board (MIPS assembly, I/O devices, VGA output). Additional game versions in Excel and Javascript.

boardscreenshot
BoardScreenshot

Project description

What do you need to play a classic arcade game with VGA graphics output on a Xilinx Spartan 3 FPGA board in a digital circuits class?

Simple: extend the provided MIPS processor by a few additional I/O devices, use a program of 104 MIPS assembly instructions, and you can enter the grid.

Detailed description and source code (Verilog and MIPS assembly) of this project (collaboration with Sandro Meier) are described on my github page. The game is played by 2 players. Output is shown on the attached VGA screen.

Some neat tricks have been used to custom design the hardware (described in Verilog) to keep the software (MIPS assembly) as simple as possible. This was initially triggered by the fact that the provided MIPS CPU (also described in Verilog) could handle only a very limited instruction set. However, it reveals the classic balance of hardware and software and illustrates how powerful customized hardware functionality can be.

Also the created “graphics card” in Verilog uses a creative solution to manage a VGA resolution with 8 colors with only very limited space for the created video RAM.

For debugging purpose, the clock frequency of the CPU could be switched to 1 Hz (instead of MHz). Some wires of the buses (described in Verilog) were connected with the onboard LEDs. Thus, details of program execution could be followed in detail.

The detailed walkthrough guide may be an interesting read.

But without further ado, a short video clip how the game looks like.

Other versions of this game

I always liked the Tron movies and this game. Additionally, it is quite easy to implement. Thus, I had already implemented the game in 2 other systems before.

Microsoft Excel: While working a lot with data analysis with Excel (see also here), I wondered whether Excel could also be used as a game engine.
Yes, it can. :-)
The grid was created by shrinking all available cells of a worksheet that they could be used as pixels. Some VisualBasic for Applications (VBA) tricks were used to run the actual game.
Screenshot

Javascript: Another version of this game is available directly on this web site: Welcome to the grid
You may want to store this short-link for future reference.

Acknowledgments

  • Tron, the grid and the light cycle race are (c) / TM from Walt Disney Productions. A first Tron arcade game was published by Midway Games in 1982. The present game was designed for educational in-class use without commercial interest. This project illustrates building of input and output devices for a simple MIPS computer on a Xilinx Spartan 3 FPGA board.
  • VGA output is based on Xilinx library code and based on the project bitvga-s3 by E. Gallimore and N. Smith on embedded.olin.edu (Internet Archive Link; original site not online at the moment).
  • MIPS code including ALU, control unit, registry file, instruction and data memory are based on the files provided in class. They were written by Frank K. Gürkaynak, ETH Zürich. We completed the code as asked in the lab sheets of the exercise sessions, and introduced only few modifications for this game like optional 1 Hz debug clock frequency (which allows tracking of the assembly program from the outside with some internal wires put on the status LEDs), wider instruction memory bus and memory size for max. 128 instructions. Additional output pin IsIO from MIPS to the motherboard top.v, which simplified the outside homebrew I/O controller.