Question: Exercise 2.17 For these problems, several instructions that are not included in the MIPS instruction set are shown. a. abs $t2, $t3 # R[rd] =
Exercise 2.17 For these problems, several instructions that are not included in the MIPS instruction set are shown.
a. abs $t2, $t3 # R[rd] = |R[rt]|
b. sgt $t1, $t2, $t3 # R[rd] = (R[rs] > R[rt]) ? 1:0 2.17.1 [5] <2.7> The table above contains some instructions not included in the MIPS instruction set and the description of each instruction. Why are these instructions not included in the MIPS instruction set.
2.17.2 [5] <2.7> The table above contains some instructions not included in the MIPS instruction set and the description of each instruction. If these instructions were to be implemented in the MIPS instruction set, what is the most appropriate instruction format?
2.17.3 [5] <2.7> For each instruction in the table above, fi nd the shortest sequence of MIPS instructions that performs the same operation.
For these problems, the table holds MIPS assembly code fragments. You will be asked to evaluate each of the code fragments, familiarizing you with the different MIPS branch instructions.
a. LOOP: slt $t2, $0, $t1 bne $t2, $zero, ELSE j DONE ELSE: addi $s2, $s2, 2 subi $t1, $t1, 1 j LOOP DONE:
b. LOOP: addi $t2, $0, 0xA LOOP2: addi $s2, $s2, 2 subi $t2, $t2, 1 bne $t2, $0, LOOP2 subi $t1, $t1, 1 bne $t1, $0, LOOP DONE:
2.17.4 [5] <2.7> For the loops written in MIPS assembly above, assume that the register $t1 is initialized to the value 10. What is the value in register $s2 assuming the $s2 is initially zero?
2.17.5 [5] <2.7> For each of the loops above, write the equivalent C code routine.
Assume that the registers $s1, $s2, $t1, and $t2 are integers A, B, i, and temp, respectively.
2.17.6 [5] <2.7> For the loops written in MIPS assembly above, assume that the register $t1 is initialized to the value N. How many MIPS instructions are executed?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
