In: Computer Science
Consider the following unsigned decimal constants: 12345, 34567, 9876543.
Perform the following operations:
Note: Do not use any pseudo instructions to do so.
(a) Write MIPS instruction(s) to store each constant in temporary registers(i.e., any of $t0, $t1, . . . $t7)
(b) Write MIPS instruction(s) to perform an addition operation of the given numbers with the decimal number 123.
Make sure the numbers follow the size limitations of the immediate instruction type.
Please up vote ,comment if any query . Thanks for Question .Be safe .
Note : check attached for register value after addition . code tested in MARS MIPS simulator .
Program Plan :
Program :
.data
.text #code section
main:
li $t0,12345 #load
immediate value 12345 into $t0
li $t1,34567 #load
immediate value 34567 into $t1
li $t2,9876543 #load immediate
value 9876543 into $t2
addi $t3,$t0,123 #add 123 to $t3
$t3=$t0+123
addi $t4,$t1,123 #add 123 to $t4
$t4=$t1+123
addi $t5,$t2,123 #add 123 to $t5
$t5=$t2+123
#terminate program
li $v0,10
syscall
Output :
Please comment if you want any changes . Be safe .