A railway signal box sends many tracks into one line, and a switch decides which track is connected at any moment. A multiplexer does the same job for data, and a demultiplexer does the reverse.
Multiplexer
A multiplexer (MUX) selects one of several data inputs and sends it to a single output. The choice is made by select lines. A 4:1 multiplexer has four data inputs I0 to I3, two select lines S1 and S0, and one output Y. Its output equation is Y = S1'S0'·I0 + S1'S0·I1 + S1S0'·I2 + S1S0·I3.
Definition: Multiplexer. A combinational circuit that selects one of many data inputs, according to the binary value on its select lines, and passes it to a single output.
Table 2.7: Function table of a 4:1 multiplexer
| S1 | S0 | Output Y |
|---|---|---|
| 0 | 0 | I0 |
| 0 | 1 | I1 |
| 1 | 0 | I2 |
| 1 | 1 | I3 |
Since n select lines choose among 2 to the power n inputs, a 4:1 multiplexer needs two select lines and an 8:1 multiplexer needs three. Multiplexers are also used to implement Boolean functions: the function variables drive the select lines and the data inputs are set to 0, 1 or a variable.
Demultiplexer
A demultiplexer (DEMUX) has one data input and several outputs. The select lines decide which output receives the input, and the other outputs stay at 0. A 1:4 demultiplexer with data input D and select lines S1, S0 has outputs Y0 = S1'S0'·D, Y1 = S1'S0·D, Y2 = S1S0'·D and Y3 = S1S0·D. Used together, a multiplexer and a demultiplexer let many devices share one communication line.
Example 2.4: Selecting an input with a multiplexer
Problem: In a 4:1 multiplexer I0 = 1, I1 = 0, I2 = 1 and I3 = 0. Find Y for S1 S0 = 10 and S1 S0 = 01. Then find the outputs of a 1:4 demultiplexer with D = 1 and S1 S0 = 11.
Solution:
- For S1 S0 = 10, the selected input is I2, so Y = 1.
- For S1 S0 = 01, the selected input is I1, so Y = 0.
- For the demultiplexer, S1 S0 = 11 selects Y3, so Y3 = D = 1 and Y0, Y1, Y2 are 0.
Result: Y = 1 and Y = 0 for the multiplexer, and the DEMUX outputs are 0, 0, 0, 1.
def mux(i, s1, s0):
return i[2*s1 + s0]
i = [1, 0, 1, 0]
print(mux(i, 1, 0), mux(i, 0, 1))
print([1 if k == 3 else 0 for k in range(4)])
Output
1 0
[0, 0, 0, 1]
Table 2.8: Comparison of multiplexer and demultiplexer
| Property | Multiplexer | Demultiplexer |
|---|---|---|
| Data inputs | Many | One |
| Data outputs | One | Many |
| Select lines | Choose the input | Choose the output |
| Common name | Data selector | Data distributor |
Common mistakes
- Saying that a 4:1 multiplexer needs four select lines. It needs two.
- Confusing the direction of data flow of a multiplexer and a demultiplexer.
- Letting two data inputs reach the output at the same time.
Key takeaways
- A multiplexer selects one input; a demultiplexer routes one input to one output.
- n select lines control 2 to the power n lines.
- Y = S1'S0'I0 + S1'S0I1 + S1S0'I2 + S1S0I3 for a 4:1 multiplexer.
- A multiplexer can implement any Boolean function.
Practice questions
- How many select lines does an 8:1 multiplexer need?
- What does a demultiplexer do?
- Which input appears at Y of a 4:1 MUX when S1 S0 = 11?
Answers to the practice questions
- Three.
- It sends a single data input to one of several outputs chosen by the select lines.
- I3.
Sources
- Official BCA syllabus Computer Architecture, course code 25BCA401DS02, Unit II
