Computing Library › Classical Logic Gates
Classical Logic Gates

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

SDY0Y1
0000
0110
1000
1101

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

In code

python

def demux(data, sel, n_out):
    out = [0] * n_out
    out[sel] = data   # only the selected line carries the data
    return out

Where 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.