Question: Exercise 2.13 In the following problems, the data table contains the values for registers $t0 and $t1. You will be asked to perform several MIPS
Exercise 2.13 In the following problems, the data table contains the values for registers $t0 and $t1. You will be asked to perform several MIPS logical operations on these registers.
a. $t0 = 0x55555555, $t1 = 0x12345678
b. $t0 = 0xBEADFEED, $t1 = 0xDEADFADE 2.13.1 [5] <2.6> For the lines above, what is the value of $t2 for the following sequence of instructions:
sll $t2, $t0, 4 or $t2, $t2, $t1 2.13.2 [5] <2.6> For the values in the table above, what is the value of $t2 for the following sequence of instructions:
sll $t2, $t0, 4 andi $t2, $t2, –1 2.13.3 [5] <2.6> For the lines above, what is the value of $t2 for the following sequence of instructions:
srl $t2, $t0, 3 andi $t2, $t2, 0xFFEF In the following exercise, the data table contains various MIPS logical operations.
You will be asked to fi nd the result of these operations given values for registers
$t0 and $t1.
a. sll $t2, $t0, 1 or $t2, $t2, $t1
b. srl $t2, $t0, 1 andi $t2, $t2, 0x00F0 2.13.4 [5] <2.6> Assume that $t0 = 0x0000A5A5 and $t1 = 00005A5A. What is the value of $t2 after the two instructions in the table?
2.13.5 [5] <2.6> Assume that $t0 = 0xA5A50000 and $t1 = A5A50000. What is the value of $t2 after the two instructions in the table?
2.13.6 [5] <2.6> Assume that $t0 = 0xA5A5FFFF and $t1 = A5A5FFFF. What is the value of $t2 after the two instructions in the table?
Exercise 2.14 The following fi gure shows the placement of a bit fi eld in register $t0.
Field 31 – i bits i – j bits j bits In the following problems, you will be asked to write MIPS instructions to extract the bits “Field” from register $t0 and place them into register $t1 at the location indicated in the following table.
a.
0 0 0 … 0 0 0 Field b.
0 0 0 … 0 0 0 Field 0 0 0 … 0 0 0 2.14.1 [20] <2.6> Find the shortest sequence of MIPS instructions that extracts a fi eld from $t0 for the constant values i = 22 and j = 5 and places the fi eld into $t1 in the format shown in the data table.
2.14.2 [5] <2.6> Find the shortest sequence of MIPS instructions that extracts a fi eld from $t0 for the constant values i = 4 and j = 0 and places the fi eld into $t1 in the format shown in the data table.
2.14.3 [5] <2.6> Find the shortest sequence of MIPS instructions that extracts a fi eld from $t0 for the constant values i = 31 and j = 28 and places the fi eld into $t1 in the format shown in the data table.
In the following problems, you will be asked to write MIPS instructions to extract the bits “Field” from register $t0 shown in the fi gure and place them into register $t1 at the location indicated in the following table. The bits shown as “XXX” are to remain unchanged.
a.
X X X … X X X Field b.
X X X … X X X Field X X X … X X X 2.14.4 [20] <2.6> Find the shortest sequence of MIPS instructions that extracts a fi eld from $t0 for the constant values i = 17 and j = 11 and places the fi eld into $t1 in the format shown in the data table.
2.14.5 [5] <2.6> Find the shortest sequence of MIPS instructions that extracts a fi eld from $t0 for the constant values i = 5 and j = 0 and places the fi eld into $t1 in the format shown in the data table.
2.14.6 [5] <2.6> Find the shortest sequence of MIPS instructions that extracts a fi eld from $t0 for the constant values i = 31 and j = 29 and places the fi eld into $t1 in the format shown in the data table.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
