CPE 315
Winter 2008
Laboratory Project #5 - Worth 2 labs
Due Thursday, March 6 at the end of lab.



Lab 5 FAQ

Notes:
  1. This is an individual assignment.
    But you may write and share the hextoascii subroutine with one or two other people; be sure to give proper credit.
  2. All submission and plagiarism rules are in effect and will be enforced.
  3. You may not use any MIPS pseudo instructions in this lab (except la)


Objectives:

Files:
SPIM overflow demo: overflowDemo.asm

hextoascii subroutine specification: subroutine specs
You must write and use this subroutine exactly as specified.
You must use a FOR loop to process the 8 nibbles in a word.

Reference:
Sections A.6 - A.8 of our textbook.

Description:

  1. Note: you may use syscalls to print the messages.
    You may do the I/O using memory-mapped instructions if you wish.
    You will learn the memory-mapped registers really well and will earn 50% extra credit.
    See Echo chars example

  2. Write a program that creates one addressing error (your choice: exception 4,5,6 or 7). In the exception routine, identify the exception in the Cause register and print an appropriate message (must include type of exception and hex address of the offending instruction)
    Then return control to the program at the instruction AFTER the addressing error instruction.

    Note: the address must include at least one letter (a-f) as a test for hextoascii.

  3. Then create an overflow; you may do this any way you prefer.
    In the exception routine, identify the exception in the Cause register and print an appropriate message that includes the hex address of the offending instruction.
    Fix the overflow problem and return control to the program at the instruction that caused the overflow.

  4. Print a message that shows you returned to the program

  5. Run xspim with the following command line:
    xspim -noexception -file lab5.asm
  6. Prove the program works - either a demo on Mar. 6th or screen prints
    This lab requires lots of annotation.
    1. Show that your exception handler runs; after each exception, make a screen print of the kernel code and contents of the exception registers.
    2. Ensure that the EPC addresses contain both digits and letters.
      You can control the text address with the .text directive:
          e.g.       .text 0x0040010C
    3. Do a screen print showing the numbers that caused the overflow.

Deliverables

A formal lab submission as described in the syllabus.

Last updated on 2/28/08