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

1. Provide a single MIPS assembly instruction or a sequence of MIPS assembly ins

ID: 3878594 • Letter: 1

Question

1. Provide a single MIPS assembly instruction or a sequence of MIPS assembly instructions that performs: a. incrementing register $10 by 1020 b. loading register $10 with value -33 c. incrementing register $10 by 524,295 d. storing value -2 in a word at memory location 524,296 e· y[51] = y[22] + z, assuming z corresponds to register $10, and y [O] integer at the memory location 1,048,580; Note y is an array of integers f. x y * w, assuming x, y and w are integer variables in memory locations 8000, 9000 and 9004, respectively g, a b * c, assuming a, b and c are single precision real variables in memory locations 8008, 8000 and 8004 respectively. h, if (a => b) goto ABC Assume that variable a corresponds to word at memory address 9000, and variable b to word at memory address 3500The instruction at ABC is after the branch instruction and there are 200 instructions between those two instructions. i. if (a

Explanation / Answer

a. addi $10, $10, 1020 #increment register 10 by 1020

b. li $10, -33 #load -33 into register 10

c. addi $10, $10, 524295 #add 524295 to $10

d. li $5, -2 #load -2 into $5
sw $5, 524296 #store $5 in 524296 memory location

e. li $5, 22 #load offset y[22]
mul $5, $5, 4 #multiply by 4 for byte offset
lw $7, 1048580($5) #load y[22] into $7
li $6, 51 #load offset y[51]
mul $6, $6, 4 #multiply by 4 for byte offset
add $7, $7, $10 #add $10 to y[22]
sw $7, 1048580($6) #store in y[51]

f. lw $5, 9000 #load contents at 9000 (y)
lw $6, 9004 #load contents at 9004 (z)
mul $5, $5, $6 #multiply both
sw $5, 8000 #store at 8000 (x)

g. lw $5, 8000 #load contents at 8000 (b)
lw $6, 8004 #load contents at 8004 (c)
mul.s $5, $5, $6 #multiply both with single precision
sw $5, 8008 #store in 8008 (a)

h. lw $5, 9000 #load contents at 9000
lw $6, 3500 #load contents at 3500
bge $5, $6, ABC #compare both, if >= go to ABC
#200 instructions
ABC:

i. XYZ:
#200 instructions
blt $5, $7, XYZ #compare $5, $7, if < go to XYZ

j. mfc1 $5, $f2 #load $f2 into $5
addi $5, $5, 1020 #increment $5 by 1020
mtc1 $5, $f2 #store $5 into $f2

Hope this helps. Do Upvote! :)