Multiplexers and demultiplexers
Selecting one of 2^n inputs with n select lines, the output equation, building larger multiplexers from smaller ones, implementing Boolean functions with a multiplexer using Shannon expansion, universality, and the demultiplexer.
Why it exists
A multiplexer (MUX) is a digital switch: it passes one of several data inputs to a single output, and the select lines say which. It is the circuit behind register-file reads, ALU result selection and bus sharing. It is also a universal building block: any Boolean function can be implemented by a multiplexer, which GATE tests with questions of the form "implement this function with a 4:1 multiplexer and what are the data inputs", "how many 2:1 multiplexers are needed for a 16:1", or "which function does this multiplexer circuit compute". The demultiplexer does the reverse: it routes one input to one of several outputs.
Prerequisites
You need the design flow from combinational design and minterm numbering from SOP, POS, minterms and maxterms.
Precise definitions
Multiplexer (-to-1 MUX). It has data inputs , select lines and one output . The output is the data input whose index is the binary number on the select lines:
Here is the minterm of the select variables. For the 2:1 and 4:1 cases:
A multiplexer often has an enable input : when the output is 0 (or off); .
Building larger multiplexers. A tree of smaller multiplexers works: the first level uses the low select bits and the next level uses the higher ones. The number of multiplexers needed to build a -to-1 multiplexer from 2-to-1 multiplexers is (a binary tree with leaves). In general, build the first level with multiplexers of size and repeat on their outputs. For example a 16:1 multiplexer needs 15 of size 2:1, or of size 4:1; a 64:1 needs 21 of size 4:1.
Implementing a function with a multiplexer.
- Direct method. An -variable function uses a -to-1 multiplexer with the variables on the select lines. Each data input is tied to the function's output (0 or 1) for that row of the truth table.
- Shannon expansion method (one variable less). Use a -to-1 multiplexer: connect of the variables to the select lines. For each select combination, the function is a function of the remaining variable alone, which is one of , , or . Connect that to the data input. So any -variable function needs a -to-1 multiplexer and at most one inverter.
- Repeating the Shannon expansion on more variables reduces the multiplexer size further, at the cost of more gates on the data inputs.
Universality. With the constants 0 and 1 available, a 2:1 multiplexer is functionally complete: NOT: , , select ; AND: , , select ; OR: , , select .
Demultiplexer (1-to- DEMUX). One data input , select lines and outputs. The output selected by the select lines carries and all the others are 0: . A demultiplexer is exactly a decoder with used as its enable input, which is why the two are sold as one part (decoders and encoders).
How it works
Implement with a 4:1 multiplexer. Put and on the select lines and . Group the truth table rows by :
| rows , | in terms of | data input | |
|---|---|---|---|
| 00 | 0, 1 | ||
| 01 | 1, 0 | ||
| 10 | 0, 0 | 0 | |
| 11 | 1, 1 | 1 |
The animation fills the table row by row. The columns are the function, the four data inputs as functions of , and the multiplexer output (choose the data input selected by ); the function and the output are compared.
A function of three variables on a 4:1 multiplexer
Computed exactly, not typed| A | B | C | F=sum m(1,2,6,7) | I0=C | I1=C' | I2=0 | I3=1 | Y=mux(S1=A,S0=B) |
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | · | · | · | · | · | · |
| 0 | 0 | 1 | · | · | · | · | · | · |
| 0 | 1 | 0 | · | · | · | · | · | · |
| 0 | 1 | 1 | · | · | · | · | · | · |
| 1 | 0 | 0 | · | · | · | · | · | · |
| 1 | 0 | 1 | · | · | · | · | · | · |
| 1 | 1 | 0 | · | · | · | · | · | · |
| 1 | 1 | 1 | · | · | · | · | · | · |
Step 0
Claim: connecting A and B to the select lines of a 4:1 multiplexer and wiring its data inputs to C, C', 0 and 1 gives the function F = sum m(1, 2, 6, 7). For each select value the output is just one data input.
Worked examples
EX 1The multiplexer equation in a program
EasyThe program evaluates the 4:1 multiplexer above on every input, checks it against the function, and counts multiplexers and the constants trick.
#include <stdio.h>
static int mux4(int s1, int s0, int i0, int i1, int i2, int i3) {
int in[4] = { i0, i1, i2, i3 };
return in[2 * s1 + s0];
}
int main(void) {
int bad = 0;
printf("A B C | F Y\n");
for (int m = 0; m < 8; m++) {
int a = (m >> 2) & 1, b = (m >> 1) & 1, c = m & 1;
int f = m == 1 || m == 2 || m == 6 || m == 7;
int y = mux4(a, b, c, !c, 0, 1);
printf("%d %d %d | %d %d\n", a, b, c, f, y);
bad += f != y;
}
printf("mismatches: %d\n", bad);
int cmp = 0;
for (int s = 0; s < 2; s++) {
cmp += (s ? 0 : 1) != !s; /* NOT: I0 = 1, I1 = 0 */
for (int b = 0; b < 2; b++) {
cmp += (s ? b : 0) != (s && b); /* AND: I0 = 0, I1 = b */
cmp += (s ? 1 : b) != (s || b); /* OR: I0 = b, I1 = 1 */
}
}
printf("2:1 mux with constants as AND, OR, NOT mismatches: %d\n", cmp);
int two_to_one = 0, left = 16;
while (left > 1) {
two_to_one += left / 2;
left /= 2;
}
printf("16:1 from 2:1 muxes: %d\n", two_to_one);
int four_to_one = 0;
left = 16;
while (left > 1) {
four_to_one += left / 4;
left /= 4;
}
printf("16:1 from 4:1 muxes: %d\n", four_to_one);
return 0;
}A B C | F Y
0 0 0 | 0 0
0 0 1 | 1 1
0 1 0 | 1 1
0 1 1 | 0 0
1 0 0 | 0 0
1 0 1 | 0 0
1 1 0 | 1 1
1 1 1 | 1 1
mismatches: 0
2:1 mux with constants as AND, OR, NOT mismatches: 0
16:1 from 2:1 muxes: 15
16:1 from 4:1 muxes: 5The data inputs reproduce the function on all 8 rows. The two counts are the numbers of 2:1 and 4:1 multiplexers for a 16:1 selector.
EX 2Which input is selected?
EasyA 4:1 multiplexer has select lines . The index is , so . With , . The equation shows why: only the minterm is 1 for .
EX 3A three-variable function on an 8:1 multiplexer, directly
MediumImplement with an 8:1 multiplexer. Its minterms are (index 1), (3), (6) and (7), so . Connect , , to , , and tie and .
EX 4The same function on a 4:1 multiplexer
MediumFor , use and as selects. Pairs of rows : : rows 0, 1 give , so . : rows 2, 3 give , so . : rows 4, 5 give , so . : rows 6, 7 give , so . Data inputs: (no inverter needed).
EX 5Counting multiplexers
GATE level(a) A 32:1 multiplexer built from 2:1 multiplexers needs of them.
(b) A 64:1 multiplexer from 4:1 multiplexers needs .
(c) A 16:1 multiplexer from 4:1 multiplexers needs (the program confirms 5 and, for 2:1 multiplexers, 15).
(d) The number of select lines of a :1 multiplexer is , so a 32:1 multiplexer has 5 select lines.
EX 6Functional completeness of a 2:1 multiplexer
GATE levelWith the constants 0 and 1 the 2:1 multiplexer gives NOT (), AND () and OR (); the program checks these (the counted mismatches are 0). Since AND, OR and NOT together are complete, so is the multiplexer. Without constants a 2:1 multiplexer is not complete: built only from the input variables, every output it can produce is 0 when all inputs are 0, so the constant 1 and the function NOT cannot be made.
EX 7Demultiplexer as decoder
GATE levelA 1-to-4 demultiplexer with and select has output and . With every output is 0. A 2-to-4 decoder with enable behaves identically: its enable is the demultiplexer's data input.
Cheat box
Cheat box
- . 2:1: . A :1 MUX has select lines.
- :1 from 2:1 multiplexers: . 16:1 from 4:1: 5. 64:1 from 4:1: 21.
- Function of variables on a :1 MUX: data inputs are the truth-table column. On a :1 MUX: data inputs are , , or ( = the variable not on the selects).
- 2:1 MUX plus constants is functionally complete (NOT, AND, OR).
- DEMUX: = decoder with enable .
- MUX is the circuit for the Shannon expansion .
Traps and GATE patterns
Connections
Builds on
Across subjects
Within this subject
A decoder produces the minterms and a multiplexer selects among them, so the two are duals in use; a demultiplexer is a decoder with an enable. Multiplexers implement every function of SOP and POS forms, and their completeness is a case of functional completeness. A table of outputs stored in memory is the same idea in bulk: see ROM and PLA. In the processor the multiplexers choose the ALU input or the register to write (ALU design).
PYQs
10 previous year questions from your book. I re-solved each one myself (8 by running or simulating, 2 by reasoning only); the book's key is shown next to my answer. All PYQs
Consider the digital circuit shown below with two input lines A and B, two select lines S0 and S1, and an output line Y. The blocks Q and M represent an active-high 2:4 decoder and a 4-to-1 multiplexer, respectively. Out of 16 possible input combinations, the number of combinations that produce Y = 1 is __________. (Answer in integer).
A Boolean digital circuit is composed using two 4- input multiplexers (M1 and M2) and one 2-input multiplexer (M3) as shown in the figure. X0-X7 are the inputs of the multiplexers M1 and M2 and could be connected to either 0 or 1. The select lines of the multiplexers are connected to Boolean variables A, B and C as shown. Which one of the following set of values of (X0, X1, X2, X3, X4, X5, X6, X7) will realise the Boolean function A'+ A'⋅C' + A⋅ B'⋅C?
- (a)(1, 1, 0, 0, 1, 1, 1, 0)
- (b)(1, 1, 0, 0, 1, 1, 0, 1)
- (c)(1, 1, 0, 1, 1, 1, 0, 0)
- (d)(0, 0, 1, 1, 0, 1, 1, 1)
Consider a digital display system (DDS) shown in the figure that displays the contents of register X. A 16- bit code word is used to load a word in X, either from S or from R. S is a 1024-word memory segment and R is a 32-word register file. Based on the value of mode bit M, T selects an input word to load in X. P and Q interface with the corresponding bits in the code word to choose the addressed word. Which one of the following represents the functionality of P, Q, and T? DIGITAL LOGIC
- (a)P is 10:1 multiplexer;Q is 5: 1 multiplexer; T is 2: 1 multiplexer
- (b)P is 10: 210 decoder; Q is 5: 25 decoder;T is 2: 1 encoder
- (c)P is 10:210 decoder; Q is 5: 25 decoder; T is 2: 1 multiplexer
- (d)P is 1: 10 de-multiplexers; Q is 1: 5 de- multiplexers; T is 2: 1 multiplexer
Which one of the following circuits implements the Boolean function given below? f (x, y, z) = m0 + m1 + m3 + m4 + m5 + m6, where mi is the ith min- term.
- (a)
- (b)
- (c)
- (d)
A multiplexer is placed between a group of 32 registers and an accumulator to regulate data movement such that at any given point in time the content of only one register will move to the accumulator. The minimum number of select lines needed for the multiplexer is _____.
Consider the 4-to-1 multiplexer with two select lines S1 and S0 given below The minimal sum of products form of the output X is
- (a)P ̅Q + QR ̅ + PQ ̅R
- (b)P ̅Q + P ̅QR ̅ + PQR ̅ + PQ ̅R
- (c)PQR + P ̅QR ̅ + QR ̅ + PQ ̅R
- (d)PQR
Consider the following combinational function
block involving four Boolean variables x, y, a, b
where x, a, b are inputs and y is the output.
f(x,y,a,b)
{
if(x is 1)y =a;
else y=b;
}
Which one of the following digital logic blocks is
the most suitable for implementing this function?- (a)Full adder
- (b)Priority encoder
- (c)Multiplexer
- (d)Flip-flop
The Boolean expression of the output of the multiplexer shown below is
- (a)(P ⊕ Q ⊕ R)̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅
- (b)P ⊕ Q ⊕ R
- (c)P + Q̅ + R
- (d)(P + Q + R)̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅
Consider the circuit below. Which one of the following options correctly represents f(x,y,z)
- (a)xz̅ + xy + y̅z
- (b)xz̅ + xy +y̅z̅
- (c)xz + xy + y̅z̅
- (d)xz + xȳ + y̅z
Consider a digital logic circuit consisting of three 2- to-1 multiplexers M1, M2, and M3 as shown below. X1 and X2 are inputs of M1. X3 and X4 are DIGITAL LOGIC inputs of M2. A, B, and C are select lines of M1, M2, and M3, respectively. For an instance of inputs X1= 1, X2= 1, X3= 0, and X4= 0, the number of combinations of A, B, C that give the output Y= 1 is ____________.
Self-check
Question 1
How many 2:1 multiplexers are needed to build an 8:1 multiplexer?
Show answerHide
: four in the first level, two in the second, one in the third.
Question 2
Implement with a 4:1 multiplexer with selects and . What are the data inputs?
Show answerHide
Row pairs: : rows 0, 1 give , so . : rows 2, 3 give , so . : rows 4, 5 give , so . : rows 6, 7 give , so .
Question 3
What is the output of a 4:1 multiplexer with , , , and selects ?
Show answerHide
The output is 1 when and 0 otherwise, so : a multiplexer with data inputs 0, 1, 1, 0 is an XOR gate.
Question 4
How many select lines and data inputs does a multiplexer have if it is used to choose among 20 sources?
Show answerHide
select lines, so a 32:1 multiplexer is needed (12 inputs left unused or tied off).
Revision card
One-screen revision
- ; inputs, selects. :1 from 2:1 needs multiplexers.
- Function of variables on a :1 MUX: data inputs are 0, 1, , .
- 2:1 MUX with constants makes NOT, AND, OR (complete).
- DEMUX is a decoder with enable .
References
- ·Mano and Ciletti, Digital Design, 5th ed., Chapter 4 Combinational Logic (multiplexers, demultiplexers) and Chapter 3 (Boolean function implementation)
- ·Kohavi and Jha, Switching and Finite Automata Theory, Multiplexer realisation of switching functions
Verification
The multiplexer equation, the 0/1/x/x' data inputs for every three-variable function on a 4:1 multiplexer, functional completeness of the 2:1 multiplexer with constants, the counts of multiplexers needed for larger sizes, and the demultiplexer-as-decoder identity are checked in scripts/enum-checks/dl_comb.py. The truth-table animation is computed by scripts/gen-dl-traces.py and checked in tests/dl-traces.test.ts. The C program is compiled and run by npm run verify:c. Textbook chapter titles are from memory; the independent second pass has not been run, so the page stays draft. SECOND PASS (2026-11-02, done by the assistant, not a human check): every Self-check question was solved before the printed answer was read and all agreed; the definitions, worked examples, cheat box and traps were read claim by claim and the numbers re-derived by hand or by a small script (conversions, signed ranges and flags, IEEE 754 fields and custom formats, Boolean identities and counts, K-map groups, adder carries, BCD correction, flip-flop conversions, counter sequences and T equations, state reduction, Quine-McCluskey rounds and covers, floating-point alignment and rounding); long C programs were not re-read line by line (they are compiled and compared by npm run verify:c, and their printed outputs were checked against the prose); tables and animations are machine output and were read, not re-run; No other defect found. Status raised to self-checked; verified needs a textbook or human check.
last verified: never
My notes (saved in this browser)