Textbook Notes (280,000)
US (110,000)
LSU (20,000)
CSC (200)
All (7)

Mips Assignment

Computer Science
Course Code
CSC 3501

This preview shows half of the first page. to view the full 2 pages of the document.
Assignment 1 (due Feb. 22th by the end of the day)
There are 4 problems. Please put the code for each problem in a separate file. Please use the
function name given below as the labels for your procedures. We will test your
implementation by calling procedures using these labels.
You should implement the functions in MIPS assembly. To compile and run the assembly
programs you write, you need to download the MARS MIPS simulator from:
(Java 1.4.2 or later is required for the simulator.)
Submission: email your programs (source code) as an attachment directly to TA:
Emran Chowdhury: mchowd3@lsu.edu
1. Tower of Hanoi
In this problem, there are three pegs, two empty and one with a set of N disks of
increasing size. The task is to move all the disks from their initial position to another peg
without placing a larger disk on top of a smaller one. The number of steps it takes to do
so can be computed using the following recursive function:
Hanoi(1) = 1 and
Hanoi(n) = 2*Hanoi(n-1)+1 for n>= 2
Implement a MIPS procedure
int Hanoi( int N )
that performs this computation and returns the number of steps. Your procedure must
make recursive calls to compute the number.
2. Vector dot product
Give two vectors:
A = 0, 1, , 1
B = 0,
You're Reading a Preview

Unlock to view full version