Pseudo to Real MIPS. Convert the following pseudo instructions to Real MIPS inst
ID: 3710151 • Letter: P
Question
Pseudo to Real MIPS. Convert the following pseudo instructions to Real MIPS instructions. MIPS has a dedicated register, Sat, which can be used by the assembler, and only in the case you need more registers for implementing these pseudo instructions, you can use Sto. (a) lwine reg1, imm(reg2) Load the value at the address of Mem/reg2 + imm and then set reg2 equal 2 (b) setr reg1, reg2, reg3 - Set the value of reg1 to 1 if the previous value of reg1 is between the values TIS: of reg2 and reg3. Otherwise, set the value of regl to 0.Explanation / Answer
ScreenShot
Question b) Program
#Main program
.text
#set values for check
addi $t1,$0,4 #register2 as 4
addi $t2,$0,6 #register3 as 6
addi $t0,$0,5 #register1 as 5
ble $t0,$t1,exit #if lessthan or equal to reg2 then go to exit
bge $t0,$t2,exit #if greaterthan or equal to reg3 then go to exit
addi $t0,$0,1 #between reg2 ang reg3 then set reg1=1
#end of the program
li $v0,10
syscall
#if the value of reg1 less than reg2 and greater than reg3
exit:
#set reg1=0
addi $t0,$0,0
#end of the program
li $v0,10
syscall
-------------------------------------------------------------------------------------------
Question a) Program
#space for reg2 address
.data
address: .space 10
#Main program
.text
#load memory into reg2
la $t1,address
#add immediate value with reg2
addi $t1,$t1,8
#move address into reg1
move $t0,$t1
#increment address into 4
addi $t0,$t0,4
#move that addree into reg2
move $t1,$t0
#end of the program
li $v0,10
syscall
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.