JP5656074B2 - Branch prediction apparatus, processor, and branch prediction method - Google Patents

Branch prediction apparatus, processor, and branch prediction method Download PDF

Info

Publication number
JP5656074B2
JP5656074B2 JP2011034942A JP2011034942A JP5656074B2 JP 5656074 B2 JP5656074 B2 JP 5656074B2 JP 2011034942 A JP2011034942 A JP 2011034942A JP 2011034942 A JP2011034942 A JP 2011034942A JP 5656074 B2 JP5656074 B2 JP 5656074B2
Authority
JP
Japan
Prior art keywords
address
branch prediction
instruction
unit
prediction
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.)
Active
Application number
JP2011034942A
Other languages
Japanese (ja)
Other versions
JP2012173967A (en
Inventor
康雄 石井
康雄 石井
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 JP2011034942A priority Critical patent/JP5656074B2/en
Publication of JP2012173967A publication Critical patent/JP2012173967A/en
Application granted granted Critical
Publication of JP5656074B2 publication Critical patent/JP5656074B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3836Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
    • G06F9/3842Speculative instruction execution
    • G06F9/3848Speculative instruction execution using hybrid branch prediction, e.g. selection between prediction techniques

Landscapes

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

Description

本発明はコンピュータアーキテクチャにおける分岐予測、パイプライン動作を行うプロセッサの分岐予測装置、分岐予測方法に関する。
The present invention relates to a branch prediction apparatus and a branch prediction method for a processor that performs branch prediction and pipeline operations in a computer architecture.

プロセッサにおけるスループットを向上するためにプロセッサにはパイプライン処理機構が設けられているものがある。パイプライン動作を行うプロセッサにおいては複数段のパイプラインで連続的に命令を実行するのでスループットが向上する。しかし、パイプラインで条件分岐命令などのある処理結果を基にした判断が必要な状態が発生すると、パイプラインで連続的に命令を実行することができない状態(制御ハザード)が生じる。このようなハザードを軽減するために分岐予測と命令の投機実行が用いられている。例えば、特開2001−243069号公報には、一つの分岐予測手段に対して過去に実施した分岐予測結果をフィードバックして最新の分岐予測状態として分岐予測精度を高めるようにした分岐予測装置が紹介されている。   Some processors have a pipeline processing mechanism in order to improve throughput in the processor. In a processor that performs a pipeline operation, instructions are continuously executed in a plurality of pipelines, so that throughput is improved. However, when a state requiring determination based on a processing result such as a conditional branch instruction occurs in the pipeline, a state (control hazard) in which the instruction cannot be continuously executed in the pipeline occurs. Branch prediction and speculative execution of instructions are used to reduce such hazards. For example, Japanese Patent Laid-Open No. 2001-243069 introduces a branch prediction device that feeds back a branch prediction result that has been implemented in the past to one branch prediction unit to improve branch prediction accuracy as the latest branch prediction state. Has been.

特開2001−243069号公報JP 2001-243069 A

分岐予測と命令の投機実行は高速動作を実現するパイプライン動作のプロセッサにとって重要な技術である。しかしながら、(a)分岐の予測結果の精度が高い分岐予測方式は入力から予測結果を得るまでの時間が長い。分岐予測結果が得られるまで後続のフェッチが実施できず、パイプライン中にいわゆるバブルが発生する。(b)入力から予測結果を得るまでの時間が短い分岐予測方式は予測結果の精度が低い。分岐予測結果の精度が低いため、多くの投機実行が失敗し、高い性能が得られない。   Branch prediction and speculative execution of instructions are important techniques for pipelined processors that achieve high-speed operation. However, (a) the branch prediction method with high accuracy of the branch prediction result takes a long time to obtain the prediction result from the input. Subsequent fetches cannot be performed until a branch prediction result is obtained, and so-called bubbles are generated in the pipeline. (b) The branch prediction method with a short time from input to obtaining the prediction result has low accuracy of the prediction result. Since the accuracy of branch prediction results is low, many speculative executions fail and high performance cannot be obtained.

よって、本発明は分岐予測の入力から分岐予測の結果出力までの時間(予測レイテンシ)が短く、高精度の分岐予測が可能な分岐予測装置及び分岐予測方法を提供することを目的とする。
Therefore, an object of the present invention is to provide a branch prediction apparatus and a branch prediction method that can shorten the time (prediction latency) from the input of branch prediction to the output of the result of branch prediction (prediction latency).

上記課題を達成するため参考例の分岐予測装置の一態様は、命令フェッチの履歴から次に実行するフェッチラインを決める複数の分岐予測手段と矛盾検出手段とを備え、複数の分岐予測手段のうち高速な分岐予測手段が出力した予測アドレスで暫定的に命令フェッチアドレスを決め、複数の分岐予測手段のうち高精度で低速な分岐予測手段が出力した予測アドレスと高速な分岐予測手段が出力した予測アドレスとが同じ場合には当該暫定的な命令フェッチアドレスの命令はパイプラインで実行され、異なる場合には低速な分岐予測手段の予測アドレスを命令フェッチアドレスとし、時間軸上において先行する暫定的な命令フェッチアドレスの命令はパイプラインで実行されない(破棄される)。   In order to achieve the above object, one aspect of the branch prediction apparatus according to the reference example includes a plurality of branch prediction means and a contradiction detection means for determining a fetch line to be executed next from an instruction fetch history, and includes a plurality of branch prediction means. The instruction fetch address is tentatively determined by the prediction address output by the high-speed branch prediction means, and the prediction address output by the high-precision and low-speed branch prediction means and the prediction output by the high-speed branch prediction means among the plurality of branch prediction means When the address is the same, the instruction at the provisional instruction fetch address is executed in the pipeline. When the address is different, the prediction address of the low-speed branch prediction unit is used as the instruction fetch address, and the preceding provisional instruction on the time axis is used. The instruction at the instruction fetch address is not executed (discarded) in the pipeline.

かかる構成とすることによって、分岐予測時間が短く(低予測レイテンシ)、予測精度の高い分岐予測装置を得ることが可能となる。   With this configuration, it is possible to obtain a branch prediction device with a short prediction time (low prediction latency) and high prediction accuracy.

また、本発明の分岐予測装置の一態様は、複数ステージのパイプライン処理構造をもつプロセッサの分岐予測装置であって、複数の命令の中から次に実行すべき命令のアドレスを指定する命令フェッチアドレス部と、上記命令フェッチアドレス部に接続されて、指定された命令のアドレスの履歴から次に実行すべき命令の第1の予測アドレスを出力する第1の分岐予測手段と、上記命令フェッチアドレス部に接続されて、指定された命令のアドレスの履歴から次に実行すべき命令の第2の予測アドレスを上記第1の予測アドレスの出力から所定時間遅れて出力する上記第1の分岐予測手段よりも予測精度が高い第2の分岐予測手段と、上記命令フェッチアドレス部に接続されて、指定された命令のアドレスの履歴から次に実行すべき命令の予測アドレスを上記第2の分岐予測手段よりも低応答速度と高い予測精度で出力する第3の分岐予測手段と、上記第1乃至第3の分岐予測手段の出力が全て同じであるとき、上記第1の分岐予測手段の出力をフェッチすべき命令アドレスとして上記命令フェッチアドレス部に指定し、上記第2及び第3の分岐予測手段の出力が異なるとき、上記第3の分岐予測手段の出力をフェッチすべき命令アドレスとして上記命令フェッチアドレス部に指定し、上記第1及び第2の分岐予測手段の出力が異なるとき、上記第2の分岐予測手段の出力をフェッチすべき命令アドレスとして上記命令フェッチアドレス部に指定する、予測結果選択手段と、を備える。
また、参考例の分岐予測装置の一態様は、複数ステージのパイプライン処理構造をもつプロセッサの分岐予測装置において、複数の命令をアドレスに対応づけて記憶する記憶手段と、上記複数の命令の中から次に実行すべき命令のアドレスを指定する命令フェッチアドレス部と、指定された命令を実行する実行ユニットと、指定された命令のアドレスの履歴から次に実行すべき命令の第1の予測アドレスを出力する第1の分岐予測手段と、指定された命令のアドレスの履歴から次に実行すべき命令の第2の予測アドレスを上記第1の予測アドレスの出力から所定時間遅れて出力する上記第1の分岐予測手段よりも予測精度が高い第2の分岐予測手段と、上記第2の予測アドレスに先行する上記第1の予測アドレスを上記命令フェッチ部に与えると共に、上記第1の予測アドレスと上記第1の予測アドレスに後続する上記第2の予測アドレスが異なるとき上記第2の予測アドレスを上記命令フェッチ部に与える予測結果選択手段と、上記第2の予測アドレスが上記命令フェッチアドレス部に与えられるとき上記第1の予測アドレスの命令の実行の破棄を上記実行ユニットに指示する矛盾検出手段と、を備える。
Another aspect of the branch prediction apparatus of the present invention is a branch prediction apparatus for a processor having a multi-stage pipeline processing structure, in which an instruction fetch for designating an address of an instruction to be executed next from among a plurality of instructions is provided. An address part; a first branch prediction unit connected to the instruction fetch address part for outputting a first prediction address of an instruction to be executed next from a history of the address of the designated instruction; and the instruction fetch address is connected to the section, the first branch prediction means for outputting a second predicted address of the next instruction to be executed from a history of the addresses of the designated instruction predetermined time delay from the output of the first predicted address A second branch predicting means having a higher prediction accuracy than the above-mentioned instruction fetch address section, and the instruction to be executed next is predicted from the history of the address of the designated instruction. A third branch prediction means for outputting the address in low response speed and high prediction accuracy than the second branch prediction unit, when the output of the first to third branch prediction unit are all the same, the first The output of one branch prediction means is designated as the instruction address to be fetched in the instruction fetch address section, and when the outputs of the second and third branch prediction means are different, the output of the third branch prediction means is fetched. When the instruction fetch address part is designated as the instruction address to be fetched and the outputs of the first and second branch prediction means are different, the output of the second branch prediction means is taken as the instruction address to be fetched. And a prediction result selection means for designating to the section.
Further, one aspect of the branch prediction apparatus of the reference example is a branch prediction apparatus for a processor having a multi-stage pipeline processing structure, a storage means for storing a plurality of instructions in association with addresses, and among the plurality of instructions. An instruction fetch address portion for designating the address of the next instruction to be executed, an execution unit for executing the designated instruction, and a first predicted address of the instruction to be executed next from the history of the designated instruction address The first branch prediction means for outputting the second prediction address of the instruction to be executed next from the history of the address of the designated instruction, and outputting the second prediction address delayed for a predetermined time from the output of the first prediction address A second branch prediction unit having a higher prediction accuracy than that of the first branch prediction unit; and the first prediction address preceding the second prediction address is provided to the instruction fetch unit. And a prediction result selection means for giving the second prediction address to the instruction fetch unit when the first prediction address and the second prediction address subsequent to the first prediction address are different from each other, and And a contradiction detecting means for instructing the execution unit to discard the execution of the instruction at the first predicted address when the predicted address is given to the instruction fetch address section.

かかる構成とすることによって、分岐予測時間が短く、予測精度の高い分岐予測装置を得ることが可能となる。   By adopting such a configuration, it is possible to obtain a branch prediction device with a short branch prediction time and high prediction accuracy.

また、本発明の分岐予測装置の一態様は、複数ステージのパイプライン処理構造をもつプロセッサの分岐予測装置において、複数の命令をアドレスに対応づけて記憶する記憶手段と、上記複数の命令の中から次に実行すべき命令のアドレスを指定する命令フェッチアドレス部と、指定された命令を実行する実行ユニットと、指定された命令のアドレスの履歴から次に実行すべき命令の第1の予測アドレスの列を出力する第1の分岐予測手段と、指定された命令のアドレスの履歴から次に実行すべき命令の第2の予測アドレスの列を上記第1の予測アドレスの出力から所定時間遅れて出力する上記第1の分岐予測手段よりも予測精度が高い第2の分岐予測手段と、上記第1の予測アドレスの列を上記命令フェッチアドレス部に与えると共に、上記第1の予測アドレスの列と上記第2の予測アドレスの列とを比較して対応する予測アドレスに相違があるとき、上記第2の予測アドレスの列のアドレスで上記第1の予測アドレスの列を修正する予測結果選択手段と、上記第2の予測アドレスの列のアドレスが上記命令フェッチアドレス部に与えられるとき上記第1の予測アドレスの列の修正されたアドレスの命令の実行の破棄を上記実行ユニットに指示する矛盾検出手段と、を備える。   According to another aspect of the branch prediction apparatus of the present invention, in a branch prediction apparatus for a processor having a multi-stage pipeline processing structure, a storage means for storing a plurality of instructions in association with addresses, An instruction fetch address portion for designating the address of the next instruction to be executed, an execution unit for executing the designated instruction, and a first predicted address of the instruction to be executed next from the history of the designated instruction address The first branch prediction means for outputting the sequence of the second instruction and the second prediction address sequence of the instruction to be executed next from the history of the address of the designated instruction are delayed by a predetermined time from the output of the first prediction address. A second branch predicting unit having a higher prediction accuracy than the first branch predicting unit to be output; a column of the first predicted address; When the first predicted address column and the second predicted address column are compared and the corresponding predicted addresses are different, the first predicted address column is the same as the second predicted address column address. A prediction result selecting means for correcting the instruction, and discarding the execution of the instruction at the corrected address in the first predicted address column when the address of the second predicted address column is given to the instruction fetch address portion. Contradiction detection means for instructing the execution unit.

かかる構成とすることによって、分岐予測時間が短く、予測精度の高い分岐予測装置を得ることが可能となる。   By adopting such a configuration, it is possible to obtain a branch prediction device with a short branch prediction time and high prediction accuracy.

好ましくは、上記第1の分岐予測手段の出力と上記第2の分岐予測手段の出力との相互間には、上記パイプライン構造における1ステージ又は複数ステージに対応する時間差がある。   Preferably, there is a time difference corresponding to one stage or a plurality of stages in the pipeline structure between the output of the first branch prediction unit and the output of the second branch prediction unit.

また、参考例の分岐予測装置の一態様は、複数ステージのパイプライン処理構造をもつプロセッサの分岐予測装置において、複数の命令をアドレスに対応づけて記憶する記憶手段と、上記複数の命令の中から次に実行すべき命令のアドレスを指定する命令フェッチアドレス部と、指定された命令を実行する実行ユニットと、指定された命令のアドレスの履歴から次に実行すべき命令の第1の予測アドレスの列を出力する第1の分岐予測手段と、指定された命令のアドレスの履歴から次に実行すべき命令の第2の予測アドレスの列を上記第1の予測アドレスの出力から所定時間遅れて出力する上記第1の分岐予測手段よりも予測精度が高い第2の分岐予測手段と、上記第1の予測アドレスの列を上記命令フェッチアドレス部に与えると共に、上記第1の予測アドレスの列と上記第2の予測アドレスの列とを比較して対応する予測アドレスに相違があるとき、上記第2の予測アドレスの列のアドレスで上記第1の予測アドレスの列を修正する予測結果選択手段と、上記第2の予測アドレスの列のアドレスが上記命令フェッチアドレス部に与えられるとき上記第1の予測アドレスの列の修正されたアドレスの命令の実行の破棄を上記実行ユニットに指示する矛盾検出手段と、を備える。   Further, one aspect of the branch prediction apparatus of the reference example is a branch prediction apparatus for a processor having a multi-stage pipeline processing structure, a storage means for storing a plurality of instructions in association with addresses, and among the plurality of instructions. An instruction fetch address portion for designating the address of the next instruction to be executed, an execution unit for executing the designated instruction, and a first predicted address of the instruction to be executed next from the history of the designated instruction address The first branch prediction means for outputting the sequence of the second instruction and the second prediction address sequence of the instruction to be executed next from the history of the address of the designated instruction are delayed by a predetermined time from the output of the first prediction address. A second branch predicting unit having a higher prediction accuracy than the first branch predicting unit to be output; a column of the first predicted address; When the first predicted address column and the second predicted address column are compared and the corresponding predicted addresses are different, the first predicted address column is the same as the second predicted address column address. A prediction result selecting means for correcting the instruction, and discarding the execution of the instruction at the corrected address in the first predicted address column when the address of the second predicted address column is given to the instruction fetch address portion. Contradiction detection means for instructing the execution unit.

かかる構成とすることによって、分岐予測時間が短く、予測精度の高い分岐予測装置を得ることが可能となる。   By adopting such a configuration, it is possible to obtain a branch prediction device with a short branch prediction time and high prediction accuracy.

また、参考例の分岐予測方式の一態様は、複数ステージのパイプライン処理構造をもつプロセッサの分岐予測方式において、高速で低精度の分岐予測手段と低速で高精度の分岐予測手段を並行して動作させ、先に得られる低精度の予測アドレスを暫定アドレスとして命令フェッチを実行し、上記暫定アドレスと後に得られる高精度の予測アドレスとを比較して予測結果が異なるとき、後に得られる高精度の予測アドレスで命令フェッチを実行すると共に上記暫定アドレスでフェッチされた命令の破棄又は上記暫定アドレスでフェッチされた命令の実行結果を破棄する。   Further, one aspect of the branch prediction method of the reference example is that in a branch prediction method of a processor having a multi-stage pipeline processing structure, a high-speed and low-precision branch prediction unit and a low-speed and high-precision branch prediction unit are provided in parallel. When the instruction fetch is executed using the previously obtained low-precision prediction address as the temporary address and the prediction result is different by comparing the temporary address and the high-precision prediction address obtained later, the high-precision obtained later The instruction fetch is executed at the predicted address, and the instruction fetched at the temporary address is discarded or the execution result of the instruction fetched at the temporary address is discarded.

かかる構成とすることによって、分岐予測時間が短く、予測精度の高い分岐予測装置を得ることが可能となる。   By adopting such a configuration, it is possible to obtain a branch prediction device with a short branch prediction time and high prediction accuracy.

また、本発明の分岐予測方法の一態様は、複数ステージのパイプライン処理構造をもつプロセッサの分岐予測方法であって、指定された命令のアドレスの履歴から次に実行すべき命令の予測アドレスを所定の応答速度と所定の予測精度で出力する第1の分岐予測ステップと、上記指定された命令のアドレスの履歴から次に実行すべき命令の予測アドレスを上記第1の分岐予測ステップよりも低応答速度と高い予測精度で出力する第2の分岐予測ステップと、上記指定された命令のアドレスの履歴から次に実行すべき命令の予測アドレスを上記第2の岐予測ステップよりも低応答速度と高い予測精度で出力する第3の分岐予測ステップと、を備え、上記第1乃至第3の分岐予測ステップの出力が同じであるとき、上記第1の分岐予測ステップの出力をフェッチすべき命令アドレスとして指定し、上記第2及び第3の分岐予測ステップの出力が異なるとき、上記第3の分岐予測ステップの出力をフェッチすべき命令アドレスとして指定すると共にパイプラインの後段で上記第1及び第2の分岐予測ステップの各出力の命令アドレスに基づくフェッチよる処理を破棄し、上記第1及び第2の分岐予測ステップの出力が異なるとき、上記第2の分岐予測ステップの出力をフェッチすべき命令アドレスとして指定する共にパイプラインの後段で上記第1の分岐予測ステップの出力の命令アドレスに基づくフェッチによる処理を破棄する。
また、参考例の分岐予測方式の一態様は、複数ステージのパイプライン処理構造をもつプロセッサの分岐予測方式において、指定された命令のアドレスの履歴から次に実行すべき命令の予測アドレスを所定の応答速度と所定の予測精度で出力する第1の分岐予測手段と、指定された命令のアドレスの履歴から次に実行すべき命令の予測アドレスを上記第1の分岐予測手段よりも低応答速度と高い予測精度で出力する第2の分岐予測手段と、指定された命令のアドレスの履歴から次に実行すべき命令の予測アドレスを上記第2の岐予測手段よりも低応答速度と高い予測精度で出力する第3の分岐予測手段と、を備え、上記第1乃至第3の分岐予測手段の出力が同じであるとき、上記第1の分岐予測手段の出力をフェッチすべき命令アドレスとして指定し、上記第2及び第3の分岐予測手段の出力が異なるとき、上記第3の分岐予測手段の出力をフェッチすべき命令アドレスとして指定すると共にパイプラインの後段で上記第1及び第2の分岐予測手段の各出力をフェッチした命令アドレスによる処理を破棄し、上記第1及び第2の分岐予測手段の出力が異なるとき、上記第2の分岐予測手段の出力をフェッチすべき命令アドレスとして指定する共にパイプラインの後段で上記第1の分岐予測手段の出力をフェッチした命令アドレスによる処理を破棄する。
One aspect of the branch prediction method of the present invention is a branch prediction method for a processor having a multi-stage pipeline processing structure, wherein a predicted address of an instruction to be executed next is determined from a history of addresses of designated instructions. A first branch prediction step that outputs with a predetermined response speed and a predetermined prediction accuracy, and a predicted address of an instruction to be executed next is lower than the first branch prediction step from the history of the address of the designated instruction. A second branch prediction step for outputting with a response speed and high prediction accuracy, and a predicted address of an instruction to be executed next from the history of the address of the designated instruction is lower than the second branch prediction step. A third branch prediction step that outputs with high prediction accuracy, and when the outputs of the first to third branch prediction steps are the same, the first branch prediction step When the output is specified as an instruction address to be fetched and the outputs of the second and third branch prediction steps are different, the output of the third branch prediction step is specified as an instruction address to be fetched and is later in the pipeline. When the output by the fetch based on the instruction address of each output of the first and second branch prediction steps is discarded and the outputs of the first and second branch prediction steps are different, The output is designated as an instruction address to be fetched , and the processing based on the fetch based on the instruction address of the output of the first branch prediction step is discarded at the later stage of the pipeline.
Also, one aspect of the branch prediction method of the reference example is that in a branch prediction method of a processor having a multi-stage pipeline processing structure, a predicted address of an instruction to be executed next is determined from a specified instruction address history. A first branch prediction unit that outputs a response speed and a predetermined prediction accuracy; and a predicted address of an instruction to be executed next from the history of the address of the designated instruction is lower than the first branch prediction unit. The second branch predicting means for outputting with high prediction accuracy, and the predicted address of the next instruction to be executed from the history of the address of the designated instruction with lower response speed and higher prediction accuracy than the second branch prediction means. Third branch prediction means for outputting, and when the outputs of the first to third branch prediction means are the same, the output of the first branch prediction means is used as an instruction address to be fetched. When the outputs of the second and third branch predicting means are different from each other, the output of the third branch predicting means is specified as an instruction address to be fetched, and the first and second outputs are executed in the subsequent stage of the pipeline. When the outputs of the branch prediction means are discarded by the fetched instruction address and the outputs of the first and second branch prediction means are different, the output of the second branch prediction means is designated as the instruction address to be fetched. At the same time, the processing by the instruction address fetched from the output of the first branch predicting means is discarded at the latter stage of the pipeline.

かかる構成とすることによって、分岐予測時間が短く、予測精度の高い分岐予測装置を得ることが可能となる。   By adopting such a configuration, it is possible to obtain a branch prediction device with a short branch prediction time and high prediction accuracy.

本発明によれば、分岐予測の入力から分岐予測の結果出力までの時間が短く、高精度の分岐予測が可能な分岐予測装や分岐予測方式を得ることが可能となる。   According to the present invention, it is possible to obtain a branch prediction device and a branch prediction method capable of performing highly accurate branch prediction with a short time from the branch prediction input to the branch prediction result output.

本発明の分岐予測装置を説明する説明図である。It is explanatory drawing explaining the branch prediction apparatus of this invention. 分岐予測装置内の動作のアルゴリズムの例を説明するフローチャートである。It is a flowchart explaining the example of the algorithm of the operation | movement in a branch prediction apparatus. 分岐予測装置の動作(予測が一致する場合)を説明するタイミング図である。It is a timing diagram explaining operation | movement (when prediction is in agreement) of a branch prediction apparatus. 分岐予測装置の動作(予測が一致しない場合)を説明するタイミング図である。It is a timing diagram explaining operation | movement (when prediction does not correspond) of a branch prediction apparatus. 本発明の分岐予測装置による予測レイテンシ(実行時間)の低減を説明する図である。It is a figure explaining reduction of the prediction latency (execution time) by the branch prediction apparatus of this invention.

以下、図面を参照しつつ本発明の実施形態を通じて本発明を説明するが、以下の実施形態は特許請求の範囲に係る発明を限定するものではなく、また、実施形態の中で説明されている特徴の組み合わせのすべてが発明の解決手段に必須であるとは限らない。   Hereinafter, the present invention will be described through embodiments of the present invention with reference to the drawings. However, the following embodiments do not limit the invention according to the claims, and are described in the embodiments. Not all combinations of features are essential to the solution of the invention.

(装置の構成)
本発明によるプロセッサに内蔵される分岐予測装置は、相対的に低速で高精度な分岐予測装置と相対的に高速で低精度な分岐予測装置を命令フェッチパイプライン中で協調的に動作させることで高速で高精度な分岐予測を実現する。
(Device configuration)
The branch prediction device incorporated in the processor according to the present invention operates a relatively low speed and high accuracy branch prediction device and a relatively high speed and low accuracy branch prediction device in cooperation with each other in the instruction fetch pipeline. Realizes high-speed and high-precision branch prediction.

本実施例では、プロセッサが三段のパイプラインステージを持ち、分岐予測装置が分岐予測手段としての三つ(複数)の分岐予測部を用いて予測を行い、予測結果に基づいて命令フェッチ機構とパイプラインを制御する場合を例として説明する。第一の分岐予測部100が最も高速で低精度な動作を実現する分岐予測手段であり、第二の分岐予測部101は第一の分岐予測部よりも低速でより精度が高い動作を実現する分岐予測手段である。第三の分岐予測部102は最も低速で最も高精度な動作を実現する分岐予測手段である。   In this embodiment, the processor has three pipeline stages, the branch prediction device performs prediction using three (plural) branch prediction units as branch prediction means, and an instruction fetch mechanism based on the prediction result A case where the pipeline is controlled will be described as an example. The first branch prediction unit 100 is a branch prediction unit that realizes the fastest and low-accuracy operation, and the second branch prediction unit 101 realizes an operation that is slower and more accurate than the first branch prediction unit. It is a branch prediction means. The third branch prediction unit 102 is a branch prediction unit that realizes the slowest and most accurate operation.

分岐予測部には、例えば、単純予測、静的予測、次ライン予測、2レベル分岐予測、局所分岐予測、高域分岐予測、統合分岐予測、合意予測、分岐予測部の上書き、ニューラル分岐予測、L−Tage分岐予測、その他の分岐予測のアルゴリズムを持つ予測機構が適宜に構成される。   The branch prediction unit includes, for example, simple prediction, static prediction, next line prediction, two-level branch prediction, local branch prediction, high-frequency branch prediction, integrated branch prediction, consensus prediction, branch prediction unit overwriting, neural branch prediction, A prediction mechanism having an algorithm of L-Tage branch prediction and other branch prediction is appropriately configured.

図1に示すように、本発明の分岐予測装置は、予測結果選択部120と、命令フェッチアドレス部130と、命令キャッシュ部140と、命令デコード部150と、命令フェッチライン有効ビット部160、161と、命令実行ユニット部170と、三つ(複数)の分岐予測部100、101及び102と、予測情報の結果を参照して後続のフェッチ情報の破棄を行うかを決定する矛盾検出部110及び111、論理ゲートなどを含んで構成されている。   As shown in FIG. 1, the branch prediction apparatus of the present invention includes a prediction result selection unit 120, an instruction fetch address unit 130, an instruction cache unit 140, an instruction decoding unit 150, and instruction fetch line valid bit units 160 and 161. An instruction execution unit 170, three (plural) branch prediction units 100, 101, and 102, a contradiction detection unit 110 that determines whether to discard subsequent fetch information by referring to the prediction information result, and 111, including logic gates.

ここで、命令フェッチ部130(ステージ0)、命令キャッシュ部140(ステージ1)、命令デコード部150、命令実行ユニット部170(ステージ2)がパイプラインを構成している。また、図1の縦方向にパイプラインの三つのステージ(ステージ0、ステージ1、ステージ2)が示されている。各ステージ間のデータ移動はレジスタやデータラッチによって同期される。   Here, the instruction fetch unit 130 (stage 0), the instruction cache unit 140 (stage 1), the instruction decode unit 150, and the instruction execution unit unit 170 (stage 2) form a pipeline. Further, three stages (stage 0, stage 1 and stage 2) of the pipeline are shown in the vertical direction of FIG. Data movement between each stage is synchronized by a register or a data latch.

命令フェッチアドレス130は予測結果選択部120から出力される次に実行すべき命令アドレスを保持し、命令キャッシュ部140に対して命令フェッチ指示を与える。また、命令フェッチアドレス部130は同時に分岐予測部100、101、及び102に対して分岐予測要求を与える。
The instruction fetch address unit 130 holds the instruction address to be executed next, which is output from the prediction result selection unit 120, and gives an instruction fetch instruction to the instruction cache unit 140. The instruction fetch address unit 130 simultaneously issues a branch prediction request to the branch prediction units 100, 101, and 102.

命令フェッチライン有効ビット部160、161は各ステージの命令フェッチデータが有効であるか否かを示す。例えば、ステージ0において命令フェッチ指示で“1”が命令フェッチ有効ビット部160にセットされる。クロックと同期して後段の命令フェッチライン有効ビット部161(複数のパイプライン)に伝搬する。途中で分岐予測部の出力相互に不一致が生じた場合には命令フェッチライン有効ビット部はリセットされる。   Instruction fetch line valid bit sections 160 and 161 indicate whether or not the instruction fetch data of each stage is valid. For example, in stage 0, “1” is set in the instruction fetch valid bit unit 160 by the instruction fetch instruction. It is propagated to the instruction fetch line effective bit portion 161 (a plurality of pipelines) in the subsequent stage in synchronization with the clock. If there is a mismatch between the outputs of the branch prediction units during the process, the instruction fetch line valid bit part is reset.

命令キャッシュ部140は命令フェッチアドレス部130から与えられた命令フェッチ指示に従って該当アドレスの命令フェッチ処理を行い、命令部デコード部150に対して命令情報を与える。   The instruction cache unit 140 performs instruction fetch processing of the corresponding address in accordance with the instruction fetch instruction given from the instruction fetch address unit 130, and gives instruction information to the instruction unit decoding unit 150.

命令デコード部150は、命令キャッシュ140から出力された命令フェッチライン情報をデコードして命令実行ユニット部170を動作させる制御信号群を形成し、命令実行ユニット部170に与える。同一パイプラインステージの命令フェッチライン有効ビット部161が“1”(セット)の場合に命令実行ユニット170に命令の実行の指示が与えられ、“0”(リセット)の場合には命令実行ユニット170に命令の実行の指示が与えらず(命令実行ユニット170は命令を動作しない)、命令は破棄される。
The instruction decode unit 150 decodes the instruction fetch line information output from the instruction cache unit 140 to form a control signal group for operating the instruction execution unit unit 170 and supplies the control signal group to the instruction execution unit unit 170. Same pipe instruction fetch line valid bit 161 of line stage "1" (set) instruction execution of the instruction is given to the instruction execution unit 170 in the case of "0" (reset) instruction execution unit in the case of Razz given instruction to execute the instruction section 170 (the instruction execution unit 170 does not operate instruction), the instruction is discarded.

複数の分岐予測部100〜102はそれぞれ予測結果を分岐予測結果選択部120と後続フェッチライン破棄判定を行う矛盾検出部110及び111に出力する。   Each of the plurality of branch prediction units 100 to 102 outputs the prediction result to the branch prediction result selection unit 120 and the contradiction detection units 110 and 111 that perform the subsequent fetch line discard determination.

予測結果選択部120は得られた複数の分岐予測結果のうち適切なものを判定し、命令フェッチアドレス部130に出力する。予測結果選択部120の動作は図2を参照して後述される。
命令フェッチアドレス部130に指定された値に従って命令フェッチパイプラインは次サイクル以降のフェッチ処理を継続する。
The prediction result selection unit 120 determines an appropriate one of the obtained branch prediction results and outputs it to the instruction fetch address unit 130. The operation of the prediction result selection unit 120 will be described later with reference to FIG.
According to the value specified in the instruction fetch address unit 130, the instruction fetch pipeline continues the fetch processing from the next cycle.

後続フェッチライン破棄判定を行う矛盾検出手段(110及び111)は分岐予測部間での不整合を検出し、矛盾を検出すると命令破棄指示を命令フェッチライン有効ビット部(160及び161)に対して出力する(後述の図2参照)。すなわち、矛盾検出部110は分岐予測部100及び101間での不整合を検出し、矛盾を検出すると命令破棄指示を命令フェッチライン有効ビット部160に対して出力する。また、矛盾検出手段111は分岐予測部101及び102間での不整合を検出し、矛盾を検出すると命令破棄指示を命令フェッチライン有効ビット部160及び161に対して出力する。命令破棄指示は後続のフェッチラインの命令フェッチライン有効ビット部160、161を“0”にリセットする。命令フェッチライン有効ビット部161を“0”にリセットすると破棄された命令は実行されない。なお、命令フェッチライン有効ビット部160、161は初期値が“1”にセットされる。   The contradiction detection means (110 and 111) for determining the subsequent fetch line discarding detection detects inconsistencies between the branch prediction units. Output (see FIG. 2 described later). That is, the contradiction detection unit 110 detects inconsistency between the branch prediction units 100 and 101, and outputs an instruction discard instruction to the instruction fetch line valid bit unit 160 when a contradiction is detected. The contradiction detecting unit 111 detects inconsistency between the branch prediction units 101 and 102, and outputs an instruction discard instruction to the instruction fetch line valid bit units 160 and 161 when the contradiction is detected. The instruction discard instruction resets the instruction fetch line valid bits 160 and 161 of the subsequent fetch line to “0”. When the instruction fetch line valid bit portion 161 is reset to “0”, the discarded instruction is not executed. Note that the initial values of the instruction fetch line valid bit units 160 and 161 are set to “1”.

(装置の動作の説明)
次に、上述した分岐予測装置を備えるプロセッサの動作について説明する。
まず、命令フェッチアドレス部130はパイプライン動作の各サイクルで命令キャッシュ140に対して命令フェッチ要求を出力する。また、命令フェッチアドレス部130は分岐予測要求を出力する。命令フェッチ要求、分岐予測要求が出力されると、以下の(ア)、(イ)の処理が並行して実行される。
(Explanation of device operation)
Next, the operation of a processor including the above branch prediction apparatus will be described.
First, the instruction fetch address unit 130 outputs an instruction fetch request to the instruction cache 140 in each cycle of the pipeline operation. The instruction fetch address unit 130 outputs a branch prediction request. When an instruction fetch request and a branch prediction request are output, the following processes (a) and (b) are executed in parallel.

(ア)命令キャッシュ部140は命令フェッチ要求に対応して命令フェッチアドレス部130の値に基づいて命令フェッチを行い、得られた命令情報を命令デコード部150に出力する。命令キャッシュ部140の動作は、命令キャッシュメモリの動作として周知の技術が使用されているのでその説明を省略する。   (A) The instruction cache unit 140 performs an instruction fetch based on the value of the instruction fetch address unit 130 in response to the instruction fetch request, and outputs the obtained instruction information to the instruction decoding unit 150. The operation of the instruction cache unit 140 uses a well-known technique as the operation of the instruction cache memory, and a description thereof will be omitted.

(イ)分岐予測部100、101、及び102は分岐予測要求を受け取ると、異なるタイミングで予測結果を出力する。予測結果選択部120は分岐予測部100、101、及び102が出力した予測結果を適宜選択して命令フェッチアドレス部130に反映する。矛盾検出部110、111は選択結果に応じて不要な命令フェッチ結果を破棄するように予測結果選択部120に指示をする
(A) Upon receiving a branch prediction request, the branch prediction units 100, 101, and 102 output prediction results at different timings . The prediction result selection unit 120 appropriately selects the prediction results output from the branch prediction units 100, 101, and 102 and reflects them in the instruction fetch address unit 130. The contradiction detection units 110 and 111 instruct the prediction result selection unit 120 to discard an unnecessary instruction fetch result according to the selection result .

更に、図2のフローチャートを参照して、上記動作(イ)の命令フェッチアドレスの決定と命令フェッチ結果の破棄の判定の動作(矛盾検出の動作)について説明する。
同図に示すように、パイプライン動作が開始されると、矛盾検出部110及び111等からなる矛盾検出手段は分岐予測部100〜102の各出力を監視する(ステップS10)。
Further, with reference to the flowchart of FIG. 2, the operation (a) of determining the instruction fetch address and determining the discard of the instruction fetch result (contradictory detection operation) will be described.
As shown in the figure, when the pipeline operation is started, the contradiction detection means including the contradiction detection units 110 and 111 monitors the outputs of the branch prediction units 100 to 102 (step S10).

矛盾検出手段は、(1) 矛盾検出部111において分岐予測部101と102の各出力が一致し(ステップS12;Yes)、矛盾検出部110において分岐予測部100と101の各出力が一致している場合(ステップS14;Yes)、予測結果選択部120に第一の分岐予測部100の出力を選択させ、命令アドレス部130に設定する(ステップS16)。   Contradiction detection means: (1) In the contradiction detection unit 111, the outputs of the branch prediction units 101 and 102 match (step S12; Yes), and in the contradiction detection unit 110, the outputs of the branch prediction units 100 and 101 match. If so (step S14; Yes), the prediction result selection unit 120 selects the output of the first branch prediction unit 100 and sets it in the instruction address unit 130 (step S16).

矛盾検出手段は、(2) 矛盾検出部111において分岐予測部101と102の各出力が一致し(ステップS12;Yes)、矛盾検出部110において分岐予測部100と101の各出力が一致しない場合(ステップS14;No)、予測結果選択部120に第二の分岐予測部101の出力を選択させ、命令アドレス部130に設定する。同時に後続のフェッチした命令を破棄すべく、命令フェチライン有効ビット部160及び161を“0”に設定する(ステップS20)。   The contradiction detection means: (2) When the outputs of the branch prediction units 101 and 102 match in the contradiction detection unit 111 (step S12; Yes), and the outputs of the branch prediction units 100 and 101 do not match in the contradiction detection unit 110 (Step S <b> 14; No), the prediction result selection unit 120 selects the output of the second branch prediction unit 101 and sets it in the instruction address unit 130. At the same time, the instruction fetch line valid bit sections 160 and 161 are set to “0” in order to discard the subsequent fetched instruction (step S20).

また、矛盾検出手段は、(3) 矛盾検出部111において分岐予測部101と102の各出力が一致しない場合(ステップS12;No)、予測結果選択部120に第三の分岐予測部102の出力を選択させ、命令アドレス部130に設定する。同時に後続のフェッチした命令を破棄すべく、命令フェチライン有効ビット部160を“0”に設定する(ステップS18)。
分岐予測装置は、このような分岐予測の処理(ステップS10〜S20)を繰り返す。
Further, the contradiction detection means (3) when the outputs of the branch prediction units 101 and 102 do not match in the conflict detection unit 111 (step S12; No), the output of the third branch prediction unit 102 to the prediction result selection unit 120 Is selected and set in the instruction address section 130. At the same time, the instruction fetch line valid bit unit 160 is set to “0” in order to discard the subsequent fetched instruction (step S18).
The branch prediction apparatus repeats such branch prediction processing (steps S10 to S20).

(具体例)
次に、図3及び図4に示すタイミングチャートを参照して、本発明の分岐予測装置の命令フェッチ動作により選択される命令アドレスの例について説明する。図3は分岐予測部100乃至102の各予測アドレスが一致する場合の例を示している。図4は、分岐予測部100と101との間、分岐予測部101と102との間で予測アドレスの不一致が生じる場合(分岐予測部間で予測アドレスの不一致が発生する場合)の例を示している。両図の横軸は時間軸であり、クロック信号T0乃至T10に従って処理のステージが進む。
(Concrete example)
Next, an example of an instruction address selected by the instruction fetch operation of the branch predicting apparatus of the present invention will be described with reference to timing charts shown in FIGS. FIG. 3 shows an example when the prediction addresses of the branch prediction units 100 to 102 match. FIG. 4 shows an example of a case where a prediction address mismatch occurs between the branch prediction units 100 and 101 and a prediction address between the branch prediction units 101 and 102 (a case where a prediction address mismatch occurs between the branch prediction units). ing. The horizontal axis in both figures is the time axis, the stage of the process proceeds in accordance with the clock signal T0 through T10.

(命令フェッチ動作の概略)
まず、命令フェッチ処理は命令フェッチアドレスを用いて開始される。時刻T0では所定の命令フェッチアドレスを用いて命令キャッシュに対して命令フェッチ指示を出力する。時刻T0では平行して、第一、第二、第三の分岐予測手段に対して命令フェッチアドレスを出力する。
(Outline of instruction fetch operation)
First, the instruction fetch process is started using the instruction fetch address. At time T0, an instruction fetch instruction is output to the instruction cache using a predetermined instruction fetch address. At time T0, the instruction fetch address is output to the first, second, and third branch prediction units in parallel.

第一の分岐予測手段は時刻T0から時刻T1の間に次の命令フェッチアドレスを計算し出力する。命令フェッチアドレス部ではこの結果を時刻T1の命令フェッチアドレスとして反映する。   The first branch predicting means calculates and outputs the next instruction fetch address between time T0 and time T1. The instruction fetch address part reflects this result as the instruction fetch address at time T1.

第二の分岐予測手段は、時刻T1から時刻T2の間で、時刻T0に開始した分岐予測結果を出力する。この結果は時刻T1の第一の分岐予測手段の出力と一致していると仮定する。この場合、後続の命令のフェッチは継続される。時刻T1では並行して、第一、第二、第三の分岐予測手段に対して命令フェッチアドレスを出力する。   The second branch prediction means outputs the branch prediction result started at time T0 between time T1 and time T2. It is assumed that this result matches the output of the first branch predicting means at time T1. In this case, the fetch of subsequent instructions is continued. In parallel with time T1, the instruction fetch address is output to the first, second and third branch prediction means.

時刻T1から時刻T2の間では、第一の分岐予測手段が時刻T2のための命令フェッチアドレスを出力する。この場合、図2のフローチャートに従って第一の分岐予測手段の結果が時刻T2のための命令フェッチアドレスとして反映される。   Between time T1 and time T2, the first branch prediction means outputs an instruction fetch address for time T2. In this case, the result of the first branch predicting means is reflected as the instruction fetch address for time T2 in accordance with the flowchart of FIG.

第三の分岐予測手段は、時刻T2から時刻T3の間で、時刻T0に開始した分岐予測結果を出力する。この結果は時刻T1から時刻T2に出力された第二の分岐予測手段の出力と一致していると仮定する。この場合、後続の命令フェッチは継続される。   The third branch prediction means outputs a branch prediction result started at time T0 between time T2 and time T3. It is assumed that this result matches the output of the second branch predicting means output from time T1 to time T2. In this case, the subsequent instruction fetch is continued.

時刻T2から時刻T3の間では、第二の分岐予測手段が時刻T1に開始した分岐予測結果を出力する。この結果が時刻T2で得られた第一の分岐予測手段と異なるため(図4の例)、後続の命令フェッチ有効ビットがリセットされる。
時刻T3の命令フェッチアドレスには、第二の分岐予測手段の出力結果が反映される。
Between time T2 and time T3, the second branch prediction means outputs the branch prediction result started at time T1. Since this result is different from the first branch prediction means obtained at time T2 (example in FIG. 4), the subsequent instruction fetch valid bit is reset.
The output result of the second branch predicting means is reflected in the instruction fetch address at time T3.

時刻T3から時刻T4では第三の分岐予測手段が時刻T1に開始した分岐予測結果を出力する。この結果が時刻T2に得られた第二の分岐予測結果と一致していないため、後続の命令フェッチは破棄される。   From time T3 to time T4, the third branch prediction means outputs the branch prediction result started at time T1. Since this result does not match the second branch prediction result obtained at time T2, the subsequent instruction fetch is discarded.

時刻T7は第二の分岐予測手段の出力と第三の分岐予測手段の矛盾した例(図4の例)である。アドレスC5が次のフェッチアドレスとして選択され、命令フェッチアドレスとして利用される。   Time T7 is an inconsistent example between the output of the second branch prediction means and the third branch prediction means (example of FIG. 4). Address C5 is selected as the next fetch address and is used as the instruction fetch address.

(予測アドレスが一致する場合の例)
まず、予測アドレスが一致する場合について説明すると、図3に示すように、時刻T0において、命令フェッチアドレス部130は命令フェッチアドレスA0を用いて命令キャッシュ部140に対して命令フェッチ指示を出力する。また、同時に、第一の分岐予測部100、第二の分岐予測部101、第三の分岐予測部102に対して命令フェッチアドレスA0を出力する。なお、命令フェッチライン有効ビット部160、161の初期値は“1”である。
(Example when predicted addresses match)
First, the case where the predicted addresses match will be described. As shown in FIG. 3, at time T0, the instruction fetch address unit 130 outputs an instruction fetch instruction to the instruction cache unit 140 using the instruction fetch address A0. At the same time, the instruction fetch address A0 is output to the first branch prediction unit 100, the second branch prediction unit 101, and the third branch prediction unit 102. Note that the initial values of the instruction fetch line valid bit sections 160 and 161 are “1”.

時刻T0から時刻T1の間において、分岐予測部100は次の命令フェッチアドレスA1を計算し出力する。分岐予測部101及び102はまだ予測アドレスを出力しない。予測結果選択部120は分岐予測部100が出力したアドレスA1を選択をする。   Between time T0 and time T1, the branch prediction unit 100 calculates and outputs the next instruction fetch address A1. The branch prediction units 101 and 102 do not output a prediction address yet. The prediction result selection unit 120 selects the address A1 output by the branch prediction unit 100.

時刻T1において、命令フェッチアドレス部130は命令フェッチアドレスとしてアドレスA1を反映する。   At time T1, the instruction fetch address unit 130 reflects the address A1 as the instruction fetch address.

時刻T1から時刻T2の間において、命令フェッチアドレス部130はアドレスA1を命令キャッシュ部140、分岐予測部100〜102に出力する。分岐予測部100は次の予測アドレスA2を出力する。分岐予測部101は時刻T0に開始した分岐予測結果(アドレスA1)を出力する。分岐予測部102はまだ予測アドレスの出力を発生しない。矛盾検出部110は分岐予測部101の予測アドレスA1と分岐予測部100の前回の予測アドレスA1が一致したことを判別する。予測結果選択部120は分岐予測部100が出力したアドレスA2を選択する。   Between time T1 and time T2, the instruction fetch address unit 130 outputs the address A1 to the instruction cache unit 140 and the branch prediction units 100 to 102. The branch prediction unit 100 outputs the next prediction address A2. The branch prediction unit 101 outputs the branch prediction result (address A1) started at time T0. The branch prediction unit 102 does not generate a prediction address yet. The contradiction detection unit 110 determines that the prediction address A1 of the branch prediction unit 101 matches the previous prediction address A1 of the branch prediction unit 100. The prediction result selection unit 120 selects the address A2 output by the branch prediction unit 100.

時刻T2において、命令フェッチアドレス部130は命令フェッチアドレスとしてアドレスA2を反映する。また、矛盾検出部110の一致判別出力により命令フェッチライン有効ビット部160は“1”が維持され、アドレスA1は破棄されない(維持される)。   At time T2, the instruction fetch address unit 130 reflects the address A2 as the instruction fetch address. Further, “1” is maintained in the instruction fetch line valid bit unit 160 by the match determination output of the contradiction detection unit 110, and the address A1 is not discarded (maintained).

時刻T2から時刻T3の間において、命令フェッチアドレス部130はアドレスA2を命令キャッシュ部140、分岐予測部100〜102に出力する。分岐予測部100は次の予測アドレスA3を出力する。分岐予測部101は分岐予測結果(アドレスA2)を出力する。分岐予測部102は予測アドレスA1を出力する。矛盾検出部110は分岐予測部101の予測アドレスA2と分岐予測部100の前回の予測アドレスA2との一致を判別する。また、矛盾検出部111は分岐予測部102の予測アドレスA1と分岐予測部101の前回の予測アドレスA1との一致を判別する。予測結果選択部120は分岐予測部100が出力したアドレスA3を選択をする。   Between time T2 and time T3, the instruction fetch address unit 130 outputs the address A2 to the instruction cache unit 140 and the branch prediction units 100 to 102. The branch prediction unit 100 outputs the next prediction address A3. The branch prediction unit 101 outputs a branch prediction result (address A2). The branch prediction unit 102 outputs the prediction address A1. The contradiction detection unit 110 determines whether the prediction address A2 of the branch prediction unit 101 matches the previous prediction address A2 of the branch prediction unit 100. Further, the contradiction detection unit 111 determines whether the prediction address A1 of the branch prediction unit 102 matches the previous prediction address A1 of the branch prediction unit 101. The prediction result selection unit 120 selects the address A3 output by the branch prediction unit 100.

時刻T3において、命令フェッチアドレス部130は命令フェッチアドレスとしてアドレスA3を反映する。また、矛盾検出部110の一致判別出力により命令フェッチライン有効ビット部160は“1”となり、アドレスA2は破棄されない(維持される)。また、矛盾検出部111の一致判別出力により命令フェッチライン有効ビット部160、161は“1”が維持され、アドレスA0、アドレスA1は破棄されない(維持される)。それにより、命令アドレスA0、A1の実行結果は破棄されない。   At time T3, the instruction fetch address unit 130 reflects the address A3 as the instruction fetch address. Further, the instruction fetch line valid bit unit 160 is set to “1” by the match determination output of the contradiction detection unit 110, and the address A2 is not discarded (maintained). Further, the instruction fetch line valid bit units 160 and 161 are maintained at “1” by the match determination output of the contradiction detection unit 111, and the addresses A0 and A1 are not discarded (maintained). As a result, the execution results of the instruction addresses A0 and A1 are not discarded.

時刻T3から時刻T4の間において、命令フェッチアドレス部130はアドレスA3を命令キャッシュ部140、分岐予測部100〜102に出力する。分岐予測部100は次の予測アドレスA4を出力する。分岐予測部101はアドレスA3を出力する。分岐予測部102は予測アドレスA2を出力する。矛盾検出部110は分岐予測部101の予測アドレスA3と分岐予測部100の前回の予測アドレスA3との一致を判別する。また、矛盾検出部111は分岐予測部102の予測アドレスA2と分岐予測部101の前回の予測アドレスA2との一致を判別する。予測結果選択部120は分岐予測部100が出力したアドレスA4を選択をする。   Between time T3 and time T4, the instruction fetch address unit 130 outputs the address A3 to the instruction cache unit 140 and the branch prediction units 100 to 102. The branch prediction unit 100 outputs the next prediction address A4. The branch prediction unit 101 outputs the address A3. The branch prediction unit 102 outputs the prediction address A2. The contradiction detection unit 110 determines whether the prediction address A3 of the branch prediction unit 101 matches the previous prediction address A3 of the branch prediction unit 100. The contradiction detection unit 111 determines whether the prediction address A2 of the branch prediction unit 102 matches the previous prediction address A2 of the branch prediction unit 101. The prediction result selection unit 120 selects the address A4 output by the branch prediction unit 100.

時刻T4において、命令フェッチアドレス部130は命令フェッチアドレスとしてアドレスA4を反映する。また、矛盾検出部110の一致判別出力により命令フェッチライン有効ビット部160は“1”が維持され、アドレスA3は破棄されない(維持される)。また、矛盾検出部111の一致判別出力により命令フェッチライン有効ビット部160、161は“1”が維持され、アドレスA1、アドレスA2は破棄されない(維持される)。それにより、命令アドレスA1、A2の実行結果は破棄されない。   At time T4, the instruction fetch address unit 130 reflects the address A4 as the instruction fetch address. Further, the instruction fetch line effective bit unit 160 is maintained at “1” by the coincidence determination output of the contradiction detection unit 110, and the address A3 is not discarded (maintained). Further, the instruction fetch line valid bit units 160 and 161 are maintained at “1” by the match determination output of the contradiction detection unit 111, and the addresses A1 and A2 are not discarded (maintained). As a result, the execution results of the instruction addresses A1 and A2 are not discarded.

同様の処理が繰り返されて、図3に示すように命令アドレスA0〜A9、…がフェッチされる。
このように、出力が遅延する第三の分岐予測部102の予測結果を待たずに処理を行うので演算時間が短縮される。
Similar processing is repeated, and the instruction addresses A0 to A9,... Are fetched as shown in FIG.
In this way, the processing is performed without waiting for the prediction result of the third branch prediction unit 102 whose output is delayed, so that the calculation time is shortened.

(予測アドレスが一致しない場合の例)
次に、図4を参照して分岐予測部間で予測アドレスの不一致が生じる場合について説明する。前述したように、予測時間の短い分岐予測部よりも予測時間の長い分岐予測部の方が予測精度が高いものである。
(Example when predicted addresses do not match)
Next, with reference to FIG. 4, the case where the prediction address mismatch occurs between the branch prediction units will be described. As described above, a branch prediction unit with a long prediction time has higher prediction accuracy than a branch prediction unit with a short prediction time.

まず、時刻T0において、命令フェッチアドレス部130は命令フェッチアドレスA0を用いて命令キャッシュ部140に対して命令フェッチ指示を出力する。また、同時に第一の分岐予測部100、第二の分岐予測部101、第三の分岐予測部102に対して命令フェッチアドレスA0を出力する。   First, at time T0, the instruction fetch address unit 130 outputs an instruction fetch instruction to the instruction cache unit 140 using the instruction fetch address A0. At the same time, the instruction fetch address A0 is output to the first branch prediction unit 100, the second branch prediction unit 101, and the third branch prediction unit 102.

時刻T0から時刻T1の間において、分岐予測部100は次の命令フェッチアドレスA1を計算し出力する。分岐予測部101及び102はまだ出力を発生しない。予測結果選択部120は分岐予測部100が出力したアドレスA1を選択する。なお、命令フェッチライン有効ビット部160、161は“1”が初期設定されている。   Between time T0 and time T1, the branch prediction unit 100 calculates and outputs the next instruction fetch address A1. The branch prediction units 101 and 102 have not yet generated an output. The prediction result selection unit 120 selects the address A1 output by the branch prediction unit 100. Note that the instruction fetch line valid bit sections 160 and 161 are initially set to “1”.

時刻T1において、命令フェッチアドレス部130は命令フェッチアドレスとしてアドレスA1を反映する。   At time T1, the instruction fetch address unit 130 reflects the address A1 as the instruction fetch address.

時刻T1から時刻T2の間において、命令フェッチアドレス部130はアドレスA1を命令キャッシュ部140、分岐予測部100〜102に出力する。分岐予測部100は予測アドレスA2を出力する。分岐予測部101は時刻T0に開始した分岐予測結果(アドレスA1)を出力する。分岐予測部102はまだ予測アドレスの出力を発生しない。矛盾検出部110は分岐予測部101の予測アドレスA1と分岐予測部100の前回の予測アドレスA1との一致を判別する。予測結果選択部120は分岐予測部100が出力したアドレスA2を選択する。   Between time T1 and time T2, the instruction fetch address unit 130 outputs the address A1 to the instruction cache unit 140 and the branch prediction units 100 to 102. The branch prediction unit 100 outputs the prediction address A2. The branch prediction unit 101 outputs the branch prediction result (address A1) started at time T0. The branch prediction unit 102 does not generate a prediction address yet. The contradiction detection unit 110 determines whether the prediction address A1 of the branch prediction unit 101 matches the previous prediction address A1 of the branch prediction unit 100. The prediction result selection unit 120 selects the address A2 output by the branch prediction unit 100.

時刻T2において、命令フェッチアドレス部130は命令フェッチアドレスとしてアドレスA2を反映する。また、矛盾検出部110の一致判別出力により命令フェッチライン有効ビット部160は“1”が維持され、アドレスA1は破棄されない(維持される)。   At time T2, the instruction fetch address unit 130 reflects the address A2 as the instruction fetch address. Further, “1” is maintained in the instruction fetch line valid bit unit 160 by the match determination output of the contradiction detection unit 110, and the address A1 is not discarded (maintained).

時刻T2から時刻T3の間において、命令フェッチアドレス部130はアドレスA2を命令キャッシュ部140、分岐予測部100〜102に出力する。分岐予測部100は次の予測アドレスA3を出力する。ここで、分岐予測部101は分岐予測結果としてアドレスB2を出力すると仮定する。分岐予測部102は予測アドレスA1を出力する。矛盾検出部110は、分岐予測部101の予測アドレスB2と分岐予測部100の前回の予測アドレスA2とが一致しないので不一致を判別する。また、矛盾検出部111は、分岐予測部102の予測アドレスA1と分岐予測部101の前回の予測アドレスA1との一致を判別する。予測結果選択部120は分岐予測部101が出力したアドレスB2を選択する。   Between time T2 and time T3, the instruction fetch address unit 130 outputs the address A2 to the instruction cache unit 140 and the branch prediction units 100 to 102. The branch prediction unit 100 outputs the next prediction address A3. Here, it is assumed that the branch prediction unit 101 outputs the address B2 as the branch prediction result. The branch prediction unit 102 outputs the prediction address A1. The contradiction detection unit 110 determines a mismatch because the prediction address B2 of the branch prediction unit 101 and the previous prediction address A2 of the branch prediction unit 100 do not match. Further, the contradiction detection unit 111 determines whether the prediction address A1 of the branch prediction unit 102 matches the previous prediction address A1 of the branch prediction unit 101. The prediction result selection unit 120 selects the address B2 output by the branch prediction unit 101.

時刻T3において、命令フェッチアドレス部130は命令フェッチアドレスとしてアドレスB2を反映する。また、矛盾検出部110は、分岐予測部100の出力(アドレスA2)と分岐予測部101の出力(アドレスB2)が一致しないので命令フェッチライン有効ビット部160に“0”を設定する。アドレスA2の処理は破棄される。また、矛盾検出部111は、分岐予測部102の予測アドレスA1と分岐予測部101の前回の予測アドレスA1とが一致したので命令フェッチライン有効ビット部161の“1”を維持する。アドレスA1は破棄されない(維持される)。それにより、命令アドレスA1の内容の実行結果は破棄されない。   At time T3, the instruction fetch address unit 130 reflects the address B2 as the instruction fetch address. Further, the contradiction detection unit 110 sets “0” in the instruction fetch line valid bit unit 160 because the output (address A2) of the branch prediction unit 100 and the output (address B2) of the branch prediction unit 101 do not match. The processing at address A2 is discarded. Further, the contradiction detection unit 111 maintains “1” in the instruction fetch line valid bit unit 161 because the prediction address A1 of the branch prediction unit 102 matches the previous prediction address A1 of the branch prediction unit 101. The address A1 is not discarded (maintained). As a result, the execution result of the contents of the instruction address A1 is not discarded.

時刻T3から時刻T4の間において、命令フェッチアドレス部130はアドレスB2を命令キャッシュ部140、分岐予測部100〜102に出力する。分岐予測部100は次の予測アドレスA4を出力する。分岐予測部101はまだアドレスを出力しない。ここで、分岐予測部102が予測アドレスC2を出力すると仮定する。矛盾検出部111は、分岐予測部102の予測アドレスC2と分岐予測部101の前回の予測アドレスB2との不一致を判別する。予測結果選択部120は分岐予測部102が出力したアドレスC2を選択する。   Between time T3 and time T4, the instruction fetch address unit 130 outputs the address B2 to the instruction cache unit 140 and the branch prediction units 100 to 102. The branch prediction unit 100 outputs the next prediction address A4. The branch prediction unit 101 does not output an address yet. Here, it is assumed that the branch prediction unit 102 outputs the prediction address C2. The contradiction detection unit 111 determines a mismatch between the prediction address C2 of the branch prediction unit 102 and the previous prediction address B2 of the branch prediction unit 101. The prediction result selection unit 120 selects the address C2 output by the branch prediction unit 102.

時刻T4において、命令フェッチアドレス部130は命令フェッチアドレスとしてアドレスC2を反映する。また、矛盾検出部111は、分岐予測部102の出力(予測アドレスC2)と分岐予測部101の出力(B2)が一致しないので命令フェッチライン有効ビット部160及び161を共に“0”にリセットする。それにより、命令アドレスA2、B2の内容の実行結果は破棄される。   At time T4, the instruction fetch address unit 130 reflects the address C2 as the instruction fetch address. The contradiction detecting unit 111 resets both the instruction fetch line valid bit units 160 and 161 to “0” because the output of the branch prediction unit 102 (predicted address C2) and the output of the branch prediction unit 101 (B2) do not match. . As a result, the execution results of the contents of the instruction addresses A2 and B2 are discarded.

時刻T4から時刻T5の間において、命令フェッチアドレス部130はアドレスC2を命令キャッシュ部140、分岐予測部100〜102に出力する。分岐予測部100は次の予測アドレスA5を出力する。分岐予測部101はまだ予測アドレスを出力しない。分岐予測部102も予測アドレスを出力しない。   Between time T4 and time T5, the instruction fetch address unit 130 outputs the address C2 to the instruction cache unit 140 and the branch prediction units 100 to 102. The branch prediction unit 100 outputs the next prediction address A5. The branch prediction unit 101 does not yet output a prediction address. The branch prediction unit 102 also does not output a prediction address.

時刻T5において、命令フェッチアドレス部130は命令フェッチアドレスとしてアドレスA5を反映する。命令フェッチライン有効ビット部160は“1”にセットされ、命令フェッチライン有効ビット部161は命令フェッチライン有効ビット部160の前回の“0”出力を取り込んで“0”を維持する。   At time T5, the instruction fetch address unit 130 reflects the address A5 as the instruction fetch address. The instruction fetch line valid bit unit 160 is set to “1”, and the instruction fetch line valid bit unit 161 captures the previous “0” output of the instruction fetch line valid bit unit 160 and maintains “0”.

時刻T5から時刻T6の間において、命令フェッチアドレス部130はアドレスA5を命令キャッシュ部140、分岐予測部100〜102に出力する。分岐予測部100は次の予測アドレスA6を出力する。分岐予測部101は予測アドレスA5を出力する。分岐予測部102は予測アドレスをまだ出力しない。矛盾検出部110は、分岐予測部101の出力(アドレスA5)と分岐予測部100の前回の出力(アドレスA5)との一致を判別する。   Between time T5 and time T6, the instruction fetch address unit 130 outputs the address A5 to the instruction cache unit 140 and the branch prediction units 100 to 102. The branch prediction unit 100 outputs the next prediction address A6. The branch prediction unit 101 outputs the prediction address A5. The branch prediction unit 102 does not yet output a prediction address. The contradiction detection unit 110 determines a match between the output of the branch prediction unit 101 (address A5) and the previous output (address A5) of the branch prediction unit 100.

時刻T6において、命令フェッチアドレス部130は命令フェッチアドレスとしてアドレスA6を反映する。また、矛盾検出部110は、分岐予測部100の出力(アドレスA5)と分岐予測部101の出力(アドレスA5)が一致するので命令フェッチライン有効ビット部160の“1”を維持する。命令フェッチライン有効ビット部161は命令フェッチライン有効ビット部160の前回の“1”出力を取り込んで“1”に設定される。   At time T6, the instruction fetch address unit 130 reflects the address A6 as the instruction fetch address. The contradiction detection unit 110 maintains “1” in the instruction fetch line valid bit unit 160 because the output (address A5) of the branch prediction unit 100 matches the output (address A5) of the branch prediction unit 101. The instruction fetch line valid bit portion 161 takes in the previous “1” output of the instruction fetch line valid bit portion 160 and is set to “1”.

時刻T6からT7の間において、命令フェッチアドレス部130はアドレスA6を命令キャッシュ部140、分岐予測部100〜102に出力する。分岐予測部100は次の予測アドレスA7を出力する。分岐予測部101はアドレスA6を出力する。ここで、分岐予測部102が予測アドレスC5を出力すると仮定する。矛盾検出部111は、分岐予測部102の予測アドレスC5と分岐予測部101の前回の予測アドレスA5との不一致を判別する。予測結果選択部120は分岐予測部102が出力したアドレスC5を選択する。   Between times T6 and T7, the instruction fetch address unit 130 outputs the address A6 to the instruction cache unit 140 and the branch prediction units 100 to 102. The branch prediction unit 100 outputs the next prediction address A7. The branch prediction unit 101 outputs an address A6. Here, it is assumed that the branch prediction unit 102 outputs the prediction address C5. The contradiction detection unit 111 determines a mismatch between the prediction address C5 of the branch prediction unit 102 and the previous prediction address A5 of the branch prediction unit 101. The prediction result selection unit 120 selects the address C5 output by the branch prediction unit 102.

時刻T7において、命令フェッチアドレス部130は命令フェッチアドレスとしてアドレスC5を反映する。また、矛盾検出部111の不一致出力は、命令フェッチライン有効ビット部160及び161を共に“0”にリセットする。それにより、命令アドレスA5、A6の内容の実行結果は破棄される。   At time T7, the instruction fetch address unit 130 reflects the address C5 as the instruction fetch address. Inconsistency output from the contradiction detection unit 111 resets both the instruction fetch line valid bit units 160 and 161 to “0”. As a result, the execution result of the contents of the instruction addresses A5 and A6 is discarded.

時刻T7から時刻T8の間において、命令フェッチアドレス部130はアドレスC5を命令キャッシュ部140、分岐予測部100〜102に出力する。分岐予測部100は次の予測アドレスA8を出力する。分岐予測部101はまだ予測アドレスを出力しない。分岐予測部102も予測アドレスを出力しない。   Between time T7 and time T8, the instruction fetch address unit 130 outputs the address C5 to the instruction cache unit 140 and the branch prediction units 100 to 102. The branch prediction unit 100 outputs the next prediction address A8. The branch prediction unit 101 does not yet output a prediction address. The branch prediction unit 102 also does not output a prediction address.

時刻T8において、命令フェッチアドレス部130は命令フェッチアドレスとしてアドレスA8を反映する。命令フェッチライン有効ビット部160は“1”にセットされ、命令フェッチライン有効ビット部161は命令フェッチライン有効ビット部160の前回の“0”出力を取り込んで“0”を維持する。   At time T8, the instruction fetch address unit 130 reflects the address A8 as the instruction fetch address. The instruction fetch line valid bit unit 160 is set to “1”, and the instruction fetch line valid bit unit 161 captures the previous “0” output of the instruction fetch line valid bit unit 160 and maintains “0”.

時刻T8から時刻T9の間において、命令フェッチアドレス部130はアドレスA8を命令キャッシュ部140、分岐予測部100〜102に出力する。分岐予測部100は次の予測アドレスA9を出力する。分岐予測部101は予測アドレスA8を出力する。分岐予測部102は予測アドレスをまだ出力しない。矛盾検出部110は、分岐予測部101の出力(アドレスA8)と分岐予測部100の前回の出力(アドレスA8)との一致を判別する。   Between time T8 and time T9, the instruction fetch address unit 130 outputs the address A8 to the instruction cache unit 140 and the branch prediction units 100 to 102. The branch prediction unit 100 outputs the next prediction address A9. The branch prediction unit 101 outputs the prediction address A8. The branch prediction unit 102 does not yet output a prediction address. The contradiction detection unit 110 determines a match between the output of the branch prediction unit 101 (address A8) and the previous output of the branch prediction unit 100 (address A8).

時刻T9において、命令フェッチアドレス部130は命令フェッチアドレスとしてアドレスA9を反映する。また、矛盾検出部110は、分岐予測部100の前回出力(アドレスA8)と分岐予測部101の出力(アドレスA8)が一致するので命令フェッチライン有効ビット部160の“1”を維持する。命令フェッチライン有効ビット部161は命令フェッチライン有効ビット部160の前回の“1”出力を取り込んで“1”に設定される。   At time T9, the instruction fetch address unit 130 reflects the address A9 as the instruction fetch address. The contradiction detection unit 110 maintains “1” in the instruction fetch line valid bit unit 160 because the previous output (address A8) of the branch prediction unit 100 matches the output (address A8) of the branch prediction unit 101. The instruction fetch line valid bit portion 161 takes in the previous “1” output of the instruction fetch line valid bit portion 160 and is set to “1”.

時刻T9からT10の間において、命令フェッチアドレス部130はアドレスA9を命令キャッシュ部140、分岐予測部100〜102に出力する。分岐予測部100は次の予測アドレスA10を出力する。分岐予測部101はアドレスA9を出力する。分岐予測部102が予測アドレスA8を出力する。矛盾検出部111は、分岐予測部102の予測アドレスA8と分岐予測部101の前回の予測アドレスA8との一致を判別する。予測結果選択部120は分岐予測部102が出力したアドレスA8を選択する。   Between times T9 and T10, the instruction fetch address unit 130 outputs the address A9 to the instruction cache unit 140 and the branch prediction units 100 to 102. The branch prediction unit 100 outputs the next prediction address A10. The branch prediction unit 101 outputs an address A9. The branch prediction unit 102 outputs the prediction address A8. The contradiction detection unit 111 determines whether the prediction address A8 of the branch prediction unit 102 matches the previous prediction address A8 of the branch prediction unit 101. The prediction result selection unit 120 selects the address A8 output by the branch prediction unit 102.

時刻T10において、命令フェッチアドレス部130は命令フェッチアドレスとしてアドレスA10を反映する。   At time T10, the instruction fetch address unit 130 reflects the address A10 as the instruction fetch address.

以下、同様の処理が繰り返されて、図4に示すように命令アドレスA0、A1、C2、C5、A8、A9、A10、…がフェッチされる。
このように、出力が遅延する第三の分岐予測部102の予測結果を待たずに処理を行うので演算時間(予測レイテンシ)が短縮される。
Thereafter, the same processing is repeated, and the instruction addresses A0, A1, C2, C5, A8, A9, A10,... Are fetched as shown in FIG.
As described above, the processing is performed without waiting for the prediction result of the third branch prediction unit 102 whose output is delayed, so that the calculation time (prediction latency) is shortened.

(実施例の効果)
図5を参照して実施例の構成による予測例について説明する。例えば、図1に示す例において、第一の分岐予測手段が70%の精度、第二の分岐予測手段が90%の精度、第三の分岐予測手段が95%の精度であった場合、平均のレイテンシは図5の結果から1.54となる。第三の分岐予測手段のレイテンは3サイクルであるため、予測精度を維持しながら約2倍の高速化が実現できる。
(Effect of Example)
A prediction example according to the configuration of the embodiment will be described with reference to FIG. For example, in the example shown in FIG. 1, when the first branch predicting means has an accuracy of 70%, the second branch predicting means has an accuracy of 90%, and the third branch predicting means has an accuracy of 95%, the average The latency is 1.54 from the result of FIG. Since the latency of the third branch predicting means is 3 cycles, the speed can be increased by about twice while maintaining the prediction accuracy.

以上説明しように本発明の実施形態によれば、高精度の分岐予測手段を採用した場合に問題となるパイプラインバブルの発生を抑制することができる。
例えば、単純に第三の分岐予測手段のみを採用すると、時刻T1で得られた分岐予測結果(アドレスA1への分岐)が時刻T3まで得られない。逆に、第一の分岐予測手段のみを採用すると、時刻T2で得られた分岐予測結果の予測成功率は80%程度なので高い確率で命令の実行が失敗する。
As described above, according to the embodiment of the present invention, it is possible to suppress the occurrence of pipeline bubbles that become a problem when a highly accurate branch prediction unit is employed.
For example, if only the third branch prediction means is employed, the branch prediction result (branch to address A1) obtained at time T1 cannot be obtained until time T3. On the contrary, if only the first branch prediction means is employed, the instruction success rate of the branch prediction result obtained at time T2 is about 80%, so the instruction execution fails with a high probability.

本発明を採用することにより高い予測精度を実質的に短いレイテンシで計算でき、命令フェッチパイプラインの効率化が実現できる。   By adopting the present invention, high prediction accuracy can be calculated with substantially short latency, and the efficiency of the instruction fetch pipeline can be realized.

なお、上記発明の実施の形態を通じて説明された実施例や応用例は、用途に応じて適宜に組み合わせて、又は変更若しくは改良を加えて用いることができ、本発明は上述した実施形態の記載に限定されるものではない。そのような組み合わせ又は変更若しくは改良を加えた形態も本発明の技術的範囲に含まれ得ることが、特許請求の範囲の記載から明らかである。   It should be noted that the examples and application examples described through the above-described embodiments of the present invention can be used in combination as appropriate according to the application, or can be used with modifications or improvements. The present invention is described in the description of the above-described embodiments. It is not limited. It is apparent from the description of the scope of claims that the embodiments added with such combinations or changes or improvements can be included in the technical scope of the present invention.

(産業上の利用の可能性)
本発明は高性能なプロセッサに適用できる。特に、深いパイプラインを持つプロセッサに有効である。
(Possibility of industrial use)
The present invention can be applied to a high-performance processor. This is especially effective for processors with deep pipelines.

100 第一の分岐予測部(手段)、101 第二の分岐予測部(手段)、102 第三の分岐予測部(手段)、110,111 矛盾検出部120 予測結果選択部、130命令フェッチアドレス部、140 命令キャッシュ部、160,161 命令フェッチライン有効ビット部、170 命令実行ユニット部 DESCRIPTION OF SYMBOLS 100 1st branch prediction part (means), 101 2nd branch prediction part (means), 102 3rd branch prediction part (means), 110,111 Contradiction detection part , 120 Prediction result selection part, 130 instruction fetch address 140, instruction cache unit , 160, 161 instruction fetch line valid bit unit, 170 instruction execution unit unit

Claims (3)

複数ステージのパイプライン処理構造をもつプロセッサの分岐予測装置であって、
複数の命令の中から次に実行すべき命令のアドレスを指定する命令フェッチアドレス部と、
前記命令フェッチアドレス部に接続されて、指定された命令のアドレスの履歴から次に実行すべき命令の第1の予測アドレスを出力する第1の分岐予測手段と、
前記命令フェッチアドレス部に接続されて、指定された命令のアドレスの履歴から次に実行すべき命令の第2の予測アドレスを前記第1の予測アドレスの出力から所定時間遅れて出力する前記第1の分岐予測手段よりも予測精度が高い第2の分岐予測手段と、
前記命令フェッチアドレス部に接続されて、指定された命令のアドレスの履歴から次に実行すべき命令の予測アドレスを前記第2の分岐予測手段よりも低応答速度と高い予測精度で出力する第3の分岐予測手段と、
前記第1乃至第3の分岐予測手段の出力が全て同じであるとき、前記第1の分岐予測手段の出力をフェッチすべき命令アドレスとして前記命令フェッチアドレス部に指定し、前記第2及び第3の分岐予測手段の出力が異なるとき、前記第3の分岐予測手段の出力をフェッチすべき命令アドレスとして前記命令フェッチアドレス部に指定し、前記第1及び第2の分岐予測手段の出力が異なるとき、前記第2の分岐予測手段の出力をフェッチすべき命令アドレスとして前記命令フェッチアドレス部に指定する、予測結果選択手段と、
を備えるプロセッサの分岐予測装置。
A branch prediction device for a processor having a multi-stage pipeline processing structure,
An instruction fetch address section for designating an address of an instruction to be executed next from a plurality of instructions;
A first branch prediction unit connected to the instruction fetch address unit and outputting a first predicted address of an instruction to be executed next from a history of addresses of designated instructions;
The first instruction is connected to the instruction fetch address section and outputs a second predicted address of an instruction to be executed next from a history of the address of the designated instruction with a predetermined time delay from the output of the first predicted address. A second branch predicting means having higher prediction accuracy than the branch predicting means of
A third instruction connected to the instruction fetch address section for outputting a predicted address of an instruction to be executed next from a history of the address of the designated instruction at a lower response speed and higher prediction accuracy than the second branch prediction means; Branch prediction means of
When all the outputs of the first to third branch predicting means are the same, the output of the first branch predicting means is designated as the instruction address to be fetched in the instruction fetch address section, and the second and third When the outputs of the third branch prediction means are different, the output of the third branch prediction means is designated as the instruction address to be fetched in the instruction fetch address section, and the outputs of the first and second branch prediction means are different. Predicting result selecting means for designating the output of the second branch predicting means in the instruction fetch address section as an instruction address to be fetched;
A branch prediction apparatus for a processor comprising:
請求項1に記載の分岐予測装置を備えるパイプライン処理構造をもつプロセッサ。   A processor having a pipeline processing structure comprising the branch prediction device according to claim 1. 複数ステージのパイプライン処理構造をもつプロセッサの分岐予測方法であって、
指定された命令のアドレスの履歴から次に実行すべき命令の予測アドレスを所定の応答速度と所定の予測精度で出力する第1の分岐予測ステップと、
前記指定された命令のアドレスの履歴から次に実行すべき命令の予測アドレスを前記第1の分岐予測ステップよりも低応答速度と高い予測精度で出力する第2の分岐予測ステップと、
前記指定された命令のアドレスの履歴から次に実行すべき命令の予測アドレスを前記第2の分岐予測ステップよりも低応答速度と高い予測精度で出力する第3の分岐予測ステップと、を備え、
前記第1乃至第3の分岐予測ステップの出力が同じであるとき、前記第1の分岐予測ステップの出力をフェッチすべき命令アドレスとして指定し、
前記第2及び第3の分岐予測ステップの出力が異なるとき、前記第3の分岐予測ステップの出力をフェッチすべき命令アドレスとして指定すると共にパイプラインの後段で前記第1及び第2の分岐予測ステップの各出力の命令アドレスに基づくフェッチによる処理を破棄し、
前記第1及び第2の分岐予測ステップの出力が異なるとき、前記第2の分岐予測ステップの出力をフェッチすべき命令アドレスとして指定する共にパイプラインの後段で前記第1の分岐予測ステップの出力の命令アドレスに基づくフェッチによる処理を破棄する、
プロセッサの分岐予測方法。
A branch prediction method for a processor having a multi-stage pipeline processing structure,
A first branch prediction step for outputting a predicted address of an instruction to be executed next from a history of addresses of a specified instruction with a predetermined response speed and a predetermined prediction accuracy;
A second branch prediction step for outputting a predicted address of an instruction to be executed next from the history of the address of the designated instruction at a lower response speed and higher prediction accuracy than the first branch prediction step;
A third branch prediction step for outputting a predicted address of an instruction to be executed next from the history of the address of the designated instruction at a lower response speed and higher prediction accuracy than the second branch prediction step;
When the outputs of the first to third branch prediction steps are the same, specify the output of the first branch prediction step as an instruction address to be fetched;
When the outputs of the second and third branch prediction steps are different, the output of the third branch prediction step is designated as an instruction address to be fetched, and the first and second branch prediction steps are performed later in the pipeline. Discard the processing based on the instruction address of each output of
When the outputs of the first and second branch prediction steps are different, the output of the second branch prediction step is designated as an instruction address to be fetched, and the output of the first branch prediction step is output at a later stage of the pipeline. Abandon processing by fetch based on instruction address,
Processor branch prediction method.
JP2011034942A 2011-02-21 2011-02-21 Branch prediction apparatus, processor, and branch prediction method Active JP5656074B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011034942A JP5656074B2 (en) 2011-02-21 2011-02-21 Branch prediction apparatus, processor, and branch prediction method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011034942A JP5656074B2 (en) 2011-02-21 2011-02-21 Branch prediction apparatus, processor, and branch prediction method

Publications (2)

Publication Number Publication Date
JP2012173967A JP2012173967A (en) 2012-09-10
JP5656074B2 true JP5656074B2 (en) 2015-01-21

Family

ID=46976826

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011034942A Active JP5656074B2 (en) 2011-02-21 2011-02-21 Branch prediction apparatus, processor, and branch prediction method

Country Status (1)

Country Link
JP (1) JP5656074B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10127044B2 (en) * 2013-10-25 2018-11-13 Advanced Micro Devices, Inc. Bandwidth increase in branch prediction unit and level 1 instruction cache
CN117667221B (en) * 2024-01-31 2024-04-30 睿思芯科(深圳)技术有限公司 Hybrid algorithm two-stage branch prediction system, method and related equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5163140A (en) * 1990-02-26 1992-11-10 Nexgen Microsystems Two-level branch prediction cache
JPH0820950B2 (en) * 1990-10-09 1996-03-04 インターナショナル・ビジネス・マシーンズ・コーポレイション Multi-predictive branch prediction mechanism
US7278012B2 (en) * 2005-06-02 2007-10-02 Qualcomm Incorporated Method and apparatus for efficiently accessing first and second branch history tables to predict branch instructions
US8935517B2 (en) * 2006-06-29 2015-01-13 Qualcomm Incorporated System and method for selectively managing a branch target address cache of a multiple-stage predictor
US20090164758A1 (en) * 2007-12-20 2009-06-25 Haertel Michael J System and Method for Performing Locked Operations

Also Published As

Publication number Publication date
JP2012173967A (en) 2012-09-10

Similar Documents

Publication Publication Date Title
JP5889986B2 (en) System and method for selectively committing the results of executed instructions
US7707398B2 (en) System and method for speculative global history prediction updating
US7725684B2 (en) Speculative instruction issue in a simultaneously multithreaded processor
JP6006247B2 (en) Processor, method, system, and program for relaxing synchronization of access to shared memory
EP1886216B1 (en) Controlling out of order execution pipelines using skew parameters
JP5209633B2 (en) System and method with working global history register
JP2004038337A (en) Instruction fetch control device
JP5491071B2 (en) Instruction fusion arithmetic device and instruction fusion arithmetic method
JP2006313422A (en) Calculation processing device and method for executing data transfer processing
JP2018005488A (en) Arithmetic processing unit and control method for arithmetic processing unit
JP2009157629A (en) Semiconductor integrated circuit device, and clock control method therefor
US7844806B2 (en) Global history branch prediction updating responsive to taken branches
JP5656074B2 (en) Branch prediction apparatus, processor, and branch prediction method
JP2007207145A (en) Loop control circuit and loop control method
US20060200653A1 (en) Decoding predication instructions within a superscalar data processing system
JP2001060152A (en) Information processor and information processing method capable of suppressing branch prediction
JP2019101543A (en) Processor and pipeline processing method
JP4728877B2 (en) Microprocessor and pipeline control method
JP3759729B2 (en) Speculative register adjustment
WO2012132214A1 (en) Processor and instruction processing method thereof
JP2503223B2 (en) Prior control method
US20100153688A1 (en) Apparatus and method for data process
JP2014059665A (en) Microcomputer and instruction processing method in microcomputer
JPH09101890A (en) Arithmetic unit for pipeline and decoder device
JP2012221086A (en) Information processor

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20130111

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20140123

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140131

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140331

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20140514

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140801

A911 Transfer of reconsideration by examiner before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20140808

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140826

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20141015

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20141030

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20141112

R150 Certificate of patent or registration of utility model

Ref document number: 5656074

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150