JPS6297038A - Program executing system - Google Patents

Program executing system

Info

Publication number
JPS6297038A
JPS6297038A JP23530385A JP23530385A JPS6297038A JP S6297038 A JPS6297038 A JP S6297038A JP 23530385 A JP23530385 A JP 23530385A JP 23530385 A JP23530385 A JP 23530385A JP S6297038 A JPS6297038 A JP S6297038A
Authority
JP
Japan
Prior art keywords
area
address
stack
work area
program
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
JP23530385A
Other languages
Japanese (ja)
Inventor
Yasuhisa Kanazawa
康久 金澤
Yoshiyuki Koido
小井土 義行
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.)
Fuji Electric Co Ltd
Fuji Facom Corp
Original Assignee
Fuji Electric Co Ltd
Fuji Facom 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 Fuji Electric Co Ltd, Fuji Facom Corp filed Critical Fuji Electric Co Ltd
Priority to JP23530385A priority Critical patent/JPS6297038A/en
Publication of JPS6297038A publication Critical patent/JPS6297038A/en
Pending legal-status Critical Current

Links

Landscapes

  • Executing Machine-Instructions (AREA)

Abstract

PURPOSE:To simplify a programing job and to eliminate a runaway accident by providing the required number of working areas for each FM independently of a stack area to store temporarily the interim result of arithmetic, and releasing the working areas as soon as the execution at the FM is through. CONSTITUTION:In an initial state an area QBR10 which stores the head address of a working area is empty and an address 900 is stored in a stack pointer address storing area 11. Therefore the address 900 of a memory area 12 is equal to a stack point SP. Hereafter the stack areas follow as addresses 901 and 902. Then each area is shifted to a state A when A of an instruction FM1 of a function module FM is executed. Then the sum of parameters 1(P) and 2(P) is written to the address of the area 12 which is shown by the QBR10 when an instruction B is executed. When an instruction C is executed, the sum of a working area 0(Q) and a parameter 3(P) is stored in the address where 1 is added to the contents of the QBR10. Then the data on an area 1(Q) is divided by 3 and the result of this division is written to a parameter 4(P) with the next instruction D. The initial state is reset with an instruction E.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、記憶領域内にスタック領域をもつ演算装置に
おいて、該スタック領域とは別に前記記憶領域内に作業
領域を設け、制御プログラムにより呼び出されるサブル
ーチンパッケージの実行時において、演算途中結果など
を前記作業領域に一時格納するようにした演算装置にお
けるプログラム実行方式に関するものである。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention provides an arithmetic device having a stack area in a storage area, in which a work area is provided in the storage area separately from the stack area and is called by a control program. The present invention relates to a program execution system in an arithmetic device in which intermediate results of calculations and the like are temporarily stored in the work area during execution of a subroutine package.

〔従来の技術〕[Conventional technology]

制御プログラムにより呼び出されるサブルーチンパッケ
ージの実行時において、演算の途中結果などのデータを
、一時的に記憶する方法として従来から知られているも
のには、以下の2つの方法がある。
The following two methods are conventionally known as methods for temporarily storing data such as intermediate results of calculations during execution of a subroutine package called by a control program.

■演算処理装置内にレジスタを用意しておき、これを利
用する方法。
■Method of preparing registers in the arithmetic processing unit and using them.

■記憶領域内にスタック領域をもつ演算装置では、PU
SH命令(書き込み)、POP命令(読み出し)の実行
によって、該スタック領域にラースト・イン・ファース
ト・アウトの原則で途中結果などのデータを退避(一時
記憶)させ、或いは取り出す方法。
■In arithmetic units that have a stack area in their storage area, the PU
A method for saving (temporarily storing) or retrieving data such as intermediate results in the stack area on a last-in-first-out principle by executing an SH instruction (write) or a POP instruction (read).

ところが、上述の方法■の場合、処理装置内に設けるレ
ジスタの数には限りがあるために、レジスタが不足する
。さらに、足りないレジスタを有効に利用するためには
、メインプログラムによってレジスタに格納された、保
存しておきたいデータを、PUSH,POP命令の実行
によりスタック領域に退避させる必要があり、そのため
のプログラミングが複雑になり、かつ、不自由であると
いう欠点があった。
However, in the case of the above-mentioned method (2), the number of registers provided in the processing device is limited, so there is a shortage of registers. Furthermore, in order to effectively use the missing registers, it is necessary to save the data stored in the registers by the main program to the stack area by executing the PUSH and POP instructions. The disadvantage is that it is complicated and inconvenient.

また、上記方法■の場合、退避させるべきデータの数が
多くなってPUSH,POP命令を多数用いると、プロ
グラムが複雑になるうえに、スタック領域の先頭には、
サブルーチンパッケージの実行終了後に復帰すべき主プ
ログラム上のアドレスが復帰アドレスとして格納されて
いるために、プログラム上のミスでPUSH命令とPO
P命令の数が対応しない事態が発生したりすると、サブ
ルーチンパッケージから主プログラムに復帰する時に主
プログラム上の誤ったアドレスに復帰してしまい、プロ
グラムが暴走することがある。
In addition, in the case of the above method (2), if the amount of data to be saved increases and a large number of PUSH and POP instructions are used, the program becomes complicated, and the top of the stack area is
Because the address in the main program that should be returned to after the execution of the subroutine package is completed is stored as the return address, a mistake in the program causes the PUSH command and PO
If a situation occurs in which the number of P instructions does not correspond, when returning to the main program from the subroutine package, the program may return to an incorrect address in the main program, causing the program to run out of control.

このため、プログラムの作成に際しては、プログラムに
書き込むPUSH命令とPOP命令の数の管理に余分な
注意を必要としプログラマの負担が重くなる。また、こ
のような余分な注意を払っても、ミスは発生し勝ちであ
り、このため結果的にプログラムにおける信頼性の低下
を招きやすくなるという欠点があった。
Therefore, when creating a program, extra care is required to manage the number of PUSH commands and POP commands written in the program, which increases the burden on the programmer. Furthermore, even if such extra care is taken, mistakes are likely to occur, and as a result, the reliability of the program is likely to deteriorate.

〔発明が解決すべき問題点〕[Problems to be solved by the invention]

そこで本発明においては、制御プログラムによって呼び
出されるサブルーチンパッケージの実行時において必要
となるデータの一時的記憶手段を用意するに際し、その
ために必要なプログラム上の処理すなわちプログラミン
グを簡単化し、しかもPUSH,POP命令の数の管理
を誤った場合に生じるプログラムの暴走などが本来的に
起り得ないようにすること、を解決すべき問題点として
いる。従って本発明は、上述のことを可能にするプログ
ラム実行方式を提供することを目的とする。
Therefore, in the present invention, when preparing a temporary storage means for data required at the time of execution of a subroutine package called by a control program, processing on the program that is necessary for this purpose, that is, programming, is simplified, and in addition, PUSH and POP commands The problem that needs to be solved is to prevent runaway programs from occurring due to incorrect management of the number of programs. Therefore, it is an object of the present invention to provide a program execution method that makes the above possible.

〔問題点を解決するための手段および作用〕上記目的を
達成するため、本発明は、記憶領域内にスタック領域を
もつ演算装置において、該スタック領域とは別に前記記
憶領域内に設ける作業領域の先頭アドレスを格納するポ
インタレジスタ(以下、QBRレジスタと云う)を用意
しておき、制御プログラムにより呼び出されたサブルー
チンの実行に際し、前記スタック領域の先頭アドレスを
示すスタックポインタのアドレスを前記作業領域の先頭
アドレスとして前記QBRレジスタに取り込み、それと
共に、演算の途中結果などを一時記憶させるための領域
として、プログラマがプログラムにおいて指定したワー
ド数だけ、前記QBRレジスタに格納された先頭アドレ
スに続いて作業領域を確保することにより、前記スタッ
クポインタは該ワード数だけそのアドレスをずらしてお
き・前記サブルーチンの終了時には、前記作業領域を消
滅させてスタックポインタを元のアドレスに復帰させる
ようにしたことを特徴としている。
[Means and operations for solving the problem] In order to achieve the above object, the present invention provides an arithmetic device having a stack area in the storage area, in which a work area is provided in the storage area separately from the stack area. A pointer register (hereinafter referred to as QBR register) that stores the start address is prepared, and when a subroutine called by the control program is executed, the address of the stack pointer indicating the start address of the stack area is set to the start address of the work area. The address is taken into the QBR register, and at the same time, a work area is created following the first address stored in the QBR register by the number of words specified by the programmer in the program, as an area for temporarily storing intermediate results of calculations, etc. By securing the stack pointer, its address is shifted by the number of words, and when the subroutine ends, the work area is erased and the stack pointer is returned to its original address. .

〔実施例〕〔Example〕

以下、本発明の詳細な説明する。なお、これまでサブル
ーチンパッケージという用語を用いてきたが、それと同
じ意味の実用的な用語ファンクション・モジュール(以
後、F M < F unction Module 
)と呼ぶ)を便宜上、今後は使用して実施例を3例、以
下に示す。
The present invention will be explained in detail below. Up to now, we have used the term subroutine package, but we will also use the practical term function module with the same meaning (hereinafter, F M < Function Module).
)) will be used from now on for convenience, and three examples will be shown below.

但し、ここでは、主プログラムとFMとの間でやりとり
をするデータとしてのパラメータを、n(P)と記述し
、nはパラメータの認識番号、(P)はパラメータであ
ることを表す記号とする。また、記憶領域にスタック領
域とは別に設ける作業領域をm(0)と記述し、mは作
業領域の認識番号、(ロ)は作業領域であることを表す
記号とする。
However, here, the parameter as data exchanged between the main program and the FM is written as n(P), where n is the identification number of the parameter and (P) is the symbol indicating that it is a parameter. . Further, a work area provided in the storage area separately from the stack area is written as m(0), m is the identification number of the work area, and (b) is a symbol representing the work area.

(1) ・・j;吉言 における 施す。(1)...j; Giving in good words.

第1図は本発明の一実施例におけるプログラムの説明図
である。すなわち、記憶領域にスタック領域とは別に設
けた作業領域を用いて、主プログラムからFMlに渡さ
れるデータとしてのパラメータ1(P)、2(P)、3
(P)の平均をとり、その結果をパラメータ4(P)と
して書き込むという機能をもつFMをFMIとして想定
する。
FIG. 1 is an explanatory diagram of a program in one embodiment of the present invention. That is, parameters 1(P), 2(P), 3 as data passed from the main program to FMl are stored in a work area provided in the storage area separately from the stack area.
Assume that the FM has the function of taking the average of (P) and writing the result as parameter 4(P) as the FMI.

第2図は、このFMIの実行時における作業領域の処理
内容説明図である。
FIG. 2 is an explanatory diagram of the processing contents of the work area during execution of this FMI.

以下、第1図、第2図を参照して処理動作を説明する。The processing operation will be described below with reference to FIGS. 1 and 2.

主プログラム上で、FMCI  (FM番号1のFMを
呼び出せ、Cはコールの意味)という命令が発生し、F
MIヘジャンプした所から説明を始める。
On the main program, the command FMCI (call FM number 1, C means call) is generated,
The explanation begins from the point where you jump to MI.

11−1)F番号1番のFM内にデータを一時記憶する
ための作業領域(アドレス)を2つ(0(Q) 、 1
 (Q) )とるという命令(第1図■)を実行する。
11-1) Create two work areas (addresses) for temporarily storing data in the FM with F number 1 (0 (Q), 1
(Q) ) Execute the command to take (Fig. 1 ■).

なお、第1図■において、FMSとあるSはスタートを
意味し、その次の数字1はFM番号を、更に次の数字2
は作業領域の数を示す。
In addition, in Figure 1 ■, the S in FMS means start, the next number 1 is the FM number, and the next number 2
indicates the number of work areas.

このとき、記憶領域におけるスタック領域の現在の先頭
アドレスであるスタックポインタのアドレスが作業領域
の先頭アドレスを格納する領域(以後、 QB R<Q
 Ba5e Register > と呼ぶ)に格納さ
れ、スタックポインタのアドレスは、用意される作雫領
域の数だけ、つまり2だけ増加する(+2.)(第2図
■参照)。
At this time, the address of the stack pointer, which is the current start address of the stack area in the storage area, is the area where the start address of the work area is stored (hereinafter, QB R<Q
The address of the stack pointer increases by the number of drop areas prepared, that is, by 2 (+2.) (see FIG. 2).

なお、第2図において、IOは作業領域の先頭アドレス
を格納する領域QBRを示し、11はスタックポインタ
SPのアドレスを格納する領域を示し、12は記憶領域
(スタック領域と作業領域)を示し、これら各領域の内
容が、第1図におけるFMIの実行経過に伴い、■−〇
・・−−0と推移してゆくのである。
In FIG. 2, IO indicates an area QBR for storing the start address of the work area, 11 indicates an area for storing the address of the stack pointer SP, 12 indicates a storage area (stack area and work area), The contents of each of these areas change from ■-0 to --0 as the FMI execution progresses in FIG.

従って、第2図においで、■に先立つ初期状態において
は、QBRIOは空き、スタックポインタアドレス(以
下、SPアドレスと記すこともある)格納領域11には
、例えば900番地が格納されており、従って記憶領域
12の900番地はスタックポイント(SP)であり、
以下901゜902番地とスタック領域が続いている。
Therefore, in FIG. 2, in the initial state prior to ■, QBRIO is empty, and the stack pointer address (hereinafter also referred to as SP address) storage area 11 stores address 900, for example. Address 900 of the storage area 12 is the stack point (SP),
Addresses 901 and 902 are followed by stack areas.

第1図における命令FMIの■の実行により、第2図で
は、各領域の内容が初期状態から■へ移行することはす
でに述べた。
It has already been mentioned that by executing the instruction FMI (2) in FIG. 1, the contents of each area shift from the initial state to (2) in FIG.

1−2)パラメータ1 (P)、 2 (P)で示され
るデータの和を作業領域0(Q)に記憶するという命令
(第1図■)を実行する。
1-2) Execute the command (■ in FIG. 1) to store the sum of data indicated by parameters 1 (P) and 2 (P) in work area 0 (Q).

このときのQBRIOで示される記憶領域12のアドレ
ス(この場合、200番地で作業領域0(Q))にパラ
メータ1 (P)、2(P)の和を書き込む(第2図■
)。
At this time, write the sum of parameters 1 (P) and 2 (P) to the address of the storage area 12 indicated by QBRIO (in this case, work area 0 (Q) at address 200) (Fig. 2
).

1−3)パラメータ3(P)の示すデータと、作業領域
0 (Q)内のデータの和を作業領域1 (Q)に記憶
するという命令(第1図◎)を実行する。
1-3) Execute the command (◎ in Figure 1) to store the sum of the data indicated by parameter 3 (P) and the data in work area 0 (Q) in work area 1 (Q).

このとき、作業領域0 (Q)  とパラメータ3(P
)の和がQBRIOの内容に1を加算したアドレス(作
業領域1 (Q))に格納される(第2図O)。
At this time, working area 0 (Q) and parameter 3 (P
) is stored at the address (work area 1 (Q)) obtained by adding 1 to the contents of QBRIO (O in Figure 2).

1−4)作業領域1(Q)で示されるデータを実数3で
徐算し、その結果を、パラメータ4(P)に書き込むと
いう命令(第1図◎)を実行する。
1-4) Execute the command (◎ in Figure 1) to divide the data shown in work area 1 (Q) by a real number 3 and write the result to parameter 4 (P).

このとき作業領域1(Q)すなわち、(QBR)+1で
示されるアドレスに格納されているデータを3で割り、
結果をパラメータ4(P)に書き込む。
At this time, the data stored in work area 1 (Q), that is, the address indicated by (QBR) + 1, is divided by 3,
Write the result to parameter 4(P).

1−1−5)Fの終了処理を行う命令(第1図■)では
、FMIの作業領域0 (Q)、 1 (Q)を解放し
て元のスタック領域に戻すために、スタックポインタS
Pのアドレスを900番地とし、FMlを呼び出す前つ
まり初期状態のスタックポインタに復帰させる。
1-1-5) The instruction that performs the termination process of F (■ in Figure 1) sets the stack pointer S to release the FMI work areas 0 (Q) and 1 (Q) and return them to the original stack area.
The address of P is set to 900, and the stack pointer is returned to the initial state before calling FMl.

以上のように、この発明による作業領域を用いれば、プ
ログラマは、スタック領域を意識することなしに、一時
記憶のための作業領域を自由にプログラム上で確保でき
、PUSH命令やPOP命令の個数管理が必要であった
ときに比べ、間違いの少ない、効率の良いプログラムを
記述できる。
As described above, by using the work area according to the present invention, the programmer can freely allocate a work area for temporary storage in the program without being aware of the stack area, and manage the number of PUSH and POP instructions. You can write more efficient programs with fewer errors than when you needed to.

(2)FMのネスティングにおける・施例。(2) Examples of FM nesting.

第3図はこの発明により設けた作業領域を使ってFMの
ネスティングを行う場合の実施例を説明するためのプロ
グラム説明図である。
FIG. 3 is a program explanatory diagram for explaining an embodiment in which FM nesting is performed using the work area provided according to the present invention.

ここでは、先の実施例で説明した平均をとるというFM
を呼びだし、作業領域0 (Q)、 1 ([1)、 
2 ((1)。
Here, the FM method of taking the average explained in the previous example is used.
Call the work area 0 (Q), 1 ([1),
2 ((1).

3(ロ)を設けるというデータをパラメータとじて渡し
、その処理の結果をパラメータ1(P)に書き込み、復
帰する場合を例として示す。
An example will be shown in which data indicating that 3 (b) is provided is passed as a parameter, the result of the processing is written to parameter 1 (P), and the return is made.

第4図は、第3図に示したプログラムの実行時における
作業領域の処理内容の説明図である。
FIG. 4 is an explanatory diagram of the processing contents of the work area when the program shown in FIG. 3 is executed.

以下、第3図、第4図を参照して処理動作を説明する。The processing operation will be explained below with reference to FIGS. 3 and 4.

2−1)前述の1−1)と同様、FM番号2番のFMの
実行に際し、O(Q)、 1 (Q)、 2 (Q)、
 3 (ロ)、の4つの作業領域をとるという命令(第
3図■)を実行する。
2-1) Similar to 1-1) above, when executing the FM with FM number 2, O(Q), 1 (Q), 2 (Q),
3 (b) Execute the command to take four work areas (■ in Figure 3).

このとき、領域11に格納されている現在のスタックポ
インタSPのアドレス(900番地とする)をQBRI
Oに格納し、スタックポインタSPのアドレスを、用意
する作業領域の数つまり4だけ増加する(+4)(第4
図■)。
At this time, the address (address 900) of the current stack pointer SP stored in area 11 is set to QBRI.
O, and the address of the stack pointer SP is increased by the number of work areas to be prepared, that is, 4 (+4) (4th
Figure ■).

2−2)作業領域0 (11)に1、作業領域1(Q)
に2、作業領域2(0)に3を書き込むという命令を実
行する(第3図■)。
2-2) Work area 0 (11) 1, work area 1 (Q)
2 and executes the command to write 3 to work area 2 (0) (Fig. 3, ■).

2−3)前述の実施例で用いた平均を求めるFMlを呼
びだし作業領域0 (Q)、 1 (Q)、 2 ((
1)、 3 (Q)を設けるというデータをパラメータ
として該FM1に渡しく第3図■)、FMIにおいて、
作業領域を2つ(0(Q)、 1 (Q))とるという
命令(第3図■)を実行する。
2-3) Call up FMl for calculating the average used in the above example and calculate the working areas 0 (Q), 1 (Q), 2 ((
1), 3 (Q) is provided as a parameter to the FM1 (Fig. 3), in the FMI,
The command (■ in Figure 3) to take two work areas (0 (Q), 1 (Q)) is executed.

このとき、領域11に格納されている現在のスタックポ
インタSPのアドレスすなわち904番地をQBRlo
に格納し、スタックポインタSPのアドレスを、2つと
った作業領域の数っまり2だけ増加(+2)する(第4
図■)。
At this time, the address of the current stack pointer SP stored in area 11, that is, address 904, is set to QBRlo.
and increases the address of the stack pointer SP by 2 (+2), which is the number of the two work areas (4th
Figure ■).

2−2−4)F内の平均値を求める処理を実行する(第
3図■)と先の実施例で説明したように、パラメータ4
(P)、すなわち作業領域3(Q)に平均をとった結果
、(=2)が書き込まれる(第4図■)。
2-2-4) When the process of calculating the average value in F is executed (Fig. 3 ■), as explained in the previous example, the parameter 4 is
(P), that is, as a result of taking the average in the work area 3 (Q), (=2) is written (Fig. 4 ■).

2−2−5)Fの処理が終わると(第3図■)、FMI
の作業領域0(0)を解放するため、スタックポインタ
SPのアドレスを904番地とし、QBRIOにFM2
の作業領域の先頭アドレスすなわち900番地を再び格
納する。こうすることによってFMIを呼び出す前のス
タックポインタに復帰する(第4図■)。
2-2-5) When the processing of F is completed (Fig. 3 ■), FMI
In order to release work area 0 (0), set the address of stack pointer SP to address 904 and write FM2 to
The start address of the work area, ie address 900, is stored again. By doing this, the stack pointer returns to the state before calling FMI (Fig. 4 -).

2−6)作業領域3(Q)で示されるデータすなわち2
をパラメータ1(P)に書き込む(第3図■)。
2-6) Data indicated in work area 3 (Q), i.e. 2
is written in parameter 1 (P) (Fig. 3, ■).

2−2−7)Fの処理が終わると(第3図■)、FM2
の作業領域を解放するためにスタックポインタSPのア
ドレスを900番地とし、FM2を呼び出す前のスタッ
クポインタに復帰する(第4図■)。
2-2-7) When the processing of F is completed (Fig. 3 ■), FM2
In order to release the work area of FM2, the address of the stack pointer SP is set to address 900, and the stack pointer returns to the state before calling FM2 (FIG. 4, ■).

以上のように、FMのネスティングが何段も続く場合に
も、この発明により設けた作業領域を用いると、プログ
ラムを複雑化することなく、容易にデータを保持できる
という利点が得られる。
As described above, even when FM nesting continues in many stages, the use of the work area provided by the present invention provides the advantage that data can be easily held without complicating the program.

(3)ビット処理における実施例。(3) Example in bit processing.

この発明により、FMの実行用に設けた作業領域を用い
て、ビット処理を行う場合の実施例として、パラメータ
1 (P) 、 2 (P)で示されるデータを比較し
て、1(P)と2(P)が等しければパラメータ3(P
)にOを、■(P)が2(P)より大きければパラメー
タ3(P)に−1を、1(P)が2(P)より小さけれ
ばパラメータ3(P)に1を、書き込む処理のプログラ
ム例を第5図に示す。
According to an embodiment of the present invention, when bit processing is performed using a work area provided for FM execution, data indicated by parameters 1 (P) and 2 (P) are compared and 1 (P) If and 2(P) are equal, parameter 3(P
), -1 is written to parameter 3 (P) if (P) is greater than 2 (P), and 1 is written to parameter 3 (P) if 1 (P) is less than 2 (P). An example of the program is shown in FIG.

ここで、Q7は作業領域0 (Q)のn番目のビットを
示す。
Here, Q7 indicates the nth bit of work area 0 (Q).

第6図は第5図のプログラム処理時における作業領域の
処理内容説明図である。
FIG. 6 is an explanatory diagram of the processing contents of the work area during the program processing of FIG. 5.

第5図、第6図を参照して処理動作を説明する。The processing operation will be explained with reference to FIGS. 5 and 6.

3−1)第5図■の命令を実行し、作業領域0(0)を
とる。従って第6図において、QBRIOにそれまでの
スタックポインタSPのアドレス900番地を格納し、
とった作業領域は1つであるから、領域11に格納され
るスタックポインタSPのアドレスは901番地となる
3-1) Execute the command shown in Figure 5 (■) to obtain work area 0 (0). Therefore, in FIG. 6, the previous address 900 of the stack pointer SP is stored in QBRIO,
Since the number of work areas taken is one, the address of the stack pointer SP stored in area 11 is address 901.

3−2)第5図■の命令を実行しくなお、CEはCom
pare  Equalを意味する)、もし、パラメー
タ1(P)と2(P)が等しいと、第6図の作業領域0
 (Q)の0ビツト目、すなわちQoに1を書き込む。
3-2) When executing the command in Figure 5 ■, CE is Com
pare Equal), if parameters 1 (P) and 2 (P) are equal, the working area 0 in Figure 6
Write 1 to the 0th bit of (Q), that is, Qo.

3−3)第5図◎の命令を実行しくなおCHはComp
are  Highを意味する)、もし、パラメータ1
 (P)が2(P)より大なら、第6図の作業領域0 
(Q)の1ビット目すなわちQ、に1を書き込む。
3-3) Execute the command ◎ in Figure 5, and CH is Comp.
are High), if parameter 1
If (P) is greater than 2(P), the working area 0 in Figure 6
Write 1 to the first bit of (Q), that is, Q.

3−4)第5図◎の命令を実行しくなおCLはComp
are  L ohを意味する)、もし、パラメータ1
(P)が2(P)より小なら、第6図の作業領域0(Q
)の2ビット目すなわちQ2に1を書き込む。
3-4) Execute the command ◎ in Figure 5. CL is Comp.
are L oh), if parameter 1
If (P) is smaller than 2(P), the working area 0(Q
), 1 is written to the second bit, ie, Q2.

3−5)第5図■の命令を実行すると、第6図の作業領
域Q (Q)の0ビ・2ト目が1なら、パラメータ3(
P)にOを書き込む。
3-5) When the command in Figure 5 ■ is executed, if the 0th bit and 2nd bit of work area Q (Q) in Figure 6 are 1, parameter 3 (
Write O in P).

3−6)第5図■の命令を実行すると、第6図の作業領
域0 (Q)の1ビット目が1なら、パラメータ3(P
)に−1を書き込む。
3-6) When the command in Figure 5 ■ is executed, if the first bit of work area 0 (Q) in Figure 6 is 1, parameter 3 (P
).

3−7)第5図■の命令を実行すると、第6図の作業領
域0 (Q)の2ビット目が1なら、パラメータ3(P
)に1を書き込む。
3-7) When the command in Figure 5 ■ is executed, if the second bit of work area 0 (Q) in Figure 6 is 1, parameter 3 (P
).

このように、FMIの呼び出し元では、パラメータ3(
P)を参照することにより、パラメータ1(P) 、 
2 (P)の大小を判断できる。
In this way, the caller of the FMI uses parameter 3 (
By referring to P), parameter 1(P),
2. Can judge the size of (P).

以上のように、制御プログラムに欠くことのできない、
ビット処理においても、この発明により設けた作業領域
は有効である。
As mentioned above, the indispensable parts of the control program
The work area provided by the present invention is also effective in bit processing.

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

以上説明したように、本発明によれば、スタック領域と
は別に、ファンクションモジュールFM(サブルーチン
パッケージ)毎に必要な数だけの作業領域を設けて演算
途中結果の一時記憶を行わせ、該FMの実行終了と共に
作業領域を解放するようにして、該FMの実行前と実行
後ではスタックポインタは動かないようにしたので、プ
ログラムの暴走は起こり得す、またPUSH,POP命
令はFM実行という目的のためには使用しないので、そ
の使用個数の管理も不要となり、プログラマのプログラ
ミング時の負担が軽減し、プログラミングが簡単化する
という利点がある。
As explained above, according to the present invention, apart from the stack area, a necessary number of work areas are provided for each function module FM (subroutine package) to temporarily store intermediate results of calculations, and the FM Since the work area is released at the end of execution and the stack pointer does not move before and after the execution of the FM, it is possible for the program to run out of control, and the PUSH and POP instructions are used for the purpose of executing the FM. Since they are not used for any purpose, there is no need to manage the number of them used, which has the advantage of reducing the burden on the programmer during programming and simplifying programming.

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

第1図は本発明の一実施例におけるプログラム(FMI
)の説明図、第2図はFMI実行時における作業領域の
処理内容説明図、第3図はこの発明の別の実施例におけ
るプログラム(FM2)説明図、第4図はFM2実行時
における作業領域の処理内容説明図、第5図は本発明の
更に他の実施例におけるプログラムの説明図、第6図は
第5図のプログラム処理時における作業領域の処理内容
の説明図、である。 符号の説明 10・・・QBR(作業領域の先頭アドレス格納領域)
、11・・・スタックポインタアドレス格納領域、12
・・・記憶領域(スタック領域、作業領域)代理人 弁
理士 並 木 昭 夫 代理人 弁理士 松 崎   清 M 2 図 1゜
FIG. 1 shows a program (FMI
), FIG. 2 is an explanatory diagram of the processing contents of the work area when FMI is executed, FIG. 3 is an explanatory diagram of the program (FM2) in another embodiment of this invention, and FIG. 4 is an explanatory diagram of the work area when FM2 is executed. FIG. 5 is an explanatory diagram of a program in yet another embodiment of the present invention, and FIG. 6 is an explanatory diagram of processing contents of the work area during the program processing of FIG. 5. Explanation of symbols 10...QBR (starting address storage area of work area)
, 11...Stack pointer address storage area, 12
...Storage area (stack area, work area) Agent Patent attorney Akio Namiki Attorney Patent attorney Kiyoshi Matsuzaki M 2 Figure 1゜

Claims (1)

【特許請求の範囲】[Claims] 1)記憶領域内にスタック領域をもつ演算装置において
、該スタック領域とは別に前記記憶領域内に設ける作業
領域の先頭アドレスを格納するポインタレジスタ(以下
、QBRレジスタと云う)を用意しておき、制御プログ
ラムにより呼び出されたサブルーチンの実行に際し、前
記スタック領域の先頭アドレスを示すスタックポインタ
のアドレスを前記作業領域の先頭アドレスとして前記Q
BRレジスタに取り込み、それと共に、演算の途中結果
などを一時記憶させるための領域として、プログラマが
プログラムにおいて指定したワード数だけ、前記QBR
レジスタに格納された先頭アドレスに続いて作業領域を
確保することにより、前記スタックポインタは該ワード
数だけそのアドレスをずらしておき、前記サブルーチン
の終了時には、前記作業領域を消滅させてスタックポイ
ンタを元のアドレスに復帰させるようにしたことを特徴
とするプログラム実行方式。
1) In an arithmetic device having a stack area in a storage area, a pointer register (hereinafter referred to as QBR register) is prepared separately from the stack area to store the start address of a work area provided in the storage area, When executing a subroutine called by a control program, the address of the stack pointer indicating the start address of the stack area is set as the start address of the work area and
The number of words specified by the programmer in the program is stored in the QBR register as an area for temporarily storing intermediate results of calculations.
By allocating a work area following the first address stored in the register, the stack pointer shifts its address by the number of words, and when the subroutine ends, the work area is erased and the stack pointer is restored to its original state. A program execution method characterized by returning to the address of .
JP23530385A 1985-10-23 1985-10-23 Program executing system Pending JPS6297038A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP23530385A JPS6297038A (en) 1985-10-23 1985-10-23 Program executing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP23530385A JPS6297038A (en) 1985-10-23 1985-10-23 Program executing system

Publications (1)

Publication Number Publication Date
JPS6297038A true JPS6297038A (en) 1987-05-06

Family

ID=16984115

Family Applications (1)

Application Number Title Priority Date Filing Date
JP23530385A Pending JPS6297038A (en) 1985-10-23 1985-10-23 Program executing system

Country Status (1)

Country Link
JP (1) JPS6297038A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5474653A (en) * 1977-11-28 1979-06-14 Toshiba Corp Stack control system
JPS5843043A (en) * 1981-09-08 1983-03-12 Oki Electric Ind Co Ltd Call instruction system for data processor
JPS59135551A (en) * 1983-01-21 1984-08-03 Matsushita Electric Ind Co Ltd Computer of high function instruction
JPS6074036A (en) * 1983-09-30 1985-04-26 Fujitsu Ltd Stack computer

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5474653A (en) * 1977-11-28 1979-06-14 Toshiba Corp Stack control system
JPS5843043A (en) * 1981-09-08 1983-03-12 Oki Electric Ind Co Ltd Call instruction system for data processor
JPS59135551A (en) * 1983-01-21 1984-08-03 Matsushita Electric Ind Co Ltd Computer of high function instruction
JPS6074036A (en) * 1983-09-30 1985-04-26 Fujitsu Ltd Stack computer

Similar Documents

Publication Publication Date Title
JPS62242243A (en) Information processor
JPS6122817B2 (en)
EP0240108A2 (en) A data processing system
JPS6297038A (en) Program executing system
JPH02103630A (en) Data processor
JPS5848144A (en) Branch instruction control system of data processor
JPS6053908B2 (en) Arithmetic method using mask register
JP2001356916A (en) Memory blocking compiler and program executing method
EP1014261A1 (en) Instruction look-ahead system and method
JPS60181837A (en) Processing system for execution instruction
JPH0713770A (en) Compiling method at the time of using additional register of load store type processor
JPS6020275A (en) Simple programming system of multiprocessor
JPS60105046A (en) Address stack control system
JPS6126692B2 (en)
JP3200277B2 (en) Sequence program processing method and apparatus
JPS6039246A (en) Sequence control circuit
JPH083792B2 (en) Function call processing method
JPS6142055A (en) Input/output control device
JPS6239779B2 (en)
JPS608943A (en) Multi-branch controlling system
JPH01205337A (en) Instruction control system
JPS59105152A (en) Collectively storing method of plural registers
JPS59225450A (en) Microprogram controller
JPS6146531A (en) Microprocessor
JPS57209502A (en) Sequence controller