SPIM A MIPS32 Simulator

James Larus
spim@larusstone.org

Microsoft Research
Formerly: Professor, Computer Sciences Department, University of Wisconsin-Madison

spim has moved to SourceForge.org. New versions of spim are at that site. This site only contains old versions of the simulator.

Why move? SourceForge offers a number of services, such as a source code repository and collaborative tools, that make it easier to share code with other developers. Now that spim has an open source license, the time has come to move off a 20-year old web site and join the 21st century.

 

Table of Contents

What's New?

QtSpim is a new user interface for spim built on the Qt UI framework. Qt is cross-platform, so the same user iterface and same code will run on Windows, Linux, and Mac OS X (yeah!). Moreover, the interface is clean and up-to-date (unlike the archaic X windows interface).

Spim has moved to SourceForge! The source code for all version of spim are in an SVN repository and compiled version are available for download. There is also a bug tracker and discussion forum.

 

spim is a self-contained simulator that runs MIPS32 programs. It reads and executes assembly language programs written for this processor. spim also provides a simple debugger and minimal set of operating system services. spim does not execute binary (compiled) programs.

spim implements almost the entire MIPS32 assembler-extended instruction set. (It omits most floating point comparisons and rounding modes and the memory system page tables.) The MIPS architecture has several variants that differ in various ways (e.g., the MIPS64 architecture supports 64-bit integers and addresses), which means that spim will not run programs compiled for all MIPS processors. MIPS compilers also generate a number of assembler directives that spim cannot process. These directives usually can be safely ignored.

Earlier versions of spim (before 7.0) implemented the MIPS-I instruction set used on the MIPS R2000/R3000 computers. This architecture is obsolete (though, never surpassed for its simplicity and elegance). spim now supports the more modern MIPS32 architecture, which is the MIPS-I instruction set augmented with a large number of occasionally useful instructions. MIPS code from earlier versions of SPIM should run without changes, except code that handles exceptions and interrupts. This part of the architecture changed over time (and was poorly implemented in earlier versions of spim). This type of code will need to be updated. Examples of new exception handling are in the files: exceptions.s and Tests/tt.io.s.

spim comes with complete source code and documentation. It also include a torture test to verify a port to a new machine.

spim implements both a terminal and a window interface. On Microsoft Windows, Linux, and Mac OS X, the spim program provides the simple terminal interface and the QtSpim program provides the windowing interface.


Happy Birthday SPIM!

spim turned 20 years old January 2010. I wrote the original version of spim as the target machine for my first compiler class at University of Wisconsin, Madison in the spring semester 1990. spim is likely older than most of the students currently using it!

As a birthday present, the 8.0 version of spim has a simpler, less restrictive license, namely the standard BSD license.


QtSpim

The newest version of spim is called QtSpim, and unlike all of the other version, it runs on Microsoft Windows, Mac OS X, and Linux—the same source code and the same user interface on all three platforms! QtSpim is the version of spim that currently being actively maintaned. The other versions are still available, but please stop using them and move to QtSpim. It has a modern user interface, extensive help, and is consistent across all three platforms. QtSpim makes my life far easier, and will likely improve yours and your students' experience as well.

A compiled, immediately installable version of QtSpim is available for Microsoft Windows, Mac OS X, and Linux can be downloaded from: https://sourceforge.net/projects/spimsimulator/files/. Full source code is also available (to compile QtSpim, you need Nokia's Qt framework, a very nice cross-platform UI framework that can be downloaded from here).


Older Versions of SPIM

The information in this shaded box describes the older versions of SPIM. Please use QtSpim instead.
Most Recent Versions of SPIM
Platform Program Form File
Unix or Linux system
Mac OS X
spim
xspim
Source code http://spimsimulator.svn.sourceforge.net/viewvc/spimsimulator/
Microsoft Windows

(spim 7.0 and later versions no longer run on Windows 95/98. Use version 6.5 or earlier.)

PCSpim Executable http://sourceforge.net/projects/spimsimulator/files/PCSpim_9.0.zip/download
Source code http://spimsimulator.svn.sourceforge.net/viewvc/spimsimulator/

Installing Older Versions of SPIM

Microsoft Windows

  1. To run PCspim under Microsoft Windows, download the file http://sourceforge.net/projects/spimsimulator/files/PCSpim_9.0.zip/download.

  2. Unzip the file.

  3. Click on the setup.exe program.

Unix, Linux, or Mac OS X

(Note: the directions changed slightly for version 7.2, to reflect a new directory structure. Please read carefully.)

Installation is a bit more complex for a Unix or Linux system, as you need to compile the program for your particular computer and operating system.

  1. Download the files from the SourceForge repository. You don't need the Boneyard directory, which contains old versions, but the other directories are useful.
     

  2. The simple terminal interface is contained in the spim-8.0/spim directory and the X-windows interfaces is in the spim-8.0/xspim directory. The other directories are described in the README file.
     

  3. Next, you must set the directories in which spim will be installed by editing the Makefile (the file that contains instructions on building spim). In general, if you are installing spim and want the windowing version (xspim), edit the file xspim/Imakefile. If you don't want xspim or are running on a system without X-windows installed, you use the file spim/Makefile.

    The programs are installed in standard locations, but you can change the pathnames to other locations:

        EXCEPTION_DIR -- The full pathname of the directory in which to install the spim exception handler (exceptions.s).

        BIN_DIR -- The full pathname of the directory in which spim and xspim should be installed.

        MAN_DIR -- The full pathname of the directory in which the manual pages for spim and xspim should be installed.

    In general, the remaining parameters in a Makefile need not be changed.
     

  4. Then, if you are building xspim, change to the spim-8.0/xspim directory and type:

        % xmkmf
        % make
    If you do not have a copy of xmkmf, you can use the Makefile in the xspim directory, but beware that it may not work on your system because the paths to the X windows libraries could be different.
     

  5. If you do not have X-windows, change to thespim-8.0/spim directory, edit Makefile, and type:

        % make
       

  6. To run spim or xspim, the exception handler must be installed in the directory specified by the variable EXCEPTION_DIR in the Makefile. If the file exception.s is not installed, spim and xspim fail before they start running. You can either install this file by hand or by typing:

        % make install

    which also installs spim or xspim, and the manual pages in the directories that you set (above). You may need root permission to install these files, in which case type:

        % sudo make install

  7. To test that spim is correctly built, change to the spim-8.0/spim directory and type:

        % make test

    and examine the output of the test. (Note: the exception handler must be installed before running the test.)


Further Information


Changes in Latest Version

The current version of spim is 9.0 (January 2011), which is a major release that introduces QtSpim and fixes some bugs in all versions:

The current version of spim is 8.0 (January 2010), which is a minor release that cleans up bugs in 7.5 and moves to a BSD license:

The current version of spim is 7.5 (August 2009), which is a minor release that cleans up bugs in 7.4:

The current version of spim is 7.4 (January 2009), which is a minor release that cleans up bugs in 7.3:

1/14/09: Released new version of pcspim.zip to correct problem with installer script that did not install appropriate versions of msvcrt and mfc dlls.
1/21/09: Released new version of spim.tar.Z and spim.tar.gz to correct problem with install command for spim program (but not xspim).

The previous version of spim is 7.3 (August 2006), which is a minor release that cleans up a number of bugs in 7.2:

The previous version of spim is 7.2.1 (August 2005), which is a minor release that cleans up a number of bugs in 7.1:

The previous version of spim is 7.1 (January 2005), which is a minor release that cleans up a number of bugs in 7.0:

The previous version of spim is 7.0 (August 2004), which is a major release that contains a significant number of changes from version 6.5:

Outstanding bugs in 7.0:

The previous version of spim is 6.5 (January 2003), which contains the following changes from version 6.4:

The previous version of spim is 6.4 (January 2002), which contains the following changes from version 6.3:

The previous version of spim is 6.3 (January 2001), which contains the following changes from version 6.2:


Copyright

spim is copyrighted by James Larus and distributed under a BSD license.

Copyright (c) 1990-2010, James R. Larus. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Neither the name of the James R. Larus nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 The DOS and Windows ports were done by David A. Carley and are copyrighted y Morgan Kaufmann Publishers.


SPIMSAL Note

spimsal is an old version of spim that ran on PCs running Windows 3.1 and Macintoshes. spimsal implements an extended version of the MIPS instruction set and is based on an old version of spim. It also does NOT run under Windows 95 or Windows NT.