420 likes | 551 Views
A Coverage Analysis for Safety Property Lists. Koen Lindström Claessen Chalmers University Gothenburg, Sweden. FMCAD 2007, Austin, Texas. Property-based Verification. Properties. Design. ?. Dynamic Verification. Checkers/ Monitors. PSL/SVA properties. Properties. Design. stimuli.
E N D
A Coverage Analysis for Safety Property Lists Koen Lindström Claessen Chalmers University Gothenburg, Sweden FMCAD 2007, Austin, Texas
Property-based Verification Properties Design ?
Dynamic Verification Checkers/ Monitors PSL/SVA properties Properties Design stimuli ? ? ?
Simulation Coverage 95% Statement coverage Path coverage Properties 75% Design In Formal Verification: 100% Gate coverage 98% State space coverage 66% Register coverage 83% stimuli
How About the Properties? 1. A => B 2. B & C => next A 3. not (A and C) 4. next A => B Design ? Removing / adding one of these does not affect coverage…
Property Coverage • We need coverage for properties • How much is the design constrained by properties? • Do the properties express what we want to say? • Are any properties missing? • (lots of work done on this) The more the merrier!
Mutation Coverage Properties Design Design ! ? “Point not covered”
Mutation Coverage • Expensive • Many (failing) calls to model checker • Involves the whole design • Solutions • Symbolically; still expensive • Approximations • Look at proof • Subset of mutations [Chockler, Kupferman,Vardi]
Design may change after analysis This Talk Design does not have to exist • A property coverage analysis • Independent of the design • Finds “forgotten cases” … • … which indicate forgotten properties • Relatively cheap • Only involves properties • Independent of design size • NaN • Not a quantitative analysis There may exist multiple designs
Forgotten Case Analysis 1. prop1 2. prop2 3. prop3 4. prop4 Design
“Forgotten Case”? • Properties specify a function : In Out? • Too strict • Means complete specification • Synthesizable • Balance • Strict enough: to catch forgotten cases • Loose enough: to be practically usable
In this trace: out1 is not constrained by properties at time 6: Forgotten case! Choice: Forgotten Case Properties OK in1 1 0 1 0 0 0 1 1 1 0 0 … in2 1 0 0 0 1 1 0 0 1 1 0 … in3 0 0 0 1 1 0 0 0 0 1 1 … out1 1 1 0 0 0 1 1 0 1 1 0 … out2 0 1 1 1 0 0 0 0 1 0 1 … 0 Properties still OK
Example: a FIFO fst always outputs the first element put overrides get FIFO get fst num put err in err signals for 1 clock cycle when something goes wrong – the FIFO does not break
A First Property List Safety properties • always (put=1 & num=n next err=1) • always (put=1 & num<n next num=num+1) • always (put=1 & num=0 next fst=in) • always (put=1 & 0<num<n next fst=fst) • always (get=1 & put=0 & num=0 next err=1) • always (get=1 & put=0 & 0<num next num=num-1) No restriction on the logic… n = max. FIFO size
Analyzing err get 0 … put 0 … in 0 … num 0 … fst 0 … err ? … Not constrained at time 0
Analyzing err: A Fix Add: • err=0 Holds at initial point in time
Analyzing err get 0 0 … put 0 0 … in 0 0 … num 0 0 … fst 0 0 … err 0 ? … Nothing goes wrong…
Analyzing err: A fix Add: • always (get=0 & put=0 next err=0)
Analyzing err get 0 0 … put 1 0 … in 1 0 … num 0 1 … fst 0 1 … err 0 ? … Nothing goes wrong…
Analyzing err: A fix • always (put=1 & num<n next num=num+1) • always (get=1 & put=0 & 0<num next num=num-1) Change to: • always (put=1 & num<n next num=num+1 & next err=0) • always (get=1 & put=0 & 0<num next num=num-1 & next err=0) Analysis does not complain about err anymore…
Analyzing num get 0 … put 0 … in 0 … num ? … fst 0 … err 0 … Not constrained at time 0
Analyzing num: A Fix Add: • num=0 Holds at initial point in time
Analyzing num get 0 0 … put 0 0 … in 0 0 … num 0 ? … fst 0 0 … err 0 0 … Not constrained
Analyzing num: A fix Add: • always (get=0 & put=0 next num=num)
Analyzing num get 1 0 … put 0 0 … in 0 0 … num 0 ? … fst 0 0 … err 0 1 … An error has occurred
Analyzing num: A fix • always (get=0 & put=0 next num=num) Change to: • always ((get=0 & put=0) vnext err=1 next num=num) The analysis is now happy about num… Dependencies between outputs…
Analyzing fst get 0 … put 0 … in 0 … num 0 … fst ? … err 0 … Not restricted But we don’t want to specify it!
Analyzing fst: A fix Logically vacuous: “fst=fst” Add: • always (num=0 free fst) A new keyword: free For the analysis: free x means that x is constrained: “don’t complain!”
Analyzing fst get 0 0 1 0 … put 1 1 0 0 … in 3 5 0 0 … num 0 1 2 1 … fst 0 3 3 ? … err 0 0 0 0 … Not restricted: FIFO behavior not specified in properties
Unconstrained Outputs Cases we have to be explicit about • Three causes: • It is supposed to be unspecified • We decide not to specify it (complicated) • We have forgotten to specify it Cases we want to catch
Analyzing fst: A fix • always (get=1 & put=0 & 0<num next num=num-1 & next err=0) Change to: • always (get=1 & put=0 & 0<num next num=num-1 & next err=0 & next free fst)
Analyzing fst get 0 0 … put 0 0 … in 0 0 … num 0 0 … fst 0 ? … err 0 0 … Real forgotten case
Analyzing fst: A fix • always ((get=0 & put=0) v next err=1 next num=num) Change to: • always ((get=0 & put=0) vnext err=1 next num=num & next fst = fst) The analysis is now happy about fst… Luckily, we used free…
New & changed properties initial values implicit behavior constant behavior • err=0 & num=0 • always (get=0 & put=0 next err=0) • always ((get=0 & put=0) vnext err=1 next num=num & next fst = fst) • always (put=1 & num<n next num=num+1 & next err=0) • always (get=1 & put=0 & 0<num next num=num-1 & next err=0 & next free fst)
Implementation • For output s, find a trace where • Props(s) is OK • Props(s’) is OK • Exists exactly one t where s[t]≠s’[t] • free(s)[t] should be false • (this trace must be infinite)
Implementation (I) Using a standard LTL model checker (NuSMV) • Find a trace satisfying: • Props(s) & Props(s’) & ◊!(s≠s’) • With the use of free: • Props(s,free_s) & Props(s’,free_s) & ◊!(~free_s & s≠s’)
Implementation (II) • Property observer for safety property phi: • □OK holds iff. phi holds • Analysis for property observers: • □OK(s) & □OK(s’) ◊!(s≠s’)
Discussion (I) • Forgotten case • Given an output signal s and a time t, and given the values of all other signals at all points in time, and given all values of s not at time t, do the properties force the value of s at time t? • Alternatives…
Discussion (II) • Freeness • “free s” does not indicate that s can take on any value • rather, it is an artifical way of constraining s for the sake of the analysis, without actually restricting it logically
Conclusion: This Analysis • Identifies forgotten cases • Which inspire forgotten properties • Forces to specify when outputs are free • Distinction between forgotten cases and underconstrainedness • Is design-independent • pre-design / multiple implementations • cost