CSE 378: Machine Organization and Assembly Language
Getting Started With SPIM and XSPIM
-
Login to your account on sanjuan or orcas.
-
Edit your .cshrc (or your .mycshrc, if you have one) file
to include the following line at the end of the file:
source /cse/courses/cse378/99au/bin/spim-setup
You need to make the above changes only once. By including the above line,
you will have easy access to spim and xspim, as well as the
(scant) man page documentation.
-
Logout and login again so that the changes take effect.
-
Find out the name of the X-terminal (or workstation) on which you are working
(the name should be taped to the terminal). Then type the following at
the prompt:
setenv DISPLAY machine-name:0.0
where machine-name is the name of the terminal you are using. You will
need to set this environment variable each time you log in. Doing so allows
sanjuan or orcas to send display information to your terminal.
Note: this may not be necessary on all X-terms, as some of them are directly
connected to the instructional machines. (To find out if the DISPLAY environment
variable is set correctly, you can check its value by typing: setenv
| grep DISPLAY.)
-
You are now ready to run xspim which you do by entering:
xspim &
at the prompt. The & character tells UNIX to run xspim in the background.
This allows you to continue using the terminal window from which you started
xspim to do other work, read mail, etc...
-
After starting xspim, you should see a window like this:
![](xspim.gif)
-
Notice the 5 distinct segments:
-
Register Display. Displays the values of all registers
-
Control Buttons. Where you issue SPIM commands.
-
Text Segments. Displays addresses and assembly code.
-
Data and Stack Segments. Displays data and values on stack
-
SPIM Messages. Displays SPIM messages when running a program
-
Use the "load" button to load your assembly file.
-
There are several options to run the program:
-
Use the run button. This will run the program to completion.
-
Use the step button. This will run the program "increment" instructions
at a time. If you set the increment to 1, it will run the program instruction
by instruction.
-
Use the breakpoint command to stop the execution at a given address.
Along with the set command, this is a useful debugging tool.
Original by brd@cs.washington.edu, Spring 1997.
Modified by wolman@cs.washington.edu, Autumn 1997.