Department of Electrical Engineering and Computer Science
EECS 61C, Summer 2004
Lab 2-2
Goals
These lab
exercises are intended to familiarize you with recursive function calls in MIPS,
and give you practice on more advanced instructions as well as testing your
understanding of the MIPS conventions.
Exercise 1:
Function Calls and Recursion in MIPS
Copy
the file fib.s from
~cs61c/labs/lab2-2 into your home directory.
Part a) Multiplier
Implement the
function called Multiply, in the same fib.s
file, that takes two integers in $a0 and $a1 and puts
the lower 32 bits of the result
in register $v0. You do not
need to detect overflow. DO NOT use
the MIPS instruction mul, write your own function to
multiply.
Part b) Fibonacci
Write a
function called fib that takes
an integer n as argument in register $a0 and computes the nth fibonacci value using
recursion, puts the result in register $v0.
Verify that C ignores integer overflow in two ways: