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

The $a0 register is used to store a return address from a function call. T/F Wri

ID: 2084236 • Letter: T

Question

The $a0 register is used to store a return address from a function call. T/F Write the following sequence of code into MIPS assembler: a = (a - b) + (c - d) Assume that a, b, c, d are stored in registers $s1-$s4. Write the following sequence of code into MIPS assembler: a = (a + 10) + (b + 20) + (c + 9) Assume that a, b, c are stored in registers $s1-$s4. Let's suppose we have a 40-year-old computer that has an instruction execution rate of one thousand instructions per second. How long would it take in days, hours, and minutes, to execute the same number of instructions that you derived for the 500 MHz machine? Which of the following MIPS functions are R-type? -add, -sub, -addi, -lw, -SW Which of the following MIPS functions are I-type? -add, -sub, -addi, -lw, -SW What is the Difference between program counter and instruction register?

Explanation / Answer

2)TRUE

3)The operation a=(a-b)+(c-d) can be implemented using one step in c language. But in MIPS we have to implement it in three steps

so, we need multiple instructions to implement the given sequence

sub t0,a,b

sub t1,c,d

add a,t0,t1

given that assume that a,b,c,d values lies in the registers $1-$4, then the implementation is as follows

sub t0,$1,$2

sub t1,$3,$4

add $1,t0,t1

4)The operation a=(a+10)+(b+20)+(c+9) canbe implemented in 4 steps

add t0, a,10

add t1,b,20

add t2,c,9

add a,t0,t1,t2

as the values of a,b,c are stored in registers $1-$3

add t0,$1,10

add t1,$2,20

add t2,$3,9

add a,t0,t1,t2

5)time=1/frequency

given that frequency=500MHz

time=2*10-9secs

6a)R-type instructions in MIPS are used while all the data values are used by the instruction are alredy registered.

from the given functions the arithematic functions add(addition), sub(subtraction)are R-type MIPS functions.

6b) I-type insrtuctions in MIPS are used when instruction must have to operate immediate value and register value.

From the given functions addi(addition immediately), lw(load word),sw(store word) comes under I-type MIPS functions.

7)The PC and IR are used in stack overflow.