Choosing between two inputs
Figure: A trapezoid 2-to-1 MUX symbol with two data inputs a and b stacked on the left, one output y on the right
A multiplexer (MUX) is a selector switch built from gates. The 2-to-1 MUX is the smallest one:
- Two data inputs,
a and b. - One select line,
s. - One output,
y.
The rule: when s = 0 the output copies a, and when s = 1 it copies b. Selection shows up everywhere in a processor, choosing which value flows next, so this block is worth knowing cold.
Select picks the source
Because the MUX ignores one input at a time, the behaviour compresses to two rows:
Written as a full truth table over all three inputs:
The x is a don't care: when s = 0 the value of b cannot change the output, and when s = 1 the value of a cannot.
From table to equation
You already have the tool to turn that table into gates. Take the two rows where and write a product for each:
- Route
a: the term passes a while s = 0. - Route
b: the term passes while .