JPS5991554A - Instruction prefetch device forecasting branch direction - Google Patents

Instruction prefetch device forecasting branch direction

Info

Publication number
JPS5991554A
JPS5991554A JP20155982A JP20155982A JPS5991554A JP S5991554 A JPS5991554 A JP S5991554A JP 20155982 A JP20155982 A JP 20155982A JP 20155982 A JP20155982 A JP 20155982A JP S5991554 A JPS5991554 A JP S5991554A
Authority
JP
Japan
Prior art keywords
branch
instruction
address
circuit
information
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
JP20155982A
Other languages
Japanese (ja)
Inventor
Ritsuo Sugaya
菅谷 律雄
Shuichi Hanatani
花谷 修一
Masanobu Akagi
赤木 正信
Koemon Nigo
仁後 公衛門
Toshiteru Shibuya
渋谷 俊輝
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Nippon Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp, Nippon Electric Co Ltd filed Critical NEC Corp
Priority to JP20155982A priority Critical patent/JPS5991554A/en
Priority to EP83111451A priority patent/EP0109655B1/en
Priority to DE8383111451T priority patent/DE3382350D1/en
Publication of JPS5991554A publication Critical patent/JPS5991554A/en
Priority to US07/286,021 priority patent/US4984154A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3802Instruction prefetching
    • G06F9/3804Instruction prefetching for branches, e.g. hedging, branch folding
    • G06F9/3806Instruction prefetching for branches, e.g. hedging, branch folding using address prediction, e.g. return stack, branch history buffer
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Advance Control (AREA)

Abstract

PURPOSE:To improve the probability of a forecast in an information processor by storing a pair of a branch direction and an address to be branched in a branch history table, forecasting an address to be branched from the past result, and if the executed branch direction does not coincide with the forecasted, result updating the branch information. CONSTITUTION:The branch history table 410 stores a part of the address of a branch instruction, V bits indicating whether the contents are effective or not and the address to be branched which corresponds to the contents. The contents of an instruction address register 411 index the table 410, which checks whether the address of a branch instruction to be prefetched is registered or not and outputs the checked result to a signal line 106. If registered, the corresponding address to be branched is read out to a signal line 105. On the other hand, the address of the executed branch instruction generated through an instruction storage device 408 and an instruction decoding device 403 is stored in a register 402 and a checking circuit 420 checks the coincidence of the contents of the register 402 with that of a register 418 storing forecasted information, and in case of inconsistency, the contents of the table 410 are updated by the contents held in a register 423.

Description

【発明の詳細な説明】 発明の属する技術分野 本発明はデータ処理システムの命令シーケンスのステッ
プに含まれる分岐条件判定ステップ実行処理に先立って
判定結果を予測しつつ次の命令の先取漫を行々う分岐方
向予測を行なう命令先取り装置に関する。
DETAILED DESCRIPTION OF THE INVENTION Field of the Invention The present invention relates to a method for predicting a judgment result prior to executing a branch condition judgment step included in an instruction sequence step of a data processing system and preempting the next instruction. The present invention relates to an instruction prefetching device that performs branch direction prediction.

従来技術 少なくとも1個の分岐命令を含む命令群が記憶装置に命
令シーケンスの形で格納されているデータ処理システム
においては、このような命令シ−ケンスの実行は、次の
ように行なわれる。
BACKGROUND OF THE INVENTION In a data processing system in which a group of instructions including at least one branch instruction is stored in a storage device in the form of an instruction sequence, such an instruction sequence is executed as follows.

まず、前記記憶装置の分岐元アドレスに分岐命令が格納
される。次に、この分岐命令に引き続いて実行される命
令が先取りされる。このあと、分岐命令が実行され、こ
の実行結果によシ次に実行される命令が明らかになる。
First, a branch instruction is stored at a branch source address in the storage device. Next, the instruction to be executed following this branch instruction is prefetched. After this, a branch instruction is executed, and the result of this execution reveals the next instruction to be executed.

このようなシステムは米国特許4.200.927号に
提案されている。しかし、このシステムでは、分岐命令
先取シ制御において実行結果の判別時まで命令先取り制
御を停止させると、処理の迅速化が妨げられる。この点
をの除去のだめ、分岐命令の実行結果を予め予測しこの
予測に従って命令先取りを行なう方式が提案されている
。この予測が正しく行なわれたときには、テータ処理シ
ステムは処理時間の少ない遅れで稼働する。例えば、そ
のような従来の予測方式としては次の3つの方式がある
。第1の予測方式では、全ての分岐命令の分岐先方向が
成功側または不成功側のいずれか一方のみに予測されて
いる。
Such a system is proposed in US Pat. No. 4,200,927. However, in this system, if the branch instruction preemption control is stopped until the execution result is determined, speeding up of processing will be hindered. In order to eliminate this problem, a method has been proposed in which the execution result of a branch instruction is predicted in advance and instructions are prefetched in accordance with this prediction. When this prediction is made correctly, the data processing system operates with little delay in processing time. For example, there are the following three methods as such conventional prediction methods. In the first prediction method, the branch destination direction of all branch instructions is predicted to be either the successful side or the unsuccessful side.

他の1つの予測方式では、過去の事実に基づいて分岐先
方向を予測する。すなわち、同じ分岐命令の過去の実行
結果において分岐先がすでに明らかにされているという
事実を用いてこの結果に基づいて予測を行なうことによ
シ予測的中率を高めている。このような予測方式の代表
例が特開昭57−76638号公報に示されている。
Another prediction method predicts the branch destination direction based on past facts. That is, by using the fact that the branch destination has already been revealed in the past execution results of the same branch instruction and making a prediction based on this result, the accuracy of the prediction is increased. A typical example of such a prediction method is shown in Japanese Patent Laid-Open No. 57-76638.

さらにもう1つの予測方式では、分岐命令に対応して分
岐の方向を予測する分岐指示フラグを多数用意し分岐命
令の発生に応答してこれら分岐指示フラグを参照するこ
とによυ分岐先を予測している、この例の詳細は特開昭
53−74857号公報を参照できる。しかし、上述の
3つのいずれの予読出しおよび解読動作分だけ処理が遅
れるという欠点がある。
In yet another prediction method, a large number of branch instruction flags are prepared to predict the branch direction in response to a branch instruction, and the υ branch destination is predicted by referring to these branch instruction flags in response to the occurrence of a branch instruction. For details of this example, please refer to Japanese Patent Laid-Open No. 74857/1983. However, there is a drawback that the processing is delayed by the amount of the pre-reading and decoding operations of any of the three mentioned above.

この欠点を除去する予測方式が特開昭57−’5925
3号公報に示されている。この方式では、主記憶装置の
命令部の写しである命令キャッジ−メモリのブロックに
対応して該ブロック中に含まれる分岐命令の分岐先アド
レスを、該ブロックの次にエッチされるべきブロックの
アドレスとして記憶手段に保持している。命令先取り動
作において、命令キャッジ−メモリへのアクセスと同時
に前記記憶手段をアクセスして前記分岐先アドレスを読
出し、読み出された分岐先アドレスにより先取りすべき
命令のアドレスを決定している点において、この方式は
上述の従来の3つの予測方式と異なり処理の迅速化に有
効である。しかし、この方式では、命令キャッジ−メモ
リのブロック対応で予測するため、該ブロックに分岐命
令が複数個存在するときにはそのそれぞれの分岐命令に
対応して予測を行なうことができない。この結果、精度
の粗い予測的中率しか得られないという欠点がある。
A prediction method that eliminates this drawback is disclosed in Japanese Patent Application Laid-Open No. 57-'5925.
This is shown in Publication No. 3. In this method, the instruction cache, which is a copy of the instruction part of the main memory, corresponds to a block of memory, and the branch destination address of the branch instruction contained in the block is transferred to the address of the block to be etched next to the block. It is retained in the storage means as . In the instruction prefetching operation, the storage means is accessed simultaneously with accessing the instruction cache memory to read the branch destination address, and the address of the instruction to be prefetched is determined based on the read branch destination address. This method is different from the three conventional prediction methods described above and is effective in speeding up processing. However, in this method, prediction is made in correspondence between the instruction cache and the memory block, so when a plurality of branch instructions exist in the block, prediction cannot be made corresponding to each branch instruction. As a result, there is a drawback that only a prediction hit rate with low accuracy can be obtained.

発明の目的 本発明の目的は上述の欠点を除去するようにした分岐方
向予測を行なう命令先取シ装置を提供することにある。
OBJECTS OF THE INVENTION It is an object of the present invention to provide an instruction preemption device for branch direction prediction which eliminates the above-mentioned drawbacks.

発明の構成 本発明の装置゛は、分岐命令のアドレスを指定する情報
と、該分岐命令に対応する分岐方向及び分岐先アドレス
を含む分岐情報とを対にして複数対記憶する分岐ヒスト
リテーブル手段を設け、命令先取り動作を行なう際に先
取りされるべき分岐命令命令の登録の判明に応答して対
応する分岐情報を前記分岐ヒストリテーブルから読み出
し、該分岐情報に従い、分岐命令の解読を行なうことな
く命令先取り動作を開始するように制御することにより
予測的中時にはロスサイクルを生じることなく命令供給
を可能とする。はらに、命令実行装置で実行された分岐
命令の分岐方向の結果と、該分岐命令の分岐ヒストリテ
ーブルの分岐方向情報とを比較する該分岐命令の分岐方
向が正しく予測されたことを確認する手段によシ分岐命
令の分岐予測が間違っていると判定された場合は該分岐
命令の正しい後続命令を取り出し実行する手段および分
岐烏合の実行結果で前記分岐ヒストリテーブル中の分岐
情報を更新する手段を備えている。
Structure of the Invention The device of the present invention includes branch history table means for storing a plurality of pairs of information specifying the address of a branch instruction and branch information including a branch direction and a branch destination address corresponding to the branch instruction. A branch instruction to be prefetched when an instruction is prefetched.In response to the registration of the instruction, the corresponding branch information is read from the branch history table, and the instruction is read out from the branch history table according to the branch information without decoding the branch instruction. By controlling the start of the prefetch operation, it is possible to supply instructions without causing loss cycles when the prediction is correct. Furthermore, means for confirming that the branch direction of the branch instruction has been correctly predicted by comparing the branch direction result of the branch instruction executed by the instruction execution device with the branch direction information of the branch history table of the branch instruction. If it is determined that the branch prediction of a branch instruction is incorrect, means for fetching and executing a correct subsequent instruction of the branch instruction, and means for updating branch information in the branch history table with the execution result of the branch combination. We are prepared.

発明の原理と作用 本発明の特徴は分岐命令の実行における分岐方向に加え
て分岐先アドレスがその同じ分岐命令の過去の結果の把
握によシ比較的高い的中率で予測可能であるという事実
に基づいて装置が動作することにある。
Principle and operation of the invention A feature of the present invention is the fact that in addition to the branch direction in the execution of a branch instruction, the branch destination address can be predicted with a relatively high accuracy rate by understanding the past results of the same branch instruction. The device operates based on this.

発明の実施例 次に本発明の一実施例を図面を参照して詳細に説明する
。第1図を参照すると、本発明の一実施例は、命令アド
レス生成回路4o1、命令アドレス変換回路402、命
令解読回路4o3、オペランドアドレス生成回路4o4
、オペランドアドレス変換回路405、オペランド記憶
回路を有するオペランド読出し回路4o6、命令実行回
路407、命令記憶回路408、命令バッファ4o9、
分岐ヒストリテーブル(BHT ) 410.命令アド
レスレジスタ411、命令アドレス加算回路412、分
岐情報バッファ413、命令整列回路414、分岐情報
切換回路415、分岐情報レジスタ416.417.4
18、および419、 予測確認回路42o1アドレス
生成回路421、選択回路422、レジスタ423、命
令先取シ制御回路424およびフリップフロップ425
から構成されている。
Embodiment of the Invention Next, an embodiment of the present invention will be described in detail with reference to the drawings. Referring to FIG. 1, one embodiment of the present invention includes an instruction address generation circuit 4o1, an instruction address conversion circuit 402, an instruction decoding circuit 4o3, and an operand address generation circuit 4o4.
, an operand address conversion circuit 405, an operand reading circuit 4o6 having an operand storage circuit, an instruction execution circuit 407, an instruction storage circuit 408, an instruction buffer 4o9,
Branch history table (BHT) 410. Instruction address register 411, instruction address addition circuit 412, branch information buffer 413, instruction alignment circuit 414, branch information switching circuit 415, branch information register 416.417.4
18, and 419, prediction confirmation circuit 42o1 address generation circuit 421, selection circuit 422, register 423, instruction prefetch control circuit 424, and flip-flop 425
It consists of

命令記憶回路408およびオペランド読出し回路406
内のオペランド記憶回路はともに主記憶装置そのもので
あってもよく、さらに命令記憶回路408が主記憶装置
の命令部の一部の写しである命令キャッシュメモリ、前
記オペランド記憶回路が主記憶装置のオペランド部の写
しであるオペランドキャッシュメモリとし、て構成され
うる。
Instruction storage circuit 408 and operand read circuit 406
Both of the operand storage circuits in the main memory may be the main memory itself, and the instruction storage circuit 408 may be an instruction cache memory that is a copy of a part of the instruction section of the main memory, and the operand storage circuit may be a main memory operand storage circuit. The operand cache memory may be configured as a copy of the operand cache memory.

本発明は前述の命令の処理単位に対応した装置構成を必
ずしも有する必要はなく、例えば命令アドレス生成回路
401とオペランドアドレス生成回路404、命令アド
レス変換回路402とオペランドアドレス変換回路40
5、命令記憶回路408とオペランド読出し回路406
内の記憶回粋が共用されたコンビーータシステムにおい
ても適用され得る。前記分岐ヒストリテーブル(BHT
)410は分岐命令のアドレスを指定する情報と該分岐
命令の実行の予測としての分岐成否フラグと分岐先アド
レスを第3図に示すように対にして記憶している。前記
命令記憶回路408に対する前記命令アドレスレジスタ
(IAR)411は、命令読出しのリクエストアドレス
を保持して命令の読出し動作を実行する。さらに前記命
令アドレスレジスタ411(IAR’)は分岐ヒストリ
テーブル41゜(13HT)および命令アドレス加算回
路412に信号線101を介して接続されている。前記
レジスタ411の内容は該分岐ヒストリテーブル410
(DAT’)を索引し、読出されるべき命令のアドレス
がそれに登録されているか否かを示す信号を信号線10
6に出力する。登録されていれば対応する分岐先アドレ
スが信号線105に読出される。
The present invention does not necessarily need to have a device configuration corresponding to the above-mentioned instruction processing units; for example, an instruction address generation circuit 401, an operand address generation circuit 404, an instruction address conversion circuit 402, and an operand address conversion circuit 40.
5. Instruction storage circuit 408 and operand reading circuit 406
It can also be applied in conbeater systems in which the memory collection within is shared. The branch history table (BHT
) 410 stores information specifying the address of a branch instruction, a branch success/failure flag as a prediction of execution of the branch instruction, and a branch destination address in pairs as shown in FIG. The instruction address register (IAR) 411 for the instruction storage circuit 408 holds an instruction read request address and executes an instruction read operation. Further, the instruction address register 411 (IAR') is connected to a branch history table 41° (13HT) and an instruction address addition circuit 412 via a signal line 101. The contents of the register 411 are stored in the branch history table 410.
(DAT') and sends a signal to the signal line 10 indicating whether or not the address of the instruction to be read is registered therein.
Output to 6. If registered, the corresponding branch destination address is read out to the signal line 105.

登録されていなければ前記命令アドレス加算回路412
により後続の命令語の命令先取シのだめのアドレスが生
成される。前記命令アドレス加算回路412は1回のリ
クエストで読出される命令語を8Byteと仮定したと
き単に” IAI(、+8 ’″を出力107に生成す
る回路である。前記命令バッファ409は、命令記憶回
路408から読出された8Byteの先取り命令語を蓄
積し命令処理部へのど9 命令の供給における待行列(Que−v=)を形成する
。前記命令整列回路414は、命令バッファ409が空
のとき信号線102を介して命令記憶回路408から読
出される8Byteの命令語に応答して前記命令バッフ
ァ409が空でないとき信号線103を介して前記命令
バッファに貯えられる8Byteの命令語に応答して命
令を抽出して信号線104を介して命令解読回路403
に命令を供給する回路である。前記分岐情報バッフγ4
13は、前記命令バッファ409に格納される命令語に
対応して用意をれており、その命令語中に分岐成功と予
測された分岐命令が存在すれは、第7図に示す該分岐命
令の分岐情報を格納する回路であり、分岐命令のアドレ
スは信号線101を介してまた分岐情報としての分岐先
アドレスおよびVビットハ分岐ヒストリテーブル410
(Bl−IT)から信号線105を介してそれぞれセッ
トされる。前記分岐情報切替回路415は、命令バッフ
ァ409が空のとき16号線]01および105を介し
て与えられる前記分岐情報を、そうでないときは前記分
岐情報バッファ403を介して力えられる前記分岐情報
をそれぞれ出力する。前記レジスタ416.417、お
よび418はそれぞれ分岐命令の命令解読、命令アドレ
ス生成、アドレス変換の各処理ステージに対応し、その
分岐情報を保持する。前記分岐情報レジスタ419はそ
の分岐先アドレス部を該分岐命令の実行によって生成さ
れる実際の分岐先アドレスに置き換えて保持するレジス
タである。前記予測確認回路420は分岐命令の実行に
よって生成される実際の分岐命令の生成結果と前記分岐
情報レジスタ418に保持される該分岐命令の予測情報
との一致をとる回路である。前記アドレス生成回路42
1は前記分岐情報レジスタ4】9に保持される分岐命令
のアドレスと該分岐命令自身の命令語長とを加算し分岐
N0GO側の命令の命令アドレスを生成する。前記選択
回路422は分岐命令の成否信号線111の状態に応答
して該信号線の状態が分岐GOを示すとき線115を介
して与えられる前記分岐情報レジスタ419に保持され
る分岐先アドレス部の出力を選択し、前記線の状態が分
岐N0GOを示すとき&1116を介して与えられる前
記アドレス生成回路421の出力を選択し、信号線11
3を介して該選択回路422の出力をレジスタ423に
供給する。前記レジスタ423は分岐命令の予測が失敗
したとき分岐ヒス) IJテーブル410(Bl(T)
を更新するだめのものであり、はらに信号i!N117
を介して命令アドレスレジスタ411(IAR,)に命
令先取りのだめの新たなアドレスを供給する。前記命令
先取り制御回路424は線106を介して分岐ヒストリ
テーブル410(BIT)から与えられる分岐予測信号
および予測確認回路から線112を介して与えられる予
測成否信号に基づいて命令アドレスレジスタ411(I
AR)の入力を制御する回路である。
If not registered, the instruction address addition circuit 412
The instruction preemption address for the subsequent instruction word is generated. The instruction address addition circuit 412 is a circuit that simply generates "IAI(,+8'" at the output 107 when the instruction word read out in one request is 8 bytes.The instruction buffer 409 is a circuit for generating an instruction storage circuit. The 8-byte prefetched instruction word read from the instruction buffer 408 is accumulated to form a queue (Que-v=) for supplying the first instruction to the instruction processing unit.The instruction alignment circuit 414 outputs a signal when the instruction buffer 409 is empty. When the instruction buffer 409 is not empty in response to an 8-byte instruction word read from the instruction storage circuit 408 via the line 102, the instruction is read out in response to an 8-byte instruction word stored in the instruction buffer via the signal line 103. is extracted and sent to the instruction decoding circuit 403 via the signal line 104.
This is a circuit that supplies instructions to the The branch information buffer γ4
13 is prepared corresponding to the instruction word stored in the instruction buffer 409, and if there is a branch instruction predicted to be a successful branch among the instruction words, the branch instruction shown in FIG. This is a circuit that stores branch information, and the address of the branch instruction is sent to the branch history table 410 via the signal line 101 and the branch destination address and V bit as branch information.
(Bl-IT) via the signal line 105. The branch information switching circuit 415 selects the branch information provided via lines 16 and 105 when the instruction buffer 409 is empty, and selects the branch information provided via the branch information buffer 403 when the instruction buffer 409 is empty. Output each. The registers 416, 417, and 418 correspond to each processing stage of instruction decoding, instruction address generation, and address translation of a branch instruction, and hold branch information thereof. The branch information register 419 is a register that replaces the branch destination address field with an actual branch destination address generated by executing the branch instruction. The prediction confirmation circuit 420 is a circuit that matches the actual branch instruction generation result generated by the execution of a branch instruction with the prediction information of the branch instruction held in the branch information register 418. The address generation circuit 42
1 adds the address of the branch instruction held in the branch information register 4/9 to the instruction word length of the branch instruction itself to generate the instruction address of the instruction on the branch N0GO side. The selection circuit 422 responds to the state of the branch instruction success/failure signal line 111 and selects the branch destination address section held in the branch information register 419 which is applied via the line 115 when the state of the signal line indicates branch GO. When the state of the line indicates branch N0GO, the output of the address generation circuit 421 given through &1116 is selected and the signal line 11
3, the output of the selection circuit 422 is supplied to the register 423. The register 423 registers a branch hiss when prediction of a branch instruction fails.IJ table 410 (Bl(T)
It is useless to update the i! N117
A new address for the instruction prefetch is supplied to the instruction address register 411 (IAR, ) via the instruction address register 411 (IAR). The instruction prefetch control circuit 424 registers the instruction address register 411 (I
This is a circuit that controls the input of AR.

次に前記分岐ヒストリテーブル410 (BHT)、前
記予測確認回路420および前記命令先取多制御回路4
24の詳細なブロック図とタイムチャートを参照しなが
ら本実施例の動作を詳細に説明する。
Next, the branch history table 410 (BHT), the prediction confirmation circuit 420 and the instruction prefetch control circuit 4
The operation of this embodiment will be described in detail with reference to the detailed block diagram and time chart of No. 24.

第2図を参照すると、前記分岐ヒストリテーブル410
(BHT)は、ディレクトリ記憶部501、データ記憶
部502、テスト回路503、5041えている。前記
記憶部501および502は、1回のリクエストに対し
て命令記憶回路408から読出される命令語の単位をブ
ロックの単位とし、セント数m、レベル数nの記憶部で
ある。
Referring to FIG. 2, the branch history table 410
(BHT) includes a directory storage section 501, a data storage section 502, and test circuits 503 and 5041. The storage units 501 and 502 are storage units with m cents and n levels, where the unit of the instruction word read from the instruction storage circuit 408 in response to one request is a block unit.

第3図を参照すると、記憶部501には分岐命令の命令
アドレスの一部とその内容が有効か否かを示す■ビット
が格納され記憶部502には、分岐先アドレスの実アド
レスが格納されている。前記Vビットは対応する分岐ヒ
ストリテーブル(BHT)410のワードの有効性を示
すと同時に該分岐命令の実行の予測としての分岐成否フ
ラグの槻能を有する。この分岐ヒストリテーブル(BH
T)410への索引は以下のようなセットアソシアティ
ブ法によって行われる。
Referring to FIG. 3, a part of the instruction address of a branch instruction and a ■ bit indicating whether or not its contents are valid are stored in the storage unit 501, and a real address of the branch destination address is stored in the storage unit 502. ing. The V bit indicates the validity of the word in the corresponding branch history table (BHT) 410 and has the function of a branch success/failure flag as a prediction of execution of the branch instruction. This branch history table (BH
T) 410 is performed by the set associative method as follows.

第5図に示される前記テスト回路503.504.50
5、および506はテーブル410の各レベルに対応し
て命令アドレスレジスタ411(IAR)K保持される
リクエストアドレスが各レベルのBHT−AA i (
iはレベルに対応するサフィクスを示す)に登録されて
いるか否かを示す信号を信号線130.131.132
.133に出力する。
The test circuit 503.504.50 shown in FIG.
5 and 506 are BHT-AA i (
(i indicates a suffix corresponding to the level)
.. 133.

第4図を参照すると前記テスト回路503.504.5
05および506のそれぞれは、一致回路701および
大小比較回路702から構成されている。前記比較回路
701では、命令アドレスレジスタ(IAR)411に
保持されるリクエストアドレスの一部IAI((: ]
 8−28 )をセットアドレスとして読出された記憶
部501の各レベルの内容と44fAM七前記レジスタ
411の内容IAR(:4−17)とが比較され、等し
いアドレスが存在するか否かを検出する。該一致回路7
01の出力により命令アドレスレジスタ(IAR)41
1に保持されるリクエストアドレスで読出されるべき命
令語の8Byteプロノク中にすでに分岐ヒストリテー
ブル(Bl(T)410に登録された分岐命令が存在す
るか否かが、判明する。しかしリクエストアドレスとそ
れが読出すべき分岐命令との対応をどるには上記一致検
出のみでは不十分である。
Referring to FIG. 4, the test circuit 503.504.5
05 and 506 each include a matching circuit 701 and a magnitude comparison circuit 702. In the comparison circuit 701, a part of the request address held in the instruction address register (IAR) 411 IAI((: )
The contents of each level of the storage unit 501 read out using 8-28) as a set address are compared with the contents IAR (:4-17) of the register 411 of 44fAM7, and it is detected whether an equal address exists. . The matching circuit 7
The output of 01 causes the instruction address register (IAR) 41
It becomes clear whether or not there is a branch instruction already registered in the branch history table (Bl(T) 410) in the 8-byte block of the instruction word to be read at the request address held as 1. However, if the request address is The above coincidence detection alone is not sufficient to determine the correspondence between it and the branch instruction to be read.

第5図を参照すると、1回のリクエストで読出される8
Byteの命令語のブロック中に2By t e命令B
CO1A、BCI、BC2の4個の命令が存在する。命
令BCO1BCI、BC2がともに分岐成功と予測され
た分岐命令であるときに(は、各々の分岐命令はともに
そのアドレスの一部が記憶部(BHT−AA ) 50
1に登録されるう このとき他の分岐命令から命令Aに
分岐して命令へのアドレス<A>が前記命令語のブロッ
クを読出すためのリクエストアドレスとして蒲令アドレ
スレジスタ(IAR)411に保持されるときりこは、
分岐ヒストリテーブル(BHT)410から読出される
べき分岐命令の情報は島台の実行の経路から分岐命令B
CIの情報でなけれはならない。
Referring to Figure 5, 8 is read in one request.
2Byte instruction B in a block of Byte instruction words
There are four instructions: CO1A, BCI, and BC2. When instructions BCO1BCI and BC2 are both branch instructions that are predicted to be successful, each branch instruction has a part of its address in the storage section (BHT-AA) 50
At this time, another branch instruction branches to instruction A, and the address <A> to the instruction is held in the instruction address register (IAR) 411 as a request address for reading the block of the instruction word. When Kiriko is done,
The information on the branch instruction to be read from the branch history table (BHT) 410 is the branch instruction B from the execution path of Shimadai.
Must be CI information.

従って前記レジスタ(IAR)411に保持されるリク
エストアドレスと前記記憶部(BHT −AA i )
501に保持される分岐命令のアドレスとの関係が上記
の一致条件とともに次の関係が成立すると509に与え
られ、該BHT HITi  信号のオア信号が線10
6を介して出力され分岐予測信号(BHT−HI T信
号)となる。
Therefore, the request address held in the register (IAR) 411 and the storage unit (BHT-AA i )
When the relationship between the address of the branch instruction held in 501 and the above matching condition is satisfied, it is applied to 509, and the OR signal of the BHT HITi signal is applied to line 10.
6 and becomes a branch prediction signal (BHT-HIT signal).

Bl−IT((ITi−(I皿C417)=BHT−A
Ai C4−17))凸(1皿(:29,30)臼)i
T力蹟i(:29,30))ABHT AAi (V) 再び第4図を参照すると、前記大小比較回路は、この条
件を実現する回路である。さらに前記信号J3HT−H
I T iの条件が2ヶ以上のレベルにおいて成立した
とき記憶部501の対応するレベル(BHT−AA i
 )に保持される分岐命令のアドレス8 By t e
ブロック内アドレスBHT −AA i (: 29.
30 )の値の最#ふも小さいレベルが選択される必要
がある。
Bl-IT((ITi-(I plate C417)=BHT-A
Ai C4-17)) Convex (1 plate (:29,30) mortar) i
ABHT AAi (V) Referring again to FIG. 4, the magnitude comparison circuit is a circuit that realizes this condition. Furthermore, the signal J3HT-H
When the condition of I Ti is satisfied at two or more levels, the corresponding level (BHT-AA i
) address of the branch instruction held in 8 Byte
Intra-block address BHT-AA i (: 29.
The lowest level of the value of 30) needs to be selected.

再び第5図を参照すると、命令BCIおよび13C2の
分岐命令関係情報が格納される分岐ヒストリテーブル4
10のレベルで前記信号BHT−HITi条件が共に成
立する。このとき命令の実行の経路から命令BC1に対
するレベルが選択きれる必要がある。前記プライオリテ
ィ回路507は、前記信号BH’II” −B I T
 iの2ケ以上の成立に対するものであシ、この出力に
より記憶部BIT−DA502 (7) セントアドレ
スIAR(:18−28)で示されるエントリの分岐先
アドレスがレベル選択回路508を介して読出される。
Referring again to FIG. 5, branch history table 4 stores instruction BCI and branch instruction related information of 13C2.
At a level of 10, the signal BHT-HITi conditions are both satisfied. At this time, it is necessary that the level for the instruction BC1 can be selected from the instruction execution path. The priority circuit 507 receives the signal BH'II''-B I T
This is for the establishment of two or more digits of i, and by this output, the branch destination address of the entry indicated by the storage unit BIT-DA502 (7) cent address IAR (:18-28) is read out via the level selection circuit 508. be done.

群605−608から構成されている。前記アンド回路
2!P601−604はn+1個並列に配置されている
It consists of groups 605-608. Said AND circuit 2! n+1 pieces of P601 to 604 are arranged in parallel.

前記第2図におけるレベル選択回路508のnケのレベ
ルの選択信号は第6図における信号VO,Vl、V2、
V3により以下のように与えられる。
The n level selection signals of the level selection circuit 508 in FIG. 2 are the signals VO, Vl, V2, and V2 in FIG.
V3 is given as follows.

■0のと@         vow VOL 1−・
−1VQLn■0・■1のとき     VILQVI
LI  −−1VILnVO−Vl、−V2のとき  
 VaLQ V3L1、・・・・・、V2LnVO−V
l −V2 ・V3のとき V3IJI V3LL −
、V3Ln以上のようにして第2図におけるレベル選択
回路508から読出された分岐情報は第1図の命令記憶
回路408から読出される命令と対応づけることが可能
である。
■0noto @ vow VOL 1-・
-1VQLn■0・■1 VILQVI
When LI −-1VILnVO-Vl, -V2
VaLQ V3L1,..., V2LnVO-V
l −V2 ・When V3 V3IJI V3LL −
, V3Ln and above, the branch information read out from the level selection circuit 508 in FIG. 2 can be associated with the instruction read out from the instruction storage circuit 408 in FIG. 1.

第9図には、命令記憶回路408における命令と分岐ヒ
ストリテーブル(BHT)410における分岐情報の上
記対応関係が示されている。命令の実行順序が命令AO
1分岐命令BCO1B1、Be□゛、B2、B3、BC
2、C5、C2・・・・・・・ と予測された場合であ
る。なお、〈A〉は人命令のアドレスを、BCiは分岐
命令をそれぞれ示す。
FIG. 9 shows the above-mentioned correspondence between instructions in the instruction storage circuit 408 and branch information in the branch history table (BHT) 410. Instruction execution order is instruction AO
1 branch instruction BCO1B1, Be□゛, B2, B3, BC
2, C5, C2... This is the case where it is predicted. Note that <A> indicates the address of a human instruction, and BCi indicates a branch instruction.

第10図を参照すると、前記第9図のに示した分岐ヒス
) IJテーブルBHT410 による命令先取り動作
は次のようにされる。リクエストアドレスの命令アドレ
スレジスタ411のセットに応答して命令記憶回路40
8から命令語が読出され、これと同時にテーブルBHT
410が索引される。□信号線106を介してBHT−
HIT信号が出力される。と記憶部BIT−DA502
の分岐先アドレス<I31>がアドレスレジスタ411
にセットされ、 次の命令先取りが行われる。前記信号
線106を介してBHT(A)が与えられ、「8」加算
されたアドレスが出力され、次の命令先取りが遂次性わ
れる。
Referring to FIG. 10, the instruction prefetching operation by the IJ table BHT410 (branch hiss shown in FIG. 9) is performed as follows. In response to the setting of the instruction address register 411 of the request address, the instruction storage circuit 40
The instruction word is read from table BHT at the same time.
410 is indexed. □BHT- via signal line 106
A HIT signal is output. and storage unit BIT-DA502
The branch destination address <I31> is in the address register 411
is set, and the next instruction is prefetched. BHT(A) is applied via the signal line 106, the address added by "8" is output, and the next instruction is prefetched sequentially.

以上の命令の先取りに従えば命令記憶回路408から読
出される命令語は、テーブルBH’i”410 の内容
による予測に従って順次読出され、命令バッファ409
には予測された命令の実行順に格納することが可能であ
る。
According to the above instruction prefetch, the instruction words read from the instruction storage circuit 408 are sequentially read out according to the prediction based on the contents of the table BH'i'' 410, and the instruction words are read out from the instruction buffer 408.
can be stored in the predicted execution order of instructions.

このときたとえ信号BHT−HIT  が出力されても
分岐予測方向と反対側の命令先取シ動作を一部行わせし
めた後に分岐予測方向の命令先取り動作を行ってもよい
At this time, even if the signal BHT-HIT is output, the instruction prefetching operation in the branch prediction direction may be performed after partially performing the instruction prefetching operation in the opposite direction to the branch prediction direction.

以上のようにして命令先取りされた命令が分岐命令で第
1図の命令整列回路414にょシ、命令解読回路403
に導かれたとき同時に該分岐命令に対応する分岐情報が
最初の分岐情報レジスタ416 (QRo )にセット
される。
The instruction pre-fetched in the above manner is a branch instruction and is sent to the instruction alignment circuit 414 and the instruction decoding circuit 403 in FIG.
At the same time, branch information corresponding to the branch instruction is set in the first branch information register 416 (QRo).

以降前記分岐命令の進行に伴い前記命令解読、アドレス
変換に対応して前記分岐情報が第2および第3の分岐情
報レジスタ417(QR,1)  および418(QR
2)に転送される。そして前記分岐命令の実行によって
生成きれる実際の分岐命令の生成結果と前記分岐情報レ
ジスタ418(QR2)に保持される該分岐命令の予測
情報との一致が予測確認回路420によりチェックされ
る。
Thereafter, as the branch instruction progresses, the branch information is stored in the second and third branch information registers 417 (QR, 1) and 418 (QR, 1) corresponding to the instruction decoding and address conversion.
2). Then, a prediction confirmation circuit 420 checks whether the actual branch instruction generation result generated by executing the branch instruction matches the prediction information of the branch instruction held in the branch information register 418 (QR2).

第8図を参照すると、前記予測確認回路420は比較回
路801、フリップフロップ802および前記比較回路
801には、分岐命令の実行により生成された分岐先ア
ドレスの実アドレスが命令アドレス変換回路402から
信号線109を介して与えられるとともに、分岐情報レ
ジスタ418CQT?、2)から予測された分岐先が線
108を介して与えられる。前記比較回路801では両
者の一致、不一致が判定される。判定結果と前記レジス
タ418 を介l−て与えられるVビットがアンド回路
806  に与えられる。論理積結果により分岐GOと
予測きれたときこの事実を示す信号がフリップフロップ
802にセットされる。このフリップ70ツブ802の
出力が1”で実際の分岐命令を実行した結果が分岐N0
GOであればアンド回路805から予測00失敗信号1
23が生成される。前記フリップフロップ801の出力
がr+ 、 nで分岐命令の実行結果がGOであればア
ンド回路804から予測N0GO路809から予測失敗
信号112として生成される。
Referring to FIG. 8, the prediction confirmation circuit 420 sends a signal from the instruction address conversion circuit 402 to a comparison circuit 801, a flip-flop 802, and the comparison circuit 801 with the real address of the branch destination address generated by execution of a branch instruction. is provided via line 109 and branch information register 418CQT? , 2) is given via line 108. The comparison circuit 801 determines whether the two match or do not match. The determination result and the V bit provided via the register 418 are provided to an AND circuit 806. When a branch GO is predicted based on the AND result, a signal indicating this fact is set in flip-flop 802. The output of this flip 70 tube 802 is 1", and the result of executing the actual branch instruction is branch N0.
If GO, prediction 00 failure signal 1 from AND circuit 805
23 is generated. If the output of the flip-flop 801 is r+, n and the execution result of the branch instruction is GO, a prediction failure signal 112 is generated from the AND circuit 804 through the prediction N0GO path 809.

第1図および第11図を参照すると、分岐情報レジスタ
419 (QR3)の分岐先アドレス部に(寸前記命令
アドレス変換回路402から新たに生成される分岐先ア
ドレスがセットされる。また前記分岐情報レジスタ41
9 (QR3)の分岐命令BC,のアドレス部の内容と
該分岐命令BC1自身の命令語長部の内容とがアドレス
生成回路421により加算され分岐N0GO側の命令の
命令アドレスが生成される。
Referring to FIGS. 1 and 11, the branch destination address newly generated from the instruction address conversion circuit 402 is set in the branch destination address field of the branch information register 419 (QR3). register 41
The address generation circuit 421 adds the contents of the address field of the branch instruction BC of 9 (QR3) and the contents of the instruction word length field of the branch instruction BC1 itself to generate the instruction address of the branch N0GO side instruction.

そして分岐命令BC1の実際の実行により分岐GOなら
ば前記分岐情報レジスタ419 (QR3)から線11
5を介して与えられる分岐先アドレス部の出力〈D□〉
が分岐N0GOならば線116を介して与えられる前記
アドレス生成回路4210出力〈B2〉が選択回路42
2により選択される。前記分岐命令BC,の予測失敗信
号112が予測確認回路421から発生したとき、該選
択回路422の出力〈Dl〉が線113を介してレジス
タ423(WEL)にセットされる。
If the branch is GO due to the actual execution of the branch instruction BC1, the line 11 is sent from the branch information register 419 (QR3).
Output of branch destination address section given via 5 <D□>
If the branch is N0GO, the address generation circuit 4210 output <B2> given via the line 116 is output to the selection circuit 42.
2 is selected. When the prediction failure signal 112 of the branch instruction BC is generated from the prediction confirmation circuit 421, the output <Dl> of the selection circuit 422 is set to the register 423 (WEL) via the line 113.

一方分岐情報レジスタ419(QR3)の分岐命令のア
ドレス<BC□〉は信号線114を介して命令アドレス
レジスタ411(IAR)にセットされる。このアドレ
スは該分岐命令に対応する分岐ヒス) IJテーブル4
]0(BHT) の更新(7)ためff9101を介し
て該テーブル410にライトアドレスとして供給される
1、前記予測失敗信号112の出力がフリップフラップ
425に与えられ、この出力が指示パルスとして線11
9を介してテーブル401に与えられる。
On the other hand, the branch instruction address <BC□> of the branch information register 419 (QR3) is set to the instruction address register 411 (IAR) via the signal line 114. This address is the branch hiss corresponding to the branch instruction) IJ table 4
]0 (BHT) is supplied as a write address to the table 410 via the ff9101 for updating (7). The output of the prediction failure signal 112 is given to the flip flap 425, and this output is sent to the line 11 as an instruction pulse.
9 to table 401.

この出力に応答して分岐命令の次の命令先取り時のだめ
の分岐予測情報の更新が行なわれる。この更新は本実施
例では予測N0CIO失敗のとき前記レジスタ423(
WR)に保持される新だな分岐先アドレスで行なわれ、
予測GO失敗のときは■ピントをリセットするように行
われるが分岐予測情報の更新におけるアルゴリズムを用
いて他の方法によシ行なって差しつかえない。予測失敗
したとき予測側に後続する命令の動作はすべてキャンセ
ルされ、前記レジスタ423(WR)に保持される新だ
なリクエストアドレスが分岐ヒストリテーブル410(
BHT)の更新後に命令アドレスレジスタ411(IA
几)に供給され改めて命令の取出しが開始される。
In response to this output, the branch prediction information for prefetching the next instruction of the branch instruction is updated. In this embodiment, this update is performed in the register 423 (
The new branch destination address is held in WR),
When the predicted GO fails, the method is as follows: (1) Resetting the focus, but other methods may be used using the algorithm for updating the branch prediction information. When prediction fails, all operations of instructions following the prediction side are canceled, and the new request address held in the register 423 (WR) is stored in the branch history table 410 (
After updating the instruction address register 411 (IA
几) and command retrieval is started again.

第12図を参照すると、前記命令先取多制御回路424
はフリップフロップ1201.真偽回路12o2−12
04およびアンド回路12o5がら構成されている。前
記フリップフロップ12o1は前記予測失敗信号112
を1マシンブイクル保持するためのフリップフロップで
ある。この回路424の出力はアドレスレジスタ411
の前段にあるセレクタの選択指示信号となる。この選択
指示信号は、前記命令アドレス加算回路412の出力、
前記レジスタ423の出力、前記テーブル410の出力
、および分岐情報レジスタ419の出力のうちのどれを
選択するかを指示するだめの信号である。なお、この命
令先取り制御回路42,1の制御により分岐予測が的中
したときには後述する第16図の命令処理が行なわれ、
分岐予測が失敗したときには後述する第17図の命令処
理が行なわれる。前記アドレス加算回路11は線106
を介してBHT−HIT信号が出力されないとき分岐N
0GO側の命令の先取りを行うだめのアドレス生成を行
う。このときアドレスは実アドレスで加算が行われるだ
めに、例えば、ページングを行うコンピュータシステ1
1において前記アドレス加算がぺ〜ジ境界を越えた場合
アドレス変換を改めてやり直す必要が生じる。このため
に前記命令アドレス加算回路11にページ境界越え検出
回路を設け、該検出回路によりページ境界越えが生じた
場合、信号線Lllにより、命令アドレス生成回路1を
起動し、命令先取り動作を改めて命令アドレス生成回路
(IA)401及び命令アドレス変換回路(IT)40
2から行うように制御すればよい。
Referring to FIG. 12, the instruction preemption control circuit 424
is a flip-flop 1201. Truth/false circuit 12o2-12
04 and an AND circuit 12o5. The flip-flop 12o1 receives the prediction failure signal 112.
This is a flip-flop for holding one machine vehicle. The output of this circuit 424 is the address register 411
This is the selection instruction signal for the selector in the previous stage. This selection instruction signal is the output of the instruction address addition circuit 412,
This is a signal for instructing which of the output of the register 423, the output of the table 410, and the output of the branch information register 419 is selected. Note that when the branch prediction is correct under the control of the instruction prefetch control circuit 42, 1, the instruction processing shown in FIG. 16, which will be described later, is performed.
When branch prediction fails, instruction processing shown in FIG. 17, which will be described later, is performed. The address adder circuit 11 is connected to the line 106.
Branch N when the BHT-HIT signal is not output via
Generates an address for pre-fetching an instruction on the 0GO side. At this time, since the address is not added to the real address, for example, the computer system 1 that performs paging
1, if the address addition exceeds the page boundary, it is necessary to perform address conversion again. For this purpose, a page boundary crossing detection circuit is provided in the instruction address addition circuit 11, and when the detection circuit detects that a page boundary crossing has occurred, the instruction address generation circuit 1 is activated by the signal line Lll, and the instruction prefetch operation is re-instructed. Address generation circuit (IA) 401 and instruction address conversion circuit (IT) 40
It is sufficient to control the process to be performed from step 2.

ここで問題となるのは、あらたに分岐ヒストリテーブル
BI(T41Qに前記命令アドレス情報を登録するとき
既存のどの部分に格納された命令アドレス情報を追い出
すかである。
The problem here is which part of the existing instruction address information should be removed when newly registering the instruction address information in the branch history table BI (T41Q).

この方法としては使われた順序、すなわち最も古く使わ
れたものから順に追い出す法LRU(Least Re
ccntly Used)情報が入った順序、すなわち
最も古く入ったものから順に追い出す方法FIFO(F
irst In First 0ui)等があるが、ど
ちらを用いてもよい。
This method is based on the LRU (Least Relay) method, which is a method that evicts items in the order of use, that is, from the oldest to the least used.
FIFO (F
irst In First Oui), but either one may be used.

発明の効果 次に本発明の効果を第13図から第17図を参照しなが
ら詳細に説明する。
Effects of the Invention Next, the effects of the invention will be explained in detail with reference to FIGS. 13 to 17.

第13図を参照すると、命令の処理は一般的に次の8つ
の処理単位に分けられる。
Referring to FIG. 13, instruction processing is generally divided into the following eight processing units.

(1)  IAステージ:実行すべき命令の命令アドレ
ス(論理アドレス)が生 成される。
(1) IA stage: An instruction address (logical address) of an instruction to be executed is generated.

(2)  ITステージ:生成された命令アドレスのア
ドレス変換が行われる。
(2) IT stage: Address translation of the generated instruction address is performed.

(3)  ICステージ:変換された命令の実アドレス
で記憶装置から命令が読 出される。
(3) IC stage: The instruction is read from the storage device at the translated real address of the instruction.

(4)  IDステージ:読出された命令が解読される
(4) ID stage: The read instruction is decoded.

(5)OAステージ:解読された命令のオペランドアト
lメス(論理アドレス) が生成される。
(5) OA stage: The operand address (logical address) of the decoded instruction is generated.

(6)  OAステージ:生成されたオペランドアドレ
スのアドレス変換が行な われる。
(6) OA stage: Address translation of the generated operand address is performed.

(7)QCステージ;変換きれたオペランドの実アドレ
スで記憶装置からオ ペランドが読出される。
(7) QC stage: The operand is read from the storage device using the converted real address of the operand.

(8)  EXステージ:命令が実行される。(8) EX stage: The instruction is executed.

上述のITステージおよびOTステージのアドレス変換
においてアドレス変換バッファを設け、必要な変換テー
ブルが該アドレス変換ノ々ソファに存在すれば上記アド
レス変換処理は高速に実行し得る。また、上述のICス
テージおよびQCスデージの命令およびオペランドの読
出し動作において主記憶装置のデータの一部の写しを保
持するキャッジ−メモリを設け、必要な命令およびオペ
ランドが該キャッシュメモリに存在すればICステージ
およびOCステージの処理は高速に行いうる。
If an address translation buffer is provided for the address translation in the IT stage and the OT stage, and a necessary translation table exists in the address translation node, the address translation process can be executed at high speed. In addition, a cache memory is provided to hold a copy of a part of the data in the main memory during the instruction and operand read operations of the above-mentioned IC stage and QC stage. Stage and OC stage processing can be performed at high speed.

説明の簡単のためにここでは各処理単位にその機能を果
す回路があるものとする。上述のI T、OTおよびI
C,QCの各ステージの高速処理が可能なとき複数の命
令の処理の流れを無駄なく実行する8段のパイプライン
制御が可能である。
For ease of explanation, it is assumed here that each processing unit has a circuit that performs its function. IT, OT and I mentioned above
When high-speed processing of each stage of C and QC is possible, eight-stage pipeline control is possible to execute the processing flow of multiple instructions without waste.

このときの分岐命令を含む命令の処理の流れを第14図
および第11図を参照したから説明する。
The flow of processing instructions including branch instructions at this time will be described with reference to FIGS. 14 and 11.

第14図は分岐命令の命令先取りにおいて前述のすべて
の分岐はn GOITであると予測した場合の命令の処
理の流れを示す。すなわち、命令AOは分岐命令BCの
分岐条件を決定する。命令で該分岐条件は命令AOの実
行結果、すなわち、時刻t7において決定きれる。分岐
命令BCは時刻t4において解読されると命令アドレス
の生成回路を用いて分岐先命令B1のアドレスを生成し
以後B1命令を先取シするように動作する。時刻t2、
t3、およびt4には分岐N0GO側の後続命令A0、
A2、およびA3の命令先取シのだめのアドレス生成が
開始される。時刻t6およびt7には予測動作としての
分岐GO側の後続命令B2およびB3の命令先取多動作
が開始される。時刻t7において分岐条件の判定結果に
よシ、時刻t8以降は正しい命令の処理の流れに従って
処理が継続される。
FIG. 14 shows the flow of instruction processing when it is predicted that all the branches described above are n GOITs in instruction prefetching of branch instructions. That is, instruction AO determines the branch condition of branch instruction BC. The branch condition of the instruction can be determined at the execution result of the instruction AO, that is, at time t7. When the branch instruction BC is decoded at time t4, it generates the address of the branch destination instruction B1 using an instruction address generation circuit, and thereafter operates to preempt the B1 instruction. Time t2,
At t3 and t4, the subsequent instruction A0 on the branch N0GO side,
Preemptive address generation for instructions A2 and A3 is started. At times t6 and t7, instruction preemption operations for subsequent instructions B2 and B3 on the branch GO side are started as predicted operations. Depending on the branch condition determination result at time t7, processing continues from time t8 onwards according to the correct instruction processing flow.

この場合、分岐命令の出現によるパイプラインのロスサ
イクルは 予測的中(分岐GO)のとき 3ザイクル予測失敗(分
岐N0GO)のとき3サイクルである。
In this case, the loss cycles of the pipeline due to the appearance of a branch instruction are 3 cycles when the prediction is correct (branch GO) and 3 cycles when the prediction is unsuccessful (branch NOGO).

分岐GO率γ予測的中率αとしだときこの場合α−α−
〇5であシ1分岐命令尚シ平均的なロスサイクルは 3×γ+3×(1−γ)==3サイクルである。
Branch GO rate γ Predicted hit rate α and in this case α−α−
〇5 and 1 branch instruction.The average loss cycle is 3×γ+3×(1−γ)==3 cycles.

一方第15図は分岐命令の命令先取りにおいて、前述の
同じ分岐命令の過去の結果に基づいて予Illを行った
場合の命令の処理の流れを示す。すなわち、分岐命令B
Cは、時刻t4において解読されるとともに分岐命令の
アドレステーブルを探索しその有無によるかもしくは分
岐指示フラグの指示の予測により、分岐Go側の命令B
1を先取りするか分岐N0GOπIllの命令人□を先
取りする力\を決定する。前回と同様に時刻t2、t3
、およびt4匹分岐N0GO側の後続命令A0、A2、
およびA3の命令先取りのだめのアドレス生成75: 
[ei4始される。
On the other hand, FIG. 15 shows the flow of instruction processing when prefetching of a branch instruction is performed based on the past results of the same branch instruction described above. That is, branch instruction B
C is decoded at time t4, and the address table of the branch instruction is searched, and the instruction B on the branch Go side is determined either by its presence or absence or by predicting the instruction of the branch instruction flag.
Determine the force \ that preempts 1 or preempts the commander □ of branch N0GOπIll. Same as last time, time t2, t3
, and subsequent instructions A0, A2 on the t4 branch N0GO side,
and A3 instruction prefetch address generation 75:
[ei4 begins.

時刻t6、卦よびt7には予測Vこよるぞδ令先取りの
後続命令B1およびB2もしくはA4およびA5の命令
のアドレス生成が開始される、時亥11t7において分
岐条件の特定結果により時亥]1t8以降は正しい命令
の処理の流れに従って処理75玉継続される。
At times t6 and t7, address generation for the subsequent instructions B1 and B2 or A4 and A5 of the predicted δ instruction preemption is started, and at time 11t7, the address generation for the instructions of A4 and A5 is started. Thereafter, the processing of 75 balls is continued according to the processing flow of the correct command.

この場合分岐命令の出現によるノくイブラインのロスサ
イクルは 分岐GOと予測して的中したとき 3サイクル分岐N0
GOと予測して的中したときOサイクル分岐GOと予測
して失敗したとき  3サイクル分岐N0GOと予測し
て失敗したとき6サイクルである。従って、分岐GO率
γ−05予拐目的中率α−08と仮定したとき1分岐命
令当υの平均的なロスサイクルは 3・γ α+0・(1ゴ)α+3γ(1−α)+6 (
1−γ)(1−α)=2.1サイクル を得る。
In this case, the loss cycle of the branch line due to the appearance of a branch instruction is predicted to be branch GO, and when it is correct, 3 cycles branch N0
It is 6 cycles when you predict GO and fail. O cycle when you predict branch GO and fail. 3 cycles when you predict branch NOGO and fail. Therefore, assuming that the branch GO rate is γ-05 and the aborted target rate is α-08, the average loss cycle for one branch instruction is 3・γ α+0・(1 go)α+3γ(1-α)+6 (
1-γ)(1-α)=2.1 cycles are obtained.

従ってこの従来の発明は同じ分岐命令のj尚去の結果に
基づいて予測を行った場合高い予担目的中率を得るとい
う原理を用いることにより常に分11支(1)と予測す
る第14図に示す処理に比べ幾分の改良がみられる。し
かし、この改良された発り」においても、たとえ予測的
中時分岐GOの場合はイ伎然として3サイクルのロスサ
イクルを要することに−なり、これ以上短縮できかい。
Therefore, this conventional invention uses the principle that when prediction is made based on the previous result of the same branch instruction, a high predetermined hit rate is obtained. There is some improvement compared to the process shown in . However, even with this improved starting point, even in the case of a predictive intermediate branch GO, three loss cycles are required, and it is not possible to reduce the number of cycles any further.

従って分岐令令力く生じた場合たとえ予測が的中しても
ロスサイクルを生じることになる。
Therefore, if a branch order occurs suddenly, a loss cycle will occur even if the prediction is correct.

第16図および第17図は本発明による命令の処理の流
れを示している。本発明における命令の処理単位ICス
テージは命令を記憶装置から読出す機能の他に、分岐ヒ
ストIJテーブルを索引し読出でれる命令のアドレスが
該分岐ヒストリテーブルに登録きれているか否かを検出
し、登録されていれば対応する分岐情報を読出し、登録
されていなければ後続命令の命令先取)のだめのアドレ
スを生成する機能を有する。
16 and 17 show the flow of instruction processing according to the present invention. In addition to the function of reading instructions from the storage device, the instruction processing unit IC stage of the present invention indexes the branch history IJ table and detects whether the address of the instruction that can be read is registered in the branch history table. , if it is registered, it reads the corresponding branch information, and if it is not registered, it has a function of generating a default address (instruction preemption of the subsequent instruction).

第16図および第17図を参照すると、分岐命令BCの
時刻t1における動作は次のようにして行なわれる□。
Referring to FIGS. 16 and 17, the operation of branch instruction BC at time t1 is performed as follows.

まず、該分岐命令BCが命令キャッジ−メモリから読出
妬れると同時に分岐ヒストリテーブルが索引される。該
分岐命令BCの命令アドレスが登録されていれば対応す
る分岐情報が読出される。該分岐情報を分析した結果、
分岐G。
First, the branch history table is indexed at the same time as the branch instruction BC is read out from the instruction cache memory. If the instruction address of the branch instruction BC is registered, the corresponding branch information is read out. As a result of analyzing the branch information,
Branch G.

側の予測として該分岐情報中に含まれる分岐先アドレス
により分岐先命令B1の命令先取υを開始するか、もし
くは分岐N0GO側の予測として分岐Hooo側の命令
A□の命令アドレスを生成して命令A1の先取りを開始
するかが決定される。以降時刻t5tでは前記分岐命令
BCの予測期間であシ、予測側の後続命令が先取りされ
時刻t5に2いて分岐条件が決定される。予測的中時に
は第16図に示すようにパイプラインの流れは乱れを生
ずることなく処理が継続される。予測失敗時には第17
図に示すように16時刻で前記分岐ヒストリテーブルの
更新を行った後に正しい命令の流れから命令の取出しを
行うように制御される。この場合、分岐命令の出現によ
るパイプラインのロスサイクルは 予測が的中したとき    Oサイクル予測が失敗した
とき    5サイクルである。予測的中率αは、この
場合分岐方向たけでなく分岐先アドレスをも予測するこ
とから分岐方向だけの予測に比べ若干低くなるが、その
割合は微々たるものである。従って、予測的中率α−0
8として1分岐命令当りの平均的なロスサイクルは 0・α+5・(1−α)=1ザイクル 、 となり、従来技術に比べて格段に改良される。
As a prediction on the side, the instruction prefetch υ of the branch destination instruction B1 is started based on the branch destination address included in the branch information, or as a prediction on the branch N0GO side, an instruction address of the instruction A□ on the branch Hooo side is generated and the instruction is It is determined whether to start prefetching A1. Thereafter, at time t5t, during the prediction period of the branch instruction BC, the subsequent instruction on the prediction side is prefetched, and the branch condition is determined at time t5. When the prediction is correct, the processing continues without any disturbance in the flow of the pipeline, as shown in FIG. 17th when prediction fails
As shown in the figure, after the branch history table is updated at time 16, the instruction is controlled to be taken out from the correct instruction flow. In this case, the pipeline loss cycles due to the appearance of a branch instruction are O cycles when the prediction is correct and 5 cycles when the prediction fails. In this case, since not only the branch direction but also the branch destination address is predicted, the prediction accuracy rate α is slightly lower than when predicting only the branch direction, but the rate is insignificant. Therefore, the prediction accuracy α−0
8, the average loss cycle per branch instruction is 0.alpha.+5.(1-.alpha.)=1 cycle, which is a significant improvement over the prior art.

本発明には分岐ヒス) IJテーブルに分岐命令の分岐
方向及び分岐先アドレスを含む分岐情報を登録し、分岐
命令実行時は実行結果の分岐方向と該分岐命令に対応す
る分岐ヒス) IJテーブルの分岐方向を比較して分岐
命令の予測が的中したか否かを調べ、分岐予測失敗時に
は正しい後続命令を取り出し実行を再開し、分岐情報を
更新する手段をもつことにより条件分岐命令を含む分岐
命令の分岐予測を可能とし分岐予測的中時は、パイプラ
イン:li制御における分岐命令の実行をロスサイクル
々して処理できるという多大な効果がちる。
In the present invention, branch information including the branch direction and branch destination address of a branch instruction is registered in the IJ table (branch history), and when a branch instruction is executed, the branch direction of the execution result and the branch history corresponding to the branch instruction are registered in the IJ table. By comparing the branch directions to check whether the prediction of the branch instruction was correct or not, and if the branch prediction fails, the correct subsequent instruction is retrieved and execution is resumed, and the branch information is updated by having a means to update the branch information. It is possible to predict a branch of an instruction, and when the branch prediction is correct, there is a great effect that the execution of the branch instruction in pipeline:li control can be processed in loss cycles.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明の一実施例を示す図、第2図は分岐ヒス
) IJテーブルの詳細な構成を示す図、第3図は第2
図の記憶部501および601の記憶形式を示す図、第
4図は第2図のテスト回路503−506の詳細な構成
を示す図、第5図は命令語の構成を示す図、第6図は第
2図のプライオリティ回路507の詳細な構成を示す図
、第7図は第1図のレジスタ417−419の格納形式
を示す図、第8図は第1図の予測確認回路420の詳細
な構成を示す図、第9図は第1図の命令記憶回路408
における命令と分岐ヒストリテーブル410における分
岐情報との対応関係を説明するだめの図、第10図は第
9図のテーブル410による命令先取り動作を説明する
だめの図、第11図は予測失敗時における命令先取多動
作開始までの動作を説明するだめの図、第12図は第1
図の命令先取り制御回路の詳細な構成を示す図、第13
図は、命令の処理の流れの概要を示す図、第14図およ
び第15図は従来の予測方式を用いた命令の処理の流れ
を示す図、第16図は本発明において、分岐命令の予測
が的中しだときの命令の処理の流れを示す図、および第
17図は本発明において分岐命令の予測が失敗したとき
の命令の処理の流れを示す図である。 第1図から第17図において、401・・・・命令アド
レス生成回路 402 命令アドレス変換回路403 
命令解読回路 404 ・オペランドアドレス生成回路
 405 ・オペランドアドレス変換回路 406・・
・オペランド読出し回路 407・・・命令実行回路 
408・ 命令記憶回路 409・・・命令バッファ 
410・・・・分岐ヒストリテーブル(BET)411
   命令アドレスレジスタ(1卸)412・・・・命
令アドレス加算回路 413・・・分岐情報バッファ 
414 ・命令整列回路 415・・・・・・分岐情報
切換回路 416・ 分岐情報レジスタ(QBfl)4
17 分岐情報レジスタ(QRI)  418・・・ 
分岐情報レジスタ(QR2)  419・・・・・分岐
情報レジスタ(QR3)  420  ・予測確認回路
 421アドレス生成回路 422 ・・選択回路 4
23 ・・レジスタ(WR)  424  命令先取り
制御回路425・・フリップフロノア’  501,5
02・・・・・記憶部 503.504.505.50
6・・・テスト回路507・・・・プライオリティ回路
 508・・・・・選択回路509・・オア回路。 代理人 弁理士  内 原   晋 芋130
Fig. 1 is a diagram showing an embodiment of the present invention, Fig. 2 is a diagram showing the detailed configuration of the IJ table (branch histology), and Fig. 3 is a diagram showing the detailed configuration of the IJ table.
4 is a diagram showing the detailed configuration of the test circuits 503 to 506 in FIG. 2, FIG. 5 is a diagram showing the structure of instruction words, and FIG. 7 is a diagram showing the detailed configuration of the priority circuit 507 in FIG. 2, FIG. 7 is a diagram showing the storage format of the registers 417-419 in FIG. FIG. 9 is a diagram showing the configuration of the instruction storage circuit 408 in FIG.
10 is a diagram illustrating the correspondence between instructions and branch information in the branch history table 410, FIG. 10 is a diagram illustrating the instruction prefetching operation based on the table 410 of FIG. 9, and FIG. Figure 12 is a diagram for explaining the operation up to the start of the instruction preemption operation.
13, a diagram showing a detailed configuration of the instruction prefetch control circuit in FIG.
14 and 15 are diagrams showing the flow of instruction processing using the conventional prediction method, and FIG. 16 is a diagram showing the outline of the instruction processing flow in the present invention. FIG. 17 is a diagram showing the flow of instruction processing when prediction of a branch instruction fails in the present invention. 1 to 17, 401...instruction address generation circuit 402 instruction address conversion circuit 403
Instruction decoding circuit 404 - Operand address generation circuit 405 - Operand address conversion circuit 406...
・Operand reading circuit 407...Instruction execution circuit
408・Instruction storage circuit 409・Instruction buffer
410... Branch history table (BET) 411
Instruction address register (1 wholesale) 412...Instruction address addition circuit 413...Branch information buffer
414 - Instruction alignment circuit 415... Branch information switching circuit 416 - Branch information register (QBfl) 4
17 Branch information register (QRI) 418...
Branch information register (QR2) 419... Branch information register (QR3) 420 ・Prediction confirmation circuit 421 Address generation circuit 422 ・・Selection circuit 4
23...Register (WR) 424 Instruction prefetch control circuit 425...Flip frontor' 501,5
02...Storage section 503.504.505.50
6... Test circuit 507... Priority circuit 508... Selection circuit 509... OR circuit. Agent Patent Attorney Shinimo Uchihara 130

Claims (1)

【特許請求の範囲】 分岐命令のアドレスを指定する情報と該分岐命令に対応
する分岐方向及び分岐光アドレスを含んだ分岐情報とを
対にして複数対記憶する分岐ヒストリテーブル手段と、 命令先取りにおいて先取シされるべき分岐命令のアドレ
スを指定する情報が前記ヒス) l)テーブル手段に登
録されているか否かを調べ該分岐命令の登録の判明に応
答して前記分岐ヒスl−’Jテーブルから対応する分岐
情報を読み出す手段と、該分岐情報に従い命令の先取シ
動作を実施する命令先取逆制御手段と、 命令実行装置で実行された分岐命令の分岐方向の結果と
該分岐命令の分岐ヒス) IJテーブルの分岐方向情報
とを比較し、該分岐命令の分岐方向が(ン 正しく予測されため否かを確認する手段と、前記確認手
段によシ分岐命令の分岐方向予測が間違っていると判定
された場合は、該分岐命令の正しい後続命令を取り出し
て実行する手段と、前記分岐命令の実行結果で前記分岐
ヒストリテーブル手段中の分岐情報を更新する手段とを
備えたことを特徴とする分岐方向予測を行なう命令先取
シ装置。
[Scope of Claims] A branch history table means for storing a plurality of pairs of information specifying the address of a branch instruction and branch information including a branch direction and a branch optical address corresponding to the branch instruction; Information specifying the address of the branch instruction to be preempted is checked to see if it is registered in the table means, and in response to finding out that the branch instruction is registered, the information specifying the address of the branch instruction to be preempted is retrieved from the branch hiss table. means for reading out corresponding branch information; instruction preemption reverse control means for preempting instructions according to the branch information; branch direction results of branch instructions executed by the instruction execution device and branch history of the branch instructions) means for comparing the branch direction information in the IJ table to check whether the branch direction of the branch instruction is correctly predicted; and determining that the branch direction prediction of the branch instruction is incorrect by the checking means. If the branch instruction is executed, the branch is characterized by comprising means for fetching and executing a correct subsequent instruction of the branch instruction, and means for updating branch information in the branch history table means with the execution result of the branch instruction. An instruction preemption device that performs direction prediction.
JP20155982A 1982-11-17 1982-11-17 Instruction prefetch device forecasting branch direction Pending JPS5991554A (en)

Priority Applications (4)

Application Number Priority Date Filing Date Title
JP20155982A JPS5991554A (en) 1982-11-17 1982-11-17 Instruction prefetch device forecasting branch direction
EP83111451A EP0109655B1 (en) 1982-11-17 1983-11-15 Instruction prefetching device with prediction of a branch destination address
DE8383111451T DE3382350D1 (en) 1982-11-17 1983-11-15 ARRANGEMENT FOR RETRIEVING COMMANDS PREDICTING A BRANCH TARGET ADDRESS.
US07/286,021 US4984154A (en) 1982-11-17 1988-12-19 Instruction prefetching device with prediction of a branch destination address

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP20155982A JPS5991554A (en) 1982-11-17 1982-11-17 Instruction prefetch device forecasting branch direction

Publications (1)

Publication Number Publication Date
JPS5991554A true JPS5991554A (en) 1984-05-26

Family

ID=16443054

Family Applications (1)

Application Number Title Priority Date Filing Date
JP20155982A Pending JPS5991554A (en) 1982-11-17 1982-11-17 Instruction prefetch device forecasting branch direction

Country Status (1)

Country Link
JP (1) JPS5991554A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62293434A (en) * 1986-06-12 1987-12-21 Nec Corp Branch destination forecasting controlling system
US6920549B1 (en) 1999-09-30 2005-07-19 Fujitsu Limited Branch history information writing delay using counter to avoid conflict with instruction fetching

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS4925832A (en) * 1972-07-05 1974-03-07
JPS5022384A (en) * 1973-06-29 1975-03-10
JPS5599655A (en) * 1979-01-26 1980-07-29 Tetsunori Nishimoto Branch control unit
JPS5759253A (en) * 1980-09-29 1982-04-09 Nec Corp Branch instruction prefetch system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS4925832A (en) * 1972-07-05 1974-03-07
JPS5022384A (en) * 1973-06-29 1975-03-10
JPS5599655A (en) * 1979-01-26 1980-07-29 Tetsunori Nishimoto Branch control unit
JPS5759253A (en) * 1980-09-29 1982-04-09 Nec Corp Branch instruction prefetch system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62293434A (en) * 1986-06-12 1987-12-21 Nec Corp Branch destination forecasting controlling system
US6920549B1 (en) 1999-09-30 2005-07-19 Fujitsu Limited Branch history information writing delay using counter to avoid conflict with instruction fetching

Similar Documents

Publication Publication Date Title
US4881170A (en) Instruction prefetch control apparatus
US4985825A (en) System for delaying processing of memory access exceptions until the execution stage of an instruction pipeline of a virtual memory system based digital computer
US4725947A (en) Data processor with a branch target instruction storage
JP3231571B2 (en) Ordered multi-thread execution method and its execution device
US8117395B1 (en) Multi-stage pipeline for cache access
JPS59165144A (en) Order extractor
JPH0283735A (en) Instruction prefetching device
KR100335744B1 (en) Load/load detection and reorder method
CN110291507B (en) Method and apparatus for providing accelerated access to a memory system
US20020099922A1 (en) Data processing apparatus including a plurality of pipeline processing mechanisms in which memory access instructions are carried out in a memory access pipeline
US6938148B2 (en) Managing load and store operations using a storage management unit with data flow architecture
JPS5991551A (en) Instruction prefetching device forecasting address to be branched
EP0442690A2 (en) Data cache store buffer for high performance computer
JPS5991554A (en) Instruction prefetch device forecasting branch direction
JPS59132047A (en) Data processing unit
JPS6051947A (en) Instruction prefetching system in virtual storage computer
JPH046983B2 (en)
JPS6310451B2 (en)
KR950000088B1 (en) Data processing system
JPS60175148A (en) Instruction prefetching device
JPS581247A (en) Cntrolling method for instruction advance-fetch
JPH07200406A (en) Cache system
JP2542565B2 (en) Branch predictive control method
JPH0695306B2 (en) Instruction prefetching device
JPH04340145A (en) Cache memory device