l4: karnaugh diagrams, two-, and multi-level minimization · pdf file ·...

48
L4: Karnaugh diagrams, two-, and multi-level minimization Elena Dubrova KTH / ICT / ES [email protected]

Upload: hakhuong

Post on 22-Mar-2018

225 views

Category:

Documents


3 download

TRANSCRIPT

L4: Karnaugh diagrams,

two-, and multi-level

minimization

Elena Dubrova

KTH / ICT / ES

[email protected]

Combinatorial system

A combinatorial system has no memory - its output depends

therefore ONLY on the PRESENT value of the input signal

a(t)

not(a(t))

Lecture 4 - Lecture 7

2 IE1204 Digital Design, Autumn 2014

Sequential system

A sequential system has a built-in memory - its output depends

therefore BOTH on the PRESENT and PREVIOUS value(s)

of the input signal

a(t)

f(a(t))

Lecture 8 - Lecture 13

3 IE1204 Digital Design, Autumn 2014

• BV pp. 168-211

This lecture covers …

IE1204 Digital Design, HT 2011 4

Example: Minterms of the function are m(1,2,3) or

f = x1x0 + x1x0 + x1x0

Using Boolean algebra, we can shorten the expression to:

f = x1x0 + x1x0 + x1x0 = x1x0 + x1(x0 + x0)

= x1x0 + x1 (1) = x1x0 + x1 (1 + x0) =

= x1x0 + x1 + x1x0 = x0 (x1 + x1) + x1 = x0 (1) + x1

= x1 + x0

Minimization of Boolean expressions

4 IE1204 Digital Design, Autumn 2014

• A minterm MUST contain all variables, otherwise it

is not a minterm

• A minterm represents the combination of values of

function's valiables for which the function evaluates

to 1

f = Sm(0,2,3) = x1x2x3+x1x2x3+x1x2x3

Minterms

5 IE1204 Digital Design, Autumn 2014

• A maxterm MUST contain all variables, otherwise it is

not a maxterm

• A minterm represents the combination of values of

function's valiables for which the function evaluates to 0

f = PM (0,2,3) = (x1+x2+x3) (x1+x2+x3) (x1+x2+x3)

Maxterms

6 IE1204 Digital Design, Autumn 2014

Commonly used functions in two-

dimensional table-form

0 0

0 1

0 1

1 1

0 1

1 0

1 1

1 0

1 0

0 0

1 0

0 1

1 0 AND OR XOR

NAND NOR XNOR

x0 x1

0

1

0 1 x0

x1

0

1

0 1 x0

x1

0

1

0 1

x0 x1

0

1

0 1 x0

x1

0

1

0 1 x0

x1

0

1

0 1

x0 0 1

NOT

7 IE1204 Digital Design, Autumn 2014

3-dimensional Boolean space

0 0 0 100

010

101

110

011 111

001

0-dimensional

subspace

1-dimensional

subspace

2-dimensional

subspace

8 IE1204 Digital Design, Autumn 2014

a

b

c

Size: abc

Karnaugh map

000 100

010 110

101

011 111

a

b

c

00 01

1

0

11 10

bc

a

Differ in the value

of only one variable

9 IE1204 Digital Design, Autumn 2014

001 b = 0

b = 1

Minimizing

000 100

010 110

101

011 111

a

b

c 1

1

1 1

1

0

1

10 IE1204 Digital Design, Autumn 2014

001

f(a,b,c) = Σm (0,2,3,5,7)

00 01 11 10

bc

a

Implicants

000 100

010 110

101

011 111

a

b

c 1

1

1 1

1

0

1

f (a,b,c) = Σm (0,2,3,5,7)

Circle the minterms

located "next” to

each other

11 IE1204 Digital Design, Autumn 2014

001 00 01 11 10

bc

a

• A given product-term in a sum-of-products

form consists of several variables

– Each of the variables may appear

complemented or non-complemented

– These variables are called literals

Literals and Product-Terms

IE1204 Digital Design, Autumn 2014 12

f(a,b,c) = abc + ab + bc

• A minterm always contains all variables of a

function

• A product-term may contain less variables

– Examples of minterms for three variable

functions:

abc, abc

– Examples of product-terms for three variable

functions:

abc, ab, a

Minterms and product-terms

IE1204 Digital Design, Autumn 2014 13

• Implicant - A product-term for which the function

evaluates to 1

• Prime implicant - An implicant which is not

contained in any other implicant

– A prime implicants cannot be expanded into a larger

implicant

• Cover is a set of implicants which contains all

minterms for which the function evaluates to 1

Implicants and Covers

14 IE1204 Digital Design, Autumn 2014

• A prime implicant is essential if there is a

minterm covered by that implicant, but no

other prime implicant

– Essential imlicants will always be included in a

cover of a function

• If we can remove an implicant, but all

minterms are still covered, then such an

implicant is called redundant

More implicant treminology

IE1204 Digital Design, Autumn 2014 15

Example

IE1204 Digital Design, Autumn 2014 16

000 100

010 110

101

011 111

a

b

c 1

1

1 1

1

00 01

0

1

11 10

bc

a

f (a, b, c) = Σm (0,2,3,5,7)

Redundant implicants -

both are not necessary

to cover the function

001

• Minimum cover is a cover with the

minimum number of cubes

• Prime cover is a cover consisting of only

prime implicants

• Irredundant cover is a cover which does

not contain any redundant implicants

Covers

IE1204 Digital Design, Autumn 2014 17

• Example: f (a, b, c, d) = abc + bd + cd is

minimum, prime and irredundant cover for f

Example

IE1204 Digital Design, Autumn 2014 18

0

0

0

1

0

1

0

0

cd 00 01 11 10

00

01

ab

1

0

1

0

1

1

1

0

11

10

• Quine's Theorem: For any Boolean function, there

exists a minimum cover which is prime

Exact minimization

IE1204 Digital Design, Autumn 2014 19

All

minimum

covers

All prime

covers

Consequence: The search for a minimum

cover can be restricted to covers with prime

implicants only

Two-level minimization

20 IE1204 Digital Design, Autumn 2014

Minimum sum-of-product

implementation

1

1

1 1

1

00 01

0

1

11 10

ac

b

f = bc + ac + bc

a b c

f

21 IE1204 Digital Design, Autumn 2014

• Both AND and OR

arrays are

programmable

Programmable Logic Array (PLA)

IE1204 Digital Design, Autumn 2014 22

f 1

P 1

P 2

f 2

x 1 x 2 x 3

OR

plane

AND

plane

P 3

P 4

• Only the AND arrays

are programmable

• Which functions

P1, P2, P3 and P4

represent ?

Programmable Array Logic (PAL)

IE1204 Digital Design, Autumn 2014 23

f 1

P 1

P 2

f 2

x 1 x 2 x 3

AND

plane

P 3

P 4

Karnaugh map with 4 variables

1 1

1 1

1 1

1 1

00 01 11 10

00

01

11

10

x1x0

x3x2

We always circle an entire sub-space (as large as possible) !!!

24 IE1204 Digital Design, Autumn 2014

Karnaugh map with 5 variables

25 IE1204 Digital Design, Autumn 2014

1

110 111 101 100

1

000 001 011 010

00

01

11

10

x4x1x0

x3x2

x3 x2 x1 x0

Example

26 IE1204 Digital Design, Autumn 2014

110 111 101 100

1

000 001 011 010

00

01

11

10

x2x1x0

x4x3

x3 x2 x1 x0

1

Karnaugh map with 6 variables

27 IE1204 Digital Design, Autumn 2014

1

110 111 101 100

1

000 001 011 010

000

001

011

010

110

111

101

100

x4x1x0

x5x3x2

1

1

x3 x2 x1 x0

Example

28 IE1204 Digital Design, Autumn 2014

1

110 111 101 100

1

000 001 011 010

000

001

011

010

110

111

101

100

x2x1x0

x5x4x3

1

1

x3 x2 x1 x0

Alternative: Circle 0s

Circle the zeros is zeros is less than ones !!!

29 IE1204 Digital Design, Autumn 2014

1 1 1 1

1 0 1

1 1 1 1

1 1 1 1

00 01 11 10

00

01

11

10

x1x0

x3x2

1 1 1 1 1

1 0 1

1 1 1 1

1 1 1 1

00 01 11 10

00

01

11

10

x1x0

x3x2

1 x3 x2 x1 x0 =

x3 + x2 +x1 +x0

• Often you can simplify a specification of the

logic function knowing that some input

combinations never occur

• For these combinations, we use the value

"don’t care"

• There are different symbols for "don't care"

– ’d', 'D', '-', 'ϕ', ’x'

Incomplete functions with

don’t cares

30 IE1204 Digital Design, Autumn 2014

Specification of incomplete functions

x 1

x 0

x 3

x 2

0

00 01 11 10

0 0 1

1 1 0 1

d d d d

0 0 0 1

00

01

11

10

x 2 x

1

x 1 x

0

(A) SOP implementation

Two implementations of the function

f (x3,..., x0) = Sm(2, 4, 5, 6, 10) + D(12, 13, 14, 15).

0

00 01 11 10

0 0 1

1 1 0 1

d d d d

0 0 0 1

00

01

11

10 x

2 x

1 + ( )

x 1

x 0

+ ( )

(B) POS implementations

x 1

x 0

x 3

x 2

31 IE1204 Digital Design, Autumn 2014

Alternative notation

x 1

x 0

x 3

x 2

0

00 01 11 10

0 0 1

1 1 0 1

- - - -

0 0 0 1

00

01

11

10

x 2 x

1

x 1 x

0

(A) SOP implementation

Two implementations of the function

f (x3,..., x0) = Sm(2, 4, 5, 6, 10) + D(12, 13, 14, 15).

0

00 01 11 10

0 0 1

1 1 0 1

- - - -

0 0 0 1

00

01

11

10 x

2 x

1 + ( )

x 1

x 0

+ ( )

(B) POS implementations

x 1

x 0

x 3

x 2

32 IE1204 Digital Design, Autumn 2014

Functions with multiple outputs

Different outputs can share implicants!

33 IE1204 Digital Design, Autumn 2014

1 0 1 1

0 0 0

0 0 0 1

1 0 1 1

00 01 11 10

00

01

11

10

x1x0

x3x2

1 1 0 1 1

0 0 0

1 0 0 1

1 0 1 1

00 01 11 10

00

01

11

10

x1x0

x3x2

1 f1= f0+x3x0

f0 f1

Multi-level minimization

34 IE1204 Digital Design, Autumn 2014

• One can realize all the combinational

circuits with two-level (AND-OR, OR-AND)

– The assumption is that all inputs are also

availible in the inverted form (as in PAL, PLA)

Do we need multi-level logic?

IE1204 Digital Design, Autumn 2014 35

• A multi-level implementation may have

considerably less gates than a two-level

implementation

Why multi-level logic?

IE1204 Digital Design, Autumn 2014 36

1. Factorisation

2. Functional Decomposition

Two strategies for multi-level logic

IE1204 Digital Design, Autumn 2014 37

• Suppose the following function is to be

implemented

Factorisation

IE1204 Digital Design, Autumn 2014 38

f x1x 2x3x 4 x5x6 x1x2x 3x 4x 5x6

• If we use the distributive law (L2, s.21,

12a), we can get the following multi-level

implementation:

Factorisation

IE1204 Digital Design, Autumn 2014 39

f x1x 2x3x 4 x5x6 x1x2x 3x 4 x 5x6

x1x 4 x6 (x 2x3x5 x2x 3x 5)

Factorization

IE1204 Digital Design, Autumn 2014 41

x 6

x 4

x 1

x 5

x 2

x 3

x 2

x 3

x 5

f x1x 4x6 (x 2x3x5 x2x 3x 5)

• One can often reduces the complexity of a

logic function by reusing its sub-functions

several times

• For implementation it means to share sub-

circuits in its construction

Functional decomposition

IE1204 Digital Design, Autumn 2014 42

• How can the following function

implemented?

Functional Decomposition

IE1204 Digital Design, Autumn 2014 43

f x 1x2x3 x1x 2x3 x1x2x4 x 1x 2x4

• Factorisation gives us

• If we define a sub-function g as

Functional Decomposition

IE1204 Digital Design, Autumn 2014 44

f x 1x2x3 x1x 2x3 x1x2x4 x 1x 2x4

(x 1x2 x1x 2)x3 (x1x2 x 1x 2)x4

2121 xxxxg

• So, we get

• where

Functional Decomposition

IE1204 Digital Design, Autumn 2014 45

f gx3 g x4

g x 1x2 x1x 2 x1x2 x 1x 2

Functional Decomposition

IE1204 Digital Design, Autumn 2014 46

1

x 2

x 3

x 4

f

g

h

x

x 1

x 2

x 3

x 4

f g

Implementation

g x 1x2 x1x 2 x1x2 x 1x 2

f gx3 g x4

• Karnaugh map minimization gives a good

insight into how to minimize logic functions

• But to minimize the complex functions with

the help of computer, there are better

algorithms

• Chapter 4.9 and 4.10 in Brown/Vranesic

provides an introduction to the minimization

algorithms (for the interested student)

Algorithms for minimization

IE1204 Digital Design, Autumn 2014 47

• Karnaugh maps are a good tool for

minimizing logic functions with a few

variables

• There are algorithms for both two-level and

multi-level minimization

• Next lecture: BV pp. 250-280

Summary

48 IE1204 Digital Design, Autumn 2014