JPH04333929A - Cache memory control system - Google Patents

Cache memory control system

Info

Publication number
JPH04333929A
JPH04333929A JP3105440A JP10544091A JPH04333929A JP H04333929 A JPH04333929 A JP H04333929A JP 3105440 A JP3105440 A JP 3105440A JP 10544091 A JP10544091 A JP 10544091A JP H04333929 A JPH04333929 A JP H04333929A
Authority
JP
Japan
Prior art keywords
instruction
branch
cache memory
register
address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP3105440A
Other languages
Japanese (ja)
Inventor
Yasumasa Nakada
中田 恭正
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.)
Toshiba Corp
Original Assignee
Toshiba Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp filed Critical Toshiba Corp
Priority to JP3105440A priority Critical patent/JPH04333929A/en
Publication of JPH04333929A publication Critical patent/JPH04333929A/en
Pending legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)
  • Executing Machine-Instructions (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

PURPOSE:To accelerate a program processing by staying the instruction train of a program loop under execution existent in a cache memory until the end a loop processing. CONSTITUTION:When the condition of a branching instruction for returning is established and a size (loop size) from the branching destination instruction to the branching instruction is smaller than a cache memory size, the address of the branching instruction, the address of the branching destination and the loop side are set to registers 11, 12 and 13 and by detecting the establishment of the condition in the case of executing the same branching instruction again at a comparator 14 and an AND gate 18, a state under loop execution is detected to turn a flag 20 on. When the flag 20 is turned on, a cache controller 4 extracts the loop instruction train shown by the registers 11-13 from a main memory 2 and writes it is a cache memory 3 and until the comparator 14 detects that the address of the instruction to be executed exceeds the address of the branching instruction, the loop instruction train in the cache memory 3 is not turned out.

Description

【発明の詳細な説明】[Detailed description of the invention]

【0001】0001

【産業上の利用分野】この発明は、キャッシュメモリを
備えた情報処理装置に係り、特にプログラムループの実
行に好適なキャッシュメモリ制御方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an information processing apparatus equipped with a cache memory, and more particularly to a cache memory control method suitable for executing a program loop.

【0002】0002

【従来の技術】近年の情報処理装置では、主記憶等のメ
モリの内容の一部の写しが置かれるキャッシュメモリを
備えるのが一般的である。
2. Description of the Related Art In recent years, information processing apparatuses are generally equipped with a cache memory in which a copy of a portion of the contents of a memory such as a main memory is stored.

【0003】この種の情報処理装置では、メモリアクセ
ス要求時に、目的の命令(またはデータ)がキャッシュ
メモリ内に存在するか否か、即ちキャッシュヒットか否
(ミスヒット)かを調べ、キャッシュヒット時には、キ
ャッシュメモリから目的の命令(またはデータ)を取出
すことにより、命令(またはデータ)のアクセスの高速
化を図っている。
In this type of information processing device, when a memory access request is made, it is checked whether or not the target instruction (or data) exists in the cache memory, that is, whether there is a cache hit or not (mishit). By retrieving the target instruction (or data) from the cache memory, the access speed of the instruction (or data) is increased.

【0004】また、ミスヒット時には、メモリアクセス
を行って目的の命令(またはデータ)を含む所定サイズ
のブロックデータを読出し、同ブロックデータをキャッ
シュメモリに格納することにより、ミスヒットとなった
命令(またはデータ)に続いてその近傍の命令(または
データ)をアクセスする際の高速化が図れるようにして
いる。このキャッシュメモリへのブロックデータ格納が
行われると、それ以前にその格納先に格納されていた他
のブロックデータは追出されることになる。
[0004] Furthermore, in the event of a miss, the instruction (or data) that caused the miss is accessed to read a block of data of a predetermined size containing the target instruction (or data), and the block data is stored in the cache memory. This makes it possible to speed up access to instructions (or data) in the vicinity of the instruction (or data) following the instruction (or data). When this block data is stored in the cache memory, other block data previously stored in the storage location will be evicted.

【0005】[0005]

【発明が解決しようとする課題】上記したように従来は
、主記憶からキャッシュメモリへの命令(またはデータ
)の格納は、所定サイズのブロックを単位に行われてい
た。しかし、ブロック単位でキャッシュメモリの入替え
を行う方式では、例えばプログラムの中にループがあり
、そのループ全体(の命令列)がキャッシュメモリに格
納可能な場合でも、一部のデータが無効になったり、他
のデータにオーバーライトされることが生じ、そのプロ
グラムの処理時間が増大されしまうという問題があった
As described above, in the past, instructions (or data) were stored from the main memory to the cache memory in units of blocks of a predetermined size. However, with the method of replacing the cache memory in block units, even if there is a loop in the program and the entire loop (instruction sequence) can be stored in the cache memory, some data may become invalid. However, there is a problem in that the program may be overwritten with other data, increasing the processing time of the program.

【0006】この発明は上記事情に鑑みてなされたもの
でその目的は、実行中のプログラムループを構成する命
令列がキャッシュメモリに入り切る場合には、そのルー
プの命令列を、そのループの処理が終了するまで確実に
キャッシュメモリに駐在させることができ、もってプロ
グラム処理の高速化が図れるキャッシュメモリ制御方式
を提供することにある。
The present invention has been made in view of the above-mentioned circumstances, and an object of the present invention is to transfer the instruction string of the program loop being executed to the processing of the loop when the instruction string constituting the program loop being executed can fit into the cache memory. It is an object of the present invention to provide a cache memory control method that can reliably make programs reside in a cache memory until they are completed, thereby speeding up program processing.

【0007】[0007]

【課題を解決するための手段】この発明は、前に戻る分
岐命令の分岐成立時に、キャッシュメモリに入り切る命
令列からなるプログラムループの実行中であることを検
出することにより、同ループの構成命令列を全てキャッ
シュメモリに格納し、同ループの処理の終了を検出する
までは同ループの構成命令列がキャッシュメモリから追
出されないようにしたことを特徴とするものである。
[Means for Solving the Problems] The present invention detects that a program loop consisting of an instruction sequence that can fit into a cache memory is being executed when a branch of a previous branch instruction is established, thereby reconfiguring the loop. The entire instruction sequence is stored in the cache memory, and the instruction sequence forming the loop is not evicted from the cache memory until the end of the processing of the same loop is detected.

【0008】[0008]

【作用】上記の構成において、CPUは、前に戻る分岐
命令の分岐成立時に、その分岐先アドレスの示す分岐先
命令から分岐命令までの命令列がキャッシュメモリに入
り切ることを検出することにより、分岐命令の命令アド
レスと分岐先アドレスと分岐先命令から分岐命令までの
命令列のサイズをレジスタに保持し、再びその分岐命令
を実行して分岐が成立した場合には、その分岐命令がプ
ログラムループのために用いられていること、即ちプロ
グラムループの実行中であることを検出し、そのプログ
ラムループを構成する命令列のキャッシュメモリへの格
納をキャッシュコントローラに要求する。
[Operation] In the above configuration, the CPU detects that the instruction string from the branch destination instruction indicated by the branch destination address to the branch instruction is completely stored in the cache memory when a branch of the previous branch instruction is established. The instruction address of the branch instruction, the branch destination address, and the size of the instruction sequence from the branch destination instruction to the branch instruction are held in registers, and if the branch instruction is executed again and the branch is taken, the branch instruction is inserted into the program loop. It detects that a program loop is being executed, that is, a program loop is being executed, and requests the cache controller to store a sequence of instructions constituting the program loop in the cache memory.

【0009】これによりキャッシュコントローラは、上
記レジスタの内容に従い、プログラムループの命令列を
例えば主記憶から取出してキャッシュメモリに格納する
。そしてキャッシュコントローラは、上記レジスタの内
容が有効な期間中(プログラムループの実行期間中)は
、CPUからのアクセス要求に対して、いわゆるキャッ
シングではなく、通常のメモリアクセスを行ってプログ
ラムループ中の対応命令を取出し、CPUに送出する。
[0009] Accordingly, the cache controller takes out the instruction sequence of the program loop from, for example, the main memory and stores it in the cache memory according to the contents of the register. During the period when the contents of the above registers are valid (during the execution period of the program loop), the cache controller responds to access requests from the CPU by performing normal memory access rather than caching. Takes an instruction and sends it to the CPU.

【0010】さて、上記レジスタの内容は、実行中の命
令の命令アドレスが上記レジスタに保持されている分岐
命令の命令アドレスを越えると、プログラムループの処
理が終了したものとして(ループから抜け出たものとし
て)、クリアされる。キャッシュコントローラは、上記
レジスタの内容がクリアされると、CPUからのアクセ
ス要求に対してキャッシングを行い、キャッシュミスの
場合には、要求先の命令を含むブロックデータをキャッ
シュメモリに格納する。
Now, the contents of the above register are determined as follows: When the instruction address of the instruction being executed exceeds the instruction address of the branch instruction held in the above register, it is assumed that the processing of the program loop has ended (the one that has escaped from the loop). ), cleared. When the contents of the register are cleared, the cache controller performs caching in response to an access request from the CPU, and in the case of a cache miss, stores block data including the requested instruction in the cache memory.

【0011】[0011]

【実施例】図1はこの発明を適用するキャッシュメモリ
を持つ情報処理装置の一実施例を示すブロック構成図で
ある。
DESCRIPTION OF THE PREFERRED EMBODIMENTS FIG. 1 is a block diagram showing an embodiment of an information processing apparatus having a cache memory to which the present invention is applied.

【0012】図1において、1は装置の中心をなし、命
令実行を司るCPU、2は各種プログラム、データの格
納に用いられる主記憶、3は主記憶2の内容の一部の写
し、例えばプログラムの一部の写しが置かれるキャッシ
ュメモリ(命令キャッシュ)、4はCPU1からの主記
憶アクセス要求を受けてキャッシュメモリ3また主記憶
2をアクセスするキャッシュコントローラである。なお
図1には、主記憶2上のデータの一部の写しが置かれる
キャッシュメモリ(データキャッシュ)は省略されてい
る。
In FIG. 1, numeral 1 is a CPU which forms the center of the device and is in charge of executing instructions; 2 is a main memory used for storing various programs and data; and 3 is a copy of a part of the contents of the main memory 2, such as a program. A cache memory (instruction cache) in which a copy of a part of is placed, 4 is a cache controller that accesses the cache memory 3 or the main memory 2 in response to a main memory access request from the CPU 1. Note that a cache memory (data cache) in which a copy of part of the data on the main memory 2 is placed is omitted in FIG.

【0013】CPU1には、前に戻る分岐先を指定する
条件付分岐命令の命令アドレスを保持するためのレジス
タ11(REG#1)と、上記条件付分岐命令で指定さ
れる分岐先のアドレスを保持するためのレジスタ12(
REG#2)と、レジスタ13(REG#3)とが設け
られる。このレジスタ13は、上記条件付分岐命令で指
定される分岐先アドレスの命令から同分岐命令までの命
令列のサイズ(以下、ループサイズと称する)を保持す
るのに用いられる。レジスタ11〜13は、キャッシュ
コントローラ4から参照可能である。
The CPU 1 has a register 11 (REG#1) for holding the instruction address of a conditional branch instruction that specifies the previous branch destination, and a register 11 (REG#1) for holding the instruction address of the conditional branch instruction that specifies the branch destination to return to. Register 12 for holding (
REG#2) and a register 13 (REG#3) are provided. This register 13 is used to hold the size of the instruction string from the instruction at the branch destination address specified by the conditional branch instruction to the branch instruction (hereinafter referred to as loop size). The registers 11 to 13 can be referenced by the cache controller 4.

【0014】CPU1にはまた、実行中命令(これから
実行される命令)の命令アドレスとレジスタ11(RE
G#1)の保持内容(分岐命令アドレス)とを比較する
比較器14が設けられる。この比較器14は、実行中命
令の命令アドレスがレジスタ11の内容に一致している
ことを検出した場合に、プログラムループを構成するた
めの分岐命令の実行であることを示すループ構成分岐命
令検出信号15を出力し、実行中命令の命令アドレスが
レジスタ11の内容を越えていることを検出した場合に
、プログラムループの処理の終了を示すループ終了検出
信号16を出力する。このループ終了検出信号16は、
レジスタ11〜13(REG#1〜#3)の内容をクリ
アするためのクリア信号として用いられる。
The CPU 1 also contains the instruction address of the instruction currently being executed (the instruction to be executed) and the register 11 (RE
A comparator 14 is provided to compare the content held in the branch instruction (branch instruction address) of the branch instruction G#1). When the comparator 14 detects that the instruction address of the instruction being executed matches the contents of the register 11, the comparator 14 detects a loop configuration branch instruction, which indicates that a branch instruction for configuring a program loop is being executed. A signal 15 is output, and when it is detected that the instruction address of the instruction being executed exceeds the contents of the register 11, a loop end detection signal 16 indicating the end of the program loop processing is output. This loop end detection signal 16 is
It is used as a clear signal to clear the contents of registers 11 to 13 (REG #1 to #3).

【0015】CPU1には更に、比較器14からのルー
プ構成分岐命令検出信号15と、条件付分岐命令実行時
にその条件が成立したこと(分岐が成立したこと)を示
す分岐成立信号17との論理積をとるアンドゲート18
と、このアンドゲート18の出力信号(以下、ループ実
行中検出信号と称する)19に応じてセット(オン)す
るループ命令列格納フラグ(F)20とが設けられる。 このループ命令列格納フラグ20は、レジスタ11〜1
3の内容で指定されるプログラムループの構成命令列(
ループ命令列)をキャッシュメモリ3に格納して、キャ
ッシングによらないキャッシュメモリアクセスを行うこ
とをキャッシュコントローラ4に指示するためのもので
ある。ループ命令列格納フラグ20は、ループ終了検出
信号16とレジスタ11〜13の書換えを示すREG書
換え信号21との論理和をとるオアゲート22の出力信
号に応じてリセット(オフ)される。
The CPU 1 further includes a logic between the loop configuration branch instruction detection signal 15 from the comparator 14 and a branch established signal 17 indicating that the condition is satisfied (that the branch is established) when the conditional branch instruction is executed. AND gate 18 that takes the product
and a loop instruction string storage flag (F) 20 that is set (turned on) in response to an output signal (hereinafter referred to as a loop execution detection signal) 19 of the AND gate 18. This loop instruction string storage flag 20 is stored in registers 11 to 1.
The configuration instruction sequence of the program loop specified by the contents of 3 (
This command is used to instruct the cache controller 4 to store a loop instruction sequence) in the cache memory 3 and perform cache memory access that does not involve caching. The loop instruction string storage flag 20 is reset (turned off) in response to the output signal of the OR gate 22 which takes the logical sum of the loop end detection signal 16 and the REG rewrite signal 21 indicating rewriting of the registers 11 to 13.

【0016】次に、図1の構成の動作を、図2乃至図4
のフローチャートを参照して説明する。CPU1はまず
、前に戻る条件付分岐命令(即ち、条件成立時の分岐先
が分岐命令より前のアドレスとなる条件付分岐命令)の
実行時に、その条件が成立して分岐する際には、その分
岐命令のアドレスから分岐先のアドレスを引いた値(相
対アドレスの絶対値)に、その分岐命令自身の大きさ(
命令長)を加えた値、即ち分岐先の命令から分岐命令ま
での命令列(分岐命令がプログラムループを構成するた
めの命令であるものとした場合の、そのループサイズ)
を算出する(図2ステップS1)。
Next, the operation of the configuration shown in FIG. 1 will be explained with reference to FIGS. 2 to 4.
This will be explained with reference to the flowchart. First, when the CPU 1 executes a conditional branch instruction to go back (i.e., a conditional branch instruction in which the branch destination when the condition is met is an address before the branch instruction), when the condition is met and the branch is executed, The value obtained by subtracting the address of the branch destination from the address of the branch instruction (the absolute value of the relative address) is the size of the branch instruction itself (
(instruction length), that is, the instruction sequence from the branch destination instruction to the branch instruction (the loop size when the branch instruction is an instruction for configuring a program loop)
(Step S1 in FIG. 2).

【0017】次にCPU1は、算出したループサイズと
キャッシュメモリ3のサイズ(キャッシュサイズ)との
比較により、ループサイズがキャッシュサイズ以下であ
ること、即ち該当するプログラムループの構成命令列が
キャッシュメモリ3に入り切ることを検出し、更にレジ
スタ11〜13(REG#1〜#3)が全てクリアされ
ていることを検出したならば(図2ステップS2,S3
)、実行中の分岐命令のアドレスをレジスタ11に、同
分岐命令で指定される分岐先のアドレスをレジスタ12
に、そして算出したループサイズをレジスタ13に、そ
れぞれ設定する(図2ステップS4)。
Next, the CPU 1 compares the calculated loop size with the size of the cache memory 3 (cache size) and determines that the loop size is less than or equal to the cache size, that is, the constituent instruction sequence of the corresponding program loop is in the cache memory 3. If it is detected that the registers 11 to 13 (REG #1 to #3) are all cleared (steps S2 and S3 in FIG.
), the address of the branch instruction being executed is stored in register 11, and the address of the branch destination specified by the same branch instruction is stored in register 12.
and set the calculated loop size in the register 13 (step S4 in FIG. 2).

【0018】またCPU1は、レジスタ11〜13に既
に何らかの値が設定されている場合でも、算出したルー
プサイズが、(キャッシュサイズ以下であって且つ)レ
ジスタ13(REG#3)の示すループサイズより大き
いならば、アクティブなREG書換え信号21を出力し
た上で(図2ステップS5,S6)、上記ステップ4の
レジスタ設定を行う。これにより、レジスタ11〜13
が、既設定のプログラムループよりサイズの大きい新た
なプログラムループに関する情報に書換えられる。この
とき、オアゲート22の出力信号が、アクティブなRE
G書換え信号21に応じて真となり、これによりループ
命令列格納フラグ20はオフ状態となる。
[0018] Furthermore, even if some value has already been set in registers 11 to 13, the CPU 1 determines that the calculated loop size is smaller than the loop size indicated by register 13 (REG#3) (less than or equal to the cache size). If it is larger, the active REG rewrite signal 21 is output (steps S5 and S6 in FIG. 2), and the register setting in step 4 is performed. As a result, registers 11 to 13
is rewritten with information regarding a new program loop that is larger in size than the previously set program loop. At this time, the output signal of the OR gate 22 is
It becomes true in response to the G rewrite signal 21, and thereby the loop instruction string storage flag 20 is turned off.

【0019】さて、CPU1は、分岐成立(分岐条件成
立)すると、分岐先命令以降の命令列を順に実行する。 この際の命令は、CPU1からキャッシュコントローラ
4に対して命令アドレスと共に命令アクセス要求が出力
されることにより、次のようにキャッシュコントローラ
4から与えられるものである。
Now, when the branch is established (branch condition is satisfied), the CPU 1 sequentially executes the instruction sequence after the branch destination instruction. The instruction at this time is given from the cache controller 4 as follows by outputting an instruction access request together with an instruction address from the CPU 1 to the cache controller 4.

【0020】即ちキャッシュコントローラ4は、CPU
1から命令アクセス要求があると、ループ命令列格納フ
ラグ20の状態を調べ(図4ステップS21)、本実施
例のようにオフ状態にある場合には、キャッシュメモリ
3に対していわゆるキャッシングによるアクセスを行う
ことで(図4ステップS23)、要求された命令を得て
、CPU1に出力する。この際、ミスヒットとなったな
らば、要求された命令を含むブロックが主記憶2から読
出されてキャッシュメモリ3の該当領域に書込まれるこ
とは勿論である。
That is, the cache controller 4
When there is an instruction access request from 1, the state of the loop instruction string storage flag 20 is checked (step S21 in FIG. 4), and if it is in the off state as in this embodiment, the cache memory 3 is accessed by so-called caching. By doing this (step S23 in FIG. 4), the requested command is obtained and output to the CPU 1. At this time, if a miss occurs, the block containing the requested instruction is of course read from the main memory 2 and written to the corresponding area of the cache memory 3.

【0021】このようにして、分岐先命令以降の命令列
が順に実行され、やがてレジスタ11に保持されている
命令アドレスと同一命令アドレスの命令、即ちレジスタ
11〜13への情報設定のきっかけとなった条件付分岐
命令が再び実行されると、比較器14からアクティブな
ループ構成分岐命令検出信号15が出力される。
[0021] In this way, the instruction sequence after the branch destination instruction is executed in order, and eventually an instruction with the same instruction address as the instruction address held in register 11, that is, information setting in registers 11 to 13, is triggered. When the conditional branch instruction is executed again, the comparator 14 outputs an active loop configuration branch instruction detection signal 15.

【0022】このとき、再実行された条件付分岐命令の
条件が成立するならば、図示せぬデコーダから条件成立
を示すアクティブな分岐成立信号17が出力される。こ
の結果、アンドゲート18から、(再実行された条件付
分岐命令がプログラムループを構成する分岐命令であり
、したがって)プログラムループの実行中であることを
示すアクティブなループ実行中検出信号19が出力され
、ループ命令列格納フラグ20がオン状態となる。
At this time, if the condition of the re-executed conditional branch instruction is satisfied, an active branch established signal 17 indicating that the condition is satisfied is output from a decoder (not shown). As a result, the AND gate 18 outputs an active loop execution detection signal 19 indicating that the program loop is being executed (because the re-executed conditional branch instruction is a branch instruction that constitutes a program loop). Then, the loop instruction string storage flag 20 is turned on.

【0023】キャッシュコントローラ4は、ループ命令
列格納フラグ20がオン状態になると、図3のフローチ
ャートに示すループ命令列の格納処理を以下に述べるよ
うに実行する。
When the loop instruction string storage flag 20 is turned on, the cache controller 4 executes the loop instruction string storage process shown in the flowchart of FIG. 3 as described below.

【0024】即ちキャッシュコントローラ4は、まずC
PU1内のレジスタ12,13(REG#2,#3)の
内容(分岐先アドレス、ループサイズ)を取出す(図3
ステップS11)。次にキャッシュコントローラ4は、
レジスタ12で示される分岐先アドレスを先頭アドレス
とし、レジスタ13で示されるサイズ分のループ命令列
を、主記憶2から順に取出す(図3ステップS12)。
That is, the cache controller 4 first
Retrieve the contents (branch destination address, loop size) of registers 12 and 13 (REG #2, #3) in PU1 (Figure 3
Step S11). Next, the cache controller 4
Using the branch destination address indicated by the register 12 as the start address, a loop instruction string of the size indicated by the register 13 is sequentially retrieved from the main memory 2 (step S12 in FIG. 3).

【0025】そしてキャッシュコントローラ4は、主記
憶2から取出した命令列、即ちレジスタ12に保持され
ている分岐先アドレスで指定される分岐先命令から、レ
ジスタ11に保持されている命令アドレスで指定される
分岐命令までの命令列(ループ命令列)を、キャッシュ
メモリ3の先頭アドレスから順に書込む(図3ステップ
S13)。このように本実施例では、プログラムループ
の実行中が検出されると、そのループの命令列が全てキ
ャッシュメモリ3に書込まれ、従来のキャシングにおけ
るミスヒット時のブロック書込みとは異なることに注意
されたい。
[0025] The cache controller 4 then selects a branch destination instruction specified by the instruction address held in the register 11 from the instruction sequence retrieved from the main memory 2, that is, a branch destination instruction specified by the branch destination address held in the register 12. The instruction string (loop instruction string) up to the branch instruction is written in order from the first address of the cache memory 3 (step S13 in FIG. 3). In this way, in this embodiment, when it is detected that a program loop is being executed, the entire instruction sequence of the loop is written to the cache memory 3, which is different from block writing when a miss occurs in conventional caching. I want to be

【0026】一方、CPU1は、再実行した分岐命令の
条件が成立すると、分岐先命令以降の命令列を順に実行
する。この際の命令は、CPU1からキャッシュコント
ローラ4に対して命令アドレスと共に命令アクセス要求
が出力されることにより、次のようにキャッシュコント
ローラ4から与えられるものである。
On the other hand, when the condition of the re-executed branch instruction is satisfied, the CPU 1 sequentially executes the instruction sequence after the branch destination instruction. The instruction at this time is given from the cache controller 4 as follows by outputting an instruction access request together with an instruction address from the CPU 1 to the cache controller 4.

【0027】即ちキャッシュコントローラ4は、CPU
1から命令アクセス要求があると、ループ命令列格納フ
ラグ20の状態を調べ(図4ステップS21)、この例
のようにオン状態にある場合には、要求された命令アド
レスからレジスタ12(REG#2)の内容(分岐先ア
ドレス)を差し引いた値をキャッシュメモリ3のアドレ
スとして、通常のメモリアクセスと同様にキャッシュメ
モリ3をリードアクセスすることで(図4ステップS2
2)、要求された命令を得て、CPU1に出力する。こ
の際、いわゆるキャッシングのためのキャッシュヒット
/ミスの検出機構の動作は、抑止または無視され、キャ
ッシングが行われないことから、キャッシュメモリ3に
書込まれた実行中のループ命令列が、一部分たりとも追
出されることはない。
That is, the cache controller 4
When there is an instruction access request from 1, the state of the loop instruction string storage flag 20 is checked (step S21 in FIG. 4), and if it is in the on state as in this example, the register 12 (REG# By subtracting the contents of 2) (branch destination address) and setting the value as the address of the cache memory 3, read access to the cache memory 3 in the same way as normal memory access (step S2 in FIG. 4).
2) Obtain the requested instruction and output it to the CPU 1. At this time, the operation of the so-called cache hit/miss detection mechanism for caching is suppressed or ignored, and caching is not performed. You will not be kicked out either.

【0028】このようにして、CPU1がループ命令列
を順に実行していき、やがてレジスタ11に保持されて
いる命令アドレスで指定される分岐命令が実行されて分
岐不成立となり、次の命令のアクセスが要求されたもの
とする。この場合、その命令の命令アドレスはレジスタ
11に保持されている命令アドレス(分岐命令のアドレ
ス)より大きいことから、比較器14からプログラムル
ープの処理の終了(ループから抜け出たこと)を示すア
クティブなループ終了検出信号16が出力される。この
結果、レジスタ11〜13(REG#1〜#3)の内容
がクリアされると共に、ループ命令列格納フラグ20が
オフ状態となる。キャッシュコントローラ4は、ループ
命令列格納フラグ20がオフ状態になると、CPU1か
らの命令アクセス要求に対してキャッシングによるキャ
ッシュメモリ3のアクセスを行う(図4ステップS21
,S23)。
In this way, the CPU 1 sequentially executes the loop instruction sequence, and eventually the branch instruction specified by the instruction address held in the register 11 is executed, the branch is not taken, and the access of the next instruction is interrupted. As requested. In this case, since the instruction address of that instruction is larger than the instruction address (branch instruction address) held in the register 11, the active signal from the comparator 14 indicates the end of the program loop processing (exit from the loop). A loop end detection signal 16 is output. As a result, the contents of registers 11 to 13 (REG #1 to #3) are cleared, and the loop instruction string storage flag 20 is turned off. When the loop instruction string storage flag 20 turns off, the cache controller 4 accesses the cache memory 3 by caching in response to an instruction access request from the CPU 1 (step S21 in FIG. 4).
, S23).

【0029】なお、前記実施例では、ループサイズを保
持するためのレジスタ13(REG#3)を設けた場合
について説明したが、命令長が固定の場合には、レジス
タ11,12の内容からループサイズを求めることがで
きるため、レジスタ13は必ずしもなくてもよい。また
、図2のフローチャートで示されるCPU1の処理は、
ハードウェア回路により簡単に実現可能である。
In the above embodiment, the case where the register 13 (REG#3) for holding the loop size was provided was explained, but if the instruction length is fixed, the loop size is determined from the contents of registers 11 and 12. Since the size can be determined, the register 13 does not necessarily have to be provided. Furthermore, the processing of the CPU 1 shown in the flowchart of FIG.
This can be easily realized using a hardware circuit.

【0030】[0030]

【発明の効果】以上詳述したようにこの発明によれば、
前に戻る分岐命令の分岐成立時に、キャッシュメモリに
入り切る命令列からなるプログラムループの実行中であ
ることを検出することにより、同ループの構成命令列を
全てキャッシュメモリに格納し、同ループの処理の終了
を検出するまでは同ループの構成命令列がキャッシュメ
モリから追出されないようにしたので、プログラムルー
プの構成命令を高速にフェッチすることができ、プログ
ラム処理の高速化が図れる。
[Effects of the Invention] As detailed above, according to the present invention,
When a branch to the previous branch instruction is taken, by detecting that a program loop consisting of a sequence of instructions that can fit into the cache memory is being executed, all the instruction sequences that constitute the loop are stored in the cache memory, and the execution of the same loop is executed. Since the constituent instructions of the same loop are not ejected from the cache memory until the end of processing is detected, the constituent instructions of the program loop can be fetched at high speed, and program processing can be accelerated.

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

【図1】この発明を適用するキャッシュメモリを持つ情
報処理装置の一実施例を示すブロック構成図。
FIG. 1 is a block diagram showing an embodiment of an information processing device having a cache memory to which the present invention is applied.

【図2】図1のCPU1におけるレジスタ設定動作を説
明するためのフローチャート。
FIG. 2 is a flowchart for explaining a register setting operation in the CPU 1 in FIG. 1;

【図3】図1のキャッシュコントローラ4におけるルー
プ命令列格納動作を説明するためのフローチャート。
FIG. 3 is a flowchart for explaining a loop instruction string storage operation in the cache controller 4 of FIG. 1;

【図4】図1のキャッシュコントローラ4におけるキャ
ッシュアクセス動作を説明するためのフローチャート。
4 is a flowchart for explaining a cache access operation in the cache controller 4 of FIG. 1. FIG.

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

1…CPU、2…主記憶、3…キャッシュメモリ、4…
キャッシュコントローラ、11…レジスタ(REG#1
)、12…レジスタ(REG#2)、13…レジスタ(
REG#3)、14…比較器(第1、第2の検出手段)
、18…アンドゲート(第1の検出手段)、20…ルー
プ命令列格納フラグ(F)。
1...CPU, 2...Main memory, 3...Cache memory, 4...
Cache controller, 11... register (REG#1
), 12...Register (REG#2), 13...Register (
REG#3), 14... Comparator (first and second detection means)
, 18... AND gate (first detection means), 20... Loop instruction string storage flag (F).

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】  キャッシュメモリを備えた情報処理装
置において、上記キャッシュメモリに入り切る命令列か
らなるプログラムループの実行中であることを検出する
第1の検出手段と、この第1の検出手段の検出結果に応
じて上記プログラムループの構成命令列を全て上記キャ
ッシュメモリに格納する手段と、上記プログラムループ
の処理の終了を検出する第2の検出手段と、を具備し、
上記第2の検出手段による終了検出までは、上記プログ
ラムループの構成命令列が上記キャッシュメモリから追
出されないようにしたことを特徴とするキャッシュメモ
リ制御方式。
1. An information processing device equipped with a cache memory, comprising: a first detection means for detecting that a program loop consisting of a sequence of instructions that can fit into the cache memory is being executed; comprising means for storing all constituent instruction sequences of the program loop in the cache memory according to a detection result, and second detection means for detecting the end of processing of the program loop,
A cache memory control method characterized in that the instruction sequence constituting the program loop is not ejected from the cache memory until the end is detected by the second detection means.
【請求項2】  キャッシュメモリを備えた情報処理装
置において、前に戻る分岐先を指定する分岐命令の命令
アドレスを保持するための第1のレジスタと、上記分岐
命令で指定される分岐先のアドレスを保持するための第
2のレジスタと、上記分岐命令の分岐成立時に、その分
岐先の命令から同分岐命令までの命令列が上記キャッシ
ュメモリに入り切ることを検出することにより、上記第
1および第2のレジスタへの情報設定を行う手段と、上
記第1のレジスタに保持されている命令アドレスの分岐
命令の分岐成立を検出することにより、上記キャッシュ
メモリに入り切る命令列からなるプログラムループの実
行中であることを検出する第1の検出手段と、この第1
の検出手段の検出結果に応じ、上記第2のレジスタに保
持されている分岐先アドレスの命令から上記第1のレジ
スタに保持されている命令アドレスの分岐命令までの命
令列を全て上記キャッシュメモリに格納する手段と、実
行中命令のアドレスが上記第1のレジスタに保持されて
いる命令アドレスを越えたことを検出することにより、
上記プログラムループの処理の終了を検出する第2の検
出手段と、を具備し、上記第2の検出手段による終了検
出までは、上記プログラムループの構成命令列が上記キ
ャッシュメモリから追出されないようにしたことを特徴
とするキャッシュメモリ制御方式。
2. An information processing device equipped with a cache memory, comprising: a first register for holding an instruction address of a branch instruction specifying a previous branch destination; and an address of the branch destination specified by the branch instruction. A second register for holding the above-mentioned first and second registers, and a second register for holding the above-mentioned first and second registers, and detecting that, when a branch of the above-mentioned branch instruction is established, the instruction sequence from the branch destination instruction to the same branch instruction is fully stored in the above-mentioned cache memory. By means of setting information in the second register and detecting the establishment of a branch of the branch instruction of the instruction address held in the first register, a program loop consisting of an instruction string that can be stored in the cache memory is configured. a first detecting means for detecting that the first detecting means is being executed;
According to the detection result of the detection means, all instruction strings from the instruction at the branch destination address held in the second register to the branch instruction at the instruction address held in the first register are stored in the cache memory. means for storing and detecting that the address of the instruction being executed exceeds the instruction address held in the first register;
a second detection means for detecting the end of the processing of the program loop, and prevents the constituent instruction sequence of the program loop from being evicted from the cache memory until the end is detected by the second detection means. A cache memory control method that is characterized by:
【請求項3】  キャッシュメモリを備えた情報処理装
置において、前に戻る分岐先を指定する分岐命令の命令
アドレスを保持するための第1のレジスタと、上記分岐
命令で指定される分岐先のアドレスを保持するための第
2のレジスタと、上記分岐命令で指定される分岐先アド
レスの命令から同分岐命令までの命令列のサイズを保持
するための第3のレジスタと、上記分岐命令の分岐成立
時に、その分岐先の命令から同分岐命令までの命令列が
上記キャッシュメモリに入り切ることを検出することに
より、上記第1乃至第3のレジスタに有効な情報が設定
されていないか、或いは上記第3のレジスタの示すサイ
ズが、分岐成立した上記分岐命令で指定される分岐先ア
ドレスの命令から同分岐命令までの命令列のサイズより
小さいならば、上記第1乃至第3のレジスタへの情報設
定を行う手段と、上記第1のレジスタに保持されている
命令アドレスの分岐命令の分岐成立を検出することによ
り、上記キャッシュメモリに入り切る命令列からなるプ
ログラムループの実行中であることを検出する第1の検
出手段と、この第1の検出手段の検出結果に応じ、上記
第2のレジスタに保持されている分岐先アドレスの命令
から上記第1のレジスタに保持されている命令アドレス
の分岐命令までの命令列を全て上記キャッシュメモリに
格納する手段と、実行中命令のアドレスが上記第1のレ
ジスタに保持されている命令アドレスを越えたことを検
出することにより、上記プログラムループの処理の終了
を検出する第2の検出手段と、を具備し、上記第2の検
出手段による終了検出までは、上記プログラムループの
構成命令列が上記キャッシュメモリから追出されないよ
うにしたことを特徴とするキャッシュメモリ制御方式。
3. An information processing device equipped with a cache memory, comprising: a first register for holding an instruction address of a branch instruction specifying a previous branch destination; and an address of the branch destination specified by the branch instruction. a second register for holding the size of the instruction string from the instruction at the branch destination address specified by the branch instruction to the branch instruction, and a third register for holding the size of the instruction string from the instruction at the branch destination address specified by the branch instruction to the branch instruction, and the branch completion of the branch instruction. Sometimes, by detecting that the instruction string from the branch destination instruction to the branch instruction is completely stored in the cache memory, it is determined whether valid information is not set in the first to third registers or If the size indicated by the third register is smaller than the size of the instruction string from the instruction at the branch destination address specified by the branch instruction that took the branch to the same branch instruction, the information is transferred to the first to third registers. Detecting that a program loop consisting of an instruction sequence that can fit into the cache memory is being executed by detecting the execution of a branch instruction of the instruction address held in the first register and the setting means. and a first detection means for detecting a branch from the instruction at the branch destination address held in the second register to the instruction address held in the first register according to the detection result of the first detection means. The processing of the program loop is performed by storing the entire instruction sequence up to the instruction in the cache memory, and by detecting that the address of the instruction being executed exceeds the instruction address held in the first register. a second detection means for detecting the end, and the constituent instruction string of the program loop is not ejected from the cache memory until the end is detected by the second detection means. Cache memory control method.
【請求項4】  上記第2の検出手段による上記プログ
ラムループの処理の終了検出に応じて上記第1および第
2のレジスタの内容がクリアされることを特徴とする請
求項2または請求項3記載のキャッシュメモリ制御方式
4. The contents of the first and second registers are cleared in response to detection of completion of processing of the program loop by the second detection means. cache memory control method.
JP3105440A 1991-05-10 1991-05-10 Cache memory control system Pending JPH04333929A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3105440A JPH04333929A (en) 1991-05-10 1991-05-10 Cache memory control system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3105440A JPH04333929A (en) 1991-05-10 1991-05-10 Cache memory control system

Publications (1)

Publication Number Publication Date
JPH04333929A true JPH04333929A (en) 1992-11-20

Family

ID=14407656

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3105440A Pending JPH04333929A (en) 1991-05-10 1991-05-10 Cache memory control system

Country Status (1)

Country Link
JP (1) JPH04333929A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1998036351A1 (en) * 1997-02-17 1998-08-20 Hitachi, Ltd. Data processor
US5801775A (en) * 1995-07-17 1998-09-01 Nec Corporation Moving picture compression using cache memory for storing coding instructions
US6223282B1 (en) 1997-12-29 2001-04-24 Samsung Electronics Co., Ltd. Circuit for controlling execution of loop in digital signal processing chip
JP2013097638A (en) * 2011-11-02 2013-05-20 Renesas Electronics Corp Cache memory device, cache control method and microprocessor system

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5801775A (en) * 1995-07-17 1998-09-01 Nec Corporation Moving picture compression using cache memory for storing coding instructions
WO1998036351A1 (en) * 1997-02-17 1998-08-20 Hitachi, Ltd. Data processor
US6505295B1 (en) 1997-02-17 2003-01-07 Hitachi, Ltd. Data processor
US7080240B2 (en) 1997-02-17 2006-07-18 Hitachi, Ltd. Data processing apparatus
US6223282B1 (en) 1997-12-29 2001-04-24 Samsung Electronics Co., Ltd. Circuit for controlling execution of loop in digital signal processing chip
JP2013097638A (en) * 2011-11-02 2013-05-20 Renesas Electronics Corp Cache memory device, cache control method and microprocessor system

Similar Documents

Publication Publication Date Title
US6219759B1 (en) Cache memory system
JP3733842B2 (en) Vector scatter instruction control circuit and vector type information processing apparatus
US20050086435A1 (en) Cache memory controlling apparatus, information processing apparatus and method for control of cache memory
US20050210204A1 (en) Memory control device, data cache control device, central processing device, storage device control method, data cache control method, and cache control method
JP2004533079A (en) Method and apparatus for facilitating speculative storage in a multiprocessor system
JP2009282920A (en) Cache memory device
JPH04333929A (en) Cache memory control system
JPS6184753A (en) Associative buffer memory
JP2902847B2 (en) Self-modifying code execution method
JP3039391B2 (en) Memory system
JPH05257807A (en) Cache memory controller
JPH02238490A (en) Image processor
KR960029986A (en) Data processing device and cache memory control method
JPH04363738A (en) Cache memory device
JPH08161226A (en) Data look-ahead control method, cache controller and data processor
JPH04246728A (en) Information processor
JPS63311548A (en) Cache memory controlling system
JPH07219838A (en) Data look-ahead controller
JP2000347931A (en) Cache memory and method for controlling cache memory
JPH0362143A (en) Cache-write-back control system
JP2000267885A (en) Breakpoint setting method and computer readable recording medium recording program for setting breakpoint
JPH0728701A (en) Computer system
JPH02224158A (en) Cache memory device, data processor, data access method, and method for storing data in cache memory
JPH0659890A (en) Cache memory device
JPH031249A (en) Buffer memory device