MC48 Lab 1 (Fall 1998)

Due: October 5, 1998

The goal of this lab is to get familiar with the xspim simulator, try out some of the simple programs we've been writing in class, and write and test a couple more programs of your own. In this lab, we'll steer clear of fancy things like recursion and other uses of memory; that's what the next lab is for.

Your lab write up can be short and sweet, but it should be English. You should communicate everything you did at some level of detail, but for the uninteresting parts, you can summarize in broad outline, while for the more interesting parts, you can go into detail. Specific details I will expect to see are the two programs you are asked to write, and test data and results from those two programs. Make sure your testing is systematic and thorough. Thorough doesn't mean using large quantities of weird numbers that still only test the same cases; rather, it means using carefully chosen tests to ensure that all cases are covered and all likely bugs exposed, while still allowing the answers to easily be hand-checked. You can do this lab on either a an SGI or a Linux PC (in OHS 326 or 329). You will use xspim, as described in Appendix A of the book. To run it, you can also just type xspim in a shell window. Let me know if you have troubles with this or other Unix/X-windows user interface stuff.

Start by stepping through simple programs, like one to add two numbers. This part of the lab is to make sure you are comfortable with SPIM.

Now you have two programs to write and test and debug (if necessary). You can do these in whichever order seems more natural for you.

  1. Do exercise A.6 from page A-76.
  2. Do exercise A.7 from page A-77. Do not add all three numbers and then subtract off the smallest, since that might fail if the addition of all three overflowed the range of numbers representable in 32 bits. However, you may none the less find it useful to think about identifying which one number is the smallest, rather than about identifying which two numbers are the largest.

Instructor: Max Hailperin