Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

8 . 6 LAB: Array of Fibonacci sequen 8 . 6 LAB: Array of Fibonacci sequence - loop Write a program to populate an array

8.6 LAB: Array of Fibonacci sequen8.6 LAB: Array of Fibonacci sequence - loop
Write a program to populate an array with Fibonacci numbers. The Fibonacci sequence begins with 0 and then 1, each following number is
the sum of the previous two numbers. Ex: 0,1,1,2,3,5,8,13. Assume the size of the array is always at least 1. Use the '+' button under the
Registers display to store the size of an integer array in $ to and the address of the first element of the array in the memory in $1.
Ex: If $ to and $ t 1 are initialized in the simulator as 5 and 5000, the data memory starting at address 5000 will contain:
Line 1 main:
Line 2 sw $t2,0($t1)
Line 3 addi $ t1, $ t ,4
Line 4
Line 5
Sw $t2,0($t1)
Line 6
addi $t1,$t1,4
Line 7
Line 8
Line 9 fib_loop:
Line 10 add $t7, $t5, $t6
Line 11 sw $t7,0($t1)
Line 12
Line 13
Line 14
Line 15
Line 16
Line 17
Line 18
Line 19
addi $t3,$t3,1
addi $t1,$t1,1
move $t5, $t6
move $t6, $t7
bne $t3, $t0, fib_loop
Compare storage A
Write a program to populate an array with Fibonacci numbers. The Fibonacci sequence begins with 0 and then 1, each following number is
the sum of the previous two numbers. Ex: 0,1,1,2,3,5,8,13. Assume the size of the array is always at least 1. Use the '+' button under the
Registers display to store the size of an integer array in $t0 and the address of the first element of the array in the memory in $t1.
Ex: If $ t0 and $ t 1 are initialized in the simulator as 5 and 5000, the data memory starting at adress 5000 will contain:
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

1. I love iguanas.

Answered: 1 week ago