Demultiplexer
A demultiplexer routes a single input to one of several outputs chosen by select lines, the reverse of a multiplexer.
What it does
A demultiplexer, or demux, takes one data input and steers it to exactly one of many outputs, selected by the select lines. The unselected outputs sit at their inactive value. A demux with n select lines drives 2 to the n outputs.
One-to-two example
| S | D | Y0 | Y1 |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 |
With S=0 the data D appears on Y0 while Y1 stays 0; with S=1 the data appears on Y1 instead.
Relationship to a decoder
A demultiplexer is closely related to a decoder. If the data input is held at 1, the demux behaves exactly like a decoder: the select value activates one output line. A decoder with an enable input is often used as a demux by feeding data into the enable.
Building larger demuxes
- Each output is an AND of the data line with a decoded select combination.
- Wider demuxes use more select lines and one AND term per output.
- Trees of small demuxes reduce fan-in for large output counts.
- Multi-bit routing uses parallel demux slices sharing the select lines.
In code
python
def demux(data, sel, n_out):
out = [0] * n_out
out[sel] = data # only the selected line carries the data
return outWhere it appears
Demultiplexers distribute a shared signal to one of many destinations, such as directing serial data to a chosen register, selecting a memory bank, or driving one row of a display.