Multi-valued logic

advertisement
Logic Synthesis
Multi-Valued Logic
Courtesy RK Brayton (UCB)
and A Kuehlmann (Cadence)
1
Multi-Valued Logic
Up to now…two-valued synthesis
– Binary variables take only values {0, 1}
Multi-Valued logic
– Multi-valued variable Xi can take on values Pi = {0,…,|Pi|-1} (integers but no ordering implied)
– Symbolic variables take values from symbolic set, e.g. state:
{s0,s1,…,sn} or X: {a,b,c}.
– Enumeration types from RTL
– Set of values for each dimension is finite!!!!
2
Multi-Valued Logic
• Formally: F : P1  Pn  {0,1,*}
(sometimes called an mv-function ).
• Problem:
find the minimum SOP form for an incompletely-specified function of
this kind
• Big News:
Nothing really changes because solution space is still finite!!
3
Example “Truth Table”
• P1={0,1,2}, P2={0,1}
•
X1
0
0
1
1
2
2
X2
0
1
0
1
0
1

1
1
0
1

1
Here “2” means the value 2 and not {0,1}
f(0,0) = 1
f(2,1) = 1
f(1,0) = 0
f(2,0) = * unspecified (don’t cares)
4
MV Function
X3
X2
X1
on
off
Don’t care
5
Terminology
• Vertex:
A point of the space P1 
 Pn
• Cube:
A set c  c1 
 cn , ci  Pi
• Containment:
c  d (c, d cubes) iff ci  d i , i
When c is a vertex, d  c, also say c  d
• Implicant:
Cube c such that for all v c, F(v)  0
6
Terminology
• Onset minterm:
Vertex v such that f(v)  1. If v  (c1,
,cn )
then each ci has exactly one member.
• Prime Implicant:
Implicant c such that there is no implicant d
such that d  c
• Cover of F :
A set of implicants which together
contain every onset minterm of f
• Prime Cover of F:
A cover, each of whose elements is prime
7
Notation-MV Literals
Definition: A multi-valued literal
X ici is a binary logic function of the form
X ici  ( X i   1 )    ( X i   k )
where
 j  ci  Pi
Definition: A cube c  c1  c2    cn can be written as the product of
MV-literals:
X1c1 X 2c2  X ncn
8
Notation-MV Literals
• If ci=Pi we may omit X iPi from the expression (since X iPi =1)
• Note analogy to two-valued case:
X i{0}  X i
X i{1}  X i
X i{0,1}  1
•
Actually, multi-valued notation is superior to binary notation.
9
Example
Rows marked as a (b) form single
mv-cube implicant
Cube a  {0,2}×{0,1}  X1{ 0,2 }
Cube b  {0,1,2}×{1}  X 2{ 1}
Both a and b are prime implicants
X 1{ 0 } X 2{ 0 ,1 }  X 1{ 0 } is an implicant of F
X1
0
0
1
1
2
2
X2
0
1
0
1
0
1

1
1
0
1

1
a
a
b
b
a
a
b
The following are cube covers of F. F2 is a prime cover
F1  X 2{ 1}  X1{ 0 } X 2{ 0 }
F2  X 2{ 1}  X1{ 0,2 }
10
Positional Notation
Example: Cube1
X 1{A, B} X 2{R} P1={A,B,C,D}, P2={R,S} (Symbolic)
Cube1:
Cube2:
•
•
A B C D
1 1 0 0
1 1 1 1
R S
1 0
0 1
A cube does not depend on variable Xi if it has all 1’s in the set of columns
associated with Xi (Cube2 does nor depend on X1).
Each of the columns of a variable is called a part of that variable. There is one
part for each value a variable can take.
11
Positional Notation
Extension of Espresso notation
(value=0) (value=1)
0
1
1
1
0
0
1
1
2
Example:
C1
C2
C3
C4
C5
X1
11110
01100
01010
00110
00001
X2
00001
00011
00100
01001
11111
X3
11111
01010
11111
11010
10110
12
Positional Notation
5 Cubes
12345
X3
C1
C2
C3
C4
C5
X1
11110
01100
01010
00110
00001
X2
00001
00011
00100
01001
11111
X3
11111
01010
11111
11010
10110
X2
X1
13
Minimization for Multi-Valued Logic
Given:
Find:
Cover F of  and a cover D of the don’t-care set d,
A minimum sum-of-products form for 
Same problem as for two-valued
• Generate primes of (f+d)
• Generate covering table
• Solve the covering table (unate covering problem)
14
Applications of Multi-Valued Logic
Theorem: minimizing a two-valued (n input)  (m output) logic function g is
equivalent to minimizing a single binary-output MV-logic function:
f : {0,1}  {0,1}  ...  {0,…,m-1}  {0,1}
Proof( sketch):
Let g = {f0,…,fm-1} be the multiple output function. Consider the characteristic
function f of the multiple output function, (defined on (n+1) variables with the
last one, y, being multi-valued on {0,1,…,m-1} ) :
m 1
f ( x , y )  1    ( y  i )  fi ( x ) 
i 0
15
Applications of Multi-Valued Logic
Note:
An implicant of g (the multi-output function) is a cube c in the x-space where each output
is turned on only if fi(c)=1. Any output not turned on means no information (not offset),
since the each output is the OR of all of its input cubes.
g
X
x-cube
f1 f2 f3 f4 f5 f6
0 1 0 1 1 0
16
Other Applications: Encoding
•
Input Encoding problem
– bit-grouped PLA structure (decoded PLA)
•
Output encoding problem
– output phase optimization
•
State encoding problem
– Minimize symbolically to get constraints on a possible binary encoding
– solve constraints to derive binary code
– Re-minimize binary problem
– Implement in binary
17
Multi-Valued Minimization Example
f0  X 1 X 2 X 3  X 1 X 2 X 3  X 1 X 2 X 3  X 1X 2 X 3

g   f1  X 1 X 2 X 3  X 1 X 2 X 3  X 1 X 2 X 3  X 1 X 2 X 3

f2  X 1 X 2 X 3  X 1 X 2 X 3  X 1 X 2 X 3  X 1X 2 X 3
f : {0,1} {0,1} {0,1} {0,1,2}  {0,1}
f : P1  P2  P3  P4  {0,1}
f  X 10 X 20 X 30 X 40  X 10 X 21 X 30 X 40  X 10 X 21 X 31 X 40 
X 11 X 21 X 31 X 40  X 10 X 20 X 30 X 41  X 10 X 20 X 31 X 41 
X 10 X 21 X 31 X 41  X 11 X 20 X 31 X 41  X 10 X 20 X 30 X 42 
X 10 X 20 X 31 X 42  X 10 X 21 X 30 X 42  X 1 X 21 X 31 X 42
18
Example - after minimization
Prime and irredundant SOP of f:
f  X 10 X 21 X 31 X 4{0,1}  X 11 X 21 X 31 X 4{0, 2} 
X 10 X 2{0,1} X 30 X 4{0, 2}  X 10 X 20 X 3{0,1} X 4{1, 2} 
X 1{0,1} X 20 X 31 X 41
(five cubes 1+2+3+4+5)
Equivalent to:
f0  1  2  3  X1 X 2 X 3  X1 X 2 X 3  X1 X 2
f1  1  4  5  X 1 X 2 X 3  X 1 X 2  X 2 X 3
f2  2  3  4  X1 X 2 X 3  X1 X 2  X1 X 3
19
Example - after minimization
f0
f1
f2
Note: X1 X 2 X 3 is not a prime of f0, but X 1 X 2 X 3 X 4{0,2} is a prime of f.
Similarly for X1 X 2 X 3 .
20
Download