Multi-Valued Logic
Synthesis
R. K. Brayton and S. P. Khatri
University of California
Berkeley
1
Motivation
• More natural way of describing
designs
• At a higher level of specification
– more possibility of optimization
• Is a generalization
– leads to improved understanding even
of the binary case.
2
This Talk
Unlike paper in proceedings, this talk will concentrate
on several algorithms used for optimizing a logic
circuit with multi-valued variables.
General setting is an MV network. An acyclic graph
where each node is an MV-logic function and an
arc connects two nodes if one function directly
depends on the other.
Each node is associated with a single MV-variable,
and a set of MV-inputs from other nodes or primary
inputs.
3
Outline
• MV-Notation
• Algorithms for Multi-valued Logic
– Redundancy Removal - see next talk
– MV-factorization
• extracting common divisors in an MV setting
– SPFDs
• using flexibility to optimize circuit
– Decomposition
• f(x) = h(x1,g(x2))
• Conclusions and comments
4
Notation - I
Definition - A multi-valued variable X i can take
on values from a set
Pi { 0 , , P
i
Definition
1 }
- A multi-valued function
function which maps
F
is a
F : P1 Pn PF
5
Notation - II
Definition - A multi-valued literal X ici
binary logic function of the form
ci
X i ( X i 1 ) ( X i
where
is a
k)
j ci Pi
Definition - A cube c c1 c2 cn can
be written as the product of MV-literals:
cn
c1 c 2
X1 X 2 X n
6
Multi-valued Factorization
Example
f1 X
{ 0,1}
ak X
{ 2}
f2 X
{ 3,4}
bk c
aj X
{ 5}
bj d
We will show that this can be rewritten as:
f1 X {0,1, 2}ky c
f 2 X { 3,4,5} jy d
y X {0,1, 3,4}a X { 2,5}b
7
Binary Encode First?
f1 X {0,1}ak X { 2}bk c
f 2 X { 3,4}aj X {5}bj d
0 x0 x1 x2
3 x0 x1 x2
1 x0 x1 x2
4 x0 x1 x2
2 x0 x1 x2
5 x0 x1 x2
0 x0 x1 x2
3 x0 x1 x2
f1 x1ky c
1 x0 x1 x2
4 x0 x1 x2
2 x0 x1 x2
5 x0 x1 x2
f 2 x1 jy d
f1 x1ak x0 x1 x2bk c
f 2 x2aj x0 x1 x2bj d
y x0 a x0 x 2 b
8
MV-Kerneling (S. Malik)
f1 X { 0,1}ak X { 2}bk c
f2 X { 3,4}aj X { 5}bj d
Expression Co-kernel
kernel
f1
1
X {0,1}ak X { 2}bk c
f1
k
X {0,1}a X { 2}b
f2
1
X { 3,4}aj X {5}bj d
f2
j
X { 3,4}a X {5}b
9
Co-kernel cube matrix
Expression
Co-kernel
kernel
f1
1
X {0,1}ak X { 2}bk c
f1
k
X {0,1}a X { 2}b
f2
1
X { 3,4}aj X {5}bj d
f2
j
X { 3,4}a X {5}b
a
b
ak
bk
aj
bj
c
d
1
0
0
X { 0 ,1}
X { 2}
0
0
1
0
k
1
j
X { 0 ,1}
0
X { 2}
0
0
0
0
0
0
X { 3, 4 }
0
X {5}
0
0
0
1
X { 3, 4 }
X {5}
0
0
0
0
0
0
10
Common Divisors and
Rectangles
a
b
ak
bk
aj
bj
c
d
1
0
0
X { 0 ,1}
X { 2}
0
0
1
0
k
1
j
X { 0 ,1}
0
X { 2}
0
0
0
0
0
0
X { 3, 4 }
0
X {5}
0
0
0
1
X { 3, 4 }
X {5}
0
0
0
0
0
0
Rectangle: { (2,4) (1,2) }
X { 0 ,1}
X { 2}
X { 3, 4 }
X {5}
11
Satisfiable Rectangle
Definition:
A rectangle is satisfiable if for every variable:
if a value appears somewhere in row i and the
same value occurs somewhere in column j,
then the same value must occur in M(i,j).
X { 0 ,1}
X { 2}
X { 0 ,1}
X { 2}
X { 0 ,1}
X { 3, 4 }
X {5}
X { 3, 4 }
X {0,5}
X { 0, 3, 4} X { 0, 5}
satisfiable
not satisfiable
X { 0, 2}
satisfiable
12
Forming a Common Divisor
f1
f1
f2
f2
1.
2.
3.
4.
a
b
ak
bk
aj
bj
c
d
1
0
0
X { 0 ,1}
X { 2}
0
0
1
0
k
1
j
X { 0 ,1}
0
X { 2}
0
0
0
0
0
0
0
X {5}
0
0
0
1
X { 3, 4 }
X {5}
0
0
0
0
0
X
{ 3, 4 }
0
For each row of the rectangle, take the union or row entries
AND these with the co-kernel associated with that row
For each column take the union of the column entries
AND these with column labels.
5. OR these together
a
b
f1
k
X { 0 ,1}
X { 2}
X { 0 ,1, 2}k
factor in f1
f2
j
X { 3, 4 }
X {5}
X { 3, 4 , 5 } j
factor in f2
a X { 0 ,1, 3, 4 }+ b X { 2, 5 }
common divisor
13
Final Result
a
b
k
X { 0 ,1}
X { 2}
X { 0 ,1, 2}k
factor in f1
j
X { 3, 4 }
X {5}
X { 3, 4 , 5 } j
factor in f2
a X { 0 ,1, 3, 4 }+ b X { 2, 5 }
common divisor
f1 kX { 0,1, 2} ( aX { 0,1, 3,4} bX { 2,5} ) c
f2 jX { 3,4,5} ( aX { 0,1, 3,4} bX { 2,5} ) d
14
Nice Result
Theorem:
If k is a kernel found by the usual
Boolean kerneling process for some binary encoding,
then it will be found by the MV factoring process.
In addition, the MV process can find some
“Boolean factors”
15
Binary Encoding
f1 X {0,1, 2}ky c
f 2 X { 3,4,5} jy d
y X {0,1, 3,4}a X { 2,5}b
0 x0 x1 x2
3 x0 x1 x2
1 x0 x1 x2
4 x0 x1 x2
2 x0 x1 x2
5 x0 x1 x2
0 x0 x1 x2
3 x0 x1 x2
1 x0 x1 x2
4 x0 x1 x2
2 x0 x1 x2
5 x0 x1 x2
f1 ( x1 x2 x1 x2 x3 )ky c
f 2 ( x1 x2 x1 x2 x3 ) jy d
y ( x1 x2 x1 x2 )a x1 x2b
f1 x1ky c
f 2 x1 jy d
y x0 a x0 x 2 b
16
Sets of Pairs of Functions
to be Distinguished (SPFDs)
• An SPFD is equivalent to a set of
incompletely specified functions (ISFs)
• Proposed by Yamashita, Sawada and
Nagoya for simplifying binary FPGAs
• Implemented in SIS
• For binary functions, can be
represented by a bipartite graph
17
Example of SPFD computation
for MV-functions
Consider the MV-function:
X
Z
F
0
1
2
2
0
1
0
1
0
1
1
0
R
R
Y
G
G
Y
FR X { 0} Z X {1} Z
FY X {1, 2} Z
FG X { 0, 2} Z
Old network
SPFDF(X,Z)
xz
00
Red
21
11
Green
01
20
10
Yellow
18
Assign Edges to Inputs
SPFDX(X,Z)
SPFDF(X,Z)
xz
00
01
01
Red
21
11
21
11
xz
00
20
10
Green
20
10
00
Yellow
xz
21
11
01
20
SPFDZ(X,Z)
10
19
Re-synthesize X
W=SPFDX(X,Z)
xz
00
1
11
20
X
21
01
0
10
FR X { 0} Z X {1} Z
FY X {1, 2} Z
FG X { 0, 2} Z
Old network
WX ZX Z
{0}
0
1
2
2
0
1
Z
0
1
0
1
1
0
{ 1}
F
R
R
Y
G
G
Y
W
1
1
0
0
0
0
FR W X { 0} Z X {1} Z
FY W Z FR Z
FG W Z FR Z
New network
20
SPFDs
• Allows more flexibility than simple
don’t cares
• Changes both function and some of
its inputs simultaneously
• Extended to multi-valued functions.
21
Decomposition of MultiValued Functions
(Brzozowski and Lou)
Consider partially-specified MV-functions
f : E n Dm with n inputs and m outputs.
E is a finite non-empty set and
D 2 is the set of subsets of E
E
Decomposition is finding a function g such that
f ( x1 , , xn ) h( u1 , , ur , g ( v1 , , vs ))
where
( u1 , , ur ) ( xi1 , , xir ) (v1 , , vs ) ( x j1 , , x js )22
Set Matrices
A function f is represented by a set
matrix, e.g.
inputs
{1}
Not
{1}
consistent
{0,1,2}
0
{1}
{0}
0
{0,1,2}
{1}
{0,1}
0
{0,1}
0
{0,1}
outputs
{0}
{0,2}
{0}
{0}
{1,2}
n=2
m=1
with n+m columns which must be
consistent.
23
Decomposition of MVfunctions
Definition: Given a set S, a blanket B=(b1,b2,b3,…,bk)
is a set of nonempty distinct (but not necessarily disjoint)
subsets of S, called blocks, whose union is S.
Example: S={1,2,3}, B={(1,2),(2,3), (1)}
Definition: A blanket product of two blankets B1
and B2 is given by
1) forming the cross product of intersections of blocks
2) removing duplicates and null intersections
Example: S={1,2,3},
B1={(1,2),(2,3),(1)},
B2={(1,2),(3)}
B1 x B2 = {(1,2),(2),(3), (1)}
24
Row blanket for a set
matrix
This is a list of unique sets of rows which
cover each minterm in the input/output space, e.g.
inputs
{1}
{1}
{0,1,2}
{1}
{0}
{0,1,2}
{1}
{0,1}
{0,1}
{0,1}
outputs
{0}
{0,2}
{0}
{0}
{1,2}
000
001
002
010
…
100
...
-
3
5
5
3
- 1,3,4
So row blanket for this is
Bf={(3),(5),(1,3,4),(1,2,3,4),(2),(1)}
25
Example of Decomposition
x1
0
1
2
1,2
x2
0
0
1
1
2
2
x3
0
2
0
2
0
2
x2
0
1,2
0,1,2
0,2
BV
<
1,3,4
1,4
2,3
2
2,3,4
2,4
x2
0,2
0,2
0
0,2
Bg
f1
0,1
0,2
1,2
0,1
f2
0
1
2
1,2
u=x1
v=x2,x3
f(x)=h(u,g(v))
codes g(v)
1,3,4
2
1,2,4 1,3,4 0,2
2,3,4
1
1,2,4 2,3,4 0,1
2,3,4
1
1,2,4 2,3,4 0,1
2
2
1
1
1
0
To find g(v), form
the blanket Bv.
Find a blanket Bg that
BV<Bg and BU x Bg <Bf
Encode the
row sets of Bg
Choose a code
for each minterm
in the V space.
26
x2
x3
0
0
1
1
2
2
0
2
0
2
0
2
x1
0
1
2
1,2
BV
<
1,3,4
1,4
2,3
2
2,3,4
2,4
x2
0
1,2
0,1,2
0,2
x2
0,2
0,2
0
0,2
Bg
codes g(v)
1,3,4
2
1,2,4 1,3,4 0,2
2,3,4
1
1,2,4 2,3,4 0,1
2,3,4
1
1,2,4 2,3,4 0,1
f1
0,1
0,2
1,2
0,1
f2
0
1
2
1,2
2
2
1
1
1
0
g
2
0,1
1,2
0,1,2
27
Computing h(u,g)
X1
BU
0
1
1
2,4
2
3,4
x1
0
1
2
1,2
x2
0
1,2
0,1,2
0,2
g
Bg
BU*Bg <
2
2
0
1
2
0
1
1,3,4
1,3,4
1,2,4
2,3,4
1,3,4
1,2,4
2,3,4
1
4
2,4
2,4
3,4
4
3,4
x2
0,2
0,2
0
0,2
f1
0,1
0,2
1,2
0,1
f2
0
1
2
1,2
1. List each minterm of U
3. List possible codes of g that
can correspond to these minterms
5. List all blocks of Bf that cover BU*Bg
Bf
1
2,4 4 3,4
2,4
2,4
3,4
2,4 4 3,4
3,4
g
2
0,1
1,2
0,1,2
h1
0,1
0,1
0
0
1
0,1
1
h2
0
1,2
1
1
2
1,2
2
The outputs h1 and
h2 are obtained
by intersecting the
outputs of the
chosen rows.
2. List rows that cover it = BU
4. List corresponding blocks of Bg
with these codes
6. Choose one block of Bf for
28 the
implementation
Final Result
x1
0
1
2
1,2
X1
0
1
1
1
2
2
2
g
x2
0
1,2
0,1,2
0,2
=g(x1,x2)
g
2
2
0
1
2
0
1
2
0,1
1,2
0,1,2
h1
=
h1(x1,g)
h2(x1,g)
Note that the results are
incompletely specified functions
0,1
0,1
0
0
1
0,1
1
h2
0
1,2
1
1
2
1,2
2
29
Conclusions and Comments
• Methods have been developed for
representing and manipulating multi-valued
functions
• Conceptually, the best way to deal with
MV-logic is
– to manipulate them directly,
– followed by intelligent binary encoding,
– followed by binary manipulations
• We require such a logic package to
experiment more fully with these methods but this has not been developed to date.30
© Copyright 2026 Paperzz