Example: stock market

SYSTEMVERILOG ASSERTIONS FOR FORMAL VERIFICATION

SYSTEMVERILOG ASSERTIONS FOR FORMAL VERIFICATIOND mitry Korchemny, Intel , November 4, 2013, Haifa Most of the examples used in this tutorial are borrowed from our SVA bookNovember 4, 2013 HVC20132 Agenda Introduction FORMAL VERIFICATION model. LTL properties Assertion statements Sequences and properties Clocks and resets Assertion system functions Metalanguage and checkers Local variables Recursive properties Efficiency and methodology tips Future directions and challengesNovember 4, 2013 HVC20133 INTRODUCTIONN ovember 4, 2013 HVC20134 Hardware VERIFICATION Task Does DUT meet the spec? Simulation Does DUT meet the spec for giveninput stimuli? FORMAL VERIFICATION (FV) Does DUT meet the spec for anylegal input stimuli?DUT(RTL)SPEC(Spec language)November 4, 2013 HVC20135 SYSTEMVERILOG ASSERTIONS (SVA) SYSTEMVERILOG (proliferation of Verilog) is a unified hardware design, specification, and VERIFICATION language RTL/gate/transistor level ASSERTIONS (SVA) Testbench (SVTB) API SVA is a FORMAL specification language Native part of SYSTEMVERILOG [SV12] Good for simulation and FORMAL verificationNo

Linear Time Model. Global Clock • We assume that the time is linear: • There is one global clock (AKA system clock or reference clock) which always ticks (never stops) • All signal changes are synchronized with the ticks of the global clock • Global clock introduces the notion of discrete time in the system • 0, 1, 2, … • Each number corresponds to a tick of the global clock

Tags:

  Ticks, The ticks

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of SYSTEMVERILOG ASSERTIONS FOR FORMAL VERIFICATION

1 SYSTEMVERILOG ASSERTIONS FOR FORMAL VERIFICATIOND mitry Korchemny, Intel , November 4, 2013, Haifa Most of the examples used in this tutorial are borrowed from our SVA bookNovember 4, 2013 HVC20132 Agenda Introduction FORMAL VERIFICATION model. LTL properties Assertion statements Sequences and properties Clocks and resets Assertion system functions Metalanguage and checkers Local variables Recursive properties Efficiency and methodology tips Future directions and challengesNovember 4, 2013 HVC20133 INTRODUCTIONN ovember 4, 2013 HVC20134 Hardware VERIFICATION Task Does DUT meet the spec? Simulation Does DUT meet the spec for giveninput stimuli? FORMAL VERIFICATION (FV) Does DUT meet the spec for anylegal input stimuli?DUT(RTL)SPEC(Spec language)November 4, 2013 HVC20135 SYSTEMVERILOG ASSERTIONS (SVA) SYSTEMVERILOG (proliferation of Verilog) is a unified hardware design, specification, and VERIFICATION language RTL/gate/transistor level ASSERTIONS (SVA) Testbench (SVTB) API SVA is a FORMAL specification language Native part of SYSTEMVERILOG [SV12] Good for simulation and FORMAL verificationNovember 4, 2013 HVC20136 SVA Standardization History 2003 Basic assertion features defined 2005 Improved assertion semantics 2009 Major changes in the language.

2 Deferred ASSERTIONS , LTL support, checkers 2012 Improved checker usability, final ASSERTIONS , enhancements in bit-vector system functions and in assertion control Part of SYSTEMVERILOG standardization (IEEE 1800)November 4, 2013 HVC20137 SVA vs. PSL FORMAL semantics of SVA is (almost) consistent with the FORMAL semantics of PSL [PSL10] Meta-language layers are quite different ( , checkers vs. vunits) SVA has well-defined simulation semantics; tightly integrated with other parts of SystemVerilogNovember 4, 2013 HVC20138 FORMAL VERIFICATION MODEL. LTL PROPERTIESN ovember 4, 2013 HVC20139 Linear Time Model. Global Clock We assume that the time is linear: There is one global clock (AKA system clock or reference clock) which always ticks (never stops) All signal changes are synchronized with the ticks of the global clock Global clock introduces the notion of discrete time in the system 0, 1, 2.

3 Each number corresponds to a tick of the global clockNovember 4, 2013 HVC201310[Pnu77]Global Clock in SYSTEMVERILOG In simulation the natural notion of global clock are simulation ticks . But such definition makes global clock very expensive In SYSTEMVERILOG there is a special construct for global clocking definitionNovember 4, 2013 HVC201311modulem(input logicclk, ..);global clocking @(posedge clk); clocking @$global_clock; : mMay be declared anywhere in the designDefault clocking defines the default clock for ASSERTIONS $global_clockis explicit designation of global clockglobal clocking is used in simulation, but usually ignored in FV and emulationIn practice most ASSERTIONS are written relative to some specific clock,not relative to the global clock.

4 Will be discussed laterFormal VERIFICATION Model Kripke structure: = , , , Finite set of states Set of initial states Set of Boolean variables (labels) : 2 Labeling function mapping each state to the set of variables that are true in this state (Left total) transition relation Shows to which states it is possible to transition from given stateNovember 4, 2013 HVC201312[Kr63] FORMAL VERIFICATION Model. Example = , = , , , , = November 4, 2013 HVC201313module m(input logic i, clk, output o);wire a = !i;global clocking @(posedgeclk); endclockingalways @($global_clock) o <= a;endmodule: mSymbolic Representation Each variable is represented as a pair: Current value (its value at the current time moment): Next value (its value at the next time moment): Each set and relation is represented by its characteristic function , = In SYSTEMVERILOG there is a notation of next value: $future_gclk(x) , corresponds to i ^ $future_gclk(o) Other future sampled value functions: $rising_gclk(x) !

5 X & $future_gclk(x) (for bit variables) $falling_gclk(x) x & !$future_gclk(x) (for bit variables) $steady_gclk(x) x === $future_gclk(x) $changing-gclk(x) x !== $future_gclk(x)November 4, 2013 HVC201314 Linear Time Model Linear time FV model defines a number of legal infinite traces Specification language describes the properties of these tracesNovember 4, 2013 HVC201315module m(input logicclk, i, output logico);global clocking @(posedgeclk); endclockingdefault clocking @$global_clock; endclockingalways@(posedgeclk) o <= !i;assert property (i |=> !o);endmodule: mi0 0 1 1 ..o0 1 1 0 ..i0 1 0 1 ..o1 1 0 1 ..i0 0 1 1 ..o0 0 1 1 ..Feasible tracesInfeasible traceLinear Time Language (LTL) Properties Properties are temporal statements that can be true or false Properties have a starting point (t), but no end point Boolean property: e Nexttime property: nexttimep In SVA there exists also a strong version: s_nexttime Discussed laterNovember 4, 2013 HVC2013160 1 2te0 1 2tpt+1 LTL Properties (cont.)

6 Always property: always p Eventually property: s_eventuallypNovember 4, 2013 HVC2013170 1 2tpp p pp p p0 1 2tpCompound Properties True from next moment: nexttime always p True from some moment: s_eventually always p Infinitely often: always s_eventuallypNovember 4, 2013 HVC201318tpppptpp p pp p ptpp p pp p ppppBoolean Connectives Negation: notp Conjunction: pandq Disjunction: porq Implication: pimpliesq Equivalence: piffq Condition: if(e) p elseq CaseNovember 4, 2013 HVC201319 Counterexample Counterexample trace witnessing a property failure In general case infinite May be finite Meaning that any infinite extension of this finite trace is a counterexampleNovember 4, 2013 HVC201320 Safety and Liveness Safety properties All their counterexample are finite , always e Liveness properties All their counterexamples are infinite , s_eventuallye Hybrid properties also exist Sometimes also called liveness November 4, 2013 HVC2013210 1 2t!

7 E0!e!e !e!e !e!e !e!e!e!e!e[AS87, KV01]LTL Properties. Until Non-overlapping until puntilq if qdoes not happen, pholds forever ps_untilq qmust eventually happen Overlapping until puntil_withq if qdoes not happen, pholds forever ps_until_withq qmust eventually happenNovember 4, 2013 HVC2013220 1 2tpp p pp p q0 1 2tpp p pp pp andqSafetySafety(General) liveness(General) livenessBounded Versions November 4, 2013 HVC201323 PropertySemantics[s_]nexttime[m] p[s_] [s_]nexttimep[s_]eventually[m:n] p[s_]nexttime[m] p or[s_]nexttime[n] ps_eventually[m:$] ps_nexttime[m] s_eventuallyp[s_]always[m:n] p[s_]nexttime[m] p and[s_]nexttime[m] palways[m:$] pnexttime[m] alwayspASSERTION STATEMENTSN ovember 4, 2013 HVC201324 Assertion KindsNovember 4, 2013 HVC201325 AssertionsClockedUnclockedConcurrentImme diateDeferredFinal20092012(Concurrent) Assertion Statements ASSERTIONS Insure design correctnessassert property (p); Assumptions Model design environmentassume property (p); Cover statements To monitor coverage evaluationcover property (p); Restrictions To specify FORMAL VERIFICATION constraintrestrict property (p);November 4, 2013 HVC201326 Assertion Placement Inside initial procedure execute only once Outside of initial procedure execute continuouslyNovember 4, 2013 HVC201327initialassert property(p);Onceassert property(p).

8 Every clock tickExpresses pure semantics, but rarely usedinitial assert property(rst);p is always truerst is high at time 0 Implicit alwaysalwaysp is true at time 0assert property(ok);ok is always highAssertions Specify requirements from DUT FV Mathematically proves assertion correctness DV Checks assertion correctness for given simulation traceNovember 4, 2013 HVC201328initial assert property (p);Passes iff p is true at time 0 on all feasible tracesFails iff p is false at time 0 on some feasible traceAssumptions Specify requirements from environment FV Restricts the set of feasible traces in the model DV Checks assertion correctness for given simulation trace From FV point of view, the DUT acts as an assumption Contradictory assumptions (with each other or with the model) cause all ASSERTIONS to pass This is called an empty modelNovember 4, 2013 HVC201329assume property (in == !)

9 Inv_in)else$error( Inputs in and inv_in are expected to be inverse );Restrictions Specify condition for which FV has been performed FV Restricts the model Same as assumption DV Completely ignoredNovember 4, 2013 HVC201330restrict property (opcode == OP_ADD);Cover Specify scenario you wish to observe FV Mathematically prove that the property holds on some feasible trace DV Capture scenario in simulation trace From FV point of viewNovember 4, 2013 HVC201331cover property (read[*2]);initial cover property (p);passesinitial assert property (not p);failsFormal View on ASSERTIONS and Assumptions Set of assumptions initial assume property (q_1); .. initial assume property (q_m); and ASSERTIONS initial assert property (p_1); .. initial assert property (p_n); is equivalent to the following single assertion initialassert property (q_1 andq_mimpliesp_1 p_n).

10 November 4, 2013 HVC201332 November 4, 2013 HVC201333 Sampling Signal values are sampled at the beginning of simulation tickclocksigsample hereTime StepSEQUENCES AND PROPERTIESN ovember 4, 2013 HVC201334 Sequence Informal definition Sequence is a rule defining a series of values in time A sequence does not have a truth value, it has one initial point and zero or more matchpoints When a sequence is applied to a specific trace, it defines zero or more finite fragments on this trace starting at the sequence initial point and ending in its match points Essentially, sequence is a regular expressionNovember 4, 2013 HVC201335 Example Readis followed by writein one or two clock ticks read##[1:2] write Let starting point of this sequence be t= 2 November 4, 2013 HVC201336234234No match234 Single match at 3234 Single match at 4234 Two matches (at 3 and 4)Boolean Sequence Boolean expression edefines the simplest sequence a Boolean sequence This sequence has a match at its initial point if e is true Otherwise, it does not have any satisfaction points at allNovember 4, 2013 HVC201337 Sequence Concatenation Sequence concatenation.


Related search queries