boolean expression simplificationgajski/eecs31/slides/digital_design_-_boolean... · principles of...

17
Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring Implicants and Prime Implicants K Maps Don’t Care Conditions

Upload: others

Post on 30-Apr-2020

23 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Principles Of Digital Design

Boolean Expression Simplification

Literal Minimization Boolean Factoring Implicants and Prime Implicants K Maps Don’t Care Conditions

Page 2: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine

Expression Minimization

Goal? Literal minimization Ex: xy + xy’ = x (y + y’) = x Ex: xyz + xyz’ +xy’z + xy’z’ = x (yz + yz’ + y’z + y’z’) = x

How? Visualization (few variables) K- Maps (2-6 variables)

Reality? CAD tools (many variables) Ex: 64-bit adder (64 variables, 2 terms)

2

64

Page 3: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 3

Boolean Functions and Factors Each Boolean function of n variables can be represented

by a truth table where each raw represents a minterm Each subset of n-m literals, l1l2…ln – m , is called a factor iff

l1l2…ln – m (any minterm of m variables) is a 1-minterm

x y z F 0 0 0 0

0 0 1 1

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 1

1 1 0 1

1 1 1 1

x y z F 0 0 0 0

0 0 1 1

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 1

1 1 0 1

1 1 1 1

y’z = (x’+ x) y’z

xy = xy(z’ + z)

z’ = (x’y’ + x’y + xy’ + xy)z

Page 4: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 4

Boolean Functions and Factors For any Boolean function a prime implicant is a factor not

contained in any other prime implicant An essential prime implicant is a factor that contains a 1-

minterm that is not included in any other prime implicant

x y z F 0 0 0 0

0 0 1 1

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 1

1 1 0 1

1 1 1 1

x y z F 0 0 0 0

0 0 1 1

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 1

1 1 0 1

1 1 1 1

y’z = (x’+ x) y’z

xy = xy(z’ + z)

z = (x’y’ + x’y + xy’ + xy)z

F = xy + z

x y z F 0 0 0 0

0 0 1 1

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 1

1 1 0 1

1 1 1 1

Page 5: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 5

K-maps define Boolean functions

Map representation is equivalent to truth tables, Boolean expressions

Maps aid in visually identifying prime implicants and essential prime implicants in each Boolean function

Maps are used for manual optimization of Boolean functions with few variables

Map Representation

Page 6: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 6

m0 m1

m2 m3

Karnaugh Maps for n = 1, 2, 3, and 4

n = 1 n = 2

n = 3 n = 4

1

0

1 0

m0 m1 m3 m2

m4 m5 m7 m6

m12 m13 m15 m14

m8 m9 m11 m10

m0 m1 m3 m2

m4 m5 m7 m6

10 11 01 00

10 11 01 00

1

0

01

00

10

11

x

y

yz x

x

zw xy

1 0

Page 7: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 7

0 1

2 3

2–variable K-Map

1 0

1

0

y

x 0 1

2 3

1 0

1

0

y

x

0 1

2 3

1 0

1

0

y

x 0 1

2 3

1 0

1

0

y

x 0 1

2 3

1 0

1

0

y

x

x′y′

1 1 1

1

1

1

x y AND OR XOR

0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0

x′y

xy′ xy

Truth Table

AND OR XOR

Map Organization Example of 1-factors

Example:

Factor x

Factor y

Factor x′

Page 8: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 8

Three–variable K-Map

1

0 0 1 3 2

4 5 7 6

10 11 01 00 yz

x

x′y′z′ x′y′z x′yz x′yz′

xy′z′ xy′z xyz xyz′

Map Organization

1

0 0 1 3 2

4 5 7 6

10 11 01 00 yz

x

Example of 2-factors

1

0 0 1 3 2

4 5 7 6

10 11 01 00 yz

x

Example of 1-factors

Factor xz′

Factor yz

Factor x′y′

Factor x

Factor z′

Factor z

Page 9: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 9

Maps for Carry and Sum Functions

ci xi yi ci + 1 si 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1

Truth Table Carry Function ci + 1 Sum Function si

1

0 0 1 3 2

4 5 7 6

10 11 01 00 xiyi

ci

1

1 1 1 1

0 0 1 3 2

4 5 7 6

10 11 01 00 xiyi

ci

1 1

1 1

si = xi′yi′ci + xi′yici′ + xiyi′ci′ + xiyici ci + 1 = xiyi + cixi + ciyi

Page 10: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 10

Four–variable K-Map

0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

10 11 01 00

01

00

10

11

zw xy

x′y′z′w′ x′y′z′w x′y′zw x′y′zw′

x′yz′w′ x′yz′w x′yzw x′yzw′

xyz′w′ xyz′w xyzw xyzw′

xy′z′w′ xy′z′w xy′zw xy′zw′

0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

10 11 01 00

01

00

10

11

zw xy

Factor w′

0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

10 11 01 00

01

00

10

11

zw xy

Factor x′

Factor y′w

Factor x′y

Factor xz

Map Organization

Example of 3-factors Example of 2-factors

Page 11: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 11

Simplification of Comparison Functions

0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

10 11 01 00

01

00

10

11

1 1 1

1 1

1

Less-than Function

x1 x0 y1 y0 Greater

Than Equal Less Than

0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 1 0 0 1 0 1 0 0 1 0 0 0 1 0 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1 0 0 1 1 0 0 0 1 0 0 1 0 0 1 1 0 0 1 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 0 1 0 0 1 1 1 1 0 1 0

0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

10 11 01 00

01

00

10

11

y1y0 x1x0

1

1 1 1

1 1

Greater-than Function

Truth Table

G = x1y1′ + x0y1′y0′ + x1x0y0′

y1y0 x1x0

L = x1′ y1 + x1′x0′y0 + x0′y1y0

Page 12: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 12

Boolean Simplification with Maps Truth table, canonical form

or standard form

Determine prime implicants

Generate map

Select essential prime implicants

Find minimal cover

Standard form

Page 13: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 13

Boolean Simplification with Maps Example: Maps method Problem: Using the map method, simplify the Boolean function

0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

10 11 01 00

01

00

10

11

yz wx

1 1 1

1 1

1 1

1 1 1

0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

10 11 01 00

01

00

10

11

yz

wx

1 1 1

1 1

1 1

1 1 1

F = w′y′z′ + wz + xyz + w′y

Map Organization

PI List: w′z′, wz, yz, w′y EPI List: w′z′, wz Cover List: (1) w′z′, wz, yz (2) w′z′, wz, w′y

Prime Implicants in the Map

Page 14: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 14

Boolean Simplification with Maps Example: Map method Problem: Simplify the Boolean function

0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

10 11 01 00

01

00

10

11

yz wx

1 1

1 1

1 1

1 1

F = w′x′yz′ + w′xy + wxz + wx′y′ + w′x′y′z′

PI List: w′x′z′, w′xy, wxz, wx′y′, x′y′z′, wy′z, xyz, w′yz′ EPI List: empty Cover List: (1) w′x′z′, w′xy, wxz, wx′y′ (2) x′y′z′, wy′z, xyz, w′yz′

Page 15: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 15

Don’t–Care Conditions

Completely specified functions have a value assigned for every minterm

Incompletely specified functions do not have values assigned for some minterms which are called don’t–care minterms (d–minterms) or don’t–care conditions

Don’t–care minterms can be assigned any value during simplifications in order to simplify Boolean expressions

Page 16: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 16

Don’t–Care Conditions Example: Don’t–care conditions

Problem: Derive Boolean expressions for the 9’s complement of a BCD digit

Digits Nine’s Complements

Decimal BCD

Decimal BCD

x3 x2 x1 x0 y3 y2 y1 y0

0 0 0 0 0 9 1 0 0 1 1 0 0 0 1 8 1 0 0 0 2 0 0 1 0 7 0 1 1 1 3 0 0 1 1 6 0 1 1 0 4 0 1 0 0 5 0 1 0 1 5 0 1 0 1 4 0 1 0 0 6 0 1 1 0 3 0 0 1 1 7 0 1 1 1 2 0 0 1 0 8 1 0 0 0 1 0 0 0 1 9 1 0 0 1 0 0 0 0 0

0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

10 11 01 00

01

00

10

11

x1x0

x3x2

1

X

1

X X

X

X

X

0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

10 11 01 00

01

00

10

11

x1x0

x3x2

0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

10 11 01 00

01

00

10

11

x1x0

x3x2

0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

10 11 01 00

01

00

10

11

x1x0

x3x2

X X X

X

X

X

X X X

X

X

X

X X X

X

X

X

1 1

1 1

1 1

1 1

1

1

1

1

1

y2 = x2 ⊕ x1 y3 = x3′ x2′ x1′

y0 = x0′ y1 = x1 K Maps Nine’s–Complement Table

Page 17: Boolean Expression Simplificationgajski/eecs31/slides/Digital_Design_-_Boolean... · Principles Of Digital Design Boolean Expression Simplification Literal Minimization Boolean Factoring

Copyright © 2010-2011 by Daniel D. Gajski EECS 31/CSE 31, University of California, Irvine 17

Summary

Simplification of Boolean expressions by K-Map method (visual for 2-6 variables))

Prime implicants

Essential prime implicants

Minimal cover