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 A | In B | In Ch0 | In Ch1 | In Ch2 | In Ch3 | Out |
---|---|---|---|---|---|---|
0 | 0 | 0 | x | x | x | 0 |
0 | 0 | 1 | x | x | x | 1 |
0 | 1 | x | 0 | x | x | 0 |
0 | 1 | x | 1 | x | x | 1 |
1 | 0 | x | x | 0 | x | 0 |
1 | 0 | x | x | 1 | x | 1 |
1 | 1 | x | x | x | 0 | 0 |
1 | 1 | x | x | x | 1 | 1 |
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:
Demultiplexer
Instead of grouping multiple channels into one, de-multiplexer assign a single data source into one of the multiple destinations.
In A | In B | In D | Out Ch1 | Out Ch1 | Out Ch2 | Out Ch3 |
---|---|---|---|---|---|---|
x | x | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 1 | 1 | 0 | 0 | 0 |
0 | 1 | 1 | 0 | 1 | 0 | 0 |
1 | 0 | 1 | 0 | 0 | 1 | 0 |
1 | 1 | 1 | 0 | 0 | 0 | 1 |
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:
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.