1 multi-valued logic synthesis r. k. brayton and s. p. khatri university of california berkeley

30
1 Multi-Valued Logic Synthesis Multi-Valued Logic Synthesis R. K. Brayton and S. P. R. K. Brayton and S. P. Khatri Khatri University of California University of California Berkeley Berkeley

Post on 20-Dec-2015

220 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

1

Multi-Valued Logic Multi-Valued Logic SynthesisSynthesis

R. K. Brayton and S. P. KhatriR. K. Brayton and S. P. Khatri

University of CaliforniaUniversity of California

BerkeleyBerkeley

Page 2: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

2

MotivationMotivation

• More natural way of describing More natural way of describing designsdesigns

• At a higher level of At a higher level of specification specification – more possibility of optimizationmore possibility of optimization

• Is a generalizationIs a generalization– leads to improved understanding leads to improved understanding

even of the binary case.even of the binary case.

Page 3: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

3

This TalkThis TalkUnlike paper in proceedings, this talk will concentrateUnlike paper in proceedings, this talk will concentrateon several algorithms used for on several algorithms used for optimizing a logic optimizing a logic circuitcircuit with multi-valued variables. with multi-valued variables.

General setting is an General setting is an MV networkMV network. An acyclic graph. An acyclic graphwhere each node is an MV-logic function and an where each node is an MV-logic function and an arc connects two nodes if one function directly arc connects two nodes if one function directly depends on the other.depends on the other.

Each node is associated with a single MV-variable,Each node is associated with a single MV-variable,and a set of MV-inputs from other nodes or primary and a set of MV-inputs from other nodes or primary inputs. inputs.

Page 4: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

4

OutlineOutline• MV-NotationMV-Notation• Algorithms for Multi-valued LogicAlgorithms for Multi-valued Logic

– Redundancy Removal - see next talkRedundancy Removal - see next talk– MV-factorizationMV-factorization

• extracting common divisors in an MV settingextracting common divisors in an MV setting

– SPFDsSPFDs• using flexibility to optimize circuitusing flexibility to optimize circuit

– DecompositionDecomposition• f(x) = h(x1,g(x2))f(x) = h(x1,g(x2))

• Conclusions and commentsConclusions and comments

Page 5: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

5

Notation - INotation - I

iXDefinitionDefinition - A multi-valued - A multi-valued variablevariable can take can take on values from a seton values from a set

DefinitionDefinition - - A multi-valued A multi-valued functionfunction is a is a function which mapsfunction which maps

F

},,{ 10 iPiP

Fn PPPF 1:

Page 6: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

6

Notation - IINotation - IIDefinitionDefinition - A multi-valued - A multi-valued literalliteral is a is a binary logic function of the formbinary logic function of the form

wherewhere

X ici

)()( 1 kiici XXX i

iij Pc

DefinitionDefinition - A - A cubecube can can be written as the product of MV-literals:be written as the product of MV-literals:

ncccc 21

ncn

cc XXX 21

21

Page 7: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

7

Multi-valued Multi-valued FactorizationFactorization

ExampleExample

We will show that this can be rewritten as:We will show that this can be rewritten as:

dbjXajXf

cbkXakXf

}5{}4,3{

2

}2{}1,0{1

bXaXy

djyXf

ckyXf

}5,2{}4,3,1,0{

}5,4,3{2

}2,1,0{1

Page 8: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

8

Binary Encode First?Binary Encode First?

dbjXajXf

cbkXakXf

}5{}4,3{

2

}2{}1,0{1

210210

210210

210210

52

41

30

xxxxxx

xxxxxx

xxxxxx

bxxaxy

djyxf

ckyxf

200

12

11

210210

210210

210210

52

41

30

xxxxxx

xxxxxx

xxxxxx

dbjxxxajxf

cbkxxxakxf

21022

21011

Page 9: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

9

MV-Kerneling (S. Malik)MV-Kerneling (S. Malik)

dbjXajXf

cbkXakXf

}5{}4,3{

2

}2{}1,0{1

ExpressionExpressionCo-kernelCo-kernel kernelkernel

f1 1 cbkXakX }2{}1,0{

f1 k bXaX }2{}1,0{

f2 1 dbjXajX }5{}4,3{

f2 j bXaX }5{}4,3{

Page 10: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

10

Co-kernel cube matrixCo-kernel cube matrix

X { , }0 1

X { , }0 1

X { , }3 4

X { , }3 4

X { }5

X { }5

X { }2

X { }20

10

0

000

0

00

0

0

0 00

0

0

0

0

0

0 0 0

11

1

k

j

a b ak bk aj dcbj

ExpressionExpression Co-kernelCo-kernel kernelkernel

f1

f2

f1

f2

1

1

k

j

cbkXakX }2{}1,0{

bXaX }2{}1,0{

dbjXajX }5{}4,3{

bXaX }5{}4,3{

Page 11: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

11

Common Divisors and Common Divisors and RectanglesRectangles

X { , }0 1

X { , }0 1

X { , }3 4

X { , }3 4

X { }5

X { }5

X { }2

X { }20

10

0

000

0

00

0

0

0 00

0

0

0

0

0

0 0 0

11

1

k

j

a b ak bk aj dcbj

Rectangle: { }Rectangle: { }(2,4)(2,4) (1,2)(1,2)

X { , }0 1

X { , }3 4 X { }5

X { }2

Page 12: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

12

Satisfiable RectangleSatisfiable Rectangle

DefinitionDefinition:: A rectangle is A rectangle is satisfiablesatisfiable if for every variable: if for every variable:

if a value appears somewhere in row if a value appears somewhere in row ii and the and the same valuesame value occurs somewhere in column occurs somewhere in column jj,,thenthen the same value must occur in the same value must occur in M(i,j)M(i,j)..

X { , }0 1

X { , }3 4 X { }5

X { }2

satisfiablesatisfiable

X { , }0 1

X { , }3 4 X { , }0 5

X { }2

notnot satisfiable satisfiable

X { , }0 1

X { , , }0 3 4 X { , }0 5

X { , }0 2

satisfiablesatisfiable

Page 13: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

13

Forming a Common Forming a Common DivisorDivisor

1. For each row of the rectangle, take the union or row entries1. For each row of the rectangle, take the union or row entries

X { , , }0 1 2

X { , , }3 4 5

2. 2. ANDAND these with the co-kernel associated with that row these with the co-kernel associated with that row

k

j

3. For each column take the union of the column entries3. For each column take the union of the column entries

X { , , , }0 1 3 4 X { , }2 5a b

5. 5. OROR these together these together

++

4. 4. ANDAND these with column labels. these with column labels.

common divisorcommon divisor

factor in f1factor in f1

factor in f2factor in f2

X { , }0 1

X { , }0 1

X { , }3 4

X { , }3 4

X { }5

X { }5

X { }2

X { }20

10

0

000

0

00

0

0

0 00

0

0

0

0

0

0 0 0

11

1

k

j

a b ak bk aj dcbj

f1f1f1f1f2f2f2f2

X { , }0 1

X { , }3 4 X { }5

X { }2k

j

a b

f1f1

f2f2

Page 14: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

14

Final ResultFinal Result

X { , , }0 1 2

X { , , }3 4 5

k

j

X { , , , }0 1 3 4 X { , }2 5

X { , }0 1

X { , }3 4 X { }5

X { }2k

j

a b

a b++ common divisorcommon divisor

factor in f1factor in f1

factor in f2factor in f2

dbXaXjXf

cbXaXkXf

)(

)(}5,2{}4,3,1,0{}5,4,3{

2

}5,2{}4,3,1,0{}2,1,0{1

Page 15: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

15

Nice ResultNice Result

Theorem:Theorem: If If kk is a kernel found by the usual is a kernel found by the usual Boolean kerneling process for Boolean kerneling process for somesome binary encoding, binary encoding, then it then it will be foundwill be found by the MV factoring process. by the MV factoring process.

In additionIn addition, the MV process can find some , the MV process can find some ““Boolean factors”Boolean factors”

Page 16: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

16

Binary EncodingBinary Encoding

210210

210210

210210

52

41

30

xxxxxx

xxxxxx

xxxxxx

bxxaxy

djyxf

ckyxf

200

12

11

bXaXy

djyXf

ckyXf

}5,2{}4,3,1,0{

}5,4,3{2

}2,1,0{1

210210

210210

210210

52

41

30

xxxxxx

xxxxxx

xxxxxx

bxxaxxxxy

djyxxxxxf

ckyxxxxxf

212121

321212

321211

)(

)(

)(

Page 17: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

17

Sets of Pairs of Sets of Pairs of Functions to be Functions to be

Distinguished (SPFDs)Distinguished (SPFDs)• An SPFD is equivalent to a An SPFD is equivalent to a setset of of

incompletely specified functions incompletely specified functions (ISFs)(ISFs)

• Proposed by Proposed by Yamashita, Sawada and Yamashita, Sawada and NagoyaNagoya for simplifying binary FPGAs for simplifying binary FPGAs

• Implemented in SISImplemented in SIS• For binary functions, can be For binary functions, can be

represented by a bipartite graphrepresented by a bipartite graph

Page 18: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

18

Example of SPFD Example of SPFD computation for MV-computation for MV-

functionsfunctionsConsider the MV-function:Consider the MV-function:

0 0 R1 1

110

10

22

RYGGY0

X Z F

00

11 01

21

1020

SPFDF(X,Z)

RedRed GreenGreen

YellowYellow

xzxz

Old networkOld network

ZXF

ZXF

ZXZXF

G

Y

R

}2,0{

}2,1{

}1{}0{

Page 19: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

19

Assign Edges to InputsAssign Edges to Inputs

00

11 01

21

1020

SPFDF(X,Z)

RedRed GreenGreen

YellowYellow

xzxz

00

11 01

21

1020

SPFDX(X,Z)

xzxz

00

11 01

21

1020

SPFDZ(X,Z)

xzxz

Page 20: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

20

Re-synthesize XRe-synthesize X

11 00

00

11 01

21

1020

W=SPFDX(X,Z)

xzxz0 0 R1 1

110

10

22

RYGGY0

X Z F WW111100000000

W X Z X Z { } { }0 1

Old networkOld network

ZXF

ZXF

ZXZXF

G

Y

R

}2,0{

}2,1{

}1{}0{

ZFZWF

ZFZWF

ZXZXWF

RG

RY

R

}1{}0{

New networkNew network

Page 21: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

21

SPFDsSPFDs

• Allows more flexibility than Allows more flexibility than simple don’t caressimple don’t cares

• Changes both function and Changes both function and some of its inputs some of its inputs simultaneouslysimultaneously

• Extended to multi-valued Extended to multi-valued functions.functions.

Page 22: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

22

Decomposition of Multi-Decomposition of Multi-Valued Functions Valued Functions

(Brzozowski and Lou)(Brzozowski and Lou)

is a finite non-empty set andis a finite non-empty set andE

Consider Consider partially-specifiedpartially-specified MV-functions MV-functions with with nn inputs and inputs and mm outputs. outputs. mn DEf :

is the set of subsets of is the set of subsets of EED 2

DecompositionDecomposition is finding a function g such that is finding a function g such that

wherewhere)),,(,,,(),,( 111 srn vvguuhxxf

),,(),,(),,(),,(11 11 sr jjsiir xxvvxxuu

Page 23: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

23

Set MatricesSet MatricesA function f is represented by a set A function f is represented by a set matrix, e.g.matrix, e.g.

with n+m columns which must be with n+m columns which must be consistentconsistent..

{1} {0,1,2} {0}{1} {0,1,2} {0}{1} {1} {0,2}{1} {1} {0,2}{0,1,2} {0,1} {0}{0,1,2} {0,1} {0}{1} {0,1} {0}{1} {0,1} {0}{0} {0,1} {1,2}{0} {0,1} {1,2}

inputsinputs outputsoutputs

n=2n=2m=1m=1

NotNotconsistentconsistent

00 00

0000

Page 24: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

24

Decomposition of MV-Decomposition of MV-functionsfunctions

Definition:Definition: Given a set Given a set SS, a , a blanketblanket B=(bB=(b11,b,b22,b,b33,…,b,…,bkk)) is a set of nonempty distinct (but not necessarily disjoint) is a set of nonempty distinct (but not necessarily disjoint) subsets of subsets of SS, called blocks, whose union is , called blocks, whose union is SS..

Example:Example: S={1,2,3}, B={(1,2),(2,3), (1)} S={1,2,3}, B={(1,2),(2,3), (1)}

Definition:Definition: A blanket A blanket productproduct of two blankets of two blankets BB11 and and BB22 is given by is given by 1) forming the cross product of intersections of blocks 1) forming the cross product of intersections of blocks 2) removing duplicates and null intersections2) removing duplicates and null intersections

Example:Example: S={1,2,3}, S={1,2,3}, BB11={(1,2),(2,3),(1)},={(1,2),(2,3),(1)}, BB22={(1,2),(3)}={(1,2),(3)}

BB11 x B x B22 = {(1,2),(2),(3), (1)} = {(1,2),(2),(3), (1)}

Page 25: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

25

Row blanket for a set Row blanket for a set matrixmatrix

This is a list of This is a list of uniqueunique sets of rows which sets of rows which cover each minterm in the input/output space, e.g.cover each minterm in the input/output space, e.g.

{1} {0,1,2} {0}{1} {0,1,2} {0}{1} {1} {0,2}{1} {1} {0,2}{0,1,2} {0,1} {0}{0,1,2} {0,1} {0}{1} {0,1} {0}{1} {0,1} {0}{0} {0,1} {1,2}{0} {0,1} {1,2}

inputsinputs outputsoutputs 000 - 3000 - 3001 - 5001 - 5002 - 5002 - 5010 - 3010 - 3……100 - 1,3,4100 - 1,3,4......

So row blanket for this isSo row blanket for this isBBff=={(3),(5),(1,3,4),(1,2,3,4),(2),(1)}{(3),(5),(1,3,4),(1,2,3,4),(2),(1)}

Page 26: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

26

Example of Example of DecompositionDecomposition

0 0 0 0 0,2 0,2 0,1 0,1 0011 1,21,2 0,20,2 0,2 0,2 1122 0,1,20,1,2 00 1,21,2 221,21,2 0,20,2 0,20,2 0,10,1 1,21,2

x1x1 x2x2 x2x2 f1f1 f2f2u=x1u=x1v=x2,x3v=x2,x3

00 00 1,3,41,3,4 1,3,41,3,4 22 2200 22 1,41,4 1,2,4 1,3,41,2,4 1,3,4 0,20,2 2211 00 2,32,3 2,3,42,3,4 11 1111 22 22 1,2,4 2,3,41,2,4 2,3,4 0,10,1 1122 00 2,3,42,3,4 2,3,42,3,4 11 1122 22 2,42,4 1,2,4 2,3,41,2,4 2,3,4 0,10,1 00

x2x2 x3x3 BBVV < B < Bgg codes g(v)codes g(v)

f(x)=h(u,g(v))f(x)=h(u,g(v))

Find a blanket BFind a blanket Bgg that that BBVV<B<Bgg and B and BUU x B x Bg g <B<Bff

Encode the Encode the row sets of Brow sets of Bgg

Choose a codeChoose a codefor each minterm for each minterm in the V space.in the V space.

To find g(v), form To find g(v), form the blanket Bthe blanket Bvv. .

Page 27: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

27

0 0 0 0 0,2 0,2 0,1 0,1 0 20 211 1,21,2 0,20,2 0,2 0,2 1 0,11 0,122 0,1,20,1,2 00 1,21,2 2 1,22 1,21,21,2 0,20,2 0,20,2 0,10,1 1,2 0,1,21,2 0,1,2

x1x1 x2x2 x2x2 f1f1 f2f2 gg

00 00 1,3,41,3,4 1,3,41,3,4 22 2200 22 1,41,4 1,2,4 1,3,41,2,4 1,3,4 0,20,2 2211 00 2,32,3 2,3,42,3,4 11 1111 22 22 1,2,4 2,3,41,2,4 2,3,4 0,10,1 1122 00 2,3,42,3,4 2,3,42,3,4 11 1122 22 2,42,4 1,2,4 2,3,41,2,4 2,3,4 0,10,1 00

x2x2 x3x3 BBVV < B < Bgg codes g(v)codes g(v)

Page 28: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

28

00 11 22 1,3,41,3,4 11 11 0,10,1 0011 2,42,4 22 1,3,41,3,4 44 2,4 4 3,42,4 4 3,4 0,10,1 1,21,2 00 1,2,41,2,4 2,42,4 2,42,4 00 11 11 2,3,42,3,4 2,42,4 2,42,4 00 1122 3,43,4 22 1,3,41,3,4 3,43,4 3,43,4 11 22 00 1,2,41,2,4 44 2,4 4 3,42,4 4 3,4 0,10,1 1,21,2 11 2,3,42,3,4 3,43,4 3,43,4 11 22

X1X1 BBUU gg BBgg B BUU*B*Bgg < B < Bff h1 h2h1 h2

Computing h(u,g)Computing h(u,g)

The outputs h1 and The outputs h1 and h2 are obtainedh2 are obtainedby intersecting the by intersecting the outputs of the outputs of the chosen rows.chosen rows.

1. List each minterm of U1. List each minterm of U 2. List rows that cover it = B2. List rows that cover it = BUU

3. List possible codes of g that 3. List possible codes of g that can correspond to these mintermscan correspond to these minterms

4. List corresponding blocks of B4. List corresponding blocks of Bgg

with these codeswith these codes

5. List all blocks of B5. List all blocks of Bff that cover B that cover BUU*B*Bgg

6. Choose one block of B6. Choose one block of Bff for the for the implementationimplementation

0 0 0 0 0,2 0,2 0,1 0,1 0 20 211 1,21,2 0,20,2 0,2 0,2 1 0,11 0,122 0,1,20,1,2 00 1,21,2 2 1,22 1,21,21,2 0,20,2 0,20,2 0,10,1 1,2 0,1,21,2 0,1,2

x1x1 x2x2 x2x2 f1f1 f2f2 gg

Page 29: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

29

Final ResultFinal Result

0 0 0 0 2 211 1,21,2 0,1 0,122 0,1,20,1,2 1,2 1,21,21,2 0,20,2 0,1,2 0,1,2

x1x1 x2x2 gg

00 22 0,1 00,1 011 22 0,1 1,20,1 1,21 1 00 0 10 11 1 11 0 10 122 22 1 21 22 2 00 0,1 1,20,1 1,22 2 11 1 21 2

X1X1 gg h1 h2 h1 h2

Note that the results are Note that the results are incompletely specified functionsincompletely specified functions

=g(x1,x2)=g(x1,x2)

h1(x1,g)h1(x1,g)== h2(x1,g)h2(x1,g)

Page 30: 1 Multi-Valued Logic Synthesis R. K. Brayton and S. P. Khatri University of California Berkeley

30

Conclusions and Conclusions and CommentsComments

• Methods have been developed for Methods have been developed for representing and manipulating multi-valued representing and manipulating multi-valued functionsfunctions

• Conceptually, the best way to deal with MV-Conceptually, the best way to deal with MV-logic is logic is – to manipulate them directly, to manipulate them directly, – followed by followed by intelligentintelligent binary encoding, binary encoding, – followed by binary manipulationsfollowed by binary manipulations

• We require such a logic package to We require such a logic package to experiment more fully with these methods - experiment more fully with these methods - but this has not been developed to date.but this has not been developed to date.