IT233 Digital Logic

Digital LogicUnit 89 min read

Karnaugh Maps: Minimization, K-Map Rules & Real-World Logic Design

Unit 8 of Digital Logic covers Karnaugh Maps (K-Maps), their construction, simplification rules, and practical applications in minimizing Boolean functions for efficient digital circuit design. Learn how to reduce logic expressions, handle don’t-care conditions, and design optimized circuits using K-Maps—essential for


1. What is a Karnaugh Map (K-Map)?

A Karnaugh Map (K-Map) is a graphical tool used to simplify Boolean expressions by grouping adjacent 1s (or 0s) in a way that minimizes the number of logic gates in the final circuit. Unlike algebraic methods (e.g., Boolean algebra laws), K-Maps visually group terms to eliminate redundant variables, reducing complexity.

Why Use K-Maps?

  • Efficiency: Reduces the number of gates in a circuit, lowering cost and power consumption.
  • Clarity: Visual grouping makes it easier to spot optimizations than algebraic methods.
  • Don’t-Care Terms: Handles undefined inputs (e.g., unused binary combinations) to further simplify logic.

2. K-Map Basics: Structure and Rules

2.1 K-Map Grid Construction

K-Maps are 2D arrays where:

  • Rows and columns represent variables (e.g., A, B, C, D).
  • Adjacency is circular (wraps around edges) and includes diagonals if they differ by one bit.
  • Size depends on the number of variables:
    • 2 variables → 4 cells (2×2)
    • 3 variables → 8 cells (2×4)
    • 4 variables → 16 cells (4×4)
    • 5 variables → 32 cells (4×8) (rare in exams)

2.2 Example: 3-Variable K-Map

graph TD
    subgraph K-Map for F("A,B,C")
        A["A=0"] --> B["B=0"] --> C["C=0"]
        A --> D["B=1"] --> E["C=1"]
        F["A=1"] --> G["B=0"] --> H["C=0"]
        F --> I["B=1"] --> J["C=1"]
    end

Key Rules for Grouping:

  1. Group size: Must be powers of 2 (2, 4, 8, 16).
  2. Maximize group size: Larger groups reduce terms more.
  3. Overlap allowed: A cell can belong to multiple groups.
  4. Don’t-care terms (X): Can be included in groups to simplify further.

3. Step-by-Step K-Map Simplification

Example 1: Minimize

Step 1: List the minterms

  • → minterms where : 2, 3 (assuming or ).
  • → minterm 3 (since ).
  • → minterm 7. Correction: Rewrite in sum-of-products (SOP) form: .

Step 2: Draw the K-Map (3 variables: )

      yz\x | 00 | 01 | 11 | 10
      ------------------------
       0   |  0 |  0 |  0 |  1
       1   |  1 |  1 |  0 | 0

Step 3: Group the 1s

  • Group 2 and 3 (differ by ) → .
  • Group 3 and 7 (differ by ) → . Simplified expression: .

Example 2: With Don’t-Care Terms

Problem: Minimize with don’t-cares . Step 1: Draw the 4-variable K-Map

      PR\MN | 00 | 01 | 11 | 10
      ----------------------------
       00   |  1 |  0 |  0 |  1
       01   |  0 |  1 |  1 |  0
       11   |  1 |  1 |  1 |  1
       10   |  1 |  0 |  0 | X

Step 2: Group 1s and use Xs to form larger groups

  • Group 0,1,3,5 (8-cell group) → .
  • Group 7,15,13,11 (8-cell group) → .
  • Use X at (8) to extend a group if needed (e.g., combine with 9,10). Simplified expression: .

4. K-Map vs. Boolean Algebra: Comparison

Feature Karnaugh Map Boolean Algebra
Method Visual grouping Algebraic manipulation
Ease for 4+ vars Better (scalable) Complex
Don’t-cares Handles easily Requires substitution
Error-prone Less (visual) More (algebraic mistakes)
Output Minimized SOP/POP Minimized expression

5. Real-World Applications of K-Maps

## In the Real World

  1. eSewa Payment Validation

    • Idea Used: K-Maps simplify the logic for validating transaction inputs (e.g., amount, user ID, time).
    • How: A 4-variable K-Map reduces the circuit for checking fraudulent patterns (e.g., amount > limit AND time = night), lowering gate count and speeding up approvals.
  2. Ncell Call Routing

    • Idea Used: K-Maps optimize the logic for routing calls based on network conditions (e.g., signal_strength AND roaming = false).
    • How: A 3-variable K-Map minimizes the control logic for prioritizing calls, reducing latency.
  3. Daraz Order Fulfillment Queue

    • Idea Used: K-Maps design the priority encoder for order processing (e.g., priority = high IF (payment_confirmed AND stock_available)).
    • How: Simplifies the hardware logic for sorting orders, cutting costs in Daraz’s warehouse management systems.

Worked Example: Traffic Light Controller (Nepal’s Kathmandu)

Problem: Design a simplified logic for a traffic light that turns green if:

  • No pedestrians (P=0) AND no emergency vehicles (E=0).
  • Don’t-care: Nighttime (N=1) can ignore pedestrian signals.

K-Map for with

      EN\P | 00 | 01 | 11 | 10
      ------------------------
       0   |  1 |  1 |  X |  X
       1   |  0 |  0 |  1 |  1

Groups:

  • 0,1,4,5 → (since and vary but ).
  • Use X at (2,3) to extend group if needed (but not required here). Simplified Logic: . Circuit: A single NOT gate for , connected to the green light.

6. Practical Design: From K-Map to Circuit

Example: Implement

Step 1: Draw the K-Map (3 variables)

      BC\A | 00 | 01 | 11 | 10
      ------------------------
       0   |  0 |  0 |  0 |  1
       1   |  1 |  1 |  0 | 0

Step 2: Group

  • Group 1: (cells 3,7).
  • Group 2: (cells 2,6). Simplified Expression: .

Step 3: Circuit Diagram

flowchart LR
    A["A"] --> AND1["AND"]
    B["B"] --> AND1
    AND1 --> OR["OR"]
    C["C"] --> NOT["NOT"]
    NOT --> AND2["AND"]
    A --> NOT
    AND2 --> OR

Explanation:

  • AND1: Implements .
  • NOT + AND2: Implements .
  • OR: Combines both terms.

7. Common Mistakes and Pitfalls

  1. Ignoring Circular Adjacency: Forgetting that edges wrap around (e.g., 00 and 10 are adjacent in a 2×2 K-Map).
  2. Overlapping Groups Improperly: A cell can’t be in two groups of the same size unless necessary.
  3. Missing Don’t-Care Terms: Not using X to form larger groups can lead to suboptimal solutions.
  4. Incorrect Group Sizes: Groups must be powers of 2 (e.g., 4-cell groups are valid, but 3-cell groups are not).

8. Advanced Techniques

8.1 Quine-McCluskey Method

  • An algebraic alternative to K-Maps for larger functions (5+ variables).
  • When to Use: If K-Maps become too complex (e.g., 5-variable maps).

8.2 POS vs. SOP Simplification

  • Sum-of-Products (SOP): Simplifies to AND-OR circuits (default in K-Maps).
  • Product-of-Sums (POS): Simplifies to OR-AND circuits (use 0s instead of 1s in K-Maps).

## Exam Tip

  1. Always Check the Number of Variables:

    • 2 vars → 2×2 K-Map.
    • 3 vars → 2×4 K-Map.
    • 4 vars → 4×4 K-Map.
    • Penalty: Wrong size = wrong answer.
  2. Label Axes Correctly:

    • Use Gray code for variables (e.g., 00, 01, 11, 10 for 2 bits).
    • Example: For , label rows/columns as AB and CD.
  3. Don’t-Care Terms Are Your Friends:

    • If a question includes d = ..., always use them to form larger groups.
    • Example: In the Ncell routing problem, X terms can merge groups to reduce terms.
  4. Show All Steps:

    • Examiners deduct marks for incomplete work. Always:
      1. List minterms.
      2. Draw the K-Map.
      3. Circle groups.
      4. Write the simplified expression.
  5. Practice with Real Scenarios:

    • Bank Loan Approval: Simplify logic like income > threshold AND credit_score > 600.
    • WhatsApp Message Priority: Use K-Maps to design a circuit that prioritizes messages based on sender_type and time.
  6. Common Exam Questions:

    • "How many cells in a K-Map?" → where = number of variables.
    • "Minimize with don’t-cares" → Always include X in groups if it helps.
    • "Design a circuit" → Draw the simplified logic gates from the K-Map expression.

## Summary Checklist

Before submitting your answer, verify: ✅ K-Map size matches the number of variables. ✅ All minterms are correctly placed. ✅ Groups are powers of 2 and maximized. ✅ Don’t-care terms are utilized if present. ✅ Simplified expression matches the grouped terms. ✅ Circuit diagram (if required) is accurate.


Based on the TU BITM syllabus for Digital Logic (IT233), unit 8.

Discussion

Loading…