Encoder
• An Encoder is a combinational logic circuit that converts multiple
input lines into a binary output
• An encoder “understands” the active input and produces the
corresponding binary output, while all other inputs remain OFF.
• Purpose / Use of a Encoder
• Convert active input line into binary code
• Priority systems
• Digital systems (CPU, interrupts)
Basic Rule of a Decoder
• If there are 2ⁿ inputs, the encoder will have n outputs
Inputs (2ⁿ) Outputs (n)
2 1
4 2
8 3
16 4
4-to-2 Encoder
• Inputs: Y0, Y1, Y2, Y3
• Outputs: A, B
Y0 Y1 Y2 Y3 A B
1 0 0 0 0 0
0 1 0 0 0 1
0 0 1 0 1 0
0 0 0 1 1 1
• Rule: Only ONE input should be HIGH (1) at a time.
How It Works
• If Y0 = 1 → Output = 00
• If Y1 = 1 → Output = 01
• If Y2 = 1 → Output = 10 Y0 Y1 Y2 Y3 A B
1 0 0 0 0 0
• If Y3 = 1 → Output = 11
0 1 0 0 1 0
• Binary output shows which input is active.
0 0 1 0 0 1
0 0 0 1 1 1
Logic Gates Used in a Encoder
• Encoders use:
• OR gates
• Why OR gates?
• Output bit becomes HIGH if any related input is HIGH.
Boolean Rules for All Outputs
(4-to-2 Encoder)
Output Boolean Expression Gates
Y0 Y1 Y2 Y3 A B
A Y1 + Y3 OR 1 0 0 0 0 0
0 1 0 0 1 0
B Y2 + Y3 OR
0 0 1 0 0 1
0 0 0 1 1 1
8-to-3 Encoder
• 3-to-8 decoder has:
• 8 inputs (D0 to D7)
• 3 outputs (A, B, C)
• Only one input is HIGH at a time
Truth Table (8-to-3 Encoder)
D0 D1 D2 D3 D4 D5 D6 D7 A B C
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
Boolean Rules for All Outputs
(8-to-3 Decoder)
Output Expression
A D4 + D5 + D6 + D7
B D2 + D3 + D6 + D7
C D1 + D3 + D5 + D7