JPH04373023A - Data processor - Google Patents

Data processor

Info

Publication number
JPH04373023A
JPH04373023A JP15026491A JP15026491A JPH04373023A JP H04373023 A JPH04373023 A JP H04373023A JP 15026491 A JP15026491 A JP 15026491A JP 15026491 A JP15026491 A JP 15026491A JP H04373023 A JPH04373023 A JP H04373023A
Authority
JP
Japan
Prior art keywords
instruction
branch
address
processing means
branching
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
Application number
JP15026491A
Other languages
Japanese (ja)
Inventor
Takuya Kokuryo
琢也 國領
Taizo Sato
泰造 佐藤
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 JP15026491A priority Critical patent/JPH04373023A/en
Publication of JPH04373023A publication Critical patent/JPH04373023A/en
Withdrawn legal-status Critical Current

Links

Abstract

PURPOSE:To decrease the stop of a pipe-lined processing generated at the time of branching according to a branching instruction by continuously executing following instructions and canceling an instruction preceding to the instruction of a branching destination even when the branching instruction is detected. CONSTITUTION:When the branching instruction is detected by a first processing means 4 to decode the instruction and the address of the branching destination is calculated by a second processing means 5 to calculate an operand address, the address is stored in a branching address register 21. For example, when a non-condition branching instruction is decided to be branched to the branching destination address by the second processing means 5 and a condition branching instruction is decided to the branching destination address by a fourth processing means 7 to execute calculation, a branch judgement part 19 detects the branch and instructs it to cancel control parts 9-13 on respective stages that a non- branch side instruction discriminated as an unwanted instruction is canceled. When it is decided that the instruction is not branched to the branching destination address, no instruction is canceled, and the pipe-lined processing is continuously advanced as it is.

Description

【発明の詳細な説明】[Detailed description of the invention]

【0001】0001

【産業上の利用分野】本発明は、パイプライン処理を行
なうデータ処理装置に関し、分岐命令の処理時に発生す
るパイプライン処理の停滞を減少させるための構成に係
る。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a data processing apparatus that performs pipeline processing, and relates to a structure for reducing stagnation in pipeline processing that occurs when processing branch instructions.

【0002】現在、パイプライン処理により大部分の命
令を1サイクルにて実行するCPUが商品化され種々の
データ処理装置において実用化されている。しかし、分
岐命令の実行においてはパイプライン処理が停滞するの
で、このような場合のパイプライン処理の効率低下を抑
える方法が要求されている。この要求を満足させるため
には、分岐命令を検出してもパイプライン処理を継続す
ることによりパイプライン処理の効率を高める必要があ
る。
Currently, CPUs that execute most instructions in one cycle through pipeline processing have been commercialized and put into practical use in various data processing devices. However, since pipeline processing stalls when executing a branch instruction, there is a need for a method for suppressing the drop in efficiency of pipeline processing in such cases. In order to satisfy this requirement, it is necessary to increase the efficiency of pipeline processing by continuing pipeline processing even when a branch instruction is detected.

【0003】0003

【従来の技術】従来のデータ処理装置は、条件分岐命令
を検出すると、分岐条件の成立、不成立が判明する前に
、分岐する確率が高いか、あるいは分岐しない確率が高
いかを予め予測しておき、確率が高い方の命令からパイ
プライン処理を行なっていた。これは、一般的にプログ
ラムのループ処理においては、分岐条件が成立する確率
の高い方をループを構成するために使用し、分岐条件が
成立する確率の低い方をループから抜けるために使用す
れば、分岐か非分岐かの予測が当たる確率を高められる
からである。
2. Description of the Related Art When a conventional data processing device detects a conditional branch instruction, it predicts in advance whether the probability of branching is high or the probability of not branching is high, before it is known whether the branch condition is satisfied or not. Then, pipeline processing was performed starting from the instruction with the highest probability. Generally speaking, in program loop processing, the one with a higher probability of the branch condition being met is used to construct the loop, and the one with a lower probability of the branch condition being met is used to exit the loop. This is because the probability of predicting whether to branch or not to branch is correct can be increased.

【0004】ところが、プログラムの処理選択のような
分岐する確率を特定できない処理において条件分岐命令
を検出した場合には、ループ処理の場合と違って分岐か
非分岐かの予測が当たる可能性が、かなり低くなる。そ
のため、一般にプログラムの処理選択における条件分岐
命令を検出したときには、分岐条件判定まではとりあえ
ず非分岐側命令を先行処理することにより、分岐条件不
成立時のパイプライン処理の停滞を回避していた。
However, when a conditional branch instruction is detected in a process where the probability of branching cannot be specified, such as program process selection, unlike in loop processing, there is a possibility that the prediction of branching or non-branching will be correct. It will be quite low. Therefore, in general, when a conditional branch instruction is detected in a program's process selection, non-branch instructions are processed in advance until the branch condition is determined, thereby avoiding pipeline processing stagnation when the branch condition is not met.

【0005】図4は、従来例を説明する図である。ここ
では、パイプラインの段数が“5”であるデータ処理装
置を想定し、第1段目で命令のデコードを行ない、第2
段目でオペランドアドレスの計算を行ない、第3段目で
オペランドフェッチを行ない、第4段目で演算を行ない
、第5段目で書き込みを行なうものとする。データ処理
装置は、図4(a)〜(c)の左欄に掲げられている“
命令1”〜“命令5”を実行するものとし、その中の各
“命令1”は分岐命令であり、それぞれの分岐命令、す
なわち、“命令1”に対する分岐先命令は図4(a)と
(b)では“命令3”に、(c)では“命令4”になっ
ている。
FIG. 4 is a diagram illustrating a conventional example. Here, we assume a data processing device in which the number of pipeline stages is "5", and the first stage decodes instructions, and the second stage decodes instructions.
It is assumed that the operand address is calculated in the third stage, the operand fetch is performed in the third stage, the operation is performed in the fourth stage, and writing is performed in the fifth stage. The data processing device is “
It is assumed that "Instruction 1" to "Instruction 5" are executed, and each "Instruction 1" among them is a branch instruction, and the branch destination instruction for each branch instruction, that is, "Instruction 1" is as shown in FIG. 4(a). In (b), it is "instruction 3", and in (c), it is "instruction 4".

【0006】また、図中“DC”,“AC”,“OF”
,“OE”,“OW”は処理の略称であり、略称に続く
数字符は、左欄にある命令を識別するためにそれぞれの
命令の後ろに付した番号と対応している。例えば、“D
C1”は“命令1”に係る処理であり、“DC3”は“
命令3”に係る処理である。
[0006] In addition, "DC", "AC", "OF" in the figure
, "OE", and "OW" are abbreviations for processing, and the number mark following the abbreviation corresponds to the number attached to the end of each instruction in the left column to identify the instruction. For example, “D
C1" is the process related to "instruction 1", and "DC3" is the process related to "instruction 1".
This is the process related to instruction 3''.

【0007】また、“DC”は第1段目の命令デコード
処理を示し、“AC”は第2段目のアドレス計算処理を
、“OF”は第3段目のオペランドフェッチ処理を、“
OE”は第4段目の演算処理を、“OW”は第5段目の
書き込み処理をそれぞれ示している。図中、これらの処
理の略称を区切る縦線は、時間をステージごとに区切る
ものであり、図の右方向に時間は流れているものとする
Further, "DC" indicates the first stage of instruction decoding processing, "AC" indicates the second stage of address calculation processing, "OF" indicates the third stage of operand fetch processing, "
"OE" indicates the calculation process in the fourth stage, and "OW" indicates the write process in the fifth stage. In the figure, the vertical lines that separate the abbreviations of these processes are those that divide time into stages. It is assumed that time is flowing to the right in the figure.

【0008】図4(a)は、“命令1”が無条件分岐で
あり、その分岐先命令が“命令3”の場合の処理につい
て示している。図4(a)に示すとおり、無条件分岐命
令からその分岐先命令の実行に移るまでの間に、2ステ
ージ分の停滞が生じていることがわかる。
FIG. 4A shows processing when "instruction 1" is an unconditional branch and the branch destination instruction is "instruction 3". As shown in FIG. 4A, it can be seen that two stages of stagnation occur between the unconditional branch instruction and the execution of the branch destination instruction.

【0009】また、図4(b)は、“命令1”が条件分
岐命令であり、その条件成立時の分岐先命令が“命令3
”の場合の処理について示している。図4(b)に示す
とおり、分岐条件が成立した場合には、条件分岐命令か
らその分岐先命令の実行に移るまでの間に3ステージ分
の停滞が生じていることがわかる。なお、分岐条件の成
立、不成立については、条件分岐命令の演算処理を行な
うステージ、すなわち“OE1”のところで判明するも
のとする。
In addition, in FIG. 4(b), "instruction 1" is a conditional branch instruction, and the branch destination instruction when the condition is satisfied is "instruction 3".
As shown in Figure 4(b), when the branch condition is met, there is a stagnation of three stages between the conditional branch instruction and the execution of the branch destination instruction. It can be seen that the establishment or failure of the branch condition is determined at the stage where the arithmetic processing of the conditional branch instruction is performed, that is, at "OE1".

【0010】図4(c)は図4(b)と同じく“命令1
”が条件命令であり、異なるところは、分岐条件が成立
したときの分岐先命令が“命令3”ではなく“命令4”
であるところである。図4(c)においても、(b)と
同じく“OE1”のステージで分岐条件の成立が判明し
、結局、条件分岐命令からその分岐先命令の実行に移る
までの間に3ステージ分の停滞が生じていることがわか
る。
FIG. 4(c) shows "instruction 1" as in FIG. 4(b).
” is a conditional instruction, and the difference is that when the branch condition is met, the branch destination instruction is “instruction 4” instead of “instruction 3”.
That's where it is. In FIG. 4(c), as in (b), it is found that the branch condition is established at the "OE1" stage, and in the end, there is a stagnation of three stages between the conditional branch instruction and the execution of the branch destination instruction. It can be seen that this is occurring.

【0011】[0011]

【発明が解決しようとする課題】このように、従来のデ
ータ処理装置では、プログラムの処理選択における無条
件分岐命令あるいは条件分岐命令を検出して、分岐する
こととなった場合には、大きな遅延を生じるという問題
点があった。すなわち、分岐命令からその分岐先命令の
実行に移るまでに、パイプライン処理がある時間だけ停
滞するという問題点があった。
[Problems to be Solved by the Invention] As described above, in conventional data processing devices, when an unconditional branch instruction or a conditional branch instruction is detected in program processing selection and a branch is to be taken, a large delay occurs. There was a problem in that it caused That is, there is a problem in that the pipeline processing is stalled for a certain period of time before moving from a branch instruction to execution of the branch destination instruction.

【0012】本発明は、このような従来の問題点に鑑み
、データ処理装置において、分岐の際に生じるパイプラ
イン処理の停滞を抑えることを目的とする。
SUMMARY OF THE INVENTION In view of these conventional problems, it is an object of the present invention to suppress the stagnation of pipeline processing that occurs at the time of branching in a data processing device.

【0013】[0013]

【課題を解決するための手段】本発明によれば、上述の
目的は、前記特許請求の範囲に記載した手段により達成
される。
According to the invention, the above objects are achieved by the means set out in the claims.

【0014】すなわち、請求項1の発明は、記憶部から
先取りした命令を蓄えるバッファを有し、このバッファ
から取り出す命令を順次複数段の処理手段に渡してパイ
プライン処理を行なうデータ処理装置において、無条件
分岐命令を検出したときに、その無条件分岐命令以降の
命令を継続して実行する手段を具備すると共に、前記無
条件分岐命令の分岐先アドレスを保持する手段と、前記
処理手段で実行する命令のアドレスと前記分岐先アドレ
スとを比較する手段とを有し、前記分岐先アドレスの命
令が、前記処理手段で実行されている場合において、前
記無条件分岐命令後かつ前記分岐先アドレスの命令前の
命令を取り消す手段を設けるデータ処理装置である。
That is, the invention according to claim 1 provides a data processing apparatus that has a buffer for storing instructions prefetched from a storage section and performs pipeline processing by sequentially passing instructions taken out from the buffer to processing means in a plurality of stages. comprising means for continuously executing instructions after the unconditional branch instruction when an unconditional branch instruction is detected; and means for holding a branch destination address of the unconditional branch instruction; and execution by the processing means. means for comparing the address of an instruction to be executed with the branch destination address, and when the instruction at the branch destination address is being executed by the processing means, after the unconditional branch instruction and at the branch destination address, This data processing device is provided with means for canceling a previous command.

【0015】請求項2の発明は、記憶部から先取りした
命令を蓄えるバッファを有し、このバッファから取り出
す命令を順次複数段の処理手段に渡してパイプライン処
理を行なうデータ処理装置において、条件分岐命令を検
出したときに、その条件分岐命令以降の命令を継続して
実行する手段を具備すると共に、前記条件分岐命令の条
件によって決まる分岐先アドレスを保持する手段と、前
記処理手段で実行する命令のアドレスと、前記分岐先ア
ドレスとを比較する手段とを有し、前記条件分岐命令の
条件が分岐する条件であって、かつ、前記分岐先アドレ
スの命令が前記処理手段で実行されている場合において
、前記条件分岐命令後かつ前記分岐先アドレスの命令前
の命令を取り消す手段を設けるデータ処理装置である。
The invention according to claim 2 provides a data processing device which has a buffer for storing instructions pre-fetched from a storage section and performs pipeline processing by sequentially passing instructions taken out from the buffer to processing means in a plurality of stages. comprising a means for continuously executing instructions after the conditional branch instruction when an instruction is detected, a means for holding a branch destination address determined by the condition of the conditional branch instruction, and an instruction executed by the processing means. and means for comparing the branch address with the branch destination address, and the condition of the conditional branch instruction is a condition for branching, and the instruction at the branch destination address is executed by the processing means. The data processing apparatus further includes means for canceling an instruction after the conditional branch instruction and before the instruction at the branch destination address.

【0016】請求項3の発明は、複数段の処理手段の各
段ごとにフラグ保持部を設けると共に、各段の処理手段
で実行している命令のアドレスが、分岐先アドレス以降
か否かを示すフラグを各段の前記フラグ保持部に格納す
る手段と、前記フラグ保持部に格納してあるフラグに従
って命令を取り消す手段とを具備する請求項1または請
求項2記載のデータ処理装置である。
The invention of claim 3 provides a flag holding section for each stage of the plurality of stages of processing means, and determines whether the address of the instruction being executed by the processing means at each stage is after the branch destination address. 3. The data processing apparatus according to claim 1, further comprising means for storing a flag indicating the instruction in the flag holding section of each stage, and means for canceling the instruction according to the flag stored in the flag holding section.

【0017】請求項4の発明は、複数段の処理手段の各
段ごとに命令アドレスレジスタを設けると共に、各段の
処理手段で実行している命令のアドレスを各段の前記命
令アドレスレジスタに格納する手段と、前記命令アドレ
スレジスタのアドレスと、分岐先アドレスとを比較する
手段と,前記比較手段に従って命令を取り消す手段とを
具備する請求項1または請求項2記載のデータ処理装置
である。
According to the fourth aspect of the invention, an instruction address register is provided for each stage of the plurality of stages of processing means, and the address of the instruction being executed by the processing means of each stage is stored in the instruction address register of each stage. 3. The data processing apparatus according to claim 1, further comprising means for comparing the address of the instruction address register with a branch destination address, and means for canceling the instruction according to the comparing means.

【0018】[0018]

【作用】本発明は、プログラムの処理選択における分岐
の場合には近接した前方アドレスへ分岐する場合が多い
ことに着目し、分岐命令を検出してもその分岐命令以降
の命令を継続して先行処理する。先行処理を進めていく
と、多くの場合、次にどの命令を実行するのかが判明す
るまでの間に分岐先の命令の先行処理に入る。そこで、
そのとき、分岐することとなり不要な命令を実行してい
たならばそれらの不要な命令を取り消すようにすればよ
い。
[Operation] The present invention focuses on the fact that in the case of a branch in the process selection of a program, the branch is often to a nearby forward address. Process. As the preprocessing progresses, in many cases, the preprocessing of the branch destination instruction begins before it is known which instruction is to be executed next. Therefore,
At that time, if a branch occurs and unnecessary instructions are being executed, those unnecessary instructions can be canceled.

【0019】図1は、本発明の原理説明図である。従来
例と同様に、図1ではパイプラインの段数が“5”であ
るデータ処理装置を想定し、第1段目で命令のデコード
を行ない、第2段目でオペランドアドレスの計算を行な
い、第3段目でオペランドフェッチを行ない、第4段目
で演算を行ない、第5段目で書き込みを行なうものとす
る。データ処理装置は、図1(a)〜(c)の左欄に掲
げられている“命令1”〜“命令5”を実行するものと
し、各“命令1”は分岐命令であり、それぞれの分岐命
令に対する分岐先命令は図1(a)と(b)では“命令
3”に、(c)では“命令4”になっている。
FIG. 1 is a diagram explaining the principle of the present invention. As in the conventional example, FIG. 1 assumes a data processing device in which the number of pipeline stages is "5", in which the first stage decodes the instruction, the second stage calculates the operand address, and the second stage decodes the instruction. It is assumed that operand fetch is performed in the third stage, calculation is performed in the fourth stage, and writing is performed in the fifth stage. The data processing device executes "instruction 1" to "instruction 5" listed in the left column of FIGS. 1(a) to (c), each "instruction 1" is a branch instruction, and each The branch destination instruction for the branch instruction is "instruction 3" in FIGS. 1(a) and (b), and "instruction 4" in FIG. 1(c).

【0020】また、従来例と同じく図1において、“D
C”,“AC”,“OF”,“OE”,“OW”は処理
の略称であり、略称に続く数字符は、左欄にある命令を
識別するために付した番号と対応している。例えば、“
OE1”は“命令1”に係る処理であり、“OE3”は
“命令3”に係る処理である。
In addition, in FIG. 1, as in the conventional example, “D
"C", "AC", "OF", "OE", and "OW" are process abbreviations, and the numbers following the abbreviations correspond to the numbers assigned to identify the instructions in the left column. .for example,"
"OE1" is a process related to "instruction 1", and "OE3" is a process related to "instruction 3".

【0021】また、“DC”は第1段目の命令デコード
処理を示し、“AC”は第2段目のアドレス計算処理を
、“OF”は第3段目のオペランドフェッチ処理を、“
OE”は第4段目の演算処理を、“OW”は第5段目の
書き込み処理をそれぞれ示している。図中、これらの処
理の略称を区切る縦線は、時間をステージごとに区切る
ものであり、図の右方向に時間は流れているものとする
Further, "DC" indicates the first stage instruction decoding process, "AC" indicates the second stage address calculation process, "OF" indicates the third stage operand fetch process, "
"OE" indicates the calculation process in the fourth stage, and "OW" indicates the write process in the fifth stage. In the figure, the vertical lines that separate the abbreviations of these processes are those that divide time into stages. It is assumed that time is flowing to the right in the figure.

【0022】図1(a)〜(c)のいずれの場合も、命
令のデコードを行なう第1段目の処理手段は、“命令1
”〜“命令5”までのデコードを分岐命令である“命令
1”を検出した後も継続して行なっていることがわかる
。第2〜5段目の処理手段も同様に、分岐命令を検出し
ていないかの如く分岐命令以降の命令を継続して行なっ
ている。
In any of the cases shown in FIGS. 1(a) to 1(c), the first stage processing means for decoding the instruction is "instruction 1".
It can be seen that the decoding from "instruction 5" to "instruction 5" continues even after the branch instruction "instruction 1" is detected.The processing means in the second to fifth stages also detect the branch instruction. The instructions after the branch instruction continue to be executed as if they had not been executed.

【0023】分岐命令によって分岐することとなった場
合、図1(a)〜(c)のそれぞれについてのパイプラ
イン処理の停滞をみると、図1(a)と(b)とで1ス
テージ分の停滞が生じており、図1(c)で2ステージ
分の停滞が生じていることがわかる。なお、この分岐す
る場合において、図1(a)〜(c)の“命令2”およ
び図1(c)の“命令3”は、不要な命令として取り消
される。
When a branch is to be taken by a branch instruction, looking at the stagnation of pipeline processing in each of FIGS. 1(a) to (c), it is found that the amount of time required for one stage in FIGS. 1(a) and (b) is A stagnation has occurred, and it can be seen in FIG. 1(c) that a stagnation of two stages has occurred. In this branching case, "instruction 2" in FIGS. 1(a) to 1(c) and "instruction 3" in FIG. 1(c) are canceled as unnecessary instructions.

【0024】先に従来例について示した図4と、本発明
について示す図1とを比較してみると、図4(a)と図
1(a)との比較では、1ステージ分の時間の違いがあ
り、本発明の場合のパイプライン処理の停滞時間は、従
来の半分となっていることがわかる。同様に、図4(b
)と図1(b)との比較では、本発明の場合の停滞は従
来の三分の一になっていることが、図4(c)と図1(
c)との比較では、停滞が従来の三分の二になっている
ことがわかる。
Comparing FIG. 4, which shows the conventional example, and FIG. 1, which shows the present invention, the comparison between FIG. 4(a) and FIG. 1(a) shows that the time for one stage is reduced. It can be seen that there is a difference, and the stagnation time of pipeline processing in the case of the present invention is half that of the conventional method. Similarly, Fig. 4(b
) and FIG. 1(b), the stagnation in the case of the present invention is one-third that of the conventional method.
A comparison with c) shows that stagnation is two-thirds of the previous level.

【0025】[0025]

【実施例】図2は、本発明の一実施例を示す図であり、
パイプライン処理を行なうデータ処理装置の構成例を示
している。図1において示したパイプライン処理の各ス
テージの処理は、図2に示す各処理手段4〜8が処理す
るものとする。記憶部1から取り出される命令は命令バ
ッファ2に蓄えられ、命令デコードを行なう第一の処理
手段4に供給される。
[Embodiment] FIG. 2 is a diagram showing an embodiment of the present invention.
An example of the configuration of a data processing device that performs pipeline processing is shown. It is assumed that each stage of the pipeline processing shown in FIG. 1 is processed by each of the processing means 4 to 8 shown in FIG. Instructions taken out from the storage section 1 are stored in an instruction buffer 2 and supplied to a first processing means 4 that performs instruction decoding.

【0026】ここでデコードした命令は、オペランドア
ドレスの計算を行なう第二の処理手段5、オペランドフ
ェッチを行なう第三の処理手段6、演算実行を行なう第
四の処理手段7、演算結果の書き込みを行なう第五の処
理手段8により順次処理される。パイプライン制御部2
0は、各処理手段4〜8のパイプライン制御を行なう。
The instructions decoded here are the second processing means 5 for calculating the operand address, the third processing means 6 for fetching the operand, the fourth processing means 7 for executing the operation, and the writing of the operation result. The data are sequentially processed by the fifth processing means 8. Pipeline control section 2
0 performs pipeline control of each processing means 4-8.

【0027】命令デコードを行なう第一の処理手段4に
おいて分岐命令が検出され、オペランドアドレスの計算
を行なう第二の処理手段5においてその分岐命令の分岐
先アドレスが計算できると、分岐先アドレスは分岐アド
レスレジスタ21に格納される。
When a branch instruction is detected in the first processing means 4 that performs instruction decoding and the branch destination address of the branch instruction can be calculated in the second processing means 5 that calculates the operand address, the branch destination address is It is stored in the address register 21.

【0028】その後に命令バッファ2から第一の処理手
段4に入力される命令のアドレスと分岐アドレスレジス
タ21の分岐先アドレスとをアドレス比較部3が比較し
、第一の処理手段4に入力される命令のアドレスが分岐
先アドレス以上のときには分岐側命令であることを示す
フラグをフラグ保持部14にセットする。このフラグは
パイプライン処理の流れとともに後方にシフトされて、
各フラグ保持部15〜18にセットされる。
Thereafter, the address comparator 3 compares the address of the instruction inputted from the instruction buffer 2 to the first processing means 4 and the branch destination address of the branch address register 21, and the address of the instruction inputted to the first processing means 4 is compared. When the address of the instruction is equal to or greater than the branch destination address, a flag indicating that the instruction is a branch-side instruction is set in the flag holding unit 14. This flag is shifted backwards as the pipeline progresses,
It is set in each flag holding section 15-18.

【0029】分岐命令が第二の処理手段5〜第五の処理
手段8のいずれかにおいて、たとえば、無条件分岐命令
ではオペランドアドレスの計算を行なう第二の処理手段
5において、条件分岐命令では演算実行を行なう第四の
処理手段7において、分岐先アドレスに分岐することが
確定すれば、分岐判定部19がその分岐を検出し、各ス
テージの取り消し制御部9〜13に対して、不要な命令
であることが判明した非分岐側命令を取り消すことを指
示する。
When a branch instruction is processed in any one of the second processing means 5 to fifth processing means 8, for example, in the case of an unconditional branch instruction, the second processing means 5 calculates the operand address, and in the case of a conditional branch instruction, an operation is performed. In the fourth processing means 7 that performs execution, if it is determined that the branch will be taken to the branch destination address, the branch determination unit 19 detects the branch and sends unnecessary instructions to the cancellation control units 9 to 13 of each stage. Instructs to cancel non-branching instructions that are found to be .

【0030】分岐先命令以降の分岐側命令は、取り消さ
れることなく継続してパイプライン処理される。一方、
分岐先アドレスに分岐しないことが確定すれば、非分岐
側命令も分岐側命令も取り消すことはせずに、そのまま
継続してパイプライン処理を進めていく。
Branch-side instructions after the branch destination instruction are continuously processed in the pipeline without being canceled. on the other hand,
If it is determined that the program will not branch to the branch destination address, the pipeline processing continues without canceling either the non-branch side instruction or the branch side instruction.

【0031】図3は、本発明の別の実施例を示す図であ
る。先に、図1において示したパイプライン処理の各ス
テージの処理は、図3に示す各処理手段34〜38が処
理するものとする。記憶部31から取り出される命令は
、命令バッファ32に蓄えられ、命令デコードを行なう
第一の処理手段34に供給される。
FIG. 3 is a diagram showing another embodiment of the present invention. First, it is assumed that each stage of the pipeline processing shown in FIG. 1 is processed by each of the processing means 34 to 38 shown in FIG. The instructions retrieved from the storage section 31 are stored in an instruction buffer 32 and supplied to a first processing means 34 that performs instruction decoding.

【0032】ここでデコードした命令は、オペランドア
ドレスの計算を行なう第二の処理手段35、オペランド
フェッチを行なう第三の処理手段36、演算実行を行な
う第四の処理手段37、演算結果の書き込みを行なう第
五の処理手段38により順次処理される。パイプライン
制御部50は、各処理手段34〜38のパイプライン制
御を行なう。
The instructions decoded here are the second processing means 35 for calculating the operand address, the third processing means 36 for fetching the operand, the fourth processing means 37 for executing the operation, and the writing of the operation result. The data are sequentially processed by the fifth processing means 38. The pipeline control unit 50 performs pipeline control of each processing means 34 to 38.

【0033】命令デコードを行なう第一の処理手段34
が分岐命令を検出し、オペランドアドレスの計算を行な
う第二の処理手段35がその分岐命令の分岐先アドレス
を計算すると、この分岐先アドレスは分岐アドレスレジ
スタ51に格納される。その後に、命令バッファ32か
ら第一の処理手段34に入力される命令のアドレスは、
命令アドレスレジスタ44に格納される。
First processing means 34 for decoding instructions
detects a branch instruction, and when the second processing means 35 for calculating operand addresses calculates the branch destination address of the branch instruction, this branch destination address is stored in the branch address register 51. Thereafter, the address of the instruction input from the instruction buffer 32 to the first processing means 34 is
It is stored in the instruction address register 44.

【0034】この命令アドレスレジスタ44の内容は、
パイプライン処理の流れと共に後方にシフトされて、各
命令アドレスレジスタ45〜48に格納される。各アド
レス比較部52〜56は、分岐アドレスレジスタ51の
内容と、対応する命令アドレスレジスタ45〜48の内
容とを比較し、対応する処理手段34〜38が非分岐側
の命令を実行しているのか、分岐側の命令を実行してい
るのかを通知する。
The contents of this instruction address register 44 are as follows:
It is shifted backward with the flow of pipeline processing and stored in each instruction address register 45-48. Each address comparing unit 52-56 compares the contents of the branch address register 51 with the contents of the corresponding instruction address register 45-48, and the corresponding processing means 34-38 executes the non-branch side instruction. It notifies whether the instruction on the branch side is being executed.

【0035】分岐命令が第二の処理手段35〜第五の処
理手段38のいずれかにおいて、分岐先アドレスに分岐
することが確定すれば、分岐判定部49がその分岐を検
出し、各ステージの取り消し制御部39〜43に非分岐
側の命令を取り消すことを指示する。一方、分岐先アド
レスに分岐しないことが確定すれば、そのままパイプラ
イン処理を続行する。
If it is determined that the branch instruction branches to the branch destination address in any of the second processing means 35 to fifth processing means 38, the branch determination unit 49 detects the branch and determines the branching at each stage. Instructs the cancellation control units 39 to 43 to cancel the non-branch side instruction. On the other hand, if it is determined that the branch will not be branched to the branch destination address, the pipeline processing continues as is.

【0036】[0036]

【発明の効果】以上説明した様に、本発明によれば、プ
ログラム処理の二分岐選択、および多岐選択において発
生する前方の近接アドレスへの分岐に対しては、連続的
にパイプライン処理を先行させるため、無条件分岐命令
、および条件分岐命令においてパイプライン処理の中断
時間を減少させることができ、データ処理装置の処理速
度の向上を図ることができるという利点がある。
As explained above, according to the present invention, pipeline processing is continuously performed in advance for branches to forward adjacent addresses that occur during two-branch selection and multi-branch selection in program processing. Therefore, there is an advantage that the interruption time of pipeline processing can be reduced in unconditional branch instructions and conditional branch instructions, and the processing speed of the data processing device can be improved.

【図面の簡単な説明】[Brief explanation of the drawing]

【図1】本発明の原理説明図である。FIG. 1 is a diagram explaining the principle of the present invention.

【図2】本発明の一実施例を示す図である。FIG. 2 is a diagram showing an embodiment of the present invention.

【図3】本発明の別の実施例を示す図である。FIG. 3 is a diagram showing another embodiment of the invention.

【図4】従来例を説明する図である。FIG. 4 is a diagram illustrating a conventional example.

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

1, 31    記憶部 2, 32    命令バッファ 3, 52〜56    アドレス比較部4, 34 
   第一の処理手段 5, 35    第二の処理手段 6, 36    第三の処理手段 7, 37    第四の処理手段 8, 38    第五の処理手段 9〜13, 39〜43    取り消し制御部14〜
18    フラグ保持部 19, 49    分岐判定部
1, 31 Storage section 2, 32 Instruction buffer 3, 52-56 Address comparison section 4, 34
First processing means 5, 35 Second processing means 6, 36 Third processing means 7, 37 Fourth processing means 8, 38 Fifth processing means 9-13, 39-43 Cancellation control section 14-
18 Flag holding section 19, 49 Branch judgment section

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】  記憶部から先取りした命令を蓄えるバ
ッファを有し、このバッファから取り出す命令を順次複
数段の処理手段に渡してパイプライン処理を行なうデー
タ処理装置において、無条件分岐命令を検出したときに
、その無条件分岐命令以降の命令を継続して実行する手
段を具備すると共に、前記無条件分岐命令の分岐先アド
レスを保持する手段と、前記処理手段で実行する命令の
アドレスと前記分岐先アドレスとを比較する手段とを有
し、前記分岐先アドレスの命令が、前記処理手段で実行
されている場合において、前記無条件分岐命令後かつ前
記分岐先アドレスの命令前の命令を取り消す手段を設け
ることを特徴とするデータ処理装置。
Claim 1: In a data processing device that has a buffer for storing instructions pre-fetched from a storage unit and performs pipeline processing by sequentially passing instructions taken out from the buffer to processing means in multiple stages, an unconditional branch instruction is detected. In some cases, the unconditional branch instruction includes a means for continuously executing instructions after the unconditional branch instruction, a means for holding a branch destination address of the unconditional branch instruction, and an address of the instruction to be executed by the processing means and the branch. means for comparing the instruction with the branch destination address, and means for canceling the instruction after the unconditional branch instruction and before the instruction at the branch destination address when the instruction at the branch destination address is being executed by the processing means. A data processing device comprising:
【請求項2】  記憶部から先取りした命令を蓄えるバ
ッファを有し、このバッファから取り出す命令を順次複
数段の処理手段に渡してパイプライン処理を行なうデー
タ処理装置において、条件分岐命令を検出したときに、
その条件分岐命令以降の命令を継続して実行する手段を
具備すると共に、前記条件分岐命令の条件によって決ま
る分岐先アドレスを保持する手段と、前記処理手段で実
行する命令のアドレスと、前記分岐先アドレスとを比較
する手段とを有し、前記条件分岐命令の条件が分岐する
条件であって、かつ、前記分岐先アドレスの命令が前記
処理手段で実行されている場合において、前記条件分岐
命令後かつ前記分岐先アドレスの命令前の命令を取り消
す手段を設けることを特徴とするデータ処理装置。
2. When a conditional branch instruction is detected in a data processing device that has a buffer for storing instructions prefetched from a storage unit and performs pipeline processing by sequentially passing instructions taken out from the buffer to processing means in multiple stages. To,
It comprises means for continuously executing instructions after the conditional branch instruction, means for holding a branch destination address determined by the condition of the conditional branch instruction, an address of the instruction to be executed by the processing means, and a means for holding the branch destination address determined by the condition of the conditional branch instruction. and when the condition of the conditional branch instruction is a condition for branching and the instruction at the branch destination address is executed by the processing means, after the conditional branch instruction A data processing device further comprising means for canceling an instruction before the instruction at the branch destination address.
【請求項3】  複数段の処理手段の各段ごとにフラグ
保持部を設けると共に、各段の処理手段で実行している
命令のアドレスが、分岐先アドレス以降か否かを示すフ
ラグを各段の前記フラグ保持部に格納する手段と、前記
フラグ保持部に格納してあるフラグに従って命令を取り
消す手段とを具備する請求項1または請求項2記載のデ
ータ処理装置。
3. A flag holding section is provided for each stage of the plurality of stages of processing means, and a flag indicating whether the address of the instruction being executed by the processing means at each stage is after the branch destination address is stored in each stage. 3. The data processing apparatus according to claim 1, further comprising means for storing the flag in the flag holding section, and means for canceling the instruction according to the flag stored in the flag holding section.
【請求項4】  複数段の処理手段の各段ごとに命令ア
ドレスレジスタを設けると共に、各段の処理手段で実行
している命令のアドレスを各段の前記命令アドレスレジ
スタに格納する手段と、前記命令アドレスレジスタのア
ドレスと、分岐先アドレスとを比較する手段と、前記比
較手段に従って命令を取り消す手段とを具備する請求項
1または請求項2記載のデータ処理装置。
4. Means for providing an instruction address register for each stage of the plurality of stages of processing means, and storing the address of the instruction being executed by the processing means of each stage in the instruction address register of each stage; 3. The data processing apparatus according to claim 1, further comprising means for comparing an address of an instruction address register with a branch destination address, and means for canceling the instruction according to the comparing means.
JP15026491A 1991-06-21 1991-06-21 Data processor Withdrawn JPH04373023A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP15026491A JPH04373023A (en) 1991-06-21 1991-06-21 Data processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP15026491A JPH04373023A (en) 1991-06-21 1991-06-21 Data processor

Publications (1)

Publication Number Publication Date
JPH04373023A true JPH04373023A (en) 1992-12-25

Family

ID=15493143

Family Applications (1)

Application Number Title Priority Date Filing Date
JP15026491A Withdrawn JPH04373023A (en) 1991-06-21 1991-06-21 Data processor

Country Status (1)

Country Link
JP (1) JPH04373023A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008299729A (en) * 2007-06-01 2008-12-11 Digital Electronics Corp Processor
US10853081B2 (en) 2017-11-29 2020-12-01 Sanken Electric Co., Ltd. Processor and pipelining method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008299729A (en) * 2007-06-01 2008-12-11 Digital Electronics Corp Processor
US10853081B2 (en) 2017-11-29 2020-12-01 Sanken Electric Co., Ltd. Processor and pipelining method

Similar Documents

Publication Publication Date Title
JP5889986B2 (en) System and method for selectively committing the results of executed instructions
JP2518616B2 (en) Branching method
JP2640454B2 (en) Digital instruction processor controller and method for executing a branch in one cycle
US6662295B2 (en) Method and system dynamically presenting the branch target address in conditional branch instruction
US20010020267A1 (en) Pipeline processing apparatus with improved efficiency of branch prediction, and method therefor
US7454598B2 (en) Controlling out of order execution pipelines issue tagging
EP1280052A2 (en) Branch fetch architecture for reducing branch penalty without branch prediction
US6622240B1 (en) Method and apparatus for pre-branch instruction
JP3749233B2 (en) Instruction execution method and apparatus in pipeline
JPH04373023A (en) Data processor
JP2003263313A (en) Digital processor and method of selecting command
JP4728877B2 (en) Microprocessor and pipeline control method
JPH11345121A (en) Instruction extracting device for program control unit and method thereof
JP3082944B2 (en) Pipeline processing equipment
JPH0667883A (en) Data processor
US7822954B2 (en) Methods, systems, and computer program products for recovering from branch prediction latency
JP3493110B2 (en) High-speed branch processing unit
JPH04372020A (en) Method and device for data processing
JP2503223B2 (en) Prior control method
JPH07121371A (en) Plural instructions simultaneous fetching mechanism
JP3431503B2 (en) Information processing apparatus and program control method
JPH02211533A (en) Computer apparatus for performing selective execution of instruction following branch instruction
JPH01271842A (en) Information processor
JPH0774992B2 (en) Data processing device
JPH06161750A (en) Instruction fetch control method and instruction processor

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 19980903