Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions