Unit 2 Combinational Logic Design
Unit 2 Combinational Logic Design
Sources:
1. “Modern Digital Electronics”, R.P. Jain, Tata McGraw-Hill , Third Edition.
2. “Digital Design”, M Morris Mano, Prentice Hall, Third Edition.
3. “Fundamentals of Digital Circuits”, A. Anand Kumar, PHI, Second Edition.
DISCLAIMER
This presentation is created as a reference material for
the students of SE-IT, PICT (AY 2022-23 Sem-1).
It is restricted only for the internal use and any circulation
is strictly prohibited.
RVK-LDCO-Unit-1 2
Syllabus
• Design using SSI chips: Code converters, Half- Adder, Full Adder, Half
Subtractor, Full Subtractor, n bit Binary adder.
• Introduction to MSI chips: Multiplexer (IC 74153), Demultiplexer (IC
74138), Decoder (74238) Encoder (IC 74147), Binary adder (IC 7483)
• Design using MSI chips: BCD adder & subtractor using IC 7483,
Implementation of logic functions using IC 74153 & 74138.
• Case Study: Use of combinational logic design in 7 segment display
interface
RVK-LDCO-2.1 3
Contents
2.1-Combinational SSI Circuits-Adder
RVK-LDCO-Unit-1 4
2.1 Combinational SSI Circuits-
Adder
Sources:
1. “Modern Digital Electronics”, R.P. Jain, Tata McGraw-Hill , Third
Edition.
2. “Digital Design”, M Morris Mano, Prentice Hall, Third Edition.
3. “Fundamentals of Digital Circuits”, A. Anand Kumar, PHI, Second
Edition.
Combinational Logic Circuits
• The term "combinational" comes to us from mathematics which
means an unordered set where nobody cares which order the
items came in.
RVK-LDCO-2.1 7
Designing Combinational Circuits
• In general we have to do following steps:
1. From the specifications of the circuit, determine the required
number of inputs and outputs and assign a letter symbol to
each
RVK-LDCO-2.1 9
Adder
• Adders are the basic building blocks of all arithmetic circuits.
• Adders add two binary numbers and give out sum and carry as
output.
RVK-LDCO-2.1 10
Half Adder
Half Adder
• Adding two single-bit binary values, X, Y produces a sum S bit and
a carry out C-out bit.
RVK-LDCO-2.1
C-out 12
Full Adder
Full Adder
• Adding two single-bit binary
values, X, Y with a carry input bit
C-in produces a sum bit S and a
carry out C-out bit.C
• Logical Implementation
RVK-LDCO-2.1 15
Full Adder implemented by Two Half
Adders and an OR Gate
• A ‘Full Adder’ can also be implemented using two half adders
and an ‘OR’ Gate as follows:
The sum S = X Å Y Å (C-in)
The carry out
C _ out = XY + XC _ in + YC_ in
= XY + C _ in ( X + Y )
= XY + C _ in ( X + Y )( X + X )(Y + Y )
= XY + C _ in ( X + Y )( XY + X Y + X Y + X Y )
= XY + C _ in ( XY + X Y + X Y )
= XY + C _ in XY + C _ in ( X Y + X Y )
= XY (1 + C _ in ) + C _ in ( X Y + X Y )
= XY + C _ in ( X ⊕ Y )
RVK-LDCO-2.1 16
Full Adder implemented by Two Half Adders and
an OR Gate (Cont.)
• Therefore S = X ⊕ Y ⊕ C _ in and C _ out = XY + C _ in ( X ⊕ Y )
HA1 HA2
X
Y S
C-in
C-out
C-in S2 S
Y C1
RVK-LDCO-2.1 17
Adding Two Binary Numbers
• We want to add two 4-bit binary numbers.
A4 A3 A2 A1 B4 B3 B2 B1
• Example (not using 2’s complement)
– A4A3A2A1 = 0111, B4B3B2B1 = 1010, Ci = 1 Co 74283 Ci
– So, result should be 10010 =(18)10 S4 S3 S2 S1
RVK-LDCO-2.1 20
Cascading the 74283 ICs
• A 74283 IC only accept 4-bits Boolean variables at its input.
X8 X7 X6 X5 Y8 Y7 Y6 Y5 X4 X3 X2 X1 Y4 Y3 Y2 Y1
A4 A3 A2 A1 B4 B3 B2 B1 A4 A3 A2 A1 B4 B3 B2 B1
Co 74283 Ci Co 74283 Ci
S4 S3 S2 S1 S4 S3 S2 S1
Sources:
1. “Modern Digital Electronics”, R.P. Jain, Tata McGraw-Hill , Third
Edition.
2. “Digital Design”, M Morris Mano, Prentice Hall, Third Edition.
3. “Fundamentals of Digital Circuits”, A. Anand Kumar, PHI, Second
Edition.
Faster Circuits
• Three ways of improving the speed of circuits:
– Use better technology (eg. ECL faster than TTL gates) but
• Faster technology is more expensive, needs more power, lower-level
of integrations
Ci are:
Si = Pi Å Ci … (1)
Ci+1 = Gi + Pi·Ci … (2)
Ci
n These formulae are Pi
Ci+1
deeply nested, as Gi
shown here for Ci+2:
Pi+1
Ci+2
Gi+1
• We employ look-
ahead formula in this
lookahead-carry adder
circuit:
LOOK-AHEAD CARRY ADDER (6/6)
Sources:
1. “Modern Digital Electronics”, R.P. Jain, Tata McGraw-Hill , Third
Edition.
2. “Digital Design”, M Morris Mano, Prentice Hall, Third Edition.
3. “Fundamentals of Digital Circuits”, A. Anand Kumar, PHI, Second
Edition.
Subtraction
• If we want to do subtraction, the
circuit is very similar to half adder.
• Looking at the truth table for A – B
the only difference between a half
adder and a half subtractor is the
borrow
• In order to perform this
subtraction a digit has to
be borrowed from the next
highest column of the
subtraction
• When it borrows, it gets a 2
and the operation then
becomes 2 - 1 = 1
• The Borrow output is set to
indicate that borrow
RVK-LDCO-2.2 operation is required 31
Half Subtractor
• Subtracting a single-bit binary value Y from another X (i.e. X - Y)
produces a difference bit D and a borrow out bit B-out
• This operation is called half subtraction and the circuit to realize it is
called a half subtractor.
D(X,Y) = S (1,2)
D(X,Y) = X'Y + XY'
D = XÅY
B-out(X,Y) = S (1)
B-out = X'Y
Difference
X
D
Y
Symbol
B-out
RVK-LDCO-2.2 32
Half Subtractor Circuit
• Again, we shall represent the half subtractor using a box.
RVK-LDCO-2.2 33
Full Subtrator
• Subtracting two single-bit
binary values, Y, B-in from a
single-bit value X produces a
difference bit D and a borrow
out B-out bit.
• This is called full subtraction. D = X Å Y Å (B-in)
X-OR gate
implementation Full subtractor using two half
of half subtractor subtractors and an OR gate
HS1 HS2
X
Y X
Y D
B_in Difference (D)
Y
B_out
B_in
X B_out
B_in Text
Y
B_in
RVK-LDCO-2.2 35
2.3 Combinational MSI
Circuits- BCD Adder
Sources:
1. “Modern Digital Electronics”, R.P. Jain, Tata McGraw-Hill , Third
Edition.
2. “Digital Design”, M Morris Mano, Prentice Hall, Third Edition.
3. “Fundamentals of Digital Circuits”, A. Anand Kumar, PHI, Second
Edition.
BCD Adder
• When the sum of two digits is less than or equal to 9 then the
ordinary 4-bit adder can be used.
RVK-LDCO-2.3 37
Examples :
1. CASE I : Sum £ 9 & carry = 0.
RVK-LDCO-2.3 38
Examples :
2. CASE II : Sum > 9 & carry = 0.
• Add BCD digits 6 & 5
1. 0110
+0101
-----------
1 0 1 1 -- No Carry, but Sum>9
• Invalid BCD (since sum > 9) so 0110 is to be added
2. 1011
+0110
-----------
10001
(1 1)BCD
RVK-LDCO-2.3 39
Examples :
3. CASE III : Sum £ 9 & carry = 1.
• Add BCD digits 9 & 9
1. 1001
+ 1001
-----------
1 0 0 1 0 -- Carry=1, but Sum< 9
• Invalid BCD ( since Carry = 1 ) so 0110 is to be added
2. 1 0 0 1 0
+ 0110
------------
1 1000
(1 8)BCD
• Valid BCD result = (18)BCD
RVK-LDCO-2.3 40
Design of BCD Adder
• Consider the addition of two decimal digits in BCD, together with an input
carry from a previous stage.
• Since each input BCD digit does not exceed 9, the output sum cannot be
greater than 9 + 9 + 1 = 19, the 1 in the sum being an input carry.
• If we apply two BCD digits to a 4-bit binary adder, then the adder will form
the sum in binary and produce a result that ranges from 0 through 19.
• These Binary sums and its corresponding BCD sums are listed in Table A.
• When the binary sum £ 1001, the corresponding BCD number is identical
èNo conversion is needed.
• When the binary sum > 1001, we obtain an invalid BCD representation.
The addition of binary 6 (0110) to the binary sum converts it to the correct
BCD representation and also produces an output carry as required.
RVK-LDCO-2.3 41
Table A:
Binary sums
and its
corresponding
BCD sums
RVK-LDCO-2.3 42
Derivation of BCD Adder
• Referring to the table entries, it is obvious that a correction is
needed in the following conditions:
1. Whenever the binary sum has an output carry Z4 = 1 (sums >15).
2. The other six combinations from 1010 through 1111 (sums from 10
to 15) i.e. whenever Z3=1 and either Z2 or Z1 or both are 1.
RVK-LDCO-2.3 43
Design of BCD Adder Using IC 7483
• To execute first step i. e. binary addition of two 4-bit numbers we
will use IC 7483 ( with Cin = 0 ), which is 4-bit binary adder.
• We need to design a digital circuit which will sense sum & carry of IC
7483 & if sum exceeds 9 or carry = 1, this digital circuit will produce
high output (X=1 )otherwise its output will be zero (X=0 ).
RVK-LDCO-2.3 44
Ex1. 5+3
Inputs:[A]=0101, [B]= 0011, C0=0 0011
0101
0 1 0 0 0
0 0
0
1000
0
1 0 0 0
RVK-LDCO-2.3 0000 45
Ex2. 7+6
Inputs:[A]= 0111, [B]= 0110, C0=0
0110
0111
0 1 1 0 1
1 1
1
1101
1
0 0 1 1
RVK-LDCO-2.3 0110 46
Cascading BCD Adders
• The previous circuit is used for adding only two decimal digits in
BCD. E.g. 7 + 6 = 13.
• For adding numbers with several digits, a separate BCD adder for
each digit position must be used.
• For example:
BCD Adder BCD Adder
2 4 7
+ 5 3 8
----------------------------
?
BCD Adder
RVK-LDCO-2.3 47
Cascading BCD Adders
RVK-LDCO-2.3 48
BCD Addition Example
Q. Determine the inputs and the outputs when the above
circuit is used to add 538 to 247. Assume a CARRY IN =
0.
Solution:
– Represent the decimal numbers in BCD
247 = 0010 0100 0111
538 = 0101 0011 1000
– Put these numbers in registers [A] and [B]
[A] = 0010 0100 0111
[B] = 0101 0011 1000
RVK-LDCO-2.3 49
BCD Addition Example (cont..)
0 0 1 0 0 1 0 0 0 1 1 1
0 0 1
0
0111 1000 0101
0 1 0 1 0 0 1 1 1 0 0 0
Sources:
1. “Modern Digital Electronics”, R.P. Jain, Tata McGraw-Hill , Third Edition.
2. “Fundamentals of Digital Circuits”, A. Anand Kumar, PHI, Second Edition.
BCD Subtractor
• Rules for BCD subtraction :
1. Find 9’s complement of the subtrahend.
a) To find 9’s complement first find 1’s complement of subtrahend.
b) Add (10)10 i.e. (1010)2 to it.
2. Add 9’s complement of the subtrahend to the minuend using
BCD rules of addition.
3. After BCD addition if carry out of MSB is 0, result is negative
expressed in 9’s complement form to get it in natural form find
9’s complement of the LSB of the result.
4. But after BCD addition if carry out of MSB is 1 it indicates that
result is positive expressed in natural form & add ( 1 )10 i. e. (
0001 )2 to it.
RVK-LDCO-2.4 52
Examples :
1. CASE I : Carry = 1, Answer is positive.
• Subtract BCD digit 2 from 8. i.e. (8-2)
1000 (8)10
+0 1 1 1 9’s comp. of (2)10
----------
1 1 1 1 --No carry, but Sum>9
Invalid BCD so (0110)2 is added
1111
+ 0110
----------
10101
3. Since carry out of MSB after BCD addition is 1, answer is positive expressed in natural form &
to get final answer carry is added at the end.
0101
+ 1 Add End Around Carry (EAC)
-----------
0110 Final Answer: (8-2)10 =(6)10
RVK-LDCO-2.4 54
Examples :
2. CASE II : Carry = 0, Answer is negative.
Ex. 1 Subtract BCD digit 9 from 6. i.e. (6-9)
3. Since carry out of MSB after BCD addition is 0, answer is negative expressed in 9’s
compliment form & to get final answer, 9’s compliment of answer is taken.
9’s complement of the answer 0110:
a) 1’s complement of answer 1001
b) add (1010)2 + 1010
----------
10011 (discard carry).
Final Answer: (6-9)10 = -(3)10
RVK-LDCO-2.4 56
Ex: 2. CASE II : Carry = 0, Answer is negative
3. Since carry out of MSB after BCD addition is 0, answer is negative expressed in 9’s
compliment form & to get final answer, 9’s compliment of answer is taken.
9’s complement of the answer 1000:
a) 1’s complement of answer 0111
b) add (1010)2 + 1010
----------
10001 (discard carry).
Final Answer: (8-9)10 = -(1)10
RVK-LDCO-2.4 58
Design of BCD Subtractor
1. To execute first step i. e. to find 9’s compliment of subtrahend
a) First we find 1’s compliment of subtrahend.
b) Then add (10)10 i.e. (1010)2 to 1’s compliment of subtrahend.
We use inverter to get 1’s compliment of subtrahend. Since subtrahend is 4 bit
we need 4 inverters and to add this to (1010)2, 4 bit binary adder IC 7483 is
used.
2. Circuit for BCD addition of 9’s compliment of subtrahend and
minuend:
We will use already designed BCD adder
3. Circuit to get answer in correct form:
– If carry out of MSB after BCD addition is 0, answer is negative expressed in
9’s compliment form & to get answer in correct form we have to find 9’s
compliment of the result.
– If carry out of MSB after BCD addition is 1, answer is positive expressed in
natural form & to get final answer carry is added to the earlier answer.
RVK-LDCO-2.4 59
Logic
Dia-
gram
RVK-LDCO-2.4 60
Subtrahend
0 0 1 0
(1000)2
1 01 1 1
- (0010)2 9’s complement of
subtrahend
Minuend 1 0 0 0 0 1 1 1
Final Answer: 1
(8-2)10 = +(6)10 0 1 1 1 1
0
00 10 00 10
1
1
1 0 1 0 1
1 (10)10
0 1 1 0 1 1 1 1
0 0 0 0 0 1 0 1
0 1 0 1 1 0 Final Ans.
1 0 1 0 1 0
RVK-LDCO-2.4 61
Subtrahend
1 0 0 1
(0110)2
1 0 0 0 0
- (1001)2 9’s complement of
subtrahend
Minuend 0 1 1 0 0 0 0 0
Final Answer: 0
(6-9)10 = -(3)10 0 0 1 1 0
1
01 11 11 01
0
0
1 1 0 0 1
0 (10)10
0 0 0 0 0 1 1 0
1 0 1 0 1 0 0 1
0 1 0 0 0 1 1 Final Ans.
0 1 1 0 1
RVK-LDCO-2.4 62
2.5 Combinational MSI Circuits-
Multiplexers & Demultiplexers
Sources:
1. “Modern Digital Electronics”, R.P. Jain, Tata McGraw-Hill , Third Edition.
2. “Digital Design”, M Morris Mano, Prentice Hall, Third Edition.
3. “Fundamentals of Digital Circuits”, A. Anand Kumar, PHI, Second Edition.
Multiplexers and De-Multiplexers
• A multiplexer or 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.
RVK-LDCO-2.5 64
Multiplexers
Multiplexers
• A multiplexer is a device which has
– A number of input lines
– A number of selection lines
– One output line
2n:1
inputs : Multiplexer output
...
select
RVK-LDCO-2.5 66
Multiplexers (cont..)
• Truth table for a 4-to-1 multiplexer:
I0 I1 I2 I3 S1 S0 Y S1 S0 Y
d0 d1 d2 d3 0 0 d0 0 0 I0
d0 d1 d2 d3 0 1 d1 0 1 I1
d0 d1 d2 d3 1 0 d2 1 0 I2
d0 d1 d2 d3 1 1 d3 1 1 I3
Inputs Inputs
I0 0 I0
I1 4:1 I1
1 4:1
MUX Y
I2 2 Y Y I2 mux
I3 3 I3 Output
S1 S0 Output
S1 S0
Select Select
inputs inputs
RVK-LDCO-2.5 67
Multiplexers (cont..)
• Output of multiplexer is S1 S0 Y
0 0 I0
“sum of the (product of data lines and selection lines)” 0 1 I1
1 0 I2
1 1 I3
• Example: Output of a 4-to-1 multiplexer is:
Y = S1’ S0’ I0 + S1’ S0 I1 + S1 S0’ I2 + S1 S0 I3
I0
• 4-to-1 multiplexer circuit:
I1
Y
I2
I3
RVK-LDCO-2.5 68
S1 S0
Multiplexers (cont..)
• Truth table of 4:1 multiplexer with
strobe input:
• A strobe(or enable) input (G) helps in cascading.
• It is generally active-low which means it performs
its intended operation when it is LOW.
RVK-LDCO-2.5 69
Multiplexers (cont..)
• An application:
RVK-LDCO-2.5 70
Combinational Logic Design Using
Multiplexers
• Multiplexers offer the following advantages:
– Simplification of a logic expression is not needed.
– It minimizes IC package count.
– Logic design is simplified
RVK-LDCO-2.5 71
Cascading of Multiplexers
Multiplexer IC Package
• Some IC packages have a few multiplexers in each package (chip).
The selection and enable inputs are common to all multiplexers
within the package.
A0
Y0
A1
Y1
A2
Y2
A3
Y3
B0
B1 E’ S Output Y
B2 1 X all 0’s
0 0 select A
B3 0 1 select B
S
(select)
E'
(enable) Quadruple 2:1 multiplexer
RVK-LDCO-2.5 73
Larger Multiplexers
• Larger multiplexers can be constructed from smaller ones.
I0
I1 4:1
I2
S2 S1 S0 Y
MUX
I3 0 0 0 I0
2:1
0 0 1 I1
S1 S0 MUX Y 0 1 0 I2
I4 0 1 1 I3
I5 4:1 1 0 0 I4
I6 MUX 1 0 1 I5
S2
I7 1 1 0 I6
1 1 1 I7
S1 S0
RVK-LDCO-2.5 74
Larger Multiplexers (cont..)
• An 8:1 multiplexer can be constructed from smaller multiplexers:
S2 S1 S0 Y
I0
I1 I0 I1 I2 0 0 0 I0
4:1
I2 MUX 0 0 1 I1
I3
I0 I1 I6 0 1 0 I2
2:1
S1 S0 MUX Y 0 1 1 I3
I4 1 0 0 I4
I5 4:1 I4 I5 I6 1 0 1 I5
I6 MUX
I7
S2 1 1 0 I6
1 1 1 I7
S1 S0
S2 S1 S0 Y
When
I0 2:1 0 0 0 I0
S2S1S0 = 000
I1 MUX 0 0 1 I1
0 1 0 I2
I0
I2 2:1 S0 0 1 1 I3
I3 MUX 1 0 0 I4
I2
I0 1 0 1 I5
4:1 1 1 0 I6
S0 MUX Y
1 1 1 I7
I4 2:1 I4
I5 MUX
S2 S1
I6
S0 I6 2:1
I7 MUX Q: Can we use only 2:1 multiplexers?
S0
RVK-LDCO-2.5 76
Larger Multiplexers (cont..)
• A 16-to-1 multiplexer
can be constructed from
five 4-to-1 multiplexers:
RVK-LDCO-2.5 77
Standard MSI Multiplexer
• 74151A 8-to-1 multiplexer:
(c)
(c) Logic diagram (d) Generic logic symbol e) IEEE standard logic symbol
Source: The TTL Data Book Volume 2. Texas Instruments
RVK-LDCO-2.5 Inc.,1985. 79
Implementing Boolean
Functions Using Multiplexer
Implementing Functions Using Multiplexer
• Boolean functions can be implemented using multiplexers.
• To implement a Boolean function of n input variables, a 2n-to-1
multiplexer with n selection lines is needed.
• Design procedure is as follows:
1. Express a Boolean function in sum-of-minterms form and identify a decimal
number corresponding to each minterm in the expression.
Example: F(A,B,C) = A'×B'×C + A'×B×C + A×B'×C + A×B×C'
= S m(1,3,5,6)
2. Connect n variables to the n selection lines.
3. Input lines corresponding to minterms in the expression are connected to logic
‘1’ and all other input lines are connected to logic ‘0’.
RVK-LDCO-2.5 81
Example 1: Implementing Functions Using
Multiplexer
Ex.1 F(A,B,C) = S m(1,3,5,6)
Sol.
• Since there are 3 variables, a multiplexer with 3 select lines is
needed.
• Hence 23-to-1 (8:1) multiplexer is used.
RVK-LDCO-2.5 83
Implementation Using Smaller Multiplexer
(cont..)
• Design Procedure is as follows:
1. Express a Boolean function in sum-of-minterms form.
2. Reserve one variable for input lines of multiplexer and use the
rest (n-1) variables for selection lines.
RVK-LDCO-2.5 84
Example1 : Implementation Using Smaller
Multiplexer
Ex1: F(A,B,C) = S m(0,1,3,6) = A'×B'×C' + A'×B'×C + A'×B×C + A×B×C’
Sol.
• Truth table and implementation using 8-to-1 (23:1)
multiplexer as the function has 3 variables:
1 0
1 1
0 2
1 3 mux F
0 4
0 5
1 6
0 7
A B C
? 0
? 1 F
mux
? 2
? 3
A B
RVK-LDCO-2.5 86
Example1 : Implementation Using
Smaller Multiplexer (cont..)
MUX A B C F Mux
A B C F Input
input
0 0 0 1 1 0
0 0 0 1 1
0 0 1 1 C 1
0 0 1 1 F
0 1 0 0
C 2 mux
0 1 0 0 0 1 1 1 0
3
0 1 1 1
1 0 0 0
0 C'
1 0 1 0
1 0 0 0 1 1 0 1
C’
1 0 1 0 1 1 1 0 A B
1 1 0 1
1 1 1 0
• OR Reserve variable A for input data lines and the rest are used as
selection lines. D D D D
0 1 2 3
A’ 0 1 2 3
A 4 5 6 7
i/p to MUX A’ A’ A A’
RVK-LDCO-2.5 89
Example 2: Implementation Using Smaller
Multiplexer
Ex.2 F(A,B,C,D) = S m(0,2,3,6,8,9,12,14)
Sol.
• Since there are 4 variables, a
multiplexer with 4 select lines is
needed.
• Hence 24-to-1 (16:1) multiplexer is
used.
• Thus only one IC package for 16:1
multiplexer is required to implement a
given Boolean function.
• Note: Here, a multiplexer output is active-high.
In case of active-low, the logic ‘0’ and logic ‘1’
on this figure are to be interchanged.
RVK-LDCO-2.5 90
Example 2: Implementation Using Smaller
Multiplexer (cont..)
Alternative Sol. : Implementing a Boolean function of n variables with
a multiplexer that has n - 1 selection inputs.
• Truth Tables for F(A,B,C,D) = S m(0,2,3,6,8,9,12,14)
With 4 variables
With 3 variables
RVK-LDCO-2.5 91
Example 2: Implementation Using Smaller
Multiplexer (cont..)
Alternative Sol. : (with n-1 select lines)
• Thus realization with 3 variables require 3 select lines and thus 23-
to-1 (8:1) multiplexer is used.
RVK-LDCO-2.5 92
Example2 : Implementation Using
Smaller Multiplexer (cont..)
Ex.2 F(A,B,C,D) = S m(0,2,3,6,8,9,12,14)
Alternative Sol. : (with n-1 select lines)
By Hardware Reduction Table Method:
• Reserve variable D for input data lines and the rest are used as
selection lines.
D0 D1 D2 D3 D4 D5 D6 D7
D’ 0 2 4 6 8 10 12 14
D 1 3 5 7 9 11 13 15
i/p to MUX D’ 1 0 D’ 1 0 D’ D’
RVK-LDCO-2.5 93
Example 3: Implementation Using Smaller
Multiplexer (cont..)
Ex.3: Implement the function below with 74151A:
f(x1,x2,x3,x4) = S m(0,1,2,3,4,9,13,14,15)
Sol. 74151A is 8:1 Mux.
RVK-LDCO-2.5 94
Example4 : Implementation Using
Smaller Multiplexer (cont..)
Ex.4 Implement the function below with 74153 using variable A at
data input lines of a MUX: F(A,B,C) = S m(1,2,4,7)
Sol. 74153 is 4:1 MUX.
• We will use Hardware Reduction Table Method.
• Reserve variable A for input data lines and the rest are used as
selection lines.
D0 D1 D2 D3
A’ 0 1 2 3
A 4 5 6 7
i/p to MUX A A’ A’ A
RVK-LDCO-2.5 95
Example5 : Implementation Using
Smaller Multiplexer (cont..)
Ex.5 Implement the function below with 74151A using variable B at
data input lines of a MUX: f(A,B,C,D) = S m(0,1,2,3,4,9,13,14,15)
Sol. 74151A is 8:1 MUX.
• We will use Hardware Reduction Table Method.
• Reserve variable B for input data lines and the rest are used as
selection lines.
D0 D1 D2 D3 D4 D5 D6 D7
B’ 0 1 2 3 8 9 10 11
B 4 5 6 7 12 13 14 15
i/p to MUX B B’ B’ 0 0 1 B B
RVK-LDCO-2.5 96
Implementing Full Adder
Using Multiplexer
Full Adder
• Adding two single-bit binary
values, X, Y with a carry input bit
C-in produces a sum bit S and a
carry out C-out bit.
Y0 = D∙S1'∙S0'
Y1 = D∙S1'∙S0
Data D demux
Y2 = D∙S1∙S0'
Y3 = D∙S1∙S0
S1 S0
select
S1 So Y0 Y1 Y2 Y3
0 0 D 0 0 0
0 1 0 D 0 0
1 0 0 0 D 0
1 1 0 0 0 D RVK-LDCO-2.5 102
Demultiplexers (cont..)
• It turns out that the demultiplexer circuit is actually identical to a
decoder with enable.
Y0 = E∙A’∙B'
Y1 = E∙A’∙B
Y2 = E∙A∙B'
Y3 = E∙A∙B
RVK-LDCO-2.5 103
Cascading of Demultiplexers
Larger Demultiplexers
• Implementation of 1:8 demultiplexer using 1:4 demultiplexers and
1:2 demultiplexer:
RVK-LDCO-2.5 105
Larger Demultiplexers
• Implementation of
1:16 demultiplexer
using 1:8
demultiplexers and 1:2
demultiplexer:
RVK-LDCO-2.5 106
2.6 Combinational Circuits-
Decoders & Encoders
Sources:
1. “Modern Digital Electronics”, R.P. Jain, Tata McGraw-Hill , Third Edition.
2. “Digital Design”, M Morris Mano, Prentice Hall, Third Edition.
3. “Fundamentals of Digital Circuits”, A. Anand Kumar, PHI, Second Edition.
Decoders
Decoders
• A combinational circuit that converts binary information from n
coded inputs to a maximum 2n coded outputs → n to 2n decoder.
• n-to-m decoder, m £ 2n
– Examples: BCD-to-7-segment decoder,
where n = 4 and m = 10
RVK-LDCO-2.6 109
2-to-4 Decoder
• This is what a 2-to-4 decoder looks like on the inside.
RVK-LDCO-2.6 110
3-line-to 8-line (3-to-8) or (1-of-8) Decoder
• Three inputs A, B, C, are decoded
into eight outputs, O0 through O7.
RVK-LDCO-2.6 111
74138 Decoder with Enable
• 3-to-8 decoder constructed with NAND gates.
• As NAND gate produces AND operation with an inverted output, it
economically produces minterms in their complemented form.
• Logic diagram for the 74LS138 decoder:
RVK-LDCO-2.6 112
Enable Inputs
• The 74138 features 3 ENABLE inputs, two active LOW (E1 and E2)
and one active HIGH (E3) to control the operation of the decoder.
• When ENABLE signal line E1 and E2 held LOW and E3 held HIGH, the
decoder will function normally and the A0, A1, A2 input code will
determine which output is LOW.
RVK-LDCO-2.6 114
Cascading of Decoders
Larger Decoders
• Implementation of 4:16 decoder using 3:8 decoders:
• When w=0, the top decoder is enabled and the other is disabled.
– The bottom decoder outputs are all 0’s, and the top eight outputs generate
minterms 0000 to 0111.
• When w=1, the bottom decoder is enabled and the other is
disabled.
– The bottom decoder outputs generate minterms 1000 to 1111, while the
outputs of the top decoder are all 0’s.
• It demonstrates the usefulness of enable inputs.
RVK-LDCO-2.6 116
Standard MSI Decoder
• 74138 : 3 lines-to-8 lines Decoder
RVK-LDCO-2.6 119
Example 1: Implementing Functions Using
Decoder
Ex.1 Implement a given Boolean function using a decoder.
Y = A• B •C + A• B •C + A• B •C + A• B •C
Sol.
• A given function Y is written as Y(A,B,C)=∑(0,2,4,7).
• Since there are 3 variables and , a decoder 3-lines to 8-lines is
used.
RVK-LDCO-2.6 120
Example 2: Implementing Functions Using
Decoder
Ex.2 Implement Full adder using a decoder.
Sol.
• In Full Adder, a function for Sum is written as S(X,Y,C-in) =∑(1,2,4,7)
and a function for C-out is written as C-out(X,Y,C-in) = ∑(3,5,6,7).
• Since there are 3 variables and , a decoder 3-lines to 8-lines is used.
RVK-LDCO-2.6 121
Implementation of Full
Subtractor Using Decoder
Full Subtractor
• Subtracting two single-bit
binary values, Y, B-in from a
single-bit value X produces a
difference bit D and a borrow
out B-out bit.
• This is called full subtraction. D = X Å Y Å (B-in)
RVK-LDCO-2.6 127
Encoders
• Example: Octal-to-Binary encoder
Inputs Outputs
D0 D1 D2 D3 D4 D5 D6 D7 x y z
1 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 1 0
0 0 0 1 0 0 0 0 0 1 1
0 0 0 0 1 0 0 0 1 0 0
0 0 0 0 0 1 0 0 1 0 1
0 0 0 0 0 0 1 0 1 1 0
0 0 0 0 0 0 0 1 1 1 1
– Output Functions:
x= D4 + D5 + D6 + D7
y= D2 + D3 + D6 + D7
z= D1 + D3 + D5 + D7
– At any one time, only one input line has a value of 1.
– Otherwise, we need priority encoder.
RVK-LDCO-2.6 128
Encoders
• Example: Octal-to-Binary encoder
D0
D1 x = D 4 + D5 + D6 + D7
D2
D3
y = D 2 + D3 + D6 + D7
D4
D5
D6
D7 z = D 1 + D3 + D5 + D7
An 8-to-3 encoder
• An output with all 0’s is generated when all the inputs are 0; but this
output is the same as when D0 is equal to 1.
– The discrepancy can be resolved by providing one more output to indicate
whether at least one input is equal to 1.
RVK-LDCO-2.6 130
Priority Encoders
Priority Encoders
• A priority encoder is one that includes the priority function.
– If two or more inputs are simultaneously equal to 1, the input with the highest
priority takes precedence.
– If all inputs are 0, this input combination is considered invalid.
RVK-LDCO-2.6 133
74HC147 Decimal to BCD Priority Encoder
• The 74HC147 is an example of an encoder IC.
• It has ten active-LOW inputs and converts the active input to an
active-LOW BCD output.
• This device offers additional
flexibility with a priority
encoder.
– An encoder in which multiple
asserted inputs are allowed but
only the highest value input digit
is encoded and any other active
input is ignored.
– Thus resolve the ambiguity
mentioned above.
RVK-LDCO-2.6 134
2.7 Code Conversion
Sources:
1. “Modern Digital Electronics”, R.P. Jain, Tata McGraw-Hill , Third Edition.
2. “Digital Design”, M Morris Mano, Prentice Hall, Third Edition.
3. “Fundamentals of Digital Circuits”, A. Anand Kumar, PHI, Second Edition.
Code Conversion
• Different digital systems use different codes .
• It is sometimes necessary to use the output of one system as the
input to another.
– A conversion circuit must be inserted between the two systems if each uses
different codes for the same information.
– It represents the decimal numbers 0 to 9. So, some codes are unused, like
1010BCD, 1011BCD, … 1111BCD. These codes are considered as errors.
RVK-LDCO-2.7 137
BCD To Excess-3 Conversion
Truth Table for Code Conversion
• 4 binary i/p variables may have 16
bit combinations, but BCD
represents decimal numbers 0 to 9
only (the first 10 i/p combinations),
so the last 6 i/p combinations have
no meaning in BCD. Hence those
are don’t-care combinations.
RVK-LDCO-2.7 139
K-Maps for
BCD to
Excess-3
Code
Conversion
RVK-LDCO-2.7 140
Logic Diagram for BCD to Excess-3
Code Conversion
RVK-LDCO-2.7 141
Alternative Logic Diagram for
BCD To Excess-3 Conversion
Alternative Logic Diagram for BCD to
Excess-3 Code Conversion
• For a 4-bit BCD number, the inputs A,B,C,D can be expressed as
variables B3,B2,B1,B0 respectively.
• Similarly, the equivalent outputs W,X,Y,Z for an Excess-3 number
can be expressed as variables E3,E2,E1,E0 respectively.
E3 = B3+B2(B0+ B1)
E2 = B2’ B1 + B2’B0 + B2 B1’ B0’
= B2’(B1 + B0) + B2 (B1+ B0)’
= B2Å (B1 + B0)
E1= B1 B0 + B1’ B0’
= B 1ꙩ B 0
RVK-LDCO-2.7 144
Thank You!
RVK-LDCO-2.7 145