JP2771373B2 - Instruction prefetch device - Google Patents

Instruction prefetch device

Info

Publication number
JP2771373B2
JP2771373B2 JP35387691A JP35387691A JP2771373B2 JP 2771373 B2 JP2771373 B2 JP 2771373B2 JP 35387691 A JP35387691 A JP 35387691A JP 35387691 A JP35387691 A JP 35387691A JP 2771373 B2 JP2771373 B2 JP 2771373B2
Authority
JP
Japan
Prior art keywords
instruction
branch
prediction
word
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.)
Expired - Lifetime
Application number
JP35387691A
Other languages
Japanese (ja)
Other versions
JPH05165633A (en
Inventor
雅則 数野
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 JP35387691A priority Critical patent/JP2771373B2/en
Publication of JPH05165633A publication Critical patent/JPH05165633A/en
Application granted granted Critical
Publication of JP2771373B2 publication Critical patent/JP2771373B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)

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 employing a pipeline processing method for prefetching instructions using branch prediction means.

【0002】[0002]

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

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

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

【0005】すなわち、この様な方式では、命令先取り
の予測が適中する限りにおいては、分岐命令を高速に実
行できる効果がある。
That is, such a method has an effect that a branch instruction can be executed at a high speed as long as prediction of 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 the following stages, provides hardware for performing the functions of the stages, and sequentially executes each stage cycle. It is controlled so that it can be executed in one stage cycle per instruction apparently by executing it all over.

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

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

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

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

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

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

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

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

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

【0016】命令メモリ12(このメモリは主記憶でも
キャッシュメモリでも可)からの命令は命令先取りバッ
ファ14に格納されてDCステージへの命令供給がなさ
れる。同時に分岐予測機能13により分岐予測が行われ
て分岐予測先アドレスが生成され、これが分岐予測先ア
ドレスレジスタ15にセットされる。
An instruction from an instruction memory 12 (this memory may be a main memory or a cache memory) is stored in an 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 from the branch prediction destination address register 15 to the instruction fetch address register 11, and the instruction of the prediction destination is fetched. The address recovery function 16 sets a new address for fetching an instruction when the branch prediction fails, in the instruction fetch register 11.

【0018】図3に示した従来の命令先取り方式では、
図4に示す命令列を実行する場合、図5に示す様に、分
岐命令Dの分岐予測がIFBステージで行われ、このI
FBステージで生成された分岐予測先アドレス100 の命
令L,Mを取出すまでの間に、既に命令取出しを行って
いる分岐Go側の命令E,Fは無効な命令として捨てら
れている。従って、メモリの索引効率が低下し、命令供
給能力が低下する原因になるという欠点がある。
In the conventional instruction prefetching method shown in FIG.
When executing the instruction sequence shown in FIG. 4, the branch prediction of the branch instruction D is performed in the IFB stage as shown in FIG.
By the time the instructions L and M at the branch prediction destination address 100 generated at the FB stage are fetched, the instructions E and F on the branch Go which have already been fetched are discarded as invalid instructions. Therefore, there is a drawback that the index 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 in the instruction sequence shown in FIG. 4 is predicted by the branch Go and the branch prediction fails and the branch is determined to be NoGo, as shown in FIG.
As for the instruction E on the NoGo side, the timing T
In No. 3, although the instruction has been fetched from the memory 12, it is discarded because it is an instruction on the NoGo side.

【0020】分岐命令Dの実行によりNoGoと判定さ
れたとき、再びNoGo側の命令Eを取出しているの
で、命令取出し動作が同一命令に対して2回実行される
ことになり、命令取出しのメモリ索引効率が低下し、命
令供給能力が低下するという欠点がある。
When it is determined as NoGo by the execution of the branch instruction D, the instruction E on the NoGo side is fetched again, so that the instruction fetch operation is executed twice for the same instruction, and the memory for instruction fetch is executed. There is a disadvantage 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 shown in FIG. 6, when the branch destination address of the branch instruction D is determined in the AD stage as shown in FIG. 6, there is a method of activating the instruction fetch in the direction opposite to the prediction.

【0022】分岐命令Dの実行T数は4Tになるが、分
岐命令Dの実行結果を待たずして予測と反対方向の命令
取出しを行うために、分岐命令Dに関する予測が成功す
る場合は、予測と反対方向の命令取出し動作は中止さ
れ、予測方向の先取りが継続される。
The number of executions T of the branch instruction D is 4T. However, in order to fetch the instruction in the opposite direction to the prediction without waiting for the execution result of the branch instruction D, if the prediction relating to 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 fetch operation in the direction opposite to the prediction, so that the index efficiency of the memory is reduced and the instruction supply capability is reduced. Further, as described above, the instruction fetch operation is performed twice for the instruction E on the NoGo side, so that the index efficiency of the memory is similarly reduced, and the instruction supply capability is reduced.

【0024】[0024]

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

【0025】[0025]

【発明の構成】本発明による命令取出し装置は、命令取
出しアドレスレジスタのアドレスによりメモリから命令
を取出して命令先取りバッファに格納すると同時に前記
アドレスにより分岐予測手段を索引して分岐予測アドレ
スを生成する第1のステージと、前記命令先取りバッフ
ァの命令を次段の命令解読ステージへ供給すると同時に
前記分岐予測先アドレスを前記命令取出しアドレスレジ
スタに供給する第2のステージとからなる命令先取りス
テージを有し、前記第1のステージにおける前記メモリ
からの命令取出しは2命令同時に行い、前記命令解読ス
テージ以降のステージでは、1命令毎に実行するように
したパイプライン処理方式の情報処理装置における命令
先取り装置であって、メモリから読出された分岐命令を
含む命令ワードを前記命令先取りバッファに格納する際
に、前記分岐予測手段により分岐Go予測された第1〜
第N(Nは2以上の整数)の分岐命令を含む命令ワード
を前記命令先取りバッファに夫々格納し、これ等命令ワ
ードの各々に続いて前記第1〜第Nの分岐命令の分岐N
oGo方向の命令を含む命令ワードを分岐NoGoワー
ドとして夫々連続して前記命令先取りバッファに格納制
御する手段と、前記分岐Go予測された分岐命令が実行
されて分岐予測失敗して分岐NoGoと判定された場合
に、前記命令先取りバッファに格納されている前記分岐
NoGoワードの命令を前記命令解読ステージへ供給
し、その後の命令先取りは前記分岐NoGoワードの後
続ワードから開始するよう制御する手段とを含むことを
特徴とする。
An instruction fetch apparatus according to the present invention fetches an instruction from a memory according to an address of an instruction fetch address register and stores it in an instruction prefetch buffer, and at the same time, indexes a branch prediction means by the address to generate a branch prediction address. a first stage, an instruction prefetch stage and a second stage of supplying the predicted branch target address and at the same time fed to the next instruction decoding stage instruction of the instruction prefetch buffer to the instruction fetch address register possess, The memory in the first stage
Instruction fetching is performed simultaneously for two instructions, and the instruction decoding
At the stage after the stage, it is executed every instruction
An instruction prefetching device in an information processing device of the pipelined processing method, wherein when storing an instruction word including a branch instruction read from a memory in the instruction prefetching buffer, a branch Go predicted by the branch predicting means. 1 to
The instruction words including the Nth (N is an integer of 2 or more) branch instructions are stored in the instruction prefetch buffer, and each of these instruction words is followed by a branch N of the first to Nth branch instructions.
means for continuously storing instruction words including an instruction in the oGo direction as a branch NoGo word in the instruction prefetch buffer; and execution of the branch instruction predicted by the branch Go, failure of branch prediction and determination of a branch NoGo. Supplying the instruction of the branch NoGo word stored in the instruction prefetch buffer to the instruction decoding stage, and controlling the subsequent instruction prefetch to start from the succeeding word of the branch NoGo word. It is characterized by the following.

【0026】[0026]

【実施例】以下、図面を用いて本発明の実施例について
詳細に説明する。
Embodiments of the present invention will be described below in detail 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 parts as those in FIG. 3 are denoted by the same reference numerals. In this example, a register group 19 for storing a plurality of branch prediction destination addresses of a branch NoGo word, and a selection circuit 18 for selecting the outputs of the register group 19 and the register 15 and supplying the output to the instruction fetch address register 11 are added. It is configured.

【0028】命令取出しアドレスレジスタ11には、メ
モリ12から読出す命令のアドレスが保持されており、
メモリ12、分岐予測機能13、カウンタ17に夫々保
持アドレス2が供給される。
The instruction fetch address register 11 holds the address of an instruction to be 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にセットされる。
The instruction memory 12 is read in instruction word units (for example, if one instruction is 4 bytes and one word is 8 bytes, two instructions can be fetched by one reading operation from the instruction memory 12), and the instruction prefetching is performed. The data 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 a 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 by the counter 17 to fetch the subsequent word, and is set in the instruction fetch address register 11.

【0031】上記動作により分岐Go予測として動作し
た場合、命令先取りバッファ14には、分岐命令を含む
ワードの命令列が格納されており、分岐予測先アドレス
レジスタ15には、分岐Go予測された分岐命令に対す
る分岐予測先アドレスがセットされており、命令取出し
アドレスレジスタ11には、分岐Go予測された分岐命
令を含むワードの後続ワード、すなわち、分岐命令のN
oGo方向の命令を含むワードのアドレスがセットされ
ている。次のサイクルで命令先取りバッファ14に格納
されている命令はDCステージに供給される。
When the operation is performed as the branch Go prediction by the above operation, the instruction prefetch buffer 14 stores the instruction sequence of the word including the 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, in the instruction fetch address register 11, the word following the word including the branch instruction predicted by the branch Go, ie, the 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 address set in the branch prediction address register 15 in the same cycle is set in the instruction fetch address register 11 via the selection circuit 18. In the same cycle, 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 and held in a word following the branch Go prediction word in the instruction buffer shown in FIG. Is done. From the next cycle onward, instruction fetching is continued from the branch prediction destination address set in the instruction fetch address register 11, and the instruction according to the prediction is supplied from the instruction prefetch buffer 14 to the DC stage.

【0033】分岐命令が実行され、分岐予測が失敗し分
岐NoGoと判定された場合に、図2に示されている命
令バッファ内の分岐Go予測ワードに連続するワードに
保持されている分岐NoGo側の命令をDCステージに
供給する。
When the branch instruction is executed and the branch prediction fails and it is determined that the branch is NoGo, the branch NoGo stored in the word following the branch Go prediction word in the instruction buffer shown in FIG. 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,
The instruction fetch address register 11 is set. From the next cycle onward, instruction fetch is continued from the address following 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, the result becomes as shown in FIG. In FIG. 7, when the branch instruction D is predicted to be a branch Go at the timing T2 and a branch prediction destination address is generated, at the timing T3, the instructions E and F on the branch NoGo side conventionally discarded are the instructions shown in FIG. It is held in a word following the branch Go prediction word in the prefetch buffer.

【0036】タイミングT8 において、分岐Go予測失
敗と判定された場合、タイミングT9 においてDCステ
ージに対して図2に示される命令先取りバッファ内の分
岐Go予測ワードに連続するワードに保持されていた命
令Eが供給され、IFAステージのアドレスは図1のア
ドレスリカバリ機能16によって分岐NoGoワードの
後続のワードのアドレスが生成され、図1の命令取出し
アドレスレジスタ11にセットされる。
At timing T8, when it is determined that the branch Go prediction has failed, at the timing T9, the instruction E held in the word following the branch Go prediction word in the instruction prefetch buffer shown in FIG. 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 only one memory access is required for the instructions E and F on the branch NoGo side. Further, the number of execution Ts of the branch instruction can be increased without using the method of activating the instruction fetch in the direction opposite to the prediction when the branch instruction described above with reference to FIG. In addition, unnecessary instruction fetch operation is not required, and the memory index efficiency is improved.

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

【0039】図1を参照すると、分岐Go予測が行わ
れ、図2に示す命令先取りバッファ内の分岐Go予測ワ
ードに連続するワードに分岐NoGoワードがセットさ
れるのと同じサイクルにおいて、分岐NoGoワードに
対しても分岐予測機能13によって分岐予測が行われて
いる。従って、分岐NoGoワード内に分岐命令が存在
し、分岐Go予測された場合に、分岐予測機能13から
は、分岐NoGo側ワード内の分岐命令に対する分岐予
測先アドレスが生成される。その分岐予測先アドレスは
分岐NoGoワードの分岐予測先アドレス保持レジスタ
群19に保持される。
Referring to FIG. 1, the branch Go prediction is performed, and the branch NoGo word is set in the same cycle as the branch NoGo word is set in the word following the branch Go prediction word in the instruction prefetch buffer shown in FIG. Is also predicted 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 group 19 of the branch NoGo word.

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

【0041】従って、分岐NoGoワード内に存在する
分岐命令に対しても分岐予測が有効となり、分岐予測率
が向上し、命令先取りに関する機能の有効利用が図れ
る。
Accordingly, 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 instruction prefetching can be effectively used.

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

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

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

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

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

【0047】タイミングT6 において、分岐命令Bが分
岐Go予測失敗と判定された場合に、タイミングT7 に
おいて、図1の分岐NoGoワードの分岐予測先アドレ
スレジスタ群19に保持されていた分岐NoGoワード
内の分岐命令Dに対する分岐予測先アドレスが、選択回
路18に与えられ、選択回路18により命令先取アドレ
スレジスタ11にセットされる。
At timing T6, when it is determined that the branch instruction B has failed in branch Go prediction, at timing T7, the branch NoGo word in the branch prediction destination address register group 19 of the branch NoGo word in FIG. The branch prediction destination address for the branch 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, and at the timing T11, the branch Go prediction is successful, and the execution of the branch instruction D is performed at 1T.

【0049】尚、上記実施例では、分岐Go予測が1つ
だけの場合につき説明したが、命令の先取りが進行して
先行する分岐Go予測が実行される前に更に分岐Go予
測が行われる場合がある。
Although the above embodiment has been described with reference to the case where there is only one branch Go prediction, the case where the prefetching of an instruction proceeds and the branch Go prediction is further performed before the preceding branch Go prediction is executed. There is.

【0050】この様な場合、分岐Go予測が行われる度
に前述の動作に従って分岐NoGoワードは図2の命令
先取りバッファ14内の分岐Go予測ワードに連続する
ワードとして順次格納する様にする。そして、分岐No
Goワードに対する分岐予測アドレスは図1の分岐No
Goワードの分岐予測先アドレス保持レジスタ群19に
順次格納するようにするのである。
In such a case, every time the branch Go prediction is performed, the branch NoGo word is sequentially stored as a word following the branch Go prediction word in the instruction prefetch buffer 14 in FIG. And branch No
The branch prediction address for the Go word is the branch number in FIG.
The Go words are sequentially stored in the branch prediction destination address holding register group 19.

【0051】分岐Go予測命令が実行されたとき、分岐
Go予測成功の場合は、実行された分岐Go予測命令に
対応する図2の分岐Go予測ワードに連続するワードの
内容とレジスタ群19の内容とが捨てられる。分岐Go
予測失敗の場合は、前述の動作に従って実行された分岐
Go予測命令に対応するバッファ14内の分岐Go予測
ワードに連続するワードの内容と、レジスタ群19の内
容とが読出され、命令先取り動作が実行される。従っ
て、複数個N(Nは2以上の整数)の分岐Go予測に対
応できることになる。
When the branch Go prediction instruction is executed, if the branch Go prediction is successful, the contents of the word following the branch Go prediction word and the contents of the register group 19 corresponding to the executed branch Go prediction instruction in FIG. Is thrown away. Branch Go
In the case of a prediction failure, the contents of the word following the branch Go prediction word in the buffer 14 corresponding to the branch Go prediction instruction executed according to the above-described operation and the contents of the register group 19 are read, and the instruction prefetch operation is performed. Be executed. Therefore, it is possible to cope with a plurality of N (N is an integer of 2 or more) branch Go predictions.

【0052】[0052]

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

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

【図面の簡単な説明】[Brief description of the 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 14;

【図3】従来の命令先取り装置のブロック図である。FIG. 3 is a block diagram of a conventional instruction prefetch 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 a conventional method fails in prediction.

【図6】従来方式による分岐Go予測が予測失敗したと
きの実行過程の他の例を示すタイムチャートである。
FIG. 6 is a time chart showing another example of the execution process when 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 according to the first embodiment of the present invention.

【図8】本発明の実施例に用いる命令列を示す図であ
る。
FIG. 8 is a diagram showing an instruction sequence used in the 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ワードの分岐予測先アドレスレジス
タ群
DESCRIPTION OF SYMBOLS 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 prediction destination address group of branch NoGo word

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 命令取出しアドレスレジスタのアドレス
によりメモリから命令を取出して命令先取りバッファに
格納すると同時に前記アドレスにより分岐予測手段を索
引して分岐予測アドレスを生成する第1のステージと、
前記命令先取りバッファの命令を次段の命令解読ステー
ジへ供給すると同時に前記分岐予測先アドレスを前記命
令取出しアドレスレジスタに供給する第2のステージと
からなる命令先取りステージを有し、前記第1のステー
ジにおける前記メモリからの命令取出しは2命令同時に
行い、前記命令解読ステージ以降のステージでは、1命
令毎に実行するようにしたパイプライン処理方式の情報
処理装置における命令先取り装置であって、メモリから
読出された分岐命令を含む命令ワードを前記命令先取り
バッファに格納する際に、前記分岐予測手段により分岐
Go予測された第1〜第N(Nは2以上の整数)の分岐
命令を含む命令ワードを前記命令先取りバッファに夫々
格納し、これ等命令ワードの各々に続いて前記第1〜第
Nの分岐命令の分岐NoGo方向の命令を含む命令ワー
ドを分岐NoGoワードとして夫々連続して前記命令先
取りバッファに格納制御する手段と、前記分岐Go予測
された分岐命令が実行されて分岐予測失敗して分岐No
Goと判定された場合に、前記命令先取りバッファに格
納されている前記分岐NoGoワードの命令を前記命令
解読ステージへ供給し、その後の命令先取りは前記分岐
NoGoワードの後続ワードから開始するよう制御する
手段とを含むことを特徴とする命令先取り装置。
A first stage for fetching an instruction from a memory according to 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 prediction address;
Have a command prefetch stage and a second stage of supplying the predicted branch target address and at the same time fed to the next instruction decoding stage instruction of the instruction prefetch buffer to the instruction fetch address register, the first stay
Instruction fetches from the memory at the same time
In the stage after the instruction decoding stage, one life
An instruction prefetching device in a pipeline processing type information processing device which is executed for each instruction, wherein said branch prediction means is used when storing an instruction word including a branch instruction read from a memory in said instruction prefetching buffer. The instruction words including the first to N-th (N is an integer of 2 or more) branch instructions predicted by the branch Go are stored in the instruction prefetch buffer, respectively. Means for continuously controlling the instruction word including the branch NoGo direction instruction of the N branch instructions as the branch NoGo word in the instruction prefetch buffer; and executing the branch instruction predicted by the branch Go and causing the branch prediction failure. Branch No
If it is determined to be Go, the instruction of the branch NoGo word stored in the instruction prefetch buffer is supplied to the instruction decoding stage, and the subsequent instruction prefetch is controlled to start from the word following the branch NoGo word. Means for prefetching instructions.
【請求項2】 前記分岐予測手段により分岐Go予測さ
れた前記第1〜第Nの分岐命令の各分岐先アドレスを格
納する分岐予測先アドレスレジスタと、前記分岐予測手
段により予測が行われた第1〜第Nの前記分岐NoGo
ワード内に含まれている分岐命令に対する各分岐予測先
アドレスを保持する分岐NoGoワード分岐予測先アド
レスレジスタと、これ等両レジスタの出力を選択して前
記命令取出しレジスタへ格納制御する手段とを含むこと
を特徴とする請求項1記載の命令先取り装置。
2. A branch prediction destination address register for storing respective branch destination addresses of the first to N-th branch instructions predicted by the branch prediction means by a Go, and a branch prediction address predicted by the branch prediction means. 1st to Nth branch NoGo
A branch NoGo word branch prediction destination address register for holding each branch prediction destination address for a branch instruction included in a word, and a means for selecting the outputs of both registers and controlling the storage in the instruction fetch register 2. The instruction prefetch device according to claim 1, wherein:
JP35387691A 1991-12-18 1991-12-18 Instruction prefetch device Expired - Lifetime JP2771373B2 (en)

Priority Applications (1)

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

Applications Claiming Priority (1)

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

Publications (2)

Publication Number Publication Date
JPH05165633A JPH05165633A (en) 1993-07-02
JP2771373B2 true JP2771373B2 (en) 1998-07-02

Family

ID=18433823

Family Applications (1)

Application Number Title Priority Date Filing Date
JP35387691A Expired - Lifetime JP2771373B2 (en) 1991-12-18 1991-12-18 Instruction prefetch device

Country Status (1)

Country Link
JP (1) JP2771373B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0281085A (en) * 1988-09-19 1990-03-22 Nippon Raito Service Kk Storing effect facilitating device

Also Published As

Publication number Publication date
JPH05165633A (en) 1993-07-02

Similar Documents

Publication Publication Date Title
EP0394624B1 (en) Multiple sequence processor system
EP0297943B1 (en) Microcode reading control system
JP2771373B2 (en) Instruction prefetch device
EP0079370A4 (en) Digital computer for executing instructions in three time-multiplexed portions.
JPH05173785A (en) Instruction prefetching device
JPH0877021A (en) Device and method for interruption processing
JPH05165636A (en) Instruction prefetch device
JPH05165634A (en) Instruction prefetch device
JPH05165635A (en) Instruction prefetch device
WO2002039272A9 (en) Method and apparatus for reducing branch latency
JPH05173784A (en) Instruction prefetching device
JP2584156B2 (en) Program-controlled processor
JP2894438B2 (en) Pipeline processing equipment
JPS60241136A (en) Data processor
JP3668643B2 (en) Information processing device
JP2503223B2 (en) Prior control method
JP3471691B2 (en) Branch instruction control method in micro instruction
JP2591325B2 (en) Branch control device
JP2843844B2 (en) Parallel processing unit
JP2545594B2 (en) Operand data prefetching method
JPH0348535B2 (en)
JPH0248733A (en) Information processor
JP2636566B2 (en) Pipeline control method
JP5013966B2 (en) Arithmetic processing unit
JPH06314196A (en) Method and device for processing information