JPH06124206A - Branching instruction estimation processor and processing method therefor - Google Patents

Branching instruction estimation processor and processing method therefor

Info

Publication number
JPH06124206A
JPH06124206A JP4300298A JP30029892A JPH06124206A JP H06124206 A JPH06124206 A JP H06124206A JP 4300298 A JP4300298 A JP 4300298A JP 30029892 A JP30029892 A JP 30029892A JP H06124206 A JPH06124206 A JP H06124206A
Authority
JP
Japan
Prior art keywords
branch
instruction
address
prediction
prediction table
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
JP4300298A
Other languages
Japanese (ja)
Inventor
Kazuya Okabe
和也 岡部
Makoto Odajima
眞 小田島
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.)
Oki Electric Industry Co Ltd
Original Assignee
Oki Electric Industry 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 Oki Electric Industry Co Ltd filed Critical Oki Electric Industry Co Ltd
Priority to JP4300298A priority Critical patent/JPH06124206A/en
Publication of JPH06124206A publication Critical patent/JPH06124206A/en
Pending legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)

Abstract

PURPOSE:To perform branching estimation even immediately after applying a power source and at the time of resetting. CONSTITUTION:All the contents of a branching estimation table 10 are '0' immediately after applying the power source and at the time of resetting, however, prescribed data can be set to the respective entries of the branching estimation table 10 by a branching estimation table changing instruction execution part 11 before executing a program. Thus, the branching estimation is performed by using the data inside the branching estimation table 10 immediately after starting the execution of the program. Also, before executing a new job, the data matched with job can be set to the respective entries of the branching estimation table 10 by the branching estimation table changing instruction execution part 11.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、分岐命令の分岐方向と
分岐先を、分岐命令の実行結果が判明する前に予測する
ことによっていち早く分岐命令に続く命令をフェッチす
る分岐命令予測処理装置及びその処理方法に関するもの
である。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a branch instruction prediction processing apparatus for predicting the branch direction and branch destination of a branch instruction before the execution result of the branch instruction is known, thereby fetching the instruction immediately following the branch instruction. It relates to the processing method.

【0002】[0002]

【従来の技術】従来、分岐命令予測は以下に示すような
方法で行なわれていた。まず、第1の方式としては、予
め分岐方向を一意に決めて予測するものがある。これは
過去の命令実行結果にかかわらず、常に一方向に予測す
るものであり、分岐すると予測する方式(taken 予
測)、分岐しないものと予測する方式(not-taken 予
測)がある。しかしながら、これらの方式では、分岐方
向が固定されているので、予測の的中率が低くかった。
また、分岐方向の予測に留まっており、分岐先の命令を
先行的にフェッチすることができなかった。そこで、分
岐方向の予測を実行時に動的に行ない、更に分岐命令の
実行が終了して分岐方向と分岐先アドレスが決定する前
に分岐先命令を先行的にフェッチすることができる方式
として分岐予測テーブルを用いる方式が提案された。
2. Description of the Related Art Conventionally, branch instruction prediction has been performed by the following method. First, as a first method, there is a method in which a branch direction is uniquely determined and predicted in advance. This always predicts in one direction regardless of past instruction execution results, and there are methods that predict branching (taken prediction) and methods that predict not branching (not-taken prediction). However, in these methods, since the branching direction is fixed, the prediction hit rate was low.
In addition, the prediction is limited to the branch direction, and the instruction at the branch destination cannot be fetched in advance. Therefore, branch prediction is a method in which the prediction of the branch direction is performed dynamically at the time of execution, and the branch target instruction can be fetched in advance before the execution of the branch instruction is completed and the branch direction and the branch target address are determined. A method using a table has been proposed.

【0003】図2は、分岐予測テーブルの説明図であ
る。図示の分岐予測テーブルは、分岐命令アドレス、分
岐先アドレス、分岐方向予測、Validの4つのフィ
ールドから構成されている。分岐方向予測については、
Johnny K.F.Lee,Alan Jay Smith 「Branch Prediction S
trategies and Branch target Buffer Design」 IEEE CO
MPUPER January 1984 に詳述されている。この分岐方向
予測のための情報は、通常2ビットで構成されている。
そして、例えば2回予測が外れたときに分岐方向予測を
変更するといったアルゴリズムで更新される。また、V
alidビットは、通常“1”の時に当該エントリが有
効であることを示し、“0”の時に無効であることを示
す。このような分岐予測テーブルを用いることによっ
て、分岐命令を実行して分岐条件の判断と分岐先アドレ
スの計算を行なうよりも早く、分岐命令をフェッチした
ときに分岐先を予測することが可能となる。これによ
り、分岐命令実行結果が得られるまでの無駄な待ち時間
がなくなる。もし、この予測が成功しなかった場合に
は、分岐先と予測して先行的に実行した結果を破棄す
る。
FIG. 2 is an explanatory diagram of the branch prediction table. The illustrated branch prediction table is composed of four fields of a branch instruction address, a branch destination address, a branch direction prediction, and Valid. For branch direction prediction,
Johnny KFLee, Alan Jay Smith "Branch Prediction S
trategies and Branch target Buffer Design "IEEE CO
Detailed in MPUPER January 1984. The information for predicting the branch direction is usually composed of 2 bits.
Then, for example, it is updated by an algorithm that changes the branch direction prediction when the prediction is missed twice. Also, V
The "alid" bit normally indicates that the entry is valid when "1", and indicates that the entry is invalid when "0". By using such a branch prediction table, it becomes possible to predict the branch destination when the branch instruction is fetched, faster than executing the branch instruction to judge the branch condition and calculate the branch destination address. . This eliminates unnecessary waiting time until the branch instruction execution result is obtained. If this prediction is not successful, the branch destination is predicted and the result executed in advance is discarded.

【0004】このような分岐予測テーブルは、分岐命令
を処理する度に更新される。つまり、ある分岐命令を実
行したときに分岐命令アドレスフィールドに該当するア
ドレスを持つものがあり、そのエントリのValidフ
ィールドが“1”であれば、そのエントリの分岐方向予
測フィールドに分岐命令によって分岐が行なわれたか否
かによって、あるアルゴリズムによって求められる値を
書き込む。例えば、この分岐命令は過去において常に分
岐が行なわれていたとすると、分岐方向予測フィールド
は“11”であり、新たにこの分岐命令を実行した結
果、分岐が行なわれなければ、このフィールドは“1
0”に変化する。
Such a branch prediction table is updated every time a branch instruction is processed. In other words, when a certain branch instruction has an address corresponding to the branch instruction address field and the Valid field of the entry is "1", the branch direction prediction field of the entry causes the branch instruction to branch. The value obtained by a certain algorithm is written depending on whether or not it is performed. For example, if this branch instruction has always taken a branch in the past, the branch direction prediction field is "11", and if a branch is not taken as a result of executing this new branch instruction, this field is set to "1".
Changes to 0 ".

【0005】更に、当該エントリの分岐先アドレスフィ
ールドには分岐命令によって分岐が行なわれたときの分
岐先アドレスを書き込む。もし、分岐命令アドレスフィ
ールドに該当するアドレスが存在せず、すべてのエント
リのValidフィールドが“1”であれば、最も古く
アクセスされた分岐命令アドレスを持つエントリを削除
して、新しい分岐命令アドレスに関する情報を書き込
む。もし、分岐命令アドレスに、該当するアドレスが存
在せず、Validフィールドが“0”であるエントリ
があれば、それらのエントリの内から1つを選び出して
用いる。ここで、分岐予測テーブルにおいてValid
フィールドの値が“1”であるものの分岐命令アドレス
の中にフェッチされた分岐命令のアドレスに該当するア
ドレスが存在しないときに、分岐命令を実行した結果、
分岐を行なわなければならなくなったときの動作につい
て考える。
Furthermore, the branch destination address when the branch is executed by the branch instruction is written in the branch destination address field of the entry. If there is no corresponding address in the branch instruction address field and the Valid fields of all the entries are “1”, the entry having the oldest accessed branch instruction address is deleted and the branch instruction address relating to the new branch instruction address is deleted. Write information. If the branch instruction address does not have a corresponding address and there is an entry whose Valid field is "0", one of those entries is selected and used. Here, in the branch prediction table, Valid
When the value of the field is "1" but the address corresponding to the fetched branch instruction address does not exist in the branch instruction addresses, the result of executing the branch instruction is:
Consider what happens when you have to branch.

【0006】図3は、命令列と命令実行タイミングの例
の説明図である。図示の例において、図3(a)の命令
は、条件レジスタの内容が“0”の時分岐を行ない、分
岐先のアドレスがレジスタR10に保持されていること
を示す。図3(b)の命令は図3(a)の命令の直後の
アドレスの命令であり、レジスタR11とR12の内容
の和を求めてR13に書き込むことを示す。図3(c)
の命令はR10の内容のアドレス命令であり、図3
(b)と同様にレジスタR21とR22の内容の和を求
めてR23に書き込むことを示す。図3に示すような実
行を行なう装置は、実行がf(命令フェッチ)、d(命
令デコード、レジスタからのオペランド読み出し)、e
(命令実行、分岐の条件判断、分岐先アドレス計算)、
w(結果の書き込み)の4つのステージで表わされるパ
イプライン処理を行なう。
FIG. 3 is an explanatory diagram of an example of an instruction sequence and instruction execution timing. In the illustrated example, the instruction of FIG. 3A indicates that the branch is performed when the content of the condition register is "0", and the branch destination address is held in the register R10. The instruction of FIG. 3B is an instruction of an address immediately after the instruction of FIG. 3A, and indicates that the sum of the contents of the registers R11 and R12 is obtained and written in R13. Figure 3 (c)
3 is an address instruction having the contents of R10, and FIG.
Similar to (b), it is shown that the sum of the contents of the registers R21 and R22 is obtained and written to R23. In the apparatus for executing the execution as shown in FIG. 3, the execution is f (instruction fetch), d (instruction decode, read operand from register), e.
(Instruction execution, branch condition judgment, branch destination address calculation),
Pipeline processing represented by four stages of w (writing of results) is performed.

【0007】図3(a)の命令をフェッチ中に分岐予測
テーブルの分岐命令アドレスの検索が行なわれるが、該
当する命令アドレスが存在しないので、次のステージで
は、先にフェッチを行なったアドレスに連続するアドレ
スの命令がフェッチされる。しかし、図3(a)の命令
のeステージで分岐条件判断を行ない、分岐条件が成立
することが判明したとする。尚、この場合は条件レジス
タの内容が“0”である。そして、更に分岐先アドレス
が計算されるので、次のステージにおいて図3(c)の
分岐先命令がフェッチされ、以降このアドレスの命令か
ら連続に処理される。ただし、図3(b)の命令はdス
テージまで進んだのみで実行を取り止める。この時、分
岐予測が成功した場合と比較して2ステージの遅れが生
じている。
While the instruction of FIG. 3A is being fetched, the branch instruction address of the branch prediction table is searched. However, since there is no corresponding instruction address, in the next stage, the address fetched earlier is selected. Instructions at consecutive addresses are fetched. However, it is assumed that the branch condition is determined at the e stage of the instruction of FIG. 3A and it is found that the branch condition is satisfied. In this case, the content of the condition register is "0". Then, since the branch destination address is further calculated, the branch destination instruction of FIG. 3C is fetched in the next stage, and thereafter, the instruction of this address is successively processed. However, execution of the instruction of FIG. 3B is stopped only when it has advanced to the d stage. At this time, there is a delay of two stages as compared with the case where the branch prediction is successful.

【0008】[0008]

【発明が解決しようとする課題】しかしながら、上述し
た従来の技術には、次のような問題があった。即ち、上
述した分岐予測テーブルのValidフィールドの初期
状態はすべて“0”であり、電源投入直後及びリセット
直後に計算機がプログラムの実行を開始する場合、分岐
予測は全く行なえなかった。更に、計算機が新たなジョ
ブを開始する場合には、それ以前とは全く異なるアドレ
スの命令の実行を開始するために、分岐予測テーブルの
Validフィールドがすべて“1”であっても、該当
する命令アドレスが分岐予測テーブルの分岐命令アドレ
スフィールドになく、分岐予測ができない状態が発生す
る。従って、計算機の処理速度が低下するという問題が
あった。本発明は、以上の点に着目してなされたもの
で、電源投入直後及びリセット直後に計算機が実行を開
始する場合にも分岐予測が行なえるようにした分岐命令
予測処理装置及びその処理方法を提供することを目的と
するものである。
However, the above-mentioned conventional technique has the following problems. That is, the initial states of the Valid fields in the branch prediction table are all "0", and when the computer starts executing the program immediately after power-on and reset, branch prediction cannot be performed at all. Further, when the computer starts a new job, the execution of an instruction at an address completely different from that before that is started, so that even if the Valid field of the branch prediction table is all "1", the corresponding instruction is executed. The address does not exist in the branch instruction address field of the branch prediction table, and a state in which branch prediction cannot be performed occurs. Therefore, there is a problem that the processing speed of the computer is reduced. The present invention has been made in view of the above points, and provides a branch instruction prediction processing device and a processing method thereof capable of performing branch prediction even when a computer starts execution immediately after power-on and reset. It is intended to be provided.

【0009】[0009]

【課題を解決するための手段】本発明の分岐命令予測処
理装置は、計算機で順に実行される分岐命令に続く命令
をフェッチする際に、当該分岐命令による分岐方向と分
岐先を、当該分岐命令の実行結果が判明する前に予測す
ることによっていち早く分岐命令に続く命令をフェッチ
する分岐命令予測処理装置において、前記分岐命令の実
行時に、当該分岐命令のアドレスと、当該分岐命令によ
って分岐が行なわれたか否かを示す情報と、当該分岐命
令の分岐先の命令のアドレスとを保持する分岐予測テー
ブルと、計算機によりプログラムを正規に実行する前
に、当該分岐予測テーブルの内容を明示的に書き換え得
る分岐予測テーブル変更命令実行部とを備えたことを特
徴とするものである。
A branch instruction prediction processing device of the present invention, when fetching an instruction following a branch instruction sequentially executed by a computer, determines the branch direction and branch destination of the branch instruction by the branch instruction. In a branch instruction prediction processing device that fetches an instruction immediately following a branch instruction by predicting before the execution result of is known, when the branch instruction is executed, a branch is performed by the address of the branch instruction and the branch instruction. Information indicating whether or not the branch instruction is stored, and the address of the branch destination instruction of the branch instruction, and the contents of the branch prediction table can be explicitly rewritten before the computer executes the program normally. And a branch prediction table change instruction execution unit.

【0010】本発明の分岐命令予測処理方法は、プログ
ラム実行時の分岐に関して、個々の分岐命令での分岐方
向を記録するとともに、分岐命令のアドレス及び分岐先
命令のアドレスを記録する分岐予測テーブルを用意し、
計算機によりプログラムを正規に実行する前に、当該分
岐予測テーブルに前記分岐方向と、分岐命令のアドレス
及び分岐先命令のアドレスを記録するための準備的な実
行を1回以上行ない、正規のプログラム実行時の分岐予
測のための分岐方向と、分岐命令のアドレス及び分岐先
命令のアドレスを前記分岐予測テーブルに予め設定する
ことを特徴とするものである。
The branch instruction prediction processing method of the present invention records a branch direction of each branch instruction with respect to a branch during program execution, and a branch prediction table for recording the address of the branch instruction and the address of the branch destination instruction. Prepare,
Before the program is executed normally by the computer, preliminary execution for recording the branch direction, the address of the branch instruction and the address of the branch destination instruction in the branch prediction table is performed once or more to execute the regular program. The branch direction for branch prediction at that time, the address of the branch instruction, and the address of the branch target instruction are set in advance in the branch prediction table.

【0011】[0011]

【作用】本発明の分岐命令予測処理装置及びその処理方
法においては、電源投入直後及びリセット直後、更には
新たなジョブを開始するときに、準備的なプログラムの
実行を行なう。この準備用のプログラムは正規の実行用
のプログラムでもよく、また、分岐予測テーブルの変更
のための特殊な命令を含んだプログラムでもよい。これ
により、正規にプログラムの実行をしようとするとき
は、常に既にこれから実行される分岐命令に該当する分
岐予測テーブルエントリが設定されている。従って、電
源投入直後等でも分岐命令をフェッチすると、直ちに分
岐予測が行なわれ、分岐予測先の命令がフェッチされ
る。
In the branch instruction prediction processing apparatus and the processing method thereof according to the present invention, the preparatory program is executed immediately after the power is turned on and after the reset, and when a new job is started. The preparation program may be a regular execution program or a program including a special instruction for changing the branch prediction table. As a result, when the program is to be executed normally, the branch prediction table entry corresponding to the branch instruction to be executed is already set. Therefore, even if the branch instruction is fetched immediately after the power is turned on, the branch prediction is immediately performed and the branch prediction destination instruction is fetched.

【0012】[0012]

【実施例】以下、本発明の実施例を図面を参照して詳細
に説明する。図1は、本発明の分岐命令予測処理装置を
含む情報処理装置の一実施例のブロック図である。図示
の情報処理装置は、命令メモリ1、命令バッファ2、演
算処理部3、レジスタファイル4、メモリ制御部5、デ
ータメモリ6、命令フェッチ制御部7、分岐命令実行部
8及び分岐命令予測処理部9から成る。更に、分岐命令
予測処理部9は、分岐予測テーブル10と、分岐予測テ
ーブル変更命令実行部11から成る。命令メモリ1は、
図3又は図7に示すような命令を格納する。
Embodiments of the present invention will now be described in detail with reference to the drawings. FIG. 1 is a block diagram of an embodiment of an information processing device including a branch instruction prediction processing device of the present invention. The illustrated information processing apparatus includes an instruction memory 1, an instruction buffer 2, an arithmetic processing unit 3, a register file 4, a memory control unit 5, a data memory 6, an instruction fetch control unit 7, a branch instruction execution unit 8 and a branch instruction prediction processing unit. It consists of nine. Further, the branch instruction prediction processing unit 9 includes a branch prediction table 10 and a branch prediction table change instruction execution unit 11. The instruction memory 1 is
The instruction as shown in FIG. 3 or FIG. 7 is stored.

【0013】命令バッファ2は、実行する命令を一時的
に格納するメモリである。演算処理部3は、命令バッフ
ァ2から取り出した命令を実行する。レジスタファイル
4は、汎用レジスタ等から成る。メモリ制御部5は、デ
ータメモリ6とレジスタファイル4との間のデータ転送
を制御する。データメモリ6は、演算処理部3で処理す
るデータを格納する。命令フェッチ制御部7は、命令メ
モリ1から命令バッファ2への命令の転送を制御する。
分岐命令実行部8は、命令バッファ2から取り出した分
岐命令を実行し、分岐する場合には分岐先のアドレスの
命令を命令メモリ1から命令バッファ2に転送する。一
方、分岐しない場合には当該分岐命令の次のアドレスの
命令を命令メモリ1から命令バッファ2に転送する。
The instruction buffer 2 is a memory for temporarily storing instructions to be executed. The arithmetic processing unit 3 executes the instruction fetched from the instruction buffer 2. The register file 4 is composed of general-purpose registers and the like. The memory control unit 5 controls data transfer between the data memory 6 and the register file 4. The data memory 6 stores the data processed by the arithmetic processing unit 3. The instruction fetch control unit 7 controls the transfer of instructions from the instruction memory 1 to the instruction buffer 2.
The branch instruction execution unit 8 executes the branch instruction fetched from the instruction buffer 2, and when branching, transfers the instruction at the branch destination address from the instruction memory 1 to the instruction buffer 2. On the other hand, when not branching, the instruction at the address next to the branch instruction is transferred from the instruction memory 1 to the instruction buffer 2.

【0014】分岐命令予測処理部9は、分岐命令実行部
8で分岐命令が実行される前にその分岐命令のアドレス
から分岐方向を予測し、命令フェッチ部7に予め次の命
令をフェッチさせる。分岐予測テーブル10は、分岐命
令アドレスに対応して分岐先アドレス、分岐方向予測、
Validを格納している。分岐予測テーブル変更命令
実行部11は、演算処理部3で実行される所定の命令に
より、分岐予測テーブル10中の命令アドレス、分岐先
アドレス、分岐方向予測を明示的に書き換え得る。
The branch instruction prediction processing unit 9 predicts the branch direction from the address of the branch instruction before the branch instruction execution unit 8 executes the branch instruction, and causes the instruction fetch unit 7 to fetch the next instruction in advance. The branch prediction table 10 includes a branch destination address, a branch direction prediction,
Stores Valid. The branch prediction table change instruction execution unit 11 can explicitly rewrite the instruction address, the branch destination address, and the branch direction prediction in the branch prediction table 10 by a predetermined instruction executed by the arithmetic processing unit 3.

【0015】図4は、分岐予測テーブルを設定するプロ
グラムの例を示す図である。即ち、この図には、分岐予
測テーブルに書き込みを行なう命令列の例を示す。この
命令中moviは第1引数で示される分岐予測テーブル
のフィールドに第2引数で示される値を書き込む命令で
ある。bp,bpa,bptは各々分岐予測テーブルの
分岐予測、分岐命令アドレス、分岐予測アドレスの各フ
ィールドを示している。演算処理部3で分岐予測テーブ
ル変更命令であることが認識されると、これを分岐命令
予測処理部9の分岐予測テーブル変更命令実行部11に
通知する。分岐予測テーブル変更命令実行部11では、
Validフィールドが“0”であるエントリを1つ選
んでそのエントリの各フィールドの内容を書き換える。
この場合、Validフィールドが“0”であるエント
リがなければValidフィールドが“1”であって最
後に利用されたものを検索してそのエントリの各フィー
ルドの内容を書き換える。
FIG. 4 is a diagram showing an example of a program for setting the branch prediction table. That is, this figure shows an example of an instruction sequence for writing to the branch prediction table. In this instruction, movi is an instruction to write the value indicated by the second argument into the field of the branch prediction table indicated by the first argument. bp, bpa, and bpt respectively represent the fields of the branch prediction, branch instruction address, and branch prediction address of the branch prediction table. When the arithmetic processing unit 3 recognizes that the instruction is a branch prediction table changing instruction, it notifies the branch prediction table changing instruction executing unit 11 of the branch instruction prediction processing unit 9 of this. In the branch prediction table change instruction execution unit 11,
One entry in which the Valid field is "0" is selected, and the contents of each field of the entry are rewritten.
In this case, if there is no entry in which the Valid field is "0", the one that is valid in the Valid field and is used last is searched, and the contents of each field of the entry are rewritten.

【0016】分岐予測テーブルが図2に示される状態で
あったときに、図4による分岐予測テーブルの設定が実
行されると、図1に示すように分岐予測テーブルが書き
換えられる。つまり、図1に示す分岐予測テーブル10
の第3行に示されるエントリが追加される。図5は、分
岐予測テーブルエントリの決定手順を説明するフローチ
ャートである。即ち、このフローチャートは、分岐予測
テーブルに書き込むエントリを決定し、分岐予測テーブ
ルに書き込む方法の手順を示す。各エントリを決定する
に当り、まず高速化の対象となるジョブプログラムを実
行する(ステップS1)。更に、実行中に分岐命令を検
索し(ステップS2)、分岐命令があれば、その分岐命
令アドレスを記録する(ステップS3)。更に、当該分
岐命令の結果を収集し(ステップS4)、分岐命令によ
る分岐先アドレスと分岐方向を記録する(ステップS
5)。以上、記録された各項目について、実行開始から
分岐予測テーブルエントリ数と同数の分岐命令アドレス
について、各2回の分岐命令実行の記録を取り出す(ス
テップS6、S7、S8)。
When the branch prediction table is set as shown in FIG. 4 while the branch prediction table is in the state shown in FIG. 2, the branch prediction table is rewritten as shown in FIG. That is, the branch prediction table 10 shown in FIG.
The entry shown in the third line is added. FIG. 5 is a flowchart illustrating a procedure for determining a branch prediction table entry. That is, this flowchart shows the procedure of the method for determining the entry to be written in the branch prediction table and writing it in the branch prediction table. In determining each entry, first, a job program to be accelerated is executed (step S1). Furthermore, a branch instruction is searched during execution (step S2), and if there is a branch instruction, the branch instruction address is recorded (step S3). Further, the result of the branch instruction is collected (step S4), and the branch destination address and branch direction of the branch instruction are recorded (step S4).
5). As described above, for each of the recorded items, the record of the execution of the branch instruction twice each is extracted for the same number of branch instruction addresses as the number of branch prediction table entries from the start of execution (steps S6, S7, S8).

【0017】図6は、分岐方向予測フィールドの決定方
法の説明図である。図示のように、1回目に分岐してい
れば分岐方向予測フィールドの上位ビットの値は“1”
になる。また、2回目に分岐していれば分岐方向予測フ
ィールドの下位ビットの値は“1”になる。図7は、分
岐命令を含む命令列と本発明による実行タイミングの例
を示す図である。即ち、この図は、上記のように分岐予
測テーブルを書き換えた後に、図3に示した命令と同じ
命令を実行したときのタイミングを示している。以下、
図1を参照しつつ、図7に示す実行タイミングについて
説明する。
FIG. 6 is an explanatory diagram of a method of determining a branch direction prediction field. As shown in the figure, the value of the upper bit of the branch direction prediction field is "1" if the branch is the first time.
become. If the branch is the second time, the value of the lower bit of the branch direction prediction field is "1". FIG. 7 is a diagram showing an example of an instruction sequence including branch instructions and execution timing according to the present invention. That is, this figure shows the timing when the same instruction as the instruction shown in FIG. 3 is executed after rewriting the branch prediction table as described above. Less than,
The execution timing shown in FIG. 7 will be described with reference to FIG.

【0018】始めに、分岐命令をフェッチするステージ
fで、分岐予測テーブル10は命令フェッチ制御部7か
らアドレスを取り出し、分岐予測テーブル10内の各エ
ントリの分岐命令アドレスと比較する。この時、分岐予
測テーブル10の分岐命令アドレスには、前述のとおり
プログラムによって書き込んだエントリが存在し、これ
が現在フェッチ中の命令アドレスと一致する。従って、
当該エントリのValidフィールドが“1”であるこ
とを確認した上で、分岐方向予測を読み出す。分岐方向
予測はこの時“11”であるので、分岐が行なわれると
予測される。従って、当該エントリの分岐先アドレスを
分岐方向予測と共に分岐命令実行部8に通知する。分岐
命令実行部8では、このアドレスを命令フェッチ制御部
7に通知する。次のステージでは、命令アドレスを分岐
予測先のアドレスに変更して命令フェッチを行なう。更
に次のステージでは、分岐命令の条件判断が行なわれ、
前述の分岐予測が正しければ図7に示すようにそのまま
実行が続けられる。
First, at the stage f for fetching a branch instruction, the branch prediction table 10 fetches an address from the instruction fetch control unit 7 and compares it with the branch instruction address of each entry in the branch prediction table 10. At this time, the branch instruction address of the branch prediction table 10 has an entry written by the program as described above, and this matches the instruction address currently fetched. Therefore,
After confirming that the Valid field of the entry is "1", the branch direction prediction is read. Since the branch direction prediction is "11" at this time, it is predicted that the branch will be taken. Therefore, the branch destination address of the entry is notified to the branch instruction execution unit 8 together with the branch direction prediction. The branch instruction execution unit 8 notifies the instruction fetch control unit 7 of this address. In the next stage, the instruction address is changed to the branch prediction destination address and the instruction is fetched. In the next stage, the branch instruction condition is judged,
If the above-mentioned branch prediction is correct, the execution is continued as shown in FIG.

【0019】[0019]

【発明の効果】以上説明したように、本発明の分岐命令
予測処理装置及びその処理方法によれば、電源投入直後
及びリセット直後、更には新たなジョブを開始するとき
に、既にこれから実行される分岐命令に該当する分岐予
測テーブルが設定されるようにしたので、分岐命令をフ
ェッチすると、直ちに分岐予測を行なうことができ、分
岐予測先の命令をフェッチすることができる。従って、
分岐予測テーブルの内容がすべて無効である場合や、プ
ロセッサが新たなジョブを開始し、それに続く命令のア
ドレスが全く分岐予測テーブルに登録されていない場合
でも、すぐに高速な処理を開始することが可能になる。
As described above, according to the branch instruction prediction processing apparatus and the processing method thereof of the present invention, the branch instruction prediction processing apparatus is already executed immediately after the power is turned on and reset, and when a new job is started. Since the branch prediction table corresponding to the branch instruction is set, the branch prediction can be immediately performed when the branch instruction is fetched, and the branch prediction destination instruction can be fetched. Therefore,
Even if the contents of the branch prediction table are all invalid, or if the processor starts a new job and the address of the following instruction is not registered in the branch prediction table, high-speed processing can be started immediately. It will be possible.

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

【図1】本発明の分岐命令予測処理装置を含む情報処理
装置の一実施例のブロック図である。
FIG. 1 is a block diagram of an embodiment of an information processing device including a branch instruction prediction processing device of the present invention.

【図2】分岐予測テーブルの構成の説明図である。FIG. 2 is an explanatory diagram of a configuration of a branch prediction table.

【図3】分岐命令を含む命令列と従来の実行タイミング
の例の説明図である。
FIG. 3 is an explanatory diagram of an example of an instruction string including a branch instruction and a conventional execution timing.

【図4】分岐予測テーブルを設定するプログラムの例の
説明図である。
FIG. 4 is an explanatory diagram of an example of a program that sets a branch prediction table.

【図5】分岐予測テーブルエントリの決定手順を説明す
るフローチャートである。
FIG. 5 is a flowchart illustrating a procedure for determining a branch prediction table entry.

【図6】分岐方向予測フィールドの決定方法の説明図で
ある。
FIG. 6 is an explanatory diagram of a method for determining a branch direction prediction field.

【図7】分岐命令を含む命令列と本発明による実行タイ
ミングの例の説明図である。
FIG. 7 is an explanatory diagram of an example of an instruction sequence including a branch instruction and execution timing according to the present invention.

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

1 命令メモリ 2 命令バッファ 3 演算処理部 4 レジスタファイル 5 メモリ制御部 6 データメモリ 7 命令フェッチ制御部 8 分岐命令実行部 9 分岐命令予測処理部 10 分岐予測テーブル 11 分岐予測テーブル変更命令実行部 1 instruction memory 2 instruction buffer 3 arithmetic processing unit 4 register file 5 memory control unit 6 data memory 7 instruction fetch control unit 8 branch instruction execution unit 9 branch instruction prediction processing unit 10 branch prediction table 11 branch prediction table change instruction execution unit

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 計算機で順に実行される分岐命令に続く
命令をフェッチする際に、当該分岐命令による分岐方向
と分岐先を、当該分岐命令の実行結果が判明する前に予
測することによっていち早く分岐命令に続く命令をフェ
ッチする分岐命令予測処理装置において、 前記分岐命令の実行時に、当該分岐命令のアドレスと、
当該分岐命令によって分岐が行なわれたか否かを示す情
報と、当該分岐命令の分岐先の命令のアドレスとを保持
する分岐予測テーブルと、 計算機によりプログラムを正規に実行する前に、当該分
岐予測テーブルの内容を明示的に書き換え得る分岐予測
テーブル変更命令実行部とを備えたことを特徴とする分
岐命令予測処理装置。
1. When fetching an instruction subsequent to a branch instruction that is sequentially executed by a computer, the branch direction and branch destination of the branch instruction are predicted before the execution result of the branch instruction is known, so that the branch is executed earlier. In a branch instruction prediction processing device for fetching an instruction following an instruction, when executing the branch instruction, an address of the branch instruction,
A branch prediction table that holds information indicating whether or not a branch was taken by the branch instruction, and the address of the branch destination instruction of the branch instruction, and the branch prediction table before the computer executes the program normally. And a branch prediction table changing instruction execution unit capable of explicitly rewriting the contents of the branch instruction prediction processing apparatus.
【請求項2】 プログラム実行時の分岐に関して、個々
の分岐命令での分岐方向を記録するとともに、分岐命令
のアドレス及び分岐先命令のアドレスを記録する分岐予
測テーブルを用意し、 計算機によりプログラムを正規に実行する前に、当該分
岐予測テーブルに前記分岐方向と、分岐命令のアドレス
及び分岐先命令のアドレスを記録するための準備的な実
行を1回以上行ない、 正規のプログラム実行時の分岐予測のための分岐方向
と、分岐命令のアドレス及び分岐先命令のアドレスを前
記分岐予測テーブルに予め設定することを特徴とする分
岐命令予測処理方法。
2. A branch prediction table for recording the branch direction of each branch instruction and the address of the branch instruction and the address of the branch destination instruction is prepared for the branch at the time of executing the program, and the program is normalized by a computer. Prior to execution, preparatory execution for recording the branch direction, the address of the branch instruction and the address of the branch destination instruction in the branch prediction table is performed one or more times. A branch instruction prediction processing method, wherein a branch direction, a branch instruction address, and a branch target instruction address are preset in the branch prediction table.
JP4300298A 1992-10-13 1992-10-13 Branching instruction estimation processor and processing method therefor Pending JPH06124206A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4300298A JPH06124206A (en) 1992-10-13 1992-10-13 Branching instruction estimation processor and processing method therefor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4300298A JPH06124206A (en) 1992-10-13 1992-10-13 Branching instruction estimation processor and processing method therefor

Publications (1)

Publication Number Publication Date
JPH06124206A true JPH06124206A (en) 1994-05-06

Family

ID=17883107

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4300298A Pending JPH06124206A (en) 1992-10-13 1992-10-13 Branching instruction estimation processor and processing method therefor

Country Status (1)

Country Link
JP (1) JPH06124206A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007058875A (en) * 1996-08-02 2007-03-08 Jackie A Freeman Programmable branch prediction system and method for computer system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007058875A (en) * 1996-08-02 2007-03-08 Jackie A Freeman Programmable branch prediction system and method for computer system

Similar Documents

Publication Publication Date Title
US4858104A (en) Preceding instruction address based branch prediction in a pipelined processor
JPH06236268A (en) Apparatus and method for judgment of length of instruction
JPH03147022A (en) Branch instruction processing apparatus and method
JP2560988B2 (en) Information processing apparatus and processing method
JPS6125169B2 (en)
JP3522135B2 (en) Information processing apparatus provided with branch history having a plurality of ways
JPH06124206A (en) Branching instruction estimation processor and processing method therefor
JPH07306785A (en) Processor with branch instruction executing function and branch instruction control method
JP2552738B2 (en) Data processing device
JPS5890244A (en) Data processor
JP3493110B2 (en) High-speed branch processing unit
JPH08137690A (en) Program execution control method
JP2977951B2 (en) Arithmetic unit
JPH04213727A (en) Information processor
JPS6411973B2 (en)
JPH02151930A (en) Storage buffer managing system
JPS63231627A (en) Advanced control system
JPH06301538A (en) Condition branch instruction processor
JP2559416B2 (en) Information processing device
JPS6373432A (en) Information processor
JPS6047615B2 (en) Serialized instruction execution control method
KR970062891A (en) Operation execution method and operation execution device
JPS6232507B2 (en)
JPH07295814A (en) Data input address management method
JPS6020245A (en) Instruction control circuit of data processor

Legal Events

Date Code Title Description
A621 Written request for application examination

Effective date: 20050207

Free format text: JAPANESE INTERMEDIATE CODE: A621

A761 Written withdrawal of application

Effective date: 20060620

Free format text: JAPANESE INTERMEDIATE CODE: A761