Computer Organization and Structure

 

Homework #2

Due: 2005/11/17~18

 

Please write the following programs in MIPS assembly language.

 

1.      Fibonacci Sequence:
write a program that uses a loop to calculate and print out the first ten values in the Fibonacci number sequence.

 

2.      Pascal’s Triangle:
write a program to compute and display the Pascal’s triangle with given depth.

 

BONUS

 

Large-Number Calculator:
implement a calculator that can perform arithmetic operations for large signed integer numbers.
ex: (-98765432109876543210+(1234567890987654321/5712121))*1357924680

 

Hint:

 

a.         Write four procedures for the four basic arithmetic operations: +, -, *, /

b.        Write a program that can input an expression and then use the above four procedures to evaluate this expression. The expression contains:

Ø        Signed integer numbers with at most 40 digits

Ø        Operators: +, -, *, /

Ø        Parentheses: ()

 

Submission & Grading

 

Please demo your programs to TAs during the deadline, on the demo day please

 

a.         hand-in your hardcopy document

b.        demo and explain the programs to TAs personally

c.         leave your source code as a copy on the computer

 

NOTE

 

a.         learn more on net, discuss with each other but write your own code

b.        any similar homework get ZERO points without mercy
(both the original and the copy)