two-level logic minimization prof. srinivas devadas mit ...keutzer/classes/... · the quine -...

57
1 Two-Level Logic Minimization Prof. Srinivas Devadas MIT Prof. Kurt Keutzer Prof. Richard Newton Prof. Sanjit Seshia University of California Berkeley, CA

Upload: others

Post on 14-Feb-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

1

Tw

o-L

evel

Lo

gic

Min

imiz

ati

on

Pro

f. S

rin

iva

s D

ev

ad

as

MIT

Pro

f. K

urt

Ke

utz

er

Pro

f. R

ich

ard

Ne

wto

n

Pro

f. S

an

jit

Se

sh

ia

Un

ive

rsit

y o

f C

ali

forn

ia

Be

rke

ley,

CA

Page 2: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

2

To

pic

s

•M

oti

vati

on

•B

oo

lean

fu

ncti

on

s &

no

tati

on

•E

xact

2-l

evel lo

gic

min

imiz

ati

on

–Q

uin

e-M

cC

luske

y

•H

eu

risti

c 2

-level m

inim

izati

on

–M

INI, E

sp

resso

Page 3: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

3

Sch

em

ati

c E

ntr

y E

ra

Giv

en

:

•G

ate

-level sch

em

ati

c e

ntr

y e

dit

or

•G

ate

-level sim

ula

tor

(we h

aven

’t t

alk

ed

ab

ou

t th

is)

•G

ate

level sta

tic-t

imin

g a

naly

zer

•N

etl

ist� ���

Layo

ut

flo

w

•W

e c

an

(an

d d

id)

bu

ild

larg

e-s

cale

in

teg

rate

d (

35,0

00 g

ate

) cir

cu

its

•E

DA

ven

do

rs p

rovid

ed

fro

nt-

en

d t

oo

ls a

nd

AS

IC v

en

do

r (e

.g.

LS

I L

og

ic)

pro

vid

ed

back-e

nd

flo

w

•B

ut

…It

ma

y b

e m

uch

mo

re n

atu

ral, a

nd

pro

du

cti

ve, to

d

escri

be c

om

ple

x c

on

tro

l lo

gic

by B

oo

lean

eq

uati

on

s t

han

by

a s

ch

em

ati

c n

etl

ist

of

gate

s

Page 4: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

4

Fo

r exam

ple

: tr

aff

ic lig

ht

co

ntr

oller

Page 5: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

5

As a

Sta

te t

ran

sit

ion

dia

gra

m

Page 6: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

6

Syn

thesiz

e L

og

ic t

o Im

ple

men

t eq

uati

on

s

B

Fli

p-f

lop

s

Co

mb

inati

on

al

Lo

gic

inputs

outp

uts

Desc

rib

e u

sin

g B

oo

lean

eq

uati

on

s

Page 7: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

7

Ph

ys

ica

lly I

mp

lem

en

t: A

ND

-OR

an

d N

OR

-NO

R P

LA

s

I1 I2

O1

O2

I1 I2

O1

O2

Lo

gic

in

cre

as

es w

ith

th

e n

um

ber

of

pro

du

ct

term

s

Page 8: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

8

Earl

y “

Syn

thesis

”F

low

FS

MS

yn

thesis

FS

M

log

ic

SO

P l

og

ico

pti

miz

ati

on

PL

A

ph

ysic

al

desig

n

layo

ut

F1 =

B +

D +

A C

+ A

C

I1 I2

O1

O2

Page 9: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

9

Key T

ech

no

log

y:

SO

P L

og

ic M

inim

izati

on

Can

reali

ze a

n a

rbit

rary

lo

gic

fu

ncti

on

in

su

m-o

f-p

rod

ucts

or

two

-level fo

rm

F1 =

A B

+ A

B D

+ A

B C

D

+ A

B C

D +

A B

+ A

B D

F1 =

B +

D +

A C

+ A

C

Of

gre

at

inte

rest

to f

ind

a m

inim

um

su

m-o

f-p

rod

ucts

rep

res

en

tati

on

Page 10: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

10

Defi

nit

ion

s -

1

Ba

sic

defi

nit

ion

s:

Let

B =

{0, 1}

an

dY

= {

0, 1, 2}

Inp

ut

vari

ab

les:

X1, X

2…

Xn

Ou

tpu

t vari

ab

les:

Y1,

Y2

…Y

m

A l

og

ic f

un

cti

on

ff

(or

Bo

ole

an

fu

ncti

on

, sw

itch

ing

fu

ncti

on

) in

nin

pu

ts a

nd

m

ou

tpu

ts i

s t

he m

ap

ff:

Bn

Ym

do

n’t

care

–aka

“X

Page 11: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

11

Defi

nit

ion

s -

2

If b

∈ ∈∈∈B

nis

map

ped

to

a 2

th

en

fu

ncti

on

is

inco

mp

lete

ly s

pe

cif

ied

, els

e c

om

ple

tely

sp

ecif

ied

OF

F-S

ET

iB

n, th

e s

et

of

all in

pu

t valu

es

for

wh

ich

ff i(x

) =

0

DC

-SE

Ti

Bn, th

e s

et

of

all in

pu

t valu

es

for

wh

ich

ff i(x

) =

2

Fo

r each

ou

tpu

t w

e d

efi

ne:

ON

-SE

Ti

Bn,

the s

et

of

all in

pu

tvalu

es f

or

wh

ich

ff i(x

) =

1

Page 12: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

12

Th

e B

oo

lean

n-C

ub

e, B

n

Page 13: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

13

Lit

era

ls

Gre

en

–O

N-s

et

Red

–O

FF

-set

Page 14: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

14

Bo

ole

an

Fo

rmu

las -

-S

yn

tax

Page 15: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

15

“S

em

an

tic”

Descri

pti

on

of

Bo

ole

an

F

un

cti

on

EX

AM

PL

E:

Tru

th t

ab

le f

orm

of

an

in

co

mp

lete

ly s

pe

cif

ied

fu

ncti

on

ff:

B3

Y2

Y1:

ON

-SE

T1 =

{

000, 001, 100, 101, 110}

OF

F-S

ET

1=

{

010, 011}

DC

-SE

T1

= {

111}

X1 X

2X

3Y

1Y

2

0 0

0 1

1

0 0

1 1

0

0 1

0 0

1

0 1

1 0

1

1 0

0 1

0

1 0

1 1

2

1 1

0 1

1

1 1

1 2

1

Page 16: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

16

Cu

be R

ep

resen

tati

on

F1 =

A

B +

A B

D +

A B

C D

+ A

B C

D +

A B

+ A

B D

F1 =

B +

D +

A C

+ A

C

min

imu

m r

ep

resen

tati

on

0 0

--

1

0 1

-1

10 1

0 0

1

1 1

1 0

1

1 0

--

11 1

-1 1

-0 -

-1

--

-1

10 -

0 -

11 -

1 -

1

Inp

uts

Ou

tpu

ts

Page 17: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

17

Op

era

tio

ns o

n L

og

ic F

un

cti

on

s

(1)

Co

mp

lem

en

t: f

f

inte

rch

an

ge O

N a

nd

OF

F-S

ET

S

(2)

Pro

du

ct

(or

inte

rsecti

on

or

log

ical

AN

D)

h =

f • •••

go

r h

= f

∩ ∩∩∩g

(3)

Su

m (

or

un

ion

or

log

ical O

R):

h =

f +

go

r h

= f

∪ ∪∪∪g

(4)

Dif

fere

nce

h

= f

-g

= f

∩ ∩∩∩g

Page 18: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

18

Pri

me Im

plican

ts

A c

ub

e p

is a

n im

plican

t o

ff

if it

do

es n

ot

inte

rsect

the O

FF

-SE

T o

f f

p f

ON

∪ ∪∪∪f D

C(o

r p

∩ ∩∩∩f O

FF

= 0

)

A p

rim

e im

plican

t o

f f

is a

n im

plican

t p

su

ch

th

at

(1)

No

oth

er

imp

lican

t q

is s

uch

th

at

q⊃ ⊃⊃⊃

pin

th

e s

en

se t

hat

qco

vers

all

vert

ices o

f p

(2)

fD

C⊃ ⊃⊃⊃

p

A m

inte

rmis

a f

ull

y s

pecif

ied

im

plican

te.g

., 011, 111

(no

t 01-)

Page 19: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

19

Exam

ple

s o

f Im

plican

ts/P

rim

es

X1 X

2X

3Y

1

0 0

0 1

0 0

1 1

0 1

0 0

0 1

1 0

1 0

0 1

1 0

1 1

1 1

0 1

1 1

1 2

000, 00-

are

im

plican

ts, b

ut

no

t p

rim

es (

-0-

)

1-1

0-0

Page 20: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

20

Pri

me a

nd

Irr

ed

un

dan

t C

overs

A c

over

is a

set

of

cu

bes C

su

ch

th

at

C

⊇ ⊇⊇⊇f O

Nan

dC

f

ON

∪ ∪∪∪f D

C

All o

f th

e O

N-s

et

is c

overe

d b

y C

C is c

on

tain

ed

in

th

e O

N-s

et

an

d D

on

’t C

are

Set

A p

rim

e c

over

is a

co

ver

wh

ose c

ub

es a

re a

ll p

rim

e

imp

lican

ts

An

irr

ed

un

dan

t co

ver

is a

co

ver

Csu

ch

th

at

rem

ovin

g a

ny c

ub

e f

rom

Cre

su

lts in

a s

et

of

cu

bes t

hat

no

lo

ng

er

co

vers

th

e f

un

cti

on

Page 21: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

21

Min

imu

m c

overs

A m

inim

um

co

ver

is a

co

ver

of

min

imu

m

card

inali

ty

Th

eo

rem

: A

min

imu

m c

over

can

alw

ays b

e

fou

nd

by r

estr

icti

ng

th

e s

earc

h t

o p

rim

e

an

d i

rred

un

dan

t co

vers

.

Giv

en

an

y c

over

C(a

) if

red

un

dan

t, n

ot

min

imu

m

(b)

if

an

y c

ub

e q

is n

ot

pri

me, re

pla

ce q

wit

h p

rim

e p

⊃ ⊃⊃⊃q

an

d c

on

tin

ue u

nti

l all

cu

bes p

rim

e;

it is a

min

imu

m p

rim

e c

over

Page 22: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

22

Exam

ple

Co

vers

X1 X

2X

3Y

1

0 0

0 1

0 0

1 1

0 1

0 0

0 1

1 0

1 0

0 1

1 0

1 1

1 1

0 1

1 1

1 2

0 0

-1 0

-is

a c

over.

Is

it

pri

me?

1 1

-Is

it

irre

du

nd

an

t?

Wh

at

is a

min

imu

m p

rim

e a

nd

ir

red

un

dan

t co

ver

for

the f

un

cti

on

?

Page 23: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

23

Exam

ple

Co

vers

X1 X

2X

3Y

1

0 0

0 1

0 0

1 1

0 1

0 0

0 1

1 0

1 0

0 1

1 0

1 1

1 1

0 1

1 1

1 2

0 0

-1 0

-is

a c

over.

Is

it

pri

me?

1 1

-Is

it

irre

du

nd

an

t?

-0 -

1 1

-is

a c

over.

Is it

pri

me?

Is it

irre

du

nd

an

t?Is

it

min

imu

m?

Wh

at

is a

min

imu

m p

rim

e a

nd

ir

red

un

dan

t co

ver

for

the f

un

cti

on

?

Page 24: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

24

Th

e Q

uin

e-

McC

luskey

Meth

od

Ste

p 1

:L

ist

all m

inte

rms

in O

N-S

ET

an

d D

C-S

ET

Ste

p 2

:U

se a

pre

scri

bed

seq

uen

ce o

f ste

ps t

o f

ind

all t

he p

rim

e

imp

lican

tso

f th

e f

un

cti

on

Ste

p 3

:C

on

str

uct

the p

rim

e im

plican

tta

ble

Ste

p 4

:F

ind

a m

inim

um

set

of

pri

me

imp

lican

tsth

at

co

ver

all t

he

min

term

s

Page 25: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

25

Exam

ple

0 5 7 8 9 10

11

14

15

0000

0101

0111

1000

1001

1010

1011

1110

1111

0,8

5,7

7,1

5

8,9

8,1

0

9,1

1

10,1

1

10,1

4

11,1

5

14,1

5

-000 E

01-1

D

-111 C

100-

10-0

10-1

101-

1-1

0

1-1

1

111-

8,9

,10,1

110--

B

10,1

1,1

4,1

51-1

-A

A B

C

D

E

are

pri

me im

plican

ts

Page 26: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

26

Pri

me Im

plican

t T

ab

le

AB

CD

E XX

XX

XX

XX

XX

XX X

X

0 5 7 8 9 10

11

14

15

Min

term

s(O

N-S

ET

on

ly)

X’s

in

dic

ate

min

term

sco

vere

d b

y P

Is

Page 27: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

27

Essen

tial P

rim

e Im

plican

ts

Ro

w w

ith

a s

ing

le X

iden

tifi

es a

n e

ssen

tial

pri

me

imp

lican

t (E

PI)

Ess

en

tial P

I’s

E, D

, B

, A

⇒ ⇒⇒⇒

Fo

rm m

inim

um

co

ver

AB

CD

E XX

XX

XX

XX

XX

XX X

X

0 5 7 8 9 10

11

14

15

Page 28: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

28

Do

min

ati

ng

Ro

ws

In g

en

era

l E

PIs

do

no

t fo

rm a

co

ver

At

Ste

p 4

, w

e n

eed

to

sele

ct

PIs

to

ad

d t

o

the E

PIs

so

as t

o f

orm

a m

inim

um

co

ver

AB

CD

FG

XX

XX

XX

XX

XX

XX

XX

X

1 8 9 24

25

27

Ro

w 9

do

min

ate

s 8

Ro

w 2

5 d

om

inate

s 2

4

Can

rem

ove 8

sin

ce c

overi

ng

9 im

plies c

overi

ng

of

8

Page 29: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

29

Do

min

ati

ng

Co

lum

ns

Fd

om

inate

s

D

Can

rem

ove

Dsin

ce

Fco

vers

all m

inte

rms

Dco

vers

Can

th

is h

ap

pen

in

th

e o

rig

inal ta

ble

?

Ma

y h

ap

pen

aft

er

rem

oval o

f P

Is

AB

CD

FG

XX

XX

XX

XX

XX

XX

XX

X

1 8 9 24

25

27

Page 30: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

30

Ste

p 4

Issu

es

Rem

oval

of

do

min

ati

ng

co

lum

ns o

r d

om

inate

d r

ow

s m

ay in

tro

du

ce c

olu

mn

s

wit

h s

ing

le X

’s.

–N

eed

to

ite

rate

A c

over

ma

y s

till n

ot

be f

orm

ed

aft

er

all

ess

en

tial ele

men

ts a

nd

do

min

an

ce

rela

tio

ns h

ave b

een

rem

oved

–N

eed

to

bra

nch

over

po

ssib

le

so

luti

on

s

Page 31: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

31

Recu

rsiv

e B

ran

ch

ing

(S

tep

4)

(a)

Sele

ct

EP

Is,

rem

ove d

om

inate

d c

olu

mn

s

an

d d

om

inati

ng

ro

ws ite

rati

vely

till ta

ble

d

oes n

ot

ch

an

ge

(b)

If t

he s

ize o

f th

e s

ele

cte

d s

et

(+ lo

wer

bo

un

d)

exceed

s o

r eq

uals

best

so

luti

on

so

far,

retu

rn f

rom

th

is level

of

recu

rsio

n. If

no

ele

men

ts l

eft

to

be

co

vere

d,

decla

re s

ele

cte

d s

et

as t

he

best

so

luti

on

reco

rded

.

(c)

Sele

ct

(heu

risti

call

y)

a b

ran

ch

ing

co

lum

n.

Page 32: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

32

Recu

rsiv

e B

ran

ch

ing

(S

tep

4)

-2

(d)

Giv

en

th

e s

ele

cte

d c

olu

mn

, re

cu

r

–O

n t

he s

ub

-tab

le r

esu

ltin

g f

rom

d

ele

tin

g t

he c

olu

mn

an

d a

ll r

ow

s

co

vere

d b

y t

his

co

lum

n. A

dd

th

is

co

lum

n t

o t

he s

ele

cte

d s

et.

–O

n t

he s

ub

-tab

le r

esu

ltin

g f

rom

d

ele

tin

g t

he c

olu

mn

wit

ho

ut

ad

din

g it

to t

he s

ele

cte

d s

et.

Page 33: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

33

Exam

ple

-a1

No

ess

en

tial

pri

mes, d

om

inate

d r

ow

s o

r co

lum

ns.

Sele

ct

pri

me A

AB

CD

EF

GH

XX

XX X

X XX

XX

XX

XX

XX

0 1 5 7 8 10

14

15

Page 34: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

34

Exam

ple

-a2

BC

DE

FG

HX

X XX

XX

XX

XX

XX

5 7 810

14

15

Bis

do

min

ate

d b

y C

His

do

min

ate

d b

y G

Rem

ove B

, H

Sele

cte

d s

et

= {

A}

Page 35: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

35

Exam

ple

-a3

C D

EF

GX X

XX

XX

XX

XX

5 7 810

14

15

C, G

essen

tial to

this

tab

le

Sele

cte

d s

et

= {

A, C

, G

}

D E

FX

XX

X14

15

Sele

cte

d s

et

= {

A, C

, G

, E

}

Page 36: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

36

Exam

ple

-b

1

Sele

cte

d s

et

= {

}B

CD

EF

GH X

X XX X

XX

XX

XX

XX

X

0 1 5 7 810

14

15

Ess

en

tial p

rim

es

in t

his

tab

leare

B,

H

Sele

cte

d s

et

= {

B, H

}

CD

EF

GX

XX

XX

XX

X

710

14

15

Sele

cte

d s

et

= {

B, H

, D

, F

}

Page 37: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

37

Eff

icie

nt

low

er

bo

un

din

g a

t S

tep

4(b

) to

term

inate

u

np

rofi

tab

le s

earc

hes h

igh

in

th

e r

ecu

rsio

n

Siz

e o

f sele

cte

d s

et

+ L

ow

er

bo

un

d e

qu

als

or

exceed

s b

est

so

luti

on

alr

ead

y k

no

wn

, q

uit

level

of

recu

rsio

n

Esp

resso

-Exact

(1987)

Inclu

de

AD

iscard

A

Inclu

de

B

Inclu

de C

Ob

tain

co

ver

wit

h c

ost

10

Dis

card

B

Co

mp

ute

lo

wer

bo

un

d o

f 9

Page 38: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

38

Lo

wer

Bo

un

din

g

Lo

wer

bo

un

d:

Maxim

al

ind

ep

en

den

t set

of

row

s a

ll o

f w

hic

h a

re

pair

wis

ed

isjo

int

Maxim

al

ind

ep

en

den

t set

= {

1, 4, 8}

or

{0, 6, 10}

Need

to

sele

ct

at

least

on

e P

I/co

lum

n t

o c

ove

r ea

ch

ro

w.

NO

TE

: F

ind

ing

maxim

um

ind

ep

en

den

t set

is i

tself

NP

-hard

AB

CD

EF

XX

XX

XX

XX

XX

XX

X

0 1 4 6 810

12

Page 39: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

39

Co

mp

lexit

y o

f Q

-M b

ased

Meth

od

s

(1)

Th

ere

exis

t fu

ncti

on

s f

or

wh

ich

th

e

nu

mb

er

of

pri

me im

plican

tsis

O(3

n)

(nis

nu

mb

er

of

inp

uts

)

(2)

Giv

en

a P

I ta

ble

, re

cu

rsiv

e b

ran

ch

ing

co

uld

re

qu

ire O

(2m

)ti

me (

mis

th

e n

um

ber

of

PIs

)

Cu

rren

t lo

gic

min

imiz

ers

ab

le t

o f

ind

exact

so

luti

on

s f

or

fun

cti

on

s w

ith

20-2

5 in

pu

t vari

ab

les

⇒ ⇒⇒⇒N

eed

heu

risti

c m

eth

od

s f

or

larg

er

fun

cti

on

s

Page 40: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

40

Heu

risti

c L

og

ic M

inim

izati

on

Pre

sen

tly,

there

ap

pears

to

be a

lim

it o

f ~

20-2

5 i

np

ut

va

riab

les i

n p

rob

lem

s t

hat

can

be h

an

dle

d b

y e

xa

ct

min

imiz

ers

Eas

y f

or

co

mp

lex c

on

tro

l lo

gic

to

excee

d 2

0-

25 i

np

ut

va

riab

les

HIS

TO

RY

50’s

Karn

au

gh

Map

≤ ≤≤≤5 v

ari

ab

les

60’s

Q-M

meth

od

< 1

0 v

ari

ab

les

70’s

Sta

rner,

Die

tme

yer

< 1

5 v

ari

ab

les

1974

MIN

Ih

eu

risti

c

1980-8

4E

SP

RE

SS

Oap

pro

ach

es

1986

McB

oo

le<

25 v

ari

ab

les

1987

ES

PR

ES

SO

-EX

AC

T <

25 v

ari

ab

les

Page 41: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

41

Als

o, M

ult

iple

Ou

tpu

t F

un

cti

on

s

Tru

th t

ab

le is A

ND

-OR

rep

resen

tati

on

AN

D O

Ra b

c

f

g

0 1

− −−−1 0

0 1

1

1 1

1 0

1

0 1

Wh

at

do

es v

ecto

r 0

1 1

pro

du

ce?

ON

-SE

T o

f f

=

{0

1 − −−−

, 0 1

1}

= {0

1 − −−−

}

ON

-SE

T o

f g

= {0

1 1

, 1 0

1}

Page 42: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

42

Mu

ltip

le-O

utp

ut

Fu

ncti

on

Pri

mes

Sam

e d

efi

nit

ion

as in

sin

gle

-ou

tpu

t case

–C

ub

e w

ith

mo

st

min

term

sth

at

will in

ters

ect

OF

F-S

ET

if

yo

u a

dd

an

y m

ore

min

term

sto

th

em

f g

CU

BE

TY

PE

.

0 0

0 0

1 0

0 0

0 0

1

00 0

0 1

1 0

0 0

0 − −−−

1 0

1 0

0 1

1 0

1 0

0 1

1

00 0

0 0

0 1

1 0

0 1

1

10 0

1 0

0 1

0 0

0 − −−−

1 1

1 0

0 1

0 1

Page 43: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

43

MIN

I

S.J

. H

on

g, R

.G. C

ain

, D

.L. O

sta

pko

-1974

Fin

al so

luti

on

is o

bta

ined

fro

m in

itia

l so

luti

on

by

itera

tive im

pro

vem

en

t ra

ther

than

by g

en

era

tin

g

an

d c

overi

ng

pri

me im

plican

ts

Th

ree b

asic

mo

dif

icati

on

s a

re p

erf

orm

ed

–R

ed

ucti

on

of

imp

lican

tsw

hil

e

main

tain

ing

co

vera

ge

–R

esh

ap

ing

im

plican

tsin

pair

s

–E

xp

an

sio

n o

f im

pli

can

ts(a

nd

re

mo

val

of

co

vere

d im

plican

ts)

Page 44: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

44

MIN

I A

lgo

rith

m

MIN

I (F

, D

C)

{F

is O

N-S

ET

DC

is D

on

’t C

are

Set

1.

F =

U -

(F ∨ ∨∨∨

DC

) U

is u

niv

ers

e c

ub

e

2.

(Co

ver)

f=

Exp

an

df

ag

ain

st

Fp

= C

om

pu

te s

olu

tio

n s

ize

3.

f =

Red

uce

each

cu

be o

f f

ag

ain

st

oth

er

cu

bes o

f F

∨ ∨∨∨D

C

4.

Resh

ap

ef

5.

f=

Exp

an

df

ag

ain

st

Fn

= c

om

pu

te s

olu

tio

n s

ize

6.

If n

< p

g

o t

o 3

, els

e, exit

}

Page 45: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

45

Exam

ple

: E

xp

an

sio

n

bc

a

Page 46: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

46

Exp

an

sio

n E

xam

ple

Ste

p 2

in

MIN

I:

Exp

an

d f

a

gain

st

F

ff e

xp

an

ded

F

10

01

01

01

10

10

11

01

10

10

00

10

10

10

01

− −−−1

00

10

− −−−1

11

01

10

11

01

− −−−1

11

10

− −−−0

10

10

− −−−1

− −−−0

01

− −−−0

− −−−1

10

10

01

01

0− −−−

10

10

11

01

10

10

− −−−0

10

10

10

01

− −−−1

00

10

− −−−− −−−

11

11

− −−−1

− −−−0

01

− −−−0

− −−−1

10

11

10

10

01

01

10

00

10

01

00

01

01

00

00

10

− −−−1

01

01

− −−−0

00

01

Ord

er

sm

all

cu

bes f

irst

Page 47: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

47

Red

ucti

on

Red

uce t

he s

ize (

in t

he s

en

se o

f th

e n

um

ber

of

min

term

s/v

ert

ices t

hat

it c

overs

) o

f cu

bes in

f

wit

ho

ut

aff

ecti

ng

co

vera

ge

Th

e s

maller

the s

ize o

f th

e c

ub

e, th

e m

ore

lik

ely

it

will b

e c

overe

d b

y a

n e

xp

an

ded

cu

be

Page 48: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

48

Red

ucti

on

Ex

am

ple

s

1 − −−−

− −−−1

− −−−1 − −−−

1− −−−

− −−−1 1

f 1 0

0 1

− −−−1 − −−−

1− −−−

− −−−1 1

f red

uced

Red

ucin

g c

overs

:

10

01

01

0− −−−

10

10

11

01

10

10

− −−−0

10

10

10

01

− −−−1

00

10

− −−−− −−−

11

11

− −−−1

− −−−0

01

− −−−0

− −−−1

10

− −−−− −−−

11

11

− −−−0

− −−−1

10

− −−−1

− −−−0

01

10

− −−−0

10

− −−−1

00

10

0− −−−

10

10

11

01

10

10

10

01

10

01

01

Reo

rder,

p

ut

larg

er

cu

bes f

irst

− −−−− −−−

11

11

− −−−0

01

10

− −−−1

− −−−0

01

10

− −−−0

10

− −−−1

00

10

0− −−−

10

10

11

01

10

10

10

01

10

01

01

(− −−−0 1

1 1

0)

Page 49: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

49

Resh

ap

ing

Att

em

pt

to c

han

ge t

he s

hap

e o

f th

e c

ub

es w

ith

ou

t ch

an

gin

g c

overa

ge o

r n

um

ber

Resh

ap

ing

tra

nsfo

rms a

pair

of

cu

bes in

to a

no

ther

pair

su

ch

th

at

co

vera

ge is u

naff

ecte

d (

pert

urb

s

so

luti

on

so

next

exp

an

d d

oes t

hin

gs d

iffe

ren

tly)

Page 50: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

50

Resh

ap

ing

Exam

ple

− −−−− −−−

11

11

− −−−0

01

10

− −−−1

− −−−0

01

10

− −−−0

10

− −−−1

00

10

0− −−−

10

10

11

01

10

10

10

01

10

01

01

f

− −−−− −−−

11

11

− −−−1

− −−−0

01

10

− −−−0

10

− −−−0

01

10

− −−−1

00

10

0− −−−

10

10

11

01

10

10

10

01

10

01

01

f resh

ap

ed

− −−−− −−−

11

11

− −−−1

− −−−0

01

10

− −−−0

10

− −−−0

01

10

− −−−1

00

10

0− −−−

10

10

11

01

10

10

10

01

10

01

01

1 2 3 4 5 6 7 8 9

− −−−− −−−

11

11

− −−−1

10

01

− −−−1

00

11

10

00

10

10

10

11

00

01

10

10

01

11

0− −−−

10

10

11

01

10

1

(2,5

)

(3,8

)

(4,9

) 6 7

f ord

ere

d

Page 51: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

51

A C

om

ple

te E

xam

ple

00

01

11

10

cd

ab

00

01

11

10

00

01

11

10

00

01

11

10

4 1 8

9 1 7

9 3 1

10 4 1 8

1

55

2

11

1

55

6

fg

init

ial f

− −−−− −−−

11

11

10

01

01

11

01

10

− −−−0

01

10

− −−−1

− −−−0

01

10

10

01

01

10

10

− −−−0

10

10

− −−−1

00

10

10

00

10

1 2 3 4 5 6 7 8 9 10

a

b

c d

f

g

− −−−− −−−

11

11

10

01

01

11

01

10

− −−−0

− −−−1

10

− −−−1

− −−−0

01

10

10

01

0− −−−

10

10

− −−−1

00

10

10

− −−−0

10

exp

an

d

Page 52: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

52

Exam

ple

-2

00

01

11

10

cd

ab

00

01

11

10

00

01

11

10

00

01

11

10

4 1,4 7

9 1 7

9 3 1

10 4

1,4 10

1

55

2

11

1

55

6

exp

an

ded

f

− −−−− −−−

11

11

10

01

01

11

01

10

− −−−0

− −−−1

10

− −−−1

− −−−0

01

10

10

01

0− −−−

10

10

− −−−1

00

10

10

− −−−0

10

1 2 3 4 5 6 7 9 10

a

b

c d

f

g

− −−−− −−−

11

11

10

01

01

11

01

10

− −−−0

01

10

− −−−1

− −−−0

01

10

10

01

0− −−−

10

01

− −−−1

00

10

10

− −−−0

10

red

uce

Page 53: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

53

Exam

ple

-3

00

01

11

10

cd

ab

00

01

11

10

00

01

11

10

00

01

11

10

4 1 7

9 1 7

9 3 1

10 4 1 10

1

55

2

11

1

55

6

red

uced

f

1 2 3 4 5 6 7 9 10

a

b

c d

f

g

− −−−− −−−

11

11

10

01

01

11

01

10

− −−−0

01

10

− −−−1

− −−−0

01

10

10

01

0− −−−

10

10

− −−−1

00

10

10

− −−−0

10

− −−−− −−−

11

11

10

01

11

11

01

10

00

01

10

− −−−1

10

01

10

10

11

0− −−−

10

10

− −−−1

00

11

10

00

10

2,4

5,9

6,1

0

2,4

5,9

6,1

0

resh

ap

e

Page 54: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

54

Exam

ple

-4

ab

00

01 11

10

2

00

01 11

10

cd

00

01

11

10

00

01

11

10

4 1 7

9 1 7

9 3 1

10 1 6

1

99

2

11

1

55

6

resh

ap

ed

f

1 2 3 4 5 6 7 9 10

a

b

c d

f

g

− −−−− −−−

11

11

10

01

01

11

01

10

00

01

10

− −−−1

10

01

10

10

11

0− −−−

10

10

− −−−1

00

11

10

00

10

− −−−− −−−

11

11

10

− −−−1

11

1− −−−

0− −−−

10

− −−−0

− −−−1

10

− −−−1

− −−−0

01

10

1− −−−

11

0− −−−

10

10

− −−−1

00

11

exp

an

d

Page 55: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

55

Exam

ple

-5

cd

4

1,4

,7

7

9 1,7 7

3,9 3 1

3

1,2

,4,6

6

1

5,9

5,9

2

11

1,2

,6

55

6

2,3

,4

ab

fin

al

exp

an

ded

f

− −−−− −−−

11

11

10

− −−−1

11

1− −−−

0− −−−

10

− −−−0

− −−−1

10

− −−−1

− −−−0

01

10

1− −−−

11

0− −−−

10

10

− −−−1

00

11

1 2 3 4 5 6 7 9

a

b

c d

f

g

00

01

11

10

00

01

11

10

00

01

11

10

00

01

11

10

fin

al F

Page 56: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

56

Esp

resso

Alg

ori

thm

ES

PR

ES

SO

(F

, D

C)

{F

is O

N-S

ET

DC

is D

on

’t C

are

Set

1.

F =

U -

(F ∨ ∨∨∨

DC

) U

is u

niv

ers

e c

ub

e

2.

n =

|F

|

3.

F =

Red

uce (

F, D

C);

4.

F =

Exp

an

d (

F, F

);

5.

F =

Irr

ed

un

dan

t (F

, D

C);

6.

If |F

|<

n g

oto

2, els

e, p

ost-

pro

cess &

exit

}

Page 57: Two-Level Logic Minimization Prof. Srinivas Devadas MIT ...keutzer/classes/... · The Quine - McCluskey Method Step 1: List all minterms in ON-SET and DC-SET Step 2: Use a prescribed

57

Su

mm

ary

of

2-l

evel

2-l

evel o

pti

miz

ati

on

is v

ery

eff

ecti

ve a

nd

matu

re.

Exp

resso

(develo

ped

at

Berk

ele

y)

is t

he “

last

wo

rd”

on

th

e s

ub

ject

2-l

evel o

pti

miz

ati

on

is d

irectl

y u

sefu

l fo

r P

LA

’s/P

LD

’s–

these w

ere

wid

ely

used

to

im

ple

men

t co

mp

lex c

on

tro

l lo

gic

in

th

e e

arl

y 8

0’s

they a

re r

are

ly u

sed

th

ese d

ays

2-l

evel o

pti

miz

ati

on

fo

rms t

he t

heo

reti

cal

fou

nd

ati

on

fo

r m

ult

ilevel lo

gic

op

tim

izati

on

2-l

evel o

pti

miz

ati

on

is u

sefu

l as a

su

bro

uti

ne in

m

ult

ilevel o

pti

miz

ati

on