| Active Input Line | D3 | D2 | D1 | D0 | Y1 (MSB) | Y0 (LSB) |
|---|---|---|---|---|---|---|
| D0 ACTIVE | 0 | 0 | 0 | 1 | 0 | 0 |
| D1 | 0 | 0 | 1 | 0 | 0 | 1 |
| D2 | 0 | 1 | 0 | 0 | 1 | 0 |
| D3 | 1 | 0 | 0 | 0 | 1 | 1 |
What is a 4-to-2 Encoder?
An Encoder is a combinational digital circuit that performs the reverse operation of a decoder. It has \(2^N\) input lines and \(N\) output lines. A 4-to-2 encoder compresses 4 input signal lines (\(D_0, D_1, D_2, D_3\)) into a 2-bit binary code (\(Y_1, Y_0\)).
Purpose of an Encoder
In digital systems, encoders reduce the number of physical transmission lines required to send information by encoding active input lines into compact binary representations.
Boolean Logic Equations
The output equations are derived from the active inputs that produce a logic '1' for each output bit:
Why is D0 omitted from the OR gates?
When \(D_0 = 1\), the desired output is binary 00 (\(Y_1 = 0, Y_0 = 0\)). Since both outputs should remain LOW, \(D_0\) does not need to trigger either OR gate.
Valid vs Invalid Input Conditions
- Valid Condition: Exactly one input line is HIGH (\(1\)) while all others are LOW (\(0\)).
- Invalid Condition: Multiple input lines HIGH simultaneously (e.g. \(D_1=1\) and \(D_2=1\)). The basic encoder produces ambiguous outputs. Priority encoders resolve this by selecting the highest-indexed input.
Encoder vs Decoder Comparison
| Feature | Encoder | Decoder |
|---|---|---|
| Lines | \(2^N\) Inputs → \(N\) Outputs | \(N\) Inputs → \(2^N\) Outputs |
| Function | Converts 1 active line to binary code | Converts binary code to 1 active line |
| Logic Gates | Uses OR gates | Uses AND / NOT gates |
Key Real-World Applications
- Keyboard Encoders: Converts keypresses into binary ASCII code.
- Data Compression: Reduces pin counts in microprocessors.
- Control Systems & Microprocessors: Encodes interrupt request lines into binary vector addresses.
- Communication & DSP: Digitizes multi-channel input selectors.