4-to-1 Multiplexer
A 2-bit select code routes one of four data inputs to a single output. Changing an unselected data input does not affect the output.
What You'll Learn
- Use a 2-bit select code to choose among 4 data inputs.
- Read the 4-to-1 MUX truth table.
- Write the SOP Boolean expression with four select-decode AND terms.
- Build a 4-to-1 MUX from a tree of 2-to-1 MUXes.
- Apply 4-to-1 MUXes for ALU op selection, register reads, and FPGA LUTs.
How It Works
A 4-to-1 multiplexer routes one of four data inputs (D0–D3) to a single output (Y), controlled by a 2-bit select code (S1, S0). The 2-bit select addresses 4 inputs because 2² = 4.
Select mapping: - S1S0 = 00 → Y = D0 - S1S0 = 01 → Y = D1 - S1S0 = 10 → Y = D2 - S1S0 = 11 → Y = D3
The Boolean expression is a sum of four AND-terms, each AND'ing the data input with the matching select decode: Y = ¬S1·¬S0·D0 + ¬S1·S0·D1 + S1·¬S0·D2 + S1·S0·D3.
A 4-to-1 MUX can be built as a tree of three 2-to-1 MUXes: two MUXes pair (D0,D1) and (D2,D3) using S0 as their select; a third 2-to-1 chooses between those two pair-results using S1. This decomposition generalizes: an N-to-1 MUX is a binary tree of (N−1) 2-to-1 MUXes.
When used to implement arbitrary 2-input Boolean functions, a 4-to-1 MUX with the function's truth-table values wired to D0–D3 and the function's variables on S1, S0 reproduces any Boolean function of those variables. This is the lookup-table principle that FPGAs use everywhere.
Truth Table
Select code S1S0 chooses one of D0–D3. Each pair of rows holds the unselected inputs LOW and toggles the selected input to verify both output levels.
| Inputs | Output | ||||||
|---|---|---|---|---|---|---|---|
| S1 | S0 | D0 | D1 | D2 | D3 | Y | |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | S1S0=00 → Y = D0 (=0 here) |
| 0 | 0 | 1 | 0 | 0 | 0 | 1 | S1S0=00 → Y = D0 (=1) |
| 0 | 1 | 0 | 0 | 0 | 0 | 0 | S1S0=01 → Y = D1 (=0) |
| 0 | 1 | 0 | 1 | 0 | 0 | 1 | S1S0=01 → Y = D1 (=1) |
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | S1S0=10 → Y = D2 (=0 here) |
| 1 | 0 | 0 | 0 | 1 | 0 | 1 | S1S0=10 → Y = D2 (=1) |
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | S1S0=11 → Y = D3 (=0 here) |
| 1 | 1 | 0 | 0 | 0 | 1 | 1 | S1S0=11 → Y = D3 (=1) |
Boolean Expression
Sum-of-products form — four AND terms, each gated by a different select-code minterm.
Try It Step-by-Step
Set the listed controls in the embedded circuit, then compare the observed modeled state with the expected result.
- 1D0=1S0=0S1=0Expected:
Y = 1What you'll see:Select=00 routes D0. Set D0=1, the other Ds don't matter. - 2D1=1S0=1S1=0Expected:
Y = 1What you'll see:Select=01 routes D1. Flipping S0 has selected a different data input. - 3D2=1S0=0S1=1Expected:
Y = 1What you'll see:Select=10 routes D2. The high bit of select swaps to the upper half of the input bank. - 4D3=1S0=1S1=1Expected:
Y = 1What you'll see:Select=11 routes D3 — the last input. Watching one D at a time, you can verify each row of the truth table.
Components Used
Applications and Design Context
ALU operation selection. Choosing among add, subtract, AND, OR results: a 4-to-1 MUX with operation code as select.
Register file read ports. Reading one of 4 registers uses a 4-to-1 MUX with the register address as select.
FPGA logic cells. Most modern FPGAs use 4-input or 6-input lookup tables — physically a small MUX with programmable data inputs.
Sensor input switching. Microcontrollers route one of several analog/digital sensor inputs through an internal MUX to a single ADC channel.
Display driver column selection. Multiplexed LED matrices use a fast MUX cycling through column data while a counter cycles row addresses.
Frequently Asked Questions
Why does a 4-to-1 MUX need 2 select bits?
Because log₂(4) = 2. The select code addresses one of 4 inputs, so it needs 2 bits. In general, N-to-1 MUXes need ⌈log₂N⌉ select bits.
Can I build a 4-to-1 from three 2-to-1 MUXes?
Yes. Two 2-to-1 MUXes pair up the 4 data inputs (D0/D1 and D2/D3), each using S0 as their select. A third 2-to-1 MUX picks between the two intermediate outputs using S1. Total: 3 MUXes.
How is this used in FPGAs?
A k-input FPGA lookup table stores 2^k configuration bits and uses its k logical inputs to select one bit, conceptually like a 2^k-to-1 MUX. This 4-to-1 MUX is therefore analogous to a 2-input LUT; it is not itself a 4-input LUT.
What's the difference between a 4-to-1 MUX and a 2-to-4 decoder?
A MUX *selects* one input and routes it; a decoder *enables* one of N output lines based on its input code. They're often used together: a decoder produces select signals; a MUX uses them. A MUX has 4 data inputs + 2 select; a decoder has 2 inputs + 4 outputs.
Can I implement any 2-variable Boolean function with a 4-to-1 MUX?
Yes. Wire the function's two variables to S1 and S0; wire the truth-table outputs (one bit per row) to D0–D3. The MUX output reproduces the function. This is the LUT principle — implement any function as a programmable lookup.