JP2011076619A - Program code compression device, program code compression method, and program of program code compression method - Google Patents

Program code compression device, program code compression method, and program of program code compression method Download PDF

Info

Publication number
JP2011076619A
JP2011076619A JP2010258969A JP2010258969A JP2011076619A JP 2011076619 A JP2011076619 A JP 2011076619A JP 2010258969 A JP2010258969 A JP 2010258969A JP 2010258969 A JP2010258969 A JP 2010258969A JP 2011076619 A JP2011076619 A JP 2011076619A
Authority
JP
Japan
Prior art keywords
execution
data
command
processing
code
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.)
Granted
Application number
JP2010258969A
Other languages
Japanese (ja)
Other versions
JP5247791B2 (en
Inventor
Yamahiko Ito
山彦 伊藤
Shigeki Suzuki
繁樹 鈴木
Yoshiko Ochiai
淑子 落合
Noriyuki Kushiro
紀之 久代
Yoshiaki Koizumi
吉秋 小泉
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2010258969A priority Critical patent/JP5247791B2/en
Publication of JP2011076619A publication Critical patent/JP2011076619A/en
Application granted granted Critical
Publication of JP5247791B2 publication Critical patent/JP5247791B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a program code compression method and the like to realize a program execution device and the like reducing the memory capacity of a buffer while preventing reduction in an execution processing speed. <P>SOLUTION: The program code compression device compresses a program code constructed of one or more execution codes, each of which is constructed of a command showing execution processing content and processing data used by the command for execution processing and is described in a character string format of text data. The program code compression device is equipped with: a processing data-command discrimination part 1A discriminating each of the execution codes between the processing data and the command by collating the respective execution codes with a dictionary storing the all commands previously; and a conversion part 1B performing conversion processing on each of the processing data and the command respectively, to compress the execution codes. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明はプログラムコードに基づいて実行処理を行うプログラム実行装置、方法等を実現するためのプログラムコード圧縮方法、装置等に関するものである。   The present invention relates to a program code compression method, device, and the like for realizing a program execution device, method, and the like that execute execution processing based on a program code.

家電機器(エアコン、冷蔵庫、洗濯機、放電灯点灯装置等)等においては、その動作を制御するため、プログラム実行装置を組み込んでいる(以下、このような家電機器、家電機器アダプタ等を組み込み機器という)。ここで、プログラム実行装置が実行処理を行うためには、あらかじめ定められたプログラムコードと呼ばれるデータを必要とする。このプログラムコードは、例えば組み込み機器内に設けられたROM(Read Only Memory)等の記憶手段にあらかじめ記憶されており、プログラム実行装置はROMに記憶されたプログラムコードを読み込んで(入力して)実行処理を行っている。   In home appliances (air conditioners, refrigerators, washing machines, discharge lamp lighting devices, etc.), etc., a program execution device is incorporated in order to control the operation (hereinafter, such appliances, home appliance adapters, etc. are incorporated). Called). Here, in order for the program execution apparatus to execute the execution process, data called a predetermined program code is required. This program code is stored in advance in storage means such as a ROM (Read Only Memory) provided in the embedded device, for example, and the program execution device reads (inputs) the program code stored in the ROM and executes it Processing is in progress.

ここで、プログラムコードを圧縮処理して、記憶すべきデータ量を減らし、ROM等の記憶手段の記憶容量をできるだけ減らすことにより、記憶手段に係るコストを低減させているプログラム実行装置がある(例えば特許文献1参照)。このようにプログラムコードのデータ量を減らすことは、今後、組み込み機器がネットワークを介して相互に接続され、例えば、プログラムコードのデータを含む信号を送受信するような場合には都合がよい。   Here, there is a program execution device that reduces the cost associated with the storage means by compressing the program code, reducing the amount of data to be stored, and reducing the storage capacity of the storage means such as ROM as much as possible (for example, Patent Document 1). Reducing the data amount of the program code in this way is convenient in the case where embedded devices are connected to each other via a network in the future and, for example, transmit / receive a signal including program code data.

特開2002−318696号公報JP 2002-318696 A

通常、プログラムコードが圧縮されると、プログラム実行装置の実行処理速度が低減する。そこでRAM(Randam Access Memory)等で構成される、一時的な記憶手段(バッファ)に、伸張したプログラムコードを蓄えておく方法が採られている。そのため、RAMの容量を多く必要とする。   Usually, when the program code is compressed, the execution processing speed of the program execution device is reduced. Therefore, a method of storing the expanded program code in a temporary storage means (buffer) composed of RAM (Randam Access Memory) or the like is employed. Therefore, a large capacity of RAM is required.

そこで、本発明は、圧縮したプログラムコードによりROMの記憶容量の低減を図りつつ、さらに、プログラム実行装置の実行処理速度の低減を防ぎながら、用意すべきバッファの記憶容量を低減することができるプログラム実行装置、方法等を実現するためのプログラムコード圧縮方法、装置等を実現することを目的とする。   Therefore, the present invention is a program capable of reducing the storage capacity of a buffer to be prepared while reducing the storage capacity of the ROM by the compressed program code and further preventing the reduction of the execution processing speed of the program execution device. It is an object of the present invention to realize a program code compression method, apparatus and the like for realizing an execution apparatus and method.

本発明に係るプログラムコード圧縮装置は、実行処理内容を表すコマンドとコマンドが実行処理に用いる処理データとで構成されテキストデータの文字列形式によって記述される実行コードが1又は複数で構成されるプログラムコードを圧縮するプログラムコード圧縮装置であって、各実行コードをあらかじめすべてのコマンドが記憶されている辞書と照合することにより各実行コードを処理データとコマンドとに識別する識別手段と、処理データとコマンドとに対してそれぞれ変換処理を行って実行コードを圧縮する変換手段と、を備えるものである。   The program code compression apparatus according to the present invention is a program comprising one or a plurality of execution codes composed of commands representing execution processing contents and processing data used by the commands for the execution processing and described in a character string format of text data. A program code compression apparatus for compressing a code, wherein each execution code is compared with a dictionary in which all commands are stored in advance to identify each execution code into processing data and a command, processing data, Conversion means for performing a conversion process on each of the commands and compressing the execution code.

本発明によれば、処理データとコマンドとが順にテキストデータの文字列形式によって並べられた実行コードにより構成されるプログラムコードを圧縮する際、識別手段が各実行コードの処理データとコマンドとを識別し、変換手段が変換処理を行って圧縮した実行コードを生成するようにしたので、処理データとコマンドとに対して、それぞれ処理を行って圧縮することができる。   According to the present invention, when compressing a program code composed of an execution code in which processing data and a command are sequentially arranged in a character string format of text data, the identification unit identifies the processing data and the command of each execution code. Since the conversion means performs the conversion process to generate the compressed execution code, the process data and the command can be respectively processed and compressed.

第1の実施の形態に係るプログラムコードの圧縮処理を表す図である。It is a figure showing the compression process of the program code which concerns on 1st Embodiment. 本発明の実施の形態2に係るプログラム実行装置を表す図である。It is a figure showing the program execution apparatus which concerns on Embodiment 2 of this invention. プログラム実行装置における動作を表すフローチャートである。It is a flowchart showing the operation | movement in a program execution apparatus. 実施の形態3に係る圧縮された実行コードを表す図である。FIG. 10 is a diagram illustrating compressed execution code according to the third embodiment.

実施の形態1.
図1は本発明の第1の実施の形態に係るプログラムコードの圧縮処理を表す図である。図1の上側には実行コードの一例を示している。ここではテキストデータとして記述されている。プログラムコードは1又は複数の実行コードで構成される。まず、実行コードについて説明する。本実施の形態においては、プログラムコードに用いる言語としてForth を用い、ECHONET (ECHONET はECHONET コンソーシアムの商標)の規格における実行処理を行うためのコードであるとする。ECHONET とは、家電機器同士を連携させつつ制御を行なうためのネットワーク(通信回線)の規格である。また、Forth は構文解析が簡単又は不要な逆ポーランド記法(後置記法)に基づく言語である。本実施の形態において、実行コードは、プログラム実行装置が実行すべき処理を表すコマンド(命令)のデータ(以下、コマンドという。Forth ではwordという)とコマンドに基づく実行処理を行う際に処理されるデータ(以下、処理データという)で構成されている。そして、処理データ、コマンドの順に記述される。ここで各コマンドとその処理内容については、あらかじめ定義づけられて(関連づけられて)データとして登録されている(以下、これを辞書という)。そのため、実行コード内の数字、文字列のデータについて、辞書に登録されていればコマンドであり、登録されていなければ処理データとなる。本実施の形態では、後述する記憶手段2に辞書が記憶されているものとする。
Embodiment 1 FIG.
FIG. 1 is a diagram showing a program code compression process according to the first embodiment of the present invention. An example of the execution code is shown on the upper side of FIG. Here, it is described as text data. The program code is composed of one or a plurality of execution codes. First, the execution code will be described. In the present embodiment, it is assumed that Forth is used as the language used for the program code, and the code is for executing processing according to the ECHONET (ECHONET is a trademark of the ECHONET Consortium) standard. ECHONET is a network (communication line) standard for controlling home appliances while linking them. Forth is a language based on reverse Polish notation (postfix notation) that is easy or unnecessary to parse. In the present embodiment, the execution code is processed when executing an execution process based on a command (instruction) data (hereinafter referred to as a command; referred to as word in Forth) representing a process to be executed by the program execution device. It consists of data (hereinafter referred to as processing data). Then, processing data and commands are described in this order. Here, each command and its processing contents are defined (associated) in advance and registered as data (hereinafter referred to as a dictionary). Therefore, if the number and character string data in the execution code is registered in the dictionary, it is a command, and if not registered, it is processing data. In the present embodiment, it is assumed that a dictionary is stored in the storage unit 2 described later.

コマンドRGST_EPCは組み込み機器のプロパティ情報を登録を実行処理するために記述される。オブジェクトidは組み込み機器のオブジェクトに対して付されるidである。オブジェクトidを表すために2ビットを割り当てている。ECHONET プロパティは、組み込み機器の種類に応じて設定可能なプロパティ(例えば、エアコンにおける風量設定状態等)のコードである。コードの値はECHONET の規格で定められており、8ビットを割り当てている。また、ここではプロパティのデータ型として7種類を用意しており、3ビットを割り当てている。アクセスルールは書き込み(Set )、読み出し(Get )、通知の可否を示すもので3ビットを割り当てている。状変時アナウンス有無はプロパティの状態が変化した際に、ネットワークを介して通知するか否かを表す指標(フラグ)であり、1ビットを割り当てている。データサイズは、プロパティのデータサイズを規定するためのものであり、ECHONET の規格ではその最大値を8640バイトとしており、その数値を表すために14ビットを割り当てている。   The command RGST_EPC is described to execute registration processing of property information of the embedded device. The object id is an id attached to the object of the embedded device. Two bits are assigned to represent the object id. The ECHONET property is a code of a property that can be set according to the type of embedded device (for example, the air volume setting state in an air conditioner). The code value is determined by the ECHONET standard, and 8 bits are assigned. Here, seven types of property data types are prepared, and 3 bits are assigned. The access rule indicates whether or not writing (Set), reading (Get), and notification are possible, and 3 bits are assigned. The status change announcement presence / absence is an index (flag) indicating whether or not to notify via the network when the property state changes, and 1 bit is assigned. The data size is for defining the data size of the property. In the ECHONET standard, the maximum value is 8640 bytes, and 14 bits are assigned to represent the numerical value.

次にプログラムコード圧縮処理装置の構成と処理について説明する。本実施の形態におけるプログラムコード圧縮装置は、制御処理手段1、記憶手段2及び通信手段3で構成されているものとする。制御処理手段1は、処理データ・コマンド識別部1A及び変換部1Bを有している。制御処理手段1には データ・コマンド識別部1Aでは、プログラムコードの各実行コードについて、記憶手段2に記憶されている辞書と照合し、辞書と合致しない文字列、数字等を処理データとし、合致した文字列(スクリプト)をコマンドとすることで、処理データとコマンドとを識別処理する。ここで、実行コードについては、例えば、オペレータが入力手段から入力した指示、データ等に基づいて制御処理手段1のデータ・コマンド識別部1Aの前段に設けられたプログラムコード生成部(図示せず)で生成するようにしてもよいし、別の装置において生成され、通信回線(ECHONET に係るものでなくてもよい)を介して送信された信号に含まれる実行コードを処理するようにしてもよい。   Next, the configuration and processing of the program code compression processing device will be described. It is assumed that the program code compression apparatus in the present embodiment is composed of a control processing unit 1, a storage unit 2, and a communication unit 3. The control processing means 1 has a processing data / command identification unit 1A and a conversion unit 1B. In the control processing means 1, the data / command identification unit 1A compares each execution code of the program code with a dictionary stored in the storage means 2, and uses a character string, number, etc. that does not match the dictionary as processing data, and matches By using the character string (script) as a command, the processing data and the command are identified. Here, with respect to the execution code, for example, a program code generation unit (not shown) provided in the preceding stage of the data / command identification unit 1A of the control processing unit 1 based on instructions, data, and the like input by the operator from the input unit It is also possible to generate the code at the same time, or to process the execution code included in the signal generated by another device and transmitted via a communication line (not necessarily related to ECHONET). .

変換部1Bは、処理データとコマンドとをそれぞれバイナリ形式のデータ(以下、バイナリデータという)で表し、所定のデータ量毎に分けたデータを生成する。本実施の形態においては7ビットを所定の単位とする。例えば処理データが7で割り切れない場合は、例えば残りのビットに“0”を補充する。そして、処理データを表すデータ(以下、このデータについても処理データという)については分けたそれぞれの先頭のビットに“0”を付し、コマンドを判別するためのデータ(以下、このデータについてもコマンドという)については“1”を付す。つまり、これが、処理データであるかコマンドであるかを判定するための判定用ビット(フラグ)となる。これにより、図1の下側に示すように、各実行コード(プログラムコード)は1バイト(8ビット)を単位としたデータ(バイトデータ)に分けられる。このように、各要素(項目)の文字列に分かれていた処理データをバイナリデータとしてまとめて符号化(エンコード)処理してデータ量の低減を図る。   The conversion unit 1B represents processing data and a command in binary format data (hereinafter referred to as binary data), and generates data divided for each predetermined data amount. In this embodiment, 7 bits are set as a predetermined unit. For example, if the processing data is not divisible by 7, for example, the remaining bits are supplemented with “0”. For data representing processing data (hereinafter, this data is also referred to as processing data), “0” is added to each of the divided head bits, and data for determining a command (hereinafter, this data is also referred to as a command). "1" is attached to the above. That is, this is a determination bit (flag) for determining whether it is processing data or a command. Thereby, as shown in the lower side of FIG. 1, each execution code (program code) is divided into data (byte data) in units of 1 byte (8 bits). In this way, the processing data divided into the character strings of the respective elements (items) are collectively encoded as binary data and encoded (encoded) to reduce the data amount.

一方、コマンドについては、そのコマンドと1対1で対応する数値等(コード値)をバイナリデータで表す。これにより、そのバイナリデータが表すコマンドを判別することができる。このコマンドとバイナリデータとの関係は関連づけられて記憶手段2に記憶されており、変換部1Bはデータ生成に際してそのデータを参照する。ここで、コマンド数が128以下であればコマンドを判別するためには1バイトあれば足りる。例えばコマンド数がそれ以上となる等の場合には2バイト以上になるが、その場合でも、実行処理に使用(出現)する頻度の高いコマンド(例えばプロパティ関連等)については、1バイト分のデータでも判別できるようにすれば、プログラムコード全体に係るデータ量をさらに減らすことができる。なお、本実施の形態による方法によって生成したバイトデータを、さらにランレングス法のような公知のビット列圧縮法によって圧縮するようにしてもよい。   On the other hand, for a command, a numerical value (code value) corresponding to the command on a one-to-one basis is represented by binary data. Thereby, the command represented by the binary data can be determined. The relationship between the command and the binary data is associated and stored in the storage unit 2, and the conversion unit 1B refers to the data when generating the data. Here, if the number of commands is 128 or less, one byte is sufficient to determine the command. For example, if the number of commands is more than that, it will be 2 bytes or more, but even in that case, for a command that is frequently used (appears) for execution processing (for example, property-related), 1 byte of data However, if it can be discriminated, the data amount relating to the entire program code can be further reduced. The byte data generated by the method according to the present embodiment may be further compressed by a known bit string compression method such as a run length method.

以上のようにして生成した圧縮したプログラムコードのデータを、例えばネットワークを介して組み込み機器側から送信されたダウンロード要求に応じ、又はプログラムコード圧縮処理装置(制御処理手段1)側から積極的な配信により、通信手段3、有線又は無線の通信回線を介して、後述する実施の形態2の組み込み機器のプログラムコード格納手段24に記憶する。   The compressed program code data generated as described above is actively distributed in response to a download request transmitted from the embedded device side via the network, for example, or from the program code compression processing device (control processing means 1) side. Thus, the data is stored in the program code storage unit 24 of the embedded device according to the second embodiment to be described later via the communication unit 3 and a wired or wireless communication line.

以上のように、第1の実施の形態によれば、各実行コードの処理データとコマンドとを識別し、処理データは各要素(項目)をまとめてバイナリデータとし、コマンドは対応する数値をバイナリデータとして、それぞれのデータを所定の単位(本実施の形態では7ビット)に分け、処理データを含むデータかコマンドを含むデータか判定するための判定用ビットを各データに付すようにして、1バイトのデータに分けるようにしたので、処理データとコマンドをそれぞれ圧縮できる。そして、実行処理を行う際に、読み込みを1バイト毎に行い、そのデータが処理データを含むかコマンドを含むかを簡単に判別できる。また、プログラムコードをForth 等の逆ポーランド記法に基づく言語とすることにより、実行コードが処理データ、コマンドの順に構成されているので、処理データとコマンドとの識別を容易に行うことができる。さらに、プログラムコードを分ける単位を1バイトとすることにより、実行処理を行う際に、例えばワンチップマイコン等のような処理装置でも対応することができる。そして、例えば、実行処理に使用(出現)する頻度の高いコマンドを含むバイト数を低くする等、頻度に応じた調整をすることで、より圧縮効果を高めることができる。   As described above, according to the first embodiment, the processing data and the command of each execution code are identified, and the processing data collects each element (item) as binary data. As data, each data is divided into predetermined units (7 bits in the present embodiment), and a determination bit for determining whether the data includes processing data or data including a command is attached to each data. Since it is divided into byte data, processing data and commands can be compressed respectively. Then, when executing the execution process, reading is performed for each byte, and it can be easily determined whether the data includes processing data or a command. Further, by making the program code a language based on the reverse Polish notation such as Forth, the execution code is configured in the order of the processing data and the command, so that the processing data and the command can be easily identified. Furthermore, by setting the unit for dividing the program code to 1 byte, a processing device such as a one-chip microcomputer can be used when executing the execution process. For example, the compression effect can be further enhanced by adjusting the frequency according to, for example, reducing the number of bytes including commands that are frequently used (appear) in the execution process.

実施の形態2.
図2は本発明の実施の形態2に係るプログラム実行装置を表す図である。本実施の形態では、プログラム実行装置はコード種別判定手段21、コード伸張手段22、実行手段23、プログラムコード格納手段24及びバッファ記憶手段25で構成されている。そして、実施の形態1で生成した圧縮したプログラムコードに基づく実行処理を行うものとする。
Embodiment 2. FIG.
FIG. 2 is a diagram illustrating a program execution device according to Embodiment 2 of the present invention. In the present embodiment, the program execution apparatus includes a code type determination unit 21, a code expansion unit 22, an execution unit 23, a program code storage unit 24, and a buffer storage unit 25. Then, an execution process based on the compressed program code generated in the first embodiment is performed.

コード種別判定手段21は、プログラムコード格納手段24に記憶された圧縮(エンコード)されたプログラムコードを所定のデータ量で読み込む(入力する)。本実施の形態では、実施の形態1に合わせて、所定のデータ量を1バイト(8ビット)とする。そして、読み込んだデータは処理データが含まれているデータ(データバイト。コマンドを含んでいないデータ)かコマンドが含まれているデータ(コマンドバイト)かを判定する。コード種別判定手段21は実施の形態1で説明した判定用ビット(フラグ)に基づいて判定を行うものとする。そして、処理データであると判定するとその処理データをバッファ記憶手段25に記憶させ、コマンドであると判定するとコード伸張手段22に処理の制御を渡す。   The code type determination unit 21 reads (inputs) the compressed (encoded) program code stored in the program code storage unit 24 with a predetermined amount of data. In the present embodiment, in accordance with the first embodiment, the predetermined data amount is 1 byte (8 bits). Then, it is determined whether the read data is data including processing data (data byte, data not including a command) or data including a command (command byte). The code type determination unit 21 performs determination based on the determination bit (flag) described in the first embodiment. If it is determined that it is processing data, the processing data is stored in the buffer storage unit 25, and if it is determined that it is a command, control of processing is passed to the code decompression unit 22.

コード伸張手段22は、コード種別判定手段21がコマンドと判定すると、バッファ記憶手段25に記憶された処理データ及びコマンドに基づいて実行コードを生成(伸張、デコード)する。実行コードを生成すると実行手段23に処理の制御を渡す。   When the code type determination unit 21 determines that the code is a command, the code expansion unit 22 generates (decompresses or decodes) an execution code based on the processing data and the command stored in the buffer storage unit 25. When the execution code is generated, control of processing is transferred to the execution means 23.

実行手段23は、コード伸張手段22が生成した実行コードに基づいて実行処理を行う。ここで、本実施の形態では、実行手段23は実行コードを解釈(翻訳)しながら処理データに対してコマンドの実行処理を行うインタプリタであるとする。したがって、プログラムコードは、実行コード毎に逐次的に実行処理されることになる。ここで、実行手段23は、実行コードを解釈するために、第1の実施の形態で説明した辞書を記憶手段(図示せず)に有しているものとする。実行処理を終了するとコード種別判定手段21に処理の制御を渡す。   The execution unit 23 performs an execution process based on the execution code generated by the code expansion unit 22. Here, in this embodiment, it is assumed that the execution means 23 is an interpreter that executes a command execution process on the processing data while interpreting (translating) the execution code. Therefore, the program code is sequentially executed for each execution code. Here, it is assumed that the execution means 23 has the dictionary described in the first embodiment in the storage means (not shown) in order to interpret the execution code. When the execution process ends, control of the process is passed to the code type determination means 21.

プログラムコード格納手段24及びバッファ記憶手段25はともに記憶手段である。ここで、本実施の形態ではプログラムコード格納手段24を不揮発性メモリとするが、単なるROMではなく、追加、一部又は全部を変更、削除等、プログラムコードの書き換えができるような記憶手段(例えば、EPROM、EEPROM等)であるとする。プログラムコードを書き換える場合、実施の形態1で説明したように、例えばネットワークを介したダウンロードにより、プログラムコードを含む信号を組み込み機器が有する通信手段(図示せず)が受信し、プログラムコード格納手段24に記憶され、保持される。   Both the program code storage means 24 and the buffer storage means 25 are storage means. Here, in the present embodiment, the program code storage means 24 is a non-volatile memory, but it is not a mere ROM, but a storage means (for example, a program code can be rewritten such as adding, changing part or all, or deleting). , EPROM, EEPROM, etc.). When the program code is rewritten, as described in the first embodiment, the communication means (not shown) of the embedded device receives a signal including the program code, for example, by downloading via a network, and the program code storage means 24 Stored and retained.

バッファ記憶手段25は、例えば揮発性メモリとする。バッファ記憶手段25は、コード伸張手段22が実行コードを生成するまでに少なくとも処理データを記憶させておくための一時的な記憶手段であり、次の処理データが入力されれば残さない。したがって、バッファ記憶手段25が有する記憶容量は任意であるが、好ましくは、組み込み機器(プログラム実行装置)が1回に実行処理する実行コードの処理データ部分(又は実行コード)が記憶できる最大の記憶容量とする。   The buffer storage means 25 is, for example, a volatile memory. The buffer storage means 25 is a temporary storage means for storing at least processing data until the code decompression means 22 generates an execution code, and is not left if the next processing data is input. Therefore, the storage capacity of the buffer storage unit 25 is arbitrary, but preferably the maximum storage that can store the processing data portion (or execution code) of the execution code that the embedded device (program execution device) executes at a time. Capacity.

本実施の形態は、実行処理を行う圧縮されたプログラムコードのデータを1バイト毎に読み込み、そのデータに含まれているのが処理データであるかコマンドであるかの判定を行う。処理データであればバッファ記憶手段25に記憶させ、コマンドであると判定すると、伸張手段22がバッファ記憶手段25に記憶した処理データとコマンドとを実行コードにする。その実行コードを実行手段23が実行処理する。これにより、プログラム実行装置によるプログラムコード格納手段24に格納された圧縮されたプログラムコードに基づいて、実行コード毎の実行処理が行われる。ここで、実行処理が終了した実行コード(プログラムコード)を、RAM等のバッファ記憶手段25に不用意に残しておかないようにし、1回の実行処理に必要な実行コードの処理データ(又は実行コード)を一時的に記憶するために必要な量を越えないようにして、バッファ記憶手段25の記憶容量を抑える。また、コード種別判定手段21、コード伸張手段22及び実行手段23について、それぞれ物理的に独立した手段で構成してもよいが、通常、プログラム実行装置はいわゆるマイコン等のコンピュータで構成されており、これらの手段は、例えばCPUを中心とする制御処理装置で構成されている。そして、制御処理装置がそれぞれの手段の処理を実行することで、プログラム実行装置の実行処理を実現する。   In the present embodiment, compressed program code data to be executed is read byte by byte, and it is determined whether the data is processing data or a command. If it is processing data, it is stored in the buffer storage means 25, and if it is determined that it is a command, the decompression means 22 uses the processing data and command stored in the buffer storage means 25 as an execution code. The execution means 23 executes the execution code. Thus, execution processing for each execution code is performed based on the compressed program code stored in the program code storage unit 24 by the program execution device. Here, the execution code (program code) for which the execution process has been completed is not inadvertently left in the buffer storage means 25 such as a RAM, so that the process data (or execution data) of the execution code necessary for one execution process is kept. The storage capacity of the buffer storage means 25 is suppressed so as not to exceed the amount necessary for temporarily storing the code). The code type determination means 21, code decompression means 22 and execution means 23 may be configured by physically independent means, but usually the program execution device is configured by a computer such as a so-called microcomputer. These means are comprised by the control processing apparatus centering on CPU, for example. Then, the control processing device executes processing of each means, thereby realizing execution processing of the program execution device.

図3はプログラム実行装置における実行処理を行う際の動作を表すフローチャートである。ここでは、特にプログラム実行装置のコード種別判定手段21、コード伸張手段22及び実行手段23が行う処理を中心に説明する。コード種別判定手段21は、プログラムコード格納手段24から圧縮されたプログラムコードのデータを1バイト単位で読み込む(S1)。そして、コード種別判定手段21は、実施の形態1で説明した判定用ビットが“0”であるか“1”であるかどうかによって、読み込んだデータがコマンドであるか又は処理データであるか(コマンドでないか)の判定を行う(S2)。処理データである(コマンドでない)と判断すると、判定用ビットを除いた上でバッファ記憶手段25に記憶し(S3)、さらに圧縮されたプログラムコードのデータを1バイト単位で読み込む(S1)。   FIG. 3 is a flowchart showing the operation when executing the execution process in the program execution device. Here, the processing performed by the code type determination unit 21, the code expansion unit 22, and the execution unit 23 of the program execution apparatus will be mainly described. The code type determination unit 21 reads the compressed program code data from the program code storage unit 24 in units of 1 byte (S1). The code type determination unit 21 determines whether the read data is a command or processing data depending on whether the determination bit described in the first embodiment is “0” or “1” ( It is determined whether it is a command (S2). If it is determined that the data is processed data (not a command), the determination bit is removed and stored in the buffer storage means 25 (S3), and the compressed program code data is read in units of 1 byte (S1).

一方、読み込んだデータがコマンドであると判断すると、コード伸張手段22に制御が渡される。コード伸張手段22は、読み込んだデータ(バイナリデータ)に基づいて、そのデータが表すコマンドを判別し、スクリプト形式のコマンドに変換する。この判別には、実施の形態1で説明したバイナリデータとコマンドとの関係を用いる。コマンドが判別できると、コマンドが実行処理を行う処理データの要素(項目)と割り当てられたデータ量(ビット数)がわかるので、処理データのバイナリデータに基づいて、各要素(項目)の処理データに分ける。以上のような伸張処理を行って実行コードを生成する(S4)。   On the other hand, if it is determined that the read data is a command, control is passed to the code expansion means 22. Based on the read data (binary data), the code decompression means 22 determines a command represented by the data and converts it into a script format command. For this determination, the relationship between the binary data and the command described in the first embodiment is used. If the command can be identified, the element (item) of the processing data to be executed by the command and the allocated data amount (number of bits) can be known, so the processing data of each element (item) is based on the binary data of the processing data. Divide into The decompression process as described above is performed to generate an execution code (S4).

そして、コード伸張手段22から実行手段23に制御が渡されると、コード伸張手段22が生成した実行コードに基づいて実行処理を行う(S5)。逆ポーランド記法に基づく言語においては、各要素(項目)はスタックに積まれ、コマンドに基づいて処理される。実行コードに基づく実行処理が終了すると、コード種別判定手段21に制御が渡され、次の実行コードに基づく実行処理に対する処理が行われる。以上のように実行コード毎の実行処理を逐次行ってプログラムコードを実行処理し、組み込み機器が動作する。また、実行処理に基づくデータを含む信号を組み込み機器外の機器にネットワークを介して送信して動作させる。   When control is passed from the code decompression means 22 to the execution means 23, execution processing is performed based on the execution code generated by the code decompression means 22 (S5). In a language based on reverse Polish notation, each element (item) is put on a stack and processed based on a command. When the execution process based on the execution code is completed, control is passed to the code type determination unit 21 and a process for the execution process based on the next execution code is performed. As described above, the execution process for each execution code is sequentially performed to execute the program code, and the embedded device operates. In addition, a signal including data based on the execution process is transmitted to a device outside the embedded device via a network to be operated.

以上のように実施の形態2によれば、プログラムコード格納手段24から、圧縮されたプログラムコードのデータを所定のデータ量(本実施の形態では1バイト)で読み込み、コード種別判定手段21が処理データを含むデータであると判定すれば、バッファ記憶手段25に処理データを一時的に記憶させていき、コマンドを含むデータであると判定すれば、次にコード伸張手段22が実行コードを生成し、実行手段23がその実行コードに基づく実行処理を行うようにしたので、バッファ記憶手段25は、実行コードを生成するまで処理データを記憶させておくだけでよく、これによりバッファ記憶手段25として設けておくべき記憶容量を少なくさせることができる。また、圧縮されたプログラムコードのデータ読み込みから実行コードの実行処理に至るまでのプログラム実行装置の全体の処理がシンプルであるため、生成した実行コード(プログラムコード)を保持しておかなくても速度の低減を防ぐことができる。以上のように、本実施の形態のプログラム実行装置は、処理に係る記憶容量の低減、実行処理速度の維持の両面を両立できたため、動作制御のためのコスト抑制の要求が高い、家電機器に組み込む場合に特に効果を発揮する。また、通信回線を介して、圧縮されたプログラムコードのデータを含む信号を組み込み機器等に送信してプログラムコード格納手段24のデータを書き換えられるようにしたので、プログラムコード格納手段24のプログラムコードを最新に、より効率よく、高度な状態に保つことができる。   As described above, according to the second embodiment, the compressed program code data is read from the program code storage unit 24 with a predetermined data amount (1 byte in the present embodiment), and the code type determination unit 21 performs processing. If it is determined that the data includes data, the processing data is temporarily stored in the buffer storage unit 25. If it is determined that the data includes a command, the code decompression unit 22 then generates an execution code. Since the execution means 23 performs the execution process based on the execution code, the buffer storage means 25 only needs to store the processing data until the execution code is generated, thereby providing the buffer storage means 25. The storage capacity that should be kept can be reduced. In addition, since the entire processing of the program execution device from data reading of the compressed program code to execution processing of the execution code is simple, speed can be maintained even if the generated execution code (program code) is not retained. Can be prevented. As described above, the program execution device according to the present embodiment can achieve both reduction in storage capacity related to processing and maintenance of execution processing speed, so that there is a high demand for cost control for operation control. This is especially effective when incorporated. In addition, since the signal including the compressed program code data is transmitted to the embedded device or the like via the communication line so that the data of the program code storage means 24 can be rewritten, the program code of the program code storage means 24 is changed. Latest, more efficient and more advanced.

実施の形態3.
図4は本発明の実施の形態3に係る圧縮された実行コードのデータ構成を表す図である。上述の実施の形態1においては、バイナリデータにした処理データを先頭から7ビット毎に分けていき(表記されたデータ列においていわゆる左詰めにし)、処理データが7で割り切れない場合には余った残りのビットに“0”等を補充した。
Embodiment 3 FIG.
FIG. 4 is a diagram showing a data structure of the compressed execution code according to the third embodiment of the present invention. In the first embodiment described above, the processing data converted into binary data is divided every 7 bits from the top (so-called left-justified in the indicated data string), and there is a surplus when the processing data is not divisible by 7. The remaining bits are supplemented with “0” or the like.

ここで、実行コードに基づく実行処理を行う際に、スタックのようなデータ構造を採る場合、最後に積んだデータが先頭になり、そのデータから処理を行う(つまり、表記されたデータ列の右側のデータからの処理になる)。例えば、要素(項目)の個数を変化させることができる場合、その個数のデータがスタックの先頭に示される。このようなことから、同じ処理系において統一されている方がなにかと都合がよいこともある。そこで、図4(a)に示すように、バイナリデータをいわゆる右詰めにし、コード伸張手段22の伸張処理においても、その先頭が(補充のデータではなく)処理データの一部となるようにした。   Here, when performing an execution process based on the execution code, if a data structure such as a stack is adopted, the data loaded last is the head, and the process starts from that data (that is, the right side of the indicated data string) Will be processed from the data). For example, when the number of elements (items) can be changed, the number of data is shown at the top of the stack. For this reason, it may be more convenient to be unified in the same processing system. Therefore, as shown in FIG. 4 (a), binary data is so-called right-justified so that the beginning (not supplemental data) of the binary data is part of the processing data in the decompression processing of the code decompression means 22. .

また、図4(b)のように、最初に読み込まれる1バイトのデータ(コマンドを含まないデータ)内に、コマンドを含まないデータのバイト数を表すデータを含ませておくことで、コード種別判定手段21における、コマンドを含んだデータか否かの判定を行わせることができる。図4(b)では、5ビット分(0〜31までの数値)を処理データのバイト数を表すためのデータに割り当てている。これにより、各バイトデータについて判定用ビットを設ける必要がない。そのため、特に処理データを含むデータのバイト数(ビット数)が多いほど効率のよい圧縮を行うことができる。しかも、処理データのバイト数がわかっており、処理データの次にコマンドが続くため、コマンドに対しても判定用ビットを設ける必要がない。これにより、判定用ビットを設けた場合に比べて、例えば1バイトで判別できるコマンド数が2倍に増える。そのため、コマンド数が多い場合にも有効である。   Also, as shown in FIG. 4B, the code type can be obtained by including data representing the number of bytes of data not including a command in 1-byte data (data not including a command) read first. The determination means 21 can determine whether the data includes a command. In FIG. 4B, 5 bits (numerical values from 0 to 31) are allocated to data for representing the number of bytes of processing data. Thereby, it is not necessary to provide a determination bit for each byte data. Therefore, more efficient compression can be performed as the number of bytes (number of bits) of data including processing data increases. Moreover, since the number of bytes of the processing data is known and the command follows the processing data, it is not necessary to provide a determination bit for the command. As a result, the number of commands that can be discriminated by, for example, 1 byte is doubled as compared with the case where a determination bit is provided. Therefore, it is effective even when the number of commands is large.

実施の形態4.
上述した実施の形態では、プログラムコードを逆ポーランド記法に基づく言語で記述し、実行手段23は、その記述を解釈して実行処理を行うインタプリタとした。本発明はこれに限定するものではない。例えば、インタプリタをJavaVM(又はJVM (Java, Java Virtual Machine JVMはアメリカ合衆国およびその他の国における Sun Microsystems, Inc. の商標又は登録商標)等、スタック型言語の実行コードに基づく実行処理を行うインタプリタを処理系として構成してもよい。より汎用的な言語に適用できるようにしておくことで、さらに高度なコード生成ができる可能性がある。
Embodiment 4 FIG.
In the above-described embodiment, the program code is described in a language based on reverse Polish notation, and the execution means 23 is an interpreter that interprets the description and executes execution processing. The present invention is not limited to this. For example, interpreter is JavaVM (or JVM (Java, Java Virtual Machine JVM is a trademark or registered trademark of Sun Microsystems, Inc. in the United States and other countries). It may be configured as a system, and it may be possible to generate more advanced code by making it applicable to more general-purpose languages.

1 制御処理手段、1A 処理データ・コマンド識別部、1B 変換部、2 記憶手段、3 通信手段、21 コード種別判定手段、22 コード伸張手段、23 実行手段、24 プログラムコード格納手段、25 バッファ記憶手段。   DESCRIPTION OF SYMBOLS 1 Control processing means, 1A Processing data and command identification part, 1B conversion part, 2 Storage means, 3 Communication means, 21 Code classification judgment means, 22 Code expansion means, 23 Execution means, 24 Program code storage means, 25 Buffer storage means .

Claims (5)

実行処理内容を表すコマンドと前記コマンドが実行処理に用いる処理データとで構成されテキストデータの文字列形式によって記述される実行コードが1又は複数で構成されるプログラムコードを圧縮するプログラムコード圧縮装置であって、
前記各実行コードをあらかじめすべてのコマンドが記憶されている辞書と照合することにより前記各実行コードを前記処理データと前記コマンドとに識別する識別手段と、
前記処理データと前記コマンドとに対してそれぞれ変換処理を行って実行コードを圧縮する変換手段と、
を備えることを特徴とするプログラムコード圧縮装置。
A program code compression apparatus for compressing a program code composed of one or a plurality of execution codes composed of a command representing execution processing contents and processing data used by the command for execution processing and described in a character string format of text data There,
Identifying means for identifying each execution code as the processing data and the command by comparing each execution code with a dictionary in which all commands are stored in advance;
Conversion means for compressing the execution code by performing conversion processing on the processing data and the command, respectively;
A program code compression apparatus comprising:
前記各コマンドに対応する数値とを関連付けてデータとして記憶する記憶手段を備え、
前記変換手段は、前記識別手段が識別した前記コマンドに対し、前記記憶手段に記憶したデータに基づいて前記対応する数値のデータに変換し、前記コマンドのデータであることを判定するためのフラグデータを付す処理を行うことを特徴とする請求項1記載のプログラムコード圧縮処理装置。
Storage means for associating and storing numerical values corresponding to the respective commands as data;
The conversion means converts the command identified by the identification means into the corresponding numerical data based on the data stored in the storage means, and determines flag data for determining the command data The program code compression processing apparatus according to claim 1, wherein a process of attaching a program is performed.
前記変換手段は、前記識別手段が識別した処理データに対し、前記処理データを構成する要素毎の前記処理データをまとめてバイナリ形式に変換し、所定のデータ量毎に分け、前記処理データであることを判定するためのフラグデータを前記分けたデータに付す処理を行うことを特徴とする請求項1又は2に記載のプログラムコード圧縮処理装置。   The conversion means collectively converts the processing data for each element constituting the processing data into binary format with respect to the processing data identified by the identification means, and divides the processing data into a predetermined amount of data. 3. The program code compression processing apparatus according to claim 1, wherein a process of attaching flag data for determining the above to the divided data is performed. 実行処理内容を表すコマンドと前記コマンドが実行処理に用いる処理データとで構成されテキストデータの文字列形式によって記述される実行コードを読み込み、あらかじめ定めた前記コマンドの文字列と比較し、一致する文字列を前記コマンドとして、各実行コードを前記処理データと前記コマンドとに識別する工程と、
前記処理データと前記コマンドとに対してそれぞれ変換処理を行って実行コードを圧縮する工程と
を1又は複数の前記実行コードで構成されるプログラムコードの前記各実行コードに対して行うことを特徴とするプログラムコード圧縮処理方法。
An execution code composed of a command representing execution processing contents and processing data used by the command for execution processing is read and compared with a predetermined character string of the command by reading an execution code described in a character string format of text data. Identifying a column as the command and identifying each execution code as the processing data and the command;
Performing a conversion process on each of the processing data and the command to compress an execution code for each execution code of a program code composed of one or a plurality of the execution codes, Program code compression processing method.
実行処理内容を表すコマンドと前記コマンドが実行処理に用いる処理データとで構成されテキストデータの文字列形式によって記述される実行コードを読み込み、あらかじめ定めた前記コマンドの文字列と比較し、一致する文字列を前記コマンドとして、各実行コードを前記処理データと前記コマンドとに識別する工程と、
前記処理データと前記コマンドとに対してそれぞれ変換処理を行って実行コードを圧縮する工程とを、
1又は複数の前記実行コードで構成されるプログラムコードの前記各実行コードについて、コンピュータに実行させることを特徴とするプログラムコード圧縮方法のプログラム。
An execution code composed of a command representing execution processing contents and processing data used by the command for execution processing is read and compared with a predetermined character string of the command by reading an execution code described in a character string format of text data. Identifying a column as the command and identifying each execution code as the processing data and the command;
Performing a conversion process on the processing data and the command, respectively, and compressing an execution code,
A program for compressing a program code, which causes a computer to execute the execution code of the program code composed of one or a plurality of the execution codes.
JP2010258969A 2010-11-19 2010-11-19 Program code compression apparatus, method, and program code compression method program Expired - Fee Related JP5247791B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010258969A JP5247791B2 (en) 2010-11-19 2010-11-19 Program code compression apparatus, method, and program code compression method program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010258969A JP5247791B2 (en) 2010-11-19 2010-11-19 Program code compression apparatus, method, and program code compression method program

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2005028123A Division JP4656960B2 (en) 2005-02-03 2005-02-03 Program execution device, method, program execution method program, program code compression device, method, and program code compression method program

Publications (2)

Publication Number Publication Date
JP2011076619A true JP2011076619A (en) 2011-04-14
JP5247791B2 JP5247791B2 (en) 2013-07-24

Family

ID=44020476

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010258969A Expired - Fee Related JP5247791B2 (en) 2010-11-19 2010-11-19 Program code compression apparatus, method, and program code compression method program

Country Status (1)

Country Link
JP (1) JP5247791B2 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS61204741A (en) * 1985-03-06 1986-09-10 Nec Corp Compressing method for source program
JPH10320172A (en) * 1997-05-15 1998-12-04 Seiko Epson Corp Program compressing method, program decoding method and program storing device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS61204741A (en) * 1985-03-06 1986-09-10 Nec Corp Compressing method for source program
JPH10320172A (en) * 1997-05-15 1998-12-04 Seiko Epson Corp Program compressing method, program decoding method and program storing device

Also Published As

Publication number Publication date
JP5247791B2 (en) 2013-07-24

Similar Documents

Publication Publication Date Title
US8448158B2 (en) Program code generation support device and method, program execution device and method, and program code compression processing device and method and program thereof
JP2002529849A (en) Data compression method for intermediate object code program executable in embedded system supplied with data processing resources, and embedded system corresponding to this method and having multiple applications
CN108139896A (en) EVM(extended virtual machine) instruction set framework
KR20120134916A (en) Storage device and data processing device for storage device
JP4638250B2 (en) Program code generation support apparatus and method, and program code generation support method program
CN101231597A (en) Method for execution of JAVA program instruction in smart card
CN105808513A (en) Converting device and converting method
US8572557B2 (en) Program code generation support device and method, program execution device and method, and program code compression processing device and method and program thereof
JP4978025B2 (en) Pointer compression / decompression method, program for executing the same, and computer system using the same
JP4656960B2 (en) Program execution device, method, program execution method program, program code compression device, method, and program code compression method program
JP5247791B2 (en) Program code compression apparatus, method, and program code compression method program
US20150248432A1 (en) Method and system
JP4930435B2 (en) Variable length code decoding apparatus, variable length code decoding method and program
JP2009093513A (en) Method for reducing instruction bit length
US9448975B2 (en) Character data processing method, information processing method, and information processing apparatus
CN100445951C (en) A firmware executing apparatus and executing method, a firmware configuration device and configuration method
JP6245028B2 (en) Execution control method, execution control program, and execution control apparatus
JP2007004475A (en) Processor and method for executing program
JP2001043082A (en) Information processor and method for coding and decoding instruction
JPH113105A (en) Programming device for programmable controller
CN113759884B (en) Method and system for generating input/output point product file of distributed control system
JP6615843B2 (en) Instruction processing apparatus and instruction processing system
JP2010282248A (en) Programming language analysis execution program
CN113541694A (en) Data compression method and device and electronic equipment
CN115543472A (en) Fixed-length instruction set program operation method and central processing unit

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20121225

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130207

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130409

R150 Certificate of patent or registration of utility model

Ref document number: 5247791

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20160419

Year of fee payment: 3

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

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees