Title: The Multiplication Operation Inner View
1The Multiplication Operation Inner View
- Two types of Multiplication
- Unsigned ( Conventional way) Treats sign
magnitude separately. - Signed ( Machine Implementation) Uses rs
complement scheme ( the base of the number system
being r). -
2The Conventional Way Unsigned Multiplication
- Task at hand
- Given Operand A m digit magnitude
- ( The Multiplicand ( MPD ) .
- Given Operand B m digit magnitude
- ( The Multiplier ( MPR ) .
- Produce the 2m digit Result C ? A X B.
3Unsigned Multiplication Examples - 1
- Size of MPD (A) MPR (B) 3 digits.
- Hence size of Result (C ) 6 digits.
- Bases used
- 1. Decimal
- 2. Binary
-
4Unsigned Multiplication in Decimal
- Multiplicand (MPD) A 125
- Multiplier (MPR) B 232
- Multiplication Process
-
1 2 5 1 2 5 -
X 2 3 9 X 2 3 9 -
--------------- --------------- -
1 1 2 5 0 1 1 2 5 -
3 7 5 X 0 3 7 5 0 -
2 5 0 X 2 5 0 0 0 -
--------------- ----------------- - 6 Digit Result C 0 2 9 8 7 5
0 2 9 8 7 5 -
-
5Unsigned Multiplication in Binary
- Multiplicand (MPD) A 110
- Multiplier (MPR) B 101
- Multiplication Process
-
1 1 0 1 1 0 -
X 1 0 1 X 1 0 1 -
--------------- --------------- -
1 1 0 0 0 0 1 1 0 -
0 0 0 X 0 0 0 0 0 0 -
1 1 0 X 0 1 1 0 0 0 -
--------------- ----------------- - 6 Digit Result C 0 1 1 1 1 0
0 1 1 1 1 0 -
-
6Unsigned MultiplicationCommon Observations
- Essentially a process of shifted addition.
- At each step, one Multiplier Digit is considered
, starting from Least Significant Digit , moving
towards left. - Multiplication Table is needed.
- Requires 2m digit addition involving more than 2
operands. Cannot be performed by machine .
7Unsigned Multiplicationtowards Machine
Implementation
- Use m digit adder only.
- Add only 2 Operands at a time.
- Eliminate need for multiplication table by
repeated addition. - Ease out the task of considering each multiplier
digit starting from Least Significant Digit.
8Unsigned Binary Multiplication Example - 1
- Consider the Multiplicand (MPD) A 110
- The Multiplier (MPR) B 101 Lower Half of
Result - We are to Compute C A X B
- Step 1 Set up Upper Half of the Result C 0 0 0
3 Digits - Set Operation / Shift Counter ? 3
- Set Cy ? 0 . Copy/Preserve MPR B
in E . - Step 2 The Current Rightmost Multiplier Digit
MPRd 1. - Step 3 Addition Counter Add_Count 1 . One
ADDITION - Step 4 C ? C PLUS MPD A ?
- C ? 000 PLUS 110 110 , Carry 0
9Unsigned Binary Multiplication Example - 2
- Cy Result C MPR B Add_Count
MPD A - 0 1 1 0 1 0 1
1 1 1 0 - Step 5 Decrement Add_Counter 1 / 0.
- Step 6 Add_Count is ZERO hence Right Shift
Logically Cy, C B. - Cy Result C MPR B Add_Count
MPD A - 0 0 1 1 0 1 0
0 1 1 0 - Step 7 Decrement Operation/ Shift Counter 3 /
(2) NOT 0 hence Continue.
10Unsigned Binary Multiplication Example - 3
- Step 8 The Current Rightmost Multiplier Digit
MPRd 0. - Step 9 Addition Counter Add_Count 0 . NO
ADDITION - Step 10 Right Shift Logically Cy, C B.
- Cy Result C MPR B Add_Count
MPD A - 0 0 0 1 1 0 1
0 1 1 0 - Step 11 Decrement Operation / Shift Counter
2 /( 1) - NOT 0 Hence Continue.
11Unsigned Binary Multiplication Example - 4
- Step 11 The Current Rightmost Multiplier Digit
MPRd 1. - Step 12 Addition Counter Add_Count 1 .
- C ? C PLUS MPD A ?
- C ? 001 PLUS 110 111 , Carry 0.
- Add _Count 0
- Step 13 Right Shift Logically Cy, C B.
- Cy Result C MPR B Add_Count
MPD A - 0 0 1 1 1 1 0
0 1 1 0 - Step 14 Decrement Operation / Shift Counter
1 /( 0) - Equals 0 Hence STOP.
- Hence final Result 0 1 1 1 1 0
12Unsigned Binary Multiplication Compact Process
Example
- Multiplicand A 0101 5 Decimal
- Multiplier B 0100 4 Decimal
- Result C 0 0 0 1 0 1 0 0 20 Decimal
- Step 1
- Partial Result 0 0 0 0 0 1 0 0
- 1st two Multiplier bits 0 , Hence after
two Logical Right Shifts ( Step 1 Step 2) the
Partial Result 0 0 0 0 0 0 0 1 - Next Step ( Step 3 ) , Current Multiplier Bit
1 - Add Multiplicand to the MS Nibble of the
Partial Result - 0 0 0 0 0 0 0 1
- 0 1 0 1
- ----------
- 0 1 0 1 0 0 0 1 gtgt 0 0 1 0 1 0 0 0.
Now last Multiplier bit 0 - After one more Right Logical Shift Result 0
0 0 1 0 1 0 0 -
13Unsigned Decimal Multiplication The Modified
Process - 1
- MPD A m Digits , MPR B m Digits . Hence
Result will be 2m Digits long. - Step 1 Initialize Upper Half of the Result C
0 0 0 -
m Digits - Copy MPR B into E. MPR B will hold Lower Half
of Result - Clear Carry Cy 0 . Preserve it.
- Set up Operation / Shift Counter m
- Step 2 Consider the current rightmost
multiplier digit MPRd. - Step 3 Addition Counter (ADD_Count) ? MPRd k
. - Step 4 C ? ( C ) PLUS MPD A .
- Step 5 For any Carry produced , Increment Cy .
- Step 6 Decrement ADD_Count.
- Step 7 IF (ADD_Count is NON ZERO) GO TO Step 4.
14Unsigned Decimal Multiplication The Modified
Process - 2
- Step 8 ADD_Count is Zero. One Multiplier
Digit Considered. -
- a. Right Shift Logically the Cy, Upper Half of
Result C MPR (B) . - b. Cy Comes in at Left Most position of the
Upper Half of Result C . - c. Right most Digit of C comes to the left
most place of MPR (B). - d. Right most Digit of the MPR B goes out.
- e. 0 comes into Cy.
- Step 9 Decrement Operation Counter.
- Step 10 If Operation Counter is NON Zero GOTO
Step 2 ELSE STOP.
15Unsigned Decimal Multiplication Example - 1
- Consider the Multiplicand (MPD) A 125
- The Multiplier (MPR) B 239
- We are to Compute C A X B
- Step 1 Set up 3 digit Upper Half of Result C
0 0 0 - Here Operation Counter 3. Copy
B(239) to D - Set Cy ? 0 . Preserve it
- Step 2 The Current Rightmost Multiplier Digit
MPRd 9. - Step 3 Addition Counter Add_Count 9
- Step 4 C ? C PLUS MPD A ?
- C ? 000 PLUS 125 125 , No Carry.
16Unsigned Decimal Multiplication Example - 2
- Step 5 Cy Result C MPR B
Add_Count MPD A - 0 1 2 5 2 3
9 9 1 2 5 - Step 6 Decrement Addition Counter Add_Count
9 / 8. - Step 7 Add_Count is NON ZERO hence GO TO STEP
4. - After repeating this 6 more i.e. Adding MPD A (
125 ) to the Upper Half of thel Result C , a
total of 7 times the status becomes - Cy Result C MPR B
Add_Count MPD A - 0 8 7 5 2 3 9
2 1 2 5 - Step 4 C ? C PLUS MPD A ?
- C ? 875 PLUS 125 000 , Carry 1
17Unsigned Decimal Multiplication Example - 3
- Step 5 Cy Result C MPR B
Add_Count MPD A - 1 0 0 0 2 3 9
2 1 2 5 - Step 6 Decrement Addition Counter Add_Count
2 / 1. - Step 7 Add_Count is NON ZERO hence GO TO STEP
4. - After Looping one more time i.e.a total of 9
times the status becomes - Cy Result C MPR B
Add_Count MPD A - 1 1 2 5 2 3
9 0 1 2 5 - Step 8 Right Shift Logically Cy, C B.
18Unsigned Decimal Multiplication Example - 4
- Step 8 Cy Result C MPR B
Add_Count MPD A - 0 1 1 2 5 2
3 3 1 2 5 - Add_Count 3. Operation Counter 2 .
- Add_Count is NON ZERO hence GO TO STEP 4.
- Step 4 C ? C PLUS A ? C ? 1 12 PLUS 125 2
3 7 , Cy 0 - Decrement Add_Count.
- Cy Result C MPR B
Add_Count MPD A - 0 2 3 7 5 2
3 2 1 2 5 - Step 5 C ? C PLUS A ? C ? 237 PLUS 125 3 6
2 , Cy 0 - Decrement Add_Count.
- Cy Result C MPR B
Add_Count MPD A - 0 3 6 2 5 2
3 1 1 2 5
19Unsigned Decimal Multiplication Example - 5
- Step 5 Cy Result C MPR B
Add_Count MPD A - 0 3 6 2 5 2
3 1 1 2 5 - Step 6 C ? C PLUS A ? C ? 3 6 2 PLUS 125 4
8 7 , Cy 0 - Decrement Add_Count.
- Cy Result C MPR B
Add_Count MPD A - 0 4 8 7 5 2
3 0 1 2 5 - Step 7 RSHIFT Logical Cy C B Decrement
Operation Count. - Cy Result C MPR B
Add_Count MPD A - 0 0 4 8 7 5
2 2 1 2 5
20Unsigned Decimal Multiplication Example - 6
- Step 7 Cy Result C MPR B
Add_Count MPD A - 0 0 4 8 7
5 2 2 1 2 5 - Step 8 C ? C PLUS A ? C ? 0 4 8 PLUS 125 1
7 3 , Cy 0 - Decrement Add_Count.
- Cy Result C MPR B
Add_Count MPD A - 0 1 7 3 7 5
2 1 1 2 5 - Step 9 C ? C PLUS A ? C ? 1 7 3 PLUS 125 2
9 8 , Cy 0 - Decrement Add_Count.
- Cy Result C MPR B
Add_Count MPD A - 0 2 9 8 7 5
2 0 1 2 5
21Unsigned Decimal Multiplication Example - 7
- Step 10 Cy Result C MPR B
Add_Count MPD A - 0 2 9 8 7
5 2 0 1 2 5 - RSHIFT LOGICAL Cy C B .
- Decrement Operation Counter 1 / 0. Multiplication
Over - Cy Result C MPR B
Add_Count MPD A - 0 0 2 9 8 7 5
N.A. 1 2 5 -
- Final Result 125 X 239 0 2 9 8 7 5
- Unsigned HEX Unsigned Octal Multiplication Left
as an Exercise. -