Topic 04 — Digital Electronics

Combinational Circuits — Static Logic Masterclass

Adders, multiplexers, decoders, encoders, and comparators — the foundational building blocks of every processor, memory controller, and digital system ever built.

Half & Full Adder Carry Look-Ahead MUX & DEMUX Decoders & Encoders Interactive Simulator

1. Axioms of Combinational Logic

A combinational circuit is a digital system where output at any instant depends solely on the current combination of inputs — no memory of past states, no internal storage elements. Unlike sequential circuits (flip-flops, registers), combinational circuits have no feedback paths that create state.

Mathematically, a combinational circuit with n inputs and m outputs is a physical implementation of m Boolean functions of n variables. There are 22n possible Boolean functions for n inputs — for just 4 inputs, that's 65,536 possible behaviors.

Design Methodology

  1. Problem Statement: Define inputs, outputs, and functional behavior precisely.
  2. Truth Table: Enumerate all 2n input combinations with desired outputs.
  3. Simplification: Apply K-Maps or Boolean algebra to minimize gate count.
  4. Realization: Map to NAND/NOR standard cells for silicon implementation.
  5. Verification: Simulate all input combinations; check for hazards.
Propagation Delay (tpd): The only timing concern in combinational logic. A change in inputs takes finite time to propagate to outputs through gate delays. The longest such path is the critical path, and it limits the maximum clock frequency when combinational blocks are used between flip-flops.
Arithmetic Circuits
Adders, subtractors, multipliers — the computation muscle of the ALU.
🔀
Data Routing
MUX, DEMUX — select and direct data streams in buses and datapaths.
🔓
Decoding
Decoders translate binary addresses to enable specific memory or I/O.
🏆
Priority Logic
Encoders determine which of multiple simultaneous requests has highest priority.

2. Binary Arithmetic Units: Adders

Half Adder

The simplest addition circuit: takes two 1-bit inputs and produces a Sum and Carry. It cannot handle a carry-in from a previous stage, making it suitable only for the least significant bit position.

Sum (S) = A ⊕ B
Carry (C) = A · B
ABSum (S)Carry (Cout)
0000
0110
1010
1101

Full Adder

The cornerstone of all multi-bit addition. A Full Adder accepts three inputs: A, B, and a Carry-in (Cin), producing Sum and Carry-out. It can be built from two Half Adders and an OR gate.

Sum (S) = A ⊕ B ⊕ Cin
Carry (Cout) = A·B + B·Cin + A·Cin
ABCinSum (S)Cout
00000
00110
01010
01101
10010
10101
11001
11111

Ripple Carry Adder (RCA)

Chain N Full Adders in series, connecting Cout of each stage to Cin of the next. Simple to design but the carry must "ripple" from LSB to MSB — total delay scales as O(N). For a 64-bit adder, that's 64 Full Adder delays on the critical path, making it too slow for gigahertz operation.

3. Carry Look-Ahead Architecture (CLA)

The CLA eliminates the serial carry ripple by computing all carries simultaneously in parallel. It defines two auxiliary signals for each bit position i:

  • Generate (Gi) = Ai · Bi: Carry is definitely produced at this stage.
  • Propagate (Pi) = Ai ⊕ Bi: Carry is passed through if Cin is 1.
Ci+1 = Gi + Pi · Ci

Expanding recursively: C2 = G1 + P1G0 + P1P0C0. All carries can be computed in just 2–3 gate delays regardless of word width. Modern x86/ARM processors use 64-bit CLA with block-level hierarchy (groups of 4 CLAs feeding a Group CLA) to achieve adder delays of under 1 ns.

CLA vs RCA Trade-off: CLA is faster (O(1) carry computation vs O(N)) but requires O(N²) gate connections. Above ~64 bits, hierarchical CLA or Prefix Adder architectures (Kogge-Stone, Brent-Kung) provide better area-delay trade-offs.

4. Subtractors & 2's Complement Logic

A Full Subtractor computes A − B − Borrowin, producing a Difference and Borrowout:

Diff (D) = A ⊕ B ⊕ Bin
Borrowout = A'·B + (A⊕B)'·Bin

In practice, hardware designers never build separate subtractors. Instead, modern ALUs perform subtraction by adding the 2's complement of the subtrahend: A − B = A + (B' + 1). This reuses the same adder hardware with just an XOR inversion stage and carrying in a '1'. A single N-bit adder with a "subtract mode" control performs both addition and subtraction — saving millions of transistors.

BCD Adder

When adding BCD-encoded decimals, the result must stay in range 0000–1001. If the 4-bit sum exceeds 9 (or produces a carry), add 6 (0110) as a correction factor to skip the invalid hex digits (A–F). BCD adders are used in calculators and financial ASICs requiring exact decimal representation.

5. Multiplexers (MUX) — Data Selectors

A multiplexer connects one of 2n data inputs to a single output based on n selection lines. It is the fundamental data-routing element in digital systems.

S1S0Output YActive Input
00D0D0 → Y
01D1D1 → Y
10D2D2 → Y
11D3D3 → Y

The Boolean expression for a 4-to-1 MUX: Y = S1'·S0'·D0 + S1'·S0·D1 + S1·S0'·D2 + S1·S0·D3

MUX as Universal Logic: Any Boolean function of N variables can be implemented using a 2N−1-to-1 MUX by connecting variables to selection lines and the last variable (or constants) to data inputs. FPGAs use this principle — each LUT is a glorified MUX tree. A 6-input LUT is a 64-to-1 MUX with all inputs programmable.

Cascading MUXes

A 16-to-1 MUX can be built from four 4-to-1 MUXes (first level) and one 4-to-1 MUX (second level). This tree structure reduces interconnect complexity and is easier to time than a single flat MUX implementation.

6. Demultiplexers (DEMUX)

A DEMUX performs the inverse of MUX: one input is routed to one of 2n outputs based on selection lines. Also called a Data Distributor. The unselected outputs remain at logic 0.

If the single data input is held constant at logic 1, the DEMUX behaves identically to a Decoder — activating exactly one output line. This dual use makes DEMUX/decoder cells interchangeable in many MSI designs.

Applications: Time-division multiplexing demultiplexing, memory bank selection, serial-to-parallel conversion, output port expansion in microcontrollers.

7. Decoders — Addressing & Translation

An N-to-2N decoder takes an N-bit binary input and activates exactly one of 2N output lines. The activated output corresponds to the binary number at the input. All other outputs remain LOW.

A1A0Y0Y1Y2Y3
001000
010100
100010
110001

Memory Chip Select

A 10-to-1024 decoder enables individual rows in a DRAM memory array. The 10-bit row address activates exactly one of 1024 word lines. This is the fundamental addressing mechanism in every RAM chip — the decoder translates your binary address into a physical row/column activation.

Seven-Segment Decoder

A specialized decoder converting 4-bit BCD input to 7 output segments (a–g) controlling an LED display. Each output requires a separate K-Map simplification, yielding 7 distinct combinational logic functions. This is a classic examination problem in digital design courses and real hardware in every embedded display.

8. Encoders & Priority Encoders

An encoder is the inverse of a decoder: 2N inputs → N-bit binary output. It assumes only one input is active at a time. If multiple inputs are simultaneously active, the output is undefined — which is why the Priority Encoder was invented.

D3D2D1D0A1A0Valid
1XXX111
01XX101
001X011
0001001
0000XX0

X = Don't Care (can be 0 or 1). The priority encoder outputs the binary code of the highest-priority active input (highest bit index), along with a Valid flag indicating any input is active.

Interrupt Controller: The 8259A PIC (Programmable Interrupt Controller) used in x86 systems is essentially a priority encoder with masking registers. When multiple devices assert interrupt lines simultaneously, the PIC selects the highest-priority one and signals the CPU. This mechanism is still present in modern APIC (Advanced PIC) systems.

9. Magnitude Comparators

A magnitude comparator determines the relationship between two N-bit binary numbers A and B, producing three outputs: A>B, A=B, A<B. For a 1-bit comparator:

  • A = B: A XNOR B (true when bits are identical)
  • A > B: A AND NOT B
  • A < B: NOT A AND B

For N-bit comparison, start from the MSB and work down. The MSB difference determines the result for most significant pairs; only if MSBs are equal do we check lower bits. This hierarchical comparison is how high-speed comparators are built in silicon.

Applications: Branch prediction (conditional jumps in CPUs compare register values), cache tag matching, priority arbitration in bus controllers, sorting hardware in network switches.

10. Code Converters

Binary to Grey Code

The MSB of Grey code equals the MSB of binary. Each subsequent Grey bit = current binary bit XOR previous binary bit: Gi = Bi ⊕ Bi+1. No simplification needed — this is an exact formula implementable with XOR gates only.

Grey Code to Binary

Inverse conversion: MSB of binary = MSB of Grey. Each subsequent binary bit = current Grey bit XOR previous binary bit: Bi = Gi ⊕ Bi+1. Note this is sequential in nature — each bit depends on the previous, creating a propagation chain.

BCD to Excess-3

Add 3 (binary 0011) to each BCD nibble. Since BCD digits range 0–9 (0000–1001), adding 0011 gives 0011–1100 (Excess-3 range). This is a pure combinational addition, implementable with a 4-bit adder with one input hard-wired to 0011.

11. Timing Hazards & Glitch Analysis

When input signals transition, they travel through different paths with different propagation delays. If a gate receives inputs that should logically produce a stable output but haven't all arrived yet, it may briefly output an incorrect value — called a glitch or hazard.

Static-1 Hazard

The output should remain at 1 during a transition but briefly drops to 0. Occurs when switching between adjacent minterms that share a K-Map group but the covering term was eliminated during minimization. Fix: add the consensus term — the prime implicant that covers both adjacent minterms, even if logically redundant.

Static-0 Hazard

Output should remain at 0 but briefly rises to 1. Fix in the dual (POS) form — add redundant product terms to cover all K-Map transitions.

Power Impact: Glitches in low-power digital design account for up to 30% of dynamic power consumption. Every unwanted transition charges and discharges gate capacitances, wasting energy. Glitch-free design is not just about correctness — it's critical for battery life in mobile chips and thermal management in data centers.

12. Advanced Engineering FAQ

What is the difference between a Decoder and a Demultiplexer?

Logically similar but functionally distinct. A decoder takes N inputs and activates one of 2N outputs — it translates a binary code. A DEMUX takes 1 data signal and routes it to one of 2N outputs — it distributes data. Setting the data input of a DEMUX to constant 1 makes it functionally identical to a decoder.

Why does Grey Code matter in combinational circuits?

Standard binary transitions like 011→100 flip 3 bits simultaneously. In physical gates, these bits don't switch at exactly the same instant — the brief intermediate states (010, 110, etc.) appear as transient wrong values. Grey Code (010→110) flips only 1 bit per transition, eliminating these spurious intermediate states. Critical in shaft encoders and FSM state encoding.

What are "Don't Care" conditions and how do they help?

Don't Care (d or X) input combinations are those that either can never occur (invalid codes) or whose output doesn't matter. In K-Map minimization, we freely choose d conditions as 0 or 1 to create larger groupings, reducing the number of gates required. More gates = more power, more area, more propagation delay.

How does a MUX implement any Boolean function?

For an N-variable function, use a 2N−1-to-1 MUX with N−1 variables on the selection lines. For each of the 2N−1 combinations of the selection variables, the corresponding data input is connected to the N-th variable, its complement, 0, or 1 — determined by the truth table. This is called Shannon expansion (or Shannon decomposition).

What is a Critical Path in combinational design?

The longest delay path from any input to any output, determining the maximum operating frequency when placed between register stages. Timing closure in chip design means ensuring all combinational paths complete within the clock period minus setup time. Static Timing Analysis (STA) tools like PrimeTime enumerate millions of paths to find violations.

Interactive Lab

Combinational Circuit Simulator — 3 Tools

4-to-1 MUX · Full Adder · 2-to-4 Decoder

Toggle data inputs D0–D3 and selection lines S1, S0. The selected input is routed to output Y.

D0
0
D1
0
D2
0
D3
0
S1
0
S0
0
ACTIVE INPUT: D0
0
Output Y

Toggle A, B, and Cin to see the Full Adder compute Sum and Carry with step-by-step logic.

A
0
B
0
Cin
0
0
Sum (S)
0
Carry (Cout)

Toggle address bits A1 and A0. Exactly one output Y0–Y3 goes HIGH, corresponding to the binary address.

A1 (MSB)
0
A0 (LSB)
0
Address:
00
= 0
Y0 (addr=00)
1
Y1 (addr=01)
0
Y2 (addr=10)
0
Y3 (addr=11)
0
← Logic Gates Flip-Flops →

Related VLSI Topics

FSM Design
Combinational output logic is the foundation of FSM next-state and output functions — see how adders, muxes, and encoders are wired together inside state machines.
RTL Design Techniques
Adders, multiplexers, and decoders at RTL level — how synthesis tools map combinational circuit blocks to standard cell libraries and optimize for timing and area.
Critical Path Analysis
Combinational logic depth directly determines the critical path — see how STA traces arrival times through adders, muxes, and comparators to find the slowest path.