The Multiplexer
⨯ What It Does
A multiplexer selects one of many inputs and forwards it to a single output line. Select lines act as the address, choosing which input passes through. A 2:1 mux uses 1 select line. A 4:1 uses 2. An 8:1 uses 3. The pattern: n select lines address 2n inputs.
⇄ The Demultiplexer
The inverse operation. One input, routed to one of many outputs based on select lines. Where a mux concentrates, a demux distributes. Together they form the fundamental routing fabric of every digital system ever built.
Scaling: From Gates to Processors
⚙ Inside the ALU
The arithmetic logic unit uses multiplexers to select operands from registers, choose which operation to execute (add, subtract, AND, OR), and route results back to the register file. Every instruction cycle is a mux decision.
■ Building n-bit
A 32-bit processor cascades mux layers for each bit position. Shannon proved in 1937 that any Boolean function decomposes into a hierarchy of multiplexers. His expansion theorem is the mathematical bedrock of all digital design.
Three Domains, One Pattern
⚡ Silicon
Transistors switch voltage levels. Select lines address input channels. Nanosecond decisions route data through billions of gates. The CPU is a mux/demux machine.
🧠 Biology
The thalamus multiplexes sensory streams — vision, sound, touch, pain — into focused attention. Motor cortex demultiplexes intent into specific muscle groups. Attention is biological multiplexing.
🤖 Intelligence
AI agents multiplex heterogeneous inputs — memory, context, tools, observations — into a single decision point. They demultiplex that decision into parallel actions: API calls, code, messages, delegation. Orchestration is applied mux/demux theory.
Building From Nothing: NAND to Mux
📖 The Elements of Computing Systems
In the celebrated Nand2Tetris course by Noam Nisan and Shimon Schocken, students build an entire computer from a single primitive: the NAND gate. The course proves that NAND is functionally complete — any Boolean function can be built from NAND alone. The first project starts with NAND and ends with Mux8Way16 and DMux8Way. By chapter 5, you have a working CPU.
The Primitive: NAND
NAND (Not-AND) is the only gate given to you. Everything else is built from it.
Mux from 4 NAND Gates
The multiplexer — the selector at the heart of every processor — needs just 4 NAND gates:
DMux from 5 NAND Gates
The demultiplexer routes one input to one of two outputs. The inverse of Mux:
The Nand2Tetris HDL
Mux.hdl
DMux.hdl
Scaling Up: The Tree Pattern
Multi-way muxes compose as binary trees. Each level adds one select bit, doubling the input count:
Inside the ALU: Mux as Decision Maker
The Hack ALU from Nand2Tetris uses six control bits, each driving a Mux16 to conditionally transform the inputs. This elegant cascade lets one circuit compute 18 different functions:
Timeline
Claude Shannon proves Boolean algebra can implement any logical function in electrical circuits. His expansion theorem shows every function is a mux tree.
Telephone switching networks become the first industrial-scale mux/demux systems, routing thousands of calls through shared copper.
Integrated circuits put multiplexers on silicon. The 74151 (8:1 mux) and 74138 (3:8 demux) become building blocks of early microcomputers.
AI agent orchestration applies the pattern at a new level. Multiple models, multiple tools, multiple knowledge sources — multiplexed into decisions, demultiplexed into coordinated action across machines and networks.