JP3473249B2 - Central processing unit - Google Patents
Central processing unitInfo
- Publication number
- JP3473249B2 JP3473249B2 JP05132296A JP5132296A JP3473249B2 JP 3473249 B2 JP3473249 B2 JP 3473249B2 JP 05132296 A JP05132296 A JP 05132296A JP 5132296 A JP5132296 A JP 5132296A JP 3473249 B2 JP3473249 B2 JP 3473249B2
- Authority
- JP
- Japan
- Prior art keywords
- read
- buffer
- write
- branch prediction
- entry
- 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
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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】[0001]
【発明の属する技術分野】本発明は計算機の中央処理装
置に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a central processing unit of a computer.
【0002】[0002]
【従来の技術】近年、中央処理装置の高速化のためにパ
イプライン方式が不可欠な技術となっている。パイプラ
イン方式では、中央処理装置で処理する命令を、例え
ば、命令読みだし,命令解読,実行,結果のレジスタへ
の書き込みというようにステージに分割し、命令1の結
果のレジスタへの書き込み,命令2の実行,命令3の命
令解読,命令4の命令読みだしを並列に処理することで
命令当たりの処理速度を高速化する。2. Description of the Related Art In recent years, a pipeline system has become an indispensable technique for increasing the speed of a central processing unit. In the pipeline method, an instruction processed by the central processing unit is divided into stages such as instruction reading, instruction decoding, execution, and writing of a result to a register, and writing of a result of instruction 1 to a register and an instruction. By executing the execution of 2, the decoding of the instruction 3, and the reading of the instruction 4 in parallel, the processing speed per instruction is increased.
【0003】パイプライン方式では、このようにアドレ
スの連続する命令列の実行は並列に処理することができ
る。一方、命令列中に条件分岐命令が存在する場合およ
び分岐先アドレスの計算が必要な分岐命令が存在する場
合、分岐命令実行の結果次命令のアドレスが決定した
後、次命令の命令読みだしが行われる。このため、命令
列中にこれらの分岐命令が存在するとパイプラインの命
令解読,実行,結果の書き込みのステージに空きができ
るため、処理速度が低下する。In the pipeline system, the execution of the instruction sequence having continuous addresses can be processed in parallel. On the other hand, if there is a conditional branch instruction in the instruction sequence or if there is a branch instruction that requires calculation of the branch destination address, the instruction read of the next instruction will occur after the address of the next instruction is determined as a result of branch instruction execution. Done. Therefore, if these branch instructions exist in the instruction sequence, there is a space in the pipeline instruction decoding, execution, and result writing stages, and the processing speed decreases.
【0004】分岐命令の実行待ちによる処理速度の低下
を防ぐために、分岐予測が多く用いられる。分岐予測
は、分岐命令を読みだした時に次の命令のアドレスを予
測し、分岐命令の結果を待たずに予測したアドレスから
続けて命令をパイプラインに投入する。これを投機実行
と呼ぶ。処理が進んで分岐命令実行の結果、分岐命令の
次命令のアドレスが決定した時点で分岐予測が正しかっ
た場合、そのまま命令の実行を続ける。分岐予測が誤っ
ていた場合投機実行中の命令を全て破棄し、正しいアド
レスから分岐命令以降の読みだしを再開する。このた
め、分岐予測が正しい場合には、分岐命令の実行待ちに
より処理速度が低下することを回避できる。Branch prediction is often used in order to prevent a decrease in processing speed due to waiting for execution of a branch instruction. In the branch prediction, the address of the next instruction is predicted when the branch instruction is read, and the instruction is continuously input to the pipeline from the predicted address without waiting for the result of the branch instruction. This is called speculative execution. If the branch prediction is correct at the time when the address of the instruction next to the branch instruction is determined as a result of the progress of processing and execution of the branch instruction, execution of the instruction is continued as it is. If the branch prediction is incorrect, all the speculatively executed instructions are discarded, and reading from the correct branch address is resumed. Therefore, when the branch prediction is correct, it is possible to avoid a decrease in processing speed due to waiting for execution of a branch instruction.
【0005】従来の中央処理装置では、投機実行中の命
令列に読みだし命令または書き込み命令がある場合、こ
れらの命令の投機実行は行われていなかった。これに該
当する中央処理装置は、文献“PowerPC601 ユーザーズ
マニュアル”に示されるように、PowerPC601が挙げられ
る。In the conventional central processing unit, if a read instruction or a write instruction is included in an instruction sequence during speculative execution, speculative execution of these instructions has not been performed. As a central processing unit corresponding to this, as shown in the document “PowerPC601 User's Manual”, the PowerPC601 is cited.
【0006】[0006]
【発明が解決しようとする課題】従来技術で、条件分岐
命令以降に読みだし命令または書き込み命令が実行され
る場合、条件分岐命令以降の読みだし命令または書き込
み命令は投機実行されず、処理速度が低下する。In the prior art, when a read instruction or a write instruction is executed after the conditional branch instruction, the read instruction or the write instruction after the conditional branch instruction is not speculatively executed and the processing speed is high. descend.
【0007】本発明の目的は、投機実行した読みだし命
令の結果を破棄可能として読みだし命令を投機実行可能
とし、さらに分岐予測を誤って実行した読みだし命令の
結果を後続の同一アドレスへの読みだし命令で利用可能
とし、読みだし時間を短縮することで中央処理装置の処
理速度を向上することにある。An object of the present invention is to make the result of a speculatively executed read instruction discardable so that a read instruction can be speculatively executed, and to further forward the result of a read instruction in which branch prediction is erroneously executed to the same subsequent address. The purpose is to improve the processing speed of the central processing unit by making it available for read commands and shortening the read time.
【0008】[0008]
【課題を解決するための手段】1以上の分岐ユニット
と、1以上の主記憶読みだし要求を格納する読みだしバ
ッファと1以上の主記憶書き込み要求を格納する書き込
みバッファを具備する1以上の主記憶アクセスユニット
と、分岐予測回路と、記憶制御回路を具備する中央処理
装置で、前記読みだしバッファには、各読みだしバッフ
ァエントリ毎にエントリ有効フラグと、1以上の分岐予
測の結果実行されると判断された場合に各分岐予測の方
向を特定するための分岐予測フィールドと、前記エント
リが分岐予測の誤りにより実行されないことを示す分岐
予測誤りフラグと、読みだしアドレスフィールドと、読
みだしデータフィールドと、読みだし完了フラグを設け
る。One or more main units having one or more branch units, a read buffer for storing one or more main memory read requests, and a write buffer for storing one or more main memory write requests. A central processing unit including a storage access unit, a branch prediction circuit, and a storage control circuit, wherein the read buffer is executed with an entry valid flag for each read buffer entry and one or more branch prediction results. Branch prediction field for specifying the direction of each branch prediction, a branch prediction error flag indicating that the entry is not executed due to an error in branch prediction, a read address field, and a read data field And a read completion flag is set.
【0009】これにより、分岐実行結果が得られた時に
全読みだしバッファの分岐予測フィールドと分岐実行結
果を比較して、分岐予測を誤った読みだしバッファエン
トリを特定することができ、読みだし命令の投機実行が
可能となる。As a result, when the branch execution result is obtained, the branch prediction field of the full read buffer is compared with the branch execution result, and the read buffer entry with the wrong branch prediction can be specified. It is possible to execute the speculation.
【0010】さらに、分岐予測を誤った場合にも、投機
実行中の読みだし命令は破棄するが、読みだしバッファ
エントリのエントリ有効フラグを有効のまま分岐予測誤
りフラグを誤りと設定することで、読みだし要求および
主記憶読みだしデータを読みだしバッファ内に保持す
る。Further, even if the branch prediction is erroneous, the read instruction being speculatively executed is discarded, but the branch prediction error flag is set to an error while the entry valid flag of the read buffer entry remains valid. The read request and main memory read data are held in the read buffer.
【0011】以後、正しいアドレスから実行が再開され
た後、読みだしバッファエントリと同一アドレスへの読
みだし命令が実行された場合、読みだしバッファエント
リに格納されている主記憶読みだしデータを使用して読
みだし時間を短縮し、中央処理装置の処理速度を向上す
る。After that, when the read instruction to the same address as the read buffer entry is executed after the execution is restarted from the correct address, the main memory read data stored in the read buffer entry is used. The reading time is shortened and the processing speed of the central processing unit is improved.
【0012】[0012]
〈実施例1〉以下に本発明の第1の実施例について説明
する。図1は本発明の中央処理装置を示す。<First Embodiment> A first embodiment of the present invention will be described below. FIG. 1 shows the central processing unit of the present invention.
【0013】図1で中央処理装置は、記憶制御回路10
0,分岐予測回路110,命令発行回路120,レジス
タファイル130,演算ユニット140,分岐ユニット
150,主記憶アクセスユニット160,書き込みバッフ
ァ170,読みだしバッファ180,リオーダバッファ
190からなる。In FIG. 1, the central processing unit is a storage control circuit 10
0, branch prediction circuit 110, instruction issuing circuit 120, register file 130, arithmetic unit 140, branch unit
150, a main memory access unit 160, a write buffer 170, a read buffer 180, and a reorder buffer 190.
【0014】記憶制御回路100は、分岐予測回路11
0より指示される命令の読みだし、および書き込みバッ
ファ170内のデータの書き込み、読みだしバッファ1
80で指示されるデータの読みだしをバス102を通し
て中央処理装置外部に発行し、また、読みだし結果をバ
ス102を通して中央処理装置内部に受け取る。記憶制
御回路100にキャッシュメモリを持たせる方式も考え
られるが、本実施例ではキャッシュメモリは設けていな
い。しかし、本発明はキャッシュメモリの有無に関係な
く実施できる。The storage control circuit 100 includes a branch prediction circuit 11
Instruction read from 0, writing of data in write buffer 170, read buffer 1
The reading of the data designated by 80 is issued to the outside of the central processing unit through the bus 102, and the reading result is received inside the central processing unit through the bus 102. A method of providing the storage control circuit 100 with a cache memory is also conceivable, but no cache memory is provided in this embodiment. However, the present invention can be implemented with or without a cache memory.
【0015】分岐予測回路110は、読みだした命令が
分岐命令である場合に次命令のアドレスを予測し、記憶
制御回路100に命令読みだしを要求する。読みだした
命令が分岐命令以外の場合、命令アドレスをインクリメ
ントし、記憶制御回路100に命令読みだしを要求す
る。分岐予測は、種々の方法が提案されているが、本発
明は分岐予測の方法に関らず実施できる。When the read instruction is a branch instruction, the branch prediction circuit 110 predicts the address of the next instruction and requests the storage control circuit 100 to read the instruction. When the read instruction is other than the branch instruction, the instruction address is incremented and the storage control circuit 100 is requested to read the instruction. Although various methods have been proposed for branch prediction, the present invention can be implemented regardless of the method of branch prediction.
【0016】命令発行回路120は、読みだした命令を
解読し、命令の種類に応じて演算ユニット140,分岐
ユニット150,主記憶アクセスユニット160のいず
れかに命令を発行する。この時、分岐予測により命令を
投機実行している場合、分岐予測の方向を示すデータを
付加する。本発明では一例として、分岐予測方向を2ビ
ットで表す。分岐予測データが“00”の場合、投機実
行中ではなく、当該命令は必ず実行されることを示す。
分岐予測データが“10”の場合、投機実行中であり、
分岐を行わないと予測したことを示す。分岐予測データ
が“11”の場合、投機実行中であり、分岐を行うと予
測したことを示す。The instruction issuing circuit 120 decodes the read instruction and issues the instruction to any of the arithmetic unit 140, the branch unit 150 and the main memory access unit 160 depending on the type of the instruction. At this time, if the instruction is speculatively executed by branch prediction, data indicating the direction of branch prediction is added. In the present invention, as an example, the branch prediction direction is represented by 2 bits. When the branch prediction data is "00", it indicates that the speculative execution is not being executed and the instruction is always executed.
If the branch prediction data is “10”, speculation is in progress,
Indicates that the branch was predicted not to be taken. When the branch prediction data is “11”, it indicates that the speculative execution is in progress and it is predicted to branch.
【0017】演算ユニット140は、命令発行回路12
0から受けた演算命令を実行し、演算結果をリオーダバ
ッファ190に格納する。The arithmetic unit 140 includes an instruction issuing circuit 12
The operation instruction received from 0 is executed, and the operation result is stored in the reorder buffer 190.
【0018】主記憶アクセスユニット160は、命令発
行回路120から受けた読みだし命令または書き込み命
令をそれぞれ読みだしバッファ180,書き込みバッフ
ァ170に登録し、読みだし結果をリオーダバッファ1
90に格納する。The main memory access unit 160 registers the read command or the write command received from the command issuing circuit 120 in the read buffer 180 and the write buffer 170, respectively, and the read result is stored in the reorder buffer 1
Store in 90.
【0019】リオーダバッファ190は、演算ユニット
140から受けた演算結果または主記憶アクセスユニッ
ト160から受けた読みだし結果を一旦格納し、レジス
タファイル130に送る。投機実行した命令について
は、分岐ユニット150から分岐実行結果を得て、分岐
予測が正しかった場合は投機実行した命令の結果をレジ
スタファイル130に送るが、分岐予測が誤っていた場
合は投機実行した命令の結果を破棄する。Reorder buffer 190 temporarily stores the operation result received from operation unit 140 or the read result received from main memory access unit 160, and sends it to register file 130. For the speculatively executed instruction, the branch execution result is obtained from the branch unit 150, and if the branch prediction is correct, the result of the speculatively executed instruction is sent to the register file 130, but if the branch prediction is incorrect, the speculative execution is executed. Discard the result of the instruction.
【0020】分岐ユニット150は、命令発行回路12
0から受けた分岐命令を実行する。分岐命令が条件分岐
命令であった場合、分岐実行の結果をリオーダバッファ
190,書き込みバッファ170,読みだしバッファ18
0に送る。The branch unit 150 includes the instruction issuing circuit 12
The branch instruction received from 0 is executed. If the branch instruction is a conditional branch instruction, the result of branch execution is reordered in the buffer.
190, write buffer 170, read buffer 18
Send to 0.
【0021】書き込みバッファ170は、書き込み命令
のアドレス,データおよび分岐予測結果を保持し、記憶
制御回路100に書き込み命令を発行する。投機実行し
た命令の場合、分岐ユニット150から分岐実行結果を
得るまで待ち、分岐予測が正しかった場合に記憶制御回
路100に書き込み命令を発行する。一方、分岐予測が
誤っていた場合には書き込み命令を破棄する。The write buffer 170 holds the address, data and branch prediction result of the write instruction and issues the write instruction to the storage control circuit 100. In the case of the speculatively executed instruction, it waits until the branch execution result is obtained from the branch unit 150, and if the branch prediction is correct, issues a write instruction to the storage control circuit 100. On the other hand, if the branch prediction is incorrect, the write instruction is discarded.
【0022】書き込みバッファ170は、エントリ毎に
書き込み要求の有効を示すエントリ有効フラグ170
a,書き込み命令の分岐予測データを格納する分岐予測
フィールド170b,書き込みアドレスフィールド17
0c,書き込みデータフィールド170dのフィールド
を持つ。The write buffer 170 has an entry valid flag 170 indicating the validity of the write request for each entry.
a, a branch prediction field 170b for storing branch prediction data of a write instruction, and a write address field 17
0c, and a write data field 170d.
【0023】書き込みバッファ170に関する処理は、
以下に示す種類が存在する。The processing relating to the write buffer 170 is as follows.
There are the following types.
【0024】(書き込み発行処理)書き込みバッファ1
70は、主記憶アクセスユニット160から、書き込み
アドレス,分岐予測データおよび書き込みデータを受信
し、以下に示す書き込み命令の発行を行う。(Write Issue Process) Write Buffer 1
70 receives the write address, the branch prediction data, and the write data from the main memory access unit 160, and issues the write command shown below.
【0025】(1)エントリ有効フラグ170aが
“0”の書き込みバッファエントリが存在する場合、書
き込みアドレスおよび書き込みデータを書き込みバッフ
ァエントリの書き込みアドレスフィールド170cおよ
び書き込みデータフィールド170dに書き込み、エントリ
有効フラグ170aを“1”とする。(1) When there is a write buffer entry having the entry valid flag 170a of "0", the write address and write data are written in the write address field 170c and the write data field 170d of the write buffer entry, and the entry valid flag 170a is set. Set to "1".
【0026】(2)エントリ有効フラグ170aが
“0”の書き込みバッファエントリが存在しない場合、
(1)が実行できるまで新たな書き込み発行処理を受け
付けず待つ。(2) When there is no write buffer entry having the entry valid flag 170a of "0",
Wait until (1) can be executed without accepting new write issue processing.
【0027】(主記憶アクセス発行処理)エントリ有効
フラグ170aが“1”かつ分岐予測フィールド170
bが“00”の書き込みバッファエントリについて、主
記憶制御回路に書き込みアドレスおよび書き込みデータ
を与え、主記憶書き込みを発行する。主記憶書き込み
は、書き込みバッファ170への登録順に従って行う。
この後、エントリ有効フラグ170aを“0”とする。(Main memory access issue processing) The entry valid flag 170a is "1" and the branch prediction field 170
For the write buffer entry in which b is "00", a write address and write data are given to the main memory control circuit, and main memory write is issued. Main memory writing is performed in the order of registration in the write buffer 170.
After that, the entry valid flag 170a is set to "0".
【0028】(分岐結果処理)分岐ユニット150から
分岐結果データを受けて、分岐結果を受信する。分岐結
果の受信時には、以下の処理を行う。(Branch Result Processing) Branch result data is received from the branch unit 150 and the branch result is received. The following processing is performed when the branch result is received.
【0029】(1)エントリ有効フラグが“1”かつ、
分岐予測フィールド170bが“00”でなく、分岐予測
フィールド170bと分岐結果データが一致する全ての
書き込みバッファエントリで、分岐予測フィールド17
0bを“00”とする。(1) The entry valid flag is "1" and
The branch prediction field 170b is not "00", and the branch prediction field 17b is the same as the branch prediction field 170b in all write buffer entries.
0b is set to "00".
【0030】(2)エントリ有効フラグが“1”かつ、
分岐予測フィールド170bが“00”でなく、分岐予測
フィールド170bと分岐結果データが一致しない全て
の書き込みバッファエントリで、エントリ有効フラグ1
70aを“0”とする。(2) The entry valid flag is "1" and
If the branch prediction field 170b is not “00” and the branch prediction field 170b and the branch result data do not match, the entry valid flag 1 is set in all the write buffer entries.
70a is set to "0".
【0031】読みだしバッファ180は、エントリ毎に
読みだし要求の有効を示すエントリ有効フラグ180
a,読みだし命令の分岐予測データを格納する分岐予測
フィールド180b,読みだし命令に対応する分岐予測
の誤りを示す分岐予測誤りフラグ180c,読みだしア
ドレスフィールド180d,主記憶の読みだしが完了し
たことを示す読みだし完了フラグ180e,主記憶読み
だし結果を一旦保持する読みだしデータフィールド18
0f,主記憶読みだし結果を書き込むレジスタ番号を示
すレジスタフィールド180g,後続の読みだし命令が
当該エントリのデータを使うことを許可する読みだし許
可フラグ180hのフィールドを持つ。The read buffer 180 has an entry valid flag 180 indicating the validity of the read request for each entry.
a, a branch prediction field 180b for storing the branch prediction data of the read instruction, a branch prediction error flag 180c indicating a branch prediction error corresponding to the read instruction, a read address field 180d, and the reading of the main memory being completed. Reading completion flag 180e indicating that the main memory reading result is temporarily held and the reading data field 18
0f, a register field 180g indicating a register number for writing the main memory read result, and a read permission flag 180h for permitting the subsequent read instruction to use the data of the entry.
【0032】読みだしバッファ180に関する処理は、
以下に示す種類が存在する。The processing relating to the read buffer 180 is as follows.
There are the following types.
【0033】(読みだし発行処理)読みだしバッファ1
80は、主記憶アクセスユニットから、読みだしアドレ
ス、分岐予測データおよび書き込みレジスタ番号を受信
し、以下に示す読みだし命令の発行処理を行う。(Read issuing process) Read buffer 1
The reference numeral 80 receives the read address, the branch prediction data and the write register number from the main memory access unit, and performs the read instruction issuing process described below.
【0034】(1)エントリ有効フラグ180aおよび
読みだし許可フラグ180hが“1”、かつ、読みだし
アドレスと読みだしバッファエントリの読みだしアドレ
スフィールド180dが一致、かつ、分岐予測誤りフラ
グ180cと読みだし完了フラグ180eの少なくとも
片方が“1”の場合、(1a)〜(1c)のいずれかの
処理を行う。(1) The entry valid flag 180a and the read permission flag 180h are "1", the read address matches the read address field 180d of the read buffer entry, and the branch prediction error flag 180c is read. When at least one of the completion flags 180e is "1", one of the processes (1a) to (1c) is performed.
【0035】(1a)分岐予測誤りフラグ180cおよ
び読みだし完了フラグ180eがともに“1”の場合、
当該エントリの読みだしデータフィールド180fを書
き込みデータ,主記憶アクセスユニット160から受け
た書き込みレジスタ番号を書き込みレジスタ番号とし
て、リオーダバッファ190に書き込みを発行する。(1a) When the branch prediction error flag 180c and the read completion flag 180e are both "1",
Writing is issued to the reorder buffer 190 using the read data field 180f of the entry as write data and the write register number received from the main memory access unit 160 as the write register number.
【0036】これにより、以前に投機実行し、分岐予測
を誤った読みだし命令と同一アドレスに対する後続の読
みだし命令は、以前の読みだし結果を使うことができ
る。As a result, the previous read result can be used by a subsequent read instruction that has been speculatively executed previously and has a wrong branch prediction and the same address as the read instruction.
【0037】(1b)分岐予測誤りフラグ180cが
“0”,読みだし完了フラグ180eが“1”の場合、
当該エントリの読みだしデータフィールド180fを書
き込みデータ,レジスタフィールド180gを書き込み
レジスタ番号として、リオーダバッファ190に書き込
みを発行する。(1b) When the branch prediction error flag 180c is "0" and the read completion flag 180e is "1",
Writing is issued to the reorder buffer 190 using the read data field 180f of the entry as the write data and the register field 180g as the write register number.
【0038】これにより、以前に発行した読みだし命令
と同一アドレスに対する後続の読みだし命令は、以前の
読みだし結果を使うことができる。As a result, the subsequent read instruction for the same address as the previously issued read instruction can use the previous read result.
【0039】(1c)分岐予測誤りフラグ180cが
“1”,読みだし完了フラグ180eが“0”の場合、
当該エントリの分岐予測フィールド180bを分岐予測
データ,レジスタフィールド180gを書き込みレジス
タ番号,分岐予測誤りフラグ180cを“0”に設定する。(1c) When the branch prediction error flag 180c is "1" and the read completion flag 180e is "0",
The branch prediction field 180b of the entry is set to branch prediction data, the register field 180g is set to a write register number, and the branch prediction error flag 180c is set to "0".
【0040】これにより、以前に投機実行し、分岐予測
が誤った読みだし命令と同一アドレスに対する後続の読
みだし命令は、以前の読みだし結果が主記憶から戻るの
を待って使うことができる。Thus, the subsequent read instruction for the same address as the read instruction which has been speculatively executed and whose branch prediction is wrong can be used after waiting for the previous read result to return from the main memory.
【0041】(2)(1)の条件に該当する読みだしバ
ッファエントリが存在せず、エントリ有効ビット180
aが“0”であるエントリが存在する場合、このエント
リの読みだしアドレスフィールド180d,分岐予測フ
ィールド180b,レジスタフィールド180gを読み
だし発行の読みだしアドレス,分岐予測データ,レジス
タ番号に設定し、エントリ有効ビット180aおよび読
みだし許可フラグ180hを“1”,分岐予測誤りフラ
グ180cおよび読みだし完了フラグ180eを“0”
に設定する。(2) The read buffer entry corresponding to the conditions of (1) does not exist, and the entry valid bit 180
If there is an entry in which a is "0", the read address field 180d, the branch prediction field 180b, and the register field 180g of this entry are set to the read issue address, branch prediction data, and register number, and the entry is set. The valid bit 180a and the read permission flag 180h are "1", and the branch prediction error flag 180c and the read completion flag 180e are "0".
Set to.
【0042】この後、読みだしアドレスフィールド18
0dを読みだしアドレスとし、当該エントリのエントリ
番号を読みだしバッファ番号として、記憶制御回路10
0に主記憶アクセスを発行する。After this, the read address field 18
The storage control circuit 10 uses 0d as a read address and the entry number of the entry as a read buffer number.
Issue main memory access to 0.
【0043】(3)(1),(2)の条件に該当せず、エ
ントリ有効フラグ180aおよび読みだし完了フラグ1
80eが“1”、かつ、読みだし許可フラグ180hが
“0”かつ、読みだしアドレスと読みだしバッファエン
トリの読みだしアドレスフィールド180dが一致する
エントリが存在する場合、(2)と同一の動作を行う。(3) Not satisfying the conditions (1) and (2), the entry valid flag 180a and the read completion flag 1
If 80e is "1", the read permission flag 180h is "0", and there is an entry in which the read address and the read address field 180d of the read buffer entry match, the same operation as (2) is performed. To do.
【0044】(4)(1),(2),(3)の条件に該当せ
ず、エントリ有効フラグ180a,読みだし許可フラグ
180hが全て“1”のエントリが存在する場合、
(2)と同一の動作を行う。(4) In the case where the conditions of (1), (2), and (3) are not satisfied and there are entries in which the entry valid flag 180a and the read permission flag 180h are all "1",
The same operation as (2) is performed.
【0045】これにより、読みだしバッファエントリが
全て有効の場合に、データ到着処理を終えた読みだしバ
ッファエントリを使用することができる。As a result, if all the read buffer entries are valid, the read buffer entry that has completed the data arrival process can be used.
【0046】(5)(1)から(4)のいずれの条件に
も該当しない場合、読みだし命令を登録可能な読みだし
バッファエントリが存在しないため、(1)から(4)
のいずれかが実行できるまで新たな読みだし発行処理を
受け付けず待つ。(5) If none of the conditions (1) to (4) is satisfied, there is no read buffer entry in which a read command can be registered, so (1) to (4)
Wait until one of the above can be executed without accepting a new read / issue process.
【0047】(主記憶アクセス発行処理)読みだしバッ
ファ180は、記憶制御回路100に読みだしアドレス
および読みだしバッファ番号を与え、主記憶読みだしを
発行する。(Main memory access issuing process) The read buffer 180 gives a read address and a read buffer number to the storage control circuit 100, and issues a main memory read.
【0048】(データ到着処理)読みだしバッファ18
0は、記憶制御回路100から主記憶読みだし結果のデ
ータと読みだしバッファ番号を受信し、以下の処理を行
う。(Data Arrival Processing) Read-out buffer 18
0 receives the main memory read result data and the read buffer number from the storage control circuit 100, and performs the following processing.
【0049】(1)読みだしバッファ番号で指定される
読みだしバッファエントリの、読みだしデータフィール
ド180fに主記憶読みだし結果を書き込み、読みだし
完了フラグ180eを“1”とする。(1) The main memory read result is written in the read data field 180f of the read buffer entry specified by the read buffer number, and the read completion flag 180e is set to "1".
【0050】(2)当該エントリの、読みだしデータフ
ィールド180fの値を書き込みデータ,レジスタフィ
ールド180gの値を書き込みレジスタ番号,分岐予測
フィールドを分岐予測データとして、レジスタ書き込み
をリオーダバッファ190に対して発行する。(2) A register write is issued to the reorder buffer 190 using the read data field 180f value of the entry as write data, the register field 180g value as the write register number, and the branch prediction field as the branch prediction data. To do.
【0051】(3)当該エントリの読みだし許可フラグ
180hが“0”の場合、エントリ有効フラグを“0”
とする。(3) If the read permission flag 180h of the entry is "0", set the entry valid flag to "0".
And
【0052】(書き込み発行処理)読みだしバッファ1
80は、主記憶アクセスユニット160から書き込みア
ドレスを受けて、以下に示す書き込み発行処理を行う。(Write issuing process) Read buffer 1
The reference numeral 80 receives the write address from the main memory access unit 160, and performs the write issue processing described below.
【0053】(1)エントリ有効フラグ180aが
“1”かつ書き込みアドレスと読みだしアドレスフィー
ルド180dが一致するエントリを検索する。(1) An entry in which the entry valid flag 180a is "1" and the write address matches the read address field 180d is searched.
【0054】(2)(1)に示したエントリが存在する
場合、当該エントリの読みだし許可フラグ180hを
“0”とする。この時、読みだし完了フラグ180eが
“1”ならば、エントリ有効フラグ180aを“0”と
する。(2) When the entry shown in (1) exists, the reading permission flag 180h of the entry is set to "0". At this time, if the reading completion flag 180e is "1", the entry valid flag 180a is set to "0".
【0055】(分岐結果処理)読みだしバッファ180
は、分岐ユニット150から分岐結果データを受けて、
以下に示す分岐結果処理を行う。(Branch Result Processing) Read Buffer 180
Receives the branch result data from the branch unit 150,
The following branch result processing is performed.
【0056】(1)エントリ有効フラグ180aが
“1”かつ、分岐予測フィールド180bが“10”ま
たは“11”かつ、分岐予測フィールド180bが分岐
結果データと一致する全てのエントリで、分岐予測フィ
ールド180bを“00”とする。(1) The branch prediction field 180b is all entries in which the entry valid flag 180a is "1", the branch prediction field 180b is "10" or "11", and the branch prediction field 180b matches the branch result data. Is set to "00".
【0057】(2)エントリ有効フラグ180aが
“1”かつ、分岐予測フィールド180bが“10”ま
たは“11”かつ、分岐予測フィールド180bが分岐
結果データと一致しない全てのエントリで、分岐予測フ
ィールド180bを分岐結果データとし、分岐予測誤り
フラグ180cを“1”とする。(2) The branch prediction field 180b is all entries in which the entry valid flag 180a is "1", the branch prediction field 180b is "10" or "11", and the branch prediction field 180b does not match the branch result data. Is set as the branch result data, and the branch prediction error flag 180c is set to "1".
【0058】これにより、分岐予測を誤って実行した読
みだしバッファエントリについて、読みだしバッファエ
ントリを有効としたまま分岐予測の誤りを設定すること
ができる。As a result, it is possible to set an error in branch prediction for a read buffer entry for which branch prediction was erroneously executed, while keeping the read buffer entry valid.
【0059】本実施例では、読みだしバッファ180の
各エントリに分岐予測フィールド180bおよび分岐予
測誤りフラグ180cを設けることに特徴がある。The present embodiment is characterized in that a branch prediction field 180b and a branch prediction error flag 180c are provided in each entry of the read buffer 180.
【0060】本実施例で示した中央処理装置で、図2の
プログラムを実行した場合の動作を以下に示す。The operation when the program of FIG. 2 is executed by the central processing unit shown in this embodiment will be described below.
【0061】図2のプログラムで、I1は条件分岐命令
であり、分岐予測回路110で分岐しないと予測する
が、実際には分岐を行う。In the program of FIG. 2, I1 is a conditional branch instruction, and the branch prediction circuit 110 predicts that the branch will not occur, but actually branches.
【0062】I2,I5,I8,I13は読みだし命令
であり、例えば“LD A,R1”は主記憶のアドレス
Aの値をレジスタR1に読み込むことを示す。I2, I5, I8 and I13 are read instructions. For example, "LD A, R1" indicates that the value of the address A of the main memory is read into the register R1.
【0063】I9は書き込み命令であり、”ST R
3,A”はレジスタR3の値を主記憶のアドレスAに書
き込むことを示す。I9 is a write command, and "ST R
3, A ″ indicates that the value of the register R3 is written to the address A of the main memory.
【0064】I3,I4,I6,I7,I10,I1
1,I12はそれぞれR1,R2,R3,R4とは無関
係の演算命令である。I3, I4, I6, I7, I10, I1
Reference numerals 1 and I12 are operation instructions unrelated to R1, R2, R3 and R4, respectively.
【0065】I14はレジスタR2を使用する演算命令
である。I14 is an arithmetic instruction using the register R2.
【0066】本実施例では、読みだし命令は主記憶を読
みだす時間を含めると10サイクル、その他の命令は読
みだし中のデータを使用しない場合1サイクルの実行時
間がかかるとし、分岐予測の5サイクル後に分岐実行結
果がわかるものとする。In the present embodiment, it is assumed that the read instruction takes 10 cycles when the time to read the main memory is included, and the other instructions take 1 cycle when the data being read is not used. The branch execution result is known after the cycle.
【0067】図2のプログラムの実行タイミングを図3
に示す。FIG. 3 shows the execution timing of the program of FIG.
Shown in.
【0068】(1)1サイクル目に分岐命令を読みだす
と、分岐予測回路110は分岐しないと予測し、分岐予
測データを“10”とする。この後、分岐実行結果が得
られるまでの5サイクルの間、I2,I3,I4,I
8,I9の投機実行を行う。この時、主記憶アクセスユ
ニット160は読みだしバッファ180に対して、2サ
イクル目にI2,5サイクル目にI8の読みだし発行処
理が発行され、読みだし発行処理(2)に従って読みだ
しバッファ180に格納される。また、6サイクル目に
I9の書き込み発行処理が発行され、書き込み発行処理
(2)が実行され、アドレスAのデータを保持する読み
だしバッファエントリの読みだし許可フラグ180hを
“0”とする。この時の読みだしバッファ180の状態
を図5に示す。(1) When the branch instruction is read in the first cycle, the branch prediction circuit 110 predicts that no branch will be taken, and sets the branch prediction data to "10". After this, I2, I3, I4, and I for five cycles until the branch execution result is obtained.
8 and I9 speculative execution is performed. At this time, the main memory access unit 160 issues the read issue processing of I8 in the second cycle and the read issue processing of I8 in the fifth cycle to the read buffer 180, and the read buffer 180 enters the read buffer 180 according to the read issue processing (2). Is stored. Further, the write issue process of I9 is issued in the sixth cycle, the write issue process (2) is executed, and the read permission flag 180h of the read buffer entry holding the data of the address A is set to “0”. The state of the read buffer 180 at this time is shown in FIG.
【0069】(2)6サイクル目の最後に分岐ユニット
150で分岐実行結果が得られると、読みだしバッファ
180に分岐結果処理が発行される。この時、分岐実行
結果は分岐を行うため、分岐結果データは“11”とな
る。読みだしバッファ180は、分岐結果処理(2)に
従いI2,I9に対応する読みだしバッファエントリの
分岐予測誤りフラグ180cを“1”とする。(2) When the branch unit 150 obtains the branch execution result at the end of the sixth cycle, the branch result process is issued to the read buffer 180. At this time, since the branch execution result branches, the branch result data becomes “11”. The read buffer 180 sets the branch prediction error flag 180c of the read buffer entry corresponding to I2 and I9 to "1" according to the branch result process (2).
【0070】(3)7サイクル目には投機実行中ではな
いため分岐予測データは“00”となり、正しい命令列
I5,I6,I7が実行され、I5が読みだしバッファ
180に読みだし発行処理(2)により登録される。(3) Since the speculative execution is not being executed in the 7th cycle, the branch prediction data becomes "00", the correct instruction sequence I5, I6, I7 is executed, and I5 is read out to the read buffer 180 and issuance processing ( Registered according to 2).
【0071】(4)10サイクル目には、I8が実行さ
れ、主記憶アクセスユニット160は読みだしバッファ
180に対し、読みだし発行処理を発行する。読みだし
バッファ180は、読みだし発行処理(1c)に従い5
サイクル目のI8で発行され、分岐予測を誤った読みだ
し命令の結果を使用できるようにする。(4) In the 10th cycle, I8 is executed, and the main memory access unit 160 issues the read issue processing to the read buffer 180. The read buffer 180 is 5 according to the read issuing process (1c).
Issued at I8 of the cycle, the branch prediction makes it possible to use the result of the erroneous read instruction.
【0072】(5)2サイクル目に発行したI2の結果
は、12サイクル目にデータ到着処理により読みだしバ
ッファ180に戻される。この時、読みだしバッファ1
80は、I2に対応する読みだしバッファエントリの読
みだし許可フラグ180hが“0”であるため、今後こ
の読みだしバッファエントリの読みだしデータは再利用
されないことを知り、データ到着処理(3)に従いエント
リ有効フラグ180aを“0”とする。(5) The result of I2 issued in the second cycle is returned to the read buffer 180 by the data arrival processing in the twelfth cycle. At this time, read buffer 1
Since the read permission flag 180h of the read buffer entry corresponding to I2 is “0”, the reference numeral 80 knows that the read data of this read buffer entry will not be reused in the future, and follows the data arrival process (3). The entry valid flag 180a is set to "0".
【0073】(6)5サイクル目に発行したI8の結果
は、15サイクル目にデータ到着処理により読みだしバ
ッファ180に戻される。この時、データ到着処理によ
り、読みだし結果が読みだしバッファ180からリオー
ダバッファ190を通してレジスタファイル130に格
納される。この時の読みだしバッファ180の状態を図
6に示す。(6) The result of I8 issued in the 5th cycle is returned to the read buffer 180 by the data arrival processing in the 15th cycle. At this time, due to the data arrival processing, the read result is stored in the register file 130 from the read buffer 180 through the reorder buffer 190. The state of the read buffer 180 at this time is shown in FIG.
【0074】(7)16サイクル目のI14実行時に
は、レジスタR2に既にアドレスCの読みだし結果が格
納されており、I14が実行できる。(7) When I14 is executed in the 16th cycle, the read result of the address C is already stored in the register R2, and I14 can be executed.
【0075】以上により、図2に示す命令列は16サイ
クルで実行される。As described above, the instruction sequence shown in FIG. 2 is executed in 16 cycles.
【0076】これに対し、本発明を利用せず、分岐予測
を誤った場合に投機実行した全ての命令を破棄すること
を考える。この時、投機実行したI5は6サイクル目の
最後に破棄され、I14は10サイクル目に実行するI
8の結果を待たなければならない。このため、図4に示
すようにI14の実行は21サイクル目まで待たされ
る。よって、本発明を利用しない場合、図2に示す命令
列の実行には21サイクルかかる。On the other hand, without using the present invention, consider discarding all speculatively executed instructions when the branch prediction is incorrect. At this time, the speculatively executed I5 is discarded at the end of the sixth cycle, and I14 is the I executed in the tenth cycle.
We have to wait for the result of 8. Therefore, as shown in FIG. 4, the execution of I14 is delayed until the 21st cycle. Therefore, if the present invention is not used, it takes 21 cycles to execute the instruction sequence shown in FIG.
【0077】以上の実施例によれば、読みだしバッファ
180の各エントリに分岐予測フィールド180bおよ
び分岐予測誤りフラグ180cを設け、分岐予測を誤っ
た場合でも投機実行した読みだし命令の読みだし結果を
利用可能とすることで、読みだし結果の待ち時間を短縮
することができ、中央処理装置の性能を向上することが
できる。According to the above embodiment, the branch prediction field 180b and the branch prediction error flag 180c are provided in each entry of the read buffer 180, and the read result of the speculatively executed read instruction is output even when the branch prediction is wrong. By making it available, the waiting time for the reading result can be shortened and the performance of the central processing unit can be improved.
【0078】〈実施例2〉本発明の実施例2を説明す
る。本実施例は実施例1の変形であるため、相違点につ
いてのみ説明する。本実施例は、主記憶アクセスユニッ
ト160,書き込みバッファ170,読みだしバッファ
180の構造を変更し、書き込みバッファ内に存在する
データの読みだし時には主記憶を読みださず、書き込み
バッファのデータを読みだしデータとして使用可能とす
る点が異なる。<Second Embodiment> A second embodiment of the present invention will be described. Since this embodiment is a modification of the first embodiment, only different points will be described. In this embodiment, the structures of the main memory access unit 160, the write buffer 170, and the read buffer 180 are changed so that the main memory is not read when the data existing in the write buffer is read, but the data in the write buffer is read. The difference is that it can be used as dashi data.
【0079】図7は本実施例の中央処理装置を示す。FIG. 7 shows the central processing unit of this embodiment.
【0080】本実施例の中央処理装置では、主記憶アク
セスユニット260は命令発行回路220から受けた読
みだし命令および書き込み命令を、書き込みバッファ2
70に対して発行する。In the central processing unit of this embodiment, the main memory access unit 260 receives the read instruction and the write instruction received from the instruction issuing circuit 220 and writes them in the write buffer 2.
Issue to 70.
【0081】書き込みバッファ270は、エントリ毎に
書き込み要求の有効を示すエントリ有効フラグ270
a,書き込み命令の分岐予測データを格納する分岐予測
フィールド270b,書き込みアドレスフィールド27
0c,書き込みデータフィールド270dのフィールド
を持つ。The write buffer 270 has an entry valid flag 270 indicating the validity of the write request for each entry.
a, a branch prediction field 270b for storing branch prediction data of a write instruction, a write address field 27
It has fields of 0c and a write data field 270d.
【0082】書き込みバッファ270に関する処理は、
以下に示す種類が存在する。The processing relating to the write buffer 270 is as follows.
There are the following types.
【0083】(書き込み発行処理)書き込みバッファ2
70は、主記憶アクセスユニット260から、書き込み
アドレス,分岐予測データおよび書き込みデータを受信
し、書き込み命令の発行を行う。(Write Issue Processing) Write Buffer 2
70 receives a write address, branch prediction data and write data from the main memory access unit 260 and issues a write instruction.
【0084】(1)エントリ有効フラグ270aが
“0”の書き込みバッファエントリが存在する場合、書
き込みアドレスおよび書き込みデータを書き込みバッフ
ァエントリの書き込みアドレスフィールド270cおよ
び書き込みデータフィールド270dに書き込み、エントリ
有効フラグ270aを“1”とする。(1) When there is a write buffer entry having the entry valid flag 270a of "0", the write address and write data are written in the write address field 270c and the write data field 270d of the write buffer entry, and the entry valid flag 270a is set. Set to "1".
【0085】(2)エントリ有効フラグ270aが
“0”の書き込みバッファエントリが存在しない場合、
(1)が実行できるまで新たな書き込み発行処理を受け
付けず待つ。(2) When there is no write buffer entry with the entry valid flag 270a being "0",
Wait until (1) can be executed without accepting new write issue processing.
【0086】(3)(1)または(2)の後、読みだし
バッファ280に書き込みアドレスを与え、書き込み発
行処理を行う。(3) After (1) or (2), a write address is given to the read buffer 280, and a write issue process is performed.
【0087】(主記憶アクセス発行処理)書き込みバッ
ファ270は、エントリ有効フラグ270aが“1”か
つ分岐予測フィールド270bが“00”の書き込みバ
ッファエントリについて、書き込みアドレスおよび書き
込みデータを与え、主記憶書き込みを発行する。主記憶
書き込みは、書き込みバッファ270への登録順に従っ
て行う。この後、エントリ有効フラグ270aを“0”
とする。(Main Memory Access Issuing Process) The write buffer 270 gives the write address and write data to the write buffer entry with the entry valid flag 270a being "1" and the branch prediction field 270b being "00" to write the main memory. Issue. Main memory writing is performed in the order of registration in the write buffer 270. After that, the entry valid flag 270a is set to "0".
And
【0088】(分岐結果処理)書き込みバッファ270
は、分岐ユニット250から分岐結果データを受けて、
分岐結果を受信し、以下に示す分岐結果処理を行う。(Branch Result Processing) Write Buffer 270
Receives the branch result data from the branch unit 250,
The branch result is received and the following branch result processing is performed.
【0089】(1)エントリ有効フラグ270aが
“1”かつ、分岐予測フィールド270bが“00”で
なく、分岐予測フィールド270bと分岐結果データが
一致する全ての書き込みバッファエントリで、分岐予測
フィールド270bを“00”とする。(1) If the entry valid flag 270a is not "1" and the branch prediction field 270b is not "00", the branch prediction field 270b is set to the branch prediction field 270b in all the write buffer entries whose branch result data matches the branch prediction data 270b. Set to "00".
【0090】(2)エントリ有効フラグが“1”かつ、
分岐予測フィールド270bが“00”でなく、分岐予測
フィールド270bと分岐結果データが一致しない全て
の書き込みバッファエントリで、エントリ有効フラグ2
70aを“0”とする。(2) The entry valid flag is "1" and
If the branch prediction field 270b is not "00" and the branch prediction field 270b does not match the branch result data, the entry valid flag 2 is set in all the write buffer entries.
70a is set to "0".
【0091】(読みだし発行処理)書き込みバッファ2
70は、主記憶アクセスユニット260から読みだしア
ドレス,分岐予測データおよび書き込みレジスタ番号を
受信し、以下に示す読みだし発行処理を行う。(Read Issue Processing) Write Buffer 2
70 receives the read address, the branch prediction data, and the write register number from the main memory access unit 260, and performs the read issue processing shown below.
【0092】(1)エントリ有効フラグ270aが
“1”かつ、書き込みアドレスフィールド270cが読
みだしアドレスと一致するエントリが存在する場合、最
も後に登録された書き込みバッファエントリを検索す
る。この後、読みだしアドレス,分岐予測データ,書き
込みレジスタ番号,当該書き込みバッファエントリの分
岐予測フィールド270b,当該書き込みバッファエン
トリの書き込みデータ270dを読みだしバッファ28
0に与え、読みだしバッファ280の読みだし発行処理
を行う。(1) When the entry valid flag 270a is "1" and there is an entry in which the write address field 270c matches the read address, the write buffer entry registered last is searched. Thereafter, the read address, the branch prediction data, the write register number, the branch prediction field 270b of the write buffer entry, and the write data 270d of the write buffer entry are read from the read buffer 28.
It is given to 0, and the read issue processing of the read buffer 280 is performed.
【0093】(2)(1)以外の場合、読みだしアドレ
ス,分岐予測データ,書き込みレジスタ番号を読みだし
バッファ280に与え、読みだしバッファ280の読み
だし発行処理を行う。(2) In cases other than (1), the read address, the branch prediction data, and the write register number are given to the read buffer 280, and the read issue processing of the read buffer 280 is performed.
【0094】読みだしバッファ280は、実施例1の読
みだしバッファ180に加えて書き込みデータ分岐予測
フィールド280iを持つ。書き込みデータ分岐予測フ
ィールド280iは、書き込みバッファ270のデータ
を読みだし結果として使用した後、書き込み命令が分岐
予測誤りのために破棄された場合に、この書き込み結果
を使用する読みだしバッファエントリを破棄するために
設けてある。The read buffer 280 has a write data branch prediction field 280i in addition to the read buffer 180 of the first embodiment. The write data branch prediction field 280i discards the read buffer entry using this write result when the write instruction is discarded due to a branch prediction error after using the data of the write buffer 270 as the read result. It is provided for this purpose.
【0095】本実施例では、実施例1の読みだし発行処
理,分岐結果処理を以下に示すように変更する。In this embodiment, the read issue processing and branch result processing of the first embodiment are modified as follows.
【0096】(読みだし発行処理)読みだしバッファ2
80は、書き込みバッファ270から読みだしアドレ
ス,分岐予測データおよび書き込みレジスタ番号を受信
し、以下に示す読みだし発行処理を行う。(Read issuing processing) Read buffer 2
80 receives the read address, the branch prediction data, and the write register number from the write buffer 270, and performs the read issuing issue process described below.
【0097】(1)エントリ有効フラグ280aおよび
読みだし許可フラグ280hが“1”、かつ、読みだし
アドレスと読みだしバッファエントリの読みだしアドレ
スフィールド280dが一致、かつ、分岐予測誤りフラ
グ280cと読みだし完了フラグ280eの少なくとも
片方が“1”の場合、(1a)〜(1c)のいずれかの処
理を行う。(1) The entry valid flag 280a and the read permission flag 280h are "1", the read address and the read address field 280d of the read buffer entry match, and the branch prediction error flag 280c is read. When at least one of the completion flags 280e is "1", one of the processes (1a) to (1c) is performed.
【0098】(1a)分岐予測誤りフラグ280cおよび
読みだし完了フラグ280eが“1”の場合、当該エン
トリの読みだしデータフィールド280fを書き込みデ
ータ,主記憶アクセスユニット160から受けた書き込
みレジスタ番号を書き込みレジスタ番号として、リオー
ダバッファ290に書き込みを発行する。(1a) When the branch prediction error flag 280c and the read completion flag 280e are "1", the read data field 280f of the entry is the write data, and the write register number received from the main memory access unit 160 is the write register. A write is issued to the reorder buffer 290 as a number.
【0099】これにより、以前に投機実行し、分岐予測
が誤った読みだし命令と同一アドレスに対する後続の読
みだし命令は、以前の読みだし結果を使うことができ
る。As a result, the subsequent read instruction for the same address as the read instruction that was previously speculatively executed and has an incorrect branch prediction can use the previous read result.
【0100】(1b)分岐予測誤りフラグ280cが
“0”,読みだし完了フラグ280eが“1”の場合、
当該エントリの読みだしデータフィールド280fを書
き込みデータ,レジスタフィールド280gを書き込み
レジスタ番号として、リオーダバッファ290に書き込
みを発行する。(1b) When the branch prediction error flag 280c is "0" and the read completion flag 280e is "1",
Writing is issued to the reorder buffer 290 using the read data field 280f of the entry as the write data and the register field 280g as the write register number.
【0101】これにより、以前に発行した読みだし命令
と同一アドレスに対する後続の読みだし命令は、以前の
読みだし結果を使うことができる。As a result, the subsequent read instruction for the same address as the previously issued read instruction can use the previous read result.
【0102】(1c)分岐予測誤りフラグ280cが
“1”,読みだし完了フラグ280eが“0”かつ読み
だし発行処理に書き込みデータフィールド270dおよ
び書き込みデータの分岐予測フィールド270bが伴っ
ていない場合、当該エントリの分岐予測フィールド28
0bを分岐予測データ,レジスタフィールド280gを
レジスタ番号に設定する。(1c) If the branch prediction error flag 280c is "1", the read completion flag 280e is "0", and the read issue processing does not involve the write data field 270d and the write data branch prediction field 270b, Branch prediction field 28 of entry
0b is set as the branch prediction data, and the register field 280g is set as the register number.
【0103】これにより、以前に投機実行し、分岐予測
が誤った読みだし命令と同一アドレスに対する後続の読
みだし命令は、以前の読みだし結果が主記憶から戻るの
を待って使うことができる。As a result, a subsequent read instruction for the same address as the read instruction which was previously speculatively executed and has an incorrect branch prediction can be used after waiting for the previous read result to return from the main memory.
【0104】(2)(1)の条件に該当せず、エントリ
有効ビット280aが“0”であるエントリが存在する
場合、このエントリの読みだし発行の読みだしアドレ
ス,分岐予測データ,レジスタ番号を、読みだしアドレ
スフィールド280d,分岐予測フィールド280b,
レジスタフィールド280gに設定し、エントリ有効ビ
ット280aおよび読みだし許可フラグ280hを
“1”,分岐予測誤りフラグ280cおよび読みだし完
了フラグ280eを“0”に設定する。(2) If there is an entry whose entry valid bit 280a is "0" which does not correspond to the conditions of (1), the read address of the read issue of this entry, the branch prediction data, and the register number are set. , Read address field 280d, branch prediction field 280b,
The register valid field 280g is set, the entry valid bit 280a and the read permission flag 280h are set to "1", and the branch prediction error flag 280c and the read completion flag 280e are set to "0".
【0105】この後、読みだし発行処理に書き込みデー
タフィールド270dおよび書き込みデータの分岐予測
フィールド270bが伴っている場合、これらを当該読
みだしバッファエントリの読みだしデータフィールド2
80f,書き込みデータ分岐予測フィールド280iに
書き込み、主記憶読みだし完了フラグ280cを“1”
として、(1a)の処理を行う。After that, when the read issue processing is accompanied by the write data field 270d and the write data branch prediction field 270b, these are read data field 2 of the read buffer entry.
80f, write data branch prediction field 280i is written, main memory read completion flag 280c is "1"
As a result, the processing of (1a) is performed.
【0106】読みだし発行処理に書き込みデータフィー
ルド270dおよび書き込みデータの分岐予測フィール
ド270bが伴っていない場合、書き込みデータ分岐予
測フィールド280iを“00”,読みだしアドレスフ
ィールド280dを読みだしアドレスとし、当該エント
リのエントリ番号を読みだしバッファ番号として、記憶
制御回路200に主記憶アクセスを発行する。If the read data issuing process does not include the write data field 270d and the write data branch prediction field 270b, the write data branch prediction field 280i is set to "00" and the read address field 280d is set to the read address, and the entry concerned is set. The main memory access is issued to the memory control circuit 200 by using the entry number of 1 as the read buffer number.
【0107】(3)(1),(2)の条件に該当せず、エ
ントリ有効フラグ280aおよび読みだし完了フラグ2
80eが“1”、かつ、読みだし許可フラグ280hが
“0”かつ、読みだしアドレスと読みだしバッファエン
トリの読みだしアドレスフィールド280dが一致する
エントリが存在する場合、(2)と同一の動作を行う。(3) The entry valid flag 280a and the read completion flag 2 are not satisfied because the conditions (1) and (2) are not satisfied.
If 80e is "1", the read permission flag 280h is "0", and there is an entry in which the read address and the read address field 280d of the read buffer entry match, the same operation as (2) is performed. To do.
【0108】(4)(1),(2),(3)の条件に該当せ
ず、エントリ有効ビット280a,読みだし許可フラグ
280hが全て“1”のエントリが存在する場合、
(2)と同一の動作を行う。(4) If the conditions of the entries (1), (2), and (3) are not satisfied and the entry valid bit 280a and the read permission flag 280h are all "1",
The same operation as (2) is performed.
【0109】これにより、読みだしバッファエントリが
全て有効の場合に、分岐予測が誤った読みだしバッファ
エントリを消去して使用することができる。As a result, when all the read buffer entries are valid, the read buffer entries with incorrect branch prediction can be deleted and used.
【0110】(5)(1)から(4)のいずれの条件に
も該当しない場合、(1)から(4)のいずれかが実行
できるまで新たな読みだし発行処理を受け付けず待つ。(5) When none of the conditions (1) to (4) is satisfied, the new reading and issuing process is not accepted and waits until any of (1) to (4) can be executed.
【0111】(分岐結果処理)読みだしバッファ280
は、分岐ユニット250から分岐結果データを受けて、
以下に示す分岐結果処理を行う。(Branch Result Processing) Read Buffer 280
Receives the branch result data from the branch unit 250,
The following branch result processing is performed.
【0112】(1)エントリ有効フラグ280aが
“1”かつ、分岐予測フィールド280bが“10”ま
たは“11”かつ、分岐予測フィールド280bが分岐
結果データと一致する全てのエントリで、(1a)書き
込みデータ命令予測フィールド280iが“00”または、
分岐結果データと一致する場合、分岐予測フィールド28
0bおよび書き込みデータ命令予測フィールド280iを
“00”とする。(1b)(1a)以外の場合、読みだ
し許可フラグ280hを“0”とする。(1) Write (1a) in all entries in which the entry valid flag 280a is "1", the branch prediction field 280b is "10" or "11", and the branch prediction field 280b matches the branch result data. Data command prediction field 280i is "00" or
Branch prediction field 28 if it matches the branch result data
0b and the write data command prediction field 280i are set to "00". (1b) In cases other than (1a), the read permission flag 280h is set to "0".
【0113】(2)エントリ有効フラグ280aが
“1”かつ、分岐予測フィールド280bが“10”ま
たは“11”かつ、分岐予測フィールド280bが分岐
結果データと一致しない全てのエントリで、(2a)書
き込みデータ命令予測フィールド280iが“00”ま
たは、分岐結果データと一致する場合、分岐予測フィー
ルド280bを分岐結果データとし、分岐予測誤りフラ
グ280cを“1”とする。(2) Write (2a) in all entries where the entry valid flag 280a is "1", the branch prediction field 280b is "10" or "11", and the branch prediction field 280b does not match the branch result data. When the data instruction prediction field 280i is "00" or coincides with the branch result data, the branch prediction field 280b is set as the branch result data and the branch prediction error flag 280c is set at "1".
【0114】(2b)(2a)以外の場合、読みだし許
可フラグ280hを“0”とする。(2b) In cases other than (2a), the read permission flag 280h is set to "0".
【0115】これにより、読みだし命令発行時に、書き
込みバッファ270のデータを読みだし結果とし、書き
込みデータが分岐予測誤りのため実行されない場合に、
当該読みだしバッファエントリを読みだし不可とするこ
とができる。As a result, when the read instruction is issued, the data in the write buffer 270 is used as the read result, and when the write data is not executed due to a branch prediction error,
The read buffer entry can be made unreadable.
【0116】本実施例では、実施例1に加えて読みだし
バッファエントリに書き込みデータ分岐予測フィールド
280iを設けることに特徴がある。In addition to the first embodiment, the present embodiment is characterized in that a write data branch prediction field 280i is provided in the read buffer entry.
【0117】本実施例で示した中央処理装置で、図8の
プログラムを実行した場合の動作を以下に示す。The operation when the program of FIG. 8 is executed by the central processing unit shown in this embodiment is shown below.
【0118】(1)1サイクル目にI1が実行される
と、R1の値が書き込みバッファ270に登録される。
I1の書き込み命令が記憶制御回路200に対して未発
行の場合、2サイクル目の読みだし命令I2は書き込み
バッファ270の読みだし発行処理(1)に従い、書き
込みデータを読みだし値として使用する。(1) When I1 is executed in the first cycle, the value of R1 is registered in the write buffer 270.
When the write command of I1 has not been issued to the storage control circuit 200, the read command I2 in the second cycle uses the write data as the read value according to the read issue process (1) of the write buffer 270.
【0119】これにより、以前に同一アドレスに書き込
みを発行した場合、読みだし命令は以前の書き込みデー
タを利用することができ、主記憶から読みだした場合と
比較して読みだしにかかる時間が短くなり、性能を向上
することができる。As a result, when a write is previously issued to the same address, the read instruction can use the previous write data, and the time required for reading is shorter than that in the case of reading from the main memory. Therefore, the performance can be improved.
【0120】(2)3サイクル目の条件分岐命令は、分
岐予測回路210では分岐しないと予測されるが、実際
には分岐を行う命令である。この時、分岐実行結果が得
られるまでの5サイクルの間、分岐予測データ“10”
としてI4,I5および後続命令の投機実行を行う。(2) The conditional branch instruction of the third cycle is an instruction that actually branches although it is predicted that the branch prediction circuit 210 will not branch. At this time, the branch prediction data “10” is obtained for 5 cycles until the branch execution result is obtained.
As a result, speculative execution of I4, I5 and subsequent instructions is performed.
【0121】(3)I4の実行時、書き込みバッファ2
70は書き込み発行処理(1)に従い、書き込みアドレ
スフィールド270cをアドレスA,書き込みデータフ
ィールド270dをR1の値,分岐予測フィールドを
“10”として書き込みバッファ270に格納される。(3) Write buffer 2 when I4 is executed
According to the write issuing process (1), 70 is stored in the write buffer 270 with the write address field 270c as the address A, the write data field 270d as the value of R1, and the branch prediction field as “10”.
【0122】(4)I5の実行時、書き込みバッファ2
70は書き込みバッファ270の読みだし発行処理
(1)に従い、読みだしアドレス,分岐予測データ,書
き込みレジスタ番号,当該書き込みバッファエントリの
分岐予測フィールド270bを読みだしバッファ280
に与え、読みだしバッファ280の読みだし発行処理を
行う。(4) Write buffer 2 when executing I5
In accordance with the read issue processing (1) of the write buffer 270, the read buffer 280 reads the read address, the branch prediction data, the write register number, and the branch prediction field 270b of the write buffer entry.
Then, the read-out issuing process of the read-out buffer 280 is performed.
【0123】読みだしバッファ280は読みだしバッフ
ァ280の読みだし発行処理(2)に従い、このエントリ
の読みだしアドレスフィールド280d,分岐予測フィ
ールド280b,書き込みレジスタフィールド280g
を読みだし発行の読みだしアドレス,分岐予測データ,
レジスタ番号に設定し、エントリ有効ビット280aお
よび読みだし許可フラグ280hを“1”,分岐予測誤
りフラグ280cおよび読みだし完了フラグ280eを
“0”,読みだしデータフィールド280f,書き込み
データ分岐予測フィールド280iに書き込み、主記憶
読みだし完了フラグ280cを“1”する。この後、読
みだしデータフィールド280fを書き込みデータ,レ
ジスタフィールド280gを書き込みレジスタ番号とし
て、リオーダバッファ290に書き込みを発行する。こ
の時の読みだしバッファ280および書き込みバッファ
270の状態を図9に示す。The read buffer 280 follows the read issue processing (2) of the read buffer 280, and the read address field 280d, branch prediction field 280b, and write register field 280g of this entry.
Read-out address of read issue, branch prediction data,
The register number is set, the entry valid bit 280a and the read permission flag 280h are set to "1", the branch prediction error flag 280c and the read completion flag 280e are set to "0", the read data field 280f, and the write data branch prediction field 280i. The writing and main memory reading completion flag 280c is set to "1". After that, writing is issued to the reorder buffer 290 with the read data field 280f as the write data and the register field 280g as the write register number. The states of the read buffer 280 and the write buffer 270 at this time are shown in FIG.
【0124】(5)分岐ユニット250で分岐実行結果
が得られると、書き込みバッファ270および読みだしバ
ッファ280に分岐結果処理が発行される。この時の分
岐実行結果は、分岐を行うため“11”となる。(5) When the branch execution result is obtained by the branch unit 250, the branch result process is issued to the write buffer 270 and the read buffer 280. The branch execution result at this time is “11” because the branch is performed.
【0125】この時、書き込みバッファ270は、書き
込みバッファ270の分岐結果処理(1)に従い、アド
レスAへのR2の値の書き込みの書き込みバッファエン
トリのエントリ有効フラグ270aを“0”とする。At this time, the write buffer 270 sets the entry valid flag 270a of the write buffer entry for writing the value of R2 to the address A to "0" according to the branch result process (1) of the write buffer 270.
【0126】読みだしバッファ280は、読みだしバッ
ファ280の分岐結果処理(2b)に従い、アドレスA
からの読みだしのエントリの読みだし許可フラグ280
hを“0”とする。The read buffer 280 follows the branch result process (2b) of the read buffer 280 and sets the address A
Reading permission flag 280 of reading entry from
Let h be “0”.
【0127】(6)(5)以降分岐予測データは“0
0”となり、I5以降の命令が正しい命令列として実行
され、I5の実行時には読みだしバッファ280の読み
だし発行処理(2)に従い記憶制御回路200に主記憶
の読みだしが発行される。よって、I5に対応する読み
だしバッファエントリの読みだしデータフィールド280f
を、誤って使用することはない。(6) The branch prediction data after (5) is "0".
Therefore, the instructions after I5 are executed as a correct instruction sequence, and when I5 is executed, the main memory read is issued to the storage control circuit 200 according to the read issue processing (2) of the read buffer 280. Read data field 280f of the read buffer entry corresponding to I5
Is never used by mistake.
【0128】読みだしバッファ280は、書き込み命令
の分岐予測データを保持するために書き込みデータ分岐
予測フィールド280iを設けることで、主記憶アクセ
スユニット260は、読みだし命令を書き込みバッファ
270に発行し、書き込みバッファ270は同一アドレ
スへの書き込みがあれば書き込み値を読みだしデータと
して読みだしバッファに与えることができる。これによ
り、書き込み命令の後に同一アドレスに読みだしを発行
する場合、読みだし結果の待ち時間を短縮することがで
き、中央処理装置の性能を向上することができる。The read buffer 280 is provided with a write data branch prediction field 280i for holding the branch prediction data of the write instruction, so that the main memory access unit 260 issues the read instruction to the write buffer 270 and writes it. The buffer 270 can read the write value as read data and provide it to the read buffer if there is a write to the same address. As a result, when the read is issued to the same address after the write instruction, the waiting time of the read result can be shortened and the performance of the central processing unit can be improved.
【0129】〈実施例3〉本発明の実施例3を説明す
る。本実施例は実施例1の変形であるため、相違点につ
いてのみ説明する。本実施例は、読みだし命令および書
き込み命令を共通のバッファに格納する点が異なる。<Third Embodiment> A third embodiment of the present invention will be described. Since this embodiment is a modification of the first embodiment, only different points will be described. The present embodiment is different in that the read command and the write command are stored in a common buffer.
【0130】図10は本実施例の中央処理装置を示す。FIG. 10 shows the central processing unit of this embodiment.
【0131】本実施例の中央処理装置では、主記憶アク
セスユニット360は命令発行回路320から受けた読
みだし命令および書き込み命令を、アクセスバッファ3
85に対して発行する。In the central processing unit of this embodiment, the main memory access unit 360 receives the read instruction and the write instruction received from the instruction issuing circuit 320 and accesses the access buffer 3.
Issue to 85.
【0132】アクセスバッファ385はエントリ毎に読
みだしまたは書き込み要求の有効を示すエントリ有効フ
ラグ385a,アクセスバッファエントリが書き込み命
令を保持していることを示す書き込みフラグ385j,
読みだし命令または書き込み命令の分岐予測データを格
納する分岐予測フィールド385b,読みだし命令に対
応する分岐予測の誤りを示す分岐予測誤りフラグ385
c,アドレスフィールド385d,主記憶の読みだしが
完了したことを示す読みだし完了フラグ385e,主記憶読
みだし結果または書き込み値を一旦保持するデータフィ
ールド385f,主記憶読みだし結果を書き込むレジス
タ番号を示すレジスタフィールド385g,後続の読みだし
命令が当該エントリのデータを使うことを許可する読み
だし許可フラグ385hのフィールドを持つ。The access buffer 385 has an entry valid flag 385a indicating the validity of a read or write request for each entry, a write flag 385j indicating that the access buffer entry holds a write command,
A branch prediction field 385b for storing branch prediction data of a read instruction or a write instruction, a branch prediction error flag 385 indicating an error in branch prediction corresponding to the read instruction.
c, an address field 385d, a reading completion flag 385e indicating that the reading of the main memory is completed, a data field 385f for temporarily holding the main memory reading result or the write value, and a register number for writing the main memory reading result. It has a register field 385g and a read permission flag 385h that permits the subsequent read instruction to use the data of the entry.
【0133】本実施例では、アクセスバッファエントリ
を読みだし命令の場合には書き込みフラグ385jを
“0”として使用し、書き込み命令の場合には書き込み
フラグ385jを“1”として使用する。これにより、
アクセスバッファエントリが読みだしまたは書き込みの
いずれのエントリとして使用されているかを区別でき、
共通のアクセスバッファ385で読みだしバッファおよ
び書き込みバッファの両方の役割を持つことができる。In this embodiment, the write flag 385j is used as "0" in the case of a read instruction for an access buffer entry, and the write flag 385j is used as "1" in the case of a write instruction. This allows
You can distinguish whether an access buffer entry is used as a read or write entry,
The common access buffer 385 can serve as both a read buffer and a write buffer.
【0134】読みだしバッファおよび書き込みバッファ
双方の機能を共通のアクセスバッファ385に持たせる
ことで、読みだしバッファと書き込みバッファを別に設
ける必要がなくなり、ハードウェア量を減らすことがで
きる。By providing the read buffer and the write buffer with the common access buffer 385, it is not necessary to provide a read buffer and a write buffer separately, and the amount of hardware can be reduced.
【0135】〈実施例4〉以下に本発明の実施例4を説
明する。本実施例は実施例2の変形であるため、相違点
についてのみ説明する。本実施例は、読みだしバッファ
に読みだしデータフィールドを設ける代わりに、リオー
ダバッファに格納したデータを読みだしデータとして利
用可能とする点が異なる。<Fourth Embodiment> A fourth embodiment of the present invention will be described below. Since this embodiment is a modification of the second embodiment, only different points will be described. The present embodiment is different in that instead of providing a read data field in the read buffer, the data stored in the reorder buffer can be used as read data.
【0136】図11は、本実施例の中央処理装置を示
す。FIG. 11 shows the central processing unit of this embodiment.
【0137】リオーダバッファ490は、エントリ毎に
リオーダバッファエントリの有効を示すエントリ有効フ
ラグ490a,レジスタ書き込み処理の分岐予測データ
を格納する分岐予測フィールド490b,レジスタ書き
込み処理に対応する分岐予測の誤りを示す分岐予測誤り
フラグ490c,レジスタへの書き込み値を保持するデ
ータフィールド490f,データフィールド490fの
値を書き込むレジスタ番号を保持する書き込みレジスタ
フィールド490g,読みだし命令フラグ490kのフィー
ルドを持つ。The reorder buffer 490 indicates, for each entry, an entry valid flag 490a indicating the validity of the reorder buffer entry, a branch prediction field 490b for storing branch prediction data for register write processing, and a branch prediction error corresponding to register write processing. It has a branch prediction error flag 490c, a data field 490f for holding the value written to the register, a write register field 490g for holding the register number for writing the value of the data field 490f, and a read instruction flag 490k.
【0138】リオーダバッファ490は、演算ユニット
440から受けた演算結果または主記憶アクセスユニッ
ト460から受けた読みだし結果を一旦格納し、レジス
タファイル430に書き込む。投機実行した命令につい
ては、分岐ユニット450から分岐実行結果を得て、分
岐予測が正しかった場合は投機実行した命令の結果をレ
ジスタファイル430に書き込むが、分岐予測が誤って
いた場合は投機実行した命令の結果をレジスタファイル
430に書き込まない。本実施例では、リオーダバッフ
ァ490は、従来のリオーダバッファの機能に加え、投
機実行し、分岐予測を誤った読みだし命令の読みだし結
果を保持する機能を持つ。Reorder buffer 490 temporarily stores the operation result received from operation unit 440 or the read result received from main memory access unit 460 and writes it in register file 430. For the speculatively executed instruction, the branch execution result is obtained from the branch unit 450, and if the branch prediction is correct, the result of the speculatively executed instruction is written to the register file 430, but if the branch prediction is incorrect, the speculative execution is executed. Do not write the result of the instruction to register file 430. In this embodiment, the reorder buffer 490 has a function of speculatively executing and holding a reading result of a branch prediction erroneous reading instruction in addition to the function of the conventional reorder buffer.
【0139】リオーダバッファ490に関する処理は、
リオーダバッファ書き込み処理,レジスタ書き込み処
理,分岐結果処理,リオーダバッファ解放処理,リオー
ダバッファ変更処理が存在する。以下に、リオーダバッ
ファ書き込み処理,分岐結果処理,レジスタ書き込み処
理,リオーダバッファ変更処理を説明する。The processing relating to the reorder buffer 490 is as follows.
There are reorder buffer write processing, register write processing, branch result processing, reorder buffer release processing, and reorder buffer change processing. The reorder buffer write processing, branch result processing, register write processing, and reorder buffer change processing will be described below.
【0140】(リオーダバッファ書き込み処理)リオー
ダバッファ490は、演算ユニット440,分岐ユニッ
ト450,主記憶アクセスユニット460のいずれかか
ら分岐予測データ,書き込みレジスタ番号,書き込みデ
ータを伴ったリオーダバッファ書き込み処理の要求を受
け、以下に示すリオーダバッファ書き込み処理を行う。(Reorder buffer write processing) The reorder buffer 490 requests the reorder buffer write processing accompanied by the branch prediction data, the write register number, and the write data from any one of the arithmetic unit 440, the branch unit 450, and the main memory access unit 460. In response, the reorder buffer write processing shown below is performed.
【0141】(1)エントリ有効フラグ490aが
“0”のエントリが存在する場合、当該エントリのエン
トリ有効フラグ490aを“1”,分岐予測フィールド
490bを分岐予測データ,分岐予測誤りフラグ490
cを“0”,書き込みレジスタフィールド490gを書
き込みレジスタ番号,データフィールド490fを書き
込みデータ値とし、エントリを確保する。(1) When the entry valid flag 490a has an entry of "0", the entry valid flag 490a of the entry is "1", the branch prediction field 490b is the branch prediction data, and the branch prediction error flag 490.
The entry is secured by setting c to “0”, the write register field 490g to the write register number, and the data field 490f to the write data value.
【0142】発行する命令が読みだし命令の場合にのみ
読みだし命令フラグ490kを“1”とし、エントリ番
号を読みだしバッファ480に返す。Only when the instruction to be issued is a read instruction, the read instruction flag 490k is set to "1", and the entry number is returned to the read buffer 480.
【0143】(2)エントリ有効フラグ490aが
“0”のエントリが存在せず、分岐予測誤りフラグが
“1”のエントリが存在する場合、当該エントリのエン
トリ有効フラグ490aを“1”,分岐予測フィールド
490bを分岐予測データ,分岐予測誤りフラグ490
cを“0”,データ有効フラグ490eを“0”,書き
込みレジスタフィールド490gを書き込みレジスタ番
号,書き込みデータをデータフィールド490fとし、
エントリを確保する。(2) If there is no entry having the entry valid flag 490a of "0" and there is an entry having the branch prediction error flag of "1", the entry valid flag 490a of the entry is set to "1" and the branch prediction is made. A field 490b is used as branch prediction data and a branch prediction error flag 490.
c is “0”, the data valid flag 490e is “0”, the write register field 490g is the write register number, and the write data is the data field 490f.
Reserve an entry.
【0144】発行する命令が読みだし命令の場合にのみ
読みだし命令フラグ490kを“1”とし、エントリ番
号を読みだしバッファ480に返す。Only when the instruction to be issued is a read instruction, the read instruction flag 490k is set to "1", and the entry number is returned to the read buffer 480.
【0145】この後、読みだしバッファ480に対して
当該エントリのリオーダバッファ番号と共にリオーダバ
ッファ解放処理を発行する。Thereafter, the reorder buffer release process is issued to the read buffer 480 together with the reorder buffer number of the entry.
【0146】(3)(1)および(2)以外の場合、使
用可能なリオーダバッファエントリが存在しないため、
(1)または(2)のいずれかの条件を満たすまでエン
トリ確保処理を受け付けず待つ。(3) In cases other than (1) and (2), since there is no reorder buffer entry that can be used,
The entry reservation process is not accepted and waits until either condition (1) or (2) is satisfied.
【0147】(レジスタ書き込み処理)リオーダバッフ
ァ490は、エントリ有効フラグ490aが“1”,分
岐予測フィールド490bが“00”のエントリが存在
する場合、以下の処理を行う。(Register Write Processing) The reorder buffer 490 performs the following processing when there is an entry with an entry valid flag 490a of "1" and a branch prediction field 490b of "00".
【0148】(1)当該エントリの書き込みレジスタフ
ィールド490gを書き込みレジスタ番号,データフィ
ールド490fをレジスタ書き込み値としてレジスタ書
き込みを行う。この後、当該エントリのエントリ有効フ
ラグ490aを“0”とする。読みだし命令フラグ49
0kが“1”の場合には、読みだしバッファ480に対
して当該エントリのリオーダバッファ番号と共にリオー
ダバッファ解放処理を発行する。(1) Register writing is performed using the write register field 490g of the entry as a write register number and the data field 490f of the entry as a register write value. After that, the entry valid flag 490a of the entry is set to "0". Read instruction flag 49
If 0k is "1", the reorder buffer release process is issued to the read buffer 480 together with the reorder buffer number of the entry.
【0149】(分岐結果処理)リオーダバッファ490
は、分岐ユニット450から分岐結果データを受けて、
以下に示す処理を行う。(Branch Result Processing) Reorder Buffer 490
Receives the branch result data from the branch unit 450,
The following processing is performed.
【0150】(1)エントリ有効フラグ490aが
“1”かつ、分岐予測フィールド490bが“10”ま
たは“11”かつ、分岐予測フィールド490bが分岐
結果データと一致する全てのエントリで、分岐予測フィ
ールド490bを“00”とし、分岐予測誤りフラグ4
90cを“0”とする。(1) The branch prediction field 490b is all entries in which the entry valid flag 490a is "1", the branch prediction field 490b is "10" or "11", and the branch prediction field 490b matches the branch result data. Is set to "00" and the branch prediction error flag 4
90c is set to "0".
【0151】(2)エントリ有効フラグ490aが
“1”かつ、分岐予測フィールド490bが“10”ま
たは“11”かつ、分岐予測フィールド480bが分岐
結果データと一致しない全てのエントリで、分岐予測フ
ィールド480bを分岐結果データとし、分岐予測誤り
フラグ480cを“1”とする。(2) The branch prediction field 480b is all entries in which the entry valid flag 490a is "1", the branch prediction field 490b is "10" or "11", and the branch prediction field 480b does not match the branch result data. Is set as the branch result data, and the branch prediction error flag 480c is set to "1".
【0152】この後、当該エントリが読みだし命令フラ
グ490kが“0”の場合、エントリ有効フラグ390
aを“0”とし、リオーダバッファエントリを解放す
る。Thereafter, when the read instruction flag 490k of the entry is "0", the entry valid flag 390 is entered.
A is set to "0" and the reorder buffer entry is released.
【0153】これにより、分岐予測を誤って実行した読
みだし命令に対応するリオーダバッファエントリについ
て、エントリを有効としたまま分岐予測の誤りを設定す
ることができる。Thus, with respect to the reorder buffer entry corresponding to the read instruction in which the branch prediction is erroneously executed, the branch prediction error can be set while the entry remains valid.
【0154】(リオーダバッファ変更処理)リオーダバ
ッファ490は、主記憶アクセスユニット460からリ
オーダバッファ番号,分岐予測データ,書き込みレジス
タ番号,書き込みデータを受け、以下に示すリオーダバ
ッファ変更処理を行う。(Reorder Buffer Change Processing) The reorder buffer 490 receives the reorder buffer number, branch prediction data, write register number, and write data from the main memory access unit 460, and performs the reorder buffer change processing shown below.
【0155】(1)リオーダバッファ番号に対応するリ
オーダバッファエントリの、分岐予測データ,書き込み
データ,書き込みレジスタ番号をそれぞれ順に分岐予測
データフィールド490b,データフィールド490
f,レジスタ番号フィールド490gに格納する。(1) Branch prediction data field 490b and data field 490 of branch prediction data, write data, and write register number of the reorder buffer entry corresponding to the reorder buffer number, respectively.
f, stored in the register number field 490g.
【0156】(2)分岐予測誤りビット490cを
“0”とし、読みだし命令フラグ490kを“1”とす
る。(2) The branch prediction error bit 490c is set to "0" and the read instruction flag 490k is set to "1".
【0157】読みだしバッファ480は、エントリ毎に
読みだし要求の有効を示すエントリ有効フラグ480
a,読みだし命令の分岐予測データを格納する分岐予測
フィールド480b,読みだし命令に対応する分岐予測
の誤りを示す分岐予測誤りフラグ480c,読みだしア
ドレスフィールド480d,主記憶の読みだしが完了し
たことを示す読みだし完了フラグ480e,主記憶読み
だし結果を格納するリオーダバッファ番号フィールド4
80f,主記憶読みだし結果を格納するリオーダバッフ
ァエントリが存在することを示すリオーダバッファ存在
フラグ480j,主記憶読みだし結果を書き込むレジス
タ番号を示すレジスタフィールド480g,後続の読み
だし命令が当該エントリのデータを使うことを許可する
読みだし許可フラグ480h,書き込みバッファ470
の書き込みデータを読みだしデータとして使用する場合
の分岐予測データを格納する書き込みデータ分岐予測フ
ィールド480iのフィールドを持つ。The read buffer 480 has an entry valid flag 480 indicating the validity of the read request for each entry.
a, a branch prediction field 480b for storing the branch prediction data of the read instruction, a branch prediction error flag 480c indicating a branch prediction error corresponding to the read instruction, a read address field 480d, and the reading of the main memory being completed. Reading completion flag 480e indicating the number, and a reorder buffer number field 4 for storing the main memory reading result
80f, a reorder buffer existence flag 480j indicating that there is a reorder buffer entry for storing the main memory read result, a register field 480g indicating a register number for writing the main memory read result, and a subsequent read instruction has data of the entry. Read permission flag 480h, write buffer 470 that permits the use of
Has a field of a write data branch prediction field 480i for storing branch prediction data when the write data of is used as read data.
【0158】本実施例では、実施例2の読みだし発行処
理,分岐結果処理,データ到着処理を以下に示すように
変更し、リオーダバッファ解放処理を追加する。In this embodiment, the read issue processing, branch result processing, and data arrival processing of the second embodiment are modified as follows, and reorder buffer release processing is added.
【0159】(読みだし発行処理)読みだしバッファ4
80は、書き込みバッファ470から読みだしアドレ
ス,リオーダバッファ番号,分岐予測データおよび書き
込みレジスタ番号を受信し、以下に示す読みだし発行処
理を行う。(Read issuing processing) Read buffer 4
80 receives the read address, the reorder buffer number, the branch prediction data, and the write register number from the write buffer 470, and performs the read issue processing shown below.
【0160】(1)エントリ有効フラグ480aおよび
読みだし許可フラグ480hが“1”、かつ、読みだし
アドレスと読みだしバッファエントリの読みだしアドレ
スフィールド480dが一致した場合、以下の処理を行
う。(1) When the entry valid flag 480a and the read permission flag 480h are "1" and the read address and the read address field 480d of the read buffer entry match, the following processing is performed.
【0161】(1a)分岐予測誤りフラグ480cが
“1”かつ、リオーダバッファ存在フラグ480jが
“1”の場合、当該エントリの分岐予測フィールド48
0bを分岐予測データ,レジスタフィールド480gを
書き込みレジスタ番号,分岐予測誤りフラグ480cを
“0”に設定する。(1a) When the branch prediction error flag 480c is "1" and the reorder buffer existence flag 480j is "1", the branch prediction field 48 of the entry concerned.
0b is set to branch prediction data, register field 480g is set to a write register number, and branch prediction error flag 480c is set to "0".
【0162】読みだし発行処理に書き込みデータフィー
ルド470dおよび書き込みデータの分岐予測フィール
ド470bが伴っている場合、当該読みだしバッファエ
ントリの書き込みデータ分岐予測フィールド480iに
書き込みデータの分岐予測フィールド470bの値を書
き込み、主記憶読みだし完了フラグ480eを“1”と
する。この後、主記憶アクセスユニット460を経由し
てリオーダバッファ490にリオーダバッファ番号48
0f,分岐予測データ,書き込みレジスタ番号,書き込
みデータを与え、リオーダバッファ変更処理を発行す
る。When the read issue processing is accompanied by the write data field 470d and the write data branch prediction field 470b, the value of the write data branch prediction field 470b is written in the write data branch prediction field 480i of the read buffer entry. The main memory read completion flag 480e is set to "1". Thereafter, the reorder buffer number 480 is transferred to the reorder buffer 490 via the main memory access unit 460.
0f, branch prediction data, write register number, and write data are given, and reorder buffer change processing is issued.
【0163】読みだし発行処理に書き込みデータフィー
ルド470dおよび書き込みデータの分岐予測フィール
ド470bが伴っていない場合、書き込みデータ分岐予
測フィールド480iを“00”,読みだしアドレスフ
ィールド480dを読みだしアドレスとし、当該エント
リのエントリ番号を読みだしバッファ番号として、記憶
制御回路400に主記憶アクセスを発行する。If the read data issuing process does not involve the write data field 470d and the write data branch prediction field 470b, the write data branch prediction field 480i is set to "00" and the read address field 480d is set to the read address, and the entry concerned is set. The main memory access is issued to the memory control circuit 400 by using the entry number of 1 as the read buffer number.
【0164】(1b)分岐予測誤りフラグ480cが
“1”かつ、リオーダバッファ存在フラグ480jが
“0”の場合、このエントリの読みだしアドレスフィー
ルド480d,分岐予測フィールド480b,レジスタ
フィールド480gを読みだし発行の読みだしアドレ
ス,分岐予測データ,レジスタ番号に設定し、エントリ
有効ビット480aおよび読みだし許可フラグ480h
を“1”,分岐予測誤りフラグ480cおよび読みだし
完了フラグ480eを“0”に設定する。(1b) When the branch prediction error flag 480c is "1" and the reorder buffer existence flag 480j is "0", the read address field 480d, branch prediction field 480b, and register field 480g of this entry are read and issued. Read address, branch prediction data, register number, entry valid bit 480a and read enable flag 480h.
Is set to "1", the branch prediction error flag 480c and the read completion flag 480e are set to "0".
【0165】読みだし発行処理に書き込みデータフィー
ルド470dおよび書き込みデータの分岐予測フィール
ド470bが伴っている場合、当該読みだしバッファエ
ントリの書き込みデータ分岐予測フィールド480iに
書き込みデータの分岐予測フィールド470bの値を書
き込み、リオーダバッファ存在フラグ480jおよび主
記憶読みだし完了フラグ480eを“1”とする。この
後、主記憶アクセスユニット460を経由してリオーダ
バッファ490に分岐予測データ,書き込みレジスタ番
号,書き込みデータを与え、リオーダバッファ書き込み
処理を発行し、リオーダバッファ490からリオーダバ
ッファ番号を得て、リオーダバッファ番号フィールド4
80fに格納する。When the read issue processing is accompanied by the write data field 470d and the write data branch prediction field 470b, the value of the write data branch prediction field 470b is written in the write data branch prediction field 480i of the read buffer entry. , The reorder buffer existence flag 480j and the main memory read completion flag 480e are set to "1". After that, the branch prediction data, the write register number, and the write data are given to the reorder buffer 490 via the main memory access unit 460, the reorder buffer write processing is issued, the reorder buffer number is obtained from the reorder buffer 490, and the reorder buffer 490 is obtained. Number field 4
Store in 80f.
【0166】読みだし発行処理に書き込みデータフィー
ルド470dおよび書き込みデータの分岐予測フィール
ド470bが伴っていない場合、書き込みデータ分岐予
測フィールド480iを“00”,読みだしアドレスフ
ィールド480dを読みだしアドレスとし、当該エント
リのエントリ番号を読みだしバッファ番号として、記憶
制御回路400に主記憶アクセスを発行する。If the read data issuing process does not involve the write data field 470d and the write data branch prediction field 470b, the write data branch prediction field 480i is set to "00" and the read address field 480d is set to the read address, and the entry concerned is set. The main memory access is issued to the memory control circuit 400 by using the entry number of 1 as the read buffer number.
【0167】(2)(1)の条件に該当せず、エントリ
有効フラグ480aが“0”であるエントリが存在する
場合、このエントリの読みだしアドレスフィールド48
0d,分岐予測フィールド480b,レジスタフィール
ド480gを読みだし発行の読みだしアドレス,分岐予
測データ,レジスタ番号に設定し、エントリ有効フラグ
480aおよび読みだし許可フラグ480hを“1”,
分岐予測誤りフラグ480cおよび読みだし完了フラグ
480eを“0”に設定する。(2) If the entry which does not satisfy the conditions of (1) and the entry valid flag 480a is "0" exists, the read address field 48 of this entry is present.
0d, the branch prediction field 480b, and the register field 480g are set to the read address of read issue, the branch prediction data, and the register number, and the entry valid flag 480a and the read permission flag 480h are set to "1",
The branch prediction error flag 480c and the read completion flag 480e are set to "0".
【0168】読みだし発行処理に書き込みデータフィー
ルド470dおよび書き込みデータの分岐予測フィール
ド470bが伴っている場合、当該読みだしバッファエ
ントリの書き込みデータ分岐予測フィールド480iに
書き込みデータの分岐予測フィールド470bの値を書
き込み、リオーダバッファ存在フラグ480j,読みだ
し完了フラグ480eを“1”とする。この後、主記憶
アクセスユニット460を経由してリオーダバッファ49
0に分岐予測データ,書き込みレジスタ番号,書き込み
データを与え、リオーダバッファ書き込み処理を発行
し、リオーダバッファ490からリオーダバッファ番号
を得て、リオーダバッファ番号フィールド480fに格
納する。When the read issue processing is accompanied by the write data field 470d and the write data branch prediction field 470b, the value of the write data branch prediction field 470b is written in the write data branch prediction field 480i of the read buffer entry. , The reorder buffer existence flag 480j and the read completion flag 480e are set to "1". After this, the reorder buffer 49 is passed via the main memory access unit 460.
The branch prediction data, the write register number, and the write data are given to 0, the reorder buffer write processing is issued, the reorder buffer number is obtained from the reorder buffer 490, and stored in the reorder buffer number field 480f.
【0169】読みだし発行処理に書き込みデータフィー
ルド470dおよび書き込みデータの分岐予測フィール
ド470bが伴っていない場合、書き込みデータ分岐予
測フィールド480iを“00”,読みだしアドレスフ
ィールド480dを読みだしアドレスとし、当該エント
リのエントリ番号を読みだしバッファ番号とし、リオー
ダバッファ存在フラグ480jを“0”として、記憶制
御回路400に主記憶アクセスを発行する。When the read issue processing is not accompanied by the write data field 470d and the write data branch prediction field 470b, the write data branch prediction field 480i is set to "00" and the read address field 480d is set to the read address, and the entry concerned is set. The main memory access is issued to the storage control circuit 400 by setting the entry number of 1 as the read buffer number and setting the reorder buffer existence flag 480j to "0".
【0170】(3)(1),(2)の条件に該当せず、エ
ントリ有効フラグ480aおよび読みだし完了フラグ4
80eが“1”かつ、読みだし許可フラグ480hが
“0”かつ、読みだしアドレスと読みだしバッファエン
トリの読みだしアドレスフィールド480dが一致する
エントリが存在する場合、(2)と同一の動作を行う。(3) The entry valid flag 480a and the read completion flag 4 are not satisfied because the conditions (1) and (2) are not satisfied.
If 80e is "1", the read permission flag 480h is "0", and there is an entry in which the read address and the read address field 480d of the read buffer entry match, the same operation as (2) is performed. .
【0171】(4)(1),(2),(3)の条件に該当
せず、エントリ有効フラグ480a,読みだし許可フラ
グ480hが全て“1”のエントリが存在する場合、
(2)と同一の動作を行う。(4) If the conditions of (1), (2), and (3) are not satisfied and the entry valid flag 480a and the read permission flag 480h are all "1",
The same operation as (2) is performed.
【0172】(5)(1)から(4)のいずれの条件に
も該当しない場合、(1)から(4)のいずれかが実行
できるまで新たな読みだし発行処理を受け付けず待つ。(5) When none of the conditions (1) to (4) is satisfied, the new reading and issuing process is not accepted and waits until either (1) to (4) can be executed.
【0173】以上により、読みだしバッファエントリが
全て有効の場合に、分岐予測が誤った読みだしバッファ
エントリを消去して使用することができる。As described above, when all the read buffer entries are valid, the read buffer entries with incorrect branch prediction can be erased and used.
【0174】(分岐結果処理)読みだしバッファ480
は、分岐ユニット450から分岐結果データを受けて、
以下に示す分岐結果処理を行う。(Branch Result Processing) Read Buffer 480
Receives the branch result data from the branch unit 450,
The following branch result processing is performed.
【0175】(1)エントリ有効フラグ480aが
“1”かつ、分岐予測フィールド480bが“10”ま
たは“11”かつ、分岐予測フィールド480bが分岐
結果データと一致する全てのエントリで、(1a)書き
込みデータ命令予測フィールド480iが“00”また
は、分岐結果データと一致する場合、分岐予測フィール
ド480bおよび書き込みデータ命令予測フィールド48
0iを“00”とし、分岐予測誤りフラグ480cを
“0”とする。(1) Write (1a) in all entries in which the entry valid flag 480a is "1", the branch prediction field 480b is "10" or "11", and the branch prediction field 480b matches the branch result data. If the data instruction prediction field 480i is "00" or matches the branch result data, the branch prediction field 480b and the write data instruction prediction field 48
0i is set to "00" and the branch prediction error flag 480c is set to "0".
【0176】(1b)(1a)以外の場合、読みだし許
可フラグ480hを“0”とする。(1b) In cases other than (1a), the read permission flag 480h is set to "0".
【0177】(2)エントリ有効フラグ480aが
“1”かつ、分岐予測フィールド480bが“10”ま
たは“11”かつ、分岐予測フィールド480bが分岐
結果データと一致しない全てのエントリで、(2a)書
き込みデータ命令予測フィールド480iが“00”ま
たは、分岐結果データと一致する場合、分岐予測フィー
ルド480bを分岐結果データとし、分岐予測誤りフラ
グ480cを“1”とする。(2) Write (2a) in all entries where the entry valid flag 480a is "1", the branch prediction field 480b is "10" or "11", and the branch prediction field 480b does not match the branch result data. When the data instruction prediction field 480i is "00" or matches the branch result data, the branch prediction field 480b is set as the branch result data, and the branch prediction error flag 480c is set at "1".
【0178】(2b)(2a)以外の場合、読みだし許
可フラグ480hを“0”とする。(2b) In cases other than (2a), the read permission flag 480h is set to "0".
【0179】これにより、読みだし命令発行時に、書き
込みバッファ470のデータを読みだし結果とし、書き
込みデータが分岐予測誤りのため実行されない場合に、
当該読みだしバッファエントリを使用不可とすることが
できる。As a result, when the read instruction is issued, the data in the write buffer 470 is used as the read result, and when the write data is not executed due to a branch prediction error,
The read buffer entry can be made unusable.
【0180】(データ到着処理)読みだしバッファ48
0は、記憶制御回路400から主記憶読みだし結果のデ
ータと読みだしバッファ番号を受信し、以下の処理を行
う。(Data arrival processing) Read buffer 48
0 receives the main memory read result data and the read buffer number from the storage control circuit 400, and performs the following processing.
【0181】(1)読みだしバッファ番号で指定される
読みだしバッファエントリの、読みだし完了フラグ48
0eを“1”とする。(1) Reading completion flag 48 of the reading buffer entry designated by the reading buffer number
0e is set to "1".
【0182】(2)当該エントリのリオーダバッファ存
在フラグ480fが“1”の場合、主記憶アクセスユニ
ット460を経由してリオーダバッファ490に分岐予
測データ,書き込みレジスタ番号,書き込みデータを与
え、リオーダバッファ変更処理を発行する。(2) When the reorder buffer existence flag 480f of the entry is "1", branch prediction data, write register number, and write data are given to the reorder buffer 490 via the main memory access unit 460 to change the reorder buffer. Issue the process.
【0183】(3)(2)以外の場合、主記憶アクセス
ユニット460を経由してリオーダバッファ490に分
岐予測データ,書き込みレジスタ番号,書き込みデータ
を与え、リオーダバッファ書き込み処理を発行し、リオ
ーダバッファ490からリオーダバッファ番号を得て、
リオーダバッファ番号フィールド480fに格納する。(3) In cases other than (2), branch prediction data, write register number, and write data are given to the reorder buffer 490 via the main memory access unit 460, reorder buffer write processing is issued, and the reorder buffer 490 is issued. Get the reorder buffer number from
It is stored in the reorder buffer number field 480f.
【0184】(リオーダバッファ解放処理)読みだしバ
ッファ490は、リオーダバッファ480からリオーダ
バッファ番号を受け、以下の処理を行う。(Reorder Buffer Release Processing) The read buffer 490 receives the reorder buffer number from the reorder buffer 480 and performs the following processing.
【0185】(1)リオーダバッファ番号フィールド4
80fがリオーダバッファ番号と一致する全ての読みだ
しバッファエントリのリオーダバッファ存在フラグ48
0jを“0”とする。(1) Reorder buffer number field 4
Reorder buffer existence flag 48 of all read buffer entries whose 80f matches the reorder buffer number
0j is set to "0".
【0186】読みだしバッファ480に読みだしデータ
フィールドを設ける代わりに、リオーダバッファ番号フ
ィールド480fおよびリオーダバッファ存在フラグ48
0jを設けたことにより、分岐予測を誤った読みだし命令
の読みだし結果をリオーダバッファ490に格納し、後
続の同一アドレスへの読みだし命令で利用可能とするこ
とにより、実施例2と比較してハードウェア量を削減で
きる。Instead of providing a read data field in the read buffer 480, a reorder buffer number field 480f and a reorder buffer existence flag 48 are provided.
Since 0j is provided, the result of reading a branch prediction erroneous read instruction is stored in the reorder buffer 490 and can be used in the subsequent read instruction to the same address. Can reduce the amount of hardware.
【0187】[0187]
【発明の効果】本発明によれば、分岐予測を誤った場合
でも投機実行した読みだし命令の読みだし結果が利用可
能となり、分岐予測が誤った読みだし命令と同一アドレ
スに読みだしを発行した場合の読みだし結果の待ち時間
を短縮することができ、中央処理装置の性能を向上する
ことができる。According to the present invention, the reading result of a speculatively executed reading instruction can be used even if the branch prediction is wrong, and the reading is issued to the same address as the reading instruction with the wrong branch prediction. In this case, the waiting time for the read result can be shortened and the performance of the central processing unit can be improved.
【図1】本発明の実施例1の中央処理装置のブロック
図。FIG. 1 is a block diagram of a central processing unit according to a first embodiment of the present invention.
【図2】本発明の実施例1の動作例のプログラムのフロ
ーシート。FIG. 2 is a flow chart of a program of an operation example of the first embodiment of the present invention.
【図3】本発明の実施例1の動作例のプログラムの動作
を示す説明図。FIG. 3 is an explanatory diagram showing the operation of the program of the operation example of the first embodiment of the present invention.
【図4】本発明の実施例1の動作例のプログラムの動作
を示す説明図。FIG. 4 is an explanatory diagram showing the operation of the program of the operation example of the first embodiment of the present invention.
【図5】本発明の実施例1の動作の読みだしバッファの
内容を示す説明図。FIG. 5 is an explanatory diagram showing the contents of the read buffer of the operation according to the first embodiment of the present invention.
【図6】本発明の実施例1の動作の読みだしバッファの
内容を示す説明図。FIG. 6 is an explanatory diagram showing the contents of the read buffer of the operation of the first embodiment of the present invention.
【図7】本発明の実施例2の中央処理装置のブロック
図。FIG. 7 is a block diagram of a central processing unit according to a second embodiment of the present invention.
【図8】本発明の実施例2の動作例のプログラムのフロ
ーチャート。FIG. 8 is a flowchart of a program of an operation example according to the second embodiment of the present invention.
【図9】本発明の実施例2の動作の読みだしバッファお
よび書き込みバッファの内容を示す説明図。FIG. 9 is an explanatory diagram showing the contents of a read buffer and a write buffer in the operation according to the second embodiment of the present invention.
【図10】本発明の実施例3の中央処理装置のブロック
図。FIG. 10 is a block diagram of a central processing unit according to a third embodiment of the present invention.
【図11】本発明の実施例4の中央処理装置のブロック
図。FIG. 11 is a block diagram of a central processing unit according to a fourth embodiment of the present invention.
100…記憶制御回路、102…バス、110…分岐予
測回路、120…命令発行回路、130…レジスタファ
イル、140…演算ユニット、150…分岐ユニット、
160…主記憶アクセスユニット、170…書き込みバ
ッファ、170a…エントリ有効フラグ、170b…分岐予
測フィールド、170c…書き込みアドレスフィール
ド、170d…書き込みデータフィールド、180…読
みだしバッファ、180a…エントリ有効フラグ、18
0b…分岐予測フィールド、180c…分岐予測誤りフラ
グ、180d…読みだしアドレスフィールド、180e
…読みだし完了フラグ、180f…読みだしデータフィ
ールド、180g…書き込みレジスタフィールド、18
0h…読みだし許可フラグ、190…リオーダバッフ
ァ。100 ... Storage control circuit, 102 ... Bus, 110 ... Branch prediction circuit, 120 ... Instruction issuing circuit, 130 ... Register file, 140 ... Arithmetic unit, 150 ... Branch unit,
160 ... Main memory access unit, 170 ... Write buffer, 170a ... Entry valid flag, 170b ... Branch prediction field, 170c ... Write address field, 170d ... Write data field, 180 ... Read buffer, 180a ... Entry valid flag, 18
0b ... Branch prediction field, 180c ... Branch prediction error flag, 180d ... Read address field, 180e
... Reading completion flag, 180f ... Reading data field, 180g ... Write register field, 18
0h ... reading permission flag, 190 ... reorder buffer.
Claims (12)
読みだし要求を格納する読みだしバッファと1以上の主
記憶書き込み要求を格納する書き込みバッファを具備す
る1以上の主記憶アクセスユニットと、分岐予測回路
と、記憶制御回路とを具備する中央処理装置において、
前記読みだしバッファは、各読みだしバッファエントリ
毎にエントリ有効フラグと、1以上の分岐予測の結果実
行されると判断された場合に各分岐予測の方向を特定す
るための分岐予測フィールドと、前記エントリが分岐予
測の誤りにより実行されないことを示す分岐予測誤りビ
ットと、読みだしアドレスフィールドと、読みだしデー
タフィールドと、主記憶読みだし完了フラグを具備し、
分岐予測を誤った場合でも読みだし要求有効フラグが有
効を示す前記読みだしバッファエントリ内の読みだしデ
ータフィールドが利用可能であることを特徴とする中央
処理装置。1. A one or more main memory access unit comprising one or more branch units, a read buffer for storing one or more main memory read requests, and a write buffer for storing one or more main memory write requests. In a central processing unit including a branch prediction circuit and a storage control circuit,
The read buffer has an entry valid flag for each read buffer entry, a branch prediction field for specifying the direction of each branch prediction when it is determined to be executed as a result of one or more branch predictions, A branch prediction error bit indicating that the entry is not executed due to an error in branch prediction, a read address field, a read data field, and a main memory read completion flag,
A central processing unit, characterized in that the read data field in the read buffer entry, which indicates that the read request valid flag is valid, is available even if the branch prediction is incorrect.
定するための分岐予測データを生成し、全ての命令に付
加する請求項1に記載の中央処理装置。2. The central processing unit according to claim 1, wherein the branch prediction circuit generates branch prediction data for specifying a direction of branch prediction and adds it to all instructions.
みだし命令実行時に前記読みだしバッファに前記読みだ
しバッファエントリを確保し、前記読みだしバッファエ
ントリのエントリ有効フラグを有効とし、前記主記憶読
みだし命令の分岐予測データを、前記読みだしバッファ
エントリの分岐予測フィールドに記憶し、前記主記憶読
みだし命令の対象アドレスを、前記読みだしバッファエ
ントリの読みだしアドレスフィールドに記憶し、前記読
みだしバッファエントリの分岐予測誤りフラグを誤り無
しと設定し、前記読みだしバッファエントリの読みだし
完了フラグを未完と設定し、読みだしアクセスを記憶制
御回路に対して発行する請求項1または請求項2に記載
の中央処理装置。3. The main memory access unit secures the read buffer entry in the read buffer when executing a main memory read instruction, validates an entry valid flag of the read buffer entry, and reads the main memory read. The branch prediction data of the read instruction is stored in the branch prediction field of the read buffer entry, the target address of the main memory read instruction is stored in the read address field of the read buffer entry, and the read buffer is stored. 3. The branch prediction error flag of an entry is set as no error, the read completion flag of the read buffer entry is set as incomplete, and a read access is issued to the storage control circuit. Central processing unit.
制御回路から記憶装置の読みだし結果が戻ると、読みだ
し結果を対応する読みだしバッファエントリの読みだし
データフィールドに格納し、前記読みだしバッファエン
トリの読みだし完了フラグを完了と設定する請求項1,
2または3に記載の中央処理装置。4. The main memory access unit stores the read result in the read data field of the corresponding read buffer entry when the read result of the storage device is returned from the storage control circuit, and the read buffer. The read completion flag of the entry is set to "complete".
The central processing unit according to 2 or 3.
主記憶アクセスユニット内の全ての前記読みだしバッフ
ァエントリの前記分岐予測フィールドと実際に分岐を実
行してきた方向を比較し、分岐予測が誤っている全ての
前記読みだしバッファエントリの分岐予測誤りフラグを
誤りと設定する請求項1,2,3または4に記載の中央
処理装置。5. The branch unit compares the branch prediction fields of all the read buffer entries in the main memory access unit with the actual execution direction of the branch when the branch is executed, and the branch prediction is incorrect. The central processing unit according to claim 1, 2, 3 or 4, wherein the branch prediction error flags of all the read buffer entries are set as an error.
憶書き込み命令の実行時に、分岐予測誤りフラグが誤り
を示す全ての読みだしバッファエントリの読みだしアド
レスフィールドと、書き込みアドレスの一部乃至全部の
ビットを比較し、一致した全ての読みだしバッファエン
トリのエントリ有効ビットを無効と設定する請求項1,
2,3,4または5に記載の中央処理装置。6. The main memory access unit, when executing the main memory write instruction, reads the read address field of all read buffer entries in which a branch prediction error flag indicates an error, and a part or all of the write address. 2. The bits are compared, and the entry valid bits of all the read buffer entries that match are set as invalid.
The central processing unit according to 2, 3, 4 or 5.
憶読みだし命令の実行時にエントリ有効フラグが有効か
つ分岐予測誤りフラグが誤りを示す全ての読みだしバッ
ファエントリの読みだしアドレスフィールドと、主記憶
読みだし命令の読みだしアドレスを比較し、一致した読
みだしバッファエントリに対応する読みだしデータを、
主記憶読みだし命令の読みだし結果として使用する請求
項1,2,3,4,5または6に記載の中央処理装置。7. The main memory access unit includes a read address field of all read buffer entries in which an entry valid flag is valid and a branch prediction error flag indicates an error when the main memory read instruction is executed, and a main memory. The read addresses of the read instructions are compared, and the read data corresponding to the matched read buffer entry is
7. The central processing unit according to claim 1, 2, 3, 4, 5 or 6, which is used as a reading result of a main memory reading instruction.
アドレスおよびデータを一旦保持する1以上の書き込み
バッファエントリからなり、前記主記憶アクセスユニッ
トは、主記憶読みだし命令実行時に読みだしアドレスと
書き込みバッファ内の全ての有効な書き込みバッファエ
ントリの書き込みアドレスフィールドとを比較し、一致
するエントリがある場合には前記書き込みバッファエン
トリの書き込みデータフィールドを主記憶読みだし結果
として使用する点が異なる請求項1,2,3,4,5,
6または7に記載の中央処理装置。8. The write buffer comprises one or more write buffer entries for temporarily holding an address and data of a write instruction, and the main memory access unit has a read address and a write buffer within the write buffer when a main memory read instruction is executed. The write address fields of all the valid write buffer entries of the above are compared, and if there is a matching entry, the write data field of the write buffer entry is used as the main memory read result. , 3, 4, 5,
The central processing unit according to 6 or 7.
命令以前の分岐命令で分岐または非分岐を選択してきた
方を記録する分岐実行データを保持し、読みだしバッフ
ァの各読みだしバッファエントリに分岐予測誤りフラグ
を設ける代わりに、分岐実行データと各読みだしバッフ
ァエントリの分岐予測フィールドを比較して予測と実行
命令が一致した場合に分岐予測誤り無しと判断する点が
異なる請求項1,2,3,4,5,6,7または8に記
載の中央処理装置。9. The branch unit holds branch execution data for recording which of the branch instructions before execution of the instruction being executed selects branch or non-branch, and each read buffer entry of the read buffer. 3. Instead of providing a branch prediction error flag in, the branch execution data and the branch prediction field of each read buffer entry are compared, and when the prediction and the execution instruction match, it is judged that there is no branch prediction error. The central processing unit according to 2, 3, 4, 5, 6, 7 or 8.
読みだし命令の実行時に読みだしバッファの全ての読み
だしバッファエントリのエントリ有効ビットが有効であ
る場合、分岐予測誤りデータが誤りを示す読みだし要求
を廃棄し、前記主記憶読みだし命令の読みだし要求を登
録する点が異なる請求項1,2,3,4,5,6,7,
8または9に記載の中央処理装置。10. The main memory access unit, when the main memory read instruction is executed, if the entry valid bits of all the read buffer entries in the read buffer are valid, the branch prediction error data indicates a read error. A difference is that the request is discarded and the read request of the main memory read instruction is registered.
8. The central processing unit according to 8 or 9.
しバッファと書き込みバッファを別個に設ける代わりに
読みだし要求と書き込み要求の双方を登録することがで
きるバッファを設ける点が異なる請求項1,2,3,
4,5,6,7,8,9または10に記載の中央処理装
置。11. The main memory access unit is different in that a buffer capable of registering both a read request and a write request is provided instead of separately providing a read buffer and a write buffer. Three
The central processing unit according to 4, 5, 6, 7, 8, 9 or 10.
フィールドを設ける代わりに、リオーダバッファ番号フ
ィールドおよびリオーダバッファ存在フラグを設け、読
みだしたデータをリオーダバッファに直接書き込む請求
項1,2,3,4,5,6,7,8,9,10または1
1に記載の中央処理装置。12. A reorder buffer number field and a reorder buffer existence flag are provided in place of providing the read data field in the read buffer, and the read data is directly written in the reorder buffer. , 5, 6, 7, 8, 9, 10, or 1
The central processing unit according to 1.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP05132296A JP3473249B2 (en) | 1996-03-08 | 1996-03-08 | Central processing unit |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP05132296A JP3473249B2 (en) | 1996-03-08 | 1996-03-08 | Central processing unit |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPH09244892A JPH09244892A (en) | 1997-09-19 |
| JP3473249B2 true JP3473249B2 (en) | 2003-12-02 |
Family
ID=12883688
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP05132296A Expired - Fee Related JP3473249B2 (en) | 1996-03-08 | 1996-03-08 | Central processing unit |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP3473249B2 (en) |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP3565314B2 (en) | 1998-12-17 | 2004-09-15 | 富士通株式会社 | Branch instruction execution controller |
| JP3518510B2 (en) | 2001-01-10 | 2004-04-12 | 日本電気株式会社 | Reorder buffer management method and processor |
| US8006078B2 (en) | 2007-04-13 | 2011-08-23 | Samsung Electronics Co., Ltd. | Central processing unit having branch instruction verification unit for secure program execution |
| JP5552042B2 (en) | 2010-12-27 | 2014-07-16 | インターナショナル・ビジネス・マシーンズ・コーポレーション | Program analysis method, system and program |
-
1996
- 1996-03-08 JP JP05132296A patent/JP3473249B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JPH09244892A (en) | 1997-09-19 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP3729087B2 (en) | Multiprocessor system, data-dependent speculative execution control device and method thereof | |
| US9471325B2 (en) | Method and apparatus for selective renaming in a microprocessor | |
| JPH0619707A (en) | Information processor | |
| JPH05204709A (en) | Processor | |
| CA2367324C (en) | Re-order buffer managing method and processor | |
| JP3473249B2 (en) | Central processing unit | |
| JP3727244B2 (en) | Cache system control circuit | |
| JP2001092657A (en) | Central processing unit, compiling method, and recording medium recording compiling program | |
| JP6520416B2 (en) | Arithmetic processing apparatus and processing method of arithmetic processing apparatus | |
| JP3800533B2 (en) | Program counter control method and processor | |
| EP0969358A2 (en) | Information processing device and method for performing parallel processing | |
| WO1999045463A1 (en) | Information processor | |
| US6959377B2 (en) | Method and system for managing registers | |
| JPH11110214A (en) | Instruction control system and method | |
| JP3497087B2 (en) | Instruction control apparatus and method | |
| US20050125634A1 (en) | Processor and instruction control method | |
| JP3854200B2 (en) | Processor and instruction control method | |
| JP2894438B2 (en) | Pipeline processing equipment | |
| CN121597288B (en) | Instruction speculation execution method, apparatus and storage medium for vector processor | |
| US20250036409A1 (en) | Processor | |
| JP2953451B2 (en) | Interrupt handling method | |
| CN117453290A (en) | Execution method and device in out-of-order core based on RISCV-V instruction set | |
| CN121597282A (en) | Loading storage units, data acquisition methods, chips and computer equipment | |
| WO2026042576A1 (en) | Processor and pipeline processing method | |
| CN120085918A (en) | Instruction processing method, device, processor and computer equipment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| LAPS | Cancellation because of no payment of annual fees |