Please use computer organization and design 5th edition book
Solution
.data
A: .word 0:100 # array of 100 integers
B: .word 0:100 # array of 100 integers
.text
main:
li $t0, 4 # load the value \"1\" into register $t0
li $t1, 400 # load the value \"100\" into register $t1
la $a1, B
la $a0, A
loop:
add $t2, $a1, $t0 # $t2 = B + i
lw $s4, 0($a1) # $s4 = B[i]
add $t3, $t0, -4 # $t3 = i - 1
add $t4, $a0, $t3 # $t4 = A + i - 1
lw $s5, 0($t4) # $s5 = A[i - 1]
add $t5, $a0, $t0 # $t5 = A + i
add $t6, $s4, $s5 # $t6 = B[i] + A[i - 1]
sw $t6, 0($t5) # A[i] = $t6
addi $t0, $t0, 4 # i++
li $v0, 1 # system call for print_int
move $a0, $t6 # the sum to print
syscall # print the sum
blt $t0, $t1, loop # branches to Loop if $t0 < 100
