The following instruction is to be executed sw t1 4t2 The in
The following instruction is to be executed: sw $t1, 4($t2). The instruction is located at 0x00401000. Assume that $t1 holds a -1 and $t2 holds 0x10010010 Give the values of the following
i. output of sign-extend
ii. output of shift left 2
iii. inputs to ALU control
iv. output from MUX before registers
v. output from MUX before ALU
vi. output from ALU
vii. output from adder at top left
viii. output from adder at top right
Solution
Consider the following data:
Address of instruction=0×00401000
Value of $t1=-1
Value of $t2=0×10010010
The instruction to execute: sw $t1, 4($t2).
The instruction means store the value t1 at address given by value of t2 + offset (4)
The address where the value must be stored will be: - t2+offset (4)
=0×10010010 + 00000100
=0×10010110
Address to store the value -1 = 0×10010110
i. Output of sign extension:-
Ans:- To store the value of 8 bits, bits required = 0×10010110
Now, sign extended will be 8+8=16 bits,
then the answer will be: -
0×0000000010010110
ii. Output of shift left 2
Ans: - Output of shift left 2 is equal to multiplication by 4 i.e
multiply 0×10010110 by 0×00000100=0×1001011000
iii. Inputs to ALU control
Ans: -Since the input to ALU control is Input values and function to be performed
Hence, instruction is sw $t1, 4($t2).
Thus, input will be: -
Values: -
$t1
4($t2)
Function:-
Sw
iv. Output from MUX before registers
The output to the MUX before registers are:-

