JP7040272B2 - Source code conversion program and source code conversion method - Google Patents

Source code conversion program and source code conversion method Download PDF

Info

Publication number
JP7040272B2
JP7040272B2 JP2018089902A JP2018089902A JP7040272B2 JP 7040272 B2 JP7040272 B2 JP 7040272B2 JP 2018089902 A JP2018089902 A JP 2018089902A JP 2018089902 A JP2018089902 A JP 2018089902A JP 7040272 B2 JP7040272 B2 JP 7040272B2
Authority
JP
Japan
Prior art keywords
source code
offload
description
tag
algorithm information
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.)
Active
Application number
JP2018089902A
Other languages
Japanese (ja)
Other versions
JP2019197308A (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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2018089902A priority Critical patent/JP7040272B2/en
Publication of JP2019197308A publication Critical patent/JP2019197308A/en
Application granted granted Critical
Publication of JP7040272B2 publication Critical patent/JP7040272B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Description

本発明は、ソースコード変換プログラムおよびソースコード変換方法に関する。 The present invention relates to a source code conversion program and a source code conversion method.

近年、高位合成等の回路合成技術の進歩により、CやC++等の汎用的なソフトウェア言語でハードウェア設計が行われる場合がある。このため、CPU(Central Processing Unit)で動作するアプリケーションを、高速化のためにFPGA(Field Programmable Gate Array)やGPU(Graphics Processing Unit)等のハードウェアにオフロードして動作させることが提案されている。ところが、多くのアプリケーションは、CPUを対象に記述されており、そのままの記述では、十分なハードウェア性能を引き出すことが難しい。 In recent years, due to advances in circuit synthesis technology such as high-level synthesis, hardware design may be performed in a general-purpose software language such as C or C ++. Therefore, it has been proposed to offload an application running on a CPU (Central Processing Unit) to hardware such as FPGA (Field Programmable Gate Array) or GPU (Graphics Processing Unit) for speeding up. There is. However, many applications are written for the CPU, and it is difficult to bring out sufficient hardware performance with the description as it is.

従って、アプリケーションのソースコードについて、アルゴリズムに対応する部分と、ハードウェアのアーキテクチャに対応する部分とに分類して設計し、これらを纏めてオフロード記述に書き換えることが求められる。このオフロード記述への書き換えは、データ構造の変更、関数呼び出しや繰り返し等の制御構造の変更が多いため自動化が難しく、多大な工数を掛けた人手作業で行うことが一般的である。 Therefore, it is required to design the source code of the application by classifying it into the part corresponding to the algorithm and the part corresponding to the hardware architecture, and rewrite these into the offload description. This rewriting to the offload description is difficult to automate because there are many changes in the data structure and control structures such as function calls and repetitions, and it is common to manually perform a large amount of man-hours.

国際公開第2017/056427号International Publication No. 2017/05/6427 特表2014-509106号公報Special Table 2014-509106 Gazette

一方、アプリケーションのソースコードは、バージョンアップやバグ修正等により、頻繁に更新される傾向にある。ソースコードの更新には、パッチと呼ばれるソースコードの差分情報が提供されることが多い。しかしながら、ハードウェアに合わせて書き換えたオフロード記述に対して、ソースコード用のパッチを適用することは困難である。このため、更新後のソースコードに対応するオフロード記述の書き換えは、人手作業で行われることになり、アプリケーションの更新頻度が高い場合、書き換えに掛かる工数が増大することになる。 On the other hand, the source code of an application tends to be updated frequently due to version upgrades and bug fixes. Source code updates are often provided with source code diffs called patches. However, it is difficult to apply a patch for source code to an offload description rewritten according to the hardware. Therefore, the rewriting of the offload description corresponding to the updated source code is performed manually, and if the application is frequently updated, the man-hours required for rewriting will increase.

一つの側面では、アプリケーションの更新があった際に対応するオフロード記述の更新効率を向上できるソースコード変換プログラムおよびソースコード変換方法を提供することにある。 One aspect is to provide a source code conversion program and a source code conversion method that can improve the update efficiency of the corresponding offload description when the application is updated.

一つの態様では、ソースコード変換プログラムは、ソースコードを有するアプリケーションに基づいて、ハードウェアで動作させるオフロード記述に対応する、前記アプリケーションのアルゴリズム情報の挿入箇所をタグで示すとともに前記ハードウェアのアーキテクチャを表すオフロード記述テンプレートを取得する処理をコンピュータに実行させる。ソースコード変換プログラムは、前記ソースコードが更新された場合、更新を反映したソースコードから、前記タグに対応するアルゴリズム情報を抽出する処理をコンピュータに実行させる。ソースコード変換プログラムは、抽出した前記アルゴリズム情報を前記オフロード記述テンプレートの対応する箇所に挿入して前記オフロード記述を更新する処理をコンピュータに実行させる。 In one embodiment, the source code conversion program is based on the application having the source code, and indicates the insertion point of the algorithm information of the application corresponding to the offload description operated by the hardware with a tag and the architecture of the hardware. Causes the computer to execute the process of acquiring the offload description template that represents. When the source code is updated, the source code conversion program causes a computer to execute a process of extracting algorithm information corresponding to the tag from the source code reflecting the update. The source code conversion program inserts the extracted algorithm information into the corresponding portion of the offload description template and causes the computer to execute a process of updating the offload description.

アプリケーションの更新があった際に対応するオフロード記述の更新効率を向上できる。 It is possible to improve the update efficiency of the corresponding offload description when the application is updated.

図1は、実施例の変換装置の構成の一例を示すブロック図である。FIG. 1 is a block diagram showing an example of the configuration of the conversion device of the embodiment. 図2は、ソースコードとオフロード記述の一例を示す図である。FIG. 2 is a diagram showing an example of source code and offload description. 図3は、アルゴリズム情報とオフロード記述テンプレートの一例を示す図である。FIG. 3 is a diagram showing an example of algorithm information and an offload description template. 図4は、抽出用タグの挿入の一例を示す図である。FIG. 4 is a diagram showing an example of inserting an extraction tag. 図5は、タグ挿入パッチの一例を示す図である。FIG. 5 is a diagram showing an example of a tag insertion patch. 図6は、アルゴリズム情報の一例を示す図である。FIG. 6 is a diagram showing an example of algorithm information. 図7は、グルーロジックの挿入の一例を示す図である。FIG. 7 is a diagram showing an example of inserting glue logic. 図8は、オフロード記述テンプレートの一例を示す図である。FIG. 8 is a diagram showing an example of an offload description template. 図9は、オフロード記述の生成の一例を示す図である。FIG. 9 is a diagram showing an example of generation of an offload description. 図10は、オフロード記述テンプレートの更新を要する場合におけるパッチプログラムの出力の一例を示す図である。FIG. 10 is a diagram showing an example of the output of the patch program when the offload description template needs to be updated. 図11は、抽象構文木における差分の一例を示す図である。FIG. 11 is a diagram showing an example of the difference in the abstract syntax tree. 図12は、抽象構文木を用いてアルゴリズム情報の抽出を行う場合の一例を示す図である。FIG. 12 is a diagram showing an example of a case where algorithm information is extracted using an abstract syntax tree. 図13は、プログラム言語変換の一例を示す図である。FIG. 13 is a diagram showing an example of programming language conversion. 図14は、実施例の初回抽出処理の一例を示すフローチャートである。FIG. 14 is a flowchart showing an example of the initial extraction process of the embodiment. 図15は、実施例の変換処理の一例を示すフローチャートである。FIG. 15 is a flowchart showing an example of the conversion process of the embodiment. 図16は、ソースコード変換プログラムを実行するコンピュータの一例を示す図である。FIG. 16 is a diagram showing an example of a computer that executes a source code conversion program.

以下、図面に基づいて、本願の開示するソースコード変換プログラムおよびソースコード変換方法の実施例を詳細に説明する。なお、本実施例により、開示技術が限定されるものではない。また、以下の実施例は、矛盾しない範囲で適宜組みあわせてもよい。 Hereinafter, examples of the source code conversion program and the source code conversion method disclosed in the present application will be described in detail with reference to the drawings. The disclosed technology is not limited by the present embodiment. In addition, the following examples may be appropriately combined as long as they do not contradict each other.

図1は、実施例の変換装置の構成の一例を示すブロック図である。図1に示す変換装置100は、アプリケーション(以下、アプリともいう。)のソースコードをハードウェア記述に変換する処理を行う情報処理装置の一例である。変換装置100は、ソースコードを有するアプリケーションに基づいて、ハードウェアで動作させるオフロード記述に対応するオフロード記述テンプレートを取得する。オフロード記述テンプレートは、アプリケーションのアルゴリズム情報の挿入箇所をタグで示すとともにハードウェアのアーキテクチャを表すものである。変換装置100は、ソースコードが更新された場合、更新を反映したソースコードから、タグに対応するアルゴリズム情報を抽出する。変換装置100は、抽出したアルゴリズム情報をオフロード記述テンプレートの対応する箇所に挿入してオフロード記述を更新する。これにより、変換装置100は、アプリケーションの更新があった際に対応するオフロード記述の更新効率を向上できる。 FIG. 1 is a block diagram showing an example of the configuration of the conversion device of the embodiment. The conversion device 100 shown in FIG. 1 is an example of an information processing device that performs a process of converting a source code of an application (hereinafter, also referred to as an application) into a hardware description. The conversion device 100 acquires an offload description template corresponding to the offload description to be operated by the hardware based on the application having the source code. The offload description template indicates the insertion point of the algorithm information of the application with a tag and represents the hardware architecture. When the source code is updated, the conversion device 100 extracts the algorithm information corresponding to the tag from the source code reflecting the update. The conversion device 100 inserts the extracted algorithm information into the corresponding portion of the offload description template to update the offload description. As a result, the conversion device 100 can improve the update efficiency of the corresponding offload description when the application is updated.

まず、図2および図3を用いてソースコードとオフロード記述について説明する。図2は、ソースコードとオフロード記述の一例を示す図である。図2に示すソースコード10およびオフロード記述11は、それぞれ同じ処理を行うものである。なお、ソースコード10は、Cで記述されており、オフロード記述11は、SystemCで記述されている。また、オフロード記述11は、対象ハードウェアに実装するプログラム、または、回路データのコンパイル可能なソースコードである。 First, the source code and the offload description will be described with reference to FIGS. 2 and 3. FIG. 2 is a diagram showing an example of source code and offload description. The source code 10 and the offload description 11 shown in FIG. 2 perform the same processing. The source code 10 is described in C, and the offload description 11 is described in SystemC. Further, the offload description 11 is a program implemented in the target hardware or a compileable source code of circuit data.

オフロード記述11は、ハードウェア上のアーキテクチャを表現するため、記述12~14に示す点がソースコード10と異なっている。記述12は、入出力に関する記述であり、ソースコード10ではポインタ変数、オフロード記述11ではFIFO(First In First Out)変数となっている。記述13は、ループ構造に関する記述であり、ソースコード10では3個のfor文、オフロード記述11では1個のwhile文となっている。記述14は、変数名や変数へのアクセスに関する記述であり、記述12,13に起因するものである。 Since the offload description 11 expresses the architecture on the hardware, the points shown in the descriptions 12 to 14 are different from the source code 10. Description 12 is a description relating to input / output, and is a pointer variable in the source code 10 and a FIFO (First In First Out) variable in the offload description 11. The description 13 is a description relating to the loop structure, and is three for statements in the source code 10 and one while statement in the offload description 11. The description 14 is a description relating to the variable name and the access to the variable, and is derived from the descriptions 12 and 13.

図3は、アルゴリズム情報とオフロード記述テンプレートの一例を示す図である。図3に示すオフロード記述15は、アルゴリズム情報16とオフロード記述テンプレート17とに分類することができる。アルゴリズム情報16は、オフロード記述15の中でデータに対する演算を行っている箇所を示す。オフロード記述テンプレート17は、オフロード記述15の中で入出力とメモリの宣言文、入出力とメモリへのアクセス、および、入出力とメモリへのアクセスを含む制御文を示す。制御文には、例えば、for文、while文、until文の様なループや、if文、else文、switch文の様な条件分岐が含まれる。 FIG. 3 is a diagram showing an example of algorithm information and an offload description template. The offload description 15 shown in FIG. 3 can be classified into the algorithm information 16 and the offload description template 17. The algorithm information 16 indicates a part of the offload description 15 where an operation is performed on the data. The offload description template 17 indicates in the offload description 15 a control statement including input / output and memory declaration statements, input / output and memory access, and input / output and memory access. The control statement includes, for example, a loop such as a for statement, a while statement, and a until statement, and a conditional branch such as an if statement, an else statement, and a switch statement.

次に、変換装置100の構成について説明する。図1に示すように、変換装置100は、通信部110と、表示部111と、操作部112と、記憶部120と、制御部130とを有する。なお、変換装置100は、図1に示す機能部以外にも既知のコンピュータが有する各種の機能部、例えば各種の入力デバイスや音声出力デバイス等の機能部を有することとしてもかまわない。 Next, the configuration of the conversion device 100 will be described. As shown in FIG. 1, the conversion device 100 includes a communication unit 110, a display unit 111, an operation unit 112, a storage unit 120, and a control unit 130. In addition to the functional units shown in FIG. 1, the conversion device 100 may have various functional units of known computers, such as various input devices and audio output devices.

通信部110は、例えば、NIC(Network Interface Card)等によって実現される。通信部110は、図示しないネットワークを介して他の情報処理装置と有線または無線で接続され、他の情報処理装置との間で情報の通信を司る通信インタフェースである。通信部110は、例えば、他の端末からソースコードの更新パッチを受信する。また、通信部110は、他の端末に、更新後のオフロード記述を送信する。 The communication unit 110 is realized by, for example, a NIC (Network Interface Card) or the like. The communication unit 110 is a communication interface that is connected to another information processing device by wire or wirelessly via a network (not shown) and controls information communication with the other information processing device. The communication unit 110 receives, for example, a source code update patch from another terminal. Further, the communication unit 110 transmits the updated offload description to another terminal.

表示部111は、各種情報を表示するための表示デバイスである。表示部111は、例えば、表示デバイスとして液晶ディスプレイ等によって実現される。表示部111は、制御部130から入力された表示画面等の各種画面を表示する。 The display unit 111 is a display device for displaying various information. The display unit 111 is realized by, for example, a liquid crystal display or the like as a display device. The display unit 111 displays various screens such as a display screen input from the control unit 130.

操作部112は、変換装置100のユーザから各種操作を受け付ける入力デバイスである。操作部112は、例えば、入力デバイスとして、キーボードやマウス等によって実現される。操作部112は、ユーザによって入力された操作を操作情報として制御部130に出力する。なお、操作部112は、入力デバイスとして、タッチパネル等によって実現されるようにしてもよく、表示部111の表示デバイスと、操作部112の入力デバイスとは、一体化されるようにしてもよい。 The operation unit 112 is an input device that receives various operations from the user of the conversion device 100. The operation unit 112 is realized by, for example, a keyboard, a mouse, or the like as an input device. The operation unit 112 outputs the operation input by the user to the control unit 130 as operation information. The operation unit 112 may be realized by a touch panel or the like as an input device, or the display device of the display unit 111 and the input device of the operation unit 112 may be integrated.

記憶部120は、例えば、RAM(Random Access Memory)、フラッシュメモリ(Flash Memory)等の半導体メモリ素子、ハードディスクや光ディスク等の記憶装置によって実現される。記憶部120は、ソースコード記憶部121と、タグ挿入パッチ記憶部122と、テンプレート記憶部123と、アルゴリズム情報記憶部124と、オフロード記述記憶部125とを有する。また、記憶部120は、制御部130での処理に用いる情報を記憶する。 The storage unit 120 is realized by, for example, a semiconductor memory element such as a RAM (Random Access Memory) or a flash memory (Flash Memory), or a storage device such as a hard disk or an optical disk. The storage unit 120 includes a source code storage unit 121, a tag insertion patch storage unit 122, a template storage unit 123, an algorithm information storage unit 124, and an offload description storage unit 125. Further, the storage unit 120 stores information used for processing in the control unit 130.

ソースコード記憶部121は、アプリのソースコードを記憶する。また、ソースコード記憶部121は、ソースコードの更新パッチによって更新されたソースコードを記憶する。 The source code storage unit 121 stores the source code of the application. Further, the source code storage unit 121 stores the source code updated by the source code update patch.

タグ挿入パッチ記憶部122は、ソースコードのアルゴリズムが記述された部分を特定する抽出用タグを挿入するためのタグ挿入パッチを記憶する。なお、初回のタグ挿入パッチは、初版のソースコードと、初版のソースコードに人手作業にて抽出用タグを挿入されたタグ挿入済みソースコードとに基づいて生成される。また、初版のソースコードとは、オフロード記述の生成が最初という意味であり、初版のソースコードには、アプリ自体の版数としては任意の版数のものを用いてもよい。 The tag insertion patch storage unit 122 stores a tag insertion patch for inserting an extraction tag that specifies a portion in which a source code algorithm is described. The first tag insertion patch is generated based on the source code of the first edition and the source code with the tag inserted by manually inserting the extraction tag into the source code of the first edition. Further, the source code of the first edition means that the offload description is generated first, and the source code of the first edition may be any version of the application itself.

テンプレート記憶部123は、オフロード記述テンプレートを記憶する。オフロード記述テンプレートは、アプリのアルゴリズム情報の挿入箇所をタグで示すとともに、ハードウェアのアーキテクチャを表すものである。 The template storage unit 123 stores the offload description template. The offload description template indicates the insertion point of the algorithm information of the application with a tag and represents the architecture of the hardware.

アルゴリズム情報記憶部124は、ソースコードのアルゴリズム部分を抽出したアルゴリズム情報を記憶する。 The algorithm information storage unit 124 stores the algorithm information obtained by extracting the algorithm portion of the source code.

オフロード記述記憶部125は、オフロード記述テンプレートとアルゴリズム情報とに基づいて生成されたオフロード記述を記憶する。 The offload description storage unit 125 stores the offload description generated based on the offload description template and the algorithm information.

制御部130は、例えば、CPUやMPU(Micro Processing Unit)等によって、内部の記憶装置に記憶されているプログラムがRAMを作業領域として実行されることにより実現される。また、制御部130は、例えば、ASIC(Application Specific Integrated Circuit)やFPGA等の集積回路により実現されるようにしてもよい。制御部130は、取得部131と、抽出部132と、更新部133とを有し、以下に説明する情報処理の機能や作用を実現または実行する。なお、制御部130の内部構成は、図1に示した構成に限られず、後述する情報処理を行う構成であれば他の構成であってもよい。 The control unit 130 is realized by, for example, using a CPU, an MPU (Micro Processing Unit), or the like to execute a program stored in an internal storage device using the RAM as a work area. Further, the control unit 130 may be realized by, for example, an integrated circuit such as an ASIC (Application Specific Integrated Circuit) or an FPGA. The control unit 130 has an acquisition unit 131, an extraction unit 132, and an update unit 133, and realizes or executes the functions and operations of information processing described below. The internal configuration of the control unit 130 is not limited to the configuration shown in FIG. 1, and may be any other configuration as long as it is configured to perform information processing described later.

取得部131は、例えば、通信部110を介して、他の端末から初版のソースコード、タグ挿入済みソースコードおよびオフロード記述テンプレートを取得する。取得部131は、取得した初版のソースコードおよびオフロード記述テンプレートを、それぞれソースコード記憶部121およびテンプレート記憶部123に記憶する。ここで取得するタグ挿入済みソースコードは、初版のソースコードに人手作業にて抽出用タグを挿入されたものである。また、ここで取得するオフロード記述テンプレートは、初版のソースコードから人手作業にて生成されたオフロード記述に対して、アルゴリズム情報に代えて挿入箇所を示すタグを記述したものである。 The acquisition unit 131 acquires the first edition source code, the tag-inserted source code, and the offload description template from another terminal, for example, via the communication unit 110. The acquisition unit 131 stores the acquired first edition source code and the offload description template in the source code storage unit 121 and the template storage unit 123, respectively. The tag-inserted source code acquired here is the source code of the first edition with the extraction tag manually inserted. In addition, the offload description template acquired here describes a tag indicating the insertion point instead of the algorithm information for the offload description manually generated from the source code of the first edition.

取得部131は、初版のソースコードおよびタグ挿入済みソースコードに基づいて、タグ挿入パッチを生成する。取得部131は、生成したタグ挿入パッチをタグ挿入パッチ記憶部122に記憶する。 The acquisition unit 131 generates a tag insertion patch based on the source code of the first edition and the source code in which the tag has been inserted. The acquisition unit 131 stores the generated tag insertion patch in the tag insertion patch storage unit 122.

抽出部132は、例えば、通信部110を介して、他の端末からソースコード更新パッチを取得する。抽出部132は、ソースコード記憶部121からパッチ対象のソースコードを読み出し、読み出したソースコードに対してソースコード更新パッチを適用する。つまり、抽出部132は、ソースコード更新パッチに基づいて、ソースコードを更新する。抽出部132は、更新したソースコードをソースコード記憶部121に記憶する。 The extraction unit 132 acquires a source code update patch from another terminal, for example, via the communication unit 110. The extraction unit 132 reads the source code to be patched from the source code storage unit 121, and applies the source code update patch to the read source code. That is, the extraction unit 132 updates the source code based on the source code update patch. The extraction unit 132 stores the updated source code in the source code storage unit 121.

抽出部132は、タグ挿入パッチ記憶部122を参照し、更新したソースコードにタグ挿入パッチを適用する。なお、タグ挿入パッチは、差分情報であるので、ソースコードが更新されても高い確率でタグ挿入箇所を特定できる。抽出部132は、タグ挿入パッチを適用できたか否かを判定する。抽出部132は、タグ挿入パッチを適用できないと判定した場合には、オフロード記述テンプレートの更新を要する旨のメッセージを表示部111に出力して表示させる。 The extraction unit 132 refers to the tag insertion patch storage unit 122, and applies the tag insertion patch to the updated source code. Since the tag insertion patch is difference information, the tag insertion location can be specified with high probability even if the source code is updated. The extraction unit 132 determines whether or not the tag insertion patch has been applied. When the extraction unit 132 determines that the tag insertion patch cannot be applied, it outputs a message to the effect that the offload description template needs to be updated and displays it on the display unit 111.

一方、抽出部132は、タグ挿入パッチを適用できると判定した場合には、タグ挿入済みソースコードを生成する。また、抽出部132は、オフロード記述テンプレートの更新が不要である旨のメッセージを表示部111に出力して表示させる。なお、抽出部132は、タグ挿入パッチに代えて、ソースコードのアルゴリズム情報の抽象構文木を用いて、タグ挿入済みソースコードを生成するようにしてもよい。パッチでは、ソースコードの行、インデント、引数の名前等が一致していないと使えない場合がある。一方、抽象構文木では、多少記述が変わっていてもアルゴリズム情報を抽出してタグ挿入済みソースコードを生成することができる。 On the other hand, when it is determined that the tag insertion patch can be applied, the extraction unit 132 generates the tag-inserted source code. Further, the extraction unit 132 outputs a message to the effect that the offload description template does not need to be updated to the display unit 111 and displays it. The extraction unit 132 may generate the tag-inserted source code by using the abstract syntax tree of the algorithm information of the source code instead of the tag insertion patch. In the patch, it may not be possible to use it unless the source code line, indentation, argument name, etc. match. On the other hand, in the abstract syntax tree, it is possible to extract the algorithm information and generate the tagged source code even if the description is slightly changed.

抽出部132は、生成したタグ挿入済みソースコードからアルゴリズム情報を抽出する。つまり、抽出部132は、タグ挿入済みソースコードのうち、タグで囲まれた箇所を抽出することでアルゴリズム情報を抽出する。抽出部132は、抽出したアルゴリズム情報をアルゴリズム情報記憶部124に記憶する。抽出部132は、アルゴリズム情報をアルゴリズム情報記憶部124に記憶すると、更新指示を更新部133に出力する。 The extraction unit 132 extracts the algorithm information from the generated source code with the tag inserted. That is, the extraction unit 132 extracts the algorithm information by extracting the part surrounded by the tag in the tag-inserted source code. The extraction unit 132 stores the extracted algorithm information in the algorithm information storage unit 124. When the extraction unit 132 stores the algorithm information in the algorithm information storage unit 124, the extraction unit 132 outputs an update instruction to the update unit 133.

言い換えると、抽出部132は、ソースコードが更新された場合、更新を反映したソースコードから、タグに対応するアルゴリズム情報を抽出する。また、抽出部132は、ソースコードが更新された場合、更新を反映したソースコードに、アルゴリズム情報の抽出用タグを挿入し、タグに対応するアルゴリズム情報を抽出する。また、抽出部132は、アルゴリズム情報の抽出用タグを挿入するパッチを用いて、抽出用タグを挿入する。また、抽出部132は、アルゴリズム情報の抽象構文木を用いて、抽出用タグを挿入する。また、抽出部132は、更新を反映したソースコードに、アルゴリズム情報の抽出用タグを挿入できない箇所がある場合、オフロード記述テンプレートの更新を要する旨を通知する。 In other words, when the source code is updated, the extraction unit 132 extracts the algorithm information corresponding to the tag from the source code reflecting the update. Further, when the source code is updated, the extraction unit 132 inserts a tag for extracting algorithm information into the source code reflecting the update, and extracts the algorithm information corresponding to the tag. Further, the extraction unit 132 inserts the extraction tag by using a patch for inserting the extraction tag of the algorithm information. Further, the extraction unit 132 inserts an extraction tag using an abstract syntax tree of algorithm information. Further, the extraction unit 132 notifies that the offload description template needs to be updated when there is a part in the source code reflecting the update where the tag for extracting the algorithm information cannot be inserted.

更新部133は、抽出部132から更新指示が入力されると、テンプレート記憶部123およびアルゴリズム情報記憶部124から、それぞれオフロード記述テンプレートおよびアルゴリズム情報を読み出す。更新部133は、読み出したオフロード記述テンプレートのタグ部分にアルゴリズム情報を挿入してオフロード記述を生成する。更新部133は、生成したオフロード記述をオフロード記述記憶部125に記憶する。 When the update instruction is input from the extraction unit 132, the update unit 133 reads the offload description template and the algorithm information from the template storage unit 123 and the algorithm information storage unit 124, respectively. The update unit 133 inserts the algorithm information into the tag portion of the read offload description template to generate the offload description. The update unit 133 stores the generated offload description in the offload description storage unit 125.

ここで、図4から図9を用いて、ソースコードからオフロード記述への変換の具体例について説明する。図4は、抽出用タグの挿入の一例を示す図である。図4に示すソースコード10は、行番号L6,L9,L12がアルゴリズム部分であるとする。ソースコード10が初版のソースコードである場合には、人手作業によりアルゴリズム情報の抽出用タグが挿入され、タグ挿入済みソースコード18が生成される。ソースコード10が二版以降のソースコードである場合には、抽出部132が、タグ挿入パッチを適用することで、タグ挿入済みソースコード18を生成する。 Here, a specific example of the conversion from the source code to the offload description will be described with reference to FIGS. 4 to 9. FIG. 4 is a diagram showing an example of inserting an extraction tag. In the source code 10 shown in FIG. 4, line numbers L6, L9, and L12 are assumed to be algorithm parts. When the source code 10 is the source code of the first edition, the tag for extracting the algorithm information is manually inserted, and the tag-inserted source code 18 is generated. When the source code 10 is the source code of the second edition or later, the extraction unit 132 generates the tag-inserted source code 18 by applying the tag insertion patch.

アルゴリズム情報の抽出用タグは、アルゴリズム部分の箇所ごとに関数ペアで囲む。つまり、抽出用タグは、例えば、「//_OFFLOAD_BEGIN()」と「//_OFFLOAD_END()」の関数ペアの呼び出しで表現する。また、関数ペアの引数には、アルゴリズム部分の箇所を識別するために、例えば、「offload_1」、「offload_2」、「offload_3」といったIDを与える。 The tag for extracting algorithm information is enclosed in a function pair for each part of the algorithm. That is, the extraction tag is expressed by, for example, calling the function pair of "// _OFFLOAD_BEGIN ()" and "// _ OFFLOAD_END ()". Further, in order to identify the part of the algorithm part, IDs such as "offload_1", "offload_2", and "offload_3" are given to the argument of the function pair.

図5は、タグ挿入パッチの一例を示す図である。図5に示すタグ挿入パッチ19は、初版のソースコードと、タグ挿入済みソースコードとの差分をdiffプログラムによって求めることで生成できる。抽出部132は、一度、差分情報であるタグ挿入パッチ19を生成すると、二版以降のソースコードに、パッチ(patch)プログラムを用いてタグ挿入パッチ19を適用することで、二版以降に対応するタグ挿入済みソースコードを生成できる。 FIG. 5 is a diagram showing an example of a tag insertion patch. The tag insertion patch 19 shown in FIG. 5 can be generated by obtaining the difference between the source code of the first edition and the source code in which the tag has been inserted by a diff program. Once the tag insertion patch 19 which is the difference information is generated, the extraction unit 132 corresponds to the second and subsequent editions by applying the tag insertion patch 19 to the source code of the second and subsequent editions using a patch program. You can generate source code with tags inserted.

図6は、アルゴリズム情報の一例を示す図である。図6に示すアルゴリズム情報20は、タグ挿入済みソースコードから抽出用タグの関数ペアで囲まれた箇所を、抽出用タグのIDと対応付けたものである。抽出部132は、例えば、図4に示すタグ挿入済みソースコード18から、「//_OFFLOAD_BEGIN(offload_1)」と「//_OFFLOAD_END(offload_1)」の関数ペアで囲まれた「c[i]=a[i]+b[i];」をアルゴリズムとして抽出する。抽出部132は、例えば、アルゴリズム情報20に示すように、アルゴリズム部分の箇所を識別するIDを引数にとるタグ「//_OFFLOAD_BODY(offload_1)」に続いて抽出したアルゴリズム「c[i]=a[i]+b[i];」をコピーする。抽出部132は、ID「offload_2」、「offload_3」についても同様にアルゴリズムを抽出し、タグと対応付けてコピーして、アルゴリズム情報20を生成する。 FIG. 6 is a diagram showing an example of algorithm information. The algorithm information 20 shown in FIG. 6 corresponds the portion surrounded by the function pair of the extraction tag from the tag-inserted source code with the ID of the extraction tag. The extraction unit 132 is, for example, from the tag-inserted source code 18 shown in FIG. 4, “c [i] = a” surrounded by the function pairs of “// _OFFLOAD_BEGIN (offload_1)” and “// _OFFLOAD_END (offload_1)”. [i] + b [i]; "is extracted as an algorithm. For example, as shown in the algorithm information 20, the extraction unit 132 extracts the algorithm "c [i] = a [" following the tag "// _OFFLOAD_BODY (offload_1)" that takes an ID for identifying the part of the algorithm part as an argument. Copy "i] + b [i];". The extraction unit 132 similarly extracts the algorithm for the IDs “offload_2” and “offload_3” and copies them in association with the tag to generate the algorithm information 20.

図7は、グルーロジックの挿入の一例を示す図である。図7に示すオフロード記述11は、ソースコード10から人手により書き換え作業が行われた直後の生のオフロード記述である。一方、アルゴリズム情報20は、ソースコード10から抽出されたものであるため、オフロード記述11とはアルゴリズム部分の記述についても一対一の対応が取れない状態である。このため、人手作業によりアルゴリズム情報20の記述を直接オフロード記述に挿入できるように、橋渡しをするグルーロジックを挿入する。オフロード記述21は、オフロード記述11に対してグルーロジックの挿入を行うことでアルゴリズム情報20と整合性をとったものである。 FIG. 7 is a diagram showing an example of inserting glue logic. The offload description 11 shown in FIG. 7 is a raw offload description immediately after the rewriting work is manually performed from the source code 10. On the other hand, since the algorithm information 20 is extracted from the source code 10, there is no one-to-one correspondence with the offload description 11 regarding the description of the algorithm part. Therefore, a glue logic for bridging is inserted so that the description of the algorithm information 20 can be directly inserted into the offload description by manual work. The offload description 21 is consistent with the algorithm information 20 by inserting glue logic into the offload description 11.

グルーロジックの挿入は、例えば、(1)要素数「1」の配列を定義、(2)ループ変数を定義、(3)入出力(FIFO)のアクセス関数に置換の3つのステップを行う。図7の例では、(1)として、オフロード記述11に、a[1],b[1],c[1],d[1],x[1]を定義する。(2)として、オフロード記述11に、i=0,j=0,k=0を定義する。(3)として、オフロード記述11のFIFOのアクセス方法を、afifo.read(),bfifo.read(),xfifo.write()に置換する。なお、グルーロジック自体は、高位合成ツールの最適化機能により削除される可能性が高く、性能劣化の原因にはなりにくいと考えられる。 Glue logic insertion involves, for example, three steps: (1) defining an array with the number of elements "1", (2) defining a loop variable, and (3) replacing it with an input / output (FIFO) access function. In the example of FIG. 7, as (1), a [1], b [1], c [1], d [1], and x [1] are defined in the offload description 11. As (2), i = 0, j = 0, and k = 0 are defined in the offload description 11. As (3), the access method of the FIFO of the offload description 11 is replaced with afifo.read (), bfifo.read (), xfifo.write (). Glue logic itself is likely to be deleted by the optimization function of the high-level synthesis tool, and it is considered that it is unlikely to cause performance deterioration.

図8は、オフロード記述テンプレートの一例を示す図である。図8に示すオフロード記述テンプレート22は、オフロード記述21からタグ「//_OFFLOAD_BODY()」を残してアルゴリズムの記述を削除したものである。つまり、オフロード記述21のタグ「//_OFFLOAD_BODY()」以外の記述は、ハードウェアのアーキテクチャを表す記述である。 FIG. 8 is a diagram showing an example of an offload description template. The offload description template 22 shown in FIG. 8 is obtained by deleting the algorithm description from the offload description 21 by leaving the tag “// _OFFLOAD_BODY ()”. That is, the description other than the tag "// _OFFLOAD_BODY ()" of the offload description 21 is a description representing the hardware architecture.

図9は、オフロード記述の生成の一例を示す図である。図9に示すように、更新部133は、オフロード記述テンプレート22の各タグ「//_OFFLOAD_BODY()」に対して、アルゴリズム情報20の対応するIDのアルゴリズムの記述を挿入し、オフロード記述23を生成する。なお、図9の説明では、ソースコード10から抽出したアルゴリズム情報20を用いたので、オフロード記述23は、オフロード記述21と同じ記述となったが、更新されたソースコードに基づくアルゴリズム情報を用いれば、更新が適用されたオフロード記述となる。 FIG. 9 is a diagram showing an example of generation of an offload description. As shown in FIG. 9, the update unit 133 inserts the algorithm description of the corresponding ID of the algorithm information 20 into each tag “// _OFFLOAD_BODY ()” of the offload description template 22, and the offload description 23. To generate. In the explanation of FIG. 9, since the algorithm information 20 extracted from the source code 10 is used, the offload description 23 has the same description as the offload description 21, but the algorithm information based on the updated source code is used. If used, it will be an offload description to which the update has been applied.

図10は、オフロード記述テンプレートの更新を要する場合におけるパッチプログラムの出力の一例を示す図である。図10に示すメッセージ24は、抽出部132においてタグ挿入パッチを適用できないと判定した場合に出力するメッセージの一例である。メッセージ24は、パッチプログラムが失敗した場合のメッセージであり、「FAILED」を含んだ警告メッセージである。抽出部132は、タグ挿入パッチを適用できないと判定した場合に、メッセージ24を表示してもよいし、メッセージ24に基づいて、例えば「オフロード記述テンプレートの更新が必要です。」といったメッセージを表示するようにしてもよい。なお、抽出部132は、タグ挿入パッチを適用できると判定した場合には、例えば「オフロード記述テンプレートの更新は不要です。」といったメッセージを表示する。 FIG. 10 is a diagram showing an example of the output of the patch program when the offload description template needs to be updated. The message 24 shown in FIG. 10 is an example of a message to be output when the extraction unit 132 determines that the tag insertion patch cannot be applied. The message 24 is a message when the patch program fails, and is a warning message including "FAIRLED". When the extraction unit 132 determines that the tag insertion patch cannot be applied, the message 24 may be displayed, or a message such as "The offload description template needs to be updated" is displayed based on the message 24. You may try to do it. When the extraction unit 132 determines that the tag insertion patch can be applied, it displays a message such as "It is not necessary to update the offload description template."

続いて、図11から図13を用いて、タグ挿入パッチに代えて、ソースコードのアルゴリズム情報の抽象構文木を用いる場合について説明する。図11は、抽象構文木における差分の一例を示す図である。図11に示すソースコード25は、Cによる記述であり、抽象構文木26は、ソースコード25に対応する。また、ソースコード27は、ソースコード25を更新するソースコードである。抽象構文木28は、ソースコード27に対応する。ソースコード25とソースコード27とを比較すると、演算子「+」が「*」に更新されている。一方、抽象構文木26と抽象構文木28とを比較すると、演算子に関する記述29aが記述29bに更新されていることがわかる。つまり、記述29a,29bが抽象構文木における差分となる。 Subsequently, the case where the abstract syntax tree of the algorithm information of the source code is used instead of the tag insertion patch will be described with reference to FIGS. 11 to 13. FIG. 11 is a diagram showing an example of the difference in the abstract syntax tree. The source code 25 shown in FIG. 11 is described in C, and the abstract syntax tree 26 corresponds to the source code 25. Further, the source code 27 is a source code for updating the source code 25. The abstract syntax tree 28 corresponds to the source code 27. Comparing the source code 25 and the source code 27, the operator "+" is updated to "*". On the other hand, when the abstract syntax tree 26 and the abstract syntax tree 28 are compared, it can be seen that the description 29a relating to the operator is updated to the description 29b. That is, the descriptions 29a and 29b are the differences in the abstract syntax tree.

図12は、抽象構文木を用いてアルゴリズム情報の抽出を行う場合の一例を示す図である。図12の例では、抽出部132は、Cで記述されているソースコード30を抽象構文木31に変換し、アルゴリズムに対応する記述32を探索する。記述32は、ソースコード30の関数main中の変数xへの代入文に対応する。抽出部132は、記述32に基づいて、アルゴリズム情報33を抽出する。なお、アルゴリズム情報33では、タグは省略している。抽出部132は、抽出したアルゴリズム情報33に基づいて、タグ挿入済みソースコードを生成する。このように、抽象構文木を用いる場合、パッチの様な行単位ではなく、プログラム言語の文法単位でアルゴリズム箇所を特定できる。また、抽出部132は、抽象構文木を用いることで、プログラム言語変換を行うこともできる。 FIG. 12 is a diagram showing an example of a case where algorithm information is extracted using an abstract syntax tree. In the example of FIG. 12, the extraction unit 132 converts the source code 30 described in C into an abstract syntax tree 31 and searches for the description 32 corresponding to the algorithm. The description 32 corresponds to the assignment statement to the variable x in the function main of the source code 30. The extraction unit 132 extracts the algorithm information 33 based on the description 32. In the algorithm information 33, the tag is omitted. The extraction unit 132 generates the tag-inserted source code based on the extracted algorithm information 33. In this way, when the abstract syntax tree is used, the algorithm part can be specified not in the line unit like the patch but in the grammar unit of the programming language. Further, the extraction unit 132 can also perform programming language conversion by using an abstract syntax tree.

図13は、プログラム言語変換の一例を示す図である。図13は、FORTRANのソースコード34をCで記述されたアルゴリズム情報37に変換する場合の一例である。抽出部132は、ソースコード34を抽象構文木35に変換し、アルゴリズムに対応する記述36を探索する。記述36は、ソースコード34の関数main中の変数xへの代入文に対応する。抽出部132は、記述36に基づいて、アルゴリズム情報37を抽出する。抽出部132は、アルゴリズム情報37をCで記述されたソースコードのテンプレートに挿入することで、FORTRANからCに言語変換を行うことができる。なお、抽出部132は、アルゴリズム情報37に基づいて、オフロード記述を生成してもよい。 FIG. 13 is a diagram showing an example of programming language conversion. FIG. 13 is an example of converting the FORTRAN source code 34 into the algorithm information 37 described in C. The extraction unit 132 converts the source code 34 into an abstract syntax tree 35 and searches for the description 36 corresponding to the algorithm. The description 36 corresponds to the assignment statement to the variable x in the function main of the source code 34. The extraction unit 132 extracts the algorithm information 37 based on the description 36. The extraction unit 132 can perform language conversion from FORTRAN to C by inserting the algorithm information 37 into the template of the source code described in C. The extraction unit 132 may generate an offload description based on the algorithm information 37.

次に、実施例の変換装置100の動作について説明する。まず、図14を用いて初回抽出処理について説明する。図14は、実施例の初回抽出処理の一例を示すフローチャートである。 Next, the operation of the conversion device 100 of the embodiment will be described. First, the initial extraction process will be described with reference to FIG. FIG. 14 is a flowchart showing an example of the initial extraction process of the embodiment.

取得部131は、例えば、他の端末から初版のソースコード、タグ挿入済みソースコードおよびオフロード記述テンプレートを取得する(ステップS1)。取得部131は、取得した初版のソースコードおよびオフロード記述テンプレートを、それぞれソースコード記憶部121およびテンプレート記憶部123に記憶する。 The acquisition unit 131 acquires, for example, the source code of the first edition, the source code with the tag inserted, and the offload description template from another terminal (step S1). The acquisition unit 131 stores the acquired first edition source code and the offload description template in the source code storage unit 121 and the template storage unit 123, respectively.

取得部131は、初版のソースコードおよびタグ挿入済みソースコードに基づいて、タグ挿入パッチを生成する(ステップS2)。取得部131は、生成したタグ挿入パッチをタグ挿入パッチ記憶部122に記憶する。 The acquisition unit 131 generates a tag insertion patch based on the source code of the first edition and the source code in which the tag has been inserted (step S2). The acquisition unit 131 stores the generated tag insertion patch in the tag insertion patch storage unit 122.

抽出部132は、タグ挿入済みソースコードからアルゴリズム情報を抽出する(ステップS3)。抽出部132は、抽出したアルゴリズム情報をアルゴリズム情報記憶部124に記憶する。これにより、変換装置100は、初版のソースコード、タグ挿入パッチ、オフロード記述テンプレート、および、アルゴリズム情報を記憶し、二版以降のソースコード変換処理の準備を整えることができる。すなわち、変換装置100は、アプリのアルゴリズム情報と、ハードウェア実装上のアーキテクチャを表すオフロード記述テンプレートとを分離して管理することができる。 The extraction unit 132 extracts the algorithm information from the tag-inserted source code (step S3). The extraction unit 132 stores the extracted algorithm information in the algorithm information storage unit 124. As a result, the conversion device 100 can store the source code of the first edition, the tag insertion patch, the offload description template, and the algorithm information, and prepare for the source code conversion processing of the second and subsequent editions. That is, the conversion device 100 can separately manage the algorithm information of the application and the offload description template representing the architecture on the hardware implementation.

続いて、図15を用いてソースコードが更新された場合における変換処理について説明する。図15は、実施例の変換処理の一例を示すフローチャートである。 Subsequently, the conversion process when the source code is updated will be described with reference to FIG. FIG. 15 is a flowchart showing an example of the conversion process of the embodiment.

抽出部132は、例えば、他の端末からソースコード更新パッチを取得する(ステップS11)。抽出部132は、ソースコード更新パッチに基づいて、ソースコードを更新する(ステップS12)。抽出部132は、更新したソースコードをソースコード記憶部121に記憶する。 The extraction unit 132 acquires, for example, a source code update patch from another terminal (step S11). The extraction unit 132 updates the source code based on the source code update patch (step S12). The extraction unit 132 stores the updated source code in the source code storage unit 121.

抽出部132は、タグ挿入パッチ記憶部122を参照し、更新したソースコードにタグ挿入パッチを適用する(ステップS13)。抽出部132は、タグ挿入パッチを適用できたか否かを判定する(ステップS14)。抽出部132は、タグ挿入パッチを適用できると判定した場合には(ステップS14:肯定)、タグ挿入済みソースコードを生成する(ステップS15)。 The extraction unit 132 refers to the tag insertion patch storage unit 122, and applies the tag insertion patch to the updated source code (step S13). The extraction unit 132 determines whether or not the tag insertion patch has been applied (step S14). When the extraction unit 132 determines that the tag insertion patch can be applied (step S14: affirmative), the extraction unit 132 generates the tag-inserted source code (step S15).

抽出部132は、オフロード記述テンプレートの更新が不要である旨のメッセージを表示部111に出力して表示させる(ステップS16)。抽出部132は、生成したタグ挿入済みソースコードからアルゴリズム情報を抽出する(ステップS17)。抽出部132は、抽出したアルゴリズム情報をアルゴリズム情報記憶部124に記憶し、更新指示を更新部133に出力する。 The extraction unit 132 outputs a message to the effect that the offload description template does not need to be updated to the display unit 111 and displays it (step S16). The extraction unit 132 extracts the algorithm information from the generated source code with the tag inserted (step S17). The extraction unit 132 stores the extracted algorithm information in the algorithm information storage unit 124, and outputs an update instruction to the update unit 133.

更新部133は、抽出部132から更新指示が入力されると、テンプレート記憶部123およびアルゴリズム情報記憶部124から、それぞれオフロード記述テンプレートおよびアルゴリズム情報を読み出す。更新部133は、読み出したオフロード記述テンプレートのタグ部分にアルゴリズム情報を挿入してオフロード記述を生成する(ステップS18)。更新部133は、生成したオフロード記述をオフロード記述記憶部125に記憶し、変換処理を終了する。 When the update instruction is input from the extraction unit 132, the update unit 133 reads the offload description template and the algorithm information from the template storage unit 123 and the algorithm information storage unit 124, respectively. The update unit 133 inserts the algorithm information into the tag portion of the read offload description template to generate the offload description (step S18). The update unit 133 stores the generated offload description in the offload description storage unit 125, and ends the conversion process.

一方、抽出部132は、ステップS14において、タグ挿入パッチを適用できないと判定した場合には(ステップS14:否定)、オフロード記述テンプレートの更新を要する旨のメッセージを表示部111に出力して表示させ(ステップS19)、変換処理を終了する。これにより、変換装置100は、アプリケーションの更新があった際に対応するオフロード記述の更新効率を向上できる。つまり、変換装置100は、アプリまたはハードウェアの変更に対して柔軟な更新が可能となる。また、変換装置100は、タグ挿入パッチを適用できないと判定した場合に、更新したソースコードの対象箇所を容易に特定できる。従って、変換装置100は、オフロード記述テンプレートの変更箇所も容易に特定できる。 On the other hand, when the extraction unit 132 determines in step S14 that the tag insertion patch cannot be applied (step S14: negation), the extraction unit 132 outputs and displays a message to the effect that the offload description template needs to be updated to the display unit 111. (Step S19), and the conversion process is terminated. As a result, the conversion device 100 can improve the update efficiency of the corresponding offload description when the application is updated. That is, the conversion device 100 can be flexibly updated in response to changes in the application or hardware. Further, the conversion device 100 can easily identify the target location of the updated source code when it is determined that the tag insertion patch cannot be applied. Therefore, the conversion device 100 can easily identify the changed part of the offload description template.

なお、上記実施例では、アプリのソースコードをCまたはC++、オフロード記述をSystemCで記述した場合について説明したが、これに限定されない。例えば、アプリのソースコードとして、FORTRAN、COBOL、Java(登録商標)、Perl、Python、Ruby等の各種の言語のソースコードを用いることができる。また、例えば、オフロード記述として、SystemVerilog等の各種の言語のオフロード記述を用いることができる。 In the above embodiment, the case where the source code of the application is described in C or C ++ and the offload description is described in SystemC has been described, but the present invention is not limited to this. For example, as the source code of the application, source codes of various languages such as FORTRAN, COBOL, Java (registered trademark), Perl, Python, and Ruby can be used. Further, for example, as the offload description, an offload description of various languages such as SystemVerilog can be used.

このように、変換装置100は、ソースコードを有するアプリケーションに基づいて、ハードウェアで動作させるオフロード記述に対応する、アプリケーションのアルゴリズム情報の挿入箇所をタグで示すとともにハードウェアのアーキテクチャを表すオフロード記述テンプレートを取得する。また、変換装置100は、ソースコードが更新された場合、更新を反映したソースコードから、タグに対応するアルゴリズム情報を抽出する。また、変換装置100は、抽出したアルゴリズム情報をオフロード記述テンプレートの対応する箇所に挿入してオフロード記述を更新する。その結果、変換装置100は、アプリケーションの更新があった際に対応するオフロード記述の更新効率を向上できる。 As described above, the conversion device 100 indicates the insertion point of the algorithm information of the application corresponding to the offload description operated by the hardware based on the application having the source code with a tag and the offload representing the architecture of the hardware. Get the description template. Further, when the source code is updated, the conversion device 100 extracts the algorithm information corresponding to the tag from the source code reflecting the update. Further, the conversion device 100 inserts the extracted algorithm information into the corresponding portion of the offload description template to update the offload description. As a result, the conversion device 100 can improve the update efficiency of the corresponding offload description when the application is updated.

また、変換装置100は、ソースコードが更新された場合、更新を反映したソースコードに、アルゴリズム情報の抽出用タグを挿入し、タグに対応するアルゴリズム情報を抽出する。その結果、変換装置100は、更新されたソースコードに対応するアルゴリズム情報を取得できる。 Further, when the source code is updated, the conversion device 100 inserts a tag for extracting algorithm information into the source code reflecting the update, and extracts the algorithm information corresponding to the tag. As a result, the conversion device 100 can acquire the algorithm information corresponding to the updated source code.

また、変換装置100は、アルゴリズム情報の抽出用タグを挿入するパッチを用いて、抽出用タグを挿入する。その結果、変換装置100は、アルゴリズムに関する記述を特定できる。 Further, the conversion device 100 inserts the extraction tag by using a patch for inserting the extraction tag of the algorithm information. As a result, the conversion device 100 can specify the description regarding the algorithm.

また、変換装置100は、アルゴリズム情報の抽象構文木を用いて、抽出用タグを挿入する。その結果、変換装置100は、アルゴリズムに関する記述を特定できる。 Further, the conversion device 100 inserts an extraction tag using an abstract syntax tree of algorithm information. As a result, the conversion device 100 can specify the description regarding the algorithm.

また、変換装置100は、更新を反映したソースコードに、アルゴリズム情報の抽出用タグを挿入できない箇所がある場合、オフロード記述テンプレートの更新を要する旨を通知する。その結果、変換装置100は、ハードウェアのアーキテクチャに関する部分の更新があったことをユーザに知らせることができる。 Further, the conversion device 100 notifies that the offload description template needs to be updated when there is a part in the source code reflecting the update where the tag for extracting the algorithm information cannot be inserted. As a result, the converter 100 can notify the user that there has been an update of a portion related to the hardware architecture.

また、図示した各部の各構成要素は、必ずしも物理的に図示の如く構成されていることを要しない。すなわち、各部の分散・統合の具体的形態は図示のものに限られず、その全部または一部を、各種の負荷や使用状況等に応じて、任意の単位で機能的または物理的に分散・統合して構成することができる。例えば、抽出部132と更新部133とを統合してもよい。また、図示した各処理は、上記の順番に限定されるものでなく、処理内容を矛盾させない範囲において、同時に実施してもよく、順序を入れ替えて実施してもよい。 Further, each component of each of the illustrated parts does not necessarily have to be physically configured as shown in the figure. That is, the specific form of distribution / integration of each part is not limited to the one shown in the figure, and all or part of them may be functionally or physically distributed / integrated in any unit according to various loads and usage conditions. Can be configured. For example, the extraction unit 132 and the update unit 133 may be integrated. Further, the illustrated processes are not limited to the above order, and may be performed simultaneously or in a different order as long as the processing contents do not contradict each other.

さらに、各装置で行われる各種処理機能は、CPU(またはMPU、MCU(Micro Controller Unit)等のマイクロ・コンピュータ)上で、その全部または任意の一部を実行するようにしてもよい。また、各種処理機能は、CPU(またはMPU、MCU等のマイクロ・コンピュータ)で解析実行されるプログラム上、またはワイヤードロジックによるハードウェア上で、その全部または任意の一部を実行するようにしてもよいことは言うまでもない。 Further, the various processing functions performed by each device may be executed on the CPU (or a microcomputer such as an MPU or a MCU (Micro Controller Unit)) in whole or in any part thereof. In addition, various processing functions may be executed in whole or in any part on a program analyzed and executed by a CPU (or a microcomputer such as an MPU or MCU) or on hardware by wired logic. Needless to say, it's good.

ところで、上記の各実施例で説明した各種の処理は、予め用意されたプログラムをコンピュータで実行することで実現できる。そこで、以下では、上記の各実施例と同様の機能を有するプログラムを実行するコンピュータの一例を説明する。図16は、ソースコード変換プログラムを実行するコンピュータの一例を示す図である。 By the way, various processes described in each of the above embodiments can be realized by executing a program prepared in advance on a computer. Therefore, in the following, an example of a computer that executes a program having the same functions as those of the above embodiments will be described. FIG. 16 is a diagram showing an example of a computer that executes a source code conversion program.

図16に示すように、コンピュータ200は、各種演算処理を実行するCPU201と、データ入力を受け付ける入力装置202と、モニタ203とを有する。また、コンピュータ200は、記憶媒体からプログラム等を読み取る媒体読取装置204と、各種装置と接続するためのインタフェース装置205と、他の情報処理装置等と有線または無線により接続するための通信装置206とを有する。また、コンピュータ200は、各種情報を一時記憶するRAM207と、ハードディスク装置208とを有する。また、各装置201~208は、バス209に接続される。 As shown in FIG. 16, the computer 200 has a CPU 201 that executes various arithmetic processes, an input device 202 that accepts data input, and a monitor 203. Further, the computer 200 includes a medium reading device 204 for reading a program or the like from a storage medium, an interface device 205 for connecting to various devices, and a communication device 206 for connecting to another information processing device or the like by wire or wirelessly. Has. Further, the computer 200 has a RAM 207 for temporarily storing various information and a hard disk device 208. Further, each of the devices 201 to 208 is connected to the bus 209.

ハードディスク装置208には、図1に示した取得部131、抽出部132および更新部133の各処理部と同様の機能を有するソースコード変換プログラムが記憶される。また、ハードディスク装置208には、ソースコード記憶部121、タグ挿入パッチ記憶部122、テンプレート記憶部123、アルゴリズム情報記憶部124、オフロード記述記憶部125、および、ソースコード変換プログラムを実現するための各種データが記憶される。入力装置202は、例えば、コンピュータ200のユーザから操作情報等の各種情報の入力を受け付ける。モニタ203は、例えば、コンピュータ200のユーザに対して表示画面等の各種画面を表示する。インタフェース装置205は、例えば印刷装置等が接続される。通信装置206は、例えば、図1に示した通信部110と同様の機能を有し図示しないネットワークと接続され、他の情報処理装置と各種情報をやりとりする。 The hard disk device 208 stores a source code conversion program having the same functions as the processing units of the acquisition unit 131, the extraction unit 132, and the update unit 133 shown in FIG. Further, the hard disk device 208 is for realizing a source code storage unit 121, a tag insertion patch storage unit 122, a template storage unit 123, an algorithm information storage unit 124, an offload description storage unit 125, and a source code conversion program. Various data are stored. The input device 202 receives, for example, input of various information such as operation information from a user of the computer 200. The monitor 203 displays various screens such as a display screen for the user of the computer 200, for example. For example, a printing device or the like is connected to the interface device 205. The communication device 206 has, for example, the same function as the communication unit 110 shown in FIG. 1 and is connected to a network (not shown) to exchange various information with other information processing devices.

CPU201は、ハードディスク装置208に記憶された各プログラムを読み出して、RAM207に展開して実行することで、各種の処理を行う。また、これらのプログラムは、コンピュータ200を図1に示した取得部131、抽出部132および更新部133として機能させることができる。 The CPU 201 performs various processes by reading out each program stored in the hard disk device 208, expanding the program in the RAM 207, and executing the program. Further, these programs can make the computer 200 function as the acquisition unit 131, the extraction unit 132, and the update unit 133 shown in FIG.

なお、上記のソースコード変換プログラムは、必ずしもハードディスク装置208に記憶されている必要はない。例えば、コンピュータ200が読み取り可能な記憶媒体に記憶されたプログラムを、コンピュータ200が読み出して実行するようにしてもよい。コンピュータ200が読み取り可能な記憶媒体は、例えば、CD-ROMやDVD(Digital Versatile Disc)、USB(Universal Serial Bus)メモリ等の可搬型記録媒体、フラッシュメモリ等の半導体メモリ、ハードディスクドライブ等が対応する。また、公衆回線、インターネット、LAN等に接続された装置にこのソースコード変換プログラムを記憶させておき、コンピュータ200がこれらからソースコード変換プログラムを読み出して実行するようにしてもよい。 The above source code conversion program does not necessarily have to be stored in the hard disk device 208. For example, the computer 200 may read and execute a program stored in a storage medium that can be read by the computer 200. The storage medium that can be read by the computer 200 is, for example, a portable recording medium such as a CD-ROM, a DVD (Digital Versatile Disc), or a USB (Universal Serial Bus) memory, a semiconductor memory such as a flash memory, a hard disk drive, or the like. .. Further, the source code conversion program may be stored in a device connected to a public line, the Internet, a LAN, or the like, and the computer 200 may read the source code conversion program from these and execute the program.

100 変換装置
110 通信部
111 表示部
112 操作部
120 記憶部
121 ソースコード記憶部
122 タグ挿入パッチ記憶部
123 テンプレート記憶部
124 アルゴリズム情報記憶部
125 オフロード記述記憶部
130 制御部
131 取得部
132 抽出部
133 更新部
100 Conversion device 110 Communication unit 111 Display unit 112 Operation unit 120 Storage unit 121 Source code storage unit 122 Tag insertion patch storage unit 123 Template storage unit 124 Algorithm information storage unit 125 Offload description storage unit 130 Control unit 131 Acquisition unit 132 Extraction unit 133 Update Department

Claims (6)

ソースコードを有するアプリケーションに基づいて、ハードウェアで動作させるオフロード記述に対応する、前記アプリケーションのアルゴリズム情報の挿入箇所をタグで示すとともに前記ハードウェアのアーキテクチャを表すオフロード記述テンプレートを取得し、
前記ソースコードが更新された場合、更新を反映したソースコードから、前記タグに対応するアルゴリズム情報を抽出し、
抽出した前記アルゴリズム情報を前記オフロード記述テンプレートの対応する箇所に挿入して前記オフロード記述を更新する、
処理をコンピュータに実行させることを特徴とするソースコード変換プログラム。
Based on the application having the source code, the offload description template corresponding to the offload description to be operated by the hardware is obtained by indicating the insertion point of the algorithm information of the application with a tag and representing the architecture of the hardware.
When the source code is updated, the algorithm information corresponding to the tag is extracted from the source code reflecting the update.
The extracted algorithm information is inserted into the corresponding part of the offload description template to update the offload description.
A source code conversion program characterized by having a computer execute processing.
前記抽出する処理は、前記ソースコードが更新された場合、前記更新を反映したソースコードに、前記アルゴリズム情報の抽出用タグを挿入し、前記タグに対応する前記アルゴリズム情報を抽出する、
ことを特徴とする請求項1に記載のソースコード変換プログラム。
In the extraction process, when the source code is updated, a tag for extracting the algorithm information is inserted into the source code reflecting the update, and the algorithm information corresponding to the tag is extracted.
The source code conversion program according to claim 1.
前記抽出する処理は、前記アルゴリズム情報の抽出用タグを挿入するパッチを用いて、前記抽出用タグを挿入する、
ことを特徴とする請求項2に記載のソースコード変換プログラム。
In the extraction process, the extraction tag is inserted by using a patch for inserting the extraction tag of the algorithm information.
The source code conversion program according to claim 2.
前記抽出する処理は、前記アルゴリズム情報の抽象構文木を用いて、前記抽出用タグを挿入する、
ことを特徴とする請求項2に記載のソースコード変換プログラム。
In the extraction process, the extraction tag is inserted using the abstract syntax tree of the algorithm information.
The source code conversion program according to claim 2.
前記抽出する処理は、前記更新を反映したソースコードに、前記アルゴリズム情報の抽出用タグを挿入できない箇所がある場合、前記オフロード記述テンプレートの更新を要する旨を通知する、
ことを特徴とする請求項2~4のいずれか1つに記載のソースコード変換プログラム。
The extraction process notifies that the offload description template needs to be updated when there is a part in the source code reflecting the update where the tag for extracting the algorithm information cannot be inserted.
The source code conversion program according to any one of claims 2 to 4, wherein the source code conversion program is characterized by the above.
ソースコードを有するアプリケーションに基づいて、ハードウェアで動作させるオフロード記述に対応する、前記アプリケーションのアルゴリズム情報の挿入箇所をタグで示すとともに前記ハードウェアのアーキテクチャを表すオフロード記述テンプレートを取得し、
前記ソースコードが更新された場合、更新を反映したソースコードから、前記タグに対応するアルゴリズム情報を抽出し、
抽出した前記アルゴリズム情報を前記オフロード記述テンプレートの対応する箇所に挿入して前記オフロード記述を更新する、
処理をコンピュータが実行することを特徴とするソースコード変換方法。
Based on the application having the source code, the offload description template corresponding to the offload description to be operated by the hardware is obtained by indicating the insertion point of the algorithm information of the application with a tag and representing the architecture of the hardware.
When the source code is updated, the algorithm information corresponding to the tag is extracted from the source code reflecting the update.
The extracted algorithm information is inserted into the corresponding part of the offload description template to update the offload description.
A source code conversion method characterized by a computer performing processing.
JP2018089902A 2018-05-08 2018-05-08 Source code conversion program and source code conversion method Active JP7040272B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2018089902A JP7040272B2 (en) 2018-05-08 2018-05-08 Source code conversion program and source code conversion method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2018089902A JP7040272B2 (en) 2018-05-08 2018-05-08 Source code conversion program and source code conversion method

Publications (2)

Publication Number Publication Date
JP2019197308A JP2019197308A (en) 2019-11-14
JP7040272B2 true JP7040272B2 (en) 2022-03-23

Family

ID=68538393

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2018089902A Active JP7040272B2 (en) 2018-05-08 2018-05-08 Source code conversion program and source code conversion method

Country Status (1)

Country Link
JP (1) JP7040272B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113821278B (en) * 2021-09-06 2024-05-03 挂号网(杭州)科技有限公司 Calling image size method, device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003280956A (en) 2002-03-26 2003-10-03 Hitachi Software Eng Co Ltd Database case device
US20100122234A1 (en) 2008-11-12 2010-05-13 International Business Machines Corporation System and method for reconciling software source code
JP2014153777A (en) 2013-02-05 2014-08-25 Tokyo Kogei Univ Source code inspection device
JP2015198473A (en) 2014-03-31 2015-11-09 パナソニックIpマネジメント株式会社 Cabinet for distribution board with measuring unit and distribution board
WO2017210202A1 (en) 2016-06-01 2017-12-07 The Mathworks, Inc. Systems and methods for creating model adaptors

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015198473A1 (en) * 2014-06-27 2015-12-30 富士通株式会社 Test program, test device, and test method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003280956A (en) 2002-03-26 2003-10-03 Hitachi Software Eng Co Ltd Database case device
US20100122234A1 (en) 2008-11-12 2010-05-13 International Business Machines Corporation System and method for reconciling software source code
JP2014153777A (en) 2013-02-05 2014-08-25 Tokyo Kogei Univ Source code inspection device
JP2015198473A (en) 2014-03-31 2015-11-09 パナソニックIpマネジメント株式会社 Cabinet for distribution board with measuring unit and distribution board
WO2017210202A1 (en) 2016-06-01 2017-12-07 The Mathworks, Inc. Systems and methods for creating model adaptors

Also Published As

Publication number Publication date
JP2019197308A (en) 2019-11-14

Similar Documents

Publication Publication Date Title
JP4396994B2 (en) Resource file translation verification method, apparatus, and program
US9037595B2 (en) Creating graphical models representing control flow of a program manipulating data resources
US20120174061A1 (en) Code suggestion in a software development tool
US9202021B2 (en) License verification method and apparatus, and computer readable storage medium storing program therefor
US10929149B2 (en) Method and system for updating firmware
CN110990023A (en) aar file dependency uploading method and device, storage medium and electronic equipment
CN105446725A (en) Method and system for model driven development
US20080059957A1 (en) Method of compiling source code, compiler, computer system, and computer program product
CN111078262A (en) Application thermal restoration method and device
CN110109671A (en) A kind of webpack label sizes pattern conversion method and device
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN107797805B (en) Code packaging method and device and computer readable storage medium
US20070100897A1 (en) System and method for automatic instance data mapping generation
CN112256670A (en) Data migration method, terminal device and readable storage medium
JP7040272B2 (en) Source code conversion program and source code conversion method
US20170329587A1 (en) Program conversion method using comment-based pseudo-codes and computerreadable recording medium, onto which program is recorded, for implementing
JP2011008358A (en) Information processor and information processing method
US20150268954A1 (en) Apparatus and method for identifying correspondence between an installed program and an interface in a source code
US8276132B1 (en) System and method for representing and managing a multi-architecture co-processor application program
JP6651974B2 (en) Information processing apparatus, compiling method and compiler program
US9720690B2 (en) Software architecture by untangling undesired code level dependencies using code refactoring
US20170017471A1 (en) Multi-flavored software execution from a singular code base
US20170228243A1 (en) Non-transitory computer-readable recording medium storing control program, control device and control method
US10983813B2 (en) Automatic repetition of context-specific code edits
JP2018005315A (en) Regulation conversion support apparatus and regulation conversion support program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20210210

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20220119

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: 20220208

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20220221

R150 Certificate of patent or registration of utility model

Ref document number: 7040272

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150