JPH08339299A - Pipeline processor - Google Patents

Pipeline processor

Info

Publication number
JPH08339299A
JPH08339299A JP8086868A JP8686896A JPH08339299A JP H08339299 A JPH08339299 A JP H08339299A JP 8086868 A JP8086868 A JP 8086868A JP 8686896 A JP8686896 A JP 8686896A JP H08339299 A JPH08339299 A JP H08339299A
Authority
JP
Japan
Prior art keywords
instruction
branch
counter
advance notice
address
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
JP8086868A
Other languages
Japanese (ja)
Other versions
JP2883035B2 (en
Inventor
Katsuya Hasegawa
克也 長谷川
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co 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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP8086868A priority Critical patent/JP2883035B2/en
Publication of JPH08339299A publication Critical patent/JPH08339299A/en
Application granted granted Critical
Publication of JP2883035B2 publication Critical patent/JP2883035B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)
  • Executing Machine-Instructions (AREA)

Abstract

PURPOSE: To eliminate the disturbance of a pipeline by calculating a branching address before a branching position. CONSTITUTION: This pipeline processor is provided with a counter part 4 for holding a counter value. The counter value is initialized to an instruction number to the change point of control supplied by a preliminarily announced branching instruction. The counter value is decreased synchronized with the increase of a program counter 2. The counter part 4 compares the counter value with a prescribed threshold value. Corresponding to a compared result by the counter part 4, one of the address of a successive instruction and the branching destination address of the preliminarily announced branching instruction is selected.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】本発明は、複数の命令をパイ
プライン処理可能なパイプライン・プロセッサに関す
る。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a pipeline processor capable of pipeline processing a plurality of instructions.

【0002】[0002]

【従来の技術】現在実用に供されているほとんどすべて
のプロセッサは複数の命令をパイプライン処理してい
る。パイプライン処理とは、命令の実行プロセスを複数
のステージに分割し、その複数のステージをオーバーラ
ップさせることにより、複数の命令を並列に処理するも
のである。これにより、プロセッサの性能が向上する。
このようなパイプライン処理を行うプロセッサは、パイ
プライン・プロセッサと呼ばれる。
2. Description of the Related Art Almost all processors currently in practical use pipeline a plurality of instructions. The pipeline processing is to process a plurality of instructions in parallel by dividing the instruction execution process into a plurality of stages and overlapping the plurality of stages. This improves the performance of the processor.
A processor that performs such pipeline processing is called a pipeline processor.

【0003】分岐命令を実行するためには、パイプライ
ン・プロセッサは、命令をフェッチしデコードすること
によりその命令が分岐命令であることを認識し、分岐を
行うか否かの条件を判断し、分岐先のアドレスを計算し
た後に、次にフェッチすべき命令のアドレスを変更する
必要がある。しかし、分岐命令について次にフェッチす
べき命令のアドレスを変更する時点では、その分岐命令
に続く逐次命令が既にフェッチされてしまっており、誤
ってフェッチした命令を捨てて分岐先の命令をフェッチ
しなおさなければならない。誤ってフェッチした命令を
捨てて分岐先の命令をフェッチしなおすまでに費やされ
たサイクル数が分岐命令の実行によって生じる遅延であ
る。
In order to execute a branch instruction, the pipeline processor recognizes that the instruction is a branch instruction by fetching and decoding the instruction, and determines the condition for branching. After calculating the address of the branch destination, it is necessary to change the address of the instruction to be fetched next. However, when changing the address of the next instruction to be fetched for a branch instruction, the sequential instruction following that branch instruction has already been fetched, and the instruction fetched by mistake is discarded and the instruction at the branch destination is fetched. I have to do it. The number of cycles spent until the instruction fetched by mistake is discarded and the instruction at the branch destination is fetched again is the delay caused by the execution of the branch instruction.

【0004】制御の流れを変更する分岐命令は、パイプ
ライン・プロセッサの性能を著しく低下させる。分岐命
令は、パイプラインへのスムーズな命令供給を阻害し、
パイプラインの乱れを引き起こすからである。
Branch instructions that modify the flow of control significantly degrade the performance of pipeline processors. Branch instructions impede smooth instruction supply to the pipeline,
This is because it causes turbulence in the pipeline.

【0005】一般のアプリケーション・プログラムで
は、全命令中に占める分岐命令の割合は20%〜30%
である。仮に1つの分岐命令を実行することによって3
サイクルのロスが生じるとすると、パイプライン・プロ
セッサのトータルな性能は、分岐命令の実行によって6
0%〜90%劣化することになる。分岐命令の実行によ
ってパイプラインの乱れが生じてしまうからである。
In a general application program, the proportion of branch instructions in all instructions is 20% to 30%.
Is. 3 by executing one branch instruction
Given the loss of cycles, the total performance of a pipeline processor is 6
The deterioration is 0% to 90%. This is because the pipeline is disturbed by the execution of the branch instruction.

【0006】このように、分岐命令の実行に伴う遅れ
(ペナルティ)は、パイプライン・プロセッサの性能を
劣化させる大きな要因である。
As described above, the delay (penalty) associated with the execution of the branch instruction is a major factor that deteriorates the performance of the pipeline processor.

【0007】パイプラインの乱れを防止するには、大別
して2つのアプローチがある。1つは、条件判断の遅れ
をなくすことにより、パイプラインの乱れを防止するア
プローチである。もう1つは、分岐先アドレスの計算の
遅れをなくすことにより、パイプラインの乱れを防止す
るアプローチである。
There are roughly two approaches to prevent pipeline turbulence. One is an approach to prevent turbulence in the pipeline by eliminating the delay in condition judgment. The other is an approach to prevent the pipeline from being disturbed by eliminating the delay in the calculation of the branch destination address.

【0008】条件判断の遅れをなくす手法としては、種
々の分岐予測の手法が知られている。しかし、分岐先ア
ドレスの計算の遅れをなくす手法に関しては有力な手法
が少ない。
Various branch prediction methods are known as methods for eliminating the delay in condition judgment. However, there are few effective methods for eliminating the delay in the calculation of the branch destination address.

【0009】分岐先アドレスの計算の遅れをなくす手法
の1つとしては、ブランチ・ターゲット・バッファ(B
ranch Target Buffer;以下、BT
Bと略す)を用いる手法がある。この手法は、以前に計
算した分岐先アドレスをBTBに格納しておくことによ
り、その分岐先アドレスを再利用するものである。この
手法によれば、分岐命令をデコードするより前に分岐命
令の分岐先アドレスを取得することが可能となる。
As one method of eliminating the delay in the calculation of the branch destination address, the branch target buffer (B
Ranch Target Buffer; BT
(Abbreviated as B). In this method, the branch destination address calculated previously is stored in the BTB, and the branch destination address is reused. According to this method, it becomes possible to acquire the branch destination address of the branch instruction before decoding the branch instruction.

【0010】図11は、BTBを用いた従来のプロセッ
サの構成を示す。図12に示されるように、BTB10
は、タグを格納する領域41と分岐先アドレスを格納す
る領域42と分岐履歴を格納する領域43とを有してい
る。分岐命令が実行されると、命令メモリ1におけるそ
の分岐命令のアドレスの上位ビットが領域41に格納さ
れ、その分岐命令の分岐先アドレスが領域42に格納さ
れ、その分岐命令の分岐履歴が領域43に格納される。
BTB10における領域41、42および43の行位置
は、その分岐命令の下位アドレスに従って決められる。
FIG. 11 shows the configuration of a conventional processor using BTB. As shown in FIG. 12, BTB10
Has an area 41 for storing a tag, an area 42 for storing a branch destination address, and an area 43 for storing a branch history. When the branch instruction is executed, the upper bits of the address of the branch instruction in the instruction memory 1 are stored in the area 41, the branch destination address of the branch instruction is stored in the area 42, and the branch history of the branch instruction is stored in the area 43. Stored in.
The row positions of the areas 41, 42 and 43 in the BTB 10 are determined according to the lower address of the branch instruction.

【0011】プログラムカウンタ2には、次にフェッチ
すべき命令のアドレス(以下、PCアドレスという)が
格納されている。PCアドレスの下位ビット(例えば、
8ビット)をインデックスとしてBTB10が参照さ
れ、PCアドレスの上位ビットとBTB10の領域41
に格納されるタグとが比較される。
The program counter 2 stores an address of an instruction to be fetched next (hereinafter referred to as a PC address). Lower bits of PC address (for example,
BTB10 is referred to by using (8 bits) as an index, and the upper bits of the PC address and the area 41 of BTB10
Is compared to the tags stored in.

【0012】PCアドレスの上位ビットとBTB10の
領域41に格納されるタグとが一致することは、PCア
ドレスに対応する分岐命令が以前に実行されたというこ
とを示す。その分岐命令の分岐先アドレスはBTB10
における対応する領域42に格納されている。従って、
PCアドレスの上位ビットとBTB10の領域41に格
納されるタグとが一致する場合には、PCアドレスの代
わりに、BTB10の領域42に格納されている分岐先
アドレスが命令メモリ1に出力される。なお、PCアド
レスの代わりにBTB10の領域42に格納されている
分岐先アドレスを命令メモリ1に出力するか否かの判定
には、BTB10の領域43に格納されている分岐履歴
を考慮してもよい。分岐履歴は、分岐が起こるか否かを
予測するために使用され得る。
A match between the upper bits of the PC address and the tag stored in the area 41 of the BTB 10 indicates that the branch instruction corresponding to the PC address has been executed before. The branch destination address of the branch instruction is BTB10.
Are stored in the corresponding area 42 in the. Therefore,
When the upper bit of the PC address matches the tag stored in the area 41 of the BTB 10, the branch destination address stored in the area 42 of the BTB 10 is output to the instruction memory 1 instead of the PC address. It should be noted that the branch history stored in the area 43 of the BTB 10 is taken into consideration in determining whether to output the branch destination address stored in the area 42 of the BTB 10 to the instruction memory 1 instead of the PC address. Good. The branch history can be used to predict whether a branch will occur.

【0013】PCアドレスの上位ビットとBTB10の
領域41に格納されるタグとが一致しない場合には、通
常の命令フェッチのサイクルと同様にして、PCアドレ
スが命令メモリ1に出力される。
When the upper bits of the PC address do not match the tag stored in the area 41 of the BTB 10, the PC address is output to the instruction memory 1 in the same manner as the normal instruction fetch cycle.

【0014】このように、PCアドレスの上位ビットと
BTB10の領域41に格納されるタグとが一致した場
合には、命令フェッチのサイクルと同一のサイクルにお
いて分岐命令の分岐先アドレスを取得することができ
る。このことは、命令デコードのサイクルよりも前に分
岐先アドレスの計算が完了していることを意味する。
As described above, when the upper bits of the PC address and the tag stored in the area 41 of the BTB 10 match, the branch destination address of the branch instruction can be acquired in the same cycle as the instruction fetch cycle. it can. This means that the calculation of the branch destination address is completed before the instruction decoding cycle.

【0015】また、分岐先アドレスの計算の遅れをなく
す他の手法としては、アーキテクチャ的に遅延分岐(D
elayed branch)を定義する手法がある。
この手法は、実際に分岐が生じるか否かにかからわず分
岐命令に続く所定の数の命令を実行することにより、分
岐先アドレスの計算の遅れをなくすものである。
Another method for eliminating the delay in the calculation of the branch destination address is architecturally a delayed branch (D
There is a method of defining an emissive branch).
This method eliminates the delay in the calculation of the branch destination address by executing a predetermined number of instructions following the branch instruction regardless of whether the branch actually occurs.

【0016】[0016]

【発明が解決しようとする課題】上述したBTBを用い
る手法では、BTBは多くのメモリを必要とする。実用
的な効果を発揮するためには、BTBは少なくとも10
24のエントリ数を必要とする。これは、6〜7キロバ
イトのメモリに相当し、チップ上では非常に大きな面積
を占める。また、パイプラインの乱れを防止するために
は、BTBへのアクセスを1サイクル以内に行う必要が
ある。このことは、プロセッサの動作速度を律速する大
きな要因となる。
In the method using the BTB described above, the BTB requires a large amount of memory. BTB should be at least 10 for practical effect.
It requires 24 entries. This corresponds to a memory of 6 to 7 kilobytes and occupies a very large area on the chip. Further, in order to prevent the disturbance of the pipeline, it is necessary to access the BTB within one cycle. This is a major factor limiting the operating speed of the processor.

【0017】また、上述した遅延分岐の手法では、遅延
分岐の性能は、コンパイラが遅延スロットをどれだけ有
効な命令で満たすことができるかにかかっている。遅延
スロットを満たす命令は、分岐の有無にかかわらず実行
される命令であるから、分岐条件に影響を与える命令で
あってはならない。一般に、コンパイラがそのような命
令を見つけだすことは容易ではない。命令を実際に実行
する前に、その命令が分岐条件に影響を与えるか否かを
判定することは困難だからである。
In the delay branch method described above, the performance of the delay branch depends on how many valid instructions the compiler can fill the delay slot. An instruction that fills the delay slot is an instruction that is executed regardless of whether or not there is a branch, so it must not be an instruction that affects the branch condition. In general, it is not easy for a compiler to find such an instruction. This is because it is difficult to determine whether or not the instruction affects the branch condition before actually executing the instruction.

【0018】1つの命令をフェッチするのに必要なサイ
クル数が1である場合には、遅延スロットの90%程度
を有効な命令で満たすことが可能である。しかし、1つ
の命令をフェッチするのに必要なサイクル数が増大する
につれて、遅延スロットを有効な命令で満たすことは困
難になる。遅延スロットを満たすべき命令の数が増大す
るからである。従って、遅延分岐の手法を多段のパイプ
ラインプロセッサやスーパースカラマシンに適用するこ
とは困難である。
When the number of cycles required to fetch one instruction is 1, it is possible to fill about 90% of the delay slots with valid instructions. However, as the number of cycles required to fetch one instruction increases, it becomes difficult to fill the delay slot with valid instructions. This is because the number of instructions that should fill the delay slot increases. Therefore, it is difficult to apply the delayed branch method to a multi-stage pipeline processor or superscalar machine.

【0019】遅延スロットを有効な命令で満たすことが
不可能である場合には、コンパイラは遅延スロットをN
OP命令で満たす。このことはプログラムサイズを冗長
に増大させる。
If the delay slot cannot be filled with valid instructions, then the compiler fills the delay slot with N
Fill with OP instruction. This redundantly increases the program size.

【0020】本発明の目的は、大量のメモリや動作速度
に影響を与えることなく、分岐命令の実行により遅延を
生じないパイプライン・プロセッサを提供することにあ
る。本発明の他の目的は、1つの命令をフェッチするの
に必要なサイクル数が増大した場合でも、分岐命令の実
行により遅延を生じないパイプライン・プロセッサを提
供することにある。
An object of the present invention is to provide a pipeline processor which does not cause a delay due to the execution of branch instructions without affecting a large amount of memory or operating speed. Another object of the present invention is to provide a pipeline processor that does not cause a delay due to execution of a branch instruction even when the number of cycles required to fetch one instruction increases.

【0021】[0021]

【課題を解決するための手段】本発明のパイプライン・
プロセッサは、制御の流れを変更するまでに予告分岐命
令の後に続いて実行されるべき少なくとも1つの命令の
数を定義する予告分岐命令を実行するパイプライン・プ
ロセッサであって、フェッチすべき命令のアドレスを保
持するプログラムカウンタと、該プログラムカウンタに
よって保持されるアドレスに対応する命令を出力する命
令メモリと、該命令メモリから出力された命令をフェッ
チし保持する命令レジスタと、該命令レジスタによって
保持された命令をデコードすることにより、該命令が該
予告分岐命令であるか否かを識別する命令デコード部
と、カウンタ値を保持し、該カウンタ値と所定のしきい
値とを比較するカウンタ部であって、該カウンタ値は該
予告分岐命令によって定義された命令数に初期化され、
該カウンタ値は該プログラムカウンタがインクリメント
されるのに同期してデクリメントされるカウンタ部と、
該プログラムカウンタによって保持されるアドレスをイ
ンクリメントし、該インクリメントされたアドレスを逐
次命令アドレスとして提供する加算器と、該予告分岐命
令の分岐先アドレスを提供する分岐先アドレスレジスタ
と、該カウンタ部の比較結果に応じて、該逐次命令アド
レスと該予告分岐命令の分岐先アドレスとのうちの一方
を選択するセレクタとを備えており、これにより上記目
的が達成される。
Means for Solving the Problems The pipeline of the present invention
The processor is a pipeline processor that executes a predictive branch instruction that defines the number of at least one instruction that should be executed subsequent to the predictive branch instruction before changing control flow, and the processor A program counter for holding an address, an instruction memory for outputting an instruction corresponding to an address held by the program counter, an instruction register for fetching and holding an instruction output from the instruction memory, and an instruction register for holding the instruction register An instruction decoding unit that identifies whether the instruction is the advance notice branch instruction by decoding the instruction, and a counter unit that holds a counter value and compares the counter value with a predetermined threshold value. And the counter value is initialized to the number of instructions defined by the advance branch instruction,
The counter value is decremented in synchronization with the increment of the program counter;
Comparison of the adder that increments the address held by the program counter and provides the incremented address as a sequential instruction address, the branch destination address register that provides the branch destination address of the advance notice branch instruction, and the counter unit A selector for selecting one of the sequential instruction address and the branch destination address of the advance notice branch instruction according to the result is provided, thereby achieving the above object.

【0022】前記予告分岐命令は、前記命令の種類を識
別するオペコードを格納する領域と、前記分岐先アドレ
スを指定する領域と、前記制御の流れを変更するまでに
予告分岐命令の後に続いて実行されるべき少なくとも1
つの命令の数を格納する領域とを含んでいる。
The advance notice branch instruction is executed after the advance notice branch instruction until the control flow is changed, an area for storing an operation code for identifying the type of the instruction, an area for specifying the branch destination address. At least one to be done
And an area for storing the number of one instruction.

【0023】前記所定のしきい値は、1つの命令をフェ
ッチするのに必要なサイクル数に等しい。
The predetermined threshold is equal to the number of cycles required to fetch one instruction.

【0024】前記カウンタ部は、前記カウンタ値と前記
所定のしきい値とが一致する場合に、前記予告分岐命令
の分岐先アドレスを選択する選択信号を前記セレクタに
出力してもよい。
The counter unit may output a selection signal for selecting a branch destination address of the advance notice branch instruction to the selector when the counter value matches the predetermined threshold value.

【0025】前記カウンタ部は、前記予告分岐命令によ
って定義された命令の数が前記所定のしきい値より小さ
い場合に、前記予告分岐命令の分岐先アドレスを選択す
る選択信号を前記セレクタに出力してもよい。
The counter section outputs a selection signal for selecting a branch destination address of the advance notice branch instruction to the selector when the number of instructions defined by the advance notice branch instruction is smaller than the predetermined threshold value. May be.

【0026】前記カウンタ部は、前記予告分岐命令によ
って定義された命令の数が前記所定のしきい値より小さ
い場合に、前記命令レジスタによって保持された命令を
キャンセルする信号を前記命令レジスタに出力してもよ
い。
The counter section outputs a signal for canceling the instruction held in the instruction register to the instruction register when the number of instructions defined by the advance branch instruction is smaller than the predetermined threshold value. May be.

【0027】前記パイプライン・プロセッサは、前記予
告分岐命令について前記制御の流れを変更するか否かを
判断する条件判断部をさらに備えており、前記カウンタ
部は、前記カウンタ値が所定の値に達した場合に、前記
予告分岐命令について前記制御の流れを変更するか否か
を判断するタイミングを規定する信号を該条件判断部に
出力してもよい。
The pipeline processor further includes a condition judging unit for judging whether or not to change the control flow for the advance notice branch instruction, and the counter unit sets the counter value to a predetermined value. When it reaches, a signal defining the timing for determining whether to change the control flow for the advance notice branch instruction may be output to the condition determining unit.

【0028】前記条件判断部は、前記予告分岐命令につ
いて前記制御の流れを変更しないと判断した場合に、前
記命令レジスタによって保持された命令をキャンセルす
る信号を前記命令レジスタに出力し、前記命令デコード
部によってデコードされる命令をキャンセルする信号を
前記命令デコード部に出力してもよい。
When the condition judging unit judges that the control flow of the advance notice branch instruction is not changed, the condition judging unit outputs a signal for canceling the instruction held by the instruction register to the instruction register to decode the instruction decode. A signal for canceling the instruction decoded by the unit may be output to the instruction decoding unit.

【0029】以下、作用を説明する。The operation will be described below.

【0030】本発明のパイプライン・プロセッサによれ
ば、実際の制御の流れの変更は制御の流れの変更を指示
する命令をフェッチ、デコードした時点ではただちに起
こらず、制御の流れの変更を指示する命令にエンコード
された制御の流れの変更点までの命令数だけ後に起こ
る。一方、制御の変更先アドレスは制御の流れの変更を
指示する命令をデコードした時点で計算できており実際
の制御の変更時点では既に用意されている。従って、制
御の流れの変更(すなわち、フェッチ先の変更)を行う
時点ではすみやかにフェッチ先を変更することが可能と
なり、従来の分岐命令のように既に誤ってフェッチした
逐次命令を捨てて分岐先の命令をフェッチしなおす必要
がなくなる。
According to the pipeline processor of the present invention, the actual change of the control flow does not occur immediately at the time of fetching and decoding the instruction indicating the change of the control flow, but indicates the change of the control flow. It occurs after the number of instructions up to the change in control flow encoded in the instruction. On the other hand, the control change destination address can be calculated at the time when the instruction for changing the control flow is decoded, and is already prepared at the time when the actual control is changed. Therefore, at the time of changing the control flow (that is, changing the fetch destination), the fetch destination can be changed promptly, and a sequential instruction that has already been erroneously fetched, such as a conventional branch instruction, is discarded and the branch destination is discarded. It is not necessary to fetch the instruction of.

【0031】[0031]

【発明の実施の形態】以下、図面を参照して本発明の実
施の形態を説明する。
BEST MODE FOR CARRYING OUT THE INVENTION Embodiments of the present invention will be described below with reference to the drawings.

【0032】図1は、本発明によるパイプライン・プロ
セッサ100の構成を示す。
FIG. 1 shows the structure of a pipeline processor 100 according to the present invention.

【0033】プログラムカウンタ2は、次にフェッチす
べき命令のアドレス101を保持する。プログラムカウ
ンタ2は、保持されたアドレス101を命令メモリ1に
出力する。命令メモリ1には複数の命令が格納されてい
る。命令メモリ1に格納されている複数の命令のうち、
プログラムカウンタ2から出力されたアドレス101に
よって指定される命令102が命令レジスタ8にフェッ
チされ、そこで保持される。
The program counter 2 holds the address 101 of the instruction to be fetched next. The program counter 2 outputs the held address 101 to the instruction memory 1. The instruction memory 1 stores a plurality of instructions. Of the multiple instructions stored in the instruction memory 1,
The instruction 102 designated by the address 101 output from the program counter 2 is fetched into the instruction register 8 and held there.

【0034】命令メモリ1には様々な種類の命令が格納
され得る。それらの命令は逐次命令と分岐命令に分類さ
れる。
Various types of instructions can be stored in the instruction memory 1. Those instructions are classified into sequential instructions and branch instructions.

【0035】本明細書では、「逐次命令」とは、制御の
流れを変更しない命令であると定義する。従って、逐次
命令の次にはその逐次命令が格納されている命令メモリ
1のアドレスの次のアドレスに対応する命令が実行され
る。「分岐命令」とは、制御の流れを変更する命令であ
ると定義する。従って、「分岐命令」は、条件分岐命
令、無条件ジャンプ命令、サブルーチン・コール命令、
リターン命令などを含む。
In this specification, the "sequential instruction" is defined as an instruction that does not change the control flow. Therefore, after the sequential instruction, the instruction corresponding to the address next to the address of the instruction memory 1 in which the sequential instruction is stored is executed. A "branch instruction" is defined as an instruction that changes the flow of control. Therefore, "branch instruction" means conditional branch instruction, unconditional jump instruction, subroutine call instruction,
Including a return instruction.

【0036】図2は、パイプライン・プロセッサ100
において使用される分岐命令のフォーマットを示す。本
明細書では、図2に示される分岐命令を「予告分岐命
令」という。「予告分岐命令」とは、その予告分岐命令
から所定の数の命令を実行した後に分岐先アドレスに分
岐する命令である。その所定の数は、予告分岐命令のオ
ペランドとして与えられる。
FIG. 2 shows the pipeline processor 100.
Shows the format of the branch instruction used in. In this specification, the branch instruction shown in FIG. 2 is referred to as a “preliminary branch instruction”. The "predictive branch instruction" is an instruction that executes a predetermined number of instructions from the predictive branch instruction and then branches to the branch destination address. The predetermined number is given as an operand of the advance notice branch instruction.

【0037】例えば、「2つの命令を実行した後に命令
Xに分岐する予告分岐命令」は、プログラムコードでは
「Branch after 2 to X」と表現さ
れる。命令Xのアドレスは、分岐命令の分岐先アドレス
としてパイプライン・プロセッサ100において計算さ
れる。
For example, the "predictive branch instruction that branches to the instruction X after executing two instructions" is expressed as "Branch after 2 to X" in the program code. The address of the instruction X is calculated in the pipeline processor 100 as the branch destination address of the branch instruction.

【0038】予告分岐命令は、オペコードを格納する領
域21と、分岐先アドレスを指定する領域22と、制御
の流れの変更点(分岐点)までに予告分岐命令に続いて
実行されるべき少なくとも1つの命令の数を格納する領
域23とを有している。
The advance notice branch instruction has an area 21 for storing an operation code, an area 22 for designating a branch destination address, and at least one that should be executed following the advance notice branch instruction by the change point (branch point) of the control flow. Area 23 for storing the number of one instruction.

【0039】オペコードとは命令の種類を識別するため
のコードである。オペコードは、通常、複数のビットか
ら構成される。
The operation code is a code for identifying the type of instruction. The opcode is usually composed of multiple bits.

【0040】分岐先アドレスは、直接アドレッシングモ
ードもしくは間接アドレシングモードにおいて指定され
る。
The branch destination address is designated in the direct addressing mode or the indirect addressing mode.

【0041】直接アドレッシングモードでは、分岐先ア
ドレスは絶対アドレスによって指定される。この場合、
領域22には、直接アドレッシングモードを示すコード
と、絶対アドレスとが格納される。
In the direct addressing mode, the branch destination address is designated by the absolute address. in this case,
The area 22 stores a code indicating the direct addressing mode and an absolute address.

【0042】間接アドレッシングモードでは、分岐先ア
ドレスはベースアドレスに対する相対アドレスによって
指定される。この場合、領域22には、間接アドレッシ
ングモードを示すコードと、相対アドレス(予告分岐命
令から分岐点までのディスプレースメント)とが格納さ
れる。ベースアドレスとしては、典型的には、プログラ
ムカウンタ2に保持されるアドレスが使用される。しか
し、ベースアドレスとして他のレジスタに保持されるア
ドレスが使用されてもよい。
In the indirect addressing mode, the branch destination address is designated by the relative address with respect to the base address. In this case, the area 22 stores a code indicating the indirect addressing mode and a relative address (displacement from the advance branch instruction to the branch point). An address held in the program counter 2 is typically used as the base address. However, an address held in another register may be used as the base address.

【0043】現実行命令から制御の流れの変更点(分岐
点)までの命令数は、0または正の整数によって指定さ
れる。0または正の整数は、予告分岐命令のオペランド
として与えられる。例えば、予告分岐命令がプログラム
コードで「Branch after 2 to X
」と表現されている場合には、領域23には2が格納
される。
The number of instructions from the currently executed instruction to the change point (branch point) of the control flow is designated by 0 or a positive integer. 0 or a positive integer is given as the operand of the advance notice branch instruction. For example, the advance notice branch instruction may be “Branch after 2 to X” in program code.
2 ”is stored in the area 23.

【0044】図1を再び参照して、命令レジスタ8に保
持された命令102は、命令レジスタ8の出力103と
して命令デコード部3と分岐先アドレス計算部7とに供
給される。
Referring again to FIG. 1, the instruction 102 held in the instruction register 8 is supplied to the instruction decoding unit 3 and the branch destination address calculating unit 7 as the output 103 of the instruction register 8.

【0045】命令デコード部3は、命令103をデコー
ドすることにより命令103の種類を識別する。命令1
03の種類の識別は、命令103の先頭領域に格納され
るオペコードを識別することによって達成される。
The instruction decoding unit 3 identifies the type of the instruction 103 by decoding the instruction 103. Instruction 1
The 03 type identification is achieved by identifying the opcode stored in the head area of the instruction 103.

【0046】命令103が逐次命令であると命令デコー
ド部が識別した場合には、命令103の種類を示す情報
106が実行部11に供給され、命令103において指
定されるレジスタを示す情報107がレジスタファイル
12に供給される。情報107によって指定されたレジ
スタの値は、情報108として実行部11に供給され
る。例えば、命令103が「レジスタ1の値にレジスタ
2の値を加算して、その加算結果をレジスタ1に格納せ
よ」という命令である場合には、命令103の種類を示
す情報106として「加算命令」を示す情報が実行部1
1に供給され、命令103において指定されるレジスタ
を示す情報107として「レジスタ1、レジスタ2」を
示す情報がレジスタファイル12に供給される。
When the instruction decoding unit identifies that the instruction 103 is a sequential instruction, the information 106 indicating the type of the instruction 103 is supplied to the executing unit 11, and the information 107 indicating the register designated in the instruction 103 is registered. It is supplied to the file 12. The value of the register designated by the information 107 is supplied to the execution unit 11 as the information 108. For example, when the instruction 103 is an instruction “add the value of register 2 to the value of register 1 and store the addition result in register 1”, as the information 106 indicating the type of instruction 103, “add instruction The information indicating "
1 is supplied to the register file 12 as the information 107 indicating the register designated by the instruction 103.

【0047】実行部11は、命令デコード部3からの情
報106とレジスタファイル12からの情報108とに
基づいて、命令を実行する。実行部11による実行結果
は、必要に応じて、出力109としてレジスタファイル
12に出力される。
The execution unit 11 executes the instruction based on the information 106 from the instruction decoding unit 3 and the information 108 from the register file 12. The execution result by the execution unit 11 is output to the register file 12 as the output 109, if necessary.

【0048】命令103が予告分岐命令であると命令デ
コード部3が識別した場合には、命令デコード部3は、
初期値設定信号104をカウンタ部4に供給するととも
に、予告分岐命令の領域23に格納されている値をカウ
ンタ部4に初期値105として供給する。初期値設定信
号104は、カウンタ部4に初期値105を設定するサ
イクルにおいてハイレベルとなり、その他のときはロー
レベルとなる。
When the instruction decoding unit 3 identifies that the instruction 103 is the advance notice branch instruction, the instruction decoding unit 3
The initial value setting signal 104 is supplied to the counter unit 4, and the value stored in the area 23 of the advance notice branch instruction is supplied to the counter unit 4 as the initial value 105. The initial value setting signal 104 has a high level in the cycle for setting the initial value 105 in the counter unit 4, and has a low level otherwise.

【0049】カウンタ部4は、カウント値を保持する。
カウント値は、予告分岐命令の分岐タイミングを規定す
るために使用される。カウント値は、例えば、整数であ
る。カウンタ部4に保持されたカウント値は、初期値設
定信号104に応答して初期値105に初期化される。
初期値105は、予告分岐命令の領域23に格納されて
いる値である。カウンタ部4に保持されたカウント値
は、プログラムカウンタ2からの信号110に応答して
1だけデクリメントされる。信号110は、プログラム
カウンタ2の値が1だけインクリメントされるのに同期
してカウンタ部4に出力される。
The counter section 4 holds the count value.
The count value is used to define the branch timing of the advance notice branch instruction. The count value is, for example, an integer. The count value held in the counter unit 4 is initialized to the initial value 105 in response to the initial value setting signal 104.
The initial value 105 is a value stored in the advance notice branch instruction area 23. The count value held in the counter unit 4 is decremented by 1 in response to the signal 110 from the program counter 2. The signal 110 is output to the counter unit 4 in synchronization with the value of the program counter 2 being incremented by 1.

【0050】カウンタ部4は、カウンタ部4に保持され
るカウンタ値と所定のしきい値とを比較する。そのカウ
ンタ値と所定のしきい値とが一致する場合には、カウン
タ部4は、ハイレベルの選択信号111をセレクタ5に
出力し、ハイレベルのキャンセル信号116を命令レジ
スタ8に出力する。その他の場合には、カウンタ部4
は、ローレベルの選択信号111をセレクタ5に出力
し、ローレベルのキャンセル信号116を命令レジスタ
8に出力する。選択信号111は、次にフェッチすべき
命令のアドレスを分岐先のアドレスに変更するために使
用される。キャンセル信号116は、命令レジスタ8に
フェッチされた命令をキャンセルするために使用され
る。
The counter section 4 compares the counter value held in the counter section 4 with a predetermined threshold value. When the counter value and the predetermined threshold value match, the counter unit 4 outputs the high-level selection signal 111 to the selector 5 and the high-level cancel signal 116 to the instruction register 8. In other cases, the counter unit 4
Outputs a low-level selection signal 111 to the selector 5, and outputs a low-level cancel signal 116 to the instruction register 8. The selection signal 111 is used to change the address of the instruction to be fetched next to the address of the branch destination. The cancel signal 116 is used to cancel the instruction fetched in the instruction register 8.

【0051】セレクタ5は、選択信号111のレベルに
応じて、加算器9の出力112と分岐先アドレスレジス
タ6の出力113のうちの一方を選択する。選択信号1
11のレベルがハイレベルである場合には、セレクタ5
は分岐先アドレスレジスタ6の出力113を選択する。
選択信号111のレベルがローレベルである場合には、
セレクタ5は加算器9の出力112を選択する。セレク
タ5の出力115は、プログラムカウンタ2に供給され
る。
The selector 5 selects one of the output 112 of the adder 9 and the output 113 of the branch destination address register 6 according to the level of the selection signal 111. Selection signal 1
When the level of 11 is high level, the selector 5
Selects the output 113 of the branch destination address register 6.
When the level of the selection signal 111 is low,
The selector 5 selects the output 112 of the adder 9. The output 115 of the selector 5 is supplied to the program counter 2.

【0052】分岐先アドレスレジスタ6には、分岐先ア
ドレス計算部7による計算結果(すなわち、予告分岐命
令の分岐先アドレス)114が供給される。分岐先アド
レスレジスタ6は、計算結果114を出力113として
セレクタ5に供給する。分岐先アドレスレジスタ6は、
予告分岐命令の分岐先アドレスをセレクタ5を介してプ
ログラムカウンタ2に提供する。
The branch destination address register 6 is supplied with the calculation result (that is, the branch destination address of the advance notice branch instruction) 114 by the branch destination address calculator 7. The branch destination address register 6 supplies the calculation result 114 as the output 113 to the selector 5. The branch destination address register 6 is
The branch destination address of the advance notice branch instruction is provided to the program counter 2 via the selector 5.

【0053】加算器9は、プログラムカウンタ2の値を
1だけインクリメントし、そのインクリメントされた値
を出力112としてセレクタ5に供給する。加算器9
は、逐次命令に続く命令のアドレスを計算するために使
用される。
The adder 9 increments the value of the program counter 2 by 1 and supplies the incremented value to the selector 5 as the output 112. Adder 9
Is used to calculate the address of the instruction following the sequential instruction.

【0054】プログラムカウンタ2からアドレス101
が出力されてからそのアドレス101に対応する命令1
02が命令レジスタ8にフェッチされるまでの処理を
「命令フェッチ」という。
Program counter 2 to address 101
Command 1 corresponding to the address 101 after
The process until 02 is fetched into the instruction register 8 is called “instruction fetch”.

【0055】命令デコード部3によって実行される処理
を「命令デコード」という。分岐先アドレス計算部7に
よって分岐先アドレスの計算が開始されてからその計算
結果が分岐先アドレスレジスタ6に格納されるまでの処
理を「分岐先アドレスの計算」という。パイプライン・
プロセッサ100は、「命令デコード」と「分岐先アド
レスの計算」とを同一のサイクルにおいて実行する。
The process executed by the instruction decoding unit 3 is called "instruction decoding". The process from the start of the calculation of the branch target address by the branch target address calculation unit 7 until the calculation result is stored in the branch target address register 6 is called “branch target address calculation”. pipeline·
The processor 100 executes "instruction decoding" and "calculation of branch destination address" in the same cycle.

【0056】実行部11が情報106と情報108とに
基づいて命令を実行する処理を「命令実行」という。ま
た、実行部11がレジスタファイル12に情報109を
格納する処理を「ライトバック」という。
The process in which the execution unit 11 executes an instruction based on the information 106 and the information 108 is called "instruction execution". In addition, the process in which the execution unit 11 stores the information 109 in the register file 12 is called “write back”.

【0057】このように、パイプライン・プロセッサ1
00における処理は、「命令フェッチ」、「命令デコー
ド」、「命令実行」、「ライトバック」を繰り返すこと
によって実行される。
In this way, the pipeline processor 1
The process at 00 is executed by repeating “instruction fetch”, “instruction decode”, “instruction execution”, and “writeback”.

【0058】図3は、カウンタ部4の構成を示す。カウ
ンタ部4は、カウンタ値Zを保持するダウンカウンタ3
1を含んでいる。
FIG. 3 shows the configuration of the counter section 4. The counter unit 4 includes a down counter 3 that holds a counter value Z.
Contains 1.

【0059】ダウンカウンタ31には、初期値105と
初期値設定信号104とが入力される。ダウンカウンタ
31に保持されるカウンタ値Zは、初期値設定信号10
4のレベルがハイレベルである場合に初期値105に初
期化される。上述したように、初期値105は、予告分
岐命令の領域23に格納された予告分岐命令から分岐点
までの命令数に等しい。以下、初期値105は値Bに等
しいと仮定する。
An initial value 105 and an initial value setting signal 104 are input to the down counter 31. The counter value Z held in the down counter 31 is the initial value setting signal 10
When the level of 4 is a high level, it is initialized to the initial value 105. As described above, the initial value 105 is equal to the number of instructions from the advance notice branch instruction to the branch point stored in the advance notice branch instruction area 23. Hereinafter, it is assumed that the initial value 105 is equal to the value B.

【0060】ダウンカウンタ31には、信号110がさ
らに入力される。ダウンカウンタ31に保持されるカウ
ンタ値Zは、信号110に応答して1だけデクリメント
される。カウンタ値Zは、比較器33に出力される。
The signal 110 is further input to the down counter 31. The counter value Z held in the down counter 31 is decremented by 1 in response to the signal 110. The counter value Z is output to the comparator 33.

【0061】比較器33は、カウンタ値Zがしきい値A
に等しいか否かを判定する。しきい値Aは、しきい値設
定部32から供給される。しきい値Aは、1つの命令を
フェッチするのに必要とされるサイクル数(以下、命令
フェッチサイクル数という)に等しくなるように予めし
きい値設定部32に設定される。比較器33は、カウン
タ値Zがしきい値Aに等しい場合にはハイレベルの信号
をOR回路36の一方の入力に供給し、それ以外の場合
にはローレベルの信号をOR回路36の一方の入力に供
給する。OR回路36の他方の入力には、AND回路3
7の出力が供給される。
In the comparator 33, the counter value Z is the threshold value A.
It is determined whether or not. The threshold value A is supplied from the threshold value setting unit 32. The threshold value A is set in the threshold value setting unit 32 in advance so as to be equal to the number of cycles required to fetch one instruction (hereinafter referred to as the instruction fetch cycle number). The comparator 33 supplies a high level signal to one input of the OR circuit 36 when the counter value Z is equal to the threshold value A, and supplies a low level signal to one input of the OR circuit 36 otherwise. Supply to the input of. The other input of the OR circuit 36 is connected to the AND circuit 3
7 outputs are provided.

【0062】減算器34は、初期値Bからしきい値Aを
減算する。減算結果Yは、判定部35と制御信号生成部
38とに供給される。
The subtractor 34 subtracts the threshold value A from the initial value B. The subtraction result Y is supplied to the determination unit 35 and the control signal generation unit 38.

【0063】判定部35は、演算結果Yが0より小さい
か否かを判定する。判定部35は、演算結果Yが0より
小さい場合にはハイレベルの信号をAND回路37の一
方の入力に供給し、それ以外の場合にはローレベルの信
号をAND回路37の一方の入力に供給する。AND回
路37の他方の入力には、初期値設定信号104が供給
される。
The judging section 35 judges whether the calculation result Y is smaller than 0 or not. The determination unit 35 supplies a high level signal to one input of the AND circuit 37 when the operation result Y is smaller than 0, and otherwise supplies a low level signal to one input of the AND circuit 37. Supply. The initial value setting signal 104 is supplied to the other input of the AND circuit 37.

【0064】このようにして、(B<A)または(Z=
A)である場合にのみOR回路36の出力はハイレベル
となり、それ以外の場合にはOR回路36の出力はロー
レベルとなる。これにより、(B<A)または(Z=
A)である場合にのみセレクタ5から分岐先アドレスレ
ジスタ6の出力113が出力される。その以外の場合に
はセレクタ5から加算器9の出力112が出力される。
In this way, (B <A) or (Z =
Only in the case of A), the output of the OR circuit 36 becomes high level, and in other cases, the output of the OR circuit 36 becomes low level. As a result, (B <A) or (Z =
Only in the case of A), the output 113 of the branch destination address register 6 is output from the selector 5. In other cases, the selector 112 outputs the output 112 of the adder 9.

【0065】制御信号生成部38は、初期値設定信号1
04と減算結果Yとに応じて、キャンセル信号116を
生成する。
The control signal generator 38 uses the initial value setting signal 1
The cancel signal 116 is generated according to 04 and the subtraction result Y.

【0066】図4(a)は、命令フェッチサイクル数が
3である場合における制御信号生成部38の構成例を示
す。命令フェッチサイクル数が3以外である場合にも、
図4(a)に示される制御信号生成回路38と同様にし
て制御信号生成回路38を構成することができる。
FIG. 4A shows a configuration example of the control signal generator 38 when the number of instruction fetch cycles is three. Even if the number of instruction fetch cycles is other than 3,
The control signal generation circuit 38 can be configured in the same manner as the control signal generation circuit 38 shown in FIG.

【0067】制御信号生成部38は、カウンタ51〜5
3と、論理回路54と、セレクタ55とを含んでいる。
The control signal generating section 38 includes counters 51-5.
3, a logic circuit 54, and a selector 55.

【0068】カウンタ51〜53は、初期値設定信号1
04に応答して信号を出力する。カウンタ51〜53の
出力は、論理回路54を介してセレクタ55の入力端子
1〜Y3にそれぞれ入力される。
The counters 51 to 53 have the initial value setting signal 1
A signal is output in response to 04. The outputs of the counters 51 to 53 are input to the input terminals Y 1 to Y 3 of the selector 55 via the logic circuit 54, respectively.

【0069】セレクタ55は、減算器34から入力され
る減算結果Yの値に応じて、入力端子Y1〜Y3に入力さ
れる3つの信号のうちの1つを出力する。セレクタ55
は、Y=1である場合には入力端子Y1に入力される信
号を出力し、Y=2である場合には入力端子Y2に入力
される信号を出力し、Y=3である場合には入力端子Y
3に入力される信号を出力する。セレクタ55の出力
は、キャンセル信号116として命令レジスタ8に供給
される。
The selector 55 outputs one of the three signals input to the input terminals Y 1 to Y 3 according to the value of the subtraction result Y input from the subtractor 34. Selector 55
Outputs a signal input to the input terminal Y 1 when Y = 1, outputs a signal input to the input terminal Y 2 when Y = 2, and outputs Y = 3 Input terminal Y
Outputs the signal input to 3 . The output of the selector 55 is supplied to the instruction register 8 as the cancel signal 116.

【0070】図4(b)は、カウンタ51〜53の出力
の波形と、セレクタ55の出力の波形とを示す。セレク
タ55の出力がハイレベルとなるサイクルにおいて、命
令レジスタ8に保持されている命令がキャンセルされ
る。
FIG. 4B shows the output waveforms of the counters 51 to 53 and the output waveform of the selector 55. In the cycle in which the output of the selector 55 becomes high level, the instruction held in the instruction register 8 is canceled.

【0071】図5(a)は、予告分岐命令を含むプログ
ラムコード列の例を示す。図5(a)において、I1
2、I4、I5、I6は逐次命令を示し、I3は予告分岐
命令「Branch after 3 to X」を示
し、Xは予告分岐命令の分岐先の命令を示す。
FIG. 5A shows an example of a program code string including a notice branch instruction. In FIG. 5A, I 1 ,
I 2 , I 4 , I 5 , and I 6 indicate sequential instructions, I 3 indicates a notice branch instruction “Branch after 3 to X”, and X indicates a branch destination instruction of the notice branch instruction.

【0072】図5(b)は、命令フェッチサイクル数が
2であり、かつ、現実行命令から分岐点までの命令数が
3である予告分岐命令I3を実行する場合におけるパイ
プライン・プロセッサ100の動作を示すタイムチャー
トである。この場合、A=2かつB=3である。
FIG. 5B shows the pipeline processor 100 when executing the advance notice branch instruction I 3 in which the number of instruction fetch cycles is 2 and the number of instructions from the current execution instruction to the branch point is 3. 3 is a time chart showing the operation of FIG. In this case, A = 2 and B = 3.

【0073】図5(b)において、IF1〜IF2は命令
フェッチのサイクルを示し、IDは命令デコードのサイ
クルを示し、EXは命令実行のサイクルを示し、WBは
ライトバックのサイクルを示す。
In FIG. 5B, IF 1 to IF 2 indicate instruction fetch cycles, ID indicates instruction decode cycles, EX indicates instruction execution cycles, and WB indicates write back cycles.

【0074】サイクルC3において予告分岐命令I3が命
令デコード部3によってデコードされる。その結果、予
告分岐命令I3の領域23に格納される値(B=3)が
初期値105としてダウンカウンタ31(図3)に入力
される。ダウンカウンタ31に保持されるカウンタ値Z
は、3に初期化される。ダウンカウンタ31に保持され
るカウンタ値Zは、各サイクルC4〜C6において1つず
つデクリメントされる。
In cycle C 3 , the predictive branch instruction I 3 is decoded by the instruction decoding unit 3. As a result, the value (B = 3) stored in the area 23 of the advance notice branch instruction I 3 is input to the down counter 31 (FIG. 3) as the initial value 105. Counter value Z held in the down counter 31
Is initialized to 3. The counter value Z held in the down counter 31 is decremented by 1 in each cycle C 4 to C 6 .

【0075】サイクルC4においてダウンカウンタ31
に保持されるカウンタ値Zとしきい値設定部32(図
3)に設定されているしきい値(A=2)とが一致す
る。その結果、サイクルC4において選択信号111が
ハイレベルとなり、セレクタ5の出力が加算器9の出力
112から分岐先アドレスレジスタ6の出力113に切
り替わる。
In cycle C 4 , down counter 31
The counter value Z held in the table and the threshold value (A = 2) set in the threshold value setting unit 32 (FIG. 3) match. As a result, in cycle C 4 , the selection signal 111 becomes high level, and the output of the selector 5 switches from the output 112 of the adder 9 to the output 113 of the branch destination address register 6.

【0076】図5(b)において、Sはセレクタ5の出
力115が出力112(逐次命令アドレス)であること
を示し、Bはセレクタ5の出力115が出力113(分
岐先アドレス)であることを示す。
In FIG. 5B, S indicates that the output 115 of the selector 5 is the output 112 (sequential instruction address), and B indicates that the output 115 of the selector 5 is the output 113 (branch destination address). Show.

【0077】図6は、命令フェッチサイクル数が3であ
り、かつ、現実行命令から分岐点までの命令数が3であ
る予告分岐命令I3を実行する場合におけるパイプライ
ン・プロセッサ100の動作を示すタイムチャートであ
る。この場合、A=3かつB=3である。
FIG. 6 shows the operation of the pipeline processor 100 when executing the advance notice branch instruction I 3 in which the number of instruction fetch cycles is 3 and the number of instructions from the current execution instruction to the branch point is 3. It is a time chart shown. In this case, A = 3 and B = 3.

【0078】図6において、IF1〜IF3は命令フェッ
チのサイクルを示し、IDは命令デコードのサイクルを
示し、EXは命令実行のサイクルを示し、WBはライト
バックのサイクルを示す。
In FIG. 6, IF 1 to IF 3 indicate instruction fetch cycles, ID indicates instruction decode cycles, EX indicates instruction execution cycles, and WB indicates write back cycles.

【0079】サイクルC3においてダウンカウンタ31
(図3)に保持されるカウンタ値Zは、3に初期化され
る。ダウンカウンタ31に保持されるカウンタ値Zは、
各サイクルC4〜C6において1つずつデクリメントされ
る。
In cycle C 3 , down counter 31
The counter value Z held in (FIG. 3) is initialized to 3. The counter value Z held in the down counter 31 is
It is decremented by 1 in each cycle C 4 to C 6 .

【0080】サイクルC3においてダウンカウンタ31
に保持されるカウンタ値Zとしきい値設定部32(図
3)に設定されているしきい値(A=3)とが一致す
る。その結果、サイクルC3において選択信号111が
ハイレベルとなり、セレクタ5の出力が加算器9の出力
112から分岐先アドレスレジスタ6の出力113に切
り替わる。
In cycle C 3 , down counter 31
The counter value Z held in the threshold value and the threshold value (A = 3) set in the threshold value setting unit 32 (FIG. 3) match. As a result, in cycle C 3 , the selection signal 111 becomes high level, and the output of the selector 5 switches from the output 112 of the adder 9 to the output 113 of the branch destination address register 6.

【0081】図6において、Sはセレクタ5の出力11
5が出力112(逐次命令アドレス)であることを示
し、Bはセレクタ5の出力115が出力113(分岐先
アドレス)であることを示す。
In FIG. 6, S is the output 11 of the selector 5.
5 indicates the output 112 (sequential instruction address), and B indicates that the output 115 of the selector 5 is the output 113 (branch destination address).

【0082】このように、パイプライン・プロセッサ1
00によれば、A≦Bである場合には、分岐命令の実行
により遅延は発生しない。従って、パイプラインの乱れ
も生じない。
In this way, the pipeline processor 1
According to 00, when A ≦ B, no delay occurs due to the execution of the branch instruction. Therefore, the pipeline is not disturbed.

【0083】図7は、命令フェッチサイクル数が3であ
り、かつ、現実行命令から分岐点までの命令数が2であ
る予告分岐命令I3を実行する場合におけるパイプライ
ン・プロセッサ100の動作を示すタイムチャートであ
る。この場合、A=3かつB=2である。
FIG. 7 shows the operation of the pipeline processor 100 when executing the advance notice branch instruction I 3 in which the number of instruction fetch cycles is 3 and the number of instructions from the current execution instruction to the branch point is 2. It is a time chart shown. In this case, A = 3 and B = 2.

【0084】図7において、IF1〜IF3は命令フェッ
チのサイクルを示し、IDは命令デコードのサイクルを
示し、EXは命令実行のサイクルを示し、WBはライト
バックのサイクルを示す。
In FIG. 7, IF 1 to IF 3 indicate instruction fetch cycles, ID indicates instruction decode cycles, EX indicates instruction execution cycles, and WB indicates write back cycles.

【0085】サイクルC3において初期値115として
与えられる値(B=2)は、命令フェッチサイクル数
(A=3)より小さい。その結果、サイクルC3におい
て選択信号111がハイレベルとなり、セレクタ5の出
力が加算器9の出力112から分岐先アドレスレジスタ
6の出力113に切り替わる。
The value (B = 2) given as the initial value 115 in the cycle C 3 is smaller than the number of instruction fetch cycles (A = 3). As a result, in cycle C 3 , the selection signal 111 becomes high level, and the output of the selector 5 switches from the output 112 of the adder 9 to the output 113 of the branch destination address register 6.

【0086】図7において、Sはセレクタ5の出力11
5が出力112(逐次命令アドレス)であることを示
し、Bはセレクタ5の出力115が出力113(分岐先
アドレス)であることを示す。
In FIG. 7, S is the output 11 of the selector 5.
5 indicates the output 112 (sequential instruction address), and B indicates that the output 115 of the selector 5 is the output 113 (branch destination address).

【0087】このように、パイプライン・プロセッサ1
00によれば、A>Bである場合には、予告分岐命令の
実行により遅延が発生する。しかし、図7に示す例で
は、遅延するサイクル数は1である。これに対して、A
=3の場合に従来の分岐命令の実行により遅延するサイ
クル数は3である(図8参照)。
In this way, the pipeline processor 1
According to 00, when A> B, a delay occurs due to the execution of the advance notice branch instruction. However, in the example shown in FIG. 7, the number of delayed cycles is one. On the other hand, A
= 3, the number of cycles delayed by the execution of the conventional branch instruction is 3 (see FIG. 8).

【0088】このように、パイプライン・プロセッサ1
00によれば、予告分岐命令の実行により生じる遅延を
従来よりも小さくすることができる。このことは、パイ
プラインの乱れを最小化する。
In this way, the pipeline processor 1
According to 00, the delay caused by the execution of the predictive branch instruction can be made smaller than before. This minimizes pipeline turbulence.

【0089】次に、予告分岐命令の分岐条件を判断する
タイミングを説明する。図5(b)、図6、図7に示さ
れるように、予告分岐命令I3の命令実行(EX)のサ
イクルは、ダウンカウンタ31(図3)に保持されるカ
ウンタ値Zが0になるサイクルの次のサイクルである。
このことは、予告分岐命令I3の分岐条件を判断するタ
イミングが現実行命令から分岐点までの命令数(B)に
応じて延期されることを意味する。これにより、予告分
岐命令に続く逐次命令がその予告分岐命令の分岐条件を
判断するのに影響を与えるものであった場合であって
も、分岐条件を正確に判断することができる。
Next, the timing for determining the branch condition of the advance notice branch instruction will be described. As shown in FIGS. 5B, 6, and 7, the counter value Z held in the down counter 31 (FIG. 3) becomes 0 in the instruction execution (EX) cycle of the advance notice branch instruction I 3 . It is the next cycle of the cycle.
This means that the timing for judging the branch condition of the advance notice branch instruction I 3 is postponed according to the number of instructions (B) from the current execution instruction to the branch point. Accordingly, even if the sequential instruction following the advance notice branch instruction has an influence on the determination of the branch condition of the advance notice branch instruction, the branch condition can be accurately determined.

【0090】このような分岐条件を判断するタイミング
は、カウンタ部4において判定回路39(図3)を設け
ることによって規定することができる。
The timing for judging such a branch condition can be defined by providing the judgment circuit 39 (FIG. 3) in the counter section 4.

【0091】判定回路39は、ダウンカウンタ31に保
持されるカウンタ値Zが0に一致するか否かを判定す
る。判定回路39は、ダウンカウンタ31に保持される
カウンタ値Zが0に一致する場合にはハイレベルの信号
117を出力し、その他の場合にはローレベルの信号1
17を出力する。信号117は、条件判断部13に供給
される。
The determination circuit 39 determines whether or not the counter value Z held in the down counter 31 matches 0. The determination circuit 39 outputs a high level signal 117 when the counter value Z held in the down counter 31 matches 0, and otherwise outputs a low level signal 1.
17 is output. The signal 117 is supplied to the condition determination unit 13.

【0092】図9は、条件判断部13の構成を示す。条
件判断部13は、予告分岐命令について制御の流れを変
更するか否か(すなわち、分岐先アドレスに分岐するか
否か)を判断する。
FIG. 9 shows the structure of the condition judging unit 13. The condition determination unit 13 determines whether or not to change the flow of control for the advance notice branch instruction (that is, whether to branch to the branch destination address).

【0093】条件判断部13は、コンディション・コー
ド61と、予告分岐命令の領域21に格納されるオペコ
ードによって規定される分岐条件に応じてコンディショ
ン・コード61の値を判断する分岐条件判断部62と、
AND回路63とを含んでいる。
The condition judging unit 13 includes a condition code 61 and a branch condition judging unit 62 for judging the value of the condition code 61 according to the branch condition defined by the operation code stored in the advance notice branch instruction area 21. ,
AND circuit 63.

【0094】実行部11は、実行結果109に応じてコ
ンディション・コード61の値を更新する。例えば、コ
ンディション・コード61は、Z(1ビット)、N(1
ビット)、V(1ビット)、C(1ビット)の計4ビッ
トから構成される。Zはゼロフラグを示し、Nはネガテ
ィブフラグを示し、Vはオーバーフローフラグを示し、
Cはキャリーフラグを示す。これらのフラグのそれぞれ
は、例えば、0または1の値を有する。これらのフラグ
の値が実行部11によって更新される。
The execution section 11 updates the value of the condition code 61 according to the execution result 109. For example, the condition code 61 is Z (1 bit), N (1
Bit), V (1 bit), and C (1 bit). Z indicates a zero flag, N indicates a negative flag, V indicates an overflow flag,
C indicates a carry flag. Each of these flags has a value of 0 or 1, for example. The values of these flags are updated by the execution unit 11.

【0095】分岐条件判断部62には、予告分岐命令の
領域21に格納されるオペコードが命令デコード部3か
ら入力される。
The operation code stored in the area 21 of the advance notice branch instruction is input to the branch condition judging section 62 from the instruction decoding section 3.

【0096】表1は、予告分岐命令の領域21に格納さ
れるオペコードの種類を示す。この例では、オペコード
は3ビットから構成される。もちろん、オペコードは3
ビット以外のビットから構成されてもよい。
Table 1 shows the types of opcodes stored in the advance branch instruction area 21. In this example, the opcode consists of 3 bits. Of course, the opcode is 3
It may be composed of bits other than bits.

【0097】[0097]

【表1】 [Table 1]

【0098】例えば、オペコード「100」は、「Br
anch on not equal(コンディション
・コード61のゼロフラグZの値がゼロでないという条
件が満たされれば分岐アドレスに分岐せよ)」という命
令に対応する。分岐条件判断部62は、命令デコード部
3からオペコード「100」を受け取った場合には、コ
ンディション・コード61のゼロフラグZの値がゼロで
あるか否かを判断する。 ゼロフラグZの値がゼロでな
い場合(すなわち、オペコード「100」によって規定
される分岐条件が満たされる場合)には、分岐条件判断
部62は、ハイレベルの信号をAND回路63の反転入
力に供給する。ゼロフラグZの値がゼロである場合(す
なわち、オペコード「100」によって規定される分岐
条件が満たされない場合)には、分岐条件判断部62
は、ローレベルの信号をAND回路63の反転入力に供
給する。
For example, the operation code "100" is "Br
anch on not equal (branch to a branch address if the condition that the value of the zero flag Z of the condition code 61 is not zero is satisfied) ”. When the branch condition judging unit 62 receives the operation code “100” from the instruction decoding unit 3, the branch condition judging unit 62 judges whether the value of the zero flag Z of the condition code 61 is zero. When the value of the zero flag Z is not zero (that is, when the branch condition defined by the operation code “100” is satisfied), the branch condition determination unit 62 supplies a high level signal to the inverting input of the AND circuit 63. . When the value of the zero flag Z is zero (that is, when the branch condition defined by the operation code “100” is not satisfied), the branch condition determination unit 62.
Supplies a low level signal to the inverting input of the AND circuit 63.

【0099】分岐条件を判断するタイミングを規定する
信号117がカウンタ部4の判定回路39からAND回
路63の入力に供給される。
A signal 117 defining the timing for judging the branch condition is supplied from the judgment circuit 39 of the counter section 4 to the input of the AND circuit 63.

【0100】このようにして、AND回路63の出力
は、分岐条件を判断するタイミングであり、かつ、分岐
条件が満たされていない場合にハイレベルとなり、その
他の場合にはローレベルとなる。
In this way, the output of the AND circuit 63 is at a high level when it is the timing for judging the branch condition and the branch condition is not satisfied, and is at the low level otherwise.

【0101】AND回路63の出力は、パイプライン中
の命令をキャンセルする信号として命令レジスタ8と命
令デコード部3と実行部11とに供給される。AND回
路63の出力がハイレベルとなるサイクルにおいて、命
令レジスタ8と命令デコード部3と実行部11のそれぞ
れは、命令をキャンセルする。
The output of the AND circuit 63 is supplied to the instruction register 8, the instruction decoding unit 3 and the execution unit 11 as a signal for canceling the instruction in the pipeline. In the cycle in which the output of the AND circuit 63 becomes high level, each of the instruction register 8, the instruction decoding unit 3, and the executing unit 11 cancels the instruction.

【0102】なお、図9に示される例では、説明の簡単
のため、条件判断部13は、コンディション・コード6
1に基づいて分岐するか否かを判断する構成とした。他
の条件に基づいて分岐するか否かを判断するように条件
判断部13を構成することも可能である。例えば、条件
判断部13は、レジスタファイル12の特定のレジスタ
の値に基づいて分岐するか否かを判断してもよい。
In the example shown in FIG. 9, the condition judging section 13 uses the condition code 6 for the sake of simplicity of explanation.
It is configured to judge whether to branch based on 1. It is also possible to configure the condition determination unit 13 so as to determine whether or not to branch based on other conditions. For example, the condition determination unit 13 may determine whether to branch based on the value of a specific register in the register file 12.

【0103】以下、プログラムコードにおける予告分岐
命令の位置について説明する。
The position of the advance notice branch instruction in the program code will be described below.

【0104】図10(a)は、従来の分岐命令を含むプ
ログラムコードの例である。図10(a)において、S
1〜S3、S4〜S7は逐次命令を示し、B1およびB2は分
岐命令を示す。
FIG. 10A shows an example of program code including a conventional branch instruction. In FIG. 10A, S
1 to S 3 and S 4 to S 7 indicate sequential instructions, and B 1 and B 2 indicate branch instructions.

【0105】図10(b)は、予告分岐命令を含むプロ
グラムコードの例である。図10(b)において、S1
〜S3、S4〜S7は逐次命令を示し、B1は3つの命令を
実行後に分岐する予告分岐命令を示し、B2は4つの命
令を実行後に分岐する予告分岐命令を示す。図10
(b)に示されるプログラムコードにおいて命令が実行
される順序は、図10(a)に示されるプログラムコー
ドにおいて命令が実行される順序と同じである。
FIG. 10B shows an example of the program code including the advance notice branch instruction. In FIG. 10B, S 1
˜S 3 , S 4 ˜S 7 indicate sequential instructions, B 1 indicates a notice branch instruction branching after executing three instructions, and B 2 indicates a notice branch instruction branching after executing four instructions. Figure 10
The order in which the instructions are executed in the program code shown in (b) is the same as the order in which the instructions are executed in the program code shown in FIG.

【0106】プログラムコードにおける予告分岐命令の
最適な配置は、直前の分岐点(実際に分岐が起こるべき
位置)の直後に予告分岐命令を配置することである(図
10(b)参照)。このような予告分岐命令の配置が、
その予告分岐命令の条件判断に悪影響を与えることはな
い。予告分岐命令の分岐条件を判断するタイミングは、
ダウンカウンタ31に保持されるカウンタ値Zに基づい
て適切に延期される。従って、予告分岐命令に続く逐次
命令が予告分岐命令の分岐条件を判断するのに影響を与
える場合でも、それらの影響の結果を踏まえて分岐条件
を判断することができる。
The optimum placement of the advance notice branch instruction in the program code is to place the advance notice branch instruction immediately after the immediately preceding branch point (the position where the actual branch should occur) (see FIG. 10 (b)). Such a notice branch instruction arrangement
It does not adversely affect the condition judgment of the advance notice branch instruction. The timing to judge the branch condition of the advance notice branch instruction is
The delay is appropriately postponed based on the counter value Z held in the down counter 31. Therefore, even if the sequential instruction following the advance notice branch instruction affects the determination of the branch condition of the advance notice branch instruction, the branch condition can be determined based on the result of the influence.

【0107】上述したパイプライン・プロセッサ100
は、ハードフェア的な利点に加えてソフトフェア的な利
点も併せ持っている。すなわち、パイプライン・プロセ
ッサ100は、プログラムコードの可搬性を向上させ
る。
The pipeline processor 100 described above
Has a soft fair advantage in addition to a hard fair advantage. That is, the pipeline processor 100 improves the portability of program code.

【0108】例えば、パイプライン・プロセッサ100
は、従来の分岐命令を含むプログラムコードを実行する
ことも可能である。予告分岐命令「Branch af
ter 0 to X」(0個の命令を実行した後に命
令Xに分岐する予告分岐命令)は、従来の分岐命令と等
価だからである。このことは、過去に作成したプログラ
ムコードの継続的な使用を保証する。
For example, the pipeline processor 100
Can also execute program code containing conventional branch instructions. Advance branch instruction "Branch af
This is because the “ter 0 to X” (preliminary branch instruction that branches to the instruction X after executing 0 instructions) is equivalent to the conventional branch instruction. This guarantees continued use of program code created in the past.

【0109】また、パイプライン・プロセッサ100を
命令フェッチサイクル数の異なる2つのハードウェアで
実現した場合、同一のプログラムコードを両方のハード
ウェアで実行することが可能である。このことも、過去
に作成したプログラムコードの継続的な使用を保証す
る。遅延分岐の手法では、プログラムコードの継続的な
使用は保証されない。例えば、遅延スロット=2で生成
したプログラムコードを遅延スロット=3に対応するハ
ードウェアで実行することは不可能である(あるいは、
著しく性能が劣化する)。この点で、本発明の手法と遅
延分岐の手法とは、著しい対照をなす。
When the pipeline processor 100 is implemented by two pieces of hardware having different instruction fetch cycles, the same program code can be executed by both pieces of hardware. This also guarantees continuous use of the program code created in the past. The delayed branch approach does not guarantee continuous use of the program code. For example, it is impossible to execute the program code generated with the delay slot = 2 on the hardware corresponding to the delay slot = 3 (or
Performance will deteriorate significantly). In this respect, the method of the present invention and the delayed branching method make a sharp contrast.

【0110】命令フェッチサイクル数は増加する傾向に
あり、それに応じてハードウェアは更新を余儀なくされ
る。しかし、ソフトウェアの更新はハードウェアの更新
に比較して膨大なコストを必要とする。それゆえ、過去
に作成したプログラムの継続的な使用を保証すること
は、重要な意義を有するのである。
The number of instruction fetch cycles tends to increase, and the hardware must be updated accordingly. However, updating software requires enormous cost compared to updating hardware. Therefore, ensuring the continued use of programs created in the past is of great significance.

【0111】[0111]

【発明の効果】本発明のパイプライン・プロセッサによ
れば、大量のメモリや動作速度に影響を与えることな
く、分岐命令の実行により遅延が生じることを防止する
ことができる。また、1つの命令をフェッチするのに必
要なサイクル数が増大した場合でも、分岐命令の実行に
より遅延が生じることを防止することができる。
According to the pipeline processor of the present invention, it is possible to prevent a delay from occurring due to execution of a branch instruction without affecting a large amount of memory or operating speed. Further, even if the number of cycles required to fetch one instruction increases, it is possible to prevent the execution of the branch instruction from causing a delay.

【0112】さらに、本発明のパイプライン・プロセッ
サは、特別なハードウェアを必要としない。
Moreover, the pipeline processor of the present invention does not require any special hardware.

【0113】本発明のパイプライン・プロセッサによれ
ば、分岐位置よりも以前に分岐先アドレスを計算できる
ので、逐次命令から分岐先命令へのフェッチの切り替え
動作に際して分岐先アドレスの計算終了を待つことがな
い。これにより、分岐命令の実行に伴って生じるパイプ
ラインの乱れをなくすことができる。
According to the pipeline processor of the present invention, the branch target address can be calculated before the branch position. Therefore, the completion of the calculation of the branch target address is waited for in the switching operation of the fetch from the sequential instruction to the branch target instruction. There is no. As a result, it is possible to eliminate the disturbance of the pipeline caused by the execution of the branch instruction.

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

【図1】本発明によるパイプライン・プロセッサ100
の構成を示す図である。
FIG. 1 is a pipeline processor 100 according to the present invention.
It is a figure which shows the structure of.

【図2】パイプライン・プロセッサ100において使用
される分岐命令のフォーマットを示す図である。
2 is a diagram showing a format of a branch instruction used in the pipeline processor 100. FIG.

【図3】カウンタ部4の構成を示す図である。FIG. 3 is a diagram showing a configuration of a counter section 4.

【図4】(a)は制御信号生成部38の構成を示す図、
(b)は制御信号生成部38における信号の波形を示す
図である。
FIG. 4A is a diagram showing a configuration of a control signal generation unit 38,
(B) is a diagram showing a waveform of a signal in the control signal generation unit 38.

【図5】(a)は予告分岐命令を含むプログラムコード
列の例を示す図、(b)はA=2かつB=3の場合にお
けるパイプライン・プロセッサ100の動作を示すタイ
ムチャートである。
5A is a diagram showing an example of a program code string including a notice branch instruction, and FIG. 5B is a time chart showing the operation of the pipeline processor 100 when A = 2 and B = 3.

【図6】A=3かつB=3の場合におけるパイプライン
・プロセッサ100の動作を示すタイムチャートであ
る。
FIG. 6 is a time chart showing the operation of the pipeline processor 100 when A = 3 and B = 3.

【図7】A=3かつB=2の場合におけるパイプライン
・プロセッサ100の動作を示すタイムチャートであ
る。
FIG. 7 is a time chart showing the operation of the pipeline processor 100 when A = 3 and B = 2.

【図8】A=3の場合における従来のパイプライン・プ
ロセッサ100の動作を示すタイムチャートである。
FIG. 8 is a time chart showing the operation of the conventional pipeline processor 100 when A = 3.

【図9】条件判断部13の構成を示す図である。FIG. 9 is a diagram showing a configuration of a condition determination unit 13.

【図10】(a)は従来の分岐命令を含むプログラムコ
ードの例を示す図、(b)は予告分岐命令を含むプログ
ラムコードの例を示す図である。
10A is a diagram showing an example of a program code including a conventional branch instruction, and FIG. 10B is a diagram showing an example of a program code including a notice branch instruction.

【図11】BTBを用いた従来のプロセッサの構成を示
す。
FIG. 11 shows a configuration of a conventional processor using BTB.

【図12】BTBの構成例を示す。FIG. 12 shows a configuration example of BTB.

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

1 命令メモリ 2 プログラムカウンタ 3 命令デコード部 4 カウンタ部 5 セレクタ 6 分岐先アドレスレジスタ 7 分岐先アドレス計算部 8 命令レジスタ 9 加算器 10 BTB 11 実行部 12 レジスタファイル 13 条件判断部 100 パイプライン・プロセッサ 1 Instruction Memory 2 Program Counter 3 Instruction Decode Unit 4 Counter Unit 5 Selector 6 Branch Destination Address Register 7 Branch Destination Address Calculation Unit 8 Instruction Register 9 Adder 10 BTB 11 Execution Unit 12 Register File 13 Condition Judgment Unit 100 Pipeline Processor

Claims (8)

【特許請求の範囲】[Claims] 【請求項1】 制御の流れを変更するまでに予告分岐命
令の後に続いて実行されるべき少なくとも1つの命令の
数を定義する予告分岐命令を実行するパイプライン・プ
ロセッサであって、 フェッチすべき命令のアドレスを保持するプログラムカ
ウンタと、 該プログラムカウンタによって保持されるアドレスに対
応する命令を出力する命令メモリと、 該命令メモリから出力された命令をフェッチし保持する
命令レジスタと、 該命令レジスタによって保持された命令をデコードする
ことにより、該命令が該予告分岐命令であるか否かを識
別する命令デコード部と、 カウンタ値を保持し、該カウンタ値と所定のしきい値と
を比較するカウンタ部であって、該カウンタ値は該予告
分岐命令によって定義された命令数に初期化され、該カ
ウンタ値は該プログラムカウンタがインクリメントされ
るのに同期してデクリメントされるカウンタ部と、 該プログラムカウンタによって保持されるアドレスをイ
ンクリメントし、該インクリメントされたアドレスを逐
次命令アドレスとして提供する加算器と、 該予告分岐命令の分岐先アドレスを提供する分岐先アド
レスレジスタと、 該カウンタ部の比較結果に応じて、該逐次命令アドレス
と該予告分岐命令の分岐先アドレスとのうちの一方を選
択するセレクタとを備えたパイプライン・プロセッサ。
1. A pipeline processor for executing a predictive branch instruction that defines the number of at least one instruction that should be executed following the predictive branch instruction before changing control flow, to be fetched. A program counter for holding an address of an instruction, an instruction memory for outputting an instruction corresponding to an address held by the program counter, an instruction register for fetching and holding an instruction output from the instruction memory, and an instruction register An instruction decoding unit that identifies whether or not the held instruction is the advance notice branch instruction by decoding the held instruction, and a counter that holds a counter value and compares the counter value with a predetermined threshold value. The counter value is initialized to the number of instructions defined by the advance branch instruction, and the counter value is A counter unit that is decremented in synchronization with the program counter being incremented, an adder that increments the address held by the program counter and provides the incremented address as a sequential instruction address, and the advance notice branch instruction. And a selector for selecting one of the sequential instruction address and the branch destination address of the advance notice branch instruction according to the comparison result of the counter unit. Line processor.
【請求項2】 前記予告分岐命令は、前記命令の種類を
識別するオペコードを格納する領域と、前記分岐先アド
レスを指定する領域と、前記制御の流れを変更するまで
に予告分岐命令の後に続いて実行されるべき少なくとも
1つの命令の数を格納する領域とを含んでいる、請求項
1に記載のパイプライン・プロセッサ。
2. The advance notice branch instruction follows an advance notice branch instruction until an area for storing an opcode for identifying the type of the instruction, an area for specifying the branch destination address, and the control flow is changed. And a region for storing the number of at least one instruction to be executed by the pipeline processor.
【請求項3】 前記所定のしきい値は、1つの命令をフ
ェッチするのに必要なサイクル数に等しい、請求項1に
記載のパイプライン・プロセッサ。
3. The pipeline processor of claim 1, wherein the predetermined threshold is equal to the number of cycles required to fetch an instruction.
【請求項4】 前記カウンタ部は、前記カウンタ値と前
記所定のしきい値とが一致する場合に、前記予告分岐命
令の分岐先アドレスを選択する選択信号を前記セレクタ
に出力する、請求項1に記載のパイプライン・プロセッ
サ。
4. The counter unit outputs a selection signal for selecting a branch destination address of the advance notice branch instruction to the selector when the counter value matches the predetermined threshold value. Pipeline processor described in.
【請求項5】 前記カウンタ部は、前記予告分岐命令に
よって定義された命令の数が前記所定のしきい値より小
さい場合に、前記予告分岐命令の分岐先アドレスを選択
する選択信号を前記セレクタに出力する、請求項1に記
載のパイプライン・プロセッサ。
5. The counter unit, when the number of instructions defined by the advance notice branch instruction is smaller than the predetermined threshold value, sends a selection signal for selecting a branch destination address of the advance notice branch instruction to the selector. The pipeline processor according to claim 1, which outputs.
【請求項6】 前記カウンタ部は、前記予告分岐命令に
よって定義された命令の数が前記所定のしきい値より小
さい場合に、前記命令レジスタによって保持された命令
をキャンセルする信号を前記命令レジスタに出力する、
請求項1に記載のパイプライン・プロセッサ。
6. The counter unit sends a signal to the instruction register to cancel the instruction held by the instruction register when the number of instructions defined by the advance notice branch instruction is smaller than the predetermined threshold value. Output,
The pipeline processor according to claim 1.
【請求項7】 前記パイプライン・プロセッサは、 前記予告分岐命令について前記制御の流れを変更するか
否かを判断する条件判断部をさらに備えており、 前記カウンタ部は、前記カウンタ値が所定の値に達した
場合に、前記予告分岐命令について前記制御の流れを変
更するか否かを判断するタイミングを規定する信号を該
条件判断部に出力する、請求項1に記載のパイプライン
・プロセッサ。
7. The pipeline processor further includes a condition determination unit that determines whether or not to change the control flow for the advance notice branch instruction, and the counter unit has a predetermined counter value. The pipeline processor according to claim 1, wherein when the value is reached, a signal defining a timing for determining whether to change the control flow for the advance notice branch instruction is output to the condition determining unit.
【請求項8】 前記条件判断部は、前記予告分岐命令に
ついて前記制御の流れを変更しないと判断した場合に、
前記命令レジスタによって保持された命令をキャンセル
する信号を前記命令レジスタに出力し、前記命令デコー
ド部によってデコードされる命令をキャンセルする信号
を前記命令デコード部に出力する、請求項7に記載のパ
イプライン・プロセッサ。
8. The condition judging unit, when judging that the control flow is not changed for the advance notice branch instruction,
The pipeline according to claim 7, wherein a signal for canceling an instruction held by the instruction register is output to the instruction register, and a signal for canceling an instruction decoded by the instruction decoding unit is output to the instruction decoding unit. -Processor.
JP8086868A 1995-04-12 1996-04-09 Pipeline processor Expired - Fee Related JP2883035B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP8086868A JP2883035B2 (en) 1995-04-12 1996-04-09 Pipeline processor

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP7-86844 1995-04-12
JP8684495 1995-04-12
JP8086868A JP2883035B2 (en) 1995-04-12 1996-04-09 Pipeline processor

Publications (2)

Publication Number Publication Date
JPH08339299A true JPH08339299A (en) 1996-12-24
JP2883035B2 JP2883035B2 (en) 1999-04-19

Family

ID=26427923

Family Applications (1)

Application Number Title Priority Date Filing Date
JP8086868A Expired - Fee Related JP2883035B2 (en) 1995-04-12 1996-04-09 Pipeline processor

Country Status (1)

Country Link
JP (1) JP2883035B2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002509302A (en) * 1997-12-17 2002-03-26 エス・アール・シィ・コンピューターズ・インコーポレイテッド A multiprocessor computer architecture incorporating multiple memory algorithm processors in a memory subsystem.
JP2007287186A (en) * 2007-08-09 2007-11-01 Denso Corp Risc type cpu, compiler, and microcomputer
JP2019509576A (en) * 2016-03-23 2019-04-04 エイアールエム リミテッド Branch instruction
WO2022030037A1 (en) * 2020-08-07 2022-02-10 LeapMind株式会社 Neural network circuit and neural network circuit control method

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002509302A (en) * 1997-12-17 2002-03-26 エス・アール・シィ・コンピューターズ・インコーポレイテッド A multiprocessor computer architecture incorporating multiple memory algorithm processors in a memory subsystem.
JP2010102719A (en) * 1997-12-17 2010-05-06 Src Computers Inc Multiprocessor computer architecture incorporating a plurality of memory algorithm processors in memory subsystem
JP2007287186A (en) * 2007-08-09 2007-11-01 Denso Corp Risc type cpu, compiler, and microcomputer
JP2019509576A (en) * 2016-03-23 2019-04-04 エイアールエム リミテッド Branch instruction
WO2022030037A1 (en) * 2020-08-07 2022-02-10 LeapMind株式会社 Neural network circuit and neural network circuit control method
JP2022030486A (en) * 2020-08-07 2022-02-18 LeapMind株式会社 Neural network circuit and method for controlling neural network circuit

Also Published As

Publication number Publication date
JP2883035B2 (en) 1999-04-19

Similar Documents

Publication Publication Date Title
KR100233220B1 (en) Pipeline processor
US7437537B2 (en) Methods and apparatus for predicting unaligned memory access
JP2744890B2 (en) Branch prediction data processing apparatus and operation method
RU2417407C2 (en) Methods and apparatus for emulating branch prediction behaviour of explicit subroutine call
US4775927A (en) Processor including fetch operation for branch instruction with control tag
US8572358B2 (en) Meta predictor restoration upon detecting misprediction
JP2004533695A (en) Method, processor, and compiler for predicting branch target
JPH10133873A (en) Processor and method for speculatively executing condition branching command by using selected one of plural branch prediction system
JP2000181710A (en) Branch instruction execution controller
US4541047A (en) Pipelined data processing system
US4739470A (en) Data processing system
US20020174327A1 (en) Efficient link and fall-through address calculation
CN115993992A (en) Early fetching of branch target buffers
JP4412905B2 (en) Low power operation control device and program optimization 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
US6871343B1 (en) Central processing apparatus and a compile method
US20160196156A1 (en) Simulation apparatus, simulation method, and computer product
JPH03129432A (en) Branch control circuit
JP2883035B2 (en) Pipeline processor
US20050027921A1 (en) Information processing apparatus capable of prefetching instructions
US20040003213A1 (en) Method for reducing the latency of a branch target calculation by linking the branch target address cache with the call-return stack
US7472264B2 (en) Predicting a jump target based on a program counter and state information for a process
KR920006770B1 (en) System for controlling instruction fetch controlling
JP2006053830A (en) Branch estimation apparatus and branch estimation method
JPH07262006A (en) Data processor with branch target address cache

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 19990121

LAPS Cancellation because of no payment of annual fees