Vlsi Cad:: Logic To Layout
Vlsi Cad:: Logic To Layout
1
Logic to Layout Computational Boolean
Algebra: Basics
Rob A. Rutenbar
University of Illinois
Computational Boolean Algebra…?
• Background…
• You’ve done Boolean algebra, hand manipulations, Karnaugh maps to simplify…
• But this is not sufficient for real designs
F(x=1,y,z) = F(x,y=0,z) =
function
0 x F mux
0
1 sel
function
1 x F x
• Notice also that order does not matter: (Fx)y = (Fy)x = Fxy
• For our example
Rob A. Rutenbar
University of Illinois
Next Question: Properties of Cofactors
• What else can you do with cofactors?
• Suppose you have 2 functions F(X) and G(X), where X=(x1,x2,...xn)
• Suppose you make a new function H, from F and G, say…
• H = F
• H = (F • G) ie, H(X) = F(X) • G(X)
• H = (F + G) ie, H(X) = F(X) + G(X)
• Interesting question
• Can you tell anything about H’s cofactors from those of F, G…?
(F•G)x = what? (F ’)x = what? etc.
Slide 13 © 2013, R.A. Rutenbar
Nice Properties of Cofactors
• Cofactors of F and G tell you everything you need to know
• Complements
• (F’ )x =
• In English: cofactor of complement is complement of cofactor
x x+Δ
Let Δ go to 0 in the limit and you got df(x)
Slide 16 dx © 2013, R.A. Rutenbar
Boolean Derivatives
• So, do Boolean functions have “derivatives”…?
• Actually, yes. Trick is how to define them...
• Basic idea
• For real-valued f(x), df/dx tell how f changes when x changes
• For 0,1-valued Boolean function, we cannot change x by small delta
• Can only change 0 ßà 1, but can still ask how f changes with x ...
• ∂( f ⊕ g ) / ∂x = ∂f/∂x ⊕ ∂g/∂x
• If function f is actually constant (f=1 or f=0, always, for all inputs)
• ∂f/∂x = 0 for any x
∂ ⎡ ∂g ⎤ ⎡ ∂ f ⎤ ⎡ ∂ f ∂g ⎤
( f • g) = ⎢ f • ⎥ ⊕ ⎢g • ⎥ ⊕ ⎢ • ⎥
∂x ⎣ ∂x ⎦ ⎣ ∂x ⎦ ⎣ ∂x ∂x ⎦
∂ ⎡ ∂g ⎤ ⎡ ∂ f ⎤ ⎡ ∂ f ∂g ⎤
( f + g) = ⎢ f • ⎥ ⊕ ⎢g • ⎥ ⊕ ⎢ • ⎥
∂x ⎣ ∂x ⎦ ⎣ ∂x ⎦ ⎣ ∂x ∂x ⎦
• Why?
• Because AND and OR on Boolean values do not always behave like
ADDITION and MULTIPLICATION on real numbers
x x
f f
y
x x
f y f
y
∂Cout / ∂Cin = ?
1 x F(x=1)
• “(∃xi F)” is a new function
• “∃” sign is “there exists” from logic;
and function also does not depend on xi
Note, like anything involving cofactors, both these new functions do not depend on xi
So: (∀xi F) and (∃xi F) both omit xi
Slide 27 © 2013, R.A. Rutenbar
Quantification Notation Makes Sense…
(∀x F) ( all original vars but x) ==1 when?
0 x F(x=0)
AND
1 x F(x=1)
OR
1 x F(x=1)
• Remember!
• (∀x F), (∃x F), and ∂F / ∂x are all functions...
• ..but they are functions of all the vars except x
• We got rid of variable x and made 3 new functions
Slide 29 © 2013, R.A. Rutenbar
Quantification Example
• Consider this circuit, it adds X=0 or X=1 to a 2-bit number A1A0
• It’s just a 2-bit adder, but instead of B1B0 for the second operand, it is just 0X
• It produces a carry out called C
and also has a carry in called D A1 0 A0 X
C a1 b1 a0 b0 D
adder
• What is (∀A1,A0 C)[X,D]…?
• A function of only X,D. Makes a 1 for values of X,D that make carry C=1 for
all values of operand input A1A0, i.e., makes a carry C=1 for all values of A1A0
• What is (∃A1,A0 C)[X,D]…?
• A function of just X,D. Makes a 1 for values of X,D that make carry C=1, for
some value of A1A0, i.e., there exists some A1A0 that, for this X,D makes C=1
Slide 30 © 2013, R.A. Rutenbar
Quantification Example
A1 0 A0 X
Do the math: C = A1A0X + A1(A0+X)D
C a1 b1 a0 b0
adder
D Need all 4 CA1A0 CA1’A0 CA1A0’ CA1’A0’
cofactors:
Specified Got
b
ab + b’ f(a,b) b ?? g(a,b)
a a
• Goal
• Can we deduce how precisely to change this gate to restore correct function?
• Lets go with this very trivial test case to see how mechanics work...
Slide 33 © 2013, R.A. Rutenbar
Network Repair
• Clever trick
• Replace our suspect gate by a
4:1 mux with 4 arbitrary new vars ?? g(a,b)
b
• By cleverly assigning values to a
d0 d1 d2 d3, we can fake any gate
• Question is: what are the right values
of d’s so g is repaired (==f) Replace with
b
a s1 s0
d0 00
d1
d2
01 mux G(a,b,d0,d1,d2,d3)
10
d3 11
y
x s1 s0
0 00
0 01
mux
0 10
1 11
y
x s1 s0
0 00
1 01
mux
1 10
0 11
Slide 35 © 2013, R.A. Rutenbar
Network Repair: Using Quantification
• Next trick
• Make new function Z(a,b,d0,d1,d2,d3) that =1 just when G == f
b
a s1 s0
d0 00
d1 01 G(a,b,d0,d1,d2,d3)
d2 mux
10
d3 11
exnor
(==) Z(a,b,d0,d1,d2,d3)
b f(a,b)
a
known good version of logic
Slide 36 © 2013, R.A. Rutenbar
Using Quantification
• What now?
• Think hard about exactly what we want:
d1 01
mux G(a,b,d0,d1,d2,d3)
d2 10
d3 11
exnor Z(a,b,d0,d1,d2,d3)
(==)
b f(a,b)
a
ab+b’
b
d0= 00
a
d0 00
s1 s0
d1= 01 mux
d1
d2
01
10
mux G(a,b,d0,d1,d2,d3)
d2= 10
d3 11
d3= 11
exnor Z(a,b,d0,d1,d2,d3)
(==)
b f(a,b)
a
111
011
001 101
c
b 010 110
a 000 100
Cube is just a “graph”
of a Boolean function,
but only vertices have
Slide 45 values for the function © 2013, R.A. Rutenbar
Positional Cube Notation (PCN)
• So, we say ‘cube’ and mean ‘product term’
• So, how to represent each cube? PCN: one slot per variable, 2 bits per slot
• Write each cube by just noting which variables are true, complemented, or absent
• In slot for var x: put 01 if product term has ...x... in it
• In slot for var x: put 10 if product term has ...x’... in it
• In slot for var x: put 11 if product terms has no x or x’ in it
111
011
001 101
c 010 110
b
a 000 100
Slide 46 © 2013, R.A. Rutenbar
PCN Cube List = Our Representation
• So, we represent a function as a cover of cubes (circle its 1’s)
• This is a list of cubes (this is the ‘sum’) in positional cube notation (of products)
• Ex: f(a,b,c)=a’ +bc +ab => [10 11 11], [11 01 01], [01 01 11]
BUG fix.
[10 11 11] 111
011
First slot is
for a’ 001 101
Other are c
don’t care b 010 110
a 000 100
f=1?? split on x
(fx =1 AND fx’ =1)??
y/n y/n
fx=1?? fx’=1??
• What else do we need here?
• Selection rules: which x is good to pick to split on?
• Termination rules: how do we know when to quit splitting, so we can
answer ==1 or !=1 for function at this node of tree?
• Mechanics: how hard is it to actually represent the cofactors?
f=1?? split on x
(fx =1 AND fx’ =1)??
y/n y/n
fx=1?? fx’=1??
• We need these:
• Selection rules: which x is good to pick to split on?
• Termination rules: how do we know when to quit splitting, so we can
answer ==1 or !=1 for function at this node of tree?
• Mechanics: how hard is it to actually represent the cofactors?
f = abd+bc’ fa fc
[01 01 11 01]
[11 01 10 11]
Slide 52 © 2013, R.A. Rutenbar
Unate Functions
• Selection / termination, another trick: Unate functions
• Special class of Boolean functions
• f is unate if a SOP representation only has each literal in exactly one polarity,
either all true, or all complemented
• Ex: ab + ac’d + c’de’ is …
• Ex: xy + x’y + xyz’ + z’ is ...
• Terminology
• f is positive unate in var x -- if changing x 0à1 keeps f constant or makes f: 0à1
• f is negative unate in var x -- if changing x 0à1 keeps f constant or makes f: 1à0
• Function that is not unate is called binate
Slide 53 © 2013, R.A. Rutenbar
Unate Functions
• Analogous to monotone continuous functions
y
This function is monotone non-decreasing,
whenever x2 ≥ x1, then f(x2) ≥ f(x1)
x
• Example: for a Boolean function f positive unate in x
Boolean
function f( ... x ...)
variable x
f
f==1? f==1?
split split
fx=1?? fx=1??
... ==1 YES 01 11 10 ==1 NO
11 11 ... 11 Rule 1 11 01 10 Rule 2 - It’s unate but
... 01 01 10 all don’t care
cube is not here
Slide 57 © 2013, R.A. Rutenbar
Recursive Tautology Checking
• Lots more possible rules...
• Rule 3: ==1 if cube list has single var cube that appears in both polarities
Why: function at this leaf is (stuff + x + x’ + stuff) == 1
fx=1?? split
01 11 11 ==1 YES
10 11 11 Rule 3 -
11 11 10 = ... + x + x’ + ...
‘1’ 11 11 11 c 11 11 01
c 11 11 01 c’ 11 11 10
f
• So we are done:
fa fa’ ==1
• Our tree has tautologies at all leaves!
• Note -- if any leaf !=1, then f != 1 too,
this is how tautology fails fab ==1 fab’ ==1
Slide 62 © 2013, R.A. Rutenbar
Computational Boolean Algebra
• Computational philosophy revisited
• Strategy is so general and useful it has a name: Unate Recursive Paradigm
• Abbreviated usually as “URP”
• Summary
• Cofactors and functions of cofactors are important and useful
• Boolean difference, quantifications; real applications like network repair
• Representations (data structures) for Boolean functions are critical
• Truth tables, Kmaps, equations cannot be manipulated by software