JP2006235723A - Instruction fetch circuit - Google Patents

Instruction fetch circuit Download PDF

Info

Publication number
JP2006235723A
JP2006235723A JP2005045661A JP2005045661A JP2006235723A JP 2006235723 A JP2006235723 A JP 2006235723A JP 2005045661 A JP2005045661 A JP 2005045661A JP 2005045661 A JP2005045661 A JP 2005045661A JP 2006235723 A JP2006235723 A JP 2006235723A
Authority
JP
Japan
Prior art keywords
instruction
branch
words
address
acquisition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2005045661A
Other languages
Japanese (ja)
Inventor
Kota Takamatsu
幸太 高松
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.)
Sony Corp
Original Assignee
Sony 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 Sony Corp filed Critical Sony Corp
Priority to JP2005045661A priority Critical patent/JP2006235723A/en
Publication of JP2006235723A publication Critical patent/JP2006235723A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Advance Control (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To conduct branch prediction of a branch instruction formed of a plurality of words at a high speed in a processor of a pipeline system. <P>SOLUTION: The branch prediction is conducted at a stage that a part of the branch instruction formed of the plurality of the words is fetched. When branch prediction information is obtained from a branch target buffer (BTB) or the like, an instruction of a predicted branch destination is fetched without fetching a remaining part of the branch instruction. Thereby, the branch instruction formed of the plurality of the words is processed at an execution cycle of one word as long as the branch prediction succeeds. A penalty when the branch prediction is failed is same as in a case that the branch instruction is formed of one word. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

本発明は、命令フェッチ回路に関し、特にコンピュータプログラムに含まれる各命令をフェッチ(取得)するための命令フェッチ回路、命令フェッチ制御回路、プロセッサおよびコンピュータシステムに関する。   The present invention relates to an instruction fetch circuit, and more particularly to an instruction fetch circuit, an instruction fetch control circuit, a processor, and a computer system for fetching (acquiring) each instruction included in a computer program.

パイプライン方式のプロセッサでは、必要な処理を複数の段階(ステージ)に区切った命令パイプラインに対して、コンピュータプログラムに含まれる各命令を次々と投入することにより、各ステージにおける処理をオーバラップさせて性能を向上させている。従って、各命令が連続して命令パイプラインに投入されている状態であればその性能を発揮するが、分岐命令などにより命令の流れが乱れてしまうと本来の性能を発揮できなくなるおそれが生じる。   In a pipelined processor, each instruction included in a computer program is input one after another into an instruction pipeline that divides the necessary processing into multiple stages (stages), thereby overlapping the processes in each stage. To improve performance. Therefore, the performance is exhibited if each instruction is continuously input to the instruction pipeline, but if the instruction flow is disturbed by a branch instruction or the like, the original performance may not be exhibited.

そこで、分岐命令の処理を高速化するため、分岐先アドレスを予測して後続命令を命令パイプラインに投入する分岐予測手法が採用されている。この分岐予測手法としては、分岐命令のフィールド内に分岐予測に関する情報を埋め込んでおく静的な手法(例えば、特許文献1参照。)や、分岐命令に対応して予測された分岐先アドレスを保持しておいて動的に分岐予測を行う手法(例えば、特許文献2参照。)などが提案されている。
特開平8−272610号公報(図1) 特開平8−234980号公報(図3)
Therefore, in order to speed up the processing of the branch instruction, a branch prediction method is adopted in which a branch destination address is predicted and a subsequent instruction is input to the instruction pipeline. As this branch prediction method, a static method (for example, refer to Patent Document 1) in which information related to branch prediction is embedded in a branch instruction field, or a branch destination address predicted corresponding to a branch instruction is held. In addition, a method of dynamically performing branch prediction (see, for example, Patent Document 2) has been proposed.
JP-A-8-272610 (FIG. 1) JP-A-8-234980 (FIG. 3)

このような分岐予測手法により分岐命令の高速化が図られるが、複数語(語:ワード、例えば1ワード32ビット)からなる分岐命令の場合には以下のような問題が生じる。近年のメモリの大容量化に伴い、アドレス空間は例えば1ワードの命令コードサイズと同等のビット幅を有するようになっている。従って、分岐命令においてアドレス空間を即値指定しようとした場合、他の命令サイズと同様の1ワードの分岐命令ではメモリの全空間を網羅することは困難である。そのため、通常の分岐命令では、分岐先を汎用レジスタやアキュームレータに保持しておいてそれらを命令コードまたは8ビット程度のオペランドで指定する方式や、現在のプログラムカウンタに対する8ビット程度の相対アドレスを即値として命令コードに収める方式が一般的に採用されている。   Although such a branch prediction method speeds up the branch instruction, the following problem occurs in the case of a branch instruction consisting of a plurality of words (word: word, for example, one word 32 bits). With the recent increase in memory capacity, for example, the address space has a bit width equivalent to the instruction code size of one word. Accordingly, when an immediate address space is specified in a branch instruction, it is difficult to cover the entire memory space with a one-word branch instruction similar to other instruction sizes. Therefore, in a normal branch instruction, the branch destination is held in a general-purpose register or accumulator and specified by an instruction code or an 8-bit operand, or an 8-bit relative address for the current program counter is an immediate value. As a general rule, a method of storing in an instruction code is adopted.

しかしながら、前者のように汎用レジスタやアキュームレータを用いた場合にはハードウェアリソースを消費してしまう上、そのハードウェアリソースへ書き込むための命令がさらに必要となってしまう。また、後者のように相対アドレスを用いた場合には相対アドレスから絶対アドレスへ変換するための演算が必要となる上、現在のプログラムカウンタから制限された範囲でしか分岐できず、アドレス空間全体に渡っての分岐は不可能となる。特に、DSP(デジタル信号処理プロセッサ)などでは汎用レジスタにアドレスを保持させることを想定しないアーキテクチャを有することが多く、絶対アドレスの即値指定によりアドレスの全空間を指定できることが望まれる。   However, when a general-purpose register or accumulator is used as in the former case, hardware resources are consumed and further instructions for writing to the hardware resources are required. If the relative address is used as in the latter case, an operation for converting the relative address to the absolute address is required, and branching can be made only within a limited range from the current program counter, and the entire address space can be branched. Branching across is impossible. In particular, a DSP (digital signal processor) or the like often has an architecture that does not assume that a general-purpose register holds an address, and it is desired that the entire space of the address can be specified by specifying an immediate value of an absolute address.

一方、即値指定を分岐命令に含めた命令セットアーキテクチャを想定すると、分岐命令にアドレスを指定するフィールドが追加となるため、分岐命令の命令サイズは通常の1ワード命令の2乃至3倍になり得る。この複数ワードからなる分岐命令は遅延スロットのように働き、パイプラインフラッシュの数を遮蔽するなどの効果はあるものの、ループの内部においては分岐命令の命令フェッチが繰り返し実行され、処理のスループットを下げるおそれがある。   On the other hand, assuming an instruction set architecture in which an immediate value specification is included in a branch instruction, since a field for specifying an address is added to the branch instruction, the instruction size of the branch instruction can be two to three times that of a normal one-word instruction. . Although this multi-word branch instruction works like a delay slot and has the effect of shielding the number of pipeline flushes, the instruction fetch of the branch instruction is repeatedly executed inside the loop, reducing the processing throughput. There is a fear.

そこで、本発明は、パイプライン方式のプロセッサにおいて複数ワードからなる分岐命令の分岐予測を高速に行うことを目的とする。   Therefore, an object of the present invention is to perform branch prediction of a branch instruction consisting of a plurality of words at high speed in a pipeline processor.

本発明は、上記課題を解決するためになされたものであり、その第1の側面は、コンピュータプログラムに含まれる各命令の取得を制御する命令取得制御手段と、上記命令が複数語からなる分岐命令である場合には当該分岐命令の一部の語のみが取得された際に当該分岐命令に関する分岐予測情報を生成する分岐予測手段とを具備し、上記命令取得制御手段は、上記複数語からなる分岐命令の上記一部の語のみが取得された直後は上記分岐予測情報に従った命令を取得させることを特徴とする命令取得制御回路である。これにより、分岐命令の一部の語のみが取得された段階で、分岐命令の残部を取得することなく、分岐予測情報に従った命令を取得させるという作用をもたらす。   The present invention has been made in order to solve the above-mentioned problems. A first aspect of the present invention is an instruction acquisition control means for controlling acquisition of each instruction included in a computer program, and a branch in which the instruction is composed of a plurality of words. A branch prediction unit that generates branch prediction information related to the branch instruction when only a part of the word of the branch instruction is acquired when the instruction is an instruction, the instruction acquisition control unit includes the plurality of words. The instruction acquisition control circuit is characterized in that an instruction according to the branch prediction information is acquired immediately after only the partial word of the branch instruction is acquired. As a result, when only some words of the branch instruction are acquired, the instruction according to the branch prediction information is acquired without acquiring the remainder of the branch instruction.

また、この第1の側面において、上記分岐予測情報は、予測される分岐発生の有無および分岐が発生する場合に予測される分岐先アドレスを含むものとすることができる。この場合、上記命令取得制御手段は、上記分岐予測情報において分岐発生がないと予測された場合には上記複数語からなる分岐命令の残りの語を取得させずに当該分岐命令の後続命令を取得させるという作用をもたらす。   In the first aspect, the branch prediction information may include the presence or absence of a predicted branch occurrence and a branch destination address predicted when a branch occurs. In this case, when it is predicted that no branch occurs in the branch prediction information, the instruction acquisition control unit acquires a subsequent instruction of the branch instruction without acquiring the remaining words of the branch instruction consisting of the plurality of words. It brings about the effect of letting.

また、この第1の側面において、上記分岐予測手段は、各分岐命令に対応して当該分岐命令の命令アドレスを保持する分岐命令アドレスレジスタと、当該分岐命令の予測される分岐先アドレスを保持する分岐先アドレスレジスタと、当該分岐命令の予測される分岐発生の有無を保持する分岐方向レジスタと、上記複数語からなる分岐命令の命令アドレスと上記分岐命令アドレスレジスタに保持された命令アドレスとの一致を検出する検出器を備え、上記一致が検出された場合にはその命令アドレスに対応する分岐先アドレスおよび分岐発生の有無を上記分岐先アドレスレジスタおよび上記分岐方向レジスタからそれぞれ読み出して上記分岐予測情報として出力するものとすることができる。この場合、上記命令取得制御手段は、上記一致が検出された場合において分岐発生がないと予測された際には上記複数語からなる分岐命令の残りの語を取得させずに当該分岐命令の後続命令を取得させ、また、上記一致が検出されなかった場合においては上記複数語からなる分岐命令の残りの語を取得させるという作用をもたらす。   In the first aspect, the branch predicting means holds a branch instruction address register that holds an instruction address of the branch instruction corresponding to each branch instruction and a predicted branch destination address of the branch instruction. The branch destination address register, the branch direction register that holds the presence or absence of the predicted branch occurrence of the branch instruction, and the instruction address of the branch instruction consisting of the multiple words and the instruction address held in the branch instruction address register When the coincidence is detected, the branch prediction address is read out from the branch destination address register and the branch direction register, respectively, and the branch prediction information is read out from the branch destination address register and the branch direction register. As output. In this case, the instruction acquisition control means does not acquire the remaining words of the branch instruction consisting of the plurality of words and succeeds the branch instruction when it is predicted that no branch occurs when the match is detected. An instruction is acquired, and if the match is not detected, the remaining words of the branch instruction consisting of the plurality of words are acquired.

また、本発明の第2の側面は、コンピュータプログラムに含まれる各命令を取得する命令取得手段と、上記命令取得手段における上記命令の取得を制御する命令取得制御手段と、上記命令が複数語からなる分岐命令である場合には当該分岐命令の一部の語のみが取得された際に当該分岐命令に関する分岐予測情報を生成する分岐予測手段とを具備し、上記命令取得制御手段は、上記複数語からなる分岐命令の上記一部の語のみが取得された直後は上記分岐予測情報に従った命令を命令取得手段に取得させることを特徴とする命令取得回路である。これにより、分岐命令の一部の語のみが取得された段階で、分岐命令の残部を取得することなく、分岐予測情報に従った命令を取得するという作用をもたらす。   Further, according to a second aspect of the present invention, there is provided an instruction acquisition means for acquiring each instruction included in a computer program, an instruction acquisition control means for controlling the acquisition of the instruction in the instruction acquisition means, and the instruction from a plurality of words. A branch prediction unit that generates branch prediction information related to the branch instruction when only a part of the words of the branch instruction is acquired. Immediately after only the partial word of the branch instruction consisting of words is acquired, the instruction acquisition circuit is configured to cause the instruction acquisition means to acquire an instruction according to the branch prediction information. As a result, when only some words of the branch instruction are acquired, the instruction according to the branch prediction information is acquired without acquiring the remainder of the branch instruction.

また、本発明の第3の側面は、コンピュータプログラムに含まれる各命令を取得する命令取得手段と、上記命令取得手段において取得された命令を実行する命令実行手段と、上記命令取得手段における上記命令の取得を制御する命令取得制御手段と、上記命令が複数語からなる分岐命令である場合には当該分岐命令の一部の語のみが取得された際に当該分岐命令に関する分岐予測情報を生成する分岐予測手段とを具備し、上記命令取得制御手段は、上記複数語からなる分岐命令の上記一部の語のみが取得された直後は上記分岐予測情報に従った命令を命令取得手段に取得させることを特徴とするプロセッサである。これにより、分岐命令の一部の語のみが取得された段階で、分岐命令の残部を取得することなく、分岐予測情報に従った命令を取得して実行させるという作用をもたらす。   According to a third aspect of the present invention, there is provided an instruction acquisition means for acquiring each instruction included in a computer program, an instruction execution means for executing an instruction acquired by the instruction acquisition means, and the instruction in the instruction acquisition means. Instruction acquisition control means for controlling the acquisition of the branch instruction, and when the instruction is a branch instruction consisting of a plurality of words, branch prediction information relating to the branch instruction is generated when only a part of the words of the branch instruction is acquired. A branch prediction unit, and the instruction acquisition control unit causes the instruction acquisition unit to acquire an instruction according to the branch prediction information immediately after only the partial words of the branch instruction including the plurality of words are acquired. This is a processor characterized by that. As a result, when only a part of the words of the branch instruction is acquired, the instruction according to the branch prediction information is acquired and executed without acquiring the remainder of the branch instruction.

また、本発明の第4の側面は、コンピュータプログラムに含まれる各命令を保持する命令メモリと、上記命令メモリから上記命令を取得する命令取得手段と、上記命令取得手段において取得された命令を実行する命令実行手段と、上記命令取得手段における上記命令の取得を制御する命令取得制御手段と、上記命令が複数語からなる分岐命令である場合には当該分岐命令の一部の語のみが取得された際に当該分岐命令に関する分岐予測情報を生成する分岐予測手段とを具備し、上記命令取得制御手段は、上記複数語からなる分岐命令の上記一部の語のみが取得された直後は上記分岐予測情報に従った命令を命令取得手段に取得させることを特徴とするコンピュータシステムである。これにより、命令メモリから分岐命令の一部の語のみが取得された段階で、分岐命令の残部を取得することなく、分岐予測情報に従った命令を命令メモリから取得して実行させるという作用をもたらす。   According to a fourth aspect of the present invention, there is provided an instruction memory for holding each instruction included in a computer program, an instruction acquisition means for acquiring the instruction from the instruction memory, and an instruction acquired by the instruction acquisition means Instruction execution means for executing, instruction acquisition control means for controlling acquisition of the instruction in the instruction acquisition means, and if the instruction is a branch instruction consisting of a plurality of words, only a part of the words of the branch instruction is acquired. A branch prediction unit that generates branch prediction information relating to the branch instruction when the branch instruction is acquired. A computer system characterized by causing an instruction acquisition unit to acquire an instruction according to prediction information. As a result, when only some words of the branch instruction are acquired from the instruction memory, the instruction according to the branch prediction information is acquired from the instruction memory and executed without acquiring the remainder of the branch instruction. Bring.

本発明によれば、パイプライン方式のプロセッサにおいて複数ワードからなる分岐命令の分岐予測を高速に行うという優れた効果を奏し得る。   According to the present invention, it is possible to achieve an excellent effect of performing branch prediction of a branch instruction consisting of a plurality of words at a high speed in a pipeline processor.

次に本発明の実施の形態について図面を参照して詳細に説明する。   Next, embodiments of the present invention will be described in detail with reference to the drawings.

図1は、本発明の実施の形態におけるコンピュータシステムの一構成例を示す図である。本発明の実施の形態におけるコンピュータシステムは、プロセッサ200とメモリ300とを備える。メモリ300はコンピュータプログラムを保持するものである。このメモリ300はプロセッサ200に内蔵されていてもよい。プロセッサ200はメモリ300からコンピュータプログラムを読み出して、そのコンピュータプログラムを実行するものである。プロセッサ200は後述するように、命令パイプライン方式により構成されていることを想定する。   FIG. 1 is a diagram illustrating a configuration example of a computer system according to an embodiment of the present invention. The computer system in the embodiment of the present invention includes a processor 200 and a memory 300. The memory 300 holds a computer program. The memory 300 may be built in the processor 200. The processor 200 reads out a computer program from the memory 300 and executes the computer program. As will be described later, it is assumed that the processor 200 is configured by an instruction pipeline system.

プロセッサ200は、演算制御回路210と、命令フェッチ回路230と、分岐予測回路100とを備えている。命令フェッチ回路230は、演算制御回路210の指示に従ってメモリ300からコンピュータプログラム中の命令をフェッチ(取得)するものである。演算制御回路210は、命令フェッチ回路230によってフェッチされた命令をデコード(解読)して、その命令に応じた動作を行うものである。分岐予測回路100は、分岐命令毎に分岐予測情報を保持して各分岐命令の分岐先を予測するためのものである。   The processor 200 includes an arithmetic control circuit 210, an instruction fetch circuit 230, and a branch prediction circuit 100. The instruction fetch circuit 230 fetches (acquires) an instruction in the computer program from the memory 300 in accordance with an instruction from the arithmetic control circuit 210. The arithmetic control circuit 210 decodes (decodes) the instruction fetched by the instruction fetch circuit 230 and performs an operation according to the instruction. The branch prediction circuit 100 is for holding branch prediction information for each branch instruction and predicting the branch destination of each branch instruction.

演算制御回路210は、命令フェッチ回路230に対して信号線219によって命令アドレスを指定し、命令のフェッチを要求する。命令フェッチ回路230は、信号線219によって指定された命令アドレスにより、メモリ300から信号線390を介して命令をフェッチする。命令フェッチ回路230は、メモリ300からフェッチした命令を、信号線239により演算制御回路210に供給する。   The arithmetic control circuit 210 designates an instruction address via the signal line 219 to the instruction fetch circuit 230 and requests an instruction fetch. The instruction fetch circuit 230 fetches an instruction from the memory 300 via the signal line 390 according to the instruction address specified by the signal line 219. The instruction fetch circuit 230 supplies the instruction fetched from the memory 300 to the arithmetic control circuit 210 through the signal line 239.

演算制御回路210は、信号線239により供給された命令をデコードして、その命令に応じた動作を行う。例えば、演算命令であれば、演算対象となるオペランドをメモリ300または(図示しない)レジスタなどから取得して、演算を行う。また、分岐命令であれば、分岐条件を判断してその判断結果に応じて次に実行すべき命令のアドレスを決定する。但し、分岐命令の次アドレスを決定するまでに通常は数クロック要するため、その間の命令パイプランのストールを避けるために、分岐予測回路100によって分岐予測が行われる。   The arithmetic control circuit 210 decodes an instruction supplied through the signal line 239 and performs an operation according to the instruction. For example, in the case of an operation instruction, an operand to be operated is acquired from the memory 300 or a register (not shown) and the operation is performed. If it is a branch instruction, the branch condition is determined, and the address of the instruction to be executed next is determined according to the determination result. However, since it usually takes several clocks to determine the next address of the branch instruction, branch prediction is performed by the branch prediction circuit 100 in order to avoid stalling of the instruction pipeline during that time.

すなわち、演算制御回路210は、フェッチ対象の命令アドレスを信号線218によって分岐予測回路100に与え、分岐予測回路100から信号線191および192により供給された分岐予測情報に基づいて次にフェッチすべき命令のアドレスを決定する。また、演算制御回路210は、信号線211乃至213により分岐予測回路100に対して分岐予測情報の登録更新の制御を行う。   That is, the arithmetic control circuit 210 gives the instruction address to be fetched to the branch prediction circuit 100 through the signal line 218 and should fetch the next based on the branch prediction information supplied from the branch prediction circuit 100 through the signal lines 191 and 192. Determine the address of the instruction. Further, the arithmetic control circuit 210 controls the branch prediction information 100 for the branch prediction circuit 100 through the signal lines 211 to 213.

図2は、本発明の実施の形態における分岐予測回路100の一構成例を示す図である。この分岐予測回路100は、N個(Nは整数)の分岐方向レジスタ110と、N個の分岐先アドレスレジスタ120と、N個の分岐命令アドレスレジスタ130と、N個の比較器140と、方向選択器150と、アドレス選択器160と、論理和回路170とを備えている。すなわち、分岐予測回路100としては、いわゆるブランチターゲットバッファ(BTB)と同様の回路構成を採用することができる。   FIG. 2 is a diagram illustrating a configuration example of the branch prediction circuit 100 according to the embodiment of the present invention. The branch prediction circuit 100 includes N (N is an integer) branch direction registers 110, N branch destination address registers 120, N branch instruction address registers 130, N comparators 140, and directions. A selector 150, an address selector 160, and an OR circuit 170 are provided. That is, as the branch prediction circuit 100, a circuit configuration similar to a so-called branch target buffer (BTB) can be employed.

分岐方向レジスタ110は、分岐予測情報として、対応する分岐命令が「分岐する」か「分岐しない」かの分岐方向の予測を保持するレジスタである。分岐先アドレスレジスタ120は、分岐予測情報として、対応する分岐命令の予測される分岐先アドレスを保持するレジスタである。分岐命令アドレスレジスタ130は、対応する分岐命令の命令アドレスを保持するレジスタである。比較器140は、信号線218から供給されるプログラムカウンタ(PC)の値と対応する分岐命令アドレスレジスタ130の内容とを比較して一致を検出する比較器である。   The branch direction register 110 is a register that holds, as branch prediction information, prediction of the branch direction of whether the corresponding branch instruction is “branch” or “not branch”. The branch destination address register 120 is a register that holds a predicted branch destination address of a corresponding branch instruction as branch prediction information. The branch instruction address register 130 is a register that holds an instruction address of a corresponding branch instruction. The comparator 140 is a comparator that compares the value of the program counter (PC) supplied from the signal line 218 with the content of the corresponding branch instruction address register 130 to detect a match.

方向選択器150およびアドレス選択器160は、比較器140における比較結果に応じてそれぞれ分岐方向レジスタ110および分岐先アドレスレジスタ120の内容を選択して出力する選択器である。これら方向選択器150およびアドレス選択器160の出力はそれぞれ信号線191および192によって演算制御回路210に供給される。   The direction selector 150 and the address selector 160 are selectors that select and output the contents of the branch direction register 110 and the branch destination address register 120, respectively, according to the comparison result in the comparator 140. The outputs of the direction selector 150 and the address selector 160 are supplied to the arithmetic control circuit 210 through signal lines 191 and 192, respectively.

論理和回路170は、N個の比較器140の出力の論理和を生成することにより、比較器140の何れかにおいてプログラムカウンタの値と分岐命令アドレスレジスタ130の内容との間で一致が検出されたことを知らせるものである。この論理和回路170の出力は信号線199によって演算制御回路210に供給される。   The logical sum circuit 170 generates a logical sum of the outputs of the N comparators 140 so that a match is detected between the value of the program counter and the contents of the branch instruction address register 130 in any of the comparators 140. It is to inform you. The output of the OR circuit 170 is supplied to the arithmetic control circuit 210 through a signal line 199.

分岐方向レジスタ110、分岐先アドレスレジスタ120、分岐命令アドレスレジスタ130および比較器140は、それぞれN個設けられており、全体でN組のエントリを構成する。すなわち、ある分岐命令の命令アドレスがi組目(iは整数)の分岐命令アドレスレジスタ130に保持されたとすると、その分岐命令の予測分岐先アドレスはi組目の分岐先アドレスレジスタ120に保持され、その分岐命令の分岐方向はi組目の分岐方向レジスタ110に保持される。そして、プログラムカウンタの値との一致がi組目の比較器140によって検出されると、方向選択器150およびアドレス選択器160は、それぞれi組目の分岐方向レジスタ110および分岐先アドレスレジスタ120の内容を選択して分岐予測情報として出力する。   N branch direction registers 110, branch destination address registers 120, branch instruction address registers 130, and comparators 140 are provided, and N sets of entries are formed as a whole. That is, if the instruction address of a certain branch instruction is held in the i-th branch instruction address register 130 (i is an integer), the predicted branch destination address of the branch instruction is held in the i-th branch destination address register 120. The branch direction of the branch instruction is held in the i-th branch direction register 110. When a match with the value of the program counter is detected by the i-th set of comparators 140, the direction selector 150 and the address selector 160 respectively store the i-th set of the branch direction register 110 and the branch destination address register 120. Select contents and output as branch prediction information.

分岐方向レジスタ110への登録更新は信号線211を介した分岐方向更新信号により行われる。また、分岐先アドレスレジスタ120および分岐命令アドレスレジスタ130への登録更新は信号線213を介したアドレス更新信号のタイミングで行われ、それぞれ信号線212および218から供給される確定分岐先アドレスおよびプログラムカウンタの値がそれぞれ保持される。   Registration update to the branch direction register 110 is performed by a branch direction update signal via the signal line 211. Also, the registration update to the branch destination address register 120 and the branch instruction address register 130 is performed at the timing of the address update signal via the signal line 213, and the determined branch destination address and program counter supplied from the signal lines 212 and 218, respectively. Each value is held.

図3は、本発明の実施の形態におけるプロセッサ200の命令パイプライン構成例を示す図である。このプロセッサ200は、命令フェッチステージ(IF:Instruction Fetch)510、命令デコードステージ(ID:Instruction Decode)520、データフェッチステージ(DF:Data Fetch)530および実行ステージ(EX:EXecution)540の4段の命令パイプラインからなるものと想定する。   FIG. 3 is a diagram illustrating a configuration example of an instruction pipeline of the processor 200 according to the embodiment of the present invention. The processor 200 includes an instruction fetch stage (IF: Instruction Fetch) 510, an instruction decode stage (ID: Instruction Decode) 520, a data fetch stage (DF: Data Fetch) 530, and an execution stage (EX: Execution) 540. Assume that it consists of an instruction pipeline.

命令フェッチステージ510は、メモリ300からコンピュータプログラム中の命令をフェッチするステージである。この命令フェッチ処理は、図1の構成例における命令フェッチ回路230により実現される。また、この命令フェッチステージ510では、フェッチされた命令が分岐命令である場合、その分岐命令の分岐先の予測も行なわれる。この分岐予測処理は図1の構成例における分岐予測回路100により実現される。   The instruction fetch stage 510 is a stage for fetching instructions in the computer program from the memory 300. This instruction fetch process is realized by the instruction fetch circuit 230 in the configuration example of FIG. In this instruction fetch stage 510, when the fetched instruction is a branch instruction, the branch destination of the branch instruction is also predicted. This branch prediction process is realized by the branch prediction circuit 100 in the configuration example of FIG.

命令デコードステージ520は、命令フェッチステージ510においてフェッチされた命令をデコードして、その命令の示す処理内容を抽出するステージである。データフェッチステージ530は、命令フェッチステージ510において抽出されたオペランドに従って、必要なデータをメモリ300や(図示しない)レジスタ等からフェッチするステージである。   The instruction decode stage 520 is a stage for decoding the instruction fetched in the instruction fetch stage 510 and extracting the processing content indicated by the instruction. The data fetch stage 530 is a stage for fetching necessary data from the memory 300, a register (not shown) or the like according to the operand extracted in the instruction fetch stage 510.

また、実行ステージ540は、命令の指示する動作に従って処理を実行するステージである。この命令実行処理においては、データの読出しが必要な場合にはデータフェッチステージ530においてフェッチされたデータが利用され、また、生成されたデータの書込みが必要な場合にはメモリ300や(図示しない)レジスタ等への書込みが行われる。また、分岐命令の分岐条件の判断についても、この実行ステージ540で行われる。なお、ここで説明した命令デコードステージ520、データフェッチステージ530および実行ステージ540における処理は、図1の構成例における演算制御回路210により実現される。   The execution stage 540 is a stage for executing processing according to the operation indicated by the instruction. In this instruction execution process, the data fetched in the data fetch stage 530 is used when data reading is necessary, and the memory 300 (not shown) is used when the generated data needs to be written. Writing to a register or the like is performed. In addition, the determination of the branch condition of the branch instruction is also performed in the execution stage 540. The processing in the instruction decode stage 520, the data fetch stage 530, and the execution stage 540 described here is realized by the arithmetic control circuit 210 in the configuration example of FIG.

図4は、本発明の実施の形態における分岐命令の命令フォーマットの一例を示す図である。図4(a)は、本発明の実施の形態における無条件分岐命令の命令フォーマットの一例であり、第1ワード目にはオペコードフィールド611および未使用フィールド612が格納される。オペコードフィールド611には無条件分岐命令を示すオペコードが含まれる。この無条件分岐命令の命令フォーマットでは、オペコード611に続くフィールドは未使用フィールド612とされる。そして、第2ワード目として、分岐先アドレスフィールド613には、この無条件分岐命令の次に実行すべき命令のアドレスが即値として格納される。   FIG. 4 is a diagram showing an example of the instruction format of the branch instruction in the embodiment of the present invention. FIG. 4A is an example of an instruction format of an unconditional branch instruction in the embodiment of the present invention, and an opcode field 611 and an unused field 612 are stored in the first word. The operation code field 611 includes an operation code indicating an unconditional branch instruction. In the instruction format of this unconditional branch instruction, the field following the opcode 611 is an unused field 612. As the second word, the branch destination address field 613 stores the address of the instruction to be executed next to this unconditional branch instruction as an immediate value.

図4(b)は、本発明の実施の形態における条件分岐命令の命令フォーマットの一例であり、第1ワード目にはオペコードフィールド621および分岐条件フィールド622が格納される。オペコードフィールド621には条件分岐命令を示すオペコードが含まれる。このオペコードには静的分岐予測の情報等を含ませるようにしてもよい。また、分岐条件フィールド622には、この条件分岐命令の分岐条件が指定される。例えば、演算結果を示す状態コード(CC:Condition Code)の内容を分岐条件として指定することができる。そして、第2ワード目として、分岐先アドレスフィールド623には、分岐条件の判断の結果として「分岐する」こととなった場合に、次に実行すべき命令のアドレスが即値として格納される。なお、分岐条件の判断の結果として「分岐しない」こととなった場合には、その条件分岐命令の後続命令が次に実行される。   FIG. 4B is an example of an instruction format of a conditional branch instruction in the embodiment of the present invention, and an opcode field 621 and a branch condition field 622 are stored in the first word. The operation code field 621 includes an operation code indicating a conditional branch instruction. This opcode may include static branch prediction information and the like. In the branch condition field 622, the branch condition of this conditional branch instruction is specified. For example, the contents of a status code (CC) indicating the calculation result can be specified as a branch condition. As the second word, the branch destination address field 623 stores the address of an instruction to be executed next as an immediate value when the branch condition is determined to be “branch”. If the result of the branch condition determination is “no branch”, the instruction following the conditional branch instruction is executed next.

ここで説明した無条件分岐命令および条件分岐命令は、何れも2ワードからなる命令形式である。従って、1サイクルに1ワードずつ命令をフェッチした場合には、これら分岐命令を完全にフェッチするには2サイクルを要することになる。本発明の実施の形態においては、このような複数ワードからなる分岐命令をフェッチした場合、分岐命令を完全にフェッチする前に分岐予測を行い、後続命令を高速に実行する。   The unconditional branch instruction and the conditional branch instruction described here are both in the instruction format consisting of two words. Therefore, when an instruction is fetched one word at a time, it takes two cycles to completely fetch these branch instructions. In the embodiment of the present invention, when such a branch instruction consisting of a plurality of words is fetched, branch prediction is performed before the branch instruction is completely fetched, and the subsequent instruction is executed at high speed.

次に本発明の実施の形態における演算制御回路210の動作について図面を参照して説明する。   Next, the operation of the arithmetic control circuit 210 in the embodiment of the present invention will be described with reference to the drawings.

図5は、本発明の実施の形態における演算制御回路210の無条件分岐命令に対する処理例を示す流れ図である。まず、命令フェッチ回路230によって無条件分岐命令の一部、すなわち最初のワードがフェッチされると(ステップS911)、そのタイミングで分岐予測回路100における分岐予測が行われる。これにより、分岐予測回路100における分岐命令アドレスレジスタ130の何れかに、その無条件分岐命令の命令アドレスが登録されていれば(ヒット:ステップS912)、演算制御回路210は対応する予測分岐先アドレスにより次の命令をフェッチするよう命令フェッチ回路230に指示する(ステップS925)。   FIG. 5 is a flowchart showing an example of processing for the unconditional branch instruction of the arithmetic control circuit 210 according to the embodiment of the present invention. First, when a part of an unconditional branch instruction, that is, the first word is fetched by the instruction fetch circuit 230 (step S911), branch prediction in the branch prediction circuit 100 is performed at that timing. Thereby, if the instruction address of the unconditional branch instruction is registered in any of the branch instruction address registers 130 in the branch prediction circuit 100 (hit: step S912), the arithmetic control circuit 210 will correspond to the corresponding predicted branch destination address. To instruct the instruction fetch circuit 230 to fetch the next instruction (step S925).

一方、分岐予測回路100における分岐命令アドレスレジスタ130の何れにも、その無条件分岐命令の命令アドレスが登録されていなければ(ミスヒット:ステップS912)、演算制御回路210はその無条件分岐命令の残りの部分をフェッチするよう命令フェッチ回路230に指示する(ステップS913)。さらに次の命令として、分岐先の命令をフェッチすべきであるがこの時点では分岐先アドレスが確定していないため、命令パイプラインはストールする(ステップS915)。   On the other hand, if the instruction address of the unconditional branch instruction is not registered in any of the branch instruction address registers 130 in the branch prediction circuit 100 (mis-hit: step S912), the arithmetic control circuit 210 stores the unconditional branch instruction. The instruction fetch circuit 230 is instructed to fetch the remaining part (step S913). Further, as the next instruction, the branch destination instruction should be fetched, but at this point, the branch destination address is not fixed, so the instruction pipeline is stalled (step S915).

無条件分岐命令の残りの部分から分岐先アドレスが判明すると、演算制御回路210は分岐予測回路100に対して分岐予測情報の登録更新を指示する(ステップS916)。その後、無条件分岐命令の分岐が確定すると、演算制御回路210は先行してフェッチしていた無条件分岐命令の次の命令をフラッシュ(取消し)する(ステップS918)。そして、演算制御回路210は確定した分岐先の命令をフェッチするよう命令フェッチ回路230に指示する(ステップS919)。   When the branch destination address is found from the remaining part of the unconditional branch instruction, the arithmetic control circuit 210 instructs the branch prediction circuit 100 to update and update the branch prediction information (step S916). Thereafter, when the branch of the unconditional branch instruction is confirmed, the arithmetic control circuit 210 flushes (cancels) the instruction next to the unconditional branch instruction fetched in advance (step S918). Then, the arithmetic control circuit 210 instructs the instruction fetch circuit 230 to fetch the determined branch destination instruction (step S919).

図6は、本発明の実施の形態において無条件分岐命令が分岐予測回路100でミスヒットした場合の処理例を示すタイムチャートである。まず、サイクルt1で無条件分岐命令の先頭ワードがフェッチされると、そのタイミングで分岐予測回路100における分岐予測が行われる。ここではミスヒットしたことを想定するため、信号線199の分岐予測ヒット信号は非アクティブのままである。すると、次のサイクルt2では、無条件分岐命令の次のワードがフェッチされる。なお、ここでは無条件分岐命令は2ワードからなると想定する。   FIG. 6 is a time chart showing an example of processing when an unconditional branch instruction misses in the branch prediction circuit 100 in the embodiment of the present invention. First, when the first word of the unconditional branch instruction is fetched in cycle t1, branch prediction in the branch prediction circuit 100 is performed at that timing. Here, since it is assumed that a miss-hit has occurred, the branch prediction hit signal of the signal line 199 remains inactive. Then, in the next cycle t2, the next word of the unconditional branch instruction is fetched. Here, it is assumed that the unconditional branch instruction consists of two words.

次のサイクルt3では、分岐先アドレスがまだ確定していないため命令パイプラインはストールする。また、このサイクルt3では、無条件分岐命令の分岐先アドレスが確定するため、分岐予測回路100に対して信号線212により確定分岐先アドレスが供給されるとともに、信号線213によりアドレス更新指示がなされる。これにより、その無条件分岐命令が分岐予測回路100に登録更新される。すなわち、「PC」番地が分岐命令アドレスレジスタ130のいずれかのエントリに登録され、「分岐先」番地が分岐先アドレスレジスタ120の同じエントリに登録され、分岐方向レジスタ110の同じエントリには「分岐する」旨の内容が登録される。   In the next cycle t3, the instruction pipeline stalls because the branch destination address has not yet been determined. Further, in this cycle t3, since the branch destination address of the unconditional branch instruction is fixed, the determined branch destination address is supplied to the branch prediction circuit 100 through the signal line 212, and an address update instruction is issued through the signal line 213. The As a result, the unconditional branch instruction is registered and updated in the branch prediction circuit 100. That is, the “PC” address is registered in any entry of the branch instruction address register 130, the “branch destination” address is registered in the same entry of the branch destination address register 120, and the same entry of the branch direction register 110 is The contents of “Yes” are registered.

次のサイクルt4では、先行してフェッチされていた無条件分岐命令の次の命令がフラッシュされ、新たに確定した分岐先命令がフェッチされる。サイクルt5以降では、順次後続命令がフェッチされていく。   In the next cycle t4, the instruction next to the unconditional branch instruction fetched in advance is flushed, and the newly determined branch destination instruction is fetched. Subsequent instructions are sequentially fetched after cycle t5.

このように、無条件分岐命令が分岐予測回路100でミスヒットした場合には、命令パイプラインとしての損失(ペナルティ)は、「1」サイクルとなる。   Thus, when an unconditional branch instruction misses in the branch prediction circuit 100, a loss (penalty) as an instruction pipeline is “1” cycle.

図7は、本発明の実施の形態において無条件分岐命令が分岐予測回路100でヒットした場合の処理例を示すタイムチャートである。まず、サイクルt1で無条件分岐命令の先頭ワードがフェッチされると、そのタイミングで分岐予測回路100における分岐予測が行われる。ここではヒットしたことを想定するため、信号線199の分岐予測ヒット信号はアクティブになる。すると、次のサイクルt2では、予測された分岐先の命令がフェッチされる。以降、順次後続命令がフェッチされていく。   FIG. 7 is a time chart illustrating a processing example when an unconditional branch instruction hits in the branch prediction circuit 100 in the embodiment of the present invention. First, when the first word of the unconditional branch instruction is fetched in cycle t1, branch prediction in the branch prediction circuit 100 is performed at that timing. Here, since it is assumed that a hit has occurred, the branch prediction hit signal of the signal line 199 becomes active. Then, in the next cycle t2, the predicted branch destination instruction is fetched. Thereafter, subsequent instructions are sequentially fetched.

このように、無条件分岐命令が分岐予測回路100でヒットした場合には、無条件分岐命令の2ワード目の命令フェッチを行わないため、命令パイプラインとしてのペナルティは「−1」サイクルとなる。   Thus, when an unconditional branch instruction hits in the branch prediction circuit 100, the instruction fetch of the second word of the unconditional branch instruction is not performed, so the penalty as the instruction pipeline is “−1” cycle. .

図8は、本発明の実施の形態における演算制御回路210の条件分岐命令に対する処理例を示す流れ図である。まず、命令フェッチ回路230によって条件分岐命令の一部、すなわち最初のワードがフェッチされると(ステップS931)、そのタイミングで分岐予測回路100における分岐予測が行われる。これにより、分岐予測回路100における分岐命令アドレスレジスタ130の何れかにその条件分岐命令の命令アドレスが登録されていれば(ヒット:ステップS932)、分岐予測情報が分岐予測回路100から取得される(ステップS933)。一方、分岐予測回路100における分岐命令アドレスレジスタ130の何れにもその条件分岐命令の命令アドレスが登録されていなければ(ミスヒット:ステップS932)、演算制御回路210はその条件分岐命令の残りの部分をフェッチするよう命令フェッチ回路230に指示する(ステップS943)。   FIG. 8 is a flowchart showing an example of processing for a conditional branch instruction of the arithmetic control circuit 210 according to the embodiment of the present invention. First, when a part of the conditional branch instruction, that is, the first word is fetched by the instruction fetch circuit 230 (step S931), branch prediction in the branch prediction circuit 100 is performed at that timing. Thus, if the instruction address of the conditional branch instruction is registered in any of the branch instruction address registers 130 in the branch prediction circuit 100 (hit: step S932), branch prediction information is acquired from the branch prediction circuit 100 ( Step S933). On the other hand, if the instruction address of the conditional branch instruction is not registered in any of the branch instruction address registers 130 in the branch prediction circuit 100 (mishit: step S932), the arithmetic control circuit 210 determines the remaining part of the conditional branch instruction. Is fetched to the instruction fetch circuit 230 (step S943).

ステップS933において取得された分岐予測情報の分岐方向が「分岐する」を示している場合には、演算制御回路210は分岐予測情報の分岐予測先の命令をフェッチするよう命令フェッチ回路230に指示する(ステップS935)。そして、条件分岐命令の分岐条件622の判断結果が確定すると、演算制御回路210は分岐予測回路100に対して分岐予測情報の更新を行う(ステップS936)。このとき、確定した分岐方向が「分岐しない」であれば、フェッチされた分岐予測先の命令をフラッシュして(ステップS938)、新たに条件分岐命令の後続命令をフェッチするよう命令フェッチ回路230に指示する(ステップS939)。   If the branch direction of the branch prediction information acquired in step S933 indicates “branch”, the arithmetic control circuit 210 instructs the instruction fetch circuit 230 to fetch the branch prediction destination instruction of the branch prediction information. (Step S935). When the determination result of the branch condition 622 of the conditional branch instruction is confirmed, the arithmetic control circuit 210 updates the branch prediction information to the branch prediction circuit 100 (step S936). At this time, if the determined branch direction is “do not branch”, the fetched branch prediction destination instruction is flushed (step S938), and the instruction fetch circuit 230 is newly fetched with a subsequent instruction of the conditional branch instruction. An instruction is given (step S939).

一方、ステップS933において取得された分岐予測情報の分岐方向が「分岐しない」を示している場合もしくはステップS932でミスヒットとなったため条件分岐命令の残りの部分がフェッチ(ステップS943)された場合、演算制御回路210はさらに条件分岐命令の後続の命令をフェッチするよう命令フェッチ回路230に指示する(ステップS945)。そして、条件分岐命令の分岐条件622の判断結果が確定すると、演算制御回路210は分岐予測回路100に対して分岐予測情報の更新を行う(ステップS946)。このとき、確定した分岐方向が「分岐する」であれば、フェッチされた分岐予測先の命令をフラッシュして(ステップS948)、新たに確定した分岐先の命令をフェッチするよう命令フェッチ回路230に指示する(ステップS949)。   On the other hand, if the branch direction of the branch prediction information acquired in step S933 indicates “do not branch” or if the remaining portion of the conditional branch instruction is fetched (step S943) because of a miss hit in step S932, The arithmetic control circuit 210 further instructs the instruction fetch circuit 230 to fetch an instruction subsequent to the conditional branch instruction (step S945). When the determination result of the branch condition 622 of the conditional branch instruction is confirmed, the arithmetic control circuit 210 updates the branch prediction information to the branch prediction circuit 100 (step S946). At this time, if the determined branch direction is “branch”, the fetched branch prediction destination instruction is flushed (step S948), and the instruction fetch circuit 230 is fetched to fetch the newly determined branch destination instruction. An instruction is given (step S949).

図9は、本発明の実施の形態において条件分岐命令が分岐予測回路100でミスヒットした際に分岐方向が「分岐する」となった場合の処理例を示すタイムチャートである。まず、サイクルt1で条件分岐命令の先頭ワードがフェッチされると、そのタイミングで分岐予測回路100における分岐予測が行われる。ここではミスヒットしたことを想定するため、信号線199の分岐予測ヒット信号は非アクティブのままである。すると、次のサイクルt2では、条件分岐命令の次のワードがフェッチされる。なお、ここでは条件分岐命令は2ワードからなると想定する。   FIG. 9 is a time chart showing an example of processing when the branch direction becomes “branch” when a conditional branch instruction misses in the branch prediction circuit 100 in the embodiment of the present invention. First, when the first word of a conditional branch instruction is fetched in cycle t1, branch prediction in the branch prediction circuit 100 is performed at that timing. Here, since it is assumed that a miss-hit has occurred, the branch prediction hit signal of the signal line 199 remains inactive. Then, in the next cycle t2, the next word of the conditional branch instruction is fetched. Here, it is assumed that the conditional branch instruction consists of two words.

次のサイクルt3では、条件分岐命令の次の命令が先行してフェッチされる。また、このサイクルt3では、条件分岐命令の分岐先アドレスが判明するため、分岐予測回路100に対して信号線212により確定分岐先アドレスが供給されるとともに、信号線213によりアドレス更新指示がなされる。これにより、その条件分岐命令が分岐予測回路100に登録更新される。すなわち、「PC」番地が分岐命令アドレスレジスタ130のいずれかのエントリに登録され、「分岐先」番地が分岐先アドレスレジスタ120の同じエントリに登録される。   In the next cycle t3, the instruction next to the conditional branch instruction is fetched in advance. Further, in this cycle t3, since the branch destination address of the conditional branch instruction is determined, the definite branch destination address is supplied to the branch prediction circuit 100 through the signal line 212 and the address update instruction is issued through the signal line 213. . As a result, the conditional branch instruction is registered and updated in the branch prediction circuit 100. That is, the “PC” address is registered in one of the entries in the branch instruction address register 130, and the “branch destination” address is registered in the same entry in the branch destination address register 120.

次のサイクルt4では、条件分岐命令の2つ後(「PC+3」番地)の命令が先行してフェッチされる。また、条件分岐命令の分岐方向が確定して、その条件分岐命令の分岐方向が分岐予測回路100に登録更新される。ここでは、「分岐する」となったことを想定しているため、分岐方向レジスタ110の対応するエントリには「分岐する」旨の内容が登録される。   In the next cycle t4, the instruction two after the conditional branch instruction (address “PC + 3”) is fetched in advance. Further, the branch direction of the conditional branch instruction is determined, and the branch direction of the conditional branch instruction is registered and updated in the branch prediction circuit 100. Here, since it is assumed that “branch”, the content of “branch” is registered in the corresponding entry of the branch direction register 110.

次のサイクルt5では、先行してフェッチされていた条件分岐命令の後の2つの命令がフラッシュされ、新たに確定した分岐先命令がフェッチされる。サイクルt6以降では、順次後続命令がフェッチされていく。   In the next cycle t5, two instructions after the conditional branch instruction fetched in advance are flushed, and a newly determined branch destination instruction is fetched. Subsequent instructions are sequentially fetched after cycle t6.

このように、条件分岐命令が分岐予測回路100でミスヒットした際に分岐方向が「分岐する」となった場合には、命令パイプラインとしてのペナルティは「2」サイクルとなる。   Thus, when the branch direction becomes “branch” when the conditional branch instruction misses in the branch prediction circuit 100, the penalty as the instruction pipeline is “2” cycles.

図10は、本発明の実施の形態において条件分岐命令が分岐予測回路100でミスヒットした際に分岐方向が「分岐しない」となった場合の処理例を示すタイムチャートである。まず、サイクルt1で条件分岐命令の先頭ワードがフェッチされると、そのタイミングで分岐予測回路100における分岐予測が行われる。ここではミスヒットしたことを想定するため、信号線199の分岐予測ヒット信号は非アクティブのままである。すると、次のサイクルt2では、条件分岐命令の次のワードがフェッチされる。なお、ここでは条件分岐命令は2ワードからなると想定する。   FIG. 10 is a time chart showing a processing example when the branch direction becomes “not branch” when the conditional branch instruction misses in the branch prediction circuit 100 in the embodiment of the present invention. First, when the first word of a conditional branch instruction is fetched in cycle t1, branch prediction in the branch prediction circuit 100 is performed at that timing. Here, since it is assumed that a miss-hit has occurred, the branch prediction hit signal of the signal line 199 remains inactive. Then, in the next cycle t2, the next word of the conditional branch instruction is fetched. Here, it is assumed that the conditional branch instruction consists of two words.

次のサイクルt3では、条件分岐命令の次の命令が先行してフェッチされる。また、このサイクルt3では、条件分岐命令の分岐先アドレスが判明するため、分岐予測回路100に対して信号線212により確定分岐先アドレスが供給されるとともに、信号線213によりアドレス更新指示がなされる。これにより、その条件分岐命令が分岐予測回路100に登録更新される。すなわち、「PC」番地が分岐命令アドレスレジスタ130のいずれかのエントリに登録され、「分岐先」番地が分岐先アドレスレジスタ120の同じエントリに登録される。   In the next cycle t3, the instruction next to the conditional branch instruction is fetched in advance. Further, in this cycle t3, since the branch destination address of the conditional branch instruction is determined, the definite branch destination address is supplied to the branch prediction circuit 100 through the signal line 212 and the address update instruction is issued through the signal line 213. . As a result, the conditional branch instruction is registered and updated in the branch prediction circuit 100. That is, the “PC” address is registered in one of the entries in the branch instruction address register 130, and the “branch destination” address is registered in the same entry in the branch destination address register 120.

次のサイクルt4では、条件分岐命令の2つ後(「PC+3」番地)の命令が先行してフェッチされる。また、条件分岐命令の分岐方向が確定して、その条件分岐命令の分岐方向が分岐予測回路100に登録更新される。ここでは、「分岐しない」となったことを想定しているため、分岐方向レジスタ110の対応するエントリには「分岐しない」旨の内容が登録される。   In the next cycle t4, the instruction two after the conditional branch instruction (address “PC + 3”) is fetched in advance. Further, the branch direction of the conditional branch instruction is determined, and the branch direction of the conditional branch instruction is registered and updated in the branch prediction circuit 100. Here, since it is assumed that “not branched”, the content of “not branched” is registered in the corresponding entry of the branch direction register 110.

この例では「分岐しない」側の命令を先行してフェッチしていたため、次のサイクルt5では、先行してフェッチされていた条件分岐命令の後の2つの命令はフラッシュされることなくそのまま処理され、さらにその次(「PC+4」番地)の命令が引き続きフェッチされる。   In this example, since the instruction on the “no branch” side is fetched in advance, in the next cycle t5, the two instructions after the conditional branch instruction fetched in advance are processed as they are without being flushed. Further, the next instruction (address “PC + 4”) is continuously fetched.

このように、条件分岐命令が分岐予測回路100でミスヒットした際に分岐方向が「分岐しない」となった場合には、命令パイプラインとしてのペナルティは、「0」サイクルとなる。   As described above, when the branch direction becomes “not branched” when the conditional branch instruction misses in the branch prediction circuit 100, the penalty as the instruction pipeline becomes “0” cycle.

図11は、本発明の実施の形態において条件分岐命令が分岐予測回路100でヒットして予測分岐方向が「分岐する」であった際に分岐方向が「分岐する」となった場合の処理例を示すタイムチャートである。まず、サイクルt1で条件分岐命令の先頭ワードがフェッチされると、そのタイミングで分岐予測回路100における分岐予測が行われる。ここではヒットしたことを想定するため、信号線199の分岐予測ヒット信号はアクティブとなる。すると、次のサイクルt2では、予測された分岐先の命令がフェッチされる。なお、ここでは条件分岐命令は2ワードからなると想定する。   FIG. 11 shows an example of processing when the branch direction becomes “branch” when the conditional branch instruction hits in the branch prediction circuit 100 and the predicted branch direction is “branch” in the embodiment of the present invention. It is a time chart which shows. First, when the first word of a conditional branch instruction is fetched in cycle t1, branch prediction in the branch prediction circuit 100 is performed at that timing. Here, since it is assumed that a hit has occurred, the branch prediction hit signal on the signal line 199 becomes active. Then, in the next cycle t2, the predicted branch destination instruction is fetched. Here, it is assumed that the conditional branch instruction consists of two words.

その後、サイクルt2以降は予測された分岐先の命令が順次フェッチされていく。そして、サイクルt4で条件分岐命令の分岐方向が確定して、その条件分岐命令の分岐方向が分岐予測回路100に登録更新される。ここでは、「分岐する」となったことを想定しているため、分岐方向レジスタ110の対応するエントリには「分岐する」旨の内容が登録される。   Thereafter, after the cycle t2, the predicted branch destination instructions are sequentially fetched. Then, the branch direction of the conditional branch instruction is determined at cycle t4, and the branch direction of the conditional branch instruction is registered and updated in the branch prediction circuit 100. Here, since it is assumed that “branch”, the content of “branch” is registered in the corresponding entry of the branch direction register 110.

この例では「分岐する」側の命令を先行してフェッチしていたため、次のサイクルt5では、先行してフェッチされていた3つの命令(「分岐先」番地、「分岐先+1」番地および「分岐先+2」番地)はフラッシュされることなくそのまま処理され、さらにその次(「分岐先+3」番地)の命令が引き続きフェッチされる。   In this example, since the instruction on the “branch” side has been fetched in advance, in the next cycle t5, the three instructions (“branch destination” address, “branch destination + 1” address, and “ (Branch destination + 2 ”address) is processed without being flushed, and the next instruction (“ Branch destination + 3 ”address) is continuously fetched.

このように、条件分岐命令が分岐予測回路100でヒットして予測分岐方向が「分岐する」であった際に分岐方向が「分岐する」となった場合には、条件分岐命令の2ワード目の命令フェッチを行わないため、命令パイプラインとしてのペナルティは「−1」サイクルとなる。   As described above, when the conditional branch instruction hits in the branch prediction circuit 100 and the predicted branch direction is “branch” and the branch direction becomes “branch”, the second word of the conditional branch instruction. Since the instruction fetch is not performed, the penalty as the instruction pipeline is “−1” cycles.

図12は、本発明の実施の形態において条件分岐命令が分岐予測回路100でヒットして予測分岐方向が「分岐する」であった際に分岐方向が「分岐しない」となった場合の処理例を示すタイムチャートである。まず、サイクルt1で条件分岐命令の先頭ワードがフェッチされると、そのタイミングで分岐予測回路100における分岐予測が行われる。ここではヒットしたことを想定するため、信号線199の分岐予測ヒット信号はアクティブとなる。すると、次のサイクルt2では、予測された分岐先の命令がフェッチされる。なお、ここでは条件分岐命令は2ワードからなると想定する。   FIG. 12 shows an example of processing when the branch direction becomes “not branch” when the conditional branch instruction hits in the branch prediction circuit 100 and the predicted branch direction is “branch” in the embodiment of the present invention. It is a time chart which shows. First, when the first word of a conditional branch instruction is fetched in cycle t1, branch prediction in the branch prediction circuit 100 is performed at that timing. Here, since it is assumed that a hit has occurred, the branch prediction hit signal of the signal line 199 becomes active. Then, in the next cycle t2, the predicted branch destination instruction is fetched. Here, it is assumed that the conditional branch instruction consists of two words.

その後、サイクルt2以降は予測された分岐先の命令が順次フェッチされていく。そして、サイクルt4で条件分岐命令の分岐方向が確定して、その条件分岐命令の分岐方向が分岐予測回路100に登録更新される。ここでは、「分岐しない」となったことを想定しているため、分岐方向レジスタ110の対応するエントリには「分岐しない」旨の内容が登録される。   Thereafter, after the cycle t2, the predicted branch destination instructions are sequentially fetched. Then, the branch direction of the conditional branch instruction is determined at cycle t4, and the branch direction of the conditional branch instruction is registered and updated in the branch prediction circuit 100. Here, since it is assumed that “not branched”, the content of “not branched” is registered in the corresponding entry of the branch direction register 110.

この例では「分岐する」側の命令を先行してフェッチしていたため、次のサイクルt5では、先行してフェッチされていた3つの命令(「分岐先」番地、「分岐先+1」番地および「分岐先+2」番地)はフラッシュされ、条件分岐命令の次(「PC+2」番地)の命令がフェッチされる。サイクルt6以降では、順次その後続命令がフェッチされていく。   In this example, since the instruction on the “branch” side has been fetched in advance, in the next cycle t5, the three instructions (“branch destination” address, “branch destination + 1” address, and “ (Branch destination + 2 "address) is flushed, and the instruction next to the conditional branch instruction (" PC + 2 "address) is fetched. Subsequent instructions are sequentially fetched after cycle t6.

このように、条件分岐命令が分岐予測回路100でヒットして予測分岐方向が「分岐する」であった際に分岐方向が「分岐しない」となった場合には、命令パイプラインとしてのペナルティは「2」サイクルとなる。   Thus, if the branch direction becomes “not branch” when the conditional branch instruction hits in the branch prediction circuit 100 and the predicted branch direction is “branch”, the penalty as an instruction pipeline is “2” cycles.

図13は、本発明の実施の形態において条件分岐命令が分岐予測回路100でヒットして予測分岐方向が「分岐しない」であった際に分岐方向が「分岐しない」となった場合の処理例を示すタイムチャートである。まず、サイクルt1で条件分岐命令の先頭ワードがフェッチされると、そのタイミングで分岐予測回路100における分岐予測が行われる。ここではヒットしたことを想定するため、信号線199の分岐予測ヒット信号はアクティブとなる。すると、次のサイクルt2では、条件分岐命令の次の命令がフェッチされる。なお、ここでは条件分岐命令は2ワードからなると想定する。   FIG. 13 shows a processing example when the branch direction becomes “not branch” when the conditional branch instruction hits in the branch prediction circuit 100 and the predicted branch direction is “not branch” in the embodiment of the present invention. It is a time chart which shows. First, when the first word of a conditional branch instruction is fetched in cycle t1, branch prediction in the branch prediction circuit 100 is performed at that timing. Here, since it is assumed that a hit has occurred, the branch prediction hit signal of the signal line 199 becomes active. Then, in the next cycle t2, the instruction next to the conditional branch instruction is fetched. Here, it is assumed that the conditional branch instruction consists of two words.

その後、サイクルt2以降は条件分岐命令の次の命令に続く命令が先行して順次フェッチされていく。そして、サイクルt4で条件分岐命令の分岐方向が確定して、その条件分岐命令の分岐方向が分岐予測回路100に登録更新される。ここでは、「分岐しない」となったことを想定しているため、分岐方向レジスタ110の対応するエントリには「分岐しない」旨の内容が登録される。   Thereafter, after cycle t2, the instruction following the instruction next to the conditional branch instruction is sequentially fetched in advance. Then, the branch direction of the conditional branch instruction is determined at cycle t4, and the branch direction of the conditional branch instruction is registered and updated in the branch prediction circuit 100. Here, since it is assumed that “not branched”, the content of “not branched” is registered in the corresponding entry of the branch direction register 110.

この例では「分岐しない」側の命令を先行してフェッチしていたため、次のサイクルt5では、先行してフェッチされていた3つの命令(「PC+2」番地、「PC+3」番地および「PC+4」番地)はフラッシュされることなくそのまま処理され、さらにその次(「PC+5」番地)の命令が引き続きフェッチされる。   In this example, since the instruction on the “not branching” side is fetched in advance, in the next cycle t5, the three instructions fetched in advance (address “PC + 2”, address “PC + 3”, and address “PC + 4”) ) Are processed as they are without being flushed, and the next instruction (address “PC + 5”) is continuously fetched.

このように、条件分岐命令が分岐予測回路100でヒットして予測分岐方向が「分岐しない」であった際に分岐方向が「分岐しない」となった場合には、条件分岐命令の2ワード目の命令フェッチを行わないため、命令パイプラインとしてのペナルティは「−1」サイクルとなる。   As described above, when the conditional branch instruction hits the branch prediction circuit 100 and the predicted branch direction is “do not branch” and the branch direction becomes “do not branch”, the second word of the conditional branch instruction. Since the instruction fetch is not performed, the penalty as the instruction pipeline is “−1” cycles.

図14は、本発明の実施の形態において条件分岐命令が分岐予測回路100でヒットして予測分岐方向が「分岐しない」であった際に分岐方向が「分岐する」となった場合の処理例を示すタイムチャートである。まず、サイクルt1で条件分岐命令の先頭ワードがフェッチされると、そのタイミングで分岐予測回路100における分岐予測が行われる。ここではヒットしたことを想定するため、信号線199の分岐予測ヒット信号はアクティブとなる。すると、次のサイクルt2では、条件分岐命令の次の命令がフェッチされる。なお、ここでは条件分岐命令は2ワードからなると想定する。   FIG. 14 shows an example of processing when the branch direction becomes “branch” when the conditional branch instruction hits the branch prediction circuit 100 and the predicted branch direction is “not branch” in the embodiment of the present invention. It is a time chart which shows. First, when the first word of a conditional branch instruction is fetched in cycle t1, branch prediction in the branch prediction circuit 100 is performed at that timing. Here, since it is assumed that a hit has occurred, the branch prediction hit signal on the signal line 199 becomes active. Then, in the next cycle t2, the instruction next to the conditional branch instruction is fetched. Here, it is assumed that the conditional branch instruction consists of two words.

その後、サイクルt2以降は条件分岐命令の次の命令に続く命令が先行して順次フェッチされていく。そして、サイクルt4で条件分岐命令の分岐方向が確定して、その条件分岐命令の分岐方向が分岐予測回路100に登録更新される。ここでは、「分岐する」となったことを想定しているため、分岐方向レジスタ110の対応するエントリには「分岐する」旨の内容が登録される。   Thereafter, after cycle t2, the instruction following the instruction next to the conditional branch instruction is sequentially fetched in advance. Then, the branch direction of the conditional branch instruction is determined at cycle t4, and the branch direction of the conditional branch instruction is registered and updated in the branch prediction circuit 100. Here, since it is assumed that “branch”, the content of “branch” is registered in the corresponding entry of the branch direction register 110.

この例では「分岐しない」側の命令を先行してフェッチしていたため、次のサイクルt5では、先行してフェッチされていた3つの命令(「PC+2」番地、「PC+3」番地および「PC+4」番地)はフラッシュされ、確定した分岐先の命令がフェッチされる。サイクルt6以降では、順次その後続命令がフェッチされていく。   In this example, since the instruction on the “not branching” side is fetched in advance, in the next cycle t5, the three instructions fetched in advance (address “PC + 2”, address “PC + 3”, and address “PC + 4”) ) Is flushed, and the determined branch destination instruction is fetched. Subsequent instructions are sequentially fetched after cycle t6.

このように、条件分岐命令が分岐予測回路100でヒットして予測分岐方向が「分岐しない」であった際に分岐方向が「分岐する」となった場合には、命令パイプラインとしてのペナルティは「2」サイクルとなる。   Thus, if the branch direction becomes “branch” when the conditional branch instruction hits in the branch prediction circuit 100 and the predicted branch direction is “not branch”, the penalty as the instruction pipeline is “2” cycles.

これらの説明から明らかなように、本発明の実施の形態によれば、命令フェッチ回路230において複数ワードからなる分岐命令の一部のワードのみがフェッチされた段階で、分岐予測回路100における分岐予測を行なわせて、分岐命令の残りのワードをフェッチすることなく予測分岐先の命令をフェッチするよう演算制御回路210から命令フェッチ回路230に指示することにより、高速な分岐予測を行うことができる。   As is apparent from these descriptions, according to the embodiment of the present invention, the branch prediction in the branch prediction circuit 100 is performed at the stage where only a part of the words of the branch instruction consisting of a plurality of words is fetched in the instruction fetch circuit 230. Thus, the operation control circuit 210 instructs the instruction fetch circuit 230 to fetch the predicted branch destination instruction without fetching the remaining words of the branch instruction, so that high-speed branch prediction can be performed.

例えば、2ワードからなる無条件分岐命令については、分岐予測回路100でヒットした場合には無条件分岐命令の2ワード目の命令フェッチを行わないで済むため、命令パイプラインとしてのペナルティは「−1」サイクルとなり、従来よりも「1」サイクル高速に処理することができる。また、2ワードからなる条件分岐命令については、分岐予測回路100でヒットして分岐予測が成功した場合には条件分岐命令の2ワード目の命令フェッチを行わないで済むため、命令パイプラインとしてのペナルティは「−1」サイクルとなり、やはり従来よりも「1」サイクル高速に処理することができる。   For example, for an unconditional branch instruction consisting of two words, if the branch prediction circuit 100 hits, it is not necessary to fetch the second word of the unconditional branch instruction. It becomes 1 ”cycle, and processing can be performed at a higher speed by“ 1 ”cycle than before. For conditional branch instructions consisting of two words, if the branch prediction circuit 100 hits and branch prediction is successful, it is not necessary to fetch the second word of the conditional branch instruction. The penalty is “−1” cycle, and it is possible to process the “1” cycle faster than before.

すなわち、本発明の実施の形態によれば、分岐予測が成功している限り、複数ワードからなる分岐命令を1ワードの実行サイクルでパイプラインストールやバブルなしに実行することが可能となる。通常の命令シーケンス中で分岐予測回路における分岐予測成功率は80%を超えると言われており、本発明の実施の形態による命令パイプラインのペナルティ削減は実効面でも有用である。   That is, according to the embodiment of the present invention, as long as the branch prediction is successful, a branch instruction consisting of a plurality of words can be executed in one word execution cycle without pipeline installation or bubbles. It is said that the branch prediction success rate in the branch prediction circuit exceeds 80% in a normal instruction sequence, and the instruction pipeline penalty reduction according to the embodiment of the present invention is also effective in terms of effectiveness.

なお、本発明の実施の形態は本発明を具現化するための一例を示したものであり、以下に示すように特許請求の範囲における発明特定事項とそれぞれ対応関係を有するが、これに限定されるものではなく本発明の要旨を逸脱しない範囲において種々の変形を施すことができる。   The embodiment of the present invention is an example for embodying the present invention and has a corresponding relationship with the invention-specific matters in the claims as shown below, but is not limited thereto. However, various modifications can be made without departing from the scope of the present invention.

すなわち、請求項1において、命令取得制御手段は例えば演算制御回路210に対応する。また、分岐予測手段は例えば分岐予測回路100に対応する。   That is, in claim 1, the instruction acquisition control means corresponds to the arithmetic control circuit 210, for example. A branch prediction unit corresponds to the branch prediction circuit 100, for example.

また、請求項7において、命令取得手段は例えば命令フェッチ回路230に対応する。また、命令取得制御手段は例えば演算制御回路210に対応する。また、分岐予測手段は例えば分岐予測回路100に対応する。   Further, in claim 7, the instruction acquisition means corresponds to the instruction fetch circuit 230, for example. The instruction acquisition control means corresponds to the arithmetic control circuit 210, for example. A branch prediction unit corresponds to the branch prediction circuit 100, for example.

また、請求項8において、命令取得手段は例えば命令フェッチ回路230に対応する。また、命令取得制御手段は例えば演算制御回路210に対応する。また、命令実行手段は例えば命令実行ステージ540に対応する。命令取得手段は例えば命令フェッチ回路230に対応する。また、命令取得制御手段は例えば演算制御回路210に対応する。また、分岐予測手段は例えば分岐予測回路100に対応する。   Further, in claim 8, the instruction acquisition means corresponds to the instruction fetch circuit 230, for example. The instruction acquisition control means corresponds to the arithmetic control circuit 210, for example. The instruction execution means corresponds to the instruction execution stage 540, for example. The instruction acquisition means corresponds to the instruction fetch circuit 230, for example. The instruction acquisition control means corresponds to the arithmetic control circuit 210, for example. A branch prediction unit corresponds to the branch prediction circuit 100, for example.

また、請求項9において、命令メモリは例えばメモリ300に対応する。また、命令取得手段は例えば命令フェッチ回路230に対応する。また、命令取得制御手段は例えば演算制御回路210に対応する。また、命令実行手段は例えば命令実行ステージ540に対応する。命令取得手段は例えば命令フェッチ回路230に対応する。また、命令取得制御手段は例えば演算制御回路210に対応する。また、分岐予測手段は例えば分岐予測回路100に対応する。   Further, in claim 9, an instruction memory corresponds to the memory 300, for example. An instruction acquisition unit corresponds to the instruction fetch circuit 230, for example. The instruction acquisition control means corresponds to the arithmetic control circuit 210, for example. The instruction execution means corresponds to the instruction execution stage 540, for example. The instruction acquisition means corresponds to the instruction fetch circuit 230, for example. The instruction acquisition control means corresponds to the arithmetic control circuit 210, for example. A branch prediction unit corresponds to the branch prediction circuit 100, for example.

なお、本発明の実施の形態において説明した処理手順は、これら一連の手順を有する方法として捉えてもよい。   Note that the processing procedure described in the embodiment of the present invention may be regarded as a method having a series of these procedures.

本発明の実施の形態におけるコンピュータシステムの一構成例を示す図である。It is a figure which shows the example of 1 structure of the computer system in embodiment of this invention. 本発明の実施の形態における分岐予測回路100の一構成例を示す図である。It is a figure which shows the example of 1 structure of the branch prediction circuit 100 in embodiment of this invention. 本発明の実施の形態におけるプロセッサ200の命令パイプライン構成例を示す図である。It is a figure which shows the example of an instruction pipeline structure of the processor 200 in embodiment of this invention. 本発明の実施の形態における分岐命令の命令フォーマットの一例を示す図である。It is a figure which shows an example of the instruction format of the branch instruction in embodiment of this invention. 本発明の実施の形態における演算制御回路210の無条件分岐命令に対する処理例を示す流れ図である。It is a flowchart which shows the process example with respect to the unconditional branch instruction of the arithmetic control circuit 210 in embodiment of this invention. 本発明の実施の形態において無条件分岐命令が分岐予測回路100でミスヒットした場合の処理例を示すタイムチャートである。6 is a time chart showing an example of processing when an unconditional branch instruction misses in the branch prediction circuit 100 in the embodiment of the present invention. 本発明の実施の形態において無条件分岐命令が分岐予測回路100でヒットした場合の処理例を示すタイムチャートである。6 is a time chart showing an example of processing when an unconditional branch instruction hits in the branch prediction circuit 100 in the embodiment of the present invention. 本発明の実施の形態における演算制御回路210の条件分岐命令に対する処理例を示す流れ図である。It is a flowchart which shows the process example with respect to the conditional branch instruction of the arithmetic control circuit 210 in embodiment of this invention. 本発明の実施の形態において条件分岐命令が分岐予測回路100でミスヒットした際に分岐方向が「分岐する」となった場合の処理例を示すタイムチャートである。5 is a time chart showing an example of processing when the branch direction becomes “branch” when a conditional branch instruction misses in the branch prediction circuit 100 in the embodiment of the present invention. 本発明の実施の形態において条件分岐命令が分岐予測回路100でミスヒットした際に分岐方向が「分岐しない」となった場合の処理例を示すタイムチャートである。6 is a time chart showing an example of processing when the branch direction becomes “not branching” when a conditional branch instruction misses in the branch prediction circuit 100 in the embodiment of the present invention. 本発明の実施の形態において条件分岐命令が分岐予測回路100でヒットして予測分岐方向が「分岐する」であった際に分岐方向が「分岐する」となった場合の処理例を示すタイムチャートである。Time chart showing an example of processing when the branch direction becomes “branch” when the conditional branch instruction hits in the branch prediction circuit 100 and the predicted branch direction is “branch” in the embodiment of the present invention. It is. 本発明の実施の形態において条件分岐命令が分岐予測回路100でヒットして予測分岐方向が「分岐する」であった際に分岐方向が「分岐しない」となった場合の処理例を示すタイムチャートである。Time chart showing an example of processing when the branch direction becomes “not branch” when the conditional branch instruction hits in the branch prediction circuit 100 and the predicted branch direction is “branch” in the embodiment of the present invention. It is. 本発明の実施の形態において条件分岐命令が分岐予測回路100でヒットして予測分岐方向が「分岐しない」であった際に分岐方向が「分岐しない」となった場合の処理例を示すタイムチャートである。A time chart showing a processing example when the branch direction becomes “not branch” when the conditional branch instruction hits in the branch prediction circuit 100 and the predicted branch direction is “not branch” in the embodiment of the present invention. It is. 本発明の実施の形態において条件分岐命令が分岐予測回路100でヒットして予測分岐方向が「分岐しない」であった際に分岐方向が「分岐する」となった場合の処理例を示すタイムチャートである。Time chart showing an example of processing when the branch direction becomes “branch” when the conditional branch instruction hits in the branch prediction circuit 100 and the predicted branch direction is “not branch” in the embodiment of the present invention. It is.

符号の説明Explanation of symbols

100 分岐予測回路
110 分岐方向レジスタ
120 分岐先アドレスレジスタ
130 分岐命令アドレスレジスタ
140 比較器
150 方向選択器
160 アドレス選択器
170 論理和回路
191 予測分岐方向
192 予測分岐先アドレス
199 分岐予測ヒット
200 プロセッサ
210 演算制御回路
211 分岐方向更新信指示
212 確定分岐先アドレス
213 アドレス更新指示
218 次命令アドレス
219 命令フェッチアドレス
229 プログラムカウンタ
230 命令フェッチ回路
239 命令
300 メモリ
DESCRIPTION OF SYMBOLS 100 Branch prediction circuit 110 Branch direction register 120 Branch destination address register 130 Branch instruction address register 140 Comparator 150 Direction selector 160 Address selector 170 OR circuit 191 Predicted branch direction 192 Predicted branch destination address 199 Branch prediction hit 200 Processor 210 Operation Control circuit 211 Branch direction update signal instruction 212 Determined branch destination address 213 Address update instruction 218 Next instruction address 219 Instruction fetch address 229 Program counter 230 Instruction fetch circuit 239 Instruction 300 Memory

Claims (9)

コンピュータプログラムに含まれる各命令の取得を制御する命令取得制御手段と、
前記命令が複数語からなる分岐命令である場合には当該分岐命令の一部の語のみが取得された際に当該分岐命令に関する分岐予測情報を生成する分岐予測手段とを具備し、
前記命令取得制御手段は、前記複数語からなる分岐命令の前記一部の語のみが取得された直後は前記分岐予測情報に従った命令を取得させることを特徴とする命令取得制御回路。
Command acquisition control means for controlling acquisition of each command included in the computer program;
Branch prediction means for generating branch prediction information related to the branch instruction when only a partial word of the branch instruction is acquired when the instruction is a branch instruction consisting of a plurality of words;
The instruction acquisition control circuit is configured to acquire an instruction according to the branch prediction information immediately after the partial words of the branch instruction including the plurality of words are acquired.
前記分岐予測情報は、予測される分岐発生の有無および分岐が発生する場合に予測される分岐先アドレスを含むことを特徴とする請求項1記載の命令取得制御回路。   2. The instruction acquisition control circuit according to claim 1, wherein the branch prediction information includes a predicted presence / absence of a branch and a branch destination address predicted when the branch occurs. 前記命令取得制御手段は、前記分岐予測情報において分岐発生がないと予測された場合には前記複数語からなる分岐命令の残りの語を取得させずに当該分岐命令の後続命令を取得させることを特徴とする請求項2記載の命令取得制御回路。   The instruction acquisition control means is configured to acquire a subsequent instruction of the branch instruction without acquiring the remaining words of the branch instruction consisting of the plurality of words when it is predicted that no branch occurs in the branch prediction information. The instruction acquisition control circuit according to claim 2, wherein: 前記分岐予測手段は、各分岐命令に対応して当該分岐命令の命令アドレスを保持する分岐命令アドレスレジスタと、当該分岐命令の予測される分岐先アドレスを保持する分岐先アドレスレジスタと、当該分岐命令の予測される分岐発生の有無を保持する分岐方向レジスタと、前記複数語からなる分岐命令の命令アドレスと前記分岐命令アドレスレジスタに保持された命令アドレスとの一致を検出する検出器を備え、前記一致が検出された場合にはその命令アドレスに対応する分岐先アドレスおよび分岐発生の有無を前記分岐先アドレスレジスタおよび前記分岐方向レジスタからそれぞれ読み出して前記分岐予測情報として出力することを特徴とする請求項1記載の命令取得制御回路。   The branch prediction means includes a branch instruction address register that holds an instruction address of the branch instruction corresponding to each branch instruction, a branch destination address register that holds a predicted branch destination address of the branch instruction, and the branch instruction A branch direction register that holds the presence or absence of a predicted branch occurrence, and a detector that detects a match between the instruction address of the branch instruction consisting of the plurality of words and the instruction address held in the branch instruction address register, When a match is detected, a branch destination address corresponding to the instruction address and the presence / absence of a branch are read from the branch destination address register and the branch direction register, respectively, and output as the branch prediction information. The instruction acquisition control circuit according to Item 1. 前記命令取得制御手段は、前記一致が検出された場合において分岐発生がないと予測された際には前記複数語からなる分岐命令の残りの語を取得させずに当該分岐命令の後続命令を取得させることを特徴とする請求項4記載の命令取得制御回路。   The instruction acquisition control means acquires a subsequent instruction of the branch instruction without acquiring the remaining words of the branch instruction consisting of the plurality of words when it is predicted that no branch occurs when the match is detected. The instruction acquisition control circuit according to claim 4, wherein: 前記命令取得制御手段は、前記一致が検出されなかった場合においては前記複数語からなる分岐命令の残りの語を取得させることを特徴とする請求項4記載の命令取得制御回路。   5. The instruction acquisition control circuit according to claim 4, wherein the instruction acquisition control means acquires the remaining words of the branch instruction consisting of the plurality of words when the coincidence is not detected. コンピュータプログラムに含まれる各命令を取得する命令取得手段と、
前記命令取得手段における前記命令の取得を制御する命令取得制御手段と、
前記命令が複数語からなる分岐命令である場合には当該分岐命令の一部の語のみが取得された際に当該分岐命令に関する分岐予測情報を生成する分岐予測手段とを具備し、
前記命令取得制御手段は、前記複数語からなる分岐命令の前記一部の語のみが取得された直後は前記分岐予測情報に従った命令を命令取得手段に取得させることを特徴とする命令取得回路。
Instruction acquisition means for acquiring each instruction included in the computer program;
Command acquisition control means for controlling acquisition of the command in the command acquisition means;
Branch prediction means for generating branch prediction information related to the branch instruction when only a partial word of the branch instruction is acquired when the instruction is a branch instruction consisting of a plurality of words;
The instruction acquisition control means causes the instruction acquisition means to acquire an instruction according to the branch prediction information immediately after only the partial words of the branch instruction consisting of the plurality of words are acquired. .
コンピュータプログラムに含まれる各命令を取得する命令取得手段と、
前記命令取得手段において取得された命令を実行する命令実行手段と、
前記命令取得手段における前記命令の取得を制御する命令取得制御手段と、
前記命令が複数語からなる分岐命令である場合には当該分岐命令の一部の語のみが取得された際に当該分岐命令に関する分岐予測情報を生成する分岐予測手段とを具備し、
前記命令取得制御手段は、前記複数語からなる分岐命令の前記一部の語のみが取得された直後は前記分岐予測情報に従った命令を命令取得手段に取得させることを特徴とするプロセッサ。
Instruction acquisition means for acquiring each instruction included in the computer program;
Instruction execution means for executing the instruction acquired by the instruction acquisition means;
Command acquisition control means for controlling acquisition of the command in the command acquisition means;
Branch prediction means for generating branch prediction information related to the branch instruction when only a partial word of the branch instruction is acquired when the instruction is a branch instruction consisting of a plurality of words;
The processor is characterized in that the instruction acquisition control means causes the instruction acquisition means to acquire an instruction according to the branch prediction information immediately after the partial words of the branch instruction consisting of the plurality of words are acquired.
コンピュータプログラムに含まれる各命令を保持する命令メモリと、
前記命令メモリから前記命令を取得する命令取得手段と、
前記命令取得手段において取得された命令を実行する命令実行手段と、
前記命令取得手段における前記命令の取得を制御する命令取得制御手段と、
前記命令が複数語からなる分岐命令である場合には当該分岐命令の一部の語のみが取得された際に当該分岐命令に関する分岐予測情報を生成する分岐予測手段とを具備し、
前記命令取得制御手段は、前記複数語からなる分岐命令の前記一部の語のみが取得された直後は前記分岐予測情報に従った命令を命令取得手段に取得させることを特徴とするコンピュータシステム。
An instruction memory for holding each instruction included in the computer program;
Command acquisition means for acquiring the command from the command memory;
Instruction execution means for executing the instruction acquired by the instruction acquisition means;
Command acquisition control means for controlling acquisition of the command in the command acquisition means;
Branch prediction means for generating branch prediction information related to the branch instruction when only a partial word of the branch instruction is acquired when the instruction is a branch instruction consisting of a plurality of words;
The instruction acquisition control means causes the instruction acquisition means to acquire an instruction according to the branch prediction information immediately after the partial words of the branch instruction consisting of the plurality of words are acquired.
JP2005045661A 2005-02-22 2005-02-22 Instruction fetch circuit Pending JP2006235723A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005045661A JP2006235723A (en) 2005-02-22 2005-02-22 Instruction fetch circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005045661A JP2006235723A (en) 2005-02-22 2005-02-22 Instruction fetch circuit

Publications (1)

Publication Number Publication Date
JP2006235723A true JP2006235723A (en) 2006-09-07

Family

ID=37043337

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005045661A Pending JP2006235723A (en) 2005-02-22 2005-02-22 Instruction fetch circuit

Country Status (1)

Country Link
JP (1) JP2006235723A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104978282A (en) * 2014-04-04 2015-10-14 上海芯豪微电子有限公司 Cache system and method

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63124135A (en) * 1986-11-13 1988-05-27 Mitsubishi Electric Corp Data processor

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63124135A (en) * 1986-11-13 1988-05-27 Mitsubishi Electric Corp Data processor

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JPN6009052653, David A.Patterson John L.Hennessy, コンピュータ・アーキテクチャ−設計・実現・評価の定量的アプローチ−, 19921225, 1版, P.302−P.307, JP, 日経BP社 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104978282A (en) * 2014-04-04 2015-10-14 上海芯豪微电子有限公司 Cache system and method

Similar Documents

Publication Publication Date Title
JP5653762B2 (en) System and method for selectively committing the results of executed instructions
KR101827747B1 (en) Controlling the execution of adjacent instructions that are dependent upon a same data condition
CN106681695B (en) Fetching branch target buffer in advance
JP5941488B2 (en) Convert conditional short forward branch to computationally equivalent predicate instruction
JP2009099097A (en) Data processor
KR101048178B1 (en) Method and apparatus for correcting link stack circuit
JP3749233B2 (en) Instruction execution method and apparatus in pipeline
JP2009059246A (en) Microprocessor
EP3198400B1 (en) Dependency-prediction of instructions
US11294681B2 (en) Processing device with a microbranch target buffer for branch prediction using loop iteration count
JP3811140B2 (en) Information processing device
JP5233078B2 (en) Processor and processing method thereof
JP2008071061A (en) Information processor
JP3532835B2 (en) Data processing device and program conversion device
JP2006235723A (en) Instruction fetch circuit
JP4728877B2 (en) Microprocessor and pipeline control method
JP5696210B2 (en) Processor and instruction processing method thereof
JP2004038338A (en) Information processor having branch estimation mechanism
JP2010015298A (en) Information processor and instruction fetch control method
JP4002288B2 (en) Information processing device
US7343481B2 (en) Branch prediction in a data processing system utilizing a cache of previous static predictions
JP5679263B2 (en) Information processing apparatus and microinstruction processing method
JP4049490B2 (en) Information processing device
WO2008038373A1 (en) Processor for increasing the branching prediction speed
JP2007310668A (en) Microprocessor

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20070618

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20090811

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20091013

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20091126

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20100914