CSCI-2500 Computer Organization

Fall 2000

Homework 3
Due Date: Oct 27th by 11:59 PM


You are to write a MIPS assembly program that functions as a simple calculator. Your calculator will read 2 integer numbers from the SPIM console, then an operation (this order just makes the I/O a little easier when using SPIM). You must support addition, subtraction, multiplication and division. You are not allowed to use the MIPS multiplication instructions or division instructions.

You program will use the SPIM syscall I/O support to read a number from the console, then read another number, and finally read the operation (as a string). You can assume that all numbers are entered correctly, so you don't need to do any error checking on the numbers. You should print out an error message if the operation specified by the user is not one of the 4 listed below.

If the operation enter is '+', you should print out the sum of the 2 numbers, '-' the difference, '*' the product and '/' the integer quotient.

Feel free to use the multiplication subroutine we went over in class and available in the sample code at http://www.cs.rpi.edu/~hollingd/comporg/spim. You must write your own division subroutine without using any multiplication or division MIPS instructions.

Deliverables

Your submission must include the following:

Submission Instructions

Submit via email to comporg-submit@cs.rpi.edu with the subject line "3". Complete submission instructions are here. Please make sure you send submissions to comporg-submit@cs.rpi.edu not to comporg@cs.rpi.edu!!!