- Learn
- Engineering
- Electrical Engineering
- Digital Logic Design
- Gate-Level Minimization
Gate-Level Minimization
BeginnerLesson 2 of 7 in Digital Logic Design Course
What you will learn
- Place a function of two, three or four variables on a Karnaugh map, group adjacent 1s into rectangles, and read off a minimal sum-of-products expression by choosing prime implicants.
- Build and read two- and three-variable mapsSet up a Karnaugh map in Gray-code order, fill it from a truth table or minterm list, and turn groups of adjacent 1s into simplified product terms.
- Simplify four-variable functionsUse the 16-cell map, including its wraparound edges and corners, to find the largest possible groups of 1, 2, 4, 8 or 16 cells.
- Use prime implicants to find a minimal coverIdentify all prime implicants and the essential ones, then choose the fewest and largest groups so that every 1 is covered and no group is redundant.
- Build and read two- and three-variable maps
- Simplify a function by grouping its 0s, take advantage of input combinations whose output does not matter, and choose and check the cheaper minimal form.
- Simplify to a product of sumsGroup the 0s of a map to simplify the complement, then apply DeMorgan's theorem to write a minimal product-of-sums expression.
- Use don't-care conditionsMark input combinations whose output does not matter and treat each one as a 1 or a 0, whichever gives a simpler expression.
- Compare costs and verify a minimized designMeasure the cost of a two-level circuit, choose between the sum-of-products and product-of-sums forms, and confirm that a simplified expression matches its truth table.
- Simplify to a product of sums
- Build any function from NAND gates alone or NOR gates alone, convert two-level and multilevel AND-OR circuits into these forms by matching inversion bubbles, and read such circuits back as Boolean expressions.
- Use NAND and NOR as universal gatesExplain why NAND and NOR gates can each build any circuit, and use their alternative graphic symbols to reason about inversions.
- Build two-level NAND and NOR circuitsTurn a sum of products into a NAND-NAND circuit and a product of sums into a NOR-NOR circuit, and recognize the other two-level gate forms.
- Convert and analyze multilevel NAND and NOR circuitsConvert circuits with more than two levels of AND and OR gates into NAND-only or NOR-only form by placing and matching bubbles, and find the function of a given NAND or NOR circuit.
- Use NAND and NOR as universal gates
- Use the properties of XOR and XNOR, recognize odd and even functions on a map, and design parity generators and checkers for error detection.
- Apply exclusive-OR and equivalence propertiesDefine XOR and XNOR, use their identities, and recognize and implement odd and even functions.
- Generate and check parity bitsDesign even- and odd-parity generators and checkers with XOR gates and explain which transmission errors parity detects.
- Apply exclusive-OR and equivalence properties
Gate-Level Minimization study guide
1Read maps and choose a minimal cover
A truth table lists the required outputs; a Karnaugh map arranges them so useful combinations sit together. Begin with two- and three-variable maps, then use both wraparound directions in a four-variable map. Reading a group removes changing inputs, but choosing a minimal expression also requires deciding which groups are necessary. Prime and essential prime implicants make that choice systematic, even when several answers have the same cost.
1.1 Two- and three-variable maps
A Karnaugh map makes Boolean simplification visible. Each cell is one truth-table row, and neighboring cells differ in just one input. Grouping those cells removes inputs that no longer affect the result.
Boolean algebra reaches the same simplifications, but does not give a clear stopping signal by itself. A map shows which groups can still grow.
Put inputs in the right cells
A literal is a variable or its complement, such as or . A prime mark means NOT; an overbar means the same thing. Read minterm numbers as binary, with the first listed variable as the most significant bit. In , means 101, so its product is . A list such as marks the cells where the output is 1; all other cells are 0.
A two-variable map has rows and columns . Its top row contains minterms 0 and 1, and its bottom row contains 2 and 3. Three variables need eight cells. Keep on the rows and put across the columns in Gray-code order:
| 00 | 01 | 11 | 10 | |
|---|---|---|---|---|
| 0 | ||||
| 1 |
The order 00, 01, 11, 10 makes each change involve one bit. The first and last columns also differ in only one bit, so the map wraps from left to right. Binary column order would create false neighbors.
Turn a group into a term
A valid group is a rectangle of 1, 2, 4 or 8 cells containing only 1s. Rectangles may cross the wraparound edge. Diagonal cells and groups of three are invalid. For example, 000 and 011 differ in two inputs, so they cannot form a pair.
Adjacent minterms combine by the Boolean law . Keep each input that stays fixed throughout the group: use its plain form for a fixed 1 and its complemented form for a fixed 0. Omit every input that changes. A pair removes one variable, a group of four removes two, and all eight cells give the constant .
For , pair 2 with 3. Their inputs are 010 and 011, so and stay fixed: the term is . Pair 4 with 5 to get . Thus . Four three-literal minterms become two two-literal products.
Use edges and overlap
For , pair 3 with 7 to get . Pair 4 with 6 across the outer columns to get . The result is .
Larger groups can reuse cells. In , cells 0, 2, 4 and 6 form a wrapped group of four giving . Pair 4 with 5 to cover the remaining 1, giving . Cell 4 belongs to both groups; this is valid because repeating a covered 1 does not change the function. Even in a two-variable map, uses two pairs that share cell 3.
For a minimal SOP, first minimize the number of product terms, then minimize literals among expressions with that term count.
Key Takeaways
- Gray-code order keeps neighboring cells one bit apart, including the outer columns.
- A group keeps fixed inputs and removes changing inputs.
- Use rectangular power-of-two groups; overlap is allowed.
- Minimal SOP means fewest terms, then fewest literals.
1.2 Four-variable groups and wraparound
A four-variable map has 16 cells. It follows the same grouping rule as a smaller map, but both pairs of opposite edges are adjacent. This makes groups at the corners easy to miss.
Lay out all 16 inputs
For , put on the rows and on the columns. Use 00, 01, 11, 10 on both axes:
| 00 | 01 | 11 | 10 | |
|---|---|---|---|---|
| 00 | 0 | 1 | 3 | 2 |
| 01 | 4 | 5 | 7 | 6 |
| 11 | 12 | 13 | 15 | 14 |
| 10 | 8 | 9 | 11 | 10 |
The entries above are minterm numbers, not output values. Replace them with the function's 0s and 1s when filling a map. Each cell has four one-bit neighbors: left, right, above and below, with wraparound at an edge.
The four corners are minterms 0, 2, 8 and 10. Their binary inputs are 0000, 0010, 1000 and 1010. All have and ; and vary. A group containing these four corners gives . Opposite diagonal corners alone do not make a pair: 0000 and 1010 differ in two bits.
Choose rectangles that remove literals
The side lengths of a valid rectangle are 1, 2 or 4 cells, allowing groups of 1, 2, 4, 8 or 16. A row of four and a 2-by-2 block are both valid. The two outer columns together form a wrapped 2-by-4 rectangle. An L-shape or a six-cell block is invalid.
In an -variable map, cells leave literals. For four variables:
| Cells in group | Literals left |
|---|---|
| 1 | 4 |
| 2 | 3 |
| 4 | 2 |
| 8 | 1 |
| 16 | 0: the function is 1 |
Cover every 1 at least once, using large groups and as few groups as possible. Start with cells that have only one possible largest group. Overlap can enlarge a group without causing any conflict.
Work from a large group to the remaining cells
Consider . The eight cells in columns 00 and 01 all have , so they give . This leaves minterms 2, 6 and 14 uncovered.
Use cells 0, 2, 4 and 6: rows 00 and 01, across the outer columns. They keep and , giving . Next use 4, 6, 12 and 14, which keep and , giving . Therefore . The expression has five literals; the original 11 minterms contained 44.
A small group can be valid yet wasteful. For the four-corner function, pairing 0 with 2 gives , but expanding to all four corners removes too. After writing the expression, check a 0-cell as well as the 1s. In the worked example, input 0011 makes all three terms 0. A complete check evaluates all 16 inputs.
Key Takeaways
- Four-variable maps wrap horizontally and vertically.
- The four corners form a group, but opposite corners alone are not a pair.
- A group of eight leaves one literal; a group of four leaves two.
- Cover every 1 and expand groups where possible.
- Check that the final expression keeps specified 0s at 0.
1.3 Prime implicants and minimum covers
Finding large rectangles is only part of minimization. You must also choose which rectangles belong in the final expression. A group can be as large as possible and still be unnecessary.
Distinguish three kinds of group
An implicant is a product term that never outputs 1 at a 0-cell of the function. A prime implicant cannot be enlarged without including a 0. An essential prime implicant covers at least one 1 that no other prime implicant covers.
| Question about a group | What it tells you |
|---|---|
| Does it contain only 1s? | It is an implicant. |
| Can it grow while remaining valid? | If not, it is prime. |
| Is it the only prime group covering some 1? | It is essential. |
Every term in a minimal SOP is prime, and all essential prime implicants must be selected. Other primes are choices, not automatic additions.
Find a cover systematically
- Find every prime implicant, including overlapping and wrapped groups.
- For each 1, record the primes that cover it. A cell listed under only one prime forces that prime into the answer.
- Mark the cells covered by those essential primes.
- Cover the remaining 1s with the fewest additional primes. Break ties by literal count.
For , the six primes are:
| Prime | Cells covered |
|---|---|
| 5, 7, 13, 15 | |
| 0, 2, 8, 10 | |
| 3, 7, 11, 15 | |
| 2, 3, 10, 11 | |
| 9, 11, 13, 15 | |
| 8, 9, 10, 11 |
Only covers cell 5; only covers cell 0. Select both. Cells 3, 9 and 11 remain. Cell 3 needs or , while cell 9 needs or . No single prime covers both 3 and 9, so two more terms are necessary. Each of the four combinations covers cell 11 too. One answer is ; another is . All four minimal choices have four terms and eight literals.
Remove groups that add no coverage
For , cells 1, 6, 11 and 12 force the pairs , , and . These pairs already cover every 1, including all cells of the larger prime . Adding would increase cost without changing the function.
Redundancy also appears in the consensus theorem: . When , either activates or activates ; the extra term adds no new 1s.
Essential primes need not exist. For , all six primes are pairs and every 1 has two possible covers. The two minimal results are and . Each has three terms and six literals.
Key Takeaways
- Prime means a group cannot grow; essential means a specified 1 has no other prime cover.
- Select essential primes first, then cover the remaining 1s.
- A large prime can be redundant when selected groups already cover its cells.
- Minimal expressions can have equal cost without being identical.
- The consensus theorem removes a term that contributes no new 1s.
- Choosing every prime implicant usually adds unnecessary terms.
2Simplify with zeros and unrestricted inputs
The 1s of a function are only one route to a small circuit. Its 0s can produce a cheaper product of sums, and unused input combinations can enlarge useful groups. Work through both forms, keep required outputs separate from unrestricted ones, and compare gate inputs under the same convention. A complete truth-table, map or algebraic check then establishes that the saving has preserved every specified output.
2.1 Zero-groups and product-of-sums forms
Grouping 1s produces a sum of products. Grouping 0s gives another useful form: a product of sums, or POS. A POS is an AND of OR terms, so any one factor becoming 0 makes the whole output 0.
Read the zeros with the correct polarity
A maxterm contains every variable in a sum and equals 0 at exactly one input combination. The notation lists the 0s. For four variables, the other minterms are the 1s: .
Use the same rectangular power-of-two grouping rules for 0s as for 1s. First read each zero-group as a product describing where . Then complement the entire SOP with DeMorgan's theorem. Each product becomes a sum, each literal changes polarity, and the OR between products becomes AND between sums.
You can also read a zero-group directly:
| Fixed input in the group | Literal in the POS factor |
|---|---|
| 0 | Plain variable |
| 1 | Complemented variable |
| Changes | Omit the variable |
The polarity is reversed from grouping 1s because the sum factor must be 0 inside its group. A group fixed at gives : both literals are 0 there.
Derive both forms of one function
Take . Its 1-groups give . Now use the 0s:
- Cells 12, 13, 14 and 15 keep , so their product for is .
- Cells 3, 7, 11 and 15 keep , giving .
- Cells 4, 6, 12 and 14 keep , giving .
Therefore . Complement the whole expression:
The last factor contains plain because the zero-group fixed . Leaving it complemented would move the zeros to different inputs.
Check a one and a zero
At minterm 5, the inputs are 0101. The three factors become , and , so their product is 1. The SOP also gives 1 because .
At minterm 12, the inputs are 1100. The first factor is 0, so the whole POS is 0 without evaluating the remaining factors. A POS describes the function's 1s through conditions that must all hold, even though its factors were found by grouping 0s.
Keep the output name attached to the algebra: describes , not . Complementing literals alone is insufficient; AND and OR must also swap. The POS can be built with OR gates feeding AND, or converted to NOR gates feeding NOR. Its cost can differ from the SOP, so finding the simplest SOP does not settle which circuit to build.
Key Takeaways
- Group 0s to obtain a minimal SOP for the complement.
- DeMorgan changes products into sums and complements each literal.
- A fixed 0 gives a plain literal in a POS factor; a fixed 1 gives a complement.
- One zero factor makes the whole POS zero.
2.2 Don't-cares and simpler circuits
Some input combinations place no requirement on the output. These don't-care conditions can enlarge map groups, often removing literals that would otherwise be needed.
Decide which inputs truly do not matter
An input is a don't-care when it never occurs in the system or when the output is ignored for that input. Mark it X and list it separately from the required 1s and 0s. A BCD input represents a decimal digit with four bits: 0000 through 1001 represent 0 through 9. Codes 1010 through 1111 are unused BCD digit codes. In a circuit specified to receive valid BCD digits, those unused codes can be don't-cares.
An X is freedom to choose an output, not a third output value. The finished circuit still produces a definite 0 or 1 at every input. If an unused combination occurs, its output follows the expression you built.
Include an X only when it helps
For an SOP, combine required 1s with useful Xs, never with a required 0. Choose each X independently. No X needs coverage. A group containing only Xs contributes nothing to covering required 1s and is unnecessary. For a POS, combine required 0s with useful Xs, never with a required 1.
A prime group can contain 1s and Xs and must be as large as possible without including a 0. Essentiality still depends on required 1s: being the only group covering an X does not force a term into the answer.
Simplify a BCD decision
A BCD circuit outputs 1 for digits 5 through 9. With as the most significant bit, write . Mark digits 0 through 4 as required 0s.
Use the six Xs to expand groups:
- All eight cells with form a group, giving . Only cells 8 and 9 are required 1s; the others are Xs.
- Cells 5, 7, 13 and 15 give .
- Cells 6, 7, 14 and 15 give .
The result is , with five literals. If the six unused codes instead had to output 0, the minimal result would be , with nine literals. The saving comes from the missing output requirements, not from changing any specified digit's output.
Different choices can both be correct
For , cells 3, 7, 11 and 15 give the essential term . The remaining 1 at cell 1 can join 0, 2 and 3 to give , or join 3, 5 and 7 to give . Both results have two terms and four literals:
The first makes cells 0 and 2 high and cell 5 low; the second makes 0 and 2 low and 5 high. Both match every required output. Grouping 0s with Xs gives and hence , equivalent to the second SOP. Compare solutions on specified inputs; differing X outputs alone do not make one solution wrong.
Key Takeaways
- An X marks an input whose output is unrestricted.
- Use Xs to enlarge useful groups; they never require coverage.
- Essentiality is judged by required 1s, not by Xs.
- Use Xs with 0s for POS simplification.
- Two valid designs can disagree at don't-care inputs.
2.3 Circuit cost and complete verification
An expression can be correct without being economical. After minimizing, count its implementation cost under one convention and verify that every specified output is preserved.
Count literals and gate inputs separately
The literal count counts each variable occurrence, complemented or plain. The gate-input count adds the input pins used by all logic gates. Here both polarities of each input are available, so input inverters are excluded. A one-literal term or factor goes directly to the final gate.
For , the literal count is . Only the last two terms need AND gates: two inputs each. The final OR takes three inputs, so the gate-input count is . Counting an AND gate for would add a gate that is not needed.
Compare SOP and POS under the same rules
For , the minimal forms are:
| Form | Literals | Gate inputs |
|---|---|---|
| 7 | ||
| 6 |
The POS is cheaper by both measures. Another function may favor SOP, or the costs may tie. A three-input majority function is 1 when at least two inputs are 1. Its 1s are 3, 5, 6 and 7, giving . Grouping its 0s gives . Both forms have six literals and nine gate inputs.
Two-level minimization optimizes a chosen form. Factoring may reveal a cheaper implementation: . The expanded AND-OR circuit has 12 gate inputs; the OR-AND circuit has six. Both have two gate levels, so this saving does not require another level.
Prove that the function is preserved
A four-input function has 16 input rows. A few successful checks can expose some mistakes, but they do not establish equivalence. Use one complete method:
- Truth-table check: evaluate the expression on every specified input and compare the output. Skip don't-care rows because they have no required output.
- Map check: for SOP, put each product's 1-group on an empty map. The union must cover all required 1s and no required 0s. For POS, draw each factor's zero-group. Their union must cover all required 0s and no required 1s. Xs are optional in either check.
- Algebraic proof: transform one form into the other with valid Boolean laws. For example, follows by factoring out .
A specification written in words needs a truth table before these checks can begin. For majority, “at least two” includes 111 as well as 011, 101 and 110. Omitting 111 changes the required function. For the same reason, verify required zeros as carefully as required ones: an oversized group often looks correct on every 1 while accidentally covering a 0.
Key Takeaways
- Count literal occurrences and gate inputs as different cost measures.
- Use the same inverter convention for every design being compared.
- Single-literal terms feed the final gate directly.
- Compare minimal SOP and POS; either can be cheaper.
- Verify every specified row, the complete map coverage, or an algebraic equivalence.
- Factoring can reduce gate inputs without adding gate levels.
3Build and read NAND and NOR circuits
A circuit made from one gate type can still perform every Boolean operation. NAND and NOR achieve this through inversion, which must be tracked at each connection. Start with their equivalent bubble symbols, convert two-level expressions, and then follow the intermediate signals of factored circuits. The same signal equations let you read an unfamiliar NAND or NOR network back into a familiar Boolean function.
3.1 Universal gates and inversion bubbles
NAND and NOR each form a complete gate library: either type alone can build any Boolean function. Their inversion bubbles also provide a way to translate familiar AND-OR logic into circuits made from one gate type.
Build the basic operations
A NAND outputs . It is 0 only when all inputs are 1. A NOR outputs . It is 1 only when all inputs are 0. Three-input versions complement the three-input AND or OR in the same way.
| Operation | NAND-only construction | NOR-only construction |
|---|---|---|
| NOT | ||
| AND | Invert the output of | |
| OR | Invert the output of |
Tying both inputs together makes an inverter. Thus the complemented inputs needed in the table can also be generated with the same gate type. With only plain inputs available, NAND-built OR uses two input inverters and one final NAND. Since NOT, AND and OR can express any Boolean function, these constructions establish universality.
Do not combine NANDs as though they were ANDs
NAND and NOR are not associative. Cascading two NANDs gives , which need not equal . At , the cascade gives 0 but the three-input NAND gives 1. The first gate's inversion has changed the signal entering the next gate.
To build a three-input NAND from two-input NANDs, restore the intermediate AND: let , then , then . This takes three gates. Simply connecting two NANDs omits the needed middle inversion.
Read two symbols for the same gate
DeMorgan gives . A NAND can therefore be drawn as an AND with an output bubble, or an OR with an input bubble on each wire. These are called AND-invert and invert-OR. They represent the same physical gate.
Likewise, . A NOR is an OR with an output bubble or an AND with bubbles on all its inputs: OR-invert or invert-AND. Changing to the alternative symbol changes the drawing, not the function.
Two inversion bubbles on the same connection cancel: . This lets a first gate's output bubble meet the next gate's input bubble, exposing an underlying AND-OR path. A lone bubble needs compensation during conversion.
NAND is not an AND with complemented inputs. That expression is , a NOR. The equivalent NAND symbol is an OR with complemented inputs.
Why these gates suit hardware
In standard static CMOS, a two-input NAND or NOR uses four transistors. A two-input AND or OR adds a two-transistor inverter, giving six. Direct NAND or NOR implementations therefore suit this common technology.
Key Takeaways
- NAND and NOR can each build NOT, AND and OR, making each universal.
- Tied inputs turn NAND or NOR into an inverter.
- NAND and NOR are not associative.
- DeMorgan gives each gate an equivalent symbol with input bubbles.
- Two bubbles on one connection cancel.
3.2 Two-level gate implementations
A minimal expression suggests the gate family that implements it directly. SOP leads to NAND-NAND; POS leads to NOR-NOR. A term that is only one literal needs special attention because it bypasses the first gate level.
Convert SOP to NAND-NAND
For , apply DeMorgan twice:
The first two NANDs produce the complemented products. The output NAND acts as an OR of the original products. In a bubble drawing, use AND-invert symbols first and invert-OR at the output; the bubbles meet in pairs.
To convert an SOP, use one NAND for each product of two or more literals, then feed their outputs into the final NAND. Feed a single-literal term complemented to that final gate.
For , build and . The output is , requiring two two-input NANDs and a three-input NAND. The direct input is , not : DeMorgan makes the final output include the complement of that input. If is unavailable, generate it with a tied-input NAND.
Convert POS to NOR-NOR
The dual conversion is Each first-level NOR complements one sum, and the final NOR reconstructs their AND. A single-literal factor also enters the final gate complemented.
For , make three NORs with input pairs ; ; and . Their outputs feed a three-input NOR. The result uses four gates. Starting from SOP and simply replacing every gate with NOR would produce a different function.
Recognize inverted two-level forms
Some designs need an inverted combination. The useful two-level forms come in pairs:
| Function form | Gate pairs |
|---|---|
| SOP | AND-OR, NAND-NAND |
| POS | OR-AND, NOR-NOR |
| AND-OR-INVERT (AOI) | AND-NOR, NAND-AND |
| OR-AND-INVERT (OAI) | OR-NAND, NOR-OR |
AOI realizes . To design in AOI form, minimize as an SOP. For , , giving .
OAI realizes . For the same function, , so invert that POS to obtain .
There are 16 ordered combinations of AND, OR, NAND and NOR across two levels. The eight above are nondegenerate. The other eight collapse to one operation. For example, NAND-OR gives , one larger NAND. This collapse is different from cascading NANDs: NAND-NAND remains a useful SOP structure.
Key Takeaways
- NAND-NAND implements SOP; NOR-NOR implements POS.
- Complement a single-literal term or factor that bypasses the first level.
- AOI implements an inverted SOP; OAI implements an inverted POS.
- For an inverted form, simplify the complement in the matching form.
- Degenerate two-level forms collapse to one operation.
- Gate replacement must preserve the signal polarity at every connection.
3.3 Multilevel conversion and signal tracing
Factored expressions often create paths through more than two gates. To convert these multilevel circuits, keep track of each signal's polarity along the whole path. Direct replacement works only when the inversions match.
Convert one connection at a time
For NAND-only logic, replace AND with AND-invert and OR with invert-OR. Both symbols are NANDs. Inspect every wire: a bubble at each end cancels, but a bubble at only one end changes the signal. Compensate with an inverter or a complemented primary input.
Consider . Label intermediate signals so the conversion stays readable:
- is the NAND for the inner AND.
- is the NAND drawn as invert-OR. Its input from has matched bubbles. Its other input must be .
- complements the product .
- complements the other product.
- reconstructs the OR of those products.
This uses five NANDs when complemented inputs are available. The longest path runs through four gates. If step 2 used plain , the gate would produce , changing the function. The need for is visible at that unmatched input bubble.
Use the dual conversion for NOR
For NOR-only logic, replace OR with OR-invert and AND with invert-AND. Again, pair bubbles on each connection and compensate for any unmatched bubble.
Take . Start with and , using NORs drawn as invert-AND gates. Next make and . The final NOR gives . Its two inverted inputs supply the AND of the original factors. Five NOR gates suffice with complemented primary inputs available.
The first NOR gates have no output inversion relative to the products they replace because their input bubbles receive complemented literals. Labeling the signals avoids guessing from the gate shape alone.
Analyze a circuit from inputs to output
Write one equation per gate before simplifying. For , and , DeMorgan gives . When this reduces to ; when it reduces to . This is a useful independent check of the circuit's behavior.
Alternative symbols can reveal the same result: draw the output NAND as invert-OR so each input bubble cancels a first-level output bubble. You can then read the two products feeding an OR.
Factor before choosing a gate family
The SOP needs four two-input NANDs and a four-input NAND: 12 gate inputs. Factoring gives , implemented with three two-input NORs: six gate inputs. This particular factoring keeps two levels. Other factoring introduces multilevel paths, and each added gate level adds propagation delay. Count the gates along the longest input-to-output path separately from the number of gates in the whole circuit.
Key Takeaways
- Use alternative NAND or NOR symbols, then inspect every connection for unmatched bubbles.
- Label intermediate signals and derive their equations in input-to-output order.
- An unmatched input bubble requires a complemented signal or an added inverter.
- Factoring can reduce circuit cost; gate count and path depth are separate measures.
4Use XOR to generate and check parity
Alternating 1s and 0s can make a K-map look impossible to simplify, yet XOR gates often express the pattern directly. Their output tracks whether the count of high inputs is odd or even. Use that connection to build controlled inversion, parity generators and parity checkers. Following what happens when bits flip also explains both the value and the limits of a single parity bit.
4.1 XOR patterns and identities
Some maps resist SOP grouping because their 1s alternate with 0s. These patterns often have a short exclusive-OR implementation even when their minimal SOP is long.
Define XOR and XNOR
For two inputs, XOR is 1 when the inputs differ: . XNOR, or equivalence, is 1 when they match: .
| Identity | Effect |
|---|---|
| Pass the bit | |
| Invert the bit | |
| Equal terms cancel | |
| Complementary terms give 1 |
XOR is commutative and associative, so reorder and regroup its inputs freely. For example, . Complementing one input complements the output: . Complementing both inputs preserves XOR: .
An XOR is therefore a controlled inverter. One input is the data bit and the other is the control. Control 0 passes the data; control 1 flips it. The roles can be swapped because XOR is commutative.
Extend to several inputs
A multi-input XOR is 1 when an odd number of inputs are 1. It is called the odd function. For three inputs, . Input 111 gives 1 because three is odd; XOR does not mean “exactly one” once there are more than two inputs.
The complement is the even function, 1 when the count of 1s is even, including zero. For three inputs its minterms are 0, 3, 5 and 6. Use an XOR followed by XNOR: . An XOR tree or chain for inputs uses two-input XOR gates. For four inputs the odd function has minterms 1, 2, 4, 7, 8, 11, 13 and 14.
Recognize the map pattern
Odd and even functions form checkerboards on K-maps. Changing one input changes parity, so every adjacent cell has the opposite output. No 1s can be grouped. The three-input odd function has minimal SOP : four products and 12 literals. Two XOR gates implement the same function.
A partial checkerboard can involve fewer variables. For , pairs remove , leaving . Likewise, . Read which inputs differ instead of assuming every variable belongs in the XOR.
Build XOR from NANDs
Let , and , then . These four two-input NAND gates implement . For equal inputs 00 or 11, both and become 1, so the output is 0. For 01 or 10, one becomes 0, making the output 1. The shared intermediate signal is used by both branches.
Key Takeaways
- Two-input XOR detects unequal inputs; XNOR detects equal inputs.
- XOR permits regrouping and cancellation of repeated inputs.
- Complementing one XOR input flips the result; complementing both preserves it.
- Multi-input XOR detects an odd count of 1s, including three 1s.
- A parity checkerboard has no adjacent 1s to combine.
- Four NAND gates can implement a two-input XOR.
4.2 Parity bits and error detection
A parity bit adds one bit of error-detection information to a message. The generator chooses it so the total count of 1s has the agreed parity. The checker includes that extra bit when testing the received word.
Generate the extra bit
For data , an even-parity generator outputs . If the data contains an odd number of 1s, the XOR is 1, so adding that parity bit makes the total even. If the data count is already even, the parity bit is 0.
| Data | Number of 1s | Even-parity bit | Odd-parity bit |
|---|---|---|---|
| 000 | 0 | 0 | 1 |
| 001 | 1 | 1 | 0 |
| 011 | 2 | 0 | 1 |
| 111 | 3 | 1 | 0 |
For odd parity use . The word “even” describes the total count, not a fixed value of the parity bit. The bit changes with the message.
For data inputs, an even-parity generator needs two-input XOR gates. A tree or a chain gives the same Boolean result. In seven-bit ASCII, A is 1000001 with two 1s, so its even-parity bit is 0. C is 1000011 with three 1s, so its even-parity bit is 1.
Check all received bits
For even parity, compute . A result of 0 means no error is detected; 1 flags an error. This checker needs three two-input XOR gates for four received bits. In general, checking data bits plus their parity bit takes two-input XOR gates.
For odd parity, the same XOR should be 1 for a consistent word. To make an error flag that is 1 on failure, complement the full XOR. Generator and checker must use the same parity convention.
Send data 101 with even parity. There are two 1s, so and the transmitted word is 1010, with the parity bit last. If 1110 arrives, the checker finds three 1s and outputs 1. If 1011 arrives, only the parity bit changed; the checker still outputs 1. It cannot tell whether a data bit or the parity bit was damaged.
Understand the detection limit
Each flipped bit toggles the XOR. Any odd number of flips changes the expected result and is detected. Any even number restores it, so a single parity check misses that error pattern.
For example, if 1010 becomes 0110, two data bits have flipped. The received word still contains two 1s, and the even-parity checker outputs 0. Passing the check means the word has the expected parity; it does not establish that every bit arrived correctly.
A single parity bit also cannot locate the bad bit. Many different one-bit changes produce the same error flag. It detects an odd-flip error but cannot correct it; a system can respond by requesting the data again. When tracing a checker, include the parity input itself and distinguish the raw XOR result from the error flag used for odd parity.
Key Takeaways
- Even parity makes the total count of 1s even, including the parity bit.
- An even-parity generator XORs the data bits; an odd-parity generator complements that result.
- An even-parity checker XORs all received bits and flags 1 as an error.
- A single parity bit detects odd numbers of flips and misses even numbers.
- Parity detects errors without locating or correcting the damaged bit.
Gate-Level Minimization examples
1From a truth table to a minimum cover
15 steps
- 1IntroductionMake combinations visible
A truth table records outputs; a K-map places inputs that differ in one bit next to one another. Combining neighboring 1s removes inputs that do not affect that part of the function.
Work from a small map to a four-variable map, then choose a cover. A valid group is a candidate term; deciding whether it is needed requires looking at what the other groups cover.
- 2ExplanationLay out the three-input map
For inputs , use rows and columns . The top minterm row is 0, 1, 3, 2; the bottom row is 4, 5, 7, 6.
The column order is Gray code, so each neighboring label changes one bit. The outer columns also differ in one bit. A pair can cross that edge just as it can cross an interior cell boundary.
- 3ExampleFill the required ones
Take . Put 1s at those five minterms and 0s elsewhere. Minterm 5 is binary 101, so its position is the bottom row, column 01.
The first and last columns contain 1s in both rows: cells 0, 2, 4 and 6. Across these cells while both and vary. They form one wrapped group of four.
- 4ExampleRead the two products
The four-cell group gives : keep the fixed input and omit the changing inputs. Cell 5 is still uncovered, so pair it with cell 4. Their inputs 101 and 100 keep , giving .
The result is . Cell 4 belongs to both groups. Overlap is allowed because a 1 already covered by one term can also be covered by another without changing the OR result.
- 5ChallengeTry another edge pair
For , find a two-term SOP.
---reveal---
Pair 0 with 2 across the outer columns to obtain . Pair 6 with 7 to obtain . Thus . The possible pair 2,6 gives , but adding it would cover no new 1 after the first two groups are selected.
- 6ExplanationWrap both map directions
For four inputs, rows and columns both use 00, 01, 11, 10. The minterm rows are 0,1,3,2; 4,5,7,6; 12,13,15,14; and 8,9,11,10.
Top touches bottom, and left touches right. Think of bringing opposite edges together: a group split across the printed page can still be one rectangle in the wrapped map. A diagonal pair still changes two inputs and is invalid.
- 7ExampleRead a group at four corners
Suppose only cells 0, 2, 8 and 10 are 1. These four corners are one group. In binary they are 0000, 0010, 1000 and 1010.
Only and remain fixed, so the product is . A smaller pair such as 0,2 would keep unnecessarily. Using all four corners removes that extra literal without covering any required 0.
- 8TipCount changing inputs
A valid four-variable group of 2, 4 or 8 cells removes 1, 2 or 3 inputs, leaving 3, 2 or 1 literals. The count is a useful check on a term you have read.
For a four-cell group, finding three fixed inputs signals an error: either the group is not a valid rectangle, or one input actually changes. Group size and fixed-input count must describe the same input combinations.
- 9ChallengeExpand across rows
A four-variable function has 1s only at cells 1, 3, 9 and 11. Find its minimal product term.
---reveal---
The top and bottom rows join through wraparound. The cells keep while vary, so . Two separate row pairs would be correct but would retain an unnecessary dependence on . The wrapped group makes one two-literal term.
- 10ExplanationFind forced choices
A prime implicant cannot expand without including a 0. It is essential if some 1 has no other prime cover.
To identify essentiality, inspect every prime, including overlaps. A cell appearing in just one selected group is not enough: an unselected prime might also cover it. Unique coverage must hold among all primes, not just among the groups already drawn for an answer.
- 11ExampleSelect two essential primes
For , the primes are .
Cell 5 belongs only to ; cell 0 belongs only to . Select both. They cover cells 0,2,5,7,8,10,13,15, leaving 3,9,11. Listing the remaining cells prevents selecting an attractive group that adds no necessary coverage.
- 12ExampleFinish the cover
Cell 3 needs or . Cell 9 needs or . No one prime covers both cells, so at least two more terms are required. Each choice also covers cell 11.
Choosing and gives . Replacing either chosen nonessential prime with its alternative gives three other minimal answers. Each has four terms and eight literals.
- 13ChallengeDecide which prime to omit
For , the prime pairs give , , and . Find a minimal SOP and explain your choice.
---reveal---
Cell 1 forces and cell 7 forces . Only cell 4 remains; cover it with either or . Both give three terms and six literals. Including both extra pairs increases cost with no new required coverage.
- 14Key InsightA large group can add nothing
For , isolated coverage choices force four pairs: . Together they cover every required 1.
The larger prime covers cells 5,7,13,15, all already covered by those forced pairs. It stays prime but contributes no necessary cell. “Cannot grow” and “must be chosen” answer different questions.
- 15RecapUse coverage to justify the answer
Set up Gray-code labels, mark the specified outputs, and find valid wrapped rectangles. Read fixed inputs from each group. Identify all primes before deciding which are essential, then cover any remaining 1s with the fewest extra terms.
When two answers differ, compare their covered cells and their term and literal counts. The drawing need not match for the expressions to be equally minimal.
2Choose between ones, zeros, and Xs
13 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionChoose another route through the map
- 2ExplanationMake a factor zero inside its group
- 3ExampleGroup the zeros of a function
- 4ExampleComplement the whole expression
- 5ChallengeFind a POS from a new zero list
- 6ExplanationGive X its proper role
- 7ExampleEnlarge a BCD group
- 8Key InsightDifferent X outputs can both work
- 9ChallengeUse only the helpful Xs
- 10ExplanationCount the actual gate inputs
- 11ExampleCompare two minimal forms
- 12ChallengeCombine Xs, polarity, and cost
- 13RecapKeep requirements and cost separate
3Convert expressions into NAND or NOR networks
16 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionFollow the inversion
- 2ExplanationBuild a complete gate library
- 3ConnectionChange the symbol without changing the gate
- 4ExampleKeep the intermediate inversion
- 5ChallengeIdentify the alternative symbol
- 6ExplanationTurn products into NAND inputs
- 7ExampleHandle a bypassed literal
- 8ExplanationUse the dual structure for POS
- 9Key InsightRecognize the inverted forms
- 10ChallengeChoose signals for the output gate
- 11ExampleStart a factored NAND conversion
- 12ExampleComplete the outer products
- 13ExampleTrace a NOR network
- 14TipWrite one equation per gate
- 15ChallengeRepair an unmatched input
- 16RecapMatch structure and polarity
4From XOR patterns to parity checking
12 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionCount high inputs with XOR
- 2ExplanationConnect different inputs to the formula
- 3ExampleSimplify by cancellation
- 4ConnectionRecognize a checkerboard
- 5ExampleUse four NANDs for XOR
- 6ChallengeRemove an unused input from the pattern
- 7ExplanationMake the total even
- 8ExampleGenerate and send a word
- 9ExampleCompare one flip with two
- 10Key InsightSeparate the XOR result from the error flag
- 11ChallengeBuild and test a new parity word
- 12RecapTrack parity across the whole word
Gate-Level Minimization practice questions
Set 1: From input combinations to minimum covers10 Practice Questions
Question 1 of 10
Show answerHide answer
Question 2 of 10
Show answerHide answer
Question 3 of 10
Show answerHide answer
Question 4 of 10
Show answerHide answer
Question 5 of 10
Show answerHide answer
Question 6 of 10
Show answerHide answer
Question 7 of 10
Show answerHide answer
Question 8 of 10
Show answerHide answer
Question 9 of 10
Show answerHide answer
Question 10 of 10
Show answerHide answer
Set 2: Zero-groups, don’t-cares, and circuit cost10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 3: NAND and NOR implementation choices10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 4: XOR patterns and parity checks10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 5: Combine minimization, implementation, and checking10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Stuck on your own question? Homework Help
Key Terms
A
Alternative gate symbol
AND-OR-INVERT
B
Binary-coded decimal
C
Circuit depth
Consensus term
Controlled inverter
Cover
D
Degenerate gate form
DeMorgan’s theorem
Don’t-care condition
E
Error flag
Essential prime implicant
Even function
Exclusive-NOR
Exclusive-OR
F
Factoring
Four-corner group
G
Gate-input count
Gray code
I
Implicant
Incompletely specified function
Intermediate signal
Inversion bubble
K
Karnaugh map
L
Literal
Literal count
M
Majority function
Maxterm
Minimal SOP
Minterm
Multilevel circuit
N
NAND
NAND-NAND implementation
NOR
NOR-NOR implementation
O
Odd function
OR-AND-INVERT
Overlapping groups
P
Parity bit
Parity checker
Parity generator
Power-of-two group
Prime implicant
Product of sums
S
Specified input
Sum of products
T
Truth-table verification
U
Universal gate
W
Wraparound adjacency
Z
Zero-group
About this lesson
Make your own Study Materials
Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.