Hennessy-Patterson

CS 2731 Computer Organization II -- Spring 2003
Take-Home Quiz: Exceptions
(Work on as preparation for the final exam)

The quiz is based on the following MIPS assembler program, including a very small exception handler. (This exception handler is a greatly simplified version of the standard one.) Execution starts at line 30, which then calls main. In running this code, the -notrap option must be used (and must be placed first after spim), that is:

Below is the code (line numbers to the left are not part of the code). Here is the source of the above code without line numbers: quiz_exception.s

Questions:
  1. What will happen if the above code is run without lines 27 through 32 and without the -notrap option, that is, with % spim -file quiz_exception0.s? This code is given below and in quiz_exception0.s:

  2. Assume now that the entire program is run with the -notrap option. Starting with line 2, describe what is printed when this code segment executes lines 2 through 12. Will Duhh-hhhhh! be printed and if so, why?

  3. What (if anything) is line 26 (jr $k0) doing? What would happen if line 25 (addiu $k0 $k0 4) were omitted?


Revision date: 2003-04-29. (Please use ISO 8601, the International Standard.)