Question: Develop the following MIPS pseudo instructions. You may use the $at register and the stack to store temporary results. Also comment your code. a). parity
Develop the following MIPS pseudo instructions. You may use the $at register and the stack to store temporary results. Also comment your code.
a). parity reg2, reg1
Computes the parity (serial XOR of all bits) of the 32-bit MIPS register reg1 and stores the result (000 or 001) in reg2.
b). movx srcreg, destreg, countreg
This instruction moves a (32-bit) word array of number of elements provided in countreg starting at memory address pointed by the srcreg register to the memory address starting at the memory address destreg. (You may assume that the two arrays are stored at non-overlapping locations in memory.)
c). bswap reg2, reg1
Swaps the bytes of the 32-bit MIPS register reg1 and stores the result in reg2, e.g. b0,b1,b2,b3 becomes b3,b2,b1,b0. Note that this pseudo-instruction can be used to convert the endianness of a word.
d). sum srcreg, sumreg, countreg
This instruction computes the sum of a word array of number of elements provided in register countreg starting at memory address pointed by the srcreg register. The sum is stored in the register sumreg.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
