the game of life - columbia university · game of life overview of the system based on initial...

15
The Game of Life Steven Chen, Juan Gutierrez, Vincenzo Zarrillo {stc2104, jmg2048, vaz2001}@columbia.edu Embedded Systems Design, CS 4840 May 8, 2007

Upload: others

Post on 21-Jul-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

The Game of Life

Steven Chen, Juan Gutierrez, Vincenzo Zarrillo

{stc2104, jmg2048, vaz2001}@columbia.edu

Embedded Systems Design, CS 4840

May 8, 2007

Page 2: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

2

Game of Life

Overview of the System

� Based on initial coordinates, outputs to VGA the game visualization (the ‘board’)� White indicates ‘life’ and blue indicates ‘death’

� Each organism modeled as one pixel on a 256x256 pixel board

� Generations occur roughly every second

� Hardware used to update each generation of the game

� Software (C program) used to pass to hardware the initial conditions of the board

Page 3: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

3

Game of Life

Architectural Design

FPGA

vga_rasterVGA Video

Port

VGA

Monitor

Nios

Processor

Avalon bus

Page 4: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

4

Game of Life

vga_raster Component Design

swap = 0

swap = 1

RAM 1

RAM 2

updater VGA

‘Load’ RAMFrom Avalon Bus

To VGA Video Port

Page 5: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

5

Game of Life

Overall System

� Nios sends initial coordinates to the ‘Load’ RAM through the Avalon bus

� ‘Load’ RAM contents loaded into RAM 1 (‘current’)

� VGA reads from ‘current’ while updater also reads from ‘current’ and writes to RAM 2 (‘next’)

� ‘next’ and ‘current’ are then swapped

Page 6: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

6

Game of Life

Internal Representation of Game Board

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Each ‘cell’ holds 32 bits

8 cells X 32 bits = 256 bits total per row

8 cells X 256 rows = 2048 (211) cells total in board

256

Rows

8 cells per row

Page 7: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

7

Game of Life

Dual-Port RAM - Current

q_b (32 bits)

q_a (32 bits)

address_a (11 bits)

data_a (32 bits)

clock

address_b (32 bits)

data_b (1 bit)

wren_b (1 bit)

wren_a (1 bit)

To updater

To VGA

From

Updater

From

VGA

Page 8: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

8

Game of Life

Game Logic Implementation

1 0 1 … 0

0 0 0 … 0

0 0 1 … 0

sr_pos

dataOut1

dataOut2

dataOut3

34-bit registers

0 0 … 1outRegister

32-bit register

33 0

31 0

currentPositionInOutput

countNeighbors: 0011

From RAM 1

To RAM 2

1

0

0

Page 9: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

9

Game of Life

Page 10: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

10

Game of Life

VGA Implementation

� Reads bit by bit and colors pixel accordingly

� After reading bottom right end of the board, updater

turns on

Page 11: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

11

Game of Life

Nios Implementation

� Writes 32 bits to each location in RAM

� Random set of numbers or hard-coded set of

numbers as initial conditions

Page 12: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

12

Game of Life

Implementation Experiences and

Issues� Necessity of Precise Timing

� Difficulties in deciding on best and easiest

implementation of game logic

� Shift registers, components, etc.

� Writing Initial Conditions into the program

� Issues with addressing

� Reading from a file in C

Page 13: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

13

Game of Life

Primary Roles

� Steve

� Updater Implementation

� Design Document, Final Report, Presentation

� Juan

� Updater/VGA/Nios Implementation

� System Integration

� Vinny

� VGA/Nios Implementation

� System Integration

� Everyone

� Design, Debugging, Troubleshooting

Page 14: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

14

Game of Life

Lessons Learned

� Timing Diagrams – Draw them first!

� Test every potential thing that could go wrong as

soon as you can.

� The simulator is your best friend

� Think Hardware, not Software

� It’s never too early to start

Page 15: The Game of Life - Columbia University · Game of Life Overview of the System Based on initial coordinates, outputs to VGA the game visualization (the ‘board’) White indicates

The Game of Life

Steven Chen, Juan Gutierrez, Vincenzo Zarrillo

{stc2104, jmg2048, vaz2001}@columbia.edu

Embedded Systems Design, CS 4840

May 8, 2007