JP2006277774A - Information processor having branch prediction mechanism - Google Patents

Information processor having branch prediction mechanism Download PDF

Info

Publication number
JP2006277774A
JP2006277774A JP2006193265A JP2006193265A JP2006277774A JP 2006277774 A JP2006277774 A JP 2006277774A JP 2006193265 A JP2006193265 A JP 2006193265A JP 2006193265 A JP2006193265 A JP 2006193265A JP 2006277774 A JP2006277774 A JP 2006277774A
Authority
JP
Japan
Prior art keywords
instruction
branch
entry
branch prediction
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.)
Granted
Application number
JP2006193265A
Other languages
Japanese (ja)
Other versions
JP4113227B2 (en
Inventor
Masaki Ukai
昌樹 鵜飼
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2006193265A priority Critical patent/JP4113227B2/en
Publication of JP2006277774A publication Critical patent/JP2006277774A/en
Application granted granted Critical
Publication of JP4113227B2 publication Critical patent/JP4113227B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Advance Control (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To increase the speed of processing performance of an information processor by providing a device for effectively deleting a phantom entry. <P>SOLUTION: A phantom entry in entries of branch history is surely detected by using a flag provided for an execution control queue of branch instructions and phantoms for identifying the phantoms and a flag for detecting a mismatch between the start position of an instruction and a position at which a branch prediction is executed, and is deleted when it is not necessary. When an instruction that may generate discontinuity is present in a sequence of instruction execution, a deliberate phantom entry is generated and an instruction prefetch is allowed to be executed for it. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は情報処理装置、特に分岐を含む命令列を高速に実行するための分岐予測機構(ブランチヒストリなど)を採用した情報処理装置に関し、特に性能に悪影響を及ぼすエントリの登録抹消方式に関する。   The present invention relates to an information processing apparatus, and more particularly to an information processing apparatus employing a branch prediction mechanism (branch history or the like) for executing an instruction sequence including a branch at high speed, and more particularly to an entry deregistration method that adversely affects performance.

パイプライン処理方式以降の高度な命令処理方式を採用した情報処理装置においては、一つの命令の実行の終了を待たずに、投機的に後続の命令の処理を行うことで性能の向上を図ってきた。その中でも分岐命令があると、その分岐命令が分岐するか否か、あるいは、分岐する場合には、その分岐先命令の命令アドレスが確定しないと、次に実行すべき命令を投入できない。この問題を解決するために分岐予測機構を導入し、分岐命令の分岐方向の予測、あるいは分岐先命令アドレスを予測することで、更なる性能向上をするようになった。例えば、特開平6−89173号では、キャッシュメモリと独立した分岐予測機構(ブランチヒストリ)を持つことで、優位な性能を得てきた。   In an information processing device that employs an advanced instruction processing method after the pipeline processing method, performance has been improved by speculatively processing subsequent instructions without waiting for the end of execution of one instruction. It was. Among them, if there is a branch instruction, whether or not the branch instruction branches, or in the case of branching, the instruction to be executed next cannot be input unless the instruction address of the branch destination instruction is determined. In order to solve this problem, a branch prediction mechanism has been introduced to predict the branch direction of a branch instruction or the branch destination instruction address, thereby further improving the performance. For example, Japanese Patent Laid-Open No. 6-89173 has obtained superior performance by having a branch prediction mechanism (branch history) independent of the cache memory.

ところが、ブランチヒストリの規模の増大に伴い、その内容によって逆に性能劣化を引き起こすケースが目立ってきた。
特に、ブランチヒストリがキャッシュメモリやTLB(Translation Lookaside Buffer)などと独立しているために、命令列が更新される等で命令域の状態が更新されたとしても、ブランチヒストリに対して通常その更新情報が反映されない、あるいは、全ての更新ケースに対して反映仕切れない。その結果、
・かつて分岐命令が存在した命令アドレスに別の命令がロードされる
・TLBを変更したなどで論理空間に別のプログラムがディスパッチされる
などで、分岐命令以外の命令に対して分岐予測を行う、という事態が発生する。ブランチヒストリ上に存在するこのようなエントリをファントムエントリと呼ぶ。
However, with the increase in the branch history scale, there have been conspicuous cases where the contents deteriorated depending on the contents.
In particular, since the branch history is independent of the cache memory, TLB (Translation Lookaside Buffer), etc., even if the state of the instruction area is updated by updating the instruction sequence, the branch history is normally updated. Information is not reflected or is not reflected for all update cases. as a result,
-Another instruction is loaded at the instruction address where the branch instruction used to exist-Another program is dispatched to the logical space by changing the TLB, etc., and branch prediction is performed for instructions other than the branch instruction. This happens. Such an entry existing in the branch history is called a phantom entry.

図9は、ファントムエントリが生じる仕組みを概略説明する図である。
従来のブランチヒストリは、ファントムエントリを積極的に消去せず、新たなエントリが登録されることで発生するリプレース動作により、古いエントリが消去される動作により、ファントムエントリもまた、そのうち消滅することを期待していた。
FIG. 9 is a diagram schematically illustrating a mechanism in which phantom entry occurs.
The conventional branch history does not actively delete phantom entries, but replaces that occur when a new entry is registered. I expected.

しかし、図9に示されるように、プログラムAとプログラムBとがあり、これらをプロセッサが時分割制御によって、並列に実行している場合を考えると、ある時は、プログラムAが実行され、別の時は、プログラムBが実行されるという状態が起きる。図9の場合、プログラムAのアドレスが1500番地にブランチ命令があるとしている。この場合、ブランチヒストリなどの分岐予測機構は、アドレスの1500番地を検出すると、分岐予測を行う。プログラムAのみが実行されている場合には、1500番地に格納されている命令はブランチ命令なので、分岐予測をするのは正しいが、時分割制御のように、ある時命令実行がプログラムBに移ったとすると、ブランチヒストリなどの分岐予測機構は、命令のデコードを待たず、アドレスの検出のみによって分岐予測をするので、1500番地を検出すると自動的に分岐予測をしてしまう。しかし、現在は、プログラムBを実行しているので、図9に示されるように、1500番地には、分岐予測の必要のないアド命令が格納されている。したがって、ブランチヒストリが正しくエントリを保持していないと、このような分岐予測すべきでない、プログラムBのアド命令についても、プログラムAのブランチ命令だと判断して分岐予測を行ってしまう。   However, as shown in FIG. 9, there are a program A and a program B, and considering that the processor is executing them in parallel by time-sharing control, the program A is executed in some cases. In this case, a state occurs in which the program B is executed. In the case of FIG. 9, it is assumed that there is a branch instruction at address 1500 of program A. In this case, a branch prediction mechanism such as a branch history performs branch prediction when the address 1500 is detected. If only program A is executed, the instruction stored at address 1500 is a branch instruction, so it is correct to make a branch prediction, but at some point, instruction execution moves to program B as in time-sharing control. Assuming that the branch prediction mechanism such as the branch history does not wait for the instruction to be decoded and performs branch prediction only by detecting the address, the branch prediction is automatically made when address 1500 is detected. However, since program B is currently being executed, an add instruction that does not require branch prediction is stored at address 1500 as shown in FIG. Therefore, if the branch history does not hold the entry correctly, it is determined that the add instruction of the program B, which should not be predicted as such, is also a branch instruction of the program A, and branch prediction is performed.

命令の実行制御において、このように、分岐命令でないにも関わらず分岐予測を行われると、その不整合を解消する処理が必要になり、オーバヘッドを伴う。従って、このファントムエントリに対しては判明次第消去しなければ、性能向上のために開発されたはずのブランチヒストリが、逆に性能劣化を伴うものとなる。特に、ブランチヒストリのエントリ容量が少なかった場合にはリプレース動作などで消去されるまでの時間が短かったものが、容量や連想度の増大に伴い、ファントムエントリの残留も多くなり、問題が顕在化するようになった。   In instruction execution control, if branch prediction is performed even though it is not a branch instruction, processing for eliminating the inconsistency is required, which involves overhead. Therefore, if this phantom entry is not deleted as soon as it is found, the branch history that should have been developed for improving the performance is conversely accompanied by performance degradation. In particular, when the branch history entry capacity is small, the time required for erasure by the replace operation is short, but as the capacity and association level increase, the phantom entry remains and the problem becomes apparent. It was way.

本発明の課題は、このような状況を解決するため、ファントムエントリを効果的に消去する装置を提供し、従って、情報処理装置の処理性能の高速化を実現することである。   In order to solve such a situation, an object of the present invention is to provide an apparatus that effectively erases a phantom entry, and therefore, to realize an increase in processing performance of the information processing apparatus.

本発明の第1の情報処理装置は、分岐予測機構を有する情報処理装置において、分岐予測を行った対象の命令が分岐命令であるか否かを判断する判断手段と、該分岐予測を行った対象の命令が分岐命令でないと判断された場合に、前記分岐予測機構に格納される該命令に対応する分岐予測のためのエントリを削除するファントム削除手段とを備えることを特徴とする。   According to a first information processing apparatus of the present invention, in an information processing apparatus having a branch prediction mechanism, determination means for determining whether or not a target instruction for which branch prediction is performed is a branch instruction, and the branch prediction is performed. Phantom deletion means for deleting an entry for branch prediction corresponding to the instruction stored in the branch prediction mechanism when it is determined that the target instruction is not a branch instruction.

本発明の第2の情報処理装置は、分岐予測機構を有する情報処理装置において、命令を切り出し、実行のために格納するキュー手段と、該キュー手段に格納される命令について分岐予測を行った場合、該分岐予測を行ったアドレス位置が該キュー手段に格納された命令語の境界にあるか否かを検出する検出手段と、該分岐予測を行ったアドレス位置が命令語の境界にないと判断された場合には、該分岐予測を行う基となった、分岐予測機構に格納される分岐予測のためのエントリを削除するミスアライン削除手段とを備えることを特徴とする。   The second information processing apparatus according to the present invention is a case in which, in an information processing apparatus having a branch prediction mechanism, a queue unit that cuts out an instruction and stores it for execution, and branch prediction is performed on the instruction stored in the queue unit Detecting means for detecting whether or not the address position where the branch prediction is made is at the boundary of the instruction word stored in the queue means, and determining that the address position where the branch prediction is made is not at the boundary of the instruction word In such a case, a misalignment deleting unit that deletes an entry for branch prediction stored in the branch prediction mechanism, which is a basis for performing the branch prediction, is provided.

本発明の第3の情報処理装置は、分岐予測機構を有する情報処理装置において、分岐命令であっても高速に実行されない命令、あるいは、分岐命令ではないが、命令シーケンスを不連続にする命令を検出するファントム対象命令検出手段と、該ファントム対象命令検出手段が検出した命令に対応するエントリを、分岐予測機構に格納される分岐予測のためのエントリに生成して加えるファントムエントリ生成手段とを備え、分岐予測のためのエントリを用いて命令プリフェッチを行うことによって命令の高速処理を実現することを特徴とする。   According to a third information processing apparatus of the present invention, in an information processing apparatus having a branch prediction mechanism, an instruction that is not executed at high speed even if it is a branch instruction or an instruction that makes the instruction sequence discontinuous although it is not a branch instruction. Phantom target instruction detecting means for detecting, and phantom entry generating means for generating and adding an entry corresponding to the instruction detected by the phantom target instruction detecting means to an entry for branch prediction stored in the branch prediction mechanism , High-speed instruction processing is realized by performing instruction prefetch using an entry for branch prediction.

本発明によれば、分岐予測機構に格納されるブランチヒストリのエントリの内、余分なエントリであるファントムエントリを確実に消去し、アプリケーションが時分割に情報処理装置によって実行されるような場合でも、間違った分岐予測が行われるのを避けることができる。従って、誤った分岐予測をただすために必要とされる時間を節約し、情報処理装置の処理性能を向上することができる。   According to the present invention, even if the phantom entry, which is an extra entry, is reliably deleted from the branch history entries stored in the branch prediction mechanism, even when the application is executed by the information processing device in a time-sharing manner, Incorrect branch prediction can be avoided. Therefore, it is possible to save the time required for making an erroneous branch prediction and improve the processing performance of the information processing apparatus.

また、情報処理装置が処理に時間がかかる命令などを故意にファントムエントリとしてブランチヒストリに登録し、これらの命令について命令プリフェッチを行うようにすることで、これらの命令の実行を高速化することができ、やはり、情報処理装置の処理性能を向上することができる。   In addition, the information processing apparatus intentionally registers instructions that take a long time to process in the branch history as phantom entries, and performs prefetching of these instructions, thereby speeding up the execution of these instructions. In addition, the processing performance of the information processing apparatus can be improved.

本手法を用いることで、ファントムエントリを確実に消去でき、ブランチヒストリの性能劣化を回避することができるようになる。また、この機能を積極利用することにより、複雑な制御転送命令であっても命令プリフェッチ効果をもたらす制御を可能とし、性能向上に役立つ。   By using this method, the phantom entry can be surely deleted and the performance deterioration of the branch history can be avoided. Further, by actively utilizing this function, it is possible to perform control that provides an instruction prefetch effect even for a complicated control transfer instruction, which is useful for improving performance.

分岐予測は当然ながら分岐命令の実行制御と密接に関連する。分岐処理の結果、その分岐予測が成功したか否かを分岐制御部は知っており、ブランチヒストリを更新するための情報・更新制御構造を持っている。この構成は実用化されている(特開2000−282710号公報参照)。   Naturally, branch prediction is closely related to execution control of branch instructions. As a result of the branch processing, the branch control unit knows whether or not the branch prediction is successful, and has an information / update control structure for updating the branch history. This configuration has been put into practical use (see Japanese Patent Application Laid-Open No. 2000-282710).

ここで分岐制御部において、分岐命令でないにも関わらず分岐予測された命令に対応したエントリを生成することで、分岐予測部(ブランチヒストリ)に対して分岐予測の成否を報告する装置は、特開2000−181710号公報において述べられているので、これを有効活用する。   Here, a device that reports the success or failure of branch prediction to the branch prediction unit (branch history) by generating an entry corresponding to a branch predicted instruction in spite of not being a branch instruction in the branch control unit. Since this is described in Japanese Unexamined Patent Publication No. 2000-181710, this is utilized effectively.

また、通常のブランチヒストリ更新については、例えば、特開2000−172503号公報において述べられているので、これも有効活用する。
装置によっては、命令長が一定ではなく可変長である(複数の命令長を持つ)命令セットを採用しているものがある。このような命令セット上でブランチヒストリを採用したマイクロアーキテクチャの場合、状況によって図1のように、命令境界とは異なる位置に対して分岐予測を行うケースが生じる。これもファントムエントリの一種であるが、前述の状況からさらに困難な問題が控える。
Further, since normal branch history update is described in, for example, Japanese Patent Laid-Open No. 2000-172503, this is also effectively utilized.
Some apparatuses employ an instruction set in which the instruction length is not constant but variable (having a plurality of instruction lengths). In the case of a microarchitecture that employs a branch history on such an instruction set, there is a case where branch prediction is performed at a position different from the instruction boundary as shown in FIG. This is also a kind of phantom entry, but it refrains from more difficult problems from the above situation.

図1は、命令境界でないところで分岐予測が生じる場合について説明する図である。
図1(a)に記載されている通常の分岐予測では、命令と命令の間の境界の部分で分岐予測がなされる。しかし、従来技術で述べたような、別のプログラムがロードされ、ブランチヒストリが更新されないままの場合、図1(b)のように、命令の境界以外の場所で分岐予測がなされることがある。これは、前のプログラムにおいて、分岐命令が図1(b)の点線で示される部分にあった場合に、次のプログラムが読み込まれた後では、前のプログラムの命令の境界が必ずしも後のプログラムの命令の境界になるとは限らないと言うことを意味している。
FIG. 1 is a diagram for explaining a case in which branch prediction occurs at an instruction boundary.
In the normal branch prediction described in FIG. 1A, branch prediction is performed at a boundary portion between instructions. However, when another program is loaded and the branch history is not updated as described in the prior art, branch prediction may be performed at a place other than the instruction boundary as shown in FIG. . This is because, in the previous program, when the branch instruction is in the portion indicated by the dotted line in FIG. 1B, after the next program is read, the boundary of the instruction of the previous program is not necessarily the subsequent program. This means that it will not always be a boundary between orders.

この場合、命令境界からのオフセットなど、該予測位置を正確に復元できる情報を記憶しておかなければ、対応するブランチヒストリ上のファントムエントリを消せない場合がある。   In this case, the phantom entry on the corresponding branch history cannot be deleted unless information that can accurately restore the predicted position, such as an offset from the instruction boundary, is not stored.

また、必ず割り込みを発生させる命令(ソフトウェアトラップ命令)など、分岐命令同様に命令アドレスを変更する命令がある。これらの命令は命令アドレスを変更すると同時にプロセッサステートなどを変更するため、分岐命令制御部のみで高速に動作させられないことがある。   There are also instructions that change the instruction address, like branch instructions, such as instructions that always generate interrupts (software trap instructions). Since these instructions change the processor address and the like at the same time as changing the instruction address, they may not be operated at high speed only by the branch instruction control unit.

これらの特殊な命令についてもブランチヒストリに登録することができれば、ブランチヒストリを索引した結果、当該情報より分岐予測先フェッチを行うことができるようになるので、命令キャッシュ領域に実行される命令を先読みする効果をもたらし、キャッシュミスペナルティを軽減することができる。   If these special instructions can also be registered in the branch history, the branch history is indexed, so that the branch prediction destination fetch can be performed from the information, so the instruction executed in the instruction cache area is prefetched. Effect, and cash miss penalty can be reduced.

このように、分岐実行制御部が操作しない命令においても、本発明の実施形態に従ったファントムエントリ消去手法を用いることで、矛盾無く、また他の分岐命令の予測を含む動作を阻害することなく動作する事ができるようになる。   As described above, even in an instruction that is not operated by the branch execution control unit, by using the phantom entry erasing method according to the embodiment of the present invention, there is no contradiction and an operation including prediction of another branch instruction is not hindered. It will be able to work.

図2は、本発明の実施形態における情報処理装置の概略を示す図である。
本実施形態においては、スーパスカラ方式の情報処理装置で、3命令同時処理可能であり、命令フェッチ部においては、そのための最大3命令をIWR0〜IWR2(Instruction Word Register)にセットするものとする。また、1命令の命令語長は、2、4、6バイトの3通りがあるものとし、ただし長さ6バイトの命令はIWR0にのみセットされる(それ以外には次以降のサイクルにまわる)ものとする。以下、ハーフワード単位での表現が入ることがある(従って、Half−Wordは、1、2、3ハーフワードの3通り)。
FIG. 2 is a diagram showing an outline of the information processing apparatus according to the embodiment of the present invention.
In this embodiment, a superscalar type information processing apparatus can simultaneously process three instructions. In the instruction fetch unit, a maximum of three instructions are set in IWR0 to IWR2 (Instruction Word Register). In addition, there are three instruction word lengths of 1, 4 and 6 bytes for one instruction. However, an instruction with a length of 6 bytes is set only to IWR0 (otherwise, it goes to the next and subsequent cycles). Shall. Hereinafter, expressions in half word units may be entered (therefore, Half-Word is 1, 2, or 3 half words).

分岐処理上の分岐命令キューをここではRSBRとし、RSBR上の各キューには、各分岐命令の命令アドレスPC、分岐先アドレスTPCに、分岐予測情報であるBRHIS Hitタグと、Hit−Wayタグ情報があるものとする。この構成は、特開2000−172503号公報に記載のものと同じである。本実施形態においては、更にHit−Offsetを持ち、これは分岐予測された位置の当該命令アドレスPCからのオフセットで示される。従って、普通に分岐命令について分岐予測されていればHit−Offsetは0を示す。   Here, the branch instruction queue for branch processing is RSBR, and each queue on RSBR has an instruction address PC and a branch destination address TPC of each branch instruction, a BRHIS Hit tag that is branch prediction information, and Hit-Way tag information. There shall be. This configuration is the same as that described in Japanese Patent Laid-Open No. 2000-172503. In the present embodiment, Hit-Offset is further provided, which is indicated by an offset from the instruction address PC at the position where the branch is predicted. Therefore, if a branch instruction is normally predicted for a branch instruction, Hit-Offset indicates 0.

ただし、本発明の実施形態とは異なり、ある種のRISC命令セットでは、命令語が必ず4バイトなどの一定値であり、また、命令の実行位置を命令語境界に持ってくる境界位置保障がなされている。こういった命令セット上では分岐予測位置が命令語境界にならないという事象は起こらない(わざわざ起こるように作ることは可能だが、そのメリットはない)。従って、このような命令セットを実現する装置ではHit−Offsetは不要であるので、本実施形態のこのような命令セットへの応用は当業者によって適宜変型されるべきである。   However, unlike the embodiment of the present invention, in a certain RISC instruction set, the instruction word is always a constant value such as 4 bytes, and there is a boundary position guarantee that brings the instruction execution position to the instruction word boundary. Has been made. On such an instruction set, the event that the branch prediction position does not become an instruction word boundary does not occur (it can be made to occur intentionally, but there is no merit). Accordingly, since Hit-Offset is not necessary in an apparatus that implements such an instruction set, the application of this embodiment to such an instruction set should be modified as appropriate by those skilled in the art.

図2において、IF−EAG(Instruction Fetch−Effective Address Generator)すなわち、フェッチアドレス生成部10においては、命令フェッチすべき命令のアドレスが計算される。計算されたアドレスは、ブランチヒストリ(BRHIS)を有する分岐予測部11とI−Cacheすなわち、命令キャッシュ12に入力される。分岐予測部11では、入力されたアドレスから分岐予測を行うか否か、及び分岐予測をした場合には、予測分岐先アドレスを出力する。予測分岐先アドレスはフェッチアドレス生成部10に渡され、そのまま命令キャッシュ12に入力される。また、分岐予測部11の出力である、分岐予測をした旨の信号は、命令投入制御部13に入力される。   In FIG. 2, IF-EAG (Instruction Fetch-Effective Address Generator), that is, the fetch address generator 10 calculates the address of the instruction to be fetched. The calculated address is input to the branch prediction unit 11 having a branch history (BRHIS) and the I-Cache, that is, the instruction cache 12. The branch prediction unit 11 outputs whether or not branch prediction is performed from the input address and, when branch prediction is performed, a predicted branch destination address. The predicted branch destination address is transferred to the fetch address generation unit 10 and input to the instruction cache 12 as it is. Further, a signal indicating that the branch prediction is performed, which is an output of the branch prediction unit 11, is input to the instruction input control unit 13.

命令キャッシュ12は、入力されたアドレスから実行すべき命令を取り出し、命令投入制御部13へ入力する。命令投入制御部13は、入力された命令を、分岐予測されたものか否かの情報と共に、命令解読の方法を指示してIWR、すなわち、命令解読部14に渡す。命令解読部14において命令が解読されると、命令の内容によって、それぞれの命令処理部に渡されるが、特に、分岐命令である場合には、分岐命令キューRSBRの生成制御を行うRSBR生成制御部15に入力される。分岐命令キューRSBRは、分岐処理部16内に生成され、分岐命令の処理が順次行われる。   The instruction cache 12 extracts an instruction to be executed from the input address and inputs the instruction to the instruction input control unit 13. The instruction input control unit 13 instructs the instruction decoding method together with information on whether or not the branch instruction is predicted, and passes it to the IWR, that is, the instruction decoding unit 14. When the instruction is decoded by the instruction decoding unit 14, it is passed to each instruction processing unit depending on the content of the instruction. In particular, in the case of a branch instruction, an RSBR generation control unit that controls generation of the branch instruction queue RSBR. 15 is input. The branch instruction queue RSBR is generated in the branch processing unit 16, and branch instruction processing is sequentially performed.

分岐処理部16の分岐命令の処理の結果は、分岐完了制御部17に渡され、分岐予測が成功したか、あるいは、失敗したかの判断をし、処理完了した分岐情報をBRHIS更新制御部18に渡す。BRHIS更新制御部18では、取得した分岐情報を基に、分岐予測部11のブランチヒストリの更新を行う。   The result of the branch instruction processing of the branch processing unit 16 is transferred to the branch completion control unit 17 to determine whether the branch prediction has succeeded or failed, and the branch information that has been processed is stored in the BRHIS update control unit 18. To pass. The BRHIIS update control unit 18 updates the branch history of the branch prediction unit 11 based on the acquired branch information.

命令をIWRにセットする際、同時に分岐予測結果を命令毎に切り分けて送る。そして、その分岐予測に関連付けられたHit−Wayを含む分岐予測情報と共に、Hit−OffsetをRSBRに渡す。   When an instruction is set in IWR, the branch prediction result is divided and sent for each instruction at the same time. Then, Hit-Offset is passed to RSBR together with branch prediction information including Hit-Way associated with the branch prediction.

図3は、BRHIS−HitとHit−Offset(MISALIGN Half−Word)の生成回路例を示す図である。なお、図3の回路は、図2の構成の内、命令投入制御部13内に設けられるものである。   FIG. 3 is a diagram illustrating a generation circuit example of BRHIS-Hit and Hit-Offset (MISALIGN Half-Word). The circuit of FIG. 3 is provided in the instruction input control unit 13 in the configuration of FIG.

この図においてL1 HWm ILC n信号は、命令切り出し開始点からハーフワード距離mにある命令の(そこが命令境界点であれば)命令語長がnであることを意味する信号である(nは、この場合2、4、6のいずれかであり、使用されている命令語の長さを示す。また、mは、命令の切り出し位置から、命令の先頭が、ハーフワード数(例えば2ハーフワード)を単位としてどの位置にあるかを示す)。またL1 HIT HW p信号は、分岐予測された点が命令切りだし開始点からハーフワード距離pに有ることを示す信号である。   In this figure, the L1 HWm ILC n signal is a signal that means that the instruction word length of an instruction at a halfword distance m from the instruction cut-out start point (if it is an instruction boundary point) is n (n is In this case, it is one of 2, 4, and 6 and indicates the length of the used instruction word, and m is the number of halfwords (for example, 2 halfwords) from the instruction cutout position. ) As a unit). The L1 HIT HW p signal is a signal indicating that the branch predicted point is at the half word distance p from the instruction start point.

分岐予測が命令境界位置に無かった場合にも対応する命令のHit(SET IWRx HIT)として検出し、同時に、SET IWRx MISALIGN HW y信号を出すことで、命令語境界になかったことを判別する。   Even when the branch prediction is not at the instruction boundary position, it is detected as Hit (SET IWRx HIT) of the corresponding instruction, and at the same time, a SET IWRx MISALIGN HW y signal is issued to determine that there is no instruction word boundary.

すなわち、図3の上段の「for IWR0」の回路においては、命令の切り出し位置が命令語境界であることを示すL1 HIT HW 0の論理値が真で入力されると、IWR0がヒットしたことを意味するSET IWR0 HITの論理値が真となる。また、同じく、命令語長が4あるいは6である場合であって、命令切り出し位置からハーフワード距離0のところに命令があり(L1 HW 0ILC 4、6)、かつ、分岐予測された点が命令切り出し開始点からハーフワード距離1にある場合には、SET IWR0 HITの論理値を真にすると共に、ハーフワード距離1のところで命令語境界になっていないことを示すSET IWR0 MISALIGN HW 1の論理値が真となる。同様に、命令切り出し開始点からハーフワード距離2のところに分岐予測された点が有る場合であって(L1 HIT HW 2)、かつ、命令語長が6である場合であって、命令切り出し位置からハーフワード距離0のところに命令がある場合、ハーフワード距離2のところで、ミスアラインされている(分岐予測が命令語境界でないところで行われている)ことを示すSET IWR0 MISALIGN HW 2の論理値が真となる。ただし、SET IWR0 HITは、何れの場合にも分岐予測が行われたことを示すために真とされる。   That is, in the “for IWR0” circuit in the upper part of FIG. 3, if the logical value of L1 HIT HW 0 indicating that the instruction cut-out position is an instruction word boundary is input as true, it indicates that IWR0 has been hit. Meaning logical value of SET IWR0 HIT becomes true. Similarly, when the instruction word length is 4 or 6, there is an instruction at a halfword distance 0 from the instruction extraction position (L1 HW 0ILC 4, 6), and the branch predicted point is the instruction. When the half word distance is 1 from the cutout start point, the logical value of SET IWR0 HIT is set to true, and the logical value of SET IWR0 MISALIGN HW 1 indicating that the instruction word boundary is not reached at the half word distance 1 Becomes true. Similarly, when there is a branch predicted point at a halfword distance 2 from the instruction cutout start point (L1 HIT HW 2) and the instruction word length is 6, the instruction cutout position When there is an instruction at a halfword distance of 0, the logical value of SET IWR0 MISALIGN HW 2 indicating that misalignment is performed at a halfword distance of 2 (branch prediction is performed not at an instruction word boundary) is Become true. However, SET IWR0 HIT is true to indicate that branch prediction has been performed in any case.

以上のように、図3の信号を読むと、「for IWR1」の回路の場合には、
1)ハーフワード距離1のところで分岐予測され、命令語長2で、ハーフワード距離0のところに命令がある場合は、ミスアラインではなく、分岐予測が行われたことを示すSET IWR1 HITの論理値が真となる。
2)ハーフワード距離2のところで分岐予測され、命令語長4で、ハーフワード距離0のところに命令がある場合には、ミスアラインではなく、SET IWR1 HITの論理値が真となる。
3)ハーフワード距離2のところで分岐予測され、命令語長が2でハーフワード距離0のところに命令があり、かつ、命令語長が4でハーフワード距離1のところに命令がある場合には、ミスアラインであるとして、SET IWR1 HIT及びSET IWR1 MISALIGN HW 1の論理値が真になる(ここでは、最初の命令が命令語長2で次の命令の命令語長が4であり、分岐予測が次の命令の真ん中で起こっている場合を示している)。
4)ハーフワード距離3のところで分岐予測され、命令語長が4でハーフワード距離0のところに命令があり、かつ、命令語長が4でハーフワード距離2のところに命令がある場合には、ミスアラインであるとして、SET IWR1 HIT及びSET IWR1 MISALIGN HW 1の論理値を真とする。
As described above, when the signal of FIG. 3 is read, in the case of the “for IWR1” circuit,
1) When a branch is predicted at a halfword distance of 1, an instruction word length of 2 and an instruction is at a halfword distance of 0, a logical value of SET IWR1 HIT indicating that a branch prediction has been made, not a misalignment Becomes true.
2) If a branch is predicted at a halfword distance of 2, an instruction word length of 4 and an instruction at a halfword distance of 0, the logical value of SET IWR1 HIT is true instead of misalignment.
3) When a branch is predicted at a halfword distance of 2, an instruction word length is 2 and an instruction is at a halfword distance of 0, and an instruction word length is 4 and an instruction is at a halfword distance of 1 , The logical values of SET IWR1 HIT and SET IWR1 MISALIGN HW 1 become true (in this case, the first instruction has an instruction word length of 2 and the next instruction has an instruction word length of 4, and branch prediction is Shows what happens in the middle of the next instruction).
4) When a branch is predicted at a halfword distance of 3, an instruction word length of 4 and an instruction at a halfword distance of 0, and an instruction word length of 4 and an instruction at a halfword distance of 2 Assuming misalignment, the logical values of SET IWR1 HIT and SET IWR1 MISALIGN HW 1 are set to true.

更に、「for IWR2」の回路においては、
1)ハーフワード距離2のところで分岐予測され、命令語長が2でハーフワード距離0と1のところに命令がある場合は、通常にヒットしたとしてSET IWR2 HITの論理値が真となる。
2)ハーフワード距離3のところで分岐予測され、命令語長が2でハーフワード距離0のところに命令があり、かつ、命令語長4でハーフワード距離2のところに命令がある場合は、通常にヒットしたとしてSET IWR2 HITの論理値が真となる。
3)ハーフワード距離3のところで分岐予測され、ハーフワード距離0のところに命令語長4の命令が、ハーフワード距離1のところに命令語長2の命令が有る場合には、通常にヒットしたとして、SET IWR2 HITの論理値が真となる。
4)ハーフワード距離4のところで分岐予測され、ハーフワード距離0のところに命令語長4の命令が、ハーフワード距離2のところに命令語長4の命令がある場合には、通常にヒットしたとして、SET IWR2 HITの論理値を真にする。
5)ハーフワード距離3のところで分岐予測され、ハーフワード距離0のところに、命令語長2の命令が、ハーフワード距離1のところに命令語長2の命令が、ハーフワード距離2のところに命令語長4の命令がある場合には、ミスアラインが起きたとして、SET IWR2 HIT及びSET IWR2 MISALIGN HW 1の論理値が真とする。
6)ハーフワード距離4のところで分岐予測され、ハーフワード距離0のところに命令語長2の命令が、ハーフワード距離1のところに命令語長4の命令が、ハーフワード距離3のところに命令語長4の命令がある場合には、ミスアラインが起きたとして、SET IWR2 HIT及びSET IWR2 MISALIGN HW 1の論理値を真とする。
7)ハーフワード距離4のところで分岐予測され、ハーフワード距離0のところに命令語長4の命令が、ハーフワード距離2のところに命令語長2の命令が、ハーフワード距離3のところに命令語長4の命令がある場合、ミスアラインが起きたとして、SET IWR2 HIT及びSET IWR2 MISALIGNHW 1の論理値を真とする。
8)ハーフワード距離5のところで分岐予測され、ハーフワード距離0のところに命令語長4の命令が、ハーフワード距離2のところに命令語長4の命令が、ハーフワード距離4のところに命令語長4の命令がある場合には、SET IWR2 HIT及びSET IWR2 MISALIGN HW 1の論理値を真とする。
Furthermore, in the “for IWR2” circuit,
1) When a branch is predicted at a halfword distance of 2, the instruction word length is 2 and there are instructions at halfword distances 0 and 1, the logical value of SET IWR2 HIT becomes true as a normal hit.
2) When a branch is predicted at a halfword distance of 3, an instruction word length is 2 and an instruction is at a halfword distance of 0, and an instruction word length is 4 and an instruction is at a halfword distance of 2, usually The logical value of SET IWR2 HIT becomes true.
3) A branch is predicted at a halfword distance of 3, and if an instruction with an instruction word length of 4 is present at a halfword distance of 0 and an instruction with an instruction word length of 2 is present at a halfword distance of 1, a normal hit is found. As a result, the logical value of SET IWR2 HIT becomes true.
4) A branch was predicted at a halfword distance of 4, and when an instruction with an instruction word length of 4 was found at a halfword distance of 0 and an instruction with an instruction word length of 4 was found at a halfword distance of 2, a normal hit was found. The logical value of SET IWR2 HIT is made true.
5) A branch is predicted at a halfword distance of 3, an instruction with an instruction word length of 2 at a halfword distance of 0, an instruction with an instruction word length of 2 at a halfword distance of 1, and a halfword distance of 2. If there is an instruction with an instruction word length of 4, it is assumed that a misalignment has occurred, and the logical values of SET IWR2 HIT and SET IWR2 MALIGN HW 1 are true.
6) A branch is predicted at a halfword distance of 4, an instruction word length of 2 at halfword distance 0, an instructionword length of 4 at halfword distance 1, and an instruction at halfword distance 3. If there is an instruction with a word length of 4, it is assumed that a misalignment has occurred, and the logical values of SET IWR2 HIT and SET IWR2 MISALIGN HW 1 are set to true.
7) A branch is predicted at a halfword distance of 4, an instruction word length of 4 at a halfword distance of 0, an instruction of a word length of 2 at a halfword distance of 2, and an instruction at a halfword distance of 3 If there is an instruction with a word length of 4, the logical values of SET IWR2 HIT and SET IWR2 MISALIGNWW 1 are set to true, assuming that misalignment has occurred.
8) A branch is predicted at halfword distance 5, an instruction word length 4 instruction at halfword distance 0, an instruction word length 4 instruction at halfword distance 2, an instruction at halfword distance 4 If there is an instruction with a word length of 4, the logical values of SET IWR2 HIT and SET IWR2 MISALIGN HW 1 are set to true.

これらを他の分岐予測情報タグと組でRSBRに渡す。他の分岐予測情報タグと組でRSBRに渡す構成の詳細は既知である。
図4は、分岐命令とファントムの実行制御キューRSBRの構成例を示す図である。同図のRSBRは、図2の分岐処理部16に設けられるものである。
These are passed to RSBR in combination with other branch prediction information tags. Details of the configuration passed to the RSBR in combination with other branch prediction information tags are known.
FIG. 4 is a diagram showing a configuration example of the branch instruction and phantom execution control queue RSBR. The RSBR in the same figure is provided in the branch processing unit 16 in FIG.

この構成では、キューRSBRのエントリの有効性を示すvalidフラグと、ファントムエントリか否かを示すPhantom−Validフラグ、条件分岐のアドレスや分岐条件などを記述する分岐制御情報、分岐予測する命令のアドレスIAR、分岐先の命令アドレスTIAR、図3のSET IWRy HIT(ここで、yは、IWRを識別する整数)を格納するHit部、ブランチヒストリのWAYを示すWay部、及び、図3のミスアラインを示す信号を格納するMisalign−HW部からなる。Misalign−HWのデータは、RSBRのエントリがファントムエントリの時にのみ有効である。   In this configuration, a valid flag indicating the validity of an entry in the queue RSBR, a phantom-valid flag indicating whether or not the entry is a phantom entry, branch control information describing the address of a conditional branch, a branch condition, etc., and the address of an instruction for branch prediction The IAR, the instruction address TIAR at the branch destination, the Hit part for storing the SET IWRy HIT (where y is an integer identifying IWR) in FIG. 3, the Way part indicating the WAY of the branch history, and the misalignment in FIG. It consists of a Misalign-HW unit for storing the signal shown. Misalign-HW data is valid only when the RSBR entry is a phantom entry.

なお、RSBRのPhantom−Validフラグの設定は、前述の特開2000−181710号公報に記載の技術を使って設定するものとする。
RSBRで分岐処理もしくはファントムエントリ処理が完了すると、ブランチヒストリに対して、その完了報告が行われる。
Note that the RSBR Phantom-Valid flag is set using the technique described in Japanese Patent Laid-Open No. 2000-181710.
When the branch process or phantom entry process is completed by RSBR, the completion report is sent to the branch history.

図5は、分岐実行完了の報告を行うための動作を説明する図である。なお、図5の回路は、図2の分岐完了制御部17に設けられるものである。
図6は、エントリ消去のための指示信号を生成する回路例を示す図である。図6の回路は、図2のBRHIS更新制御部18に設けられる。
FIG. 5 is a diagram for explaining the operation for reporting the completion of branch execution. The circuit in FIG. 5 is provided in the branch completion control unit 17 in FIG.
FIG. 6 is a diagram illustrating a circuit example for generating an instruction signal for erasing an entry. The circuit of FIG. 6 is provided in the BRHIIS update control unit 18 of FIG.

分岐完了制御回路は、ファントムエントリ処理完了の場合、当該命令がファントムエントリであったことを示すBR COMP AS PHANTOMとともに、完了した命令の命令アドレスBR COMP IAR<0:31>、BRHIS HitしたWAY位置BR COMP HIT WAY<1:0>、それがミスアラインしていた場合のBR COMP MISALIGN HW y(と必要に応じて他の制御フラグ)をBRHIS更新制御部に送る。   When the phantom entry processing is completed, the branch completion control circuit, together with BR COMP AS PHANTOM indicating that the instruction is a phantom entry, the instruction address BR COMP IAR <0:31> of the completed instruction, the WAY position where the BRHIS Hit is performed BR COMP HIT WAY <1: 0>, and BR COMP MISALIGN HW y (and other control flags as necessary) when it is misaligned are sent to the BRHIS update control unit.

図6において、通常の分岐予測の場合には、命令境界位置に予測されるので、Hitしたエントリ位置はBR COMP IAR<0:31>であるが、ファントムエントリであって、ミスアラインを検出している場合、Hitを検出したエントリの本来の位置はBR COMP IAR<0:31>+BR COMPMISALIGN HW y(ここで、yはハーフワード距離の値であり、整数である。この演算は、y=1の場合、2を加算するなど)となる。これで決まるアドレス位置でBR COMP HIT WAYによって指示されたWAYへ消去動作を行えば良い。   In FIG. 6, in the case of normal branch prediction, since it is predicted at the instruction boundary position, the hit entry position is BR COMP IAR <0:31>, but it is a phantom entry and a misalignment is detected. When the hit is detected, the original position of the entry that detected the hit is BR COMP IAR <0:31> + BR COMPMISALIGN HW y (where y is a halfword distance value and is an integer. This calculation is performed by y = 1). In this case, 2 is added). The erasing operation may be performed on the WAY designated by the BR COMP HIT WAY at the address position determined by this.

たまたまミスアラインを検出した命令が分岐命令であった場合、BR COMP AS TAKEN(分岐成立の場合)、あるいはBR COMP AS NOT TAKEN(分岐不成立の場合)が送られ、通常の分岐処理と同様に処理される。この場合も、ミスアラインの情報を加算したアドレスに対して更新制御を行えばよい。ミスアライン分を加算することを除けば、従来に既知の技術と同じである。   If the instruction that happens to be misaligned is a branch instruction, BR COMP AS TAKEN (if the branch is established) or BR COMP AS NOT TAKEN (if the branch is not established) is sent and processed in the same way as normal branch processing. The Also in this case, update control may be performed on the address to which the misalignment information is added. Except for adding misalignment, this is the same as a conventionally known technique.

図6の下の回路は、通常の消去条件とファントムエントリであることを示すBR COMP AS PHANTOMのいずれかが入力されたときに、ブランチヒストリのエントリを消去すべき旨を通知するBRHIS ERASE ENTRYの信号を送出する。また、どのブランチヒストリのエントリを消去するかは、図6の上の回路で計算される。BR COMP IARのアドレスを入力として、BR COMP MISALIGN HWyによって、yの値で示されるハーフワード距離分アドレスを加算器20によって入力アドレスBR COMP IARに加算して、BRHIS UPDATE IARとして出力する。   The lower circuit in FIG. 6 is a table of BRHIS ERASE ENTRY for notifying that the branch history entry should be erased when one of BR COMP AS PHANTOM indicating normal erase conditions and phantom entries is input. Send a signal. Further, which branch history entry is to be deleted is calculated by the upper circuit of FIG. The address of BR COMP IAR is input, and the address of half word distance indicated by the value of y is added to the input address BR COMP IAR by the adder 20 by BR COMP MISALGIN HWy, and output as BRHIS UPDATE IAR.

このようにして、ファントムエントリを特定し、ブランチヒストリのファントムエントリのうち、消すべきファントムエントリについての消去依頼の信号を設ける。この消去依頼信号を従来のブランチヒストリのエントリの消去依頼と同様に扱い、従来ブランチヒストリが持っているエントリの消去手段を利用してファントムエントリを消去する。   In this way, the phantom entry is specified, and an erase request signal is provided for the phantom entry to be deleted among the phantom entries in the branch history. This erasure request signal is handled in the same way as a conventional branch history entry erasure request, and the phantom entry is erased using the entry erasure means of the conventional branch history.

以上により、ファントムエントリを確実に消去できる実施形態を示した。逆に故意にファントムエントリを作成することで命令プリフェッチ効果を見いだす実施形態を以下に示す。   As described above, the embodiment in which the phantom entry can be surely deleted has been shown. Conversely, an embodiment in which an instruction prefetch effect is found by intentionally creating a phantom entry is shown below.

図7は、故意にファントムエントリを生成する構成を説明する図である。この回路は、図2のRSBR生成制御部15に設けられるものである。
命令をデコードして発行する時(IWRx Releaseによって処理の開始許可が示される)に、その命令がマイクロコードやファームウェアエミュレートされるような複雑な命令(分岐命令であっても高速に実行されない命令)あるいは、RSBRで処理されるような分岐命令ではないが命令アドレスを不連続にするような命令(ソフトウェア例外処理を発生させる命令やプログラムカウンタを直接書き換える命令など、図中IWRx CTI INST)であることが判明した場合、RSBRにはファントムエントリ相当のエントリとして生成する。ここで当該命令が故意に生成されるファントムエントリであることを識別可能なタグ(図7ではCTIフィールド)を登録しておき、これを完了時にBRHIS更新部へ通知する。また、RSBRでは、命令のアドレスの変更先を、該複雑命令の処理部から受け取るようにしておく。従って、完了時には変更先のアドレスはBR COMP TIARとしてBRHISに送られる。
FIG. 7 is a diagram illustrating a configuration for intentionally generating a phantom entry. This circuit is provided in the RSBR generation control unit 15 in FIG.
A complicated instruction (an instruction that is not executed at high speed even if it is a branch instruction) when the instruction is decoded and issued (the start of processing is indicated by IWRx Release). Or an instruction that makes the instruction address discontinuous (such as an instruction that generates software exception handling or an instruction that directly rewrites the program counter, etc.). If it is found, an entry equivalent to a phantom entry is generated in RSBR. Here, a tag (CTI field in FIG. 7) that can identify that the instruction is a phantom entry that is intentionally generated is registered, and this is notified to the BRHIIS update unit upon completion. In RSBR, the instruction address change destination is received from the processing unit of the complex instruction. Therefore, at the time of completion, the address to be changed is sent to BRHIIS as BR COMP TIAR.

図7では、分岐命令ではないが命令アドレスを不連続にする命令である(IWRx CTI inst)か、ブランチヒストリにヒットし(IWRx BRHIS Hit)、命令が分岐命令ではない場合(IWRx BRANCHの論理反転)である場合であって、IWRx Release(命令デコードが終了し、処理開始許可)が出た場合、Phantom−Validにフラグを立てる。また、ブランチヒストリにヒットしているので、Hitフラグにもフラグを立てる。また、IWRx BRANCHとIWRx Releaseが入力されている場合には、エントリが有効であるとしてValidフラグを立てる。   In FIG. 7, when the instruction is not a branch instruction but makes the instruction address discontinuous (IWRx CTI inst) or hits the branch history (IWRx BRHIS Hit) and the instruction is not a branch instruction (logical inversion of IWRx BRANCH) ), And when IWRx Release (instruction decoding ends and processing start permission) is issued, a flag is set in Phantom-Valid. Since the branch history is hit, the Hit flag is also flagged. When IWRx BRANCH and IWRx Release are input, the Valid flag is set as the entry is valid.

図8は、故意にファントムエントリを生成する場合のBRHISの更新信号の生成回路例を示す図である。図8の回路は、図2のBRHIS更新制御部18に設けられる。
BRHIS更新制御部18においては、該タグ付きのBR COMP AS PHANTOM通知が来た場合には消去をせず、通常の分岐予測情報更新と同じ様な動作、すなわち、既にエントリが存在して(BRHIS Hit)いれば必要に応じて更新、エントリが存在しなければ(Not hit)新規エントリ生成を行う。エントリの作成/更新に用いられる分岐先アドレスはRSBRから送られるBR COMP TIARを使う等他の制御は従来技術と同様になる。
FIG. 8 is a diagram illustrating an example of a BRHIS update signal generation circuit when a phantom entry is intentionally generated. The circuit of FIG. 8 is provided in the BRHIIS update control unit 18 of FIG.
When the BR COMP AS PHANTOM notification with the tag is received, the BRHIS update control unit 18 does not delete the same operation as the normal branch prediction information update, that is, the entry already exists (BRHIS If it is “Hit”, it is updated as necessary, and if there is no entry (Not hit), a new entry is generated. Other controls such as the use of the BR COMP TIAR sent from the RSBR as the branch destination address used for creating / updating the entry are the same as in the prior art.

図8においては、ブランチヒストリのエントリがファントムエントリであり(BR COMP AS PHANTOM)、分岐命令である場合には(BR COMP CTI INSTの反転論理)、通常の消去条件と同様に、ブランチヒストリのエントリを消去する命令(BRHIS ERASE ENTRY)を出力する。また、エントリがファントムエントリであり(BR COMP AS PHANTOM)、分岐命令でない(BR COMP CTI INST)の場合であって、ブランチヒストリにヒットしていない(BR COMP BRHIS HITの反転論理)には、通常の新規エントリの生成条件と共に、故意にファントムエントリを生成する旨の指示(BRHIS CREATE NEW ENTRY)を出す。また、ブランチヒストリにヒットし、エントリがファントムであり、分岐命令でない場合には、そのファントムエントリを維持すべき命令(BRHIS UPDATE OLD ENTRY)を出力する。   In FIG. 8, if the branch history entry is a phantom entry (BR COMP AS PHANTOM) and a branch instruction (inverted logic of BR COMP CTI INST), the branch history entry is the same as the normal erase condition. A command (BRHIS ERASE ENTRY) for erasing data is output. Also, if the entry is a phantom entry (BR COMP AS PHANTOM) and not a branch instruction (BR COMP CTI INST), the branch history is not hit (inverted logic of BR COMP BRHIS HIT). An instruction to intentionally generate a phantom entry (BRHIS CREATE NEW ENTRY) is issued together with the new entry generation condition. If the branch history is hit and the entry is a phantom and it is not a branch instruction, an instruction (BRHIS UPDATE OLD ENTRY) to maintain the phantom entry is output.

このようにすると、次回当該命令アドレスに対応する命令フェッチ時に、当該エントリが読み出されて分岐予測命令フェッチが行われるようになる。たとえ、これが実行部で即座に使うことができなくとも、命令プリフェッチができることでキャッシュに対してプリフェッチ要求相当の動作になるため、性能改善効果がある。   In this way, at the next instruction fetch corresponding to the instruction address, the entry is read and a branch prediction instruction fetch is performed. Even if this cannot be used immediately in the execution unit, since the instruction prefetch can be performed, an operation equivalent to a prefetch request is made to the cache, which has a performance improvement effect.

(付記1)分岐予測機構を有する情報処理装置において、
分岐予測を行った対象の命令が分岐命令であるか否かを判断する判断手段と、該分岐予測を行った対象の命令が分岐命令でないと判断された場合に、前記分岐予測機構に格納される該命令に対応する分岐予測のためのエントリを削除するファントム削除手段と、
を備えることを特徴とする情報処理装置。
(付記2)分岐予測機構を有する情報処理装置において、
命令を切り出し、実行のために格納するキュー手段と、
該キュー手段に格納される命令について分岐予測を行った場合、該分岐予測を行ったアドレス位置が該キュー手段に格納された命令語の境界にあるか否かを検出する検出手段と、
該分岐予測を行ったアドレス位置が命令語の境界にないと判断された場合には、該分岐予測を行う基となった、分岐予測機構に格納される分岐予測のためのエントリを削除するミスアライン削除手段と、
を備えることを特徴とする情報処理装置。
(付記3)分岐予測を行おうとする命令のアドレス位置が実際の命令境界位置と異なる位置であることが判明した場合、分岐処理を行う機構において、該境界位置からの位置を特定する特定情報を保持し、該特定情報を用いて分岐予測機構の有する分岐予測のためのエントリを削除することを特徴とする付記2に記載の情報処理装置。
(付記4)分岐予測機構を有する情報処理装置において、
分岐命令であっても高速に実行されない命令、あるいは、分岐命令ではないが、命令シーケンスを不連続にする命令を検出するファントム対象命令検出手段と、
該ファントム対象命令検出手段が検出した命令に対応するエントリを、分岐予測機構に格納される分岐予測のためのエントリに生成して加えるファントムエントリ生成手段とを備え、
分岐予測のためのエントリを用いて命令プリフェッチを行うことによって命令の高速処理を実現することを特徴とする情報処理装置。
(付記5)分岐予測機構を有する情報処理装置における分岐予測のためのエントリの内の不要なエントリの削除方法であって、
分岐予測を行った対象の命令が分岐命令であるか否かを判断する判断ステップと、
該分岐予測を行った対象の命令が分岐命令でないと判断された場合に、前記分岐予測機構に格納される該命令に対応する分岐予測のためのエントリを削除するファントム削除ステップと、
を備えることを特徴とする方法。
(付記6)分岐予測機構を有する情報処理装置における分岐予測のためのエントリの内の不要なエントリを削除する方法であって、
命令セットを切り出し、実行のために格納するキューステップと、
該キューステップにおいて格納された命令について分岐予測を行った場合、該分岐予測を行ったアドレス位置が該キューステップにおいて格納された命令語の境界にあるか否かを検出する検出ステップと、
該分岐予測を行ったアドレス位置が命令語の境界にないと判断された場合には、該分岐予測を行う基となった、分岐予測機構に格納される分岐予測のためのエントリを削除するミスアライン削除ステップと、
を備えることを特徴とする方法。
(付記7)分岐予測を行おうとする命令のアドレス位置が実際の命令境界位置と異なる位置であることが判明した場合、分岐処理を行う機構において、該境界位置からのオフセット情報を記憶しておき、該オフセット情報を用いて分岐予測機構の有する分岐予測のためのエントリを削除することを特徴とする付記6に記載の方法。
(付記8)分岐予測機構を有する情報処理装置における命令の高速処理のための方法であって、
分岐命令であっても高速に実行されない命令、あるいは、分岐命令ではないが、命令シーケンスを不連続にする命令を検出するファントム対象命令検出ステップと、
該ファントム対象命令検出手段が検出した命令に対応するエントリを、分岐予測機構に格納される分岐予測のためのエントリに生成して加えるファントムエントリ生成ステップとを備え、
分岐予測のためのエントリを用いて命令プリフェッチを行うことによって命令の高速処理を実現することを特徴とする方法。
(Supplementary note 1) In an information processing apparatus having a branch prediction mechanism,
Stored in the branch prediction mechanism when it is determined that the target instruction for which branch prediction has been performed is a branch instruction, and when it is determined that the target instruction for which branch prediction has been performed is not a branch instruction Phantom deletion means for deleting an entry for branch prediction corresponding to the instruction,
An information processing apparatus comprising:
(Supplementary Note 2) In an information processing apparatus having a branch prediction mechanism,
Cue means for cutting out instructions and storing them for execution;
When branch prediction is performed for an instruction stored in the queue means, detection means for detecting whether the address position where the branch prediction is performed is at the boundary of the instruction word stored in the queue means;
A misalignment that deletes an entry for branch prediction stored in the branch prediction mechanism, which is a basis for performing the branch prediction, when it is determined that the address position where the branch prediction has been performed is not at the instruction word boundary Delete means,
An information processing apparatus comprising:
(Supplementary Note 3) When it is found that the address position of the instruction to be branch-predicted is different from the actual instruction boundary position, in the mechanism that performs the branch processing, specific information for specifying the position from the boundary position is The information processing apparatus according to appendix 2, wherein the information is stored and the entry for branch prediction included in the branch prediction mechanism is deleted using the specific information.
(Supplementary Note 4) In an information processing apparatus having a branch prediction mechanism,
A phantom target instruction detection means for detecting an instruction that is not executed at high speed even if it is a branch instruction, or an instruction that is not a branch instruction but makes the instruction sequence discontinuous;
Phantom entry generation means for generating and adding an entry corresponding to the instruction detected by the phantom target instruction detection means to an entry for branch prediction stored in the branch prediction mechanism;
An information processing apparatus that realizes high-speed instruction processing by performing instruction prefetch using an entry for branch prediction.
(Supplementary Note 5) A method for deleting an unnecessary entry among entries for branch prediction in an information processing apparatus having a branch prediction mechanism,
A determination step of determining whether or not the target instruction for which branch prediction has been performed is a branch instruction;
A phantom deletion step of deleting an entry for branch prediction corresponding to the instruction stored in the branch prediction mechanism when it is determined that the instruction subjected to the branch prediction is not a branch instruction;
A method comprising the steps of:
(Supplementary note 6) A method of deleting an unnecessary entry among entries for branch prediction in an information processing apparatus having a branch prediction mechanism,
A cue step to cut out the instruction set and store it for execution;
A detection step for detecting whether or not the address position where the branch prediction is performed is at the boundary of the instruction word stored in the queue step when branch prediction is performed for the instruction stored in the queue step;
A misalignment that deletes an entry for branch prediction stored in the branch prediction mechanism, which is a basis for performing the branch prediction, when it is determined that the address position where the branch prediction has been performed is not at the instruction word boundary Delete step,
A method comprising the steps of:
(Supplementary note 7) When it is found that the address position of the instruction to be branched is different from the actual instruction boundary position, the mechanism for performing the branch process stores offset information from the boundary position. The method according to appendix 6, wherein an entry for branch prediction included in the branch prediction mechanism is deleted using the offset information.
(Supplementary note 8) A method for high-speed instruction processing in an information processing apparatus having a branch prediction mechanism,
A phantom target instruction detection step for detecting an instruction that is not executed at high speed even if it is a branch instruction, or an instruction that is not a branch instruction but makes the instruction sequence discontinuous;
A phantom entry generation step of generating and adding an entry corresponding to the instruction detected by the phantom target instruction detection means to an entry for branch prediction stored in the branch prediction mechanism;
A method for realizing high-speed processing of an instruction by performing an instruction prefetch using an entry for branch prediction.

命令境界でないところで分岐予測が生じる場合について説明する図である。It is a figure explaining the case where branch prediction arises in the place which is not an instruction boundary. 本発明の実施形態における情報処理装置の概略を示す図である。It is a figure which shows the outline of the information processing apparatus in embodiment of this invention. BRHIS−HitとHit−Offset(MISALIGN Half−Word)の生成回路例を示す図である。It is a figure which shows the example of a production | generation circuit of BRHIS-Hit and Hit-Offset (MISALIGN Half-Word). 分岐命令とファントムの実行制御キューRSBRの構成例を示す図である。It is a figure which shows the example of a structure of the branch instruction and the phantom execution control queue RSBR. 分岐実行完了の報告を行うための動作を説明する図である。It is a figure explaining the operation | movement for reporting a branch execution completion. エントリ消去のための指示信号を生成する回路例を示す図である。It is a figure which shows the example of a circuit which produces | generates the instruction | indication signal for entry deletion. 故意にファントムエントリを生成する構成を説明する図である。It is a figure explaining the structure which produces | generates a phantom entry intentionally. 故意にファントムエントリを生成する場合のBRHISの更新信号の生成回路例を示す図である。It is a figure which shows the example of a production | generation circuit of the update signal of BRHIIS when producing | generating a phantom entry intentionally. ファントムエントリが生じる仕組みを概略説明する図である。It is a figure which illustrates roughly the mechanism in which a phantom entry arises.

符号の説明Explanation of symbols

10 IF−EAG フェッチアドレス生成部
11 BRHIS 分岐予測部
12 I−CACHE 命令キャッシュ
13 命令投入制御部
14 IWRs 命令解読部
15 RSBR生成制御部
16 分岐処理部 RSBRs
17 分岐完了制御部
18 BRHIS更新制御部
20 加算器
10 IF-EAG fetch address generation unit 11 BRHIIS branch prediction unit 12 I-CACHE instruction cache 13 instruction input control unit 14 IWRs instruction decoding unit 15 RSBR generation control unit 16 branch processing unit RSBRs
17 Branch completion control unit 18 BRHIIS update control unit 20 Adder

Claims (4)

分岐予測のためのエントリを格納する分岐予測手段を有する命令制御装置において、
分岐命令ではないが実行されることにより、後続の命令アドレスの変更を行う特定命令を検出する特定命令検出手段と、
命令の命令制御情報を格納する命令キュー手段と、
前記命令キュー手段に格納される命令制御情報の生成を行う命令キュー生成制御手段を有し、
前記特定命令検出手段により特定命令が検出された場合には、前記特定命令を分岐命令であるとみなして、前記命令キュー生成制御手段により前記命令が特定命令であることを識別するための情報を前記命令キュー手段に格納し、
前記特定命令が実行された場合に、前記特定命令の実行により変更された後続命令のアドレスを前記分岐予測手段にエントリとして格納する変更アドレス登録手段とを有することを特徴とする命令制御装置。
In an instruction control device having branch prediction means for storing an entry for branch prediction,
A specific instruction detecting means for detecting a specific instruction for changing a subsequent instruction address by being executed although it is not a branch instruction;
Instruction queue means for storing instruction control information of instructions;
Having instruction queue generation control means for generating instruction control information stored in the instruction queue means;
When the specific instruction is detected by the specific instruction detection unit, the specific instruction is regarded as a branch instruction, and information for identifying the instruction is a specific instruction by the instruction queue generation control unit Storing in the instruction queue means;
An instruction control apparatus comprising: a changed address registering unit that stores an address of a subsequent instruction changed by execution of the specified instruction as an entry in the branch predicting unit when the specified instruction is executed.
前記命令制御装置は、前記エントリを使用して、命令プリフェッチを行うことを特徴とする請求項1に記載の命令制御装置。   The instruction control apparatus according to claim 1, wherein the instruction control apparatus performs instruction prefetch using the entry. 分岐予測のためのエントリを格納するブランチヒストリを有する命令制御装置の命令制御方法において、
分岐命令ではないが実行されることにより、後続の命令アドレスの変更を行う特定命令を検出する特定命令検出ステップと、
前記特定命令検出ステップにおいて、特定命令が検出された場合には、前記特定命令を分岐命令であるとみなして、前記命令が特定命令であることを識別するための情報を前記命令キューに格納する特定命令キュー格納ステップと、
前記特定命令が実行された場合に、前記特定命令の実行により変更された後続命令のアドレスを前記ブランチヒストリに登録する変更アドレス登録ステップとを有することを特徴とする命令制御方法。
In an instruction control method of an instruction control apparatus having a branch history for storing an entry for branch prediction,
A specific instruction detection step for detecting a specific instruction for changing a subsequent instruction address by being executed, although not a branch instruction;
In the specific instruction detection step, when a specific instruction is detected, the specific instruction is regarded as a branch instruction, and information for identifying that the instruction is a specific instruction is stored in the instruction queue. A specific instruction queue storage step;
An instruction control method comprising: a change address registration step of registering, in the branch history, an address of a subsequent instruction changed by execution of the specific instruction when the specific instruction is executed.
前記命令制御方法は、前記エントリを使用して、命令プリフェッチを行うことを特徴とする請求項3に記載の命令制御方法。   The instruction control method according to claim 3, wherein the instruction prefetch is performed using the entry.
JP2006193265A 2006-07-13 2006-07-13 Information processing apparatus having branch prediction mechanism Expired - Fee Related JP4113227B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006193265A JP4113227B2 (en) 2006-07-13 2006-07-13 Information processing apparatus having branch prediction mechanism

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006193265A JP4113227B2 (en) 2006-07-13 2006-07-13 Information processing apparatus having branch prediction mechanism

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2002191433A Division JP3843048B2 (en) 2002-06-28 2002-06-28 Information processing apparatus having branch prediction mechanism

Publications (2)

Publication Number Publication Date
JP2006277774A true JP2006277774A (en) 2006-10-12
JP4113227B2 JP4113227B2 (en) 2008-07-09

Family

ID=37212399

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006193265A Expired - Fee Related JP4113227B2 (en) 2006-07-13 2006-07-13 Information processing apparatus having branch prediction mechanism

Country Status (1)

Country Link
JP (1) JP4113227B2 (en)

Also Published As

Publication number Publication date
JP4113227B2 (en) 2008-07-09

Similar Documents

Publication Publication Date Title
JP3542020B2 (en) Processor device and processor control method for executing instruction cache processing for instruction fetch alignment over multiple predictive branch instructions
JP5198879B2 (en) Suppress branch history register updates by branching at the end of the loop
JP2875909B2 (en) Parallel processing unit
JP4027620B2 (en) Branch prediction apparatus, processor, and branch prediction method
US7478228B2 (en) Apparatus for generating return address predictions for implicit and explicit subroutine calls
US20110320787A1 (en) Indirect Branch Hint
KR20080023723A (en) A method and apparatus for predicting branch instructions
JP6796717B2 (en) Branch target buffer compression
US11099849B2 (en) Method for reducing fetch cycles for return-type instructions
US20040117606A1 (en) Method and apparatus for dynamically conditioning statically produced load speculation and prefetches using runtime information
KR20080102251A (en) Method and apparatus for repairing a link stack
JP3486690B2 (en) Pipeline processor
US20060149949A1 (en) Data processing device with branch prediction mechanism
US8909907B2 (en) Reducing branch prediction latency using a branch target buffer with a most recently used column prediction
US20040225866A1 (en) Branch prediction in a data processing system
US20030204705A1 (en) Prediction of branch instructions in a data processing apparatus
US20080172547A1 (en) Reusing a buffer memory as a microcache for program instructions of a detected program loop
US10922082B2 (en) Branch predictor
JP3683439B2 (en) Information processing apparatus and method for suppressing branch prediction
US7603545B2 (en) Instruction control method and processor to process instructions by out-of-order processing using delay instructions for branching
US11397685B1 (en) Storing prediction entries and stream entries where each stream entry includes a stream identifier and a plurality of sequential way predictions
JP4113227B2 (en) Information processing apparatus having branch prediction mechanism
US20050154859A1 (en) Branch prediction in a data processing apparatus
US20060015706A1 (en) TLB correlated branch predictor and method for use thereof
US20090070569A1 (en) Branch prediction device,branch prediction method, and microprocessor

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060713

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20070201

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070213

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070411

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20070529

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070730

A911 Transfer of reconsideration by examiner before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20070806

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20080304

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20080307

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: 20080408

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20080410

R150 Certificate of patent (=grant) or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110418

Year of fee payment: 3

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110418

Year of fee payment: 3

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120418

Year of fee payment: 4

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130418

Year of fee payment: 5

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140418

Year of fee payment: 6

LAPS Cancellation because of no payment of annual fees