5.3 Multiplexers (MUX) & Function Implementation
π‘ Core Intuition: The Rotary Train Track Switchβ
Imagine a busy train terminal where four separate incoming freight lines () merge into a single outbound mainline track (). A switch operator sits in a control tower with a two-lever selector console (). By flipping the levers into one of four possible binary combinations (), the operator physically steers exactly one train onto the main track while holding all others back.
π³ The Everyday Analogy: The Multi-Source TV Remoteβ
- The Input Channels: Your television has multiple ports: HDMI 1 (), HDMI 2 (), DisplayPort (), and Cable TV ().
- The Single Display Output: Your TV screen () can only display one video feed at any given moment.
- The Selector Buttons: When you push button "2" on your remote control (), an internal routing switch disconnects all other inputs and routes HDMI 2 directly to the screen pixels.
- This is a Multiplexer (MUX): a digitally controlled data selector that funnels data input channels into a single output line under the direction of control select lines.
π» Bridging to Computer Scienceβ
In computer architecture, data routing is ubiquitous:
- CPU Register Files: When an instruction executes
ADD R1, R2, R3, a multiplexer decodes the register IDR2to select which physical register lines are wired to the ALU's operand port. - Bus Arbitration: Multiple memory controllers and DMA engines contend for a single memory bus. A multiplexer network grants channel access to one master at a time.
- FPGA Architecture: Field Programmable Gate Arrays do not physically re-wire AND/OR gates at runtime. Instead, an FPGA consists of millions of Look-Up Tables (LUTs), which are essentially SRAM memory cells feeding wide multiplexer trees!
πTable of Contents
- π MUX Fundamentals & Gate Architecture
- π³ Hierarchical MUX Tree Expansion
- β‘ Boolean Logic Implementation via MUX
- π The Residue Table Method (2^{n-1}:1 MUX)
- π§© The Universal Logic Module Property
- π Real-World Production Context: Data Steering, Processor Interconnects & FPGA LUTs
- π Numerical Applications & Worked Examples
- π― Exam & Interview Pitfall Check
π MUX Fundamentals & Gate Architectureβ
A Multiplexer (often abbreviated as MUX or Data Selector) possesses:
- Data Inputs:
- Select Inputs:
- Enable Input (Strobe): or (optional chip-select line)
- Single Output:
Data Inputs (2βΏ)
Source Streams- Carries digital information from multiple independent sources.
- Can carry constant logic levels (0, 1) or time-varying data signals.
Select Lines (n)
Address Control- An n-bit binary control word selects exactly one active input channel.
- Number of select lines is logarithmic: n = logβ(Data Inputs).
Enable / Strobe
Chip Control- Typically active-low (E_bar).
- When asserted (0), normal MUX routing occurs; when de-asserted (1), output is forced to 0 (or High-Z).
The 2:1 Multiplexerβ
- Inputs: data lines (), select line (), output ().
| Select () | Active Input Selected | Output () |
|---|---|---|
With active-low enable input :
- Channel 0 AND Gate: Evaluates .
- Channel 1 AND Gate: Evaluates .
- Output OR Gate: Combines both paths: .
The 4:1 Multiplexerβ
- Inputs: data lines (), select lines (), output ().
| Enable () | (MSB) | (LSB) | Selected Input | Output () |
|---|---|---|---|---|
| None (Disabled) | ||||
π³ Hierarchical MUX Tree Expansionβ
When a system requires a wider multiplexer than what is available in standard catalog ICs (e.g., building a 16:1 MUX from 4:1 MUXes), we construct a Hierarchical MUX Tree.
Synthesizing a 4:1 MUX Using Three 2:1 MUXesβ
We can build a 4:1 MUX using two levels of 2:1 MUXes:
- Level 1: Two 2:1 MUXes select between pairs of inputs controlled by :
- : Inputs controlled by
- : Inputs controlled by
- Level 2: One 2:1 MUX selects between and controlled by :
- : Inputs controlled by
Two-Level 4:1 MUX Tree Hierarchy Using 2:1 MUXes
Hierarchical steering: Level 1 decodes LSB select Sβ, Level 2 decodes MSB select Sβ
Level 1: Sβ Selection
MUX A routes (Iβ, Iβ) to Y_A; MUX B routes (Iβ, Iβ) to Y_B.
Level 2: Sβ Selection
Final MUX selects between intermediate outputs (Y_A, Y_B).
Substitute and into the Level 2 equation:
The result matches the exact equation of a 4:1 Multiplexer.
General MUX Sizing Ruleβ
To synthesize an -to-1 MUX using -to-1 MUX modules:
- Number of modules in First Stage
- Continue cascading until a single output remains.
- Total number of MUXes (when and are powers of 2).
For example:
- Building an 8:1 MUX using 2:1 MUXes: ( in stage 1, in stage 2, in stage 3).
- Building a 16:1 MUX using 4:1 MUXes: ( in stage 1, in stage 2).
β‘ Boolean Logic Implementation via MUXβ
A multiplexer is essentially a programmable truth table lookup engine.
Method 1: Trivial Implementation Using a -to-1 MUXβ
To implement an arbitrary -variable Boolean function using a -to-1 MUX:
- Connect all function variables directly to the select lines: .
- For every minterm where , tie the corresponding data input to Logic 1 ().
- For every minterm where , tie the corresponding data input to Logic 0 ().
While simple, this method is hardware-inefficient because it requires a large MUX. In engineering interviews and real chip design, we use Method 2.
π The Residue Table Method ( MUX)β
Any -variable Boolean function can be implemented using a multiplexer with only select lines (a -to-1 MUX) without needing any additional external logic gates!
The Step-by-Step Algorithmβ
- Select Control Variables: Assign variables to the MUX select lines. By convention, assign the most significant variables to select lines .
- Identify the Residue Variable: Let the single remaining unassigned variable be (typically the LSB).
- Construct the Implementation Table:
- Create columns corresponding to the MUX inputs .
- Under each input , list the two minterms it addresses:
- Top row: minterm when ()
- Bottom row: minterm when ()
- Circle the minterms that are present in the function's ON-set ().
- Determine Each Data Input Value:
- If neither minterm in the column is circled .
- If both minterms in the column are circled .
- If only the top minterm () is circled .
- If only the bottom minterm () is circled .
The 4-Way Residue Table Decision Rules
Mapping circled minterms in column k directly to MUX data input pin I_k
Neither Circled
Both minterms absent from function ON-set.
Both Circled
Both minterms present in function ON-set.
Top Only Circled
Asserted only when residue variable Z = 0.
Bottom Only Circled
Asserted only when residue variable Z = 1.
π§© The Universal Logic Module Propertyβ
A multiplexer is a universal logic module: any fundamental logic gate can be implemented using a single 2:1 Multiplexer.
Let select line :
- NOT Gate ():
Set - AND Gate ():
Set - OR Gate ():
Set - NAND Gate ():
Set - NOR Gate ():
Set - XOR Gate ():
Set - XNOR Gate ():
Set
π Real-World Production Context: Data Steering, Processor Interconnects & FPGA LUTsβ
Why does modern compute and reconfigurable hardware care so deeply about multiplexers?
- CPU Register Files: When executing
ADD R1, R2, R3, a multiplexer decodes register addressR2to steer the physical register lines onto the ALU operand bus. - Shared Memory Interconnects: Crossbar switches and AXI bus interconnects route multi-core memory traffic using cascaded MUX arrays.
- FPGA Look-Up Tables (LUTs): Configurable logic blocks in modern FPGAs (AMD Xilinx, Intel Altera) rely on SRAM cells driving wide multiplexer trees to emulate arbitrary combinational functions in single-cycle deterministic latency:
Inside a 6-Input FPGA Look-Up Table (LUT6)
How configuration SRAM cells and high-speed multiplexer trees evaluate arbitrary Boolean logic
Configuration SRAM Cells (64 Bits)
Holds the truth table output bits (0 or 1) programmed during bitstream upload.
6-Level Multiplexer Tree (64:1 MUX)
Constructed from cascading 2:1 MUXes controlled by primary inputs A, B, C, D, E, F.
LUT Output Pin (Y)
Delivers the evaluated Boolean function in a deterministic 150-picosecond latency.
- When a software developer writes Verilog/VHDL code for an arbitrary equation , the synthesis tool evaluates the truth table and stores all 64 output bits into 64 SRAM cells.
- The 6 input signals act as select lines driving a 64:1 MUX tree.
- In silicon, any arbitrary 6-variable Boolean function executes in the exact same deterministic propagation delay, regardless of whether the function is a simple AND gate or a complex cryptographic hash round!
π Numerical Applications & Worked Examplesβ
Example 1: Full Adder Implementation Using Two 4:1 Multiplexersβ
Problem Statement:
Design a 1-bit Full Adder () using two 4:1 Multiplexers. Connect variables and to select lines () and derive the exact data input connections for both MUXes using the residue table method.
Step 1: Write Truth Table for Full Adderβ
Inputs: . Output: , .
| Minterm | () | () | (Residue) | Sum () | Carry () |
|---|---|---|---|---|---|
Step 2: Implementation Table for Sum ()β
Select lines: . Residue variable: .
| Row Condition | () | () | () | () |
|---|---|---|---|---|
| () | (circled) | (circled) | ||
| () | (circled) | (circled) | ||
| Data Input Value |
- Column : circled
- Column : circled
- Column : circled
- Column : circled
Step 3: Implementation Table for Carry ()β
| Row Condition | () | () | () | () |
|---|---|---|---|---|
| () | (circled) | |||
| () | (circled) | (circled) | (circled) | |
| Data Input Value |
- Column : Neither circled (GND)
- Column : circled
- Column : circled
- Column : Both circled () ()
Final Circuit Summaryβ
- MUX 1 (Sum): Inputs , Selects .
- MUX 2 (Carry): Inputs , Selects .
Example 2: Implementing a 4-Variable Function Using an 8:1 Multiplexerβ
Problem Statement:
Implement the 4-variable Boolean function:
Using an 8:1 Multiplexer with connected to select lines respectively.
Step 1: Map Variables to Select and Residue Linesβ
- variables ().
- Select inputs of 8:1 MUX: , , .
- Residue variable: .
Step 2: Construct the Residue Tableβ
Inputs: to corresponding to .
| Row | () | () | () | () | () | () | () | () |
|---|---|---|---|---|---|---|---|---|
| () | ||||||||
| () | ||||||||
| Input |
Step 3: Determine Values for Each Inputβ
- Column : Both are in
- Column : Only is in
- Column : Only is in
- Column : Neither nor is in
- Column : Both are in
- Column : Only is in
- Column : Neither nor is in
- Column : Both are in
Final Connections:
- Select lines: .
- Data inputs: .
Example 3: Synthesizing an 8:1 MUX Using Only 2:1 MUXesβ
Problem Statement:
- Determine the exact number of 2:1 Multiplexers required to construct an 8:1 Multiplexer.
- Draw the tree hierarchy showing how select lines are mapped across each level.
- If each 2:1 MUX has a propagation delay of , calculate the total propagation delay of the 8:1 MUX tree.
Step 1: Calculate Module Countβ
Using the formula :
Step 2: Architecture & Select Line Allocationβ
The 7 multiplexers are arranged in a 3-level binary tree:
- Stage 1 (4 MUXes):
- Inputs: , , ,
- Select input for all 4 MUXes: (LSB)
- Produces 4 intermediate outputs: .
- Stage 2 (2 MUXes):
- Inputs: and
- Select input for both MUXes:
- Produces 2 intermediate outputs: .
- Stage 3 (1 MUX):
- Inputs:
- Select input: (MSB)
- Delivers the final output .
Step 3: Propagation Delay Analysisβ
- Signal propagation passes sequentially through one MUX in Stage 1, one MUX in Stage 2, and one MUX in Stage 3.
- Total logic depth .
- Total propagation delay:
π― Exam & Interview Pitfall Checkβ
-
Why can any -variable Boolean function be implemented with a MUX, but requires a MUX if no inverted input () is available?
The residue method depends on feeding four possible values to each MUX input: . If you only have available without an inverter (NOT gate), you cannot generate for columns that only circle the top minterm. In that case, you must either add an external NOT gate or upgrade to a MUX where inputs are strictly constants ( or ). -
Can you implement an -variable function using a MUX?
Yes, but it requires external logic gates. With a MUX, two variables remain as residue variables. Each MUX input must then be driven by an arbitrary function of those two residue variables (e.g., , , ), which requires external AND/OR/XOR gates.
- Trap: Inverting the Select Line Significance.
When mapping variables to select lines, always verify MSB vs LSB alignment. If you assign and , your binary row selection will scramble the minterm addressing! Always maintain: . - Trap: Forgetting that MUX inputs must be tied off.
In CMOS hardware, leaving an unused MUX input "floating" causes high-impedance oscillation and excessive static power consumption. In synthesis and schematic diagrams, every unused input MUST be explicitly tied to or .