JPH06250843A - Arithmetic processing method and arithmetic unit - Google Patents

Arithmetic processing method and arithmetic unit

Info

Publication number
JPH06250843A
JPH06250843A JP6136193A JP6136193A JPH06250843A JP H06250843 A JPH06250843 A JP H06250843A JP 6136193 A JP6136193 A JP 6136193A JP 6136193 A JP6136193 A JP 6136193A JP H06250843 A JPH06250843 A JP H06250843A
Authority
JP
Japan
Prior art keywords
instruction
branch
unit
address
execution
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
JP6136193A
Other languages
Japanese (ja)
Inventor
Koichi Takeda
浩一 武田
Teruhiko Ohara
輝彦 大原
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.)
National Institute of Advanced Industrial Science and Technology AIST
Original Assignee
Agency of Industrial Science and Technology
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 Agency of Industrial Science and Technology filed Critical Agency of Industrial Science and Technology
Priority to JP6136193A priority Critical patent/JPH06250843A/en
Publication of JPH06250843A publication Critical patent/JPH06250843A/en
Pending legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)

Abstract

PURPOSE:To speed up processing by changing the constitution of a program itself including a condition branching instruction, fetching both instructions for the success of branching and its failure and selecting either one of the instructions. CONSTITUTION:The constitution of the program itself is changed, a branch instruction is stored in an instruction address N of an instruction memory part 1 and a conditional instruction is stored in the succeeding instruction address N+1. The 1st instruction address supplying part 2-1 generates the address N to read out and fetch a branching instruction from the memory part 1 to the 1st instruction fetching part 3-1. An execution part 5 supplies a branched address A0 to the 1st and 2nd instruction address branching parts 2-1, 2-2 based upon an instruction execution result and supplies a branch generating information X and a branch success information Y to a selection control part 6, which controls an instruction selecting part 4, and when branching succeeds, selects a branched instruction and supplies the selected instruction to the execution part 5. When branching fails, the succeeding instruction is selected and supplied to the execution part 5.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、プログラムをパイプラ
イン制御により実行する場合に、条件分岐命令が含まれ
ていたとき、命令先取り効果を有効に利用し性能向上を
図る演算処理方法および演算処理装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an arithmetic processing method and an arithmetic processing for effectively improving the performance by effectively utilizing the instruction prefetching effect when a conditional branch instruction is included when executing a program by pipeline control. Regarding the device.

【0002】[0002]

【従来の技術】プロセッサによるマイクロプログラム制
御等の分野においては、プログラムの高速処理を図るた
めにパイプライン制御が行なわれている。このパイプラ
イン制御では、命令を格納したメモリから命令を順に呼
び出し、フェッチし、デコードし、実行し、格納すると
いった各ステージを代わる代わる順送りに行なう。即
ち、初めに読み出された命令がフェッチされ、次にデコ
ードされるタイミングで次の命令がフェッチされる。そ
して、初めに読み出された命令が実行されるとき、次に
読み出された命令がデコードされ、その次に読み出され
た命令がフェッチされる。こうした処理によって、ハー
ドウェアの効率的な利用と演算処理の高速化が図られ
る。
2. Description of the Related Art In the field of microprogram control by a processor or the like, pipeline control is performed in order to achieve high-speed processing of programs. In this pipeline control, the instructions are sequentially called from the memory in which the instructions are stored, fetched, decoded, executed, and stored, and the stages are alternately forwarded. That is, the instruction read first is fetched, and the next instruction is fetched at the timing of being decoded next. Then, when the instruction read first is executed, the instruction read next is decoded, and the instruction read next is fetched. Through such processing, efficient use of hardware and high-speed arithmetic processing can be achieved.

【0003】ところで、このようなプログラムに条件分
岐命令が含まれていたような場合、そのプログラムの実
行順序が変化するが、そのような場合のパイプライン制
御が問題となる。即ち、ある命令によって一定の演算結
果が得られた場合に、次の命令によって、直前の演算結
果がある条件を満たしている場合には続いて読み出され
るべき命令を飛ばして別の分岐先命令を実行するといっ
た処理が行われる。ところが、このような条件分岐命令
の指示する分岐先アドレスは、条件分岐命令の実行が完
了するまで得ることができない。従って、通常のパイプ
ライン制御では、予めどの命令を先取りし、フェッチ
し、デコードしてよいか判別がつかない。
When a conditional branch instruction is included in such a program, the execution order of the program changes, but pipeline control in such a case poses a problem. In other words, when a certain operation result is obtained by a certain instruction, if the next operation result satisfies a certain condition, the next instruction is skipped and another branch destination instruction is issued. Processing such as execution is performed. However, the branch destination address designated by such a conditional branch instruction cannot be obtained until the execution of the conditional branch instruction is completed. Thus, in the normal pipeline control, we anticipate in advance which instructions to fetch, can not tell determine may be decoded.

【0004】そこで、従来、例えば条件分岐命令の実行
を待たずに、これに続く命令や予測される分岐先命令を
画一的に先取りし、フェッチやデコードを行なって、も
し予測とは別の命令が実行されることになった場合に
は、既にフェッチ等をした命令を放棄し、改めて正しい
命令をフェッチするようにした。このような方法は分岐
予測と呼ばれ、例えば分岐発生の確率が非常に高いプロ
グラムでは、予測される分岐先命令を先取りすることに
よって高速化を図ることができる。また、別の方法とし
ては、条件分岐命令の実行から実際の分岐先命令の実行
まで数サイクルの時間をおき、その間分岐に無関係な命
令を実行させるようにする。なお、条件分岐命令の実行
終了から分岐先命令の実行開始までのサイクルを遅延ス
ロットと呼び、この方法は遅延分岐とも呼ばれている。
なお、上記のような従来技術は、例えば「情報科学辞
典」(岩波書店)p.739の「命令先取り」の説明、「高
性能コンピュータアーキテクチャ」(丸善)pp.160-166
の 3.5.1「条件分岐」等に記載されている。
Therefore, conventionally, for example, without waiting for the execution of a conditional branch instruction, the following instruction and the predicted branch destination instruction are uniformly prefetched, and fetched and decoded to perform a different operation from the prediction. When the instruction is to be executed, the instruction that has already been fetched is discarded and the correct instruction is fetched again. Such a method is called branch prediction, and for example, in a program with a very high probability of branch occurrence, the speed can be increased by prefetching the predicted branch destination instruction. As another method, several cycles are allowed from the execution of the conditional branch instruction to the actual execution of the branch destination instruction, and during that time, instructions unrelated to the branch are executed. The cycle from the end of execution of a conditional branch instruction to the start of execution of a branch destination instruction is called a delay slot, and this method is also called a delayed branch.
In addition, the conventional technology as described above is described, for example, in "Information Science Dictionary" (Iwanami Shoten), "Instruction Prefetching" in p.739, "High Performance Computer Architecture" (Maruzen) pp.160-166.
3.5.1 “Conditional branching” and so on.

【0005】[0005]

【発明が解決しようとする課題】ところで、上記のよう
な従来の条件分岐命令を含むプログラムの演算処理には
次のような問題があった。まず、予め分岐予測を行なっ
て命令を先取りする方法では、もしその分岐予測が外れ
た場合には、命令先取りの効果がなくなる。従って、何
れか一方への分岐が多く、分岐予測の立て易いプログラ
ム以外については、その性能が低下するという問題があ
った。しかも、RISCコンピュータ等のように、1サ
イクルで1命令を実行するプロセッサでは、条件分岐命
令の実行完了時に分岐先アドレスが算出されるので、そ
のままでは一方の分岐先命令を先取りすることは難し
い。
However, there are the following problems in the arithmetic processing of the program including the conventional conditional branch instruction as described above. First, in the method of performing branch prediction in advance and prefetching an instruction, if the branch prediction is missed, the effect of instruction prefetching is lost. Therefore, there is a problem that the number of branches to either one is large, and the performance of programs other than those for which branch prediction is easy to take deteriorates. Moreover, in a processor that executes one instruction in one cycle, such as a RISC computer, the branch destination address is calculated when the execution of the conditional branch instruction is completed, so it is difficult to prefetch one branch destination instruction as it is.

【0006】このために、予め分岐先の命令と分岐が成
立しなかった場合の命令の両方を先取りし、その何れか
一方の実行結果を利用するといった方法も考えられてい
るが、これには、条件分岐命令の読み出しと同時に、分
岐先命令のアドレスを得るために、分岐先命令毎に、対
応する分岐先アドレスを格納した情報テーブル等を別途
用意する必要があって、その構成が複雑になる。また、
遅延スロットにおいて、分岐に無関係な命令を実行させ
る方法では、条件分岐命令の後に実行可能な、分岐に無
関係な命令が存在しないような場合には、プロセッサの
性能が低下するという問題があった。
For this reason, a method has been considered in which both the branch destination instruction and the instruction in the case where the branch is not taken are prefetched and the execution result of either one of them is used. In order to obtain the address of the branch destination instruction at the same time as reading the conditional branch instruction, it is necessary to separately prepare an information table or the like that stores the corresponding branch destination address for each branch destination instruction, which complicates the configuration. Become. Also,
The method of executing an instruction unrelated to a branch in the delay slot has a problem that the performance of the processor is deteriorated when there is no instruction unrelated to the branch that can be executed after the conditional branch instruction.

【0007】本発明は以上の点に着目してなされたもの
で、条件分岐命令を含むプログラム自体の構成を変更し
て、分岐が成立した場合と不成立の場合の両方の命令の
先取りを可能とし、その後何れかを選択することにより
処理の高速化を図った演算処理方法および演算処理装置
を提供することを目的とするものである。
The present invention has been made by paying attention to the above points. By changing the configuration of the program itself including a conditional branch instruction, it is possible to prefetch both instructions when the branch is taken and when the branch is not taken. It is an object of the present invention to provide an arithmetic processing method and an arithmetic processing device in which the processing speed is increased by selecting either one thereafter.

【0008】[0008]

【課題を解決するための手段】本発明の第1発明は、条
件分岐命令を含むプログラムをパイプライン制御により
実行する場合において、複数の命令の何れかを実行する
ようにプログラムの分岐先を指定する分岐命令の実行開
始を、分岐条件を示す条件命令の実行開始に先行させ
て、前記分岐命令を実行して得られた分岐先命令アドレ
スを使用して、複数系統のパイプラインにより該当する
複数の分岐先命令を同時に先取りして読み出し、前記条
件命令の実行結果により、前記複数の分岐先命令のうち
の何れかを選択して実行することを特徴とする演算処理
方法に関する。
According to a first aspect of the present invention, when a program including a conditional branch instruction is executed by pipeline control, a branch destination of the program is designated so as to execute any one of a plurality of instructions. A branch instruction instruction address obtained by executing the branch instruction is preceded by the start of execution of a conditional instruction indicating a branch condition, and a plurality of corresponding pipelines are processed by a pipeline of a plurality of systems. Of the branch destination instructions are read out at the same time, and any one of the plurality of branch destination instructions is selected and executed according to the execution result of the conditional instruction.

【0009】第2発明は、条件分岐命令を含むプログラ
ムを格納した命令メモリ部と、この命令メモリ部へ同時
に異なる命令アドレスを供給するための、第1命令アド
レス供給部と第2命令アドレス供給部と、前記命令メモ
リ部から同時に読み出された2種の命令をフェッチする
ための、第1命令フェッチ部と第2命令フェッチ部と、
前記命令メモリ部から読み出された命令を実行する実行
部と、前記第1命令フェッチ部にフェッチされた命令と
前記第2命令フェッチ部にフェッチされた命令の何れか
一方を選択して前記実行部に出力する命令選択部と、前
記第1命令アドレス供給部及び第2命令アドレス供給部
と前記命令選択部の動作を制御する選択制御部とを備
え、前記第1命令アドレス供給部と前記第1命令フェッ
チ部とで構成されるパイプラインを第1系統のラインと
し、前記第2命令アドレス供給部と前記第2命令フェッ
チ部とで構成されるパイプラインを第2系統のラインと
したとき、何れか一方の系統のラインは、プログラム中
に分岐命令が含まれている場合に、分岐先を示す分岐命
令のフェッチ後に分岐条件を示す条件命令をフェッチさ
せて、その順に各命令を前記実行部に出力し、前記第1
系統のラインと第2系統のラインは、それぞれ分岐が成
立した場合の分岐先命令と、分岐不成立の場合の次命令
をフェッチして、前記選択制御部は、前記条件命令の実
行結果により何れか一方のラインにフェッチされた命令
を前記命令選択部に選択させて実行部に出力することを
特徴とする演算処理装置に関する。
A second aspect of the present invention is an instruction memory unit storing a program including a conditional branch instruction, and a first instruction address supply unit and a second instruction address supply unit for supplying different instruction addresses to the instruction memory unit at the same time. And a first instruction fetch unit and a second instruction fetch unit for fetching two types of instructions read simultaneously from the instruction memory unit,
The execution unit that executes the instruction read from the instruction memory unit, the instruction that is fetched by the first instruction fetch unit, and the instruction that is fetched by the second instruction fetch unit are selected and executed. A first instruction address supply unit, a second instruction address supply unit, and a selection control unit that controls the operation of the instruction selection unit, and the first instruction address supply unit and the first instruction address supply unit. When the pipeline composed of one instruction fetch unit is a line of the first system and the pipeline composed of the second instruction address supply unit and the second instruction fetch unit is a line of the second system, In the case where a branch instruction is included in the program, the line of either one of the lines causes the conditional instruction indicating the branch condition to be fetched after fetching the branch instruction indicating the branch destination, and each instruction in that order. The output to the execution unit, the first
The line of the system and the line of the second system fetch the branch destination instruction when the branch is taken and the next instruction when the branch is not taken, and the selection control unit determines which of the two depending on the execution result of the conditional instruction. The present invention relates to an arithmetic processing unit, wherein the instruction selection unit selects an instruction fetched in one line and outputs the instruction to an execution unit.

【0010】[0010]

【作用】この方法では、まずプログラム実行順序を指定
する条件分岐命令を実行して、分岐先命令アドレスを得
て、分岐が成立した場合と成立しない場合の命令を同時
に先取りする。分岐が成立するかどうかを決定する演算
処理命令は、条件分岐命令の直後に実行させ、無駄の無
いタイミングで分岐先命令の選択を行なう。従って、分
岐が成立した場合も不成立の場合もパイプラインの流れ
は乱れず、また条件分岐命令のフェッチから分岐先命令
のフェッチまでの間に無駄時間が生じない。
In this method, first, a conditional branch instruction designating a program execution order is executed to obtain a branch destination instruction address, and instructions for a case where a branch is taken and a case where the branch is not taken are prefetched at the same time. The arithmetic processing instruction that determines whether or not the branch is taken is executed immediately after the conditional branch instruction, and the branch destination instruction is selected at a timing without waste. Therefore, the pipeline flow is not disturbed whether the branch is taken or not taken, and no dead time is generated between the fetch of the conditional branch instruction and the fetch of the branch destination instruction.

【0011】上記の方法を実施するために、演算処理装
置には2系統のパイプラインを用意する。一方の系統の
ラインで分岐命令がフェッチされると、その実行ステー
ジで分岐条件を示す条件命令がフェッチされる。次に、
分岐命令の実行により得られた分岐先命令アドレスを利
用して、続くステージで例えば一方の系統のラインに次
の命令をフェッチし、他方の系統のラインに同時に分岐
先命令をフェッチする。更に、そのステージで実行され
た条件命令の実行結果により、次のステージで次の命令
か分岐先命令の何れか一方を選択し実行部に出力する。
この間に、両方の系統のラインではそれぞれ各命令の次
の命令の先行読み出しを行ない、命令選択部に選択され
た方のラインが、その後引続き次の命令をフェッチして
パイプライン処理を進める。
In order to carry out the above method, two pipelines are prepared in the arithmetic processing unit. When a branch instruction is fetched in the line of one system, a conditional instruction indicating a branch condition is fetched in the execution stage. next,
Using the branch destination instruction address obtained by executing the branch instruction, for example, the next instruction is fetched in the line of one system and the branch destination instruction is simultaneously fetched in the line of the other system in the subsequent stage. Further, depending on the execution result of the conditional instruction executed at that stage, either the next instruction or the branch destination instruction is selected at the next stage and output to the execution unit.
In the meantime, the preceding instruction of the instruction next to each instruction is performed on the lines of both systems, and the line selected by the instruction selection unit subsequently fetches the next instruction and advances the pipeline processing.

【0012】[0012]

【実施例】以下、本発明を図の実施例を用いて詳細に説
明する。図1は、本発明の演算処理装置実施例を示すブ
ロック図である。図の装置は、条件分岐命令を含むプロ
グラムを格納した命令メモリ部1と、その読み出された
命令を実行する実行部5を備えている。また、命令メモ
リ部1から命令を読み出すために、第1命令アドレス供
給部2−1及び第2命令アドレス供給部2−2を備えて
いる。更に、読み出された命令をフェッチするために、
第1命令フェッチ部3−1と、第2命令フェッチ部3−
2が設けられている。
The present invention will be described in detail below with reference to the embodiments shown in the drawings. FIG. 1 is a block diagram showing an embodiment of an arithmetic processing unit of the present invention. The illustrated apparatus includes an instruction memory unit 1 that stores a program including a conditional branch instruction, and an execution unit 5 that executes the read instruction. Moreover, in order to read an instruction from the instruction memory unit 1, a first instruction address supply unit 2-1 and a second instruction address supply unit 2-2 are provided. Furthermore, in order to fetch the read instruction,
First instruction fetch unit 3-1 and second instruction fetch unit 3-
Two are provided.

【0013】第1命令フェッチ部3−1と第2命令フェ
ッチ部3−2の出力は、何れも命令選択部4に入力し、
その何れか一方が選択されて実行部5に入力するよう構
成されている。更に、この装置には、第1命令アドレス
供給部2−1と、第2命令アドレス供給部2−2及び命
令選択部4の動作を制御するために、選択制御部6が設
けられている。この選択制御部6からは、命令選択部4
に対し命令選択信号S0が供給され、第1命令アドレス
供給部2−1に対し第1アドレス選択信号S1を供給
し、第2命令アドレス供給部2−2に対し第2アドレス
選択信号S2を供給する構成となっている。
The outputs of the first instruction fetch unit 3-1 and the second instruction fetch unit 3-2 are both input to the instruction selection unit 4,
Either one of them is selected and input to the execution unit 5. Further, this apparatus is provided with a selection control unit 6 for controlling the operations of the first instruction address supply unit 2-1, the second instruction address supply unit 2-2 and the instruction selection unit 4. From the selection control unit 6, the instruction selection unit 4
To the first instruction address supply unit 2-1 and the second address selection signal S2 to the second instruction address supply unit 2-2. It is configured to do.

【0014】一方、実行部5は、命令の実行結果に基づ
いて分岐先アドレスA0を第1命令アドレス供給部2−
1及び第2命令アドレス供給部2−2に供給し、分岐発
生通知Xと分岐成立通知Yとを選択制御部6に供給する
よう構成されている。即ち、この装置は、第1命令アド
レス供給部2−1及び第1命令フェッチ部3−1による
第1系統のラインと、第2命令アドレス供給部2−2と
第2命令フェッチ部3−2による第2系統のラインを有
し、それぞれ同時に命令メモリ部1から任意の命令を読
み出し、フェッチして、実行部5に供給できる構成とな
っている。
On the other hand, the execution unit 5 supplies the branch destination address A0 based on the execution result of the instruction to the first instruction address supply unit 2-.
The branch instruction notification X and the branch taken notification Y are supplied to the selection control section 6. That is, this apparatus is configured such that the first instruction line supply section 2-1 and the first instruction fetch section 3-1 form the first system line, the second instruction address supply section 2-2, and the second instruction fetch section 3-2. 2 has a second system line, and is configured to be able to simultaneously read and fetch arbitrary instructions from the instruction memory unit 1 and supply them to the execution unit 5.

【0015】図2に、本発明の方法によるプログラム例
説明図を示す。上記のような装置を使用し、本発明の方
法を実施する場合には、まず、そのプログラムが従来と
異なる構成をとる。図2に示したのは、そのようなプロ
グラムの例で、図1に示した命令メモリ部1の命令アド
レスをN−1、N、N+1、N+2…と表示した場合、
命令アドレスNに分岐命令が格納され、命令アドレスN
+1に条件命令が格納され、その後の命令アドレスに次
の命令あるいは分岐先命令が格納される。なお、この例
では分岐先命令は命令アドレスLに格納されている。
FIG. 2 shows an explanatory diagram of a program example according to the method of the present invention. When the method of the present invention is carried out using the apparatus as described above, first, the program has a configuration different from the conventional one. FIG. 2 shows an example of such a program. When the instruction address of the instruction memory unit 1 shown in FIG. 1 is displayed as N-1, N, N + 1, N + 2 ...
The branch instruction is stored in the instruction address N, and the instruction address N
The conditional instruction is stored in +1 and the next instruction or branch destination instruction is stored in the subsequent instruction address. In this example, the branch destination instruction is stored in the instruction address L.

【0016】一般に、条件分岐命令は、例えばもしK=
1であったら分岐先アドレスLへ移り、それ以外の場合
は次の命令を実行せよといった内容の命令が一文で記述
されるか、あるいはもし…ならば、という条件命令があ
って、その次に分岐先を示す分岐命令が記述される。し
かしながら、本発明では、このように初めに分岐先を指
定する分岐命令を記述し、その後に分岐条件を示す条件
命令を記述する。この図2の例では、命令アドレスNの
分岐命令は、次の命令の実行結果が真ならばL番地へ分
岐し、さもなければN+2番地の次命令を実行せよ、と
いう内容のものとなっている。また、次のN+1番地の
条件命令は、r0=r1ならば結果が真であるといった
内容となっている。
Generally, a conditional branch instruction is, for example, if K =
If it is 1, the instruction moves to the branch destination address L, and in other cases, an instruction with the content of executing the next instruction is described in one sentence, or if ... If there is a conditional instruction, then A branch instruction indicating the branch destination is described. However, in the present invention, the branch instruction designating the branch destination is first described, and then the conditional instruction indicating the branch condition is described. In the example of FIG. 2, the branch instruction of the instruction address N has a content of branching to the address L if the execution result of the next instruction is true, or executing the next instruction at the address N + 2 otherwise. There is. The condition instruction of the next address N + 1 has the content that the result is true if r0 = r1.

【0017】上記図1に示すような装置に、図2に示す
ようなプログラムを実行させた場合の概略動作を続いて
説明する。図3に、本発明による演算処理動作タイミン
グチャートを示す。このタイミングチャートは、装置の
動作用クロックによる各サイクルC1〜C7にタイミン
グを合わせて各命令が処理されていくところを、図の左
から右の方向へ時間が経過するように表わしたものであ
る。例えば、図1に示す第1命令アドレス供給部2−1
が命令アドレスNを発生させ、命令メモリ部1から分岐
命令を読み出したとする。この命令は図1の第1命令フ
ェッチ部3−1にフェッチされる。
The outline of the operation when the program shown in FIG. 2 is executed by the apparatus shown in FIG. 1 will be described below. FIG. 3 shows a timing chart of the arithmetic processing operation according to the present invention. This timing chart shows that each instruction is processed in synchronism with each cycle C1 to C7 according to the operation clock of the device, as time elapses from left to right in the figure. . For example, the first instruction address supply unit 2-1 shown in FIG.
Generates an instruction address N and reads a branch instruction from the instruction memory unit 1. This instruction is fetched by the first instruction fetch unit 3-1 in FIG.

【0018】なお、図3に示す各タイミングチャートの
中で、Fはフェッチステージ、Eは実行ステージ、Wは
書き込みステージを表わしている。このサイクルC1で
分岐命令のフェッチステージが実行されると、サイクル
C2において、分岐命令はEの実行ステージに移る。一
方、このサイクルC2に命令アドレスN+1の条件命令
がフェッチされる。この命令アドレスN+1も、図1に
示す第1命令アドレス供給部2−1から出力され、条件
命令は第1命令フェッチ部3−1にフェッチされる。な
お、この段階では、命令選択部4は第1命令フェッチ部
3−1の出力を実行部5に供給し続けているものとす
る。
In each timing chart shown in FIG. 3, F represents a fetch stage, E represents an execution stage, and W represents a write stage. When the fetch stage of the branch instruction is executed in this cycle C1, the branch instruction moves to the execution stage of E in the cycle C2. On the other hand, the conditional instruction of the instruction address N + 1 is fetched in this cycle C2. This instruction address N + 1 is also output from the first instruction address supply unit 2-1 shown in FIG. 1, and the conditional instruction is fetched by the first instruction fetch unit 3-1. At this stage, it is assumed that the instruction selection unit 4 continues to supply the output of the first instruction fetch unit 3-1 to the execution unit 5.

【0019】ここで、サイクルC2において、分岐命令
が実行されると、この分岐命令が示す分岐先アドレスが
得られる。図1に示す実行部5は、この分岐先アドレス
A0を第1命令アドレス供給部2−1及び第2命令アド
レス供給部2−2に供給する。次のサイクルC3では、
第1命令アドレス供給部2−1は、条件命令に続く次の
命令を読み出すために命令アドレスN+2を発生する。
命令メモリ部1からは次の命令が読み出され、第1命令
フェッチ部3−1にフェッチされる。
When the branch instruction is executed in cycle C2, the branch destination address indicated by the branch instruction is obtained. The execution unit 5 shown in FIG. 1 supplies the branch destination address A0 to the first instruction address supply unit 2-1 and the second instruction address supply unit 2-2. In the next cycle C3,
The first instruction address supply unit 2-1 generates an instruction address N + 2 to read the next instruction following the conditional instruction.
The next instruction is read from the instruction memory unit 1 and fetched by the first instruction fetch unit 3-1.

【0020】一方、上記サイクルC2において、分岐命
令が実行されると、その命令が分岐命令であることを通
知する分岐発生通知Xが選択制御部6に向け出力され
る。選択制御部6は、これによって第2アドレス選択信
号S2を生成し、第2命令アドレス供給部2−2に対し
分岐先アドレスA0の選択を実行させる。第2命令アド
レス供給部2−2は、分岐先アドレスA0を命令メモリ
部1に供給する。これにより、命令メモリ部1からは分
岐先アドレスLの分岐先命令が読み出され、第2命令フ
ェッチ部3−2にフェッチされる。
On the other hand, when a branch instruction is executed in the cycle C2, a branch occurrence notification X notifying that the instruction is a branch instruction is output to the selection control unit 6. The selection control unit 6 thereby generates the second address selection signal S2 and causes the second instruction address supply unit 2-2 to select the branch destination address A0. The second instruction address supply unit 2-2 supplies the branch destination address A0 to the instruction memory unit 1. As a result, the branch destination instruction at the branch destination address L is read from the instruction memory unit 1 and fetched by the second instruction fetch unit 3-2.

【0021】サイクルC3では、分岐命令は書き込みス
テージに移り、条件命令は実行ステージに移る。このス
テージで、条件命令によって分岐条件が成立したか不成
立かの結果が得られる。その結果は、図1に示す実行部
5から分岐成立通知Yとして選択制御部6に供給され
る。選択制御部6に分岐成立通知Yが入力すると、その
内容に従って選択制御部6は命令選択信号S0を生成
し、命令選択部4を制御する。これによって、分岐が成
立した場合には分岐先命令が選択されて実行部5に供給
され、分岐が不成立の場合には次の命令が選択されて実
行部5に供給される。
In cycle C3, the branch instruction moves to the write stage and the conditional instruction moves to the execute stage. At this stage, the result of whether the branch condition is satisfied or not is obtained by the conditional instruction. The result is supplied from the execution unit 5 shown in FIG. 1 to the selection control unit 6 as a branch establishment notification Y. When the branch control notification 6 is input to the selection control unit 6, the selection control unit 6 generates an instruction selection signal S0 according to the contents of the notification Y and controls the instruction selection unit 4. Thus, when the branch is taken, the branch destination instruction is selected and supplied to the execution unit 5, and when the branch is not taken, the next instruction is selected and supplied to the execution unit 5.

【0022】この図3に示す例では、分岐が成立し、分
岐先命令が次のサイクルC4において実行ステージに移
されるところを示している。なお、分岐が成立した場合
には、その後第2命令アドレス供給部2−2の読み出し
制御を優先させ、これによって読み出される次の命令ア
ドレスL+1の命令が、命令メモリ部1から読み出さ
れ、第2命令フェッチ部3−2にフェッチされる。従っ
て、その後は第2命令アドレス供給部2−2による第2
方法のラインによって命令の読み出しが制御され、命令
選択部4は第2命令フェッチ部3−2の出力を実行部5
に供給し続ける。
In the example shown in FIG. 3, a branch is taken and the branch destination instruction is moved to the execution stage in the next cycle C4. When the branch is taken, the read control of the second instruction address supply unit 2-2 is prioritized thereafter, and the instruction at the next instruction address L + 1 read by this is read from the instruction memory unit 1 and It is fetched by the 2-instruction fetch unit 3-2. Therefore, after that, the second instruction address supply unit 2-2 performs the second
Instruction reading is controlled by the method line, and the instruction selecting unit 4 outputs the output of the second instruction fetching unit 3-2 to the executing unit 5.
To continue to supply.

【0023】以上のように、本発明の方法によれば図3
に示した通り、分岐が成立した場合も分岐が不成立の場
合も、パイプライン制御が円滑に行なわれる。また、予
め先行読み出しされ、フェッチされた命令の何れか一方
が、必ず実行ステージに移されるため、無駄がなく効率
のよい高速演算処理が可能となる。
As described above, according to the method of the present invention, FIG.
As shown in, the pipeline control is smoothly performed regardless of whether the branch is taken or not taken. Further, since either one of the instructions read in advance and fetched in advance is always transferred to the execution stage, efficient high-speed arithmetic processing without waste is possible.

【0024】図4に、本発明の装置の具体的実施例ブロ
ック図を示す。図1に示す装置は、具体的には、この図
に示すような回路構成によって実現する。即ち、図1に
示す第1命令アドレス供給部2−1は、第1アドレスセ
レクタ101と、第1命令アドレスレジスタ102、1
03と第1加算器104から構成される。また、図1に
示す第2命令アドレス供給部2−2は、第2アドレスセ
レクタ201と第2命令アドレスレジスタ202、20
3と第2加算器204とから構成される。
FIG. 4 shows a block diagram of a concrete embodiment of the apparatus of the present invention. The device shown in FIG. 1 is specifically realized by the circuit configuration shown in this figure. That is, the first instruction address supply unit 2-1 shown in FIG. 1 includes the first address selector 101 and the first instruction address registers 102, 1
03 and the first adder 104. Further, the second instruction address supply unit 2-2 shown in FIG. 1 includes a second address selector 201 and second instruction address registers 202, 20.
3 and a second adder 204.

【0025】第1命令アドレスレジスタ102、103
は、第1アドレスセレクタ101から出力される命令ア
ドレスを1サイクルの時間だけ保持するためのレジスタ
から構成される。第1加算器104は、第1命令アドレ
スレジスタ103の出力に1を加算し、命令アドレスを
インクリメントして第1アドレスセレクタ101に供給
するための回路である。また、第2命令アドレスレジス
タ202、203は、第2アドレスセレクタ201の出
力を1サイクル保持するためのレジスタである。第2加
算器204は、第2命令アドレスレジスタ203の出力
に1を加算し、命令アドレスをインクリメントして第2
アドレスセレクタ201に供給するための回路である。
First instruction address registers 102, 103
Is composed of a register for holding the instruction address output from the first address selector 101 for the time of one cycle. The first adder 104 is a circuit for adding 1 to the output of the first instruction address register 103, incrementing the instruction address, and supplying it to the first address selector 101. The second instruction address registers 202 and 203 are registers for holding the output of the second address selector 201 for one cycle. The second adder 204 increments the instruction address by adding 1 to the output of the second instruction address register 203
This is a circuit for supplying to the address selector 201.

【0026】上記第1アドレスセレクタ101と第2ア
ドレスセレクタ201とには、分岐先アドレスA0が供
給される。また、第1アドレスセレクタ101及び第2
アドレスセレクタ201の選択動作を制御するために、
第1アドレス選択信号S1及び第2アドレス選択信号S
2が供給されている。命令メモリ部1の出力は、第1命
令レジスタ105及び第2命令レジスタ205に接続さ
れている。これらのレジスタに命令メモリ部1から読み
出された命令がフェッチされる。なお、第1命令レジス
タ105の出力と第2命令レジスタ205の出力は、命
令セレクタ40に入力する。この命令セレクタ40は、
入力信号の何れか一方を選択して、デコード及び実行ユ
ニット50に出力するためのマルチプレクサ等から構成
される。なお、この選択制御のために、命令選択信号S
0が命令セレクタ40に入力する構成とされている。デ
コード及び実行ユニット50は、命令セレクタ40を介
して入力する命令のデコードと実行を行なうための回路
である。一般に、デコード部と実行部とは、それぞれ別
々のブロックで構成されるが、特に本発明においては、
その詳細は説明の必要が無いため図示を省略している。
A branch destination address A0 is supplied to the first address selector 101 and the second address selector 201. In addition, the first address selector 101 and the second
In order to control the selection operation of the address selector 201,
First address selection signal S1 and second address selection signal S
2 is supplied. The output of the instruction memory unit 1 is connected to the first instruction register 105 and the second instruction register 205. The instruction read from the instruction memory unit 1 is fetched into these registers. The output of the first instruction register 105 and the output of the second instruction register 205 are input to the instruction selector 40. This instruction selector 40 is
It is composed of a multiplexer or the like for selecting either one of the input signals and outputting it to the decoding and execution unit 50. For this selection control, the command selection signal S
0 is input to the instruction selector 40. The decode and execute unit 50 is a circuit for decoding and executing an instruction input via the instruction selector 40. In general, the decoding unit and the execution unit are each composed of separate blocks, but particularly in the present invention,
The details are not shown because they need not be described.

【0027】図5に、選択制御部の具体例ブロック図を
示す。図4に示すデコード及び実行ユニット50から出
力される分岐発生通知Xや分岐成立通知Yを受入れ、更
に図4に示す第1アドレスセレクタ101や第2アドレ
スセレクタ201に対し、第1アドレス選択信号S1や
第2アドレス選択信号S2を出力し、同時に命令セレク
タ40に対し命令選択信号S0を供給するために、選択
制御部は、この図に示すような構成とされる。この選択
制御部は、論理ゲート群から構成される制御信号発生回
路60と、その入力側及び出力側に設けられたレジスタ
61、62から構成される。この図に示すように、分岐
発生通知Xは、制御信号発生回路60に直接入力する
他、レジスタ61において1サイクルだけ保持された
後、制御信号発生回路60に入力する構成とされてい
る。また、制御信号発生回路60には、この他に、分岐
成立通知Yが入力する。
FIG. 5 shows a block diagram of a specific example of the selection control unit. The branch occurrence notification X and the branch taken notification Y output from the decoding and execution unit 50 shown in FIG. 4 are accepted, and the first address selection signal S1 is sent to the first address selector 101 and the second address selector 201 shown in FIG. In order to output the second address selection signal S2 and the instruction selection signal S0 to the instruction selector 40 at the same time, the selection control unit is configured as shown in this figure. The selection control unit is composed of a control signal generation circuit 60 composed of a group of logic gates, and registers 61 and 62 provided on the input side and the output side thereof. As shown in this figure, the branch occurrence notification X is directly input to the control signal generation circuit 60, and is also input to the control signal generation circuit 60 after being held for one cycle in the register 61. In addition to this, the branch taken notification Y is also input to the control signal generation circuit 60.

【0028】一方、制御信号発生回路60からは、第1
アドレス選択信号S1と第2アドレス選択信号S2が出
力される。また、命令選択信号S0は、レジスタ62を
介して制御信号発生回路60から出力される。なお、こ
の命令選択信号S0は、各制御信号生成のために、制御
信号発生回路60に再び入力するよう構成されている。
上記の構成により、レジスタ61からは制御信号発生回
路60に対し前回の分岐発生通知Xの内容が供給される
よう構成され、また制御信号発生回路60からはレジス
タ62に対し次回の命令選択信号が供給される構成とな
っている。
On the other hand, from the control signal generation circuit 60, the first
The address selection signal S1 and the second address selection signal S2 are output. The instruction selection signal S0 is output from the control signal generation circuit 60 via the register 62. The instruction selection signal S0 is configured to be input again to the control signal generation circuit 60 for generating each control signal.
With the above configuration, the register 61 is configured to supply the content of the previous branch occurrence notification X to the control signal generation circuit 60, and the control signal generation circuit 60 sends the next instruction selection signal to the register 62. It is configured to be supplied.

【0029】図6に、上記選択制御部動作説明図を示
す。上記のような選択制御部は、制御信号発生回路60
の論理回路によって、この図に示すような内容の各信号
の生成を行なう。即ち、図の左側に示す分岐発生通知X
と、分岐発生通知保持信号XB、分岐成立通知Y及び直
前に出力された命令選択信号S0が図5の制御信号発生
回路60に入力すると、これによって次回の命令選択信
号SNと、第1アドレス選択信号S1及び第2アドレス
選択信号S2が生成される。なお、この図において、
“0”はロウレベル、“1”はハイレベルの信号を示
し、“X”は無効な信号を示している。これらの信号
は、既に図3の演算処理動作で説明したようなタイミン
グで回路各部に供給されることになる。
FIG. 6 is a diagram for explaining the operation of the selection control section. The selection control unit as described above includes the control signal generation circuit 60.
The respective logic circuits generate the signals shown in FIG. That is, the branch occurrence notification X shown on the left side of the figure.
When the branch occurrence notification holding signal XB, the branch taken notification Y, and the instruction selection signal S0 output immediately before are input to the control signal generation circuit 60 of FIG. 5, this causes the next instruction selection signal SN and the first address selection. The signal S1 and the second address selection signal S2 are generated. In addition, in this figure,
"0" indicates a low level signal, "1" indicates a high level signal, and "X" indicates an invalid signal. These signals are supplied to each part of the circuit at the timings already described in the arithmetic processing operation of FIG.

【0030】図7に、本発明の装置の動作タイミングチ
ャートを示す。このタイミングチャートを見ながら、図
4、図5に示す回路による一連の命令処理動作を具体的
に説明する。なお、この動作プログラムは、図2に示し
たものと同様である。また、この図の(a)には第1命
令アドレスレジスタ102に格納される第1命令アドレ
ス、(b)には第2命令アドレスレジスタ202に格納
される第2命令アドレス、(c)には第1命令レジスタ
105に格納される第1命令、(d)には第2命令レジ
スタ205に格納する第2命令、(e)には命令セレク
タ40に供給される命令選択信号、(f)にはデコード
及び実行ユニット50に入力した実行中の命令、(g)
にはデコード及び実行ユニット50から出力される分岐
発生通知X、(h)には図5のレジスタ61から制御信
号発生回路60に供給される分岐発生通知保持信号X
B、(i)にはデコード及び実行ユニット50から出力
される分岐成立通知、(j)には第1アドレスセレクタ
101の選択制御に使用される第1アドレス選択信号S
1、(k)には第2アドレスセレクタ201の選択制御
に使用される第2アドレス選択信号S2、(m)にはデ
コード及び実行ユニット50から出力される分岐先アド
レス、(n)には装置の制御に使用されるクロックを示
した。
FIG. 7 shows an operation timing chart of the device of the present invention. A series of instruction processing operations by the circuits shown in FIGS. 4 and 5 will be specifically described with reference to this timing chart. Note that this operation program is the same as that shown in FIG. Further, in FIG. 9A, the first instruction address stored in the first instruction address register 102 is shown, the second instruction address stored in the second instruction address register 202 is shown in FIG. The first instruction stored in the first instruction register 105, the second instruction stored in the second instruction register 205 in (d), the instruction selection signal supplied to the instruction selector 40 in (e), and (f). Is the executing instruction input to the decode and execute unit 50, (g)
Is the branch occurrence notification X output from the decoding and execution unit 50, and (h) is the branch occurrence notification holding signal X supplied from the register 61 of FIG. 5 to the control signal generation circuit 60.
B, (i) a branch taken notification output from the decoding and execution unit 50, and (j) a first address selection signal S used for selection control of the first address selector 101.
1, (k) is the second address selection signal S2 used for selection control of the second address selector 201, (m) is the branch destination address output from the decoding and execution unit 50, and (n) is the device. The clocks used to control the are shown.

【0031】ここで、まずサイクルC1において、
(a)に示すように第1命令アドレスレジスタ102か
ら第1命令アドレスNが命令メモリ部1に供給される
と、(c)のように命令メモリ部1から第1命令が読み
出され、第1命令レジスタ105にフェッチされる。な
お、(f)に示すように、この段階ではデコード及び実
行ユニット50は命令アドレスN−1の命令を実行して
いる。また、(e)に示す命令選択信号S0はロウレベ
ルで、命令セレクタ40は第1命令レジスタ105の出
力をデコード及び実行ユニット50に供給しているもの
とする。このサイクルC1では、(j)に示す第1アド
レス選択信号がロウレベルとされ、第1アドレスセレク
タ101は第1加算器104の出力信号を選択して第1
命令アドレスレジスタ103に出力する状態となってい
る。従って、次のサイクルC2では、第1加算器104
により直前の命令アドレスに1が加算されたアドレスN
+1が命令アドレスとして使用される。
First, in cycle C1,
When the first instruction address N is supplied from the first instruction address register 102 to the instruction memory unit 1 as shown in (a), the first instruction is read from the instruction memory unit 1 as shown in (c) and It is fetched into the 1-instruction register 105. As shown in (f), the decoding and executing unit 50 is executing the instruction at the instruction address N-1 at this stage. Further, it is assumed that the instruction selection signal S0 shown in (e) is at a low level, and the instruction selector 40 supplies the output of the first instruction register 105 to the decoding and execution unit 50. In this cycle C1, the first address selection signal shown in (j) is set to the low level, and the first address selector 101 selects the output signal of the first adder 104 to make the first
It is ready to be output to the instruction address register 103. Therefore, in the next cycle C2, the first adder 104
Address N obtained by adding 1 to the instruction address immediately before
+1 is used as the instruction address.

【0032】サイクルC2においては、これにより
(a)に示す第1命令アドレスがN+1の命令が命令メ
モリ1から読み出され、第1命令レジスタ105にフェ
ッチされる。ここで、(f)に示すように、デコード及
び実行ユニット50は命令アドレスNの命令を実行して
いる。この例では、命令アドレスNの命令は、図2に示
した通り分岐命令である。従って、(g)に示すよう
に、サイクルC2の後半において、デコード及び実行ユ
ニット50から分岐発生通知Xが出力され、更に分岐先
アドレスA0が出力される。これは(m)に示したよう
に、Lとなる。
In cycle C2, the instruction having the first instruction address N + 1 shown in (a) is read from the instruction memory 1 and fetched in the first instruction register 105. Here, as shown in (f), the decoding and execution unit 50 is executing the instruction at the instruction address N. In this example, the instruction at the instruction address N is a branch instruction as shown in FIG. Therefore, as shown in (g), in the latter half of the cycle C2, the decode and execution unit 50 outputs the branch occurrence notification X, and further outputs the branch destination address A0. This becomes L as shown in (m).

【0033】ここで、図6に示す論理に従って、図7
(k)に示す第2アドレス選択信号がロウレベルからハ
イレベルに切り替わる。こうして、図4に示す第2アド
レスセレクタ201は、分岐先アドレスA0を選択して
第2命令アドレスレジスタ202に向け出力する。次の
サイクルC3においては、第1命令アドレスレジスタ1
02から供給される第1命令アドレスはN+2となり、
このアドレスN+2の命令が第1命令レジスタ105に
フェッチされる。一方、第2命令アドレスレジスタ20
2から第2命令アドレスLが命令メモリ部1に供給さ
れ、第2命令レジスタ205にアドレスLの第2命令が
フェッチされる。上記図2に示す例では、第1命令レジ
スタ105に次の命令がフェッチされ、第2命令レジス
タ205に分岐先命令がフェッチされることになる。こ
のサイクルC3では、先に第1命令レジスタ105にフ
ェッチされていた条件命令が命令セレクタ40を通じて
デコード及び実行ユニット50に供給され、実行されて
いる(図7(f))。
Here, according to the logic shown in FIG.
The second address selection signal shown in (k) switches from low level to high level. In this way, the second address selector 201 shown in FIG. 4 selects the branch destination address A0 and outputs it to the second instruction address register 202. In the next cycle C3, the first instruction address register 1
The first instruction address supplied from 02 is N + 2,
The instruction at the address N + 2 is fetched into the first instruction register 105. On the other hand, the second instruction address register 20
The second instruction address L from 2 is supplied to the instruction memory unit 1, and the second instruction at the address L is fetched into the second instruction register 205. In the example shown in FIG. 2, the next instruction is fetched in the first instruction register 105, and the branch destination instruction is fetched in the second instruction register 205. In this cycle C3, the conditional instruction previously fetched in the first instruction register 105 is supplied to the decoding and execution unit 50 through the instruction selector 40 and is executed (FIG. 7 (f)).

【0034】その結果、図7(i)に示すように、この
サイクルC3の終了部分で分岐成立が判断され、デコー
ド及び実行ユニット50から分岐成立通知Yが、図5に
示す制御信号発生回路60に入力する。なお、このとき
図7(h)に示すように、分岐発生通知保持信号は、サ
イクルC3の間、ハイレベルとなっている。従って、図
6に示す論理により、次のタイミングで、図7(e)に
示す命令選択信号S0がロウレベルからハイレベルに切
り替わる。
As a result, as shown in FIG. 7 (i), it is judged that the branch is taken at the end of the cycle C3, and the decode and execute unit 50 sends a branch taken notification Y to the control signal generating circuit 60 shown in FIG. To enter. At this time, as shown in FIG. 7H, the branch occurrence notification holding signal is at the high level during the cycle C3. Therefore, according to the logic shown in FIG. 6, the instruction selection signal S0 shown in FIG. 7E switches from the low level to the high level at the next timing.

【0035】図4に示す命令セレクタ40は、第2命令
レジスタ205にフェッチされた命令を選択し、デコー
ド及び実行ユニット50に向け出力するよう動作する。
これによって、次のサイクルC4では、分岐先アドレス
Lにある分岐先命令が実行され、これと同時にフェッチ
された次の命令は放棄される。なお、このサイクルC4
においては、第2命令アドレスレジスタ202に格納さ
れた第2命令アドレスL+1が命令メモリ部1に向け出
力されて、そのアドレスにある命令が第2命令レジスタ
205にフェッチされる。こうして、以後、今度は第2
命令レジスタ205の出力が継続的に選択されてデコー
ド及び実行ユニット50に供給される。
The instruction selector 40 shown in FIG. 4 operates to select the instruction fetched in the second instruction register 205 and output it to the decoding and execution unit 50.
As a result, in the next cycle C4, the branch target instruction at the branch target address L is executed, and the next instruction fetched at the same time is abandoned. This cycle C4
In, the second instruction address L + 1 stored in the second instruction address register 202 is output to the instruction memory unit 1 and the instruction at that address is fetched into the second instruction register 205. Thus, after this, the second time
The output of the instruction register 205 is continuously selected and provided to the decode and execute unit 50.

【0036】なお、上記サイクルC3において、条件分
岐が不成立という結果が得られた場合には、命令セレク
タ40は、これまで同様第1命令レジスタ105の出力
を選択し、デコード及び実行ユニット50に向け供給す
る。従って、上記のような構成により、分岐命令の発生
の際、常に2系統のパイプラインが、同時に次に実行す
る命令を先行読み出しして、無駄なく処理を進めること
ができる。
In the cycle C3, when the result that the conditional branch is not taken is obtained, the instruction selector 40 selects the output of the first instruction register 105 as before and directs it to the decoding and execution unit 50. Supply. Therefore, with the above-described configuration, when a branch instruction occurs, the pipelines of two systems can always read ahead the instruction to be executed next at the same time and proceed with processing without waste.

【0037】本発明は以上の実施例に限定されない。上
記実施例においては、パイプラインを2系統としたが、
例えば条件分岐命令によって分岐先が3以上に別れるよ
うなプログラムであれば、パイプラインを3系統以上設
けるようにすればよい。
The present invention is not limited to the above embodiments. In the above embodiment, the pipeline has two systems,
For example, if the program is such that the branch destination is divided into three or more depending on the conditional branch instruction, three or more pipelines may be provided.

【0038】[0038]

【発明の効果】以上説明した本発明の演算処理方法およ
び演算処理装置によれば、分岐先を指定する分岐命令の
実行開始を分岐条件を示す条件命令の実行開始に先行さ
せ、分岐命令を実行している間、分岐先命令アドレスを
使用して、複数系統のパイプラインにより先取りした複
数の分岐先命令を条件命令の実行結果により選択するよ
うにしたので、RISCコンピュータのように1サイク
ルで1命令を実行するようなプロセッサにおいて、分岐
先の両方の命令を先取りし、無駄なくパイプライン処理
を実行できる。また、上記のように複数のパイプライン
を設けることによって、その何れかを選択し、常に命令
先取りの効果を生かすことができ、演算処理の高速化と
高能率化を図ることができる。
According to the arithmetic processing method and the arithmetic processing apparatus of the present invention described above, the execution start of the branch instruction designating the branch destination is preceded by the execution start of the conditional instruction indicating the branch condition, and the branch instruction is executed. During this time, the branch destination instruction address is used to select a plurality of branch destination instructions prefetched by the pipelines of multiple systems according to the execution result of the conditional instruction. In a processor that executes instructions, both instructions at the branch destination can be preempted and pipeline processing can be executed without waste. Further, by providing a plurality of pipelines as described above, it is possible to select any one of them and always take advantage of the instruction prefetching, and it is possible to speed up the arithmetic processing and increase the efficiency.

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

【図1】本発明の演算処理装置実施例を示すブロック図
である。
FIG. 1 is a block diagram showing an embodiment of an arithmetic processing unit of the present invention.

【図2】本発明の方法によるプログラム例説明図であ
る。
FIG. 2 is a diagram illustrating a program example according to the method of the present invention.

【図3】本発明による演算処理動作タイミングチャート
である。
FIG. 3 is a timing chart of a calculation processing operation according to the present invention.

【図4】本発明の装置の具体的実施例ブロック図であ
る。
FIG. 4 is a block diagram of a specific embodiment of the device of the present invention.

【図5】選択制御部の具体例ブロック図である。FIG. 5 is a block diagram of a specific example of a selection control unit.

【図6】選択制御部動作説明図である。FIG. 6 is an operation explanatory diagram of a selection control unit.

【図7】本発明の装置の動作タイミングチャートであ
る。
FIG. 7 is an operation timing chart of the device of the present invention.

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

1 命令メモリ部 2−1 第1命令アドレス供給部 2−2 第2命令アドレス供給部 3−1 第1命令フェッチ部 3−2 第2命令フェッチ部 4 命令選択部 5 実行部 6 選択制御部 1 Instruction Memory Unit 2-1 First Instruction Address Supply Unit 2-2 Second Instruction Address Supply Unit 3-1 First Instruction Fetch Unit 3-2 Second Instruction Fetch Unit 4 Instruction Selection Unit 5 Execution Unit 6 Selection Control Unit

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 条件分岐命令を含むプログラムをパイプ
ライン制御により実行する場合において、 複数の命令の何れかを実行するようにプログラムの分岐
先を指定する分岐命令の実行開始を、 分岐条件を示す条件命令の実行開始に先行させて、 前記分岐命令を実行して得られた分岐先命令アドレスを
使用して、複数系統のパイプラインにより該当する複数
の分岐先命令を同時に先取りして読み出し、 前記条件命令の実行結果により、前記複数の分岐先命令
のうちの何れかを選択して実行することを特徴とする演
算処理方法。
1. When a program including a conditional branch instruction is executed under pipeline control, execution of a branch instruction that specifies a branch destination of the program so as to execute any one of a plurality of instructions is indicated by a branch condition. Prior to the start of execution of the conditional instruction, the branch destination instruction address obtained by executing the branch instruction is used to prefetch and read a corresponding plurality of branch destination instructions at the same time by a pipeline of a plurality of systems, An arithmetic processing method, wherein any one of the plurality of branch destination instructions is selected and executed according to the execution result of the conditional instruction.
【請求項2】 条件分岐命令を含むプログラムを格納し
た命令メモリ部と、 この命令メモリ部へ同時に異なる命令アドレスを供給す
るための、第1命令アドレス供給部と第2命令アドレス
供給部と、 前記命令メモリ部から同時に読み出された2種の命令を
フェッチするための、第1命令フェッチ部と第2命令フ
ェッチ部と、 前記命令メモリ部から読み出された命令を実行する実行
部と、 前記第1命令フェッチ部にフェッチされた命令と前記第
2命令フェッチ部にフェッチされた命令の何れか一方を
選択して前記実行部に出力する命令選択部と、 前記第1命令アドレス供給部及び第2命令アドレス供給
部と前記命令選択部の動作を制御する選択制御部とを備
え、 前記第1命令アドレス供給部と前記第1命令フェッチ部
とで構成されるパイプラインを第1系統のラインとし、
前記第2命令アドレス供給部と前記第2命令フェッチ部
とで構成されるパイプラインを第2系統のラインとした
とき、 何れか一方の系統のラインは、 プログラム中に分岐命令が含まれている場合に、分岐先
を示す分岐命令のフェッチ後に分岐条件を示す条件命令
をフェッチさせて、その順に各命令を前記実行部に出力
し、 前記第1系統のラインと第2系統のラインは、 それぞれ分岐が成立した場合の分岐先命令と、分岐不成
立の場合の次命令をフェッチして、 前記選択制御部は、 前記条件命令の実行結果により何れか一方のラインにフ
ェッチされた命令を前記命令選択部に選択させて実行部
に出力することを特徴とする演算処理装置。
2. An instruction memory unit storing a program including a conditional branch instruction, a first instruction address supply unit and a second instruction address supply unit for simultaneously supplying different instruction addresses to the instruction memory unit, A first instruction fetch unit and a second instruction fetch unit for fetching two types of instructions read simultaneously from the instruction memory unit; an execution unit that executes the instructions read from the instruction memory unit; An instruction selection unit that selects one of the instruction fetched by the first instruction fetch unit and the instruction fetched by the second instruction fetch unit and outputs the selected instruction to the execution unit; the first instruction address supply unit; A two-instruction address supply unit and a selection control unit that controls the operation of the instruction selection unit, and a pipeline configured by the first instruction address supply unit and the first instruction fetch unit. The in is the line of the first system,
When the pipeline composed of the second instruction address supply unit and the second instruction fetch unit is a second system line, one of the system lines includes a branch instruction in the program. In this case, after fetching a branch instruction indicating a branch destination, a conditional instruction indicating a branch condition is fetched, and each instruction is output to the execution unit in that order, and the first system line and the second system line are respectively The branch destination instruction when the branch is taken and the next instruction when the branch is not taken are fetched, and the selection control unit selects the instruction fetched in one of the lines depending on the execution result of the conditional instruction. An arithmetic processing device characterized by causing a section to select and outputting to an execution section.
JP6136193A 1993-02-26 1993-02-26 Arithmetic processing method and arithmetic unit Pending JPH06250843A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6136193A JPH06250843A (en) 1993-02-26 1993-02-26 Arithmetic processing method and arithmetic unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6136193A JPH06250843A (en) 1993-02-26 1993-02-26 Arithmetic processing method and arithmetic unit

Publications (1)

Publication Number Publication Date
JPH06250843A true JPH06250843A (en) 1994-09-09

Family

ID=13168954

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6136193A Pending JPH06250843A (en) 1993-02-26 1993-02-26 Arithmetic processing method and arithmetic unit

Country Status (1)

Country Link
JP (1) JPH06250843A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5769457A (en) * 1980-10-17 1982-04-28 Nec Corp Microprogram controller
JPH03288929A (en) * 1990-04-06 1991-12-19 Fujitsu Ltd Double pipe line control system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5769457A (en) * 1980-10-17 1982-04-28 Nec Corp Microprogram controller
JPH03288929A (en) * 1990-04-06 1991-12-19 Fujitsu Ltd Double pipe line control system

Similar Documents

Publication Publication Date Title
JPH0115093B2 (en)
JPH09171463A (en) Method for processing of interrupt routine by digital instruction processor controller
JPH1124929A (en) Arithmetic processing unit and its method
JPS633337B2 (en)
EP0162929B1 (en) Method of controlling branching
JP3532835B2 (en) Data processing device and program conversion device
JP3602801B2 (en) Memory data access structure and method
JPH06250843A (en) Arithmetic processing method and arithmetic unit
JP2006040173A (en) Branch prediction device and method
JP3335735B2 (en) Arithmetic processing unit
JPS63141131A (en) Pipeline control system
JP2772100B2 (en) Parallel instruction fetch mechanism
JPH0793151A (en) Instruction supplying device
JP2825315B2 (en) Information processing device
JP2545594B2 (en) Operand data prefetching method
JP2636192B2 (en) Information processing device
JPS60250438A (en) Information processor
JPH06161751A (en) Instruction buffer controller
JPH01240931A (en) Data processor
JP2010140398A (en) Apparatus and method for data process
JPH0774992B2 (en) Data processing device
JPH0855033A (en) Information processor
JPH09101890A (en) Arithmetic unit for pipeline and decoder device
JPH05257686A (en) Instruction cache circuit
JPH11327929A (en) Program controller