# Multiplexer **A circuit that selects an input from several and forwards it to a single output.** ![[4to1Multiplexer.svg|225]] *A 4-to-1 multiplexer; using $S_{0}$ and $S_{1}$ as a binary counter, the multiplexer can select which input line to forward to the output* A **multiplexer** or **mux** is a circuit that chooses one of its inputs to *forward* to its output according to a set of *select lines*. A multiplexer with $2^{n}$ information inputs has $n$ select lines. The inputs are typically labelled according to the binary combination of the select lines. The inverse of a multiplexer is a **demultiplexer** or **demux**, which instead transmits its input to one of several outputs as chosen by its *control lines*, which are analogous to the select lines of a multiplexer. ## Implementation ### Multiplexer A multiplexer can be implemented using a [[decoder]], 2-input [[Conjunction|AND]] gates, and an [[Disjunction|OR]] gate. ![[4to1MultiplexerConstruction.svg|550]] *A 4-to-1 multiplexer implemented using a decoder, four 2-input AND gates, and a 4-input OR gate* Larger multiplexers with more total inputs can subsequently be constructed by *cascading* together smaller multiplexers. ![[8to1CascadingMultiplexers.svg|450]] *An 8-to-1 multiplexer implemented by cascading two 4-to-1 multiplexers into a 2-to-1 multiplexer* ### Demultiplexer A demultiplexer can be implemented using a decoder and 2-input AND gates. As such they can be thought of as decoders with an enable line. ![[DemultiplexerConstruction.svg|450]] *A 1-to-4 demultiplexer implemented using a 2-to-4 line decoder and four 2-input AND gates; the inputs and outputs have been labelled to correspond to those of a multiplexer in reverse* ## Applications ### Digital electronics Multiplexers can be used to implement [[Boolean Function|Boolean functions]]. The functions need to be *decomposed* with [[Boole's expansion theorem]] first, such that a variable or a set of variables can act as the select lines. > [!Boolean equation, 1 select line]- >$\begin{flalign} F&=\bar{A}\bar{C}+AB+AC &\\ &=A(B+C)+\bar{A}(\bar{C}) \end{flalign}$ ![[MultiplexerImplementationBooleanEquation1.svg|500]] > [!Boolean equation, 2 select lines]- To use both $A$ and $B$ as select lines, $B$ needs to be included in every term. This can be achieved by multiplying all terms by $B+\bar{B}=1$. >$\begin{flalign} F&=\bar{A}\bar{C}+AB+AC &\\ &=AC(B+\bar{B})+AB(1)+\bar{A}\bar{C}(B+\bar{B}) &\\ &=ABC+A\bar{B}C+AB(1)+\bar{A}B\bar{C}+\bar{A}\bar{B}\bar{C} &\\ &=AB(1)+A\bar{B}(C)+\bar{A}B(\bar{C})+\bar{A}\bar{B}(C) \end{flalign}$ ![[MultiplexerImplementationBooleanEquation2.svg|550]] > [!Minterm canonical form]- $F(A,B,C,D)=\sum m(1,3,4,11,12,13,14,15)$ > If $A$ and $B$ are the select lines, a [[Karnaugh Map|K-map]] can be used to find the combinations of the other variables that correspond with each input, i.e. $AB = 00$, $AB=01$ etc. > For example, if $AB=01$, then the minterm $\bar{C}\bar{D}$ is HIGH according to the function. Thus, $\bar{C}\bar{D}$ must be the value forwarded to the output when $AB=01$. > ![[MultiplexerImplementationMintermCanonicalKMap.svg|400]] > ![[MultiplexerImplementationMintermCanonical.svg|550]] ### Telecommunications Multiplexers, along with demultiplexers, are used in telecommunications to facilitate *[[multiplexing]]*, the most common method of allowing multiple signals to use a shared transmission medium. ![[Multiplexing.svg|400]]