JPH038023A - Branch predicting algorithm - Google Patents

Branch predicting algorithm

Info

Publication number
JPH038023A
JPH038023A JP14328189A JP14328189A JPH038023A JP H038023 A JPH038023 A JP H038023A JP 14328189 A JP14328189 A JP 14328189A JP 14328189 A JP14328189 A JP 14328189A JP H038023 A JPH038023 A JP H038023A
Authority
JP
Japan
Prior art keywords
branch
plant
predicted
case
instruction
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
JP14328189A
Other languages
Japanese (ja)
Inventor
Takashi Kodama
児玉 隆
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric 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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP14328189A priority Critical patent/JPH038023A/en
Publication of JPH038023A publication Critical patent/JPH038023A/en
Pending legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)

Abstract

PURPOSE:To increase a branch predicting condition and to improve the rate of success for predicting a branch by providing more than three kinds of branch status for a branch predicting algorithm and increasing the history of the branch. CONSTITUTION:The branch is expressed by T and a negative branch is expressed by N. For example, in the case of NTNT, the branch and negative branch are repeated. In such a case, since it can be predicted that the branch and negative branch are repeated in following operation, such a state is predicted as N. The case of TNTN is samely predicted as T. Next, in the case of NNNT, concerning a branch instruction after arithmetic calculation, since the instruction is defined to execute the branch only when a digit flows over, such a state is predicted as N. In the case of TTTN, when a counter is not 0, such a state can be predicted as T and in the case of NNTN, such a state can be predicted as N similary as the case of NNNT. When it is failed to predict NTTN and TNNT, NTTN is transited to TTNN. Accordingly, the next state can be predicted as N and accuracy for predicting is improved in the following operation. Samely, since TNNT is transited to NNTT, the next state is predicted as T and the accuracy for predicting the following branch is improved.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 この発明は、電子計算機におけるプランチ命令のプラン
チするかいなかを予測するプランチターゲットバッファ
(BTB)のプランチ予測アルゴリズムに関するもので
ある。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a launch prediction algorithm for a launch target buffer (BTB) that predicts whether or not a launch instruction in an electronic computer will launch.

〔従来の技術〕[Conventional technology]

第3図、第4図は、従来のプランチ命令における過去2
回のプランチ状況データを基にプランチ命令のプランチ
予測を実施するプランチ予測アルゴリズムを説明する図
である。
Figures 3 and 4 show the past 2
FIG. 2 is a diagram illustrating a launch prediction algorithm that executes a launch prediction of a launch instruction based on the branch status data of the first instruction.

次に動作について説明する。Next, the operation will be explained.

まずは、このアルゴリズムを説明する前に、第5図を用
いてプランチターゲットバッファ(以下。
First, before explaining this algorithm, we will use Fig. 5 to refer to the launch target buffer (hereinafter referred to as "plant target buffer").

BTBという)について説明する。(referred to as BTB) will be explained.

このBTBはパイプライン制御下におけるプランチ命令
のプランチ先アドレスを格納するキャッシュメモリであ
る。
This BTB is a cache memory that stores the branch destination address of a branch instruction under pipeline control.

通常のキャッシュメモリは、基本的にアドレスプレイ、
アドレス比較回路、データアレイにて構成されるが、E
TEもほぼ同様にアドレスアレイ。
Normal cache memory basically uses address play,
It consists of an address comparison circuit and a data array, but E
TE is almost the same address array.

アドレス比較回路、プランチ予測回路、データアレイと
いう構成になる。唯一プランチ予測回路が追加された点
が異なる。BTBのアドレスアレイには、プランチ命令
アドレスが格納されており。
It consists of an address comparison circuit, a plant prediction circuit, and a data array. The only difference is that a plant prediction circuit has been added. The address array of the BTB stores the plant instruction address.

データアレイにはプランチ先アドレスと過去のプランチ
履歴を示すプランチステータスが格納される、プランチ
ステータスは、第3図、第4図の2重マル内に示される
データ(“NT’  ”TN″ ”NN”。
The data array stores the plant destination address and the plant status indicating the past plant history. The plant status is the data (“NT” “TN” “NN” ”.

“TT″)である。“TT”).

プランチ予測回路では、下記条件時、起動される。The plant prediction circuit is activated under the following conditions.

アドレスアレイ内アドレスとメモリリクエストされたア
ドレスが一致した場合(BTEbtt時)。
When the address in the address array matches the memory requested address (at the time of BTEbtt).

データアレイよりプランチステータスを読み出し。Read plant status from data array.

プランチ命令がプランチするかいなかを予測し。Predict whether or not the plant command will plant.

プランチするとなればデータアレイのプランチ先アドレ
スによりキャッシュメモリにアクセスさせ。
If you want to plant, access the cache memory using the data array's plant destination address.

プランチしなければ、プランチ命令アドレスをそのまま
キャッシュメモリに送出する、プランチ命令が命令実行
された場合、このプランチ予測が正しかったかいなかが
判明する。この時点でBTBのデータアレイのプランチ
ステータス部が更新される。
If the branch instruction is not executed, the branch instruction address is directly sent to the cache memory, and if the branch instruction is executed, it becomes clear whether or not the branch prediction was correct. At this point, the plant status section of the BTB's data array is updated.

本発明は、プランチ予測回路におけるプランチ命令がプ
ランチするかいなかを予測するプランチ予測アルゴリズ
ムに関するものである。
The present invention relates to a launch prediction algorithm for predicting whether or not a branch instruction in a launch prediction circuit will launch.

第3図、第1図、第5図において、プランチステータス
は2bitである。つまシプランチ予測のプランチ履歴
は最新2回に関してのデータである。
In FIG. 3, FIG. 1, and FIG. 5, the plant status is 2 bits. The launch history of the Tsumeshi launch prediction is data regarding the latest two times.

次に、第3図を用いて従来のプランチ予測アルゴリズム
について説明する。
Next, a conventional plant prediction algorithm will be explained using FIG.

プランチステータスは、2bitであることから。This is because the plant status is 2 bits.

4個の状態が存在する。“TT“TN″ ”NT″”N
N’である。“TT″ ”NN’ に関しては、過去2
回のプランチ状況が一致していることから9次回も同様
と予測できる。したがって、プランチステータスが”T
T″の場合はT″と予測され、つま先 プランチすると
予測される。また、プランチステータスが”NN−の場
合@N”と予測され、つまシ、プランチしないと予測さ
れる。
There are four states. “TT“TN” “NT””N
It is N'. Regarding “TT” “NN”, past 2
Since the planch situation in the first round is the same, it can be predicted that the same will happen in the ninth time. Therefore, the plant status is “T”.
If T'', it is predicted to be T'' and a toe plank is predicted. Further, if the plant status is "NN-, @N" is predicted, and it is predicted that the plant will not plant.

プランチステータスが@TN“ ”NT−の場合。If the plant status is @TN“”NT-.

次の予測が難かしい。“N″とも“T″とも予測できる
が、第3図の場合は、プランチステータスが1個の時と
同じようになる。つ′1シ、前回の状態と同様な状況に
次回もなると予測している。また。
It is difficult to predict what will happen next. Both "N" and "T" can be predicted, but in the case of FIG. 3, the result will be the same as when there is one plant status. I predict that the situation will be similar to the last time's situation next time. Also.

第4図が第3図と異なる点は@TN”の場合1T#と予
測することである。このように、プランチステータスを
2個使用し、プランチ命令のプランチ予測を実施してい
る。
The difference between FIG. 4 and FIG. 3 is that 1T# is predicted in the case of "@TN". In this way, two branch statuses are used to perform the branch prediction of the branch instruction.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

従来の2個のプランチステータスを使用してプランチ予
測アルゴリズムは、プランチステータスが2個しかない
ため、プランチ履歴の前回と前々回の状況が異なる場合
(“NT″、“TN’ )、  プランチ予測の成功率
が低いという9問題点があった。
Since there are only two plant statuses in the conventional plant prediction algorithm using two plant statuses, if the situation between the previous plant history and the previous one is different (“NT”, “TN”), the plant prediction is successful. There were 9 problems with low rates.

この発明は上記のような問題点を解消するため罠なされ
たもので、よシプランチ予測の成功率を高めるプランチ
予測アルゴリズムを得ること金目的とする。
This invention has been made to solve the above-mentioned problems, and the object is to obtain a launch prediction algorithm that increases the success rate of the launch prediction.

〔課題を解決するだめの手段〕[Failure to solve the problem]

この発明に係るプランチ予測アルゴリズムは。 The plant prediction algorithm according to the present invention is as follows.

プランチステータスを3個以上とし、プランチ履歴を増
やすことにより、プランチを予測する条件を珈したもの
である。
The conditions for predicting a launch are established by setting the number of launch statuses to three or more and increasing the launch history.

〔作用〕 この発明におけるプランチ予測アルゴリズムは。[Effect] The plant prediction algorithm in this invention is as follows.

3個以上の過去のプランチ履歴を基にプランチ命令のプ
ランチ予測をするため、よりプランチ予測の成功率が高
まる。
Since the branch prediction of the branch instruction is performed based on three or more past branch histories, the success rate of the branch prediction is further increased.

〔実施例〕〔Example〕

本発明のプランチ予測アルゴリズムを第1図で示してい
る。
The plant prediction algorithm of the present invention is shown in FIG.

16個のマルで囲まれたものは、4個の過去のプランチ
履歴を示す。左サイドが最も古い。例えば、”NTTN
=fは@N’!>Ul−も古(’、−T”7>E2番目
に古い、“T″は3番目に古く、“N″が前回のプラン
チ履歴である。
Those surrounded by 16 circles indicate 4 past plant histories. The left side is the oldest. For example, “NTTN
=f is @N'! >Ul- is also old (', -T"7>E is the second oldest, "T" is the third oldest, and "N" is the previous plant history.

矢印は、状態の遷移を表わし、プランチ命令が実行され
た後、プランチした場合“↓”に示す状態に遷移し、プ
ランチしなかった場合“N″に示す状態に遷移する。ま
た、各16個のマルで囲まれたプランチ履歴に関して、
どのようにプランチを予測するかを示している。例えば
“TTTT″の場合、(次回は)“T″と予測(つまシ
、プランチすると予測)している。
The arrows represent state transitions, and after the launch command is executed, if a launch occurs, the state transitions to the state shown by "↓", and if the plant does not launch, the state changes to the state shown by "N". Also, regarding the plant history surrounded by 16 circles,
It shows how to predict planches. For example, in the case of "TTTT", it is predicted that the next time it will be "T" (it is predicted that the next time) will be "T".

プランチ命令は、大きく分割すると、2種類に分割され
る。
Broadly speaking, plant instructions can be divided into two types.

(1)無条件プランチ命令(必ずプランチする)(2)
条件付プランチ命令(条件が合致した場合プランチする
) プランチ予測アルゴリズムは、(2)の条件付プランチ
命令のプランチをいかく正確に予測できるかが最も重要
である。このため、過去のプランチ履歴を見て、履歴パ
ターンよりプランチが発生しそうか、または、しそうも
ないかを判定してプランチを予測している。この判定で
は、最新履歴から逆昇って2個以上同じ履歴であった場
合1次回も同じ履歴になるだろうというのが基本である
。例えば”NTTT”は@T−と予測され、”NTIJ
N”は“N″と予測される。
(1) Unconditional plant command (always plant) (2)
Conditional plant instruction (plant when conditions are met) The most important aspect of the plant prediction algorithm is how accurately it can predict the plant of the conditional plant instruction (2). For this reason, a plant is predicted by looking at past plant history and determining whether a plant is likely to occur or not based on the history pattern. The basic principle of this determination is that if two or more histories are the same going back up from the latest history, the first history will also be the same. For example, "NTTT" is predicted as @T-, and "NTIJ" is predicted as @T-.
N” is predicted to be “N”.

なお1判定において最も難しいものは、最新履歴から逆
昇った2個の履歴が異なる場合のプランチ予測である。
Note that the most difficult one of the determinations is the branch prediction when two histories reversed from the latest history are different.

本発明は、この場合の予測精度を上げるために考えられ
たものである。例えば。
The present invention was devised to improve prediction accuracy in this case. for example.

−NTNT″の場合、プランチ及びプランチしない状態
の繰り返しである。これは、今後も繰り返すことが予想
される。しだがって、“N”と予測できる。”TNIJ
“も同様に“T″と予測できる。第3図のアルゴリズム
を用いれば、  ”NT″の場合”T″と予測し、”T
N″の場合”N″と予測するため100チプランチ予測
が不成功になることが予想できる。
In the case of "-NTNT", the state of launching and not launching is repeated. This is expected to repeat in the future. Therefore, it can be predicted that "N"."TNIJ
“ can be predicted as “T” in the same way. If the algorithm in Figure 3 is used, “T” is predicted in the case of “NT”, and “T” is predicted as “T”.
In the case of "N", it is predicted to be "N", so it can be expected that the 100-chip launch prediction will be unsuccessful.

第4図では、“NT″の場合”T″と予測し、”TN″
の場合“T″と予測することから、プランチ予測は50
%の確率になることが予想される。
In Figure 4, in the case of “NT”, “T” is predicted, and “TN”
Since we predict “T” in the case of , the plant prediction is 50
It is expected that the probability will be %.

次に“NNNT”の場合、算術通算後にかかわるプラン
チ命令などに関する1例えばOve r FI Ow:
BOR(桁あぶれのときプランチ)9桁あぶれがおこっ
た時のみプランチするというようなプランチ命令と予測
される。しfCがって、“N″と予測されるが、第3図
、第4図においては、“NT″は“T″と予測する。
Next, in the case of "NNNT", 1 regarding the branch instruction etc. involved after arithmetic addition, for example, Over FI Ow:
BOR (Prunch when 9 digits are out of order) It is predicted that this is a plank instruction that only executes when 9 digits are out of order. Therefore, fC is predicted to be "N", but in FIGS. 3 and 4, "NT" is predicted to be "T".

また、同様K”TTTN″の場合、  Branch 
C!0unt(BOT)命令のように、カウンタが°O
”でない場合はプランチするというようなプランチ命令
と予測できる。したがって9次回は°T″と予測される
。第3図、第4図に関しては、“TN″の場合、第3図
では“N″と予測され、第4図では“T″と予測される
Similarly, in the case of K"TTTN", Branch
C! As in the 0unt (BOT) instruction, the counter is
It can be predicted that the command will be a launch command such as "If not, then launch. Therefore, the ninth instruction is predicted to be °T". Regarding FIGS. 3 and 4, in the case of "TN", "N" is predicted in FIG. 3, and "T" is predicted in FIG. 4.

NNTN”の場合は、上記で説明した“NNNT’と同
様なプランチ命令による履歴と考えられる。
In the case of "NNTN", it is considered that the history is caused by a plant instruction similar to "NNNT'" explained above.

このためN″と予測される。Therefore, it is predicted to be N''.

−TTNT“の場合は、”TTTN”と同様なプランチ
命令と考えられ、“T″と予測できる。
-TTNT" is considered to be a launch instruction similar to "TTTN", and can be predicted as "T".

”NTTN″ “TNNT″の場合、規則性のあるプラ
ンチ命令と予測できる。例えばBranch 0oun
t命令(BOT)のようなカウンタ使用命令のように予
測できる。したがって、”NTTN″の場合は°T″と
予測され、”TNNT″の場合は°N”と予測される。
"NTTN" In the case of "TNNT", it can be predicted that it is a regular plant instruction. For example, Branch 0own
It can be predicted like a counter-using instruction such as the t instruction (BOT). Therefore, in the case of "NTTN", it is predicted as °T", and in the case of "TNNT", it is predicted as °N".

この“NTTN″ ’TNNT″ の予測が最も難しい
が、予測が失敗した場合、“NTTN″は“τTNN″
に遷移しているので9次には′N“と予測され9次回以
降の予測精度は上がる。同様に。
Prediction of this “NTTN” is the most difficult, but if the prediction fails, “NTTN” becomes “τTNN”
Since it has transitioned to , it is predicted to be 'N'' in the 9th order, and the prediction accuracy from the 9th time onwards increases.Similarly.

@TNNT”は@NNTT”に遷移するので1次回は“
T″と予測され、やはり1次回以降のプランチ予測精度
は上がる。
@TNNT” changes to @NNTT”, so the first time is “
T'' is predicted, and the accuracy of plant prediction after the first time also increases.

このように、4個のプランチステータスを用いると、5
0%以上の確率で予測が失敗するということはありえな
くなる。
In this way, using 4 plant statuses, 5
It becomes impossible for a prediction to fail with a probability of 0% or more.

次に第2図を用いて、3個の過去のプランチ履歴の場合
を説明する。
Next, the case of three past plant histories will be explained using FIG.

過去2個のプランチステータスが@NN”または“TT
″の場合は、同様にそれぞれ次のステータスを“N″ま
たは°T″と予測する。
The past two plant statuses are @NN” or “TT”
", the next status is similarly predicted to be "N" or "T".

その他の’NTN”  ’NNT’  ”TTN’、”
TNT’は、それぞれ多数決によシ決定する。しだがっ
てNTN″ −NNT’は−N−と予測し、 ”TTN
’″、”TNT−は“T″と予測する。
Other 'NTN''NNT''TTN',”
TNT' is determined by majority vote. Therefore, NTN″ −NNT′ is predicted to be −N−, and “TTN
``'', ``TNT-'' predicts ``T''.

なお、上記実施例においては、プランチステ−タスを4
または3個と限定しているが、基本的に3個以上なら何
個でも良い。
In addition, in the above embodiment, the plant status is set to 4.
Alternatively, the number is limited to three, but basically any number is acceptable as long as it is three or more.

また、上記実施例では、“Y″と“N″でプランチステ
ータスを表わしたが、“1″とO″や“Y″とN″など
他の方法で表わしてもよい。さらに。
Further, in the above embodiment, the plant status is expressed by "Y" and "N", but it may be expressed by other methods such as "1" and O" or "Y" and N". moreover.

これらが、ビットやバイトなどのサイズを問わず。Regardless of the size of these bits or bytes.

かつフォーマットも問わず、メモリ内でどのような形で
保持されていてもかまわない。
Moreover, the format does not matter, and it does not matter what form it is held in memory.

〔発明の効果〕〔Effect of the invention〕

以上のように、この発明によれば、プランチステータス
などのプランチ履歴情報を3個以上にしてプランチ予測
を実施しているので、予測の不確定要素が少なく、高い
精度のプランチ予測ができる。
As described above, according to the present invention, since the plant prediction is performed using three or more pieces of plant history information such as the plant status, there are few uncertainties in the prediction, and highly accurate plant prediction can be performed.

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

第1図、第2図はそれぞれ本発明の一実施例である3個
以上のプランチステータスを用いたプランチ予測アルゴ
リズムを説明する図、第3図、第4図は従来の2個のプ
ランチステータスのプランチ予測アルゴリズムを示す図
、第5図は従来のプランチ予測アルゴリズムを示す図で
ある。
Figures 1 and 2 are diagrams each explaining a launch prediction algorithm using three or more launch statuses, which is an embodiment of the present invention, and Figures 3 and 4 are diagrams illustrating a conventional launch prediction algorithm using two or more launch statuses. FIG. 5 is a diagram showing a conventional plant prediction algorithm.

Claims (1)

【特許請求の範囲】 計算機の動作時におけるプランチ命令がプランチするか
をプランチ履歴情報をもちいて予測するプランチ予測ア
ルゴリズムにおいて、 プランチを“T”で表わし、否プランチを“N”で表わ
すとき、以下の手段を備えたことを特徴とするプランチ
予測アルゴリズム (a)あるプランチ命令の2個の最新のプランチ履歴情
報が“TT”のとき、次の動作を“T”と予測する手段
、 (b)あるプランチ命令の2個の最新のプランチ履歴情
報が“NN”のとき、次の動作を“N”と予測する手段
、 (c)あるプランチ命令の2個の最新のプランチ履歴情
報が“TT”と“NN”のいずれでもないとき、それ以
前のプランチ履歴情報を用いて次の動作を予測する手段
[Claims] In a plant prediction algorithm that uses plant history information to predict whether or not a plant instruction will plant during computer operation, where a plant is represented by "T" and a no-plant is represented by "N", the following applies. A plant prediction algorithm characterized by comprising means (a) means for predicting the next action as "T" when the two latest plant history information of a certain plant instruction are "TT"; (b) (c) means for predicting the next operation as "N" when the two latest plant history information of a certain plant instruction are "NN"; (c) means for predicting the next operation as "N" when the two latest plant history information of a certain plant instruction are "TT"; and "NN", means for predicting the next operation using previous launch history information.
JP14328189A 1989-06-06 1989-06-06 Branch predicting algorithm Pending JPH038023A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP14328189A JPH038023A (en) 1989-06-06 1989-06-06 Branch predicting algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP14328189A JPH038023A (en) 1989-06-06 1989-06-06 Branch predicting algorithm

Publications (1)

Publication Number Publication Date
JPH038023A true JPH038023A (en) 1991-01-16

Family

ID=15335091

Family Applications (1)

Application Number Title Priority Date Filing Date
JP14328189A Pending JPH038023A (en) 1989-06-06 1989-06-06 Branch predicting algorithm

Country Status (1)

Country Link
JP (1) JPH038023A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06236270A (en) * 1993-01-08 1994-08-23 Internatl Business Mach Corp <Ibm> Method and system for enhancement of estimation accuracy of branch history in superscalar processor system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06236270A (en) * 1993-01-08 1994-08-23 Internatl Business Mach Corp <Ibm> Method and system for enhancement of estimation accuracy of branch history in superscalar processor system

Similar Documents

Publication Publication Date Title
US6115808A (en) Method and apparatus for performing predicate hazard detection
JP2640454B2 (en) Digital instruction processor controller and method for executing a branch in one cycle
US5987595A (en) Method and apparatus for predicting when load instructions can be executed out-of order
EP0847004B1 (en) Information processing apparatus with branch prediction
KR970002637A (en) Multiprocessor system
US10228864B1 (en) Pre-fetching data based on memory usage patterns
US6715064B1 (en) Method and apparatus for performing sequential executions of elements in cooperation with a transform
JP2021527248A (en) Storage of accidental branch predictions to reduce the waiting time for misprediction recovery
US7051191B2 (en) Resource management using multiply pendent registers
KR20200090103A (en) Branch predictor
JPH02216545A (en) Execution hysteresis storage device
US20050283593A1 (en) Loop end prediction
US6484256B1 (en) Apparatus and method of branch prediction utilizing a comparison of a branch history table to an aliasing table
JPH038023A (en) Branch predicting algorithm
US4559596A (en) History memory control system
JP5379712B2 (en) In-vehicle control device
US4124892A (en) Data processing systems
US5974535A (en) Method and system in data processing system of permitting concurrent processing of instructions of a particular type
CN100354820C (en) External microcode
US6978361B2 (en) Effectively infinite branch prediction table mechanism
JP5154763B2 (en) Conditional branch instruction encoding in multiple instruction set data processing systems
US7353343B2 (en) Memory management system for preventing program execution when CPU fetches execution code from unoccupied region of memory
JPS6236575B2 (en)
JP4872883B2 (en) Computer, failure reproduction method and program
CN119025164B (en) RISC-V vector instruction configuration determination method and device