Template: 4-to-1 Multiplexer
Four-input multiplexer with 2-bit selection. Learn multi-input data routing and selection logic.
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 generalises: 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 to route to Y. Showing each select case with its routed value.
| Inputs | Output | |||
|---|---|---|---|---|
| S1 | S0 | Selected | Y | |
| 0 | 0 | 0 | 0 | S1S0=00 → Y = D0 (=0 here) |
| 0 | 0 | 1 | 1 | S1S0=00 → Y = D0 (=1) |
| 0 | 1 | 0 | 0 | S1S0=01 → Y = D1 (=0) |
| 0 | 1 | 1 | 1 | S1S0=01 → Y = D1 (=1) |
| 1 | 0 | 0 | 0 | S1S0=10 → Y = D2 |
| 1 | 0 | 1 | 1 | |
| 1 | 1 | 0 | 0 | S1S0=11 → Y = D3 |
| 1 | 1 | 1 | 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 inputs in the embed above, then read what should happen and confirm.
- 1S1 = 0 S0 = 0 D0 = 1Expected:
Y = 1What you'll see: Select=00 routes D0. Set D0=1, the other Ds don't matter. - 2S1 = 0 S0 = 1 D1 = 1Expected:
Y = 1What you'll see: Select=01 routes D1. Flipping S0 has selected a different data input. - 3S1 = 1 S0 = 0 D2 = 1Expected:
Y = 1What you'll see: Select=10 routes D2. The high bit of select swaps to the upper half of the input bank. - 4S1 = 1 S0 = 1 D3 = 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
Real-World Applications
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.