Quick Guide: 4 Easy Steps To Play Snake on Your FPGA

Hello FPGA lovers. I am sure you are going to love today´s post: How to implement Snake Game on your FPGA. Maybe some of you are too young to remember this everlasting game that has been popular generation after generation on a wide variety of formats. And as it couldn´t be less, Snake Game deserves to be played on a FPGA.

The tutorial I am presenting today was developed by a group of students from the University of Manitoba.  The project has 4 simple steps and all the hardware that you will need is your FPGA, a VGA monitor, a PS/2 keyboard, a USB cable and a power cable. Easy stuff here. Sorry for those hand-work lovers. More on that in future posts.

Well, getting back to the snake. According to the authors the more difficult parts to develop where the VGA output and the PS/2 keyboard input, as there is not too much information available on internet for its coding using Verilog. Read this, if you want to learn useful basics that will help you in future projects.

The FPGA that they used was an Altera DE2 Cyclone IV. Thus you may need to adapt the Verilog program to your FPGA. You can download the whole code here.

Another aspect I would like to highlight for you, it is their approach for coding the snake itself and what it eats, apples (funny uh). No they are not from IBM. Anyway, you may like to make your snake carnivore or a sweet lover so read these steps up and play with the code. Make your snake a dragon that eats carrots or whatever you want. This is the magic of coding.

We would love to see your modifications!

But as always, have fun!


By D. Lovegrove, I. Sweetland, K. Jacobson & R. Alves

Create A Particle Dynamics Simulator With Your FPGA


Today´s article presents a very detailed project of a Cornell student who wanted to play with Pyro Sand Game. He did not want his laptop to overheat due to high power consumption, the fan to go crazy or the screen to freeze up once a lot of particles were on screen. To solve this he created a hardware version taking advantage of an FPGA and its great parallelization capabilities.

As the author describes it, this piece of software is more a 2D particle simulator than a game. In this sense, he chose to model the particle as a cellular automaton.  Each pixel on a 480×640 screen is a cell. The whole screen is drawn on a VGA screen and this determines the kind an amount of memory required. More details here. Also, a VGA logic module is needed.

A great deal of this project is implemented as hardware directly downloaded on the FPGA, using Verilog code (every line is provided). Pictures and diagrams are provided to help the reader properly understand the designing process.  Even gif graphs have been used in order to correctly explain how he managed to solve a problem with the RAM storage of rows of pixels in order to update the state of any pixel.

Don´t jump between sections and read the testing and debugging if you want to avoid unnecessary headaches!

This a very interesting project to use as a starting point for a particle dynamics simulator. As it can be seen in the pictures, the physical behavior of some particles is not real. So…

Now it´s your turn to make it happen!


By S. Schneider

VHDL Communication With A PS/ 2 Keyboard

Thanks to reader Hamster, who submitted this peachy Wiki page!  Hamster has written some VHDL code for communicating with a PS/ 2 keyboard that can be found on the wiki!  Useful stuff:

“It has lots of features:

  • It does full start bit, stopbit and parity check
  • … deglitches the signals, by requiring a state change of longer than 1us before it is acted upon
  • Checks that the clock speed is within limits
  • Can be adapted  to stuff keyboard scan codes into a FIFO for later processing.”

You can check out Hamster’s code here.

If this is up your alley, give it a try, and post your results in the comments thread.  Suggestions or improvements?  Thanks again Hamster!