Académique Documents
Professionnel Documents
Culture Documents
COMPUTER
MULTIPLICATION
TEAM: VO HOANG CHUONG
TEAM MEMBERS
1. Vo Hoang Chuong ( Leader )
2. Le Quang Dao
3. Le Duc Minh Tuan
4. Ho Ba Trung
5. Tran Le Quoc
Let’s review the multiplication of decimal
numbers to remind us of the steps of
multiplication and the names of the operands.
0000
1000
1001000
We restricted the decimal digits to 0 and 1. With only
two choices, each step of the multiplication is simple:
0010 x 0011
MULTIPLICATION
ALGORITHM
Example of unsigned Multiplication
Calculate: 3 x 8
Iteration Step Multiplier Multiplicand Product
0 Initial values 1000 00000011 00000000
1 1: 0 ⟹ No operation 1000 00000011 00000000
2: Shift left Multiplicand 1000 00000110 00000000
3: Shift right Multiplier 0100 00000110 00000000
2 1: 0 ⟹ No operation 0100 00000110 00000000
2: Shift left Multiplicand 0100 00001100 00000000
3: Shift right Multiplier 0010 00001100 00000000
3 1: 0 ⟹ No operation 0010 00001100 00000000
2: Shift left Multiplicand 0010 00011000 00000000
3: Shift right Multiplier 0001 00011000 00000000
4 1a: 1 ⟹ Prod = Prod + Mcand 0001 00011000 00011000
2: Shift left Multiplicand 0000 00110000 00011000
3: Shift right Multiplier 0000 00110000 00011000
SIGNED MULTIPLICATION
The signed multiplication has 2 cases:
1. Both operands have the same sign => Positive product
2. The operands have opposite sign => Negative product
How to perform the signed multiplication:
1. Convert the negative operand(s) to positive operand(s)
2. Multiply the operands like unsigned case.
3. Negate the product if there is the sign disagreement.
Example of signed Multiplication
Calculate: 3 x -8
Iteration Step Multiplier Multiplicand Product
0 Initial values 11000 00000011 0000000000
1 Convert to positive number 01000 00000011 0000000000
2 1: 0 ⟹ No operation 01000 00000011 0000000000
2: Shift left Multiplicand 01000 00000110 0000000000
3: Shift right Multiplier 00100 00000110 0000000000
3 1: 0 ⟹ No operation 00100 00000110 0000000000
2: Shift left Multiplicand 00100 00001100 0000000000
3: Shift right Multiplier 00010 00001100 0000000000
4 1: 0 ⟹ No operation 00010 00001100 0000000000
2: Shift left Multiplicand 00010 00011000 0000000000
3: Shift right Multiplier 00001 00011000 0000000000
5 1a: 1 ⟹ Prod = Prod + Mcand 00001 00011000 0000011000
2: Shift left Multiplicand 00000 00110000 0000011000
3: Shift right Multiplier 00000 00110000 0000011000
6 Negate the product 00000 00110000 1111101000
FASTER MULTIPLICATION
Why is the multiplier with 32 adders faster?
- Original multiplier needs a clock cycle per bit
- Optimized multiplier needs:
•An “and” operation (parallel)
•32 adders (pipelined)
•Each adder receives output of previous multiplier
oLeast significant bit goes to result
o31 upper bits plus carry out go to next multiplier
- Pipeline latency:
•Cost of first multiply slow
•Following multiplies fast (presumably one per cycle)
MULTIPLICATION IN MIPS
• mult $t1, $t2 # t1 * t2
• multu $t1, $t2 # t1 * t2
• Two registers, Hi-Lo, operating as an extended 64-bit
register
• mflo $t3 # fetches 32 bits from Lo and store to $t3
• mfhi $t4 # fetches 32 bits from Hi and store to $t4
MULTIPLICATION IN MIPS
THANK YOU!!!