Chapter 5 - Combinational Logic (EEEg4302)
Chapter 5 - Combinational Logic (EEEg4302)
AASTU
Department of Electrical and
Electronics Engineering By Milkias H.
1
Outline
• Chapter 5 : Combinational Logic
• Introduction
• Basic Combinational Logic Circuits
• Combinational Logic using NAND and NOR Gates
• Functions of Combinational Logic
• Implementing Combinational Logic
• Binary Adder and Subtractor
• Magnitude Comparator
• Decoder and Encoders
• Multiplexers and Demultiplexers
2
Introduction
3
Basic Combinational Logic Circuits
• As you know, SOP expressions are implemented with an AND gate for each
product term and one OR gate for summing all of the product terms.
• This SOP implementation is called AND-OR logic and is the basic form for realizing
standard Boolean functions.
• Here, we will see the AND-OR and the AND-OR-Invert; the Exclusive-OR and
Exclusive-NOR which are a form of AND-OR logic.
4
Basic Combinational Logic Circuits
AND-OR logic
• An AND-OR circuit directly implements an SOP expression, assuming the complements
(if any) of the variables are available.
Example : for a 4- input AND-OR logic circuit, the output X is HIGH (1) if both inputs A and
B are HIGH(1) or both input C and input D are HIGH(1).
5
Basic Combinational Logic Circuits
AND-OR-Invert logic
• When the output of an AND-OR circuit is complimented (inverted),it results AND-OR-
Invert circuit. Since AND-OR logic directly implements SOP expressions. POS
expressions can be implemented with AND-OR-Invert Logic.
Example : for a 4- input AND-OR-Invert logic circuit, the output X is LOW(0) if both
inputs A and B are HIGH(1) or both input C and input D are HIGH(1).
6
Basic Combinational Logic Circuits
Exclusive-OR logic
• Although, because of its importance Exclusive-OR is considered as a type of logic gate
with its own unique symbol. It is actually a combination of 2 AND gates, 1 OR gate and
2 inverters.
X = A𝐵 + 𝐴B X=A⨁B
7
Basic Combinational Logic Circuits
X = A𝐵 + 𝐴B = 𝐴𝐵 + AB X = A⨀B
8
Combinational Logic using NAND and NOR Gates
• NAND and NOR gates can be used to implement a logic function.
• The NAND gate also exhibits an equivalent operation called the negative-OR 𝑨𝑩 =𝑨 + 𝑩 .
• The NOR gate also exhibits an equivalent operation called the negative-AND 𝑨 + 𝑩 =𝑨𝑩.
• Use of the appropriate symbols to represent the equivalent operation makes the “reading”
a logic diagram easier (bubble to bubble).
Example 1: NAND Logic for X=AB+CD
9
Combinational Logic using NAND and NOR Gates
10
Functions of Combinational Logic
• When logic gates are connected together to produce a specified output for certain
specified combinations of input variables with no storage involved; the resulting
circuit is in the category of Combinational logic.
• In combinational logic , the output level is at all times dependent on the combination
of input levels.
• A combinational circuit consists of an interconnection of logic gates.
• Combinational logic gates react to the values of the signals at their inputs and
produce the value of the output signal, transforming binary information from the
given input data to a required output data.
• A block diagram of a combinational circuit is shown in figure below. The n input binary
variables come from an external source; the m output variables are produced by the
internal combinational logic circuit and go to an external destination.
11
Implementing Combinational Logic
Design Procedure
• The design of combinational circuits starts from the specification of the design objectives
and is converted to a set of Boolean functions from which the logic diagram can be
obtained.
• The procedure involves the following steps;
I. Determine the required number of inputs and outputs and assign a symbol to each.
II. Derive the truth table that defines the required relationship between inputs and
outputs.
III. Obtain the simplified Boolean functions for each output as a function of the input
variables.
IV. Draw the logic diagram and verify the correctness of the design.
12
Binary Adder and Subtractor
13
Binary Adder and Subtractor
• When the augend and addend numbers contain more significant digits, the carry
obtained from the addition of two bits is added to the next higher order pair of
significant bits.
• A combinational circuit that performs the addition of two bits is called a half adder.
• One that performs the addition of three bits (two significant bits and a previous
carry) is a full adder. The names of the circuits comes from the fact that two Half
adders can be employed to implement a full adder.
• The basic difference between a full-adder and a half-adder is that the full-adder
accepts an input carry.
14
Binary Adder and Subtractor
Half Adder
• From the explanation of a half adder, we find that this circuit needs two binary inputs
and two binary outputs.
• The input variables designate the augend and addend bits; the output variables
produce the sum and carry.
• We assign symbols X and Y to the two inputs and S (for sum) and C (for carry) to the
outputs.
• The truth table for the half adder is listed in the following Table .
15
Binary Adder and Subtractor
Half Adder
16
Binary Adder and Subtractor
Full Adder
• A full adder is a combinational circuit that forms the arithmetic sum of three bits. It
consists of three inputs and two outputs.
• Two of the input variables, denoted by X and Y represent the two significant bits to
be added.
• The third input Z, represents the carry (Ci )from the previous lower significant
position.
• Two outputs are necessary because the arithmetic sum of three binary digits ranges
in value from 0 to 3 and binary representation of 2 or 3 needs two bits.
• The two outputs are designated by the symbols S for sum and C for carry.
17
Binary Adder and Subtractor
Full Adder
• The truth table of the full adder is listed in the following Table.
18
Binary Adder and Subtractor
Full Adder
20
Binary Adder and Subtractor
• To demonstrate with a specific example, consider the two binary numbers A = 1011
and B = 0011. Their sum S = 1110 is formed with the four-bit adder as follows:
21
Binary Adder and Subtractor
Binary Subtractor
• The subtraction of binary numbers can be done most conveniently by means of
complements.
• Remember that the subtraction A - B can be done by taking the 2’s complement of B
and adding it to A .
• The 2’s complement can be obtained by taking the 1’s complement and adding 1 to
the least significant pair of bits.
• The 1’s complement can be implemented with inverters and a 1 can be added to the
sum through the input carry.
• The addition and subtraction operations can be combined into one circuit with one
common binary adder by including an exclusive-OR gate with each full adder.
22
Binary Adder and Subtractor
Binary Subtractor
• A four-bit Adder–Subtractor circuit is shown in the following Figure. The mode input
M controls the operation. When M = 0, the circuit is an adder and when M = 1, the
circuit becomes a Subtractor.
• Each exclusive-OR gate receives input M and one of the inputs of B . When M = 0, we
have B ⨁ 0 = B. The full adders receive the value of B , the input carry is 0, and the
circuit performs A plus B . When M = 1, we have B ⨁ 1 = B and C0 = 1.
• The B inputs are all complemented and a 1 is added through the input carry. The
circuit performs the operation A plus the 2’s complement of B. (The exclusive-OR
with output V is for detecting an overflow.)
Four-bit Adder–Subtractor
(with overflow detection)
23
Magnitude Comparator
• The comparison of two numbers is an operation that determines whether one
number is greater than, less than, or equal to the other number.
• A magnitude comparator is a combinational circuit that compares two numbers A
and B and determines their relative magnitudes.
• The outcome of the comparison is specified by three binary variables that indicate
whether A >B, A = B or A < B.
• The circuit for comparing two n -bit numbers has 22n entries in the truth table and
becomes too bulky even with n = 3.
• Since a comparator circuit possesses a certain amount of regularity. Digital functions
that possess an inherent well-defined regularity can usually be designed by means of
an algorithm.
• The algorithm is a direct application of the procedure a person uses to compare the
relative magnitudes of two numbers.
24
Magnitude Comparator
• Example: Consider two numbers, A and B with four digits each. Write the coefficients
of the numbers in descending order of significance:
• Each subscripted letter represents one of the digits in the number. The two numbers
are equal if all pairs of significant digits are equal: A3 = B3, A2 = B2, A1 = B1, and
A0 = B0.It can be expressed logically with an exclusive-NOR function.
25
Magnitude Comparator
• If the corresponding digit of A is 1 and that of B is 0, we conclude that A > B. If the
corresponding digit of A is 0 and that of B is 1, we have A < B. The sequential
comparison can be expressed logically by the two Boolean functions.
• The symbols (A > B) and (A < B) are binary output variables that are equal to 1 when
A > B and A < B, respectively.
• The unequal outputs can use the same gates that are needed to generate the equal
output.
26
Magnitude Comparator
3 to 8
Decoder
The operation of the decoder may be clarified by the truth table listed in
the Table. For each possible input combination, there are seven outputs
that are equal to 0 and only one that is equal to 1. 29
Decoder
Decoder with an Enable Input
• A decoder with enable input can function as a Demultiplexer— a circuit that receives
information from a single line and directs it to one of 2n possible output lines.
2 to 4
Decoder
Enable
A two-to-four-line decoder with an enable input(Enable 0 or Active Low) constructed with NAND gates.
30
Decoder
Decoder with an Enable Input
• In general, enable inputs are a convenient feature for interconnecting two or more
standard components for the purpose of combining them into a similar function with
more inputs and outputs.
• Decoders with enable inputs can be connected together to form a larger decoder
circuit.
• Example: Two 3-to-8-line decoders with enable inputs connected to form a 4-to-16-line
decoder.
4 to 16
Decoder
Enable
32
Decoder
BCD-to-7-Segement Decoder (Application)
4-line-to-7-line decoder.
33
Encoder
34
Encoder
• Output z is equal to 1 when the input octal digit is 1, 3, 5or 7. Output y is 1 for octal
digits 2, 3, 6, or 7, and output x is 1 for digits 4, 5, 6, or 7. These conditions can be
expressed by the following Boolean output functions:
36
Multiplexer
37
Multiplexer
• The circuit has two data input lines (I0 & I1), one output line (Y) and one selection
line S . When S = 0, the upper AND gate is enabled and I0 has a path to the output.
When S = 1, the lower AND gate is enabled and I1 has a path to the output.
38
Multiplexer
39
Demultiplexer
40
Last slide
41