Professional Documents
Culture Documents
Lect # 06, Floyd, CH # 06 - Adder, Subtractor, Multiplier, Comparator PDF
Lect # 06, Floyd, CH # 06 - Adder, Subtractor, Multiplier, Comparator PDF
Fundamentals
Tenth Edition
Floyd
Chapter 6
Combinational Logic
• The three basic logic functions AND, OR, and NOT
can be combined to form various other types of
more complex logic functions, such as:
– comparison,
– arithmetic,
– code conversion,
– encoding/decoding,
– data selection,
– counting, and
– storage
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ307458. All Rights Reserved
Summary
Half-Adder
Basic rules of binary addition are performed by a
Inputs Outputs
half adder, which has two binary inputs (A and B)
A B Cout S
and two binary outputs (Carry out and Sum).
0 0 0 0
0 1 0 1
The inputs and outputs can be summarized on a 1 0 0 1
truth table. 1 1 1 0
S S
A S
A
Cout
B Cout B
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Summary
Half-Subtractor
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Summary
Full-Adder
Inputs Outputs
S S
A S A S
B
B Cout Cout
Cin
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Full-Adder Summary Inputs Outputs
A B Cin Cout S
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Summary
Full-Adder S S 0 Sum
1 A S 1 A S
0 B Cout 0 B Cout 1
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Summary
Full-Adder
Inputs Outputs
A B Cin Cout S
S S 0 Sum
0 0 0 0 0 1 A S 1 A S
0 0 1 0 1
0 1 0 0 1 1
0 1 1 1 0 0 B Cout 0 B Cout
1 0 0 0 1
1 0 1 1 0 1 Cout
1 1 0 1 0
1 1 1 1 1 1
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Summary
Full-Subtractor
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Full-Subtractor
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Summary
Full-Adder
Inputs Outputs
S
A S
B
Cout
Cin
Full Adder
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Summary
Parallel Adders Modification, Look a Head Carry
Full adders are combined into parallel adders that can add binary
numbers with multiple bits. A 4-bit adder is shown.
A4 B4 A3 B3 A2 B2 A1 B1
C0
C4
C3 C2 C1
S4 S3 S2 S1
The output carry (C4) is not ready until it propagates through all of the
full adders. This is called ripple carry, delaying the addition process.
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Summary
Parallel Adders
The logic symbol for a 4-bit parallel adder is shown. This 4-bit adder
includes a carry in (labeled (C0) and a Carry out (labeled C4).
S
1 1
Binary 2 2 4-bit
number A 3 3 sum
4 4
1
Binary 2
number B 3
4
Input Output
C0 C4
carry carry
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Summary
Parallel Subtractor
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Summary
Binary Multiplication
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Summary
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
4-Bit Binary Multiplication
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Summary
4-Bit Binary Multiplication
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
4-Bit Binary Multiplication
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Functions of Combinational Logic
COMPARATOR
CIRCUIT
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Functions of Combinational Logic
• Comparator
–Comparator is a logic circuit that performed magnitude comparison.
–It compares two quantities and indicates whether they are equal or not
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Functions of Combinational Logic
• Comparator
– Three possibilities, while comparing
• Equal
Greater than
• Not Equal
Lessthan
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Functions of Combinational Logic
• Comparator
– Inequality - 1-bit Comparator
• Truth table
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Functions of Combinational Logic
• Comparator
–Equality for 2-bit
• In order to compare binary numbers containing two bits each, an additional
exclusive-NOR gate is necessary.
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Functions of Combinational Logic
• Comparator
–Inequality
• But how to compare for more than
1-bit numbers?
• To determine an inequality of large
binary numbers, A and B, you first
examine the highest-order bit in
each number.
• The general procedure used in a
comparator is to check for an
inequality in a bit position, starting
with the highest-order bits (MSBs).
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
2-bit Comparator using Blocks of 1-bit Comparator
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Functions of Combinational Logic
• Implement 4-bit Comparator using 2-bitComparators?
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Functions of Combinational Logic
• Comparator
– Inequality – n-bit comparator
• Example – 4-bit Comparator:
A3 A2 A1 A0 B3 B2 B1 B0 Checking
MSB bit
1 0 0 1 0 0 1 1 order
Note :
Since,A3 > B3
When such an inequality is found in
highes order number, any other
A >B inequalities
t in lower-order bit positions
must be ignored because it is
possible for an opposite indication to
occur
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Functions of Combinational Logic
• Comparator
– Inequality
• Exercise
A= 0110
B =0011
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Functions of Combinational Logic
• Design a 4-bit Comparator ?
1-bit comparator
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Functions of Combinational Logic
• 4-bit Comparator
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Functions of Combinational Logic
• 8-bit Comparator
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Summary
Representation of numbers on ICs
Floyd, Digital Fundamentals, 10th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved