JPH06149568A - Sub routine return control method and intruction controller - Google Patents

Sub routine return control method and intruction controller

Info

Publication number
JPH06149568A
JPH06149568A JP29451292A JP29451292A JPH06149568A JP H06149568 A JPH06149568 A JP H06149568A JP 29451292 A JP29451292 A JP 29451292A JP 29451292 A JP29451292 A JP 29451292A JP H06149568 A JPH06149568 A JP H06149568A
Authority
JP
Japan
Prior art keywords
general
instruction
return
purpose register
address
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.)
Granted
Application number
JP29451292A
Other languages
Japanese (ja)
Other versions
JP3325309B2 (en
Inventor
Youzou Nakayama
陽象 中山
Shigemi Sugiyama
淑美 杉山
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.)
Fujitsu Ltd
PFU Ltd
Original Assignee
Fujitsu Ltd
PFU 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 Fujitsu Ltd, PFU Ltd filed Critical Fujitsu Ltd
Priority to JP29451292A priority Critical patent/JP3325309B2/en
Publication of JPH06149568A publication Critical patent/JPH06149568A/en
Application granted granted Critical
Publication of JP3325309B2 publication Critical patent/JP3325309B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Abstract

PURPOSE:To reduce pipeline penalties at the time of sub routine return by storing a return address in a return address register outside a general-purpose register circuit part at the same time when storing a return address. CONSTITUTION:An instruction fetch control circuit part 10 is provided with a return address register (RREG) 18 for storing data incrementing contents in a program counter(PC) at the time of call instruction execution. At the time of a sub routine call, the return address is stored in a general-purpose register 61 inside a general-purpose register circuit part 60 and simultaneously stored in the RREG 18 provided outside the general-purpose register circuit part 60, and a flag is raised to index the validity of data stored in the RREG 18. When the general-purpose register 61 designated by a return instruction is the specified general-purpose register 61 and the flag indexes the validity at the time of sub routine return, the sub routine return is performed with the contents in the RREG 18 as a branch address.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、パイプライン制御等を
用いた命令処理装置において、サブルーチンコールさ
れ、所定の処理の実行後に、サブルーチンリターンを行
う場合の制御方法に関し、特に、サブルーチンリターン
の場合に、パイプラインインターロック(パイプライン
ペナルティ)を生じさせることのないサブルーチンリタ
ーンの制御方法及び該方法を用いた命令処理装置に関す
る。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a control method in the case where an instruction processing device using pipeline control or the like is called by a subroutine and a subroutine return is performed after a predetermined process is executed. In addition, the present invention relates to a subroutine return control method that does not cause pipeline interlock (pipeline penalty) and an instruction processing apparatus using the method.

【0002】[0002]

【従来の技術】図3は、従来の命令処理装置のシステム
構成の一例を示すブロック図である。図3において、5
0はパイプライン制御における命令フェッチ及び分岐処
理を行う命令フェッチ制御回路部(内部の詳細は図1の
実施例の項で説明される)、60は複数の汎用レジスタ
(GR)が内蔵された汎用レジスタ回路部、61は汎用
レジスタ回路部中の1つの汎用レジスタ(GR1)、6
2は汎用レジスタ回路部中の1つの汎用レジスタ(GR
2)、70は命令及びデータが格納されたメモリを表し
ている。なお、本例は、命令フェッチ制御回路部50と
汎用レジスタ回路部60が別ブロックで実装されている
場合の例である。例えば、それぞれが別の回路チップ上
に構成されている場合である。
2. Description of the Related Art FIG. 3 is a block diagram showing an example of a system configuration of a conventional instruction processing device. In FIG. 3, 5
Reference numeral 0 is an instruction fetch control circuit unit that performs instruction fetch and branch processing in pipeline control (internal details will be described in the section of the embodiment of FIG. 1), and 60 is a general purpose built-in general-purpose register (GR). A register circuit unit, 61 is one general-purpose register (GR1) in the general-purpose register circuit unit, 6
2 is one general-purpose register (GR
2) and 70 represent memories in which instructions and data are stored. Note that this example is an example in which the instruction fetch control circuit unit 50 and the general-purpose register circuit unit 60 are mounted in different blocks. For example, each is configured on a different circuit chip.

【0003】図4は、パイプライン制御の一構成例を示
す図であり、命令フェッチ制御ブロック50で処理され
るパイプライン制御について説明するための図である。
すなわち、パイプライン各命令は、4つのステージに分
けて処理され、各ステージの処理内容は以下の通りであ
る。 ・IFステージ 前の命令のDC(IA)ステージで要求された命令デー
タの応答ステージ。 ・DC(IA)ステージ 命令デコード及び次に実行する命令の命令アドレス生
成、フェッチ要求ステージ。 ・EXステージ 演算実行ステージ。 ・WBステージ 演算結果書き込みステージ。
FIG. 4 is a diagram showing an example of the configuration of pipeline control, and is a diagram for explaining the pipeline control processed by the instruction fetch control block 50.
That is, each instruction of the pipeline is processed in four stages, and the processing contents of each stage are as follows. IF stage A response stage of the instruction data requested in the DC (IA) stage of the previous instruction. DC (IA) stage Instruction decoding, instruction address generation of an instruction to be executed next, and fetch request stage.・ EX stage Operation execution stage.・ WB stage Calculation result writing stage.

【0004】このような、パイプライン制御の命令処理
装置において、サブルーチンコールを行う場合は、命令
フェッチ制御回路部50が、多数の汎用レジスタからな
る汎用レジスタ回路部60中の1つの汎用レジスタ、例
えば汎用レジスタ(GR1)61にリターンアドレスを
格納してサブルーチンに分岐する。
In such an instruction processing apparatus of pipeline control, when making a subroutine call, the instruction fetch control circuit unit 50 includes one general-purpose register in the general-purpose register circuit unit 60 including a large number of general-purpose registers, for example, a general-purpose register. The return address is stored in the general-purpose register (GR1) 61 and the process branches to the subroutine.

【0005】サブルーチンリターンする場合は、上記汎
用レジスタ(GR)61の内容を分岐アドレスとして、
リターンする。このように、従来のサブルーチンリター
ン時には、汎用レジスタ(GR)61をアクセスして、
その内容を分岐アドレスとして命令フェッチを実行す
る。
When the subroutine returns, the contents of the general-purpose register (GR) 61 are used as a branch address.
To return. Thus, at the time of the conventional subroutine return, the general-purpose register (GR) 61 is accessed,
Instruction fetch is executed with the contents as the branch address.

【0006】[0006]

【発明が解決しようとする課題】図2は、本発明の実施
例と従来例のパイプライン動作を比較するための図であ
り、図2(a)は、従来例のパイプライン制御される命
令処理装置におてる、サブルーチンコール/リターン時
の処理動作のタイムチャートを示したものである。
FIG. 2 is a diagram for comparing the pipeline operations of the embodiment of the present invention and the conventional example, and FIG. 2 (a) is a pipeline controlled instruction of the conventional example. 6 is a time chart of a processing operation at the time of subroutine call / return in the processing device.

【0007】以下、本タイムチャートについて説明す
る。 (1)時刻t1でコール命令(CALL)がフェッチさ
れたとする。 (2)コール命令のDC(IA)ステージで分岐先のア
ドレスが生成され、1ディレイ(delay)命令を間
にはさんで、時刻t3で、分岐先のアドレスがフェッチ
され実行処理される。また、汎用レジスタ(GR1)6
1に分岐先アドレスが格納される。ディレイ命令につい
ては、実施例の前提条件(2)が説明する。
The time chart will be described below. (1) It is assumed that a call instruction (CALL) is fetched at time t1. (2) The branch destination address is generated at the DC (IA) stage of the call instruction, and the branch destination address is fetched and executed at time t3 with one delay instruction in between. In addition, the general-purpose register (GR1) 6
The branch destination address is stored in 1. The delay instruction will be described in the precondition (2) of the embodiment.

【0008】(3)時刻t5で、リターン命令がフェッ
チされ、命令の実行が開始されると、汎用レジスタ(G
R1)61の内容を読みに行く。しかし、汎用レジスタ
回路部60は命令フェッチ制御回路部50とは別ブロッ
クであり、配線距離等の物理的制約条件により汎用レジ
スタ(GR1)61からデータを読み出すには時間がか
かる。従って、汎用レジスタ(GR1)61からのアド
レスデータの読み出しのために、1マシンサイクルの
間、パイプライン制御にインタロックをかける(図中の
1τのペナルティ)。
(3) At time t5, when the return instruction is fetched and the execution of the instruction is started, the general-purpose register (G
R1) Go to read the contents of 61. However, the general-purpose register circuit unit 60 is a separate block from the instruction fetch control circuit unit 50, and it takes time to read data from the general-purpose register (GR1) 61 due to physical constraints such as wiring distance. Therefore, in order to read the address data from the general-purpose register (GR1) 61, the pipeline control is interlocked for one machine cycle (penalty of 1τ in the figure).

【0009】(4)そして、ディレイ命令を間にはさん
で、時刻t8で、分岐先アドレスの命令がフェッチされ
実行される。このように、従来例の命令処理装置では、
サブルーチンリターン時に1τのパイプラインペナルテ
ィが生じ、サブルーチンコールが頻発する場合にはパイ
プライン動作が乱され、大幅に効率を低下させていた。
(4) Then, the instruction at the branch destination address is fetched and executed at time t8 with the delay instruction in between. Thus, in the conventional instruction processing device,
When the subroutine returns, a pipeline penalty of 1τ occurs, and when the subroutine calls occur frequently, the pipeline operation is disturbed, resulting in a significant reduction in efficiency.

【0010】上記、パイプラインペナルティをなくすこ
と、すなわち汎用レジスタ(GR1)61から分岐先ア
ドレスをDC(IA)ステージで得るためには、いくつ
かの方法が考えられる。
In order to eliminate the pipeline penalty, that is, to obtain the branch destination address from the general-purpose register (GR1) 61 at the DC (IA) stage, several methods can be considered.

【0011】(1)分岐アドレスの読み出し用に、汎用
レジスタ回路部60に専用の読み出しポートを設ける方
法。しかしながらこの方法では、汎用レジスタの読み出
しポートに多くの負荷をかけることになり、パイプライ
ンのステージの中で、クリティカルパス(critic
al path)となり易いDCステージ(例えば、D
Cステージで、演算ソースを汎用レジスタから読み出す
場合等)、EXステージ(例えば、EXステージで演算
ソースを汎用レジスタから読み出す場合)の設計がより
困難なものとなる。
(1) A method for providing a dedicated read port in the general-purpose register circuit section 60 for reading a branch address. However, this method puts a lot of load on the read port of the general-purpose register, and in the pipeline stage, the critical path (critical)
DC stage (for example, D
It becomes more difficult to design the EX stage (for example, when the operation source is read from the general-purpose register in the C stage) and the EX stage (for example, when the operation source is read from the general-purpose register in the EX stage).

【0012】(2)マイクロプロセッサのように、1チ
ップ上に命令フェッチ制御回路部50と汎用レジスタ回
路部60を内蔵する方法。しかし、この方法では、汎用
レジスタからの分岐処理回路までの配線パスのため、信
号伝達の遅延時間増加や配線性の低下を招くことにな
り、不利益が多くなる。
(2) A method of incorporating the instruction fetch control circuit section 50 and the general-purpose register circuit section 60 on one chip like a microprocessor. However, with this method, the wiring path from the general-purpose register to the branch processing circuit causes an increase in the signal transmission delay time and a decrease in the wiring property, which is disadvantageous.

【0013】(3)また、複数のチップを用いてシステ
ムを構成する場合は、同一チップ上に、命令フェッチ制
御回路部50と汎用レジスタ回路部60を実装する方法
が考えられるが。しかし、演算器等との関連を考慮する
と困難な場合が多く、また、このような場合は、命令フ
ェッチ/分岐処理回路と汎用レジスタ間のインタフェー
ス回路が必要となり、遅延時間や配線ピン数の制限が問
題となる。
(3) When a system is constructed using a plurality of chips, a method of mounting the instruction fetch control circuit section 50 and the general-purpose register circuit section 60 on the same chip can be considered. However, it is often difficult to consider the relationship with the arithmetic unit, and in such a case, an interface circuit between the instruction fetch / branch processing circuit and the general-purpose register is required, and the delay time and the number of wiring pins are limited. Is a problem.

【0014】以上、従来の技術では、種々の理由によ
り、サブルーチンリターンの分岐処理でパイプラインペ
ナルティを生じることは避け難かった。本発明は上記問
題点に鑑みなされたものであり、サブルーチンリターン
の時パイプラインペナルティを、効果的に削減し得るサ
ブルーチンリターン制御方法及び該方法を用いた命令処
理装置を提供することを目的とする。
As described above, in the conventional technique, it is difficult to avoid the pipeline penalty in the branch process of the subroutine return for various reasons. The present invention has been made in view of the above problems, and an object of the present invention is to provide a subroutine return control method that can effectively reduce the pipeline penalty at the time of subroutine return, and an instruction processing device using the method. .

【0015】[0015]

【課題を解決するための手段】本発明によれば、上述の
目的は前記特許請求の範囲に記載した手段により達成さ
れる。
According to the invention, the above mentioned objects are achieved by means of the patent claims.

【0016】すなわち、請求項1記載の発明について
は、複数の汎用レジスタを内蔵する汎用レジスタ回路部
有し、上記汎用レジスタ回路部中の汎用レジスタを特定
し、リターンアドレスを格納してサブルーチンに分岐す
るサブルーチンコール命令と、上記特定した汎用レジス
タの内容を分岐アドレスとしてサブルーチンからリター
ンするサブルーチンリターン命令を有する命令処理装置
において、サブルーチンコール命令で汎用レジスタを特
定して、リターンアドレスを格納する際に、同時に、該
リターンアドレスを、上記汎用レジスタ回路部外に設け
たリターンアドレスレジスタに格納するリターンアドレ
ス格納手段と、上記リターンアドレスレジスタにデータ
を格納する際に、同時に該リターンアドレスが有効であ
ることをフラグにより指標する手段と、上記サブルーチ
ンコール命令以降に実行される命令により、上記特定し
た汎用レジスタの内容が変更された場合には、上記フラ
グに無効を指標させる手段と、サブルーチンリターン命
令実行時に、指定された汎用レジスタが上記特定した汎
用レジスタであり、かつ上記フラグが有効を指標してい
る場合には、上記リターンアドレスレジスタの内容を分
岐先アドレスとして分岐を実行する手段とを用いるサブ
ルーチンリターン制御方法である。
That is, according to the first aspect of the present invention, a general-purpose register circuit unit having a plurality of general-purpose registers is provided, the general-purpose register in the general-purpose register circuit unit is specified, the return address is stored, and the subroutine is branched. In the instruction processing device having a subroutine call instruction for returning and a subroutine return instruction for returning from the subroutine using the content of the specified general-purpose register as a branch address, when the general-purpose register is specified by the subroutine call instruction and the return address is stored, At the same time, the return address storing means for storing the return address in the return address register provided outside the general-purpose register circuit section and the fact that the return address is valid at the same time when the data is stored in the return address register By flag When the contents of the specified general-purpose register are changed by the means for indexing and the instruction executed after the subroutine call instruction, the means for indexing the flag as invalid, and the instruction specified when the subroutine return instruction is executed. If the general-purpose register is the specified general-purpose register and the flag indicates that the flag is valid, a subroutine return control method using means for executing branch using the contents of the return address register as the branch destination address is used. is there.

【0017】請求項2記載の発明については、リターン
アドレスを格納するリターンアドレスレジスタと、上記
リターンアドレスレジスタに格納されたアドレスデータ
の有効性を指標するフラグとを命令フェッチ及び分岐処
理を行う命令フェッチ制御回路部内に設けた請求項1記
載のサブルーチンリターン制御方法である。
According to the second aspect of the invention, a return address register for storing a return address and a flag for indicating the validity of the address data stored in the return address register are used for instruction fetch and instruction fetch for performing branch processing. The subroutine return control method according to claim 1, wherein the subroutine return control method is provided in the control circuit section.

【0018】請求項3記載の発明については、請求項1
または2記載のサブルーチンリターン制御方法を用いた
命令処理装置である。
According to the invention of claim 3, claim 1
Alternatively, it is an instruction processing device using the subroutine return control method described in 2.

【0019】[0019]

【作用】請求項1記載のサブルーチンリターン制御方法
では、汎用レジスタ回路部とは別の場所に、リターンア
ドレスのコピーを取るリターンアドレスレジスタを設け
ておく、そして、そのリターンアドレスレジスタに格納
されたデータの有効性を指標するフラグも同時に設け
る。
According to the subroutine return control method of the present invention, a return address register for copying the return address is provided in a place different from the general-purpose register circuit section, and the data stored in the return address register is stored. At the same time, a flag that indicates the effectiveness of

【0020】そして、サブルーチンコール/リターン時
に下記のような動作を行わせる。 (1)サブルーチンコール時には、リターンアドレス
を、汎用レジスタ回路部内の特定した汎用レジスタに格
納すると共に、さらに、汎用レジスタ回路部外に設けた
リターンアドレスレジスタに同時に格納する。
Then, the following operation is performed at the time of subroutine call / return. (1) At the time of a subroutine call, the return address is stored in the specified general-purpose register in the general-purpose register circuit unit, and further stored in the return address register provided outside the general-purpose register circuit unit at the same time.

【0021】(2)そして、リターンアドレスレジスタ
に格納されたデータの有効性を指標するフラグを立て
る。 (3)サブルーチンリターン時に、リターン命令により
指定された汎用レジスタが特定した汎用レジスタであ
り、かつ、フラグが有効を指標している場合には、リタ
ーンアドレスレジスタの内容を分岐アドレスとして、サ
ブルーチンリターンする。
(2) Then, a flag is set to indicate the validity of the data stored in the return address register. (3) When the general-purpose register specified by the return instruction is the general-purpose register specified when the subroutine returns, and the flag indicates that the flag is valid, the contents of the return address register are used as the branch address to return to the subroutine. .

【0022】(4)なお、サブルーチンコール命令より
以降に実行された命令により、特定した汎用レジスタの
内容が書き換えられた場合には、フラグに無効を指標さ
せ、リターンアドレスレジスタの内容は使用しない。
(4) When the content of the specified general-purpose register is rewritten by an instruction executed after the subroutine call instruction, the flag is made invalid and the content of the return address register is not used.

【0023】したがって、本発明では、通常の場合は、
サブルーチンリターン時の分岐アドレスを得るのに、汎
用レジスタにアクセスすることなく、リターンアドレス
レジスタから直接分岐アドレスが得られる。
Therefore, in the present invention, in the normal case,
To obtain the branch address at the time of subroutine return, the branch address can be obtained directly from the return address register without accessing the general-purpose register.

【0024】従って、高速な命令フェッチが可能とな
り、従来例のようなパイプラインペナルティを生じるこ
とがなくなる。請求項2記載の発明については、リター
ンアドレスレジスタとフラグの設置場所を、命令フェッ
チ及び分岐処理を行う回路部の内部に配置し、分岐アド
レスの読み出し動作を極力高速化するものである。
Therefore, high-speed instruction fetch is possible, and the pipeline penalty as in the conventional example does not occur. According to the second aspect of the present invention, the place where the return address register and the flag are installed is disposed inside the circuit unit that performs the instruction fetch and the branch processing, so that the read operation of the branch address is speeded up as much as possible.

【0025】請求項3記載の発明については、請求項1
または2記載の方法を用いた命令処理装置である。
According to the invention of claim 3, claim 1
Alternatively, the instruction processing apparatus uses the method described in item 2.

【0026】[0026]

【実施例】図1は、本発明の一実施例のシステム構成を
示すブロック図である。請求項1,2及び3記載の発明
に共通に対応する実施例である。
FIG. 1 is a block diagram showing the system configuration of an embodiment of the present invention. This is an embodiment commonly corresponding to the invention described in claims 1, 2, and 3.

【0027】図1において、10はパイプライン制御に
おける命令フェッチ及び分岐処理を行う命令フェッチ制
御回路部、11は命令データが格納される命令バッファ
(IB)、12は命令の内容を解読するデコーダ(DE
C)、13は命令フェッチの制御を行うIF制御回路、
14はプログラムカウンタ(PC)、15はコール命令
実行時にPCとIBの該当フィールドから抜き出された
相対アドレス値を加算する分岐アドレス生成加算器(T
G)、16はPCの内容をインクリメント(+1)して
更新するためのインクリメンタ(INC)、17はPC
に書き込むデータを選択するためのセレクタ(PC−S
EL)、18はコール命令実行時のPCの内容をインク
リメント(+1)したデータを格納するリターンアドレ
スレジスタ(RREG)、19はRREGの内容の有効
/無効を指標するフラグ(RVAL)、20は命令アド
レスを選択するためのセレクタ(IFA−sel)、2
1は命令先取りを行うためのプリフェッチプログラムカ
ウンタ(PFPC)、22はPFPCへの書き込みデー
タを選択するためのセレクタ(PFPC−sel)、2
3は入力データをインクリメント(+1)して出力する
インクリメンタ(INC)、24はINC23への入力
データを選択するセレクタ(PFPC−INC−se
l)を表している。
In FIG. 1, 10 is an instruction fetch control circuit section for performing instruction fetch and branch processing in pipeline control, 11 is an instruction buffer (IB) in which instruction data is stored, 12 is a decoder (decoder for decoding the content of an instruction ( DE
C) and 13 are IF control circuits for controlling instruction fetch,
Reference numeral 14 is a program counter (PC), and 15 is a branch address generation adder (T) that adds the relative address values extracted from the corresponding fields of PC and IB when the call instruction is executed.
G), 16 is an incrementer (INC) for incrementing (+1) and updating the contents of the PC, and 17 is the PC
Selector (PC-S for selecting data to be written to
EL), 18 is a return address register (RREG) that stores the data obtained by incrementing (+1) the contents of the PC when the call instruction is executed, 19 is a flag (RVAL) that indicates whether the contents of RREG are valid or invalid, and 20 is an instruction Selector (IFA-sel) for selecting an address, 2
1 is a prefetch program counter (PFPC) for prefetching instructions, 22 is a selector (PFPC-sel) for selecting write data to the PFPC, 2
3 is an incrementer (INC) that increments (+1) and outputs the input data, and 24 is a selector (PFPC-INC-se) that selects the input data to the INC 23.
l) is represented.

【0028】また、図3の従来例と同じ部分には、同じ
符号を付してあり、その説明は省略する。なお、図1中
のリターンアドレスレジスタ(RREG)18と、フラ
グ(RVAL)19が、本発明を実現するために新たに
追加された部分であり、その他の部分は、従来例の命令
フェッチ制御回路部50(図3)と同じである。
Further, the same parts as those in the conventional example of FIG. 3 are designated by the same reference numerals, and the description thereof will be omitted. A return address register (RREG) 18 and a flag (RVAL) 19 shown in FIG. 1 are newly added to realize the present invention, and the other parts are the conventional instruction fetch control circuit. Same as part 50 (FIG. 3).

【0029】また、本実施例の命令処理装置のパイプラ
イン構成は、図4に示した構成例を用いる。まず最初
に、図1の実施例のパイプラインの動作部の前提条件を
以下に示す。なお、この前提条件は単に、実施例の前提
条件であり、本発明の前提条件となるものではない。
As the pipeline configuration of the instruction processing device of this embodiment, the configuration example shown in FIG. 4 is used. First of all, the preconditions of the operation part of the pipeline of the embodiment of FIG. 1 are shown below. It should be noted that this precondition is merely a precondition for the embodiment and not a precondition for the present invention.

【0030】(1)DC(IA)ステージで、DC(デ
コード)と同時に実行されるIA(IFアドレス供給ス
テージ)において、命令アドレスをメモリに供給し、I
Fステージにおいて命令データを得るものとする。な
お、EXステージ、WBステージは、本発明と直接関係
しないのでその詳細は省略する。
(1) In the DC (IA) stage, in the IA (IF address supply stage) which is executed simultaneously with the DC (decoding), the instruction address is supplied to the memory, and the I
Instruction data is obtained in the F stage. Since the EX stage and the WB stage are not directly related to the present invention, their details are omitted.

【0031】(2)(1)のパイプライン制御方式で
は、コール/リターン命令等の分岐命令実行時には、命
令フェッチのためのペナルティが生じるが、一般的な手
法として遅延分岐によるペナルティの削減が行われ、本
実施例でもこの手法を採用している。
(2) In the pipeline control method of (1), a penalty for instruction fetch occurs when a branch instruction such as a call / return instruction is executed, but as a general method, the penalty is reduced by delay branch. This method is also used in this embodiment.

【0032】(3)分岐アドレスを格納する汎用レジス
タ(GR1)61は、命令セットをアーキテクチャで固
定してもよく、またコンパイラが生成するコール/リタ
ーン命令で使用頻度の高い汎用レジスタを特定したもの
でもよい。本実施例では、汎用レジスタ(GR1)61
を当該特定汎用レジスタとする。
(3) The general-purpose register (GR1) 61 for storing a branch address may have a fixed instruction set according to architecture, and a general-purpose register frequently used is specified by a call / return instruction generated by a compiler. But it's okay. In this embodiment, the general purpose register (GR1) 61
Is the specific general-purpose register.

【0033】(4)リターン命令実行時、汎用レジスタ
回路部の実装位置や遅延時間等の物理的制約から、汎用
レジスタ(GR1)61の内容の読み出し、命令アドレ
スの生成、命令フェッチの一連の処理が、パイプライン
の1マシンサイクル(τ)で実行できないと仮定し、そ
の時の処理として、汎用レジスタ(GR1)61へのア
クセスのため1τのパイプラインインターロックをかけ
る制御を行う。
(4) During execution of a return instruction, a series of processes of reading the contents of the general-purpose register (GR1) 61, generating an instruction address, and fetching an instruction due to physical restrictions such as the mounting position of the general-purpose register circuit section and delay time However, assuming that it cannot be executed in one machine cycle (τ) of the pipeline, as a processing at that time, control for applying a pipeline interlock of 1τ for accessing the general-purpose register (GR1) 61 is performed.

【0034】(5)コールを含む分岐命令は、プログラ
ムカウンタ(PC)14からの相対アドレスにより分岐
を行うものとする。 (6)プログラムカウンタ(PC)14は、IFステー
ジで更新される。よって、例外等(割込等)の発生によ
り命令を無効化するようなケースではPCの特殊制御が
必要であるが、本発明には直接関係しないので省略す
る。
(5) A branch instruction including a call is supposed to branch at a relative address from the program counter (PC) 14. (6) The program counter (PC) 14 is updated at the IF stage. Therefore, although special control of the PC is required in the case where an instruction is invalidated due to the occurrence of an exception or the like (interrupt or the like), it is omitted because it is not directly related to the present invention.

【0035】(7)図1の実施例においては、本発明に
関係する部分のみを示したものであり、コール/リター
ン命令制御以外の詳細は省略する。また、IB(命令バ
ッファ)11の構成や数量等のインクリメントに依存す
る部分も特に規定するものではない。
(7) In the embodiment shown in FIG. 1, only the portion related to the present invention is shown, and details other than the call / return instruction control are omitted. Further, the configuration of the IB (instruction buffer) 11 and the part depending on the increment of the number are not particularly specified.

【0036】以上の前提条件から、本発明の動作を説明
する。 (1)コールや、リターン命令等のフロー制御命令以外
の命令フェッチの場合には、セレクタ(IFA−se
l)20の選択により、プリフェッチプログラムカウン
タ(PFPC)21の内容を命令アドレスとし命令フェ
ッチを行う。またPFPC21のデータは、セレクタ
(PFPC−INC−sel)24を介してインクリメ
ンタ(INC)23に送られる。そして、PFPC21
には、命令フェッチ毎に、インクリメンタ(INC)2
3により現在の内容をインクリメント(+1)したデー
タが格納される。
The operation of the present invention will be described based on the above prerequisites. (1) In the case of an instruction fetch other than a flow control instruction such as a call or a return instruction, a selector (IFA-se
1) By selecting 20, the instruction fetch is performed with the content of the prefetch program counter (PFPC) 21 as the instruction address. The data of the PFPC 21 is sent to the incrementer (INC) 23 via the selector (PFPC-INC-sel) 24. And PFPC21
For each instruction fetch, the incrementer (INC) 2
The data obtained by incrementing (+1) the current content is stored by 3.

【0037】同様に、プログラムカウンタ(PC)14
にも、インクリメンタ(INC)16及びセレクタ(P
C−sel)17により、現在の内容をインクリメント
(+1)したデータが格納される。
Similarly, the program counter (PC) 14
Also, the incrementer (INC) 16 and the selector (P
C-sel) 17 stores the data obtained by incrementing (+1) the current content.

【0038】以上の、PFPC21及びPC14へのイ
ンクリメント値の格納許可条件は、パイプラインのDC
(IA)ステージのリリース信号(パイプラインインタ
ーロック等がなく、次のステージに進むことができる許
可信号)である。
The storage permit condition of the increment value to the PFPC 21 and the PC 14 is the pipeline DC.
It is a release signal of the (IA) stage (a permission signal that can proceed to the next stage without a pipeline interlock or the like).

【0039】(2)コール命令実行時は、PC14と、
命令バッファ(IB)11の該当するフィールドから抜
粋された相対値を、ターゲットアドレスレジスタ(T
G)15で加算したデータを命令アドレス(サブルーチ
ン呼び出しアドレス)として、セレクタ(IFA−se
l)20を介して出力する。
(2) When executing the call instruction, the PC 14
The relative value extracted from the corresponding field of the instruction buffer (IB) 11 is set to the target address register (T
G) The data added in 15 is used as the instruction address (subroutine call address), and the selector (IFA-se
l) Output via 20.

【0040】この時、セレクタ(PFPC−INC−s
el)24もTG15の出力を選択し、PFPC21に
は、INC23及びセレクタ(PFPC−sel)22
を介して、サブルーチンの呼び出しアドレス(TG15
の出力データ)の次のアドレスがセットされる。
At this time, the selector (PFPC-INC-s
el) 24 also selects the output of the TG 15, and the PFPC 21 has an INC 23 and a selector (PFPC-sel) 22.
Via the call address of the subroutine (TG15
Output data) is set.

【0041】同時に、現在のPC14の内容をインクリ
メント(+1)した値、すなわちコール命令の次のアド
レス(サブルーチンからのリターンアドレス)をパイプ
ラインの以降のステージを通して、命令で指定された汎
用レジスタ(GR)に書き込む。
At the same time, the value obtained by incrementing (+1) the current contents of the PC 14, that is, the address next to the call instruction (return address from the subroutine) is passed through the subsequent stages of the pipeline to the general register (GR) designated by the instruction. ).

【0042】コール命令で指定された汎用レジスタ(G
R)が特定汎用レジスタ(GR1)61の場合は、現在
のPC14の値をインクリメント(+1)した値(リタ
ーンアドレス)をRREG21に格納すると共に、フラ
グ(RVAL)19をセットし、RREG18に特定汎
用レジスタ(GR1)と同じ内容のデータが有効に存在
することを示す(図1中のCALL−GR1信号ONの
時)。
The general-purpose register (G
When R) is the specific general purpose register (GR1) 61, the value (return address) obtained by incrementing (+1) the current value of the PC 14 is stored in the RREG 21, the flag (RVAL) 19 is set, and the specific general purpose is set in the RREG 18. It indicates that data having the same content as the register (GR1) is effectively present (when the CALL-GR1 signal in FIG. 1 is ON).

【0043】コール命令で指定された汎用レジスタ(G
R)が特定汎用レジスタ(GR1)61以外の場合は、
RREG18及びフラグ(RVAL)19の内容は変更
されない。
The general-purpose register (G
When R) is other than the specific general purpose register (GR1) 61,
The contents of the RREG 18 and the flag (RVAL) 19 are not changed.

【0044】(3)コール命令以外で、デストネーショ
ンレジスタに特定汎用レジスタ(GR1)61が指定さ
れた命令が実行されると、フラグ(RVAL)19をリ
セットし、RREG18の内容が無効化されたことを示
す(図1中のDEST−GR1信号ONの時)。
(3) When a command other than the call command with the specified general purpose register (GR1) 61 specified in the destination register is executed, the flag (RVAL) 19 is reset and the content of the RREG 18 is invalidated. (When the DEST-GR1 signal in FIG. 1 is ON).

【0045】(4)リターン命令実行時、指定された汎
用レジスタ(GR)が特定汎用レジスタ(GR1)61
であり、かつフラグ(RVAL)19がオン(セット状
態)の場合は、命令アドレスとして、RREG18の内
容を選択する。この時、セレクタ(PFPC−INC−
sel)24もRREG18の出力を選択することによ
り、PFPC21には、サブルーチンの戻りアドレスの
次のアドレスが格納される。
(4) When the return instruction is executed, the specified general-purpose register (GR) is the specific general-purpose register (GR1) 61.
And the flag (RVAL) 19 is on (set state), the content of the RREG 18 is selected as the instruction address. At this time, the selector (PFPC-INC-
sel) 24 also selects the output of RREG 18, so that the address next to the return address of the subroutine is stored in PFPC 21.

【0046】さらに、PC14にも、セレクタ(PC−
sel)17を介して、リターン命令のアドレスを格納
する。以上説明したように、本実施例では、サブルーチ
ンリターン時に、汎用レジスタ(GR)へのアクセスは
ない。
Further, the PC 14 also has a selector (PC-
The address of the return instruction is stored via (sel) 17. As described above, in this embodiment, the general register (GR) is not accessed when the subroutine returns.

【0047】リターン命令実行時、指定された汎用レジ
スタ(GR)が特定汎用レジスタ(GR1)61である
が、フラグ(RVAL)19がオフ(リセット状態)で
あるか、あるいは、特定汎用レジスタ(GR1)61以
外の汎用レジスタが指定された場合は、パイプラインの
DC(IA)ステージをインターロックし、その間に指
定された汎用レジスタ(GR)をアクセスし、PFPC
21及びPC14に読み出した値を格納する。
When the return instruction is executed, the designated general-purpose register (GR) is the specific general-purpose register (GR1) 61, but the flag (RVAL) 19 is off (reset state), or the specific general-purpose register (GR1). ) When a general-purpose register other than 61 is specified, the DC (IA) stage of the pipeline is interlocked, the specified general-purpose register (GR) is accessed during that time, and the PFPC is accessed.
21 and the read value are stored in the PC 14.

【0048】なお、この場合、セレクタ(PFPC−s
el)22及びセレクタ(PC−sel)17が汎用レ
ジスタ(GR)の読み出しデータを選択する。以降の動
作は、(1)と同様である。
In this case, the selector (PFPC-s
el) 22 and selector (PC-sel) 17 select read data from the general-purpose register (GR). The subsequent operation is the same as in (1).

【0049】また、図2は、本発明の実施例と従来例の
パイプライン動作を比較するための図であり、図2
(a)は従来例の場合を示し、図2(b)は本発明の場
合を示している。
FIG. 2 is a diagram for comparing the pipeline operation of the embodiment of the present invention with that of the conventional example.
2A shows the case of the conventional example, and FIG. 2B shows the case of the present invention.

【0050】図2(a)の従来例の場合の動作は、リタ
ーン命令実行時に汎用レジスタ(GR1)61の読み出
しのために、インターロックがかかり、1τのパイプラ
インペナルティが生じる(時刻t6)。
In the operation of the conventional example shown in FIG. 2A, an interlock is applied due to the reading of the general-purpose register (GR1) 61 when the return instruction is executed, and a pipeline penalty of 1τ occurs (time t6).

【0051】図2(b)は、本発明の実施例での、RV
ALが有効を指標している場合の、パイプライン動作で
ある。リターン命令のDC(IA)ステージでRREG
18の内容を読み取り、リターンアドレスを得ることが
できるため(時刻t7の時点)、従来例のごとく1τの
パイプラインペナルティは生じない。ただし、RVAL
が無効を指標している場合は従来例の場合と同様であ
る。
FIG. 2B shows the RV in the embodiment of the present invention.
This is a pipeline operation in the case where the AL indicates the validity. RREG at DC (IA) stage of return instruction
Since the return address can be obtained by reading the contents of 18 (at time t7), the pipeline penalty of 1τ does not occur unlike the conventional example. However, RVAL
When is an index of invalidity, it is similar to the case of the conventional example.

【0052】[0052]

【発明の効果】本発明のサブルーチンリターン制御方法
及び該方法を用いた命令処理装置によれば、リターンア
ドレスレジスタ(RREG)18と、フラグ(RVA
L)19なる単純なハードウエアを追加するだけで、サ
ブルーチンリターン時のパイプラインペナルティを削減
することができる。
According to the subroutine return control method and the instruction processing apparatus using the method of the present invention, the return address register (RREG) 18 and the flag (RVA) are used.
L) The pipeline penalty at the time of subroutine return can be reduced by adding simple hardware such as 19.

【0053】スーパスカラやVLIW等の並列命令を実
行する命令処理装置においては、マシンサイクルに対す
る分岐命令の出現頻度が高く、本発明による性能の向上
は極めて大きい。
In an instruction processing device that executes parallel instructions such as superscalar and VLIW, the frequency of occurrence of branch instructions with respect to machine cycles is high, and the performance improvement according to the present invention is extremely large.

【0054】しかも、本ハードウエアは、汎用レジスタ
の実装位置には依存せず、命令フェッチ制御回路の内
部、またはその近傍に実装すればよく、柔軟なチップ設
計及び分割を可能にする。
Moreover, the present hardware does not depend on the mounting position of the general-purpose register and may be mounted inside the instruction fetch control circuit or in the vicinity thereof, and enables flexible chip design and division.

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

【図1】本発明の一実施例のシステム構成を示すブロッ
ク図である。
FIG. 1 is a block diagram showing a system configuration of an embodiment of the present invention.

【図2】本発明の実施例と従来例のパイプライン動作を
比較するための図である。
FIG. 2 is a diagram for comparing pipeline operations of an example of the present invention and a conventional example.

【図3】従来の命令処理装置のシステム構成の一例を示
すブロック図である。
FIG. 3 is a block diagram showing an example of a system configuration of a conventional instruction processing device.

【図4】パイプライン制御の一構成例を示す図である。FIG. 4 is a diagram showing a configuration example of pipeline control.

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

10 命令フェッチ制御回路部 11 命令バッファ(IB) 12 デコーダ(DEC) 13 IF制御回路 14 プログラムカウンタ(PC) 15 分岐アドレス生成加算器(TG) 16 インクリメンタ(INC) 17 セレクタ(PC−SEL) 18 レジスタ(RREG) 19 フラグ(RVAL) 20 セレクタ(IFA−sel) 21 プリフェッチプログラムカウンタ(PFPC) 22 セレクタ(PFPC−sel) 23 インクリメンタ(INC) 24 セレクタ(PFOC−INC−sel) 60 汎用レジスタ回路部 61 汎用レジスタ(GR1) 10 instruction fetch control circuit unit 11 instruction buffer (IB) 12 decoder (DEC) 13 IF control circuit 14 program counter (PC) 15 branch address generation adder (TG) 16 incrementer (INC) 17 selector (PC-SEL) 18 Register (RREG) 19 Flag (RVAL) 20 Selector (IFA-sel) 21 Prefetch program counter (PFPC) 22 Selector (PFPC-sel) 23 Incrementer (INC) 24 Selector (PFOC-INC-sel) 60 General-purpose register circuit unit 61 General-purpose register (GR1)

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 複数の汎用レジスタを内蔵する汎用レジ
スタ回路部を有し、上記汎用レジスタ回路部中の汎用レ
ジスタを特定し、リターンアドレスを格納してサブルー
チンに分岐するサブルーチンコール命令と、上記特定し
た汎用レジスタの内容を分岐アドレスとしてサブルーチ
ンからリターンするサブルーチンリターン命令を有する
命令処理装置において、 サブルーチンコール命令で汎用レジスタを特定して、リ
ターンアドレスを格納する際に、同時に、該リターンア
ドレスを、上記汎用レジスタ回路部外に設けたリターン
アドレスレジスタに格納するリターンアドレス格納手段
と、 上記リターンアドレスレジスタにデータを格納する際
に、同時に該リターンアドレスが有効であることをフラ
グにより指標する手段と、 上記サブルーチンコール命令以降に実行される命令によ
り、上記特定した汎用レジスタの内容が変更された場合
には、上記フラグに無効を指標させる手段と、 サブルーチンリターン命令実行時に、指定された汎用レ
ジスタが上記特定した汎用レジスタであり、かつ上記フ
ラグが有効を指標している場合には、上記リターンアド
レスレジスタの内容を分岐アドレスとして分岐を実行す
る手段とを用いることを特徴とするサブルーチンリター
ン制御方法。
1. A subroutine call instruction which has a general-purpose register circuit unit containing a plurality of general-purpose registers, specifies a general-purpose register in the general-purpose register circuit unit, stores a return address and branches to a subroutine, and the specification. In an instruction processing device having a subroutine return instruction that returns from a subroutine using the contents of the general-purpose register as a branch address, when the general-purpose register is specified by a subroutine call instruction and the return address is stored, the return address Return address storing means for storing in a return address register provided outside the general-purpose register circuit section, means for indicating that the return address is valid at the same time when storing data in the return address register by a flag, Subroutine If the contents of the specified general-purpose register are changed by an instruction executed after the address instruction, a means for indicating the above flag as invalid and a specified general-purpose register specified when the subroutine return instruction is executed are specified. And a flag indicating that the flag is valid, a means for executing a branch using the contents of the return address register as a branch address is used.
【請求項2】 リターンアドレスを格納するリターンア
ドレスレジスタと、 上記リターンアドレスレジスタに格納されたアドレスデ
ータの有効性を指標するフラグとを命令フェッチ及び分
岐処理を行う命令フェッチ制御回路部内に設けたことを
特徴とする請求項1記載のサブルーチンリターン制御方
法。
2. A return address register for storing a return address and a flag for indicating the validity of the address data stored in the return address register are provided in an instruction fetch control circuit unit for performing instruction fetch and branch processing. The subroutine return control method according to claim 1, wherein:
【請求項3】 請求項1または2記載のサブルーチンリ
ターン制御方法を用いたことを特徴とする命令処理装
置。
3. An instruction processing apparatus using the subroutine return control method according to claim 1.
JP29451292A 1992-11-02 1992-11-02 Subroutine return instruction processing unit Expired - Fee Related JP3325309B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP29451292A JP3325309B2 (en) 1992-11-02 1992-11-02 Subroutine return instruction processing unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP29451292A JP3325309B2 (en) 1992-11-02 1992-11-02 Subroutine return instruction processing unit

Publications (2)

Publication Number Publication Date
JPH06149568A true JPH06149568A (en) 1994-05-27
JP3325309B2 JP3325309B2 (en) 2002-09-17

Family

ID=17808742

Family Applications (1)

Application Number Title Priority Date Filing Date
JP29451292A Expired - Fee Related JP3325309B2 (en) 1992-11-02 1992-11-02 Subroutine return instruction processing unit

Country Status (1)

Country Link
JP (1) JP3325309B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08212075A (en) * 1995-01-31 1996-08-20 Nec Corp Information processor

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08212075A (en) * 1995-01-31 1996-08-20 Nec Corp Information processor

Also Published As

Publication number Publication date
JP3325309B2 (en) 2002-09-17

Similar Documents

Publication Publication Date Title
US5404552A (en) Pipeline risc processing unit with improved efficiency when handling data dependency
US5961637A (en) Split branch system utilizing separate set branch, condition and branch instructions and including dual instruction fetchers
KR100208889B1 (en) Parallel processing device amd parallel processing method
US7065632B1 (en) Method and apparatus for speculatively forwarding storehit data in a hierarchical manner
JPH02130634A (en) Device and method for processing data
KR20040016829A (en) Exception handling in a pipelined processor
US6725359B2 (en) Address stage logic for generating speculative address operand interim results of preceding instruction by arithmetic operations and configuring
US5522084A (en) Method and system for invalidating instructions utilizing validity and write delay flags in parallel processing apparatus
US6263424B1 (en) Execution of data dependent arithmetic instructions in multi-pipeline processors
EP1190305B1 (en) Method and apparatus for jump delay slot control in a pipelined processor
US7134000B2 (en) Methods and apparatus for instruction alignment including current instruction pointer logic responsive to instruction length information
US7020769B2 (en) Method and system for processing a loop of instructions
JP3325309B2 (en) Subroutine return instruction processing unit
JPH10124312A (en) Central processor
US20060168431A1 (en) Method and apparatus for jump delay slot control in a pipelined processor
JPH08272611A (en) Microprocessor
US4853889A (en) Arrangement and method for speeding the operation of branch instructions
KR100278136B1 (en) Data processing device and data processing method
US20030061468A1 (en) Forwarding the results of operations to dependent instructions quickly
US6442673B1 (en) Update forwarding cache for address mode
JP2000029696A (en) Processor, and pipeline process control method
JP3520372B2 (en) Elimination of critical path in operation of memory control unit and input / output control unit
US20050071830A1 (en) Method and system for processing a sequence of instructions
US20050033939A1 (en) Address generation
JP3147884B2 (en) Storage device and information processing device

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20020618

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313532

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees