(20%) Logical and Branch Instructions. 1. Suppose the register $tO contains a (h
ID: 3871746 • Letter: #
Question
(20%) Logical and Branch Instructions. 1. Suppose the register $tO contains a (hexadecimal) value xo0000040, what is the (hexadecimal or decimal) value of st2 after the following instruction: sil $t2, $t0, 2 Suppose the register $to contains a (hexadecimal) value ox00000040, what is the (hexadecimal or decimal) value of $t2 after the following instructions: 2. sll $to, $t0, 2 slti $t2, $t0, 64 Suppose the register $t0 contains a (hexadecimal) value 0x00000040, what is the (hexadecimal or decimal) value of $t2 after the following instructions: 3. addi $t1, $zero, 64 bne $to, $tl, Else andi $t2, t0, 1 j Done Else: ori $t2, $t0, 1 Done:Explanation / Answer
1)
sll $t2,$t0,2
=> $t2 = $t0 << 2
=> $t2 = 0x00000040 << 2
=> $t2 = 0000 0000 0000 0000 0000 0001 0000 0000
=> $t2 = 0x00000100
2) sll $t0,$t0,2
=> $t0 = 0x00000040 << 2
=> $t0 = 0000 0000 0000 0000 0000 0001 0000 0000
=> $t0 = 0x00000100
slti $t2,$t0,64
=> it will set $t2 if $t0 is less than 64
=> $t2 = ($t0 < 64)
=> $t2 = (256 < 64)
=> $t2 = 0
3)
addi $t1,$zero,64
=> $t1 = 0 + 64
=> $t1 = 64
bne $t0,$t1,Else
=> $t0 != $t1 -----> jump to Else
=> 64 != 64 (false .so it won't jump to Else)
andi $t2,$t0,1
=>$t2 = $t0 & 1
=>$t2 = 0x40 & 1
=>$t2 = 0
j Done
=> jump to Done
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.