Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment needs to be written in MIPS Assembly : This is the skeleton code given: 4. The Fibonacci number sequence is 1, 1, 2,

This assignment needs to be written in MIPS Assembly:

image text in transcribedThis is the skeleton code given:

image text in transcribed

4. The Fibonacci number sequence is 1, 1, 2, 3, 5, 8, 13, ... Each number is the sum of the previous two, and the first two numbers are both 1. An array named arrayA will contain sixteen values of the Fibonacci sequence. The array is initialized with the first two l's of the sequence, and the remaining values of the sequence will be computed using a loop and stored in arrayA. 5. Write instructions to prepare for a future loop, including the following actions: Choose a register to use as the loop index counter Initialize the loop counter to a value of 16. Put the address of array into a register, using the la instruction. 6. Run the code you've written so far and verify that the outcome is as you expect. 7. Write instructions to complete the body of the loop, including the Remember: following actions: Sequential loop Use lw instructions to move two values from stored memory index values arrayA to registers. Add those two registers together changeby 1. Store that sum into the the arrayA at the correct location. Increment the "base address" in the register that originally contained the Sequential wordt addresses address of arrayA, for use during the next iteration of the loop Increment the loop counter value 8. Run the code you've written so far and verify that the outcome is as you expect. 9. Your program should have computed and stored in memory the values of the Fibonacci sequence (1, 1, 2, 3, 5, 8, 13, ...). Note that arrayB's initialized data has been overwritten (destroyed) by your program. n of the loop change by 4. .data arrayA: .word 1, 1, 0, 0 arrayB: .word Oxffff, Oxffff, Oxffff, Oxffff .text addi $50, $zero, 16 # This is a common way to initialize a register: addi the desired value to $zero #initialize the counter variable to 16 la $ao, arrayA #put the starting address of arrayA to register ao top: addi $se, $s0, -1 bne $50, $zero, top

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

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions