Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECEN2102 Digital Logic Design Lecture 9 Combinational Circuits Binary Adders and Subtractors Abdullah Said Alkalbani University of.

Similar presentations


Presentation on theme: "ECEN2102 Digital Logic Design Lecture 9 Combinational Circuits Binary Adders and Subtractors Abdullah Said Alkalbani University of."— Presentation transcript:

1 ECEN2102 Digital Logic Design Lecture 9 Combinational Circuits Binary Adders and Subtractors Abdullah Said Alkalbani University of Buraimi

2 Overview °Addition and subtraction of binary data is fundamental Need to determine hardware implementation °Represent inputs and outputs Inputs: single bit values, carry in Outputs: Sum, Carry °Hardware features Create a single-bit adder and chain together °Same hardware can be used for addition and subtraction with minor changes °Dealing with overflow What happens if numbers are too big?

3 Half Adder CABS 0001 A 0 B 0 S 0 C Dec Binary °Add two binary numbers A 0, B 0 -> single bit inputs S 0 -> single bit sum C 1 -> carry out

4 Multiple-bit Addition A 3 A 2 A 1 A A B 3 B 2 B 1 B 0 B A B A i +B i C i SiSi C i+1 °Consider single-bit adder for each bit position. Each bit position creates a sum and carry

5 Full Adder C i A i B i S i C i CiCi AiBiAiBi SiSi °Full adder includes carry in C i °Notice interesting pattern in Karnaugh map.

6 Full Adder C i A i B i S i C i+1 S i = !C i & !A i & B i # !C i & A i & !B i # C i & !A i & !B i # C i & A i & B i °Full adder includes carry in C i °Alternative to XOR implementation

7 Full Adder S i = !C i & !A i & B i # !C i & A i & !B i # C i & !A i & !B i # C i & A i & B i S i = !C i & (!A i & B i # A i & !B i ) # C i & (!A i & !B i # A i & B i ) S i = !C i & (A i $ B i ) # C i & !(A i $ B i ) S i = C i $ (A i $ B i ) °Reduce and/or representations into XORs

8 Full Adder C i A i B i S i C i CiCi AiBiAiBi C i+1 °Now consider implementation of carry out °Two outputs per full adder bit (C i+1, S i ) Note: 3 inputs

9 Full Adder C i A i B i S i C i+1 CiCi AiBiAiBi C i+1 C i+1 = A i & B i # C i & B i # C i & A i °Now consider implementation of carry out °Minimize circuit for carry out - C i+1

10 Full Adder C i+1 = A i & B i # C i !A i & B i # C i & A i & !B i C i+1 = A i & B i # C i & (!A i & B i # A i & !B i ) C i+1 = A i & B i # C i & (A i $ B i ) Recall: S i = C i $ (A i $ B i ) C i+1 = A i & B i # C i & (A i $ B i )

11 Full Adder S i = C i $ (A i $ B i ) Half-adder C i+1 = A i & B i # C i & (A i $ B i ) °Full adder made of several half adders

12 Full Adder A full adder can be made from two half adders (plus an OR gate). °Hardware repetition simplifies hardware design

13 Full Adder Block Diagram °Putting it all together Single-bit full adder Common piece of computer hardware

14 4-Bit Adder C A B S °Chain single-bit adders together. °What does this do to delay?

15 Negative Numbers – 2s Complement = = = FF 16 = = = = = °Subtracting a number is the same as: 1.Perform 2s complement 2.Perform addition °If we can augment adder with 2s complement hardware?

16 4-bit Subtractor: E = 1 +1 Add A to B (ones complement) plus 1 That is, add A to twos complement of B D = A - B

17 Adder- Subtractor Circuit

18 Overflow in twos complement addition °Definition: When two values of the same signs are added: Result wont fit in the number of bits provided Result has the opposite sign. Overflow? C N-1 B N-1 A N-1 Assumes an N-bit adder, with bit N-1 the MSB

19 Addition cases and overflow OFL

20 Summary °Addition and subtraction are fundamental to computer systems °Key – create a single bit adder/subtractor Chain the single-bit hardware together to create bigger designs °The approach is call ripple-carry addition Can be slow for large designs °Overflow is an important issue for computers Processors often have hardware to detect overflow °Next time: encoders/decoder.


Download ppt "ECEN2102 Digital Logic Design Lecture 9 Combinational Circuits Binary Adders and Subtractors Abdullah Said Alkalbani University of."

Similar presentations


Ads by Google