Question: This is assemble programming. Here is a code, .data arrayA: .word 1, 1, 0, 0 arrayB: .word 0xffff, 0xffff, 0xffff, 0xffff .text addi $s0, $zero,

This is assemble programming.

Here is a code,

.data

arrayA: .word 1, 1, 0, 0

arrayB: .word 0xffff, 0xffff, 0xffff, 0xffff

.text

addi $s0, $zero, 5 # This is a common way to initialize a register: addi the desired value to $zero

top: addi $s0, $s0, -1

bne $s0, $zero, top

Write instructions to prepare for a future loop, including the following actions:

1.Choose a register to use as the loop index counter

2.Initialize the loop counter to a value of 16.

3.Put the address of arrayA into a register, using the la instruction.

Write instructions to complete the body of the loop, including the following actions:

1.Use lw instructions to move two values from stored memory arrayA to registers.

2.Add those two registers together

3.Store that sum into the the arrayA at the correct location.

4.Increment the base address in the register that originally contained the address of arrayA, for use during the next iteration of the loop

5.Increment the loop counter value

This program should have computed and stored in memory the values of the Fibonacci sequence (1, 1, 2, 3, 5, 8, 13, ). Note that arrayBs initialized data has been overwritten (destroyed) by the program.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!