JPH01106227A - Data processor with branching forecasting function - Google Patents

Data processor with branching forecasting function

Info

Publication number
JPH01106227A
JPH01106227A JP26497487A JP26497487A JPH01106227A JP H01106227 A JPH01106227 A JP H01106227A JP 26497487 A JP26497487 A JP 26497487A JP 26497487 A JP26497487 A JP 26497487A JP H01106227 A JPH01106227 A JP H01106227A
Authority
JP
Japan
Prior art keywords
branch
instruction
branch prediction
prediction
register
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP26497487A
Other languages
Japanese (ja)
Other versions
JPH0760386B2 (en
Inventor
Tatsuya Ueda
達也 上田
Toyohiko Yoshida
豊彦 吉田
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP26497487A priority Critical patent/JPH0760386B2/en
Publication of JPH01106227A publication Critical patent/JPH01106227A/en
Publication of JPH0760386B2 publication Critical patent/JPH0760386B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)

Abstract

PURPOSE:To forecast branching even when the branch can not be forecasted by history by adding a 2nd branch forecasting means for forecasting whether branching is generated or not from a branching condition of an instruction decoded by an instruction fetching/decoding means. CONSTITUTION:A branching forecasting mechanism 20 independent of the history fetches a 4-bit branching condition code '0000' from a branching condition code register 7 and determines a signal to be outputted to the 2nd branching forecasting signal line 24 from the pattern of the branching condition code. The code '0000' is set up so as to forecast the generation of branching. When a signal from a branching forecast disabling signal line 23 is in an ON state, a selector 21 selects the 2nd branching forecasting signal line 24. Consequently, the generation of a branching can be forecasted.

Description

【発明の詳細な説明】 [産業上の利用分野] この発明は分岐予測機能を有するデータ処理装置に関し
、特にパイプライン機構を有し、命令をデコード時に、
分岐するか否かを予測する分岐に測機能を有するデータ
処理装置に関するものである。
[Detailed Description of the Invention] [Industrial Application Field] The present invention relates to a data processing device having a branch prediction function, and in particular has a pipeline mechanism, and when decoding an instruction,
The present invention relates to a data processing device having a branch measuring function for predicting whether or not to take a branch.

[従来の技術] 計算機の命令には大きく分けて非分岐命令、無条件分岐
命令、条件分岐命令がある。条件分岐命令は、成る一定
の条件が成立していると分岐を起こす命令であり、パイ
プライン方式の計算機にとって高速化のための障害とな
っている。すなわち、パイプライン方式の計算機におい
て、分岐命令が命令実行部において実行され、実際に分
岐が起こると、その時点においてパイプラインで処理中
の命令はキャンセルされ、新たに分岐先の命令がフェッ
チされる。このため、パイプラインの流れに隙間ができ
、パイプラインが乱れることになる。
[Prior Art] Computer instructions can be broadly classified into non-branch instructions, unconditional branch instructions, and conditional branch instructions. A conditional branch instruction is an instruction that causes a branch if a certain condition is met, and is an obstacle to increasing the speed of pipelined computers. In other words, in a pipelined computer, a branch instruction is executed in the instruction execution unit, and when a branch actually occurs, the instruction being processed in the pipeline at that point is canceled and a new branch destination instruction is fetched. . This creates gaps in the flow of the pipeline, resulting in turbulence in the pipeline.

そこで、条件分岐命令が与えられたとき、分岐するか否
かを予測する分岐予測方式が採用されている。このよう
な分岐予測方法については、米国電気電子学会(IEE
E)のコンピュータ部会(COMPUTERSOCI 
ETY) が発行シた「コンピュータ(COMPUTE
R)J 1984年1月号に記載されている。
Therefore, a branch prediction method is adopted that predicts whether or not to branch when a conditional branch instruction is given. This branch prediction method is described in the Institute of Electrical and Electronics Engineers (IEE).
E) Computer Subcommittee (COMPUTERSOCI)
"COMPUTE" published by ETY
R) J January 1984 issue.

第5図は、従来の分岐r測機能を有するデータ処理装置
の概略ブロック図である。まず、第5図を参照して、従
来の分岐p4−1機能を有するデータ処理装置の構成に
ついて説明する。命令レジスタ1はデータバスに出力さ
れた命令を記憶するものである。命令レジスタ1に記憶
された命令は命令デコーダ2に与えられる。命令デコー
ダ2は命令をデコードして、演算指示信号や分岐変位(
その命令が条件分岐命令あるいは無条件分岐命令であれ
ば)やそのデコードされた命令の命令長を出力するもの
である。実行機構3は命令デコーダによって、命令がデ
コードされた結果、出力される演算指示信号に基づいて
命令を実行するものである。
FIG. 5 is a schematic block diagram of a conventional data processing device having a branch measurement function. First, with reference to FIG. 5, the configuration of a conventional data processing device having a branch p4-1 function will be described. The instruction register 1 stores instructions output to the data bus. The instructions stored in the instruction register 1 are given to the instruction decoder 2. The instruction decoder 2 decodes instructions and outputs calculation instruction signals and branch displacements (
If the instruction is a conditional branch instruction or an unconditional branch instruction, it outputs the instruction length of the decoded instruction. The execution mechanism 3 executes an instruction based on an operation instruction signal outputted as a result of the instruction being decoded by the instruction decoder.

分岐予測機構4は命令のアドレスに対応して分岐予測ビ
ットを記憶するものである。この分岐子alビットは、
命令が実行されたとき、分岐を起こすか否かを予測する
ためのものである。そして、分岐予測機構4は命令がデ
コードされたとき、その命令に対応するアドレスから分
岐r測ビットを読出して、比較器5と次フェッチ命令ア
ドレス指定部6とに与える。分岐すると予測してブリブ
ランチを行なった場合には、比較器5は分岐予測ビット
に基づく予測結果と、分岐すると予1111 した条件
分岐命令の実行機構3−による実行結果とを比較し、一
致しないとき、分岐予測失敗信号を次フェッチ命令アド
レス指定部6に与える。
The branch prediction mechanism 4 stores branch prediction bits corresponding to the addresses of instructions. This branch al bit is
This is to predict whether a branch will occur when an instruction is executed. Then, when the instruction is decoded, the branch prediction mechanism 4 reads the branch r prediction bit from the address corresponding to the instruction and supplies it to the comparator 5 and the next fetch instruction address designation section 6. When a branch is predicted and a branch is executed, the comparator 5 compares the prediction result based on the branch prediction bit with the execution result by the execution mechanism 3- of the conditional branch instruction predicted to take a branch, and determines that they do not match. At this time, a branch prediction failure signal is given to the next fetch instruction address specifying unit 6.

次フェッチ命令アドレス指定部6は比較器5によって分
岐の予測の失敗が判別されたとき、分岐予測失敗信号に
基づいて、正しい方向の命令をメモリから読出す。この
次フェッチ命令アドレス指定部6は加算器61とデコー
ド用プログラムカウンタ62とセーブレジスタ63とを
含む。加算器61は命令を実行するごとに命令長をデコ
ード用プログラムカウンタ62の内容に加算して、次に
フェッチすべき命令のアドレス信号を出力するものであ
る。次フェッチ命令アドレス指定部6は分岐予測機構4
から分岐予測ビットが与えられたときには、デコード用
プログラムカウンタ62のアドレスデータをセーブレジ
スタ63にセーブし、加算器61によってデコード用プ
ログラムカウンタ62の計数しているアドレスデータに
分岐変位を加算させる。
When the comparator 5 determines that the branch prediction has failed, the next fetch instruction addressing unit 6 reads the instruction in the correct direction from the memory based on the branch prediction failure signal. The next fetch instruction address specifying unit 6 includes an adder 61, a decoding program counter 62, and a save register 63. The adder 61 adds the instruction length to the contents of the decoding program counter 62 each time an instruction is executed, and outputs the address signal of the next instruction to be fetched. The next fetch instruction address specification unit 6 is a branch prediction mechanism 4
When a branch prediction bit is given from , address data of a decoding program counter 62 is saved in a save register 63, and an adder 61 adds the branch displacement to the address data counted by the decoding program counter 62.

デコード用プログラムカウンタ62のアドレスデータを
セーブレジスタ63にセーブするのは、もし分岐予測を
失敗したときには、セーブしたアドレスデータを再びデ
コード用プログラムカウンタ62に、ロードし、そのア
ドレスデータに命令長を加算して、次のアドレスの命令
をフェッチする−ためのものである。
The reason why the address data of the decoding program counter 62 is saved in the save register 63 is that if branch prediction fails, the saved address data is loaded into the decoding program counter 62 again and the instruction length is added to the address data. This is for fetching the instruction at the next address.

第6図は分岐子7Tl11機能を説明するためのメモリ
内でのアドレスの関係を示す関係図である。次に、第5
図および第6図を参照して、従来の条件分岐命令が与え
られたときの分岐子a1方法について説明する。デコー
ド用プログラムカウンタ62のアドレスデータがアドレ
ス信号としてアドレスバスに出力され、メモリ(図示せ
ず)の成る番地から命令が読出されて命令レジスタ1に
ロードされる。
FIG. 6 is a relationship diagram showing the relationship of addresses in the memory to explain the function of the branch 7Tl11. Next, the fifth
A conventional branching element a1 method when a conditional branch instruction is given will be described with reference to the drawings and FIG. Address data from the decoding program counter 62 is output as an address signal to the address bus, and an instruction is read from an address in a memory (not shown) and loaded into the instruction register 1.

この命令は命令デコーダ2によってデコードされ、演算
指示信号と命令長が出力される。実行機構3はその演算
指示信号に基づいて処理動作を実行する。
This instruction is decoded by the instruction decoder 2, and an operation instruction signal and instruction length are output. The execution mechanism 3 executes processing operations based on the calculation instruction signal.

一方、加算器61は命令デコーダ2によってデコードさ
れた命令長をデコード用プログラムカウンタ62の内容
に加算し、次にフェッチすべき命令のアドレス信号をア
ドレスバスに出力する。デコード用プログラムカウンタ
62から出力されたアドレス信号が条件分岐命令に対応
している場合には、そのアドレスの一部に対応して記憶
されている分岐子a1ビットが読出されて、次フェッチ
命令アドレス指定部6に与えられる。その命令が分岐す
ると予測され、かつその命令をデコードした結果、それ
が条件分岐命令であることが判明した場合には、次フェ
ッチ命令アドレス指定部6はその命令が分岐するものと
判断し、デコード用プログラムカウンタ62の内容をセ
ーブレジスタ63にセーブする。そして、加算器61は
デコード用プログラムカウンタ62の内容に、命令デコ
ーダ2によってデコードされた分岐変位を加算する。
On the other hand, the adder 61 adds the instruction length decoded by the instruction decoder 2 to the contents of the decoding program counter 62, and outputs the address signal of the next instruction to be fetched to the address bus. If the address signal output from the decoding program counter 62 corresponds to a conditional branch instruction, the branch a1 bit stored corresponding to a part of the address is read out and the next fetch instruction address is read out. It is given to the designation section 6. If the instruction is predicted to branch, and as a result of decoding the instruction, it is found that it is a conditional branch instruction, the next fetch instruction address specification unit 6 determines that the instruction will branch, and decodes the instruction. The contents of the program counter 62 are saved in the save register 63. Then, the adder 61 adds the branch displacement decoded by the instruction decoder 2 to the contents of the decoding program counter 62.

すなわち、第6図に示すように、条件分岐命令のアドレ
スaに対して、分岐変位すが加算されて、分岐先アドレ
スa+bを示すアドレス信号が出力される。このアドレ
ス信号に基づいて、メモリから分岐先の命令が読出され
る。
That is, as shown in FIG. 6, the branch displacement is added to the address a of the conditional branch instruction, and an address signal indicating the branch destination address a+b is output. Based on this address signal, the branch destination instruction is read from the memory.

他方、実行機構3は条件分岐命令を実行するが、この条
件分岐命令は成る一定の条件が満たされていれば分岐す
るが、条件が満たされていない場合には分岐しない命令
である。たとえば、2(ゼロ)フラグが立っていれば分
岐するという条件を持つ条件分岐命令を実行する場合は
、Zフラグが立っていれば分岐するが、2フラグが立っ
ていなければ分岐しない。実行機構3が条件分岐命令を
実行した結果、分岐しなかった場合には、分岐しなかっ
たことを示す実行結果信号が比較器5に与えられる。こ
の比較器5には分岐子a−1機構4から分岐子ilN情
報が与えられているので、比較器5は両者が一致しない
ことを判別して、分岐予測失敗信号を次フェッチ命令ア
ドレス指定部6に与える。次フェッチ命令アドレス指定
部6は条件分岐命令を実行した結果、分岐しなかった場
合には、第6図に示す条件分岐命令の次のアドレスa+
cの命令を実行する必要がある。しかし、デコード用プ
ログラムカウンタ62は前述したように、条件分岐命令
が分岐するとT−謝し、分岐先のアドレスa十すを示す
アドレス信号を出力している。このため、次フェッチ命
令アドレス指定部6はデコード用プログラムカウンタ6
2の内容をキャンセルし、セーブレジスタ63にセーブ
したもとのアドレスaを読出してデコード用プログラム
カウンタ62にロードする。さらに、加算器61は命令
長Cをデコード用プログラムカウンタ62の内容に加算
して、アドレスa+cを示すアドレス信号を出力させる
。それによって、メモリからアドレスa+Cに対応する
命令が読出されて、実行機構3によって実行される。
On the other hand, the execution mechanism 3 executes a conditional branch instruction, which branches if a certain condition is met, but does not branch if the condition is not met. For example, when executing a conditional branch instruction that has a condition of branching if the 2 (zero) flag is set, the branch will be taken if the Z flag is set, but the branch will not be taken if the 2 flag is not set. When the execution mechanism 3 executes the conditional branch instruction and the branch is not taken, an execution result signal indicating that the branch is not taken is given to the comparator 5. Since this comparator 5 is given the branch ilN information from the branch a-1 mechanism 4, the comparator 5 determines that the two do not match and sends the branch prediction failure signal to the next fetch instruction address designation section. Give to 6. If the next fetch instruction address designation unit 6 does not branch as a result of executing the conditional branch instruction, the next fetch instruction address specifying unit 6 selects the next address a+ of the conditional branch instruction shown in FIG.
It is necessary to execute the instruction c. However, as described above, when the conditional branch instruction branches, the decoding program counter 62 outputs an address signal indicating the address a and the branch destination. For this reason, the next fetch instruction address designation unit 6 uses the decoding program counter 6.
2 is canceled and the original address a saved in the save register 63 is read out and loaded into the decoding program counter 62. Further, the adder 61 adds the instruction length C to the contents of the decoding program counter 62, and outputs an address signal indicating the address a+c. Thereby, the instruction corresponding to address a+C is read from the memory and executed by the execution mechanism 3.

[発明が解決しようとする問題点] 従来の分岐予測機能ををするデータ処理装置は、上述の
ように構成されているので、分岐の予測が失敗した場合
には、セーブレジスタ63にセーブしたアドレスをデコ
ード用プログラムカウンタ62に転送し、そのアドレス
に命令長を加算するための処理を必要とし、処理が複雑
になってしまうという問題点があった。
[Problems to be Solved by the Invention] A conventional data processing device that performs a branch prediction function is configured as described above, so when a branch prediction fails, the address saved in the save register 63 is saved. This requires processing to transfer the address to the decoding program counter 62 and add the instruction length to the address, resulting in a problem that the processing becomes complicated.

そこで、本願発明者の一部らは、このような問題点を解
決したデータ処理装置を発明し、本出願人は、特願昭6
1−200557号、特願昭204500号において出
願し、さらにそれらの日本国内出願に対して優先権を主
張して、1987年8月26日に米国出願を行なってい
る。その出願において開示された内容は本出願の発明に
対する先行技術として以下に説明される。
Therefore, some of the inventors of the present invention invented a data processing device that solved such problems, and the applicant has filed a patent application in 1983.
No. 1-200557 and Japanese Patent Application No. 204500, and the US application was filed on August 26, 1987, claiming priority to those Japanese applications. The subject matter disclosed in that application is discussed below as prior art to the invention of the present application.

第3図はこの先行技術の一実施例を示す概略ブロック図
である。まず、第3図を参照して、分岐予測機能を杓°
するデータ処理装置の構成について説明する。第3図に
おいて、命令レジスタ1と命令デコーダ2と実行機構)
と分岐予測機構4と加算器61とデコード用プログラム
カウンタ62は前述の第5図に示したものと同じものが
用いられる。レジスタ10は命令デコーダ2によってデ
コードされた命令の命令長をロードするものであり、レ
ジスタ11は同じく命令デコーダ2によってデコードさ
れた命令の分岐変位あるいは命令長をロードするもので
ある。レジスタ11には、その命令が無条件分岐命令ま
たは条件分岐命令である場合には、分岐変位がロードさ
れ、その命令が非分岐命令である場合には、命令長がロ
ードされる。
FIG. 3 is a schematic block diagram showing one embodiment of this prior art. First, refer to Figure 3 and use the branch prediction function.
The configuration of the data processing device will be explained. In Fig. 3, instruction register 1, instruction decoder 2, and execution mechanism)
The same branch prediction mechanism 4, adder 61, and decoding program counter 62 as shown in FIG. 5 are used. The register 10 is used to load the instruction length of the instruction decoded by the instruction decoder 2, and the register 11 is used to load the branch displacement or instruction length of the instruction decoded by the instruction decoder 2. The register 11 is loaded with a branch displacement when the instruction is an unconditional branch instruction or a conditional branch instruction, and loaded with an instruction length when the instruction is a non-branch instruction.

セレクタ12は分岐予測機構4から読出された分岐予測
ビットと、命令が非分岐命令、無条件分岐命令および条
件分岐命令のいずれの命令であるかの情報に基づいて、
レジスタ10の出力とレジスタ11の出力とを切替える
ものである。すなわち、非分岐命令または分岐すること
が予ilNされない条件分岐命令が読出されたときには
、レジスタ10の出力を選択して命令長を加算器61に
与え、無条件分岐命令または分岐することが予測される
条件分岐命令が読出されたときには、レジスタ11の出
力を選択して分岐変位を加算器61に与える。
Based on the branch prediction bits read from the branch prediction mechanism 4 and information on whether the instruction is a non-branch instruction, an unconditional branch instruction, or a conditional branch instruction, the selector 12
The output of the register 10 and the output of the register 11 are switched. That is, when a non-branch instruction or a conditional branch instruction that is not predicted to branch is read, the output of the register 10 is selected and the instruction length is given to the adder 61, and an unconditional branch instruction or a conditional branch instruction that is predicted to branch is selected. When a conditional branch instruction is read out, the output of the register 11 is selected and the branch displacement is given to the adder 61.

命令デコーダ2の出力には、分岐条件コードレジスタ7
とレジスタ13とレジスタ14とが接続サレル。分岐条
件コードレジスタ7は命令デコーダ2によってデコード
された条件分岐命令の分岐条件コードをロードする。レ
ジスタ13は同じくデコードされた無条件分岐命令また
は条件分岐命令の分岐変位、あるいは非分岐命令に対し
ては命令長をロードし、レジスタ14はデコードされた
命令の命令長をロードする。レジスタ13とレジスタ1
4の各出力はセレクタ15に与えられる。
The output of the instruction decoder 2 includes a branch condition code register 7.
and register 13 and register 14 are connected. The branch condition code register 7 loads the branch condition code of the conditional branch instruction decoded by the instruction decoder 2. Register 13 similarly loads the branch displacement of a decoded unconditional branch instruction or conditional branch instruction, or the instruction length for a non-branch instruction, and register 14 loads the instruction length of the decoded instruction. register 13 and register 1
Each output of 4 is given to selector 15.

セレクタ15は分岐予測機構の分岐予測ビットと、命令
が非分岐命令、無条件分岐命令および条件分岐命令のい
ずれの命令であるかの情報に基づいて、レジスタ13の
出力とレジスタ14との出力を切替える。すなわち、非
分岐命令、分岐することが予測されない条件分岐命令お
よび無条件分岐命令のいずれかの命令であれば、レジス
タ13にロードされたデータを選択し、分岐することが
予測される条件分岐命令であれば、レジスタ14にロー
ドされた命令長を選択する。このセレクタ15によって
選択された出力は実行機構3に与えられる。
The selector 15 selects the output of the register 13 and the output of the register 14 based on the branch prediction bit of the branch prediction mechanism and information on whether the instruction is a non-branch instruction, an unconditional branch instruction, or a conditional branch instruction. Switch. In other words, if the instruction is a non-branch instruction, a conditional branch instruction that is not predicted to branch, or an unconditional branch instruction, it is a conditional branch instruction that selects the data loaded into the register 13 and is predicted to branch. If so, select the instruction length loaded into register 14. The output selected by this selector 15 is given to the execution mechanism 3.

分岐条件コードレジスタ7は4ビツトで構成されていて
、上位3ビツトで分岐条件を表わし、最下位1ビツトで
その分岐条件が成立するときに分岐するのか、それとも
不成立のときに分岐するのかを表わす。たとえば、00
00はZ(ゼロ)フラグ成立、つまり演算の結果が0と
なると分岐することを表わすのに対して、0001は2
フラグ不成立、つまり演算の結果が0でないと分岐する
ことを表わす。この分岐条件コードレジスタフの最下位
ビットの出力はセレクタ9に与えられるとともに、イン
バータ8によって反転されてセレクタ9に与えられる。
The branch condition code register 7 consists of 4 bits, the upper 3 bits represent the branch condition, and the lowest 1 bit represents whether to branch when the branch condition is met or not. . For example, 00
00 indicates that the Z (zero) flag is established, that is, a branch occurs when the result of the operation becomes 0, whereas 0001 indicates that the
If the flag is not established, that is, the result of the operation is not 0, it indicates that the process will branch. The output of the least significant bit of this branch condition code register is applied to the selector 9, and is also inverted by the inverter 8 and applied to the selector 9.

セレクタ9は分岐することが予n1されない条件分岐命
令の場合には、分岐条件コードレジスタ7の最下位ビッ
トを選択し、分岐することが予811される条件分岐命
令であればインバータ8の出力を選択して実行機構3に
与える。
The selector 9 selects the least significant bit of the branch condition code register 7 in the case of a conditional branch instruction that is not predicted to branch, and selects the output of the inverter 8 if it is a conditional branch instruction that is predicted to branch. It is selected and given to the execution mechanism 3.

非分岐命令または無条件分岐命令の゛場合には、分岐条
件コードレジスタにどのようなデータが人?ていても実
行機構3はこのデータを無視する。
In the case of a non-branch instruction or an unconditional branch instruction, what kind of data is in the branch condition code register? The execution mechanism 3 ignores this data.

第4図はこの先行技術の一実施例の具体的な動作を説明
するためのフローチャートである。次に、第3図、第4
図および第6図を参照して、この先行技術の一実施例の
具体的な動作について説明する。まず、従来例と同様に
して、デコード用プログラムカウンタ62の内容がアド
レス信号としてアドレスバスに出力され、メモリ(図示
せず)の成る番地から命令が読出されて命令レジスタ1
にロードされる。命令レジスタ1にロードされた命令は
命令デコーダ2によってデコードされ、演算指示信号が
実行機構3に与えられるとともに、デコードされた命令
の命令長がレジスタ10とレジスタ14にロードされる
。実行機構3は与えられた演算指示信号に基づいて実行
処理する。同時に、加算器61はセレクタ12によって
選択された命令長または分岐変位をデコード用プログラ
ムカウンタ62の内容に加算して、次に実行すべき命令
の位置を示すアドレス信号を出力する。このアドレス信
号に基づいて、メモリから次に実行すべき命令が読出さ
れて命令レジスタ1にロードされる。
FIG. 4 is a flowchart for explaining the specific operation of an embodiment of this prior art. Next, Figures 3 and 4
The specific operation of this embodiment of the prior art will be described with reference to FIG. 6 and FIG. First, in the same manner as in the conventional example, the contents of the decoding program counter 62 are outputted as an address signal to the address bus, and an instruction is read from an address in a memory (not shown) to the instruction register 1.
loaded into. The instruction loaded into the instruction register 1 is decoded by the instruction decoder 2, an operation instruction signal is given to the execution mechanism 3, and the instruction length of the decoded instruction is loaded into the register 10 and the register 14. The execution mechanism 3 performs execution processing based on the given calculation instruction signal. At the same time, the adder 61 adds the instruction length or branch displacement selected by the selector 12 to the contents of the decoding program counter 62, and outputs an address signal indicating the position of the next instruction to be executed. Based on this address signal, the next instruction to be executed is read from the memory and loaded into the instruction register 1.

次に、メモリから分岐条件コード“0000”を持つ条
件分岐命令が読出されたものとする。分岐条件コード“
0000”はZ(ゼロ)フラグが立っていれば分岐する
ことを意味している。この命令が読出されると、命令は
デコードされ、その命令が条件分岐命令であることが判
明し、その命令のアドレスの上位8ビツトに対応して分
岐予測機構4に記憶されている分岐予測ビットが分岐す
ることを示していれば、セレクタ12はレジスタ11の
出力を選択し、セレクタ15はレジスタ14の出力を選
択し、セレクタ9はインバータ8の出力を選択する。セ
レクタ12はレジスタ11の出力を選択するので、加算
器61は、第6図に示゛ す分岐変位すをデコード用プ
ログラムカウンタ62の内容に加算する。それによって
、その条件分岐命令の分岐先アドレスa +、bを指し
示すアドレス信号が出力される。このアドレス信号にU
づいてメモリ上の条件分岐命令の分岐先から、次に実行
すべき命令が読出される。すなわち、非分岐命令または
分岐することが予11111されない条件分岐命令では
、レジスタ10にロードされている命令長Cが加算器6
1によってデコード用プログラムカウンタ62の内容に
加算されるが、無条件分岐命令または分岐することが予
測される条件分岐命令の場合には、レジスタ11にロー
ドされた分岐度′位すが加算器61によってデコード用
プログラムカウンタ62の内容に加算される。一方、セ
レクタ15は分岐することが予測される条件分岐命令の
場合にはレジスタ14の命令長Cを、非分岐命令、無条
件分岐命令または分岐することが予測されない条件分岐
命令の場合には、レジスタ13の出力を選択する。この
ようして、デコードされた命令が分岐することが予測さ
れる条件分岐命令の場合、入替機構により命令長と分岐
変位とが入替えられることになる。ここで、入替機構と
はレジスタ10.11.13.14とセレクタ12,1
5を含む概念上の機構である。
Next, it is assumed that a conditional branch instruction having a branch condition code "0000" is read from the memory. Branch condition code “
0000" means that a branch will occur if the Z (zero) flag is set. When this instruction is read, the instruction is decoded and found to be a conditional branch instruction. If the branch prediction bits stored in the branch prediction mechanism 4 corresponding to the upper 8 bits of the address indicate a branch, the selector 12 selects the output of the register 11, and the selector 15 selects the output of the register 14. The selector 9 selects the output of the inverter 8.The selector 12 selects the output of the register 11, so the adder 61 uses the contents of the program counter 62 for decoding the branch displacement shown in FIG. As a result, an address signal indicating the branch destination address a +, b of the conditional branch instruction is output.
Then, the next instruction to be executed is read from the branch destination of the conditional branch instruction on the memory. That is, in a non-branch instruction or a conditional branch instruction that is not predicted to branch, the instruction length C loaded in the register 10 is
1 is added to the contents of the decoding program counter 62. However, in the case of an unconditional branch instruction or a conditional branch instruction predicted to branch, the branch degree 'loaded to the register 11 is added to the contents of the decoding program counter 62. is added to the contents of the decoding program counter 62. On the other hand, the selector 15 sets the instruction length C of the register 14 in the case of a conditional branch instruction that is predicted to branch, and in the case of a non-branch instruction, an unconditional branch instruction, or a conditional branch instruction that is not predicted to branch. Select the output of register 13. In this way, if the decoded instruction is a conditional branch instruction that is predicted to branch, the instruction length and branch displacement are swapped by the swapping mechanism. Here, the switching mechanism is register 10.11.13.14 and selector 12, 1.
It is a conceptual mechanism that includes 5.

また、命令デコーダ2によってデコードされた命令の分
岐条件コード゛0000“は分岐条件コードレジスタ7
にロードされる。この場合、分岐することが予測されて
いるので、この分、岐条件コードレジスタ7の上位3ビ
ツトは実行機構3に与えられ、最下位1ビツトはインバ
ータ8によって反転されたものが、セレクタ9を介して
実行機構3に与えられる。すなわち、分岐条件コード“
00001の最下位1ビツトがインバータ8によって反
転され、分岐条件コード′0001”として実行機構3
にり、えられることになる。これはZフラグが立ってい
なければ分岐することを示している。
Further, the branch condition code "0000" of the instruction decoded by the instruction decoder 2 is stored in the branch condition code register 7.
loaded into. In this case, since a branch is predicted, the upper 3 bits of the branch condition code register 7 are given to the execution unit 3, and the lower 1 bit is inverted by the inverter 8 and sent to the selector 9. It is given to the execution mechanism 3 via the In other words, the branch condition code “
The least significant bit of 00001 is inverted by the inverter 8 and sent to the execution mechanism 3 as the branch condition code '0001'.
You will be saved. This indicates that the process will branch if the Z flag is not set.

実行機構3は、図示されていないが加算器とプログラム
カウンタを有していて、プログラムカウンタは条件分岐
命令のアドレスaを指定し、加算器はレジスタ14にロ
ードされた命令長Cをプログラムカウンタに加算する。
The execution mechanism 3 has an adder and a program counter (not shown), the program counter specifies the address a of the conditional branch instruction, and the adder specifies the instruction length C loaded into the register 14 to the program counter. to add.

一方、命令レジスタ1にはメモリから条件分岐命令に続
いて実行されるべき命令が読出されてロードされている
。この場合、条件分岐命令が分岐すると予測されたもの
であり、命令レジスタ1にはメモリ上のアドレスa+b
の命令がロードされている。実行機構3でZフラグが立
っていなかった場合には、分岐条件コード“0001”
を持ち、分岐食位すが命令長Cに置換えられた条件分岐
命令が実行機構3で実行され、アドレスa+Cに分岐を
起こす。これは、もともとの条件分岐命令に対する分岐
を起こすという予測が結果的に誤っていたことになる。
On the other hand, the instruction to be executed following the conditional branch instruction is read from the memory and loaded into the instruction register 1. In this case, the conditional branch instruction is predicted to branch, and instruction register 1 contains address a+b on memory.
instructions are loaded. If the Z flag is not set in execution mechanism 3, the branch condition code is “0001”.
A conditional branch instruction with a branch position and instruction length C is executed by the execution unit 3, causing a branch to address a+C. This means that the original prediction that a branch would occur in response to a conditional branch instruction was incorrect.

この結果、命令レジスタ1にロードされていたメモリ上
のアドレスa十すに位置する命令はキャンセルされ、メ
モリ上のアドレスa十Cの命令が読出され、この命令が
命令レジスタ1にロードされる。
As a result, the instruction located at address a~C on the memory that had been loaded into the instruction register 1 is canceled, the instruction at address a~C on the memory is read out, and this instruction is loaded into the instruction register 1.

一方、実行機構3でZフラグが立っていた場合には、分
岐条件コード“0001″を持つ条件分岐命令は実行機
構3で実行されても分岐しない。これは、もともとの条
件分岐命令に対する分岐を起こすという予aPIが結果
的に正しかったことになる。
On the other hand, if the Z flag is set in the execution mechanism 3, the conditional branch instruction with the branch condition code "0001" will not branch even if executed by the execution mechanism 3. This means that the aPI that caused a branch in response to the original conditional branch instruction was correct as a result.

その結果、命令レジスタ1にロードされていたメモリ上
のアドレスa+bに位置する命令は有効であり、そのま
ま命令デコーダ2、実行機構3の方へ移され、処理され
る。
As a result, the instruction located at address a+b on the memory that had been loaded into the instruction register 1 is valid and is transferred as is to the instruction decoder 2 and execution mechanism 3 for processing.

なお、メモリ上のアドレスaに位置する非分岐命令が読
出された場合には、それが命令レジスタ1にロードされ
、命令デコーダ2でデコードされ、非分岐命令であるこ
とが判明すると、分岐予測機構4で分岐Ta1llを行
ない、分岐?’ilF+ビットがどんな値を示しても、
デコード用プログラムカウンタ62には命令長Cが加算
され、デコード用プログラムカウンタ62はa+Cのア
ドレスを指し示し、この非分岐命令に続いてメモリ上の
アドレスa+Cの命令が読出される。
Note that when a non-branch instruction located at address a on the memory is read, it is loaded into the instruction register 1, decoded by the instruction decoder 2, and if it is found to be a non-branch instruction, the branch prediction mechanism Execute branch Ta1ll at 4 and branch? 'No matter what value the ilF+ bit indicates,
The instruction length C is added to the decoding program counter 62, the decoding program counter 62 points to address a+C, and following this non-branch instruction, the instruction at address a+C on the memory is read.

また、メモリ上のアドレスaに位置する無条件゛ 分岐
命令が読出された場合には、それが命令レジスタ1にロ
ードされ、命令デコーダ2でデコードされ、無条件分岐
命令であることが判明すると、分岐予測機構4で分岐r
測を行ない、分岐予測ビットがどんな値を示しても、デ
コード用プログラムカウンタ62には分岐変位すが加算
され、デコード用プログラムカウンタ62はa+bのア
ドレスを指し示し、この無条件分岐命令に続いてメモリ
上のアドレスa十すの命令が読出される。
Furthermore, when an unconditional branch instruction located at address a on the memory is read, it is loaded into the instruction register 1 and decoded by the instruction decoder 2, and if it is found to be an unconditional branch instruction, Branch r with branch prediction mechanism 4
No matter what value the branch prediction bit indicates, the branch displacement value is added to the decoding program counter 62, the decoding program counter 62 points to address a+b, and following this unconditional branch instruction, the branch displacement is added to the decoding program counter 62. The instruction at the upper address a is read out.

以上述べたように、分岐予測機能を用いることにより、
分岐する可能性の高い条件分岐命令をパイプラインのデ
コード段階で判断し、その命令が実行される前に分岐さ
せることにより分岐命令によるパイプラインの乱れを少
なくし、処理効率を上げることができる。
As mentioned above, by using the branch prediction function,
By determining conditional branch instructions that are likely to branch at the pipeline decoding stage and branching before the instructions are executed, it is possible to reduce pipeline disturbances caused by branch instructions and improve processing efficiency.

また、上述のような先行技術によれば、条件分岐命令が
分岐することが予測されると、インバータ8によって条
件分岐命令の分岐条件コードの最下位ビットを反転し、
分岐変位と命令長とを入替えて実行機構3で実行する。
Further, according to the prior art as described above, when a conditional branch instruction is predicted to branch, the inverter 8 inverts the least significant bit of the branch condition code of the conditional branch instruction,
The branch displacement and instruction length are exchanged and executed by the execution mechanism 3.

そうすることによって、条件分岐命令が分岐することを
予測し、その子n1が外れても、実行機構3はプログラ
ム上の条件分岐命令の次に位置する命令へ分岐するよう
にしているため、従来例のような複雑な処理を必要とせ
ず、比較的簡単な方法により分岐予測と、それに付随す
る処理を行なうことができる。
By doing so, even if the conditional branch instruction predicts a branch and its child n1 misses, the execution mechanism 3 branches to the instruction next to the conditional branch instruction in the program, so the conventional example Branch prediction and associated processing can be performed using a relatively simple method without requiring such complicated processing.

しかしながら、システムのリセットなどにより、分岐子
Δ11機構の分岐予測ビットがクリアされた場合、新た
に分岐や1lFIの登録が行なわれるまで、分岐を起こ
さないと千aされることになり、分岐予測機能の効果が
得られない。つまり、上述の従来例および先行技術例で
示される分岐r瀾機構とは、命令をデコードした結果、
その命令が条件分岐命令であると判断された場合、その
条−件分岐命令が以前に実行されたときに実際に分岐し
たかどうかの履歴に従って合同分岐するかを予測し、分
岐すると予測した場合は命令の取込光を分岐先に変更す
る機構である。そのため、条件分岐命令が実行され、実
際に分岐が起こったときに初めて、分岐予測のテーブル
の登録が行なわれるので、それまではその条件分岐命令
に対しては分岐を予測することができない。
However, if the branch prediction bit of the branch Δ11 mechanism is cleared due to a system reset, etc., the branch prediction function will be disabled unless the branch occurs until a new branch or 1lFI is registered. effect cannot be obtained. In other words, the branch r-run mechanism shown in the above-mentioned conventional example and prior art example is such that as a result of decoding an instruction,
If the instruction is determined to be a conditional branch instruction, it is predicted whether the conditional branch instruction will take a joint branch based on the history of whether or not it actually took a branch when it was previously executed, and if it is predicted that the instruction will take a branch. is a mechanism that changes the instruction capture light to the branch destination. Therefore, the branch prediction table is registered only when a conditional branch instruction is executed and a branch actually occurs, and until then, a branch cannot be predicted for that conditional branch instruction.

そこで、この発明は上記の問題点を解消するためになさ
れたもので、履歴に°よって分岐を予−−1することが
できない場合にも分岐予測を容品に行なうことができる
とともに、高速に処理を行なう分岐’j’DI機能を有
するデータ処理装置を提供することを目的とする。
Therefore, this invention was made to solve the above-mentioned problems, and allows branch prediction to be easily performed even when a branch cannot be predicted based on the history, and at high speed. It is an object of the present invention to provide a data processing device having a branch 'j' DI function for processing.

[問題点を解決するための手段] この発明に従った分岐予測機能を有するデータ処理装置
は以下の手段を備えている。
[Means for Solving the Problems] A data processing device having a branch prediction function according to the present invention includes the following means.

(ム)  命令を取出し、その命令を解読する命令取出
・解読手段。
(M) Instruction fetching/deciphering means for fetching and deciphering instructions.

(b)  この命令取出・解読手段によって解読された
命令をバイブライン処理の原理で実行する命令実行手段
(b) Instruction execution means for executing the instructions decoded by the instruction fetching/decoding means on the principle of Vibration processing.

(c)  この命令取出・解読手段によって取出および
解読されるべき命令が条件分岐命令であって、その条件
分岐命令が分岐を起こすか否かをY・測する分岐子11
11手段。
(c) The instruction to be fetched and decoded by this instruction fetching and decoding means is a conditional branch instruction, and a branching element 11 that measures whether or not the conditional branch instruction causes a branch.
11 means.

(d)  この分岐予測手段の予測結果に基づいて、条
件分岐命令によって示される分岐先の命令までの変位と
、条件分岐命令の命令長とを入替える入替手段。
(d) Swapping means for swapping the displacement to the branch destination instruction indicated by the conditional branch instruction and the instruction length of the conditional branch instruction based on the prediction result of the branch prediction means.

そして、上記分岐子7IP1手段は、前回までの処理に
おける分岐結果により分岐を起こすか否かを予測する第
1の分岐予測手段と、命令取出・解読手段によって解読
された命令の分岐条件より分岐を起こすか否かを予測す
る第2の分岐予測手段とからなっている。また、この第
1の分岐予測手段によって分岐を起こすか否かを予測す
ることができないとき、第2の分岐予測手段によって分
岐を起こすか否かを予測するものである。
The branching device 7IP1 means includes a first branch prediction means for predicting whether or not a branch will occur based on the branch result in the previous processing, and a first branch prediction means for predicting whether or not a branch will occur based on the branch result in the previous processing, and a branch prediction means for predicting whether or not a branch will occur based on the branch condition of the instruction decoded by the instruction fetching/decoding means. and a second branch prediction means for predicting whether or not the branch will occur. Furthermore, when the first branch prediction means cannot predict whether or not a branch will occur, the second branch prediction means predicts whether or not a branch will occur.

[作用] この発明における分岐子aP1機能を有するデータ処理
装置は、命令取出・解読手段によって解読された命令の
分岐条件より分岐を起こすか否かを予測する第2の分岐
子n1手段を備えている。この第2の分岐予測手段を付
加することにより、履歴による分岐予測が不可能な場合
でも分岐予測を行なうことができる。このため、従来の
分岐予測機能を有するデータ処理装置よりもさらに分岐
子111Jの的中率が向上する。
[Operation] The data processing device having the branching element aP1 function according to the present invention includes second branching element n1 means for predicting whether or not a branch will occur based on the branch condition of the instruction decoded by the instruction fetching/decoding means. There is. By adding this second branch prediction means, branch prediction can be performed even when branch prediction based on history is impossible. Therefore, the hit rate of the branch element 111J is further improved than in a data processing device having a conventional branch prediction function.

[発明の実施例] 以上、この発明の一実施例を図について説明する。第1
図はこの発明の一実施例を示す概略ブロック図である。
[Embodiment of the Invention] An embodiment of the present invention will be described above with reference to the drawings. 1st
The figure is a schematic block diagram showing one embodiment of the present invention.

第2図は第1図に示す履歴による分岐]−測機構4の記
憶内容の構成を説明するための図である。次に、第1図
および第2図を参照して、この発明の一実施例の構成に
ついて説明する。
FIG. 2 is a diagram for explaining the structure of the storage contents of the branching based on the history shown in FIG. 1. Next, the configuration of an embodiment of the present invention will be described with reference to FIGS. 1 and 2.

第1図は、本発明による分岐予測機構を備えたパイプラ
イン方式のデータ処理装置を示す概略ブロック図である
。図において、先行技術例を示す第3図と同一の符号は
同一または同等の機能部分を示す。履歴による分岐予測
機構4は従来例および先行技術例にもある、履歴によっ
て分岐を予測する機構であるが、この発明の実施例にお
いては分岐予測ビットの他に分岐子11111不n1ビ
ットを有している。この履歴による分岐]’ ilN機
構4の構成は第2図に示されている。この分岐]’ M
FI機構4によれば、1つのエントリは分岐命令の先頭
番地の下位8ビツトに対応して分岐]−測ビットと分岐
1−静1不可ビットとが対になった形になっている。こ
の分岐予測機構4が初期化されると、すべてのエントリ
において分岐予測不可ビットがセットされる。
FIG. 1 is a schematic block diagram showing a pipeline data processing device equipped with a branch prediction mechanism according to the present invention. In the figure, the same reference numerals as in FIG. 3 showing the prior art example indicate the same or equivalent functional parts. The branch prediction mechanism 4 based on history is a mechanism for predicting branches based on history, which is also present in conventional examples and prior art examples, but in the embodiment of the present invention, in addition to the branch prediction bit, it has a branch child 11111 nonn1 bit. ing. Branching based on this history]' The configuration of the ilN mechanism 4 is shown in FIG. This branch]' M
According to the FI mechanism 4, one entry is a pair of branch]-measurement bit and branch1-static1 disable bit corresponding to the lower 8 bits of the start address of the branch instruction. When this branch prediction mechanism 4 is initialized, branch unpredictability bits are set in all entries.

この分岐予測不可ビットが立っている間は、分岐予測ビ
ットは無意味なものとみなされる。成る1つの条件分岐
命令が実行され、その結果が履歴による分岐予測機構4
に登録されると、その条件分岐命令の先頭番地の下位8
ビツトに対応する分岐子apl不可ビットはクリアされ
る。以上の2種類のビットに対応して、履歴による分岐
子a−1機構4より第1の分岐予測信号線22と分岐予
測不可信号線23とが出力される。また、このデータ処
理装置は履歴によらない分岐予測機構20も備えている
。この履歴によらない分岐予測機構20は、分岐条件コ
ードレジスタ7より4ビツトの分岐条件コードを取込み
、そのパターンに応じて第2の分岐予測信号線24を出
力する。この場合、4ビツトの条件の組合わせは16通
りであるので、この分岐予測機構20は単純な組合わせ
回路で実現できる。また、回路をアドレス幅4ビツトの
ROMとしても実現できる。分岐条件コードがどのパタ
ーンのときに分岐が起こると予測するかはチップ設計者
が決めればよい。あるいは、この分岐予測機構20をR
AMで構成しておき、システム立上げ時にどの条件で分
岐を起こすと予測するかを設定するようにしてもよい。
While this branch unpredictability bit is set, the branch prediction bit is considered meaningless. One conditional branch instruction consisting of
, the lower 8 of the first address of the conditional branch instruction
The branch apl disable bit corresponding to the bit is cleared. Corresponding to the above two types of bits, a first branch prediction signal line 22 and a branch prediction unpredictability signal line 23 are output from the branch element a-1 mechanism 4 based on the history. This data processing device also includes a branch prediction mechanism 20 that does not rely on history. This history-independent branch prediction mechanism 20 takes in a 4-bit branch condition code from the branch condition code register 7, and outputs a second branch prediction signal line 24 according to the pattern. In this case, since there are 16 combinations of 4-bit conditions, this branch prediction mechanism 20 can be realized with a simple combinational circuit. Further, the circuit can also be realized as a ROM with an address width of 4 bits. It is up to the chip designer to decide which branch condition code pattern will cause a branch to occur. Alternatively, this branch prediction mechanism 20 may be
It is also possible to configure AM, and to set under what conditions a branch is predicted to occur when the system is started up.

セレクタ21は、分岐予測不可信号線23からの信号の
状態に応じて、履歴による分岐予測機構4からの第1の
分岐予測f二号線22、および履歴によらない分岐予測
機構20からの第2の分岐r−611,i帰線24のい
ずれかの信号線を選択する。ここで選択された結果は、
先行技術例と同様に命令デコーダ2で条件分岐命令がデ
コードされたときのみ有効となる。
The selector 21 selects the first branch prediction f2 line 22 from the history-based branch prediction mechanism 4 and the second branch prediction line 22 from the history-based branch prediction mechanism 20, depending on the state of the signal from the branch prediction impossible signal line 23. Select one of the signal lines of branch r-611 and i retrace line 24. The result selected here is
Similar to the prior art example, this becomes valid only when the instruction decoder 2 decodes a conditional branch instruction.

次に、この発明の一実施例の具体的な動作について説明
する。デコードされた命令が条件分岐命令でない場合、
またはデコードされた命令が条件分岐命令であり、かつ
履歴による分岐子al1機構4からの分岐予測不可信号
線23からの信号がOFF状態の場合は、先行技術例と
全く同じ動作をするので本説明では省略することにする
。ここでは、先行技術例と異なる場合、すなわち、デコ
ードされた命令が条件分岐命令であり、かつ履歴による
分岐予測機構4からの分岐予測不可信号線23からの信
号がON状態の場合を説明する。ここで、この分岐予測
不可信号線23からの信号は履歴による分岐子111J
機構4にまだ分岐予測が登録されていない場合にはON
状態を示し、分岐予測が登録されているとOFF状態を
示す。したがって、分岐子1lF1不可信号線23から
の信号がOFF状態の場合は履歴による分岐予測結果が
有効となり、ON状態の場合は本発明における履歴によ
らない分岐予測結果が有効となる。
Next, the specific operation of one embodiment of the present invention will be explained. If the decoded instruction is not a conditional branch instruction,
Alternatively, if the decoded instruction is a conditional branch instruction and the signal from the branch unpredictability signal line 23 from the history-based branch element al1 mechanism 4 is in the OFF state, the operation is exactly the same as the prior art example, so this explanation will be given. I will omit it here. Here, a case different from the prior art example will be described, that is, a case where the decoded instruction is a conditional branch instruction and the signal from the branch prediction impossible signal line 23 from the history-based branch prediction mechanism 4 is in the ON state. Here, the signal from this branch unpredictability signal line 23 is the branch element 111J based on the history.
ON if branch prediction is not registered in mechanism 4 yet.
It shows the state, and if a branch prediction is registered, it shows an OFF state. Therefore, when the signal from the branch element 11F1 disable signal line 23 is in the OFF state, the branch prediction result based on the history is valid, and when the signal is in the ON state, the branch prediction result not based on the history in the present invention is valid.

メモリ(図示せず)から分岐条件コード“0000゛を
持つ条件分岐命令が読出されたものとする。分岐条件コ
ード“0000”は2(ゼロ)フラグが立っていれば分
岐することを意味している。
Assume that a conditional branch instruction with a branch condition code "0000" is read from memory (not shown).The branch condition code "0000" means that the branch will occur if the 2 (zero) flag is set. There is.

この命令が読出されると、命令はデコードされ、その命
令が条件分岐命令であることが判明する。
When this instruction is read, it is decoded and found to be a conditional branch instruction.

このとき、履歴による分岐予測機構4の分岐予測ビット
と分岐予測不可ビットとが第1の分岐子71p3信号線
22および分岐子ハ1不可信号線23に出力される。こ
の場合、出力された分岐子1I−1不可信号線23から
の信号はON状態になっている。すなわち、履歴による
分岐予測機構4に分岐予測がまだ登録されておらず、こ
の分岐予測機構4では予測lJできない状態である。
At this time, the branch prediction bit and branch unpredictability bit of the branch prediction mechanism 4 based on history are output to the first branch 71p3 signal line 22 and the branch C1 unpredictability signal line 23. In this case, the output signal from the branch 1I-1 disable signal line 23 is in the ON state. That is, the branch prediction has not yet been registered in the branch prediction mechanism 4 based on history, and this branch prediction mechanism 4 is in a state where it cannot make a prediction.

一方、履歴によらない分岐予測機構20は分岐条件コー
ドレジスタ7より4ビツトの分岐条件コード“0000
“を取出し、この分岐条件コードのパターンより第2の
分岐予測信号線24に出力する信号を決定する。コード
“0000”は分岐を起こすと’?’ilF+するよう
に設定されているものとする。
On the other hand, the branch prediction mechanism 20 that does not depend on the history receives the 4-bit branch condition code "0000" from the branch condition code register 7.
" is extracted, and the signal to be output to the second branch prediction signal line 24 is determined based on the pattern of this branch condition code. It is assumed that the code "0000" is set so that '?'ilF+ occurs when a branch occurs. .

このとき、セレクタ21は分岐子ΔIII不r予測信号
線23からの信号がON状態であるので履歴によらない
分岐予測機構20からの第2の分岐]′−δp1信号線
24を選択する。その結果、分岐が起こると予測された
ことになる。この後の処理は、先行技術例において分岐
が起こると予測された場合と同じである。
At this time, the selector 21 selects the second branch ]'-δp1 signal line 24 from the branch prediction mechanism 20 that does not depend on the history, since the signal from the branch ΔIII unr prediction signal line 23 is in the ON state. As a result, the branch is predicted to occur. The subsequent processing is the same as when a branch is predicted to occur in the prior art example.

[発明の効果] 以上のように、この発明によれば、履歴による第1の分
岐予測機構を備えたデータ処理装置において、さらに履
歴によらない分岐条件より分岐を予測する第2の分岐予
測機構を付加することにより、履歴による分岐予測が不
可能な場合でも分岐予測が可能となり、予測が当たる確
率が向上するため、より高速なデータ処理速度が得られ
、システムの性能が向上する。
[Effects of the Invention] As described above, according to the present invention, in a data processing device equipped with a first branch prediction mechanism based on history, a second branch prediction mechanism that predicts a branch based on a branch condition not based on history is further provided. By adding , branch prediction becomes possible even when branch prediction based on history is impossible, and the probability of a correct prediction increases, resulting in faster data processing speed and improved system performance.

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

第1図はこの発明の一実施例の概略ブロック図、第2図
は第1図に示す履歴による分岐r測機構の記憶内容の構
成を示す構成図、第3図はこの発明の先行技術例を示す
概略ブロック図、第4図はこの発明の先行技術例の具体
的な動作を説明するためのフローチャート、第5図は従
来の分岐予測機能を有するデータ処理装置を示す概略ブ
ロック図、第6図は分岐予測機能を説明するためのメモ
リ内でのアドレスの関係を示す関係図である。 図において、1は命令レジスタ、2は命令デコーダ、3
は実行機構、4は履歴による分岐予測機構、7は分岐条
件コードレジスタ、8はインバータ、9,12,15.
21はセレクタ、10,11.13.14はレジスタ、
20は履歴によらない分岐子1N機構、61は加算器、
62はデコード用プログラムカウンタである。 なお、各図中、同一符号は同一または相当部分を示す。
FIG. 1 is a schematic block diagram of an embodiment of the present invention, FIG. 2 is a configuration diagram showing the structure of the memory contents of the branch r measurement mechanism based on the history shown in FIG. 1, and FIG. 3 is an example of prior art of the present invention. FIG. 4 is a flowchart for explaining the specific operation of the prior art example of the present invention, FIG. 5 is a schematic block diagram showing a conventional data processing device having a branch prediction function, and FIG. The figure is a relationship diagram showing the relationship of addresses in memory to explain the branch prediction function. In the figure, 1 is an instruction register, 2 is an instruction decoder, and 3 is an instruction register.
is an execution mechanism, 4 is a branch prediction mechanism based on history, 7 is a branch condition code register, 8 is an inverter, 9, 12, 15 .
21 is a selector, 10, 11.13.14 are registers,
20 is a branch 1N mechanism that does not depend on history, 61 is an adder,
62 is a decoding program counter. In each figure, the same reference numerals indicate the same or corresponding parts.

Claims (11)

【特許請求の範囲】[Claims] (1)分岐予測機能を有するデータ処理装置であって、 命令を取出し、その命令を解読する命令取出・解読手段
と、 前記命令取出・解読手段によって解読された命令をパイ
プライン処理の原理で実行する命令実行手段と、 前記命令取出・解読手段によって取出および解読される
べき命令が条件分岐命令であって、その条件分岐命令が
分岐を起こすか否かを予測する分岐予測手段と、 前記分岐予測手段の予測結果に基づいて、前記条件分岐
命令によって示される分岐先の命令までの変位と、前記
条件分岐命令の命令長とを入替える入替手段とを備え、
さらに 前記分岐予測手段は、前回までの処理における分岐結果
により分岐を起こすか否かを予測する第1の分岐予測手
段と、前記命令取出・解読手段によって解読された命令
の分岐条件より分岐を起こすか否かを予測する第2の分
岐予測手段とからなり、 前記第1の分岐予測手段によって分岐を起こすか否かを
予測することができないとき、前記第2の分岐予測手段
によって分岐を起こすか否かを予測するものである、分
岐予測機能を有するデータ処理装置。
(1) A data processing device having a branch prediction function, comprising an instruction fetching/decoding means for fetching an instruction and decoding the instruction, and executing the instruction decoded by the instruction fetching/deciphering means on the principle of pipeline processing. the instruction to be fetched and decoded by the instruction fetch/decipher means is a conditional branch instruction, branch prediction means for predicting whether or not the conditional branch instruction will cause a branch; a replacement means for replacing a displacement to a branch destination instruction indicated by the conditional branch instruction and an instruction length of the conditional branch instruction, based on a prediction result of the means;
Further, the branch prediction means includes a first branch prediction means for predicting whether or not to take a branch based on the branch result in the previous processing, and a first branch prediction means for predicting whether or not to take a branch based on the branch result in the previous processing, and a branch prediction means for taking a branch based on the branch condition of the instruction decoded by the instruction fetching/decoding means. and a second branch prediction means for predicting whether or not to take a branch, and when the first branch prediction means cannot predict whether or not to take a branch, the second branch prediction means determines whether to take a branch. A data processing device having a branch prediction function that predicts whether the branch is negative or not.
(2)前記第1の分岐予測手段は、前記条件分岐命令の
番地に対応して、 前回までの処理における分岐結果によって前記条件分岐
命令が分岐するか否かを予測するための予測ビットと、 前回までの処理における分岐結果によって前記条件分岐
命令が分岐するか否かを予測することができるか否かを
示す予測不可ビットとを記憶するための手段を備え、さ
らに、 前記予測ビットと前記予測不可ビットとに応じて、第1
の分岐予測信号と分岐予測不可信号とを出力するもので
ある、特許請求の範囲第1項に記載の分岐予測機能を有
するデータ処理装置。
(2) The first branch prediction means includes a prediction bit, corresponding to the address of the conditional branch instruction, for predicting whether or not the conditional branch instruction will branch based on the branch result in the previous processing; and an unpredictability bit indicating whether or not it is possible to predict whether or not the conditional branch instruction will branch based on the branch result in the previous processing, further comprising means for storing the prediction bit and the prediction. Depending on the disable bit, the first
A data processing device having a branch prediction function according to claim 1, which outputs a branch prediction signal and a branch unpredictability signal.
(3)前記第2の分岐予測手段は、前記命令取出・解読
手段によって解読された命令の分岐条件コードのパター
ンに応じて第2の分岐予測信号を出力するものである、
特許請求の範囲第2項に記載の分岐予測機能を有するデ
ータ処理装置。
(3) The second branch prediction means outputs a second branch prediction signal according to the pattern of the branch condition code of the instruction decoded by the instruction fetching/decoding means.
A data processing device having a branch prediction function according to claim 2.
(4)前記分岐予測手段は、前記第1の分岐予測手段か
ら出力される前記第1の分岐予測信号と、 前記第2の分岐予測手段から出力される前記第2の分岐
予測信号とのいずれかを、 前記第1の分岐予測手段から出力される前記分岐予測不
可信号に応じて選択するための第1の選択手段を含む、
特許請求の範囲第3項に記載の分岐予測機能を有するデ
ータ処理装置。
(4) The branch prediction means is configured to select one of the first branch prediction signal outputted from the first branch prediction means and the second branch prediction signal outputted from the second branch prediction means. a first selection means for selecting a branch prediction impossible signal outputted from the first branch prediction means;
A data processing device having a branch prediction function according to claim 3.
(5)前記命令取出・解読手段は、前記命令を記憶する
ための命令レジスタと、 前記命令レジスタに記憶された命令を解読し、少なくと
も命令長と変位を出力する命令デコーダとを備えるもの
である、特許請求の範囲第1項ないし第4項のいずれか
に記載の分岐予測機能を有するデータ処理装置。
(5) The instruction fetching/decoding means includes an instruction register for storing the instruction, and an instruction decoder for decoding the instruction stored in the instruction register and outputting at least an instruction length and displacement. , A data processing device having a branch prediction function according to any one of claims 1 to 4.
(6)前記入替手段は、前記命令取出・解読手段によっ
て解読された命令長を記憶するための第1のレジスタと
、 前記命令取出・解読手段によって解読された変位を記憶
するための第2のレジスタと、 前記分岐予測手段によって分岐が予測されるのに応じて
、前記第2のレジスタに記憶された変位を選択するため
の第2の選択手段とを備えるものである、特許請求の範
囲第1項ないし第5項のいずれかに記載の分岐予測機能
を有するデータ処理装置。
(6) The rewriting means includes a first register for storing an instruction length decoded by the instruction fetching and decoding means, and a second register for storing a displacement decoded by the instruction fetching and decoding means. A register as claimed in claim 1, comprising: a register; and second selection means for selecting a displacement stored in said second register in response to a branch predicted by said branch prediction means. A data processing device having a branch prediction function according to any one of items 1 to 5.
(7)当該データ処理装置は、次の命令の番地を計算す
るための番地計算手段と、 前記第2の選択手段によって選択された変位を前記番地
計算手段に付与し、前記番地計算手段によって示された
アドレス値にその変位を加算するための加算手段とをさ
らに備えているものである、特許請求の範囲第6項に記
載の分岐予測機能を有するデータ処理装置。
(7) The data processing device includes an address calculation means for calculating the address of the next instruction, and a displacement selected by the second selection means, which is given to the address calculation means, and is indicated by the address calculation means. 7. A data processing device having a branch prediction function according to claim 6, further comprising an adding means for adding the displacement to the address value obtained by the branch prediction function.
(8)前記第2の選択手段は、分岐が前記分岐予測手段
によって予測されないとき、または前記命令が非分岐命
令であるとき、前記第1のレジスタに記憶された命令長
を出力するための手段を備えるものである、特許請求の
範囲第6項または第7項に記載の分岐予測機能を有する
データ処理装置。
(8) The second selection means outputs the instruction length stored in the first register when a branch is not predicted by the branch prediction means or when the instruction is a non-branch instruction. A data processing device having a branch prediction function according to claim 6 or 7.
(9)前記入替手段は、前記命令取出・解読手段によっ
て解読された命令長を記憶するための第3のレジスタと
、 前記命令取出・解読手段によって解読された変位を記憶
するための第4のレジスタと、 前記分岐予測手段によって分岐が予測されるのに応じて
、前記第3のレジスタに記憶された命令長を前記命令実
行手段に付与するための第3の選択手段とを備えるもの
である、特許請求の範囲第1項ないし第8項のいずれか
に記載の分岐予測機能を有するデータ処理装置。
(9) The rewriting means includes a third register for storing the instruction length decoded by the instruction retrieval/decoding means, and a fourth register for storing the displacement decoded by the instruction retrieval/decoding means. and a third selection means for giving the instruction length stored in the third register to the instruction execution means in response to a branch being predicted by the branch prediction means. , A data processing device having a branch prediction function according to any one of claims 1 to 8.
(10)前記第3の選択手段は、分岐が前記分岐予測手
段によって予測されないとき、または前記命令が非分岐
命令であるとき、前記第4のレジスタに記憶された変位
を出力し、その変位を前記命令実行手段に付与するため
の手段を備えるものである、特許請求の範囲第9項に記
載の分岐予測機能を有するデータ処理装置。
(10) When a branch is not predicted by the branch prediction means, or when the instruction is a non-branch instruction, the third selection means outputs the displacement stored in the fourth register, and selects the displacement. 10. A data processing device having a branch prediction function according to claim 9, further comprising means for imparting a branch prediction function to said instruction execution means.
(11)前記入替手段は、前記分岐予測手段の予測結果
に基づいて、前記条件分岐命令の分岐条件を変更するた
めの分岐条件変更手段を備えるものである、特許請求の
範囲第1項ないし第10項のいずれかに記載の分岐予測
機能を有するデータ処理装置。
(11) The replacing means includes branch condition changing means for changing the branch condition of the conditional branch instruction based on the prediction result of the branch predicting means. A data processing device having a branch prediction function according to any one of Item 10.
JP26497487A 1987-10-20 1987-10-20 Data processing device having branch prediction function Expired - Fee Related JPH0760386B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP26497487A JPH0760386B2 (en) 1987-10-20 1987-10-20 Data processing device having branch prediction function

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP26497487A JPH0760386B2 (en) 1987-10-20 1987-10-20 Data processing device having branch prediction function

Publications (2)

Publication Number Publication Date
JPH01106227A true JPH01106227A (en) 1989-04-24
JPH0760386B2 JPH0760386B2 (en) 1995-06-28

Family

ID=17410797

Family Applications (1)

Application Number Title Priority Date Filing Date
JP26497487A Expired - Fee Related JPH0760386B2 (en) 1987-10-20 1987-10-20 Data processing device having branch prediction function

Country Status (1)

Country Link
JP (1) JPH0760386B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007317083A (en) * 2006-05-29 2007-12-06 Nec Computertechno Ltd Microprocessor and pipeline control method

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR3016538B1 (en) 2014-01-20 2016-07-15 Constellium France PROCESS FOR MANUFACTURING A BOX, METAL BOTTLE OR AEROSOL BOX OF ALUMINUM ALLOY

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007317083A (en) * 2006-05-29 2007-12-06 Nec Computertechno Ltd Microprocessor and pipeline control method

Also Published As

Publication number Publication date
JPH0760386B2 (en) 1995-06-28

Similar Documents

Publication Publication Date Title
JP2987308B2 (en) Information processing device
US6338136B1 (en) Pairing of load-ALU-store with conditional branch
AU618142B2 (en) Tightly coupled multiprocessor instruction synchronization
JP3599409B2 (en) Branch prediction device
JP3494736B2 (en) Branch prediction system using branch destination buffer
JP2640454B2 (en) Digital instruction processor controller and method for executing a branch in one cycle
US6247122B1 (en) Method and apparatus for performing branch prediction combining static and dynamic branch predictors
JP2840444B2 (en) Method for operating an arithmetic pipeline and data processing apparatus
JPH1124929A (en) Arithmetic processing unit and its method
JPH0769818B2 (en) Data processing device
JP2008535063A (en) Branch target address cache that stores two or more branch target addresses per index
JP3163045B2 (en) Branch solution method and processor
JP2002073330A (en) Data processing device
JP3486690B2 (en) Pipeline processor
JP2002527798A (en) Mechanism for load block based on store address generation and universal dependency vector
JP3749233B2 (en) Instruction execution method and apparatus in pipeline
JP5136405B2 (en) Arithmetic processing device and control method of arithmetic processing device
US8578135B2 (en) Apparatus for calculating and prefetching a branch target address
US5295248A (en) Branch control circuit
US11403110B2 (en) Storing a result of a first instruction of an execute packet in a holding register prior to completion of a second instruction of the execute packet
US5440704A (en) Data processor having branch predicting function
JP3345787B2 (en) Data processing device
JP7205174B2 (en) Arithmetic processing device and method of controlling arithmetic processing device
JPH01106227A (en) Data processor with branching forecasting function
US6421774B1 (en) Static branch predictor using opcode of instruction preceding conditional branch

Legal Events

Date Code Title Description
S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees