JPH07110772A - Data processor - Google Patents

Data processor

Info

Publication number
JPH07110772A
JPH07110772A JP25722393A JP25722393A JPH07110772A JP H07110772 A JPH07110772 A JP H07110772A JP 25722393 A JP25722393 A JP 25722393A JP 25722393 A JP25722393 A JP 25722393A JP H07110772 A JPH07110772 A JP H07110772A
Authority
JP
Japan
Prior art keywords
register
value
pointer
registers
instruction
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
JP25722393A
Other languages
Japanese (ja)
Inventor
Shinkou Yamako
真弘 山子
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 JP25722393A priority Critical patent/JPH07110772A/en
Publication of JPH07110772A publication Critical patent/JPH07110772A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To provide a data processor capable of preserving an internal state in an interruption processing or the like without lowering an operating speed or destructing data. CONSTITUTION:The value of the number of registers to be used as general purpose registers in a register group 21 is set in the register field 24 of a PSW beforehand and the remaining registers are defined as the registers to be used for a stack area. A pointer to which the value is set as an initial value is provided and it is increased/decreased by a computing element 26. PUSH and POP are performed to the registers to be used for the stack area with the value of the pointer 25 as a register number and the system of the preservation processing of the internal state is selected by an interruption level or the kind of a specific instruction accompanying the utilization of the stack area.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】この発明は、マイクロプロセッサ
などによるデータ処理装置、特に、その割り込み処理に
よる中断時における内部状態の保存、および再開時にお
ける内部状態の回復に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a data processing device using a microprocessor or the like, and more particularly to saving an internal state at the time of interruption and recovering the internal state at the time of resumption by its interrupt processing.

【0002】[0002]

【従来の技術】図4は従来のデータ処理装置による割り
込み処理を示す説明図であり、図において、1はメイン
ルーチンであり、2は割り込み要求によって実行される
割り込み処理ルーチンである。割り込み処理ルーチン2
内において、3は内部レジスタ値を外部メモリに退避さ
せるレジスタ値保存処理部であり、4は当該割り込み処
理ルーチン2の本体である本体処理部、5は退避させた
内部レジスタ値を回復させるレジスタ値回復処理部であ
る。
2. Description of the Related Art FIG. 4 is an explanatory view showing an interrupt processing by a conventional data processing apparatus. In the figure, 1 is a main routine and 2 is an interrupt processing routine executed by an interrupt request. Interrupt processing routine 2
In the figure, 3 is a register value saving processing unit that saves the internal register value to an external memory, 4 is a main body processing unit that is the main body of the interrupt processing routine 2, and 5 is a register value that restores the saved internal register value. It is a recovery processing unit.

【0003】次に動作について説明する。外部より命令
を読み込んで逐次実行してゆくデータ処理装置において
は、ある命令列(例えば、メインルーチン1)を実行中
に優先度の高い他の処理の割り込み要求が発生すると、
データ処理装置はそのとき実行していた命令列から割り
込み要求時に実行する別の命令列(割り込み処理ルーチ
ン2)に処理を移す。この別の命令列の処理が終わる
と、もとの命令列に戻って中断していたところから処理
を継続する。このように、実行中の命令列の処理を一時
中断して全く関係のない別の命令列を実行し、その処理
が終了した後に中断していた命令列の処理を再開するた
めには、中断時におけるレジスタ値などの内部状態を保
存しておき、再開時にその内部状態を回復しなければな
らない。
Next, the operation will be described. In a data processing device that reads instructions from the outside and sequentially executes the instructions, when an interrupt request of another process having a high priority occurs while a certain instruction sequence (for example, main routine 1) is being executed,
The data processing device transfers the processing from the instruction sequence being executed at that time to another instruction sequence (interrupt processing routine 2) to be executed at the time of the interrupt request. When the processing of this other instruction sequence is completed, the process returns to the original instruction sequence and continues the process from the point where it was interrupted. In this way, in order to temporarily suspend the processing of the instruction sequence that is being executed, execute another instruction sequence that has nothing to do with it, and restart the processing of the instruction sequence that was interrupted after the processing was completed, The internal state such as the register value at the time must be saved, and the internal state must be restored when restarting.

【0004】8ビットマイクロプロセッサなどによるデ
ータ処理装置では、内部レジスタ値の保存および回復
を、PUSH(プッシュ)命令およびPOP(ポップ)
命令と呼ばれている命令を使用して行っている。即ち、
図4に示すように、メインルーチン1の実行時に割り込
み要求が発生すると割り込み処理ルーチン2に処理が移
る。割り込み処理ルーチン2ではそのレジスタ値保存処
理部3において、PUSH命令を使用して外部メモリに
内部レジスタのデータを退避させる。その後、当該割り
込み処理ルーチン2の本体処理部4の処理を実行する。
本体処理部4の処理が終了すると、レジスタ値回復処理
部5においてPOP命令を使用して、先に退避させてお
いたデータを外部メモリより読み出してもとの内部レジ
スタに戻す。このようにして、内部レジスタのデータを
復帰させた後にメインルーチン1の処理を再開させる。
In a data processing device such as an 8-bit microprocessor, the internal register value is saved and restored by a PUSH (push) instruction and a POP (pop) instruction.
This is done using instructions called instructions. That is,
As shown in FIG. 4, when an interrupt request occurs during execution of the main routine 1, the process proceeds to the interrupt processing routine 2. In the interrupt processing routine 2, the register value saving processing unit 3 uses the PUSH instruction to save the data in the internal register to the external memory. After that, the processing of the main body processing unit 4 of the interrupt processing routine 2 is executed.
When the processing of the main body processing unit 4 ends, the register value recovery processing unit 5 uses the POP instruction to return the previously saved data from the external memory to the original internal register. In this way, after the data in the internal register is restored, the processing of the main routine 1 is restarted.

【0005】ところがこのような方式では、割り込みが
発生した場合、退避する内部レジスタの数の2倍の回数
の外部メモリへのアクセスが必要となるため、処理速度
の低下は免れないものとなる。そこで、内部に補助レジ
スタ群を設け、通常のレジスタ群と補助レジスタ群との
切り換え命令を備えたデータ処理装置も提案されてい
る。
However, in such a system, when an interrupt occurs, it is necessary to access the external memory twice as many times as the number of internal registers to be saved, so that the processing speed is inevitably reduced. Therefore, there is also proposed a data processing device which is provided with an auxiliary register group therein and is provided with an instruction for switching between the normal register group and the auxiliary register group.

【0006】図5はそのような補助レジスタ群を備えた
マイクロプロセッサによるデータ処理装置を示すブロッ
ク図である。図において、11は複数の汎用レジスタよ
りなる通常のレジスタ群としての汎用レジスタ群であ
り、12は同じく複数の汎用レジスタよりなる補助レジ
スタ群としての汎用レジスタ群である。13はこの汎用
レジスタ群11、12の書き込み読み出し信号の切り換
えを行う切り換え回路であり、14はこの切り換え回路
13の切り換え信号を生成する制御部、15は汎用レジ
スタ群11、12が接続されたデータバスである。
FIG. 5 is a block diagram showing a data processing device by a microprocessor provided with such an auxiliary register group. In the figure, 11 is a general-purpose register group as a normal register group including a plurality of general-purpose registers, and 12 is a general-purpose register group as an auxiliary register group including a plurality of general-purpose registers. 13 is a switching circuit for switching the write / read signals of the general-purpose register groups 11 and 12, 14 is a control unit for generating the switching signal of the switching circuit 13, and 15 is data to which the general-purpose register groups 11 and 12 are connected. It's a bus.

【0007】次に動作について説明する。切り換え回路
13は制御部14より切り換え信号を受け取る度に読み
出し書き込み信号の出力先を、汎用レジスタ群11と汎
用レジスタ群12との間で切り換える。ここで、この切
り換え回路13は、当該マイクロプロセッサ立ち上げ時
においては汎用レジスタ群11に読み出し書き込み信号
が出力されるように設定されている。制御部14はこの
汎用レジスタ群11と12との交換命令(以下EX命令
という)が実行されると、切り換え回路13に対して切
り換え信号を出力する。
Next, the operation will be described. The switching circuit 13 switches the output destination of the read / write signal between the general-purpose register group 11 and the general-purpose register group 12 each time the switching signal is received from the control unit 14. Here, the switching circuit 13 is set so that a read / write signal is output to the general-purpose register group 11 when the microprocessor is started up. The control unit 14 outputs a switching signal to the switching circuit 13 when an exchange command (hereinafter referred to as an EX command) for exchanging the general-purpose register groups 11 and 12 is executed.

【0008】従って、割り込み処理ルーチンの開始時に
EX命令を実行すれば、それまで使用されていた汎用レ
ジスタ群、たとえば汎用レジスタ群11は読み出しも書
き込みもできなくなり、外部メモリにアクセスすること
なく内部レジスタのデータを保存することができる。ま
た、割り込み処理ルーチンの終了時に再度EX命令を実
行すれば、汎用レジスタ群11の読み出し書き込みの停
止が解除され、内部レジスタのデータを外部メモリにア
クセスすることなく復帰できる。
Therefore, if the EX instruction is executed at the start of the interrupt processing routine, the general-purpose register group used until then, for example, the general-purpose register group 11 cannot be read or written, and the internal register can be accessed without accessing the external memory. The data of can be saved. Further, if the EX instruction is executed again at the end of the interrupt processing routine, the stop of the read / write of the general-purpose register group 11 is released, and the data of the internal register can be restored without accessing the external memory.

【0009】しかしながら、割り込み処理ルーチンの本
体処理部の中でEX命令が実行されるような場合、すな
わち、割り込み処理ルーチンの最後で内部レジスタ値の
復帰を行う前にEX命令が実行されてしまった場合に
は、割り込み処理ルーチンの開始時において停止させた
汎用レジスタ群11の読み出し書き込みがその時点で可
能となるため、保存しておいたはずの内部レジスタのデ
ータが破壊されてしまう可能性が生ずる。
However, when the EX instruction is executed in the main processing unit of the interrupt processing routine, that is, the EX instruction is executed before the internal register value is restored at the end of the interrupt processing routine. In this case, since the general-purpose register group 11 stopped at the start of the interrupt processing routine can be read and written at that time, there is a possibility that the data of the internal register that should have been saved will be destroyed. .

【0010】[0010]

【発明が解決しようとする課題】従来のデータ処理装置
は以上のように構成されているので、割り込み処理等に
おいて内部状態を保持する必要が生じると、外部メモリ
に対するアクセスのために処理速度の低下を招くという
問題点があり、また、動作速度の低下を防ぐために補助
レジスタなどのハードウェアを追加した場合には、内部
状態の完全な保持が場合によっては確実に行われない可
能性があるなどの問題点があった。
Since the conventional data processing apparatus is configured as described above, if it becomes necessary to hold the internal state in interrupt processing or the like, the processing speed is lowered due to access to the external memory. In addition, if hardware such as an auxiliary register is added to prevent a decrease in operating speed, the internal state may not be completely retained in some cases. There was a problem.

【0011】この発明は上記のような問題点を解消する
ためになされたもので、割り込み処理等において必要と
なる内部状態の保持を、動作速度の低下を招くことな
く、かつ、データの破壊も起きないように行うことので
きるデータ処理装置を得ることを目的とする。
The present invention has been made in order to solve the above-mentioned problems, and retains the internal state required for interrupt processing and the like without lowering the operation speed and destroying data. It is an object of the present invention to obtain a data processing device that can be performed so as not to occur.

【0012】[0012]

【課題を解決するための手段】請求項1に記載の発明に
係るデータ処理装置は、複数のレジスタからなるレジス
タ群中のいくつのレジスタを汎用レジスタとして使用す
るかを指定する値が書き込まれるレジスタフィールドを
もった状態ワードを格納する状態レジスタ、このレジス
タフィールドに書き込まれた値が初期値としてセットさ
れ、その値が演算部によってインクリメントおよびデク
リメントされて、レジスタ群中のスタック領域として使
用されるレジスタの中の1つを指定するポインタ、およ
び汎用レジスタとして使用されている所定のレジスタの
格納データを、ポインタで指定されたレジスタに転送
し、ポインタで指定されたレジスタの格納データを、汎
用レジスタとして使用されている所定のレジスタに転送
する転送手段を備えたものである。
According to a first aspect of the present invention, there is provided a data processing device in which a value is written to specify how many registers in a register group including a plurality of registers are used as general-purpose registers. A status register that stores a status word with fields, the value written in this register field is set as an initial value, and the value is incremented and decremented by the arithmetic unit and used as a stack area in the register group. Of the specified register used as a general-purpose register and a pointer that specifies one of the pointers, and the stored data in the register specified by the pointer is used as a general-purpose register. Equipped with transfer means to transfer to the specified register used It is intended.

【0013】また、請求項2に記載の発明に係るデータ
処理装置は、状態ワードの割り込みレベルフィールドに
書き込まれた値と、外部より入力される割り込みレベル
との比較結果に応じて、転送手段を有効とするか否かを
制御する比較器を設けたものである。
The data processing device according to the second aspect of the present invention includes a transfer means according to the result of comparison between the value written in the interrupt level field of the status word and the interrupt level input from the outside. It is provided with a comparator for controlling whether or not it is valid.

【0014】また、請求項3に記載の発明に係るデータ
処理装置は、命令デコーダで特定命令の1つがデコード
された場合に、状態ワード中のスタック使用命令フィー
ルドを参照し、その値に基づいて、汎用レジスタとして
使用されている所定のレジスタの格納データと、ポイン
タで指定されたレジスタとの間のデータ転送処理を行う
か否かを制御する機能を転送手段に持たせたものであ
る。
Further, in the data processor according to the present invention as defined in claim 3, when one of the specific instructions is decoded by the instruction decoder, the stack use instruction field in the status word is referred to and based on the value thereof. The transfer means is provided with a function of controlling whether or not data transfer processing between data stored in a predetermined register used as a general-purpose register and a register designated by a pointer is performed.

【0015】[0015]

【作用】請求項1に記載の発明におけるポインタは、状
態レジスタに格納された状態ワードのレジスタフィール
ドに書き込まれた値が初期値としてセットされ、その値
が演算部によってインクリメントおよびデクリメントさ
れて、レジスタ群中のスタック領域として使用されるレ
ジスタの中の1つを指定し、転送手段は汎用レジスタと
して使用されている所定のレジスタの格納データをこの
ポインタで指定されたレジスタに転送し、このポインタ
で指定されたレジスタの格納データを汎用レジスタとし
て使用されている所定のレジスタに転送することによ
り、ポインタで指定されたレジスタをスタック領域とし
て使用して、内部状態を動作速度の低下を招くことなく
確実に保持することのできるデータ処理装置を実現す
る。
In the pointer according to the first aspect of the invention, the value written in the register field of the status word stored in the status register is set as an initial value, and the value is incremented and decremented by the operation unit to register the register. One of the registers used as a stack area in the group is designated, and the transfer means transfers the data stored in a predetermined register used as a general-purpose register to the register designated by this pointer, and by this pointer By transferring the data stored in the specified register to the specified register used as a general-purpose register, the register specified by the pointer is used as the stack area to ensure the internal state without degrading the operating speed. A data processing device that can be stored in

【0016】また、請求項2に記載の発明における比較
器は、外部より入力される割り込みレベルを状態ワード
の割り込みレベルフィールドに書き込まれた値と比較
し、その比較結果に応じて転送手段を有効とすることに
より、ポインタの指定するレジスタをスタック領域とし
て使用するか否かを決定する。
Further, the comparator in the invention described in claim 2 compares the interrupt level input from the outside with the value written in the interrupt level field of the status word, and activates the transfer means according to the comparison result. By doing so, it is determined whether or not the register designated by the pointer is used as the stack area.

【0017】また、請求項3に記載の発明における転送
手段は、特定命令の1つがデコードされたとき、状態ワ
ード中のスタック使用命令フィールドの値に基づいて、
自身の転送処理を有効とすることにより、ポインタの指
定するレジスタをスタック領域として使用するか否かを
決定する。
The transfer means in the invention described in claim 3 is based on the value of the stack use instruction field in the status word when one of the specific instructions is decoded,
By enabling its own transfer process, it is determined whether the register designated by the pointer is used as a stack area.

【0018】[0018]

【実施例】【Example】

実施例1.以下、この発明の実施例1を図について説明
する。図1は請求項1に記載した発明の一実施例を示す
ブロック図である。図において、21は複数、例えば1
6本のレジスタR1〜R16からなるレジスタ群であ
り、22はこのレジスタ群21が接続されたデータバス
である。23は内部の状態を現わす状態ワードであるプ
ロセッサステータスワード(以下PSWという)が格納
される状態レジスタであり、24は前記レジスタ群21
のレジスタR1〜R16の中の何本を汎用レジスタとし
て使用し、残りの何本をスタック領域となる特定レジス
タとして使用するかを指定するための値が書き込まれ
る、前記PSW内のレジスタフィールドである。
Example 1. Embodiment 1 of the present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing an embodiment of the invention described in claim 1. In the figure, 21 is a plurality, for example, 1
It is a register group including six registers R1 to R16, and 22 is a data bus to which the register group 21 is connected. Reference numeral 23 is a status register for storing a processor status word (hereinafter referred to as PSW) which is a status word showing an internal status, and 24 is the register group 21.
Is a register field in the PSW in which a value for designating how many of the registers R1 to R16 are used as general-purpose registers and the remaining ones to be used as a specific register serving as a stack area is written. .

【0019】25はこのレジスタフィールド24に書き
込まれた値が初期値としてセットされ、その値によって
スタック領域として使用されるレジスタの中の1つを指
示するポインタであり、26はこのポインタ25の値の
インクリメントおよびデクリメントを行う演算器であ
る。27はこのデータ処理装置としてのマイクロプロセ
ッサの全体制御を行う制御部であり、レジスタ群21中
の汎用レジスタとして使用されている所定のレジスタに
格納されているデータを、スタック領域として使用され
る特定レジスタ中の前記ポインタ25の値で指定された
ものに転送し、このポインタ25の値で指定された特定
レジスタに格納されているデータを、汎用レジスタとし
て使用されている所定のレジスタに転送する転送手段と
しての機能を備えている。
Reference numeral 25 is a pointer to which the value written in this register field 24 is set as an initial value, and which indicates one of the registers used as a stack area, and 26 is the value of this pointer 25. It is an arithmetic unit that increments and decrements. Reference numeral 27 denotes a control unit that performs overall control of the microprocessor as the data processing device, and identifies data stored in a predetermined register used as a general-purpose register in the register group 21 as a stack area. Transfer to a register specified by the value of the pointer 25 in the register, and transfer the data stored in the specific register specified by the value of the pointer 25 to a predetermined register used as a general-purpose register It has a function as a means.

【0020】また、28はスタック領域として外部に接
続したメモリを用いる場合に、PUSHしようとしたレ
ジスタの格納データを転送する外部メモリを指定するた
めの値が書き込まれるスタックポインタである。29は
このスタックポインタ28に格納された値と比較される
値を保持する比較用レジスタであり、30はこれらスタ
ックポインタ28の値と比較用レジスタ29の値とを比
較して、その比較結果を制御部27に出力する比較器で
ある。31は外部より読み込んだ命令の解読を行う命令
デコーダである。
Reference numeral 28 is a stack pointer in which a value for designating an external memory to which the data stored in the register to be PUSHed is transferred when a memory connected to the outside is used as a stack area. Reference numeral 29 is a comparison register for holding a value to be compared with the value stored in the stack pointer 28, and reference numeral 30 is for comparing the value of the stack pointer 28 with the value of the comparison register 29 to obtain the comparison result. It is a comparator that outputs to the control unit 27. An instruction decoder 31 decodes an instruction read from the outside.

【0021】次に動作について説明する。ここで、前述
のようにR1〜R16の16本のレジスタによってレジ
スタ群21が形成されている場合、PSWは4ビットの
レジスタフィールド24を持ち、ポインタ25は4ビッ
トのデータ部分と1ビットのフラグ部分による5ビット
構成となっている。ユーザはまず、レジスタ群21の1
6本のレジスタR1〜R16のうちの何本を汎用レジス
タとし、残りの何本をスタック領域として使用する特定
レジスタとするかを決める。例えば、10本を汎用レジ
スタとして使用し、残りの6本を特定レジスタとして使
用すると決定した場合、PSWのレジスタフィールド2
4には“1010”が書き込まれる。なお、この書き込
みはPSWへの書き込みを行う命令によって行う。
Next, the operation will be described. Here, when the register group 21 is formed by 16 registers R1 to R16 as described above, the PSW has a 4-bit register field 24, and the pointer 25 has a 4-bit data portion and a 1-bit flag. It has a 5-bit structure consisting of parts. The user first sets 1 of the register group 21.
It is determined how many of the six registers R1 to R16 will be general-purpose registers and the rest will be specific registers to be used as a stack area. For example, if it is decided to use 10 registers as general-purpose registers and the remaining 6 registers as specific registers, PSW register field 2
In “4”, “1010” is written. It should be noted that this writing is performed by an instruction for writing to the PSW.

【0022】命令デコーダ31は当該命令をデコードす
ると、命令コードの中に含まれている“1010”の値
を、状態レジスタ23に格納されているPSWのレジス
タフィールド24に書き込むとともにポインタ25にも
入力する。このような初期設定を行うことによって、ユ
ーザがプログラム上で使用できる汎用レジスタはレジス
タR1〜R10の10本となる。
When the instruction decoder 31 decodes the instruction, it writes the value "1010" contained in the instruction code to the register field 24 of the PSW stored in the status register 23 and also inputs it to the pointer 25. To do. By performing such initial settings, the number of general-purpose registers that can be used by the user on the program becomes 10 registers R1 to R10.

【0023】このような状態でPUSH命令が実行され
ると、制御部27はポインタ25の値を演算器26によ
って1だけインクリメントした値をレジスタ番号とする
レジスタ群21中のレジスタ、すなわちこの場合にはレ
ジスタR11に、PUSHしようとした汎用レジスタの
データを書き込む。レジスタR11への書き込みが終了
した後のポインタ25の値は、演算器26によって1だ
けインクリメントされているため“1011”となって
いる。次にPOP命令が実行されると、このポインタ2
5の値“1011”をレジスタ番号とするレジスタ、す
なわちレジスタR11のデータをPOPする汎用レジス
タに書き込む。この書き込みが終了した後、ポインタ2
5の値は演算器26によって1だけデクリメントされて
“1010”に戻る。
When the PUSH instruction is executed in such a state, the control unit 27 causes a register in the register group 21 whose register number is a value obtained by incrementing the value of the pointer 25 by 1 by the calculator 26, that is, in this case. Writes the data of the general-purpose register to be PUSH into the register R11. The value of the pointer 25 after writing to the register R11 is “1011” because it is incremented by 1 by the computing unit 26. When the POP instruction is executed next, this pointer 2
The data having the value "1011" of 5 as the register number, that is, the data of the register R11 is written to the general-purpose register for POP. After this writing is completed, pointer 2
The value of 5 is decremented by 1 by the calculator 26 and returned to "1010".

【0024】また、PUSH命令が続けて発生して、ポ
インタ25の値をインクリメントすると“1111”を
超えてしまうような場合には、ポインタ25のフラグ部
分に“1”をたててオーバーフローであることを表示す
る。制御部27はポインタ25のフラグがたっている
と、PUSHしようとした汎用レジスタのデータをスタ
ックポインタ28の値で指定される外部メモリに書き込
む。そのとき同時に、ポインタ25には“0000”を
書き込み、またこのときのスタックポインタ28の値を
比較用レジスタ29に書き込む。以後、PUSH命令は
このスタックポインタ28の値を用いて実行される。
When the PUSH instruction is successively generated and the value of the pointer 25 is incremented to exceed "1111", "1" is set in the flag portion of the pointer 25 to cause an overflow. Display that. When the flag of the pointer 25 is on, the control unit 27 writes the data of the general-purpose register to be PUSHed into the external memory designated by the value of the stack pointer 28. At the same time, "0000" is written to the pointer 25, and the value of the stack pointer 28 at this time is written to the comparison register 29. After that, the PUSH instruction is executed using the value of this stack pointer 28.

【0025】一方、この比較用レジスタ29に値が書き
込まれた後にPOP命令が実行されるときには、スタッ
クポインタ28で指示される外部メモリからPOPする
データを読み出すとともに、スタックポインタ28の値
と比較用レジスタ29の値とを比較器30で比較する。
比較の結果、両者が一致すると制御部27はポインタ2
5のフラグを“0”にクリアする。フラグがたっていな
いときにPOP命令が実行されると、制御部27は前述
したポインタ25を使用したPOPを行う。ただし、フ
ラグがクリアされた直後のポインタ25ではその値が
“0000”となっている。そのような場合にはレジス
タ群21中のレジスタR16から読み出したデータをP
OPする汎用レジスタに書き込む。書き込み終了後には
このポインタ25の値は演算器26によってデクリメン
トされて“1111”となる。
On the other hand, when the POP instruction is executed after the value is written in the comparison register 29, the POP data is read from the external memory designated by the stack pointer 28, and the value of the stack pointer 28 is compared with the data. The value in the register 29 is compared with the comparator 30.
As a result of the comparison, if the two match, the control unit 27 causes the pointer 2
The flag of 5 is cleared to "0". When the POP instruction is executed when the flag is not set, the control unit 27 performs the POP using the pointer 25 described above. However, the value of the pointer 25 immediately after the flag is cleared is "0000". In such a case, the data read from the register R16 in the register group 21 is set to P
Write to a general-purpose register to be OPed. After the writing is completed, the value of the pointer 25 is decremented by the calculator 26 to become "1111".

【0026】実施例2.次に、この発明の実施例2を図
について説明する。図2は請求項2に記載した発明の一
実施例を示すブロック図である。図において、21はレ
ジスタ群、22はデータバス、23は状態レジスタ、2
4はレジスタフィールド、25はポインタ、26は演算
器、27は転送手段としての機能を備えた制御部、28
はスタックポインタであり、図1に同一符号を付してた
ものと同一、もしくは相当部分であるため詳細な説明は
省略する。
Example 2. Next, a second embodiment of the present invention will be described with reference to the drawings. FIG. 2 is a block diagram showing an embodiment of the invention described in claim 2. In the figure, 21 is a register group, 22 is a data bus, 23 is a status register, 2
4 is a register field, 25 is a pointer, 26 is a computing unit, 27 is a control unit having a function as a transfer unit, 28
Is a stack pointer, which is the same as or equivalent to the one denoted by the same reference numeral in FIG.

【0027】また、32は状態レジスタ23に格納され
たPSWのレジスタフィールド24とは異なる位置に設
定され、前記実施例1におけるポインタ25の値に基づ
く内部状態の保存処理を行うべき割り込みレベルを指定
する値が書き込まれる割り込みレベルフィールドであ
る。33は外部より入力される割り込みレベルをこの割
り込みレベルフィールド32の値と比較して、その比較
結果に応じて制御部27の転送手段の機能の有効/無効
を制御する比較器である。
Further, 32 is set at a position different from the register field 24 of the PSW stored in the state register 23, and designates the interrupt level at which the internal state saving process based on the value of the pointer 25 in the first embodiment is performed. This is the interrupt level field to which the value to be written is written. Reference numeral 33 is a comparator which compares the interrupt level input from the outside with the value of the interrupt level field 32 and controls the validity / invalidity of the function of the transfer means of the control unit 27 according to the comparison result.

【0028】次に動作について説明する。ユーザは状態
レジスタ23に格納されたPSWのレジスタフィールド
24に実施例1の場合と同様に値を設定するとともに、
その割り込みレベルフィールド32にも値を設定する。
この割り込みレベルフィールド32に設定された値は、
割り込み処理におけるレジスタの格納データの退避時
に、ポインタ25を使用したPUSHおよびPOPを行
うか、スタックポインタ28を使用した通常のPUSH
およびPOPを行うかの選択に使用される。
Next, the operation will be described. The user sets a value in the register field 24 of the PSW stored in the status register 23 as in the case of the first embodiment, and
A value is also set in the interrupt level field 32.
The value set in this interrupt level field 32 is
At the time of saving the data stored in the register in the interrupt processing, PUSH and POP using the pointer 25 are performed, or normal PUSH using the stack pointer 28 is performed.
And used to select whether to perform POP.

【0029】外部から割り込みが要求されたとき、制御
部27はその割り込みレベルと割り込みレベルフィール
ド32に設定されている値とを比較器33にて比較す
る。比較の結果、外部から要求された割り込みの割り込
みレベルの方が割り込みレベルフィールド32に設定さ
れた値よりも小さかった場合には、その割り込み処理に
おけるPUSHおよびPOPは、実施例1で説明したポ
インタ25とレジスタ群21を用いて当該データ処理装
置の内部で行われる。一方、要求された割り込みレベル
の方が割り込みレベルフィールド32の設定値よりも大
きければ、スタックポインタ28を用いて、当該データ
処理装置に外部接続されたメモリとの間でPUSHおよ
びPOPを実行する。
When an interrupt is requested from the outside, the control unit 27 compares the interrupt level with the value set in the interrupt level field 32 by the comparator 33. As a result of the comparison, if the interrupt level of the interrupt requested from the outside is lower than the value set in the interrupt level field 32, the PUSH and POP in the interrupt processing are the pointers 25 described in the first embodiment. And the register group 21 are used inside the data processing device. On the other hand, if the requested interrupt level is higher than the set value of the interrupt level field 32, the stack pointer 28 is used to execute PUSH and POP with the memory externally connected to the data processing device.

【0030】このようにして、この実施例2によれば、
ポインタ25を用いて当該データ処理装置の内部で行う
PUSHとPOPを、ユーザの希望する優先度の割り込
み要求に対してのみ実行することが可能となる。
Thus, according to the second embodiment,
By using the pointer 25, PUSH and POP performed inside the data processing apparatus can be executed only for the interrupt request of the priority desired by the user.

【0031】実施例3.次に、この発明の実施例3を図
について説明する。図3は請求項3に記載した発明の一
実施例を示すブロック図で、相当部分には図1と同一の
符号を付してその説明を省略する。図において、34は
状態レジスタ23に格納されたPSWのレジスタフィー
ルド24とは異なる位置に設定され、スタック領域の使
用を伴う各種特定命令毎に、実施例1にて説明したポイ
ンタ25の値に基づく内部状態の保存処理を行うか否か
を指定する値が書き込まれたスタック使用命令フィール
ドである。
Example 3. Next, a third embodiment of the present invention will be described with reference to the drawings. FIG. 3 is a block diagram showing an embodiment of the invention described in claim 3. Corresponding parts are designated by the same reference numerals as those in FIG. 1 and their explanations are omitted. In the figure, 34 is set at a position different from the register field 24 of the PSW stored in the status register 23, and is based on the value of the pointer 25 described in the first embodiment for each specific instruction involving the use of the stack area. This is a stack use instruction field in which a value designating whether or not to save the internal state is written.

【0032】なお、転送手段を実現している制御部27
は、命令デコーダ31で前記特定命令のいずれかがデコ
ードされた場合に、状態レジスタ23に格納されたPS
Wのスタック使用命令フィールド34を参照し、その値
に基づいて当該転送手段の機能を有効とするか否かを決
定する点で、実施例1のそれとは異なっている。
Incidentally, the control unit 27 which realizes the transfer means.
Is the PS stored in the status register 23 when any of the specific instructions is decoded by the instruction decoder 31.
This is different from that of the first embodiment in that the stack use instruction field 34 of W is referred to and whether or not the function of the transfer means is validated is determined based on the value.

【0033】次に動作について説明する。スタック領域
へデータを書き込む命令には、前記PUSH命令やPO
P命令の他にもサブルーチンへの分岐命令など、複数種
類の命令がある。そのため、この実施例3においては、
それらスタック領域の使用を伴う各特定命令毎に1ビッ
トのフィールドをスタック使用命令フィールド34とし
てもたせ、スタック領域として外部のメモリを用いる場
合には“0”を、内部のレジスタ群21を用いる場合に
は“1”をそこに書き込んでおく。
Next, the operation will be described. The instruction to write data to the stack area includes the PUSH instruction and PO.
In addition to the P instruction, there are a plurality of types of instructions such as a branch instruction to a subroutine. Therefore, in the third embodiment,
A 1-bit field is provided as a stack use instruction field 34 for each specific instruction that involves the use of the stack area, and "0" is used when an external memory is used as the stack area, and when the internal register group 21 is used. Writes "1" there.

【0034】命令デコーダ31にてスタック領域の使用
を伴う特定命令の1つがデコードされると、スタック使
用信号と当該特定命令毎に固有の信号が制御部27に送
られる。制御部27は状態レジスタ23に格納されたP
SWのスタック使用命令フィールド34の該当するフィ
ールドを検索し、そこに設定されている値が“0”であ
れば、スタックポインタ28を使用して当該データ処理
装置の外部に接続されたメモリをスタック領域としてP
USHあるいはPOPを行う。一方、そこに設定されて
いる値が“1”であれば、ポインタ25を使用して当該
データ処理装置内部のレジスタ群21をスタック領域と
してPUSHあるいはPOPを行う。なお、このポイン
タ25を使用した動作については実施例1の場合と同様
である。
When one of the specific instructions involving the use of the stack area is decoded by the instruction decoder 31, a stack use signal and a signal unique to each specific instruction are sent to the control unit 27. The control unit 27 controls the P stored in the status register 23.
The corresponding field of the stack use instruction field 34 of SW is searched, and if the value set therein is "0", the stack pointer 28 is used to stack the memory connected to the outside of the data processing device. P as region
Perform USH or POP. On the other hand, if the value set therein is "1", PUSH or POP is performed using the pointer 25 using the register group 21 inside the data processing device as a stack area. The operation using the pointer 25 is the same as that in the first embodiment.

【0035】[0035]

【発明の効果】以上のように、請求項1に記載の発明に
よれば、PSWのレジスタフィールドの値が初期値とし
てセットされるポインタを設け、その値を演算器でイン
クリメントおよびデクリメントして、レジスタ群中のス
タック領域に使用されるレジスタ中の1つを指定するよ
うに構成したので、外部のメモリに対するアクセスが生
じず、内部状態の保存/復帰の際に動作速度の低下を招
くようにことがなくなるばかりか、通常のプログラムが
使用するレジスタの領域と、内部状態の保存のためのレ
ジスタの領域とが厳密に区別されてデータの破壊が防止
され、確実な内部状態の保存が可能となり、さらに、そ
の領域をユーザが自由に設定することが可能となって、
ハードウェアをより有効に活用できるなどの効果があ
る。
As described above, according to the first aspect of the present invention, the pointer in which the value of the register field of the PSW is set as the initial value is provided, and the value is incremented and decremented by the arithmetic unit, Since one of the registers used for the stack area in the register group is designated, access to the external memory does not occur and the operation speed is reduced when saving / restoring the internal state. Not only that, but the area of the register used by a normal program and the area of the register for saving the internal state are strictly distinguished from each other to prevent the destruction of data and enable the reliable saving of the internal state. , Furthermore, it becomes possible for the user to set the area freely,
This has the effect of making more effective use of hardware.

【0036】また、請求項2に記載の発明によれば、比
較器によって外部より入力される割り込みレベルとPS
Wの割り込みレベルフィールドの値と比較し、その比較
結果に応じて転送手段の機能を有効とするように構成し
たので、ポインタと内部のレジスタ群を用いたPUSH
およびPOPを、ユーザの希望する優先度の割り込み要
求に対してのみ行うことが可能となり、限られたハード
ウェアによって、ユーザの望む処理については確実にそ
の動作速度の低下をおさえることができる効果がある。
According to the second aspect of the invention, the interrupt level and the PS input from the outside by the comparator are
Since the function of the transfer means is compared with the value of the interrupt level field of W and the function of the transfer means is made effective according to the comparison result, the PUSH using the pointer and the internal register group is used.
Since the POP and the POP can be performed only for the interrupt request of the priority desired by the user, the limited hardware can surely suppress the decrease in the operation speed of the processing desired by the user. is there.

【0037】また、請求項3に記載の発明によれば、P
SW中のスタック使用命令フィールドの値に基づいて、
スタック領域の使用を伴う各特定命令における内部状態
の保存処理の方式を選択するように構成したので、ポイ
ンタと内部のレジスタ群を用いたPUSHおよびPOP
を、ユーザの希望する特定命令に対してのみ行うことが
可能となり、限られたハードウェアによって、ユーザの
望む処理については確実にその動作速度の低下をおさえ
ることができる効果がある。
According to the invention of claim 3, P
Based on the value of the stack use instruction field in SW,
Since it is configured to select the method of saving the internal state in each specific instruction involving the use of the stack area, PUSH and POP using the pointer and the internal register group are selected.
Can be performed only for a specific instruction desired by the user, and the limited hardware has an effect that the operation speed of the processing desired by the user can be surely suppressed.

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

【図1】この発明の実施例1によるデータ処理装置を示
すブロック図である。
FIG. 1 is a block diagram showing a data processing device according to a first embodiment of the present invention.

【図2】この発明の実施例2によるデータ処理装置を示
すブロック図である。
FIG. 2 is a block diagram showing a data processing device according to a second embodiment of the present invention.

【図3】この発明の実施例3によるデータ処理装置を示
すブロック図である。
FIG. 3 is a block diagram showing a data processing device according to a third embodiment of the present invention.

【図4】従来のデータ処理装置による割り込み処理の様
子を示す説明図である。
FIG. 4 is an explanatory diagram showing a state of interrupt processing by a conventional data processing device.

【図5】従来の補助レジスタ群を備えたデータ処理装置
を示すブロック図である。
FIG. 5 is a block diagram showing a data processing device including a conventional auxiliary register group.

【符号の説明】[Explanation of symbols]

21 レジスタ群 23 状態レジスタ 24 レジスタフィールド 25 ポインタ 26 演算器 27 制御部(転送手段) 31 命令デコーダ 32 割り込みレベルフィールド 33 比較器 34 スタック使用命令フィールド 21 register group 23 status register 24 register field 25 pointer 26 arithmetic unit 27 control unit (transfer means) 31 instruction decoder 32 interrupt level field 33 comparator 34 stack use instruction field

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 データを記憶するための複数のレジスタ
からなるレジスタ群と、前記レジスタ群のレジスタ中の
いくつを汎用レジスタとして使用し、残りのいくつを特
定レジスタとして使用するかを指定する値が書き込まれ
るレジスタフィールドをもつ状態ワードが格納される状
態レジスタと、前記レジスタフィールドに書き込まれた
値が初期値としてセットされるポインタと、前記ポイン
タの値をインクリメントおよびデクリメントするための
演算器と、前記汎用レジスタとして使用されているレジ
スタ中の所定のものに格納されているデータを、前記特
定レジスタとして使用されるレジスタ中の前記ポインタ
の値で指定されたものに転送し、前記特定レジスタとし
て使用されるレジスタ中の前記ポインタの値で指定され
たものに格納されているデータを、前記汎用レジスタと
して使用されているレジスタ中の所定のものに転送する
転送手段とを備えたデータ処理装置。
1. A register group consisting of a plurality of registers for storing data, and a value designating how many of the registers in the register group are used as general-purpose registers and the remaining number is used as a specific register. A status register in which a status word having a register field to be written is stored; a pointer to which the value written in the register field is set as an initial value; an arithmetic unit for incrementing and decrementing the value of the pointer; The data stored in a predetermined one of the registers used as the general-purpose registers is transferred to the one designated by the value of the pointer in the register used as the specific register, and is used as the specific register. Stored in the value specified by the pointer in the register And a transfer means for transferring the stored data to a predetermined one of the registers used as the general-purpose registers.
【請求項2】 前記状態レジスタに格納された状態ワー
ドが、前記ポインタの値に基づく転送処理を行う割り込
みレベルを指定する値が書き込まれた割り込みレベルフ
ィールドをもち、外部より入力される割り込みレベルを
前記割り込みレベルフィールドの値と比較し、比較結果
に応じて前記転送手段を有効とする比較器を設けたこと
を特徴とする請求項1に記載のデータ処理装置。
2. The status word stored in the status register has an interrupt level field in which a value designating an interrupt level for carrying out a transfer process based on the value of the pointer is written, and an interrupt level input from the outside is stored. The data processing apparatus according to claim 1, further comprising a comparator that compares the value of the interrupt level field and validates the transfer means according to a comparison result.
【請求項3】 前記状態レジスタに格納された状態ワー
ドが、前記ポインタの値に基づく転送処理を行うか否か
を指定する値がスタック領域の使用を伴う各特定命令毎
に書き込まれたスタック使用命令フィールドをもち、前
記転送手段が、命令デコーダで前記特定命令のいずれか
がデコードされた場合に前記スタック使用命令フィール
ドを参照し、その値に基づいて前記転送処理を行うか否
かを決定するものであることを特徴とする請求項1に記
載のデータ処理装置。
3. A stack use in which a status word stored in the status register has a value designating whether or not to perform a transfer process based on the value of the pointer, which is written for each specific instruction accompanied by use of a stack area. An instruction field is provided, and the transfer means refers to the stack use instruction field when any of the specific instructions is decoded by the instruction decoder, and determines whether to perform the transfer process based on the value. The data processing device according to claim 1, wherein the data processing device is a device.
JP25722393A 1993-10-14 1993-10-14 Data processor Pending JPH07110772A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP25722393A JPH07110772A (en) 1993-10-14 1993-10-14 Data processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP25722393A JPH07110772A (en) 1993-10-14 1993-10-14 Data processor

Publications (1)

Publication Number Publication Date
JPH07110772A true JPH07110772A (en) 1995-04-25

Family

ID=17303383

Family Applications (1)

Application Number Title Priority Date Filing Date
JP25722393A Pending JPH07110772A (en) 1993-10-14 1993-10-14 Data processor

Country Status (1)

Country Link
JP (1) JPH07110772A (en)

Similar Documents

Publication Publication Date Title
US6209085B1 (en) Method and apparatus for performing process switching in multiprocessor computer systems
KR100286416B1 (en) How to perform different data type operations not found in many operating system technologies
EP0464615B1 (en) Microcomputer equipped with DMA controller
KR20000064488A (en) Method and device for executing floating point and compressed data instructions using a single register file
JP2655615B2 (en) Information processing device
KR960035262A (en) Method and apparatus for selective control of interrupt wait in data processing system
GB2318194A (en) Power saving in asynchronous data processing apparatus
JP3970609B2 (en) Processor system
US5819078A (en) Addressing extended memory using millicode by concatenating a small millicode address and address extension data
US5671424A (en) Immediate system management interrupt source with associated reason register
JPH07110772A (en) Data processor
US20050216708A1 (en) Processor for performing context switching, a method for performing context switching, a computer program for perform context switching
JPH0414376B2 (en)
JPH056281A (en) Information processor
US5778207A (en) Assisting operating-system interrupts using application-based processing
JPS59218569A (en) Microcomputer
JP2871171B2 (en) Microcomputer
JPH05250161A (en) Microcomputer device
JPH04162135A (en) Data processor
JPS6352240A (en) Data processor
JPH0997185A (en) Device and method for information processing
JPH02173828A (en) Interruption process system
JPH0876876A (en) Clock supply control circuit of microprocessor
EP0333213B1 (en) Microcomputer producing pulses at outout ports in sequence in response to request signal
JPH03127126A (en) Information processor