Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is assemble programming. Here is a code, .data arrayA: .word 1, 1, 0, 0 arr

ID: 3869789 • Letter: T

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, 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 arrayB’s initialized data has been overwritten (destroyed) by the program.

Explanation / Answer

Instruction for a future loop:-

    addi $t0,$zer0,16
    la $t1,arrayA
    loop_start:
        addi $t0,$t0,-1
        bne $t0,$zero,loop_start


Write instructions to complete body to loop:

.data
    arrayA: .word 1,1,0,0
    arrayB: .word 0xffff,0xffff,0xffff,0xffff
  
.text
    addi $t0,$zer0,16
    la $t1,arrayA
    loop_start:
        lw $t2,0($t1)
        lw $t3,4($t1)
        add $t4,$t2,$t1
        sw $t4,8($t1)
        addi $t1,$t1,4
        addi $t0,$t0,-1
        bne $t0,$zero,loop_start
  
   

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote