Multiplexer (MUX)

A multiplexer (MUX) is a digital switch that allows one of several input signals to be selected and passed through to a single output line. In a 2-input MUX with signals and , and a selector bit , the value of determines whether or is passed to the output. Specifically,

The 2-input MUX is graphically represented as

\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
 
   % Draw the multiplexer box
   \node at (0.5,0) {MUX};
   \draw[thick] (0,1) -- (0,-1) -- (1,-0.5) -- (1,0.5) -- cycle;
 
   % Draw the input lines
   \draw[thick, ->] (-1,0.5) -- (0,0.5) node[at start, left]{A};
   \draw[thick, ->] (-1,-0.5) -- (0,-0.5) node[at start, left]{B};
 
   % Draw the selector line
   \draw[thick, ->] (0.35,-1.6) -- (0.35,-0.8) node[at start, below]{S};
 
   % Draw the output line
   \draw[thick, ->] (1,0) -- (2,0) node[right]{Y};
 
\end{tikzpicture}
\end{document}

Understsanding

The easiest way to understand the MUX is using a truth table:

ABSOut
0000
1001
0010
1010
0100
1101
0111
1111