Javier Valcarce's Homepage

The Game Of Life for PicoBlaze

This is the well known game of life (or simply Life) implemented in assembler for a Xilinx Picoblaze soft processor.

It's a simple example of how to connect VGA80x40 macro to PicoBlaze. This System-On-A-Chip (SoC) includes PicoBlaze, VGA80x40 peripheral macro, Block RAMs and the necessary glue logic to assemble the whole system.

The software running on PicoBlaze shows Life game on screen. It doesn't use special hardware, in particular it doesn't multiplication in hardware but shift & add algorithm.

Life on PicoBlaze using VGA80x40 IP core

Hardware

Stuff:

  • 3200 bytes True Dual Port Block RAM to store text (video buffer)
  • 3072 bytes Single Port Block ROM to store font bitmap (font buffer)
  • VGA80x40 macro
  • 2 8-bit registers (write only) that store de 12-bit address for video RAM, one for MSB part and one for LSB part of the address
  • 3 8-bit registers (write only) for VGA80x40: CRX, CRY and CTL
  • PicoBlaze and its program ROM (optionally with JTAG interface for easy firmware update)
  • Software of The Game Of Life for PicoBlaze

Connection diagram of the entire system:

Connection diagram

Software

Life grid is a 80x40 character matrix (text mode). The software indexes text buffer using two indexes to calculate the linear memory address. The necessary multiplication is done in software thought shift and add operations. The rules of Life are very simple.

Rules of the Game

From Wikipedia: The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square ''cells'', each of which is in one of two possible states, ''live'' or ''dead''. Every cell interacts with its eight ''neighbours'', which are the cells that are directly horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:

  1. Any live cell with fewer than two live neighbours dies, as if by loneliness.
  2. Any live cell with more than three live neighbours dies, as if by overcrowding.
  3. Any live cell with two or three live neighbours lives, unchanged, to the next generation.
  4. Any dead cell with exactly three live neighbours comes to life.

The initial pattern constitutes the 'seed' of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed—births and deaths happen simultaneously, and the discrete moment at which this happens is sometimes called a ''tick''. (In other words, each generation is a pure function of the one before.) The rules continue to be applied repeatedly to create further generations.

Download

The package game_of_life.zip contains two subdirectories

  • HW. VHDL files for the SoC.
  • SW. PicoBlaze assembler PSM source code file and the corresponding compiled *.VHD file, ready to be included in the ISE project.

You can use BIT file included in the zip and use it directly with Xilinx iMPACT tool for a Xilinx Spartan-3 Starter Kit board, in case you have such development board.

References

This page forms part of website https://javiervalcarce.eu