<<

Model-Based Design Early Verification andValidationin The MathWorks Technical Marketing Amory Wakefield ®

© 2008 The MathWorks, Inc. ® ® ®

Introductions

I spend most of my time:

A. Creating specifications and requirements ( and )

B. Implementation based on specification and requirements created by somebody else (generating, writing, deploying, debugging code)

C. Both

D. None of the above

2 ® ®

Address the Entire Development Process

RequirementsRequirements

Design V&V Requirements Validation Environment Robustness Testing Modeling Standards Checking

Physical Components Component V&V Algorithms Design Verification Model Testing G e H t e Coverage and Test Generation G a a n e nd r e n - e r Property Proving e n a ra t te e e G Code Verification Digital Embedded Code Correctness Electronics Software Processor-In-The Loop Testing VHDL, Verilog C, C++

FPGA ASIC MCU DSP Integration Testing Software Integration Testing Integration Hardware-in-the-Loop Testing Hardware Connectivity Implement

3 ® ®

Methods for Verification and Validation

ƒ Traceability ƒ Requirements to model and code ƒ Model to code ƒ Modeling and Coding Standards ƒ Modeling standards checking ƒ Coding standards checking ƒ Testing ƒ Model testing in simulation ƒ Processor-in-the-loop ƒ Proving ƒ Proving design properties ƒ Proving code correctness

4 ® ®

Increasing Confidence in Your Designs Confidence

Traceability Modeling and Coding Model and Code Proving Design Standards Checking Testing Properties and Code Correctness Verification Method

5 ® ®

Traceability System V&V Comp. V&V Integration Functional Requirements

Design

Environment

Physical Components ƒTracing RequirementsÙModel Simulink Verification and Validation Algorithms

H G e ƒTracing ModelÙSource Code G an t e e d a n ne - r e ra e r t n a e t Real-Time Workshop Embedded Coder e e G

Digital Embedded Electronics Software ƒTracing RequirementsÙSource Code VHDL, Verilog C, C++ Simulink Verification and Validation

FPGA ASIC MCU DSP

Integration Implement

6 ® ®

Tracing RequirementsÙModel System V&V Comp. V&V Simulink Verification and Validation Integration ƒ Creating links between text documents and model objects

7 ® ®

Tracing RequirementsÙSource Code System V&V Comp. V&V Simulink Verification and Validation Integration Real-Time Workshop Embedded Coder ƒ Including requirements in the generated source code

8 ® ®

Requirements Traceability—Overview System V&V Comp. V&V Simulink Verification and Validation Integration

ƒ Bidirectional linking with external documents ƒ For Simulink and Stateflow ƒ Extensibility API ƒ Report generation ƒ DOORS integration ƒ Linking with read-only requirement documents ƒ Real-Time Workshop Telelogic DOORS Microsoft Word Embedded Coder integration Microsoft Excel ƒ Embeds requirements as PDF comments in source code HTML Text Supported document formats 9 ® ®

Modeling and Coding Standards System V&V Comp. V&V Coding Standards Integration Modeling Standards

Design

Environment

Physical Components ƒ Modeling Standards Checking Simulink Verification and Validation Algorithms

H G e G an t e e d a n ne - r e ra e r t n a e t e e G Digital Embedded ƒ Coding Standards Checking Electronics Software PolySpaceTM Client for C/C++ VHDL, Verilog C, C++

FPGA ASIC MCU DSP

Integration Implement

10 ® ®

Simulink Model Advisor Model Checking ƒ Enforce modeling best practices ƒ Detect and troubleshoot modeling and code generation issues ƒ Check models for (a subset of) known version upgrade issues

ƒ Automated report is a useful process audit document: ƒ More detailed summary ƒ Valid check states: Pass, Fail, Warning, and Not Run

11 ® ®

Modeling Standards Checking Simulink Verification and Validation

ƒ Static analysis of models for ƒ Requirement consistency ƒ Custom checks for company- specific processes ƒ Standards ƒ MAAB Style Guidelines ƒ DO-178B ƒ IEC 61508 ƒ Custom – using extensibility API

ƒ Benefits ƒ Prevent problems early in the design process ƒ Automate time consuming review work

12 ® ®

MAAB Style Guide Checks

ƒ MathWorks Automotive Advisory Board (MAAB)

ƒ Consistency ƒ Interoperability ƒ Error prevention ƒ Knowledge sharing

13 ® ®

IEC 61508 Modeling Standards Checks

This Absolute Value This Relational Operator block is block is operating on not outputting a Boolean data type an unsigned value which may lead to unpredictable which could result in results in the generated code. unreachable code.

14 ® ®

Coding Standards Checking System V&V Comp. V&V PolySpace Client for C/C++ Integration

ƒ Configure rules and run as part of the static check of the C source code

ƒ MISRA-C:2004 ƒ Covers 122/142 rules ƒ 102 fully supported ƒ 20 partially supported

15 ® ®

Testing System V&V Comp. V&V Integration Functional Requirements

Design ƒModel Testing Environment ƒSystemTest ƒSimulink Verification and Validation Physical Components ƒSimulink Design Verifier Algorithms Verify that design meets

H G requirements e G an t e e d a n ne - r e ra e r t n a e t e e G ƒCode Testing Digital Embedded ƒReal-Time Workshop Electronics Software Embedded Coder VHDL, Verilog C, C++ ƒEmbedded IDE Link products FPGA ASIC MCU DSP ƒTarget Support Package products Integration Verify that the behavior of source code and object code Implement matches the model

16 ® ®

Demo

ƒ Model testing using test cases stored in Excel

17 ® ®

Improving Test Suite System V&V Comp. V&V Simulink Design Verifier Integration

ƒ Generating tests to reach coverage criteria

Test Generation

Test generation harness with the copy of the original model Test inputs that ensure complete coverage

18 ® ®

Code Testing with Generated Signals Simulink ƒ Software-in-the-loop ƒ On the host ƒ Processor-in-the-loop ƒ On the target processor

ƒ Independent code testing environment ƒ Generated signals and model outputs are saved as a .mat data file ƒ Exported input signals drive code tests ƒ Exported model outputs become expectation values for code testing

19 ® ®

Proving System V&V Comp. V&V Integration RequirementsRequirements

Design

Environment

Physical Components ƒ Proving Design Properties Simulink Design Verifier Algorithms Prove that design meets

H G a e G n t e the key functional e d a n ne - r e ra e r t n a e t e e requirements G

Digital Embedded Electronics Software ƒ Proving Code Correctness VHDL, Verilog C, C++ PolySpace Server for C/C++

FPGA ASIC MCU DSP Prove that code meets non-functional runtime Integration requirements Implement

20 ® ®

Proving Properties – Workflows System V&V Comp. V&V Simulink Design Verifier Integration

1. Authoring ƒ Benefits ƒ Highly Iterative ƒ Leads to precise definition of low ƒ Leads to improvement in level functional requirements design and in specifications ƒ Once established, properties 2. Execution and Reporting represent a model of design behavior ƒ Automated ƒ Minimizes chance of implementing ƒ Part of the regression undesired behavior testing harness

21 ® ®

Proving Code Correctness System V&V Comp. V&V Integration Requirements Requirements

Design ƒ Verifying code integration Environment ƒ Certification requirements Physical Components ƒ Reliability concerns

Algorithms

G e t e a n r e e r - e n a d t e t a e n r G a e H n e Digital Embedded G Electronics Software ƒ Proving Code Correctness VHDL, Verilog C, C++ PolySpace Server for C/C++ FPGA ASIC MCU DSP

Integration Implement

22 ® ®

Code Correctness Formal method: Abstract Interpretation

Green Green reliable reliable P r o Red Green v e faulty reliable n Grey dead Green Orange reliable unproven

Results are proven for all possible executions of the code!! 24 ® ®

Summary

ƒ Model-Based Design enables early verification and validation

ƒ Early verification and validation methods improve and optimize your existing development process

ƒ Early problem detection significantly reduces time spent debugging – shorter time to resolution

25