JPH04191931A - Electronic computer - Google Patents

Electronic computer

Info

Publication number
JPH04191931A
JPH04191931A JP32091690A JP32091690A JPH04191931A JP H04191931 A JPH04191931 A JP H04191931A JP 32091690 A JP32091690 A JP 32091690A JP 32091690 A JP32091690 A JP 32091690A JP H04191931 A JPH04191931 A JP H04191931A
Authority
JP
Japan
Prior art keywords
instruction
branch
delay slot
delay
delayed
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
JP32091690A
Other languages
Japanese (ja)
Other versions
JPH0778736B2 (en
Inventor
Hirobumi Muratani
博文 村谷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
National Institute of Advanced Industrial Science and Technology AIST
Original Assignee
Agency of Industrial Science and Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Agency of Industrial Science and Technology filed Critical Agency of Industrial Science and Technology
Priority to JP2320916A priority Critical patent/JPH0778736B2/en
Publication of JPH04191931A publication Critical patent/JPH04191931A/en
Publication of JPH0778736B2 publication Critical patent/JPH0778736B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Abstract

PURPOSE:To efficiently execute an instruction sequence by delay-controlling a delay branching instruction according to the value of the delay slot length of the delay branching instruction. CONSTITUTION:A delay branching instruction to have variable delay slot length is titled as a brd (N) in the case of an unconditional branching instruction when the delay slot length is defined as (N), instruction sequences <ope1>, <ope2>,..., <opeN> continued after the delay branching instruction brd (N) of which delay slot length is the (N) are executed in order within a delay slot period set by the delay branching instruction brd (N) to the certain instruction sequence, for instance, and after that, an <ope> which is the instruction of the branching destination of the delay branching instruction brd (N) is executed at time of passing through the delay slot (N). Thus, the optimization of the instruction sequences can be attained simply and efficiently and instruction executing time is shortened without causing the waste of a clock.

Description

【発明の詳細な説明】 [発明の目的] (産業上の利用分野) 本発明は遅延スロット長の異なる遅延分岐命令を用いて
効率的に命令を実行する電子計算機に関する。
DETAILED DESCRIPTION OF THE INVENTION [Object of the Invention] (Industrial Application Field) The present invention relates to an electronic computer that efficiently executes instructions using delayed branch instructions having different delay slot lengths.

(従来の技術) 最近、RI S C(Recluced In5tru
ction SetComputer)型のアーキテク
チャを持つマイクロプロセッサが注目されている。この
種のマイクロプロセッサでは、そのバイブライン処理の
流れを乱すことなく命令を実行することが、その性能を
十分に発揮させる上での重要な課題となる。
(Prior art) Recently, RISC (Recluded In5tru
Microprocessors with a ction SetComputer type architecture are attracting attention. In this type of microprocessor, executing instructions without disturbing the flow of its vibe line processing is an important issue in making full use of its performance.

さて上述したバイブライン処理の乱れを招く原因の1つ
に分岐命令かある。即ち、バイブライン処理は、既に前
のフェーズでフェッチした命令のデコードと、次の命令
のフェッチとを同しフェーズで並行して行われる。この
際、デコードによって命令の種別が分岐であることが解
釈されると、上述した如(フェッチした次の命令を取消
し、前記分岐命令の分岐先の命令を改めてフェッチする
ことが必要となる。このような命令フェッチのやり直し
がクロックのロスとなり、バイブライン処理の乱れの原
因となる。
Now, one of the causes of the disturbance in the above-mentioned vibe line processing is a branch instruction. That is, in the vibe line processing, decoding of an instruction already fetched in the previous phase and fetching of the next instruction are performed in parallel in the same phase. At this time, if the instruction type is interpreted as a branch by decoding, it is necessary to cancel the next fetched instruction and re-fetch the branch destination instruction of the branch instruction, as described above. Redoing such an instruction fetch results in a clock loss and causes a disturbance in the vibe line processing.

二のような分岐命令によるパイプライン処理の乱れに起
因する不具合を解決する手段として、例えば rD、J、[,1lja。
For example, rD,J,[,1lja] is a means for solving problems caused by disturbances in pipeline processing due to branch instructions such as 2.

”Reducing  the  Branch  P
enalty  in  PipelinedProc
essors、” Computer、 July、1
.988.pp、47〜55J等の文献に紹介されるよ
うに、 ■静的な分岐子mI (Static Branch 
Prediction)■動的な分岐予測(Dynam
ic Branch Prediction )■遅延
分岐(Delayect Branch)■ループバッ
ファ(Loop BufTers)等の手法を採用する
ことが考えられている。
”Reducing the Branch P
energy in PipelinedProc
essors,” Computer, July, 1
.. 988. As introduced in the literature such as pp, 47-55J, Static Branch mI (Static Branch
Prediction) ■Dynamic branch prediction (Dynam
It is considered to adopt techniques such as ic Branch Prediction, Delay Branch, and Loop BufTers.

上述した遅延分岐の手法で用いられる遅延分岐命令は、
その命令(遅延分岐命令)の実行直後に一定長の遅延ス
ロットを設定するものであり、この遅延スロット期間に
ある命令は前記遅延分岐命令の実行前に実行されること
になる。尚、この遅延分岐命令の遅延スロット長はパイ
プライン処理のステージ数と各ステージでの処理の内容
に応じて決定される。例えばrBerkeley RI
SCIIJ等では、一般的に遅延スロット長[1]の遅
延分岐命令か設定される。
The delayed branch instruction used in the delayed branch method described above is
A delay slot of a certain length is set immediately after the execution of the instruction (delayed branch instruction), and the instructions in this delay slot period are executed before the execution of the delayed branch instruction. Note that the delay slot length of this delayed branch instruction is determined depending on the number of stages of pipeline processing and the content of processing at each stage. For example, Berkeley RI
In SCIIJ and the like, a delayed branch instruction with a delay slot length of [1] is generally set.

さて分岐命令のデコード時には、その直後(次)の命令
を既にフェッチしているので、一般的にはデコードによ
って命令の分岐か確定した場合、既にフェッチした次の
命令の実行を取消す必要がある。この点、遅延分岐命令
によれば、その次の命令の取消しを行なう代りに、遅延
分岐命令の後にnop  (no operaNon)
命令を置き、このnop命令をそのまま実行することに
なる。この結果、前述したように次の命令を取消す場合
と実質的に等価な処理を、より単純なハードウェアによ
り、しかもパイプライン処理を乱すことなく実行するこ
とが可能となる。
Now, when a branch instruction is decoded, the immediately following (next) instruction has already been fetched, so if it is determined by decoding that the instruction is a branch, it is generally necessary to cancel the execution of the next instruction that has already been fetched. In this regard, according to the delayed branch instruction, instead of canceling the next instruction, nop (no operaNon) is executed after the delayed branch instruction.
This nop instruction will be executed as is. As a result, as described above, processing substantially equivalent to canceling the next instruction can be executed using simpler hardware and without disturbing pipeline processing.

ところでこの種の遅延分岐命令を持つ電子計算機におい
ては、遅延分岐命令によって設定される遅延スロット期
間に、例えばその分岐命令の直前の命令や分岐先の命令
、或いは分岐しない先の命令を持ってくることかできる
。このような命令実行順序の変更(シフト)により命令
列(コード)”Optimizing  Delaye
d  Branchs、−Proc、IEEE  Ml
cro−15,Oct、19B2.pp、114〜】2
0 」等の文献に詳しく紹介される。しかしてこのよう
なコードの最適化手法を用いることにより、例えば本来
的には何の処理も実行しなかったクロックを有効に使っ
て、その命令列を効率的に実行することか可能となる。
By the way, in electronic computers that have this type of delayed branch instruction, for example, the instruction immediately before the branch instruction, the instruction at the branch destination, or the instruction at the destination to which the branch is not branched is brought into the delay slot period set by the delayed branch instruction. I can do it. By changing (shifting) the instruction execution order like this, the instruction sequence (code) "Optimizing Delay"
d Branches, -Proc, IEEE Ml
cro-15, Oct, 19B2. pp, 114~]2
0,” etc., in detail. However, by using such a code optimization method, it becomes possible to efficiently execute the instruction sequence by effectively using, for example, a clock that originally did not perform any processing.

ここで上述した遅延分岐命令が関係するコード最適化手
法の代表的な例について説明する。ここに示す代表的な
コート最適化手法の1つは、成る分岐命令Aの分岐先a
が分岐命令Bである場合、その分岐元の分岐命令Aの分
岐先aを、その分岐先aの分岐命令Bの分岐先すにて置
換えると云う最適化手法でるある。もう1つの手法は、
本来、インタロツタを起こしてしまうような2つの命令
の間に置かれたnop命令の位置に分岐命令を持ってく
ることで、無駄なりロックを消すようにした最適化の手
法である。尚、ここで用いる[インタロック]の意味に
ついては後述する。
A typical example of a code optimization method involving the above-mentioned delayed branch instruction will now be described. One of the typical code optimization methods shown here is that the branch destination a of a branch instruction A consisting of
This is an optimization method in which, when is a branch instruction B, the branch destination a of the branch instruction A that is the branch source is replaced with the branch destination of the branch instruction B that is the branch destination a. Another method is
This is an optimization method that removes unnecessary locks by bringing a branch instruction to the position of a nop instruction placed between two instructions that would otherwise cause an interlock. Note that the meaning of [interlock] used here will be described later.

先ず、これらの最適化手法を実際に適用する際しての制
約について考える。
First, we will consider constraints when actually applying these optimization methods.

分岐命令Aの分岐先が分岐命令Bである場合、分岐元の
分岐命令Aの分岐先aを、その分岐先aの分岐命令Bの
分岐先すて置き換えることで、分岐の回数を減らすよう
にした最適化手法について述べる。但し、ここでは分岐
元、および分岐先の両分岐命令とも遅延分岐命令である
場合を考える。
When the branch destination of branch instruction A is branch instruction B, the number of branches is reduced by replacing the branch destination a of the branch instruction A that is the branch source with the branch destination of branch instruction B that is the branch destination a. This section describes the optimization method used. However, here, we will consider a case where both the branch instructions at the branch source and the branch destination are delayed branch instructions.

また説明の簡単化の為、ここではこれらの遅延分岐命令
の遅延スロット長を[1〕として説明する。
Further, to simplify the explanation, the delay slot length of these delayed branch instructions is assumed to be [1].

例えば第11図(a)に示すように、分岐先および分岐
元の両遅延命令とも無条件分岐命令(以下、[brd 
] と標記する)であるような命令列である場合、これ
らの各無条件分岐命令brd^、brd Bの次の命令
<opel>、 <ope2>の少なくとも一方がno
p命令であるならば、この命令列を第11図(b)に示
すように分岐元の無条件分岐命令brd AをbrdB
に書き換えて最適化することができる。
For example, as shown in FIG. 11(a), both the branch destination and branch source delayed instructions are unconditional branch instructions (hereinafter, [brd
), then at least one of the instructions <opel> and <ope2> following each of these unconditional branch instructions brd^ and brdB is no.
If it is a p instruction, this instruction sequence is changed from the branch source unconditional branch instruction brd A to brdB as shown in FIG. 11(b).
It can be rewritten and optimized.

尚、命令<ape>は、命令<opel>、 <ape
2>のうちのnop命令ではない方の命令を示している
。また上記命令<opel>、 <ape2>の両方が
それぞれnop命令である場合には、上記命令<ope
〉もnop命令となる。
Note that the command <ape> is the command <opel>, <ape
2>, which is not a nop instruction. Furthermore, if both of the above instructions <opel> and <ape2> are nop instructions, the above instruction <opel> and <ape2> are respectively nop instructions.
> is also a nop instruction.

また上記命令<opel>、 <ape2>が共にno
p命令ではない場合には、例えば第11図(C)に示す
ように分岐元の無条件分岐命令の分岐先を書き換え(b
rcl^→brd B ) 、この無条件分岐命令の前
に命令<opel>を移動(シフト)することによりそ
の命令列を最適化することができる。しかし命令<op
el>を無条件分岐命令brdの前に移動すると、もと
もと上記無条件分岐命令brdO前に存在する命令との
間でインタロックを起こす虞れがある。
Also, the above commands <opel> and <ape2> are both no.
If it is not a p instruction, the branch destination of the unconditional branch instruction that is the branch source is rewritten (b
rcl^→brd B), by moving (shifting) the instruction <opel> before this unconditional branch instruction, the instruction sequence can be optimized. But the command <op
If el> is moved before the unconditional branch instruction brd, there is a possibility that an interlock will occur with the instruction that originally exists before the unconditional branch instruction brdO.

従ってこのような場合には、例えばそれらの命令の間に
nop命令を挿入する必要が生じる。これ故、上述した
第11図(e)に示すような最適化は、必ずしも有効で
あるとは云えない。
Therefore, in such a case, it is necessary to insert, for example, a nop instruction between those instructions. Therefore, the optimization as shown in FIG. 11(e) described above cannot necessarily be said to be effective.

これに対して第12図(a)に示すように、分岐元が条
件分岐命令(以下、[cbrd] と表記する)であり
、その分岐先が無条件分岐命令brdである場合には次
のようにしてその最適化を行うことができる。即ち、条
件分岐命令cbrclが、その条件の成立・不成立に拘
らず遅延スロット期間にある命令を実行するものとする
と、例えば第12図(b)に示すように条件分岐命令c
brdの分岐先を書き換え(cbrd cc、A −c
brd cc、B ) 、命令(opel>を上記条件
分岐命令cbrdの実行前に移動することにより最適化
することができる。但し、このような最適化か行えるの
は命令<opel>の実行の結果、そのコンデイション
・コードが変わらない場合だけである。
On the other hand, as shown in Figure 12(a), if the branch source is a conditional branch instruction (hereinafter referred to as [cbrd]) and the branch destination is an unconditional branch instruction brd, then the following The optimization can be done in this way. That is, if the conditional branch instruction cbrcl executes an instruction in the delay slot period regardless of whether the condition is met or not, then the conditional branch instruction c
Rewrite the branch destination of brd (cbrd cc, A -c
brd cc, B), it can be optimized by moving the instruction (opel> before the execution of the conditional branch instruction cbrd above.However, such optimization can only be performed on the result of execution of the instruction <opel>) , only if its condition code does not change.

へ ちなみに命令〈opel>の実行によってコンデイ
ション・コードが変わるような場合は、上記<opel
>°を前記条件分岐命令cbrdの前に移動させること
はできない。しかしこの場合には、例えば第12図(e
)に示すように条件分岐命令cbrdの分岐先を書き換
え(cbrd cc、A −+cbrd cc、c )
 、その分岐先を命令<ape2>にすることにより最
適化することができる。但し、ラベルB:で始まる基本
ブロックにとって、その直前の基本ブロックがプレデセ
ッサであって、且つその基本ブロックの最後の命令が分
岐命令でなく、また遅延分岐命令の遅延スロット期間に
存在するものでもない場合には、上述した最適化の後、
ラベルC:の前にラベルB:への分岐命令br Bを挿
入することか必要となる。従ってこのような最適化を行
っても、そのプログラムの実行時間が短くなるという保
証はない。
By the way, if the condition code changes by executing the instruction <opel>, use the <opel> command above.
>° cannot be moved before the conditional branch instruction cbrd. However, in this case, for example, FIG.
) Rewrite the branch destination of the conditional branch instruction cbrd (cbrd cc, A −+cbrd cc, c )
, optimization can be achieved by setting the branch destination to the instruction <ape2>. However, for a basic block starting with label B:, the basic block immediately before it is a predecessor, and the last instruction of that basic block is not a branch instruction, nor does it exist in the delay slot period of a delayed branch instruction. In case, after the optimization mentioned above,
It is necessary to insert a branch instruction br B to label B: before label C:. Therefore, even if such optimization is performed, there is no guarantee that the execution time of the program will be shortened.

しかし上記ラベルB:で始まる基本ブロックへの入り方
が、分岐だけによって発生するならば上述したような新
たな分岐命令の挿入の必要はなく、従って上述した最適
化はいちがいに悪とは云えない。
However, if entering the basic block starting with label B: occurs only by branching, there is no need to insert a new branch instruction as described above, and therefore the optimization described above cannot be said to be entirely bad.

次に、例えば第13図(a)に示すように、分岐元の条
件分岐命令が、条件不成立時に遅延スロワした第12図
(C)に示した最適化と同様にして、例えば第13図(
b)に示すように条件分岐命令の分岐先を変更(cbr
d” cc、^−cbrd” cc、B)することで、
その最適化か可能である。
Next, as shown in FIG. 13(a), for example, the conditional branch instruction of the branch source is subjected to a delay thrower when the condition is not met, in the same way as in the optimization shown in FIG.
As shown in b), change the branch destination of the conditional branch instruction (cbr
d" cc, ^-cbrd" cc, B) By doing,
Its optimization is possible.

但し、この場合にもラベルB:で始まる基本ブロックの
直前の基本ブロックがプレデセソサであって、この基本
ブロックの最後の命令が分岐命令でなく、また遅延分岐
命令の遅延スロット期間に存在するものでもない場合に
は、その最適化の後にラベルC:の前にラベルB、への
分岐命令br Bを挿入することが必要となる。従って
この場合にも、上述した最適化によりプログラムの実行
時間が短くなるという保証はない。しかし上記ラベルB
:で始まる基本ブロックへの入り方が前述したように分
岐だけによって発生するならば新たな分岐命令の挿入の
必要がなくなるので、この最適化は非常に有効に作用す
ることになる。
However, even in this case, the basic block immediately before the basic block starting with label B: is a predecessor, and the last instruction of this basic block is not a branch instruction, and even if it exists in the delay slot period of a delayed branch instruction. If not, it is necessary to insert a branch instruction br B to label B before label C: after the optimization. Therefore, in this case as well, there is no guarantee that the above-described optimization will shorten the program execution time. However, the above label B
If entry into a basic block starting with : occurs only by branching as described above, there is no need to insert a new branch instruction, so this optimization will work very effectively.

最後に、本来、インタロックを起こしてしまうような2
つの命令の間に置かれたnop命令の位置に分岐命令を
持ってくることで、無駄なりロックを消すようにした最
適化の手法について述べる。
Finally, there are two
We will describe an optimization method that removes unnecessary locks by bringing a branch instruction to the position of a nop instruction placed between two instructions.

第14図(a)はインクロックを起こしてしまうような
2つの命令<opel>、 <ope2>の間にnop
命令を持つ命令列を示している。ここで上記2つの命令
<opel>、 <ope2>の間の挿入されているn
op命令は、命令<opel、>、 <open>が起
こすインタロックを防止する為のものである。
Figure 14(a) shows a nop between two instructions <opel> and <ope2> that cause an ink clock.
It shows an instruction sequence with instructions. Here, the n inserted between the above two instructions <opel> and <ope2>
The op instruction is used to prevent interlocks caused by the instructions <opel,> and <open>.

さて上述したインタロツタとは、命令<opel>の成
るフユーズと命令<ope2>の成るフェーズとの間に
何等かの依存関係があり、これらの命令<opel><
ope2>を連続して実行すると、上記依存関係が因果
律に反し、この結果、正しい実行動作か保証されないよ
うな現象のことを称する。
Now, the above-mentioned interrotsuta means that there is some kind of dependency relationship between the fuse consisting of the instruction <opel> and the phase consisting of the instruction <opel>, and these instructions <opel><
This term refers to a phenomenon in which when ``op2>'' is executed continuously, the above dependency relationship violates the law of causality, and as a result, correct execution is not guaranteed.

例えば第15図(a)に示すように命令<opel>が
フェーズMを終了した後でないと命令<ope2>のフ
ェーズEを実行できない場合、命令(Opel >(O
pe2)を連続して実行するとインタロックか発生する
For example, as shown in FIG. 15(a), if the phase E of the instruction <opel> cannot be executed until after the instruction <opel> has completed phase M, the instruction (Opel>(O
If pe2) is executed continuously, an interlock will occur.

従って二のような場合には、第15図(b)に示すよう
に連続する2つの命令<opel>、 <ope2>の
間にnop命令をおくことで、インタロックの発生を防
止する必要がある。
Therefore, in case 2, it is necessary to prevent the occurrence of an interlock by placing a nop instruction between two consecutive instructions <opel> and <ope2> as shown in FIG. 15(b). be.

二の場合、例えば命令<ope2>の次の命令が無条件
分岐命令brである場合には、例えば第15図(C)に
示すように上記分岐命令brを遅延分岐命令brdに変
え、前記命令<opel、>、 <ope2>の間に移
動することにより、nop命令か与えられていた部分で
の無駄なりロックを無くすことが可能となる。但し、こ
のような最適化が行なえるのは、nop命令がbr命令
の2つ前(遅延スロット長+1スロツト前)・ =j=
’、ある場合だけである。このような条件か満たさt゛
ない場合には、例えば命令のスケジューリング−により
、nop命令をその位置まで移動させる必要−があり、
このようなnop命令の移動が必ずしも可能であるとは
保証されない。
In case 2, for example, if the next instruction after the instruction <ope2> is an unconditional branch instruction br, the branch instruction br is changed to a delayed branch instruction brd as shown in FIG. 15(C), and the instruction By moving between <opel,> and <ope2>, it becomes possible to eliminate unnecessary locks in the part where the nop instruction was given. However, this kind of optimization can be performed if the nop instruction is two instructions before the br instruction (delay slot length + 1 slot before) =j=
', only in certain cases. If this condition is not met, it is necessary to move the nop instruction to that position, for example, by instruction scheduling.
It is not guaranteed that such a nop instruction movement is necessarily possible.

(発明が解決しようとする課題) このようにRISC型のアーキテクチャを持つマイクロ
プロセッサにおいては、遅延分岐命令の分岐先が同様な
遅延分岐命令である場合、その分岐元の分岐命令の分岐
先を、その分岐先の分岐命令の分岐先にて置き換えると
云う命令コードの最適化が考えられる。しかし遅延命令
の種類にょっては、種々の制約により必ずしもその最適
化を行い得るとは限らない。また最適化を行うに際して
新たな分岐命令の追加が必要になる場合もあり、実行時
間を減らすことか可能となると云う保証もない。従って
これらの問題を考慮すると、その最適化は非常に複雑な
ものとなることが否めない。
(Problems to be Solved by the Invention) As described above, in a microprocessor having a RISC type architecture, when the branch destination of a delayed branch instruction is a similar delayed branch instruction, the branch destination of the branch instruction that is the branch source is Optimization of the instruction code can be considered by replacing it with the branch destination of the branch instruction at the branch destination. However, depending on the type of delayed instruction, optimization may not always be possible due to various constraints. Further, when performing optimization, it may be necessary to add a new branch instruction, and there is no guarantee that the execution time will be reduced. Therefore, when these problems are considered, it is undeniable that the optimization becomes extremely complicated.

またインタロックを起こすような2つの命令間に分岐命
令を移動させることで無駄なりロックをなくすような最
適化においては、nop命令をスケジューリングにより
最適化可能な位置に置くことができるとは限らない。
Furthermore, in optimizations that eliminate wasteful locking by moving a branch instruction between two instructions that cause an interlock, it is not always possible to place the nop instruction in a position that can be optimized by scheduling. .

本発明はこのような事情を考慮してなされたものできる
電子計算機を提供することにある。
The object of the present invention is to provide an electronic computer that has been made in consideration of such circumstances.

[発明の構成コ (課題を解決するための手段) 本発明に係る電子計算機は、遅延スロット長か可変であ
る遅延分岐命令、または遅延スロット長か異なる複数の
遅延分岐命令を持ち、この遅延分岐命令の遅延スロット
長の値に従って遅延分岐命令の実行を遅延制御すること
を特徴とするものである。
[Structure of the Invention (Means for Solving the Problems)] An electronic computer according to the present invention has a delayed branch instruction whose delay slot length is variable, or a plurality of delayed branch instructions whose delay slot lengths are different. The present invention is characterized in that the execution of a delayed branch instruction is delayed and controlled according to the value of the instruction's delay slot length.

特に上記遅延分岐命令の実行の遅延制御を、遅延スロッ
ト長に関する情報を格納し、遅延スロット内の命令の実
行の過程で、その命令サイクルに応じて上記遅延スロッ
ト長に関する情報の値を変化させ、その値に応じて分岐
の実行を行なうが否かを判断して行うようにしたことを
特徴とするものである。
In particular, the delay control of execution of the delayed branch instruction is performed by storing information regarding the delay slot length, and changing the value of the information regarding the delay slot length in accordance with the instruction cycle in the process of executing an instruction in the delay slot; This method is characterized in that it is determined whether or not to execute a branch depending on the value.

(作 用) 本発明によれば、遅延分岐命令の遅延スロット長が可変
され、その遅延スロット長に応じて分岐の実行が制御さ
れるので、例えば遅延スロット(実施例) 本発明に係る電子計算機は、可変の遅延スロット長を持
つ遅延分岐命令を持ち、第1図に示すように構成された
命令フェッチ部を具備したマイクロプロセッサにより実
現される。
(Function) According to the present invention, the delay slot length of a delayed branch instruction is varied, and execution of a branch is controlled according to the delay slot length. has a delayed branch instruction with a variable delay slot length, and is realized by a microprocessor equipped with an instruction fetch unit configured as shown in FIG.

上記可変の遅延スロット長を持つ遅延分岐命令は、その
遅延スロット長を[N]としたとき、無条件分岐命令の
場合にはbrd(N)として標記され、また条件分岐命
令の場合にはcbrd” (N)として標記される。そ
して、例えば第2図に示すような命令列に対しては、遅
延スロット長が[N]である遅延分岐命令brd (N
)の後に続く命令列<opel>。
A delayed branch instruction with a variable delay slot length as described above is marked as brd(N) in the case of an unconditional branch instruction, and cbrd in the case of a conditional branch instruction, where the delay slot length is [N]. ” (N).For example, for an instruction sequence as shown in FIG. 2, the delayed branch instruction brd (N) whose delay slot length is [N] is
) is followed by the instruction sequence <opel>.

<ope2>、−、〈opeN>を、上記遅延分岐命令
brd(N)により設定される遅延スロット期間内に順
に実行し、その後、上記遅延スロット[N]を経た時点
で前記遅延分岐命令brd(N)の分岐先の命令である
<Qpe>を実行するものとなっている。
<ope2>, -, <opeN> are executed in order within the delay slot period set by the delayed branch instruction brd(N), and then, after passing through the delay slot [N], the delayed branch instruction brd( <Qpe>, which is the branch destination instruction of N), is executed.

つまり本発明では可変の遅延スロット長を持つ遅延分岐
命令か取り扱われるので、第3図(a)に示すよう遅延
分岐命令の分岐先を数スロ・ント先にので、第3図(b
)に対比して示すように、その遅延スロット期間に高々
1の命令しか実行することができない。これ故、前述し
たように命令コード列の最適化の上での種々の制約が発
生し、その最適化か困難化すると云う不具合が生してい
た。
In other words, since the present invention handles delayed branch instructions with variable delay slot lengths, the branch destination of the delayed branch instruction is set several slots ahead as shown in FIG. 3(a).
), at most one instruction can be executed during that delay slot. Therefore, as described above, various constraints arise in optimizing the instruction code sequence, making optimization difficult.

以下、このような可変の遅延スロ・ント長を持つ遅延分
岐命令による、上述した問題の解決につ(1て説明する
Hereinafter, a solution to the above-mentioned problem using a delayed branch instruction having a variable delay slot length will be explained.

先ず前述した第11図(a)に示したような命令列に対
しては、例えば遅延スロ・ソト長が[2]である無条件
分岐命令brd(2)を用いることにより、その不具合
を解消することができる。即ち、この場合には、例えば
第4図(a)に示すように、分岐元の無条件分岐命令b
rdの分岐先を、その分岐先の無条件分岐命令brdの
分岐先に変更しく brd^−brd B ) 、且つ
その遅延スロット長を[2]とするような(brd B
 −”brd(N) B)最適化を行えば良い。
First, for the instruction sequence shown in FIG. 11(a) mentioned above, the problem can be solved by using, for example, an unconditional branch instruction brd(2) with a delay slot length of [2]. can do. That is, in this case, for example, as shown in FIG. 4(a), the unconditional branch instruction b of the branch source
Change the branch destination of rd to the branch destination of the unconditional branch instruction brd (brd^-brd B ), and set the delay slot length to [2] (brd B
-”brd(N) B) Optimization can be performed.

この場合、前述した第11図(b)に示した最適化のよ
うに、命令<opel>、 <ope2>のいずれかが
を考慮する必要はない。但し、命令<opel><op
e2>の間のインタロツタの可能性については十分に考
慮する必要がある。このような新しい最適化は非常に単
純であり、且つその最適化に成功する可能性が非常に高
いものである。
In this case, unlike the optimization shown in FIG. 11(b), there is no need to consider either the instructions <opel> or <ope2>. However, the command <opel><op
It is necessary to fully consider the possibility of an interpolation between e2>. Such a new optimization is very simple and has a very high probability of success.

一方、第12図(a)に示したような命令列に対しては
、例えば同様にして遅延スロット長[2コの条件分岐命
令cbrd(2)を準備する。このような条件分岐命令
cbrd(2)を用いれば、先の無条件分岐の場合と同
様にして、その分岐元の分岐命令cbrd cc、^を
cbrd(2) cc、Bに変更することで、第4図(
b)に示すように最適化することが可能となる。
On the other hand, for an instruction sequence as shown in FIG. 12(a), for example, a conditional branch instruction cbrd(2) with a delay slot length [2] is prepared in the same manner. If you use such a conditional branch instruction cbrd(2), you can change the branch instruction cbrd cc, ^ from the branch source to cbrd(2) cc,B in the same way as in the case of the unconditional branch above. Figure 4 (
It becomes possible to optimize as shown in b).

この場合にも、前述した第12図(b)に示した最適化
のように、命令<0pe1〉を分岐命令cbrdの前に
移動する必要がないので、命令<opel>がコンデイ
ション・コードを変えるか否かを考慮する必要がなくな
る。また第12図(C)に示した最適化のように、新た
な分岐命令を挿入する必要もないので、確実にプログラ
ムの実行時間を短くすることが可能となる。
In this case as well, there is no need to move the instruction <0pe1> before the branch instruction cbrd as in the optimization shown in FIG. 12(b) described above, so the instruction <opel> There is no need to consider whether or not to change it. Furthermore, unlike the optimization shown in FIG. 12(C), there is no need to insert a new branch instruction, so it is possible to reliably shorten the program execution time.

条件分岐命令cbrd” (2)を用い、条件分岐命令
cbrd’ cc、Aをcbrd” (2) cc、B
に変更することで、例えば第4図(C)に示すように最
適化することが可能となる。尚、条件分岐命令cbrd
’は、その条件不成立時には遅延スロットに存在する命
令の実行を取消すものである。この場合にも、前述した
第13図(b)に示した最適化のように新たな分岐命令
を挿入する必要がないので、そのプログラムの実行時間
を確実に短くすることが可能となる。
Using the conditional branch instruction cbrd" (2), change the conditional branch instruction cbrd' cc, A to cbrd" (2) cc, B
By changing, for example, optimization as shown in FIG. 4(C) becomes possible. Furthermore, the conditional branch instruction cbrd
' cancels the execution of the instruction existing in the delay slot when the condition is not satisfied. In this case as well, there is no need to insert a new branch instruction as in the optimization shown in FIG. 13(b) described above, so that the execution time of the program can be reliably shortened.

尚、第5図(a)に示すように命令<opel><op
e2>の間にインタロックを防止する為のnop命令が
置かれており、その後に命令<opeM+l:>、分岐
命令br Bが存在する命令列について考える。従来、
このような命令列は、前記命令<opeM+1>のMが
[1コでなければ最適化の対象にならなかったものであ
る。
Incidentally, as shown in FIG. 5(a), the command <opel><op
Consider an instruction sequence in which a nop instruction for preventing an interlock is placed between e2>, followed by an instruction <opeM+l:> and a branch instruction brB. Conventionally,
Such an instruction sequence would not have been optimized unless M of the instruction <opeM+1> was [1].

このような命令列については、一般的には命令のスケジ
ューリングにより、例えば第6図(a)に示すように並
べ変えることができる。このようにスケジューリングさ
れた命令列の場合には、上記し、上記分岐命令brは遅
延スロ・ソト長[0]の無条件分岐命令を表している。
Such an instruction sequence can generally be rearranged, for example, as shown in FIG. 6(a) by instruction scheduling. In the case of an instruction sequence scheduled in this manner, the branch instruction br described above represents an unconditional branch instruction with a delay slot length [0].

尚、遅延スロ・ソト期間の全てがnop命令で埋められ
ている遅延分岐命令brclの場合にも同様に最適化す
ることが可能でングすることができないような場合であ
っても、その命令列を第5図(b)に示すように直接的
に最適化することが可能となる。従って第5図(a)に
示すような命令列をわざわざスケジューリングして第6
図(a)に示すような命令列に変換する必要がなくなり
、その最適化を非常に簡単に行うことか可能となる。
It should be noted that it is possible to similarly optimize the delayed branch instruction brcl in which the entire delay slot/soto period is filled with nop instructions. can be directly optimized as shown in FIG. 5(b). Therefore, by taking the trouble to schedule the instruction sequence shown in Figure 5(a),
There is no need to convert it into an instruction sequence as shown in Figure (a), and optimization can be performed very easily.

このように可変の遅延スロット長を持つ分岐命令を導入
することにより、本発明に係る電子計算機では、従来よ
り問題となっていた最適化の複雑さを解決し、しかも従
来ては最適化の対象とならなかった命令列に対しても、
これを効果的に最適化することが可能となる。
By introducing a branch instruction with a variable delay slot length in this way, the electronic computer according to the present invention solves the complexity of optimization that has conventionally been a problem, and moreover, Even for instruction sequences that do not become
This can be effectively optimized.

ところで一般的に、遅延スロット長が長くなる−に議論
が成立するのは、遅延スロ・ソト長か固定されていると
の前提に基づくものである。然し乍ら、−前述したよう
に遅延スロット長(期間)が可変さ“−れる場合には、
逆に長い遅延スロ・ソト長を持つ遅延分岐命令が存在す
ることにより、その長い遅延スロット期間内に移動可能
な命令に対する制約か少なくなり、最適化の観点から見
ると幾つかの利点か生しる。
Generally speaking, the argument that the delay slot length increases is based on the premise that the delay slot length is fixed. However, if the delay slot length (period) is variable as described above,
On the other hand, the existence of delayed branch instructions with long delay slot lengths reduces the constraints on the instructions that can be moved within the long delay slot period, which brings about several advantages from an optimization perspective. Ru.

その1つは前述したように、最適化を単純に行うことか
できることと、従来では最適化の対象とならなかった命
令列に対しても最適化を行なうことが可能となると云う
点である。今1つは、新たに導入した遅延スロット長が
可変な遅延分岐命令を含む命令列に対しても、前述した
新たな最適化の手法を一般化して適用できるという点で
ある。
One of them, as mentioned above, is that optimization can be performed simply, and that it is also possible to perform optimization on instruction sequences that were not targets of optimization in the past. Another advantage is that the above-described new optimization method can be generalized and applied to instruction sequences including newly introduced delayed branch instructions with variable delay slot lengths.

この新たな最適化の手法の一般化した適用について説明
する。例えば前述した第4図(a)に示す最適化の一般
化について考えると、この場合には第7図(a)に示す
ように分岐元の遅延スロット長[M]の遅延分岐命令b
rd(M)の分岐先が、遅延スbrd (M)の分岐先
を、その分岐先の遅延分岐命令brd(N)の分岐先に
置き換える(brd(M)A−brd(M+N) B)
ことにより、第7図(b)に示すように最適化すること
が可能となる。この最適化に際−しては、その遅延スロ
ット期間内に移動されるどの命令もnap命令である必
要はない。但し、命令<open>と命令<opeM+
1>との間のインタロックについては注意する必要があ
る。
A generalized application of this new optimization method will be explained. For example, considering the generalization of the optimization shown in FIG. 4(a) mentioned above, in this case, as shown in FIG. 7(a), the delayed branch instruction b with the delay slot length [M] of the branch source is
The branch destination of rd(M) replaces the branch destination of delayed branch instruction brd(M) with the branch destination of the delayed branch instruction brd(N) at the branch destination (brd(M)A−brd(M+N)B)
This makes it possible to optimize as shown in FIG. 7(b). For this optimization, any instructions moved within the delay slot need not be nap instructions. However, the command <open> and the command <opeM+
It is necessary to be careful about the interlock between 1> and 1>.

同様に第8図(a)に示すような遅延スロット長が可変
な条件遅延分岐命令cbrd(M) cc、^を含む命
令列についても第8図(b)に示すように最適化するこ
とができ、第9図(a)に示すような遅延スロット長が
可変な条件遅延分岐命令cbrd” (M) ce、A
を含む命令列についても第9図(b)に示すように最適
化することができる。
Similarly, an instruction sequence including the conditional delayed branch instruction cbrd(M) cc, ^ with variable delay slot length as shown in FIG. 8(a) can also be optimized as shown in FIG. 8(b). A conditional delayed branch instruction cbrd" (M) ce, A with variable delay slot length as shown in FIG. 9(a).
It is also possible to optimize an instruction sequence including the above as shown in FIG. 9(b).

いずれの場合であっても、連続する命令<open>。In either case, consecutive instructions <open>.

<opeM+1>との間のインタロックについては十分
に注意する必要があるが、条件分岐命令の前の位置に命
令か移動することが無いので、コンデイション・コード
が変イつるか否かについては注意する必要はない。
It is necessary to be careful about the interlock with <opeM+1>, but since the instruction does not move to the position before the conditional branch instruction, it is difficult to determine whether the condition code will change or not. There is no need to be careful.

列<opel>、 <ope2>、 −=、 〈ope
M+N>をスケジューリングし、その遅延スロット期間
内から外部に出せるものついては、例えば遅延分岐命令
の前の位置に移動することにより、必要な遅延スロット
長を成る程度短くすることができる。また遅延スロット
期間内の長い命令列をそのまま新たな最適化の対象とし
たり、或いはスケジューリングにより新たに最適化の対
象となる命令列に変換することも可能である。従って可
変の遅延スロット長を持つ分岐命令を導入しても、従来
の最適化の手法をそのまま一般化し、最適化の複雑さを
解消して種々の命令列を効果的に最適化して、その命令
列を効率的に実行することか可能となる。
Columns <opel>, <ope2>, -=, <ope
M+N> and those that can be brought out from within the delay slot period can be moved to a position before the delayed branch instruction, for example, thereby reducing the required delay slot length to a considerable extent. It is also possible to use a long instruction sequence within the delay slot period as a new optimization target, or to convert it into an instruction sequence that becomes a new optimization target through scheduling. Therefore, even if branch instructions with variable delay slot lengths are introduced, conventional optimization techniques can be generalized as they are, the complexity of optimization can be eliminated, and various instruction sequences can be effectively optimized. It becomes possible to execute columns efficiently.

また第10図(a)は、命令〈opeD、 cope2
>の間に、インタロツタを防止する為のnop命令を置
き、その後に条件分岐命令か出現する命令列の例を示し
ている。この場合には、例えば第10図(b)に示すよ
うに条件分岐命令をnop命令の位置に移動させ、命令
<opel>+ <ope2>の間にインタロツタを防
止する為にわざわざ設けられたnop命令を消し、スロ
ットの無駄な使用をなくすことかできる。損金にだけ可
能なものである。またこのようにして条件分岐命令をn
op命令の位置に移動させる場合、これによって連続す
る命令〈opeM+1>、 (opeM+2>との間で
新たなインタロツタか生しないように配慮する必要があ
ることは勿論のことである。
In addition, FIG. 10(a) shows the commands <opeD, copy2
An example of an instruction sequence in which a nop instruction is placed between > and a nop instruction to prevent interpolation, followed by a conditional branch instruction is shown. In this case, for example, as shown in FIG. 10(b), the conditional branch instruction is moved to the position of the nop instruction, and the nop You can erase commands and eliminate wasteful use of slots. This is possible only for losses. Also, in this way, the conditional branch instruction is
Of course, when moving to the position of the op instruction, it is necessary to take care not to create a new interpolation between the consecutive instructions <opeM+1> and (opeM+2>).

次に上述した可変遅延スロット長を持つ遅延分岐命令を
含む命令列を実行する電子計算8!(マイクロプロセッ
サ)の命令フェッチ部について説明する。二の命令フェ
ッチ部は、前述したように第1図に示す如く構成される
Next, electronic calculation 8! executes an instruction sequence including a delayed branch instruction with a variable delay slot length as described above! (microprocessor) instruction fetch unit will be explained. The second instruction fetch section is configured as shown in FIG. 1, as described above.

第1図において命令ブリフェッチ・レジスタ1は、キャ
ッシュバス2を介してプログラムメモリ(図示せず)か
ら、後述するプログラム・カウンタ3の制御の下で命令
を順次ブリフェッチする。
In FIG. 1, an instruction briefetch register 1 sequentially briefetches instructions from a program memory (not shown) via a cache bus 2 under the control of a program counter 3, which will be described later.

この命令ブリフェッチ・レジスタ1にフェッチされた命
令はデコーダ4によりデコードされ、その命令が解釈さ
れる。しかしてその命令が可変遅延スロット長を持つ遅
延分岐命令の場合には、その遅延スロット長の値が分岐
カウンタ5に格納されまたその分岐先アドレスが分岐先
アドレス・レジスタ8に格納される。また前記デコーダ
4によりデコードされた命令か通常の分岐命令の場合に
はその分岐命令の分岐先アドレスはそのままプログラム
・カウンタ3に格納される。
The instruction fetched into the instruction briefetch register 1 is decoded by the decoder 4 and interpreted. If the instruction is a delayed branch instruction having a variable delay slot length, the value of the delay slot length is stored in branch counter 5, and the branch destination address is stored in branch destination address register 8. If the instruction decoded by the decoder 4 is a normal branch instruction, the branch destination address of the branch instruction is stored in the program counter 3 as is.

・尚、デコーダ4によりデコードされた命令が上場合に
は、前記プログラム・カウンタ3は命令の実行に伴って
インクリメントされるだけである。
-If the instruction decoded by the decoder 4 is the upper one, the program counter 3 is only incremented as the instruction is executed.

さて前記分岐カウンタ5は、そこに格納された遅延スロ
ット長を示す値が[1コ以上ならば、命令の実行に伴う
クロックを受けて[0コになるまでデクリメントする。
Now, if the value indicating the delay slot length stored therein is 1 or more, the branch counter 5 decrements it until it becomes 0 in response to the clock associated with the execution of the instruction.

つまり遅延分岐命令のデコードによりその遅延スロット
長を示す値か分岐カウンタ5が格納されると、命令の実
行に伴うスロットの進行に伴って分岐カウンタ5に格納
された値がデクリメントされ、遅延分岐命令によって設
定された遅延スロットの残りスロット期間が示されるよ
うになっている。しかしてこの分岐カラン、  夕5の
値は比較器7にて設定値[1]と比較され、その一致が
検出されたとき遅延スロット期間の終了として判定され
ている。この時点で前記分岐先、  アドレス・レジス
タ6に格納されている値(分岐先アドレス)か前記プロ
グラム・カウンタ3に移される。
In other words, when a value indicating the delay slot length of a delayed branch instruction is stored in the branch counter 5 by decoding, the value stored in the branch counter 5 is decremented as the slot progresses as the instruction is executed. The remaining slot period of the delay slot set by is shown. However, the value of this branch 5 is compared with the set value [1] in the comparator 7, and when a match is detected, it is determined that the delay slot period has ended. At this point, the value stored in the branch destination address register 6 (branch destination address) is transferred to the program counter 3.

ゴーセレクタ8は、常時は前記プログラム・カウンの命
令の読み出しを制御し、上述した如く遅延ス)アドレス
)を選択することで、命令の分岐を実シ 現している。
The go selector 8 normally controls reading of instructions from the program counter, and executes instruction branching by selecting a delayed address as described above.

一つまりこの命令フェッチ部では、遅延分岐命令が与え
られたとき、その遅延分岐命令の遅延スロット長を分岐
カウンタ5により計測することで、遅延分岐命令の実行
を上記遅延スロ・ソト長句だけ意図的に遅らせるように
構成されている。
In other words, in this instruction fetch section, when a delayed branch instruction is given, by measuring the delay slot length of the delayed branch instruction using the branch counter 5, the instruction fetch section executes the delayed branch instruction only with the above-mentioned delay slot/soto long phrase. is configured to be delayed.

かくしてこのように構成された命令フエ・ノチ部によれ
ば、例えば第3図(a)に示すように遅延分岐命令をデ
コードしたのち、その分岐先の命令を実行するまでに複
数スロ・ソトに亘る遅延期間か設定されるので、この遅
延スロット期間を利用して他の複数の命令を円滑に実行
することかできる。
According to the instruction processing section configured in this way, for example, as shown in FIG. Since the delay slot period is set, multiple other instructions can be smoothly executed using this delay slot period.

ちなみに従来では、遅延分岐命令の遅延スロ・ソト長が
[1]に固定されているので、第3図(b)に示すよう
にその遅延スロット期間(1スロ・ソト)内に高々1つ
の命令しか実行することができない。
By the way, conventionally, the delay slot length of a delayed branch instruction is fixed to [1], so at most one instruction can be executed within the delay slot period (1 slot soto) as shown in FIG. 3(b). can only be executed.

この結果、前述したように命令コードの最適化を行う場
合、その制約から種々の不具合が生じ、例えば成る命令
を遅延分岐命令の実行前に実行するようにその命令を移
動させる等の不具合があった。
As a result, when optimizing instruction code as described above, various problems arise due to the constraints, such as moving an instruction to be executed before executing a delayed branch instruction. Ta.

この点、可変長の遅延分岐命令を用いる実施例針:\゛ ′−複数の命令を効率的に実行することか可能となる。In this regard, an example using a variable-length delayed branch instruction: \゛ ' - It becomes possible to efficiently execute multiple instructions.

この結果、命令列の最適化を行う場合でも、これを容易
になすことが可能となる。
As a result, it becomes possible to easily optimize the instruction sequence.

尚、上述した命令コードの最適化を行うに際しては、コ
ンデイション・コードを変える算術演算命令や論理演算
命令とは別に、コンデイション・コードを変えない算術
演算命令や論理演算命令を用意しておく二とも有用であ
る。このようにすれば、例えば条件判定の必要がない演
算の場合、上記コンデイション・コードを変えない命令
を用いることにより、その最適化の可能性を更に大きく
することか可能となる。
In addition, when performing the instruction code optimization described above, prepare arithmetic operation instructions and logical operation instructions that do not change the condition code, in addition to arithmetic operation instructions and logical operation instructions that change the condition code. Both are useful. In this way, for example, in the case of an operation that does not require condition determination, the possibility of optimization can be further increased by using an instruction that does not change the condition code.

またコンデイション・コードを変えない算術演算命令や
論理演算命令を別に用意することは、条件分岐命令の遅
延スロット内の命令を上記条件分岐命令の前に移動し得
る可能性を高くするので、最適化の自由度を更に大きく
すると云える。
Also, preparing separate arithmetic operation instructions and logical operation instructions that do not change the condition code increases the possibility that the instruction in the delay slot of the conditional branch instruction can be moved before the conditional branch instruction, so it is optimal. This can be said to further increase the degree of freedom in

尚、本発明は上述した実施例に限定されるものではない
。例えば遅延スロット長に関する情報を遅延分岐命令に
持たせる手法としては、遅延分岐命令の命令コード内に
遅延スロット長を直接指定するためのフィールドを用意
したり、或いは遅延ヨ \“良い。この場合には、遅延スロット長に関する情報
を格納する為の分岐カウンタ5を省略することか可能で
ある。分岐カウンタ5を省略する場合には、例えば遅延
スロット長に関する情報をプロセッサの制御部の論理と
して組み込んでおくようにすれば良い。また遅延スロッ
ト長に関する情報をレジスタやメモリに格納しておき、
レジスタ番号やメモリ・アドレスを指定するすることで
、その制御を行うようにしても良い。その他、本発明は
その要旨を逸脱しない範囲で種々変形して実施すること
ができる。
Note that the present invention is not limited to the embodiments described above. For example, a method for providing information regarding the delay slot length in a delayed branch instruction is to prepare a field for directly specifying the delay slot length in the instruction code of the delayed branch instruction, or to provide a field for directly specifying the delay slot length in the instruction code of the delayed branch instruction. It is possible to omit the branch counter 5 for storing information regarding the delay slot length.If the branch counter 5 is omitted, for example, the information regarding the delay slot length may be incorporated into the logic of the control section of the processor. You can also store information about the delay slot length in a register or memory.
The control may be performed by specifying a register number or memory address. In addition, the present invention can be implemented with various modifications without departing from the gist thereof.

[発明の効果] 以上詳述したように本発明によれば、遅延分岐命令の分
岐先が遅延分岐命令である場合や、遅延分岐命令より数
ステップ前にnop命令がある場合のように、従来では
最適化か複雑であった命令列に対しても、これを簡易に
最適化して効率的に命令を実行することが可能となる。
[Effects of the Invention] As detailed above, according to the present invention, when the branch destination of a delayed branch instruction is a delayed branch instruction, or when there is a nop instruction several steps before the delayed branch instruction, Now, it becomes possible to easily optimize a complicated instruction sequence and execute the instructions efficiently.

しかも最適化の際の制約条件を大幅に緩和することがで
き、従来ては最適化の対象とならなかった幾つかの命令
列に対しても、その最適化を行なうことを可能とする等
の実用上多大なる効果か奏せられる。
Moreover, the constraints on optimization can be significantly relaxed, and it is now possible to optimize some instruction sequences that were not previously subject to optimization. It has great practical effects.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明の一実施例に係る遅延分岐命令を実行す
る命令フェッチ部の構成例を示す図、第2図は本発明に
おける遅延分岐命令を含む命令列の実行順序を示す図、
第3図は遅延分岐命令のパイプライン処理を表す図、第
4図乃至第10図はそれぞれ本発明に係る遅延分岐命令
を含む命令列の最適化の手法を示す図である。また第1
1図乃至第14図はそれぞれ従来の最適化の手法を示す
図、第15図はインタロックの発生とその回避の状況を
示す図である。 】・・・命令ブリフェッチ・レジスタ、2・・・キャッ
シュ・バス、3・・・プログラム・カウンタ、4・・・
デコーダ、5・・・分岐カウンタ、6・・・分岐先アド
レス・レジスタ、7・・・比較器、8・・・セレクタ。 出願人 工業技術院長 杉油 賢 第1図 (命令列)       (♀令案行の順序)第2図 第3図 第10図 第12図 第13図 第14図
FIG. 1 is a diagram showing an example of the configuration of an instruction fetch unit that executes a delayed branch instruction according to an embodiment of the present invention, and FIG. 2 is a diagram showing the execution order of an instruction string including a delayed branch instruction in the present invention.
FIG. 3 is a diagram showing pipeline processing of delayed branch instructions, and FIGS. 4 to 10 are diagrams each showing a method of optimizing an instruction sequence including delayed branch instructions according to the present invention. Also the first
1 to 14 are diagrams each showing a conventional optimization method, and FIG. 15 is a diagram showing the occurrence of an interlock and its avoidance. ]...Instruction briefetch register, 2...Cache bus, 3...Program counter, 4...
Decoder, 5... Branch counter, 6... Branch destination address register, 7... Comparator, 8... Selector. Applicant Ken Sugiyu, Director of the Agency of Industrial Science and Technology

Claims (2)

【特許請求の範囲】[Claims] (1)遅延スロット長が可変である遅延分岐命令、また
は遅延スロット長が異なる複数の遅延分岐命令を持ち、
この遅延分岐命令の遅延スロット長の値に従って遅延分
岐命令の実行を遅延制御することを特徴とする電子計算
機。
(1) Having a delayed branch instruction with variable delay slot length or multiple delayed branch instructions with different delay slot lengths,
An electronic computer characterized in that execution of a delayed branch instruction is delayed-controlled in accordance with a value of a delay slot length of the delayed branch instruction.
(2)遅延分岐命令の実行の遅延制御は、遅延分岐命令
の遅延スロット長に関する情報を格納し、遅延スロット
内の命令の実行の過程で、その命令サイクルに応じて上
記遅延スロット長に関する情報の値を変化させ、その値
に応じて分岐の実行を行なうか否かを判断して行うこと
を特徴とする請求項(1)に記載の電子計算機。
(2) Delay control of execution of delayed branch instructions stores information regarding the delay slot length of the delayed branch instruction, and in the process of executing an instruction within the delay slot, information regarding the delay slot length is stored in accordance with the instruction cycle. 2. The computer according to claim 1, wherein the computer changes a value and determines whether or not to execute the branch depending on the value.
JP2320916A 1990-11-27 1990-11-27 Electronic computer Expired - Lifetime JPH0778736B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2320916A JPH0778736B2 (en) 1990-11-27 1990-11-27 Electronic computer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2320916A JPH0778736B2 (en) 1990-11-27 1990-11-27 Electronic computer

Publications (2)

Publication Number Publication Date
JPH04191931A true JPH04191931A (en) 1992-07-10
JPH0778736B2 JPH0778736B2 (en) 1995-08-23

Family

ID=18126704

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2320916A Expired - Lifetime JPH0778736B2 (en) 1990-11-27 1990-11-27 Electronic computer

Country Status (1)

Country Link
JP (1) JPH0778736B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008072178A1 (en) * 2006-12-11 2008-06-19 Nxp B.V. Pipelined processor and compiler/scheduler for variable number branch delay slots

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6986278B2 (en) * 2019-02-28 2021-12-22 株式会社ソフイア Pachinko machine

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5794849A (en) * 1980-12-05 1982-06-12 Nec Corp Microprogram controller
JPS63205732A (en) * 1987-02-23 1988-08-25 Agency Of Ind Science & Technol Information processor

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5794849A (en) * 1980-12-05 1982-06-12 Nec Corp Microprogram controller
JPS63205732A (en) * 1987-02-23 1988-08-25 Agency Of Ind Science & Technol Information processor

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008072178A1 (en) * 2006-12-11 2008-06-19 Nxp B.V. Pipelined processor and compiler/scheduler for variable number branch delay slots
US8959500B2 (en) 2006-12-11 2015-02-17 Nytell Software LLC Pipelined processor and compiler/scheduler for variable number branch delay slots

Also Published As

Publication number Publication date
JPH0778736B2 (en) 1995-08-23

Similar Documents

Publication Publication Date Title
US5710902A (en) Instruction dependency chain indentifier
US6453407B1 (en) Configurable long instruction word architecture and instruction set
US8935515B2 (en) Method and apparatus for vector execution on a scalar machine
US6192515B1 (en) Method for software pipelining nested loops
TWI529618B (en) Single cycle multi-branch prediction including shadow cache for early far branch prediction
JP2002007141A (en) Loop cache memory for pipe lined microprocessor and cache controller
US5901318A (en) Method and system for optimizing code
US20080016321A1 (en) Interleaved hardware multithreading processor architecture
WO2002008893A1 (en) A microprocessor having an instruction format containing explicit timing information
US20110264892A1 (en) Data processing device
KR950012118B1 (en) Parallel pipelined instruction processing system for very long instruction word
KR20020025703A (en) Rename device and processor
JPH04191931A (en) Electronic computer
JP3146058B2 (en) Parallel processing type processor system and control method of parallel processing type processor system
US7010670B2 (en) Data processing device that controls an overriding of a subsequent instruction in accordance with a conditional execution status updated by a sequencer
JP3490005B2 (en) Instruction control apparatus and method
KR100576560B1 (en) Speculative register adjustment
US7302555B2 (en) Zero overhead branching and looping in time stationary processors
JPH09512939A (en) Compatible notation method of object code of very long instruction program
JP3335735B2 (en) Arithmetic processing unit
JP2006524859A (en) Parallel processing system
JP3647930B2 (en) Dynamic hyperscalar processor
US11663014B2 (en) Speculatively executing instructions that follow a status updating instruction
JP4006887B2 (en) Compiler, processor and recording medium
KR100515039B1 (en) Pipeline status indicating circuit for conditional instruction

Legal Events

Date Code Title Description
EXPY Cancellation because of completion of term