JP4578884B2 - Program converter - Google Patents

Program converter Download PDF

Info

Publication number
JP4578884B2
JP4578884B2 JP2004225302A JP2004225302A JP4578884B2 JP 4578884 B2 JP4578884 B2 JP 4578884B2 JP 2004225302 A JP2004225302 A JP 2004225302A JP 2004225302 A JP2004225302 A JP 2004225302A JP 4578884 B2 JP4578884 B2 JP 4578884B2
Authority
JP
Japan
Prior art keywords
program
address
processing
storage unit
processing 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
JP2004225302A
Other languages
Japanese (ja)
Other versions
JP2006048201A (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.)
DMG Mori Co Ltd
Original Assignee
DMG Mori Co Ltd
Mori Seiki Co 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 DMG Mori Co Ltd, Mori Seiki Co Ltd filed Critical DMG Mori Co Ltd
Priority to JP2004225302A priority Critical patent/JP4578884B2/en
Publication of JP2006048201A publication Critical patent/JP2006048201A/en
Application granted granted Critical
Publication of JP4578884B2 publication Critical patent/JP4578884B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Description

本発明は、予め設定された一連の処理を実行するための処理プログラムを、同一の処理内容を実行するための新たな処理プログラムに変換するプログラム変換装置に関する。   The present invention relates to a program conversion apparatus that converts a processing program for executing a series of preset processes into a new processing program for executing the same processing content.

一般に、NC工作機械などの機械や装置の制御装置は、CPU,ROM及びRAMを備えており、CPUが、ROMやRAMに予め格納されたシステム制御プログラムなどを、当該ROMやRAMから読み出して実行することにより、前記機械や装置を制御するように構成されている。   In general, control devices for machines and devices such as NC machine tools are provided with a CPU, ROM and RAM, and the CPU reads a system control program stored in the ROM or RAM in advance from the ROM or RAM and executes it. By doing so, it is configured to control the machine or device.

しかしながら、CPUによる実行処理は、その実行速度がCPUの性能に大きく依存するため、低性能なCPUを用いた場合には、応答遅れを生じるなど高速に処理することができず、システム制御を精度良く行うことができないという問題があり、高性能なCPUを用いた場合には、製造コストが高くなるという問題があった。   However, since the execution speed of the CPU greatly depends on the performance of the CPU, when a low-performance CPU is used, it cannot be processed at a high speed such as a response delay, and the system control is not accurate. There is a problem that it cannot be performed well, and when a high-performance CPU is used, there is a problem that the manufacturing cost increases.

そこで、近年では、システム制御プログラムの一部を、例えば、FPGA(フィールドプログラマブルゲートアレイ)などのプログラム可能な論理回路に書き込み、CPUにより実行されていた処理の一部を、当該論理回路により実行させるといったことが提案されている。このようにすれば、論理回路による処理速度がCPUに比べて高速であることから、システム制御プログラム全体を高速に処理することが可能となり、システム制御を精度良く行うことができる。   Therefore, in recent years, a part of the system control program is written in a programmable logic circuit such as an FPGA (Field Programmable Gate Array), and a part of the processing executed by the CPU is executed by the logic circuit. It has been proposed. In this way, since the processing speed of the logic circuit is higher than that of the CPU, the entire system control program can be processed at high speed, and system control can be performed with high accuracy.

そして、論理回路へのプログラムの書き込みは、従来、次のようにして行われており、まず、オペレータが、C言語などのソフトウェアプログラム言語で作成されたシステム制御プログラム中において、一定回数以上繰り返されて実行される処理を探し出し、当該繰り返し処理となっている部分のプログラムを抽出する。   The writing of the program to the logic circuit is conventionally performed as follows. First, the operator repeats a predetermined number of times or more in a system control program created in a software program language such as C language. The process to be executed is searched, and the program of the part that is the repeated process is extracted.

この後、抽出したプログラムをサブルーチン化するとともに、元のシステム制御プログラムについては、当該システム制御プログラムから繰り返し処理の部分を削除して、当該繰り返し処理を前記サブルーチンで実行させるように構成されたメインルーチンに変換する。ついで、サブルーチン化したプログラムのプログラム言語を、適宜変換装置などを用いて、論理回路を動作させるためのハードウェア記述言語に変換し、変換後のプログラムを論理回路に書き込む一方、メインルーチンのプログラムをROMなどに書き込む。   Thereafter, the extracted program is converted into a subroutine, and the original system control program is deleted from the repeated processing portion of the system control program, and the repeated processing is executed by the subroutine. Convert to Next, the program language of the program converted into a subroutine is converted into a hardware description language for operating the logic circuit using an appropriate conversion device or the like, and the converted program is written in the logic circuit, while the program of the main routine is written. Write to ROM.

これにより、システム制御プログラムは、そのメインルーチン部分の処理がCPUにより実行され、サブルーチン部分(繰り返し処理の部分)の処理が論理回路により実行されるようになる。また、繰り返し部分の処理をサブルーチン化して、論理回路により実行するようにしているので、メインルーチンのプログラムデータ量を小さくしたり、システム制御プログラムの処理速度をより効果的に向上させるといった効果を得ることもできる。   As a result, in the system control program, processing of the main routine portion is executed by the CPU, and processing of the subroutine portion (repetitive processing portion) is executed by the logic circuit. In addition, since the processing of the repetitive portion is made into a subroutine and executed by a logic circuit, it is possible to reduce the amount of program data in the main routine and to improve the processing speed of the system control program more effectively. You can also

藤田昌宏著,「Design Wave Magazine」,2003年2月号,QC出版,2003年2月1日,p.20−p.25Masahiro Fujita, “Design Wave Magazine”, February 2003, QC Publishing, February 1, 2003, p. 20-p. 25

ところが、上述のように、オペレータが、システム制御プログラム全体の中から、一定回数以上繰り返されて実行される処理のプログラムを抽出してサブルーチン化したり、抽出したプログラムのプログラム言語をハードウェア記述言語に変換したり、当該繰り返し処理をサブルーチンで実行させるように、元のシステム制御プログラムを変換していたのでは、これらの作業に時間がかかり、効率的でないという問題や、プログラムの変換時などに何らかの間違いをすると、システム制御に異常を生じるという問題があった。   However, as described above, the operator extracts a program for processing to be executed repeatedly over a predetermined number of times from the entire system control program and converts it into a subroutine, or changes the program language of the extracted program to a hardware description language. If the original system control program was converted so that it could be converted or executed in a subroutine, it would take a long time to perform these operations, and there would be problems such as inefficiency and program conversion. If a mistake was made, there was a problem that an abnormality occurred in the system control.

本発明は、以上の実情に鑑みなされたものであって、プログラムの変換を効率的且つ正確に行うことができるプログラム変換装置の提供をその目的とする。   The present invention has been made in view of the above circumstances, and an object thereof is to provide a program conversion apparatus capable of efficiently and accurately converting a program.

上記目的を達成するための本発明は、
それぞれ異なる複数の実行命令を含んだ、一連の処理を行うためのプログラムであり、該各実行命令を予め設定された順序に従い順次実行させるとともに、該各実行命令の一部については複数回実行させるように構成された処理プログラムを基に、メインルーチンとなる第1プログラムと、サブルーチンとなる第2プログラムとを生成して、前記処理プログラムを、該第1プログラム及び第2プログラムからなる新たな処理プログラムに変換する装置であって、
変換前の前記処理プログラムを記憶する記憶部であり、前記各実行命令を該記憶部内のアドレスと対応付けてそれぞれ記憶する原プログラム記憶部と、
前記実行命令を該実行命令が格納された前記原プログラム記憶部内のアドレスから、前記実行順序に従い順次読み出して、前記処理プログラムを実行する実行処理部と、
前記アドレスを記憶するアドレス記憶部と、
前記実行処理部における処理を監視して、該実行処理部により順次実行される実行命令の前記アドレスを、該実行命令が実行される順番に前記アドレス記憶部に格納する監視処理部と、
前記アドレス記憶部に格納されたアドレスを基に、その並びを確認して、該アドレスが同じ順番で一定数以上並んでいる部分が、予め設定された数以上あるか否かを確認し、該設定数以上あることを確認した場合には、該当部分の各アドレスをその並びのまま抽出する抽出処理部と、
前記抽出処理部によって抽出されたアドレス、及び前記原プログラム記憶部に格納された処理プログラムを基に、前記抽出アドレスに対応した各実行命令を該抽出アドレスが並んだ順番で順次実行させるように構成された前記第2プログラムと、前記一連の処理を実行させるとともに、該一連の処理の内、前記抽出アドレスに対応した各実行命令により順次実行される処理については、前記第2プログラムで実行させるように構成された前記第1プログラムとを生成して、前記変換前の処理プログラムを、該生成した第1プログラム及び第2プログラムからなる新たな処理プログラムに変換する変換処理部と、
前記変換処理部によって生成された第1プログラム及び第2プログラムを記憶する生成プログラム記憶部とを備えてなることを特徴とするプログラム変換装置に係る。
To achieve the above object, the present invention provides:
A program for performing a series of processes including a plurality of different execution instructions, each of which is sequentially executed according to a preset order, and a part of each of the execution instructions is executed a plurality of times. Based on the processing program configured as described above, a first program as a main routine and a second program as a subroutine are generated, and the processing program is converted into a new process including the first program and the second program. A device for converting into a program,
An original program storage unit that stores the processing program before conversion, and stores each execution instruction in association with an address in the storage unit;
An execution processing unit that sequentially reads out the execution instruction from the address in the original program storage unit in which the execution instruction is stored according to the execution order, and executes the processing program;
An address storage unit for storing the address;
A monitoring processing unit that monitors processing in the execution processing unit and stores the addresses of the execution instructions sequentially executed by the execution processing unit in the address storage unit in the order in which the execution instructions are executed;
Based on the addresses stored in the address storage unit, the arrangement is confirmed, and it is confirmed whether there are more than a preset number of portions where the addresses are arranged in a certain number or more in the same order, When it is confirmed that there are more than the set number, an extraction processing unit that extracts each address of the corresponding part as it is,
Based on the address extracted by the extraction processing unit and the processing program stored in the original program storage unit, the execution instructions corresponding to the extraction address are sequentially executed in the order in which the extraction addresses are arranged. The second program and the series of processes are executed, and the processes sequentially executed by the execution instructions corresponding to the extraction addresses in the series of processes are executed by the second program. A conversion processing unit that generates the first program configured as described above and converts the processing program before conversion into a new processing program including the generated first program and second program;
A program conversion apparatus comprising: a generated program storage unit that stores a first program and a second program generated by the conversion processing unit.

この発明によれば、まず、原プログラム記憶部内に、変換対象となる、所定の一連の処理を行うための処理プログラムが格納される。この処理プログラムは、それぞれ異なる複数の実行命令を含み、当該各実行命令を所定の順序に従い順次実行させるとともに、当該各実行命令の一部については複数回実行させるように構成されており、当該各実行命令が記憶部内のアドレスと対応付けられてそれぞれ格納される。尚、このような処理プログラムの一例として、NC工作機械といった機械や装置を制御するためのシステム制御プログラムなどを挙げることができる。   According to this invention, first, a processing program for performing a predetermined series of processing to be converted is stored in the original program storage unit. The processing program includes a plurality of different execution instructions, and each execution instruction is sequentially executed according to a predetermined order, and a part of each execution instruction is executed a plurality of times. Execution instructions are stored in association with addresses in the storage unit. An example of such a processing program is a system control program for controlling machines and devices such as NC machine tools.

そして、実行処理部により、実行命令が原プログラム記憶部内の対応するアドレスから、前記実行順序に従い順次読み出されて、処理プログラムが実行されると、当該実行処理部における処理を監視する監視処理部により、実行処理部によって順次実行される実行命令の前記アドレスが、その実行順にアドレス記憶部に格納される。   Then, when the execution program is sequentially read out from the corresponding address in the original program storage unit according to the execution order by the execution processing unit and the processing program is executed, the monitoring processing unit monitors the processing in the execution processing unit Thus, the addresses of the execution instructions sequentially executed by the execution processing unit are stored in the address storage unit in the execution order.

この後、抽出処理部により、アドレス記憶部に格納されたアドレスを基に、その並びが確認されて、当該アドレスが同じ順番で一定数以上並んでいる部分が所定数以上あるか否かが確認され、所定数以上あることが確認された場合には、該当部分の各アドレスがその並びのまま抽出される。一方、所定数以上あることが確認されなかった場合には、上記一連の処理が終了する。尚、前記一定数及び所定数は、処理プログラムの処理内容やプログラムデータ量などに応じて適宜設定されている。また、抽出されるアドレスの数が多くなると、変換処理部によって生成される第2プログラムのデータ量が大きくなり、後述する論理回路の記憶容量を越える恐れがあるため、同じ順番で並ぶ(抽出される)アドレスの数に上限値を設定して、同じ順番且つ一定数(下限値)以上上限値以下の数でアドレスが並んでいる部分が所定数以上あるか否かを確認するように構成することが好ましい。   Thereafter, the arrangement is confirmed by the extraction processing unit based on the addresses stored in the address storage unit, and it is confirmed whether or not there are a predetermined number or more of parts where the addresses are arranged in a certain number in the same order. If it is confirmed that there are a predetermined number or more, each address of the corresponding part is extracted as it is. On the other hand, if it is not confirmed that there are a predetermined number or more, the above series of processing ends. The fixed number and the predetermined number are appropriately set according to the processing content of the processing program, the amount of program data, and the like. If the number of addresses to be extracted increases, the amount of data of the second program generated by the conversion processing unit increases and may exceed the storage capacity of the logic circuit described later. The upper limit value is set for the number of addresses, and it is configured to check whether there are more than a predetermined number of addresses arranged in the same order and a certain number (lower limit value) or more and less than the upper limit value. It is preferable.

抽出処理部によってアドレスが抽出されると、変換処理部により、当該抽出処理部によって抽出されたアドレス、及び原プログラム記憶部に格納された処理プログラムを基に、前記抽出アドレスに対応した各実行命令を当該抽出アドレスが並んだ順番で順次実行させるように構成されたサブルーチンたる第2プログラムと、前記一連の処理を実行させるとともに、当該一連の処理の内、前記抽出アドレスに対応した各実行命令により順次実行される処理については前記第2プログラムで実行させるように構成されたメインルーチンたる第1プログラムとが生成されて、前記変換前の処理プログラムが、当該生成された第1プログラム及び第2プログラムからなる新たな処理プログラムに変換される。   When the address is extracted by the extraction processing unit, each execution instruction corresponding to the extraction address is converted by the conversion processing unit based on the address extracted by the extraction processing unit and the processing program stored in the original program storage unit. Are executed in the order in which the extracted addresses are arranged, and the second program, which is a subroutine, and the series of processes are executed, and each execution instruction corresponding to the extracted address is included in the series of processes. A first program that is a main routine configured to be executed by the second program is generated for the processing that is sequentially executed, and the pre-conversion processing program is generated by the generated first program and second program. Is converted into a new processing program.

そして、変換処理部によって生成された第1プログラム及び第2プログラムは、当該変換処理部により、生成プログラム記憶部に格納される。   The first program and the second program generated by the conversion processing unit are stored in the generated program storage unit by the conversion processing unit.

尚、前記変換処理部は、前記第2プログラムを、例えば、FPGAなどのプログラム可能な論理回路を動作させるためのプログラムとして生成するように構成されていることが好ましく、前記プログラム変換装置は、前記生成プログラム記憶部に格納された第1プログラム及び第2プログラムを、該第1プログラムについては、例えば、ROMやRAMなどの記憶装置に、該第2プログラムについては前記論理回路に書き込む書込処理部を更に備えて構成されていることが好ましい。   The conversion processing unit is preferably configured to generate the second program as a program for operating a programmable logic circuit such as an FPGA, for example. Write processing unit for writing the first program and the second program stored in the generated program storage unit into the storage device such as ROM and RAM for the first program, and the logic circuit for the second program It is preferable to further comprise.

また、本発明は、
それぞれ異なる処理内容を実行させるように構成された複数のサブルーチンと、該各サブルーチンをそれぞれ実行させて予め設定された一連の処理を行わせるように構成されたメインルーチンとからなる処理プログラムを、プログラム可能な論理回路を動作させるための論理回路用プログラムを含んだ新たな処理プログラムに変換する装置であって、
変換前の前記処理プログラムを記憶する記憶部であり、前記各サブルーチンを該記憶部内のアドレスと対応付けてそれぞれ記憶する原プログラム記憶部と、
前記原プログラム記憶部に格納されたメインルーチンを実行するとともに、前記サブルーチンを該サブルーチンが格納された前記原プログラム記憶部内のアドレスから読み出して実行する実行処理部と、
前記アドレスを記憶するアドレス記憶部と、
前記実行処理部における処理を監視して、該実行処理部により実行されるサブルーチンの前記アドレスを、該サブルーチンが実行される度に前記アドレス記憶部に格納する監視処理部と、
前記アドレス記憶部に格納されたアドレスを基に、該各アドレス毎の数をそれぞれ計数して、予め設定された数を超えたアドレスがあるか否かを確認し、該設定数を超えたアドレスがあることを確認した場合には、そのアドレスを抽出する抽出処理部と、
前記抽出処理部によって抽出されたアドレス、及び前記原プログラム記憶部に格納された処理プログラムを基に、該抽出アドレスに対応したサブルーチンを前記論理回路用プログラムに変換するとともに、前記一連の処理の内、前記抽出アドレスに対応したサブルーチンにより実行される処理を、前記変換した論理回路用プログラムで実行させるように構成された新たなメインルーチンに前記メインルーチンを変換して、前記変換前の処理プログラムを、該変換後の論理回路用プログラム及びメインルーチン、並びに未変換の前記各サブルーチンからなる新たな処理プログラムに変換する変換処理部と、
前記変換処理部によって変換された論理回路用プログラム及びメインルーチンを少なくとも記憶する変換プログラム記憶部とを備えてなることを特徴とするプログラム変換装置に係る。
The present invention also provides:
A processing program comprising a plurality of subroutines configured to execute different processing contents and a main routine configured to execute a series of preset processes by executing the subroutines. An apparatus for converting into a new processing program including a logic circuit program for operating a possible logic circuit,
An original program storage unit that stores the processing program before conversion, and stores each subroutine in association with an address in the storage unit;
An execution processing unit that executes a main routine stored in the original program storage unit and reads and executes the subroutine from an address in the original program storage unit in which the subroutine is stored;
An address storage unit for storing the address;
A monitoring processing unit that monitors processing in the execution processing unit and stores the address of a subroutine executed by the execution processing unit in the address storage unit each time the subroutine is executed;
Based on the address stored in the address storage unit, the number for each address is counted to check whether there is an address exceeding the preset number, and the address exceeding the set number If it is confirmed that there is, the extraction processing unit that extracts the address,
Based on the address extracted by the extraction processing unit and the processing program stored in the original program storage unit, a subroutine corresponding to the extraction address is converted into the logic circuit program, and The main routine is converted into a new main routine configured to execute the processing executed by the subroutine corresponding to the extracted address by the converted logic circuit program, and the processing program before the conversion is converted. A conversion processing unit that converts the converted logic circuit program and main routine into a new processing program including the unconverted subroutines;
A program conversion apparatus comprising: a logic circuit program converted by the conversion processing unit and a conversion program storage unit for storing at least a main routine.

この発明によれば、上記と同様に、まず、原プログラム記憶部内に、変換対象となる処理プログラムが格納される。この処理プログラムは、それぞれ異なる処理内容を実行させる複数のサブルーチンと、各サブルーチンをそれぞれ実行させて所定の一連の処理を行わせるメインルーチンとから構成されており、当該各サブルーチンが記憶部内のアドレスと対応付けられてそれぞれ格納される。   According to this invention, similarly to the above, first, the processing program to be converted is stored in the original program storage unit. This processing program is composed of a plurality of subroutines for executing different processing contents and a main routine for executing each subroutine and executing a predetermined series of processing. Stored in association with each other.

そして、実行処理部により、原プログラム記憶部に格納されたメインルーチンが実行されるとともに、サブルーチンが当該原プログラム記憶部内の対応するアドレスから読み出されて実行されると、当該実行処理部における処理を監視する監視処理部により、実行処理部によって実行されるサブルーチンの前記アドレスが、当該サブルーチンが実行される度にアドレス記憶部に格納される。   When the main routine stored in the original program storage unit is executed by the execution processing unit and the subroutine is read from the corresponding address in the original program storage unit and executed, the processing in the execution processing unit is performed. The monitoring processing unit for monitoring the address of the subroutine executed by the execution processing unit is stored in the address storage unit every time the subroutine is executed.

この後、抽出処理部により、アドレス記憶部に格納されたアドレスを基に、当該各アドレス毎の数がそれぞれ計数されて、所定数を超えたアドレスがあるか否かが確認され、所定数を超えたアドレスがあることが確認された場合には、そのアドレスが抽出される。一方、所定数を超えたアドレスがあることが確認されなかった場合には、上記一連の処理が終了する。尚、前記所定数は、処理プログラムの処理内容などに応じて適宜設定されている。   Thereafter, the number of each address is counted by the extraction processing unit based on the address stored in the address storage unit, and it is confirmed whether there is an address exceeding the predetermined number. If it is confirmed that there is an exceeding address, the address is extracted. On the other hand, if it is not confirmed that there are more addresses than the predetermined number, the above series of processing ends. The predetermined number is appropriately set according to the processing contents of the processing program.

抽出処理部によってアドレスが抽出されると、変換処理部により、当該抽出処理部によって抽出されたアドレス、及び原プログラム記憶部に格納された処理プログラムを基に、当該抽出アドレスに対応したサブルーチンが、例えば、FPGAなどのプログラム可能な論理回路を動作させるための論理回路用プログラムに変換されるとともに、前記一連の処理の内、前記抽出アドレスに対応したサブルーチンにより実行される処理が、前記論理回路用プログラムで実行されるように構成された新たなメインルーチンに前記メインルーチンが変換されて、前記変換前の処理プログラムが、当該変換後の論理回路用プログラム及びメインルーチン、並びに未変換の前記各サブルーチンからなる新たな処理プログラムに変換される。   When the address is extracted by the extraction processing unit, the conversion processing unit, based on the address extracted by the extraction processing unit and the processing program stored in the original program storage unit, a subroutine corresponding to the extraction address, For example, a process for converting to a logic circuit program for operating a programmable logic circuit such as an FPGA, and a process executed by a subroutine corresponding to the extracted address in the series of processes is performed for the logic circuit. The main routine is converted into a new main routine configured to be executed by a program, and the pre-conversion processing program is the logic circuit program and main routine after conversion, and the unconverted subroutines. Is converted into a new processing program.

そして、変換処理部によって変換された少なくとも論理回路用プログラム及びメインルーチンは、当該変換処理部により、変換プログラム記憶部に格納される。   Then, at least the logic circuit program and the main routine converted by the conversion processing unit are stored in the conversion program storage unit by the conversion processing unit.

尚、前記プログラム変換装置は、前記変換プログラム記憶部に格納された論理回路用プログラム及びメインルーチンを、該論理回路用プログラムについては前記論理回路に、該メインルーチンについては、例えば、ROMやRAMなどの記憶装置に書き込む書込処理部を更に備えて構成されていることが好ましい。   The program conversion apparatus stores the logic circuit program and the main routine stored in the conversion program storage unit, the logic circuit program in the logic circuit, and the main routine, for example, ROM, RAM, etc. It is preferable to further include a writing processing unit for writing to the storage device.

このように、本発明に係るプログラム変換装置によれば、各実行命令の前記アドレスが同じ順番で一定数以上並んでいる部分が所定の設定数以上ある場合に、当該部分の各実行命令により実行される処理を繰り返し処理と判断して、当該繰り返し処理をサブルーチン化した第2プログラムを生成するとともに、当該繰り返し処理については第2プログラムで処理を実行させるように構成された、メインルーチンとなる第1プログラムを生成することにより、変換対象の処理プログラムを、第1プログラム(メインルーチン)及び第2プログラム(サブルーチン)からなる新たな処理プログラムに自動的に変換するので、効率的且つ正確に変換処理を行うことができる。   As described above, according to the program conversion device of the present invention, when there are a predetermined number or more of portions where the addresses of the execution instructions are arranged in a certain number or more in the same order, the execution is performed by each execution instruction of the portion The second process is determined to be a repetitive process, a second program in which the repetitive process is converted into a subroutine is generated, and the repetitive process is a main routine configured to cause the second program to execute the process. By generating one program, the processing program to be converted is automatically converted into a new processing program consisting of a first program (main routine) and a second program (subroutine), so that the conversion process is efficient and accurate. It can be performed.

また、所定の設定数を超えたサブルーチンの前記アドレスがある場合に、当該サブルーチンにより実行される処理を繰り返し処理と判断して、当該繰り返し処理のプログラムを論理回路用プログラムに変換するとともに、当該繰り返し処理については論理回路用プログラムで処理を実行させるように構成された新たなメインルーチンに、変換前のメインルーチンを変換することにより、変換対象の処理プログラムを、当該変換後の論理回路用プログラム及びメインルーチン、並びに未変換の各サブルーチンからなる新たな処理プログラムに自動的に変換するので、この場合においても、変換処理を効率的且つ正確に実施することができる。   Further, when there is an address of a subroutine that exceeds a predetermined set number, the process executed by the subroutine is determined to be a repetition process, and the program for the repetition process is converted into a logic circuit program. As for the processing, by converting the main routine before the conversion into a new main routine configured to execute the processing by the logic circuit program, the conversion target processing program is converted into the converted logic circuit program and Since the program is automatically converted into a new processing program consisting of the main routine and unconverted subroutines, the conversion process can be performed efficiently and accurately even in this case.

また、変換処理部が、第2プログラムを、プログラム可能な論理回路を動作させるためのプログラムとして生成するように構成すれば、生成された第2プログラムのプログラム言語を、論理回路に対応したプログラム言語に改めて変換しなくても良いので、効率的であり、また、論理回路用の正確なプログラムを得ることができる。   Further, if the conversion processing unit is configured to generate the second program as a program for operating the programmable logic circuit, the program language of the generated second program is changed to a program language corresponding to the logic circuit. Therefore, it is not necessary to convert the data into a new one, so that it is efficient and an accurate program for the logic circuit can be obtained.

また、プログラム変換装置に書込処理部を更に設けて構成すれば、生成プログラム記憶部に格納された第1プログラム及び第2プログラムや、変換プログラム記憶部に格納された論理回路用プログラム及びメインルーチンを、適宜記憶装置や論理回路に自動的に書き込むことが可能となるので、当該書込処理を効率的に実施することができる。   If the program conversion device is further provided with a write processing unit, the first program and the second program stored in the generated program storage unit, the logic circuit program and the main routine stored in the conversion program storage unit Can be automatically written to a storage device or a logic circuit as appropriate, so that the writing process can be performed efficiently.

以下、本発明の具体的な実施形態について、添付図面に基づき説明する。尚、図1は、本発明の一実施形態に係るプログラム変換装置の概略構成を示したブロック図である。   Hereinafter, specific embodiments of the present invention will be described with reference to the accompanying drawings. FIG. 1 is a block diagram showing a schematic configuration of a program conversion apparatus according to an embodiment of the present invention.

図1に示すように、本例のプログラム変換装置1は、CPU,ROM,RAM及びハードディスクなどから構成され、原プログラム記憶部11,実行処理部12,監視処理部13,アドレス記憶部14,抽出処理部15,抽出アドレス記憶部16,変換処理部17,生成プログラム記憶部18及び書込処理部19を備える。   As shown in FIG. 1, the program conversion apparatus 1 of this example is composed of a CPU, a ROM, a RAM, a hard disk, and the like, and includes an original program storage unit 11, an execution processing unit 12, a monitoring processing unit 13, an address storage unit 14, and an extraction. A processing unit 15, an extracted address storage unit 16, a conversion processing unit 17, a generated program storage unit 18, and a writing processing unit 19 are provided.

前記原プログラム記憶部11には、変換対象となる、所定の一連の処理を行うための処理プログラムが格納される。この処理プログラムは、例えば、C言語などのソフトウェアプログラム言語で作成された後、機械語に変換されたNC工作機械のシステム制御プログラムであり、それぞれ異なる複数の実行命令を含み、当該各実行命令を図2に示すような所定の順序に従い順次実行させるとともに、当該各実行命令の一部については複数回繰り返して実行させるように構成されている。そして、図3に示すように、前記各実行命令や、その実行に当たり必要なデータなどは、記憶部内のアドレスと対応付けられてそれぞれ格納されている。   The original program storage unit 11 stores a processing program for performing a predetermined series of processes to be converted. This processing program is, for example, a system control program for an NC machine tool that is created in a software program language such as C language and then converted into a machine language, and includes a plurality of different execution instructions. While being executed sequentially according to a predetermined order as shown in FIG. 2, a part of each execution instruction is repeatedly executed a plurality of times. As shown in FIG. 3, the execution instructions and data necessary for the execution are stored in association with addresses in the storage unit.

前記実行処理部12は、前記実行命令を当該実行命令が格納された原プログラム記憶部11内のアドレスから、前記実行順序に従い順次読み出して、前記処理プログラムを実行する処理を行う。   The execution processing unit 12 sequentially reads the execution instructions from the address in the original program storage unit 11 where the execution instructions are stored according to the execution order, and executes the processing program.

前記監視処理部13は、実行処理部12における処理を監視して、当該実行処理部12により順次実行される実行命令の前記アドレスを、当該実行命令が実行される順番に前記アドレス記憶部14に格納する処理を行う。尚、アドレス記憶部14に格納されたアドレスのデータ構成は、図4に示すようなデータテーブルとなっている。   The monitoring processing unit 13 monitors the processing in the execution processing unit 12 and stores the addresses of the execution instructions sequentially executed by the execution processing unit 12 in the address storage unit 14 in the order in which the execution instructions are executed. Process to store. The data structure of the address stored in the address storage unit 14 is a data table as shown in FIG.

前記抽出処理部15は、アドレス記憶部14に格納されたアドレスを基に、その並びを確認して、当該アドレスが同じ順番且つ一定範囲内の数(例えば、5個以上100個以下)で並んでいる部分が、予め設定された数以上(例えば、3個以上)あるか否かを確認し、当該設定数以上あることを確認した場合には、該当部分の各アドレスをその並びのまま抽出して、抽出したアドレスを前記抽出アドレス記憶部16に格納する処理を行う。尚、前記一定範囲及び予め設定された数は、当該処理プログラムの処理内容やプログラムデータ量などに応じて適宜設定される。また、同じ順番で並ぶ(抽出される)アドレスの数に上限値を設定しているのは、抽出されるアドレスの数が多くなると、変換処理部17により後述のようにして生成される第2プログラムのデータ量が大きくなり、論理回路22の記憶容量を越える恐れがあるからである。   The extraction processing unit 15 confirms the arrangement based on the addresses stored in the address storage unit 14, and the addresses are arranged in the same order and in a certain range (for example, 5 or more and 100 or less). Check if there are more than the preset number (for example, three or more), and if there are more than the set number, extract each address of the corresponding part as it is Then, the extracted address is stored in the extracted address storage unit 16. The predetermined range and the preset number are appropriately set according to the processing content of the processing program, the amount of program data, and the like. In addition, the upper limit is set for the number of addresses arranged (extracted) in the same order because the conversion processor 17 generates a second value as described later when the number of addresses to be extracted increases. This is because the data amount of the program becomes large and may exceed the storage capacity of the logic circuit 22.

例えば、図4に示したアドレス例では、同じ順番で並んだアドレスとして、アドレス3及びアドレス4と、アドレス6,アドレス7,アドレス8,アドレス9,アドレス10及びアドレス11とが挙げられ、アドレス3及びアドレス4については2個、アドレス6,アドレス7,アドレス8,アドレス9,アドレス10及びアドレス11については3個ある。したがって、前記一定範囲及び予め設定された数の条件を満たすアドレスとして、アドレス6,アドレス7,アドレス8,アドレス9,アドレス10及びアドレス11が抽出され、抽出アドレス記憶部16に格納される。   For example, in the address example shown in FIG. 4, as addresses arranged in the same order, address 3 and address 4, address 6, address 7, address 8, address 9, address 10, and address 11 are given. 2 for address 4 and 3 for address 6, address 7, address 8, address 9, address 10 and address 11. Therefore, address 6, address 7, address 8, address 9, address 10, and address 11 are extracted and stored in the extracted address storage unit 16 as addresses that satisfy the predetermined range and a predetermined number of conditions.

前記変換処理部17は、抽出アドレス記憶部16に格納された抽出アドレス、原プログラム記憶部11に格納された処理プログラムを基に、メインルーチンとなる第1プログラムと、サブルーチンとなる第2プログラムとを生成して、前記処理プログラムを、当該生成した第1プログラム及び第2プログラムからなる新たな処理プログラムに変換する処理を行う。   Based on the extracted address stored in the extracted address storage unit 16 and the processing program stored in the original program storage unit 11, the conversion processing unit 17 includes a first program serving as a main routine and a second program serving as a subroutine. Is generated, and the processing program is converted into a new processing program including the generated first program and second program.

具体的には、変換処理部17は、まず、原プログラム記憶部11に格納された処理プログラム、及び抽出アドレス記憶部16に格納された抽出アドレスを基に、当該処理プログラムの全ソースコード(C言語のプログラム)、及び前記抽出アドレスに対応した各実行命令を当該抽出アドレスが並んだ順番で順次実行させるためのソースコードを認識する。   Specifically, the conversion processing unit 17 first determines all source codes (C) of the processing program based on the processing program stored in the original program storage unit 11 and the extraction address stored in the extraction address storage unit 16. Language program) and source code for sequentially executing the execution instructions corresponding to the extracted addresses in the order in which the extracted addresses are arranged.

ついで、認識した、抽出アドレスに対応した各実行命令のソースコードを、例えば、FPGAなどのプログラム可能な論理回路22を動作させるためのハードウェア記述言語に変換して前記第2プログラムを生成するとともに、認識した全ソースコードから、抽出アドレスに対応した各実行命令のソースコードを削除して、前記一連の処理を実行させるとともに、当該一連の処理の内、前記抽出アドレスに対応した各実行命令により順次実行される処理については、前記第2プログラムで実行させるように構成された前記第1プログラムを生成する。   Next, the recognized source code of each execution instruction corresponding to the extracted address is converted into a hardware description language for operating a programmable logic circuit 22 such as an FPGA to generate the second program. The source code of each execution instruction corresponding to the extracted address is deleted from all the recognized source codes, and the series of processes is executed, and each execution instruction corresponding to the extraction address is included in the series of processes. For the processing to be executed sequentially, the first program configured to be executed by the second program is generated.

これにより、例えば、図2に示した実行順序で実行される処理プログラムは、図5に示すように、メインルーチンたる第1プログラムとサブルーチンたる第2プログラムとによって当該各実行命令が順次実行されるような新たな処理プログラムに変換される。そして、変換処理部17は、生成した第1プログラム及び第2プログラムを、前記生成プログラム記憶部18に格納する。   Thereby, for example, in the processing program executed in the execution order shown in FIG. 2, the execution instructions are sequentially executed by the first program as a main routine and the second program as a subroutine as shown in FIG. It is converted into such a new processing program. Then, the conversion processing unit 17 stores the generated first program and second program in the generated program storage unit 18.

前記書込処理部19は、生成プログラム記憶部18に格納された第1プログラム及び第2プログラムを基に、第1プログラムについては、そのプログラム言語をC言語から機械語に変換した後、ROM21に書き込む一方、第2プログラムについては、ハードウェア記述言語のプログラムを、前記論理回路22に書き込むための書き込みデータに変換した後、当該論理回路22に書き込む処理を行う。   The write processing unit 19 converts the program language from C language to machine language based on the first program and the second program stored in the generated program storage unit 18, and then stores them in the ROM 21. On the other hand, with respect to the second program, the hardware description language program is converted into write data for writing to the logic circuit 22 and then written to the logic circuit 22.

以上のように構成された本例のプログラム変換装置1によれば、まず、原プログラム記憶部11内に、変換対象となる、所定の一連の処理を行うための処理プログラムが格納される。尚、この処理プログラムは、それぞれ異なる複数の実行命令を含んでおり、当該各実行命令などが、記憶部内のアドレスと対応付けられてそれぞれ格納される。   According to the program conversion apparatus 1 of the present example configured as described above, first, a processing program for performing a predetermined series of processes to be converted is stored in the original program storage unit 11. The processing program includes a plurality of different execution instructions, and each execution instruction is stored in association with an address in the storage unit.

そして、実行処理部12により、実行命令が原プログラム記憶部11内の対応するアドレスから、実行順序に従い順次読み出されて、処理プログラムが実行されると、当該実行処理部12における処理を監視する監視処理部13により、実行処理部12によって順次実行される実行命令の前記アドレスが、その実行順にアドレス記憶部14に格納される。   Then, when the execution processing unit 12 sequentially reads the execution instruction from the corresponding address in the original program storage unit 11 according to the execution order and executes the processing program, the processing in the execution processing unit 12 is monitored. The monitoring processing unit 13 stores the addresses of the execution instructions sequentially executed by the execution processing unit 12 in the address storage unit 14 in the order of execution.

この後、抽出処理部15により、アドレス記憶部14に格納されたアドレスを基に、その並びが確認されて、当該アドレスが同じ順番且つ一定範囲内の数で並んでいる部分が所定数以上あるか否かが確認され、所定数以上あることが確認された場合には、該当部分の各アドレスがその並びのまま抽出されて抽出アドレス記憶部16に格納される。一方、所定数以上あることが確認されなかった場合には、上記一連の処理が終了する。   Thereafter, the extraction processing unit 15 confirms the arrangement based on the addresses stored in the address storage unit 14, and there are a predetermined number or more portions where the addresses are arranged in the same order and in a certain range. If it is confirmed that the number is equal to or greater than the predetermined number, the addresses of the corresponding part are extracted as they are arranged and stored in the extracted address storage unit 16. On the other hand, if it is not confirmed that there are a predetermined number or more, the above series of processing ends.

抽出処理部15によってアドレスが抽出されると、変換処理部17により、抽出アドレス記憶部16に格納された抽出アドレス、及び原プログラム記憶部11に格納された処理プログラムを基に、前記抽出アドレスに対応した各実行命令を当該抽出アドレスが並んだ順番で順次実行させるように構成されたサブルーチンたる第2プログラムと、前記一連の処理を実行させるとともに、当該一連の処理の内、前記抽出アドレスに対応した各実行命令により順次実行される処理については前記第2プログラムで実行させるように構成されたメインルーチンたる第1プログラムとが生成されて、前記変換前の処理プログラムが、当該生成された第1プログラム及び第2プログラムからなる新たな処理プログラムに変換される。   When the address is extracted by the extraction processing unit 15, the conversion processing unit 17 converts the address into the extraction address based on the extraction address stored in the extraction address storage unit 16 and the processing program stored in the original program storage unit 11. The second program, which is a subroutine configured to sequentially execute the corresponding execution instructions in the order in which the extracted addresses are arranged, and the series of processes are executed, and the extracted address is supported in the series of processes. The first program that is a main routine configured to be executed by the second program is generated for the processing that is sequentially executed by each executed instruction, and the processing program before the conversion is generated by the first program It is converted into a new processing program comprising the program and the second program.

そして、変換処理部17によって生成された第1プログラム及び第2プログラムは、当該変換処理部17により、生成プログラム記憶部18に格納され、格納された第1プログラムは、書込処理部19により、ROM21に書き込まれる一方、格納された第2プログラムは、論理回路22に書き込まれる。   Then, the first program and the second program generated by the conversion processing unit 17 are stored in the generated program storage unit 18 by the conversion processing unit 17, and the stored first program is stored by the writing processing unit 19. While being written in the ROM 21, the stored second program is written in the logic circuit 22.

斯くして、本例のプログラム変換装置1によれば、各実行命令の前記アドレスが同じ順番且つ一定範囲内の数で並んでいる部分が所定の設定数以上ある場合に、当該部分の各実行命令により実行される処理を繰り返し処理と判断して、当該繰り返し処理をサブルーチン化した第2プログラムを生成するとともに、当該繰り返し処理については第2プログラムで処理を実行させるように構成された、メインルーチンとなる第1プログラムを生成することにより、変換対象の処理プログラムを、第1プログラム(メインルーチン)及び第2プログラム(サブルーチン)からなる新たな処理プログラムに自動的に変換するので、効率的且つ正確に変換処理を行うことができる。   Thus, according to the program conversion apparatus 1 of the present example, when there are more than a predetermined number of portions where the addresses of the execution instructions are arranged in the same order and in a certain range, each execution of the portion is executed. A main routine configured to determine that the process executed by the instruction is a repetitive process, generate a second program in which the repetitive process is converted into a subroutine, and execute the process with the second program for the repetitive process Is automatically converted into a new processing program consisting of a first program (main routine) and a second program (subroutine), thereby generating an efficient and accurate program. Conversion processing can be performed.

また、第2プログラムを、論理回路22を動作させるためのプログラムとして生成するように構成しているので、生成された第2プログラムのプログラム言語を、論理回路22に対応したプログラム言語に改めて変換しなくても良いので、効率的であり、また、論理回路22用の正確なプログラムを得ることができる。   In addition, since the second program is generated as a program for operating the logic circuit 22, the program language of the generated second program is converted again into a program language corresponding to the logic circuit 22. Since it is not necessary, it is efficient and an accurate program for the logic circuit 22 can be obtained.

また、書込処理部19により、生成プログラム記憶部18に格納された第1プログラム及び第2プログラムを、ROM21及び論理回路22に自動的に書き込むようにしているので、当該書込処理を効率的に実施することができる。   In addition, since the write processing unit 19 automatically writes the first program and the second program stored in the generated program storage unit 18 in the ROM 21 and the logic circuit 22, the write processing is efficient. Can be implemented.

以上、本発明の一実施形態について説明したが、本発明の採り得る具体的な態様は、何らこれに限定されるものではない。   As mentioned above, although one Embodiment of this invention was described, the specific aspect which this invention can take is not limited to this at all.

例えば、前記プログラム変換装置1は、これを、図6に示すようなプログラム変換装置2として構成することもでき、この場合、プログラム変換装置2は、同図6に示すように、原プログラム記憶部31,実行処理部32,監視処理部33,アドレス記憶部34,抽出処理部35,抽出アドレス記憶部36,変換処理部37,変換プログラム記憶部38及び書込処理部39を備える。   For example, the program conversion apparatus 1 can also be configured as a program conversion apparatus 2 as shown in FIG. 6, and in this case, the program conversion apparatus 2 has an original program storage unit as shown in FIG. 31, an execution processing unit 32, a monitoring processing unit 33, an address storage unit 34, an extraction processing unit 35, an extraction address storage unit 36, a conversion processing unit 37, a conversion program storage unit 38 and a writing processing unit 39.

前記原プログラム記憶部31には、変換対象となる処理プログラムが格納される。この処理プログラムは、例えば、C言語などのソフトウェアプログラム言語で作成された後、機械語に変換されたNC工作機械のシステム制御プログラムであり、それぞれ異なる処理内容を実行させるように構成された複数のサブルーチンと、当該各サブルーチンを図7に示すような所定の順序に従い順次実行させるとともに、当該各サブルーチンの一部については複数回繰り返して実行させて、所定の一連の処理を行わせるように構成されたメインルーチンとからなる。尚、各サブルーチンは、少なくともその先頭部分が、図8に示すように、当該原プログラム記憶部31内のアドレスと対応付けられてそれぞれ格納される。   The original program storage unit 31 stores a processing program to be converted. This processing program is, for example, a NC machine tool system control program created in a software program language such as C language and then converted into a machine language. A plurality of processing programs are configured to execute different processing contents. The subroutine and each subroutine are sequentially executed according to a predetermined order as shown in FIG. 7, and a part of each subroutine is repeatedly executed a plurality of times to perform a predetermined series of processes. Main routine. Each subroutine is stored in association with an address in the original program storage unit 31 as shown in FIG.

前記実行処理部32は、原プログラム記憶部31に格納されたメインルーチンを実行するとともに、前記サブルーチンを当該サブルーチンが格納された原プログラム記憶部31内のアドレスから読み出して実行する処理を行う。   The execution processing unit 32 executes a main routine stored in the original program storage unit 31 and performs a process of reading and executing the subroutine from an address in the original program storage unit 31 in which the subroutine is stored.

前記監視処理部33は、実行処理部32における処理を監視して、当該実行処理部32により順次実行されるサブルーチンの前記アドレスを、当該サブルーチンが実行される度に前記アドレス記憶部34に格納する処理を行う。尚、アドレス記憶部34に格納されたアドレスのデータ構成は、図9に示すようなデータテーブルとなっている。   The monitoring processing unit 33 monitors processing in the execution processing unit 32 and stores the addresses of subroutines sequentially executed by the execution processing unit 32 in the address storage unit 34 each time the subroutine is executed. Process. The data structure of the address stored in the address storage unit 34 is a data table as shown in FIG.

前記抽出処理部35は、アドレス記憶部34に格納されたアドレスを基に、当該各アドレス毎の数をそれぞれ計数して、予め設定された数(例えば、3個以上)を超えたアドレスがあるか否かを確認し、当該設定数を超えたアドレスがあることを確認した場合には、そのアドレスを抽出して、抽出したアドレスを前記抽出アドレス記憶部36に格納する処理を行う。尚、前記予め設定された数は、当該処理プログラムの処理内容などに応じて適宜設定される。   The extraction processing unit 35 counts the number of each address based on the address stored in the address storage unit 34, and there is an address exceeding a preset number (for example, 3 or more). When it is confirmed that there is an address exceeding the set number, the address is extracted and the extracted address is stored in the extracted address storage unit 36. The preset number is appropriately set according to the processing contents of the processing program.

例えば、図9に示したアドレス例では、前記予め設定された数(3個以上)を超えたアドレスとして、アドレス3が抽出され、抽出アドレス記憶部36に格納される。   For example, in the address example shown in FIG. 9, the address 3 is extracted as an address exceeding the preset number (three or more) and stored in the extracted address storage unit 36.

前記変換処理部37は、抽出アドレス記憶部36に格納された抽出アドレス、原プログラム記憶部31に格納された処理プログラムを基に、当該処理プログラムを、前記論理回路22を動作させるための論理回路用プログラムを含んだ新たな処理プログラムに変換する処理を行う。   The conversion processing unit 37 is a logic circuit for operating the logic circuit 22 based on the extracted address stored in the extracted address storage unit 36 and the processing program stored in the original program storage unit 31. A process for converting to a new processing program including the processing program is performed.

具体的には、変換処理部37は、まず、原プログラム記憶部31に格納された処理プログラム、及び抽出アドレス記憶部36に格納された抽出アドレスを基に、メインルーチンのソースコード(C言語のプログラム)、及び前記抽出アドレスに対応したサブルーチンのソースコード(C言語のプログラム)を認識する。   Specifically, the conversion processing unit 37 first generates the main routine source code (C language) based on the processing program stored in the original program storage unit 31 and the extracted address stored in the extracted address storage unit 36. Program) and subroutine source code (C language program) corresponding to the extracted address.

ついで、認識したサブルーチンのソースコードを、ハードウェア記述言語に変換して前記論理回路用プログラムに変換するとともに、認識したメインルーチンのソースコードを基に、当該メインルーチンを、前記一連の処理の内、前記抽出アドレスに対応したサブルーチンにより実行される処理を、前記変換した論理回路用プログラムで実行させるように構成された新たなメインルーチンに変換する。   Next, the recognized source code of the subroutine is converted into a hardware description language to be converted into the logic circuit program, and the main routine is converted into the above-mentioned series of processes based on the recognized source code of the main routine. The process executed by the subroutine corresponding to the extracted address is converted into a new main routine configured to be executed by the converted logic circuit program.

これにより、例えば、図7に示した実行順序で実行される処理プログラムは、変換後の前記論理回路用プログラム(サブルーチン3)及びメインルーチン、並びに未変換の前記各サブルーチン(サブルーチン1,サブルーチン2,サブルーチン4及びサブルーチン5)からなる新たな処理プログラムに変換される。そして、変換処理部37は、変換した前記論理回路用プログラム及びメインルーチン、並びに未変換の前記各サブルーチンを、前記変換プログラム記憶部38に格納する。   Thus, for example, the processing program executed in the execution sequence shown in FIG. 7 includes the converted logic circuit program (subroutine 3) and main routine, and the unconverted subroutines (subroutine 1, subroutine 2, subroutine 2). It is converted into a new processing program consisting of subroutine 4 and subroutine 5). Then, the conversion processing unit 37 stores the converted logic circuit program and main routine and the unconverted subroutines in the conversion program storage unit 38.

前記書込処理部39は、変換プログラム記憶部38に格納された論理回路用プログラム,メインルーチン及び未変換の各サブルーチンを基に、メインルーチンについては、メインルーチンのプログラム言語をC言語から機械語に変換した後、未変換の各サブルーチンについてはそのまま、ROM21に書き込む一方、論理回路用プログラムについては、ハードウェア記述言語のプログラムを、前記論理回路22に書き込むための書き込みデータに変換した後、当該論理回路22に書き込む処理を行う。   The write processing unit 39 is based on the logic circuit program, main routine, and unconverted subroutines stored in the conversion program storage unit 38. For the main routine, the program language of the main routine is changed from C language to machine language. After being converted to the above, each unconverted subroutine is written in the ROM 21 as it is, while for the logic circuit program, the hardware description language program is converted into write data for writing in the logic circuit 22, A process of writing to the logic circuit 22 is performed.

以上のように構成されたプログラム変換装置2によっても、所定の設定数を超えたサブルーチンの前記アドレスがある場合に、当該サブルーチンにより実行される処理を繰り返し処理と判断して、当該繰り返し処理のプログラムを論理回路用プログラムに変換するとともに、当該繰り返し処理については論理回路用プログラムで処理を実行させるように構成された新たなメインルーチンに、変換前のメインルーチンを変換することにより、変換対象の処理プログラムを、当該変換後の論理回路用プログラム及びメインルーチン、並びに未変換の各サブルーチンからなる新たな処理プログラムに自動的に変換するので、上記プログラム変換装置1と同様の効果を得ることができる。   Even with the program conversion apparatus 2 configured as described above, when there is the subroutine address exceeding a predetermined number, the process executed by the subroutine is determined to be a repetition process, and the program for the repetition process is determined. Is converted into a logic circuit program, and the repetitive processing is converted into a new main routine that is configured to execute the processing by the logic circuit program. Since the program is automatically converted into a new processing program consisting of the converted logic circuit program and main routine and unconverted subroutines, the same effect as the program conversion apparatus 1 can be obtained.

また、上例では、書込処理部19,39が、生成プログラム記憶部18に格納された第1プログラム及び第2プログラムや、変換プログラム記憶部38に格納された論理回路用プログラム及びメインルーチンを、C言語から機械語に変換したり、ハードウェア記述言語を、前記論理回路22に書き込むための書き込みデータに変換した後、ROM21や論理回路22に書き込むように構成したが、これに限られるものではなく、変換処理部17,37が、第1プログラム及び第2プログラムや、論理回路用プログラム及びメインルーチンを、機械語や、論理回路22に書き込むための書き込みデータで生成したり、変換するように構成しても良い。この場合、書込処理部19,39は、生成プログラム記憶部18や変換プログラム記憶部38に格納されたデータを、そのままROM21や論理回路22に書き込むように構成される。   In the above example, the write processing units 19 and 39 execute the first program and the second program stored in the generated program storage unit 18, the logic circuit program and the main routine stored in the conversion program storage unit 38, respectively. In this configuration, the C language is converted into machine language, or the hardware description language is converted into write data for writing into the logic circuit 22 and then written into the ROM 21 or the logic circuit 22. Instead, the conversion processing units 17 and 37 generate or convert the first program and the second program, the logic circuit program, and the main routine using machine language or write data for writing to the logic circuit 22. You may comprise. In this case, the write processing units 19 and 39 are configured to write the data stored in the generated program storage unit 18 and the conversion program storage unit 38 into the ROM 21 and the logic circuit 22 as they are.

また、原プログラム記憶部11,31に格納される前記処理プログラムは、それぞれ異なる複数の実行命令を含んだメインルーチンと、それぞれ異なる複数の実行命令を含み、それぞれ異なる処理内容を実行させるサブルーチンとから構成されていても良い。この場合、メインルーチンの実行命令の中から繰り返し処理を抽出して論理回路用プログラム(新たなサブルーチン)を生成したり、あるサブルーチンの実行命令の中から繰り返し処理を抽出して論理回路用プログラム(新たなサブルーチン)を生成したり、繰り返して実行されるサブルーチンを論理回路用プログラムに変換することができる。   The processing program stored in the original program storage units 11 and 31 includes a main routine including a plurality of different execution instructions and a subroutine including a plurality of different execution instructions and executing different processing contents. It may be configured. In this case, a repetitive process is extracted from the execution instruction of the main routine to generate a logic circuit program (new subroutine), or a repetitive process is extracted from the execution instruction of a certain subroutine to generate a logic circuit program ( A new subroutine) or a subroutine that is repeatedly executed can be converted into a logic circuit program.

また、上例では、各実行命令が図2に示すような実行順序で実行される処理プログラム(即ち、繰り返し処理部(実行命令6,実行命令7,実行命令8,実行命令9,実行命令10及び実行命令11)が連続して3回繰り返される処理プログラム)の繰り返し処理部をサブルーチン化して論理回路22用プログラムを生成するように構成したが、これに限られるものではなく、図10に示すように、他の実行命令を挟んで計3回実行される実行命令6,実行命令7,実行命令8,実行命令9及び実行命令10についても、同様に、サブルーチン化して論理回路22用プログラムを生成することができる。   In the above example, each execution instruction is executed in the execution order as shown in FIG. 2 (that is, a repetitive processing unit (execution instruction 6, execution instruction 7, execution instruction 8, execution instruction 9, execution instruction 10). In addition, the repetitive processing unit of the processing program in which the execution instruction 11) is continuously repeated three times is formed as a subroutine to generate a program for the logic circuit 22, but the present invention is not limited to this, and is shown in FIG. Similarly, the execution instruction 6, execution instruction 7, execution instruction 8, execution instruction 9, and execution instruction 10 that are executed a total of three times with other execution instructions are also converted into subroutines and the program for the logic circuit 22 is executed. Can be generated.

また、更に、各サブルーチンが図7に示すような実行順序で実行される処理プログラム(即ち、サブルーチン3が連続して3回繰り返される処理プログラム)の繰り返し処理部(サブルーチン)を論理回路22用プログラムに変換するように構成したが、これに限られるものではなく、図11に示すように、他のサブルーチンを挟んで計3回実行されるサブルーチン3についても、同様に、論理回路22用プログラムに変換することができる。   Furthermore, a repetitive processing unit (subroutine) of a processing program (that is, a processing program in which subroutine 3 is repeated three times in succession) in which each subroutine is executed in the execution order as shown in FIG. However, the present invention is not limited to this, and as shown in FIG. 11, the program for the logic circuit 22 is similarly applied to the subroutine 3 executed three times in total with other subroutines interposed therebetween. Can be converted.

本発明の一実施形態に係るプログラム変換装置の概略構成を示したブロック図である。It is the block diagram which showed schematic structure of the program conversion apparatus which concerns on one Embodiment of this invention. 各実行命令の実行順序を示した説明図である。It is explanatory drawing which showed the execution order of each execution instruction. 本実施形態の原プログラム記憶部に格納された処理プログラムのデータ構成を示した説明図である。It is explanatory drawing which showed the data structure of the processing program stored in the original program memory | storage part of this embodiment. 本実施形態のアドレス記憶部に格納されたアドレスのデータ構成を示した説明図である。It is explanatory drawing which showed the data structure of the address stored in the address memory | storage part of this embodiment. 本実施形態の変換処理部によって変換された処理プログラムを説明するための説明図である。It is explanatory drawing for demonstrating the processing program converted by the conversion process part of this embodiment. 本発明の他の実施形態に係るプログラム変換装置の概略構成を示したブロック図である。It is the block diagram which showed schematic structure of the program conversion apparatus which concerns on other embodiment of this invention. 各サブルーチンの実行順序を示した説明図である。It is explanatory drawing which showed the execution order of each subroutine. 他の実施形態の原プログラム記憶部に格納された処理プログラムのデータ構成を示した説明図である。It is explanatory drawing which showed the data structure of the processing program stored in the original program memory | storage part of other embodiment. 他の実施形態のアドレス記憶部に格納されたアドレスのデータ構成を示した説明図である。It is explanatory drawing which showed the data structure of the address stored in the address memory | storage part of other embodiment. 各実行命令の実行順序を示した説明図である。It is explanatory drawing which showed the execution order of each execution instruction. 各サブルーチンの実行順序を示した説明図である。It is explanatory drawing which showed the execution order of each subroutine.

符号の説明Explanation of symbols

1 プログラム変換装置
11 原プログラム記憶部
12 実行処理部
13 監視処理部
14 アドレス記憶部
15 抽出処理部
16 抽出アドレス記憶部
17 変換処理部
18 生成プログラム記憶部
19 書込処理部
21 ROM
22 論理回路
DESCRIPTION OF SYMBOLS 1 Program converter 11 Original program memory | storage part 12 Execution process part 13 Monitoring process part 14 Address memory | storage part 15 Extraction process part 16 Extraction address memory | storage part 17 Conversion process part 18 Generation | occurrence | production program storage part 19 Write process part 21 ROM
22 logic circuits

Claims (5)

それぞれ異なる複数の実行命令を含んだ、一連の処理を行うためのプログラムであり、該各実行命令を予め設定された順序に従い順次実行させるとともに、該各実行命令の一部については複数回実行させるように構成された処理プログラムを基に、メインルーチンとなる第1プログラムと、サブルーチンとなる第2プログラムとを生成して、前記処理プログラムを、該第1プログラム及び第2プログラムからなる新たな処理プログラムに変換する装置であって、
変換前の前記処理プログラムを記憶する記憶部であり、前記各実行命令を該記憶部内のアドレスと対応付けてそれぞれ記憶する原プログラム記憶部と、
前記実行命令を該実行命令が格納された前記原プログラム記憶部内のアドレスから、前記実行順序に従い順次読み出して、前記処理プログラムを実行する実行処理部と、
前記アドレスを記憶するアドレス記憶部と、
前記実行処理部における処理を監視して、該実行処理部により順次実行される実行命令の前記アドレスを、該実行命令が実行される順番に前記アドレス記憶部に格納する監視処理部と、
前記アドレス記憶部に格納されたアドレスを基に、その並びを確認して、該アドレスが同じ順番で一定数以上並んでいる部分が、予め設定された数以上あるか否かを確認し、該設定数以上あることを確認した場合には、該当部分の各アドレスをその並びのまま抽出する抽出処理部と、
前記抽出処理部によって抽出されたアドレス、及び前記原プログラム記憶部に格納された処理プログラムを基に、前記抽出アドレスに対応した各実行命令を該抽出アドレスが並んだ順番で順次実行させるように構成された前記第2プログラムと、前記一連の処理を実行させるとともに、該一連の処理の内、前記抽出アドレスに対応した各実行命令により順次実行される処理については、前記第2プログラムで実行させるように構成された前記第1プログラムとを生成して、前記変換前の処理プログラムを、該生成した第1プログラム及び第2プログラムからなる新たな処理プログラムに変換する変換処理部と、
前記変換処理部によって生成された第1プログラム及び第2プログラムを記憶する生成プログラム記憶部とを備えてなることを特徴とするプログラム変換装置。
A program for performing a series of processes including a plurality of different execution instructions, each of which is sequentially executed according to a preset order, and a part of each of the execution instructions is executed a plurality of times. Based on the processing program configured as described above, a first program as a main routine and a second program as a subroutine are generated, and the processing program is converted into a new process including the first program and the second program. A device for converting into a program,
An original program storage unit that stores the processing program before conversion, and stores each execution instruction in association with an address in the storage unit;
An execution processing unit that sequentially reads out the execution instruction from the address in the original program storage unit in which the execution instruction is stored according to the execution order, and executes the processing program;
An address storage unit for storing the address;
A monitoring processing unit that monitors processing in the execution processing unit and stores the addresses of the execution instructions sequentially executed by the execution processing unit in the address storage unit in the order in which the execution instructions are executed;
Based on the addresses stored in the address storage unit, the arrangement is confirmed, and it is confirmed whether there are more than a preset number of portions where the addresses are arranged in a certain number or more in the same order, When it is confirmed that there are more than the set number, an extraction processing unit that extracts each address of the corresponding part as it is,
Based on the address extracted by the extraction processing unit and the processing program stored in the original program storage unit, the execution instructions corresponding to the extraction address are sequentially executed in the order in which the extraction addresses are arranged. The second program and the series of processes are executed, and the processes sequentially executed by the execution instructions corresponding to the extraction addresses in the series of processes are executed by the second program. A conversion processing unit that generates the first program configured as described above and converts the processing program before conversion into a new processing program including the generated first program and second program;
A program conversion apparatus comprising: a generated program storage unit that stores a first program and a second program generated by the conversion processing unit.
前記変換処理部は、前記第2プログラムを、プログラム可能な論理回路を動作させるためのプログラムとして生成するように構成されてなることを特徴とする請求項1記載のプログラム変換装置。   The program conversion apparatus according to claim 1, wherein the conversion processing unit is configured to generate the second program as a program for operating a programmable logic circuit. 前記生成プログラム記憶部に格納された第1プログラム及び第2プログラムを、該第1プログラムについては記憶装置に、該第2プログラムについては前記論理回路に書き込む書込処理部を更に備えてなることを特徴とする請求項2記載のプログラム変換装置。   A write processing unit for writing the first program and the second program stored in the generated program storage unit into the storage device for the first program and the logic circuit for the second program; 3. The program conversion apparatus according to claim 2, wherein それぞれ異なる処理内容を実行させるように構成された複数のサブルーチンと、該各サブルーチンをそれぞれ実行させて予め設定された一連の処理を行わせるように構成されたメインルーチンとからなる処理プログラムを、プログラム可能な論理回路を動作させるための論理回路用プログラムを含んだ新たな処理プログラムに変換する装置であって、
変換前の前記処理プログラムを記憶する記憶部であり、前記各サブルーチンを該記憶部内のアドレスと対応付けてそれぞれ記憶する原プログラム記憶部と、
前記原プログラム記憶部に格納されたメインルーチンを実行するとともに、前記サブルーチンを該サブルーチンが格納された前記原プログラム記憶部内のアドレスから読み出して実行する実行処理部と、
前記アドレスを記憶するアドレス記憶部と、
前記実行処理部における処理を監視して、該実行処理部により実行されるサブルーチンの前記アドレスを、該サブルーチンが実行される度に前記アドレス記憶部に格納する監視処理部と、
前記アドレス記憶部に格納されたアドレスを基に、該各アドレス毎の数をそれぞれ計数して、予め設定された数を超えたアドレスがあるか否かを確認し、該設定数を超えたアドレスがあることを確認した場合には、そのアドレスを抽出する抽出処理部と、
前記抽出処理部によって抽出されたアドレス、及び前記原プログラム記憶部に格納された処理プログラムを基に、該抽出アドレスに対応したサブルーチンを前記論理回路用プログラムに変換するとともに、前記一連の処理の内、前記抽出アドレスに対応したサブルーチンにより実行される処理を、前記変換した論理回路用プログラムで実行させるように構成された新たなメインルーチンに前記メインルーチンを変換して、前記変換前の処理プログラムを、該変換後の論理回路用プログラム及びメインルーチン、並びに未変換の前記各サブルーチンからなる新たな処理プログラムに変換する変換処理部と、
前記変換処理部によって変換された論理回路用プログラム及びメインルーチンを少なくとも記憶する変換プログラム記憶部とを備えてなることを特徴とするプログラム変換装置。
A processing program comprising a plurality of subroutines configured to execute different processing contents and a main routine configured to execute a series of preset processes by executing the subroutines. An apparatus for converting into a new processing program including a logic circuit program for operating a possible logic circuit,
An original program storage unit that stores the processing program before conversion, and stores each subroutine in association with an address in the storage unit;
An execution processing unit that executes a main routine stored in the original program storage unit and reads and executes the subroutine from an address in the original program storage unit in which the subroutine is stored;
An address storage unit for storing the address;
A monitoring processing unit that monitors processing in the execution processing unit and stores the address of a subroutine executed by the execution processing unit in the address storage unit each time the subroutine is executed;
Based on the address stored in the address storage unit, the number for each address is counted to check whether there is an address exceeding the preset number, and the address exceeding the set number If it is confirmed that there is, the extraction processing unit that extracts the address,
Based on the address extracted by the extraction processing unit and the processing program stored in the original program storage unit, a subroutine corresponding to the extraction address is converted into the logic circuit program, and The main routine is converted into a new main routine configured to execute the processing executed by the subroutine corresponding to the extracted address by the converted logic circuit program, and the processing program before the conversion is converted. A conversion processing unit that converts the converted logic circuit program and main routine into a new processing program including the unconverted subroutines;
A program conversion apparatus comprising: a logic circuit program converted by the conversion processing unit and a conversion program storage unit for storing at least a main routine.
前記変換プログラム記憶部に格納された論理回路用プログラム及びメインルーチンを、該論理回路用プログラムについては前記論理回路に、該メインルーチンについては記憶装置に書き込む書込処理部を更に備えてなることを特徴とする請求項4記載のプログラム変換装置。   A logic circuit program and a main routine stored in the conversion program storage unit; a logic processing program for the logic circuit program; and a writing processing unit for writing the main routine to the storage device. 5. The program conversion apparatus according to claim 4, wherein
JP2004225302A 2004-08-02 2004-08-02 Program converter Expired - Fee Related JP4578884B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004225302A JP4578884B2 (en) 2004-08-02 2004-08-02 Program converter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004225302A JP4578884B2 (en) 2004-08-02 2004-08-02 Program converter

Publications (2)

Publication Number Publication Date
JP2006048201A JP2006048201A (en) 2006-02-16
JP4578884B2 true JP4578884B2 (en) 2010-11-10

Family

ID=36026700

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004225302A Expired - Fee Related JP4578884B2 (en) 2004-08-02 2004-08-02 Program converter

Country Status (1)

Country Link
JP (1) JP4578884B2 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04175974A (en) * 1990-11-09 1992-06-23 Hitachi Ltd Automatic generating method for coprocessor logic circuit
JPH05298115A (en) * 1992-04-23 1993-11-12 Toshiba Corp Device and method for processing data
JPH0869447A (en) * 1994-08-31 1996-03-12 Toshiba Corp Data processor
WO2001090887A1 (en) * 2000-05-25 2001-11-29 Fujitsu Limited Method fir processing program for high-speed processing by using dynamically reconfigurable hardware and program for executing the processing method
JP2003177806A (en) * 2001-12-12 2003-06-27 Mitsubishi Electric Corp Personal computer nc, programmable controller with personal computer and software developing tool for programmable controller

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04175974A (en) * 1990-11-09 1992-06-23 Hitachi Ltd Automatic generating method for coprocessor logic circuit
JPH05298115A (en) * 1992-04-23 1993-11-12 Toshiba Corp Device and method for processing data
JPH0869447A (en) * 1994-08-31 1996-03-12 Toshiba Corp Data processor
WO2001090887A1 (en) * 2000-05-25 2001-11-29 Fujitsu Limited Method fir processing program for high-speed processing by using dynamically reconfigurable hardware and program for executing the processing method
JP2003177806A (en) * 2001-12-12 2003-06-27 Mitsubishi Electric Corp Personal computer nc, programmable controller with personal computer and software developing tool for programmable controller

Also Published As

Publication number Publication date
JP2006048201A (en) 2006-02-16

Similar Documents

Publication Publication Date Title
US9841744B2 (en) Programmable controller, peripheral device thereof, and table data access program of programmable controller
JP2004013896A5 (en)
JP2015531936A (en) Instruction insertion in state machine engines
US20230117626A1 (en) Convolution apparatus, convolution method, matrix unknit-knit device and matrix unknit-knit method
KR101324370B1 (en) Sequence program debugging device, debugging method, and program
JP2008518355A5 (en)
US9824229B2 (en) Controller with enhanced reliability
JP6240136B2 (en) PLC system and operation method thereof
JP4578884B2 (en) Program converter
JP5353063B2 (en) Coping knowledge generation program, coping knowledge generation device, and coping knowledge generation method
CN101939733A (en) External device access apparatus, control method thereof, and system lsi
WO2010044189A1 (en) Apparatus and method for controlling machine tool
JP5267243B2 (en) Behavior description conversion apparatus, behavior description conversion method, and program
JP6025955B1 (en) Program analysis apparatus and program analysis method
JP6547345B2 (en) Test case generation program, test case generation method and test case generation apparatus
JP2020149300A (en) Device, method, and program for displaying graphs
JP2020149299A (en) Device, method, and program for displaying graphs
JP3019922B2 (en) Trace data reduction method
JP3066643B2 (en) Interpreter processing device
JP7419956B2 (en) Information processing device, information processing method and program
JP5354463B2 (en) Programmable controller
JP2010198132A (en) Programmable controller
TW202414133A (en) Portable operating devices, mechanical systems and memory control programs of portable operating devices
JPWO2021260888A5 (en) Information processing device, information processing method, and program
CN110597504A (en) Rapid generation method of data table codes

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20070509

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20091126

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

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20100825

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130903

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Ref document number: 4578884

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees