JP2503223B2 - Prior control method - Google Patents

Prior control method

Info

Publication number
JP2503223B2
JP2503223B2 JP6654587A JP6654587A JP2503223B2 JP 2503223 B2 JP2503223 B2 JP 2503223B2 JP 6654587 A JP6654587 A JP 6654587A JP 6654587 A JP6654587 A JP 6654587A JP 2503223 B2 JP2503223 B2 JP 2503223B2
Authority
JP
Japan
Prior art keywords
instruction
condition code
branch
address
stage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP6654587A
Other languages
Japanese (ja)
Other versions
JPS63231627A (en
Inventor
下文郎 松野
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu 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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP6654587A priority Critical patent/JP2503223B2/en
Publication of JPS63231627A publication Critical patent/JPS63231627A/en
Application granted granted Critical
Publication of JP2503223B2 publication Critical patent/JP2503223B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔概要〕 アドレス計算が不要なレジスタ間演算命令などを実行
する場合、その結果のコンディションコードの値を予測
で算出し、そのコンディションコードを使用して処理を
決定する後続の命令は、その予測値を使用して早期に処
理の決定を行なうことにより、待ち時間を減らし、処理
の高速化を図ったものである。
DETAILED DESCRIPTION [Outline] When an inter-register operation instruction that does not require address calculation is executed, the value of the resulting condition code is calculated by prediction, and the processing is determined using the condition code. The instruction is intended to reduce the waiting time and speed up the processing by making an early decision on the processing using the predicted value.

〔産業上の利用分野〕[Industrial applications]

本発明は、パイプライン方式の処理装置に関するもの
であり、特に後続命令が先行命令のコンディションコー
ドを使用して実行すべき処理を決定する場合の先行制御
方式に関する。
The present invention relates to a pipeline type processing device, and more particularly to a preceding control method in a case where a subsequent instruction uses a condition code of a preceding instruction to determine a process to be executed.

〔従来の技術〕[Conventional technology]

一般に処理装置で実行される命令には、主記憶装置を
アクセスするためにアドレス計算を必要とするものと、
レジスタ間演算命令のようにオペランドのアドレス計算
を必要としないものとがある。
Generally, an instruction executed by a processor requires an address calculation to access the main memory,
There are some which do not require address calculation of operands, such as inter-register arithmetic instructions.

また加算(AR)、減算(SR)、比較(CR)などの演算
命令では、演算結果が負になったり、オーバーフローし
たりするなどの例外状態を生じる場合があり、それぞれ
に定められた例外処理が行われる。
In addition, in addition (AR), subtraction (SR), comparison (CR), and other operation instructions, exception conditions such as a negative operation result or overflow may occur. Is done.

このため、これらの演算命令は、その実行終了時に演
算結果にしたがった値のコンディションコードを設定
し、後続する命令、たとえば分岐(BR)命令は、そのコ
ンディションコードの値を判定して、対応する処理を切
り分けるようになっている。
Therefore, these operation instructions set a condition code of a value according to the operation result at the end of their execution, and subsequent instructions, for example, a branch (BR) instruction, determine the value of the condition code and respond. It is designed to separate processing.

ところでこのような演算命令と分岐命令とが連続して
いる場合、後続の分岐命令は、先行の演算命令が実行終
了した後でなければ、コンディションコードを参照する
ことができないため、必ず待たされることになる。
By the way, when such an arithmetic instruction and a branch instruction are consecutive, the subsequent branch instruction must refer to the condition code only after the execution of the preceding arithmetic instruction is completed, so that the instruction must be kept waiting. become.

第4図に示すパイプラインのフロー図を用いて、従来
の方式を説明する。
The conventional method will be described with reference to the flow chart of the pipeline shown in FIG.

第4図において、横軸は、パイプラインの実行サイク
ルを示しており、ないしは順次のサイクルを参照可
能にするため、便宜上番号付けしたものである。
In FIG. 4, the horizontal axis indicates the execution cycle of the pipeline, or is numbered for the sake of convenience so that sequential cycles can be referred to.

図示の例は、加算命令ARに続いて分岐命令BRが実行さ
せ、さらに後続命令あるいは分岐先命令が実行される場
合のものである。
The illustrated example is a case where a branch instruction BR is executed following the addition instruction AR, and a subsequent instruction or a branch destination instruction is executed.

各命令は、パイプラインに投入されると、サイクル
(τ)ごとに、D、A、T、B、E、Wの各ステージを
順次流れてゆく。ここでDは命令のデコード、Aはアド
レス計算、Tはバッファメモリのタグチェック、Bはバ
ッファ読み出し、Eは実行、Wは結果の書き込みを表わ
している。
When each instruction is input to the pipeline, it sequentially flows through each stage of D, A, T, B, E, and W every cycle (τ). Here, D represents instruction decoding, A represents address calculation, T represents buffer memory tag check, B represents buffer reading, E represents execution, and W represents result writing.

加算命令ARは、サイクルにパイプラインへ投入さ
れ、サイクルのEステージで加算演算を実行して、そ
の結果により、サイクルのWステージでコンディショ
ンコード(CCで表わす)に値を設定する。
The add instruction AR is input to the pipeline in the cycle, executes the add operation in the E stage of the cycle, and sets the value in the condition code (denoted by CC) in the W stage of the cycle according to the result.

分岐命令BRは、加算命令ARよりも1τ後のサイクル
にパイプラインへ投入される。
The branch instruction BR is input to the pipeline in a cycle 1τ after the addition instruction AR.

分岐命令BRは、サイクルのAステージで分岐先命令
のアドレス計算を行ない、サイクルのBステージでバ
ッファから分岐先命令を読み出して、Eステージの最初
で命令を先取り(プリフェッチ)する。以後この命令を
先取り命令と呼ぶ。続いてサイクルのEステージで、
加算命令ARが設定したCCの値を参照し、条件判定を行な
って、次に実行する命令を分岐命令BRの後続命令でよい
か、あるいは分岐先の先取り命令に変更するかどうかを
決定する。
The branch instruction BR calculates the address of the branch destination instruction at the A stage of the cycle, reads the branch destination instruction from the buffer at the B stage of the cycle, and prefetches (prefetches) the instruction at the beginning of the E stage. Hereinafter, this instruction is called a prefetch instruction. Then at the E stage of the cycle,
By referring to the value of CC set by the addition instruction AR, condition determination is performed, and it is determined whether the instruction to be executed next may be the instruction subsequent to the branch instruction BR or is changed to the prefetch instruction of the branch destination.

もしも分岐が成功した場合には、先取り命令は、分岐
命令BRの投入から4τ遅れたサイクルに、パイプライ
ンへ投入される。
If the branch is successful, the prefetch instruction is input to the pipeline in a cycle delayed by 4τ from the input of the branch instruction BR.

他方、分岐が成功しない場合については、予め分岐が
成功しない場合を考えて分岐命令BRの後続命令を順次パ
イプラインへ投入しておく方法がとられているので(サ
イクルないしで後続命令がパイプラインへ投入され
ている)、特別な遅れは生じない。なお分岐が成功した
場合、予めパイプラインへ投入されていたこれらの後続
命令は無効化されるので不都合は生じない。
On the other hand, in the case where the branch is not successful, a method is adopted in which the subsequent instructions of the branch instruction BR are sequentially input to the pipeline in consideration of the case where the branch is not successful (cycle or subsequent instruction is pipelined. Input), no special delay will occur. If the branch is successful, these subsequent instructions that have been input to the pipeline in advance are invalidated and no inconvenience occurs.

〔発明が解決しようとする問題点〕[Problems to be solved by the invention]

従来のパイプライン方式の処理装置では、コンディシ
ョンコードの設定処理を含む演算命令等と、そのコンデ
ィションコードを使用して条件を判定し、処理を切り分
ける分岐命令等との組みを実行するたびに待ち時間が生
じ、これらの命令の出現頻度が多い程、処理装置の処理
速度は低下するという問題があった。
In a conventional pipeline type processing device, a waiting time is executed each time a combination of an operation instruction including a condition code setting process and a branch instruction that determines a condition by using the condition code and divides the process is executed. However, there is a problem that the processing speed of the processing device decreases as the frequency of appearance of these instructions increases.

〔問題点を解決するための手段〕[Means for solving problems]

レジスタ間演算命令などのオペランドのアドレスを計
算する必要がない命令ではアドレス計算回路が空いてい
ることに着目して、これを用いてコンディションコード
の予測値を算出し、これをコンディションコードを使用
する後続の命令に渡すことにより、後続命令の待ち時間
を短縮するものである。
Paying attention to the fact that the address calculation circuit is empty for instructions that do not need to calculate the address of the operand, such as register-to-register operation instructions, use this to calculate the predicted value of the condition code and use it for the condition code. By passing the instruction to the subsequent instruction, the waiting time of the subsequent instruction is shortened.

第1図により、本発明の原理を説明する。 The principle of the present invention will be described with reference to FIG.

第1図は、本発明による処理装置のパイプラインの概
念的なフローである。図中、はコンディションコード
CCを設定する処理を伴う先行命令の例の加算命令ARのフ
ロー、はコンディションコードCCを使用して次の処理
を決定する後続命令の例として分岐命令BRのフロー、
は後続命令が決定した処理を実行する分岐先の先取り
命令のフローである。
FIG. 1 is a conceptual flow of a pipeline of a processing device according to the present invention. In the figure, is the condition code
The flow of the add instruction AR in the example of the preceding instruction accompanied by the process of setting CC, is the flow of the branch instruction BR as an example of the subsequent instruction that determines the next process using the condition code CC,
Is the flow of the prefetch instruction at the branch destination that executes the processing determined by the subsequent instruction.

また各命令フローにおいて、D、A、T、B、E、W
はパイプラインの順次のステージを表わしている。
In each instruction flow, D, A, T, B, E, W
Represents the sequential stages of the pipeline.

同様に各命令フローにおいて共通に、10は命令バッフ
ァ、11は命令レジスタ、12はアドレス計算回路、13はバ
ッファメモリ、14は演算ユニット、15は第1コンディシ
ョンコードラッチCC−1、16は第2コンディションコー
ドラッチCC−2、17は条件比較回路を表わしている。な
お便宜上、各命令フロー中には、それぞれ必要とされる
ハードウェア要素のみが示されている。
Similarly, commonly in each instruction flow, 10 is an instruction buffer, 11 is an instruction register, 12 is an address calculation circuit, 13 is a buffer memory, 14 is an arithmetic unit, 15 is a first condition code latch CC-1, 16 is a second. The condition code latches CC-2 and CC17 represent a condition comparison circuit. For the sake of convenience, only the hardware elements required for each are shown in each instruction flow.

命令バッファ10は、パイプラインへ投入するための先
取りされた命令を一時的に保持しておくもので、複数段
で構成される。
The instruction buffer 10 temporarily holds a prefetched instruction to be input to the pipeline, and has a plurality of stages.

命令レジスタ11は、Dステージでパイプラインに投入
された命令を保持し、命令のOPコードやアドレス情報等
の取り出しに使用される。
The instruction register 11 holds the instruction input to the pipeline at the D stage and is used to fetch the OP code and address information of the instruction.

アドレス計算回路12は、通常は命令のアドレス情報に
基づいて、オペランドや命令フェッチ用の実効アドレス
の計算をAステージで行なう。しかし本発明において
は、特に加算命令AR等のレジスタ間演算命令のように、
オペランドの実効アドレス計算が不要であってかつコン
ディションコードCCの設定を伴う加算命令ARの場合、コ
ンディションコードCCの予測演算にも使用される。後者
の場合は、汎用レジスタが入力源として使用される。
The address calculation circuit 12 normally calculates an operand or an effective address for instruction fetch at the A stage based on the address information of the instruction. However, in the present invention, in particular, like an inter-register operation instruction such as an addition instruction AR,
In the case of the addition instruction AR which does not require the calculation of the effective address of the operand and involves setting the condition code CC, it is also used for the prediction operation of the condition code CC. In the latter case, a general purpose register is used as the input source.

バッファメモリ13は、主記憶装置(図示せず)に対す
るアクセス時間を短縮するため、データの一時蓄積用に
中間に設けられており、T、Bステージでオペランドや
命令を取り出すために使用される。
The buffer memory 13 is provided in the middle for temporary storage of data in order to shorten the access time to the main storage device (not shown), and is used for fetching operands and instructions at the T and B stages.

演算ユニット14は、命令により定められる算術演算や
論理演算をEステージで実効する。
The arithmetic unit 14 executes the arithmetic operation and the logical operation determined by the instruction at the E stage.

第1コンディションコードラッチ15(CC−1)には、
演算ユニット14の演算結果に基づいて生成されたコンデ
ィションコードCCの値が、Wステージで設定される。
In the first condition code latch 15 (CC-1),
The value of the condition code CC generated based on the calculation result of the calculation unit 14 is set in the W stage.

第2コンディションコードラッチ16(CC−2)は本発
明に固有のものであり、アドレス計算回路12が図のの
AステージでコンディションコードCCの予測演算を行な
ったときに得られた予測値が、Tステージで設定され
る。
The second condition code latch 16 (CC-2) is unique to the present invention, and the predicted value obtained when the address calculation circuit 12 performs the predictive calculation of the condition code CC at the A stage in the figure is: It is set at the T stage.

条件比較回路17は本発明に固有のものであり、コンデ
ィションコードCCを使用する分岐命令BRに指定されてい
るCC値と、第2コンディションコードラッチ16(CC−
2)に設定された予測CC値とを図ののAステージで比
較し、その結果により、分岐先命令の先取りを実行する
かどうかを決定する。
The condition comparison circuit 17 is unique to the present invention, and the CC value specified in the branch instruction BR that uses the condition code CC and the second condition code latch 16 (CC-
The predicted CC value set in 2) is compared at the A stage in the figure, and it is determined whether the prefetch of the branch destination instruction is executed or not according to the result.

図のにおいて、条件比較回路17が2つのCC値の一致
を検出したときには、条件成立すなわち分岐成功とし、
アドレス計算回路12がAステージで計算した先取り命令
の実効アドレスにより、TおよびBステージにおいてバ
ッファメモリ13をアクセスさせる。
In the figure, when the condition comparison circuit 17 detects that two CC values match, the condition is satisfied, that is, the branch is successful,
The address calculation circuit 12 causes the buffer memory 13 to be accessed in the T and B stages by the effective address of the prefetch instruction calculated in the A stage.

バッファメモリ13から読み出された先取り命令は、
のEステージの始めに、図のに示すように命令バッフ
ァ10に格納され、続いてパイプラインに投入される。
The prefetch instruction read from the buffer memory 13 is
At the beginning of the E stage, the data is stored in the instruction buffer 10 as shown in the figure, and is subsequently input to the pipeline.

〔作用〕[Action]

本発明の作用を、第1図と、第2図に示すパイプライ
ンのフロー図とを用いて説明する。第2図は、第4図に
示した従来方式のフロー図に対応するものであり、図中
の記号、番号および適用されている命令等の具体例は共
通であるので、重複する説明は省略する。
The operation of the present invention will be described with reference to FIG. 1 and the flow chart of the pipeline shown in FIG. FIG. 2 corresponds to the flow chart of the conventional method shown in FIG. 4, and since concrete examples of symbols, numbers and applied instructions in the figure are common, duplicate explanations are omitted. To do.

第2図において、加算命令ARのフローでは、第1図の
第2コンディションコードラッチ16(CC−2)で説明し
たように、Aステージでアドレス計算回路12を用いての
コンディションコードの予測演算を行ない、その結果の
値を、Tステージで第2コンディションコードラッチ16
(CC−2)に設定し、次の分岐命令BRにより参照可能に
する。なお、Eステージで演算ユニット14が実際に行な
った演算の結果に基づき生成されたコンディションコー
ドCCが、Wステージで第1コンディションコードラッチ
15(CC−1)に設定されるが、ここでは使用されない。
As shown in the second condition code latch 16 (CC-2) of FIG. 1, in the flow of the add instruction AR in FIG. 2, the prediction operation of the condition code using the address calculation circuit 12 at the A stage is performed. Then, the resulting value is set in the second condition code latch 16 at the T stage.
Set to (CC-2) so that it can be referenced by the next branch instruction BR. The condition code CC generated based on the result of the operation actually performed by the operation unit 14 at the E stage is the first condition code latch at the W stage.
Set to 15 (CC-1), but not used here.

分岐命令BRのフローでは、Aステージにおいて、アド
レス計算回路12が分岐先の先取り命令の実効アドレスを
計算するとともに、条件比較回路17で第2コンディショ
ンコードラッチ16(CC−2)の予測値CCをチェックす
る。その結果が分岐成功であれば、TステージおよびB
ステージでバッファメモリ13をアクセスし、分岐先の先
取り命令を読み出し、その先取り命令をEステージの始
めに、命令バッファ10に格納する。
In the flow of the branch instruction BR, at the A stage, the address calculation circuit 12 calculates the effective address of the prefetch instruction of the branch destination, and the condition comparison circuit 17 calculates the predicted value CC of the second condition code latch 16 (CC-2). To check. If the result is a successful branch, T stage and B
The buffer memory 13 is accessed at the stage, the prefetch instruction at the branch destination is read, and the prefetch instruction is stored in the instruction buffer 10 at the beginning of the E stage.

すなわち、分岐命令BRのEステージでは、加算命令AR
が同じサイクルのWステージで第1コンディションコ
ードラッチ15(CC−1)に設定する実際のCCを参照して
条件判定を行なう必要がなく、そのサイクル中に直ち
に分岐先の先取り命令を命令バッファ10からパイプライ
ンへ投入することができる。
That is, in the E stage of the branch instruction BR, the add instruction AR
Does not need to refer to the actual CC set in the first condition code latch 15 (CC-1) in the W stage of the same cycle to make a condition determination, and immediately outputs the branch destination prefetch instruction to the instruction buffer 10 during the cycle. Can be put into the pipeline.

このため、第4図の従来方式の場合にくらべて、待ち
時間が1サイクル(τ)分短縮され、分岐命令BRからの
遅れは3τとなる。
Therefore, the waiting time is shortened by one cycle (τ) as compared with the case of the conventional method shown in FIG. 4, and the delay from the branch instruction BR is 3τ.

アドレス計算回路12で行なうコンディションコードの
予測演算は、演算ユニット14が行なう実際の演算の結果
の数値は必要でなく,たとえば加算命令の場合には,演
算結果が0,正,負,桁上げのいずれの状態であるかだけ
知ることができればよい。しかしこの場合,アドレス計
算回路の加算器しか使用できないため,予測演算の内容
は加減算や比較などの簡単なものに限られる。けれども
演算自体は演算ユニット14が行うものと同じで簡略化さ
れることはなく,演算結果のうちで利用するものが限ら
れているだけである。加算命令の場合,予測演算により
得られた結果が0、正、負、桁上げのいずれであるかに
より、コンディションコードCCの予測値としてそれぞれ
0、1、2、3が設定される。
The condition code prediction calculation performed by the address calculation circuit 12 does not require the numerical value of the result of the actual calculation performed by the calculation unit 14. For example, in the case of an addition instruction, the calculation result is 0, positive, negative, or carry. It suffices to know only in which state it is. However, in this case, since only the adder of the address calculation circuit can be used, the content of the prediction calculation is limited to simple ones such as addition and subtraction and comparison. However, the operation itself is the same as the operation performed by the operation unit 14 and is not simplified, and only the operation results are used. In the case of the addition instruction, 0, 1, 2, and 3 are set as the predicted values of the condition code CC depending on whether the result obtained by the prediction calculation is 0, positive, negative, or carry.

〔実施例〕〔Example〕

第3図は、本発明による処理装置のパイプラインの1
実施例構成図である。
FIG. 3 shows one of the pipelines of the processing apparatus according to the present invention.
It is a block diagram of an Example.

第3図において、10ないし17で示されるブロック要素
は第1図に示されているものと同じである。第3図にお
いて細部構成を示すために新たに付加されているブロッ
ク要素は18ないし28で示されている。以下に図中のブロ
ック要素のリストを示す。
In FIG. 3, the block elements designated 10 to 17 are the same as those shown in FIG. In FIG. 3, the block elements newly added to show the detailed structure are indicated by 18 to 28. Below is a list of block elements in the figure.

10:命令バッファであり、実行待ちの命令を一時的に保
持する。
10: Instruction buffer, which temporarily holds instructions waiting to be executed.

11:命令レジスタであり、実行のため投入された命令を
保持する。
11: An instruction register, which holds an instruction input for execution.

12:アドレス計算回路であり、オペランドや先取り命令
の実行アドレスを算出する。コンディションコードCCの
予測値算出にも使用される。
12: An address calculation circuit that calculates the execution address of the operand or prefetch instruction. It is also used to calculate the predicted value of the condition code CC.

13:バッファメモリである。13: Buffer memory.

14:演算ユニットである。14: An arithmetic unit.

15:第1コンディションコードラッチ(CC−1)であ
り、演算ユニット14によりコンディションコードCCを設
定される。
15: The first condition code latch (CC-1), and the operation unit 14 sets the condition code CC.

16:第2コンディションコードラッチ(CC−2)であ
り、アドレス計算回路がCCの予測値を算出して設定す
る。
16: Second condition code latch (CC-2), which the address calculation circuit calculates and sets the predicted value of CC.

17:条件比較回路であり、命令中の指定CC値とCC−2の
予測CC値とを比較し、分岐の成功/不成功を判定する。
17: A condition comparison circuit, which compares the designated CC value in the instruction with the predicted CC value of CC-2 to judge the success / failure of the branch.

18:汎用のレジスタ群であり、コンディションコードの
予測演算を行なうときにアドレス計算回路12への入力デ
ータ源となる。
18: A general-purpose register group, which serves as an input data source to the address calculation circuit 12 when performing a prediction operation of a condition code.

19〜21:アドレスレジスタであり、アドレス計算回路12
の入力レジスタを構成する。
19 to 21: Address registers, address calculation circuit 12
Configure the input register of.

22:加算器であり、アドレスレジスタ19〜21の値を加算
する。
22: An adder that adds the values of the address registers 19 to 21.

23:実効アドレスレジスタ(EAR)であり、アドレス計算
回路12が算出した実効アドレスが格納される。
23: An effective address register (EAR), which stores the effective address calculated by the address calculation circuit 12.

24:使用中レジスタ番号ラッチであり、パイプラインを
先行している命令が使用しているレジスタの番号を保持
する。
24: A register number latch in use, which holds the number of the register used by the instruction preceding the pipeline.

25:レジスタ比較回路であり、命令間での使用レジスタ
の番号を比較し、干渉を検出する。
25: A register comparison circuit that compares the numbers of registers used between instructions to detect interference.

26:レジスタ干渉ラッチであり、レジスタ比較回路25が
命令間でのレジスタ番号の一致を検出したとき、レジス
タ干渉の存在を示すためONに設定される。
26: Register interference latch, which is set to ON to indicate the presence of register interference when the register comparison circuit 25 detects a match in register number between instructions.

27:命令制御回路であり、命令のOPコードから、命令取
り出し要求iFCHを出すかどうかを決定する。
27: An instruction control circuit that determines whether to issue the instruction fetch request iFCH from the OP code of the instruction.

28:主記憶装置である。28: Main memory.

次に本実施例の動作を説明する。 Next, the operation of this embodiment will be described.

命令バッファ10から加算命令ARが命令レジスタ11に入
ると、そのOPコードがデコードされて、命令制御回路27
に入る。
When the add instruction AR from the instruction buffer 10 enters the instruction register 11, the OP code is decoded and the instruction control circuit 27
to go into.

命令制御回路27は,OPコードのデコード結果からこの
命令がアドレス計算の必要のある命令かどうかを判断す
る。そしてアドレス計算の必要がある命令の場合には,
アドレス計算を行っているステージAのサイクルでメモ
リに対してオペランドまたは命令の取り出し要求を発行
するが,アドレス計算の必要のない命令の場合には,こ
の要求を発行しない。そのためアドレス計算の必要のな
い命令の場合は制御にゆとりが生じるので,これを利用
して加算器22に汎用レジスタの内容を入力し,加減算や
比較などの簡単な演算を行わせる。この場合加算命令AR
は,レジスタ間の加算命令なので、オペランドのアドレ
ス計算を行なう必要がないと判断して、加算命令ARで指
示されたレジスタの内容を、汎用レジスタ群18から読み
出して、アドレスレジスタ19、20に入力する。
The instruction control circuit 27 determines from the decoding result of the OP code whether or not this instruction needs an address calculation. And in the case of instructions that need address calculation,
An operand or instruction fetch request is issued to the memory in the cycle of the stage A where address calculation is performed, but this request is not issued for an instruction that does not require address calculation. Therefore, in the case of an instruction that does not require address calculation, there is a margin of control, and this is used to input the contents of the general-purpose register to the adder 22 to perform simple operations such as addition and subtraction and comparison. In this case, add instruction AR
Is a register-to-register addition instruction, it is determined that it is not necessary to perform operand address calculation, the contents of the register designated by the addition instruction AR are read from the general-purpose register group 18, and are input to the address registers 19 and 20. To do.

この場合加算命令ARだけでなくアドレスレジスタ20の
出力にで示すように、内容を反転させることによって
減算や比較も行なわせる事ができる。
In this case, not only the addition instruction AR but also the subtraction and comparison can be performed by inverting the contents as shown in the output of the address register 20.

アドレスレジスタ19、20を入力して加算器22で計算を
行なわせ、その結果をレジスタEAR23に保持すると同時
に、計算結果が例えば“0"の時は“0"に、正の時は“1"
に、負の時は“2"に、桁上がりがある時は“3"というよ
うに、第2コンディションコードラッチ16(CC−2)に
セットする。この時点ですでにCCを予測した事になる。
The address registers 19 and 20 are input, the adder 22 performs the calculation, and the result is held in the register EAR23. At the same time, when the calculation result is "0", it is "0", and when it is positive, it is "1".
The second condition code latch 16 (CC-2) is set to "2" when the value is negative and "3" when there is a carry. At this point, we have already predicted CC.

次に加算命令ARは、バッファメモリ13からデータを読
み出す必要がないのでEステージまで進む。
Next, the add instruction AR proceeds to the E stage because it is not necessary to read the data from the buffer memory 13.

Eステージでは、演算ユニット14で実際の演算を行な
わせる。加算命令等は、レジスタ間で演算を行ない、ま
たレジスタに書き込む動作が必要なため、指定されたレ
ジスタの内容を演算ユニット14に渡してやる。
In the E stage, the arithmetic unit 14 is caused to perform actual arithmetic. Since an addition instruction or the like requires an operation between registers and an operation of writing to the registers, the contents of the designated register are passed to the arithmetic unit 14.

演算ユニット14では、渡されたデータを演算してその
結果をレジスタに書き込むと同時に、本来のCCを第1コ
ンディションコードラッチ15(CC−1)に設定する。
The arithmetic unit 14 arithmetically operates the passed data and writes the result to the register, and at the same time, sets the original CC in the first condition code latch 15 (CC-1).

次に分岐命令BRが命令レジスタ11に投入されると、そ
のOPコードがデコードされ、命令制御回路27に入る。こ
こで再びどのような命令かを判断するが、分岐命令の場
合は、CCを見て指定されたアドレスへ分岐するかもしく
はそのまま後続命令を処理するかの判断が必要である。
Next, when the branch instruction BR is input to the instruction register 11, the OP code is decoded and enters the instruction control circuit 27. Here, it is judged again what kind of instruction, but in the case of a branch instruction, it is necessary to judge whether to branch to the designated address by looking at CC or to process the subsequent instruction as it is.

従来方式の場合、この時点ではまだどちらに決定する
か判断する事ができないので、分岐先アドレスを計算
し、そのアドレスからの命令の先取り要求を出すと同時
に、後続命令をパイプラインに投入することが行なわれ
た。そしてCCが設定された時点で処理が決定され、どち
らか一方が選択され、もう一方の命令は無効化された。
In the case of the conventional method, it is not possible to determine which to decide at this point in time, so calculate the branch destination address, issue a prefetch request for the instruction from that address, and at the same time input the subsequent instruction into the pipeline. Was done. Then, when the CC was set, the processing was decided, either one was selected, and the other instruction was invalidated.

しかし本発明方式では、すでに予測されたCCが設定さ
れているので、分岐命令BCのCC部(MASK部)とを条件比
較回路17を使って比較し、それによって分岐するかどう
かを決定する(一致したら分岐)。
However, in the method of the present invention, since the predicted CC has already been set, the conditional comparison circuit 17 is used to compare the CC portion (MASK portion) of the branch instruction BC, and it is determined whether or not to branch. If they match, branch.

そして一致の場合は分岐先命令の取り出し要求(iFC
H)をバッファメモリ13に対して出す。他方一致しなか
ったなら、分岐先命令の取り出し要求(iFCH)は出さず
に、後続命令をパイプラインに投入する。
If they match, the branch destination instruction fetch request (iFC
H) is output to the buffer memory 13. On the other hand, if they do not match, the instruction to fetch the branch destination instruction (iFCH) is not issued and the subsequent instruction is input to the pipeline.

一方、従来方式では、常に分岐先命令の取り出し要求
を出していたために、もしバッファメモリ13にその命令
がなかった場合には、主記憶装置28までデータの取り出
し要求(REQUEST)を行なわなければならなかった。分
岐するのであれば問題はないが、分岐しないと決定され
た場合には主記憶装置に対して無駄な要求を出した事に
なり、他の事象に遅れをきたす事にもなっていた。
On the other hand, in the conventional method, since the fetch request of the branch destination instruction is always issued, if there is no such instruction in the buffer memory 13, the data fetch request (REQUEST) must be sent to the main storage device 28. There wasn't. There is no problem if the branch is taken, but if it is decided not to branch, it means that a useless request is made to the main storage device, which causes a delay in other events.

しかし本発明方式では、CCの予測を行なって、分岐先
命令の取り出し要求を出すか出さないかを判断できるの
で、分岐しない場合は取り出し要求を出すことがなく、
主記憶装置へ余分な要求が出ないため、他の事象に影響
を与えないですむ利点がある。
However, according to the method of the present invention, it is possible to predict whether or not to issue a fetch request for a branch destination instruction by predicting CC, so if no branch is taken, the fetch request is not issued.
Since an extra request is not made to the main storage device, there is an advantage that it does not affect other events.

さらに重要な点は、CCにより分岐が決定すると仮定す
ると、従来方式では先取り命令が命令バッファ10に入っ
た時点にはまだCCが決定されていないために1t遅れて実
行を開始するが、本発明方式ではCCの予測を行なってい
るので、先取り命令が命令バッファ10に入った時点で実
行を開始できることである。
More importantly, assuming that the branch is decided by CC, in the conventional method, the CC is not decided yet when the prefetch instruction enters the instruction buffer 10, so that the execution is delayed by 1t. Since CC prediction is performed in the method, execution can be started when the prefetch instruction enters the instruction buffer 10.

〔発明の効果〕〔The invention's effect〕

以上述べたように、本発明による先行制御方式では、
コンディションコードを設定する先行命令がアドレス計
算を行なわないものである場合、アドレス計算のAステ
ージで早期にコンディションコードの値を予測で求めて
しまい、またコンディションコードを使用する後続の命
令も、アドレス計算のAステージで、この予測されたコ
ンディションコードを使用し、次の処理を早期に決定し
てしまうので、命令の先取り要求を必要な場合にだけ出
すことができ、また先取りした命令の実行も可能な最短
時間で開始させることができる。
As described above, in the advanced control method according to the present invention,
If the preceding instruction that sets the condition code is one that does not perform address calculation, the condition code value is predicted early at the A stage of address calculation, and the subsequent instruction that uses the condition code also calculates the address. Since the predicted condition code is used in the A stage of, and the next processing is determined early, it is possible to issue a prefetch request for an instruction only when necessary, and it is also possible to execute the prefetched instruction. It can be started in the shortest possible time.

このパイプラインの効率が向上し、処理装置の処理速
度が改善される。
The efficiency of this pipeline is improved and the processing speed of the processing device is improved.

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

第1図は本発明の原理説明図、第2図は本発明の作用を
説明するためのパイプラインのフロー図、第3図は本発
明の1実施例によるパイプラインのブロック構成図、第
4図は従来方式によるパイプラインのフロー図である。 第1図中、 10:命令バッファ 11:命令レジスタ 12:アドレス計算回路 13:バッファメモリ 14:演算ユニット 16:第2コンディションコードラッチCC−2 17:条件比較回路
FIG. 1 is a diagram explaining the principle of the present invention, FIG. 2 is a flow chart of a pipeline for explaining the operation of the present invention, FIG. 3 is a block diagram of the pipeline according to one embodiment of the present invention, and FIG. The figure is a flow chart of the pipeline according to the conventional method. In Fig. 1, 10: instruction buffer 11: instruction register 12: address calculation circuit 13: buffer memory 14: operation unit 16: second condition code latch CC-2 17: condition comparison circuit

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】アドレス計算回路(12)をそなえた命令制
御部をもつパイプライン方式の処理装置において、 アドレス計算が不要でかつコンディションコードを設定
する命令を実行する際、その命令の実行終了を持たずに
上記アドレス計算回路(12)を用いて演算によりコンデ
ィションコードの予測値を求め、 上記のコンディションコードを用いて処理すべき内容を
決定する後続の命令に対しては、上記コンディションコ
ードの予測値を渡し、処理すべき内容の決定を早期に実
行させるよう制御することを特徴とする先行制御方式。
1. In a pipeline type processor having an instruction control unit having an address calculation circuit (12), when an instruction for which address calculation is unnecessary and a condition code is set is executed, the execution end of the instruction is terminated. Without having it, the predicted value of the condition code is obtained by calculation using the address calculation circuit (12), and the condition code is predicted for the subsequent instruction that determines the content to be processed using the condition code. A preceding control method, which is characterized by passing a value and controlling to determine the contents to be processed early.
JP6654587A 1987-03-20 1987-03-20 Prior control method Expired - Lifetime JP2503223B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6654587A JP2503223B2 (en) 1987-03-20 1987-03-20 Prior control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6654587A JP2503223B2 (en) 1987-03-20 1987-03-20 Prior control method

Publications (2)

Publication Number Publication Date
JPS63231627A JPS63231627A (en) 1988-09-27
JP2503223B2 true JP2503223B2 (en) 1996-06-05

Family

ID=13318977

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6654587A Expired - Lifetime JP2503223B2 (en) 1987-03-20 1987-03-20 Prior control method

Country Status (1)

Country Link
JP (1) JP2503223B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3599409B2 (en) * 1994-06-14 2004-12-08 株式会社ルネサステクノロジ Branch prediction device

Also Published As

Publication number Publication date
JPS63231627A (en) 1988-09-27

Similar Documents

Publication Publication Date Title
US4858104A (en) Preceding instruction address based branch prediction in a pipelined processor
US5404552A (en) Pipeline risc processing unit with improved efficiency when handling data dependency
KR100900364B1 (en) System and method for reducing write traffic in processors
JP2507638B2 (en) Data processing device
JP2620511B2 (en) Data processor
JP4134179B2 (en) Software dynamic prediction method and apparatus
JPH07120284B2 (en) Data processing device
JPS634208B2 (en)
JP3738253B2 (en) Method and apparatus for processing program loops in parallel
JP3599499B2 (en) Central processing unit
JP2503223B2 (en) Prior control method
JP2924735B2 (en) Pipeline operation device and decoder device
JP2591325B2 (en) Branch control device
JPS6411973B2 (en)
KR100515039B1 (en) Pipeline status indicating circuit for conditional instruction
JP4702004B2 (en) Microcomputer
JPH10154072A (en) Pipeline processor
JP2597744B2 (en) Branch control method
JPH01271842A (en) Information processor
JPH05108348A (en) Parallel arithmetic processor
JPH0247725A (en) Data processor
JPS63221428A (en) Data processor
JPS6217841A (en) Information processor
JPH03291724A (en) Microprogram control system
JPH02254541A (en) Control system for conditional branch instruction