Multiplexers
In previous sections, we analyzed number representations, Boolean algebra, logic gates, and Karnaugh map minimization. In this final section of Module 1, we assemble logic gates into standard combinational building blocks. This article examines the multiplexer (MUX). The multiplexer is one of the most widely used combinational blocks in digital circuit design. It routes signals through processor datapath pipelines, controls memory bus access, and forms the fundamental logic element in Field-Programmable Gate Arrays (FPGAs).
Multiplexer Operating Principles
A multiplexer is a digital data selector. A multiplexer contains $N$ data inputs ($I_0 \dots I_{N-1}$), $n = \log_2 N$ select lines ($S_{n-1} \dots S_0$), and one output ($Y$). The binary value applied to the select lines forms an address. The multiplexer connects the data input at that address directly to the output pin. All unselected data inputs do not affect the output.
2-to-1 Multiplexer
A 2-to-1 multiplexer selects between two data inputs ($A$ and $B$) using one select line ($S$). Table 1 lists the truth table for all input combinations:
| $S$ | $A$ | $B$ | $Y$ |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
When $S = 0$, output $Y$ equals input $A$. When $S = 1$, output $Y$ equals input $B$. Grouping the active minterms yields the standard 2-to-1 multiplexer Boolean equation:
$$Y = \overline{S}A\overline{B} + \overline{S}AB + S\overline{A}B + SAB = \overline{S}A + SB$$
Figure 1 illustrates the gate-level circuit diagram. The circuit requires two AND gates, one OR gate, and one inverter.
4-to-1 Multiplexer
A 4-to-1 multiplexer uses two select lines ($S_1, S_0$) to route one of four data inputs to output $Y$ (Table 2):
| $S_1$ | $S_0$ | Selected Input ($Y$) |
|---|---|---|
| 0 | 0 | $I_0$ |
| 0 | 1 | $I_1$ |
| 1 | 0 | $I_2$ |
| 1 | 1 | $I_3$ |
The corresponding Boolean sum-of-products equation is:
$$Y = \overline{S_1},\overline{S_0},I_0 + \overline{S_1}S_0,I_1 + S_1\overline{S_0},I_2 + S_1S_0,I_3$$
Multiplexer Trees
You can construct wider multiplexers by cascading smaller multiplexer units in a tree topology. Figure 2 shows a 4-to-1 multiplexer built from three 2-to-1 multiplexers.
The first logic stage uses two multiplexers controlled by $S_0$ to choose between $(I_0, I_1)$ and $(I_2, I_3)$. The second logic stage uses a single multiplexer controlled by $S_1$ to select the final output. In general, a $2^n$-to-1 multiplexer requires $2^n - 1$ two-to-one multiplexers arranged across $n$ logic levels.
Table 3 shows hardware requirements for standard multiplexer configurations:
| Multiplexer Type | Select Lines ($n$) | Equivalent 2-to-1 Multiplexers | Cascaded Logic Levels |
|---|---|---|---|
| 2-to-1 | 1 | 1 | 1 |
| 4-to-1 | 2 | 3 | 2 |
| 8-to-1 | 3 | 7 | 3 |
| 16-to-1 | 4 | 15 | 4 |
Universal Boolean Function Implementation
A multiplexer can implement any arbitrary Boolean function without extra logic gates. An $N$-to-1 multiplexer implements any function of $n = \log_2 N$ variables by applying fixed logic levels (0 or 1) to its data inputs. Variables connect directly to the select lines.
Furthermore, an $N$-to-1 multiplexer can implement any Boolean function of $n + 1$ variables:
- Connect $n$ variables to the select inputs.
- Express the function outputs in terms of the remaining variable ($C$, $\overline{C}$, 0, or 1).
- Connect those terms to the multiplexer data inputs.
Example Implementation
Consider the 3-variable function:
$$f(A, B, C) = \overline{A}B + BC + \overline{A},\overline{C}$$
Connect variables $A$ and $B$ to select inputs $S_1$ and $S_0$. Evaluate output $f$ across values of $C$ for each $(A, B)$ combination (Table 4):
| $A$ | $B$ | $f$ at $C = 0$ | $f$ at $C = 1$ | Required Data Input |
|---|---|---|---|---|
| 0 | 0 | 1 | 0 | $I_0 = \overline{C}$ |
| 0 | 1 | 0 | 1 | $I_1 = C$ |
| 1 | 0 | 0 | 0 | $I_2 = 0$ |
| 1 | 1 | 0 | 1 | $I_3 = C$ |
Figure 3 shows the resulting 4-to-1 multiplexer circuit.
FPGA Architecture and Lookup Tables (LUTs)
Modern FPGAs implement combinational logic circuits using Lookup Tables (LUTs). A 4-input LUT (LUT4) consists of 16 bits of Static RAM (SRAM) connected to the inputs of a 16-to-1 multiplexer. The four logic inputs drive the select lines of the multiplexer.
When the input signals change, the multiplexer routes the stored SRAM bit at that address to the output. A single LUT4 can implement any of the $2^{16} = 65{,}536$ possible 4-variable Boolean functions. When you write Register Transfer Level (RTL) code, synthesis tools calculate the truth table and write the configuration bits into the LUT SRAM cells. The programmable routing interconnect that connects logic cells also uses multiplexer switches.
Hardware Datapath Applications
Digital architectures use multiplexers in several key subsystems:
- ALU Write-Back: Directs computational results from execution units (ALU, shifter, multiplier, memory load unit) into the register file.
- Pipeline Operand Forwarding: Routes results from subsequent pipeline stages directly to operand inputs, resolving data hazards.
- Bus Arbitration: Selects read data lines from multiple memory-mapped peripheral devices.
Timing and Glitch Considerations
A multiplexer exhibits two distinct propagation delays:
- Data-to-Output Delay ($t_{PD, \text{data}}$): Time required for a change on an active data input to propagate to the output.
- Select-to-Output Delay ($t_{PD, \text{select}}$): Time required for a change on the select inputs to switch the output.
If the select line changes while data inputs remain active, internal gate propagation skews can produce output glitches. These transient pulses can propagate through downstream combinational logic. Timing analysis tools analyze select-to-output paths to ensure correct setup and hold margins.
Worked Example
Implement the function $f(A, B, C) = \sum m(0, 3, 5, 6)$ using a 4-to-1 multiplexer with select inputs $S_1 = A$ and $S_0 = B$.
Table 5 lists the truth table:
| $A$ | $B$ | $C$ | $f$ |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 0 |
Group rows by $(A, B)$ to determine the input expressions for $C$ (Table 6):
| $A$ | $B$ | $f$ at $C = 0$ | $f$ at $C = 1$ | Assigned Input |
|---|---|---|---|---|
| 0 | 0 | 1 | 0 | $I_0 = \overline{C}$ |
| 0 | 1 | 0 | 1 | $I_1 = C$ |
| 1 | 0 | 0 | 1 | $I_2 = C$ |
| 1 | 1 | 1 | 0 | $I_3 = \overline{C}$ |
The implementation requires:
- $S_1 = A$, $S_0 = B$
- $I_0 = \overline{C}$, $I_1 = C$, $I_2 = C$, $I_3 = \overline{C}$
This truth table describes a 3-input XOR function ($f = A \oplus B \oplus C$).
Practice Exercises
Problem 1: Implement a 2-input XOR function ($f = A \oplus B$) using a single 2-to-1 multiplexer. Determine the required connections for select and data inputs.
View Solution
Connect variable $A$ to select line $S$. When $A = 0$, $f = B$; therefore, connect $B$ to data input $I_0$. When $A = 1$, $f = \overline{B}$; therefore, connect $\overline{B}$ to data input $I_1$. The implementation requires one 2-to-1 multiplexer and one inverter.
Problem 2: A 4-to-1 multiplexer has data inputs $I_0 = 1$, $I_1 = 0$, $I_2 = 1$, and $I_3 = 0$. Determine output $Y$ when $S_1S_0 = 10$, and when $S_1S_0 = 01$.
View Solution
- When $S_1S_0 = 10$ (decimal index 2), the multiplexer selects $I_2$: $Y = 1$.
- When $S_1S_0 = 01$ (decimal index 1), the multiplexer selects $I_1$: $Y = 0$.
Notice that for all combinations, $Y = \overline{S_0}$.
Problem 3: Construct an 8-to-1 multiplexer using only 4-to-1 and 2-to-1 multiplexers. Specify the signal routing.
View Solution
- Use two 4-to-1 multiplexers in the first stage.
- First 4-to-1 multiplexer receives data inputs $I_0$ through $I_3$.
- Second 4-to-1 multiplexer receives data inputs $I_4$ through $I_7$.
- Connect select lines $S_1$ and $S_0$ to both 4-to-1 multiplexers in parallel.
- Use one 2-to-1 multiplexer in the second stage.
- Connect the output of the first 4-to-1 multiplexer to input $A$.
- Connect the output of the second 4-to-1 multiplexer to input $B$.
- Connect select line $S_2$ to the select input of the 2-to-1 multiplexer.
When $S_2 = 0$, the circuit routes $I_0 \dots I_3$. When $S_2 = 1$, the circuit routes $I_4 \dots I_7$.
In the next article, we examine the complementary operations: demultiplexers and binary decoders.