4-to-1 multiplexer

Four inputs, two selector bits — pick any one and send it through. A ready-made routing circuit you can open in the TorchAnvil simulator.

One selector bit isn't enough

The 2-to-1 mux uses a single selector bit to choose between two inputs. Want to choose between four? You need two selector bits, because two bits can name four different things: 00, 01, 10, 11. Each combination picks a different input — I0, I1, I2, or I3 — and forwards just that one to the output.

How it works

The selector bits S1 S0 act as a two-bit address. Each input has a unique "permission pattern" made of S1/S0 and their negations:

Each input runs through two AND gates in series to check both bits of its pattern, then all four gated signals meet in a small OR tree: OR(I0-gated, I1-gated) and OR(I2-gated, I3-gated), with a final OR merging both halves. Only one path can be live at a time — the other three are silenced by their AND gates — so the ORs really just forward the survivor.

The formula, if you like it compact:

Out = (I0 · !S1 · !S0) + (I1 · !S1 · S0) + (I2 · S1 · !S0) + (I3 · S1 · S0)

Why it matters

A 4-to-1 mux is the generalization of the 2-to-1 and the template for every wider mux. With n selector bits you address 2^n inputs. Real CPUs use 8-to-1, 16-to-1, or wider muxes on their register files to pick which register feeds the ALU on any given cycle. This pattern also appears anywhere you're routing data from many sources to one destination: video switchers, network crossbars, the inside of a cache controller.

Notice the decoder hiding inside: the four AND pairs that gate each input are doing exactly what a 2-to-4 decoder does — turning two selector bits into four one-hot enable lines.

Try this