系統晶片驗證 (SoC Verification)

系統晶片驗證 (SoC Verification)
94 學年下學期電機系研究所選修課程 943 U0250
Homework #3 BDD-Based Verification (Reference Solution)
Adapted from: xxxxxxx54
1.
Prove that “f ⊕ g = x ⋅ (fx ⊕ gx) + x’ ⋅ (fx’ ⊕ gx’)”, where operator ‘⊕’ is
“exclusive-OR”, and x’ means the inversion of x.
f = x ⋅ fx + x’ ⋅ fx’
g= x ⋅ gx + x’ ⋅ gx’
f ⊕ g = f’g+fg’
=( x ⋅ fx + x’ ⋅ fx’)’(x ⋅ gx + x’ ⋅ gx’) + ( x ⋅ fx + x’ ⋅ fx’)(x ⋅ gx + x’ ⋅ gx’)’
= x ⋅ fx’ ⋅ gx + x’ ⋅ fx’’ gx’ + x ⋅ fx ⋅ gx ‘+ x’ ⋅ fx’ gx’ ‘
= x ⋅ (fx’ ⋅ gx + fx ⋅ gx ‘) + x’ ⋅( fx’’ gx’ + fx’ gx’ ‘)
=x ⋅ (fx ⊕ gx) + x’ ⋅ (fx’ ⊕ gx’)
1
2.
(a) Draw the BDDs for gates g1 to g9 of the following circuit with the variable
ordering {a, b, c, d, e, f} from top to bottom. Draw them in the same
diagram with arrows pointing to the BDD nodes that represent the functions
g1 to g9. (Note: just draw regular BDDs; no complement edges).
c
g4
b
d
g1
g5
e
¬c
g2
g8
g6
d
a
b
g9
g7
g3
o2
f
a, b, c, d, e, and f are primitive inputs, o1 and o2 are primitive outputs, and
‘¬c’ is the inversion of ‘c’.
g5
g1
g2
g3
g4
b
c
b
c
a
c
b
d
d
c
d
e
b
e
d
G1:
1
G2:
1
G3:
1
G4:
2
1
G5:
1
g7
g8
g6
a
c
d
a
b
b
b
c
c
c
d
d
d
d
d
G6:
e
e
e
G7:
1
G8:
1
O2
g9
a
a
O1
b
b
c
c
d
d
b
c
d
b
b
c
c
d
d
c
d
e
e
e
f
G9:
1
o1:
1
3
o2:
1
1
(b) A BDD node ‘s’ is said to be “inside” the cone of another BDD node ‘r’ if
there exists a path from ‘r’ through ‘s’ to terminal node ‘1’ or ‘0’. Otherwise,
it is called “outside” the cone of BDD node ‘r’ (e.g. node ‘t’ in the following
figure). Remove the BDD nodes that are NOT in any inside cone of BDDs
g1 to g9. Count the number of remaining BDD nodes in total. How many
nodes are inside the BDD nodes of o1 and o2 (i.e. g5 and g9)?
o1 has 6 nodes.
r
o2 has 9 nodes.
t
s
1
0
(c) In order to witness (o1 = 1) and (o2 = 1), we use the “witness BDD
generation algorithm” as shown in slides 67 to 74. Show your steps and
result BDDs for o1 and o2. Compare them with the BDDs in problem 2-(b).
For output o1 :
I)
Witness o1 = “1”, choose g1 = “1” and g2= “0”
II)
Build g1 and g2’
III)
Return restrict (G1 G2’)
IV)
(G1/c = G1/c’) thus return restrict [G1 , (G2’/c’ or G2’/c)]
V)
(G2’/c’ or G2’/c) =1, therefore return G1
4
VI)
ended result BDD :
For output o2
I)
witness o2 =1, this is a controlling value. Thus build BDD for each
fan-ins
II)
Construct G8=1, this is a non controlling value. Witness G8 =1
III)
choose G4 = “1” and G7= “0”, restrict (G4,G7’)
IV)
built G4 and G7’
G4
G7'
b
a
c
b
d
c
1
d
d
e
1
5
V)
Restrict (G4 , G7’). It is observed that (G4/a = G4/a’) , therefore
continue restrict (G4, G7’/a’ or G7’/a) but (G7’/a’ or G7’/a)=1
return (G4)
VI)
In another words, restrict (G4,G7’) returns (b.c.d)
VII)
Finally, the result BDD is constructed. (we know the value of f
because it’s a controlling value)
Witness o2 =1 :
6
3.
Given the synchronous modulo-8 counter as below:
x0
y0
x1
y1
x2
y2
(a) What are the transition functions for y0, y1 and y2?
y0=x0’
y1=x0⊕ x1
y2=(x0 & x1) ⊕ x2
7
(b) What are the transition relations for individual registers TR0(y0, X),
TR1(y1, X) and TR2(y2, X)?
y1
x0
x0
y0
x1
x0
x1
x1
x0
1
1
TR0
TR1
y2
x0
x0
x1
x2
x2
x0
x0
x1
x1
x2
x2
1
TR2
8
x0
x0
x1
x2
x2
x1
(c)
What is the monolithic transition relation (i.e. representing the whole circuit
transition relation in a single equation) TR(Y, X)? Draw the BDD for this TR(Y, X) with
the variable order { y0, y1, y2, x0, x1, x2 }.
y0
y1
y1
y2
y2
y2
y2
x0
x0
x0
x0
x0
x0
x0
x0
x1
x1
x1
x1
x1
x1
x1
x1
x2
x2
x2
x2
x2
x2
x2
x2
1
9
(d)Suppose the initial state for this counter is S0: (x0, x1 x2) = (0, 0, 0). Compute the
next state function by S1(Y) = ∃X⋅(S0(X) ∧ TR(Y, X)). Perform the computation on
BDDs.
y0
y0
y1
y2
x0
y1
y2
x0
x0
y1
y2
x0
x0
y2
x0
x0
x0
x0
x1
x1
x1
x1
x1
x1
x1
x0
x1
x1
x2
x2
x2
x2
x2
x2
x2
x2
x2
1
1
and
10
1
=
(e) Rewrite the equation in (d) to conjunctively partitioned TR and apply early
quantification as: S1(Y) = ∃x0 { ∃x1 { ∃x2⋅(S0(X) ∧ TR2(y2, X)) }
∧ TR1(y1, X) } ∧ TR0(y0, X). Perform the computation on BDDs and
compare the results with (d) in terms of average and peak numbers of BDD
nodes.
y2
x0
x0
x1
x2
x2
x0
x0
x1
x1
x2
x2
x0
x0
x1
x2
x2
x2
1
1
and
y2
y1
x0
x0
x1
x2
x0
x0
x0
x1
x1
x1
x2
x2
x1
1
1
=
and
11
x1
y1
y2
y2
x0
x0
x0
x1
x1
x1
x1
x2
x2
x2
x2
x1
1
=and
1
y0
y0
y1
y1
y1
y1
y2
y2
x0
x0
y2
y2
y2
x0
x0
y0
x1
x0
x1
x1
x1
x1
x2
x0
x2
x0
x2
x2
x0
1
=
1
and
1
=
1
and
12
x2
1
=
In (d) the peak nodes =31
In (e) the peak nodes =15
the average nodes=(15+15+11)/3=14
(f) Extend the equation in (d) using iterative squaring as: S2(Y) = ∃X (F2(Y, X) ∧
S0(X)), where F2(Y, X) = ∃K (TR(Y, K) ∧ (TR(K, X)). Compute the next state
function S2(Y) using BDDs.
y0
y1
y1
y2
y2
y2
y2
k0
k0
k0
k0
k0
k0
k0
k0
k1
k1
k1
k1
k1
k1
k1
k1
k2
k2
k2
k2
k2
k2
k2
k2
x0
x0
x0
x0
x0
x0
x0
x0
x0
x1
x1
x1
x1
x1
x1
x1
x1
x1
x2
x2
x2
x2
x2
x2
x2
x2
x2
1
1
and
13
y0
y1
y2
k0
k1
k2
x0
x1
x2
=
1
14