Combinational Logic Circuits Overview
Combinational Logic Circuits Overview
DIGITAL ELECTRONICS
MODULE III
Product terms
A
AB
B
C CD
D AB + CD + . . . + JK
Sum-of-products
J
JK
K
Product term
A
B ABC
C X = ABC + DE SOP
D
DE
E
D X = (ABC)(DE) DeMorgan
E DE X = (A + B + C)(D + E) POS
Exclusive-OR Logic
Inputs Output
The truth table for an exclusive-OR gate is A B X
Notice that the output is HIGH whenever 0 0 0
0 1 1
A and B disagree. 1 0 1
1 1 0
The Boolean expression is X = AB + AB
The circuit can be drawn as
A
Symbols:
X =1
Exclusive-NOR Logic
Inputs Output
The truth table for an exclusive-NOR gate is A B X
0 0 1
Notice that the output is HIGH whenever 0 1 0
A and B agree. 1 0 0
1 1 1
The Boolean expression is X = AB + AB
The circuit can be drawn as
A Symbols:
X
B
=1
C C
1. Group the 1’s into two overlapping
AB 1
B changes groups as indicated.
across this AB 1 1 2. Read each group by eliminating any
boundary variable that changes across a boundary.
AB 3. The vertical group is read A C.
C changes 4. The horizontal group is read AB.
AB
across this
boundary The circuit is on the next slide:
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 9 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 12
Implementing Combinational Logic
continued…
Circuit: A
C X= AC + AB
A
B
A A A AB
B
Inverter AND gate
A A
A+B A+B
B B
A A+ B
A A
B
Inverter OR gate
A A
AB AB
B B
1 C X= AC + AB
AB
B changes
across this A
AB 1 1
boundary B
AB
A
C changes
AB C
across this X= AC + AB
boundary A
B
Recall from Boolean algebra that double inversion cancels. By adding
inverting bubbles to above circuit, it is easily converted to NAND gates.
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 14 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 17
Combinational Logic Analysis
NAND Logic
Recall from DeMorgan’s theorem that AB = A + B.
By using equivalent symbols, it is simpler to read the logic of
SOP forms. The earlier example shows the idea:
A
C Inputs Output
X= AC + AB
A B AB A + B
A
0 0 1 1
B 0 1 1 1
1 0 1 1
The logic is easy to read if you (mentally) 1 1 0 0
cancel the two connected bubbles on a line.
A A
AB A+B
B B
NAND Negative-OR
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 15 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 18
Combinational Logic Analysis
NOR Logic
Alternatively, DeMorgan’s theorem can be written as A + B = AB.
By using equivalent symbols, it is simpler to read the logic of POS
forms. For example,
A Inputs Output
B A B A + B AB
X = (A + B)(A + C)
0 0 1 1
A 0 1 0 0
C 1 0 0 0
1 1 0 0
Again, the logic is easy to read if you
cancel the two connected bubbles on a line.
A A
A+B AB
B B
NOR Negative-AND
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 16 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 19
Combinational Logic Analysis
Pulsed Waveforms
For combinational circuits with pulsed inputs, the output
can be predicted by developing intermediate outputs and
combining the result. For example, the circuit shown can
be analyzed at the outputs of the OR gates:
A
A
G1
B B
G3
C
C
G2
D D
G1
G2
G3
Pulsed Waveforms
Inputs Output
Alternatively, you can develop the truth table for
A B C D X
the circuit and enter 0’s and 1’s on the waveforms.
Then read the output from the table. 0 0 0 0 0
0 0 0 1 1
0 0 1 0 1
A
G1 0 0 1 1 1
B 0 1 0 0 0
G3 1
0 1 0 1
C 0 1 1 0 1
G2
D 0 1 1 1 1
1 0 0 0 0
A 0 1 0 1 0 1 0 1 0 1 1 0 0 1 0
1 0 1 0 0
B 0 1 1 0 0 1 1 0 0 0 1 0 1 1 0
1 1 0 0 0
C 0 0 0 1 1 1 1 0 0 0
1 1 0 1 1
D 0 0 0 0 0 0 0 1 1 0 1 1 1 0 1
1 1 1 1 1
G3 0 0 0 0 1 1 1 0 1 0
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 18 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 21
Combinational Logic Analysis
A
A
G1
B B
G3
C
C
G2
D D
DIGITAL ELECTRONICS
MODULE III
Basic adder
Encoder Decoder
Multiplexer
Demultiplexer
[Link] INDUSTRIAL AUTOMATION Page 21 of 111
Combinational Logic - Basic Adders
Half-Adder
Inputs Outputs
Simple Binary Addition A B Cout S
0 0 0 0
0+0=0 Zero plus zero equals zero 0 1 0 1
1 0 0 1
1 1 1 0
0+1=1 Zero plus one equals one
1+0=1 One plus zero equals one
1 + 1 = 10 One plus one equals zero with a carry of one
Half-Adder
Full-Adder
By contrast, a full adder has three binary inputs (A, B, and Carry
in) and two binary outputs (Carry out and Sum).
Full-Adder
Full-Adder S S 0 Sum
1 A S 1 A S
1
0 B Cout 0 B Cout
1 Cout
1
For the given inputs, determine the
intermediate and final outputs of the full adder.
Full-Adder
Inputs Outputs
S S 0 Sum
A B Cin Cout S 1 A S 1 A S
0 0 0 0 0
1
0 0 1 0 1
0 B Cout 0 B Cout
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1 1 Cout
1 0 1 1 0
1 1 0 1 0 1
1 1 1 1 1
Parallel Adders
Full adders are combined into parallel adders that can add binary
numbers with multiple bits. A 2-bit adder is shown.
Parallel Adders
Full adders are combined into parallel adders that can add binary
numbers with multiple bits. A 4-bit adder is shown.
A 4 B4 A3 B3 A2 B2 A1 B1
C0
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
Comparators
The function of a comparator is to compare the magnitudes of
two binary numbers to determine the relationship between them.
In the simplest form, a comparator can test for equality using
XNOR gates.
Comparators
2-bit Comparator
Comparators
Comparators
IC comparators provide outputs to indicate which of the numbers
is larger or if they are equal. The bits are numbered starting at 0,
rather than 1 as in the case of adders. Cascading inputs are
provided to expand the comparator to larger numbers.
COMP
A0 0
A1 A
A2
A3 3
Cascading A>B A>B
A=B A=B Outputs
inputs
A<B A<B
B0 0
B1 A
B2
B3 3
The IC shown is the 4-bit 74LS85.
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 34 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 15
Combinational Logic - Comparators
Comparators
IC comparators can be expanded using the cascading inputs as
shown. The lowest order comparator has a HIGH on the A = B.
LSBs MSBs
A0 COMP A4 COMP
A1 0 A5 0
A2 A A6 A
A3 A7
3 3
A>B A>B A>B A>B
+5.0 V A=B A=B A=B A=B Outputs
A<B A<B A<B A<B
B0 0 B4 0
B1 A B5 A
B2 B6
B3 3 B7 3
Decoders
A decoder is a logic circuit that detects the presence of a specific
combination of bits at its input. Two simple decoders that detect
the presence of the binary code 0011 are shown.
The first has an active HIGH output; the second has an active
LOW output.
A0 A0
A1 X A1 X
A2 A2
A3 A3
Active HIGH decoder for 0011 Active LOW decoder for 0011
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 36 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 17
QUIZ
Assume the output of the decoder shown is a
logic 1. What are the inputs to the decoder?
A0 = 0
A1 = 1
1
A2 = 0
A3 = 1
Decoders
IC decoders have multiple outputs to decode any combination of
inputs. For example the binary-to-decimal decoder shown here
has 16 outputs – one for each combination of binary inputs.
Bin/Dec
0 1
For the input shown, what is the output? 1 1
2 1
3 1
4 1
1 A0 5 1
6 1
4-bit binary 1 A1 7 1 Decimal
input 0 A2 8 1 outputs
9 1
1 A3 10 1
11 0
12 1
13 1
14 1
15 1
Decoders
Decoders
BCD-to-decimal decoders accept a binary coded decimal input
and activate one of ten possible decimal digit indications.
74HC42
All lines are HIGH except for one active output, which is
LOW. The active outputs are 5, 6, 3, and 2 in that order.
BCD Decoder/Driver
Another useful decoder is the 74LS47. This is a BCD-to-seven
segment display with active LOW outputs. V CC
(16)
BCD/7-seg
(4) BI/RBO
BI/RBO
The a-g outputs are designed (13)
(7) a
for much higher current than 1
b
(12)
(1)
most devices (hence the BCD
inputs (2)
2
c
(11) Outputs
4 (10) to seven
word driver in the name). (6)
8
d
(9) segment
e device
LT (3) LT (15)
f
(5) (14)
RBI RBI g
74LS47 (8)
GND
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 44 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 25
Combinational Logic - Decoders
BCD Decoder/Driver
Here the 7447A is an connected to an LED seven segment
display. Notice the current limiting resistors, required to
prevent overdriving the LED display.
+5.0 V
1.0 kW
+5.0 V
74LS47 16
R's = MAN72
BCD/7-seg
3 VCC 330 W 3, 9, 14
LT a 13 1 a
4
BI/RBO b 12 13 b
5 RBI 11 10
c c
6 A 10 8
d d
2 B e 9 7 e
BCD
input 1 C f 15 2 f
g 14 11 g
7
D
GND
8
Encoders
An encoder accepts an active logic level on one of its inputs and
converts it to a coded output, such as BCD or binary.
Encoders
Show how the decimal-to-BCD encoder converts the
decimal number 3 into a BCD 0011.
The top two OR gates have ones as indicated with the
red lines. Thus the output is 0111.
1 0 1
A0
2 0
1
3 1
A1
4 0
5 0 0
6
0
0 A2
7
8 0 0
A3
0
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 47 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 28
Combinational Logic - Encoders
Encoders
The 74HC147 is an example of an IC encoder. It is has ten active-
LOW inputs and converts the active input to an active-LOW
BCD output. V CC
(16)
This device is offers additional (11)
HPRI/BCD
1
flexibility in that it is a priority (12)
2
(13)
encoder. (1)
3
1 (9)
4 (7)
Decimal input (2) 2 BCD
5
This means that if more than one (3) 6
4 (6)
(14)
output
8
input is active, the one with the (4)
7
(5) 8
highest order decimal digit will (10) 9
be active. (8)
74HC147
GND
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 48 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 29
Combinational Logic - Encoders
VCC
Encoders
R7 R8 R9
Keyboard
7 8 9
encoder HPRI/BCD
1
R4 R5 R6 2
3 1
4 2
5 4
BCD complement of
6 8 key press
4 5 6 7
8
9
R1 R2 R3 74HC147
1 2 3
HIGH
9 Encoder
8
Keypad Encoder 7
6 Binary code
5 for 9 used for
4 storage and/or
3 computation
2
7 8 9 1
4 5 6 0
1 2 3
0 . +/–
Calculator keypad
Binary input
7-segment display
Code Converters
There are various code converters that change one code to another.
Two examples are the four bit binary-to-Gray converter and the
Gray-to-binary converter.
Show the conversion of binary 0111 to Gray and back.
0 1 LSB
1 0
LSB
0 1
1 0
1 1 1 1
0 0
0 MSB 0 MSB
Binary-to-Gray Gray-to-Binary
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 51 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 32
Combinational Logic – Code Converter
Code converters
Multiplexers
A multiplexer (MUX) selects one data line from two or more
input lines and routes data from the selected line to the output.
The particular data line that is selected is determined by the
select inputs.
MUX
0
S0 0
Data
1
select S1 1
Which data line is
selected if S1S0 = 10? D0 Data
0
D1 output
Data 1
D2 inputs
D2
2
D3
3
Multiplexers
Demultiplexers
A demultiplexer (DEMUX) performs the opposite function
from a MUX. It switches data from one input line to two or
more data lines depending on the select inputs.
Demultiplexers
Multiplexer Demultiplexer
A D
Data from Data from Data from Data from
A to D B to E C to F A to D
∆t1 ∆t1
∆ t1 ∆ t2 ∆ t3 ∆t 1
B E
∆t2 ∆t2
∆t3 ∆t3
C F
Switching Switching
sequence sequence
control input control input
DIGITAL ELECTRONICS
MODULE III
Latches
Flip-Flops
Latches
Q Q
S R
NOR Active-HIGH Latch NAND Active-LOW Latch
Latches
(2)
1S1
(3) (4) 1Q
1S2
S-R latches are frequently used (1)
1R
for switch debounce circuits as (6)
shown: 2S (7) 2Q
(5)
2R
VCC (11)
3S1
(12) (9) 3Q
3S2
(10)
3R
(15)
2 S Q 4S (13)
S 4Q
(14)
4R
R R Position Position
1 1 to 2 2 to 1
74LS279A
Latches
1
A gated latch is a variation on the basic latch. S
Q
The gated latch has an additional 0
input, called enable (EN) that must EN
be HIGH in order for the latch to
1 Q
respond to the S and R inputs. R
EN
Q
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 67 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 10
Latches
Latches
The D latch is an variation of the S-R latch but combines the S and R
inputs into a single D input as shown:
D D Q
Q
EN EN
Q
Q
Latches
Inputs Outputs
D EN Q Q Comments
0 1 0 1 RESET
1 1 1 0 SET
X 0 Q0 Q0 No change
Latches
EN
Notice that the Enable is not active during these times, so the output
is latched.
• Edge-triggered D flip-flop
• Edge-triggered J-K flip-flop
Flip-flops
A flip-flop differs from a latch in the manner it changes states.
A flip-flop is a clocked device, in which only the clock edge
determines when a new bit is entered.
The active edge can be positive or negative.
D Q D Q
C C
Dynamic Q Q
input
indicator (a) Positive edge-triggered (b) Negative edge-triggered
Flip-flops
Edge-triggered D flip-flop
Flip-flops
Inputs Outputs
J K CLK Q Q Comments
0 0 Q0 Q0 No change
0 1 0 1 RESET
1 0 1 0 SET
1 1 Q0 Q0 Toggle
CLK
Determine the Q output for the J-K
flip-flop, given the inputs shown. K Q
Notice that the outputs change on the leading edge of the clock.
CLK
Flip-flops
A D-flip-flop does not have a toggle mode like the J-K flip-
flop, but you can hardwire a toggle mode by connecting Q
back to D as shown. This is useful in some counters as you
will see in Chapter 8.
For example, if Q is LOW, Q is HIGH D Q
and the flip-flop will toggle on the next
CLK CLK
clock edge. Because the flip-flop only
changes on the active edge, the output
Q
will only change once for each clock
pulse.
Inputs Outputs Inputs Outputs
D CLK Q Q Comments CLK Q
D Dflip-flop Q Comments
hardwired for
1 1 0 SET a toggle
1 mode
1 0 SET
0 0 1 RESET 0 0 1 RESET
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 77 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 20
Edge-Triggered Flip-Flops
Flip-flop Applications
Flip-flop Applications
Flip-flop Applications
• Monostable (One-Shot)
• Astable.
Monostable
The monostable or one-shot multivibrator is a device with
only one stable state. When triggered, it goes to its unstable
state for a predetermined length of time, then returns to its
stable state. +V
Astable
(4) (8)
R1
(7) RESET VCC
DISCH
(6) (3)
The trigger is a THRES OUT
negative-going (2) (5) tW = 1.1R1C1
TRIG CONT
pulse. GND
C1 (1)
(6) (3)
R2 THRES OUT
(2) (5)
TRIG CONT
C1 GND
(1)
10 (4) (8)
R1
RESET VCC
1.0 (7)
DISCH
C1 (mF)
10
1
1M
10
10
kW
0k
MW
kW
(6) (3)
W
R2 THRES
W
0.1 OUT
(2) (5)
TRIG CONT
0.01
C1 GND
(1)
0.001
0.1 1.0 10 100 1.0k 10k 100k
f (Hz)
Floyd
Digital Fundamentals, 9/e
555-timer-astable-circuit-calculator Copyright ©2006 by Pearson Education, Inc.
Page 86 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 29
Timer 555 Applications
Flasher
Tone Generator
DIGITAL ELECTRONICS
MODULE III
Counters
Counting in Binary
As you know, the binary count sequence follows a
familiar pattern of 0’s and 1’s.
Counting in Binary
A counter can form the same pattern of 0’s and 1’s with
logic levels. The first stage in the counter represents the
least significant bit – notice that these waveforms follow
the same pattern as counting in binary.
LSB 0 1 0 1 0 1 0 1 0
0 0 1 1 0 0 1 1 0
MSB 0 0 0 0 1 1 1 1 0
CLK
Propagation Delay
Asynchronous counters are sometimes called ripple counters,
because the stages do not all change together. For certain
applications requiring high clock rates, this is a major
disadvantage.
CLK 1 2 3 4
Notice how delays are
cumulative as each Q0
stage in a counter is Q1
clocked later than the
previous stage. Q2
Synchronous Counters
Counter Decoding
Q0 Q2
J0 Q0 J1 Q1 J2 Q2
C C C
Q1
K0 Q0 K1 Q1 K2 Q2
CLK
1 1 1
LSB MSB
Decoded 5
Q2Q1Q0
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 103 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 17
Synchronous binary counter
CLR (1)
(9) CTR DIV 16
LOAD
(10) (15)
ENT TC = 15 RCO
(7)
ENP
(2)
CLK C
Q0 Q1 Q2 Q3
D3
CLK
ENP
ENT
Q0
Q1
Data
outputs Q2
Q3
RCO
12 13 14 15 0 1 2
Count Inhibit
Clear Preset
Floyd Copyright ©2006 by Pearson Education, Inc.
Digital Fundamentals, 9/e Page 105 of 111
Upper Saddle River, New Jersey 07458
All rights reserved.
Slide 19
Synchronous binary counter
Cascaded counters
Cascading is a method of achieving higher-modulus counters. For
synchronous IC counters, the next counter is enabled only when
the terminal count of the previous stage is reached.
HIGH
ƒin
Counter 1 Counter 2
16 fout ƒin
CTEN TC CTEN TC 256
CTR DIV 16 CTR DIV 16
CLK C Q0 Q1 Q2 Q3 C Q0 Q1 Q2 Q3
fin
CLK