COSC 201: Computer Organization
Lab 1: Using the SPIM Simulator
- Purpose
- Learn about the computers in the lab and how to use the SPIM
simulator.
- Method
- Run and modify a simple MIPS assembly program.
Load and run a more complex program.
- Preparation
- Read the SPIM instructions in section A.9 in the text.
- Files to use
- expression.s, factorial.s
- What to Hand In
- Modified copy of expression.s
- Create a directory for this course:
~/courses/201
- Create a working directory for this lab:
~/courses/201/lab01
- Save the files
expression.s and
factorial.s
into your lab01 directory.
- Open a new terminal window and type the following command to
start the spim simulator:
xspim
- Load the
expression.s program into the
simulator. Try running the program with both the run command and the
step command.
- Change in the program so that it evaluates the following
expression:
(10 + 9) - (8 + 7)
Document your change with appropriate comments. Run the program
again using the simulator to verify that it prints the correct
result.
- Load and run the program
factorial.s from your
lab01 folder. Single step through this program for part
of the execution. Read the code and comments to familiarize yourself
with a more complex sample of MIPS code. Observe the contents of the
different registers as you step through the program.
- Create a directory for completed assignments:
~/courses/201/assignments
- Save a copy of your modified
expression.s file in your assignements
directory.
- Send e-mail to your instructor when you have completed the
assignment. Your instructor will make a copy of your files for
grading.
- Do not forget to log out before you leave the lab!