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

1. Sum of three integers stored in the memory (like in the lecture (a) Specify m

ID: 3719206 • Letter: 1

Question

1. Sum of three integers stored in the memory (like in the lecture (a) Specify memory location using: [la] (b) Load immediate Integer-1 to register: [$t1] (c) Load immediate Integer-2 to register: $t2] (d) Load Immediate Integer-3 to register: $t3] (e) Store Integer-1 to Memory (f) Store Integer-2 to Memory (g) Store Integer-3 to Memory (h) Load Integer-1 from memory to Register: [St4] (i) Load Integer-1 from memory to Register: [ St5 (j) Load Integer-1 from memory to Register: | St6 ] (k) add: Integer-1 Integer-2 Integer-3: $t7] (1) Store the result of the addition again to memory (m) Load the result of the addition to register: [$t8 ].... DONE) . In the report also include the appropriate screenshot.

Explanation / Answer

Defining the variables:
array of type "word(4 bytes, same as integer)" of size 3 elements.
array: .word 3

Variable "sum" to store the addition of three integers:
sum: .word 0

(a) Specify memory location of array :
la $t0, array

(b) Load immediate Integer-1 to register $t1:
li $t1, Integer-1

(c) Load immediate Integer-2 to register $t2:
li $t2, Integer-2

(d) Load immediate Integer-3 to register $t3:
li $t3, Integer-3

(e) Store Integer-1 to memory, first element of array:
sw $t1, ($t0)

(f) Store Integer-2 to memory, second element of array:
sw $t2, 4($t0)

(g) Store Integer-3 to memory, third element of array:
sw $t3, 8($t0)

(h) Load Integer-1 from memory to $t4:
lw $t4, ($t0)

(i) Load Integer-2 from memory to $t5:
lw $t5, 4($t0)

(j) Load Integer-3 from memory to $t6:
lw $t6, 8($t0)

(k) Addition of three integers has to be done in two instructions:
add $t7, $t4, $t5
add $t7, $t6, $t7

(l) Store the result into variable "sum":
sw $t7, sum

(m) Load the result of the addition to $t8:
lw $t8, sum

Let me know if the solution does not satifies the requirements.