slide: 1 copyright © 2009 adacore geneauto for ada and spark a verifying model compiler geneauto2...

11
Slide: 1 Copyright © 2009 AdaCore GeneAuto for Ada and SPARK A verifying model compiler GeneAuto2 meeting (Toulouse) September 2009 Matteo Bordin [email protected] Franco Gasperoni [email protected]

Upload: prosper-moore

Post on 04-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Slide: 1 Copyright © 2009 AdaCore GeneAuto for Ada and SPARK A verifying model compiler GeneAuto2 meeting (Toulouse) September 2009 Matteo Bordin bordin@adacore.com

Slide: 1 Copyright © 2009 AdaCore

GeneAuto for Ada and SPARK

A verifying model compiler

GeneAuto2 meeting (Toulouse)

September 2009

Matteo [email protected]

Franco [email protected]

Page 2: Slide: 1 Copyright © 2009 AdaCore GeneAuto for Ada and SPARK A verifying model compiler GeneAuto2 meeting (Toulouse) September 2009 Matteo Bordin bordin@adacore.com

Slide: 2 Copyright © 2009 AdaCore

Model Compilers: State-of-the-Art

• Traditional model compiler

– Rarely added value (model = graphical coding)

• Properties verifiable at model level

– Show they hold at source level: qualified code generator

– Show they hold in the executable: compiler qualification kit

– Assume they are respected during execution

• Properties non-verifiable at model level

– Platform-dependent properties (overflows, stack size, wcet, …)

– No feedback in the model

Page 3: Slide: 1 Copyright © 2009 AdaCore GeneAuto for Ada and SPARK A verifying model compiler GeneAuto2 meeting (Toulouse) September 2009 Matteo Bordin bordin@adacore.com

Slide: 3 Copyright © 2009 AdaCore

Verifying Model Compilers: High-level Vision

• Properties for an intermediate representation

– Formal semantics

– Executable semantics

– Show properties are formally preserved

– Complement V&V activities

• Our first experiment: Simulink

– Need open technology to rely on: GeneAuto

– Emphasis on the intermediate representation for:

– Correctness (property preservation + complement V&V)

– Efficiency

– Traceability (modelsource & sourceobject)

Page 4: Slide: 1 Copyright © 2009 AdaCore GeneAuto for Ada and SPARK A verifying model compiler GeneAuto2 meeting (Toulouse) September 2009 Matteo Bordin bordin@adacore.com

Slide: 4 Copyright © 2009 AdaCore

SPARK: target language of GeneAuto/Ada

package My_Block

--# own Input_Ports, Output_Ports, Is_Initialized;

is

procedure Initialize;

--# global out Is_Initialized;

--# post Is_Initialized;

procedure Pass_Data (D : Data);

--# global out Input_Ports;

--# pre Is_Initialized;

--# derives Input_Ports from D;

procedure Compute;

--# global in Input_Ports; out Output_Ports;

--# pre Is_Initialized;

--# derives Output_Ports from Input_Ports;

Data/Information flow contractStatically proved pre/post condition

Require the Block to be initialized

State that the value of input ports depends from the parameter D

Page 5: Slide: 1 Copyright © 2009 AdaCore GeneAuto for Ada and SPARK A verifying model compiler GeneAuto2 meeting (Toulouse) September 2009 Matteo Bordin bordin@adacore.com

Slide: 5 Copyright © 2009 AdaCore

GeneAuto/Ada: a Verifying Model Compiler (I)

• What we can formally prove with SPARK

– Absence of run-time errors:

– Overflows, underflows

– Array-out-of-bounds

– Data/Information flow errors (uninitialized variables, ineffective

statements, …)

– Partial correctness

– Hoare-like pre/post conditions

• Major advantages:– Model translation is formally void of errors

– The formal representation (in SPARK) is executable and efficient

Page 6: Slide: 1 Copyright © 2009 AdaCore GeneAuto for Ada and SPARK A verifying model compiler GeneAuto2 meeting (Toulouse) September 2009 Matteo Bordin bordin@adacore.com

Slide: 6 Copyright © 2009 AdaCore

GeneAuto/Ada: a Verifying Model Compiler (II)

AdaAdaSPARK

GeneAuto/Ada

Model

Model

Object Code

GNAT Pro Ada

SPARK Pro

Use SPARK as an intermediate representationADDED VALUE: Complement model-level V&V by

automated source code analysis

GNAT Stack

Round-trip of analysis results

VIRTUAL

Page 7: Slide: 1 Copyright © 2009 AdaCore GeneAuto for Ada and SPARK A verifying model compiler GeneAuto2 meeting (Toulouse) September 2009 Matteo Bordin bordin@adacore.com

Slide: 7 Copyright © 2009 AdaCore

A typical day in GeneAuto/Ada…

This is the C code we generate: how would the SPARK version look like?

Yep, you’re right. We discovered:- A problem in GeneAuto requirements- A problem in GeneAuto implementation- A limit in model-level verification

This is the corresponding SPARK code. I’ve found:- Possible source of overflow- Unused parameters- Access to uninitialized variables- …

Page 8: Slide: 1 Copyright © 2009 AdaCore GeneAuto for Ada and SPARK A verifying model compiler GeneAuto2 meeting (Toulouse) September 2009 Matteo Bordin bordin@adacore.com

Slide: 8 Copyright © 2009 AdaCore

Qualifying GeneAuto/Ada

• We considered OpenOffice… for almost 3 full minutes…

• We needed:

– Agile framework supporting distributed artifacts manipulation

– Easy revision control (at least 4 developers)

– Tracking of:

– Actions!

– Approved requirements

– Implemented requirements

– Open questions

– Traceability evidence

Page 9: Slide: 1 Copyright © 2009 AdaCore GeneAuto for Ada and SPARK A verifying model compiler GeneAuto2 meeting (Toulouse) September 2009 Matteo Bordin bordin@adacore.com

Slide: 9 Copyright © 2009 AdaCore

FitNesse: a Prototypal Qualifying Machine

• A qualifying machine:

– Infrastructure keeping track of each atomic action

– Analyze artifacts deployment/history to discover:

– Workflow was (not) followed

– Traceability problems

– Agile user interface (possibly web-based)

• Our current choice: FitNesse

– A tool for test-driven development (agile paradigm)

– Slightly modified to better fit our needs

Page 10: Slide: 1 Copyright © 2009 AdaCore GeneAuto for Ada and SPARK A verifying model compiler GeneAuto2 meeting (Toulouse) September 2009 Matteo Bordin bordin@adacore.com

Slide: 10 Copyright © 2009 AdaCore

FitNesse: a Prototypal Qualifying Machine (II)

Artifact Editing &Action tracking

Managing Open Questions

Page 11: Slide: 1 Copyright © 2009 AdaCore GeneAuto for Ada and SPARK A verifying model compiler GeneAuto2 meeting (Toulouse) September 2009 Matteo Bordin bordin@adacore.com

Slide: 11 Copyright © 2009 AdaCore

Future Directions

• Increase the number of supported blocks

• Pursuing the verifying model compiler vision

• Investigate integration with UML, SysML, MARTE/AADL

• Improve qualifying machine

• Opening the project: Open-DO

• Business model (OPEES)