The assembly language test driver for assignment 6 is available in the public directory, as well as a working sample life_xform (in the file speed.asm) which is a simple direct hand translation of the -a(`../handouts/speed.c',`given C code'). It is inefficient, and you should not use it as a starting point for your code; instead, you should think about the various strategies for optimization -- improved algorithm, loop unrolling, constant propagation and common subexpression elimination, and dead code elimination -- and write your version of life_xform out in C or in pseudo-code, and translate that into MIPS assembler.
The C driver code has been modified to use the same pseudo-random number generator as in the assembly language driver to make testing easier. (You can ask for only a few repetitions without displaying the intermediate generations and comparing the outputs of the C program with that of the assembly language program. Remember to seed the random number generator with the same value: with the C program, you use the -S num flag; with the MIPS version, you type it in interactively.)
There is also a modified version of xspim and spim which provides an instruction count when the program exits. You should organize your code as a replacement for speed.asm, and hand in only that file. To obtain the count, do the following in an xterm:
$ cat driver.asm speed.asm > all.asm $ spim -file all.asm SPIM Version 6.0 of July 21, 1997 Copyright 1990-1997 by James R. Larus (larus@cs.wisc.edu). All Rights Reserved. See the file README for a full copyright notice. Loaded: /home/solaris/ieng9/cs30f/public/lib/trap.handler Enter numbers, <= 0 to use default Width? 70 Height? 20 Xterm control sequences? (0/1) 1 Show intermediate states? (0/1) 1 Seed? 1 Rep? 20 ... display of successive generations ... Total instructions since program load = 0x00000000 00cda86c $Your life_xform should do substantially better than this dumb implementation.
When testing your code, you will probably want to continue using xspim, since it is easier to single step code and watch registers change as instructions are executed etc. Remember that you have to cat together the two files, and so every time you modify your speed.asm, you should re-run the cat command and have xspim reload all.asm.
bsy@cse.ucsd.edu, last updated