JP2003150375A - Device and method for prefetching instruction - Google Patents

Device and method for prefetching instruction

Info

Publication number
JP2003150375A
JP2003150375A JP2002334960A JP2002334960A JP2003150375A JP 2003150375 A JP2003150375 A JP 2003150375A JP 2002334960 A JP2002334960 A JP 2002334960A JP 2002334960 A JP2002334960 A JP 2002334960A JP 2003150375 A JP2003150375 A JP 2003150375A
Authority
JP
Japan
Prior art keywords
instruction
condition
branch
address
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.)
Pending
Application number
JP2002334960A
Other languages
Japanese (ja)
Inventor
Kouji Zaiki
幸治 材木
Tetsuya Tanaka
哲也 田中
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 Holdings Corp
Original Assignee
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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP2002334960A priority Critical patent/JP2003150375A/en
Publication of JP2003150375A publication Critical patent/JP2003150375A/en
Pending legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a device and a method for prefetching instructions for reducing delay caused by a branch prediction error by continuously prefetching instructions according to conditions when the conditions are fixed at the time point when a conditional branch instruction is prefetched. SOLUTION: A first decode part 101 determines whether a processed instruction S112 is the conditional branch instruction or not and whether the instruction is a condition generating instruction for fixing branch conditions or not, a condition fix signal generating means 120 determined whether the conditions are fixed or not by comparing the address of condition generating instruction with contents of a program counter and outputs a condition fix signal S118 to a condition fixture determining part 103, and corresponding to this signal, the condition fixture determining part 103 outputs prefetch address information S114 for address generation to a prefetch address generating part 100 by using a condition code S119.

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. 6A 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. 7B, first, in the instruction fetch process, 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にかかる命令プリフェッチ方法は、先読み
された第1の命令が、条件分岐命令であるか否かを判定
する命令判定工程と、前記第1の命令の直前の条件生成
命令の実行が終了しているか否かを判定する終了判定工
程と、前記第1の命令が条件分岐命令と判定された場合
において、前記終了判定工程にて終了が判定された場合
には、確定した条件よりプリフェッチアドレスを出力す
るプリフェッチアドレス生成工程とを含むものであり、
条件生成命令に対する判定処理を実行し、確定した条件
に対応した命令のアドレスを生成する。
In order to achieve the above object, an instruction prefetch method according to a first aspect of the present invention includes an instruction determining step of determining whether or not the prefetched first instruction is a conditional branch instruction. A termination determination step of determining whether or not the execution of the condition generation instruction immediately before the first instruction is terminated, and a termination determination step in the case where the first instruction is determined to be a conditional branch instruction. If the end is determined by the prefetch address generation step of outputting the prefetch address from the determined condition,
The determination process for the condition generation instruction is executed, and the address of the instruction corresponding to the confirmed condition is generated.

【0024】また、請求項2にかかる命令プリフェッチ
方法は、請求項1に記載の命令プリフェッチ方法におい
て、前記終了判定工程は、前記第1の命令の直前の条件
生成命令のアドレスを記憶する工程と、記憶したアドレ
スと、実行されている命令のアドレスとを比較する比較
工程とを含むものであり、条件が確定したか否かの判定
を、条件を確定する命令のアドレスを実行中の命令のア
ドレスと比較することで実行し、条件が確定したか否か
を判定する。
An instruction prefetch method according to a second aspect is the instruction prefetch method according to the first aspect, wherein the end determination step is a step of storing an address of a condition generation instruction immediately before the first instruction. , A comparison step of comparing the stored address with the address of the instruction being executed, and determining whether or not the condition is fixed is performed by determining whether the address of the instruction for fixing the condition is It is executed by comparing with the address, and it is determined whether or not the condition is fixed.

【0025】また、請求項3にかかる命令プリフェッチ
装置は、先読みされた第1の命令が、条件分岐命令であ
るか否かを判定する命令判定手段と、前記第1の命令の
直前の条件生成命令の実行が終了しているか否かを判定
する終了判定手段と、前記第1の命令が条件分岐命令と
判定された場合において、前記終了判定工程にて終了が
判定された場合には、確定した条件よりプリフェッチア
ドレスを出力するプリフェッチアドレス生成手段とを備
えたものであり、条件生成命令に対する判定処理を実行
し、確定した条件に対応した命令のアドレスを生成す
る。
According to a third aspect of the present invention, there is provided an instruction prefetch device for determining whether or not the prefetched first instruction is a conditional branch instruction, and a condition generation immediately before the first instruction. Termination determining means for determining whether or not the execution of the instruction is terminated, and when the termination is determined in the termination determining step in the case where the first instruction is determined as the conditional branch instruction, the determination is made. The prefetch address generating means for outputting the prefetch address according to the condition is provided, and the determination process for the condition generating instruction is executed to generate the address of the instruction corresponding to the confirmed condition.

【0026】また、請求項4にかかる命令プリフェッチ
装置は、請求項3に記載の命令プリフェッチ装置におい
て、前記終了判定手段は、前記第1の命令の直前の条件
生成命令のアドレスを記憶する手段と、記憶したアドレ
スと、実行されている命令のアドレスとを比較する比較
手段とを含むものであり、条件が確定したか否かの判定
を、条件を確定する命令のアドレスを実行中の命令のア
ドレスと比較することで実行し、条件が確定したか否か
を判定する。
An instruction prefetch device according to a fourth aspect is the instruction prefetch device according to the third aspect, wherein the end determination means is means for storing the address of the condition generation instruction immediately before the first instruction. , A comparison unit that compares the stored address with the address of the instruction being executed, and determines whether or not the condition has been determined, by determining the address of the instruction that determines the condition of the instruction being executed. It is executed by comparing with the address, and it is determined whether or not the condition is fixed.

【0027】また、請求項5にかかる命令プリフェッチ
装置は、先読みされた命令が、条件生成命令または条件
分岐命令であるか否かを判定する命令判定手段と、先読
みされた命令のアドレスを保持する命令アドレス保持手
段と、実行されている命令のアドレスと、前記命令アド
レス保持手段のアドレスとを比較する比較手段と、前記
命令判定手段にて条件生成命令と判定されれば、自己の
状態をリセットし、前記比較手段で一致を検出されれば
自己のセットを行う条件確定判定手段と、前記命令判定
手段において条件分岐命令と判定された場合において、
前記条件確定判定手段がセットされている場合には、確
定した条件よりプリフェッチアドレスを出力し、セット
されていない場合には、所定の分岐予測方法によりアド
レスを出力するプリフェッチアドレス生成手段とを備え
たものであり、条件生成命令に対する判定処理を実行
し、そのアドレスを保持することで、アドレス比較によ
る条件確定についての判断を実行し、条件分岐命令の条
件が確定した場合は当該確定した条件に対応した命令の
アドレスを生成し、確定しない場合は所定の分岐予測方
法によりアドレスを出力する。
An instruction prefetch device according to a fifth aspect of the present invention holds an instruction determination means for determining whether a prefetched instruction is a condition generation instruction or a conditional branch instruction, and an address of the prefetched instruction. If the instruction address holding means, the comparing means for comparing the address of the executed instruction with the address of the instruction address holding means, and the instruction determining means determine that the instruction is a condition generation instruction, the own state is reset. However, in the case where the comparison means detects a match, it sets itself, and the case where the instruction judgment means judges that it is a conditional branch instruction,
And a prefetch address generating means for outputting a prefetch address according to the confirmed condition when the condition confirmation determining means is set, and for outputting an address according to a predetermined branch prediction method when the condition confirmation determining means is not set. By executing the judgment processing for the condition generation instruction and holding the address, the judgment of the condition confirmation by the address comparison is executed, and when the condition of the conditional branch instruction is confirmed, it corresponds to the confirmed condition. The address of the executed instruction is generated, and if it is not determined, the address is output by a predetermined branch prediction method.

【0028】また、請求項6にかかる命令プリフェッチ
装置は、命令を実行する計算機において、上記命令を記
憶する記憶装置から先読みする命令プリフェッチ装置で
あって、前記先読みされた命令が、分岐を指令する分岐
命令であるか否かを判断し、分岐命令である場合には、
分岐信号を出力する分岐判定手段と、前記先読みした命
令が前記分岐を決定する条件を確定する条件生成命令で
あるか否かを判定し、条件生成命令である場合は、当該
条件生成命令に従って演算処理を実行し、その結果を用
いて、確定条件情報を生成する確定条件情報生成手段
と、所定の分岐予測方法に従って、分岐先の命令を指定
する情報を生成する分岐予測手段と、前記分岐信号が出
力された場合に、前記確定条件情報生成手段より、確定
条件情報を入力されたときは、当該確定条件情報に基づ
いて、プリフェッチすべきアドレスを生成し、前記確定
条件情報を入力されないときは、前記分岐予測手段が生
成した情報に基づいてプリフェッチすべきアドレスを生
成するプリフェッチアドレス生成手段とを備えたもので
あり、上記確定条件情報生成手段は、条件生成命令につ
いての判定を演算処理に伴って実行する。
An instruction prefetch device according to a sixth aspect is an instruction prefetch device that prefetches from a storage device that stores the instruction in a computer that executes the instruction, and the prefetched instruction commands a branch. If it is a branch instruction, it is judged whether it is a branch instruction.
Branch determination means for outputting a branch signal, and whether or not the prefetched instruction is a condition generation instruction that determines the condition for determining the branch. If it is a condition generation instruction, an operation is performed according to the condition generation instruction. Deterministic condition information generating means for executing a process and using the result, deterministic condition information generating means, branch predicting means for generating information designating a branch destination instruction according to a predetermined branch predicting method, and the branch signal When the definite condition information is input from the definite condition information generating means, the address to be prefetched is generated based on the definite condition information, and when the definite condition information is not input. A prefetch address generating means for generating an address to be prefetched based on the information generated by the branch predicting means, Distribution generation means executes with a determination about the condition generation instruction to the arithmetic processing.

【0029】また、請求項7にかかる命令プリフェッチ
装置は、命令を実行する計算機において、上記命令を記
憶する記憶装置から先読みする命令プリフェッチ装置で
あって、上記先読みされた命令が、分岐を指令する分岐
命令であるか否かを判断し、分岐命令である場合には、
分岐信号を出力する分岐判定手段と、上記分岐信号が出
力された場合に、上記分岐命令における分岐を決定する
条件が確定しているか否かを判定し、確定している場合
には、当該条件に対応した確定条件情報を、後述するプ
リフェッチアドレス生成手段に対して出力する確定条件
情報生成手段と、上記確定条件情報生成手段より、確定
条件情報を入力されたときは、当該確定条件情報に基づ
いて、プリフェッチすべきアドレスを生成するプリフェ
ッチアドレス生成手段とを備えたものであり、分岐命令
に続く命令のプリフェッチにあたり、条件が確定してい
る場合には、当該確定した条件に対応した命令のアドレ
スを生成する。
An instruction prefetch device according to claim 7 is an instruction prefetch device that prefetches from a storage device that stores the instruction in a computer that executes the instruction, and the prefetched instruction commands a branch. If it is a branch instruction, it is judged whether it is a branch instruction.
Branch determination means for outputting a branch signal, and, when the branch signal is output, determines whether or not a condition for determining a branch in the branch instruction is fixed. If the condition is fixed, the condition is determined. When the definite condition information is input from the definite condition information generating means for outputting definite condition information corresponding to the definite condition information generating means to be described later and the definite condition information generating means, based on the definite condition information. And a prefetch address generating means for generating an address to be prefetched, and in the case of prefetching an instruction following a branch instruction, if the condition is fixed, the address of the instruction corresponding to the fixed condition. To generate.

【0030】また、請求項8にかかる命令プリフェッチ
装置は、請求項7の装置において、上記確定条件情報生
成手段は、上記分岐命令における分岐を決定する条件が
確定しているか否かを判定し、確定している場合には条
件確定信号を出力する条件確定信号生成手段と、上記条
件確定信号が出力されたときは、当該確定した条件を取
得して、上記取得した条件に基づいて上記確定条件情報
を生成する条件確定判定手段とを備えたものであり、条
件が確定したか否かを、条件確定信号において伝達し、
条件が確定している場合には当該条件を利用する。
According to an eighth aspect of the present invention, in the apparatus of the seventh aspect, the definite condition information generating means determines whether or not the condition for determining a branch in the branch instruction is definite. A condition-determining signal generating means that outputs a condition-determining signal when the condition-determining signal is output, and a condition-determining signal is output when the condition-determining signal is output. A condition confirmation determining means for generating information is provided, and whether or not the condition is confirmed is transmitted in a condition confirmation signal,
If the condition is confirmed, use the condition.

【0031】また、請求項9にかかる命令プリフェッチ
装置は、請求項8の装置において、上記条件確定信号生
成手段は、上記分岐判定手段から出力された命令のアド
レスを保持する第一の命令アドレス保持手段と、その時
点において実行されている命令のアドレスを保持する第
二の命令アドレス保持手段と、上記第一の命令アドレス
保持手段と、上記第二の命令アドレス保持手段とが保持
するアドレスの比較処理を行い、上記比較において一致
していると判定する場合に、上記条件確定信号を上記条
件判定確定手段に出力する比較手段とを備えたものであ
り、条件が確定したか否かの判定を、条件を確定する命
令のアドレスを実行中の命令のアドレスと比較すること
で実行し、条件が確定したか否かを判定する。
An instruction prefetch device according to a ninth aspect is the device according to the eighth aspect, wherein the condition determination signal generating means holds a first instruction address holding the address of the instruction output from the branch judging means. Means, second instruction address holding means for holding the address of the instruction being executed at that time, comparison of addresses held by the first instruction address holding means, and the second instruction address holding means When the processing is performed and it is determined that they match in the comparison, it is provided with a comparison unit that outputs the condition determination signal to the condition determination determination unit, and determines whether or not the condition is determined. By comparing the address of the instruction that determines the condition with the address of the instruction that is being executed, it is determined whether the condition has been determined.

【0032】また、請求項10にかかる命令プリフェッ
チ装置は、請求項9の装置において、上記分岐判定手段
は、上記先読みされた命令が条件生成命令であるか否か
を判定し、条件生成命令である場合は、当該条件生成命
令のアドレスを上記第1の命令アドレス保持手段に対し
て出力するとともに、上記条件確定判定手段に対して、
条件未確定信号を出力するものであり、上記出力する分
岐信号として、当該分岐命令における分岐条件を示す情
報を、上記条件確定判定手段に対して出力するととも
に、上記分岐命令における分岐先アドレスを示す情報
を、上記プリフェッチアドレス生成手段に対して出力す
るものであり、条件生成命令に対する判定処理を実行
し、そのアドレスを保持することで、アドレス比較によ
る条件確定についての判断を実行する。
According to a tenth aspect of the present invention, in the instruction prefetch apparatus according to the ninth aspect, the branch judging means judges whether the prefetched instruction is a condition generating instruction, In some cases, the address of the condition generation instruction is output to the first instruction address holding means, and the condition confirmation determination means
A condition undetermined signal is output, and as the branch signal to be output, information indicating a branch condition in the branch instruction is output to the condition determination determination means and a branch destination address in the branch instruction is output. The information is output to the prefetch address generation means, and the determination process for the condition generation instruction is executed, and the address is held, so that the condition determination by the address comparison is executed.

【0033】また、請求項11にかかる命令プリフェッ
チ装置は、請求項10の装置において、上記条件確定判
定手段は、上記条件確定信号を入力されたとき、当該分
岐命令の次のアドレス、又は上記分岐先アドレスを用い
るべき旨を示す条件確定情報を上記プリフェッチアドレ
ス生成手段に対して出力するものであり、確定した条件
に対応した命令のアドレスを生成する。
According to an eleventh aspect of the present invention, in the instruction prefetch apparatus according to the tenth aspect, when the condition decision determining means receives the condition decision signal, the address next to the branch instruction or the branch is issued. Condition determination information indicating that the destination address should be used is output to the prefetch address generation means, and the address of the instruction corresponding to the determined condition is generated.

【0034】また、請求項12にかかる命令プリフェッ
チ装置は、請求項7の装置において、上記確定条件情報
生成手段は、上記先読みした命令が上記分岐を決定する
条件を確定する条件生成命令であるか否かを判定し、条
件生成命令である場合は、当該条件生成命令に従って演
算処理を実行し、その結果を用いて、上記確定条件情報
を生成するものであり、条件生成命令についての判定を
演算処理に伴って実行する。
According to a twelfth aspect of the present invention, in the instruction prefetch device according to the seventh aspect, is the definite condition information generating means a condition generation instruction for definite a condition for determining the branch by the prefetched instruction. Whether or not it is a condition generation instruction, arithmetic processing is executed according to the condition generation instruction, and the finalized condition information is generated using the result, and the determination regarding the condition generation instruction is calculated. Execute along with processing.

【0035】また、請求項13にかかる命令プリフェッ
チ装置は、請求項12の装置において、上記条件生成命
令は、当該命令が、条件生成命令であることを示す情報
を含むものであり、演算処理にともなう当該命令の解析
を実行する。
The instruction prefetch device according to a thirteenth aspect is the device according to the twelfth aspect, wherein the condition generation instruction includes information indicating that the instruction is a condition generation instruction, Along with this, analysis of the relevant instruction is executed.

【0036】また、請求項14にかかる命令プリフェッ
チ方法は、命令を実行する計算機において、上記命令を
記憶する記憶装置から先読みする命令プリフェッチ方法
であって、上記先読みされた命令が、分岐を指令する分
岐命令であるか否かを判断し、分岐命令である場合に
は、分岐信号を出力する分岐判定ステップと、上記分岐
信号が出力された場合に、上記分岐命令における分岐を
決定する条件が確定しているか否かを判定し、確定して
いる場合には、当該条件に対応した確定条件情報を、後
述するプリフェッチアドレス生成ステップにおいて用い
られるように出力する確定条件情報生成ステップと、上
記確定条件情報生成ステップにおいて、確定条件情報が
出力されたときは、当該確定条件情報に基づいて、プリ
フェッチすべきアドレスを生成するプリフェッチアドレ
ス生成ステップとを含むものであり、分岐命令に続く命
令のプリフェッチにあたり、条件が確定している場合に
は、当該確定した条件に対応した命令のアドレスを生成
する。
An instruction prefetch method according to a fourteenth aspect is an instruction prefetch method for prefetching from a storage device that stores the instruction in a computer that executes the instruction, and the prefetched instruction commands a branch. A branch determination step of determining whether or not a branch instruction and outputting a branch signal if the instruction is a branch instruction, and a condition for determining a branch in the branch instruction when the branch signal is output If it has been decided, the definite condition information corresponding to the condition is output so as to be used in a prefetch address generation step which will be described later. In the information generation step, when the definite condition information is output, the ad to be prefetched based on the definite condition information. Is intended to include a prefetch address generating step of generating a scan, when prefetching the instruction following the branch, if the condition is identified, it generates the address of the instruction corresponding to the determined conditions.

【0037】また、請求項15にかかる命令プリフェッ
チ方法は、請求項14の方法において、上記確定条件情
報生成ステップは、上記分岐命令における分岐を決定す
る条件が確定しているか否かを判定し、確定している場
合には条件確定信号を出力する条件確定信号生成ステッ
プと、上記条件確定信号が出力されたときは、当該確定
した条件を取得して、上記取得した条件に基づいて上記
確定条件情報を生成する条件確定判定ステップとを含む
ものであり、条件が確定したか否かを、条件確定信号に
おいて伝達する。
According to a fifteenth aspect of the present invention, in the instruction prefetch method according to the fourteenth aspect, the definite condition information generating step determines whether or not a condition for determining a branch in the branch instruction is definite. A condition-determining signal generation step of outputting a condition-determining signal when the condition-determining signal is output, and when the condition-determining signal is output, the condition-determining signal is acquired, and the condition-determining condition is acquired based on the acquired condition. And a condition confirmation determination step of generating information, and whether or not the condition is confirmed is transmitted in the condition confirmation signal.

【0038】また、請求項16にかかる命令プリフェッ
チ方法は、請求項14の方法において、上記確定条件情
報生成ステップでは、上記先読みした命令が上記分岐を
決定する条件を確定する条件生成命令であるか否かを判
定し、条件生成命令である場合は、当該条件生成命令に
従って演算処理を実行し、その結果を用いて、上記確定
条件情報を生成するものであり、条件生成命令について
の判定を演算処理に伴って実行する。
According to a sixteenth aspect of the present invention, in the instruction prefetch method according to the fourteenth aspect, in the definite condition information generating step, is the prefetched instruction a condition generating instruction that determines a condition for determining the branch. Whether or not it is a condition generation instruction, arithmetic processing is executed according to the condition generation instruction, and the finalized condition information is generated using the result, and the determination regarding the condition generation instruction is calculated. Execute along with processing.

【0039】また、請求項17にかかる命令プリフェッ
チ方法は、請求項16の方法において、上記条件生成命
令は、当該命令が、条件生成命令であることを示す情報
を含むものであり、演算処理にともなう当該命令の解析
を実行する。
An instruction prefetch method according to a seventeenth aspect is the method according to the sixteenth aspect, wherein the condition generation instruction includes information indicating that the instruction is a condition generation instruction, Along with this, analysis of the relevant instruction is executed.

【0040】[0040]

【発明の実施の形態】実施の形態1.本発明の実施の形
態1による命令プリフェッチ装置は、分岐条件が確定し
たか否かを示す条件確定信号を用いて、条件が確定して
いる場合は、当該条件に対応した命令をプリフェッチす
るものである。図1は本実施の形態1による命令プリフ
ェッチ装置の構成を示すブロック図である。図示するよ
うに、本実施の形態1による命令プリフェッチ装置は、
プリフェッチアドレス生成部100、第1デコード部1
01、条件生成命令アドレス保持部102、条件確定判
定部103、命令バッファ104、第2デコード部10
5、条件コード保持部106、演算実行部107、プロ
グラムカウンタ108、および比較器109を備えた構
成となっている。
BEST MODE FOR CARRYING OUT THE INVENTION 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 instruction prefetch device according to the first embodiment is
Prefetch address generation unit 100, first decoding unit 1
01, condition generation instruction address holding unit 102, condition determination determination unit 103, instruction buffer 104, second decoding unit 10
5, a condition code holding unit 106, a calculation executing unit 107, a program counter 108, and a comparator 109.

【0041】プリフェッチアドレス生成部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 judgment unit 103 to generate an address to be prefetched next, and outputs the prefetch address signal S110 which is the device output 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.

【0042】また、第1デコード部101は、命令が分
岐命令であるか否かを判断し、分岐命令である場合に
は、分岐信号を出力する分岐判定手段として機能するも
のであり、命令S112が分岐命令である場合には、当
該条件分岐命令における分岐先アドレスを示す信号S1
11と、当該分岐命令における分岐条件を示す信号S1
15とを出力する。信号S111、およびS115は、
命令が分岐命令であることを示す分岐信号としても扱わ
れる。さらに、第1デコード部101は、命令が条件コ
ード(例えばゼロフラグ)を変更する命令、すなわち条
件生成命令であるか否かを判断するものであり、条件生
成命令であると判断した場合は、当該条件生成命令S1
12の命令アドレスS113を後述する条件生成命令ア
ドレス保持部102に出力するとともに、条件確定判定
手段103に対して未確定信号S115を出力する。
Further, the first decoding unit 101 functions as a branch judging means for judging whether 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.

【0043】条件確定判定部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.

【0044】命令バッファ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.

【0045】条件生成命令アドレス保持部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.

【0046】さらに、本実施の形態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.

【0047】このように構成された本実施の形態1によ
る命令プリフェッチ装置における、動作の概要を以下に
説明する。あるタイミングにおいて、プリフェッチアド
レス生成部100において、次にフェッチすべき命令の
アドレスが生成され、プリフェッチアドレス信号S11
0として出力される。当該命令プリフェッチ装置を用い
るプロセッサにおいては、このプリフェッチアドレス信
号S110を用いて、命令をフェッチし、この命令S1
12を当該命令プリフェッチ装置に入力する。次のタイ
ミングでは、プリフェッチされた命令S112が、第1
デコード部101に入力され、デコード処理される。
An 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.

【0048】第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, signal S116 indicating the content of instruction S112 is output to instruction buffer 104. .

【0049】命令バッファ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 and held in the condition code holding unit 106. .

【0050】一方、条件確定信号生成手段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 generation command address holding unit 102 is instructed by the command 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.

【0051】条件確定判定部103は、条件確定信号生
成手段120から、条件確定信号S118を入力された
か否かと、第1デコード部から、未確定信号、または分
岐条件を示す信号として信号S115を入力されたか否
かとによって動作が異なる。まず、未確定信号S115
を入力された場合には、条件確定判定部103における
リセット処理が実行され、直前に処理された条件生成命
令に基づく条件確定信号S118を用いることによって
セットされた状態がリセットされる。
The condition confirmation determination unit 103 receives the condition confirmation signal S118 from the condition confirmation signal generating means 120 and the first decoding unit receives the signal S115 as an unconfirmed signal or a signal indicating a branch condition. 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.

【0052】条件確定判定部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.

【0053】プリフェッチアドレス生成部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.

【0054】セレクタ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.

【0055】アドレスカウンタ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.

【0056】以上の動作により、プリフェッチアドレス
生成部100では、アドレスカウンタ152に保持され
た、先にプリフェッチされた命令のアドレスに対して、
加算器153において、信号S111が伝えるアドレス
差分(相対値)が加算され、得られた分岐先アドレスが
プリフェッチアドレス信号S110となるか、あるい
は、固定長「4」が加算され、4バイト先の次の命令の
アドレスがプリフェッチアドレス信号S110となるか
の、いずれかが行われることとなる。
By the above operation, in the prefetch address generation unit 100, with respect to the address of the previously prefetched instruction held in the address counter 152,
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.

【0057】次に従来技術による装置の場合と同様に、
図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.

【0058】命令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.

【0059】また、命令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.

【0060】条件生成命令である命令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.

【0061】タイミング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.

【0062】タイミングチャート図である図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, in FIG. 9, at the timing t7, the address of the instruction 403 which is the instruction to be fetched correctly is shown. 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.

【0063】図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. 3A shows the case of the conventional technique, and the instruction A
Is a condition generation instruction, it means that the prefetch of the next instruction cannot be performed based on the confirmed condition, only after the execution of the instruction A at the timing CLn + 2. On the other hand, in the case of the first embodiment shown in FIG. 9B, 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.

【0064】このように、本発明の実施の形態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.

【0065】実施の形態2.本発明の実施の形態2によ
る命令プリフェッチ装置は、分岐条件が確定したか否か
を命令実行処理において判定し、条件が確定している場
合は、当該条件に対応した命令をプリフェッチするもの
である。
Embodiment 2. The instruction prefetch device according to the second embodiment of the present invention determines whether or not a branch condition is fixed in an instruction execution process, and if the condition is fixed, prefetches an instruction corresponding to the condition. .

【0066】図5は本実施の形態2による命令プリフェ
ッチ装置の構成を示すブロック図である。図示するよう
に、本実施の形態2による命令プリフェッチ装置は、プ
リフェッチアドレス生成部200、第1デコード部20
1、条件確定判定部202、命令バッファ203、第2
デコード部204、条件コード保持部206、および演
算実行部205を備えた構成となっている。図1との比
較において、本実施の形態2における命令プリフェッチ
装置では、実施の形態1の装置が備えていた、条件確定
信号生成手段120を備えない構成となっている。
FIG. 5 is a block diagram showing the structure 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 200 and a first decoding unit 20.
1, condition determination determination unit 202, instruction buffer 203, second
It is configured to include a decoding unit 204, a condition code holding unit 206, and a calculation executing 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.

【0067】第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.

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

【0069】このため、本実施の形態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.

【0070】プリフェッチアドレス生成部200、命令
バッファ203、第2デコード部204、および条件コ
ード保持部206は、実施の形態1の装置における10
0、104、105、および106と同様であるので、
説明を省略する。
The prefetch address generation 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.

【0071】このように構成された本実施の形態2によ
る命令プリフェッチ装置における、動作の概要を以下に
説明する。あるタイミングにおいて、プリフェッチアド
レス生成部200において、次にフェッチすべき命令の
アドレスが生成され、プリフェッチアドレス信号S20
7として出力される。当該命令プリフェッチ装置を用い
るプロセッサにおいては、このプリフェッチアドレス信
号S207を用いて、命令をフェッチし、この命令S2
09を当該命令プリフェッチ装置に入力する。次のタイ
ミングでは、プリフェッチされた命令S209が、第1
デコード部201に入力され、デコード処理される。
The 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.

【0072】第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.

【0073】命令バッファ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. .

【0074】本実施の形態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.

【0075】条件確定判定部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 decision determining unit 202, and the condition decision 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.

【0076】次に従来技術による装置、および実施の形
態1による装置の場合と同様に、図8に示すプログラム
について実行する場合の動作を説明するが、本実施の形
態2による装置においても、タイミングと動作との関係
は実施の形態1と同様のものとなるので、実施の形態1
におけるタイミングチャート図を用いることとし、以下
に図3のタイミングチャートに従って説明する。
Next, as in the case of the device according to the prior art and the device according to the first embodiment, the operation for executing the program shown in FIG. 8 will be described. However, the timing according to the device according to the second embodiment will also be described. 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.

【0077】図3のチャートに示すタイミングt1で
は、プリフェッチアドレス生成部200において命令4
00のアドレスが生成され、プリフェッチアドレス信号
S207として出力される。当該命令プリフェッチ装置
を用いるプロセッサにおいては、このプリフェッチアド
レス信号S207を用いて、命令400をフェッチし、
当該命令プリフェッチ装置に入力する。次のタイミング
t2で、プリフェッチされた命令400が、第1デコー
ド部201に入力され、デコード処理される。
At timing t1 shown in the chart of FIG. 3, the instruction 4 in the prefetch address generation unit 200
00 address is generated and output as a prefetch address signal S207. In the processor using the instruction prefetch device, the instruction 400 is fetched by using the prefetch address signal S207,
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.

【0078】命令400は条件分岐命令ではないので、
分岐アドレスを示す信号S208と、分岐条件を示す信
号S211とは出力されない。また、命令400の内容
を示す信号は命令バッファ203に出力される。第2デ
コード部204は命令バッファ203から命令400を
取り出してデコード処理することにより、命令400が
加算命令である旨を解釈し、信号出力によってデコード
処理の結果を演算実行部205に伝える。命令400
は、条件生成命令であり、かつ、その実行結果は直後の
条件分岐命令401に影響を与えるものである。この旨
は当該命令400に対して、コンパイル時付与された情
報から取得されるものであり、ここで、第2デコード部
204によって解釈された上で、演算実行部205に伝
えられる。
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. Further, 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. Instruction 400
Is a condition generation instruction, and its execution result affects the conditional branch instruction 401 immediately after. 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.

【0079】演算実行部205は、命令400が意味す
る加算処理を実行し、加算処理の結果は条件コードに影
響を与え得るものであることから、当該加算処理の結果
を条件コード保持部206に出力し、条件コード保持部
206は変更された条件コードを保持する。図3のタイ
ミングt3において、条件フラグが確定する。そして、
本実施の形態2における演算実行部205は、第2デコ
ード部204から伝達された命令400についての情報
に基づいて、条件確定信号S212を条件確定判定部2
02に出力する。条件確定信号S212を入力された条
件確定判定部202では、条件コード保持部206から
条件コードS213を取得する。
The operation 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.

【0080】タイミング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 by 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.

【0081】このように、本実施の形態2の命令プリフ
ェッチ装置によれば、後続の条件分岐命令に影響を与え
る条件生成命令については、その旨を当該命令自体が情
報として有するものとし、当該命令実行時に、演算実行
部205が条件確定信号を生成するものとしたことで、
実施の形態1と同様に、条件分岐命令がプリフェッチさ
れた時に既に条件が確定していれば、分岐予測をするこ
となく正しいプリフェッチアドレスが生成され、予測ミ
スによる、分岐命令実行時における遅延時間がなくな
り、効率的な処理を実行することが可能となる。
As described above, according to the instruction prefetch device of the second embodiment, regarding the condition generation instruction that 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.

【0082】本実施の形態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. It is possible to confirm the condition confirmation and generate the condition confirmation signal together with the execution of the arithmetic processing described above, and it is possible to simplify the configuration of the device and the processing in the instruction prefetch device.

【0083】[0083]

【発明の効果】請求項1にかかる命令プリフェッチ方法
によれば、先読みされた第1の命令が、条件分岐命令で
あるか否かを判定する命令判定工程と、前記第1の命令
の直前の条件生成命令の実行が終了しているか否かを判
定する終了判定工程と、前記第1の命令が条件分岐命令
と判定された場合において、前記終了判定工程にて終了
が判定された場合には、確定した条件よりプリフェッチ
アドレスを出力するプリフェッチアドレス生成工程とを
含むようにしたので、条件生成命令に対する判定処理を
実行し、確定した条件に対応した命令のアドレスを生成
するため、条件が確定していたならば当該条件を利用で
き、分岐予測ミスによる遅延を低減して、装置資源を活
用した処理の効率化が可能となる。
According to the instruction prefetch method of the first aspect, an instruction determining step of determining whether or not the prefetched first instruction is a conditional branch instruction, and a step immediately before the first instruction are executed. An end determination step of determining whether or not the execution of the condition generation instruction has ended, and a case where the end determination step determines that the first instruction is a conditional branch instruction. Since the prefetch address generation step of outputting the prefetch address from the fixed condition is included, the determination process for the condition generation instruction is executed and the address of the instruction corresponding to the fixed condition is generated, so the condition is fixed. If so, the condition can be used, the delay due to a branch misprediction can be reduced, and the efficiency of processing utilizing the device resources can be improved.

【0084】請求項2にかかる命令プリフェッチ方法に
よれば、請求項1に記載の命令プリフェッチ方法におい
て、前記終了判定工程は、前記第1の命令の直前の条件
生成命令のアドレスを記憶する工程と、記憶したアドレ
スと、実行されている命令のアドレスとを比較する比較
工程とを含むものであり、条件が確定したか否かの判定
を、条件を確定する命令のアドレスを実行中の命令のア
ドレスと比較することで実行し、条件が確定したか否か
を判定するようにしたので、分岐予測ミスによる遅延を
低減して、装置資源を活用した処理の効率化が可能とな
る。
According to the instruction prefetch method of the second aspect, in the instruction prefetch method of the first aspect, the end determination step includes a step of storing an address of a condition generation instruction immediately before the first instruction. , A comparison step of comparing the stored address with the address of the instruction being executed, and determining whether or not the condition is fixed is performed by determining whether the address of the instruction for fixing the condition is Since it is executed by comparing with the address and whether or not the condition is fixed is determined, the delay due to a branch misprediction can be reduced and the efficiency of the processing utilizing the device resources can be improved.

【0085】請求項3にかかる命令プリフェッチ装置に
よれば、先読みされた第1の命令が、条件分岐命令であ
るか否かを判定する命令判定手段と、前記第1の命令の
直前の条件生成命令の実行が終了しているか否かを判定
する終了判定手段と、前記第1の命令が条件分岐命令と
判定された場合において、前記終了判定工程にて終了が
判定された場合には、確定した条件よりプリフェッチア
ドレスを出力するプリフェッチアドレス生成手段とを備
えたものであり、条件生成命令に対する判定処理を実行
し、確定した条件に対応した命令のアドレスを生成する
ので、条件生成命令に対する判定処理を実行し、確定し
た条件に対応した命令のアドレスを生成するため、条件
が確定していたならば当該条件を利用でき、分岐予測ミ
スによる遅延を低減して、装置資源を活用した処理の効
率化が可能となる。
According to the instruction prefetch device of the third aspect, the instruction determining means for determining whether or not the prefetched first instruction is the conditional branch instruction, and the condition generation immediately before the first instruction. Termination determining means for determining whether or not the execution of the instruction is terminated, and if the termination is determined in the termination determining step in the case where the first instruction is determined as the conditional branch instruction, the determination is made. And a prefetch address generating means for outputting a prefetch address according to the specified condition. Since the determination process for the condition generation instruction is executed and the address of the instruction corresponding to the confirmed condition is generated, the determination process for the condition generation instruction is performed. Is executed and the address of the instruction corresponding to the confirmed condition is generated, the condition can be used if the condition has been confirmed, and the delay due to a branch misprediction can be reduced. To, thereby enabling efficient processing utilizing device resources.

【0086】請求項4にかかる命令プリフェッチ装置に
よれば、請求項3に記載の命令プリフェッチ装置におい
て、前記終了判定手段は、前記第1の命令の直前の条件
生成命令のアドレスを記憶する手段と、記憶したアドレ
スと、実行されている命令のアドレスとを比較する比較
手段とを含むものであり、条件が確定したか否かの判定
を、条件を確定する命令のアドレスを実行中の命令のア
ドレスと比較することで実行し、条件が確定したか否か
を判定するので、分岐予測ミスによる遅延を低減して、
装置資源を活用した処理の効率化が可能となる。
According to the instruction prefetch device of the fourth aspect, in the instruction prefetch device of the third aspect, the end judging means is means for storing the address of the condition generating instruction immediately before the first instruction. , A comparison unit that compares the stored address with the address of the instruction being executed, and determines whether or not the condition is fixed, by determining whether or not the address of the instruction that determines the condition is being executed. It is executed by comparing with the address, and it is determined whether the condition is fixed or not.
It is possible to improve the efficiency of processing by utilizing the device resources.

【0087】請求項5にかかる命令プリフェッチ装置に
よれば、先読みされた命令が、条件生成命令または条件
分岐命令であるか否かを判定する命令判定手段と、先読
みされた命令のアドレスを保持する命令アドレス保持手
段と、実行されている命令のアドレスと、前記命令アド
レス保持手段のアドレスとを比較する比較手段と、前記
命令判定手段にて条件生成命令と判定されれば、自己の
状態をリセットし、前記比較手段で一致を検出されれば
自己のセットを行う条件確定判定手段と、前記命令判定
手段において条件分岐命令と判定された場合において、
前記条件確定判定手段がセットされている場合には、確
定した条件よりプリフェッチアドレスを出力し、セット
されていない場合には、所定の分岐予測方法によりアド
レスを出力するプリフェッチアドレス生成手段とを備え
たものであり、条件生成命令に対する判定処理を実行
し、そのアドレスを保持することで、アドレス比較によ
る条件確定についての判断を実行し、条件分岐命令の条
件が確定した場合は当該確定した条件に対応した命令の
アドレスを生成し、確定しない場合は所定の分岐予測方
法によりアドレスを出力するようにしたので、条件が確
定したか否かの判定を実行し、条件が確定していたなら
ば、当該条件を利用し、分岐予測ミスによる遅延を低減
して、装置資源を活用した処理の効率化が可能となる。
According to the instruction prefetch device of the fifth aspect, the instruction determining means for determining whether the prefetched instruction is the condition generation instruction or the conditional branch instruction, and the address of the prefetched instruction are held. If the instruction address holding means, the comparing means for comparing the address of the executed instruction with the address of the instruction address holding means, and the instruction determining means determines that the instruction is a condition generation instruction, the own state is reset. However, in the case where the comparison means detects a match, it sets itself, and the case where the instruction judgment means judges that it is a conditional branch instruction,
And a prefetch address generating means for outputting a prefetch address according to the confirmed condition when the condition confirmation determining means is set, and for outputting an address according to a predetermined branch prediction method when the condition confirmation determining means is not set. By executing the judgment processing for the condition generation instruction and holding the address, the judgment of the condition confirmation by the address comparison is executed, and when the condition of the conditional branch instruction is confirmed, it corresponds to the confirmed condition. Since the address of the executed instruction is generated and the address is output by a predetermined branch prediction method when it is not determined, it is determined whether or not the condition is determined. By utilizing the condition, the delay due to the branch misprediction can be reduced, and the processing efficiency can be improved by utilizing the device resources.

【0088】請求項6にかかる命令プリフェッチ装置に
よれば、命令を実行する計算機において、上記命令を記
憶する記憶装置から先読みする命令プリフェッチ装置で
あって、前記先読みされた命令が、分岐を指令する分岐
命令であるか否かを判断し、分岐命令である場合には、
分岐信号を出力する分岐判定手段と、前記先読みした命
令が前記分岐を決定する条件を確定する条件生成命令で
あるか否かを判定し、条件生成命令である場合は、当該
条件生成命令に従って演算処理を実行し、その結果を用
いて、確定条件情報を生成する確定条件情報生成手段
と、所定の分岐予測方法に従って、分岐先の命令を指定
する情報を生成する分岐予測手段と、前記分岐信号が出
力された場合に、前記確定条件情報生成手段より、確定
条件情報を入力されたときは、当該確定条件情報に基づ
いて、プリフェッチすべきアドレスを生成し、前記確定
条件情報を入力されないときは、前記分岐予測手段が生
成した情報に基づいてプリフェッチすべきアドレスを生
成するプリフェッチアドレス生成手段とを備えたもので
あり、上記確定条件情報生成手段は、条件生成命令につ
いての判定を演算処理に伴って実行し、条件が確定して
いる場合には当該条件を利用することで、分岐予測ミス
による遅延を低減して、装置資源を活用した処理の効率
化が可能となる。
According to the sixth aspect of the instruction prefetch device, in the computer that executes the instruction, the instruction prefetch device prefetches from the storage device that stores the instruction, and the prefetched instruction commands a branch. If it is a branch instruction, it is judged whether it is a branch instruction.
Branch determination means for outputting a branch signal, and whether or not the prefetched instruction is a condition generation instruction that determines the condition for determining the branch. If it is a condition generation instruction, an operation is performed according to the condition generation instruction. Deterministic condition information generating means for executing a process and using the result, deterministic condition information generating means, branch predicting means for generating information designating a branch destination instruction according to a predetermined branch predicting method, and the branch signal When the definite condition information is input from the definite condition information generating means, the address to be prefetched is generated based on the definite condition information, and when the definite condition information is not input. A prefetch address generating means for generating an address to be prefetched based on the information generated by the branch predicting means, The report generation means executes the determination of the condition generation instruction in accordance with the arithmetic processing, and when the condition is fixed, the condition is used to reduce the delay due to the branch prediction error and save the device resources. It is possible to improve the efficiency of the utilized processing.

【0089】請求項7にかかる命令プリフェッチ装置に
よれば、命令を実行する計算機において、上記命令を記
憶する記憶装置から先読みする命令プリフェッチ装置で
あって、上記先読みされた命令が、分岐を指令する分岐
命令であるか否かを判断し、分岐命令である場合には、
分岐信号を出力する分岐判定手段と、上記分岐信号が出
力された場合に、上記分岐命令における分岐を決定する
条件が確定しているか否かを判定し、確定している場合
には、当該条件に対応した確定条件情報を、後述するプ
リフェッチアドレス生成手段に対して出力する確定条件
情報生成手段と、上記確定条件情報生成手段より、確定
条件情報を入力されたときは、当該確定条件情報に基づ
いて、プリフェッチすべきアドレスを生成するプリフェ
ッチアドレス生成手段とを備えたものであり、分岐命令
に続く命令のプリフェッチにあたり、条件が確定してい
る場合には、当該確定した条件に対応した命令のアドレ
スを生成するので、分岐予測ミスによる遅延を低減し
て、装置資源を活用した処理の効率化が可能となる。
According to the seventh aspect of the instruction prefetch device, in the computer that executes the instruction, the instruction prefetch device prefetches from the storage device that stores the instruction, and the prefetched instruction commands a branch. If it is a branch instruction, it is judged whether 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 a condition for determining a branch in the branch instruction is fixed. If the condition is fixed, the condition is determined. When the definite condition information is input from the definite condition information generation means for outputting definite condition information corresponding to the above to the prefetch address generation means described later and the definite condition information generation means, based on the definite condition information. And a prefetch address generating means for generating an address to be prefetched, and in the case of prefetching an instruction following a branch instruction, if the condition is fixed, the address of the instruction corresponding to the fixed condition. Is generated, it is possible to reduce the delay due to a branch misprediction and improve the efficiency of the processing using the device resources.

【0090】請求項8にかかる命令プリフェッチ装置に
よれば、請求項7の装置において、上記確定条件情報生
成手段は、上記分岐命令における分岐を決定する条件が
確定しているか否かを判定し、確定している場合には条
件確定信号を出力する条件確定信号生成手段と、上記条
件確定信号が出力されたときは、当該確定した条件を取
得して、上記取得した条件に基づいて上記確定条件情報
を生成する条件確定判定手段とを備えたものであり、条
件が確定したか否かを、条件確定信号において伝達する
ことで、当該確定した条件に対応したプリフェッチアド
レスを生成して、分岐予測ミスによる遅延を低減して、
装置資源を活用した処理の効率化が可能となる。
According to the instruction prefetch device of the eighth aspect, in the apparatus of the seventh aspect, the definite condition information generating means determines whether or not the condition for determining the branch in the branch instruction is definite. A condition-determining signal generating means that outputs a condition-determining signal when the condition-determining signal is output, and, when the condition-determining signal is output, acquires the condition-determining condition and determines the condition-determining condition based on the acquired condition. A condition determination determination means for generating information is provided, and by transmitting in a condition determination signal whether or not the condition is determined, a prefetch address corresponding to the determined condition is generated, and branch prediction is performed. Reduce delays due to mistakes,
It is possible to improve the efficiency of processing by utilizing the device resources.

【0091】請求項9にかかる命令プリフェッチ装置に
よれば、請求項8の装置において、上記条件確定信号生
成手段は、上記分岐判定手段から出力された命令のアド
レスを保持する第一の命令アドレス保持手段と、その時
点において実行されている命令のアドレスを保持する第
二の命令アドレス保持手段と、上記第一の命令アドレス
保持手段と、上記第二の命令アドレス保持手段とが保持
するアドレスの比較処理を行い、上記比較において一致
していると判定する場合に、上記条件確定信号を上記条
件判定確定手段に出力する比較手段とを備えたものであ
り、条件が確定したか否かの判定を、条件を確定する命
令のアドレスを実行中の命令のアドレスと比較すること
で実行することで、条件が確定したか否かの判定を実行
し、分岐予測ミスによる遅延を低減して、装置資源を活
用した処理の効率化が可能となる。
According to the ninth aspect of the instruction prefetch device, in the apparatus of the eighth aspect, the condition fixing signal generating means holds the first instruction address holding the address of the instruction output from the branch judging means. Means, second instruction address holding means for holding the address of the instruction being executed at that time, comparison of addresses held by the first instruction address holding means, and the second instruction address holding means When the processing is performed and it is determined that they match in the comparison, it is provided with a comparison unit that outputs the condition determination signal to the condition determination determination unit, and determines whether or not the condition is determined. By executing the instruction by comparing the address of the instruction that determines the condition with the address of the instruction that is being executed, it is determined whether the condition has been determined, and the branch prediction error According to reduce delay, it is possible to streamline the process utilizing device resources.

【0092】請求項10にかかる命令プリフェッチ装置
によれば、請求項9の装置において、上記分岐判定手段
は、上記先読みされた命令が条件生成命令であるか否か
を判定し、条件生成命令である場合は、当該条件生成命
令のアドレスを上記第1の命令アドレス保持手段に対し
て出力するとともに、上記条件確定判定手段に対して、
条件未確定信号を出力するものであり、上記出力する分
岐信号として、当該分岐命令における分岐条件を示す情
報を、上記条件確定判定手段に対して出力するととも
に、上記分岐命令における分岐先アドレスを示す情報
を、上記プリフェッチアドレス生成手段に対して出力す
るものであり、条件生成命令に対する判定処理を実行
し、そのアドレスを保持することで、アドレス比較によ
る条件確定についての判断を実行するので、条件が確定
していたならば、当該条件を利用し、分岐予測ミスによ
る遅延を低減して、装置資源を活用した処理の効率化が
可能となる。
According to the instruction prefetch device of the tenth aspect, in the device of the ninth aspect, the branch determination means determines whether or not the prefetched instruction is a condition generation instruction, In some cases, the address of the condition generation instruction is output to the first instruction address holding means, and the condition confirmation determination means
A condition undetermined signal is output, and as the branch signal to be output, information indicating a branch condition in the branch instruction is output to the condition determination determination means and a branch destination address in the branch instruction is output. The information is output to the prefetch address generation means, the determination process for the condition generation instruction is executed, and by holding the address, the determination of the condition determination by the address comparison is executed. If confirmed, the conditions can be used to reduce the delay due to branch misprediction, and the efficiency of processing that utilizes device resources can be improved.

【0093】請求項11にかかる命令プリフェッチ装置
によれば、請求項10の装置において、上記条件確定判
定手段は、上記条件確定信号を入力されたとき、当該分
岐命令の次のアドレス、又は上記分岐先アドレスを用い
るべき旨を示す条件確定情報を上記プリフェッチアドレ
ス生成手段に対して出力するものであり、確定した条件
に対応した命令のアドレスを生成するので、分岐予測ミ
スによる遅延を低減して、装置資源を活用した処理の効
率化が可能となる。
According to the eleventh aspect of the instruction prefetch device, in the apparatus of the tenth aspect, when the condition decision signal is input, the condition decision determining means receives the next address of the branch instruction or the branch instruction. Condition determination information indicating that the destination address should be used is output to the prefetch address generation means, and the address of the instruction corresponding to the determined condition is generated, so that the delay due to a branch prediction error is reduced, It is possible to improve the efficiency of processing by utilizing the device resources.

【0094】請求項12にかかる命令プリフェッチ装置
によれば、請求項7の装置において、上記確定条件情報
生成手段は、上記先読みした命令が上記分岐を決定する
条件を確定する条件生成命令であるか否かを判定し、条
件生成命令である場合は、当該条件生成命令に従って演
算処理を実行し、その結果を用いて、上記確定条件情報
を生成するものであり、条件生成命令についての判定を
演算処理に伴って実行するので、条件が確定している場
合には、当該条件を利用することで、分岐予測ミスによ
る遅延を低減して、装置資源を活用した処理の効率化が
可能となる。
According to the instruction prefetch apparatus of the twelfth aspect, in the apparatus of the seventh aspect, whether the definite condition information generating means is a condition generation instruction that determines the condition for determining the branch by the prefetched instruction. If it is a condition generation instruction, the arithmetic processing is executed according to the condition generation instruction, and the finalized condition information is generated by using the result, and the determination for the condition generation instruction is calculated. Since the processing is executed along with the processing, when the condition is fixed, the delay due to the branch prediction error can be reduced by using the condition, and the efficiency of the processing using the device resource can be improved.

【0095】請求項13にかかる命令プリフェッチ装置
によれば、請求項12の装置において、上記条件生成命
令は、当該命令が、条件生成命令であることを示す情報
を含むものであり、演算処理にともなう当該命令の解析
を実行することで、上記の効果が得られる。
According to the instruction prefetch device of the thirteenth aspect, in the apparatus of the twelfth aspect, the condition generating instruction includes information indicating that the instruction is the condition generating instruction, and the arithmetic processing is performed. The above effect can be obtained by executing the analysis of the relevant instruction.

【0096】請求項14にかかる命令プリフェッチ方法
によれば、命令を実行する計算機において、上記命令を
記憶する記憶装置から先読みする命令プリフェッチ方法
であって、上記先読みされた命令が、分岐を指令する分
岐命令であるか否かを判断し、分岐命令である場合に
は、分岐信号を出力する分岐判定ステップと、上記分岐
信号が出力された場合に、上記分岐命令における分岐を
決定する条件が確定しているか否かを判定し、確定して
いる場合には、当該条件に対応した確定条件情報を、後
述するプリフェッチアドレス生成ステップにおいて用い
られるように出力する確定条件情報生成ステップと、上
記確定条件情報生成ステップにおいて、確定条件情報が
出力されたときは、当該確定条件情報に基づいて、プリ
フェッチすべきアドレスを生成するプリフェッチアドレ
ス生成ステップとを含むものであり、分岐命令に続く命
令のプリフェッチにあたり、条件が確定している場合に
は、当該確定した条件に対応した命令のアドレスを生成
するので、分岐予測ミスによる遅延を低減して、装置資
源を活用した処理の効率化が可能となる。
According to the instruction prefetch method of the fourteenth aspect, in the computer that executes the instruction, the instruction prefetch method prefetches from the storage device that stores the instruction, and the prefetched instruction commands a branch. A branch determination step of determining whether or not a branch instruction and outputting a branch signal if the instruction is a branch instruction, and a condition for determining a branch in the branch instruction when the branch signal is output If it has been decided, the definite condition information corresponding to the condition is output so as to be used in a prefetch address generation step which will be described later. In the information generation step, when the definite condition information is output, the ad to be prefetched based on the definite condition information. And a prefetch address generation step for generating a branch instruction. When prefetching an instruction following a branch instruction, if the condition is fixed, the address of the instruction corresponding to the fixed condition is generated, so the branch It is possible to reduce the delay due to misprediction and improve the efficiency of the processing that utilizes the device resources.

【0097】請求項15にかかる命令プリフェッチ方法
によれば、請求項14の方法において、上記確定条件情
報生成ステップは、上記分岐命令における分岐を決定す
る条件が確定しているか否かを判定し、確定している場
合には条件確定信号を出力する条件確定信号生成ステッ
プと、上記条件確定信号が出力されたときは、当該確定
した条件を取得して、上記取得した条件に基づいて上記
確定条件情報を生成する条件確定判定ステップとを含む
ものであり、条件が確定したか否かを、条件確定信号に
おいて伝達することで、上記の効果が得られる。
According to the instruction prefetch method of the fifteenth aspect, in the method of the fourteenth aspect, the definite condition information generating step determines whether or not the condition for determining the branch in the branch instruction is definite, A condition-determining signal generating step of outputting a condition-determining signal when the condition-determining signal is output, and when the condition-determining signal is output, the condition-determining signal is acquired, and the condition-determining condition is acquired based on the acquired condition. The above-mentioned effect is obtained by including a condition confirmation determination step of generating information, and transmitting whether or not the condition is confirmed by the condition confirmation signal.

【0098】請求項16にかかる命令プリフェッチ方法
によれば、請求項14の方法において、上記確定条件情
報生成ステップでは、上記先読みした命令が上記分岐を
決定する条件を確定する条件生成命令であるか否かを判
定し、条件生成命令である場合は、当該条件生成命令に
従って演算処理を実行し、その結果を用いて、上記確定
条件情報を生成するものであり、条件生成命令について
の判定を演算処理に伴って実行することで、上記の効果
が得られる。
According to the instruction prefetch method of the sixteenth aspect, in the method of the fourteenth aspect, in the definite condition information generating step, is the prefetched instruction a condition generating instruction that determines a condition for determining the branch. Whether or not it is a condition generation instruction, arithmetic processing is executed according to the condition generation instruction, and the finalized condition information is generated using the result, and the determination regarding the condition generation instruction is calculated. The above effect can be obtained by executing the processing along with the processing.

【0099】請求項17にかかる命令プリフェッチ方法
によれば、請求項16の方法において、上記条件生成命
令は、当該命令が、条件生成命令であることを示す情報
を含むものであり、演算処理に伴い当該命令の解析を実
行することで、上記の効果が得られる。
According to the instruction prefetch method of the seventeenth aspect, in the method of the sixteenth aspect, the condition generating instruction includes information indicating that the instruction is the condition generating instruction, and the arithmetic processing is performed. Accordingly, the above effect can be obtained by executing the analysis of the instruction.

【図面の簡単な説明】[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

Claims (17)

【特許請求の範囲】[Claims] 【請求項1】 先読みされた第1の命令が、条件分岐命
令であるか否かを判定する命令判定工程と、 前記第1の命令の直前の条件生成命令の実行が終了して
いるか否かを判定する終了判定工程と、 前記第1の命令が条件分岐命令と判定された場合におい
て、前記終了判定工程にて終了が判定された場合には、
確定した条件よりプリフェッチアドレスを出力するプリ
フェッチアドレス生成工程とを含む、 ことを特徴とする命令プリフェッチ方法。
1. An instruction determination step of determining whether or not a prefetched first instruction is a conditional branch instruction, and whether or not execution of a condition generation instruction immediately before the first instruction has been completed. An end determination step of determining, and when the first instruction is determined to be a conditional branch instruction, when the end is determined in the end determination step,
And a prefetch address generating step of outputting a prefetch address based on a determined condition.
【請求項2】 請求項1に記載の命令プリフェッチ方法
において、 前記終了判定工程は、 前記第1の命令の直前の条件生成命令のアドレスを記憶
する工程と、記憶したアドレスと、実行されている命令
のアドレスとを比較する比較工程とを含む、 ことを特徴とする命令プリフェッチ方法。
2. The instruction prefetch method according to claim 1, wherein the end determination step includes a step of storing an address of a condition generation instruction immediately before the first instruction, a stored address, and an execution. And a comparison step of comparing the address of the instruction.
【請求項3】 先読みされた第1の命令が、条件分岐命
令であるか否かを判定する命令判定手段と、 前記第1の命令の直前の条件生成命令の実行が終了して
いるか否かを判定する終了判定手段と、 前記第1の命令が条件分岐命令と判定された場合におい
て、前記終了判定工程にて終了が判定された場合には、
確定した条件よりプリフェッチアドレスを出力するプリ
フェッチアドレス生成手段とを備えた、 ことを特徴とする命令プリフェッチ装置。
3. An instruction determining means for determining whether or not the prefetched first instruction is a conditional branch instruction, and whether or not the execution of the condition generating instruction immediately before the first instruction is completed. Termination determining means for determining, and when the first instruction is determined to be a conditional branch instruction, when termination is determined in the termination determining step,
An instruction prefetch device, comprising: a prefetch address generation unit that outputs a prefetch address based on a determined condition.
【請求項4】 請求項3に記載の命令プリフェッチ装置
において、 前記終了判定手段は、 前記第1の命令の直前の条件生成命令のアドレスを記憶
する手段と、記憶したアドレスと、実行されている命令
のアドレスとを比較する比較手段とを含む、 ことを特徴とする命令プリフェッチ装置。
4. The instruction prefetch device according to claim 3, wherein the end determination unit stores the address of the condition generation instruction immediately before the first instruction, the stored address, and the execution. An instruction prefetch device comprising: a comparison unit that compares the address of an instruction.
【請求項5】 先読みされた命令が、条件生成命令また
は条件分岐命令であるか否かを判定する命令判定手段
と、 先読みされた命令のアドレスを保持する命令アドレス保
持手段と、 実行されている命令のアドレスと、前記命令アドレス保
持手段のアドレスとを比較する比較手段と、 前記命令判定手段にて条件生成命令と判定されれば、自
己の状態をリセットし、前記比較手段で一致を検出され
れば自己のセットを行う条件確定判定手段と、 前記命令判定手段において条件分岐命令と判定された場
合において、前記条件確定判定手段がセットされている
場合には、確定した条件よりプリフェッチアドレスを出
力し、セットされていない場合には、所定の分岐予測方
法によりアドレスを出力するプリフェッチアドレス生成
手段とを備えた、 ことを特徴とする命令プリフェッチ装置。
5. An instruction determination means for determining whether or not the prefetched instruction is a condition generation instruction or a conditional branch instruction, and an instruction address holding means for holding the address of the prefetched instruction. If the address of the instruction is compared with the address of the instruction address holding means, and if the instruction determining means determines that the instruction is a condition generation instruction, it resets its own state and the comparing means detects a match. If so, the condition decision determining means for performing its own setting, and when the instruction decision means determines that the condition branch instruction, if the condition decision determining means is set, the prefetch address is output from the decided condition. If it is not set, a prefetch address generating means for outputting an address by a predetermined branch prediction method is provided. Instruction prefetching device comprising.
【請求項6】 命令を実行する計算機において、上記命
令を記憶する記憶装置から先読みする命令プリフェッチ
装置であって、 前記先読みされた命令が、分岐を指令する分岐命令であ
るか否かを判断し、分岐命令である場合には、分岐信号
を出力する分岐判定手段と、 前記先読みした命令が前記分岐を決定する条件を確定す
る条件生成命令であるか否かを判定し、条件生成命令で
ある場合は、当該条件生成命令に従って演算処理を実行
し、その結果を用いて、確定条件情報を生成する確定条
件情報生成手段と、 所定の分岐予測方法に従って、分岐先の命令を指定する
情報を生成する分岐予測手段と、 前記分岐信号が出力された場合に、前記確定条件情報生
成手段より、確定条件情報を入力されたときは、当該確
定条件情報に基づいて、プリフェッチすべきアドレスを
生成し、前記確定条件情報を入力されないときは、前記
分岐予測手段が生成した情報に基づいてプリフェッチす
べきアドレスを生成するプリフェッチアドレス生成手段
とを備えた、 ことを特徴とする命令プリフェッチ装置。
6. A computer for executing instructions, which is an instruction prefetch device for prefetching from a storage device for storing the instructions, wherein it is determined whether or not the prefetched instructions are branch instructions for instructing branching. If it is a branch instruction, it is a condition generation instruction by determining whether or not the branch determination unit that outputs a branch signal and whether the prefetched instruction is a condition generation instruction that determines the condition that determines the branch. In this case, an arithmetic process is executed according to the condition generation instruction, and the result is used to generate definite condition information generation means for generating definite condition information and information for designating a branch destination instruction according to a predetermined branch prediction method. Branching predicting means for outputting the branching signal, and when the definite condition information is input from the definite condition information generating means when the branch signal is output, based on the definite condition information, An address to be pre-fetched is generated based on the information generated by the branch predicting means when the definite condition information is not input. Instruction prefetch device.
【請求項7】 命令を実行する計算機において、上記命
令を記憶する記憶装置から先読みする命令プリフェッチ
装置であって、 上記先読みされた命令が、分岐を指令する分岐命令であ
るか否かを判断し、分岐命令である場合には、分岐信号
を出力する分岐判定手段と、 上記分岐信号が出力された場合に、上記分岐命令におけ
る分岐を決定する条件が確定しているか否かを判定し、
確定している場合には、当該条件に対応した確定条件情
報を、後述するプリフェッチアドレス生成手段に対して
出力する確定条件情報生成手段と、 上記確定条件情報生成手段より、確定条件情報を入力さ
れたときは、当該確定条件情報に基づいて、プリフェッ
チすべきアドレスを生成するプリフェッチアドレス生成
手段とを備えたことを特徴とする命令プリフェッチ装
置。
7. A computer for executing instructions, which is an instruction prefetch device for prefetching from a storage device for storing the instructions, wherein the prefetched instructions determine whether or not 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.
When it has been decided, the definite condition information corresponding to the condition is input to the definite condition information generation means for outputting to the prefetch address generation means described later and the definite condition information generation means. In this case, the instruction prefetch device is provided with a prefetch address generating means for generating an address to be prefetched based on the definite condition information.
【請求項8】 請求項7に記載の命令プリフェッチ装置
において、 上記確定条件情報生成手段は、 上記分岐命令における分岐を決定する条件が確定してい
るか否かを判定し、確定している場合には条件確定信号
を出力する条件確定信号生成手段と、 上記条件確定信号が出力されたときは、当該確定した条
件を取得して、上記取得した条件に基づいて上記確定条
件情報を生成する条件確定判定手段とを備えたものであ
ることを特徴とする命令プリフェッチ装置。
8. The instruction prefetch device according to claim 7, wherein the definite condition information generation means determines whether or not a condition for determining a branch in the branch instruction is definite, and when the condition is definite, Is a condition-determining signal generating means for outputting a condition-determining signal, and when the condition-determining signal is output, the condition-determining signal is generated, and the condition-determining signal is generated based on the acquired condition. An instruction prefetch device comprising: a determining unit.
【請求項9】 請求項8に記載の命令プリフェッチ装置
において、 上記条件確定信号生成手段は、 上記分岐判定手段から出力された命令のアドレスを保持
する第一の命令アドレス保持手段と、 その時点において実行されている命令のアドレスを保持
する第二の命令アドレス保持手段と、 上記第一の命令アドレス保持手段と、上記第二の命令ア
ドレス保持手段とが保持するアドレスの比較処理を行
い、上記比較において一致していると判定する場合に、
上記条件確定信号を上記条件判定確定手段に出力する比
較手段とを備えたものであることを特徴とする命令プリ
フェッチ装置。
9. The instruction prefetch device according to claim 8, wherein the condition determination signal generating means includes a first instruction address holding means for holding an address of an instruction output from the branch determination means, and at that time point. The second instruction address holding means for holding the address of the instruction being executed, the first instruction address holding means, and the addresses held by the second instruction address holding means are compared, and the comparison is performed. When it is determined that they match in
An instruction prefetch device comprising: a comparison means for outputting the condition determination signal to the condition determination determination means.
【請求項10】 請求項9に記載の命令プリフェッチ装
置において、 上記分岐判定手段は、 上記先読みされた命令が条件生成命令であるか否かを判
定し、条件生成命令である場合は、当該条件生成命令の
アドレスを上記第1の命令アドレス保持手段に対して出
力するとともに、上記条件確定判定手段に対して、条件
未確定信号を出力するものであり、 上記出力する分岐信号として、当該分岐命令における分
岐条件を示す情報を、上記条件確定判定手段に対して出
力するとともに、上記分岐命令における分岐先アドレス
を示す情報を、上記プリフェッチアドレス生成手段に対
して出力するものであることを特徴とする命令プリフェ
ッチ装置。
10. The instruction prefetch device according to claim 9, wherein the branch determination unit determines whether the prefetched instruction is a condition generation instruction, and if it is a condition generation instruction, the condition is generated. The address of the generated instruction is output to the first instruction address holding means, and the condition undetermined signal is output to the condition determination determination means. The branch instruction to be output is the branch instruction. The information indicating the branch condition in (1) is output to the condition decision determining means, and the information indicating the branch destination address in the branch instruction is output to the prefetch address generating means. Instruction prefetch device.
【請求項11】 請求項10に記載の命令プリフェッチ
装置において、 上記条件確定判定手段は、上記条件確定信号を入力され
たとき、当該分岐命令の次のアドレス、又は上記分岐先
アドレスを用いるべき旨を示す条件確定情報を上記プリ
フェッチアドレス生成手段に対して出力するものである
ことを特徴とする命令プリフェッチ装置。
11. The instruction prefetch device according to claim 10, 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. An instruction prefetch device characterized in that it outputs condition determination information indicating to the prefetch address generating means.
【請求項12】 請求項7に記載の命令プリフェッチ装
置において、 上記確定条件情報生成手段は、 上記先読みした命令が上記分岐を決定する条件を確定す
る条件生成命令であるか否かを判定し、条件生成命令で
ある場合は、当該条件生成命令に従って演算処理を実行
し、その結果を用いて、上記確定条件情報を生成するも
のであることを特徴とする命令プリフェッチ装置。
12. The instruction prefetch device according to claim 7, wherein the definite condition information generation unit determines whether the prefetched instruction is a condition generation instruction that determines a condition for determining the branch, In the case of a condition generation instruction, an instruction prefetch device, characterized in that arithmetic processing is executed according to the condition generation instruction and the result is used to generate the definite condition information.
【請求項13】 請求項12に記載の命令プリフェッチ
装置において、 上記条件生成命令は、当該命令が、条件生成命令である
ことを示す情報を含むものであることを特徴とする命令
プリフェッチ装置。
13. The instruction prefetch device according to claim 12, wherein the condition generation instruction includes information indicating that the instruction is a condition generation instruction.
【請求項14】 命令を実行する計算機において、上記
命令を記憶する記憶装置から先読みする命令プリフェッ
チ方法であって、 上記先読みされた命令が、分岐を指令する分岐命令であ
るか否かを判断し、分岐命令である場合には、分岐信号
を出力する分岐判定ステップと、 上記分岐信号が出力された場合に、上記分岐命令におけ
る分岐を決定する条件が確定しているか否かを判定し、
確定している場合には、当該条件に対応した確定条件情
報を、後述するプリフェッチアドレス生成ステップにお
いて用いられるように出力する確定条件情報生成ステッ
プと、 上記確定条件情報生成ステップにおいて、確定条件情報
が出力されたときは、当該確定条件情報に基づいて、プ
リフェッチすべきアドレスを生成するプリフェッチアド
レス生成ステップとを含むことを特徴とする命令プリフ
ェッチ方法。
14. An instruction prefetch method for prefetching from a storage device that stores the instruction in a computer that executes the instruction, wherein it is determined whether the prefetched instruction is a branch instruction that instructs a branch. In the case of a branch instruction, a branch determination step of 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.
If the confirmation condition information has been confirmed, the confirmation condition information corresponding to the condition is output so as to be used in a prefetch address generation step described later, and the confirmation condition information is generated in the confirmation condition information generation step. A prefetch address generating step of generating an address to be prefetched based on the definite condition information when output, the instruction prefetch method.
【請求項15】 請求項14に記載の命令プリフェッチ
方法において、 上記確定条件情報生成ステップは、 上記分岐命令における分岐を決定する条件が確定してい
るか否かを判定し、確定している場合には条件確定信号
を出力する条件確定信号生成ステップと、 上記条件確定信号が出力されたときは、当該確定した条
件を取得して、上記取得した条件に基づいて上記確定条
件情報を生成する条件確定判定ステップとを含むもので
あることを特徴とする命令プリフェッチ方法。
15. The instruction prefetch method according to claim 14, wherein the definite condition information generating step determines whether or not a condition for determining a branch in the branch instruction is definite, and when the definite condition information is definite, Is a condition confirmation signal generating step of outputting a condition confirmation signal, and, when the condition confirmation signal is output, acquires the confirmed condition and generates the condition confirmation information based on the acquired condition. An instruction prefetch method comprising a determination step.
【請求項16】 請求項14に記載の命令プリフェッチ
方法において、 上記確定条件情報生成ステップでは、 上記先読みした命令が上記分岐を決定する条件を確定す
る条件生成命令であるか否かを判定し、条件生成命令で
ある場合は、当該条件生成命令に従って演算処理を実行
し、その結果を用いて、上記確定条件情報を生成するも
のであることを特徴とする命令プリフェッチ方法。
16. The instruction prefetch method according to claim 14, wherein in the determining condition information generating step, it is determined whether or not the prefetched instruction is a condition generating instruction that determines a condition for determining the branch, In the case of a condition generation instruction, an operation processing is executed according to the condition generation instruction, and the result is used to generate the definite condition information, the instruction prefetch method.
【請求項17】 請求項16に記載の命令プリフェッチ
方法において、 上記条件生成命令は、当該命令が、条件生成命令である
ことを示す情報を含むものであることを特徴とする命令
プリフェッチ方法。
17. The instruction prefetch method according to claim 16, wherein the condition generation instruction includes information indicating that the instruction is a condition generation instruction.
JP2002334960A 1996-11-01 2002-11-19 Device and method for prefetching instruction Pending JP2003150375A (en)

Priority Applications (1)

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

Applications Claiming Priority (3)

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

Related Parent Applications (1)

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

Publications (1)

Publication Number Publication Date
JP2003150375A true JP2003150375A (en) 2003-05-23

Family

ID=26558545

Family Applications (1)

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

Country Status (1)

Country Link
JP (1) JP2003150375A (en)

Similar Documents

Publication Publication Date Title
US6338136B1 (en) Pairing of load-ALU-store with conditional branch
US11216258B2 (en) Direct function call substitution using preprocessor
US6185676B1 (en) Method and apparatus for performing early branch prediction in a microprocessor
US4858104A (en) Preceding instruction address based branch prediction in a pipelined processor
US6662295B2 (en) Method and system dynamically presenting the branch target address in conditional branch instruction
US6687812B1 (en) Parallel processing apparatus
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
US6119221A (en) Instruction prefetching apparatus and instruction prefetching method for processing in a processor
US8250344B2 (en) Methods and apparatus for dynamic prediction by software
JP3738253B2 (en) Method and apparatus for processing program loops in parallel
JP3419276B2 (en) Instruction prefetch apparatus and instruction prefetch method
JP2003150375A (en) Device and method for prefetching instruction
Mohammadi et al. Energy efficient on-demand dynamic branch prediction models
US20050154859A1 (en) Branch prediction in a data processing apparatus
US20090031118A1 (en) Apparatus and method for controlling order of instruction
JP3602801B2 (en) Memory data access structure and method
JP2000163266A (en) Instruction execution system
JP3547562B2 (en) Microprocessor
US20040230781A1 (en) Method and system for predicting the execution of conditional instructions in a processor
KR920006613B1 (en) Instruction fetching unit for pipelined processing
JP2503223B2 (en) Prior control method
JP2002163126A (en) Event detecting circuit embedded in debugging cpu, event detecting method, and external peripheral circuit
CN115698984A (en) Graph instruction processing method and device
KR20060034998A (en) Apparatus and method for controling an access of branch predictor
JPH07334363A (en) Information processor