JP3168657B2 - Branch instruction control circuit - Google Patents
Branch instruction control circuitInfo
- Publication number
- JP3168657B2 JP3168657B2 JP00441492A JP441492A JP3168657B2 JP 3168657 B2 JP3168657 B2 JP 3168657B2 JP 00441492 A JP00441492 A JP 00441492A JP 441492 A JP441492 A JP 441492A JP 3168657 B2 JP3168657 B2 JP 3168657B2
- Authority
- JP
- Japan
- Prior art keywords
- register
- instruction
- address
- branch
- reg
- 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.)
- Expired - Fee Related
Links
Landscapes
- Advance Control (AREA)
- Executing Machine-Instructions (AREA)
Description
【0001】[0001]
【産業上の利用分野】本発明は、レジスタファイル(RE
G) の値を分岐先の命令アドレスとする分岐を行う命令
(レジスタ分岐命令) を備えた情報処理装置の分岐命令
制御回路に関する。The present invention relates to a register file (RE)
Instruction that performs branching using the value of (G) as the instruction address of the branch destination
(Register branch instruction).
【0002】一般に、情報処理装置においては、サブル
ーチンからのリタン時に使用される分岐命令は、レジス
タファイル(REG) の特定のレジスタ、例えば、レジスタ
番号が、該レジスタファイル(REG) の最終番号であるレ
ジスタで、該リタン先が与えられることが多い。Generally, in an information processing apparatus, a branch instruction used when returning from a subroutine is a specific register of a register file (REG), for example, the register number is the last number of the register file (REG). The return destination is often given by a register.
【0003】これは、プログラム間のインタフェースを
取りやすいようにする為に固定化された結果であり、コ
ンパイラも、該レジスタ分岐命令は、決まったレジスタ
番号しか使用しないことが多い。This is a fixed result in order to make it easy to provide an interface between programs, and the compiler often uses only a fixed register number for the register branch instruction.
【0004】この点に着目すると、該リタンアドレスを
保持するレジスタ番号(RARN)のレジスタに限って、特別
なコピーレジスタ(RAR) を備えることで、該レジスタフ
ァイル(REG) の読み出しサイクルでの読み出し結果を待
つことなく、リタンアドレスを生成することができ、レ
ジスタ分岐の高速化を行うことが期待できる。Focusing on this point, by providing a special copy register (RAR) only for the register of the register number (RARN) holding the return address, the register file (REG) can be read in a read cycle. The return address can be generated without waiting for the result, and it can be expected that the register branching speeds up.
【0005】[0005]
【従来の技術】図6〜図8は、従来の分岐動作を説明す
る図であり、図6はレジスタ分岐の場合を示し、図7
は、命令バッファとプログラムカウンタ(PC)を使用する
相対分岐の場合を示し、図8は、命令バッファ(IB)と、
専用レジスタポートを使用して高速分岐を行う場合を示
している。2. Description of the Related Art FIGS. 6 to 8 are diagrams for explaining a conventional branch operation. FIG. 6 shows a case of a register branch.
8 shows a case of a relative branch using an instruction buffer and a program counter (PC). FIG.
A case where a high-speed branch is performed using a dedicated register port is shown.
【0006】又、ここでは、所謂、パイプライン制御の
情報処理装置を例にしており、「Inst Fetch」は命令フ
ェッチステートを示し、「Decode」はデコードステート
を示し、「Execute 」は実行ステートで、具体的には、
メモリアクセス命令では、オペランドアドレス計算を行
い、その他の命令では、算術演算,論理演算等を行うス
テートを示し、「Data Fetch」はオペランドデータフェ
ッチのステートを示し、「Write 」は、レジスタファイ
ル(REG) への書き込みステートを示している。Here, a so-called pipeline-controlled information processing device is taken as an example. "Inst Fetch" indicates an instruction fetch state, "Decode" indicates a decode state, and "Execute" indicates an execution state. ,In particular,
The memory access instruction calculates the operand address, the other instructions indicate a state in which an arithmetic operation, a logical operation, and the like are performed, “Data Fetch” indicates the state of operand data fetch, and “Write” indicates a register file (REG file). ).
【0007】サブルーチンから帰る (リタン) 時に使用
される分岐命令は、一般には、レジスタファイル(REG)
1 の特定のレジスタ番号のレジスタ{例えば、該レジス
タファイル(REG) 1 が16個のレジスタで構成されている
場合には、レジスタ番号が“15”のレジスタ}で分岐
先(リタン先)が与えられる。A branch instruction used when returning from a subroutine (return) is generally a register file (REG).
1 (for example, when the register file (REG) 1 is composed of 16 registers, the register number is “15”) and the branch destination (return destination) is given. Can be
【0008】[0008]
【発明が解決しようとする課題】図6は、該レジスタ分
岐の動作を模式的に示しており、分岐命令(BRANCH)は、
該レジスタファイル(REG) 1 を参照して、分岐先のアド
レスを認識し、分岐を行う為、図示されている如くに、
パイプラインを乱し、パイプラインの実行が遅くなる。
本例では、1τの遅れがある。FIG. 6 schematically shows the operation of the register branch. The branch instruction (BRANCH) is
Referring to the register file (REG) 1 to recognize the address of the branch destination and perform the branch, as shown in the figure,
Disrupts the pipeline and slows down the execution of the pipeline.
In this example, there is a delay of 1τ.
【0009】然しながら、命令バッファ(IB) 5とプログ
ラムカウンタ(PC) 6を使用した相対分岐や,命令バッフ
ァ(IB) 5を使用する絶対分岐の場合は、パイプラインに
よる先読みを行った命令バッファ(IB) 5の内容を使用
し、専用のアドレス加算器 7によって、前述の「Inst F
etch」ステートでアドレス計算を行うことにより、図7
に示されている如くに、該分岐によるパイプラインの遅
れを無くすことができる。However, in the case of a relative branch using the instruction buffer (IB) 5 and the program counter (PC) 6 or an absolute branch using the instruction buffer (IB) 5, the instruction buffer (read ahead) performed by the pipeline is used. IB) 5 and the above-mentioned “Inst F
By performing the address calculation in the "etch" state,
As shown in (1), the delay of the pipeline due to the branch can be eliminated.
【0010】前述のレジスタによる分岐の場合も、上記
先読みを行った命令バッファ(IB) 5の内容を使用し、専
用のレジスタ読み出しポート 10aによって該分岐アドレ
スの生成を行うことにより、図8に示されている如く
に、該パイプラインの流れを乱すことを無くすることが
できるが、レジスタファイル(REG) 1 に専用の読み出し
ポート 10aを必要とし、物量の増加や、レジスタファイ
ル(REG) 1 の出力ポートセレクタが複雑になることによ
り、該ポートのアクセスタイムの増加につながり、ひい
ては、マシンサイクルを増加させる要因ともなるという
問題があった。Also in the case of branching by the above-mentioned register, the contents of the prefetched instruction buffer (IB) 5 are used and the branch address is generated by the dedicated register read port 10a, as shown in FIG. As described above, it is possible to prevent the flow of the pipeline from being disturbed.However, a dedicated read port 10a is required for the register file (REG) 1, which increases the physical quantity and increases the capacity of the register file (REG) 1. The complexity of the output port selector leads to an increase in the access time of the port, resulting in a problem of increasing the machine cycle.
【0011】本発明は上記従来の欠点に鑑み、レジスタ
ファイル(REG) の値を分岐先の命令アドレスとする分岐
を行う命令 (レジスタ分岐命令) を備えた情報処理装置
の分岐命令制御回路において、レジスタポートの増加
や, アクセスタイムの増加を抑止することができる分岐
命令制御回路を提供することを目的とするものである。The present invention has been made in view of the above-mentioned conventional drawbacks, and provides a branch instruction control circuit of an information processing apparatus provided with an instruction (register branch instruction) for performing a branch using a value of a register file (REG) as a branch destination instruction address. It is an object of the present invention to provide a branch instruction control circuit capable of suppressing an increase in register ports and an increase in access time.
【0012】[0012]
【課題を解決するための手段】図1は、本発明の原理構
成図である。上記の問題点は下記の如くに構成した分岐
命令制御回路によって解決される。FIG. 1 is a block diagram showing the principle of the present invention. The above problem is solved by a branch instruction control circuit configured as follows.
【0013】プログラムで読み書きする複数のレジスタ
からなるレジスタファイル(REG) 1の特定のレジスタ 10
の値を分岐先の命令アドレスとする分岐を行うレジス
タ分岐命令を備えた情報処理装置において、該レジスタ
ファイル(REG) 1 の特定のレジスタ 10 と、同じ内容を
持つコピーレジスタ(RAR) 2 と、先読みされている命令
が分岐命令であって、該分岐命令の分岐先アドレスを示
すレジスタアドレスフィールドの値と、上記特定のレジ
スタ 10 のアドレスとの一致を検出するリターンアドレ
ス一致検出回路A 30 と、該レジスタファイル(REG) 1
に対する書き込みアドレスと、上記特定のレジスタ 10
のアドレスとの一致を検出する書き込みアドレス一致検
出回路B 31 と、上記レジスタファイル(REG) 1 の読み
出しデータと、上記コピーレジスタ(RAR) 2 の出力デー
タと、命令アドレス加算回路(IF ADDER) 7等によって
生成された命令アドレスとを、上記リターンアドレス一
致検出回路A 30 のアドレス一致信号と、命令フェッ
チ制御信号とによって制御して選択し、命令フェッチ
アドレスを出力する命令フェッチアドレス選択回路(IF
ADRS SELECT) 3とを備えて、上記書き込みアドレス一致
検出回路B 31 からの書き込みアドレス一致検出信号
が得られた時には、上記コピーレジスタ(RAR) 2 に、上
記レジスタファイル(REG) 1 の特定のレジスタ 10 に書
き込むデータと同じデータを書き込み、上記命令フェ
ッチ制御信号がレジスタ分岐命令の実行を指示してい
て、上記リターンアドレス一致検出回路A 30 からのア
ドレス一致信号が得られたとき、上記コピーレジスタ
(RAR) 2 の値を、上記命令フェッチアドレス選択回路
(IF ADRS SELECT) 3で選択して出力し、上記命令フェッ
チ制御信号がレジスタ分岐命令の実行を指示してい
て、上記リターンアドレス一致検出回路A 30 からのア
ドレス一致信号が得られなかったとき、上記レジスタ
ファイル(REG) 1 の値を、上記命令フェッチアドレス選
択回路(IF ADRS SELECT) 3で選択して出力するように構
成する。A specific register 10 of a register file (REG) 1 comprising a plurality of registers to be read and written by a program 10
In the information processing apparatus provided with a register branch instruction for performing a branch having the value of the branch destination as an instruction address, a specific register 10 of the register file (REG) 1, a copy register (RAR) 2 having the same contents, A prefetched instruction is a branch instruction, and a return address match detection circuit A30 for detecting a match between a value of a register address field indicating a branch destination address of the branch instruction and an address of the specific register 10; The register file (REG) 1
And the specific register 10
A write address match detection circuit B 31 for detecting a match with the address of the register file (REG) 1, output data of the copy register (RAR) 2, and an instruction address addition circuit (IF ADDER) 7. The instruction fetch address selection circuit (IF) that selects and selects the instruction address generated by the above-described method by controlling the address coincidence signal of the return address coincidence detection circuit A 30 and the instruction fetch control signal to output the instruction fetch address.
ADRS SELECT) 3 and when a write address match detection signal is obtained from the write address match detection circuit B 31, a specific register of the register file (REG) 1 is stored in the copy register (RAR) 2. 10, the same data as the data to be written into the copy register is written. When the instruction fetch control signal instructs execution of the register branch instruction and the address match signal from the return address match detection circuit A 30 is obtained,
(RAR) 2
(IF ADRS SELECT) 3 and output. When the instruction fetch control signal indicates the execution of the register branch instruction and the address match signal from the return address match detection circuit A 30 is not obtained, The value of the register file (REG) 1 is selected and output by the instruction fetch address selection circuit (IF ADRS SELECT) 3.
【0014】[0014]
【作用】前述のように、多くの場合、サブルーチンから
帰る(リタン)時に必要なリタンアドレスを保持するレ
ジスタファイル(REG) 1 のレジスタ番号は、プログラム
間のインタフェースが取り易いように、例えば、該レジ
スタファイル(REG) 1 の数が、16個の時には、第16番目
のレジスタ(即ち、レジスタ番号が“15”のレジス
タ)と固定されている。As described above, in many cases, the register number of the register file (REG) 1 holding the required return address when returning from the subroutine (return) is set to, for example, When the number of register files (REG) 1 is 16, it is fixed to the 16th register (that is, the register whose register number is “15”).
【0015】従って、コンパイラ等も、レジスタ分岐命
令は決まったレジスタ番号しか使用しないことが殆どで
ある。本発明は、プログラム中のレジスタ分岐命令の動
作に、この事象があることに着目して、レジスタファイ
ル(REG) 1 中の、このリタンアドレスを保持している特
定のレジスタ番号(RARN)のレジスタ 10 に限って、特別
なコピーレジスタ(RAR) 2 を設けて、先読みされている
レジスタ分岐命令が指示しているレジスタ番号が、上記
特定のレジスタ 10 のレジスタ番号 (例えば、上記の15
番)(RARN) と一致していることを検出するリターンアド
レス一致検出回路A 30 からのアドレス一致信号が得
られた時、上記コピーレジスタ(RAR) 2 の値を使用し
て分岐アドレスを生成するようにして、レジスタファイ
ル(REG) 1 からの読み出し出力を使用することなく、レ
ジスタ分岐を高速に行うようにしたものである。Therefore, most compilers and the like only use a fixed register number for a register branch instruction. The present invention focuses on the fact that there is this phenomenon in the operation of a register branch instruction in a program, and in the register file (REG) 1, a register of a specific register number (RARN) holding this return address. 10 only, a special copy register (RAR) 2 is provided so that the register number indicated by the prefetched register branch instruction is the register number of the specific register 10 (for example, 15
When an address match signal is obtained from the return address match detection circuit A 30 for detecting the match with the (RARN), a branch address is generated using the value of the copy register (RAR) 2. In this way, register branching is performed at high speed without using the read output from the register file (REG) 1.
【0016】当然のことながら、本発明においては、該
レジスタファイル(REG) 1 の上記特定のレジスタ 10 に
対する書き込み指示があったときには、同じ書き込みデ
ータを当該コピーレジスタ(RAR) 2 にも書き込んでおく
ようにしておく必要がある。Naturally, in the present invention, when there is a write instruction to the specific register 10 of the register file (REG) 1, the same write data is also written to the copy register (RAR) 2. It is necessary to keep it.
【0017】但し、該レジスタ分岐命令であっても、該
レジスタ分岐命令が指示するレジスタ番号が、上記特定
のレジスタの番号(RARN)と一致しなくで、上記コピーレ
ジスタ(RAR) 2 を使用できない時には、従来のレジスタ
ファイル(REG) 1 を使用するレジスタ分岐を行う。However, even with the register branch instruction, the register number specified by the register branch instruction does not match the specific register number (RARN), and the copy register (RAR) 2 cannot be used. Occasionally, a register branch using the conventional register file (REG) 1 is performed.
【0018】従って、本発明によれば、レジスタファイ
ル(REG) 1 のレジスタ出力ポート 10aを増加させること
なく、又、該レジスタ出力ポート 10aのアクセスタイム
を増加させることなく、レジスタ分岐の高速化を行うこ
とができる効果がある。Therefore, according to the present invention, the speed of register branch can be increased without increasing the register output port 10a of the register file (REG) 1 and without increasing the access time of the register output port 10a. There are effects that can be performed.
【0019】又、本発明による、上記分岐命令制御回路
によれば、当該特定のレジスタ 10に対するレジスタ干
渉が発生した場合においても、後述するように、特別な
回路を使用することなく、従来と同じバイパス回路を使
用して、高速にレジスタ分岐を行うことができ、本発明
を妨げる要因になることはない。Further, according to the branch instruction control circuit according to the present invention, even when register interference with the specific register 10 occurs, the same operation as in the related art can be performed without using a special circuit, as described later. By using the bypass circuit, register branching can be performed at high speed, which does not hinder the present invention.
【0020】[0020]
【実施例】以下本発明の実施例を図面によって詳述す
る。前述の図1が、本発明の原理構成図であり、図2,
図3は、本発明の一実施例を示した図であって、図2
は、動作フローを示し、図3は、命令アドレス選択回路
の論理条件を示している。又、図4,図5はレジスタ干
渉がある場合のレジスタ分岐の動作を示した図であり、
図4はレジスタ分岐命令の前の命令がロード命令の場合
を示し、図5はレジスタ分岐命令の前の命令が演算命令
の場合を示している。BRIEF DESCRIPTION OF THE DRAWINGS FIG. FIG. 1 described above is a principle configuration diagram of the present invention.
FIG. 3 is a diagram showing one embodiment of the present invention, and FIG.
Shows an operation flow, and FIG. 3 shows a logical condition of the instruction address selection circuit. FIGS. 4 and 5 are diagrams showing the operation of register branching when there is register interference.
FIG. 4 shows the case where the instruction before the register branch instruction is a load instruction, and FIG. 5 shows the case where the instruction before the register branch instruction is an operation instruction.
【0021】本発明においては、プログラムで読み書き
する複数のレジスタからなるレジスタファイル(REG) 1
の特定のレジスタ 10 の値を分岐先の命令アドレスとす
る分岐を行うレジスタ分岐命令を備えた情報処理装置に
おいて、該レジスタファイル(REG) 1 の特定のレジスタ
10 と、同じ内容を持つコピーレジスタ(RAR) 2 と、先
読みされている命令が分岐命令であって、該分岐命令の
分岐先アドレスを示すレジスタアドレスフィールドの値
と、上記特定のレジスタ 10 のアドレスとの一致を検出
するリターンアドレス一致検出回路A 30 と、該レジス
タファイル(REG) 1 に対する書き込みアドレスと、上記
特定のレジスタ 10 のアドレスとの一致を検出する書き
込みアドレス一致検出回路B 31 と、上記レジスタファ
イル(REG) 1 の読み出しデータと、上記コピーレジスタ
(RAR) 2 の出力データと、命令アドレス加算回路(IF
ADDER) 7等によって生成された命令アドレスとを、上記
リターンアドレス一致検出回路A 30 のアドレス一致信
号と、命令フェッチ制御信号とによって制御して選
択し、命令フェッチアドレスを出力する命令フェッチア
ドレス選択回路 3が、本発明を実施するのに必要な手段
である。尚、全図を通して同じ符号は同じ対象物を示し
ている。In the present invention, a register file (REG) 1 comprising a plurality of registers to be read and written by a program 1
In the information processing apparatus provided with a register branch instruction for performing a branch using the value of the specific register 10 as a branch destination instruction address, the specific register of the register file (REG) 1
10, a copy register (RAR) 2 having the same contents, a value of a register address field indicating a branch destination address of the branch instruction where the prefetched instruction is a branch instruction, and an address of the specific register 10. A return address match detection circuit A 30 for detecting a match with the register file (REG) 1, a write address match detection circuit B 31 for detecting a match between the write address for the register file (REG) 1 and the address of the specific register 10, Register file (REG) 1 read data and the above copy register
(RAR) 2 output data and the instruction address adder (IF
ADDER) An instruction fetch address selection circuit for controlling and selecting an instruction address generated by 7 or the like by using an address match signal of the return address match detection circuit A 30 and an instruction fetch control signal, and outputting an instruction fetch address. 3 is the means necessary to carry out the present invention. Note that the same reference numerals indicate the same object throughout the drawings.
【0022】以下、図1を参照しながら、図2〜図5を
用いて、本発明の分岐命令制御回路の構成と動作を説明
する。先ず、図3は、図1に示した本発明の分岐命令制
御回路の、特に、命令アドレス選択回路(IF ADRS SELEC
T) 3の選択論理を示している。Hereinafter, the configuration and operation of the branch instruction control circuit according to the present invention will be described with reference to FIGS. First, FIG. 3 shows the branch instruction control circuit according to the present invention shown in FIG. 1, particularly, an instruction address selection circuit (IF ADRS SELEC).
T) The selection logic of 3 is shown.
【0023】先読みされているレジスタ分岐命令(Regis
ter-Branch-Instruction) の分岐先アドレスを示すレジ
スタの番号(Return-reg-adrs) が、レジスタファイル(R
EG)1 の特定のレジスタ 10 の番号(RARN)を指示してい
て、前述のリターンアドレス一致検出回路A 30 からア
ドレス一致検出信号が出力された場合には、本発明の
コピーレジスタ(RAR) 2 の出力データを、分岐先の命
令フェッチアドレスとして出力(*で示す)し、上記リ
ターンアドレス一致検出回路A 30 からアドレス一致検
出信号が出力されなかった場合には、レジスタファイ
ル(REG) 1 の読み出しが終了した時点において、その読
み出しデータを、該分岐先の命令フェッチアドレスとし
て出力(**で示す)する。A prefetched register branch instruction (Regis
The register number (Return-reg-adrs) indicating the branch destination address of (ter-Branch-Instruction) is stored in the register file (R
EG) 1 indicating the number (RARN) of the specific register 10 and when the address match detection signal is output from the return address match detection circuit A 30 described above, the copy register (RAR) 2 of the present invention is used. Is output as the instruction fetch address of the branch destination (indicated by *). If the address match detection signal is not output from the return address match detection circuit A 30, the register file (REG) 1 is read. Is completed, the read data is output (indicated by **) as the instruction fetch address of the branch destination.
【0024】又、レジスタ分岐でない分岐命令(Non-Reg
ister-Branch-Instruction) の場合には、図1に示した
専用の命令アドレス加算回路(IF ADDER) 7の出力であ
る、プログラムカウンタ(PC)+相対値(OFFSET)の値を出
力(#で示す)し、分岐命令でない場合(Non-Branch-In
struction)には、プログラムカウンタ(PC)+命令長(LEN
GTH of INSTRUCTION) の値を出力(##で示す)する。A non-register branch instruction (Non-Reg
In the case of ister-Branch-Instruction), the value of the program counter (PC) + the relative value (OFFSET), which is the output of the dedicated instruction address adder (IF ADDER) 7 shown in FIG. Shown), but not a branch instruction (Non-Branch-In
struction) contains the program counter (PC) + instruction length (LEN
GTH of INSTRUCTION) is output (indicated by ##).
【0025】尚、上記命令アドレス選択回路(IF ADRS S
ELECT) 3の論理には直接関係しないが、該図1におい
て、該レジスタファイル(REG) 1 に対する書き込みアド
レスと、上記特定のレジスタ 10 のアドレスとの一致を
検出する書き込みアドレス一致検出回路B 31 で一致が
とれた場合 (一致信号が出力された場合) には、該レ
ジスタファイル(REG) 1 の特定のレジスタ番号(RARN)の
レジスタ 10 に書き込むデータ(Write Data)と同じデ
ータを、本発明のコピーレジスタ(RAR) 2 にも書き込む
ように動作する。The instruction address selection circuit (IF ADRS S
Although not directly related to the logic of (ELECT) 3, in FIG. 1, a write address match detection circuit B 31 detects a match between a write address for the register file (REG) 1 and an address of the specific register 10. When a match is obtained (when a match signal is output), the same data as the data (Write Data) to be written to the register 10 of the specific register number (RARN) of the register file (REG) 1 is written according to the present invention. It operates to write to the copy register (RAR) 2.
【0026】上記のように動作する本発明の分岐命令制
御回路によるレジスタ分岐の動作を、図2の動作フロー
で以下に説明する。 1)先ず、命令バッファ(IB) 5に先読みされている命令
を、「Inst Fetch」ステートでプリデコードし、レジス
タ分岐命令(BRANCH)であり、且つ、分岐先アドレスを示
すレジスタ番号が、レジスタファイル(REG) 1 の特定の
レジスタの番号(RARN)と一致することが、図2のリタ−
ンアドレス一致検出回路A 30 で検出された場合(即
ち、RAR にヒットした場合)、そのアドレス一致信号
によって、コピーレジスタ(RAR) 2 の値を、分岐先の命
令のアドレスとして、「Decode」ステートでプログラム
カウンタ(PC)にセットすると共に、命令フェッチアドレ
スとして使用する。The operation of register branching by the branch instruction control circuit of the present invention which operates as described above will be described below with reference to the operation flow of FIG. 1) First, the instruction prefetched in the instruction buffer (IB) 5 is pre-decoded in the “Inst Fetch” state, and the register branch instruction (BRANCH) and the register number indicating the branch destination address are stored in the register file. (REG) 1 coincides with the specific register number (RARN) of FIG.
When the address match detection circuit A 30 detects the address (ie, when the RAR is hit), the address match signal causes the value of the copy register (RAR) 2 to be used as the address of the instruction at the branch destination and the “Decode” state And set it to the program counter (PC) and use it as the instruction fetch address.
【0027】このとき、多くの場合、該命令フェッチア
ドレスは、図2の動作フローにも示されているように、
命令キャッシュメモリ(ICACHE) 8のアドレスとして使用
される。At this time, in many cases, the instruction fetch address is, as shown in the operation flow of FIG.
Used as the address of the instruction cache memory (ICACHE) 8.
【0028】2) 命令バッファ(IB) 5に先読みされてい
る命令を、「Inst Fetch」ステートでプリデコードし、
レジスタ分岐命令(BRANCH)であるが、分岐先アドレスを
示すレジスタ番号が、レジスタファイル(REG) 1 の特定
のレジスタの番号(RARN)と一致しなかった場合 (即ち、
RAR にヒットしなかった場合) 、図2の動作フローに示
されている如く、該分岐先の命令を1τ停止(即ち、イ
ンタロックして)該レジスタ分岐命令(BRANCH)がレジス
タファイル(REG) 1 を読み出すのを待ち、該レジスタフ
ァイル(REG) 1 の読み出しが終了したら、その値を、該
分岐先命令のアドレスとして決定して、該分岐先命令の
「Inst Fetch」ステートでプログラムカウンタ(PC) 6に
設定して、命令フェッチアドレスとして使用する。2) Predecode the instruction prefetched in the instruction buffer (IB) 5 in the "Inst Fetch" state,
A register branch instruction (BRANCH), but the register number indicating the branch destination address does not match the specific register number (RARN) of the register file (REG) 1 (i.e.,
When the RAR is not hit), as shown in the operation flow of FIG. 2, the instruction at the branch destination is stopped by 1τ (that is, interlocked) and the register branch instruction (BRANCH) is registered in the register file (REG). Waiting to read 1 and when the reading of the register file (REG) 1 is completed, the value is determined as the address of the branch target instruction, and the program counter (PC) is set in the “Inst Fetch” state of the branch target instruction. ) Set to 6 to use as an instruction fetch address.
【0029】該命令バッファ(IB) 5に先読みされている
命令をプリデコードして、レジスタ分岐命令(BRANCH)で
なかった場合には、従来と同じ制御とする。即ち、 3) 命令バッファ(IB) 5に先読みされている命令を、「I
nst Fetch」ステートでプリデコードし、レジスタ分岐
命令以外の分岐命令であった場合には、該先読みした命
令バッファ(IB) 5の分岐先アドレスを生成するフィール
ドと、プログラムカウンタ(PC) 6などから、「Inst Fet
ch」ステートで、前述の命令アドレス加算回路(多くの
場合は、加算器で構成されている)(IF ADDER) 7 を使用
して、該分岐先命令のアドレスを生成し、該分岐先命令
(後続命令)の「Inst Fetch」ステートでプログラムカ
ウンタ(PC) 6に設定して、命令フェッチアドレスとして
使用する。{図7参照} 4) 命令バッファ(IB) 5に先読みされている命令を、「I
nst Fetch」ステートでプリデコードし、分岐命令以外
の命令であった場合には、プログラムカウンタ(PC) 6
と、該命令バッファ(IB) 5にセットされている命令の命
令長等から、後続する命令のアドレスを生成して、次の
命令の「Inst Fetch」ステートでプログラムカウンタ(P
C) 6に設定して、命令フェッチアドレスとして使用す
る。The instruction prefetched in the instruction buffer (IB) 5 is pre-decoded, and if the instruction is not a register branch instruction (BRANCH), the same control as in the prior art is performed. 3) Instruction buffer (IB) 5
In the case of a branch instruction other than a register branch instruction by pre-decoding in the `` nst Fetch '' state, a field for generating a branch destination address of the prefetched instruction buffer (IB) 5 and a program counter (PC) 6 etc. , "Inst Fet
In the "ch" state, the address of the branch destination instruction is generated using the above-mentioned instruction address addition circuit (often constituted by an adder) (IF ADDER) 7 and the branch destination instruction ( In the “Inst Fetch” state of the following instruction), the program counter (PC) 6 is set and used as an instruction fetch address. << Refer to Fig. 7 >> 4) The instruction read ahead in the instruction buffer (IB)
When the instruction is pre-decoded in the “nst Fetch” state and the instruction is not a branch instruction, the program counter (PC) 6
When, the instruction length and the like of the instruction set in the instruction buffer (IB) 5, and generates the address of the instruction subsequent, "Inst Fetch" state in the program counter of the next instruction (P
C) Set to 6 to use as an instruction fetch address.
【0030】本発明の上記コピーレジスタ(RAR) 2 への
書き込みは、書き込みレジスタの番号が、上記レジスタ
ファイル(REG) 1 の特定のリタンアドレスの番号(RARN)
であった場合 (即ち、図1の前述の書き込みアドレス一
致検出回路B 31 から一致検出信号が得られた場合)
に行う。When writing to the copy register (RAR) 2 according to the present invention, the number of the write register is the number (RARN) of the specific return address of the register file (REG) 1.
(That is, when a match detection signal is obtained from the write address match detection circuit B 31 in FIG. 1).
To do.
【0031】従って、先行命令が、該コピーレジスタ(R
AR) 2 に書き込みを行う場合には、レジスタ干渉が起こ
り、通常は、該コピーレジスタ(RAR) 2 の値が正しくな
るまで、上記レジスタ分岐命令(BRANCH)の、該コピーレ
ジスタ(RAR) 2 の値による分岐先アドレスをプログラム
カウンタ(PC) 6へ設定することができない。Therefore, the preceding instruction sets the copy register (R
When writing to (AR) 2, register interference occurs.Normally, until the value of the copy register (RAR) 2 becomes correct, the register branch instruction (BRANCH) of the copy register (RAR) 2 The branch destination address by value cannot be set in the program counter (PC) 6.
【0032】この場合の動作を、図4,図5に示す。図
4は、該先行命令がロード(LOAD)命令の場合を示してお
り、図4に示されている如くに、該レジスタ分岐命令(B
RANCH)は、「Decode」ステートでインタロックされる。The operation in this case is shown in FIGS. FIG. 4 shows a case where the preceding instruction is a load (LOAD) instruction. As shown in FIG. 4, the register branch instruction (B
RANCH) is interlocked in the "Decode" state.
【0033】通常の動作では、分岐命令であるか演算命
令であるかに係わらず、レジスタファイル(REG) 1 を参
照する命令であると、該レジスタ干渉がある場合には、
インタロックするように構成されている。従って、該レ
ジスタ分岐命令(BRANCH)だけレジスタ干渉によるインタ
ロックを回避するように制御しようとすると、該当の回
路が複雑になってしまうだけで、後続命令の開始タイミ
ングに良い効果を与えない。In a normal operation, regardless of whether the instruction is a branch instruction or an operation instruction, if the instruction refers to the register file (REG) 1, if the register interference occurs,
It is configured to interlock. Therefore, if an attempt is made to control only the register branch instruction (BRANCH) so as to avoid the interlock due to the register interference, the corresponding circuit becomes complicated and does not have a good effect on the start timing of the subsequent instruction.
【0034】即ち、本発明を適用した分岐制御回路にお
いても、図4に示されている如くに、先行命令と当該レ
ジスタ分岐命令(BRANCH)との間にレジスタ干渉がある場
合には、従来と同じバイパス回路を使用することによ
り、高速なレジスタ分岐を行うことができる。この場
合、前述の命令フェッチアドレス選択回路(IF ADRS SEL
ECT) 3では、図3の選択論理に示されているように、レ
ジスタファイル(REG) 1へのライトデータ(Write Data)
が選択されることになる。That is, in the branch control circuit to which the present invention is applied, as shown in FIG. 4, when there is register interference between the preceding instruction and the register branch instruction (BRANCH), the conventional control is not performed. By using the same bypass circuit, high-speed register branching can be performed. In this case, the instruction fetch address selection circuit (IF ADRS SEL
ECT) 3, as shown in the selection logic of FIG. 3, write data (Write Data) to the register file (REG) 1
Will be selected.
【0035】従って、本発明を適用しても、レジスタ干
渉制御の為に、更なる回路の追加や変更が不要であり、
本発明を妨げる要因になることはない。上記の図4は、
先行命令がロード命令の場合を示しているが、図5は、
該先行命令が演算命令(ADD) の場合を示している。図4
の場合と同じように、バイパス回路を使用して高速な
レジスタ分岐が行われている。Therefore, even if the present invention is applied, it is not necessary to add or change a further circuit for register interference control.
It does not hinder the present invention. In FIG. 4 above,
FIG. 5 shows a case where the preceding instruction is a load instruction.
The case where the preceding instruction is an operation instruction (ADD) is shown. FIG.
As in the case of (1), a high-speed register branch is performed using a bypass circuit.
【0036】上記レジスタ干渉が発生した際の高速動作
を行う為のバイパス回路が存在しない情報処理装置に
おいては、一度、レジスタファイル(REG) 1,及び、コピ
ーレジスタ(RAR) 2 に書き込みを行ってからアドレス生
成を行えばよく、この場合も、回路の増加や, 変更はな
い。又、当然のことながら、上記のように、パイプライ
ン制御をしない場合も、該コピーレジスタ(RAR) 2 の効
果は変わることはなく、又、追加量も変わることはな
い。In an information processing apparatus that does not have a bypass circuit for performing high-speed operation when the register interference occurs, writing to the register file (REG) 1 and the copy register (RAR) 2 is performed once. The address generation may be performed from this point, and in this case, the circuit is not increased or changed. Of course, as described above, even when the pipeline control is not performed, the effect of the copy register (RAR) 2 does not change, and the added amount does not change.
【0037】このように、本発明は、レジスタファイル
(REG) の値を分岐先の命令アドレスとする分岐を行う命
令 (レジスタ分岐命令) を備えた情報処理装置の分岐命
令制御回路において、サブルーチンからの帰りアドレス
であるリタンアドレスを保持するレジスタ番号(RARN)の
レジスタファイル(REG) に対応して、コピーレジスタ(R
AR) を設け、先読みされている命令が、レジスタ分岐命
令であって、該レジスタ分岐命令の分岐先アドレスを示
すレジスタ番号が、上記リタンアドレスを保持するレジ
スタファイル(REG) のレジスタ番号(RARN)と一致したと
き、該コピーレジスタ(RAR) の値を次の命令 (分岐先の
命令) のアドレスとして、プログラムカウンタ(PC)にセ
ットして、命令フェッチアドレスとし、不一致の時に
は、該レジスタファイル(REG) の読み出しステートで読
み出した値を次の命令 (分岐先の命令) のアドレスとし
て、プログラムカウンタ(PC)にセットして、命令フェッ
チアドレスとして使用するようにしたところに特徴があ
る。Thus, the present invention provides a register file
In a branch instruction control circuit of an information processing apparatus provided with an instruction (register branch instruction) for performing a branch using the value of (REG) as a branch destination instruction address, a register number (return address holding a return address from a subroutine) is stored. RARN) register file (REG) and copy register (R
AR), the prefetched instruction is a register branch instruction, and the register number indicating the branch destination address of the register branch instruction is the register number (RARN) of the register file (REG) holding the return address. When the value matches, the value of the copy register (RAR) is set as the address of the next instruction (branch destination instruction) in the program counter (PC), and the instruction fetch address is used. The value read in the read state of (REG) is set as the address of the next instruction (branch destination instruction) in the program counter (PC) and used as the instruction fetch address.
【0038】[0038]
【発明の効果】以上、詳細に説明したように、本発明の
分岐命令制御回路は、サブルーチンからの帰りアドレス
であるリタンアドレスを保持するレジスタ番号(RARN)の
レジスタファイル(REG) に対応して、コピーレジスタ(R
AR) を設け、先読みされている命令が、レジスタ分岐命
令であって、該レジスタ分岐命令の分岐先アドレスを示
すレジスタ番号が、上記リタンアドレスを保持するレジ
スタファイル(REG) のレジスタ番号(RARN)と一致したと
き、該コピーレジスタ(RAR) の値を次の命令 (分岐先の
命令) のアドレスとして、プログラムカウンタ(PC)にセ
ットして、命令フェッチアドレスとし、不一致の時に
は、レジスタファイル(REG) の読み出しステートで読み
出した値を次の命令 (分岐先の命令) のアドレスとし
て、プログラムカウンタ(PC)にセットして、命令フェッ
チアドレスとして使用するようにしたものであるので、
レジスタファイル(REG) の出力ポートを増加させること
なく、又、該ポートのアクセスタイムを増加させること
なく、レジスタ分岐を高速に行うことができる効果があ
る。As described in detail above, the branch instruction control circuit of the present invention corresponds to the register file (REG) of the register number (RARN) holding the return address which is the return address from the subroutine. , Copy register (R
AR), the prefetched instruction is a register branch instruction, and the register number indicating the branch destination address of the register branch instruction is the register number (RARN) of the register file (REG) holding the return address. When the value matches, the value of the copy register (RAR) is set as the address of the next instruction (branch destination instruction) in the program counter (PC) and used as the instruction fetch address. ) Is set in the program counter (PC) as the address of the next instruction (branch destination instruction) and used as the instruction fetch address.
There is an effect that register branching can be performed at high speed without increasing the number of output ports of the register file (REG) and without increasing the access time of the port.
【図1】本発明の原理構成図FIG. 1 is a block diagram of the principle of the present invention.
【図2】本発明の一実施例を示した図(その1)FIG. 2 shows an embodiment of the present invention (part 1).
【図3】本発明の一実施例を示した図(その2)FIG. 3 shows an embodiment of the present invention (part 2).
【図4】レジスタ干渉がある場合のレジスタ分岐の動作
を示した図(その1)FIG. 4 is a diagram showing an operation of register branch when register interference occurs (part 1);
【図5】レジスタ干渉がある場合のレジスタ分岐の動作
を示した図(その2)FIG. 5 is a diagram showing an operation of register branch when register interference occurs (part 2);
【図6】従来の分岐動作を説明する図(その1)FIG. 6 is a view for explaining a conventional branch operation (part 1);
【図7】従来の分岐動作を説明する図(その2)FIG. 7 illustrates a conventional branch operation (part 2).
【図8】従来の分岐動作を説明する図(その3)FIG. 8 is a view for explaining a conventional branch operation (part 3);
1 レジスタファイル(REG) 2 コピー
レジスタ(RAR) 3 命令アドレス選択回路(IF ADRS SELECT) 30 リタ−ンアドレス一致検出回路A 31 書き込みアドレス一致検出回路B 4 命令フェッチアドレス選択回路(IF ADRS SELEC
T) 5 命令バッファ(IB) 6 プログ
ラムカウンタ(PC) 7 命令アドレス加算回路(IF ADDER) , アドレス一致検出信号 命令制御信号(IF-Control) 書き
込みデータ(Write Data) バイパス回路 コピーレジスタ(RAR) の出力1 Register file (REG) 2 Copy register (RAR) 3 Instruction address selection circuit (IF ADRS SELECT) 30 Return address match detection circuit A 31 Write address match detection circuit B 4 Instruction fetch address selection circuit (IF ADRS SELEC)
T) 5 Instruction buffer (IB) 6 Program counter (PC) 7 Instruction address adder (IF ADDER) , address match detection signal Instruction control signal (IF-Control) Write data (Write Data) Bypass circuit Copy register (RAR) output
───────────────────────────────────────────────────── フロントページの続き (56)参考文献 特開 昭54−36148(JP,A) 特開 平1−118930(JP,A) 特開 平2−121034(JP,A) 特開 平2−232726(JP,A) 特開 平3−77137(JP,A) 特開 平1−222332(JP,A) 特開 平1−258032(JP,A) 特開 平2−155038(JP,A) 特開 平4−348430(JP,A) 特開 平5−120013(JP,A) (58)調査した分野(Int.Cl.7,DB名) G06F 9/32 - 9/42 ──────────────────────────────────────────────────続 き Continuation of front page (56) References JP-A-54-36148 (JP, A) JP-A-1-118930 (JP, A) JP-A-2-121034 (JP, A) JP-A-2- 232726 (JP, A) JP-A-3-77137 (JP, A) JP-A-1-222332 (JP, A) JP-A 1-258032 (JP, A) JP-A 2-155038 (JP, A) JP-A-4-348430 (JP, A) JP-A-5-120013 (JP, A) (58) Fields investigated (Int. Cl. 7 , DB name) G06F 9/32-9/42
Claims (1)
からなるレジスタファイル(REG)(1)の特定のレジスタ(1
0)の値を分岐先の命令アドレスとする分岐を行うレジス
タ分岐命令を備えた情報処理装置において、 該レジスタファイル(REG)(1)の特定のレジスタ(10)と、
同じ内容を持つコピーレジスタ(RAR)(2)と、 先読みされている命令が分岐命令であって、該分岐命令
の分岐先アドレスを示すレジスタフィールドの値と、上
記特定のレジスタ(10)のアドレスとの一致を検出するリ
ターンアドレス一致検出回路A(30)と、該レジスタファ
イル(REG)(1)に対する書き込みアドレスと、上記特定の
レジスタ(10)のアドレスとの一致を検出する書き込みア
ドレス一致検出回路B(31)と、上記レジスタファイル(R
EG)(1)の読み出しデータと、上記コピーレジスタ(RAR)
の出力データ () と、命令アドレス加算回路(IF ADDE
R)(7) 等によって生成された命令アドレスとを、上記リ
ターンアドレス一致検出回路A(30)のアドレス一致信号
() と、命令フェッチ制御信号 () とによって制御
して選択し、命令フェッチアドレスを出力する命令フェ
ッチアドレス選択回路(IF ADRS SELECT)(3) とを備え
て、 上記書き込みアドレス一致検出回路B(31)からの書き込
みアドレス一致検出信号 () が得られた時には、上記
コピーレジスタ(RAR)(2)に、上記レジスタファイル(RE
G)(1)の特定のレジスタ(10)に書き込むデータ () と
同じデータを書き込み、 上記命令フェッチ制御信号 () がレジスタ分岐命令の
実行を指示していて、上記リターンアドレス一致検出回
路A(30)からのアドレス一致信号 () が得られたと
き、上記コピーレジスタ(RAR)(2)の値 () を、上記命
令フェッチアドレス選択回路(IF ADRS SELECT)(3) で選
択して出力し、 上記命令フェッチ制御信号 () がレジスタ分岐命令の
実行を指示していて、上記リターンアドレス一致検出回
路A(30)からのアドレス一致信号 () が得られなかっ
たとき、上記レジスタファイル(REG)(2)の値を、上記命
令フェッチアドレス選択回路(IF ADRS SELECT)(3) で選
択して出力することを特徴とする分岐命令制御回路。A specific register (1) of a register file (REG) (1) comprising a plurality of registers to be read and written by a program.
An information processing apparatus provided with a register branch instruction for performing a branch using the value of (0) as a branch destination instruction address, comprising: a specific register (10) of the register file (REG) (1);
A copy register (RAR) (2) having the same contents, a value of a register field indicating a branch destination address of the branch instruction where the prefetched instruction is a branch instruction, and an address of the specific register (10). A return address match detection circuit A (30) for detecting a match with the register file (REG) (1) and a write address match detection for detecting a match between the address of the specific register (10) and the write address of the register file (REG) (1). Circuit B (31) and the register file (R
EG) (1) read data and the above copy register (RAR)
Output data () and the instruction address adder (IF ADDE
R) (7), etc., with the address match signal of the return address match detection circuit A (30).
And an instruction fetch address selection circuit (IF ADRS SELECT) (3) for controlling and selecting by the instruction fetch control signal () and outputting an instruction fetch address. When the write address match detection signal () from (31) is obtained, the register file (RE) is stored in the copy register (RAR) (2).
G) The same data as the data () to be written to the specific register (10) of (1) is written, and the instruction fetch control signal () instructs execution of the register branch instruction, and the return address match detection circuit A ( When the address match signal () from (30) is obtained, the value () in the copy register (RAR) (2) is selected and output by the instruction fetch address selection circuit (IF ADRS SELECT) (3). When the instruction fetch control signal () instructs execution of a register branch instruction and the address match signal () from the return address match detection circuit A (30) is not obtained, the register file (REG) A branch instruction control circuit characterized in that the value of (2) is selected and output by the instruction fetch address selection circuit (IF ADRS SELECT) (3).
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP00441492A JP3168657B2 (en) | 1992-01-14 | 1992-01-14 | Branch instruction control circuit |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP00441492A JP3168657B2 (en) | 1992-01-14 | 1992-01-14 | Branch instruction control circuit |
Publications (2)
Publication Number | Publication Date |
---|---|
JPH05189233A JPH05189233A (en) | 1993-07-30 |
JP3168657B2 true JP3168657B2 (en) | 2001-05-21 |
Family
ID=11583646
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP00441492A Expired - Fee Related JP3168657B2 (en) | 1992-01-14 | 1992-01-14 | Branch instruction control circuit |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3168657B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113470554B (en) * | 2021-07-15 | 2023-08-29 | 中科芯集成电路有限公司 | Open circuit detection readback method for LED display driving chip |
-
1992
- 1992-01-14 JP JP00441492A patent/JP3168657B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JPH05189233A (en) | 1993-07-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5961637A (en) | Split branch system utilizing separate set branch, condition and branch instructions and including dual instruction fetchers | |
JP3688270B2 (en) | Stop processor | |
US5404552A (en) | Pipeline risc processing unit with improved efficiency when handling data dependency | |
EP0491693B1 (en) | Improved cpu pipeline having register file bypass on update/access address compare | |
US5008807A (en) | Data processing apparatus with abbreviated jump field | |
JPH01310441A (en) | Data processor | |
US4758949A (en) | Information processing apparatus | |
US4642757A (en) | Microinstruction controlled arithmetic control unit | |
US5287483A (en) | Prefetched operand storing system for an information processor | |
JP3168657B2 (en) | Branch instruction control circuit | |
US5293499A (en) | Apparatus for executing a RISC store and RI instruction pair in two clock cycles | |
JPH04215129A (en) | Method and apparatus for executing continuous command | |
KR900002436B1 (en) | Bypass control system for pipeline processing | |
EP0116600A1 (en) | Pre-execution next address calculating mechanism. | |
JP2636821B2 (en) | Parallel processing unit | |
JPH063583B2 (en) | Digital computer and method for generating an address during an instruction decode cycle | |
KR100246465B1 (en) | Apparatus and method for reducing cycle of microprocessor stack order | |
US6289439B1 (en) | Method, device and microprocessor for performing an XOR clear without executing an XOR instruction | |
EP1069499A2 (en) | Data processing apparatus and method for simultaneously executing plural instructions | |
EP0167333A2 (en) | Data processing apparatus with data type classifier | |
JPH024011B2 (en) | ||
JPH05307483A (en) | Method and circuit for controlling write-in to register | |
JPH04127326A (en) | Information processor and instruction generating method | |
JPH0228724A (en) | Branch instruction control method | |
JPS6049439A (en) | Control system of microprogram |
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: 20010213 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20080316 Year of fee payment: 7 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20090316 Year of fee payment: 8 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100316 Year of fee payment: 9 |
|
LAPS | Cancellation because of no payment of annual fees |