Question: Write MIPS instruction sequences to perform the following operations. Do not use pseudoinstructions. (That means no LI, MOVE, etc.) In addition to OR, ORI, AND,
Write MIPS instruction sequences to perform the following operations.
Do not use pseudoinstructions. (That means no LI, MOVE, etc.)
In addition to OR, ORI, AND, and ANDI, the MIPS ISA also has NOR (R-Type), XOR (R-Type) and XORI (I-Type). Make the best use of all logical instructions.
Use LUI if you need to load data into the upper 16 bits
For full credit you must use a minimum length sequence.
For each operation, the input and output register is specified. Use the $t registers if other registers are needed.
---------------------
a) Extract byte 2 (bits 16 to 23) of the value stored in $s0, placing it in the low order byte (bits 0 to 7) of $s1. All other bits should be 0. (2 instructions)
b) Clear bits 12 to 15 of $s0 (modify $s0 in place). Leave the other bits unmodified. (1 instruction)
c) Set bits 22 and 23 of $s0 (modify $s0 in place). Leave the other bits unmodified. (2 instructions)
d) Invert the even bits (bit 0,2,4,6,..30) of $s0. Leave the odd bits unmodified. (3 instructions)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
