CA-12: Combinational & Sequential Logic — VLSI Trainers
⌂ Home / CA Series
Computer Architecture · Article 12 of 12

CA-12: Combinational & Sequential Logic

How digital systems are built from logic gates — AND, OR, NOT, NAND, NOR, XOR. The 6-step combinational design procedure. Half-adder, full-adder, half-subtractor, and full-subtractor circuits. NAND as a universal gate. Sequential circuits and flip-flops — the memory elements that store state.

Combinational vs Sequential Circuits

All digital logic circuits fall into one of two fundamental categories:

COMBINATIONAL CIRCUIT
  • Output depends only on current inputs
  • No memory — no feedback paths
  • Output changes immediately when input changes (after propagation delay)
  • Described by Boolean functions
  • Examples: adders, subtractors, multiplexers, decoders, encoders, ALU
SEQUENTIAL CIRCUIT
  • Output depends on current inputs and past history (state)
  • Contains memory elements (flip-flops)
  • Has feedback paths — output feeds back to input
  • Described by state machines (state table + state diagram)
  • Examples: registers, counters, FSMs, CPUs, RAM, shift registers
The fundamental distinction: A combinational circuit is a pure function — same inputs always produce the same outputs, immediately. A sequential circuit has state — it remembers past events. A CPU is a sequential circuit: the current instruction cycle output depends on the current instruction (input) and the contents of all registers and flags (state from previous cycles).

🔌Logic Gates — The Building Blocks

Every digital system — from a half-adder to a billion-transistor CPU — is built from a small set of basic logic gates. Each gate implements one Boolean operation:

Figure 1 — The six fundamental logic gates: symbol, Boolean expression, and description
AND Gate A B Y Y = A · B High only when ALL inputs are high OR Gate A B Y Y = A + B High when ANY input is high NOT Gate (Inverter) A Y Y = A’ Output always complement of input NAND Gate A B Y Y = (A·B)’ High unless ALL inputs are high NOR Gate A B Y Y = (A+B)’ Low if ANY input is high EXOR Gate A B Y Y = A ⊕ B High when inputs DIFFER (odd parity) Universal Gates — NAND and NOR NAND and NOR are called universal gates — any Boolean function can be implemented using ONLY NAND gates or ONLY NOR gates. NAND → NOT: (A·A)’ = A’ Tie both inputs to A NAND → AND: ((AB)’)’ = AB NAND followed by NOT-NAND NAND → OR: (A’·B’)’ = A+B Invert both inputs, then NAND (De Morgan) Since NOT, AND, OR can all be built from NAND gates, NAND alone suffices for any digital circuit. vlsitrainers.com

The six fundamental logic gates. AND, OR, NOT are the primary gates from which all Boolean functions can be built. NAND = NOT-AND (bubble on output of AND), NOR = NOT-OR (bubble on output of OR). XOR (exclusive-OR) outputs 1 only when inputs differ — it is the basis of binary addition. NAND and NOR are universal: any circuit can be built using only one gate type.

📋Gate Truth Tables

A truth table enumerates every possible input combination and the resulting output. For n inputs there are 2ⁿ rows:

Figure 2 — Truth tables for all six gates (2-input where applicable)
A B AND OR NOT A NAND NOR XOR 0 0 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 1 1 1 1 ← 1 0 0 ← 0 0 NOT only has 1 input ← AND=1 only here vlsitrainers.com

Truth tables for all six gates with 2-input configurations (NOT only uses input A). AND outputs 1 only when both inputs are 1. OR outputs 1 when either or both inputs are 1. XOR outputs 1 only when exactly one input is 1. NAND and NOR are the complement of AND and OR respectively. The NOT column ignores B.

📐Combinational Circuit Design Procedure

The systematic 6-step procedure for designing any combinational circuit from a verbal problem statement:

  1. State the problem clearly. Understand exactly what transformation is needed — what the inputs mean and what the outputs must produce.
  2. Determine the number of input and output variables. Count how many input bits describe each possible input case and how many output bits are required.
  3. Assign letter symbols to all input and output variables.
  4. Derive the truth table. List all 2ⁿ possible input combinations. For each, determine the correct output value. Don’t-care inputs (inputs that will never occur) may be marked X for later optimisation.
  5. Simplify the Boolean function for each output using algebraic manipulation, Karnaugh map (K-map), or tabulation. The goal is to minimise gates and propagation delay.
  6. Draw the logic diagram. Implement the simplified Boolean expressions with gates.
Design constraints to consider in step 5: (1) Minimum number of gates, (2) minimum number of gate inputs, (3) minimum signal propagation time (critical for speed), (4) minimum number of interconnections, (5) fan-out limitations (how many inputs one gate output can drive). These constraints often conflict — a faster design may require more gates. The design context (power-limited mobile vs performance server) determines which constraints dominate.

½Half-Adder

A half-adder is a combinational circuit that adds two single bits and produces a 2-bit result (sum + carry). It is the simplest arithmetic circuit:

Inputs: x (augend), y (addend).   Outputs: S (sum bit), C (carry out).

Truth table and Boolean expressions

xyC (carry)S (sum)
0000
0101
1001
1110

From the truth table, by inspection:

S = x’y + xy’ = x ⊕ y    C = xy

S is the XOR of x and y. C is the AND of x and y. The most compact implementation uses one XOR gate and one AND gate.

Figure 3 — Half-adder (left) and full-adder built from two half-adders + OR gate (right)
Half-Adder: S = x ⊕ y, C = x · y x y S (sum) XOR C (carry) AND Full-Adder: HA₁ + HA₂ + OR gate x y z Half-Adder 1 S₁ = x⊕y · C₁ = xy inputs: x, y S₁ C₁ z Half-Adder 2 S = S₁⊕z · C₂ = S₁·z inputs: S₁, z S (sum out) C₂ Cout OR S = x⊕y⊕z Cout = xy + z(x⊕y) vlsitrainers.com

Half-adder (left): XOR gate produces sum S = x⊕y; AND gate produces carry C = xy. The minimal 2-gate circuit. Full-adder (right): built from two half-adders and an OR gate. The first half-adder computes S₁=x⊕y and C₁=xy. The second adds S₁ with the incoming carry-in z, producing the final sum S=S₁⊕z and partial carry C₂=S₁·z. The final carry-out is C₁ OR C₂.

Full-Adder — Truth Table & Equations

A full-adder adds three bits: x (augend), y (addend), z (carry-in from previous stage). Two outputs: S (sum), C (carry-out). This is the building block for ripple-carry adders — chain n full-adders to add n-bit numbers.

xyz (Cᵢₙ)C (carry-out)S (sum)
00000
00101
01001
01110
10001
10110
11010
11111

S = 1 when an odd number of inputs are 1 (1 or 3 inputs = 1). C = 1 when two or more inputs are 1.

Simplified Boolean expressions:

S = x’y’z + x’yz’ + xy’z’ + xyz

C = xy + xz + yz

Critical observation: S in the full-adder is identical in structure to the XOR of three inputs: S = x ⊕ y ⊕ z. The carry-out C has a simple interpretation: carry-out is 1 whenever any two or more of the three inputs are 1 — each term in C = xy + xz + yz is a “majority” pair. This insight leads to the efficient two-half-adder implementation shown in Figure 3.

½Half-Subtractor

A half-subtractor computes x − y, producing a difference D and a borrow B. When x < y (0 − 1), the circuit borrows from the next higher stage:

x (minuend)y (subtrahend)B (borrow)D (difference)
0000
0111
1001
1100

Boolean expressions:

D = x’y + xy’ = x ⊕ y    (same logic as S in half-adder!)

B = x’y    (borrow only when x=0 and y=1)

Note the symmetry: D = x ⊕ y is identical to S in the half-adder. The only difference is the carry/borrow output: C = xy (AND) in the half-adder, but B = x’y (AND of inverted x with y) in the half-subtractor.

Full-Subtractor

A full-subtractor computes x − y − z, where z is the borrow-in from a lower-significance stage. Three inputs, two outputs (D and borrow-out B):

xyz (Bᵢₙ)B (borrow-out)D (difference)
00000
00111
01011
01110
10001
10100
11000
11111

Boolean expressions:

D = x’y’z + x’yz’ + xy’z’ + xyz   (same as S in full-adder)

B = x’y + x’z + yz

Adder–subtractor duality: D in the full-subtractor is identical to S in the full-adder. Borrow B = x’y + x’z + yz resembles C = xy + xz + yz in the full-adder — except that x is complemented in each term. Therefore, a full-adder can be converted to a full-subtractor simply by complementing input x before it enters the carry-output logic. This is why the hardware adder-subtractor circuit from CA-11 works — it only needs to complement the B operand.

🌐NAND — The Universal Gate

NAND (and NOR) are called universal gates because any Boolean function can be implemented using only NAND gates (or only NOR gates). This is practically important: NAND gates are the most efficient gate to fabricate in CMOS technology — modern standard cell libraries are built primarily from NAND gates.

Figure 4 — NAND gate implementing NOT, AND, and OR (De Morgan)
NAND → NOT Tie both inputs to same signal A A A’ (A · A)’ = A’ 1 NAND + tied inputs = inverter NAND → AND NAND then invert output (another NAND tied) A B AB ((AB)’)’ = AB 2 NAND gates = AND NAND → OR Invert each input, then NAND — (A’·B’)’ = A+B A B A+B (A’·B’)’ = A+B De Morgan’s theorem ✓ · 3 NAND gates = OR vlsitrainers.com

NAND gate implementing the three primary operations. NOT: tie both inputs together → output = (A·A)’ = A’. AND: NAND followed by a NOT (another tied-input NAND) → ((AB)’)’ = AB. OR: invert both inputs with NOT-NANDs, then feed to a NAND → (A’·B’)’ = A+B by De Morgan’s theorem. Since NOT, AND, and OR can all be built from NAND gates, NAND alone can implement any Boolean function.

🔁Code Conversion Example — BCD to Excess-3

Code conversion is a classic combinational design problem. BCD (Binary Coded Decimal) represents decimal digits 0–9 using 4 bits. Excess-3 represents the same digits by adding 3 to each BCD value. A converter is needed when two systems using different codes must communicate:

🔍 Worked Example — BCD to Excess-3 Code Converter Design

Inputs: A, B, C, D (4-bit BCD, 0–9)    Outputs: w, x, y, z (4-bit Excess-3)

Key entries from truth table (excerpt):

DecimalBCD (ABCD)Excess-3 (wxyz)
000000011
100010100
401000111
701111010
910011100

Don’t-care inputs: BCD combinations 1010–1111 (10–15) never occur in valid BCD → treat as don’t-cares (X) in K-map for simplification.

Simplified Boolean expressions (after K-map with don’t-cares):

z = D’
y = CD + C’D’ = CD + (C+D)’
x = B’C + B’D + BC’D’ = B'(C+D) + B(C+D)’
w = A + BC + BD = A + B(C+D)

Key insight: The OR gate producing C+D is shared by expressions for x and w — this is multi-output optimisation. The shared gate reduces total gate count from 7 AND + 3 OR (sum of products) to 4 AND + 4 OR + 1 NOT. Don’t-care conditions reduced the complexity by allowing the K-map to form larger groupings.

💾Sequential Circuits & Flip-Flops

Sequential circuits add memory to combinational logic. The fundamental memory element is a flip-flop — a bistable circuit that stores one bit indefinitely, changing state only in response to a clock edge and control inputs.

Figure 5 — Sequential circuit structure (left) and SR NAND latch (right)
Sequential Circuit Structure Combinational Logic Memory (flip-flops) Inputs Outputs Next state Current state Clock SR NAND Latch — Cross-coupled S’ Q R’ Q→ Q̄→ SR Latch Truth Table (active-LOW inputs) S’=1, R’=1 → Hold    S’=0, R’=1 → Set Q=1 S’=1, R’=0 → Reset Q=0    S’=0, R’=0 → Forbidden ⚠ D flip-flop prevents forbidden state by keeping S’ and R’ always complementary vlsitrainers.com

Sequential circuit structure (left): outputs depend on both current inputs and stored state. The memory block feeds back current state to the combinational logic; the clock synchronises updates. SR NAND latch (right): two cross-coupled NAND gates. The Q output wire (green) taps mid-wire and routes back down through the feedback path to NAND2’s top input. The Q̄ output wire (red) taps mid-wire and routes back up to NAND1’s bottom input. S’=0 sets Q=1; R’=0 resets Q=0; both at 1 holds state; both at 0 is forbidden.

Flip-flop types

Flip-flopInputsBehaviourPrimary use
SR (Set-Reset)S, RSet Q=1 (S=1), Reset Q=0 (R=1), Hold (S=R=0). Forbidden: S=R=1Debouncing switches, basic latches
D (Data)DOn clock edge: Q ← D. The simplest clocked flip-flop — no forbidden stateRegisters, pipeline stages, shift registers
JKJ, KJ=K=0: hold · J=1,K=0: set · J=0,K=1: reset · J=K=1: toggle (Q̄)Counters, frequency dividers
T (Toggle)TT=0: hold · T=1: toggle (Q ← Q̄). Derived from JK with J=K=TBinary counters — each stage divides frequency by 2
D flip-flop — the universal register element: Modern digital design almost exclusively uses edge-triggered D flip-flops. A register file is an array of D flip-flops. A pipeline register is a bank of D flip-flops capturing the output of one stage on each clock edge and holding it stable for the next stage. The SRAM bit cell (CA-06) is a 6-transistor SR latch. The entire state of a CPU — every register, every flag, every pipeline register — is held in D flip-flops clocked by the system clock.

🔬VLSI Connections

🔬 Standard cell library — NAND-centric implementation

Every CMOS standard cell library (TSMC, Samsung, GF, Intel) is built primarily around NAND and NOR gates because they are the most area and power efficient gates in CMOS. A NAND2 cell in 7nm TSMC typically measures ~0.04 µm² and switches in ~15 ps. When you synthesise RTL with Design Compiler or Genus, the tool maps your Boolean logic to this library. The synthesis tool applies De Morgan transformations, logic restructuring, and technology mapping to convert arbitrary Boolean expressions into networks of NAND, NOR, INV, and complex cells (AOI/OAI — AND-OR-INVERT). Understanding that NAND is universal is what lets synthesis tools take any combinational logic and implement it efficiently — the 6-step design procedure you learned here is exactly what synthesis tools automate at scale.

🔬 Ripple-carry adder vs carry-lookahead in RTL timing closure

A 32-bit ripple-carry adder chains 32 full-adders — the carry must ripple through all 32 stages before the output is valid. With each full-adder stage adding ~200 ps of carry propagation, a 32-bit ripple-carry adder has a critical path of ~6.4 ns — far too slow for modern GHz operation. The carry-lookahead adder (CLA) computes generate (G = A·B) and propagate (P = A⊕B) signals for every bit position in parallel, then computes all carry-outs simultaneously in a two-level logic network — reducing the critical path to ~1 ns. The full-adder’s Boolean equations (S = x⊕y⊕z, C = xy+xz+yz) are the starting point for deriving the G and P signals. When you work on timing closure for a 32×32-bit multiplier or a 64-bit ALU, reducing the adder critical path is often the most impactful optimisation — and it requires understanding the basic full-adder equations from this article.

🔬 Flip-flops in VLSI — setup time, hold time, and clock distribution

In physical design, every D flip-flop has three critical timing parameters: setup time (data must be stable this long before the clock edge — typically 50–200 ps), hold time (data must remain stable this long after the clock edge — typically 0–50 ps), and clock-to-Q delay (time from clock edge to valid output — typically 100–300 ps). Timing analysis (STA — Static Timing Analysis) checks every combinational path between flip-flop output and the next flip-flop input to ensure setup time is met. A hold time violation is worse than a setup time violation — setup violations are fixed by reducing clock frequency, but hold violations cause functional failures even at reduced frequency and require inserting delay buffers. The clock distribution network (H-tree or spine) that delivers the clock edge simultaneously to millions of flip-flops is one of the most power-intensive design challenges — clocks consume 30–40% of total dynamic power in a modern CPU. Understanding D flip-flop behaviour from first principles is the foundation of all sequential circuit design and physical timing closure work.

Summary — CA-12 key points: Combinational circuits: output depends only on current inputs, no memory, described by Boolean functions. Sequential circuits: output depends on inputs and past state (flip-flops), clock synchronises updates. Six logic gates: AND (all high → high), OR (any high → high), NOT (invert), NAND (NOT-AND, universal), NOR (NOT-OR, universal), XOR (inputs differ → high). 6-step combinational design procedure: state → variable count → symbols → truth table → Boolean simplification → logic diagram. Half-adder: S=x⊕y, C=xy (XOR+AND). Full-adder: S=x⊕y⊕z, C=xy+xz+yz (two half-adders + OR). Half-subtractor: D=x⊕y, B=x’y. Full-subtractor: D=x⊕y⊕z, B=x’y+x’z+yz. NAND is universal: any function can be built from NAND gates alone. Flip-flop types: SR (set/reset), D (data, edge-triggered), JK (set/reset/toggle), T (toggle). D flip-flops are the universal register element in all synchronous digital design.
🎉 Series complete! You have now studied all 12 articles of the Computer Architecture series — from historical context and Von Neumann architecture through buses, memory hierarchy, cache, virtual memory, I/O techniques, the ALU, integer and floating-point arithmetic, and the combinational and sequential logic that implements it all at the gate level. Every concept maps directly to the RTL and physical design work you will do as a VLSI engineer.
Scroll to Top