JPH03263224A - Data processor - Google Patents

Data processor

Info

Publication number
JPH03263224A
JPH03263224A JP6532790A JP6532790A JPH03263224A JP H03263224 A JPH03263224 A JP H03263224A JP 6532790 A JP6532790 A JP 6532790A JP 6532790 A JP6532790 A JP 6532790A JP H03263224 A JPH03263224 A JP H03263224A
Authority
JP
Japan
Prior art keywords
instruction
branch
address
branch instruction
prefetch
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP6532790A
Other languages
Japanese (ja)
Inventor
Toshinao Ide
井手 敏直
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.)
NEC Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP6532790A priority Critical patent/JPH03263224A/en
Publication of JPH03263224A publication Critical patent/JPH03263224A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To efficiently prefetch an instruction by forecasting success or failure of branch by a programmer and designating it with a branch instruction. CONSTITUTION:In the case of a branch instruction, the instruction code of the instruction read out to a program buffer 2 is sent to an instruction decoding circuit 14, and a signal line 17 is driven because of the branch instruction; and if a forecast bit 15 in the branch instruction is set, the output of an AND gate 18 goes to '1', and an address selecting circuit 13 selects a branch address instructed in the lower order of the branch instruction and sends it to a main storage device 1, thus prefetching the instruction in the branch destination. If the forecast bit 15 is not set, the output of the AND gate 18 is '0' and a normal instruction address selecting circuit 12 is selected to prefetch the normal sequence. Thus, success or failure of branch is forecasted by the program and is designated by the branch instruction to efficiently prefetch the instruction.

Description

【発明の詳細な説明】 [産業上の利用分野] 本発明は主記憶中の命令先取りを行なうデータ処理装置
に関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a data processing device that prefetches instructions in main memory.

[従来の技術] 従来、データ処理装置において命令実行速度を上げるた
め命令読出しの先取りを行っているが、ブランチ命令時
、ブランチ先の命令を先取りして読出しておき、ブラン
チ条件か成立した場合部ブランチ先の命令が実行できる
よう構成されていた。
[Prior Art] Conventionally, in order to increase the instruction execution speed in a data processing device, instruction reading is prefetched, but when a branch instruction is issued, the instruction at the branch destination is prefetched and read, and when the branch condition is met, the instruction is prefetched. It was configured so that the instructions at the branch destination could be executed.

[発明が解決しようとする課題] 上述した従来のデータ処理装置は、ブランチ命令におけ
るブランチ条件が成立した場合、最も有効に動作するが
、ブランチ条件が不成立の場合、改めてブランチ命令の
次の命令の読出しを始めなければならないという欠点が
ある。即ち、ブランチ命令が読出された場合、必ずブラ
ンチ先の命令を読出すためブランチ条件が成立する確率
か高い場合は有効であるが、ブランチ条件が成立する確
率が低い場合は効率が悪いという欠点があった。
[Problems to be Solved by the Invention] The conventional data processing device described above operates most effectively when the branch condition in the branch instruction is met, but when the branch condition is not met, the data processing device operates again in the next instruction after the branch instruction. The disadvantage is that reading must begin. In other words, when a branch instruction is read, the instruction at the branch destination is always read, so it is effective if the probability of the branch condition being met is high, but it has the disadvantage of being inefficient if the probability of the branch condition being met is low. there were.

本発明の目的は、命令先取りを効率よく行なえるデータ
処理装置を提供することである。
An object of the present invention is to provide a data processing device that can efficiently prefetch instructions.

[課題を解決するための手段] 本発明のデータ処理装置は、命令コード中に設けられた
ブランチ条件成立/不成立の予想ビットを含むブランチ
命令と、該ブランチ命令を検出する回路と、先取り命令
読出しリクエストアドレスとして前記ブランチ命令で、
かつ前記予想ビットがセットされている場合、前記ブラ
ンチ命令によるブランチ先のアドレスを選択し、前記予
想ビットかセットされていない場合ブランチしない命令
シーケンスのアドレスを選択する選択回路とを有する。
[Means for Solving the Problems] A data processing device of the present invention includes a branch instruction including a branch condition prediction bit provided in an instruction code, a circuit for detecting the branch instruction, and a prefetch instruction reading system. In said branch instruction as the request address,
and a selection circuit that selects a branch destination address by the branch instruction when the prediction bit is set, and selects an address of an instruction sequence to which the branch is not to be branched when the prediction bit is not set.

[作 用] ブランチ成立または不成立をプログラムか予葱しブラン
チ命令で指定しておくことにより、命令先取りを効率よ
く行える。
[Operation] Instruction preemption can be performed efficiently by specifying whether a branch is established or not established in a program or a pre-branch instruction.

[実施例] 次に、本発明の実施例について図面を参照して説明する
[Example] Next, an example of the present invention will be described with reference to the drawings.

第1図は本発明の一実施例のデータ処理装置のブロック
図、第2図は本実施例の動作を従来と比較して示すタイ
ムチャートである。
FIG. 1 is a block diagram of a data processing device according to an embodiment of the present invention, and FIG. 2 is a time chart showing the operation of this embodiment in comparison with a conventional one.

主記憶装置1に格納されているブロクラムはプログラム
バッファ2に読出され、通常プロクラムバッファ3,4
を経て命令レジスタ5へ格納される。この命令レジスタ
5の内容はデータ処理部6へ送られ解読、実行に移され
データ処理が行われる。また、プログラムバッファ2,
3.4および命令レジスタ5に対応してプログラムの主
記憶装置上にアドレスを保持するレジスタ7.8.9゜
10が存在し命令先取りのアドレスとして利用される。
The block diagram stored in the main memory device 1 is read out to the program buffer 2, and usually program buffers 3 and 4 are read out to the program buffer 2.
The command is then stored in the instruction register 5. The contents of the instruction register 5 are sent to the data processing section 6, decoded and executed, and data processing is performed. Also, program buffer 2,
3.4 and instruction register 5, registers 7.8.9.10 for holding addresses exist on the main memory of the program and are used as addresses for prefetching instructions.

今、ブランチ命令でない通常の命令の場合、命令レジス
タ5に読出されデータ処理部6で処理されるが、プログ
ラム先取りのため現在の命令のアドレスに数命令分(プ
ログラムバッファ2,3゜4の格納状況により変化)の
先のアドレスを加えアドレス選択回路12.13を介し
て主記憶装置1へ送られ、読出しリクエストが行われる
Now, in the case of a normal instruction that is not a branch instruction, it is read out to the instruction register 5 and processed by the data processing unit 6, but because the program is prefetched, several instructions are stored at the address of the current instruction (program buffers 2, 3, 4). The next address (changes depending on the situation) is added and sent to the main memory device 1 via the address selection circuit 12, 13, and a read request is made.

次に、ブランチ命令の場合、プログラムバッファ2に読
出された命令の命令コードが命令解読回路14に送られ
、ブランチ命令であるため信号線17か駆動され、ブラ
ンチ命令中の予想ビット15がセットされている場合、
アンドゲート18の出力が“1”となり、アドレス選択
回路13は通常命令アドレス選択回路12の出力は選択
せず、ブランチ命令の下位に指示されているブランチア
ドレス16を選択し主記憶装置1に送り、ブランチ先の
命令先取りを行う。
Next, in the case of a branch instruction, the instruction code of the instruction read into the program buffer 2 is sent to the instruction decoding circuit 14, and since it is a branch instruction, the signal line 17 is driven, and the prediction bit 15 in the branch instruction is set. If
The output of the AND gate 18 becomes "1", and the address selection circuit 13 does not normally select the output of the instruction address selection circuit 12, but selects the branch address 16 specified below the branch instruction and sends it to the main memory 1. , prefetch the instructions at the branch destination.

このブランチ命令の予想ビット15がセットされていな
い場合、あるいはブランチ命令でない場合はアンドゲー
ト18の出力は“0”で、通常命令アドレス選択回路1
2が選択され、通常シーケンスの先取りが行われる。
If the prediction bit 15 of this branch instruction is not set or if it is not a branch instruction, the output of the AND gate 18 is "0", and the normal instruction address selection circuit 1
2 is selected and the normal sequence is prefetched.

次に、本実施例の動作を第2図のタイミングチャートを
参照して説明する。
Next, the operation of this embodiment will be explained with reference to the timing chart of FIG.

この図において命令A、A+1.A+2.−・・と続き
、A+2なる命令はブランチ命令で、ブランチ先の命令
はBと仮定している。vI2図(1)は従来の方式で命
令の先取りはあるがブランチ先の先取りはない場合で、
ブランチ命令A+2が条件成立するタイミングチャート
である。メモリリクエストアドレスとプロクラムバッフ
ァ2,3.4および命令レジスタ5には図て示したよう
なアドレスおよびアドレスの内容がセットされる。
In this figure, instructions A, A+1. A+2. -..., the instruction A+2 is a branch instruction, and it is assumed that the branch destination instruction is B. Figure vI2 (1) shows a case in which there is prefetching of instructions in the conventional method, but there is no prefetching of branch destinations.
12 is a timing chart in which a condition for branch instruction A+2 is satisfied. The memory request address, program buffers 2, 3.4, and instruction register 5 are set with the addresses and contents of the addresses as shown in the figure.

また、A、A+1.Bは2ステ一ジ時間か必要な命令で
あり、A+2はブランチ命令で1ステージで終了する。
Also, A, A+1. B is an instruction that requires two stages, and A+2 is a branch instruction that completes in one stage.

命令レジスタ5にA+2がセットされた0点て既にA+
5の読出しリクエストが出されていてプログラムバッフ
ァ4にはA+3なる命令がセットされており、さらにA
+4.A+5か読出されてくる。しかしA+2なるブラ
ンチ命令がブランチする場合、Bなる命令を読出す必要
があり、A+3.A+4.A+5の命令を捨て。
The 0 point when A+2 is set in the instruction register 5 is already A+.
A read request of 5 has been issued, an instruction A+3 is set in program buffer 4, and an instruction A+3 is set in program buffer 4.
+4. A+5 is read out. However, when the branch instruction A+2 branches, it is necessary to read the instruction B, and A+3. A+4. Discard the A+5 command.

Bが命令レジスタ5にセットされるまで処理を中断しな
ければならない。即ちこのタイムチャートの場合4ステ
ージウエイトさせる必要がある。
Processing must be interrupted until B is set in the instruction register 5. That is, in this time chart, it is necessary to wait four stages.

次に、第2図(2)のタイムチャートはブランチ先の先
取りがあり、ブランチ命令A+2の条件成立の場合であ
る。この場合、プログラムバッファ2にA+2がセット
された場合Bの読出しリクエストを行うため1ステージ
のウェイトで済む。
Next, the time chart of FIG. 2(2) shows a case where there is prefetching of the branch destination and the condition of branch instruction A+2 is satisfied. In this case, when A+2 is set in the program buffer 2, a read request for B is made, so one stage of wait is sufficient.

次に、第2図(3)のタイムチャートはブランチ先の先
取りはあるが、ブランチ条件不成立の場合である。プロ
クラムバッファ2にA+2がセットされた時、Bの読出
しリクエストを行い、さらにB+1もリクエストするが
、命令レジスタ5におけるA+2のブランチ条件が不成
立のためB。
Next, the time chart in FIG. 2(3) shows a case where the branch destination is preempted, but the branch condition is not satisfied. When A+2 is set in the program buffer 2, a read request is made for B, and then B+1 is also requested, but the branch condition for A+2 in the instruction register 5 is not satisfied, so B.

B+1を捨てA+4以降の読出しが必要となり、3ステ
ージのウェイトが必要となる。
It is necessary to discard B+1 and read from A+4 onward, requiring three stages of wait.

表1は第2図のウェイト数をまとめたもので従来のウェ
イト数と本実施例の予想ビットを使用した場合のウェイ
ト数の比較した表である。
Table 1 summarizes the weight numbers shown in FIG. 2, and is a table comparing the conventional weight numbers and the weight numbers when using the expected bits of this embodiment.

(以下余白) この表においてブランチ予想ビットが立っている場合は
ブランチ成立/不成立のウェイト数は従来と同様1ウエ
イト/3ウエイトで同じであるが、ブランチ予想ビット
が立っていない場合は4ウエイト10ウエイトである。
(Left below) In this table, when the branch prediction bit is set, the number of waits for branch establishment/unestablishment is the same as before, 1 wait/3 waits, but when the branch prediction bit is not set, it is 4 waits and 10 waits. It's a weight.

即ち、ブランチが成立する場合は本実施例は従来と同じ
か遅くなる(ブランチ予想なしの時)が、ブランチ不成
立の場合は本実施例の場合は従来と同じか早くなる。し
たがって、プログラマがブランチしないと予想した時に
ブランチする場合とブランチしない場合の比較となるが
、一般にプログラマがプログラミングするとき、ある程
度の確率で予想できるためブランチしない確率が高いと
予想した時にブランチする場合よりもブランチしない確
率が圧倒的に多いと考えられる。したがって、ブランチ
不成立を予想してブランチ不成立の場合従来より3ウエ
イト無駄を省けることになる。
That is, when a branch is taken, this embodiment is the same as or slower than the conventional method (when no branch prediction is made), but when the branch is not taken, this embodiment is the same or faster than the conventional method. Therefore, it is a comparison between branching when the programmer predicts that it will not branch and not branching, but in general, when programming, programmers can predict with a certain probability, so the probability of not branching is higher than when branching when they predict that it will not branch. It is thought that there is an overwhelmingly high probability that the branch will not occur. Therefore, when a branch is predicted to fail and the branch fails, three waits can be wasted compared to the conventional method.

第3図はブランチ命令Bl、B2.B3.B4を含むプ
ログラムのフローチャート、表2は第3図中のブランチ
命令か成立/不成立する確率を具体的に設定した時の平
均ウェイト数を算出した表ブランチ命令B1.B2.B
3.B4の各々のブランチする/しない確率と、ブラン
チ予想ビットを使用した本実施例の場合とブランチ予想
ビットを使用しない従来の場合の平均ウェイト数は、ブ
ランチ予想ビットを立てた場合は同じであるか、ブラン
チ予想ビットを立てない場合は本実施例の方が少ない。
FIG. 3 shows branch instructions B1, B2. B3. Table 2 is a flowchart of the program including B4, and Table 2 shows the table branch instructions B1. B2. B
3. Are the probabilities of branching/not branching for each of B4 and the average number of weights in this embodiment using the branch prediction bit and in the conventional case not using the branch prediction bit the same when the branch prediction bit is set? , the number of cases in which the branch prediction bit is not set is smaller in this embodiment.

81〜B4を経る平均ウェイト数は従来は7.2である
か、本実施例の場合は5.4となり明らかに効果かわか
る。
The average number of weights passing through 81 to B4 is 7.2 in the conventional case, or 5.4 in the case of this embodiment, which clearly shows the effect.

[発明の効果] 以上説明したように本発明は、ブランチ成立または不成
立をプログラマが予想しブランチ命令で指定しておくこ
とにより、命令先取りを効率よく行える効果がある。
[Effects of the Invention] As described above, the present invention has the advantage that instructions can be preempted efficiently by allowing the programmer to predict whether a branch will be taken or not and specifying it in a branch instruction.

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

第1図は本発明の一実施例のデータ処理装置の要部のブ
ロック図、第2図(1) 、 (2) 、 (3)は従
来と本実施例の動作を示すタイミングチャート、第3図
はブランチ命令81〜B4を含むプログラムのフローチ
ャートである。 1・・・主記憶装置、2,3.4・・・プロクラムバッ
ファ、5・・・命令レジスタ、6・・・データ処理部、
7.8.9.10・・・命令アドレスレジスタ、11・
・・命令先取りカウント、12・・・通常命令アドレス
選択回路、13・・・アドレス選択回路、14・・・ブ
ランチ命令解読回路、18・・・アントゲート。
FIG. 1 is a block diagram of the main parts of a data processing device according to an embodiment of the present invention, FIGS. 2 (1), (2), and (3) are timing charts showing operations of the conventional and this embodiment, The figure is a flowchart of a program including branch instructions 81 to B4. 1... Main memory device, 2, 3.4... Program buffer, 5... Instruction register, 6... Data processing section,
7.8.9.10...Instruction address register, 11.
. . . Instruction prefetch count, 12 . . . Normal instruction address selection circuit, 13 . . Address selection circuit, 14 . . Branch instruction decoding circuit, 18 . . . Ant gate.

Claims (1)

【特許請求の範囲】[Claims] 1、主記憶中の命令先取りを行うデータ処理装置におい
て、命令コード中に設けられたブランチ条件成立/不成
立の予想ビットを含むブランチ命令と、該ブランチ命令
を検出する回路と、先取り命令読出しリクエストアドレ
スとして前記ブランチ命令で、かつ前記予想ビットがセ
ットされている場合、前記ブランチ命令によるブランチ
先のアドレスを選択し、前記予想ビットがセットされて
いない場合ブランチしない命令シーケンスのアドレスを
選択する選択回路とを有することを特徴とするデータ処
理装置。
1. In a data processing device that prefetches instructions in main memory, a branch instruction including a prediction bit of whether a branch condition is met or not established provided in an instruction code, a circuit for detecting the branch instruction, and a prefetch instruction read request address a selection circuit that selects an address to be branched to by the branch instruction when the branch instruction is set and the expected bit is set, and selects an address of an instruction sequence that does not branch when the expected bit is not set; A data processing device comprising:
JP6532790A 1990-03-14 1990-03-14 Data processor Pending JPH03263224A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6532790A JPH03263224A (en) 1990-03-14 1990-03-14 Data processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6532790A JPH03263224A (en) 1990-03-14 1990-03-14 Data processor

Publications (1)

Publication Number Publication Date
JPH03263224A true JPH03263224A (en) 1991-11-22

Family

ID=13283712

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6532790A Pending JPH03263224A (en) 1990-03-14 1990-03-14 Data processor

Country Status (1)

Country Link
JP (1) JPH03263224A (en)

Similar Documents

Publication Publication Date Title
JP2603626B2 (en) Data processing device
US4775927A (en) Processor including fetch operation for branch instruction with control tag
JPS63503177A (en) Command preemption control device
US5146570A (en) System executing branch-with-execute instruction resulting in next successive instruction being execute while specified target instruction is prefetched for following execution
US5125097A (en) Data flow type information processors where data packets pass through plurality of merging and branching portions of the internal path
JP2636088B2 (en) Information processing device
JPS6049340B2 (en) Branch instruction prefetch method
JPH0342723A (en) Data processor
JPH03263224A (en) Data processor
JPS5991551A (en) Instruction prefetching device forecasting address to be branched
JPH01291327A (en) Processing mode prefetch control system
JPS60164842A (en) Instruction prefetching device
JPH0248733A (en) Information processor
JP2814683B2 (en) Instruction processing unit
JPS5991552A (en) Instruction prefetch device having set associative type history table
JPS6116334A (en) Data processor
JPS60181931A (en) Instruction prefetch control device
JPS6022768B2 (en) Data processing method
JPS61208129A (en) Control system for preread of instruction
JPS5991554A (en) Instruction prefetch device forecasting branch direction
JPH03255530A (en) Parallel instruction fetching mechanism
JPH1124942A (en) Microcomputer
JPH10254698A (en) Information processor
JP2001134448A (en) Information processor and interruption processing method
JPH07120281B2 (en) Information processing equipment