{"id":9536,"date":"2017-07-21T13:51:15","date_gmt":"2017-07-21T13:51:15","guid":{"rendered":"https:\/\/www.techdesignforums.com\/practice\/?p=9536"},"modified":"2017-08-31T06:29:31","modified_gmt":"2017-08-31T06:29:31","slug":"the-ongoing-evolution-of-formal-verification","status":"publish","type":"post","link":"https:\/\/www.techdesignforums.com\/practice\/technique\/the-ongoing-evolution-of-formal-verification\/","title":{"rendered":"Doc Formal: The evolution of formal verification &#8211; Part One"},"content":{"rendered":"<p>We celebrate innovation and creativity in the way we cherish fortresses, castles, and other monuments built throughout history. We have always been infatuated with architecture, with the design of the finished structures, even with the process itself, but not with how these buildings were tested. Many books describe how amazing landmarks were built and explain their beauty, but you are unlikely to find much about how they were examined for quality and rigor.<\/p>\n<p>Obviously,\u00a0tests were carried out: That we still can visit Mayan temples, Egyptian pyramids, and Roman amphitheaters testifies to the workmanship and thoughtful construction methods employed. But let\u2019s be honest. Test has never been regarded with the same enthusiasm as design and architecture. It is little surprise that much the same applies in the semiconductor industry. Design takes the lion\u2019s share of the glory; verification is largely left out of the limelight.<\/p>\n<p>Doc Formal wants to encourage you to give test a closer look. It might not be flashy, but it is essential. It makes the cool stuff possible.<\/p>\n<p>In this two-part feature, I will first give you a brief history of how formal techniques have evolved &#8211; and illustrate their\u00a0solid and long-standing foundations \u2013 and then move on to give a user-level view of their application today.<\/p>\n<h3>Change, constant and continuous<\/h3>\n<p>Much has changed since transistors were invented in 1947, but evolution has not been uniform across our business.<\/p>\n<p>In terms of design, architecture, and computing we have gone from room-sized mainframes in the 1960s to today\u2019s pocket-sized mobile compute machines running at gigahertz with tons of on-chip memory. Our interactions with these machines continue to redefine human existence.<\/p>\n<p>By contrast, test and verification have not scaled in the same manner. The principles remain the same; the basics of simulation-based testing have not changed. Test\u2019s three main components &#8211; stimuli, observers\/scoreboards, and checkers \u2013 still have their roots in test\u2019s early forms.<\/p>\n<p>The way in which a stimulus is generated may have changed, but the role of a stimulus generator is still one of the tentpoles for the constrained random or directed form of dynamic simulation used to test billion-gate designs. The role of the observer has changed: Where once a human read an oscilloscope, now a machine records the traces of simulation automatically or in a programmed manner. But whether an issue in a design-under-test (DUT) is found still frequently comes down to a comparison with a reference model, a process that again used to be done manually.<\/p>\n<p>One thing that has changed significantly for semiconductors compared to other engineering disciplines, however, is the rate at which complexity has increased in design and architecture. We must\u00a0also account for aggressively shrinking times-to-market. These factors have exacerbated the challenges facing test and verification, thrusting it into the spotlight for the first time and for one overarching reason: Verification now accounts for nearly 70% of overall design cost.<\/p>\n<p>Autonomous cars and applications for the Internet of Things (IoT) are driving innovation and growth in hardware and software design. The complex array of requirements needed for these markets can be distilled down to two key leading requirements: Safety and security.<\/p>\n<p>Functional safety is paramount in the automotive industry, avionics, and railways. At the Verification Futures Conference in April 2017, it was obvious that even the marine industry is alert to increasing demands for safety certification, and an array of standards \u2013 e.g., ISO 26262, DO-254, DO-178, and DO-333 \u2013 is raising the bar in terms of compliance. Meanwhile, security is fast becoming a nightmare for engineers across all disciplines involved in delivering trustworthy systems for mobile computing and access control.<\/p>\n<p>Dynamic simulation is the default verification technique for hardware and software. It has long formed the backbone of test and verification. However, despite the consolidation of once-diverse methodologies (e.g., OVM, VMM and AVM) into UVM, engineers are some way from its efficient deployment for speedy verification and, more importantly, achieving the quality required to ensure key safety and security goals are met in the underlying systems.<\/p>\n<p>There is one exception. This is the recent advent of the portable stimulus where requirements-based testing is driven from architectural models of subsystems and SoCs. Even that, unfortunately, has \u2018stimulus\u2019 in the name rather than \u2018requirements\u2019. Nevertheless, the overall framework appears to be promising.<\/p>\n<p>That aside, though, we still have some way to go.<\/p>\n<h3>The foundations of formal verification<\/h3>\n<p>As conventional simulation-based testing has increasingly struggled to cope with design complexity, somewhere in parallel, strategies\u00a0centered around formal verification methods have quietly evolvied.<\/p>\n<p>Edsger Wybe Dijkstra famously coined the phrase, <a href=\"http:\/\/homepages.cs.ncl.ac.uk\/brian.randell\/NATO\/nato1969.PDF\">\u201cTesting shows the presence, not the absence of bugs.\u201d<\/a> In April 1970, he challenged the design community to think differently. Even though the remark was made in the context of software verification, Dijkstra\u2019s call to action has had much\u00a0wider influence. Nor was Dijkstra alone on this train of thought. This quiet revolution in the USA and the UK can be traced back to the 1950s. In 1954, <a href=\"http:\/\/www.cs.nyu.edu\/cs\/faculty\/davism\/\">Martin Davis<\/a> developed the <a href=\"http:\/\/www.springer.com\/gb\/book\/9783319418414\">first computer-generated mathematical proof<\/a> for a theorem for a decidable fragment of first order logic, called Pressburger arithmetic. The actual theorem was that the product of two even numbers is even.<\/p>\n<h4>Key steps in theorem proving<\/h4>\n<p>In the late 1960s, first-order theorem provers were applied to the problem of verifying the correctness of computer programs written in languages such as Pascal, Ada, and Java. Notable among such early verification systems was the <a href=\"http:\/\/i.stanford.edu\/pub\/cstr\/reports\/cs\/tr\/79\/731\/CS-TR-79-731.pdf\">Stanford Pascal Verifier<\/a>. It was developed by <a href=\"http:\/\/www-ee.stanford.edu\/~luckham\/\">David Luckham<\/a> at Stanford University and was based on the Stanford Resolution Prover developed using <a href=\"http:\/\/dl.acm.org\/citation.cfm?doid=321250.321253&amp;CFID=944729420&amp;CFTOKEN=55493847\">J.A. Robinson&#8217;s Resolution Principle<\/a>.<\/p>\n<p>In Edinburgh, Scotland in 1972, Robert S. Boyer and J. Strother Moore built the first successful machine-based prover, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Nqthm\">Nqthm<\/a>.It became the basis for <a href=\"http:\/\/www.cs.utexas.edu\/users\/moore\/acl2\/\">ACL2<\/a>, which could prove mathematical theorems automatically for logic based on a dialect of Pure Lisp. Almost at the same time, <a href=\"https:\/\/www.cl.cam.ac.uk\/~mjcg\/papers\/HolHistory.pdf\">Sir Robin Milner built the original LCF system for proof checking at Stanford University. <\/a>Descendants of LCF make up a thriving family of theorem provers, the most famous ones being <a href=\"https:\/\/hol-theorem-prover.org\/#doc\">HOL 4<\/a>, built by Mike Gordon and Tom Melham; <a href=\"https:\/\/www.cl.cam.ac.uk\/~jrh13\/hol-light\/\">HOL Light<\/a>, built by John Harrison; and <a href=\"https:\/\/coq.inria.fr\/\">Coq<\/a>, built at INRIA in France drawing on original work done by G\u00e9rard Huet and Thierry Coquand.<\/p>\n<p>Both ACL2 and the various provers such as HOL 4 and HOL Light have been used extensively for digital design verification of floating point units\u2014most notably, <a href=\"http:\/\/www.russinoff.com\/papers\/paris.pdf\">AMD<\/a> and <a href=\"http:\/\/www.cl.cam.ac.uk\/~jrh13\/slides\/lics-22jun03.pdf\">Intel<\/a>. John Harrison, Josef Urban, and Freek Wiedijk have written a useful article covering the <a href=\"http:\/\/www.cl.cam.ac.uk\/~jrh13\/papers\/joerg.pdf\">history of interactive theorem proving<\/a>.<\/p>\n<p>Another notable theorem prover that is not considered part of the LCF family is <a href=\"http:\/\/dl.acm.org\/citation.cfm?id=752639\">PVS<\/a>. It was developed by Sam Owre, John Rushby, and Natrajan Shankar at SRI International and has been used extensively during the verification of safety-critical systems, especially on space-related work at NASA.<\/p>\n<p>Theorem provers have long proved valuable and were once seen as the formal \u2018tools of choice\u2019. But they had a major shortcoming. If they couldn\u2019t prove a theorem they couldn\u2019t say why. There was no way of generating a counter-example or any form of explanation as to why a conjecture could not be a lemma. This limited their applicability to formal experts with solid foundations in computer science and mathematics. So much so, that many engineers used to quip, \u201cYou need a PhD in formal just to use formal tools.\u201d<\/p>\n<h4>Model checking<\/h4>\n<p>While theorem proving was gaining attention for proving the properties of infinite systems, it clearly had shortcomings. These began to be addressed by a number of people during the 1970s. Particularly notably in this group were Allen Emerson and Edmund Clarke at Carnegie Mellon University in the USA, and J.P. Quielle and Joseph Sifakis in France. Also, in the late 1970s and early 1980s, Amir Pnueli, Owicki, and Lamport began work toward creating a language to capture the properties of concurrent programs using temporal logic.<\/p>\n<p>In 1981, <a href=\"http:\/\/dl.acm.org\/citation.cfm?id=747438\">Emerson and Clarke<\/a> combined the state-space exploration approach with temporal logic in a way that provided the first automated model checking algorithm. It was fast, capable of proving properties of programs, and, more importantly, could provide counter-examples when it could not prove. Moreover, it happily coped with partial specifications.<\/p>\n<p>During the mid-1980s, several papers were written showing how model checking could be applied to hardware verification and the user base for formal began to grow. Soon, however, a new challenge emerged: the size of the hardware designs that could be verified with model checking was being limited because of the explicit state-space reachability.<\/p>\n<p>Around this time, Randall Bryant, from CMUs electrical engineering department, began playing with the idea of circuit-level simulation mainly for logic simulation for transistors. Specifically he considered using the idea of a three-valued simulation.<\/p>\n<p>Bryant explored the use of symbolic encoding in compressing simulation test vectors. The biggest challenge was an efficient encoding of these symbols and the Boolean formulas made on them. In response, Bryant invented ordered Binary decision diagrams (OBDDs). Ken McMillan, a graduate student working with Edmund Clarke on his PhD, got to know of this and in 1993, <a href=\"http:\/\/www.kenmcmil.com\/pubs\/LICS90.pdf\">symbolic model checking<\/a> was born.<\/p>\n<p>OBDDs provide a canonical form for Boolean formulas that is often substantially more compact than conjunctive or disjunctive normal form. Also, very efficient algorithms have been developed for manipulating them. To quote Ed Clarke from <a href=\"https:\/\/www7.in.tum.de\/um\/25\/pdf\/Clarke.pdf\">this paper<\/a>: \u201cBecause the symbolic representation captures some of the regularity in the state space determined by circuits and protocols, it is possible to verify systems with an extremely large number of states\u2014many orders of magnitude larger than could be handled by the explicit-state algorithms.\u201d<\/p>\n<p>Together with Carl J. Seger, Bryant went on to invent another very powerful model checking technique called <a href=\"http:\/\/repository.cmu.edu\/cgi\/viewcontent.cgi?article=1189&amp;context=compsci\">symbolic trajectory evaluation<\/a> (STE). It has been used extensively for processor verification at companies such as <a href=\"https:\/\/www.cs.ox.ac.uk\/tom.melham\/pub\/Jones-2001-PFV.pdf\">Intel<\/a> for more than 20 years. Several generations of Pentium floating point units <a href=\"https:\/\/www.cs.ox.ac.uk\/tom.melham\/pub\/Jones-2001-PFV.pdf\">have been verified<\/a> using STE. Intel continues to use STE to today.<\/p>\n<p>The main benefit that STE provides over conventional model checking is that it employs a three-value logic (0,1,X) with partial order over a lattice to carry out symbolic simulation over finite time periods. The use of \u2018X\u2018 to denote an unknown state in the design and perform Boolean operations on \u2018X\u2019 provided an automatic fast data abstraction. When coupled with BDDs, this provided a very fast algorithm for finite-state model checking. A quick primer on STE is available <a href=\"http:\/\/darbari.org\/ashish\/research\/pub\/ste2004.pdf\">here.<\/a> The main disadvantage of STE is that it is unable to specify properties over unbounded time periods. This limited its applicability to verifying digital designs for finite bounded time behavior.<\/p>\n<p>Other prominent developments in formal technology still in use that include model checking and some form of theorem proving for verification of concurrent systems include:<\/p>\n<ul>\n<li>the <a href=\"https:\/\/www.microsoft.com\/en-us\/research\/wp-content\/uploads\/2016\/12\/Specifying-Concurrent-Systems-with-TLA.pdf\">TLA+ based model checker<\/a> by Leslie Lamport;<\/li>\n<li>the <a href=\"http:\/\/dl.acm.org\/citation.cfm?doid=359576.359585\">CSP based verification<\/a> by Tony Hoare;<\/li>\n<li>the <a href=\"http:\/\/alloy.mit.edu\/alloy\/\">Alloy<\/a> language from Daniel Jackson at MIT; and<\/li>\n<li>the <a href=\"http:\/\/www.event-b.org\/\">Event-B language<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Z_notation\">Z-notation<\/a>, and proof tools from Jean-Raymond Abrial.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>However, all of these languages and supported formal verification tools have primarily been applied to software or the high-level modeling of systems, and less so to hardware. Using them requires a substantial background in mathematics.<\/p>\n<h4>Equivalence checking<\/h4>\n<p>Both theorem proving and model checking continue to be used for different reasons on both hardware and software, but a third form of formal verification is also now being used extensively. That form is equivalence checking.<\/p>\n<p>This method relies on comparing two models of a design and produces an outcome that either proves they are equal or provides a counter-example to show when they disagree. Its early forms of this were done for combinational hardware designs, but <a href=\"http:\/\/researcher.watson.ibm.com\/researcher\/view_group.php?id=2987\">scalable equivalence checkers<\/a> now exist for sequential equivalence checking. These are used widely, most notably for combinational equivalence checking of an RTL and a netlist, but also for <a href=\"https:\/\/www.onespin.com\/products\/360-ec-fpga\/\">sequential netlist synthesis verification<\/a>. It is now common practice for hardware designers to use equivalence checkers to compare that an unoptimized digital design is functionally the same as an optimized one where the optimization may have applied power-saving features such as clock gating.<\/p>\n<p>This quick tour should give you a good sense of how formal verification techniques have steadily evolved, rising to each challenge before them. This is an established approach now coming into its own because of how it helps us confront increasing complexity. Formal verification also has, to take us back to the beginning, an elegance to it that is perhaps not as fully recognized as that in the designs it enables.<\/p>\n<p>But in our next part, it is time to move on to look at how formal verification can be applied, how it can make those lauded designs a possibility. We will do this by taking <a href=\"https:\/\/www.techdesignforums.com\/practicetechnique\/doc-formal-the-evolution-of-formal-verification-part-two\/\">\u2018A practitioner\u2019s view of formal\u2019<\/a> with specific examples built around the technology\u2019s use in conjunction with widely-adopted System Verilog Assertions.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Doc Formal begins a two-part series by describing the solid and well-established foundations of formal verification.<\/p>\n","protected":false},"author":138,"featured_media":9429,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[1108,1605,1548,1904,2073],"coauthors":[1441],"class_list":["post-9536","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-design-verification","tag-formal-verification","tag-functional-safety","tag-model-checking","tag-sequential-equivalence-checking","tag-theorem-proving","workflow-expert-blog","workflow-op-ed","workflow-up-to-date","organization-onespin-solutions"],"_links":{"self":[{"href":"https:\/\/www.techdesignforums.com\/practice\/wp-json\/wp\/v2\/posts\/9536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techdesignforums.com\/practice\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techdesignforums.com\/practice\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techdesignforums.com\/practice\/wp-json\/wp\/v2\/users\/138"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techdesignforums.com\/practice\/wp-json\/wp\/v2\/comments?post=9536"}],"version-history":[{"count":0,"href":"https:\/\/www.techdesignforums.com\/practice\/wp-json\/wp\/v2\/posts\/9536\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techdesignforums.com\/practice\/wp-json\/wp\/v2\/media\/9429"}],"wp:attachment":[{"href":"https:\/\/www.techdesignforums.com\/practice\/wp-json\/wp\/v2\/media?parent=9536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techdesignforums.com\/practice\/wp-json\/wp\/v2\/categories?post=9536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techdesignforums.com\/practice\/wp-json\/wp\/v2\/tags?post=9536"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.techdesignforums.com\/practice\/wp-json\/wp\/v2\/coauthors?post=9536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}