JPH05120002A - Return address stack control circuit - Google Patents

Return address stack control circuit

Info

Publication number
JPH05120002A
JPH05120002A JP3282855A JP28285591A JPH05120002A JP H05120002 A JPH05120002 A JP H05120002A JP 3282855 A JP3282855 A JP 3282855A JP 28285591 A JP28285591 A JP 28285591A JP H05120002 A JPH05120002 A JP H05120002A
Authority
JP
Japan
Prior art keywords
stack
instruction
return
stored
storage means
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
JP3282855A
Other languages
Japanese (ja)
Inventor
Morio Takeishi
守雄 竹石
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.)
NEC Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP3282855A priority Critical patent/JPH05120002A/en
Publication of JPH05120002A publication Critical patent/JPH05120002A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/12Improving ICE efficiencies

Landscapes

  • Executing Machine-Instructions (AREA)

Abstract

PURPOSE:To renounce an unnecessary stack without giving a burden on a micro program. CONSTITUTION:A pointer value which a stack pointer 17 holds is stored in a stack pointer storage part 12 at the time of executing a special sub-routine call instruction. At the time of executing a special return instruction, the pointer value which the stack pointer storage part 12 stores is written into the stack pointer 17, and the value of the return address of a sub-routine, which a stack memory 15 stores, is written into a program counter 16. Thus, some levels in the stacks of the return addresses of the micro program can be renounced with one instruction.

Description

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

【0001】[0001]

【産業上の利用分野】本発明はマイクロプロセッサのス
タック管理のためのリターンアドレススタック制御回路
に係わり、特に、不要なスタックを捨てる処理を工夫し
たリターンアドレススタック制御回路に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a return address stack control circuit for managing a stack of a microprocessor, and more particularly to a return address stack control circuit devised to discard unnecessary stacks.

【0002】[0002]

【従来の技術】従来、マイクロプロセッサのスタック管
理には、スタック用の専用の記憶手段を持ちハードウェ
アで管理を行う方式と、このような専用の記憶手段を持
たずにマイクロプログラムからアクセス可能なメモリ上
にスタック用のエリアを設定し、マイクロプログラムが
この管理を行う方式とが存在した。
2. Description of the Related Art Conventionally, for stack management of a microprocessor, there is a system in which a dedicated storage means for stack is used and the management is performed by hardware, and a microprocessor is accessible without such a dedicated storage means. There was a method in which an area for stacking was set on the memory and the microprogram managed this.

【0003】このうちの、ハードウェアでスタック管理
を行う方式では、マイクロプログラムからスタックメモ
リの先頭を示すレジスタとしてのスタックポインタの制
御を行うことができず、常にスタックメモリの先頭のみ
が制御の対象とされていた。
In the stack management method using hardware, the stack pointer as a register indicating the top of the stack memory cannot be controlled from the microprogram, and only the top of the stack memory is always controlled. Was said.

【0004】[0004]

【発明が解決しようとする課題】このようにハードウェ
アでスタック管理を行っているマイクロプロセッサで
は、スタックメモリの先頭のみが制御の対象とされてい
た。このため、何段かのスタックを捨てて一気に大もと
のルーチンへ戻ろうとすると、マイクロプログラムによ
るスタックを捨てるための処理が必要とされた。この結
果として、マイクロプログラムの処理効率が低下すると
いう問題と、この処理に間違いがあった場合にはその後
の動作が保証できないという問題があった。
In the microprocessor in which stack management is performed by hardware as described above, only the top of the stack memory is subject to control. For this reason, when attempting to discard several stacks and return to the original routine at once, a process for discarding the stack by the microprogram was required. As a result, there are problems that the processing efficiency of the microprogram is lowered and that if the processing is erroneous, the subsequent operation cannot be guaranteed.

【0005】そこで本発明の目的は、マイクロプログラ
ムに負担をかけずに不要なスタックを捨てることができ
るようにしたリターンアドレススタック制御回路を提供
することにある。
SUMMARY OF THE INVENTION An object of the present invention is to provide a return address stack control circuit that can discard unnecessary stacks without burdening the microprogram.

【0006】[0006]

【課題を解決するための手段】請求項1記載の発明で
は、専用の記憶手段として用意されたスタックメモリ
と、このスタックメモリにおけるマイクロプログラムの
戻りアドレスが格納されている位置を記憶する位置記憶
手段と、この位置記憶手段によって記憶された位置をマ
イクロプログラムの制御可能なスタックメモリの先頭と
擬制するスタック先頭擬制手段とをリターンアドレスス
タック制御回路に具備させる。
According to a first aspect of the present invention, a stack memory prepared as dedicated storage means and a position storage means for storing a position where a return address of a microprogram is stored in the stack memory. Further, the return address stack control circuit is provided with a stack head quasi-means for simulating the position stored by the position storage means as the head of the stack memory that can be controlled by the microprogram.

【0007】すなわち請求項1記載の発明では、位置記
憶手段によって記憶されたスタックの位置をスタックの
先頭と擬制して処理することで、前記した目的を達成す
る。
That is, according to the first aspect of the present invention, the above-mentioned object is achieved by simulating the position of the stack stored by the position storage means as the top of the stack and processing.

【0008】請求項2記載の発明では、専用の記憶手段
として用意されたスタックメモリと、特殊なサブルーチ
ンコール命令実行時にこのスタックメモリにおける戻り
アドレスが格納された位置を記憶する位置記憶手段と、
特殊なサブルーチンからのリターン命令実行時にこの位
置記憶手段によって記憶されているスタックメモリの位
置をスタックの先頭と擬制してリターン処理するリター
ン処理手段とをリターンアドレススタック制御回路に具
備させる。
According to the second aspect of the present invention, a stack memory prepared as a dedicated storage means, a position storage means for storing a position where a return address is stored in the stack memory when a special subroutine call instruction is executed,
The return address stack control circuit is provided with return processing means for simulating the position of the stack memory stored by the position storage means as the top of the stack when the return instruction from the special subroutine is executed.

【0009】すなわち請求項2記載の発明では、特殊な
サブルーチンコール命令実行時に戻りアドレスが格納さ
れたスタックの位置を位置記憶手段に記憶しておき、特
殊なサブルーチンからのリターン命令実行時にこの位置
をスタックの先頭と擬制してリターン処理することで、
前記した目的を達成する。
That is, according to the second aspect of the invention, the position of the stack in which the return address is stored at the time of executing the special subroutine call instruction is stored in the position storing means, and this position is stored at the time of executing the return instruction from the special subroutine. By assuming that it is the top of the stack and processing the return,
The above-mentioned object is achieved.

【0010】請求項3記載の発明では、専用の記憶手段
として用意されたスタックメモリと、特殊なサブルーチ
ンコール命令実行時にこの位置記憶手段によって記憶さ
れている戻りアドレスが格納されたスタックメモリの位
置を記憶する位置記憶手段と、特殊なサブルーチンから
のリターン命令実行時にこの位置記憶手段によって記憶
されているスタックの位置をスタックメモリの先頭と擬
制してリターン処理するリターン処理手段と、特殊なス
タック制御命令の実行時にスタックメモリの位置を位置
記憶手段に記憶する記憶制御手段と、別の特殊なスタッ
ク制御命令の実行時にこの記憶されている位置にスタッ
クメモリの先頭を移動させるスタックメモリ先頭移動手
段とをリターンアドレススタック制御回路に具備させ
る。
According to the third aspect of the present invention, the stack memory prepared as a dedicated storage means and the position of the stack memory where the return address stored by this position storage means at the time of execution of the special subroutine call instruction are stored. Position storing means for storing, return processing means for simulating the position of the stack stored by the position storing means as the head of the stack memory when the return instruction from the special subroutine is executed, and return processing, and a special stack control instruction Storage control means for storing the position of the stack memory in the position storage means during execution of, and stack memory head moving means for moving the head of the stack memory to this stored position when executing another special stack control instruction. It is provided in the return address stack control circuit.

【0011】すなわち請求項3記載の発明では、特殊な
サブルーチンコール命令実行時に戻りアドレスが格納さ
れたスタックの位置を位置記憶手段に記憶しておき、特
殊なサブルーチンからのリターン命令実行時にこの位置
をスタックの先頭と擬制してリターン処理する一方、特
殊なスタック制御命令の実行時にスタックの位置を位置
記憶手段に記憶しておいてこの記憶されている位置にス
タックの先頭を移動させるように制御することで、前記
した目的を達成する。
That is, according to the third aspect of the invention, the position of the stack in which the return address is stored at the time of executing the special subroutine call instruction is stored in the position storage means, and this position is stored at the time of executing the return instruction from the special subroutine. While simulating the top of the stack and performing return processing, the position of the stack is stored in the position storage means when a special stack control instruction is executed, and the top of the stack is moved to this stored position. By doing so, the above-mentioned object is achieved.

【0012】[0012]

【実施例】以下実施例につき本発明を詳細に説明する。EXAMPLES The present invention will be described in detail below with reference to examples.

【0013】図1は、本発明の一実施例におけるリター
ンアドレススタック制御回路の構成を表わしたものであ
る。この回路は、マイクロ命令を解読する命令デコード
部11を備えている。命令デコード部11によってデコ
ードされた命令のタイプは、スタックポインタ記憶部1
2と、スタックポインタ制御部13と、スタックメモリ
15およびプログラムカウンタ16にそれぞれ指示され
るようになっている。スタックポインタ制御部13は、
この指示によってスタックポインタ17のインクリメン
トまたはデクリメントの制御と、スタックポインタ記憶
部12が記憶しているスタックポインタの値の書き込み
の制御を行うようになっている。スタックポインタ17
は、スタックメモリ15のポインタを保持し、スタック
ポインタ制御部13のの指示によってポインタの更新を
行い、スタックメモリ15に対してポインタの指示を行
う。スタックメモリ15は、プログラムカウンタ16の
内容を後入れ先出しで記憶する専用のメモリである。プ
ログラムカウンタ16は、マイクロプログラムの実行ア
ドレスを保持するカウンタである。
FIG. 1 shows a configuration of a return address stack control circuit according to an embodiment of the present invention. This circuit includes an instruction decoding unit 11 that decodes microinstructions. The type of the instruction decoded by the instruction decoding unit 11 is the stack pointer storage unit 1
2, the stack pointer controller 13, the stack memory 15 and the program counter 16, respectively. The stack pointer control unit 13
By this instruction, the stack pointer 17 is controlled to be incremented or decremented, and the stack pointer value stored in the stack pointer storage unit 12 is controlled to be written. Stack pointer 17
Holds the pointer of the stack memory 15, updates the pointer according to the instruction of the stack pointer control unit 13, and instructs the stack memory 15 of the pointer. The stack memory 15 is a dedicated memory for storing the contents of the program counter 16 last in, first out. The program counter 16 is a counter that holds the execution address of the microprogram.

【0014】まず、通常のスタック制御が行われる場合
について説明する。
First, the case where normal stack control is performed will be described.

【0015】通常のサブルーチンコール命令の実行時に
は、命令のデコードを行った命令デコード部11がサブ
ルーチンコール命令であることをスタックメモリ15に
指示する。指示を受けたスタックメモリ15は、サブル
ーチンの戻りアドレスであるプログラムカウンタ16の
内容を記憶する。次に、命令デコード部11はスタック
ポインタ制御部13とプログラムカウンタ16に対し
て、サブルーチンコール命令であることを指示する。プ
ログラムカウンタ16は、これを基にしてサブルーチン
のアドレスをセットする。スタックポインタ制御部13
は、スタックポインタ17の更新を行い、サブルーチン
コール命令の実行が終了する。
When a normal subroutine call instruction is executed, the instruction decoding unit 11 that has decoded the instruction instructs the stack memory 15 that the instruction is a subroutine call instruction. Upon receipt of the instruction, the stack memory 15 stores the contents of the program counter 16 which is the return address of the subroutine. Next, the instruction decoding unit 11 instructs the stack pointer control unit 13 and the program counter 16 that it is a subroutine call instruction. The program counter 16 sets the address of the subroutine based on this. Stack pointer control unit 13
Updates the stack pointer 17 and ends the execution of the subroutine call instruction.

【0016】通常のリターン命令実行時には、命令をデ
コードした命令デコード部11はリターン命令であるこ
とをスタックポインタ制御部13に指示する。スタック
ポインタ制御部13はスタックポインタ17の更新を行
う。次に命令デコード部11はプログラムカウンタ16
に対してリターン命令であることを指示し、スタックポ
インタ17にポイントされるスタックメモリ15が記憶
しているサブルーチンの戻りアドレス値をプログラムカ
ウンタ16に書き込む。このようにしてリターン命令の
実行が終了する。
When a normal return instruction is executed, the instruction decoding unit 11 which has decoded the instruction instructs the stack pointer control unit 13 that the instruction is a return instruction. The stack pointer control unit 13 updates the stack pointer 17. Next, the instruction decoding unit 11 uses the program counter 16
Is instructed to be a return instruction, and the return address value of the subroutine stored in the stack memory 15 pointed to by the stack pointer 17 is written in the program counter 16. Thus, the execution of the return instruction is completed.

【0017】次に特殊なスタック制御が行われる場合を
説明する。
Next, a case where special stack control is performed will be described.

【0018】まず特殊なサブルーチンコール命令の実行
時には、命令デコード部11が特殊サブルーチンコール
命令であることをスタックポインタ記憶部12に指示す
る。指示を受けたスタックポインタ記憶部12はスタッ
クポインタ17の保持しているポインタ値を記憶する。
その他については、通常のサブルーチンコール命令と同
一の動作が行われ、サブルーチンコール命令の実行が終
了する。
First, when a special subroutine call instruction is executed, the instruction decoding unit 11 instructs the stack pointer storage unit 12 that it is a special subroutine call instruction. The stack pointer storage unit 12 that has received the instruction stores the pointer value held by the stack pointer 17.
In other respects, the same operation as the normal subroutine call instruction is performed, and the execution of the subroutine call instruction is completed.

【0019】次に特殊なリターン命令実行時には、命令
デコード部11が特殊リターン命令であることをスタッ
クポインタ制御部13に指示する。指示を受けたスタッ
クポインタ制御部13はスタックポインタ記憶部12が
記憶しているポインタ値をスタックポインタ17に書き
込む。次に命令デコード部11はプログラムカウンタ1
6にリターン命令であることを指示し、スタックポイン
タ17にポイントされるスタックメモリ15が記憶して
いるサブルーチンの戻りアドレスの値をプログラムカウ
ンタ16に書き込み、特殊リターン命令の実行が終了す
る。
Next, when a special return instruction is executed, the instruction decoding unit 11 instructs the stack pointer control unit 13 that it is a special return instruction. Upon receiving the instruction, the stack pointer control unit 13 writes the pointer value stored in the stack pointer storage unit 12 into the stack pointer 17. Next, the instruction decoding unit 11 uses the program counter 1
6 is instructed to be the return instruction, the value of the return address of the subroutine stored in the stack memory 15 pointed to by the stack pointer 17 is written in the program counter 16, and the execution of the special return instruction is completed.

【0020】スタックポインタ記憶指示命令実行時に
は、スタックポインタ記憶部12はスタックポインタ1
7が保持しているポインタ値を記憶し命令の実行が終了
する。
When the stack pointer storage instruction is executed, the stack pointer storage unit 12 stores the stack pointer 1
The pointer value held by 7 is stored, and the execution of the instruction ends.

【0021】スタックポインタ復帰指示命令実行時に
は、スタックポインタ制御部13はスタックポインタ記
憶部12が記憶しているポインタ値をスタックポインタ
17に書き込んで命令の実行が終了する。
When the stack pointer return instruction command is executed, the stack pointer control unit 13 writes the pointer value stored in the stack pointer storage unit 12 into the stack pointer 17, and the execution of the command ends.

【0022】[0022]

【発明の効果】このように本発明によれば、マイクロプ
ログラムの戻りアドレスを格納するスタックの位置を記
憶しておき、このスタックの位置をスタックの先頭とし
て処理することで、不要なスタックを一度に捨てること
ができ、マイクロプログラムの処理効率の低下を防止す
ることができる。また、マイクロプログラムによるスタ
ックを捨てるための特別な処理が不要になるので、この
処理の間違いによる誤動作を防止することができるとい
う効果がある。
As described above, according to the present invention, by storing the position of the stack for storing the return address of the microprogram and processing this stack position as the top of the stack, unnecessary stacks are once Therefore, it is possible to prevent the deterioration of the processing efficiency of the microprogram. Further, since special processing for discarding the stack by the microprogram is not required, there is an effect that it is possible to prevent a malfunction due to a mistake in this processing.

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

【図1】本発明の一実施例におけるリターンアドレスス
タック制御回路の構成を示すブロック図である。
FIG. 1 is a block diagram showing a configuration of a return address stack control circuit according to an embodiment of the present invention.

【符号の説明】 11 命令デコード部 12 スタックポインタ記憶部 13 スタックポインタ制御部 15 スタックメモリ 16 プログラムカウンタ 17 スタックポインタ[Description of Reference Signs] 11 instruction decoding unit 12 stack pointer storage unit 13 stack pointer control unit 15 stack memory 16 program counter 17 stack pointer

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 専用の記憶手段として用意されたスタッ
クメモリと、 このスタックメモリにおけるマイクロプログラムの戻り
アドレスが格納されている位置を記憶する位置記憶手段
と、 この位置記憶手段によって記憶された位置をマイクロプ
ログラムの制御可能な前記スタックメモリの先頭と擬制
するスタック先頭擬制手段とを具備することを特徴とす
るリターンアドレススタック制御回路。
1. A stack memory prepared as a dedicated storage means, a position storage means for storing a position where a return address of a microprogram is stored in the stack memory, and a position stored by the position storage means. A return address stack control circuit, comprising: a stack head control means for controlling a head of the stack memory capable of controlling a microprogram.
【請求項2】 専用の記憶手段として用意されたスタッ
クメモリと、 特殊なサブルーチンコール命令実行時にこのスタックメ
モリにおける戻りアドレスが格納された位置を記憶する
位置記憶手段と、 特殊なサブルーチンからのリターン命令実行時にこの位
置記憶手段によって記憶されているスタックメモリの位
置をスタックの先頭と擬制してリターン処理するリター
ン処理手段とを具備することを特徴とするリターンアド
レススタック制御回路。
2. A stack memory prepared as a dedicated storage means, a position storage means for storing a position where a return address is stored in this stack memory when a special subroutine call instruction is executed, and a return instruction from a special subroutine. A return address stack control circuit comprising: return processing means for simulating the position of the stack memory stored by the position storage means at the time of execution as the top of the stack and performing return processing.
【請求項3】 専用の記憶手段として用意されたスタッ
クメモリと、 特殊なサブルーチンコール命令実行時にこの位置記憶手
段によって記憶されている戻りアドレスが格納されたス
タックメモリの位置を記憶する位置記憶手段と、 特殊なサブルーチンからのリターン命令実行時にこの位
置記憶手段によって記憶されているスタックの位置をス
タックメモリの先頭と擬制してリターン処理するリター
ン処理手段と、 特殊なスタック制御命令の実行時にスタックメモリの位
置を前記位置記憶手段に記憶する記憶制御手段と、 別の特殊なスタック制御命令の実行時にこの記憶されて
いる位置にスタックメモリの先頭を移動させるスタック
メモリ先頭移動手段とを具備することを特徴とするリタ
ーンアドレススタック制御回路。
3. A stack memory prepared as a dedicated storage means, and a position storage means for storing the position of the stack memory in which the return address stored by this position storage means is stored when a special subroutine call instruction is executed. , When the return instruction from a special subroutine is executed, the position of the stack stored by this position storage means is assumed to be the top of the stack memory, and the return processing means performs return processing, and when the special stack control instruction is executed, the stack memory A storage control means for storing the position in the position storage means; and a stack memory head moving means for moving the head of the stack memory to the stored position when executing another special stack control instruction. Return address stack control circuit.
JP3282855A 1991-10-29 1991-10-29 Return address stack control circuit Pending JPH05120002A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3282855A JPH05120002A (en) 1991-10-29 1991-10-29 Return address stack control circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3282855A JPH05120002A (en) 1991-10-29 1991-10-29 Return address stack control circuit

Publications (1)

Publication Number Publication Date
JPH05120002A true JPH05120002A (en) 1993-05-18

Family

ID=17657951

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3282855A Pending JPH05120002A (en) 1991-10-29 1991-10-29 Return address stack control circuit

Country Status (1)

Country Link
JP (1) JPH05120002A (en)

Similar Documents

Publication Publication Date Title
JPH02235156A (en) Information processor
JP2001265609A (en) Arithmetic processor
JP2875842B2 (en) Programmable controller
JPH05120002A (en) Return address stack control circuit
US5893928A (en) Data movement apparatus and method
JPS6329861A (en) Ipl control system
JPS59218569A (en) Microcomputer
JPS622332B2 (en)
JP2985244B2 (en) Information processing device
JPH0353321A (en) Information processor
JPH0683986A (en) Single chip microcomputer
JPH03184136A (en) Address trace circuit
JPS595931B2 (en) Address stop method for arithmetic processing system
JPH11288371A (en) In-circuit emulator
JPS6260034A (en) Stored program system controller
JPS62248043A (en) Memory switching circuit for fetching microcomputer instruction
JPS61229137A (en) Arithmetic processing unit
JPS63170752A (en) Trace circuit
JPH0287227A (en) Data processor
JPS6362769B2 (en)
JPS59114622A (en) Initial microprogram loading system
JPS5852261B2 (en) Program processing method
JPS59186048A (en) Microprogram control system
JPH01201741A (en) Trace circuit
JPH04358227A (en) Microprocessor