280 likes | 399 Views
Symbolic Simulation with Approximate Values. Chris Wilson, David L. Dill Computer Systems Laboratory Stanford University. Randal E. Bryant CS Dept. Carnegie-Mellon University. Bug rate. Directed testing Random testing. Many “easy”. Model checking Emulation Semi-formal methods. fewer
E N D
Symbolic Simulation with Approximate Values Chris Wilson, David L. DillComputer SystemsLaboratory Stanford University Randal E. BryantCS Dept. Carnegie-Mellon University
Bug rate Directed testing Random testing Many “easy” Model checking Emulation Semi-formal methods fewer “hard” time Verification Bottleneck
Symbolic simulation Our Approach Bug rate time
Symbolic Simulation • Efficiency • 1 symbolic test <=> many directed tests. • Ease of use • short tests => easy to write, debug. • Low Risk • User controls number of symbolic variables. • Blow up • BDDs too unpredictable. How to prevent blow up?
Our Contribution • Approximate values • Simulator chooses amount of approximation. • Function of node/time. • Adaptive variable classification • Low effort at start. • Increase effort as necessary. • Efficient BDD overflow handling. • Automatically trade time for memory. • Set relevant variables to constants. • SAT-based case splitting.
Related Work • Symbolic Trajectory Evaluation [BryantSeger95] • Approximate values allowed on inputs. • Simulator has no flexibility in creating BDDs. • Innologic • Commercial symbolic simulator. • Based on STE. • Sets random variable to constant on BDD overflow. • Quasi-Symbolic Simulation [DAC00] • Scalar values/SAT-based case splitting. • Fast/no memory overflow. • Exponential simulation time in number of control variables.
<d1,d2,d3,d4> 23 pass/ fail datain = dataout <a1,a2,a3,a4> 408 address 0 interrupt 5 <c1,c2,c3> req valid dly =0 counter request DUT “read” 0 1 “write” 0 Symbolic System Simulation Symbolic test = directed test with symbolic values
A B exact approximate 0 0 0 00 1 0 01 0 0 X1 1 1 X A & B Approximate Values Simulator Values are functions of symbolic variables.
BDDs with Approximate Values • Ternary MTBDDs • Leaf nodes = {0,1,X} • Modify BDD apply algorithm. Apply(F,G) find top variable V compute L=left(F,G), R=right(F,G) if node(V,L,R) exists, return it else create node(V,L,R) return node
BDDs with Approximate Values • Generic Approximate BDD apply algorithm. Approx_Apply(F,G) find top variable V compute L=left(F,G), R=right(F,G) if node(V,L,R) exists, return itelse if (want_exact(V,L,R)) create node (V,L,R) return nodeelse /* approximate */ return X
Exact Approximate Variable Types Data Control Don’t care
Variable Classification • Goal: simulation effort function of variable type • Control variables high. • Data variables medium. • can be done very cheaply! • Don’t care variables low effort.
Classification Algorithm • Simulator’s classification • Care • Don’t Care • Algorithm • Initially, all variables are Don’t Care. • Simulate using sub-domain values only. • Re-classify 1 variable as Care. • Repeat until sufficient variables classified.
Sub-Domains • Sub-domain • Limited set of values. • Small representation. • Fast evaluation. • Approximate values are combinations of… • Exact BDD nodes. • Sub-domain values. • Exact nodes ordered above sub-domain nodes. • Example: Quasi-symbolic sub-domain. • Note: paper describes different sub-domain.
b a a Etc. X 0 1 1 0 0 1 1 0 Quasi-Symbolic Values • Quasi-symbolic sub-domain • {0,1,X,a,~a,b,~b,…} • If computed value not in domain… • Return X. Exact value allowed ifl,rare both constants.
Associated variable (c) Propagate care variables (a) (a) Final associated variable= care variable (b) (b) Variable Classification 0 1 & C 1 (a) A X & & A B 1 & B
BDDs with Approximate Values • Approximation using: • quasi-symbolic values and … • Variable classification. Approx_Apply(F,G) find top variable V compute L=left(F,G), R=right(F,G) if node (V,L,R) exists, return itelseif (V is care variable OR L,R are constants) create node (V,L,R) return node else /* approximate */ return X
a a b b b b c X X X X d e f X 0 1 Unmarked variables in BDDs A B C D E F marked care unmarked
Observations • BDD size function of care variables only. • Data variables limited to exactly one node in BDD. • Don’t care nodes quickly become X.
BDD Overflow • No room to create new BDD node. • Handle using approximation rule. Approx_Apply(F,G) find top variable V compute L=left(F,G), R=right(F,G) if node (V,L,R) exists, return itelse if (want_exact(V,L,R) AND space in BDD node table) create node (V,L,R) return node else /* approximate */ return X
X A=1 A=0 X B=0 B=1 0 0 BDD Overflow Handling • Set care variables to constants. • variable classification algorithm selects variable. • SAT-based case splitting for completeness.
Experiments • Evaluate scalability • Increase number of care variables in a test. • Plot total simulation time. • Maximum BDD size. • Total BDD nodes used.
Datatransfer Test Design 150K gates, 2500 latches 16 control 10 data ~300 don’t care Pentium Pro bus MCU Synfinity Interconnect
Simulation Time Time(sec.) Number of Care Variables
Maximum BDD Size BDDnodes Number of care variables
Total BDD Nodes BDDnodes Number of care variables
Summary • Want to improve system level verification. • Use symbolic simulation. • Many don’t cares. • Control logic more important than data. • Use approximate BDDs • Exact values on care nodes. • Approximate values on don’t care nodes. • Variable classification determines approximation. • BDD overflow handled using approximation.