henry hexmoor1 computer logic and digital design chapter 2 henry hexmoor and logic s1 s2 path? off...

46
Henry Hexmoor 1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1 . S2 AND Gate AB B

Post on 19-Dec-2015

218 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 1

Computer Logic and Digital Design Chapter 2

Henry HexmoorAND logic

S1 S2 path?off off noon off nooff on noon on yes

input output

S1 . S2

AND Gate

ABB

Page 2: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 2

OR logic

S1 S2 path?off off noon off yesoff on yeson on yes

input

output

S1 S2

S1 + S2

Page 3: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 3

NOT logic

S1 00 1

SS'S

Page 4: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 4

Equivalent Symbols of NAND, NOR GatesEquivalent Symbols of NAND, NOR Gates

X

Y(X . Y)’

X

YX’ + Y’

X

Y(X + Y)’

X

YX’ . Y’

NAND Symbols

NOR Symbols

According to DeMorgan’s theorem T13: (X . Y)’ = X’ + Y’

Normal Symbol

Normal NOR Symbol

According to DeMorgan’s theorem T13’: (X + Y)’ = X’ . Y’

Alternate NOR Symbol

Alternate NAND Symbol

Page 5: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 5

Boolean Algebra

X Y Z Y’Z X+Y’Z0 0 0 0 00 0 1 1 10 1 0 0 00 1 1 0 01 0 0 0 11 0 1 1 11 1 0 0 11 1 1 0 1

• Literals (n) and terms• number of truth table rows = 2n

• See table 2-3• Using demorgan’s laws OR and AND are interchanged… the duality principle

Page 6: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 6

Switching Algebra Axioms & Theorems

(A1)X = 0 if X ≠ 1 (A1’) X = 1 if X ≠ 0(A2)If X = 0, then X’ = 1 (A2’) if X = 1, then, X’ = 0(A3)0 . 0 = 0 (A3’) 1 + 1 = 1(A4)1 . 1 = 1 (A4’) 0 + 0 = 0(A5)0 . 1 = 1 . 0 = 0 (A5’) 1 + 0 = 0 + 1 = 1

(T1)X + 0 = X (T1’) X . 1 = X (Identities)(T2) X + 1 = 1 (T2’) X . 0 = 0 (Null

elements)(T3) X + X = X (T3’) X . X = X

(Idempotency)(T4)(X’)’ = X (Involution)(T5)X + X’ = 1 (T5’) X . X’ = 0 (Complements)(T6)X + Y = Y + X (T6’) X . Y = Y . X (Commutativity)(T7)(X + Y) + Z = X + (Y + Z) (T7’) (X . Y) . Z = X . (Y . Z) (Associativity)(T8) X . Y + X . Z = X . (Y + Z) (T8’) (X + Y) . (X + Z) = X + Y . Z (Distributivity)(T9) X + X . Y = X (T9’) X . (X + Y) = X (Covering)(T10) X . Y + X . Y’ = X (T10’) (X + Y) . (X + Y’) = X (Combining)(T11) X . Y + X’. Z + Y . Z = X . Y + X’ . Z(T11’) (X + Y) . ( X’ + Z) . (Y + Z) = (X + Y) . (X’ + Z) (Consensus)(T12) X + X + . . . + X = X (T12’) X . X . . . . . X = X (Generalized

idempotency)

(T13) (X1 . X2 . . . . . Xn)’ = X1’ + X2’ + . . . + Xn’

(T13’) (X1 + X2 + . . . + Xn)’ = X1’ . X2’ . . . . . Xn’ (DeMorgan’s theorems)

(T14) [F(X1, X2, . . ., Xn, +, .)]’ = F(X1’, X2’, . . ., Xn’, . , +) (Generalized DeMorgran’s theorem)

Page 7: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 7

Switching Algebra Axioms Axioms

• First two axioms state that a variable X can only take on only one of two values:

(A1) X = 0 if X 1

(A1’) X = 1 if X 0

• Not Axioms, formally define X’ (X prime or NOT X):

(A2) If X = 0, then X’ = 1

(A2’) if X = 1, then, X’ = 0

Note: Above axioms are stated in pairs with only difference being the interchange of the symbols 0 and 1.

Page 8: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 8

Three More Switching Algebra Axioms

• The following three Boolean Algebra axioms state and formally define the AND, OR operations:

(A3) 0 . 0 = 0

(A3’) 1 + 1 = 1

(A4) 1 . 1 = 1

(A4’) 0 + 0 = 0

(A5) 0 . 1 = 1 .0 = 0

(A5’) 1 + 0 = 0 + 1 = 1

Axioms A1-A5, A1’-A5’ completely define switching algebra.

Page 9: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 9

Switching Algebra: Single-Variables Theorems • Switching-algebra theorems are statements known to be always

true (proven using axioms) that allow us to manipulate algebraic logic expressions to allow for simpler analysis.

(e.g . X + 0 = X allow us to replace every X +0 with X)

The Theorems: (T1-T5, T1’-T5’)

(T1) X + 0 = X (T1’) X . 1 = X (Identities)

(T2) X + 1 = 1 (T2’) X . 0 = 0 (Null elements)

(T3) X + X = X (T3’) X . X = X (Idempotency)

(T4) (X’)’ = X (Involution)

(T5) X + X’ = 1 (T5’) X . X’ = 0 (Complements)

Page 10: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 10

Perfect Induction

• Most theorems in switching algebra are simple to prove using perfect induction:

Since a switching variable can only take the values 0 and 1 we can prove a theorem involving a single variable X by proving it true for X = 0 and X =1

Example: To prove (T1) X + 0 = X

[X = 0] 0 + 0 = 0 true according to axiom A4’

[X = 1] 1 + 0 = 1 true according to axiom A5’

Page 11: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 11

Switching Algebra: Two- and Three-Variable Theorems (Commutativity)

(T6) X + Y = Y + X

(T6’) X . Y = Y . X

(Associativity)

(T7) (X + Y) + Z = X + (Y + Z)

(T7’) (X . Y) . Z = X . (Y . Z)

T6-T7, T6’ -T7’ are similar to commutative and associative laws for addition and multiplication of integers and reals.

Page 12: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 12

Two- and Three-Variable Theorems (Continued)

(Distributivity)

(T8) X . Y + X . Z = X . (Y + Z)

(T8’) (X + Y) . (X + Z) = X + Y . Z

• T8 allows to multiply-out an expression to get sum-of-products form (distribute logical multiplication over logical addition):

For example: V . (W + X) . (Y + Z) = V .W . Y + V. W. Z + V. X . Y + V. X . Z

sum-of-products form

• T8’ allows to add-out an expression to get a product-of-sums form (distribute logical addition over logical multiplication):

For example:(V . W . X) + (Y . Z ) = (V + Y) . (V + Z) . (W + Y) . (W + Z) . (X + Y) . (X + Z)

product-of-sums form

Page 13: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 13

Theorem Theorem Proof using Truth TableProof using Truth Table• Can use truth table to prove T8 by perfect induction.• i.e, Prove that: X . Y + X . Z = X . (Y + Z)

(i) Construct truth table for both sides of above equality.

x y z y + z x.(y + z) x.y x.z x.y + x.z0 0 0 0 0 0 0 00 0 1 1 0 0 0 00 1 0 1 0 0 0 00 1 1 1 0 0 0 01 0 0 0 0 0 0 01 0 1 1 1 0 1 11 1 0 1 1 1 0 11 1 1 1 1 1 1 1

(ii) Check that from truth table check that that X . Y + X . Z = X . (Y + Z)

This is satisfied because output column values for X . Y + X . Z and output column values for X . (Y + Z) are equal for all cases.

Page 14: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 14

Two- and Three-Variable Theorems (Continued)

(Covering)

(T9) X + X . Y = X

(T9’) X . (X + Y) = X

(Combining)

(T10) X . Y + X . Y’ = X

(T10’) (X + Y) . (X + Y’) = X

• T9-T10 used in the minimization of logic functions.

Page 15: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 15

(Consensus)

(T11) X . Y + X’. Z + Y . Z = X . Y + X’ . Z

(T11’) (X + Y) . ( X’ + Z) . (Y + Z) = (X + Y) . (X’ + Z)

• In T11 the term Y. Z is called the consensus of the term X . Y and the term X’ . Z:– If Y . Z = 1, then either X . Y or X’ . Z must also be 1.– Thus the term Y . Z is redundant and may be dropped.

Two- and Three-Variable Theorems (Continued)

Page 16: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 16

n-Variable Theorems

(Generalized idempotency)

(T12) X + X + . . . + X = X

(T12’) X . X . . . . . X = X

(DeMorgan’s theorems)

(T13) (X1 . X2 . . . . . Xn)’ = X1’ + X2’ + . . . + Xn’

(T13’) (X1 + X2 + . . . + Xn)’ = X1’ . X2’ . . . . . Xn’

(T13), (T13’) are probably the most commonly

used theorems of switching algebra.

Page 17: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 17

Examples Using DeMorgan’s theorems

Example: Equivalence of NAND Gate:

A two-input NAND Gate has the output expression Z = (X . Y)’ using (T13) Z = (X . Y)’ = (X’ + Y’)

The function of a NAND gate can be achieved with an OR gate with an inverter at each input.

Example: Equivalence of NOR Gate

A two-input NOR Gate has the output expression Z=(X+Y)’

using (T13’) Z = (X + Y)’ = X’ . Y’

The function of a NOR gate can be achieved with an AND gate with an inverter at each input.

Page 18: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 18

n-Variable Theorems (Continued)

(Generalized DeMorgran’s theorem)

(T14) [F(X1, X2, . . ., Xn, +, .)]’ = F(X1’, X2’, . . ., Xn’, . , +)

• States that given any n-variable logic expression its complement can be found by swapping + and . and complementing all variables.

Example:

F(W,X,Y,Z) = (W’.X) + ( X.Y) + (W.(X’ + Z’))

= ((W)’ . X) + (X. Y) + (W.((X)’ + (Z)’))

[F(W,X,Y,Z)]’ = ((W’)’ + X’) .(X’ + Y’).(W’ + ((X’)’.(Z’)’))

Using T4, (X’)’ = X simplifies it to:

[F(W,X,Y,Z)]’ = (W + X’) . (X’ + Y’) . (W’ + (X . Z))

Page 19: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 19

Logic Function Representation Definitions

• A literal: is a variable or a complement of a variable

Examples: X, Y, X’, Y’

• A product term: is a single literal, or a product of two or more literals. Examples: Z’ W.Y.Y X.Y’.Z W’.Y’.Z

• A sum-of-products expression: is a logical sum of product terms.

Example: Z’ + W.X.Y + X.Y’.Z + W’.Y’.Z

• A sum term: is a single literal or logical sum of two or more literals

Examples: Z’ W + X + Y X + Y’ + Z W’ + Y’ + Z

• A product-of-sums expression: is a logical product of sum terms.

Example: Z’. (W + X + Y) . (X + Y’ + Z) . (W’ + Y’ + Z)

• A normal term: is a product or sum term in which no variable appears more than once

Examples of non-normal terms: W.X.X.Y’ W+W+X’+Y X.X’.Y

Examples of normal terms: W . X . Y’ W + X’ + Y

Page 20: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 20

Logic Expression Algebraic Manipulation ExampleLogic Expression Algebraic Manipulation Example • Prove that the following identity is true using Algebraic expression

Manipulation : (one can also prove it using a truth table)

X .Y + X . Z = ((X’ + Y’) . (X’ + Z’))’– Starting from the left hand side of the identity:

Let F = X .Y + X . Z

A = X . Y B = X . Z

Then F = A + B

– Using DeMorgan’s theorem T 13 on F:

F = A + B = (A’ . B’)’ (1)

– Using DeMorgan’s theorem T 13’ on A, B:

A = X . Y = (X’ + Y’)’ (2)

B = X . Z = (X’ + Z’)’ (3)

– Substituting A, B from (2), (3), back in F in (1) gives:

F = (A’ . B’)’ = ((X’ + Y’) . (X’ + Z’))’

Which is equal to the right hand side of the identity.

Page 21: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 21

Terminology: Minterms

• A minterm is a special product of literals, in which each input variable appears exactly once.

• A function with n variables has 2n minterms (since each variable can appear complemented or not)

• A three-variable function, such as f(x,y,z), has 23 = 8 minterms:

• Each minterm is true for exactly one combination of inputs:

x’y’z’ x’y’z x’yz’ x’yzxy’z’ xy’z xyz’ xyz

Minterm Is true when… Shorthandx’y’z’ x=0, y=0, z=0 m0

x’y’z x=0, y=0, z=1 m1

x’yz’ x=0, y=1, z=0 m2

x’yz x=0, y=1, z=1 m3

xy’z’ x=1, y=0, z=0 m4

xy’z x=1, y=0, z=1 m5

xyz’ x=1, y=1, z=0 m6

xyz x=1, y=1, z=1 m7

Page 22: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 22

Terminology: Maxterms

• A maxterm is a special sum of literals, in which each input variable appears exactly once.

• A function with n variables has 2n maxterms (since each variable can appear complemented or not)

• A three-variable function, such as f(x,y,z), has 23 = 8 maxterms:

Maxterm Shorthandx’+ y’+ z’ M0

x’+ y’ + z M1

x’+ y + z’ M2

x’ + y + z M3

x + y’ + z’ M4

x + y’ + z M5

x + y + z’ M6

x + y + z M7

Page 23: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 23

Canonical Forms• Minterms and Maxterms• Index Representation of Minterms and

Maxterms • Sum-of-Minterm (SOM) Representations• Product-of-Maxterm (POM) Representations• Representation of Complements of

Functions• Conversions between Representations

Page 24: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 24

Logic Function Representation Definitions

• Minterm An n-variable minterm is a normal product term with n literals.

There are 2n such products terms.

Example of 4-variable minterms:

W.X’.Y’.Z’ W.X.Y’.Z W’.X’.Y.Z’

• Maxterm An n-variable maxterm is a normal sum term with n literals.

There are 2n such sum terms.

Examples of 4-variable maxterms:

W’ + X’ + Y + Z’ W + X’ + Y’ + Z W’ + X’ + Y + Z

• A minterm can be defined as as product term that is 1 in exactly one row of the truth table.

• A maxterm can similarly be defined as a sum term that is 0 in exactly one row in the truth table.

Page 25: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 25

Minterms/Maxterms for A 3-variable function F(X,Y,Z)

Row X Y Z F Minterm Maxterm

0 0 0 0 F(0,0,0) X’.Y’.Z’ X + Y + Z 1 0 0 1 F(0,0,1) X’.Y’.Z X + Y + Z’ 2 0 1 0 F(0,1,0) X’.Y.Z’ X + Y’ + Z 3 0 1 1 F(0,1,1) X’.Y.Z X + Y’ + Z’ 4 1 0 0 F(1,0,0) X.Y’.Z’ X’ + Y + Z 5 1 0 1 F(1,0,1) X.Y’.Z X’ + Y + Z’ 6 1 1 0 F(1,1,0) X.Y.Z’ X’ + Y’ + Z 7 1 1 1 F(1,1,1) X.Y.Z X’ + Y’ + Z’

Page 26: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 26

Canonical Sum Example• The function represented by the truth table:

has the canonical sum representation:

F = X,Y,Z m(0, 3, 4, 6, 7)

= X’.Y’.Z’ + X’.Y.Z + X.Y’.Z’ + X.Y’.Z’ + X.Y.Z

Row X Y Z F 0 0 0 0 1 1 0 0 1 0 2 0 1 0 0 3 0 1 1 1 4 1 0 0 1 5 1 0 1 0 6 1 1 0 1 7 1 1 1 1

Minterm list using notation

Algebraic canonical sum of minterms

Page 27: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 27

Canonical Product Example

• The function represented by the truth table:

has the canonical product representation:F = X,Y,Z M(1,2,5)

= (X + Y + Z’) . (X + Y’ + Z) . (X’ + Y + Z’)

Row X Y Z F 0 0 0 0 1 1 0 0 1 0 2 0 1 0 0 3 0 1 1 1 4 1 0 0 1 5 1 0 1 0 6 1 1 0 1 7 1 1 1 1

Page 28: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 28

• Review: DeMorgan's Theorem and • Two-variable example: and M2 is the complement of m2 and vice-versa.• Since DeMorgan's Theorem holds for n

variables, the above holds for terms of n variables

• giving:

and Thus Mi is the complement of mi.

Minterm and Maxterm Relationship

yx y· x yxyx

y x M2 yx· m2

i mM i ii Mm

Page 29: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 29

Conversion Between Minterm/Maxterm ListsConversion Between Minterm/Maxterm Lists

• To convert between a minterm list and a maxterm list

take the set complement.

Example (page 44, 3rd ed.):

F’(X,Y, Z) = m(1,3, 4, 6) = m1 + m3 + m4 + m6

F(X,Y, Z) = M(1,3,4,6) = M1M3M4M6

Page 30: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 30

• A verbal logic description:– The ALARM output is 1 if the panic input is 1, or if the ENABLE input is 1, the

EXISTING input is 0, and the house is not secure.– The house is secure if the WINDOW, DOOR, GARAGE inputs are all 1

• This can be put in logic expressions as follows:

ALARM = PANIC + ENABLE . EXISTING’ . SECURE’

SECURE = WINDOW. DOOR. GARAGE

ALARM = PANIC + ENABLE . EXISTING’. (WINDOW . DOOR . GARAGE)’

In sum of products form as (by using DeMorgan T13 and multiplying out) :ALARM = PANIC + ENABLE. EXISTING’ . WINDOW’

+ ENABLE . EXISTING’. DOOR’+ ENABLE. EXISTING’. GARAGE’

Verbal Synthesis Example: An Alarm Circuit

Page 31: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 31

cost criteria2-4

OR Gate

1. Literal cost2. Gate input cost: literals + terms

Page 32: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 32

Combinational Circuit Minimization

• Canonical sum and product logic expressions do not provide a circuit realization with the minimum number of gates.

• Minimization methods reduce the cost of two level AND-OR, NAND-NAND, OR-AND, NOR-NOR circuits in three ways:

1 By minimizing the number of first level gates

2 By minimizing the number of inputs of each first-level gate.

3 Minimizing the inputs of the second level gate

• Most minimization methods are based on the combining theorems T10, T10’:

Page 33: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 33

Karnaugh MapsKarnaugh Maps

• A Karnaugh Map or (K-map for short) is a graphical representation of the truth table of a logic function.

• The K-map for an n-input logic function is an array with 2n cells or squares, one for each input combination or minterm.

• The rows and columns are labeled so that the input combination for any cell is determined from the row and column headings.

• The row and columns of the map are ordered in such a way that each cell differs from an adjacent cell in only one input variable:

– Thus for an n-variable K-map, each cell has n adjacent cells.

• The K-map for a function is filled by putting:– a ‘1’ in the square corresponding to a minterm

– a ‘0’ otherwise (maybe omitted)

Page 34: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 34

2-Variable K-map2-Variable K-map

For a 2-variable logic function F(X,Y):

Row X Y F Minterm 0 0 0 F(0,0) X’.Y’ 1 0 1 F(0,1) X’.Y 2 1 0 F(1,0) X.Y’ 3 1 1 F(1,1) X .Y

Truth Table:

K-map

XY

0 1

0 1

Y

X

0 2

1 3

Example: For the function F(X,Y) = X,Y m(1,2,3)

Row X Y F 0 0 0 0 1 0 1 1 2 1 0 1 3 1 1 1

Truth Table: K-map

XY

0 1

0 1

Y

X

0 2

1 3

1

11

Page 35: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 35

3 variable Karnaugh mapTextbook convention

X’ Y Z’ X’ Y Z X’ Y Z X’ Y Z

XY’ Z’ X Y’Z X Y Z

0

1

X

YZ

00 01 11 10

X Y Z’

Page 36: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 36

3-Variable K-map

X

Y

0 1

00 01 11 10

Y

X

YZ

0

1

2

3

6

7

4

5

For a 3-variable logic function F(X,Y,Z):

Truth Table:K-mapRow X Y Z F Minterm

0 0 0 0 F(0,0,0) X’.Y’.Z’ 1 0 0 1 F(0,0,1) X’.Y’.Z 2 0 1 0 F(0,1,0) X’.Y.Z’ 3 0 1 1 F(0,1,1) X’.Y.Z 4 1 0 0 F(1,0,0) X.Y’.Z’ 5 1 0 1 F(1,0,1) X.Y’.Z 6 1 1 0 F(1,1,0) X.Y.Z’ 7 1 1 1 F(1,1,1) X.Y.Z

Example: For the function F(X,Y,Z) = X,Y,Z (1,4,6,7)

Truth Table:

K-map

Row X Y Z F 0 0 0 0 0 1 0 0 1 1 2 0 1 0 0 3 0 1 1 0 4 1 0 0 1 5 1 0 1 0 6 1 1 0 1 7 1 1 1 1

X

Y

0 1

00 01 11 10

Z

X

YZ

0

1

2

3

6

7

4

51

1

1 1

Page 37: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 37

4-Variable K-map4-Variable K-map

For a 4-variable logic function F(W,X,Y,Z):

W

Y

00

01

11

10

00 01 11 10

Z

WXYZ

X

0

1

3

2

4

5

7

6

12

13

15

14

8

9

11

10

Truth Table: K-map

Row W X Y Z F Minterm

0 0 0 0 0 F(0,0,0,0) W’.X’.Y’.Z’ 1 0 0 0 1 F(0,0,0,1) W’. X’.Y’.Z 2 0 0 1 0 F(0,0,1,0) W’. X’.Y.Z’ 3 0 0 1 1 F(0,0,1,1) W’. X’.Y.Z 4 0 1 0 0 F(0,1,0,0) W’. X.Y’.Z’ 5 0 1 0 1 F(0,1,0,1) W’.X.Y’.Z 6 0 1 1 0 F(0,1,1,0) W’.X.Y.Z’ 7 0 1 1 1 F(0,1,1,1) W’.X.Y.Z 8 1 0 0 0 F(1,0,0,0) W.X’.Y’.Z’ 9 1 0 0 1 F(1,0,0,1) W.X’.Y’.Z 10 1 0 1 0 F(1,0,1,0) W.X’.Y.Z’ 11 1 0 1 1 F(1,0,1,1) W.X’.Y.Z 12 1 1 0 0 F(1,1,0,0) W.X.Y’.Z’ 13 1 1 0 1 F(1,1,0,1) W.X.Y’.Z 14 1 1 1 0 F(1,1,1,0) W.X.Y.Z’ 15 1 1 1 1 F(1,1,1,1) W.X.Y.Z

Page 38: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 38

Minimization Using K-maps

• Group or combine as many adjacent 1-cells as possible:

– The larger the group is, the fewer the number of literals in the resulting product term.

– Grouping 2 adjacent 1-cells eliminates 1 variable, grouping 4 1-cells eliminates 2 variables, grouping 8 1-cells eliminates 3 variables, and so on. In general, grouping 2n squares eliminates n variables.

• Select as few groups as possible to cover all the 1-cells (minterms) of the function:

– The fewer the groups, the fewer the number of product terms in the minimized function.

Page 39: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 39

Karnaugh mapsExample 2-4 (Figure 2-14b, page 54, 3rd ed.)

0

1

X

YZ

00 01 11 10

F2(X,Y,Z) = m(0,2,4,5,6) = Z’ + XY’

1 1

11 1

• 1cell Square overlap is OK. Z’

XY’

000100010110

100101

Page 40: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 40

4 variable Karnaugh mapexample 2-5 (Figure 2-19, page 57, 3rd ed.)

00

01

11

10

WX

YZ

00 01 11 10

1 11 1

1 1

1 1

1

1

1

F(W,X,Y,Z) = m(0,1,2,4,5,5,8,9,12,13,14) = Y’ + W’Z’ + XZ’

000000011100110110001001

000000010100010100100110

0100110001101110

Page 41: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 41

prime/essential implicants

00

01

11

10

WX

YZ

00 01 11 10

1 11 1

1 1

1 1

1

1

1

F(X,Y,Z) = m(0,1,2,4,5,5,8,9,12,13,14) = Y’ + W’Z’ + XZ’

W’Z’ and XZ’ are prime implicants(each rectangle needs all its cells)Y’ is an essential prime implicant…(the rectangle contains exclusive (i.e., nonshared) cells

Selection rule: minimize overlap among prime implicants

Page 42: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 42

product of sums: Maxterms

00

01

11

10

WX

YZ

00 01 11 10

1 11 1

1 1

1 1

1

1

1

F(X,Y,Z) = m(0,1,2,4,5,5,8,9,12,13,14) = YZ + WX’Y (Y’ + Z’) (W’ + X + Y)

Selection rule: minimize overlap among prime implicants

00

0

0 0

Page 43: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 43

Y

0 1 1 0

X 0 1 0 1

Z

• x’z + y’z + xyz’.

Y

1 0 0 1

0 1 0 0

0 1 0 0X

W1 0 0 1

Z

x’z’ + xy’zY

w’x’y’z’ w’x’y’z w’x’yz w’x’yz’

w’xy’z’ w’xy’z w’xyz w’xyz’

wxy’z’ wxy’z wxyz wxyz’X

Wwx’y’z’ wx’y’z wx’yz wx’yz’

Z

More Examples…

Page 44: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 44

multilevel optimization2-6

OR Gate

Manipulate equations algebraically

G = AC’E + AC’F + AD’E + AD’F + BCDE’F’ = A (C’E + C’F + D’E + D’F) + BCDE’F’ = A (C’ + D’)(E + F) + BCDE’F’

Page 45: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 45

other gate types

OR Gate

See figures 2-22 and 2-23 in 4th edition

Page 46: Henry Hexmoor1 Computer Logic and Digital Design Chapter 2 Henry Hexmoor AND logic S1 S2 path? off off no on off no off on no on on yes input output S1

Henry Hexmoor 46

HW 2

OR Gate

1. Demonstrate by means of truth tables the validity of the following identity:

(XYZ)’ = X’ + Y’ + Z’(Q 2-1)2. Optimize the following Boolean function by means a

three-variable map:1. F(X,Y,Z) = m(1,3,6,7)(Q 2-14)