CEJ - ECE 3rd - Unit No.1 - Decoder & Encoder - DSD
CEJ - ECE 3rd - Unit No.1 - Decoder & Encoder - DSD
BTEC-302-18
Dr. Sajjan Singh
HOD-ECE
Topics: DECODER
& ENCODER
04/26/2023 1
DECODER
• A decoder is a combinational circuit.
• A decoder accepts a set of inputs that represents a binary
number and activates only that output corresponding to
the input number. All other outputs remain inactive.
• Fig. 1 shows the block diagram of decoder with ‘N’ inputs
and ‘M’ outputs.
• There are 2N possible input combinations, for each of these
input combination only one output will be HIGH (active)
all other outputs are LOW
• Some decoder have one or more ENABLE (E) inputs that
are used to control the operation of decoder.
04/26/2023 2
BLOCK DIAGRAM OF DECODER
A0 B0
A1 B1
. DECODER .
A2 . .
. .
. .
B2
AN-1 BM-1
N- Inputs M- Outputs
Only one output is High for
each input
Fig. 1
04/26/2023 3
2 to 4 Line Decoder:
Block diagram of 2 to 4 decoder is shown in fig. 2
A and B are the inputs. ( No. of inputs =2)
No. of possible input combinations: 22=4
No. of Outputs : 22=4, they are indicated by D0, D1, D2 and D3
From the Truth Table it is clear that each output is “1” for only
specific combination of inputs.
TRUTH TABLE
A D0
INPUTS OUTPUTS
2X4 1
Decoder A B D0 D1 D2 D3
B D2
D
0 0 1 0 0 0
D3
0 1 0 1 0 0
Inputs Outputs
1 0 0 0 1 0
Fig. 2 1 1 0 0 0 1
04/26/2023 4
BOOLEAN EXPRESSION:
From Truth Table
D0 A B D1 A B
D2 A B D3
LOGIC DIAGRAM: AB
A A B B
D0 A B
D1 A B
D2 A B
D3 A B
Fig. 3
04/26/2023 5
3 to 8 Line Decoder:
Block diagram of 3 to 8 decoder is shown in fig. 4
A , B and C are the inputs. ( No. of inputs =3)
No. of possible input combinations: 23=8
No. of Outputs : 23=8, they are indicated by D0 to D7
From the Truth Table it is clear that each output is “1” for only
specific combination of inputs.
A
.
D0
B 3X8
.
Decoder
.
.
D7
C
Inputs
Outputs
Fig. 4
04/26/2023 6
TRUTH TABLE FOR 3 X 8 DECODER:
INPUTS OUTPUTS
A B C D0 D1 D2 D3 D4 D5 D6 D7
0 0 0 1 0 0 0 0 0 0 0 D0 A'B'C'
0 0 1 0 1 0 0 0 0 0 0 D1 A' B’C
0 1 0 0 0 1 0 0 0 0 0 D 2 A' B
C'
0 1 1 0 0 0 1 0 0 0 0 D3 A' B C
1 0 0 0 0 0 0 1 0 0 0 D4 A B'
C'
1 0 1 0 0 0 0 0 1 0 0 D5 A B' C
1 1 0 0 0 0 0 0 0 1 0 D6 A B C'
1 1 1 0 0 0 0 0 0 0 1 D7 A B C
04/26/2023 7
LOGIC DIAGRAM OF 3 X 8 DECODER:
INPUTS
A B C
A C
B
D0 A B C
D1 A B
C D2 A
B C D3 OUTPUTS
A B C D4
A B C Fig. 5
D5 A B C
D6 A B
04/26/2023 8
C D7 A
EXPANSION OF DECODERS:
04/26/2023 9
3 x 8 Decoder From 2 x 4 Decoder:
X D0
INPUT
Y D1
2 x 4 Decoder
D2
E
OUTPUT
D3
D4
2 x 4 Decoder
D5
D6
Fig. 6
D7
04/26/2023 10
Example: Implement the following multiple output function using a
suitable Decoder.
f1(A, B, C) = ∑m(0,4,7)+ d(2,3)
f2 (A, B, C) =∑m (1,5,6)
f3 (A, B, C) =∑m (0,2,4,6)
Solution: f1 consists of don’t care conditions. So we consider them to be
logic 1.
0
1
A 2
3 x 8 Decoder
f1(A, B, C)
3
INPUTS
B f2 (A, B, C)
4
C
5 f3 (A, B, C)
7 Fig. 7
04/26/2023 11
EXAMPLE: Implement the following Boolean function using suitable
Decoder. f1 (x,y,z)=∑m(1,5,7)
f2 (x,y,z)=∑m(0,3)
f3 (x,y,z)=∑m(2,4,5)
0
Solution:
1 f1 (x,y,z)
X 2
3 X 8 Decoder
Y 3 f2 (x,y,z)
INPUTS
Z 4
5
E f3 (x,y,z)
6
7
Fig. 8
04/26/2023 13
12
EXAMPLE: A combinational circuit is defined by the following
Boolean function. Design circuit with a Decoder and external
gate.
F1 (x, y, z ) x y z x z (UPTU, 2004-05)
F 2 (x, y, z ) x y z x
z
SOLUTION: STEP 1: Write the
given function F1 in SOP form
F1(x, y,z)
xyz
(y y ) x
z
F1(x, y,z) x y z x y z x y
z F1(x, y,z) m (0,5,7)
04/26/2023 F2 (x, y,z) x y z x z 13
Boolean Function using Decoder:
1
X 2 F1
3x8
Decoder 3
Y
4 F2
5
Z
6
7
Fig. 9
04/26/2023 14
ENCODER
• An Encoder is a combinational logic circuit.
• It performs the inverse operation of Decoder.
• The opposite process of decoding is known as Encoding.
• An Encoder converts an active input signal into a coded output signal.
• Block diagram of Encoder is shown in Fig.10. It has ‘M’ inputs and ‘N’
outputs.
• An Encoder has ‘M’ input lines, only one of which is activated at a given
time, and produces an N-bit output code, depending on which input is
activated. A0 B 0
‘M’ Inputs
‘N’ Outputs
A1
A2 B1
-------
-------
Encoder B2
AM-1 BN-1
Fig. 10
04/26/2023 15
• Encoders are used to translate the rotary or linear motion into a digital
signal.
• The difference between Decoder and Encoder is that Decoder has Binary
Code as an input while Encoder has Binary Code as an output.
• Encoder is an Electronics device that converts the analog signal to digital
signal such as BCD Code.
• Types of Encoders
i. Priority Encoder
ii. Decimal to BCD Encoder
iii. Octal to Binary Encoder
iv. Hexadecimal to Binary Encoder
04/26/2023 16
ENCODER
M=4
M=22
M=2N
‘M’ is the input and
‘N’ is the output
A0
B0
B1
A1 Encoder Decoder
B2
4x2 2x4
A2
A3 B3
Fig. 11
04/26/2023 18
17
ENCODER
M=4
M=22
M=2N
‘M’ is the input and
‘N’ is the output
00
A0
01
A1
A2
10 Encoder Decoder
11 4x2 2x4
A3
Fig. 12
04/26/2023 19
18
ENCODER
M=4
M=22
M=2N
‘M’ is the input and
‘N’ is the output
00
A0
01 1
A1
A2
10 Encoder 0
Decoder
11 4x2 2x4
A3
Fig. 13
04/26/2023 20
19
ENCODER
M=4
M=22
M=2N
‘M’ is the input and
‘N’ is the output
00
A0
01 1
A1
A2
10 Encoder 0
Decoder
10
11 4x2 2x4
A3
Fig. 14
04/26/2023 21
20
PRIORITY
ENCODER:
• As the name indicates, the priority is given to inputs line.
• If two or more input lines are high at the same time i.e 1 at the same time,
then the input line with high priority shall be considered.
• Block diagram and Truth table of Priority Encoder are shown in fig.15
Highest Priority
Input TRUTH TABLE:
D3 INPUTS OUTPUTS V
Y1
D2 D3 D2 D1 D0 Y1 Y0
Priority 0 0 0 0 x x 0
D1 Encoder
0 0 0 1 0 0 1
Y0
D0 0 0 1 x 0 1 1
0 1 x x 1 0 1
Lowest Priority Output 1 x x x 1 1 1
Input
Block Diagram of Priority Fig.15
Encoder
04/26/2023 22
21
• There are four inputs D0, D1,D2, D3 and two outputs Y1 and Y2.
• D3 has highest priority and D0 is at lowest priority.
• If D3=1 irrespective of other inputs then output Y1Y0=11.
• D3 is at highest priority so other inputs are considered as don’t care.
D1D0 K-map for Y1 and Y0
D1D0
D3D2 00 01 11 D3D2 00 01 11 10
10
00 X 0 0 0 00 X 0 1 1
01 1 1 1 1 01 0 0 0 0
11 1 1 1 1 11 1 1 1 1
10 1 1 1 1 10 1 1 1 1
Y1 D 2 D 3
Y0 D3 D2 D1
Fig. 16
04/26/2023 22
LOGIC DIAGRAM OF PRIORITY ENCODER:
Y1 D 2 D 3
Y0 D3 D2 D1
D3
D2
D1
D0 Y1
Y0
Fig. 17
04/26/2023 23
DECIMAL TO BCD ENCODER:
• It has ten inputs corresponding to ten decimal digits (from 0 to
9)
and four outputs (A,B,C,D) representing the BCD.
• The block diagram is shown in fig.18 and Truth table in fig.19
0
A
1
2 B
-------- -
ENCODER
9 D
INPUT OUTPUTS Fig. 18
S
04/26/2023 24
Truth table:
INPUTS BCD
OUTPUTS
0 1 2 3 4 5 6 7 8 9 A B C D
1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 0 0 0 1 0
0 0 0 1 0 0 0 0 0 0 0 0 1 1
0 0 0 0 1 0 0 0 0 0 0 1 0 0
0 0 0 0 0 1 0 0 0 0 0 1 0 1
0 0 0 0 0 0 1 0 0 0 0 1 1 0
0 0 0 0 0 0 0 1 0 0 0 1 1 1
0 0 0 0 0 0 0 0 1 0 1 0 0 0
0 0 0 0 0 0 0 0 0 1 1 0 0 1
Fig. 19
04/26/2023 25
• From Truth Table it is clear that the output A is HIGH when input
is 8 OR 9 is HIGH
Therefore A=8+9
• The output B is HIGH when 4 OR 5 OR 6 OR 7 is HIGH
Therefore B=4+5+6+7
• The output C is HIGH when 2 OR 3 OR 6 OR 7 is HIGH
Therefore C=2+3+6+7
• Similarly D=1+3+5+7+9
Logic Diagram is shown in fig.20
04/26/2023 26
DECIMAL TO BCD ENCODER
+5V
0
1
2
3
4
5
6
7
8
9
A B C D Fig. 20
04/26/2023 27
OCTAL TO BINARY ENCODER:
• Block Diagram of Octal to Binary Encoder is shown in Fig. 21
• It has eight inputs and three outputs.
• Only one input has one value at any given time.
• Each input corresponds to each octal digit and generates
output
corresponding Binary Code.
D0
X
D1
ENCODER Y
D2
D3 Z Fig. 21
INPUT OUTPUT
D4
04/26/2023 28
TRUTH TABLE:
INPUT OUTPUT
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
Fig. 22
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
04/26/2023 29
From Truth table:
X D 4 D5 D 6 D 7
Y D 2 D3 D 6 D 7
Z D1 D 3 D 5 D 7
• It is assume that only one input is HIGH at any given time. If two outputs
are HIGH then undefined output will produced. For example D3 and D6
are HIGH, then output of Encoder will be 111. This output neither
equivalent code corresponding to D3 nor to D6.
• To overcome this problem, priorities should be assigned to each input.
• Form the truth table it is clear that the output X becomes 1 if any of the
digit D4 or D5 or D6 or D7 is 1.
• D0 is considered as don’t care because it is not shown in expression.
• If inputs are zero then output will be zero. Similarly if D0 is one, the
output will be zero.
•
04/26/2023 30
X D 4 D5 D6 D7
Y D 2 D3 D6
D 7 Z D1 D 3 D 5
LOGIC DIAGRAM: D7
D0 D 1 D 2 D 3 D4 D5 D 6 D7
X D4 D5 D6 D7
Y D 2 D3 D6 D7
Z D1 D 3 D 5 D 7
Fig. 23
04/26/2023 31
THANK YOU
04/26/2023 32