What is the single MIPS instruction or the shortest sequence of MIPS instruction
ID: 3667075 • Letter: W
Question
What is the single MIPS instruction or the shortest sequence of MIPS instructions that performs:
e. y[30] = y[40] + x, assuming x corresponds to register R9, and y is an array of integers with y[0] an integer at the memory location 1,048,596
f. x = y * w, assuming x, y, and w are integer variables in memory locations 4000,2000, and 3004, respectively.
g. if (x => y) Goto lab1
Assume that variable x corresponds to a word at memory address 800, and variable y corresponds to a word at memory address 1000. The instruction with lab1 is after the branch instruction and there are 30 instructions between those two instructions.
Explanation / Answer
e.
lw $t0, 1048596
addi $t1, $t0, 120 # y[30] address
addi $t0, $t0, 160 # y[40] address
addi ($ti), ($t0), 10 # y[30] = y[40] + 10
f.
lw $t0, ($2000) # value of y
lw $t1, ($3004) # value of w
mul ($4000), ($t1), ($t0)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.