JPS61175733A - Control system of branch estimation - Google Patents
Control system of branch estimationInfo
- Publication number
- JPS61175733A JPS61175733A JP1588585A JP1588585A JPS61175733A JP S61175733 A JPS61175733 A JP S61175733A JP 1588585 A JP1588585 A JP 1588585A JP 1588585 A JP1588585 A JP 1588585A JP S61175733 A JPS61175733 A JP S61175733A
- Authority
- JP
- Japan
- Prior art keywords
- branch
- instruction
- address
- register
- buffer
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/38—Concurrent instruction execution, e.g. pipeline or look ahead
- G06F9/3836—Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
- G06F9/3842—Speculative instruction execution
- G06F9/3844—Speculative instruction execution using dynamic branch prediction, e.g. using branch history tables
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
Description
【発明の詳細な説明】
〔産業上の利用分野〕
本発明は分岐命令の高速化を図る分岐予測制御方式に関
する。DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a branch prediction control method for increasing the speed of branch instructions.
分岐命令の高速化技術として、分岐命令の履歴を記憶し
、過去の結果を基に分岐成功/不成功及び分岐先を予測
する方法がある。(例えばI BEECOMPUTE&
1984 1月号 P6〜P22)〔発明が解決しよ
うとする問題点〕
上述した分岐予測は分岐命令を含む命令語アドレスと、
該分岐命令の分岐先アドレスとを保持する分岐ヒストリ
バッファを設け、命令取出時に取出し命令中に分岐命令
を含む場合、分岐先アドレスを得るものである。この分
岐予測バッファでは分岐命令実行時、予測が失敗する度
にその結果に基づき内容が修正されている。As a technique for speeding up branch instructions, there is a method of storing a history of branch instructions and predicting branch success/failure and branch destination based on past results. (For example, I BEECOMPUTE&
1984 January issue P6-P22) [Problems to be solved by the invention] The above-mentioned branch prediction uses an instruction word address containing a branch instruction,
A branch history buffer is provided to hold the branch destination address of the branch instruction, and when an instruction is fetched and the fetched instruction includes a branch instruction, the branch destination address is obtained. In this branch prediction buffer, the contents are modified based on the result every time a prediction fails when a branch instruction is executed.
ところが7オートランプログラムのDOループなどで使
用されるループ制御用分岐命令では、そのループが再度
使用される場合、やはシ分岐成功の確率が高い。従って
、ループを抜は出るとき、分岐予測が失敗(成功を予測
したが実際は分岐失敗)シ、分岐予測バッファを更新し
てしまうと、再度このループを実行する場合、予測は再
度失敗するという欠点がある。However, with a loop control branch instruction used in a DO loop of a 7 autorun program, if the loop is used again, the probability of a successful branch is high. Therefore, when exiting the loop, the branch prediction fails (predicted success but actually failed), and if the branch prediction buffer is updated, the prediction will fail again if this loop is executed again. There is.
すなわち本発明の分岐予測制御方式では、ループ制御用
の分岐命令においては、分岐不成功時。That is, in the branch prediction control method of the present invention, in a branch instruction for loop control, when a branch fails.
分岐予測バッファの対応するエントリの内容を無効化し
ないことに特徴がある。The feature is that the content of the corresponding entry in the branch prediction buffer is not invalidated.
次に本発明について図面を参照して詳細に説明する。 Next, the present invention will be explained in detail with reference to the drawings.
第1図を参照すると、本発明の一実施例は外部から与え
られる仮想アドレスを格納する仮想アドレスレジスタ1
、このレジスタ1からのアドレスおよび取出命令アドレ
スKrtJを加算したアドレスとのどちらか一方を選択
して出力する切替回路2、この切換回路2からの出力の
うち下位ビットによシ指定された位置に分岐命令のアド
レスを格納する分岐ヒストリバッファ(K) 3 、前
記下位ビットによシ指定された位置に分岐先アドレスを
保持する分岐ヒストリバッフ、(”14.分岐ヒストリ
バッファ(K)3の内容と前記レジスタ1からのアドレ
スとを比較する比較回路5および6、この比較回路5お
よび6のどちらか一方の一致検出に応答して分岐ヒスト
リバッファ(D)4の出力を選択出力する切替回路7、
アトア命令によるメモリへの書込アドレスを保持するス
トアアドレスレジスタ8、取出した命令のアドレス範囲
のうち上限のアドレスを保時する取出命令アドレスレジ
スタ9、このアドレス範囲のうち少なくとも1組の下限
のアドレスを保持する取出命令アドレスレジスタ10、
このレジスタ10の内容にrllを加算するカウンタ1
1、前記レジスタ8からのアドレスおよび前記レジスタ
9からのアドレスを比較する比較回路l 2.前記レジ
スタ8からのアドレスおよび前記レジスタlOからのア
ドレスを比較する比較回路13、およびこれら比較回路
12および13の出力の論理積をとるアンドゲート14
から構成されている。前記レジスタlO紘レジスタフィ
ルタで構成されてもよい。Referring to FIG. 1, one embodiment of the present invention includes a virtual address register 1 that stores a virtual address given from the outside.
, a switching circuit 2 that selects and outputs either the address from this register 1 or the address obtained by adding the fetch instruction address KrtJ; A branch history buffer (K) 3 that stores the address of the branch instruction, a branch history buffer that holds the branch destination address at the location specified by the lower bit, ("14. Contents of the branch history buffer (K) 3 and Comparing circuits 5 and 6 that compare the address from the register 1; a switching circuit 7 that selects and outputs the output of the branch history buffer (D) 4 in response to detection of a match between either of the comparing circuits 5 and 6;
A store address register 8 that holds the write address to memory by an at-a-toa instruction, a fetch instruction address register 9 that holds the upper limit address of the address range of the fetched instruction, and the lower limit address of at least one set of this address range. a fetch instruction address register 10 holding
Counter 1 that adds rll to the contents of this register 10
1. Comparison circuit l for comparing the address from the register 8 and the address from the register 9. 2. A comparison circuit 13 that compares the address from the register 8 and the address from the register IO, and an AND gate 14 that takes the AND of the outputs of these comparison circuits 12 and 13.
It consists of The register 10 may be composed of a resistor filter.
次に本発明の一実施例の動作を詳細に説明する。Next, the operation of one embodiment of the present invention will be explained in detail.
命令取出のために生成された仮想アドレスはキャッシュ
メモリ(ここでは図示されていない)K送出されると同
時に仮想アドレスレジスタIKセットされる。仮想アド
レスレジスタ1の出力は切替回路2を通し、分岐命令の
アドレスを保持する分岐ヒストリバッファ([Q3およ
び分岐先アドレスを保持する分岐ヒストリバッファβ4
に供給される。The virtual address generated for fetching the instruction is sent to a cache memory (not shown here) and at the same time the virtual address register IK is set. The output of the virtual address register 1 is passed through the switching circuit 2 to a branch history buffer ([Q3] that holds the address of the branch instruction and a branch history buffer β4 that holds the branch destination address).
supplied to
アドレスレジスタlの内容によシ取出そうとする命令が
以前の取出して分岐命令を含みかつその分岐命令が条件
分岐成功または無条件分岐の場合、分岐先アドレスが分
岐予測バッファ4よシ得られる。分岐予測バッファ3お
よび4は2レベルで構成される。比較回路5もしくは6
のどちらで取出アドレスの一致が検出されたかによシ、
分岐ヒストリバ、77◎の出力が切替回路7によシ選択
され、分岐予測ビット信号とともに送出される。この分
岐予測アドレス出力を用い命令取出することによ)分岐
先命令語の取出しが高速化され、分岐命令の実行が高速
処理されることになる。If the instruction to be fetched according to the contents of the address register 1 includes a branch instruction previously fetched and the branch instruction is a successful conditional branch or an unconditional branch, the branch destination address is obtained from the branch prediction buffer 4. Branch prediction buffers 3 and 4 are configured at two levels. Comparison circuit 5 or 6
Depending on whether a match of the retrieval address was detected,
The output of the branch history bar 77◎ is selected by the switching circuit 7 and sent out together with the branch prediction bit signal. By fetching an instruction using this branch predicted address output, the branch destination instruction word can be fetched at high speed, and the branch instruction can be executed at high speed.
仮想アドレスレジスタIKセットされた命令取出アドレ
スはさらに取出した命令のアドレス範囲を保持する取出
命令アドレスレジスタ9および10に送出される。分岐
先の先頭命令の取出し時には両方のレジスタに取出アド
レスがセットされるが、2回目以降の取出しでは、取出
命令アドレスレジスタ([J)9にのみセットされる。The instruction fetch address set in virtual address register IK is further sent to fetch instruction address registers 9 and 10 which hold the address range of the fetched instruction. When the first instruction of the branch destination is fetched, the fetch address is set in both registers, but in the second and subsequent fetches, only the fetch instruction address register ([J) 9 is set.
一方、取出した命令が一命令実行される度に取出命令ア
ドレスレジスタ(L)10の内容はカウンタ11を通し
て1が加算される。これによ〕取出した命令のアドレス
の上限と下限が保持される。ストアアドレスレジスタ8
はストア命令によるメモリへの書込アドレスを保持する
。このストアアドレスと取出した命令の範囲とは比較回
路12および13によシチェ。On the other hand, each time one fetched instruction is executed, the contents of the fetched instruction address register (L) 10 are incremented by 1 through a counter 11. As a result, the upper and lower limits of the address of the fetched instruction are maintained. Store address register 8
holds the address written to memory by a store instruction. This store address and the range of the fetched instruction are determined by comparison circuits 12 and 13.
りされ、先取シした命令語の先行するストア命令による
書替があったかどうかが検出される。もし書替が検出さ
れた場合、命令の取出し直しから処理を再開する。取出
した命令を保持する命令バ。It is detected whether the preempted instruction word has been rewritten by the preceding store instruction. If rewriting is detected, processing is restarted from re-fetching the instruction. An instruction bar that holds fetched instructions.
7アおよび取出命令アドレスレジスタ9および10は、
分岐命令高速化のために3組用意されておシ、分岐命令
によシ命令ストリームが変更される度に他の組を使用す
るよう制御される。7a and fetch instruction address registers 9 and 10,
Three sets of branch instructions are prepared for speeding up the branch instruction, and each time the instruction stream is changed by a branch instruction, another set is controlled to be used.
分mヒストリバッファにセットキれていない分岐命令の
セットは次のように行なわれる。条件分岐成功または無
条件分岐命令の対応エントリが分岐予測バッファ9およ
びIOKない場合、分岐命令実行時に1分岐命令自身の
アドレスが取出命令アドレスレジスタ(L)10から仮
想アドレスレジスタ1にセットされる。次に該分岐命令
のアドレス計算によシ取出命令アドレスレジスター10
のレジスタファイル中の別のレジスタにセットされた分
岐先アドレスが取出され、仮想アドレスレジスタlで指
定された分岐予測バッファ(D)4にセットされるとと
もに1分岐予測バッファ(K)3に仮想アドレスレジス
タ1の内容がセットされる。2レベルの予測バッファの
どちらのレベルにセットするかは公知のリプレースメン
トアルゴリズムが使用される。Branch instructions that have not been set in the minute history buffer are set as follows. If there is no corresponding entry of a successful conditional branch or an unconditional branch instruction in the branch prediction buffer 9 and IOK, the address of one branch instruction itself is set from the fetch instruction address register (L) 10 to the virtual address register 1 when the branch instruction is executed. Next, by calculating the address of the branch instruction, the fetch instruction address register 10
The branch destination address set in another register in the register file is retrieved and set in the branch prediction buffer (D) 4 specified by the virtual address register l, and the virtual address is also stored in the branch prediction buffer (K) 3. The contents of register 1 are set. A known replacement algorithm is used to determine which level of the two-level prediction buffer to set.
一方分岐予側バッ7ア9.IOK既にセットされた内容
が:命令の書替によ多分岐命令で無くなった、分岐先ア
ドレスが変更された、分岐成功が失敗に変ったなどの理
由で不正とな、った場合、分岐予測バッファ(K)3中
の有効性表示ピッ)(Vビット)のリセットが行なわれ
対応エントリの無効化が図られる。しかしFOR,T
R,ANプログラムなどで用いられるDOループの制御
用分岐命令は、同一ループの多数回使用があるので、た
とえ分岐不成功であっても、対応エントリをリセットし
ない。On the other hand, branching side bag 7a9. If the content that has already been set in IOK becomes invalid because it is no longer a multi-branch instruction due to instruction rewriting, the branch destination address has been changed, or a branch success has changed to failure, the branch prediction The validity indicator bit (V bit) in the buffer (K) 3 is reset to invalidate the corresponding entry. But FOR,T
Branch instructions for controlling DO loops used in R, AN programs, etc. do not reset the corresponding entry even if the branch is unsuccessful, since the same loop is used many times.
すなわち、DOループを抜は出すときに必ず分岐予測は
失敗するが、この時毎回分岐ヒストリバッファの対応エ
ントリを無効化すると、再度このループを使用する時に
も分岐予測失敗となってしまい、性能が低下するからで
ある。In other words, branch prediction always fails when exiting a DO loop, but if you invalidate the corresponding entry in the branch history buffer each time, branch prediction will fail even when this loop is used again, which will reduce performance. This is because it decreases.
第2図を参照すると、分岐予測時の性能が従来方式と比
較される。分岐予測成功時には、分岐命令実行時間が大
幅に改善されている。従来方式では条件分岐命令の演算
サイクルで、分岐成功/不成功が判断される。分岐成功
の場合状のサイクルから分岐先命令のアドレス計算サイ
クルが開始されるため、分岐命令の実行完了(Eサイク
ル終了)から分岐先命令のEサイクル終了まで4マシン
サイクル必要である。一方分岐予測を行った場合、分岐
命令の取出PIプサイルで分岐予測バッファを索引する
ことによシ、取出した命令に分岐成功予予測の分岐命令
を含む場合には分岐先アドレスを得ることができる。こ
のアドレスを用いて分岐先命令の取出およびデコードが
行われ、分岐命令のEサイクルの次のサイクルで、分岐
先命令が実行されることによ〕、本例のパイプライン構
造の場合、従来方式に比し分岐命令の実行時間が4倍高
速化される。Referring to FIG. 2, performance during branch prediction is compared with the conventional method. When branch prediction is successful, branch instruction execution time is significantly improved. In the conventional method, the success/failure of a branch is determined in the operation cycle of a conditional branch instruction. Since the address calculation cycle for the branch destination instruction starts from the cycle in which the branch is successful, four machine cycles are required from the completion of execution of the branch instruction (end of the E cycle) to the end of the E cycle of the branch destination instruction. On the other hand, when branch prediction is performed, by indexing the branch prediction buffer using the branch instruction fetch PI pesile, the branch destination address can be obtained if the fetched instruction includes a branch instruction predicted to be a successful branch. . This address is used to fetch and decode the branch destination instruction, and the branch destination instruction is executed in the cycle following the E cycle of the branch instruction. The execution time of a branch instruction is four times faster than that of a branch instruction.
本発明には、ループ制御用の分岐命令では分岐不成功時
分舷予測バッファの対応するエン) I)を無効化しな
いことkよ多分岐命令の性能を改善できるという効果が
ある。The present invention has the effect that the performance of multi-branch instructions can be improved by not invalidating the corresponding I) of the branch prediction buffer when a branch fails in branch instructions for loop control.
第1図は本発明の一実施例を示す図、および第2図は分
岐予測の効果を示す図である。
第1図および第2図において、1・・・・・・仮想アド
レスレジスタ、2,7・・・・・・切替回路、3・・・
・・・分岐予測バッファ(転)、4・・・・・・分岐予
測バッファ(至)、5゜6.12.13・・・・・・比
較回路、8・・・・・・ストアアドレスレジスタ、9・
・・・・・取出命令アドレスレジスタ(ロ)、lO・・
・・・・散出命令アドレスレジスター、11・・・・・
・カウンタ。
A : アトし又it璋“ソ”イフル
I ニ アトしス+□i+1イクル
C: キ4ツシェア7七又ブイ1ノし
E : 殉」賽′す′イクル
4イ9 2 膠dFIG. 1 is a diagram showing an embodiment of the present invention, and FIG. 2 is a diagram showing the effect of branch prediction. 1 and 2, 1...virtual address register, 2, 7...switching circuit, 3...
...Branch prediction buffer (to), 4...Branch prediction buffer (to), 5゜6.12.13...Comparison circuit, 8...Store address register , 9・
...Fetch command address register (b), lO...
...Scattered instruction address register, 11...
·counter. A: Ato Shimata it Sho "So" I Full I Ni At Shisu + □i + 1 cycle C: Ki 4 shares 7 Seven pronged buoy 1 Noshi E: Martyr's death's' Cycle 4 I 9 2 Glue d
Claims (1)
保持する分岐ヒストリバッファを備えた情報処理装置で
あって、 ループ制御用の分岐命令においては、分岐不成功時前記
分岐ヒストリバッファの対応するエントリの内容を無効
化しないことを特徴とする分岐予測制御方式。[Scope of Claims] An information processing device comprising a branch history buffer that holds an address of a branch instruction and a branch destination address of the branch instruction, wherein in a branch instruction for loop control, when the branch fails, the branch A branch prediction control method characterized by not invalidating the contents of a corresponding entry in a history buffer.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP1588585A JPS61175733A (en) | 1985-01-30 | 1985-01-30 | Control system of branch estimation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP1588585A JPS61175733A (en) | 1985-01-30 | 1985-01-30 | Control system of branch estimation |
Publications (1)
Publication Number | Publication Date |
---|---|
JPS61175733A true JPS61175733A (en) | 1986-08-07 |
Family
ID=11901245
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP1588585A Pending JPS61175733A (en) | 1985-01-30 | 1985-01-30 | Control system of branch estimation |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPS61175733A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS63303432A (en) * | 1987-01-22 | 1988-12-12 | Nec Corp | System for controlling writing in branching history table |
JPH01296341A (en) * | 1988-05-25 | 1989-11-29 | Nec Corp | Data processor |
US6754813B1 (en) | 1999-08-24 | 2004-06-22 | Fujitsu Limited | Apparatus and method of processing information for suppression of branch prediction |
-
1985
- 1985-01-30 JP JP1588585A patent/JPS61175733A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS63303432A (en) * | 1987-01-22 | 1988-12-12 | Nec Corp | System for controlling writing in branching history table |
JPH01296341A (en) * | 1988-05-25 | 1989-11-29 | Nec Corp | Data processor |
US6754813B1 (en) | 1999-08-24 | 2004-06-22 | Fujitsu Limited | Apparatus and method of processing information for suppression of branch prediction |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US4477872A (en) | Decode history table for conditional branch instructions | |
US4725947A (en) | Data processor with a branch target instruction storage | |
US4827402A (en) | Branch advanced control apparatus for advanced control of a branch instruction in a data processing system | |
JPH0283735A (en) | Instruction prefetching device | |
JPS6234242A (en) | Data processing system | |
JPS63175934A (en) | Data processor | |
JPS6125169B2 (en) | ||
JP7590336B2 (en) | Data Structure Abandonment | |
JPH08320788A (en) | Pipeline system processor | |
US3553655A (en) | Short forward conditional skip hardware | |
JPS61175733A (en) | Control system of branch estimation | |
JP3723019B2 (en) | Apparatus and method for performing branch prediction of instruction equivalent to subroutine return | |
JP2534662B2 (en) | Instruction cache control method | |
JP3082944B2 (en) | Pipeline processing equipment | |
JPH046983B2 (en) | ||
JP2542565B2 (en) | Branch predictive control method | |
JPS62159230A (en) | Instruction prefetching device | |
JPH0612256A (en) | Instruction cache control system | |
JPS62159231A (en) | Instruction prefetching device | |
JPH01296343A (en) | Data processor | |
JPS62159232A (en) | Instruction prefetching device | |
JPS59177653A (en) | Instruction prefetch control system | |
JPS6114536B2 (en) | ||
JPH0774992B2 (en) | Data processing device | |
JPS63311438A (en) | Control circuit for discrepancy of store instruction |