Transcript Lecture Notes on ``Computational Boolean Algebra`` (PPT Slides)
ENGG3190 Logic Synthesis Computational Boolean Algebra Winter 2014 S. Areibi School of Engineering University of Guelph
2
Outline
• Computational Boolean Algebra “Basics” • Shannon Cofactors and Properties • The Boolean Difference Operator • Quantification Operators • Recursive Tautology • URP (Unate Recursive Paradigm)
Computational Boolean Algebra
Computational Boolean Algebra are algorithmic Circuits.
and computational strategies for manipulating Boolean Functions and It is a set of
Data structures , Techniques and theorems , Algorithms , It will help us to simplify and optimize circuits, repair circuits, prove that they perform certain tasks.
y + z’ + yz’
Co-factors of F()
xz’
Definition
The cofactor C xj of a cube C • • • with respect to a literal x j C if x C\{x j j and x j } if x if x j j is do not appear in C appears positively in C, i.e. x j C appears negatively in C, i.e. x j C
Example
If C = x 1 x 4 ‘ x 6 C x2 = C (x 2 does not appear in C ) C x1 = x 4 C x4 = ‘x 6 (x (x 1 4 appears positively in C) appears negatively in C) 8
F xi = Positive Co-factor F xi’ = Negative Co-factor
Not a proof but a case study Let xi = 1 F(x1, x2, …, xi=1, ….) = 1.F(xi=1) + 0.F(xi=0) = F(xi=1) Which is the same!!
The same can be obtained by letting xi=0
Shannon (Boole) Cofactors
The cofactor f xi f xi (x 1 , x 2 , …, x n ) = f (x 1 , …, x i-1 , 1, x i+1 ,…, x n ) (x 1 f a , x of f by a literal a=x 2 , …, x n ) = f (x 1 i , …, x or a=x i-1 , 0, x i is i+1 ,…, x n ) The computation of the cofactor is a fundamental operation in Boolean reasoning!!!!
Example:
f = abc + abc
F no longer depends on a
f a = bc c a b 11 c a b
Shannon Cofactor
f
abc
a b c
a b c
a b c
on off Don’t care
a f a
bc
b c
12
Shannon Expansion Definitions:
f : B
n
B
f
x f i x i
Theorem:
F is a cover of f. Then F x i is also a cover of f.
We say that f (F) is expanded about x i . x i is called the splitting variable .
x i
x i 13
Example
F F
aF
a
aF
a
)
bc c b Cube
bc
a got split into two cubes c a b 14
Generalized Cofactor
• The generalized cofactor f C of f by a cube C is f with the fixed values indicated by the literals of C, e.g. if C=x i x j , then x i =1, and x j =0.
• if C= x 1 x 4 x 6 f C is just the function f restricted to the subspace where x 1 =x 6 =1 and x 4 =0.
• As a function, f C does not depend on x 1 ,x 4 or x 6 anymore (However, we still consider f C as a function of all be independent of x
1 ,x 4 and x 6
).
n
variables, it just happens to 15
Assume we have a mux with two Inputs (a,b).
Let
variable x
control the selection Line.
If x = 0, we send a If x = 1, we send b F = a.x’ + b.x
Negative Co-factor x’ . F(x=0) + x . F(x=1) This is Shannon Expansion!! Positive Co-factor
F(x=1) = y . F(x=1,y=1) + y’ . F(x=1,y=0) F(x=0) = y . F(x=0,y=1) + y’ . F(x=0,y=0) x.y.F(x=1,y=1) + x.y’.F(x=1,y=0) + x’.y.F(x=0,y=1) + x’.y’.F(x=0,y=0)
Notice we have four sub-Boolean Functions when cofactoring around two vars
Shannon Cofactors: Example
F = a.b + a.c + a.b’.c’ + a’
F a F a ’ = b + c + b’.c’ (a’ is gone since a=1) = 1 (first three terms dissapear) F = a.Fa + a’Fa’
F
a
= b + c + b’.c’ Decompose F further around b bF
ab F ab F ab’
+ b’F
ab ’ = 1 + c = c + c’
(function of c only)
Recursive?
Binary Recursion Tree
The recursive Shannon expansion corresponds to a binary recursion tree
f
xf x
x f x
xy
y f x y
)
xy
y f x y
)
x
Example:
1 x 1 0 1 0
(v)
1 x 2 0 1 y 0 1 x 3 0
f xy
v
Path (v) to node v corresponds to cube c (v) Example: c (v) = x 1 x 2 ‘x 3
f x y
1 y 0
f xy f x y
20
Computational Boolean Algebra
Use of Shannon Cofactors Properties of Cofactors Boolean Difference
F G H
(F x )’
We are measuring the sensitivity of f to small changes in x
F
x
xor F
x’ XOR is the ODD Function
Like Additions
f = x’, df/dx = f x xor f x’ f x =0, f x’ =1 df/dx = 0 xor 1 = 1 what make this function == 1?
We must make y=0, Any change on x will change f f = x+y, f x =1, f x’ =y df/dx = 1 xor y = y’, f = x.y, f x What makes this function == 1?
We must make y=1, if you change x
f will change = y and f df/dx = y xor 0 = y f = x xor y, f x = y’, f x’ df/dx = y xor y’ = 1, =y, x’ =0,
APPLICATIONS?
When does a change in C in make a change to C out ?
((C out ) C in =1) = ab + (a + b).1 = ab + (a+b) = a(b+1) + b = a + b ((C out ) Cin =0) = ab dC out /dC in = C out (c in =1)
xor
= (a + b)
xor
C out (cin=0) = ab = (a+b)’ ab + (a+b) (ab)’ = a xor b
What does this mean?
When a != b any change c in will cause change in C out
Computational Boolean Algebra
New Quantification Operators
Existential Quantification Universal Quantification A Realistic Application
Application to Logic Network Repair
ALSO CALLED CONSENSUS OF F wrt Xi
ALSO CALLED the SMOOTHING OF F wrt Xi
Universal Quantification What makes this a 1?
These other inputs make F=1 FOR ALL values of x Existential Quantification What makes this a 1?
There exits a value of ‘x’ that makes F=1 for this input Pattern of other variables.
Quantify the ‘x’ then quantify the ‘y’
What if we quantify the A Operands?
Independent of A1 A0!!
0
X + D 0 XD 0
X + C + 0 + XD + 0 = X + D
F(a,b) = ab + b’ == a + b’ Note: This is a simple and Trivial Example!!
What we want?
Values of constants d0,d1,d2,d3 that make Z == 1 For all possible values of original inputs a, b!!
Universally quantify the variables ‘a’ and ‘b’ out of the Z
function, this function will then depend only on d0,d1,d2,d3 == 1 (a, b) will disappear by cofactors
MUX Eqn
We will first use the above expression of the MUX written and then substitute:
a.b for s 1 and
b’ for s 0
G = d 0 (ab)’b’’ + d 1 (ab)’b’ +d 2 = d 0 (ab)’b + d 1 (ab)’b’ + d 2 (ab) b’’ + d ab b + 0 3 = d 0 (a’ + b’)b + d = d 0 a’b + d 1 b’ + d 2 1 (a’ + b’)b’ + d ab 2 ab (ab)b’
So now Z = G xnor F == GF + G’F’ What I want is to go calculate ** (For all a b Z) = Z ab . Z a’b . Z ab’ . Z a’b’
If we Calculate Z then find Co-factors, this will be complicated!!
Is there an easier way!
When a=0,b=0 then Z a’b’ = d 1 xnor 1 = d 1 When a=0,b=1 then Z a’b = d 0 xnor 0 = d 0 ’ When a=1,b=0 then Z ab’ = d 1 xnor 1 = d 1 When a=1,b=1 then Z ab = d 2 xnor 1 = d 2
The thing that I need to calculate is the universal quantification (FOR ALL ab Z) (d0,d1,d2,d3) = AND of all cofactors=
d0’d1d2
!!
What did we get??
How do we make this a ‘1’??
To make this a 1 (i.e. repair it) we need to make d 0 =0, d 1 =1,d 2 =1, d 3 =x
0 1 1 1 0 1 1 x 0 1 1 0
Computational Boolean Algebra
Positional Cube Notation (PCN) Tautology Checking
Recursive Tautology Concrete data structure URP (Unate Recursive Paradigm)
Tautology
F
acd
bcd
abd
ad
bcd
abd
abc acd
cd
ac
Given a cover F, we want to know if F = 1? NOT EASY !!!
F= 1311 3111 2132 2322 3321 1323 1332 3212 2231 2213 == 1?
53
a’ bc ab Is this a minimal representation?
NO
a’ bc
[a b c ] a’ = [10 11 11 ] [a b c ] bc = [11 01 01 ]
Anding Two Cubes and getting 00 (void) means kill the cube
EX: f(a,b,c) = a’ + bc + ab [10 11 11], [11 01 01], [01 01 11]
What if the function I am looking at is too complex? Break it into two pieces (cofactors) thereby decomposing it into simpler problems!!
Steps
abd bc’ a
1 c
1
[11 01 11 01] (change 01 to 11) [11 01 10 11] (nothing !)
[01 01 11 01] (nothing!)
Cube Vanishes!!
is unate? Why? Because you see variable ‘a’ but not a’ you see c’ but not c … is not unate? Why? Because you see variable ‘x’ and x’ … but it is unate in variable y!!
Analogy to Continuous Functions?
x 1 x 2 A Boolean function is called positive unate in x if the variable x orginally 0 changes to 1 and therefore the value of f(…,x,…) will remain flat or increases from
0 to 1
a b’c ac a b’c bc
Why do we care about this result?
1 1 1 1 1 1 1 1
1
Tautology Not a Tautology
x x’
You can have many rules but It will be computationally Expensive to check all of them!!
x + x’ = 1
The Binate Select Heuristic
Example Unate and non-unate covers: a b c d G = ac+cd 1 - 1 - - 1 0
is unate
F = ac+cd+bcd a b c d 1 - 1 - - 0 1 - 1 1 0
is not unate
=> Choose c for splitting !
• • The
binate variables
of a cover are those with both 1’s and 0’s in the corresponding column.
In the unate recursive paradigm, the BINATE_SELECT heuristic chooses a (most) binate variable for splitting, which is thus eliminated from the sub-covers. 66
Heuristic !!
Rules of Termination Selection Rule ..
Recursion ..
Generic Tautology Check
Algorithm
CHECK_TAUTOLOGY
(List_of_Cubes C) { if(C == ) return FALSE; if(C == {-...-})return TRUE; // cube with all ‘-’ x i =
SELECT_VARIABLE
C 0 =
COFACTOR
(C,^X i ) (C) if(
CHECK_TAUTOLOGY
(C 0 ) == FALSE) { print x i = 0 return FALSE; } C 1 =
COFACTOR
(C,X i ) if(
CHECK_TAUTOLOGY
(C 1 ) == FALSE) { print x i = 1 return FALSE; } return TRUE; } 69
when we set a=1 b [11 01 11] c [11 11 01] b’c’[11 10 10] fourth disappears Should we Stop?
when we set a=0
73
Tautology …
n n n n n n
Check if a function is always TRUE.
Plays an important role in all algorithms for logic optimization.
Recursive paradigm
• Expand about a variable.
• If all cofactors are TRUE then function is a tautology.
TAUTOLOGY
• The cover has a row of all 1s (Tautology cube).
• The cover depends on one variable only, and there is no column of 0s in that field.
NO TAUTOLOGY
• The cover has a column of 0s (A variable that never takes a certain value).
When a cover is the union of two subcovers that depend on disjoint subsets of variables, then check tautology in both subcovers.
74
… Tautology
n n
Unate heuristics
• If cofactors are unate functions, additional criteria to determine tautology.
• Faster decision.
A cover is not tautology if it is unate row of all 1’s.
and there is not a
n
If a function is expanded in a unate variable , only one cofactor needs to be checked for tautology
• Positive unate in variable xi, f xi checked for tautology.
f xi’ ; only f xi’ needs to be • Negative unate in variable xi, f xi checked for tautology.
f xi’ ; only f xi needs to be 75
Tautology Example
n n
f = ab+ac+ab’c’ +a’ Select variable a.
• Cofactor w.r.to a’ • 11 11 11 => Tautology.
• Cofactor w.r.to a is: n
Select variable b.
• Cofactor w.r. to b’ is: n • • Depends on a single variable, no column of 0’s => Tautology.
Cofactor w.r. to b is: 11 11 11 => Tautology
Function is a TAUTOLOGY.
76