 Download Presentation Computer Arithmetic I-II

# Computer Arithmetic I-II - PowerPoint PPT Presentation

Computer Arithmetic I-II. Addition concepts. 1 bit adder 2 inputs for the operands. Third input – carry in from a previous addition/adder Single bit output for the sum. Second output to pass on the carry. Concepts I/P output specification – 1 bit adder. Concepts Logical equations. I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation ## Computer Arithmetic I-II

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
1. Computer Arithmetic I-II

2. Addition concepts • 1 bit adder • 2 inputs for the operands. • Third input – carry in from a previous addition/adder • Single bit output for the sum. • Second output to pass on the carry.

3. ConceptsI/P output specification – 1 bit adder

4. ConceptsLogical equations • CarryOut = (b.CarryIn) + (a.CarryIn) + (a.b) + (a.b.Carryin). • If the last term (a.b.carryin) is true, then one of the first three has to be true so we can leave out the last term • CarryOut = (b.CarryIn) + (a.CarryIn) + (a.b). • Sum = 1 when exactly one or all three inputs are 1.

5. Hardware for CarryOut signal • Input combinations for which we have a carryout

6. 1-bit logical Unit- &, + • Use a mux to select between the two functions – arith. And logic addition. • 1-bit selector since we have two operations to select from

7. 1-bit ALU • This ALU can perform the logical functions +, &, and the arithmetic fn. Of addition. • A 2-bit selector is used to determine which operation is sent to the O/P.

8. 32 bit ALU obtained from 1-bit ALUs.

9. Subtraction • Same as addition. We negate the appropriate operand and then perform the addition. • 2’s complement • 1’s complement

10. Subtraction • Include a mux which chooses btw b and b. • We set the carry in signal to 1: • Remember 2s complement of a number a + b + 1 = a + (b + 1) = a – b *** b +1 = -b (2s complement)

12. Ripple carry adder • Created by linking directly the carries of 1-bit adders. • a single carry out of the LSB can ripple all the way through the adder. • this results in a carry out of the MSB • Problem: The computation is time consuming.

13. Carry Lookahead Question: How quickly can we add two operands e.g 32 bit operands? • The carry input depends on the operation in the previous 1-bit adder. • Looking at the dependencies involved, the MSB of the sum has to wait for each of the preceding bit adders to sequentially evaluate. • PROBLEM : TOO SLOW

14. Analysis • CarryIn2 is exactly = CarryOut1. = (b1.Carryin1) + (a1.Carryin1) + (b1.a1) • Similarly CarryIn1 is exactly = CarryOut0. = (b0.Carryin0) + (a0.Carryin0) + (b0.a0) • The purpose is to calculate ahead of time and bypass some adders thereby reducing calculation time.

15. Analysis Using ci = CarryIni: • c2 = (b1.c1) + (a1.c1) + (a 1.b1). • c1 = (b0.c0) + (a0.c0) + (a 0.b0). This expansion becomes more complex as we move to higher order bits.

16. Propagate and generate • Attempt is to limit complexity as well as increasing the speed. Fast carry schemes attempt to do this. • Carry Lookahead adder. • Uses levels of abstraction in its implementation. • Propagate • generate

17. Propagate & generate gi • Ci+1= (bi.ci) + (ai.ci) + (ai.bi) = (ai.bi) + ci.(ai+bi) Using this formula: c2 = (ai.bi) + (ai+bi) . ((a0.b0) + (a0+b0) . c0) • generate = gi = (ai.bi). • propagate = pi = (ai+bi). • ci+1 = gi + pi . ci pi

18. pi & gi contd. • Assuming gi = 1: ci+1 = gi + pi . ci = 1 + pi . ci = 1 • The adder generates a CarryOut(ci+1) independent of the value of CarryIn(ci) if gi=1. • Assuming gi = 0 & pi = 1: ci+1 = gi + pi . Ci = 0 + pi . ci = ci • The adder propagtes CarryIn (ci) to a CarryOut.

19. Logical expressions • c1 = g0 + (p0.c0) • c2 = g1 + (p1.g0) + (pi.p0.c0) • c3 = g2 +(p2.g1) + (p2p1g0) + (p2.p1.p0.c0) • c4 = g3 + (p3.g2) + (p3.p2.g1) + (p3.p2.p1.g0) + (p3.p2.p1.p0.c0) Cin propagates a carry if some earlier adder generates a carry and all intermediary adders propagate a carry.

20. 2nd level of abstraction. • Faster => carry lookahead at a higher level. • 4-bits adder, we need P0, P1, P2, P3 P0 = p3.p2.p1.p0 P1 = p3.p2.p1.p0 P2 = p3.p2.p1.p0 P3 = p3.p2.p1.p0 ******Super propagate (Pi) is only true if each of the bits will propagate a carry P = super propagate Propagate & generate at higher level

21. Remember, a carry is generated out of position i if gi = 1 or pi = 1 and there was a carryin From the previous position. Example 1101 0110 0000 0001 0010 0001 0110 1011 P3, G3 P2, G2 P1, G1 P0, G0 pi = ai + bi gi = ai.bi

22. 2nd level of abstraction. • Generate Gi. • Is there a carryout of the MSB of the 4-bit addition? A Gi of the MSB is true • If gi is true for the MSB • If a previous gi is true and all intermediate propagates are true. G0 = g3 + (p3.g2)+(p3.p2.g1)+(p3.p2.p1.g0) G1 = g7 + (p7.g6)+(p7.p6.g5)+(p7.p6.p5.g4) G2 = g11 + (p11.g10)+(p11.p10.g9)+(p11.p10.p9.g8) G3 = g15 + (p15.g14)+(p15.p14.g13)+(p15.p14.p13.g12)

23. Carryout • The carries out of every fourth position is then given by… • C1 = G0 + (P0.c0) • C2 = G1 + (P1.G0) + (P1.P0.c0) • C3 = G2 + (P2.G1) + (P2.P1.G0) + (P2.P1.P0.c0) • C4 = G3 + (P3.G2) + (P3.P2.G1) + (P3.P2.P1.G0) + (P3.P2.P1.P0.c0)

24. Carry Lookhead Unit  pre-calculated the carry bit

25. At bit 0

26. At bit 1

27. At bit 2

28. At bit 4

29. Overall

30. Total Delay

31. Extension for 64 bits ?

32. Basic unit of 4 bits

33. p and g inputs

34. Big block

35. Two-level

36. P and G ?

37. Generate the G

38. Propagate

39. Big picture

40. Multiple Level