Encoders and Priority Encoders
On this page 5 headings
Start here A decoder turns a code into “one line on”. An encoder does the opposite: it sees which line is on and gives back its number in binary. Think of a quiz-show buzzer panel: the player whose buzzer is pressed gets their seat number shown on the screen.
- 2ⁿ inputs → n outputs.
- It assumes exactly one input is 1 at a time, and outputs that input’s number in binary.
| 0 | 0 | 0 | 1 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 1 |
| 0 | 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
Equations: and .
Why? is the “2s” bit. It is 1 for inputs 2 and 3. is the “1s” bit. It is 1 for inputs 1 and 3.
The problem: what if two inputs are 1 together, like and ? Then and output 11 = 3, which is wrong! Neither 1 nor 2 was chosen.
A priority encoder fixes this: if many inputs are 1, the highest-numbered input wins. The lower ones are ignored.
| Winner | ||||||
|---|---|---|---|---|---|---|
| 1 | X | X | X | 1 | 1 | 3 |
| 0 | 1 | X | X | 1 | 0 | 2 |
| 0 | 0 | 1 | X | 0 | 1 | 1 |
| 0 | 0 | 0 | 1 | 0 | 0 | 0 |
“don’t care”: it doesn’t matter whether that input is 0 or 1, because a higher input has already won.
Equations:
- (the winner is 2 or 3)
- (the winner is 3, or it’s 1 and input 2 is not on)
Why the in ? is on, input 2 wins, and 2 = 10 has 0. So can only set when is off.
Worked example (2026 T2 end-term, answer 10) Inputs , with and .
- 1
- 0 (, so )
- Output = 10 (input 2 wins, as it’s the highest one that is on) ✔
Everyday example: an ambulance, a bus and a car all reach a junction at the same time. The traffic police let the ambulance go first. It has the highest priority.
In one line: An encoder turns “one line on” into its binary number ; a priority encoder lets the highest active input win when several are on. Exam words: encoder, 4-to-2 encoder, priority encoder, highest priority, don’t care (X).
