written 8.5 years ago by | modified 2.9 years ago by |
Mumbai University > Computer Engineering > Sem4 > Computer Organization and Architecture
Marks: 7M
Year: May 14
written 8.5 years ago by | modified 2.9 years ago by |
Mumbai University > Computer Engineering > Sem4 > Computer Organization and Architecture
Marks: 7M
Year: May 14
written 8.5 years ago by |
Using the flowchart, we can solve the given question as follows:
$(5)_{10}= 0101$ (in 2’s complement)
$(7)_{10} =0111$ (in 2’s complement)
Multiplicand (B) = 0101
Multiplier (Q) = 0111
And initially $Q_{-1}$= 0
Count =4
Steps | A | Q | $Q_1$ | Operation |
---|---|---|---|---|
Initial | 0000 | 0111 | 0 | - |
1 | 1011 1101 |
0111 1011 |
0 1 |
A=A-B Right shift |
2 | 1110 | 1101 | 1 | Right shift |
3 | 1111 | 0110 | 1 | Right Shift |
4 | 0100 0010 |
0110 0011 |
1 0 |
A=A+B <right shift=""> |
Result | 0010 | 0011 | - | - |
The result to the problem is $(0010 0011)_2$ or $(35)_{10}$
Here a property of Arithmetic right shift can be seen. When after addition or subtraction(A-B or A+B) a right shift occurs,the left most bit of $A(A_{n-1})$ is shifted to the second left most bit i.e. $A_{n-2}$ the $(n-1)^{th}$ bit is retained as shown in the above example. This is done to preserve the sign of A.