JP3419276B2 - Instruction prefetch apparatus and instruction prefetch method - Google Patents

Instruction prefetch apparatus and instruction prefetch method

Info

Publication number
JP3419276B2
JP3419276B2 JP28519297A JP28519297A JP3419276B2 JP 3419276 B2 JP3419276 B2 JP 3419276B2 JP 28519297 A JP28519297 A JP 28519297A JP 28519297 A JP28519297 A JP 28519297A JP 3419276 B2 JP3419276 B2 JP 3419276B2
Authority
JP
Japan
Prior art keywords
instruction
condition
address
branch
prefetch
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
Application number
JP28519297A
Other languages
Japanese (ja)
Other versions
JPH10187442A (en
Inventor
幸治 材木
哲也 田中
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic Corp
Panasonic Holdings Corp
Original Assignee
Panasonic Corp
Matsushita Electric Industrial Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Panasonic Corp, Matsushita Electric Industrial Co Ltd filed Critical Panasonic Corp
Priority to JP28519297A priority Critical patent/JP3419276B2/en
Publication of JPH10187442A publication Critical patent/JPH10187442A/en
Application granted granted Critical
Publication of JP3419276B2 publication Critical patent/JP3419276B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】本発明は、命令プリフェッチ
装置、および命令プリフェッチ方法に関し、特にプロセ
ッサにおいて、パイプライン処理を効率的に実行し得る
命令プリフェッチ装置、および命令プリフェッチ方法に
関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an instruction prefetch device and an instruction prefetch method, and more particularly to an instruction prefetch device and an instruction prefetch method capable of efficiently executing pipeline processing in a processor.

【0002】[0002]

【従来の技術】現在、ほとんどのコンピュータにおいて
は、データと同様にプログラムをも記憶装置に格納し、
これを読み出して実行するノイマン型アーキテクチャが
採用されている。一般にノイマン型コンピュータは、プ
ログラムの実行を制御するCPU等のプロセッサと、プ
ログラムやデータを一時的に記憶する主記憶とを備えた
コンピュータを主体として、ユーザや外部との入出力を
行うI/O(入出力装置)や、プログラムやデータを長
期的に記憶する補助記憶装置(二次記憶装置)などを有
するコンピュータシステムとして実現される。
2. Description of the Related Art Currently, most computers store programs as well as data in storage devices.
The Neumann architecture for reading and executing this is adopted. Generally, a Neumann computer mainly comprises a computer having a processor such as a CPU for controlling execution of programs and a main memory for temporarily storing programs and data, and I / O for inputting / outputting data to / from a user or the outside. It is realized as a computer system having an (input / output device) and an auxiliary storage device (secondary storage device) for storing programs and data for a long time.

【0003】プロセッサの制御によるプログラムの実行
においては、主記憶に格納したプログラムの命令を読み
取り、その内容に基づいて、計算機各部分に制御信号を
送る命令処理が行われるものであって、このためプロセ
ッサ内部には、実行すべき命令の主記憶における格納場
所を指定するプログラムカウンタや、命令を格納する命
令レジスタ等のレジスタを備えている。
In executing a program under the control of a processor, an instruction process for reading a command of a program stored in a main memory and sending a control signal to each part of a computer is executed based on the content thereof. Inside the processor, there are provided a program counter for designating a storage location in the main memory of an instruction to be executed, and an instruction register for storing an instruction.

【0004】図6(a) は、プロセッサの制御による命令
処理における制御動作を説明するための図である。ま
ず、命令フェッチ処理において、プログラムカウンタを
参照することで、次に実行すべき命令が読み出される。
次の命令デコード処理では、読み出した命令の種類が判
定され、命令が解釈される。続く命令実行処理では、デ
ータの読み出しや演算処理等の処理が、命令に従って実
行される。その後、結果格納処理において、命令実行に
より得られた結果の格納がなされる。図示するように、
各処理は、マシンサイクルに相当する1タイミングごと
に、タイミングCLnからタイミングCLn+3にかけ
て行われる。
FIG. 6 (a) is a diagram for explaining the control operation in the instruction processing under the control of the processor. First, in the instruction fetch process, the instruction to be executed next is read by referring to the program counter.
In the next instruction decoding process, the type of the read instruction is determined and the instruction is interpreted. In the subsequent instruction execution processing, processing such as data reading and arithmetic processing is executed according to the instruction. Then, in the result storing process, the result obtained by executing the instruction is stored. As shown,
Each process is performed from timing CLn to timing CLn + 3 at each timing corresponding to a machine cycle.

【0005】一般にプログラムの実行は、複数の命令を
順次実行することによってなされるが、同図(b) は、命
令Aと命令Bとを順次実行する場合を示す。同図(b) に
示す場合、まず命令フェッチ処理において、プログラム
カウンタを参照することによって命令Aが読み出され、
命令デコード処理によって命令Aの指示する内容が解釈
され、命令実行処理において当該指示する内容に従った
処理がなされ、結果格納処理において、命令実行により
得られた結果がしかるべく格納される。次のタイミング
において、命令Bに対する命令フェッチ処理が実行され
て命令Bが読み出され、このようにして命令は順次処理
されることとなる。同図(a) と同様に命令Aの処理がタ
イミングCLnからタイミングCLn+3にかけて行わ
れたならば、命令Bの実行はタイミングCLn+4から
行われるものとなる。
Generally, a program is executed by sequentially executing a plurality of instructions, but FIG. 1B shows a case where the instruction A and the instruction B are sequentially executed. In the case shown in FIG. 6B, in the instruction fetch processing, the instruction A is read by referring to the program counter,
The instruction decoding process interprets the content instructed by the instruction A, the process according to the instructed content is performed in the instruction execution process, and the result obtained by the instruction execution is appropriately stored in the result storage process. At the next timing, the instruction fetch process for the instruction B is executed to read the instruction B, and the instructions are sequentially processed in this manner. If the processing of the instruction A is performed from the timing CLn to the timing CLn + 3 as in the case of FIG. 9A, the execution of the instruction B is performed from the timing CLn + 4.

【0006】同図(c) は処理の効率化と迅速化を図るた
めの、パイプライン処理を説明するための図である。こ
こでは、「命令フェッチ」「命令デコード」「命令実
行」、および「結果格納」の4つの処理をパイプライン
処理として、オーバーラップして行うことが可能であ
る、すなわち4つの制御動作を並行して実行することが
可能であるものとする。タイミングCL1においては、
命令Aの命令フェッチ処理がされる。次のタイミングC
L2においては、命令Aに対してのデコード処理と、命
令Bに対してのフェッチ処理とが行われる。次のタイミ
ングCL3においては、命令Aに対しての実行処理、命
令Bに対してのデコード処理、および命令Cに対しての
フェッチ処理が行われる。このように、パイプライン処
理を実行することによって、パイプライン処理可能数に
相当する数の命令を並行して処理することが可能とな
り、処理の迅速化が図られるものである。
FIG. 1C is a diagram for explaining pipeline processing for improving efficiency and speed of processing. Here, it is possible to perform the four processes of “instruction fetch”, “instruction decode”, “instruction execution”, and “result storage” as pipeline processing in an overlapping manner, that is, four control operations are performed in parallel. It should be possible to carry out. At the timing CL1,
The instruction fetch process of the instruction A is performed. Next timing C
In L2, the decoding process for the instruction A and the fetch process for the instruction B are performed. At the next timing CL3, execution processing for the instruction A, decoding processing for the instruction B, and fetch processing for the instruction C are performed. By executing the pipeline processing in this way, it becomes possible to concurrently process a number of instructions equivalent to the number of pipeline processings, and to speed up the processing.

【0007】ここで、命令AからDが単純に順次実行す
べき命令であるならば、プログラムの記述順に処理する
ことによって、図示するように理想的なパイプライン処
理を行うことができる。しかしプログラムにおいては、
繰り返し処理や、分岐・選択処理が多用されるものであ
り、複数の命令が単純に記述順に処理されるものとは限
らない。また、先の命令の実行処理の結果を用いて、後
の命令の処理がなされたり、あるいは分岐・選択がなさ
れたりする場合もあり、プログラムの流れに沿ったパイ
プライン処理を行うことが、効率化のために必要とな
る。
Here, if the instructions A to D are simply instructions to be sequentially executed, the ideal pipeline processing can be performed by processing in the program description order. But in the program,
Iterative processing and branch / selection processing are frequently used, and a plurality of instructions are not always processed in the order described. In addition, the result of the execution process of the preceding instruction may be used to process the subsequent instruction, or branch / selection may be performed. It will be necessary for commercialization.

【0008】以下に、従来の技術における、予測処理を
伴った、命令プリフェッチの手法について説明する。従
来より、パイプライン処理における命令フェッチ処理で
は、次に実行すべき命令のアドレスが最終的に決定され
る前に、次の命令を予測して命令フェッチ処理を行うこ
とがされていたものであり、このような先読みによる命
令フェッチ処理を命令プリフェッチ処理と呼ぶ。以下
に、予測処理を伴った命令プリフェッチ処理をプロセッ
サにおいて実行する、従来の技術による命令プリフェッ
チ装置について説明する。
A method of instruction prefetch with prediction processing in the prior art will be described below. Conventionally, in the instruction fetch processing in pipeline processing, the instruction fetch processing is performed by predicting the next instruction before the address of the next instruction to be executed is finally determined. The instruction fetch processing by such prefetching is called instruction prefetch processing. An instruction prefetch device according to the related art that executes an instruction prefetch process accompanied by a prediction process in a processor will be described below.

【0009】図7は従来の技術によるプリフェッチ装置
の構成を示す図、図8はプリフェッチ処理を実行する対
象となる命令を含むプログラムの一部を示す図、図9
は、従来のプリフェッチ装置で処理される場合の概略動
作を示すタイミングチャート図である。図7に示すよう
に、従来の技術による命令プリフェッチ装置は、プリフ
ェッチアドレス生成部300、第1デコード部303、
分岐予測部304、命令バッファ305、第2デコード
部306、演算実行部307、および条件コード保持部
308を備えた構成となっている。
FIG. 7 is a diagram showing a configuration of a prefetch device according to a conventional technique, FIG. 8 is a diagram showing a part of a program including an instruction to be subjected to prefetch processing, and FIG.
FIG. 6 is a timing chart diagram showing a schematic operation when processing is performed by a conventional prefetch device. As shown in FIG. 7, the conventional instruction prefetch device includes a prefetch address generation unit 300, a first decoding unit 303,
The configuration includes a branch prediction unit 304, an instruction buffer 305, a second decoding unit 306, an operation execution unit 307, and a condition code holding unit 308.

【0010】プリフェッチアドレス生成部300は、分
岐予測部304の予測と、条件コードとに基づいて、次
にプリフェッチすべきアドレスを生成し、プリフェッチ
アドレス信号S301を出力する。第1デコード部30
3はプリフェッチされた命令S302に対してデコード
処理を行い、命令を取得して、後述する命令バッファ3
05に対してこれを出力する。また、第1デコード部3
03は、上記デコード処理の結果により、プリフェッチ
された命令S302の種類を判定して、命令S302が
条件分岐命令である場合には、その旨を示す信号を、後
述する分岐予測部304、およびプリフェッチアドレス
生成部300に出力する。分岐予測部304は、条件分
岐命令に続く命令をプリフェッチするために、処理手順
の分岐がどのように行われるかの予測を行い、その予測
結果をプリフェッチアドレス生成部300に出力する。
予測の方式としては、分岐する確率に基づいて、あらか
じめ分岐する方向を定めておく方法や、過去の同じ条件
分岐における分岐方向を記憶しておき、当該記憶した分
岐方向の履歴に応じて定める方法などを用いることがで
きる。命令バッファ305は、第1デコード部303の
デコード処理によって取得された命令を、後段の処理の
ために一時蓄積する。第2デコード部306は、命令バ
ッファ305より一時蓄積された命令を取り出し、これ
を逐次デコードして、取得した結果に応じて、後述する
演算実行部における演算処理を制御する。演算実行部3
07は、第2デコード部306の制御に従って演算を実
行し、当該演算の結果に応じて、後述する条件コード保
持部308の保持する条件コードに変化がある場合に
は、条件コード保持部308にその結果を示す信号を出
力する。条件コード保持部308は、演算実行部307
から入力された演算処理結果に基づいて得られる条件コ
ードを保持する。
The prefetch address generator 300 generates an address to be prefetched next based on the prediction of the branch predictor 304 and the condition code, and outputs a prefetch address signal S301. First decoding unit 30
3 performs a decoding process on the prefetched instruction S302 to acquire the instruction, and an instruction buffer 3 to be described later.
This is output to 05. Also, the first decoding unit 3
03 determines the type of the prefetched instruction S302 based on the result of the decoding process, and when the instruction S302 is a conditional branch instruction, a signal indicating that is issued to the branch prediction unit 304 and the prefetch unit described later. It is output to the address generator 300. The branch prediction unit 304 predicts how the branch of the processing procedure will be performed in order to prefetch the instruction following the conditional branch instruction, and outputs the prediction result to the prefetch address generation unit 300.
As a prediction method, a method of determining a branching direction in advance based on the probability of branching, or a method of storing a branching direction in the same conditional branch in the past and setting it according to the history of the stored branching direction Etc. can be used. The instruction buffer 305 temporarily stores the instruction acquired by the decoding processing of the first decoding unit 303 for the subsequent processing. The second decoding unit 306 takes out the temporarily stored instructions from the instruction buffer 305, sequentially decodes the instructions, and controls the arithmetic processing in the later-described arithmetic execution unit according to the obtained result. Calculation execution unit 3
07 executes an operation under the control of the second decoding unit 306, and if the condition code held by the condition code holding unit 308 described later changes according to the result of the operation, the condition code holding unit 308 A signal indicating the result is output. The condition code holding unit 308 is a calculation execution unit 307.
The condition code obtained based on the arithmetic processing result input from is stored.

【0011】このように構成された従来の技術による命
令プリフェッチ装置の動作の概略は次のようになる。あ
るタイミングにおいて、プリフェッチアドレス生成部3
00において、次にフェッチすべき命令のアドレスが生
成され、プリフェッチアドレス信号S301として出力
される。当該命令プリフェッチ装置を用いるプロセッサ
においては、このプリフェッチアドレス信号S301を
用いて、命令をフェッチし、当該命令プリフェッチ装置
に入力する。次のタイミングでは、プリフェッチされた
命令が、第1デコード部303に入力され、デコード処
理される。
The outline of the operation of the conventional instruction prefetch device having the above-described structure is as follows. At a certain timing, the prefetch address generator 3
At 00, the address of the instruction to be fetched next is generated and output as the prefetch address signal S301. A processor using the instruction prefetch device fetches an instruction using the prefetch address signal S301 and inputs the instruction to the instruction prefetch device. At the next timing, the prefetched instruction is input to the first decoding unit 303 and decoded.

【0012】第1デコード部303では、処理した命令
が条件分岐命令であるか否かを判定する。条件分岐命令
である場合には、プリフェッチアドレス生成部300
と、分岐予測部304とに、その旨を示す信号を出力す
る。また、条件分岐命令である場合、およびない場合の
いずれにおいても、処理した命令を命令バッファ305
に出力する。
The first decoding unit 303 determines whether the processed instruction is a conditional branch instruction. If it is a conditional branch instruction, the prefetch address generation unit 300
Then, a signal indicating that is output to the branch prediction unit 304. In addition, the processed instruction is processed in the instruction buffer 305 regardless of whether it is a conditional branch instruction or not.
Output to.

【0013】命令バッファ305において一時蓄積され
た命令は、その後第2デコード部306によって取り出
され、デコード処理されることによって、命令の内容が
解釈される。第2デコード部306は、取得した命令の
内容を示す信号を演算実行部307に出力し、演算実行
部307では、入力された信号に基づいて、命令の内容
に従った演算処理が実行される。演算処理の結果は、当
該命令プリフェッチ装置を含むプロセッサにおいて処理
されるとともに、当該演算処理の結果が条件コードに影
響を及ぼす場合には、条件コード保持部308に出力さ
れて保持されることとなる。
The instruction temporarily stored in the instruction buffer 305 is taken out by the second decoding unit 306 and subjected to a decoding process to interpret the content of the instruction. The second decoding unit 306 outputs a signal indicating the content of the acquired instruction to the arithmetic execution unit 307, and the arithmetic execution unit 307 executes arithmetic processing according to the content of the instruction based on the input signal. . The result of the arithmetic processing is processed in the processor including the instruction prefetch device, and when the result of the arithmetic processing affects the condition code, it is output to and held in the condition code holding unit 308. .

【0014】一方、分岐予測部304は、第1デコード
部より条件分岐命令である旨を示す信号が入力されたと
きは、設定された方法に従って予測処理を行い、予測の
結果を示す信号をプリフェッチアドレス生成部300に
出力する。プリフェッチアドレス生成部300において
は、次にプリフェッチすべき命令のアドレスを生成する
が、ここでプリフェッチアドレス生成部300が、第1
デコード部303から、条件分岐命令である旨を示す信
号を入力されていなかった場合には、条件コード保持部
308に保持された条件コードを参照した上で、次にプ
リフェッチすべき命令のアドレスを生成して、これをプ
リフェッチアドレス信号S301として出力する。これ
に対して、第1デコード部303から、条件分岐命令で
ある旨を示す信号を入力されていた場合には、分岐予測
部304から入力された予測を示す信号に基づいて、次
にプリフェッチすべき命令のアドレスを生成し、これを
プリフェッチアドレス信号S301として出力する。
On the other hand, when the signal indicating that it is a conditional branch instruction is input from the first decoding unit, the branch prediction unit 304 performs prediction processing according to the set method and prefetches a signal indicating the result of prediction. It is output to the address generator 300. The prefetch address generation unit 300 generates an address of an instruction to be prefetched next, but here, the prefetch address generation unit 300
If the signal indicating that the instruction is a conditional branch instruction is not input from the decoding unit 303, the condition code held in the condition code holding unit 308 is referred to, and the address of the instruction to be prefetched next is determined. It is generated and output as the prefetch address signal S301. On the other hand, if a signal indicating that the instruction is a conditional branch instruction is input from the first decoding unit 303, the next prefetch is performed based on the signal indicating the prediction input from the branch prediction unit 304. An address of a power instruction is generated and this is output as a prefetch address signal S301.

【0015】ここで、図9のタイミングチャートに従っ
て、図8に示すプログラムを処理する場合について説明
するものであるが、当該プログラムは、以下のような処
理手順を示すものである。同図において、命令400は
加算命令であり、レジスタD0とD1とに格納されたデ
ータに対して加算処理を行い、その結果をレジスタD2
に格納することを意味するものである。このプログラム
においては、命令400を実行した演算結果に応じて、
命令401における分岐が決定されるものである。すな
わち、条件分岐命令である命令401が分岐の判断に用
いる条件コードが、命令400の実行結果によって変わ
るものである。ここでは、結果が0であれば条件コード
のゼロフラグがセットされるものとする。命令401は
条件分岐命令であり、条件コードのゼロフラグに応じ
て、次に実行されるべき命令が選択されることによっ
て、処理手順の分岐がなされる。ここでは、当該ゼロフ
ラグがセットされていなければ、次に実行される命令は
命令403となり、セットされていれば、次に実行され
る命令は命令402となるものである。
Here, the case where the program shown in FIG. 8 is processed will be described according to the timing chart of FIG. 9, but the program shows the following processing procedure. In the figure, an instruction 400 is an addition instruction, which performs addition processing on the data stored in the registers D0 and D1 and outputs the result to the register D2.
Is meant to be stored in. In this program, according to the operation result of executing the instruction 400,
The branch in instruction 401 is to be determined. In other words, the condition code used by the instruction 401, which is a conditional branch instruction, to determine a branch changes depending on the execution result of the instruction 400. Here, if the result is 0, the zero flag of the condition code is set. The instruction 401 is a conditional branch instruction, and a processing procedure is branched by selecting an instruction to be executed next according to the zero flag of the condition code. Here, if the zero flag is not set, the instruction to be executed next is the instruction 403, and if it is set, the instruction to be executed next is the instruction 402.

【0016】次に、従来の技術による命令プリフェッチ
装置において、当該プリフェッチ装置を用いるプロセッ
サが、図8に示すプログラムを実行する場合における動
作を、図9のタイミングチャートに従って、以下に説明
する。図9のチャートに示すタイミングt1では、プリ
フェッチアドレス生成部300において命令400のア
ドレスが生成され、プリフェッチアドレス信号S301
として出力される。当該命令プリフェッチ装置を用いる
プロセッサにおいては、このプリフェッチアドレス信号
S301を用いて、命令400をフェッチし、当該命令
プリフェッチ装置に入力する。次のタイミングt2で、
プリフェッチされた命令400が、第1デコード部30
3に入力され、デコード処理される。
Next, in the instruction prefetch device according to the conventional technique, the operation when the processor using the prefetch device executes the program shown in FIG. 8 will be described below with reference to the timing chart of FIG. At timing t1 shown in the chart of FIG. 9, the address of the instruction 400 is generated in the prefetch address generation unit 300, and the prefetch address signal S301 is generated.
Is output as. In the processor using the instruction prefetch device, the instruction 400 is fetched using this prefetch address signal S301 and input to the instruction prefetch device. At the next timing t2,
The prefetched instruction 400 is stored in the first decoding unit 30.
3 and is decoded.

【0017】命令400は条件分岐命令ではないので、
条件分岐命令である旨を示す信号は出力されることな
く、命令400は命令バッファ305に出力される。第
2デコード部306は命令バッファ305から命令40
0を取り出してデコード処理することにより、命令40
0が加算命令である旨を解釈し、信号出力によってデコ
ード処理の結果を演算実行部307に伝える。演算実行
部307は、命令400が意味する加算処理を実行し、
上述のように、命令400の加算処理の結果は条件コー
ドに影響を与え得るものであることから、当該加算処理
の結果を条件コード保持部308に出力し、条件コード
保持部308は変更された条件コードを保持する。前述
のように、加算結果が0であれば条件コードのゼロフラ
グがセットされるが、ここでは演算結果が0でなく、ゼ
ロフラグがセットされなかったものとする。図9のタイ
ミングt3において、命令401における条件分岐を決
定する条件フラグが確定する。
Since instruction 400 is not a conditional branch instruction,
The instruction 400 is output to the instruction buffer 305 without outputting a signal indicating that it is a conditional branch instruction. The second decoding unit 306 transfers the instruction 40 from the instruction buffer 305.
By fetching 0 and decoding it, the instruction 40
It interprets that 0 is an addition instruction, and the result of decoding processing is transmitted to the operation execution unit 307 by signal output. The arithmetic execution unit 307 executes the addition process indicated by the instruction 400,
As described above, since the result of the addition process of the instruction 400 may affect the condition code, the result of the addition process is output to the condition code holding unit 308, and the condition code holding unit 308 is changed. Holds the condition code. As described above, if the addition result is 0, the zero flag of the condition code is set, but here it is assumed that the operation result is not 0 and the zero flag is not set. At timing t3 in FIG. 9, the condition flag for determining the conditional branch in the instruction 401 is settled.

【0018】その後、タイミングt3において、命令4
01のアドレスが生成されて、条件分岐命令である命令
401がフェッチされ、タイミングt4において、当該
プリフェッチ装置に入力され、第1デコード部303に
おいてデコード処理がなされる。命令401は条件分岐
命令であるので、その旨を示す信号が、第1デコード部
303から、プリフェッチアドレス生成部300と、分
岐予測部304とに出力される。
Thereafter, at timing t3, the instruction 4
The address 01 is generated, the instruction 401, which is a conditional branch instruction, is fetched, input to the prefetch device at timing t4, and decoded by the first decoding unit 303. Since the instruction 401 is a conditional branch instruction, the signal indicating that is output from the first decoding unit 303 to the prefetch address generation unit 300 and the branch prediction unit 304.

【0019】信号を入力された分岐予測部304は、予
測を行い、その結果を示す信号をプリフェッチアドレス
生成部300に出力する。ここでは、分岐予測部304
による予測は、「プログラムにおいて、次に記述された
命令」を予測するように設定されていたものとする。そ
こで、「次の命令」を示す信号が分岐予測部304から
プリフェッチアドレス生成部300に出力され、図9の
タイミングt5では、プリフェッチアドレス生成手段3
00は、当該条件分岐命令401の「次の命令」である
命令402のアドレスを生成し、「命令402」を示す
プリフェッチアドレス信号S301を出力する。プロセ
ッサでは、命令402がプリフェッチされることにな
り、図9のタイミングt4では命令402が第1デコー
ド部303に入力される。
The branch predictor 304 to which the signal is input performs prediction and outputs a signal indicating the result to the prefetch address generator 300. Here, the branch prediction unit 304
The prediction by is assumed to have been set to predict the "instruction described next in the program". Therefore, a signal indicating the "next instruction" is output from the branch prediction unit 304 to the prefetch address generation unit 300, and at the timing t5 in FIG.
00 generates the address of the instruction 402 which is the “next instruction” of the conditional branch instruction 401, and outputs the prefetch address signal S301 indicating the “instruction 402”. In the processor, the instruction 402 is prefetched, and the instruction 402 is input to the first decoding unit 303 at timing t4 in FIG.

【0020】一方、タイミングt3で確定した条件フラ
グを用いて、命令401の条件分岐についての判断がな
される。上述の設定により、ゼロフラグがセットされて
いないので、次に実行される命令は命令403となる。
このことは、図9のタイミングt6における分岐先アド
レスの確定にあたる。この段階において、本来次にフェ
ッチすべき命令のアドレスが確定するものであるが、こ
の例においては、この本来のアドレス(命令403のア
ドレス)と、タイミングt5でプリフェッチアドレス生
成部300が生成したアドレス(命令402のアドレ
ス)とが一致していず、すなわち分岐予測ミスが起こっ
たため、次のタイミングt7において、改めて、次の命
令のプリフェッチが開始される。
On the other hand, the conditional flag determined at the timing t3 is used to judge the conditional branch of the instruction 401. Since the zero flag is not set by the above setting, the next instruction to be executed is the instruction 403.
This corresponds to the determination of the branch destination address at the timing t6 in FIG. At this stage, the address of the instruction to be fetched next is originally determined, but in this example, the original address (address of the instruction 403) and the address generated by the prefetch address generation unit 300 at the timing t5. (Address of instruction 402) does not match, that is, a branch prediction error has occurred, so at the next timing t7, prefetching of the next instruction is started again.

【0021】[0021]

【発明が解決しようとする課題】上記のような従来の技
術による命令プリフェッチ装置では、条件分岐命令があ
った場合、それに続く命令については、専ら分岐予測部
304の予測に基づいてプリフェッチがされることとす
る。そして、図9に示すように、条件分岐命令401が
プリフェッチされた時点において、命令400の実行が
完了しており、条件コードが確定している場合(タイミ
ングt3)でも、この結果を利用して次にプリフェッチ
する命令を決定することはできない。従って、予測が当
たっている場合には、スムーズなパイプライン処理がな
されることとなり、処理の効率が良いが、予測がはずれ
た場合には、既にフェッチされている命令をキャンセル
して正しい命令のフェッチを行なうために遅延が生じる
という問題点があった。また、この例における命令40
2のプリフェッチは無駄な動作となってしまい、当該プ
リフェッチ装置を含むプロセッサ全体として、装置資源
の活用がなされなかったこととなってしまう。
In the above-described conventional instruction prefetch device, when there is a conditional branch instruction, the instruction following it is prefetched exclusively based on the prediction of the branch prediction unit 304. I will. Then, as shown in FIG. 9, even when the execution of the instruction 400 is completed at the time when the conditional branch instruction 401 is prefetched and the condition code is fixed (timing t3), this result is used. The next prefetch instruction cannot be determined. Therefore, if the prediction is correct, smooth pipeline processing will be performed, and the processing efficiency will be good, but if the prediction is incorrect, the already fetched instruction will be canceled and the correct instruction There is a problem that a delay occurs due to fetching. Also, the instruction 40 in this example
The prefetch of No. 2 is a useless operation, and the device resources are not utilized as a whole processor including the prefetch device.

【0022】本発明はかかる問題点に鑑みてなされたも
のであり、条件分岐命令をプリフェッチした時点におい
て、条件が確定しているならば、当該確定した条件に従
って命令のプリフェッチを実行することで、分岐予測ミ
スによる遅延を少なくして、装置資源を活用した効率的
な処理をすることが可能な、命令プリフェッチ装置を提
供することを目的とする。
The present invention has been made in view of the above problems. If the condition is fixed at the time of prefetching the conditional branch instruction, the instruction prefetch is executed according to the fixed condition. An object of the present invention is to provide an instruction prefetch device capable of reducing delay due to branch misprediction and performing efficient processing utilizing device resources.

【0023】[0023]

【課題を解決するための手段】上記目的を達成するた
め、請求項1にかかる命令プリフェッチ装置は、命令を
実行する計算機において、上記命令を記憶する記憶装置
から先読みする命令プリフェッチ装置であって、上記先
読みされた命令が、分岐を指令する分岐命令であるか否
かを判断し、分岐命令である場合には、分岐信号を出力
する分岐判定手段と、上記分岐信号が出力された場合
に、上記分岐命令における分岐を決定する条件が確定し
ているか否かを判定し、確定している場合には、当該条
件に対応した確定条件情報を、後述するプリフェッチア
ドレス生成手段に対して出力する確定条件情報生成手段
と、所定の分岐予測方法に従って、分岐先の命令を指定
する情報を生成する分岐予測手段と、上記確定条件情報
生成手段より、確定条件情報を入力されたときは、当該
確定条件情報に基づいて、プリフェッチすべきアドレス
を生成し、上記確定条件情報を入力されないときは、上
記分岐予測手段が生成した情報に基づいてプリフェッチ
すべきアドレスを生成するプリフェッチアドレス生成手
段とを備え、上記確定条件情報生成手段は、上記分岐命
令における分岐を決定する条件が確定しているか否かを
判定し、確定している場合には条件確定信号を出力する
条件確定信号生成手段と、上記条件確定信号が出力され
たときは、当該確定した条件を取得して、上記取得した
条件に基づいて上記確定条件情報を生成する条件確定判
定手段とを有するものとし、上記条件確定信号生成手段
は、上記分岐判定手段から出力されたアドレスを保持す
る第一の命令アドレス保持手段と、その時点において実
行されている命令のアドレスを保持する第二の命令アド
レス保持手段と、上記第一の命令アドレス保持手段と、
上記第二の命令アドレス保持手段とが保持するアドレス
の比較処理を行い、上記比較において一致していると判
定する場合に、上記条件確定信号を上記条件判定確定手
段に出力する比較手段とを有するものとしたものであ
り、分岐命令に続く命令のプリフェッチにあたり、条件
が確定している場合には、当該確定した条件に対応した
命令のアドレスを生成し、確定していない場合には所定
の予測方法に従って命令のアドレスを生成する。また、
条件が確定したか否かを、条件確定信号において伝達
し、条件が確定している場合には当該条件を利用する。
さらに、条件が確定したか否か の判定を、条件を確定す
る命令のアドレスを実行中の命令のアドレスと比較する
ことで実行し、条件が確定したか否かを判定する。
In order to achieve the above object, an instruction prefetch device according to claim 1 is an instruction prefetch device for prefetching from a storage device storing the instruction in a computer that executes the instruction, The prefetched instruction determines whether or not it is a branch instruction for instructing branching, and if it is a branch instruction, branch determination means for outputting a branch signal, and when the branch signal is output, It is determined whether or not the condition for determining the branch in the branch instruction is fixed, and if the condition is fixed, the fixed condition information corresponding to the condition is output to the prefetch address generating means described later. The condition information generating means, a branch predicting means for generating information designating a branch destination instruction according to a predetermined branch predicting method, and the definite condition information generating means, When the information is input, an address to be prefetched is generated based on the definite condition information, and when the definite condition information is not input, the address to be prefetched is generated based on the information generated by the branch prediction unit. And a prefetch address generating means for generating the branch instruction.
Whether the conditions that determine the branch in the decree have been established
Judges and outputs the condition confirmation signal when it is confirmed
The condition confirmation signal generating means outputs the condition confirmation signal.
If so, obtain the confirmed conditions and obtain the above
Condition confirmation judgment that generates the above-mentioned confirmation condition information based on the condition
And a condition determining signal generating device.
Holds the address output from the branch determination means
First instruction address holding means and the actual
A second instruction add that holds the address of the instruction being executed
Address holding means, the first instruction address holding means,
Address held by the second instruction address holding means
The comparison process is performed and it is determined that they match in the above comparison.
The condition determination signal, the condition determination signal
In the prefetch of the instruction following the branch instruction, if the condition is fixed, the address of the instruction corresponding to the fixed condition is generated and fixed. If not, the address of the instruction is generated according to a predetermined prediction method. Also,
Communicates whether or not the condition is confirmed by the condition confirmation signal
However, if the condition is confirmed, the condition is used.
In addition, determine whether the condition has been finalized by confirming the condition.
The address of the instruction that is executing with the address of the instruction that is executing
This is executed, and it is determined whether or not the condition is fixed.

【0024】また、請求項2にかかる命令プリフェッチ
装置は、請求項1の装置において、上記分岐判定手段
は、上記先読みされた命令が条件生成命令であるか否か
を判定し、条件生成命令である場合は、当該条件生成命
令のアドレスを上記第1の命令アドレス保持手段に対し
て出力するとともに、上記条件確定判定手段に対して、
条件未確定信号を出力するものであり、上記出力する分
岐信号として、当該分岐命令における分岐条件を示す情
報を、上記条件確定判定手段に対して出力するととも
に、上記分岐命令における分岐先アドレスを示す情報
を、上記プリフェッチアドレス生成手段に対して出力す
るものであり、条件生成命令に対する判定処理を実行
し、そのアドレスを保持することで、アドレス比較によ
る条件確定についての判断を実行する。
An instruction prefetch device according to a second aspect is the device according to the first aspect, wherein the branch determining means is
Is whether the prefetched instruction is a condition generation instruction or not.
If it is a condition generation instruction, the condition generation instruction
The address of the command to the first instruction address holding means
And output to the condition confirmation determination means,
The condition undetermined signal is output.
As a branch signal, information indicating the branch condition in the branch instruction
Report is output to the condition confirmation determining means.
Information indicating the branch destination address in the above branch instruction
Is output to the prefetch address generating means.
It executes the judgment process for the condition generation instruction.
By holding the address, the address comparison
Make a judgment about the condition confirmation.

【0025】また、請求項3にかかる命令プリフェッチ
装置は、請求項2の装置において、上記条件確定判定手
段は、上記条件確定信号を入力されたとき、当該分岐命
令の次のアドレス、又は上記分岐先アドレスを用いるべ
き旨を示す条件確定情報を上記プリフェッチアドレス生
成手段に対して出力するものであり、確定した条件に対
応した命令のアドレスを生成する。
Further, the instruction prefetching device according to claim 3, The apparatus of claim 2, said condition determination judging hand
When the above condition confirmation signal is input, the stage
Use the address next to the decree or the branch destination address above.
Condition confirmation information indicating that the prefetch address is
It is output to the compensator, and the
Generates the address of the corresponding instruction.

【0026】また、請求項4にかかる命令プリフェッチ
装置は、先読みされた第1の命令が、条件分岐命令であ
るかを判定する命令判定手段と、前記第1の命令の直前
の条件生成命令のアドレスを記憶する手段と、記憶され
たアドレスと、実行されている命令のアドレスとを比較
する比較手段と、前記第1の命令が条件分岐命令と判定
された場合において、前記比較手段にてアドレスの一致
検出された場合には、確定した条件よりプリフェッチ
アドレスを出力するプリフェッチアドレス生成手段とを
備えたものとしたものであり、分岐条件が確定したか否
かを条件生成命令実行の際に予め判定し、条件が確定し
ている場合は当該条件に基づく命令のプリフェッチアド
レスを生成する。
According to a fourth aspect of the present invention, there is provided an instruction prefetch device, which comprises an instruction determining means for determining whether the prefetched first instruction is a conditional branch instruction, and a condition generating instruction immediately before the first instruction. means for storing the addresses, the stored address, and comparing means for comparing the address of the instruction being executed, in a case where the first instruction is determined to conditional branch instruction, a Te to the comparison means When a match of the address is detected, the prefetch address generating means for outputting the prefetch address from the determined condition is provided, and the condition generation is performed to determine whether or not the branch condition is determined. When the instruction is executed, it is determined in advance, and if the condition is confirmed, the prefetch address of the instruction based on the condition is generated.

【0027】また、請求項5にかかる命令プリフェッチ
方法は、先読みされた第1の命令が、条件分岐命令であ
るかを判定する命令判定工程と、前記第1の命令の直前
の条件生成命令のアドレスを記憶する工程と、記憶され
たアドレスと、実行されている命令のアドレスとを比較
する比較工程と、前記第1の命令が条件分岐命令と判定
された場合において、前記比較工程にてアドレスの一致
検出された場合には、確定した条件よりプリフェッチ
アドレスを出力するプリフェッチアドレス生成工程とを
含むものとしたものであり、分岐条件が確定したか否か
を条件生成命令実行の際に予め判定し、条件が確定して
いる場合は当該条件に基づく命令のプリフェッチアドレ
スを生成する。
According to a fifth aspect of the present invention, there is provided an instruction prefetch method, which comprises an instruction determining step of determining whether the prefetched first instruction is a conditional branch instruction and a condition generating instruction immediately before the first instruction. a step of storing the addresses, the stored address, a comparison step of comparing the address of the instruction being executed, in a case where the first instruction is determined to conditional branch instruction, a Te on the comparison step When a match of the address is detected, a prefetch address generation step of outputting a prefetch address based on the determined condition is included, and whether or not the branch condition is determined is determined by a condition generation instruction. It is determined in advance at the time of execution, and if the condition is fixed, the prefetch address of the instruction based on the condition is generated.

【0028】[0028]

【0029】[0029]

【0030】[0030]

【0031】[0031]

【0032】[0032]

【0033】[0033]

【0034】[0034]

【発明の実施の形態】DETAILED DESCRIPTION OF THE INVENTION

実施の形態1.本発明の実施の形態1による命令プリフ
ェッチ装置は、分岐条件が確定したか否かを示す条件確
定信号を用いて、条件が確定している場合は、当該条件
に対応した命令をプリフェッチするものである。図1は
本実施の形態1による命令プリフェッチ装置の構成を示
すブロック図である。図示するように、本実施の形態1
による命令プリフェッチ装置は、プリフェッチアドレス
生成部100、第1デコード部101、条件生成命令ア
ドレス保持部102、条件確定判定部103、命令バッ
ファ104、第2デコード部105、条件コード保持部
106、演算実行部107、プログラムカウンタ10
8、および比較器109を備えた構成となっている。
Embodiment 1. The instruction prefetch device according to the first embodiment of the present invention uses a condition decision signal indicating whether or not a branch condition is decided, and when the condition is decided, prefetches an instruction corresponding to the condition. is there. FIG. 1 is a block diagram showing the configuration of the instruction prefetch device according to the first embodiment. As shown, the first embodiment
The instruction prefetch device by means of the prefetch address generation unit 100, the first decoding unit 101, the condition generation instruction address holding unit 102, the condition determination determination unit 103, the instruction buffer 104, the second decoding unit 105, the condition code holding unit 106, the operation execution Unit 107, program counter 10
8 and a comparator 109.

【0035】プリフェッチアドレス生成部100は、条
件確定判定部103が出力するプリフェッチアドレス情
報S114を用いて、次にプリフェッチすべきアドレス
を生成し、当該命令プリフェッチ装置の装置出力である
プリフェッチアドレス信号S110を出力する。第1デ
コード部101はプリフェッチされた命令S112に対
してデコード処理を行い、命令の内容を意味する情報S
116を取得して、後述する命令バッファ104に対し
てこれを出力する。
The prefetch address generation unit 100 uses the prefetch address information S114 output from the condition determination determination unit 103 to generate an address to be prefetched next, and outputs the prefetch address signal S110 output from the device of the instruction prefetch device. Output. The first decoding unit 101 performs a decoding process on the prefetched instruction S112 to obtain information S indicating the content of the instruction.
116 is acquired and is output to the instruction buffer 104 described later.

【0036】また、第1デコード部101は、命令が分
岐命令であるか否かを判断し、分岐命令である場合に
は、分岐信号を出力する分岐判定手段として機能するも
のであり、命令S112が分岐命令である場合には、当
該条件分岐命令における分岐先アドレスを示す信号S1
11と、当該分岐命令における分岐条件を示す信号S1
15とを出力する。信号S111、およびS115は、
命令が分岐命令であることを示す分岐信号としても扱わ
れる。さらに、第1デコード部101は、命令が条件コ
ード(例えばゼロフラグ)を変更する命令、すなわち条
件生成命令であるか否かを判断するものであり、条件生
成命令であると判断した場合は、当該条件生成命令S1
12の命令アドレスS113を後述する条件生成命令ア
ドレス保持部102に出力するとともに、条件確定判定
手段103に対して未確定信号S115を出力する。
Further, the first decoding section 101 functions as a branch judging means for judging whether or not the instruction is a branch instruction and, if it is a branch instruction, outputting a branch signal, and the instruction S112. Is a branch instruction, the signal S1 indicating the branch destination address in the conditional branch instruction.
11 and a signal S1 indicating a branch condition in the branch instruction.
And 15 are output. The signals S111 and S115 are
It is also treated as a branch signal indicating that the instruction is a branch instruction. Furthermore, the first decoding unit 101 determines whether or not the instruction is an instruction for changing a condition code (for example, a zero flag), that is, a condition generation instruction. Condition generation instruction S1
The 12 instruction addresses S113 are output to the condition generation instruction address holding unit 102, which will be described later, and the undetermined signal S115 is output to the condition determination determining unit 103.

【0037】条件確定判定部103は、第1デコード部
101から入力される分岐条件を示す信号S115と、
条件コード保持部106より取得する条件コードS11
9とを用いて、プリフェッチアドレス生成部100に対
して出力するプリフェッチアドレス情報を生成する。
The condition decision determining unit 103 receives the signal S115 indicating the branch condition input from the first decoding unit 101,
Condition code S11 acquired from the condition code holding unit 106
9 is used to generate prefetch address information to be output to the prefetch address generation unit 100.

【0038】命令バッファ104は、第1デコード部1
01のデコード処理によって取得された命令の内容を示
す信号S116を、後段の処理のために一時蓄積する。
第2デコード部105は、一時蓄積された信号S116
を命令バッファ104より取り出し、これを逐次デコー
ド処理して、取得した結果に応じて、後述する演算実行
部における演算処理を制御する信号を出力する。条件コ
ード保持部106は、条件分岐処理等の判断を伴う処理
において、判断のために用いる分岐条件等の条件コード
を保持する。演算実行部107は、第2デコード部10
5より入力される制御信号に従って演算を実行し、当該
演算の結果に応じて、後述する条件コード保持部106
の保持する条件コードに変化がある場合には、条件コー
ド保持部106にその結果を示す信号を出力する。
The instruction buffer 104 includes the first decoding unit 1
The signal S116 indicating the content of the instruction acquired by the decoding processing of 01 is temporarily stored for the subsequent processing.
The second decoding unit 105 uses the temporarily stored signal S116.
Is fetched from the instruction buffer 104, is sequentially decoded, and a signal for controlling the arithmetic processing in the arithmetic execution unit described later is output according to the obtained result. The condition code holding unit 106 holds a condition code such as a branch condition used for the determination in a process involving the determination such as the conditional branch process. The operation executing unit 107 includes the second decoding unit 10
An operation is executed in accordance with a control signal input from No. 5, and a condition code holding unit 106 described later is executed according to the result of the operation.
When there is a change in the condition code held by, the condition code holding unit 106 outputs a signal indicating the result.

【0039】条件生成命令アドレス保持部102は、条
件生成命令のアドレスを保持する第1の命令アドレス保
持手段として機能するものであり、命令アドレスS11
3を保持する。プログラムカウンタ108は当該命令プ
リフェッチ装置を用いるプロセッサにおいて、実行中の
命令のアドレスを保持するレジスタであり、演算実行部
107により実行されている命令アドレスを保持する第
2の命令アドレス保持手段として機能する。比較器10
9は、条件生成命令アドレス保持部102から取得する
命令アドレスS117と、プログラムカウンタ108に
保持されたアドレスとの比較を行い、一致した場合に
は、一致を示す信号を出力する。条件生成命令アドレス
保持部102、プログラムカウンタ108、および比較
器109は、分岐命令における分岐を決定する条件が確
定しているか否かを判定し、確定している場合には条件
確定信号S118を出力する条件確定信号生成手段12
0として機能する。
The condition generation instruction address holding unit 102 functions as a first instruction address holding unit which holds the address of the condition generation instruction, and the instruction address S11.
Holds 3. The program counter 108 is a register that holds the address of the instruction that is being executed in the processor that uses the instruction prefetch device, and functions as a second instruction address holding unit that holds the instruction address that is being executed by the operation execution unit 107. . Comparator 10
9 compares the instruction address S117 acquired from the condition generation instruction address holding unit 102 with the address held in the program counter 108, and if they match, outputs a signal indicating the match. The condition generation instruction address holding unit 102, the program counter 108, and the comparator 109 determine whether or not the condition for determining the branch in the branch instruction has been decided, and if so, output the condition decision signal S118. Condition determination signal generating means 12
Functions as 0.

【0040】さらに、本実施の形態1による命令プリフ
ェッチ装置においては、図1に示していないが、従来の
技術による装置と同様の分岐予測部を備えるものであ
り、条件確定信号S118が条件確定判定部103に入
力されない場合は、該分岐予測手段を用いて分岐予測を
行い、そのアドレスをプリフェッチアドレス生成部10
0に入力するものである。
Further, although not shown in FIG. 1, the instruction prefetch device according to the first embodiment is provided with a branch predictor similar to the device according to the prior art, and the condition decision signal S118 is used to determine the condition decision. When the address is not input to the unit 103, the branch prediction is performed by using the branch prediction unit, and the address is prefetched by the prefetch address generation unit 10.
It is input to 0.

【0041】このように構成された本実施の形態1によ
る命令プリフェッチ装置における、動作の概要を以下に
説明する。あるタイミングにおいて、プリフェッチアド
レス生成部100において、次にフェッチすべき命令の
アドレスが生成され、プリフェッチアドレス信号S11
0として出力される。当該命令プリフェッチ装置を用い
るプロセッサにおいては、このプリフェッチアドレス信
号S110を用いて、命令をフェッチし、この命令S1
12を当該命令プリフェッチ装置に入力する。次のタイ
ミングでは、プリフェッチされた命令S112が、第1
デコード部101に入力され、デコード処理される。
The outline of the operation of the instruction prefetch device according to the first embodiment having the above-described structure will be described below. At a certain timing, the prefetch address generation unit 100 generates the address of the instruction to be fetched next, and the prefetch address signal S11 is generated.
It is output as 0. In the processor using the instruction prefetch device, an instruction is fetched by using the prefetch address signal S110, and the instruction S1 is fetched.
12 is input to the instruction prefetch device. At the next timing, the prefetched instruction S112 is
It is input to the decoding unit 101 and decoded.

【0042】第1デコード部101では、命令S112
が条件分岐命令であるか否かと、条件生成命令であるか
否かとの判断を行う。命令S112が条件分岐命令であ
った場合、第1デコード部101は、当該条件分岐命令
における分岐先アドレスを示す信号S111をプリフェ
ッチアドレス部100に出力し、それとともに、当該分
岐命令における分岐条件を示す信号S115を条件確定
判定部103に出力する。分岐先アドレスを示す信号と
して、ここでは、分岐先アドレスと、先にプリフェッチ
した命令のアドレスとのアドレス差分を示す信号S11
1を出力することとする。また、命令S112が条件生
成命令であった場合、命令S112の命令アドレスを示
す信号S113を条件生成命令アドレス保持部102に
出力するとともに、条件確定判定手段103に対して未
確定信号S115を出力する。条件生成命令か否かの判
断については、例えば加減乗除を行う命令等を条件生成
命令とするなど、あらかじめ命令の種類によって条件生
成命令か否かを定めておくことによって、命令S112
が入力された際に判断することができる。また、命令S
112が条件分岐命令であった場合、条件生成命令であ
った場合、または条件分岐命令でも条件生成命令でもな
かった場合のいずれにおいても、命令S112の内容を
示す信号S116を命令バッファ104に出力する。
In the first decoding section 101, the instruction S112
Is a conditional branch instruction and whether it is a condition generation instruction. When the instruction S112 is a conditional branch instruction, the first decoding unit 101 outputs a signal S111 indicating a branch destination address in the conditional branch instruction to the prefetch address unit 100, and at the same time, indicates a branch condition in the branch instruction. The signal S115 is output to the condition confirmation determination unit 103. As the signal indicating the branch destination address, here, a signal S11 indicating the address difference between the branch destination address and the address of the instruction prefetched previously.
1 is to be output. If the instruction S112 is a condition generation instruction, a signal S113 indicating the instruction address of the instruction S112 is output to the condition generation instruction address holding unit 102, and an unconfirmed signal S115 is output to the condition determination determination means 103. . As for the determination as to whether or not a condition generation command, for example, an instruction for adding, subtraction, multiplication and division is used as a condition generation command, and whether or not it is a condition generation command is determined in advance according to the type of the command.
Can be judged when is input. Also, the command S
Whether signal 112 is a conditional branch instruction, a conditional generation instruction, or neither a conditional branch instruction nor a conditional generation instruction, a signal S116 indicating the content of the instruction S112 is output to the instruction buffer 104. .

【0043】命令バッファ104において一時蓄積され
た、命令の内容を示す信号S116は、その後第2デコ
ード部105によって取り出され、デコード処理される
ことによって、命令の内容が解釈される。第2デコード
部105は、解釈した命令の内容に従った指示を演算実
行部107に出力し、演算実行部107は、入力された
指示に基づいて、演算処理を実行する。演算処理の結果
は、当該命令プリフェッチ装置を含むプロセッサにおい
て処理されるとともに、当該演算処理の結果が条件コー
ドに影響を及ぼす場合には、条件コード保持部106に
出力されて保持されることとなる。
The signal S116 indicating the content of the instruction temporarily stored in the instruction buffer 104 is taken out by the second decoding unit 105 and subjected to a decoding process to interpret the content of the instruction. The second decoding unit 105 outputs an instruction according to the content of the interpreted instruction to the arithmetic execution unit 107, and the arithmetic execution unit 107 executes arithmetic processing based on the input instruction. The result of the arithmetic processing is processed in the processor including the instruction prefetch device, and when the result of the arithmetic processing affects the condition code, it is output to the condition code holding unit 106 and held therein. .

【0044】一方、条件確定信号生成手段120におい
ては、条件生成命令アドレス保持部102に命令S11
2のアドレスS113が入力された場合、当該アドレス
と、プログラムカウンタ108から取得されるアドレス
とが、比較器109に入力されて比較される。プログラ
ムカウンタ108には、前述のように、当該命令プリフ
ェッチ装置を含むプロセッサの処理において、実行中の
命令のアドレスが格納されているので、かかる比較処理
により、対象となる条件生成命令が実行されたものであ
るか否かを知ることができる。実行されたものであれ
ば、この命令S112の実行結果によって定められる条
件は確定したものと判断されるので、条件確定の旨を示
す条件確定信号S118が条件確定判定部103に出力
される。
On the other hand, in the condition determination signal generating means 120, the condition generating instruction address holding unit 102 is instructed by the instruction S11.
When the second address S113 is input, the address and the address obtained from the program counter 108 are input to the comparator 109 and compared. As described above, the program counter 108 stores the address of the instruction being executed in the processing of the processor including the instruction prefetch device. Therefore, the target condition generating instruction is executed by the comparison processing. You can know whether it is a thing or not. If it has been executed, the condition determined by the execution result of this command S112 is determined to have been determined, so the condition determination signal S118 indicating that the condition has been determined is output to the condition determination determination unit 103.

【0045】条件確定判定部103は、条件確定信号生
成手段120から、条件確定信号S118を入力された
か否かと、第1デコード部から、未確定信号、または分
岐条件を示す信号として信号S115を入力されたか否
かとによって動作が異なる。まず、未確定信号S115
を入力された場合には、条件確定判定部103における
リセット処理が実行され、直前に処理された条件生成命
令に基づく条件確定信号S118を用いることによって
セットされた状態がリセットされる。
The condition confirmation determination unit 103 inputs whether or not the condition determination signal S118 is input from the condition determination signal generation means 120, and an undetermined signal or a signal S115 as a signal indicating a branch condition from the first decoding unit. The operation differs depending on whether or not it is performed. First, the undetermined signal S115
When is input, a reset process is executed in the condition confirmation determination unit 103, and the set state is reset by using the condition confirmation signal S118 based on the condition generation instruction processed immediately before.

【0046】条件確定判定部103に対して、分岐条件
を示す信号S115が入力され、かつ、条件確定信号S
118が入力されたときは、条件コード保持部106よ
り条件コードを取得し、これをプリフェッチアドレス情
報S114として、プリフェッチアドレス部100に出
力する。これに対して、分岐条件を示す信号S115が
入力されるが、条件確定信号S118が入力されない場
合は、条件確定判定部103は動作せず、前述のように
分岐予測部(図示せず)による予測が、プリフェッチア
ドレス生成部100に入力され、用いられることとな
る。
A signal S115 indicating a branching condition is input to the condition decision determining unit 103, and the condition decision signal S
When 118 is input, the condition code is acquired from the condition code holding unit 106 and is output to the prefetch address unit 100 as the prefetch address information S114. On the other hand, when the signal S115 indicating the branch condition is input but the condition determination signal S118 is not input, the condition determination determination unit 103 does not operate and the branch prediction unit (not shown) operates as described above. The prediction is input to the prefetch address generation unit 100 and used.

【0047】プリフェッチアドレス生成部100では、
入力されたプリフェッチアドレス情報を用いてプリフェ
ッチアドレス信号S110が生成されて出力される。図
2は、プリフェッチアドレス生成部100の動作を説明
するための図であり、内部構成の要部を示すものであ
る。図示するように、プリフェッチアドレス生成部10
0は、セレクタ151、アドレスカウンタ152、およ
び加算器153を備えたものとなっている。
In the prefetch address generator 100,
A prefetch address signal S110 is generated and output using the input prefetch address information. FIG. 2 is a diagram for explaining the operation of the prefetch address generation unit 100 and shows a main part of the internal configuration. As shown, the prefetch address generator 10
0 is provided with a selector 151, an address counter 152, and an adder 153.

【0048】セレクタ151は、条件確定判定部103
から入力されるプリフェッチアドレス情報S114に対
応して、信号S111か、固定長(この場合は値
「4」)かのいずれかを選択して、これを加算器153
に出力する。信号S111は、前述のようにプリフェッ
チされた条件分岐命令における、分岐先アドレスを示す
信号として入力され、アドレス差分の相対値として用い
られるものである。一方固定長は、アドレスの差分を固
定的に決定するものであり、例えば4バイト分と決定す
るものであれば図示するように値「4」が用いられるこ
ととなる。
The selector 151 has a condition decision determining section 103.
Either the signal S111 or the fixed length (in this case, the value “4”) is selected in accordance with the prefetch address information S114 input from the adder 153.
Output to. The signal S111 is input as a signal indicating a branch destination address in the conditional branch instruction prefetched as described above, and is used as a relative value of the address difference. On the other hand, the fixed length fixedly determines the difference between the addresses, and if the fixed length is determined to be, for example, 4 bytes, the value “4” is used as shown in the figure.

【0049】アドレスカウンタ152は、直前のプリフ
ェッチアドレス生成処理において生成されたアドレスを
保持するものである。セレクタ151から、選択された
信号が加算器153に出力されると、加算器153で
は、当該選択された信号と、アドレスカウンタ152に
保持された値とが加算処理され、この加算の結果が、当
該命令プリフェッチ装置の装置出力であるプリフェッチ
アドレス信号S110として出力される。また、それと
ともに、プリフェッチアドレス信号S110は、アドレ
スカウンタ152にも出力されて、次回のアドレス生成
処理に用いられるために保持されることとなる。
The address counter 152 holds the address generated in the immediately preceding prefetch address generating process. When the selected signal is output from the selector 151 to the adder 153, the adder 153 performs addition processing on the selected signal and the value held in the address counter 152, and the result of this addition is It is output as a prefetch address signal S110 which is a device output of the instruction prefetch device. At the same time, the prefetch address signal S110 is also output to the address counter 152 and held for use in the next address generation process.

【0050】以上の動作により、プリフェッチアドレス
生成部100では、アドレスカウンタ152に保持され
た、先にプリフェッチされた命令のアドレスに対して、
加算器153において、信号S111が伝えるアドレス
差分(相対値)が加算され、得られた分岐先アドレスが
プリフェッチアドレス信号S110となるか、あるい
は、固定長「4」が加算され、4バイト先の次の命令の
アドレスがプリフェッチアドレス信号S110となるか
の、いずれかが行われることとなる。
As a result of the above operation, the prefetch address generator 100 compares the address of the previously prefetched instruction held in the address counter 152 with
In the adder 153, the address difference (relative value) transmitted by the signal S111 is added, and the obtained branch destination address becomes the prefetch address signal S110, or a fixed length "4" is added and the next 4-byte destination is added. Either the address of the instruction becomes the prefetch address signal S110.

【0051】次に従来技術による装置の場合と同様に、
図8に示すプログラムについて実行する場合の動作を、
図3のタイミングチャートに従って説明する。図3のチ
ャートに示すタイミングt1では、プリフェッチアドレ
ス生成部100において命令400のアドレスが生成さ
れ、プリフェッチアドレス信号S110として出力され
る。当該命令プリフェッチ装置を用いるプロセッサにお
いては、このプリフェッチアドレス信号S110を用い
て、命令400をフェッチし、当該命令プリフェッチ装
置に入力する。次のタイミングt2で、プリフェッチさ
れた命令400が、第1デコード部101に入力され、
デコード処理される。
Then, as in the case of the prior art device,
The operation when executing the program shown in FIG.
A description will be given according to the timing chart of FIG. At the timing t1 shown in the chart of FIG. 3, the address of the instruction 400 is generated in the prefetch address generation unit 100 and output as the prefetch address signal S110. In the processor using the instruction prefetch device, the instruction 400 is fetched using this prefetch address signal S110 and input to the instruction prefetch device. At the next timing t2, the prefetched instruction 400 is input to the first decoding unit 101,
It is decoded.

【0052】命令400は条件分岐命令ではないので、
分岐アドレスを示す信号S111と、分岐条件を示す信
号S115とは出力されない。一方、命令400は条件
コード(ゼロフラグ)を変更する命令であり、条件生成
命令であると判断されるので、命令400のアドレスが
条件生成命令アドレス保持部102に出力されて記憶さ
れるとともに、条件コード未確定信号S115が条件確
定判定部103に入力される。
Since the instruction 400 is not a conditional branch instruction,
The signal S111 indicating the branch address and the signal S115 indicating the branch condition are not output. On the other hand, since the instruction 400 is an instruction for changing the condition code (zero flag) and is determined to be a condition generation instruction, the address of the instruction 400 is output to and stored in the condition generation instruction address holding unit 102, and The code unconfirmed signal S115 is input to the condition confirmation judgment unit 103.

【0053】また、命令400の内容を示す信号S11
6は命令バッファ104に出力される。第2デコード部
105は命令バッファ104から命令400を取り出し
てデコード処理することにより、命令400が加算命令
である旨を解釈し、信号出力によってデコード処理の結
果を演算実行部107に伝える。演算実行部107は、
命令400が意味する加算処理を実行し、加算処理の結
果は条件コードに影響を与え得るものであることから、
当該加算処理の結果を条件コード保持部106に出力
し、条件コード保持部106は変更された条件コードを
保持する。図3のタイミングt3において、条件フラグ
が確定する。
Also, a signal S11 indicating the content of the instruction 400
6 is output to the instruction buffer 104. The second decoding unit 105 interprets that the instruction 400 is an addition instruction by fetching the instruction 400 from the instruction buffer 104 and performing a decoding process, and transmits the result of the decoding process to the operation executing unit 107 by outputting a signal. The calculation execution unit 107
The addition process executed by the instruction 400 is executed, and the result of the addition process may affect the condition code.
The result of the addition processing is output to the condition code holding unit 106, and the condition code holding unit 106 holds the changed condition code. At timing t3 in FIG. 3, the condition flag is settled.

【0054】条件生成命令である命令400の実行によ
って、条件確定信号生成手段120の処理においては、
条件確定信号S118が出力されることとなるので、条
件確定信号S118を入力された条件確定判定部103
は、条件コード保持部106から条件コードS119を
取得する。
By executing the instruction 400, which is a condition generation instruction, in the processing of the condition confirmation signal generation means 120,
Since the condition confirmation signal S118 will be output, the condition confirmation determination unit 103 to which the condition confirmation signal S118 is input.
Acquires the condition code S119 from the condition code holding unit 106.

【0055】タイミングt4において、条件分岐命令で
ある命令401が第1デコード部101においてデコー
ド処理をされる。命令401が分岐命令であることか
ら、分岐条件を示す信号S115が条件確定判定部10
3に出力される。条件確定判定部103では、信号S1
15の入力に応じて、取得した条件コードS119に基
づいて、条件分岐命令401の次に実行すべき命令アド
レスとして、正しいアドレス(命令403のアドレス)
を生成するようにプリフェッチアドレス生成部100に
指示する。これによりタイミングt5で生成されたプリ
フェッチアドレスに基づいて、命令403のプリフェッ
チが行われることとなる。
At timing t4, the instruction 401, which is a conditional branch instruction, is decoded in the first decoding unit 101. Since the instruction 401 is a branch instruction, the signal S115 indicating the branch condition is sent to the condition determination determination unit 10
3 is output. In the condition confirmation determination unit 103, the signal S1
According to the input of 15, the correct address (the address of the instruction 403) as the instruction address to be executed next to the conditional branch instruction 401 based on the acquired condition code S119.
To the prefetch address generation unit 100. As a result, the instruction 403 is prefetched based on the prefetch address generated at the timing t5.

【0056】タイミングチャート図である図3を従来技
術による装置を用いた場合のタイミングチャート図であ
る図9と比較すると、図9においてはタイミングt7に
おいて、正しくフェッチすべき命令である命令403の
アドレスが出力されるのに対して、本実施の形態1によ
る図3のチャートでは、タイミングt5において、命令
403のアドレスが出力されることが示されており、本
実施の形態1では、予測の代わりに確定条件を用いるこ
とで、処理を迅速になし得ることが分かる。
Comparing FIG. 3 which is a timing chart diagram with FIG. 9 which is a timing chart diagram when a device according to the prior art is used, the address of the instruction 403 which is the instruction to be fetched correctly at the timing t7 in FIG. 3 is output, the chart of FIG. 3 according to the first embodiment shows that the address of the instruction 403 is output at the timing t5. It can be seen that the processing can be performed quickly by using the definite condition for.

【0057】図4は、パイプライン処理における、本実
施の形態1によるプリフェッチ処理を説明するための図
である。同図(a) は従来技術による場合であり、命令A
が条件生成命令である場合、タイミングCLn+2にお
ける命令Aの実行の後でなければ、確定した条件に基づ
いて次の命令のプリフェッチをすることができないこと
を示している。これに対して同図(b) に示す本実施の形
態1による場合は、タイミングCL+1における命令A
のデコード処理の際に、命令Aが条件生成命令であるこ
とを判断して、確定した条件を取得する準備をするの
で、タイミングCLn+2において、命令Aが実行され
て条件が確定したならば、当該確定した条件に基づい
て、命令Bのプリフェッチが可能となるものである。
FIG. 4 is a diagram for explaining the prefetch process according to the first embodiment in the pipeline process. FIG. 7A shows the case of the conventional technique, and the instruction A
If There is a condition generate instruction, until after the execution of the instruction A in the timing CLn + 2, based on the determined condition indicates that process is not performed to the prefetch of the next instruction. On the other hand, in the case of the first embodiment shown in FIG. 7B, the instruction A at the timing CL + 1
At the time of the decoding process of 1, the instruction A is judged to be a condition generation instruction, and preparation is made to acquire the confirmed condition. The instruction B can be prefetched based on the determined condition.

【0058】このように、本発明の実施の形態1の命令
プリフェッチ装置によれば、条件確定信号生成手段12
0と、条件確定判定部103を備え、第1デコード部1
01が、プリフェッチした命令をデコード処理する際
に、分岐命令であるか否かのみならず、条件生成命令で
あるか否かをも判断して、その旨を示す信号を出力する
ものとしたことで、条件が確定した場合にはその旨を示
す信号S118が条件確定判定部103に入力されるの
で、条件分岐命令がプリフェッチされた時に既に条件が
確定していれば、分岐予測をすることなく正しいプリフ
ェッチアドレスが生成され、予測ミスによる、分岐命令
実行時における遅延時間がなくなり、効率的な処理を実
行することが可能となる。
As described above, according to the instruction prefetch device of the first embodiment of the present invention, the condition determination signal generating means 12
0 and the condition confirmation determination unit 103, and the first decoding unit 1
When 01 decodes the prefetched instruction, it determines not only whether it is a branch instruction but also whether it is a condition generation instruction, and outputs a signal to that effect. When the condition is confirmed, the signal S118 indicating that is input to the condition determination determination unit 103. Therefore, if the condition is already confirmed when the conditional branch instruction is prefetched, branch prediction is not performed. A correct prefetch address is generated, a delay time due to a misprediction in executing a branch instruction is eliminated, and efficient processing can be executed.

【0059】実施の形態2. 本発明の実施の形態2による命令プリフェッチ装置は、
分岐条件が確定したか否かを命令実行処理において判定
し、条件が確定している場合は、当該条件に対応した命
令をプリフェッチするものである。図5は本実施の形態
2による命令プリフェッチ装置の構成を示すブロック図
である。図示するように、本実施の形態2による命令プ
リフェッチ装置は、プリフェッチアドレス生成部20
0、第1デコード部201、条件確定判定部202、命
令バッファ20、第2デコード部204、条件コード
保持部206、および演算実行部205を備えた構成と
なっている。図1との比較において、本実施の形態2に
おける命令プリフェッチ装置では、実施の形態1の装置
が備えていた、条件確定信号生成手段120を備えない
構成となっている。
Embodiment 2. The instruction prefetch device according to the second embodiment of the present invention is
In the instruction execution process, it is determined whether or not the branch condition is fixed. If the condition is fixed, the instruction corresponding to the condition is prefetched. FIG. 5 is a block diagram showing the configuration of the instruction prefetch device according to the second embodiment. As shown, the instruction prefetch device according to the second embodiment includes a prefetch address generation unit 20.
0, first decoding unit 201, condition determination judging unit 202, instruction buffer 20 3, the second decode section 204 has a configuration which includes a condition code holding unit 206 and the execution unit 205. In comparison with FIG. 1, the instruction prefetch device according to the second embodiment does not include the condition determination signal generating means 120 included in the device according to the first embodiment.

【0060】第1デコード部201はプリフェッチされ
た命令S209に対してデコード処理を行い、命令の内
容を意味する情報を取得して、命令バッファ203に対
してこれを出力する。また、第1デコード部201は、
命令が分岐命令であるか否かを判断し、分岐命令である
場合には、分岐信号を出力する分岐判定手段として機能
するものであり、命令S209が分岐命令である場合に
は、当該条件分岐命令における分岐先アドレスを示す信
号S208と、当該分岐命令における分岐条件を示す信
号S211とを出力する。信号S208、およびS22
1は、分岐命令であることを示す分岐信号としても扱わ
れる。
The first decoding unit 201 performs a decoding process on the prefetched instruction S209, obtains information indicating the content of the instruction, and outputs it to the instruction buffer 203. Also, the first decoding unit 201
It judges whether or not the instruction is a branch instruction, and when it is a branch instruction, it functions as a branch determination means for outputting a branch signal. When the instruction S209 is a branch instruction, the conditional branch is executed. The signal S208 indicating the branch destination address in the instruction and the signal S211 indicating the branch condition in the branch instruction are output. Signals S208 and S22
1 is also treated as a branch signal indicating that it is a branch instruction.

【0061】演算実行部205は、条件確定信号S21
2を生成する条件確定信号生成手段として機能するもの
であり、命令の実行の際に、当該命令が条件コードを変
更する命令、すなわち条件生成命令であり、かつ、当該
変更される条件コードが、当該条件生成命令に後続する
条件分岐命令に対して影響を与えるものである場合に
は、当該命令の実行が完了した際に、条件確定信号S2
12を条件確定判定部202に対して出力する。
The calculation executing section 205 determines the condition confirmation signal S21.
Is intended to function as a condition determination signal generating means for generating 2, upon execution of the instruction, the instruction to which the instruction to change the condition code, i.e., a condition generation instruction, and the condition code is the change , Which affects the conditional branch instruction following the condition generation instruction, when the execution of the instruction is completed, the condition determination signal S2
12 is output to the condition determination determination unit 202.

【0062】このため、本実施の形態2による命令プリ
フェッチ装置が処理対象とするプログラムにおいては、
上記の条件を満たす命令については、その旨を示す情報
を当該命令自体が有するものとしておくものである。こ
のような設定は、例えば、コンパイルのような実行形式
のプログラムを作成する処理において、命令を解析し
て、後続する条件分岐命令に影響を与える条件生成命令
については、その旨を示す情報を付与することで実現す
ることができる。従って、本実施の形態2においては、
その旨を当該命令中に持たせることにより、当該条件生
成命令の実行が完了した時に条件確定判定部202に条
件確定信号212を送るものである。
Therefore, in the program to be processed by the instruction prefetch device according to the second embodiment,
For an instruction satisfying the above conditions, the information indicating that is included in the instruction itself. Such a setting is, for example, in the process of creating an executable program such as compilation, analyzing an instruction and adding information indicating that to a conditional generation instruction that affects a subsequent conditional branch instruction. It can be realized by doing. Therefore, in the second embodiment,
By including that fact in the instruction, the condition determination signal 212 is sent to the condition determination determination unit 202 when the execution of the condition generation instruction is completed.

【0063】プリフェッチアドレス生成部200、命令
バッファ203、第2デコード部204、および条件コ
ード保持部206は、実施の形態1の装置における10
0、104、105、および106と同様であるので、
説明を省略する。
The prefetch address generating unit 200, the instruction buffer 203, the second decoding unit 204, and the condition code holding unit 206 are the same as those in the device of the first embodiment.
Is the same as 0, 104, 105, and 106, so
The description is omitted.

【0064】このように構成された本実施の形態2によ
る命令プリフェッチ装置における、動作の概要を以下に
説明する。あるタイミングにおいて、プリフェッチアド
レス生成部200において、次にフェッチすべき命令の
アドレスが生成され、プリフェッチアドレス信号S20
7として出力される。当該命令プリフェッチ装置を用い
るプロセッサにおいては、このプリフェッチアドレス信
号S207を用いて、命令をフェッチし、この命令S2
09を当該命令プリフェッチ装置に入力する。次のタイ
ミングでは、プリフェッチされた命令S209が、第1
デコード部201に入力され、デコード処理される。
An outline of the operation of the instruction prefetch device according to the second embodiment having the above-described structure will be described below. At a certain timing, the prefetch address generation unit 200 generates the address of the instruction to be fetched next, and the prefetch address signal S20
It is output as 7. In the processor using the instruction prefetch device, the instruction is fetched by using the prefetch address signal S207, and the instruction S2 is fetched.
09 is input to the instruction prefetch device. At the next timing, the prefetched instruction S209 is
It is input to the decoding unit 201 and subjected to decoding processing.

【0065】第1デコード部201では、命令S209
が条件分岐命令であるか否かの判断を行う。命令S20
9が条件分岐命令であった場合、第1デコード部201
は、当該条件分岐命令における分岐先アドレスを示す信
号S208をプリフェッチアドレス部200に出力し、
それとともに、当該分岐命令における分岐条件を示す信
号S211を条件確定判定部202に出力する。また、
命令S209が条件分岐命令であった場合、またはなか
った場合のいずれにおいても、命令S209の内容を示
す信号を命令バッファ104に出力する。
In the first decoding section 201, the instruction S209
Is a conditional branch instruction. Command S20
If 9 is a conditional branch instruction, the first decoding unit 201
Outputs a signal S208 indicating the branch destination address in the conditional branch instruction to the prefetch address unit 200,
At the same time, the signal S211 indicating the branch condition in the branch instruction is output to the condition determination determination unit 202. Also,
Whether the instruction S209 is a conditional branch instruction or not, a signal indicating the content of the instruction S209 is output to the instruction buffer 104.

【0066】命令バッファ203において一時蓄積され
た命令の内容を示す信号は、その後第2デコード部20
4によって取り出され、デコード処理されることによっ
て、命令の内容が解釈される。第2デコード部204
は、解釈した命令の内容に従った指示を演算実行部20
5に出力し、演算実行部205は、入力された指示に基
づいて、演算処理を実行する。演算処理の結果は、当該
命令プリフェッチ装置を含むプロセッサにおいて処理さ
れるとともに、当該演算処理の結果が条件コードに影響
を及ぼす場合には、条件コード保持部206に出力され
て保持されることとなる。
The signal indicating the content of the instruction temporarily stored in the instruction buffer 203 is then sent to the second decoding section 20.
The contents of the instruction are interpreted by being fetched by 4 and decoded. Second decoding unit 204
Is the operation execution unit 20 that gives an instruction according to the content of the interpreted instruction.
5, and the arithmetic execution unit 205 executes arithmetic processing based on the input instruction. The result of the arithmetic processing is processed in the processor including the instruction prefetch device, and when the result of the arithmetic processing affects the condition code, it is output to the condition code holding unit 206 and held therein. .

【0067】本実施の形態2による命令プリフェッチ装
置では、演算実行部205は、以下の場合には、条件コ
ード出力にともなって、条件確定信号S212を条件確
定判定部202に出力するものである。すなわち、命令
S209が条件生成命令であり、かつ、その実行結果と
して得られる条件コードが、後続の条件分岐命令におい
て用いられるものである場合に、上記のように条件確定
信号S212を出力する。このことにより、本実施の形
態2による装置では、プリフェッチアドレスの生成にあ
たり、条件コード保持部206に保持された条件コード
を使用可能な旨が、条件確定判定部202に伝達される
こととなる。
In the instruction prefetch device according to the second embodiment, the operation executing unit 205 outputs the condition confirmation signal S212 to the condition confirmation determining unit 202 with the output of the condition code in the following cases. That is, when the instruction S209 is the condition generation instruction and the condition code obtained as the execution result thereof is used in the subsequent conditional branch instruction, the condition determination signal S212 is output as described above. As a result, in the device according to the second embodiment, the fact that the condition code held in the condition code holding unit 206 can be used when the prefetch address is generated is transmitted to the condition confirmation determination unit 202.

【0068】条件確定判定部202に対して、分岐条件
を示す信号S211が入力され、かつ、条件確定信号S
212が入力されたときは、条件コード保持部206よ
り条件コードを取得し、これをプリフェッチアドレス情
報S210として、プリフェッチアドレス部200に出
力する。これに対して、分岐条件を示す信号S211が
入力されるが、条件確定信号S212が入力されない場
合は、条件確定判定部202は動作せず、実施の形態1
と同様に分岐予測部(図示せず)による予測が、プリフ
ェッチアドレス生成部200に入力され、用いられるこ
ととなる。この後、プリフェッチアドレス生成部200
の動作は実施の形態1と同様のものであり、本実施の形
態2による命令プリフェッチ装置の装置出力として、プ
リフェッチアドレス信号S207が出力される。
A signal S211 indicating a branching condition is input to the condition determination determination unit 202, and the condition determination signal S
When 212 is input, the condition code is acquired from the condition code holding unit 206 and is output to the prefetch address unit 200 as the prefetch address information S210. On the other hand, when the signal S211 indicating the branch condition is input but the condition confirmation signal S212 is not input, the condition determination determination unit 202 does not operate and the first embodiment
Similarly, the prediction by the branch prediction unit (not shown) is input to the prefetch address generation unit 200 and used. After this, the prefetch address generation unit 200
Is the same as that of the first embodiment, and the prefetch address signal S207 is output as the device output of the instruction prefetch device according to the second embodiment.

【0069】次に従来技術による装置、および実施の形
態1による装置の場合と同様に、図8に示すプログラム
について実行する場合の動作を説明するが、本実施の形
態2による装置においても、タイミングと動作との関係
は実施の形態1と同様のものとなるので、実施の形態1
におけるタイミングチャート図を用いることとし、以下
に図3のタイミングチャートに従って説明する。図3の
チャートに示すタイミングt1では、プリフェッチアド
レス生成部200において命令400のアドレスが生成
され、プリフェッチアドレス信号S207として出力さ
れる。当該命令プリフェッチ装置を用いるプロセッサに
おいては、このプリフェッチアドレス信号S207を用
いて、命令400をフェッチし、当該命令プリフェッチ
装置に入力する。次のタイミングt2で、プリフェッチ
された命令400が、第1デコード部201に入力さ
れ、デコード処理される。
Next, the operation when the program shown in FIG. 8 is executed will be described as in the case of the apparatus according to the prior art and the apparatus according to the first embodiment, but the timing is also used in the apparatus according to the second embodiment. Since the relationship between the operation and the operation is the same as that in the first embodiment, the first embodiment
The timing chart in FIG. 3 will be used and will be described below with reference to the timing chart in FIG. At timing t1 shown in the chart of FIG. 3, the address of the instruction 400 is generated in the prefetch address generation unit 200 and output as the prefetch address signal S207. In the processor using the instruction prefetch device, the instruction 400 is fetched by using the prefetch address signal S207 and input to the instruction prefetch device. At the next timing t2, the prefetched instruction 400 is input to the first decoding unit 201 and decoded.

【0070】命令400は条件分岐命令ではないので、
分岐アドレスを示す信号S208と、分岐条件を示す信
号S211とは出力されない。
Since the instruction 400 is not a conditional branch instruction,
The signal S208 indicating the branch address and the signal S211 indicating the branch condition are not output.

【0071】また、命令400の内容を示す信号は命令
バッファ203に出力される。第2デコード部204は
命令バッファ203から命令400を取り出してデコー
ド処理することにより、命令400が加算命令である旨
を解釈し、信号出力によってデコード処理の結果を演算
実行部205に伝える。命令400は、条件生成命令で
あり、かつ、その実行結果は直後の条件分岐命令401
に影響を与えるものである。この旨は当該命令400に
対して、コンパイル時付与された情報から取得されるも
のであり、ここで、第2デコード部204によって解釈
された上で、演算実行部205に伝えられる。
A signal indicating the content of the instruction 400 is output to the instruction buffer 203. The second decoding unit 204 takes out the instruction 400 from the instruction buffer 203 and decodes it to interpret that the instruction 400 is an addition instruction, and transmits the result of the decoding processing to the operation execution unit 205 by outputting a signal. The instruction 400 is a condition generation instruction, and its execution result is the conditional branch instruction 401 immediately after.
That will affect. This fact is obtained from the information given to the instruction 400 at the time of compilation, and is interpreted by the second decoding unit 204 and then transmitted to the operation executing unit 205.

【0072】演算実行部205は、命令400が意味す
る加算処理を実行し、加算処理の結果は条件コードに影
響を与え得るものであることから、当該加算処理の結果
を条件コード保持部206に出力し、条件コード保持部
206は変更された条件コードを保持する。図3のタイ
ミングt3において、条件フラグが確定する。そして、
本実施の形態2における演算実行部205は、第2デコ
ード部204から伝達された命令400についての情報
に基づいて、条件確定信号S212を条件確定判定部2
02に出力する。条件確定信号S212を入力された条
件確定判定部202では、条件コード保持部206から
条件コードS213を取得する。
The arithmetic execution unit 205 executes the addition process indicated by the instruction 400, and the result of the addition process may affect the condition code. Therefore, the result of the addition process is stored in the condition code holding unit 206. Then, the condition code holding unit 206 holds the changed condition code. At timing t3 in FIG. 3, the condition flag is settled. And
The operation executing unit 205 in the second embodiment sends the condition confirmation signal S212 to the condition confirmation determining unit 2 based on the information about the instruction 400 transmitted from the second decoding unit 204.
Output to 02. The condition confirmation determination unit 202, to which the condition confirmation signal S212 is input, acquires the condition code S213 from the condition code holding unit 206.

【0073】タイミングt4において、条件分岐命令で
ある命令401が第1デコード部201においてデコー
ド処理をされる。命令401が分岐命令であることか
ら、分岐条件を示す信号S211が条件確定判定部20
2に出力される。条件確定判定部202では、信号S2
11の入力に応じて、取得した条件コードS213に基
づいて、条件分岐命令401の次に実行すべき命令アド
レスとして、正しいアドレス(命令403のアドレス)
を生成するようにプリフェッチアドレス生成部200に
指示する。これによりタイミングt5で生成されたプリ
フェッチアドレスに基づいて、命令403のプリフェッ
チが行われることとなる。
At timing t4, the instruction 401, which is a conditional branch instruction, is decoded in the first decoding unit 201. Since the instruction 401 is a branch instruction, the signal S211 indicating the branch condition is the condition determination determination unit 20.
2 is output. In the condition confirmation determination unit 202, the signal S2
According to the input of 11, the correct address (address of the instruction 403) as the instruction address to be executed next to the conditional branch instruction 401 based on the acquired condition code S213.
To the prefetch address generation unit 200. As a result, the instruction 403 is prefetched based on the prefetch address generated at the timing t5.

【0074】このように、本実施の形態2の命令プリフ
ェッチ装置によれば、後続の条件分岐命令に影響を与え
る条件生成命令については、その旨を当該命令自体が情
報として有するものとし、当該命令実行時に、演算実行
部205が条件確定信号を生成するものとしたことで、
実施の形態1と同様に、条件分岐命令がプリフェッチさ
れた時に既に条件が確定していれば、分岐予測をするこ
となく正しいプリフェッチアドレスが生成され、予測ミ
スによる、分岐命令実行時における遅延時間がなくな
り、効率的な処理を実行することが可能となる。
As described above, according to the instruction prefetch device of the second embodiment, regarding the condition generation instruction which affects the subsequent conditional branch instruction, the instruction itself has the fact as information, and the instruction concerned. At the time of execution, since the operation execution unit 205 is supposed to generate the condition confirmation signal,
Similar to the first embodiment, if the condition is already established when the conditional branch instruction is prefetched, the correct prefetch address is generated without performing the branch prediction, and the delay time at the time of executing the branch instruction due to the misprediction is predicted. It becomes possible to execute efficient processing.

【0075】本実施の形態2では、プログラムコンパイ
ル時に上記のような処理を行う必要があり、かかる処理
のされた、本実施の形態2の装置に対応したプログラム
を用いねばならないが、命令に対応した演算処理実行と
ともに、条件確定を確認して条件確定信号を生成するこ
とができ、当該命令プリフェッチ装置において、装置の
構成の簡略化と処理の単純化とを図ることが可能とな
る。
In the second embodiment, it is necessary to perform the above-mentioned processing at the time of compiling the program, and a program corresponding to the device of the second embodiment, which has been subjected to such processing, must be used. With the execution of the arithmetic processing, it is possible to confirm the condition confirmation and generate the condition confirmation signal, and in the instruction prefetch device, it is possible to simplify the configuration of the device and the processing.

【0076】[0076]

【発明の効果】請求項1の命令プリフェッチ装置によれ
ば、命令を実行する計算機において、上記命令を記憶す
る記憶装置から先読みする命令プリフェッチ装置であっ
て、上記先読みされた命令が、分岐を指令する分岐命令
であるか否かを判断し、分岐命令である場合には、分岐
信号を出力する分岐判定手段と、上記分岐信号が出力さ
れた場合に、上記分岐命令における分岐を決定する条件
が確定しているか否かを判定し、確定している場合に
は、当該条件に対応した確定条件情報を、後述するプリ
フェッチアドレス生成手段に対して出力する確定条件情
報生成手段と、所定の分岐予測方法に従って、分岐先の
命令を指定する情報を生成する分岐予測手段と、上記確
定条件情報生成手段より、確定条件情報を入力されたと
きは、当該確定条件情報に基づいて、プリフェッチすべ
きアドレスを生成し、上記確定条件情報を入力されない
ときは、上記分岐予測手段が生成した情報に基づいてプ
リフェッチすべきアドレスを生成するプリフェッチアド
レス生成手段とを備え、上記確定条件情報生成手段は、
上記分岐命令における分岐を決定する条件が確定してい
るか否かを判定し、確定している場合には条件確定信号
を出力する条件確定信号生成手段と、上記条件確定信号
が出力されたときは、当該確定した条件を取得して、上
記取得した条件に基づいて上記確定条件情報を生成する
条件確定判定手段とを有するものとし、上記条件確定信
号生成手段は、上記分岐判定手段から出力されたアドレ
スを保持する第一の命令アドレス保持手段と、その時点
において実行されている命令のアドレスを保持する第二
の命令アドレス保持手段と、上記第一の命令アドレス保
持手段と、上記第二の命令アドレス保持手段とが保持す
るアドレスの比較処理を行い、上記比較において一致し
ていると判定する場合に、上記条件確定信号を上記条件
判定確定手段に出力する比較手段とを有するものとした
ので、分岐命令に続く命令のプリフェッチにあたり、条
件が確定している場合には、当該確定した条件に対応し
た命令のアドレスを生成し、確定していない場合には所
定の予測方法に従って命令のアドレスを生成するので、
分岐予測ミスによる遅延を低減して、装置資源を活用し
た処理の効率化が可能となるばかりでなく、条件が確定
したか否かを、条件確定信号において伝達することで、
当該確定 した条件に対応したプリフェッチアドレスを生
成して、分岐予測ミスによる遅延を低減して、装置資源
を活用した処理の効率化が可能となり、さらに、条件が
確定したか否かの判定を、条件を確定する命令のアドレ
スを実行中の命令のアドレスと比較することで実行する
ことで、条件が確定したか否かの判定を実行し、分岐予
測ミスによる遅延を低減して、装置資源を活用した処理
の効率化が可能となる。
According to the instruction prefetch device of the first aspect, in a computer that executes an instruction, the instruction prefetch device prefetches from a storage device that stores the instruction, and the prefetched instruction commands a branch. If the branch instruction is a branch instruction, a branch determination unit that outputs a branch signal and a condition that determines a branch in the branch instruction when the branch signal is output are determined. Whether or not it has been decided, and when it has been decided, the definite condition information corresponding to the condition is outputted to a prefetch address generating means which will be described later, and a predetermined branch prediction. According to the method, when the definite condition information is input from the branch predicting unit that generates information designating a branch destination instruction and the definite condition information generating unit, the definite condition Based on the distribution, and generates an address to be prefetched, when not inputting the confirmation condition information, and a prefetch address generating means for generating an address to be prefetched based on information the branch prediction unit is generated, the The confirmation condition information generating means is
The conditions that determine the branch in the above branch instruction have been determined.
Condition confirmation signal if it is confirmed.
Condition determination signal generating means for outputting
When is output, obtain the confirmed conditions and
Generate the fixed condition information based on the acquired conditions
The above-mentioned condition confirmation message shall be provided.
The signal generating means outputs the address output from the branch determining means.
The first instruction address holding means for holding the
A second holding the address of the instruction being executed in
Of the first instruction address holding means
Held by the holding means and the second instruction address holding means.
Address comparison processing is performed.
If it is determined that the above condition determination signal is
It has a comparison means for outputting to the determination confirmation means.
Therefore, in prefetching an instruction following a branch instruction, if the condition is fixed, the address of the instruction corresponding to the fixed condition is generated, and if not fixed, the address of the instruction is determined according to a predetermined prediction method. Will generate
Not only can the delay due to branch misprediction be reduced, the efficiency of processing that utilizes equipment resources can be improved, but the conditions are also fixed.
By transmitting whether or not it is done in the condition confirmation signal,
Generate a prefetch address corresponding to the confirmed conditions.
To reduce the delay due to branch misprediction,
It is possible to improve the efficiency of processing by utilizing
The address of the instruction that determines the condition is used to determine whether it has been determined.
Execution by comparing the address with the address of the executing instruction
By doing so, it is possible to judge whether or not the condition is fixed, and
Processing that utilizes equipment resources by reducing delays due to measurement errors
The efficiency of can be improved.

【0077】請求項2の命令プリフェッチ装置によれ
ば、請求項1の装置において、上記分岐判定手段は、上
記先読みされた命令が条件生成命令であるか否かを判定
し、条件生成命令である場合は、当該条件生成命令のア
ドレスを上記第1の命令アドレス保持手段に対して出力
するとともに、上記条件確定判定手段に対して、条件未
確定信号を出力するものであり、上記出力する分岐信号
として、当該分岐命令における分岐条件を示す情報を、
上記条件確定判定手段に対して出力するとともに、上記
分岐命令における分岐先アドレスを示す情報を、上記プ
リフェッチアドレス生成手段に対して出力するものであ
り、条件生成命令に対する判定処理を実行し、そのアド
レスを保持することで、アドレス比較による条件確定に
ついての判断を実行するので、条件が確定していたなら
ば、当該条件を利用し、分岐予測ミスによる遅延を低減
して、装置資源を活用した処理の効率化が可能となる。
According to the instruction prefetch device of claim 2, in the device of claim 1, the branch determining means is
Judge whether the prefetched instruction is a condition generation instruction
However, if it is a condition generation instruction, the condition generation instruction
Output the dress to the first instruction address holding means
In addition, the condition confirmation
Outputs a definite signal and outputs the branch signal
As the information indicating the branch condition in the branch instruction,
While outputting to the condition confirmation determination means,
Information indicating the branch destination address in the branch instruction is
It is output to the refetch address generation means.
To execute the judgment processing for the condition generation instruction and
By holding the reply, the condition can be determined by comparing the addresses.
If the condition is confirmed, it will make a judgment about
For example, it is possible to reduce the delay due to a branch misprediction by using this condition and improve the efficiency of the processing that utilizes the device resources.

【0078】請求項3の命令プリフェッチ装置によれ
ば、請求項2の装置において、上記条件確定判定手段
は、上記条件確定信号を入力されたとき、当該分岐命令
の次のアドレス、又は上記分岐先アドレスを用いるべき
旨を示す条件確定情報を上記プリフェッチアドレス生成
手段に対して出力するものであり、確定した条件に対応
した命令のアドレスを生成するので、分岐予測ミスによ
る遅延を低減して、装置資源を活用した処理の効率化が
可能となる。
According to the instruction prefetch device of claim 3, in the device of claim 2, the condition confirmation determining means.
Is the branch instruction when the condition confirmation signal is input.
Next address or the branch destination address above should be used
Condition confirmation information indicating that the above prefetch address is generated
It is output to the means and corresponds to the fixed condition
Since the address of the executed instruction is generated, the delay due to the branch prediction error can be reduced, and the efficiency of the processing utilizing the device resources can be improved.

【0079】請求項4にかかる命令プリフェッチ装置に
よれば、先読みされた第1の命令が、条件分岐命令であ
るかを判定する命令判定手段と、前記第1の命令の直前
の条件生成命令のアドレスを記憶する手段と、記憶され
たアドレスと、実行されている命令のアドレスとを比較
する比較手段と、前記第1の命令が条件分岐命令と判定
された場合において、前記比較手段にてアドレスの一致
検出された場合には、確定した条件よりプリフェッチ
アドレスを出力するプリフェッチアドレス生成手段とを
備えたものとしたので、分岐条件が確定したか否かを条
件生成命令実行の際に予め判定しているため、条件が確
定している場合は当該条件に基づく命令のプリフェッチ
アドレスを生成でき、分岐予測ミスによる分岐命令実行
時の遅延をなくすことが可能となる。
According to the instruction prefetch device of the fourth aspect, the instruction judging means for judging whether or not the prefetched first instruction is the conditional branch instruction, and the condition generating instruction immediately before the first instruction. means for storing the addresses, the stored address, and comparing means for comparing the address of the instruction being executed, in a case where the first instruction is determined to conditional branch instruction, a Te to the comparison means Since the prefetch address generating means for outputting the prefetch address from the determined condition is provided when the match of the address is detected , the condition generating instruction is executed depending on whether or not the branch condition is determined. If the condition is confirmed, the prefetch address of the instruction based on the condition can be generated, and the branch instruction execution delay due to the branch misprediction is eliminated. Succoth is possible.

【0080】請求項5にかかる命令プリフェッチ方法に
よれば、先読みされた第1の命令が、条件分岐命令であ
るかを判定する命令判定工程と、前記第1の命令の直前
の条件生成命令のアドレスを記憶する工程と、記憶され
たアドレスと、実行されている命令のアドレスとを比較
する比較工程と、前記第1の命令が条件分岐命令と判定
された場合において、前記比較工程にてアドレスの一致
検出された場合には、確定した条件よりプリフェッチ
アドレスを出力するプリフェッチアドレス生成工程とを
含むものとしたので、分岐条件が確定したか否かを条件
生成命令実行の際に予め判定しているため、条件が確定
している場合は当該条件に基づく命令のプリフェッチア
ドレスを生成でき、分岐予測ミスによる分岐命令実行時
の遅延をなくすことが可能となる。
According to the instruction prefetch method of the fifth aspect, the instruction determining step of determining whether the prefetched first instruction is a conditional branch instruction, and the condition generating instruction immediately before the first instruction a step of storing the addresses, the stored address, a comparison step of comparing the address of the instruction being executed, in a case where the first instruction is determined to conditional branch instruction, a Te on the comparison step If a match of the address is detected, the prefetch address generation step of outputting the prefetch address based on the determined condition is included. Therefore, it is determined whether the branch condition is determined by executing the condition generation instruction. When the condition is confirmed, the prefetch address of the instruction based on the condition can be generated and the delay in executing the branch instruction due to the branch misprediction is eliminated. It becomes possible.

【0081】[0081]

【0082】[0082]

【0083】[0083]

【0084】[0084]

【0085】[0085]

【0086】[0086]

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の実施の形態1による命令プリフェッチ
装置の構成を示すブロック図である。
FIG. 1 is a block diagram showing a configuration of an instruction prefetch device according to a first embodiment of the present invention.

【図2】同実施の形態のプリフェッチアドレス生成部の
機能を説明するための、要部構成を示すブロック図であ
る。
FIG. 2 is a block diagram showing a main configuration for explaining a function of a prefetch address generation unit of the same embodiment.

【図3】同実施の形態における処理の概略動作を示すタ
イミングチャート図である。
FIG. 3 is a timing chart diagram showing a schematic operation of a process in the same embodiment.

【図4】同実施の形態における処理の流れを、従来技術
による場合と比較して説明するための図である。
FIG. 4 is a diagram for explaining the flow of processing in the same embodiment in comparison with the case of a conventional technique.

【図5】本発明の実施の形態2による命令プリフェッチ
装置の構成を示すブロック図である。
FIG. 5 is a block diagram showing a configuration of an instruction prefetch device according to a second embodiment of the present invention.

【図6】計算機のプロセッサによる処理を説明するため
の図である。
FIG. 6 is a diagram for explaining processing by a processor of a computer.

【図7】従来の技術による命令プリフェッチ装置の構成
を示すブロック図である。
FIG. 7 is a block diagram showing a configuration of an instruction prefetch device according to a conventional technique.

【図8】処理の対象となるプログラムの一例を示す図で
ある。
FIG. 8 is a diagram showing an example of a program to be processed.

【図9】従来の技術における処理の概略動作を示すタイ
ミングチャート図である。
FIG. 9 is a timing chart showing a schematic operation of processing in a conventional technique.

【符号の説明】[Explanation of symbols]

100,200,300 プリフェッチアドレス生成
部 101,201,303 第1デコード部 102 条件生成命令アドレス保持
部 103,202 条件確定判定部 104,203,305 命令バッファ 105,204,306 第2デコード部 106,206,308 条件コード保持部 107,205,307 演算実行部 108 プログラムカウンタ 109 比較器 120 条件確定信号生成手段
100, 200, 300 prefetch address generation unit 101, 201, 303 first decoding unit 102 condition generation instruction address holding unit 103, 202 condition determination determination unit 104, 203, 305 instruction buffer 105, 204, 306 second decoding unit 106, 206, 308 Condition code holding units 107, 205, 307 Operation execution unit 108 Program counter 109 Comparator 120 Condition determination signal generating means

───────────────────────────────────────────────────── フロントページの続き (56)参考文献 特開 平6−161750(JP,A) 特開 平1−119829(JP,A) 特開 平4−60720(JP,A) 特開 昭61−208130(JP,A) 特開 昭50−128949(JP,A) (58)調査した分野(Int.Cl.7,DB名) G06F 9/38 ─────────────────────────────────────────────────── ─── Continuation of the front page (56) Reference JP-A-6-161750 (JP, A) JP-A-1-119829 (JP, A) JP-A-4-60720 (JP, A) JP-A-61- 208130 (JP, A) JP-A-50-128949 (JP, A) (58) Fields investigated (Int.Cl. 7 , DB name) G06F 9/38

Claims (5)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 命令を実行する計算機において、上記命
令を記憶する記憶装置から先読みする命令プリフェッチ
装置であって、 上記先読みされた命令が、分岐を指令する分岐命令であ
るか否かを判断し、分岐命令である場合には、分岐信号
を出力する分岐判定手段と、 上記分岐信号が出力された場合に、上記分岐命令におけ
る分岐を決定する条件が確定しているか否かを判定し、
確定している場合には、当該条件に対応した確定条件情
報を、後述するプリフェッチアドレス生成手段に対して
出力する確定条件情報生成手段と、 所定の分岐予測方法に従って、分岐先の命令を指定する
情報を生成する分岐予測手段と、 上記確定条件情報生成手段より、確定条件情報を入力さ
れたときは、当該確定条件情報に基づいて、プリフェッ
チすべきアドレスを生成し、上記確定条件情報を入力さ
れないときは、上記分岐予測手段が生成した情報に基づ
いてプリフェッチすべきアドレスを生成するプリフェッ
チアドレス生成手段とを備え、 上記確定条件情報生成手段は、上記分岐命令における分
岐を決定する条件が確定しているか否かを判定し、確定
している場合には条件確定信号を出力する条件確定信号
生成手段と、上記条件確定信号が出力されたときは、当
該確定した条件を取得して、上記取得した条件に基づい
て上記確定条件情報を生成する条件確定判定手段とを有
し、 上記条件確定信号生成手段は、上記分岐判定手段から出
力された命令のアドレスを保持する第一の命令アドレス
保持手段と、その時点において実行されている命令のア
ドレスを保持する第二の命令アドレス保持手段と、上記
第一の命令アドレス保持手段と、上記第二の命令アドレ
ス保持手段とが保持するアドレスの比較処理を行い、上
記比較において一致していると判定する場合に、上記条
件確定信号を上記条件判定確定手段に出力する比較手段
とを有する、 ことを特徴とする命令プリフェッチ装置。
1. A computer for executing instructions, which is an instruction prefetch device for prefetching from a storage device for storing the instructions, wherein the prefetched instruction is a branch instruction for instructing branching. In the case of a branch instruction, a branch determination unit that outputs a branch signal, and, when the branch signal is output, determines whether or not the condition for determining the branch in the branch instruction is fixed.
If it has been decided, the decision condition information generating means for outputting the decision condition information corresponding to the condition to the prefetch address generating means described later and the instruction of the branch destination according to the predetermined branch prediction method are specified. When the definite condition information is input from the branch predicting unit that generates information and the definite condition information generating unit, an address to be prefetched is generated based on the definite condition information, and the definite condition information is not input. And a prefetch address generating means for generating an address to be prefetched based on the information generated by the branch predicting means, wherein the definite condition information generating means determines the condition for determining the branch in the branch instruction. Whether or not there is a condition-determining signal generating means for outputting a condition-determining signal, and the condition-determining device And a condition confirmation determination means for acquiring the confirmed condition and generating the confirmed condition information based on the acquired condition. First instruction address holding means for holding the address of the instruction output from the judging means, second instruction address holding means for holding the address of the instruction currently being executed, and the first instruction address holding Means for comparing the addresses held by the means and the second instruction address holding means, and when it is determined that they match in the comparison, the comparison means for outputting the condition determination signal to the condition determination determining means. An instruction prefetch device, comprising:
【請求項2】 請求項1に記載の命令プリフェッチ装置
において、 上記分岐判定手段は、 上記先読みされた命令が条件生成命令であるか否かを判
定し、条件生成命令である場合は、当該条件生成命令の
アドレスを上記第1の命令アドレス保持手段に対して出
力するとともに、上記条件確定判定手段に対して、条件
未確定信号を出力するものであり、 上記出力する分岐信号として、当該分岐命令における分
岐条件を示す情報を、上記条件確定判定手段に対して出
力するとともに、上記分岐命令における分岐先アドレス
を示す情報を、上記プリフェッチアドレス生成手段に対
して出力するものである ことを特徴とする命令プリフェッチ装置。
2. The instruction prefetch device according to claim 1, wherein the branch determination means determines whether or not the prefetched instruction is a condition generation instruction, and if it is a condition generation instruction, the condition is fetched. The address of the generated instruction is output to the first instruction address holding means, and at the same time, a condition undetermined signal is output to the condition determination determination means. The branch signal to be output is the branch instruction. information indicating the branch condition of, and outputs to said condition determination judging means, information indicating a branch destination address in the branch instruction, and outputs to said prefetch address generating means, and characterized in that Instruction prefetching device.
【請求項3】 請求項2に記載の命令プリフェッチ装置
において、 上記条件確定判定手段は、上記条件確定信号を入力され
たとき、当該分岐命令の次のアドレス、又は上記分岐先
アドレスを用いるべき旨を示す条件確定情報を上記プリ
フェッチアドレス生成手段に対して出力するものであ
ことを特徴とする命令プリフェッチ装置。
3. The instruction prefetch device according to claim 2, wherein the condition decision determining means should use the next address of the branch instruction or the branch destination address when the condition decision signal is input. and outputs to said prefetch address generating means the condition determination information indicating the instruction prefetch and wherein the.
【請求項4】 先読みされた第1の命令が、条件分岐命
令であるかを判定する命令判定手段と、 前記第1の命令の直前の条件生成命令のアドレスを記憶
する手段と、 記憶されたアドレスと、実行されている命令のアドレス
とを比較する比較手段と、 前記第1の命令が条件分岐命令と判定された場合におい
て、前記比較手段にてアドレスの一致検出された場合
には、確定した条件よりプリフェッチアドレスを出力す
るプリフェッチアドレス生成手段とを備えた ことを特徴とする命令プリフェッチ装置。
4. An instruction determination means for determining whether or not the prefetched first instruction is a conditional branch instruction, a means for storing an address of a condition generation instruction immediately before the first instruction, and stored. and address comparison means for comparing the address of the instruction being executed, in a case where the first instruction is determined to conditional branch instruction, if a match of addresses is detected Te in the comparison means , and a prefetch address generating means for outputting a prefetch address from established criteria, instruction prefetching apparatus characterized by.
【請求項5】 先読みされた第1の命令が、条件分岐命
令であるかを判定する命令判定工程と、 前記第1の命令の直前の条件生成命令のアドレスを記憶
する工程と、 記憶されたアドレスと、実行されている命令のアドレス
とを比較する比較工程と、 前記第1の命令が条件分岐命令と判定された場合におい
て、前記比較工程に ドレスの一致検出された場合
には、確定した条件よりプリフェッチアドレスを出力す
るプリフェッチアドレス生成工程とを含む ことを特徴とする命令プリフェッチ方法。
5. An instruction determination step of determining whether the prefetched first instruction is a conditional branch instruction, a step of storing an address of a condition generation instruction immediately before the first instruction, address, a comparison step of comparing the address of the instruction being executed, in a case where the first instruction is determined to conditional branch instruction, if a match of addresses Te in the comparing step is detected , instruction prefetching method and a prefetch address generating step, and wherein the outputs of the prefetch address from established criteria.
JP28519297A 1996-11-01 1997-10-17 Instruction prefetch apparatus and instruction prefetch method Expired - Fee Related JP3419276B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP28519297A JP3419276B2 (en) 1996-11-01 1997-10-17 Instruction prefetch apparatus and instruction prefetch method

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP29143396 1996-11-01
JP8-291433 1996-11-01
JP28519297A JP3419276B2 (en) 1996-11-01 1997-10-17 Instruction prefetch apparatus and instruction prefetch method

Related Child Applications (1)

Application Number Title Priority Date Filing Date
JP2002334960A Division JP2003150375A (en) 1996-11-01 2002-11-19 Device and method for prefetching instruction

Publications (2)

Publication Number Publication Date
JPH10187442A JPH10187442A (en) 1998-07-21
JP3419276B2 true JP3419276B2 (en) 2003-06-23

Family

ID=26555781

Family Applications (1)

Application Number Title Priority Date Filing Date
JP28519297A Expired - Fee Related JP3419276B2 (en) 1996-11-01 1997-10-17 Instruction prefetch apparatus and instruction prefetch method

Country Status (1)

Country Link
JP (1) JP3419276B2 (en)

Also Published As

Publication number Publication date
JPH10187442A (en) 1998-07-21

Similar Documents

Publication Publication Date Title
US4858104A (en) Preceding instruction address based branch prediction in a pipelined processor
JP3397081B2 (en) Processor, data processing system and method for speculatively executing a conditional branch instruction using a selected one of a plurality of branch prediction schemes
US6185676B1 (en) Method and apparatus for performing early branch prediction in a microprocessor
JP2761956B2 (en) Pipeline data processing system
US6662295B2 (en) Method and system dynamically presenting the branch target address in conditional branch instruction
US5313644A (en) System having status update controller for determining which one of parallel operation results of execution units is allowed to set conditions of shared processor status word
US5812809A (en) Data processing system capable of execution of plural instructions in parallel
EP0840209B1 (en) Instruction prefetching apparatus and instruction prefetching method
JP2006520964A (en) Method and apparatus for branch prediction based on branch target
JP2006520964A5 (en)
US5978905A (en) Program translating apparatus and a processor which achieve high-speed execution of subroutine branch instructions
JP3435267B2 (en) Microprocessor and load address prediction method thereof
EP1109095A2 (en) Instruction prefetch and branch prediction circuit
US6496924B2 (en) Data processing apparatus including a plurality of pipeline processing mechanisms in which memory access instructions are carried out in a memory access pipeline
US5461715A (en) Data processor capable of execution of plural instructions in parallel
US20040225866A1 (en) Branch prediction in a data processing system
JP3419276B2 (en) Instruction prefetch apparatus and instruction prefetch method
EP1622006B1 (en) Branch predicting apparatus and branch predicting method
JP2001060152A (en) Information processor and information processing method capable of suppressing branch prediction
US20050154859A1 (en) Branch prediction in a data processing apparatus
US7831806B2 (en) Determining target addresses for instruction flow changing instructions in a data processing apparatus
US5745723A (en) Data processing system capable of execution of plural instructions in parallel
JP2003150375A (en) Device and method for prefetching instruction
JP3602801B2 (en) Memory data access structure and method
JPH07262006A (en) Data processor with branch target address cache

Legal Events

Date Code Title Description
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080418

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20090418

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20100418

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20110418

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20120418

Year of fee payment: 9

LAPS Cancellation because of no payment of annual fees