Xcell Journal Online
  Xcell Journal Archives
   
  Writing for Xcell
  Advertising in Xcell
  FREE Subscription
   
  Partner Yellow Pages
  Reference Pages
  Contact Us

    

Home : Documentation : Xcell Journal Online : Article
FPGA-Based Video Games



by Eric Crabill, Staff Design Engineer, Xilinx, Inc.
eric.crabill@xilinx.com (6/25/05)


Implementing video games in FPGAs is fun and educational.
article link to PDF
Article PDF 300 KB


In an attempt to help me maintain a better work/life balance, my wife suggested that I pick up a hobby. The first thing that came to mind was developing FPGA-based video games. I have never been a good game player, but I am fascinated by game hardware. The reason I studied electrical engineering in the first place was to get a job at Atari Games, but they closed their doors before I earned my degree.

Silicon, software, and solutions from Xilinx® are all you need to develop game platforms and write games. You can get started for less than $100 with the Xilinx Spartan™-3 Starter Kit and ISE™ WebPACK™ software. Implementing video games in FPGAs is not only fun, it creates an opportunity to learn more about FPGA devices and development tools through experimentation – without the stress of deadlines.

FPGA Gaming Platforms
Simple gaming platforms only require three components: a human interface device for input, another for output, and a mechanism for implementing the game logic or game program. Many commercial development boards with Xilinx FPGAs satisfy these requirements.

However, to create something that I could truly call my own, I chose to design a platform that was:

  • Entirely Xilinx-based
  • Inexpensive to build
  • Suitable for cooperative development
  • Capable of respectable performance
After a number of iterations, I created a block diagram (Figure 1) for a simple and yet highly flexible reconfigurable video game platform that met my requirements. The platform is designed to support the largest Spartan-3 device available in the free ISE WebPACK tools – the XC3S1000; this device is used to implement the game logic or game program. The platform also uses the Xilinx System ACE™ CF configuration controller to great advantage.

At power on, the SystemACE CF controller configures the XC3S1000 from one of eight user-selectable configurations on the Compact Flash card. After the initial poweron configuration loads, the XC3S1000 can instruct the controller to reconfigure using any of the other configurations. Furthermore, the design in the XC3S1000 may access the Compact Flash card through the System ACE CF controller as a disk. You can use the extra space on the Compact Flash card for program and data storage.

In terms of human interface devices, there are two joystick ports, a stereo audio output jack, and a VGA port capable of 4,096 colors. The platform also provides a standard serial port to use for linking systems, textual interaction through a terminal, or debugging. Schematics and photoplots for this design are available at the FPGA Games website (see the resources list at the end of the article).

A completed prototype of the platform (Figure 2) is quite small at 4 x 6 inches and could easily be smaller, possibly fashioned into a handheld unit with an integrated LCD screen. The Compact Flash card becomes, in effect, the game cartridge. The fun doesn’t start, though, until you have some games to play!

Games Via Emulation
Emulation is the sincerest form of flattery. With a suitable platform, you can emulate a wide variety of games and game systems, including those found exclusively in arcades. There are two general methods: software emulation and hardware emulation.

In either case, emulation may involve the use of ROM images, which contain copyrighted software and audiovisual content. Make sure that you obtain legal ROM images for emulation – either by purchasing original ROMs or by obtaining the legal rights to use downloaded ROM images from services such as StarROMS. Don’t let flattery turn into thievery.

The Atari 2600 Video Computer System, originally released in 1977, makes a wonderful case study of emulation. Although the system is nearly 30 years old, only recently have people been able to emulate it well.

Software Emulation
Software emulation involves the creation of a program that runs on one system (the host) to simulate the behavior of another (the target). For game systems, the emulation of the target must include human interface devices as well as the game logic, which is typically a microprocessor running a game program.

In most cases, software emulation requires a host with performance at least an order of magnitude greater than the target. This is because it may take a fair number of instructions (or cycles) on the host to emulate what happens in one instruction (or cycle) of the target.

Software emulation of game systems is entirely feasible if you use Xilinx Platform FPGA devices such as the Virtex™-4 FX family with integrated PowerPC™ processors. For example, you can emulate the Atari 2600 Video Computer System on a PowerPC host created with the Xilinx Embedded Development Kit. If you are coding-challenged like me, porting an existing emulator is quicker than writing one from scratch.

For each emulated cycle of the target system, the emulator must exactly match the target behavior. However, most emulators do not run with cycle-for-cycle accuracy in real time. One technique is to periodically emulate behaviors faster than real time, and then halt until the next period begins.

Hardware Emulation
Hardware emulation involves re-creating the original hardware – or something functionally equivalent – in programmable logic. This approach may yield the most authentic emulation, but requires detailed knowledge of the emulated system, sometimes down to the transistor level.

Again, consider the Atari 2600 Video Computer System. It is based on a 6507 processor (a derivative of the venerable 6502), the 6532 peripheral (RAM, I/O, and a timer), and a ROM (4 KB). The processor is available from the Open Cores website, and the rest are easy to create.

An additional custom peripheral called the Television Interface Adapter (TIA) implements audio and video output and user inputs. The TIA was designed in NMOS, and while its schematics are available, the TIA is surprisingly complex for a few thousand gates. The TIA design uses dynamic logic, latches, all manner of asynchronous resets and presets, gated clocks, and circuits cascaded using ripple techniques. To further complicate the situation, game programmers learned how to exploit undocumented “features” in TIA hardware. As a result, any hardware implementation must truly reproduce the original behavior in real time, cycle for cycle.

Ed Henciak, an expert Xilinx user from Pennsylvania, had the understanding, skills, and patience to implement a hardware emulation of the Atari 2600 Video Computer System in an FPGA. I was so amazed with his results that I sent him a prototype unit of my game platform. He sent me back some exciting pictures of his design running on it (Figure 3). In the near future, Ed plans to release his design with a low-cost FPGA-based game platform of his own.

Unleash Your Imagination
If you aren’t nostalgic for the video game systems of yesteryear, unleash your imagination and implement a game you enjoy from the ground up. I find wonderful ideas by scouring the websites of hobbyists working with discrete embedded processors.

Some of the best games are simple. You can start small with an addictive puzzle or action game (for example, Tetris, Minesweeper, Pong, or Breakout), implementing it directly in logic or with a Xilinx PicoBlaze™ processor.

Once you are comfortable with games like this, you can graduate to more complex ones running on Xilinx MicroBlaze™ or PowerPC processors. The Xilinx Embedded Development Kit is a great tool for this activity, as it provides a wealth of peripherals to choose from and complete development environments for both processors.

Conclusion
You can develop games on a wide variety of Xilinx FPGA development boards. It is a fun and rewarding activity. If you are interested in reading more, the following websites provide great information, motivation, and example projects:

  • www.fpgaarcade.com
  • http://office-dsan.hp.infoseek.co.jp (Japanese)
  • http://members.iinet.net.au/ ~msmcdoug/pace
  • www.fpga-games.com
  • www.retrogames.com
  • www.starroms.com
  • www.opencores.org.

Printable PDF version of this article with graphics. PDF logo (6/25/05) 300 KB

 
职位招聘 本地活动及在线座谈 本地新闻稿 投资者关系 反馈 法律声明 网站地图
© 1994-2008 Xilinx, Inc. All Rights Reserved.