Multiplexer and Demultiplexer

Overview

Building a Multiplexer or De-multiplexer is not that difficult because you can build upon a decoder, so in this tutorial, I will teach you how to build such circuits.

Multiplexer

Multiplexer can let you choose a input signal path for the output, just like a HDMI switch which you can select a specific HDMI input for your screen.

Here is the truth table for a 4 channel multiplexer, since there are quite a few combinations, I only show the most important state for this circuit. I will put an X in the table, which means “don’t care”, meaning that the input will have no change neither 0 nor 1:


In AIn BIn Ch0In Ch1In Ch2In Ch3Out
000xxx0
001xxx1
01x0xx0
01x1xx1
10xx0x0
10xx1x1
11xxx00
11xxx11

Let me build a simulation to see the circuit in action:


"Wait a minute, is that just a decoder with an extra input?" Yes! All you need is an extra AND gate for your data stream of each channels, and an OR gate to return the selected stream, and... You are done, a multiplexer!

It is even clearer to see the decoder in SunVox, as you only need to attach a modulator after the output of the decoder, while the modulators act as transistors, controlling the flow of the data stream channels:

multiplexer

Demultiplexer

Instead of grouping multiple channels into one, de-multiplexer assign a single data source into one of the multiple destinations.


In AIn BIn DOut Ch1Out Ch1Out Ch2Out Ch3
xx00000
0011000
0110100
1010010
1110001

Unsuprisingly, you can also see a decoder here for select the destination channels, meaning that if we reverse the I/O from the multiplexer, we can get a de-multiplexer like shown:


SunVox implementation:

demultiplexer

Conclusion

Decoder is vital for digital logic since you can create other combinational circuits from expending the decoders. In the chapter, you have learn how to build multiplexer and de-multiplexer for dynamically routing the signal. After that, we will move on to other type of circuit, the fully featured adder.