Given MIPS instructions:
slt $t2, $0, $t0
bne $t2, $0, ELSE
j DONE
ELSE: addi $t2,$t2, 2
DONE:
In the above instruction, slt stands for “set on less than” . This instruction will compare the value $0 with the value of $t0. If the value $0 is less than The value of $t0, then the $t2 is set to 1.Here it is given that $t0 register has the value 0x00101000.
Now, if then the value of $t2 is set to 1. Since 0 is less than the value of $t0 , now the value of $t2 is set to 1.
Instruction bne stands for “branch if not equal” . The values of $t2 and $0 is compared to check whether they are equal. Here, the value of $t2 is 1 and it is compared to 0, so they are not equal. So the ELSE part will be executed.
The ELSE part has the addi instruction that will add the value 2 to the value of $t2 and store the result in $t2.
We know that $t2=1, will be added to 2 and then the result 3 will be stored in $t2.
Now, $t2=3 after the execution of the given instructions.