
Authors: Valeria Molano and Luisa Fernanda Avendaño.
This is a simple snake game project selected as the best course project from the Digital Asic Design 2025-2 course at Universidad Pedagogica y Tecnologica de Colombia - Tunja. The course has been taught by professor Juan David Guerrero Balaguera.
Here you can find a Demo of an FPGA implementation of the Snake Game.
This project consist of an minimal ASIC design of the classical Snake videogame using four 8X8 Led Matrices and four input push buttons for controlling the game. The ASIC is all full implemented using verilog.
Microchip Snake Game (snake_game_uptc)
Below you can see the description and hardware implementation (Verilog RTL) of the Snake game. The design is intended to control 4 coupled 8×8 LED matrices, forming a 16×16 pixel game area. The circuit integrates clean reading of mechanical buttons, the complete game logic through a state machine, snake and food position control, a BCD scoring system, and SPI communication to drive the external displays via the MAX7219 driver.
Figure 1: Hardware architecture and data flow in snake_top.
Cleans the mechanical noise from the buttons. Each button (KEY [3:0]) enters a shift register. The signal only changes its internal logical state if it remains stable (high or low) for 8 consecutive clock cycles.
Receives 16-bit parallel commands from the game_core and serializes them. Generates the necessary clock, data, and chip select (CS) pulses to communicate in a standard way with the MAX7219 ICs of the LED matrices.
Table 1: Input and output signals map of the Design.
| Signal | Type | Width | Origin / Destination | Description |
|---|---|---|---|---|
| CLOCK_10 | Input | 1 bit | System | Base board clock (10 MHz). |
| SW [0] | Input | 1 bit | Switch | Asynchronous reset (Active low 0). |
| KEY [0] | Input | 1 bit | Button | Moves Left. |
| KEY [1] | Input | 1 bit | Button | Moves Right. |
| KEY [2] | Input | 1 bit | Button | Moves Down. |
| KEY [3] | Input | 1 bit | Button | Moves Up. |
| MAX_DIN | Output | 1 bit | SPI Driver | Serial data output to MAX7219. |
| MAX_CLK | Output | 1 bit | SPI Driver | Clock for SPI transmission. |
| MAX_CS | Output | 1 bit | SPI Driver | Chip Select (CS) signal for the matrix. |
| HEX0 [3:0] | Output | 4 bits | Score LEDs | Counter units (for 4 LEDs). |
| HEX1 [3:0] | Output | 4 bits | Score LEDs | Counter tens (for 4 LEDs). |
Table 2: Input and output pins on the TinyTapeot chip.
| # | Input (ui) | Output (uo) | Bidirectional (uio) |
| 0 | left | spi_din | disp1[0] |
| 1 | right | spi_clk | disp1[0] |
| 2 | down | spi_cs | disp1[0] |
| 3 | up | - | disp1[0] |
| 4 | - | disp0[0] | - |
| 5 | - | disp0[0] | - |
| 6 | - | disp0[0] | - |
| 7 | - | disp0[0] | - |
See the General System Description and Internal Module Description sections above for the full technical breakdown of snake_top, debounce, game_core, and spi_driver.
SW[0]).DIN/DOUT daisy-chained, CLK/CS in parallel).Supplementary material in the repository:

Figure 2: Implementation on FPGA

Figure 3: Working operation evidence
Table 2: Operational details to consider for hardware integration.
| Code | Behavior | Recommended Solution |
|---|---|---|
| NOTE-01 — KEY Inversion | The direction pins on the main module are logically inverted (e.g., when receiving "Up", "Down" is processed). | Physically cross the button connections on the motherboard during assembly. |
| NOTE-02 — Self-collision | If the direction opposite to the current movement is pressed (e.g., moving right and pressing left), the game applies the 180° turn before advancing, detecting a collision with its own body. | The player must make "U" turns in two steps (e.g., press "Up" and immediately "Left"). |
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | left | spi_din | disp1[0] |
| 1 | right | spi_clk | disp1[1] |
| 2 | down | spi_cs | disp1[2] |
| 3 | up | disp1[3] | |
| 4 | disp0[0] | ||
| 5 | disp0[1] | ||
| 6 | disp0[2] | ||
| 7 | disp0[3] |