1 / 26

درس مدارهای منطقی دانشگاه قم lc-qom.blogfa / مدارهای منطقی محاسباتی

درس مدارهای منطقی دانشگاه قم http://lc-qom.blogfa.com / مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه امیرکبیر http://ceit.aut.ac.ir/~szamani/index_files/logic.htm. Adder and Subtractor. Ai. Ai. 0. 1. 0. 1. Bi. Bi. 0. 1. 0. 0. 0.

Download Presentation

درس مدارهای منطقی دانشگاه قم lc-qom.blogfa / مدارهای منطقی محاسباتی

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. درس مدارهای منطقی دانشگاه قم http://lc-qom.blogfa.com/ مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه امیرکبیر http://ceit.aut.ac.ir/~szamani/index_files/logic.htm

  2. Adder and Subtractor

  3. Ai Ai 0 1 0 1 Bi Bi 0 1 0 0 0 0 1 0 1 0 1 1 Sum = Ai Bi + Ai Bi = AiBi Half Adder (HA) • Add single bits Ai Bi Sum Carry 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 Carry = Ai . Bi

  4. Full Adder (FA) • For adding multiple bits, we need three inputs

  5. A B CI S CO A B 0 0 0 0 0 CI 00 01 11 10 0 0 1 1 0 0 0 1 0 1 0 1 0 1 0 0 1 1 0 1 1 1 0 1 0 1 0 0 1 0 1 0 1 0 1 A B 1 1 0 0 1 1 1 1 1 1 CI 00 01 11 10 0 0 0 1 0 1 0 1 1 1 Full Adder (FA) S CO S = CI xor A xor B CO = B CI + A CI + A B = CI (A + B) + A B

  6. Full Adder Using 2 Half Adders • A full adder can also be realized with two half adders and an OR gate, since Ci+1 can also be expressed as: • Ci+1 = AiBi + (Ai  Bi)Ci and Si = (Ai Bi)  Ci Ai Si Bi Ci+1 Ci

  7. Example: 4-bit Ripple Carry Adder

  8. Adder/Subtractor A - B = A + (-B) = A + B’ + 1

  9. 4-bit Binary Adder/Subtractor (cont.) S=0 B3 B2 B1 B0 0 S=0 selects addition

  10. 4-bit Binary Adder/Subtractor (cont.) S=1 B3’ B2’ B1’ B0’ 1 S=1 selects subtraction

  11. Overflow Detection • Overflow can occur ONLY when both numbers have the same sign. • This condition can be detected when the carry out (Cn) is different than the carry at the previous position (Cn-1).

  12. Overflow Detection V Cn-1 Cn C n-bit Adder/Subtractor • C =1 indicates overflow condition when adding/subtr. unsigned numbers. • V=1 indicates overflow condition when adding/subtr. signed-2’s complement numbers

  13. Delay Analysis of Ripple Adder • Carry out of a single stage can be implemented in 2 gate delays after CI is ready. • For a 16 bit adder, the 16th bit carry is generated after about 16 * 2 = 32 gate delays. • The sum bit takes one additional gate delay to generate the sum of the 16th bit after 15th bit carry ~ 15 * 2 + 1 = 31 gate delays • Takes too long - need to investigate FASTER adders!

  14. @0 A @1 @N+1 late arriving signal B @0 CI @N CO @N+2 two gate delays to compute CO A @0 B @0 @1 C 0 A @0 A S @2 @0 0 0 B 0 B C @3 S 0 1 @N CI @N+1 A S @4 1 1 1 B C @5 1 2 A S @6 2 2 2 B C @7 2 3 A S @8 3 3 3 B C @9 3 4 Delay Analysis of Ripple Adder 4 stage adder

  15. Carry Lookahead Adder • Carry Generate • Gi = Ai Bimust generate carry when A = B = 1 • Carry Propagate • Pi = Ai xor Bicarry-in will equal carry-out here • Sum and Carry can be reexpressed in terms of generate/propagate: Si = Ai xor Bi xor Ci = Pi xor Ci Ci+1 = Ai Bi + Ai Ci + Bi Ci = Ai Bi + Ci (Ai + Bi) = Ai Bi + Ci (Ai xor Bi) = Gi + Ci Pi

  16. Carry Lookahead Adder C1 = G0 + P0 C0 C2 = G1 + P1 C1 = G1 + P1 G0 + P1 P0 C0 C3 = G2 + P2 C2 = G2 + P2 G1 + P2 P1 G0 + P2 P1 P0 C0 C4 = G3 + P3 C3 = G3 + P3 G2 + P3 P2 G1 + P3 P2 P1 G0 + P3 P2 P1 P0 C0 • Each of the carry equations can be implemented in a two-level logic network • Variables are the adder inputs.

  17. Ai Pi Bi Si Ci Gi C0 C0 C0 P0 C1 P0 P0 P1 P1 G0 P2 P2 P3 G0 P1 G0 C0 P2 P1 P0 P2 P1 G1 C3 P3 G0 P2 C2 G1 P1 P2 G2 P3 G1 C4 G2 P3 G3 CLA @0 @1 @0 • Increasingly complex logic @t+1 @t @1

  18. 0 C 0 A S @2 0 0 1 B C @3 0 1 A S @4 2 1 1 B C @3 1 2 A S @4 2 2 B C @3 2 3 A S @4 3 3 3 B C @3 3 4 Delay Analysis of CLA • Ci’s are generated independent of N 4 stage adder final sum and carry • NOTE HOWEVER THIS ASSUMES ALL GATE DELAYS ARE SAME • Not true, delays depand on fan-ins and fan-out

  19. BCD Addition Addition: 5 = 0101 3 = 0011 1000 = 8 5 = 0101 8 = 1000 1101 = 13! Problem when digit sum exceeds 9 Solution: add 6 (0110) if sum exceeds 9! 5 = 0101 8 = 1000 1101 6 = 0110 1 0011 = 1 3 in BCD 9 = 1001 7 = 0111 1 0000 = 16 in binary 6 = 0110 1 0110 = 1 6 in BCD

  20. A B A B A B A B 3 3 2 2 1 1 0 0 F A F A F A F A 1 1XX F A F A S S S S 3 2 1 0 BCD Adder CO CI CO CI CO CI CO CI Cin S S S S A1 1X1X A2 CO CI CO CI 0 S S Cout Add 0110 to sum whenever it exceeds 1001 (11XX or 1X1X)

  21. Multiplier

  22. A1 A2B1 B2 P1 P2P4 P8 2x2-bit Multiplier A2 A1 B2 B1 P8 P4 P2 P1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 1 0 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 1 1 0 1 1 1 0 0 1 4-variable K-map for each of the 4 output functions

  23. A2 A2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 B1 B1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 B2 B2 A1 A1 A2 A2 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 1 B1 B1 0 1 1 0 1 0 0 0 0 1 0 1 0 1 0 0 B2 B2 A1 A1 2x2-bit Multiplier (cont’d) K-map for P4 K-map for P8 P4 = A2B2B1' + A2A1'B2 P8 = A2A1B2B1 K-map for P2 K-map for P1 P1 = A1B1 P2 = A2'A1B2 + A1B2B1' + A2B2'B1 + A2A1'B1

  24. Y0 Multiplier X1 Y1 X1 Y0 X0 Y1 X0 Y0 X0 Y0 X3 Y3 X2 Y0 X2 Y1 X1 Y2 X0 Y3 X2 Y2 X2 Y0 X1 Y1 X0 Y2 X3 Y1 X2 Y2 X1 Y3 X3 Y3 X3 Y2 X2 Y3 Z7 Z6 Z4 Z5 Z3 Z2 Z1 Z0

  25. 4-Bit ALU • 74181 TTL ALU • Arithmetic-Logic Unit

  26. 4-Bit ALU

More Related