Part6a Mlt
-
Upload
adityalakshay26 -
Category
Documents
-
view
237 -
download
0
Transcript of Part6a Mlt
-
8/13/2019 Part6a Mlt
1/26
Copyright 2008 KorenECE666/Koren Part.6a.1
Israel KorenSpring 2008
UNIVERSITY OF MASSACHUSETTS
Dept. of Electrical & Computer Engineering
Digital Computer ArithmeticECE 666
Part 6aHigh-Speed Multiplication - I
-
8/13/2019 Part6a Mlt
2/26
Copyright 2008 KorenECE666/Koren Part.6a.2
Speeding Up MultiplicationMultiplication involves 2basic operations - generation of
partial products + their accumulation2ways to speed up - reducing number of partial
products and/or accelerating accumulation
3types of high-speed multipliers:
Sequential multiplier- generates partial productssequentially and adds each newly generated product topreviously accumulated partial product
Parallel multiplier- generates partial products inparallel, accumulates using a fast multi-operand adder
Array multiplier- array of identical cells generatingnew partial products; accumulating them simultaneously No separate circuits for generation and accumulation
Reduced execution time but increased hardware complexity
-
8/13/2019 Part6a Mlt
3/26
Copyright 2008 KorenECE666/Koren Part.6a.3
Reducing Number of Partial Products
Examining 2 or more bits of multiplier at a timeRequires generating A (multiplicand),2A, 3A
Reduces number of partial products to n/2 -each step more complex
Several algorithm which do not increasecomplexity proposed - one is Booth'salgorithm
Fewer partial products generated for groups ofconsecutive 0s and 1s
-
8/13/2019 Part6a Mlt
4/26
Copyright 2008 KorenECE666/Koren Part.6a.4
Booths AlgorithmGroup of consecutive 0s in multiplier - no new partial
product - only shift partial product right one bitposition for every 0
Group of mconsecutive 1's in multiplier - less than mpartial products generated
...01110... = ...10...000... - ...00...010...
Using SD (signed-digit) notation =...100...010...
Example:
...011110... = ...100000... - ...000010... =...100010...(decimal notation: 15=16-1)
Instead of generating all mpartial products - only 2partial products generated
First partial product added - second subtracted -number of single-bit shift-right operations still m
-
-
-
8/13/2019 Part6a Mlt
5/26
Copyright 2008 KorenECE666/Koren Part.6a.5
Booths Algorithm - Rules
Recodingmultiplier xn-1 xn- 2...x1 x0inSDcode
Recodedmultiplier yn-1yn-2... y1y0
xi,xi-1 of multiplier examined to generate yi
Previous bit - xi-1- only reference bit
i=0 - reference bitx-1=0
Simple recoding - yi = xi-1- xiNo special order - bits can be recoded in parallel
Example: Multiplier 0011110011(0)recoded as0100010101 - 4instead of 6add/subtracts
--
-
8/13/2019 Part6a Mlt
6/26
Copyright 2008 KorenECE666/Koren Part.6a.6
Sign Bit
Two's complement - sign bit xn-1must be usedDeciding on add or subtract operation - no shift
required - only prepares for next step
Verify only for negative values of X(xn-1=1)2cases
Case 1- Asubtracted - necessary correction
Case 2- without sign bit - scan over a string of1's and perform an addition for position n-1
When xn-1=1considered - required addition not done Equivalent to subtracting A2 - correction termn-1
-
8/13/2019 Part6a Mlt
7/26
Copyright 2008 KorenECE666/Koren Part.6a.7
Example
-
8/13/2019 Part6a Mlt
8/26
Copyright 2008 KorenECE666/Koren Part.6a.8
Booths Algorithm - Properties
Multiplication starts from least significant bit
If started from most significant bit - longeradder/subtractor to allow for carry propagation
No need to generate recoded SDmultiplier(requiring 2bits per digit) Bits of original multiplier scanned - control signals for
adder/subtractor generated
Booth's algorithmcan handle two's complementmultipliers
If unsigned numbers multiplied - 0 added to left ofmultiplier (xn=0) to ensure correctness
-
8/13/2019 Part6a Mlt
9/26
Copyright 2008 KorenECE666/Koren Part.6a.9
Drawbacks to Booth's AlgorithmVariable number of add/subtract operations and
of shift operations between two consecutiveadd/subtract operations Inconvenient when designing a synchronous multiplier
Algorithm inefficient with isolated 1's
Example:001010101(0)recoded as 011111111, requiring
8instead of 4 operations
Situation can be improved by examining 3bits ofXat a time rather than 2
- -- -
-
8/13/2019 Part6a Mlt
10/26
Copyright 2008 KorenECE666/Koren Part.6a.10
Radix-4 Modified Booth Algorithm
Bits xiand xi-1recoded into yiand yi-1-xi-2serves as reference bit
Separately - xi-2and xi-3recoded into yi-2andyi-3- xi-4serves as reference bit
Groups of 3bits each overlap - rightmost beingx1x0(x-1), next x3x2(x1),and so on
-
8/13/2019 Part6a Mlt
11/26
Copyright 2008 KorenECE666/Koren Part.6a.11
Radix-4 Algorithm - Rules
i=1,3,5,
Isolated 0/1handledefficiently
If xi-1is anisolated 1, yi-1=1 -only a single operation needed
Similarly - xi-1an isolated 0in a string of 1's -
...10(1)recoded as ...11...or ...01- singleoperation performed
Exercise: To find required operation - calculatexi-1+xi-2-2xifor odd is and represent result as a2-bit binary number yiyi-1in SD
- -
-
8/13/2019 Part6a Mlt
12/26
Copyright 2008 KorenECE666/Koren Part.6a.12
Radix-4 vs. Radix-2 Algorithm
01|01|01|01|(0)yields 01|01|01|01|- number of
operations remains 4- the minimum00|10|10|10|(0) yields01|01|01|10|,requiring 4,
instead of 3, operations
Compared to radix-2Booth's algorithm - lesspatterns with more partial products; Smallerincrease in number of operations
Can design n-bit synchronous multiplier thatgenerates exactly n/2partial products
Even n- two's complement multipliers handledcorrectly; Odd n- extension of sign bit neededAdding a 0 to left of multiplier needed if unsigned
numbers are multiplied and nodd - 2 0s if neven
- - -
-
8/13/2019 Part6a Mlt
13/26
Copyright 2008 KorenECE666/Koren Part.6a.13
Example
n/2=3steps ; 2 multiplier bits in each stepAll shift operations are 2bit position shifts
Additional bit for storing correct sign required toproperly handle addition of 2A
-
8/13/2019 Part6a Mlt
14/26
Copyright 2008 KorenECE666/Koren Part.6a.14
Radix-8 Modified Booth's AlgorithmRecoding extended to 3bits at a time -
overlapping groups of 4bits eachOnly n/3partial products generated - multiple
3Aneeded - more complex basic step
Example: recoding 010(1)yields yiyi-1yi-2=011
Technique for simplifying generation andaccumulation of 3Aexists
To find minimal number of add/subtract opsrequired for a given multiplier - find minimal SD
representation of multiplierRepresentation with smallest number of nonzero
digits -
-
8/13/2019 Part6a Mlt
15/26
Copyright 2008 KorenECE666/Koren Part.6a.15
Obtaining Minimal Representation of X
yn-1yn-2... y0 is a minimal representation of an
SD number if yiyi-1
=0for 1
in-1, given thatmost significant bits can satisfy yn-1yn-2 1
Example:Representationof 7with 3bits
111minimalrepresentationalthoughyiyi-1 0
For any X -add a 0to itsleft to satisfyabove condition
-
8/13/2019 Part6a Mlt
16/26
Copyright 2008 KorenECE666/Koren Part.6a.16
Canonical Recoding
Multiplier bits examinedone at a time from right;xi+1- reference bit
To correctly handle a
single 0/1in string of1's/0s- need information on string to rightCarry bit- 0for 0'sand 1for 1's
As before, recoded multiplier can be used withoutcorrection if represented in two's complement
Extend sign bit xn-1 - xn-1xn-1xn-2x0Can be expanded to two or more bits at a time
Multiples needed for 2bits - A and 2A
-
8/13/2019 Part6a Mlt
17/26
Copyright 2008 KorenECE666/Koren Part.6a.17
Disadvantages of Canonical Recoding
Bits of multiplier generated sequentiallyIn Booths algorithm- no carry propagation -
partial products generated in parallel and a fastmulti-operand adder used
To take full advantage of minimum number ofoperations - number of add/subtracts and lengthof shifts must be variable - difficult toimplement
For uniforms shifts - n/2partial products - morethan the minimum in canonical recoding
-
8/13/2019 Part6a Mlt
18/26
Copyright 2008 KorenECE666/Koren Part.6a.18
Alternate 2-bit-at-a-timeAlgorithm
Reducing number ofpartial products butstill uniform shiftsof 2bits each
xi+1reference bit for xixi-1- iodd2A,4Acan be generated using shifts4Agenerated when (xi+1)xi xi-1=(0)11- group of 1's
- not for (xi+3)xi+2 xi+1- 0in rightmost position Not recoding - cannot express 4in 2bits Number of partial products - always n/2 Two's complement multipliers - extend sign bit
Unsigned numbers - 1or 2 0s added to left of multiplier
-
8/13/2019 Part6a Mlt
19/26
Copyright 2008 KorenECE666/Koren Part.6a.19
Example
Multiplier 01101110- partial products:
Translates to the SDnumber 010110010 -notminimal - includes 2adjacent nonzero digits
Canonical recoding yields 010010010 -minimal
representation
-
8/13/2019 Part6a Mlt
20/26
Copyright 2008 KorenECE666/Koren Part.6a.20
Dealing with Least significant Bit
For the rightmost pairx
1
x0, if
x0 = 1 -
considered continuation of string of 1's that neverreally started - no subtraction took place
Example:multiplier 01110111 - partial products:
Correction:when x0=1- set initial partial product
to -Ainstead of 04possible cases:
-
8/13/2019 Part6a Mlt
21/26
Copyright 2008 KorenECE666/Koren Part.6a.21
Example
Previousexample -
Multiplier's sign bit extended in order to decide
that no operation needed for first pair ofmultiplier bits
As before - additional bit for holding correctsign is needed, because of multiples like -2A
-
8/13/2019 Part6a Mlt
22/26
Copyright 2008 KorenECE666/Koren Part.6a.22
Extending the Alternative Algorithm
The above method can be extended to three bitsor more at each step
However, here too, multiples of Alike 3Aoreven 6Aare needed and Prepare in advance and store Perform two additions in a single step
For example, for (0)101we need 8-2=6, and for(1)001, -8+2=-6
-
8/13/2019 Part6a Mlt
23/26
Copyright 2008 KorenECE666/Koren Part.6a.23
Implementing Large Multipliers UsingSmaller Ones
Implementing n x nbit multiplier as a singleintegrated circuit - several such circuits forimplementing larger multipliers can be used
2n x 2nbit multiplier can be constructed out of 4n x nbit multipliers based on :
AH , AL- most and least significant halves of A ;XH,XL- same for X
-
8/13/2019 Part6a Mlt
24/26
Copyright 2008 KorenECE666/Koren Part.6a.24
Aligning Partial Products
4partial products of 2nbits
- correctly aligned before addingLast arrangement - minimum
height of matrix - 1level ofcarry-save addition and a CPA
nleast significant bits - alreadybits of final product - no furtheraddition needed
2ncenter bits - added by 2n-bit CSAwith outputs connected to a CPA
nmost significant bits connected to same CPA,since center bits may generate carry into mostsignificant bits - 3n-bit CPAneeded
-
8/13/2019 Part6a Mlt
25/26
Copyright 2008 KorenECE666/Koren Part.6a.25
Decomposing a Large Multiplier intoSmaller Ones - Extension
Basic multiplier - n x mbits - nm
Multipliers larger than 2n x 2mcan be implemented
Example: 4n x 4nbit multiplier - implemented usingn x nbit multipliers 4n x 4nbit multiplier requires 4 2n x 2nbit multipliers
2n x 2nbit multiplier requires 4 n x nbit multipliers
Total of 16 n x nbit multipliers
16partial products - alignedbefore being added
Similarly- for any kn xknbit multiplier with integerk
-
8/13/2019 Part6a Mlt
26/26
Copyright 2008 KorenECE666/Koren Part.6a.26
Adding Partial Products
After aligning 16 products-7bits in one column needto be added
Method 1: (7,3)counters -generating 3 operands added by(3,2)counters - generating 2operands added by a CPA
Method 2: Combining 2sets
of counters into a setof (7;2)compressors
Selecting moreeconomical multi-operand adder - discussed next