Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP7059827B2 - Source code generator - Google Patents
[go: Go Back, main page]

JP7059827B2 - Source code generator - Google Patents

Source code generator Download PDF

Info

Publication number
JP7059827B2
JP7059827B2 JP2018122141A JP2018122141A JP7059827B2 JP 7059827 B2 JP7059827 B2 JP 7059827B2 JP 2018122141 A JP2018122141 A JP 2018122141A JP 2018122141 A JP2018122141 A JP 2018122141A JP 7059827 B2 JP7059827 B2 JP 7059827B2
Authority
JP
Japan
Prior art keywords
source code
model
processing
generated
unit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2018122141A
Other languages
Japanese (ja)
Other versions
JP2020004036A (en
Inventor
文崇 佐川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Denso Corp
Original Assignee
Denso Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Denso Corp filed Critical Denso Corp
Priority to JP2018122141A priority Critical patent/JP7059827B2/en
Publication of JP2020004036A publication Critical patent/JP2020004036A/en
Application granted granted Critical
Publication of JP7059827B2 publication Critical patent/JP7059827B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Description

本開示は、モデルからソースコードを生成する技術に関する。 The present disclosure relates to a technique for generating source code from a model.

入力データに対する処理を複数の処理ブロック間におけるデータの入出力の仕様として記述されるモデルから、モデルに対応するソースコードを生成する技術として、例えば、特許文献1に記載されているものが知られている。 As a technique for generating a source code corresponding to a model from a model in which processing for input data is described as specifications for input / output of data between a plurality of processing blocks, for example, one described in Patent Document 1 is known. ing.

特許文献1に記載されているように、モデルまたはソースコードに対しては、モデルまたはソースコードの品質を検査するためにテストケースが生成される。テストケースは、テスト対象のモデルまたはソースコードに対する入力データである。通常、テストケースは、モデルの出力側から入力側に向けて逆算して生成される。 As described in Patent Document 1, for a model or source code, a test case is generated to inspect the quality of the model or source code. A test case is input data for the model or source code to be tested. Normally, test cases are generated by back calculation from the output side to the input side of the model.

そして、モデルまたはソースコードがテストケースを実行した結果、モデルまたはソースコードにおける処理経路がどの程度テストされたかを表すカバレッジは、テストケースによる品質検査を保証するために必要な所定値以上であることが要求される。 And, as a result of executing the test case by the model or source code, the coverage showing how much the processing path in the model or source code has been tested is equal to or more than the predetermined value required to guarantee the quality inspection by the test case. Is required.

特開2009-294846号公報Japanese Unexamined Patent Publication No. 2009-294846

モデルが大型化し複雑になると、所定値以上のカバレッジを達成することが困難になる場合がある。そこで、モデルを分割し小型化して複数のサブシステムを生成し、サブシステム毎にテストケースを生成してカバレッジを向上させることが考えられる。 As the model becomes larger and more complex, it may be difficult to achieve coverage above a given value. Therefore, it is conceivable to divide the model and miniaturize it to generate a plurality of subsystems, and generate a test case for each subsystem to improve the coverage.

この場合、サブシステムに対応するサブソースコードを関数として定義すれば、サブソースコードからモデルに対応するソースコードを容易に生成でき、サブシステム毎のテストケースをサブシステムまたはサブソースコードで実行できる。 In this case, if the subsource code corresponding to the subsystem is defined as a function, the source code corresponding to the model can be easily generated from the subsource code, and the test case for each subsystem can be executed in the subsystem or the subsource code. ..

しかし、サブソースコードが関数として定義されると、定義される関数の数が上昇するのに従い関数の呼び出し回数が増加する。その結果、サブソースコードから生成されるソースコードの実行時間が増加するという課題が生じる。また、関数として定義しない場合には、サブシステムの入出力に相当するものがソースコードに無く、サブシステムのテストケースがソースコード上で実行できないという課題が生じる。 However, when the subsource code is defined as a function, the number of function calls increases as the number of defined functions increases. As a result, there arises a problem that the execution time of the source code generated from the subsource code increases. Further, if it is not defined as a function, there is no equivalent to the input / output of the subsystem in the source code, and there arises a problem that the test case of the subsystem cannot be executed on the source code.

本開示は、モデルを分割したサブシステム毎にサブソースコードを生成しても、モデルに対応してサブソースコードから生成されるソースコードの実行時間の増加を抑制しつつ、サブシステム毎のテストケースを実行可能にする技術を提供する。 In this disclosure, even if the subsource code is generated for each subsystem that divides the model, the test for each subsystem is suppressed while suppressing the increase in the execution time of the source code generated from the subsource code corresponding to the model. Provides technology that makes cases feasible.

本開示のソースコード生成装置(50)は、入力データに対する処理を複数の処理ブロック(112、120~128)間におけるデータの入出力の仕様として記述されるモデル(12、100)から、モデルに対応するソースコード(14、210)を生成するソースコード生成装置であって、カバレッジ判定部(64、S406、S414)と、対応付け部(70、S430、S432)と、パラメータ定義部(72、S434)と、サブコード生成部(74、S436~S448)と、ソースコード生成部(76、S450)と、を備える。 The source code generator (50) of the present disclosure is a model from a model (12, 100) in which processing for input data is described as specifications for input / output of data between a plurality of processing blocks (112, 120 to 128). A source code generator that generates the corresponding source code (14, 210), including a coverage determination unit (64, S406, S414), a mapping unit (70, S430, S432), and a parameter definition unit (72, S434), a subcode generation unit (74, S436 to S448), and a source code generation unit (76, S450).

カバレッジ判定部は、モデルから生成されるテストケースをモデルに実行させたカバレッジが所定値未満の場合、モデルを分割して生成された複数のサブシステム(130、140)のそれぞれに対し、サブシステムから生成されるテストケースを実行させたカバレッジが所定値以上か否かを判定する。 When the coverage of the test case generated from the model executed by the model is less than the predetermined value, the coverage judgment unit is a subsystem for each of the plurality of subsystems (130, 140) generated by dividing the model. It is determined whether or not the coverage for executing the test case generated from is equal to or higher than the predetermined value.

対応付け部は、複数のサブシステムのカバレッジがすべて所定値以上であるとカバレッジ判定部が判定すると、サブシステム毎に、サブシステムに分割される前のモデルから生成された元のソースコード(200)と、処理ブロックおよび処理ブロックの入出力パラメータとを対応付ける。 When the coverage determination unit determines that the coverage of a plurality of subsystems is all equal to or higher than a predetermined value, the association unit is the original source code (200) generated from the model before being divided into subsystems for each subsystem. ) And the processing block and the input / output parameters of the processing block are associated with each other.

パラメータ定義部は、対応付け部が対応付けた結果において、元のソースコードで定義されていない入出力パラメータが存在すれば、サブシステム毎に、定義されていない入出力パラメータを定義する。 The parameter definition unit defines the input / output parameters that are not defined for each subsystem if there are input / output parameters that are not defined in the original source code in the result of the mapping by the mapping unit.

サブコード生成部は、サブシステム毎に、対応付け部が対応付けた結果とパラメータ定義部が定義する入出力パラメータとを使用して、サブシステムに対応するサブソースコード(212、214)を生成する。ソースコード生成部は、サブコード生成部が生成するサブソースコードから、モデルに対応するソースコードを生成する。 The subcode generation unit generates subsource codes (212, 214) corresponding to the subsystem by using the result associated with the mapping unit and the input / output parameters defined by the parameter definition unit for each subsystem. do. The source code generator generates the source code corresponding to the model from the subsource code generated by the subcode generator.

このように、本開示のソースコード生成装置では、モデルを分割したサブシステム毎に、分割前のモデルから生成された元のソースコードにおいて定義されていない入出力パラメータを新たに定義する。そして、サブシステム毎に、対応付け部が対応付けた結果とパラメータ定義部が定義する入出力パラメータとに基づいて、サブシステムに対応するサブソースコードが生成される。これにより、サブシステムに対応して生成されるサブソースコードとサブソースコードとの間で、入出力パラメータによりデータの受け渡しができる。 As described above, in the source code generator of the present disclosure, input / output parameters not defined in the original source code generated from the model before division are newly defined for each subsystem in which the model is divided. Then, for each subsystem, the subsource code corresponding to the subsystem is generated based on the result of the mapping by the mapping unit and the input / output parameters defined by the parameter definition unit. As a result, data can be exchanged between the subsource code generated corresponding to the subsystem and the subsource code by input / output parameters.

したがって、サブシステムから関数として定義されるサブソースコードを生成する場合に比べ、関数の呼び出しにより生じる実行時間の増加を抑制しつつ、サブシステム毎のテストケースを実行できる。 Therefore, it is possible to execute a test case for each subsystem while suppressing an increase in execution time caused by calling a function, as compared with the case of generating a subsystem code defined as a function from a subsystem.

尚、この欄および特許請求の範囲に記載した括弧内の符号は、一つの態様として後述する実施形態に記載の具体的手段との対応関係を示すものであって、本開示の技術的範囲を限定するものではない。 In addition, the reference numerals in parentheses described in this column and the scope of claims indicate the correspondence with the specific means described in the embodiment described later as one embodiment, and the technical scope of the present disclosure is defined. It is not limited.

モデルベース開発システムを示すブロック図。A block diagram showing a model-based development system. ソースコード生成装置を示すブロック図。A block diagram showing a source code generator. ソースコード生成のメイン処理を示すフローチャート。A flowchart showing the main process of source code generation. ソースコード置換処理を示すフローチャート。A flowchart showing the source code replacement process. モデルの構成を示す説明図。Explanatory drawing which shows the structure of a model. モデルから生成されたソースコードを示すプログラム。A program that shows the source code generated from the model. モデルの分割を示す説明図。Explanatory diagram showing the division of the model. サブシステムとソースコードとの対応を示す一覧図。A list showing the correspondence between the subsystem and the source code. サブシステムを示す説明図。Explanatory diagram showing a subsystem. 未定義の入出力パラメータを定義した一覧図。A list of undefined I / O parameters defined. 処理ブロックのソースコードの置換を説明する一覧図。A list diagram illustrating the replacement of the source code of the processing block. 処理ブロックの他のソースコードの置換を説明する一覧図。A list diagram illustrating replacement of other source code in a processing block. 他の処理ブロックのソースコードの置換を説明する一覧図。A list diagram illustrating source code replacement for other processing blocks. 他の処理ブロックのソースコードの置換を説明する一覧図。A list diagram illustrating source code replacement for other processing blocks. モデルに対応する置換終了後のソースコードを示すプログラム。A program that shows the source code after replacement corresponding to the model.

以下、本開示の実施形態を図に基づいて説明する。
[1.構成]
図1に示すモデルベース開発システム2は、ソースコード生成部10と、モデル12と、ソースコード14と、テストケース生成部20と、ソースコード実行部30と、モデル実行部32と、実行結果比較部40と、結果表示部42とを備えている。モデルベース開発システム2は、例えば、ディスプレイ、入出力装置、CPU、RAM、ROM、HDD等を備えるパーソナルコンピュータにより実現される。
Hereinafter, embodiments of the present disclosure will be described with reference to the drawings.
[1. Constitution]
The model-based development system 2 shown in FIG. 1 compares execution results with a source code generation unit 10, a model 12, a source code 14, a test case generation unit 20, a source code execution unit 30, and a model execution unit 32. A unit 40 and a result display unit 42 are provided. The model-based development system 2 is realized by, for example, a personal computer including a display, an input / output device, a CPU, a RAM, a ROM, an HDD, and the like.

以下、モデル12から生成されたソースコード14のカバレッジが所定値以上の場合のモデルベース開発システム2の作動について説明する。
ソースコード生成部10は、HDD等に記憶されているモデル12から、例えばC言語で記述されたソースコード14を生成する。
Hereinafter, the operation of the model-based development system 2 when the coverage of the source code 14 generated from the model 12 is equal to or higher than a predetermined value will be described.
The source code generation unit 10 generates, for example, a source code 14 written in C language from a model 12 stored in an HDD or the like.

ソースコード生成部10の例としては、Mathworks(登録商標)社のEmbedded Coder(登録商標)がある。なお、モデルは、モデルエディタ等のモデル作成用プログラムをパーソナルコンピュータで実行し、その実行時にユーザがモデル作成のための作業を入力装置を用いて行うことで作成されるようになっていてもよい。このようなモデルエディタがモデルベース開発システム2に含まれていてもよい。 As an example of the source code generation unit 10, there is an Embedded Coder (registered trademark) manufactured by MathWorks (registered trademark). The model may be created by executing a model creation program such as a model editor on a personal computer and the user performing work for model creation using an input device at the time of execution. .. Such a model editor may be included in the model-based development system 2.

ここで、モデル12について説明する。モデル12は、時系列の中でのデータ演算、データ入力およびデータ出力のうち少なくともいずれか1つの機能を表す処理ブロック、および処理ブロック間の入出力関係の仕様、すなわち、処理ブロックからどの処理ブロックにデータが渡されるかを示す結線の組み合わせとして記述される。 Here, the model 12 will be described. The model 12 is a processing block representing at least one function of data calculation, data input and data output in a time series, and a specification of an input / output relationship between the processing blocks, that is, which processing block from the processing block. It is described as a combination of connections indicating whether data is passed to.

これら処理ブロックおよび結線の組み合わせによって、入力データに応じたモデル12の処理が記述される。例えば、車載装置の制御処理であれば、エンジン制御、ブレーキ制御等の処理がある。モデルの例として、Mathworks(登録商標)社のSimulink(登録商標)モデルがある。 The combination of these processing blocks and connections describes the processing of the model 12 according to the input data. For example, in the case of control processing of an in-vehicle device, there are processing such as engine control and brake control. An example of a model is the Simulink® model from MathWorks®.

テストケース生成部20は、モデル12に基づいてテストケースを生成する。なお、テストケースは、モデル12のみに基づいて生成してもよいし、あるいは、モデル12のソースコード14に基づいて生成してもよいし、またあるいは、モデル12とソースコード14との両方に基づいて生成してもよい。 The test case generation unit 20 generates a test case based on the model 12. The test case may be generated based only on the model 12, or may be generated based on the source code 14 of the model 12, or may be generated in both the model 12 and the source code 14. It may be generated based on.

テストケースとは、モデル12の品質、および、ソースコード生成部10によってモデル12から生成されたソースコード14の品質を検査するためのカバレッジテスト等の処理の実行において、その品質検査が十分となるよう、モデル12やソースコード14に入力するテスト用データである。例えば、後述するソースコード実行部30およびモデル実行部32の実行の際にも、このテストケースが使用される。 The test case is sufficient in executing a process such as a coverage test for inspecting the quality of the model 12 and the quality of the source code 14 generated from the model 12 by the source code generation unit 10. This is test data to be input to the model 12 and the source code 14. For example, this test case is also used when executing the source code execution unit 30 and the model execution unit 32, which will be described later.

品質検査が十分となるようなテストケースとは、例えば、できる限りモデル12の全ての処理ブロックまたはソースコード14の全ての命令文が実行されるような入力データである。
ソースコード実行部30は、テストケース生成部20によって生成されたテストケースを入力データとして、ソースコード14に記載された処理内容を実行する。その実行の際、ソースコード実行部30は、ソースコード14の実行単位による出力データ、および実行した命令文の時系列的なリストを生成する。
The test case for which the quality inspection is sufficient is, for example, input data in which all the processing blocks of the model 12 or all the statements of the source code 14 are executed as much as possible.
The source code execution unit 30 executes the processing content described in the source code 14 using the test case generated by the test case generation unit 20 as input data. At the time of execution, the source code execution unit 30 generates output data according to the execution unit of the source code 14 and a time-series list of the executed instructions.

モデル実行部32は、テストケース生成部20によって生成されたテストケースを入力データとして、モデル12のシミュレーションを実行する。シミュレーションとは、モデル12の表現するデータの入出力の時間変化をパーソナルコンピュータ上で仮想的に再現する処理をいう。 The model execution unit 32 executes the simulation of the model 12 using the test case generated by the test case generation unit 20 as input data. The simulation is a process of virtually reproducing the time change of the input / output of the data represented by the model 12 on a personal computer.

モデル実行部32は、モデル12のシミュレーションによる外部への出力データ、ならびに処理ブロック毎の実行時間および入出力データをHDD等に格納する。
実行結果比較部40は、ソースコード実行部30およびモデル実行部32によって実行された実行結果データを比較し、その比較結果をHDD等に格納する。尚、比較とは、ソースコード実行部30が実行したソースコード14と、モデル実行部32がシミュレーションを行ったモデル12とのそれぞれの実行結果のデータの比較をいう。
The model execution unit 32 stores the output data to the outside by the simulation of the model 12, the execution time for each processing block, and the input / output data in the HDD or the like.
The execution result comparison unit 40 compares the execution result data executed by the source code execution unit 30 and the model execution unit 32, and stores the comparison result in the HDD or the like. The comparison refers to the comparison of the data of the execution results of the source code 14 executed by the source code execution unit 30 and the model 12 simulated by the model execution unit 32.

比較項目としては、同じ入力データに対してモデル12、ソースコード14が出力したデータがある。そして実行結果比較部40は、比較の結果、それぞれが合致しているか否かの合否判定を行い、その合否判定の情報もHDD等に格納する。結果表示部42は、実行結果比較部40による比較結果をディスプレイに出力する。 As comparison items, there are data output by the model 12 and the source code 14 for the same input data. Then, the execution result comparison unit 40 determines whether or not each of them matches as a result of the comparison, and stores the pass / fail determination information in the HDD or the like. The result display unit 42 outputs the comparison result by the execution result comparison unit 40 to the display.

ここで、モデル12の構造が大型化しており複雑な場合、テストケース生成部20が生成するテストケースをソースコード実行部30とモデル実行部32とが実行しても、カババレッジが、モデル12またはソースコード14に対するテストケースによる品質検査を保証するために必要な所定値以上にならないことがある。 Here, when the structure of the model 12 is large and complicated, even if the source code execution unit 30 and the model execution unit 32 execute the test case generated by the test case generation unit 20, the coverage is the model 12 or the model 12. It may not exceed the predetermined value required to guarantee the quality inspection by the test case for the source code 14.

そこで、図2に、構造が大型化しており複雑な場合のモデル100であっても、ソースコード210でテストケースを実行した結果のカバレッジを所定値以上にする本実施形態のソースコード生成装置50を示す。 Therefore, FIG. 2 shows the source code generator 50 of the present embodiment in which the coverage of the result of executing the test case with the source code 210 is set to a predetermined value or more even in the model 100 in the case where the structure is large and complicated. Is shown.

ソースコード生成装置50は、モデル入力部52と、ソースコード生成部54と、分析部60と、対応付け部70と、パラメータ定義部72と、サブコード生成部74と、ソースコード生成部76とを備えている。分析部60は、テストケース生成部62とカバレッジ判定部64とを備えている。 The source code generation device 50 includes a model input unit 52, a source code generation unit 54, an analysis unit 60, a mapping unit 70, a parameter definition unit 72, a subcode generation unit 74, and a source code generation unit 76. It is equipped with. The analysis unit 60 includes a test case generation unit 62 and a coverage determination unit 64.

ソースコード生成装置50の各要素が実行するソースコード生成処理について以下に説明する。
[2.処理]
[2-1.メイン処理]
ソースコード生成装置50が実行するソースコード生成のメイン処理について、図3のフローチャートに基づいて説明する。
The source code generation process executed by each element of the source code generation device 50 will be described below.
[2. process]
[2-1. Main processing]
The main process of source code generation executed by the source code generation device 50 will be described with reference to the flowchart of FIG.

S400においてモデル入力部52は、モデルと、モデルに付随する情報として、モデルを分割してサブシステムを生成する場合の分割箇所などを取得する。S402においてソースコード生成部54は、モデルからソースコードを生成する。この場合、ソースコード生成部54は、図1に示すソースコード生成部10と実質的に同じ処理を実行する。 In S400, the model input unit 52 acquires the model and the division points when the model is divided and the subsystem is generated as the information accompanying the model. In S402, the source code generation unit 54 generates the source code from the model. In this case, the source code generation unit 54 executes substantially the same processing as the source code generation unit 10 shown in FIG.

図5に、モデル100の一例を示す。符号102~108は入力パラメータを示す。符号110は出力パラメータを示す。符号112、120~128は処理ブロックである。符号112は、1.01の定数を出力する定数ブロックである。符号120は、定数ブロック112の値と、遅延処理ブロック128の出力との積を出力する乗算ブロックである。 FIG. 5 shows an example of the model 100. Reference numerals 102 to 108 indicate input parameters. Reference numeral 110 indicates an output parameter. Reference numerals 112 and 120 to 128 are processing blocks. Reference numeral 112 is a constant block that outputs a constant of 1.01. Reference numeral 120 is a multiplication block that outputs the product of the value of the constant block 112 and the output of the delay processing block 128.

符号122~126が示す条件分岐ブロックは、上中下の入力パラメータのうち、中央の信号が0でないときに上の信号を出力し、中央の信号が0の場合は下の信号を出力する。
符号128が示す遅延処理ブロックは、1周期前の値を出力する。
The conditional branch block indicated by reference numerals 122 to 126 outputs the upper signal when the central signal is not 0 among the upper, middle, and lower input parameters, and outputs the lower signal when the central signal is 0.
The delay processing block indicated by reference numeral 128 outputs the value one cycle before.

図5に示されるモデル100から、ソースコード生成部54が生成したC言語によるソースコード200を図6に示す。
S404において分析部60のテストケース生成部62は、モデル100に実行させるテストケースを生成する。この場合、テストケース生成部62は、図1に示すテストケース生成部20と実質的に同じ処理を実行する。S406において分析部60のカバレッジ判定部64は、モデル100にテストケースを実行させた結果のカバレッジが所定値以上であるか否かを判定する。
FIG. 6 shows the source code 200 in C language generated by the source code generation unit 54 from the model 100 shown in FIG.
In S404, the test case generation unit 62 of the analysis unit 60 generates a test case to be executed by the model 100. In this case, the test case generation unit 62 executes substantially the same processing as the test case generation unit 20 shown in FIG. In S406, the coverage determination unit 64 of the analysis unit 60 determines whether or not the coverage as a result of having the model 100 execute the test case is equal to or greater than a predetermined value.

S406の判定がYesである、つまりモデル100にテストケースを実行させた結果のカバレッジが所定値以上の場合、S408において、図1に示すモデルベース開発システム2により、モデル100と、S402で生成されたソースコード200とに対してテストが実行される。 When the judgment of S406 is Yes, that is, when the coverage as a result of having the model 100 execute the test case is equal to or more than a predetermined value, it is generated by the model 100 and S402 by the model-based development system 2 shown in FIG. 1 in S408. The test is executed against the source code 200.

これに対し、S406の判定がNoである、つまりモデル100にテストケースを実行させた結果のカバレッジが所定値未満の場合、S410においてカバレッジ判定部64は、S400でモデル入力部52が取得したモデル100の分割箇所でモデル100を分割し複数のサブシステムを生成する。 On the other hand, when the determination in S406 is No, that is, the coverage as a result of having the model 100 execute the test case is less than a predetermined value, the coverage determination unit 64 in S410 is the model acquired by the model input unit 52 in S400. The model 100 is divided at 100 division points to generate a plurality of subsystems.

図7に、S400でモデル入力部52が取得した分割情報に基づいてモデル100を2つのサブシステム130、140に分割した例を示す。
S412においてテストケース生成部62は、サブシステム130、140のそれぞれについてテストケースを生成する。
FIG. 7 shows an example in which the model 100 is divided into two subsystems 130 and 140 based on the division information acquired by the model input unit 52 in S400.
In S412, the test case generation unit 62 generates test cases for each of the subsystems 130 and 140.

S414においてカバレッジ判定部64は、サブシステム130、140のそれぞれについてテストケースを実行した結果のカバレッジが所定値以上であるか否かを判定する。
S414の判定がNoである、つまりカバレッジが所定値未満のサブシステムが存在する場合、処理はS410に戻り、カバレッジが所定値未満のサブシステムがさらに複数のサブシステムに分割される。
In S414, the coverage determination unit 64 determines whether or not the coverage as a result of executing the test case for each of the subsystems 130 and 140 is equal to or greater than a predetermined value.
If the determination in S414 is No, that is, if there is a subsystem whose coverage is less than the predetermined value, the process returns to S410, and the subsystem whose coverage is less than the predetermined value is further divided into a plurality of subsystems.

S414の判定がYesである、つまりすべてのサブシステム、図7の例ではサブシステム130、140のカバレッジが所定値以上の場合、S416のソースコード置換処置において、対応付け部70とパラメータ定義部72とサブコード生成部74とソースコード生成部76とは、S402で生成されたソースコードを置換して、複数のサブシステム130、140のそれぞれに対応するサブソースコードを生成する。 When the determination of S414 is Yes, that is, when the coverage of all the subsystems, that is, the subsystems 130 and 140 in the example of FIG. 7 is equal to or more than a predetermined value, the mapping unit 70 and the parameter definition unit 72 are used in the source code replacement procedure of S416. And the subcode generation unit 74 and the source code generation unit 76 replace the source code generated in S402 to generate subsource codes corresponding to each of the plurality of subsystems 130 and 140.

そして、サブソースコードをまとめて、モデル100に対応するソースコードを生成する。それぞれのサブシステム130、140のカバレッジが所定値以上であれば、それぞれのサブシステム130、140から生成されたサブソースコードをまとめて生成されたモデル100に対応するソースコードのカバレッジも所定値以上である。 Then, the sub-source code is put together to generate the source code corresponding to the model 100. If the coverage of each of the subsystems 130 and 140 is equal to or higher than the predetermined value, the coverage of the source code corresponding to the model 100 generated by collectively generating the subsystems 130 and 140 from the respective subsystems 130 and 140 is also equal to or higher than the predetermined value. Is.

尚、S416のソースコード置換処理については、図4のフローチャートに基づいて詳細に説明する。
そして、S418において、S416で生成されたサブシステム130、140に対応するサブソースコードと、サブシステム130、140とに対して、図1に示すモデルベース開発システム2においてソースコード実行部30とモデル実行部32とが、S412で生成されたテストケースを使用してテストを実行する。
The source code replacement process of S416 will be described in detail with reference to the flowchart of FIG.
Then, in S418, the subsource code corresponding to the subsystems 130 and 140 generated in S416 and the subsystems 130 and 140 are compared with the source code execution unit 30 and the model in the model-based development system 2 shown in FIG. The execution unit 32 executes the test using the test case generated in S412.

[2-2.ソースコード置換処理]
図3のS416においてソースコード生成装置50が実行するソースコード置換処理について、図4のフローチャートに基づいて説明する。
[2-2. Source code replacement process]
The source code replacement process executed by the source code generation device 50 in S416 of FIG. 3 will be described with reference to the flowchart of FIG.

S430において対応付け部70は、モデル100を分割して生成されたサブシステム130、140に対し置換処理を実行する順番を決定する。モデル100において早く実行されるサブシステム130から置換処理が実行される。 In S430, the mapping unit 70 determines the order in which the replacement processing is executed for the subsystems 130 and 140 generated by dividing the model 100. The replacement process is executed from the subsystem 130 which is executed earlier in the model 100.

S432において対応付け部70は、サブシステム130、140のそれぞれについて、処理ブロックと入出力パラメータと一時パラメータとに対し、ソースコード200を対応付けた一覧を生成する。図8に、対応付け部70がサブシステム130についてソースコード200を対応付けて生成した一覧を示す。 In S432, the mapping unit 70 generates a list in which the source code 200 is associated with the processing block, the input / output parameter, and the temporary parameter for each of the subsystems 130 and 140. FIG. 8 shows a list generated by the mapping unit 70 in association with the source code 200 for the subsystem 130.

図8の一覧と図9に示すサブシステム130とにおいて、A、B、Cが処理ブロックであり、a、b、c、dが入力パラメータであり、eが出力パラメータであり、f、gが一時パラメータである。f、gが示す一時パラメータも、いずれかの処理ブロックにおける入力パラメータまたは出力パラメータである。 In the list of FIG. 8 and the subsystem 130 shown in FIG. 9, A, B, and C are processing blocks, a, b, c, and d are input parameters, e is an output parameter, and f and g are. It is a temporary parameter. The temporary parameters indicated by f and g are also input parameters or output parameters in any of the processing blocks.

処理ブロックは、処理の種別として、反復、分岐、順接に分類される。分岐、順接が反復される場合は、反復/分岐、反復/順接として分類される。
各処理ブロックに対応付けるソースコードは、反復および順接については、処理ブロックに関連するソースコードの記述がすべて抽出される。分岐については、複数の分岐の条件がソースコードに記述されている場合、該当する分岐の条件だけが抽出される。
Processing blocks are classified into iteration, branching, and adjunct as processing types. When branching and adjunct are repeated, they are classified as iterative / branching and iterative / adjunct.
For the source code associated with each processing block, all the source code descriptions related to the processing block are extracted for iteration and adjunct. For branching, if multiple branching conditions are described in the source code, only the corresponding branching conditions are extracted.

図8の一覧において、入出力パラメータとして、「A」で表される条件分岐ブロック124の出力パラメータの「e」と、「B」で表される条件分岐ブロック122の出力パラメータであり条件分岐ブロック124の入力パラメータである一時パラメータの「f」と、「C」で表される乗算ブロック120の出力パラメータであり条件分岐ブロック122の入力パラメータである一時パラメータの「g」とに対応する記述が、図6に示すソースコード200において未定義であることが分かる。 In the list of FIG. 8, as input / output parameters, the output parameter "e" of the conditional branch block 124 represented by "A" and the output parameter of the conditional branch block 122 represented by "B" are the conditional branch blocks. There is a description corresponding to the temporary parameter "f" which is the input parameter of 124 and the temporary parameter "g" which is the output parameter of the multiplication block 120 represented by "C" and is the input parameter of the conditional branch block 122. , It can be seen that it is undefined in the source code 200 shown in FIG.

そこで、S434においてパラメータ定義部72は、一覧において未定義の入出力パラメータとして、出力パラメータの「e」と一時パラメータの「f」、「g」とを、図10に示すように、double sub1_out1[2]、double sub1_tmp1[2]、double sub1_tmp2[2]として、図10の下線で示すように処理後のサブソースコードで定義する。 Therefore, in S434, the parameter definition unit 72 sets the output parameter "e" and the temporary parameters "f" and "g" as undefined input / output parameters in the list as double sub1_out1 [. 2], double sub1_tmp1 [2], double sub1_tmp2 [2] are defined in the processed subsource code as shown by the underline in FIG.

S436においてサブコード生成部74は、サブシステム130において、ソースコードを置換してサブソースコードを生成する処理ブロックの順番を決定する。本実施形態では、サブコード生成部74は、乗算ブロック120と条件分岐ブロック122、124とのうち、条件分岐ブロック122、124を先に置換する。さらに、サブコード生成部74は、条件分岐ブロック122、124のうち、後段で分岐処理が実行される条件分岐ブロック124を条件分岐ブロック122よりも先に置換する。 In S436, the subcode generation unit 74 determines the order of the processing blocks in which the source code is replaced and the subsource code is generated in the subsystem 130. In the present embodiment, the subcode generation unit 74 first replaces the conditional branch blocks 122 and 124 among the multiplication block 120 and the conditional branch blocks 122 and 124. Further, the subcode generation unit 74 replaces the conditional branch block 124 in which the branch processing is executed in the subsequent stage among the conditional branch blocks 122 and 124 before the conditional branch block 122.

これは、サブシステム130からサブソースコードが生成された場合、後段の条件分岐ブロックに対応するサブソースコードから実行されるので、分岐条件のいずれかが満たされない場合、分岐条件が満たされない場合に実行されるサブソースコードが実行されない。これにより、生成されたサブソースコードの実行時間が短縮される。 This is executed from the subsource code corresponding to the conditional branch block in the subsequent stage when the subsource code is generated from the subsystem 130. Therefore, if any of the branch conditions is not satisfied, or if the branch condition is not satisfied. The subsource code that is executed is not executed. This reduces the execution time of the generated subsource code.

S436の処理により、サブシステム130において、条件分岐ブロック124、条件分岐ブロック122、乗算ブロック120の順番で、対応するソースコードが置換される。
S438においてサブコード生成部74は、今回の置換処理の対象である処理ブロックに対応するソースコードの記述において、分岐先の処理が省略されているか否かを判定する。S438の判定がYesである、つまりソースコードにおいて分岐先の処理が省略されている場合、処理はS440に移行する。S438の判定がNoである、つまり分岐先の処理が省略されていない場合、処理はS442に移行する。
By the process of S436, the corresponding source code is replaced in the subsystem 130 in the order of the conditional branch block 124, the conditional branch block 122, and the multiplication block 120.
In S438, the subcode generation unit 74 determines whether or not the processing of the branch destination is omitted in the description of the source code corresponding to the processing block that is the target of the replacement processing this time. If the determination in S438 is Yes, that is, the processing of the branch destination is omitted in the source code, the processing shifts to S440. If the determination in S438 is No, that is, the processing of the branch destination is not omitted, the processing shifts to S442.

例えば、条件分岐ブロック124に対応する「if (!(in3[s4t_tmp] != 0.0F))」の判定に対し、ソースコード200には判定結果が偽の場合の分岐先の記述が省略されているので、S438の判定はYesである。 For example, in contrast to the determination of "if (! (in3 [s4t_tmp]! = 0.0F))" corresponding to the conditional branch block 124, the source code 200 omits the description of the branch destination when the determination result is false. Therefore, the determination of S438 is Yes.

この場合、S440においてサブコード生成部74は、図11の下線で示すように、条件分岐ブロック124に対応するサブソースコードにおいて、「else」が追加される。
S442において、サブコード生成部74は、処理ブロックに対応する処理で、出力パラメータに入力パラメータを代入する記述を追加する。
In this case, in S440, the subcode generation unit 74 adds "else" in the subsource code corresponding to the conditional branch block 124, as shown by the underline in FIG.
In S442, the subcode generation unit 74 adds a description of substituting an input parameter to an output parameter in the process corresponding to the processing block.

例えば、図12の下線で示すように、条件分岐ブロック124に対応する「if (!(in3[s4t_tmp] != 0.0F))」の判定に対し、判定結果が真であれば、sub1_out1[s4t_tmp]=out1[s4t_tmp]の記述が追加され、判定結果が偽であれば、sub1_out1[s4t_tmp]=sub1_tmp1[s4t_tmp]の記述が追加される。 For example, as shown by the underline in FIG. 12, if the judgment result is true for the judgment of "if (! (in3 [s4t_tmp]! = 0.0F))" corresponding to the conditional branch block 124, sub1_out1 [s4t_tmp] ] = out1 [s4t_tmp] description is added, and if the judgment result is false, the description of sub1_out1 [s4t_tmp] = sub1_tmp1 [s4t_tmp] is added.

S444においてサブコード生成部74は、置換処理が終了した処理ブロックを対象から除く。S446においてサブコード生成部74は、すべての処理ブロックに対する置換処理が終了したか否かを判定する。S446の判定がNoである、つまり置換処理が未処理の処理ブロックが存在する場合、処理はS436に移行する。 In S444, the subcode generation unit 74 excludes the processing block for which the replacement processing has been completed from the target. In S446, the subcode generation unit 74 determines whether or not the replacement processing for all the processing blocks has been completed. If the determination in S446 is No, that is, if there is a processing block in which the replacement processing has not been processed, the processing shifts to S436.

例えば、条件分岐ブロック124に対する置換処理が終了しても、条件分岐ブロック122対する置換処理は終了していないので、処理はS436に移行し、条件分岐ブロック124と同様に条件分岐ブロック122に対する置換処理が実行される。 For example, even if the replacement process for the conditional branch block 124 is completed, the replacement process for the conditional branch block 122 is not completed, so the process shifts to S436 and the replacement process for the conditional branch block 122 is performed in the same manner as the conditional branch block 124. Is executed.

条件分岐ブロック122の処理は条件分岐ブロック124において判定結果が偽である「else」側で実行されるので、図13の下線で示すように、サブソースコードにおいて条件分岐ブロック122の処理に対応する記述が条件分岐ブロック124のサブソースコードにおける「else」側に記述される。 Since the processing of the conditional branch block 122 is executed on the "else" side where the determination result is false in the conditional branch block 124, it corresponds to the processing of the conditional branch block 122 in the subsource code as shown by the underline in FIG. The description is described on the "else" side in the subsource code of the conditional branch block 124.

この場合、条件分岐ブロック124の判定結果が偽のときに実行されるsub1_out1[s4t_tmp]=sub1_tmp1[s4t_tmp]において、条件分岐ブロック124の判定結果が真であればsub1_tmp1[s4t_tmp]=in1[s4t_tmp]が実行され、条件分岐ブロック124の判定結果が偽であればsub1_tmp1[s4t_tmp]=sub1_tmp2[s4t_tmp]が実行される。 In this case, in sub1_out1 [s4t_tmp] = sub1_tmp1 [s4t_tmp] executed when the judgment result of the conditional branch block 124 is false, if the judgment result of the conditional branch block 124 is true, sub1_tmp1 [s4t_tmp] = in1 [s4t_tmp] Is executed, and if the determination result of the conditional branch block 124 is false, sub1_tmp1 [s4t_tmp] = sub1_tmp2 [s4t_tmp] is executed.

そして、条件分岐ブロック122に対する置換処理が終了すると、乗算ブロック120に対する置換処理が実行される。
この場合、図14の下線で示すように、条件分岐ブロック122の判定結果が偽のときに実行されるsub1_tmp1[s4t_tmp]=sub1_tmp2[s4t_tmp]の前に、乗算ブロック120の処理結果であるout1[s4t_tmp]*0.01がsub1_tmp2[s4t_tmp]に代入される。
Then, when the replacement process for the conditional branch block 122 is completed, the replacement process for the multiplication block 120 is executed.
In this case, as shown by the underline in FIG. 14, before sub1_tmp1 [s4t_tmp] = sub1_tmp2 [s4t_tmp] executed when the determination result of the conditional branch block 122 is false, out1 [which is the processing result of the multiplication block 120. s4t_tmp] * 0.01 is assigned to sub1_tmp2 [s4t_tmp].

S446の判定がYesである、つまり、すべての処理ブロックの置換処理が終了した場合、S448においてサブコード生成部74は、分割された複数のサブシステムについて、置換処理が終了したか否かを判定する。S448の判定がNoである、つまり置換処理が未処理のサブシステムが存在する場合、処理はS432に移行する。 When the determination in S446 is Yes, that is, when the replacement processing of all the processing blocks is completed, the subcode generation unit 74 in S448 determines whether or not the replacement processing has been completed for the plurality of divided subsystems. do. If the determination in S448 is No, that is, if there is a subsystem in which the replacement process has not been processed, the process shifts to S432.

例えば、図7においてモデル100を分割したサブシステム130、40のうち、サブシステム130の置換処理が終了すると、サブシステム130と同様にサブシステム140の置換処理が実行される。サブシステム140の置換処理では、サブシステム130の置換処理で定義された入出力パラメータが使用される。 For example, among the subsystems 130 and 40 in which the model 100 is divided in FIG. 7, when the replacement process of the subsystem 130 is completed, the replacement process of the subsystem 140 is executed in the same manner as the subsystem 130. In the replacement process of the subsystem 140, the input / output parameters defined in the replacement process of the subsystem 130 are used.

そして、S448の判定がYesである、つまり、すべてのサブシステムの置換処理が終了すると、S450においてソースコード生成部76は、図15に示すように、生成されたサブソースコード212、214をまとめて、モデル100に対応するソースコード210を生成する。 Then, when the determination in S448 is Yes, that is, when the replacement processing of all the subsystems is completed, the source code generation unit 76 in S450 puts together the generated subsource codes 212 and 214 as shown in FIG. Then, the source code 210 corresponding to the model 100 is generated.

図15において、符号212がサブシステム130から生成されたサブソースコードであり、符号214がサブシステム140から生成されたサブソースコードである。
サブシステム140に対応するソースコード214の部分において、条件分岐ブロック126の判定であるif (in4s4t_tmp] != 0.0F)の判定結果が偽の場合、out1[s4t_tmp]には同じ値が代入されるので、分岐先の記述は追加されていない。
In FIG. 15, reference numeral 212 is a subsource code generated from the subsystem 130, and reference numeral 214 is a subsystem code generated from the subsystem 140.
In the part of the source code 214 corresponding to the subsystem 140, if the judgment result of if (in4s4t_tmp]! = 0.0F) which is the judgment of the conditional branch block 126 is false, the same value is assigned to out1 [s4t_tmp]. Therefore, the description of the branch destination has not been added.

図15に示すように、モデル100から分割されたサブシステム130、140において、元のソースコード200に対して、置換処理により生成されたサブソースコード212、214には関数定義は存在していない。そして、サブソースコード212、214は、反復と分岐と順接との処理だけで記述されている。 As shown in FIG. 15, in the subsystems 130 and 140 divided from the model 100, there is no function definition in the subsource codes 212 and 214 generated by the replacement process with respect to the original source code 200. .. The subsource codes 212 and 214 are described only by the processing of iteration, branching, and adjunct.

図3のS418で実行されるテストは、S412においてサブシステム130、140のそれぞれに対して生成されたテストケースで実行される。
[3.効果]
以上説明した上記実施形態では、以下の効果を得ることができる。
The test executed in S418 of FIG. 3 is executed in the test case generated for each of the subsystems 130 and 140 in S412.
[3. effect]
In the above-described embodiment, the following effects can be obtained.

(1)元のソースコード200に対して、置換処理により生成されたサブソースコード212、214には関数定義は存在しておらず、サブソースコード212、214は、反復と分岐と順接との処理だけで記述されている。したがって、サブソースコード212、214から生成されるソースコード210を実行するときに関数が呼び出されないので、ソースコード210の実行時間が増加することを抑制しつつ、サブシステム毎のテストケースを実行できる。 (1) There is no function definition in the sub-source codes 212 and 214 generated by the replacement process with respect to the original source code 200, and the sub-source codes 212 and 214 have iterations, branches and adjuncts. It is described only by the processing of. Therefore, since the function is not called when the source code 210 generated from the subsource codes 212 and 214 is executed, the test case for each subsystem is executed while suppressing the increase in the execution time of the source code 210. can.

(2)モデル100から分割されて、簡単化かつ小型化されたサブシステム130、140と、サブシステム130、140に対応して生成されたサブソースコード212、214との組み合わせに対して、それぞれのサブシステム130、140から生成されたテストケースによりテストを実行する。 (2) For each combination of the simplified and miniaturized subsystems 130 and 140 separated from the model 100 and the subsource codes 212 and 214 generated corresponding to the subsystems 130 and 140, respectively. The test is executed by the test cases generated from the subsystems 130 and 140 of.

サブシステム130、140はモデル12よりも簡単化かつ小型化されているので、生成されたテストケースにより実行されたテストのカバレッジは向上する。
上記実施形態において、S406、S414がカバレッジ判定部の処理に対応し、S430、S432が対応付け部の処理に対応し、S434がパラメータ定義部の処理に対応し、S436~S448がサブコード生成部の処理に対応し、S450がソースコード生成部の処理に対応する。
[4.他の実施形態]
(1)上記実施形態では、置換処理前のモデルであるモデル100を1回分割して生成されたサブシステム130、140のカバレッジが所定値以上になる例を説明した。
Since the subsystems 130 and 140 are simpler and smaller than the model 12, the coverage of the tests executed by the generated test cases is improved.
In the above embodiment, S406 and S414 correspond to the processing of the coverage determination unit, S430 and S432 correspond to the processing of the mapping unit, S434 corresponds to the processing of the parameter definition unit, and S436 to S448 correspond to the processing of the subcode generation unit. Corresponds to the processing of, and S450 corresponds to the processing of the source code generation unit.
[4. Other embodiments]
(1) In the above embodiment, an example has been described in which the coverage of the subsystems 130 and 140 generated by dividing the model 100, which is the model before the replacement process, once, becomes a predetermined value or more.

これに対し、分割して生成されたすべてのサブシステムのカバレッジが所定値以上になるまで、カバレッジが所定値未満のサブシステムをさらに分割して複数のサブシステムを生成してもよい。 On the other hand, until the coverage of all the divided and generated subsystems becomes the predetermined value or more, the subsystems whose coverage is less than the predetermined value may be further divided to generate a plurality of subsystems.

(2)上記実施形態では、ソースコード生成装置50のカバレッジ判定部64が、モデル100から取得する分割情報に基づいて、モデル100またはサブシステム130、140を分割して複数のサブシステムを生成した。 (2) In the above embodiment, the coverage determination unit 64 of the source code generator 50 divides the model 100 or the subsystems 130 and 140 based on the division information acquired from the model 100 to generate a plurality of subsystems. ..

これに対し、例えばオペレータが、ソースコード生成装置50のマウスまたはキーボード等の入力装置を操作してモデル100を分割してもよい。
(3)上記実施形態では、ソースコード生成装置50のカバレッジ判定部64が、モデル100から取得する分割情報に基づいて、モデル100またはサブシステム130、140を分割して複数のサブシステムを生成した。
On the other hand, for example, the operator may operate an input device such as a mouse or a keyboard of the source code generation device 50 to divide the model 100.
(3) In the above embodiment, the coverage determination unit 64 of the source code generator 50 divides the model 100 or the subsystems 130 and 140 based on the division information acquired from the model 100 to generate a plurality of subsystems. ..

これに対し、ソースコード生成装置50が、モデル100の構造を解析し、モデル100の分割箇所を決定する分割部を備えてもよい。
(4)上記実施形態における一つの構成要素が有する複数の機能を複数の構成要素によって実現したり、一つの構成要素が有する一つの機能を複数の構成要素によって実現したりしてもよい。また、複数の構成要素が有する複数の機能を一つの構成要素によって実現したり、複数の構成要素によって実現される一つの機能を一つの構成要素によって実現したりしてもよい。また、上記実施形態の構成の一部を省略してもよい。また、上記実施形態の構成の少なくとも一部を、他の上記実施形態の構成に対して付加または置換してもよい。尚、特許請求の範囲に記載した文言のみによって特定される技術思想に含まれるあらゆる態様が本開示の実施形態である。
(5)上述したソースコード生成装置の他、当該ソースコード生成装置を構成要素とするシステム、当該ソースコード生成装置としてコンピュータを機能させるためのソースコード生成プログラム、このソースコード生成プログラムを記録した記録媒体、ソースコード生成方法など、種々の形態で本開示を実現することもできる。
On the other hand, the source code generator 50 may include a division unit that analyzes the structure of the model 100 and determines the division location of the model 100.
(4) A plurality of functions possessed by one component in the above embodiment may be realized by a plurality of components, or one function possessed by one component may be realized by a plurality of components. Further, a plurality of functions possessed by the plurality of components may be realized by one component, or one function realized by the plurality of components may be realized by one component. Further, a part of the configuration of the above embodiment may be omitted. Further, at least a part of the configuration of the above embodiment may be added or replaced with the configuration of the other above embodiment. It should be noted that all aspects included in the technical idea specified only by the wording described in the claims are embodiments of the present disclosure.
(5) In addition to the above-mentioned source code generator, a system having the source code generator as a component, a source code generator for operating a computer as the source code generator, and a record of recording the source code generator. The present disclosure can also be realized in various forms such as a medium and a source code generation method.

50:ソースコード生成装置、64カバレッジ判定部、70:対応付け部、72:パラメータ定義部、74:サブコード生成部、76:ソースコード生成部、100:モデル、112:定数ブロック(処理ブロック)、120:乗算ブロック(処理ブロック)、122~126:条件分岐ブロック(処理ブロック)、128:遅延ブロック(処理ブロック)、130、140:サブシステム、200:元のソースコード、210:ソースコード、212、214:サブソースコード
50: Source code generation device, 64 coverage determination unit, 70: Correspondence unit, 72: Parameter definition unit, 74: Subcode generation unit, 76: Source code generation unit, 100: Model, 112: Constant block (processing block) , 120: Multiplication block (processing block), 122-126: Conditional branch block (processing block), 128: Delay block (processing block), 130, 140: Subsystem, 200: Original source code, 210: Source code, 212, 214: Sub source code

Claims (4)

入力データに対する処理を複数の処理ブロック(112、120~128)間におけるデータの入出力の仕様として記述されるモデル(12、100)から、前記モデルに対応するソースコード(14、210)を生成するソースコード生成装置(50)であって、
前記モデル(100)から生成されるテストケースを前記モデルに実行させたカバレッジが所定値未満の場合、前記モデルを分割して生成された複数のサブシステム(130、140)のそれぞれに対し、前記サブシステムから生成されるテストケースを実行させた前記カバレッジが所定値以上か否かを判定するように構成されたカバレッジ判定部(64、S406、S414)と、
前記複数のサブシステムの前記カバレッジがすべて前記所定値以上であると前記カバレッジ判定部が判定すると、前記サブシステム毎に、前記サブシステムに分割される前の前記モデルから生成された元のソースコード(200)と、前記処理ブロックおよび前記処理ブロックの入出力パラメータとを対応付けるように構成された対応付け部(70、S430、S432)と、
前記対応付け部が対応付けた結果において、前記元のソースコードで定義されていない前記入出力パラメータが存在すれば、前記サブシステム毎に、定義されていない前記入出力パラメータを定義するように構成されたパラメータ定義部(72、S434)と、
前記サブシステム毎に、前記対応付け部が対応付けた結果と前記パラメータ定義部が定義する前記入出力パラメータとに基づいて、前記サブシステムに対応するサブソースコード(212、214)を生成するように構成されたサブコード生成部(74、S436~S448)と、
前記サブコード生成部が生成する前記サブソースコードから、前記モデルに対応するソースコードを生成するように構成されたソースコード生成部(76、S450)と、
を備えるソースコード生成装置。
A source code (14, 210) corresponding to the model is generated from a model (12, 100) in which processing for input data is described as data input / output specifications between a plurality of processing blocks (112, 120 to 128). Source code generator (50)
When the coverage of the test case generated from the model (100) executed by the model is less than a predetermined value, the above-mentioned is applied to each of the plurality of subsystems (130, 140) generated by dividing the model. A coverage determination unit (64, S406, S414) configured to determine whether or not the coverage for executing a test case generated from a subsystem is equal to or higher than a predetermined value.
When the coverage determination unit determines that the coverage of the plurality of subsystems is all equal to or higher than the predetermined value, the original source code generated from the model before being divided into the subsystems for each of the subsystems. (200), an association unit (70, S430, S432) configured to associate the processing block and the input / output parameters of the processing block, and
If the input / output parameter that is not defined in the original source code exists in the result of the mapping by the mapping unit, the input / output parameter that is not defined is defined for each of the subsystems. Parameter definition unit (72, S434)
For each of the subsystems, the subsystem code (212, 214) corresponding to the subsystem is generated based on the result of the mapping by the mapping unit and the input / output parameters defined by the parameter definition unit. Subcode generators (74, S436-S448) configured in
A source code generation unit (76, S450) configured to generate a source code corresponding to the model from the sub-source code generated by the sub-code generation unit.
Source code generator equipped with.
請求項1に記載のソースコード生成装置であって、
前記カバレッジ判定部は、前記サブシステムに前記テストケースを実行させた前記カバレッジが所定値未満の場合、前記カバレッジが所定値未満の前記サブシステムをさらに分割して生成された複数のサブシステムのそれぞれに対し、生成されたテストケースを実行させた前記カバレッジが所定値以上であるか否かを判定するように構成されている、
ソースコード生成装置。
The source code generator according to claim 1.
When the coverage obtained by causing the subsystem to execute the test case is less than a predetermined value, the coverage determination unit is a plurality of subsystems generated by further dividing the subsystem having a coverage less than a predetermined value. On the other hand, it is configured to determine whether or not the coverage for executing the generated test case is equal to or higher than a predetermined value.
Source code generator.
請求項1または2に記載のソースコード生成装置であって、
前記サブコード生成部は、前記サブシステムにおいて後段の処理を実行する前記処理ブロックから順番に、前記パラメータ定義部が定義する前記入出力パラメータを使用して、前記元のソースコードに基づいて、前記処理ブロックの処理に対応する前記サブソースコードを生成するように構成されている、
ソースコード生成装置。
The source code generator according to claim 1 or 2.
The subcode generation unit uses the input / output parameters defined by the parameter definition unit in order from the processing block that executes the subsequent processing in the subsystem, and uses the input / output parameters defined by the parameter definition unit, based on the original source code. It is configured to generate the subsource code corresponding to the processing of the processing block,
Source code generator.
請求項3に記載のソースコード生成装置であって、
前記サブコード生成部は、前記処理ブロックが条件分岐の処理を実行し、いずれかの分岐先の処理に対応する記述が前記元のソースコードに存在しない場合、記述が存在しない分岐先の処理を表すサブコードを生成するように構成されている、
ソースコード生成装置。
The source code generator according to claim 3.
When the processing block executes the conditional branch processing and the description corresponding to the processing of one of the branch destinations does not exist in the original source code, the subcode generation unit performs the processing of the branch destination where the description does not exist. It is configured to generate the subcode that represents it,
Source code generator.
JP2018122141A 2018-06-27 2018-06-27 Source code generator Expired - Fee Related JP7059827B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2018122141A JP7059827B2 (en) 2018-06-27 2018-06-27 Source code generator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2018122141A JP7059827B2 (en) 2018-06-27 2018-06-27 Source code generator

Publications (2)

Publication Number Publication Date
JP2020004036A JP2020004036A (en) 2020-01-09
JP7059827B2 true JP7059827B2 (en) 2022-04-26

Family

ID=69100290

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2018122141A Expired - Fee Related JP7059827B2 (en) 2018-06-27 2018-06-27 Source code generator

Country Status (1)

Country Link
JP (1) JP7059827B2 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005301568A (en) 2004-04-09 2005-10-27 Denso Corp Display information storage control device and display information storage control program
JP2009294846A (en) 2008-06-04 2009-12-17 Denso Corp Test case generator, and test case generation program and method
JP2010250669A (en) 2009-04-17 2010-11-04 Denso Corp Test case generation device, object inspection device, and program
US9665350B1 (en) 2009-05-29 2017-05-30 The Mathworks, Inc. Automatic test generation for model-based code coverage

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01303533A (en) * 1988-05-31 1989-12-07 Toshiba Corp Measuring system for test comprehension rate

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005301568A (en) 2004-04-09 2005-10-27 Denso Corp Display information storage control device and display information storage control program
JP2009294846A (en) 2008-06-04 2009-12-17 Denso Corp Test case generator, and test case generation program and method
JP2010250669A (en) 2009-04-17 2010-11-04 Denso Corp Test case generation device, object inspection device, and program
US9665350B1 (en) 2009-05-29 2017-05-30 The Mathworks, Inc. Automatic test generation for model-based code coverage

Also Published As

Publication number Publication date
JP2020004036A (en) 2020-01-09

Similar Documents

Publication Publication Date Title
US10025696B2 (en) System and method for equivalence class analysis-based automated requirements-based test case generation
US10296447B2 (en) Automated software program repair
CN111104335B (en) A C language defect detection method and device based on multi-level analysis
US20090319829A1 (en) Pattern extraction method and apparatus
JP6316120B2 (en) Test case generation system and recording medium recording test case
US20110145799A1 (en) Path-sensitive dataflow analysis including path refinement
JP6878707B2 (en) Test equipment, test methods and test programs
JP6003699B2 (en) Test data generation program, method and apparatus
US10936474B2 (en) Software test program generation
JP2009169828A (en) Test case generation apparatus and test case generation program
He et al. Swe-perf: Can language models optimize code performance on real-world repositories?
JP2009294846A (en) Test case generator, and test case generation program and method
JP6002507B2 (en) Software verification program and software verification system
JP7059827B2 (en) Source code generator
WO2020194455A1 (en) Test case generation device, test case generation method, and test case generation program
JP2015069400A (en) Software test system
JP2010250669A (en) Test case generation device, object inspection device, and program
JPWO2019142266A1 (en) Test case generation device, test case generation method, and test case generation program
JP5811978B2 (en) Test case generation apparatus and test case generation method for model-based control apparatus
WO2021161426A1 (en) Program generation device, program generation method, and program
JP2009205239A (en) Software verification system
US20040111684A1 (en) Design method of logic circuit
JP6693898B2 (en) Test case generation method, computer and program
JPH0773044A (en) Optimizing compiling method and optimizing compiling device
JP6583033B2 (en) Driver generation program, apparatus, and method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20210218

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20220228

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20220315

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20220328

R151 Written notification of patent or utility model registration

Ref document number: 7059827

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

LAPS Cancellation because of no payment of annual fees