A Unified Model for Hardware/Software Codesign Nirav

Total Page:16

File Type:pdf, Size:1020Kb

A Unified Model for Hardware/Software Codesign Nirav A Unified Model for Hardware/Software Codesign by Nirav Dave Submitted to the Department of Electrical Engineering and Computer Science in partial fulfillment of the requirements for the degree of Doctor of Philosophy in Electrical Engineering and Computer Science at the MASSACHUSETTS INSTITUTE OF TECHNOLOGY September 2011 © Nirav Dave, MMXI. All rights reserved. The author hereby grants to MIT permission to reproduce and distribute publicly paper and electronic copies of this thesis document in whole or in part. Author.............................................................. Department of Electrical Engineering and Computer Science July 26, 2011 Certified by. Arvind Johnson Professor of Electrical Engineering and Computer Science Thesis Supervisor Accepted by . Professor Leslie A. Kolodziejski Chair, Department Committee on Graduate Students 2 A Unified Model for Hardware/Software Codesign by Nirav Dave Submitted to the Department of Electrical Engineering and Computer Science on July 26, 2011, in partial fulfillment of the requirements for the degree of Doctor of Philosophy in Electrical Engineering and Computer Science Abstract Embedded systems are almost always built with parts implemented in both hard- ware and software. Market forces encourage such systems to be developed with different hardware-software decompositions to meet different points on the price- performance-power curve. Current design methodologies make the exploration of different hardware-software decompositions difficult because such exploration is both expensive and introduces significant delays in time-to-market. This thesis addresses this problem by introducing, Bluespec Codesign Language (BCL), a unified language model based on guarded atomic actions for hardware-software codesign. The model provides an easy way of specifying which parts of the design should be implemented in hardware and which in software without obscuring important design decisions. In addition to describing BCL's operational semantics, we formalize the equivalence of BCL programs and use this to mechanically verify design refinements. We describe the partitioning of a BCL program via computational domains and the compilation of different computational domains into hardware and software, respectively. Thesis Supervisor: Arvind Title: Johnson Professor of Electrical Engineering and Computer Science 3 4 Acknowledgments This thesis has been a long time in coming and as one might expect, the list of those who deserve proper acknowledgment are long and hard to list. Foremost, I would like to my Advisor Professor Arvind for his help and mentorship. It is not an easy thing to find an advisor with a love of both the theoretical aspects of the work and an appreciation for practical application. Arvind never forced me to step away from any vector of interest. This perhaps is part of why my time at MIT was so long, but also so worthwhile. I would also like to thank Rishiyur Nikhil, Joe Stoy, Jamey Hicks, Kattamuri Ekanadham, Derek Chiou, James Hoe, and John Ankcorn for their advice and dis- cussion on various aspects of this work and its presentation over the years. To Jacob Schwartz, Jeff Newbern, Ravi Nanavati, and everyone else at Bluespec Inc. who patiently dealt with both my complaints about the compiler and my off the wall ideas. To my fellow graduate students, Charles O'Donnell, Ryan Newton, Man Cheuk Ng, Jae Lee, Mieszko Lis, Abhinav Agarwal, Asif Khan, Muralidaran Vijayaraghavan, and Kermin Fleming, who put up with my distractions. Special thanks are needed for Michael Pellauer who helped slog through some of the semantic details, Myron King who spent many years working with me on the BCL compiler and Michael Katelman who was instrumental in the verification effort. To Peter Neumann, for significant English assistance, and convincing me to keep up the editing process even after the thesis was acceptable. To my parents who were always there to remind me that my thesis need not solve the field and perhaps eight years of work was enough. And last but not least Nick and Larissa who got me out of the office and kept me sane over the years. I do not think I would have made it without you both. 5 6 Contents 1 Introduction 15 1.1 Desirable Properties for a Hardware-Software Codesign Language . 17 1.2 Thesis Contributions . 19 1.3 Thesis Organization . 21 1.4 Related Work . 22 1.4.1 Software Models of Hardware Description Languages . 22 1.4.2 C-based Behavioral Synthesis . 23 1.4.3 Implementation Agnostic Parallel Models . 24 1.4.4 Heterogeneous Simulation Frameworks . 25 1.4.5 Algorithmic Approaches to Design . 26 1.4.6 Application-Specific Programmable Processors . 26 1.4.7 Single Specification Hardware/Software Approaches . 27 1.4.8 Previous Work on Atomic Actions and Guards . 27 2 BCL: A Language of Guarded Atomic Actions 29 2.1 Example: Longest Prefix Match . 32 2.2 Semantics of Rule Execution in BCL . 36 2.2.1 Action Composition . 37 2.2.2 Conditional versus Guarded Actions . 40 2.2.3 Looping Constructs . 42 2.2.4 Local Guard . 42 2.2.5 Method Calls . 43 2.2.6 Notation of Rule Execution . 44 7 2.3 A BCL Program as a State Transition System . 45 2.4 Program Equivalence and Ordering . 48 2.4.1 Derived Rules . 50 3 A Rule-level Interpreter of BCL 53 3.1 Functionalization of BCL: The GCD Example . 53 3.2 Translation of BCL to λ-Calculus . 56 3.3 The GCD Example Revisited . 62 4 Hardware Synthesis 65 4.1 Implementing a Single Rule . 66 4.1.1 Implementing State Merging Functions . 68 4.1.2 Constructing the FSM . 71 4.2 Modularizing the Translation . 73 4.3 Understanding the FSM Modularization . 76 5 Scheduling 83 5.1 A Reference Scheduler . 84 5.2 Scheduling via Rule Composition . 86 5.2.1 Rule Composition Operators . 88 5.2.2 Sequencing Rules: compose . 89 5.2.3 Merging Mutually Exclusive Rules: par . 89 5.2.4 Choosing from Rules: restrict . 92 5.2.5 Repeating Execution: repeat . 92 5.2.6 Expressing Other Rule Compositions . 93 5.3 Scheduling in the Context of Synchronous Hardware . 94 5.3.1 Exploiting Parallel Composition . 94 5.3.2 Extending for Sequentiality . 97 5.3.3 Improving Compilation Speed . 99 5.3.4 Introducing Sequential Composition . 99 5.4 Expressing User-defined Schedules via Rule Compositions . 101 8 5.4.1 The Three Schedules . 104 5.4.2 Performance Results . 104 6 Computational Domains 107 6.1 Representing Partitioning in BCL: Computational Domains . 111 6.2 Partitioning with Computational Domains . 115 6.2.1 Modifying the Program for Partitioning . 116 6.3 Isolating Domains for Implementation . 117 6.4 A Design Methodology in the Presence of Domains . 120 7 Software Generation 121 7.1 Rule Canonicalization . 121 7.2 Syntax-Directed Compilation . 123 7.2.1 Compiling Expressions . 125 7.2.2 Compiling Actions . 125 7.2.3 Compiling Rules and Methods . 130 7.2.4 Compiling Modules . 130 7.3 The Runtime: Constructing main() ................... 130 7.4 Software Optimizations . 135 7.4.1 Shadow Minimization . 135 7.4.2 Action Sequentialization . 140 7.4.3 When Lifting . 141 7.4.4 Scheduling and Runtime Improvements . 143 8 Refinements and Correctness 145 8.1 Understanding Design Refinements . 146 8.1.1 Observability . 151 8.1.2 An Example of an Incorrect Refinement . 153 8.1.3 Refinements in the Context of Choice . 156 8.2 Establishing Correctness of Implementation . 160 8.3 Checking Simulation Using SMT Solvers . 163 9 8.3.1 Checking Correctness . 164 8.3.2 The Algorithm . 166 8.3.3 Formulating the SMT Queries . 167 8.3.4 Step-By-Step Demonstration . 169 8.4 The Debugging Tool and Evaluation . 170 9 Conclusion 175 10 List of Figures 2-1 Grammar of BCL. For simplicity we will assume all module and method names are unique. 30 2-2 Sequential C code for longest prefix match example . 32 2-3 Example: A Table-Lookup Program. Other modules implementations are given in Figure 2-4 . 34 2-4 One-element FIFO and Na¨ıve Memory Modules . 35 2-5 Operational semantics of a BCL Expressions. When no rule applies the expression evaluates to NR . 38 2-6 Operational semantics of a BCL Actions. When no rule applies the action evaluates to NR. Rule bodies which evaluate to NR produce no state update. 39 2-7 Helper Functions for Operational Semantics . 40 2-8 When-Related Axioms on Actions . 41 3-1 GCD Program in BCL . 54 3-2 Functionalization of Actions. Fixed-width text is concrete syntax of the λ-calculus expression . 59 3-3 Functionalization of BCL Expressions. Fixed-width text is concrete syntax of the λ-calculus expression . 60 3-4 Conversion of Top-level BCL Design to top-level definitions. Fixed-width text is concrete syntax of the λ-calculus expression. 61 3-5 Functionalized form of GCD program . 63 11 4-1 Initial Example translation of λ-expressions to Circuits. White boxes can be implemented solely with wires, gray boxes need gates, dotted boxes correspond to λ abstractions. 68 4-2 Result of β-reduction on expression in Figure 4-1. Notice how the fundamental circuit structures does not change . 69 4-3 Result of Distribution and Constant Propagation on expression in Fig- ure 4-2. Sharing the white box structures (wire structures) do not change the . 69 4-4 Example Single-Rule Program for Hardware Synthesis . 72 4-5 Simplified λ expressions of functionalization of Figure 4-4 . 72 4-6 Final functionalization of Program in Figure 4-4 . 73 4-7 Example of implemented rule. State structure s0, s1, ns, and final output s2 have been flattened into a single bit-vector. fg is Verilog bit-vector concatenation. 74 4-8 Generation of δ Functions.
Recommended publications
  • Operational Semantics Page 1
    Operational Semantics Page 1 Operational Semantics Class notes for a lecture given by Mooly Sagiv Tel Aviv University 24/5/2007 By Roy Ganor and Uri Juhasz Reference Semantics with Applications, H. Nielson and F. Nielson, Chapter 2. http://www.daimi.au.dk/~bra8130/Wiley_book/wiley.html Introduction Semantics is the study of meaning of languages. Formal semantics for programming languages is the study of formalization of the practice of computer programming. A computer language consists of a (formal) syntax – describing the actual structure of programs and the semantics – which describes the meaning of programs. Many tools exist for programming languages (compilers, interpreters, verification tools, … ), the basis on which these tools can cooperate is the formal semantics of the language. Formal Semantics When designing a programming language, formal semantics gives an (hopefully) unambiguous definition of what a program written in the language should do. This definition has several uses: • People learning the language can understand the subtleties of its use • The model over which the semantics is defined (the semantic domain) can indicate what the requirements are for implementing the language (as a compiler/interpreter/…) • Global properties of any program written in the language, and any state occurring in such a program, can be understood from the formal semantics • Implementers of tools for the language (parsers, compilers, interpreters, debuggers etc) have a formal reference for their tool and a formal definition of its correctness/completeness
    [Show full text]
  • Denotational Semantics
    Denotational Semantics CS 6520, Spring 2006 1 Denotations So far in class, we have studied operational semantics in depth. In operational semantics, we define a language by describing the way that it behaves. In a sense, no attempt is made to attach a “meaning” to terms, outside the way that they are evaluated. For example, the symbol ’elephant doesn’t mean anything in particular within the language; it’s up to a programmer to mentally associate meaning to the symbol while defining a program useful for zookeeppers. Similarly, the definition of a sort function has no inherent meaning in the operational view outside of a particular program. Nevertheless, the programmer knows that sort manipulates lists in a useful way: it makes animals in a list easier for a zookeeper to find. In denotational semantics, we define a language by assigning a mathematical meaning to functions; i.e., we say that each expression denotes a particular mathematical object. We might say, for example, that a sort implementation denotes the mathematical sort function, which has certain properties independent of the programming language used to implement it. In other words, operational semantics defines evaluation by sourceExpression1 −→ sourceExpression2 whereas denotational semantics defines evaluation by means means sourceExpression1 → mathematicalEntity1 = mathematicalEntity2 ← sourceExpression2 One advantage of the denotational approach is that we can exploit existing theories by mapping source expressions to mathematical objects in the theory. The denotation of expressions in a language is typically defined using a structurally-recursive definition over expressions. By convention, if e is a source expression, then [[e]] means “the denotation of e”, or “the mathematical object represented by e”.
    [Show full text]
  • Quantum Weakest Preconditions
    Quantum Weakest Preconditions Ellie D’Hondt ∗ Prakash Panangaden †‡ Abstract We develop a notion of predicate transformer and, in particular, the weak- est precondition, appropriate for quantum computation. We show that there is a Stone-type duality between the usual state-transformer semantics and the weakest precondition semantics. Rather than trying to reduce quantum com- putation to probabilistic programming we develop a notion that is directly taken from concepts used in quantum computation. The proof that weak- est preconditions exist for completely positive maps follows from the Kraus representation theorem. As an example we give the semantics of Selinger’s language in terms of our weakest preconditions. 1 Introduction Quantum computation is a field of research that is rapidly acquiring a place as a significant topic in computer science. To be sure, there are still essential tech- nological and conceptual problems to overcome in building functional quantum computers. Nevertheless there are fundamental new insights into quantum com- putability [Deu85, DJ92], quantum algorithms [Gro96, Gro97, Sho94, Sho97] and into the nature of quantum mechanics itself [Per95], particularly with the emer- gence of quantum information theory [NC00]. These developments inspire one to consider the problems of programming full-fledged general purpose quantum computers. Much of the theoretical re- search is aimed at using the new tools available - superposition, entanglement and linearity - for algorithmic efficiency. However, the fact that quantum algorithms are currently done at a very low level only - comparable to classical computing 60 years ago - is a much less explored aspect of the field. The present paper is ∗Centrum Leo Apostel , Vrije Universiteit Brussel, Brussels, Belgium, [email protected].
    [Show full text]
  • Metadefender Core V4.12.2
    MetaDefender Core v4.12.2 © 2018 OPSWAT, Inc. All rights reserved. OPSWAT®, MetadefenderTM and the OPSWAT logo are trademarks of OPSWAT, Inc. All other trademarks, trade names, service marks, service names, and images mentioned and/or used herein belong to their respective owners. Table of Contents About This Guide 13 Key Features of Metadefender Core 14 1. Quick Start with Metadefender Core 15 1.1. Installation 15 Operating system invariant initial steps 15 Basic setup 16 1.1.1. Configuration wizard 16 1.2. License Activation 21 1.3. Scan Files with Metadefender Core 21 2. Installing or Upgrading Metadefender Core 22 2.1. Recommended System Requirements 22 System Requirements For Server 22 Browser Requirements for the Metadefender Core Management Console 24 2.2. Installing Metadefender 25 Installation 25 Installation notes 25 2.2.1. Installing Metadefender Core using command line 26 2.2.2. Installing Metadefender Core using the Install Wizard 27 2.3. Upgrading MetaDefender Core 27 Upgrading from MetaDefender Core 3.x 27 Upgrading from MetaDefender Core 4.x 28 2.4. Metadefender Core Licensing 28 2.4.1. Activating Metadefender Licenses 28 2.4.2. Checking Your Metadefender Core License 35 2.5. Performance and Load Estimation 36 What to know before reading the results: Some factors that affect performance 36 How test results are calculated 37 Test Reports 37 Performance Report - Multi-Scanning On Linux 37 Performance Report - Multi-Scanning On Windows 41 2.6. Special installation options 46 Use RAMDISK for the tempdirectory 46 3. Configuring Metadefender Core 50 3.1. Management Console 50 3.2.
    [Show full text]
  • Operational Semantics with Hierarchical Abstract Syntax Graphs*
    Operational Semantics with Hierarchical Abstract Syntax Graphs* Dan R. Ghica Huawei Research, Edinburgh University of Birmingham, UK This is a motivating tutorial introduction to a semantic analysis of programming languages using a graphical language as the representation of terms, and graph rewriting as a representation of reduc- tion rules. We show how the graphical language automatically incorporates desirable features, such as a-equivalence and how it can describe pure computation, imperative store, and control features in a uniform framework. The graph semantics combines some of the best features of structural oper- ational semantics and abstract machines, while offering powerful new methods for reasoning about contextual equivalence. All technical details are available in an extended technical report by Muroya and the author [11] and in Muroya’s doctoral dissertation [21]. 1 Hierarchical abstract syntax graphs Before proceeding with the business of analysing and transforming the source code of a program, a com- piler first parses the input text into a sequence of atoms, the lexemes, and then assembles them into a tree, the Abstract Syntax Tree (AST), which corresponds to its grammatical structure. The reason for preferring the AST to raw text or a sequence of lexemes is quite obvious. The structure of the AST incor- porates most of the information needed for the following stage of compilation, in particular identifying operations as nodes in the tree and operands as their branches. This makes the AST algorithmically well suited for its purpose. Conversely, the AST excludes irrelevant lexemes, such as separators (white-space, commas, semicolons) and aggregators (brackets, braces), by making them implicit in the tree-like struc- ture.
    [Show full text]
  • Linuxvilag-66.Pdf 8791KB 11 2012-05-28 10:27:18
    Magazin Hírek Java telefon másképp Huszonegyedik századi autótolvajok Samsung okostelefon Linuxszal Magyarországon még nem jellemzõ, Kínában már kapható de tõlünk nyugatabbra már nem tol- a Samsung SCH-i819 mo- vajkulccsal vagy feszítõvassal, hanem biltelefonja, amely Prizm laptoppal járnak az autótolvajok. 2.5-ös Linuxot futtat. Ot- Mindezt azt teszi lehetõvé, hogy tani nyaralás esetén nyu- a gyújtás, a riasztó és az ajtózárak is godtan vásárolhatunk távirányíthatóak, így egy megfelelõen belõle, hiszen a CDMA felszerelt laptoppal is irányíthatóak 800 MHz-e mellett az ezek a rendszerek. európai 900/1800 MHz-et http://www.leftlanenews.com/2006/ is támogatja. A kommunikációt egy 05/03/gone-in-20-minutes-using- Qualcomm MSM6300-as áramkör bo- laptops-to-steal-cars/ nyolítja, míg az alkalmazások egy 416 MHz-es Intel PXA270-es processzoron A Lucent Technologies és a SUN Elephants Dream futnak. A készülék Class 10-es GPRS elkészítette a Jasper S20-at, ami adatátvitelre képes, illetve tartalmaz alapvetõen más koncepcióval GPS (globális helymeghatározó) vevõt © Kiskapu Kft. Minden jog fenntartva használja a Java-t, mint a mostani is. Az eszköz 64 megabájt SDRAM-ot és telefonok. Joggal kérdezheti a kedves 128 megabájt nem felejtõ flash memóri- Olvasó, hogy megéri-e, van-e hely át kapott, de micro-SD memóriakártyá- a jelenlegi Symbian, Windows Mobile val ezt tovább bõvíthetjük. A kijelzõje és Linux trió mellett. A jelenlegi 2.4 hüvelykes, felbontása pedig „csak” telefonoknál kétféleképpen futhat 240x320 képpont 65 ezer színnel. egy program: natív vagy Java mód- Május 19-én elérhetõvé tette az Orange Természetesen a trendeknek megfele- ban. A Java mód ott szükségessé Open Movie Project elsõ rövidfilmjét lõen nem maradt ki a 2 megapixeles tesz pár olyan szintet, amely Creative Commons jogállással.
    [Show full text]
  • Making Classes Provable Through Contracts, Models and Frames
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by CiteSeerX DISS. ETH NO. 17610 Making classes provable through contracts, models and frames A dissertation submitted to the SWISS FEDERAL INSTITUTE OF TECHNOLOGY ZURICH (ETH Zurich)¨ for the degree of Doctor of Sciences presented by Bernd Schoeller Diplom-Informatiker, TU Berlin born April 5th, 1974 citizen of Federal Republic of Germany accepted on the recommendation of Prof. Dr. Bertrand Meyer, examiner Prof. Dr. Martin Odersky, co-examiner Prof. Dr. Jonathan S. Ostroff, co-examiner 2007 ABSTRACT Software correctness is a relation between code and a specification of the expected behavior of the software component. Without proper specifica- tions, correct software cannot be defined. The Design by Contract methodology is a way to tightly integrate spec- ifications into software development. It has proved to be a light-weight and at the same time powerful description technique that is accepted by software developers. In its more than 20 years of existence, it has demon- strated many uses: documentation, understanding object-oriented inheri- tance, runtime assertion checking, or fully automated testing. This thesis approaches the formal verification of contracted code. It conducts an analysis of Eiffel and how contracts are expressed in the lan- guage as it is now. It formalizes the programming language providing an operational semantics and a formal list of correctness conditions in terms of this operational semantics. It introduces the concept of axiomatic classes and provides a full library of axiomatic classes, called the mathematical model library to overcome prob- lems of contracts on unbounded data structures.
    [Show full text]
  • A Denotational Semantics Approach to Functional and Logic Programming
    A Denotational Semantics Approach to Functional and Logic Programming TR89-030 August, 1989 Frank S.K. Silbermann The University of North Carolina at Chapel Hill Department of Computer Science CB#3175, Sitterson Hall Chapel Hill, NC 27599-3175 UNC is an Equal OpportunityjAfflrmative Action Institution. A Denotational Semantics Approach to Functional and Logic Programming by FrankS. K. Silbermann A dissertation submitted to the faculty of the University of North Carolina at Chapel Hill in par­ tial fulfillment of the requirements for the degree of Doctor of Philosophy in Computer Science. Chapel Hill 1989 @1989 Frank S. K. Silbermann ALL RIGHTS RESERVED 11 FRANK STEVEN KENT SILBERMANN. A Denotational Semantics Approach to Functional and Logic Programming (Under the direction of Bharat Jayaraman.) ABSTRACT This dissertation addresses the problem of incorporating into lazy higher-order functional programming the relational programming capability of Horn logic. The language design is based on set abstraction, a feature whose denotational semantics has until now not been rigorously defined. A novel approach is taken in constructing an operational semantics directly from the denotational description. The main results of this dissertation are: (i) Relative set abstraction can combine lazy higher-order functional program­ ming with not only first-order Horn logic, but also with a useful subset of higher­ order Horn logic. Sets, as well as functions, can be treated as first-class objects. (ii) Angelic powerdomains provide the semantic foundation for relative set ab­ straction. (iii) The computation rule appropriate for this language is a modified parallel­ outermost, rather than the more familiar left-most rule. (iv) Optimizations incorporating ideas from narrowing and resolution greatly improve the efficiency of the interpreter, while maintaining correctness.
    [Show full text]
  • Denotational Semantics
    Denotational Semantics 8–12 lectures for Part II CST 2010/11 Marcelo Fiore Course web page: http://www.cl.cam.ac.uk/teaching/1011/DenotSem/ 1 Lecture 1 Introduction 2 What is this course about? • General area. Formal methods: Mathematical techniques for the specification, development, and verification of software and hardware systems. • Specific area. Formal semantics: Mathematical theories for ascribing meanings to computer languages. 3 Why do we care? • Rigour. specification of programming languages . justification of program transformations • Insight. generalisations of notions computability . higher-order functions ... data structures 4 • Feedback into language design. continuations . monads • Reasoning principles. Scott induction . Logical relations . Co-induction 5 Styles of formal semantics Operational. Meanings for program phrases defined in terms of the steps of computation they can take during program execution. Axiomatic. Meanings for program phrases defined indirectly via the ax- ioms and rules of some logic of program properties. Denotational. Concerned with giving mathematical models of programming languages. Meanings for program phrases defined abstractly as elements of some suitable mathematical structure. 6 Basic idea of denotational semantics [[−]] Syntax −→ Semantics Recursive program → Partial recursive function Boolean circuit → Boolean function P → [[P ]] Concerns: • Abstract models (i.e. implementation/machine independent). Lectures 2, 3 and 4. • Compositionality. Lectures 5 and 6. • Relationship to computation (e.g. operational semantics). Lectures 7 and 8. 7 Characteristic features of a denotational semantics • Each phrase (= part of a program), P , is given a denotation, [[P ]] — a mathematical object representing the contribution of P to the meaning of any complete program in which it occurs. • The denotation of a phrase is determined just by the denotations of its subphrases (one says that the semantics is compositional).
    [Show full text]
  • Probabilistic Predicate Transformers
    Probabilistic Predicate Transformers CARROLL MORGAN, ANNABELLE McIVER, and KAREN SEIDEL Oxford University Probabilistic predicates generalize standard predicates over a state space; with probabilistic pred- icate transformers one thus reasons about imperative programs in terms of probabilistic pre- and postconditions. Probabilistic healthiness conditions generalize the standard ones, characterizing “real” probabilistic programs, and are based on a connection with an underlying relational model for probabilistic execution; in both contexts demonic nondeterminism coexists with probabilis- tic choice. With the healthiness conditions, the associated weakest-precondition calculus seems suitable for exploring the rigorous derivation of small probabilistic programs. Categories and Subject Descriptors: D.2.4 [Program Verification]: Correctness Proofs; D.3.1 [Programming Languages]: Formal Definitions and Theory; F.1.2 [Modes of Computation]: Probabilistic Computation; F.3.1 [Semantics of Programming Languages]: Specifying and Ver- ifying and Reasoning about Programs; G.3 [Probability and Statistics]: Probabilistic Algorithms General Terms: Verification, Theory, Algorithms, Languages Additional Key Words and Phrases: Galois connection, nondeterminism, predicate transformers, probability, program derivation, refinement, weakest preconditions 1. MOTIVATION AND INTRODUCTION The weakest-precondition approach of Dijkstra [1976] has been reasonably success- ful for rigorous derivation of small imperative programs, even (and especially) those involving demonic
    [Show full text]
  • Mechanized Semantics of Simple Imperative Programming Constructs*
    App eared as technical rep ort UIB Universitat Ulm Fakultat fur Informatik Dec Mechanized Semantics of Simple Imp erative Programming Constructs H Pfeifer A Dold F W von Henke H Rue Abt Kunstliche Intelligenz Fakultat fur Informatik Universitat Ulm D Ulm verifixkiinformatikuniulmde Abstract In this pap er a uniform formalization in PVS of various kinds of semantics of imp er ative programming language constructs is presented Based on a comprehensivede velopment of xed p oint theory the denotational semantics of elementary constructs of imp erative programming languages are dened as state transformers These state transformers induce corresp onding predicate transformers providing a means to for mally derivebothaweakest lib eral precondition semantics and an axiomatic semantics in the style of Hoare Moreover algebraic laws as used in renement calculus pro ofs are validated at the level of predicate transformers Simple reformulations of the state transformer semantics yield b oth a continuationstyle semantics and rules similar to those used in Structural Op erational Semantics This formalization provides the foundations on which formal sp ecication of program ming languages and mechanical verication of compilation steps are carried out within the Verix pro ject This research has b een funded in part by the Deutsche Forschungsgemeinschaft DFG under pro ject Verix Contents Intro duction Related Work Overview A brief description of PVS Mechanizing Domain
    [Show full text]
  • Chapter 3 – Describing Syntax and Semantics CS-4337 Organization of Programming Languages
    !" # Chapter 3 – Describing Syntax and Semantics CS-4337 Organization of Programming Languages Dr. Chris Irwin Davis Email: [email protected] Phone: (972) 883-3574 Office: ECSS 4.705 Chapter 3 Topics • Introduction • The General Problem of Describing Syntax • Formal Methods of Describing Syntax • Attribute Grammars • Describing the Meanings of Programs: Dynamic Semantics 1-2 Introduction •Syntax: the form or structure of the expressions, statements, and program units •Semantics: the meaning of the expressions, statements, and program units •Syntax and semantics provide a language’s definition – Users of a language definition •Other language designers •Implementers •Programmers (the users of the language) 1-3 The General Problem of Describing Syntax: Terminology •A sentence is a string of characters over some alphabet •A language is a set of sentences •A lexeme is the lowest level syntactic unit of a language (e.g., *, sum, begin) •A token is a category of lexemes (e.g., identifier) 1-4 Example: Lexemes and Tokens index = 2 * count + 17 Lexemes Tokens index identifier = equal_sign 2 int_literal * mult_op count identifier + plus_op 17 int_literal ; semicolon Formal Definition of Languages • Recognizers – A recognition device reads input strings over the alphabet of the language and decides whether the input strings belong to the language – Example: syntax analysis part of a compiler - Detailed discussion of syntax analysis appears in Chapter 4 • Generators – A device that generates sentences of a language – One can determine if the syntax of a particular sentence is syntactically correct by comparing it to the structure of the generator 1-5 Formal Methods of Describing Syntax •Formal language-generation mechanisms, usually called grammars, are commonly used to describe the syntax of programming languages.
    [Show full text]