Starting from:

$30

CSCI231-Lab Exercise 1 Solved

Write a program in MIPS assembly language that computes the first seven values of the fibonacci sequence*​ and stores those values in memory. Initialize ​F​0​ = 0 and ​F​1​ = 1. After running your program, the data segment window should show all seven values. Hint: Please use an array to store those values. You can initialize your array as “Fib: ​ ​  .word 0 1 ” (that means​         Fib[0] = 0, Fib[1] = 1) in the .data​    ​ section, and to get the address of this array, use “​la $s0, Fib​” (that means $s0 = addr(Fib[0])) in the .text​   section. The seventh value of fibonacci sequence is​    

F​6​ = 8.

 

 ​* ​The sequence Fn​ ​ of Fibonacci numbers is defined by the recurrence relation:  

 F​n​ = ​F​n−1​ + ​F​n−2​, with ​F​0​ = 0 and ​F​1​ = 1.  


More products