I'm working my way through a MIPS asm tutorial at the moment, but there are no solutions to the exercises.
I also have a little trouble understanding the questions, I don't know if it is my english skills, or
just the tutorial author being a little unclear. Anyway, here is the question, copied from the site.
Now, using only register-to-register logic and shift instructions, rearrange the bit pattern so that register $2 gets the bit pattern 0x0000CAFE.
Write this program so that after the low 16 bits of $1 have been set up with any bit pattern, no matter what bit pattern it is, the nibbles in $2 are the same rearrangement of the nibbles of $1 shown with the example pattern. For example, if $1 starts out with 0x00003210 it will end up with the pattern 0x00001230
A. Moderately Easy program: do this using ori instructions to create masks, then use and and or instructions to mask in and mask out the various nibbles. You will also need rotate instructions.
B. Somewhat Harder program: Use only and, or, and rotate instructions.
What I don't understand here is if I should do this with registers $1 and $2 only, or if can use other registers.
Would this assignment be possible with just 2 registers? I got it to work with 3 registers, going the "somewhat harder"
way, but if I'm meant to do it with 2 registers, then I can't consider myself done with this problem.