Lab 04: Exploring Logical and Arithmetic Operations

In this laboratory, you will explore the use of arithmetic and logical operations. Besides the MIPS processor already has a multiplier in the hardware, in this laboratory you will implement a algorithm for multiply two signed numbers. Most of the architectures for deeply embedded systems are simple microcontrollers of 8 or 16 bits that don't have a hardware multiplier. In this architectures the multiplication is performed on software.

Your job in this lab, is implement on software a 16 bit multiplier using the SPIM, storing the result in a 32-bit register. Follow the third multiply algorithm described in the class book "Computer Organization and Design: the Hardware and Software Interface" [Patterson,1997], pages 144-153, in your implementation. Remember to take care of signed numbers.

The Base Program file contains the implementation of two functions to help you to print data on the screen. Call the function print_int passing an integer as first argument to print it on the screen. To print strings on the console, use the function print_string passing the address of the string (null terminated) as first argument.

Supplied Files