Module 3
Module 3
21CS33
Venugopala Rao A S
Dept. of Computer Science and Design
AIET, Moodbidri
Module 3
• Combinational circuit design and simulation using gates:
Review of Combinational circuit design, design of circuits
with limited Gate Fan-in, Gate delays and Timing diagrams,
Hazards in combinational Logic, simulation and testing of
logic circuits
07/05/2023 21CS33 3
Review of Combinational circuit design
• Design Procedure
• The design of combinational circuits starts from the outline
of the problem statement and
• Ends in a logic circuit diagram or a set of Boolean functions
from which the logic diagram can be easily obtained.
• The design procedure involves following steps
07/05/2023 21CS33 4
Review of Combinational circuit design
• 1. The problem definition.
• 2. The determination of number of available input variables
and required output variables.
• 3. Assigning letter symbols to input and output variables.
• 4. The derivation of truth table indicating the relationships
between input and output variables.
• 5. Obtain simplified Boolean expression for each output.
• 6. Obtain the logic diagram.
07/05/2023 21CS33 5
Review of Combinational circuit design
• A Combinational Function Generator
• Here, the combinational circuit is represented by the
relationship between its input and an output variable or
variables.
• We will see a few examples to understand the procedure to
design such combinational circuits.
• E.g. 1:
• Design a combination logic circuit with three input variables
that will produce a logic 1 output when more than one input
variables are logic 1.
07/05/2023 21CS33 6
Review of Combinational circuit design
• Solution:
• Step 1 Derive the truth table for given statement
• Given that there are three input variables and one output
variable.
• Let us name them as A, B and C and let Y letter be the
symbol to one output variable.
• The relationship between input variables and output variable
needs to be tabulated in the form of truth table
07/05/2023 21CS33 7
Review of Combinational circuit design
07/05/2023 21CS33 8
Review of Combinational circuit design
• Step 2: Obtain simplified Boolean expression.
07/05/2023 21CS33 9
Review of Combinational circuit design
• Example 2: Design circuit to detect invalid BCD number and
implement using NAND gate only
• Solution:
• Truth table
07/05/2023 21CS33 10
Review of Combinational circuit design
07/05/2023 21CS33 11
Review of Combinational circuit design
07/05/2023 21CS33 12
Review of Combinational circuit design
• Design of Circuits with Limited Gate Fan-in
• In practical circuit design problems, the maximum number
of inputs on each gate is limited, (Fan-in is limited).
• Depending on the type of gates used, this limit may be 2, 3, 4
or 8.
• If a two level realization of a circuit requires more gate
inputs than allowed, factoring of the logic expression in done
to obtain a multilevel realization.
07/05/2023 21CS33 13
Review of Combinational circuit design
• E.g.: Minimize the following functions and realize them
using only 2 input NAND gates and inverters
• f1=Ʃ m(0, 2, 3, 4, 5) f2=Ʃ m(0, 2, 3, 4, 7)
• f3=Ʃ m(1, 2, 6, 7)
• Step 1: minimize each function separately
07/05/2023 21CS33 14
Review of Combinational circuit design
• Step 2: To implement each expression we need, three 3-input
OR gate.
• Since the requirement is to use 2-input OR gate we need to
factorize them.
• or
07/05/2023 21CS33 15
Review of Combinational circuit design
• Check for the common terms in these three function.
• Let us choose second expression for f2 as it has the term (a`b)
common with f1.
• The term (a`b`c) of f3 can be represented as
• a`b`c = a`(b` c) = a`((b+c`))`
• The term (b+c`) in the above expression can be shared with
the same term in the function f2.
• The term (a+c`) is common in functions f1 and f3.
• Let us first realize these function using basic gates.
07/05/2023 21CS33 16
Review of Combinational circuit design
07/05/2023 21CS33 17
Review of Combinational circuit design
• NAND Gate implementation:
• A NAND and NOR gates (universal gates) can be used to
implement any Boolean function
• Let us see how to implement a circuit that is equivalent to
the given circuit and consists of only NAND gates.
• E.g.
07/05/2023 21CS33 18
Review of Combinational circuit design
• Same Boolean Function with NAND gate is as shown below:
07/05/2023 21CS33 19
Review of Combinational circuit design
• OR Using NAND
07/05/2023 21CS33 20
Review of Combinational circuit design
• Procedure for Conversion
• Consider the following circuit.
07/05/2023 21CS33 21
Review of Combinational circuit design
• This circuit is equivalent to the original one
• The output of each AND gate is being complemented twice
before the signal reaches the OR gate.
• These inverters will play a key role in the process of
conversion.
• Now take a look at the highlighted areas.
07/05/2023 21CS33 22
Review of Combinational circuit design
• The gates in each highlighted area can be combined into one
NAND gate. Thus we get
07/05/2023 21CS33 24
Review of Combinational circuit design
• To realize using 2-input NAND gate and inverter note the
following rule, Bubbled NAND= OR
• E.g.:
07/05/2023 21CS33 25
Review of Combinational circuit design
07/05/2023 21CS33 26
Review of Combinational circuit design
07/05/2023 21CS33 27
Review of Combinational circuit design
• Gate Delays and Timing Diagrams
• When the input to a logic gate is changed, the output will not
change instantaneously.
• The transistors or other switching elements within the gate
take a finite time to react to a change in input, so that the
change in the gate output is delayed with respect to the input
change
• Following figure shows possible input and output waveforms
for an inverter.
07/05/2023 21CS33 28
Review of Combinational circuit design
07/05/2023 21CS33 30
Review of Combinational circuit design
• Several variables are usually plotted with the same time scale
so that the times at which these variables change can be
visualized easily
• Consider the following timing diagram for a circuit with two
gates
07/05/2023 21CS33 31
Review of Combinational circuit design
07/05/2023 21CS33 35
Review of Combinational circuit design
• Timing Diagram:
07/05/2023 21CS33 36
Review of Combinational circuit design
• Note that, after B changes to 0, both the inverter input (B)
and output (B’) are 0 until the propagation delay has elapsed.
• During this period, both terms in the equation for F are 0, so
F momentarily goes to 0.
• Detection of Static 1 Hazard:
• Hazards can be detected using a Karnaugh map
07/05/2023 21CS33 37
Review of Combinational circuit design
• As seen on the map, no loop
covers both minterms ABC and
ABC`.
• So if A = C = 1 and B changes,
both terms can momentarily go
to 0, resulting in a glitch in F.
07/05/2023 21CS33 38
Review of Combinational circuit design
• We can detect hazards in a two-level AND-OR circuit, using
the following procedure:
• 1. Write down the sum-of-products expression for the circuit.
• 2. Plot each term on the map and loop it.
• 3. If any two adjacent 1’s are not covered by the same loop, a
1-hazard exists for the transition between the two 1’s.
• For an n-variable map, this transition occurs when one
variable changes and the other n –1 variables are held
constant.
07/05/2023 21CS33 39
Review of Combinational circuit design
• To Eliminate Static 1 Hazard:
• If we add a loop to the map of above Figure and, then, add
the corresponding gate to the circuit, hazard gets eliminated
07/05/2023 21CS33 42
Review of Combinational circuit design
• From the K-map we can see that, four pairs of adjacent 0’s
are not covered by a common loop as indicated by the
arrows.
• Each of these pairs corresponds to a 0-hazard.
• Assume that gate delays of 3 ns for each inverter, and of 5 ns
for each AND gate and each OR gate
• when A = 0, B = 1, D = 0, and C changes from 0 to 1, a spike
may appear at the Z output for some combination of gate
delays.
• The timing diagram illustrates this.
07/05/2023 21CS33 43
Review of Combinational circuit design
• A = 0, B = 1, D = 0,
• C = 01
07/05/2023 21CS33 44
Review of Combinational circuit design
• To Eliminate Static 0 Hazard:
• We can eliminate the 0-hazards by looping additional prime
implicants that cover the adjacent 0’s that are not already
covered by a common loop.
• This requires three additional loops as shown in the
following Figure.
07/05/2023 21CS33 45
Review of Combinational circuit design
•.
07/05/2023 21CS33 46
Review of Combinational circuit design
• The resulting circuit requires seven gates in addition to the
inverters, as given by below expression
• 𝐹= (𝐴+𝐶) (𝐴′+𝐷′) (𝐵′+𝐶′+𝐷) (𝐶+𝐷′) (𝐴+𝐵′+𝐷) (𝐴′+𝐵′+𝐶′)
07/05/2023 21CS33 48
Review of Combinational circuit design
• This is true when the design is built in IC form, because
fabricating an IC may take a long time and correcting errors
may be very expensive.
• Simulation is done for following reasons:
• Verification that the design is logically correct
• Verification that the timing of the logic signals is correct, and
• Simulation of faulty components in the circuit as an aid to
finding tests for the circuit.
07/05/2023 21CS33 49
Review of Combinational circuit design
• A simple simulator for combinational logic works as follows:
1. The circuit inputs are applied to the first set of gates in the
circuit, and the outputs of those gates are calculated.
2. The outputs of the gates which changed in the previous step
are fed into the next level of gate inputs. If the input to any
gate has changed, then the output of that gate is calculated.
3. Step 2 is repeated until no more changes in gate inputs occur.
The circuit is then in a steady-state condition, and the
outputs may be read.
4. Steps 1 through 3 are repeated every time a circuit input
change.
07/05/2023 21CS33 50
MUX, DECODERS, AND PLD
• MULTIPLEXERS:
• A multiplexer (or data selector, abbreviated as MUX) has a
group of data inputs and a group of control inputs.
• The control inputs are used to select one of the data inputs
and connect it to the output terminal.
• The following Figure shows a 2-to-1 multiplexer.
07/05/2023 21CS33 51
MUX, DECODERS, AND PLD
• When the control input A is 0, the switch is in the upper
position and the MUX output is Z = I0
• When A is 1, the switch is in the lower position and the
MUX output is Z = I1.
• Thus, a MUX acts like a switch that selects one of the data
inputs (I0 or I1) and transmits it to the output.
• The logic equation for the 2-to-1 MUX is
therefore: 𝑍 = 𝐴′ 𝐼0 + 𝐴𝐼1
07/05/2023 21CS33 52
MUX, DECODERS, AND PLD
• 4-to-1 multiplexer
07/05/2023 21CS33 53
MUX, DECODERS, AND PLD
• Two control inputs (A and B) are needed to select one of the
four inputs. If the control inputs are AB = 00, the output is I0;
similarly, the control inputs 01, 10, and 11 give outputs of I1,
I2, and I3, respectively.
• The 4- to-1 multiplexer is described by the
equation: 𝑍 = 𝐴′ 𝐵′𝐼0 + 𝐴′ 𝐵𝐼1 + 𝐴𝐵′𝐼2 + 𝐴𝐵𝐼3
07/05/2023 21CS33 54
MUX, DECODERS, AND PLD
• 8-to-1 MUX:
• The 8-to-1 MUX selects one of eight data inputs using three
control inputs.
• It is described by the equation:
• 𝑍 = 𝐴′𝐵′𝐶′𝐼0 + 𝐴′𝐵′𝐶𝐼1 + 𝐴′𝐵𝐶′𝐼2 + 𝐴′𝐵𝐶𝐼3+𝐴𝐵′𝐶′𝐼4+𝐴𝐵′𝐶𝐼5+𝐴𝐵𝐶′𝐼6
+ 𝐴𝐵𝐶𝐼7.
07/05/2023 21CS33 55
MUX, DECODERS, AND PLD
• Internal schematic of 8:1 MUX
07/05/2023 21CS33 61
MUX, DECODERS, AND PLD
07/05/2023 21CS33 62
MUX, DECODERS, AND PLD
• Expanding Multiplexers
• Several digital multiplexer ICs are available such as 74150 (16
to 1), 74151 (8 to 1), 74157 (Dual 2 input) and 74153 (Dual 4
to 1) multiplexer.
• It is possible to expand the range of inputs for multiplexer
beyond the available range in the integrated circuits.
• This can be accomplished by interconnecting several
multiplexers.
• E.g.: Two 74XX151, 8 to 1 multiplexers can be used together to
form a 16-to-1 multiplexer, two 74XX150, 16 to 1 multiplexers
can be used together to form a 32 to 1 multiplexer and so on.
07/05/2023 21CS33 63
MUX, DECODERS, AND PLD
• Various Multiplexer ICs
• 74153 4 to 1 MUX
07/05/2023 21CS33 64
MUX, DECODERS, AND PLD
• 74151 8 to 1 MUX
07/05/2023 21CS33 65
MUX, DECODERS, AND PLD
• 74152 8 to 1 MUX - It has eight inputs and one output. The
output is in inverted form.
07/05/2023 21CS33 66
MUX, DECODERS, AND PLD
• 74150 – 16 to 1 MUX
07/05/2023 21CS33 67
MUX, DECODERS, AND PLD
• E.g.: Design 32 to 1 multiplexer using two 74LSI50
• to design 32-to-1 MUX
• 16-to-1 mux needed - 2
• Select inputs needed - 5
• Let A, B, C, D and E be select inputs
• E input is to be applied to the enable input of the MUX 1 and
E` is to be applied to MUX 2
07/05/2023 21CS33 68
MUX, DECODERS, AND PLD
07/05/2023 21CS33 69
MUX, DECODERS, AND PLD
• E.g. 2: Design 32:1 multiplexer using two 16:1 multiplexers
and one 2:1 multiplexer.
• Solution:
• To design 32:1 MUX we need to 16:1 MUX.
• The output of these two MUX should be fed as input to 2:1
MUX
• Select lines S0, S1, S2 and S3 are connected in parallel to both
16:1 multiplexers.
• S4 is connected to 2:1 MUX to select one of the output of
two 16:1 MUX
07/05/2023 21CS33 70
MUX, DECODERS, AND PLD
07/05/2023 21CS33 71
MUX, DECODERS, AND PLD
• E.g.: Construct 8:1 multiplexer using 2:1 multiplexer
07/05/2023 21CS33 72
MUX, DECODERS, AND PLD
• Examples to Practice:
• Construct 16:1 multiplexer using 4:1and 2:1 multiplexer
• Design a 16 to 1 multiplexer using two 8 to 1 multiplexer
and one 2 to multiplexer
07/05/2023 21CS33 73
MUX, DECODERS, AND PLD
• Demultiplexers:
• In digital systems, many times it is necessary to route data
from single data line to one of the available output lines and
there should be facility to select the output line on which the
data is to be routed.
• The digital circuit which does this task is a demultiplexer.
• A demultiplexer is a circuit that receives information on a
single line and transmits this information on one of 2n
possible output lines.
• The selection of specific output line is controlled by the
values of n selection lines
07/05/2023 21CS33 74
MUX, DECODERS, AND PLD
• The following figure shows the block diagram of a
demultiplexer.
• It has one input data line, 2 output lines, n select lines and
one enable input.
07/05/2023 21CS33 75
MUX, DECODERS, AND PLD
• Differentiate between Multiplexer and Demultiplexer
• List out – based on inputs, outputs, functionality
07/05/2023 21CS33 76
MUX, DECODERS, AND PLD
• Three-State Buffers
• A gate output can only be connected to a limited number of
other device inputs without degrading the performance of a
digital system.
• A simple buffer may be used to increase the driving
capability of a gate output.
• Figure below shows a buffer connected between a gate
output and several gate inputs
07/05/2023 21CS33 77
MUX, DECODERS, AND PLD
• As there is no bubble is present at the buffer output, this is a non-
inverting buffer, and the logic values of the buffer input and
output are the same, that is, F = C.
• Normally, a logic circuit will not operate correctly if the outputs
of two or more gates or other logic devices are directly
connected to each other.
• For example, if one gate has a 0 output and another has a 1
output, when the gate outputs are connected together the
resulting output voltage may be some intermediate value that
does not clearly represent either a 0 or a 1.
• In some cases, damage to the gates may result if the outputs are
connected together.
07/05/2023 21CS33 78
MUX, DECODERS, AND PLD
• Use of three-state logic permits the outputs of two or more
gates or other logic devices to be connected together.
• Following figure shows a three-state buffer and its logical
equivalent
07/05/2023 21CS33 80
Review of Combinational circuit design
• In first two, the enable input B is not inverted, so the buffer
output is enabled when B = 1 and disabled when B = 0.
• That is, the buffer operates normally when B=1, and the
buffer output is effectively an open circuit when B = 0.
• We use the symbol Z to represent this high-impedance state.
• Also note that, in second figure, the buffer output is inverted
so that C =A` when the buffer is enabled.
• The buffers in 3rd and 4th figures operate the same as in 1st
and 2nd except that the enable input is inverted, so the buffer
is enabled when B = 0.
07/05/2023 21CS33 81
Review of Combinational circuit design
• The operation of these buffers can be summarized in truth
table as shown below
07/05/2023 21CS33 82
Review of Combinational circuit design
• Consider the following figure:
07/05/2023 21CS33 86
Review of Combinational circuit design
• Decoder
• The decoder is another commonly used type of integrated
circuit
• Decoder is identical to a demultiplexer without any data
input.
• Its outputs can be either active-low or active-high.
• For active-high outputs, the output selected by select lines
(usually called address lines) goes high, other outputs remain
low.
07/05/2023 21CS33 87
Review of Combinational circuit design
• Fig. shows 2 to 4 decoder.
• Here, 2 inputs are decoded
into four outputs, each
output representing one the
minterms of the 2 input
variables.
• The two inverters provide
the complement of the
inputs, and each one of
four AND gates generates
one of the minterms.
07/05/2023 21CS33 88
Review of Combinational circuit design
• The truth table for a 2 to 4 decoder can be written as shown
below.
07/05/2023 21CS33 90
Review of Combinational circuit design
07/05/2023 21CS33 91
Review of Combinational circuit design
• Truth table:
07/05/2023 21CS33 92
Review of Combinational circuit design
• Decoder ICs
• 3 to 8 Decoder (IC 74138)
• The 74X138 is a commercially available 3-to-8 decoder.
• It accepts three binary inputs (A, B, C) and provides eight
enabled, individual active low outputs (Y0 - Y7).
• The device has three enable inputs: two active low (G2A,G2B)
and one active high (G1).
• Logic symbol and function table are shown in the following
figures
07/05/2023 21CS33 93
Review of Combinational circuit design
07/05/2023 21CS33 94
Review of Combinational circuit design
07/05/2023 21CS33 95
Review of Combinational circuit design
• Implementation of Combinational Logic using Decoder
• When decoder output is active high, it generates minterms
(product terms) for input variables; i.e. it makes selected
output logic 1.
• In such case to implement SOP function we have to take sum
of selected product terms generated by decoder implemented
by ORing the selected decoder outputs.
07/05/2023 21CS33 96
Review of Combinational circuit design
• E.g.: f = Ʃ M(1,2,3, 7) using 3:8 decoder with active high
outputs.
07/05/2023 21CS33 98
Review of Combinational circuit design
• Realize the following Boolean expressions using the 3:8
decoder
• F1(A, B, C)=Ʃ m(1, 2, 3, 4), F2(A, B, C) = Ʃm(3, 5, 7)
07/05/2023 21CS33 99
Review of Combinational circuit design
• Seven-Segment Decoders:
• The following Fig shows a seven-segment indicator, i.e.
seven LEDs labeled a through g
• By forward biasing the LEDs, we can display the digits 0
through 9.
• Solution:
• Based on the given expressions, let
us construct a PLA table with one
row for each distinct product term.
07/05/2023 21CS33 115
Review of Combinational circuit design
• the PLA structure can be drawn as shown below,
• The X’s in the following Figure (b) indicate that 𝐼1 𝑎𝑛𝑑 𝐼2′
lines are connected to the first AND gate, and the 𝐼1`𝑎𝑛𝑑 𝐼2
lines are connected to the other gate. 119
07/05/2023 21CS33
Review of Combinational circuit design
• Example: Implement Full Adder using PAL. Solution: The
logic equations for the full adder are:
• 𝑆𝑢𝑚=𝑋′𝑌′𝐶𝑖𝑛+𝑋′𝑌𝐶′𝑖𝑛+𝑋𝑌′𝐶′𝑖𝑛+𝑋𝑌𝐶𝑖𝑛
• 𝐶𝑜𝑢𝑡=𝑋𝑌+𝑌𝐶𝑖𝑛+𝑋𝐶𝑖𝑛
• Solution:
• The following Figure shows PAL where each OR gate is
driven by four AND gates. The X’s on the diagram show the
connections that are programmed into the PAL to implement
the full adder equations.