[go: up one dir, main page]

JPH10187442A - Device and method for prefetching instruction - Google Patents

Device and method for prefetching instruction

Info

Publication number
JPH10187442A
JPH10187442A JP28519297A JP28519297A JPH10187442A JP H10187442 A JPH10187442 A JP H10187442A JP 28519297 A JP28519297 A JP 28519297A JP 28519297 A JP28519297 A JP 28519297A JP H10187442 A JPH10187442 A JP H10187442A
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.)
Granted
Application number
JP28519297A
Other languages
Japanese (ja)
Other versions
JP3419276B2 (en
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 JP28519297A priority Critical patent/JP3419276B2/en
Publication of JPH10187442A publication Critical patent/JPH10187442A/en
Application granted granted Critical
Publication of JP3419276B2 publication Critical patent/JP3419276B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a prefetch instruction for reducing delay caused by a branch predictive error by continuously prefetching a condition branching instruction according to conditions when these conditions are fixed at the time point when the instruction is prefetched. SOLUTION: A 1st decode part 101 discriminates whether a processed instruction S112 is the condition branching instruction or not and whether the instruction is a condition generating instruction for fixing branching conditions or not, and a condition fix signal generating means 120 outputs a condition fix signal A118 to a condition fixture discriminating part 103 by comparing the address of condition generating instruction with contents of the program counter. Corresponding to this signal, the condition fixture discriminating part 103 outputs prefetch address information S114 for address generation to a prefetch address generating part 100 while using a condition code S119.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、命令プリフェッチ
装置、および命令プリフェッチ方法に関し、特にプロセ
ッサにおいて、パイプライン処理を効率的に実行し得る
命令プリフェッチ装置、および命令プリフェッチ方法に
関する。
The present invention relates to an instruction prefetch apparatus and an instruction prefetch method, and more particularly, to an instruction prefetch apparatus 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 At present, most computers store programs as well as data in a storage device.
A Neumann-type architecture that reads and executes this is adopted. In general, a Neumann-type computer mainly includes a computer having a processor such as a CPU for controlling the execution of a program and a main memory for temporarily storing a program and data, and is an I / O for performing input / output with a user or the outside. (I / O device) and a computer system having an auxiliary storage device (secondary storage device) for storing programs and data for a long period of time.

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

【0004】図6(a) は、プロセッサの制御による命令
処理における制御動作を説明するための図である。ま
ず、命令フェッチ処理において、プログラムカウンタを
参照することで、次に実行すべき命令が読み出される。
次の命令デコード処理では、読み出した命令の種類が判
定され、命令が解釈される。続く命令実行処理では、デ
ータの読み出しや演算処理等の処理が、命令に従って実
行される。その後、結果格納処理において、命令実行に
より得られた結果の格納がなされる。図示するように、
各処理は、マシンサイクルに相当する1タイミングごと
に、タイミングCLnからタイミングCLn+3にかけ
て行われる。
FIG. 6A is a diagram for explaining a control operation in instruction processing under the control of a processor. First, in the instruction fetch process, the next instruction to be executed 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. Thereafter, in a result storing process, a 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から
行われるものとなる。
In general, a program is executed by sequentially executing a plurality of instructions. FIG. 1B shows a case where an instruction A and an instruction B are sequentially executed. In the case shown in FIG. 2B, first, in the instruction fetch processing, the instruction A is read by referring to the program counter,
The content indicated by the instruction A is interpreted by the instruction decoding process, the process according to the specified content is performed in the instruction execution process, and the result obtained by the instruction execution is stored appropriately in the result storing process. At the next timing, the instruction fetch processing for the instruction B is executed to read the instruction B, and the instructions are sequentially processed in this way. If the processing of the instruction A is performed from the timing CLn to the timing CLn + 3, the execution of the instruction B is performed from the timing CLn + 4 as in FIG.

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

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

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

【0009】図7は従来の技術によるプリフェッチ装置
の構成を示す図、図8はプリフェッチ処理を実行する対
象となる命令を含むプログラムの一部を示す図、図9
は、従来のプリフェッチ装置で処理される場合の概略動
作を示すタイミングチャート図である。図7に示すよう
に、従来の技術による命令プリフェッチ装置は、プリフ
ェッチアドレス生成部300、第1デコード部303、
分岐予測部304、命令バッファ305、第2デコード
部306、演算実行部307、および条件コード保持部
308を備えた構成となっている。
FIG. 7 is a diagram showing a configuration of a conventional prefetch device, FIG. 8 is a diagram showing a part of a program including an instruction to be subjected to prefetch processing, and FIG.
FIG. 4 is a timing chart showing a schematic operation when processing is performed by a conventional prefetch device. As shown in FIG. 7, a 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 generation unit 300 generates an address to be prefetched next based on the prediction of the branch prediction unit 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 stores the instruction in an instruction buffer 3 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, sends a signal indicating the instruction to the branch prediction unit 304 described later and the prefetch instruction Output to the address generation unit 300. The branch prediction unit 304 predicts how the branch of the processing procedure is 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 branch direction in advance based on the probability of branching, or a method of storing a branch direction in the same conditional branch in the past and determining the branch direction according to a history of the stored branch direction is used. 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 fetches instructions temporarily stored from the instruction buffer 305, sequentially decodes the instructions, and controls an arithmetic process in an arithmetic execution unit, which will be described later, according to the obtained result. Calculation execution unit 3
07 executes an operation under the control of the second decoding unit 306, and if there is a change in a condition code held by a condition code holding unit 308, which will be described later, in accordance with the result of the operation, the condition code holding unit 308 A signal indicating the result is output. The condition code holding unit 308 includes an operation execution unit 307
Holds the condition code obtained based on the calculation processing result input from.

【0011】このように構成された従来の技術による命
令プリフェッチ装置の動作の概略は次のようになる。あ
るタイミングにおいて、プリフェッチアドレス生成部3
00において、次にフェッチすべき命令のアドレスが生
成され、プリフェッチアドレス信号S301として出力
される。当該命令プリフェッチ装置を用いるプロセッサ
においては、このプリフェッチアドレス信号S301を
用いて、命令をフェッチし、当該命令プリフェッチ装置
に入力する。次のタイミングでは、プリフェッチされた
命令が、第1デコード部303に入力され、デコード処
理される。
The operation of the conventional instruction prefetch device having the above-mentioned configuration is schematically described below. At a certain timing, the prefetch address generation unit 3
At 00, the address of the next instruction to be fetched is generated and output as the prefetch address signal S301. In the processor using the instruction prefetch device, an instruction is fetched using the prefetch address signal S301 and input 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 the instruction is a conditional branch instruction, the prefetch address generation unit 300
To the branch prediction unit 304. In both cases where the instruction is a conditional branch instruction and when it is not, the processed instruction is stored in the instruction buffer 305.
Output to

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

【0014】一方、分岐予測部304は、第1デコード
部より条件分岐命令である旨を示す信号が入力されたと
きは、設定された方法に従って予測処理を行い、予測の
結果を示す信号をプリフェッチアドレス生成部300に
出力する。プリフェッチアドレス生成部300において
は、次にプリフェッチすべき命令のアドレスを生成する
が、ここでプリフェッチアドレス生成部300が、第1
デコード部303から、条件分岐命令である旨を示す信
号を入力されていなかった場合には、条件コード保持部
308に保持された条件コードを参照した上で、次にプ
リフェッチすべき命令のアドレスを生成して、これをプ
リフェッチアドレス信号S301として出力する。これ
に対して、第1デコード部303から、条件分岐命令で
ある旨を示す信号を入力されていた場合には、分岐予測
部304から入力された予測を示す信号に基づいて、次
にプリフェッチすべき命令のアドレスを生成し、これを
プリフェッチアドレス信号S301として出力する。
On the other hand, when a signal indicating that the instruction is a conditional branch instruction is input from the first decoding unit, the branch prediction unit 304 performs a prediction process according to a set method, and prefetches a signal indicating a prediction result. Output to the address generation unit 300. The prefetch address generation unit 300 generates an address of an instruction to be prefetched next. Here, the prefetch address generation unit 300
If a signal indicating that the instruction is a conditional branch instruction has not been input from the decoding unit 303, the address of the next instruction to be prefetched is referred to after referring to the condition code held in the condition code holding unit 308. Generated and output as a 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. The address of the 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 in accordance with the timing chart of FIG. 9 will be described. The program shows the following processing procedure. In the figure, an instruction 400 is an addition instruction, performs an addition process on data stored in registers D0 and D1, and outputs the result to a register D2.
Is stored. In this program, according to the operation result of executing the instruction 400,
The branch in the 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 according to the execution result of the instruction 400. Here, it is assumed that if the result is 0, the zero flag of the condition code is set. The instruction 401 is a conditional branch instruction, and the processing procedure is branched by selecting the next instruction to be executed according to the zero flag of the condition code. Here, if the zero flag is not set, the next instruction to be executed is the instruction 403. If the zero flag is set, the next instruction to be executed is the instruction 402.

【0016】次に、従来の技術による命令プリフェッチ
装置において、当該プリフェッチ装置を用いるプロセッ
サが、図8に示すプログラムを実行する場合における動
作を、図9のタイミングチャートに従って、以下に説明
する。図9のチャートに示すタイミングt1では、プリ
フェッチアドレス生成部300において命令400のア
ドレスが生成され、プリフェッチアドレス信号S301
として出力される。当該命令プリフェッチ装置を用いる
プロセッサにおいては、このプリフェッチアドレス信号
S301を用いて、命令400をフェッチし、当該命令
プリフェッチ装置に入力する。次のタイミングt2で、
プリフェッチされた命令400が、第1デコード部30
3に入力され、デコード処理される。
Next, the operation of the conventional instruction prefetch device when the processor using the prefetch device executes the program shown in FIG. 8 will be described with reference to the timing chart of FIG. At the timing t1 shown in the chart of FIG. 9, the address of the instruction 400 is generated by the prefetch address generation unit 300, and the prefetch address signal S301
Is output as The processor using the instruction prefetch device fetches the instruction 400 using the prefetch address signal S301 and inputs the instruction 400 to the instruction prefetch device. At the next timing t2,
The prefetched instruction 400 is transmitted to the first decoding unit 30
3 and 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 the instruction is a conditional branch instruction. The second decoding unit 306 outputs the instruction 40 from the instruction buffer 305.
0 and decode processing, the instruction 40
It interprets that 0 is an addition instruction, and transmits the result of the decoding process to the arithmetic execution unit 307 by signal output. The arithmetic execution unit 307 executes an addition process indicated by the instruction 400,
As described above, since the result of the addition processing of the instruction 400 can affect the condition code, the result of the addition processing is output to the condition code holding unit 308, and the condition code holding unit 308 is changed. Holds condition codes. As described above, if the addition result is 0, the zero flag of the condition code is set. 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 determined.

【0018】その後、タイミングt3において、命令4
01のアドレスが生成されて、条件分岐命令である命令
401がフェッチされ、タイミングt4において、当該
プリフェッチ装置に入力され、第1デコード部303に
おいてデコード処理がなされる。命令401は条件分岐
命令であるので、その旨を示す信号が、第1デコード部
303から、プリフェッチアドレス生成部300と、分
岐予測部304とに出力される。
Thereafter, at timing t3, instruction 4
An address of 01 is generated, and an instruction 401, which is a conditional branch instruction, is fetched. The instruction 401 is input to the prefetch device at a timing t4, and is decoded by the first decoding unit 303. Since the instruction 401 is a conditional branch instruction, a signal indicating the instruction 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 prediction unit 304 to which the signal is input performs prediction, and outputs a signal indicating the result to the prefetch address generation unit 300. Here, the branch prediction unit 304
Is set so as 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. At timing t5 in FIG.
00 generates the address of the instruction 402 that is the “next instruction” of the conditional branch instruction 401 and outputs a 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 branch of the instruction 401 is determined using the condition flag determined at the timing t3. 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 determined. In this example, the original address (the address of the instruction 403) and the address generated by the prefetch address generation unit 300 at the timing t5. (The address of the instruction 402) does not match, that is, a branch prediction error has occurred, so that at the next timing t7, the prefetch of the next instruction is started again.

【0021】[0021]

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

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

【0023】[0023]

【課題を解決するための手段】上記目的を達成するた
め、請求項1にかかる命令プリフェッチ装置は、命令を
実行する計算機において、上記命令を記憶する記憶装置
から先読みする命令プリフェッチ装置であって、上記先
読みされた命令が、分岐を指令する分岐命令であるか否
かを判断し、分岐命令である場合には、分岐信号を出力
する分岐判定手段と、上記分岐信号が出力された場合
に、上記分岐命令における分岐を決定する条件が確定し
ているか否かを判定し、確定している場合には、当該条
件に対応した確定条件情報を、後述するプリフェッチア
ドレス生成手段に対して出力する確定条件情報生成手段
と、上記確定条件情報生成手段より、確定条件情報を入
力されたときは、当該確定条件情報に基づいて、プリフ
ェッチすべきアドレスを生成するプリフェッチアドレス
生成手段とを備えたものであり、分岐命令に続く命令の
プリフェッチにあたり、条件が確定している場合には、
当該確定した条件に対応した命令のアドレスを生成す
る。
According to a first aspect of the present invention, there is provided an instruction prefetch device for prefetching from a storage device for storing the instruction in a computer for executing the instruction. It is determined whether the prefetched instruction is a branch instruction for instructing a branch, and if the instruction is a branch instruction, branch determination means for outputting a branch signal; and It is determined whether or not a condition for determining a branch in the branch instruction is determined. If the condition is determined, the determined condition information corresponding to the determined condition is output to a prefetch address generation unit described later. When the fixed condition information is input from the fixed condition information generating means and the fixed condition information generating means, the address to be prefetched is set based on the fixed condition information. Are those in which a prefetch address generating means for generating for, when prefetching the instruction following the branch, if the condition is identified,
An address of an instruction corresponding to the determined condition is generated.

【0024】また、請求項2にかかる命令プリフェッチ
装置は、請求項1の装置において、上記確定条件情報生
成手段は、上記分岐命令における分岐を決定する条件が
確定しているか否かを判定し、確定している場合には条
件確定信号を出力する条件確定信号生成手段と、上記条
件確定信号が出力されたときは、当該確定した条件を取
得して、上記取得した条件に基づいて上記確定条件情報
を生成する条件確定判定手段とを備えたものであり、条
件が確定したか否かを、条件確定信号において伝達し、
条件が確定している場合には当該条件を利用する。
According to a second aspect of the present invention, in the instruction prefetch apparatus according to the first aspect, the fixed condition information generating means determines whether a condition for determining a branch in the branch instruction is fixed. A condition determination signal generating means for outputting a condition determination signal when the condition is determined, and obtaining the determined condition when the condition determination signal is output, and obtaining the determination condition based on the obtained condition. Condition determination determining means for generating information, and whether or not the condition is determined, is transmitted in a condition determination signal,
If the conditions are determined, the conditions are used.

【0025】また、請求項3にかかる命令プリフェッチ
装置は、請求項2の装置において、上記条件確定信号生
成手段は、上記分岐判定手段から出力されたアドレスを
保持する第一の命令アドレス保持手段と、その時点にお
いて実行されている命令のアドレスを保持する第二の命
令アドレス保持手段と、上記第一の命令アドレス保持手
段と、上記第二の命令アドレス保持手段とが保持するア
ドレスの比較処理を行い、上記比較において一致してい
ると判定する場合に、上記条件確定信号を上記条件判定
確定手段に出力する比較手段とを備えたものであり、条
件が確定したか否かの判定を、条件を確定する命令のア
ドレスを実行中の命令のアドレスと比較することで実行
し、条件が確定したか否かを判定する。
According to a third aspect of the present invention, there is provided the instruction prefetch apparatus according to the second aspect, wherein the condition determination signal generation means includes a first instruction address holding means for holding an address output from the branch determination means. A second instruction address holding unit that holds the address of the instruction that is being executed at that time, the first instruction address holding unit, and a comparison process of the address held by the second instruction address holding unit. And comparing means for outputting the condition determination signal to the condition determination determination means when it is determined that they match in the comparison, and determining whether or not the condition has been determined, Is executed by comparing the address of the instruction to determine the address with the address of the instruction being executed, and determines whether the condition is determined.

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

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

【0028】また、請求項6にかかる命令プリフェッチ
装置は、請求項1の装置において、上記確定条件情報生
成手段は、上記先読みした命令が上記分岐を決定する条
件を確定する条件生成命令であるか否かを判定し、条件
生成命令である場合は、当該条件生成命令に従って演算
処理を実行し、その結果を用いて、上記確定条件情報を
生成するものであり、条件生成命令についての判定を演
算処理に伴って実行する。
According to a sixth aspect of the present invention, in the instruction prefetch apparatus according to the first aspect of the present invention, the fixed condition information generating means is a condition generating instruction for determining the condition for determining the branch by the prefetched instruction. It is determined whether or not the instruction is a condition generation instruction. If the instruction is a condition generation instruction, an operation process is executed in accordance with the condition generation instruction. Execute with the processing.

【0029】また、請求項7にかかる命令プリフェッチ
装置は、請求項6の装置において、上記条件生成命令
は、当該命令が、条件生成命令であることを示す情報を
含むものであり、演算処理にともなう当該命令の解析を
実行する。
According to a seventh aspect of the present invention, in the instruction prefetch apparatus according to the sixth aspect, the condition generating instruction includes information indicating that the instruction is a condition generating instruction. The associated instruction is analyzed.

【0030】また、請求項8にかかる命令プリフェッチ
方法は、命令を実行する計算機において、上記命令を記
憶する記憶装置から先読みする命令プリフェッチ方法で
あって、上記先読みされた命令が、分岐を指令する分岐
命令であるか否かを判断し、分岐命令である場合には、
分岐信号を出力する分岐判定ステップと、上記分岐信号
が出力された場合に、上記分岐命令における分岐を決定
する条件が確定しているか否かを判定し、確定している
場合には、当該条件に対応した確定条件情報を、後述す
るプリフェッチアドレス生成ステップにおいて用いられ
るように出力する確定条件情報生成ステップと、上記確
定条件情報生成ステップにおいて、確定条件情報が出力
されたときは、当該確定条件情報に基づいて、プリフェ
ッチすべきアドレスを生成するプリフェッチアドレス生
成ステップとを含むものであり、分岐命令に続く命令の
プリフェッチにあたり、条件が確定している場合には、
当該確定した条件に対応した命令のアドレスを生成す
る。
According to another aspect of the present invention, there is provided an instruction prefetch method for prefetching from a storage device storing the instruction, wherein the prefetched instruction issues a branch. It is determined whether or not the instruction is a branch instruction.
A branch determining step of outputting a branch signal; and determining whether or not a condition for determining a branch in the branch instruction has been determined when the branch signal has been output. And a fixed condition information generating step of outputting the fixed condition information corresponding to the fixed condition information to be used in a prefetch address generating step to be described later. When the fixed condition information is output in the fixed condition information generating step, the fixed condition information is output. And a prefetch address generation step of generating an address to be prefetched based on the prefetch instruction. In the prefetch of an instruction following the branch instruction, if the condition is determined,
An address of an instruction corresponding to the determined condition is generated.

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

【0032】また、請求項10にかかる命令プリフェッ
チ方法は、請求項8の方法において、上記確定条件情報
生成ステップでは、上記先読みした命令が上記分岐を決
定する条件を確定する条件生成命令であるか否かを判定
し、条件生成命令である場合は、当該条件生成命令に従
って演算処理を実行し、その結果を用いて、上記確定条
件情報を生成するものであり、条件生成命令についての
判定を演算処理に伴って実行する。
According to a tenth aspect of the present invention, in the method of the eighth aspect, in the determining condition information generating step, the prefetched instruction is a condition generating instruction for determining a condition for determining the branch. It is determined whether or not the instruction is a condition generation instruction. If the instruction is a condition generation instruction, an operation process is executed in accordance with the condition generation instruction. Execute with the processing.

【0033】また、請求項11にかかる命令プリフェッ
チ方法は、請求項10の方法において、上記条件生成命
令は、当該命令が、条件生成命令であることを示す情報
を含むものであり、演算処理にともなう当該命令の解析
を実行する。
An instruction prefetch method according to claim 11 is the method according to claim 10, wherein the condition generation instruction includes information indicating that the instruction is a condition generation instruction. The associated instruction is analyzed.

【0034】[0034]

【発明の実施の形態】BEST MODE FOR CARRYING OUT THE INVENTION

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

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

【0036】また、第1デコード部101は、命令が分
岐命令であるか否かを判断し、分岐命令である場合に
は、分岐信号を出力する分岐判定手段として機能するも
のであり、命令S112が分岐命令である場合には、当
該条件分岐命令における分岐先アドレスを示す信号S1
11と、当該分岐命令における分岐条件を示す信号S1
15とを出力する。信号S111、およびS115は、
命令が分岐命令であることを示す分岐信号としても扱わ
れる。さらに、第1デコード部101は、命令が条件コ
ード(例えばゼロフラグ)を変更する命令、すなわち条
件生成命令であるか否かを判断するものであり、条件生
成命令であると判断した場合は、当該条件生成命令S1
12の命令アドレスS113を後述する条件生成命令ア
ドレス保持部102に出力するとともに、条件確定判定
手段103に対して未確定信号S115を出力する。
The first decoding unit 101 determines whether or not the instruction is a branch instruction. If the instruction is a branch instruction, the first decode unit 101 functions as a branch determination unit that outputs a branch signal. 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.
15 is output. The signals S111 and S115 are
It is also handled as a branch signal indicating that the instruction is a branch instruction. Further, the first decoding unit 101 determines whether 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
Twelve instruction addresses S113 are output to the condition generation instruction address holding unit 102 described later, and an undetermined signal S115 is output to the condition determination determining unit 103.

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

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

【0039】条件生成命令アドレス保持部102は、条
件生成命令のアドレスを保持する第1の命令アドレス保
持手段として機能するものであり、命令アドレスS11
3を保持する。プログラムカウンタ108は当該命令プ
リフェッチ装置を用いるプロセッサにおいて、実行中の
命令のアドレスを保持するレジスタであり、演算実行部
107により実行されている命令アドレスを保持する第
2の命令アドレス保持手段として機能する。比較器10
9は、条件生成命令アドレス保持部102から取得する
命令アドレスS117と、プログラムカウンタ108に
保持されたアドレスとの比較を行い、一致した場合に
は、一致を示す信号を出力する。条件生成命令アドレス
保持部102、プログラムカウンタ108、および比較
器109は、分岐命令における分岐を決定する条件が確
定しているか否かを判定し、確定している場合には条件
確定信号S118を出力する条件確定信号生成手段12
0として機能する。
The condition generation instruction address holding section 102 functions as a first instruction address holding means for holding the address of the condition generation instruction, and stores the instruction address S11.
Hold 3. The program counter 108 is a register that holds the address of the instruction being executed in the processor using the instruction prefetch device, and functions as a second instruction address holding unit that holds the instruction address 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 outputs a signal indicating a match if they 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 is determined. If the condition is determined, the condition generation signal S118 is output. Condition determining signal generating means 12
Functions as 0.

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

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

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

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

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

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

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

【0047】プリフェッチアドレス生成部100では、
入力されたプリフェッチアドレス情報を用いてプリフェ
ッチアドレス信号S110が生成されて出力される。図
2は、プリフェッチアドレス生成部100の動作を説明
するための図であり、内部構成の要部を示すものであ
る。図示するように、プリフェッチアドレス生成部10
0は、セレクタ151、アドレスカウンタ152、およ
び加算器153を備えたものとなっている。
In the prefetch address generator 100,
Using the input prefetch address information, a prefetch address signal S110 is generated and output. 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 generation unit 10
0 has a selector 151, an address counter 152, and an adder 153.

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

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

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

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

【0052】命令400は条件分岐命令ではないので、
分岐アドレスを示す信号S111と、分岐条件を示す信
号S115とは出力されない。一方、命令400は条件
コード(ゼロフラグ)を変更する命令であり、条件生成
命令であると判断されるので、命令400のアドレスが
条件生成命令アドレス保持部102に出力されて記憶さ
れるとともに、条件コード未確定信号S115が条件確
定判定部103に入力される。
Since 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, the instruction 400 is an instruction for changing the condition code (zero flag) and is determined to be a condition generation instruction. Therefore, the address of the instruction 400 is output to the condition generation instruction address holding unit 102 and stored, and The code undetermined signal S115 is input to the condition determination determining unit 103.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

【0072】演算実行部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 since the result of the addition process can affect the condition code, the result of the addition process is stored in the condition code holding unit 206. The condition code is output, and the condition code holding unit 206 holds the changed condition code. At timing t3 in FIG. 3, the condition flag is determined. And
The operation execution unit 205 according to the second embodiment outputs the condition determination signal S212 based on the information about the instruction 400 transmitted from the second decoding unit 204, to the condition determination unit 2
02 is output. The condition determination determining unit 202 that has received the condition determination signal S212 acquires the condition code S213 from the condition code holding unit 206.

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

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

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

【0076】[0076]

【発明の効果】請求項1の命令プリフェッチ装置によれ
ば、命令を実行する計算機において、上記命令を記憶す
る記憶装置から先読みする命令プリフェッチ装置であっ
て、上記先読みされた命令が、分岐を指令する分岐命令
であるか否かを判断し、分岐命令である場合には、分岐
信号を出力する分岐判定手段と、上記分岐信号が出力さ
れた場合に、上記分岐命令における分岐を決定する条件
が確定しているか否かを判定し、確定している場合に
は、当該条件に対応した確定条件情報を、後述するプリ
フェッチアドレス生成手段に対して出力する確定条件情
報生成手段と、上記確定条件情報生成手段より、確定条
件情報を入力されたときは、当該確定条件情報に基づい
て、プリフェッチすべきアドレスを生成するプリフェッ
チアドレス生成手段とを備えたものであり、分岐命令に
続く命令のプリフェッチにあたり、条件が確定している
場合には、当該確定した条件に対応した命令のアドレス
を生成するので、分岐予測ミスによる遅延を低減して、
装置資源を活用した処理の効率化が可能となる。
According to the present invention, in a computer for executing an instruction, the instruction prefetch apparatus prefetches from a storage device storing the instruction, wherein the prefetched instruction instructs a branch. A branch decision means for 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. It is determined whether or not the fixed condition information has been set. If the fixed condition information has been set, fixed condition information generating means for outputting fixed condition information corresponding to the condition to a prefetch address generating means described later; A prefetch address generating means for generating an address to be prefetched based on the fixed condition information when the fixed condition information is input from the generating means; In prefetching an instruction following a branch instruction, if a condition is determined, an address of an instruction corresponding to the determined condition is generated, so that delay due to a branch prediction error is reduced. ,
Processing efficiency can be improved by utilizing device resources.

【0077】請求項2の命令プリフェッチ装置によれ
ば、請求項1の装置において、上記確定条件情報生成手
段は、上記分岐命令における分岐を決定する条件が確定
しているか否かを判定し、確定している場合には条件確
定信号を出力する条件確定信号生成手段と、上記条件確
定信号が出力されたときは、当該確定した条件を取得し
て、上記取得した条件に基づいて上記確定条件情報を生
成する条件確定判定手段とを備えたものであり、条件が
確定したか否かを、条件確定信号において伝達すること
で、当該確定した条件に対応したプリフェッチアドレス
を生成して、分岐予測ミスによる遅延を低減して、装置
資源を活用した処理の効率化が可能となる。
According to the instruction prefetch apparatus of the second aspect, in the apparatus of the first aspect, the determination condition information generating means determines whether a condition for determining a branch in the branch instruction is determined, and A condition determination signal generating means for outputting a condition determination signal when the condition determination signal has been output; and when the condition determination signal has been output, obtaining the determined condition and obtaining the determined condition information based on the obtained condition. And a condition determination signal for generating a prefetch address corresponding to the determined condition by transmitting a condition determination signal as to whether or not the condition has been determined. , And the efficiency of processing utilizing device resources can be increased.

【0078】請求項3の命令プリフェッチ装置によれ
ば、請求項2の装置において、上記条件確定信号生成手
段は、上記分岐判定手段から出力されたアドレスを保持
する第一の命令アドレス保持手段と、その時点において
実行されている命令のアドレスを保持する第二の命令ア
ドレス保持手段と、上記第一の命令アドレス保持手段
と、上記第二の命令アドレス保持手段とが保持するアド
レスの比較処理を行い、上記比較において一致している
と判定する場合に、上記条件確定信号を上記条件判定確
定手段に出力する比較手段とを備えたものであり、条件
が確定したか否かの判定を、条件を確定する命令のアド
レスを実行中の命令のアドレスと比較することで実行す
ることで、条件が確定したか否かの判定を実行し、分岐
予測ミスによる遅延を低減して、装置資源を活用した処
理の効率化が可能となる。
According to a third aspect of the present invention, in the second aspect of the present invention, the condition determination signal generating means includes: a first instruction address holding means for holding an address output from the branch determination means; A second instruction address holding unit that holds the address of the instruction being executed at that time, the first instruction address holding unit, and a comparison process of the addresses held by the second instruction address holding unit are performed. A comparison unit that outputs the condition determination signal to the condition determination determination unit when it is determined that the conditions match in the comparison, and determines whether or not the condition is determined. Execution is performed by comparing the address of the instruction to be determined with the address of the instruction being executed, thereby determining whether or not the condition has been determined. Hesi in, it is possible to streamline the process utilizing device resources.

【0079】請求項4の命令プリフェッチ装置によれ
ば、請求項3の装置において、上記分岐判定手段は、上
記先読みされた命令が条件生成命令であるか否かを判定
し、条件生成命令である場合は、当該条件生成命令のア
ドレスを上記第1の命令アドレス保持手段に対して出力
するとともに、上記条件確定判定手段に対して、条件未
確定信号を出力するものであり、上記出力する分岐信号
として、当該分岐命令における分岐条件を示す情報を、
上記条件確定判定手段に対して出力するとともに、上記
分岐命令における分岐先アドレスを示す情報を、上記プ
リフェッチアドレス生成手段に対して出力するものであ
り、条件生成命令に対する判定処理を実行し、そのアド
レスを保持することで、アドレス比較による条件確定に
ついての判断を実行するので、条件が確定していたなら
ば、当該条件を利用し、分岐予測ミスによる遅延を低減
して、装置資源を活用した処理の効率化が可能となる。
According to a fourth aspect of the present invention, in the device of the third aspect, the branch determination means determines whether the prefetched instruction is a condition generation instruction, and determines whether the instruction is a condition generation instruction. In this case, the address of the condition generating instruction is output to the first instruction address holding means, and a condition undetermined signal is output to the condition determination determining means. As information indicating a branch condition in the branch instruction,
It outputs to the prefetch address generation means, and outputs information indicating a branch destination address in the branch instruction to the condition determination determination means, and executes a determination process for the condition generation instruction. Holds, the determination about the condition determination by the address comparison is executed. If the condition is determined, the condition is used to reduce the delay due to the branch prediction error, and the processing using the device resources is performed. Can be made more efficient.

【0080】請求項5の命令プリフェッチ装置によれ
ば、請求項4の装置において、上記条件確定判定手段
は、上記条件確定信号を入力されたとき、当該分岐命令
の次のアドレス、又は上記分岐先アドレスを用いるべき
旨を示す条件確定情報を上記プリフェッチアドレス生成
手段に対して出力するものであり、確定した条件に対応
した命令のアドレスを生成するので、分岐予測ミスによ
る遅延を低減して、装置資源を活用した処理の効率化が
可能となる。
According to a fifth aspect of the present invention, in the apparatus of the fourth aspect, when the condition determination signal is input, the condition determination determining means may receive the next address of the branch instruction or the branch destination. The prefetch address generation means outputs condition determination information indicating that an address is to be used, and generates an address of an instruction corresponding to the determined condition. It is possible to increase the efficiency of processing using resources.

【0081】請求項6の命令プリフェッチ装置によれ
ば、請求項1の装置において、上記確定条件情報生成手
段は、上記先読みした命令が上記分岐を決定する条件を
確定する条件生成命令であるか否かを判定し、条件生成
命令である場合は、当該条件生成命令に従って演算処理
を実行し、その結果を用いて、上記確定条件情報を生成
するものであり、条件生成命令についての判定を演算処
理に伴って実行するので、条件が確定している場合に
は、当該条件を利用することで、分岐予測ミスによる遅
延を低減して、装置資源を活用した処理の効率化が可能
となる。
According to the instruction prefetch apparatus of claim 6, in the apparatus of claim 1, the determination condition information generating means determines whether the prefetched instruction is a condition generation instruction for determining a condition for determining the branch. If the instruction is a condition generation instruction, an operation is performed in accordance with the condition generation instruction, and the result is used to generate the above-described final condition information. When the condition is determined, by using the condition, it is possible to reduce the delay due to a branch prediction error and to increase the efficiency of the process using the device resources.

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

【0083】請求項8の命令プリフェッチ方法によれ
ば、命令を実行する計算機において、上記命令を記憶す
る記憶装置から先読みする命令プリフェッチ方法であっ
て、上記先読みされた命令が、分岐を指令する分岐命令
であるか否かを判断し、分岐命令である場合には、分岐
信号を出力する分岐判定ステップと、上記分岐信号が出
力された場合に、上記分岐命令における分岐を決定する
条件が確定しているか否かを判定し、確定している場合
には、当該条件に対応した確定条件情報を、後述するプ
リフェッチアドレス生成ステップにおいて用いられるよ
うに出力する確定条件情報生成ステップと、上記確定条
件情報生成ステップにおいて、確定条件情報が出力され
たときは、当該確定条件情報に基づいて、プリフェッチ
すべきアドレスを生成するプリフェッチアドレス生成ス
テップとを含むものであり、分岐命令に続く命令のプリ
フェッチにあたり、条件が確定している場合には、当該
確定した条件に対応した命令のアドレスを生成するの
で、分岐予測ミスによる遅延を低減して、装置資源を活
用した処理の効率化が可能となる。
According to an eighth aspect of the present invention, there is provided an instruction prefetching method for prefetching from a storage device for storing the instruction, wherein the prefetched instruction is a branch instruction for instructing a branch. It is determined whether or not the instruction is a branch instruction. If the instruction is a branch instruction, a branch determination step of outputting a branch signal, and if the branch signal is output, a condition for determining a branch in the branch instruction is determined. It is determined whether or not the fixed condition information is generated. If the fixed condition information is determined, the fixed condition information generating step of outputting the fixed condition information corresponding to the condition so as to be used in a prefetch address generating step described later; In the generation step, when the fixed condition information is output, an address to be prefetched is generated based on the fixed condition information. A prefetch address generating step for prefetching an instruction following the branch instruction. If the condition is determined, an address of the instruction corresponding to the determined condition is generated. The delay can be reduced, and the efficiency of the process using the device resources can be increased.

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

【0085】請求項10の命令プリフェッチ方法によれ
ば、請求項8の方法において、上記確定条件情報生成ス
テップでは、上記先読みした命令が上記分岐を決定する
条件を確定する条件生成命令であるか否かを判定し、条
件生成命令である場合は、当該条件生成命令に従って演
算処理を実行し、その結果を用いて、上記確定条件情報
を生成するものであり、条件生成命令についての判定を
演算処理に伴って実行することで、上記の効果が得られ
る。
According to a tenth aspect of the present invention, in the method of the eighth aspect, in the determining condition information generating step, it is determined whether or not the prefetched instruction is a condition generating instruction for determining a condition for determining the branch. If the instruction is a condition generation instruction, an operation is performed in accordance with the condition generation instruction, and the result is used to generate the above-described final condition information. The above effect can be obtained by executing the above.

【0086】請求項11の命令プリフェッチ方法によれ
ば、請求項10の方法において、上記条件生成命令は、
当該命令が、条件生成命令であることを示す情報を含む
ものであり、演算処理に伴い当該命令の解析を実行する
ことで、上記の効果が得られる。
According to the instruction prefetch method of claim 11, in the method of claim 10, the condition generating instruction is:
The instruction includes information indicating that the instruction is a condition generation instruction, and the above-described effect is obtained by executing the analysis of the instruction along with the arithmetic processing.

【図面の簡単な説明】[Brief description of the 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 embodiment.

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

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

【図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 illustrating a schematic operation of a process according to 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 units 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 unit 107, 205, 307 Arithmetic execution unit 108 Program counter 109 Comparator 120 Condition determination signal generation means

Claims (11)

【特許請求の範囲】[Claims] 【請求項1】 命令を実行する計算機において、上記命
令を記憶する記憶装置から先読みする命令プリフェッチ
装置であって、 上記先読みされた命令が、分岐を指令する分岐命令であ
るか否かを判断し、分岐命令である場合には、分岐信号
を出力する分岐判定手段と、 上記分岐信号が出力された場合に、上記分岐命令におけ
る分岐を決定する条件が確定しているか否かを判定し、
確定している場合には、当該条件に対応した確定条件情
報を、後述するプリフェッチアドレス生成手段に対して
出力する確定条件情報生成手段と、 上記確定条件情報生成手段より、確定条件情報を入力さ
れたときは、当該確定条件情報に基づいて、プリフェッ
チすべきアドレスを生成するプリフェッチアドレス生成
手段とを備えたことを特徴とする命令プリフェッチ装
置。
1. A computer for executing an instruction, comprising: an instruction prefetch device for prefetching from a storage device for storing the instruction, wherein it is determined whether or not the prefetched instruction is a branch instruction for instructing a branch. If the instruction is a branch instruction, branch determination means for outputting a branch signal; and, when the branch signal is output, determine whether a condition for determining a branch in the branch instruction is determined,
When it is determined, the fixed condition information generating means for outputting the fixed condition information corresponding to the condition to a prefetch address generating means, which will be described later, and the fixed condition information generating means from the fixed condition information generating means. And a prefetch address generating means for generating an address to be prefetched based on the fixed condition information.
【請求項2】 請求項1に記載の命令プリフェッチ装置
において、 上記確定条件情報生成手段は、 上記分岐命令における分岐を決定する条件が確定してい
るか否かを判定し、確定している場合には条件確定信号
を出力する条件確定信号生成手段と、 上記条件確定信号が出力されたときは、当該確定した条
件を取得して、上記取得した条件に基づいて上記確定条
件情報を生成する条件確定判定手段とを備えたものであ
ることを特徴とする命令プリフェッチ装置。
2. The instruction prefetch apparatus according to claim 1, wherein the determination condition information generating unit determines whether a condition for determining a branch in the branch instruction is determined, and determines whether a condition for branching is determined. Is a condition determination signal generating means for outputting a condition determination signal; and, when the condition determination signal is output, acquiring the determined condition and generating the determination condition information based on the acquired condition. An instruction prefetch device, comprising: a determination unit.
【請求項3】 請求項2に記載の命令プリフェッチ装置
において、 上記条件確定信号生成手段は、 上記分岐判定手段から出力された命令のアドレスを保持
する第一の命令アドレス保持手段と、 その時点において実行されている命令のアドレスを保持
する第二の命令アドレス保持手段と、 上記第一の命令アドレス保持手段と、上記第二の命令ア
ドレス保持手段とが保持するアドレスの比較処理を行
い、上記比較において一致していると判定する場合に、
上記条件確定信号を上記条件判定確定手段に出力する比
較手段とを備えたものであることを特徴とする命令プリ
フェッチ装置。
3. The instruction prefetch device according to claim 2, wherein said condition determination signal generation means includes: first instruction address holding means for holding an address of an instruction output from said branch determination means; The second instruction address holding means for holding the address of the instruction being executed, the first instruction address holding means, and the second instruction address holding means perform a comparison process on the addresses held by the second instruction address holding means. When it is determined that they match,
An instruction prefetch device comprising: a comparison unit that outputs the condition determination signal to the condition determination determination unit.
【請求項4】 請求項3に記載の命令プリフェッチ装置
において、 上記分岐判定手段は、 上記先読みされた命令が条件生成命令であるか否かを判
定し、条件生成命令である場合は、当該条件生成命令の
アドレスを上記第1の命令アドレス保持手段に対して出
力するとともに、上記条件確定判定手段に対して、条件
未確定信号を出力するものであり、 上記出力する分岐信号として、当該分岐命令における分
岐条件を示す情報を、上記条件確定判定手段に対して出
力するとともに、上記分岐命令における分岐先アドレス
を示す情報を、上記プリフェッチアドレス生成手段に対
して出力するものであることを特徴とする命令プリフェ
ッチ装置。
4. The instruction prefetch device according to claim 3, wherein the branch determination unit determines whether the prefetched instruction is a condition generation instruction, and if the prefetched instruction is a condition generation instruction, the branch determination unit determines whether the instruction is a condition generation instruction. The address of the generated instruction is output to the first instruction address holding means, and a condition undetermined signal is output to the condition determination determining means. And the information indicating the branch destination address in the branch instruction is output to the prefetch address generating means. Instruction prefetch unit.
【請求項5】 請求項4に記載の命令プリフェッチ装置
において、 上記条件確定判定手段は、上記条件確定信号を入力され
たとき、当該分岐命令の次のアドレス、又は上記分岐先
アドレスを用いるべき旨を示す条件確定情報を上記プリ
フェッチアドレス生成手段に対して出力するものである
ことを特徴とする命令プリフェッチ装置。
5. The instruction prefetch device according to claim 4, wherein the condition determination determining means should use the next address of the branch instruction or the branch destination address when the condition determination signal is input. An instruction prefetch apparatus for outputting condition determination information indicating the above to the prefetch address generation means.
【請求項6】 請求項1に記載の命令プリフェッチ装置
において、 上記確定条件情報生成手段は、 上記先読みした命令が上記分岐を決定する条件を確定す
る条件生成命令であるか否かを判定し、条件生成命令で
ある場合は、当該条件生成命令に従って演算処理を実行
し、その結果を用いて、上記確定条件情報を生成するも
のであることを特徴とする命令プリフェッチ装置。
6. The instruction prefetch apparatus according to claim 1, wherein the determination condition information generation unit determines whether the prefetched instruction is a condition generation instruction that determines a condition for determining the branch. If the instruction is a condition generation instruction, the instruction prefetch device executes an arithmetic process in accordance with the condition generation instruction, and generates the above-mentioned fixed condition information using the result.
【請求項7】 請求項6に記載の命令プリフェッチ装置
において、 上記条件生成命令は、当該命令が、条件生成命令である
ことを示す情報を含むものであることを特徴とする命令
プリフェッチ装置。
7. The instruction prefetch apparatus according to claim 6, wherein the condition generation instruction includes information indicating that the instruction is a condition generation instruction.
【請求項8】 命令を実行する計算機において、上記命
令を記憶する記憶装置から先読みする命令プリフェッチ
方法であって、 上記先読みされた命令が、分岐を指令する分岐命令であ
るか否かを判断し、分岐命令である場合には、分岐信号
を出力する分岐判定ステップと、 上記分岐信号が出力された場合に、上記分岐命令におけ
る分岐を決定する条件が確定しているか否かを判定し、
確定している場合には、当該条件に対応した確定条件情
報を、後述するプリフェッチアドレス生成ステップにお
いて用いられるように出力する確定条件情報生成ステッ
プと、 上記確定条件情報生成ステップにおいて、確定条件情報
が出力されたときは、当該確定条件情報に基づいて、プ
リフェッチすべきアドレスを生成するプリフェッチアド
レス生成ステップとを含むことを特徴とする命令プリフ
ェッチ方法。
8. A method for prefetching an instruction from a storage device for storing an instruction in a computer that executes the instruction, comprising: determining whether the prefetched instruction is a branch instruction for instructing a branch. If the instruction is a branch instruction, a branch determining step of outputting a branch signal; and, when the branch signal is output, determining whether a condition for determining a branch in the branch instruction is determined,
When it is determined, the fixed condition information generating step of outputting the fixed condition information corresponding to the condition so as to be used in the prefetch address generating step described later; A prefetch address generating step of generating an address to be prefetched based on the determined condition information when the instruction is output.
【請求項9】 請求項8に記載の命令プリフェッチ方法
において、 上記確定条件情報生成ステップは、 上記分岐命令における分岐を決定する条件が確定してい
るか否かを判定し、確定している場合には条件確定信号
を出力する条件確定信号生成ステップと、 上記条件確定信号が出力されたときは、当該確定した条
件を取得して、上記取得した条件に基づいて上記確定条
件情報を生成する条件確定判定ステップとを含むもので
あることを特徴とする命令プリフェッチ方法。
9. The instruction prefetch method according to claim 8, wherein the determining condition information generating step determines whether or not a condition for determining a branch in the branch instruction has been determined. Is a condition determination signal generating step of outputting a condition determination signal; and, when the condition determination signal is output, acquiring the determined condition and generating the determination condition information based on the acquired condition. And a determining step.
【請求項10】 請求項8に記載の命令プリフェッチ方
法において、 上記確定条件情報生成ステップでは、 上記先読みした命令が上記分岐を決定する条件を確定す
る条件生成命令であるか否かを判定し、条件生成命令で
ある場合は、当該条件生成命令に従って演算処理を実行
し、その結果を用いて、上記確定条件情報を生成するも
のであることを特徴とする命令プリフェッチ方法。
10. The instruction prefetch method according to claim 8, wherein in the determining condition information generating step, it is determined whether the prefetched instruction is a condition generating instruction for determining a condition for determining the branch. If the instruction is a condition generation instruction, the instruction prefetch method is characterized in that an arithmetic process is executed in accordance with the condition generation instruction, and the result is used to generate the fixed condition information.
【請求項11】 請求項10に記載の命令プリフェッチ
方法において、 上記条件生成命令は、当該命令が、条件生成命令である
ことを示す情報を含むものであることを特徴とする命令
プリフェッチ方法。
11. The instruction prefetch method according to claim 10, wherein the condition generation instruction includes information indicating that the instruction is a condition generation instruction.
JP28519297A 1996-11-01 1997-10-17 Instruction prefetch apparatus and instruction prefetch method Expired - Fee Related JP3419276B2 (en)

Priority Applications (1)

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

Applications Claiming Priority (3)

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

Related Child Applications (1)

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

Publications (2)

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

Family

ID=26555781

Family Applications (1)

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

Country Status (1)

Country Link
JP (1) JP3419276B2 (en)

Also Published As

Publication number Publication date
JP3419276B2 (en) 2003-06-23

Similar Documents

Publication Publication Date Title
JP2603626B2 (en) Data processing device
US6338136B1 (en) Pairing of load-ALU-store with conditional branch
US6185676B1 (en) Method and apparatus for performing early branch prediction in a microprocessor
US10860300B2 (en) Direct function call substitution using preprocessor
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
JPH08106387A (en) Instruction prefetch circuit and cache device
US7831806B2 (en) Determining target addresses for instruction flow changing instructions in a data processing apparatus
JPH10187442A (en) Device and method for prefetching instruction
US20050154859A1 (en) Branch prediction in a data processing apparatus
JP2003150375A (en) Device and method for prefetching instruction
KR100331199B1 (en) Processor and method of fetching an instruction that select one of a plurality of fetch addresses generated in parallel to form a memory request
JP3547562B2 (en) Microprocessor
JP3335735B2 (en) Arithmetic processing unit
JP2503223B2 (en) Prior control method
US20040230781A1 (en) Method and system for predicting the execution of conditional instructions in a processor
JP2007317083A (en) Microprocessor and pipeline control method
KR920006613B1 (en) Instruction fetching unit for pipelined processing
JP2000163266A (en) Instruction execution system
JPH0228723A (en) System for executing loop instruction
JP2591325B2 (en) Branch control device
JPS60198640A (en) Pipeline type information processor
KR20060034998A (en) Apparatus and method for controlling branch predictor access
JP3102846B2 (en) Load address cache device and method
JPH0433021A (en) Branching instruction control system

Legal Events

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

Free format text: PAYMENT UNTIL: 20080418

Year of fee payment: 5

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

Year of fee payment: 6

Free format text: PAYMENT UNTIL: 20090418

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

Year of fee payment: 7

Free format text: PAYMENT UNTIL: 20100418

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

Free format text: PAYMENT UNTIL: 20110418

Year of fee payment: 8

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

Year of fee payment: 9

Free format text: PAYMENT UNTIL: 20120418

LAPS Cancellation because of no payment of annual fees