JP6214455B2 - Instruction table generation apparatus, instruction decode program generation apparatus, instruction table generation method, instruction decode program generation method, and program - Google Patents

Instruction table generation apparatus, instruction decode program generation apparatus, instruction table generation method, instruction decode program generation method, and program Download PDF

Info

Publication number
JP6214455B2
JP6214455B2 JP2014081581A JP2014081581A JP6214455B2 JP 6214455 B2 JP6214455 B2 JP 6214455B2 JP 2014081581 A JP2014081581 A JP 2014081581A JP 2014081581 A JP2014081581 A JP 2014081581A JP 6214455 B2 JP6214455 B2 JP 6214455B2
Authority
JP
Japan
Prior art keywords
instruction
field
fields
size
item
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2014081581A
Other languages
Japanese (ja)
Other versions
JP2015203895A (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.)
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 JP2014081581A priority Critical patent/JP6214455B2/en
Publication of JP2015203895A publication Critical patent/JP2015203895A/en
Application granted granted Critical
Publication of JP6214455B2 publication Critical patent/JP6214455B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Executing Machine-Instructions (AREA)
  • Devices For Executing Special Programs (AREA)

Description

本発明は、命令テーブル生成装置、命令デコードプログラム生成装置、命令テーブル生成方法、命令デコードプログラム生成方法、およびプログラムに関するものである。   The present invention relates to an instruction table generation device, an instruction decode program generation device, an instruction table generation method, an instruction decode program generation method, and a program.

命令セットシミュレータおよびディスアセンブラなどのソフトウェアは、バイナリ形式で与えられた命令語の命令を識別するための命令デコード処理を含む。命令デコード処理はターゲットCPU(Central Processing Unit)の命令セットに依存している。このため複数のCPUに対応した命令セットシミュレータまたはディスアセンブラを得るためにはCPUごとの命令デコード処理を開発する必要がある。   Software such as an instruction set simulator and a disassembler includes an instruction decoding process for identifying an instruction of an instruction word given in a binary format. The instruction decoding process depends on the instruction set of a target CPU (Central Processing Unit). Therefore, in order to obtain an instruction set simulator or disassembler corresponding to a plurality of CPUs, it is necessary to develop an instruction decoding process for each CPU.

CPUごとの命令デコード処理の開発を容易化する方法には、命令セットアーキテクチャ依存の情報を保持した命令テーブルを入力としてデコード処理を行なう方法がある。命令テーブルは、命令の識別に必要な命令ごとのフォーマット情報を保持するデータである。命令の識別に必要なフォーマット情報には、命令語中のどのビットが定数を持つかの情報と、定数を持つビットごとの値に関する情報とが含まれる。フォーマット情報を表現するデータ構造としては、命令語と同じ長さのビット列を命令語のビット列と同じ並び順で一対一に対応させた、マスクパターンとオペコードパターンとの対が用いられる。   As a method for facilitating the development of instruction decoding processing for each CPU, there is a method of performing decoding processing by inputting an instruction table holding information dependent on instruction set architecture. The instruction table is data holding format information for each instruction necessary for instruction identification. The format information necessary for instruction identification includes information on which bits in the instruction word have constants and information on values for each bit having constants. As a data structure expressing the format information, a pair of a mask pattern and an opcode pattern in which a bit string having the same length as the instruction word is associated one-to-one in the same order as the bit string of the instruction word is used.

マスクパターンは、定数を持つビットに対応するビットには"1"を、それ以外のビットには"0"を保持するビットパターンである。またオペコードパターンは、命令語中の定数を持つビットに対応するビットには当該定数の値を、それ以外のビットには"0"を保持するビットパターンである。   The mask pattern is a bit pattern that holds "1" for bits corresponding to bits having constants and "0" for other bits. The opcode pattern is a bit pattern that holds the value of the constant in the bit corresponding to the bit having the constant in the instruction word, and holds “0” in the other bits.

上記の命令テーブルと命令語とを入力とする命令デコード処理は、命令テーブルを巡回し、命令語と一致する命令テーブルエントリを見つけることで、命令の識別を行なう。命令語が命令テーブルエントリと一致するか否かの判定は、命令語とマスクパターンとのビットごとの論理積がオペコードパターンと一致するか否かで行なわれる。   In the instruction decoding process using the instruction table and the instruction word as inputs, the instruction table is circulated and an instruction is identified by finding an instruction table entry that matches the instruction word. Whether or not the instruction word matches the instruction table entry is determined by whether or not the bitwise AND of the instruction word and the mask pattern matches the opcode pattern.

マスクパターンとオペコードパターンとの対を用いた命令テーブルは、命令エンコーディング図に基づいて作成し得る。命令エンコーディング図は、命令フォーマットを視覚的に表現した図でありCPUのマニュアル記載などにも一般に用いられている。命令エンコーディング図において命令フォーマットは命令フィールドごとに区切られている。各命令フィールドには、命令フィールドが定数、すなわちオペコードフィールドの場合、オペコードの値が記載される。また、命令フィールドが任意値、すなわちオペランドフィールドまたは未使用フィールドの場合には、オペランド名の記号または未使用であることを表す記号が記載される。さらに命令フィールドごとに、命令フィールドの位置およびサイズが、対応する命令フィールド付近に、必要に応じて記載されている。   An instruction table using pairs of mask patterns and opcode patterns can be created based on an instruction encoding diagram. The instruction encoding diagram is a diagram that visually represents an instruction format, and is generally used for manual description of a CPU. In the instruction encoding diagram, the instruction format is divided for each instruction field. In each instruction field, when the instruction field is a constant, that is, an operation code field, a value of the operation code is described. In addition, when the instruction field is an arbitrary value, that is, an operand field or an unused field, a symbol indicating an operand name or a symbol indicating that it is unused is described. Further, for each instruction field, the position and size of the instruction field are described near the corresponding instruction field as necessary.

命令エンコーディング図から命令テーブルを人手で直接に作成することも可能であるが、作業をより容易とするために、命令セットの定義を表現する命令定義体を作成し、この命令定義体から命令テーブルを生成することが提案されている。   Although it is possible to create the instruction table directly from the instruction encoding diagram, in order to make the work easier, an instruction definition body that expresses the definition of the instruction set is created, and the instruction table is created from this instruction definition body. It has been proposed to generate

特開平8−235019号公報(特許文献1)によれば、命令定義体が有する複数のエントリの各々は、1つの命令を表す文字列を有する。マスクデータテーブル生成処理においては、命令セットの定義を表現する命令定義体中の各エントリの文字パターンから1または0を表現する文字が現れる文字位置に対応するマスクデータテーブルの対応するエントリのビット位置に0が置かれ、その他の場合は0が置かれる。オペコードテーブル生成処理においては、命令定義体中の各エントリの文字パターンから1を表現する文字が現れる文字位置に対応するビット位置に1が置かれ、その他の場合は0が置かれる。またオペランドデータ生成処理においては、命令定義体中の各項目の文字パターンから連続する一文字以上の文字で構成されるオペランド定義フィールドが抽出され、オペランドデータの生成が行なわれる。   According to Japanese Patent Laying-Open No. 8-2335019 (Patent Document 1), each of a plurality of entries included in an instruction definition body has a character string representing one instruction. In the mask data table generation process, the bit position of the corresponding entry in the mask data table corresponding to the character position at which the character representing 1 or 0 appears from the character pattern of each entry in the instruction definition body representing the definition of the instruction set 0 is placed in, otherwise 0 is placed. In the operation code table generation process, 1 is placed in the bit position corresponding to the character position where the character expressing 1 appears from the character pattern of each entry in the instruction definition body, and 0 in other cases. In the operand data generation process, an operand definition field composed of one or more consecutive characters is extracted from the character pattern of each item in the instruction definition body, and operand data is generated.

上記公報において文字列の例として"1101ssdd"が挙げられている。文字のそれぞれは右から左へ順に0ビット目から7ビット目に対応している。"1101"がMOV命令のオペコードを表しており、"ss"がソースレジスタ番号を表しており、"dd"がディスティネーションレジスタ番号を表している。この場合、マスクデータテーブルには"11110000"が、オペコードテーブルには"11010000"が生成される。またフィールド名ssおよびddが定義される。フィールドddは0ビット目および1ビット目で示され、フィールドssは2ビット目および3ビット目で示される。   In the above publication, “1101ssdd” is given as an example of a character string. Each of the characters corresponds to the 0th to 7th bits in order from right to left. “1101” represents the opcode of the MOV instruction, “ss” represents the source register number, and “dd” represents the destination register number. In this case, “11110000” is generated in the mask data table and “11010000” is generated in the operation code table. In addition, field names ss and dd are defined. The field dd is indicated by the 0th and 1st bits, and the field ss is indicated by the 2nd and 3rd bits.

特開平8−235019号公報JP-A-8-2335019

上記公報の方法によると、命令定義体中に含めるオペコードは必ず2進数で表現されなければならない。しかしながら命令エンコーディング図は2進数を用いているとは限らず、たとえば16進数が用いられることも多い。この場合、16進数を2進数へ変換しなければならず、さらにその結果を"0"または"1"の文字として入力する際にビット位置を誤らないよう留意が必要である。また入力されたデータの正しさを確認する場合は、ビット数を数えながら2進数のデータを把握することや、2以外の基数での表現への変換が必要となり得る。また各オペランドに対応するビット位置に"s"または"d"などの特定の文字を入力する際にも、ビット位置を誤らないよう留意が必要である。さらに、命令エンコーディング図においてオペランドフィールドの名称が複数の文字からなる場合は、"s"または"d"など何らか1種類の文字を割り当てる作業を要する。   According to the method disclosed in the above publication, the operation code included in the instruction definition body must be expressed in binary. However, instruction encoding diagrams do not always use binary numbers, and for example, hexadecimal numbers are often used. In this case, the hexadecimal number must be converted to a binary number, and care must be taken not to misplace the bit position when the result is input as a character of “0” or “1”. In addition, when confirming the correctness of the input data, it may be necessary to grasp binary data while counting the number of bits, or to convert it to an expression in a radix other than 2. Also, when inputting a specific character such as “s” or “d” in the bit position corresponding to each operand, care must be taken not to make a mistake in the bit position. Furthermore, when the name of the operand field consists of a plurality of characters in the instruction encoding diagram, it is necessary to assign some kind of character such as “s” or “d”.

以上のように、従来の方法では、命令定義体を作成する作業の労力が大きく、また作業に誤りが生じやすかった。これは、命令テーブルまたは命令デコードプログラムを複数のCPUの各々について開発する場合に特に深刻となる。   As described above, in the conventional method, the labor for creating the instruction definition body is large, and errors are easily generated in the work. This becomes particularly serious when an instruction table or an instruction decoding program is developed for each of a plurality of CPUs.

本発明は以上のような課題を解決するためになされたものであり、その目的は、命令テーブルまたは命令デコードプログラムを記述性および可読性に優れた命令定義体から自動的に生成することができる生成装置および生成方法、ならびにプログラムを提供することである。   The present invention has been made to solve the above-described problems, and an object of the present invention is to generate an instruction table or an instruction decoding program that can be automatically generated from an instruction definition body excellent in descriptiveness and readability. An apparatus, a generation method, and a program are provided.

本発明の命令テーブル生成装置または命令デコードプログラム生成装置は構文解析部および計算部を含む。構文解析部は、命令セットを定義する命令定義体に対して構文解析を行なう。前記命令セットは、複数の命令フィールドを有する命令フォーマットで定義される命令を含む。前記命令定義体は、前記命令フォーマットを表現する記述列を含む。前記記述列は前記命令フィールドの各々について、LSB位置、MSB位置およびサイズのいずれか1つの項目を表す位置・サイズ関連文字列と、前記命令フィールドの各々において指定される内容を表す内容文字列との対を前記命令フィールドの並び順で記述している。前記構文解析部は前記記述列に基づいて、前記命令フィールドの各々についての前記1つの項目に関する値を取得する。計算部は、前記構文解析部が取得する前記1つの項目に関する値を用いて前記命令フィールドの各々について、LSB位置、MSB位置およびサイズのうち前記1つの項目と異なる他の項目に関する値を計算する。   The instruction table generating apparatus or instruction decoding program generating apparatus of the present invention includes a syntax analysis unit and a calculation unit. The syntax analysis unit performs syntax analysis on an instruction definition body that defines an instruction set. The instruction set includes instructions defined in an instruction format having a plurality of instruction fields. The instruction definition body includes a description string representing the instruction format. The description string includes, for each of the instruction fields, a position / size related character string representing any one item of LSB position, MSB position and size, and a content character string representing contents designated in each of the instruction fields, Are described in the order of the instruction fields. The syntax analysis unit acquires a value related to the one item for each of the instruction fields based on the description string. The calculation unit calculates a value related to another item different from the one item among the LSB position, the MSB position, and the size for each of the instruction fields, using the value related to the one item acquired by the parsing unit. .

本発明によれば、命令定義体の記述列が各命令フィールドについて記述する位置・サイズ関連文字列が、LSB位置、MSB位置およびサイズのいずれか1つの項目を表し、これに基づいて他の項目の情報が計算される。これにより、記述性および可読性を優先した命令定義体からであっても、命令テーブルまたは命令デコードプログラムの生成に必要な、命令フィールドの位置・サイズ関連の十分な情報が得られる。よって、命令テーブルまたは命令デコードプログラムを、記述性および可読性に優れた命令定義体から自動的に生成することができる。   According to the present invention, the position / size related character string described in each instruction field by the description string of the instruction definition body represents any one item of the LSB position, the MSB position, and the size. Information is calculated. Thereby, even from an instruction definition body giving priority to descriptiveness and readability, sufficient information related to the position and size of the instruction field necessary for generating the instruction table or the instruction decoding program can be obtained. Therefore, an instruction table or an instruction decoding program can be automatically generated from an instruction definition body excellent in descriptiveness and readability.

本発明の実施の形態1における命令テーブル生成装置を含む命令セットシミュレーションシステムの構成を概略的に示すブロック図である。It is a block diagram which shows schematically the structure of the instruction set simulation system containing the instruction table production | generation apparatus in Embodiment 1 of this invention. 命令フォーマットの情報としてマスクパターンおよびオペコードパターンを用いた命令テーブルの例を示す。An example of an instruction table using a mask pattern and an opcode pattern as instruction format information is shown. 図1の命令セットシミュレータによる命令デコード処理を概略的に示すフロー図である。It is a flowchart which shows roughly the instruction decoding process by the instruction set simulator of FIG. 図2の命令テーブルに対応する命令エンコーディング図である。FIG. 3 is an instruction encoding diagram corresponding to the instruction table of FIG. 2. 本発明の実施の形態1における命令定義体の文法を表した拡張バッカス・ナウア記法(EBNF)を示す図である。It is a figure which shows the extended Bacchus-Naur notation (EBNF) showing the grammar of the instruction definition body in Embodiment 1 of this invention. 本発明の実施の形態1における、ADD命令の命令フォーマットと、対応する命令定義体エントリの記述とを例示する図である。FIG. 6 is a diagram illustrating an instruction format of an ADD instruction and a description of a corresponding instruction definition entry in the first embodiment of the present invention. 本発明の実施の形態1における命令テーブルの生成方法を概略的に示すフロー図である。It is a flowchart which shows schematically the production | generation method of the instruction table in Embodiment 1 of this invention. 図7の命令フィールド位置・サイズ解決処理のより詳細を示すフロー図である。FIG. 8 is a flowchart showing more details of the instruction field position / size resolution process of FIG. 7. 図8の構文解析処理のより詳細を示すフロー図である。It is a flowchart which shows the detail of the syntax analysis process of FIG. 図9の"CONTENT"部読出処理のより詳細を示すフロー図である。FIG. 10 is a flowchart showing more details of the “CONTENT” part reading process of FIG. 9. 図10の"CONSTANT"部読出処理のより詳細を示すフロー図である。FIG. 11 is a flowchart showing more details of the “CONSTANT” part reading process of FIG. 10. 図6のADD命令の命令定義体エントリに対して図8の構文解析処理を適用した結果得られる情報を示す図である。FIG. 9 is a diagram showing information obtained as a result of applying the syntax analysis processing of FIG. 8 to the instruction definition entry of the ADD instruction of FIG. 6. 図8の位置・サイズ計算処理のより詳細を示すフロー図である。It is a flowchart which shows the detail of the position and size calculation process of FIG. 図12の構文解析結果に対して図13のフィールド位置・サイズ計算処理を適用した結果得られる情報を示す図である。It is a figure which shows the information obtained as a result of applying the field position and size calculation process of FIG. 13 to the syntax analysis result of FIG. 図7の命令テーブル生成処理のより詳細を示すフロー図である。It is a flowchart which shows the detail of the instruction table production | generation process of FIG. 図15のオペコードパターン生成処理のより詳細を示すフロー図である。FIG. 16 is a flowchart showing more details of the operation code pattern generation processing of FIG. 15. 図15のマスクパターン生成処理のより詳細を示すフロー図である。FIG. 16 is a flowchart showing more details of the mask pattern generation process of FIG. 15. 本発明の実施の形態2における命令デコードプログラム生成装置を含む命令セットシミュレーションシステムの構成を概略的に示すブロック図である。It is a block diagram which shows roughly the structure of the instruction set simulation system containing the instruction decoding program production | generation apparatus in Embodiment 2 of this invention. 図2の命令テーブルを入力とする命令デコード処理と等価な図18の命令デコードプログラムのC言語コードを示す図である。It is a figure which shows the C language code of the instruction decoding program of FIG. 18 equivalent to the instruction decoding process which inputs the instruction table of FIG. 本発明の実施の形態2における命令デコードプログラムの生成方法を概略的に示すフロー図である。It is a flowchart which shows schematically the production | generation method of the instruction decoding program in Embodiment 2 of this invention. 図20の命令デコードプログラム生成処理のより詳細を示すフロー図である。It is a flowchart which shows the detail of the instruction decoding program production | generation process of FIG. 本発明の実施の形態3における命令定義体の文法を表したEBNFを示す図である。It is a figure which shows EBNF showing the grammar of the instruction definition body in Embodiment 3 of this invention. 本発明の実施の形態3における"CONSTANT"部読出処理の構成を概略的にを示すフロー図である。It is a flowchart which shows schematically the structure of the "CONSTANT" part reading process in Embodiment 3 of this invention. 本発明の実施の形態4における構文解析部およびそれへの入力を概略的に示すブロック図である。It is a block diagram which shows roughly the syntax analysis part in Embodiment 4 of this invention, and the input to it. 本発明の実施の形態5における、ADD命令の命令フォーマットと、対応する命令定義体エントリの記述とを例示する図である。It is a figure which illustrates the instruction format of the ADD instruction | indication and description of a corresponding instruction definition body entry in Embodiment 5 of this invention. 図25のADD命令の命令定義体エントリに対して図8の構文解析処理を適用した結果得られる情報を示す図である。FIG. 26 is a diagram illustrating information obtained as a result of applying the syntax analysis processing of FIG. 8 to the instruction definition entry of the ADD instruction of FIG. 本発明の実施の形態5における位置・サイズ計算処理の構成を概略的に示すフロー図である。It is a flowchart which shows schematically the structure of the position and size calculation process in Embodiment 5 of this invention. 図26の構文解析結果に対して図27のフィールド位置・サイズ計算処理を適用した結果得られる情報を示す図である。FIG. 28 is a diagram illustrating information obtained as a result of applying the field position / size calculation processing of FIG. 27 to the syntax analysis result of FIG. 26; 本発明の実施の形態6の命令テーブル生成部の構成を概略的に示すブロック図である。It is a block diagram which shows roughly the structure of the instruction table production | generation part of Embodiment 6 of this invention. 本発明の実施の形態6におけるオペコードパターン生成処理の構成を概略的に示すフロー図である。It is a flowchart which shows schematically the structure of the opcode pattern generation process in Embodiment 6 of this invention. 本発明の実施の形態7において命令テーブルまたは命令デコードプログラムの生成を実行するコンピュータを含むシステムを概略的に示すブロック図である。It is a block diagram which shows roughly the system containing the computer which performs the production | generation of an instruction table or an instruction decoding program in Embodiment 7 of this invention.

以下、図面に基づいて本発明の実施の形態について説明する。なお、以下の図面において同一または相当する部分には同一の参照番号を付しその説明は繰返さない。   Hereinafter, embodiments of the present invention will be described with reference to the drawings. In the following drawings, the same or corresponding parts are denoted by the same reference numerals, and description thereof will not be repeated.

(実施の形態1)
図1は、本実施の形態における命令テーブル生成装置101を含む命令セットシミュレーションシステム901の構成を概略的に示すブロック図である。命令セットシミュレーションシステム901は、命令定義体記憶部50と、命令テーブル記憶部51と、実行対象プログラム記憶部60と、命令セットシミュレータ91と、命令テーブル生成装置101とを有する。命令定義体は、命令セットを定義するデータであり、詳しくは後述する。命令テーブル生成装置101は命令フィールド位置・サイズ解決部110および命令テーブル生成部121を有する。命令フィールド位置・サイズ解決部110は構文解析部111および計算部112を有する。
(Embodiment 1)
FIG. 1 is a block diagram schematically showing a configuration of an instruction set simulation system 901 including an instruction table generation apparatus 101 in the present embodiment. The instruction set simulation system 901 includes an instruction definition storage unit 50, an instruction table storage unit 51, an execution target program storage unit 60, an instruction set simulator 91, and an instruction table generation device 101. The instruction definition body is data defining an instruction set, which will be described later in detail. The instruction table generation apparatus 101 includes an instruction field position / size resolution unit 110 and an instruction table generation unit 121. The instruction field position / size resolution unit 110 includes a syntax analysis unit 111 and a calculation unit 112.

図2は、命令フォーマットの情報としてマスクパターンおよびオペコードパターンを用いた命令テーブルの例を示す。この命令テーブルは、インフィニオンテクノロジーズ社のTriCore(登録商標)アーキテクチャの命令セットに含まれるADD命令、EQ命令、SUB命令およびABS命令の4命令に対応した命令テーブルである。なお、図中のビットパターンには可読性向上のため4ビットごとにハイフンが入れられている。   FIG. 2 shows an example of an instruction table using a mask pattern and an opcode pattern as instruction format information. This instruction table is an instruction table corresponding to four instructions of an ADD instruction, an EQ instruction, a SUB instruction, and an ABS instruction included in the instruction set of the TriCore (registered trademark) architecture of Infineon Technologies. In the bit pattern in the figure, a hyphen is inserted every 4 bits for improving readability.

ADD命令のマスクパターン
0000-1111-1110-0000-0000-0000-1111-1111
は、ADD命令の命令語が、LSB(最下位ビット:Least Significant Bit)を0ビット目としてLSBからMSB(最上位ビット:Most Significant Bit)に向かって数えたとき、27〜21ビット目のビットと7〜0ビット目のビットとが定数を持ち、それ以外のビットが任意の値を持つことを表す。
ADD instruction mask pattern
0000-1111-1110-0000-0000-0000-1111-1111
When the instruction word of the ADD instruction is counted from the LSB toward the MSB (Most Significant Bit) with the LSB (least significant bit) as the 0th bit, the 27th to 21st bit And 7th to 0th bits have constants, and the other bits have arbitrary values.

またADD命令のオペコードパターン
0000-0000-0000-0000-0000-0000-1000-1011
は、定数を持つ27〜21ビット目のビット列が"0000000"であり、定数を持つ7〜0ビット目のビット列が"10001011"であることを表す。すなわち、27〜21ビット目はすべて定数"0"であり、7ビット目と3ビット目と1ビット目と0ビット目とが定数"1"であり、6ビット目と5ビット目と4ビット目と2ビット目とが定数"0"である。
The ADD instruction opcode pattern
0000-0000-0000-0000-0000-0000-1000-1011
Indicates that the bit string of the 27th to 21st bits having a constant is “0000000” and the bit string of the 7th to 0th bits having a constant is “10001011”. That is, the 27th to 21st bits are all constants “0”, the 7th, 3rd, 1st and 0th bits are constant “1”, the 6th, 5th and 4th bits. The first and second bits are the constant “0”.

上記の命令テーブルおよび命令語を入力とする命令デコード処理は、命令テーブルを巡回し、命令語に一致する命令テーブルエントリを見つけることで、命令の識別を行なう。   In the instruction decoding process using the instruction table and the instruction word as input, the instruction table is circulated and the instruction is identified by finding an instruction table entry matching the instruction word.

図3は、命令セットシミュレータ91(図1)が命令のデコードを行なう命令デコード処理のフロー図である。ステップS91〜S94は、命令テーブルエントリを巡回するループ処理である。ループの繰返しごとに変数iは、1から、命令テーブルのエントリ数(図2の場合は4)まで、1ずつ増加する。ステップS92は、命令語がi番目の命令テーブルエントリのパターンと一致するか否かを判定し、一致していればステップS93に分岐し、それ以外の場合はステップS94に分岐する条件分岐処理である。命令語が命令テーブルエントリと一致するか否かの判定は、命令語とマスクパターンのビットごとの論理積がオペコードパターンと一致するか否かで行なわれる。ステップS93では、命令識別子としてi番目の命令テーブルエントリの命令識別子が記憶される。ステップS90が終了した時点で、命令語に対応した命令識別子が得られる。   FIG. 3 is a flowchart of instruction decoding processing in which instruction set simulator 91 (FIG. 1) decodes instructions. Steps S91 to S94 are loop processing that cycles through the instruction table entries. At each iteration of the loop, the variable i increases by 1 from 1 to the number of entries in the instruction table (4 in the case of FIG. 2). In step S92, it is determined whether or not the instruction word matches the pattern of the i-th instruction table entry. If the instruction word matches, the process branches to step S93; otherwise, the conditional branch process branches to step S94. is there. Whether or not the instruction word matches the instruction table entry is determined based on whether or not the logical product for each bit of the instruction word and the mask pattern matches the opcode pattern. In step S93, the instruction identifier of the i-th instruction table entry is stored as the instruction identifier. When step S90 is completed, an instruction identifier corresponding to the instruction word is obtained.

図4は命令テーブル(図2)に対応する、TriCoreの命令エンコーディング図である。ADD命令、EQ命令、SUB命令およびABS命令の各々は、複数の命令フィールドを有する命令フォーマットで定義されている。   FIG. 4 is a TriCore instruction encoding diagram corresponding to the instruction table (FIG. 2). Each of the ADD instruction, EQ instruction, SUB instruction, and ABS instruction is defined in an instruction format having a plurality of instruction fields.

たとえばADD命令の命令エンコーディング図は、縦棒で区切られた5つの四角形の領域で表現されており、それぞれが5つの命令フィールドに対応している。命令フィールドは、たとえば、互いに隣接する"0x00"の命令フィールドと"c"の命令フィールドとを含んでいる。命令フィールドには、"0x"で始まる16進数文字列、英数字の文字列、または"-"が記述されている。命令フィールド中の16進数文字列は、命令語の定数であるオペコードの値である。また命令フィールド中の英数字文字列は、オペランドフィールドの名前である。たとえば、"a"および"b"はデータレジスタを表しており、"const9"は9ビットの任意値を表している。上記ADD命令においては、データレジスタ"a"の内容が"const9"の内容に加えられ、その結果がデータレジスタ"c"に格納される。また命令フィールド中の"-"は未使用(空)であることを表している。   For example, the instruction encoding diagram of the ADD instruction is expressed by five rectangular areas separated by vertical bars, each corresponding to five instruction fields. The instruction field includes, for example, an instruction field “0x00” and an instruction field “c” that are adjacent to each other. In the command field, a hexadecimal character string starting with “0x”, an alphanumeric character string, or “-” is described. The hexadecimal character string in the instruction field is the value of the operation code that is a constant of the instruction word. The alphanumeric character string in the instruction field is the name of the operand field. For example, “a” and “b” represent data registers, and “const9” represents a 9-bit arbitrary value. In the ADD instruction, the contents of the data register “a” are added to the contents of “const9”, and the result is stored in the data register “c”. In addition, “-” in the instruction field indicates unused (empty).

図5は、本実施の形態における命令定義体の文法を表したEBNFを示す。命令定義体は、テキスト文字列であり、非終端記号"DEFINITION"から導出される。命令定義体は、デコード対象となる命令ごとにエントリ"ENTRY"を持つ。各エントリは、命令識別子"ID"および命令フォーマット"FORMAT"の対である。命令識別子"ID"は英数字文字列であり、命令フォーマット"FORMAT"は、命令フィールドごとの情報を表す文字列が、命令語に現れる命令フィールドと同じ順で並べられた文字列である。   FIG. 5 shows EBNF representing the grammar of the instruction definition body in the present embodiment. The instruction definition body is a text string and is derived from the non-terminal symbol “DEFINITION”. The instruction definition body has an entry “ENTRY” for each instruction to be decoded. Each entry is a pair of an instruction identifier “ID” and an instruction format “FORMAT”. The instruction identifier “ID” is an alphanumeric character string, and the instruction format “FORMAT” is a character string in which character strings representing information for each instruction field are arranged in the same order as the instruction fields appearing in the instruction word.

命令フィールドごとの情報は、命令フィールドの数字"DICIMAL_NUMER"および内容"CONTENT"の対である。"DECIMAL_NUMBER"は10進数の文字列であり、本実施の形態においては命令フィールドのサイズを意味する。フィールドの内容"CONTENT"は、命令定義体の命令フィールドの内容文字列であり、定数文字列"CONSTANT"、オペランド文字列"OPERAND"、または空である。定数文字列"CONSTANT"は16進数の文字列表現であり接頭語として"0x"を持つ。オペランド文字列"OPERAND"は、英字で始まる英数字文字列である。   The information for each instruction field is a pair of the instruction field number “DICIMAL_NUMER” and the content “CONTENT”. “DECIMAL_NUMBER” is a decimal character string, and means the size of the instruction field in this embodiment. The content “CONTENT” of the field is a content character string of the instruction field of the instruction definition body, and is a constant character string “CONSTANT”, an operand character string “OPERAND”, or empty. The constant character string “CONSTANT” is a hexadecimal character string representation and has “0x” as a prefix. The operand character string “OPERAND” is an alphanumeric character string starting with an alphabetic character.

内容"CONTENT"が定数"CONSTANT"の場合は、対応する命令フィールドが定数であること、すなわち命令識別用のオペコードフィールドであることを意味する。また、内容"CONTENT"がオペランド文字列"OPERAND"である場合、対応する命令フィールドがオペランドフィールドであることを意味する。また、"CONTENT"が空の場合、命令フィールドは任意の値を持つことを意味する。   When the content “CONTENT” is a constant “CONSTANT”, it means that the corresponding instruction field is a constant, that is, an opcode field for instruction identification. When the content “CONTENT” is the operand character string “OPERAND”, it means that the corresponding instruction field is an operand field. If "CONTENT" is empty, it means that the command field has an arbitrary value.

たとえば、命令定義体におけるADD命令の表現は、
4[c]7[0x00]9[const9]4[a]8[0x8B]
である。
For example, the expression of the ADD instruction in the instruction definition is
4 [c] 7 [0x00] 9 [const9] 4 [a] 8 [0x8B]
It is.

図6は、本実施の形態における、ADD命令の命令フォーマット(図中、上段)と、対応する命令定義体エントリの記述(図中、下段)との例を示す。"4[c]"の部分は、命令の31〜28ビット目が"c"で識別される4ビットのオペランドフィールドであり任意の値を持つことを意味する。"7[0x00]"の部分は、命令の27〜21ビット目が7ビットのオペコードフィールドであり定数0であることを意味する。"9[const9]"の部分は、命令の20〜12ビット目の部分が"const9"で識別される9ビットのオペランドフィールドであり任意の値を持つことを意味する。"4[a]"の部分は、命令の11〜8ビット目がオペランドフィールドであり任意の値を持つことを意味する。"8[0x8B]"の部分は、命令の7〜0ビット目が8ビットのオペコードフィールドであり16進数で"8B"すなわち2進数で"10001101"を定数として持つことを意味する。このように、命令定義体は、命令フォーマットを表現する記述列を含む。   FIG. 6 shows an example of the instruction format of the ADD instruction (upper part in the figure) and the description of the corresponding instruction definition entry (lower part in the figure) in the present embodiment. The part “4 [c]” means that the 31st to 28th bits of the instruction are a 4-bit operand field identified by “c” and have an arbitrary value. The part “7 [0x00]” means that the 27th to 21st bits of the instruction are a 7-bit opcode field and a constant 0. The “9 [const9]” portion means that the 20th to 12th bit portions of the instruction are a 9-bit operand field identified by “const9” and have an arbitrary value. The part “4 [a]” means that the 11th to 8th bits of the instruction are an operand field and have an arbitrary value. The portion “8 [0x8B]” means that the 7th to 0th bits of the instruction are an 8-bit opcode field and have “8B” in hexadecimal, that is, “10001101” in binary as a constant. As described above, the instruction definition body includes a description string representing the instruction format.

この記述列は本実施の形態においては、命令フィールドの各々についてサイズを表す位置・サイズ関連文字列(たとえば図中"8")と、命令フィールドの各々において指定される内容を表す内容文字列(たとえば図中"0x8B")との対(たとえば図中"8[0x8B]")を、命令フィールドの並び順で記述している。なお位置・サイズ関連文字列は、本実施の形態においては上述したようにサイズを表すものであるが、LSB位置、MSB位置およびサイズのいずれか1つの項目を表すものであり得る。   In the present embodiment, this description string is a position / size related character string (for example, “8” in the figure) representing the size of each instruction field, and a content character string representing the contents specified in each instruction field ( For example, a pair with “0x8B” in the figure (for example, “8 [0x8B]” in the figure) is described in the order of the instruction fields. The position / size related character string represents a size as described above in the present embodiment, but may represent any one item of an LSB position, an MSB position, and a size.

図7は、本発明の実施の形態1における命令セットシミュレーションの方法を概略的に示すフロー図である。命令フィールド位置・サイズ解決処理(ステップS30)は、命令定義体記憶部50(図1)に記憶された命令定義体を入力として、命令定義体中で記述されたすべての命令フィールドについて位置とサイズとを計算によって解決する処理である。ステップS60Tは、命令テーブルを生成する処理であり、入力された命令定義体の情報と、ステップS30で計算された命令フィールドのサイズの情報とに基づいて、命令テーブルを生成する。命令テーブルは、命令識別子、オペコードパターンおよびマスクパターンの組をエントリとするテーブルである。生成された命令テーブルは、命令テーブル記憶部51(図1)に格納される。命令セットシミュレータ91(図1)は、命令テーブル記憶部51および実行対象プログラム記憶部60(図1)の各々の内容を入力として実行対象プログラムを模擬実行する。   FIG. 7 is a flowchart schematically showing an instruction set simulation method according to the first embodiment of the present invention. The instruction field position / size resolution process (step S30) receives the instruction definition stored in the instruction definition storage 50 (FIG. 1) as an input, and positions and sizes of all instruction fields described in the instruction definition. Is a process for solving the above by calculation. Step S60T is a process of generating an instruction table. The instruction table is generated based on the input instruction definition information and the instruction field size information calculated in step S30. The instruction table is a table having a combination of an instruction identifier, an operation code pattern, and a mask pattern as an entry. The generated instruction table is stored in the instruction table storage unit 51 (FIG. 1). The instruction set simulator 91 (FIG. 1) simulates and executes the execution target program with the contents of the instruction table storage unit 51 and the execution target program storage unit 60 (FIG. 1) as inputs.

図8は、命令フィールド位置・サイズ解決処理(図7:ステップS30)のより詳細を示すフロー図である。この処理の全体は、ステップS31およびS32の間のループ処理である。このループ処理は、命令定義体のエントリを巡回する処理であり、繰返しごとに命令定義体の1つのエントリを処理する。   FIG. 8 is a flowchart showing more details of the instruction field position / size resolution process (FIG. 7: step S30). The entire process is a loop process between steps S31 and S32. This loop processing is a process of cycling through the entries of the instruction definition body, and processes one entry of the instruction definition body for each repetition.

構文解析処理(ステップS3000)では、命令定義体中において図5の非終端記号"FORMAT"に相当する部分が構文解析部111(図1)によって構文解析される。これにより命令定義体に記載された命令フォーマットの情報が読み出される。本実施の形態においては、この処理において構文解析部111は命令定義体の記述列に基づいて、命令フィールドの各々についてのサイズに関する値を取得する。より一般的に言えば、記述列は命令フィールドの各々について、LSB位置、MSB位置およびサイズのいずれか1つの項目を表す位置・サイズ関連文字列を記述しており、構文解析部111は記述列に基づいて、命令フィールドの各々についての上記1つの項目に関する値を取得する。   In the syntax analysis process (step S3000), the syntax corresponding to the non-terminal symbol “FORMAT” in FIG. 5 in the instruction definition is parsed by the syntax analysis unit 111 (FIG. 1). Thereby, the information of the instruction format described in the instruction definition body is read. In the present embodiment, in this processing, the syntax analysis unit 111 acquires a value related to the size of each instruction field based on the description string of the instruction definition body. More generally speaking, the description string describes a position / size related character string representing any one of the LSB position, the MSB position, and the size for each of the instruction fields. To obtain a value for the one item for each of the instruction fields.

フィールド位置・サイズ計算処理(ステップS5000)では、ステップS3000で読み出された命令フィールドごとの情報を入力として、計算部112(図1)が命令フィールドごとの位置を計算する。本実施の形態の場合、命令フィールドのサイズはステップS3000で構文解析部111が取得済であるため、ステップS5000では、サイズに関する値を用いて命令フィールドの各々について、サイズとは異なる項目、すなわち、LSB位置またはMSB位置が計算される。より一般的に言えば、計算部112は、構文解析部111が取得する、LSB位置、MSB位置およびサイズのいずれか1つの項目に関する値を用いて命令フィールドの各々について、LSB位置、MSB位置およびサイズのうち上記1つの項目と異なる他の項目に関する値を計算する。計算の方法の詳細は後述する。   In the field position / size calculation process (step S5000), the information for each instruction field read in step S3000 is input, and the calculation unit 112 (FIG. 1) calculates the position for each instruction field. In the case of the present embodiment, since the syntax analysis unit 111 has acquired the size of the instruction field in step S3000, in step S5000, for each of the instruction fields, an item different from the size using the value related to the size, that is, The LSB position or MSB position is calculated. More generally speaking, the calculation unit 112 uses the value related to any one item of the LSB position, the MSB position, and the size acquired by the syntax analysis unit 111, for each of the instruction fields, the LSB position, the MSB position, and A value related to another item different from the one item in the size is calculated. Details of the calculation method will be described later.

図9は、構文解析処理(図8:ステップS3000)のより詳細を示すフロー図である。このフローは、命令定義体中の1つのエントリに含まれる"DECIMAL_NUMBER"および"CONTENT"の対をすべて読み出すループになっている。   FIG. 9 is a flowchart showing more details of the syntax analysis process (FIG. 8: step S3000). This flow is a loop for reading all the "DECIMAL_NUMBER" and "CONTENT" pairs included in one entry in the instruction definition body.

ステップS3100は、変数iに数値"1"を代入する処理である。ここで変数iは、命令フィールドに付けられた識別番号であり、ビットの上位側(図6における左側)から順に付されている。   Step S3100 is processing to substitute a numerical value “1” for the variable i. Here, the variable i is an identification number assigned to the instruction field, and is assigned in order from the higher bit side (left side in FIG. 6).

ステップS3200では、命令フィールドの"DECIMAL_NUMBER"部が読み出される。"DECIMAL_NUMBER"部は、10進数の文字列表現であり、本実施の形態では命令フィールドのサイズを表す。   In step S3200, the “DECIMAL_NUMBER” portion of the instruction field is read. The “DECIMAL_NUMBER” portion is a character string representation of a decimal number, and represents the size of the instruction field in this embodiment.

ステップS3300は、ステップS3200で読み出された10進数文字列表現のデータを数値に変換し、i番目の命令フィールドのサイズとして記憶する。   In step S3300, the decimal character string representation data read in step S3200 is converted into a numerical value and stored as the size of the i-th instruction field.

ステップS3400は、命令フィールドの内容情報を読み出す処理である。内容情報は、フィールド値およびフィールド種別の対である。ステップS3400の詳細は後述のとおりである。   Step S3400 is processing for reading the content information of the instruction field. The content information is a pair of field value and field type. Details of step S3400 are as described later.

ステップS3500では、ステップS3400で読み出された命令フィールドの内容情報がi番目の命令フィールドの内容情報として記憶される。   In step S3500, the content information of the instruction field read in step S3400 is stored as the content information of the i-th instruction field.

ステップS3600では、命令フィールドの番号である変数iが、1つ増加した値に更新される。   In step S3600, the variable i, which is the instruction field number, is updated to a value increased by one.

ステップS3700は、エントリの終端に達したか否かを判定する。終端でなければ次の"NUMBER"と"CONTENT"との対を読み出すために、ステップS3200に分岐され、エントリの終端であれば処理が終了される。   Step S3700 determines whether the end of the entry has been reached. If it is not the end, the process branches to step S3200 to read the next pair of “NUMBER” and “CONTENT”. If it is the end of the entry, the process ends.

図10は、"CONTENT"部読出処理(図9:ステップS3400)のより詳細を示すフロー図である。   FIG. 10 is a flowchart showing more details of the “CONTENT” part reading process (FIG. 9: step S3400).

ステップS3401では、命令定義体エントリ中の文字"["が読み飛ばされる。   In step S3401, the character “[” in the instruction definition entry is skipped.

ステップS3402では、読出位置の先頭文字が1文字先読みされ、先頭文字の値によって分岐処理が行なわれる。分岐先は、位置先頭の文字が数字の場合はステップS3410、英字の場合はステップS3440、"]"の場合はステップS3470である。これら3つの場合のそれぞれは、"CONTENT"の内容が定数"CONSTANT"の場合、オペランド"OPERAND"の場合、および空の場合に対応する。   In step S3402, the first character at the reading position is prefetched one character, and branch processing is performed according to the value of the first character. The branch destination is step S3410 if the first character at the position is a number, step S3440 if it is an alphabetic character, and step S3470 if it is "]". Each of these three cases corresponds to the case where the content of “CONTENT” is a constant “CONSTANT”, an operand “OPERAND”, and an empty case.

ステップS3410〜S3430は、"CONTENT"の内容が定数"CONSTANT"の場合の処理フローである。ステップS3410では、"CONSTANT"部を読み出すことで数値が取得される。ステップS3420では、ステップS3410で読み出された値がフィールドの値として記憶される。次にステップS3430では、フィールドの種別として文言「定数」が記憶される。文言「定数」は、フィールドが定数を持つことを表す識別情報である。   Steps S3410 to S3430 are a processing flow when the content of “CONTENT” is a constant “CONSTANT”. In step S3410, a numerical value is acquired by reading the “CONSTANT” portion. In step S3420, the value read in step S3410 is stored as a field value. In step S3430, the word “constant” is stored as the field type. The word “constant” is identification information indicating that the field has a constant.

ステップS3440〜S3460は、"CONTENT"の内容がオペランド"OPERAND"の場合の処理である。ステップS3440では、命令定義体の読出位置から英字で始まる英数字文字列が読み出される。ステップS3450では、フィールドの値として読み出された文字列が記憶される。ステップS3460では、フィールド種別として「任意値」が記憶される。「任意値」はフィールドが任意値を持つことを表す識別情報である。   Steps S3440 to S3460 are processes when the content of “CONTENT” is the operand “OPERAND”. In step S3440, an alphanumeric character string starting with an alphabetic character is read from the reading position of the instruction definition body. In step S3450, the character string read as the field value is stored. In step S3460, “arbitrary value” is stored as the field type. “Arbitrary value” is identification information indicating that the field has an arbitrary value.

ステップS3470は、"CONTENT"の内容が空の場合の処理であり、フィールド種別として「任意値」を記憶する。   Step S3470 is processing when the content of “CONTENT” is empty, and stores “arbitrary value” as the field type.

最後にステップS3480では、文字"]"がスキップされ、読出位置が進められる。   Finally, in step S3480, the character “]” is skipped and the reading position is advanced.

図11は、"CONSTANT"部読出処理(図10:ステップS3410)のより詳細を示すフロー図である。   FIG. 11 is a flowchart showing more details of the “CONSTANT” part reading process (FIG. 10: step S3410).

ステップS3411では、図5の非終端記号"HEX_NUMBER"、すなわち"0x"で始まる16進数文字列が読み出される。   In step S3411, the non-terminal symbol “HEX_NUMBER” in FIG. 5, that is, a hexadecimal character string starting with “0x” is read.

ステップS3414では、ステップS3411で読み出された文字列が数値に変換される。つまり構文解析部111(図1)によって定数文字列が数値に変換される。   In step S3414, the character string read in step S3411 is converted into a numerical value. That is, the constant character string is converted into a numerical value by the syntax analysis unit 111 (FIG. 1).

図12は、ADD命令の命令定義体エントリ(図6の下段)に対して構文解析処理(図8:ステップS3000)を適用した結果得られる情報を示す図である。ADD命令には5つのフィールドがあり、各々のサイズ、種別および値が取得済みである。   FIG. 12 is a diagram showing information obtained as a result of applying the syntax analysis process (FIG. 8: step S3000) to the instruction definition entry (lower part of FIG. 6) of the ADD instruction. The ADD instruction has five fields, and each size, type, and value have been acquired.

図13は、位置・サイズ計算処理(図8:ステップS5000)のより詳細を示すフロー図である。この処理では、構文解析処理(図8:ステップS3000)の結果を用いて、1つの命令を構成するすべての命令フィールドのLSB位置が計算によって求められる。LSB位置の値は、命令語のLSBを0ビット目として上位ビットに向かって数え上げた値とされる。LSB位置の計算では、命令中で最も下位に位置する命令フィールドのLSB位置が0であることと、すべての命令フィールドのサイズが既知であることとが利用される。フィールド位置・サイズ計算処理では、命令のLSB側から順に命令フィールドの位置が計算される。   FIG. 13 is a flowchart showing more details of the position / size calculation process (FIG. 8: step S5000). In this process, the LSB positions of all the instruction fields constituting one instruction are obtained by calculation using the result of the syntax analysis process (FIG. 8: step S3000). The value of the LSB position is a value obtained by counting up the LSB of the instruction word from the 0th bit toward the upper bit. In the calculation of the LSB position, the fact that the LSB position of the instruction field located at the lowest position in the instruction is 0 and the sizes of all the instruction fields are known are used. In the field position / size calculation process, the position of the instruction field is calculated in order from the LSB side of the instruction.

ステップS5100では、変数iが命令フィールドの個数で初期化される。変数iは、構文解析処理と同じ規則で命令フィールドに与えられた識別番号である。   In step S5100, variable i is initialized with the number of instruction fields. The variable i is an identification number given to the instruction field according to the same rule as the parsing process.

ステップS5300では、i番目の命令フィールドのLSB位置として0が記憶される。ここで0が用いられる理由は、ステップS5300の時点でiは命令中の最下位命令フィールドと対応しているためである。   In step S5300, 0 is stored as the LSB position of the i-th instruction field. Here, 0 is used because i corresponds to the lowest instruction field in the instruction at the time of step S5300.

ステップS5400〜S5800は、最下位命令フィールドより上位側の命令フィールドのLSB位置を順に求めるループである。本ループでは、サイズおよびLSB位置が既知となった命令フィールドと隣接する命令フィールドのLSB位置を順に求めることで、すべての命令フィールドのLSB位置が取得される。   Steps S5400 to S5800 are a loop for sequentially obtaining the LSB position of the instruction field higher than the lowest instruction field. In this loop, the LSB positions of all instruction fields are obtained by sequentially obtaining the LSB positions of the instruction field adjacent to the instruction field whose size and LSB position are known.

ステップS5400は、変数iの値が1より大きい場合S5700を行ない、それ以外の場合に処理を終了する条件分岐処理である。   Step S5400 is a conditional branch process that performs S5700 if the value of the variable i is greater than 1, and ends the process otherwise.

ステップS5700では、i−1番目フィールドのLSB位置が、以下の演算
i番目フィールドのLSB位置+i番目フィールドのサイズ
によって計算される。つまり、計算部112(図1)が、i番目(第1)の命令フィールドについてのLSB位置に関する値と、i番目の命令フィールドのサイズとから、i−1番目(第2)の命令フィールドについてのLSB位置の値を計算する。
In step S5700, the LSB position of the (i−1) -th field is calculated by the following calculation: LSB position of the i-th field + size of the i-th field. That is, the calculation unit 112 (FIG. 1) determines the i−1th (second) instruction field from the value regarding the LSB position for the ith (first) instruction field and the size of the ith instruction field. The value of the LSB position is calculated.

ステップS5800では、1つ減らされた値で変数iが更新され、そしてステップS5400に処理が戻される。   In step S5800, variable i is updated with the value reduced by one, and the process returns to step S5400.

図14は、構文解析結果(図12)に対してフィールド位置・サイズ計算処理(図13:ステップS5000)を適用した結果得られる情報を示す。フィールド位置・サイズ計算処理は、LSB位置の列を図中矢印の向きの順番で取得する。   FIG. 14 shows information obtained as a result of applying the field position / size calculation process (FIG. 13: step S5000) to the syntax analysis result (FIG. 12). In the field position / size calculation process, a sequence of LSB positions is acquired in the order of the arrows in the figure.

上記のステップS5700で示したように、i番目の命令フィールドのLSB位置と、i番目の命令フィールドのサイズとから、隣接するi−1番目の命令フィールドの値が計算される。これにより、命令定義体にフィールドの位置が含まれていなくても、命令フィールドのサイズから命令フィールドの位置を取得することができる。   As shown in step S5700 above, the value of the adjacent i-1th instruction field is calculated from the LSB position of the i-th instruction field and the size of the i-th instruction field. Thereby, even if the position of the field is not included in the instruction definition body, the position of the instruction field can be acquired from the size of the instruction field.

なおステップS5700(図13)ではLSB位置に関する計算が行なわれるが、これと類似して、MSB位置に関する計算も行なわれ得る。具体的には、計算部112(図1)は、i番目(第1)の命令フィールドについてのMSB位置に関する値と、i番目の命令フィールドのサイズとから、i+1番目(第2)の命令フィールドについてのMSB位置の値を計算し得る。この場合、全命令フィールドのサイズの総和から1を減じた値を1番目の命令フィールドのMSB位置とし、この位置を基点にしてMSB位置が順次(図14の矢印とは逆方向に)求められてもよい。このように定数命令フィールドのLSB(MSB)位置およびサイズの対を巡回し、命令フィールドのLSB位置のビットからMSB側(MSB位置のビットからLSB側)にサイズ分だけを定数ビットとして記憶する処理を繰り返すステップを設けることによって、命令中で定数となるビットの位置を取得することができる。   In step S5700 (FIG. 13), calculation related to the LSB position is performed, but similarly, calculation related to the MSB position can also be performed. Specifically, the calculation unit 112 (FIG. 1) calculates the i + 1th (second) instruction field from the value regarding the MSB position for the i-th (first) instruction field and the size of the i-th instruction field. The value of the MSB position for can be calculated. In this case, the value obtained by subtracting 1 from the sum of the sizes of all the instruction fields is set as the MSB position of the first instruction field, and the MSB position is sequentially obtained from this position as a base point (in the direction opposite to the arrow in FIG. 14). May be. In this way, the LSB (MSB) position and size pair of the constant instruction field is circulated, and only the size is stored as a constant bit from the LSB position bit of the instruction field to the MSB side (from the MSB position bit to the LSB side). By providing the step of repeating the above, it is possible to acquire the position of a bit that becomes a constant in the instruction.

より一般的に言えば、計算部112は、第1の命令フィールドについてのLSB位置およびMSB位置の一方の項目に関する値と、第1の命令フィールドのサイズとから、第2の命令フィールドについての一方の項目の値を計算することができる。   More generally speaking, the calculation unit 112 calculates a value for one of the second instruction fields from a value related to one item of the LSB position and the MSB position for the first instruction field and the size of the first instruction field. The value of the item can be calculated.

図15は、命令テーブル生成処理(図7:ステップS60T)のより詳細を示すフロー図である。命令テーブル生成処理への入力は、命令定義体の情報、および、命令フィールドのLSB位置の情報である。また、命令テーブル生成処理の出力は、命令テーブルである。   FIG. 15 is a flowchart showing more details of the instruction table generation process (FIG. 7: step S60T). The input to the instruction table generation process is information on the instruction definition body and information on the LSB position of the instruction field. The output of the instruction table generation process is an instruction table.

ステップS60Tは、命令定義体に含まれるすべての命令についてオペコードパターンとマスクパターンとを生成するループ処理であり、変数iはループの繰返しごとに、1から命令定義体のエントリ数分まで増加する。ループ処理では、1回の繰返しにつきi番目の命令についてオペコードパターンおよびマスクパターンが計算される。   Step S60T is a loop process for generating an opcode pattern and a mask pattern for all instructions included in the instruction definition body, and the variable i increases from 1 to the number of entries in the instruction definition body every time the loop is repeated. In the loop processing, an opcode pattern and a mask pattern are calculated for the i-th instruction per one iteration.

ステップS6000では、i番目の命令のオペコードパターンが生成される。この処理の詳細は後述する。   In step S6000, an opcode pattern of the i-th instruction is generated. Details of this processing will be described later.

ステップS63Tでは、ステップS6000で取得されたオペコードパターンが、命令テーブルのi番目エントリのオペコードパターンに設定される。   In step S63T, the opcode pattern acquired in step S6000 is set as the opcode pattern of the i-th entry in the instruction table.

ステップS8000では、i番目の命令のマスクパターンが生成される。この処理の詳細は後述する。   In step S8000, a mask pattern for the i-th instruction is generated. Details of this processing will be described later.

ステップSS64Tでは、ステップS8000で取得されたマスクパターンが命令テーブルのi番目エントリのマスクパターンに設定される。   In step SS64T, the mask pattern acquired in step S8000 is set as the mask pattern of the i-th entry in the instruction table.

ステップSS65Tでは、i番目の命令テーブルエントリの命令識別子にi番目命令定義体の命令識別子が設定される。   In step SS65T, the instruction identifier of the i-th instruction definition body is set as the instruction identifier of the i-th instruction table entry.

図16は、オペコードパターン生成処理(図15:ステップS6000)のより詳細を示すフロー図である。本処理は命令フィールドの情報を入力とし、命令のオペコードパターンを出力する。   FIG. 16 is a flowchart showing more details of the operation code pattern generation process (FIG. 15: step S6000). This process takes the instruction field information as input and outputs the instruction opcode pattern.

ステップS6100では、オペコードパターンが0で初期化される。初期化されたオペコードパターンは、ステップS6200〜S6800で最終的なオペコードパターンに更新される。   In step S6100, the opcode pattern is initialized with zero. The initialized opcode pattern is updated to the final opcode pattern in steps S6200 to S6800.

ステップS6200〜S6800は、1つの命令に含まれる命令フィールドの回数分の処理を繰り返すループである。ループの繰返しごとに変数iは、1から1つずつ大きくなる。   Steps S6200 to S6800 are a loop that repeats the process for the number of times of the instruction field included in one instruction. The variable i increases from 1 to 1 for each iteration of the loop.

ステップS6300は、i番目の命令フィールドが定数の場合ステップS6600に分岐し、それ以外の場合ステップS6800に分岐する条件分岐処理である。i番目の命令フィールドが定数か否かは、"CONTENT"部読出処理S3400(図9)の処理で取得された命令フィールドの種別が「定数」か否かを確認することで判定され得る。   Step S6300 is a conditional branch process that branches to step S6600 if the i-th instruction field is a constant, and branches to step S6800 otherwise. Whether or not the i-th instruction field is a constant can be determined by confirming whether or not the type of the instruction field acquired in the processing of the “CONTENT” part reading process S3400 (FIG. 9) is “constant”.

ステップS6600では、オペコードパターン中のi番目の命令フィールドのLSB位置にi番目の命令フィールドの定数が格納される。   In step S6600, the i-th instruction field constant is stored at the LSB position of the i-th instruction field in the opcode pattern.

このように命令フィールドのLSB(またはMSB)位置およびサイズを用いて命令フィールドのLSB位置のビットからMSB側に(または、MSB位置のビットからLSB側に)サイズ分だけ順に各ビットの値を記憶する処理を繰り返すステップを設けることによって、命令語中で固定の値を持つ、ビットごとの定数を、すべて得ることができる。   In this way, using the LSB (or MSB) position and size of the instruction field, the value of each bit is stored in order of the size from the LSB position bit of the instruction field to the MSB side (or from the MSB position bit to the LSB side). By providing the step of repeating the process, all constants for each bit having a fixed value in the instruction word can be obtained.

図17は、マスクパターン生成処理(図15:ステップS8000)のより詳細を示すフロー図である。本処理は命令フィールドの情報を入力とし、命令のマスクパターンを出力する。   FIG. 17 is a flowchart showing more details of the mask pattern generation process (FIG. 15: step S8000). This process takes the information in the instruction field as input and outputs a mask pattern of the instruction.

ステップS8100では、マスクパターンが0で初期化される。初期化されたオペコードパターンは、ステップS8200〜S8500で最終的なマスクパターンに更新される。   In step S8100, the mask pattern is initialized with zero. The initialized opcode pattern is updated to a final mask pattern in steps S8200 to S8500.

ステップS8200〜S8500は、1つの命令に含まれる命令フォールドの回数分の処理を繰り返すループである。ループの繰返しごとに変数iは、1から1つずつ大きくなる。   Steps S8200 to S8500 are a loop that repeats the process for the number of instruction folds included in one instruction. The variable i increases from 1 to 1 for each iteration of the loop.

ステップS8300は、i番目の命令フィールドが定数の場合ステップS8400に分岐し、それ以外の場合ステップS8500に分岐する条件分岐処理である。i番目の命令フィールドが定数か否かは、構文解析処理で取得された命令フィールドの種別が「定数」か否かを確認することで判定され得る。   Step S8300 is a conditional branch process that branches to step S8400 if the i-th instruction field is a constant, and branches to step S8500 otherwise. Whether or not the i-th instruction field is a constant can be determined by checking whether or not the type of the instruction field acquired in the parsing process is “constant”.

ステップS8400では、マスクパターン中のi番目フィールドのLSB位置から上位ビットに向かってi番目フィールドのサイズ数分のビットに1が格納される。   In step S8400, 1 is stored in bits corresponding to the number of sizes of the i-th field from the LSB position of the i-th field in the mask pattern toward the upper bits.

次に比較例の命令テーブル生成について説明する。本比較例においては、TriCoreのADD命令の命令テーブルエントリを作成するために、命令定義体のADD命令のエントリに
cccc0000000nnnnnnnnnaaaa10001011
と記述される。この記述のためには、図4のような命令エンコーディング図を参照しながら、"1"、"0"またはその他を表現する文字("c"、"n"または"a")が入力される。この際、16進数で記述されたオペコードを2進数に変換することや、ビット数を数えながら文字を入力することなど、誤りがちな作業を人手で行なう必要がある。また、命令定義体が正しく記述されているか否かを目視で確認するためにも、ビット数を数えることや、2進数から別の基数に変換することなどの誤りがちな作業を行なう必要がある。さらには、オペコードの名前が命令エンコーディング図では2文字以上で書かれた場合には、1文字に省略する必要がある。たとえば、図4のADD命令の場合、命令定義体作成者は、即値オペランドを表すオペランドフィールドの名前"const9"を1文字(上記命令定義体においては"n")に短縮しなければならない。
Next, instruction table generation of a comparative example will be described. In this comparative example, in order to create an instruction table entry for the TriCore ADD instruction,
cccc0000000nnnnnnnnnaaaa10001011
It is described. For this description, a character ("c", "n" or "a") representing "1", "0" or others is input with reference to the instruction encoding diagram as shown in FIG. . At this time, it is necessary to manually perform an error-prone operation such as converting an operation code described in hexadecimal to binary, or inputting characters while counting bits. In addition, it is necessary to perform error-prone operations such as counting the number of bits and converting from a binary number to another radix in order to visually check whether the instruction definition is correctly described. . Furthermore, when the name of the operation code is written in two or more characters in the instruction encoding diagram, it is necessary to omit it to one character. For example, in the case of the ADD instruction of FIG. 4, the creator of the instruction definition body must shorten the name “const9” of the operand field representing the immediate operand to one character (“n” in the above instruction definition body).

これに対して本実施の形態によれば、命令定義体の記述列が各命令フィールドについて、サイズを表す位置・サイズ関連文字列を記述している。よって、命令定義体中に命令フィールドのビット位置を含ませる必要なく、人手による命令定義体の記述を容易に行なうことができる。そしてこのサイズ情報に基づいてLSB位置(またはMSB位置)が計算される。これにより、記述性および可読性を優先した命令定義体から、命令テーブルまたは命令デコードプログラムの生成に必要な、命令フィールドの位置・サイズ関連の十分な情報が得られる。よって、命令テーブルまたは命令デコードプログラムを、記述性および可読性に優れた命令定義体から自動的に生成することができる。よってCPUごとの命令セットシミュレータの開発を効率化することができる。   On the other hand, according to the present embodiment, the description string of the instruction definition body describes the position / size related character string representing the size for each instruction field. Therefore, it is not necessary to include the bit position of the instruction field in the instruction definition body, and the instruction definition body can be easily described manually. Based on this size information, the LSB position (or MSB position) is calculated. Thereby, sufficient information related to the position / size of the instruction field necessary for generating the instruction table or the instruction decoding program can be obtained from the instruction definition body giving priority to descriptiveness and readability. Therefore, an instruction table or an instruction decoding program can be automatically generated from an instruction definition body excellent in descriptiveness and readability. Therefore, the development of an instruction set simulator for each CPU can be made efficient.

なお、1つの命令フィールドに関して、LSB位置、MSB位置およびサイズの間には、
LSB位置+サイズ−1 = MSB位置
の関係がある。このため、LSB位置、MSB位置およびサイズのうち2つの項目についての値が得られれば、上式により残り1項目の値は容易に得られる。よってLSB位置またはサイズの一方が計算済みであれば他方は容易に得られる。本実施の形態においては、サイズからLSB位置が計算されているので、MSB位置は必要に応じて上式により直ちに求め得る。
For one command field, between the LSB position, MSB position and size,
There is a relationship of LSB position + size-1 = MSB position. For this reason, if the values for two items of the LSB position, the MSB position, and the size are obtained, the value of the remaining one item can be easily obtained by the above formula. Thus, if one of the LSB position or size has been calculated, the other can be easily obtained. In the present embodiment, since the LSB position is calculated from the size, the MSB position can be obtained immediately by the above formula as necessary.

また本実施の形態においては命令テーブル生成装置101によって出力される命令テーブルが命令セットシミュレータ91(図1)に入力される場合について説明したが、命令テーブルが入力されるものはそのようなものに限定されるわけではなく、たとえば、ディスアセンブラ装置に入力されてもよい。   Further, in the present embodiment, the case where the instruction table output by the instruction table generation device 101 is input to the instruction set simulator 91 (FIG. 1) has been described. For example, it may be input to a disassembler device.

上記の説明では、命令フィールド位置・サイズ解決処理(図7:ステップS30)の後に命令テーブル生成処理(ステップS60T)が行なわれるが、両処理は命令定義体の1つのエントリごとに行なわれてもよい。つまり命令フィールド位置・サイズ解決処理の後に命令テーブル生成処理が行なわれる処理が繰り返されてもよい。これは、命令定義体の1つのエントリごとに命令フィールド位置・サイズの解決と命令テーブルエントリの作成とを行なうことができるためである。   In the above description, the instruction table generation process (step S60T) is performed after the instruction field position / size resolution process (FIG. 7: step S30), but both processes may be performed for each entry of the instruction definition body. Good. That is, the process in which the instruction table generation process is performed after the instruction field position / size resolution process may be repeated. This is because the instruction field position and size can be resolved and the instruction table entry can be created for each entry of the instruction definition body.

(実施の形態2)
命令定義体を入力として命令テーブル生成装置101(図1:実施の形態1)は、命令セットシミュレータ91に入力するための命令テーブルを出力する。これに対して本実施の形態においては、命令定義体を入力として命令デコードプログラム生成装置が、命令セットシミュレータ92の一部を構成する命令デコードプログラムを出力する。
(Embodiment 2)
The instruction table generation apparatus 101 (FIG. 1: Embodiment 1) receives an instruction definition body as an input and outputs an instruction table to be input to the instruction set simulator 91. On the other hand, in the present embodiment, the instruction decode program generation device outputs an instruction decode program constituting a part of the instruction set simulator 92 with the instruction definition body as an input.

図18は、本実施の形態における命令デコードプログラム生成装置102を含む命令セットシミュレーションシステム902の構成を概略的に示すブロック図である。命令セットシミュレーションシステム902は、命令定義体記憶部50と、実行対象プログラム記憶部60と、命令セットシミュレータ92と、命令デコードプログラム生成装置102とを有する。命令デコードプログラム生成装置102は命令デコードプログラム生成部122を有する。命令デコードプログラム生成部122は命令デコードプログラム52を生成するものである。命令セットシミュレータ92は、命令デコードプログラム52を含むプログラムによって実行させられるものである。   FIG. 18 is a block diagram schematically showing a configuration of an instruction set simulation system 902 including the instruction decode program generation apparatus 102 in the present embodiment. The instruction set simulation system 902 includes an instruction definition body storage unit 50, an execution target program storage unit 60, an instruction set simulator 92, and an instruction decode program generation device 102. The instruction decode program generation apparatus 102 has an instruction decode program generation unit 122. The instruction decode program generation unit 122 generates the instruction decode program 52. The instruction set simulator 92 is executed by a program including the instruction decoding program 52.

図19は、命令テーブル(図2)を入力とする命令デコード処理と等価な命令デコードプログラム52(図18)のC言語コードを示す。命令デコードプログラム52は関数"Decode"である。関数"Decode"は命令語を引数"word"として入力し、命令種類ごとに対応するサブ関数を呼び出す。各サブ関数は、命令の動作を模擬するコードである。   FIG. 19 shows the C language code of the instruction decode program 52 (FIG. 18) equivalent to the instruction decode process that receives the instruction table (FIG. 2). The instruction decode program 52 is a function “Decode”. The function “Decode” inputs an instruction word as an argument “word” and calls a subfunction corresponding to each instruction type. Each subfunction is a code that simulates the operation of an instruction.

図20は、本実施の形態における命令デコードプログラムの生成方法を概略的に示すフロー図である。図21は、命令デコードプログラム生成処理(図20:ステップS60P)のより詳細を示すフロー図である。ステップS61Pでは、プログラム開始部が生成される。プログラムの開始部は関数の前半部分である。たとえば、32ビットの命令語を引数とし、命令識別子を返す関数の場合のコード断片は、
void Decode(uint32_t word) {
である。
FIG. 20 is a flowchart schematically showing a method for generating an instruction decode program in the present embodiment. FIG. 21 is a flowchart showing more details of the instruction decode program generation process (FIG. 20: step S60P). In step S61P, a program start part is generated. The beginning of the program is the first half of the function. For example, the code fragment for a function that takes a 32-bit instruction word as an argument and returns an instruction identifier is:
void Decode (uint32_t word) {
It is.

ステップS62PおよびS68P間の処理は、構文解析済みの命令定義体を巡回するループであり、変数iはループの繰返しごとに、1から命令テーブルエントリ数まで1ずつ増加する。ステップS6000は、i番目の命令定義体エントリの解析済みフィールド情報を入力とし、オペコードパターンを生成する処理である。ステップS6000の詳細は実施の形態1と同様である。ステップS8000は、i番目の命令定義端エントリの解析済み命令フィールド情報を入力とし、マスクパターンを生成する処理である。ステップS66Pは、命令語が命令定義体エントリのパターンと一致するか否かの判定文を出力する処理である。これは、以下のようなテンプレート
if ((instruction & MASK_PATTERN) == OPCODE_PATTERN) {
ID(word);
}
を用いて生成することができる。
The processing between steps S62P and S68P is a loop that circulates the syntax analysis instruction that has been parsed, and the variable i increases by 1 from 1 to the number of instruction table entries each time the loop is repeated. Step S6000 is processing to generate an opcode pattern by using the analyzed field information of the i-th instruction definition entry as an input. Details of step S6000 are the same as those in the first embodiment. Step S8000 is a process of generating a mask pattern using the analyzed instruction field information of the i-th instruction definition end entry as an input. Step S66P is a process of outputting a determination statement as to whether or not the instruction word matches the pattern of the instruction definition entry. This is a template like
if ((instruction & MASK_PATTERN) == OPCODE_PATTERN) {
ID (word);
}
Can be generated.

ここで"MASK_PATTERN"と"OPCODE_PATTERN"と"ID"とはテンプレートのパラメータである。ステップS66Pは、ステップS8000で取得されたマスクパターンを"MASK_PATTERN"に代入し、ステップS6000で取得されたオペコードパターンを"OPCODE_PATTERN"に代入し、i番目命令定義体エントリの命令識別子を"ID"に代入する。最後にステップS69Pでは、関数末尾を表す"}"を生成する。   Here, "MASK_PATTERN", "OPCODE_PATTERN", and "ID" are template parameters. In step S66P, the mask pattern acquired in step S8000 is assigned to “MASK_PATTERN”, the opcode pattern acquired in step S6000 is assigned to “OPCODE_PATTERN”, and the instruction identifier of the i-th instruction definition entry is set to “ID”. substitute. Finally, in step S69P, “}” representing the end of the function is generated.

なお、上記以外の構成については、上述した実施の形態1の構成とほぼ同じであるため、同一または対応する要素について同一の符号を付し、その説明を繰り返さない。   Since the configuration other than the above is substantially the same as the configuration of the first embodiment described above, the same or corresponding elements are denoted by the same reference numerals, and description thereof is not repeated.

本実施の形態によれば、命令テーブルの生成に代わり命令デコードプログラムの生成において、実施の形態1と同様の効果が得られる。   According to the present embodiment, the same effect as in the first embodiment can be obtained in generating an instruction decoding program instead of generating an instruction table.

なお本実施の形態においては命令デコードプログラム生成装置102が、命令セットシミュレータ92の一部を構成する命令デコードプログラム52を出力する場合について説明したが、命令デコードプログラム生成装置が出力するプログラムはそのようなものに限定されるわけではなく、たとえば、ディスアセンブラの一部を構成する命令デコードプログラムを出力してもよい。この場合においては、C言語の命令デコードプログラム52(図19)は、命令のディスアセンブル結果を出力するコードである。   In the present embodiment, the case where the instruction decode program generating apparatus 102 outputs the instruction decode program 52 constituting a part of the instruction set simulator 92 has been described, but the program output by the instruction decode program generating apparatus is For example, an instruction decoding program that constitutes a part of the disassembler may be output. In this case, the C instruction decode program 52 (FIG. 19) is a code for outputting the instruction disassemble result.

また本実施の形態においては命令デコードプログラム52としてC言語のデコード処理関数が生成されるが(図19)、プログラミング言語およびデコード処理アルゴリズムがそのようなものに限定されるわけではない。   In the present embodiment, a C language decoding function is generated as the instruction decoding program 52 (FIG. 19), but the programming language and decoding algorithm are not limited to such.

(実施の形態3)
実施の形態1によれば、命令エンコーディング図に記載されている16進数のオペコードを16進数として用いることができる。しかしながら、命令エンコーディング図では、16進数以外に10進数または2進数が用いられていることもある。このため、命令定義体の文法が16進数以外に対応していない場合、仮に単一の命令セットアーキテクチャを記述するのには十分であっても、複数のCPUに対応させるためには人手で基数を変換する必要が生じる。これに対して本実施の形態における構文解析処理は、以下に詳述するように、命令フィールドの定数の記述の基数ごとに処理を切り替えるよう拡張されている。
(Embodiment 3)
According to the first embodiment, the hexadecimal opcode described in the instruction encoding diagram can be used as the hexadecimal number. However, in the instruction encoding diagram, decimal numbers or binary numbers may be used in addition to hexadecimal numbers. For this reason, if the grammar of the instruction definition body does not support anything other than hexadecimal numbers, even if it is sufficient to describe a single instruction set architecture, the radix is required manually to support multiple CPUs. Need to be converted. On the other hand, the parsing process in the present embodiment is extended to switch the process for each radix of the description of the constant in the instruction field, as will be described in detail below.

図22は、本実施の形態における命令定義体の文法を表したEBNFを示す。実施の形態1のEBNF(図5)との相違は、命令フィールドの定数を表す定数文字列の非終端記号"CONSTANT"の内容として2進数文字列"BIN_NUMBER"と10進数文字列"DECIMAL_NUMBER"とが追加されている点である。図中で示されている例においては、2進数文字列"BIN_NUMBER"は先頭部分に基数識別用に"0b"が付された数字文字列であり、"DECIMAL_NUMBER"は先頭部分から数字で始まる数字文字列である。   FIG. 22 shows EBNF representing the grammar of the instruction definition body in the present embodiment. The difference from the EBNF of the first embodiment (FIG. 5) is that a binary character string “BIN_NUMBER” and a decimal character string “DECIMAL_NUMBER” are included as the contents of a non-terminal symbol “CONSTANT” of a constant character string representing a constant of an instruction field. It is a point that has been added. In the example shown in the figure, the binary character string "BIN_NUMBER" is a numeric character string with "0b" appended to the beginning for identifying the radix, and "DECIMAL_NUMBER" is a number beginning with a number from the beginning. It is a string.

図23は、本実施の形態における"CONSTANT"部読出処理(ステップS3410C)の構成を概略的に示すフロー図である。このステップS3410Cによって実施の形態1のステップS3410(図10)が置き換えられることで、基数の切替えが実現されている。言い換えれば、構文解析部111(図1)は本実施の形態においては、定数文字列を数値へ基数を考慮して変換する。   FIG. 23 is a flowchart schematically showing a configuration of the “CONSTANT” part reading process (step S3410C) in the present embodiment. This step S3410C replaces step S3410 (FIG. 10) of the first embodiment, thereby realizing switching of the radix. In other words, in this embodiment, the syntax analysis unit 111 (FIG. 1) converts the constant character string into a numerical value in consideration of the radix.

具体的には、まずステップS3411cで、定数文字列が読出位置から読み出され、読出位置が進められる。ここでは、数字のみの文字列は10進数"DECIMAL_NUMBER"、"0x"で始まる数字文字列は16進数"HEX_NUMBER"、"0b"で始まる数字文字列は2進数"BIN_NUMBER"として扱われ、ステップS3411cでは、これらの文字列の読出が行なわれる。   Specifically, first, in step S3411c, the constant character string is read from the reading position, and the reading position is advanced. Here, a character string only of numbers is treated as a decimal number “DECIMAL_NUMBER”, a number character string beginning with “0x” is treated as a hexadecimal number “HEX_NUMBER”, and a number character string beginning with “0b” is treated as a binary number “BIN_NUMBER”, step S3411c. Then, these character strings are read out.

ステップS3413では、ステップS3411cで読み出された数値文字列の先頭部分に応じた分岐処理が行なわれる。具体的には、数値文字列の先頭が"0b"の場合に基数が2、"0x"の場合に基数が16、それ以外の場合に基数が10、と判定される。そして、基数が2の場合ステップS3414bに分岐され、基数が10の場合ステップS3414dに分岐され、基数が16の場合ステップS3414hに分岐される。このように、構文解析部111(図1)が、命令定義体の命令フィールドの定数文字列を解析することによって基数が判定される。   In step S3413, branch processing is performed according to the head portion of the numeric character string read in step S3411c. Specifically, it is determined that the radix is 2 when the beginning of the numeric character string is “0b”, the radix is 16 when it is “0x”, and the radix is 10 otherwise. If the radix is 2, the process branches to step S3414b. If the radix is 10, the process branches to step S3414d. If the radix is 16, the process branches to step S3414h. In this way, the radix is determined by the syntax analysis unit 111 (FIG. 1) analyzing the constant character string in the instruction field of the instruction definition body.

ステップS3414bでは、数値文字列が2進数として数値に変換される。また、ステップS3414dでは数値文字列が10進数として数値に変換される。また、S3414hでは、数値文字列が16進数として数値に変換される。"CONSTANT"部読出処理の出力は、ステップS3414b、S3414dおよびS3414hのいずれかで変換した結果の数値である。   In step S3414b, the numeric character string is converted to a numeric value as a binary number. In step S3414d, the numeric character string is converted to a numeric value as a decimal number. In S3414h, the numerical character string is converted into a numerical value as a hexadecimal number. The output of the “CONSTANT” part reading process is a numerical value obtained as a result of conversion in any of steps S3414b, S3414d, and S3414h.

なお、上記以外の構成については、上述した実施の形態1または2の構成とほぼ同じであるため、同一または対応する要素について同一の符号を付し、その説明を繰り返さない。   Since the configuration other than the above is substantially the same as the configuration of the first or second embodiment described above, the same or corresponding elements are denoted by the same reference numerals, and description thereof is not repeated.

本実施の形態によれば、命令定義体の命令フィールドの定数文字列を解析することで、定数文字列を数値に変換するときに用いる基数が切り替えられる。これにより命令定義体中で命令フィールドの定数を記述するときに複数の基数を用いることができる。よって命令定義体の記述性が向上する。よって複数のCPU向けの命令定義体を人手でより容易に記述することができる。   According to this embodiment, by analyzing the constant character string in the instruction field of the instruction definition body, the radix used when converting the constant character string into a numerical value can be switched. This allows multiple radixes to be used when describing instruction field constants in an instruction definition. Therefore, the descriptiveness of the instruction definition body is improved. Therefore, it is possible to more easily describe instruction definition bodies for a plurality of CPUs manually.

(実施の形態4)
実施の形態3では基数の判定が数値文字列の解析に基づいて行なわれるが、本実施の形態においては基数の判定が、処理実行時に外部から与えたコンフィギュレーションオプションによって行なわれる。
(Embodiment 4)
In the third embodiment, the radix is determined based on the analysis of the numeric character string. In the present embodiment, the radix is determined by a configuration option given from the outside during processing.

図24は、本実施の形態における構文解析部111Cおよびそれへの入力を概略的に示すブロック図である。構文解析部111Cは、命令定義体とは別に、コンフィギュレーションオプション59の入力を受け付けるように構成されている。コンフィギュレーションオプション59は、基数を指定する設定を含む。本実施の形態では、ステップS3413(図23)においてコンフィギュレーションオプション59を参照することで基数の判定が行なわれる。   FIG. 24 is a block diagram schematically showing the syntax analysis unit 111C and the input thereto in the present embodiment. The syntax analysis unit 111C is configured to receive an input of the configuration option 59 separately from the instruction definition body. Configuration option 59 includes a setting that specifies a radix. In the present embodiment, the radix is determined by referring to the configuration option 59 in step S3413 (FIG. 23).

本実施の形態によれば、命令定義体中の"CONSTANT"部の数値文字列において、実施の形態3で用いていたような基数識別用の先頭部分を省略することができながらも、命令定義体ごとに異なる基数で数値文字列を記述することができる。たとえば、ある命令定義体には"0xBEEF"と書く代わりに"BEEF"と記述することができ、別の命令定義体には"0b0101"と書く代わりに"0101"と書くことができる。つまり、用いられている基数が異なる複数の命令定義体からの命令テーブル(または命令デコードプログラム)の生成を、単一の生成装置で行なうことができる。   According to the present embodiment, in the numerical character string of the “CONSTANT” part in the instruction definition body, the head part for identifying the radix as used in the third embodiment can be omitted, but the instruction definition Numeric character strings can be written in different radix for each field. For example, instead of writing “0xBEEF” in one instruction definition, “BEEF” can be written, and in another instruction definition, “0101” can be written instead of “0b0101”. That is, it is possible to generate an instruction table (or an instruction decoding program) from a plurality of instruction definition bodies having different radixes used by a single generation device.

言い換えれば、実行時に外部からのコンフィギュレーションオプションで定数文字列を数値に変換するので、命令定義体ごとに命令フィールドの定数文字列を異なる基数で記述することができる。その上、定数文字列のフォーマット自体で基数を表す必要がないため、簡潔に命令定義体を作成することができる。   In other words, since the constant character string is converted into a numerical value by an external configuration option at the time of execution, the constant character string in the instruction field can be described in a different radix for each instruction definition body. In addition, since it is not necessary to represent the radix in the constant character string format itself, an instruction definition body can be created simply.

(実施の形態5)
実施の形態1においては、命令定義体と命令エンコーディング図とが共通して、"4"、"7"、"9"、"4"および"8"(図6)のように、命令フィールドのサイズ情報を保持している。これに対して本実施の形態では、命令定義体中にサイズの代わりに命令フィールドの位置が保持されている場合を扱う。
(Embodiment 5)
In the first embodiment, the instruction definition body and the instruction encoding diagram are common, and the instruction field of “4”, “7”, “9”, “4”, and “8” (FIG. 6) is used. Holds size information. On the other hand, in this embodiment, the case where the position of the instruction field is held instead of the size in the instruction definition body is handled.

図25は、本実施の形態における、ADD命令の命令フォーマット(図中、下段)と、対応する命令定義体エントリの記述(図中上段)との例を示す。命令定義体と命令エンコーディング図とが共通して、"31"、"27"、"20"、"11"および"7"という、命令フィールドのMSBのビット位置情報、すなわちMSB位置、を保持している。実施の形態1と比較すると、命令定義体中の命令フォーマットは、"DECIMAL_NUMBER[CONTENT]"の並びである点でEBNF(図5)としては同様であるが、構文解析において"DECIMAL_NUMBER"はサイズではなく位置を表すものとして扱われる。たとえば、ADD命令の命令定義体における命令フォーマット"FORMAT"の表現は、図25に示すように
31[c]27[0x00]20[const9]11[a]7[0x8B]
である。
FIG. 25 shows an example of the instruction format of the ADD instruction (lower part in the figure) and the description of the corresponding instruction definition entry (upper part in the figure) in the present embodiment. The instruction definition body and instruction encoding diagram share the bit position information of the MSB of the instruction field, that is, the MSB position of “31”, “27”, “20”, “11” and “7”. ing. Compared to Embodiment 1, the instruction format in the instruction definition body is the same as that of EBNF (FIG. 5) in that it is an array of “DECIMAL_NUMBER [CONTENT]”, but in the parsing, “DECIMAL_NUMBER” is not the size. It is treated as representing the position. For example, the expression of the instruction format “FORMAT” in the instruction definition body of the ADD instruction is as shown in FIG.
31 [c] 27 [0x00] 20 [const9] 11 [a] 7 [0x8B]
It is.

図26は、上記の命令定義体の表現を実施の形態1で説明した構文解析処理にかけた結果を示す。この結果には、フィールドごとのMSB位置が含まれているが、サイズに関する情報が含まれていない。   FIG. 26 shows a result of applying the expression of the above instruction definition body to the parsing process described in the first embodiment. This result includes the MSB position for each field, but does not include information about the size.

図27は、本実施の形態における位置・サイズ計算処理(ステップS5000D)の構成を概略的に示すフロー図である。本実施の形態においては、このステップS5000DがステップS5000(図13)に代わり命令フィールド位置・サイズ解決処理(ステップS30)において行なわれる。この場合、計算部112(図1)に入力される、構文解析部111(図1)の構文解析結果は、各命令フィールドのMSB位置(図26)である。ステップS5000Dにおいては、この入力に基づきLSB位置が計算される。   FIG. 27 is a flowchart schematically showing a configuration of position / size calculation processing (step S5000D) in the present embodiment. In the present embodiment, step S5000D is performed in an instruction field position / size resolution process (step S30) instead of step S5000 (FIG. 13). In this case, the syntax analysis result of the syntax analysis unit 111 (FIG. 1) input to the calculation unit 112 (FIG. 1) is the MSB position (FIG. 26) of each instruction field. In step S5000D, the LSB position is calculated based on this input.

ステップS5100は、変数iを命令フィールドの個数で初期化する処理である。ステップS5200は、i番目の命令フィールドのMSB位置に1を加算した結果によってi番目の命令フィールドのサイズを取得し記憶する処理である。ステップS5300は、i番目フィールドのLSB位置として0ビット目を記憶する処理である。   Step S5100 is processing for initializing the variable i with the number of instruction fields. Step S5200 is processing for acquiring and storing the size of the i-th instruction field based on the result of adding 1 to the MSB position of the i-th instruction field. Step S5300 is processing to store the 0th bit as the LSB position of the i-th field.

ステップS5400〜S5800は、i−1番目から1番目までの命令フィールドのサイズおよびLSB位置を計算する処理ループである。ステップS5400は、iが1より大きい場合ステップS5500に分岐し、それ以外の場合処理を終了する条件分岐処理である。ステップS5500では、i−1番目フィールドのMSB位置からi番目フィールドのMSB位置を減じることで、(i−1)番目フィールドのサイズが求められ、値が記憶される。次のステップS5700では、i番目フィールドのLSB位置とi番目フィールドのサイズとを加算することで、(i−1)番目フィールドのLSB位置が求められ、値が記憶される。   Steps S5400 to S5800 are a processing loop for calculating the size and LSB position of the i-1st to 1st instruction fields. Step S5400 is a conditional branch process that branches to step S5500 if i is greater than 1 and ends the process otherwise. In step S5500, the size of the (i−1) -th field is obtained by subtracting the MSB position of the i-th field from the MSB position of the i−1-th field, and the value is stored. In the next step S5700, the LSB position of the (i−1) -th field is obtained by adding the LSB position of the i-th field and the size of the i-th field, and the value is stored.

図28は、構文解析結果(図26)に対してフィールド位置・サイズ計算処理(図27:ステップS5000D)を適用した結果得られる情報を示す。フィールド位置・サイズ計算処理は、LSB位置およびサイズの各々の列を図中矢印の向きの順番で取得する。   FIG. 28 shows information obtained as a result of applying the field position / size calculation process (FIG. 27: step S5000D) to the syntax analysis result (FIG. 26). In the field position / size calculation processing, each column of the LSB position and size is acquired in the order of the arrows in the figure.

この構文解析において行なわれる、上述した処理ループ(ステップS5400〜S5800)の詳細について、ADD命令のように命令フィールドの個数が3つ以上の場合を例に、以下に詳述する。   Details of the above-described processing loop (steps S5400 to S5800) performed in this syntax analysis will be described in detail below, taking an example in which the number of instruction fields is three or more as in the case of an ADD instruction.

ステップS5000D(図27)を含むループにおいて、i=k+2(kは自然数)のときには、ステップS5500では、
(k+1)番目フィールドのサイズ
← (k+1)番目フィールドのMSB位置−(k+2)番目フィールドのMSB位置
が計算される。
In the loop including step S5000D (FIG. 27), when i = k + 2 (k is a natural number), in step S5500,
The size of the (k + 1) th field ← The MSB position of the (k + 1) th field−the MSB position of the (k + 2) th field is calculated.

そして次のループ、すなわちi=k+1のときには、ステップS5700では、
k番目フィールドLSB位置
← (k+1)番目フィールドのLSB位置+(k+1)番目フィールドのサイズ
が計算される。
In the next loop, i = k + 1, in step S5700,
kth field LSB position ← (k + 1) th field LSB position + (k + 1) th field size is calculated.

上記2つの計算をまとめると、連続して配置された命令フィールドである、k番目、(k+1)番目および(k+2)番目の命令フィールドの間で、以下の計算
k番目フィールドLSB位置
← (k+1)番目フィールドのLSB位置
+{(k+1)番目フィールドのMSB位置
−(k+2)番目フィールドのMSB位置}
が行なわれることになる。すなわち、(k+1)番目の命令フィールドのLSB位置と、(k+1)番目および(k+2)番目の命令フィールドの各々のMSB位置とを用いて、k番目の命令フィールドのLSB位置が、計算部112(図1)によって計算される。
Summarizing the above two calculations, the following calculation is performed between the k-th, (k + 1) -th and (k + 2) -th instruction fields which are consecutively arranged instruction fields: k-th field LSB position ← (k + 1) LSB position of the second field
+ {(K + 1) th field MSB position
-MSB position of (k + 2) -th field}
Will be performed. That is, using the LSB position of the (k + 1) th instruction field and the MSB position of each of the (k + 1) th and (k + 2) th instruction fields, the LSB position of the kth instruction field is calculated by the calculation unit 112 ( Fig. 1).

たとえば、k=1の場合、
1番目フィールドLSB位置
← 2番目フィールドのLSB位置
+{2番目フィールドのMSB位置−3番目フィールドのMSB位置}
である。この計算は、図28を参照して具体的な数値を代入することにより、
1番目フィールドLSB位置
← 21+{27−20} = 28
の結果となる。
For example, if k = 1,
First field LSB position ← Second field LSB position + {MSB position of second field-3 MSB position of third field}
It is. This calculation is performed by substituting specific numerical values with reference to FIG.
First field LSB position ← 21+ {27-20} = 28
Result.

またi=k+1のときに、ステップS5500では、
k番目フィールドのサイズ
← k番目フィールドのMSB位置 − (k+1)番目フィールドのMSB位置
が計算される。すなわち互いに隣り合うk番目および(k+1)番目の命令フィールドのMSB位置の差分からk番目の命令フィールドのサイズが、計算部112(図1)によって計算される。
When i = k + 1, in step S5500,
the size of the kth field
← MSB position of kth field − The MSB position of the (k + 1) th field is calculated. That is, the calculation unit 112 (FIG. 1) calculates the size of the kth instruction field from the difference between the MSB positions of the kth and (k + 1) th instruction fields adjacent to each other.

なお、上記以外の構成については、上述した実施の形態1〜4のいずれかの構成とほぼ同じであるため、同一または対応する要素について同一の符号を付し、その説明を繰り返さない。   Since the configuration other than the above is substantially the same as the configuration of any of Embodiments 1 to 4 described above, the same or corresponding elements are denoted by the same reference numerals, and description thereof will not be repeated.

実施の形態1で参照された命令エンコーディング図(図4)には各命令フィールドのサイズが記載されている。しかしながら、サイズの記載がない命令エンコーディング図を参照して命令定義体が作成される場合もある。この場合、命令定義体の作成者は命令フィールドのサイズを計算する必要があり、このときに誤りが混入する可能性がある。   The instruction encoding diagram (FIG. 4) referred to in the first embodiment describes the size of each instruction field. However, an instruction definition body may be created with reference to an instruction encoding diagram without size description. In this case, the creator of the instruction definition body needs to calculate the size of the instruction field, and an error may be mixed at this time.

これに対して本実施の形態によれば、命令定義体中に記述された各命令フィールドのMSB位置からLSB位置およびサイズが取得される。これにより命令定義体を、命令フィールドのサイズを含めずに記述することができる。よって上記のような誤りが混入することが防止される。   On the other hand, according to the present embodiment, the LSB position and size are acquired from the MSB position of each instruction field described in the instruction definition body. Thus, the instruction definition body can be described without including the size of the instruction field. Therefore, it is possible to prevent the above errors from being mixed.

(実施の形態6)
図29は、本実施の形態の命令テーブル生成部121の構成を概略的に示すブロック図である。本実施の形態においては命令テーブル生成部121は検出部121Dを有する。検出部121Dは、命令フィールドのうち定数文字列と対をなすものが、数値を表現することができるサイズを有するか否かを検出する。
(Embodiment 6)
FIG. 29 is a block diagram schematically showing the configuration of the instruction table generation unit 121 of the present embodiment. In the present embodiment, the instruction table generation unit 121 includes a detection unit 121D. The detection unit 121D detects whether or not the instruction field that is paired with the constant character string has a size that can represent a numerical value.

図30は、本実施の形態におけるオペコードパターン生成処理S6000Dの構成を概略的に示すフロー図である。実施の形態1のステップS6000(図16)との相違は、命令定義体の誤り検出(ステップS6400)が追加されていることである。ステップS6400は、i番目の命令フィールドの値がi番目の命令フィールドのサイズのビット数で表現できる場合には、ステップS6600を行なうが、そうでない場合はエラーを報告して終了する。   FIG. 30 is a flowchart schematically showing a configuration of the operation code pattern generation processing S6000D in the present embodiment. The difference from the step S6000 (FIG. 16) of the first embodiment is that an error detection of the instruction definition body (step S6400) is added. Step S6400 performs step S6600 if the value of the i-th instruction field can be expressed by the number of bits of the size of the i-th instruction field, but if not, reports an error and ends.

なお、上記以外の構成については、上述した実施の形態1〜5のいずれかの構成とほぼ同じであるため、同一または対応する要素について同一の符号を付し、その説明を繰り返さない。   Since the configuration other than the above is substantially the same as the configuration of any of Embodiments 1 to 5 described above, the same or corresponding elements are denoted by the same reference numerals, and description thereof will not be repeated.

本実施の形態によれば、たとえば、命令定義体中の命令フォーマットとして
4[c]7[0x00]9[const9]4[a]8[0x8B]
と記載されるべきところ、
4[c]7[0x00]9[const9]4[a]8[0x18B]
と記載されているような誤りを発見することができる。この例では、5番目の命令フィールドに対応する"8[0x18B]"で8ビットの命令フィールドが定数"0x18B"を持つことが指定されている。しかし"0x18B"は2進数表記で9ビットの"110001011"であり、8ビット命令フィールドでは表現することができないため、記述に誤りがあると判定される。
According to the present embodiment, for example, as an instruction format in an instruction definition body
4 [c] 7 [0x00] 9 [const9] 4 [a] 8 [0x8B]
Should be stated,
4 [c] 7 [0x00] 9 [const9] 4 [a] 8 [0x18B]
Can be found. In this example, “8 [0x18B]” corresponding to the fifth instruction field specifies that the 8-bit instruction field has a constant “0x18B”. However, “0x18B” is 9-bit “110001011” in binary notation and cannot be expressed in the 8-bit instruction field, so it is determined that there is an error in the description.

上記のように、命令フィールドの定数が命令フィールドのサイズ、すなわちビット幅、で表現できないことを検出するステップを用いることで、命令定義体に誤りが含まれていることをユーザが知ることができる。また、誤った命令テーブルの生成を防止することもできる。   As described above, by using the step of detecting that the constant of the instruction field cannot be expressed by the size of the instruction field, that is, the bit width, the user can know that the instruction definition includes an error. . It is also possible to prevent generation of an erroneous instruction table.

なお命令テーブルでなく命令デコードプログラムが生成される場合は、検出部121Dが、命令デコードプログラム生成部122(図18)に設けられればよい。   When the instruction decode program is generated instead of the instruction table, the detection unit 121D may be provided in the instruction decode program generation unit 122 (FIG. 18).

(実施の形態7)
図31は、本実施の形態において命令テーブルまたは命令デコードプログラムの生成を実行するコンピュータを含むシステムを概略的に示すブロック図である。上記各実施の形態で説明した、命令テーブルまたは命令デコードプログラムの生成は、専用の生成装置、または汎用のコンピュータ6000によって実行され得る。コンピュータ6000はCPU6100(プロセッサ)とRAM(Random Access Memory)6200とROM(Read Only Memory)6300とディスプレイ6400と記憶部6500と入力部6600とネットワークI/F(Interface)6700と記録媒体読取部6800とを有する。
(Embodiment 7)
FIG. 31 is a block diagram schematically showing a system including a computer that executes generation of an instruction table or an instruction decoding program in the present embodiment. The generation of the instruction table or instruction decoding program described in each of the above embodiments can be executed by a dedicated generation apparatus or a general-purpose computer 6000. The computer 6000 includes a CPU 6100 (processor), a RAM (Random Access Memory) 6200, a ROM (Read Only Memory) 6300, a display 6400, a storage unit 6500, an input unit 6600, a network I / F (Interface) 6700, and a recording medium reading unit 6800. Have

記憶部6500は、内部記録媒体6510を有する補助記憶装置である。たとえば、記憶部6500は、内部記録媒体6510として記録ディスクを有するディスクドライブ、または内部記録媒体6510として固体メモリを有するソリッドステートドライブ(SSD)である。上記ディスドライブは典型的には、磁気ディスクを有するハードディスクドライブである。SSDは典型的には、RAMまたはEEPROM(Electrically Erasable Programmable Read-Only Memory)などの半導体素子メモリを有する。   The storage unit 6500 is an auxiliary storage device having an internal recording medium 6510. For example, the storage unit 6500 is a disk drive having a recording disk as the internal recording medium 6510 or a solid state drive (SSD) having a solid memory as the internal recording medium 6510. The disk drive is typically a hard disk drive having a magnetic disk. The SSD typically includes a semiconductor element memory such as a RAM or an EEPROM (Electrically Erasable Programmable Read-Only Memory).

ネットワークI/F6700はネットワーク7700を介してサーバ8000に接続され得る。これによりコンピュータ6000はサーバ8000から情報を取得し得る。サーバ8000は、上述した内部記憶媒体6510と同様の記録媒体8010を有する。   The network I / F 6700 can be connected to the server 8000 via the network 7700. As a result, the computer 6000 can acquire information from the server 8000. The server 8000 includes a recording medium 8010 similar to the internal storage medium 6510 described above.

記録媒体読取部6800は外部記録媒体9010を読み取るものである。外部記録媒体9010は、持ち運び可能な記録媒体であり、たとえば、記録ディスク、固体メモリまたは記録テープである。外部記録媒体9010としての記録ディスクは、具体的には、光ディスク、光磁気ディスクまたは磁気ディスクなどであり、たとえば、CD−ROM(Compact Disk-Read Only Memory)、DVD−ROM(Digital Versatile Disc-Read Only Memory)またはブルーレイディスクなどである。外部記録媒体9010としての固体メモリは、たとえば、SSDが有する固体メモリと同様のもの、またはROMである。   A recording medium reading unit 6800 reads an external recording medium 9010. The external recording medium 9010 is a portable recording medium, for example, a recording disk, a solid-state memory, or a recording tape. The recording disk as the external recording medium 9010 is specifically an optical disk, a magneto-optical disk, a magnetic disk, or the like. For example, a CD-ROM (Compact Disk-Read Only Memory), a DVD-ROM (Digital Versatile Disc-Read). Only Memory) or Blu-ray Disc. The solid-state memory as the external recording medium 9010 is, for example, the same as the solid-state memory included in the SSD or a ROM.

前述した各実施の形態は、命令テーブルまたは命令デコードプログラムの生成のための処理をプログラムがコンピュータ6000のCPU6100に実行させることによって行なわれ得る。コンピュータ6000およびサーバ8000がシステムを構成する場合、プログラムは上記処理を、システムに含まれるプロセッサに実行させてもよい。   Each of the embodiments described above can be performed by causing the CPU 6100 of the computer 6000 to execute processing for generating an instruction table or an instruction decoding program. When the computer 6000 and the server 8000 constitute a system, the program may cause the processor included in the system to execute the above processing.

プログラムは典型的には、上述した記録媒体の少なくともいずれかに記録される。記録されるプログラムは、記録媒体により、またはネットワーク7700を介したダウンロードにより、プログラム製品として提供され得る。すなわちプログラム製品は、プログラムが記録された記録媒体と、プログラム自体とを含む。   The program is typically recorded on at least one of the recording media described above. The recorded program can be provided as a program product by a recording medium or by download via the network 7700. That is, the program product includes a recording medium on which the program is recorded and the program itself.

なお、本発明は、その発明の範囲内において、各実施の形態を自由に組み合わせたり、各実施の形態を適宜、変形、省略することが可能である。   It should be noted that the present invention can be freely combined with each other within the scope of the invention, and each embodiment can be appropriately modified or omitted.

50 命令定義体記憶部、51 命令テーブル記憶部、52 命令デコードプログラム、59 コンフィギュレーションオプション、60 実行対象プログラム記憶部、91,92 命令セットシミュレータ、101 命令テーブル生成装置(生成装置)、102 命令デコードプログラム生成装置(生成装置)、110 命令フィールド位置・サイズ解決部、111,111C 構文解析部、112 計算部、121 命令テーブル生成部、121D 検出部、122 命令デコードプログラム生成部、901,902 命令セットシミュレーションシステム、6000 コンピュータ、6100 CPU、6500 記憶部、6510 内部記録媒体、6800 記録媒体読取部、7700 ネットワーク、8000 サーバ、8010 記録媒体、9010 外部記録媒体。   50 instruction definition storage unit, 51 instruction table storage unit, 52 instruction decode program, 59 configuration option, 60 execution target program storage unit, 91, 92 instruction set simulator, 101 instruction table generation device (generation device), 102 instruction decode Program generation device (generation device), 110 instruction field position / size resolution unit, 111, 111C syntax analysis unit, 112 calculation unit, 121 instruction table generation unit, 121D detection unit, 122 instruction decode program generation unit, 901, 902 instruction set Simulation system, 6000 computer, 6100 CPU, 6500 storage unit, 6510 internal recording medium, 6800 recording medium reading unit, 7700 network, 8000 server, 8010 recording medium, 90 10 External recording medium.

Claims (20)

命令セットを定義する命令定義体に対して構文解析を行なう構文解析部を備え、前記命令セットは、複数の命令フィールドを有する命令フォーマットで定義される命令を含み、前記命令定義体は、前記命令フォーマットを表現する記述列を含み、前記記述列は前記命令フィールドの各々について、LSB位置、MSB位置およびサイズのいずれか1つの項目を表す位置・サイズ関連文字列と、前記命令フィールドの各々において指定される内容を表す内容文字列との対を前記命令フィールドの並び順で記述しており、前記構文解析部は前記記述列に基づいて、前記命令フィールドの各々についての前記1つの項目に関する値を取得し、
前記構文解析部が取得する前記1つの項目に関する値を用いて前記命令フィールドの各々について、LSB位置、MSB位置およびサイズのうち前記1つの項目と異なる他の項目に関する値を計算する計算部をさらに備える、
命令テーブル生成装置。
A syntax analysis unit configured to perform syntax analysis on an instruction definition body defining an instruction set, the instruction set including an instruction defined in an instruction format having a plurality of instruction fields, wherein the instruction definition body includes the instruction A description string representing a format, wherein the description string is a position / size related character string representing any one of an LSB position, an MSB position, and a size for each of the instruction fields, and is specified in each of the instruction fields A pair with a content character string representing the content to be processed is described in the order of the instruction field, and the syntax analysis unit calculates a value related to the one item for each of the instruction fields based on the description string. Acquired,
A calculation unit that calculates a value related to another item different from the one item among the LSB position, the MSB position, and the size for each of the instruction fields by using the value related to the one item acquired by the parsing unit; Prepare
Instruction table generator.
前記命令定義体の前記命令フィールドの前記内容文字列は定数文字列を含み、
前記構文解析部は、前記定数文字列を数値へ、基数を考慮して変換する、請求項1に記載の命令テーブル生成装置。
The content string of the instruction field of the instruction definition includes a constant string;
The instruction table generation device according to claim 1, wherein the syntax analysis unit converts the constant character string into a numerical value in consideration of a radix.
前記構文解析部は、前記命令定義体の命令フィールドの定数文字列を解析することによって前記基数を判定する、請求項2に記載の命令テーブル生成装置。   The instruction table generation device according to claim 2, wherein the syntax analysis unit determines the radix by analyzing a constant character string in an instruction field of the instruction definition body. 前記構文解析部は、前記基数を指定する入力を前記命令定義体とは別に受け付ける、請求項2に記載の命令テーブル生成装置。   The instruction table generation device according to claim 2, wherein the syntax analysis unit receives an input specifying the radix separately from the instruction definition body. 前記命令フィールドは、互いに隣接する第1および第2の命令フィールドを含み、
前記計算部は、前記第1の命令フィールドについてのLSB位置およびMSB位置の一方の項目に関する値と前記第1の命令フィールドのサイズとから、前記第2の命令フィールドについての前記一方の項目の値を計算する、請求項1に記載の命令テーブル生成装置。
The instruction field includes first and second instruction fields adjacent to each other;
The calculation unit calculates the value of the one item for the second instruction field from the value for one item of the LSB position and the MSB position for the first instruction field and the size of the first instruction field. The instruction table generation device according to claim 1, wherein
前記命令フィールドは、kを自然数としてk番目および(k+1)番目の命令フィールドを含み、
前記計算部は、k番目および(k+1)番目の命令フィールドのMSB位置の差分からk番目の命令フィールドのサイズを計算する、請求項1に記載の命令テーブル生成装置。
The instruction field includes kth and (k + 1) th instruction fields, where k is a natural number,
2. The instruction table generation device according to claim 1, wherein the calculation unit calculates a size of a k-th instruction field from a difference between MSB positions of the k-th and (k + 1) -th instruction fields.
前記命令フィールドは、kを自然数として、k番目、(k+1)番目および(k+2)番目の命令フィールドを含み、
前記計算部は、(k+1)番目の命令フィールドのLSB位置と(k+1)番目および(k+2)番目の命令フィールドの各々のMSB位置とを用いて、k番目の命令フィールドのLSB位置を計算する、請求項1に記載の命令テーブル生成装置。
The instruction field includes kth, (k + 1) th and (k + 2) th instruction fields, where k is a natural number,
The calculation unit calculates the LSB position of the k-th instruction field using the LSB position of the (k + 1) -th instruction field and the MSB position of each of the (k + 1) -th and (k + 2) -th instruction fields. The instruction table generation device according to claim 1.
前記命令定義体の前記命令フィールドの前記内容文字列は定数文字列を含み、
前記構文解析部は、前記定数文字列を数値に変換し、
前記命令フィールドのうち前記定数文字列と対をなすものが、前記数値を表現することができるサイズを有するか否かを検出する検出部をさらに備える、請求項1に記載の命令テーブル生成装置。
The content string of the instruction field of the instruction definition includes a constant string;
The parsing unit converts the constant character string into a numerical value,
The instruction table generation device according to claim 1, further comprising: a detection unit configured to detect whether a pair of the instruction field that is paired with the constant character string has a size capable of expressing the numerical value.
命令セットを定義する命令定義体に対して構文解析を行なう構文解析部を備え、前記命令セットは、複数の命令フィールドを有する命令フォーマットで定義される命令を含み、前記命令定義体は、前記命令フォーマットを表現する記述列を含み、前記記述列は前記命令フィールドの各々について、LSB位置、MSB位置およびサイズのいずれか1つの項目を表す位置・サイズ関連文字列と、前記命令フィールドの各々において指定される内容を表す内容文字列との対を前記命令フィールドの並び順で記述しており、前記構文解析部は前記記述列に基づいて、前記命令フィールドの各々についての前記1つの項目に関する値を取得し、
前記構文解析部が取得する前記1つの項目に関する値を用いて前記命令フィールドの各々について、LSB位置、MSB位置およびサイズのうち前記1つの項目と異なる他の項目に関する値を計算する計算部をさらに備える、
命令デコードプログラム生成装置。
A syntax analysis unit configured to perform syntax analysis on an instruction definition body defining an instruction set, the instruction set including an instruction defined in an instruction format having a plurality of instruction fields, wherein the instruction definition body includes the instruction A description string representing a format, wherein the description string is a position / size related character string representing any one of an LSB position, an MSB position, and a size for each of the instruction fields, and is specified in each of the instruction fields A pair with a content character string representing the content to be processed is described in the order of the instruction field, and the syntax analysis unit calculates a value related to the one item for each of the instruction fields based on the description string. Acquired,
A calculation unit that calculates a value related to another item different from the one item among the LSB position, the MSB position, and the size for each of the instruction fields by using the value related to the one item acquired by the parsing unit; Prepare
Instruction decode program generator.
前記命令定義体の前記命令フィールドの前記内容文字列は定数文字列を含み、
前記構文解析部は、前記定数文字列を数値へ、基数を考慮して変換する、請求項9に記載の命令デコードプログラム生成装置。
The content string of the instruction field of the instruction definition includes a constant string;
The instruction decoding program generation device according to claim 9, wherein the syntax analysis unit converts the constant character string into a numerical value in consideration of a radix.
前記構文解析部は、前記命令定義体の命令フィールドの定数文字列を解析することによって前記基数を判定する、請求項10に記載の命令デコードプログラム生成装置。   The instruction decoding program generation apparatus according to claim 10, wherein the syntax analysis unit determines the radix by analyzing a constant character string in an instruction field of the instruction definition body. 前記構文解析部は、前記基数を指定する入力を前記命令定義体とは別に受け付ける、請求項10に記載の命令デコードプログラム生成装置。   The instruction decoding program generation apparatus according to claim 10, wherein the syntax analysis unit receives an input specifying the radix separately from the instruction definition body. 前記命令フィールドは、互いに隣接する第1および第2の命令フィールドを含み、
前記計算部は、前記第1の命令フィールドについてのLSB位置およびMSB位置の一方の項目に関する値と前記第1の命令フィールドのサイズとから、前記第2の命令フィールドについての前記一方の項目の値を計算する、請求項9に記載の命令デコードプログラム生成装置。
The instruction field includes first and second instruction fields adjacent to each other;
The calculation unit calculates the value of the one item for the second instruction field from the value for one item of the LSB position and the MSB position for the first instruction field and the size of the first instruction field. 10. The instruction decode program generation device according to claim 9, wherein
前記命令フィールドは、kを自然数としてk番目および(k+1)番目の命令フィールドを含み、
前記計算部は、k番目および(k+1)番目の命令フィールドのMSB位置の差分からk番目の命令フィールドのサイズを計算する、請求項9に記載の命令デコードプログラム生成装置。
The instruction field includes kth and (k + 1) th instruction fields, where k is a natural number,
The instruction decoding program generation device according to claim 9, wherein the calculation unit calculates the size of the k-th instruction field from a difference between MSB positions of the k-th and (k + 1) -th instruction fields.
前記命令フィールドは、kを自然数として、k番目、(k+1)番目および(k+2)番目の命令フィールドを含み、
前記計算部は、(k+1)番目の命令フィールドのLSB位置と(k+1)番目および(k+2)番目の命令フィールドの各々のMSB位置とを用いて、k番目の命令フィールドのLSB位置を計算する、請求項9に記載の命令デコードプログラム生成装置。
The instruction field includes kth, (k + 1) th and (k + 2) th instruction fields, where k is a natural number,
The calculation unit calculates the LSB position of the k-th instruction field using the LSB position of the (k + 1) -th instruction field and the MSB position of each of the (k + 1) -th and (k + 2) -th instruction fields. The instruction decoding program generation device according to claim 9.
前記命令定義体の前記命令フィールドの前記内容文字列は定数文字列を含み、
前記構文解析部は、前記定数文字列を数値に変換し、
前記命令フィールドのうち前記定数文字列と対をなすものが、前記数値を表現することができるサイズを有するか否かを検出する検出部をさらに備える、請求項9に記載の命令デコードプログラム生成装置。
The content string of the instruction field of the instruction definition includes a constant string;
The parsing unit converts the constant character string into a numerical value,
The instruction decoding program generation device according to claim 9, further comprising a detection unit configured to detect whether or not a pair of the instruction field and the constant character string has a size capable of expressing the numerical value. .
命令セットを定義する命令定義体に対して構文解析部が構文解析を行なうステップを備え、前記命令セットは、複数の命令フィールドを有する命令フォーマットで定義される命令を含み、前記命令定義体は、前記命令フォーマットを表現する記述列を含み、前記記述列は前記命令フィールドの各々について、LSB位置、MSB位置およびサイズのいずれか1つの項目を表す位置・サイズ関連文字列と、前記命令フィールドの各々において指定される内容を表す内容文字列との対を前記命令フィールドの並び順で記述しており、前記構文解析を行なうステップは、前記構文解析部が前記記述列に基づいて、前記命令フィールドの各々についての前記1つの項目に関する値を取得するステップを含み、
前記構文解析部が取得した前記1つの項目に関する値を用いて前記命令フィールドの各々について、LSB位置、MSB位置およびサイズのうち前記1つの項目と異なる他の項目に関する値を計算部が計算するステップをさらに備える、
命令テーブル生成方法。
The instruction analysis unit includes a step of performing parsing with respect to an instruction definition body defining an instruction set, the instruction set including an instruction defined in an instruction format having a plurality of instruction fields, and the instruction definition body includes: A description string representing the instruction format, wherein the description string includes a position / size related character string representing any one of an LSB position, an MSB position, and a size for each of the instruction fields; and each of the instruction fields A description is given of a pair with a content character string representing the content specified in the order of the instruction fields, and the step of performing the syntax analysis is performed by the syntax analysis unit based on the description sequence. Obtaining a value for said one item for each;
The calculation unit calculates a value related to another item different from the one item among the LSB position, the MSB position, and the size for each of the instruction fields using the value related to the one item acquired by the parsing unit. Further comprising
Instruction table generation method.
命令セットを定義する命令定義体に対して構文解析部が構文解析を行なうステップを備え、前記命令セットは、複数の命令フィールドを有する命令フォーマットで定義される命令を含み、前記命令定義体は、前記命令フォーマットを表現する記述列を含み、前記記述列は前記命令フィールドの各々について、LSB位置、MSB位置およびサイズのいずれか1つの項目を表す位置・サイズ関連文字列と、前記命令フィールドの各々において指定される内容を表す内容文字列との対を前記命令フィールドの並び順で記述しており、前記構文解析を行なうステップは、前記構文解析部が前記記述列に基づいて、前記命令フィールドの各々についての前記1つの項目に関する値を取得するステップを含み、
前記構文解析部が取得した前記1つの項目に関する値を用いて前記命令フィールドの各々について、LSB位置、MSB位置およびサイズのうち前記1つの項目と異なる他の項目に関する値を計算部が計算するステップをさらに備える、
命令デコードプログラム生成方法。
The instruction analysis unit includes a step of performing parsing with respect to an instruction definition body defining an instruction set, the instruction set including an instruction defined in an instruction format having a plurality of instruction fields, and the instruction definition body includes: A description string representing the instruction format, wherein the description string includes a position / size related character string representing any one of an LSB position, an MSB position, and a size for each of the instruction fields; and each of the instruction fields A description is given of a pair with a content character string representing the content specified in the order of the instruction fields, and the step of performing the syntax analysis is performed by the syntax analysis unit based on the description sequence. Obtaining a value for said one item for each;
The calculation unit calculates a value related to another item different from the one item among the LSB position, the MSB position, and the size for each of the instruction fields using the value related to the one item acquired by the parsing unit. Further comprising
Instruction decoding program generation method.
命令テーブルの生成をコンピュータに実行させるためのプログラムであって、前記プログラムは前記コンピュータに、
命令セットを定義する命令定義体に対して構文解析部が構文解析を行なうステップを実行させ、前記命令セットは、複数の命令フィールドを有する命令フォーマットで定義される命令を含み、前記命令定義体は、前記命令フォーマットを表現する記述列を含み、前記記述列は前記命令フィールドの各々について、LSB位置、MSB位置およびサイズのいずれか1つの項目を表す位置・サイズ関連文字列と、前記命令フィールドの各々において指定される内容を表す内容文字列との対を前記命令フィールドの並び順で記述しており、前記構文解析を行なうステップは、前記構文解析部が前記記述列に基づいて、前記命令フィールドの各々についての前記1つの項目に関する値を取得するステップを含み、
前記構文解析部が取得した前記1つの項目に関する値を用いて前記命令フィールドの各々について、LSB位置、MSB位置およびサイズのうち前記1つの項目と異なる他の項目に関する値を計算部が計算するステップをさら実行させる、
プログラム。
A program for causing a computer to generate an instruction table, wherein the program is
A step of performing a parsing by the parsing unit on an instruction definition that defines an instruction set, wherein the instruction set includes an instruction defined in an instruction format having a plurality of instruction fields; , Including a description string representing the instruction format, and the description string includes, for each of the instruction fields, a position / size related character string representing any one item of an LSB position, an MSB position, and a size; A pair with a content character string representing a content designated in each is described in the order of the instruction fields, and the step of performing the syntax analysis is performed by the syntax analysis unit based on the description sequence. Obtaining a value for said one item for each of
The calculation unit calculates a value related to another item different from the one item among the LSB position, the MSB position, and the size for each of the instruction fields using the value related to the one item acquired by the parsing unit. To make it run,
program.
命令デコードプログラムの生成をコンピュータに実行させるためのプログラムであって、前記プログラムは前記コンピュータに、
命令セットを定義する命令定義体に対して構文解析部が構文解析を行なうステップを実行させ、前記命令セットは、複数の命令フィールドを有する命令フォーマットで定義される命令を含み、前記命令定義体は、前記命令フォーマットを表現する記述列を含み、前記記述列は前記命令フィールドの各々について、LSB位置、MSB位置およびサイズのいずれか1つの項目を表す位置・サイズ関連文字列と、前記命令フィールドの各々において指定される内容を表す内容文字列との対を前記命令フィールドの並び順で記述しており、前記構文解析を行なうステップは、前記構文解析部が前記記述列に基づいて、前記命令フィールドの各々についての前記1つの項目に関する値を取得するステップを含み、
前記構文解析部が取得した前記1つの項目に関する値を用いて前記命令フィールドの各々について、LSB位置、MSB位置およびサイズのうち前記1つの項目と異なる他の項目に関する値を計算部が計算するステップをさら実行させる、
プログラム。
A program for causing a computer to generate an instruction decoding program, the program being executed by the computer,
A step of performing a parsing by the parsing unit on an instruction definition that defines an instruction set, wherein the instruction set includes an instruction defined in an instruction format having a plurality of instruction fields; , Including a description string representing the instruction format, and the description string includes, for each of the instruction fields, a position / size related character string representing any one item of an LSB position, an MSB position, and a size; A pair with a content character string representing a content designated in each is described in the order of the instruction fields, and the step of performing the syntax analysis is performed by the syntax analysis unit based on the description sequence. Obtaining a value for said one item for each of
The calculation unit calculates a value related to another item different from the one item among the LSB position, the MSB position, and the size for each of the instruction fields using the value related to the one item acquired by the parsing unit. To make it run,
program.
JP2014081581A 2014-04-11 2014-04-11 Instruction table generation apparatus, instruction decode program generation apparatus, instruction table generation method, instruction decode program generation method, and program Active JP6214455B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014081581A JP6214455B2 (en) 2014-04-11 2014-04-11 Instruction table generation apparatus, instruction decode program generation apparatus, instruction table generation method, instruction decode program generation method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2014081581A JP6214455B2 (en) 2014-04-11 2014-04-11 Instruction table generation apparatus, instruction decode program generation apparatus, instruction table generation method, instruction decode program generation method, and program

Publications (2)

Publication Number Publication Date
JP2015203895A JP2015203895A (en) 2015-11-16
JP6214455B2 true JP6214455B2 (en) 2017-10-18

Family

ID=54597347

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2014081581A Active JP6214455B2 (en) 2014-04-11 2014-04-11 Instruction table generation apparatus, instruction decode program generation apparatus, instruction table generation method, instruction decode program generation method, and program

Country Status (1)

Country Link
JP (1) JP6214455B2 (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0895827A (en) * 1994-09-29 1996-04-12 Hitachi Ltd Microprogram verifying method
JP3156537B2 (en) * 1995-02-22 2001-04-16 松下電器産業株式会社 Instruction table generation method
JP4202673B2 (en) * 2002-04-26 2008-12-24 株式会社東芝 System LSI development environment generation method and program thereof
JP2005063175A (en) * 2003-08-13 2005-03-10 Nec Electronics Corp Development automation system of software development environments for processor design development
JP2010282248A (en) * 2009-06-02 2010-12-16 Hitachi Ltd Programming language analysis execution program

Also Published As

Publication number Publication date
JP2015203895A (en) 2015-11-16

Similar Documents

Publication Publication Date Title
Wells Elements of combinatorial computing
US20160321039A1 (en) Technology mapping onto code fragments
CN110825363B (en) Intelligent contract acquisition method and device, electronic equipment and storage medium
JP2006243839A (en) Instruction generation device and instruction generation method
US9495150B2 (en) Information processing apparatus and method, and computer program product
US20160342615A1 (en) Method and device for generating pileup file from compressed genomic data
CN114625844B (en) Code searching method, device and equipment
US9753752B2 (en) Simulator generation method and apparatus
US20100037039A1 (en) Instruction operation code generation system
JP6214455B2 (en) Instruction table generation apparatus, instruction decode program generation apparatus, instruction table generation method, instruction decode program generation method, and program
Fournel et al. Automated generation of efficient instruction decoders for instruction set simulators
US10055318B2 (en) Method and apparatus for generating test bench for verification of processor decoder
KR102671575B1 (en) A technique to BinDiff cross architecture binaries
CN114816435A (en) Software development method based on reverse technology
JP6502044B2 (en) Data analysis device, data analysis method, and program.
WO2020049622A1 (en) Information processing device, analysis system, analysis method, and non-transitory computer-readable medium having analysis program stored thereon
CN113031952A (en) Method and device for determining execution code of deep learning model and storage medium
JP6243619B2 (en) Program analysis apparatus and program analysis method
CN111240682A (en) Instruction data processing method and device, equipment and storage medium
JP6409639B2 (en) Compiler program, system, method, and apparatus
JP2010282248A (en) Programming language analysis execution program
Giegerich et al. Towards a discipline of dynamic programming
US12050892B2 (en) Card solver compiler parsing
JP2008176520A (en) Tag conversion device
CN118626147A (en) Instruction decoding method, device, electronic equipment and readable medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20160928

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20170731

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20170919

R150 Certificate of patent or registration of utility model

Ref document number: 6214455

Country of ref document: JP

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