Suppose the register $ t0 contains a (hexadecimal) value 0 times 00000040, what
ID: 3935377 • Letter: S
Question
Suppose the register $ t0 contains a (hexadecimal) value 0 times 00000040, what is the (hexadecimal or decimal) value of $t2 after the following instruction: $l1, $t2, $t0, 2 Suppose the register $t0 contains a (hexadecimal) value 0 times 00000040, what is the (hexadecimal or decimal) value of $t2 after the following instructions: sl1$t0, $t0, 2 slti $t2, $t0, 64 Suppose the register $t0 contains a (hexadecimal) value 0 times 00000040, what is the (hexadecimal or decimal) value of $t2 after the following instructions: addi $t1, $zero, 64 bne $t0, $t1, Else andi $t2, $t0, 1 j Done Else: ori $t2, $t0, 1 Done:Explanation / Answer
1) given that $t0 contains the value 0x00000040
after the execution of instruction sll $t2,$t0,2 and here the directive SLL is defined as logical shilft left of the given value by the given number of times
hence $t0 value will be left shifted by 2 times and that value is stored in $t2 register, Therefore
$t2= $t0 << 2
= 0x00000040 << 2
. =0x00000100 will be stored the $t2 after the execution of above given instruction
2)
given that $t0 holds 0x00000040 value and here two set of instructions of executed they are
sll $t0,$t0,2 ; Hence value of $t0 is leftshifted by 2 times and value is loaded into $t0 i.e., 0x00000100 i ; loaded
slti $t2,$t0,64 ; SLTI directive is used to set the register if the other register is less than the immediate given
; value and here $t0 contains 256 which is not less than 64 hence value will not be set into
;$t2 register i.e., 0 will stored in $t2.
3)
given that $t0 contains 0x00000040 value and $zero always holds 0 value and instructions to be executed are:
addi $t1,$zero,64 ; this will add value of $zero with 64 and stores in $t1 ... $t1=64
bne $t0,$t1,ELse ; branch to Else if $t0 != $t1 since both are equal next instruction will be executed in order
andi $t2,$t0,1 ; apply masking for $t0 value with 1 and result will be stored in $t2 register
Hence value of $t2 is 0
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.