JP2006048258A - Data processor - Google Patents

Data processor Download PDF

Info

Publication number
JP2006048258A
JP2006048258A JP2004226318A JP2004226318A JP2006048258A JP 2006048258 A JP2006048258 A JP 2006048258A JP 2004226318 A JP2004226318 A JP 2004226318A JP 2004226318 A JP2004226318 A JP 2004226318A JP 2006048258 A JP2006048258 A JP 2006048258A
Authority
JP
Japan
Prior art keywords
instruction
branch
prediction
fetch
control unit
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.)
Withdrawn
Application number
JP2004226318A
Other languages
Japanese (ja)
Inventor
Yasuhiko Saito
靖彦 斎藤
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.)
Renesas Technology Corp
Original Assignee
Renesas Technology 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 Renesas Technology Corp filed Critical Renesas Technology Corp
Priority to JP2004226318A priority Critical patent/JP2006048258A/en
Publication of JP2006048258A publication Critical patent/JP2006048258A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Advance Control (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To flexibly respond to a request for low power consumption and the high-speed implementation of a program. <P>SOLUTION: The invention comprises an instruction fetch control part (5), an instruction buffer (15) that holds an instruction fetched by the fetch control part, and an execution part (6) that executes the instruction held by the instruction buffer in a pipeline in a predetermined order. The fetch control part obtains prediction information showing the predicted direction of conditional branching and its accuracy using the instruction address of the branch instruction. The fetch control part is capable of carrying out the fetching of instructions on the branching predicting side and the fetching of instructions on the non-branching prediction side in the conditional branching instructions, and restricts selectively the fetching of instructions on the non-branching prediction side according to the prediction information. The fetch control part restricts fetching of instructions on the non-prediction side when the accuracy of branching prediction by the prediction information is relatively high. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

本発明は、パイプラインによる命令実行が可能なデータプロセッサ(パイプラインプロセッサ)における条件分岐命令の分岐予測による命令フェッチ制御に関する。   The present invention relates to instruction fetch control by branch prediction of a conditional branch instruction in a data processor (pipeline processor) capable of executing instructions by a pipeline.

条件分岐命令の分岐予測とは、予め分岐する方向を予測して、その予測に基づいたアドレスの命令をパイプラインにつめてパイプラインの無駄をなくする技術である。さらに、前記分岐予測による命令実行の効率化の効果を上げるために、分岐予測が確定する前に予測した分岐方向の命令実行を許すると共にその予測が外れたときに命令実行の矛盾を解消するようにした投機実行という技術を採用することができる。   Branch prediction of a conditional branch instruction is a technique for predicting a branching direction in advance and filling an instruction with an address based on the prediction into the pipeline to eliminate the waste of the pipeline. Further, in order to increase the efficiency of instruction execution by the branch prediction, instruction execution in the predicted branch direction is allowed before branch prediction is confirmed, and instruction execution contradictions are resolved when the prediction is lost. A technique called speculative execution can be employed.

特許文献1には、分岐予測および投機的実行機能を備えるパイプラインプロセッサにおいて、分岐予測失敗による消費電力効率の悪化を防止するために、分岐予測が当たりにくい条件分岐命令を判断し、分岐予測が当たりにくい条件分岐命令については後続命令の投機的実行を行わず、分岐条件が確定するまで、後続命令の実行を待機する。分岐条件検証結果を受け取った後、分岐条件が成立したかどうかを判定し、分岐条件が成立していれば条件分岐命令の次アドレスの命令から実行し、分岐条件が成立していなければ分岐飛び先アドレスの命令から実行する。   In Patent Literature 1, in a pipeline processor having a branch prediction and speculative execution function, in order to prevent deterioration of power consumption efficiency due to failure of branch prediction, a conditional branch instruction that is difficult to hit branch prediction is determined, and branch prediction is performed. For a conditional branch instruction that is difficult to hit, the speculative execution of the subsequent instruction is not performed, and the execution of the subsequent instruction is waited until the branch condition is determined. After receiving the branch condition verification result, it is determined whether or not the branch condition is satisfied. If the branch condition is satisfied, the process is executed from the instruction at the address next to the conditional branch instruction. If the branch condition is not satisfied, the branch jump is performed. Execute from the instruction at the destination address.

特開2000−322257号公報JP 2000-322257 A

本発明者は、低消費電力且つ高速動作を達成するマイクロプロセッサにおける命令フェッチ部の低消費電力化について検討した。携帯情報機器などの組み込み分野向けプロセッサでは、アプリケーションの複雑化に伴い高速化が必要となる。また携帯応用であるため低消費電力化も必要である。しかしながら、特許文献1記載の如く、分岐予測が当たりにくい条件分岐命令を検出すると、常にその分岐命令以降の命令列の実行を停止すると、プログラムの高速実行性能が低下する場合のあることが本発明者によって見出された。   The present inventor has studied a reduction in power consumption of an instruction fetch unit in a microprocessor that achieves low power consumption and high-speed operation. In a processor for an embedded field such as a portable information device, it is necessary to increase the speed as the application becomes complicated. Moreover, since it is a portable application, low power consumption is also necessary. However, as described in Patent Document 1, when a conditional branch instruction that is difficult to predict branch detection is detected, if execution of an instruction sequence after the branch instruction is always stopped, the high-speed execution performance of the program may be degraded. It was found by the person.

本発明の目的は、低消費電力とプログラムの高速実行との要求に対して柔軟に対応することができるデータプロセッサを提供することにある。   An object of the present invention is to provide a data processor that can flexibly cope with demands for low power consumption and high-speed program execution.

本発明の前記並びにその他の目的と新規な特徴は本明細書の記述及び添付図面から明らかになるであろう。   The above and other objects and novel features of the present invention will be apparent from the description of this specification and the accompanying drawings.

本願において開示される発明のうち代表的なものの概要を簡単に説明すれば下記の通りである。   The following is a brief description of an outline of typical inventions disclosed in the present application.

〔1〕データプロセッサは、命令のフェッチ制御部(5)と、前記フェッチ制御部によりフェッチされた命令を保持する命令バッファ(15)と、前記命令バッファに保持された命令を所定の順番にパイプラインで実行する実行部(6)とを含む。前記フェッチ制御部は、分岐命令の命令アドレスを用いて条件分岐の予測方向とその確度を示す予測情報(33)を取得し、条件分岐命令における分岐予測側の命令のフェッチと分岐非予測側の命令のフェッチを行なうことが可能であると共に、前記予測情報に応じて選択的に分岐非予測側の命令のフェッチを抑止する。例えば、前記フェッチ制御部は、前記予測情報による分岐予測の確度が相対的に高いときに前記非予測側の命令のフェッチを抑止する。   [1] The data processor pipes the instruction fetch control unit (5), the instruction buffer (15) holding the instruction fetched by the fetch control unit, and the instructions held in the instruction buffer in a predetermined order. And an execution unit (6) that executes on the line. The fetch control unit obtains prediction information (33) indicating the prediction direction and the accuracy of the conditional branch using the instruction address of the branch instruction, fetches the instruction on the branch prediction side in the conditional branch instruction, and the branch non-prediction side It is possible to fetch an instruction, and selectively inhibit fetching of an instruction on the branch non-prediction side according to the prediction information. For example, the fetch control unit suppresses fetching of the instruction on the non-prediction side when the accuracy of branch prediction based on the prediction information is relatively high.

条件分岐命令における分岐予測側の命令のフェッチと分岐非予測側の命令のフェッチの双方を行なうことにより、条件分岐予測がミスしても、非予測側の命令フェッチが行われているため、条件分岐予測ミス時のパイプラインにおけるストールサイクル数が低減されプログラムの高速実行に資することができる。一方、予測情報によりその条件分岐予測が高い確率でヒットすると判断される場合に非予測側の命令フェッチを抑止することができるから、プログラムの実行において、実際には必要とされない命令のフェッチ回数が抑止され、命令フェッチのためのメモリ読み出し回数を低減でき、メモリ読み出しに必要な電力の低減に資することができる。前記非予測側命令に対するフェッチの抑止は前記予測情報に応じて選択的に行うことが可能であるから、低消費電力とプログラムの高速実行との要求に対して柔軟に対応することができる。   By fetching both the branch prediction side instruction and the branch non-prediction side instruction in the conditional branch instruction, even if the conditional branch prediction misses, the non-prediction side instruction fetch is performed. The number of stall cycles in the pipeline at the time of branch misprediction is reduced, which can contribute to high-speed program execution. On the other hand, when it is determined by the prediction information that the conditional branch prediction is hit with a high probability, instruction fetch on the non-prediction side can be suppressed. Therefore, the number of instruction fetches that are not actually required in program execution is The number of memory reads for instruction fetch can be reduced, and the power required for memory read can be reduced. Since suppression of fetch for the non-prediction side instruction can be selectively performed in accordance with the prediction information, it is possible to flexibly cope with demands for low power consumption and high-speed program execution.

〔2〕本発明の別の観点によるデータプロセッサは、命令のフェッチ制御部と、前記フェッチ制御部によりフェッチされた命令を保持する命令バッファと、前記命令バッファに保持された命令を所定の順番にパイプラインで実行する実行部とを含み、前記フェッチ制御部は、分岐命令の命令アドレスを用いて条件分岐の予測方向とその確度を示す予測情報を取得し、条件分岐命令における分岐予測側の命令のフェッチと分岐非予測側の命令のフェッチの双方を行なう第1フェッチモードと、前記分岐予測側の命令のフェッチを行なうと共に前記予測情報に応じて選択的に分岐非予測側の命令のフェッチを抑止する第2フェッチモードとの選択が可能にされる。前記フェッチ制御部は、第2フェッチモードにおいて前記予測情報による分岐予測の確度が相対的に高いときに前記非予測側の命令のフェッチを抑止する。   [2] A data processor according to another aspect of the present invention includes an instruction fetch control unit, an instruction buffer that holds an instruction fetched by the fetch control unit, and instructions held in the instruction buffer in a predetermined order. An execution unit that executes in a pipeline, and the fetch control unit obtains prediction information indicating a prediction direction and accuracy of a conditional branch using an instruction address of the branch instruction, and an instruction on a branch prediction side in the conditional branch instruction The first fetch mode for fetching both of the instruction and the branch non-prediction side instruction, fetching the branch prediction side instruction, and selectively fetching the branch non-prediction side instruction according to the prediction information Selection of the second fetch mode to be suppressed is made possible. The fetch control unit suppresses fetching of the instruction on the non-prediction side when the accuracy of branch prediction based on the prediction information is relatively high in the second fetch mode.

条件分岐命令において、第1フェッチモードでは、条件分岐命令において、予測側命令フェッチ及び非予測側命令フェッチを行なうため、本来必要のない命令フェッチが発生する。例えば、条件分岐命令の実行回数が2,000回として、ほぼ一回の条件分岐あたり非予測側の命令フェッチが1回発生するとすれば、プログラム全体で2,000回の非予測側の命令フェッチが発生する。条件分岐予測のヒット率が90%とすれば、この内非予測側で実行されない命令のための命令フェッチ回数は、2,000×0.9=1,800回である。第2フェッチモードでは、条件分岐予測が高い確率でヒットすると予測される場合、非予測側の命令フェッチを抑止して、メモリ読み出し回数を低減できる。また、条件分岐予測が低い確率でヒットすると予測される場合は、非予測側の命令フェッチも行なうため、実際に予測がはずれた場合でも、非予測側の命令フェッチが既に行なわれているため、実際の分岐方向の命令列の実行に課せられるパイプラインストールサイクル数が低減され、プログラムの高速実行が可能になる。分岐予測機構を備えるパイプラインプロセッサでは、プログラム実行時の命令フェッチ部及びメモリ部での消費電力が、全体の消費電力の10〜30%を占める場合もあり、第2フェッチモードでの命令フェッチ回数低減が、全体の消費電力低減に効果がある。   In the conditional branch instruction, in the first fetch mode, a prediction instruction fetch and a non-prediction instruction fetch are performed in the conditional branch instruction. For example, if the number of executions of conditional branch instructions is 2,000, and there is one non-predicted instruction fetch per almost conditional branch, 2,000 non-predicted instruction fetches for the entire program Will occur. If the conditional branch prediction hit rate is 90%, the number of instruction fetches for an instruction not executed on the non-prediction side is 2,000 × 0.9 = 1,800. In the second fetch mode, when it is predicted that the conditional branch prediction will be hit with a high probability, the instruction fetch on the non-prediction side can be suppressed to reduce the number of memory reads. Also, if the conditional branch prediction is predicted to hit with a low probability, the instruction fetch on the non-prediction side is also performed, so even if the prediction actually deviates, the instruction fetch on the non-prediction side has already been performed. The number of pipeline installation cycles imposed on the execution of the actual instruction sequence in the branch direction is reduced, and the program can be executed at high speed. In a pipeline processor having a branch prediction mechanism, the power consumption in the instruction fetch unit and the memory unit during program execution may occupy 10 to 30% of the total power consumption. The number of instruction fetches in the second fetch mode Reduction is effective in reducing the overall power consumption.

本発明の具体的な形態では、設定値に応じて前記第1フェッチモード又は第2フェッチモードを指定する制御レジスタを有する。前記制御レジスタの設定値は前記実行部による命令実行により可変である。   A specific form of the present invention includes a control register for designating the first fetch mode or the second fetch mode according to a set value. The set value of the control register is variable by instruction execution by the execution unit.

本発明の別の具体的な形態では、前記予測情報は複数ビットを有し、その値の違いによって各々異なる分岐予測及びその確度を表す。前記フェッチ制御部は、条件分岐命令の命令アドレスの一部を用いてインデックスされ、前記予測情報を複数格納する予測情報テーブル部を有する。前記フェッチ制御部は、条件分岐命令の分岐が確定したとき、その条件分岐命令を用いてインデックスされた予測情報がヒットであった場合には当該予測情報をその予測の最高確度を限度に当該確度が高くなる方向に更新し、その条件分岐命令を用いてインデックスされた予測情報がミスであった場合には当該予測情報をその予測の確度が低くなる方向に更新する。これによってダイナミックな分岐予測が可能になる。   In another specific form of the present invention, the prediction information has a plurality of bits, and represents different branch predictions and their accuracy depending on the difference in the values. The fetch control unit includes a prediction information table unit that is indexed using a part of an instruction address of a conditional branch instruction and stores a plurality of pieces of the prediction information. When the branch of the conditional branch instruction is confirmed, if the prediction information indexed using the conditional branch instruction is a hit, the fetch control unit sets the prediction information to the maximum accuracy of the prediction. If the prediction information indexed using the conditional branch instruction is a miss, the prediction information is updated in the direction in which the prediction accuracy decreases. This enables dynamic branch prediction.

このとき、前記分岐予測情報の最大値は条件分岐命令における分岐条件成立による分岐予測の確度最大を意味し、最小値は条件分岐命令における分岐条件不成立による分岐予測の確度最大を意味する。   At this time, the maximum value of the branch prediction information means the maximum accuracy of branch prediction due to the establishment of the branch condition in the conditional branch instruction, and the minimum value means the maximum accuracy of branch prediction due to the failure of the branch condition in the conditional branch instruction.

〔3〕本発明の更に別の観点によるデータプロセッサは、命令のフェッチ制御部と、前記フェッチ制御部によりフェッチされた命令を保持する命令バッファと、前記命令バッファに保持された命令を所定の順番にパイプラインで実行する実行部とを含み、前記フェッチ制御部は、条件分岐命令の命令アドレスの一部を用いてインデックスされ、分岐予測情報を複数格納する予測情報テーブル部(32A)と、分岐予測に対するヒット又はミスの分岐結果をシフト入力して最新より複数の分岐結果を分岐履歴情報として保持するシフトレジスタ部(21)とを有する。前記分岐予測情報(33A)はその値に応じて条件分岐の予測方向を示す。前記フェッチ制御部は、条件分岐命令における分岐予測側の命令のフェッチと分岐非予測側の命令のフェッチを行なうことが可能であると共に、前記シフトレジスタ部が保有する分岐履歴情報(22)から分岐確度を判定し、分岐確度が高いときは分岐非予測側の命令のフェッチを抑止する。例えば、前記フェッチ制御部は、シフトレジスタ部が保有する分岐履歴情報の半分以上の分岐結果が予測ヒットを示しているとき、分岐予測の確度は高いと判定する。予測情報を最小の1ビットで構成することができ、大域的な分岐履歴によって非予測側命令のフェッチを選択的に抑止することができる。   [3] A data processor according to still another aspect of the present invention includes an instruction fetch control unit, an instruction buffer that holds an instruction fetched by the fetch control unit, and instructions stored in the instruction buffer in a predetermined order. An execution unit that executes in a pipeline, and the fetch control unit is indexed using a part of the instruction address of a conditional branch instruction, and stores a prediction information table unit (32A) that stores a plurality of branch prediction information; A shift register unit (21) which shift-inputs the branch result of hit or miss for the prediction and holds a plurality of branch results as branch history information from the latest. The branch prediction information (33A) indicates the prediction direction of the conditional branch according to the value. The fetch control unit is capable of fetching a branch prediction side instruction and a branch non-prediction side instruction in a conditional branch instruction and branching from branch history information (22) held in the shift register unit. The accuracy is judged, and when the branch accuracy is high, fetching of instructions on the branch non-prediction side is suppressed. For example, the fetch control unit determines that the accuracy of branch prediction is high when a branch result of more than half of the branch history information held by the shift register unit indicates a prediction hit. Prediction information can be composed of a minimum of 1 bit, and fetching of non-predicted instructions can be selectively suppressed by a global branch history.

〔4〕本発明の更に別の観点によるデータプロセッサは、命令のフェッチ制御部と、前記フェッチ制御部によりフェッチされた命令を保持する命令バッファと、前記命令バッファに保持された命令を所定の順番にパイプラインで実行する実行部とを含み、前記フェッチ制御部は、条件分岐命令の命令アドレスの一部を用いてインデックスされ、分岐予測情報を複数格納する予測情報テーブル部と、分岐予測に対するヒット又はミスの分岐結果をシフト入力して最新より複数の分岐結果を分岐履歴情報として保持するシフトレジスタ部とを有し、前記分岐予測情報はその値に応じて条件分岐の予測方向を示す。前記フェッチ制御部は、分岐命令の命令アドレスを用いて条件分岐の予測方向を示す予測情報を取得し、条件分岐命令における分岐予測側の命令のフェッチと分岐非予測側の命令のフェッチの双方を行なう第1フェッチモードと、前記分岐予測側の命令のフェッチを行なうと共に前記シフトレジスタ部より取得した分岐履歴情報が高い分岐確度を示しているときは分岐非予測側の命令のフェッチを抑止する第2フェッチモードとの選択が可能にされる。   [4] A data processor according to still another aspect of the present invention includes an instruction fetch control unit, an instruction buffer that holds an instruction fetched by the fetch control unit, and instructions held in the instruction buffer in a predetermined order. The fetch control unit is indexed using a part of the instruction address of the conditional branch instruction and stores a plurality of branch prediction information, and a hit for branch prediction. Alternatively, a shift register unit that shift-inputs a miss branch result and holds a plurality of branch results from the latest as branch history information, and the branch prediction information indicates a prediction direction of a conditional branch according to the value. The fetch control unit obtains prediction information indicating a prediction direction of a conditional branch using an instruction address of a branch instruction, and fetches both a branch prediction side instruction fetch and a branch non-prediction side instruction fetch in the conditional branch instruction. A first fetch mode to be performed, and fetching an instruction on the branch prediction side, and when branch history information acquired from the shift register unit indicates a high branch accuracy, fetching an instruction on the branch non-prediction side is inhibited. Selection with the 2-fetch mode is made possible.

本発明の具体的な形態では、設定値に応じて前記第1フェッチモード又は第2フェッチモードを指定する制御レジスタを有する。前記制御レジスタの設定値は前記実行部による命令実行により可変である。   A specific form of the present invention includes a control register for designating the first fetch mode or the second fetch mode according to a set value. The set value of the control register is variable by instruction execution by the execution unit.

〔5〕本発明の更に別の観点によるデータプロセッサは、命令のフェッチ制御部と、前記フェッチ制御部によりフェッチされた命令を保持する命令バッファと、前記命令バッファに保持された命令を所定の順番にパイプラインで実行する実行部とを含み、前記フェッチ制御部は、条件分岐命令における分岐予測側の命令をN1個と分岐非予測側の命令をN2個フェッチする第1のフェッチ機能と、条件分岐命令に対する予測確度を示す情報が高い予測確度を示しているときには、予測側の命令をN3個フェッチする第2のフェッチ機能を有し、N3<N1,N2である。   [5] A data processor according to still another aspect of the present invention includes an instruction fetch control unit, an instruction buffer that holds an instruction fetched by the fetch control unit, and instructions stored in the instruction buffer in a predetermined order. And an execution unit that executes in a pipeline, wherein the fetch control unit fetches N1 branch prediction side instructions and N2 branch non-prediction side instructions in a conditional branch instruction, and a condition When the information indicating the prediction accuracy for the branch instruction indicates a high prediction accuracy, it has a second fetch function for fetching N3 instructions on the prediction side, and N3 <N1, N2.

本願において開示される発明のうち代表的なものによって得られる効果を簡単に説明すれば下記の通りである。すなわち、低消費電力とプログラムの高速実行との要求に対して柔軟に対応することができる。   The effects obtained by the representative ones of the inventions disclosed in the present application will be briefly described as follows. That is, it is possible to flexibly meet the demands for low power consumption and high-speed program execution.

図1にはデータプロセッサの一例が示される。データプロセッサ7は、特に制限されないが、相補型MOS集積回路製造技術によって単結晶シリコンのような1個の半導体基板に形成される。データプロセッサ7はプロセッサコア部(PCOR)1を有し、このプロセッサコア部1は制御レジスタ(CREG)16、命令のフェッチ制御を行なうフェッチ制御部(FCNT)5、前記フェッチ制御部5によりフェッチされた命令を保持する命令バッファ(IBUF)15、及び前記命令バッファ15に保持された命令を所定の順番にパイプラインで実行するパイプライン実行部(PEXEC)6などから成る中央処理装置(CPU)を有する。前記フェッチ制御部5、制御レジスタ16及びパイプライン実行部6は内部バス4に接続される。内部バス4には内蔵メモリとしてキャッシュメモリ(CACH)2とワークRAM(WRAM)3が接続される。キャッシュメモリ2とワークRAM3はバスステートコントローラ(BSC)13を介して外部バス8、DMAC(ダイレクトメモリアクセスコントローラ)14及び周辺バス5とインタフェース可能にされる。外部バス8には代表的に示された外部メモリ(EXMEM)9が接続される。周辺バス5には、代表的に示された割り込みコントローラ(INTC)10、CPG(クロックパルジェネレータ)11及びTMU(タイマーユニット)12が接続される。   FIG. 1 shows an example of a data processor. The data processor 7 is not particularly limited, but is formed on one semiconductor substrate such as single crystal silicon by a complementary MOS integrated circuit manufacturing technique. The data processor 7 has a processor core unit (PCOR) 1. The processor core unit 1 is fetched by a control register (CREG) 16, a fetch control unit (FCNT) 5 that performs fetch control of instructions, and the fetch control unit 5. A central processing unit (CPU) comprising an instruction buffer (IBUF) 15 for holding the received instructions and a pipeline execution unit (PEXEC) 6 for executing the instructions held in the instruction buffer 15 in a predetermined order in the pipeline. Have. The fetch control unit 5, the control register 16 and the pipeline execution unit 6 are connected to the internal bus 4. A cache memory (CACH) 2 and a work RAM (WRAM) 3 are connected to the internal bus 4 as built-in memories. The cache memory 2 and work RAM 3 can be interfaced with an external bus 8, a DMAC (direct memory access controller) 14, and a peripheral bus 5 via a bus state controller (BSC) 13. A representative external memory (EXMEM) 9 is connected to the external bus 8. The peripheral bus 5 is connected to a representatively shown interrupt controller (INTC) 10, CPG (clock pulse generator) 11, and TMU (timer unit) 12.

フェッチ制御部5は、内部バス4を経由して、キャッシュメモリ2から命令列をフェッチする。キャッシュメモリ2がキャッシュミスのときはフェッチ対象の命令列が外部メモリ9からキャッシュメモリ2に供給されることになる。フェッチ制御部5でフェッチされた命令は命令バッファ15に格納され、命令バッファ15に格納された命令はパイプライン実行部6に投入され、パイプラインにより実行される。パイプライン実行部6による命令実行結果のうちの所定の結果は信号18により命令フェッチ制御部5に反映される。例えば分岐条件成立または不成立を決定するための情報などが前記信号18により命令フェッチ制御部5に供給される。   The fetch control unit 5 fetches an instruction sequence from the cache memory 2 via the internal bus 4. When the cache memory 2 has a cache miss, the instruction sequence to be fetched is supplied from the external memory 9 to the cache memory 2. The instruction fetched by the fetch control unit 5 is stored in the instruction buffer 15, and the instruction stored in the instruction buffer 15 is input to the pipeline execution unit 6 and executed by the pipeline. A predetermined result of the instruction execution results by the pipeline execution unit 6 is reflected on the instruction fetch control unit 5 by a signal 18. For example, information for determining whether the branch condition is satisfied or not is supplied to the instruction fetch control unit 5 by the signal 18.

フェッチ制御部5は条件分岐命令の分岐予測を行ない、その予測に基づいたアドレスの命令をパイプラインにつめてパイプラインの無駄をなくす。そしてパイプライン実行部6は、分岐予測が確定する前に予測した分岐方向の命令実行を許すると共にその予測が外れたときに命令実行の矛盾を解消するようにした投機実行の制御を行なう。   The fetch control unit 5 performs branch prediction of a conditional branch instruction and packs an instruction at an address based on the prediction into the pipeline to eliminate the waste of the pipeline. The pipeline execution unit 6 controls speculative execution so as to permit instruction execution in the branch direction predicted before the branch prediction is finalized and to resolve inconsistencies in instruction execution when the prediction is lost.

ここで、データプロセッサにおけるパイプラインステージについて説明する。図2にはデータプロセッサ7のパイプラインステージが例示される。パイプラインステージは7段であり、各ステージの処理内容は以下のようになる。ステージI1およびステージI2は内部バス4を経由して命令フェッチを行なう命令フェッチステージであり、ステージI1でフェッチコマンドをキャッシュメモリ2に発行する。ステージI2ではフェッチされた命令を命令バッファ15に格納すると共に、分岐命令を検出する。図2の例では1回の命令フェッチサイクルで最大4命令フェッチすることができ、命令A,B,C,DがステージI1でフェッチされ、I2ステージで命令バッファに格納される。ステージIDは命令デコードステージであり、命令バッファ15から供給された命令をデコードする。フェッチされた命令が次のサイクルで、デコードされる場合はI2ステージから、IDステージに処理が進む。パイプラインストールなどで、フェッチされた命令がすぐにIDステージに進めない場合は、フェッチされた命令は、命令バッファ15内に留まり、分岐命令の検出を続行する。この期間をプリデコードステージPDと呼ぶ。ステージE1,E2、E3は実行ステージであり、命令のデコード結果に応じて演算を行なう。ステージWBはライトバックステージであり、演算結果をレジスタやメモリに書き込む。前記ID、E1、E2、E3、WBの各ステージはパイプライン実行部6で処理される。   Here, the pipeline stage in the data processor will be described. FIG. 2 illustrates the pipeline stage of the data processor 7. There are seven pipeline stages, and the processing contents of each stage are as follows. Stage I1 and stage I2 are instruction fetch stages for fetching instructions via the internal bus 4, and a fetch command is issued to the cache memory 2 at stage I1. At stage I2, the fetched instruction is stored in the instruction buffer 15, and a branch instruction is detected. In the example of FIG. 2, a maximum of four instructions can be fetched in one instruction fetch cycle, and instructions A, B, C, and D are fetched at stage I1 and stored in the instruction buffer at stage I2. The stage ID is an instruction decode stage and decodes the instruction supplied from the instruction buffer 15. When the fetched instruction is decoded in the next cycle, the process proceeds from the I2 stage to the ID stage. If the fetched instruction cannot be immediately advanced to the ID stage due to pipeline installation or the like, the fetched instruction remains in the instruction buffer 15 and continues to detect the branch instruction. This period is called a predecode stage PD. Stages E1, E2, and E3 are execution stages, and perform operations according to instruction decode results. The stage WB is a write back stage, and writes the operation result to a register or a memory. The stages ID, E1, E2, E3, and WB are processed by the pipeline execution unit 6.

フェッチ制御部5は、内部バス4を経由して、キャッシュメモリ2から命令列をフェッチする。フェッチ制御部5でフェッチされた命令は、命令バッファ15に格納される。フェッチ制御部5は、I2およびPDステージで分岐命令を検索する。条件分岐命令を検出すると、その命令アドレスに応ずる予測情報などに基づいて条件分岐方向を予測する。フェッチ制御部5は、条件分岐命令における分岐予測側の命令のフェッチと分岐非予測側の命令のフェッチの双方を行なう第1フェッチモードと、前記分岐予測側の命令のフェッチを行なうと共に前記予測情報に応じて選択的に分岐非予測側の命令のフェッチを抑止する第2フェッチモードとの選択が可能にされる。前記第1フェッチモードか第2フェッチモードのいずれが選択されているかは前記制御レジスタ16のフェッチモード切替ビット17の値によって決定される。制御レジスタ16の設定値は前記パイプライン実行部6による命令実行により可変とされる。   The fetch control unit 5 fetches an instruction sequence from the cache memory 2 via the internal bus 4. The instruction fetched by the fetch control unit 5 is stored in the instruction buffer 15. The fetch control unit 5 searches for branch instructions at the I2 and PD stages. When a conditional branch instruction is detected, the conditional branch direction is predicted based on prediction information corresponding to the instruction address. The fetch control unit 5 performs a first fetch mode in which both a branch prediction side instruction fetch and a branch non-prediction side instruction fetch are performed in a conditional branch instruction, the branch prediction side instruction is fetched, and the prediction information Accordingly, selection with the second fetch mode that selectively suppresses fetching of instructions on the branch non-prediction side is enabled. Whether the first fetch mode or the second fetch mode is selected is determined by the value of the fetch mode switching bit 17 of the control register 16. The set value of the control register 16 is made variable by instruction execution by the pipeline execution unit 6.

図2では、第1フェッチモードが選択されているとき、予測された分岐方向の命令フェッチ及び非予測側の命令フェッチを発行し、内部バス経由でフェッチされた命令を命令バッファ15に格納する例が示されている。すなわち、条件分岐命令CをサイクルC2のI2ステージで検出したとき、サイクルC3のPDステージで条件分岐方向を予測する。条件分岐命令Cの分岐予測が分岐成立予測(Taken)予測であれば、分岐成立側(Taken側)の命令ストリームをサイクルC4でフェッチする。更にこのフェッチモードでは、非予測側となる分岐不成立(NotTaken側)の命令ストリームもサイクルC5でフェッチし、命令バッファに格納する。サイクルC3以前の非予測側命令フェッチは図示しないサイクルC1以前にフェッチされた命令に対する予測に基づいている。   In FIG. 2, when the first fetch mode is selected, an instruction fetch in the predicted branch direction and an instruction fetch on the non-prediction side are issued, and the instruction fetched via the internal bus is stored in the instruction buffer 15. It is shown. That is, when the conditional branch instruction C is detected in the I2 stage of cycle C2, the conditional branch direction is predicted in the PD stage of cycle C3. If the branch prediction of the conditional branch instruction C is a branch establishment prediction (Taken) prediction, the instruction stream on the branch establishment side (Taken side) is fetched in cycle C4. Further, in this fetch mode, an instruction stream on the branch failure (NotTaken side) on the non-prediction side is also fetched in cycle C5 and stored in the instruction buffer. The non-predicted instruction fetch before cycle C3 is based on the prediction for an instruction fetched before cycle C1 (not shown).

図3では、第2フェッチモードが選択されているとき、分岐予測の確度が高い場合には非予測側の命令ストリームのフェッチを抑止する例が示される。この場合、非予測側の命令ストリームは分岐不成立(Not Taken)側であり、Not Taken側の命令ストリームのフェッチが抑止されている。要するにサイクルC3のPDステージにおける条件分岐方向の予測結果に対して、サイクルC4、C5では予測側の命令列がフェッチされ、非予測側の命令列に対するフェッチは抑止されている。   FIG. 3 shows an example in which the fetch of the instruction stream on the non-prediction side is suppressed when the second fetch mode is selected and the branch prediction accuracy is high. In this case, the instruction stream on the non-prediction side is the branch failure (Not Taken) side, and fetching of the instruction stream on the Not Taken side is suppressed. In short, with respect to the prediction result in the conditional branch direction in the PD stage of cycle C3, the instruction sequence on the prediction side is fetched in cycles C4 and C5, and fetching for the instruction sequence on the non-prediction side is suppressed.

図4には前記フェッチモードに従った命令フェッチ制御のために構成が例示される。ここでフェッチすべき命令アドレスはパイプライン実行部6で実行される実行命令アドレスに対して複数命令先行するプリフェッチアドレスを生成するフェッチアドレス生成回路20が生成する。生成されたフェッチアドレスはフェッチアドレスバッファ(FABUF)38が保有し、そのフェッチアドレスFADRが内部バス4に出力され、キャッシュメモリ2から命令INSTがフェッチされる。命令フェッチは内部バス4の空きサイクルを利用して行なわれる。フェッチアドレス生成回路20は命令バッファ15にフェッチされた命令の中から条件分岐命令を検索し、条件分岐命令を検索したときは当該条件分岐命令の命令アドレスを条件分岐命令アドレスバッファ31に保持する。条件分岐命令アドレスバッファ31に保持された条件分岐命令アドレスは分岐予測テーブル(分岐予測情報テーブル部)32に対する連想アクセスに用いられる。分岐予測テーブル32は命令アドレスの下位側複数ビットのインデックスアドレスによってインデックスされるテーブルエントリを複数有し、インデックスされたテーブルエントリは当該命令アドレスの下位側複数ビットのオフセットアドレスによって選択可能な複数の分岐予測情報33を保有する。分岐予測テーブル32が保有する分岐予測情報は命令アドレスに相関を有する。ここでは分岐予測情報33は複数ビットを有し、その値によって予測方向とその予測の確度を表す。分岐予測情報は対応する条件分岐命令の分岐予測に対する実際の分岐状態を反映する方向に更新されるようになっている。分岐予測情報の更新についてその詳細は後述する。分岐予測テーブル32から読み出された分岐予測情報33はフェッチ方向判定部34及びフェッチ抑止部36に供給される。フェッチ方向判定部34は分岐予測情報に従って命令フェッチの予測方向を示す予測フェッチ信号35を生成する。例えば、予測フェッチ信号35は予測方向が分岐成立(taken)側の場合にはハイレベル、予測方向が分岐不成立(not taken)側の場合にはローレベルとされる。フェッチ抑止部36はフェッチモード切替ビット17の値と分岐予測情報33とを入力し、第1フェッチモードにおいては非予測側フェッチ抑止信号37をネゲートし(非活性化レベルとし)、非予測側命令のフェッチを許容する。第2フェッチモードにおいては分岐予測情報33より予測方向の確度を判定し、その確度が高いと判定したときは非予測側フェッチ抑止信号をアサートし(活性化レベルとし)、非予測側命令フェッチの抑止を指示する。第2フェッチモードにおいて分岐予測情報33より判定された予測方向の確度が低いと判定したときは非予測側フェッチ抑止信号をネゲートし、非予測側命令フェッチの許容を指示する。前記予測フェッチ信号35及び非予測側フェッチ抑止信号37が与えられるフェッチアドレス生成回路20は、非予測側命令フェッチの抑止が指示されていなければ、フェッチアドレスバッファ38にその条件分岐命令の予測側アドレスと非予測側アドレスをセットして、内部バスの空きサイクルなどを利用して、予測側の命令と非予測側の命令の双方をフェッチしていく。一方、非予測側命令フェッチの抑止が指示されているときは、フェッチアドレス生成回路20は、フェッチアドレスバッファ38にその条件分岐命令の予測側アドレスをセットして、内部バスの空きサイクルなどを利用して予測側の命令をフェッチし、非予測側命令のフェッチは行なわない。その条件分岐命令の条件分岐方向の確定情報はパイプライン実行部から信号18によりフェッチ制御部4に返され、フェッチ制御部4はその予測の当否に従って対応する予測情報33の確度または予測方向を更新する。信号18は条件分岐命令のE3ステージで生成され、この情報により、確定した条件分岐命令のアドレスに対応する分岐予測テーブルの予情報が更新される。   FIG. 4 illustrates a configuration for instruction fetch control according to the fetch mode. The instruction address to be fetched here is generated by a fetch address generation circuit 20 that generates a prefetch address preceding a plurality of instructions with respect to the execution instruction address executed by the pipeline execution unit 6. The generated fetch address is held in the fetch address buffer (FABUF) 38, the fetch address FADR is output to the internal bus 4, and the instruction INST is fetched from the cache memory 2. Instruction fetch is performed using an empty cycle of the internal bus 4. The fetch address generation circuit 20 searches for a conditional branch instruction from the instructions fetched to the instruction buffer 15. When the conditional branch instruction is searched, the instruction address of the conditional branch instruction is held in the conditional branch instruction address buffer 31. The conditional branch instruction address held in the conditional branch instruction address buffer 31 is used for associative access to the branch prediction table (branch prediction information table section) 32. The branch prediction table 32 has a plurality of table entries indexed by index addresses of a plurality of lower bits of an instruction address, and the indexed table entry is a plurality of branches that can be selected by an offset address of the lower bits of the instruction address. Predictive information 33 is held. The branch prediction information held in the branch prediction table 32 has a correlation with the instruction address. Here, the branch prediction information 33 has a plurality of bits, and the value represents the prediction direction and the accuracy of the prediction. The branch prediction information is updated in a direction reflecting the actual branch state with respect to the branch prediction of the corresponding conditional branch instruction. Details of the branch prediction information update will be described later. The branch prediction information 33 read from the branch prediction table 32 is supplied to the fetch direction determination unit 34 and the fetch suppression unit 36. The fetch direction determination unit 34 generates a predicted fetch signal 35 indicating the predicted direction of instruction fetch according to the branch prediction information. For example, the prediction fetch signal 35 is at a high level when the prediction direction is on the branch taken (taken) side, and is at a low level when the prediction direction is on the not taken branch side. The fetch suppression unit 36 inputs the value of the fetch mode switching bit 17 and the branch prediction information 33. In the first fetch mode, the non-prediction side fetch suppression signal 37 is negated (deactivated level), and the non-prediction side instruction Allow fetching. In the second fetch mode, the accuracy of the prediction direction is determined from the branch prediction information 33. When it is determined that the accuracy is high, the non-prediction side fetch suppression signal is asserted (set to the activation level), and the non-prediction side instruction fetch. Instructs suppression. When it is determined that the accuracy of the prediction direction determined from the branch prediction information 33 in the second fetch mode is low, the non-prediction side fetch suppression signal is negated to instruct permission of the non-prediction side instruction fetch. The fetch address generation circuit 20 to which the prediction fetch signal 35 and the non-prediction side fetch suppression signal 37 are given is not instructed to suppress the non-prediction side instruction fetch, and the fetch side buffer 38 has the prediction side address of the conditional branch instruction. And the non-prediction side address are set, and both the prediction side instruction and the non-prediction side instruction are fetched using an empty cycle of the internal bus. On the other hand, when it is instructed to inhibit fetching of the non-predictive instruction, the fetch address generation circuit 20 sets the predictive address of the conditional branch instruction in the fetch address buffer 38 and uses an empty cycle of the internal bus. Thus, the prediction side instruction is fetched, and the non-prediction side instruction is not fetched. The decision information of the conditional branch direction of the conditional branch instruction is returned from the pipeline execution unit to the fetch control unit 4 by a signal 18, and the fetch control unit 4 updates the accuracy or the prediction direction of the corresponding prediction information 33 according to the prediction success / failure. To do. The signal 18 is generated at the E3 stage of the conditional branch instruction. With this information, the preliminary information of the branch prediction table corresponding to the address of the confirmed conditional branch instruction is updated.

図5には前記分岐予測情報を活用した命令フェッチフローが例示される。パイプラインステージのI2及びPDステージでのフローは、S1、S2,S3,S4のステップで構成され、パイプラインステージのI1ステージは、S5、S6,S7のステップで構成される。ステップS1では、命令バッファ15を検索して条件分岐命令を検出する。S2では、検出された分岐命令のアドレスから分岐予測テーブル32を引き、当該条件分岐命令の分岐予測方向および予測の確度を取得する。S3では、フェッチモード切替ビット17により第2フェッチモードが指示されているかを判定する。第2フェッチモードが指示されているとき、S4において、当該条件分岐の予測確度が高いかを判定する。S4で当該条件分岐予測の予測確度が高いと判定された場合、S6で、予測側の命令をフェッチし、以降の空きサイクルでの非予測側の命令フェッチを抑止する。S4で当該条件分岐予測の予測確度が低いと判定された場合、または、S3でフェッチモードが第1フェッチモードと判定された場合には、S5において予測側の命令をフェッチし、以降の空きサイクルでの非予測側の命令フェッチを抑止しない。図5のフローでは、パイプラインステージのI2ステージでのフローは、S1、S2,S3,S4のステップで構成され、当該ステージで条件分岐命令が検出された場合、当該条件分岐命令の分岐先または非分岐先命令のI1ステージが、S5、S6,S7のステップで構成される。   FIG. 5 illustrates an instruction fetch flow utilizing the branch prediction information. The flow in the pipeline stage I2 and PD stages is composed of steps S1, S2, S3, and S4, and the pipeline stage I1 stage is composed of steps S5, S6, and S7. In step S1, the instruction buffer 15 is searched to detect a conditional branch instruction. In S2, the branch prediction table 32 is subtracted from the address of the detected branch instruction, and the branch prediction direction and the prediction accuracy of the conditional branch instruction are acquired. In S3, it is determined whether or not the second fetch mode is instructed by the fetch mode switching bit 17. When the second fetch mode is instructed, it is determined in S4 whether the prediction accuracy of the conditional branch is high. If it is determined in S4 that the prediction accuracy of the conditional branch prediction is high, in S6, the instruction on the prediction side is fetched, and the instruction fetch on the non-prediction side in the subsequent empty cycle is suppressed. If it is determined in S4 that the prediction accuracy of the conditional branch prediction is low, or if the fetch mode is determined to be the first fetch mode in S3, the instruction on the prediction side is fetched in S5, and the subsequent empty cycle Do not suppress instruction fetch on the non-prediction side. In the flow of FIG. 5, the flow in the I2 stage of the pipeline stage is composed of steps S1, S2, S3, and S4. When a conditional branch instruction is detected in the stage, the branch destination of the conditional branch instruction or The I1 stage of the non-branch destination instruction is composed of steps S5, S6, and S7.

ここで、前記フェッチ制御部4は第1フェッチモードにおいて条件分岐命令における分岐予測側の命令をN1個と分岐非予測側の命令をN2個フェッチするとき、第2フェッチモードにおいて条件分岐命令に対する予測確度を示す情報が高い予測確度を示しているときには、予測側の命令をN3個フェッチする。このとき、N3<N1,N2に関係を満足することが望ましい。無駄な命令フェッチを省いて低消費電力を企図する観点よりすれば、確度が高い場合であっても非予測側命令を併せてフェッチする場合よりも多い数の予測側の命令をフェッチしたのでは、低消費電力効果を十分に発揮できなくなる虞があるからである。   Here, when the fetch control unit 4 fetches N1 branch prediction side instructions and N2 branch non-prediction side instructions in the conditional branch instruction in the first fetch mode, the fetch control unit 4 predicts the conditional branch instruction in the second fetch mode. When the information indicating the accuracy indicates a high prediction accuracy, N3 instructions on the prediction side are fetched. At this time, it is desirable to satisfy the relationship of N3 <N1, N2. From the point of view of low power consumption by eliminating unnecessary instruction fetches, even if the accuracy is high, fetching more predictor instructions than when fetching non-predictor instructions together This is because the low power consumption effect may not be sufficiently exhibited.

図6には分岐予測情報の意義と予測確度の算出方法が示される。分岐予測テーブルに格納される分岐予測情報は33は、2ビットの予測ビットにより構成されている。たとえば、分岐予測情報33のエントリ数は256個などとされる。分岐予測情報33の状態は対応する条件分岐命令の過去の分岐成立(Taken)、分岐不成立(Not Taken)に対する予測の履歴を反映した値を保持する。各分岐予測情報の予測状態は4つある。状態0は分岐不成立(NotTaken)強予測であり、条件分岐の方向としては、NotTaken方向の確度が高い状態を示す。状態1は分岐不成立(NotTaken)弱予測であり、条件分岐の方向としては、NotTaken方向の予測であるが、その確度は低い状態を示す。状態2は分岐成立(Taken)弱予測であり、条件分岐の方向としては、Taken方向の予測であるが、その確度は低い状態を示す。状態3は分岐成立(Taken)強予測であり、条件分岐の方向としては、Taken方向の確度が高い状態を示す。2ビットの予測情報33の遷移は、当該条件分岐命令の確定した分岐方向がTakenであれば、1加算し、ビット最大値に到達すれば、最大値に飽和させる。また当該条件分岐命令の確定した分岐方向がNotTakenであれば、1減算し、ビット最小値に到達すれば、最小値に飽和させる。本予測情報33の更新タイミングは、現在予測されている条件分岐命令の方向が確定する時点であり、この条件分岐方向の確定情報はパイプライン実行部から信号18により反映される。この情報は、条件分岐命令のE3ステージで生成される。   FIG. 6 shows the significance of the branch prediction information and the calculation method of the prediction accuracy. The branch prediction information 33 stored in the branch prediction table is composed of two prediction bits. For example, the number of entries in the branch prediction information 33 is 256. The state of the branch prediction information 33 holds a value reflecting the history of prediction for the past branch establishment (Taken) and branch failure (Not Taken) of the corresponding conditional branch instruction. There are four prediction states for each branch prediction information. The state 0 is branch failure failure (NotTaken) strong prediction, and indicates the state in which the accuracy of the NotTaken direction is high as the direction of the conditional branch. State 1 is a weak prediction of branch failure (NotTaken), and the conditional branch direction is prediction of the NotTaken direction, but the accuracy is low. State 2 is weak prediction of branch establishment (Taken), and the direction of conditional branch is prediction of Taken direction, but the accuracy is low. State 3 is branch prediction (Taken) strong prediction, and the condition branch direction indicates a state in which the accuracy in the Taken direction is high. The transition of the 2-bit prediction information 33 is incremented by 1 if the determined branch direction of the conditional branch instruction is Taken, and saturated to the maximum value when the bit maximum value is reached. If the determined branch direction of the conditional branch instruction is NotTaken, 1 is subtracted, and when the bit minimum value is reached, it is saturated to the minimum value. The update timing of the prediction information 33 is a point in time when the direction of the currently predicted conditional branch instruction is fixed, and this conditional branch direction determination information is reflected by the signal 18 from the pipeline execution unit. This information is generated at the E3 stage of the conditional branch instruction.

図7には制御レジスタ16のフェッチモード切り替えビット17が例示される。フェッチモード切替ビット17はCPUの制御レジスタ16における所定のビットフィールドに定義され、本ビットが論理値0のとき、非予測側の命令フェッチを抑止しない第1フェッチモードを指定し、本ビットが論理値1のとき、非予測側の命令フェッチを選択的に抑止する第2フェッチモードを指定する。この制御レジスタ16のフェッチモード切替ビット17の値により、命令フェッチ制御部4は、条件分岐命令の分岐先および非分岐先命令のフェッチ動作を変えることが可能になる。   FIG. 7 illustrates the fetch mode switching bit 17 of the control register 16. The fetch mode switching bit 17 is defined in a predetermined bit field in the control register 16 of the CPU, and when this bit is a logical value 0, it designates the first fetch mode that does not inhibit the instruction fetch on the non-prediction side, and this bit is logical When the value is 1, the second fetch mode for selectively inhibiting instruction fetching on the non-prediction side is designated. Depending on the value of the fetch mode switching bit 17 of the control register 16, the instruction fetch control unit 4 can change the fetch operation of the branch destination of the conditional branch instruction and the non-branch destination instruction.

図8には命令フェッチモードを制御する命令列を例示する。命令列81および命令列82に示すCPU命令により、プログラムから命令フェッチモードの切替が可能となる。第1フェッチモードの設定命令列82では、フェッチモード切替ビット17を保持する制御レジスタ16のアドレスをロードし、制御レジスタの値をロードし、当該モード値を第1フェッチモードの値(論理値0)に変更した値を制御ビット17に書き込むことで、第1フェッチモードを設定する。第2フェッチモードの設定命令列81では、フェッチモード切替ビット17を保持する制御レジスタ16のアドレスをロードし、制御レジスタの値をロードし、当該モード値を第2フェッチモードの値(論理値1)に変更した値を制御ビット17に書き込むことで、第2フェッチモードを設定する。要するに、命令で制御レジスタ16の制御ビット17を書き換えることにより命令フェッチモードを動的に切り替え可能である。   FIG. 8 illustrates an instruction sequence for controlling the instruction fetch mode. The instruction fetch mode can be switched from the program by the CPU instructions shown in the instruction sequence 81 and the instruction sequence 82. In the first fetch mode setting instruction sequence 82, the address of the control register 16 holding the fetch mode switching bit 17 is loaded, the value of the control register is loaded, and the mode value is set to the value of the first fetch mode (logical value 0). The first fetch mode is set by writing the changed value to the control bit 17. In the second fetch mode setting instruction sequence 81, the address of the control register 16 holding the fetch mode switching bit 17 is loaded, the value of the control register is loaded, and the mode value is set to the value of the second fetch mode (logical value 1). The second fetch mode is set by writing the changed value to the control bit 17. In short, the instruction fetch mode can be dynamically switched by rewriting the control bit 17 of the control register 16 with an instruction.

図9には図8のような命令フェッチモードの制御コードの生成方法が示される。ここでは、低消費電力で動作させたいプログラムの実行に合わせて第2フェッチモードを選択できるようにする。ステップT1にて、対象となるプログラムをコンパイルする。T2にてT1で生成されたプログラムをシミュレータで実行し、ソースコード上の関数単位での経過サイクル数などの実行プロファイルを取得する。T3にて、実行プロファイルを解析し、実行サイクル数の大きな関数を選択する。T4にて、当該関数の分岐予測ヒット率が高いかを判断する。もし、当該関数の分岐予測ヒット率が高ければ、T5にて、ソースファイルの書き換えを行なう。これは、当該関数での命令フェッチモードを低消費電力向けの第2フェッチモードにする命令コードを当該関数の開始ポイントに挿入を指示するプラグマ指示文の挿入で実現される。T4にて当該関数の分岐予測ヒット率が低ければ、第1フェッチモードのコードを挿入するが、運用上、第1フェッチモードがデフォルトの設定とすれば、当該関数のソースコードでは書き換え不要となる。T6にて、プログラムを再コンパイルすることにより、プログラムの低消費電力向けコンパイルが完了する。この方法により、ソフトウエアプログラマがフェッチモードの切替を制御する命令列をソフトウエアに組み込むことが可能となる。   FIG. 9 shows a method for generating a control code in the instruction fetch mode as shown in FIG. Here, the second fetch mode can be selected in accordance with the execution of the program to be operated with low power consumption. In step T1, the target program is compiled. At T2, the program generated at T1 is executed by the simulator, and an execution profile such as the number of elapsed cycles in function units on the source code is acquired. At T3, the execution profile is analyzed and a function having a large number of execution cycles is selected. At T4, it is determined whether the branch prediction hit rate of the function is high. If the branch prediction hit rate of the function is high, the source file is rewritten at T5. This is realized by inserting a pragma directive that instructs insertion of an instruction code for setting the instruction fetch mode in the function into the second fetch mode for low power consumption at the start point of the function. If the branch prediction hit rate of the function is low at T4, the code of the first fetch mode is inserted. However, if the first fetch mode is set to the default setting in operation, the source code of the function does not need to be rewritten. . At T6, recompiling the program completes compiling the program for low power consumption. With this method, it is possible for a software programmer to incorporate an instruction sequence for controlling fetch mode switching into the software.

図10には前記ソースコード上での命令フェッチモード設定プラグマ指示文の例を示す。プラグマとはコンパイラに特定の情報を渡すために使用するコンパイラ指令であり、これによってコンパイル内容を詳細に制御できる。図10のコード100において、関数“func0 ( )”を命令の第2フェッチモードでコンパイルする場合は、プラグマ指示文“#pragma fetch_mode_2 (func0)”をソースコードに記述する。当該プラグマ指示文を認識するコンパイラはコード101に示す命令列を生成する。   FIG. 10 shows an example of an instruction fetch mode setting pragma directive on the source code. A pragma is a compiler directive that is used to pass specific information to the compiler, which allows detailed control of the compilation. In the code 100 of FIG. 10, when the function “func0 ()” is compiled in the second fetch mode of the instruction, the pragma directive “#pragma fetch_mode_2 (func0)” is described in the source code. A compiler that recognizes the pragma directive generates an instruction sequence indicated by code 101.

以上説明した分岐予測を用いたフェッチ制御部5によれば、条件分岐命令の実行において、予測側の命令フェッチおよび非予測側の命令フェッチを行なう第1フェッチモードでは、条件分岐予測がミスしても、非予測側の命令フェッチが行われているため、条件分岐予測ミス時のパイプラインにおけるストールサイクル数が低減されプログラムの高速実行に寄与する。条件分岐命令の実行において、条件分岐方向を示す予測ビットの状態に応じて、非予測側の命令フェッチをする、しないを決定して命令フェッチ動作を行なえる第2フェッチモードでは、条件分岐方向を示す予測ビットの状態に応じて、その条件分岐予測が高い確率でヒットすると判断される場合に、非予測側の命令フェッチを抑止するため、プログラムの実行において、実際には必要とされない命令のフェッチ回数が抑止されメモリ読み出し回数が低減され、メモリ読み出しに必要な電力が低減される。第2のフェッチモードでは、条件分岐予測が高い確率でヒットすると予測される場合、非予測側の命令フェッチを抑止して、メモリ読み出し回数を低減でき、消費電力低減に効果がある。また、条件分岐予測が低い確率でヒットすると予測される場合は、非予測側の命令フェッチも行なうため、実際に予測がはずれた場合でも、非予測側の命令フェッチがすでに行なわれているので実際の分岐方向の命令列の実行に課せられるパイプラインストール サイクル数が低減され、高速実行が可能である。フェッチモードは切り替えビット17により可変可能であり、第2フェッチモードにおいて前記非予測側命令に対するフェッチの抑止は前記予測情報33に応じて選択的に行うことが可能であるから、低消費電力とプログラムの高速実行との要求に対して柔軟に対応することができる。   According to the fetch control unit 5 using the branch prediction described above, the conditional branch prediction is missed in the first fetch mode in which the instruction fetch on the prediction side and the instruction fetch on the non-prediction side are performed in the execution of the conditional branch instruction. However, since the instruction fetch on the non-prediction side is performed, the number of stall cycles in the pipeline at the time of a conditional branch prediction error is reduced, which contributes to high-speed program execution. In execution of a conditional branch instruction, in the second fetch mode in which the instruction fetch operation can be performed by determining whether or not to fetch an instruction on the non-prediction side according to the state of the prediction bit indicating the conditional branch direction, the conditional branch direction is set to Fetch instructions that are not actually needed in program execution in order to suppress non-predicted instruction fetches when it is determined that the conditional branch prediction will hit with a high probability according to the state of the prediction bit indicated The number of times of memory reading is reduced and the number of times of memory reading is reduced, and the power required for memory reading is reduced. In the second fetch mode, when it is predicted that the conditional branch prediction will be hit with a high probability, the instruction fetch on the non-prediction side can be suppressed to reduce the number of memory reads, which is effective in reducing power consumption. In addition, if the conditional branch prediction is predicted to hit with a low probability, the instruction fetch on the non-prediction side is also performed. Therefore, even if the prediction actually deviates, the instruction fetch on the non-prediction side has already been performed. The number of pipeline installation cycles imposed on the execution of the instruction sequence in the branch direction is reduced, and high-speed execution is possible. The fetch mode can be changed by the switching bit 17, and in the second fetch mode, it is possible to selectively suppress fetch for the non-prediction side instruction in accordance with the prediction information 33. It is possible to respond flexibly to requests for high-speed execution.

図11にはフェッチ制御部4の別の構成が示される。図4との相違点は、予測情報33Aのビット数を1ビットにして分岐予測テーブル32Aのサイズを小さくし或いはエントリ数を増加し、また、分岐予測に対す確度を指標するために分岐予測に対するヒット又はミスの分岐結果をシフト入力して最新より複数の分岐結果を分岐履歴情報22として保持するシフトレジスタ部21を採用したことである。前記分岐予測情報33Aはその値に応じて条件分岐の予測方向を示す。論理値0は分岐不成立(not taken)予測、論理値1は分岐成立(taken)予測を意味する。パイプラインステージI2において、フェッチアドレス生成回路20は条件分岐命令を検索する。条件分岐命令のアドレスはバッファ31に格納され、その条件分岐命令のTaken側アドレスおよびNotTaken側アドレスは条件分岐命令のアドレスと対応付けられてフェッチアドレスバッファ38に格納される。条件分岐命令の命令フェッチアドレスの一部を用いて分岐予測テーブル32Aをアクセスする。分岐予測テーブル32Aは、前述の如く命令アドレスと相関を有して予測情報を保持する連想メモリとされる。フェッチ方向判定部34Aは分岐予測テーブル32Aから出力された予測情報33Aを入力し、その論理値に応じて予測フェッチ信号45を生成する。また、フェッチ抑止部36Aは、シフトレジスタ部21から分岐ヒットの大域的な履歴を表す分岐履歴情報22を入力し、分岐予測確度を過去の分岐履歴から判定し、非予測側の命令フェッチ抑止信号37を生成する。条件分岐方向の確定情報はパイプライン実行部から信号18により反映される。この情報は、条件分岐命令のE3ステージで生成される。この情報により、確定した条件分岐命令のアドレスに対応する分岐予測情報テーブル32Aが更新される。また、信号18の情報によりシフトレジスタ部21の分岐履歴情報22が1ビットシフト入力されて更新される。   FIG. 11 shows another configuration of the fetch control unit 4. The difference from FIG. 4 is that the number of bits of the prediction information 33A is set to 1 bit, the size of the branch prediction table 32A is reduced or the number of entries is increased, and the branch prediction is used to index the accuracy for branch prediction. The shift register unit 21 that shift-inputs the hit result or the miss result and holds a plurality of branch results as the branch history information 22 from the latest is adopted. The branch prediction information 33A indicates the prediction direction of the conditional branch according to the value. A logical value of 0 means branch not taken (not taken) prediction, and a logical value of 1 means branch taken (taken) prediction. In the pipeline stage I2, the fetch address generation circuit 20 searches for a conditional branch instruction. The address of the conditional branch instruction is stored in the buffer 31, and the Taken side address and NotTaken side address of the conditional branch instruction are stored in the fetch address buffer 38 in association with the address of the conditional branch instruction. The branch prediction table 32A is accessed using a part of the instruction fetch address of the conditional branch instruction. The branch prediction table 32A is an associative memory that retains prediction information in correlation with the instruction address as described above. The fetch direction determination unit 34A receives the prediction information 33A output from the branch prediction table 32A, and generates a prediction fetch signal 45 according to the logical value. Further, the fetch suppression unit 36A receives the branch history information 22 representing the global history of branch hits from the shift register unit 21, determines the branch prediction accuracy from the past branch history, and determines the instruction fetch suppression signal on the non-prediction side. 37 is generated. The decision information of the conditional branch direction is reflected by the signal 18 from the pipeline execution unit. This information is generated at the E3 stage of the conditional branch instruction. With this information, the branch prediction information table 32A corresponding to the address of the confirmed conditional branch instruction is updated. Further, the branch history information 22 of the shift register unit 21 is shifted by 1 bit and updated by the information of the signal 18.

図12にはシフトレジスタ部21が保有する分岐履歴情報22とそれによる分岐予測確度の判定動作を示す。例えば分岐履歴情報は4ビットから構成されており、現在の条件分岐命令より過去の予測成功を論理値1で表し、予測失敗を論理値0で表すビットを4つ保持する。図の右側から左側ビットに行くほど過去の情報を示し、各条件分岐命令の方向が確定するパイプラインステージで、確定した予測成功・失敗を示すビットを左側にシフトインする。条件分岐予測確度は、このシフトレジスタ部21が保有する分岐履歴情報22の状態により判定する。例えば、過去4回の予測のうち、3回成功していたら、すなわち、論理値1のビットが3つ以上あったら、現在の条件分岐予測の確度は高いと判定する。このシフトレジスタ22の更新タイミングは、現在予測されている条件分岐命令の方向が確定する時点であり、条件分岐命令のE3ステージで生成される。また、過去4回の予測のうち、予測成功が3回未満なら、すなわち、論理値1がたつビットが3個未満なら、現在の条件分岐予測の確度は低いと判定する。一般に、シフトレジスタ22のビット数はNビットとし、確度判定の閾値は論理値1がたつビット数をMビットとし、それ以上で現在の条件分岐予測の確度が高いと判定し、それ未満で当該確度が低いと判定することによって実現することができる。第2フェッチモードでは前述と同様に、予測確度が高い場合には非予測方向の命令フェッチを抑止し、予測方向の命令フェッチを行なう。予測角度が低い場合には予測方向及び非予測方向双方の命令フェッチを行なう。   FIG. 12 shows branch history information 22 held by the shift register unit 21 and a branch prediction accuracy determination operation based on the branch history information 22. For example, the branch history information is composed of 4 bits, and holds four bits representing a past prediction success with a logical value 1 and a prediction failure with a logical value 0 from the current conditional branch instruction. In the pipeline stage in which past information is shown from the right side of the figure to the left side bit and the direction of each conditional branch instruction is decided, the bit indicating the confirmed prediction success / failure is shifted in to the left side. The conditional branch prediction accuracy is determined based on the state of the branch history information 22 held by the shift register unit 21. For example, if the prediction has been successful three times in the past four predictions, that is, if there are three or more bits of logical value 1, it is determined that the accuracy of the current conditional branch prediction is high. The update timing of the shift register 22 is the time when the direction of the currently predicted conditional branch instruction is determined, and is generated at the E3 stage of the conditional branch instruction. If the prediction success is less than 3 times among the 4 predictions in the past, that is, if the number of bits with one logical value 1 is less than 3, it is determined that the accuracy of the current conditional branch prediction is low. In general, the number of bits of the shift register 22 is N bits, and the threshold value for accuracy determination is M bits as the number of bits with a logical value of 1; This can be realized by determining that the accuracy is low. In the second fetch mode, as described above, when the prediction accuracy is high, instruction fetch in the non-prediction direction is suppressed and instruction fetch in the prediction direction is performed. When the prediction angle is low, instruction fetch in both the prediction direction and the non-prediction direction is performed.

以上本発明者によってなされた発明を実施形態に基づいて具体的に説明したが、本発明はそれに限定されるものではなく、その要旨を逸脱しない範囲において種々変更可能であることは言うまでもない。   Although the invention made by the present inventor has been specifically described based on the embodiments, it is needless to say that the present invention is not limited thereto and can be variously modified without departing from the gist thereof.

例えば、分岐予測情報のビット数は上記1ビット又は2ビットに限定されない。分岐履歴情報も4ビットに限定されない。パイプライン段数、1回の命令フェッチでフェッチ可能な命令数も適宜変更可能である。更にデータプロセッサが保有する回路モジュールは図1に限定されず、例えばプロセッサコアに浮動小数点演算ユニットを含んだり、周辺回路バスを持たなかったり、別の周辺モジュールを備えたり、といった種々の変形が可能である。データプロセッサは汎用のマイクロプロセッサだけでなく、システムオンチップの特定制御用とに特化した半導体集積回路であってもよい。   For example, the number of bits of the branch prediction information is not limited to the above 1 bit or 2 bits. The branch history information is not limited to 4 bits. The number of pipeline stages and the number of instructions that can be fetched by one instruction fetch can be changed as appropriate. Further, the circuit modules possessed by the data processor are not limited to those shown in FIG. 1, and various modifications such as including a floating-point arithmetic unit in the processor core, no peripheral circuit bus, and other peripheral modules are possible. It is. The data processor may be not only a general-purpose microprocessor but also a semiconductor integrated circuit specialized for system-on-chip specific control.

データプロセッサの一例を示すブロック図である。It is a block diagram which shows an example of a data processor. 第1フェッチモードが選択されているとき、予測された分岐方向の命令フェッチ及び非予測側の命令フェッチを発行し、内部バス経由でフェッチされた命令を命令バッファ15に格納するときのパイプラインステージを例示する動作説明図である。When the first fetch mode is selected, a pipeline stage for issuing an instruction fetch in the predicted branch direction and an instruction fetch on the non-prediction side and storing the instruction fetched via the internal bus in the instruction buffer 15 It is operation | movement explanatory drawing which illustrates these. 第2フェッチモードが選択されているとき、分岐予測の確度が高い場合には非予測側の命令ストリームのフェッチを抑止するときのパイプラインステージを例示する動作説明図である。When the second fetch mode is selected, when the accuracy of branch prediction is high, it is an operation explanatory diagram illustrating the pipeline stage when the fetch of the instruction stream on the non-prediction side is suppressed. フェッチモードに従った命令フェッチ制御のための構成を例示するブロック図である。It is a block diagram which illustrates the structure for the instruction fetch control according to fetch mode. 分岐予測情報を活用した命令フェッチフローを例示するフローチャートである。It is a flowchart which illustrates the instruction fetch flow using branch prediction information. 分岐予測情報の意義と予測確度の算出方法を例示する説明図である。It is explanatory drawing which illustrates the calculation method of the significance of branch prediction information, and prediction accuracy. フェッチモー切り替えビットを有する制御レジスタのフォーマット図である。It is a format diagram of a control register having a fetch mode switching bit. 命令フェッチモードを制御する命令列を例示する説明図である。It is explanatory drawing which illustrates the instruction sequence which controls instruction fetch mode. 命令フェッチモードの制御コードの生成方法を示すフローチャートである。It is a flowchart which shows the production | generation method of the control code of instruction fetch mode. ソースコード上での命令フェッチモード設定プラグマ指示文を例示する説明図である。It is explanatory drawing which illustrates the instruction fetch mode setting pragma directive in a source code. フェッチ制御部の別の構成を例示するブロック図である。It is a block diagram which illustrates another composition of a fetch control part. シフトレジスタ部が保有する分岐履歴情報とそれによる分岐予測確度の判定動作を示す説明図である。It is explanatory drawing which shows the branch history information which a shift register part holds, and the determination operation | movement of the branch prediction accuracy by it.

符号の説明Explanation of symbols

1 プロセッサコア
2 キャッシュメモリ
4 内部バス
5 フェッチ制御部
6 パイプライン実行部
7 データプロセッサ
13 バスステートコントローラ
15 命令バッファ
16 制御レジスタ
17 フェッチモード切替ビット
20 フェッチアドレス生成回路
31 条件分岐命令アドレスバッファ
32,32A 分岐予測テーブル(予測情報テーブル)
33,33A 分岐予測情報
34,34A フェッチ方向判定部
35 予測フェッチ信号
36,36A フェッチ抑止部
37 非予測側フェッチ抑止信号
38 フェッチアドレスバッファ
DESCRIPTION OF SYMBOLS 1 Processor core 2 Cache memory 4 Internal bus 5 Fetch control part 6 Pipeline execution part 7 Data processor 13 Bus state controller 15 Instruction buffer 16 Control register 17 Fetch mode switching bit 20 Fetch address generation circuit 31 Condition branch instruction address buffer 32, 32A Branch prediction table (prediction information table)
33, 33A Branch prediction information 34, 34A Fetch direction determination unit 35 Predictive fetch signal 36, 36A Fetch suppression unit 37 Non-prediction side fetch suppression signal 38 Fetch address buffer

Claims (14)

命令のフェッチ制御部と、前記フェッチ制御部によりフェッチされた命令を保持する命令バッファと、前記命令バッファに保持された命令を所定の順番にパイプラインで実行する実行部とを含み、
前記フェッチ制御部は、分岐命令の命令アドレスを用いて条件分岐の予測方向とその確度を示す予測情報を取得し、条件分岐命令における分岐予測側の命令のフェッチと分岐非予測側の命令のフェッチを行なうことが可能であると共に、前記予測情報に応じて選択的に分岐非予測側の命令のフェッチを抑止するデータプロセッサ。
An instruction fetch control unit, an instruction buffer that holds an instruction fetched by the fetch control unit, and an execution unit that executes the instructions held in the instruction buffer in a predetermined order in a pipeline,
The fetch control unit obtains prediction information indicating a prediction direction and accuracy of a conditional branch using an instruction address of the branch instruction, fetches a branch prediction side instruction and a branch non-prediction side instruction in the conditional branch instruction. And a data processor that selectively inhibits fetching of instructions on the branch non-prediction side according to the prediction information.
前記フェッチ制御部は、前記予測情報による分岐予測の確度が相対的に高いときに前記非予測側の命令のフェッチを抑止する請求項1記載のデータプロセッサ。 The data processor according to claim 1, wherein the fetch control unit suppresses fetching of the non-prediction side instruction when the accuracy of branch prediction based on the prediction information is relatively high. 命令のフェッチ制御部と、前記フェッチ制御部によりフェッチされた命令を保持する命令バッファと、前記命令バッファに保持された命令を所定の順番にパイプラインで実行する実行部とを含み、
前記フェッチ制御部は、分岐命令の命令アドレスを用いて条件分岐の予測方向とその確度を示す予測情報を取得し、条件分岐命令における分岐予測側の命令のフェッチと分岐非予測側の命令のフェッチの双方を行なう第1フェッチモードと、前記分岐予測側の命令のフェッチを行なうと共に前記予測情報に応じて選択的に分岐非予測側の命令のフェッチを抑止する第2フェッチモードとの選択が可能にされるデータプロセッサ。
An instruction fetch control unit, an instruction buffer that holds an instruction fetched by the fetch control unit, and an execution unit that executes the instructions held in the instruction buffer in a predetermined order in a pipeline,
The fetch control unit obtains prediction information indicating a prediction direction and accuracy of a conditional branch using an instruction address of the branch instruction, fetches a branch prediction side instruction and a branch non-prediction side instruction in the conditional branch instruction. The first fetch mode that performs both of the above and the second fetch mode that fetches the instruction on the branch prediction side and selectively suppresses fetching of the instruction on the branch non-prediction side according to the prediction information can be selected. Data processor.
前記フェッチ制御部は、第2フェッチモードにおいて前記予測情報による分岐予測の確度が相対的に高いときに前記非予測側の命令のフェッチを抑止する請求項3記載のデータプロセッサ。 4. The data processor according to claim 3, wherein the fetch control unit suppresses fetching of the instruction on the non-prediction side when the accuracy of branch prediction based on the prediction information is relatively high in the second fetch mode. 設定値に応じて前記第1フェッチモード又は第2フェッチモードを指定する制御レジスタを有する請求項4記載のデータプロセッサ。 5. The data processor according to claim 4, further comprising a control register for designating the first fetch mode or the second fetch mode according to a set value. 前記制御レジスタの設定値は前記実行部による命令実行により可変である請求項5記載のデータプロセッサ。 6. The data processor according to claim 5, wherein the set value of the control register is variable by instruction execution by the execution unit. 前記予測情報は複数ビットを有し、その値の違いによって各々異なる分岐予測及びその確度を表し、
前記フェッチ制御部は、条件分岐命令の命令アドレスの一部を用いてインデックスされ、前記予測情報を複数格納する予測情報テーブル部を有し、
前記フェッチ制御部は、条件分岐命令の分岐が確定したとき、その条件分岐命令を用いてインデックスされた予測情報がヒットであった場合には当該予測情報をその予測の最高確度を限度に当該確度が高くなる方向に更新し、その条件分岐命令を用いてインデックスされた予測情報がミスであった場合には当該予測情報をその予測の確度が低くなる方向に更新する請求項6記載のデータプロセッサ。
The prediction information has a plurality of bits, each representing a different branch prediction and its accuracy according to the difference in value,
The fetch control unit includes a prediction information table unit that is indexed using a part of an instruction address of a conditional branch instruction and stores a plurality of the prediction information,
When the branch of the conditional branch instruction is confirmed, the fetch control unit, when the prediction information indexed using the conditional branch instruction is a hit, the prediction information is limited to the maximum accuracy of the prediction. The data processor according to claim 6, wherein the prediction information is updated in a direction in which the prediction accuracy decreases when the prediction information indexed using the conditional branch instruction is a miss. .
前記分岐予測情報の最大値は条件分岐命令における条件成立による分岐予測の確度最大を意味し、最小値は条件分岐命令における条件不成立による分岐予測の確度最大を意味する請求項7記載のデータプロセッサ。 8. The data processor according to claim 7, wherein the maximum value of the branch prediction information means the maximum accuracy of branch prediction due to the condition establishment in the conditional branch instruction, and the minimum value means the maximum accuracy of branch prediction due to the failure of the condition in the conditional branch instruction. 命令のフェッチ制御部と、前記フェッチ制御部によりフェッチされた命令を保持する命令バッファと、前記命令バッファに保持された命令を所定の順番にパイプラインで実行する実行部とを含み、
前記フェッチ制御部は、条件分岐命令の命令アドレスの一部を用いてインデックスされ、分岐予測情報を複数格納する予測情報テーブル部と、分岐予測に対するヒット又はミスの分岐結果をシフト入力して最新より複数の分岐結果を分岐履歴情報として保持するシフトレジスタ部とを有し、
前記分岐予測情報はその値に応じて条件分岐の予測方向を示し、
前記フェッチ制御部は、条件分岐命令における分岐予測側の命令のフェッチと分岐非予測側の命令のフェッチを行なうことが可能であると共に、前記シフトレジスタ部が保有する分岐履歴情報から分岐確度を判定し、分岐確度が高いときは分岐非予測側の命令のフェッチを抑止するデータプロセッサ。
An instruction fetch control unit, an instruction buffer that holds an instruction fetched by the fetch control unit, and an execution unit that executes the instructions held in the instruction buffer in a predetermined order in a pipeline,
The fetch control unit is indexed by using a part of the instruction address of the conditional branch instruction, and a prediction information table unit for storing a plurality of branch prediction information, and a shift result of a branch result of hit or miss for branch prediction is input from the latest A shift register unit that holds a plurality of branch results as branch history information;
The branch prediction information indicates the prediction direction of the conditional branch according to the value,
The fetch control unit can fetch a branch prediction side instruction and a branch non-prediction side instruction in a conditional branch instruction, and determine branch accuracy from branch history information held by the shift register unit. A data processor that suppresses fetching of instructions on the branch non-prediction side when the branch accuracy is high.
前記フェッチ制御部は、シフトレジスタ部が保有する分岐履歴情報の半分以上の分岐結果が予測ヒットを示しているとき、分岐予測の確度は高いと判定する請求項9記載のデータプロセッサ。 The data processor according to claim 9, wherein the fetch control unit determines that the accuracy of branch prediction is high when a branch result of more than half of the branch history information held by the shift register unit indicates a prediction hit. 命令のフェッチ制御部と、前記フェッチ制御部によりフェッチされた命令を保持する命令バッファと、前記命令バッファに保持された命令を所定の順番にパイプラインで実行する実行部とを含み、
前記フェッチ制御部は、条件分岐命令の命令アドレスの一部を用いてインデックスされ、分岐予測情報を複数格納する予測情報テーブル部と、分岐予測に対するヒット又はミスの分岐結果をシフト入力して最新より複数の分岐結果を分岐履歴情報として保持するシフトレジスタ部とを有し、
前記分岐予測情報はその値に応じて条件分岐の予測方向を示し、
前記フェッチ制御部は、分岐命令の命令アドレスを用いて条件分岐の予測方向を示す予測情報を取得し、条件分岐命令における分岐予測側の命令のフェッチと分岐非予測側の命令のフェッチの双方を行なう第1フェッチモードと、前記分岐予測側の命令のフェッチを行なうと共に前記シフトレジスタ部より取得した分岐履歴情報が高い分岐確度を示しているときは分岐非予測側の命令のフェッチを抑止する第2フェッチモードとの選択が可能にされるデータプロセッサ。
An instruction fetch control unit, an instruction buffer that holds an instruction fetched by the fetch control unit, and an execution unit that executes the instructions held in the instruction buffer in a predetermined order in a pipeline,
The fetch control unit is indexed by using a part of the instruction address of the conditional branch instruction, and a prediction information table unit for storing a plurality of branch prediction information, and a shift result of a branch result of hit or miss for branch prediction is input from the latest A shift register unit that holds a plurality of branch results as branch history information;
The branch prediction information indicates the prediction direction of the conditional branch according to the value,
The fetch control unit obtains prediction information indicating the prediction direction of the conditional branch using the instruction address of the branch instruction, and fetches both the branch prediction side instruction fetch and the branch non-prediction side instruction fetch in the conditional branch instruction. A first fetch mode to be performed, and fetching an instruction on the branch prediction side, and when branch history information acquired from the shift register unit indicates a high branch accuracy, fetching an instruction on the branch non-prediction side is suppressed. A data processor that enables selection between two fetch modes.
設定値に応じて前記第1フェッチモード又は第2フェッチモードを指定する制御レジスタを有する請求項11記載のデータプロセッサ。 12. The data processor according to claim 11, further comprising a control register for designating the first fetch mode or the second fetch mode according to a set value. 前記制御レジスタの設定値は前記実行部による命令実行により可変である請求項12記載のデータプロセッサ。 13. The data processor according to claim 12, wherein the set value of the control register is variable by instruction execution by the execution unit. 命令のフェッチ制御部と、前記フェッチ制御部によりフェッチされた命令を保持する命令バッファと、前記命令バッファに保持された命令を所定の順番にパイプラインで実行する実行部とを含み、
前記フェッチ制御部は、条件分岐命令における分岐予測側の命令をN1個と分岐非予測側の命令をN2個フェッチする第1のフェッチ機能と、条件分岐命令に対する予測確度を示す情報が高い予測確度を示しているときには、予測側の命令をN3個フェッチする第2のフェッチ機能を有し、N3<N1,N2であるデータプロセッサ。
An instruction fetch control unit, an instruction buffer that holds an instruction fetched by the fetch control unit, and an execution unit that executes the instructions held in the instruction buffer in a predetermined order in a pipeline,
The fetch control unit includes a first fetch function for fetching N1 branch prediction side instructions and N2 branch non-prediction side instructions in a conditional branch instruction, and information indicating a prediction accuracy for a conditional branch instruction with high prediction accuracy. , A data processor having a second fetch function for fetching N3 instructions on the prediction side and N3 <N1, N2.
JP2004226318A 2004-08-03 2004-08-03 Data processor Withdrawn JP2006048258A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004226318A JP2006048258A (en) 2004-08-03 2004-08-03 Data processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004226318A JP2006048258A (en) 2004-08-03 2004-08-03 Data processor

Publications (1)

Publication Number Publication Date
JP2006048258A true JP2006048258A (en) 2006-02-16

Family

ID=36026750

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004226318A Withdrawn JP2006048258A (en) 2004-08-03 2004-08-03 Data processor

Country Status (1)

Country Link
JP (1) JP2006048258A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013121516A1 (en) 2012-02-14 2013-08-22 ルネサスエレクトロニクス株式会社 Data processing device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013121516A1 (en) 2012-02-14 2013-08-22 ルネサスエレクトロニクス株式会社 Data processing device
US9542190B2 (en) 2012-02-14 2017-01-10 Renesas Electronics Corporation Processor with fetch control for stoppage

Similar Documents

Publication Publication Date Title
US10268480B2 (en) Energy-focused compiler-assisted branch prediction
JP5137948B2 (en) Storage of local and global branch prediction information
JP5579930B2 (en) Method and apparatus for changing the sequential flow of a program using prior notification technology
EP1889152B1 (en) A method and apparatus for predicting branch instructions
US6263427B1 (en) Branch prediction mechanism
US20070288733A1 (en) Early Conditional Branch Resolution
US20130346727A1 (en) Methods and Apparatus to Extend Software Branch Target Hints
JP5231403B2 (en) Sliding window block based branch target address cache
US20120210107A1 (en) Predicated issue for conditional branch instructions
KR101026978B1 (en) Method and apparatus for managing a return stack
US20070288732A1 (en) Hybrid Branch Prediction Scheme
US20070288731A1 (en) Dual Path Issue for Conditional Branch Instructions
Evers et al. Understanding branches and designing branch predictors for high-performance microprocessors
US7627740B2 (en) Methods and apparatus for dynamic prediction by software
US20070288734A1 (en) Double-Width Instruction Queue for Instruction Execution
JP2020119504A (en) Branch predictor
JP2004503865A (en) Processor with selective branch prediction
KR20030066749A (en) Method and apparatus for processing program loops in parallel
JP2006048258A (en) Data processor
JP2006031697A (en) Branch target buffer and usage for the same
KR20060034998A (en) Apparatus and method for controling an access of branch predictor
US20060259752A1 (en) Stateless Branch Prediction Scheme for VLIW Processor
JP2004062427A (en) Microprocessor

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20071106