Getting SPIM

The new assignment asks you to use the "spim" MIPS simulator to try out some MIPS code. There are several ways to get access to the simulator.

Running spim in the CS domain

I've got a copy of it in my home space. You can get access to it by including the line

source /user/pfeiffer/software/config/cshrc.pfeiffer

in your .cshrc file (you can look at /user/pfeiffer/.cshrc, line 45, for an example)

It came with the book

The CDROM that came with the text has a directory called Content/Software/Spim/ with Unix (which should work with Linux, Mac OSX, and Solaris systems) and PC (I don't really know if it's DOS or Windows -- I suspect DOS) versions of the simulator. There is a file in there called compilation_help.html that you'll want to look at; it gives compilation instructions for the Unix version.

Unfortunately, as I mentioned in class Monday, recent versions of flex won't compile with this code. But it can be fixed! If you untar the Unix version, it will create a directory called spim-7.0. There is a file in this directory called scanner.l.

Edit this file by inserting the line

#define yytext_ptr yytext

at line 334 of the file. The context of this patch will now look like:


/* Use yywrap to insert a marker character, which causes the
   scanner to return Y_EOF, before return a hard EOF.  This
   wouldn't be necessary, except that bison does not allow
   the parser to use EOF (= 0) as a non-terminal */
#define yytext_ptr yytext
int yywrap()
{
	if (eof_returned)

Get my patched version

I've got a version, patched as described above, at http://www.cs.nmsu.edu/~pfeiffer/classes/473/notes/spim-patched.tgz.

Get a package

Spim has been around forever, so I expect every Linux distribution in the universe has it. Under debian, the package is named spim (original, huh?).


Last modified: Wed Feb 2 08:58:29 MST 2005