First MUX: 2-to-1 Multiplexer
Reference for the 2-to-1 multiplexer: select-driven data routing and the conditional operator that expresses it.
Updated 2026-06-05
A multiplexer, or MUX, is a data selector. A 2-to-1 MUX has two data inputs and one select line, and it routes one data input to the output based on the value of select. It is the hardware equivalent of "choose this input or that input depending on a control signal."
The routing is a small table: for one value of select the output follows one data input, and for the other value it follows the other. Getting this polarity right — which select value picks which input — is the whole job, so read the lesson's wiring carefully before writing code.
Verilog expresses this with the conditional operator ? :, which evaluates a condition and yields one of two values. A MUX is the canonical use of that operator: the select line is the condition, and the two data inputs are the two possible results.