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 A and B, and a selector bit S, the value of S determines whether A or B is passed to the output. Specifically, Out=S⋅B+S⋅A.
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: