SPIM


SPIM is a MIPS processor simulator, designed to run assembly language code for this architecture. The program simulates R2000 and R3000 processors, and was written by James R. Larus while a professor at the University of Wisconsin–Madison. The MIPS machine language is often taught in college-level assembly courses, especially those using the textbook Computer Organization and Design: The Hardware/Software Interface by David A. Patterson and John L. Hennessy.
The name of the simulator is a reversal of the letters "MIPS".
SPIM simulators are available for Windows, Mac OS X and Unix/Linux-based operating systems. As of release 8.0 in January 2010, the simulator is licensed under the standard BSD license.
In January, 2011, a major release version 9.0 features QtSpim that has a new user interface built on the cross-platform Qt UI framework and runs on Windows, GNU/Linux, and Mac OS X. From this version, the project has also been moved to SourceForge for better maintenance. Precompiled versions of QtSpim for Linux, Windows, and Mac OS X, as well as PCSpim for Windows are provided.

The SPIM operating system

The SPIM simulator comes with a rudimentary operating system, which allows the programmer usage of common used functions in a comfortable way. Such functions are invoked by the syscall-instruction. Then the OS acts depending on the values of specific registers.
serviceTrap codeInputOutputNotes
print_int$v0 = 1$a0 = integer to printprints $a0 to standard outputbase = 10
print_string$v0 = 4$a0 = address of first characterprints a character string to standard output
read_int$v0 = 5integer read from standard input placed in $v0base = 10
sbrk$v0 = 9$a0 = number of bytes required$v0= address of allocated memoryAllocates memory from the heap
exit$v0 = 10
file_open$v0 = 13$a0 = full path, $a1 = flags, $a2 = UNIX octal file mode$v0 = file descriptorexample; there are read/write/close functions, too

The SPIM OS expects a label named main as a handover point from the OS-preamble.

SPIM Alternatives/Competitors

MARS is a Java-based IDE for the MIPS Assembly Programming Language and an alternative to SPIM.
Its initial release was in 2005 and is under active development.
Imperas is a suite of embedded software development tools for MIPS architecture which uses Just-in-time compilation emulation and simulation technology.
The simulator was initially released in 2008 and is under active development.
There are over 30 open source models of the MIPS 32 bit and 64 bit cores.