JPH0659888A - Information processing unit having branched history table - Google Patents

Information processing unit having branched history table

Info

Publication number
JPH0659888A
JPH0659888A JP4213853A JP21385392A JPH0659888A JP H0659888 A JPH0659888 A JP H0659888A JP 4213853 A JP4213853 A JP 4213853A JP 21385392 A JP21385392 A JP 21385392A JP H0659888 A JPH0659888 A JP H0659888A
Authority
JP
Japan
Prior art keywords
instruction
address
branch
subroutine
output
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP4213853A
Other languages
Japanese (ja)
Other versions
JP2929853B2 (en
Inventor
Noriaki Sakai
則彰 境
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP4213853A priority Critical patent/JP2929853B2/en
Publication of JPH0659888A publication Critical patent/JPH0659888A/en
Application granted granted Critical
Publication of JP2929853B2 publication Critical patent/JP2929853B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

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

Abstract

PURPOSE:To quicken branching for a restoration processing by indexing a branch history table with a value of a stack pointer as a key so as to use the branching history table. CONSTITUTION:An output of an instruction counter adder 232 for instruction advance fetch is selected at the time of the instruction advance fetch after an instruction counter represented by an instruction advance fetch instruction counter 231. The output of a selector 233 is fed to selectors 230, 240. The selector 230 is an input selector of the instruction advance fetch instruction counter 231 and selects either the initial value sent from an operation execution device or a revised value of the instruction fetch instruction counter 231 being an output of the selector 233. The selector 240 is a selector selecting an index address of a branching history table 24 and selects an output of a stack pointer 222 or an output of the selector 233. The output of the stack pointer 222 is selected at the time of the processing of a sub routine return instruction processing and instruction fetch address information being the output of the selector 233 is selected in the other case.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は分岐ヒストリテーブルを
有す情報処理装置に関し、特にサブルーチンの読み出
し、復帰について分岐ヒストリテーブルの登録、索引処
理に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an information processing apparatus having a branch history table, and more particularly to registering a branch history table and index processing for reading and returning a subroutine.

【0002】[0002]

【従来の技術】従来、この種の情報処理装置には分岐命
令を高速に処理するために分岐履歴テーブルを備えるも
のがある。分岐履歴テーブルについては「Branch predi
ctionstrategies and Branch Target Buffer Design」
J.K.F.Lee,A.J.Smitl IEEE
COMPUTER 1984 Janに説明されてい
る。また、サブルーチンの読み出し復帰命令を高速化す
る手法として、プロセッサ内に少容量のスタックを備え
るものがある。「先行ジャンプ処理の採用によりパイプ
ライン処理効率を高めた32ビットMPU GMICR
O/100」吉田他、日経エレクトロニクス1989.
7.10にPCスタックとして説明されている。
2. Description of the Related Art Conventionally, some information processing apparatuses of this type have a branch history table for processing branch instructions at high speed. For the branch history table, see "Branch predi
ctionstrategies and Branch Target Buffer Design ''
J. K. F. Lee, A .; J. Smitl IEEE
It is described in COMPUTER 1984 Jan. Further, as a method of accelerating the read / restore instruction of the subroutine, there is a method of providing a small capacity stack in the processor. "32-bit MPU GMICR with improved pipeline processing efficiency by adopting the preceding jump processing
O / 100 ”Yoshida et al., Nikkei Electronics 1989.
Described in 7.10 as a PC stack.

【0003】[0003]

【発明が解決しようとする課題】従来の分岐ヒストリテ
ーブルは、分岐命令の格納されていたアドレスとその分
岐命令の分岐先アドレスを対にして記憶するテーブルを
備え、命令読出し時に索引され分岐先アドレスの予測値
を出力する。ところがサブルーチンからの復帰命令はそ
のサブルーチンを読み出したサブルーチン読み出し命令
の次の命令に分岐する為、例えば数ヵ所より呼び出され
る共用サブルーチンからの復帰アドレスはいつも異なる
ことになり、過去の分岐履歴を利用する分岐ヒストリテ
ーブルは役立たなかった。
A conventional branch history table is provided with a table for storing an address in which a branch instruction is stored and a branch destination address of the branch instruction as a pair, and the table is indexed when the instruction is read. The predicted value of is output. However, since the return instruction from the subroutine branches to the instruction next to the subroutine read instruction that has read the subroutine, the return address from the shared subroutine called from several places will always be different, and the past branch history is used. The branch history table didn't help.

【0004】また、GMICRO/100のようにプロ
セッサ内に専用のPCスタックを設けてサブルーチンの
復帰処理を高速化しているものもある。しかし、サブル
ーチン復帰命令の高速化のためだけに専用のスタックを
用意する必要がある為ハードウェア(HW)量が増大す
る欠点がある。また、専用スタックのサイズよりネスト
の深いサブルーチン読み出しについては、有効でないと
いう欠点がある。
There is also a processor such as GMICRO / 100 in which a dedicated PC stack is provided in the processor to accelerate the return processing of the subroutine. However, there is a drawback that the amount of hardware (HW) increases because it is necessary to prepare a dedicated stack only for speeding up the subroutine return instruction. Further, there is a drawback that it is not effective for reading a subroutine having a deeper nest than the size of the dedicated stack.

【0005】[0005]

【課題を解決するための手段】本発明の情報処理装置
は、サブルーチンの使用を支援する機構として、スタッ
クポインタと、該スタックポインタを使用したサブルー
チン呼び出し命令及びサブルーチン復帰命令を含む命令
セットを備え、分岐命令のアドレスと該分岐命令の分岐
先アドレスを対にして記憶する分岐ヒストリテーブルを
有する情報処理装置において、上記サブルーチン呼び出
し命令、サブルーチン復帰命令を検出する命令デコード
手段と、該命令デコード手段の出力に応答して命令取り
出し番地と、前記スタックポインタの出力を切り換える
第一のセレクタ手段と命令実行に際して、実行中の命令
があらかじめ定められた分岐命令のときは該分岐命令が
格納されていた番地、また実行中の命令が前記サブルー
チン呼び出し命令のときは該サブルーチン呼び出し命令
によって更新されたスタックポインタの出力を選択する
第二のセレクタ手段と、前記分岐命令の分岐先番地と前
記サブルーチン呼び出し命令によるサブルーチン呼び出
しからの復帰番地を切り換える第三のセレクタ手段と、
前記第一のセレクタ手段の出力を索引キーとし、前記第
二のセクタ手段の出力を登録キー、前記第三のセレクタ
手段の出力を登録データとする前記分岐ヒストリテーブ
ル手段を有する。
An information processing apparatus of the present invention comprises a stack pointer and an instruction set including a subroutine call instruction and a subroutine return instruction using the stack pointer, as a mechanism for supporting the use of the subroutine. In an information processing apparatus having a branch history table that stores a branch instruction address and a branch destination address of the branch instruction as a pair, an instruction decoding means for detecting the subroutine call instruction and the subroutine return instruction, and an output of the instruction decoding means In response to the instruction fetch address, the first selector means for switching the output of the stack pointer and the instruction execution, when the instruction being executed is a predetermined branch instruction, the address where the branch instruction is stored, The instruction being executed is the same as the subroutine call instruction. Second selector means for selecting the output of the stack pointer updated by the subroutine call instruction, and third selector means for switching the branch destination address of the branch instruction and the return address from the subroutine call by the subroutine call instruction. When,
The branch history table means uses the output of the first selector means as an index key, the output of the second sector means as a registration key, and the output of the third selector means as registration data.

【0006】更に本発明の情報処理装置は、サブルーチ
ンの使用を支援する機構として、複数のスタックポイン
タと、現在有効なスタックポインタの番号を示すモード
情報と、該スタックポインタを使用したサブルーチン呼
び出し命令及びザブルーチン復帰命令を含む命令セット
を備え、分岐命令のアドレスと該分岐命令の分岐先アド
レスを対にして記憶する分岐ヒストリテーブルを有する
情報処理装置において、上記サブルーチン読み場し命
令、サブルーチン復帰命令を検出する命令デコード手段
と、該命令デコード手段の出力に応答して命令取り出し
番地と前記スタックポインタの出力を切り換える第一の
セレクタ手段と、前記モード情報に含まれるスタックポ
インタ番号を選択する第二のセレクタ手段と、命令実行
に際して実行中の命令があらかじめ定められた分岐命令
のときは該分岐命令が格納されていた番地、また実行中
の命令が前記サブルーチン読み出し命令のときは該サブ
ルーチン読み出し命令によって更新されたスタックポイ
ンタの出力を選択する第三のセレクタ手段と、該第三の
セレクタ手段で選択されたスタックポインタのスタック
ポインタ番号を選択する第四のセレクタ手段と、前記分
岐命令の分岐先番地と前記サブルーチン呼び出し命令に
よるサブルーチン読み出しからの復帰番地を切り換える
第五のセレクタ手段と、前記第一,第二のセレクタ手段
の出力を索引キーとし、前記第三,第四のセレクタ手段
の出力を登録キー、前記第五のセレクタ手段の出力を登
録データとする前記分岐ヒストリテーブル手段を有す
る。
Further, the information processing apparatus of the present invention, as a mechanism for supporting the use of a subroutine, a plurality of stack pointers, mode information indicating the number of the stack pointer currently valid, a subroutine call instruction using the stack pointer, and In the information processing device having an instruction set including a sub routine return instruction, and having a branch history table for storing a branch instruction address and a branch destination address of the branch instruction as a pair, the subroutine read instruction and the subroutine return instruction are detected. Instruction decoding means, first selector means for switching the instruction fetch address and the output of the stack pointer in response to the output of the instruction decoding means, and the second selector for selecting the stack pointer number included in the mode information. Means and lives being executed when executing instructions Is a predetermined branch instruction, the address in which the branch instruction was stored, and when the instruction being executed is the subroutine read instruction, the output of the stack pointer updated by the subroutine read instruction is selected. Selector means, a fourth selector means for selecting the stack pointer number of the stack pointer selected by the third selector means, a branch destination address of the branch instruction and a return address from the subroutine read by the subroutine call instruction. The output of the fifth and selector means for switching between the first and second selector means is an index key, the outputs of the third and fourth selector means are registration keys, and the output of the fifth selector means is registered. It has the branch history table means for data.

【0007】更に又、本発明の情報処理装置は、サブル
ーチンの使用を支援する機構として、専用のスタックポ
インタがなく、汎用レジスタを使用したサブルーチン読
み出し命令及びサブルーチン復帰命令を備え、分岐命令
のアドレスと該分岐命令の分岐先アドレスを対にして記
憶する分岐ヒストリテーブルを有する情報処理装置にお
いて、上記サブルーチン読み出し命令、及びサブルーチ
ン復帰命令を検出する命令デコード手段と、該命令デコ
ード手段の出力に応答して、命令取り出し番地と前記サ
ブルーチン復帰命令で生成された番地を切り換える第一
のセレクタ手段と、該番地の生成に際してスタックポイ
ンタの代りに使用された汎用レジスタのレジスタ番号を
選択する第二のセクタ手段と、命令実行に際して実行中
の命令があらかじめ定められた分岐命令のときは該分岐
命令が格納されていた番地、また実行中の命令が前記サ
ブルーチン読み出し命令のときは該サブルーチン読み出
し命令によりストアされる復帰番地を選択する第三のセ
レクタ手段と、前記サブルーチン読み出し命令でストア
番地生成に際してスタックポインタの代りに使用された
汎用レジスタのレジスタ番号を選択する第四のセレクタ
手段と、前記分岐命令の分岐先番地と前記サブルーチン
読み出し命令によりストアされる復帰番地を切り換える
第五のセレクタ手段と、前記第一,第二のセレクタ手段
の出力を索引キーとし、前記第三,第四のセレクタ手段
の出力を登録キー、前記第五のセレクタ手段の出力を登
録データとする前記分岐ヒストリテーブル手段を有す
る。
Furthermore, the information processing apparatus of the present invention is provided with a subroutine read instruction and a subroutine return instruction using a general-purpose register without using a dedicated stack pointer as a mechanism for supporting the use of the subroutine, and the address of the branch instruction. In an information processing device having a branch history table for storing a branch destination address of the branch instruction as a pair, in response to an output of the instruction decoding means for detecting the subroutine read instruction and the subroutine return instruction, and an output of the instruction decoding means. First selector means for switching the instruction fetch address and the address generated by the subroutine return instruction, and second sector means for selecting the register number of the general-purpose register used in place of the stack pointer when generating the address. When executing an instruction, the instruction being executed is Third selector means for selecting the address in which the branch instruction was stored when the branch instruction was determined, and the return address stored by the subroutine read instruction when the instruction being executed was the subroutine read instruction , Fourth selector means for selecting a register number of a general-purpose register used in place of a stack pointer in generating a store address by the subroutine read instruction, a branch destination address of the branch instruction, and a return stored by the subroutine read instruction The fifth selector means for switching addresses and the outputs of the first and second selector means are used as index keys, the outputs of the third and fourth selector means are used as registration keys, and the output of the fifth selector means is used as an index key. It has the branch history table means used as registration data.

【0008】[0008]

【実施例】次に本発明について図面を参照して説明す
る。図1は本発明の第1の実施例である分岐ヒストリテ
ーブルを有する情報処理装置を示す構成図である。第1
の実施例の情報処理装置は先行制御装置10と記憶制御
装置11と演算実行装置12とを有している。先行制御
装置10は命令読み出し動作において、信号線1を介し
て命令先取りアドレスおよび読出しアクセス要求を記憶
制御装置11に出力する。このアドレスおよびアクセス
要求に応答して記憶制御装置11はバッファ記憶もしく
は主記憶から命令を読出し、信号線3を介して先行制御
装置10に送出する。先行制御装置10は命令を解読
し、その命令がメモリからオペランドを読み出す必要が
あればオペランドアドレスを生成し、信号線1を介して
オペランドアドレスおよび読み出しアクセス要求を記憶
制御装置11に出力する。このアドレスおよびアクセス
要求に応答して記憶制御装置11はバッファ記憶もしく
は主記憶からオペランドを読み出し、信号線4を介して
演算実行装置12に送出する。先行制御装置10は命令
を解読したデコード情報,生成したアドレス等を信号線
5を介して演算実行装置12に送る。このデコード情報
により指示された演算の演算結果が、演算実行装置12
から信号線6,7を介して先行制御装置10および記憶
制御装置11に送られアドレス計算用汎用レジスタや記
憶装置の内容が更新される。
The present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing an information processing apparatus having a branch history table which is a first embodiment of the present invention. First
The information processing apparatus of this embodiment has a preceding control apparatus 10, a storage control apparatus 11, and a calculation execution apparatus 12. In the instruction read operation, the preceding control device 10 outputs the instruction prefetch address and the read access request to the storage control device 11 via the signal line 1. In response to this address and the access request, the storage control device 11 reads an instruction from the buffer storage or the main storage and sends it to the preceding control device 10 via the signal line 3. The preceding control device 10 decodes the instruction, generates an operand address if the instruction needs to read an operand from the memory, and outputs the operand address and the read access request to the storage control device 11 via the signal line 1. In response to the address and the access request, the storage control device 11 reads out the operand from the buffer storage or the main storage and sends it to the operation execution device 12 via the signal line 4. The preceding control device 10 sends the decode information obtained by decoding the instruction, the generated address and the like to the arithmetic execution device 12 via the signal line 5. The operation result of the operation instructed by the decode information is the operation execution device 12
Is sent to the preceding control device 10 and the storage control device 11 via the signal lines 6 and 7, and the contents of the general-purpose address calculation register and the storage device are updated.

【0009】図2は先行制御装置10の内部構成の一部
を示している。記憶制御装置より信号線L201を介し
て送られる命令は命令レジスタ201に設定される。こ
の命令は命令デコード202により解読される。ここで
出力される命令解読情報は、レジスタ203に設定され
るとともに先行制御装置10内に含まれるレジスタ、セ
レクタ等の制御にも使用される。レジスタ203に設定
された命令解読情報は演算実行装置12に信号線L20
8を介して送られる。命令デコード202により解読し
た結果、アドレス生成が必要な命令については、汎用レ
ジスタファイル205よりページアドレス,インテック
スアドレスを読み出し、命令により直接指定されるディ
スプレースメントと共に、これらの値がレジスタ206
〜208に設定される。さらに、レジスタ206〜20
8の出力はアドレス加算器209で加算され、オペラン
ドアドレス,分岐アドレスとして使用される。アドレス
加算器209の出力は信号線L210を介して演算実行
装置に送出されると共に、セレクタ210,233にも
送られる。セレクタ210はオペランドアドレス等を選
択するセレクタであり、アドレス加算器209、スタッ
クポインタ222の出力を切り換えて、信号線L206
を介して記憶制御装置11にアドレス情報を供給する。
FIG. 2 shows a part of the internal configuration of the advance control apparatus 10. The instruction sent from the storage controller via the signal line L201 is set in the instruction register 201. This instruction is decoded by the instruction decode 202. The instruction decoding information output here is set in the register 203 and also used for controlling the registers, selectors, etc. included in the preceding control device 10. The instruction decoding information set in the register 203 is sent to the arithmetic execution unit 12 via the signal line L20.
Sent via 8. As a result of decoding by the instruction decode 202, for an instruction that requires address generation, the page address and the intex address are read from the general-purpose register file 205, and these values are stored in the register 206 together with the displacement directly specified by the instruction.
Is set to 208. Furthermore, registers 206 to 20
The outputs of 8 are added by the address adder 209 and used as an operand address and a branch address. The output of the address adder 209 is sent to the arithmetic execution unit through the signal line L210 and also to the selectors 210 and 233. The selector 210 is a selector that selects an operand address or the like, and switches the outputs of the address adder 209 and the stack pointer 222 to change the signal line L206.
The address information is supplied to the storage control device 11 via the.

【0010】セレクタ233は命令読み出しアドレス等
を選択するセレクタであり、アドレス加算器209、レ
ジスタ244、命令先取り用命令カウンタ加算器232
の出力を切り換えて、信号線L207を介して記憶制御
装置11にアドレス情報を供給する。アドレス加算器2
09の出力は分岐命令処理に際して分岐先アドレス生成
時に選択される。また、レジスタ244の出力は分岐ヒ
ストリテーブルを索引した結果、ヒット信号が出力した
ときに選択される。命令先取り用命令カウンタ加算器2
32の出力は命令先取り用命令カウンタ231が示す命
令カウンタの後の命令先取り時に選択される。セレクタ
233の出力はセレクタ230,240に送られる。セ
レクタ230は命令先取り用命令カウンタ231の入力
セレクタであり、演算実行装置12より送られる初期値
とセレクタ233の出力である命令先取り用命令カウン
タ231の更新値が選択される。セレクタ240は、分
岐ヒストリテーブル242の索引アドレスを選択するセ
レクタであり、スタックポインタ222の出力と、セレ
クタ233の出力を選択する。スタックポインタ222
の出力は、サブルーチン復帰命令処理時に選択され、そ
れ以外はセレクタ233の出力である命令先取りアドレ
ス情報が選択される。
The selector 233 is a selector for selecting an instruction read address and the like, and includes an address adder 209, a register 244, and an instruction prefetch instruction counter adder 232.
Output is switched and address information is supplied to the storage control device 11 via the signal line L207. Address adder 2
The output of 09 is selected when the branch destination address is generated in the branch instruction processing. The output of the register 244 is selected when a hit signal is output as a result of indexing the branch history table. Instruction prefetch instruction counter adder 2
The output of 32 is selected at the time of instruction prefetch after the instruction counter indicated by the instruction prefetch instruction counter 231. The output of the selector 233 is sent to the selectors 230 and 240. The selector 230 is an input selector of the instruction prefetch instruction counter 231, and selects the initial value sent from the arithmetic execution unit 12 and the updated value of the instruction prefetch instruction counter 231 output from the selector 233. The selector 240 is a selector that selects the index address of the branch history table 242, and selects the output of the stack pointer 222 and the output of the selector 233. Stack pointer 222
Is selected at the time of processing of a subroutine return instruction, and otherwise, the instruction prefetch address information output from the selector 233 is selected.

【0011】分岐ヒストリテーブル242を索引した結
果、ヒット情報と予測アドレスがそれぞれ読み出され、
フラグ243、レジスタ244に設定される。フラグ2
43の出力は分岐ヒストリテーブルのヒット情報とし
て、セレクタ233の選択指示として使用される。また
演算実行装置12より信号線L203,L205を介し
て分岐ヒストリテーブル242への登録アドレスと登録
データが送られる。スタックポインタ222はサブルー
チン読み出し命令処理時、またはサブルーチン復帰命令
処理時に加減算器221により更新される。本実施例で
はサブルーチン読み出し命令処理時に−4,サブルーチ
ン復帰命令処理時に+4の操作がおこなわれるとする。
但し、加減算が逆になっても同様である。セレクタ22
0はスタックポインタ222の入力セレクタであり、演
算実行装置12おり送られる初期値と加減算器221の
出力であるスタックポインタ222の更新値が選択され
る。
As a result of indexing the branch history table 242, hit information and predicted address are read out,
It is set in the flag 243 and the register 244. Flag 2
The output of 43 is used as hit information of the branch history table and as a selection instruction of the selector 233. Further, the registration address and registration data to the branch history table 242 are sent from the arithmetic execution unit 12 via the signal lines L203 and L205. The stack pointer 222 is updated by the adder / subtractor 221 during processing of a subroutine read instruction or during processing of a subroutine return instruction. In the present embodiment, it is assumed that the operation of -4 is performed when the subroutine read instruction is processed, and the operation of +4 is performed when the subroutine return instruction is processed.
However, the same applies even when the addition and subtraction are reversed. Selector 22
Reference numeral 0 is an input selector of the stack pointer 222, and the initial value sent to the arithmetic execution unit 12 and the updated value of the stack pointer 222 output from the adder / subtractor 221 are selected.

【0012】図3は演算実行装置12の内部構造に一部
を示している。先行制御装置10より信号線L208,
L210を介して送られる命令解読情報、アドレス情報
は信号線L301,,L303を介して命令解読情報キ
ュー301,アドレスキュー302でバッファされる。
命令カウンタ306は演算実行装置12にて処理中の命
令が格納されていたアドレスを示す。加算器307は命
令カウンタ306が次の命令を指示するように命令長文
の加算をおこなうために使用される。セレクタ305
は、命令カウンタの入力セレクタでアドレスキュー30
2,信号線L304を介したALUの出力、加算器30
7の出力を選択する。アドレスキュー302の出力は、
分岐命令処理に際して分岐がおこなわれたときに選択さ
れる。ALUの出力は初期値設定時に選択される。その
他は加算器307が選択される。スタックポインタ30
9はスタックポインタ222と同様な処理が実施される
が、そのタイミングが異なる。スタックポインタ222
は、サブルーチン読み出し命令やサブルーチン復帰命令
をデコード後、アドレス生成のタイミングで更新される
がスタックポインタ309は演算実行装置12におい
て、サブルーチン読み出し命令やサブルーチン復帰命令
の処理完了のタイミングで更新される。加減算器311
はスタックポインタ309の更新データの生成に使用さ
れる。セレクタ308はALUより初期値を設定する際
に、ALUを選択する様に切り換えられる。レジスタ3
22〜324は演算実行装置12において、処理が完了
するタイミングに処理が完了した命令の格納されていた
命令カウンタ306の値、アドレスキュー302より出
力される分岐先命令アドレス更新前のスタックポインタ
309の値が設定される。セレクタ325,327は分
岐ヒストリテーブルへの登録アドレス,データを選択に
使用される。その出力は信号線L306,L307を介
して先行制御装置10に送られ、先行制御装置10の信
号線L203,L205を介して分岐ヒストリテーブル
へ登録される。分岐命令処理に際してはレジスタ32
2,323が選択され、信号線L306,L307に出
力される。すなわち、分岐命令が格納されていたアドレ
スと、その分岐命令の分岐先アドレスが分岐ヒストリテ
ーブルに登録されることになる。サブルーチン読み出し
命令処理に関しては、まず、レジスタ322,323が
選択され信号線L306,L307に出力される。すな
わち、サブルーチン読み出し命令が格納されていたアド
レスとそのサブルーチン読み出し命令のサブルーチン入
口アドレスが分岐ヒストリテーブルに登録される。次
に、レジスタ324、加算器326が選択され信号線L
306,L307に出力される。すなわち、サブルーチ
ン読み出し時のスタックポインタの値と、サフルーチン
復帰アドレスが分岐ヒストリテーブルに登録される。加
算器326はサブルーチン復帰アドレスを算出すための
加算器である。本実施例では、サブルーチン読み出し命
令の命令長を4バイトと仮定しているため+4加算器に
なっている。図11に分岐命令の分岐動作を示す。A番
地の分岐命令(BRA)によって、B番地に分岐するこ
のとき分岐ヒストリテーブルには、A番地とB番地が組
で登録される。図12にサブルーチン呼び出し/復帰の
動作を示す。A番地のサブルーチン読み出し命令(JS
R)はE番地を入口番地とするサブルーチンを呼び出
す。同時に、スタックポインタが更新される。このとき
器ヒストリテーブルには、A番地とE番地,SP番地と
B番地がそれぞれ組で登録される。本実施例では、A番
地とE番地,SP番地とB番地の順に登録するが、この
順はどちらを先にすることもできる。
FIG. 3 shows a part of the internal structure of the arithmetic execution unit 12. The signal line L208 from the preceding control device 10,
The instruction decode information and address information sent via L210 are buffered in the instruction decode information queue 301 and address queue 302 via signal lines L301, L303.
The instruction counter 306 indicates the address where the instruction being processed by the arithmetic execution unit 12 was stored. The adder 307 is used to add the instruction length sentence so that the instruction counter 306 indicates the next instruction. Selector 305
Is the input selector of the instruction counter and is the address queue 30
2, output of ALU via signal line L304, adder 30
7 output is selected. The output of the address queue 302 is
This is selected when a branch is taken in processing a branch instruction. The output of the ALU is selected when the initial value is set. In other cases, the adder 307 is selected. Stack pointer 30
9 performs the same process as the stack pointer 222, but the timing is different. Stack pointer 222
Is updated at the timing of address generation after decoding the subroutine read instruction and the subroutine return instruction, but the stack pointer 309 is updated at the timing of the processing completion of the subroutine read instruction and the subroutine return instruction in the arithmetic execution unit 12. Adder / subtractor 311
Is used to generate update data for the stack pointer 309. The selector 308 is switched to select the ALU when setting the initial value from the ALU. Register 3
22 to 324 are the values of the instruction counter 306 in which the processed instruction is stored at the timing when the processing is completed, and the stack pointer 309 before updating the branch destination instruction address output from the address queue 302 in the arithmetic execution unit 12. The value is set. The selectors 325 and 327 are used to select the registered address and data in the branch history table. The output is sent to the preceding control device 10 via the signal lines L306 and L307, and registered in the branch history table via the signal lines L203 and L205 of the preceding control device 10. Register 32 for processing branch instructions
2, 323 are selected and output to the signal lines L306 and L307. That is, the address in which the branch instruction was stored and the branch destination address of the branch instruction are registered in the branch history table. Regarding the subroutine read instruction processing, first, the registers 322 and 323 are selected and output to the signal lines L306 and L307. That is, the address where the subroutine read instruction is stored and the subroutine entry address of the subroutine read instruction are registered in the branch history table. Next, the register 324 and the adder 326 are selected and the signal line L
It is output to 306 and L307. That is, the value of the stack pointer at the time of reading out the subroutine and the sufficient return address are registered in the branch history table. The adder 326 is an adder for calculating a subroutine return address. In this embodiment, since the instruction length of the subroutine read instruction is assumed to be 4 bytes, it is a +4 adder. FIG. 11 shows the branch operation of the branch instruction. Branch to address B by the branch instruction (BRA) at address A. At this time, address A and address B are registered as a set in the branch history table. FIG. 12 shows the subroutine calling / returning operation. Subroutine read instruction at address A (JS
R) calls a subroutine having the E address as the entrance address. At the same time, the stack pointer is updated. At this time, the address A and the address E, and the address SP and the address B are registered in pairs in the container history table. In this embodiment, addresses A and E, SP addresses and B addresses are registered in this order, but this order may be registered first.

【0013】図4は分岐ヒストリテーブル242の内部
構成の一部を示している。分岐ヒストリテーブルのキー
部402は3つのデータフィールドで構成される。ま
た、データ部403は1つのデータフィールドで構成さ
れる。分岐命令処理における登録で生成された分岐命令
エントリでは、有効ビット(V)、分岐命令表示ビット
(B)、分岐命令アドレス部の3つのデータフィールド
がキー部に分岐先命令アドレス部がデータ部に登録され
る。サブルーチン読み出し命令のアドレスとサブルーチ
ン入口アドレスを登録する場合も、分岐命令と同様にあ
つかう。一方、スタックポインタとサブルーチン復帰ア
ドレスを登録により生成された分岐命令エントリでは、
有効ビット(V)、分岐命令表示ビット(B)、スタッ
クポインタ部の3つのデータフィールドがキー部に、復
帰先命令アドレス部がデータ部に登録される。このとき
は分岐命令表示ビット(B)は、非表示を示す値(Ba
rB)が設定される。登録には信号線L203,L20
5を介して、演算実行装置から送られるデータを使用す
る。セレクタ401は登録時信号線L203を選択す
る。索引時には、索引アドレスがセレクタ240より送
られるので、セレクタ401はセレクタ240を選択す
る。分岐ヒストリテーブルキー部402より読み出され
た有効ビット、分岐命令表示ビット、分岐命令アドレス
部、又はスタックポインタ部を比較器404,405お
よびアンドゲート406に入力する。分岐命令アドレス
部、又はクタックポインタ部はセレクタ401の出力と
比較される。また、分岐命令表示ビットは索引情報と比
較される。索引情報は、セレクタ240がスタックポイ
ンタの出力を選択したとき、すなわちサブルーチン復帰
命令の処理に際して分岐ヒストリテーブルを索引すると
きは、非表示を示す値(BarB)となりそれ以外の場
合は分岐命令表示を示す値(B)となる。比較器40
4,405の出力はそれぞれアンドゲート406に入力
され、さらに索引エントリの有効ビット、分岐ヒストリ
テーブルの索引指示とアンドされヒット情報が出力され
る。このヒット情報は、ヒットフラグ243に設定され
る。また、同じエントリのデータ部はレジスタ244に
格納され、予測先命令取り出しに利用される。分岐ヒス
トリテーブルの索引指示はあらかじめ定められた命令の
処理時命令デコーダの出力より生成される信号である。
FIG. 4 shows a part of the internal structure of the branch history table 242. The key portion 402 of the branch history table is composed of three data fields. The data section 403 is composed of one data field. In a branch instruction entry generated by registration in branch instruction processing, three data fields of a valid bit (V), a branch instruction display bit (B), and a branch instruction address part are key parts, and a branch destination instruction address part is a data part. be registered. The address of the subroutine read instruction and the subroutine entry address are registered in the same manner as the branch instruction. On the other hand, in the branch instruction entry generated by registering the stack pointer and the subroutine return address,
Three data fields of a valid bit (V), a branch instruction display bit (B), and a stack pointer portion are registered in the key portion, and a return destination instruction address portion is registered in the data portion. At this time, the branch instruction display bit (B) has a value (Ba) indicating non-display.
rB) is set. Signal lines L203 and L20 are used for registration.
The data sent from the arithmetic execution unit via 5 is used. The selector 401 selects the signal line L203 during registration. At the time of indexing, since the index address is sent from the selector 240, the selector 401 selects the selector 240. The valid bit, the branch instruction display bit, the branch instruction address section, or the stack pointer section read from the branch history table key section 402 is input to the comparators 404 and 405 and the AND gate 406. The branch instruction address part or the tuck pointer part is compared with the output of the selector 401. Also, the branch instruction indication bit is compared with the index information. The index information is a value (BarB) indicating non-display when the selector 240 selects the output of the stack pointer, that is, when the branch history table is indexed when the subroutine return instruction is processed, and otherwise displays the branch instruction display. It becomes the indicated value (B). Comparator 40
Outputs 4 and 405 are respectively input to the AND gate 406, and are ANDed with the valid bit of the index entry and the index instruction of the branch history table, and the hit information is output. This hit information is set in the hit flag 243. Further, the data part of the same entry is stored in the register 244 and used for fetching the prediction destination instruction. The index instruction of the branch history table is a signal generated from the output of the instruction decoder when processing a predetermined instruction.

【0014】本発明の第2の実施例である分岐ヒストリ
テーブルを有する情報処理装置は、第1の実施例と同じ
構成で、図1に示すように第2の実施例の情報処理装置
は先行制御装置10と記憶制御装置11と演算実行装置
12とを有している。
An information processing apparatus having a branch history table according to the second embodiment of the present invention has the same configuration as that of the first embodiment. As shown in FIG. It has a control device 10, a storage control device 11, and a calculation execution device 12.

【0015】図5は第2の実施例における先行制御装置
10の内部構成の一部を示している。記憶制御装置より
信号線L501を介して送られる命令は命令レジスタ5
01に設定される。この命令は命令デコード502によ
り解読される。ここで出力される命令解読情報は、レジ
スタ503に設定されるとともに先行制御装置10内に
含まれるレジスタ、セレクタ等の制御にも使用される。
レジスタ503に設定された命令解読情報は演算実行装
置12に信号線L508を介して送られる。命令デコー
ド502により解読した結果、アドレス生成が必要な命
令については、汎用レジスタファイル505よりページ
アドレス,インテックスアドレスを読み出し、命令によ
り直接指定されるディスプレースメントと共に、これら
の値がレジスタ506〜508に設定される。さらに、
レジスタ506〜508の出力はアドレス加算器509
で加算され、オペランドアドレス,分岐アドレスとして
使用される。アドレス加算器509の出力は信号線L5
10を介して演算実行装置に送出されると共に、セレク
タ510,533にも送られる。セレクタ510はオペ
ランドアドレス等を選択するセレクタであり、アドレス
加算器509、スタックポインタ522,523の出力
を切り換えて、信号線L506を介して記憶制御装置1
1にアドレス情報を供給する。セレクタ533は命令読
み出しアドレス等を選択するセレクタであり、アドレス
加算器509、レジスタ544、命令先取り用命令カウ
ンタ加算器532の出力を切り換えて、信号線L507
を介して記憶制御装置11にアドレス情報を供給する。
アドレス加算器509の出力は分岐命令処理に際して分
岐先アドレス生成時に選択される。また、レジスタ54
4の出力は分岐ヒストリテーブルを索引した結果、ヒッ
ト信号が出力したときに選択される。命令先取り用命令
カウンタ加算器532の出力は命令先取り用命令カウン
タ531が示す命令カウンタの後の命令先取り時に選択
される。セレクタ533の出力はセレクタ530,54
0に送られる。セレクタ530は命令先取り用命令カウ
ンタ531の入力セレクタであり、演算実行装置12よ
り送られる初期値とセレクタ533の出力である命令先
取り用命令カウンタ531の更新値が選択される。セレ
クタ540は、分岐ヒストリテーブル542の索引アド
レスを選択するセレクタであり、スタックポインタ52
2の出力と、セレクタ533の出力を選択する。スタッ
クポインタ522,523の出力は、サブルーチン復帰
命令処理時に選択され、それ以外はセレクタ533の出
力である命令先取りアドレス情報が選択される。分岐ヒ
ストリテーブル542を索引した結果、ヒット情報と予
測アドレスがそれぞれ読み出され、フラグ543、レジ
スタ544に設定される。フラグ543の出力は分岐ヒ
ストリテーブルのヒット情報として、セレクタ533の
選択指示として使用される。また演算実行装置12より
信号線L503,L505を介して分岐ヒストリテーブ
ル542への登録アドレスと登録データが送られる。ス
タックポインタ522はサブルーチン読み出し命令処理
時、またはサブルーチン復帰命令処理時に加減算器52
1により更新される。本実施例ではサブルーチン読み出
し命令処理時に−4,サブルーチン復帰命令処理時に+
4の操作がおこなわれるとする。但し、加減算が逆にな
っても同様である。セレクタ520はスタックポインタ
522の入力セレクタであり、演算実行装置12おり送
られる初期値と加減算器521の出力であるスタックポ
インタ522の更新値が選択される。
FIG. 5 shows a part of the internal configuration of the advance control apparatus 10 according to the second embodiment. The instruction sent from the storage controller via the signal line L501 is the instruction register 5
It is set to 01. This instruction is decoded by the instruction decode 502. The instruction decoding information output here is set in the register 503 and is also used for controlling the registers, selectors, etc. included in the preceding control device 10.
The instruction decoding information set in the register 503 is sent to the arithmetic execution unit 12 via the signal line L508. As a result of decoding by the instruction decode 502, the page address and the intex address are read from the general-purpose register file 505 for the instruction that needs the address generation, and these values are set in the registers 506 to 508 together with the displacement directly specified by the instruction. To be done. further,
The outputs of the registers 506 to 508 are the address adder 509.
Are used as operand addresses and branch addresses. The output of the address adder 509 is the signal line L5.
It is sent to the arithmetic execution unit via 10 and is also sent to the selectors 510 and 533. The selector 510 is a selector that selects an operand address or the like, and switches the outputs of the address adder 509 and the stack pointers 522 and 523, and the storage controller 1 via the signal line L506.
1 to supply address information. The selector 533 is a selector that selects an instruction read address and the like, and switches the outputs of the address adder 509, the register 544, and the instruction prefetching instruction counter adder 532 to change the signal line L507.
The address information is supplied to the storage control device 11 via the.
The output of the address adder 509 is selected when the branch destination address is generated in processing the branch instruction. In addition, the register 54
The output of 4 is selected when the hit signal is output as a result of indexing the branch history table. The output of the instruction prefetch instruction counter adder 532 is selected at the time of instruction prefetch after the instruction counter indicated by the instruction prefetch instruction counter 531. The output of the selector 533 is the selectors 530 and 54.
Sent to 0. The selector 530 is an input selector of the instruction prefetch instruction counter 531 and selects the initial value sent from the arithmetic execution unit 12 and the updated value of the instruction prefetch instruction counter 531 which is the output of the selector 533. The selector 540 is a selector that selects an index address of the branch history table 542, and is a stack pointer 52.
The output of 2 and the output of the selector 533 are selected. The outputs of the stack pointers 522 and 523 are selected at the time of processing of a subroutine return instruction, and otherwise, the instruction prefetch address information output from the selector 533 is selected. As a result of indexing the branch history table 542, the hit information and the predicted address are read out and set in the flag 543 and the register 544. The output of the flag 543 is used as hit information in the branch history table and as a selection instruction of the selector 533. Further, the registration address and registration data to the branch history table 542 are sent from the arithmetic execution unit 12 via the signal lines L503 and L505. The stack pointer 522 is used by the adder / subtractor 52 when processing a subroutine read instruction or processing a subroutine return instruction.
Updated by 1. In this embodiment, -4 when processing a subroutine read instruction, + when processing a subroutine return instruction
It is assumed that operation 4 is performed. However, the same applies even when the addition and subtraction are reversed. The selector 520 is an input selector of the stack pointer 522, and selects the initial value sent to the arithmetic execution unit 12 and the updated value of the stack pointer 522 which is the output of the adder / subtractor 521.

【0016】本実施例においては、スタックポインタは
2個存在する。ここでは、スタックポインタA522,
スタックポインタB523がそれである。また、どちら
のスタックポインタが有効であるかを示すレジスタ52
4が用意されている。このレジスタはユーザモード、ス
ーパーバイザモード等のモード遷移時に変換される。し
たがって同時に両方のスタックポインタが使用できるわ
けではない。(しかし一般にはスタックポインタは複数
個存在できるし、プロセスごとにそれらを割り当てるこ
とも可能である。また、命令毎にスタックポインタを指
定することも可能であろう。)すなわちスタックポイン
タ522,523はレジスタ524の有効スタックポイ
ンタ番号に応じて一方が有効、他方が無効となる。参
照,更新はいつも有効な方のスタックポインタが対象と
なる。レジスタ524の出力は信号線L509を介し
て、演算実行装置に送られる。また、セレクタ541は
レジスタ524の出力と、‘0’値とを選択して分岐ヒ
ストリテーブル542の索引に使用される。セレクタ5
40でスタックポインタ522,523選択時にレジス
タ524の出力が選択される。分岐ヒストリテーブル5
42には演算実行装置12より信号線L504を介し
て、有効スタックポインタ番号が送られて登録に使用さ
れる。
In this embodiment, there are two stack pointers. Here, the stack pointer A522,
That is the stack pointer B523. In addition, a register 52 indicating which stack pointer is valid
4 is prepared. This register is converted at the time of mode transition such as user mode and supervisor mode. Therefore, both stack pointers cannot be used at the same time. (However, in general, there can be a plurality of stack pointers, and it is possible to allocate them for each process. It is also possible to specify the stack pointer for each instruction.) That is, the stack pointers 522 and 523 are One is valid and the other is invalid according to the valid stack pointer number of the register 524. Reference and update always target the valid stack pointer. The output of the register 524 is sent to the arithmetic execution unit via the signal line L509. Further, the selector 541 selects the output of the register 524 and the value “0” and uses it for the index of the branch history table 542. Selector 5
At 40, when the stack pointers 522 and 523 are selected, the output of the register 524 is selected. Branch history table 5
The valid execution stack pointer number is sent to 42 from the arithmetic execution unit 12 through the signal line L504 and used for registration.

【0017】図6は演算実行装置12の内部構造に一部
を示している。先行制御装置10より信号線L508〜
L510を介して送られる命令解読情報、アドレス情報
は信号線L601〜L603を介して命令解読情報キュ
ー601,アドレスキュー602でバッファされる。命
令カウンタ606は演算実行装置12にて処理中の命令
が格納されていたアドレスを示す。加算器607は命令
カウンタ606が次の命令を指示するように命令長文の
加算をおこなうために使用される。セレクタ605は、
命令カウンタの入力セレクタでアドレスキュー602,
信号線L604を介したALUの出力、加算器607の
出力を選択する。アドレスキュー602の出力は、分岐
命令処理に際して分岐がおこなわれたときに選択され
る。ALUの出力は初期値設定時に選択される。その他
は加算器607が選択される。スタックポインタ60
9,610はスタックポインタ522,523と同様な
処理が実施されるが、そのタイミングが異なる。スタッ
クポインタ522,523は、サブルーチン読み出し命
令やサブルーチン復帰命令をデコード後、アドレス生成
のタイミングで更新されるがスタックポインタ609,
610は演算実行装置12において、サブルーチン読み
出し命令やサブルーチン復帰命令の処理完了のタイミン
グで更新される。スタックポインタ609,610はス
タックポインタ522,523に対応しており、情報処
理装置のモード情報が設定されるレジスタ(不図示)に
含まれる有効スタックポインタ番号に応じて一方が有
効、他方が無効となる。参照、更新にいても有効な方の
スタックポインタが対象となる。レジスタ524は、前
記モード情報が設定されるレジスタに含まれる、有効ス
タックポインタ番号のコピーである。このような有効ス
タックポインタ番号はアーキテクチャに依存しており、
スパーバイザモード,ユーザモード等のモードで代用す
る場合もある。加減算器611はスタックポインタ60
9,610の更新データの生成に使用される。セレクタ
608はALUより初期値を設定する際にALUを選択
する様に切り換えられる。レジスタ620,622〜6
24は演算実行装置12において処理が完了するタイミ
ングに命令解読情報キュー601より出力される有効ス
タックポインタ番号、処理が完了した命令の格納されて
いた命令カウンタ606の値,アドレスキュー602よ
り出力される分岐先命令アドレス、、更新前のスタック
ポインタ609の値が設定される。セレクタ621,6
25,627は分岐ヒストリテーブルへの登録アドレ
ス,データを選択に使用される。その出力は信号線L6
05〜L607を介して先行制御装置10に送られ、先
行制御装置10の信号線L503〜L505を介して分
岐ヒストリテーブルへ登録される。分岐命令処理に際し
ては‘0’,レジスタ622,623が選択され、信号
線L605〜L607に出力される。すなわち、分岐命
令が格納されていたアドレスと、その分岐命令の分岐先
アドレスが分岐ヒストリテーブルに登録されることにな
る。サブルーチン読み出し命令処理に関しては、まず、
‘0’,レジスタ622,623が選択され信号線L6
05〜L607に出力される。すなわち、サブルーチン
読み出し命令が格納されていたアドレスとそのサブルー
チン読み出し命令のサブルーチン入口アドレスが分岐ヒ
ストリテーブルに登録される。分岐命令処理に際しては
レジスタ322,323が選択され、信号線L306,
L307に出力される。すなわち、分岐命令が格納され
ていたアドレスと、その分岐命令の分岐先アドレスが分
岐ヒストリテーブルに登録されることになる。サブルー
チン読み出し命令処理に関しては、まず、レジスタ32
2,323が選択され信号線L306,L307に出力
される。すなわち、サブルーチン読み出し命令が格納さ
れていたアドレスとそのサブルーチン読み出し命令のサ
ブルーチン入口アドレスが分岐ヒストリテーブルに登録
される。次に、レジスタ620,624、加算器326
が選択され信号線L605〜6077に出力される。す
なわち、サブルーチン読み出し時のスタックポインタの
値と、サブルーチン復帰アドレスが分岐ヒストリテーブ
ルに登録される。加算器326はサブルーチン復帰アド
レスを算出すための加算器である。本実施例では、サブ
ルーチン読み出し命令の命令長を4バイトと仮定してい
るため+4加算器になっている。図11に分岐命令の分
岐動作を示す。A番地の分岐命令(BRA)によって、
B番地に分岐するこのとき分岐ヒストリテーブルには、
A番地とB番地が組で登録される。図12にサブルーチ
ン呼び出し/復帰の動作を示す。A番地のサブルーチン
読み出し命令(JSR)はE番地を入口番地とするサブ
ルーチンを呼び出す。同時に、スタックポインタが更新
される。このとき器ヒストリテーブルには、A番地とE
番地,SP番地とB番地がそれぞれ組で登録される。本
実施例では、A番地とE番地,SP番地とB番地の順に
登録するが、この順はどちらを先にすることもできる。
FIG. 6 shows a part of the internal structure of the arithmetic execution unit 12. The signal line L508 from the preceding control device 10
The instruction decode information and address information sent via L510 are buffered in the instruction decode information queue 601 and the address queue 602 via signal lines L601 to L603. The instruction counter 606 indicates the address where the instruction being processed by the arithmetic execution unit 12 was stored. The adder 607 is used to add the instruction length sentence so that the instruction counter 606 indicates the next instruction. The selector 605 is
Address queue 602 with the input selector of the instruction counter
The output of the ALU via the signal line L604 and the output of the adder 607 are selected. The output of the address queue 602 is selected when a branch is taken in branch instruction processing. The output of the ALU is selected when the initial value is set. In other cases, the adder 607 is selected. Stack pointer 60
9, 610 performs the same processing as the stack pointers 522, 523, but the timing is different. The stack pointers 522 and 523 are updated at the timing of address generation after decoding the subroutine read instruction and the subroutine return instruction.
In the arithmetic execution unit 12, 610 is updated at the timing of completion of processing of a subroutine read instruction and a subroutine return instruction. The stack pointers 609 and 610 correspond to the stack pointers 522 and 523, and one is valid and the other is invalid according to the valid stack pointer number included in the register (not shown) in which the mode information of the information processing device is set. Become. The stack pointer that is valid for reference and update is the target. The register 524 is a copy of the effective stack pointer number included in the register in which the mode information is set. Such a valid stack pointer number is architecture dependent,
In some cases, a mode such as a supervisor mode or a user mode may be used instead. The adder / subtractor 611 is the stack pointer 60.
It is used to generate update data for 9,610. The selector 608 is switched to select the ALU when setting the initial value from the ALU. Registers 620, 622-6
24 is a valid stack pointer number output from the instruction decoding information queue 601 at the timing of completion of processing in the arithmetic execution unit 12, a value of the instruction counter 606 in which the processed instruction is stored, and output from the address queue 602. The branch destination instruction address and the value of the stack pointer 609 before updating are set. Selector 621,6
Reference numerals 25 and 627 are used for selecting a registration address and data in the branch history table. The output is the signal line L6
It is sent to the preceding control device 10 via 05 to L607 and registered in the branch history table via the signal lines L503 to L505 of the preceding control device 10. At the time of branch instruction processing, '0', registers 622 and 623 are selected and output to the signal lines L605 to L607. That is, the address in which the branch instruction was stored and the branch destination address of the branch instruction are registered in the branch history table. Regarding subroutine read instruction processing, first,
'0', registers 622 and 623 are selected and signal line L6
05 to L607 are output. That is, the address where the subroutine read instruction is stored and the subroutine entry address of the subroutine read instruction are registered in the branch history table. When processing a branch instruction, the registers 322 and 323 are selected and the signal line L306,
It is output to L307. That is, the address in which the branch instruction was stored and the branch destination address of the branch instruction are registered in the branch history table. Regarding the subroutine read instruction processing, first, the register 32
2, 323 are selected and output to the signal lines L306 and L307. That is, the address where the subroutine read instruction is stored and the subroutine entry address of the subroutine read instruction are registered in the branch history table. Next, the registers 620 and 624 and the adder 326.
Is selected and output to the signal lines L605 to 6077. That is, the value of the stack pointer at the time of reading the subroutine and the subroutine return address are registered in the branch history table. The adder 326 is an adder for calculating a subroutine return address. In this embodiment, since the instruction length of the subroutine read instruction is assumed to be 4 bytes, it is a +4 adder. FIG. 11 shows the branch operation of the branch instruction. By the branch instruction (BRA) at address A,
Branch to address B At this time, in the branch history table,
Address A and address B are registered as a pair. FIG. 12 shows the subroutine calling / returning operation. A subroutine read instruction (JSR) at address A calls a subroutine having address E as an entry address. At the same time, the stack pointer is updated. At this time, in the container history table, address A and E
Address, SP address and B address are registered in pairs. In this embodiment, addresses A and E, SP addresses and B addresses are registered in this order, but this order may be registered first.

【0018】図7は分岐ヒストリテーブル542の内部
構成の一部を示している。分岐ヒストリテーブルのキー
部702は3つのデータフィールドで構成される。ま
た、データ部703は1つのデータフィールドで構成さ
れる。分岐命令処理における登録で生成された分岐命令
エントリでは、有効ビット(V)、分岐命令表示ビット
(B),‘0’、分岐命令アドレス部の3つのデータフ
ィールドがキー部に分岐先命令アドレス部がデータ部に
登録される。サブルーチン読み出し命令のアドレスとサ
ブルーチン入口アドレスを登録する場合も、分岐命令と
同様にあつかう。一方、スタックポインタとサブルーチ
ン復帰アドレスを登録により生成された分岐命令エント
リでは、有効ビット(V)、分岐命令表示ビット
(B)、有効クタックポインタ番号(ST)、スタック
ポインタ部の4つのデータフィールドがキー部に、復帰
先命令アドレス部がデータ部に登録される。このときは
分岐命令表示ビット(B)は、非表示を示す値(Bar
B)が設定される。登録には信号線L503〜L505
を介して、演算実行装置から送られるデータを使用す
る。セレクタ701は登録時信号線L503,L504
を選択する。索引時には、索引アドレスがセレクタ54
0より送られるので、セレクタ701はセレクタ540
を選択する。分岐ヒストリテーブルキー部702より読
み出された有効ビット、分岐命令表示ビット、‘0’ま
たは、有効スタックポインタ番号、分岐命令アドレス
部、又はスタックポインタ部を比較器704,705お
よびアンドゲート706に入力する。分岐命令アドレス
部、又はクタックポインタ部はセレクタ701の出力と
比較される。また、分岐命令表示ビットと‘0’また
は、有効スタックポインタ番号は、索引情報と比較され
る。索引情報は、セレクタ541の出力とセレクタ54
0がスタックポインタの出力を選択したとき、すなわち
サブルーチン復帰命令の処理に際して分岐ヒストリテー
ブルを索引するときは、非表示を示す値(BarB)と
なりそれ以外の場合は分岐命令表示を示す値(B)とな
る。比較器704,705の出力はそれぞれアンドゲー
ト706に入力され、さらに索引エントリの有効ビッ
ト、分岐ヒストリテーブルの索引指示とアンドされヒッ
ト情報が出力される。このヒット情報は、ヒットフラグ
543に設定される。また、同じエントリのデータ部は
レジスタ544に格納され、予測先命令取り出しに利用
される。分岐ヒストリテーブルの索引指示はあらかじめ
定められた命令の処理時命令デコーダの出力より生成さ
れる信号である。
FIG. 7 shows a part of the internal structure of the branch history table 542. The key portion 702 of the branch history table is composed of three data fields. The data section 703 is composed of one data field. In the branch instruction entry generated by the registration in the branch instruction processing, three data fields of a valid bit (V), a branch instruction display bit (B), '0', and a branch instruction address section are provided in the key section as the branch target instruction address section. Is registered in the data section. The address of the subroutine read instruction and the subroutine entry address are registered in the same manner as the branch instruction. On the other hand, in the branch instruction entry generated by registering the stack pointer and the subroutine return address, the four data fields of the valid bit (V), the branch instruction display bit (B), the valid tact pointer number (ST), and the stack pointer part Is registered in the key part, and the return destination instruction address part is registered in the data part. At this time, the branch instruction display bit (B) is set to a value (Bar) indicating non-display.
B) is set. Signal lines L503 to L505 are used for registration.
Data sent from the arithmetic execution unit via the. The selector 701 is for registering signal lines L503 and L504.
Select. When indexing, the index address is the selector 54
Since it is sent from 0, the selector 701 is
Select. The valid bit read from the branch history table key unit 702, the branch instruction display bit, “0”, or the valid stack pointer number, the branch instruction address unit, or the stack pointer unit is input to the comparators 704 and 705 and the AND gate 706. To do. The branch instruction address part or the tuck pointer part is compared with the output of the selector 701. Further, the branch instruction display bit and "0" or the effective stack pointer number is compared with the index information. The index information is output by the selector 541 and the selector 54.
When 0 selects the output of the stack pointer, that is, when the branch history table is indexed when processing the subroutine return instruction, the value indicates non-display (BarB), and otherwise the value indicates the branch instruction display (B). Becomes The outputs of the comparators 704 and 705 are input to the AND gate 706, and are ANDed with the valid bit of the index entry and the index instruction of the branch history table, and the hit information is output. This hit information is set in the hit flag 543. The data part of the same entry is stored in the register 544 and is used for fetching the prediction destination instruction. The index instruction of the branch history table is a signal generated from the output of the instruction decoder when processing a predetermined instruction.

【0019】本発明の第3の実施例である分岐ヒストリ
テーブルを有する情報処理装置は、第1の実施例と同じ
構成で、この第3の実施例の情報処理装置は図1に示す
ように先行制御装置10と記憶制御装置11と演算実行
装置12とを有している。
An information processing apparatus having a branch history table according to the third embodiment of the present invention has the same configuration as that of the first embodiment, and the information processing apparatus according to the third embodiment is as shown in FIG. It has a preceding control device 10, a storage control device 11, and a calculation execution device 12.

【0020】図8は第3の実施例における先行制御装置
10の内部構成の一部を示している。記憶制御装置より
信号線L801を介して送られる命令は命令レジスタ8
01に設定される。この命令は命令デコード802によ
り解読される。ここで出力される命令解読情報は、レジ
スタ803に設定されるとともに先行制御装置10内に
含まれるレジスタ、セレクタ等の制御にも使用される。
レジスタ803に設定された命令解読情報は演算実行装
置12に信号線L808を介して送られる。命令デコー
ド802により解読した結果、アドレス生成が必要な命
令については、汎用レジスタファイル805よりページ
アドレス,インテックスアドレスを読み出し、命令によ
り直接指定されるディスプレースメントと共に、これら
の値がレジスタ806〜808に設定される。さらに、
レジスタ806〜808の出力はアドレス加算器809
で加算され、オペランドアドレス,分岐アドレスとして
使用される。アドレス加算器809の出力は信号線L8
10を介して演算実行装置に送出されると共に、セレク
タ810,833にも送られる。セレクタ833は命令
読み出しアドレス等を選択するセレクタであり、アドレ
ス加算器809、レジスタ844、命令先取り用命令カ
ウンタ加算器832の出力を切り換えて、信号線L80
7を介して記憶制御装置11にアドレス情報を供給す
る。アドレス加算器809の出力は分岐命令処理に際し
て分岐先アドレス生成時に選択される。また、レジスタ
844の出力は分岐ヒストリテーブルを索引した結果、
ヒット信号が出力したときに選択される。命令先取り用
命令カウンタ加算器832の出力は命令先取り用命令カ
ウンタ831が示す命令カウンタの後の命令先取り時に
選択される。セレクタ833の出力はセレクタ830,
840に送られる。セレクタ830は命令先取り用命令
カウンタ831の入力セレクタであり、演算実行装置1
2より送られる初期値とセレクタ833の出力である命
令先取り用命令カウンタ831の更新値が選択される。
セレクタ840は、分岐ヒストリテーブル842の索引
アドレスを選択するセレクタであり、スタックポインタ
822の出力と、セレクタ833の出力を選択する。ス
タックポインタ822の出力は、サブルーチン復帰命令
処理時に選択され、それ以外はセレクタ833の出力で
ある命令先取りアドレス情報が選択される。分岐ヒスト
リテーブル842を索引した結果、ヒット情報と予測ア
ドレスがそれぞれ読み出され、フラグ843、レジスタ
844に設定される。フラグ843の出力は分岐ヒスト
リテーブルのヒット情報として、セレクタ833の選択
指示として使用される。また演算実行装置12より信号
線L803〜L805を介して分岐ヒストリテーブル8
42への登録アドレスと登録データが送られる。本実施
例においては、サブルーチン読み出し命令、復帰命令に
おいてインデックスレジスタをスタックポインタの代り
に使用する。(ベースレジスタを使用することも可能だ
が一般的ではない)アドレス生成のために汎用レジスタ
ファイル805から読み出したインデックスレジスタの
レジスタ番号はレジスタ811に設定され、信号線L8
09を介して演算実行装置12に送られる。また、セレ
クタ841ではセレクタ840において、アドレス加算
器809を選択したときにレジスタ811の出力を選択
して分岐ヒストリテーブル842の索引に使用される。
FIG. 8 shows a part of the internal construction of the advance control apparatus 10 in the third embodiment. The instruction sent from the storage controller via the signal line L801 is the instruction register 8
It is set to 01. This instruction is decoded by the instruction decode 802. The instruction decoding information output here is set in the register 803 and is also used for controlling the registers, selectors, etc. included in the preceding control device 10.
The instruction decoding information set in the register 803 is sent to the arithmetic execution unit 12 via the signal line L808. As a result of decoding by the instruction decode 802, for an instruction that requires address generation, the page address and the intex address are read from the general-purpose register file 805, and these values are set in the registers 806 to 808 together with the displacement directly specified by the instruction. To be done. further,
The outputs of the registers 806 to 808 are address adders 809.
Are used as operand addresses and branch addresses. The output of the address adder 809 is the signal line L8.
It is sent to the arithmetic execution unit via 10 and is also sent to the selectors 810 and 833. The selector 833 is a selector that selects an instruction read address and the like, and switches the outputs of the address adder 809, the register 844, and the instruction prefetching instruction counter adder 832 to switch the signal line L80.
The address information is supplied to the storage controller 11 via 7. The output of the address adder 809 is selected when a branch destination address is generated in processing a branch instruction. The output of the register 844 is the result of indexing the branch history table,
Selected when the hit signal is output. The output of the instruction prefetch instruction counter adder 832 is selected at the time of instruction prefetch after the instruction counter indicated by the instruction prefetch instruction counter 831. The output of the selector 833 is the selector 830,
Sent to 840. The selector 830 is an input selector of the instruction prefetching instruction counter 831, and the arithmetic execution unit 1
2 and the updated value of the instruction prefetching instruction counter 831 which is the output of the selector 833 are selected.
The selector 840 is a selector that selects the index address of the branch history table 842, and selects the output of the stack pointer 822 and the output of the selector 833. The output of the stack pointer 822 is selected at the time of processing of a subroutine return instruction, and otherwise, the instruction prefetch address information output from the selector 833 is selected. As a result of indexing the branch history table 842, the hit information and the predicted address are read out and set in the flag 843 and the register 844. The output of the flag 843 is used as hit information in the branch history table and as a selection instruction of the selector 833. Further, the branch history table 8 is sent from the arithmetic execution unit 12 via the signal lines L803 to L805.
The registration address and registration data for 42 are sent. In this embodiment, the index register is used instead of the stack pointer in the subroutine read instruction and the return instruction. The register number of the index register read from the general-purpose register file 805 for address generation (it is possible to use the base register but it is not general) is set in the register 811 and the signal line L8.
It is sent to the arithmetic execution unit 12 via 09. Also, in the selector 841, when the address adder 809 is selected in the selector 840, the output of the register 811 is selected and used as an index of the branch history table 842.

【0021】図9は演算実行装置12の内部構造に一部
を示している。先行制御装置10より信号線L808〜
L810を介して送られる命令解読情報、インデックス
レジスタ番号、アドレス情報は信号線L391〜L90
3を介して命令解読情報キュー901,アドレスキュー
902でバッファされる。命令カウンタ906は演算実
行装置12にて処理中の命令が格納されていたアドレス
を示す。加算器907は命令カウンタ906が次の命令
を指示するように命令長文の加算をおこなうために使用
される。セレクタ905は、命令カウンタの入力セレク
タでアドレスキュー902,信号線L904を介したA
LUの出力、加算器907の出力を選択する。レジスタ
920,922,923は演算実行装置12において、
処理が完了するタイミングに命令解読情報キュー901
より出力されるインデックスレジスタ番号,処理が完了
した命令の格納されていた命令カウンタ906の値、ア
ドレスキュー902より出力される分岐先命令アドレス
が設定される。セレクタ921,925,927は、分
岐ヒストリテーブルへの登録アドレス,データを選択に
使用される。その出力は信号線L905〜L907を介
して先行制御装置10に送られ、先行制御装置10の信
号線L803〜L805を介して分岐ヒストリテーブル
へ登録される。分岐命令処理に際しては、‘0’値、レ
ジスタ922,923が選択され信号線L905〜L9
07に出力される。すなわち、分岐命令が格納されてい
たアドレスと、その分岐命令の分岐先アドレスが分岐ヒ
ストリテーブルに登録されることになる。サブルーチン
読み出し命令処理に関しては、まず、レジスタ920,
923、加算器926が選択され信号線L905〜L9
07に出力される。すなわち、インデックスレジスタ番
号と、サブルーチン呼び出し時のスタックポインタの値
とサブルーチン復帰アドレスが分岐ヒストリテーブルに
登録される。加算器326は、サブルーチン復帰アドレ
スを算出するための加算器である。本実施例ではサブル
ーチン読み出しのための命令列が、4バイト長×命令と
しているため+8加算器になっている。この処理は図1
3に示す命令カウンタストア命令(STC8)処理が完
了するタイミングで登録がおこなわれる。次に、‘0’
値、レジスタ922,923が選択され信号線L905
〜L907に出力される。すなわち、サブルーチン読み
出し命令が格納されていたアドレスとそのサブルーチン
読み出し命令のサブルーチン入口アドレスが分岐ヒスト
リテーブルに登録される。この処理は図13に示す分岐
命令(BRA)の処理が完了するタイミングで登録がお
こなわれる。
FIG. 9 shows a part of the internal structure of the arithmetic execution unit 12. Signal line L808 from the preceding control device 10
The instruction decoding information, index register number, and address information sent via L810 are signal lines L391 to L90.
3 is buffered in the instruction decoding information queue 901 and the address queue 902. The instruction counter 906 indicates the address where the instruction being processed by the arithmetic execution unit 12 was stored. The adder 907 is used to add the instruction long sentence so that the instruction counter 906 indicates the next instruction. The selector 905 is an input selector of the instruction counter, and is A through the address queue 902 and the signal line L904.
The output of the LU and the output of the adder 907 are selected. The registers 920, 922, 923 are
Instruction decoding information queue 901 at the timing of completion of processing
The index register number output by the output, the value of the instruction counter 906 in which the processed instruction is stored, and the branch destination instruction address output from the address queue 902 are set. The selectors 921, 925, 927 are used for selecting the registered address and data in the branch history table. The output is sent to the preceding control device 10 via the signal lines L905 to L907, and registered in the branch history table via the signal lines L803 to L805 of the preceding control device 10. When processing a branch instruction, the value "0", the registers 922 and 923 are selected and the signal lines L905 to L9 are selected.
It is output to 07. That is, the address in which the branch instruction was stored and the branch destination address of the branch instruction are registered in the branch history table. Regarding the subroutine read instruction processing, first, the register 920,
923 and the adder 926 are selected and the signal lines L905 to L9 are selected.
It is output to 07. That is, the index register number, the stack pointer value when the subroutine is called, and the subroutine return address are registered in the branch history table. The adder 326 is an adder for calculating a subroutine return address. In the present embodiment, the instruction string for reading the subroutine is 4 bytes long × instruction, so that it is a +8 adder. This process is shown in Figure 1.
Registration is performed at the timing when the instruction counter store instruction (STC8) processing shown in 3 is completed. Next, '0'
Value, register 922, 923 is selected and signal line L905
To L907. That is, the address where the subroutine read instruction is stored and the subroutine entry address of the subroutine read instruction are registered in the branch history table. This processing is registered at the timing when the processing of the branch instruction (BRA) shown in FIG. 13 is completed.

【0022】図11に分岐命令の分岐動作を示す。A番
地の分岐命令(BRA)によって、B番地に分岐する。
このとき分岐ヒストリテーブルには、A番地とB番地が
組で登録される。図13にサブルーチン呼び出し/復帰
の動作を示す。A番地の命令カウンタストア命令(ST
C8)は命令カウンタ(A)+8の値を、汎用レジスタ
R2をインデックスレジスタとしてストアする。すなわ
ち、R2レジスタをスタックポインタとして復帰アドレ
スをストアしたことになる。次の分岐命令(BRA)に
より、サブルーチンの入口番地(E)に分岐する。サブ
ルーチンの入口では、まずスタックポインタとして使用
されているレジスタR2を更新する(SB)。サブルー
チンの出口では逆にレジスタR2を更新(AD)した
後、サブルーチン復帰命令(RET)により、B番地に
復帰する。この復帰命令(RET)によりB番地に復帰
する。この復帰命令はレジスタR2をインデックスレジ
スタとして間接分岐を行う。すなわち、レジスタR2が
示す番地の内容を復帰アドレスとして分岐を行う。
FIG. 11 shows the branch operation of the branch instruction. A branch instruction (BRA) at address A branches to address B.
At this time, address A and address B are registered as a pair in the branch history table. FIG. 13 shows a subroutine calling / returning operation. Instruction counter store instruction at address A (ST
C8) stores the value of the instruction counter (A) +8 in the general register R2 as an index register. That is, the return address is stored using the R2 register as the stack pointer. The next branch instruction (BRA) branches to the entry address (E) of the subroutine. At the entrance of the subroutine, first, the register R2 used as the stack pointer is updated (SB). At the exit of the subroutine, conversely, after updating (AD) the register R2, the subroutine return instruction (RET) returns to the address B. This return instruction (RET) returns to the address B. This return instruction performs an indirect branch using the register R2 as an index register. That is, the branch is performed using the contents of the address indicated by the register R2 as the return address.

【0023】本実施例において、サブルーチン読み出し
は命令カウンタストア命令(STC8)と分岐命令(B
RA)とレジスタ減算命令(SB)によって実現されて
いる。また、サブルーチン復帰はレジスタ加算命令(A
D)とサブルーチン復帰命令(RET)によって実現さ
れている。これは専用のスタックポインタを備えていな
いアーキテクチャであるために、スタックポインタとし
て使用する汎用レジスタを指定する必要があるからであ
る。
In the present embodiment, the subroutine read is performed by an instruction counter store instruction (STC8) and a branch instruction (B
RA) and a register subtraction instruction (SB). In addition, the register addition instruction (A
D) and a subroutine return instruction (RET). This is because the architecture does not have a dedicated stack pointer, so it is necessary to specify a general-purpose register to be used as a stack pointer.

【0024】図10は、分岐ヒストリテーブル842の
内部構成の一部を示している。分岐ヒストリテーブルの
キー打1002は、4つのデータフィールドで構成され
る。また、データ部1003は、1つのデータフィール
ドで構成される。分岐命令処理における登録で生成され
た分岐命令エントリでは有効ビット(V)分岐命令表示
ビット(B),0,分岐命令アドレス部の4つのデータ
フィールドがキー部に分岐先命令アドレス部がデータ部
に登録される。サブルーチン読み出し命令のアドレスと
サブルーチン入口アドレスを登録する場合も分岐命令と
同様にあつかう。一方、セーブアドレス部とサブルーチ
ン復帰アドレスを登録により生成された分岐命令エント
リでは有効ビット(V)、分岐命令表示ビット(B)、
インデックスレジスタ番号、スタックポインタ部の4つ
のデータフィールドがキー部に、復帰先命令アドレス部
がデータ部に登録される。このときは、分岐命令表示ビ
ット(B)は、非表示を示す値(BarB)が設定され
る。登録には信号線L803〜L805を介して、演算
実行装置から送られるデータを使用する。セレクタ10
01は登録時信号線L803〜L804を選択する。索
引時には、索引アドレスがセレクタ840にょり送られ
るのでセレクタ1001はセレクタ840を選択する。
分岐ヒストリテーブルキー部1002より読み出された
有効ビット、分岐命令表示ビット、‘0’または、イン
デックスレジスタ番号、分岐命令アドレス部又は、スタ
ックポインタ部又は、スタックポインタ部はセレクタ1
001の出力と比較される。また、分岐命令表示ビット
と、‘0’、または有効スタックポインタ番号は索引情
報と比較される。索引情報はセレクタ841の出力とセ
レクタ840がスタックポインタの出力を選択したと
き、すなわちサブルーチン復帰命令の処理に際して分岐
ヒストリテーブルを索引するときは、非表示を示す値
(BarB)となり、それ以外の場合は分岐命令表示を
示す値(B)となる情報である。比較器1004,10
05の出力はそれぞれアンドゲート1006に入力さ
れ、さらに索引エントリの有効ビット、分岐ヒストリテ
ーブルの索引指示とアンドされヒット情報が出力され
る。このヒット情報はヒットフラグ843に設定され
る。また、同じエントリのデータ部はレジスタ844に
格納され、予測先命令取り出しに利用される。分岐ヒス
トリデータの索引指示はあらかじめ定められた命令の処
理時命令デコーダの出力より生成される信号である。
FIG. 10 shows a part of the internal structure of the branch history table 842. The keystroke 1002 of the branch history table is composed of four data fields. The data section 1003 is composed of one data field. In a branch instruction entry generated by registration in branch instruction processing, four data fields of a valid bit (V), a branch instruction display bit (B), 0, and a branch instruction address part are key parts, and a branch destination instruction address part is a data part. be registered. The address of the subroutine read instruction and the subroutine entry address are registered in the same manner as the branch instruction. On the other hand, in the branch instruction entry generated by registering the save address part and the subroutine return address, the valid bit (V), the branch instruction display bit (B),
Four data fields of an index register number and a stack pointer part are registered in the key part, and a return destination instruction address part is registered in the data part. At this time, the branch instruction display bit (B) is set to a value (BarB) indicating non-display. The data sent from the arithmetic execution unit via the signal lines L803 to L805 is used for registration. Selector 10
01 selects the signal lines L803 to L804 at the time of registration. At the time of indexing, since the index address is sent to the selector 840, the selector 1001 selects the selector 840.
The valid bit read from the branch history table key unit 1002, the branch instruction display bit, “0” or the index register number, the branch instruction address unit, the stack pointer unit, or the stack pointer unit is the selector 1
It is compared with the output of 001. Further, the branch instruction display bit and "0" or the effective stack pointer number is compared with the index information. When the output of the selector 841 and the output of the stack pointer are selected by the selector 840, that is, when the branch history table is indexed during the processing of the subroutine return instruction, the index information is a value (BarB) indicating non-display, and otherwise. Is information that is a value (B) indicating a branch instruction display. Comparator 1004,10
The output of 05 is input to the AND gate 1006, and is further ANDed with the valid bit of the index entry and the index instruction of the branch history table, and the hit information is output. This hit information is set in the hit flag 843. The data part of the same entry is stored in the register 844 and is used for fetching the prediction destination instruction. The branch history data index instruction is a signal generated from the output of the instruction decoder during processing of a predetermined instruction.

【0025】[0025]

【発明の効果】以上説明したように本発明の第1の実施
例は分岐ヒストリテーブルを有する情報処理装置におい
て、サブルーチンの使用を支援する機構としてスタック
ポインタの該スタックポインタを使用したサブルーチン
読み出し命令及びサブルーチン復帰命令を含む命令セッ
トを備える上記情報処理装置において、サブルーチン読
み出し命令処理時スタックポインタの値をキー値、復帰
アドレスをデータ値として分岐ヒストリテーブルに登録
し、サブルーチン復帰命令処理時、スタックポインタの
値をキー値として分岐ヒストリテーブルを索引する。
As described above, in the first embodiment of the present invention, in the information processing apparatus having the branch history table, the subroutine read instruction using the stack pointer of the stack pointer as a mechanism for supporting the use of the subroutine and In the above information processing apparatus having an instruction set including a subroutine return instruction, the value of the stack pointer is registered as a key value and the return address is registered as a data value in the branch history table when the subroutine read instruction is processed, and the stack pointer Index the branch history table with the value as the key value.

【0026】第2の実施例はサブルーチンの使用を支援
する機構として、複数のスタックポインタと現在有効な
スタックポインタの番号を示すモード情報と該スタック
ポインタを使用したサブルーチン読み出し命令及びサブ
ルーチン復帰命令を含む命令セットを備える上記情報処
理装置において、サブルーチン呼び出し命令処理時、有
効スタックポインタ番号とスタックポインタの値をキー
値、フクィアドレスをデータ値として分岐ヒツトリテー
ブルに登録し、サブルーチン復帰命令処理時、有効スタ
ックポインタ番号とスタックポインタの値をキー値とし
て分岐ヒストリテーブルを索引する。
The second embodiment includes, as a mechanism for supporting the use of the subroutine, a plurality of stack pointers, mode information indicating the numbers of the stack pointers currently effective, and a subroutine read instruction and a subroutine return instruction using the stack pointers. In the above information processing device having an instruction set, during processing of a subroutine call instruction, the effective stack pointer number and the value of the stack pointer are registered in the branch hit table as a key value and the fuky address as a data value, and when a subroutine return instruction is processed, The branch history table is indexed using the effective stack pointer number and the value of the stack pointer as the key value.

【0027】第3の実施例はサブルーチンの使用を支援
する機構として専用のスタックポインタがなく、汎用レ
ジスタを使用したサブルーチン読み出し命令及びサブル
ーチン復帰命令を含む情報処理装置において、サブルー
チン読み出し命令処理時、スタックポインタの代りに使
用された汎用レジスタのレジスタ番号とサブルーチン復
帰アドレスとセーブした時のストアアドレス(上記サブ
ルーチン読み出し命令にて生成したアドレスに相当)を
キー値とし、サブルーチン復帰アドレスをデータ値とし
て分岐ヒストリテーブルに登録し、サブルーチン復帰命
令処理時、サブルーチン復帰アドレス読み出し時にアド
レス生成に使用したスタックポインタ代りに使用された
汎用レジスタのレジスタ番号と生成されたアドレスをキ
ー値として索引する。
The third embodiment does not have a dedicated stack pointer as a mechanism for supporting the use of a subroutine, and in an information processing device including a subroutine read instruction and a subroutine return instruction using a general-purpose register, the stack is used when processing a subroutine read instruction. Branch history with the register number of the general-purpose register used instead of the pointer, the subroutine return address, and the store address when saving (corresponding to the address generated by the above subroutine read instruction) as the key value, and the subroutine return address as the data value Register in the table, and index the register number of the general-purpose register used as a substitute for the stack pointer used to generate the address when reading the subroutine return address during the subroutine return instruction processing and the generated address as the key value. .

【0028】上記第1〜第3の実施例によりサブルーチ
ンからの復帰処理に関して分岐ヒストリテーブルが使用
でき、復帰処理についても分岐を高速化することが可能
になる。また、既存の分岐ヒストリテーブルを流用する
ため少ない金物量で効率良く実現できるという効果があ
る。
According to the first to third embodiments, the branch history table can be used for the return processing from the subroutine, and the branch can be speeded up in the return processing. Further, since the existing branch history table is used, there is an effect that it can be efficiently realized with a small amount of metal.

【0029】また、上記第1〜第3の実施例で示すよう
に様々なタイプのアーキテクチャに対応することができ
る。第1の実施例は1個のスタックポインタを備えるア
ーキテクチャに対応している。第2の実施例は複数のス
タックポインタを備えるアーキテクチャに対応してい
る。第3の実施例はスタックポインタを備えないアーキ
テクチャに対応している。このように様々なタイプのア
ーキテクチャについてもサブルーチン復帰処理について
分岐ヒイストリテーブルを有効に使用することができ
る。
Further, as shown in the first to third embodiments, various types of architectures can be supported. The first embodiment corresponds to an architecture with one stack pointer. The second embodiment corresponds to an architecture with multiple stack pointers. The third embodiment corresponds to an architecture without a stack pointer. As described above, the branch history table can be effectively used for the subroutine return processing for various types of architectures.

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

【図1】本発明の一実施例を示す図である。FIG. 1 is a diagram showing an embodiment of the present invention.

【図2】第1の実施例における先行制御装置10内部構
造を示す図である。
FIG. 2 is a diagram showing an internal structure of the advance control device 10 in the first embodiment.

【図3】演算実行装置12の内部構造を示す図である。FIG. 3 is a diagram showing an internal structure of a calculation execution device 12.

【図4】分岐ヒストリテーブル242の内部構造を示す
図である。
FIG. 4 is a diagram showing an internal structure of a branch history table 242.

【図5】第2の実施例における先行制御装置10の内部
構造を示す図である。
FIG. 5 is a diagram showing an internal structure of a preceding control device 10 in a second embodiment.

【図6】演算実行装置12の内部構造を示す図である。FIG. 6 is a diagram showing an internal structure of a calculation execution device 12.

【図7】分岐ヒストリテーブル542の内部構造を示す
図である。
FIG. 7 is a diagram showing an internal structure of a branch history table 542.

【図8】第3の実施例における先行制御装置10の内部
構造を示す図である。
FIG. 8 is a diagram showing an internal structure of a preceding control device 10 in a third embodiment.

【図9】演算実行装置12の内部構造を示す図である。FIG. 9 is a diagram showing an internal structure of the arithmetic execution unit 12.

【図10】分岐ヒストリテーブル842の内部構造を示
す図である。
FIG. 10 is a diagram showing an internal structure of a branch history table 842.

【図11】分岐命令の分岐動作を示す図である。FIG. 11 is a diagram showing a branch operation of a branch instruction.

【図12】サブルーチン呼び出し/復帰の動作を示す図
である。
FIG. 12 is a diagram showing a subroutine call / return operation.

【図13】サブルーチン呼び出し/復帰の動作を示す図
である。
FIG. 13 is a diagram showing a subroutine call / return operation.

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

10 先行制御装置 11 記憶制御装置 12 演算実行装置 201,501,801 命令レジスタ 202,502,802 命令デコーダ 203,206,207,208,244,322,3
23,324,503,506,507,508,52
4,544,620,622,623,624,80
3,806,807,808,811,844,92
0,922,923レジスタ 209,509,809 アドレス加算器 222,309,522,523,609,610
スタックポインタ 221,521,611 加減算器 237,531,831 命令先取り用命令カウンタ 231,307,326,532,607,626,8
32,907,926加算器 242,402,403,542,702,703,8
42,1002,1003 分岐ヒストリテーブル 243,543,843 フラグ 301,302,601,602,901,902
キュー 306,606,906 命令カウンタ 404,405,704,705,1004,1005
比較器 406,706,1006 アンドゲート 210,220,230,233,240,305,3
25,308,327,401,510,520,53
0,535,540,605,625,608,62
7,701,541,621,830,833,84
0,921,926,927,905,841,100
1 セレクタ
10 Advance Control Device 11 Storage Control Device 12 Operation Execution Device 201, 501, 801 Instruction Register 202, 502, 802 Instruction Decoder 203, 206, 207, 208, 244, 322, 3
23, 324, 503, 506, 507, 508, 52
4,544,620,622,623,624,80
3,806,807,808,811,844,92
0,922,923 register 209,509,809 address adder 222,309,522,523,609,610
Stack pointer 221, 521, 611 Adder / subtractor 237, 531, 831 Instruction prefetch instruction counter 231, 307, 326, 532, 607, 626, 8
32,907,926 adder 242,402,403,542,702,703,8
42,1002,1003 Branch history table 243,543,843 Flag 301,302,601,602,901,902
Queue 306, 606, 906 Instruction counter 404, 405, 704, 705, 1004, 1005
Comparators 406, 706, 1006 AND gates 210, 220, 230, 233, 240, 305, 3
25, 308, 327, 401, 510, 520, 53
0,535,540,605,625,608,62
7,701,541,621,830,833,84
0,921,926,927,905,841,100
1 selector

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 サブルーチンの使用を支援する機構とし
て、スタックポインタと、該スタックポインタを使用し
たサブルーチン呼び出し命令及びサブルーチン復帰命令
を含む命令セットを備え、分岐命令のアドレスと該分岐
命令の分岐先アドレスを対にして記憶する分岐ヒストリ
テーブルを有する情報処理装置において、上記サブルー
チン呼び出し命令、サブルーチン復帰命令を検出する命
令デコード手段と、該命令デコード手段の出力に応答し
て命令取り出し番地と、前記スタックポインタの出力を
切り換える第一のセレクタ手段と命令実行に際して、実
行中の命令があらかじめ定められた分岐命令のときは該
分岐命令が格納されていた番地、また実行中の命令が前
記サブルーチン呼び出し命令のときは該サブルーチン呼
び出し命令によって更新されたスタックポインタの出力
を選択する第二のセレクタ手段と、前記分岐命令の分岐
先番地と前記サブルーチン呼び出し命令によるサブルー
チン呼び出しからの復帰番地を切り換える第三のセレク
タ手段と、前記第一のセレクタ手段の出力を索引キーと
し、前記第二のセクタ手段の出力を登録キー、前記第三
のセレクタ手段の出力を登録データとする前記分岐ヒス
トリテーブル手段を有することを特徴とする分岐ヒスト
リテーブルを有する情報処理装置。
1. As a mechanism for supporting the use of a subroutine, a stack pointer and an instruction set including a subroutine call instruction and a subroutine return instruction using the stack pointer are provided, and the address of the branch instruction and the branch destination address of the branch instruction. In an information processing apparatus having a branch history table storing pairs of instructions, instruction decoding means for detecting the subroutine call instruction and subroutine return instruction, an instruction fetch address in response to the output of the instruction decoding means, and the stack pointer. When the instruction being executed is a predetermined branch instruction in executing the instruction and the first selector means for switching the output of the branch instruction, the address in which the branch instruction is stored, and the instruction being executed is the subroutine calling instruction Is the subroutine call instruction Second selector means for selecting the output of the updated stack pointer, third selector means for switching the branch destination address of the branch instruction and the return address from the subroutine call by the subroutine call instruction, and the first selector A branch history table characterized in that the output of the means is used as an index key, the output of the second sector means is used as a registration key, and the output of the third selector means is used as registration data. Information processing equipment.
【請求項2】 サブルーチンの使用を支援する機構とし
て、複数のスタックポインタと、現在有効なスタックポ
インタの番号を示すモード情報と、該スタックポインタ
を使用したサブルーチン呼び出し命令及びザブルーチン
復帰命令を含む命令セットを備え、分岐命令のアドレス
と該分岐命令の分岐先アドレスを対にして記憶する分岐
ヒストリテーブルを有する情報処理装置において、上記
サブルーチン読み出し命令、サブルーチン復帰命令を検
出する命令デコード手段と、該命令デコード手段の出力
に応答して命令取り出し番地と前記スタックポインタの
出力を切り換える第一のセレクタ手段と、前記モード情
報に含まれるスタックポインタ番号を選択する第二のセ
レクタ手段と、命令実行に際して実行中の命令があらか
じめ定められた分岐命令のときは該分岐命令が格納され
ていた番地、また実行中の命令が前記サブルーチン読み
出し命令のときは該サブルーチン読み出し命令によって
更新されたスタックポインタの出力を選択する第三のセ
レクタ手段と、該第三のセレクタ手段で選択されたスタ
ックポインタのスタックポインタ番号を選択する第四の
セレクタ手段と、前記分岐命令の分岐先番地と前記サブ
ルーチン呼び出し命令によるサブルーチン読み出しから
の復帰番地を切り換える第五のセレクタ手段と、前記第
一,第二のセレクタ手段の出力を索引キーとし、前記第
三,第四のセレクタ手段の出力を登録キー、前記第五の
セレクタ手段の出力を登録データとする前記分岐ヒスト
リテーブル手段を有することを特徴とする分岐ヒストリ
テーブルを有する情報処理装置。
2. An instruction set including a plurality of stack pointers, mode information indicating a currently valid stack pointer number, a subroutine call instruction and a sub routine return instruction using the stack pointers, as a mechanism for supporting the use of the subroutine. And a branch history table for storing a branch instruction address and a branch destination address of the branch instruction as a pair. First selector means for switching the instruction fetch address and the output of the stack pointer in response to the output of the means, second selector means for selecting the stack pointer number included in the mode information, and Branch with predetermined instructions When the instruction is an instruction, the address in which the branch instruction is stored, and when the instruction being executed is the subroutine read instruction, third selector means for selecting the output of the stack pointer updated by the subroutine read instruction, Fourth selector means for selecting the stack pointer number of the stack pointer selected by the third selector means, and fifth selector for switching the branch destination address of the branch instruction and the return address from the subroutine read by the subroutine call instruction. Means and the outputs of the first and second selector means as index keys, the outputs of the third and fourth selector means as registration keys, and the output of the fifth selector means as registration data. An information processing apparatus having a branch history table, characterized by comprising table means.
【請求項3】 サブルーチンの使用を支援する機構とし
て、専用のスタックポインタがなく、汎用レジスタを使
用したサブルーチン読み出し命令及びサブルーチン復帰
命令を備え、分岐命令のアドレスと該分岐命令の分岐先
アドレスを対にして記憶する分岐ヒストリテーブルを有
する情報処理装置において、上記サブルーチン読み出し
命令、及びサブルーチン復帰命令を検出する命令デコー
ド手段と、該命令デコード手段の出力に応答して、命令
取り出し番地と前記サブルーチン復帰命令で生成された
番地を切り換える第一のセレクタ手段と、該番地の生成
に際してスタックポインタの代りに使用された汎用レジ
スタのレジスタ番号を選択する第二のセクタ手段と、命
令実行に際して実行中の命令があらかじめ定められた分
岐命令のときは該分岐命令が格納されていた番地、また
実行中の命令が前記サブルーチン読み出し命令のときは
該サブルーチン読み出し命令によりストアされる復帰番
地を選択する第三のセレクタ手段と、前記サブルーチン
読み出し命令でストア番地生成に際してスタックポイン
タの代りに使用された汎用レジスタのレジスタ番号を選
択する第四のセレクタ手段と、前記分岐命令の分岐先番
地と前記サブルーチン読み出し命令によりストアされる
復帰番地を切り換える第五のセレクタ手段と、前記第
一,第二のセレクタ手段の出力を索引キーとし、前記第
三,第四のセレクタ手段の出力を登録キー、前記第五の
セレクタ手段の出力を登録データとする前記分岐ヒスト
リテーブル手段を有することを特徴とする分岐ヒストリ
テーブルを有する情報処理装置。
3. As a mechanism for supporting the use of a subroutine, there is no dedicated stack pointer, a subroutine read instruction using a general-purpose register and a subroutine return instruction are provided, and the address of the branch instruction and the branch destination address of the branch instruction are paired. In an information processing apparatus having a branch history table stored in memory, an instruction decoding means for detecting the subroutine read instruction and the subroutine return instruction, and an instruction fetch address and the subroutine return instruction in response to the output of the instruction decoding means. The first selector means for switching the address generated in step 1, the second sector means for selecting the register number of the general-purpose register used in place of the stack pointer in generating the address, and the instruction being executed in executing the instruction. If there is a predetermined branch instruction, the corresponding Address where the branch instruction was stored, and when the instruction being executed is the subroutine read instruction, third selector means for selecting a return address stored by the subroutine read instruction, and store address generation by the subroutine read instruction At this time, fourth selector means for selecting the register number of the general-purpose register used instead of the stack pointer, and fifth selector means for switching the branch destination address of the branch instruction and the return address stored by the subroutine read instruction. The branch history table means using the outputs of the first and second selector means as index keys, the outputs of the third and fourth selector means as registration keys, and the output of the fifth selector means as registration data An information processing apparatus having a branch history table.
JP4213853A 1992-08-11 1992-08-11 Information processing apparatus having branch history table Expired - Fee Related JP2929853B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4213853A JP2929853B2 (en) 1992-08-11 1992-08-11 Information processing apparatus having branch history table

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4213853A JP2929853B2 (en) 1992-08-11 1992-08-11 Information processing apparatus having branch history table

Publications (2)

Publication Number Publication Date
JPH0659888A true JPH0659888A (en) 1994-03-04
JP2929853B2 JP2929853B2 (en) 1999-08-03

Family

ID=16646107

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4213853A Expired - Fee Related JP2929853B2 (en) 1992-08-11 1992-08-11 Information processing apparatus having branch history table

Country Status (1)

Country Link
JP (1) JP2929853B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6530016B1 (en) 1998-12-10 2003-03-04 Fujitsu Limited Predicted return address selection upon matching target in branch history table with entries in return address stack
JP2009176177A (en) * 2008-01-28 2009-08-06 Meidensha Corp Programmable controller

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6530016B1 (en) 1998-12-10 2003-03-04 Fujitsu Limited Predicted return address selection upon matching target in branch history table with entries in return address stack
US7350062B2 (en) 1998-12-10 2008-03-25 Fujitsu Limited Predicted return address from return stack entry designated by computation unit with multiple inputs including return hit flag and re-fetch signal
US7925870B2 (en) 1998-12-10 2011-04-12 Fujitsu Limited Return target address prediction by moving entry pointer to return stack popped at completion to deeper one at return instruction fetch
JP2009176177A (en) * 2008-01-28 2009-08-06 Meidensha Corp Programmable controller

Also Published As

Publication number Publication date
JP2929853B2 (en) 1999-08-03

Similar Documents

Publication Publication Date Title
JP3871883B2 (en) Method for calculating indirect branch targets
JP3649470B2 (en) Data processing device
JP3599409B2 (en) Branch prediction device
JP2018063684A (en) Branch predictor
JPS63175934A (en) Data processor
JPS589455B2 (en) Microprogrammed data processing system with multiple length address configuration
WO1995016954A1 (en) Apparatus for processing instruction in computer system
JPH1091435A (en) Processor executing two types of instruction length codes and instruction code input device therefor
JP2507638B2 (en) Data processing device
JP2006520964A (en) Method and apparatus for branch prediction based on branch target
JP2006520964A5 (en)
JP2004030015A (en) Information processor and electronic equipment
JP2004030137A (en) Information processor and electronic equipment
JPH03233630A (en) Information processor
JP3345787B2 (en) Data processing device
JP2929853B2 (en) Information processing apparatus having branch history table
US6401108B1 (en) Floating point compare apparatus and methods therefor
JP2002312162A (en) Processor and processor system
JPH06161779A (en) Interruption control system for data processor
US9569220B2 (en) Processor branch cache with secondary branches
JPH1153189A (en) Operation unit, operation method and recording medium readable by computer
GB2527643A (en) Security domain prediction
JP3147884B2 (en) Storage device and information processing device
US7340587B2 (en) Information processing apparatus, microcomputer, and electronic computer
JPH06332701A (en) Information processor

Legal Events

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 19990420

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090521

Year of fee payment: 10

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100521

Year of fee payment: 11

LAPS Cancellation because of no payment of annual fees