Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

** Please Give Detailed explanation ** One extension of the MIPS instruction set

ID: 3822955 • Letter: #

Question

** Please Give Detailed explanation **

One extension of the MIPS instruction set architecture has two new instructions called movn (move if not zero) and movz (move if zero). For example, the instruction

           movn $8, $11, $4

         

copies the contents of register 11 into register 8, provided that the value in register 4 is nonzero (otherwise it does nothing). The movz instruction is similar but copying takes

place only if the register’s value is zero. Show how to use the new instructions to put whichever is larger, register 8’s value or register 9’s value, into register 10. If the values are equal, copy either into register 10. You may use register 1 as an extra register for temporary use. Do not use any conditional branches.

** Please give detailed explanation **

Explanation / Answer

Answer:

slt $1, $8, $9

movz $10, $8, $1

movn $10, $9, $1