JPH06324866A - Branch direction prediction dynamic change device - Google Patents

Branch direction prediction dynamic change device

Info

Publication number
JPH06324866A
JPH06324866A JP10207093A JP10207093A JPH06324866A JP H06324866 A JPH06324866 A JP H06324866A JP 10207093 A JP10207093 A JP 10207093A JP 10207093 A JP10207093 A JP 10207093A JP H06324866 A JPH06324866 A JP H06324866A
Authority
JP
Japan
Prior art keywords
branch
prediction
branch direction
direction prediction
value
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
JP10207093A
Other languages
Japanese (ja)
Inventor
Takayuki Sasaki
孝幸 佐々木
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
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 filed Critical NEC Corp
Priority to JP10207093A priority Critical patent/JPH06324866A/en
Publication of JPH06324866A publication Critical patent/JPH06324866A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To prevent processing speed from being reduced due to the reduction of a success rate for the branch direction prediction of a branch instruction by the branch instruction operating method of a program when the branch direction prediction of the branch instruction without possessing an execution history is performed. CONSTITUTION:A branch direction prediction value decision circuit 7 compares a value in which the value of a branch direction prediction failure counter 4 is subtracted from the value of a branch instruction counter 3 with the value of the branch direction prediction failure counter 4 with an input signal from a branch direction prediction measuring timer 6 as a turning-point and outputs a branch direction prediction value control signal to a branch direction prediction value register 8 when a comparison result shows that the value in which the value of the branch direction prediction failure counter 4 is subtracted from the value of the branch instruction counter 3 is smaller than the value of the branch direction prediction failure counter 4.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は分岐命令の分岐方向予測
を行い分岐方向予測成功処理を分岐方向予測失敗処理よ
り高速に実行する情報処理装置上で分岐命令の分岐方向
予測方向を動的に変更する分岐方向予測動的変更装置に
関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention dynamically predicts the branch direction prediction direction of a branch instruction on an information processing device that predicts the branch direction of a branch instruction and executes branch direction prediction success processing faster than branch direction prediction failure processing. The present invention relates to a branch direction prediction dynamic change device for changing.

【0002】[0002]

【従来の技術】従来この種の分岐方向予測は、特開平3
−73022号公報に示されている。図6に示されてい
るように、一般的なプログラムでは同一箇所の分岐命令
において再度分岐する確率が高いことを利用し、分岐予
測回路が用いられている。さらに、プログラムの特色で
ある『後方分岐は繰返し発生する確率が大』、『前方分
岐の繰返しの確率はプログラムによることが大きい』と
いうことを利用し、分岐命令のアドレスと分岐先のアド
レスとを比較している。
2. Description of the Related Art Conventionally, this kind of branch direction prediction is disclosed in Japanese Patent Laid-Open No.
-73022 publication. As shown in FIG. 6, in a general program, a branch prediction circuit is used by utilizing the fact that a branch instruction at the same location has a high probability of branching again. Furthermore, by utilizing the characteristics of the program "the backward branch has a high probability of repeated occurrence" and "the repeated probability of the forward branch depends on the program", the address of the branch instruction and the address of the branch destination are used. I'm comparing.

【0003】また、初めて実行され以前の分岐方向が不
明の分岐命令については、情報処理装置のハードウェア
が固定的に分岐方向の予測を行なっていた。
Further, for a branch instruction which is executed for the first time and whose branch direction is unknown before, the hardware of the information processing apparatus fixedly predicts the branch direction.

【0004】[0004]

【発明が解決しようとする課題】一般に分岐命令の分岐
方向予測は、ソフトウェア命令実行を高速に処理するた
めに行われ、分岐方向予測が失敗した場合、分岐方向予
測が成功した場合に比べ処理は遅くなる。
Generally, the branch direction prediction of a branch instruction is performed in order to process the software instruction at high speed, and when the branch direction prediction fails, the processing is performed as compared with the case where the branch direction prediction succeeds. Become slow.

【0005】上述した従来の分岐命令の分岐方向予測に
おいて、ハードウェアが固定的に分岐方向の予測を行う
場合は、同じ論理のプログラムであってもプログラムの
分岐命令使用方法によりプログラムの処理時間に差がで
きる。したがって、高速処理するようにプログラムを作
成する場合ハードウェアが固定的に分岐方向を予測する
分岐命令の分岐方向を考慮して分岐命令を使用しなけれ
ばならないという欠点がある。
In the conventional branch direction prediction of the above-mentioned branch instruction, when the hardware fixedly predicts the branch direction, even if the programs have the same logic, the processing time of the program depends on the branch instruction usage method of the program. There is a difference. Therefore, when creating a program for high-speed processing, there is a drawback in that the hardware must use the branch instruction in consideration of the branch direction of the branch instruction that predicts the branch direction in a fixed manner.

【0006】[0006]

【課題を解決するための手段】上述の課題を解決するた
め、本発明の第1の分岐方向予測動的変更装置は、分岐
命令の分岐方向の予測値を格納する分岐方向予測値レジ
スタと、この分岐方向予測値レジスタからの予測値で示
される分岐方向と処理される分岐命令の分岐方向とを比
較する分岐方向予測回路と、この分岐方向予測回路から
の信号に基づいて予測失敗回数と予測成功回数との少な
くとも一方を計数するカウンタと、このカウンタからの
計数値に基づき一定計測時間内に予測失敗回数が予測成
功回数より大きいか否かを判定し分岐方向予測値レジス
タに格納された分岐方向予測値の予測分岐方向を切換え
るため予測失敗回数が予測成功回数より大きいことを示
す信号を出力する分岐方向予測値判定回路とを含む。
In order to solve the above-mentioned problems, a first branch direction prediction dynamic changing device of the present invention comprises a branch direction prediction value register for storing a branch direction prediction value of a branch instruction, A branch direction prediction circuit that compares the branch direction indicated by the predicted value from the branch direction prediction value register with the branch direction of the branch instruction to be processed, and the number of prediction failures and prediction based on the signal from the branch direction prediction circuit. A counter that counts at least one of the number of successes and a branch stored in the branch direction prediction value register that determines whether the number of prediction failures is greater than the number of successes of prediction within a certain measurement time based on the count value from this counter A branch direction prediction value determination circuit that outputs a signal indicating that the number of prediction failures is greater than the number of prediction successes for switching the prediction branch direction of the directional prediction value.

【0007】上述の課題を解決するための、本発明の第
2の分岐方向予測動的変更装置は、ソフトウェア命令の
実行処理ごとにソフトウェア命令が分岐命令かどうか判
定する分岐命令判定回路と、この分岐命令判定回路での
分岐命令判定信号に応答して加算する分岐命令カウンタ
と、分岐命令判定回路からの判定結果にもとづいて分岐
命令の分岐方向が分岐方向予測値レジスタからの予測値
の示す分岐方向と一致していないとき分岐方向予測失敗
信号を出力する分岐方向予測回路と、この分岐方向予測
回路からの分岐方向予測失敗信号を計数し分岐方向予測
の失敗回数を求める分岐方向予測失敗カウンタと、分岐
方向予測成功と分岐方向予測失敗の計測時間に関し一定
時間を計時するタイマと、このタイマで示される時間内
にカウントされる分岐方向予測失敗カウンタからの予測
失敗回数および分岐命令カウンタからの分岐命令数から
予測失敗回数を差し引くことにより得られる予測成功回
数を比較しこの予測失敗回数が予測成功回数より大きけ
れば分岐方向予測値の予測分岐方向を切換えるための信
号を出力する分岐方向予測値判定回路と、予測分岐方向
を示す分岐方向予測値を格納し、前記分岐方向予測値判
定回路からの予測失敗回数が予測成功回数より大きい旨
を示す信号を与えられたときその失敗方向に分岐予測値
を切換える分岐方向予測値レジスタとを含む。
A second branch direction predictive dynamic changing device of the present invention for solving the above-mentioned problems includes a branch instruction judging circuit for judging whether or not a software instruction is a branch instruction for each execution process of the software instruction, and A branch instruction counter that adds in response to a branch instruction determination signal in the branch instruction determination circuit, and the branch direction of the branch instruction based on the determination result from the branch instruction determination circuit is the branch indicated by the predicted value from the branch direction predicted value register. A branch direction prediction circuit that outputs a branch direction prediction failure signal when the directions do not match, and a branch direction prediction failure counter that counts the branch direction prediction failure signal from this branch direction prediction circuit to obtain the number of branch direction prediction failures , A timer that keeps a fixed time for the measurement time of branch direction prediction success and branch direction prediction failure, and is counted within the time indicated by this timer The prediction success count obtained by subtracting the prediction failure count from the multi-direction prediction failure counter and the branch instruction count from the branch instruction counter is compared. If this prediction failure count is greater than the prediction success count, the branch direction prediction value A branch direction prediction value determination circuit that outputs a signal for switching the prediction branch direction, and a branch direction prediction value that indicates the prediction branch direction are stored, and the number of prediction failures from the branch direction prediction value determination circuit is greater than the number of prediction successes. A branch direction prediction value register for switching the branch prediction value in the failure direction when a signal indicating a large value is given.

【0008】本発明の第3の分岐方向予測動的変更装置
は、ソフトウェア命令の実行処理ごとにソフトウェア命
令が分岐命令か否か判定する分岐命令判定回路と、この
分岐命令判定回路からの判定結果にもとづいて分岐命令
の分岐方向が分岐方向予測値レジスタからの予測値と一
致していないとき分岐方向予測失敗信号を出力し一致し
ているとき分岐方向予測成功信号を出力する分岐方向予
測回路と、この分岐方向予測回路からの分岐方向予測失
敗信号を計数し分岐方向予測の失敗回数を求める分岐方
向予測失敗カウンタと、前記分岐方向予測回路からの分
岐方向予測成功信号を計数し分岐方向予測の成功回数を
求める分岐方向予測成功カウンタと、分岐方向予測成功
と分岐方向予測失敗の計測時間に関し一定時間を計時す
るタイマと、このタイマで示される時間内にカウントさ
れる前記分岐方向予測失敗カウンタからの予測失敗回数
と前記分岐方向予測成功カウンタからの予測成功回数と
を比較しこの予測失敗回数が予測成功回数より大きけれ
ば分岐方向予測値の予測分岐方向を切換える信号を出力
する分岐方向予測値判定回路と、予測分岐方向を示す分
岐方向予測値を格納し前記分岐予測値判定回路からの予
測失敗回数が予測成功回数より大きいことを示す信号に
より分岐方向予測値の予測分岐方向を切換える分岐方向
予測値レジスタ8とを含む。
A third branch direction prediction dynamic changing device of the present invention is a branch instruction judging circuit for judging whether or not a software instruction is a branch instruction for each execution process of software instructions, and a judgment result from this branch instruction judging circuit. A branch direction prediction circuit that outputs a branch direction prediction failure signal when the branch direction of the branch instruction does not match the prediction value from the branch direction prediction value register and outputs a branch direction prediction success signal when they match. , A branch direction prediction failure counter for counting the number of branch direction prediction failure signals from the branch direction prediction circuit to obtain the number of failures in branch direction prediction, and a branch direction prediction success signal from the branch direction prediction circuit for counting branch direction prediction success signals. A branch direction prediction success counter that obtains the number of successes, a timer that measures a certain time with respect to the measurement time of branch direction prediction success and branch direction prediction failure, and this The prediction failure count from the branch direction prediction failure counter and the prediction success count from the branch direction prediction success counter, which are counted within the time indicated by the interval, are compared. If the prediction failure count is greater than the prediction success count, the branch direction A branch direction prediction value determination circuit that outputs a signal that switches the prediction branch direction of the prediction value, and a branch direction prediction value that indicates the prediction branch direction, and the number of prediction failures from the branch prediction value determination circuit is greater than the number of prediction successes. And a branch direction prediction value register 8 for switching the prediction branch direction of the branch direction prediction value by a signal indicating.

【0009】本発明の第4の分岐方向予測動的変更装置
は、ソフトウェア命令の実行処理ごとにソフトウェア命
令が分岐命令かどうか判定する分岐命令判定回路と、こ
の分岐命令判定回路での分岐命令判定信号に応答して加
算する分岐命令カウンタと、分岐命令判定回路からの判
定結果にもとづいて分岐命令の分岐方向が分岐方向予測
レジスタからの予測値の示す分岐方向と一致するとき分
岐方向予測成功信号を出力する分岐方向予測回路と、こ
の分岐方向予測回路からの分岐方向予測成功信号を計数
し分岐方向予測の成功回数を求める分岐方向予測成功カ
ウンタと、分岐方向予測成功と分岐方向予測失敗の計測
時間に関し一定時間を計時するタイマと、このタイマで
示される時間内にカウントされる分岐方向予測成功カウ
ンタからの予測成功回数および分岐命令カウンタからの
分岐命令数から予測成功回数を差し引くことにより得ら
れる予測失敗回数を比較しこの予測失敗回数が予測成功
回数より大きければ分岐方向予測値の予測分岐方向を切
換えるための信号を出力する分岐方向予測値判定回路
と、予測分岐方向を示す分岐方向予測値を格納し分岐方
向予測値判定回路からの予測失敗回数が予測成功回数よ
り大きい旨の信号を与えられたときその失敗方向に分岐
予測値を切換える分岐方向予測値レジスタとを含む。
A fourth branch direction predictive dynamic change device of the present invention is a branch instruction determination circuit for determining whether or not a software instruction is a branch instruction for each execution process of a software instruction, and a branch instruction determination in this branch instruction determination circuit. Branch direction prediction success signal when the branch direction of the branch instruction matches the branch direction indicated by the predicted value from the branch direction prediction register based on the judgment result from the branch instruction judgment circuit and the branch instruction counter that adds in response to the signal. , A branch direction prediction circuit that outputs a branch direction prediction success signal that counts the number of branch direction prediction success signals from the branch direction prediction circuit, and measures the branch direction prediction success and the branch direction prediction failure. Prediction success from a timer that counts a fixed time with respect to time and a branch direction prediction success counter that is counted within the time indicated by this timer. The number of times and the number of prediction failures obtained by subtracting the number of successful predictions from the number of branch instructions from the branch instruction counter are compared. If this number of predicted failures is greater than the number of successful predictions, a signal for switching the predicted branch direction of the branch direction prediction value And a branch direction prediction value determination circuit that outputs a branch direction prediction value that indicates the prediction branch direction, and the branch direction prediction value determination circuit fails when the number of prediction failures is greater than the number of prediction successes And a branch direction prediction value register for switching the branch prediction value in the direction.

【0010】[0010]

【実施例】次に本発明の一実施例について図面を参照し
て詳細に説明する。
An embodiment of the present invention will now be described in detail with reference to the drawings.

【0011】図1を参照すると、本発明の第1の実施例
は、処理実行中のソフトウェアが分岐命令か否かを判定
する分岐命令判定回路1、この分岐命令判定回路1から
の判定結果と分岐方向予測値レジスタ8からの分岐方向
予測値とを入力し分岐命令の分岐方向を予測し実行した
分岐命令の分岐方向と一致しなければ分岐方向予測失敗
信号を出力する分岐方向予測回路2、この分岐方向予測
回路2から与えられる予測分岐方向と実行分岐方向との
不一致信号を入力し加算動作を行い、分岐方向予測失敗
回数を計数し分岐方向予測値判定回路7からの信号によ
り初期化される分岐方向予測失敗カウンタ4、分岐方向
予測値判定回路7からの信号により初期化され分岐命令
判定回路1からの信号に応答して分岐命令の数を加算す
る分岐命令カウンタ3、マイクロ命令またはシフトイン
動作でタイマの初期値を任意に設定できる分岐方向予測
計測タイマ初期値レジスタ5、このレジスタ5からの内
容を減算し、タイマ値がゼロになると分岐方向予測計測
タイマ初期値レジスタ5の内容を入力するとともに分岐
方向予測値判定回路7に信号を出力する分岐方向予測計
測タイマ6、この分岐方向予測計測タイマ6からの入力
信号に応答して分岐命令カウンタ3の値から分岐方向予
測失敗カウンタ4の値を引いた予測成功回数値と分岐方
向予測失敗カウンタ4の予測失敗回数値とを比較し、命
令カウンタ3の値から分岐方向予測失敗カウンタ4の値
を引いた予測成功回数値が分岐方向予測失敗カウンタ4
の予測失敗回数値より小さければ分岐方向予測値レジス
タ8へ分岐方向予測値制御信号を出力するとともに、結
果のいかんを問わず分岐方向予測値の判定に応答して分
岐命令カウンタ3および分岐方向予測失敗カウンタ4へ
初期化制御信号を出力する分岐方向予測値判定回路7お
よびこの分岐方向予測値判定回路7からの予測成功回数
値の予測失敗回数値より小なることを示す分岐方向予測
制御信号により格納値を反転して分岐予測方向を切替
え、分岐予測方向を示す分岐方向予測値を格納する分岐
方向予測値レジスタ8を含む。
Referring to FIG. 1, in the first embodiment of the present invention, a branch instruction judging circuit 1 for judging whether or not the software under execution is a branch instruction, and a judgment result from this branch instruction judging circuit 1 A branch direction prediction circuit 2 which inputs the branch direction prediction value from the branch direction prediction value register 8 to predict the branch direction of the branch instruction, and outputs a branch direction prediction failure signal if the branch direction does not match the branch direction of the executed branch instruction, A mismatch signal between the predicted branch direction and the execution branch direction given from the branch direction prediction circuit 2 is input, an addition operation is performed, the number of branch direction prediction failures is counted, and initialization is performed by a signal from the branch direction prediction value determination circuit 7. A branch instruction counter that is initialized by signals from the branch direction prediction failure counter 4 and the branch direction prediction value determination circuit 7 and that adds the number of branch instructions in response to the signal from the branch instruction determination circuit 1. 3. Branch direction prediction measurement timer initial value register 5 that can arbitrarily set the initial value of the timer by microinstruction or shift-in operation. When the timer value becomes zero by subtracting the contents from this register 5, the branch direction prediction measurement timer initial A branch direction predictive measurement timer 6 that inputs the contents of the value register 5 and outputs a signal to the branch direction predictive value determination circuit 7. From the value of the branch instruction counter 3 in response to an input signal from the branch direction predictive measurement timer 6. The prediction success count value obtained by subtracting the value of the branch direction prediction failure counter 4 and the prediction failure count value of the branch direction prediction failure counter 4 are compared, and the prediction obtained by subtracting the value of the branch direction prediction failure counter 4 from the value of the instruction counter 3 Success count value is branch direction prediction failure counter 4
If it is smaller than the prediction failure frequency value of, the branch direction prediction value control signal is output to the branch direction prediction value register 8 and the branch instruction counter 3 and the branch direction prediction are performed in response to the determination of the branch direction prediction value regardless of the result. A branch direction prediction value determination circuit 7 that outputs an initialization control signal to the failure counter 4 and a branch direction prediction control signal that indicates that the prediction success number value from the branch direction prediction value determination circuit 7 is smaller than the prediction failure number value. A branch direction prediction value register 8 for storing the branch direction prediction value indicating the branch prediction direction by inverting the stored value to switch the branch prediction direction is included.

【0012】次に本発明の第1の実施例の動作について
図面を参照して詳細に説明する。
Next, the operation of the first embodiment of the present invention will be described in detail with reference to the drawings.

【0013】図1を参照すると、分岐命令判定回路1
は、処理実行中のソフトウェア命令のビットパターンを
入力とし分岐命令かどうか判定を行い、分岐命令であれ
ば分岐方向予測回路2と分岐命令カウンタ3へ信号を出
力する。分岐方向予測回路2は、分岐命令判定回路1の
出力信号と分岐方向予測値レジスタ8の出力信号を入力
とし分岐命令の分岐方向を予測し実行した分岐命令の分
岐方向と一致しなければ分岐方向予測失敗カウンタ4へ
信号を出力する。分岐命令カウンタ3は、分岐命令判定
回路1の信号を入力信号として加算動作を行う。分岐命
令カウンタ3の内容は、分岐方向予測値判定回路7へ出
力する。さらに分岐方向予測値判定回路7からの入力信
号により初期化される。分岐方向予測失敗カウンタ4
は、分岐方向予測回路2の信号を入力信号として一加算
動作を行う。分岐方向予測失敗カウンタ4の内容は、分
岐方向予測値判定回路7へ出力する。さらに分岐方向予
測値判定回路7からの入力信号により初期化される。分
岐方向予測計測タイマ初期値レジスタ5は、マイクロ命
令及びシフトイン動作等で任意に書込みができる。分岐
方向予測計測タイマ初期値レジスタ5の内容は、分岐方
向予測計測タイマ6へ出力する。分岐方向予測計測タイ
マ6は、分岐方向予測計測タイマ初期値レジスタ5と同
一のビット幅を持ち減算動作を行う。さらに減算動作に
よりタイマ値がゼロになると分岐方向予測計測タイマ初
期値レジスタ5の内容を設定し分岐方向予測値判定回路
7へ信号を出力する。分岐方向予測値判定回路7は、分
岐命令カウンタ3の出力信号と分岐方向予測失敗カウン
タ4の出力信号と分岐方向予測計測タイマ6の出力信号
を入力とし分岐方向予測値を判定する。分岐方向予測値
の判定は、分岐方向予測計測タイマ6からの入力信号を
契機に分岐命令カウンタ3の値から分岐方向予測失敗カ
ウンタ4の値を引いた値と分岐方向予測失敗カウンタ4
の値を比較することで行われる。比較した結果が命令カ
ウンタ3の値から分岐方向予測失敗カウンタ4の値を引
いた値が分岐方向予測失敗カウンタ4の値より小さけれ
ば分岐方向予測値レジスタ8へ分岐方向予測値制御信号
を出力する。さらに分岐方向予測値の判定が行われた場
合は、分岐命令カウンタ3及び分岐方向予測失敗カウン
タ4へ初期化制御信号を出力する。分岐方向予測値レジ
スタ8は、分岐方向予測値判定回路7からの分岐方向予
測値制御信号により格納値を反転し分岐方向予測値を格
納する。さらに分岐方向予測値レジスタ8は、分岐方向
予測回路2の制御のため信号を出力する。
Referring to FIG. 1, a branch instruction determination circuit 1
Receives a bit pattern of a software instruction being executed, determines whether or not it is a branch instruction, and if it is a branch instruction, outputs a signal to the branch direction prediction circuit 2 and the branch instruction counter 3. The branch direction prediction circuit 2 receives the output signal of the branch instruction determination circuit 1 and the output signal of the branch direction prediction value register 8 as input, predicts the branch direction of the branch instruction, and if it does not match the branch direction of the executed branch instruction, the branch direction A signal is output to the prediction failure counter 4. The branch instruction counter 3 performs addition operation using the signal of the branch instruction determination circuit 1 as an input signal. The content of the branch instruction counter 3 is output to the branch direction prediction value determination circuit 7. Further, it is initialized by the input signal from the branch direction prediction value determination circuit 7. Branch direction prediction failure counter 4
Performs the addition operation using the signal of the branch direction prediction circuit 2 as an input signal. The content of the branch direction prediction failure counter 4 is output to the branch direction prediction value determination circuit 7. Further, it is initialized by the input signal from the branch direction prediction value determination circuit 7. The branch direction prediction measurement timer initial value register 5 can be arbitrarily written by a microinstruction, shift-in operation or the like. The content of the branch direction prediction measurement timer initial value register 5 is output to the branch direction prediction measurement timer 6. The branch direction prediction measurement timer 6 has the same bit width as the branch direction prediction measurement timer initial value register 5 and performs the subtraction operation. Further, when the timer value becomes zero by the subtraction operation, the contents of the branch direction prediction measurement timer initial value register 5 are set and a signal is output to the branch direction prediction value determination circuit 7. The branch direction prediction value determination circuit 7 receives the output signal of the branch instruction counter 3, the output signal of the branch direction prediction failure counter 4, and the output signal of the branch direction prediction measurement timer 6 as inputs and determines the branch direction prediction value. The determination of the branch direction prediction value is triggered by an input signal from the branch direction prediction measurement timer 6 and the value obtained by subtracting the value of the branch direction prediction failure counter 4 from the value of the branch instruction counter 3 and the branch direction prediction failure counter 4
It is done by comparing the values of. If the value obtained by subtracting the value of the branch direction prediction failure counter 4 from the value of the instruction counter 3 is smaller than the value of the branch direction prediction failure counter 4, the branch direction prediction value control signal is output to the branch direction prediction value register 8. . When the branch direction prediction value is further determined, the initialization control signal is output to the branch instruction counter 3 and the branch direction prediction failure counter 4. The branch direction prediction value register 8 inverts the stored value by the branch direction prediction value control signal from the branch direction prediction value determination circuit 7 and stores the branch direction prediction value. Further, the branch direction prediction value register 8 outputs a signal for controlling the branch direction prediction circuit 2.

【0014】次に本発明の第2の実施例について図2を
参照して詳細に説明する。
Next, a second embodiment of the present invention will be described in detail with reference to FIG.

【0015】図2を参照すると、本発明の第2の実施例
において分岐命令判定回路1,分岐方向予測失敗カウン
タ4,分岐方向予測計測タイマ初期値レジスタ5,分岐
方向予測計測タイマ6、および分岐方向予測値レジスタ
8は第1の実施例と同じ構成である。
Referring to FIG. 2, in the second embodiment of the present invention, a branch instruction determination circuit 1, a branch direction prediction failure counter 4, a branch direction prediction measurement timer initial value register 5, a branch direction prediction measurement timer 6, and a branch. The directional prediction value register 8 has the same configuration as that of the first embodiment.

【0016】分岐方向予測回路2′は、分岐方向予測値
レジスタ8に格納された予測分岐方向を示す分岐方向予
測値と分岐命令判定回路1で分岐命令と判定された分岐
命令の分岐方向とを比較する。分岐命令の分岐方向と分
岐方向予測値の示す予測分岐方向とが一致したとき、回
路2′は予測成功信号を分岐方向予測成功カウンタ9に
出力する。分岐命令の分岐方向と分岐方向予測値の示す
予測分岐方向とが一致しないとき、回路2′は予測失敗
信号を分岐方向予測失敗カウンタ4に出力する。
The branch direction prediction circuit 2'determines the branch direction prediction value stored in the branch direction prediction value register 8 and indicating the predicted branch direction, and the branch direction of the branch instruction determined by the branch instruction determination circuit 1 as a branch instruction. Compare. When the branch direction of the branch instruction matches the predicted branch direction indicated by the predicted branch direction value, the circuit 2 ′ outputs a prediction success signal to the branch direction prediction success counter 9. When the branch direction of the branch instruction does not match the predicted branch direction indicated by the predicted branch direction value, the circuit 2 ′ outputs a prediction failure signal to the branch direction prediction failure counter 4.

【0017】分岐方向予測成功カウンタ9は、分岐方向
予測値判定回路10からの判定終了または判定結果信号
により初期値に設定され、回路2′からの予測成功信号
を計数し予測成功回数を出力する。
The branch direction prediction success counter 9 is set to an initial value by the judgment completion or judgment result signal from the branch direction prediction value judgment circuit 10, counts the prediction success signal from the circuit 2 ', and outputs the number of prediction successes. .

【0018】分岐方向予測値判定回路10は、以下の点
で第1の実施例における分岐方向予測判定回路7とは異
なる。
The branch direction prediction value determination circuit 10 differs from the branch direction prediction determination circuit 7 in the first embodiment in the following points.

【0019】第1の実施例における分岐方向予測判定回
路7では予測成功回数を求めるために、分岐命令カウン
タ3で生成された分岐命令数から分岐方向予測失敗カウ
ンタ4で生成された予測失敗回数を差し引いている。
In the branch direction prediction determination circuit 7 in the first embodiment, in order to obtain the number of prediction successes, the number of prediction failures generated by the branch direction prediction failure counter 4 is calculated from the number of branch instructions generated by the branch instruction counter 3. I'm subtracting.

【0020】この減算は演算器等で演算すれば実現され
る。
This subtraction can be realized by calculating with a calculator or the like.

【0021】これに対し第2の実施例における分岐方向
予測判定回路10では、分岐方向予測成功カウンタ9か
らの予測成功回数と分岐方向予測失敗カウンタ4からの
予測失敗回数とを比較し予測失敗回数が予測成功回数よ
り大きいとき分岐方向予測値レジスタ8に格納された分
岐方向予測値の予測方向を切換えるための信号を出力す
る。
On the other hand, in the branch direction prediction determination circuit 10 in the second embodiment, the number of prediction failures from the branch direction prediction success counter 9 and the number of prediction failures from the branch direction prediction failure counter 4 are compared, and the number of prediction failure times is compared. Is larger than the number of successful predictions, a signal for switching the prediction direction of the branch direction prediction value stored in the branch direction prediction value register 8 is output.

【0022】次に本発明の第2の実施例の動作について
第1の実施例の動作と異なる点を図2を参照して説明す
る。
Next, the operation of the second embodiment of the present invention will be described with reference to FIG. 2 while referring to the difference from the operation of the first embodiment.

【0023】図2を参照すると、分岐方向予測回路2′
は一致信号である予測成功信号か不一致信号である予測
不成功信号かのどちらか一方を出力する。
Referring to FIG. 2, the branch direction prediction circuit 2 '.
Outputs either a prediction success signal which is a coincidence signal or a prediction failure signal which is a non-coincidence signal.

【0024】分岐方向予測計測タイマ6の計時期間中、
分岐方向予測成功カウンタ9と分岐方向予測失敗カウン
タ4とは並行動作し、予測成功回数と予測失敗回数とを
判定回路10に供給する。分岐方向予測値判定回路10
は分岐方向予測成功回数をカウンタ9から受けとること
により自ら分岐方向予測成功回数の計算を省略してい
る。
During the time period of the branch direction prediction measurement timer 6,
The branch direction prediction success counter 9 and the branch direction prediction failure counter 4 operate in parallel, and supply the prediction success count and the prediction failure count to the determination circuit 10. Branch direction prediction value determination circuit 10
By receiving the number of successful branch direction predictions from the counter 9, it omits the calculation of the number of successful branch direction predictions.

【0025】次に本発明の第3の実施例について図3を
参照して詳細に説明する。
Next, a third embodiment of the present invention will be described in detail with reference to FIG.

【0026】図3を参照すると、本発明の第3の実施例
における分岐命令判定回路1,分岐命令カウンタ3,分
岐命令方向予測計測タイマ初期値レジスタ5,分岐方向
予測計測タイマ6,分岐方向予測値レジスタ8は、本発
明の第1の実施例における対応する構成と同一である。
また、本発明の第3の実施例における分岐方向予測成功
カウンタ9は、本発明の第2の実施例における対応する
構成と同一である。本発明の第3の実施例における分岐
方向予測回路2″は分岐命令判定回路1で判定された分
岐命令の分岐方向と分岐方向予測値レジスタ8に格納さ
れた予測値で示される予測分岐方向との一致がとれたと
きに予測成功信号を出力する。この信号は分岐方向予測
成功カウンタ9に与えられ、予測成功回数の計測に使わ
れる。
Referring to FIG. 3, a branch instruction determination circuit 1, a branch instruction counter 3, a branch instruction direction prediction measurement timer initial value register 5, a branch direction prediction measurement timer 6, a branch direction prediction in the third embodiment of the present invention. The value register 8 has the same structure as the corresponding structure in the first embodiment of the present invention.
Further, the branch direction prediction success counter 9 in the third embodiment of the present invention has the same structure as the corresponding configuration in the second embodiment of the present invention. The branch direction prediction circuit 2 ″ according to the third embodiment of the present invention determines the branch direction of the branch instruction determined by the branch instruction determination circuit 1 and the predicted branch direction indicated by the predicted value stored in the branch direction prediction value register 8. The prediction success signal is output when the above-mentioned results are obtained, and this signal is given to the branch direction prediction success counter 9 and used for measuring the number of prediction successes.

【0027】分岐方向予測判定回路7′には、分岐方向
予測成功カウンタ9からの予測成功回数と分岐命令カウ
ンタ3からの分岐命令数とが与えられる。このため、回
数7′は分岐命令数から予測成功回数を差し引いて予測
失敗回数を計算し、この予測失敗回数が予測成功回数よ
り大きいとき、その旨を示す信号を出力する。この信号
は第1および第2の実施例と同様分岐方向予測値レジス
タ8に格納された予測値の分岐方向を変えるために使わ
れる。
The branch direction prediction determination circuit 7'is provided with the number of prediction successes from the branch direction prediction success counter 9 and the number of branch instructions from the branch instruction counter 3. Therefore, for the number of times 7 ', the number of prediction failures is subtracted from the number of branch instructions to calculate the number of prediction failures, and when the number of prediction failures is larger than the number of prediction successes, a signal indicating that is output. This signal is used to change the branch direction of the prediction value stored in the branch direction prediction value register 8 as in the first and second embodiments.

【0028】次に本発明の第3の実施例の動作について
特徴となる点を説明する。
Next, characteristic points of the operation of the third embodiment of the present invention will be described.

【0029】第1〜第3の実施例を通して分岐方向予測
回路2,2′および2″では、分岐命令判別回路1で判
別された分岐命令の分岐方向をみる。この分岐方向は2
方向又は4方向等2進数字で表現でき、命令のOPコー
ドを解読することにより判別可能である。
In the branch direction predicting circuits 2, 2'and 2 "through the first to third embodiments, the branch direction of the branch instruction discriminated by the branch instruction discriminating circuit 1 is observed.
It can be expressed in binary numbers such as directions or four directions, and can be identified by decoding the OP code of the instruction.

【0030】この第3の実施例の分岐方向予測回路2″
ではこの分岐命令の分岐方向と分岐方向予測値レジスタ
8からの予測値で示される分岐方向とを比較し一致して
いれば予測成功信号をカウンタ9に対し出力する。
Branch direction predicting circuit 2 "of the third embodiment
Then, the branch direction of this branch instruction is compared with the branch direction indicated by the predicted value from the branch direction predicted value register 8, and if they match, a prediction success signal is output to the counter 9.

【0031】分岐方向予測値判定回路7′は、タイマ6
により計時される時間帯の分岐命令数から予測成功カウ
ンタ9の出力、予測成功回数を差し引いて予測失敗回数
を求める。次に判定回路7′は、求められた予測失敗回
数と予測成功カウンタ9からの予測成功回数とを比較
し、予測失敗回数が予測成功回数より大きいときはその
旨を示す信号を分岐方向予測値レジスタ8に与える。分
岐方向予測値レジスタ8は、この信号により予測値の示
す予測分岐方向を切換える。
The branch direction prediction value judgment circuit 7'includes a timer 6
The prediction failure count is obtained by subtracting the output of the prediction success counter 9 and the prediction success count from the number of branch instructions in the time period measured by. Next, the decision circuit 7'compares the obtained number of prediction failures with the number of prediction successes from the prediction success counter 9, and when the number of prediction failures is greater than the number of prediction successes, outputs a signal indicating that to the branch direction prediction value. It is given to the register 8. The branch direction prediction value register 8 switches the prediction branch direction indicated by the prediction value by this signal.

【0032】[0032]

【発明の効果】本発明は、分岐命令の分岐方向予測を行
い分岐方向予測成功処理を分岐方向予測失敗処理より高
速に実行する情報処理装置上で実際に実行した分岐命令
の分岐方向予測成功数をもとに分岐方向予測方向を動的
に変更することにより、プログラムの分岐命令使用方法
によるプログラム処理時間の差が小さくなり、プログラ
ム高速処理のための分岐命令の分岐方向を考慮したプロ
グラム作成は不要となるという効果がある。
According to the present invention, the number of successful branch direction predictions of a branch instruction that is actually executed on an information processing device that predicts the branch direction of a branch instruction and executes the branch direction prediction success process faster than the branch direction prediction failure process. By dynamically changing the predicted direction based on the branch direction, the difference in program processing time due to the use of branch instructions in the program is reduced, and it is possible to create a program that considers the branch direction of the branch instruction for high-speed program processing. There is an effect that it becomes unnecessary.

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

【図1】本発明の第1の実施例を示す図である。FIG. 1 is a diagram showing a first embodiment of the present invention.

【図2】本発明の第2の実施例を示す図である。FIG. 2 is a diagram showing a second embodiment of the present invention.

【図3】本発明の第3の実施例を示す図である。FIG. 3 is a diagram showing a third embodiment of the present invention.

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

1 分岐命令判定回路 2 分岐方向予測回路 3 分岐命令カウンタ 4 分岐方向予測失敗カウンタ 5 分岐方向予測計測タイマ初期値レジスタ 6 分岐方向予測計測タイマ 7 分岐方向予測値判定回路 8 分岐方向予測値レジスタ 9 分岐方向予測成功カウンタ 10 分岐方向予測判定回路 1 Branch instruction judgment circuit 2 Branch direction prediction circuit 3 Branch instruction counter 4 Branch direction prediction failure counter 5 Branch direction prediction measurement timer initial value register 6 Branch direction prediction measurement timer 7 Branch direction prediction value judgment circuit 8 Branch direction prediction value register 9 Branch Direction prediction success counter 10 Branch direction prediction determination circuit

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 分岐命令の分岐方向の予測値を格納する
分岐方向予測値格納手段と、 この分岐方向予測値格納手段からの予測値で示される分
岐方向と処理される分岐命令の分岐方向とを比較する分
岐方向予測手段と、 この分岐方向予測手段からの信号に基づいて予測失敗回
数と予測成功回数との少なくとも一方を計数する回数計
数手段と、 この回数計数手段からの計数値に基づき一定計測時間内
に予測失敗回数が予測成功回数より大きいか否かを判定
し分岐方向予測値格納手段に格納された分岐方向予測値
の予測分岐方向を切換えるため予測失敗回数が予測成功
回数より大きいことを示す信号を出力する分岐方向予測
値判定手段とを含むことを特徴とする分岐方向予測動的
変更装置。
1. A branch direction predicted value storage means for storing a predicted value of a branch direction of a branch instruction, a branch direction indicated by a predicted value from the branch direction predicted value storage means, and a branch direction of a processed branch instruction. Branch direction predicting means for comparing the number of times, at least one of the number of prediction failures and the number of successful predictions based on the signal from the branch direction predicting means, and a constant based on the count value from this number counting means. The number of prediction failures is larger than the number of prediction successes in order to determine whether the number of prediction failures is greater than the number of prediction successes within the measurement time and switch the predicted branch direction of the branch direction prediction value stored in the branch direction prediction value storage means. Branch direction prediction value determining means for outputting a signal indicating the branch direction prediction dynamic change device.
【請求項2】 実行処理ごとに命令が分岐命令か否かを
判定する分岐命令判定手段と、 この分岐命令判定手段での判定結果に応答して分岐命令
の数を計数する分岐命令計数手段とを備え、 前記回数計数手段は予測失敗回数を計数し、 前記分岐方向予測値判定手段は前記分岐命令計数手段で
計数された分岐命令数から前記回数計数手段で計数され
た予測失敗回数を差し引いて予測成功回数を求め、求め
られた予測成功回数が前記予測失敗回数より小さいか否
かを判定することを特徴とする請求項1記載の分岐方向
予測動的変更装置。
2. A branch instruction determining means for determining whether or not the instruction is a branch instruction for each execution process, and a branch instruction counting means for counting the number of branch instructions in response to the determination result by the branch instruction determining means. The number-of-times counting unit counts the number of prediction failures, and the branch direction prediction value determination unit subtracts the number of prediction failures counted by the number-of-times counting unit from the number of branch instructions counted by the branch instruction counting unit. 2. The branch direction prediction dynamic change device according to claim 1, wherein the number of prediction successes is calculated, and it is determined whether the obtained number of prediction successes is smaller than the number of prediction failures.
【請求項3】 前記回数計数手段は予測失敗回数と予測
成功回数との両方を計数し、 前記分岐方向予測値判定手段は一定計測時間内に前記回
数計数手段から与えられる予測失敗回数が前記回数計数
手段から与えられる予測成功回数より大きいか否かを判
定することを特徴とする請求項1記載の分岐方向予測動
的変更装置。
3. The number-of-times counting unit counts both the number of prediction failures and the number of successful predictions, and the branch direction predicted value determination unit determines the number of prediction failures given from the number-of-times counting unit within a certain measurement time. 2. The branch direction prediction dynamic changing device according to claim 1, wherein it is determined whether or not it is larger than the number of times of successful prediction given by the counting means.
【請求項4】 実行処理ごとに命令が分岐命令か否かを
判定する分岐命令判定手段と、 この分岐命令判定手段での判定結果に応答して分岐命令
の数を計数する分岐命令計数手段とを備え、 前記回数計数手段は予測成功回数を計数し、 前記分岐方向予測値判定手段は前記分岐命令計数手段で
計数された分岐命令数から前記回数計数手段で計数され
た予測成功回数を差し引いて予測失敗回数を求め、求め
られた予測失敗回数が前記予測成功回数より大きいか否
かを判定することを特徴とする請求項1記載の分岐方向
予測動的変更装置。
4. A branch instruction determining means for determining whether or not an instruction is a branch instruction for each execution process, and a branch instruction counting means for counting the number of branch instructions in response to the determination result by the branch instruction determining means. The number-of-times counting means counts the number of prediction successes, and the branch direction prediction value determination means subtracts the number of prediction successes counted by the number-of-times counting means from the number of branch instructions counted by the branch instruction counting means. 2. The branch direction prediction dynamic change device according to claim 1, wherein the number of prediction failures is calculated, and it is determined whether the calculated number of prediction failures is larger than the number of prediction successes.
JP10207093A 1993-04-28 1993-04-28 Branch direction prediction dynamic change device Pending JPH06324866A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP10207093A JPH06324866A (en) 1993-04-28 1993-04-28 Branch direction prediction dynamic change device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP10207093A JPH06324866A (en) 1993-04-28 1993-04-28 Branch direction prediction dynamic change device

Publications (1)

Publication Number Publication Date
JPH06324866A true JPH06324866A (en) 1994-11-25

Family

ID=14317512

Family Applications (1)

Application Number Title Priority Date Filing Date
JP10207093A Pending JPH06324866A (en) 1993-04-28 1993-04-28 Branch direction prediction dynamic change device

Country Status (1)

Country Link
JP (1) JPH06324866A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7085920B2 (en) 2000-02-02 2006-08-01 Fujitsu Limited Branch prediction method, arithmetic and logic unit, and information processing apparatus for performing brach prediction at the time of occurrence of a branch instruction

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS54534A (en) * 1977-06-03 1979-01-05 Hitachi Ltd Advance control system of instruction in information processor
JPS6462732A (en) * 1987-09-03 1989-03-09 Nec Corp Branch destination inferring method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS54534A (en) * 1977-06-03 1979-01-05 Hitachi Ltd Advance control system of instruction in information processor
JPS6462732A (en) * 1987-09-03 1989-03-09 Nec Corp Branch destination inferring method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7085920B2 (en) 2000-02-02 2006-08-01 Fujitsu Limited Branch prediction method, arithmetic and logic unit, and information processing apparatus for performing brach prediction at the time of occurrence of a branch instruction

Similar Documents

Publication Publication Date Title
US6996701B2 (en) Computer system employing pipeline operation
JPH07191831A (en) Arithmetic unit
US5684728A (en) Data processing system having a saturation arithmetic operation function
KR100241072B1 (en) Method and apparatus for parallel prediction and computation of massive cancellation in floating point substraction
JPH0850545A (en) Digital processor with minimum/maximum retrieval instruction
US20070005945A1 (en) Branch prediction apparatus, its method and processor
US6260116B1 (en) System and method for prefetching data
JP2001117771A (en) Branch predicting device using branch prediction precision history
TW419630B (en) Limited run branch prediction
JPH06324866A (en) Branch direction prediction dynamic change device
US6629118B1 (en) Zero result prediction
KR100331846B1 (en) floating addition
US5408620A (en) Circuit for executing conditional branch instructions in pipeline process
US6684232B1 (en) Method and predictor for streamlining execution of convert-to-integer operations
JP2793357B2 (en) Parallel processing unit
JP2977099B2 (en) Arithmetic processing unit
KR970004474B1 (en) Method and apparatus for explicitly evaluating conditions in a data processor
JPS59183434A (en) Prefetch control system of instruction
JPH0612239A (en) Apparatus for detecting inaccurate result caused by division in computer alu
JP2002318706A (en) Arithmetic circuit and its error detecting method therefor
JP2665067B2 (en) Floating point adder / subtracter
KR200326695Y1 (en) Digital processor
JPS61160134A (en) Exponent underflow detecting circuit
JPH11194940A (en) Speculative execution instruction number count device
JPS63189936A (en) Floating-point multiplier

Legal Events

Date Code Title Description
A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 19960716