binary recursion · 2004-01-21 · a logic function f is monotone increasing (decreasing) in if and...

23
1 1 Binary recursion Binary recursion 2 Unate functions Unate functions ! Theorem Theorem If a cover C(f) is unate in x If a cover C(f) is unate in xj , then f is unate in x , then f is unate in xj. ! Theorem Theorem If f is unate in x If f is unate in xj , then every prime implicant of f is , then every prime implicant of f is unate in x unate in xj.

Upload: others

Post on 01-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

1

1

Binary recursionBinary recursion

2

Unate functionsUnate functions

!! TheoremTheorem

If a cover C(f) is unate in xIf a cover C(f) is unate in xjj, then f is unate in x, then f is unate in xjj..

!! TheoremTheorem

If f is unate in xIf f is unate in xjj, then every prime implicant of f is , then every prime implicant of f is unate in xunate in xjj..

Page 2: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

2

3

Why are Why are unate unate functions so special?functions so special?

!! Special Boolean algorithms for Special Boolean algorithms for unate unate functions are functions are not only fast, but also give the guaranteed minimum not only fast, but also give the guaranteed minimum result.result.

!! The algorithms presented perform the Boolean The algorithms presented perform the Boolean operations and simplify the result in the same time.operations and simplify the result in the same time.

!! In practice, many functions are In practice, many functions are partially partially unateunate. The . The divide and conquer strategy aimed at divide and conquer strategy aimed at unatenessunatenessproduces very shallow recursions; algorithms are fast produces very shallow recursions; algorithms are fast in practice.in practice.

4

Unate Unate recursive paradigm works for:recursive paradigm works for:

!! ComplementationComplementation

!! Irredundant coverIrredundant cover

!! ReduceReduce

!! Essential primesEssential primes

!! Example is Example is unateunate3221 xxxxf +=

Page 3: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

3

5

Important facts about Important facts about unate unate functionsfunctions

Proposition 1.

A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position.

jx

Proof:(if) If no prime implicant has a 0 in the jth position, any primecover C(f) is unate in . So f is unate in .jx jx(only if) Let is a prime with 0 at jth position -> the cubeobtained by replacing 0 in jth position with a 1 contains atleast one vector in . For the input v corresponding to thatvertex, f(v)=0. If we change from 1 to 0 in v, the value off changes from 0 to 1, so f is not monotone increasing.

jx

ic ic~

f

6

Proposition 2.

A unate cover is a tautology if and only if it contains a rowof all 2s (it contains a universal cube).

Proposition 3.

Let C be a unate cover, S any subset of the cubes of Cand c a cube in C. Then if and only if forsome .

Sc ⊆ sc ⊆Ss ∈

(Only if) Let C be a positive unate cover. Since C is positive, unate, everycube in C contains the vertex (1,1,…1) and so Sssc ∈∀≠∩ 0Now, suppose . This implies that but a unate cover isa tautology if and only if it contains a row of all 2s. So there exists

Sc ⊆Ss ∈

Which generated this row. Thus from this .Ss ∈sc ⊆1≡cS

The if part is trivially true.

Page 4: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

4

7

Proposition 4.

Every prime of a unate function is essential.

Proposition 5.

Let C be a unate cover and P be a set of all primes of b(C),the logical function specified by C. Then . If in addition,C is minimal with respect to single cube containment, thenP=C, and C is unique minimum cover.

( C minimal with respect to containment any c is contained in some p)

From proposition 5, it follows that we can find the minimum cardinality primecover of a unate function starting from any cover and(a) expand each cube to a prime(b) remove any cube which is contained in any other cube of the cover.

CP ⊆

8

jx

The following propositions are helpful in constructing anefficient algorithm for finding the complement of a function:

• If a logic function f is monotone increasing in , then the complement of f, is monotone increasing in .

• The complement of a unate function is unate.

•The cofactors of a unate function f with respect toand are unate.

jxf

jxjx

Page 5: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

5

9

cbacbacbacbacabf ++++=

How to simplify a unate function?

Example:

ab

cf is monotone increasing in a, decreasing in b and c.

cabf +=

(unate cover)cbbcbabaca

cbacbacbacbacbaf

++++=/+//++/+/=

(set of all primes = global unate cover)

10

Proposition.

Let be the Shannon expansion of a

completely specified logic function f. Then f=1 (tautology)

if and only if and .

Proof

(If) If

jj xjxj fxfxf +=

1≡jxf 1≡

jxf

.111 ≡+=⇒≡∧≡ jjxx xxfffjj

(only if)Suppose that is not a tautology -> exists an input ofsay , such that the output of is 0. Sinceis independent of , an input combination withcan be selected so that the output of is 0.For this input combination, the output ofcorresponding to must be 0, -> f is not a tautology.

jxfjxf

jy jxfjxf

jx 1=jxjxj fx

jj xjxj fxfxf +=jy

Page 6: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

6

11

General recursive paradigm General recursive paradigm

Applies to:intersectioncomplementationtautology

1. Apply the operation to the 2 cofactors.2. Merge the results.

)),(

),,((),(

jj

jj

xxj

xxj

gfoperatex

gfoperatexmergegfOperate =

12

Recursion treeRecursion tree

jj xjxj hxhxh +=

Each node merges the results of its 2 children trees.

For tautology checking - merging is simple, both trees must be tautologies.

Complementation and reduction are more complicated.

h

h0 h1

(for function)

jj xjxj HxHxH +=(for covers)

Page 7: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

7

13

Binary recursion treeBinary recursion tree

!! The recursive Shannon expansion corresponds to a The recursive Shannon expansion corresponds to a binary recursion treebinary recursion tree

)()(xyyxyxxyxx fyyfxfyyfxfxxff +++=+=

x1

x2y

xf

x3

1 0

10

10

P(v)

Path P(v) to node v corresponds to cube)(vPc

321)( xxxc vP =

v

f

10

fxfx

y

fxfx fxfx yy yy

1 0 1 0

14

Binary recursion treeBinary recursion tree

!! The root represents the original function fThe root represents the original function f

!! Each node v corresponds toEach node v corresponds to

!! If ever =1 or 0 we can terminate the tree and replacIf ever =1 or 0 we can terminate the tree and replace v e v by 1 or 0. Such a node is a leaf.by 1 or 0. Such a node is a leaf.

!! Example: f = ab + a’c Example: f = ab + a’c

)(vPcf

)(vPcf

a

bc

10101

0

1

1

1 10

0

0

00

1b

c

a

b

01

01

1

1

0

00

1c

splitting variable

Page 8: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

8

15

Implicit enumeration Implicit enumeration -- branch and boundbranch and bound!! Checking for tautology and many other theoretically intractable Checking for tautology and many other theoretically intractable

problems (coproblems (co--NP complete) can be effectively solved using NP complete) can be effectively solved using implicit enumeration.implicit enumeration.!! Use recursive Shannon expansion to exploreUse recursive Shannon expansion to explore

!! in (hopefully) large subspaces of , prune the binary recurin (hopefully) large subspaces of , prune the binary recursion sion tree by tree by

!! exploiting properties of the node functionexploiting properties of the node function

!! exploiting heuristic bounding techniquesexploiting heuristic bounding techniques

!! even though in the worst case the recursion tree may haveeven though in the worst case the recursion tree may have

nodes, in practice we typically encounter a linear number onodes, in practice we typically encounter a linear number of nodesf nodes

!! thus we say that the minthus we say that the min--terms of f have been terms of f have been implicitly implicitly enumeratedenumerated

!! BDD’s are alternate representations in which implicit enumeratioBDD’s are alternate representations in which implicit enumeration is n is performed statically, and nodes with identical path cofactors arperformed statically, and nodes with identical path cofactors are e identified. identified.

nB

)(vPcf

nB

n2

n2

16

Unate recursive paradigmUnate recursive paradigm

!! In the ESPRESSO program, the key pruning technique is based In the ESPRESSO program, the key pruning technique is based on exploiting the properties of unate functions.on exploiting the properties of unate functions.

!! The splitting variable is chosen so that the functions at lower The splitting variable is chosen so that the functions at lower nodes of the recursion tree become unate.nodes of the recursion tree become unate.

!! Unate covers F have many good properties:Unate covers F have many good properties:!! If a cover F is minimal with respect to single cube containment,If a cover F is minimal with respect to single cube containment, all all

of its cubes are essential primes.of its cubes are essential primes.

!! In this case F is the unique minimum cube representation of its In this case F is the unique minimum cube representation of its logic function.logic function.

!! A unate cover represents the tautology iff it contains a cube wiA unate cover represents the tautology iff it contains a cube with no th no literals.literals.

!! This type of implicit enumeration applies to many subproblems This type of implicit enumeration applies to many subproblems (prime generation, complementation, reduction).(prime generation, complementation, reduction).

Page 9: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

9

17

Recursion treeRecursion tree

!! Each node merges results of its 2 children trees.Each node merges results of its 2 children trees.

!! For tautology checking For tautology checking -- merging is simple, both subtrees must merging is simple, both subtrees must be tautologies.be tautologies.

!! Complementation and reduction are more complicated.Complementation and reduction are more complicated.

!! hh00 and hand h1 1 are the logic functions corresponding to the trees are the logic functions corresponding to the trees below a node h of a tree.below a node h of a tree.

h=xh=xjj’h’h00+x+xjjhh11

!! We work with covers and their matrixWe work with covers and their matrix

representations: representations:

H = xH = xjj’H’H00 + x+ xjjHH11

h

h1h0

18

How to keep results compact?How to keep results compact?

!! If HIf H00 and Hand H11 are prime and irredundant, we would like to have are prime and irredundant, we would like to have the same property at the next stage, i.e. H which is prime and the same property at the next stage, i.e. H which is prime and irredundant.irredundant.

!! IDEA: Make all the cubes in H prime: pick one cube of H at a IDEA: Make all the cubes in H prime: pick one cube of H at a time and make it as large as possible, provided that it does nottime and make it as large as possible, provided that it does notcontain vertex not in H.Then remove redundant covers.contain vertex not in H.Then remove redundant covers.

!! HERE: HHERE: H00 and Hand H11 are prime and irredundant and in a form of are prime and irredundant and in a form of Shannon expansion, so to enlarge a cube, one has to change a Shannon expansion, so to enlarge a cube, one has to change a 0 or a 1 in the input cube to 2, or change 3 in the output to 4.0 or a 1 in the input cube to 2, or change 3 in the output to 4.

!! The only possibility is to change 1 or 0 to 2 at the jThe only possibility is to change 1 or 0 to 2 at the j--th position.th position.

!! “Rising” cubes and checking redundancy is expensive. Fast “Rising” cubes and checking redundancy is expensive. Fast heuristics are needed.heuristics are needed.

Page 10: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

10

19

Unate complementationUnate complementation

!! PropositionProposition

The complement of a unate cover F can be expressed asThe complement of a unate cover F can be expressed as

if F is monotone increasing in xif F is monotone increasing in xjj, or as , or as

Proof. If F is monotone increasing in xProof. If F is monotone increasing in xjj, every cube of F has either , every cube of F has either a 1 or a 2 in the ja 1 or a 2 in the j--th position. Hence and F can be th position. Hence and F can be written aswritten as

jj x

x

jFFxF +=

jj x

x

j FFxF +=

(a)

(b)

jj xxFF ⊆

jjj

j xx

j

xx

j FFxFFxF )( +=+=

jj xxj

FFxF +=

20

Computing a complement of a unate coverComputing a complement of a unate cover

!! Compute , this involves complementation of a Compute , this involves complementation of a reduced # of cubes (assuming F depended on xreduced # of cubes (assuming F depended on xj j ) ) and one less variable xand one less variable xjj, since and, since and

contains a column of 2s in the jcontains a column of 2s in the j--th position.th position.

!! Compute ; this involves complementation of the Compute ; this involves complementation of the original cover dropping one variable, since original cover dropping one variable, since

because F is monotone increasing in xbecause F is monotone increasing in xjj. .

jxj Fx

|||| FFjx

<jx

F

jxF|||| FF jx

=

Page 11: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

11

21

The process:The process:

!! Choose the variable;Choose the variable;

!! Recursively complement a cover consisting of cubes not Recursively complement a cover consisting of cubes not containing that variable;containing that variable;

!! Complement the original cover with that variable dropped;Complement the original cover with that variable dropped;

!! Tack the variable onto cubes of the first result;Tack the variable onto cubes of the first result;

!! Concatenate the two resultsConcatenate the two results

!! Termination: Complement of a cover with no cubes is the Termination: Complement of a cover with no cubes is the universe and the complement of a cover with no variables is universe and the complement of a cover with no variables is empty.empty.

22

!! Definition Definition : Given a unate cover, define a matrix B:

1 if

BBijij ==

0 otherwise0 otherwise

B is the B is the personalitypersonality matrix of C. matrix of C.

!! Theorem:Theorem: Suppose S={ jSuppose S={ j11,j,j22, …,j, …,jrr} is a set of column } is a set of column indices which is minimal cover* of B. Construct a indices which is minimal cover* of B. Construct a cube c as follows:cube c as follows:

2 if2 if

cj = 0 if C is increasing in xcj = 0 if C is increasing in xjj

1 if C is decreasing in x1 if C is decreasing in xjj

then c is prime of b(C).then c is prime of b(C).

},,,{ 21 kcccC L=

2)( ≠jic

Sj ∉

Page 12: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

12

23

!! A A column covercolumn cover of a binary matrix B is defined as a set of of a binary matrix B is defined as a set of columns L such that .columns L such that .

!! ComplementationComplementation of unate functionof unate function

0 1 1 … 0 1 cube 10 1 1 … 0 1 cube 1

M= 1 0 1 … cube 2M= 1 0 1 … cube 2

……Minimal column cover of M = minimal set of columns such thatMinimal column cover of M = minimal set of columns such that

!! Theorem: If f is unate, then the set of all minimal column coverTheorem: If f is unate, then the set of all minimal column covers of M is s of M is the minimum cube cover of f.the minimum cube cover of f.

!! ExampleExample

f = ab’ + b’c + df = ab’ + b’c + d

1 1 0 01 1 0 0

M = 0 1 1 0M = 0 1 1 0

0 0 0 10 0 0 1

1≥∑∈ Lj

ijM i∀

1≥∑∈ Jj

ijM i∀

A 1 in every possible row, one possible cover

Minimal covers { (2,4), (1,3,4)}, f’ = bd’ + a’c’d’

24

!! AlgorithmAlgorithm COMPCOMP!! If f is unate then f’=UCOMP(f)If f is unate then f’=UCOMP(f)

!! Else f’<Else f’<-- Merge(xCOMP(fMerge(xCOMP(fxx) + x’COMP(f) + x’COMP(fx’x’))))

!! AlgorithmAlgorithm UCOMPUCOMP!! Represent function as a Boolean matrixRepresent function as a Boolean matrix

1 if x1 if xjj or xor xj’j’ occurs in prime ioccurs in prime i

BBijij = 0 otherwise= 0 otherwise

!! A column cover of B is a set of columns {jA column cover of B is a set of columns {jkk} such that} such that

such that such that

!! Complement f = set of all minimal column covers of B.Complement f = set of all minimal column covers of B.

!! Example:Example:

B = 1 1 1 0 {2}, {1,4}, {3,4}B = 1 1 1 0 {2}, {1,4}, {3,4}

0 1 0 10 1 0 1

ki∃∀1=

kijB

42321 xxxxxf +=

43412 xxxxxf ++=

Page 13: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

13

25

Algorithm UNATE COMPLEMENTAlgorithm UNATE COMPLEMENT

!! Generate the set of all minimal covers of a 0Generate the set of all minimal covers of a 0--1 matrix B.1 matrix B.

How to generate?How to generate?

!! Select column j (heuristic ?)Select column j (heuristic ?)

!! Select BSelect Bjj = all rows not covered by column j and all columns = all rows not covered by column j and all columns except j.except j.

!! Generate set SGenerate set Sjj of all minimal covers of Bof all minimal covers of Bj j (then {j} + S(then {j} + Sjj is the set is the set of minimal covers of B which include j) [ x’of minimal covers of B which include j) [ x’jj f’f’xx’’jj]]

!! Set B’ = all columns of B except jSet B’ = all columns of B except j

!! Generate set SGenerate set Sjj’ of all minimal covers of B’’ of all minimal covers of B’jj (S’(S’jj is all minimal is all minimal covers of B which don’t include j) [ f’covers of B which don’t include j) [ f’xxjj]]

!! Return ( {j} + SReturn ( {j} + Sjj ) + S’) + S’jj

26

Illustration of a UNATE COMPLEMENTIllustration of a UNATE COMPLEMENT

!! ExampleExample

C = 1 0 1 2 B = 1 1 1 0 C = 1 0 1 2 B = 1 1 1 0

2 0 2 1 0 1 0 12 0 2 1 0 1 0 1

dbcbaf +=j1 no j1

j2 no j2

j3 no j3

1,423,41 0 1

~11

[2,4]

1,21,4 Not minimal cover; 1,2 is contained in 2.

1 1 01 0 12

2 3 4

Page 14: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

14

27

Fast Recursive Boolean Function ManipulationFast Recursive Boolean Function Manipulation

!! The unate recursion paradigm:The unate recursion paradigm:

RECURSIVE UNATE ALGORITHMS:RECURSIVE UNATE ALGORITHMS:!! simplificationsimplification

!! complementationcomplementation

!! tautologytautology

!! reductionreduction

!! generating all prime implicantsgenerating all prime implicants

!! irredundant coverirredundant cover

!! multiplicationmultiplication

!! subtractionsubtraction

!! equivalence equivalence

28

Unate recursion paradigmUnate recursion paradigm

u u

u

u u

u

u u

!! Choose the splitting variableChoose the splitting variable

which is the most binate.which is the most binate.

!! Operate on unate levels:Operate on unate levels:!! intersectionintersection

!! complementationcomplementation

!! simplificationsimplification

!! tautologytautology

!! e.t.c.e.t.c.

!! Merge appropriatelyMerge appropriately

f=Cx x’

yy’

z z’

w w’

v v’ q q’

)()( xx fxfxf +=

Page 15: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

15

29

Divide and conquer strategyDivide and conquer strategy

!! Cofactor f until a unate function appearsCofactor f until a unate function appears

!! Operate on unate function (complement, minimize, Operate on unate function (complement, minimize, etc) and composeetc) and compose

!! GOAL: Get to unate level as fast as possible;GOAL: Get to unate level as fast as possible;

Keep cube duplication to minimum.Keep cube duplication to minimum.

Choice of splitting variable : choose xChoice of splitting variable : choose xii such that it has such that it has minimum # of 2s (most binate column). minimum # of 2s (most binate column).

30

In VLSI a spectrum of algorithms is neededIn VLSI a spectrum of algorithms is needed

!! Merging with Identity no guarantee of primeMerging with Identity no guarantee of prime

!! Merging with Containment or irredundantMerging with Containment or irredundant

!! Merging with Cover (prime)Merging with Cover (prime)

!! Merging with Cover and Irredundant (prime and Merging with Cover and Irredundant (prime and irredundant)irredundant)

slow

fast

Page 16: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

16

31

MergingMerging

!! Rising cubes and making them irredundant is Rising cubes and making them irredundant is expensiveexpensive

!! Merge with IdentityMerge with Identity: checks only for identity between : checks only for identity between cubes in Hcubes in H00 and Hand H11..

!! Merge with Containment Merge with Containment checks additionally for checks additionally for containment by a single cube Hcontainment by a single cube H00 and Hand H11..

!! Both heuristics do not guarantee that H is a set of Both heuristics do not guarantee that H is a set of primes. Moreover, the only possibility of redundancy primes. Moreover, the only possibility of redundancy detected is when two cubes in Hdetected is when two cubes in H00 and Hand H11 are are identical.identical.

32

MergingMerging

!! Identity can be checked by encoding and sorting Identity can be checked by encoding and sorting ~0(Nlogn), n=|H~0(Nlogn), n=|H00|+|H|+|H11|.|.

!! Straightforward pairwise containment is 0(|HStraightforward pairwise containment is 0(|H00| |H| |H11|).|).

!! ComplementationComplementation )()( xx fxfxf ⊕=

( )xf ( )xf

x x’lx

kx

eeef

dddf

L

L

++=

++=

21

21

)(

)(L++= 21 ccf

ji

jiji

iji

exxdelse

exded

ded

,

,

⇒⊆

⇒=

Page 17: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

17

33

SimplificationSimplification

!! A fast, heuristic algorithm SIMPLIFY. No guarantee A fast, heuristic algorithm SIMPLIFY. No guarantee that each cube of the cover will be prime irredundant. that each cube of the cover will be prime irredundant. Works well for single output functions.Works well for single output functions.

!! Idea: Idea: !! Use Shannon expressionUse Shannon expression

!! obtain simplification by applying the merging and obtain simplification by applying the merging and simplification operations on the cofactors:simplification operations on the cofactors:

where MWC=merge with containmentwhere MWC=merge with containment

jj xjxj fxfxf +=

))()(()(jj xjxj fSIMPLIFYxfSIMPLIFYxMWCfSIMPLIFY +=

34

Minimization of a single output unate coverMinimization of a single output unate cover

!! Eliminate each cube that is contained in any other Eliminate each cube that is contained in any other cube or cover. We are sure that the cover cube or cover. We are sure that the cover constructed is the minimum prime cover for this unate constructed is the minimum prime cover for this unate function.function.

!! Primness and irredundancy are sacrificed in the Primness and irredundancy are sacrificed in the merging process.merging process.

!! Optimality at the leaf level, to make the algorithm Optimality at the leaf level, to make the algorithm work well: choose splitting variables such that the work well: choose splitting variables such that the depth of the tree is as shallow as possible depth of the tree is as shallow as possible --> fewer > fewer merging. merging.

Page 18: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

18

35

Procedure SIMPLIFY(F)Procedure SIMPLIFY(F)

/* F: a cover of f, single output function *//* F: a cover of f, single output function */

/* Returns F*, a smaller or equal sized cover *//* Returns F*, a smaller or equal sized cover */

beginbegin

ifif (F unate) (F unate) returnreturn ( F*<( F*<-- UNATE_SIMPLIFYUNATE_SIMPLIFY(F));(F));

j<j<--BINATE_SELECTBINATE_SELECT(F);(F);

F*<F*<-- MERGE_WITH_CONTAINMENTMERGE_WITH_CONTAINMENT((

ifif (|F|<|F*|) (|F|<|F*|) returnreturn (F*=F) (F*=F) else returnelse return (F*)(F*)

endend

))(),(jx

FSIMPLIFYSIMPLIFY jxj xFxj

36

EXAMPLEEXAMPLE

0 2 20 2 2

1 1 2 The only binate variable is 1 1 2 The only binate variable is

2 1 12 1 1

2 1 2 It is unate, and 22 1 2 It is unate, and 2--nd cube is contained in the 1nd cube is contained in the 1--st, sost, so

2 1 12 1 1

1x 2x 3x

f= 1x

=1x

f

=1x

f [2 1 2 ] =1x

f2 2 22 1 1 which simplifies to [2 2 2]

Perform MERGE_WITH_CONTAINMENT , we express f as11 xx ff ⊆

11 xx fxff += instead of11

11 xx fxfx +

f = 2 1 20 2 2

RESULT :

F is unate, -> min. cover

Page 19: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

19

37

ExampleExample

abdffabdfdcbedcbafdcbedcba

fdcbfebbdaacfcebafdcbf

+++++++++++=

f = 2 0 0 0 2 0 0 0 1 2 1 21 2 1 2 2 10 1 2 1 2 22 1 2 2 0 12 1 0 0 2 11 0 1 0 0 22 0 0 0 2 11 0 1 0 1 22 1 0 0 2 01 1 2 1 2 01 1 2 1 2 1

f = 1 2 1 2 2 10 2 2 1 2 22 2 2 2 0 12 2 0 0 2 12 2 0 0 2 01 2 2 1 2 01 2 2 1 2 1

b

->

1 2 1 2 2 12 2 2 2 0 12 2 0 0 2 22 2 2 1 2 2

1 2 1 2 2 10 2 1 2 1 22 2 0 0 2 21 2 1 0 2 2

f =b

f = 1 1 1 2 2 12 1 2 1 2 22 1 2 2 0 12 1 0 0 2 20 0 1 2 1 21 0 1 0 2 21 2 1 2 2 12 2 0 0 2 2

38

Example (continues)Example (continues)

!! Original function :Original function :

!! Simplified function:Simplified function:

!! A more powerful minimizer yields:A more powerful minimizer yields:

abdffabdfdcbedcbafdcbedcba

fdcbfebbdaacfcebafdcbf

+++++++++++=

dcacfdcbacebadcbfebbdabcff +++++++=

dcacfdcbacebafebbdf +++++=

Page 20: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

20

39

Espresso II heuristicsEspresso II heuristics

!! Input = F and D, cube covers of the onInput = F and D, cube covers of the on--set and don’t care set of set and don’t care set of an incompletely specified Boolean function.an incompletely specified Boolean function.

!! Output : a minimized cover.Output : a minimized cover.

!! Objectives: Objectives: !! Minimize the # of product terms in the cover (NPT)Minimize the # of product terms in the cover (NPT)

!! Minimize # literals (non 2s) in the output (NLI)Minimize # literals (non 2s) in the output (NLI)

!! Minimize the output part in terms of the number of literals (NLOMinimize the output part in terms of the number of literals (NLO))

!! Goal when building the algorithm :Goal when building the algorithm :!! Computer resources are limitedComputer resources are limited

!! Obtain a solution which is as close to the optimum, as possible.Obtain a solution which is as close to the optimum, as possible.

40

Sequence of operations in ESPRESSO IISequence of operations in ESPRESSO II!! Complement:Complement: (compute the complement and the don’t care set).(compute the complement and the don’t care set).

!! ExpandExpand : (Expand each implicant into a prime and remove : (Expand each implicant into a prime and remove covered implicants).covered implicants).

!! Essential PrimesEssential Primes: (Extract the essential primes and put them in : (Extract the essential primes and put them in the don’t care set).the don’t care set).

!! Irredundant cover:Irredundant cover:(Find a minimal irredundant cover).(Find a minimal irredundant cover).

!! Reduce:Reduce:(Reduce each implicant to a minimum essential (Reduce each implicant to a minimum essential implicant).implicant).

!! IterateIterate 2,4,5 until no improvement.2,4,5 until no improvement.

!! LastgaspLastgasp: (try reduce, expand and irredundant cover one last : (try reduce, expand and irredundant cover one last time using a different strategy. If successful, continue the time using a different strategy. If successful, continue the iteration.iteration.

!! Make sparse: (Include the essential primes back into the cover Make sparse: (Include the essential primes back into the cover and make the PLA structure as sparse as possible)and make the PLA structure as sparse as possible)

Page 21: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

21

41

ComplementationComplementation

!! Idea: iterate over each output using the singleIdea: iterate over each output using the single--output output complementer based on the unite recursion paradigm.complementer based on the unite recursion paradigm.

!! We remember that the complement of a given Boolean function We remember that the complement of a given Boolean function can be obtained by recursive use of the Shannon formula:can be obtained by recursive use of the Shannon formula:

!! xxjj are splitting variables, chosen such that the cofactors become are splitting variables, chosen such that the cofactors become more unate. When leaf is unate, then we use unatemore unate. When leaf is unate, then we use unate--complement complement to find the result.to find the result.

jj xjxj fxfxf +=

42

Complementation (continued)Complementation (continued)

!! A complement of a given multiA complement of a given multi--output function output function is computed and represented as the is computed and represented as the concatenation of the single output function.concatenation of the single output function.!! Reasons:Reasons:

!! Experiments show that multiExperiments show that multi--output complementation output complementation seldom saves time and often leads to huge CPU times.seldom saves time and often leads to huge CPU times.

!! Single output format allows for more efficiency in Single output format allows for more efficiency in EXPAND (a major component of COMPLEMENT).EXPAND (a major component of COMPLEMENT).

Page 22: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

22

43

Complement of a single output functionComplement of a single output function

!! Take advantage of the special cases:Take advantage of the special cases:!! If the given function has a cube of all 2s If the given function has a cube of all 2s --> the complement is > the complement is

emptyempty

!! F is unate cover ( in each column in the matrix representation tF is unate cover ( in each column in the matrix representation there here are no both 1s and 0s) are no both 1s and 0s) --> call UNATE_COMPLEMENT> call UNATE_COMPLEMENT

!! A column of all 0s or all 1s occurs A column of all 0s or all 1s occurs --> extract a cube which > extract a cube which represents the columns where this case occurs.represents the columns where this case occurs.

For each j, if column j has 0s only For each j, if column j has 0s only --> then cj = 0, if column j has 1s > then cj = 0, if column j has 1s only, then cj=1 and otherwise cj=2. So the coveronly, then cj=1 and otherwise cj=2. So the cover

De Morgan’s law:De Morgan’s law:

c is unate, so its complement by UNATE_COMPLEMENT.c is unate, so its complement by UNATE_COMPLEMENT.

!! Now F is binate and no cube factors out, use recursive Shannon Now F is binate and no cube factors out, use recursive Shannon expansion with appropriate choice of splitting variable.expansion with appropriate choice of splitting variable.

cFcF ∩=cFcF ∪=

44

ExampleExample

!! x x x x x2 1 1 1 12 1 1 1 02 1 0 1 22 1 0 2 1

1 2 3 4 5 X2 -> all 1’s -> 22

22 , xx fxffxf +==

F = 2 2 1 1 1 F = 2 2 2 1 12 2 1 1 0 2 2 2 1 02 2 0 1 22 2 0 2 1 F = 2 2 2 1 2

2 2 2 2 1

x2 x x

x x

2 3

2 3

Unate, so it is passed toUNATE_COMPLEMENT

Split by x5 2 2 2 1 2

2 2 2 1 2

Page 23: Binary recursion · 2004-01-21 · A logic function f is monotone increasing (decreasing) in if and only if no prime implicant of f has a 0 (1) in the j-th position. x j Proof: (if)

23

45

Merging example at the branch xMerging example at the branch x33

!! Suppose the cofactors areSuppose the cofactors are

F = 2 2 2 0 0 F = 2 2 2 0 02 1 2 1 1 2 1 2 2 1

x3x3

Both cofactors contain (2 2 2 0 0)

)21211()21221()21211( ⇒⊆ remains unchanged and (21221) becomes (21021)

F = 2 2 2 0 02 1 2 1 12 1 0 2 1

In Espresso we seek only a representation of the off-set, but notnecessarily minimal representation of it. Off-set is needed for EXPAND.