multiplication p x y x multiplicand y multiplier and p
play

MULTIPLICATION p = x y x (multiplicand), y (multiplier), and p - PowerPoint PPT Presentation

1 MULTIPLICATION p = x y x (multiplicand), y (multiplier), and p (product) signed integers SCHEMES a) SEQUENTIAL ADD-SHIFT RECURRENCE CPA, CSA, SIGNED-DIGIT ADDER HIGHER RADIX AND RECODING b) COMBINATIONAL CPA, CSA,


  1. 1 MULTIPLICATION p = x × y x (multiplicand), y (multiplier), and p (product) signed integers • SCHEMES a) SEQUENTIAL ADD-SHIFT RECURRENCE ∗ CPA, CSA, SIGNED-DIGIT ADDER ∗ HIGHER RADIX AND RECODING b) COMBINATIONAL ∗ CPA, CSA, SIGNED-DIGIT ADDER ∗ HIGHER RADIX AND RECODING c) COLUMN REDUCTION d) ARRAYS WITH k × l MULTIPLIERS Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  2. 2 TOPICS (cont.) • MULTIPLY-ADD AND MULTIPLY-ACCUMULATE • SATURATING MULTIPLIERS • TRUNCATING MULTIPLIERS • RECTANGULAR MULTIPLIERS • SQUARERS • CONSTANT AND MULTIPLE CONSTANT MULTIPLIERS Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  3. 3 SIGN-AND-MAGNITUDE • EACH OPERAND: sign with value +1 and − 1 and n -digit magnitude • RESULT: a sign and a 2 n -digit magnitude • HIGH-LEVEL ALGORITHM sign ( p ) = sign ( x ) · sign ( y ) | p | = | x || y | • REPRESENTATIONS OF MAGNITUDES � n − 1 i =0 x i r i X = ( x n − 1 , x n − 2 , . . . , x 0 ) | x | = (multiplicand) � n − 1 i =0 y i r i Y = ( y n − 1 , y n − 2 , . . . , y 0 ) | y | = (multiplier) � 2 n − 1 i =0 p i r i P = ( p 2 n − 1 , p 2 n − 2 , . . . , p 0 ) | p | = (product) Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  4. 4 TWO’S COMPLEMENT • RADIX-2 CASE • EACH OPERAND: n -BIT VECTOR • RESULT: 2 n -BIT VECTOR − (2 n − 1 )(2 n − 1 − 1) ≤ p ≤ ( − 2 n − 1 )( − 2 n − 1 ) = 2 2 n − 2 • x R , y R and p R – positive integer representations of x, y , and p • HIGH-LEVEL ALGORITHM  x R y R if x ≥ 0 , y ≥ 0     2 2 n − (2 n − x R ) y R if x < 0 , y ≥ 0       p R =  2 2 n − x R (2 n − y R ) if x ≥ 0 , y < 0     (2 n − x R )(2 n − y R ) if x < 0 , y < 0        Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  5. 5 TYPES OF ALGORITHMS 1. ADD-AND-SHIFT ALGORITHM • SEQUENTIAL • COMBINATIONAL 2. COMPOSITION OF SMALLER MULTIPLICATIONS Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  6. 6 RECURRENCE FOR MAGNITUDES p [0] = 0 p [ j + 1] = r − 1 ( p ( j ) + x · r n y j ) for j = 0 , 1 , . . . , n − 1 p = p [ n ] Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  7. 7 RELATIVE POSITION OF OPERANDS Multiplier Y Xr n Multiplicand y j vector - digit multiplier xr n y j p[j] ADDER rp[j+1] shift right p[j+1] Figure 4.1: RELATIVE POSITION OF OPERANDS IN MULTIPLICATION RECURRENCE T = n ( t digmult + t add + t reg ) Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  8. 8 SEQUENTIAL MULTIPLIER WITH REDUNDANT ADDER Y X Shift Reg. Y Reg. X y j MULTIPLE GEN. nonredundant REDUNDANT redundant ADDER p[j+1] CONVERTER Reg. PH Shift Reg. PL p[j] ADDER P Figure 4.2: SEQUENTIAL MULTIPLIER WITH REDUNDANT ADDER Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  9. 9 RADIX-4 SEQUENTIAL MULTIPLIER RECODING • MULTIPLIER RECODING TO AVOID VALUES z i = 3 z i = y i + c i − 4 c i +1 y i + c i z i c i +1 0 0 0 1 1 0 2 2 0 3 -1 1 4 0 1 Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  10. 10 RADIX-4 MULTIPLIER IMPLEMENTATION THREE PIPELINED STAGES • Stage 1: MULTIPLIER RECODING • Stage 2: GENERATING THE MULTIPLE OF THE MULTIPLICAND • Stage 3: ADDITION AND SHIFT (with conversion of the shifted-out bits). cycle 0 1 2 3 4 5 ... m + 1 m + 2 LOAD X LOAD Y Stage 1 0 z 0 z 1 z 2 z 3 z 4 Stage 2 0 0 Xz 0 Xz 1 Xz 2 Xz 3 Xz m − 1 Stage 3 0 0 0 PS[1] PS[2] PS[3] PS[ m − 1 ] PS[ m ] SC[1] SC[2] SC[3] SC[ m − 1 ] SC[ m ] CPA Final product Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  11. 11 X Y 1 0 Reg X c STAGE 3 Shift-Reg M X X carry Recoder STAGE 1 Reg 2X one zero SELECTOR neg STAGE 2 Reg XY n+2 multiple of X sign-extended n+3 CARRY-SAVE Reg CS[1,0] ADDER (SC1,PS1) (SC0,PS0) (Register PL could be STAGE 3 n+3 n+3 n+3 2 2 merged with register M) 2 2 shifted SC shifted PS 2 n+3 Reg PL Reg PSH CONV Reg SCH n (SC1,PS1) (SC0,PS0) n-2 n-2 (lower) 2 2 FINAL STEP Product c in to CPA (least significant part) (register control signals not shown) (most significant part) n - even Figure 4.3: RADIX-4 MULTIPLIER. Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  12. 12 RECODING IMPLEMENTATION • BASED ON MULTIPLIER BITS ( M 1 , M 0 ) and CARRY FLAG C  0 select 2 x   one = M 0 ⊕ C =  1 select x     0 select direct   neg = M 1 · C M 1 · M 0 =  1 select complement     0 load non − zero multiple 0 · C ′ =   M ′ 1 · M ′ zero = M 1 · M 0 · C  1 load zero multiple (clear)    C next = M 1 M 0 M 1 C Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  13. 13 C M 1 M 0 one neg C zero next Figure 4.4: RECODER IMPLEMENTATION. Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  14. 14 GENERATION OF ( − 1) x PS [ j ] PS n +2 PS n +1 PS n · · · PS 1 PS 0 SC [ j ] SC n +2 SC n +1 SC n · · · SC 1 SC 0 − x X ′ X ′ X ′ · · · X ′ X ′ n +2 n +1 n 1 0 CSA s n +2 s n +1 s n · · · s 1 s 0 c n +2 c n +1 c n · · · c 1 1 ∗ ∗ for 2’s complement of x Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  15. 15 EXAMPLE OF RADIX-4 MULTIPLICATION n = 6 m = 3 radix-4 digits x = 29 X = 11101 y = 27 Y = 11011 Z = 211 ( z = y ) ( − 1 = 1) Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  16. 16 CSA shifted out PS [0] 00000000 SC [0] 00000000 xZ 0 11100010 4 PS [1] 11100010 4 SC [1] 0000000 1 PS [1] 11111000 11 SC [1] 00000000 xZ 1 11100010 4 PS [2] 00011010 4 SC [2] 1100000 1 PS [2] 00000110 1111 SC [2] 11110000 xZ 2 00111010 4 PS [3] 11001100 4 SC [3] 0110010 0 PS [3] 11110011 001111 SC [3] 00011001 P 1100 001111 = 783 Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  17. 17 EXTENSION TO HIGHER RADICES • EXTENSION TO HIGHER RADICES REQUIRES PREPROCESSING OF MORE MULTIPLES • ALTERNATIVE: USE SEVERAL RADIX-4 AND/OR RADIX-2 STAGES IN ONE ITERATION EXAMPLE: RADIX-16 MULTIPLIER DIGIT { 0,...,15 } RECODED INTO A RADIX-16 SIGNED-DIGIT v i IN THE SET { -10,...,0,...,10 } AND DECOMPOSED INTO TWO RADIX-4 DIGITS u i and w i SUCH THAT v i = 4 u i + w i u i , w i ∈ {− 2 , − 1 , 0 , 1 , 2 } Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  18. 18 X SC PS Reg X Reg PS Reg SC xw j SELECTOR radix-16 w j (-2,-1,0,1,2) multiple of X signed-digit CSA 1 v j {-10,...,10} 4xu j q[j] SELECTOR u j (-2,-1,0,1,2) multiple of 4X CSA 2 A [4:2] adder can be used instead of two [3:2] adders 16p[j+1] SC PS (see comments in Section "Radix 4") n+3 x x . . . x x x x x . . . x x x CSA 1 x x . . . x x x x x x x . . . x x x sign extension x x x x . . . x x x x x . . . x x x to spill converter CSA 2 x x . . . x x x x x . . . x x x x x . . . x x x to SC and PS x x . . . x x x registers (shifted) to spill converter Figure 4.5: RADIX-16 MULTIPLICATION DATAPATH (partial). Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  19. 19 TWO’S COMPLEMENT • MULTIPLICAND IN 2’S COMPLEMENT = ⇒ ADDITION AND SHIFT OPERATIONS PERFORMED IN THIS SYSTEM • THE EFFECT OF 2’S COMPLEMENT MULTIPLIER TAKEN INTO AC- COUNT IN TWO WAYS: 1. BY SUBTRACTING INSTEAD OF ADDING IN THE LAST ITERATION n − 2 y = − y n − 1 2 n − 1 + i =0 y i 2 i � = ⇒ CORRECTION STEP. 2. BY RECODING THE MULTIPLIER INTO A SIGNED-DIGIT SET Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  20. 20 COMBINATIONAL MULTIPLICATION n − 1 i =0 xy i r i p = � DONE IN TWO STEPS: 1. GENERATION OF THE MULTIPLES OF THE MULTIPLICAND ( x × y i ) r i 2. MULTIOPERAND ADDITION OF THE MULTIPLES GENERATED IN STEP 1. Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  21. 21 x n-1 x 1 x 0 y i m[i] (a) m[0] m[1] m[2] m[3] m[4] m[5] x 1 y 3 m[6] m[7] (b) Figure 4.6: (a) RADIX-2 MULTIPLE GENERATION. (b) BIT-MATRIX FOR MULTIPLICATION Of MAGNITUDES ( n = 8 ). Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  22. 22 RADIX-2 TWO’S COMPLEMENT MULTIPLICATION 1. EXTEND RANGE BY REPLICATING THE SIGN BIT OF MULTIPLES • PRODUCT HAS 2 n BITS 2. THE MULTIPLE xy n − 1 2 n − 1 SUBTRACTED INSTEAD OF ADDED n − 2 y = − y n − 1 2 n − 1 + i =0 y i 2 i � • COMPLEMENT AND ADD 3. RECODE THE (2’S COMPLEMENT) MULTIPLIER INTO THE DIGIT SET { -1,0,1 } • NO ADVANTAGE IN FOLLOWING THIS APPROACH Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

  23. 23 BIT-MATRIX IN RADIX-2 2’S COMPLEMENT MULTIPLIER • Simplification of sign extension based on ( − s ) + 1 − 1 = (1 − s ) − 1 = s ′ − 1 Consequently, x n − 1 y i x n − 2 y i . . . x 0 y i is replaced by ( x n − 1 y i ) ′ x n − 2 y i . . . x 0 y i -1 Digital Arithmetic - Ercegovac/Lang 2003 4 – Multiplication

Recommend


More recommend