1 / 73

Single Bit ALU

B. i. n. v. e. r. t. O. p. e. r. a. t. i. o. n. C. a. r. r. y. I. n. a. 0. 1. R. e. s. u. l. t. b. 0. 2. 1. L. e. s. s. 3. C. a. r. r. y. O. u. t. B. i. n. v. e. r. t. O. p. e. r. a. t. i. o. n. C. a. r. r. y. I. n. a. 0. 1.

darci
Télécharger la présentation

Single Bit ALU

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. B i n v e r t O p e r a t i o n C a r r y I n a 0 1 R e s u l t b 0 2 1 L e s s 3 C a r r y O u t B i n v e r t O p e r a t i o n C a r r y I n a 0 1 R e s u l t b 0 2 1 L e s s 3 S e t O v e r f l o w d e t e Single Bit ALU O v e r f l o w c t i o n b .

  2. MIPS 32 bit ALU Reg a Reg b Operation ALU CarryOut Zero Overflow Result to Reg

  3. MIPS 32 bit ALU Reg a Reg b Operation ALU CarryOut Zero Overflow Result to Reg What about the speed? 2 gate delays per bit 64 gate delays to Sum 31

  4. CarryOut = ab + aCI + bCI a b b CI a CI + CarryOut

  5. c0 a0 b0 a1 b1 a2 b2 a3 b3 a4 b4 a5 b5 2 gates c1 4 gates c2 c3 6 gates Ripple Carry c4 8 gates ci+1 = ai bi + ai ci + bi ci 10 gates c5 c6 12 Gates

  6. Carry Lookahead Adder ci is CarryIn i c1 = a0 b0 + (a0+b0)c0

  7. Carry Lookahead Adder ci is CarryIn i c1 = a0 b0 + (a0+b0)c0c2 = a1 b1 + (a1+b1)c1 = a1 b1 + (a1+b1)[a0 b0 + (a0+b0)c0] = a1b1+a1a0b0+a1a0c0+a1b0c0+b1a0b0+ b1a0c0+b1b0c0

  8. c0 a0 b0 a1 b1 c c lah c2 c1 c1 = a0 b0 + (a0+b0)c0c2 = a1 b1 + (a1+b1)c1 = a1 b1 + (a1+b1)[a0 b0 + (a0+b0)c0] = a1b1+a1a0b0+a1a0c0+a1b0c0+b1a0b0+b1a0c0+b1b0c0 + c2

  9. Carry Lookahead Adder ci is CarryIn i c1 = a0 b0 + (a0+b0)c0c2 = a1 b1 + (a1+b1)c1 = a1 b1 + (a1+b1)[a0 b0 + (a0+b0)c0] = a1b1+a1a0b0+a1a0c0+b1a0b0+b1a0c0+b1b0c0 One bit lookahead ci two gate delays from ci-2 for i even Reduces gate delays for 32 bits from 64 to 32

  10. Carry Lookahead Adder ci is CarryIn i c1 = a0 b0 + (a0+b0)c0c2 = a1 b1 + (a1+b1)c1 = a1 b1 + (a1+b1)[a0 b0 + (a0+b0)c0] c2 =a1b1+a1a0b0+a1a0c0+a1b0c0+b1a0b0+b1a0c0+b1b0c0 One bit lookahead ci two gate delays from ci-2 for i even Reduces gate delays for 32 bits from 64 to 32 c3 = a2b2+(a2+b2)c2 c4 = a3b3+(a3+b3)c3 c4 = a3b3+(a3+b3) [a2b2+(a2+b2)c2] c4 =a3b3+a3a2b2+a3a2c2+a3b2c2+b3a2b2+b3a2c2+b3b2c2

  11. c0 a0 b0 a1 b1 One Bit Lookahead a2 b2 a3 b3 c c lah c c1 c lah c2 a4 b4 a5 b5 c3 c4 c lah c 6 Gates c5 c6

  12. Carry Lookahead Adder ci is CarryIn i c1 = a0 b0 + (a0+b0)c0c2 = a1 b1 + (a1+b1)c1 = a1 b1 + (a1+b1)[a0 b0 + (a0+b0)c0] c3 = a2 b2 + (a2+b2)c2 = a2 b2 + (a2+b2){a1 b1+(a1+b1)[a0 b0+(a0+b0)c0]}

  13. Carry Lookahead Adder ci is CarryIn i c1 = a0 b0 + (a0+b0)c0c2 = a1 b1 + (a1+b1)c1 = a1 b1 + (a1+b1)[a0 b0 + (a0+b0)c0] c3 = a2 b2 + (a2+b2)c2 = a2 b2 + (a2+b2){a1 b1+(a1+b1)[a0 b0+(a0+b0)c0]} Note the patterns generate gi = ai bi propagate pi = ai + bi ci+1 = gi + pi ci if gi = 1, ci+1 = 1, if gi = 0 and pi = 1, ci+1 = ci

  14. Carry Lookahead Adder ci is CarryIn i generate gi = ai bi propagate pi = ai + bi ci+1 = gi + pi ci c1 = g0+p0c0

  15. Carry Lookahead Adder ci is CarryIn i generate gi = ai bi propagate pi = ai + bi ci+1 = gi + pi ci c1 = g0+p0c0 c2 = g1+p1g0+p1p0c0

  16. Carry Lookahead Adder ci is CarryIn i generate gi = ai bi propagate pi = ai + bi ci+1 = gi + pi ci c1 = g0+p0c0 c2 = g1+p1g0+p1p0c0 c3 = g2+p2g1+p2p1g0+p2p1p0c0

  17. Carry Lookahead Adder ci is CarryIn i generate gi = ai bi propagate pi = ai + bi ci+1 = gi + pi ci c1 = g0+p0c0 c2 = g1+p1g0+p1p0c0 c3 = g2+p2g1+p2p1g0+p2p1p0c0 c4 = g3+p3g2+p3p2g1+p3p2p1g0+p3p2p1p0c0

  18. Carry Lookahead Adder ci is CarryIn i generate gi = ai bi propagate pi = ai + bi ci+1 = gi + pi ci c1 = g0+p0c0 c2 = g1+p1g0+p1p0c0 c3 = g2+p2g1+p2p1g0+p2p1p0c0 c4 = g3+p3g2+p3p2g1+p3p2p1g0+p3p2p1p0c0 Limited by Gate Fan-in contraints

  19. Carry Lookahead Adder ci is CarryIn i ci+1 = gi + pi ci c1 = g0+p0c0 c2 = g1+p1g0+p1p0c0 c3 = g2+p2g1+p2p1g0+p2p1p0c0 c4 = g3+p3g2+p3p2g1+p3p2p1g0+p3p2p1p0c0 c5 = g4+p4c4 c6 = g5+p5g4+p5p4c4 c7 = g6+p6g5+p6p5g4+p6p5p4c4 c8 = g7+p7g6+p7p6g5+p7p6p5g4+p7p6p5p4c4 Each 4 bit stage has 2 gate delays per stage + 1 for g & p

  20. 4 bit Carry Lookahead Using Generate & Propagate c0 a0,...,a3 b0,...,b3 generate gi = ai bi propagate pi = ai + bi ci+1 = gi + pi ci s0,...s3 ALU 0 c4 g p a4,...,a7 b4,...,b7 s4,...,s7 ALU 1 c8 g p a8,...,a11 b8,...,b11 s8,...s11 ALU 2 c12 g p a12,...,a15 b12,...,b15 s12,...,s15 ALU 3 c16

  21. 4 bit Carry Lookahead 2nd Level Lookahead c0 a0,...,a3 b0,...,b3 so,...s3 ALU 0 c4 g p a4,...,a7 b4,...,b7 s4,...,s7 ALU 1 c8 g p a8,...,a11 b8,...,b11 s8,...s11 ALU 2 c12 g p a12,...,a15 b12,...,b15 G P s12,...,s15 ALU 3 c16

  22. G2 = g11+p11g10+p11p10g9+p11p10p9g8 P2 = p11p10p9p8 c12= G2 +P2c8 c8 g p a8,...,a11 b8,...,b11 s8,...s11 ALU 2 c12 g p a12,...,a15 b12,...,b15 G P s12,...,s15 ALU 3 c16

  23. G2 = g11+p11g10+p11p10g9+p11p10p9g8 P2 = p11p10p9p8 c12= G2 +P2c8 c13=g12+p12G2+p12P2c8 c8 g p a8,...,a11 b8,...,b11 s8,...s11 ALU 2 c12 g p a12,...,a15 b12,...,b15 G P s12,...,s15 ALU 3 c16

  24. G2 = g11+p11g10+p11p10g9+p11p10p9g8 P2 = p11p10p9p8 c12= G2 +P2c8 c13=g12+p12G2+p12P2c8 c14=g13+p13g12+p13p12G2+p13p12P2c8 c8 g p a8,...,a11 b8,...,b11 s8,...s11 ALU 2 c12 g p a12,...,a15 b12,...,b15 G P s12,...,s15 ALU 3 c16

  25. G2 = g11+p11g10+p11p10g9+p11p10p9g8 P2 = p11p10p9p8 c12= G2 +P2c8 c13=g12+p12G2+p12P2c8 c14=g13+p13g12+p13p12G2+p13p12P2c8 c15=g14+p14g13+p14p13g12+p14p13p12G2 +p14p13p12P2c8 c8 g p a8,...,a11 b8,...,b11 s8,...s11 ALU 2 c12 g p a12,...,a15 b12,...,b15 G P s12,...,s15 ALU 3 c16

  26. G2 = g11+p11g10+p11p10g9+p11p10p9g8 P2 = p11p10p9p8 c12= G2 +P2c8 c13=g12+p12G2+p12P2c8 c14=g13+p13g12+p13p12G2+p13p12P2c8 c15=g14+p14g13+p14p13g12+p14p13p12G2 +p14p13p12P2c8 c16=g15+etc c8 g p a8,...,a11 b8,...,b11 s8,...s11 ALU 2 c12 g p a12,...,a15 b12,...,b15 G P s12,...,s15 ALU 3 c16

  27. Multiplication - Positive numbers Example: 0010 Multiplicand x 1011 Multiplier

  28. Multiplication - Positive numbers Example: 0010 Multiplicand x 1011 Multiplier 0010

  29. Multiplication - Positive numbers Example: 0010 Multiplicand x 1011 Multiplier 0010 0010

  30. Multiplication - Positive numbers Example: 0010 Multiplicand x 1011 Multiplier 0010 0010 0000

  31. Multiplication - Positive numbers Example: 0010 Multiplicand x 1011 Multiplier 0010 0010 0000 0010

  32. Multiplication - Positive numbers Example: 0010 Multiplicand x 1011 Multiplier 0010 0010 0000 0010 0010110 Product

  33. Multiplication - Positive numbers Example: 0010 Multiplicand n bits x 1011 Multiplier m bits 0010 add 0010 shift left and add 0000 shift left and do nothing 0010 shift left and add 0010110 Product n+m bits

  34. Multiplicand Shift left 00000010 Multiplier 1011 8 bit ALU Control Test Shift right Product 00000000 1. 1 implies add

  35. Multiplicand Shift left 00000010 Multiplier 1011 8 bit ALU Shift right Control Test Product 00000010 1. 1 implies add 2. Shift

  36. Multiplicand Shift left 00000100 Multiplier 1011 8 bit ALU Shift right Control Test Product 00000010 1. 1 implies add

  37. Multiplicand Shift left 00000100 Multiplier 1011 8 bit ALU Shift right Control Test Product 00000110 • 1 implies add • Shift

  38. Multiplicand Shift left 00001000 Multiplier 1011 8 bit ALU Shift right Control Test Product 00000110 • 0 no op

  39. Multiplicand Shift left 00001000 Multiplier 1011 8 bit ALU Shift right Control Test Product 00000110 • 0 no op • Shift

  40. Multiplicand Shift left 00010000 Multiplier 1011 8 bit ALU Shift right Control Test Product 00000110 • 1 implies add

  41. Multiplicand Shift left 00010000 Multiplier 1011 8 bit ALU Shift right Control Test Product 00010110 • 1 implies add • Shift

  42. Multiplicand Shift left 00100000 Multiplier 1011 8 bit ALU Shift right Control Test Product 00010110

  43. Note: Half of the bits always 0 Multiplicand Shift left 00100000 Multiplier 1011 8 bit ALU Shift right Control Test Product 00010110

  44. Multiplication - Positive numbers – Shift Sum Example: 0010 Multiplicand x 1011 Multiplier 0010

  45. Multiplication - Positive numbers – Shift Sum Example: 0010 Multiplicand x 1011 Multiplier 0010 0010

  46. Multiplication - Positive numbers Multiplication - Positive numbers – Shift Sum Example: 0010 Multiplicand x 1011 Multiplier 0010 0010 00110

  47. Multiplication - Positive numbers Multiplication - Positive numbers – Shift Sum Example: 0010 Multiplicand x 1011 Multiplier 0010 0010 00110

  48. Multiplication - Positive numbers Multiplication - Positive numbers – Shift Sum Example: 0010 Multiplicand x 1011 Multiplier 0010 0010 00110

More Related