JPH032933A - Object code generating device - Google Patents

Object code generating device

Info

Publication number
JPH032933A
JPH032933A JP13632789A JP13632789A JPH032933A JP H032933 A JPH032933 A JP H032933A JP 13632789 A JP13632789 A JP 13632789A JP 13632789 A JP13632789 A JP 13632789A JP H032933 A JPH032933 A JP H032933A
Authority
JP
Japan
Prior art keywords
code
operand
machine code
machine
target cpu
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.)
Pending
Application number
JP13632789A
Other languages
Japanese (ja)
Inventor
Yukio Yamazaki
幸夫 山崎
Hideo Miyauchi
宮内 英男
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 JP13632789A priority Critical patent/JPH032933A/en
Publication of JPH032933A publication Critical patent/JPH032933A/en
Pending legal-status Critical Current

Links

Landscapes

  • Multi Processors (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To produce a conversion table of an optional one of plural CPUs by fetching a machine code table out of an external storage based on a target CPU and forming a conversion table in accordance with a prescribed instruction mnemonic. CONSTITUTION:A command analyzing part 5 contains a target CPU recognizing part 8 and turns an operand information part 17b and a machine code part 17c of a code conversion table 17 into the idle areas. At the same time, a machine code table input part 9 is added into an object code generator 3 and a machine code table 11 is fetched out of an external storage 10 in accordance with a target CPU recognized by the part 8. Thus the table 17 is completed. As a result, the object codes can be produced in a simple constitution to plural CPUs. In addition, an object code is easily produced even to the CPU which is newly designed as long as a machine code can be used in common to the operands.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 この発明は複数のCPUに対するオブジェクトコードを
生成するオブジェクトコード生成装置に関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to an object code generation device that generates object codes for a plurality of CPUs.

〔従来の技術〕[Conventional technology]

第8図は従来のオブジェクトコード生成装置を示すブロ
ック図である。同図において、1はオブジェクトコード
生成装置起動時のコマンド入力部、2はアセンブリ言語
(インストラクションニーモニック及びオペ−ランドか
らなるソースコード)で記述されたソースファイルを取
り込むソースファイル人力部である。3はソースファイ
ル人力部より取り込まれたソースファイルよりオブジェ
クトコードをオブジェクトファイル出力部4に出力する
オブジェクトコードジェネレータ3である。
FIG. 8 is a block diagram showing a conventional object code generation device. In the figure, 1 is a command input section when the object code generation device is activated, and 2 is a source file manual section that takes in a source file written in assembly language (source code consisting of instruction mnemonics and operands). Reference numeral 3 denotes an object code generator 3 that outputs object code to an object file output section 4 from a source file taken in from the source file manual section.

オブジェクトコードジェネレータ3は内部にコマンド解
析部5及びコード変換部6を有している。
The object code generator 3 has a command analysis section 5 and a code conversion section 6 inside.

コマンド解析部5はコマンド人力部1より人力されたコ
マンドを解析し、必要な変数を設定する。
The command analysis unit 5 analyzes the command manually input by the command input unit 1, and sets necessary variables.

コード変換部6はコード変換テーブル7とオペランド認
識部13とから構成されている。オペランド認識部13
はソースファイル人力部1よりi′7られたソースコー
ドからインストラクションニモニックに対応つけてオペ
ランドの認識を行っている。オペランド認識部13より
オペランドの認識を行った後に、コード変換部6はイン
ストラクションニモニック及びオペランドから、コード
変換テーブル7を参照して、マシンコードに変換する。
The code converter 6 includes a code converter table 7 and an operand recognizer 13. Operand recognition unit 13
recognizes the operands from the source code compiled by the source file human resource department 1 by associating them with instruction mnemonics. After the operand recognition unit 13 recognizes the operand, the code conversion unit 6 converts the instruction mnemonic and the operand into machine code by referring to the code conversion table 7.

コード変換テーブル7は同図に示すようにインストラク
ション二−モニツク部7a及びオペランド部7bにター
ゲットCPUのマシンコード部7cを対応させたコード
変換テーブルである。
As shown in the figure, the code conversion table 7 is a code conversion table in which the instruction monitor section 7a and the operand section 7b correspond to the machine code section 7c of the target CPU.

次に動作について説明する。コマンド人力部1よりオブ
ジェクトコードの生成の起動コマンドか人力されるとオ
ブジェクトコードジェネレータ3が起動し、ソースファ
イル入力部2から入力され、アセンブリ言語で記述され
たソースファイルは、オブジェクトコードジェネレータ
3に取り込まれる。
Next, the operation will be explained. When a startup command for object code generation is manually input from the command human resource unit 1, the object code generator 3 is activated, and the source file input from the source file input unit 2 and written in assembly language is imported into the object code generator 3. It will be done.

そして、オブジェクトコードジェネレータ3におけるコ
マンド解析部5においてコマンドの解析を行ない、その
後ソースファイルから1行ずつソースコードを読出す。
Then, the command analysis unit 5 in the object code generator 3 analyzes the command, and then reads out the source code line by line from the source file.

読出された1行分のソースコードは、解析され、ロケー
ションカウンタの更新、ラベル登録等が行われる。
The read source code for one line is analyzed, and the location counter is updated, the label is registered, and so on.

ロケーションカウンタの更新はコード変換部6において
、以下に述べるように行われる。コード変換部6はコー
ド変換テーブル7を参照して、オペランド認識部13で
オペランドの認識を行った後、解1?中のソースコード
のインストラクション二一モニツク及びオペランドをコ
ード変換テーブル7のインストラクションニモニック部
7a及びオペランド部7bより探しだし対応するマシン
コード部7cのマシンコードサイズ分、ロケーションカ
ウンタをカウントアツプすることにより、ロケーション
カウンタの更新を行っている。
The location counter is updated in the code converter 6 as described below. The code conversion unit 6 refers to the code conversion table 7, and after the operand recognition unit 13 recognizes the operand, the answer 1? The instruction mnemonic and operand of the source code inside are searched from the instruction mnemonic part 7a and operand part 7b of the code conversion table 7, and the location counter is counted up by the machine code size of the corresponding machine code part 7c. The counter is being updated.

第9図はラベル登録の処理の流れを示すフローチャート
である。以下、同図を参照してその動作の説明をする。
FIG. 9 is a flowchart showing the flow of label registration processing. The operation will be explained below with reference to the same figure.

尚、ラベルとは所定の値のアドレス、データを名称で示
したシンボルであって、予め登録するラベルと、適宜登
録していくラベルがある。
Note that a label is a symbol that indicates a predetermined address or data with a name, and there are labels that are registered in advance and labels that are registered as appropriate.

まず、ステップS1で予め登録すべきラベルが登録され
ているか否かがチエツクされる。予め登録すべきラベル
かまだ登録されていない場合、ステップS2でラベルの
登録が行われる。
First, in step S1, it is checked whether a label that should be registered in advance has been registered. If the label to be registered in advance has not yet been registered, the label is registered in step S2.

予め登録すべきラベルが登録されると、ステップS3で
、ラベルがソースコードの先頭に記述さているか否かの
チエツクが行われる。ラベルがソースコードの先頭に記
述さている場合、ラベル(これが前述した適宜登録して
いくラベルに)[1当する)の登録を行う必要が生じる
ため、ステップS4に移る。一方、ラベルがソースコー
ドの先頭に記述さていない場合、ラベルの登録を行う必
要がないため終了する。
Once the label to be registered is registered in advance, a check is made in step S3 to see if the label is written at the beginning of the source code. If the label is written at the beginning of the source code, it is necessary to register the label (which corresponds to the label that is registered as appropriate), so the process moves to step S4. On the other hand, if the label is not written at the beginning of the source code, there is no need to register the label and the process ends.

ステップS4において、ステップS3で検出されたラベ
ルが、既に登録されているラベルか否かがチエツクされ
る。既にラベルが登録されている場合、もう1度ラベル
の登録を行うとラベルの2重登録をおこなうことになる
ため、ステップS6で、エラーメツセージの表示を行い
終了する。
In step S4, it is checked whether the label detected in step S3 is an already registered label. If a label has already been registered, registering the label again will result in double registration of the label, so an error message is displayed in step S6 and the process ends.

一方、未だラベルが登録されていない場合、ステップS
5で、現在のロケーションカウンタの値を当該ラベルの
値としてラベル名に対応させてラベルを登録し、終了す
る。
On the other hand, if no label is registered yet, step S
In step 5, a label is registered in association with the label name using the current location counter value as the value of the label, and the process ends.

このようなラベル処理は、読み込んだソースコードl]
にラベルが存在する場合に行われる。
This kind of label processing is performed using the loaded source code]
This is done if there is a label in .

以降、同様にソースコードの全行に渡って、ロケーショ
ンカウンタの更新及びラベルの登録等を行う(パス1)
After that, similarly update the location counter and register the label for all lines of the source code (Pass 1)
.

その後、ソースファイルの先頭行からソースコードを読
込み、コード変換部6において、読み込まれた1行分の
ソースコードのインストラクション二一モニツク及びオ
ペランドから、コード変換テーブル7を参照して、マシ
ンコード部7Cより得られるビットパターンを生成する
ことにより、ソースコードをターゲットCPUのマシン
コード(オブジェクトコード)に変換する。そして、変
換された全オブジェクトコードをファイルとしてオブジ
ェクトファイル出力部4に出力することでオブジェクト
ファイルが生成される。
After that, the source code is read from the first line of the source file, and the code conversion unit 6 converts the code conversion table 7 from the instructions and operands of the read one line of source code into the machine code unit 7C. The source code is converted into machine code (object code) of the target CPU by generating a bit pattern obtained from the process. Then, an object file is generated by outputting all the converted object codes as a file to the object file output unit 4.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

従来のオブジェクトコード生成装置は以上のように構成
され、動作しているので、オブジェクトコード生成装置
は、1つのCPUに対して固有のものとなる。したがっ
て、複数のCPUそれぞれに対しオブジェクトコードを
生成できるオブジェクトコード生成装置を実現するには
、オブジェクトコードジェネレータ3をCPUごとに設
けなければならず、オブジェクトコードジェネレータ3
横築のためのプログラム生成やデバッグ等の時間的コス
トや手間がかかるといった問題点があった。
Since the conventional object code generation device is configured and operates as described above, the object code generation device is unique to one CPU. Therefore, in order to realize an object code generation device that can generate object codes for each of a plurality of CPUs, it is necessary to provide an object code generator 3 for each CPU.
There were problems in that it took time and effort to generate and debug programs for horizontal construction.

この発明は上記のような問題点を解決するためになされ
たもので、複数のCPUに対するオブジェクトコード生
成が簡単な構成で実現できるとともに、新たに設計され
たCPUに対しても容易にオブジェクトコードの生成を
実現するオブジェクトコード生成装置を得ることを目的
とする。
This invention was made to solve the above-mentioned problems, and it is possible to realize object code generation for multiple CPUs with a simple configuration, and also to easily generate object code for newly designed CPUs. The purpose of this invention is to obtain an object code generation device that realizes object code generation.

〔課題を解決するための手段〕[Means to solve the problem]

この発明にかかるオブジェクトコード生成装置は、オペ
ランドに対するマシンコードが共通な、複数のCPUに
対するオブジェクトコードを生成する装置であって、゛
所定の形式で入力されたターゲットCPUに関する情報
からターゲットCPUの認識を行なうターゲットCPU
認識部と、インストラクション二一モニツク及びオペラ
ンドからなるソースコードを付与するソースコード付7
1部と、前記複数のCPUのうち少なくとも1つが用い
るオペランド全てに灼するマシンコードが予め格納され
たオペランドコード記憶部と、前記ソースコードから、
インストラクション二一モニツクに対応づけて、オペラ
ンドの認識を行うオペランド認識部と、前記複数のCP
U各々について所定のインストラクションニーモニツク
に対するマシンコードあるいはサポートされていないこ
とを示す情報及び該インストラクション二一モニツクが
許容するオペランド情報を有するマシンコードテーブル
を格納した外部記憶装置と、前記ターゲットCPU認識
部で認識されたターゲットCPUのマシンコードテーブ
ルを前記外部記憶装置より取込み、前記所定のインスト
ラクション二一モニツクに対応づけて変換テーブルを形
成するマシンコードテーブル入力部と、前記オペランド
認識部で認識されたオペランドと、前記変換テーブルの
前記オペランド情報とを比較し、当該オペランドが、対
応づけられたインストラクションニーモニックにおいて
許容されているか否かの判定を行うオペランド判定部と
、前記オペランド判定部の判定結果に応じて、前記ソー
スコードから、前記変換テーブル及び前記オペランドコ
ード記憶部に基づき、前記ターゲットCPUに対するマ
シンコードを生成して前記ターゲットCPUに対するオ
ブジェクトコードを出力するマシンコード生成部とを備
えて構成されている。
The object code generation device according to the present invention is a device that generates object codes for a plurality of CPUs having a common machine code for operands, and is capable of recognizing a target CPU from information regarding the target CPU input in a predetermined format. Target CPU
Comes with a source code 7 that provides a source code consisting of a recognition unit, instructions 21, and operands.
from the source code;
an operand recognition unit that recognizes operands in association with instruction 21 monitors;
an external storage device storing a machine code table for each predetermined instruction mnemonic or information indicating that the instruction mnemonic is not supported, and operand information allowed by the instruction mnemonic, and the target CPU recognition unit. a machine code table input unit that takes in a machine code table of the recognized target CPU from the external storage device and forms a conversion table by associating it with the predetermined instruction monic; and an operand recognized by the operand recognition unit. , an operand determination unit that compares the operand information in the conversion table and determines whether or not the operand is permitted in the associated instruction mnemonic; and in accordance with the determination result of the operand determination unit, and a machine code generation section that generates machine code for the target CPU from the source code based on the conversion table and the operand code storage section, and outputs an object code for the target CPU.

(作用〕 この発明におけるマシンコードテーブル人力部は、ター
ゲットCPUに基づき外部記憶装置よりマシンコードテ
ーブルを取込み、所定のインストラクションニーモニッ
クに対応させることで変換テーブルを形成するため、タ
ーゲットCPUを指定することにより複数の−CPUに
おける任意のCPUの変換テーブルを形成することがで
きる。。
(Operation) The machine code table manual section in this invention takes in a machine code table from an external storage device based on the target CPU and forms a conversion table by making it correspond to a predetermined instruction mnemonic. A conversion table for any CPU among multiple CPUs can be created.

[実施例] 第1図はこの発明の一実施例であるオブジェクトコード
生成装置を示すブロック図である。同図に示すように、
コマンド解析部5が内部にターゲットCPU認識部8を
備え、コード変換テーブル17内のオペランド情報部1
7b及びマシンコード部17cを空領域にしている。ま
た、オブジェクトコードジェネレータ3内にマシンコー
ドテーブル人力部9を新たに設け、ターゲットCPU認
識部8で認識されたターゲットCPUに応じたマシンコ
ードテーブル11を外部記憶装置10より取込み、コー
ド変換テーブル17を完成させている。
[Embodiment] FIG. 1 is a block diagram showing an object code generation device which is an embodiment of the present invention. As shown in the figure,
The command analysis section 5 includes a target CPU recognition section 8 therein, and the operand information section 1 in the code conversion table 17.
7b and the machine code section 17c are empty areas. In addition, a machine code table manual section 9 is newly provided in the object code generator 3, and a machine code table 11 corresponding to the target CPU recognized by the target CPU recognition section 8 is imported from the external storage device 10, and a code conversion table 17 is generated. It is being completed.

ターゲットCPU認識部8はコマンド入力部1よりター
ゲットCPUを指定するコマンドが入力されると、その
コマンドを解析しターゲットCPU情報をマシンコード
テーブル人力部9に与える。
When a command specifying a target CPU is input from the command input section 1, the target CPU recognition section 8 analyzes the command and provides target CPU information to the machine code table manual section 9.

また、外部記憶装置10は、オペランドに対するマシン
コードが共通な、3つのCPU (CPU1、CPU2
.CPU3)におけるインストラクションニモニック部
7aに対するマシンコードテーブルlla、llb、l
lcを、第2図で示すように有している。各マシンコー
ドテーブル11a、llb、llcは第3図の詳細部分
図に示すように所定のインストラクションニーモニック
に対応した配列でオペランド情報18及びマシンコード
19が格納されており、あるインストラクションニーモ
ニック(図の例ではlN5Tx)がターゲットCPUに
サポートされていない場合は、その領域1つにサポート
していないとの情報(”No 1’ S U I)P 
ORT”)を格納している。
The external storage device 10 also has three CPUs (CPU1, CPU2) that share the same machine code for operands.
.. Machine code tables lla, llb, l for instruction mnemonic part 7a in CPU 3)
lc as shown in FIG. Each machine code table 11a, llb, llc stores operand information 18 and machine code 19 in an arrangement corresponding to a predetermined instruction mnemonic, as shown in the detailed partial diagram of FIG. If 1N5Tx) is not supported by the target CPU, information indicating that it is not supported in that one area ("No 1' S U I)P
ORT”) is stored.

コード変換部6は内部にオペランド判定部15及びオペ
ランドテーブル16を新たに設けている。
The code conversion section 6 is newly provided with an operand determination section 15 and an operand table 16 inside.

オペランド判定部15はコード変換テーブル17に基づ
き後述する判定処理により、ソースコード中のインスト
ラクションニーモニックに対応づけられたオペランドが
、当該インストラクションニーモニックにおいて許容さ
れている内容か否かの判定を行う。
Based on the code conversion table 17, the operand determination unit 15 determines whether the operand associated with the instruction mnemonic in the source code has content permitted by the instruction mnemonic, by a determination process described later.

オペランドテーブル16には予め、CPUI〜3のうち
、少なくとも1つのCPUが用いるオペランドに対応づ
けてマシンコードを格納しており、このオペランドテー
ブル16に基づき、コード変換部6は与えられたオペラ
ンドをマシンコードに変換する。このように予めオペラ
ンドテーブル16を設けておくことができるのは、3つ
のCPU(CPU1.CPU2.CPU3)はとも゛に
オペランドに対するマシンコードが共通であるため、同
一オペランドに対しては必ず同一マシンコードに変換さ
れるからである。なお、他の構成は従来と同じであるの
で説明は省略する。
The operand table 16 stores machine codes in advance in association with operands used by at least one CPU among CPUI~3, and based on this operand table 16, the code converter 6 converts a given operand into a machine code. Convert to code. The reason why the operand table 16 can be prepared in advance is that the three CPUs (CPU1, CPU2, CPU3) all have the same machine code for operands, so the same operands are always processed by the same machine. This is because it is converted into code. Note that the other configurations are the same as the conventional one, so explanations will be omitted.

第4図はマシンコード19の一例を示す説明図である。FIG. 4 is an explanatory diagram showing an example of the machine code 19.

同図に示すように、1つのソースコードに対応するマシ
ンコード19はオペレーションコード部0P(OPI、
0P2)、アドレッシングモード部AP (API、A
P2)及び拡張部EP(EPI、EP2)よりなる。オ
ペレーションコード部OPのビットパターンはインスト
ラクションニーモニックに対応して決まっており、所定
のビットパターンが格納されている。一方、アドレッシ
ングモード部APはインストラクションニモニックに対
して必要とされるアドレッシングモードのビットパター
ンを格納する領域であり、拡張部EPはインストラクシ
ョンニーモニックに対して必要とされるアドレッシング
モードがアトレッジ、ングモード部APに格納しきれな
い場合におけるビットパターンを格納すべき領域である
。なお、アドレッシングモードは、オペランドが認識さ
れるとはじめて決定するため、インストラクションニー
モニックに対応して一義的に定まっておらず、マシンコ
ード19中のアドレッシングモード部AP、拡張部EP
には、固定値(オール0)が格納されている。
As shown in the figure, the machine code 19 corresponding to one source code includes an operation code section 0P (OPI,
0P2), addressing mode section AP (API, A
P2) and an extension part EP (EPI, EP2). The bit pattern of the operation code section OP is determined corresponding to the instruction mnemonic, and a predetermined bit pattern is stored. On the other hand, the addressing mode part AP is an area for storing the addressing mode bit pattern required for the instruction mnemonic, and the extension part EP is an area for storing the addressing mode bit pattern required for the instruction mnemonic. This is an area where bit patterns should be stored when the bit pattern cannot be stored in the area. Note that since the addressing mode is determined only when the operand is recognized, it is not uniquely defined in correspondence with the instruction mnemonic, and is determined by the addressing mode section AP and extension section EP in the machine code 19.
A fixed value (all 0) is stored in .

第5図はオペランド情報18の一例を示す説明図である
。オペランド情報18は第1オペランド情報18a及び
第2オペランド情報18bからなり、インストラクショ
ンニーモニックが許容するアドレッシングモードの情報
を有している。例えば、第5図の例では、第1オペラン
ド情報18aにより、第1オペランドとしてはアドレッ
シングモードA、D、Yが許容されている(実行可能で
ある)ことを示している。なお、マシンコード19に’
NOT 5UPPORI”’が記述されている場合、オ
ペランド情lPd18の全ビットに1をセットしておく
FIG. 5 is an explanatory diagram showing an example of the operand information 18. Operand information 18 consists of first operand information 18a and second operand information 18b, and has information on addressing modes permitted by the instruction mnemonic. For example, in the example shown in FIG. 5, the first operand information 18a indicates that addressing modes A, D, and Y are allowed (executable) as the first operand. In addition, machine code 19'
If NOT 5UPPORI'' is written, all bits of the operand information IPd18 are set to 1.

上記したオペランド情報18(オペランド情報部17b
に格納される)に基づき、オペランド判定部15は、オ
ペランド認識部13で認識されたオペランドにより規定
されるアドレッシングモードが、当該オペランドに対応
づけたインストラクションニーモニックにおいて許容さ
れたアドレッシングモードであるか否かの判定を行って
いる。
The above-mentioned operand information 18 (operand information section 17b
), the operand determination unit 15 determines whether the addressing mode defined by the operand recognized by the operand recognition unit 13 is an addressing mode permitted in the instruction mnemonic associated with the operand. The judgment is being made.

第6図は第1図で示したオブジェクトコード生成装置の
動作を示すフローチャートである。以下、同図を参照し
つつその動作の説明をする。
FIG. 6 is a flowchart showing the operation of the object code generation device shown in FIG. The operation will be explained below with reference to the same figure.

まずステップS11でコマンド解析部5に、コマンド入
力部1から所定のコマンドが入力されると、オブジェク
トコードジェネレータ3が起動する。この゛とき、ター
ゲットCPU指定のコマンドも人力されており、ターゲ
ットCPU認識部8によりターゲラl−CP Uが認識
される。そして、ターゲットCPU認識部8は、認識し
たターゲットCPU情報をマシンコードテーブル入力部
9に勾える。
First, in step S11, when a predetermined command is input to the command analysis section 5 from the command input section 1, the object code generator 3 is activated. At this time, the command specifying the target CPU is also manually input, and the target CPU recognition unit 8 recognizes the target CPU. Then, the target CPU recognition unit 8 inputs the recognized target CPU information to the machine code table input unit 9.

次に、ステップS12でマシンコードテーブル人力部9
は外部記憶装置10よりターゲットCPUに対応したマ
シンコードテーブルlia〜11Cのいずれかをコード
変換テーブル17のオペランド情報部17b及びマシン
コード部17cに取り込むことで完成する。
Next, in step S12, the machine code table manual section 9
is completed by importing one of the machine code tables lia to 11C corresponding to the target CPU from the external storage device 10 into the operand information section 17b and machine code section 17c of the code conversion table 17.

そして、ステップS13でソースファイル人力部2より
ソースファイルがオブジェクトコードジェネレータ3に
取り込まれ、ステップS14においてロケーションカウ
ンタをカウントアツプすることで先頭行から1行ずつソ
ースコードの読み込みを行なう。
Then, in step S13, the source file is loaded into the object code generator 3 from the source file manual section 2, and in step S14, the source code is read line by line starting from the first line by incrementing the location counter.

そして、ステップS15においてファイルの終了(EO
F)が確認されるまで、ステップS16において、従来
と同様にして、ロケーションカウンタの更新及びラベル
の登録等の処理を行なう(パス1)。
Then, in step S15, the end of the file (EO
Until F) is confirmed, in step S16, processes such as updating the location counter and registering the label are performed in the same manner as before (pass 1).

ステップS15でソースファイルのEOFが確認される
と、ステップS17でソースファイルの先頭にロケーシ
ョンカウンタを戻し、ステップS18において再び先頭
行から一行ずつソースコードの読込みを行なう。
When the EOF of the source file is confirmed in step S15, the location counter is returned to the beginning of the source file in step S17, and the source code is read line by line again starting from the first line in step S18.

そして、ステップS19においてEOFが確認されるま
で、ステップS20でコード変換部6において、以下に
述べるオブジェクトコードの生成を行う。
Then, in step S20, the code converter 6 generates the object code described below until the EOF is confirmed in step S19.

まず、オペランド認識部13により、当該ソースコード
からオペランドの認識を、インストラクション二一モニ
ツクに対応づけて行なう。そして、オペランド判定部1
5がオペランド認識部13で認識されたオペランドを取
込み、ステップS12で完成されたコード変換テーブル
17中のオペランド情報部17b内に格納されたオペラ
ンド情報18に基づき、そのオペランドがインストラク
シ白ンニーモニックが許容したアドレッシングモードで
あるか否かの判定を行う。
First, the operand recognition unit 13 recognizes an operand from the source code in association with an instruction monic. Then, operand determination unit 1
5 takes in the operand recognized by the operand recognition unit 13, and based on the operand information 18 stored in the operand information unit 17b of the code conversion table 17 completed in step S12, the operand is determined to have an instruction white mnemonic. It is determined whether the addressing mode is allowed.

当該オペランドがインストラクシらンニーモニックが許
容したアドレッシングモードであれば、コード変換テー
ブル17及びオペランドテーブル16を参照して、ター
ゲットCPUに該当するマシンコードを生成する。
If the operand is in an addressing mode permitted by the instruction mnemonic, the code conversion table 17 and the operand table 16 are referred to to generate a machine code suitable for the target CPU.

なお、そのマシンコードを格納する領域に”N0TS 
U l)+101? T”と格納されていれば、ターゲ
ットCPUには「当該ソースコードのインストラクショ
ンニーモニックがサポートされていない」等のエラーメ
ツセージにより警告を行う。また、オペランド判定部1
5により、当該オペランドが対応づけたインストラクシ
ョン二一モニツクが許容したアドレッシングモードでな
いと判定された場合、ターゲットCPUには「当該ソー
スコードのインストラクションニーモニツクにはそのよ
うなオペランドがサポートされていない」等のエラーメ
ッセ−ジにより警告を行う。以上がコード変換部6にお
けるオブジェクトコードの生成処理である。
Note that "N0TS" is placed in the area where the machine code is stored.
U l)+101? If "T" is stored, the target CPU is warned by an error message such as "The instruction mnemonic of the source code is not supported." In addition, the operand determination unit 1
5, if it is determined that the addressing mode that the instruction mnemonic associated with the operand is not allowed, the target CPU will receive a message such as ``The instruction mnemonic of the source code does not support such an operand.'' A warning is issued with an error message. The above is the object code generation process in the code converter 6.

そして、ステップS19でEOFが確認されると、ステ
ップS21でオブジェクトファイル出力部4に、生成し
たマシンコードをファイルとしたオブジェクトファイル
を出力し、全オブジェクトコード生成処理を終了する。
When the EOF is confirmed in step S19, an object file containing the generated machine code is output to the object file output section 4 in step S21, and the entire object code generation process is ended.

このようにマシンコードテーブル入力部9が外部記憶装
置10よりターゲットCPUにおけるマシンコードテー
ブル11を取込み、所定のインストラクションニーモニ
ツクに対するコード変換テーブル17を形成し、コード
変換部6中のオペランド判定部15により、正しいオペ
ランドが記述されているかの判定を行った後、コード変
換テーブル17及びオペランドテーブル16に基づきソ
ースコードからマシンコードを生成する構成としたため
、オペランドに対するマシンコードが共通な、複数のC
PUのオブジェクトコード生成処理を1つのオブジェク
トコードジェネレータ3で行なえる。また、新たに設計
されるCPUがCPU1〜CPU3て用いたインストラ
クションニーモニツクで構成され、オペランドに対する
マシンコードがCPU1〜CPU3と共通であれば、外
部記憶装置10内に新たにマシンコードテーブル11を
設ける等の簡tpな拡張で、そのCPUに対するオブジ
ェクトコード生成処理を行なうことができる。
In this way, the machine code table input unit 9 takes in the machine code table 11 in the target CPU from the external storage device 10, forms the code conversion table 17 for a predetermined instruction mnemonic, and the operand determination unit 15 in the code conversion unit 6 , after determining whether the correct operand has been written, machine code is generated from the source code based on the code conversion table 17 and the operand table 16.
PU object code generation processing can be performed by one object code generator 3. Furthermore, if the newly designed CPU is configured with the instruction mnemonics used by CPU1 to CPU3, and the machine code for the operand is common to CPU1 to CPU3, a new machine code table 11 is provided in the external storage device 10. With simple extensions such as tp, object code generation processing for the CPU can be performed.

なお、この実施例では、1つの外部記憶装置10に複数
のCPUにおけるマシンコードテーブル11を有してい
た例を示したが、例えば第7図に示すように複数のコン
ピュータシステム20a。
Although this embodiment has shown an example in which one external storage device 10 has machine code tables 11 for a plurality of CPUs, for example, as shown in FIG. 7, a plurality of computer systems 20a may be used.

20b、20c、20dをネットワークでつなぎ、各コ
ンピュータシステム20a〜20dのCPUのマシンコ
ードテーブル21a〜21dを各コンピュータシステム
の記憶装置内に格納しておき、コンピュータシステム2
0aのみにオブジェクトコードジェネレータ3を設け、
適宜ネットワークにより所定のコンピュータシステム2
0a、20b 、  20 c 、  20 dのCP
Uにおけるマシンコードテーブルを取込む構成にするこ
ともできる。
20b, 20c, and 20d are connected via a network, and the machine code tables 21a to 21d of the CPUs of each computer system 20a to 20d are stored in the storage device of each computer system.
Provide object code generator 3 only in 0a,
A predetermined computer system 2 via a network as appropriate.
CP of 0a, 20b, 20c, 20d
It is also possible to adopt a configuration in which the machine code table in U is imported.

〔発明の効果〕〔Effect of the invention〕

以上説明したように、この発明によれば、マシンコード
テーブル人力部は、ターゲ・ソトCPUIこ基づき外部
記憶装置よりマシンコードテーブルを取込み、所定のイ
ンストラクションニーモニ・ツクに対応させることで変
換テーブルを形成するため、この変換テーブルと予め格
納されたオペランドテーブルとに基づき、ターゲットC
PUに対するオブジェクトコードの生成を行なうことに
より、複数のCPUに対するオブジェクトコード生成を
簡単な構成で実現できるとともに、新たに設計されたC
PUに対しても、オペランドに対するマシンコードが共
通であれ41.容易にオブジェクトコードの生成が実現
できる。
As described above, according to the present invention, the machine code table manual section imports the machine code table from the external storage device based on the target software CPU, and converts the conversion table by making it correspond to a predetermined instruction mnemonic. Based on this conversion table and the pre-stored operand table, the target C
By generating object code for the PU, it is possible to generate object code for multiple CPUs with a simple configuration, and a newly designed C
Even for PUs, if the machine code for operands is common, 41. Object code generation can be easily achieved.

【図面の簡単な説明】[Brief explanation of drawings]

第1図はこの発明の一実施例であるオブジェクトコード
生成装置を示すブロック図、第2図は外部記憶装置の詳
細を示す説明図、第3図はマシンコードテーブルの詳細
を示す説明図、第4図はマシンコードの詳細を示す説明
図、第5図はオペランド情報の詳細を示す説明図、第6
図はこの発明の一実施例であるオブジェクトコード生成
装置の動作を示すフローチャート、第7図は他の実施例
を示したブロック構成図、第8図は従来のオブジェクト
コード生成装置を示すブロック図、第9図はラベル登録
動作を示すフローチャートである。 図において、1はコマンド人力部、3はオブジェクトコ
ードジェネレータ、5はコマンド解t11部、6はコー
ド変換部、8はターゲットCPU認識部、9はマシンコ
ードテーブル入力部、10は外部記憶装置、11はマシ
ンコードテーブル、13はオペランド認識部、15はオ
ペランド判定部、16はオペランドテーブル、17はコ
ード変換テーブルである。 なお、各図中同一符号は同一または相当部分を示す。
FIG. 1 is a block diagram showing an object code generation device which is an embodiment of the present invention, FIG. 2 is an explanatory diagram showing details of an external storage device, FIG. 3 is an explanatory diagram showing details of a machine code table, and FIG. Figure 4 is an explanatory diagram showing details of machine code, Figure 5 is an explanatory diagram showing details of operand information, and Figure 6 is an explanatory diagram showing details of operand information.
7 is a block diagram showing another embodiment of the invention; FIG. 8 is a block diagram showing a conventional object code generating device; FIG. 9 is a flowchart showing the label registration operation. In the figure, 1 is a command manual unit, 3 is an object code generator, 5 is a command solution unit, 6 is a code conversion unit, 8 is a target CPU recognition unit, 9 is a machine code table input unit, 10 is an external storage device, 11 1 is a machine code table, 13 is an operand recognition section, 15 is an operand judgment section, 16 is an operand table, and 17 is a code conversion table. Note that the same reference numerals in each figure indicate the same or corresponding parts.

Claims (1)

【特許請求の範囲】[Claims] (1)オペランドに対するマシンコードが共通な、複数
のCPUに対するオブジェクトコードを生成するオブジ
ェクトコード生成装置であって、所定の形式で入力され
たターゲットCPUに関する情報からターゲットCPU
の認識を行なうターゲットCPU認識部と、インストラ
クションニーモニック及びオペランドからなるソースコ
ードを付与するソースコード付与部と、 前記複数のCPUのうち少なくとも1つが用いるオペラ
ンド全てに対するマシンコードが予め格納されたオペラ
ンドコード記憶部と、 前記ソースコードから、インストラクションニーモニッ
クに対応づけて、オペランドの認識を行うオペランド認
識部と、 前記複数のCPU各々について所定のインストラクショ
ンニーモニックに対するマシンコードあるいはサポート
されていないことを示す情報及び該インストラクション
ニーモニックが許容するオペランド情報を有するマシン
コードテーブルを出納した外部記憶装置と、前記ターゲ
ットCPU認識部で認識されたターゲットCPUのマシ
ンコードテーブルを前記外部記憶装置より取込み、前記
所定のインストラクションニーモニックに対応づけて変
換テーブルを形成するマシンコードテーブル入力部と、 前記オペランド認識部で認識されたオペランドと、前記
変換テーブルの前記オペランド情報とを比較し、当該オ
ペランドが、対応づけられたインストラクションニーモ
ニックにおいて許容されているか否かの判定を行うオペ
ランド判定部と、前記オペランド判定部の判定結果に応
じて、前記ソースコードから、前記変換テーブル及び前
記オペランドコード記憶部に基づき、前記ターゲットC
PUに対するマシンコードを生成して前記ターゲットC
PUに対するオブジェクトコードを出力するマシンコー
ド生成部とを備えたオブジェクトコード生成装置。
(1) An object code generation device that generates object code for a plurality of CPUs with a common machine code for operands, which generates a target CPU from information about the target CPU input in a predetermined format.
a source code assigning unit that assigns a source code consisting of an instruction mnemonic and an operand; and an operand code storage in which machine codes for all operands used by at least one of the plurality of CPUs are stored in advance. an operand recognition unit that recognizes an operand from the source code in association with an instruction mnemonic; and a machine code corresponding to a predetermined instruction mnemonic for each of the plurality of CPUs or information indicating that the instruction is not supported and the instruction. an external storage device that stores a machine code table having operand information that the mnemonic allows, and a machine code table of the target CPU recognized by the target CPU recognition unit, which is fetched from the external storage device and associated with the predetermined instruction mnemonic; a machine code table input section that forms a conversion table by comparing the operand recognized by the operand recognition section with the operand information of the conversion table, and determines whether the operand is allowed in the associated instruction mnemonic. an operand determination unit that determines whether or not the target C
Generate machine code for the PU and write it to the target C.
An object code generation device comprising a machine code generation unit that outputs an object code for a PU.
JP13632789A 1989-05-30 1989-05-30 Object code generating device Pending JPH032933A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP13632789A JPH032933A (en) 1989-05-30 1989-05-30 Object code generating device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP13632789A JPH032933A (en) 1989-05-30 1989-05-30 Object code generating device

Publications (1)

Publication Number Publication Date
JPH032933A true JPH032933A (en) 1991-01-09

Family

ID=15172633

Family Applications (1)

Application Number Title Priority Date Filing Date
JP13632789A Pending JPH032933A (en) 1989-05-30 1989-05-30 Object code generating device

Country Status (1)

Country Link
JP (1) JPH032933A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6305013B1 (en) * 1998-04-01 2001-10-16 Nec Corporation Compiling method for generating target program in accordance with target processor type, compiling device, recording medium with compiling program recorded therein and recording medium with conversion table used in compiling recorded therein

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6305013B1 (en) * 1998-04-01 2001-10-16 Nec Corporation Compiling method for generating target program in accordance with target processor type, compiling device, recording medium with compiling program recorded therein and recording medium with conversion table used in compiling recorded therein

Similar Documents

Publication Publication Date Title
US4694420A (en) Inverse assembly method and apparatus
CN113703781A (en) Storage system interface generation method and device, electronic equipment and readable storage medium
CN110633258B (en) Log insertion method, device, computer device and storage medium
JPH032933A (en) Object code generating device
US20100070951A1 (en) Generic assembler
JPS62226231A (en) Processor
US8464235B2 (en) Adaptive production of assembler
JPH04362738A (en) Variable control method
CN112346780B (en) Information processing method, device and storage medium
CN114818656B (en) Binary file analysis method, device, equipment and medium based on gray scale upgrading
CN116661859B (en) Driving method and device of MCU peripheral circuit module and terminal equipment
CN118444943A (en) Container image creation method, device, electronic equipment and storage medium
JPH01184544A (en) Object code generating device
JP3278613B2 (en) Language processing system and language processing method
CN114860252A (en) Code unified compiling method and device, electronic equipment and readable storage medium
JPH01287743A (en) Object code generating device
JP2845694B2 (en) Data processing device
CN112948266A (en) Database grammar test system, method, device, equipment and storage medium
JPH11161615A (en) Control instruction arithmetic processor
CN116048995A (en) Method, system, medium, equipment and terminal for configuring abnormal information
JPS6061832A (en) Arithmetic controller
JPH05233237A (en) Device for supporting transfer of data structure depending program
JP2000132405A (en) In-line expansion processing device and method
JPH0628034B2 (en) Calculator with tag
JPS62159248A (en) Grammar checking system for input program