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

  1. Create a directory for this course: ~/courses/201
  2. Create a working directory for this lab: ~/courses/201/lab01
  3. Save the files expression.s and factorial.s into your lab01 directory.
  4. Open a new terminal window and type the following command to start the spim simulator: xspim
  5. Load the expression.s program into the simulator. Try running the program with both the run command and the step command.
  6. 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.
  7. 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.
  8. Create a directory for completed assignments: ~/courses/201/assignments
  9. Save a copy of your modified expression.s file in your assignements directory.
  10. Send e-mail to your instructor when you have completed the assignment. Your instructor will make a copy of your files for grading.
  11. Do not forget to log out before you leave the lab!