Multiplexers and Demultiplexers
A multiplexer (MUX) is a combinational circuit that selects one of N data inputs and forwards it to a single output line. The selection is controlled by select lines (also called control lines). An N-input MUX requires log2(N) select lines.
Common MUX Sizes
| MUX Type | Data Inputs | Select Lines | Boolean Expression |
|---|---|---|---|
| 2:1 | 2 | 1 | Y = S'I0 + SI1 |
| 4:1 | 4 | 2 | Y = S1'S0'I0 + S1'S0I1 + S1S0'I2 + S1S0I3 |
| 8:1 | 8 | 3 | Y = sum of 8 minterms |
| 16:1 | 16 | 4 | Y = sum of 16 minterms |
MUX as a Universal Gate
A 2:1 MUX is functionally complete -- it can implement any Boolean function. By wiring specific constants (0 or 1) or input variables to the data and select inputs, you can build AND, OR, NOT, and every other gate. This property makes the MUX one of the most versatile building blocks in digital design. An N-variable function can be implemented with a single 2^N:1 MUX by connecting the function's truth table values to the data inputs.
Demultiplexer (DEMUX)
A demultiplexer performs the reverse operation: it takes a single input and routes it to one of 2^N outputs based on N select lines. All unselected outputs are driven to 0 (or high-impedance). A 1:4 DEMUX, for example, takes one data input and two select lines, and produces four outputs where exactly one carries the input signal.
CPU Data Path Routing
In a CPU, multiplexers are critical for data path routing. They select between:
- Register file outputs vs. immediate values for ALU operands
- ALU result vs. memory data for register write-back
- PC+4 vs. branch target vs. jump address for the next program counter
Larger MUXes can be built hierarchically -- a 16:1 MUX can be constructed from five 4:1 MUXes (four at the first level, one at the second level selecting among them).
Real-Life: TV Channel Selector
Think of a cable TV set-top box as a giant multiplexer. Hundreds of channels (data inputs) arrive simultaneously on the coaxial cable. When you press a channel number on the remote (select lines), the box selects exactly one channel's signal and routes it to your TV screen (output). The other channels are still present on the wire but ignored.
Other real-world analogies and uses:
- Train track switches: A rail switch is a physical demultiplexer -- an incoming train (single input) is routed to one of several tracks (outputs) based on the switch position (select).
- USB hubs: When a USB hub forwards data from one of several connected devices to the host, it acts as a MUX, selecting which device's data stream gets access to the shared upstream link.
- FPGA routing fabric: FPGAs use thousands of tiny MUXes to implement configurable routing between logic blocks. The "select" values are stored in configuration SRAM cells.
- Memory address decoding: A DEMUX is used in memory systems to activate exactly one chip-select line based on higher-order address bits, enabling only the targeted memory chip.