JPH05100720A - Managing device for program - Google Patents
Managing device for programInfo
- Publication number
- JPH05100720A JPH05100720A JP26231991A JP26231991A JPH05100720A JP H05100720 A JPH05100720 A JP H05100720A JP 26231991 A JP26231991 A JP 26231991A JP 26231991 A JP26231991 A JP 26231991A JP H05100720 A JPH05100720 A JP H05100720A
- Authority
- JP
- Japan
- Prior art keywords
- instruction
- program
- language
- stack
- storing
- 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
Links
Landscapes
- Programmable Controllers (AREA)
Abstract
(57)【要約】
【目的】 プログラムの実行に要する時間を可及的に短
縮することができるプログラムの管理装置を提供するこ
とである。
【構成】 ソース領域22のソース言語におけるプログ
ラムはコンパイラ18によって実行形式言語にコンパイ
ルされる。このときソース領域22から読み出される命
令は、ストア命令「STR」「STR NOT」や演算
命令「AND STR」「OR STR」であることが
検出されると、これらの命令はアキュムレータ25とス
タック領域24との間の転送命令としてコンパイルされ
る。
(57) [Abstract] [Purpose] To provide a program management device capable of shortening the time required to execute a program as much as possible. [Structure] The program in the source language of the source area 22 is compiled into an executable language by the compiler 18. At this time, when it is detected that the instructions read from the source area 22 are the store instructions “STR”, “STR NOT”, and the operation instructions “AND STR” “OR STR”, these instructions are stored in the accumulator 25 and the stack area 24. It is compiled as a transfer instruction between and.
Description
【0001】[0001]
【産業上の利用分野】本発明は、たとえばプログラマブ
ルコントローラに備えられ、アセンブラ言語などのソー
ス言語で記述されたプログラムを、機械語などの実行形
式言語に変換するコンパイラなどのプログラムの管理装
置に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a program management device such as a compiler which is provided in a programmable controller and converts a program written in a source language such as an assembler language into an execution format language such as a machine language.
【0002】[0002]
【従来の技術】たとえば工場の生産ラインにおいて、多
数の作動機器をシーケンス制御するために、プログラマ
ブルコントローラが用いられている。このプログラマブ
ルコントローラには、CPU(セントラルプロセッシン
グユニット)とメモリとが備えられ、いわゆるストアド
プログラム方式でシーケンス制御が行われる。プログラ
マブルコントローラには、プログラマと称されるプログ
ラム入力装置が接続され、例としてラダー図やアセンブ
ラ言語などでプログラムの入力が行われる。2. Description of the Related Art A programmable controller is used, for example, in a production line of a factory to sequence-control a large number of operating devices. The programmable controller includes a CPU (central processing unit) and a memory, and sequence control is performed by a so-called stored program method. A program input device called a programmer is connected to the programmable controller, and as an example, a program is input in a ladder diagram or an assembler language.
【0003】例として、アセンブラ言語で入力されたプ
ログラムは、プログラマブルコントローラのメモリ中に
おけるソース領域に、前記アセンブラ言語としてのソー
ス言語の形式で記憶され、このプログラムがプログラマ
ブルコントローラに備えられるコンパイラによってコン
パイルされ、機械語などの実行形式言語に変換され、前
記メモリ中の実行形式領域に、前記ソース領域とは別個
に記憶される。As an example, a program input in the assembler language is stored in the source area in the memory of the programmable controller in the form of the source language as the assembler language, and this program is compiled by a compiler provided in the programmable controller. , A machine language or the like, and is stored in the execution format area in the memory separately from the source area.
【0004】図3〜図5は、本発明の基礎となる技術を
説明する図である。図3は、下記第1表に示すプログラ
ム例を、ラダー図の形式で表したものである。FIG. 3 to FIG. 5 are views for explaining the technique underlying the present invention. FIG. 3 shows the program example shown in Table 1 below in the form of a ladder diagram.
【0005】[0005]
【表1】 [Table 1]
【0006】上記プログラムにおける例としてストア命
令「STR」は、いずれのアドレスに配置されている場
合でも、図4に示されるように、アキュムレータ1の内
容をスタック領域2の最上位位置3に格納する動作を行
うように、前記実行形式言語に変換される。すなわち、
図4(1)ではスタック領域2がプッシュ(PUSH)
され、図4(2)ではアキュムレータ1の内容がスタッ
ク領域2の最上位位置3に格納される。As an example in the above program, the store instruction "STR" stores the contents of the accumulator 1 in the uppermost position 3 of the stack area 2 as shown in FIG. Translated into the executable language to perform the operation. That is,
In FIG. 4A, the stack area 2 is pushed (PUSH).
4 (2), the contents of the accumulator 1 are stored in the uppermost position 3 of the stack area 2.
【0007】一方、前記プログラムにおける命令「OR
STR」,「AND STR」は、図5に示される動
作を行う。すなわち、図5(1)で示されるように、ス
タック領域2の最上位位置3の記憶内容とアキュムレー
タ1の内容とに関して、論理積演算あるいは論理和演算
の論理演算を行い、演算結果を再びアキュムレータ1に
格納する。次に、図5(2)に示されるようにスタック
領域2をポップ(POP)する。On the other hand, the instruction "OR" in the program
"STR" and "AND STR" perform the operation shown in FIG. That is, as shown in FIG. 5A, a logical operation such as a logical product operation or an logical sum operation is performed on the storage contents of the uppermost position 3 of the stack area 2 and the contents of the accumulator 1, and the operation result is again stored in the accumulator. Store in 1. Next, the stack area 2 is popped (POP) as shown in FIG.
【0008】[0008]
【発明が解決しようとする課題】前記プログラムにおけ
るアドレス「00」の命令「STR」は、この命令が実
行されるプログラムの先頭におけるアキュムレータ1の
記憶内容は、このプログラムにおける処理内容と全く無
関係であり、スタック領域2に格納する必要がないデー
タである。しかしながらこの命令「STR」は、どのよ
うなアドレスにあっても、図4を参照して説明した動作
を行うようにコンパイルされており、前記アドレス「0
0」の命令「STR」は、無駄な動作を行うことにな
り、プログラムの実行時間が長くなるという課題を有し
ている。According to the instruction "STR" at the address "00" in the above program, the storage content of the accumulator 1 at the head of the program in which this instruction is executed is completely unrelated to the processing content in this program. , Data that does not need to be stored in the stack area 2. However, this instruction "STR" is compiled to perform the operation described with reference to FIG.
The instruction "STR" of "0" causes a wasteful operation and has a problem that the execution time of the program becomes long.
【0009】また、スタック領域2を操作する命令はい
ずれもスタック領域2をプッシュ(PUSH)、あるい
はポップ(POP)する動作を行うようにコンパイルさ
れるが、一般にプログラマブルコントローラのCPUを
構成するマイクロプロセッサの動作時間は、データの転
送命令よりもスタック操作命令のほうが演算時間が長
く、この点でもプログラムの実行時間が長くなるという
課題を有している。Further, although all the instructions for operating the stack area 2 are compiled so as to perform an operation of pushing (PUSH) or popping (POP) the stack area 2, generally, a microprocessor constituting a CPU of a programmable controller. As for the operation time of, the stack operation instruction has a longer operation time than the data transfer instruction, and in this respect also, there is a problem that the program execution time becomes longer.
【0010】本発明の目的は、上述の技術的課題を解消
し、プログラムの実行に要する時間を可及的に短縮する
ことができるプログラムの管理装置を提供することであ
る。An object of the present invention is to solve the above-mentioned technical problems and to provide a program management apparatus capable of shortening the time required to execute the program as much as possible.
【0011】[0011]
【課題を解決するための手段】本発明は、プログラムを
ソース言語で記憶する第1記憶手段と、前記プログラム
を実行形式言語で記憶する第2記憶手段と、プログラム
をソース言語から実行形式言語に変換する際にのみ用い
られるスタックポインタと、ソース言語のプログラムを
実行形式言語に変換する言語変換手段であって、第1記
憶手段からアドレス順に読み出された命令がスタック領
域を操作する特定命令であるかどうかを判別する命令判
別手段と、命令判別手段が前記特定命令と判別した命令
を、アキュムレータとスタックポインタが指示するスタ
ック領域との間の転送処理に対応する実行形式命令に変
換する特定命令変換手段と、前記特定命令変換手段が動
作した直後に、スタックポインタの値を増減するスタッ
クポインタ操作手段とを備えるそのような言語変換手段
とを含むことを特徴とするプログラムの管理装置であ
る。According to the present invention, there is provided a first storage means for storing a program in a source language, a second storage means for storing the program in an execution format language, and a program from the source language to the execution format language. A stack pointer used only for conversion and a language conversion means for converting a source language program into an execution format language, and instructions read from the first storage means in the order of addresses are specific instructions for operating the stack area. An instruction discriminating means for discriminating whether or not there is, and a specific instruction for converting the instruction discriminated as the specific instruction by the instruction discriminating means into an execution format instruction corresponding to a transfer process between the accumulator and the stack area designated by the stack pointer. Immediately after the conversion means and the specific instruction conversion means operate, a stack pointer operator for increasing or decreasing the value of the stack pointer A management device program characterized by comprising a such a language conversion means comprising and.
【0012】また、本発明は、プログラムをソース言語
で記憶する第1記憶手段と、前記プログラムを実行形式
言語で記憶する第2記憶手段と、ソース言語のプログラ
ムを実行形式言語に変換する言語変換手段であって、第
1記憶手段からアドレス順に読み出された命令がスタッ
ク領域を操作する特定命令であるかどうかを判別する命
令判別手段と、読み出された命令がプログラムの先頭で
あるかどうかを判別する命令位置判別手段と、命令判別
手段と命令位置判別手段とが、プログラムの先頭に位置
し、かつスタック領域にデータを格納する命令と判別し
た特定命令を、指定するデータをアキュムレータに格納
する処理に対応する実行形式命令に変換する特定命令変
換手段とを備えるそのような言語変換手段とを含むこと
を特徴とするプログラムの管理装置である。The present invention also includes a first storage means for storing the program in the source language, a second storage means for storing the program in the execution format language, and a language conversion for converting the source language program into the execution format language. Means for determining whether the instruction read in the address order from the first storage means is a specific instruction for operating the stack area, and whether the read instruction is the head of the program The command position discriminating means for discriminating between the instruction position discriminating means, the instruction discriminating means and the instruction position discriminating means store the data for designating the specific instruction which is determined to be the instruction which is located at the head of the program and stores the data in the stack area, in the accumulator. And a language conversion means including specific instruction conversion means for converting into an executable format instruction corresponding to the processing It is the lamb of the management apparatus.
【0013】[0013]
【作用】本発明に従えば、プログラムはソース言語で第
1記憶手段に記憶され、このプログラムが言語変換手段
によって実行形式言語に変換されて、第2記憶手段に記
憶される。ここで、第1記憶手段に記憶されたプログラ
ムは、アドレス順に読み出され、命令判別手段によりス
タック領域を操作する特定命令であるかどうかが判別さ
れる。命令判別手段が、前記特定命令と判別した命令
は、特定命令変換手段によって、アキュムレータとスタ
ックポインタが指示するスタック領域との間の転送処理
に対応する実行形式命令に変換される。また、前述のよ
うに特定命令変換手段が動作すると、その直後にスタッ
クポインタ操作手段によってスタックポインタの値が増
減される。According to the present invention, the program is stored in the first storage means in the source language, the program is converted into the execution format language by the language conversion means, and is stored in the second storage means. Here, the program stored in the first storage means is read in the order of addresses, and the instruction determination means determines whether or not it is a specific instruction for operating the stack area. The instruction determined by the instruction determining means as the specific instruction is converted by the specific instruction converting means into an executable instruction corresponding to the transfer process between the accumulator and the stack area designated by the stack pointer. When the specific instruction converting means operates as described above, immediately after that, the stack pointer operating means increases or decreases the value of the stack pointer.
【0014】すなわち、前記特定命令は実行形式命令に
変換された際にアセンブラ言語におけるプッシュ(PU
SH)命令やポップ(POP)命令など、いわゆるスタ
ック操作命令に対応する実行形式命令には変換されてお
らず、前記転送命令とスタックポインタの増減命令とに
変換されている。前記スタック操作命令よりも転送命令
が演算時間が短く、これにより実行形式言語によるプロ
グラムの実行時間が短縮される。That is, when the specific instruction is converted into an executable format instruction, push (PU) in assembler language is executed.
It has not been converted into an execution format instruction corresponding to a so-called stack operation instruction such as an SH) instruction or a pop (POP) instruction, but is converted into the transfer instruction and the stack pointer increase / decrease instruction. The transfer instruction has a shorter operation time than the stack operation instruction, which reduces the execution time of the program in the executable language.
【0015】また、前記言語変換手段において、第1記
憶手段から読み出された命令が、命令判別手段によって
前記特定命令と判別され、かつ命令位置判別手段によっ
てプログラムの先頭である命令と判別されると、特定命
令変換手段によって前記特定命令は、指定するデータを
アキュムレータに格納する処理に対応する実行形式命令
に変換される。すなわち、スタック領域にデータを格納
する命令がプログラムの先頭にある場合、格納される意
味のあるデータはアキュムレータには存在せず、当該特
定命令がスタック領域にデータを格納する命令に対応す
る実行形式命令に変換されて無駄な動作を行う事態が防
止され、これによっても実行形式言語におけるプログラ
ムの演算時間を短縮することができる。In the language conversion means, the instruction read from the first storage means is discriminated by the instruction discriminating means as the specific instruction, and by the instruction position discriminating means as the instruction at the head of the program. Then, the specific instruction converting means converts the specific instruction into an execution format instruction corresponding to the process of storing the designated data in the accumulator. In other words, if the instruction to store data in the stack area is at the beginning of the program, the meaningful data to be stored does not exist in the accumulator, and the execution instruction corresponding to the instruction in which the particular instruction stores data in the stack area. It is possible to prevent a situation in which unnecessary operations are performed after being converted into an instruction, and this can also reduce the operation time of the program in the execution format language.
【0016】[0016]
【実施例】図1は本発明の一実施例に従うプログラマブ
ルコントローラ11の構成を示すブロック図である。プ
ログラマブルコントローラ11は、マイクロプロセッサ
を含んで構成される制御部(CPU,セントラルプロセ
ッシングユニット)12を備え、制御部12にはスタッ
クポインタ13が設けられている。前記制御部12に
は、例として各種スイッチ類やボタン類などの外部入力
手段がそれぞれ接続される複数の入力端子14を備える
入力ポート15と、例としてソレノイドバルブやランプ
などの外部の被制御機器などがそれぞれ接続される複数
の出力端子16を備える出力ポート17とが接続され
る。1 is a block diagram showing the configuration of a programmable controller 11 according to an embodiment of the present invention. The programmable controller 11 includes a control unit (CPU, central processing unit) 12 including a microprocessor, and the control unit 12 is provided with a stack pointer 13. The control unit 12 has an input port 15 having a plurality of input terminals 14 to which external input means such as various switches and buttons are connected, and an external controlled device such as a solenoid valve and a lamp. And the like are connected to an output port 17 having a plurality of output terminals 16 respectively connected to the above.
【0017】また、制御部12はプログラマブルコント
ローラ11に備えられるコンパイラ18を制御し、また
RAM(ランダムアクセスメモリ)などによって実現さ
れるメモリ19が接続され、プログラム入力装置として
のプログラマ20とたとえばシリアル通信を行うための
インタフェース回路21が接続される。The control unit 12 controls a compiler 18 provided in the programmable controller 11, and is connected to a memory 19 realized by a RAM (random access memory) or the like, and serially communicates with a programmer 20 as a program input device. An interface circuit 21 for performing the above is connected.
【0018】前記メモリ19には、たとえばプログラマ
20からアセンブラ語などのソース言語などの形式で入
力されたプログラムを記憶するソース領域22と、ソー
ス領域22のプログラムがコンパイラ18によって機械
語などの実行形式言語に変換されて記憶される実行形式
領域23と、アタック領域24とが設定される。In the memory 19, for example, a source area 22 for storing a program input in a format such as a source language such as an assembler language from the programmer 20, and an execution format such as a machine language for the program in the source area 22 by the compiler 18. An execution format area 23 converted into a language and stored, and an attack area 24 are set.
【0019】本実施例は、ソース領域22に記憶された
ソース言語によるプログラムをコンパイラ18によって
実行形式言語のプログラムにコンパイルする際の変換機
能に特徴を有するものである。The present embodiment is characterized by a conversion function when the compiler 18 compiles a source language program stored in the source area 22 into an executable format language program.
【0020】図2は、このような本実施例の作用を説明
するフローチャートであり、ソース言語によるプログラ
ムを実行形式言語によるプログラムにコンパイルする動
作を説明する。ステップa1では、コンパイルを開始す
るに先立って、スタックポインタ13の値を初期化す
る。ステップa2では、予めプログラマ20からソース
言語の形式で入力され、ソース領域22に記憶されてい
るプログラムをアドレス毎に読み出す。以下の説明で
は、ソース領域22に前記第1表に示すプログラム例が
記憶されている場合を想定する。ステップa3では、読
み出された命令がストア命令「STR」あるいはストア
命令「STR NOT」のいずれかであるか否かを判断
する。ソース領域22のアドレス「00」からは、命令
「STR 1」が読み出され、ステップa3の判断が肯
定となり、ステップa4に移る。FIG. 2 is a flow chart for explaining the operation of this embodiment, and the operation of compiling a program in the source language into a program in the execution format language will be described. In step a1, the value of the stack pointer 13 is initialized before starting the compilation. In step a2, the program previously input in the source language format from the programmer 20 and stored in the source area 22 is read out for each address. In the following description, it is assumed that the source area 22 stores the program examples shown in Table 1 above. In step a3, it is determined whether the read instruction is a store instruction "STR" or a store instruction "STR NOT". The instruction “STR 1” is read from the address “00” of the source region 22, the determination in step a3 becomes affirmative, and the process proceeds to step a4.
【0021】ステップa4では、この命令が第1表のプ
ログラムと等価な図3に示したラダー図における先頭で
あるかどうかを判断する。すなわち前述のようなストア
命令はソース領域22に記憶されたプログラム全体の先
頭である場合は勿論、ソース領域22のプログラムを図
3のようなラダー図にした場合、各ラダー図の先頭であ
ればステップa4の判断は肯定となる。ストア命令「S
TR」あるいはストア命令「STR NOT」は、基本
的には従来技術の項で図4を参照して説明したように、
アキュムレータ25の内容をスタック領域24にプッシ
ュ(PUSH)する動作内容であるが、このようにラダ
ー図の先頭に位置する場合には、スタック領域24に格
納されるアキュムレータ25の内容はこのプログラムに
とっては意味がなく、したがって前記プッシュ動作は無
駄な動作となる。At step a4, it is judged whether or not this instruction is the head of the ladder diagram shown in FIG. 3, which is equivalent to the program of Table 1. That is, the above-described store instruction is not only at the beginning of the entire program stored in the source area 22, but also when the program in the source area 22 is a ladder diagram as shown in FIG. The determination in step a4 is affirmative. Store instruction "S
The "TR" or store instruction "STR NOT" is basically the same as described with reference to FIG.
The content of the operation of pushing (PUSH) the contents of the accumulator 25 to the stack area 24. However, in the case of being located at the beginning of the ladder diagram in this way, the contents of the accumulator 25 stored in the stack area 24 are It makes no sense, and therefore the push operation is a useless operation.
【0022】本実施例では、このような場合ステップa
5において前記ストア命令「STR」やストア命令「S
TR NOT」を、「指定されたデータをアキュムレー
タ25に格納する命令」に対応する実行形式命令にコン
パイルする。この後、処理はステップa2に戻り、再び
命令を読出す。In this embodiment, in such a case, step a
5, the store instruction "STR" and the store instruction "S"
"TR NOT" is compiled into an executable instruction corresponding to the "instruction for storing the specified data in the accumulator 25". After that, the process returns to step a2 to read the instruction again.
【0023】前記ステップa4の判断が肯定であれば、
プログラム中の先頭以外の位置に配置されている前記ス
トア命令は、アキュムレータ25の内容をスタック領域
24に格納する必要があるため、本実施例ではステップ
a6において当該ストア命令を、「スタックポインタ1
3の示すメモリ19上の位置にアキュムレータ25の内
容を格納する命令」に対応する実行形式言語にコンパイ
ルする。If the determination at step a4 is affirmative,
Since the store instruction arranged at a position other than the beginning in the program needs to store the contents of the accumulator 25 in the stack area 24, in the present embodiment, the store instruction is changed to "stack pointer 1" in step a6.
3 is an instruction to store the contents of the accumulator 25 at the position on the memory 19 ".
【0024】すなわちこのような実行形式言語における
命令は転送命令であり、スタック領域24に関するプッ
シュ(PUSH)命令、あるいはポップ(POP)命令
に対応する命令ではない。すなわちマイクロプロセッサ
の演算速度の点で、転送命令がスタック操作命令よりも
高速であり、これにより実行形式言語におけるプログラ
ムの演算速度が向上される。この後、処理はステップa
7に移り、コンパイラ18は前記スタックポインタ13
をプラス1インクリメントし、処理はステップa5に移
り前述のように指定されたデータをアキュムレータ25
に転送する命令をコンパイルする。この後、処理はステ
ップa1に戻る。That is, the instruction in such an execution format language is a transfer instruction, and is not an instruction corresponding to a push (PUSH) instruction or a pop (POP) instruction for the stack area 24. That is, in terms of the operation speed of the microprocessor, the transfer instruction is faster than the stack operation instruction, which improves the operation speed of the program in the execution format language. After this, the process is step a.
7, the compiler 18 moves the stack pointer 13
Is incremented by 1, and the process proceeds to step a5, and the data designated as described above is stored in the accumulator 25.
Compile the instructions to transfer to. After that, the process returns to step a1.
【0025】前記ステップa3で判断が否定であれば、
処理はステップa8に移り、読み出された命令が演算命
令「AND STR」あるいは演算命令「OR ST
R」のいずれかであるか否かを判断する。この判断が否
定であれば処理はステップa9に移り、読み出されたそ
れぞれの命令が当該命令に対応する実行形式言語にコン
パイルされ、処理はステップa2に戻る。前記ステップ
a8の判断が肯定であればステップa10において、前
記演算命令を「現在スタックポインタ13で示されてい
るメモリ19上のアドレス内容とアキュムレータ25の
内容とに対してAND(論理積)あるいはOR(論理
和)などの論理演算を行う命令」に対応する実行形式言
語にコンパイルする。この後、処理はステップa11に
移り、スタックポインタ13の値をマイナス1デクリメ
ントし、処理はステップa2に戻る。If the judgment in step a3 is negative,
The process proceeds to step a8, and the read instruction is the operation instruction “AND STR” or the operation instruction “OR ST
It is determined whether or not it is either "R". If this judgment is negative, the process proceeds to step a9, each read instruction is compiled into the execution format language corresponding to the instruction, and the process returns to step a2. If the determination at step a8 is affirmative, then at step a10, the arithmetic instruction is "AND (logical product) or OR with respect to the address contents in the memory 19 currently indicated by the stack pointer 13 and the contents of the accumulator 25. Compile into an execution format language corresponding to an instruction that performs a logical operation such as (logical sum). After that, the process proceeds to step a11, the value of the stack pointer 13 is decremented by 1, and the process returns to step a2.
【0026】すなわちこの場合では、従来例では図5に
即して説明したようにスタック領域のポップ(POP)
処理を行う命令となるが、本実施例では、前述したよう
なデータの転送処理の内容にコンパイルしている。That is, in this case, in the conventional example, the pop (POP) of the stack area is performed as described with reference to FIG.
Although it is an instruction to perform processing, in the present embodiment, the contents of the data transfer processing as described above are compiled.
【0027】以上のように本実施例では、前記ストア命
令「STR」、「STRNOT」や演算命令「AND
STR」、「OR STR」などの命令をコンパイルす
るに際して、スタックポインタ13で指定されるスタッ
ク領域24とアキュムレータ25との転送処理として実
現している。これによりプログラムの演算速度が格段に
向上される。As described above, in this embodiment, the store instructions "STR", "STRNOT" and the operation instruction "AND" are used.
This is realized as a transfer process between the stack area 24 designated by the stack pointer 13 and the accumulator 25 when compiling instructions such as “STR” and “OR STR”. As a result, the calculation speed of the program is significantly improved.
【0028】[0028]
【発明の効果】以上のように本発明に従えば、プログラ
ムはソース言語で第1記憶手段に記憶され、このプログ
ラムが言語変換手段によって実行形式言語に変換され
て、第2記憶手段に記憶される。ここで、第1記憶手段
に記憶されたプログラムは、アドレス順に読み出され、
命令判別手段によりスタック領域を操作する特定命令で
あるかどうかが判別される。命令判別手段が、前記特定
命令と判別した命令は、特定命令変換手段によって、ア
キュムレータとスタックポインタが指示するスタック領
域との間の転送処理に対応する実行形式命令に変換され
る。また、前述のように特定命令変換手段が動作する
と、その直後にスタックポインタ操作手段によってスタ
ックポインタの値が増減される。As described above, according to the present invention, the program is stored in the first storage means in the source language, the program is converted into the execution format language by the language conversion means, and stored in the second storage means. It Here, the programs stored in the first storage means are read in the order of addresses,
The instruction determining means determines whether the instruction is a specific instruction for operating the stack area. The instruction determined by the instruction determining means as the specific instruction is converted by the specific instruction converting means into an executable instruction corresponding to the transfer process between the accumulator and the stack area designated by the stack pointer. When the specific instruction converting means operates as described above, immediately after that, the stack pointer operating means increases or decreases the value of the stack pointer.
【0029】すなわち、前記特定命令は実行形式命令に
変換された際にアセンブラ言語におけるプッシュ(PU
SH)命令やポップ(POP)命令など、いわゆるスタ
ック操作命令に対応する実行形式命令には変換されてお
らず、前記転送命令とスタックポインタの増減命令とに
変換されている。前記スタック操作命令よりも転送命令
が演算時間が短く、これにより実行形式言語によるプロ
グラムの実行時間が短縮される。That is, when the specific instruction is converted into an executable format instruction, push (PU) in assembler language is executed.
It has not been converted into an execution format instruction corresponding to a so-called stack operation instruction such as an SH) instruction or a pop (POP) instruction, but is converted into the transfer instruction and the stack pointer increase / decrease instruction. The transfer instruction has a shorter operation time than the stack operation instruction, which reduces the execution time of the program in the executable language.
【0030】また、前記言語変換手段において、第1記
憶手段から読み出された命令が、命令判別手段によって
前記特定命令と判別され、かつ命令位置判別手段によっ
てプログラムの先頭である命令と判別されると、特定命
令変換手段によって前記特定命令は、指定するデータを
アキュムレータに格納する処理に対応する実行形式命令
に変換される。すなわち、スタック領域にデータを格納
する命令がプログラムの先頭にある場合、格納される意
味のあるデータはアキュムレータには存在せず、当該特
定命令がスタック領域にデータを格納する命令に対応す
る実行形式命令に変換されて無駄な動作を行う事態が防
止され、これによっても実行形式言語におけるプログラ
ムの演算時間を短縮することができる。In the language conversion means, the instruction read from the first storage means is discriminated by the instruction discriminating means as the specific instruction, and by the instruction position discriminating means as the instruction at the head of the program. Then, the specific instruction converting means converts the specific instruction into an execution format instruction corresponding to the process of storing the designated data in the accumulator. In other words, if the instruction to store data in the stack area is at the beginning of the program, the meaningful data to be stored does not exist in the accumulator, and the execution instruction corresponding to the instruction in which the particular instruction stores data in the stack area. It is possible to prevent a situation in which unnecessary operations are performed after being converted into an instruction, and this can also reduce the operation time of the program in the execution format language.
【図1】本発明の一実施例に従うプログラマブルコント
ローラ11のブロック図である。FIG. 1 is a block diagram of a programmable controller 11 according to an embodiment of the present invention.
【図2】本実施例の動作を説明するフローチャートであ
る。FIG. 2 is a flowchart illustrating the operation of this embodiment.
【図3】本発明の基礎となる技術を示すラダー図であ
る。FIG. 3 is a ladder diagram showing a technique underlying the present invention.
【図4】スタックのプッシュ(PUSH)命令の処理内
容を示す図である。FIG. 4 is a diagram illustrating processing contents of a push (PUSH) instruction of a stack.
【図5】演算命令「ANT STR」の処理内容を示す
図である。FIG. 5 is a diagram showing the processing contents of an arithmetic instruction “ANT STR”.
11 プログラマブルコントローラ 12 制御部 13 スタックポインタ 14 入力端子 15 入力ポート 16 出力端子 17 出力ポート 18 コンパイラ 19 メモリ 20 プログラマ 21 インタフェース回路 22 ソース領域 23 実行形式領域 24 スタック領域 25 アキュムレータ 11 programmable controller 12 control unit 13 stack pointer 14 input terminal 15 input port 16 output terminal 17 output port 18 compiler 19 memory 20 programmer 21 interface circuit 22 source area 23 execution format area 24 stack area 25 accumulator
Claims (2)
記憶手段と、 前記プログラムを実行形式言語で記憶する第2記憶手段
と、 プログラムをソース言語から実行形式言語に変換する際
にのみ用いられるスタックポインタと、 ソース言語のプログラムを実行形式言語に変換する言語
変換手段であって、 第1記憶手段からアドレス順に読み出された命令がスタ
ック領域を操作する特定命令であるかどうかを判別する
命令判別手段と、 命令判別手段が前記特定命令と判別した命令を、アキュ
ムレータとスタックポインタが指示するスタック領域と
の間の転送処理に対応する実行形式命令に変換する特定
命令変換手段と、 前記特定命令変換手段が動作した直後に、スタックポイ
ンタの値を増減するスタックポインタ操作手段とを備え
るそのような言語変換手段とを含むことを特徴とするプ
ログラムの管理装置。1. A first for storing a program in a source language
Storage means, second storage means for storing the program in an executable language, stack pointers used only when converting the program from the source language to the executable language, and converting the source language program into the executable language An instruction discriminating means for discriminating whether or not the instruction read out in the address order from the first storing means is a specific instruction for operating the stack area; and an instruction discriminated by the instruction discriminating means as the specific instruction. To a specific instruction conversion unit for converting an execution format instruction corresponding to a transfer process between the accumulator and the stack area designated by the stack pointer, and immediately after the specific instruction conversion unit operates, the value of the stack pointer is increased or decreased. A program including a language conversion means including a stack pointer operating means. Management apparatus.
記憶手段と、 前記プログラムを実行形式言語で記憶する第2記憶手段
と、 ソース言語のプログラムを実行形式言語に変換する言語
変換手段であって、 第1記憶手段からアドレス順に読み出された命令がスタ
ック領域を操作する特定命令であるかどうかを判別する
命令判別手段と、 読み出された命令がプログラムの先頭であるかどうかを
判別する命令位置判別手段と、 命令判別手段と命令位置判別手段とが、プログラムの先
頭に位置し、かつスタック領域にデータを格納する命令
と判別した特定命令を、指定するデータをアキュムレー
タに格納する処理に対応する実行形式命令に変換する特
定命令変換手段とを備えるそのような言語変換手段とを
含むことを特徴とするプログラムの管理装置。2. A first method for storing a program in a source language
Storage means, second storage means for storing the program in an execution format language, and language conversion means for converting a source language program into an execution format language, the instructions being read in the address order from the first storage means. An instruction discriminating means for discriminating whether or not it is a specific instruction for operating the stack area, an instruction position discriminating means for discriminating whether or not the read instruction is the head of the program, an instruction discriminating means and an instruction position discriminating means Includes a specific instruction conversion unit that converts a specific instruction located at the head of the program and determined to be an instruction to store data in the stack area into an execution format instruction corresponding to the process of storing the designated data in the accumulator. A program management device including such language conversion means.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP26231991A JPH05100720A (en) | 1991-10-09 | 1991-10-09 | Managing device for program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP26231991A JPH05100720A (en) | 1991-10-09 | 1991-10-09 | Managing device for program |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH05100720A true JPH05100720A (en) | 1993-04-23 |
Family
ID=17374120
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP26231991A Pending JPH05100720A (en) | 1991-10-09 | 1991-10-09 | Managing device for program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH05100720A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2007183848A (en) * | 2006-01-10 | 2007-07-19 | Meidensha Corp | Programmable controller |
-
1991
- 1991-10-09 JP JP26231991A patent/JPH05100720A/en active Pending
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2007183848A (en) * | 2006-01-10 | 2007-07-19 | Meidensha Corp | Programmable controller |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP2001265609A (en) | Arithmetic processing unit | |
| JPH07117898B2 (en) | Microprocessor system with multiple interrupt services | |
| JPH05100720A (en) | Managing device for program | |
| US5765148A (en) | Database processing apparatus and database processing method for variable length objects, and computer-readable memory medium for storing database processing program | |
| US6766448B2 (en) | Microcomputer for transferring program data to an internal memory from an external memory connected via a bus and a method therefor | |
| JPH08249018A (en) | Multiprocessor arithmetic device and programmable controller having the device | |
| JP2585708B2 (en) | Programmable controller | |
| JPH11219294A (en) | Program control method and apparatus | |
| JPH04311225A (en) | System for executing microprocessor instruction | |
| JPH05181669A (en) | Microprocessor | |
| JPS6325373B2 (en) | ||
| JP2708983B2 (en) | Program display device | |
| KR910009262B1 (en) | How to handle library of programmable controller | |
| JPH05303419A (en) | Robot program storage device | |
| JPS6051736B2 (en) | information processing equipment | |
| JPH08272411A (en) | Ladder instruction processor | |
| JPS61169937A (en) | Expansion system of microprocessor instruction | |
| JPH02178837A (en) | Speed governing system for microprogram | |
| JPH05158707A (en) | Real register assigning method | |
| JPH11353174A (en) | Programmable controller | |
| JPH0883188A (en) | A computer that performs multitasking | |
| JPH04232506A (en) | Robot controller | |
| JPH1139159A (en) | Computer system | |
| JPH04332045A (en) | Arithmetic processor | |
| JPS625466A (en) | Auxiliary processor control system |