No pseudoinstructions!!! Implement the following using MIPs instructions. Do not
ID: 3875953 • Letter: N
Question
No pseudoinstructions!!!
Implement the following using MIPs instructions. Do not use any pseudoinstructions for this problem. Branch to a label "stage2" if $tO is greater than or equal to $t1. 3. 4. Implement the following using MIPs instructions. Do not use any pseudoinstructions for this problem. If $s1 is less than $s2, set $t5 to 4, otherwise set $t5 to 5 Implement the following using MIPs instructions. Do not use any pseudoinstructions for this problem. While $t4 is less than 7, increment t4 by 1 (set $t4 to 0 before the loop starts) 5.Explanation / Answer
1.
slt $s0, $t0, $t1 #checks $t0>$t1
beq $s0, 1, stage2 #if $t0>$t1, goto stage2
beq $t0, $t1, stage2 #if $t0==$t1, goto stage2
2.
slt $t5, $s1,$s2 #checks $s1>$s2
beq $t5, 1, .L1 # if $s1>$s2 goto label L1
beq $t5, $zero, .L2 # if $s1<$s2 goto label L2
.L1:
li $t5,5 # set $t5 to 5 if $s1>$s2 in label L1
.L2:
li $t,4 # set $t5 to 4 if $s1<$s2 in label L2
3.
li $t4, 0 #set $t4=0
li $t0 ,7 #set $t0=7
b TEST #test first
BODY:
addu $t4, $t4, 1 #$t4=$t4+1
TEST:
slt $t1, $t4, $t0 #checks $t4>$t0
beq $t1, $zero, BODY # if $t4<$t0
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.