JPH05165634A - Instruction prefetch device - Google Patents

Instruction prefetch device

Info

Publication number
JPH05165634A
JPH05165634A JP35387791A JP35387791A JPH05165634A JP H05165634 A JPH05165634 A JP H05165634A JP 35387791 A JP35387791 A JP 35387791A JP 35387791 A JP35387791 A JP 35387791A JP H05165634 A JPH05165634 A JP H05165634A
Authority
JP
Japan
Prior art keywords
instruction
branch
word
prediction
nogo
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
JP35387791A
Other languages
Japanese (ja)
Inventor
Masanori Kazuno
雅則 数野
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 Computertechno Ltd
Original Assignee
NEC Computertechno 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 NEC Computertechno Ltd filed Critical NEC Computertechno Ltd
Priority to JP35387791A priority Critical patent/JPH05165634A/en
Publication of JPH05165634A publication Critical patent/JPH05165634A/en
Pending legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)

Abstract

PURPOSE:To accelerate the execution of a branching instruction and to improve memory indexing efficiency by supplying a branching NoGo word in an instruction prefetch buffer to the next stage when the prediction of branching Go is failed. CONSTITUTION:When the branching Go prediction of the branching instruction is executed and a branch predictive destination address is generated, a conventionally abandonned instruction on the side of branching NoGo is held at a word continued to a branching Go predicting word in an instruction prefetch buffer 14. When it is judged that the prediction of branching Go is failed, the instruction held at the word continued to the branching Go predicting word in the instruction prefetch buffer 14 is supplied to a DC (instruction decode) stage and for the address of an IFA (instruction access) stage, the address of a word following to the branching NoGo word is generated by an address recovery function 16 and set to an instruction extracting address register 11.

Description

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

【0001】[0001]

【技術分野】本発明は命令先取り装置に関し、特に分岐
予測手段を用いて命令先取りを行うパイプライン処理方
式を採用した情報処理装置の命令先取り方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an instruction prefetching apparatus, and more particularly to an instruction prefetching method for an information processing apparatus that employs a pipeline processing method for prefetching instructions using branch prediction means.

【0002】[0002]

【従来技術】従来、この種の分岐予測手段による命令先
取り機能を有するパイプライン処理方式の情報処理装置
では、分岐予測テーブル等による分岐予測手段によっ
て、命令の先取りを行い、結果的に分岐命令を高速に実
行するようになっている。
2. Description of the Related Art Conventionally, in a pipeline processing type information processing apparatus having an instruction prefetching function of this kind of branch predicting means, a branch predicting means such as a branch prediction table or the like prefetches an instruction and, as a result, a branch instruction is executed. It is designed to run fast.

【0003】この様な方式は、特公昭50−22384
号公報,特開昭55−99655号公報,特開昭57−
59253号公報等において提案されており、既にいく
つかの情報処理装置で実施されている。
Such a system is disclosed in Japanese Patent Publication No. 50-22384.
JP-A-55-99655, JP-A-57-
It has been proposed in Japanese Patent No. 59253, etc., and has already been implemented in some information processing apparatuses.

【0004】これ等の方式では、分岐命令について、そ
の実行の度に実行結果の履歴を保持しておき、次にその
分岐命令が実行されようとするときには、その履歴情報
(分岐成立/不成立,分岐先アドレス)を反映させて、
命令先取りを効果的に実行するようになっている。
According to these methods, a history of execution results is held for each branch instruction, and the history information (branch taken / not taken, Reflect the branch destination address),
It is designed to effectively execute instruction prefetch.

【0005】すなわち、この様な方式では、命令先取り
の予測が適中する限りにおいては、分岐命令を高速に実
行できる効果がある。
That is, such a method has an effect that a branch instruction can be executed at a high speed as long as the prediction of the instruction prefetch is appropriate.

【0006】一般にパイプライン制御方式による情報処
理装置は、命令の実行フェーズを以下に述べる各ステー
ジに分割し、その各ステージの機能を果すためのハード
ウェアを設け、各ステージサイクルを各命令が逐次くま
なく実行するようにして見かけ上1命令当り1ステージ
サイクルで実行ができるように制御されている。
In general, an information processing apparatus based on a pipeline control system divides an instruction execution phase into each stage described below, provides hardware for performing the function of each stage, and each instruction sequentially executes each stage cycle. It is controlled so that the instructions can be executed in every stage in a single stage cycle.

【0007】IFステージ(命令先取りステージ) 命令取出しアドレスにより、メモリから命令を取出すス
テージ。
IF stage (instruction prefetch stage) A stage for fetching an instruction from a memory by an instruction fetch address.

【0008】DCステージ(命令解読ステージ) 命令レジスタに命令が読出されその命令の種類を解読す
るステージ。
DC stage (instruction decoding stage) A stage in which an instruction is read into the instruction register and the type of the instruction is decoded.

【0009】ADステージ(アドレス生成ステージ) その命令が必要とするアドレスを生成するステージであ
り、分岐命令であるならば、その分岐命令が実際に分岐
する分岐先アドレスが生成される。
AD stage (address generation stage) This is a stage for generating an address required by the instruction. If it is a branch instruction, a branch destination address to which the branch instruction actually branches is generated.

【0010】OFステージ(オペランド取出しステー
ジ) 演算に使用するオペランドを取出すステージ。
OF stage (operand fetch stage) A stage for fetching an operand used for an operation.

【0011】EXステージ(演算ステージ) 演算を実行するステージであり、分岐命令の場合、この
ステージで分岐成立か否かが確定する。
EX stage (arithmetic stage) This is a stage for executing an arithmetic operation. In the case of a branch instruction, it is decided at this stage whether or not the branch is taken.

【0012】更に、本発明に特に関係するIF(命令取
出し)ステージは複数ステージからなり、一般には以下
のステージに分割されている(尚、更に細いステージに
分割されていることもある)。
Further, the IF (instruction fetching) stage particularly related to the present invention is composed of a plurality of stages, and is generally divided into the following stages (which may be divided into smaller stages).

【0013】IFAステージ(命令アクセスステー
ジ) 命令取出しアドレスにより、メモリから命令を取出して
命令バッファに格納するステージであり、同時に命令取
出しアドレスにより分岐予測機能を索引し、分岐予測先
アドレスを生成するステージ。
IFA stage (instruction access stage) A stage for fetching an instruction from a memory by an instruction fetch address and storing it in an instruction buffer, and at the same time a stage for indexing a branch prediction function by an instruction fetch address to generate a branch prediction destination address. ..

【0014】IFBステージ(命令供給ステージ) 命令バッファの命令を、次段のDCステージの命令レジ
スタへ供給すると同時に、分岐予測機能により生成され
た分岐予測先アドレスをIFAステージへ供給するステ
ージ。
IFB stage (instruction supply stage) A stage for supplying the instruction of the instruction buffer to the instruction register of the next DC stage, and at the same time, supplying the branch prediction destination address generated by the branch prediction function to the IFA stage.

【0015】図3に従来のIFステージの構成を示す。
命令取出しレジスタ11は先取りする命令のアドレスを
保持し、このアドレスにより命令メモリ12と分岐予測
機能13とを同時に索引する。それと同時に、カウンタ
17により後続命令のアドレスを生成して命令取出しア
ドレスレジスタ11へセットする。
FIG. 3 shows the structure of a conventional IF stage.
The instruction fetch register 11 holds the address of the instruction to be prefetched, and the instruction memory 12 and the branch prediction function 13 are simultaneously indexed by this address. At the same time, the counter 17 generates the address of the subsequent instruction and sets it in the instruction fetch address register 11.

【0016】命令メモリ12(このメモリは主記憶でも
キャッシュメモリでも可)からの命令は命令先取りバッ
ファ14に格納されてDCステージへの命令供給がなさ
れる。同時に分岐予測機能13により分岐予測が行われ
て分岐予測先アドレスが生成され、これが分岐予測先ア
ドレスレジスタ15にセットされる。
An instruction from the instruction memory 12 (this memory may be a main memory or a cache memory) is stored in the instruction prefetch buffer 14 and supplied to the DC stage. At the same time, branch prediction is performed by the branch prediction function 13 to generate a branch prediction destination address, which is set in the branch prediction destination address register 15.

【0017】分岐Go予測の場合、分岐予測先アドレス
レジスタ15から命令取出しアドレスレジスタ11に分
岐予測先アドレスがセットされ、予測先の命令取出しが
行われる。アドレスリカバリ機能16は分岐予測失敗時
に命令を取出すための新しいアドレスを命令取出しレジ
スタ11にセットする。
In the case of branch Go prediction, the branch prediction destination address is set in the instruction fetch address register 11 from the branch prediction destination address register 15 and the prediction destination instruction is fetched. The address recovery function 16 sets a new address for fetching an instruction in the instruction fetch register 11 when the branch prediction fails.

【0018】図3に示した従来の命令先取り方式では、
図4に示す命令列を実行する場合、図5に示す様に、分
岐命令Dの分岐予測がIFBステージで行われ、このI
FBステージで生成された分岐予測先アドレス100 の命
令L,Mを取出すまでの間に、既に命令取出しを行って
いる分岐Go側の命令E,Fは無効な命令として捨てら
れている。従って、メモリの索引効率が低下し、命令供
給能力が低下する原因になるという欠点がある。
In the conventional instruction prefetch system shown in FIG. 3,
When executing the instruction sequence shown in FIG. 4, the branch prediction of the branch instruction D is performed at the IFB stage as shown in FIG.
By the time the instructions L and M of the branch prediction destination address 100 generated in the FB stage are fetched, the instructions E and F on the branch Go side that have already fetched the instruction are discarded as invalid instructions. Therefore, there is a drawback that the indexing efficiency of the memory is reduced and the instruction supply capability is reduced.

【0019】更に、図4で示す命令列の分岐命令Dが分
岐Go予測され、分岐予測失敗して分岐NoGoと判定
された場合、図5に示す如く、分岐命令Dの実行は6T
となり、NoGo側の命令Eに関しては、タイミングT
3 において、メモリ12から取出されているにもかかわ
らず、NoGo側の命令であるために捨てられている。
Further, when the branch instruction D of the instruction sequence shown in FIG. 4 is predicted to branch Go and the branch prediction fails and it is determined to be branch NoGo, execution of the branch instruction D is 6T as shown in FIG.
Therefore, regarding the instruction E on the NoGo side, the timing T
In 3, the instruction is on the NoGo side even though it is fetched from the memory 12 and therefore is discarded.

【0020】分岐命令Dの実行によりNoGoと判定さ
れたとき、再びNoGo側の命令Eを取出しているの
で、命令取出し動作が同一命令に対して2回実行される
ことになり、命令取出しのメモリ索引効率が低下し、命
令供給能力が低下するという欠点がある。
When it is determined to be NoGo by executing the branch instruction D, the instruction E on the NoGo side is fetched again, so the instruction fetch operation is executed twice for the same instruction, and the instruction fetch memory There is a drawback that the index efficiency is reduced and the instruction supply capability is reduced.

【0021】図5に示した分岐命令の実行T数(6T)
を削減する方式としては、図6に示す様にADステージ
で分岐命令Dの分岐先アドレスが確定するときに、予測
と反対方向の命令取出しに起動をかける方式がある。
Execution T number (6T) of the branch instruction shown in FIG.
As a method of reducing the above, there is a method of activating an instruction fetch in the direction opposite to the prediction when the branch destination address of the branch instruction D is determined in the AD stage as shown in FIG.

【0022】分岐命令Dの実行T数は4Tになるが、分
岐命令Dの実行結果を待たずして予測と反対方向の命令
取出しを行うために、分岐命令Dに関する予測が成功す
る場合は、予測と反対方向の命令取出し動作は中止さ
れ、予測方向の先取りが継続される。
The number T of executions of the branch instruction D is 4T, but since the instruction fetch in the opposite direction to the prediction is performed without waiting for the execution result of the branch instruction D, if the prediction for the branch instruction D succeeds, The instruction fetch operation in the direction opposite to the prediction is stopped, and the prefetch in the prediction direction is continued.

【0023】しかしながら、予測と反対方向の命令取出
し動作によって予測方向の先取りが中断されることにな
り、メモリの索引効率が低下し、命令供給能力が低下す
る。また、前述した如く、NoGo側の命令Eに対して
は、命令取出し動作が2回実行され、メモリの索引効率
が同様に低下し、命令供給能力が低下するという欠点が
ある。
However, prefetching in the prediction direction is interrupted by the instruction fetching operation in the direction opposite to the prediction, so that the memory indexing efficiency is lowered and the instruction supply capability is lowered. Further, as described above, the instruction fetch operation is executed twice for the instruction E on the NoGo side, the index efficiency of the memory is similarly reduced, and the instruction supply capability is reduced.

【0024】[0024]

【発明の目的】本発明の目的は、分岐Go予測失敗時の
分岐命令実行の高速化を図ると共に、メモリ索引効率を
向上させて命令供給能力を向上可能とした命令先取り装
置を提供することである。
SUMMARY OF THE INVENTION An object of the present invention is to provide an instruction prefetching device capable of speeding up the execution of a branch instruction when a branch Go prediction fails and improving the memory index efficiency to improve the instruction supply capability. is there.

【0025】[0025]

【発明の構成】本発明による命令先取り装置は、命令取
出しアドレスレジスタのアドレスによりメモリから命令
を取出して命令先取りバッファに格納すると同時に前記
アドレスにより分岐予測手段を索引して分岐予測アドレ
スを生成する第1のステージと、前記命令先取りバッフ
ァの命令を次段の命令解読ステージへ供給すると同時に
前記分岐予測先アドレスを前記命令取出しアドレスレジ
スタに供給する第2のステージとからなる命令先取りス
テージを有するパイプライン処理方式の情報処理装置に
おける命令先取り装置であって、メモリから読出された
分岐命令を含む命令ワードを前記命令先取りバッファに
格納する際に、前記分岐予測手段により分岐Go予測さ
れた分岐命令を含む命令ワードを前記命令先取りバッフ
ァに格納し、続いて前記分岐命令の分岐NoGo方向の
命令を含む命令ワードを分岐NoGoワードとして連続
して前記命令先取りバッファに格納制御する手段と、前
記分岐Go予測された分岐命令が実行されて分岐予測失
敗して分岐NoGoと判定された場合に、前記命令先取
りバッファに格納されている前記分岐NoGoワードの
命令を前記命令解読ステージへ供給し、その後の命令先
取りは前記分岐NoGoワードの後続ワードから開始す
るよう制御する手段とを含むことを特徴としている。
The instruction prefetching apparatus according to the present invention fetches an instruction from the memory by the address of the instruction fetch address register and stores it in the instruction prefetch buffer, and at the same time indexes the branch prediction means by the address to generate a branch predicted address. A pipeline having an instruction prefetch stage consisting of one stage and a second stage for supplying the instruction of the instruction prefetch buffer to the instruction decode stage of the next stage and at the same time supplying the branch prediction destination address to the instruction fetch address register. An instruction prefetching device in an information processing apparatus of a processing system, including a branch instruction predicted to branch Go by the branch prediction means when storing an instruction word including a branch instruction read from a memory in the instruction prefetching buffer. Store an instruction word in the instruction prefetch buffer, Means for continuously storing and controlling an instruction word including an instruction in the branch NoGo direction of the branch instruction as a branch NoGo word in the instruction prefetch buffer, and the branch Go predicted branch instruction is executed to cause branch prediction failure and branch When it is determined to be NoGo, the instruction of the branch NoGo word stored in the instruction prefetch buffer is supplied to the instruction decoding stage, and subsequent instruction prefetch is controlled to start from the subsequent word of the branch NoGo word. And means.

【0026】[0026]

【実施例】以下、図面を用いて本発明の実施例について
詳細に説明する。
Embodiments of the present invention will be described in detail below with reference to the drawings.

【0027】図1は本発明の実施例のブロック図であ
り、図3と同等部分は同一符号により示している。本例
では、分岐NoGoワードの分岐予測先アドレスを格納
するレジスタ19と、このレジスタ19とレジスタ15
との出力を選択して命令取出しアドレスレジスタ11へ
供給する選択回路18とが付加されて構成されている。
FIG. 1 is a block diagram of an embodiment of the present invention, and the same portions as those in FIG. 3 are designated by the same reference numerals. In this example, the register 19 that stores the branch prediction destination address of the branch NoGo word, the register 19 and the register 15
And a selection circuit 18 for selecting the output of and to supply it to the instruction fetch address register 11.

【0028】命令取出しアドレスレジスタ11には、メ
モリ12から読出す命令のアドレスが保持されており、
メモリ12、分岐予測機能13、カウンタ17に夫々保
持アドレス2が供給される。
The instruction fetch address register 11 holds the address of the instruction read from the memory 12,
The holding address 2 is supplied to the memory 12, the branch prediction function 13, and the counter 17, respectively.

【0029】命令メモリ12から命令ワード単位(例え
ば、1命令を4バイトとし、1ワードを8バイトとする
と、1回の命令メモリ12からの読出し動作で2命令取
出せる)で読出され、命令先取りバッファ14に格納さ
れる。同じサイクルで分岐予測機能13が索引され、分
岐Go予測の場合、分岐予測先アドレスが生成される
と、分岐予測先アドレスレジスタ15にセットされる。
Instructions are read from the instruction memory 12 in units of instruction words (for example, if one instruction is 4 bytes and one word is 8 bytes, two instructions can be fetched by one read operation from the instruction memory 12), and instruction prefetching is performed. It is stored in the buffer 14. In the same cycle, the branch prediction function 13 is indexed, and in the case of branch Go prediction, when the branch prediction destination address is generated, it is set in the branch prediction destination address register 15.

【0030】同じサイクルで、カウンタ17によって命
令取出しアドレスは後続のワードを取出すために8バイ
ト分加算され、命令取出しアドレスレジスタ11にセッ
トされる。
In the same cycle, the instruction fetch address is added by 8 bytes to fetch the subsequent word by the counter 17 and set in the instruction fetch address register 11.

【0031】上記動作により分岐Go予測として動作し
た場合、命令先取りバッファ14には、分岐命令を含む
ワードの命令列が格納されており、分岐予測先アドレス
レジスタ15には、分岐Go予測された分岐命令に対す
る分岐予測先アドレスがセットされており、命令取出し
アドレスレジスタ11には、分岐Go予測された分岐命
令を含むワードの後続ワード、すなわち、分岐命令のN
oGo方向の命令を含むワードのアドレスがセットされ
ている。次のサイクルで命令先取りバッファ14に格納
されている命令はDCステージに供給される。
When the branch Go prediction is performed by the above operation, the instruction prefetch buffer 14 stores an instruction string of words including a branch instruction, and the branch prediction destination address register 15 stores the branch Go predicted branch. The branch prediction destination address for the instruction is set, and the instruction fetch address register 11 stores the subsequent word of the word including the branch instruction predicted to branch Go, that is, N of the branch instruction.
The address of the word containing the instruction in the oGo direction is set. In the next cycle, the instruction stored in the instruction prefetch buffer 14 is supplied to the DC stage.

【0032】同じサイクルで分岐予測先アドレスレジス
タ15にセットされている分岐予測先アドレスは、選択
回路18を経て命令取出しアドレスレジスタ11にセッ
トされる。同じサイクルで命令取出しアドレスレジスタ
11にセットされていた分岐NoGoワードのアドレス
により、命令メモリ12から分岐NoGoワードが読出
され、図2に示される命令バッファ内の分岐Go予測ワ
ードに連続するワードに保持される。次のサイクル以降
は、命令取出しアドレスレジスタ11にセットされてい
る分岐予測先アドレスから命令の取出しが続けられ、命
令先取りバッファ14からは予測に従った命令がDCス
テージへ供給される。
The branch prediction destination address set in the branch prediction destination address register 15 in the same cycle is set in the instruction fetch address register 11 via the selection circuit 18. The branch NoGo word is read from the instruction memory 12 by the address of the branch NoGo word set in the instruction fetch address register 11 in the same cycle, and held in a word continuous to the branch Go predicted word in the instruction buffer shown in FIG. To be done. After the next cycle, the instruction fetching is continued from the branch prediction destination address set in the instruction fetching address register 11, and the instruction fetching buffer 14 supplies the instruction according to the prediction to the DC stage.

【0033】分岐命令が実行され、分岐予測が失敗し分
岐NoGoと判定された場合に、図2に示されている命
令バッファ内の分岐Go予測ワードに連続するワードに
保持されている分岐NoGo側の命令をDCステージに
供給する。
When the branch instruction is executed, the branch prediction fails, and it is determined to be the branch NoGo, the branch NoGo side held in the word consecutive to the branch Go predicted word in the instruction buffer shown in FIG. 2 is held. Is supplied to the DC stage.

【0034】同じサイクルで、アドレスリカバリ機能1
6は分岐NoGoワードに後続するアドレスを生成し、
命令取出しアドレスレジスタ11にセットする。次のサ
イクル以降は、命令取出しアドレスレジスタ11にセッ
トされた分岐NoGoワードに後続するアドレスから命
令の取出しが続けられ、命令先取りバッファ14に格納
される。
In the same cycle, the address recovery function 1
6 generates the address following the branch NoGo word,
It is set in the instruction fetch address register 11. After the next cycle, the instruction fetch is continued from the address subsequent to the branch NoGo word set in the instruction fetch address register 11 and stored in the instruction prefetch buffer 14.

【0035】上記動作により、図4に示される命令列を
実行した場合、図7に示されるようになる。図7におい
て、タイミングT2 において分岐命令Dが分岐Go予測
され、分岐予測先アドレスが生成された場合、タイミン
グT3 において、従来捨てられていた分岐NoGo側の
命令E,Fは図2に示される命令先取りバッファ内の分
岐Go予測ワードに連続するワードに保持される。
When the instruction sequence shown in FIG. 4 is executed by the above operation, it becomes as shown in FIG. In FIG. 7, when the branch instruction D is predicted to branch Go at timing T2 and a branch prediction target address is generated, the instructions E and F on the branch NoGo side that were conventionally discarded at timing T3 are the instructions shown in FIG. It is held in words that follow the branch Go prediction word in the prefetch buffer.

【0036】タイミングT8 において、分岐Go予測失
敗と判定された場合、タイミングT9 においてDCステ
ージに対して図2に示される命令先取りバッファ内の分
岐Go予測ワードに連続するワードに保持されていた命
令Eが供給され、IFAステージのアドレスは図1のア
ドレスリカバリ機能16によって分岐NoGoワードの
後続のワードのアドレスが生成され、図1の命令取出し
アドレスレジスタ11にセットされる。
When it is determined that the branch Go prediction has failed at the timing T8, the instruction E held in the word succeeding the branch Go prediction word in the instruction prefetch buffer shown in FIG. 2 for the DC stage at the timing T9. 1, the address of the IFA stage is generated by the address recovery function 16 of FIG. 1 to generate the address of the word following the branch NoGo word, and is set in the instruction fetch address register 11 of FIG.

【0037】従って、図7に示すように、分岐命令Dの
実行T数は4Tとなり、分岐NoGo側の命令E,Fに
対するメモリアクセスも1回で済む。また、図6を用い
て前述した分岐命令がADステージで分岐先アドレスが
確定する時に予測と反対方向の命令取出しに起動をかけ
る方式を用いなくても、分岐命令の実行T数が高速化さ
れ、しかも、不用な命令取出し動作も必要なくなり、メ
モリ索引効率が向上する。
Therefore, as shown in FIG. 7, the number of executions T of the branch instruction D is 4T, and the memory access to the instructions E and F on the branch NoGo side is only required once. Further, even if the method of activating the instruction fetch in the opposite direction to the prediction when the branch destination address is determined in the AD stage of the branch instruction described above with reference to FIG. Moreover, the unnecessary instruction fetching operation is not necessary, and the memory index efficiency is improved.

【0038】次に、図1の分岐NoGoワードの分岐予
測先アドレス保持レジスタ19を用いた動作について、
先述の動作例と相違している部分についてのみ詳細に説
明する。
Next, regarding the operation using the branch prediction destination address holding register 19 of the branch NoGo word of FIG.
Only the parts that are different from the above-described operation example will be described in detail.

【0039】図1を参照すると、分岐Go予測が行わ
れ、図2に示す命令先取りバッファ内の分岐Go予測ワ
ードに連続するワードに分岐NoGoワードがセットさ
れるのと同じサイクルにおいて、分岐NoGoワードに
対しても分岐予測機能13によって分岐予測が行われて
いる。従って、分岐NoGoワード内に分岐命令が存在
し、分岐Go予測された場合に、分岐予測機能13から
は、分岐NoGo側ワード内の分岐命令に対する分岐予
測先アドレスが生成される。その分岐予測先アドレスは
分岐NoGoワードの分岐予測先アドレス保持レジスタ
19に保持される。
Referring to FIG. 1, in the same cycle in which the branch Go prediction is performed and the branch NoGo word is set in a word following the branch Go prediction word in the instruction prefetch buffer shown in FIG. 2, the branch NoGo word is set. Also, the branch prediction is performed by the branch prediction function 13. Therefore, when a branch instruction exists in the branch NoGo word and the branch Go is predicted, the branch prediction function 13 generates a branch prediction destination address for the branch instruction in the branch NoGo side word. The branch prediction destination address is held in the branch prediction destination address holding register 19 of the branch NoGo word.

【0040】分岐予測が失敗し分岐NoGoと判定され
た場合に、分岐NoGo側の命令が図2に示される命令
先取りバッファ内の分岐Go予測ワードに連続するワー
ドから供給される。同じサイクルで、分岐NoGoワー
ドの分岐予測先アドレス保持レジスタ19から、分岐N
oGoワードの分岐命令に対する分岐予測先アドレスは
選択回路18に与えられ、選択回路18によりこのアド
レスが選択され、命令取出しアドレスレジスタ11にセ
ットされる。これにより、分岐NoGoワード内の分岐
命令に対する分岐予測先アドレスの命令の先取りが開始
される。
When the branch prediction fails and it is determined to be the branch NoGo, the instruction on the branch NoGo side is supplied from the word consecutive to the branch Go predicted word in the instruction prefetch buffer shown in FIG. In the same cycle, from the branch prediction destination address holding register 19 of the branch NoGo word, branch N
The branch prediction destination address for the branch instruction of the oGo word is given to the selection circuit 18, and this address is selected by the selection circuit 18 and set in the instruction fetch address register 11. As a result, prefetching of the instruction of the branch prediction destination address for the branch instruction in the branch NoGo word is started.

【0041】従って、分岐NoGoワード内に存在する
分岐命令に対しても分岐予測が有効となり、分岐予測率
が向上し、命令先取りに関する機能の有効利用が図れ
る。
Therefore, the branch prediction is effective for the branch instruction existing in the branch NoGo word, the branch prediction rate is improved, and the function relating to the instruction prefetching can be effectively used.

【0042】図8に示す命令列を、第1の実施例で実行
した結果を図9に、第2の実施例で実行した結果を図1
0に夫々示す。
FIG. 9 shows the result of execution of the instruction sequence shown in FIG. 8 in the first embodiment, and FIG. 1 shows the result of execution in the second embodiment.
0 is shown respectively.

【0043】図8の分岐命令Bが分岐Go予測され、分
岐命令BのNoGo側の命令である分岐命令Dに対して
も、分岐予測機能により分岐予測先アドレスの生成が可
能な状態で、分岐命令Bは分岐予測失敗し、結果NoG
oとなり分岐命令Dは、結果Goとなる場合について説
明する。
The branch instruction B of FIG. 8 is predicted to branch Go, and the branch instruction D is a NoGo-side instruction of the branch instruction B. Instruction B failed in branch prediction, resulting in NoG
The case where the branch instruction D becomes o and the branch instruction D becomes the result Go will be described.

【0044】図8に示される命令が前記のような実行状
態で実行された場合、第1の実施例では、図9で示すよ
うに、タイミングT2 において、分岐NoGoワード内
の分岐命令Dに対する分岐予測先アドレスが生成されて
いるにもかかわらず、保持する手段を持たないために捨
てられてしまう。
When the instruction shown in FIG. 8 is executed in the execution state as described above, in the first embodiment, as shown in FIG. 9, at the timing T2, the branch to the branch instruction D in the branch NoGo word is executed. Although the predicted address is generated, it is discarded because it has no means for holding it.

【0045】従って、分岐命令Bが分岐予測失敗し、結
果NoGoとなった場合、タイミングT11において、分
岐命令Dは、分岐予測先アドレスが存在しないため、分
岐NoGo予測として扱われ、分岐NoGo予測失敗と
なり、実行に6Tを要してしまう。
Therefore, when the branch instruction B fails the branch prediction and the result is NoGo, the branch instruction D is treated as the branch NoGo prediction at timing T11 because the branch prediction destination address does not exist, and the branch NoGo prediction failure occurs. Therefore, it takes 6T to execute.

【0046】上記の問題点を解決したのが第2の実施例
であり、図10で示すように、タイミングT2 におい
て、分岐NoGoワード内の分岐命令Dに対する分岐予
測先アドレスを捨てることなく図1の分岐NoGoワー
ドの分岐予測先アドレス保持レジスタ19に保持するこ
とにより、分岐NoGoワード内の分岐命令Dに対する
分岐予測を可能としている。
The second embodiment solves the above-mentioned problem, and as shown in FIG. 10, at timing T2, the branch prediction destination address for the branch instruction D in the branch NoGo word is not discarded and the branch prediction destination address shown in FIG. By holding the branch NoGo word of the branch NoGo word in the branch prediction destination address holding register 19, the branch prediction for the branch instruction D in the branch NoGo word is possible.

【0047】タイミングT6 において、分岐命令Bが分
岐Go予測失敗と判定された場合に、タイミングT7 に
おいて、図1の分岐NoGoワードの分岐予測先アドレ
スレジスタ19に保持されていた分岐NoGoワード内
の分岐命令Dに対する分岐予測先アドレスが、選択回路
18に与えられ、選択回路18により命令先取アドレス
レジスタ11にセットされる。
When it is determined that the branch instruction B fails in branch Go prediction at timing T6, at timing T7, the branch in the branch NoGo word held in the branch prediction destination address register 19 of the branch NoGo word in FIG. 1 is branched. The branch prediction destination address for the instruction D is given to the selection circuit 18 and set in the instruction prefetch address register 11 by the selection circuit 18.

【0048】従って、NoGoワード内の分岐命令Dに
対する分岐予測が有効になり、タイミングT11におい
て、分岐Go予測成功となり分岐命令Dの実行は1Tで
行われる。
Therefore, the branch prediction for the branch instruction D in the NoGo word becomes valid, the branch Go prediction succeeds at the timing T11, and the execution of the branch instruction D is performed at 1T.

【0049】[0049]

【発明の効果】以上説明したように、本発明によれば、
分岐Go予測が失敗した時に、分岐命令の実行の高速化
を図ることが可能となると共に、メモリ索引効率を向上
させて命令供給能力を向上させるという効果がある。
As described above, according to the present invention,
When the branch Go prediction fails, it is possible to speed up the execution of the branch instruction and improve the memory index efficiency to improve the instruction supply capability.

【0050】また、ハードウェア量の増加が少ないとい
う利点があり、さらに、命令バッファ内のワードは、分
岐NoGoワードのために固定領域を用意しないので、
分岐Go予測が行われない限り、有効に利用できるとい
う利点もある。
Further, there is an advantage that the increase in the amount of hardware is small, and further, since the word in the instruction buffer does not have a fixed area for the branch NoGo word,
There is also an advantage that it can be effectively used unless branch Go prediction is performed.

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

【図1】本発明の実施例のブロック図である。FIG. 1 is a block diagram of an embodiment of the present invention.

【図2】命令先取りバッファ14の内部の命令格納形式
を示す図である。
FIG. 2 is a diagram showing an instruction storage format inside an instruction prefetch buffer.

【図3】従来の命令先取り装置のブロック図である。FIG. 3 is a block diagram of a conventional instruction prefetching device.

【図4】分岐命令を有する命令列の一例を示す図であ
る。
FIG. 4 is a diagram showing an example of an instruction sequence having a branch instruction.

【図5】従来方式による分岐Go予測が予測失敗したと
きの実行経過の一例を示すタイムチャートである。
FIG. 5 is a time chart showing an example of execution progress when branch Go prediction by the conventional method fails in prediction.

【図6】従来方式による分岐Go予測が予測失敗したと
きの実行過程の他の例を示すタイムチャートである。
FIG. 6 is a time chart showing another example of the execution process when the branch Go prediction by the conventional method fails in prediction.

【図7】本発明の第1の実施例による分岐Go予測が予
測失敗したときの実行過程を示すタイムチャートであ
る。
FIG. 7 is a time chart showing an execution process when branch Go prediction fails in prediction according to the first embodiment of the present invention.

【図8】本発明の実施例に用いる命令列を示す図であ
る。
FIG. 8 is a diagram showing an instruction sequence used in an embodiment of the present invention.

【図9】第1の実施例により図8の命令列を実行する過
程を示すタイムチャートである。
FIG. 9 is a time chart showing a process of executing the instruction sequence of FIG. 8 according to the first embodiment.

【図10】第2の実施例により図8の命令列を実行する
過程を示すタイムチャートである。
FIG. 10 is a time chart showing a process of executing the instruction sequence of FIG. 8 according to the second embodiment.

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

11 命令取出しアドレスレジスタ 12 命令メモリ 13 分岐予測機能 14 命令先取りバッファ 15 分岐予測先アドレスレジスタ 16 アドレスリカバリ機能 17 カウンタ 18 選択回路 19 分岐NoGoワードの分岐予測先アドレスレジス
11 instruction fetch address register 12 instruction memory 13 branch prediction function 14 instruction prefetch buffer 15 branch prediction destination address register 16 address recovery function 17 counter 18 selection circuit 19 branch NoGo word branch prediction destination address register

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 命令取出しアドレスレジスタのアドレス
によりメモリから命令を取出して命令先取りバッファに
格納すると同時に前記アドレスにより分岐予測手段を索
引して分岐予測アドレスを生成する第1のステージと、
前記命令先取りバッファの命令を次段の命令解読ステー
ジへ供給すると同時に前記分岐予測先アドレスを前記命
令取出しアドレスレジスタに供給する第2のステージと
からなる命令先取りステージを有するパイプライン処理
方式の情報処理装置における命令先取り装置であって、
メモリから読出された分岐命令を含む命令ワードを前記
命令先取りバッファに格納する際に、前記分岐予測手段
により分岐Go予測された分岐命令を含む命令ワードを
前記命令先取りバッファに格納し、続いて前記分岐命令
の分岐NoGo方向の命令を含む命令ワードを分岐No
Goワードとして連続して前記命令先取りバッファに格
納制御する手段と、前記分岐Go予測された分岐命令が
実行されて分岐予測失敗して分岐NoGoと判定された
場合に、前記命令先取りバッファに格納されている前記
分岐NoGoワードの命令を前記命令解読ステージへ供
給し、その後の命令先取りは前記分岐NoGoワードの
後続ワードから開始するよう制御する手段とを含むこと
を特徴とする命令先取り装置。
1. A first stage for fetching an instruction from a memory by an address of an instruction fetch address register and storing it in an instruction prefetch buffer, and at the same time indexing a branch prediction means by the address to generate a branch predicted address.
Information processing in a pipeline processing system having an instruction prefetch stage consisting of a second stage for supplying the instruction of the instruction prefetch buffer to the next instruction decoding stage and at the same time supplying the branch prediction destination address to the instruction fetch address register An instruction prefetching device in the device,
When the instruction word including the branch instruction read from the memory is stored in the instruction prefetch buffer, the instruction word including the branch instruction predicted to branch Go by the branch predicting unit is stored in the instruction prefetch buffer, and then the instruction word is stored. Branch No. of the branch instruction Branch No to the instruction word containing the Go direction instruction
Means for successively controlling storage in the instruction prefetch buffer as a Go word and stored in the instruction prefetch buffer when the branch Go predicted branch instruction is executed and branch prediction fails and branch NoGo is determined. Means for supplying an instruction of said branch NoGo word to the instruction decoding stage and controlling subsequent instruction prefetching to start from a subsequent word of said branch NoGo word.
【請求項2】 前記分岐予測手段により分岐Go予測さ
れた分岐命令の分岐先アドレスを格納する分岐予測先ア
ドレスレジスタと、前記分岐予測手段により予測が行わ
れた前記分岐NoGoワード内に含まれている分岐命令
に対する分岐予測先アドレスを保持する分岐NoGoワ
ード分岐予測先アドレスレジスタと、これ等両レジスタ
の出力を選択して前記命令取出しレジスタへ格納制御す
る手段とを含むことを特徴とする請求項1記載の命令先
取り装置。
2. A branch prediction target address register for storing a branch target address of a branch instruction predicted to branch Go by the branch prediction unit, and a branch NoGo word predicted by the branch prediction unit. 7. A branch NoGo word branch prediction destination address register for holding a branch prediction destination address for an existing branch instruction, and means for selecting outputs of these two registers and storing them in the instruction fetch register. 1. The instruction prefetching device described in 1.
JP35387791A 1991-12-18 1991-12-18 Instruction prefetch device Pending JPH05165634A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP35387791A JPH05165634A (en) 1991-12-18 1991-12-18 Instruction prefetch device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP35387791A JPH05165634A (en) 1991-12-18 1991-12-18 Instruction prefetch device

Publications (1)

Publication Number Publication Date
JPH05165634A true JPH05165634A (en) 1993-07-02

Family

ID=18433830

Family Applications (1)

Application Number Title Priority Date Filing Date
JP35387791A Pending JPH05165634A (en) 1991-12-18 1991-12-18 Instruction prefetch device

Country Status (1)

Country Link
JP (1) JPH05165634A (en)

Similar Documents

Publication Publication Date Title
KR101225075B1 (en) System and method of selectively committing a result of an executed instruction
US6338136B1 (en) Pairing of load-ALU-store with conditional branch
JP2603626B2 (en) Data processing device
US8006072B2 (en) Reducing data hazards in pipelined processors to provide high processor utilization
JPH1124929A (en) Arithmetic processing unit and its method
JP3212213B2 (en) Data processing device
US20070220235A1 (en) Instruction subgraph identification for a configurable accelerator
JPH02287626A (en) Pipeline system branch instruction controller
JPH05173785A (en) Instruction prefetching device
JP2771373B2 (en) Instruction prefetch device
JPH05165634A (en) Instruction prefetch device
JPH05165635A (en) Instruction prefetch device
JPH05173784A (en) Instruction prefetching device
JPH05165636A (en) Instruction prefetch device
JP2636136B2 (en) Arithmetic processing device and arithmetic processing method
JP2843844B2 (en) Parallel processing unit
JP2007317083A (en) Microprocessor and pipeline control method
JP2591325B2 (en) Branch control device
JPS60241136A (en) Data processor
JP2503223B2 (en) Prior control method
JP2545594B2 (en) Operand data prefetching method
JP3668643B2 (en) Information processing device
JPH03154926A (en) System and device for prefetching instruction
JPH07191845A (en) Immediate data transfer device
JPH06314196A (en) Method and device for processing information