The Multiplexer: a Track Switch for Signals
The ninth intro introduces the digital switch: a toggle called Sel decides which of the two signals — A or B — reaches the lamp.
Experiment: the track switch
Here is a railway switch: two signals A=1 and B=0, and the Selector toggle (Sel) decides which one reaches lamp Q. Toggle Sel and watch the lamp: it repeats one of the two signals — which one is up to Sel. Sel does not light up by itself: it is not a signal but a switch that moves the signal path.
Predict: whose signal reaches the lamp
Check yourself: A=0, B=1, Sel=0 — will Q light up? No: Sel=0 routes channel A to the lamp, and A holds 0. The one on B does not "push through" by itself — its path is closed. The value of a signal and the number of the selected channel are different things, and that is exactly what beginners mix up.
The selection rule
Such a switch is called a multiplexer (MUX) — a 2-to-1 digital switch: Sel=0 → output=A; Sel=1 → output=B. Inside are two AND gates and one OR: when Sel=0, line A is open (A AND 1 = A) and line B is closed (B AND 0 = 0); at Sel=1 — the opposite.
| A | B | Sel | Q |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
The formula: Q = (A AND NOT Sel) OR (B AND Sel). NOT Sel is how "open" line A is, Sel is how open line B is, and the OR collects whichever signal has its line open.
Where it is used
On this level you will build the multiplexer from gates — and get it as a ready MUX chip. Later the chips chain into cascades: BusMUX picks whose operation result to show (level 13, the ALU). In a processor, the multiplexer decides where to take the next instruction address — from the program counter or from a jump: the same dispatcher at the track switch.