Presentation is loading. Please wait.

Presentation is loading. Please wait.

©2008 The McGraw-Hill Companies, Inc. All rights reserved. Digital Electronics Principles & Applications Seventh Edition Chapter 10 Arithmetic Circuits.

Similar presentations


Presentation on theme: "©2008 The McGraw-Hill Companies, Inc. All rights reserved. Digital Electronics Principles & Applications Seventh Edition Chapter 10 Arithmetic Circuits."— Presentation transcript:

1

2 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Digital Electronics Principles & Applications Seventh Edition Chapter 10 Arithmetic Circuits Roger L. Tokheim ©2008 The McGraw-Hill Companies, Inc. All rights reserved.

3 INTRODUCTION Binary Addition Half & Full Adders Binary Subtraction Half & Full Subtractors Parallel Adders and Subtractors Using Adders for Subtraction Binary Multiplication Binary Multipliers 2s Complement Notation 2s Complement Adding/Subtracting

4 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Conceptually similar to decimal addition Example: Add the binary numbers 1010 and 11 Binary Addition 1 0 + 1 1 (carry) 1 1011

5 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Add the Binary numbers 11010 and 1100 QUIZ 1 1 0 1 0 + 1 1 0 0 (carry) 1 011001 (carry) 1

6 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Logic device that adds two binary numbers Only adds Least Significant Digit (LSD) column (1s column) in binary addition Half Adder A B  (sum) C 0 (carry out) Half Adder Input Output Logic Symbol: Logic Diagram:

7 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. ? ? QUIZ Q#1- This circuit is called a ___. ANS: Half-adder Q#2- What are the sum and carry out outputs from the half adder circuit? A = 0 B = 0 ANS: Sum=0, Carry out=0 Q#3- What are the sum and carry out outputs from the half adder circuit? A = 0 B = 1 ANS: Sum=1, Carry out=0 Q#4- What are the sum and carry out outputs from the half adder circuit? A = 1 B = 1 ANS: Sum=0, Carry out=1 Q#5- What are the sum and carry out outputs from the half adder circuit? A = 1 B = 0 ANS: Sum=1, Carry out=0

8 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Used for adding binary place values other than the 1s place Full Adder Logic Symbol: Logic Diagram: A B  (sum) C 0 (carry out) Full Adder Input Output C in

9 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ ? ? Q#1- This combinational logic circuit is described as a(n) ___. ANS: full-adder Q#2- What are the sum and carry out outputs of this full-adder circuit? Cin = 0 A = 0 B = 0 ANS: Sum=0, Carry out=0 Q#3- What are the sum and carry out outputs of this full-adder circuit? Cin = 0 A = 0 B = 1 ANS: Sum=1, Carry out=0 Q#4- What are the sum and carry out outputs of this full-adder circuit? Cin = 1 A = 0 B = 1 ANS: Sum=0, Carry out=1 Q#5- What are the sum and carry out outputs of this full-adder circuit? Cin = 1 A = 1 B = 1 ANS: Sum=1, Carry out=1 Q#6- What are the sum and carry out outputs of this full-adder circuit? Cin = 0 A = 1 B = 1 ANS: Sum=0, Carry out=1

10 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Example: Subtract binary number 101 from 1011 Binary Subtraction 1 0 1 1 - 1 0 1 (borrow) 0110 1 0

11 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Subtract binary number 11 from 1010 QUIZ 1 0 - 1 1 1110 1 1000 01 1

12 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Subtracts LSD column in binary subtraction Half Subtractor A B D i (difference) B 0 (borrow out) Half Subtractor Input Output Logic Symbol: Logic Diagram:

13 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ ? ? Q#1- What is the difference and borrow outputs from This half-subtractor circuit? (A – B) A = 0 B = 0 ANS: Di= 0, Bo= 0 Q#2- What is the difference and borrow outputs from this half-subtractor circuit? (A – B) A = 1 B = 0 ANS: Di= 1, Bo= 0 Q#3- What is the difference and borrow outputs from this half-subtractor circuit? (A – B) A = 1 B = 1 ANS: Di= 0, Bo= 0 Q#4- What is the difference and borrow outputs from this half-subtractor circuit? (A – B) A = 0 B = 1 ANS: Di= 1, Bo= 1

14 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Used for subtracting binary place values other than the 1s place Full Subtractor Logic Symbol: Logic Diagram: A B D i (difference) B 0 (borrow out) Full Subtractor Input Output B in A B DiDi B0B0 H. S. B in

15 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ ? ? Q#1- What are the Difference and Borrow out output from this full-subtractor circuit? (A – B - Bin) Bin = 0 A = 0 B = 0 HINT: truth table from textbook (Fig. 10-10) is helpful ANSWER: Di = 0, Bo = 0 Q#2- What are the Difference and Borrow out output from this full-subtractor circuit? (A – B - Bin) Bin = 1 A = 0 B = 0 ANSWER: Di = 1, Bo = 1 Q#3- What are the Difference and Borrow out output from this full-subtractor circuit? (A – B - Bin) Bin = 1 A = 1 B = 1 ANSWER: Di = 1, Bo = 1 Q#4- What are the Difference and Borrow out output from this full-subtractor circuit? (A – B - Bin) Bin = 1 A = 0 B = 1 ANSWER: Di = 0, Bo = 1 Q#5- What are the Difference and Borrow out output from this full-subtractor circuit? (A – B - Bin) Bin = 0 A = 1 B = 0 ANSWER: Di = 1, Bo = 0 Q#6- What are the Difference and Borrow out output from this full-subtractor circuit? (A – B - Bin) Bin = 0 A = 1 B = 1 ANSWER: Di = 0, Bo = 0

16 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Use half adder for LSD Use full adder for other digits Parallel Adding A 2 A 1 A 0 + B 2 B 1 B 0

17 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Parallel Adder 1s place uses half-adder 2s, 4s, 8s places use full adders SUM appears here Enter binary numbers to be added here 0 0 1 1 + 1 0 0 0 0 1 0 1 1 1 1 0 0 + 1 1 1 1 1 1 0 1 1 1 0 1 0 0 1 1 1 0 + 0 1 1 0 Parallel adders are available in IC form. ©2008 The McGraw-Hill Companies, Inc. All rights reserved.

18 QUIZ Q#1- With the top full adder’s Cin input LOW, this operates as a half-adder while the bottom three are full adders. (T or F) 4-bit number Q#2- When the 4-bit parallel adder adds binary 1100 and 0011 the sum appearing at the lower right will be ___. Q#3- When the 4-bit parallel adder adds binary 0111 and 1001 the sum appearing at the lower right will be ___. Q#4- When the 4-bit parallel adder adds binary 1101 and 1001 the sum appearing at the lower right will be ___. Q#5- When the 4-bit parallel adder adds binary 0011 and 0110 the sum appearing at the lower right will be ___. Q#6- When the 4-bit parallel adder adds binary 1111 and 1111 the sum appearing at the lower right will be ___. Q#7- When the 4-bit parallel adder adds binary 1010 and 1001 the sum appearing at the lower right will be ___. ANS: True ANS: 01111 ANS: 10000 ANS: 10110 ANS: 01001 ANS: 11110 ANS: 10011

19 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Parallel Subtractor Using Full Adders Note the use of four full adder circuits Also notice the addition of four inverters on the B inputs to the FAs Inverters HIGH at Carry in input makes this perform as a full adder circuit Binary numbers to be subtracted are input here 1 1 1 1 - 0 0 1 1 The result (difference) of the subtraction problem will appear here. 1 1 0 0 1 0 0 1 - 0 1 1 1 0 0 1 0 HIGH at Carry in input acts like adding +1 to a 1s C number to form the 2s complement. 1sC is formed by four inverters.

20 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Example: Multiply the binary numbers 111 and 101. Binary Multiplication 111 000 111 110001 1 1 1 x 1 0 1 Multiplicand Multiplier 1st partial product 2nd partial product 3rd partial product Product 111 x 101 can also be calculated: 111 + 111 + 111 + 111 + 111

21 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Multiply the binary numbers 101 and 100. 1 0 1 x 1 0 0 000 000 101 00101 QUIZ

22 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Binary multiplier circuits – utilize repeated addition. Binary Multipliers Block Diagram: Multiplicand register Multiplier down counter Product register Adder

23 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. 2s complement representation - widely used in microprocessors. Represents sign and magnitude 2s Complement Notation Decimal: +7 +4 +1 0 -1 -4 -7 2s Complement: 0111 0100 0001 0000 1111 1100 1001 MSBLSB Sign bit (0 = + ; 1 = -)

24 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Converting positive numbers to 2s complement: Same as converting to binary Converting negative numbers to 2s complement: 2s Complement - Conversions - 4 (decimal) 0 1 0 0 1 0 1 1 - 4 = 1 1 0 0 (2s Complement) Decimal to 2s Complement Convert decimal to binary 1s complement Add 1 2s Complement to Binary 1 1 0 0 (2s C) 0 0 1 1 0 1 0 0 (Binary) 1s complement Add 1

25 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ Q#1- Convert the decimal number –4 to 2s complement. 4 (decimal) 0100 1011 Step 1: convert decimal to binary Step 2: convert to 1s complement Step 3: add +1 equaling 2s complement 1100 2s C ANS: -4 = 1100 2sC Q#2- Convert the decimal number –-7 to 2s complement. 7 (decimal) 0111 1000 1001 2s C ANS: -7 = 1001 2sC Q#3- Convert the decimal number –1 to 2s complement. 1 (decimal) 0001 1110 1111 2s C ANS: -1 = 1111 2sC Q#4- Convert the decimal number +6 to 2s complement. 6 (decimal) 0110 Not needed ANS: +6 = 0110 2sC Q#5- Convert the decimal number -8 to 2s complement. 8 (decimal) 1000 0111 1000 2sC ANS: -8 = 1000 2sC

26 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ Q#1- Convert the 2s complement number 1110 to decimal. 0001 0010 binary Step 1: convert to 1s complement Step 2: Add +1 Step 3: convert binary to decimal 2 decimal ANS: 1110 2sC = -2 decimal 1110 Q#2- Convert the 2s complement number 0101 to decimal. Not needed 0101 binary 5 decimal ANS: 0101 2sC = +5 decimal Q#3- Convert the 2s complement number 1001 to decimal. 1001 0110 0111 binary 7 decimal ANS: 1001 2sC = -7 decimal Q#4- Convert the 2s complement number 1111 to decimal. 1111 0000 0001 binary 1 decimal ANS: 1111 2sC = -1 decimal

27 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. 2s complement notation makes it possible to add and subtract signed numbers Adding/Subtracting in 2s Complement (- 1) + (- 2) (- 3) 1 1 + 1 1 1 0 1011 1 Discard (+1) + (- 3) (- 2) 0 0 0 1 + 1 1 0 1 0111 (Decimal)2s Complement 2s complement

28 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Add the following 2s complement numbers: 0 1 + 1 1 0 0 100 QUIZ 01 (+5) + (- 4) (+1) Discard

29 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Practical Suggestion for Binary Math Use a scientific calculator. Most scientific calculators have DEC, BIN, OCT, and HEX modes and can either convert between codes or perform arithmetic in different number systems. Most scientific calculators also have other functions that are valuable in digital electronics such as AND, OR, NOT, XOR, and XNOR logic functions.

30 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. REVIEW Binary Addition Half & Full Adders Binary Subtraction Half & Full Subtractors Parallel Adders and Subtractors Using Adders for Subtraction Binary Multiplication Binary Multipliers 2s Complement Notation 2s Complement Adding/Subtracting


Download ppt "©2008 The McGraw-Hill Companies, Inc. All rights reserved. Digital Electronics Principles & Applications Seventh Edition Chapter 10 Arithmetic Circuits."

Similar presentations


Ads by Google