Two input bits, four output lines — exactly one fires at a time. A ready-made routing circuit you can open in the TorchAnvil simulator.
A decoder converts a compact binary number into a one-hot
signal: a set of output lines where exactly one is high and the rest
are low. Two input bits S1 S0 name one of four outputs Y0..Y3,
and the decoder lights up that specific one.
Each output is a unique AND of the selector bits or their negations:
Y0 = NOT S1 AND NOT S0 → fires on 00Y1 = NOT S1 AND S0 → fires on 01Y2 = S1 AND NOT S0 → fires on 10Y3 = S1 AND S0 → fires on 11Every row of the truth table hits exactly one AND, because the four
conditions partition every possible (S1, S0) combination.
| S1 | S0 | Y0 | Y1 | Y2 | Y3 |
|---|---|---|---|---|---|
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 0 | 1 |
Address decoders are how a CPU picks which memory cell to talk to.
A 16-bit address runs into a 16-to-65536 decoder, and exactly one
word line fires. The same idea drives instruction decoders, 7-segment
displays, and chip-select logic on every motherboard. Scale the bits
up, the pattern stays the same: n input bits fan out to 2^n
outputs, with one-hot as the rule.
00, 01, 10, 11. The lit lamp
walks from Y0 to Y3 — the decoder is literally counting in binary
and pointing at the current number.1 in any given row.