Sei sulla pagina 1di 97

DIGITAL DESIGN FUNDAMENTALS

Logical Gates
Keep in mind that computers work on an electrical flow where a high voltage is considered a 1 and a low voltage is considered a 0. Using these highs and lows, data are represented. Electronic circuits must be designed to manipulate these positive and negative pulses into meaningful logic. Logic gates are the building blocks of digital circuits. Combinations of logic gates form circuits designed with specific tasks in mind. For example, logic gates are combined to form circuits to add binary numbers (adders), set and reset bits of memory (flip flops), multiplex multiple inputs, etc.
2

Binary Logic and Gates


Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic logical operators are the logic functions AND, OR and NOT. Logic gates implement logic functions.

Binary Variables
Recall that the two binary values have different names:
True/False On/Off Yes/No 1/0

We use 1 and 0 to denote the two values. Variable identifier examples:


A, B, y, z

Logical Operations
The three basic logical operations are:
AND OR NOT

AND is denoted by a dot (). OR is denoted by a plus (+). NOT is denoted by an overbar ( ), a single quote mark (') after, or (~) before the variable.

AND
x out y

x 0 0 1

y 0 1 0 1

out = xy 0 0 0 1

amplitude 0 1 0 1 Y(t) 0 0 1 1 X(t) 0 0 0 1

Output is one if every input has value of 1


More than two values can be and-ed together For example xyz = 1 only if x=1, y=1 and z=1

out(t)= x(t) and y(t)


6

OR
x y out = x+y

0
0 1 1

0
1 0 1

0
1 1 1

x out y

amplitude 0 1 0 1 Y(t) 0 0 1 1 X(t) 0 1 1 1 out(t)= x(t) or y(t)


7

Output is 1 if at least one input is 1. More than two values can be or-ed together. For example x+y+z = 1 if at least one of the three values is 1.

NOT
x x'
x x'

0
1

1
0

amplitude 0 1 0 1 x(t) 1 0 1 0 x'(t)

This function operates on a single Boolean value. Its output is the complement of its input. An input of 1 produces an output of 0 and an input of 0 produces an output of 1

NAND
x y out = x NAND y
x out y

0
0 1 1

0
1 0 1

1
1 1 0

amplitude 0 1 0 1 Y(t) 0 0 1 1 X(t) 1 1 1 0 out(t)= x(t) NAND y(t)

Output value is the complemented output from an AND function.

NOR
x 0 0 1 1 y 0 1 0 1 out = x NOR y 1 0 0 0
x out y

amplitude 0 1 0 1 Y(t) 0 0 1 1 X(t) 1 0 0 0 out(t)= x(t) nor y(t)

Output value is the complemented output from an OR function.

10

XOR (Exclusive OR)


x y out = x

y
x out y

0 0 1
1
amplitude 0 1 0 1

0 1 0
1

0 1 1
0

The number of inputs that are 1 matter.


Y(t)

More than two values can be xor-ed together.

0 0 1

1 X(t)

0 1 1

0 out(t)= x(t) xor y(t)

General rule: the output is equal to 1 if an odd number of input values are 1 and 0 if an even number of input values are 1.

11

XNOR
x 0 0 1 y 0 1 0 out =x xnor y 1 0 0
x out y

1
amplitude 0 1 0 1

Output value is the complemented output from an XOR function.


Y(t)

1 X(t)

1 0 0

1 out(t)= x(t) xnor y(t)


12

SUMMARY ON GATES
Inputs A 0 0 1 1 B 0 1 0 1 AND 0 0 0 1 Truth Table Outputs for each Gate NAND 1 1 1 0 OR 0 1 1 1 NOR 1 0 0 0 EX-OR EX-NOR 0 1 1 0 1 0 0 1

Logic Function AND OR NOT NAND NOR EX-OR EX-NOR

Boolean Notation A.B A+B A (A.B) (A+B) (A.B) + (A.B) or AB (A.B) + (AB) or (A B)

13

Truth Tables
Used to evaluate any logic function Consider F(X, Y, Z) = X Y + Y Z

X
0 0 0 0 1 1 1 1

Y
0 0 1 1 0 0 1 1

Z
0 1 0 1 0 1 0 1

XY
0 0 0 0 0 0 1 1

Y
1 1 0 0 1 1 0 0

YZ
0 1 0 0 0 1 0 0

F=XY+YZ
0 1 0 0 0 1 1 1
14

Logic Diagrams and Expressions


Truth Table
XYZ 000 001 010 011 100 101 110 111 0 1 0 0 1 1 1 1 Y Z F X F = X + Y Z

Logic Equation

F = X +Y Z
Logic Diagram

Boolean equations, truth tables and logic diagrams describe the same function! Truth tables are unique, but expressions and logic diagrams are not. This gives flexibility in implementing functions.
15

Why UNIVERSAL GATES


NAND and NOR both are called as universal gate. You can built any circuit or design using either NAND or NOR, this will be so flexible to fabricate any circuit in a single chip A universal gate is a gate which can implement any Boolean function without need to use any other gate type. In practice, this is advantageous since NAND and NOR gates are economical and easier to fabricate and are the basic gates used in all IC digital logic families. In fact, an AND gate is typically implemented as a NAND gate followed by an inverter not the other way around!! Likewise, an OR gate is typically implemented as a NOR gate followed by an inverter not the other way around!!

16

REALIZATION USING NAND


NOT GATE All NAND input pins connect to the input signal A gives an output A.

One NAND input pin is connected to the input signal A while all other input pins are connected to logic 1. The output will be A.

17

REALIZATION USING NAND


AND GATE An AND gate can be replaced by NAND gates as shown in the figure (The AND is replaced by a NAND gate with its output complemented by a NAND gate inverter).

18

REALIZATION USING NAND


OR GATE An AND gate can be replaced by NAND gates as shown in the figure (The AND is replaced by a NAND gate with its output complemented by a NAND gate inverter).

19

REALIZATION USING NOR


NOT GATE All NOR input pins connect to the input signal A gives an output A.

One NOR input pin is connected to the input signal A while all other input pins are connected to logic 0. The output will be A.

20

REALIZATION USING NOR


AND GATE An AND gate can be replaced by NOR gates as shown in the figure (The AND gate is replaced by a NOR gate with all its inputs complemented by NOR gate inverters)

21

REALIZATION USING NOR


OR GATE An OR gate can be replaced by NOR gates as shown in the figure (The OR is replaced by a NOR gate with its output complemented by a NOR gate inverter)

22

Boolean Algebra
A useful mathematical system for specifying and transforming logic functions. We study Boolean algebra as a foundation for designing and analyzing digital systems! 1854: Logical algebra was published by George Boole known today as Boolean Algebra Its a convenient way and systematic way of expressing and analyzing the operation of logic circuits. 1938: Claude Shannon was the first to apply Booles work to the analysis and design of logic circuits.
23

Commutative Laws
The commutative law of addition for two variables is written as: A+B = B+A
A B

A+B

B A

B+A

The commutative law of multiplication for two variables is written as: AB = BA


A B AB

B A

B+A

24

Associative Laws
The associative law of addition for 3 variables is written as:

A+(B+C) = (A+B)+C
A B C B+C A+(B+C)

A
B C

A+B

(A+B)+C

The associative law of multiplication for 3 variables is written as: A(BC) = (AB)C
A B C BC

A(BC)

A
B C

AB

(AB)C

25

Distributive Laws
The distributive law is written for 3 variables as follows:

A(B+C) = AB + AC
B C A B+C X A AB X

B A C

AC

X=A(B+C)

X=AB+AC

26

Rules of Boolean Algebra


1. A + 0 = A 2. A + 1 = 1 3. A 0 = 0 4. A 1 = A 5. A + A = A 6. A + A = 1
7. A A = A 8. A A = 0 9. A = A 10. A + AB = A 11. A + A B = A + B 12.( A + B)( A + C ) = A + BC

___________________________________________________________ A, B, and C can represent a single variable or a combination of variables.


27

deMorgans theoreMs
DeMorgans theorems provide mathematical verification of:
the equivalency of the NAND and negative-OR gates

the equivalency of the NOR and negative-AND gates.

28

deMorgans theoreMs
The complement of two or more ANDed variables is equivalent to the OR of the complements of the individual variables.
NAND

X Y = X + Y
NOR

Negative-OR

The complement of two or more ORed variables is equivalent to the AND of the complements of the individual variables.

Negative-AND

X + Y = X Y
29

deMorgans theoreMs (exercises)


Apply DeMorgans theorems to the expressions:
X Y Z X +Y + Z X +Y + Z W X Y Z
( A + B + C)D ABC + DEF AB + C D + EF A + BC + D ( E + F )
30

Boolean Expression for a Logic Circuit


To derive the Boolean expression for a given logic circuit, begin at the left-most inputs and work toward the final output, writing the expression for each gate.
C D

CD

B+CD
B

A(B+CD)

31

Boolean Algebra

An algebraic structure defined by a set B = {0, 1}, together with two binary operators (+ and ) and a unary operator ( )

1. 3. 5. 7. 9. 10.

X +0= X X+1=1 X+X=X X+X=1 X=X


X +Y =Y+ X

2. 4. 6. 8.

X .1=X X .0=0 X .X = X X .X = 0
XY = YX
(XY) Z = X(Y Z) X + YZ = (X + Y) (X + Z) X .Y = X + Y

Identity element Idempotence Complement Involution

11. 13. 15. 17.

Commutative Associative Distributive

12. (X + Y) + Z = X + (Y + Z) 14. X(Y + Z) = XY + XZ 16. X + Y = X . Y

DeMorgans
32

Some Properties of Boolean Algebra


Boolean Algebra is defined in general by a set B that can have more than two values A two-valued Boolean algebra is also know as Switching Algebra. The Boolean set B is restricted to 0 and 1. Switching circuits can be represented by this algebra. The dual of an algebraic expression is obtained by interchanging + and and interchanging 0s and 1s.

The identities appear in dual pairs. When there is only one identity on a line the identity is self-dual, i. e., the dual expression = the original expression.

Sometimes, the dot symbol (AND operator) is not written when the meaning is clear

33

Dual of a Boolean Expression


Example: F = (A + C) B + 0 dual F = (A C + B) 1 = A C + B Example: G = X Y + (W + Z) dual G = (X+Y) (W Z) = (X+Y) (W+Z) Example: H = A B + A C + B C dual H = (A+B) (A+C) (B+C) Unless it happens to be self-dual, the dual of an expression does not equal the expression itself Are any of these functions self-dual? H is self-dual (A+B)(A+C)(B+C)=(A+BC)(B+C)=AB+AC+BC

34

Boolean Operator Precedence


The order of evaluation is:
1. 2. 3. 4. Parentheses NOT AND OR

Consequence: Parentheses appear around OR expressions

Example: F = A(B + C)(C + D)


35

Boolean Algebraic Proof Example 1


A+AB=A Proof Steps A+AB =A1+AB = A ( 1 + B) =A1 =A (Absorption Theorem) Justification
Identity element: A 1 = A Distributive

1+B=1
Identity element

Our primary reason for doing proofs is to learn:


Careful and efficient use of the identities and theorems of Boolean algebra, and How to choose the appropriate identity or theorem to apply to make forward progress, irrespective of the application.
36

Boolean Algebraic Proof Example 2


AB + AC + BC = AB + AC (Consensus Theorem) Proof Steps Justification = AB + AC + BC = AB + AC + 1 BC Identity element = AB + AC + (A + A) BC Complement = AB + AC + ABC + ABC Distributive = AB + ABC + AC + ACB Commutative = AB 1 + ABC + AC 1 + ACB Identity element = AB (1+C) + AC (1 + B) Distributive = AB . 1 + AC . 1 1+X = 1 = AB + AC Identity element
37

Useful Theorems
Minimization XY+XY=Y Minimization (dual) (X+Y)(X+Y) = Y

Absorption X+XY=X Simplification X+XY=X+Y DeMorgans X+Y=XY

Absorption (dual) X (X + Y) = X Simplification (dual) X (X + Y) = X Y DeMorgans (dual) XY=X+Y


38

truth table to verify deMorgans

X+Y=XY
0 0 1 1 0 1 0 1 0 0 0 1 0 1 1 1 1 1 0 0 1 0 1 0

XY=X+Y
1 0 0 0 1 0 0 0 1 1 1 0 1 1 1 0

X Y XY X+Y X Y X+Y X Y XY X+Y

Generalized DeMorgans Theorem:


X 1 + X2 + + Xn = X 1 X 2 X n X 1 X 2 X n = X1 + X 2 + + Xn
39

Expression Simplification
An application of Boolean algebra Simplify to contain the smallest number of literals (variables that may or may not be complemented)

A B + A C D + A BD + A C D + A BC D
= AB + ABCD + A C D + A C D + A B D = AB + AB(CD) + A C (D + D) + A B D = AB + A C + A B D = B(A + AD) +AC = B (A + D) + A C (has only 5 literals)

40

Complementing Functions
Use DeMorgan's Theorem:
1. Interchange AND and OR operators 2. Complement each constant and literal

Example: Complement F = xy z + xyz

F = (x + y + z)(x + y + z)
Example: Complement G = (a + bc)d + e

G = (a (b + c) + d) e

41

Canonical Forms
Minterms and Maxterms

Sum-of-Minterm (SOM) Canonical Form


Product-of-Maxterm (POM) Canonical Form

Representation of Complements of Functions


Conversions between Representations

42

Minterms
Minterms are AND terms with every variable present in either true or complemented form. Given that each binary variable may appear normal (e.g., x) or complemented (e.g. x ), there are 2n minterms for n variables. Example: Two variables (X and Y) produce 2 x 2 = 4 combinations:
xy xy xy xy (both normal) (X normal, Y complemented) (X complemented, Y normal) (both complemented)

Thus there are four minterms of two variables.

43

Maxterms
Maxterms are OR terms with every variable in true or complemented form. Given that each binary variable may appear normal (e.g., x) or complemented (e.g., x), there are 2n maxterms for n variables. Example: Two variables (X and Y) produce 2 x 2 = 4 combinations: X + Y (both normal) X + Y (x normal, y complemented) X + Y (x complemented, y normal) X + Y (both complemented)

44

Minterms & Maxterms for 2 variables


Two variable minterms and maxterms.

Index

Minterm

Maxterm

0
0 1 1

0
1 0 1

0
1 2 3

m0 = x y
m1 = x y m2 = x y m3 = x y

M0 = x + y
M1 = x + y M2 = x + y M3 = x + y

The minterm mi should evaluate to 1 for each combination of x and y. The maxterm is the complement of the minterm
45

Minterms & Maxterms for 3 variables


x 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 Index 0 1 2 3 4 5 6 7 Minterm 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 = x y z Maxterm 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 = x + y + z

Maxterm Mi is the complement of minterm mi Mi = mi and mi = Mi


46

Purpose of the Index


Minterms and Maxterms are designated with an index The index number corresponds to a binary pattern The index for the minterm or maxterm, expressed as a binary number, is used to determine whether the variable is shown in the true or complemented form For Minterms:
1 means the variable is Not Complemented and
0 means the variable is Complemented.

For Maxterms:
0 means the variable is Not Complemented and
1 means the variable is Complemented.
47

Standard Order
All variables should be present in a minterm or maxterm and should be listed in the same order (usually alphabetically) Example: For variables a, b, c:
Maxterms (a + b + c), (a + b + c) are in standard order However, (b + a + c) is NOT in standard order (a + c) does NOT contain all variables Minterms (a b c) and (a b c) are in standard order However, (b a c) is not in standard order (a c) does not contain all variables

48

Sum-Of-Minterm (SOM)
Sum-Of-Minterm (SOM) canonical form: Sum of minterms of entries that evaluate to 1

x
0 0 0 0 1 1 1 1

y
0 0 1 1 0 0 1 1

z
0 1 0 1 0 1 0 1

F
0 1 0 0 0 0 1 1

Minterm
m1 = x y z

Focus on the 1 entries

m6 = x y z m7 = x y z

F = m1 + m6 + m7 = (1, 6, 7) = x y z + x y z + x y z
49

Sum-Of-Minterm Examples

F(a, b, c, d) = (2, 3, 6, 10, 11)


F(a, b, c, d) = m2 + m3 + m6 + m10 + m11

abcd abcd abcd abcd abcd + + + +


G(a, b, c, d) = (0, 1, 12, 15) G(a, b, c, d) = m0 + m1 + m12 + m15

abcd abcd abcd abcd + + +

50

Product-Of-Maxterm (POM)
Product-Of-Maxterm (POM) canonical form: Product of maxterms of entries that evaluate to 0

x
0 0 0 0 1 1 1 1

y
0 0 1 1 0 0 1 1

z
0 1 0 1 0 1 0 1

F
1 1 0 1 0 1 0 1

Maxterm
M2 = (x + y + z)

Focus on the 0 entries

M4 = (x + y + z)
M6 = (x + y + z)

F = M2M4M6 = (2, 4, 6) = (x+y+z) (x+y+z) (x+y+z)


51

Product-Of-Maxterm Examples
F(a, b, c, d) = (1, 3, 6, 11)
F(a, b, c, d) = M1 M3 M6 M11

(a+b+c+d) (a+b+c+d) (a+b+c+d) (a+b+c+d)


G(a, b, c, d) = (0, 4, 12, 15)
G(a, b, c, d) = M0 M4 M12 M15

(a+b+c+d)(a+b+c+d) (a+b+c+d)(a+b+c+d)
52

Observations
We can implement any function by "ORing" the minterms corresponding to the 1 entries in the function table. A minterm evaluates to 1 for its corresponding entry. We can implement any function by "ANDing" the maxterms corresponding to 0 entries in the function table. A maxterm evaluates to 0 for its corresponding entry. The same Boolean function can be expressed in two canonical ways: Sum-of-Minterms (SOM) and Product-of-Maxterms (POM). If a Boolean function has fewer 1 entries then the SOM canonical form will contain fewer literals than POM. However, if it has fewer 0 entries then the POM form will have fewer literals than SOM.

53

Converting to Sum-of-Minterms Form


A function that is not in the Sum-of-Minterms form can be converted to that form by means of a truth table

Consider F = y + x z
x y z
0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1

F
1 1 1 0 1 1 0 0

Minterm
m0 = x y z m1 = x y z m2 = x y z
m4 = x y z m5 = x y z

F = (0, 1, 2, 4, 5) = m0 + m1 + m2 + m4 + m5 = xyz+xyz+xyz+ xyz+xyz


54

Converting to Product-of-Maxterms Form


A function that is not in the Product-of-Minterms form can be converted to that form by means of a truth table Consider again: F = y + x z

x y z
0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1

F
1 1 1 0 1 1 0 0

Minterm

F = (3, 6, 7) = M3 M6 M7 =

M3 = (x+y+z)

(x+y+z) (x+y+z) (x+y+z)

M6 = (x+y+z) M7 = (x+y+z)
55

Conversions Between Canonical Forms

x
0 0 0 0 1 1 1 1

y
0 0 1 1 0 0 1 1

z
0 1 0 1 0 1 0 1

F
0 1 1 1 0 1 0 1

Minterm
m1 = x y z m2 = x y z m3 = x y z

Maxterm
M0 = (x + y + z)

M4 = (x + y + z) m5 = x y z M6 = (x + y + z) m7 = x y z

F = m1+m2+m3+m5+m7 = (1, 2, 3, 5, 7) = xyz+xyz+xyz+xyz+xyz F = M0 M4 M6 = (0, 4, 6) = (x+y+z)(x+y+z)(x+y+z)


56

Algebraic Conversion to Sum-of-Minterms Expand all terms first to explicitly list all minterms AND any term missing a variable v with (v + v) Example 1: f = x + x y (2 variables) f = x (y + y) + x y f=xy+xy+xy f = m3 + m2 + m0 = (0, 2, 3) Example 2: g = a + b c (3 variables) g = a (b + b)(c + c) + (a + a) b c g=abc+abc+abc+abc+abc+abc g=abc+abc+abc+abc+abc g = m2 + m4 + m5 + m6 + m7 = (2, 4, 5, 6, 7)
57

Algebraic Conversion to Product-of-Maxterms

Expand all terms first to explicitly list all maxterms OR any term missing a variable v with v v Example 1: f = x + x y (2 variables) Apply 2nd distributive law: f = ( x + x ) ( x + y ) = 1 ( x + y ) = ( x + y ) = M1 Example 2: g = a c + b c + a b (3 variables) g = (a c + b c + a) (a c + b c + b) (distributive) g = (c + b c + a) (a c + c + b) (x + x y = x + y) g = (c + b + a) (a + c + b) (x + x y = x + y) g = (a + b + c) (a + b + c) = M5 . M2 = (2, 5)

58

Function Complements
The complement of a function expressed as a sum of minterms is constructed by selecting the minterms missing in the sum-of-minterms canonical form Alternatively, the complement of a function expressed by a Sum of Minterms form is simply the Product of Maxterms with the same indices Example: Given F(x, y, z) = (1, 3, 5, 7)

F(x, y, z) = (0, 2, 4, 6) F(x, y, z) = (0, 2, 4, 6)

59

A Simplification Example:

S (1,4,5,6,7) Writing the minterm expression:


F( A, B, C) =

F = A B C + A B C + A B C + ABC + ABC Simplifying: F = A B C + A (B C + B C + B C + B C) F = A B C + A (B (C + C) + B (C + C)) F = A B C + A (B + B) F=ABC+A F=BC+A Simplified F contains 3 literals

60

AND/OR Two-Level Implementation


The two implementations for F are shown below
A B C A B C A B C A B C A B C
A B C F

It is quite apparent which is simpler!


61

Example
Minimize the following Boolean function using sum of products (SOP): f(a,b,c,d) = m(3,7,11,12,13,14,15)

abcd 3 0011 7 0111 11 1011 12 1100 13 1101 14 1110 15 1111

f(a,b,c,d) = m(3,7,11,12,13,14,15)

a`b`cd a`bcd ab`cd abc`d` abc`d abcd` abcd

=a`b`cd + a`bcd + ab`cd + abc`d`+ abc`d + abcd` + abcd =cd(a`b` + a`b + ab`) + ab(c`d` + c`d + cd` + cd ) =cd(a`[b` + b] + ab`) + ab(c`[d` + d] + c[d` + d]) =cd(a`[1] + ab`) + ab(c`[1] + c[1]) =ab+ab`cd + a`cd =ab+cd(ab` + a`) =ab+ cd(a + a`)(a`+b`) = ab + a`cd + b`cd = ab +cd(a` + b`) 62

Example
f(a,b,c,d) = M(0,1,2,4,5,6,8,9,10) =m(3,7,11,12,13,14,15)
=[(a+b+c+d)(a+b+c+d`)(a+b`+c`+d`) (a`+b+c`+d`)(a`+b`+c+ d)(a`+b`+c+ d`) (a`+b`+c`+d)(a`+b`+c`+d`)]

63

Karnaugh maps
A graphical technique for simplifying an expression into a minimal sum of products (MSP) form: There are a minimal number of product terms in the expression. Each term has a minimal number of literals. Circuit-wise, this leads to a minimal two-level implementation.

64

Karnaugh Maps (K-maps)


Karnaugh maps -- A tool for representing Boolean functions of up to six variables. K-maps are tables of rows and columns with entries represent 1`s or 0`s of SOP and POS representations. An n-variable K-map has 2n cells with each cell corresponding to an n-variable truth table value. K-map cells are labeled with the corresponding truth-table row. K-map cells are arranged such that adjacent cells correspond to truth rows that differ in only one bit position (logical adjacency). If mi is a minterm of f, then place a 1 in cell i of the K-map. If Mi is a maxterm of f, then place a 0 in cell i. If di is a dont care of f, then place a d or x in cell i.

65

2-Variable k-MAP
A two-variable function has four possible minterms. We can re-arrange these minterms into a Karnaugh map.
x 0 0 1 1 y 0 1 0 1 minterm xy xy xy xy

Y 0 1 0 xy xy 1 xy xy

Now we can easily see which minterms contain common literals. Minterms on the left and right sides contain y and y respectively. Minterms in the top and bottom rows contain x and x respectively.
Y 0 1 0 xy xy 1 xy xy
X X Y xy xy Y xy xy

66

Karnaugh map simplifications


Imagine a two-variable sum of minterms: xy + xy
X xy xy Y xy xy

Both of these minterms appear in the top row of a Karnaugh map, which means that they both contain the literal x.

What happens if you simplify this expression using Boolean algebra?


xy + xy = x(y + y) = x 1 = x [ Distributive ] [ y + y = 1 ] [x1=x]
67

More two-variable examples


Another example expression is xy + xy.
X xy xy Y xy xy

Both minterms appear in the right side, where y is uncomplemented. Thus, we can reduce xy + xy to just y.

How about xy + xy + xy
X xy xy

Y xy xy

We have xy + xy in the top row, corresponding to x. Theres also xy + xy in the right side, corresponding to y. This whole expression can be reduced to x + y.
68

A three-variable Karnaugh map


For a three-variable expression with inputs x, y, z, the arrangement of minterms is more tricky:
00 xyz xyz 01 xyz xyz YZ 11 xyz xyz 10 xyz xyz
00 m0 m4 01 m1 m5 YZ 11 m3 m7 10 m2 m6

0 1

0 1

Another way to label the K-map (use whichever you like):


Y X xyz xyz xyz xyz Z xyz xyz xyz xyz

Y X m0 m4 m1 m5 Z m3 m7 m2 m6

69

Why the funny ordering?


With this ordering, any group of 2, 4 or 8 adjacent squares on the map contains common literals that can be factored out.
Y X xyz xyz xyz xyz Z xyz xyz xyz xyz

xyz + xyz = xz(y + y) = xz 1 = xz

Adjacency includes wrapping around the left and right sides:


Y X xyz xyz xyz xyz Z xyz xyz xyz xyz

= = = =

xyz + xyz + xyz + xyz z(xy + xy + xy + xy) z(y(x + x) + y(x + x)) z(y+y) z

Well use this property of adjacent squares to do our simplifications.


70

Example K-map simplification


Lets consider simplifying f(x,y,z) = xy + yz + xz. First, you should convert the expression into a sum of minterms form, if its not already. The easiest way to do this is to make a truth table for the function, and then read off the minterms. You can either write out the literals or use the minterm shorthand. Here is the truth table and sum of minterms for our example:
x 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 f(x,y,z) 0 1 0 0 0 1 1 1

f(x,y,z)

= xyz + xyz + xyz + xyz = m1 + m5 + m6 + m7

71

Unsimplifying expressions
You can also convert the expression to a sum of minterms with Boolean algebra. Apply the distributive law in reverse to add in missing variables. Very few people actually do this, but its occasionally useful.
xy + yz + xz = (xy 1) + (yz 1) + (xz 1) = (xy (z + z)) + (yz (x + x)) + (xz (y + y)) = (xyz + xyz) + (xyz + xyz) + (xyz + xyz) = xyz + xyz + xyz + xyz

In both cases, were actually unsimplifying our example expression. The resulting expression is larger than the original one! But having all the individual minterms makes it easy to combine them together with the K-map.
72

Making the example K-map


Next up is drawing and filling in the K-map. Put 1s in the map for each minterm, and 0s in the other squares. You can use either the minterm products or the shorthand to show you where the 1s and 0s belong. In our example, we can write f(x,y,z) in two equivalent ways.
f(x,y,z) = xyz + xyz + xyz + xyz
Y X xyz xyz xyz xyz Z xyz xyz xyz xyz

f(x,y,z) = m1 + m5 + m6 + m7
Y X m0 m4 m1 m5 Z m3 m7 m2 m6

In either case, the resulting K-map is shown below.


Y X 0 0 1 1 Z
73

0 1

0 1

K-maps from truth tables


You can also fill in the K-map directly from a truth table. The output in row i of the table goes into square mi of the K-map. Remember that the rightmost columns of the K-map are switched.
x 0 0 0 0 y 0 0 1 1 z 0 1 0 1 f(x,y,z) 0 1 0 0

Y X
Y X 0 0 1 1 Z 0 1 0 1

m0 m4

m1 m5 Z

m3 m7

m2 m6

1 1 1 1

0 0 1 1

0 1 0 1

0 1 1 1

74

Grouping the minterms together


The most difficult step is grouping together all the 1s in the K-map. Make rectangles around groups of one, two, four or eight 1s. All of the 1s in the map should be included in at least one rectangle. Do not include any of the 0s.
Y X 0 0 1 1 Z 0 1 0 1

Each group corresponds to one product term. For the simplest result: Make as few rectangles as possible, to minimize the number of products in the final expression. Make each rectangle as large as possible, to minimize the number of literals in each term. Its all right for rectangles to overlap, if that makes them larger.
75

Reading the MSP from the K-map


Finally, you can find the MSP. Each rectangle corresponds to one product term. The product is determined by finding the common literals in that rectangle.
Y X xyz xyz xyz xyz Z xyz xyz xyz xyz
X 0 0 1 1 Z 0 1 Y 0 1

For our example, we find that xy + yz + xz = yz + xy. (This is one of the additional algebraic laws from last time.)
76

Practice K-map 1
Simplify the sum of minterms m1 + m3 + m5 + m6.
Y X Z

Y X m0 m4 m1 m5 Z m3 m7 m2 m6

77

Solutions for practice K-map 1


Here is the filled in K-map, with all groups shown.
The magenta and green groups overlap, which makes each of them as large as possible. Minterm m6 is in a group all by its lonesome.
Y X 0 0 1 1 Z 1 0 0 1

Final MSP here is xz + yz + xyz.

78

Four-variable K-maps
We can do four-variable expressions too! The minterms in the third and fourth columns, and in the third and fourth rows, are switched around. Again, this ensures that adjacent squares have common literals.
Y
Y

wxyz wxyz wxyz wxyz

wxyz wxyz wxyz wxyz Z

wxyz wxyz wxyz wxyz

wxyz wxyz X wxyz wxyz

m0 m4 m12 m8

m1 m5 m13 m9 Z

m3 m7 m15 m11

m2 m6 X m14 m10

Grouping minterms is similar to the three-variable case, but: You can have rectangular groups of 1, 2, 4, 8 or 16 minterms. You can wrap around all four sides.
79

Example: Simplify m0+m2+m5+m8+m10+m13


The expression is already a sum of minterms, so heres the K-map:
Y 1 0 0 1 0 1 1 0 Z
Y 1 0 0 1 0 1 1 0 Z 0 0 0 0 1 0 0 1 X

0 0 0 0

1 0 0 1

X
W

m0 m4 m12 m8

m1 m5 m13 m9 Z

m3 m7 m15 m11

m2 m6 m14 m10 Y

wxyz wxyz wxyz wxyz

wxyz wxyz wxyz wxyz Z

wxyz wxyz wxyz wxyz

wxyz wxyz X wxyz wxyz

We can make the following groups, resulting in the MSP xz + xyz.


80

K-maps can be tricky!


There may not necessarily be a unique MSP. The K-map below yields two valid and equivalent MSPs, because there are two possible ways to include minterm m7.
Y X 0 0 1 1 Z 0 1 1 1

Y X 0 0 1 1 Z 0 1 1 1
X 0 0 1 1 Z 0 1

Y 1 1

yz + yz + xy

yz + yz + xz

Remember that overlapping groups is possible, as shown above.

81

Examples
Two variable K-map f(A,B)=m(0,1,3)=A`B`+A`B+AB

A 0

B 0 1

1 1

0 1

82

Examples-Three variable map


f(A,B,C) = m(0,3,5)= A`B`C`+A`BC+AB`C
A`B` A`B 0 0 0 1
C` 0 C 1

A B 1 1

A B` 1 0

1
A`B`C`

1
A`BC

1
AB`C
83

Universal set A BC

Example

Simplify f= A`BC`+ A B C`+ A B C using;


(a) SumCof minterms. (b) Maxterms.
B Each cell of an n-variable K-mapAB n logically adjacent has (a) cells. AB C
0

BC 00
2

A 11
6 4

AB 10 C
0

A 00
2

01 1

01
6

11
4

10 0

0
1 3

1
7 5

0
1

0
3 7 5

C 1 B (b)

1 AB

C 1

B (c)

F`= B`+ A`C af(A,B,C) = AB + BC b-

F = B(A+C`) f(A,B,C) = B(A + C)


84

Maxterm example
(A+B) (A+B`) (A`+B`) (A`+B) A`B` A`B AB AB` C

C` 0

0
0

C` C

f(A,B,C) = M(1,2,4,6,7)
=(A+B+C`)(A+B`+C)(A`+B+C) )(A`+B`+C) (A`+B`+C`) Note that the complements are (0,3,5) which are the minterms of the previous example
85

Four variable example


(a) Minterm form. (b) Maxterm form. f(a,b,Q,G) = m(0,3,5,7,10,11,12,13,14,15) = M(1,2,4,6,8,9)

86

Example Simplify
f(A,B,C,D) = m(2,3,4,5,7,8,10,13,15)
AB CD
0

A 00
4

AB 10 CD
0

A 00
4

01
12

11
8

01
12

11
8

10 1

00
1 5

1
13 9

1 1
15 11

00
1 5

1
13 9

01
3 7

1 1
2 6

01 D 11
10 3 7

1
15

1
11

11 C 10

1
14

1 C 1

1
2 6

1
14

1
10

10

B (a) AB CD
0

B (b) A AB 10
8

A 00
0 4

00
4

01
12

11

CD 00
1

01
12

11
8

10 1

00
1 5

1
13 9

1 1
15 11

1
5 13 9

01
3 7

1 1
2 6

01 D 11
10 3 7

1
15

1
11

11 C 10

1
14

1 C 1

1
2 6

1
14

1
10

10

B (c)

B (d)

87

Example Multiple selections


f(A,B,C,D) = m(2,3,4,5,7,8,10,13,15)

AB CD
0

A 00
4

AB 10 CD
0

A 00
4

AB 10 CD
0

A 00
4

01
12

11
8

01
12

11
8

01
12

11
8

10 1

00
1 5

1
13 9

1 1
15 11

00
1 5

1
13 9

1 1
15 11

00
1 5

1
13 9

01
3 7

1 1
2 6

01 D 11
10 3 7

1 1
2 6

01 D 11
10 3 7

1
15

1
11

11 C 10

1
14

1 C 1

1
14

1 C 1

1
2 6

1
14

1
10

10

10

B (a)

B (b)

B (c)

c produces less terms than a

88

Example Redundant selections


f(A,B,C,D) = m(0,5,7,8,10,12,14,15)
AB CD
0

A 00
4

AB 10 CD
0

A 00
4

01
12

11
8

01
12

11
8

10 1
9

00
1

1
5 13

1
9

00
1

1
5 13

1 1

01
3 7

1
15 11

01 D 11
10 3 7

15

11

11 C 10
2 6

1
14

1 C 1 1

1
2 6 14

1
10

10

B (a) AB CD
0

B (b) A AB 10
8

A 00
0 4

00
4

01
12

11 1

CD 00
1

01
12

11
8

10 1
9

00
1

1
5 13

1
9

1
5 13

1 1

01
3 7

1
15 11

01 D 11
10 3 7

15

11

11 C 10
2 6

1
14

1 C 1 1

1
2 6 14

1
10

10

B (c)

B (d)

89

Example

90

Example
f(A,B,C,D) = m(1,2,4,6,9)
Step 2 AB CD
0

A 00
4

01
12

11
8

10 Step 1

00
1 5

1
13 9

01
3

1
7 15 11

1 D

11 C 10
2 6 14 10

Step 3

91

Example : 4 Variable K-Map


Example:
After labeling and transferring the truth table data into the K-Map, write the simplified sum-of-products (SOP) logic expression for the logic function F3.
R
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

S
0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

T
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

U
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

F3
0 1 0 1 0 1 1 1 0 1 0 0 1 0 1 1

92

Example : 4 Variable K-Map


Example:
After labeling and transferring the truth-table data into the K-Map, write the simplified sum-of-products (SOP) logic expression for the logic function F3. RU V
R
0 0 0 0 0 0

Solution:

S
0 0 0 0 1 1

T
0 0 1 1 0 0

U
0 1 0 1 0 1

F3
0 1 0 1 0 1

TU
RS RS

TU

TU

TU

0 0 1 0

1 1 0 1

1 1 1 0

0 1

0
0 1 1 1 1

1
1 0 0 0 0

1
1 0 0 1 1

0
1 0 1 0 1

1
1 0 1 0 0

ST
RS

RSU
RS

1
1 1 1

1
1 1 1

0
0 1 1

0
1 0 1

1
0 1 1

STU

F3 = R S U + S T U + R U + S T

93

dont care Conditions


A dont care condition, marked by (X) in the truth table, indicates a condition where the design doesnt care if the output is a (0) or a (1). A dont care condition can be treated as a (0) or a (1) in a K-Map.

Treating a dont care as a (0) means that you do not need to group it.
Treating a dont care as a (1) allows you to make a grouping larger, resulting in a simpler term in the SOP equation.

94

soMe you group, soMe you dont


C

VC 0 0

AB

X 1

This dont care condition was treated as a (1). This allowed the grouping of a single one to become a grouping of two, resulting in a simpler term.

AC

AB

AB
AB

0
X

0
0

There was no advantage in treating this dont care condition as a (1), thus it was treated as a (0) and not grouped.
95

Example : dont care Conditions


Example:
After labeling and transferring the truth table data into the K-Map, write the simplified sum-of-products (SOP) logic expression for the logic function F4. Be sure to take advantage of the dont care conditions. V
R
0 0 0 0 0 0

S
0 0 0 0 1 1

T
0 0 1 1 0 0

U
0 1 0 1 0 1

F4
X 0 1 X 0 X

0
0 1 1 1 1

1
1 0 0 0 0

1
1 0 0 1 1

0
1 0 1 0 1

X
1 1 1 1 X

1
1 1 1

1
1 1 1

0
0 1 1

0
1 0 1

X
0 0 0

96

Example : dont care Conditions


Example:
After labeling and transferring the truth table data into the K-Map, write the simplified sum-of-products (SOP) logic expression for the logic function F4. Be sure to take advantage of the dont care conditions. R T V
R
0 0 0 0 0 0

Solution:

S
0 0 0 0 1 1

T
0 0 1 1 0 0

U
0 1 0 1 0 1

F4
X 0 1 X 0 X

TU
RS RS

TU

TU

TU

X 0 X 1

0 X 0 1

X 1 0 X

1 X 0 1

0
0 1 1 1 1

1
1 0 0 0 0

1
1 0 0 1 1

0
1 0 1 0 1

X
1 1 1 1 X

RS

RS

RS

1
1 1 1

1
1 1 1

0
0 1 1

0
1 0 1

X
0 0 0

F4 = R T + R S

97

Potrebbero piacerti anche