Transcription
SVA Advanced Topics: SVAUnitand Assertions for Formal
SystemVerilog AssertionsVerification with SVAUnitAndra RaduIonuț Ciocîrlan
Tutorial Topics Introduction to SystemVerilog Assertions (SVAs) Planning SVA development Implementation SVA verification using SVAUnit SVA test patterns2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting3
Introduction to SystemVerilogAssertions(SVAs)2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting4
Assertions and Properties What is an assertion?assert (a - b)else error("Assertion failed!") What is a property?property p example;a - bendproperty2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting5
Simple Assertion Exampleproperty req to rise p;@(posedge clk) rose(req) - ##[1:3] rose(ack);endpropertyASSERT LABEL: assert property (req to rise p)else uvm error("ERR", "Assertion failed")2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting6
Types of SystemVerilogAssertions Immediateassert (expression) pass statement[else fail statement] Concurrent2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting7
Assertions Are Used In a verification component In a formal proof kit In RTL generation“Revisiting Regular Expressions in SyntHorus2: from PSL SEREs toHardware” (Fatemeh (Negin) Javaheri, Katell Morin-Allory, DominiqueBorrione) For test patterns generation“Towards a Toolchain for Assertion-Driven Test Sequence Generation” (LaurencePIERRE)2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting8
SVAs Advantages Fast Non-intrusive Flexible Coverable2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting9
Planning SVA Development2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting10
Identify Design Characteristics Defined in a document (design specification) Known or specified by the designer The most common format is of the form cause andeffect: antecedent - consequent Antecedent: rose(req) Consequent: ##[1:3] rose(ack)2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting11
Keep it Simple. Partition! Complex assertions are typically constructed fromcomplex sequences and properties.a ##1 b[*1:2] c ##1 d[*1:2] fell(a)sequence seq(arg1, arg2);arg1 ##1 arg2[*1:2];endsequenceseq(a, b) seq(c, d) fell(a)2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting12
Implementation2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting13
Coding Guidelines Avoid duplicating design logic in assertions Avoid infinite assertions Reset considerations Mind the sampling clock2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting14
Coding Guidelines (contd.) Always check for unknown condition (‘X’) Assertion naming Detailed assertion messages Assertion encapsulation2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting15
Best Practices Review the SVA with the designer to avoid DSmisinterpretation Use strong in assertions that may never complete:assert property ( req - strong(##[1: ] ack)); Properties should not hold under certain conditions(reset, enable switch)assert property (@(posedge clk) disable iff (!setup !rst n)req - strong(##[1: ] ack));2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting16
Best Practices (contd.) Avoid overlapping assertions that contradict eachother CPU 0: CPU 1:assert property (WRITE ERROR);assert property (WRITE !ERROR);assert property (WRITE and CPU 0 ERROR);assert property (WRITE and CPU 1 !ERROR);2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting17
Best Practices (contd.) Use the sampled() function in action blocksPrevious timeslotPreponedActiveInactiveNBAassert property ( @(posedge clk) ack 0 )else uvm error("ERROR", sformatf("Assertionfailed. ack is %d", ed2/29/2016Next timeslotAndra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting18
Assertion Example AMBA APB protocol specification:The bus only remains in the SETUP state for one clockcycle and always moves to the ACCESS state on thenext rising edge of the clock.2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting19
Assertion Example (contd.) Antecedent (the SETUP phase)sequence setup phase s; rose(psel) and rose(pwrite)and (!penable) and (!pready);endsequence Consequent (the ACCESS phase)sequence access phase s; rose(penable) and rose(pready) and stable(pwrite) and stable(pwdata)and stable(paddr) and stable(psel);endsequence2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting20
Assertion Example (contd.) The property can be expressed as:property access to setup p;@(posedge clk) disable iff (reset)setup phase s access phase s;endproperty The assertion will look like:assert property (access to setup p)else uvm error("ERR", "Assertion failed")2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting21
Does It Work as Intended?2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting22
SVA Verification with SVAUnit2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting23
SVA Verification ChallengesEasy to:- Update- Enhance- DisableClear separation betweenvalidation and SVA definitioncodePredictableResults should be:- Deterministic- Repeatable2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting24
Introducing SVAUnit Structured framework for Unit Testing for SVAs Allows the user to decouple the SVA definition from itsvalidation code UVM compliant package written in SystemVerilog Encapsulate each SVA testing scenario inside an unittest Easily controlled and supervised using a simple API2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting25
SVAUnit InfrastructureSVAUnit TestbenchSVAUnit Test SuiteSVAUnit TestSVAUnit Unit TestSVAUnit TestSVA interface sReportsReports2/29/2016Andra Radu - AMIQ ConsultingInterfacecontainingcontainingSVASVA SVAUnit Testbench- Enables SVAUnit- Instantiates SVAinterface- Starts test SVAUnit Test- Contains the SVAscenario SVAUnit Test Suite- Test and test suitecontainerIonuț Ciocîrlan - AMIQ Consulting26
Example Specification AMBA APB protocol specification:The bus only remains in the SETUP state for one clockcycle and always moves to the ACCESS state on thenext rising edge of the clock.2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting27
Example APB Interfaceinterface apb if (input dy;logic [ ADDR WIDTH-1 :0] paddr;logic [ WDATA WIDTH-1:0] pwdata;APB sequences definitionsAPB property definitionAPB assertion definitionendinterface2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting28
APB Sequences Definitions Antecedent (the SETUP phase)sequence setup phase s; rose(psel) and rose(pwrite)and (!penable) and (!pready);endsequence Consequent (the ACCESS phase)sequence access phase s; rose(penable) and rose(pready) and stable(pwrite) and stable(pwdata)and stable(paddr) and stable(psel);endsequence2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting29
APB Property & AssertionDefinitions The property can be expressed as:property access to setup p;@(posedge clk) disable iff (reset)setup phase s access phase s;endproperty The assertion will look like:assert property (access to setup p)else uvm error("ERR", "Assertion failed")2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting30
Example of SVAUnitTestbenchmodule top;// Instantiate the SVAUnit framework SVAUNIT UTILS.// APB interface with the SVA we want to testapb if an apb if(.clk(clock));initial begin// Register interface with the uvm config dbuvm config db#(virtual an if)::set(uvm root::get(), "*", "VIF", an apb if);// Start the scenariosrun test();end.endmodule2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting31
Example of SVAUnit Testclass ut1 extends svaunit test;// The virtual interface used to drive the signalsvirtual apb if apb vif;function void build phase(input uvm phase phase);// Retrieve the interface handle from the uvm config dbif (!uvm config db#(virtual an if)::get(this, "", "VIF", apb vif)) uvm fatal("UT1 NO VIF ERR", "SVA interface is not set!")// Test will run by default;disable test();endfunctiontask test();// Initialize signals// Create scenarios for SVA verificationendtaskendclass2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting32
APB – SVAUnit Test StepsEnable the APB SVAInitialize the interface signalsGenerate setup phase stimuliGenerate access phase stimuliSVA checks based on generated stimuli2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting33
Enable SVA and InitializeSignals.// Enable the APB SVAvpiw.disable all assertions();vpiw.enable assertion("APB PHASES");// Initialize signalstask initialize signals();apb vif.paddr 32'b0;apb vif.pwdata 32'b0;apb vif.pwrite 1'b0;apb vif.penable 1'b0;apb vif.psel 1'b0;endtask.2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting34
Generate Setup PhaseStimuli.task generate setup phase stimuli(bit valid);.// Stimuli for valid SVA scenariovalid 1 - pwrite 1 && psel 1 && penable 0 && pready 0;// Stimuli for invalid SVA scenariovalid 0 - pwrite ! 1 psel ! 1 penable ! 0 pready ! 0;.endtask.2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting35
Generate Access PhaseStimuli.task generate access phase stimuli(bit valid);.// Constrained stimuli for valid SVA scenariovalid 1 - pwdata apb vif.pwdata && paddr apb vif.paddr &&pwrite 1 && psel 1 && penable 1 && pready 1;// Constrained stimuli for invalid SVA scenariovalid 0 - pwdata ! apb vif.pwdata paddr ! apb vif.paddr pwrite ! 1 psel ! 1 penable ! 1 pready ! 1;.endtask.2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting36
SVA State Checking.if (valid setup phase)if (valid access phase)vpiw.fail if sva not succeeded("APB PHASES","The assertion should have succeeded!");elsevpiw.fail if sva succeeded("APB PHASES","The assertion should have failed!");elsevpiw.pass if sva not started("APB PHASES","The assertion should not have started!");.2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting37
Example of SVAUnit TestSuiteclass uts extends svaunit test suite;// Instantiate the SVAUnit testsut1 ut1;.ut10 ut10;function void build phase(input uvm phase phase);// Create the tests using UVM factoryut1 ut1::type id::create("ut1", this);.ut10 ut10::type id::create("ut10", this);// Register tests in suite add test(ut1);. add test(ut10);endfunctionendclass2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting38
SVAUnit Test APICONTROLCHECKREPORT2/29/2016 disable all assertions(); enable assertion(sva name); enable all assertions();. fail if sva does not exists(sva name, error msg); pass if sva not succeeded(sva name, error msg); pass/fail if(expression, error msg);. print status(); print sva(); print report();.Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting39
SVAUnit Flow2/29/2016Create SVAUnit TestbenchCreate an SVAUnit Test SuiteCreate an SVAUnit TestInstantiate test in Test SuiteImplement test() taskRegister tests in test suiteAndra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ ConsultingSimulateScan report40
Error ReportingName of SVAUnitcheckName of SVA undertest2/29/2016Andra Radu - AMIQ ConsultingSVAUnit test pathCustom errormessageIonuț Ciocîrlan - AMIQ Consulting41
Hierarchy Report2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting42
Test Scenarios Exercised2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting43
SVAs and Checks Exercised2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting44
SVA Test Patterns2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting45
Simple Implication Test a and b crepeat (test loop count) beginrandomize(stimuli for a, stimuli for b, stimuli for c);interface.a stimuli for a;interface.b stimuli for b;@(posedge an vif.clk);interface.c stimuli for c;@(posedge interface.clk);@(posedge interface.clk);if (stimuli for a 1 && stimuli for b 1)if (stimuli for c 1)vpiw.fail if sva not succeeded("IMPLICATION ASSERT","The assertion should have succeeded!");elsevpiw.fail if sva succeeded("IMPLICATION ASSERT","The assertion should have failed!");elsevpiw.pass if sva not started("IMPLICATION ASSERT","The assertion should not have started!");end2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting46
Multi-threadAntecedent/Consequent rose(a) ##[1:4] b - ##[1:3] crepeat (test loop count) begin// Generate valid delays for asserting b and c signalsrandomize(delay for b inside {[1:4]}, delay for c inside {[1:3]});interface.a 1;repeat (delay for b)@(posedge interface.clk);interface.b 1;vpiw.pass if sva started but not finished("MULTITHREAD ASSERT","The assertion should have started but not finished!");repeat (delay for c)@(posedge interface.clk);interface.c 1;vpiw.pass if sva succeeded("MULTITHREAD ASSERT","The assertion should have succeeded!");end2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting47
Multi-threadAntecedent/Consequent (contd.) rose(a) ##[1:4] b - ##[1:3] crepeat (test loop count) begin// Generate invalid delays for asserting b and c signalsrandomize(delay for b inside {[0:10]}, delay for c inside {0,[4:10]});interface.a 1;repeat (delay for b)@(posedge interface.clk);interface.b 1;vpiw.pass if sva not succeeded("MULTITHREAD ASSERT","The assertion should have failed!");repeat (delay for c)@(posedge interface.clk);interface.c 1;if (delay for b 5)vpiw.fail if sva succeeded("MULTITHREAD ASSERT","The assertion should have failed!");end2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting48
Consecutive Repetition a - b[*1:2] ##1 crepeat (test loop count) beginrandomize(stimuli for a, stimuli for c, number of b cycles 2);interface.a stimuli for a;repeat (number of b cycles) beginrandomize(stimuli for b)interface.b stimuli for b;if (stimuli for b 1) number of b assertions 1;@(posedge interface.clk);endif (stimuli for a 1 && number of b assertions number of b cycles &&number of b assertions 0)vpiw.pass if sva started but not finished("IMPLICATION ASSERT","The assertion should have started but not finished!");@(posedge interface.clk);. // (continued on the next slide)2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting49
Consecutive Repetition(contd.) a - b[*1:2] ##1 c.// (continued from previous slide)interface.c stimuli for c;@(posedge interface.clk);if (stimuli for a 1)if (number of b assertions ! number of b cycles number of b assertions 0 stimuli for c 0)vpiw.fail if sva succeeded("IMPLICATION ASSERT","The assertion should have failed!");elsevpiw.fail if sva not succeeded("IMPLICATION ASSERT","The assertion should have succeeded!");end // end of test repeat loop2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting50
Repetition Range with Zero a - b[*0:2] ##1 crepeat (test loop count) beginrandomize(stimuli for a, stimuli for c, number of b cycles 2);interface.a stimuli for a;repeat (number of b cycles) beginrandomize(stimuli for b)interface.b stimuli for b;if (stimuli for b 1) number of b assertions 1;@(posedge interface.clk);endif (stimuli for a 1 && number of b assertions number of b cycles)&& number of b assertions 0)vpiw.pass if sva started but not finished("IMPLICATION ASSERT","The assertion should have started but not finished!");@(posedge interface.clk);. // (continued on the next slide)2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting51
Repetition Range with Zero(contd.) a - b[*0:2] ##1 c.// (continued from previous slide)interface.c stimuli for c;@(posedge interface.clk);if (stimuli for a 1)if (number of b assertions ! number of b cycles number of b assertions 0 stimuli for c 0)vpiw.fail if sva succeeded("REPETITION RANGE0 ASSERT","The assertion should have failed!");elsevpiw.fail if sva not succeeded("REPETITION RANGE0 ASSERT","The assertion should have succeeded!");end // end of test repeat loop2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting52
Sequence Disjunction a (b ##1 c) or (d ##1 e)repeat (test loop count) beginrandomize(stimuli for a, stimuli for b, stimuli for c, stimuli for d, stimuli for e);interface.a stimuli for a;@(posedge interface.clk);forkbeginStimuli for branch: (b ##1 c)SVA state check based on branch stimuliendbeginStimuli for branch: (d ##1 e)SVA state check based on branch stimuliendjoinend2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting53
Sequence Disjunction(contd.) a (b ##1 c) or (d ##1 e).// Stimuli for branch (b ##1 c)forkbegininterface.b stimuli for b;@(posedge interface.clk);interface.c stimuli for c;@(posedge interface.clk);@(posedge interface.clk);// SVA state check based on branch stimulisva check phase(interface.a, interface.b, interface.c);endjoin2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting54
Sequence Disjunction(contd.) a (b ##1 c) or (d ##1 e).// Stimuli for branch (d ##1 e)forkbegininterface.b stimuli for d;@(posedge interface.clk);interface.c stimuli for e;@(posedge interface.clk);@(posedge interface.clk);// SVA state check based on branch stimulisva check phase(interface.a, interface.d, interface.e);endjoin2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting55
Sequence Disjunction(contd.) a (b ##1 c) or (d ##1 e)// SVA state checking task used in each fork branchtask sva check phase(bit stimuli a, bit stimuli b, bit stimuli c);if (stimuli a)if (stimuli b && stimuli c)vpiw.pass if sva succeeded("DISJUNCTION ASSERT","The assertion should have succeeded");elsevpiw.fail if sva succeeded("DISJUNCTION ASSERT","The assertion should have failed");endtask2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting56
Tools IntegrationSimulator independent!2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting57
Availability SVAUnit is an open-sourcepackage released by AMIQConsulting We provide:- SystemVerilog and simulatorintegration codes- AMBA-APB assertion package- Code templates and examples- HTML documentation for 2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting58
Conclusions SVAUnit decouples the checking logic from SVAdefinition code Safety net for eventual code refactoring Can also be used as self-checking documentation onhow SVAs work Quick learning curve Easy-to-use and flexible API Speed up verification closure Boost verification quality2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting59
Thank you!2/29/2016Andra Radu - AMIQ ConsultingIonuț Ciocîrlan - AMIQ Consulting60
FORMAL SPECIFICATION,SYSTEM VERILOGASSERTIONS & COVERAGEBy Calderón-Rico, Rodrigo & Tapia Sanchez, Israel G.
OBJECTIVE Learn how to define objects byspecifying their propertieswhich are formally described.OBJECT Using the formal specificationfor assertion or coveragepurposes with real examplesand gain comparisons versusother methods as scripting andSystemVerilog always blocks.Applications:Assertions Coverage 3
AGENDAI.Introduction Why do we need formalspecification? Formal Specification Components Layers of Assertion Language Temporal LogicII.Language constructs Definition Boolean logic connectors Temporal logic connectors Sequence Specification Sequence Declaration Property DeclarationIII. Sequence Basics Sequence construction.o Temporal logic connectorso Additional sequence features USB ExamplesIV. Property Basics Property construction ExamplesV. Assertion Language Introduction Assert LanguageVI. Comparative Results
I - INTRODUCTION
WHY DO WE NEED FORMALSPECIFICATION? Formalspecification languages are used to describe design propertiesunambiguously and precisely. Usuallyproperties are written as part of the high level design specifications in atext document. But writing specification in a natural language is ambiguous. Considerthe following typical property specification: Each request should begranted in four clock cycles. This specification is ambiguous: Do we count four clock cycles starting from the cycle when the request wasissued, or from the next cycle? Do we require that the grant is issued during the first four cycles or exactly atthe fourth cycle? May two requests be served by the same grant or should they be served bytwo separate grants?6
The same specification written in SystemVerilog Asserions(SVA) is unambiguous:assert property( @( posedge clk ) request - ##4 grant ); Thisspecification defines a clocked, or concurrent assertion, and it reads: whenrequest is issued, it should be followed by grant in the fourth clock cycle measuredfrom the clock cycle when request was issued. Because of the formal nature of SVA, specifications can be interpreted by tools, andwhat is more important, understood by humans. When the specifications are formallydefined, there is no place for misunderstanding.7
FORMAL SPECIFICATIONCOMPONENTS Abstract descriptions are aimed to specifyAbstractdescriptionsPropertiesan abstract behavior as it defines whathappens and when, without specifying howexactly happened. Abstract descriptions are encapsulated inproperties.Language A group of properties may describe acomplete model. Application:FormalSpecificationPre-si verification: The model created viaformal properties is a way of creatingevidence suggesting that a system either doesor does not have some behavior.8
LAYERS OF SVA ASSERTIONLANGUAGEValues ChangingOver TimeBooleansSimple LogicExpressionsSequencesPropertiesImplication ofSequencesAssertionStatementsAction!9
TEMPORAL LOGIC One can associate temporal logic to a lLogicthrough the time where a sequence ofevents occur in a specified order. The eventsare constructed via Boolean logic. Kripkestructures (nondeterministic finitestate machines) set a model to evaluatetemporal logic in discrete time.Boolean logicthrough timeNote: Any temporal logic statement is assumed tobe in the context of discrete time, and may or maynot be specified in a discrete event context.AStartCBDAB10
ABCCA single tree branch can be understoodas a realization of one possible paththrough time.ABADBABABCThe tree structure can help to unfold astate diagram in order to separatepossible different paths.11
II - LANGUAGE CONSTRUCTS
Definition The chosen language is SystemVerilog (SV).SystemVerilog is a unified hardware design, specification, and verification language. Abstracts a detailed specification of the design. Specification of assertions coverage and testbench verification that is based onmanual or automatic methodologies.The syntax defined in SV is to generate abstract descriptions (properties).Boolean logic connectors and or Non-temporal implication:expression 1 - expression 2 (if 1 then 2)13
Distribution:expression dist { dist list } ;dist list: dist item { , dist item }dist item : value range [ dist weight ]dist weight : (: expression) (:/ expression)The distribution operator dist evaluates to true if the value of the expression iscontained in the set; otherwise, it evaluates to false.Example:usb symbol dist {100 : 1, 200 : 2, 300 : 5}It means usb symbol is equal to 100, 200, or 300 with weighted ratio of1-2-5.14
TEMPORAL LOGIC CONNECTORS Delay range :#### integral number or identifier## ( constant expression )## [ cycle delay const range expression ] Temporal implication:expression 1 expression 2 Consecutive repetition:[* const or range expression ] Non-consecutive repetition:[ const or range expression ] Go-to repetition:[ - const or range expression ]15
Sequence specification (temporal sequence) throughout within first match intersectSequence declaration: sequence name [( sequence variables )] endsequence Encapsulates a temporal proposition to make it reusable.Property declaration: property name [( property variables )] endproperty Encapsulates an abstract description to make it reusable.16
III - SEQUENCE
BASICSEvent CEvent AEvent BEvent BEvent AProperties are very often constructed out of sequential behaviors, thus, thesequence feature provides the capability to build and manipulatesequential behaviors.18
19In SV a sequence can be declared in:I.II.III.IV.V.VI.a module,an interface,a program,a clocking block,a packagea compilation-unit scopeExample:sequence basics c;@( posedge clk ) A STATE ##1 B STATE ##1 A STATE ##1 B STATE ##1 C STATE;endsequence
Sequence ConstructionBoolean expression e defines the simplest sequence – a Boolean sequence This sequence has a match at its initial point if e is trueOtherwise, it does not have any satisfaction points at allTRUE if e ispresent!20
Temporal logic connector21Sequences can be composed by concatenation. The concatenation specifies a delay, using##. It is used as follows:## integral number or identifier## ( constant expression )## [ cycle delay const range expression ]cycle delay const range expression : const:const or const: Example:r ##1 s represents anon-zero andfinite numberThere is a match of sequence “r ##1 s” if there is a match of sequence r and there isa match of sequence s starting from the clock tick immediately following the match ofr
22Sequence fusion:r ##0 sThe fusion of sequences r and s, is matched if for some match of sequence r there is amatch of sequence s starting from the clock tick where the match of r happenedMultiple Delays:r ##n sr is true on current tick, s will be true on the nth tick after rExample:r ##2 s
23Example:req ##1 gnt ##1 !reqInitial Delay:##n sSpecify the number of clock ticks tobe skipped before beginning asequence match.Example: ##3 sRange:r ##[ M : N ] smeans that if r is true on current tick, s will be true M to N ticks from current tick
Example:a ##2 b ##1 a ##2 b ##1 a ##2 b ##1 a ##2 b ##1 a ##2 bby simplification the previous sequence results in:( a ##2 b ) [*5]r ##[*M : N ] sRepeat r at least M times and as many as N times consecutivelyr ##[ *M : ]Repeat r an unknown number of times but at least M times24
25Go to Repetition:r ## 1 s [- N ] ##1 tMeans r followed by exactly N not necessarily consecutive s’s with last sfollowed the next tick by tr ##1 s [- M : N ] ##1 tMeans r followed by at least M, at most N s’s followed next tick by tExample: e [- 2]Non-Consecutive Repetitionr ## 1 s [ N ] ##1 tMeans r followed by exactly N not necessarily consecutive s’s with last s followedsometime by tr ##1 s [ M : N ] ##1 tMeans r followed by at least M, at most N s’s followed some time by t “t does nothave to follow immediately after the last s”
What does the following sequence mean?a ##1 b [- 2:10] ##1 cWatch out forthe number ofthreads![- 2:10]abcclkabcseqHow can we interpret the following sequence?a ##1 b [ 2:10] ##1 c26
AndThe binary operator and is used when both operands are expected to match, but the endtimes of the operand sequences can be different.It is used as follows:Sequence A and Sequence Bwhere both operands must be sequences.Sequence AStartEndSequence BStart End27
One can say:a) The operand sequences start at the same time.b) When one of the operand sequences matches, it waits for the other to match.c) The end time of the composite sequence is the end time of the operand sequence thatcompletes last.Example:( te1 ##2 te2 ) and ( te3 ##2 te4 ##2 te5 )What if the two operands are Boolean expresions? How does the and operation behave?28
IntersectThe binary operator intersect is used when both operand sequences are expectedto match, and the end times of the operand sequences must be the same. It is usedin the same way as the and operation.SequenceAStart EndSequenceBStart EndOne can conclude that the additional requirement on the length of the sequences isthe basic difference between and operation and intersect operation.Example:( te1 ##[1:5] te2 ) intersect ( te3 ##2 te4 ##2 te5 )29
Or30The operator or is used when at least one of the two operand sequences isexpected to match. It is used in the same way as the and operation [1].te1 or te2ThroughoutSequences often occur under the assumptions of some conditions for correct behavior.A logical condition must hold true, for instance, while processing a transaction.It is used as follows:expression or dist throughout sequence exprwhere an expression or distribution must hold true during the whole sequence.
SequenceStart EndConditionTrueTrueTrueSequence ASequence BOne can understand the throughout conditionas two processes that run in parallel.WithinThe containment of a sequence within anothersequence is expressed with the withinoperation. This condition is used as follows:(sequence expr) within (sequence expr)One can conclude that:a)The start point of the match of seq1 mustbe no earlier than the start point of thematch of seq2.b)The end point of the match of seq1 mustbe no later than the end point of thematch of seq2.31
ADDITIONAL SEQUENCE FEATURESHow can we describe the following condition?!trdy [*7]within ( fell(irdy) ##1 !irdy[*8] )32
I. Detecting an
Introduction to SystemVerilog Assertions (SVAs) Planning SVA development Implementation SVA verification using SVAUnit SVA test patterns 2/29/2016 Andra Radu - AMIQ Consulting IonuțCiocîrlan-AMIQ Consulting 3