Skip to content
Ahmet Çelik

Chapter 3: Gate-Level Minimization

ELEC205 8 minute read

Source files used: ELEC205 Week 3 slides (slides 40-60), Week 4 slides, Week 5 slides (slides 1-15); textbook Chapter 3 as support. No worked examples are included.

1. Big Picture

Chapter 3 is about making a circuit as cheap as possible.

Chapter 2 asked: how do we turn any truth table into gates? Chapter 3 asks: how do we get the cheapest two-level circuit for it?

Find a minimum-cost SOP or POS for F, then count its cost.\boxed{\text{Find a minimum-cost SOP or POS for }F\text{, then count its cost.}}

New ideas in this chapter:

  • cost measures: literal cost LL, gate input cost GG and GNGN,
  • Karnaugh maps (K-maps) for 2, 3, 4 and 5 variables,
  • prime implicants and essential prime implicants,
  • the optimization algorithm and the selection rule,
  • POS simplification from the 0’s,
  • don’t-care conditions.

Erzin’s exam-style K-map questions use four steps: find all prime implicants, identify the essential ones, find the optimal SOP (or POS), compute GG.


2. Core Ideas

2.1 Optimization Needs a Cost

Simplification is informal. Optimization uses a fixed procedure and a cost criterion. The course minimizes the gate input cost of a set of Boolean equations. Two-level SOP and POS circuits give optimum or near-optimum cost.


2.2 Algebraic Simplification

Repeatedly apply XY+XY′=XXY+XY'=X to pairs of minterms that differ in one variable. It works, but it is easy to miss pairs and there is no clear stopping point. The K-map makes those pairs visible.


2.3 What a K-Map Is

  • Each square is one minterm.
  • Adjacent squares differ in exactly one variable.
  • It is a reorganized truth table (also a “warped” Venn diagram).
  • Rows and columns follow Gray code order (00, 01, 11, 10), so neighbors differ by one bit.
  • The map wraps around: left edge touches right edge, top touches bottom (cylinder/torus).

Useful only for small numbers of variables; CAD tools handle larger problems.


2.4 Groups (Rectangles)

A group is a rectangle of 1’s whose size is a power of 2. Each doubling removes one variable. Rectangles may wrap across the edges, and the four corners of a 4-variable map are one valid group.

Inside a group, a variable that stays constant is kept (1 → plain, 0 → complemented). A variable that takes both values disappears.


2.5 Prime and Essential Prime Implicants

  • Implicant: a product term that covers only 1’s (and don’t-cares).
  • Prime implicant (PI): a group that cannot be made any larger.
  • Essential prime implicant (EPI): a PI that covers at least one minterm that no other PI covers.

Every EPI must be in the final answer.


2.6 Don’t-Care Conditions

Sometimes an input combination never occurs (e.g., BCD codes 1010-1111) or its output is never used. Its output is marked “x” (don’t care) and written as d(… )d(\dots).

Treat each x as a 1 if it makes a group bigger, otherwise as a 0. You never need to cover an x.


3. Main Governing Equations and Formulas

3.1 Literal Cost LL

L=number of literal appearances in the expressionL=\text{number of literal appearances in the expression}

Examples from the slides: F=BD+AB′C+AC′D′F=BD+AB'C+AC'D' has L=8L=8; F=(A+B)(A+D)(B+C+D′)(B′+C′+D)F=(A+B)(A+D)(B+C+D')(B'+C'+D) has L=10L=10.


3.2 Gate Input Cost GG and GNGN

For SOP or POS:

G=L+(number of terms, excluding single-literal terms)G=L+(\text{number of terms, excluding single-literal terms}) GN=G+(number of distinct complemented single literals)GN=G+(\text{number of distinct complemented single literals})

GG counts all gate inputs except inverters; GNGN also counts inverter inputs.

Examples:

F=BD+AB′C+AC′D′:L=8, G=11, GN=14F=BD+AB'C+AC'D':\quad L=8,\ G=11,\ GN=14 F=A+BC+B′C′:L=5, G=7, GN=9F=A+BC+B'C':\quad L=5,\ G=7,\ GN=9

In the second one, AA is a single-literal term, so it is not counted again; only BCBC and B′C′B'C' add an OR input each. GNGN adds the inverters for B′B' and C′C'.

Use GG as the course’s default cost unless a question asks for LL or GNGN.


3.3 K-Map Cell Layout

Three variables (rows xx, columns yzyz in Gray order):

x\yz000111100m0m1m3m21m4m5m7m6\begin{array}{c|cccc} x\backslash yz & 00 & 01 & 11 & 10\\ \hline 0 & m_0 & m_1 & m_3 & m_2\\ 1 & m_4 & m_5 & m_7 & m_6 \end{array}

Four variables (rows ABAB, columns CDCD):

AB\CD00011110000132014576111213151410891110\begin{array}{c|cccc} AB\backslash CD & 00 & 01 & 11 & 10\\ \hline 00 & 0 & 1 & 3 & 2\\ 01 & 4 & 5 & 7 & 6\\ 11 & 12 & 13 & 15 & 14\\ 10 & 8 & 9 & 11 & 10 \end{array}

Memorize these index positions. Notice columns 3 and 2 (and rows 11 and 10) are swapped relative to counting order.


3.4 Group Size vs Literals

group of 2k cells in an n-variable map ⇒ product term with n−k literals\text{group of }2^k\text{ cells in an }n\text{-variable map}\ \Rightarrow\ \text{product term with }n-k\text{ literals}
  • 3-variable map: 1 cell = 3 literals, 2 cells = 2, 4 cells = 1, 8 cells = constant 1.
  • 4-variable map: 1 cell = 4 literals, 2 = 3, 4 = 2, 8 = 1, 16 = constant 1.

Use to sanity-check every term you read off a map.


3.5 Five-Variable Maps

Split on the first variable with the Shannon expansion:

F(V,W,X,Y,Z)=V′⋅F(0,W,X,Y,Z)+V⋅F(1,W,X,Y,Z)F(V,W,X,Y,Z)=V'\cdot F(0,W,X,Y,Z)+V\cdot F(1,W,X,Y,Z)

Draw two 4-variable maps, one for V=0V=0 and one for V=1V=1. Group inside each map; per the textbook, cells in the same position in the two maps are also adjacent, and a group covering both maps drops VV.


3.6 POS Simplification

F′=SOP from grouping the 0’s⇒F=(F′)′=POS via DeMorganF'=\text{SOP from grouping the 0's}\qquad\Rightarrow\qquad F=(F')'=\text{POS via DeMorgan}

The slide procedure (for a NOR-only implementation):

  1. Write F′F' as a minimum sum of products (group the 0’s).
  2. Complement F′F'.
  3. Write FF as a product of sums.

4. Problem-Solving Workflow

4.1 Minimum SOP with a K-Map

  1. Plot a 1 for each minterm (and x for each don’t-care). Leave the rest blank (0).
  2. Find all prime implicants: circle the largest possible power-of-2 rectangles, checking edge wrap and corners.
  3. Mark the essential PIs: look for 1’s covered by only one PI.
  4. Include every essential PI.
  5. Cover the remaining 1’s with a minimum-cost set of the other PIs, following the selection rule (Section 5.2).
  6. Read off one product term per group.
  7. Compute LL, GG (and GNGN if asked).

4.2 Minimum POS

  1. Plot the function; mark the 0’s (cells not in the minterm list and not don’t-cares).
  2. Group the 0’s exactly as in Section 4.1 to get a minimum SOP for F′F'.
  3. Apply DeMorgan: each product term of F′F' becomes a sum term of FF with every literal complemented.
  4. Count the cost. Compare with the SOP if the question asks which is cheaper.

4.3 With Don’t-Cares

  1. Enter the x’s from d(… )d(\dots).
  2. Use x’s only to enlarge groups of 1’s (SOP) or of 0’s (POS).
  3. Never create a group made only of x’s.
  4. Essential PIs are decided by the real 1’s only.

5. Decision Rules / Decision Trees

5.1 Reading a Variable from a Group

Variable is 1 across the whole group? → include the variable

Variable is 0 across the whole group? → include its complement

Variable is both 0 and 1 inside the group? → drop it

5.2 Selection Rule (Non-Essential PIs)

A 1 is covered by only one PI? → that PI is essential, take it

All remaining 1’s are covered by several PIs? → pick PIs that minimize overlap → every selected PI must cover at least one minterm no other selected PI covers → among equal choices, prefer larger groups (fewer literals)

5.3 SOP or POS?

Asked for “optimal SoP”? → group the 1’s

Asked for “optimal PoS” or NOR-only? → group the 0’s for F′F', then DeMorgan

Asked which is cheaper? → do both, compare GG

5.4 Don’t-Care Usage

An x lets a group double in size? → treat it as 1

An x is not needed for any group? → leave it out (treat as 0)


6. Important Tables / Correlations Needed

6.1 Cost Quick Reference

MeasureCounts
LLevery literal appearance
GGLL + one input per multi-literal term at the second-level gate
GNGNGG + one inverter input per distinct complemented literal

6.2 Common Group Shapes

MapShapeResult
3-varfull row of 41 literal (xx or x′x')
3-var2x2 square, incl. wrap columns 00 and 101 literal (z′z')
4-varfour corners (0, 2, 8, 10)B′D′B'D'
4-varfull row or column2 literals
4-varouter columns 00 and 10D′D'

6.3 Slide Functions Worth Recognizing

FunctionNote
F=∑m(2,3,5,7,11,13)F=\sum m(2,3,5,7,11,13)4-bit prime detector; minimum SOP has four 3-literal terms, G=12+4=16G=12+4=16
F=∑m(2,3,5,7)F=\sum m(2,3,5,7), d=∑m(10,…,15)d=\sum m(10,\dots,15)BCD prime detector; don’t-cares shrink it to A2′A1+A2A0A_2'A_1+A_2A_0
BCD inputscodes 1010-1111 are always don’t-cares

The prime detector shows why don’t-cares matter: the same primes with the unused codes free drop from G=16G=16 to G=6G=6.


7. Key Takeaways

  • The course cost is GG = literals + inputs to the second-level gate (single-literal terms not double-counted); GNGN adds inverters.
  • K-map rows and columns use Gray order 00, 01, 11, 10; know where every minterm index sits.
  • Groups are rectangles of size 2k2^k; each doubling removes one variable.
  • Edges wrap; the four corners of a 4-variable map form one group.
  • Prime implicant = largest possible group; essential = only PI covering some 1.
  • Algorithm: all PIs, then all EPIs, then the fewest extra PIs (minimum overlap).
  • POS: group the 0’s to get F′F', then DeMorgan.
  • Don’t-cares are used only if they enlarge a group; never cover an x on its own.
  • Five variables: two 4-variable maps split on VV (Shannon expansion).
  • Trap: missing a wrap-around or corner group gives a correct but non-minimal answer.