Karnaugh Maps for Boolean Function Simplification

Karnaugh Maps

Introduction

  • Karnaugh Maps (K-Maps) are used to simplify boolean algebra expressions and derive functions from truth tables.
  • A K-Map provides a visual method to minimize boolean functions.

Three-Variable Karnaugh Map

  • For a three-variable function f(a,b,c)f(a, b, c), a three-variable K-Map with eight squares is needed.
  • The eight squares correspond to the eight possible input combinations.
  • A three-variable K-Map can be drawn in two common ways:
    • Two rows and four columns.
    • Two columns and four rows.
Horizontal Orientation
  • Variables aa and bb are represented on the top (columns), and variable cc on the side (rows).
  • The order of inputs for aa and bb is 00, 01, 11, and 10 (Gray code) to ensure only one variable changes between adjacent columns.
  • The input for cc is binary, 0 or 1.
Filling the K-Map
  • The values inside each square are the function values from the truth table.
  • Example: If a=0a=0, b=0b=0, and c=0c=0, the corresponding function value from the truth table is placed in the square corresponding to a=0a=0, b=0b=0, and c=0c=0.
Vertical Orientation
  • Variable aa is represented above the diagonal line, and variables bb and cc below it.
  • aa has two possibilities: 0 or 1.
  • bb and cc can be 00, 01, 11, or 10.

Converting K-Map to Function

  • Circle groups of ones in the K-Map.
  • The number of ones that can be grouped together must be a power of two (1, 2, 4, 8, etc.).
  • Groups can be pairs, quads, octets, etc., but not three, five, or six.
  • Identify the variables that do not change within the group.
    • If a variable is 1, use the variable as is.
    • If a variable is 0, use the complement of the variable.
  • Write the product term for each group of ones.
  • Sum the product terms to form the simplified boolean expression.
  • f=(product terms)f = \sum (\text{product terms})
Example
  • Consider a pair of ones in the K-Map.
  • If for these ones, bb is always 1 and cc is always 0, the term is bcb \cdot \overline{c}.
  • If for another pair of ones, aa is always 1 and bb is always 0, the term is aba \cdot \overline{b}.
  • The function is the sum of these terms: f=bc+abf = b \cdot \overline{c} + a \cdot \overline{b}.
Testing the Function
  • Plug in values from the truth table into the derived function.
  • Verify that the function output matches the truth table output.

Converting Function to Circuit Diagram

  • Each product term (AND operation) requires an AND gate.
  • The sum of products (OR operation) requires an OR gate.
  • Inverters (NOT gates) are used to implement complemented variables.
Example
  • For the function f=bc+abf = b \cdot \overline{c} + a \cdot \overline{b},
    • An AND gate connects bb and c\overline{c}.
    • Another AND gate connects aa and b\overline{b}.
    • An OR gate connects the outputs of these AND gates to produce the final output ff.

Four-Variable Karnaugh Map

  • A four-variable K-Map has 16 squares (4 rows and 4 columns).
  • Variables aa and bb are represented on the top, and variables cc and dd on the side.
  • The order of inputs for aa, bb, cc, and dd is based on Gray code.
Example
  • Consider a group of two ones where aa and bb are always 1 and cc is always 0. The term is abca \cdot b \cdot \overline{c}.
  • Consider another group of two ones where aa is always 0, cc is always 1, and dd is always 0. The term is acd\overline{a} \cdot c \cdot \overline{d}.
  • The function is the sum of these terms.
Larger Groups
  • A group of four ones corresponds to a term with two variables.
  • A group of eight ones corresponds to a term with one variable.
Filling K-Map from a Function
  • For each term in the function, identify where the variables match the term.
  • Put a '1' in those squares.
  • Fill the remaining squares with '0's.
Example
  • Given the function f=ab+acd+abcf = a \cdot \overline{b} + \overline{a} \cdot c \cdot d + a \cdot b \cdot \overline{c},
    • For aba \cdot \overline{b}, put '1' where a=1a=1 and b=0b=0.
    • For acd\overline{a} \cdot c \cdot d, put '1' where a=0a=0, c=1c=1, and d=1d=1.
    • For abca \cdot b \cdot \overline{c}, put '1' where a=1a=1, b=1b=1, and c=0c=0.
Color Coding
  • Use color-coding to differentiate terms from each other.
  • Terms with one variable result in eight ones.
  • Terms with two variables result in four ones.
  • Terms with three variables result in two ones.
  • Terms with four variables result in one one.