SlideShare una empresa de Scribd logo
1 de 32
QGen: Simulink® static verification 
and code generation 
Presented by 
Matteo Bordin 
bordin@adacore.com
What is QGen? 
A qualifiable and customizable code generator from 
Simulink® and Stateflow® to SPARK and MISRA C 
A formal model verifier for runtime errors and functional properties 
An extendable framework to integrate heterogeneous models
Main features 1/2 
Support for a large subset of Simulink® 
Around 120 blocks, optional checks for MISRA Simulink® 
Stateflow® support expected in Spring 2015 
Code generation for SPARK and MISRA C 
Readable and traceable code, no performance penalty 
Ships with static model verifier 
Run-time errors (divisions by zero, overflows, …) 
Logical errors (dead execution paths) 
Functional properties (Simulink® assertions blocks)
Main features 2/2 
Off-the-shelf qualification material 
Including validation against Simulink® simulation 
DO-178C, EN 50128, ISO-26262 TCL3 
Highly tunable thanks to visible intermediate representation 
“Plug-and-play” transformations using Eclipse tools or XML manipulation 
Optimized code generation 
Generation of additional artifacts: Makefiles, docs, metrics, … 
Integrating with UML/SysML/AADL or in house DSLs
Product development history 1/2 
France and EU -funded collaborative R&D project 
From October 2011 to October 2015 
10M Euros total budget 
19 Partners 
Leader: Continental Automotive France
Product development history 2/2
How does QGen work? 1/2 
Simulink® model 
importer 
QGen intermediate representation (EMF metamodel) 
SPARK & MISRA C 
code generator 
model verifier
How does QGen work? 2/2 
Integrated in Matlab® (ideal for everyday use) 
From command line (does not require Matlab®, ideal for regression testing) 
qgenc MyModel.mdl [code-generation-options]
QGen and DO-178 
DO-330 (Tool Qualification Document) 
Precise identification of certification credit for code generator qualification 
Identification of credit w.r.t qualification strategy (TQL1 vs TQL5)
Using QGen - Verification 
Simulink® model 
QGen intermediate representation 
Verification 
Formalism 
importer 
model verifier 
Verification results 
round-trip 
Advanced 
+ 
traceability data 
*already qualified as part of a DO-178 Verification Tool / TQL5 
Verification 
Engine*
Using QGen - finding bugs 
No defensive modeling against division by zero
Using QGen - verifying functional properties 
ON OFF 
TRUE ERROR OK 
FALSE OK OK 
Brake OR 
Clutch 
Cruise Control 
The Cruise Control shall never be ON after 
the driver pushed the Brake or clutch pedal
Using QGen - verifying functional properties 
Formalization of safety property 
System implementation 
The Cruise Control shall never be ON after 
the driver pushed the Brake or clutch pedal
Using QGen - mixing proof & test 
Integration of legacy code via S-Function blocks 
How to prove the complete system (model + legacy code) is safe? 
How to extract model-relevant properties from legacy code? 
S-Functions written in C 
Difficult to automatically extract information 
Source code may not be available 
Rely on design-by-contact 
Wrap C code in automatically generated Ada stubs 
Decorate Ada stubs using pre/post conditions 
Rely on pre/post conditions for model verification 
Test C code against pre/post conditions
Using QGen - mixing proof & test 
S-Function written in C
Using QGen - mixing proof & test 
Availability of Static Analysis 
C S-Function Incomplete Model Static Analys 
C S-Function with Ada 2012 wrapper 
(design by contract) 
Static Analysis for Model 
Test for S-Function 
Ada S-Function 
Static Analysis on both Model 
and Source code 
Static Analysis holds for both 
C and Ada code generation!
Using QGen - Code Generation
Using QGen - Code Generation 
Standard code generation 
One file for every atomic subsystem 
Variables are global (in .adb/.c files) 
Full inlining, to increase performances 
A single file for the entire system 
All function calls are inlined 
Less memory consumption, less memory copy, more optimization 
Wrapping to reuse code with different I/O 
Corresponds to Simulink “generate reusable code” 
Pass persistent state and I/O as formal parameters 
Allows reusing the same code for multiple I/O data
QGen - an open and extensible framework 
Simulink Model 
Black Box 
Source Code 
Source Code 
Traditional Code Generators 
Simulink Model 
Access to intermediate representations 
Makefile 
generation 
Processor 
customization 
Modeling standard 
checking 
Additional 
verification 
Integration with UML 
Extract traceability 
data
Customizing QGen: use case 1 
A new processor is adopted, which provides intrinsic optimized functions 
Ex.: saturated sum 
How to reuse existing models? 
While benefitting from new processor functionalities? 
Relying on S-Functions requires changing them 
And potentially re-execute some verification activities! 
We rather change the code generator!
Customizing QGen: use case 1 
Exploit process-specific instructions 
… 
-- inlined code for saturated sum 
tmp := a + b; 
if tmp > Int16’Last then 
out := Int16’Last; 
elsif tmp < Int16’First then 
out := Int16’First; 
else 
out := tmp; 
end if; 
… 
… 
-- use processor-specific lib 
out := zaddwss (a, b); 
…
Customizing QGen: use case 1 
Intermediate 
representation 1 
Intermediate 
representation 2 
Intermediate 
representation 3 
Intermediate 
representation 4 
Intermediate 
representation 5 
Intermediate 
representation 6 
Source Code 
>> qgenc myModel.mdl —steps psgdxe 
>> python custom_saturate.py myModel_x.xmi 
>> qgenc myModel_x.xmi —language ada 
ECore-compliant 
XMI 
Python Script 
(150 SLOC)
Customizing QGen: use case 2 
Communication between control engineers and software architects 
Simulink models hide information relevant for software architecture 
Execution rates, data flow constraints, … 
How can this information be communicated to a software architect? 
Extraction of architectural concerns from Simulink model 
Extract AADL model out of Simulink 
Can be used to produce allocation models 
Can be used to execute real-time analysis
Customizing QGen: use case 2 
Intermediate 
representation 1 
ECore-compliant 
XMI 
Acceleo / ATL 
transformation 
>> qgen myModel.mdl —steps pe 
Extraction of real-time architectural constraints 
by generating an AADL model
QGen: roadmap 
2013 - 2014 
End of 2014 
February 2015 
Spring 2015 
Q4 2015 
evaluation by project P partners 
first selected customer pre-release 
QGen 1.0 available 
Stateflow® support 
full qualification material 
In the pipeline: static stack analysis, AUTOSAR, …
QGEN is the open, tunable and qualifiable 
model verifier and code generator 
for Simulink® and Stateflow® 
pre-release for selected customers: Q4 2014 
version 1.0: February 2015
QGen: Simulink® static verification 
and code generation 
Presented by 
Matteo Bordin 
bordin@adacore.com

Más contenido relacionado

La actualidad más candente

System verilog verification building blocks
System verilog verification building blocksSystem verilog verification building blocks
System verilog verification building blocks
Nirav Desai
 
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
Sung Kim
 
Flink Forward San Francisco 2019: Managing Flink on Kubernetes - FlinkK8sOper...
Flink Forward San Francisco 2019: Managing Flink on Kubernetes - FlinkK8sOper...Flink Forward San Francisco 2019: Managing Flink on Kubernetes - FlinkK8sOper...
Flink Forward San Francisco 2019: Managing Flink on Kubernetes - FlinkK8sOper...
Flink Forward
 

La actualidad más candente (20)

NIWeek 2017 - Automated Test of LabVIEW FPGA Code: CI and Jenkins 2 Pipelines
NIWeek 2017 - Automated Test of LabVIEW FPGA Code: CI and Jenkins 2 PipelinesNIWeek 2017 - Automated Test of LabVIEW FPGA Code: CI and Jenkins 2 Pipelines
NIWeek 2017 - Automated Test of LabVIEW FPGA Code: CI and Jenkins 2 Pipelines
 
Software Engineering - RS2
Software Engineering - RS2Software Engineering - RS2
Software Engineering - RS2
 
Randomization and Constraints - Workshop at BMS College
Randomization and Constraints - Workshop at BMS CollegeRandomization and Constraints - Workshop at BMS College
Randomization and Constraints - Workshop at BMS College
 
JedaOverview
JedaOverviewJedaOverview
JedaOverview
 
System verilog verification building blocks
System verilog verification building blocksSystem verilog verification building blocks
System verilog verification building blocks
 
Testing 1, 2, 3, ...
Testing 1, 2, 3, ... Testing 1, 2, 3, ...
Testing 1, 2, 3, ...
 
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
 
Android Test Driven Development & Android Unit Testing
Android Test Driven Development & Android Unit TestingAndroid Test Driven Development & Android Unit Testing
Android Test Driven Development & Android Unit Testing
 
H S
H SH S
H S
 
CPU Verification
CPU VerificationCPU Verification
CPU Verification
 
Tutor1
Tutor1Tutor1
Tutor1
 
Bag it Tag It Put it : Project Tracking One Click away
Bag it Tag It Put it : Project Tracking One Click away Bag it Tag It Put it : Project Tracking One Click away
Bag it Tag It Put it : Project Tracking One Click away
 
Continuous performance: Load testing for developers with gatling @ JavaOne 2016
Continuous performance: Load testing for developers with gatling @ JavaOne 2016Continuous performance: Load testing for developers with gatling @ JavaOne 2016
Continuous performance: Load testing for developers with gatling @ JavaOne 2016
 
The_Little_Jenkinsfile_That_Could
The_Little_Jenkinsfile_That_CouldThe_Little_Jenkinsfile_That_Could
The_Little_Jenkinsfile_That_Could
 
Why system verilog ?
Why system verilog ? Why system verilog ?
Why system verilog ?
 
Basics of Functional Verification - Arrow Devices
Basics of Functional Verification - Arrow DevicesBasics of Functional Verification - Arrow Devices
Basics of Functional Verification - Arrow Devices
 
Flink Forward San Francisco 2019: Managing Flink on Kubernetes - FlinkK8sOper...
Flink Forward San Francisco 2019: Managing Flink on Kubernetes - FlinkK8sOper...Flink Forward San Francisco 2019: Managing Flink on Kubernetes - FlinkK8sOper...
Flink Forward San Francisco 2019: Managing Flink on Kubernetes - FlinkK8sOper...
 
Model Checking History
Model Checking History Model Checking History
Model Checking History
 
Bangalore march07
Bangalore march07Bangalore march07
Bangalore march07
 
Ide and datatypes vb-net-u-ii-p2
Ide and datatypes  vb-net-u-ii-p2Ide and datatypes  vb-net-u-ii-p2
Ide and datatypes vb-net-u-ii-p2
 

Similar a QGen GNAT Industrial User Day

“A Practical Guide to Getting the DNN Accuracy You Need and the Performance Y...
“A Practical Guide to Getting the DNN Accuracy You Need and the Performance Y...“A Practical Guide to Getting the DNN Accuracy You Need and the Performance Y...
“A Practical Guide to Getting the DNN Accuracy You Need and the Performance Y...
Edge AI and Vision Alliance
 
Tools for Test-Driven Product Modeling
Tools for Test-Driven Product ModelingTools for Test-Driven Product Modeling
Tools for Test-Driven Product Modeling
Tim Geisler
 
Rhapsody Software
Rhapsody SoftwareRhapsody Software
Rhapsody Software
Bill Duncan
 
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
SQUADEX
 

Similar a QGen GNAT Industrial User Day (20)

Tech Days 2015: Model Based Development with QGen
Tech Days 2015: Model Based Development with QGenTech Days 2015: Model Based Development with QGen
Tech Days 2015: Model Based Development with QGen
 
Automated Requirements-Based Testing for Medical Device Software
Automated Requirements-Based Testing for Medical Device SoftwareAutomated Requirements-Based Testing for Medical Device Software
Automated Requirements-Based Testing for Medical Device Software
 
Automated requirements based testing for ISO 26262
Automated requirements based testing for ISO 26262 Automated requirements based testing for ISO 26262
Automated requirements based testing for ISO 26262
 
“A Practical Guide to Getting the DNN Accuracy You Need and the Performance Y...
“A Practical Guide to Getting the DNN Accuracy You Need and the Performance Y...“A Practical Guide to Getting the DNN Accuracy You Need and the Performance Y...
“A Practical Guide to Getting the DNN Accuracy You Need and the Performance Y...
 
Automated Low Level Requirements Testing for DO-178C
Automated Low Level Requirements Testing for DO-178CAutomated Low Level Requirements Testing for DO-178C
Automated Low Level Requirements Testing for DO-178C
 
Automated Requirements-Based Testing for Medical Device Software.ppsx
Automated Requirements-Based Testing for Medical Device Software.ppsxAutomated Requirements-Based Testing for Medical Device Software.ppsx
Automated Requirements-Based Testing for Medical Device Software.ppsx
 
PyData Berlin 2023 - Mythical ML Pipeline.pdf
PyData Berlin 2023 - Mythical ML Pipeline.pdfPyData Berlin 2023 - Mythical ML Pipeline.pdf
PyData Berlin 2023 - Mythical ML Pipeline.pdf
 
Incquery Suite Models 2020 Conference by István Ráth, CEO of IncQuery Labs
Incquery Suite Models 2020 Conference by István Ráth, CEO of IncQuery LabsIncquery Suite Models 2020 Conference by István Ráth, CEO of IncQuery Labs
Incquery Suite Models 2020 Conference by István Ráth, CEO of IncQuery Labs
 
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech UpdateAdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
AdaCore Paris Tech Day 2016: Jose Ruiz - QGen Tech Update
 
Presentation Verification & Validation
Presentation Verification & ValidationPresentation Verification & Validation
Presentation Verification & Validation
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
 
Code Generation with MDA and xUML
Code Generation with MDA and xUMLCode Generation with MDA and xUML
Code Generation with MDA and xUML
 
Project P Open Workshop
Project P Open WorkshopProject P Open Workshop
Project P Open Workshop
 
Tools for Test-Driven Product Modeling
Tools for Test-Driven Product ModelingTools for Test-Driven Product Modeling
Tools for Test-Driven Product Modeling
 
Bounded Model Checking for C Programs in an Enterprise Environment
Bounded Model Checking for C Programs in an Enterprise EnvironmentBounded Model Checking for C Programs in an Enterprise Environment
Bounded Model Checking for C Programs in an Enterprise Environment
 
Rhapsody Software
Rhapsody SoftwareRhapsody Software
Rhapsody Software
 
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
 
Incremental Queries and Transformations for Engineering Critical Systems
Incremental Queries and Transformations for Engineering Critical SystemsIncremental Queries and Transformations for Engineering Critical Systems
Incremental Queries and Transformations for Engineering Critical Systems
 
DCEU 18: From Legacy Mainframe to the Cloud: The Finnish Railways Evolution w...
DCEU 18: From Legacy Mainframe to the Cloud: The Finnish Railways Evolution w...DCEU 18: From Legacy Mainframe to the Cloud: The Finnish Railways Evolution w...
DCEU 18: From Legacy Mainframe to the Cloud: The Finnish Railways Evolution w...
 

Último

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Último (20)

%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

QGen GNAT Industrial User Day

  • 1.
  • 2. QGen: Simulink® static verification and code generation Presented by Matteo Bordin bordin@adacore.com
  • 3. What is QGen? A qualifiable and customizable code generator from Simulink® and Stateflow® to SPARK and MISRA C A formal model verifier for runtime errors and functional properties An extendable framework to integrate heterogeneous models
  • 4. Main features 1/2 Support for a large subset of Simulink® Around 120 blocks, optional checks for MISRA Simulink® Stateflow® support expected in Spring 2015 Code generation for SPARK and MISRA C Readable and traceable code, no performance penalty Ships with static model verifier Run-time errors (divisions by zero, overflows, …) Logical errors (dead execution paths) Functional properties (Simulink® assertions blocks)
  • 5. Main features 2/2 Off-the-shelf qualification material Including validation against Simulink® simulation DO-178C, EN 50128, ISO-26262 TCL3 Highly tunable thanks to visible intermediate representation “Plug-and-play” transformations using Eclipse tools or XML manipulation Optimized code generation Generation of additional artifacts: Makefiles, docs, metrics, … Integrating with UML/SysML/AADL or in house DSLs
  • 6. Product development history 1/2 France and EU -funded collaborative R&D project From October 2011 to October 2015 10M Euros total budget 19 Partners Leader: Continental Automotive France
  • 8. How does QGen work? 1/2 Simulink® model importer QGen intermediate representation (EMF metamodel) SPARK & MISRA C code generator model verifier
  • 9. How does QGen work? 2/2 Integrated in Matlab® (ideal for everyday use) From command line (does not require Matlab®, ideal for regression testing) qgenc MyModel.mdl [code-generation-options]
  • 10. QGen and DO-178 DO-330 (Tool Qualification Document) Precise identification of certification credit for code generator qualification Identification of credit w.r.t qualification strategy (TQL1 vs TQL5)
  • 11. Using QGen - Verification Simulink® model QGen intermediate representation Verification Formalism importer model verifier Verification results round-trip Advanced + traceability data *already qualified as part of a DO-178 Verification Tool / TQL5 Verification Engine*
  • 12. Using QGen - finding bugs No defensive modeling against division by zero
  • 13.
  • 14. Using QGen - verifying functional properties ON OFF TRUE ERROR OK FALSE OK OK Brake OR Clutch Cruise Control The Cruise Control shall never be ON after the driver pushed the Brake or clutch pedal
  • 15. Using QGen - verifying functional properties Formalization of safety property System implementation The Cruise Control shall never be ON after the driver pushed the Brake or clutch pedal
  • 16.
  • 17. Using QGen - mixing proof & test Integration of legacy code via S-Function blocks How to prove the complete system (model + legacy code) is safe? How to extract model-relevant properties from legacy code? S-Functions written in C Difficult to automatically extract information Source code may not be available Rely on design-by-contact Wrap C code in automatically generated Ada stubs Decorate Ada stubs using pre/post conditions Rely on pre/post conditions for model verification Test C code against pre/post conditions
  • 18. Using QGen - mixing proof & test S-Function written in C
  • 19.
  • 20. Using QGen - mixing proof & test Availability of Static Analysis C S-Function Incomplete Model Static Analys C S-Function with Ada 2012 wrapper (design by contract) Static Analysis for Model Test for S-Function Ada S-Function Static Analysis on both Model and Source code Static Analysis holds for both C and Ada code generation!
  • 21. Using QGen - Code Generation
  • 22. Using QGen - Code Generation Standard code generation One file for every atomic subsystem Variables are global (in .adb/.c files) Full inlining, to increase performances A single file for the entire system All function calls are inlined Less memory consumption, less memory copy, more optimization Wrapping to reuse code with different I/O Corresponds to Simulink “generate reusable code” Pass persistent state and I/O as formal parameters Allows reusing the same code for multiple I/O data
  • 23.
  • 24. QGen - an open and extensible framework Simulink Model Black Box Source Code Source Code Traditional Code Generators Simulink Model Access to intermediate representations Makefile generation Processor customization Modeling standard checking Additional verification Integration with UML Extract traceability data
  • 25. Customizing QGen: use case 1 A new processor is adopted, which provides intrinsic optimized functions Ex.: saturated sum How to reuse existing models? While benefitting from new processor functionalities? Relying on S-Functions requires changing them And potentially re-execute some verification activities! We rather change the code generator!
  • 26. Customizing QGen: use case 1 Exploit process-specific instructions … -- inlined code for saturated sum tmp := a + b; if tmp > Int16’Last then out := Int16’Last; elsif tmp < Int16’First then out := Int16’First; else out := tmp; end if; … … -- use processor-specific lib out := zaddwss (a, b); …
  • 27. Customizing QGen: use case 1 Intermediate representation 1 Intermediate representation 2 Intermediate representation 3 Intermediate representation 4 Intermediate representation 5 Intermediate representation 6 Source Code >> qgenc myModel.mdl —steps psgdxe >> python custom_saturate.py myModel_x.xmi >> qgenc myModel_x.xmi —language ada ECore-compliant XMI Python Script (150 SLOC)
  • 28. Customizing QGen: use case 2 Communication between control engineers and software architects Simulink models hide information relevant for software architecture Execution rates, data flow constraints, … How can this information be communicated to a software architect? Extraction of architectural concerns from Simulink model Extract AADL model out of Simulink Can be used to produce allocation models Can be used to execute real-time analysis
  • 29. Customizing QGen: use case 2 Intermediate representation 1 ECore-compliant XMI Acceleo / ATL transformation >> qgen myModel.mdl —steps pe Extraction of real-time architectural constraints by generating an AADL model
  • 30. QGen: roadmap 2013 - 2014 End of 2014 February 2015 Spring 2015 Q4 2015 evaluation by project P partners first selected customer pre-release QGen 1.0 available Stateflow® support full qualification material In the pipeline: static stack analysis, AUTOSAR, …
  • 31. QGEN is the open, tunable and qualifiable model verifier and code generator for Simulink® and Stateflow® pre-release for selected customers: Q4 2014 version 1.0: February 2015
  • 32. QGen: Simulink® static verification and code generation Presented by Matteo Bordin bordin@adacore.com