JPH05250161A - Microcomputer device - Google Patents

Microcomputer device

Info

Publication number
JPH05250161A
JPH05250161A JP4922092A JP4922092A JPH05250161A JP H05250161 A JPH05250161 A JP H05250161A JP 4922092 A JP4922092 A JP 4922092A JP 4922092 A JP4922092 A JP 4922092A JP H05250161 A JPH05250161 A JP H05250161A
Authority
JP
Japan
Prior art keywords
stack
data
memory
register
dedicated
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
JP4922092A
Other languages
Japanese (ja)
Inventor
Koichi Koga
弘一 古賀
Katsuhiro Hirayama
勝啓 平山
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP4922092A priority Critical patent/JPH05250161A/en
Publication of JPH05250161A publication Critical patent/JPH05250161A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To save and load data fast between a program counter(PC) and a microcomputer state register (PSW), and a stack at the time of subroutine branching or returning operation or interruption processing branching or returning operation. CONSTITUTION:This device is equipped with a stack block 11 dedicated to the PC and PSW and a dedicated stack pointer block 3 for saving overflow data in a memory when the dedicated stack overflows. Further, a CPU control part 1 decides whether or not data need to be transferred between the stack block 11 and memory according to an internal stack status flag 13 indicating the state of the stack block 11 and an external stack status flag 12 indicating the state of the stack of the memory, and utilizes a free cycle of a bus when the data transfer is necessary to transfer the data.

Description

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

【0001】[0001]

【産業上の利用分野】本発明はプログラムカウンタや状
態レジスタの退避処理や復帰処理に必要な時間を減ら
し、プログラムの実行速度を高めたマイクロコンピュー
タ装置に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer device in which the time required for saving and restoring processing of a program counter and a status register is reduced and the program execution speed is increased.

【0002】[0002]

【従来の技術】近年、マイクロコンピュータ(以下、C
PUという)の処理速度の向上には目ざましいものがあ
るが、その一方で、処理内容もますます複雑化、大規模
化してきている。プログラムの処理スピードを決める要
因の一つに、命令実行時のメモリアクセス頻度がある。
一般に、レジスタ間の算術・論理演算、またはレジスタ
間のデータ転送と比較して、レジスタとメモリ間のデー
タ転送には時間がかかる。このため、メモリアクセスの
頻度が高いとプログラムの処理スピードも低下してく
る。特に、サブルーチン処理時あるいは割込み処理時の
プログラムカウンタ(以下、PCという)、マイクロコ
ンピュータ状態レジスタ(以下、PSWという)、そし
て汎用レジスタのスタックポインタ(以下、SPとい
う)で示されるメモリ領域への待避・復帰動作は、本来
の目的とする処理以外のオーバーヘッドである。
2. Description of the Related Art In recent years, microcomputers (hereinafter referred to as C
There is a remarkable improvement in the processing speed of (PU), but on the other hand, the processing contents are becoming more complex and larger in scale. One of the factors that determines the processing speed of a program is the memory access frequency during instruction execution.
Generally, it takes time to transfer data between a register and a memory as compared with arithmetic / logical operation between registers or data transfer between registers. Therefore, if the frequency of memory access is high, the processing speed of the program also decreases. In particular, during the subroutine processing or interrupt processing, the program counter (hereinafter referred to as PC), the microcomputer status register (hereinafter referred to as PSW), and the saving to the memory area indicated by the stack pointer (hereinafter referred to as SP) of the general-purpose register -The return operation is an overhead other than the originally intended processing.

【0003】以下、図7〜図11を参照して従来のマイ
クロコンピュータ装置について説明する。
A conventional microcomputer device will be described below with reference to FIGS.

【0004】まず、図9に、割込み要求受理時のプログ
ラムの処理の流れを示す。図9において、メインルーチ
ン実行中に割込み要求が受理されると、PCおよびPS
Wはスタックに待避され、PCには割込みルーチンの先
頭アドレスがセットされて、新しいアドレスより命令が
実行される。割込みルーチンでは、一般に先ずそのルー
チンで使用する汎用レジスタの待避命令が実行される。
その後、割込み要求に対する応答処理の実行し、次に待
避したレジスタの復帰命令の実行し、そして最後に復帰
命令が実行されて、PCおよびPSWは元の値に復帰
し、メインルーチンの実行が再開される。ここで、分岐
時のPC、PSWの待避、およびレジスタ待避命令の実
行は、割込みが受理されてから実際に応答処理に入るま
でのオーバヘッドタイムであり、特に早急な応答を必要
とする場合には、このオーバヘッドタイムが大きな問題
となる場合がある。
First, FIG. 9 shows a flow of processing of a program when an interrupt request is accepted. In FIG. 9, when an interrupt request is accepted during execution of the main routine, PC and PS
W is saved in the stack, the start address of the interrupt routine is set in the PC, and the instruction is executed from the new address. In the interrupt routine, generally, a save instruction of a general-purpose register used in the routine is executed.
After that, the response processing to the interrupt request is executed, the save instruction of the saved register is executed next, and finally the restore instruction is executed, the PC and PSW are restored to their original values, and the execution of the main routine is resumed. To be done. Here, the execution of the PC, PSW save instruction, and register save instruction at the time of branch is the overhead time from the acceptance of the interrupt until the actual response processing is started, and particularly when an immediate response is required. However, this overhead time may be a serious problem.

【0005】また、このレジスタ群の待避・復帰処理の
中で、汎用レジスタは、割込みルーチンの中で使用する
レジスタのみが割込みルーチン(あるいはサブルーチ
ン)内に書かれているレジスタ待避の機械語命令により
待避されるのに対して、PCおよびPSWは、割込み分
岐処理(あるいはサブルーチン分岐処理)のマイクロシ
ーケンスの実行過程で必ず待避される。
Further, in the save / restore processing of the register group, the general-purpose register is a register save machine language instruction in which only the register used in the interrupt routine is written in the interrupt routine (or subroutine). In contrast to being saved, the PC and PSW are always saved in the process of executing the micro sequence of the interrupt branch process (or the subroutine branch process).

【0006】以下、従来のサブルーチン分岐・復帰処理
(あるいは割込み分岐・復帰)処理実行時のPC、PS
Wのメモリへの待避・復帰動作の一例について説明す
る。
[0006] In the following, PC, PS during execution of conventional subroutine branch / return processing (or interrupt branch / return) processing
An example of the save / restore operation of W to the memory will be described.

【0007】先ず、サブルーチン分岐(あるいは割込み
分岐)処理実行時のPCおよびPSWの待避処理につい
て説明する。
First, the PC and PSW save processing at the time of executing the subroutine branch (or interrupt branch) processing will be described.

【0008】図10はサブルーチン分岐(あるいは割込
み分岐)処理実行時のマイクロ命令の実行シーケンスを
フローチャートで示したものである。図10に示す通
り、サブルーチン分岐(あるいは割込み分岐)時には、
CPU内部では、次の順序でマイクロ命令が実行され
る。すなわち、SPデクリメント命令実行、PC待避命
令実行、SPデクリメント命令実行、PSW待避命令実
行、PC更新命令実行の順である。
FIG. 10 is a flow chart showing an execution sequence of microinstructions when executing a subroutine branch (or interrupt branch) process. As shown in FIG. 10, during a subroutine branch (or interrupt branch),
Inside the CPU, micro-instructions are executed in the following order. That is, the order is SP decrement instruction execution, PC save instruction execution, SP decrement instruction execution, PSW save instruction execution, and PC update instruction execution.

【0009】図7は従来のCPUの一回路構成を示した
ブロック図である。同図中、1はCPU制御部、3は従
来のSPブロック(以下、SP2ブロックと呼ぶ。)、
4はPCブロック、5はPSWブロック、6はアドレス
バス(AB)、7はデータバス(DB)、8はCPU制
御部1からCPU内部の各ブロックにマイクロ命令を送
るマイクロ命令バス(MB)、9はメモリ読み出し制御
信号(MRE)、10はメモリ書込み制御信号(MW
E)である。また、アドレスバス6、データバス7、メ
モリ読み出し制御信号9、メモリ書込み制御信号10は
メモリ(図示せず)に接続される。
FIG. 7 is a block diagram showing a circuit configuration of a conventional CPU. In the figure, 1 is a CPU control unit, 3 is a conventional SP block (hereinafter referred to as SP2 block),
4 is a PC block, 5 is a PSW block, 6 is an address bus (AB), 7 is a data bus (DB), 8 is a microinstruction bus (MB) that sends microinstructions from the CPU control unit 1 to each block inside the CPU, 9 is a memory read control signal (MRE), 10 is a memory write control signal (MW
E). Further, the address bus 6, data bus 7, memory read control signal 9, and memory write control signal 10 are connected to a memory (not shown).

【0010】図8は図7に示したSP2ブロック3の内
部構成の一例である。図8において、図7と同じものに
は、同じ符号6、7、8を付してある。
FIG. 8 shows an example of the internal structure of the SP2 block 3 shown in FIG. 8, the same components as those in FIG. 7 are designated by the same reference numerals 6, 7, and 8.

【0011】図8において、39はマイクロ命令バス8
からの入力をデコードするデコーダ、30はポインタ値
計算用のカウンタ、また33、34、35、36は全て
デコーダ39からの出力信号であり、カウンタ30に入
力される。このうち、33はカウンタ・インクリメント
信号、34はカウンタ・デクリメント信号、35はカウ
ンタ書込み信号、36はカウンタ読み出し信号である。
In FIG. 8, 39 is the microinstruction bus 8
Is a decoder for decoding the input from the counter, 30 is a counter for calculating the pointer value, and 33, 34, 35, and 36 are all output signals from the decoder 39, which are input to the counter 30. Of these, 33 is a counter increment signal, 34 is a counter decrement signal, 35 is a counter write signal, and 36 is a counter read signal.

【0012】次に、サブルーチン分岐処理(あるいは割
込みルーチン分岐処理)実行時のCPU内部の動作につ
いて、図7および図8のブロック図を参照しながら説明
する。
Next, the internal operation of the CPU when the subroutine branch process (or the interrupt routine branch process) is executed will be described with reference to the block diagrams of FIGS. 7 and 8.

【0013】サブルーチン分岐命令がCPU制御部1に
より解読されるか、あるいはCPU制御部1に対して割
込み要求(図示せず)が入力され、受理されると、CP
Uは次に示す一連のマイクロ・シーケンスを実行する。
When a subroutine branch instruction is decoded by the CPU control unit 1 or an interrupt request (not shown) is input to the CPU control unit 1 and accepted, the CP
U executes the following series of micro-sequences.

【0014】まず、CPU制御部1はマイクロ命令バス
8に、SP2ブロック3のポインタ・デクリメント命令
を出力する。このマイクロ命令を図8のデーコーダ39
で解読し、カウンタ・デクリメント信号34を“1”と
し、スタックポインタ値がデクリメントされる。
First, the CPU controller 1 outputs the pointer decrement instruction of the SP2 block 3 to the micro instruction bus 8. This microinstruction is applied to the decoder 39 of FIG.
, The counter decrement signal 34 is set to "1", and the stack pointer value is decremented.

【0015】次に、CPU制御部1はマイクロ命令バス
8にPCのメモリ上のスタック領域への待避命令を出力
する。SP2ブロック3内のデコーダ39は、このマイ
クロ命令を解読し、カウンタ読み出し信号36を“1”
にする。カウンタ30は、この読み出し信号36が入力
されることにより、カウンタ値をアドレスバス6に出力
する。また、同時にPCブロック4はこの命令を解読
し、PCの値をデータバス7に出力する。同時にCPU
制御部1はメモリ書込み制御信号10を“1”にし、P
Cの内容はSPで示されるメモリ上のアドレスに書き込
まれる。
Next, the CPU control unit 1 outputs a saving instruction to the micro instruction bus 8 to the stack area on the memory of the PC. The decoder 39 in the SP2 block 3 decodes this micro instruction and sets the counter read signal 36 to "1".
To The counter 30 outputs the counter value to the address bus 6 when the read signal 36 is input. At the same time, the PC block 4 decodes this instruction and outputs the value of PC to the data bus 7. CPU at the same time
The control unit 1 sets the memory write control signal 10 to "1" and P
The contents of C are written to the address on the memory indicated by SP.

【0016】次に、CPU制御部1はマイクロ命令バス
8にSPのポインタ・デクリメント命令を出力する。前
記同様にSP2ブロック3内のカウンタ30の内容はデ
クリメントされる。
Next, the CPU controller 1 outputs the SP pointer decrement instruction to the micro instruction bus 8. The contents of the counter 30 in the SP2 block 3 are decremented as described above.

【0017】次に、CPU制御部1はマイクロ命令バス
8に、PSWのメモリ上のスタック領域への待避命令を
出力する。SP2ブロック3内のデコーダ39はこのマ
イクロ命令を解読し、前記と同様にカウンタ30の内容
がアドレスバス6に出力される。また、PSWブロック
5はこの命令を解読し、PSWの内容をデータバス7に
出力する。同時にCPU制御部1はメモリ書込み制御信
号10を“1”にし、PCの内容はSPで示されるアド
レスに書き込まれる。
Next, the CPU control unit 1 outputs a saving instruction to the micro instruction bus 8 to the stack area on the memory of the PSW. The decoder 39 in the SP2 block 3 decodes this microinstruction, and the contents of the counter 30 are output to the address bus 6 as described above. The PSW block 5 also decodes this instruction and outputs the contents of PSW to the data bus 7. At the same time, the CPU control unit 1 sets the memory write control signal 10 to "1", and the contents of the PC are written to the address indicated by SP.

【0018】次に、CPU制御部1は、データバス7に
分岐アドレスを、マイクロ命令バスにPC更新命令を出
力する。PCブロック4は、このマイクロ命令を解読
し、データバス7の分岐アドレスをPCに書込み、PC
の内容は更新される。以後、CPUは新しいアドレスよ
りプログラムを実行する。
Next, the CPU controller 1 outputs the branch address to the data bus 7 and the PC update instruction to the micro instruction bus. The PC block 4 decodes this micro instruction, writes the branch address of the data bus 7 to the PC, and
The content of is updated. After that, the CPU executes the program from the new address.

【0019】次に、従来のサブルーチンからの復帰時
(あるいは、割込み処理からの復帰時)のPCおよびP
SWの復帰のためのマイクロ・シーケンスの実行過程に
ついて説明する。
Next, PC and P at the time of returning from the conventional subroutine (or at the time of returning from the interrupt processing)
The execution process of the micro sequence for SW recovery will be described.

【0020】図11はサブルーチンからの復帰(あるい
は割込みからの復帰)処理実行時のマイクロ命令の実行
シーケンスをフローチャートで示したものである。図1
1に示すとうり、サブルーチンからの復帰(あるいは割
込みからの復帰)時には、CPU内部では、次の順序で
マイクロ命令が実行される。すなわち、PSW復帰命令
実行、SPインクリメント命令実行、PC復帰命令実
行、SPインクリメント命令実行の順である。
FIG. 11 is a flow chart showing the execution sequence of the microinstruction at the time of executing the return process from the subroutine (or the return process from the interrupt). Figure 1
As shown in 1, when returning from a subroutine (or returning from an interrupt), micro instructions are executed in the following order inside the CPU. That is, the order is execution of the PSW return instruction, execution of the SP increment instruction, execution of the PC return instruction, and execution of the SP increment instruction.

【0021】サブルーチンからの復帰(あるいは割込み
からの復帰)処理実行時のCPU内部の動作について、
図7および図8を参照して説明する。
Regarding the internal operation of the CPU at the time of executing the process of returning from the subroutine (or returning from the interrupt),
This will be described with reference to FIGS. 7 and 8.

【0022】サブルーチンからの復帰命令(あるいは、
割込み処理からの復帰命令)が、CPU制御部1により
解読されると、CPUは次に示す、一連のマイクロ・シ
ーケンスを実行する。
Return instruction from subroutine (or
When the return instruction from the interrupt processing) is decoded by the CPU control unit 1, the CPU executes the following series of micro sequences.

【0023】まず、CPU制御部1は、マイクロ命令バ
ス8にPSWのメモリ上のスタック領域からの復帰命令
を出力する。また、同時にメモリ読み出し制御信号9を
“1”にする。SP2ブロック3内のデコーダ39はこ
のマイクロ命令を解読し、カウンタ読み出し信号36を
“1”にする。図8のカウンタ30はこの読み出し信号
入力によりカウンタの内容をアドレスバス6に出力す
る。メモリはメモリ読み出し制御信号9が“1”となる
ためアドレスバスで示されるアドレスの内容を読み出
し、データバス7に出力する。PSWブロック5はマイ
クロ命令を解読し、この時のデータバス7の内容をPS
Wレジスタに書き込み、PSWの内容は復帰される。
First, the CPU control unit 1 outputs a return instruction from the stack area on the PSW memory to the micro instruction bus 8. At the same time, the memory read control signal 9 is set to "1". The decoder 39 in the SP2 block 3 decodes this micro instruction and sets the counter read signal 36 to "1". The counter 30 shown in FIG. 8 outputs the contents of the counter to the address bus 6 by receiving this read signal. Since the memory read control signal 9 becomes “1”, the memory reads the content of the address indicated by the address bus and outputs it to the data bus 7. The PSW block 5 decodes the microinstruction and changes the contents of the data bus 7 at this time to PS.
The W register is written and the PSW contents are restored.

【0024】次に、CPU制御部1はマイクロ命令バス
8に、SPのポインタ・インクリメント命令を出力す
る。このマイクロ命令をSP2ブロック3内のデコーダ
39で解読し、カウンタ・インクリメント信号33を
“1”にする。カウンタ30はこのカウンタ・インクリ
メント信号入力により、カウンタ値をインクリメントす
る。
Next, the CPU control unit 1 outputs the SP pointer increment instruction to the micro instruction bus 8. This microinstruction is decoded by the decoder 39 in the SP2 block 3, and the counter increment signal 33 is set to "1". The counter 30 increments the counter value by this counter increment signal input.

【0025】次に、CPU制御部1はマイクロ命令バス
8にPCのメモリ上のスタック領域からの復帰命令を出
力する。また、同時にメモリ読み出し制御信号9を
“1”にする。SP2ブロック3はこのマイクロ命令を
解読し、前記と同様SPの値をアドレスバス6に出力す
る。メモリは、メモリ読み出し制御信号9が“1”とな
るため、アドレスバス6で示されるアドレスの内容を読
み出し、データバス7に出力する。PCブロック4はマ
イクロ命令を解読し、この時のデータバス7の内容をP
Cに書き込み、PCの内容は復帰される。
Next, the CPU controller 1 outputs to the microinstruction bus 8 a return instruction from the stack area on the memory of the PC. At the same time, the memory read control signal 9 is set to "1". The SP2 block 3 decodes this microinstruction and outputs the value of SP to the address bus 6 as described above. Since the memory read control signal 9 becomes “1”, the memory reads the content of the address indicated by the address bus 6 and outputs it to the data bus 7. The PC block 4 decodes the micro instruction and sets the contents of the data bus 7 at this time to P
Write to C and restore PC contents.

【0026】次に、CPU制御部1はマイクロ命令バス
8に、SPのポインタ・インクリメント命令を出力す
る。このマイクロ命令をSP2ブロック3内のデコーダ
39で解読し、前記と同様SP2ブロック3内のカウン
タ30の内容をインクリメントする。以後、プログラム
の実行はメインルーチンに戻る。
Next, the CPU control unit 1 outputs the SP pointer increment instruction to the micro instruction bus 8. This microinstruction is decoded by the decoder 39 in the SP2 block 3, and the content of the counter 30 in the SP2 block 3 is incremented as before. After that, the execution of the program returns to the main routine.

【0027】[0027]

【発明が解決しようとする課題】上記従来のマイクロコ
ンピュータ装置は、サブルーチン分岐、または割込み処
理分岐時(あるいは各々の復帰時)に、PCおよびPS
Wの値をメモリ上のスタック領域に待避(あるいは、メ
モリ上のスタック領域から復帰)させる必要がある。こ
れらの待避処理(あるいは、復帰処理)は、レジスタと
メモリ間のデータ転送であり、一般にレジスタ間の算術
演算やレジスタ間の論理演算と比較して多くの実行サイ
クルを必要とする。
SUMMARY OF THE INVENTION The conventional microcomputer device described above has a PC and a PS at the time of a subroutine branch or an interrupt processing branch (or at the time of each return).
It is necessary to save (or restore from the stack area on the memory) the value of W to the stack area on the memory. These save processes (or restoration processes) are data transfers between registers and memories, and generally require many execution cycles as compared with arithmetic operations between registers and logical operations between registers.

【0028】またこれらの待避処理や復帰処理は、サブ
ルーチンあるいは割込みルーチンの本来の目的とする処
理以外のオーバヘッドであり、特に早急な応答を要求す
るような割込み処理時には、このオーバヘッドタイムが
大きな問題となる場合がある。
Further, the save processing and the return processing are overheads other than the original intended processing of the subroutine or the interrupt routine, and this overhead time is a serious problem particularly in the interrupt processing that requires an immediate response. May be.

【0029】本発明の目的は、このPCおよびPSWの
待避処理や復帰処理に必要な時間を減らし、プログラム
の実行スピードを上げることである。
An object of the present invention is to reduce the time required for the save processing and the recovery processing of the PC and PSW and to increase the execution speed of the program.

【0030】[0030]

【課題を解決するための手段】本発明は、上記問題を解
決するために、スタックポインタによるメモリへのレジ
スタ待避方式のマイクロコンピュータ装置において、マ
イクロコンピュータ制御装置と、プログラムカウンタ
と、マイクロコンピュータ状態レジスタと、レジスタ待
避命令実行時に汎用レジスタ内容をメモリに待避させる
ための汎用レジスタ用スタックポインタと、サブルーチ
ン分岐処理、あるいは割込み分岐処理のマイクロ・シー
ケンス内でプログラムカウンタおよびマイクロコンピュ
ータ状態レジスタの内容を待避するための専用スタック
と、さらに、専用スタックに最初に待避したデータがオ
ーバーフローした時、オーバーフローしたデータを一時
記憶するための出力バッファレジスタと、出力バッファ
レジスタにセットされたオーバーフローデータをメモリ
に待避するための専用スタックポインタと、専用スタッ
クとメモリ上のスタック領域との間でデータの転送をお
こなうかどうかを決定する手段とを備え、サブルーチン
処理時、あるいは割込み処理時のマイクロ・シーケンス
実行時に、プログラムカウンタおよびマイクロコンピュ
ータ状態レジスタの待避・復帰動作を専用スタックとの
間でおこない、かつ専用スタックとメモリ上のスタック
領域との間でデータの転送をおこなうかどうかを決定
し、データの転送が必要な時には、メモリのバスサイク
ル空き時間にデータ転送をおこなうことを可能とするも
のである。
SUMMARY OF THE INVENTION In order to solve the above problems, the present invention is directed to a microcomputer device of a register saving system to a memory by a stack pointer, a microcomputer control device, a program counter, and a microcomputer status register. And a stack pointer for a general-purpose register to save the contents of the general-purpose register to the memory when the register save instruction is executed and the contents of the program counter and the microcomputer status register in the micro sequence of the subroutine branch process or the interrupt branch process. And the output buffer register for temporarily storing the overflowed data when the first saved data overflows to the dedicated stack. It is equipped with a dedicated stack pointer for saving overflow data to the memory and a means for deciding whether or not to transfer data between the dedicated stack and the stack area on the memory, and during subroutine processing or interrupt processing. Determines whether to save / restore the program counter and microcomputer status register to / from the dedicated stack and to transfer data between the dedicated stack and the stack area on the memory when executing the micro sequence of However, when the data transfer is required, the data transfer can be performed during the idle time of the bus cycle of the memory.

【0031】また、本発明は、前記専用スタックとメモ
リ上のスタック領域との間でデータ転送をおこなうかど
うかを決定する手段は、専用スタックがオーバーフロー
し、オーバーフローしたデータが専用スタックの出力バ
ッファレジスタにセットされているときのみ“1”とな
り、出力バッファレジスタのデータがメモリ上のスタッ
ク領域に転送されたときに“0”にリセットされる内部
スタックステータスフラグと、プログラムカウンタおよ
びマイクロコンピュータ状態レジスタのメモリ上のスタ
ック領域にデータが存在するときにのみ“1”となるよ
うな外部スタックステータスフラグをプログラムカウン
タおよびマイクロコンピュータ状態レジスタの専用スタ
ックポインタ内に備え、マイクロコンピュータ制御装置
は、サブルーチン分岐あるいは割込み処理分岐のマイク
ロ・シーケンス実行後に、専用スタック内の出力バッフ
ァレジスタの内部スタックステータスフラグを調べ、内
部スタックステータスフラグが“1”の時のみ専用スタ
ックからメモリへのデータ書込みをおこない、またサブ
ルーチン復帰または割込み処理復帰のマイクロ・シーケ
ンス実行後に、プログラムカウンタおよびマイクロコン
ピュータ状態レジスタの待避用スタックポインタの外部
スタックステータスフラグを調べ、外部スタックステー
タスフラグが“1”の時のみメモリから専用スタックへ
データの転送をおこなうものである。
Further, according to the present invention, the means for deciding whether or not to transfer data between the dedicated stack and the stack area on the memory is as follows: the dedicated stack overflows, and the overflowed data is output buffer register of the dedicated stack. Is set to "1" only when it is set to "0", and is reset to "0" when the data in the output buffer register is transferred to the stack area on the memory, the program counter and the microcomputer status register. An external stack status flag that becomes "1" only when data exists in the stack area on the memory is provided in the dedicated stack pointer of the program counter and the microcomputer status register, and the microcomputer control device executes the subroutine. After executing the micro sequence of branch or interrupt processing branch, check the internal stack status flag of the output buffer register in the dedicated stack, and only when the internal stack status flag is "1", write data from the dedicated stack to the memory. After execution of the micro sequence for subroutine return or interrupt process return, check the external stack status flag of the save stack pointer of the program counter and microcomputer status register, and only when the external stack status flag is "1", data is written from the memory to the dedicated stack. Is to be transferred.

【0032】さらに、本発明は、専用スタックを双方向
にデータ移動可能な多段シフトレジスタ構成にすること
により、スタックポインタおよびプログラムカウンタの
データ復帰時には、専用スタックの初段のシフトレジス
タの内容、つまり最後に待避されたデータをスタックポ
インタおよびプログラムカウンタに転送し、スタックポ
インタおよびプログラムカウンタのデータ待避時に専用
スタックがオーバーフローした場合には、スタックの最
終段のシフトレジスタの内容、つまりスタックに最初に
待避されたデータが出力バッファレジスタを経由してメ
モリ上のスタック領域に転送するものである。
Further, according to the present invention, the dedicated stack has a multi-stage shift register configuration capable of bidirectionally moving data, so that when the data of the stack pointer and the program counter is restored, the contents of the shift register at the first stage of the dedicated stack, that is, the last The data saved in the stack pointer and the program counter are transferred to the stack pointer and the program counter.If the dedicated stack overflows when saving the data in the stack pointer and the program counter, the contents of the shift register at the final stage of the stack, that is, the data saved in the stack first is saved. Data is transferred to the stack area on the memory via the output buffer register.

【0033】[0033]

【作用】本発明によれば、PCとPSWの専用スタック
をマイクロコンピュータ装置内に備えるため、サブルー
チン分岐・復帰処理実行時(あるいは、割込みルーチン
分岐・復帰処理実行時)にメモリアクセスをする必要が
なく、高速なスタックの待避・復帰動作が可能となる。
また、サブルーチン分岐処理実行時(あるいは割込みル
ーチン分岐処理実行時)に専用スタックがオーバーフロ
ーした場合、あるいはサブルーチンからの復帰処理実行
時(あるいは割込みルーチンからの復帰処理実行時)に
メモリ上のPCとPSWの専用スタック領域にデータが
存在した場合は専用スタックとメモリ上のスタック領域
間でデータの転送処理が必要となるが、PCおよびPS
Wの待避(あるいは復帰)動作は終了しているため、以
降の分岐後のプログラム処理(あるいは、復帰後のプロ
グラム処理)と並行して該データの転送処理の実行が可
能である。また、バスの空きサイクルを利用することに
より、処理時間の増加なしに該データの転送処理が可能
となる。
According to the present invention, since the dedicated stack of PC and PSW is provided in the microcomputer device, it is necessary to access the memory at the time of executing the subroutine branch / return processing (or the interrupt routine branch / return processing). Instead, high-speed stack save / restore operations are possible.
In addition, when the dedicated stack overflows during execution of subroutine branch processing (or during execution of interrupt routine branch processing), or when execution of return processing from a subroutine (or execution of return processing from an interrupt routine), PC and PSW on the memory If the data exists in the dedicated stack area of the PC, it is necessary to transfer the data between the dedicated stack and the stack area on the memory.
Since the saving (or returning) operation of W has been completed, the transfer processing of the data can be executed in parallel with the program processing after the branch (or the program processing after returning). Further, by utilizing the idle cycle of the bus, the transfer processing of the data becomes possible without increasing the processing time.

【0034】また、本発明によれば、マイクロコンピュ
ータ制御部は、サブルーチン分岐時(あるいは割込み処
理分岐時)には、PCおよびPSWの専用スタックの内
部スタックステータスフラグを調べ、内部スタックステ
ータスフラグが“1”の時のみ専用スタックからメモリ
へデータの転送を行い、また、サブルーチンからの復帰
時(あるいは、割込み処理からの復帰時)には、PCお
よびPSWの専用スタックポインタ出力を調べ、専用ス
タックポインタ出力が“1”の時のみメモリから専用ス
タックへのデータの転送をおこなうことにより、PCお
よびPSWの専用スタックのオーバフローデータの待避
・復帰動作が可能となる。
Further, according to the present invention, the microcomputer control unit checks the internal stack status flag of the dedicated stack of the PC and PSW at the time of subroutine branch (or interrupt processing branch), and the internal stack status flag is " Data is transferred from the dedicated stack to the memory only when it is 1 ", and when returning from the subroutine (or returning from interrupt processing), the dedicated stack pointer output of the PC and PSW is checked to determine the dedicated stack pointer. By transferring the data from the memory to the dedicated stack only when the output is "1", it is possible to save / restore the overflow data of the dedicated stack of the PC and PSW.

【0035】さらに、本発明によれば、スタックポイン
タおよびプログラムカウンタのデータ復帰時には、専用
スタックの初段のシフトレジスタの内容、つまり最後に
待避されたデータをスタックポインタおよびプログラム
カウンタに転送し、スタックポインタおよびプログラム
カウンタのデータ待避時に専用スタックがオーバーフロ
ーした場合には、スタックの最終段のシフトレジスタの
内容、つまり最初に待避されたデータが、出力バッファ
レジスタを経由してメモリ上のスタック領域に転送され
るため、この点でも高速化を図ることができる。
Further, according to the present invention, when the data of the stack pointer and the program counter is restored, the contents of the shift register at the first stage of the dedicated stack, that is, the last saved data is transferred to the stack pointer and the program counter, and the stack pointer is transferred. If the dedicated stack overflows while saving the program counter data, the contents of the shift register at the final stage of the stack, that is, the first saved data is transferred to the stack area in memory via the output buffer register. Therefore, also in this respect, speeding up can be achieved.

【0036】[0036]

【実施例】以下、本発明の実施例について図面を参照し
ながら説明する。図1は本発明の一実施例のマイクロコ
ンピュータの構成を示したものである。同図において図
7と同じものには、同じ符号1、3、4、5、6、7、
8、9、10を付してある。また、SP2ブロック3の
内部構成は、図7の場合と同様に図8に示す通りであ
る。また図1において、11はPCおよびPSWの専用
スタックブロック、2はサブルーチン分岐、あるいは割
込み処理分岐時に専用スタックがオーバーフローした時
にオーバーフローデータをメモリに待避させるための専
用SPブロック(以下、SP1ブロックという)、12
はSP1ブロック2からの出力であり、SP1ブロック
2内のポインタ値で示されるメモリ上のスタック領域に
データが存在するときにのみ“1”となる外部スタック
ステータスフラグである。13はPCおよびPSWの専
用スタックブロック11からの出力であり、スタックブ
ロック11内のスタックがオーバーフローし、オーバー
フローデータが出力バッファレジスタにセットされたと
きに“1”にセットされ、出力バッファレジスタからデ
ータが読み出され、メモリ上のスタック領域に転送され
たとき“0”にリセットされる内部スタックステータス
フラグである。14はPCブロック4とスタックブロッ
ク11間のデータ転送専用バス、15はPSWブロック
5とスタックブロック11間のデータ転送専用バスであ
る。
Embodiments of the present invention will be described below with reference to the drawings. FIG. 1 shows the configuration of a microcomputer according to an embodiment of the present invention. In the figure, the same parts as those in FIG. 7 are designated by the same reference numerals 1, 3, 4, 5, 6, 7,
The numbers 8, 9, and 10 are attached. Further, the internal structure of the SP2 block 3 is as shown in FIG. 8 as in the case of FIG. In FIG. 1, 11 is a dedicated stack block for PC and PSW, 2 is a dedicated SP block for saving overflow data to the memory when the dedicated stack overflows during a subroutine branch or an interrupt processing branch (hereinafter referred to as SP1 block). , 12
Is an output from the SP1 block 2, and is an external stack status flag which becomes "1" only when data exists in the stack area on the memory indicated by the pointer value in the SP1 block 2. Reference numeral 13 is an output from the dedicated stack block 11 of the PC and PSW, which is set to "1" when the stack in the stack block 11 overflows and overflow data is set in the output buffer register, and the data from the output buffer register is output. Is an internal stack status flag that is reset to "0" when is read and transferred to the stack area on the memory. Reference numeral 14 is a dedicated data transfer bus between the PC block 4 and the stack block 11, and 15 is a dedicated data transfer bus between the PSW block 5 and the stack block 11.

【0037】図2は図1の実施例のPC・PSW用スタ
ックブロック11の一回路構成を示すブロック図であ
る。同図において、図1と同じものには同じ符号7、
8、13、14、15を付してある。
FIG. 2 is a block diagram showing a circuit configuration of the PC / PSW stack block 11 of the embodiment shown in FIG. In the figure, the same symbols as those in FIG.
8, 13, 14, and 15 are attached.

【0038】図2において、20はスタックブロック用
マイクロ命令デコーダ回路、21はPCおよびPSWの
専用スタックレジスタ回路、22はスタックレジスタ回
路21からメモリ上のスタック領域へデータを転送する
際の出力バッファレジスタ、23はスタックレジスタ回
路21のオーバーフローデータの出力バッファレジスタ
22への転送用データバス、24は転送用データバス2
3の書込み制御信号、25はスタックレジスタ回路21
からPCブロック4、PSWブロック5へのデータ復帰
制御信号、26は出力バッファレジスタ22からメモリ
へのPCおよびPSWのオーバーフローデータの書込み
制御信号、27はPCブロック4、PSWブロック5か
らスタックレジスタ回路21へのデータ待避制御信号で
ある。28はメモリ上のスタック領域からスタックレジ
スタ回路21へのデータ読み出し制御信号である。
In FIG. 2, 20 is a stack block microinstruction decoder circuit, 21 is a dedicated stack register circuit for PC and PSW, 22 is an output buffer register for transferring data from the stack register circuit 21 to a stack area on the memory. , 23 is a data bus for transferring overflow data of the stack register circuit 21 to the output buffer register 22, and 24 is a data bus for transfer 2
3 is a write control signal, 25 is a stack register circuit 21
From the PC block 4 to the PSW block 5, a data recovery control signal from the output buffer register 22 to the memory, and a write control signal of overflow data of the PSW and the PSW from the output buffer register 22 to the stack register circuit 21 from the PC block 4 and the PSW block 5. Is a data save control signal to the. 28 is a data read control signal from the stack area on the memory to the stack register circuit 21.

【0039】図3は図2のスタックレジスタ回路21の
内部構成の一例であり、双方向に移動可能なn段のシフ
トレジスタ、411〜41nから構成される。同図におい
て、図2と同じものには同じ符号、7、14、15、2
3、24、25、27、28を付してある。
FIG. 3 shows an example of the internal structure of the stack register circuit 21 of FIG. 2, which is composed of n-stage shift registers 41 1 to 41 n that can move in both directions. In the figure, the same parts as those in FIG.
3, 24, 25, 27 and 28 are attached.

【0040】図3の回路構成により、PC、PSWの待
避・復帰動作時には初段のシフトレジスタ411との間
でデータの転送を行い、PC、PSWのデータ待避時に
専用スタックがオーバーフローすると、最終段のシフト
レジスタ41nの内容が出力バッファレジスタ22への
転送用データバス23に出力され、同時に出力バッファ
レジスタ22への書込み信号24が“1”になり、最初
に待避した最終段のシフトレジスタ41nの内容が出力
バッファレジスタ22に書き込まれる。また、メモリ上
のスタック領域のデータのスタックレジスタ回路21へ
のデータ転送時には、データバス7を介してシフトレジ
スタ41nに転送される。
With the circuit configuration shown in FIG. 3, when the PC / PSW save / restore operation is performed, data is transferred to / from the first-stage shift register 41 1, and when the dedicated stack overflows when the PC / PSW data is saved, the final stage The contents of the shift register 41 n are output to the data bus 23 for transfer to the output buffer register 22, and at the same time the write signal 24 to the output buffer register 22 becomes "1", and the shift register 41 at the last stage saved first The content of n is written to the output buffer register 22. When the data in the stack area on the memory is transferred to the stack register circuit 21, the data is transferred to the shift register 41 n via the data bus 7.

【0041】図4は図1の実施例のSP1ブロック2の
一回路構成を示すブロック図である。同図において、図
1と同じものには同じ符号6、7、8、12を付してあ
る。また、図8と同じものにも同じ符号30、33、3
4、35、36を付してある。
FIG. 4 is a block diagram showing a circuit configuration of the SP1 block 2 of the embodiment shown in FIG. In the figure, the same parts as those in FIG. 1 are designated by the same reference numerals 6, 7, 8, and 12. Also, the same reference numerals 30, 33, and 3 are applied to the same components as those in FIG.
4, 35 and 36 are attached.

【0042】図4において、31はスタックポインタの
初期値記憶用レジスタ、37はカウンタ30のカウンタ
値出力信号、38は初期値記憶用レジスタ31の出力信
号である。カウンタ値出力信号37と初期値記憶用レジ
スタ31の出力信号38はコンパレータ32の入力とな
る。12はコンパレータ32の出力信号であり、前述の
カウンタ値37とレジスタ値38が不一致のとき、つま
りメモリ上のスタック領域にデータが存在するときにの
み“1”を出力する。40はSP1ブロック2のマイク
ロ命令デコーダ回路である。
In FIG. 4, 31 is a stack pointer initial value storage register, 37 is a counter value output signal of the counter 30, and 38 is an initial value storage register 31 output signal. The counter value output signal 37 and the output signal 38 of the initial value storage register 31 are input to the comparator 32. Reference numeral 12 is an output signal of the comparator 32, which outputs "1" only when the counter value 37 and the register value 38 do not match, that is, when data exists in the stack area on the memory. 40 is a microinstruction decoder circuit of SP1 block 2.

【0043】以上の構成において、サブルーチン処理時
または割込み処理時のマイクロコンピュータのPCおよ
びPSWの待避・復帰動作を、図1、図2、図3および
図4を参照しながら説明する。
With the above configuration, the saving / returning operation of the PC and PSW of the microcomputer during the subroutine processing or the interrupt processing will be described with reference to FIGS. 1, 2, 3 and 4.

【0044】まず、PCおよびPSWの待避時のマイク
ロコンピュータの動作について説明する。サブルーチン
分岐命令がCPU制御部1により解読されるか、あるい
はCPU制御部1に対して割込み要求が入力され受理さ
れると、CPU制御部1は次に示す一連のマイクロ・シ
ーケンスを実行する。
First, the operation of the microcomputer at the time of saving the PC and PSW will be described. When a subroutine branch instruction is decoded by the CPU control unit 1 or an interrupt request is input to and accepted by the CPU control unit 1, the CPU control unit 1 executes the following series of micro sequences.

【0045】まず、図1においてCPU制御部1はマイ
クロ命令バス8に、PCおよびPSWのスタックブロッ
ク11への待避命令を出力する。このマイクロ命令はP
Cブロック4およびPSWブロック5により解読され、
各々の専用バス14および15にその内容を出力する。
First, in FIG. 1, the CPU control unit 1 outputs a saving instruction to the micro instruction bus 8 to the stack block 11 of PC and PSW. This microinstruction is P
Decrypted by C block 4 and PSW block 5,
The contents are output to each dedicated bus 14 and 15.

【0046】また、図2において、デコーダ回路20に
はマイクロ命令バス8より、PCおよびPSWのデータ
待避命令が入力される。デコーダ回路20はこの命令を
解読し、スタックレジスタ回路21へのデータ待避制御
信号27を“1”にする。スタックレジスタ回路21は
データ待避制御信号27を受けて、その時点のPCデー
タ専用バス14およびPSWデータ専用バス15上のデ
ータを、図3に示すスタックレジスタ回路21内の初段
のシフトレジスタ411に書き込む。このようにして、
PCブロック4およびPSWブロック5の内容は、マイ
クロコンピュータ内部のスタックブロック11に待避さ
れる。
In FIG. 2, the decoder circuit 20 receives PC and PSW data save commands from the micro command bus 8. The decoder circuit 20 decodes this instruction and sets the data save control signal 27 to the stack register circuit 21 to "1". The stack register circuit 21 receives the data save control signal 27, and transfers the data on the PC data dedicated bus 14 and the PSW data dedicated bus 15 at that time to the first-stage shift register 41 1 in the stack register circuit 21 shown in FIG. Write. In this way
The contents of the PC block 4 and the PSW block 5 are saved in the stack block 11 inside the microcomputer.

【0047】その後、マイクロ命令バスには、PCブロ
ック4の内容の更新命令が出され、PCブロック4は、
新しいアドレス値をデータバス7から受け取り、以降、
新しいアドレスよりプログラムが実行される。
After that, an instruction to update the contents of the PC block 4 is issued to the micro instruction bus, and the PC block 4
Receive a new address value from the data bus 7,
The program will be executed from the new address.

【0048】以上のように、本実施例の回路構成では、
PCおよびPSWのスタックレジスタ回路21への待避
のためには、一つのマイクロ命令の実行だけでよい。
As described above, in the circuit configuration of this embodiment,
Only one microinstruction needs to be executed to save the PC and PSW to the stack register circuit 21.

【0049】もし、PCおよびPSWのスタックブロッ
ク11への待避のためのマイクロ命令実行によりスタッ
クレジスタ回路21がオーバーフローした場合、オーバ
ーフローデータは、出力バッファレジスタ22の書込み
信号24により、図3の最終段のシフトレジスタ411
から転送用データバス23を介して、出力バッファレジ
スタ22にセットされる。同時に、スタックブロック1
1からの内部スタックステータスフラグ13は“1”と
なる。CPU制御装置1はサブルーチン(あるいは、割
込みルーチン)への分岐後、サブルーチン(あるいは、
割込みルーチン)プログラム実行中にこの内部スタック
ステータスフラグ13を調べ、“1”の場合、出力バッ
ファレジスタ22からメモリ上のスタック領域にオーバ
ーフローデータの待避のためのマイクロ・シーケンスを
実行する。
If the stack register circuit 21 overflows due to execution of a micro instruction for saving the PC and PSW to the stack block 11, overflow data is output by the write signal 24 of the output buffer register 22 to the final stage of FIG. Shift register 41 1
Is set in the output buffer register 22 through the transfer data bus 23. At the same time, stack block 1
The internal stack status flag 13 from 1 is "1". After branching to the subroutine (or interrupt routine), the CPU control device 1 executes the subroutine (or
(Interrupt routine) During execution of the program, the internal stack status flag 13 is checked, and if it is "1", a micro sequence for saving overflow data is executed from the output buffer register 22 to the stack area on the memory.

【0050】このマイクロ・シーケンスは従来例で示し
たPCおよびPSWのメモリへの待避のマイクロ・シー
ケンスと同様であり、以下の順序で実行される。すなわ
ち、SPデクリメント命令実行、出力バッファレジスタ
のPCデータ待避命令実行、SPデクリメント命令実
行、出力バッファレジスタのPSWデータ待避命令実行
の順である。
This micro sequence is similar to the micro sequence for saving the PC and PSW to the memory shown in the conventional example, and is executed in the following order. That is, the order of execution of the SP decrement instruction, execution of the PC data saving instruction of the output buffer register, execution of the SP decrement instruction, and execution of the PSW data saving instruction of the output buffer register.

【0051】以上述べた本実施例の回路構成によるサブ
ルーチン分岐処理(あるいは、割込みルーチン分岐処
理)実行時のCPU内部の動作の流れをフローチャート
に表わしたのが図5である。図5に示すように、スタッ
クブロックの内部スタックステータスフラグ13のチェ
ック、および出力バッファレジスタ22にセットされて
いるオーバーフローデータのメモリ上のスタック領域へ
の転送処理は分岐処理完了後に実行するため、分岐ルー
チンのプログラム実行と並行して実行することが可能で
あり、また、バスの空きサイクルを利用してオーバーフ
ローデータの待避処理を実行することにより、プログラ
ムの実行時間の増加なしにオーバーフローデータの転送
処理が可能となる。
FIG. 5 is a flow chart showing the flow of the operation inside the CPU when the subroutine branch processing (or interrupt routine branch processing) is executed by the circuit configuration of the present embodiment described above. As shown in FIG. 5, the check of the internal stack status flag 13 of the stack block and the transfer processing of the overflow data set in the output buffer register 22 to the stack area on the memory are executed after the branch processing is completed. It can be executed in parallel with routine program execution, and overflow data transfer processing can be performed by utilizing the free cycle of the bus, so that overflow data transfer processing can be performed without increasing the program execution time. Is possible.

【0052】次に、PCおよびPSWの復帰時のマイク
ロコンピュータの動作について説明する。
Next, the operation of the microcomputer when the PC and PSW are restored will be described.

【0053】サブルーチン(あるいは、割込みルーチ
ン)実行中に、サブルーチンからの復帰命令(または、
割込みルーチンからの復帰命令)がCPU制御部1によ
り解読されると、CPUは次に示す動作をおこなう。
During execution of a subroutine (or interrupt routine), a return instruction (or,
When the CPU control unit 1 decodes a return instruction from the interrupt routine), the CPU performs the following operation.

【0054】まず、図1においてCPU制御部1はマイ
クロ命令バス8に、PCおよびPSWのスタックブロッ
ク11からの復帰命令を出力する。このマイクロ命令を
受けて、スタックブロック11では、図2において、デ
コーダ回路20がこの命令をデコードし、スタックレジ
スタ回路21からPC、PSWへのデータ復帰制御信号
25を“1”にする。スタックレジスタ回路21はデー
タ復帰制御信号25を受けて、スタックレジスタ回路2
1の初段のシフトレジスタ411の内容、つまりスタッ
クに最後に書き込まれたPC、PSWの待避データを、
PCデータ転送用バス14、PSWデータ転送用バス1
5に出力する。
First, in FIG. 1, the CPU control unit 1 outputs a return instruction from the stack block 11 of PC and PSW to the micro instruction bus 8. In response to this microinstruction, in the stack block 11, the decoder circuit 20 in FIG. 2 decodes this instruction and sets the data restoration control signal 25 from the stack register circuit 21 to PC and PSW to "1". Upon receiving the data restoration control signal 25, the stack register circuit 21 receives the stack register circuit 2
The contents of the shift register 41 1 at the first stage of 1 , that is, the save data of the PC and PSW last written in the stack,
PC data transfer bus 14 and PSW data transfer bus 1
Output to 5.

【0055】また、PCブロック4およびPSWブロッ
ク5はこのマイクロ命令を解読し、各々、PCデータ転
送用バス14、PSWデータ転送用バス15から待避さ
れていたデータを受け取る。このようにして、PCブロ
ック4およびPSWブロック5は復帰し、待避直前のア
ドレスからプログラムの実行が行われる。
Further, the PC block 4 and the PSW block 5 decode the micro instruction and receive the data saved from the PC data transfer bus 14 and the PSW data transfer bus 15, respectively. In this way, the PC block 4 and the PSW block 5 are restored, and the program is executed from the address immediately before the save.

【0056】以上のように、本発明の一実施例の回路構
成では、PCおよびPSWのスタックレジスタ回路21
からのデータ復帰のためには、一つのマイクロ命令の実
行だけでよい。
As described above, in the circuit configuration of the embodiment of the present invention, the stack register circuit 21 of the PC and PSW is provided.
Only one microinstruction needs to be executed to restore the data from.

【0057】もし、PCブロック4およびPSWブロッ
ク5のPCおよびPSW専用のスタックブロック11か
らの復帰処理を実行後、メモリ上のスタック領域にデー
タが存在するかどうかを示すSP1ブロック2からの外
部スタックステータスフラグ12が“1”であると、外
部スタックステータスフラグ12はCPU制御部1に接
続されており、CPU制御部1はメモリからスタックブ
ロック11内のスタックレジスタ回路21へのデータ復
帰のために、CPUは前記従来のメモリ上のスタック領
域から、PC、PSWへのデータ復帰動作と同様のマイ
クロ・シーケンスを、メモリ上のスタック領域と図2の
スタックレジスタ回路21との間でおこなう。
If the PC block 4 and PSW block 5 are restored from the PC and PSW-dedicated stack block 11, the SP1 block 2 external stack indicating whether or not data exists in the stack area on the memory When the status flag 12 is “1”, the external stack status flag 12 is connected to the CPU control unit 1, and the CPU control unit 1 returns data from the memory to the stack register circuit 21 in the stack block 11. , CPU performs a micro sequence similar to the data restoration operation from the conventional stack area on the memory to PC and PSW between the stack area on the memory and the stack register circuit 21 of FIG.

【0058】本マイクロ・シーケンスの実行手順は以下
のとうりである。すなわち、PSWデータのスタックレ
ジスタ回路への復帰命令実行、SPインクリメント命令
実行、PCデータのスタックレジスタ回路への復帰命令
実行、SPインクリメント命令実行の順である。
The execution procedure of this micro sequence is as follows. That is, the execution order of the return instruction of the PSW data to the stack register circuit, the execution of the SP increment instruction, the execution of the return instruction of the PC data to the stack register circuit, and the execution of the SP increment instruction.

【0059】以上述べた本発明の一回路構成によるサブ
ルーチンからの復帰処理(あるいは、割込みルーチンか
らの復帰処理)実行時のCPU内部の動作の流れをフロ
ーチャートに表わしたのが図6である。図6に示すよう
に、SP1ブロックの外部スタックステータスフラグ1
2のチェック、およびメモリ上のスタック領域からスタ
ックレジスタ回路21へのデータ復帰処理はメインルー
チンへの復帰処理完了後に実行するため、メインルーチ
ンのプログラム実行と並行して実行することが可能であ
り、また、バスの空きサイクルを利用してデータの転送
処理を実行することにより、プログラムの実行時間の増
加なしにメモリ上のスタック領域からスタックレジスタ
回路21へのデータ転送処理が可能となる。
FIG. 6 is a flowchart showing the flow of the internal operation of the CPU when the return processing from the subroutine (or the return processing from the interrupt routine) is executed according to the above-described circuit configuration of the present invention. As shown in FIG. 6, the external stack status flag 1 of the SP1 block
Since the check 2 and the data restoration process from the stack area on the memory to the stack register circuit 21 are executed after the restoration process to the main routine is completed, it is possible to execute the program in parallel with the main routine. Further, by executing the data transfer process by utilizing the empty cycle of the bus, the data transfer process from the stack area on the memory to the stack register circuit 21 becomes possible without increasing the program execution time.

【0060】[0060]

【発明の効果】本発明によれば、PCおよびPSWの待
避・復帰動作をメモリ上のスタック領域ではなく、マイ
クロコンピュータ装置内の専用スタックに対しておこな
うことにより、高速なレジスタ内容の待避・復帰動作が
可能となる。
According to the present invention, the save / restore operation of the PC and PSW is performed not on the stack area on the memory but on the dedicated stack in the microcomputer device, thereby saving / restoring the register contents at high speed. It becomes possible to operate.

【0061】また本発明によれば、CPU内部のスタッ
クとメモリ上のスタック領域間でデータの転送をおこな
う必要があるかどうか判定することが可能である。ま
た、CPU内部のスタックとメモリ上のスタック領域間
でデータの転送処理が発生した場合でも、バスの空きサ
イクルを利用してデータの転送処理をおこなうことによ
り、他のマイクロ処理と並行してデータ転送を実行する
ことが可能となり、データの転送処理による実行時間の
増加なしにプログラムを実行できる。
Further, according to the present invention, it is possible to judge whether or not it is necessary to transfer data between the stack inside the CPU and the stack area on the memory. Further, even when data transfer processing occurs between the stack inside the CPU and the stack area on the memory, the data transfer processing is performed by using the empty cycle of the bus, so that the data is processed in parallel with other micro processing. The transfer can be executed, and the program can be executed without increasing the execution time due to the data transfer process.

【0062】さらに、本発明によれば、サブルーチン復
帰時(あるいは、割込み復帰時)には、CPU内部のス
タックに最後に待避したデータがPCおよびPSWに転
送され、サブルーチン分岐時(あるいは、割込み分岐
時)にCPU内部のスタックがオーバーフローした場合
には、最初にCPU内部のスタックに待避したデータが
メモリ上のスタック領域に転送される。したがって、こ
の点でも高速動作が可能となる。
Further, according to the present invention, at the time of returning from the subroutine (or returning from the interrupt), the last saved data in the stack inside the CPU is transferred to the PC and PSW, and at the time of branching the subroutine (or interrupt branching). When the stack inside the CPU overflows, the data first saved in the stack inside the CPU is transferred to the stack area on the memory. Therefore, also in this respect, high speed operation becomes possible.

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

【図1】本発明のマイクロコンピュータ装置の一実施例
の回路構成を示したブロック図
FIG. 1 is a block diagram showing a circuit configuration of an embodiment of a microcomputer device of the present invention.

【図2】図1のマイクロコンピュータ装置内部のPCお
よびPSWの専用スタックブロックの一回路構成を示し
たブロック図
FIG. 2 is a block diagram showing a circuit configuration of a dedicated stack block for PC and PSW in the microcomputer device of FIG.

【図3】図2のPCおよびPSWの専用スタックブロッ
ク内部のスタックレジスタ回路の一回路構成を示したブ
ロック図
3 is a block diagram showing a circuit configuration of a stack register circuit inside a dedicated stack block of the PC and PSW of FIG.

【図4】図1のSP1ブロックの一回路構成を示すブロ
ック図
FIG. 4 is a block diagram showing a circuit configuration of the SP1 block shown in FIG.

【図5】本発明の一実施例において、サブルーチン(あ
るいは、割込みルーチン)分岐処理の実行シーケンスを
表わすフローチャート
FIG. 5 is a flowchart showing an execution sequence of a subroutine (or interrupt routine) branch process in the embodiment of the present invention.

【図6】本発明の一実施例において、サブルーチン(あ
るいは、割込みルーチン)からの復帰処理の実行シーケ
ンスを表わすフローチャート
FIG. 6 is a flowchart showing an execution sequence of return processing from a subroutine (or an interrupt routine) in the embodiment of the present invention.

【図7】従来のマイクロコンピュータ装置の回路構成を
示すブロック図
FIG. 7 is a block diagram showing a circuit configuration of a conventional microcomputer device.

【図8】従来のSP2ブロックの回路構成を示すブロッ
ク図
FIG. 8 is a block diagram showing a circuit configuration of a conventional SP2 block.

【図9】従来例における割込み処理の実行シーケンスを
表わすフローチャート
FIG. 9 is a flowchart showing an execution sequence of interrupt processing in a conventional example.

【図10】従来例におけるサブルーチン(あるいは、割
込みルーチン)分岐処理のマイクロ命令実行シーケンス
を表わすフローチャート
FIG. 10 is a flowchart showing a microinstruction execution sequence of a subroutine (or interrupt routine) branch process in a conventional example.

【図11】従来例におけるサブルーチン(あるいは、割
込みルーチン)からの復帰処理のマイクロ命令実行シー
ケンスを表わすフローチャート
FIG. 11 is a flowchart showing a microinstruction execution sequence of return processing from a subroutine (or an interrupt routine) in the conventional example.

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

1 CPU制御部 2 PCおよびPSWの専用スタックポインタ・ブロッ
ク(SP1) 3 スタックポインタ・ブロック(SP2) 4 プログラムカウンタ・ブロック(PCブロック) 5 マイクロコンピュータ状態レジスタ・ブロック(P
SWブロック) 6 アドレスバス(AB) 7 データバス(DB) 8 マイクロ命令バス(MB) 9 メモリ読み出し制御信号(MRE) 10 メモリ書込み制御信号(MWE) 11 PCおよびPSWの専用スタックブロック 12 外部スタックステータスフラグ 13 内部スタックステータスフラグ 14 PCデータ転送専用バス 15 PSWデータ転送専用バス 20 スタックブロック用マイクロ命令デコーダ回路 21 PCおよびPSWの専用スタックレジスタ回路 22 出力バッファレジスタ 23 PCおよびPSW用の専用スタックレジスタ回路
から出力バッファレジスタへのデータ転送用バス 24 バス23のデータ転送制御信号 25 スタックレジスタ回路からPCおよびPSWへの
データ復帰制御信号 26 出力バッファレジスタからメモリへのPCおよび
PSWのオーバーフローデータの書込み制御信号 27 PC、PSWからスタックレジスタ回路へのデー
タ待避制御信号 28 メモリからスタックレジスタ回路へのデータ読み
出し制御信号 30 スタックポインタ値計算用のカウンタ 31 スタックポインタの初期値記憶用レジスタ 32 スタックポインタ値と初期値比較用のコンパレー
タ 33 カウンタ・インクリメント信号 34 カウンタ・デクリメント信号 35 カウンタ書込み信号 36 カウンタ読み出し信号 37 カウンタ値出力信号 38 カウンタ初期値出力信号 39 SP2ブロックのマイクロ命令デコーダ回路 40 SP1ブロックのマイクロ命令デコーダ回路 411 スタックレジスタの初段のシフトレジスタ 41n スタックレジスタの最終段のシフトレジスタ
1 CPU control unit 2 PC and PSW dedicated stack pointer block
(SP1) 3 Stack pointer block (SP2) 4 Program counter block (PC block) 5 Microcomputer status register block (P
SW block) 6 Address bus (AB) 7 Data bus (DB) 8 Micro instruction bus (MB) 9 Memory read control signal (MRE) 10 Memory write control signal (MWE) 11 Special stack block for PC and PSW 12 External stack status Flag 13 Internal stack status flag 14 PC dedicated data transfer bus 15 PSW dedicated data transfer bus 20 Stack block microinstruction decoder circuit 21 PC and PSW dedicated stack register circuit 22 Output buffer register 23 PC and PSW dedicated stack register circuit
For transferring data from the output buffer register to the buffer 24 Data transfer control signal on the bus 23 25 From the stack register circuit to the PC and PSW
Data recovery control signal 26 PC from output buffer register to memory and
Write control signal for overflow data of PSW 27 PC, data from PSW to stack register circuit
Data save control signal 28 Read data from memory to stack register circuit
Output control signal 30 Counter for calculating stack pointer value 31 Register for storing initial value of stack pointer 32 Comparator for comparing stack pointer value and initial value
33 counter increment signal 34 counter decrement signal 35 counter write signal 36 counter read signal 37 counter value output signal 38 counter initial value output signal 39 micro instruction decoder circuit of SP2 block 40 micro instruction decoder circuit of SP1 block 41 1 First stage shift register of stack register 41 n Shift register at the final stage of the stack register

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】スタックポインタによるメモリへのレジス
タ待避方式のマイクロコンピュータ装置において、マイ
クロコンピュータ制御装置と、プログラムカウンタと、
マイクロコンピュータ状態レジスタと、レジスタ待避命
令実行時に汎用レジスタ内容をメモリに待避させるため
の汎用レジスタ用スタックポインタと、サブルーチン分
岐処理あるいは割込み分岐処理のマイクロ・シーケンス
内で前記プログラムカウンタおよびマイクロコンピュー
タ状態レジスタの内容を待避するための専用スタック
と、前記専用スタックに最初に待避したデータがオーバ
ーフローした時、オーバーフローしたデータを一時記憶
するための出力バッファレジスタと、前記出力バッファ
レジスタにセットされたデータをメモリに待避するため
の専用スタックポインタと、前記専用スタックとメモリ
上のスタック領域との間でデータの転送をおこなうかど
うかを決定する手段とを備え、サブルーチン処理時ある
いは割込み処理時のマイクロ・シーケンス実行時に、前
記プログラムカウンタおよびマイクロコンピュータ状態
レジスタの待避・復帰動作を、前記専用スタックとの間
でおこない、かつ前記専用スタックとメモリ上のスタッ
ク領域との間でデータの転送をおこなうかどうかを決定
し、データの転送が必要な時にはメモリのバスサイクル
空き時間にデータ転送をおこなうことを特徴とするマイ
クロコンピュータ装置。
1. A microcomputer device of a system of saving registers to a memory by a stack pointer, a microcomputer controller, a program counter,
A microcomputer status register, a stack pointer for a general-purpose register for saving the contents of a general-purpose register in a memory when a register save instruction is executed, and a program counter and a microcomputer status register for the program counter and the microcomputer status register in a micro-sequence of subroutine branch processing or interrupt branch processing. A dedicated stack for saving the contents, an output buffer register for temporarily storing the overflowed data when the first saved data in the dedicated stack overflows, and the data set in the output buffer register in the memory. A dedicated stack pointer for saving and means for deciding whether or not to transfer data between the dedicated stack and the stack area on the memory are provided, and when the subroutine processing or the interrupt processing is performed, Whether to save / restore the program counter and the microcomputer status register to / from the dedicated stack and to transfer data between the dedicated stack and the stack area on the memory at the time of executing the black sequence. A microcomputer device characterized by deciding whether or not to transfer data, and when data transfer is necessary, the data transfer is performed during the free time of the memory bus cycle.
【請求項2】専用スタックとメモリ上のスタック領域と
の間でデータ転送をおこなうかどうかを決定する手段
は、前記専用スタックがオーバーフローし、オーバーフ
ローしたデータが前記専用スタックの出力バッファレジ
スタにセットされているときのみ“1”となり、出力バ
ッファレジスタのデータがメモリ上のスタック領域に転
送されたときに“0”にリセットされる内部スタックス
テータスフラグと、プログラムカウンタおよびマイクロ
コンピュータ状態レジスタのメモリ上のスタック領域に
データが存在するときにのみ“1”となる外部スタック
ステータスフラグを備え、マイクロコンピュータ制御装
置によって、サブルーチン分岐あるいは割込み処理分岐
のマイクロ・シーケンス実行後に、前記内部スタックス
テータスフラグを調べ、内部スタックステータスフラグ
が“1”の時のみ前記専用スタックの出力バッファレジ
スタからメモリへのデータ転送をおこない、またサブル
ーチン復帰または割込み処理復帰のマイクロ・シーケン
ス実行後に、前記外部スタックステータスフラグを調
べ、外部スタックステータスフラグが“1”の時のみメ
モリから前記専用スタックへデータの転送をおこなうこ
とを特徴とする請求項1記載のマイクロコンピュータ装
置。
2. A means for determining whether or not to perform data transfer between a dedicated stack and a stack area on a memory, wherein the dedicated stack overflows and the overflowed data is set in an output buffer register of the dedicated stack. Is set to "1" only when the output buffer register is transferred to the stack area on the memory, and is reset to "0" on the internal stack status flag and the program counter and microcomputer status register on the memory. An external stack status flag is set to "1" only when data exists in the stack area, and the internal stack status flag is adjusted by the microcomputer controller after the execution of a micro sequence of a subroutine branch or an interrupt processing branch. , The data is transferred from the output buffer register of the dedicated stack to the memory only when the internal stack status flag is "1", and the external stack status flag is checked after the execution of the micro sequence of the subroutine return or the interrupt process return, 2. The microcomputer device according to claim 1, wherein data is transferred from the memory to the dedicated stack only when the external stack status flag is "1".
【請求項3】専用スタックを双方向にデータ移動可能な
多段シフトレジスタで構成し、スタックポインタおよび
プログラムカウンタのデータ復帰時には、初段のシフト
レジスタの内容をスタックポインタおよびプログラムカ
ウンタに転送し、前記スタックポインタおよびプログラ
ムカウンタのデータ待避時に前記専用スタックがオーバ
ーフローした場合には、最終段のシフトレジスタの内容
を前記専用スタックの出力バッファレジスタに一時的に
記憶し、出力バッファレジスタを経由してメモリに転送
することを特徴とする請求項1記載のマイクロコンピュ
ータ装置。
3. A dedicated stack is composed of a multi-stage shift register capable of bidirectionally moving data, and when the data of the stack pointer and the program counter is restored, the contents of the shift register of the first stage are transferred to the stack pointer and the program counter, and the stack. If the dedicated stack overflows when the pointer and program counter data are saved, the contents of the shift register at the final stage are temporarily stored in the output buffer register of the dedicated stack and transferred to the memory via the output buffer register. The microcomputer device according to claim 1, wherein the microcomputer device comprises:
JP4922092A 1992-03-06 1992-03-06 Microcomputer device Pending JPH05250161A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4922092A JPH05250161A (en) 1992-03-06 1992-03-06 Microcomputer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4922092A JPH05250161A (en) 1992-03-06 1992-03-06 Microcomputer device

Publications (1)

Publication Number Publication Date
JPH05250161A true JPH05250161A (en) 1993-09-28

Family

ID=12824865

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4922092A Pending JPH05250161A (en) 1992-03-06 1992-03-06 Microcomputer device

Country Status (1)

Country Link
JP (1) JPH05250161A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0720087A1 (en) * 1994-12-27 1996-07-03 Motorola, Inc. Apparatus and method for a memory extension stack in a data processing system
KR100895686B1 (en) * 2002-03-26 2009-04-30 어보브반도체 주식회사 Method for reducing load timming in Micro controller

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS52133738A (en) * 1976-04-30 1977-11-09 Sharp Corp Caluculation control system
JPS5688541A (en) * 1979-12-21 1981-07-18 Fujitsu Ltd Stack control system
JPH02299025A (en) * 1989-05-12 1990-12-11 Nec Corp Microcomputer

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS52133738A (en) * 1976-04-30 1977-11-09 Sharp Corp Caluculation control system
JPS5688541A (en) * 1979-12-21 1981-07-18 Fujitsu Ltd Stack control system
JPH02299025A (en) * 1989-05-12 1990-12-11 Nec Corp Microcomputer

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0720087A1 (en) * 1994-12-27 1996-07-03 Motorola, Inc. Apparatus and method for a memory extension stack in a data processing system
KR100895686B1 (en) * 2002-03-26 2009-04-30 어보브반도체 주식회사 Method for reducing load timming in Micro controller

Similar Documents

Publication Publication Date Title
US5168571A (en) System for aligning bytes of variable multi-bytes length operand based on alu byte length and a number of unprocessed byte data
JP3176093B2 (en) Microprocessor interrupt controller
US4274138A (en) Stored program control system with switching between instruction word systems
JP3707581B2 (en) Data processing system having self-aligned stack pointer and method thereof
JP2655615B2 (en) Information processing device
JPH0348537B2 (en)
US5003468A (en) Guest machine execution control system for virutal machine system
EP0385136B1 (en) Microprocessor cooperating with a coprocessor
JPH05250161A (en) Microcomputer device
US4758978A (en) Method and apparatus for selectively evaluating an effective address for a coprocessor
JPH0414376B2 (en)
JPS6376028A (en) Method for controlling execution of instruction step in virtual computer system
US20050216708A1 (en) Processor for performing context switching, a method for performing context switching, a computer program for perform context switching
JPH0377137A (en) Information processor
US5557772A (en) Data processing apparatus including a register storing a parameter and a microinstruction execution arrangement including a correction arrangement for causing a first value of the parameter to be change to a second, correct value
JPH02191042A (en) Interruption control system
JP2574918B2 (en) Interrupt return processing method
JPH03269628A (en) Exception processing system
KR950004227B1 (en) Information processing system
JP2583614B2 (en) Vector arithmetic unit
JP3239042B2 (en) Microcomputer
JP2934060B2 (en) Exception handling method and exception handling device
JP2591211B2 (en) High-speed interrupt processing device
JPS63155330A (en) Microprogram controller
JPH04162135A (en) Data processor