Back to course

Encoders (Priority Encoders)

Digital Logic Systems: From Zero to Hero

26. Encoders (Priority Encoders)

An Encoder performs the reverse operation of a decoder. It accepts $2^N$ input lines (usually $N$ or fewer) and generates the binary code corresponding to the input that is currently active.

Simple Encoder Limitation (4-to-2)

If we have a simple 4-to-2 encoder, if two inputs (e.g., $D_1$ and $D_3$) are active simultaneously, the output is ambiguous.

Priority Encoder

A Priority Encoder solves the ambiguity problem by assigning a fixed priority level to each input. If multiple inputs are HIGH, only the one with the highest priority is encoded.

Example: 4-to-2 Priority Encoder ($D_3$ highest priority, $D_0$ lowest)

$D_3$$D_2$$D_1$$D_0$Output (A, B)
000100
01XX10 (Since $D_2$ is high, $D_1$ and $D_0$ are ignored)
1XXX11 (Since $D_3$ is high, all others are ignored)

Logic Derivation for Priority Encoder

Deriving the logic requires careful use of 'Don't Cares' (X) to simplify the outputs based on priority rules.

  • Priority encoders are commonly used to handle interrupts in microprocessors, determining which device requesting service should be handled first.