Compositional correctness of IP-based system design: Translating C/C++ Models into SIGNAL Processes Rennes, November 04, 2005 Hamoudi Kalla and Jean-Pierre.

Slides:



Advertisements
Similar presentations
Static Single-Assignment ? ? Introduction: Over last few years [1991] SSA has been Stablished as… Intermediate program representation.
Advertisements

SSA and CPS CS153: Compilers Greg Morrisett. Monadic Form vs CFGs Consider CFG available exp. analysis: statement gen's kill's x:=v 1 p v 2 x:=v 1 p v.
Intermediate Code Generation
ECOE 560 Design Methodologies and Tools for Software/Hardware Systems Spring 2004 Serdar Taşıran.
Combinational Logic.
Compilation 2011 Static Analysis Johnni Winther Michael I. Schwartzbach Aarhus University.
Intermediate Code Generation. 2 Intermediate languages Declarations Expressions Statements.
Control-Flow Graphs & Dataflow Analysis CS153: Compilers Greg Morrisett.
Analysis of programs with pointers. Simple example What are the dependences in this program? Problem: just looking at variable names will not give you.
Data-Flow Analysis Framework Domain – What kind of solution is the analysis looking for? Ex. Variables have not yet been defined – Algorithm assigns a.
CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
Some Properties of SSA Mooly Sagiv. Outline Why is it called Static Single Assignment form What does it buy us? How much does it cost us? Open questions.
Chapter 10 Code Optimization. A main goal is to achieve a better performance Front End Code Gen Intermediate Code source Code target Code user Machine-
Loop invariant code removal CS 480. Our sample calculation for i := 1 to n for j := 1 to m c [i, j] := 0 for k := 1 to p c[i, j] := c[i, j] + a[i, k]
8 Intermediate code generation
Lecture # 21 Chapter 6 Uptill 6.4. Type System A type system is a collection of rules for assigning type expressions to the various parts of the program.
UPPAAL Andreas Hadiyono Arrummaisha Adrifina Harya Iswara Aditya Wibowo Juwita Utami Putri.
Components of representation Control dependencies: sequencing of operations –evaluation of if & then –side-effects of statements occur in right order Data.
Program Representations. Representing programs Goals.
CS412/413 Introduction to Compilers Radu Rugina Lecture 16: Efficient Translation to Low IR 25 Feb 02.
CSE 331 SOFTWARE DESIGN & IMPLEMENTATION TESTING II Autumn 2011.
Early Global Program Optimizations Chapter Mooly Sagiv.
Representing programs Goals. Representing programs Primary goals –analysis is easy and effective just a few cases to handle directly link related things.
Recap from last time Saw several examples of optimizations –Constant folding –Constant Prop –Copy Prop –Common Sub-expression Elim –Partial Redundancy.
1 Intermediate representation Goals: –encode knowledge about the program –facilitate analysis –facilitate retargeting –facilitate optimization scanning.
Global optimization. Data flow analysis To generate better code, need to examine definitions and uses of variables beyond basic blocks. With use- definition.
Administrative info Subscribe to the class mailing list –instructions are on the class web page, which is accessible from my home page, which is accessible.
A High Performance Application Representation for Reconfigurable Systems Wenrui GongGang WangRyan Kastner Department of Electrical and Computer Engineering.
Validating High-Level Synthesis Sudipta Kundu, Sorin Lerner, Rajesh Gupta Department of Computer Science and Engineering, University of California, San.
Transformation of Java Card into Diet Java Semester Project Presentation Erich Laube.
Recap from last time: live variables x := 5 y := x + 2 x := x + 1 y := x y...
Global optimization. Data flow analysis To generate better code, need to examine definitions and uses of variables beyond basic blocks. With use- definition.
Direction of analysis Although constraints are not directional, flow functions are All flow functions we have seen so far are in the forward direction.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
Precision Going back to constant prop, in what cases would we lose precision?
Abstract Interpretation (Cousot, Cousot 1977) also known as Data-Flow Analysis.
Imperative Programming
Introduction to Software Testing Chapter 2.3 Graph Coverage for Source Code Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Adapted from Prof. Necula UCB CS 1641 Overview of COOL ICOM 4029 Lecture 2 ICOM 4029 Fall 2008.
Chapter 6 Programming Languages (2) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
“Software” Esterel Execution (work in progress) Dumitru POTOP-BUTUCARU Ecole des Mines de Paris
Predicate Abstraction of ANSI-C Programs Using SAT By Edmund Clarke, Daniel Kroening, Natalia Sharygina, Karen Yorav Presented by Yunho Kim Provable Software.
White-box Testing.
Compiler Principles Fall Compiler Principles Lecture 0: Local Optimizations Roman Manevich Ben-Gurion University.
Introduction to Software Testing Chapter 2.3 Graph Coverage for Source Code Paul Ammann & Jeff Offutt
1 Control Flow Analysis Topic today Representation and Analysis Paper (Sections 1, 2) For next class: Read Representation and Analysis Paper (Section 3)
Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.
Principle of Programming Lanugages 3: Compilation of statements Statements in C Assertion Hoare logic Department of Information Science and Engineering.
CS412/413 Introduction to Compilers Radu Rugina Lecture 18: Control Flow Graphs 29 Feb 02.
1 Control Flow Graphs. 2 Optimizations Code transformations to improve program –Mainly: improve execution time –Also: reduce program size Can be done.
1 Graph Coverage (3). Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Section 2.2 ◦ Section
CSI 3125, Preliminaries, page 1 Control Statements.
/ PSWLAB Evidence-Based Analysis and Inferring Preconditions for Bug Detection By D. Brand, M. Buss, V. C. Sreedhar published in ICSM 2007.
White-Box Testing Statement coverage Branch coverage Path coverage
Credible Compilation With Pointers Martin Rinard and Darko Marinov Laboratory for Computer Science Massachusetts Institute of Technology.
Phoenix Based Dynamic Slicing Debugging Tool Eric Cheng Lin Xu Matt Gruskin Ravi Ramaseshan Microsoft Phoenix Intern Team (Summer '06)
Code Optimization.
Software Testing.
Weakest Precondition of Unstructured Programs
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Structural testing, Path Testing
Program Slicing Baishakhi Ray University of Virginia
Software Testing (Lecture 11-a)
null, true, and false are also reserved.
Sudipto Ghosh CS 406 Fall 99 November 16, 1999
Intermediate Code Generation
Paul Ammann & Jeff Offutt
Review: What is an activation record?
Intermediate Code Generating machine-independent intermediate form.
Presentation transcript:

Compositional correctness of IP-based system design: Translating C/C++ Models into SIGNAL Processes Rennes, November 04, 2005 Hamoudi Kalla and Jean-Pierre Talpin Espresso Team

2 Outline Introduction Preliminaries Translating C/C++ Models into SIGNAL Processes  Principles  Example  Implementation Conclusion and Future works

3  Simulators and test tools  They may not cover all design errors  We need formal verification to ensure the quality of system designs  we need formal models C/C++ System Design Validation Introduction

4 System Design Validation Using Formal Models Our Methodology C/C++ Models Formal Models : SIGNAL processes automatic translation

5 Control Data-Flow Graph (CDFG) Single Statement Assignment (SSA) Preliminaries

6  Represents a procedure or a program as a directed graph G=(V, E), where the set V represents control flow nodes and E represents jumps in the control flow  Control Flow nodes are Basic blocks, Test blocks, and Join Blocks Control Data Flow Graph

7 int example(int a, int b, int c) { int x, y, z, result; y = a * b; z = a * c; if (y>z) x = y – z; else x = z – y; result = x * a; return result; } Preliminaries Control Data Flow Graph: Nodes C/C++ program CDFG

8  Basic Blocks (BB) are instructions without any jumps.  Test blocks (T) describe conditional branching expressions.  Join blocks (J) represent the end of conditional branches. Preliminaries Control Data Flow Graph: Nodes CDFG

9  SSA is a form of Control Data Flow Graph that allows optimizations to be done efficiently and easily  In SSA, every variable receives exactly one assignment during its lifetime Preliminaries Single Statement Assignment (SSA) Form … x = a * b; x = a * c; … x1 = a * b; x2 = a * c; … SSA

10 Control Data Flow Graph its associated Static Single Assignment form Preliminaries Single Statement Assignment (SSA) Form New function

11 Translating C/C++ Models into SIGNAL Processes C/C++ Models SIGNAL processes SSA Form GCC ?

12 Translating C/C++ Models into SIGNAL Processes C/C++ Models SIGNAL processes GCC f 1, …, f n functions f 1  SSA 1 f n  SSA n SSA 1  process 1 SSA n  process n … … … ?

13 Translating C/C++ Models into SIGNAL Processes Function f (SSA) Process f (SIGNAL) Encode nodes, edges, assignment statement, conditional branching, and Ф function Principle

14 Encoding SSA Nodes (blocks) Translating C/C++ Models into SIGNAL Processes Boolean BB1, T2, BB2, BB3, J1, BB4; x t1 t2 t3 t4 t5 … BB1 true false false false false … T2 false true false false false … BB2 false false true false false … BB3 false false false true false … J1 false false false false true … BB4 false false false false true … t1 t2 t3 t4 t5 … BB1 true false false false false … T2 false true false false false … BB2 false false true false false … BB3 false false false true false … J1 false false false false true … BB4 false false false false true … Instants blocks

15 Translating C/C++ Models into SIGNAL Processes B1 B2 | B2 : = true when pre_B1 default false | pre_B1 : = B1$ init false t1 t2 t3 t4 t5 … B1 true false false false false … pre_B1 false true false false false … B2 false true false false false … t1 t2 t3 t4 t5 … B1 true false false false false … pre_B1 false true false false false … B2 false true false false false … Encoding SSA Edges : for Basic and Test blocks

16 Translating C/C++ Models into SIGNAL Processes Encoding SSA Edges : for Join blocks J1 B1 | J1 : = true when pre_B1 default true when pre_B2 default false t1 t2 t3 t4 t5 … pre_B2 false true false false false … pre_B1 false false false false false … J1 false false true false false … t1 t2 t3 t4 t5 … pre_B2 false true false false false … pre_B1 false false false false false … J1 false false true false false … B2

17 Translating C/C++ Models into SIGNAL Processes Encoding Assignment Statement t1 t2 t3 t4 t5 … B1 false true false false false false … Pre_B1 false false true false false false … x … y … z … t1 t2 t3 t4 t5 … B1 false true false false false false … Pre_B1 false false true false false false … x … y … z … X1 = y1 + z1 B1 | x1 : = ( y1 + z1 ) when B1 default x1$

18 Translating C/C++ Models into SIGNAL Processes Encoding Conditional Branching Statement If (x>y) goto B1; else goto B2; If (x>y) goto B1; else goto B2; T1 B1 | test1 : = (x>y) when T1default false | pre_test1 : = test1$ init false t1 t2 t3 t4 t5 … T1 false true false false false … pre_T1 false false true false false … Test1 false true false false false … pre_test1 false false true false false … B1 false false true false false … B2 false false false false false … t1 t2 t3 t4 t5 … T1 false true false false false … pre_T1 false false true false false … Test1 false true false false false … pre_test1 false false true false false … B1 false false true false false … B2 false false false false false … B2 | B1 : = true when pre_test1 when pre_T1 default false | B2 : = true when not pre_test1 when pre_T1 default false

19 Translating C/C++ Models into SIGNAL Processes Encoding Ф Function X3 = Ф(x1,x2) J1 B1 | x3 : = x1 when pre_B1 default x2 X1 = … X2 = … B2 Y = x3 + … B3

20 Translating C/C++ Models into SIGNAL Processes Encoding Loop Statement : Blocks If (x>y) goto B1; else goto B2; If (x>y) goto B1; else goto B2; T1 B2 | test1 : = (x>y) when T1default false | pre_test1 : = test1$ init false … … … … B1 … … B0 … … J1 | T1 : = true when pre_B0 default true when pre_B1 default false | B1 : = true when pre_test1 when pre_T1 default false | B2 : = true when not pre_test1 when pre_T1 default false

21 Translating C/C++ Models into SIGNAL Processes Encoding Loop Statement : statements If (i2<10) goto B1; else goto B2; If (i2<10) goto B1; else goto B2; T1 B2 | i1 : = 1 when B0 default i1$ … … i3 := i2 + 1 B1 i1 := 1 B0 i2 := Ф(i1,i3) J1 | i2 : = i1 when pre_B0 default i3 | i3 : = i2$ +1 when pre_B1 default i3$

22 Translating C/C++ Models into SIGNAL Processes Encoding pointers (1) x = 10; if (T) p = &x ; else p = &y ; z = *p; SSA If (T) goto B1; else goto B2; If (T) goto B1; else goto B2; T1 B1 p1 = &x p2 = &y B2 X = 10 B0 p3 = Ф(p1,p2) J1 z = *p3 B3 Signal p = (p_tag,p_star) p_tag = 0  p = &x p_start = x p_tag = 1  p = &y p_start = y

23 Translating C/C++ Models into SIGNAL Processes Encoding pointers (2) If (T) goto B1; else goto B2; If (T) goto B1; else goto B2; T1 B1 p1 = &x p2 = &y B2 X = 10 B0 p3 = Ф(p1,p2) J1 z = *p3 B3 p1 = (p1_tag,p1_star) p1_tag = 0  p1 = &x p1_star = x p2 = (p2_tag,p2_star) p2_tag = 1  p2 = &y p2_star = y p3 = (p3_tag,p3_star) p3_tag = p1_tag U p2_tag p3_star = Ф (p1_start,p2_star) | z : = p3_start when B3 | p3_star : = x when (p3_tag=0) default y when (p3_tag=1)

24 Translating C/C++ Models into SIGNAL Processes Implementation

25  A methodology to validate C/C++ system design :  Extend this work in order to: encode arrays, pointers and functions calls, remove global synchronisation, reduce the number of variables/signals. it automatically creates formal models from C/C++ system models, it is based on the internal representation SSA of GCC and uses the synchronous language SIGNAL as a formal platform. Conclusion and Future Works