Project Results

Phase 1: Anything that Moves

After going through all of our trials and tribulations and finally deciding on implementing a single hardware sprite we wrote our hardware sprite module in verilog. We initially hardcoded the sprite to display a single blue rectangle to the screen as a simple test. Then, to pull everything together, we wrote a top level module for the FPGA that would contain a sprite module and an FPGA module, handle sprite position and movement, and tie all of the signals together.

Photos of our initial results:

Proof of concept - blue rectangle on a monitor. ...And it even moves around.

Phase 2: Bring on the Ghosts

Next, we needed to change our implementation to draw an actual sprite instead of just a rectangle. We didn't want to waste time trying to write a memory interface, so we created a module that emulates the sprite shape memory. The module takes an x and y coordinate and a shape and returns the R, G, B, and A (active or not) for that pixel of that shape. We hard-coded 4 shapes into the memory module: 2 colors of ghost that we based on the Pac-Man ghost. Each color of ghost has 2 seperate shapes for frames of animation. By switching back and forth between the shapes, we were able to get an animated effect for the ghosts. While integrating our shape memory into the hardware sprite module, we ran into several problems that we had to tackle:

After successfully drawing one animated ghost to the screen, an intermediate goal, we then wanted to draw multiple ghosts. We needed one additional module to do this job: a video selector which we could stack in series to draw each sprite if the Active (A) was high, or let the sprites underneath pass through to the output otherwise. This component controls which sprites appear above others when they overlap, and is essentially a 3 bit multiplexer. Finally, we tied everything together with a new top level module which contains the VGA module, 5 hardware sprite modules, and control logic for user control of one ghost and "chasing" logic for the other ghosts.

The final verilog code is available for download:

Photos and video of our final results:

Now the blue ghosts chase your red ghost. We were pretty excited when it finally worked. Click here to view a movie of our demo in action.