• 検索結果がありません。

MATLAB EXPO 2014 Dry Run 0 モデル検証&Polyspace

N/A
N/A
Protected

Academic year: 2021

シェア "MATLAB EXPO 2014 Dry Run 0 モデル検証&Polyspace"

Copied!
19
0
0

読み込み中.... (全文を見る)

全文

(1)

Polyspace

®

によるソフト不具合修正の

フロントローディング

MathWorks Japan

Application Engineering ・ アプリケーションエンジニアリング部

Application Engineer ・ アプリケーションエンジニア

Fred Noto ・ 能戸 フレッド

(2)

Polyspaceの静的解析ソリューション

コーディングルール

バグ検出

形式手法

コンパイラー警告

コードメトリックス

(No False negative)

(False negative)

Polyspace Bug Finder

TM

Polyspace Code Prover

TM

Polyspace Code Prover

エラー予防

Polyspace Bug Finder

エラー検出

コード証明

Polyspaceはコードの信頼性を確保するための機能を提供

自動生成コード、

ハンドコード

検証可能

ファイル単位、

プロジェクト単位

検証可能

(3)

このようなことでお困りでしょうか?

Code

Review

source1.c

source2.c

source3.c

Unit

Test

Integration

Test

Hardware

Testing

C

C

C

動的テスト完了後・製品リリース後にエラーが判明した!

CC

C

全てのエラーを

検出できた?

!

(4)

このようなことでお困りでしょうか?

Code

Review

Unit

Test

Integration

Test

Hardware

Testing

ソフトウェアバグが残されて検証を進めている可能性

後段階で検出したバグは修正コスト

が高い!

製品リリース後のバグはより危険!

=バグ

(5)

コード検証の目的

要求仕様通りの設計かを確認

要求仕様に問題ないことを確認

不具合(ゼロ割等)がないことを確認

コーディングルール準拠の確認

C

適切な検証手法を使用してプロセスを効率化

動的検証

C

!

CCC

C

静的検証

(6)

モデルベースデザインでも

S-Function

(ハンドコード)

制御アルゴリズム、故障診断

自動生成コード

(モデル)

インターフェイス、RTOS、等

自動生成コードとハンドコードと統合していませんか?

コード検証が必要になります

(7)

モデル検証とコード検証の役割分担

シミュレーション

• 設計エラー検出

• 機能的エラー検出

• 数学エラー検出

• カバレッジエラー検出

コード検証

• スタンダード準拠確認

• エラー不在の証明

• ハンドコードの検証

• 実装エラー検出

モデル検証

• モデル標準確認

• 設計エラー検出

• 設計の簡素化

• カバレッジ確認

• 非到達状態・遷移検出

• テストケース生成

手戻りを最低限に

するには早期の

検証が求められます

Polyspace Bug Finder

Polyspace Code Prover

(8)

Polyspace Bug Finderのスピーディー解析

バグ検出

コード作成後、すぐに欠陥を

検出・修正

コーディングルールチェック

エラー予防と再利用性向上

MISRA準拠を確認

コードメトリックス解析

コードの複雑度を測定

時間を掛けずに大部分のバグを識別

コード作成

Bug Finder解析

レポート自動生成

修正

開発プロセスの上流で不具合を発見!

コードを統合前に多くの欠陥を修正!

コード開発の効率に繋がる!

(9)

MISRA C

®

チェッカー

MISRA AC AGC

自動生成コード用

MISRA C++ チェッカー

JSF++ チェッカー

カスタマイズ

ルールのオン・オフ設定

カスタムルール

コーディングルールの確認

Polyspaceコードルールチェックによりエラーの予防可能

(10)

Polyspace Bug Finder:検出項目リスト

Numerical

Integer division by zero

Float division by zero

Integer conversion overflow

Unsigned integer conversion overflow

Sign change integer conversion overflow

Float conversion overflow

Integer overflow

Unsigned integer overflow

Float overflow

Invalid use of std. library integer routine

Invalid use of std. library float routine

Shift of a negative value

Shift operation overflow

Static memory

Array access out of bounds

Null pointer

Pointer access out of bounds

Unreliable cast of function pointer

Unreliable cast of pointer

Invalid use of std. library memory routine

Invalid use of standard library string routine

Arithmetic operation with NULL pointer

Other

Race condition

Invalid use of other standard library routine

Large pass-by-value argument

Assertion

Format string specifiers and arguments

Dynamic memory

Use of previously freed pointer

Unprotected dynamic memory allocation

Release of previously deallocated pointer

Invalid free of pointer

Memory leak

Programming

Invalid use of = operator

Invalid use of == operator

Declaration mismatch

Invalid use of floating point operation

Wrap-around on unsigned integer

Missing null in string array

Qualifier removed in conversion

Wrong type used in sizeof

Dataflow

Write without further read

Non-initialized variable

Non-initialized pointer

Variable shadowing

Missing or invalid return statement

Unreachable code

Dead code

Partially accessed array

Uncalled function

Pointer to non initialized value converted to

const pointer

Code deactivated by constant false condition

Polyspace Bug Finder GUI

(11)

Polyspace Code Proveでコードの正しさを証明

Quality(品質)

ランタイムエラーの証明

測定、向上、管理

Usage(使用方法)

コンパイル、プログラム実行、

テストケースは不要

対応言語:C/C++/Ada

Process(プロセス)

ランタイムエラーの早期検出

自動生成コード、ハンドコード

の解析可能

コードの信頼性を測定

static void pointer_arithmetic (void) { int array[100]; int *p = array; int i; for (i = 0; i < 100; i++) { *p = 0; p++; } if (get_bus_status() > 0) { if (get_oil_pressure() > 0) { *p = 5; } else { i++; } } i = get_bus_status(); if (i >= 0) { *(p - i) = 10; } }

variable ‘I’ (int32): [0 .. 99] assignment of ‘I’ (int32): [1 .. 100]

グリーン:正常

ランタイムエラーが存在しない

レッド:エラー

実行される度にランタイムエラー

グレー:デッドコード

無実行

オレンジ:Unproven

条件によってランタイムエラー

パープル:Violation

MISRA-C/C++, JSF++

変数値範囲

ツールチップ

実機実験前にコード信頼性を

確保して手戻りを削減

(12)

Polyspace Code Proverによる

ランタイムエラー有無の証明

C run-time checks

 Unreachable Code

 Out of Bounds Array Index

 Division by Zero

 Non-Initialized Variable

 Scalar and Float Overflow (left shift on signed variables, float underflow versus values near zero)

 Initialized Return Value

 Shift Operations (shift amount in 0..31/0..63, left operand of left shift is negative)

 Illegal Dereferenced Pointer (illegal pointer access to variable of structure field, pointer within bounds)

 Correctness Condition (array conversion must not extend range, function pointer does not point to a valid function)

 Non-Initialized Pointer

 User Assertion

 Non-Termination of Call (non-termination of calls and loops, arithmetic expressions)

 Known Non-Termination of Call

 Non-Termination of Loop

 Standard Library Function Call

 Absolute Address

 Inspection Points

C++ run-time checks

 Unreachable Code

 Out of Bounds Array Index

 Division by Zero

 Non-Initialized Variable

 Scalar and Float Overflow

 Shift Operations

 Pointer of function Not Null

 Function Returns a Value

 Illegal Dereferenced Pointer

 Correctness Condition

 Non-Initialized Pointer

 Exception Handling (calls to throws, destructor or delete throws, main/tasks/C_lib_func throws, exception raised is not specified in the throw list, throw during catch

parameter construction, continue execution in__except)

 User Assertion

 Object Oriented Programming (invalid pointer to member, call of pure virtual function, incorrect type for this-pointer)

 Non-Termination of Call

 Non Termination of Loop

 Absolute Address

 Potential Call

 C++ Specific Checks (positive array size, incorrect typeid argument, incorrect dynamic_cast on reference)

static void pointer_arithmetic(void) { int array[100]; int *p = array; int i; for (i= 0; i< 100; i++) { *p= 0; p++; } if (get_bus_status() > 0) { if (get_oil_pressure() > 0) { *p= 5; } else { i++; } } i= get_bus_status(); if (i>= 0) { *(p-i) = 10; } } Green: reliable

safe pointer access

Red: faulty

out of bounds error

Gray: dead

unreachable code

Orange: unproven

may be unsafe for some conditions

(13)

Polyspaceのワークフロー

BF

Software

engineers

Quality Assurance

Engineers

CP Code Prover BF Bug Finder

Software engineers

and/or

Quality engineers

Software engineers

and/or

Quality engineers

CP

実装

ソフトウェア統合テスト

ソフトウェアリリース

ソフトウェア単体テスト

設計

要求仕様

モデル検証

Design

engineers

BF

CP

BF

(14)

MathWorksツールチェーンへの統合

Simulink

®

環境からPolyspace解析を実行

Polyspaceで発見した不具合をSimulinkモデルで強調表示

モデルの入力・パラメータ情報を利用

(15)

Polyspaceのメリット

Code

Review

source1.c

source2.c

source3.c

Unit

Test

Integration

Test

Hardware

Testing

C

C

C

早期段階でのコード検証によりスムーズな流れを実現

CC

C

Polyspace Bug Finder

Polyspace Code Prover

(16)

Polyspace ソースコード静的検証 ~まとめ~

Polyspace Bug Finderで

素早くコードの欠陥を検出!

早期段階で不具合の修正が可能!

Polyspace Code Proverで

クリティカルシステムにランタイム

エラーの有無を証明!

両ツールを使用して

効率的にソフトウェアの品質を

管理・向上!

時間を掛けずに大部分のバグを識別

形式手法の解析によるコード信頼性

安全なコードを確保して実機実験へ

Simulink環境から実行可能

ファイル・プロジェクト単位で使用可能

(17)

トレーニング・コンサルティング サービス

投資

効果

トレーニング サービス

定期 トレーニング;

東京、名古屋、大阪にて定期開催

基礎コース(11)、応用コース(11)、

専門コース(4)を ご提供

オンサイト トレーニング;

お客様サイトにて開催

ご要望に応じて3つのレベルでカリキュラム

のカスタマイズが可能

コンサルティング サービス

カスタム“Jumpstart”;

顧客モデルをベースにした短期集中型ツー

ル導入サポート

Advisory Service;

顧客Project に合わせた中長期アドバイザ

リサービス

投資対効果の最大化

(18)

制御設計関連トレーニングコース

MATLAB 関連 基礎 期間 MATLAB 基礎 3日 応用 期間 MATLAB によるデータ処理と可視化 1日 MATLAB のプログラミング手法 2日 MATLAB の最適化手法 1日 MATLAB と Simulink による制御設計 2日 Simulink 関連 コース名 期間 MATLAB/Simulink によるモデルベース開発 2日 基礎 期間 Simulink 基礎 2日 応用 期間 SimPowerSystems による電力系統の物理モデリング 1日 Simulink への外部コードの取り込み 1日 Simscape によるマルチドメインシステムの物理モデリング 1日 SimMechanics による力学系の物理モデリング 1日 専門 期間 Simulink モデルの検証と妥当性確認 1日 Simulink モデルの管理 2日 Stateflow 関連 基礎 期間 Stateflow 基礎 2日 コード生成関連 基礎 期間 リアルタイム コードの生成およびテストの基礎 1日 専門 期間 Embedded Coder による量産向けコード生成 3日 Polyspace 関連 専門 期間 Polyspace によるコード検証 2日

(19)

Thank You For Your Attention

ご清聴ありがとうございました

© 2014 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The

MathWorks, Inc. See

www.mathworks.com/trademarks

for a list of additional

trademarks. Other product or brand names may be trademarks or registered

trademarks of their respective holders.

参照

関連したドキュメント

また、「収益認識に関する会計基準」(企業会計基準第29号

1-1 睡眠習慣データの基礎集計 ……… p.4-p.9 1-2 学習習慣データの基礎集計 ……… p.10-p.12 1-3 デジタル機器の活用習慣データの基礎集計………

当第1四半期連結累計期間における業績は、売上及び営業利益につきましては、期初の業績予想から大きな変

Figure 3.1 shows the performance comparison of four Lyapunov solvers lyap.m, lyapU.m, lyapUR.m, and lyapUE.m, where lyap.m is the original function in Matlab, lyapU.m, lyapUR.m,

料金算定期間 前回検針計量日 ~ 9月4日 基本料金 前回検針計量日 ~ 9月4日 電力量料金 前回検針計量日 0:00 ~ 9月4日

 当第2四半期連結累計期間(2022年3月1日から2022年8月31日)におけるわが国経済は、ウクライナ紛争長期化

春学期入学式 4月1日、2日 履修指導 4月3日、4日 春学期授業開始 4月6日 春学期定期試験・中間試験 7月17日~30日 春学期追試験 8月4日、5日

第1段階料金適用電力量=90キロワット時 × 日割計算対象日数 検針期間の日数