JPH06175848A - High-speed branch processing system for central processing unit - Google Patents

High-speed branch processing system for central processing unit

Info

Publication number
JPH06175848A
JPH06175848A JP4325878A JP32587892A JPH06175848A JP H06175848 A JPH06175848 A JP H06175848A JP 4325878 A JP4325878 A JP 4325878A JP 32587892 A JP32587892 A JP 32587892A JP H06175848 A JPH06175848 A JP H06175848A
Authority
JP
Japan
Prior art keywords
instruction
branch
address
program counter
cycle
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
JP4325878A
Other languages
Japanese (ja)
Inventor
Kazuto Nagatsuka
一人 永塚
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.)
Fuji Electric Co Ltd
Fuji Facom Corp
Original Assignee
Fuji Electric Co Ltd
Fuji Facom Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fuji Electric Co Ltd, Fuji Facom Corp filed Critical Fuji Electric Co Ltd
Priority to JP4325878A priority Critical patent/JPH06175848A/en
Publication of JPH06175848A publication Critical patent/JPH06175848A/en
Withdrawn legal-status Critical Current

Links

Landscapes

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

Abstract

PURPOSE:To fetch a branch destination address or a branch destination address with the high probability of branching next to a branching instruction for accelerating the branching instruction at a central processing unit (CPU) such as a microcomputer. CONSTITUTION:This system is constituted of a CPU 1 provided with a pipeline processing part 2 from fetch 3 to execution 4 and a program counter 5, a program counter stack means 7, a high-probability branch destination registering means 9, a program counter queue storage means 8 for the step of queuing a counter value and an instruction judging means 6 for analyzing an instruction 10 fetched 3, reloading the counter 5 with the branching destination address in an unconitional case, writing the branch destination in the counter when the instruction is registered, and loading the address value in the lowest step of the program counter queue storage means to the program counter 5 when the conditions are not satisfied.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、シーケンサ、マイコン
等の制御演算装置において、チップ内のアドレス比較用
テーブルに登録したアドレスに分岐する命令か、無条件
分岐命令をフェッチした時、その命令を実行する前にジ
ャンプ先の命令をフェッチし、分岐処理を高速化する中
央演算処理装置の高速分岐処理方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a control operation unit such as a sequencer or a microcomputer, which fetches an instruction for branching to an address registered in an address comparison table in a chip or an unconditional branch instruction. The present invention relates to a high-speed branch processing method of a central processing unit that fetches a jump destination instruction before executing it and speeds up branch processing.

【0002】[0002]

【従来の技術】中央演算処理装置の分岐処理について従
来の処理方式例を説明する。図12は、一般的な中央演
算処理装置の構成例である。
2. Description of the Related Art An example of a conventional processing method for branching processing of a central processing unit will be described. FIG. 12 is a configuration example of a general central processing unit.

【0003】中央演算処理装置1200はプログラムのフェ
ッチを行なうフェッチ部1210、デコードを行なうデコー
ド部1220、ソース・オペランドのフェッチを行なうソー
スフェッチ部1230、命令の実行を行なう実行部1240で構
成されている。実行部1240は、レジスタファイル1241、
プログラム・カウンタPC1242、ALU1243からなる。
The central processing unit 1200 comprises a fetch unit 1210 for fetching a program, a decode unit 1220 for decoding, a source fetch unit 1230 for fetching source operands, and an execution unit 1240 for executing instructions. . The execution unit 1240 uses the register file 1241,
It consists of a program counter PC1242 and an ALU1243.

【0004】フェッチ部1210、デコード部1220、ソース
フェッチ部1230、実行部1240は、それぞれ独立して動作
するので、4段のパイプライン処理(フェッチ、デコー
ド、ソースオペランドフェッチ、実行)を行なうことが
できる。
Since the fetch unit 1210, the decode unit 1220, the source fetch unit 1230, and the execution unit 1240 operate independently of each other, four-stage pipeline processing (fetch, decode, source operand fetch, execution) can be performed. it can.

【0005】図13は、無条件分岐命令を含むプログラ
ム例であり、このプログラムを図12に示した一般的な
中央演算処理装置の構成で処理したときのタイムチャー
トを図14に示す。
FIG. 13 shows an example of a program including an unconditional branch instruction, and FIG. 14 shows a time chart when this program is processed by the configuration of the general central processing unit shown in FIG.

【0006】図13に示したプログラムを図12の装置
で実行すると、図14のタイムチャートに示すように、
1サイクルずつ処理が進んでいく。まず、1サイクルで
はアドレスバス(Aバス)に1000番地が設定され、
データバス(Dバス)に1000番地の内容であるIN
C Aが設定される。そしてプログラム・カウンタ(P
C)は1000番地になる。
When the program shown in FIG. 13 is executed by the apparatus shown in FIG. 12, as shown in the time chart of FIG.
Processing progresses one cycle at a time. First, 1000 addresses are set on the address bus (A bus) in one cycle.
IN which is the contents of address 1000 on the data bus (D bus)
C A is set. And the program counter (P
C) is number 1000.

【0007】第2サイクルでは、INC Aがフェッチ
され、次のJMP LOOP命令がデータバスに設定さ
れる。同様に、第3サイクルではINC Aがデコード
され、JMP LOOPがフェッチされ、MOV A,
Bがデータバスに設定される。次の第4サイクルでIN
C Aはソースフェッチされ、第5サイクルで実行され
る。
In the second cycle, INC A is fetched and the next JMP LOOP instruction is set on the data bus. Similarly, in the third cycle, INC A is decoded, JMP LOOP is fetched, MOV A,
B is set to the data bus. IN the next 4th cycle
CA is source fetched and executed in the fifth cycle.

【0008】分岐命令(JUMP LOOP)に注目す
ると、第3サイクルで、プログラム・フェッチ部1210が
インストラクション・メモリ1100からフェッチし、第4
サイクルでプログラム・デコード部1220が命令を分岐命
令と分岐先アドレスにデコードする。そして、第5サイ
クルではソースフェッチ部1230がソースオペランドのフ
ェッチを行ない、最後に第6サイクルでJUMP LO
OP命令を実行する。
Focusing on the branch instruction (JUMP LOOP), the program fetch unit 1210 fetches from the instruction memory 1100 in the third cycle,
In a cycle, the program decode unit 1220 decodes an instruction into a branch instruction and a branch destination address. Then, in the fifth cycle, the source fetch unit 1230 fetches the source operand, and finally in the sixth cycle, JUMP LO.
Execute the OP instruction.

【0009】実行部1240では、プログラムカウンタ(P
C)の値を分岐先アドレスに書き換え、各パイプライン
の内容を無効にする。そして、サイクル7からのサイク
ルでは2000番地以降をフェッチ−デコード−ソース
フェッチ−実行する処理を行なう。
In the execution unit 1240, the program counter (P
The value of C) is rewritten to the branch destination address to invalidate the contents of each pipeline. Then, in the cycles from the cycle 7 onward, the processing of fetching-decoding-source fetching-execution from the address 2000 onward is executed.

【0010】[0010]

【発明が解決しようとする課題】しかしながら、従来の
方式では、分岐命令の実行に伴ってパイプラインの内容
を全てクリアしてから分岐命令後の命令をフェッチ処理
から開始しなければならず、数サイクルのオーバヘッド
を生じるという問題がある。
However, in the conventional method, it is necessary to clear all the contents of the pipeline as the branch instruction is executed and then start the instruction after the branch instruction from the fetch processing. There is a problem of causing cycle overhead.

【0011】すなわち、図14のタイムチャートにおい
ては、第6サイクルでJUMP命令が実行された時点で
プログラムカウンタが2000番地となり、パイプライ
ンの内容をすべて無効にしたのち2000番地以降の命
令をフェッチから処理しており、第7サイクル〜第10
サイクルでは実行部1240は稼働していない。4サイクル
分のオーバヘッドが生じていることになる。
That is, in the time chart of FIG. 14, the program counter reaches the address 2000 when the JUMP instruction is executed in the sixth cycle, and after invalidating all the contents of the pipeline, the instructions after the address 2000 are fetched. Processing, 7th cycle to 10th cycle
The execution unit 1240 is not operating in the cycle. This means that there is an overhead of 4 cycles.

【0012】本発明は、分岐処理におけるこのようなオ
ーバヘッドを解消し、分岐命令処理を高速化することを
目的とする。
An object of the present invention is to eliminate such overhead in branch processing and speed up branch instruction processing.

【0013】[0013]

【課題を解決するための手段】図1は、本発明の機能ブ
ロック図である。本発明は、命令10のフェッチ3〜実
行4の処理をパイプライン処理する中央演算処理装置1
を前提とする。また、該中央演算処理装置1はプログラ
ム・カウンタ5を有する。
FIG. 1 is a functional block diagram of the present invention. The present invention relates to a central processing unit 1 for pipeline processing of fetch 3 to execution 4 of an instruction 10.
Is assumed. Further, the central processing unit 1 has a program counter 5.

【0014】また、命令判断手段6は、フェッチした命
令10を入力とし、該命令10が分岐命令か否かを判断
する。分岐命令でない場合には中央演算処理装置1のパ
イプライン処理部2が通常のフェッチ3〜実行4を行な
う。分岐命令の場合には、無条件分岐命令あるいは条件
分岐命令のいずれかに応じた処理を実行する。
The instruction judging means 6 receives the fetched instruction 10 as an input and judges whether the instruction 10 is a branch instruction. If it is not a branch instruction, the pipeline processing unit 2 of the central processing unit 1 performs normal fetch 3 to execution 4. In the case of a branch instruction, the processing according to either the unconditional branch instruction or the conditional branch instruction is executed.

【0015】前記命令判断手段6が命令10を無条件分
岐命令と判断した場合には、命令判断手段6は、プログ
ラム・カウンタ5の内容を無条件分岐命令の分岐先アド
レスに書き換える。
When the instruction judging means 6 judges that the instruction 10 is an unconditional branch instruction, the instruction judging means 6 rewrites the contents of the program counter 5 to the branch destination address of the unconditional branch instruction.

【0016】プログラム・カウンタ・スタック手段7
は、無条件分岐命令のなかでもサブルーチンコール命令
の場合に、プログラム・カウンタ5の内容をスタックに
プッシュしたうえで、プログラム・カウンタ5の内容を
無条件分岐命令の分岐アドレスに書き換える。また、リ
ターンサブルーチン命令の場合は、スタックをホップし
てサブルーチンの戻り番地をプログラム・カウンタ5に
ロードする。
Program counter stack means 7
In the case of a subroutine call instruction among unconditional branch instructions, pushes the contents of the program counter 5 onto the stack and then rewrites the contents of the program counter 5 with the branch address of the unconditional branch instruction. In the case of a return subroutine instruction, the stack is hopped and the return address of the subroutine is loaded into the program counter 5.

【0017】分岐アドレス登録手段9は、分岐先アドレ
スに飛ぶ確率が高い場合に分岐先アドレスを登録してお
く。プログラム・カウンタ・キュー格納手段8は、プロ
グラム・カウンタ5の書き変わるタイミングにプログラ
ム・カウンタ値をキューイングする。パイプライン段数
よりも一段少ない退避用キューで、プログラム・カウン
タ5と同じビット幅を持つ。
The branch address registration means 9 registers the branch destination address when the probability of jumping to the branch destination address is high. The program counter queue storing means 8 queues the program counter value at the timing when the program counter 5 is rewritten. The save queue is one stage smaller than the number of pipeline stages and has the same bit width as the program counter 5.

【0018】命令判断手段6は、フェッチした命令10
が条件分岐命令の場合に、分岐先アドレスが前記分岐ア
ドレス登録手段9に登録されているか否かを判断し、登
録してある場合にはプログラム・カウンタ5の内容を分
岐先アドレスに書き換える。
The instruction judging means 6 uses the fetched instruction 10
Is a conditional branch instruction, it is judged whether or not the branch destination address is registered in the branch address registration means 9, and if it is registered, the contents of the program counter 5 are rewritten to the branch destination address.

【0019】該条件分岐命令をパイプライン処理部2で
実行4した時点で、条件が成立した場合にはそのまま処
理を続けると、分岐先アドレス内の命令が次に実行され
る。一方、条件が不成立の場合には、プログラム・カウ
ンタ・キュー格納手段8はキューの最下段のアドレスを
プログラム・カウンタ5にロードする。このとき、キュ
ーの最下段には該条件分岐命令の次アドレスが入ってい
る。これによって、このアドレスをパイプライン処理部
2でフェッチ3〜実行4すると正しく命令が実行され
る。
When the conditional branch instruction is executed 4 in the pipeline processing unit 2, if the condition is satisfied, if the processing is continued as it is, the instruction in the branch destination address is executed next. On the other hand, when the condition is not satisfied, the program counter queue storing means 8 loads the address of the lowest stage of the queue into the program counter 5. At this time, the next address of the conditional branch instruction is entered at the bottom of the queue. As a result, when this address is fetched 3 to 4 by the pipeline processing unit 2, the instruction is correctly executed.

【0020】[0020]

【作用】まず、条件分岐命令において分岐する確率が高
い分岐先アドレスが存在する場合には、パイプライン処
理部2の実行4を通して該分岐先アドレスを分岐アドレ
ス登録手段9に登録しておく。
First, if there is a branch destination address with a high probability of branching in the conditional branch instruction, the branch destination address is registered in the branch address registration means 9 through the execution 4 of the pipeline processing unit 2.

【0021】また、プログラム・カウンタ・キュー格納
手段8は、プログラム・カウンタ5が書き変わるタイミ
ングごとにプログラム・カウンタ値をキューイングす
る。例えば、フェッチ3−デコード−ソース・フェッチ
−実行4の4段のパイプライン処理部2であれば3段の
退避キューを用意しておく。これによって、常に、実行
4で処理された命令アドレスの次アドレスがキューの最
下段に入っていることになる。
Further, the program counter queue storing means 8 queues the program counter value every time the program counter 5 is rewritten. For example, in the case of the 4-stage pipeline processing unit 2 of fetch 3-decode-source fetch-execute 4, a 3-stage save queue is prepared. As a result, the next address of the instruction address processed in execution 4 is always in the bottom row of the queue.

【0022】命令10がパイプライン処理部2でフェッ
チ3されると、命令判断手段6はフェッチされた命令1
0のオペコードを分析する。命令10が分岐命令以外で
あればパイプライン処理部2が通常のフェッチ〜実行を
行なう。
When the instruction 10 is fetched 3 by the pipeline processing section 2, the instruction judging means 6 fetches the fetched instruction 1
Analyze 0 opcodes. If the instruction 10 is other than a branch instruction, the pipeline processing unit 2 performs normal fetch to execution.

【0023】一方、命令10が分岐命令の場合には、分
岐命令の種類によって対応する処理を実行する。まず、
命令10が無条件分岐命令の場合には、命令判断手段6
は、プログラム・カウンタ5の内容を分岐先アドレスに
書き換える。これによって、無条件分岐命令の次に、分
岐先アドレスがフェッチ3〜実行4されることになる。
On the other hand, when the instruction 10 is a branch instruction, the corresponding processing is executed depending on the type of the branch instruction. First,
When the instruction 10 is an unconditional branch instruction, the instruction judging means 6
Rewrites the contents of the program counter 5 to the branch destination address. As a result, the branch destination address is fetched 3 to 4 after the unconditional branch instruction.

【0024】無条件分岐命令のなかでもサブルーチン・
コール命令の場合は、命令判断手段6は、プログラム・
カウンタ・スタック手段7にまずプログラム・カウンタ
5の内容をプッシュし、その後、分岐先アドレスである
サブルーチンのアドレスをプログラム・カウンタ5に書
き込む。これによって、プログラム・カウンタ・スタッ
ク手段7には、サブルーチン実行後の戻りアドレスが格
納されることになる。
Among unconditional branch instructions, a subroutine
In the case of a call instruction, the instruction judging means 6
The contents of the program counter 5 are first pushed to the counter stack means 7, and then the address of the subroutine which is the branch destination address is written in the program counter 5. As a result, the return address after the execution of the subroutine is stored in the program counter stack means 7.

【0025】そして、命令10がリターン・サブルーチ
ン命令の場合は、プログラム・カウンタ・スタック手段
7をホップし、サブルーチンの戻りアドレスをプログラ
ム・カウンタ5に書き込む。これによって、リターンサ
ブルーチン命令の次に、戻り番地の命令がフェッチ3〜
実行4されることになる。
When the instruction 10 is a return subroutine instruction, the program counter stack means 7 is hopped and the return address of the subroutine is written in the program counter 5. As a result, after the return subroutine instruction, the instruction at the return address is fetched 3 to
It will be executed 4.

【0026】命令10が条件分岐命令の場合、命令判断
手段6は分岐アドレス登録手段9に該条件分岐命令の分
岐先アドレスがあるか否かを判断する。分岐先アドレス
が登録されていない場合には、そのまま、通常のパイプ
ライン処理を続ける。
When the instruction 10 is a conditional branch instruction, the instruction judging means 6 judges whether or not the branch address registering means 9 has a branch destination address of the conditional branch instruction. If the branch destination address is not registered, normal pipeline processing is continued.

【0027】一方、分岐先アドレスが登録されている場
合には、命令判断手段6は分岐先アドレスをプログラム
・カウンタ5に書き込む。そして、条件分岐命令の次
に、分岐先アドレス以降の命令をパイプライン処理部2
で処理する。
On the other hand, when the branch destination address is registered, the instruction judging means 6 writes the branch destination address in the program counter 5. Then, after the conditional branch instruction, the instructions after the branch destination address are processed by the pipeline processing unit 2
To process.

【0028】実際に、該条件分岐命令がパイプライン処
理部2で実行4されると、条件が成立あるいは不成立に
なる。条件が成立した場合には、次にパイプライン処理
されている分岐先の命令を実行4すればよい。一方、条
件が不成立の場合は、条件分岐命令の次のアドレスの命
令を処理しなければならない。このアドレスはプログラ
ム・カウンタ・キュー格納手段8の最下段に入っている
ので、キューの最下段のアドレスをプログラム・カウン
タ5にロードしたうえ、パイプライン処理部2でフェッ
チ3〜実行4する。これによって、正しく条件分岐命令
の次のアドレスの命令が処理されることになる。
When the conditional branch instruction is actually executed 4 in the pipeline processing unit 2, the condition is satisfied or not satisfied. If the condition is satisfied, the branch destination instruction that is pipelined next may be executed 4. On the other hand, if the condition is not satisfied, the instruction at the address next to the conditional branch instruction must be processed. Since this address is in the lowest stage of the program counter queue storing means 8, the address of the lowest stage of the queue is loaded into the program counter 5, and the pipeline processing unit 2 fetches 3 to 4 for fetching. As a result, the instruction at the address next to the conditional branch instruction is correctly processed.

【0029】[0029]

【実施例】以下に、本発明の実施例を説明する。図2
は、一実施例のシステム構成図である。
EXAMPLES Examples of the present invention will be described below. Figure 2
FIG. 1 is a system configuration diagram of an embodiment.

【0030】本実施例は、従来システムと同様に中央処
理演算装置210 、インストラクションメモリ200 、デー
タ・メモリ290 よりなるが、中央処理演算装置210 を強
化している。
This embodiment comprises a central processing unit 210, an instruction memory 200 and a data memory 290 as in the conventional system, but the central processing unit 210 is strengthened.

【0031】中央処理演算装置210 は、プログラムのフ
ェッチを行なう命令フェッチ部220、フェッチした命令
をデコードする命令デコード部230 、ソースオペランド
のフェッチを行なうソースフェッチ部240 、命令の実行
を行なう実行部250 に加えて、命令の内容を判断する命
令判断部260 で構成する。また、命令フェッチ部220を
強化している。
The central processing unit 210 includes an instruction fetch unit 220 for fetching a program, an instruction decode unit 230 for decoding the fetched instruction, a source fetch unit 240 for fetching a source operand, and an execution unit 250 for executing an instruction. In addition to the above, the instruction determining unit 260 for determining the content of the instruction is included. Also, the instruction fetch unit 220 is strengthened.

【0032】命令フェッチ部220 は、フェッチ・キュー
221 およびプログラム・カウンタPC222 、プログラム
・カウントをスタックするPCスタック223 、PCをキ
ューイングするPCキュー224 で構成する。PCキュー
224 は、フェッチ以下のパイプライン段数から1を引い
た段数である3段にしてある。
The instruction fetch unit 220 uses the fetch queue.
221, a program counter PC222, a PC stack 223 for stacking program counts, and a PC queue 224 for queuing PCs. PC queue
The number 224 is three, which is the number of pipeline stages after fetching minus one.

【0033】一方、命令判断部260 は、命令の解析を行
なう命令判断ロジック261 と分岐先のアドレスを格納し
ておくキャッシュ構造のテーブルである分岐先テーブル
262などで構成する。
On the other hand, the instruction judging section 260 is a branch destination table which is a table having a cache structure for storing an instruction judging logic 261 for analyzing an instruction and a branch destination address.
It is composed of 262 etc.

【0034】インストラクション・メモリ200 の入出力
バスとしてはインストラクション・アドレスバス270 と
インストラクション・データバス275 があり、インスト
ラクション・アドレスバス270 は命令フェッチ部220 の
プログラムカウンタ222 と接続され、インストラクショ
ン・データバス275 は命令フェッチ部220 のフェッチキ
ュー221 に接続されている。そして、インストラクショ
ン・メモリ200 は、インストラクション・アドレスバス
270 に入力されるプログラム・カウンタ値の内容をイン
ストラクション・データバス275 を介してフェッチキュ
ー221 に出力する。
An instruction address bus 270 and an instruction data bus 275 are provided as the input / output buses of the instruction memory 200. The instruction address bus 270 is connected to the program counter 222 of the instruction fetch section 220 and is connected to the instruction data bus 275. Is connected to the fetch queue 221 of the instruction fetch unit 220. And the instruction memory 200 is the instruction address bus.
The contents of the program counter value input to 270 are output to the fetch queue 221 via the instruction data bus 275.

【0035】フェッチキュー221 の出力は、命令デコー
ド部230 および命令判断部260 の命令判断ロジック261
に接続されている。フェッチキュー221 に格納された命
令は命令判断ロジック261 で分析し、該命令が分岐命令
であるか否かを判断する。
The output of the fetch queue 221 is the instruction judgment unit 261 of the instruction decoding unit 230 and the instruction judgment unit 260.
It is connected to the. The instruction stored in the fetch queue 221 is analyzed by the instruction judgment logic 261 to judge whether or not the instruction is a branch instruction.

【0036】図3は、一実施例の命令判断部260 の構成
図である。命令判断部260 は、命令判断ロジック261 と
分岐先テーブル262 、オアゲート300 、アンドゲート35
0 からなる。
FIG. 3 is a block diagram of the instruction determination unit 260 of one embodiment. The instruction determination unit 260 includes an instruction determination logic 261, a branch destination table 262, an OR gate 300, and an AND gate 35.
It consists of 0.

【0037】命令判断ロジック261 は、命令フェッチ部
220 のフェッチ・キュー221 と接続され、フェッチ・キ
ュー221 内の命令のうちオペコードだけ(オペランドを
除く部分)をその入力とする。命令判断ロジック261
は、該オペコードが分岐命令であるか、更に分岐命令で
あれば、無条件分岐命令か条件分岐命令かを判断する。
この判断は、無条件分岐命令および条件分岐命令のオペ
コードを命令判断ロジック261 内に持っておき、入力さ
れるオペコードとの一致を取ればよい。該オペコードを
無条件分岐命令と判断した場合にはオアゲート300 の一
方の入力を“1”、無条件分岐命令でなければ該入力を
“0”とする。一方、該オペコードを条件分岐命令と判
断した場合にはアンドゲート350 の一方の入力を
“1”、条件分岐命令でなければ該入力を“0”とす
る。
The instruction determination logic 261 is an instruction fetch unit.
It is connected to the fetch queue 221 of 220, and only the opcode (a part excluding the operand) of the instructions in the fetch queue 221 is used as its input. Instruction decision logic 261
Determines whether the operation code is a branch instruction, or if it is a branch instruction, it is an unconditional branch instruction or a conditional branch instruction.
For this determination, the operation codes of the unconditional branch instruction and the conditional branch instruction are held in the instruction judgment logic 261, and the operation code to be input may be matched. If the operation code is judged to be an unconditional branch instruction, one input of the OR gate 300 is set to "1", and if it is not an unconditional branch instruction, the input is set to "0". On the other hand, if the operation code is judged to be a conditional branch instruction, one input of the AND gate 350 is set to "1", and if it is not a conditional branch instruction, the input is set to "0".

【0038】分岐先テーブル262 は、キャッシュ構造の
テーブルであり、分岐命令が命令実行部250 で実行され
るごとに該分岐命令の分岐先アドレスをこのテーブルに
登録しておく。そして、フェッチ・キュー221 に命令が
入ると、該命令のオペランドのみを分岐先テーブル262
の入力とする。該オペランドが入力されると、該オペラ
ンドと分岐先テーブル262 内に格納されている分岐先ア
ドレスが比較され、一致したものがあると(HIT)、
前述のアンドゲート350 のもう一方の入力を“1”と
し、一致するアドレスがない場合には該入力を“0”と
する。該アンドゲート350 の出力は、オアゲート300 の
もう一方の入力となる。オアゲート300 の出力はプログ
ラム・カウンタ222 のロード・タイミング信号(LD)
となる。
The branch destination table 262 is a cache structure table, and each time a branch instruction is executed by the instruction executing section 250, the branch destination address of the branch instruction is registered in this table. Then, when an instruction enters the fetch queue 221, only the operand of the instruction is branched to the branch destination table 262.
And input. When the operand is input, the operand is compared with the branch destination address stored in the branch destination table 262, and if there is a match (HIT),
The other input of the AND gate 350 is set to "1", and when there is no matching address, the input is set to "0". The output of the AND gate 350 becomes the other input of the OR gate 300. The output of the OR gate 300 is the load timing signal (LD) of the program counter 222.
Becomes

【0039】以上の構成により、フェッチ・キュー221
に命令が入力されたとき、該命令が無条件分岐命令であ
ればオアゲート300 の一方の入力が“1”、オアゲート
300の出力が“1”となる。LDに“1”が入力された
時点で、プログラム・カウンタ222 はフェッチ・キュー
221 からオペランドである分岐先アドレスをロードす
る。
With the above configuration, the fetch queue 221
When an instruction is input to the OR gate 300, if the instruction is an unconditional branch instruction, one input of the OR gate 300 is “1”,
The output of 300 becomes "1". At the time when “1” is input to LD, the program counter 222 fetches the fetch queue.
Load the branch destination address that is the operand from 221.

【0040】一方、該命令が条件分岐命令であれば、ア
ンドゲート350 の一方の入力が“1”となり、このと
き、分岐先テーブル262 にHITする分岐先アドレスが
あればアンドゲート350 のもう一方の入力も“1”とな
り、アンドゲート350 の出力が“1”となって、オアゲ
ート300 の出力(LD)が“1”となる。これによっ
て、プログラム・カウンタ222 はフェッチ・キュー221
から分岐先アドレスをロードする。該命令が条件分岐命
令であっても、分岐先テーブル262 にHITする分岐先
アドレスがない場合には、アンドゲート350 のもう一方
の入力は“0”となり、よってアンドゲート350 の出力
が“0”、オアゲート300 の出力が“0”となる。よっ
て、プログラム・カウンタ222 はフェッチ・キュー221
から分岐先アドレスをロードすることはない。
On the other hand, if the instruction is a conditional branch instruction, one input of the AND gate 350 becomes "1". At this time, if the branch destination table 262 has a branch destination address to be hit, the other one of the AND gate 350. Also becomes "1", the output of the AND gate 350 becomes "1", and the output (LD) of the OR gate 300 becomes "1". This causes the program counter 222 to fetch queue 221.
Load the branch destination address from. Even if the instruction is a conditional branch instruction, if there is no branch destination address to be hit in the branch destination table 262, the other input of the AND gate 350 becomes "0", so that the output of the AND gate 350 becomes "0". ", The output of the OR gate 300 becomes" 0 ". Therefore, the program counter 222 becomes the fetch queue 221.
The branch destination address is not loaded from.

【0041】さらに、該命令が分岐命令でない場合に
は、条件分岐を示すアンドゲート350の一方の入力が
“0”、無条件分岐を示すオアゲート300 の一方の入力
が“0”となり、オアゲート300 の出力は“0”となる
ので、プログラム・カウンタ222はフェッチ・キュー221
から分岐先アドレスをロードすることはない。
If the instruction is not a branch instruction, one input of the AND gate 350 indicating a conditional branch becomes "0" and one input of the OR gate 300 indicating an unconditional branch becomes "0", and the OR gate 300 Is 0, the program counter 222 fetches the fetch queue 221.
The branch destination address is not loaded from.

【0042】図4は、無条件分岐命令を含むプログラム
の例である。このプログラムを図2に示した一実施例の
システム構成で処理すると、図5に示すタイムチャート
のような動作を行なう。
FIG. 4 is an example of a program including an unconditional branch instruction. When this program is processed by the system configuration of the embodiment shown in FIG. 2, the operation shown in the time chart of FIG. 5 is performed.

【0043】図4のプログラムのなかの1001番地の
JMP LABELという無条件分岐命令は、第2サイ
クルでインストラクション・データバス275 に設定さ
れ、第3サイクルでフェッチキュー221 に入る。命令判
断部260 の命令判断ロジック261 はフェッチキュー221
に入った該命令を分析して無条件分岐命令であることを
判断し、次サイクル(第4サイクル)に分岐先アドレス
2000番地をプログラムカウンタ222 に格納し、フェ
ッチキュー221 に入るはずの次の命令ADD A,Cを
無効にする。第5サイクルからは分岐先の命令のフェッ
チ−デコード−ソースフェッチ−実行処理が行われる。
すなわち、第5サイクルでは分岐先の2000番地の命
令であるAND A,Dがフェッチされ、第6サイクル
でデコード部230 によるデコード、第7サイクルでソー
スフェッチ部240 によるオペランドのフェッチ、第8サ
イクルで実行が行われる。これによって、第9サイクル
には2001番地のEND命令が実行され、処理を終了
する。
An unconditional branch instruction called JMP LABEL at address 1001 in the program shown in FIG. 4 is set in the instruction data bus 275 in the second cycle and enters the fetch queue 221 in the third cycle. The instruction judgment logic 261 of the instruction judgment unit 260 is the fetch queue 221.
The entered instruction is analyzed to determine that it is an unconditional branch instruction, the branch destination address 2000 is stored in the program counter 222 in the next cycle (fourth cycle), and the next address that should enter the fetch queue 221 is stored. Invalidates the instruction ADD A, C. From the fifth cycle, fetch-decode-source fetch-execution processing of the branch destination instruction is performed.
That is, in the fifth cycle, the instruction at the branch destination address 2000, AND A, D, is fetched, in the sixth cycle, the decoding section 230 decodes, in the seventh cycle, the source fetch section 240 fetches the operand, and in the eighth cycle. Execution takes place. As a result, the END instruction at the address 2001 is executed in the ninth cycle, and the processing ends.

【0044】従来のシステム構成(図12)で同様の図
4のプログラムを実行した場合には、無条件分岐命令を
実行することによりプログラム・カウンタを分岐先に変
え、パイプラインの内容を無効にしていた。その結果、
無条件分岐命令の実行後のサイクルである第7サイクル
でプログラムカウンタの内容が2000番地になり、第
8サイクルから分岐先の命令のフェッチ〜実行処理が行
われる。よって、2001番地のEND命令を実行して
処理を終了するのは第12サイクルとなる。
When the similar program of FIG. 4 is executed in the conventional system configuration (FIG. 12), the unconditional branch instruction is executed to change the program counter to the branch destination and invalidate the contents of the pipeline. Was there. as a result,
In the seventh cycle, which is the cycle after the execution of the unconditional branch instruction, the content of the program counter becomes address 2000, and from the eighth cycle, the fetch-execution processing of the branch destination instruction is performed. Therefore, it is the twelfth cycle that the END instruction at the address 2001 is executed and the processing is ended.

【0045】すなわち、本実施例によると、このプログ
ラムの場合、3サイクル分分岐処理を高速化できること
になる。図6は、サブルーチンコール命令を含むプログ
ラム例、図7は、図6のプログラムを本実施例のシステ
ム構成(図2)で処理した場合のタイムチャートであ
る。
That is, according to this embodiment, in the case of this program, the branch processing can be sped up for 3 cycles. FIG. 6 is a program example including a subroutine call instruction, and FIG. 7 is a time chart when the program of FIG. 6 is processed by the system configuration (FIG. 2) of this embodiment.

【0046】このプログラム例では、1001番地の命
令がサブルーチン・コール命令になっており、この命令
により2000番地〜2002番地のプログラムを実行
してた後、1002番地に戻る。
In this program example, the instruction at address 1001 is a subroutine call instruction, and after executing the program at addresses 2000 to 2002 by this instruction, the program returns to address 1002.

【0047】本実施例のシステム構成(図2)で処理し
た場合には、図7に示すように、第2サイクルでCAL
L LABEL命令がインストラクション・データバス
275に設定され、第3サイクルでフェッチキュー221 に
格納される。この時点で命令判断部260 の命令判断ロジ
ック261 が該命令がサブルーチン・コール命令であるこ
とを判断し、第4サイクルでフェッチキュー221 に格納
されるはずの1002番地の命令の内容を無効にし、そ
の時点のプログラム・カウンタ222 の内容(1002番
地)をPCスタック223 にプッシュし、分岐先アドレス
(2000番地)をプログラム・カウンタ222 に格納す
る。そして、第5サイクルからはサブルーチンの処理に
移る。
When processing is performed with the system configuration (FIG. 2) of this embodiment, as shown in FIG. 7, CAL is performed in the second cycle.
L LABEL instruction is an instruction data bus
275 and stored in the fetch queue 221 in the third cycle. At this point, the instruction determination logic 261 of the instruction determination unit 260 determines that the instruction is a subroutine call instruction, and invalidates the content of the instruction at address 1002 that should be stored in the fetch queue 221 in the fourth cycle, The contents (address 1002) of the program counter 222 at that time are pushed to the PC stack 223, and the branch destination address (address 2000) is stored in the program counter 222. Then, from the fifth cycle, the processing moves to the subroutine.

【0048】すなわち、第5サイクルでは2000番地
(AND A,C)のフェッチが行われ、第6サイクル
では2001番地(MUL A,D)のフェッチと20
00番地(AND A,C)のデコードが行われ、第7
サイクルでは2002番地(RTS)のフェッチと20
01番地(MUL A,D)のデコード、2000番地
(AND A,C)のソース・フェッチが行われる。
That is, the fetch of address 2000 (AND A, C) is performed in the fifth cycle, and the fetch of address 2001 (MUL A, D) and 20 are performed in the sixth cycle.
No. 00 (AND A, C) is decoded and the 7th
In the cycle, fetching at address 2002 (RTS) and 20
Decoding of address 01 (MUL A, D) and source fetch of address 2000 (AND A, C) are performed.

【0049】リターンサブルーチン命令(RTS)がフ
ェッチキュー221 に格納されると、命令判断部260 の命
令判断ロジック261 がリターン命令であることを判断
し、次サイクル(第8サイクル)でPCスタック223 か
らプログラム・カウンタ222 にポップを行ない、フェッ
チキュー221 の内容を無効にする。これによって、プロ
グラム・カウンタ222 は1002番地になる。さらに、
第8サイクルでは、2002番地(RTS)のデコード
と、2001番地(MUL A,D)のソース・フェッ
チ、2000番地(AND A,C)の実行が行われ
る。
When the return subroutine instruction (RTS) is stored in the fetch queue 221, the instruction decision logic 261 of the instruction decision unit 260 decides that it is a return instruction, and the PC stack 223 reads it from the next cycle (eighth cycle). Pop the program counter 222 and invalidate the contents of the fetch queue 221. As a result, the program counter 222 becomes the address 1002. further,
In the eighth cycle, decoding of address 2002 (RTS), source fetch of address 2001 (MUL A, D), and execution of address 2000 (AND A, C) are performed.

【0050】第9サイクルからは、1002番地からプ
ログラムのフェッチ〜実行の処理が行われる。以上の処
理により、図6のプログラムは、第14サイクルで完了
する(第14サイクルに1003番地のEND命令が実
行される)。
From the ninth cycle, the program fetch-execution processing is performed from address 1002. With the above processing, the program of FIG. 6 is completed in the 14th cycle (the END instruction at address 1003 is executed in the 14th cycle).

【0051】一方、従来のシステム構成(図12)で図
6のプログラムを実行した場合には、1001番地のC
ALL LABEL命令を実行した次のサイクル(第7
サイクル)でプログラム・カウンタ222 が2000番地
にセットされ、次サイクル(第8サイクルから2000
番地以降のフェッチ〜実行が行われる。よって2000
番地のAND A,C命令が実行されるのは第11サイ
クルとなり、2002番地のRTS命令は第13サイク
ルとなる。RTS命令が実行されると、次の第14サイ
クルでプログラム・カウンタ222 が1002番地にセッ
トされ、第15サイクルから1002番地以降のフェッ
チ〜実行が行われる。よって、従来構成では、図6のプ
ログラムは第19サイクルで完了する(第19サイクル
に1003番地のEND命令が実行される)。
On the other hand, when the program of FIG. 6 is executed with the conventional system configuration (FIG. 12), C at address 1001
Next cycle after executing ALL LABEL instruction (7th cycle)
In the cycle, the program counter 222 is set to the address 2000, and the next cycle (from the 8th cycle to 2000)
Fetching to execution after the address is performed. Therefore 2000
The AND A, C instruction at the address is executed in the 11th cycle, and the RTS instruction at the address 2002 is in the 13th cycle. When the RTS instruction is executed, the program counter 222 is set to the address 1002 in the next 14th cycle, and the fetch-execution from the 15th cycle to the address 1002 and thereafter is performed. Therefore, in the conventional configuration, the program of FIG. 6 is completed in the 19th cycle (the END instruction at address 1003 is executed in the 19th cycle).

【0052】これにより、本実施例の構成(図2)で
は、従来構成(図12)よりも5サイクル分高速化され
ることになる。図8は、条件付きの分岐命令を含むプロ
グラムの例である。そして、このプログラムを本実施例
のシステム構成(図2)で実行したときのタイムチャー
トを図9に示す。
As a result, the configuration of this embodiment (FIG. 2) is faster than the conventional configuration (FIG. 12) by 5 cycles. FIG. 8 is an example of a program including a conditional branch instruction. FIG. 9 shows a time chart when this program is executed by the system configuration (FIG. 2) of this embodiment.

【0053】図8のプログラムは、前もって実行される
イニシャル・ルーチンと、イニシャル・ルーチンが実行
された後に実行されるメイン・ルーチンからなる。イニ
シャル・ルーチンを実行すると、0000番地のMOV
BAT,LOOPという分岐命令実行時に分岐先テー
ブル262 に分岐先アドレスLOOPが格納される。そし
て、0001番地のJMP MAINという無条件分岐
命令でメイン・ルーチンに飛ぶ。
The program shown in FIG. 8 is composed of an initial routine that is executed in advance and a main routine that is executed after the initial routine is executed. MOV at address 0000 when the initial routine is executed
The branch destination address LOOP is stored in the branch destination table 262 when a branch instruction of BAT, LOOP is executed. Then, an unconditional branch instruction called JMP MAIN at address 0001 jumps to the main routine.

【0054】メイン・ルーチンは、1000番地の命令
でCに2を代入し、1001番地〜1002番地をCの
値が0でない場合にループするものである。ここで、イ
ニシャル・ルーチンは前もって実行されているので、分
岐先テーブル262 にはLOOPのアドレスが格納されて
いるものとし、この前提のもとで、メイン・ルーチンが
実行される。
The main routine substitutes 2 for C by the instruction at address 1000, and loops addresses 1001 to 1002 when the value of C is not 0. Here, since the initial routine has been executed in advance, it is assumed that the branch destination table 262 stores the address of LOOP, and the main routine is executed under this premise.

【0055】図9のタイムチャートで説明すると、条件
分岐命令(JNE 1001)が第4サイクルでフェッ
チキュー221 に格納されると、命令判断ロジック261 は
分岐先テーブル262 を検索し、分岐先アドレスがそこに
格納されていることを確認する。格納されているという
ことは、分岐する確率が高いということであり、命令判
断ロジック261 は第5サイクルでプログラムカウンタ22
2 に分岐先の1001番地を格納するとともに、次にフ
ェッチされるはずのフェッチ・キューの内容を無効にす
る。第6サイクル以降では、分岐先のフェッチ〜実行が
行なわれる。
Explaining with the time chart of FIG. 9, when the conditional branch instruction (JNE 1001) is stored in the fetch queue 221 in the fourth cycle, the instruction judgment logic 261 searches the branch destination table 262 and the branch destination address is Make sure it is stored there. The fact that it is stored means that there is a high probability of branching, and the instruction judgment logic 261 has the program counter 22 in the fifth cycle.
The branch destination address 1001 is stored in 2, and the contents of the fetch queue that should be fetched next are invalidated. In the sixth and subsequent cycles, the fetch-execution of the branch destination is performed.

【0056】一方、PCキュー224 はプログラム・カウ
ンタ222 が書き変わるタイミングでキューイングを行な
う。例えば、プログラム・カウンタ値‘1000’が
‘1001’に書き変わる時点でキューイングされ、P
Cの最上段に‘1000’がプッシュされる。以降、カ
ウンタ値が書き変わる時点でPCキュー224 がプッシュ
されるので、第4サイクルで‘1000’がPCキュー
224 の最下段にキューイングされることになる。第5サ
イクルでは、第4サイクルにプログラム・カウンタ222
にあった‘1003’がPCキュー224 の最上段に入
り、第7サイクルで最下段に入る。
On the other hand, the PC queue 224 performs queuing at the timing when the program counter 222 is rewritten. For example, when the program counter value "1000" is rewritten to "1001", it is queued and P
'1000' is pushed to the top of C. After that, since the PC queue 224 is pushed when the counter value is rewritten, '1000' is the PC queue in the fourth cycle.
It will be queued at the bottom of 224. In the fifth cycle, the program counter 222 in the fourth cycle
The matching '1003' enters the top stage of the PC queue 224, and enters the bottom stage in the seventh cycle.

【0057】第7サイクルでは、条件分岐命令(JNE
LOOP)が実行される。Cの値は第5サイクルで
‘2’に設定され、第6サイクルのDEC Cで1減っ
て第7サイクルには‘1’になっている。そこで、第7
サイクルの条件分岐命令は条件と一致し(C≠0)、1
001番地にループすることになる。この1001番地
は、第4サイクルの条件分岐命令フェッチ時に分岐アド
レス・テーブル262 を参照してプログラム・カウンタ22
2 にセットされ、第6サイクルでフェッチ、第7サイク
ルでデコード、第8サイクルでソース・フェッチされて
いる。よって、第9サイクルで1001番地の実行を行
なうことが可能である。実行の結果、Cの値は‘0’に
なる。また、第10サイクルでは再び条件分岐命令(J
NE LOOP)が実行される。
In the seventh cycle, the conditional branch instruction (JNE
LOOP) is executed. The value of C is set to '2' in the fifth cycle, decremented by 1 in DEC C in the sixth cycle, and becomes '1' in the seventh cycle. Therefore, the seventh
The conditional branch instruction of the cycle matches the condition (C ≠ 0), 1
It will loop to address 001. This address 1001 refers to the branch address table 262 at the time of the conditional branch instruction fetch in the fourth cycle, and the program counter 22
It is set to 2, fetched in the 6th cycle, decoded in the 7th cycle, and source fetched in the 8th cycle. Therefore, it is possible to execute the address 1001 in the ninth cycle. As a result of execution, the value of C becomes "0". In the 10th cycle, the conditional branch instruction (J
NE LOOP) is executed.

【0058】一方、第7サイクルではフェッチ・キュー
221 によってJNE LOOP命令がフェッチされてい
る。第4サイクルの場合と同様に、LOOP(1001
番地)が分岐アドレステーブル262 に格納されているか
否かを判断し、格納されているので、第8サイクルでは
プログラム・カウンタ222 を1001番地にセットし、
フェッチ・キュー221 の内容は無効にする。また、PC
キュー224 には第7サイクルでのプログラム・カウンタ
222 の内容である1003番地をプッシュする。
On the other hand, in the seventh cycle, the fetch queue
A JNE LOOP instruction has been fetched by 221. Similar to the case of the fourth cycle, LOOP (1001
Address) is stored in the branch address table 262. Since it is stored, the program counter 222 is set to the address 1001 in the eighth cycle.
Invalidates the contents of fetch queue 221. Also, PC
Queue 224 has a program counter in the 7th cycle
Push the address 1003 which is the content of 222.

【0059】第10サイクルで再び条件分岐命令(JN
E LOOP)が実行されると、このとき、条件は不成
立である(C=0)。この場合、条件一致(第7サイク
ル)の場合とは異なり、ループはしないで次の番地であ
る1003番地を実行することになる。そのため、第1
1サイクルではPCキュー224 の最下段から戻り番地で
ある1003番地をプログラム・カウンタ222 にロード
し、フェッチ・キュー221 の内容、命令デコード部230
の内容、ソースフェッチ部240 の内容を無効にする。そ
して、次の第12サイクルから、1003番地以降のフ
ェッチ〜実行処理を開始する。これによって、1003
番地は第15サイクルで命令実行部250により実行可能
になる。
In the 10th cycle, the conditional branch instruction (JN
When E LOOP) is executed, the condition is not satisfied at this time (C = 0). In this case, unlike the case of the condition match (seventh cycle), the next address 1003 is executed without looping. Therefore, the first
In one cycle, the return address 1003 from the bottom of the PC queue 224 is loaded into the program counter 222, and the contents of the fetch queue 221 and the instruction decoding unit 230 are loaded.
And the contents of the source fetch unit 240 are invalidated. Then, from the next twelfth cycle, the fetch-execution processing from the address 1003 onward is started. By this, 1003
The address can be executed by the instruction execution unit 250 in the 15th cycle.

【0060】以上のように、条件付き分岐命令の場合、
分岐アドレステーブル262 に前もって分岐する確率の高
い分岐先アドレスを格納しておくことにより、条件分付
き分岐命令のフェッチの後、次に分岐先アドレスをフェ
ッチできる。よって、条件が成立する場合には、条件付
き分岐命令実行サイクルの2サイクル後には分岐先アド
レスの命令を実行可能になる。一方、条件が不成立の場
合には、次サイクルでPCキュー224 の最下段をプログ
ラム・カウンタ222 にロードし、続いてフェッチ〜実行
処理する。よって、条件不成立の場合は、条件付き分岐
命令実行サイクルの5サイクル後には次番地の実行が可
能になる。
As described above, in the case of a conditional branch instruction,
By storing the branch destination address having a high probability of branching in advance in the branch address table 262, the branch destination address can be fetched next after the conditional branch instruction is fetched. Therefore, when the condition is satisfied, the instruction at the branch destination address can be executed two cycles after the conditional branch instruction execution cycle. On the other hand, if the condition is not satisfied, the lowermost stage of the PC queue 224 is loaded into the program counter 222 in the next cycle, and then fetch-execute processing is performed. Therefore, when the condition is not satisfied, the next address can be executed 5 cycles after the conditional branch instruction execution cycle.

【0061】従来のシステム構成(図12)で本プログ
ラム(図8)を実行した場合には、条件分岐命令実行
後、条件不成立の場合は次サイクルで次アドレスの実行
が可能だが、条件が成立する場合には5サイクル後に分
岐先アドレスの実行が可能になる。分岐先アドレスに分
岐する確率が高い場合には、条件が成立する都度5サイ
クルが無駄になり、本実施例は1回につき3サイクル分
高速化されることになる。
When this program (FIG. 8) is executed with the conventional system configuration (FIG. 12), after execution of the conditional branch instruction, if the condition is not satisfied, the next address can be executed in the next cycle, but the condition is satisfied. If so, the branch destination address can be executed after 5 cycles. When the probability of branching to the branch destination address is high, 5 cycles are wasted each time the condition is satisfied, and this embodiment speeds up by 3 cycles each time.

【0062】図10は、条件分岐命令が連続するプログ
ラムの例であり、図11は、図10のプログラムを本実
施例のシステム構成(図2)で実行した場合のタイムチ
ャートである。
FIG. 10 is an example of a program in which conditional branch instructions are continuous, and FIG. 11 is a time chart when the program of FIG. 10 is executed by the system configuration of this embodiment (FIG. 2).

【0063】この場合、1001番地(JNE L1)
をフェッチすると(第3サイクル)、命令判断部260 の
処理により次サイクル(第4サイクル)でプログラム・
カウンタ222 を分岐先アドレスであるL1(2000番
地)にセットしたうえ、フェッチ・キュー221 の内容を
無効にする。また、第4サイクルでは、PCキュー224
の最上段に1002番地が格納される。
In this case, address 1001 (JNE L1)
Is fetched (third cycle), the instruction decision unit 260 processes the program in the next cycle (fourth cycle).
The counter 222 is set to the branch destination address L1 (address 2000), and the contents of the fetch queue 221 are invalidated. In the fourth cycle, the PC queue 224
Address 1002 is stored in the uppermost row of.

【0064】第5サイクルでは2000番地(JZE
L2)がフェッチされる。すると、命令判断部260 の処
理により次サイクル(第6サイクル)でプログラム・カ
ウンタを分岐先アドレスであるL2(3000番地)に
セットしたうえ、フェッチ・キュー221 の内容を無効に
する。
In the fifth cycle, address 2000 (JZE
L2) is fetched. Then, in the next cycle (sixth cycle), the instruction counter 260 sets the program counter to the branch destination address L2 (address 3000) and invalidates the contents of the fetch queue 221.

【0065】一方、第6サイクルでは1001番地(J
NE L1)が実行される。この場合、A=0となるの
で条件は不一致となる。よって、L1(2000番地に
は飛ばずに、1002番地を次に実行することになる。
条件が不一致の場合には、次サイクル(第7サイクル)
でPCキュー224 の最下段の内容をプログラム・カウン
タ222 にロードしたうえ、パイプラインの内容(フェッ
チ、デコード、ソースフェッチ)を無効にする。その結
果、プログラム・カウンタの内容は1002番地にな
り、第8サイクルから1002番地以降のフェッチ〜実
行が行われる。
On the other hand, in the sixth cycle, address 1001 (J
NE L1) is executed. In this case, since A = 0, the conditions do not match. Therefore, L1 (address 1002 is executed next without jumping to address 2000).
If the conditions do not match, the next cycle (7th cycle)
Then, the contents of the bottom of the PC queue 224 are loaded into the program counter 222, and the contents of the pipeline (fetch, decode, source fetch) are invalidated. As a result, the content of the program counter becomes the address 1002, and the fetch to execution of the address 1002 and subsequent addresses are performed from the eighth cycle.

【0066】ここで、PCキュー224 が単に一時退避用
のレジスタであったとすると、二つ目の条件分岐命令を
フェッチ後のサイクル6でレジスタの内容が更新されて
しまい、最初の条件分岐命令が不一致であった場合に、
元の処理アドレス(1002番地)に戻ることができな
くなってしまう。よって、PCキュー224 をパイプライ
ン段数4段より1段少ない3段に設定しておくことが意
味をもつ。
If the PC queue 224 is simply a temporary save register, the contents of the register are updated in cycle 6 after fetching the second conditional branch instruction, and the first conditional branch instruction is If there is a mismatch,
It becomes impossible to return to the original processing address (address 1002). Therefore, it is significant to set the PC queue 224 to three stages, which is one stage less than the pipeline stage number of four stages.

【0067】[0067]

【発明の効果】本発明によって、命令がフェッチキュー
に格納された時点で、命令判断部により命令解析を行な
うことにより、無条件分岐命令に関しては、分岐処理が
従来方式に比べ高速化できる。また、条件分岐命令に関
しても、分岐する確率の高い分岐命令に関して分岐先ア
ドレスを分岐先テーブルに登録しておくことにより、プ
ログラム実行全体でると高速化を図ることが可能にな
る。また、パイプライン段数より1段少ない段数のPC
キューを持たせることにより、条件分岐命令が不一致の
場合でも元の処理アドレスに速やかに戻ることが可能で
ある。
As described above, according to the present invention, when an instruction is stored in the fetch queue, the instruction judging section analyzes the instruction, thereby making it possible to accelerate the branch processing of the unconditional branch instruction as compared with the conventional method. Further, regarding the conditional branch instruction as well, by registering the branch destination address in the branch destination table for the branch instruction having a high probability of branching, it is possible to speed up the entire program execution. In addition, the number of stages is one less than the number of pipeline stages
By providing a queue, it is possible to quickly return to the original processing address even if the conditional branch instructions do not match.

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

【図1】本発明のブロック図である。FIG. 1 is a block diagram of the present invention.

【図2】一実施例のシステム構成図である。FIG. 2 is a system configuration diagram of an embodiment.

【図3】一実施例の命令判断部の構成図である。FIG. 3 is a configuration diagram of an instruction determination unit according to an embodiment.

【図4】一実施例の無条件分岐命令を含むプログラム例
である。
FIG. 4 is a program example including an unconditional branch instruction according to an embodiment.

【図5】一実施例の無条件分岐命令処理のタイムチャー
トである。
FIG. 5 is a time chart of unconditional branch instruction processing according to an embodiment.

【図6】一実施例の無条件サブルーチンコール命令を含
むプログラム例である。
FIG. 6 is a program example including an unconditional subroutine call instruction according to an embodiment.

【図7】一実施例の無条件サブルーチンコール命令処理
のタイムチャートである。
FIG. 7 is a time chart of unconditional subroutine call instruction processing according to an embodiment.

【図8】一実施例の条件分岐命令を含むプログラム例で
ある。
FIG. 8 is a program example including a conditional branch instruction according to an embodiment.

【図9】一実施例の条件分岐命令処理のタイムチャート
である。
FIG. 9 is a time chart of conditional branch instruction processing according to an embodiment.

【図10】一実施例の条件分岐命令が連続するプログラ
ム例である。
FIG. 10 is an example of a program in which conditional branch instructions of one embodiment are consecutive.

【図11】一実施例の条件分岐命令が連続する場合のタ
イムチャートである。
FIG. 11 is a time chart when conditional branch instructions of one embodiment are consecutive.

【図12】従来の中央処理装置のブロック図である。FIG. 12 is a block diagram of a conventional central processing unit.

【図13】従来システムの動作を説明するプログラム例
である。
FIG. 13 is a program example for explaining the operation of the conventional system.

【図14】従来システムの動作を説明するタイムチャー
トである。
FIG. 14 is a time chart explaining the operation of the conventional system.

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

1 中央演算処理装置 2 パイプライン処理部 3 フェッチ 4 実行 5 プログラム・カウンタ 6 命令判断手段 7 プログラム・カウンタ・スタック手段 8 プログラム・カウンタ・キュー格納手段 9 分岐アドレス登録手段 10 命令 1 Central Processing Unit 2 Pipeline Processing Unit 3 Fetch 4 Execution 5 Program Counter 6 Instruction Judging Means 7 Program Counter Stacking Means 8 Program Counter Queue Storing Means 9 Branch Address Registering Means 10 Instructions

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 命令(10)のフェッチ(3)〜実行
(4)をパイプライン処理するパイプライン処理部
(2)とプログラム・カウンタ(5)からなる中央演算
処理装置(1)において、 フェッチされた命令(10)の内容を解析し、該命令
(10)が無条件分岐命であった場合に、プログラム・
カウンタ(5)を該無条件分岐命令の分岐先アドレスに
書き換える命令判断手段(6)と、 前記命令判断手段(6)が該無条件分岐命令をサブルー
チンコール命令と判断した場合には、前記命令判断手段
(6)によるプログラム・カウンタ(5)の書き換え前
に、プログラム・カウンタ(5)の内容をスタックにプ
ッシュして戻り先アドレスを保存し、また、前記命令判
断手段(6)が該無条件分岐命令をリターン・サブルー
チン命令と判断した場合には、該スタックをホップし、
プログラム・カウンタ(5)にサブルーチンの戻り先ア
ドレスをセットするプログラム・カウンタ・スタック手
段(7)と、 を有することを特徴とする中央演算処理装置の高速分岐
処理方式。
1. A central processing unit (1) comprising a pipeline processing section (2) for pipeline processing fetch (3) to execution (4) of an instruction (10) and a program counter (5), comprising: The contents of the executed instruction (10) are analyzed, and if the instruction (10) is an unconditional branch instruction, the program
Instruction judging means (6) for rewriting the counter (5) to the branch destination address of the unconditional branch instruction, and if the unconditional branch instruction is judged to be a subroutine call instruction, the instruction Before the program counter (5) is rewritten by the judging means (6), the contents of the program counter (5) are pushed onto the stack to store the return address, and the instruction judging means (6) stores If the conditional branch instruction is determined to be a return / subroutine instruction, the stack is hopped,
A high-speed branch processing system of a central processing unit, comprising: a program counter stack means (7) for setting a return address of a subroutine in a program counter (5).
【請求項2】 請求項1に記載の中央演算処理装置の高
速分岐高速処理方式であって、 分岐する確率の高い分岐アドレスを登録しておく分岐ア
ドレス登録手段(9)と、 キューの段数が(中央演算処理装置のパイプライン段数
−1)段でプログラム・カウンタ(5)と同じビット幅
を持ち、プログラム・カウンタ(5)の書き換えのタイ
ミングでプログラム・カウンタ(5)をキューイングし
プログラム・カウンタ(5)の内容を退避させるプログ
ラム・カウンタ・キュー格納手段(8)とをさらに有
し、 前記命令判断手段(6)が、フェッチされた命令(1
0)を条件分岐命令と判断した場合に、分岐先アドレス
が前記分岐アドレス登録手段(9)に登録されていれば
プログラム・カウンタ(5)を該分岐先アドレスに書き
換えて該条件分岐命令の条件成立直後に分岐先アドレス
を実行できるようにし、さらに、該条件分岐命令の条件
が不成立ならば前記プログラム・カウンタ・キュー格納
手段(8)の最下段の内容である次に処理すべきアドレ
スをプログラム・カウンタ(5)にロードすることを特
徴とする中央演算処理装置の高速分岐処理方式。
2. A high-speed branch high-speed processing method for a central processing unit according to claim 1, wherein a branch address registering means (9) for registering a branch address with a high probability of branching, and the number of stages of queues are provided. It has the same bit width as the program counter (5) at (the number of pipeline stages of the central processing unit-1), and the program counter (5) is queued at the rewriting timing of the program counter (5) to The instruction determining means (6) further comprises a program counter queue storing means (8) for saving the contents of the counter (5), and the fetched instruction (1
0) is a conditional branch instruction, and if the branch destination address is registered in the branch address registering means (9), the program counter (5) is rewritten to the branch destination address and the condition of the conditional branch instruction is rewritten. The branch destination address is executed immediately after the condition is satisfied, and if the condition of the conditional branch instruction is not satisfied, the address to be processed next, which is the lowermost content of the program counter queue storing means (8), is programmed. A high-speed branch processing method of the central processing unit, which is characterized in that it is loaded into the counter (5).
JP4325878A 1992-12-07 1992-12-07 High-speed branch processing system for central processing unit Withdrawn JPH06175848A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4325878A JPH06175848A (en) 1992-12-07 1992-12-07 High-speed branch processing system for central processing unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4325878A JPH06175848A (en) 1992-12-07 1992-12-07 High-speed branch processing system for central processing unit

Publications (1)

Publication Number Publication Date
JPH06175848A true JPH06175848A (en) 1994-06-24

Family

ID=18181627

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4325878A Withdrawn JPH06175848A (en) 1992-12-07 1992-12-07 High-speed branch processing system for central processing unit

Country Status (1)

Country Link
JP (1) JPH06175848A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4817678A (en) * 1986-06-20 1989-04-04 Picanol N.V. Broken warp thread locator

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4817678A (en) * 1986-06-20 1989-04-04 Picanol N.V. Broken warp thread locator

Similar Documents

Publication Publication Date Title
US5515519A (en) Data processor and method utilizing coded no-operation instructions
US7458069B2 (en) System and method for fusing instructions
US5404552A (en) Pipeline risc processing unit with improved efficiency when handling data dependency
US5448746A (en) System for comounding instructions in a byte stream prior to fetching and identifying the instructions for execution
US5131086A (en) Method and system for executing pipelined three operand construct
US6832305B2 (en) Method and apparatus for executing coprocessor instructions
KR100259306B1 (en) Data processor having a branch command buffer
US5761490A (en) Changing the meaning of a pre-decode bit in a cache memory depending on branch prediction mode
US8555041B2 (en) Method for performing a return operation in parallel with setting status flags based on a return value register test
EP2220556B1 (en) A method and a system for accelerating procedure return sequences
US4739470A (en) Data processing system
US5416911A (en) Performance enhancement for load multiple register instruction
US20060242394A1 (en) Processor and processor instruction buffer operating method
US6631459B1 (en) Extended instruction word folding apparatus
US4933847A (en) Microcode branch based upon operand length and alignment
US7401328B2 (en) Software-implemented grouping techniques for use in a superscalar data processing system
US7600102B2 (en) Condition bits for controlling branch processing
JPH06175848A (en) High-speed branch processing system for central processing unit
US5838961A (en) Method of operation and apparatus for optimizing execution of short instruction branches
JPH07306785A (en) Processor with branch instruction executing function and branch instruction control method
JP3765111B2 (en) Processor having branch registration instruction
KR100631318B1 (en) Method and instruction decoder for processing conditional jump instruction in a processor with pipelined architecture
JP2597744B2 (en) Branch control method
JP3493110B2 (en) High-speed branch processing unit
JP2591325B2 (en) Branch control device

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20000307