fast two operand addition a conventional number system
play

FAST TWO-OPERAND ADDITION A. Conventional number system. - PowerPoint PPT Presentation

1 FAST TWO-OPERAND ADDITION A. Conventional number system. Carry-propagate adders (CPA) Switched carry-ripple adder Carry-skip adder Carry-lookahead adder Prefix adder Carry-select adder and conditional-sum adder


  1. 1 FAST TWO-OPERAND ADDITION A. Conventional number system. Carry-propagate adders (CPA) • Switched carry-ripple adder • Carry-skip adder • Carry-lookahead adder • Prefix adder • Carry-select adder and conditional-sum adder • Variable-time adder B. Redundant number system. Totally-parallel adders (TPA); adders with limited carry propagation • Carry-save adder • Signed-digit adder Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  2. 2 n-BIT ADDITION x + y + c in = 2 n c out + s The solution: s = ( x + y + c in ) mod 2 n 1 if ( x + y + c in ) ≥ 2 n    c out =  0 otherwise    = ⌊ ( x + y + c in ) / 2 n ⌋ Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  3. 3 x i y i X Y n n c out c in c i+1 c i ADDER FA n s i S (a) (b) Figure 2.1: (a) An n -bit adder. (b) 1-bit adder (full adder module). Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  4. 4 1-BIT ADDITION • Primitive module full adder (FA) x i + y i + c i = 2 c i +1 + s i with solution s i = ( x i + y i + c i ) mod 2 c i +1 = ⌊ ( x i + y i + c i ) / 2 ⌋ Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  5. 5 ADDITION: TWO-STEP PROCESS 1. Obtain carries (carry at i depends on j ≤ i ) – non-trivial to do fast 2. Compute sum bits (local function) Y X n n c 0 = c in c c n Step 1: = out Obtain carries c c i c 1 n-1 c 0 y n-1 y i y 1 y 0 x n-1 x i x 1 x 0 Step 2: Compute sum bits s 1 s 0 s n-1 s i Figure 2.2: Steps in addition. Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  6. 6 CARRY-OUT CASES Case x i y i x i + y i c i +1 Comment 1 0 0 0 0 kill (stop) carry-in 2 0 1 1 c i propagate carry-in 1 0 1 c i propagate carry-in 3 1 1 2 1 generate carry-out Case 1 (Kill): k i = x ′ i y ′ y i ) ′ i = ( x i Case 2 (Propagate): p i = x i ⊕ y i Case 3 (Generate): g i = x i y i Then c i +1 = g i p i c i = x i y i ( x i ⊕ y i ) c i Alternative (simpler) expression: c i +1 = g i + a i c i Since a i = k ′ i we call it ”alive” Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  7. 7 CARRY CHAINS Two types: 1-carry chain consisting of carry=1 0-carry chain consisting of carry=0 i 9 8 7 6 5 4 3 2 1 0 x i 1 0 1 0 1 1 1 1 0 0 y i 0 0 0 1 0 1 0 0 1 0 p k p p p g p p p k a a a a a a a a c i +1 0 ← 0 1 ← 1 ← 1 ← 1 0 ← 0 ← 0 ← 0 Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  8. 8 Generalization to group of bits c j +1 = g ( j,i ) p ( j,i ) c i = g ( j,i ) a ( j,i ) c i or, for i = 0 c j +1 = g ( j, 0) p ( j, 0) c 0 = g ( j, 0) a ( j, 0) c 0 Recursive combining of subranges of variables: g ( f,d ) = g ( f,e ) p ( f,e ) g ( e − 1 ,d ) = g ( f,e ) a ( f,e ) g ( e − 1 ,d ) a ( f,d ) = a ( f,e ) a ( e − 1 ,d ) p ( f,d ) = p ( f,e ) p ( e − 1 ,d ) Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  9. 9 Generalization (cont.) e e-1 f d g L a L g R a R g (f,e) a (f,e) g (e-1,d) a (e-1,d) GA GA g out a out g (f,d) a (f,d) (a) (b) Figure 2.3: Computing ( g ( f,d ) , a ( f,d ) ). Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  10. 10 BASIC CARRY-RIPPLE ADDER (CRA) y 0 x 0 y i x i y n-1 x n-1 c i+1 c out =c n c i c 1 FA FA FA c 0 = c in s 0 s i s n-1 Figure 2.4: Carry-ripple adder. T CRA = ( n − 1) t c + max ( t c , t s ) Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  11. 11 Implementations of full-adder x i x’ i y i y’ i x i x i y’ i c’ y i i x i x’ i c i+1 y i c i c’ i y i s i c’ x’ i y’ i+1 c i i c i x i y i c i (a) Half Adder (HA) HA p x i i s i y i g i c i+1 c i (b) p x i i s i y i g’ i c i+1 c i (c) Figure 2.5: Implementation of full-adder. (a) Two-level network. (b) Multilevel network with xor , and and or gates; (c) Multilevel implementation with xor and nand gates. Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  12. 12 SWITCHED CARRY-RIPPLE (Manchester) ADDER y i x i CC GKP (Chain Control) "0" p i k i (a) "1" g i c i+1 c i y n-1 x n-1 y n-2 x n-2 y i x i y 1 x 1 y 0 x 0 CC CC CC CC CC c in c i c n-1 c out c i+1 c 2 c 1 (b) Figure 2.6: Switch carry-ripple network (Manchester circuit) Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  13. 13 CARRY-SKIP ADDER x (j) y (j) m m CSK-m adder P (j) (j+1) (j) c in c in m-bit Carry-Ripple Adder (j) c out (group j) 0 MUX 1 m s (j) (a) Module (n/m - 1) Module j Module 0 m m m m m m CSK-m CSK-m CSK-m ADDER ADDER ADDER m m m (b) Figure 2.7: Carry-skip adder: (a) A group with carry bypass. (b) n-bit CSK adder. Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  14. 14 CARRY CHAINS IN CARRY-SKIP ADDER group 3 group 2 group 1 group 0 0 1 1 0 1 1 0 0 1 0 0 0 1 1 0 1 X 0 0 0 1 0 0 1 1 0 0 1 1 0 1 1 1 Y 15 12 8 4 0 position c 7 c 3 c 1 c 8 c 4 c 2 2 c 12 c 9 c 5 c 13 c 10 c 6 4 c 14 c 11 c 15 6 carry-skip path c 16 carry-ripple path group size m = 4 t Figure 2.8: Carry chains in carry-skip adder: A case with several carry chains. Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  15. 15 m-bit Carry-Ripple Adder c c n 0 MUX MUX MUX s n-1 (a) group 3 group 2 group 1 group 0 1 1 1 0 1 1 0 0 1 0 0 0 1 0 0 1 X 0 0 0 1 0 0 1 1 0 1 1 1 0 1 1 1 Y 15 12 8 4 0 position c 1 c 2 2 c 3 c 4 4 c 8 c 5 c 12 c 9 c 6 6 c 16 c 13 c 10 c 7 c 14 c 11 8 carry-skip path c 15 carry-ripple path t group size m = 4 (b) Figure 2.9: (a) Critical path in carry-skip adder. (b) The worst-case situation for n = 16 . Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  16. 16 WORST-CASE DELAY T CSK = mt c + t mux + ( n m − 2) t mux + ( m − 1) t c + t s = (2 m − 1) t c + ( n m − 1) t mux + t s Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  17. 17 PROBLEM WITH CLEARING OF CARRIES (j) c out (j+1) (j) c in c in m-bit Carry-Ripple Adder (group j) P (j) Figure 2.10: Carry-skip adder using AND-OR for bypass Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  18. 18 GROUP SIZE IN CARRY-SKIP ADDERS Fixed-size: 2 t c n ) 1 / 2 (minimum delay) m opt = ( t mux T opt ≈ (8 t mux t c n ) 1 / 2 Variable-size: Group size m i Group i M-1 0 M - number of groups Figure 2.11: Optimal distribution of group sizes in carry-skip adder. Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  19. 19 CARRY-LOOKAHEAD ADDER(CLA) (k-1) y x (j) y (j) x (k-1) x (1) y (1) x (0) y (0) m m m m m m m m c n c 2m c m c 0 CLA CLA CLA CLA j k-1 1 0 m m m m k=n/m s (j) s (1) s (0) s (k-1) Figure 2.12: One-level carry-lookahead adder Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  20. 20 CARRY-LOOKAHEAD MODULE y 1 x 1 y 3 x 3 y 2 x 2 y 0 x 0 CLA-4 gap gap gap gap g 2 a 2 p 2 g 1 a 1 g 0 a 0 p 0 g 3 p 3 a 3 p 1 c 4 CARRY LOOKAHEAD GENERATOR c 0 G (CLG-4) A c 1 c 2 c 3 p 0 p 1 p 2 p 3 s 1 s 0 s 2 s 3 Figure 2.13: Carry-lookahead adder module ( m = 4 ). Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  21. 21 CARRY-LOOKAHEAD GENERATOR g 3 a 3 g 2 a 2 g 1 a 1 g 0 a 0 CLG-4 A c 0 G c 3 c 2 c 1 c 4 Figure 2.14: 4-bit carry-lookahead generator CLG-4. Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  22. 22 TWO-LEVEL CARRY-LOOKAHEAD ADDER carries from CLG-4 modules (3) =c 12 (2) =c 8 (1) =c 4 (7) =c 28 (6) =c 24 (5) =c 20 (4) =c 16 c c c c c c c x 7 y 7 x 6 y 6 x 5 y 5 x 4 y 4 x 3 y 3 x 2 y 2 x 1 y 1 x 0 y 0 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 * * * * * * * * c 0 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 s 7 s 6 s 5 s 4 s 3 s 2 s 1 s 0 G A 7 G A 6 G A 5 G A 4 G A 3 G A 2 G A 1 G A 0 7 6 5 4 3 2 1 0 CLG-4 CLG-4 (8) =c 32 c (7) =c 28 (6) =c 24 (5) =c 20 (4) =c 16 (3) =c 12 (2) =c 8 (1) =c 4 c c c c c c c critical path carries to CLA-4 modules * Carry-out is not used Figure 2.15: Two-level carry-lookahead adder ( n = 32 ) Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  23. 23 carries from CLG-2 modules (3) =c 6 (2) =c 4 (1) =c 2 c c c x 3 y 3 x 2 y 2 x 1 y 1 x 0 y 0 2 2 2 2 2 2 2 2 * * * * c 0 CLA-2 CLA-2 CLA-2 CLA-2 2 2 2 2 2 2 2 2 s 3 s 2 s 1 s 0 c 4 (1) (1) (1) (1) (1) (1) (1) (1) G 3 A G 2 A G A G 0 A 3 2 1 1 0 CLG-2 CLG-2 (3) =c 6 (1) =c 2 c c (1) (1) (2) (2) G 1 A G 0 A 1 0 c 8 CLG-2 * Carry-out is not used c 4 Figure 2.16: Three-level carry-lookahead adder ( n = 8 , m = 2 ). Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

  24. 24 Prefix adders right 2 g L a L g R a R left 2 left 1 right 1 g (left 2 ,left 1 ) a (left 2 ,left 1 ) g (right 2 ,right 1 ) a (right 2 ,right 1 ) 2 2 GA GA g (left 2 ,right 1 ) 2 a (left 2 ,right 1 ) g out a out (b) (a) Figure 2.17: Composition of spans in computing ( g, a ) signals. Digital Arithmetic - Ercegovac/Lang 2003 2 – Fast Two-Operand Adders

Recommend


More recommend