Post on 13-Dec-2015
1
Answer #1, Quiz #1
Lp:slt $t0,$s1,$s2 # $t0 = a<b
slt $t1,$s1,$s2 # $t1 = a<c
and $t2,$t0,$t1 # $t2 = $t1 && $t0
beq $t2,$zero,End
addi $s1,$s1,1 # $s1 = $s1 + 1
j Lp
End:
Wrong Answer!! C++ first checks the first condition, if it is false exit loop. The correct answer is:
2
Answer #1, Quiz #1 (cont)
Lp:slt $t0,$s1,$s2 # $t0 = a<b
beq $t0,$zero,End
slt $t0,$s1,$s2 # $t0 = a<c
beq $t0,$zero,End
addi $s1,$s1,1 # $s1 = $s1 + 1
j Lp
End:
Correct Answer!! Exit loop if one of the conditions is false.
3
Answer #2, Quiz #1
-100 = -0110 0100 = 1001 1011 + 1 = 1001 1100
78 = 0100 1110
128 = 1000 000
0xff = 0000 0000 1111 1111
0xab1 = 0000 1010 1011 0001
0x8612 = 1000 0110 0001 0010
$t0 = -1<100 = 1
$t1 = 232-1<-100 = 0
Answer #4, Quiz #1
4
Answer #3, Quiz #1
0
2
Result
Operation
a
1
CarryIn
CarryOut
0
1
Binvert
b
0
1 1
0
0
0
000
0
0
11
0
1
1
0
0