DECODER
&
ENCODER
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.
• There are 2N possible input combinations, for each of these
input combination only one output will be HIGH (active) all
other outputs are LOW
2
2 to 4 Line Decoder:
➢ Block diagram of 2 to 4 decoder
➢ 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 D1
Decoder A B D0 D1 D2 D3
B D2
0 0 1 0 0 0
D3
0 1 0 1 0 0
Inputs Outputs
1 0 0 0 1 0
1 1 0 0 0 1
Only one output is High for each input 3
BOOLEAN EXPRESSION:
From Truth Table
D0 = AB D1 = AB
D2 = A B D3 = AB
LOGIC DIAGRAM:
A B
A B
D0 = A B
D1 = A B
D2 = A B
D3 = A B
4
3 to 8 Line Decoder:
➢ Block diagram of 3 to 8 decoder
➢ 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 .
C .
D7
Inputs Outputs
5
TRUTH TABLE FOR 3 X 8 DECODER:
INPUTS OUTPUT
A B C D0 D1 D2 D3 D4 D5 D6 D7
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
LOGIC DIAGRAM OF 3 X 8 DECODER:
INPUTS
A B C
A B C
D0 = A B C
D1 = A B C
D2 = A B C
D3 = A BC
OUTPUTS
D4 = A B C
D5 = A B C
D6 = A B C
D7 = A B C
7
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 It has ‘M’inputs and ‘N’outputs.
• An Encoder has ‘M’ input lines, only one of which is activated at a giventime,
and produces an N-bit output code, depending on which input is activated.
A0 B0
‘M’ Inputs
‘N’ Outputs
A1 B1
A2 B2
- - - - - --
- - - - - --
Encoder
AM-1 BN-1
8
• The difference between Decoder and Encoder is that Decoder has Binary
Code as an input while Encoder has Binary Code as an output.
• Types of Encoders
i. Decimal to BCD Encoder
ii. Octal to Binary Encoder
iii. Hexadecimal to Binary Encoder
9
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
INPUTS OUTPUTS
An n-to-m encoder has n input lines and m output lines. The number of output lines m is determined by the formula:
m=log2(n)
10
where n is the number of input lines.
Truth table:
INPUTSc 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
11
DECIMAL TO BCD ENCODER
0
1
2
3
4
5
6
7
8
9
A B C D
12
OCTAL TO BINARY ENCODER:
• Block Diagram of Octal to Binary Encoder
• 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 output generates
corresponding Binary Code.
D0
D1 X
D2
D3
ENCODER Y
D4
D5
D6
Z
D7
INPUT OUTPUT
13
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
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
14
X = D4 + D5 + D6 + D7
Y = D2 + D3 + D6 + D7
Z = D1 + D 3 + D 5 + D 7
LOGIC DIAGRAM:
D0 D1 D2 D3 D4 D5 D6 D7
X = D 4 + D5 + D 6 +D 7
Y = D 2 + D3 + D 6 +D 7
Z = D1 + D 3 + D 5 + D 7
15
Half Adder
A half adder is a digital logic circuit
that performs binary addition of two
single-bit binary numbers. It has two
inputs, A and B, and two outputs,
SUM and CARRY.
Half Adder
The major drawback of HALF ADDER
circuit is that it can only add two inputs
and if there is any carry it is neglected.
Thus, the process is incomplete.
Full Adder
A full adder is a combinational circuit that
performs an addition operation on three
binary digits. It consists of three inputs
and two outputs. The first two inputs are
A and B and the third input is an input
carry designated as Cin.
Full Adder
Boolean Expression :
CARRY=AB+BC+AC
SUM = (A XOR B) XOR C
Multiplexer
8 x 1 Multiplexer
Multiplexer
Truth Table 2X1 MUX
Block Diagram