JP2006127080A - Pipeline processor - Google Patents
Pipeline processor Download PDFInfo
- Publication number
- JP2006127080A JP2006127080A JP2004313400A JP2004313400A JP2006127080A JP 2006127080 A JP2006127080 A JP 2006127080A JP 2004313400 A JP2004313400 A JP 2004313400A JP 2004313400 A JP2004313400 A JP 2004313400A JP 2006127080 A JP2006127080 A JP 2006127080A
- Authority
- JP
- Japan
- Prior art keywords
- instruction
- interlock
- fetching
- pipeline processor
- instructions
- 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.)
- Withdrawn
Links
Images
Landscapes
- Advance Control (AREA)
Abstract
Description
本発明は、パイプラインプロセッサに関する。 The present invention relates to a pipeline processor.
現在、複数の命令を並行に実行する、いわゆるパイプライン方式で演算処理をするパイプラインプロセッサがある。パイプラインプロセッサは、複数の命令の各々をフェッチ、デコードといったステージの単位で実行する。このようなパイプラインプロセッサには、多くのデータを記憶可能な外部メモリの他、データの記憶容量は小さいものの、より高速にアクセスできるキャッシュメモリを備えたものがある。 Currently, there are pipeline processors that execute a plurality of instructions in parallel and perform arithmetic processing in a so-called pipeline system. The pipeline processor executes each of a plurality of instructions in units of stages such as fetch and decode. Some pipeline processors include an external memory that can store a large amount of data, and a cache memory that can be accessed at a higher speed although the data storage capacity is small.
キャッシュメモリを備えたパイプラインプロセッサでは、外部メモリから命令の実行に必要なデータを外部メモリからキャッシュメモリに読み込む。そして、プロセッサがキャッシュメモリにアクセスしてデータを取り出して演算を実行することにより、より高速に演算の処理を実行することができる。
このようなパイプラインプロセッサでは、パイプラインプロセッサがキャッシュメモリのうち必要な情報が書き込まれていない領域にアクセスするというエラーが発生し得る。このようなエラーは、一般的にキャッシュのミスヒット(本明細書ではキャッシュミスヒットまたは単にミスヒットとも記す)と呼ばれている。
In a pipeline processor having a cache memory, data necessary for execution of instructions is read from the external memory into the cache memory. Then, when the processor accesses the cache memory, retrieves the data and executes the calculation, the calculation process can be executed at a higher speed.
In such a pipeline processor, an error may occur that the pipeline processor accesses an area in the cache memory where necessary information is not written. Such an error is commonly referred to as a cache miss (also referred to herein as a cache miss or simply a miss).
キャッシュミスヒットが発生した場合、外部メモリから情報が読み出されるまでパイプラインプロセッサ全体の動作が停止する。このため、キャッシュミスヒットの発生は、パイプラインプロセッサの稼動を妨げ、処理効率を低下させる一因であるといえる。キャッシュミスヒット発生によるパイプラインプロセッサの処理効率低下を防ぐ従来例としては、例えば、特許文献1、特許文献2に記載されたものがある。
When a cache miss occurs, the operation of the entire pipeline processor stops until information is read from the external memory. For this reason, it can be said that the occurrence of a cache miss hits the pipeline processor and impedes the processing efficiency. As conventional examples for preventing a decrease in processing efficiency of a pipeline processor due to occurrence of a cache miss hit, for example, there are those described in
特許文献1に記載された従来例は、レジスタファイルの他にシャドウレジスタファイルを設ける。シャドウレジスタファイルには、オペランドフェッチにおいてキャッシュミスヒットが発生したとき、ミスヒットしたアドレス等の情報が記憶される。そして、次にキャッシュミスヒットが発生したとき、記憶されているアドレスを用いて将来データアクセスすべきアドレスを予測するものである。
The conventional example described in
また、特許文献2に記載された発明は、予め第1プログラムカウンタと第2プログラムカウンタとを設けておく。そして、正常動作時は第1プログラムカウンタのアドレスで示される命令データをCPUに供給する。また、キャッシュミスヒットが起こったときには第2プログラムカウンタのアドレスで示される命令データをCPUに供給することによってキャッシュミスヒット発生時のCPU動作停止を防いでいる。
キャッシュミスヒットは、プロセッサで使用されるオペランドに係るデータ(オペランドデータ)の他、プロセッサの命令(オペコード)に係る命令データをプロセッサがフェッチする場合にも発生する。しかし、上記した従来技術をはじめ、従来技術の多くがオペランドデータのキャッシュミスヒットによるプロセッサ停止を回避するためになされたものである。この理由の一つとして、オペランドデータが命令データよりもキャッシュミスヒットの発生率が高いことが考えられる。 A cache miss hit occurs when the processor fetches instruction data related to an instruction (opcode) of the processor in addition to data related to an operand (operand data) used in the processor. However, many of the prior arts including the above-described prior art have been made in order to avoid a processor stop due to a cache miss hit of operand data. One reason for this is that operand data has a higher cache miss hit rate than instruction data.
しかしながら、命令データのキャッシュミスヒットは、オペランドデータに比べて低いとはいえプログラムやシステムによっては比較的頻繁に発生する。また、命令のキャッシュミスヒットが発生すると、外部メモリから命令が読み出されるまでパイプラインプロセッサを停止させる必要が生じる。したがって、命令データのキャッシュミスヒットは、オペランドデータのキャッシュミスヒットと同様にパイプラインプロセッサの処理効率を低下させる。 However, cache miss hits of instruction data occur relatively frequently depending on programs and systems, although they are lower than operand data. When an instruction cache miss hit occurs, the pipeline processor must be stopped until the instruction is read from the external memory. Accordingly, the instruction data cache miss hit reduces the processing efficiency of the pipeline processor in the same manner as the operand data cache miss hit.
ところで、パイプラインプロセッサで処理される複数の命令は、先に処理が開始された命令(例えば命令1とする)で得られた演算結果を後に処理が開始された命令(例えば命令2とする)の演算で利用することがある。
このような命令1、命令2において、命令2が命令1の演算結果を利用するタイミングで命令1の演算結果の書込みが完了していない場合、データハザードが発生する。データハザードが発生すると、パイプラインプロセッサは、インターロックをかけて処理を停止する。したがって、データハザードの発生に伴うインターロックの停止は、キャッシュミスヒットと同様にパイプラインプロセッサの処理効率を低下させる一因である。
By the way, as for a plurality of instructions processed by the pipeline processor, an operation result obtained by an instruction that has been processed first (for example, instruction 1) is used as an instruction that has been processed later (for example, instruction 2). It may be used in the calculation of
In
このようなデータハザードは、従来のパイプラインプロセッサにおいて、キャッシュミスヒットの発生と共にパイプラインプロセッサの処理効率を低下させる一因である。
本発明は、上記した点に鑑みてなされたものであり、キャッシュミスヒットによる処理効率の低下と併せてデータハザードによる処理効率の低下を防ぐことが可能なパイプラインプロセッサを提供することを目的とする。
Such a data hazard is a cause of reducing the processing efficiency of the pipeline processor along with the occurrence of a cache miss hit in the conventional pipeline processor.
The present invention has been made in view of the above points, and an object thereof is to provide a pipeline processor capable of preventing a decrease in processing efficiency due to a data hazard in addition to a decrease in processing efficiency due to a cache miss hit. To do.
以上の課題を解決するため、本発明のパイプラインプロセッサは、複数の命令を各々多段階の動作工程に区切って実行するパイプラインプロセッサであって、前記動作工程のうちの命令を取り込む取込動作工程において命令を取り込む命令取込手段と、前記取込動作工程において、前記命令取込手段が命令を取り込むことができないミスヒットを検出するミスヒット検出手段と、前記ミスヒット検出手段によってミスヒットが検出された場合にも前記命令取込手段を継続して動作させる動作継続手段と、を備えることを特徴とする。 In order to solve the above problems, a pipeline processor of the present invention is a pipeline processor that executes a plurality of instructions by dividing them into multi-stage operation processes, and takes in instructions in the operation processes. Instruction fetching means for fetching instructions in the process, miss hit detection means for detecting a miss that the instruction fetching means cannot fetch instructions in the fetching operation process, and a miss hit by the miss hit detection means And an operation continuation means for continuously operating the command fetching means even when detected.
このような発明によれば、複数の命令を各々多段階の動作工程に区切って実行するパイプラインプロセッサにおいて、取込動作工程において命令取込手段が命令を取り込む。また、この取込動作工程においてミスヒット検出手段がミスヒットを検出し、ミスヒットが検出された場合にも命令取込手段を動作させることができる。
このため、ミスヒットが発生した場合にも命令取込手段の停止によってパイプライン方式で行われている他の命令の処理が停止することがなく、ミスヒットを起こした命令に先行して他の命令の処理が進行する。したがって、本来後にデータハザードを生じるプログラムのデータハザード発生を防ぎ、より円滑で効率のよいパイプライン処理が実行できるパイプラインプロセッサを提供することができる。
According to such an invention, in a pipeline processor that divides and executes a plurality of instructions into multi-stage operation processes, the instruction fetch means fetches instructions in the fetch operation process. Further, in this fetching operation step, the miss-hit detecting means detects a mishit, and the instruction fetching means can be operated even when a mishit is detected.
For this reason, even when a mishit occurs, the processing of other instructions being performed in the pipeline system does not stop by stopping the instruction fetching means, and other instructions preceding the instruction that caused the mishit are not stopped. Instruction processing proceeds. Therefore, it is possible to provide a pipeline processor that can prevent a data hazard from occurring in a program that originally causes a data hazard and can execute pipeline processing more smoothly and efficiently.
また、本発明のパイプラインプロセッサは、前記動作継続手段が、前記ミスヒット検出手段によってミスヒットが検出された場合、前記命令取込手段に対して命令を取り込まないよう指示することによって前記命令取込手段を動作させることを特徴とする。
このような発明によれば、命令取込手段は、ミスヒットが検出された時にパイプラインプロセッサに入力される無効な命令を取り込むことなく、動作を継続できる。このため、命令取込手段の停止によってパイプライン方式で行われている他の命令の処理が停止することがなく、ミスヒットを起こした命令に先行して他の命令の処理が進行する。したがって、本来後にデータハザードを生じるプログラムのデータハザード発生を防ぎ、より円滑で効率のよいパイプライン処理が実行できるパイプラインプロセッサを提供することができる。
In the pipeline processor according to the present invention, the operation continuation unit instructs the instruction fetch unit to not fetch an instruction when a miss is detected by the miss hit detection unit. And operating the insertion means.
According to such an invention, the instruction fetching unit can continue the operation without fetching an invalid instruction input to the pipeline processor when a miss hit is detected. For this reason, the processing of other instructions that are performed in the pipeline system by the stop of the instruction fetching means does not stop, and the processing of the other instructions proceeds prior to the instruction that caused the mishit. Therefore, it is possible to provide a pipeline processor that can prevent a data hazard from occurring in a program that originally causes a data hazard and can execute pipeline processing more smoothly and efficiently.
また、本発明のパイプラインプロセッサは、前記動作継続手段が、前記命令取込手段に対してNOP信号を供給することによって前記命令取込手段に命令を取り込まないよう指示することを特徴とする。
このような発明によれば、比較的簡易に命令取込手段が動作を停止することを回避することができる。
The pipeline processor according to the present invention is characterized in that the operation continuation means instructs the instruction fetching means not to fetch an instruction by supplying a NOP signal to the instruction fetching means.
According to such an invention, it is possible to avoid the instruction fetching unit from stopping its operation relatively easily.
また、本発明のパイプラインプロセッサは、前記動作工程間で発生するハザードを検出するハザード検出手段をさらに備え、前記動作継続手段は、前記ミスヒット検出手段がミスヒットを検出し、かつ前記ハザード検出手段がハザードを検出していない場合に前記命令取込手段に対してNOP信号を供給することを特徴とする。
このような発明によれば、ミスヒットが発生していてハザードが発生してないタイミングの場合にNOP信号を命令取込手段に対して供給することができる。このため、適切なタイミングで効率よくNOP信号が供給されるため、本来後にデータハザードを生じるプログラムのデータハザード発生を防ぐことができ、いっそう処理効率の高いパイプラインプロセッサを提供することができる。
The pipeline processor according to the present invention further includes hazard detection means for detecting a hazard occurring between the operation steps, and the operation continuation means is configured to detect a miss by the miss-hit detection means, and detect the hazard. When the means does not detect a hazard, a NOP signal is supplied to the instruction fetch means.
According to such an invention, it is possible to supply the NOP signal to the instruction fetching means at the timing when a miss hit has occurred and no hazard has occurred. For this reason, since the NOP signal is efficiently supplied at an appropriate timing, it is possible to prevent the occurrence of a data hazard in a program that originally causes a data hazard, and it is possible to provide a pipeline processor with higher processing efficiency.
また、本発明のパイプラインプロセッサは、複数の命令を、命令を取り込む取込動作工程、取り込まれた命令をデコードするデコード動作工程を含む多段階の動作工程に区切って実行するパイプラインプロセッサであって、前記取込動作工程において命令を取り込む命令取込手段と、前記命令取込手段によって取り込まれた命令を、前記デコード動作工程においてデコードする命令デコード手段と、前記命令取込手段が命令を取り込むことができないミスヒットを検出するミスヒット検出手段と、前記デコード動作工程におけるハザードの発生によりインターロックがかかったことを検出するインターロック検出手段と、前記ミスヒット検出手段によってミスヒットが発生したことが検出され、かつ、前記インターロック検出手段によってインターロックがかかったことが検出された場合、前記デコード手段の動作をインターロックが解消するまで停止させながら、前記デコード動作工程以外の動作工程の少なくとも一部を継続して動作させる他動作継続手段と、を備えることを特徴とする。 The pipeline processor of the present invention is a pipeline processor that executes a plurality of instructions by dividing them into multi-stage operation steps including a fetch operation step for fetching instructions and a decode operation step for decoding the fetched instructions. An instruction fetching unit that fetches an instruction in the fetching operation step, an instruction decoding unit that decodes an instruction fetched by the instruction fetching unit in the decoding operation step, and the instruction fetching unit fetches an instruction. Miss hit detection means for detecting a miss hit that cannot be performed, interlock detection means for detecting that an interlock has been applied due to the occurrence of a hazard in the decoding operation step, and that a miss has occurred by the miss hit detection means Is detected, and the interlock detection means Other operation continuation means for continuously operating at least a part of the operation steps other than the decoding operation step while stopping the operation of the decoding means until the interlock is canceled when it is detected that the turlock is applied. It is characterized by providing.
このような発明によれば、多段階の動作工程のうちの取込動作工程において命令を取り込む。また、命令取込手段が命令を取り込むことができなかったミスヒットを検出すると共にデコード動作工程におけるハザードの発生によりインターロックがかかったことを検出する。そして、ミスヒットが発生したことが検出され、かつ、インターロックがかかったことが検出された場合、デコード手段の動作をインターロックが解消するまで停止させながらデコード動作工程以外の動作工程の少なくとも一部を継続して動作させることができる。 According to such an invention, the instruction is fetched in the fetching operation process among the multi-stage operating processes. Further, the instruction fetching unit detects a miss hit that cannot fetch the instruction, and detects that the interlock has been applied due to the occurrence of a hazard in the decoding operation process. When it is detected that a mis-hit has occurred and an interlock has been detected, at least one of the operation steps other than the decoding operation step is performed while stopping the operation of the decoding means until the interlock is released. The part can be operated continuously.
このような発明によれば、インターロックとミスヒットが共に発生している状態におけるデコードステージの進行停止中に、他の動作工程を継続して実行でき、他の命令の動作に影響を与えない。このため、ミスヒットに対応してミスヒットを発生した命令の取り込みを停止させている間にハザードにも対応でき、総合的なパイプラインプロセッサの停止時間をミスヒットとインターロックとに別個に対応するよりも短縮することができる。したがって、より円滑で効率のよいパイプライン処理が実行できるパイプラインプロセッサを提供することができる。 According to such an invention, while the progress of the decode stage is stopped in a state where both an interlock and a mishit occur, other operation steps can be continuously executed, and the operation of other instructions is not affected. . For this reason, it is possible to respond to hazards while stopping fetching instructions that caused a miss hit in response to a miss hit, and the total pipeline processor stop time can be handled separately for a miss hit and an interlock. It can be shortened than. Therefore, it is possible to provide a pipeline processor that can execute pipeline processing that is smoother and more efficient.
また、本発明は、前記他動作継続手段が、前記ミスヒット検出手段によってミスヒットが発生したことが検出され、かつ同時またはミスヒット発生の直前に前記インターロック検出手段によってインターロックがかかったことが検出された場合、インターロックが解消するまで前記デコード手段の動作を停止させながら、前記デコード動作工程以外の動作工程の少なくとも一部を継続して動作させることを特徴とする。 Further, according to the present invention, the other operation continuation means detects that a miss has occurred by the miss hit detection means, and the interlock detection means has been interlocked at the same time or immediately before the occurrence of the miss hit. Is detected, the operation of the decoding means is stopped until the interlock is canceled, and at least a part of the operation steps other than the decoding operation step is continuously operated.
このような発明によれば、デコード手段の動作を停止させながらデコード動作工程以外の動作工程の少なくとも一部を継続して動作させる処理を最適なタイミングで実行させることができる。このため、より円滑で効率のよいパイプライン処理が実行できるパイプラインプロセッサを提供することができる。
また、本発明のパイプラインプロセッサは、複数の命令を各々多段階の動作工程に区切って実行するパイプラインプロセッサであって、前記動作工程のうちの命令を取り込む取込動作工程において、命令を取り込む命令取込手段と、前記命令取込手段によって取り込まれた命令を格納する複数の命令格納手段と、前記命令格納手段に格納された命令を取り出してデコードする命令デコード手段と、を備え、前記ハザード検出手段によってハザードが検出され、インターロックがかかっている間は、前記命令格納手段の各々が前記命令取込手段によって取り込まれた命令を順次格納し、インターロックが解消後は、前記命令デコード手段が、前記命令格納手段の各々に格納されている命令を順次デコードすることを特徴とする。
According to such an invention, it is possible to execute a process of continuously operating at least a part of the operation steps other than the decoding operation step while stopping the operation of the decoding means at an optimal timing. Therefore, it is possible to provide a pipeline processor that can execute pipeline processing that is smoother and more efficient.
The pipeline processor of the present invention is a pipeline processor that divides and executes a plurality of instructions into multi-stage operation processes, and fetches instructions in the fetch operation process of fetching instructions among the operation processes. An instruction fetching means; a plurality of instruction storing means for storing instructions fetched by the instruction fetching means; and an instruction decoding means for fetching and decoding instructions stored in the instruction storing means; While the hazard is detected by the detecting means and the interlock is applied, each of the instruction storing means sequentially stores the instructions fetched by the instruction fetching means, and after the interlock is resolved, the instruction decoding means Are characterized by sequentially decoding instructions stored in each of the instruction storage means.
このような発明によれば、ハザード検出手段によってハザードが検出され、インターロックがかかっている間は、命令取込手段によって取り込まれた命令を複数の命令格納手段に順次格納し、インターロックが解消後は、命令格納手段の各々に格納されている命令を順次デコードする。インターロック解消後においても、新たな命令の取り込みを継続するため、命令格納手段には次々と新たな命令が取り込まれ、命令格納手段に命令が存在している状態で処理が進む。この命令格納手段に命令が存在している状態において、ミスヒットが発生した場合、格納されている命令を使って継続して動作することができる。このため、例えば動作継続手段によるNOP信号の供給がいらない、あるいはNOP信号の供給回数を抑えることができ、より円滑で効率のよいパイプライン処理が実行できるパイプラインプロセッサを提供することができる。 According to such an invention, while the hazard is detected by the hazard detecting means and the interlock is applied, the instructions fetched by the instruction fetching means are sequentially stored in the plurality of instruction storing means, and the interlock is eliminated. After that, the instructions stored in each of the instruction storage means are sequentially decoded. Even after the interlock is released, in order to continue fetching new instructions, new instructions are successively taken into the instruction storage means, and the process proceeds in a state where the instructions exist in the instruction storage means. In the state where the instruction exists in the instruction storing means, when a miss hit occurs, the operation can be continued using the stored instruction. For this reason, for example, the supply of the NOP signal by the operation continuation unit is not required, or the number of times of the NOP signal supply can be suppressed, and a pipeline processor capable of executing smoother and more efficient pipeline processing can be provided.
以下、図を参照して本発明に係るパイプラインプロセッサの実施形態1及び実施形態2を説明する。
(実施形態1)
図1は、本発明の実施形態1におけるパイプラインプロセッサのブロック図である。図示した構成は、パイプラインプロセッサに与えられる命令が格納された外部メモリ1、外部メモリ1に格納されている命令のキャッシュに使用される命令キャッシュ2と、パイプラインプロセッサ3とからなる。
Embodiments 1 and 2 of a pipeline processor according to the present invention will be described below with reference to the drawings.
(Embodiment 1)
FIG. 1 is a block diagram of a pipeline processor in
パイプラインプロセッサ3は、複数の命令を各々多段階の動作工程に区切って実行する。実施形態1では、命令キャッシュ2から複数の命令を取り出して各命令を実行する。なお、実施形態1では、各命令を実行するための多段階の動作工程とは、命令キャッシュから命令を取り込むフェッチステージ、フェッチされた命令をデコードするデコードステージ、命令を実行する実行ステージ、実行ステージで得られた結果をレジスタに書き込むライトバックステージの4つの動作ステージをいうものとする。
The
このような複数の動作ステージに命令を区切って実行するため、パイプラインプロセッサ3は、フェッチステージで命令を取り込む命令フェッチレジスタ119及びそれを制御する命令フェッチレジスタ制御部109、デコードステージを処理するための命令デコード部111、実行ステージを実行(演算)するための実行部113、実行部113による演算で得られた演算結果が書き込まれるレジスタファイル115を備えている。また、命令フェッチレジスタ制御部109は、命令フェッチレジスタ119とともに予備レジスタ121を内蔵している。さらに、命令キャッシュ2に対して命令読み出しの要求を行うために命令フェッチ要求制御部105を備えている。命令フェッチ要求制御部105は、命令キャッシュ2に対して命令の読み出し要求信号(図中ではPBUS_RD_ENと記す)と、読み出しアドレス信号(図中ではPBUS_ADRSと記す)を出力する。この読み出し要求と読み出しアドレスは、フェッチステージの前のサイクルで出力されている。
In order to execute the instruction by dividing the instruction into a plurality of operation stages, the
以上の構成において、フェッチステージで命令キャッシュ2からの命令を命令フェッチレジスタ制御部109により命令フェッチレジスタ119へ取り込む。この際、命令フェッチ要求制御部105により、命令キャッシュ2の命令がキャッシュされていない領域に読み出し要求がされていた場合、すぐに命令の取り込みができない。このことを、一般にキャッシュミスヒットという。
In the above configuration, an instruction from the
命令フェッチレジスタ制御部109は、キャッシュミスヒットが検出され、後述するインターロックが検出されていない場合、命令フェッチレジスタ119に対してNOP(no-operation instruction)信号を供給するものである。NOPとは、何の処理も行わないことを指示する命令である。
このため、命令フェッチレジスタ119は、ミスヒットによって命令が取り込めない場合に、命令フェッチレジスタ制御部109からのNOP信号を取り込むため、停止することがなく、継続して動作し続けることができる。なお、継続して動作するとは、今回の動作タイミング(クロックサイクル)で命令が取り出せない場合にも正常にフェッチが完了したのと同じように動作することをいう。キャッシュミスヒットが発生した場合にも命令フェッチレジスタ119が継続して動作した場合、デコード、演算実行といった以降の動作ステージも継続して行われる。
The instruction fetch
For this reason, since the instruction fetch
このような動作によれば、キャッシュミスヒットが発生した命令が他の命令に影響することがなく、他の命令はキャッシュミスヒットが発生しなかった場合と同様に完了する。
また、実施形態1のパイプラインプロセッサは、データハザード等を検出するための検出部107を備えている。検出部107は、命令フェッチ要求制御部105及び命令フェッチレジスタ制御部109にインターロック信号(図中ではINTERLOCKと記す)を出力する構成である。インターロック信号は、検出部107によるハザード検出の有無によって異なる値を持つ信号である。
According to such an operation, an instruction in which a cache miss hit occurs does not affect other instructions, and the other instructions are completed in the same manner as in the case where no cache miss hit has occurred.
Further, the pipeline processor of the first embodiment includes a
さらに、実施形態1のパイプラインプロセッサは、命令デコード部111において分岐命令がデコードされた時に分岐先アドレスを計算するための分岐アドレス計算部103を備える。また、命令フェッチ要求制御部105から出力される命令読み出しアドレス信号の元になるプログラムカウンタ101を備えている。プログラムカウンタ101は通常はサイクルごとにインクリメントされるが、分岐命令がデコードされた時は、分岐アドレス計算部103から出力される分岐先アドレスに更新される。なお、命令フェッチ要求制御部105から出力される命令の読み出し要求信号がディスエイブルになったときは、プログラムカウンタ101が更新されないように制御する。ちなみに、実施形態1の命令フェッチ要求制御部105から出力される命令の読み出し要求信号は、キャッシュミスヒットまたはインターロックが発生したサイクルでディスエイブルになるように制御される。
Further, the pipeline processor of the first embodiment includes a branch
以上述べた構成は、基本的に次のように動作する。すなわち、図1に示した命令キャッシュ2は、命令データと共にミスヒット信号(図中ではPBUS_WAITと記す)を命令フェッチレジスタ制御部109に出力する。ミスヒット信号は、キャッシュミスヒットの発生の有無によって値が切り換えられる信号であって、命令フェッチレジスタ制御部109は、ミスヒット信号の値によってキャッシュミスヒットの発生を検出する。
The configuration described above basically operates as follows. That is, the
また、ハザードが発生した場合、検出部107は、インターロック信号の値を切り換えてインターロックがかかったことを命令フェッチレジスタ制御部109に通知する。
実施形態1では、ミスヒット信号、インターロック信号をいずれも1または0の値をとるデジタル信号とする。そして、インターロック信号についてはインターロックがかかっていない状態の値を0、インターロックがかかった状態の値を1とする。また、ミスヒット信号については、キャッシュミスヒットが発生していない状態の値を0、キャッシュミスヒットが発生した状態の値を1とする。
When a hazard occurs, the
In the first embodiment, both the miss-hit signal and the interlock signal are digital signals having a value of 1 or 0. For the interlock signal, the value when the interlock is not applied is 0, and the value when the interlock is applied is 1. For the miss-hit signal, the value in a state where no cache miss has occurred is 0, and the value in a state where a cache miss has occurred is 1.
インターロック信号及びミスヒット信号をこのように設定することにより、実施形態1の命令フェッチレジスタ制御部109は、インターロック信号及びミスヒット信号の値の組合せによる4種類の状態を認識できる。
なお、4種類の状態とは、キャッシュミスヒット、インターロックのいずれも発生していない状態、キャッシュミスヒット、インターロックのいずれもが発生している状態、キャッシュミスヒットのみが発生している状態、インターロックのみが発生している状態の合計4つである。
By setting the interlock signal and the miss hit signal in this way, the instruction fetch
Note that the four types of states are states where neither a cache miss hit or an interlock occurs, a state where both a cache miss hit or an interlock occurs, or a state where only a cache miss hit occurs In total, only four interlocks are generated.
次に、上記したパイプラインプロセッサの動作を、キャッシュミスヒットのみ発生(インターロック発生なし)の場合と、キャッシュミスヒットとインターロックが同時に起こった場合と、に分けて説明する。なお、実施形態1では、いずれの説明においても実施形態1のパイプラインプロセッサの動作説明に先立って従来の構成の動作を示し、実施形態1と対比するものとする。 Next, the operation of the pipeline processor described above will be described separately for the case where only a cache miss hit occurs (no occurrence of an interlock) and the case where a cache miss hit and an interlock occur simultaneously. Note that in the first embodiment, prior to the description of the operation of the pipeline processor of the first embodiment, the operation of the conventional configuration is shown in any description and is compared with the first embodiment.
1、キャッシュミスヒットのみ発生(インターロック発生なし)の場合
先ず、キャッシュミスヒットのみ発生(インターロック発生なし)の場合のパイプラインプロセッサの動作について以下に説明する。この説明は、パイプラインプロセッサが以下に示すプログラム1を実行したものとして行う。
プログラム1
(INST1)
(INST2)
(INST3) ADD%SR2,%SR0,%SR1
(INST4) ADD%SR4,%SR2,%SR3
(INST5)
(INST6)
上記したプログラム1において、INST(INSTruction)1〜INST6は各々命令コードを示している。INST3、INST4は、いずれもADD命令の命令コードである。INST3は、SR0(レジスタ0)から取り出した値とSR1から取り出した値とを加算してSR2に書き込むよう命令するものである。また、INST4は、INST3のADD命令によって算出されてSR2に書き込まれた値と、SR3から取り出した値とを加算してSR4に書き込むよう命令するものである。なお、INST1、INST2及びINST5、INST6は任意のプログラムであってよい。
1. When only a cache miss hit occurs (no interlock occurs) First, the operation of the pipeline processor when only a cache miss hit occurs (no interlock occurs) will be described below. This description is made assuming that the pipeline processor executes the
(INST1)
(INST2)
(INST3) ADD% SR2,% SR0,% SR1
(INST4) ADD% SR4,% SR2,% SR3
(INST5)
(INST6)
In the above-described
このようなプログラム1は、INST3による演算結果の書き込みが完了した後でないとINST4が命令をデコードすることができない。つまり、INST4はINST3のライトバックステージ完了後でないとデコードステージを実行することができないことになる。
図2及び図3は、上記したプログラムを実行する場合のタイミングチャートであって、図2のタイミングチャートが従来のパイプラインプロセッサのものである。図3は、実施形態1のパイプラインプロセッサで上記したプログラムを実行した場合のタイミングチャートである。なお、タイミングチャートでは、フェッチステージをF、デコードステージをD、実行ステージをE、ライトバックステージをWBで示している。また、キャッシュミスヒット信号をPBUS_WAIT、インターロック信号をINTERLOCKと示している。
Such a
2 and 3 are timing charts when the above-described program is executed. The timing chart of FIG. 2 is that of a conventional pipeline processor. FIG. 3 is a timing chart when the above-described program is executed by the pipeline processor of the first embodiment. In the timing chart, F represents the fetch stage, D represents the decode stage, E represents the execution stage, and WB represents the write back stage. Further, the cache miss hit signal is indicated as PBUS_WAIT, and the interlock signal is indicated as INTERLOCK.
図2、図3に示した例では、いずれもINST4がクロックサイクル4でミスヒットを発生する。このとき、従来の構成では、フェッチが完了するクロックサイクル6までINST1、INST2、INST3の動作ステージが次の動作ステージに移ることがない(停止する)。
また、クロックサイクル6以降正常に動作を開始した後、従来の構成では、クロックサイクル7にINST3とINST4との間でデータハザードが発生する。このため、INST4は、INST3のライトバックステージが行われるクロックサイクル8以降にデコードステージを実行することが可能になる。図2に示した例では、クロックサイクル9にデコードステージが実行され、引き続き実行ステージ、ライトバックステージが実行されてクロックサイクル11にINST4が完了する。
In both the examples shown in FIGS. 2 and 3,
In addition, after normal operation is started after
一方、実施形態1のパイプラインプロセッサにおいても、INST4がクロックサイクル4でミスヒットを発生する。この時、命令フェッチレジスタ制御部109には、キャッシュミスヒットが発生していることを示すミスヒット信号のアクティブ状態が入力される。このミスヒット信号のアクティブ状態が入力され、インターロック信号のディスエイブル状態が入力された場合、命令フェッチレジスタ制御部109は、NOP信号を生成して命令フェッチレジスタ119に格納させる。
On the other hand, also in the pipeline processor of the first embodiment, INST4 generates a miss-hit in
NOP信号の格納は、例えば、次のようにして実行される。すなわち、命令フェッチレジスタ制御部109は、予めNOP信号を記憶している記憶装置を備える。命令フェッチレジスタ制御部109は、ミスヒット信号によってキャッシュミスヒットを検出し、かつ、インターロックが発生していない時、命令フェッチレジスタ119に対し、この記憶装置からNOP信号を出力させ、命令フェッチレジスタ119はこのNOP信号を格納する。
The NOP signal is stored, for example, as follows. That is, the instruction fetch
図3では、命令フェッチレジスタ119に、命令を取り込めないクロックサイクル4及びクロックサイクル5において、命令フェッチレジスタ制御部109によるNOP信号が格納される。命令フェッチレジスタ制御部109によるNOP信号の格納ステージを、ハードフェッチステージと定義し、図中に「ハードF」として示す。
以上述べたように、実施形態1のパイプラインプロセッサは、クロックサイクル4及びクロックサイクル5において、ハードフェッチステージを実行する。このため、パイプラインはどのステージも停止することなく動作を続ける。よって、INST1,INST2、INST3においても各動作ステージが停止することなく順次実行され、INST3におけるライトバックステージが従来の構成よりも早いタイミングで完了する。
In FIG. 3, the instruction fetch
As described above, the pipeline processor according to the first embodiment executes the hard fetch stage in
図3に示した例では、クロックサイクル7でINST4のデコードステージが行われる時にはINST3の演算結果の書込みが完了している。よって、INST4がクロックサイクル7でINST3の演算結果を用いることができ、インターロックによってパイプラインプロセッサが停止することがない。このような実施形態1のパイプラインプロセッサは、本来起こるハザードを、キャッシュミスヒットが発生した場合には防ぐことができ、パイプライン処理の効率を上げることができる。
In the example shown in FIG. 3, when the decode stage of INST4 is performed at
2、キャッシュミスヒットとインターロックが同時に起こった場合
次に、キャッシュミスヒットとインターロックとが同じタイミングで起こった場合のパイプラインプロセッサの動作について以下に説明する。この説明は、パイプラインプロセッサが以下に示すプログラム2を実行したものとして行う。
プログラム2
(INST1)
(INST2) ADD%SR2,%SR0,%SR1
(INST3) ADD%SR4,%SR2,%SR3
(INST4)
(INST5)
(INST6)
上記したプログラム2は、INST2による演算結果の書き込みが完了した後でないとINST3が命令をデコードすることができない。つまり、INST3はINST2のライトバックステージ完了後でないとデコードステージを実行することができないことになる。
2. When cache miss hit and interlock occur simultaneously Next, the operation of the pipeline processor when the cache miss hit and interlock occur at the same timing will be described below. This description will be made assuming that the pipeline processor executes the
(INST1)
(INST2) ADD% SR2,% SR0,% SR1
(INST3) ADD% SR4,% SR2,% SR3
(INST4)
(INST5)
(INST6)
In the
キャッシュミスヒットとインターロックとが同じタイミングで起こった場合、図1に示したパイプラインプロセッサは、検出部107が、デコードステージにおけるハザードの発生によりインターロックがかかることを検出するインターロック検出手段として機能する。
また、命令フェッチレジスタ制御部109は、ミスヒットが発生したことが検出され、かつ、インターロックがかかったことが検出された場合、命令デコード部111の動作をインターロックが解消するまで停止させながら、デコードステージ以外の動作ステージの少なくとも一部を継続して動作させる他動作継続手段として機能する。
When the cache miss hit and the interlock occur at the same timing, the pipeline processor shown in FIG. 1 serves as an interlock detection unit that detects that the
In addition, the instruction fetch
また、実施形態1でいうミスヒットが発生したことが検出され、かつ、インターロックがかかったことが検出された場合とは、ミスヒットが発生したことが検出され、かつ同時またはミスヒット発生の直前にインターロックがかかったことが検出された場合をいう。実施形態1では、ミスヒットが発生したことが検出され、かつ同時にインターロックがかかったことが検出されたものとして以降の説明を行う。なお、実施形態1でいうミスヒットが発生したことが検出され、かつ同時にインターロックがかかったとは、ミスヒットの検出信号とインターロックの検出信号とが同一サイクル内でアクティブになったことを指すものとする。 In addition, when the occurrence of a miss hit in the first embodiment is detected and the occurrence of an interlock is detected, the occurrence of a miss hit is detected and the occurrence of a simultaneous or miss hit is detected. A case where it is detected that an interlock has been applied immediately before. In the first embodiment, the following description will be given on the assumption that a miss-hit has been detected and at the same time that an interlock has been detected. It is to be noted that the occurrence of a miss hit in the first embodiment is detected and the interlock is simultaneously applied means that the miss hit detection signal and the interlock detection signal are activated in the same cycle. Shall.
図4及び図5は、キャッシュミスヒットとインターロックとが同じタイミングで起こった場合のパイプラインプロセッサの動作を説明するためのタイミングチャートであって、図4のタイミングチャートが従来のパイプラインプロセッサのものである。図5は、実施形態1のパイプラインプロセッサでキャッシュミスヒットとインターロックとが同じタイミングで起こった状態に対処した場合のタイミングチャートである。 4 and 5 are timing charts for explaining the operation of the pipeline processor when the cache miss hit and the interlock occur at the same timing. The timing chart of FIG. Is. FIG. 5 is a timing chart when the pipeline processor according to the first embodiment copes with a state in which a cache miss hit and an interlock occur at the same timing.
図示するように、図4のタイミングチャートでは、クロックサイクル4でインターロックとミスヒットとが同時に起こっている。このような場合、従来のパイプラインプロセッサでは、先ず、ミスヒットの発生に対処してINST1、INST2、INST3の動作ステージを停止する。ミスヒットが解消後、インターロックの原因となるハザードに対処してクロックサイクル6、クロックサイクル7においてINST2のライトバックステージが完了するまで、INST3のデコードステージが停止する。
As shown in the figure, in the timing chart of FIG. 4, an interlock and a miss hit occur simultaneously in
一方、実施形態1のパイプラインプロセッサでは、クロックサイクル4でインターロックとINST4のキャッシュミスヒットを発生した場合、INST3のデコードステージは停止させて、ライトバックステージにあるINST1、実行ステージにあるINST2は継続して実行させる。クロックサイクル5も同様に動作する。このように、実行ステージ、ライトバックステージを継続して動作させることにより、インターロックに対処すると伴に、INST4のミスヒットに対処していることになる。
On the other hand, in the pipeline processor of the first embodiment, when an interlock and a cache miss hit of INST4 occur in
これは、従来のようなキャッシュミスヒット中に全ての動作ステージが停止してしまうことにより、キャッシュミスヒットの解消後に、インターロックの解消を行う動作に比べて停止サイクルが短くなるため、パイプライン処理の効率が向上する。
また、上記した動作は、図1に示した構成において、命令フェッチレジスタ制御部109がキャッシュミスヒットとインターロックの発生とを同時に検出したとき、命令デコード部111の動作のみを停止させる。すなわち、命令フェッチレジスタ119の格納内容を更新させないように動作させて、実行部113等を継続して動作させることによって実現することができる。
This is because all the operation stages are stopped during a cache miss hit as in the conventional case, so that the stop cycle is shortened compared to the operation for releasing the interlock after the cache miss hit is resolved. Processing efficiency is improved.
Further, the above-described operation stops only the operation of the
図6は、以上述べた、キャッシュミスヒットのみ発生(インターロック発生なし)の場合、および、キャッシュミスヒットとインターロックが同時に起こった場合、を含む実施形態1におけるキャッシュミスヒット信号(図中ではPBUS_WAITと記す)とインターロック信号(図中ではINTERLOCKと記す)の状態に応じた命令フェッチレジスタ119の格納内容の遷移を示した表である。表中の1がアクティブ、0がディスエイブルを意味する。図中の丸付き数字はパイプラインプロセッサの状態に対して付されたものであり、丸1はキャッシュミスヒット、インターロックのいずれも発生していない状態を示す。丸2は、インターロックのみが発生している状態を示す。また、丸3は、キャッシュミスヒットのみが発生した状態を、丸4はキャッシュミスヒット、インターロックが共に発生した状態を示している。
FIG. 6 shows a cache miss signal in the first embodiment (in the figure, including the case where only a cache miss hit occurs (no interlock occurs) and the case where a cache miss hit and an interlock occur simultaneously). It is a table showing the transition of the stored contents of the instruction fetch
状態丸1では、キャッシュミスヒット、インターロック共に発生していないため、命令フェッチレジスタ119の内容は取り込まれた命令(フェッチされた命令)に、置き換えられる。
また、状態丸3は、先の説明で述べたキャッシュミスヒットのみ発生(インターロック発生なし)の場合に対応する。このとき、実施形態1のパイプラインプロセッサは、命令フェッチレジスタ制御部109が命令フェッチレジスタ119にNOP命令を格納させる。このため、パイプラインプロセッサはキャッシュミスヒットが起こっていないかのように動作し、停止することがない。これにより、従来、キャッシュミスヒットによる停止の後、本来であれば発生するインターロックを防ぐことができる。
In
The
さらに、状態丸4は、先の説明で述べたキャッシュミスヒットとインターロックが同時に起こった場合に対応する。この場合、インターロックが起こっているためデコードステージを停止する必要がある。よって、命令フェッチレジスタ119は次サイクルでも現在格納されている命令を保持する。この際、従来であればキャッシュミスヒットも同時に起こっている為、実行ステージ、ライトバックステージにある命令も停止させていた。本発明では、実行ステージ、ライトバックステージにある命令は停止をさせないため性能が向上している。
Further, the
状態丸2は、インターロックのみがかかったパイプラインプロセッサの状態を示している。この場合、インターロックが起こっているためデコードステージを停止する必要がある。よって、命令フェッチレジスタ119は次サイクルでも現在格納されている命令を保持する。このとき、新たに取り込まれた命令がある場合は、別レジスタに保持しておく必要がある。新たに取り込まれた命令とは、例えば、後述する実施形態1のタイミングチャートである図9のサイクル4で取り込まれたINST4の命令をいう。図1に示した予備レジスタ121は、このような命令を格納しておくために設けられている。
A
実施形態1ではインターロック信号が1(アクティブ)になると共に命令フェッチ要求制御部105から出力される命令読み出し要求信号がディスエイブルになるため、これ以上の命令は取り込まれない。このため、実施形態1の予備レジスタ121は一つでよい。
以上述べた実施形態1のパイプラインプロセッサは、キャッシュミスヒットのみ発生(インターロック発生なし)の場合、命令フェッチレジスタ119を停止させることがない。このため、パイプライン処理は継続され、実行ステージ、ライトバックステージの処理が進む。これにより、実施形態1は、本来発生するハザードを防ぎ、インターロックによるパイプラインプロセッサの停止を回避することができる。
In the first embodiment, since the interlock signal becomes 1 (active) and the instruction read request signal output from the instruction fetch
The pipeline processor of the first embodiment described above does not stop the instruction fetch
また、実施形態1のパイプラインプロセッサは、キャッシュミスヒットとインターロックが同時に起こった場合、デコードステージだけを停止させて他の動作ステージを動作させる。このような処理により、実施形態1は、キャッシュミスヒットの発生によるペナルティ(処理停滞)とハザードによるペナルティとに同時に対処することができる。このような対処は、キャッシュミスヒットのペナルティにインターロックのペナルティを隠蔽できていると考えることができる。 Further, when a cache miss hit and an interlock occur simultaneously, the pipeline processor of the first embodiment stops only the decode stage and operates other operation stages. With such processing, the first embodiment can simultaneously deal with a penalty (processing stagnation) due to the occurrence of a cache miss hit and a penalty due to a hazard. It can be considered that such a countermeasure can conceal the interlock penalty from the penalty of cache miss hit.
また、本発明の実施形態1は、以上述べた構成に限定されるものではない。すなわち、実施形態1では、命令のキャッシュミスヒットとハザードによるインターロックとが同時に起こった場合についてのみ説明した。しかし、実施形態1におけるパイプラインプロセッサのキャッシュミスヒットとインターロックとが同時に起こった場合の動作は、キャッシュミスヒットの直前にインターロックが発生した場合にもキャッシュミスヒットのペナルティとインターロックのペナルティとに同時に対処し、パイプラインプロセッサの処理を効率化することができる。
(実施形態2)
次に、本発明の実施形態2を説明する。図7は、本発明の実施形態2におけるパイプラインプロセッサのブロック図である。なお、図7に示した構成のうち、実施形態1のパイプラインプロセッサで述べたのと同様の構成については同様の符号を付し、説明を一部略すものとする。
Further,
(Embodiment 2)
Next,
図7に示したパイプラインプロセッサは、図1に示したパイプラインプロセッサと同様に、命令を、フェッチステージ、デコードステージ、実行ステージ、ライトバックステージに区切って実行する。このため、実施形態2のパイプラインプロセッサも、命令フェッチレジスタ制御部709、命令デコード部111、実行部113、レジスタファイル115を備えている。
The pipeline processor shown in FIG. 7 executes instructions divided into a fetch stage, a decode stage, an execution stage, and a write-back stage in the same manner as the pipeline processor shown in FIG. Therefore, the pipeline processor of the second embodiment also includes an instruction fetch
また、図7に示したパイプラインプロセッサは、データハザード等を検出するための検出部107、命令フェッチ要求制御部105を備える。
実施形態2の命令フェッチレジスタ制御部709は、命令フェッチレジスタ119を備える点で実施形態1の命令フェッチレジスタ制御部と同様であるものの、さらに複数の命令格納手段である命令バッファ0、命令バッファ1…命令バッファNを備える点で実施形態1と相違する。実施形態2では、命令バッファ0、命令バッファ1…命令バッファNを命令バッファ群719と記す。
The pipeline processor shown in FIG. 7 includes a
The instruction fetch
通常動作時、このような実施形態2のパイプラインプロセッサは、実施形態1と同様に、命令フェッチレジスタ制御部709の制御によって命令フェッチレジスタ119が命令キャッシュ2からの命令を取り込む。フェッチされた命令は、命令デコード部111でデコードされた後、実行部113で実行(演算)され、ライトバックステージにおいてレジスタファイル115に結果を書き込む。
In the normal operation, in the pipeline processor of the second embodiment, the instruction fetch
ただし、実施形態2のパイプラインプロセッサは、検出部107によってハザードが検出され、インターロックがかかっている間も命令の取り込みを継続し、命令バッファ群719に含まれる命令バッファに取り込まれた命令を順次格納する。また、インターロックが解消された後、各々の命令バッファに格納されている命令をシフトさせながら命令フェッチレジスタ119に移し、処理を行う。
However, the pipeline processor of the second embodiment continues to fetch instructions while the hazard is detected by the
インターロックの間も、命令の取り出しを継続するために、実施形態1とは違い、実施形態2の命令フェッチ要求制御部105は、インターロックがアクティブ中においても、命令読み出し要求信号(図中ではPBUS_RD_ENと記す)をアクティブにし続ける。
次に、上記したパイプラインプロセッサの動作について説明する。実施形態2では、パイプラインプロセッサが実施形態1で示したプログラム2を実行するものとする。なお、実施形態2においても、実施形態2のパイプラインプロセッサの動作説明に先立って従来の構成の動作を示し、実施形態2と対比するものとする。
Unlike the first embodiment, in order to continue fetching instructions even during the interlock, the instruction fetch
Next, the operation of the above pipeline processor will be described. In the second embodiment, it is assumed that the pipeline processor executes the
図8及び図9、図10は、上記したプログラムを実行する場合のタイミングチャートであって、図8のタイミングチャートが従来のパイプラインプロセッサのものである。図9及び図10はそれぞれ実施形態1、実施形態2のパイプラインプロセッサで上記したプログラムを実行した場合のタイミングチャートである。
図8、図9、図10に示した例では、いずれもINST3がクロックサイクル4でハザードを発生し、INST2のライトバックステージが完了するまでインターロックがかかる。また、その後、INST8でキャッシュミスヒットが発生している。
8, 9, and 10 are timing charts when the above-described program is executed, and the timing chart of FIG. 8 is that of a conventional pipeline processor. FIGS. 9 and 10 are timing charts when the above-described program is executed by the pipeline processors of the first and second embodiments, respectively.
In the examples shown in FIG. 8, FIG. 9, and FIG. 10, INST3 generates a hazard at
図9は、先に説明した実施形態1を適用した状態を示したタイミングチャートである。この場合、図に示すように、ミスヒットの発生時に命令フェッチレジスタ119にNOPを格納させることによってパイプライン処理を継続して動作させている。このため、図8に示す従来の動作では、クロックサイクル14でINST8がINST6またはINST7の演算結果を用いる場合はインターロックが発生するが、実施形態1の図9ではパイプライン処理が継続して動作したため、クロックサイクル14ではINST6及びINST7のライトバックステージが完了しているため、インターロックが発生することがない。よって、従来のパイプラインプロセッサに比べ、実施形態1のパイプラインプロセッサは処理効率が高いといえる。
FIG. 9 is a timing chart showing a state in which the first embodiment described above is applied. In this case, as shown in the figure, the pipeline process is continuously operated by storing the NOP in the instruction fetch
図10は、実施形態2のパイプラインプロセッサで同じプログラム2を実行した場合のタイミングチャートである。実施形態2のパイプラインプロセッサは、図10に示したように、インターロックがかかった場合にも命令データの取り込みを継続する。すなわち、実施形態2のパイプラインプロセッサは、インターロックが発生すると、クロックサイクル4で命令バッファ0(図中B0と記す)へINST4の命令を取り込む。また、クロックサイクル5では命令バッファ1(図中B1と記す)へINST5の命令を取り込む。
FIG. 10 is a timing chart when the
インターロックの解除後、上記した処理で命令バッファに取り込まれている命令が取り込み順序にしたがって処理される。また、図10に示した例では、インターロックの解除後のクロックサイクル6において、命令バッファ0(図中B0と記す)内にあるINST4の命令が、命令フェッチレジスタ119に格納される。このとき、命令バッファ1内にあるINST5の命令を、命令バッファ0に移しておく。また、このとき、命令キャッシュ2から取り出されたINST6は、命令バッファ1に格納される。
After releasing the interlock, the instructions fetched into the instruction buffer by the above processing are processed according to the fetching order. In the example shown in FIG. 10, the instruction INST4 in the instruction buffer 0 (denoted as B0 in the figure) is stored in the instruction fetch
クロックサイクル7では、同様に、命令バッファ0内にあるINST5の命令が、命令フェッチレジスタ119に移される。また、命令バッファ1内にあるINST6の命令は、命令バッファ0に移される。命令キャッシュ2から取り出されたINST8は、命令バッファ1に格納される。
以上のように、各命令は、命令バッファ群719の各命令バッファに順次取り込まれ、命令フェッチレジスタ119に移された時点で各命令の実行が開始される。
Similarly, in
As described above, each instruction is sequentially fetched into each instruction buffer of the
実施形態1の状態を示した図9では、クロックサイクル10でINST8のキャッシュミスヒットが発生するが、実施形態2の状態を示した図10の場合には、上記で説明したようにインターロック中に命令の取り込みを継続したために、2サイクル早いクロックサイクル8でINST8のキャッシュミスヒットが発生する。つまり、実施形態2の図10の方が、2サイクル分処理が早く進んでいる、すなわち、パイプライン処理の処理効率が向上している。
In FIG. 9 showing the state of the first embodiment, a cache miss hit of INST8 occurs at
また、図9と図10は次のように対比する事もできる。キャッシュミスヒット中の3サイクルにおいて、図9は3つのNOPを取り込むのに対し、図10はあらかじめ命令バッファ0と命令バッファ1に命令が取り込まれている為にNOPの取り込みは1つでよい。すなわち、図10は、キャッシュミスヒットが1サイクルしか起こっていないかのようにパイプラインが動作している。よって、パイプライン処理の処理効率が向上している。
Moreover, FIG. 9 and FIG. 10 can also be compared as follows. In three cycles during a cache miss hit, FIG. 9 fetches three NOPs, whereas FIG. 10 fetches instructions into the
また、命令バッファ内に命令が存在する状態で、ブランチ命令、ジャンプ命令などの分岐命令がデコードされたとき、命令バッファ内にある命令は分岐しない場合の命令が取り込まれている為、そのまま実行するとプログラムが正しく動作しない。そのため、実施形態2のパイプラインプロセッサは、分岐命令がデコードされたときは、命令バッファに格納されている命令を廃棄するように動作する。なお、ここでいう命令の廃棄とは、命令バッファ内に命令が格納されていないのと同じ状態にすることを意味する。 Also, when a branch instruction such as a branch instruction or jump instruction is decoded in the state where the instruction exists in the instruction buffer, the instruction in the instruction buffer that does not branch is fetched. The program does not work properly. Therefore, the pipeline processor according to the second embodiment operates so as to discard the instruction stored in the instruction buffer when the branch instruction is decoded. Note that the discarding of an instruction here means that the instruction is in the same state as when no instruction is stored in the instruction buffer.
実施形態2のパイプラインプロセッサは、このような動作によってプログラムが破綻することを防ぐことができる。また、このような動作は、例外処理などによってプログラムが分岐する場合も同様に行われる。
図11は、実施形態2のパイプラインプロセッサが分岐命令をデコードした場合の動作を説明するためのタイミングチャートである。図11では、INST7の命令が分岐命令であり、クロックサイクル10でデコードされる。実施形態2では、分岐命令がデコードされたクロックサイクル10において、クロックサイクル11で命令バッファ0(図中B0と記す)、命令バッファ1(図中B1と記す)が無効になるように制御する。これによって命令バッファに格納されている分岐しない場合の命令を廃棄する。命令の廃棄により、クロックサイクル11では、分岐先の命令が命令フェッチレジスタ119に格納される。これらの動作を実現するために、分岐が発生するかどうかを示す制御信号が命令デコード部111から命令フェッチレジスタ制御部709へ出力される。
The pipeline processor of the second embodiment can prevent the program from failing due to such an operation. Further, such an operation is similarly performed when a program branches by exception processing or the like.
FIG. 11 is a timing chart for explaining the operation when the pipeline processor of the second embodiment decodes a branch instruction. In FIG. 11, the instruction of INST7 is a branch instruction and is decoded in
図12は、以上述べた実施形態2におけるキャッシュミスヒット信号(図中ではPBUS_WAITと記す)とインターロック信号(図中ではINTERLOCKと記す)および命令バッファ0の有効フラグ(図中ではB(0)_fと記す)に応じた命令フェッチレジスタ119の格納内容の遷移を示した表である。
表中の1がアクティブ、0がディスエイブルを意味し、Xは、Don’t Careを意味している。また、命令バッファ0の有効フラグB(0)_fは、命令バッファ0に命令が格納されていれば有効、格納されていなければ無効として示す。また、命令バッファ0に格納されている内容をB(0)として示す。表中に示した表中の丸付き数字はパイプラインプロセッサの状態に対して付されたものである。
FIG. 12 shows a cache miss signal (denoted as PBUS_WAIT in the figure), an interlock signal (denoted as INTERLOCK in the figure), and a valid flag (B (0) in the figure) of the
In the table, 1 means active, 0 means disable, and X means Don't Care. The valid flag B (0) _f of the
丸1及び丸2はキャッシュミスヒット、インターロックのいずれも発生していない状態を示す。この時、命令バッファ0が無効、すなわち、命令バッファ0に命令が取り込まれていない場合(丸1の場合)は、命令キャッシュ2からの命令を命令フェッチレジスタ119に格納する。命令バッファ0が有効、すなわち、命令バッファ0に命令が取り込まれている場合(丸2の場合)は、命令バッファ0に取り込まれている命令を命令フェッチレジスタ119に格納する(移動する)。
丸3はインターロックのみ発生している状態を示す。この時、デコードステージが停止する、すなわち、命令フェッチレジスタ119は格納している命令を次サイクルも保持する。
丸4及び丸5はキャッシュミスヒットのみ発生している状態を示す。この時、命令バッファ0が無効の場合(丸4の場合)は、命令フェッチレジスタ制御部709は命令フェッチレジスタ119にNOPを格納させる。命令バッファ0が有効の場合(丸5の場合)は、命令バッファ0に取り込まれている命令を命令フェッチレジスタ119に格納する(移動する)。
A
丸6はキャッシュミスヒット、インターロックの両方とも発生している状態を示す。インターロックが発生しているため、デコードステージが停止する。すなわち、命令フェッチレジスタ119は格納している命令を次サイクルも保持する。
図13は、上述した実施形態2における命令バッファ群719の各々の命令バッファに格納されている内容の遷移をまとめて示した表である。なお、各命令バッファは1ビットの有効フラグを持っていて、i番目命令バッファの有効フラグをB(i)_fとし、各命令バッファに格納されている内容をB(i)として表中に示す。ただし、i=0であるときのB(i−1)_fは、命令フェッチレジスタ119を意味し、常に有効である。また、ここでいう有効フラグの有効とは、命令バッファに命令があることを示し、無効とは、命令がないことを示す。
A
FIG. 13 is a table collectively showing the transition of the contents stored in each instruction buffer of the
図13に示すように、i番目命令バッファの有効フラグB(i)_fと格納内容B(i)の遷移は、分岐の発生を示す信号、キャッシュミスヒット信号(図中ではPBUS_WAITと記す)、インターロック信号(図中ではINTERLOCKと記す)、B(i)_f、B(i+1)_f、B(i―1)_fによって決まる。
図12に示したように命令フェッチレジスタ119を制御し、図13に示したように命令バッファ群719の各々の命令バッファを制御することにより、実施形態2のパイプラインプロセッサは、図10および図11に示したタイミングチャートのように動作でき、プログラムの分岐が存在する場合でも破綻することなく動作し、処理効率の高いパイプライン処理を実現できる。
As shown in FIG. 13, the transition of the valid flag B (i) _f and stored content B (i) of the i-th instruction buffer is a signal indicating the occurrence of a branch, a cache miss signal (denoted as PBUS_WAIT in the figure), It is determined by an interlock signal (indicated as INTERLOCK in the figure), B (i) _f, B (i + 1) _f, and B (i−1) _f.
By controlling the instruction fetch
以上述べた本実施形態の実施形態2は、フェッチされた命令を格納できる命令バッファを複数備えている。そして、デコードステージでインターロックが発生した場合にはフェッチステージで命令をフェッチしては命令バッファに順次格納するので、インターロックの発生時に命令バッファに命令を取り込んでおくことができる。
また、インターロックの解除後は、命令バッファに格納された命令を順次命令フェッチレジスタにシフトしてデコードする。同時にフェッチされた命令を空いた命令バッファに取り込んでおく。そして、キャッシュミスヒットの発生時にはNOP信号の供給等の対処に優先して命令バッファに格納されている命令を使って動作ステージの停止を防ぐことができる。
The second embodiment of the present embodiment described above includes a plurality of instruction buffers that can store fetched instructions. When an interlock occurs at the decode stage, the instruction is fetched at the fetch stage and sequentially stored in the instruction buffer. Therefore, the instruction can be fetched into the instruction buffer when the interlock occurs.
Further, after the interlock is released, the instructions stored in the instruction buffer are sequentially shifted to the instruction fetch register and decoded. At the same time, fetched instructions are taken into an empty instruction buffer. When a cache miss hit occurs, it is possible to prevent the operation stage from being stopped using an instruction stored in the instruction buffer in preference to dealing with supply of a NOP signal or the like.
このような実施形態2のパイプラインプロセッサは、実施形態1よりもNOP信号の供給等の実行回数が少なくてすみ、パイプラインプロセッサの処理をより効率化することができる。 Such a pipeline processor of the second embodiment requires less number of executions such as supply of the NOP signal than the first embodiment, and the processing of the pipeline processor can be made more efficient.
1 外部メモリ、2 命令キャッシュ、3 パイプラインプロセッサ、101 プログラムカウンタ、103 分岐アドレス計算部、105 命令フェッチ要求制御部、107 検出部、109,709 命令フェッチレジスタ制御部、111 命令デコード部、113 実行部、115 レジスタファイル、119 命令フェッチレジスタ、121 予備レジスタ、719 命令バッファ群 1 external memory, 2 instruction cache, 3 pipeline processor, 101 program counter, 103 branch address calculation unit, 105 instruction fetch request control unit, 107 detection unit, 109,709 instruction fetch register control unit, 111 instruction decode unit, 113 execution , 115 register file, 119 instruction fetch register, 121 spare register, 719 instruction buffer group
Claims (7)
前記動作工程のうちの命令を取り込む取込動作工程において命令を取り込む命令取込手段と、
前記取込動作工程において、前記命令取込手段が命令を取り込むことができないミスヒットを検出するミスヒット検出手段と、
前記ミスヒット検出手段によってミスヒットが検出された場合にも前記命令取込手段を継続して動作させる動作継続手段と、
を備えることを特徴とするパイプラインプロセッサ。 A pipeline processor that divides a plurality of instructions into multi-stage operation processes and executes the instructions.
Instruction fetching means for fetching instructions in the fetching action process for fetching instructions in the operation process;
In the fetch operation step, a miss detection means for detecting a miss that the instruction fetch means cannot fetch an instruction;
An operation continuation means for continuously operating the instruction fetch means even when a miss hit is detected by the miss hit detection means;
A pipeline processor comprising:
前記ミスヒット検出手段によってミスヒットが検出された場合、前記命令取込手段に対して命令を取り込まないよう指示することによって前記命令取込手段を動作させることを特徴とする請求項1に記載のパイプラインプロセッサ。 The operation continuation means includes
2. The instruction fetching unit according to claim 1, wherein when a miss hit is detected by the miss hit detection unit, the command fetching unit is operated by instructing the command fetching unit not to fetch a command. Pipeline processor.
前記動作継続手段は、前記ミスヒット検出手段がミスヒットを検出し、かつ前記ハザード検出手段がハザードを検出していない場合に前記命令取込手段に対してNOP信号を供給することを特徴とする請求項3に記載のパイプラインプロセッサ。 Further comprising a hazard detection means for detecting a hazard occurring between the operation steps;
The operation continuation means supplies a NOP signal to the instruction fetch means when the miss hit detection means detects a miss and the hazard detection means does not detect a hazard. The pipeline processor according to claim 3.
前記取込動作工程において命令を取り込む命令取込手段と、
前記命令取込手段によって取り込まれた命令を、前記デコード動作工程においてデコードする命令デコード手段と、
前記命令取込手段が命令を取り込むことができないミスヒットを検出するミスヒット検出手段と、
前記デコード動作工程におけるハザードの発生によりインターロックがかかったことを検出するインターロック検出手段と、
前記ミスヒット検出手段によってミスヒットが発生したことが検出され、かつ、前記インターロック検出手段によってインターロックがかかったことが検出された場合、前記デコード手段の動作をインターロックが解消するまで停止させながら、前記デコード動作工程以外の動作工程の少なくとも一部を継続して動作させる他動作継続手段と、
を備えることを特徴とするパイプラインプロセッサ。 A pipeline processor that divides and executes a plurality of instructions into a multi-stage operation process including a fetch operation process for fetching an instruction and a decode operation process for decoding the fetched instruction,
Command fetching means for fetching commands in the fetching operation step;
Instruction decoding means for decoding the instruction fetched by the instruction fetching means in the decoding operation step;
A miss detection means for detecting a miss that the instruction fetch means cannot fetch an instruction;
Interlock detecting means for detecting that an interlock has been applied due to the occurrence of a hazard in the decoding operation step;
When it is detected by the miss-hit detecting means that a mis-hit has occurred and the interlock detecting means detects that an interlock has been applied, the operation of the decoding means is stopped until the interlock is released. However, other operation continuation means for continuously operating at least a part of the operation steps other than the decoding operation step,
A pipeline processor comprising:
前記動作工程のうちの命令を取り込む取込動作工程において、命令を取り込む命令取込手段と、
前記命令取込手段によって取り込まれた命令を格納する複数の命令格納手段と、
前記命令格納手段に格納された命令を取り出してデコードする命令デコード手段と、を備え、
前記ハザード検出手段によってハザードが検出され、インターロックがかかっている間は、前記命令格納手段の各々が前記命令取込手段によって取り込まれた命令を順次格納し、インターロックが解消後は、前記命令デコード手段が、前記命令格納手段の各々に格納されている命令を順次デコードすることを特徴とするパイプラインプロセッサ。 A pipeline processor that divides a plurality of instructions into multi-stage operation processes and executes the instructions.
Instruction fetching means for fetching instructions in the fetching action process for fetching instructions in the operation process;
A plurality of instruction storage means for storing instructions fetched by the instruction fetching means;
Instruction decode means for taking out and decoding the instruction stored in the instruction storage means,
While the hazard is detected by the hazard detection means and the interlock is applied, each of the instruction storage means sequentially stores the instructions fetched by the instruction fetch means, and after the interlock is released, the instruction A pipeline processor, wherein the decoding means sequentially decodes instructions stored in each of the instruction storage means.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004313400A JP2006127080A (en) | 2004-10-28 | 2004-10-28 | Pipeline processor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004313400A JP2006127080A (en) | 2004-10-28 | 2004-10-28 | Pipeline processor |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2006127080A true JP2006127080A (en) | 2006-05-18 |
Family
ID=36721797
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2004313400A Withdrawn JP2006127080A (en) | 2004-10-28 | 2004-10-28 | Pipeline processor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2006127080A (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001034474A (en) * | 1999-07-16 | 2001-02-09 | Nec Corp | Data processor and data processing method |
JP2002007119A (en) * | 2000-06-27 | 2002-01-11 | Sony Corp | Exception processing system and method for the same and processor |
-
2004
- 2004-10-28 JP JP2004313400A patent/JP2006127080A/en not_active Withdrawn
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001034474A (en) * | 1999-07-16 | 2001-02-09 | Nec Corp | Data processor and data processing method |
JP2002007119A (en) * | 2000-06-27 | 2002-01-11 | Sony Corp | Exception processing system and method for the same and processor |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5889986B2 (en) | System and method for selectively committing the results of executed instructions | |
JP4837305B2 (en) | Microprocessor and control method of microprocessor | |
US9740553B2 (en) | Managing potentially invalid results during runahead | |
JP2009053861A (en) | Program execution control device | |
JP2007026452A (en) | Method and system for enhanced microprocessor | |
US20120173848A1 (en) | Pipeline flush for processor that may execute instructions out of order | |
US7877578B2 (en) | Processing apparatus for storing branch history information in predecode instruction cache | |
JP4243271B2 (en) | Data processing apparatus and data processing method | |
JP2000322257A (en) | Speculative execution control method for conditional branch instruction | |
JP3683248B2 (en) | Information processing apparatus and information processing method | |
JP2008165589A (en) | Information processor | |
US20040225866A1 (en) | Branch prediction in a data processing system | |
JP2009169767A (en) | Pipeline type processor | |
US20080065870A1 (en) | Information processing apparatus | |
JP2001060152A (en) | Information processor and information processing method capable of suppressing branch prediction | |
US6851044B1 (en) | System and method for eliminating write backs with buffer for exception processing | |
JP2006127080A (en) | Pipeline processor | |
US20080222392A1 (en) | Method and arrangements for pipeline processing of instructions | |
JP2010015298A (en) | Information processor and instruction fetch control method | |
US20220308888A1 (en) | Method for reducing lost cycles after branch misprediction in a multi-thread microprocessor | |
US20220308887A1 (en) | Mitigation of branch misprediction penalty in a hardware multi-thread microprocessor | |
KR102639414B1 (en) | Multi-threading processor and operating method thereof | |
KR970011209B1 (en) | Microprocessor including circuit for generating signal used for tracing executed instruction stream | |
US7343481B2 (en) | Branch prediction in a data processing system utilizing a cache of previous static predictions | |
JPH09190348A (en) | Instruction prefetch buffer control method and device therefor and instruction prefetch buffer flush method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20070403 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20071023 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20100218 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20101124 |
|
A761 | Written withdrawal of application |
Free format text: JAPANESE INTERMEDIATE CODE: A761 Effective date: 20110119 |