ebook img

SystemVerilog Assertions and Functional Coverage PDF

374 Pages·2013·22.54 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview SystemVerilog Assertions and Functional Coverage

Ashok B. Mehta SystemVerilog Assertions and Functional Coverage Guide to Language, Methodology and Applications www.it-ebooks.info SystemVerilog Assertions and Functional Coverage www.it-ebooks.info Ashok B. Mehta SystemVerilog Assertions and Functional Coverage Guide to Language, Methodology and Applications 123 www.it-ebooks.info Ashok B.Mehta Los Gatos,CA USA Additionalmaterialtothisbookcanbedownloadedfromhttp://extras.springer.com. ISBN 978-1-4614-7323-7 ISBN 978-1-4614-7324-4 (eBook) DOI 10.1007/978-1-4614-7324-4 SpringerNewYorkHeidelbergDordrechtLondon LibraryofCongressControlNumber:2013935401 (cid:2)SpringerScience+BusinessMediaNewYork2014 Thisworkissubjecttocopyright.AllrightsarereservedbythePublisher,whetherthewholeorpartof the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,broadcasting,reproductiononmicrofilmsorinanyotherphysicalway,andtransmissionor informationstorageandretrieval,electronicadaptation,computersoftware,orbysimilarordissimilar methodology now known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for the purposeofbeingenteredandexecutedonacomputersystem,forexclusiveusebythepurchaserofthe work. Duplication of this publication or parts thereof is permitted only under the provisions of theCopyright Law of the Publisher’s location, in its current version, and permission for use must always be obtained from Springer. Permissions for use may be obtained through RightsLink at the CopyrightClearanceCenter.ViolationsareliabletoprosecutionundertherespectiveCopyrightLaw. The use of general descriptive names, registered names, trademarks, service marks, etc. in this publicationdoesnotimply,evenintheabsenceofaspecificstatement,thatsuchnamesareexempt fromtherelevantprotectivelawsandregulationsandthereforefreeforgeneraluse. While the advice and information in this book are believed to be true and accurate at the date of publication,neithertheauthorsnortheeditorsnorthepublishercanacceptanylegalresponsibilityfor anyerrorsoromissionsthatmaybemade.Thepublishermakesnowarranty,expressorimplied,with respecttothematerialcontainedherein. Printedonacid-freepaper SpringerispartofSpringerScience+BusinessMedia(www.springer.com) www.it-ebooks.info To My dear wife Ashraf Zahedi and My dear parents Rukshmani and Biren Mehta www.it-ebooks.info Foreword Louis H. Sullivan, an American architect, considered the father of the modern skyscraper, and mentor to Frank Lloyd Wright, coined the phrase ‘‘form follows function.’’ The actual quote is ‘‘form ever follows function’’ which is a bit more poetic and assertive than the version that has found its way into the common vernacular. He wrote those words in an article written for Lippincott’s Magazine #57 published in March 1896. Here is the passage in that article that contains the famous quote: ‘‘Whether it be the sweeping eagle in his light or the open apple-blossom, then toiling workhorse,theblitheswan,thebranchingoak,thewindingstreamatitsbase,thedrifting clouds—overallthecoursingsun,formeverfollowsfunction,andthisisthelaw.Where functiondoesnotchange,formdoesnotchange.Thegraniterocks,theeverbroodinghills, remainforages;thelightninglives,comesintoshape,anddies,inatwinkling. It is the pervading law of all things organic and inorganic, of all things physical and metaphysical,ofallthingshumanandallthingssuperhuman—ofalltruemanifestationsof thehead,oftheheart,ofthesoul—thatthelifeisrecognizableinitsexpression,thatform everfollowsfunction.Thisisthelaw.’’ Earlier in the article, Sullivan foreshadows his thought with this passage: ‘‘Allthingsinnaturehaveashape,thatistosay,aform,anoutwardsemblance,thattells uswhattheyare,thatdistinguishesthemfromourselvesandfromeachother.’’ The precise meaning of this pithy phrase has been debated in art and archi- tecture circles since Sullivan’s article was first published. However, it is widely accepted to mean that the form of something—its shape, color, size, etc.—is related to what it does. Water flows, rocks sit, and birds fly. In his book ‘‘The Design of Everyday Things,’’(Basic Books 1988) Don Nor- man discusses a similar concept, the notion of affordances. Norman defines the term as ‘‘… the perceived and actual properties of the thing, primarily those fundamentalpropertiesthatdeterminejusthowthethingcouldpossiblybeused.’’ Hecitessomeexamples:‘‘Achairaffords(‘‘isfor’’)supportand,therefore,affords sitting. A chair can also be carried. Glass is for seeing through, and for breaking. Wood is normally used for solidity, opacity, support or carving.’’ vii www.it-ebooks.info viii Foreword Norman’s idea turns Sullivan’s upside down. He is saying function follows form. The shape, color, size, etc., of an object affects what it does. Nonetheless, both men would likely agree that form and function, whichever drives the other, are inextricably linked. Software designers have the luxury of choosing the form to fit the function. They are not as constrained by the laws of physics as say, a cabinetmaker. The cabinetmakermustchoosematerialsthatwillnotonlylooknice,butwillwithstand theweightofbooksordishesorwhateveristobeplacedontheshelves.Software designershavesomeconstraintswithregardtomemoryspaceandprocessingtime, but beyond that they have a lot offreedom to build whatever comes to mind. Sullivanreferredto‘‘allthingsphysicalandmetaphysical.’’Withoutmuchofa stretch we can interpret that to include software, a most abstract human creation. Theformofapieceofsoftwareislinkedtoitsfunction.Thecomplexsoftwarethat verification engineers build, called a testbench, must be designed before it can be built. The verification engineer, like an architect, must determine the form of his creation. Thearchitecturespaceiswideopen.Computercode,whilemuchmoreabstract thansay,astaircaseoradoorhandleonacar,hasaformandafunction.Theform ofcomputercodeisthesetofsyntacticelementsstrungtogetherinaprogram.The function is what the program does when executed, often referred to as its semantics. A verification engineer is typically presented a set of requirements, often as a designspecification,andaskedtobuildatestbenchthatmeetstheserequirements. Because of the tremendous flexibility afforded by the software medium he must choose the form carefully to ensure that not only meets the requirements, but is easy to use, reusable, and robust. He must choose a form that fits the function. Oftenanassertionisjusttherightthingtocapturetheessenceofsomepartofa design.Theformofanassertionisshortsequenceoftextthatcanbeinsertedeasily without disrupting the design. With their compact syntax and concise semantics assertions can be used to check low-level invariants, protocols, or end-to-end behavior. Thefunctionofanassertion,inasimulationcontext,istoassertthatsomething is always (or never) the case. It ensures that invariants are indeed invariant. Assertions can operate as checkers or as coverpoints. The fact that they can be includedin-lineinRTLcodeorinseparatecheckers,theycanbeshortorlongfor simple or complex checking makes them invaluable in any testbench. The wise verification engineer uses all the tools as his disposal to create an effective andeasytousetestbench.Hewillconsider thefunctionofthetestbench anddeviseaformthatsuitstherequiredfunction.Assertionsareanimportantpart of any testbench. AshokMehtahaswrittenabookthatmakesassertionsaccessible.Hisapproach is very pragmatic, choosing to show you how to build and use assertions rather than engage in a lot of theoretical discussion. Not that theoretical discussion is www.it-ebooks.info Foreword ix irrelevant—it is useful to understand the theoretical underpinnings of any tech- nology. However, there are many other books on that topic. This book fills a gap forpracticingengineerswherebeforenotextprovidedthehow-tosofbuildingand using assertions in a real-world context. Ashokopensuptheworldofassertionstoverificationengineerswhomayhave thought them too opaque to consider using in a real testbench. He does an espe- cially nice job of deconstructing assertions to show how they work and how to write them. Through detailed examples he shows all the pieces that go into cre- atingassertionsofdifferentkinds,andhowtheyfittogether.Ashokcompletesthe picture by demonstrating how assertions and coverage fit together. Part of the book is devoted to functional coverage. He deconstructs the sometimes awkward SystemVerilog syntax of covergroups and coverpoints. Like hehaswithassertions,hetakesthemysteryoutofbuildingahigh-qualitycoverage model. With the mysteries of assertions unmasked, you can now include them in your personalvocabularyoftestbenchforms.Thiswillenableyoutocreatetestbenches with more sophisticated function. February 2013 Mark Glasser www.it-ebooks.info Preface Having been an end user of EDA tools for over 20 years, I have seen that many newtechnologiesstayonway side,becauseeither theengineersdonothave time tolearnofnewtechnologies/languagesortheavailablematerialistoocomplexto digest. A few years back I decided to tackle this problem by creating a very practical,application-orienteddown-to-earthSystemVerilogAssertions(SVA)and Functional Coverage (FC) class for professional engineers. The class was well received and I received a lot offeedback on making the class even more useful. That culminated in over 500 slides of class material just on SVA and FC. Many suggestedthatIhadcollectedenoughmaterialforabook.ThatishowIendedup on this project with the same goal that the reader should understand the concept clearly in an easy and intuitive manner and be able to apply the concepts to real- life applications right away. The style of the book is such that the concepts are clarified directly in a slide stylediagramwithtalkingpoints.Thiswillhopefullymakeiteasytousethebook as a quick reference as well. Applications immediately following a topic will further clarify the subject matter and my hope is that once you understand the semantics and applications of a given topic, you are ready to apply that to your dailydesignwork.Theseapplicationsaremodeledsuchthatyoushouldbeableto use them in your design with minimal modifications. This book is meant for both design and verification engineers. As a matter of fact, I have devoted a complete section on the reasons and practicality behind having micro-level assertions written by the design engineers and macro-level assertions written by verification engineers. Gone are the days when designers wouldwriteRTLandthrowitoverthewallfortheverificationengineertoquality check. The book covers both IEEE 1800-2005 and IEEE 1800-2009 standard SVA language.EventhoughIhavecoveredallthefeaturesof1800-2009standardSVA, pleasenotethatover90%ofthesefeatureswerenotsupportedbyEDAtoolsasof thiswriting.Inotherwords,theexamplesbelongingtothislanguagesubsetarenot simulated. I would greatly appreciate feedback on 1800-2009 SVA language examples for any errors or omissions. xi www.it-ebooks.info xii Preface Chapter 1 is Introduction to SVA and FC giving a brief history of SVA evo- lution. It also explains how SVA and FC fall under SystemVerilog umbrella to provide a complete assertions and functional coverage driven methodology. Part I: System Verilog Assertions (SVA) Chapter2goesin-depthonSVA-basedmethodologyprovidingdetailthatyoucan right away use in your project execution. Questions like ‘‘How do I know I have added enough assertions?’’, ‘‘What type of assertions should I add’’, etc. are explained with clarity. Chapter 3 describes Immediate Assertions. These are nontemporal assertions allowed in procedural code. Chapter4goes into the fundamentals ofConcurrentAssertions toset the stage fortherestofthebook.Howtheconcurrentmulti-threadedsemanticswork,when and how assertions get evaluated in a simulation time tick, formal arguments, disabling, etc., are described here. Chapter 5 describes the so-called sampled value functions such as $rose, $fell, $stable, $past etc. Chapter6isthebigone!Thischapterdescribesalltheoperatorsofferedbythe language including Clock Delay with and without range, Consecutive repetition with and without range, nonconsecutive repetition with and without range, ‘throughout’, ‘within’, ‘and’, ‘or’, ‘intersect’, ‘first_match’, ‘if..else’, etc. Each of the operator description is immediately followed by examples and applications to solidify the concept. Chapter 7 describes the System Functions and Tasks such as $isunknown, $onehot, etc. Chapter 8 discusses a very important aspect of the language that being prop- ertieswithmultipleclocks.Thereisnotasingledesignnowadaythatusesonlya single clock. A simple asynchronous FIFO will have a Read Clock and a Write Clock which are asynchronous. Properties need to be written such that check in one clock domain triggers a check in another clock domain. The chapter goes in plenty detail to demystify semantics to write assertions that cross clock domains. The so-called CDC (Clock Domain Crossing) assertions are explained in this chapter. Chapter9isprobablythemostusefulonedescribingLocalVariables.Without this multi-threaded feature many of the assertions would be impossible to write. There are plenty of examples to help you weed through the semantics. Chapter10isonrecursiveproperties.Thesearerarelyusedbutareveryhandy when you want to know thata propertyholds until another becomestrue orfalse. Chapters 11–13 describe other useful features such as ‘expect’, ‘assume’, and detectingendpointofasequence.Theendedandmatchedend-pointsofsequences are indeed very practical features. www.it-ebooks.info

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.