



















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















































































Number Representation
Numbers and ArithmeticRepresenting Signed Numbers Redundant Number SystemsResidue Number Systems
Addition / Subtraction
Basic Addition and CountingCarry-Look ahead Adders Variations in Fast AddersMultioperand Addition
Multiplication
Basic Multiplication SchemesHigh-Radix Multipliers Tree and Array MultipliersVariations in Multipliers
Division
Basic Division SchemesHigh-Radix Dividers Variations in DividersDivision by Convergence
Real Arithmetic
Floating-Point ReperesentationsFloating-Point Operations Errors and Error ControlPrecise and Certifiable Arithmetic
Function Evaluation
Square-Rooting MethodsThe CORDIC Algorithms Variations in Function EvaluationArithmetic by Table Lookup
Implementation Topics
High-Throughput ArithmeticLow-Power Arithmetic Fault-Tolerant ArithmeticPast, Present, and Future
Parts Chapters I.
II.
III.
IV.
V.
VI.
VII.
1.2. 3.4. 5.6. 7.8.
10.9. 11.12.
25.26. 27.28.
21.22. 23.24.
17.18. 19.20.
13.14. Elementary Operations 15.16.
Basic Multiplication Schemes: Topics
9.1 Shift/Add Multiplication Algorithms
9.2 Programmed Multiplication
9.3 Basic Hardware Multipliers
9.4 Multiplication of Signed Numbers
9.5 Multiplication by Constants
9.6 Preview of Fast Multipliers
9.1 Shift/Add Multiplication Algorithms
Notation for our discussion of multiplication algorithms: a Multiplicand ak โ 1 ak โ 2... a 1 a 0 x Multiplier xk โ 1 xk โ 2... x 1 x 0 p Product ( a ๏ด x ) p 2 k โ 1 p 2 k โ 2... p 3 p 2 p 1 p 0 Initially, we assume unsigned operands
Fig. 9.1 Multiplication of two 4-bit unsigned binary numbers in dot notation.
Product
Partial products bit-matrix
a x
p
x (^) 0 a 20 x (^) 1 a 2 1 x (^) 2 a 22 x (^) 3 a 23
Multiplicand ๏ด Multiplier
Fig. 9. Examples of sequential multipli- cation with right and left shifts.
Right-shift algorithm Left-shift algorithm ======================== ======================= a 1 0 1 0 a 1 0 1 0 x 1 0 1 1 x 1 0 1 1 ======================== ======================= p (0)^ 0 0 0 0 p (0)^ 0 0 0 0
p ( j +1)^ = ( p ( j )^ + xj a 2 k ) 2โ^1 |โโโaddโโโ| |โโshift rightโโ|
Check: 10 ๏ด 11 = 110 = 64 + 32 + 8 + 4 + 2
Fig. 9. Examples of sequential multipli- cation with right and left shifts.
Right-shift algorithm Left-shift algorithm ======================== ======================= a 1 0 1 0 a 1 0 1 0 x 1 0 1 1 x 1 0 1 1 ======================== ======================= p (0)^ 0 0 0 0 p (0)^ 0 0 0 0
p ( j +1)^ = 2 p ( j )^ + xk โ j โ 1 a |shift| |โโโโaddโโโโ|
Check: 10 ๏ด 11 = 110 = 64 + 32 + 8 + 4 + 2
Assume k -bit words
k iterations of the main loop 6-7 instructions per iteration, depending on the multiplier bit
Thus, 6 k + 3 to 7 k + 3 machine instructions, ignoring operand loads and result store
k = 32 implies 200+^ instructions on average
This is too slow for many modern applications!
Microprogrammed multiply would be somewhat better
9.3 Basic Hardware Multipliers
Fig. 9.4 Hardware realization of the sequential multiplication algorithm with additions and right shifts.
Multiplier x
Mux
Adder
0
c out
0 1
Doublewidth partial product p
Multiplicand a
Shift
Shift
( j )
x j
x (^) ja
k
k
k p ( j +1)^ = ( p ( j )^ + xj a 2 k ) 2โ^1 |โโโaddโโโ| |โโshift rightโโ|
Partial product p ( j )
k
Unused part of the multiplier x
Adderโs carry-out
Adderโs sum
k
k โ 1
k โ 1
To adder To mux control
Fig. 9.5 Combining the loading and shifting of the double-width register holding the partial product and the partially used multiplier.
Fig. 9.4b Hardware realization of the sequential multiplication algorithm with left shifts and additions.
Multiplier x
Mux
2 k -bit adder
0
c out
0 1
Doublewidth partial product p
Multiplicand a
Shift
Shift
( j )
x k - j -
a
2 k
xk - j -1 k
2 k
Fig. 9.7 Sequential multiplication of 2โs-complement numbers with right shifts (negative multiplier).
============================ a 1 0 1 1 0 x 1 0 1 0 1 ============================ p (0)^ 0 0 0 0 0
Negative multiplicand, negative multiplier: In last step (the sign bit), subtract rather than add
Check:
Fig. 9.8 The 2โs-complement sequential hardware multiplier.
Adder
k + 1
0, except in last cycle
1 0 Mux
k + 1
Enable Select
Partial product
Multiplier
Multiplicand
k + 1
c out c in
Fig. 9.9 Sequential multiplication of 2โs-complement numbers with right shifts by means of Boothโs recoding.
============================ a 1 0 1 1 0 x 1 0 1 0 1 Multiplier y - 1 1 - 1 1 - 1 Booth-recoded ============================ p (0)^ 0 0 0 0 0
xi xi โ 1 yi โโโโโโโโโโ 0 0 0 0 1 1 1 0 - 1 1 1 0 โโโโโโโโโโ
Check:
9.5 Multiplication by Constants
Explicit, e.g. y := 12 * x + 1
Implicit, e.g. A[i, j] := A[i, j] + B[i, j]
Address of A[i, j] = base + n * i + j
Software aspects:
Optimizing compilers replace multiplications by shifts/adds/subs Produce efficient code using as few registers as possible Find the best code by a time/space-efficient algorithm
0 1 2... n โ 1 0 1 2...
m โ 1
Row i
Column j
Hardware aspects:
Synthesize special-purpose units such as filters y [ t ] = a 0 x [ t ] + a 1 x [ t โ 1] + a 2 x [ t โ 2] + b 1 y [ t โ 1] + b 2 y [ t โ 2]