JP3800533B2 - Program counter control method and processor - Google Patents
Program counter control method and processor Download PDFInfo
- Publication number
- JP3800533B2 JP3800533B2 JP2002190557A JP2002190557A JP3800533B2 JP 3800533 B2 JP3800533 B2 JP 3800533B2 JP 2002190557 A JP2002190557 A JP 2002190557A JP 2002190557 A JP2002190557 A JP 2002190557A JP 3800533 B2 JP3800533 B2 JP 3800533B2
- Authority
- JP
- Japan
- Prior art keywords
- branch
- instruction
- program counter
- signal
- destination address
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims description 50
- 230000007246 mechanism Effects 0.000 claims description 23
- 238000010586 diagram Methods 0.000 description 27
- 230000008569 process Effects 0.000 description 10
- 238000003672 processing method Methods 0.000 description 7
- 230000003111 delayed effect Effects 0.000 description 6
- 230000015654 memory Effects 0.000 description 4
- 230000015556 catabolic process Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000006731 degradation reaction Methods 0.000 description 2
- 230000006872 improvement Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000012790 confirmation Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/32—Address formation of the next instruction, e.g. by incrementing the instruction counter
- G06F9/321—Program or instruction counter, e.g. incrementing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/38—Concurrent instruction execution, e.g. pipeline or look ahead
- G06F9/3836—Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
- G06F9/3842—Speculative instruction execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/38—Concurrent instruction execution, e.g. pipeline or look ahead
- G06F9/3836—Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
- G06F9/3842—Speculative instruction execution
- G06F9/3844—Speculative instruction execution using dynamic branch prediction, e.g. using branch history tables
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Advance Control (AREA)
Description
【0001】
【発明の属する技術分野】
本発明はプログラムカウンタ制御方法及びプロセッサに係り、特に分岐予測を行うと共に分岐のための遅延命令を持つ命令制御において、分岐命令を含めた複数の命令が同時に完了する構成のプログラムカウンタ及びネクストプログラムカウンタを同時に更新・制御するためのプログラムカウンタ制御方法、及びそのようなプログラムカウンタ制御方法を用いるプロセッサに関する。
【0002】
【従来の技術】
近年、プロセッサの性能を向上させるために、様々な命令処理方式が用いられる。その中の1つに、アウトオブオーダ処理方式がある。アウトオブオーダ処理方式を採用したプロセッサにおいては、1つの命令実行の完了を待たずに後続の命令列を順次、複数のパイプラインに投入して命令を実行させることで、性能の向上を行なっている。
【0003】
しかし、先行している命令の実行結果が後続の命令の実行に影響を与える場合には、先行している命令実行が完了しなければ後続の命令を実行させることができない。後続の命令の実行に影響を与える命令の処理が遅ければ、その間後続の命令は実行できず、先行の命令完了を待ち続けることになる。このため、パイプラインに乱れが生じ、性能の低下を引き起こす。このようなパイプラインの乱れは、特に分岐命令の場合に顕著に現れる。
【0004】
分岐命令の中でも、条件分岐と呼ばれる命令の場合、条件分岐命令の直前で分岐条件(通常はコンディションコード)を変更する命令があると、分岐条件を変更する命令が完了し、分岐条件が確定するまで分岐が確定しない。従って、分岐命令の後続のシーケンスがわからないために、後続の命令を投入できず、処理が止まってしまい処理能力が低下する。このことはアウトオブオーダ処理方式を採用したプロセッサに限らず、ロック・ステップ・パイプライン等の処理方式を採用しているプロセッサにおいても同様の問題が生じるが、アウトオブオーダ処理方式を採用しているプロセッサにおいては、より顕著に性能の低下が生じる。そこで、分岐命令による性能低下を抑えるために、通常は、分岐予測を行う分岐予測機構をプロセッサ内の命令制御装置に設けて、分岐命令の高速化を図っている。
【0005】
分岐予測機構を備えたアウトオブオーダ処理方式を採用するプロセッサの場合、複数の分岐命令が分岐予測結果に基づいて実行パイプラインに投入される。分岐命令が分岐した場合は、分岐先アドレスを命令アドレスレジスタにセットする必要がある。尚、SPARC(商標)アーキテクチャを採用するプロセッサでは、この命令アドレスレジスタは、プログラムカウンタ・ネクストプログラムカウンタと呼ばれる。実行パイプライン上に複数の分岐命令が存在している場合、命令アドレスレジスタは、各分岐命令の分岐先アドレスを命令完了まで保持する必要がある。しかし、各分岐命令の分岐確定のタイミングは異なるため、従来は、実際には分岐しない分岐命令の分岐先アドレスまで保持する必要があった。
【0006】
実行パイプラインの分岐命令のスループットは、分岐命令制御部のスループット及び分岐先アドレスを保持するための分岐先アドレスレジスタの数で決まる。ところが、実際には分岐しない分岐命令の分岐先アドレスで分岐先アドレスレジスタを使用してしまうと、結果的に分岐命令のスループットを抑えてしまうことになる。このため、スループット改善のために、更に分岐先アドレスレジスタを増やす必要が生じてしまうという悪循環に陥ってしまっていた。
【0007】
命令制御装置において、その実行速度を決定するものの1つに、1サイクルにおける処理可能な命令数がある。アウトオブオーダ方式による命令制御装置においては、同時に複数の命令を完了することができる。通常、命令完了とは使用するレジスタ等のリソースの更新が完了した時点を指すが、同時に複数の命令を完了させる場合には、使用するリソースの更新も複数同時に完了させる必要がある。当然、命令アドレスレジスタも、複数の命令分更新する必要がある。SPARCアーキテクチャに代表される、分岐の遅延命令を有するアーキテクチャを制御する場合、分岐命令の分岐の可否により遅延命令の実行の有無が決まり、プログラムカウンタ・ネクストプログラムカウンタの2つのレジスタを更新する必要がある。このため、従来は、分岐命令は単独若しくは決まった位置(同時に命令完了する時の他の命令との相対的な位置)からしか命令完了(コミット)できなかった。通常、デコードのサイクルにおいて、パケット方式で分岐命令をパケットの最後の位置に置き命令完了する場合も、その位置を決めている。この場合、デコードサイクル及び命令完了サイクルは、分岐命令により制約を受けることになる。
【0008】
【発明が解決しようとする課題】
近年、LSI製造技術の向上等により、大容量のメモリを使用することが可能になり、オペレーテイングシステム(OS)やアプリケーションにおいて64ビット化が進められるようになった。これに伴い、命令制御装置においても64ビット化が求められている。しかし、64ビット化に伴い、使用するレジスタ等の回路が増大してしまう。分岐命令の制御に関わるレジスタも、64ビット化する必要があり、分岐先アドレスレジスタ等が増大してしまう。
【0009】
このように、単純に32ビット構成から64ビット構成にした場合、エントリー数は変わらずに、回路が2倍必要になってしまい、回路規模(実装面積)が増大してしまうという問題があった。
【0010】
しかし、現時点において、実際のプログラムの命令領域を4Gバイト以上使用するケースは少なく、プログラム中で4Gバイト境界を越えるケースが命令処理の性能を大きく左右することはあまり見られない。そこで、本発明は、分岐のスループットの向上を、できるだけ小さい回路規模(実装面積)で図れるプログラムカウンタ制御方法及びプロセッサを実現することを目的とする。
【0011】
【課題を解決するための手段】
上記の課題は、分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、分岐予測が成功して分岐命令が分岐した時に、分岐命令を含めた複数の命令を同時に命令完了させるステップと、プログラムカウンタ及びネクストプログラムカウンタを、完了した命令数に合わせて同時に更新するステップとを含むことを特徴とするプログラムカウンタ制御方法によって達成できる。
【0012】
上記の課題は、分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、分岐予測が成功して分岐命令が分岐しない時に、分岐命令を含めた複数の命令を同時に命令完了させるステップと、プログラムカウンタ及びネクストプログラムカウンタを、完了した命令数に合わせて同時に更新するステップとを含むことを特徴とするプログラムカウンタ制御方法によっても達成できる。
【0013】
上記の課題は、分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、分岐予測が失敗して分岐命令が分岐する時に、分岐命令を含めた複数の命令を同時に命令完了させるステップと、プログラムカウンタ及びネクストプログラムカウンタを、完了した命令数に合わせて同時に更新するステップとを含むことを特徴とするプログラムカウンタ制御方法によっても達成できる。
【0014】
上記の課題は、分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、分岐予測が失敗して分岐命令が分岐しない時に、分岐命令を含めた複数の命令を同時に命令完了させるステップと、プログラムカウンタ及びネクストプログラムカウンタを、完了した命令数に合わせて同時に更新するステップとを含むことを特徴とするプログラムカウンタ制御方法によっても達成できる。
【0015】
前記アーキテクチャは、64ビット長の命令アドレス空間を使用し、プログラムカウンタ制御方法は、命令の下位32ビットとキャリービット及びボロウビットのみを使用して、分岐命令制御及び分岐先アドレスの生成を行うステップを更に含んでも良い。
【0016】
上記の課題は、分岐予測部を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、分岐命令の分岐条件判定、分岐予測の成否及び命令再フェッチの制御を行い、複数の分岐命令を同時に制御可能な分岐命令制御部と、分岐することが確定した分岐命令の分岐先アドレスを複数格納する分岐先アドレスレジスタとを備え、該分岐先アドレスレジスタは、該分岐命令制御部及び該分岐予測部とは独立して制御可能であることを特徴とするプロセッサによっても達成できる。
【0017】
上記の課題は、分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、プログラムカウンタ及びネクストプログラムカウンタからなるプログラムカウンタ手段と、分岐予測が成功して分岐命令が分岐した時に、分岐命令を含めた複数の命令を同時に命令完了させる手段と、該プログラムカウンタ及び該ネクストプログラムカウンタを、完了した命令数に合わせて同時に更新する手段とを備えたことを特徴とするプロセッサによっても達成できる。
【0018】
上記の課題は、分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、プログラムカウンタ及びネクストプログラムカウンタからなるプログラムカウンタ手段と、分岐予測が成功して分岐命令が分岐しない時に、分岐命令を含めた複数の命令を同時に命令完了させる手段と、該プログラムカウンタ及び該ネクストプログラムカウンタを、完了した命令数に合わせて同時に更新する手段とを備えたことを特徴とするプロセッサによっても達成できる。
【0019】
上記の課題は、分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、プログラムカウンタ及びネクストプログラムカウンタからなるプログラムカウンタ手段と、分岐予測が失敗して分岐命令が分岐する時に、分岐命令を含めた複数の命令を同時に命令完了させる手段と、該プログラムカウンタ及び該ネクストプログラムカウンタを、完了した命令数に合わせて同時に更新する手段とを備えたことを特徴とするプロセッサによっても達成できる。
【0020】
上記の課題は、分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、プログラムカウンタ及びネクストプログラムカウンタからなるプログラムカウンタ手段と、分岐予測が失敗して分岐命令が分岐しない時に、分岐命令を含めた複数の命令を同時に命令完了させる手段と、該プログラムカウンタ及び該ネクストプログラムカウンタを、完了した命令数に合わせて同時に更新する手段とを備えたことを特徴とするプロセッサによっても達成できる。
【0021】
従って、本発明によれば、分岐のスループットの向上を、できるだけ小さい回路規模(実装面積)で図れるプログラムカウンタ制御方法及びプロセッサを実現することができる。
【0022】
【発明の実施の形態】
本発明になるプログラムカウンタ制御方法及び本発明になるプロセッサの各実施例を、以下図面と共に説明する。
【0023】
【実施例】
図1は、本発明になるプロセッサの一実施例を示すブロック図である。同図中、プロセッサ100は、命令ユニット21、メモリユニット22及び演算ユニット23を含む。命令ユニット21は、本発明になる命令制御方法の一実施例を採用する命令制御装置を構成する。メモリユニット22は、命令やデータ等を格納するために設けられ、演算ユニット23は、各種演算を実行するために設けられている。
【0024】
命令ユニット21は、図1に示す如く接続された分岐予測部1、命令フェッチ部2、命令バッファ部3、相対分岐アドレス生成部4、命令デコーダ部5、分岐命令実行部6、命令完了制御部9、分岐先アドレスレジスタ10及びプログラムカウンタ部11からなる。分岐命令実行部6は、分岐命令制御部7及びディレイスロットスタック部8からなる。プログラムカウンタ部11には、プログラムカウンタPC、ネクストプログラムカウンタnPC及び更新部が含まれる。
【0025】
分岐命令の制御は、分岐予測部1、分岐命令制御部7、命令完了制御部9及び分岐先アドレスレジスタ10において独立して制御できる。実行パイプライン上に存在する分岐命令は、命令デコーダ部5においてデコードされると、一旦分岐命令制御部7の制御下となる。分岐命令制御部7では、分岐命令の分岐条件判定、分岐予測の成否及び命令再フェッチの制御を行う。分岐命令制御部7で制御可能な分岐命令数は、エントリー数で決定される。分岐命令制御部7での制御は、分岐命令の分岐条件確定及び分岐先アドレス生成までであり、それ以降は命令完了制御部9において制御が行われる。分岐先アドレスレジスタ10では、分岐命令制御部7での制御から開放された分岐する分岐命令の分岐先アドレスを制御しており、命令完了、即ち、プログラムカウンタ部11の更新まで制御する。命令完了制御部9では、全命令の命令完了条件を制御しており、分岐命令は、分岐の可否によらず必ず制御される。実行パイプライン上に同時に存在できる分岐命令数MAXは、命令完了制御部9のエントリー数Nに依存し、分岐先アドレスレジスタ(エントリー数=M)がフル(FULL)になった時は、分岐する分岐命令数のMAXは、分岐命令制御部7のエントリー数Lとの和L+Mになる。分岐しない分岐命令は、分岐先アドレスレジスタ10の数に依存しない。分岐先アドレスレジスタ10の下での制御は、分岐命令制御部7から開放されて命令が完了するまでの間だけであるため、分岐命令制御部7の空きが存在する間は命令デコードが影響を受けることはない。
【0026】
分岐先アドレス生成は、命令相対分岐とレジスタ相対分岐の2種類に分けられる。命令相対分岐の分岐先アドレス生成は、相対分岐アドレス生成部4で計算され、分岐命令制御部7経由で分岐先アドレスレジスタ10に供給される。レジスタ相対分岐の分岐先アドレスは、命令実行ユニット23内で計算され、分岐命令制御部7経由で分岐先アドレスレジスタ10に供給される。例えば、レジスタ相対分岐の分岐先アドレスの下位32ビットは分岐命令制御部7経由で、上位32ビットは直接プログラムカウンタ部11に供給される。アドレス相対分岐の分岐先アドレスは、上位32ビットが変わる時はボロウ(Borrow)ビット、キャリー(Carry)ビットの有無に基づいて計算により求められるので、分岐命令制御部7では分岐先命令アドレスは(下位32ビット+4ビットパリティ+Borrowビット+Carryビット)*エントリー数で制御される。分岐先アドレスレジスタ10においても同様に、分岐先命令アドレスは(下位32ビット+4ビットパリティ+Borrowビット+Carryビット)*エントリー数で構成されている。命令アドレスの上位32ビットが変わる時は、一旦プログラムカウンタ部11に値をセットした後にプログラムカウンタ部11からのリトライにより命令フェッチを必ず行うようにする。
【0027】
使用するリソースの更新のための制御は、命令完了制御部9及びプログラムカウンタ部11で行われる。プログラムカウンタ部11の場合、命令完了(コミット)では同時に何命令が命令完了したか及び分岐する命令が命令完了したかどうかの情報が供給される。尚、分岐する命令が命令完了した場合は、その情報が分岐命令制御部7にも供給される。本実施例では、PC=nPC+(同時に命令完了した数-1)*4、nPC=nPC+(同時に命令完了した数*4)若しくは分岐先アドレスとなる。本実施例では、分岐する分岐命令はそれより前にある命令とは同時に命令完了できるが、その後ろにある命令とは同時に命令完了しないようになっている。これは、プログラムカウンタPCにセットするパスに、分岐先アドレスのパスを入れていないからであり、ネクストプログラムカウンタnPCと同様に、プログラムカウンタPCにも分岐先アドレスのパスを入れれば、分岐命令の同時命令完了数の制約はなくなる。分岐しない分岐命令においては、本実施例においても、同時命令完了数の制約は受けない。本実施例では、分岐命令が命令完了する際に、命令完了する位置の制約はなく、又、デコード時にも制約を受けない。
【0028】
図2は、図1に示す命令ユニット21の要部を、演算ユニット23と共に示すブロック図である。図2中、図1と同一部分には同一符号を付し、その説明は省略する。図2において、命令デコーダ部5から分岐命令制御部7及び命令完了制御部9への入力の図示は省略する。プログラムカウンタ部11は、プログラムカウンタPC、ネクストプログラムカウンタnPC、ラッチ回路11−1、プログラムカウンタ(PC)用更新回路11−2及びネクストプログラムカウンタ(nPC)用更新回路11−3からなる。以下の説明で、特に明記していない場合を除き、アドレスは全てロジカルアドレスであるものとする。
【0029】
本実施例では、説明の便宜上、SPARCアーキテクチャが採用されているものとして説明する。命令は、アウトオブオーダで処理され、分岐命令実行部6においては、分岐命令制御部7内に複数のRSBR0〜RSBRm(Reservation Station for Branch)が設けられ、ディレイスロットスタック部8内に複数のDSS0〜DSSn(Delay Slot Stack)が設けられている。又、分岐命令予測機構として、分岐予測部1が設けられている。
【0030】
図3は、上記の如き分岐命令制御時の動作を説明するフローチャートである。同図中、ステップS1は、分岐命令が終了したか否かを判定し、判定結果がYESになると、ステップS2は、分岐命令が分岐するか否かを判定する。ステップS2の判定結果がNOであると、処理は後述するステップS4へ進む。他方、ステップS2の判定結果がYESであると、ステップS3は、分岐先アドレスレジスタ10に空きエントリーが存在するか否かを判定する。ステップS3の判定結果がYESになると、処理はステップS4へ進む。
【0031】
ステップS4は、分岐命令制御部7での分岐命令の制御を完了し、処理はステップS5及びステップS6へ進む。ステップS5は、分岐命令の完了を命令完了制御部9へ通知する。ステップS5と同時に、ステップS6は、分岐する場合は分岐アドレスの保持を分岐先アドレスレジスタ10に指示する。ステップS5及びステップS6の後、ステップS7は、リソースの更新、即ち、プログラムカウンタ部11の更新を更新回路11−2,11−3により行う。
【0032】
図4は、プログラムカウンタ部11の更新時の動作を説明するフローチャートである。同図に示す処理は、図3に示すステップS7の処理に対応する。図4において、ステップS11は、命令完了の条件がそろっているか否かを判定する。ステップS11の判定結果がYESになると、ステップS12は、同時に何命令が命令完了したか及び分岐する命令が命令完了したかの情報をプログラムカウンタ部11へ通知する。ステップS12の後、ステップS13及びステップS14が同時に行われる。
【0033】
ステップS13は、分岐する命令が命令完了した場合、その情報を分岐先アドレスレジスタ10へ通知し、処理は後述するステップS15へ進む。他方、ステップS14は、通知される情報に、分岐する命令が含まれているか否かを判定し、判定結果がYESであると処理はステップS15へ進み、NOであると処理はステップS16へ進む。ステップS15は、PC=nPC+(同時に命令完了した数-1)*4、nPC=分岐先アドレスに設定する。又、ステップS16は、PC=nPC+(同時に命令完了した数-1)*4、nPC=nPC+(同時に命令完了した数*4)に設定する。
【0034】
図2にの説明に戻るに、命令フェッチ要求が命令フェッチ部2から出されると、命令フェッチ要求が要求する命令アドレスに対して、分岐予測部1で分岐予測が行われる。分岐予測部1に、命令フェッチ要求が要求する命令アドレスに該当するエントリーが存在する場合は、対応する命令フェッチデータに分岐予測が行われたことを示すフラグBRHIS_HITが付加され、分岐予測された分岐先命令アドレスの命令フェッチ要求が命令フェッチ部2へ出力される。命令フェッチデータは、命令フェッチ部2から、付加されたフラグBRHIS_HITと共に命令デコーダ部5に供給される。命令デコーダ部5で命令がデコードされ、命令が無効(Annul)ビットを持つBPr,Bicc,BPcc, FBcc,FBPcc等の分岐命令の場合は、フラグBRHIS_HITと共に無効ビットを参照する。
【0035】
命令デコーダ部5は、フラグBRHIS_HIT=1の場合には、無条件で後続の1命令を実行するが、フラグBRHIS_HIT=0で無効ビット=1の場合には、後続の1命令をNon-Operation命令(NOP命令)としてデコードを行う。つまり、命令デコーダ部5は、フラグBRHIS_HIT=1であれば通常通りにデコードを行い、デコード結果が分岐命令でフラグBRHIS_HIT=0であり無効ビット=1の場合は、後続の1命令をNOP命令に変える。SPARCアーキテクチャでは、無効ビットを有する分岐命令は、分岐成立の場合はディレイスロット命令(遅延命令)を実行し、分岐不成立の場合で無効ビットが1の場合はディレイスロット命令を実行せず、無効ビットが0の場合のみディレイスロット命令を実行する。分岐予測を行うということは、命令が分岐命令であり、且つ、分岐成立と予測していることであるので、ディレイスロット命令を実行すると予測していることと実質的に同じである。尚、無効ビットを持たないCALL命令、JMPL命令及びRETURN命令は、無条件分岐であり、いずれもディレイスロット命令を必ず実行することから、同じように取り扱える。COND=1000であるALWAYS_BRANCH命令については、無条件分岐であるにもかかわらず、無効ビット=1の時はディレイスロット命令を実行しないが、このようなケースは出現頻度が少ないことから、命令再フェッチによりリカバリーすることができる。
【0036】
分岐予測を行った場合、予測が当たった場合は再命令フェッチを行う必要はなく、予測した分岐先の命令シーケンスと実際の命令シーケンスは同じである。又、分岐予測が当たったということは、ディレイスロット命令の実行も正しく行われているということであり、この場合はそのまま命令を実行し続ける。
【0037】
分岐予測を行い予測が外れた場合は、再命令フェッチが必要である。分岐先の命令シーケンスは、間違ったものを実行しており、実際の命令シーケンスを実行し直す必要がある。この場合、ディレイスロット命令の実行も誤っているため、ディレイスロット命令からやり直す必要がある。本実施例では、分岐命令制御部8から分岐先の再命令フェッチ要求を命令フェッチ部2に出力した後、ディレイスロットスタック部8より再実行するディレイスロット命令を取り出し、命令デコーダ部5へディレイスロット命令を供給する。これにより、ディレイスロット命令を含めて、分岐予測のリカバリーを行っている。
【0038】
全ての分岐命令は、命令デコード部5でデコードされると、分岐命令制御部7及び命令完了制御部9にエントリーを作成する。分岐命令制御部7では、分岐命令の分岐先アドレス及び分岐条件の確定まで分岐命令を制御する。命令完了制御部9では、命令完了のための制御、即ち、命令をインオーダで完了させるための制御が行われる。
【0039】
SPARCでは、上記の如く、命令相対分岐及びレジスタ相対分岐の2種類が定義されている。命令相対分岐の分岐先アドレスは、相対分岐アドレス生成部4で生成され、レジスタ相対分岐の分岐先アドレスは、演算ユニット23で生成される。相対分岐アドレス生成部4で生成された分岐先アドレスは、分岐命令制御部7に供給される。分岐命令制御部7は、相対分岐アドレス生成部4から分岐先アドレスPCRAG_TGT_PC[31:0,P3:P0]、CARRYビットPCRAG_TGTPC_CARRY、BORROWビットPCRAG_TGTPC_BORROWを供給され、演算ユニット23から分岐先アドレスEXA_TGT_PC[31:0,P3:P0]を供給される。又、演算ユニット23は、この時EXA_TGT_PC[63:32,P7:P4]をプログラムカウンタ部11に供給する。
【0040】
分岐命令制御部7での分岐命令の制御が完了すると、分岐命令は命令完了制御部9で命令完了まで制御される。分岐命令が分岐命令制御部7から開放される時、分岐命令が分岐する場合は、分岐先アドレスが分岐先アドレスレジスタ10に格納される。分岐先アドレスレジスタ10に格納されている分岐先アドレスは、対応する分岐命令のサイクルWでプログラムカウンタ部11のネクストプログラムカウンタnPCの更新に使われる。サイクルWは、レジスタ類の更新サイクルであり、プログラムカウンタPC及びネクストプログラムカウンタnPCもこのサイクルWにおいて更新される。分岐命令制御部7から分岐命令を開放する時、開放される分岐命令が分岐する時は分岐アドレスレジスタ10のエントリーに空きがあるか否かが確認され、空きがある場合は分岐命令制御部7から開放されるが、空きがない場合は分岐命令制御部7から開放されない。しかし、分岐アドレスレジスタ10がフル(FULL)であっても、分岐命令が分岐しない場合は、分岐命令は分岐命令制御部7から開放される。
【0041】
本実施例では、分岐命令制御部7は10個のエントリーを持ち、分岐アドレスレジスタ10は2個のエントリーを持っている。分岐アドレスレジスタ10がフル(FULL)であっても、分岐命令制御部7内にある後続の分岐命令の制御は、分岐命令制御部7がフル(FULL)になるまで制御が止まることはない。分岐アドレスレジスタ10のエントリーは、VALID、分岐先アドレスTGT_PC[31:0,P3:P0]、CARRYビットTGT_PC_CARRY、BORROWビットTGT_PC_BORROW、IID[5:0]により構成されている。エントリーの有効性を示すVALID=1である時は、そのエントリーが有効であることを示す。分岐する分岐命令が分岐命令制御部7から開放されると、分岐アドレスレジスタ10にエントリーが作成され、VALID=1にセットされ、その分岐命令のサイクルWまでエントリーが保持される。
【0042】
図5は、分岐命令制御部7内のエントリーを示す概念図である。同図に示す10個エントリーは、夫々VALID、分岐先アドレスTGT_PC[31:0,P3:P0]、分岐アドレスPC[31:0,P3:P0]、CARRYビット、BORROWビット及びIIDを含む。
又、図6は、分岐先アドレスレジスタ10の概要図である。同図に示す2個のエントリーA、Bは、夫々VALID、分岐先アドレスTGT_PC[31:0,P3:P0]、CARRYビット、BORROWビット及びIIDを含む。
【0043】
図7は、プログラムカウンタ部11の構成を示すブロック図である。プログラムカウンタ部11のプログラムカウンタPC及びネクストプログラムカウンタnPCの更新は、命令の完了(命令完了サイクル)後のサイクルWにおいて同時に行われる。更新については、大きく分けて以下のケース(1)〜(4)が存在する。
(1)複数の命令が同時に命令完了し、その中に分岐する分岐命令が存在しない場合。
(2)複数の命令が同時に命令完了し、その中に分岐する分岐命令が存在する場合。
(3)命令が4Gバイト境界を跨いで実行される場合。
(4)命令が命令完了した時その命令で割り込みが発生した場合。
【0044】
プログラムカウンタ部11のプログラムカウンタPC及びネクストプログラムカウンタnPCの更新は、基本的にはPC=nPC+(同時に命令完了した数-1)*4、nPC=nPC+(同時に命令完了した数*4)or分岐先アドレスとなる。従って、PC=nPC+(同時に命令完了した数-1)*4、nPC=PC+4 or分岐先アドレスとなる。
【0045】
本実施例では、分岐命令の遅延命令(ディレイスロット(DSS)命令)を、無効(ANNUL)にするという事象を、無効にされるDSS命令をNon-Operation命令(NOP命令)相当に置き換えることで実現している。プログラムカウンタ部11のプログラムカウンタPC及びネクストプログラムカウンタnPCについても、命令を実行した時と同じように更新を行う。従って、分岐しない分岐命令が命令完了する場合と、同時に命令完了する命令群の中に分岐命令が含まれていない場合(上記ケース(1)の場合)には、プログラムカウンタPC及びネクストプログラムカウンタnPCの更新はPC=nPC+(同時に命令完了した数-1)*4、nPC=PC+4となる。DSS命令が無効にされた時、NOP命令に置き換えたDSS命令の命令完了時に割り込みを許すと、プロセッサ外にDSS命令終了時のプログラムカウンタPCの値が見えてしまう。このようなNOP命令に置き換えたDSS命令は、実際には実行されない命令であるため、PC=(NOP命令に置き換えたDSS命令の命令アドレス)となっていると、割り込みから復帰した場合に実行命令列を誤る。そこで、これを防ぐため、本実施例では、このような場合にプログラムカウンタPC及びネクストプログラムカウンタnPCの値をDSS命令分(4バイト)更に更新するようにする。
【0046】
分岐する分岐命令が、複数の命令と同時に命令完了する場合、分岐命令は、それ以前の命令と同時に命令完了することはできるが、後続の命令とは同時に命令完了することができない。即ち、分岐する分岐命令が命令完了する場合は、必ず同時に命令完了する命令群の最後の命令となるため、PC=(DSS命令の命令アドレス)、nPC=(分岐の分岐先アドレス)となる(上記ケース(2)の場合)。
【0047】
本実施例では、分岐する分岐命令の命令完了時に制約を設けることで、プログラムカウンタPC及びネクストプログラムカウンタnPCの更新回路11−2,11−3を簡素化しているが、プログラムカウンタPCの更新回路11−2に対して、分岐する分岐命令の後続命令が何命令同時に命令完了したかを通知することで、PC=TGT_PC+(同時に命令完了した分岐命令の後続命令数*4)、nPC=PC+4になり、命令完了時の制約は不要となる。
【0048】
分岐する分岐命令のTGT_PCは、分岐先アドレスレジスタ10からネクストプログラムカウンタnPCにサイクルWにおいてセットされる。分岐する分岐命令が命令完了すると、そのサイクルWにその命令の命令番号(Instruction ID:IID)が命令完了制御部9から供給され、分岐先アドレスレジスタ10にある同じIIDを持つエントリーから、ネクストプログラムカウンタnPCに対してTGT_PC[31:0,P3:P0]がセットされる。このようにネクストプログラムカウンタnPCにセットすると同時に、分岐先アドレスレジスタ10のエントリーは開放され、分岐先アドレスレジスタ10には新たなエントリーをセットすることが可能となる。
【0049】
分岐命令が命令完了し、その分岐命令が分岐し、分岐先のアドレスが4Gバイト境界を跨いでいる場合の動作は、次のようになる。プログラムカウンタPCはPC=nPC+(同時に命令完了した数-1)*4で求められるため、特別な制御は必要としない。ネクストプログラムカウンタnPCは、nPC=(分岐先アドレス)となるため、分岐先アドレスレジスタ10からセットされるが、分岐先アドレスレジスタ10は、下位32ビット(+4PARITY)しかアドレスを保持していない。このため、命令完了した分岐命令が、命令相対分岐である場合は、分岐先アドレスレジスタ10に保持してあるTGT_PC_CARRY、TGT_PC_BORROWに基づいて、上位32ビット(+4PARITY)が生成される。分岐先アドレスが4Gバイト境界を跨ぐか否かは、TGT_PC_CARRY、TGT_PC_BORROWのいずれかが「1」であるか否かで判断できる。尚、TGT_PC_CARRY、TGT_PC_BORROWが同時に「1」になることはない。
【0050】
レジスタ相対分岐の場合、分岐先アドレスは、演算ユニット23で生成される。下位32ビット(+4PARITY)については、分岐先アドレスレジスタ10より得られる。上位32ビット(+4PARITY)については、演算ユニット23での分岐先アドレス生成後、分岐命令制御部7に下位32ビット(+4PARITY)が供給されると同時に、プログラムカウンタ部11に上位32ビット(+4PARITY)が供給される。この際、演算ユニット23から分岐先アドレスを生成した分岐命令のIID[5:0]が、分岐先アドレスと同時に、分岐命令制御部7及びプログラムカウンタ部11に供給される。プログラムカウンタ部11では、分岐先アドレスの上位32ビット(+4PARITY)及びその時のIID[5:0]を保持する。本実施例では、プログラムカウンタ部11に、1命令分保持するためのADRS_HOLDラッチ回路11−1が設けられている。この時、供給されてくる分岐先アドレスの上位32ビットとプログラムカウンタPCの上位32ビットとが比較され、一致しない場合には4Gバイト境界を跨ぐと判断し、信号+JMPL_RETURN_TGT_EQ_PC_HIGH=0となる。
【0051】
レジスタ相対分岐が分岐して命令完了した場合、命令完了した命令のIIDがプログラムカウンタ部11で保持しているADRS_HOLDラッチ回路11−1のIIDと一致すると、上位32ビット(+4PARITY)は、このプログラムカウンタ部11にあるADRS_HOLDラッチ回路11−1よりセットされる。レジスタ相対分岐が分岐する場合は、分岐先アドレスが4Gバイト境界を跨ぐか否かに関わらず、上位32ビット(+4PARITY)はADRS_HOLDラッチ回路11−1から、下位32ビット(+4PARITY)は分岐先アドレスレジスタ10からネクストプログラムカウンタnPCにセットされることになる。ただし、分岐先アドレスが4Gバイト境界を跨ぐ場合は、信号+JMPL_RETURN_TGT_EQ_PC_HIGH=0となる。
【0052】
命令列が4Gバイト境界を跨いで実行される場合、命令フェッチ部2は、命令フェッチアドレスの上位32ビットについて、境界直前の値で命令フェッチを行っているため、境界直前の命令が完了した時点で命令フェッチをやり直す必要がある。これは、命令アドレスの上位32ビットの値が、境界直前の命令と境界直後の命令では異なるためである。従って、本実施例では、境界直前の命令が完了した後、プログラムカウンタ部11から命令再フェッチ要求REIFCHが命令フェッチ部2に供給される。この時、プログラムカウンタPCの値は、境界直後の命令アドレスに更新されているので、命令フェッチ部2は、プログラムカウンタPCの値から命令フェッチを再開する。
【0053】
命令完了時に割り込みが発生し、割り込み処理を終えた後、命令制御装置が再スタートした場合、nPC≠PC+4となっている状態が発生することがある。この場合、プログラムカウンタ部11から命令再フェッチ要求REIFCHが命令フェッチ部2に供給されるが、この時の要求アドレスは、プログラムカウンタPCが指すアドレスとなるものの、その次に実行しなければならない命令は、ネクストプログラムカウンタnPCが指すアドレスの命令である。従って、この場合、一度プログラムカウンタPが指すアドレスで命令フェッチが行われ、1命令(プログラムカウンタPCが指していたアドレスの命令)完了すると、プログラムカウンタPC及びネクストプログラムカウンタnPCを更新した後、再度、命令再フェッチ要求REIFCHが命令フェッチ部2に供給される。これは、命令フェッチ部2は、プログラムカウンタ部11から命令再フェッチ要求REIFCHがあると、プログラムカウンタPCが指すアドレスで命令フェッチを行い、その後続の命令を供給しようとするからである。
【0054】
分岐命令のディレイスロット命令が無効にされた場合、ディレイスロット命令は、NOP命令扱いにして命令制御を行うが、この無効にされたディレイスロット命令の直前の分岐命令完了時に割り込みが発生した場合には、PC=(無効にされたディレイスロット命令のアドレス)、nPC=(実際に分岐命令の次に実行されるべき命令のアドレス)となってしまう。この状態で、割り込み処理を行い再スタートさせると、実際には実行してはいけない無効にされたディレイスロット命令からスタートしてしまう。そこで、本実施例では、分岐命令完了時に割り込みが発生した場合、後続のディレイスロット命令を無効にする場合は信号+FORCE_NOP_TGR=1とし、この信号がONの場合に割り込みが発生した場合には一度プログラムカウンタPC及びネクストプログラムカウンタnPCを更新した後、割り込み処理中にPC=nPC、nPC=nPC+4と再度プログラムカウンタPC及びネクスト付グラムカウンタnPCを更新している。
【0055】
次に、分岐命令制御部7の構成について、図8〜図11と共に説明する。図8〜図11は、分岐命令制御部7内の要部の論理回路図である。
【0056】
図8において、アンド回路171〜172及びオア回路174は、分岐命令制御部7で分岐する分岐命令が少なくとも1つ制御完了した時に「1」になる信号+RSBR_COMPLETE_TAKEN_RELEASEを生成する。アンド回路171には、分岐命令制御部7の0番のエントリーにある分岐命令の制御完了時に「1」となる信号+RSBR0_COMPLETEと、分岐命令制御部7の0番のエントリーにある分岐命令の分岐確定時に「1」となる信号+RSBR0_TAKENとが入力される。同様にして、アンド回路172には、分岐命令制御部7の1番のエントリーにある分岐命令の制御完了時に「1」となる信号+RSBR1_COMPLETEと、分岐命令制御部7の1番のエントリーにある分岐命令の分岐確定時に「1」となる信号+RSBR1_TAKENとが入力され、アンド回路173には、分岐命令制御部7の2番のエントリーにある分岐命令の制御完了時に「1」となる信号+RSBR2_COMPLETEと、分岐命令制御部7の2番のエントリーにある分岐命令の分岐確定時に「1」となる信号+RSBR2_TAKENとが入力される。オア回路174には、アンド回路171〜173の出力が入力される。
【0057】
エクスクルシブノア(排他的否定論理和)回路271及びアンド回路272,273は、分岐命令制御部7内にある分岐先アドレスレジスタ10内のエントリAに保持されている分岐命令のIIDと分岐する分岐命令が命令完了した時のその分岐命令のIIDとを比較する。エクスクルシブノア回路271には、分岐命令制御部7(又はプログラムカウンタ部11)内で分岐する分岐命令が命令完了した時のその分岐命令のIIDを示す信号+COMIT_TAKEN_IID[5:0]と、分岐命令制御部7内にある分岐先アドレスレジスタ10のエントリーAに保持されている分岐命令のIIDを示す信号+RSBR_TGT_BUFF_A_IID[5:0]とが入力される。信号+RSBR_TGT_BUFF_A_IID[5:0]は、後述する信号+TARGET_ADRS_BUFFER_A_IID[5:0]と同等である。アンド回路272には、分岐先アドレスレジスタ10よりネクストプログラムカウンタに値をセットする必要がある時に「1」になる信号+LOAD_TGT_TO_NPCと、分岐先アドレスレジスタ10内のエントリーAが有効である時に「1」となる信号+RSBR_TGT_BUFF_A_VALIDとが入力される。アンド回路273は、エクスクルシブノア回路271及びアンド回路272の出力が入力される。
【0058】
エクスクルシブノア回路274及びアンド回路275,276は、分岐命令制御部7内にある分岐先アドレスレジスタ10内のエントリBに保持されている分岐命令のIIDと分岐する分岐命令が命令完了した時のその分岐命令のIIDとを比較する。エクスクルシブノア回路274には、分岐命令制御部7(又はプログラムカウンタ部11)内で分岐する分岐命令が命令完了した時のその分岐命令のIIDを示す信号+COMIT_TAKEN_IID[5:0]と、分岐命令制御部7内にある分岐先アドレスレジスタ10のエントリーBに保持されている分岐命令のIIDを示す信号+RSBR_TGT_BUFF_B_IID[5:0]とが入力される。信号+RSBR_TGT_BUFF_B_IID[5:0]は、後述する信号+TARGET_ADRS_BUFFER_B_IID[5:0]と同等である。アンド回路275には、分岐先アドレスレジスタ10よりネクストプログラムカウンタに値をセットする必要がある時に「1」になる信号+LOAD_TGT_TO_NPCと、分岐先アドレスレジスタ10内のエントリーBが有効である時に「1」となる信号+RSBR_TGT_BUFF_B_VALIDとが入力される。アンド回路276は、エクスクルシブノア回路274及びアンド回路275の出力が入力される。
【0059】
図9において、アンド回路277は、分岐先アドレスレジスタ10のエントリーAを開放する時に「1」となる信号-RSBR_TGT_BUFF_A_REL及び分岐先アドレスレジスタ10内のエントリーAが有効である時に「1」となる信号+RSBR_TGT_BUFF_A_VALIDに基づいて、分岐先アドレスレジスタ10のエントリーAに対するクロックイネーブル信号+HOLD_RSBR_TGT_BUFF_Aを生成する。アンド回路278は、分岐先アドレスレジスタ10のエントリーBを開放する時に「1」となる信号-RSBR_TGT_BUFF_B_REL及び分岐先アドレスレジスタ10内のエントリーBが有効である時に「1」となる信号+RSBR_TGT_BUFF_B_VALIDに基づいて、分岐先アドレスレジスタ10のエントリーBに対するクロックイネーブル信号+HOLD_RSBR_TGT_BUFF_Bを生成する。
【0060】
ナンド回路371は、分岐命令制御部7の0番のエントリーにある分岐命令の分岐確定時に「1」となる信号+RSBR0_TAKEN、分岐先アドレスレジスタ10内のエントリーAが有効である時に「1」となる信号+RSBR_TGT_BUFF_A_VALID、分岐先アドレスレジスタ10内のエントリーBが有効である時に「1」となる信号+RSBR_TGT_BUFF_B_VALID及び分岐する分岐命令が命令完了したことを示す信号+W_COMMIT_BR_TAKENに基づいて、分岐命令制御部7内の0番目のエントリーの分岐命令が分岐する分岐命令である時に分岐先アドレスレジスタ10にエントリーの空きがないことを示す信号-RSBR0_TGT_BUFF_BUSYを生成する。信号+W_COMMIT_BR_TAKENは、サイクルWにおける信号であり、分岐する分岐命令の命令完了+1τのサイクルで「1」となる。
【0061】
ナンド回路372は、分岐命令制御部7の1番のエントリーにある分岐命令の分岐確定時に「1」となる信号+RSBR1_TAKEN、分岐先アドレスレジスタ10内のエントリーAが有効である時に「1」となる信号+RSBR_TGT_BUFF_A_VALID、分岐先アドレスレジスタ10内のエントリーBが有効である時に「1」となる信号+RSBR_TGT_BUFF_B_VALID及び分岐する分岐命令が命令完了したことを示す信号+W_COMMIT_BR_TAKENに基づいて、分岐命令制御部7内の1番目のエントリーの分岐命令が分岐する分岐命令である時に分岐先アドレスレジスタ10にエントリーの空きがないことを示す信号-RSBR1_TGT_BUFF_BUSYを生成する。信号+W_COMMIT_BR_TAKENは、サイクルWにおける信号であり、分岐する分岐命令の命令完了+1τのサイクルで「1」となる。
【0062】
ナンド回路371は、分岐命令制御部7の2番のエントリーにある分岐命令の分岐確定時に「1」となる信号+RSBR2_TAKEN、分岐先アドレスレジスタ10内のエントリーAが有効である時に「1」となる信号+RSBR_TGT_BUFF_A_VALID、分岐先アドレスレジスタ10内のエントリーBが有効である時に「1」となる信号+RSBR_TGT_BUFF_B_VALID及び分岐する分岐命令が命令完了したことを示す信号+W_COMMIT_BR_TAKENに基づいて、分岐命令制御部7内の2番目のエントリーの分岐命令が分岐する分岐命令である時に分岐先アドレスレジスタ10にエントリーの空きがないことを示す信号-RSBR2_TGT_BUFF_BUSYを生成する。信号+W_COMMIT_BR_TAKENは、サイクルWにおける信号であり、分岐する分岐命令の命令完了+1τのサイクルで「1」となる。
【0063】
図10において、ラッチ回路374のセット端子SETには信号+RSBR_COMPLETE_TAKEN_RELEASEが入力され、入力端子INHSには実行パイプライン上にある全命令をクリアすることを示す信号-CLEAR_PIPELINEが入力される。ノア回路375には信号+RSBR_TGT_BUFF_A_REL及び信号+CLEAR_PIPELINEが入力され、ノア回路375の出力はラッチ回路374のリセット端子RSTに入力される。ラッチ回路374は、上記信号+RSBR_TGT_BUFF_A_VALIDを生成する。
【0064】
ラッチ回路376のセット端子SETには、信号+RSBR_COMPLETE_TAKEN_RELEASE及びクロックイネーブル信号+HOLD_RSBR_TGT_BUFF_Aが入力されるアンド回路377の出力が入力される。ラッチ回路376の入力端子INHSには、実行パイプライン上にある全命令をクリアすることを示す信号-CLEAR_PIPELINEが入力される。ノア回路378には信号+RSBR_TGT_BUFF_B_REL及び信号+CLEAR_PIPELINEが入力され、ノア回路378の出力はラッチ回路376のリセット端子RSTに入力される。ラッチ回路376は、上記信号+RSBR_TGT_BUFF_B_VALIDを生成する。
【0065】
図11において、ラッチ回路471には信号+HOLD_RSBR_TGT_BUFF_A、+COMPLETE_RSBR_IID[5:0]、+COMPLETE_RSBR_CARRY、+COMPLETE_RSBR_BORROW及び+COMPLETE_RSBR_TGT_PC[31:0,P3:P0]が入力され、信号+TARGET_ADRS_BUFFER_A_IID[5:0]、+TARGET_ADRS_BUFFER_A_OVF、+TARGET_ADRS_BUFFER_A_UDF及び+TARGET_ADRS_BUFFER_A[31:0,P3:P0]が出力される。+HOLD_RSBR_TGT_BUFF_Aは、分岐先アドレスレジスタ10のエントリーAのクロックイネーブル信号、+COMPLETE_RSBR_IID[5:0]は、分岐命令制御部7から開放した(分岐命令の制御完了時の)分岐命令のIID、+COMPLETE_RSBR_CARRYは、分岐命令制御部7から開放した分岐命令の分岐先アドレスでCARRYが発生した場合に「1」となる信号、+COMPLETE_RSBR_BORROWは、分岐命令制御部7から開放した分岐命令の分岐先アドレスでBORROWが発生した場合に「1」となる信号、+COMPLETE_RSBR_TGT_PC[31:0,P3:P0]は、分岐命令制御部7から開放した分岐命令の分岐先アドレスである。+TARGET_ADRS_BUFFER_A_IID[5:0]は、分岐先アドレスレジスタ10のエントリーAに保持されている分岐命令のIID、+TARGET_ADRS_BUFFER_A_OVFは、分岐先アドレスレジスタ10のエントリーAに保持されている分岐命令のCARRYビット、+TARGET_ADRS_BUFFER_A_UDFは、分岐先アドレスレジスタ10のエントリーAに保持されている分岐命令のBORROWビット、+TARGET_ADRS_BUFFER_A[31:0,P3:P0]は、分岐先アドレスレジスタ10のエントリーAに保持されている分岐命令の分岐先アドレスである。
【0066】
ラッチ回路472には信号+HOLD_RSBR_TGT_BUFF_B、+COMPLETE_RSBR_IID[5:0]、+COMPLETE_RSBR_CARRY、+COMPLETE_RSBR_BORROW及び+COMPLETE_RSBR_TGT_PC[31:0,P3:P0]が入力され、信号+TARGET_ADRS_BUFFER_B_IID[5:0]、+TARGET_ADRS_BUFFER_B_OVF、+TARGET_ADRS_BUFFER_B_UDF及び+TARGET_ADRS_BUFFER_B[31:0,P3:P0]が出力される。+HOLD_RSBR_TGT_BUFF_Bは、分岐先アドレスレジスタ10のエントリーBのクロックイネーブル信号、+COMPLETE_RSBR_IID[5:0]は、分岐命令制御部7から開放した(分岐命令の制御完了時の)分岐命令のIID、+COMPLETE_RSBR_CARRYは、分岐命令制御部7から開放した分岐命令の分岐先アドレスでCARRYが発生した場合に「1」となる信号、+COMPLETE_RSBR_BORROWは、分岐命令制御部7から開放した分岐命令の分岐先アドレスでBORROWが発生した場合に「1」となる信号、+COMPLETE_RSBR_TGT_PC[31:0,P3:P0]は、分岐命令制御部7から開放した分岐命令の分岐先アドレスである。+TARGET_ADRS_BUFFER_B_IID[5:0]は、分岐先アドレスレジスタ10のエントリーBに保持されている分岐命令のIID、+TARGET_ADRS_BUFFER_B_OVFは、分岐先アドレスレジスタ10のエントリーBに保持されている分岐命令のCARRYビット、+TARGET_ADRS_BUFFER_B_UDFは、分岐先アドレスレジスタ10のエントリーBに保持されている分岐命令のBORROWビット、+TARGET_ADRS_BUFFER_B[31:0,P3:P0]は、分岐先アドレスレジスタ10のエントリーBに保持されている分岐命令の分岐先アドレスである。
【0067】
次に、命令完了制御部9の構成について、図12及び図13と共に説明する。図12及び図13は、命令完了制御部9内の要部の論理回路図である。
【0068】
図12において、アンド回路91には、1番目に命令完了したのが分岐命令であり後続の遅延命令を無効にする場合に「1」となる信号+TOQ_CSE_BR_FORCE_NOP、少なくとも1つの命令が完了したことを示す信号+COMMIT_TOQ_CSE、少なくとも2つの命令が完了したことを示す信号-COMMIT_2ND_CSE、最初に命令完了する命令が命令の再実行(RERUN)を行う場合に「1」となる信号-TOQ_RERUN_REIFCH_OWN_ORが入力される。アンド回路92には、2番目に命令完了したのが分岐命令であり後続の遅延命令を無効にする場合に「1」となる信号+2ND_CSE_BR_FORCE_NOP、少なくとも2つの命令が完了したことを示す信号+COMMIT_2ND_CSE、少なくとも3つの命令が完了したことを示す信号-COMMIT_3RD_CSEが入力される。アンド回路93には、3番目に命令完了したのが分岐命令であり後続の遅延命令を無効にする場合に「1」となる信号+3RD_CSE_BR_FORCE_NOP、少なくとも3つの命令が完了したことを示す信号+COMMIT_3RD_CSE、少なくとも4つの命令が完了したことを示す信号-COMMIT_4TH_CSEが入力される。アンド回路94には、4番目に命令完了したのが分岐命令であり後続の遅延命令を無効にする場合に「1」となる信号+4TH_CSE_BR_FORCE_NOP、少なくとも4つの命令が完了したことを示す信号+COMMIT_4TH_CSEが入力される。ノア回路95は、アンド回路91〜94の出力を入力される。
【0069】
アンド回路96には、割り込み処理が発生した時に「1」となる信号-RS1、次に最初に完了する命令がNOP化された遅延命令であることを示す信号+BR_FORCE_NOP_TGRが入力され、ナンド回路97には、少なくとも1つの命令が完了したことを示す信号-COMMIT_TOQ_CSE及びアンド回路96の出力が入力される。アンド回路98には、ノア回路95の出力及びナンド回路97の出力が入力される。ラッチ回路99は、入力端子1Hに演算ユニット23等で例外が発生した時に「1」となる信号+EU_XCPTN_ORを入力され、セット端子SETにアンド回路98の出力を入力され、次に最初に完了する命令がNOP化された遅延命令であることを示す信号-BR_FORCE_NOP_TGRを出力する。
【0070】
図13において、ナンド回路191には、トラップ処理を行う命令が命令完了したことを示すサイクルWの信号+W_TRAP_VALID、命令が少なくとも1つ完了したことを示す信号+COMMIT_ENDOP_ORが入力される。アンド回路192には、ナンド回路191の出力及び信号+BR_FORCE_NOP_TGR=1の時に非同期の割り込み(外部割り込み)が発生すると「1」となる信号+FORCE_NOP_TGR、割り込み処理が発生した時に「1」となる信号-RS1が入力される。アンド回路192の出力は、ラッチ回路193のセット端子SETに入力される。ラッチ回路193は、信号+FORCE_PC_INCR_TGRを出力する。信号+FORCE_PC_INCR_TGRは、分岐命令が命令完了し、ディレイスロット命令が命令完了するまでの間が延びた時にディレイスロット命令が無効化(NOP化)されている場合において割り込み処理が発生した時にプログラムカウンタPC及びネクストプログラムカウンタnPCをディレイスロット命令分(4バイト)更新しなければならない時に「1」となる信号である。つまり、信号+FORCE_PC_INCR_TGRは、信号+FORCE_NOP_TGRの1τ後に立ち上がる、サイクルW+1より有効となる信号である。
【0071】
次に、プログラムカウンタ部11内のnPC用更新回路11−3について、図14〜図18と共に説明する。図14〜図18は、プログラムカウンタ部11内のnPC用更新回路11−3の論理回路図である。
【0072】
図14において、インクリメンタ111は、信号+PC[53:32,P7:P4]、+TARGET_ADRS_BUFFER_A_OVF、+TARGET_ADRS_BUFFER_A_UDFを入力され、信号+MOD_PC_FOR_TGT_ADRS_A[63:32,P7:P4]を出力する。信号+MOD_PC_FOR_TGT_ADRS_A[63:32,P7:P4]は、分岐先アドレスレジスタ10のエントリーAでCARRYビット又はBORROWビットが「1」の時のハイ側の分岐先アドレスを示す。インクリメンタ112は、信号+PC[53:32,P7:P4]、+TARGET_ADRS_BUFFER_B_OVF、+TARGET_ADRS_BUFFER_B_UDFを入力され、信号+MOD_PC_FOR_TGT_ADRS_B[63:32,P7:P4]を出力する。信号+MOD_PC_FOR_TGT_ADRS_B[63:32,P7:P4]は、分岐先アドレスレジスタ10のエントリーBでCARRYビット又はBORROWビットが「1」の時のハイ側の分岐先アドレスを示す。
【0073】
図15において、アンド回路113には信号+MOD_PC_FOR_TGT_ADRS_A[63:32, P7:P4]、+RSBR_TGT_BUFF_A_RELが入力され、アンド回路114には信号+MOD_PC_FOR_TGT_ADRS_B[63:32,P7:P4]、+RSBR_TGT_BUFF_B_RELが入力される。オア回路115は、アンド回路113,114の出力に基づいて信号+MOD_PC_FOR_TGT_ADRS[63:32,P7:P4]を出力する。信号+MOD_PC_FOR_TGT_ADRS[63:32,P7:P4]は、分岐先アドレスレジスタ10からネクストプログラムカウンタnPCにセットするハイ側の分岐先アドレスを示す。
【0074】
アンド回路116には信号+TARGET_ADRS_BUFFER_A[31:0,P3:P0]、+RSBR_TGT_BUFF_A_RELが入力され、アンド回路117には信号+TARGET_ADRS_BUFFER_B[31:0,P3:P0]、+RSBR_TGT_BUFF_B_RELが入力される。オア回路118は、アンド回路116,117の出力に基づいて信号+SELECTED_TGT_ADRS_BUFF[31:0,P3:P0]を出力する。信号+SELECTED_TGT_ADRS_BUFF[31:0,P3:P0]は、分岐先アドレスレジスタ10からネクストプログラムカウンタnPCにセットするロー側の分岐先アドレスを示す。
【0075】
図16において、インクリメンタ211は、信号+NPC[63:0,P7:P0]、+NPC_INCREMENT[3:0]、+FORCE_PC_INCR_TGRを入力され、信号+INCR_NPC[63:0,P7:P0]を出力する。信号+NPC_INCREMENT[3:0]は、いくつの命令が同時に命令完了したかを示す。例えば、ビット3が「1」であると4命令が同時に命令完了したことを示し、ビット2が「1」であると3命令が同時に命令完了したことを示す。信号+INCR_NPC[63:0,P7:P0]は、+FORCE_NOP_TGR=1の時はnPC+4なる演算を行うことを示す。又、アンド回路212には信号+COMMIT_UPDATE_PC、-RS1が入力される。信号+COMMIT_UPDATE_PCは、プログラムカウンタPC又はネクストプログラムカウンタnPCの更新が必要であることを示す。ノア回路213には、アンド回路212の出力及び信号+TRAP_SW1、+FORCE_PC_INCR_TGRが入力される。ノア回路213の出力は、ネクストプログラムカウンタnPCのクロックイネーブル信号-CE_NPC及びプログラムカウンタPCのクロックイネーブル信号-CE_PCとして使用される。
【0076】
図17において、アンド回路214には信号+COMMIT_UPDATE_PC、-BRTKN_EQ_JUMPL_HOLD_VALID、-LOAD_TARGET_ADRS_TO_NPCが入力される。信号-BRTKN_EQ_JUMPL_HOLD_VALIDは、命令完了したレジスタ相対の分岐命令の分岐アドレスのハイ側がオール0(All0)でなくラッチ回路11−1に保持されている時に「1」となる信号である。オア回路215には、アンド回路214の出力及び信号+FORCE_PC_INCR_TGRが入力される。アンド回路216には、オア回路215の出力信号+SEL_INCR_TO_NPC_LOW及び信号-PSTATE_AMが入力される。信号+SEL_INCR_TO_NPC_LOWは、ネクストプログラムカウンタnPCのロー側へセットする際に信号+INCR_NPCを選択する時に「1」となる信号である。信号-PSTATE_AMは、「1」の時に32ビットアドレスモードを示す信号である。アンド回路216は、信号+SEL_INCR_TO_NPC_HIGHを出力する。信号+SEL_INCR_TO_NPC_HIGHは、ネクストプログラムカウンタnPCのハイ側へセットする際に信号+INCR_NPCを選択する時に「1」となる信号である。
【0077】
アンド回路217には信号-BRTKN_EQ_JUMPL_HOLD_VALID、+LOAD_TARGET_ADRS_TO_NPCが入力される。オア回路218には、アンド回路217の出力及び信号+FORCE_PC_INCR_TGRが入力される。アンド回路219には、オア回路218の出力及び信号-PSTATE_AMが入力される。アンド回路219は、信号+SEL_TARGET_TO_NPC_HIGHを出力する。信号+SEL_TARGET_TO_NPC_HIGHは、ネクストプログラムカウンタnPCのハイ側へセットする際に信号+MOD_PC_FOR_TGT_ADRSを選択する時に「1」となる信号である。又、バッファ311は、信号+LOAD_TARGET_ADRS_TO_NPCに基づいて信号+SEL_TARGET_TO_NPC_LOWを出力する。信号+LOAD_TARGET_ADRS_TO_NPCは、ネクストプログラムカウンタnPCに分岐先アドレスレジスタ10から値をセットしなければならない時に「1」となる信号である。信号+SEL_TARGET_TO_NPC_LOWは、ネクストプログラムカウンタnPCのハイ側へセットする際に信号+SELECTED_TGT_ADRS_BUFFを選択する時に「1」となる信号である。アンド回路312は、信号+BRTKN_EQ_JUMPL_HOLD_TGR、-PSTATE_AMに基づいて信号+SEL_JUMPL_AH_TO_NPCを出力する。信号+SEL_JUMPL_AH_TO_NPCは、ネクストプログラムカウンタnPCのハイ側へセットする際にラッチ回路11−1からの値(+JMPL_ADRS_HOLD)を選択する時に「1」となる信号である。
【0078】
図18において、アンド回路411は信号+INCR_NPC[63:32,P7:P4]、+SEL_INCR_TO_NPC_HIGHを入力され、アンド回路412は信号+MOD_PC_FOR_TGT_ADRS[63:32,P7:P4]、+SEL_TARGET_TO_NPC_HIGHを入力される。アンド回路413は信号+JUMPL_ADRD_HOLD[63:32,P7:P4]、+SEL_JUMPL_AH_TO_NPCを入力され、アンド回路414は信号+TRAP_ADRS[63:32,P7:P4]、+SEL_TRAP_ADRS_TO_NPCを入力される。信号+TRAP_ADRS[63:32,P7:P4]は、SPARCアーキテクチャで定義されており、トラップが発生した場合(+W_TRAP_VALID=1)に専用のトラップ(TRAP)アドレスを選択する信号である。信号+SEL_TRAP_ADRS_TO_NPCは、トラップが発生した場合に信号+TRAP_ADRSを選択する時に「1」となる信号である。オア回路415は、アンド回路411〜414の出力に基づいて、ネクストプログラムカウンタnPCのセット信号+SET_NPC[63:32,P7:P4]を出力する。アンド回路416は信号+INCR_NPC[31:0,P3:P0]、+SEL_INCR_TO_NPC_LOWを入力され、アンド回路417は信号+SELECTED_TGT_ADRS_BUFF[31:0,P3:P0]、+SEL_TARGET_TO_NPC_LOWを入力され、アンド回路418は信号+TRAP_ADRS[31:0,P3:P0]、+SEL_TRAP_ADRS_TO_NPCを入力される。オア回路419は、アンド回路416〜418の出力に基づいて信号+SET_NPC[31:0,P3:P0]を出力する。
【0079】
次に、プログラムカウンタ部11内のPC用更新回路11−2について、図19及び図20と共に説明する。図19及び図20は、プログラムカウンタ部11内のPC用更新回路11−2の論理回路図である。
【0080】
図19において、オア回路511には信号+COMMIT_UPDATE_PC、+FORCE_PC_INCR_TGRが入力される。アンド回路512には、オア回路511の出力信号+SEL_INCR_TO_PC_LOW及び信号-PSTATE_AMが入力される。信号+SEL_INCR_TO_PC_LOWは、プログラムカウンタPCのロー側へセットする際に信号+INCR_PCを選択する時に「1」となる信号である。信号+INCR_PCは、図16に示す信号+INCRR_NPCと同様に、+NPC_INCREMENT≠0の場合は(INCR_PC=)PC=nPC+(同時に命令完了した数−1)*4が計算されることを示し、+FORCE_PC_INCR_TRG=1の場合は(INCR_PC=)PC=nPCとなる。信号+NPC_INCREMENTと信号+FORCE_PC_INCR_TGRは、同時に有効にはならない。アンド回路512は、信号+SEL_INCR_TO_PC_HIGHを出力する。信号+SEL_INCR_TO_PC_HIGHは、プログラムカウンタPCのハイ側へセットする際に信号+INCR_PCを選択する時に「1」となる信号である。又、インクリメンタ513は、上記信号+PC[63:0,P7:P0]、+NPC_INCREMENT[3:0]、+FORCE_PC_INCR_TGRを入力され、信号+INCR_PC[63:0,P7:P0]を出力する。
【0081】
図20において、アンド回路611には信号+INCR_PC[63:32,P7:P4]、+SEL_INCR_TO_PC_HIGHが入力され、アンド回路612には信号+TRAP_ADRS[63:32,P7:P4]、+SEL_TRAP_ADRS_TO_PCが入力される。信号+SEL_TRAP_ADRS_TO_PCは、トラップが発生した場合に信号+TRAP_ADRSを選択する時に「1」となる信号である。オア回路613は、アンド回路611,612の出力に基づいて、プログラムカウンタPCのセット信号+SET_PC[63:32,P7:P4]を出力する。アンド回路614には信号+INCR_PC[31:0,P3:P0]、+SEL_INCR_TO_PC_LOWが入力され、アンド回路615には信号+TRAP_ADRS[31:0,P3:P0]、+SEL_TRAP_ADRS_TO_PCが入力される。オア回路616は、アンド回路614,615の出力に基づいて、プログラムカウンタPCのセット信号+SET_PC[31:0,P3:P0]を出力する。
【0082】
以上のように、本実施例では、分岐先アドレスレジスタを設け、命令アドレスレジスタを同時に完了した命令数に合わせて高速に更新す。又、分岐命令の制御が、分岐命令制御部、分岐予測部、分岐先アドレスレジスタ及び命令完了制御部で夫々独立して制御できるので、分岐のスループットを向上させてできるだけ少ない実装面積で回路を実現可能とする。
【0083】
又、64ビット長の命令アドレス空間を使用するアーキテクチャにおいて、分岐命令制御部及び分岐先アドレスを生成する部分において、下位32ビットとCARRYビット及びBORROWビットのみを使用して分岐命令の制御が行える。
【0084】
尚、本発明は、以下に付記する発明をも包含するものである。
【0085】
(付記1) 分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、
分岐予測が成功して分岐命令が分岐した時に、分岐命令を含めた複数の命令を同時に命令完了させるステップと、
プログラムカウンタ及びネクストプログラムカウンタを、完了した命令数に合わせて同時に更新するステップとを含むことを特徴とする、プログラムカウンタ制御方法。
【0086】
(付記2) 分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、
分岐予測が成功して分岐命令が分岐しない時に、分岐命令を含めた複数の命令を同時に命令完了させるステップと、
プログラムカウンタ及びネクストプログラムカウンタを、完了した命令数に合わせて同時に更新するステップとを含むことを特徴とする、プログラムカウンタ制御方法。
【0087】
(付記3) 分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、
分岐予測が失敗して分岐命令が分岐する時に、分岐命令を含めた複数の命令を同時に命令完了させるステップと、
プログラムカウンタ及びネクストプログラムカウンタを、完了した命令数に合わせて同時に更新するステップとを含むことを特徴とする、プログラムカウンタ制御方法。
【0088】
(付記4) 分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、
分岐予測が失敗して分岐命令が分岐しない時に、分岐命令を含めた複数の命令を同時に命令完了させるステップと、
プログラムカウンタ及びネクストプログラムカウンタを、完了した命令数に合わせて同時に更新するステップとを含むことを特徴とする、プログラムカウンタ制御方法。
【0089】
(付記5) 前記アーキテクチャは、64ビット長の命令アドレス空間を使用し、
命令の下位32ビットとキャリービット及びボロウビットのみを使用して、分岐命令制御及び分岐先アドレスの生成を行うステップを更に含むことを特徴とする、付記1〜4のいずれか1項記載のプログラムカウンタ制御方法。
【0090】
(付記6) 分岐予測部を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、
分岐命令の分岐条件判定、分岐予測の成否及び命令再フェッチの制御を行い、複数の分岐命令を同時に制御可能な分岐命令制御部と、
分岐することが確定した分岐命令の分岐先アドレスを複数格納する分岐先アドレスレジスタとを備え、
該分岐先アドレスレジスタは、該分岐命令制御部及び該分岐予測部とは独立して制御可能であることを特徴とする、プロセッサ。
【0091】
(付記7) 分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、
プログラムカウンタ及びネクストプログラムカウンタからなるプログラムカウンタ手段と、
分岐予測が成功して分岐命令が分岐した時に、分岐命令を含めた複数の命令を同時に命令完了させる手段と、
該プログラムカウンタ及び該ネクストプログラムカウンタを、完了した命令数に合わせて同時に更新する手段とを備えたことを特徴とする、プロセッサ。
【0092】
(付記8) 分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、
プログラムカウンタ及びネクストプログラムカウンタからなるプログラムカウンタ手段と、
分岐予測が成功して分岐命令が分岐しない時に、分岐命令を含めた複数の命令を同時に命令完了させる手段と、
該プログラムカウンタ及び該ネクストプログラムカウンタを、完了した命令数に合わせて同時に更新する手段とを備えたことを特徴とする、プロセッサ。
【0093】
(付記9) 分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、
プログラムカウンタ及びネクストプログラムカウンタからなるプログラムカウンタ手段と、
分岐予測が失敗して分岐命令が分岐する時に、分岐命令を含めた複数の命令を同時に命令完了させる手段と、
該プログラムカウンタ及び該ネクストプログラムカウンタを、完了した命令数に合わせて同時に更新する手段とを備えたことを特徴とする、プロセッサ。
【0094】
(付記10) 分岐予測機構を用いてアウトオブオーダ方式による命令制御を行うと共に、分岐の遅延命令を有するアーキテクチャを制御するプロセッサにおいて、
プログラムカウンタ及びネクストプログラムカウンタからなるプログラムカウンタ手段と、
分岐予測が失敗して分岐命令が分岐しない時に、分岐命令を含めた複数の命令を同時に命令完了させる手段と、
該プログラムカウンタ及び該ネクストプログラムカウンタを、完了した命令数に合わせて同時に更新する手段とを備えたことを特徴とする、プロセッサ。
【0095】
(付記11) 前記アーキテクチャは、64ビット長の命令アドレス空間を使用し、
命令の下位32ビットとキャリービット及びボロウビットのみを使用して、分岐命令制御及び分岐先アドレスの生成を行う手段を更に備えたことを特徴とする、付記6〜10のいずれか1項記載のプロセッサ。
【0096】
以上、本発明を実施例により説明したが、本発明は上記実施例に限定されるものではなく、種々の変形及び改良が可能であることは、言うまでもない。
【0097】
【発明の効果】
本発明によれば、分岐のスループットの向上を、できるだけ小さい回路規模(実装面積)で図れるプログラムカウンタ制御方法及びプロセッサを実現することができる。
【図面の簡単な説明】
【図1】本発明になるプロセッサの一実施例を示すブロック図である。
【図2】命令ユニットの要部を示すブロック図である。
【図3】分岐命令制御時の動作を説明するフローチャートである。
【図4】プログラムカウンタ部の更新時の動作を説明するフローチャートである。
【図5】分岐命令制御部内のエントリーを示す概要図である。
【図6】分岐先アドレスレジスタ内のエントリーを示すの概要図である。
【図7】プログラムカウンタ部の構成を示すブロック図である。
【図8】分岐命令制御部内の要部の論理回路図である。
【図9】分岐命令制御部内の要部の論理回路図である。
【図10】分岐命令制御部内の要部の論理回路図である。
【図11】分岐命令制御部内の要部の論理回路図である。
【図12】命令完了制御部内の要部の論理回路図である。
【図13】命令完了制御部内の要部の論理回路図である。
【図14】プログラムカウンタ部内のnPC用更新回路の論理回路図である。
【図15】プログラムカウンタ部内のnPC用更新回路の論理回路図である。
【図16】プログラムカウンタ部内のnPC用更新回路の論理回路図である。
【図17】プログラムカウンタ部内のnPC用更新回路の論理回路図である。
【図18】プログラムカウンタ部内のnPC用更新回路の論理回路図である。
【図19】プログラムカウンタ部内のPC用更新回路の論理回路図である。
【図20】プログラムカウンタ部内のPC用更新回路の論理回路図である。
【符号の説明】
1 分岐予測部
2 命令フェッチ部
3 命令バッファ部
4 相対分岐アドレス生成部
5 命令デコーダ部
6 分岐命令実行部
7 分岐命令制御部
8 ディレイスロットスタック部
9 命令完了制御部
10 分岐先アドレスレジスタ
11 プログラムカウンタ部
11−1 ラッチ回路
11−2,11−3 更新回路
21 命令ユニット
22 メモリユニット
23 演算ユニット
PC プログラムカウンタ
nPC ネクストプログラムカウンタ[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a program counter control method and a processor, and more particularly to a program counter and next program counter configured to complete a plurality of instructions including a branch instruction at the same time in an instruction control that performs branch prediction and has a delay instruction for branching. The present invention relates to a program counter control method for simultaneously updating and controlling the program, and a processor using such a program counter control method.
[0002]
[Prior art]
In recent years, various instruction processing methods have been used to improve processor performance. One of them is an out-of-order processing method. In a processor adopting the out-of-order processing method, the performance is improved by sequentially executing subsequent instructions in a plurality of pipelines without waiting for the completion of execution of one instruction. Yes.
[0003]
However, when the execution result of the preceding instruction affects the execution of the subsequent instruction, the subsequent instruction cannot be executed unless the preceding instruction execution is completed. If the processing of the instruction that affects the execution of the subsequent instruction is delayed, the subsequent instruction cannot be executed during that time, and the process waits for completion of the preceding instruction. For this reason, the pipeline is disturbed, resulting in performance degradation. Such pipeline disturbance is particularly noticeable in the case of branch instructions.
[0004]
Among the branch instructions, in the case of an instruction called a conditional branch, if there is an instruction that changes the branch condition (usually the condition code) immediately before the conditional branch instruction, the instruction that changes the branch condition is completed and the branch condition is finalized. The branch is not fixed until. Therefore, since the subsequent sequence of the branch instruction is not known, the subsequent instruction cannot be input, the processing is stopped, and the processing capability is reduced. This is not limited to processors that use the out-of-order processing method, but the same problem occurs in processors that use processing methods such as lock, step, and pipeline, but the out-of-order processing method is adopted. In some processors, the performance is more significantly degraded. Therefore, in order to suppress the performance degradation due to the branch instruction, a branch prediction mechanism for performing branch prediction is usually provided in the instruction control device in the processor to speed up the branch instruction.
[0005]
In the case of a processor that employs an out-of-order processing method including a branch prediction mechanism, a plurality of branch instructions are input to the execution pipeline based on the branch prediction result. When a branch instruction branches, it is necessary to set the branch destination address in the instruction address register. In a processor employing the SPARC (trademark) architecture, this instruction address register is called a program counter / next program counter. When there are a plurality of branch instructions on the execution pipeline, the instruction address register needs to hold the branch destination address of each branch instruction until the instruction is completed. However, since the branch decision timing of each branch instruction is different, conventionally, it has been necessary to hold the branch destination address of a branch instruction that does not actually branch.
[0006]
The throughput of the branch instruction in the execution pipeline is determined by the throughput of the branch instruction control unit and the number of branch destination address registers for holding the branch destination address. However, if the branch destination address register is used at the branch destination address of a branch instruction that does not actually branch, the throughput of the branch instruction is consequently suppressed. For this reason, it has fallen into a vicious circle in which it is necessary to further increase the branch destination address register in order to improve the throughput.
[0007]
In the instruction control device, one of the factors that determine the execution speed is the number of instructions that can be processed in one cycle. In the instruction control apparatus using the out-of-order method, a plurality of instructions can be completed simultaneously. Normally, instruction completion refers to the time when updating of resources such as registers to be used is completed. However, when completing a plurality of instructions at the same time, it is necessary to complete the updating of the resources to be used at the same time. Of course, the instruction address register also needs to be updated for a plurality of instructions. When controlling an architecture having a branch delay instruction typified by the SPARC architecture, it is necessary to update the two registers of the program counter and the next program counter depending on whether the branch instruction is branched or not. is there. For this reason, conventionally, a branch instruction can be completed (committed) only from a single position or a fixed position (a position relative to another instruction when the instruction is completed simultaneously). Usually, in the decoding cycle, when the branch instruction is placed at the last position of the packet and the instruction is completed by the packet method, the position is determined. In this case, the decode cycle and the instruction completion cycle are restricted by the branch instruction.
[0008]
[Problems to be solved by the invention]
In recent years, due to improvements in LSI manufacturing technology, it has become possible to use large-capacity memories, and 64-bit operation has been promoted in operating systems (OS) and applications. Along with this, 64-bit conversion is also required in instruction control devices. However, as the number of bits increases, the number of circuits such as registers to be used increases. Registers related to the control of branch instructions also need to be 64 bits, which increases the branch destination address register and the like.
[0009]
Thus, when the 32-bit configuration is simply changed to the 64-bit configuration, the number of entries is not changed, and the circuit is required twice, which increases the circuit scale (mounting area). .
[0010]
However, at present, there are few cases where the instruction area of the actual program uses 4 Gbytes or more, and the case of exceeding the 4 Gbyte boundary in the program hardly affects the performance of the instruction processing. SUMMARY OF THE INVENTION An object of the present invention is to realize a program counter control method and a processor capable of improving the branch throughput with the smallest possible circuit scale (mounting area).
[0011]
[Means for Solving the Problems]
The above problem is that the branch instruction is executed when the branch instruction is branched because the branch prediction succeeds in the processor that controls the architecture having the branch delay instruction while performing the instruction control by the out-of-order method using the branch prediction mechanism. Can be achieved by a program counter control method comprising the steps of simultaneously completing a plurality of instructions including, and simultaneously updating the program counter and the next program counter in accordance with the number of completed instructions.
[0012]
The above problem is that a branch instruction is executed when branch prediction is successful and the branch instruction does not branch in a processor that controls an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism. Can be achieved by a program counter control method characterized in that it includes a step of simultaneously completing a plurality of instructions including, and a step of simultaneously updating the program counter and the next program counter in accordance with the number of completed instructions.
[0013]
The above-mentioned problem is that when a branch instruction is branched due to branch prediction failure in a processor that controls an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism, the branch instruction Can be achieved by a program counter control method characterized in that it includes a step of simultaneously completing a plurality of instructions including, and a step of simultaneously updating the program counter and the next program counter in accordance with the number of completed instructions.
[0014]
The above problem is that a branch instruction is executed when branch prediction fails and the branch instruction does not branch in a processor that controls an architecture having an out-of-order method using a branch prediction mechanism and has an instruction having a delayed branch instruction. Can be achieved by a program counter control method characterized in that it includes a step of simultaneously completing a plurality of instructions including, and a step of simultaneously updating the program counter and the next program counter in accordance with the number of completed instructions.
[0015]
The architecture uses a 64-bit instruction address space, and the program counter control method uses only the lower 32 bits of the instruction, the carry bit, and the borrow bit to perform branch instruction control and branch destination address generation. Further, it may be included.
[0016]
The above-described problems include an instruction control by an out-of-order method using a branch prediction unit, and a processor for controlling an architecture having a branch delay instruction, branch condition determination of branch instruction, success / failure of branch prediction, and instruction refetch. A branch instruction control unit that can simultaneously control a plurality of branch instructions, and a branch destination address register that stores a plurality of branch destination addresses of branch instructions determined to branch. This can also be achieved by a processor that can be controlled independently of the branch instruction control unit and the branch prediction unit.
[0017]
In the processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism, a program counter means including a program counter and a next program counter, and branch prediction Means for simultaneously completing a plurality of instructions including a branch instruction when the branch instruction branches, and means for simultaneously updating the program counter and the next program counter in accordance with the number of completed instructions. This can also be achieved by a processor characterized by the provision.
[0018]
In the processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism, a program counter means including a program counter and a next program counter, and branch prediction Means for simultaneously completing a plurality of instructions including a branch instruction when the branch instruction does not branch, and means for simultaneously updating the program counter and the next program counter in accordance with the number of completed instructions. This can also be achieved by a processor characterized by the provision.
[0019]
In the processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism, a program counter means including a program counter and a next program counter, and branch prediction Means for simultaneously completing a plurality of instructions including a branch instruction when the branch instruction branches due to failure, and means for simultaneously updating the program counter and the next program counter in accordance with the number of completed instructions. This can also be achieved by a processor characterized by the provision.
[0020]
In the processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism, a program counter means including a program counter and a next program counter, and branch prediction Means for simultaneously completing a plurality of instructions including a branch instruction when the branch instruction does not branch, and means for simultaneously updating the program counter and the next program counter in accordance with the number of completed instructions. This can also be achieved by a processor characterized by the provision.
[0021]
Therefore, according to the present invention, it is possible to realize a program counter control method and a processor capable of improving the branch throughput with the smallest possible circuit scale (mounting area).
[0022]
DETAILED DESCRIPTION OF THE INVENTION
Embodiments of the program counter control method and the processor according to the present invention will be described below with reference to the drawings.
[0023]
【Example】
FIG. 1 is a block diagram showing an embodiment of a processor according to the present invention. In the figure, a processor 100 includes an
[0024]
The
[0025]
The branch instruction can be controlled independently in the
[0026]
Branch destination address generation is divided into two types: instruction relative branch and register relative branch. The branch destination address generation of the instruction relative branch is calculated by the relative branch address generation unit 4 and supplied to the branch
[0027]
Control for updating resources to be used is performed by the instruction
[0028]
FIG. 2 is a block diagram showing the main part of the
[0029]
In this embodiment, for the sake of convenience of explanation, it is assumed that the SPARC architecture is adopted. The instructions are processed out-of-order. In the branch instruction execution unit 6, a plurality of RSBR0 to RSBRm (Reservation Station for Branch) are provided in the branch
[0030]
FIG. 3 is a flowchart for explaining the operation at the time of branch instruction control as described above. In the figure, step S1 determines whether or not the branch instruction is completed, and if the determination result is YES, step S2 determines whether or not the branch instruction branches. If the decision result in the step S2 is NO, the process advances to a step S4 described later. On the other hand, if the decision result in the step S2 is YES, a step S3 decides whether or not there is an empty entry in the branch
[0031]
In step S4, the branch
[0032]
FIG. 4 is a flowchart for explaining the operation of the
[0033]
In step S13, when the instruction to branch is completed, the information is notified to the branch
[0034]
Returning to the description of FIG. 2, when an instruction fetch request is issued from the instruction fetch
[0035]
When the flag BRHIS_HIT = 1, the
[0036]
When branch prediction is performed, there is no need to perform re-instruction fetch when the prediction is successful, and the predicted branch destination instruction sequence is the same as the actual instruction sequence. In addition, when the branch prediction is successful, the delay slot instruction is correctly executed. In this case, the instruction continues to be executed as it is.
[0037]
When branch prediction is performed and the prediction is lost, re-instruction fetch is necessary. The branch destination instruction sequence is executed incorrectly, and the actual instruction sequence must be re-executed. In this case, since the execution of the delay slot instruction is also incorrect, it is necessary to start over from the delay slot instruction. In this embodiment, after a branch instruction re-instruction fetch request is output from the branch instruction control unit 8 to the instruction fetch
[0038]
When all branch instructions are decoded by the
[0039]
In SPARC, two types of instruction relative branch and register relative branch are defined as described above. The branch destination address of the instruction relative branch is generated by the relative branch address generation unit 4, and the branch destination address of the register relative branch is generated by the
[0040]
When the branch instruction control by the branch
[0041]
In this embodiment, the branch
[0042]
FIG. 5 is a conceptual diagram showing entries in the branch
FIG. 6 is a schematic diagram of the branch
[0043]
FIG. 7 is a block diagram showing a configuration of the
(1) When multiple instructions complete at the same time and there is no branch instruction that branches.
(2) When multiple instructions complete at the same time and there is a branch instruction that branches.
(3) When an instruction is executed across a 4-Gbyte boundary.
(4) When an instruction generates an interrupt when the instruction completes.
[0044]
Updating of the program counter PC and the next program counter nPC of the
[0045]
In this embodiment, the event that the branch instruction delay instruction (delay slot (DSS) instruction) is disabled (ANNUL) can be replaced by replacing the disabled DSS instruction with a Non-Operation instruction (NOP instruction). Realized. The program counter PC and the next program counter nPC of the
[0046]
When a branch instruction that branches branches simultaneously with a plurality of instructions, the branch instruction can complete instructions simultaneously with the previous instruction, but cannot complete instructions simultaneously with subsequent instructions. That is, when a branching instruction that completes branching is always the last instruction in the instruction group that completes the instruction at the same time, PC = (instruction address of DSS instruction) and nPC = (branch destination address of branch) ( Case (2) above).
[0047]
In this embodiment, the update circuit 11-2 and 11-3 for the program counter PC and the next program counter nPC are simplified by providing a restriction when the instruction of the branch instruction to be branched is completed. 11-2 is notified of how many subsequent instructions of the branch instruction to be branched, and PC = TGT_PC + (the number of subsequent instructions of the branch instruction completed simultaneously * 4), nPC = PC + 4 and no restrictions on instruction completion are required.
[0048]
The branch instruction TGT_PC to be branched is set in the cycle W from the branch
[0049]
The operation when the branch instruction is completed, the branch instruction branches, and the branch destination address crosses the 4 Gbyte boundary is as follows. Since the program counter PC is obtained by PC = nPC + (number of instructions completed simultaneously-1) * 4, no special control is required. The next program counter nPC is set from the branch
[0050]
In the case of a register relative branch, the branch destination address is generated by the
[0051]
When the register relative branch branches and the instruction is completed, when the IID of the instruction that has been completed matches the IID of the ADRS_HOLD latch circuit 11-1 held in the
[0052]
When the instruction sequence is executed across a 4 Gbyte boundary, the instruction fetch
[0053]
When an instruction is completed and an interrupt is generated, and the instruction control device restarts after completing the interrupt processing, a state where nPC ≠ PC + 4 may occur. In this case, an instruction refetch request REIFCH is supplied from the
[0054]
When the delay slot instruction of the branch instruction is invalidated, the delay slot instruction is handled as a NOP instruction and the instruction is controlled. However, when an interrupt occurs when the branch instruction immediately before the invalidated delay slot instruction is completed. Will be PC = (address of the disabled delay slot instruction) and nPC = (address of the instruction that should actually be executed next to the branch instruction). If interrupt processing is performed and restarted in this state, it will start from an invalid delay slot instruction that should not be executed. Therefore, in this embodiment, when an interrupt occurs when the branch instruction is completed, the signal + FORCE_NOP_TGR = 1 is set to invalidate the subsequent delay slot instruction, and once an interrupt occurs when this signal is ON. After updating the program counter PC and the next program counter nPC, the program counter PC and the next gram counter nPC are updated again with PC = nPC and nPC = nPC + 4 during the interrupt processing.
[0055]
Next, the configuration of the branch
[0056]
In FIG. 8, AND
[0057]
The exclusive NOR (exclusive negative OR)
[0058]
The exclusive NOR
[0059]
In FIG. 9, the AND
[0060]
The
[0061]
The
[0062]
The
[0063]
In FIG. 10, a signal + RSBR_COMPLETE_TAKEN_RELEASE is input to the set terminal SET of the
[0064]
An output of the AND
[0065]
In FIG. 11, the signals + HOLD_RSBR_TGT_BUFF_A, + COMPLETE_RSBR_IID [5: 0], + COMPLETE_RSBR_CARRY, + COMPLETE_RSBR_BORROW, and + COMPLETE_RSBR_TGT_PC [31: 0, P3: P0] are input to the
[0066]
The
[0067]
Next, the configuration of the instruction
[0068]
In FIG. 12, the AND
[0069]
The AND
[0070]
In FIG. 13, a
[0071]
Next, the nPC update circuit 11-3 in the
[0072]
In FIG. 14, the
[0073]
In FIG. 15, signals + MOD_PC_FOR_TGT_ADRS_A [63:32, P7: P4] and + RSBR_TGT_BUFF_A_REL are input to the AND
[0074]
The AND
[0075]
In FIG. 16, an
[0076]
In FIG. 17, signals + COMMIT_UPDATE_PC, −BRTKN_EQ_JUMPL_HOLD_VALID, and −LOAD_TARGET_ADRS_TO_NPC are input to the AND
[0077]
The AND
[0078]
In FIG. 18, the AND
[0079]
Next, the PC update circuit 11-2 in the
[0080]
In FIG. 19, signals + COMMIT_UPDATE_PC and + FORCE_PC_INCR_TGR are input to the
[0081]
In FIG. 20, the signals + INCR_PC [63:32, P7: P4] and + SEL_INCR_TO_PC_HIGH are input to the AND
[0082]
As described above, in this embodiment, a branch destination address register is provided, and the instruction address register is updated at a high speed according to the number of instructions completed simultaneously. In addition, branch instruction control can be controlled independently by the branch instruction control unit, branch prediction unit, branch destination address register, and instruction completion control unit, thereby improving the branch throughput and realizing a circuit with as little mounting area as possible. Make it possible.
[0083]
In an architecture using a 64-bit instruction address space, branch instructions can be controlled using only the lower 32 bits, the CARRY bit, and the BORROW bit in the branch instruction control unit and the branch destination address generation part.
[0084]
In addition, this invention also includes the invention attached to the following.
[0085]
(Supplementary note 1) In a processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism,
A step of simultaneously completing a plurality of instructions including a branch instruction when branch prediction is successful and the branch instruction branches; and
Updating the program counter and the next program counter according to the number of completed instructions at the same time.
[0086]
(Supplementary Note 2) In a processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism,
A step of simultaneously completing a plurality of instructions including a branch instruction when the branch prediction is successful and the branch instruction does not branch; and
Updating the program counter and the next program counter according to the number of completed instructions at the same time.
[0087]
(Supplementary Note 3) In a processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism,
A step of simultaneously completing a plurality of instructions including a branch instruction when branch prediction fails and a branch instruction branches; and
Updating the program counter and the next program counter according to the number of completed instructions at the same time.
[0088]
(Supplementary Note 4) In a processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism,
A step of simultaneously completing a plurality of instructions including a branch instruction when the branch prediction fails and the branch instruction does not branch; and
Updating the program counter and the next program counter according to the number of completed instructions at the same time.
[0089]
(Supplementary Note 5) The architecture uses a 64-bit instruction address space,
The program counter according to any one of
[0090]
(Supplementary Note 6) In a processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction unit,
A branch instruction control unit capable of simultaneously controlling a plurality of branch instructions, performing branch condition determination of branch instructions, success / failure of branch prediction, and instruction refetch control.
A branch destination address register for storing a plurality of branch destination addresses of branch instructions determined to branch;
The processor, wherein the branch destination address register can be controlled independently of the branch instruction control unit and the branch prediction unit.
[0091]
(Supplementary Note 7) In a processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism,
Program counter means comprising a program counter and a next program counter;
Means for simultaneously completing a plurality of instructions including a branch instruction when branch prediction is successful and the branch instruction branches;
A processor comprising: means for simultaneously updating the program counter and the next program counter in accordance with the number of completed instructions.
[0092]
(Supplementary Note 8) In a processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism,
Program counter means comprising a program counter and a next program counter;
Means for simultaneously completing a plurality of instructions including a branch instruction when the branch prediction is successful and the branch instruction does not branch;
A processor comprising: means for simultaneously updating the program counter and the next program counter in accordance with the number of completed instructions.
[0093]
(Supplementary Note 9) In a processor that performs instruction control by an out-of-order method using a branch prediction mechanism and controls an architecture having a branch delay instruction,
Program counter means comprising a program counter and a next program counter;
Means for simultaneously completing a plurality of instructions including a branch instruction when branch prediction fails and a branch instruction branches;
A processor comprising: means for simultaneously updating the program counter and the next program counter in accordance with the number of completed instructions.
[0094]
(Supplementary Note 10) In a processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism,
Program counter means comprising a program counter and a next program counter;
Means for simultaneously completing a plurality of instructions including a branch instruction when branch prediction fails and the branch instruction does not branch;
A processor comprising: means for simultaneously updating the program counter and the next program counter in accordance with the number of completed instructions.
[0095]
(Supplementary Note 11) The architecture uses a 64-bit instruction address space,
The processor according to any one of appendices 6 to 10, further comprising means for performing branch instruction control and branch destination address generation using only the lower 32 bits of the instruction, the carry bit, and the borrow bit. .
[0096]
As mentioned above, although this invention was demonstrated by the Example, this invention is not limited to the said Example, It cannot be overemphasized that various deformation | transformation and improvement are possible.
[0097]
【The invention's effect】
According to the present invention, it is possible to realize a program counter control method and a processor capable of improving the branch throughput with a circuit scale (mounting area) as small as possible.
[Brief description of the drawings]
FIG. 1 is a block diagram showing an embodiment of a processor according to the present invention.
FIG. 2 is a block diagram illustrating a main part of an instruction unit.
FIG. 3 is a flowchart illustrating an operation during branch instruction control.
FIG. 4 is a flowchart illustrating an operation at the time of updating a program counter unit.
FIG. 5 is a schematic diagram showing entries in a branch instruction control unit;
FIG. 6 is a schematic diagram showing entries in a branch destination address register.
FIG. 7 is a block diagram showing a configuration of a program counter unit.
FIG. 8 is a logic circuit diagram of a main part in a branch instruction control unit.
FIG. 9 is a logic circuit diagram of a main part in a branch instruction control unit.
FIG. 10 is a logic circuit diagram of a main part in a branch instruction control unit.
FIG. 11 is a logic circuit diagram of a main part in the branch instruction control unit.
FIG. 12 is a logic circuit diagram of a main part in an instruction completion control unit.
FIG. 13 is a logic circuit diagram of a main part in an instruction completion control unit.
FIG. 14 is a logic circuit diagram of an nPC update circuit in a program counter unit.
FIG. 15 is a logic circuit diagram of an update circuit for nPC in a program counter unit.
FIG. 16 is a logic circuit diagram of an update circuit for nPC in a program counter unit.
FIG. 17 is a logic circuit diagram of an update circuit for nPC in a program counter unit.
FIG. 18 is a logic circuit diagram of an update circuit for nPC in a program counter unit.
FIG. 19 is a logic circuit diagram of a PC update circuit in a program counter unit.
FIG. 20 is a logic circuit diagram of a PC update circuit in a program counter unit.
[Explanation of symbols]
1 Branch prediction unit
2 Instruction fetch section
3 Instruction buffer
4 Relative branch address generator
5 Instruction decoder section
6 Branch instruction execution part
7 Branch instruction control unit
8 Delay slot stack
9 Instruction completion controller
10 Branch destination address register
11 Program counter section
11-1 Latch circuit
11-2, 11-3 Update circuit
21 Instruction unit
22 Memory unit
23 Arithmetic unit
PC program counter
nPC Next Program Counter
Claims (5)
分岐予測が成功して分岐命令が分岐した時に、分岐命令を含めた複数の命令を同時に命令完了させるステップと、
プログラムカウンタ及びネクストプログラムカウンタを、完了した命令数に合わせて同時に更新するステップとを含むことを特徴とする、プログラムカウンタ制御方法。In a processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism,
A step of simultaneously completing a plurality of instructions including a branch instruction when branch prediction is successful and the branch instruction branches; and
Updating the program counter and the next program counter according to the number of completed instructions at the same time.
分岐予測が成功して分岐命令が分岐しない時に、分岐命令を含めた複数の命令を同時に命令完了させるステップと、
プログラムカウンタ及びネクストプログラムカウンタを、完了した命令数に合わせて同時に更新するステップとを含むことを特徴とする、プログラムカウンタ制御方法。In a processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism,
A step of simultaneously completing a plurality of instructions including a branch instruction when the branch prediction is successful and the branch instruction does not branch; and
Updating the program counter and the next program counter according to the number of completed instructions at the same time.
分岐予測が失敗して分岐命令が分岐する時に、分岐命令を含めた複数の命令を同時に命令完了させるステップと、
プログラムカウンタ及びネクストプログラムカウンタを、完了した命令数に合わせて同時に更新するステップとを含むことを特徴とする、プログラムカウンタ制御方法。In a processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism,
A step of simultaneously completing a plurality of instructions including a branch instruction when branch prediction fails and a branch instruction branches; and
Updating the program counter and the next program counter according to the number of completed instructions at the same time.
分岐予測が失敗して分岐命令が分岐しない時に、分岐命令を含めた複数の命令を同時に命令完了させるステップと、
プログラムカウンタ及びネクストプログラムカウンタを、完了した命令数に合わせて同時に更新するステップとを含むことを特徴とする、プログラムカウンタ制御方法。In a processor for controlling an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction mechanism,
A step of simultaneously completing a plurality of instructions including a branch instruction when the branch prediction fails and the branch instruction does not branch; and
Updating the program counter and the next program counter according to the number of completed instructions at the same time.
分岐命令の分岐条件判定、分岐予測の成否及び命令再フェッチの制御を行い、複数の分岐命令を同時に制御可能な分岐命令制御部と、
分岐することが確定した分岐命令の分岐先アドレスを複数格納する分岐先アドレスレジスタとを備え、
該分岐先アドレスレジスタは、該分岐命令制御部及び該分岐予測部とは独立して制御可能であることを特徴とする、プロセッサ。In a processor that controls an architecture having a branch delay instruction while performing instruction control by an out-of-order method using a branch prediction unit,
A branch instruction control unit capable of simultaneously controlling a plurality of branch instructions, performing branch condition determination of branch instructions, success / failure of branch prediction, and instruction refetch control.
A branch destination address register for storing a plurality of branch destination addresses of branch instructions determined to branch;
The processor, wherein the branch destination address register can be controlled independently of the branch instruction control unit and the branch prediction unit.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002190557A JP3800533B2 (en) | 2002-06-28 | 2002-06-28 | Program counter control method and processor |
US10/352,005 US7765387B2 (en) | 2002-06-28 | 2003-01-28 | Program counter control method and processor thereof for controlling simultaneous execution of a plurality of instructions including branch instructions using a branch prediction mechanism and a delay instruction for branching |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002190557A JP3800533B2 (en) | 2002-06-28 | 2002-06-28 | Program counter control method and processor |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2004038256A JP2004038256A (en) | 2004-02-05 |
JP3800533B2 true JP3800533B2 (en) | 2006-07-26 |
Family
ID=29774332
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2002190557A Expired - Fee Related JP3800533B2 (en) | 2002-06-28 | 2002-06-28 | Program counter control method and processor |
Country Status (2)
Country | Link |
---|---|
US (1) | US7765387B2 (en) |
JP (1) | JP3800533B2 (en) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE602006013515D1 (en) * | 2006-02-28 | 2010-05-20 | Fujitsu Ltd | PROCESSING DEVICE BY PREDICTING A DISTRIBUTION FROM COMPRESSED ADDRESS INFORMATION |
US9015449B2 (en) | 2011-03-27 | 2015-04-21 | International Business Machines Corporation | Region-weighted accounting of multi-threaded processor core according to dispatch state |
US8868886B2 (en) | 2011-04-04 | 2014-10-21 | International Business Machines Corporation | Task switch immunized performance monitoring |
US9342432B2 (en) | 2011-04-04 | 2016-05-17 | International Business Machines Corporation | Hardware performance-monitoring facility usage after context swaps |
US20130055033A1 (en) | 2011-08-22 | 2013-02-28 | International Business Machines Corporation | Hardware-assisted program trace collection with selectable call-signature capture |
EP2996034B1 (en) * | 2014-09-11 | 2018-08-15 | Nxp B.V. | Execution flow protection in microcontrollers |
US10198260B2 (en) | 2016-01-13 | 2019-02-05 | Oracle International Corporation | Processing instruction control transfer instructions |
US20210141675A1 (en) * | 2017-04-01 | 2021-05-13 | Intel Corporation | Hotpluggable runtime |
US11106466B2 (en) * | 2018-06-18 | 2021-08-31 | International Business Machines Corporation | Decoupling of conditional branches |
US11182166B2 (en) * | 2019-05-23 | 2021-11-23 | Samsung Electronics Co., Ltd. | Branch prediction throughput by skipping over cachelines without branches |
Family Cites Families (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH03122718A (en) | 1989-10-05 | 1991-05-24 | Fujitsu Ltd | Condition branching instruction execution control system in pipe-line computer |
JP2845646B2 (en) | 1990-09-05 | 1999-01-13 | 株式会社東芝 | Parallel processing unit |
US5265213A (en) | 1990-12-10 | 1993-11-23 | Intel Corporation | Pipeline system for executing predicted branch target instruction in a cycle concurrently with the execution of branch instruction |
JPH04213727A (en) | 1990-12-12 | 1992-08-04 | Matsushita Electric Ind Co Ltd | Information processor |
US5488729A (en) * | 1991-05-15 | 1996-01-30 | Ross Technology, Inc. | Central processing unit architecture with symmetric instruction scheduling to achieve multiple instruction launch and execution |
JP3499252B2 (en) * | 1993-03-19 | 2004-02-23 | 株式会社ルネサステクノロジ | Compiling device and data processing device |
JPH0793151A (en) | 1993-09-21 | 1995-04-07 | Oki Electric Ind Co Ltd | Instruction supplying device |
DE69429061T2 (en) * | 1993-10-29 | 2002-07-18 | Advanced Micro Devices Inc | Superskalarmikroprozessoren |
JPH07262008A (en) | 1994-03-25 | 1995-10-13 | Fujitsu Ltd | Parallel branching processor |
US5784603A (en) * | 1996-06-19 | 1998-07-21 | Sun Microsystems, Inc. | Fast handling of branch delay slots on mispredicted branches |
US5826074A (en) * | 1996-11-22 | 1998-10-20 | S3 Incorporated | Extenstion of 32-bit architecture for 64-bit addressing with shared super-page register |
US6240510B1 (en) * | 1998-08-06 | 2001-05-29 | Intel Corporation | System for processing a cluster of instructions where the instructions are issued to the execution units having a priority order according to a template associated with the cluster of instructions |
US6883090B2 (en) * | 2001-05-17 | 2005-04-19 | Broadcom Corporation | Method for cancelling conditional delay slot instructions |
-
2002
- 2002-06-28 JP JP2002190557A patent/JP3800533B2/en not_active Expired - Fee Related
-
2003
- 2003-01-28 US US10/352,005 patent/US7765387B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
US7765387B2 (en) | 2010-07-27 |
JP2004038256A (en) | 2004-02-05 |
US20040003207A1 (en) | 2004-01-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8250349B2 (en) | Branch prediction control device having return address stack and method of branch prediction | |
US7870369B1 (en) | Abort prioritization in a trace-based processor | |
JP3093639B2 (en) | Method and system for tracking resource allocation in a processor | |
US7222227B2 (en) | Control device for speculative instruction execution with a branch instruction insertion, and method for same | |
US20050198480A1 (en) | Apparatus and method of controlling instruction fetch | |
US20020087849A1 (en) | Full multiprocessor speculation mechanism in a symmetric multiprocessor (smp) System | |
US20050210224A1 (en) | Processor including fallback branch prediction mechanism for far jump and far call instructions | |
US6687812B1 (en) | Parallel processing apparatus | |
JPH06236271A (en) | Processor and method for guess and execution of instruction | |
KR100472346B1 (en) | A processor pipeline including instruction replay | |
US5918046A (en) | Method and apparatus for a branch instruction pointer table | |
JPH096611A (en) | Method and system for buffering of data in data-processing system | |
JP3800533B2 (en) | Program counter control method and processor | |
JP2001060153A (en) | Information processor | |
JP3839755B2 (en) | Instruction control method and processor | |
US6754813B1 (en) | Apparatus and method of processing information for suppression of branch prediction | |
JP3816845B2 (en) | Processor and instruction control method | |
JP2020086897A (en) | Arithmetic processing device and method for controlling arithmetic processing device | |
JP7409208B2 (en) | arithmetic processing unit | |
JP3741945B2 (en) | Instruction fetch control device | |
JP5093237B2 (en) | Instruction processing device | |
JPH0384632A (en) | Data processor | |
US11663014B2 (en) | Speculatively executing instructions that follow a status updating instruction | |
US20240118900A1 (en) | Arithmetic processing device and arithmetic processing method | |
US7783863B1 (en) | Graceful degradation in a trace-based processor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20050606 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20060414 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20060418 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20060420 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 Ref document number: 3800533 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20090512 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100512 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100512 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110512 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120512 Year of fee payment: 6 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130512 Year of fee payment: 7 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140512 Year of fee payment: 8 |
|
LAPS | Cancellation because of no payment of annual fees |