JPH06195219A - Data processor - Google Patents

Data processor

Info

Publication number
JPH06195219A
JPH06195219A JP4342417A JP34241792A JPH06195219A JP H06195219 A JPH06195219 A JP H06195219A JP 4342417 A JP4342417 A JP 4342417A JP 34241792 A JP34241792 A JP 34241792A JP H06195219 A JPH06195219 A JP H06195219A
Authority
JP
Japan
Prior art keywords
instruction
address
return
subroutine
bus
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
JP4342417A
Other languages
Japanese (ja)
Inventor
Katsunori Suzuki
勝則 鈴木
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP4342417A priority Critical patent/JPH06195219A/en
Publication of JPH06195219A publication Critical patent/JPH06195219A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To provide a data processor where the deterioration of efficiency at the time of executing a return sub-routine instruction is avoided and waste in a pipeline processing mechanism does not occur on the execution of the sub-routine jump instruction. CONSTITUTION:A freeze bit 227 preventing a return destination instruction from being substituted for a newly prefetched instruction when the return destination instruction is stored in a data memory 210 at the time of executing the sub-routine jump instruction is provided. Furthermore, an address saving register (RA) storing the return destination address at the time of executing the sub-routine jump instruction is provided. An address saving register (RAS) storing plural return destination addresses at the time of executing the sub-routine jump instruction is provided.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は命令をプリフェッチして
パイプライン処理するデータ処理装置に関し、特に、リ
ターンサブルーチン命令処理を高速実行し、またサブル
ーチンジャンプ命令を分岐予測するデータ処理装置に関
する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a data processing device for prefetching instructions to perform pipeline processing, and more particularly to a data processing device for executing return subroutine instruction processing at high speed and predicting a branch jump instruction.

【0002】[0002]

【従来の技術】従来技術について図7,図8及び図9を
参照して説明する。図7は従来のマイクロプロセッサに
おいて5段のパイプライン処理が行われる場合のパイプ
ラインの各ステージを示す模式図である。
2. Description of the Related Art A conventional technique will be described with reference to FIGS. 7, 8 and 9. FIG. 7 is a schematic diagram showing each stage of the pipeline when the pipeline processing of five stages is performed in the conventional microprocessor.

【0003】この図7に示されている例では、命令をプ
リフェッチする命令フェッチステージ(以下、IFステー
ジという)101, 命令をデコードするデコードステージ
(以下、Dステージという)102, オペランドのアドレス
計算を行うオペランドアドレス計算ステージ(以下、A
ステージという)103, マイクロROM をアクセスするステ
ージ(特にRステージという)104とオペランドをプリフ
ェッチするステージ(特にOFステージという)105とを含
むオペランドフェッチステージ(以下、Fステージとい
う)106, 命令を実行する実行ステージ(以下、Eステー
ジという)107の5段の構成をパイプライン処理の基本と
している。
In the example shown in FIG. 7, an instruction fetch stage (hereinafter referred to as an IF stage) 101 for prefetching an instruction, a decode stage (hereinafter referred to as a D stage) 102 for decoding an instruction, and an address calculation of operands are performed. Operand address calculation stage to perform (hereinafter, A
Operand fetch stage (hereinafter, referred to as F stage) 106, which includes a stage 103), a stage for accessing micro ROM (particularly referred to as R stage) 104 and a stage for prefetching operands (particularly referred to as OF stage) 105, and executes an instruction The five stages of execution stages (hereinafter referred to as E stages) 107 are the basics of pipeline processing.

【0004】また、命令の処理に際して各ステージで均
衡したパイプライン処理が行えるように、命令コードは
複数のパイプライン処理単位(以下、ステップコードと
いう) に分解されて処理される。IFステージ101 からD
ステージ102 に渡される情報は命令コード108 そのもの
である。Dステージ102 からAステージ103 に渡される
情報は、命令で指定された演算に関する情報(以下、D
コード109 という) と、オペランドのアドレス計算に関
する情報(以下、Aコード110 という)との二つの情報
である。
Further, the instruction code is decomposed into a plurality of pipeline processing units (hereinafter referred to as step codes) and processed so that balanced pipeline processing can be performed in each stage in processing the instructions. IF stage 101 to D
The information passed to the stage 102 is the instruction code 108 itself. The information passed from the D stage 102 to the A stage 103 is the information related to the operation designated by the instruction (hereinafter, D
It is two pieces of information, that is, the code 109) and the information regarding the operand address calculation (hereinafter referred to as the A code 110).

【0005】Aステージ103 からFステージ106 に渡さ
れる情報は、マイクロプログラムルーチンのエントリ番
地, マイクロプログラムへのパラメータ等を含むRコー
ド111 と、オペランドのアドレス, アクセス指示情報等
を含むFコード112 との二つの情報である。Fステージ
106 からEステージ107 に渡される情報は、演算制御情
報, リテラル等を含むEコード113 と、オペランド, オ
ペランドアドレス等を含むSコード114 との二つの情報
である。
Information passed from the A stage 103 to the F stage 106 is an R code 111 including an entry address of a microprogram routine, parameters to the microprogram, and an F code 112 including an operand address and access instruction information. There are two types of information. F stage
The information passed from the E 106 to the E stage 107 is two pieces of information, an E code 113 including operation control information, a literal, etc., and an S code 114 including an operand, an operand address, etc.

【0006】図8及び図9は図7に示されている各パイ
プライン処理ステージの具体的な内部構成例を示すブロ
ック図である。なお、図8には主としてIFステージ101
及びDステージ02の内部構成が、図9には主としてAス
テージ103,Fステージ106 及びEステージ107 の内部構
成がそれぞれ示されている。
FIGS. 8 and 9 are block diagrams showing a specific internal configuration example of each pipeline processing stage shown in FIG. Note that FIG. 8 mainly shows the IF stage 101.
9 and FIG. 9 mainly show the internal configurations of the A stage 103, the F stage 106 and the E stage 107, respectively.

【0007】図8のIFステージ101 において、参照符号
201 は外部からフェッチした命令コードを記憶する命令
フェッチレジスタ(IIN) を、 202は命令フェッチレジス
タ201 の出力と内部キャッシュから出力される命令コー
ドとのいずれかを選択する選択回路(SELCT) を、 203は
フェッチ順に命令コードを記憶する命令キューを、 204
は命令のフェッチ先のアドレスを計算するフェッチアド
レスカウンタ(QINPC)を、 205はフェッチアドレスカウ
ンタ204 のアドレス値をカウントアップするインクリメ
ンタ(INC) を、 206はアドレスのタグを記憶するタグレ
ジスタを、 207はアドレスのインデックスを記憶するイ
ンデックスレジスタを、 208はインデックスの値をデコ
ードして命令キャッシュのエントリをアサートするイン
デックスデコーダを、 209は命令キャッシュのアドレス
タグを記憶するタグメモリを、 210は命令キャッシュの
命令コードを記憶するデータメモリを、 211はインデッ
クスデコーダ208 でアサートされたエントリのデータメ
モリ出力BOUTを、 212は命令のフェッチアドレスを記憶
するフェッチアドレスレジスタCAA をそれぞれ示してい
る。
In the IF stage 101 of FIG.
201 is an instruction fetch register (IIN) that stores the instruction code fetched from the outside, 202 is a selection circuit (SELCT) that selects either the output of the instruction fetch register 201 or the instruction code output from the internal cache, 203 is an instruction queue for storing instruction codes in the fetch order,
Is a fetch address counter (QINPC) that calculates the address of the instruction fetch destination, 205 is an incrementer (INC) that counts up the address value of the fetch address counter 204, and 206 is a tag register that stores the address tag. 207 is an index register that stores the index of the address, 208 is an index decoder that decodes the index value and asserts the instruction cache entry, 209 is tag memory that stores the address tag of the instruction cache, and 210 is the instruction cache. , 211 indicates a data memory output BOUT of the entry asserted by the index decoder 208, and 212 indicates a fetch address register CAA for storing an instruction fetch address.

【0008】なお、参照符号280 は外部からフェッチし
た命令コードをデータメモリ210 に登録する登録データ
を、 281は命令キュー203 を経由せずに命令コードを Q
INバス251 にロードするためのバイパスをそれぞれ示し
ている。
Reference numeral 280 is registration data for registering an instruction code fetched from the outside in the data memory 210, and reference numeral 281 is an instruction code without passing through the instruction queue 203.
Each shows a bypass for loading on IN bus 251.

【0009】図8のDステージ102 において、参照符号
213は命令コード108 をデコードする命令デコード部
を、 214は命令デコード部213 で処理中の命令コードの
先頭アドレスを計算するPC演算部をそれぞれ示してい
る。
In the D stage 102 of FIG.
Reference numeral 213 denotes an instruction decoding unit that decodes the instruction code 108, and 214 denotes a PC arithmetic unit that calculates the start address of the instruction code being processed by the instruction decoding unit 213.

【0010】また、参照符号283 は分岐命令の分岐変位
アドレス値を、 284はプログラムカウント(PC)値を計算
するためのPC制御信号を、 286はサブルーチンジャンプ
命令検出信号を、 287は分岐先アドレスを、 288はデコ
ードした命令の先頭アドレスをそれぞれ示している。
Reference numeral 283 is a branch displacement address value of a branch instruction, 284 is a PC control signal for calculating a program count (PC) value, 286 is a subroutine jump instruction detection signal, and 287 is a branch destination address. , 288 indicates the start address of the decoded instruction.

【0011】図9のAステージ103 において、参照符号
215 はEステージ107 での処理に必要なオペランドのア
ドレスを計算するアドレス計算部をそれぞれ示してい
る。また、参照符号289 はオペランドのフェッチ先を示
すオペランドフェッチアドレスを示している。
At the A stage 103 in FIG.
Reference numeral 215 denotes an address calculator that calculates the address of the operand required for the processing in the E stage 107. Further, reference numeral 289 indicates an operand fetch address indicating a fetch destination of the operand.

【0012】図9のFステージ106 において、参照符号
217 はFステージ106 及びEステージ107 の制御を行な
うマイクロROM を、 218はアドレス計算部215 の計算結
果を記憶するFコードアドレスレジスタ(FA)を、 220は
Fコードアドレスレジスタ218 のアドレスに対応するオ
ペランドを記憶するSコードデータレジスタ(SD)をそれ
ぞれ示している。
In the F stage 106 of FIG.
217 is a micro ROM for controlling the F stage 106 and the E stage 107, 218 is an F code address register (FA) for storing the calculation result of the address calculation unit 215, and 220 is an address of the F code address register 218. The S code data register (SD) for storing the operands is shown.

【0013】図9のEステージ107 において、参照符号
221 はEステージ107 で使用するデータを内部に記憶す
るレジスタファイルを、 222は2値の演算を行なうALU
を、223はEステージ107 で処理する外部データを記憶
する外部データレジスタ(DD)を、 224はEステージ107
で処理する外部データのアドレスを記憶する外部データ
アドレスレジスタ(AA)をそれぞれ示している。
In E stage 107 of FIG.
221 is a register file that internally stores the data used in the E stage 107, and 222 is an ALU that performs binary operation.
223 is an external data register (DD) for storing external data processed by the E stage 107, and 224 is an E stage 107.
The external data address register (AA) for storing the address of the external data to be processed in FIG.

【0014】また、参照符号250 はこのデータ処理装置
が外部との間で入出力するデータをロードするDDバス
を、 251は命令コードをロードする QINバスを、 252は
分岐先アドレス値をロードするCAバスを、 253は分岐命
令の変位アドレス値をロードするDISPバスを、 254はア
ドレス計算部215 の出力をロードするAOバスを、 256は
ALU 222 の演算ソースをロードするS1バスを、 255はAL
U 222 の演算ソースをロードするS2バスを、 257はALU
222 の演算結果をロードするDOバスを、 258はこのデー
タ処理装置が外部との間で入出力するデータのアドレス
をロードするAAバスをそれぞれ示している。
Further, reference numeral 250 is a DD bus for loading data input / output to / from the data processor, 251 is a QIN bus for loading an instruction code, and 252 is a branch destination address value. The CA bus, 253 is the DISP bus that loads the displacement address value of the branch instruction, 254 is the AO bus that loads the output of the address calculation unit 215, and 256 is the
S1 bus for loading ALU 222 calculation source, 255 for AL
S2 bus to load the calculation source of U222, 257 is ALU
The DO bus for loading the operation result of 222 and 258 for the AA bus for loading the address of the data which this data processing unit inputs / outputs to / from the outside are respectively shown.

【0015】上述のような従来例のデータ処理装置の動
作は以下の如くである。なおここでは、ジャンプ命令以
外の通常命令を処理する場合について最初に説明する。
The operation of the conventional data processing apparatus as described above is as follows. Here, the case of processing a normal instruction other than the jump instruction will be described first.

【0016】まず、CAA 212 が示すアドレスに従って外
部から命令コードがDDバス250 にロードされる。ロード
された命令コードはIIN 201 に取り込まれる。IIN 201
に取り込まれた命令コードはSELCT 202 を経由して命令
キュー203 に一旦記憶された後、FIFO(First In First
Out)順に従って QINバス251 にロードされる。なお、分
岐命令の直後の分岐先命令フェッチが行われる場合に
は、命令キュー203 を通らずにバイパス281 を通って直
接 QINバス251 に分岐先命令コードがロードされる。
First, an instruction code is loaded onto the DD bus 250 from the outside according to the address indicated by the CAA 212. The loaded instruction code is taken into IIN 201. IIN 201
The instruction code fetched by the device is temporarily stored in the instruction queue 203 via the SELCT 202 and then stored in the FIFO (First In First
Out) will be loaded onto QIN bus 251 according to order. When the branch destination instruction is fetched immediately after the branch instruction, the branch destination instruction code is loaded directly into the QIN bus 251 through the bypass 281 without passing through the instruction queue 203.

【0017】一方、分岐先命令が命令キャッシュのデー
タメモリ210 に存在する場合には、データメモリ出力21
1 をSELCT 202 で選択しバイパス281 を経由して直接 Q
INバス251 に分岐先命令コードがロードされる。以後の
命令コードのフェッチはQINPC 204 の値をINC 205 でカ
ウントアップしてCAバス252 にロードしてCAA 212 に取
込み、このCAA 212 のアドレス値に従って命令コードが
順次フェッチされる。
On the other hand, if the branch destination instruction exists in the data memory 210 of the instruction cache, the data memory output 21
Select 1 in SELCT 202 and Q via bypass 281 directly
The branch target instruction code is loaded into the IN bus 251. For subsequent instruction code fetching, the value of QINPC 204 is incremented by INC 205, loaded on CA bus 252, fetched to CAA 212, and the instruction code is fetched sequentially according to the address value of this CAA 212.

【0018】QINバス251 にロードされた命令コードは
命令デコード部213 に取り込まれる。この命令コードが
デコードされた結果、PC制御信号284 としてデコードし
た命令長がPC演算部214 へ出力され、これに従って命令
デコード部213 はデコードする命令コードの先頭アドレ
ス (PC値) を計算する。
The instruction code loaded on the QIN bus 251 is fetched by the instruction decoding unit 213. As a result of this instruction code being decoded, the instruction length decoded as the PC control signal 284 is output to the PC operation unit 214, and the instruction decoding unit 213 calculates the start address (PC value) of the instruction code to be decoded accordingly.

【0019】アドレス計算部215 は命令デコード部213
から与えられるAコード110 に従ってオペランドのアド
レス値を計算し、オペランドフェッチアドレス289 をAO
バス254 にロードする。
The address calculation unit 215 is an instruction decoding unit 213.
Operand address value is calculated according to the A code 110 given by
Load on bus 254.

【0020】AOバス254 にロードされたオペランドフェ
ッチアドレス289 はFA 218に取り込まれ、AAバス258 に
ロードされる。AAバス258 へ出力されたアドレスに従っ
て、外部からDDバス250 にオペランドがロードされ、更
にSD 220に取り込まれる。
The operand fetch address 289 loaded on the AO bus 254 is fetched by the FA 218 and loaded on the AA bus 258. According to the address output to the AA bus 258, the operand is externally loaded into the DD bus 250 and further loaded into the SD 220.

【0021】演算に使用されるオペランドは、SD 220か
らS2バス255 にロードされる。一方のオペランドはレジ
スタファイル221 あるいはDD 223からS1バス256 にロー
ドされる。DD 223の値はAA 224からAAバス258 にロード
されたアドレス値に従って外部からDDバス250 にロード
され、DD 223に取り込まれる。S1バス256 及びS2バス25
5 にロードされた2つの値はALU 222 で演算され、その
演算結果はDOバス257 にロードされてレジスタファイル
221 に取り込まれるか、またはDD 223に取り込まれてDD
バス250 にロードされ、外部メモリ等へ転送される。以
下、各ステージでのパイプライン処理は同様の動作を繰
り返す。
The operands used in the operation are loaded from SD 220 to S2 bus 255. One operand is loaded from register file 221 or DD 223 onto S1 bus 256. The value of DD 223 is externally loaded to DD bus 250 and taken into DD 223 according to the address value loaded to AA bus 258 from AA 224. S1 bus 256 and S2 bus 25
The two values loaded into 5 are calculated by the ALU 222, and the calculation result is loaded into the DO bus 257 and registered in the register file.
Captured by 221 or DD captured by DD 223
It is loaded onto the bus 250 and transferred to external memory. Thereafter, the pipeline processing in each stage repeats the same operation.

【0022】次に、従来のデータ処理装置においてリタ
ーンサブルーチン(RTS) 命令を処理する際の動作につい
て説明する。QINPC 204 の値HA順次INC 205 に従ってイ
ンクリメントされ、 RTS命令が外部からDDバス250 にロ
ードされてIIN 201 に取り込まれる。この RTS命令の命
令コードは、通常の命令が処理される場合と同様に、SE
LCT 201 でIIN 201 の入力が選択されて命令キュー203
を経由して QINバス251 にロードされる。
Next, the operation of processing a return subroutine (RTS) instruction in the conventional data processing apparatus will be described. The value of QINPC 204 is incremented according to HA sequential INC 205, and the RTS instruction is externally loaded onto DD bus 250 and taken into IIN 201. The instruction code for this RTS instruction is SE, as if a normal instruction were processed.
ICT 201 input selected in LCT 201 and instruction queue 203
Via QIN bus 251.

【0023】QINバス251 にロードされた RTS命令コー
ドは命令デコード部213 に取り込まれる。そしてデコー
ドの結果、デコードされた RTS命令の命令長がPC制御信
号284 としてPC演算部214 へ出力されて RTS命令の次命
令の先頭アドレス (PC値) が計算される。
The RTS instruction code loaded on the QIN bus 251 is fetched by the instruction decoding unit 213. Then, as a result of the decoding, the instruction length of the decoded RTS instruction is output to the PC operation unit 214 as the PC control signal 284, and the start address (PC value) of the instruction next to the RTS instruction is calculated.

【0024】アドレス計算部215 は、命令デコード部21
3 から RTS命令に関するAコード110 が与えられるの
で、オペランドのアドレス値を計算してオペランドフェ
ッチアドレス289 をAOバス254 にロードする。
The address calculation unit 215 includes an instruction decoding unit 21
Since the A code 110 relating to the RTS instruction is given from 3, the operand address value is calculated and the operand fetch address 289 is loaded into the AO bus 254.

【0025】AOバス254 にロードされたオペランドフェ
ッチアドレス289 はFA 218に取り込まれ、AAバス258 に
ロードされる。AAバス258 に出力されたアドレスに従っ
て、外部からDDバス250 にオペランドがロードされてSD
220に取り込まれる。
The operand fetch address 289 loaded on the AO bus 254 is fetched by the FA 218 and loaded on the AA bus 258. The operand is externally loaded onto DD bus 250 according to the address output on AA bus 258, and SD
It is taken in by 220.

【0026】演算に使用されるオペランドは、SD 220か
らS2バス255 にロードされる。一方のオペランドはレジ
スタファイル221 あるいはDD 223からS1バス256 にロー
ドされる。DD 223の値はAA 224からAAバス258 にロード
されたアドレス値に従って、外部からDDバス250 にロー
ドされてDD 223に取り込まれる。S1バス256 及びS2バス
255 にロードされた2つの値はALU 222 で演算され、そ
の演算結果がDOバス257 にロードされてレジスタファイ
ル221 に取り込まれる。レジスタファイルに取り込まれ
た演算結果は RTS命令のリターン先アドレスを示してお
り、このエントリ先アドレスがCAバス252 にロードされ
る。
The operands used in the operation are loaded from SD 220 to S2 bus 255. One operand is loaded from register file 221 or DD 223 onto S1 bus 256. The value of DD 223 is externally loaded to DD bus 250 and taken into DD 223 according to the address value loaded from AA 224 to AA bus 258. S1 bus 256 and S2 bus
The two values loaded in 255 are operated on by the ALU 222, and the operation result is loaded on the DO bus 257 and fetched in the register file 221. The operation result fetched in the register file shows the return destination address of the RTS instruction, and this entry destination address is loaded into the CA bus 252.

【0027】CAバス252 にロードされたリターン先アド
レスはQINPC 204, CAA 212, タグレジスタ206,インデッ
クスレジスタ207 に取り込まれる。CAA 212 に取り込ま
れたリターン先アドレスはAAバス258 にロードされ、外
部からリターン先命令がフェッチされてDDバス250 にロ
ードされる。リターン先命令のフェッチ後は、 QINPC 2
04に取り込まれたリターン先アドレスがINC 205 でイン
クリメントされて順次リターン先命令の後続命令がフェ
ッチされる。
The return destination address loaded in the CA bus 252 is fetched in the QINPC 204, CAA 212, tag register 206, and index register 207. The return destination address fetched by the CAA 212 is loaded into the AA bus 258, and the return destination instruction is fetched from the outside and loaded into the DD bus 250. QINPC 2 after fetching the return destination instruction
The return address fetched in 04 is incremented by INC 205 and the subsequent instructions of the return destination instruction are fetched in sequence.

【0028】一方、タグレジスタ206 及びインデックス
レジスタ207 に取り込まれたリターン先アドレスに従っ
て命令キャッシュが検索され、命令キャッシュに既に登
録されている場合は、インデックスデコーダ208 が示す
エントリからデータメモリ210 に登録されているリター
ン先命令コードが出力されてデータメモリ出力レジスタ
BOUT 211に取り込まれる。 SELCT 202では命令キャッシ
ュがヒットしたことを受けてBOUT 211の値を選択して命
令キュー203 に出力する。リターン命令等のジャンプ命
令の直後の命令が処理される場合は、命令キュー203 を
経由せずに直接 QINバス251 にリターン先命令コードが
ロードされる。以下の動作は、命令デコード部以降の処
理は通常命令の動作と同様である。
On the other hand, the instruction cache is searched according to the return address fetched in the tag register 206 and the index register 207, and if it is already registered in the instruction cache, it is registered in the data memory 210 from the entry indicated by the index decoder 208. Return destination instruction code is output and data memory output register
Captured by BOUT 211. In SELCT 202, in response to the instruction cache hit, the value of BOUT 211 is selected and output to the instruction queue 203. When the instruction immediately after the jump instruction such as the return instruction is processed, the return destination instruction code is directly loaded into the QIN bus 251 without passing through the instruction queue 203. The following operation is the same as the operation of a normal instruction in the processing after the instruction decoding unit.

【0029】[0029]

【発明が解決しようとする課題】ところで、上述のよう
な命令をプリフェッチする従来のデータ処理装置では、
サブルーチンジャンプ命令を処理する場合には、サブル
ーチンジャンプ命令と共にリターン先の命令もプリフェ
ッチされている確率が高いにも拘わらず、リターンサブ
ルーチン命令の実行に際しては再度リターン先命令を外
部からフェッチする必要があり、処理効率の低下を招来
していた。
By the way, in the conventional data processing device for prefetching the above-mentioned instruction,
When processing a subroutine jump instruction, it is necessary to fetch the return destination instruction again from the outside when executing the return subroutine instruction, even though the return destination instruction is prefetched together with the subroutine jump instruction with a high probability. However, the processing efficiency was lowered.

【0030】また、パイプライン処理機構を備えている
場合には、パイプライン処理機構で処理された内容が全
て無駄になるという問題もあった。
Further, when the pipeline processing mechanism is provided, there is a problem that all the contents processed by the pipeline processing mechanism are wasted.

【0031】本発明はこのような事情に鑑みてなされた
ものであり、サブルーチンジャンプ命令の実行に際し
て、リターンサブルーチン命令実行時の効率低下を回避
し、またパイプライン処理機構での無駄が生じないデー
タ処理装置の提供を目的とする。
The present invention has been made in view of the above circumstances, and when executing a subroutine jump instruction, avoids a decrease in efficiency during execution of a return subroutine instruction, and does not waste data in the pipeline processing mechanism. It is intended to provide a processing device.

【0032】[0032]

【課題を解決するための手段】第1の発明は、サブルー
チンジャンプ命令が実行される際に、そのリターン先命
令が命令記憶手段に記憶されている場合にはその命令が
新たにプリフェッチされた命令で置き換えられないよう
にする手段を備えている。
According to a first aspect of the invention, when a return jump instruction is stored in an instruction storage means when a subroutine jump instruction is executed, the instruction is newly prefetched. Equipped with a means to prevent replacement by.

【0033】また第2の発明は、サブルーチンジャンプ
命令が実行される際に、そのリターン先アドレスを記憶
するアドレス記憶手段を備えている。
The second aspect of the invention further comprises address storage means for storing the return address when the subroutine jump instruction is executed.

【0034】更に第3の発明は、サブルーチンジャンプ
命令が実行される際に、そのリターン先アドレスを複数
記憶するアドレス記憶手段を備えている。
Further, the third invention comprises an address storage means for storing a plurality of return destination addresses when the subroutine jump instruction is executed.

【0035】[0035]

【作用】第1の発明では、サブルーチンジャンプ命令が
実行される際に、そのリターン先命令が命令記憶手段に
記憶されている場合にはその命令が新たにプリフェッチ
された命令で置き換えられることがないので、リターン
サブルーチン命令の実行に際してリターン先命令が新た
に外部からフェッチされることなしに、命令記憶手段か
ら読み出される。
In the first aspect, when the subroutine jump instruction is executed, if the return destination instruction is stored in the instruction storage means, the instruction is not replaced with the newly prefetched instruction. Therefore, when the return subroutine instruction is executed, the return destination instruction is read from the instruction storage means without being newly fetched from the outside.

【0036】また第2の発明では、サブルーチンジャン
プ命令が実行される際に、そのリターン先アドレスがア
ドレス記憶手段に記憶され、このアドレス記憶手段に記
憶されたアドレスの命令が命令記憶手段にフェッチされ
る。そして、リターンサブルーチン命令の実行に際して
は、リターン先命令が新たに外部からフェッチされるこ
となしに、アドレス記憶手段から読み出されたリターン
先アドレスに従って命令記憶手段から読み出される。
In the second invention, when the subroutine jump instruction is executed, its return destination address is stored in the address storage means, and the instruction of the address stored in this address storage means is fetched in the instruction storage means. It When the return subroutine instruction is executed, the return destination instruction is read from the instruction storage means according to the return destination address read from the address storage means without being newly fetched from the outside.

【0037】更に第3の発明は、サブルーチンジャンプ
命令が実行される際に、そのリターン先アドレスが順次
的にアドレス記憶手段に記憶され、このアドレス記憶手
段に記憶されたアドレスの命令が命令記憶手段にフェッ
チされる。そして、リターンサブルーチン命令の実行に
際しては、リターン先命令が新たに外部からフェッチさ
れることなしに、順次的にアドレス記憶手段から読み出
されたリターン先アドレスに従って命令記憶手段から読
み出される。
Further, in the third invention, when the subroutine jump instruction is executed, the return destination addresses thereof are sequentially stored in the address storage means, and the instruction of the address stored in the address storage means is stored in the instruction storage means. To be fetched. When the return subroutine instruction is executed, the return destination instruction is sequentially read from the instruction storage means according to the return destination address read from the address storage means without being newly fetched from the outside.

【0038】[0038]

【実施例】以下、本発明をその実施例を示す図面に基づ
いて詳述する。まず、図1及び図2のブロック図にその
各パイプライン処理ステージの具体的な内部構成例が示
されている本発明の第1の発明のデータ処理装置につい
て説明する。
DESCRIPTION OF THE PREFERRED EMBODIMENTS The present invention will be described below in detail with reference to the drawings showing the embodiments thereof. First, the data processing apparatus of the first invention of the present invention, in which the concrete internal configuration example of each pipeline processing stage is shown in the block diagrams of FIGS. 1 and 2, will be described.

【0039】なお、図1には主としてIFステージ101 及
びDステージ102 の内部構成が、図2には主としてAス
テージ103,Fステージ106 及びEステージ107 の内部構
成がそれぞれ示されており、また前述の従来例の説明で
参照した図8及び図9と同一の参照符号は同一又は相当
部分を示している。
FIG. 1 mainly shows the internal structures of the IF stage 101 and the D stage 102, and FIG. 2 mainly shows the internal structures of the A stage 103, the F stage 106 and the E stage 107, respectively. 8 and 9 which are referred to in the description of the conventional example, indicate the same or corresponding parts.

【0040】図1のIFステージ101 において、参照符号
201 は外部からフェッチした命令コードを記憶する命令
フェッチレジスタ(IIN) を、 202は命令フェッチレジス
タ201 の出力と内部キャッシュから出力される命令コー
ドとのいずれかを選択する選択回路(SELCT) を、 203は
フェッチ順に命令コードを記憶する命令キューを、 204
は命令のフェッチ先のアドレスを計算するフェッチアド
レスカウンタ(QINPC)を、 205はフェッチアドレスカウ
ンタ204 のアドレス値をカウントアップするインクリメ
ンタ(INC) を、 206はアドレスのタグを記憶するタグレ
ジスタを、 207はアドレスのインデックスを記憶するイ
ンデックスレジスタを、 208はインデックスの値をデコ
ードして命令キャッシュのエントリをアサートするイン
デックスデコーダを、 209は命令キャッシュのアドレス
タグを記憶するタグメモリを、 210は命令キャッシュの
命令コードを記憶するデータメモリを、 211はインデッ
クスデコーダ208 でアサートされたエントリのデータメ
モリ出力BOUTを、 212は命令のフェッチアドレスを記憶
するフェッチアドレスレジスタCAA をそれぞれ示してい
る。
In the IF stage 101 of FIG.
201 is an instruction fetch register (IIN) that stores the instruction code fetched from the outside, 202 is a selection circuit (SELCT) that selects either the output of the instruction fetch register 201 or the instruction code output from the internal cache, 203 is an instruction queue for storing instruction codes in the fetch order,
Is a fetch address counter (QINPC) that calculates the address of the instruction fetch destination, 205 is an incrementer (INC) that counts up the address value of the fetch address counter 204, and 206 is a tag register that stores the address tag. 207 is an index register that stores the index of the address, 208 is an index decoder that decodes the index value and asserts the instruction cache entry, 209 is tag memory that stores the address tag of the instruction cache, and 210 is the instruction cache. , 211 indicates a data memory output BOUT of the entry asserted by the index decoder 208, and 212 indicates a fetch address register CAA for storing an instruction fetch address.

【0041】以上のIFステージ101 の構成は図8に示さ
れている従来例と同様であるが、本第1の発明のデータ
処理装置では更にIFステージ101 に、命令キャッシュの
インデックスデコーダ208 が示すエントリのタグメモリ
出力レジスタ225 と、CAバス252 から取り込まれたてタ
グレジスタ206 に格納されているタグアドレスと命令キ
ャッシュのタグメモリ209 から出力されてタグメモリ出
力レジスタ225 の保持されているタグメモリ出力値とを
比較するタグアドレス比較器226 と、命令キャッシュの
データメモリ210 にエントリ毎にフリーズをかけること
が出来るフリーズビット227 とが備えられている。
The structure of the IF stage 101 described above is the same as that of the conventional example shown in FIG. 8. However, in the data processor of the first invention, the index decoder 208 of the instruction cache is further shown in the IF stage 101. The tag memory output register 225 of the entry, the tag address fetched from the CA bus 252 and stored in the tag register 206 and the tag memory output of the tag memory 209 of the instruction cache and held in the tag memory output register 225. A tag address comparator 226 for comparing the output value and a freeze bit 227 that can freeze each entry in the data memory 210 of the instruction cache are provided.

【0042】なお、参照符号280 は外部からフェッチし
た命令コードをデータメモリ210 に登録する登録データ
を、 281は命令キュー203 を経由せずに命令コードを Q
INバス251 にロードするためのバイパスをそれぞれ示し
ている。
Reference numeral 280 indicates registration data for registering an instruction code fetched from the outside in the data memory 210, and 281 indicates the instruction code without passing through the instruction queue 203.
Each shows a bypass for loading on IN bus 251.

【0043】図1のDステージ102 において、参照符号
213は命令コード108 をデコードする命令デコード部
を、 214は命令デコード部213 で処理中の命令コードの
先頭アドレスを計算するPC演算部をそれぞれ示してい
る。
In the D stage 102 of FIG.
Reference numeral 213 denotes an instruction decoding unit that decodes the instruction code 108, and 214 denotes a PC arithmetic unit that calculates the start address of the instruction code being processed by the instruction decoding unit 213.

【0044】また、参照符号283 は分岐命令の分岐変位
アドレス値を、 284はプログラムカウント(PC)値を計算
するためのPC制御信号を、 286はサブルーチンジャンプ
命令検出信号を、 287は分岐先アドレスを、 288はデコ
ードした命令の先頭アドレスをそれぞれ示している。
Reference numeral 283 is a branch displacement address value of a branch instruction, 284 is a PC control signal for calculating a program count (PC) value, 286 is a subroutine jump instruction detection signal, and 287 is a branch destination address. , 288 indicates the start address of the decoded instruction.

【0045】図2のAステージ103 において、参照符号
215 はEステージ107 での処理に必要なオペランドのア
ドレスを計算するアドレス計算部をそれぞれ示してい
る。以上のAステージ103 の構成は図9に示されている
従来例と同様であるが、本第1の発明のデータ処理装置
では更にAステージ103 に、命令デコード部213 でリタ
ーン命令をデコーダしたことを示すリターンサブルーチ
ン命令(RTS) 検出信号293 が備えられている。また、参
照符号289 はオペランドのフェッチ先を示すオペランド
フェッチアドレスを示している。
In the A stage 103 of FIG.
Reference numeral 215 denotes an address calculator that calculates the address of the operand required for the processing in the E stage 107. The configuration of the above A stage 103 is the same as that of the conventional example shown in FIG. 9, but in the data processor of the first aspect of the present invention, the instruction decoding unit 213 further decodes the return instruction in the A stage 103. A return subroutine instruction (RTS) detect signal 293 is provided. Further, reference numeral 289 indicates an operand fetch address indicating a fetch destination of the operand.

【0046】図2のFステージ106 において、参照符号
217 はFステージ106 及びEステージ107 の制御を行な
うマイクロROM を、 218はアドレス計算部215 の計算結
果を記憶するFコードアドレスレジスタ(FA)を、 220は
Fコードアドレスレジスタ218 のアドレスに対応するオ
ペランドを記憶するSコードデータレジスタ(SD)をそれ
ぞれ示している。
In the F stage 106 of FIG.
217 is a micro ROM for controlling the F stage 106 and the E stage 107, 218 is an F code address register (FA) for storing the calculation result of the address calculation unit 215, and 220 is an address of the F code address register 218. The S code data register (SD) for storing the operands is shown.

【0047】以上のFステージ106 の構成は図9に示さ
れている従来例と同様であるが、本第1の発明のデータ
処理装置では更にFステージ106 に、Fコードアドレス
レジスタ218 の値を退避するアドレス退避レジスタ(RA)
219 と、CAバス252 にリターン先アドレスをロードする
ことを指示するリターンアドレス制御信号292 とが備え
られている。
The configuration of the above F stage 106 is similar to that of the conventional example shown in FIG. 9, but in the data processing apparatus of the first invention, the value of the F code address register 218 is further added to the F stage 106. Address save register (RA) to save
219 and a return address control signal 292 for instructing the CA bus 252 to load a return address.

【0048】図2のEステージ107 において、参照符号
221 はEステージ107 で使用するデータを内部に記憶す
るレジスタファイルを、 222は2値の演算を行なうALU
を、223はEステージ107 で処理する外部データを記憶
する外部データレジスタ(DD)を、 224はEステージ107
で処理する外部データのアドレスを記憶する外部データ
アドレスレジスタ(AA)をそれぞれ示している。
In E stage 107 of FIG.
221 is a register file that internally stores the data used in the E stage 107, and 222 is an ALU that performs binary operation.
223 is an external data register (DD) for storing external data processed by the E stage 107, and 224 is an E stage 107.
The external data address register (AA) for storing the address of the external data to be processed in FIG.

【0049】また、参照符号250 はこのデータ処理装置
が外部との間で入出力するデータをロードするDDバス
を、 251は命令コードをロードする QINバスを、 252は
分岐先アドレス値をロードするCAバスを、 253は分岐命
令の変位アドレス値をロードするDISPバスを、 254はア
ドレス計算部215 の出力をロードするAOバスを、 256は
ALU 222 の演算ソースをロードするS1バスを、 255はAL
U 222 の演算ソースをロードするS2バスを、 257はALU
222 の演算結果をロードするDOバスを、 258はこのデー
タ処理装置が外部との間で入出力するデータのアドレス
をロードするAAバスをそれぞれ示している。
Further, reference numeral 250 is a DD bus for loading data input / output to / from the outside by this data processing device, 251 is a QIN bus for loading an instruction code, and 252 is a branch destination address value. The CA bus, 253 is the DISP bus that loads the displacement address value of the branch instruction, 254 is the AO bus that loads the output of the address calculation unit 215, and 256 is the
S1 bus for loading ALU 222 calculation source, 255 for AL
S2 bus to load the calculation source of U222, 257 is ALU
The DO bus for loading the operation result of 222 and 258 for the AA bus for loading the address of the data which this data processing unit inputs / outputs to / from the outside are respectively shown.

【0050】以下に、本発明の第1の発明のデータ処理
装置において、サブルーチンジャンプ(JSR) 命令を処理
する際の動作について説明する。但し、ジャンプ命令以
外の通常命令の動作は従来のデータ処理装置と同様であ
るため、説明を省略する。
The operation of processing the subroutine jump (JSR) instruction in the data processor according to the first aspect of the present invention will be described below. However, since the operations of the normal instructions other than the jump instruction are the same as those of the conventional data processing device, the description thereof will be omitted.

【0051】まず、CAA 212 が示すアドレスに従って外
部から JSR命令コードがDDバス250にロードされる。
ロードされた JSR命令コードはIIN 201 に取り込ま
れる。IIN202 に取り込まれた JSR命令コードはSELCT 2
02 を経由して命令キュー203 に一旦記憶された後、FIF
O(First In First Out)順に従って QINバス251 にロー
ドされる。
First, the JSR instruction code is loaded onto the DD bus 250 from the outside according to the address indicated by the CAA 212.
The loaded JSR instruction code is taken into IIN 201. The JSR instruction code fetched by IIN202 is SELCT 2
After being stored in the instruction queue 203 via 02, the FIF
Loaded on QIN bus 251 according to O (First In First Out) order.

【0052】QINバス251 にロードされた JSR命令コー
ドは、命令デコード部213 に取り込まれる。この命令コ
ードがデコードされた結果、PC制御信号284 として分岐
変位アドレス値283 をDISPバス253 から取り込むことを
指示する。PC演算部214 ではPC制御信号284 に従って分
岐変位アドレス値283 から分岐先アドレス287 を計算し
てCAバス252 にロードする。CAバス252 にロードされた
分岐先アドレス287 はCAA 212, QINPC 204及び命令キャ
ッシュのタグレジスタ206,インデックスレジスタ207 に
取り込まれる。
The JSR instruction code loaded on the QIN bus 251 is fetched by the instruction decoding unit 213. As a result of this instruction code being decoded, it is instructed to fetch the branch displacement address value 283 as the PC control signal 284 from the DISP bus 253. The PC calculation unit 214 calculates the branch destination address 287 from the branch displacement address value 283 according to the PC control signal 284 and loads it on the CA bus 252. The branch destination address 287 loaded on the CA bus 252 is taken into the CAA 212, QINPC 204, and the tag register 206 and index register 207 of the instruction cache.

【0053】命令キャッシュではタグレジスタ206 及び
インデックスレジスタ207 の値に従ってタグメモリが検
索される。命令キャッシュに既に登録されている場合は
そのエントリに対応するデータメモリから命令コードが
BOUT 211へ出力され、SELCT202 で命令キャッシュ側の
命令コードが選択されてバイパス281 を経由して QINバ
ス251 にロードされる。
In the instruction cache, the tag memory is searched according to the values of the tag register 206 and the index register 207. If it is already registered in the instruction cache, the instruction code from the data memory corresponding to that entry
It is output to BOUT 211, the instruction code on the instruction cache side is selected by SELCT 202, and loaded to QIN bus 251 via bypass 281.

【0054】未だ登録されていない場合は、CAA 212 か
らAAバス258 にロードされた分岐先アドレスに従って、
外部メモリに分岐先命令コードがフェッチされ、これが
DDバス250 にロードされてIIN 201 に取り込まれる。SE
LCT 202 ではIIN 201 が選択され、バイパス281 を経由
して QINバス251 に分岐先命令コードがロードされる。
分岐先命令コードのフェッチ後は再びQINPC 204 の値
(=分岐先アドレス) をINC 205 でインクリメントした
値がCAバス252 にロードされてCAA 212 に取り込まれ、
分岐先アドレスの後続命令のフェッチが続けられる。
If not yet registered, according to the branch destination address loaded from CAA 212 to AA bus 258,
The branch destination instruction code is fetched into the external memory and this
Loaded onto DD Bus 250 and taken into IIN 201. SE
In LCT 202, IIN 201 is selected and the branch destination instruction code is loaded into QIN bus 251 via bypass 281.
After fetching the branch destination instruction code, the value of QINPC 204 again
The value obtained by incrementing (= branch destination address) by INC 205 is loaded to CA bus 252 and fetched to CAA 212.
Fetching of the subsequent instruction at the branch destination address continues.

【0055】一方、Aステージ103 のアドレス計算部21
5 では、命令デコード部213 で JSR命令がデコード
されると、命令デコード部213 からAコード110 と
してデコードした JSR命令の命令長を受ける。また、PC
演算部214 から JSR命令の先頭アドレスを受ける。 JSR
命令の命令長及び JSR命令の先頭アドレスから JSR命令
の次命令 (リターン先命令) アドレスを計算して、AOバ
ス254 にロードする。
On the other hand, the address calculation unit 21 of the A stage 103
In 5, when the JSR instruction is decoded by the instruction decoding unit 213, the instruction length of the JSR instruction decoded as the A code 110 is received from the instruction decoding unit 213. Also, PC
Receives the start address of the JSR instruction from the operation unit 214. JSR
The next instruction (return destination instruction) address of the JSR instruction is calculated from the instruction length of the instruction and the start address of the JSR instruction, and loaded to the AO bus 254.

【0056】AOバス254 にロードされたリターン先アド
レスをFA 218に取り込む。また、命令デコード部213 か
らサブルーチンジャンプ命令(JSR) 検出信号286 を受け
てFA218に取り込んだリターン先アドレスをRA 219に退
避する。更に、 JSR検出信号286 がマイクロROM 217 に
入力されると、リターンアドレス制御信号292 を出力し
てRA 219に退避したリターン先アドレスをCAバス252 に
ロードする。
The return destination address loaded on the AO bus 254 is fetched into the FA 218. Further, upon receiving the subroutine jump instruction (JSR) detection signal 286 from the instruction decoding unit 213, the return address fetched in the FA 218 is saved in the RA 219. Further, when the JSR detection signal 286 is input to the micro ROM 217, the return address control signal 292 is output and the return destination address saved in RA 219 is loaded into the CA bus 252.

【0057】CAバス252 にロードされたリターン先アド
レスは、上位アドレスがタグレジスタ206 に、下位アド
レスがインデックスレジスタ207 にそれぞれ取り込まれ
る。インデックスデコーダ208 では、インデックスレジ
スタ207 の値に従って特定のエントリをアサートして、
タグメモリ209 からタグメモリ出力レジスタ225 にタグ
アドレスを出力する。
As for the return destination address loaded in the CA bus 252, the upper address is fetched in the tag register 206 and the lower address is fetched in the index register 207. The index decoder 208 asserts a specific entry according to the value in the index register 207,
The tag address is output from the tag memory 209 to the tag memory output register 225.

【0058】タグアドレス比較器226 では、CAバス252
から取り込んだタグレジスタ206 の値とタグメモリ出力
レジスタ225 の値とを比較する。もしヒットした際に J
SR検出信号286 がアサートされていれば、上述のインデ
ックスデコーダ208 でアサートしたエントリのデータメ
モリ210 の出力であるBOUT 211をSELCT 202 へ出力しな
い。その代わりに、上述のアサートされたエントリのフ
リーズビット227 をセットし、外部からフェッチした他
の命令により置換されることから保護する。
In the tag address comparator 226, the CA bus 252
The value of the tag register 206 fetched from is compared with the value of the tag memory output register 225. If you hit J
If the SR detection signal 286 is asserted, the output BOUT 211 of the data memory 210 of the entry asserted by the index decoder 208 is not output to the SELCT 202. Instead, the freeze bit 227 of the asserted entry described above is set to protect it from being replaced by another externally fetched instruction.

【0059】また、ミスヒットした際に JSR検出信号28
6 がアサートされていれば、外部にリターン先をフェッ
チせずにQINPC 204 の値に従って分岐先命令の後続命令
のフェッチを続ける。
Also, when a mishit occurs, the JSR detection signal 28
If 6 is asserted, the fetch of the instruction subsequent to the branch destination instruction is continued according to the value of QINPC 204 without fetching the return destination externally.

【0060】再度、サブルーチンジャンプ命令が実行さ
れた場合にも、上述同様の動作が反復される。
When the subroutine jump instruction is executed again, the same operation as described above is repeated.

【0061】最後に、本発明のデータ処理装置で、リタ
ーンサブルーチン(RTS) 命令を処理する際の動作につい
て説明する。QINPC 204 の値を順次INC 205 に従ってイ
ンクリメントを行い、 RTS命令を外部からDDバス250 に
ロードされIIN 201 に取り込まれる。通常の命令と同様
にSELCT 201 でIIN 201 の入力が選択されて命令キュー
203 を経由して QINバス251にロードされる。
Finally, the operation of the data processing apparatus of the present invention when processing a return subroutine (RTS) instruction will be described. The value of QINPC 204 is sequentially incremented according to INC 205, and the RTS instruction is externally loaded to DD bus 250 and taken into IIN 201. SELCT 201 selects the input of IIN 201 as in a normal instruction and the instruction queue
It is loaded onto QIN bus 251 via 203.

【0062】QINバス251 にロードされた RTS命令コー
ドは命令デコード部213 に取り込まれる。命令デコード
部213 では RTS命令をデコードすると RTS命令検出信号
293をマイクロROM 217 に出力する。
The RTS instruction code loaded on the QIN bus 251 is fetched by the instruction decoding unit 213. When the RTS instruction is decoded in the instruction decoding unit 213, the RTS instruction detection signal
Output 293 to micro ROM 217.

【0063】マイクロROM 217 では RTS命令検出信号29
3 を受けてリターンアドレス制御信号292 を出力して、
RA 219に退避していたリターン先アドレスをCAバス252
にロードする。これ以降の動作は他のジャンプ命令(JSR
命令等) と同様である。即ち、CAバス252 にロードされ
たリターン先アドレスはCAA 212, QINPC 204及び命令キ
ャッシュのタグレジスタ206 、インデックスレジスタ20
7 に取り込まれる。
In the micro ROM 217, the RTS instruction detection signal 29
In response to 3, output the return address control signal 292,
Return address saved in RA 219 to CA bus 252
To load. After this, the other jump instructions (JSR
Command etc.) That is, the return address loaded on the CA bus 252 is the CAA 212, QINPC 204, the instruction cache tag register 206, and the index register 20.
Incorporated in 7.

【0064】命令キャッシュではタグレジスタ206 及び
インデックスレジスタ207 の値に従ってアドレスメモリ
を検索する。事前にリターン先命令のエントリのフリー
ズビット227 をセットしてリターン先命令が置換される
ことがないように保護したので、命令キャッシュは高確
率でヒットする。
The instruction cache searches the address memory according to the values of the tag register 206 and the index register 207. Since the freeze bit 227 of the entry of the return destination instruction is set in advance to protect the return destination instruction from being replaced, the instruction cache is hit with a high probability.

【0065】通常の命令キャッシュの検索と同様に、イ
ンデックスレジスタ207 の値に従ってインデックスデコ
ーダ208 は特定のエントリをアサートする。アサートさ
れたタグメモリ209 及びデータメモリ210 の値はそれぞ
れタグメモリ出力レジスタ225 及びBOUT 211に取り込ま
れる。タグアドレス比較器226 ではCAバス252 から取り
込んだタグレジスタ206 の値との比較を行う。
Similar to a normal instruction cache search, the index decoder 208 asserts a particular entry according to the value in the index register 207. The asserted values of the tag memory 209 and the data memory 210 are fetched into the tag memory output register 225 and BOUT 211, respectively. The tag address comparator 226 compares with the value of the tag register 206 fetched from the CA bus 252.

【0066】ヒットした場合には、BOUT 211の値をSELC
T 202 に入力してヒット信号に従ってバイパス281 を経
由して直接 QINバス251 にリターン先命令がロードされ
る。また、ヒット信号により先にセットされたフリーズ
ビット227 がリセットされる。一方、ミスヒットした場
合には、CAA 212 からAAバス258 にロードしたリターン
先アドレスに従って外部メモリにフェッチする。
When there is a hit, the value of BOUT 211 is SELC
The return destination instruction is loaded directly into the QIN bus 251 via the bypass 281 according to the hit signal input to T 202. Also, the freeze signal 227 previously set by the hit signal is reset. On the other hand, in the case of a mishit, it is fetched to the external memory according to the return destination address loaded from the CAA 212 to the AA bus 258.

【0067】以降、リターン先命令の後続命令はQINPC
204 のリターン先アドレスをINC 205 でインクリメント
した値をCAバス252 にロードしCAA 212 に取り込み、CA
A 212 の値に従って順次フェッチを続ける。
Thereafter, the instruction following the return destination instruction is QINPC.
The value obtained by incrementing the return address of 204 with INC 205 is loaded into CA bus 252 and loaded into CAA 212, and CA
Continue fetching sequentially according to the value of A 212.

【0068】次に、図3及び図4のブロック図にその各
パイプライン処理ステージの具体的な内部構成例が示さ
れている本発明の第2の発明のデータ処理装置について
説明する。なお、図3には主としてIFステージ101 及び
Dステージ102 の内部構成が、図4には主としてAステ
ージ103,Fステージ106 及びEステージ107 の内部構成
がそれぞれ示されており、また前述の従来例の説明で参
照した図8及び図9と同一の参照符号は同一又は相当部
分を示している。
Next, the data processor of the second invention of the present invention, in which the concrete internal configuration example of each pipeline processing stage is shown in the block diagrams of FIGS. 3 and 4, will be explained. Note that FIG. 3 mainly shows the internal configurations of the IF stage 101 and the D stage 102, and FIG. 4 mainly shows the internal configurations of the A stage 103, the F stage 106, and the E stage 107, respectively. 8 and 9 referred to in the description of FIG. 8 indicate the same or corresponding parts.

【0069】図3のIFステージ101 において、参照符号
201 は外部からフェッチした命令コードを記憶する命令
フェッチレジスタ(IIN) を、 202は命令フェッチレジス
タ201 の出力と内部キャッシュから出力される命令コー
ドとのいずれかを選択する選択回路(SELCT) を、 203は
フェッチ順に命令コードを記憶する命令キューを、 204
は命令のフェッチ先のアドレスを計算するフェッチアド
レスカウンタ(QINPC)を、 205はフェッチアドレスカウ
ンタ204 のアドレス値をカウントアップするインクリメ
ンタ(INC) を、 206はアドレスのタグを記憶するタグレ
ジスタを、 207はアドレスのインデックスを記憶するイ
ンデックスレジスタを、 208はインデックスの値をデコ
ードして命令キャッシュのエントリをアサートするイン
デックスデコーダを、 209は命令キャッシュのアドレス
タグを記憶するタグメモリを、 210は命令キャッシュの
命令コードを記憶するデータメモリを、 211はインデッ
クスデコーダ208 でアサートされたエントリのデータメ
モリ出力BOUTを、 212は命令のフェッチアドレスを記憶
するフェッチアドレスレジスタCAA をそれぞれ示してい
る。
In the IF stage 101 of FIG.
201 is an instruction fetch register (IIN) that stores the instruction code fetched from the outside, 202 is a selection circuit (SELCT) that selects either the output of the instruction fetch register 201 or the instruction code output from the internal cache, 203 is an instruction queue for storing instruction codes in the fetch order,
Is a fetch address counter (QINPC) that calculates the address of the instruction fetch destination, 205 is an incrementer (INC) that counts up the address value of the fetch address counter 204, and 206 is a tag register that stores the address tag. 207 is an index register that stores the index of the address, 208 is an index decoder that decodes the index value and asserts the instruction cache entry, 209 is tag memory that stores the address tag of the instruction cache, and 210 is the instruction cache. , 211 indicates a data memory output BOUT of the entry asserted by the index decoder 208, and 212 indicates a fetch address register CAA for storing an instruction fetch address.

【0070】なお、参照符号280 は外部からフェッチし
た命令コードをデータメモリ210 に登録する登録データ
を、 281は命令キュー203 を経由せずに命令コードを Q
INバス251 にロードするためのバイパスをそれぞれ示し
ている。
Reference numeral 280 indicates registration data for registering the instruction code fetched from the outside in the data memory 210, and reference numeral 281 indicates the instruction code without passing through the instruction queue 203.
Each shows a bypass for loading on IN bus 251.

【0071】図3のDステージ102 において、参照符号
213は命令コード108 をデコードする命令デコード部
を、 214は命令デコード部213 で処理中の命令コードの
先頭アドレスを計算するPC演算部をそれぞれ示してい
る。
In the D stage 102 of FIG.
Reference numeral 213 denotes an instruction decoding unit that decodes the instruction code 108, and 214 denotes a PC arithmetic unit that calculates the start address of the instruction code being processed by the instruction decoding unit 213.

【0072】また、参照符号283 は分岐命令の分岐変位
アドレス値を、 284はプログラムカウント(PC)値を計算
するためのPC制御信号を、 286はサブルーチンジャンプ
命令検出信号を、 287は分岐先アドレスを、 288はデコ
ードした命令の先頭アドレスをそれぞれ示している。
Reference numeral 283 is a branch displacement address value of a branch instruction, 284 is a PC control signal for calculating a program count (PC) value, 286 is a subroutine jump instruction detection signal, and 287 is a branch destination address. , 288 indicates the start address of the decoded instruction.

【0073】図4のAステージ103 において、参照符号
215 はEステージ107 での処理に必要なオペランドのア
ドレスを計算するアドレス計算部をそれぞれ示してい
る。また、参照符号289 はオペランドのフェッチ先を示
すオペランドフェッチアドレスを示している。
In A stage 103 of FIG. 4, reference numeral
Reference numeral 215 denotes an address calculator that calculates the address of the operand required for the processing in the E stage 107. Further, reference numeral 289 indicates an operand fetch address indicating a fetch destination of the operand.

【0074】図4のFステージ106 において、参照符号
217 はFステージ106 及びEステージ107 の制御を行な
うマイクロROM を、 218はアドレス計算部215 の計算結
果を記憶するFコードアドレスレジスタ(FA)を、 220は
Fコードアドレスレジスタ218 のアドレスに対応するオ
ペランドを記憶するSコードデータレジスタ(SD)をそれ
ぞれ示している。
In the F stage 106 of FIG.
217 is a micro ROM for controlling the F stage 106 and the E stage 107, 218 is an F code address register (FA) for storing the calculation result of the address calculation unit 215, and 220 is an address of the F code address register 218. The S code data register (SD) for storing the operands is shown.

【0075】以上のFステージ106 の構成は図9に示さ
れている従来例と同様であるが、本第2の発明のデータ
処理装置では更にFステージ106 に、Dステージ102 の
命令デコード部213 がサブルーチンジャンプ命令を検出
したことを記憶する検出レジスタ216 と、Fコードアド
レスレジスタ218 の値を退避するアドレス退避レジスタ
(RA)219 と、IFステージ101 のINC 205 が何個の命令を
フェッチしたかを示すフェッチカウント制御信号290
と、リターン命令がフェッチされたことを検出レジスタ
216 からマイクロROM 217 に伝達するリターンフェッチ
制御信号291 と、CAバス252 にリターン先アドレスをロ
ードすることを指示するリターンアドレス制御信号292
と、命令デコード部213 でリターン命令をデコーダした
ことを示すリターンサブルーチン命令(RTS) 検出信号29
3 が備えられている。
The configuration of the F stage 106 described above is the same as that of the conventional example shown in FIG. 9. However, in the data processing apparatus of the second invention, the F stage 106 is further provided with the instruction decoding unit 213 of the D stage 102. Detection register 216 that stores the fact that a subroutine jump instruction has been detected, and an address save register that saves the value of the F code address register 218
(RA) 219 and fetch count control signal 290 indicating how many instructions are fetched by INC 205 of IF stage 101
And detect that the return instruction has been fetched
Return fetch control signal 291 transmitted from 216 to micro ROM 217 and return address control signal 292 for instructing to load return destination address to CA bus 252
And a return subroutine instruction (RTS) detection signal 29 indicating that the instruction decoding unit 213 has decoded the return instruction.
3 is equipped.

【0076】図4のEステージ107 において、参照符号
221 はEステージ107 で使用するデータを内部に記憶す
るレジスタファイルを、 222は2値の演算を行なうALU
を、223はEステージ107 で処理する外部データを記憶
する外部データレジスタ(DD)を、 224はEステージ107
で処理する外部データのアドレスを記憶する外部データ
アドレスレジスタ(AA)をそれぞれ示している。
In E stage 107 of FIG.
221 is a register file that internally stores the data used in the E stage 107, and 222 is an ALU that performs binary operation.
223 is an external data register (DD) for storing external data processed by the E stage 107, and 224 is an E stage 107.
The external data address register (AA) for storing the address of the external data to be processed in FIG.

【0077】また、参照符号250 はこのデータ処理装置
が外部との間で入出力するデータをロードするDDバス
を、 251は命令コードをロードする QINバスを、 252は
分岐先アドレス値をロードするCAバスを、 253は分岐命
令の変位アドレス値をロードするDISPバスを、 254はア
ドレス計算部215 の出力をロードするAOバスを、 256は
ALU 222 の演算ソースをロードするS1バスを、 255はAL
U 222 の演算ソースをロードするS2バスを、 257はALU
222 の演算結果をロードするDOバスを、 258はこのデー
タ処理装置が外部との間で入出力するデータのアドレス
をロードするAAバスをそれぞれ示している。
Further, reference numeral 250 is a DD bus for loading data input / output to / from the data processor, 251 is a QIN bus for loading an instruction code, and 252 is a branch destination address value. The CA bus, 253 is the DISP bus that loads the displacement address value of the branch instruction, 254 is the AO bus that loads the output of the address calculation unit 215, and 256 is the
S1 bus for loading ALU 222 calculation source, 255 for AL
S2 bus to load the calculation source of U222, 257 is ALU
The DO bus for loading the operation result of 222 and 258 for the AA bus for loading the address of the data which this data processing unit inputs / outputs to / from the outside are respectively shown.

【0078】以下に、本発明の第2の発明のデータ処理
装置において、サブルーチンジャンプ(JSR) 命令を処理
する際の動作について説明する。但し、ジャンプ命令以
外の通常命令の動作は従来のデータ処理装置と同様であ
るため、説明を省略する。
The operation of processing the subroutine jump (JSR) instruction in the data processor of the second invention of the present invention will be described below. However, since the operations of the normal instructions other than the jump instruction are the same as those of the conventional data processing device, the description thereof will be omitted.

【0079】まず、CAA 212 が示すアドレスに従って外
部から JSR命令コードがDDバス250にロードされる。ロ
ードされた JSR命令コードはIIN 201 に取り込まれる。
IIN202 に取り込まれた JSR命令コードはSELCT 202 を
経由して命令キュー203 に記憶され、FIFO(First In Fi
rst Out)順に従って QINバス251 にロードされる。
First, the JSR instruction code is loaded onto the DD bus 250 from the outside according to the address indicated by the CAA 212. The loaded JSR opcode is captured in IIN 201.
The JSR instruction code fetched by IIN202 is stored in the instruction queue 203 via SELCT 202, and FIFO (First In Fi
rst Out) loaded onto QIN Bus 251 in order.

【0080】QINバス251 にロードされた JSR命令コー
ドは、命令デコード部213 に取り込まれる。この命令コ
ードがデコードされた結果、PC制御信号284 として分岐
変位アドレス値283 をDISPバス253 から取り込むことを
指示する。PC演算部214 では、PC制御信号284 に従って
分岐変位アドレス値283 から分岐先アドレス287 を計算
してCAバス252 にロードする。
The JSR instruction code loaded on the QIN bus 251 is fetched by the instruction decoding unit 213. As a result of this instruction code being decoded, it is instructed to fetch the branch displacement address value 283 as the PC control signal 284 from the DISP bus 253. The PC operation unit 214 calculates the branch destination address 287 from the branch displacement address value 283 according to the PC control signal 284 and loads it on the CA bus 252.

【0081】CAバス252 にロードされた分岐先アドレス
287 はCAA 212,QINPC 204 及び命令キャッシュのタグレ
ジスタ206,インデックスレジスタ207 に取り込まれる。
命令キャッシュでは、タグレジスタ206 及びインデック
スレジスタ207 の値に従って、アドレスメモリが検索さ
れる。命令キャッシュに既に登録されている場合は、そ
のエントリに対応するデータメモリから命令コードがBO
UT211 へ出力され、SELCT 202 で命令キャッシュ側の命
令コードが選択され、バイパス281 を経由して QINバス
251 にロードされる。
Branch destination address loaded in CA bus 252
287 is loaded into the CAA 212, QINPC 204, and the tag register 206 and index register 207 of the instruction cache.
In the instruction cache, the address memory is searched according to the values of the tag register 206 and index register 207. If it is already registered in the instruction cache, the instruction code from the data memory corresponding to that entry is BO
It is output to UT211 and the instruction code on the instruction cache side is selected by SELCT 202, and is passed through the bypass 281 to the QIN bus.
Loaded into the 251.

【0082】登録されていない場合は、CAA 212 からAA
バス258 にロードされた分岐先アドレスに従って、外部
メモリに分岐先命令コードがフェッチされ、これがDDバ
ス250 にロードされてIIN 201 に取り込まれる。SELCT
202 ではIIN 201 が選択されてバイパス281 を経由して
QINバス251 に分岐先命令コードがロードされる。分岐
先命令コードがフェッチされた後は再びQINPC 204 の値
(=分岐先アドレス) をINC 205 でインクリメントした
値がCAバス252 にロードされてCAA 212 に取り込まれ、
分岐先アドレスの後続命令のフェッチが続けられる。
If not registered, CAA 212 to AA
According to the branch destination address loaded on the bus 258, the branch destination instruction code is fetched to the external memory, loaded on the DD bus 250 and fetched in the IIN 201. SELCT
In 202, IIN 201 is selected and via bypass 281
The branch instruction code is loaded into QIN bus 251. The value of QINPC 204 again after the branch destination instruction code is fetched
The value obtained by incrementing (= branch destination address) by INC 205 is loaded to CA bus 252 and fetched to CAA 212.
Fetching of the subsequent instruction at the branch destination address continues.

【0083】命令デコード部213 で JSR命令がデコード
されると、アドレス計算部215 は命令デコード部213 か
らAコード110 としてデコードした JSR命令の命令長を
受け取し、またPC演算部214 から JSR命令の先頭アドレ
スを受け取る。アドレス計算部215 は、JSR 命令の命令
長及び JSR命令の先頭アドレスから、 JSR命令の次命令
(リターン先命令) のアドレスを計算してAOバス254 に
ロードする。
When the JSR instruction is decoded by the instruction decoding unit 213, the address calculation unit 215 receives the instruction length of the JSR instruction decoded as the A code 110 from the instruction decoding unit 213, and the PC operation unit 214 outputs the JSR instruction Receive the start address. The address calculation unit 215 determines the next instruction of the JSR instruction from the instruction length of the JSR instruction and the start address of the JSR instruction.
Calculate the address of (return destination instruction) and load it to AO bus 254.

【0084】AOバス254 にロードされたリターン先アド
レスはFA 218に取り込まれる。また、命令デコード部21
3 からサブルーチンジャンプ命令(JSR) 検出信号286 を
受けて、FA 218に取り込まれたリターン先アドレスがRA
219に退避される。更に、JSR 検出信号286 を受けて検
出レジスタRC 216にはフラグがセットされる。以後、IF
ステージ101 がフェッチした分岐先命令に従って通常命
令の動作が続けられる。
The return destination address loaded on the AO bus 254 is fetched by the FA 218. Also, the instruction decoding unit 21
In response to the subroutine jump instruction (JSR) detection signal 286 from 3, the return address fetched by FA 218 is RA.
Evacuated to 219. Further, upon receiving the JSR detection signal 286, a flag is set in the detection register RC 216. After that, IF
The operation of the normal instruction continues according to the branch destination instruction fetched by the stage 101.

【0085】IFステージ101 で分岐先命令をたとえば5
命令フェッチしたとすると、INC 205 からフェッチカウ
ント制御信号290 が出力されて検出レジスタRC 216に与
えられる。RC 216では、フラグがセットされている場合
は、マイクロROM 217 にリターンフェッチ制御信号291
を出力した後にフラグをリセットする。マイクロROM217
では、リターンフェッチ制御信号291 を受けて、リタ
ーン先命令のフェッチ動作を開始する。
In the IF stage 101, the branch destination instruction is, for example, 5
If an instruction is fetched, the fetch count control signal 290 is output from the INC 205 and given to the detection register RC 216. For RC 216, if the flag is set, return fetch control signal 291 to Micro ROM 217.
Reset the flag after outputting. Micro ROM217
Then, in response to the return fetch control signal 291, the fetch operation of the return destination instruction is started.

【0086】即ち、マイクロROM 217 からリターンアド
レス制御信号292 を出力することによりRA 219に退避さ
せたリターン先アドレスがCAバス252 にロードされ、CA
A 212 の取り込み先レジスタがQINPC 204 の値からRA 2
19の値に切り換えられる。この際、QINPC 204 の値はそ
のまま保持された状態にしておき、リターン先アドレス
のフェッチ後に再び保持したQINPC 204 の値から命令の
フェッチが開始される。
That is, by outputting the return address control signal 292 from the micro ROM 217, the return destination address saved in the RA 219 is loaded on the CA bus 252,
A 212 capture destination register is changed from QINPC 204 value to RA 2
Switched to a value of 19. At this time, the value of QINPC 204 is kept as it is, and the instruction fetch is started from the value of QINPC 204 held again after fetching the return destination address.

【0087】AAバス258 にロードされたリターン先アド
レスに従って、外部からDDバス250にリターン先命令コ
ードがロードされてIIN 210 に取り込まれる。IIN 201
に取り込まれたリターン命令コードはマイクロROM 217
の制御により、SELCT 202 には取り込まれず、命令キャ
ッシュのデータメモリ210 に登録される。このデータメ
モリ210 への登録の際のエントリは、先のCAバス252 に
ロードされたリターン先アドレスを取り込んだタグレジ
スタ206 及びインデックスレジスタ207 の値を基にイン
デックスデコーダ208 によって指示されたエントリであ
る。命令キャッシュにリターン先命令コードが登録され
た後は、再びQINPC 204 の値がCAバスにロードされてCA
A 212 に取り込まれ、順次命令のフェッチが続けられ
る。
According to the return destination address loaded on the AA bus 258, the return destination instruction code is externally loaded onto the DD bus 250 and taken into the IIN 210. IIN 201
The return instruction code fetched in is micro ROM 217
Under the control of, the data is not captured in the SELCT 202 but registered in the data memory 210 of the instruction cache. The entry at the time of registration in the data memory 210 is an entry designated by the index decoder 208 based on the values of the tag register 206 and the index register 207 which have fetched the return destination address loaded in the previous CA bus 252. . After the return destination instruction code is registered in the instruction cache, the value of QINPC 204 is loaded to the CA bus again
It is fetched by A 212 and fetching of sequential instructions is continued.

【0088】最後に、本第2の発明のデータ処理装置で
リターンサブルーチン(RTS) 命令を処理する際の動作に
ついて説明する。QINPC 204 の値が順次INC 205 に従っ
てインクリメントされ、 RTS命令が外部からDDバス250
にロードされてIIN 201 に取り込まれる。通常の命令と
同様にSELCT 201 でIIN 201 側に入力が選択されて命令
キュー203 を経由して QINバス251 にロードされる。
Finally, the operation of processing the return subroutine (RTS) instruction in the data processor of the second invention will be described. The value of QINPC 204 is sequentially incremented according to INC 205 and the RTS instruction is externally applied to DD bus 250.
Loaded into and taken into IIN 201. Inputs are selected on the IIN 201 side by the SELCT 201 and loaded into the QIN bus 251 via the instruction queue 203 in the same manner as a normal instruction.

【0089】QINバス251 にロードされた RTS命令コー
ドは命令デコード部213 に取り込まれる。命令デコード
部213 では、 RTS命令をデコードすると、 RTS命令検出
信号293 をマイクロROM 217 へ出力する。マイクロROM
217 では、 RTS命令検出信号293 を受けてリターンアド
レス制御信号292 を出力することにより、RA 219に退避
されていたリターン先アドレスをCAバス252 にロードす
る。これ以降の動作は他のジャンプ命令(JSR命令等) と
同様である。即ち、CAバス252 にロードされたリターン
先アドレスはCAA 212,QINPC 204 及び命令キャッシュの
タグレジスタ206,インデックスレジスタ207 に取り込ま
れる。
The RTS instruction code loaded on the QIN bus 251 is fetched by the instruction decoding unit 213. When the instruction decoding unit 213 decodes the RTS instruction, it outputs the RTS instruction detection signal 293 to the micro ROM 217. Micro ROM
In 217, by receiving the RTS instruction detection signal 293 and outputting the return address control signal 292, the return destination address saved in the RA 219 is loaded into the CA bus 252. The subsequent operation is the same as other jump instructions (JSR instruction, etc.). That is, the return destination address loaded on the CA bus 252 is fetched into the CAA 212, QINPC 204, the tag register 206 and the index register 207 of the instruction cache.

【0090】命令キャッシュでは、タグレジスタ206 及
びインデックスレジスタ207 の値に従ってアドレスメモ
リが検索される。事前にリターン先の命令が登録されて
いるので命令キャッシュは必ずヒットし、エントリに対
応するデータメモリからリターン先命令コードがBOUT 2
11へ出力される。SELCT 202 では、命令キャッシュのヒ
ット信号を受けて、BOUT 211の命令コードを選択してバ
イパス281 を経由してQINバス251 にロードする。
In the instruction cache, the address memory is searched according to the values in the tag register 206 and index register 207. Since the return destination instruction is registered in advance, the instruction cache always hits, and the return destination instruction code is BOUT 2 from the data memory corresponding to the entry.
Output to 11. Upon receiving the hit signal from the instruction cache, the SELCT 202 selects the instruction code of BOUT 211 and loads it into the QIN bus 251 via the bypass 281.

【0091】以後、リターン先命令の後続命令は、QINP
C 204 のリターン先アドレスをINC205 でインクリメン
トした値がCAバス252 にロードされるので、これをCAA
212が取り込んでその値に従って順次フェッチが続けら
れる。
Thereafter, the succeeding instruction of the return destination instruction is QINP.
The value obtained by incrementing the return address of C 204 with INC 205 is loaded to CA bus 252.
212 is fetched and the fetch is sequentially continued according to the value.

【0092】以上に説明したように、本第2の発明で
は、リターン命令のリターン先アドレスを記憶すると共
にリターン先命令を内蔵キャッシュに登録しておくこと
により、リターン先アドレスの演算処理時間の削減及び
リターン命令からの高速な復帰が可能になり、効率良く
パイプライン処理を行なうことができる。
As described above, according to the second aspect of the present invention, the return destination address of the return instruction is stored and the return destination instruction is registered in the internal cache to reduce the calculation processing time of the return destination address. Also, high-speed return from a return instruction is possible, and pipeline processing can be performed efficiently.

【0093】次に、図5及び図6のブロック図にその各
パイプライン処理ステージの具体的な内部構成例が示さ
れている本発明の第3のデータ処理装置の発明について
説明する。なお、図5には主としてIFステージ01及びD
ステージ102 の内部構成が、図6には主としてAステー
ジ103,Fステージ106 及びEステージ107 の内部構成が
それぞれ示されており、また前述の第2の発明の説明で
参照した図3及び図4と同一の参照符号は同一又は相当
部分を示しており、それらに関する説明は省略する。
Next, the invention of the third data processing apparatus of the present invention will be described in which the concrete internal configuration examples of the respective pipeline processing stages are shown in the block diagrams of FIGS. 5 and 6. Note that FIG. 5 mainly shows IF stages 01 and D.
The internal structure of the stage 102, mainly the internal structures of the A stage 103, the F stage 106, and the E stage 107 are shown in FIG. 6, respectively, and FIGS. 3 and 4 referred to in the above description of the second invention. The same reference numerals as those in FIG. 2 denote the same or corresponding parts, and the description thereof will be omitted.

【0094】図6において、Fステージ106 の参照符号
301 はリターン先アドレスを複数記憶することが可能な
リターンアドレススタック(RAS) を、 302はRAS 301 に
書き込み先を指定する RAS書き込みポインタを、 303は
RAS 301 から読み出し先を指定する RAS読み出しポイン
タを、 304はDステージ102 の命令デコード部213 から
サブルーチンジャンプ命令(JSR) 検出信号286 を受けて
自身のカウント値をカウントアップする検出カウンタ(R
CC) をそれぞれ示す。
In FIG. 6, reference numeral of the F stage 106
301 is a return address stack (RAS) that can store multiple return destination addresses, 302 is a RAS write pointer that specifies the write destination in RAS 301, and 303 is
A RAS read pointer for designating a read destination from the RAS 301, a detection counter 304 for counting up its own count value 304 upon receiving a subroutine jump instruction (JSR) detection signal 286 from the instruction decoding unit 213 of the D stage 102.
CC) respectively.

【0095】以下に、本発明の第3の発明のデータ処理
装置において、サブルーチンジャンプ(JSR) 命令を処理
する際の動作について説明する。特に、第2のデータ処
理装置は複数のサブルーチンジャンプ命令を処理する場
合に有効である。但し、ジャンプ命令以外の通常命令の
動作は従来のデータ処理装置と同様であるため、説明を
省略する。
The operation of processing the subroutine jump (JSR) instruction in the data processor according to the third aspect of the present invention will be described below. In particular, the second data processing device is effective when processing a plurality of subroutine jump instructions. However, since the operations of the normal instructions other than the jump instruction are the same as those of the conventional data processing device, the description thereof will be omitted.

【0096】まず、CAA 212 が示すアドレスに従って外
部から JSR命令コードがDDバス250にロードされる。ロ
ードされた JSR命令コードはIIN 201 に取り込まれる。
IIN202 に取り込まれた JSR命令コードはSELCT 202 を
経由して命令キュー203 に記憶され、FIFO(First In Fi
rst Out)順に従って QINバス251 にロードされる。
First, the JSR instruction code is loaded onto the DD bus 250 from the outside according to the address indicated by the CAA 212. The loaded JSR opcode is captured in IIN 201.
The JSR instruction code fetched by IIN202 is stored in the instruction queue 203 via SELCT 202, and FIFO (First In Fi
rst Out) loaded onto QIN Bus 251 in order.

【0097】QINバス251 にロードされた JSR命令コー
ドは命令デコード部213 に取り込まれる。この命令コー
ドがデコードされた結果、PC制御信号284 として分岐変
位アドレス値283 をDISPバス253 から取り込むことが指
示される。PC演算部214 ではPC制御信号284 に従って分
岐変位アドレス値283 から分岐先アドレス287 を計算し
てCAバス252 にロードする。
The JSR instruction code loaded on the QIN bus 251 is fetched by the instruction decoding unit 213. As a result of decoding this instruction code, it is instructed to fetch the branch displacement address value 283 from the DISP bus 253 as the PC control signal 284. The PC calculation unit 214 calculates the branch destination address 287 from the branch displacement address value 283 according to the PC control signal 284 and loads it on the CA bus 252.

【0098】CAバス252 にロードされた分岐先アドレス
287 はCAA 212,QINPC 204 及び命令キャッシュのタグレ
ジスタ206,インデックスレジスタ207 に取り込まれる。
命令キャッシュでは、タグレジスタ206 及びインデック
スレジスタ207 の値に従って、アドレスメモリが検索さ
れる。命令キャッシュに既に登録されている場合は、そ
のエントリに対応するデータメモリから命令コードがBO
UT 211に出力され、SELCT 202 で命令キャッシュ側の命
令コードが選択され、バイパス281 を経由して QINバス
251 にロードされる。
Branch destination address loaded to CA bus 252
287 is loaded into the CAA 212, QINPC 204, and the tag register 206 and index register 207 of the instruction cache.
In the instruction cache, the address memory is searched according to the values of the tag register 206 and index register 207. If it is already registered in the instruction cache, the instruction code from the data memory corresponding to that entry is BO
It is output to UT 211, the instruction code on the instruction cache side is selected by SELCT 202, and the QIN bus is passed through bypass 281.
Loaded into the 251.

【0099】登録されていない場合は、CAA 212 からAA
バス258 にロードされた分岐先アドレスに従って、外部
メモリに分岐先命令コードがフェッチされ、これがDDバ
ス250 にロードされてIIN 201 に取り込まれる。SELCT
202 ではIIN 201 が選択されてバイパス281 を経由して
QINバス251 に分岐先命令コードがロードされる。
If not registered, CAA 212 to AA
According to the branch destination address loaded on the bus 258, the branch destination instruction code is fetched to the external memory, loaded on the DD bus 250 and fetched in the IIN 201. SELCT
In 202, IIN 201 is selected and via bypass 281
The branch instruction code is loaded into QIN bus 251.

【0100】分岐先命令コードのフェッチ後は再びQINP
C 204 の値 (=分岐先アドレス) をINC 205 でインクリ
メントした値がCAバス252 にロードされるので、これを
CAA212 が取り込んで分岐先アドレスの後続命令のフェ
ッチが続けられる。
QINP is executed again after fetching the branch destination instruction code.
The value of C204 (= branch destination address) incremented by INC205 is loaded to CA bus 252.
The CAA212 fetches and continues fetching subsequent instructions at the branch target address.

【0101】命令デコード部213 で JSR命令がデコード
されると、アドレス計算部215 は命令デコード部213 か
らAコード110 としてデコードした JSR命令の命令長を
受け取ると共に、PC演算部214 から JSR命令の先頭アド
レスを受け取る。そして、アドレス計算部215 は JSR命
令の命令長及び JSR命令の先頭アドレスから JSR命令の
次命令 (リターン先命令) アドレスを計算して、AOバス
254 にロードする。
When the JSR instruction is decoded by the instruction decoding unit 213, the address calculation unit 215 receives the instruction length of the JSR instruction decoded as the A code 110 from the instruction decoding unit 213 and the PC arithmetic unit 214 starts the JSR instruction at the beginning. Receive an address. Then, the address calculation unit 215 calculates the next instruction (return destination instruction) address of the JSR instruction from the instruction length of the JSR instruction and the start address of the JSR instruction, and
Load it on 254.

【0102】AOバス254 にロードされたリターン先アド
レスはFA 218に取り込まれる。また、RCC 304 はDステ
ージ102 の命令デコード部213 からサブルーチンジャン
プ命令(JSR) 検出信号286 を受けて自身のカウント値を
カウントアップする。一方、FA 218に取り込まれたリタ
ーン先アドレスは RAS書き込みポインタ302 の値に従っ
てRAS 301 に退避される。このRAS 書き込みポインタ30
2 はRCC 304 により制御されている。以後、IFステージ
101 がフェッチした分岐先命令に従って通常命令を処理
する動作が続けられる。
The return destination address loaded on the AO bus 254 is fetched by the FA 218. Further, the RCC 304 receives a subroutine jump instruction (JSR) detection signal 286 from the instruction decoding unit 213 of the D stage 102 and counts up its own count value. On the other hand, the return address fetched by the FA 218 is saved in the RAS 301 according to the value of the RAS write pointer 302. This RAS write pointer 30
2 is controlled by RCC 304. After that, IF stage
The operation of processing the normal instruction continues according to the branch destination instruction fetched by 101.

【0103】IFステージ101 で分岐先命令をたとえば5
命令フェッチしたとすると、INC 205 はフェッチカウン
ト制御信号290 を出力してRCC 304 に与える。RCC 304
ではカウント値が”0”でなければ、マイクロROM 217
へリターンフェッチ制御信号291 を出力する。マイクロ
ROM 217 では、リターンフェッチ制御信号291 を受け
て、リターン先命令のフェッチ動作を開始する。
In the IF stage 101, the branch destination instruction is, for example, 5
If an instruction is fetched, the INC 205 outputs the fetch count control signal 290 and supplies it to the RCC 304. RCC 304
Then, if the count value is not "0", the micro ROM 217
The return fetch control signal 291 is output to. micro
The ROM 217 receives the return fetch control signal 291 and starts the fetch operation of the return destination instruction.

【0104】即ち、マイクロROM 217 からリターンアド
レス制御信号292 を出力することにより、先にRAS 301
に退避されていたリターン先アドレスを RAS読み出しポ
インタ303 の値に従ってRAS 301 からCAバス252 にロー
ドする。但し、 RAS読み出しポインタ303 はRCC 304 で
制御されている。CAA 212 は取り込み先レジスタをQINP
C 204 の値からRAS 301 の値に切り換える。この際、QI
NPC 204 の値はそのまま保持された状態にしておき、リ
ターン先アドレスのフェッチ後に再び保持したQINPC 20
4 の値から命令のフェッチが開始される。
That is, by outputting the return address control signal 292 from the micro ROM 217, the RAS 301
The return destination address saved in is loaded from the RAS 301 to the CA bus 252 according to the value of the RAS read pointer 303. However, the RAS read pointer 303 is controlled by the RCC 304. CAA 212 sets the import destination register to QINP
Switch from the value of C 204 to the value of RAS 301. At this time, QI
The value of NPC 204 is kept as it is and QINPC 20 is held again after fetching the return destination address.
The instruction fetch starts from the value of 4.

【0105】AAバス258 にロードされたリターン先アド
レスに従って、外部からDDバス250にリターン先命令コ
ードがロードされてIIN 210 に取り込まれる。IIN 201
に取り込まれたリターン命令コードはマイクロROM 217
の制御により、SELCT 202 には取り込まれずに、命令キ
ャッシュのデータメモリ210 に登録される。このデータ
メモリ210 への登録の際のエントリは、先のCAバス252
にロードされたリターン先アドレスを取り込んだタグレ
ジスタ206 及びインデックスレジスタ207 の値を基にイ
ンデックスデコーダ208 によって指示されたエントリで
ある。
According to the return destination address loaded on the AA bus 258, the return destination instruction code is externally loaded onto the DD bus 250 and taken into the IIN 210. IIN 201
The return instruction code fetched in is micro ROM 217
Under the control of (1), it is registered in the data memory 210 of the instruction cache without being taken in by the SELCT 202. The entry at the time of registration in this data memory 210 is the above CA bus 252.
It is an entry designated by the index decoder 208 based on the values of the tag register 206 and the index register 207 that have fetched the return destination address loaded in the.

【0106】命令キャッシュにリターン先命令コードが
登録された後は、再びQINPC 204 の値がCAバスにロード
されるので、これをCAA 212 が取り込んで順次命令のフ
ェッチが続けられる。再び JSR命令が外部からDDバス25
0 にロードされると、通常の命令と同様にINN 201 に取
り込まれ、SELCT 202 を経て命令キュー203 に登録され
る。命令キューに登録された JSR命令コードはFIFO(Fir
st In First Out)順に従って QINバス251 にロードされ
る。
After the return destination instruction code is registered in the instruction cache, the value of QINPC 204 is loaded again to the CA bus, so that CAA 212 fetches this value and the fetching of sequential instructions is continued. The JSR instruction is again sent from outside on the DD bus 25.
When it is loaded to 0, it is fetched to INN 201 like a normal instruction, and is registered to instruction queue 203 via SELCT 202. The JSR instruction code registered in the instruction queue is FIFO (Fir
St In First Out) Loaded onto QIN Bus 251 according to order.

【0107】QINバス251 にロードされた JSR命令コー
ドは命令デコーダ213 に取り込まれる。この命令コード
がデコードされた結果、PC制御信号284 として分岐変位
アドレス値283 をDISPバス253 から取り込むことを指示
する。PC演算部214 では、PC制御信号284 に従って、分
岐変位アドレス値283 から分岐先アドレス287 を計算し
てCAバス252 にロードする。CAバス252 にロードされた
分岐先アドレス287 はCAA 212,QINPC 204 及び命令キャ
ッシュのタグレジスタ206,インデックスレジスタ207 に
取り込まれる。
The JSR instruction code loaded on the QIN bus 251 is fetched by the instruction decoder 213. As a result of this instruction code being decoded, it is instructed to fetch the branch displacement address value 283 as the PC control signal 284 from the DISP bus 253. The PC operation unit 214 calculates the branch destination address 287 from the branch displacement address value 283 according to the PC control signal 284 and loads it on the CA bus 252. The branch destination address 287 loaded on the CA bus 252 is fetched by the CAA 212, QINPC 204, the tag register 206, and the index register 207 of the instruction cache.

【0108】命令キャッシュではタグレジスタ206 及び
インデックスレジスタ207 の値に従ってアドレスメモリ
が検索される。命令キャッシュに既に登録されている場
合は、そのエントリに対応するデータメモリから命令コ
ードがBOUT 211に出力され、SELCT 202 で命令キャッシ
ュ側の命令コードが選択され、バイパス281 を経由して
QINバス251 にロードされる。
In the instruction cache, the address memory is searched according to the values of the tag register 206 and index register 207. If it is already registered in the instruction cache, the instruction code is output from the data memory corresponding to that entry to BOUT 211, the instruction code on the instruction cache side is selected by SELCT 202, and it is passed through bypass 281.
Loaded on QIN Bus 251.

【0109】登録されていない場合は、CAA 212 からAA
バス258 にロードされた分岐先アドレスに従って、外部
メモリに分岐先命令コードがフェッチされ、これがDDバ
ス250 にロードされてIIN 201 に取り込まれる。SELCT
202 ではIIN 201 を選択してバイパス281 を経由して Q
INバス251 に分岐先命令コードがロードされる。分岐先
命令コードのフェッチ後は再びQINPC 204 の値 (=分岐
先アドレス) をNC 205でインクリメントした値がCAバス
252 にロードされるので、これをCAA 212 が取り込んで
分岐先アドレスの後続命令のフェッチが続けられる。
If not registered, CAA 212 to AA
According to the branch destination address loaded on the bus 258, the branch destination instruction code is fetched to the external memory, loaded on the DD bus 250 and fetched in the IIN 201. SELCT
In 202, select IIN 201 and Q via bypass 281
The branch target instruction code is loaded into the IN bus 251. After fetching the branch destination instruction code, the value obtained by incrementing the value of QINPC 204 (= branch destination address) by NC 205 is the CA bus again.
It is loaded into 252, which CAA 212 fetches and continues fetching subsequent instructions at the branch target address.

【0110】命令デコード部213 で JSR命令が再度デコ
ードされると、アドレス計算部215は命令デコード部213
からAコード110 としてデコードした JSR命令の命令
長を受けると共に、PC演算部214 から JSR命令の先頭ア
ドレスを受ける。そして、アドレス計算部215 は JSR命
令の命令長及び JSR命令の先頭アドレスから JSR命令の
次命令 (リターン先命令) のアドレスを計算してAOバス
254 にロードする。
When the JSR instruction is decoded again by the instruction decoding unit 213, the address calculation unit 215 changes the instruction decoding unit 213.
From the A code 110, the instruction length of the JSR instruction is received, and the head address of the JSR instruction is received from the PC operation unit 214. Then, the address calculation unit 215 calculates the address of the next instruction (return destination instruction) of the JSR instruction from the instruction length of the JSR instruction and the start address of the JSR instruction to calculate the address of the AO bus.
Load it on 254.

【0111】AOバス254 にロードされたリターン先アド
レスはFA 218に取り込まれる。また、RCC 304 は命令デ
コード部213 からサブルーチンジャンプ命令(JSR) 検出
信号286 を受けて自身のカウント値をカウントアップす
る。この場合、2つの JSR命令をデコードしたのでカウ
ント値は”2”になる。一方、FA 218に取り込まれたリ
ターン先アドレスは RAS書き込みポインタ302 の値に従
ってRAS 301 に退避される。 RAS書き込みポインタ302
は検出カウンタ304 で制御されているため、ポインタは
1つ進んでいる。以後、IFステージ101 がフェッチした
分岐先命令に従って通常命令を処理する動作が続けられ
る。
The return destination address loaded on the AO bus 254 is fetched by the FA 218. Further, the RCC 304 receives the subroutine jump instruction (JSR) detection signal 286 from the instruction decoding unit 213 and counts up its own count value. In this case, the count value becomes "2" because two JSR instructions are decoded. On the other hand, the return address fetched by the FA 218 is saved in the RAS 301 according to the value of the RAS write pointer 302. RAS write pointer 302
Is controlled by the detection counter 304, so the pointer is advanced by one. After that, the operation of processing the normal instruction according to the branch destination instruction fetched by the IF stage 101 is continued.

【0112】IFステージ101 で分岐先命令をたとえば5
命令フェッチしたとすると、INC 205 からフェッチカウ
ント制御信号290 が出力されてRCC 304 に与えられる。
RCC304 では、カウント値が”0”でなければ、マイク
ロROM 217 へリターンフェッチ制御信号291 を出力す
る。マイクロROM 217 ではこのリターンフェッチ制御信
号291 を受けてリターン先命令のフェッチ動作を開始す
る。
In the IF stage 101, the branch destination instruction is, for example, 5
If an instruction is fetched, the fetch count control signal 290 is output from the INC 205 and given to the RCC 304.
If the count value is not "0", the RCC304 outputs the return fetch control signal 291 to the micro ROM 217. Upon receiving the return fetch control signal 291, the micro ROM 217 starts the fetch operation of the return destination instruction.

【0113】即ち、マイクロROM 217 からリターンアド
レス制御信号292 を出力することにより、先にRAS 301
に退避されていたリターン先アドレスを RAS読み出しポ
インタ303 の値に従ってRAS 301 からCAバス252 にロー
ドする。CAA 212 は取り込み先レジスタをQINPC 204 の
値からRAS 301 の値に切り換える。この際、QINPC 204
の値はそのまま保持された状態にしておき、リターン先
アドレスのフェッチ後に再び保持したQINPC 204 の値か
ら命令のフェッチを開始する。
That is, by outputting the return address control signal 292 from the micro ROM 217, the RAS 301
The return destination address saved in is loaded from the RAS 301 to the CA bus 252 according to the value of the RAS read pointer 303. The CAA 212 switches the capture destination register from the value of QINPC 204 to the value of RAS 301. At this time, QINPC 204
The value of is kept as it is, and the fetch of the instruction is started from the value of QINPC 204 held again after the return address is fetched.

【0114】AAバス258 にロードされたリターン先アド
レスに従って、外部からDDバス250にリターン先命令コ
ードがロードされIIN 210 に取り込まれる。IIN 201 に
取り込まれたリターン命令コードはマイクロROM 217 の
制御により、SELCT 202 には取り込まれずに、命令キャ
ッシュのデータメモリ210 に登録される。この際データ
メモリ210 に登録されるエントリは、先のCAバス252 に
ロードされたリターン先アドレスを取り込んだタグレジ
スタ206 及びインデックスレジスタ207 の値を基にイン
デックスデコーダ208 によって指示されたエントリであ
る。命令キャッシュにリターン先命令コードが登録され
た後は、再びQINPC 204 の値がCAバスにロードされるの
で、これをCAA 212 で取り込んで順次命令のフェッチが
続けられる。
According to the return destination address loaded on the AA bus 258, the return destination instruction code is externally loaded onto the DD bus 250 and taken into the IIN 210. The return instruction code fetched in the IIN 201 is registered in the data memory 210 of the instruction cache without being fetched in the SELCT 202 under the control of the micro ROM 217. At this time, the entry registered in the data memory 210 is the entry designated by the index decoder 208 based on the values of the tag register 206 and the index register 207 which have fetched the return destination address loaded in the previous CA bus 252. After the return-destination instruction code is registered in the instruction cache, the value of QINPC 204 is loaded again to the CA bus, so CAA 212 fetches it and continues fetching sequential instructions.

【0115】最後に、本発明の第3の発明のデータ処理
装置で、リターンサブルーチン(RTS) 命令を処理する際
の動作について説明する。QINPC 204 の値が順次INC 20
5 に従ってインクリメントされ、 RTS命令が外部からDD
バス250 にロードされてIIN 201 に取り込まれる。これ
らは通常の命令と同様にSELCT 201 でIIN 201 の入力が
選択されて命令キュー203 を経由して QINバス251 にロ
ードされる。
Finally, the operation of the data processor of the third invention of the present invention when processing a return subroutine (RTS) instruction will be described. The value of QINPC 204 is INC 20 sequentially
Incremented according to 5, RTS instruction externally DD
Loaded onto bus 250 and taken into IIN 201. These are loaded into the QIN bus 251 via the instruction queue 203 after the input of the IIN 201 is selected by the SELCT 201 in the same manner as a normal instruction.

【0116】QINバス251 にロードされた RTS命令コー
ドは命令デコード部213 に取り込まれる。命令デコード
部213 では RTS命令をデコードすると RTS命令検出信号
293をRCC 304 へ出力する。RCC 304 では、 RTS命令検
出信号293 が与えられると、カウント値をカウントダウ
ンし、マイクロROM 217 にリターンサブルーチン検出制
御信号294 を出力する。
The RTS instruction code loaded on the QIN bus 251 is fetched by the instruction decoding unit 213. When the RTS instruction is decoded in the instruction decoding unit 213, the RTS instruction detection signal
Output 293 to RCC 304. In the RCC 304, when the RTS instruction detection signal 293 is given, the count value is counted down and the return subroutine detection control signal 294 is output to the micro ROM 217.

【0117】マイクロROM 217 では RTS検出制御信号29
4 が与えられるとリターンアドレス制御信号292 を出力
することにより、先にRAS 301 に退避していたリターン
先アドレスを RAS読み出しポインタ303 に従ってCAバス
252 にロードする。 RAS読み出しポインタ303 は、最後
にリターン先アドレスをCAバス252 にロードした際のエ
ントリを保存しており、CAバス252 にリターン先アドレ
スをロードした後、RCC 304 に従ってエントリを変化さ
せる。
In the micro ROM 217, the RTS detection control signal 29
When 4 is given, the return address control signal 292 is output, and the return destination address previously saved in RAS 301 is transferred to the CA bus according to the RAS read pointer 303.
Load it on the 252. The RAS read pointer 303 stores the entry when the return destination address was last loaded into the CA bus 252, and after the return destination address is loaded into the CA bus 252, the entry is changed according to the RCC 304.

【0118】これ以降の動作は他のジャンプ命令(JSR命
令等) と同様である。即ち、CAバス252 にロードされた
リターン先アドレスはCAA 212,QINPC 204 及び命令キャ
ッシュのタグレジスタ206,インデックスレジスタ207 に
取り込まれる。命令キャッシュではタグレジスタ206 及
びインデックスレジスタ207 の値に従ってアドレスメモ
リが検索される。事前にリターン先の命令が登録されて
いるので命令キャッシュは必ずヒットし、エントリに対
応するデータメモリからリターン先命令コードがBOUT 2
11に出力される。SELCT 202 では命令キャッシュのヒッ
ト信号を受けてBOUT 211の命令コードを選択し、バイパ
ス281 を経由して QINバス251 にロードする。
The subsequent operation is similar to that of other jump instructions (JSR instruction etc.). That is, the return destination address loaded on the CA bus 252 is fetched into the CAA 212, QINPC 204, the tag register 206 and the index register 207 of the instruction cache. In the instruction cache, the address memory is searched according to the values of the tag register 206 and index register 207. Since the return destination instruction is registered in advance, the instruction cache always hits, and the return destination instruction code is BOUT 2 from the data memory corresponding to the entry.
It is output to 11. The SELCT 202 receives the hit signal of the instruction cache, selects the instruction code of BOUT 211, and loads it to the QIN bus 251 via the bypass 281.

【0119】以後、リターン先命令の後続命令は、QINP
C 204 のリターン先アドレスをINC205 でインクリメン
トした値がCAバス252 にロードされるので、これをCAA
212が取り込んでその値に従って順次フェッチが続けら
れる。
After that, the succeeding instruction of the return destination instruction is QINP.
The value obtained by incrementing the return address of C 204 with INC 205 is loaded to CA bus 252.
212 is fetched and the fetch is sequentially continued according to the value.

【0120】再度 RTS命令が外部からDDバス250 にロー
ドされてIIN 201 に取り込まれ、通常の命令と同様にSE
LCT 201 ではIIN 201 側に入力が選択され、命令キュー
203を経由して QINバス251 にロードされる。
Again, the RTS instruction is externally loaded onto the DD bus 250 and taken into the IIN 201, and the SE instruction is executed in the same way as a normal instruction.
In LCT 201, the input is selected on the IIN 201 side and the instruction queue
It is loaded onto QIN bus 251 via 203.

【0121】QINバス251 にロードされた RTS命令コー
ドは命令デコード部213 に取り込まれる。命令デコード
部213 では RTS命令をデコードすると RTS命令検出信号
293をRCC 304 へ出力する。RCC 304 では RTS命令検出
信号293 が与えられると自身のカウント値をカウントダ
ウンし、マイクロROM 217 にリターンサブルーチン検出
制御信号294 を出力する。
The RTS instruction code loaded on the QIN bus 251 is fetched by the instruction decoding unit 213. When the RTS instruction is decoded in the instruction decoding unit 213, the RTS instruction detection signal
Output 293 to RCC 304. The RCC 304 counts down its own count value when the RTS instruction detection signal 293 is given, and outputs the return subroutine detection control signal 294 to the micro ROM 217.

【0122】以下、先のリターンサブルーチンをデコー
ドした場合と同様な動作が行われる。以上に説明したよ
うに、本第3の発明のデータ処理装置では、サブルーチ
ンジャンプ命令をデコードする都度、リターン先アドレ
スを記憶すると共にリターン先命令を内蔵キャッシュに
登録しておくので、リターン先アドレスの演算処理時間
の削減及びリターン命令からの高速な復帰が可能にな
り、効率良くパイプライン処理を行なうことができる。
Thereafter, the same operation as in the case where the above return subroutine is decoded is performed. As described above, in the data processing device of the third aspect of the present invention, the return destination address is stored and registered in the internal cache every time the subroutine jump instruction is decoded. Since the arithmetic processing time can be reduced and the return instruction can be returned at high speed, the pipeline processing can be efficiently performed.

【0123】[0123]

【発明の効果】以上のように本発明の第1の発明のデー
タ処理装置によれば、サブルーチンジャンプ命令の実行
に際して、その命令のリターン先命令がプリフェッチさ
れて命令記憶手段に既に記憶されてい場合には他の命令
による置き換えが禁止されるので、リターンサブルーチ
ン命令の実行に際しては示度リターン先命令を外部から
フェッチする必要がなくなるため、処理効率が向上す
る。
As described above, according to the data processor of the first aspect of the present invention, when the subroutine jump instruction is executed, the return destination instruction of the instruction is prefetched and already stored in the instruction storing means. Since the replacement with another instruction is prohibited, it is not necessary to fetch the indicated return destination instruction from the outside when executing the return subroutine instruction, so that the processing efficiency is improved.

【0124】また本発明の第2,第3の発明のデータ処
理装置によれば、サブルーチンジャンプ命令の実行に際
して、リターン先アドレスが計算されて記憶されている
ため、リターンサブルーチン命令をフェッチしてデコー
ドしてからリターン先アドレスを計算する従来のデータ
処理装置に比してアドレス計算時間が削減されるので、
リターンサブルーチン命令からの高速な復帰が可能にな
る。
According to the data processor of the second and third aspects of the present invention, since the return destination address is calculated and stored when the subroutine jump instruction is executed, the return subroutine instruction is fetched and decoded. Since the address calculation time is reduced compared to the conventional data processing device that calculates the return address after that,
A fast return from a return subroutine instruction is possible.

【0125】また、従来のデータ処理装置のようにサブ
ルーチンジャンプ命令によるジャンプ先命令に後続する
命令をアドレス順にプリフェッチしてもリターンサブル
ーチン命令以降のアドレスの命令は無駄になる。そのた
め、分岐先命令をフェッチ後、必ず実行されるリターン
先命令をフェッチして内部キャッシュに予め登録してお
くことで無駄な命令のプリフェッチを削減し、リターン
サブルーチン命令からの高速な復帰を可能にしている。
Even if the instruction subsequent to the jump destination instruction by the subroutine jump instruction is prefetched in the address order as in the conventional data processing device, the instruction at the address after the return subroutine instruction is wasted. Therefore, after fetching the branch destination instruction, the return destination instruction that is always executed is fetched and pre-registered in the internal cache to reduce unnecessary prefetching of instructions and enable fast return from a return subroutine instruction. ing.

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

【図1】本発明の第1の発明のデータ処理装置の各パイ
プライン処理ステージの具体的な内部構成例を示すブロ
ック図である。
FIG. 1 is a block diagram showing a specific internal configuration example of each pipeline processing stage of a data processing device according to a first aspect of the present invention.

【図2】本発明の第1の発明のデータ処理装置の各パイ
プライン処理ステージの具体的な内部構成例を示すブロ
ック図である。
FIG. 2 is a block diagram showing a specific internal configuration example of each pipeline processing stage of the data processing device of the first invention of the present invention.

【図3】本発明の第2の発明のデータ処理装置の各パイ
プライン処理ステージの具体的な内部構成例を示すブロ
ック図である。
FIG. 3 is a block diagram showing a specific internal configuration example of each pipeline processing stage of the data processing device of the second invention of the present invention.

【図4】本発明の第2の発明のデータ処理装置の各パイ
プライン処理ステージの具体的な内部構成例を示すブロ
ック図である。
FIG. 4 is a block diagram showing a specific internal configuration example of each pipeline processing stage of the data processing device of the second invention of the present invention.

【図5】本発明の第3の発明のデータ処理装置の各パイ
プライン処理ステージの具体的な内部構成例を示すブロ
ック図である。
FIG. 5 is a block diagram showing a specific internal configuration example of each pipeline processing stage of the data processing device of the third invention of the present invention.

【図6】本発明の第3の発明のデータ処理装置の各パイ
プライン処理ステージの具体的な内部構成例を示すブロ
ック図である。
FIG. 6 is a block diagram showing a specific internal configuration example of each pipeline processing stage of the data processing device of the third invention of the present invention.

【図7】従来のマイクロプロセッサにおいて5段のパイ
プライン処理が行われる場合のパイプラインの各ステー
ジを示す模式図である。
FIG. 7 is a schematic diagram showing each stage of the pipeline when the pipeline processing of five stages is performed in the conventional microprocessor.

【図8】従来のデータ処理装置の各パイプライン処理ス
テージの具体的な内部構成例を示すブロック図である。
FIG. 8 is a block diagram showing a specific internal configuration example of each pipeline processing stage of a conventional data processing device.

【図9】従来のデータ処理装置の各パイプライン処理ス
テージの具体的な内部構成例を示すブロック図である。
FIG. 9 is a block diagram showing a specific internal configuration example of each pipeline processing stage of a conventional data processing device.

【符号の説明】 203 命令キュー 206 タグレジスタ 207 インデックスレジスタ 209 タグメモリ 210 データメモリ 213 命令デコード部 214 PC演算部 215 アドレス計算部 216 検出レジスタ 219 アドレス退避レジスタ 226 タグアドレス比較器 227 フリーズビット 301 アドレス退避レジスタ 302 RAS書き込みポインタ 303 RAS読み出しポインタ 304 検出カウンタ[Explanation of symbols] 203 Instruction queue 206 Tag register 207 Index register 209 Tag memory 210 Data memory 213 Instruction decoding unit 214 PC operation unit 215 Address calculation unit 216 Detection register 219 Address save register 226 Tag address comparator 227 Freeze bit 301 Address save Register 302 RAS write pointer 303 RAS read pointer 304 Detection counter

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 メインルーチンからサブルーチンへジャ
ンプするサブルーチンジャンプ命令を含む命令を外部か
らプリフェッチする命令フェッチ手段と、 該命令フェッチ手段がプリフェッチした複数の命令を記
憶する命令記憶手段と、 前記命令記憶手段に記憶されている命令を新たにプリフ
ェッチされた命令に置き換え制御する置き換え制御手段
と、 前記命令記憶手段に記憶されている命令を順次デコード
すると共に、サブルーチンジャンプ命令をデコードした
ことを検出する命令デコード手段と、 該命令デコード手段がサブルーチンジャンプ命令をデコ
ードした場合に、前記サブルーチンジャンプ命令のリタ
ーン先アドレスを計算するアドレス計算手段と、 前記命令デコード手段がサブルーチンジャンプ命令をデ
コードした場合に、前記アドレス計算手段が計算したリ
ターン先アドレスの命令が前記命令記憶手段に記憶され
ているか否かを検索する検索手段と、 該検索手段による検索の結果、前記アドレス計算手段が
計算したリターン先アドレスの命令が前記命令記憶手段
に記憶されていることが検出された場合に、当該命令の
前記置き換え制御手段による置き換えを禁じる置き換え
禁止手段とを備えたことを特徴とするデータ処理装置。
1. An instruction fetch means for prefetching an instruction including a subroutine jump instruction for jumping from a main routine to a subroutine from outside, an instruction storage means for storing a plurality of instructions prefetched by the instruction fetch means, and the instruction storage means. Replacement control means for controlling replacement of an instruction stored in the instruction with a newly prefetched instruction, and instruction decoding for sequentially decoding the instructions stored in the instruction storage means and detecting that a subroutine jump instruction has been decoded Means, address calculating means for calculating a return destination address of the subroutine jump instruction when the instruction decoding means decodes the subroutine jump instruction, and Search means for searching whether the instruction of the return address calculated by the dress calculation means is stored in the instruction storage means, and the instruction of the return address calculated by the address calculation means as a result of the search by the search means When it is detected that the instruction is stored in the instruction storage means, the data processing device is provided with a replacement prohibition means for prohibiting replacement of the instruction by the replacement control means.
【請求項2】 パイプライン処理機構により命令を処理
するデータ処理装置であって、 メインルーチンからサブルーチンへジャンプするサブル
ーチンジャンプ命令及びサブルーチンからメインルーチ
ンへリターンするリターンサブルーチン命令を含む命令
を外部からプリフェッチする命令フェッチ手段と、 命令を外部からプリフェッチする命令フェッチ手段と、 該命令フェッチ手段がプリフェッチした複数の命令を記
憶する命令記憶手段と、 前記命令記憶手段に記憶されている命令を順次デコード
すると共に、サブルーチンジャンプ命令及びリターンサ
ブルーチン命令をデコードしたことを検出する命令デコ
ード手段と、 前記命令デコード手段がサブルーチンジャンプ命令をデ
コードした場合に、前記サブルーチンジャンプ命令のリ
ターン先アドレスを計算するアドレス計算手段と、 該アドレス計算手段が計算したリターン先アドレスを記
憶するアドレス記憶手段とを備え、 前記命令デコード手段がサブルーチンジャンプ命令をデ
コードしたことを検出場合に、前記アドレス計算手段に
より計算されたリターン先アドレスを前記アドレス記憶
手段が記憶すると共に、前記命令フェッチ手段は前記ア
ドレス記憶手段に記憶されたリターン先アドレスの命令
を外部からフェッチして前記命令記憶手段に記憶させる
べくなしてあり、 前記命令デコード手段がリターンサブルーチン命令をデ
コードしたことを検出した場合に、前記アドレス記憶手
段に記憶されているリターン先アドレスが前記命令記憶
手段へ読み出され、対応するリターン先命令が前記命令
記憶手段から前記命令デコード手段へ出力されるべくな
してあることを特徴とするデータ処理装置。
2. A data processing device for processing an instruction by a pipeline processing mechanism, wherein an instruction including a subroutine jump instruction for jumping from a main routine to a subroutine and a return subroutine instruction for returning from the subroutine to the main routine is prefetched from the outside. Instruction fetch means, instruction fetch means for prefetching instructions from the outside, instruction storage means for storing a plurality of instructions prefetched by the instruction fetch means, and sequentially decoding the instructions stored in the instruction storage means, Subroutine jump instruction and return Instruction decoding means for detecting decoding of the subroutine instruction, and return of the subroutine jump instruction when the instruction decoding means decodes the subroutine jump instruction An address calculation means for calculating an address and an address storage means for storing the return destination address calculated by the address calculation means are provided, and when the instruction decoding means detects that the subroutine jump instruction is decoded, the address calculation means The address storage means stores the return destination address calculated by the above, and the instruction fetch means does not fetch the instruction of the return destination address stored in the address storage means from the outside and store it in the instruction storage means. When the instruction decoding unit detects that the return subroutine instruction has been decoded, the return destination address stored in the address storage unit is read to the instruction storage unit, and the corresponding return destination instruction is From the instruction storage means, the instruction decoding The data processing apparatus characterized by are none to be output to the unit.
【請求項3】 パイプライン処理機構により命令を処理
するデータ処理装置であって、 メインルーチンからサブルーチンへジャンプするサブル
ーチンジャンプ命令及びサブルーチンからメインルーチ
ンへリターンするリターンサブルーチン命令を含む命令
を外部からプリフェッチする命令フェッチ手段と、 命令を外部からプリフェッチする命令フェッチ手段と、 該命令フェッチ手段がプリフェッチした複数の命令を記
憶する命令記憶手段と、 前記命令記憶手段に記憶されている命令を順次デコード
すると共に、サブルーチンジャンプ命令及びリターンサ
ブルーチン命令をデコードしたことを検出する命令デコ
ード手段と、 前記命令デコード手段がサブルーチンジャンプ命令をデ
コードした場合に、前記サブルーチンジャンプ命令のリ
ターン先アドレスを計算するアドレス計算手段と、 該アドレス計算手段が計算したリターン先アドレスを複
数記憶するアドレス記憶手段と該アドレス記憶手段への
アドレスの書き込み順序を、前記命令デコード手段によ
るサブルーチンジャンプ命令の検出順序に従って制御す
る書き込み制御手段と、 前記アドレス記憶手段からのアドレスの読み出し順序
を、前記命令デコード手段によるサブルーチンジャンプ
命令の検出順序に従って制御する読み出し制御手段とを
備え、 前記命令デコード手段がサブルーチンジャンプ命令をデ
コードしたことを検出場合に、前記アドレス計算手段に
より計算されたリターン先アドレスを前記書き込み制御
手段の制御により前記アドレス記憶手段が記憶すると共
に、前記命令フェッチ手段は前記アドレス記憶手段に記
憶されたリターン先アドレスの命令を外部からフェッチ
して前記命令記憶手段に記憶させるべくなしてあり、 前記命令デコード手段がリターンサブルーチン命令をデ
コードしたことを検出した場合に、前記アドレス記憶手
段に記憶されているリターン先アドレスが前記読み出し
制御手段の制御に従って前記命令記憶手段へ読み出さ
れ、対応するリターン先命令が前記命令記憶手段から前
記命令デコード手段へ出力されるべくなしてあることを
特徴とするデータ処理装置。
3. A data processing device for processing an instruction by a pipeline processing mechanism, wherein an instruction including a subroutine jump instruction for jumping from a main routine to a subroutine and a return subroutine instruction for returning from the subroutine to the main routine is prefetched from the outside. Instruction fetch means, instruction fetch means for prefetching instructions from the outside, instruction storage means for storing a plurality of instructions prefetched by the instruction fetch means, and sequentially decoding the instructions stored in the instruction storage means, Subroutine jump instruction and return Instruction decoding means for detecting decoding of the subroutine instruction, and return of the subroutine jump instruction when the instruction decoding means decodes the subroutine jump instruction The address calculation means for calculating the address, the address storage means for storing a plurality of return destination addresses calculated by the address calculation means, and the order of writing the addresses to the address storage means are the order of detection of the subroutine jump instruction by the instruction decoding means. Write control means for controlling the address read means from the address storage means according to the detection order of the subroutine jump instruction by the instruction decoding means, and the instruction decoding means executes the subroutine jump instruction. When it is detected that the address has been decoded, the return destination address calculated by the address calculation means is stored in the address storage means under the control of the write control means, and the instruction fetch means is stored in the address storage means. The instruction of the stored return destination address is fetched from the outside and stored in the instruction storage means, and stored in the address storage means when the instruction decoding means detects that the return subroutine instruction is decoded. The return destination address is read out to the instruction storage means under the control of the read control means, and a corresponding return destination instruction is output from the instruction storage means to the instruction decoding means. Data processing device.
JP4342417A 1992-12-22 1992-12-22 Data processor Pending JPH06195219A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4342417A JPH06195219A (en) 1992-12-22 1992-12-22 Data processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4342417A JPH06195219A (en) 1992-12-22 1992-12-22 Data processor

Publications (1)

Publication Number Publication Date
JPH06195219A true JPH06195219A (en) 1994-07-15

Family

ID=18353572

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4342417A Pending JPH06195219A (en) 1992-12-22 1992-12-22 Data processor

Country Status (1)

Country Link
JP (1) JPH06195219A (en)

Similar Documents

Publication Publication Date Title
US6035387A (en) System for packing variable length instructions into fixed length blocks with indications of instruction beginning, ending, and offset within block
US5404552A (en) Pipeline risc processing unit with improved efficiency when handling data dependency
US5136696A (en) High-performance pipelined central processor for predicting the occurrence of executing single-cycle instructions and multicycle instructions
US4847753A (en) Pipelined computer
US5276882A (en) Subroutine return through branch history table
US7278012B2 (en) Method and apparatus for efficiently accessing first and second branch history tables to predict branch instructions
KR930004328B1 (en) Method and apparatus for executing instructions for a vector processing system
EP0375364A2 (en) Data processor with zero execution clock count for one or both of branch and compare instructions
JP2678527B2 (en) Cache memory device
US20040064683A1 (en) System and method for conditionally executing an instruction dependent on a previously existing condition
EP2220556B1 (en) A method and a system for accelerating procedure return sequences
KR101081674B1 (en) A system and method for using a working global history register
US20070266228A1 (en) Block-based branch target address cache
US6832305B2 (en) Method and apparatus for executing coprocessor instructions
US5761490A (en) Changing the meaning of a pre-decode bit in a cache memory depending on branch prediction mode
JP2000330787A (en) Computer system executing instruction loop and instruction loop executing method
US20040064684A1 (en) System and method for selectively updating pointers used in conditionally executed load/store with update instructions
JP2010501913A (en) Cache branch information associated with the last granularity of branch instructions in a variable length instruction set
JP3486690B2 (en) Pipeline processor
US7873818B2 (en) System and method for search area confined branch prediction
US5295248A (en) Branch control circuit
US5740391A (en) Preventing premature early exception signaling with special instruction encoding
JPH06195219A (en) Data processor
JPH10124312A (en) Central processor
JPH11345121A (en) Instruction extracting device for program control unit and method thereof