Question
The following are some additional pseudo-instructions that one could define for MIPS. in each case, supply an equivalent MIPS instruction or sequence of instructions with
The following are some additional pseudo-instructions that one could define for MIPS. in each case, supply an equivalent MIPS instruction or sequence of instructions with the desired effect. Recall that pseudo-instructions should change no registers except the destination register (if applicable, or PC for branch/jump), but pseudo-instructions may make use of $at for temporary results. BONUS: briefly describe the utility or usefulness of each pseudo-instruction
parta: xchg $rt, o[$rs] # swap the memory in M[$rs+o] with $rt
partb: slld $rs,$rt, shamt # Shift the double word rs:rt left by shamt
partc: double $rd, $rs # $rd = 2x($rs)
partd: triple $rd, $rs # $rd = 3x($rs)
parte: mulacc $rd, $rs, $rt # $rd = ($rd)+($rs)x($rt)
NOTES:
in parta, you are to load $rt from the effective address, and store $rt in the effective address, swapping the contents of the register and memory
in partb, treat rs and rt together as one 64-bit register, and shift it left by the shift amount shamt, storing the result bad in rs:rt
in parte, mulacc is short for multiply-accumulate. You can assume that the result of (reg1)x(reg2) will fit in a single register.
If you can't do a pseudo instruction with a single extra register $at, you may push the contents of a different register before the pseudo instruction, use that register, and then pop it's value afterwards.
Bonus: invent a new useful pseudo instruction and write the code for it. Explain why it is useful.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started