Multiplexers and Demultiplexers
← All articles

Multiplexers and Demultiplexers

5 min

What a multiplexer does

A multiplexer (MUX) is a digital switch: given N data inputs and log2(N) select lines, it routes exactly one of the inputs through to a single output. A 2-to-1 MUX has 2 data inputs and 1 select line; a 4-to-1 MUX has 4 data inputs and 2 select lines, and so on.

Building a 2-to-1 MUX from gates

With data inputs I0 and I1 and select line S, the output is:

  • Out = ¬S·I0 + S·I1
  • When S=0, the ¬S·I0 term passes I0 through while S·I1 is forced to 0. When S=1, the roles flip.

What a demultiplexer does

A demultiplexer (DEMUX) is the mirror image of a MUX: it takes a single data input and routes it to exactly one of N outputs, chosen by the select lines. All other outputs are held at 0.

Demultiplexers are commonly paired with decoders to drive exactly one output line active based on a binary address — the same principle used to select one memory chip out of many, or light up one digit of a multi-digit display.

Where they show up

Multiplexers are everywhere a circuit needs to choose between data sources: ALU operand selection, register file read ports, bus arbitration. Boolflow ships ready-made MUX 2:1 / 4:1 / 8:1 and DEMUX 1:2 / 1:4 / 1:8 blocks — load a multiplexer example and toggle the select bits to see the routing happen live.

Load a multiplexer example circuit