Docsity

MIPS Homework 8: Fibonacci Numbers and Factorial Computation, Assignments of Electrical and Electronics Engineering

Toggle sidebar
bg1
EE 3755 MIPS Homework8 Due: Not to be submitted
Estimated time to finish:
Prob. 1 : 120 Minutes.
Prob. 2 : 20 Minutes.
Prob. 3 : 50 Minutes.
Total : 190 Minutes.
Problem 1: Write MIPS program to compute Fibonacchi number :
(120 Mins)
Fibonachi number:
0,1,1,2,3,5,8,13,…..
F(n) = 0 when n = 0;
F(n) = 1 when n = 1;
Otherwise F(n)= F(n-1) + F(n-2)..
# hint: stack memory and procedure call and return.
#
FIBO: …
…
j $ra
nop.
Problem2 : Write drive program and check the result.(20Mins)
.data
textdata: .asciiz “Fibonacci number is =\n”
# output format and output when n = 4.
#
# “n = 4”
# ”Fibonacci number is = 3”
# Sol)
.text
.globl __start # or main..
__start:
Problem 3: Write MIPS program to compute Factorial.
(50 Mins)
Factorial:
1,1,2,6,24,120,…..
F(n) = 1 when n = 0;
Otherwise F(n)= n* F(n-1).
pf2

Partial preview of the text

Download MIPS Homework 8: Fibonacci Numbers and Factorial Computation and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

EE 3755 MIPS Homework 8 Due: Not to be submitted

Estimated time to finish: Prob. 1 : 120 Minutes. Prob. 2 : 20 Minutes. Prob. 3 : 50 Minutes. Total : 190 Minutes. Problem 1: Write MIPS program to compute Fibonacchi number : (120 Mins) Fibonachi number: 0,1,1,2,3,5,8,13,….. F(n) = 0 when n = 0; F(n) = 1 when n = 1; Otherwise F(n)= F(n-1) + F(n-2).. # hint: stack memory and procedure call and return. # FIBO: … … j $ra nop. Problem2 : Write drive program and check the result.(20Mins) .data textdata: .asciiz “Fibonacci number is =\n” **_# output format and output when n = 4.

“n = 4”

”Fibonacci number is = 3 ”_**

Sol)

.text .globl __start # or main.. __start: Problem 3: Write MIPS program to compute Factorial. (50 Mins) Factorial: 1,1,2,6,24,120,….. F(n) = 1 when n = 0; Otherwise F(n)= n* F(n-1).

# hint: stack memory and procedure call and return. .