JPH06266623A - Cache memory and cache memory control method - Google Patents

Cache memory and cache memory control method

Info

Publication number
JPH06266623A
JPH06266623A JP5052262A JP5226293A JPH06266623A JP H06266623 A JPH06266623 A JP H06266623A JP 5052262 A JP5052262 A JP 5052262A JP 5226293 A JP5226293 A JP 5226293A JP H06266623 A JPH06266623 A JP H06266623A
Authority
JP
Japan
Prior art keywords
memory
block
data
cache
write
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
JP5052262A
Other languages
Japanese (ja)
Inventor
Masashi Takahashi
真史 高橋
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 JP5052262A priority Critical patent/JPH06266623A/en
Publication of JPH06266623A publication Critical patent/JPH06266623A/en
Pending legal-status Critical Current

Links

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)

Abstract

PURPOSE:To improve the hit rate and the processing speed of a cache memory. CONSTITUTION:A discharge inhibition flag 13 corresponding to the respective blocks of a data memory 11 is provided, and a cache control circuit 14 controls whether data is to be replaced or not. When a discharge inhibition mode setting signal 17 is given from a processor 16, a mode switching control means 141 changes over a system to a discharge inhibition mode. A discharge inhibition mode control means 143 sets the discharge inhibition flag 13 for the block where data is loaded hereafter. The block where the discharge inhibition flag 13 is set is controlled so that it is not replaced. The mode switching control means 141 resets all the discharge inhibition flags 13 and changes over the system to a regular mode when a discharge inhibition release signal 18 is given from the processor 16.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、キャッシュメモリ及び
キャッシュメモリ制御方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a cache memory and a cache memory control method.

【0002】[0002]

【従来の技術】キャッシュメモリは、高速のプロセッサ
と低速の主メモリの間に接続され、プロセッサのメモリ
アクセスを高速化するために用いられる。
2. Description of the Related Art A cache memory is connected between a high speed processor and a low speed main memory and is used for speeding up memory access of the processor.

【0003】一般的なキャッシュメモリ構成を図12に
示す。キャッシュメモリは、データメモリ21、タグメ
モリ22、およびキャッシュ制御回路23から構成され
る。データメモリ21は、複数のブロックから構成さ
れ、ブロックごとに主メモリ24のある連続した領域の
コピーを保持する。通常、ブロックは16バイト〜32
バイト程度の大きさである。
FIG. 12 shows a general cache memory configuration. The cache memory comprises a data memory 21, a tag memory 22, and a cache control circuit 23. The data memory 21 is composed of a plurality of blocks, and holds a copy of a continuous area in the main memory 24 for each block. Normally, blocks are 16 bytes to 32
It is about the size of a byte.

【0004】タグメモリ22は、データメモリ21の各
ブロックに格納されるデータの主メモリ24上のアドレ
スを保持する。キャッシュ制御回路23は、キャッシュ
メモリとしての動作を制御するブロックである。キャッ
シュ制御回路23の動作フローを図13に示す。
The tag memory 22 holds the address on the main memory 24 of the data stored in each block of the data memory 21. The cache control circuit 23 is a block that controls the operation of the cache memory. The operation flow of the cache control circuit 23 is shown in FIG.

【0005】まず、プロセッサ25からアクセスされる
データがデータメモリ21に格納されている場合、すな
わち“ヒット”の場合は、データメモリ21がアクセス
される(ステップ101,103)。ヒットか否かは、
プロセッサ25からのアドレスがタグメモリ22に格納
されているかどうかを検索することによって判断でき
る。
First, when the data accessed from the processor 25 is stored in the data memory 21, that is, in the case of "hit", the data memory 21 is accessed (steps 101 and 103). Whether it is a hit or not,
It can be determined by searching whether the address from the processor 25 is stored in the tag memory 22.

【0006】プロセッサ25からアクセスされるデータ
がデータメモリ21に格納されていない場合、すなわち
“ミス”の場合は、データメモリ21のあるブロック
と、主メモリ24上のアクセス対象となるアドレスを含
む連続領域とで、データの入れ換え(リプレース)が行
われる(ステップ102)。
When the data accessed from the processor 25 is not stored in the data memory 21, that is, when it is a "miss", a block including the data memory 21 and a continuous address including an address to be accessed in the main memory 24 are consecutive. Data is exchanged (replaced) with the area (step 102).

【0007】どのブロックをリプレースするかは、ラン
ダムに選択する方法や、LRU(Least Recently Used
)法に基づくものが知られている。リプレース後は、
対象となるデータがデータメモリ21上に存在し、この
データをアクセスする(ステップ103)。
Which block to replace is randomly selected or LRU (Least Recently Used) is selected.
) The one based on the law is known. After replacement,
The target data exists in the data memory 21, and this data is accessed (step 103).

【0008】このようなキャッシュメモリを用いて、図
14のような、行列aij の列ごとの和を求める演算を行
う場合を考える。C言語での記述を想定すると、行列は
行方向に連続したアドレスに格納される。すなわち、列
の和を求める内側ループでは、aのアクセスはとびとび
のアドレスをアクセスすることになる。
Consider a case in which such a cache memory is used to perform an operation for obtaining the sum for each column of the matrix aij as shown in FIG. Assuming a description in C language, the matrix is stored at consecutive addresses in the row direction. That is, in the inner loop for obtaining the sum of columns, the access of a is to access discrete addresses.

【0009】このときのキャッシュメモリの動作を図1
5に示す。データメモリ21のブロックサイズは4ワー
ド、リプレース方式はLRU(Least Recently Used )
法を例にとって説明する。
The operation of the cache memory at this time is shown in FIG.
5 shows. The block size of the data memory 21 is 4 words, and the replacement method is LRU (Least Recently Used)
The method will be described as an example.

【0010】図15(a)には、データメモリ21のブ
ロック数が行列の行数よりも十分多い場合で、iに関す
る外側ループが1回進んだ時点でのデータメモリ21の
内容を示す。行列aの第0列目のデータがデータメモリ
21に格納されるが、データメモリ21にはブロック単
位で連続した領域が格納されるため、第3列目までのデ
ータも同時にデータメモリ21に格納される。従って、
これ以後i=1〜3のループでは、aに関するアクセス
はすべてヒットするため高速に処理できる。
FIG. 15A shows the contents of the data memory 21 when the number of blocks in the data memory 21 is sufficiently larger than the number of rows in the matrix and the outer loop for i advances once. The data in the 0th column of the matrix a is stored in the data memory 21, but since the data memory 21 stores a continuous area in block units, the data up to the 3rd column is also stored in the data memory 21 at the same time. To be done. Therefore,
After that, in the loop of i = 1 to 3, all the accesses relating to a hit, so that it can be processed at high speed.

【0011】図15(b)〜(d)では、データメモリ
21のブロック数が行数よりも少ない場合を示す。以下
では、ブロックに格納される一連のデータをで表す。
すなわち、図15(a)のa00 a01 a02 a03 をa0で表
すことになる。ここでは、行列の行数nに対し、ブロッ
ク数をk(k<n)とする。i=0 のループで、j=k-1 になった
時点を(b) に示す。データメモリ21の各ブロックに、
a の0行〜k-1 行までのデータが格納される。
FIGS. 15B to 15D show a case where the number of blocks in the data memory 21 is smaller than the number of rows. Hereinafter, a series of data stored in the block is represented by * .
That is, a00 a01 a02 a03 in FIG. 15A is represented by a0 * . Here, the number of blocks is k (k <n) for the number n of rows in the matrix. In the loop of i = 0, the time when j = k-1 is shown in (b). In each block of the data memory 21,
The data from line 0 to line k-1 of a is stored.

【0012】次に k行目がアクセスされると、 (c)に示
すように、a0の格納されているブロックでリプレース
が起こる。すなわち、a0はキャッシュから追い出さ
れ、akが新たにロードされる。j=n-1 までループが進
んだ時点、すなわちi=0 のループが終了した時点の様子
を(d) に示す。(b) まででロードされたデータの多く
は、リプレースによって追い出されてしまっている。
Next, when the k-th row is accessed, replacement occurs in the block storing a0 * , as shown in (c). That is, a0 * is evicted from the cache and ak * is newly loaded. (d) shows the state when the loop advances to j = n-1, that is, when the loop with i = 0 ends. Most of the data loaded up to (b) has been evicted by replacement.

【0013】次のi=1 のループが開始された時点の様子
を(e) に示す。a0はキャッシュ上には存在しないの
で、リプレースが起こり、さらにキャッシュ上のデータ
が追い出されてしまう。このように、すべてのメモリア
クセスがキャッシュミスを起こし、そのたびにキャッシ
ュ上のデータが追い出され、それによってまたキャッシ
ュミスを起こす、という悪循環が発生する。これによっ
て、ヒット率が著しく低下する。
The state at the time when the next loop of i = 1 is started is shown in (e). Since a0 * does not exist in the cache, replacement will occur and the data in the cache will be evicted. In this way, a vicious cycle occurs in which every memory access causes a cache miss, and each time the data on the cache is expelled, thereby causing a cache miss again. This significantly reduces the hit rate.

【0014】ところで、通常ソフトウェアからは、キャ
ッシュメモリは見えなくなっており、主メモリが高速化
したように見える。ソフトウェア側になんら手を加える
ことなく、処理の高速化を実現することができる。
By the way, the cache memory cannot be seen from the normal software, and the main memory seems to have been speeded up. High-speed processing can be realized without any modification on the software side.

【0015】キャッシュメモリの方式として、ライトス
ルー方式とライトバック方式が知られている。ライトス
ルー方式は、メモリ書き込み時は、キャッシュメモリ上
のデータとともに、主メモリの対応する番地にも書き込
みを行うため、書き込み時にはキャッシュの効果がな
い。
As a cache memory system, a write-through system and a write-back system are known. The write-through method has no cache effect at the time of writing because it writes to the corresponding address of the main memory together with the data on the cache memory at the time of writing to the memory.

【0016】ライトバック方式では、メモリ書き込み
時、この番地のデータがキャッシュメモリ上に存在して
いれば(キャッシュヒット)、キャッシュメモリ上に書
き込みを行い、主メモリには書き込みを行なわない。い
ずれの方式でも、ソフト側からは、キャッシュメモリの
存在を全く意識する必要がなく、高速なメモリに見え
る。
In the write-back method, when the data at this address exists in the cache memory (cache hit) at the time of writing to the memory, the data is written in the cache memory and not written in the main memory. With either method, the software does not need to be aware of the existence of the cache memory at all, and it looks like a high-speed memory.

【0017】一般的なライトバック方式のキャッシュメ
モリを用いた情報処理装置の大まかな構成を図5に示
す。この情報処理装置は大きくは、キャッシュメモリ3
1、プロセッサ32、主メモリ33から構成される。プ
ロセッサ32とキャッシュメモリ31、キャッシュメモ
リ31と主メモリ33は、アドレス線、データ線、制御
線で接続される。キャッシュメモリ31は複数のブロッ
クから構成され、ブロック単位で、主メモリ33上の連
続した領域のコピーを保持する。
FIG. 5 shows a general structure of an information processing apparatus using a general write-back type cache memory. This information processing device is roughly composed of a cache memory 3
1, a processor 32, and a main memory 33. The processor 32 and the cache memory 31, and the cache memory 31 and the main memory 33 are connected by an address line, a data line, and a control line. The cache memory 31 is composed of a plurality of blocks, and holds a copy of a continuous area on the main memory 33 in block units.

【0018】プロセッサ32で、メモリアクセス命令の
実行により、アクセス要求が発生すると、まず、該当す
るアドレスのデータがキャッシュメモリ31上に存在す
るかどうかを調べる。キャッシュメモリ31上に該当す
るアドレスのデータが存在すれば(キャアッシュヒッ
ト)、キャッシュメモリ31上のデータがアクセスされ
る。この場合、アクセス時間は非常に短くなる。
When an access request is issued by the processor 32 by executing a memory access instruction, it is first checked whether or not the data at the corresponding address exists in the cache memory 31. If the data of the corresponding address exists in the cache memory 31 (cache hit), the data in the cache memory 31 is accessed. In this case, the access time will be very short.

【0019】該当するアドレスのデータがキャッシュメ
モリ31上に存在しない場合(キャッシュミス)、キャ
ッシュメモリ31上の任意のブロックと、主メモリ33
上のアクセス対象となるアドレスを含む連続領域とでリ
プレースが行われる。
If the data of the corresponding address does not exist in the cache memory 31 (cache miss), an arbitrary block in the cache memory 31 and the main memory 33.
Replacement is performed with the continuous area including the address to be accessed above.

【0020】すなわち、 (1)任意のブロックを選択し、このブロックに対して
プロセッサ32から書き込みが行われていれば、このブ
ロックの全データを対応する主メモリ33の領域に書き
戻す(ライトバック)。 (2)ライトバックの後、アクセス対象となっているア
ドレスを含む連続領域を読み出し、この任意のブロック
に格納する。リプレース後、アクセス対象のデータは、
キャッシュメモリ31上に存在するので、プロセッサ3
2はこのデータをアクセスする。
That is, (1) If an arbitrary block is selected and writing is performed from the processor 32 to this block, all data of this block is written back to the corresponding area of the main memory 33 (write back). ). (2) After write back, the continuous area including the address to be accessed is read and stored in this arbitrary block. After replacement, the data to be accessed is
Since it exists in the cache memory 31, the processor 3
2 accesses this data.

【0021】このように、ライトバック方式キャッシュ
メモリでは、キャッシュミスの場合、リプレース対象と
なるブロックの全データを主メモリ33に書き戻してか
らでないと、対象データをキャッシュメモリ31にロー
ドすることができない。すなわち、キャッシュミス時の
ペナルティが大きいため、ヒット率が少しでも低下する
と、全体の処理速度も著しく低下してしまう。
As described above, in the write-back cache memory, in the case of a cache miss, the target data can be loaded into the cache memory 31 only after all the data of the block to be replaced is written back to the main memory 33. Can not. That is, since the penalty at the time of a cache miss is large, if the hit rate is reduced even a little, the overall processing speed will be significantly reduced.

【0022】図5で示したライトバック方式のキャッシ
ュメモリ31の詳細な構成を図16に示す。このキャッ
シュメモリ31は、データメモリ51、タグメモリ5
2、ダーティ・フラグ53、制御回路54、及びリプレ
ースブロック選択回路55から構成される。制御回路5
4は、さらにキャッシュ制御回路541とメモリアクセ
ス制御回路542とから構成される。
FIG. 16 shows the detailed structure of the write-back type cache memory 31 shown in FIG. The cache memory 31 includes a data memory 51 and a tag memory 5
2, a dirty flag 53, a control circuit 54, and a replace block selection circuit 55. Control circuit 5
4 further comprises a cache control circuit 541 and a memory access control circuit 542.

【0023】データメモリ51は、複数のブロックから
構成され、ブロックごとに主メモリ33のある連続した
領域のコピーを保持する。通常ブロックは16バイト〜
32バイト程度の大きさである。タグメモリ52は、デ
ータメモリ51の各ブロックに格納されるデータの主メ
モリ33上のアドレスを保持する。キャッシュ制御回路
541は、キャッシュメモリ31としての動作を制御す
るブロックである。キャッシュ制御回路541の動作フ
ローを図9に示す。
The data memory 51 is composed of a plurality of blocks and holds a copy of a continuous area in the main memory 33 for each block. Normal block is 16 bytes ~
The size is about 32 bytes. The tag memory 52 holds the address on the main memory 33 of the data stored in each block of the data memory 51. The cache control circuit 541 is a block that controls the operation of the cache memory 31. The operation flow of the cache control circuit 541 is shown in FIG.

【0024】まず、プロセッサ32からのアクセス要求
によって、キャッシュ制御回路541が起動される。プ
ロセッサ32からアクセスされるデータがデータメモリ
51に格納されている場合、すなわち´ヒット´の場合
(ステップ401肯定)は、データメモリ51がアクセ
スされる。さらに書き込みの場合は、対応するダーティ
・フラグ43をセットする(ステップ402,40
3)。ヒットか否かは、プロセッサ32からのアドレス
がタグメモリ52に格納されているかどうかを検索する
ことによって判断できる。
First, an access request from the processor 32 activates the cache control circuit 541. When the data accessed from the processor 32 is stored in the data memory 51, that is, when it is a'hit '(Yes at step 401), the data memory 51 is accessed. In the case of further writing, the corresponding dirty flag 43 is set (steps 402, 40).
3). Whether it is a hit or not can be determined by searching whether or not the address from the processor 32 is stored in the tag memory 52.

【0025】プロセッサ32からアクセスされるデータ
がデータメモリ51に格納されていない場合、すなわち
´ミス´の場合(ステップ401否定)は、データメモ
リ51のブロックと、主メモリ31上のアクセス対象と
なるアドレスを含む連続領域とで、データの入れ換え
(リプレース)が行われる。どのブロックをリプレース
するかは、ランダムに選択する方法や、LRU(Least
Recently Used)法に基づくものが知られている。
If the data accessed from the processor 32 is not stored in the data memory 51, that is, if it is a'miss' (No at step 401), the block of the data memory 51 and the main memory 31 are to be accessed. Data is replaced (replaced) in a continuous area including an address. Which block to replace is randomly selected or LRU (Least
Those based on the Recently Used method are known.

【0026】まず、リプレース対象となるブロックのダ
ーティフラグ43がセットされていれば(ステップ40
4肯定)、このブロックのすべてのデータを対応する主
メモリ33の領域に書き戻す(ステップ405)。その
後、新たなデータを主メモリ33からロードする(ステ
ップ406)。リプレース対象のブロックのダーティフ
ラグ43がセットされていなければ(ステップ404否
定)、このブロックの主メモリ33への書き戻しは行わ
ず、そのまま新たなデータを主メモリ33からロードす
る(ステップ407)。
First, if the dirty flag 43 of the block to be replaced is set (step 40)
4 affirmative), all the data of this block are written back to the corresponding area of the main memory 33 (step 405). Then, new data is loaded from the main memory 33 (step 406). If the dirty flag 43 of the block to be replaced is not set (No at step 404), the block is not written back to the main memory 33, and new data is loaded from the main memory 33 as it is (step 407).

【0027】リプレース後は、アクセス対象となるデー
タがデータメモリ51上に存在するので、データメモリ
51をアクセスすることになる(ステップ408)。メ
モリへの連続書き込み、読み出しは、メモリアクセス制
御回路542が制御する。
After the replacement, since the data to be accessed exists in the data memory 51, the data memory 51 is accessed (step 408). The memory access control circuit 542 controls continuous writing to and reading from the memory.

【0028】このように、ライトバック方式キャッシュ
メモリでミスが発生した場合、前述したように、リプレ
ース対象となるブロックのダーティフラグ43がセット
されていると、一旦このブロックの全データを主メモリ
33に書き戻してからでないと、対象データをキャッシ
ュメモリ31にロードすることができない。すなわち、
キャッシュミス時のペナルティが大きくなり、全体の処
理速度低下を引き起こしてしまう。
In this way, when a miss occurs in the write-back type cache memory, if the dirty flag 43 of the block to be replaced is set as described above, all the data in this block is once transferred to the main memory 33. The target data cannot be loaded into the cache memory 31 until it is written back into the cache memory 31. That is,
The penalty at the time of a cache miss increases, and the overall processing speed decreases.

【0029】[0029]

【発明が解決しようとする課題】以上のように、一般的
にメモリアクセスを高速化するキャッシュメモリは、あ
る特定の処理、例えば行列の不連続アドレス方向のアク
セスを行うと、著しくヒット率が低下し、処理速度向上
の妨げになっていた。
As described above, the cache memory, which generally speeds up memory access, has a significantly reduced hit rate when a particular process, such as an access in the direction of non-contiguous addresses of a matrix, is performed. However, it has been an obstacle to improving the processing speed.

【0030】また、従来のライトバック方式キャッシュ
メモリは、キャッシュミス時のペナルティが大きく、処
理速度向上の妨げになっていた。
Further, the conventional write-back type cache memory has a large penalty at the time of a cache miss, which hinders the improvement of the processing speed.

【0031】そこで、この発明は、このような従来の事
情に鑑みてなされたものであり、第1の発明の目的とす
るところは、ヒット率向上と処理速度向上を実現するこ
とができるキャッシュメモリを提供することにある。
Therefore, the present invention has been made in view of the above conventional circumstances, and an object of the first invention is to achieve a cache memory capable of improving the hit rate and the processing speed. To provide.

【0032】また、第2及び第3の発明の目的とすると
ころは、キャッシュミス時のペナルティを軽減し、処理
速度の向上を実現させることができるキャッシュメモリ
制御方法及びキャッシュメモリを提供することにある。
Further, it is an object of the second and third inventions to provide a cache memory control method and a cache memory which can reduce the penalty at the time of a cache miss and realize the improvement of the processing speed. is there.

【0033】[0033]

【課題を解決するための手段】以上の問題を解決するた
めに、第1の発明は、複数のブロックごとに主メモリの
データを保持するデータメモリと、該データメモリの各
ブロックに保持されているデータの主メモリ上のアドレ
スを保持するタグメモリと、前記データメモリの各ブロ
ックごとに備えられたフラグ手段と、該フラグ手段の値
によって、このフラグ手段に対応するデータメモリのブ
ロックに対するデータの入れ換えを行うか否かを制御す
るキャッシュ制御回路とから構成されている。
In order to solve the above problems, a first aspect of the present invention is to provide a data memory for holding data of a main memory for each of a plurality of blocks and a data memory for holding the data in each block of the data memory. The tag memory for holding the address on the main memory of the existing data, the flag means provided for each block of the data memory, and the value of the flag means, the data of the data for the block of the data memory corresponding to this flag means It is composed of a cache control circuit for controlling whether or not the replacement is performed.

【0034】また、前記キャッシュ制御回路は、外部信
号によって第1の動作形態と第2の動作形態との切り換
えが可能であり、第1の動作形態では、前記データメモ
リ中のデータ入れ換え対象となるブロックに対応するフ
ラグ手段が第1の値をとる場合には、該ブロックのデー
タを入れ換えた後、該フラグ手段を第2の値に設定し、
前記データメモリ中のデータ入れ換え対象となるブロッ
クに対応するフラグ手段が第2の値をとる場合には、該
ブロックのデータ入れ換えを行わず、前記主メモリに直
接アクセスすることを特徴としている。
Further, the cache control circuit can switch between the first operation mode and the second operation mode by an external signal. In the first operation mode, the data is replaced in the data memory. When the flag means corresponding to the block has the first value, the data of the block is exchanged, and then the flag means is set to the second value,
When the flag means corresponding to the block to be replaced in the data memory has the second value, the data in the block is not replaced and the main memory is directly accessed.

【0035】また、第2の発明は、キャッシュメモリ内
の任意のブロックに書き込まれているデータを主メモリ
にライトバックする際、プロセッサが、主メモリにアク
セスせず、かつ実行時間がキャッシュメモリのライトバ
ックに要する時間よりも長い命令を実行している間、あ
るいはメモリアクセス命令がキャッシュメモリのライト
バックを行なっている間に出現しないときに、前記プロ
セッサからの指示によってキャッシュメモリのライトバ
ックを行なうことを特徴としている。特に、前記実行時
間の長い命令は、並列プロセッサ構成時のプロセッサ間
通信命令あるいは同期命令であることを特徴としてい
る。
According to the second aspect of the invention, when the data written in an arbitrary block in the cache memory is written back to the main memory, the processor does not access the main memory and the execution time of the cache memory is When an instruction longer than the time required for write-back is being executed, or when a memory access instruction does not appear during write-back of the cache memory, write-back of the cache memory is performed by an instruction from the processor. It is characterized by that. In particular, the instruction having a long execution time is characterized by being an inter-processor communication instruction or a synchronization instruction in a parallel processor configuration.

【0036】さらに、第3の発明は、複数のブロックか
らなるデータメモリと、タグメモリと、キャッシュ制御
回路と、リプレースを行うブロックを選択する手段と、
データメモリのブロックごと設けられ、対応するブロッ
クに書き込みがあるとセットされるフラグ手段と、外部
からのライトバック指示を伝える手段と、前記フラグ手
段によって、書き込みのあったことを示しているブロッ
クを1つ選択するブロック選択手段と、から構成される
キャッシュメモリであって、前記キャッシュ制御回路
は、キャッシュ制御手段と、メモリアクセス制御手段
と、ライトバック制御手段とから構成され、該ライトバ
ック制御手段は、前記外部からのライトバック指示を認
識すると、前記ブロック選択手段が選択したブロックに
格納されているデータを、主メモリに書き戻す制御を行
うとともに、該ブロックに対応する前記フラグ手段をリ
セットすることを特徴としている。
Further, the third invention is a data memory comprising a plurality of blocks, a tag memory, a cache control circuit, and means for selecting a block to be replaced,
A flag unit that is provided for each block of the data memory and that is set when there is a write in the corresponding block, a unit that transmits a write-back instruction from the outside, and a block that indicates that writing has been performed by the flag unit A cache memory comprising block selecting means for selecting one, wherein the cache control circuit comprises a cache control means, a memory access control means, and a write back control means. When recognizing the write-back instruction from the outside, the control unit writes back the data stored in the block selected by the block selection unit to the main memory and resets the flag unit corresponding to the block. It is characterized by that.

【0037】[0037]

【作用】上記構成により、第1の発明のキャッシュメモ
リは、データメモリの各ブロックに対応する追い出し禁
止フラグを設け、キャッシュ制御回路にモード切り換え
制御手段と追い出し禁止モード制御手段とを追加する。
プロセッサから追い出し禁止モードが設定されると、モ
ード切り換え手段によって、キャッシュ制御回路の状態
は追い出し禁止モードに遷移する。
With the above structure, the cache memory according to the first aspect of the invention is provided with the eviction prohibition flag corresponding to each block of the data memory, and the mode switching control means and the eviction prohibition mode control means are added to the cache control circuit.
When the eviction prohibition mode is set by the processor, the mode switching means causes the state of the cache control circuit to transit to the eviction prohibition mode.

【0038】追い出し禁止モード制御手段は、それ以降
にキャッシュメモリ上にロードされたブロックに対して
追い出し禁止フラグをセットする。追い出し禁止フラグ
がセットされたブロックは、リプレース対象となっても
リプレースが行われないように制御される。
The eviction prohibition mode control means sets the eviction prohibition flag for the blocks loaded in the cache memory thereafter. The block in which the eviction prohibition flag is set is controlled so that the replacement is not performed even if the block is replaced.

【0039】モード切り換え手段は、プロセッサから追
い出し禁止モード解除が設定されると、すべての追い出
し禁止フラグをリセットして、モードを通常モードに遷
移する。
When the processor sets the erasure prohibition mode release, the mode switching means resets all the ejection prohibition flags and shifts the mode to the normal mode.

【0040】このように、追い出し禁止モードに入る
と、それ以降にキャッシュメモリ上にロードされたブロ
ックは、追い出し禁止モードが解除されるまでの間は、
キャッシュから追い出されることはないのでヒット率が
向上する。
As described above, when the eviction prohibition mode is entered, the blocks loaded in the cache memory thereafter are kept until the eviction prohibition mode is released.
Since it is not pushed out of the cache, the hit rate improves.

【0041】また、第2の発明のキャッシュメモリ制御
方法は、外部からの信号によって、任意のブロックのラ
イトバックを行うことのできるキャッシュメモリと、あ
る命令によって、キャッシュメモリのライトバックを指
示する信号線をアクティブにするプロセッサと、主メモ
リから構成され、プロセッサは、メモリにアクセスせ
ず、かつ実行時間がキャッシュメモリのライトバックに
要する時間よりも長い命令を実行する場合、あるいはメ
モリアクセス命令が、キャッシュメモリのライトバック
を行なっている間に出現しないときに、キャッシュメモ
リのライトバックを指示する。
The cache memory control method of the second invention is a cache memory capable of performing write-back of an arbitrary block by a signal from the outside, and a signal instructing write-back of the cache memory by a certain instruction. It consists of a processor that activates the line and main memory, and if the processor executes an instruction that does not access the memory and the execution time is longer than the time required to write back the cache memory, or the memory access instruction is When it does not appear during the write back of the cache memory, it instructs the write back of the cache memory.

【0042】これにより、キャッシュミス時以外にも、
メモリアクセス命令がしばらく出現しない場合や、メモ
リにアクセスせず、実行時間の長い命令を実行する場合
に、メモリへのライトバックを行うことができ、キャッ
シュミス時にライトバックを行うことが少なくなる。
As a result, in addition to when a cache miss occurs,
When a memory access instruction does not appear for a while, or when an instruction having a long execution time is executed without accessing the memory, the write back to the memory can be performed, and the write back is rarely performed at the cache miss.

【0043】さらに、第3の発明は、キャッシュ・ミス
時以外にも、外部からのライトバック指示によって、随
時メモリへのライトバックを行い、ダーティフラグをリ
セットすることができる。
Further, according to the third aspect of the invention, the write-back to the memory can be performed at any time and the dirty flag can be reset by a write-back instruction from the outside in addition to the cache miss.

【0044】したがって、キャッシュ・ミス発生時に
は、リプレース対象となるブロックのダーティ・フラグ
がセットされている可能性は小さくなる。つまり、リプ
レースは、メモリからの新データのロードのみでよい場
合が多くなり、キャッシュ・ミスによるペナルティは軽
減される。
Therefore, when a cache miss occurs, the possibility that the dirty flag of the block to be replaced is set is small. In other words, replacement often involves only loading new data from memory, and the penalty for cache misses is reduced.

【0045】[0045]

【実施例】本発明の実施例を図面を参照しながら説明す
る。
Embodiments of the present invention will be described with reference to the drawings.

【0046】第1の発明 図1は、第1の発明のキャッシュメモリの一実施例の構
成を示すブロック図である。
First Invention FIG. 1 is a block diagram showing the configuration of an embodiment of a cache memory of the first invention.

【0047】第1の発明のキャッシュメモリは、データ
メモリ11、タグメモリ12、追い出し禁止フラグ1
3、及びキャッシュ制御回路14から構成される。デー
タメモリ11は、複数のブロックから構成され、ブロッ
クごとに主メモリ15のある連続した領域のコピーを保
持する。ブロックの大きさは、通常16バイト〜32バ
イト程度の大きさである。
The cache memory according to the first aspect of the present invention comprises a data memory 11, a tag memory 12 and a eviction prohibition flag 1.
3 and the cache control circuit 14. The data memory 11 is composed of a plurality of blocks, and holds a copy of a continuous area in the main memory 15 for each block. The size of the block is usually about 16 to 32 bytes.

【0048】タグメモリ12の各タグは、データメモリ
11の各ブロックに1対1に対応している。タグメモリ
12のタグは、対応するデータメモリ11のブロックに
格納されるデータの、主メモリ15上のアドレス情報を
保持する。タグメモリ12を検索することによって、ヒ
ット、ミスを判定することができる。
Each tag of the tag memory 12 has a one-to-one correspondence with each block of the data memory 11. The tag of the tag memory 12 holds the address information on the main memory 15 of the data stored in the corresponding block of the data memory 11. By searching the tag memory 12, hits and misses can be determined.

【0049】タグメモリ12の構成は、マッピング方式
によって異なるが、通常のRAMあるいはCAM(Conte
nt Addressable Memory)が用いられる。
The structure of the tag memory 12 differs depending on the mapping method, but it is a normal RAM or CAM (Conte
nt Addressable Memory) is used.

【0050】追い出し禁止フラグ13の各構成ビット
は、データメモリ11の各ブロックに1対1に対応して
おり、後述するキャッシュ制御回路14による制御によ
って、セット/リセットされる。
Each constituent bit of the eviction prohibition flag 13 has a one-to-one correspondence with each block of the data memory 11, and is set / reset under the control of the cache control circuit 14 described later.

【0051】キャッシュ制御回路14は、キャッシュメ
モリとしての動作を制御するブロックである。キャッシ
ュ制御回路14は、モード切り換え制御手段141、従
来からある通常モード制御手段142、追い出し禁止モ
ード制御手段143、およびリプレース制御手段144
から構成される。さらに、キャッシュ制御回路14に
は、プロセッサ16から追い出し禁止モード設定信号1
7と追い出し禁止モード解除信号18が入力される。
The cache control circuit 14 is a block for controlling the operation of the cache memory. The cache control circuit 14 includes a mode switching control unit 141, a conventional normal mode control unit 142, a eviction prohibition mode control unit 143, and a replacement control unit 144.
Composed of. In addition, the cache control circuit 14 is provided with the eviction prohibition mode setting signal 1 from the processor 16.
7 and the ejection prohibition mode release signal 18 are input.

【0052】キャッシュ制御回路14の状態遷移図を図
2に示す。モード切り換え制御手段141は、追い出し
禁止モード設定信号17、および追い出し禁止モード解
除信号18にしたがって、通常モードと追い出し禁止モ
ードの切り換えを制御する。また、追い出し禁止モード
から、追い出し禁止解除信号18によって通常モードに
遷移するときに、追い出し禁止フラグ13の内容をすべ
てリセットする。
A state transition diagram of the cache control circuit 14 is shown in FIG. The mode switching control means 141 controls switching between the normal mode and the ejection prohibition mode according to the ejection prohibition mode setting signal 17 and the ejection prohibition mode release signal 18. Further, when the erasure prohibition mode is changed to the normal mode by the erasure prohibition cancel signal 18, the contents of the erasure prohibition flag 13 are all reset.

【0053】通常モードでは、通常モード制御手段14
2がプロセッサ16からメモリアクセス要求があると通
常モード処理を制御する。通常モード処理は、図13の
フロー図で示した、従来のキャッシュメモリの動作とま
ったく同じである。
In the normal mode, the normal mode control means 14
2 controls the normal mode processing when a memory access request is issued from the processor 16. The normal mode processing is exactly the same as the operation of the conventional cache memory shown in the flowchart of FIG.

【0054】すなわち、まず、プロセッサ16からのア
ドレスが、タグメモリ12に格納されているか否かがタ
グメモリ12で判定される。格納されている場合、キャ
ッシュは“ヒット”したことになる。このときアドレス
の格納されているタグに対応するデータメモリ11のブ
ロックがアクセスされる(ステップ101,103)。
That is, first, the tag memory 12 determines whether or not the address from the processor 16 is stored in the tag memory 12. If so, the cache is a "hit". At this time, the block of the data memory 11 corresponding to the tag in which the address is stored is accessed (steps 101 and 103).

【0055】タグメモリ12にプロセッサ16からのア
ドレスが格納されていない場合、すなわちキャッシュが
“ミス”した場合は、リプレース制御手段144によっ
て、主メモリ15上のアクセス対象のデータを含む連続
領域と、データメモリ11のあるブロックとの間でリプ
レースが行われる(ステップ102)。リプレース後
は、対象となるデータがデータメモリ11上に存在し、
このデータをアクセスする(ステップ103)。
When the address from the processor 16 is not stored in the tag memory 12, that is, when the cache "misses", the replacement control unit 144 causes the main memory 15 to include a continuous area containing data to be accessed, Replacement with a block in the data memory 11 is performed (step 102). After the replacement, the target data exists in the data memory 11,
This data is accessed (step 103).

【0056】一方、追い出し禁止モードを必要とする演
算を行う場合、追い出し禁止モード制御手段143によ
って、プロセッサ16からのメモリアクセスがあると追
い出し禁止モード処理を行う。追い出し禁止モード処理
のフロー図を図3に示す。
On the other hand, when performing an operation requiring the eviction prohibition mode, the eviction prohibition mode control means 143 performs the eviction prohibition mode process when the memory access from the processor 16 is made. A flow chart of the eviction prohibition mode process is shown in FIG.

【0057】なお、追い出し禁止モードに入った時は、
前回通常モードに遷移したとき、モード切り換え制御手
段141によって追い出し禁止フラグ13はすべてリセ
ットされている。
When entering the banning mode,
When the transition to the normal mode was made last time, the ejection prohibition flag 13 is all reset by the mode switching control means 141.

【0058】図3において、キャッシュがヒットする
と、通常モード処理と同様に、データメモリ11がアク
セスされる(ステップ201,205)。キャッシュが
ミスすると、まず、LRU法に基づいてリプレース対象
となるブロックが決定され、このブロックに対応する追
い出し禁止フラグ13によってリプレースを行うかどう
かを決定する(ステップ201,202)。
In FIG. 3, when the cache hits, the data memory 11 is accessed as in the normal mode processing (steps 201 and 205). When the cache miss occurs, first, a block to be replaced is determined based on the LRU method, and whether or not replacement is performed is determined by the eviction prohibition flag 13 corresponding to this block (steps 201 and 202).

【0059】追い出し禁止フラグ13がセットされてい
ない場合、このブロックに対してリプレースが行われる
(ステップ202,203)。リプレース後、このブロ
ックに対して追い出し禁止フラグ13がセットされる
(ステップ204)。
If the eviction prohibition flag 13 is not set, replacement is performed for this block (steps 202 and 203). After replacement, the ejection prohibition flag 13 is set for this block (step 204).

【0060】リプレース対象となるブロックに対して、
追い出し禁止フラグ13がセットされている場合、リプ
レースは行われず、プロセッサ16からのメモリアクセ
スは直接主メモリ15に対して行われる(ステップ20
2,206)。
For the block to be replaced,
If the eviction prohibition flag 13 is set, the replacement is not performed and the memory access from the processor 16 is directly performed to the main memory 15 (step 20).
2, 206).

【0061】すなわち、追い出し禁止モードに入ってか
ら、主メモリ15からキャッシュメモリに新たにロード
されたブロックは、追い出し禁止モードがセットされ
る。そしてこのブロックは、追い出し禁止モード中はキ
ャッシュメモリから追い出されることはない。
That is, the block newly loaded from the main memory 15 into the cache memory after entering the eviction prohibition mode is set to the eviction prohibition mode. Then, this block is not ejected from the cache memory during the ejection prohibition mode.

【0062】以上のような第1の発明のキャッシュメモ
リを用いて、図14で示した、行列aの列ごとの和を求
める演算を行う場合を考える。C言語での記述であるの
で、行列は行方向に連続したアドレスに格納される。す
なわち、列の和を求める内側ループでは、aのアクセス
はとびとびのアドレスをアクセスすることになる。
Consider the case where the cache memory of the first aspect of the invention as described above is used to perform the operation for obtaining the sum for each column of the matrix a shown in FIG. Since the description is in C language, the matrix is stored at consecutive addresses in the row direction. That is, in the inner loop for obtaining the sum of columns, the access of a is to access discrete addresses.

【0063】このときのキャッシュメモリの動作を図4
に示す。リプレース方式はLRU(Least Recently Use
d)法を例にとって説明するが、これに限るものではな
い。データメモリ11のブロック数を k,行列の行数を
n,k<n とする。従来のキャッシュメモリでは、今後ア
クセスするはずのデータがキャッシュメモリから追い出
されてしまい、ヒット率が著しく低下していた。
The operation of the cache memory at this time is shown in FIG.
Shown in. The replacement method is LRU (Least Recently Use)
d) The method will be described as an example, but the method is not limited to this. The number of blocks in the data memory 11 is k, and the number of rows in the matrix is
Let n and k <n. In the conventional cache memory, the data that should be accessed in the future is expelled from the cache memory, and the hit rate is significantly reduced.

【0064】まず、最初に、プロセッサ16は追い出し
禁止モード設定信号17を用いて追い出し禁止モードを
設定する。次に、列方向に順次アクセスが行われ、デー
タメモリ11の各ブロックに、アクセス対象となるデー
タを含む、一連のデータが順次ロードされる。j=k-1 ま
で進むと、図4(a) のように、データメモリ11のすべ
てのブロックにデータが格納される。
First, the processor 16 sets the ejection prohibition mode using the ejection prohibition mode setting signal 17. Next, sequential access is performed in the column direction, and a series of data including the data to be accessed is sequentially loaded into each block of the data memory 11. When the process goes to j = k-1, the data is stored in all the blocks of the data memory 11 as shown in FIG.

【0065】ここで、例えば第0行目のアクセスでは、
対象データa00 を含むa00 a01 a02a03 の一連のデータ
がデータメモリ11の最初のブロックに格納される。こ
の一連のデータをa0で表すことにする。
Here, for example, in the access on the 0th line,
A series of data of a00 a01 a02 a03 including the target data a00 is stored in the first block of the data memory 11. This series of data will be represented by a0 * .

【0066】その後、j=k では、第 k行目のデータがア
クセスされるが、キャッシュからのデータの追い出しは
禁止されているので、 k行目のデータをキャッシュにロ
ードすることはできない。したがって、このデータは、
直接主メモリ15から読むことになる。さらにj=n-1 ま
で進み、i=0 に関するループが終了すると、図4(b)の
ようになり、i に関する1回目のループが終了する。
After that, when j = k, the data on the k-th row is accessed, but since the data eviction from the cache is prohibited, the data on the k-th row cannot be loaded into the cache. Therefore, this data is
It will be read directly from the main memory 15. When j = n-1 is further reached and the loop for i = 0 ends, the result is as shown in FIG. 4B, and the first loop for i ends.

【0067】追い出し禁止モードの設定により、第0行
目から第k-1 行目までのデータがデータメモリ11上に
格納されており、第 k行目以降は主メモリ15からのア
クセスになっている。その後、i=1 〜3 に関するループ
では、j=0 〜k-1 に関しては、キャッシュヒットし、j=
k 〜n-1 はミスする。
By setting the eviction prohibition mode, the data from the 0th line to the (k-1) th line are stored in the data memory 11, and the access from the main memory 15 is performed from the kth line onward. There is. Then in the loop for i = 1-3, for j = 0-k-1, there is a cache hit and j =
Misses k to n-1.

【0068】i=3 のループが終了した時点で、プロセッ
サ16はいったん追い出し禁止解除信号18を用いて追
い出し禁止モード解除を行い、再度追い出し禁止モード
を設定する。以後、 iに関するループ4回ごとに、プロ
セッサ16は追い出し禁止モードをいったん解除し、再
度追い出し禁止モードを設定して、同様に処理を進め
る。
When the loop of i = 3 is completed, the processor 16 once cancels the eviction prohibition mode by using the eviction prohibition cancellation signal 18, and sets the eviction prohibition mode again. Thereafter, the processor 16 once cancels the eviction prohibition mode, sets the eviction prohibition mode again, and proceeds with the same processing every four loops regarding i.

【0069】このような操作によって、第0行目から第
K-1 行目に関しては、1回ミスすると以後ブロックサイ
ズ分だけはヒットする。すべてのデータに関してキャッ
シュミスが起こる従来のキャッシュメモリと比較する
と、その分の処理速度の向上が期待できる。
By such an operation, from the 0th line to the 0th line
For the K-1 line, if you miss once, only the block size hits. Compared with the conventional cache memory in which a cache miss occurs for all data, the processing speed can be expected to improve by that much.

【0070】以上で述べたような行列の不連続アドレス
方向のアドレスは、行列の積を求める演算等、頻繁に現
れるため、第1の発明のキャッシュメモリを用いること
によって、大幅に処理速度を向上させることができる。
Since the addresses in the direction of the discontinuous address of the matrix as described above frequently appear in the calculation for obtaining the product of the matrix and the like, by using the cache memory of the first invention, the processing speed is greatly improved. Can be made.

【0071】第2の発明 図5は、第2の発明を説明するための情報処理装置の一
実施例の大まかな構成を示すブロック図である。
Second Invention FIG. 5 is a block diagram showing a rough structure of an embodiment of an information processing apparatus for explaining the second invention.

【0072】この情報処理装置は、ライトバック方式キ
ャッシュメモリ31、プロセッサ32、主メモリ33か
ら構成される。プロセッサ32とキャッシュメモリ31
の間は、アドレス線、データ線、その他の制御線、及び
ライトバック指示信号34で接続される。プロセッサ3
2は、命令例を読み込み実行する。実行する命令がメモ
リアクセス命令ならば、キャッシュメモリ31に対し
て、アクセス動作を行う。
This information processing apparatus comprises a write-back type cache memory 31, a processor 32, and a main memory 33. Processor 32 and cache memory 31
In between, the address lines, the data lines, other control lines, and the write-back instruction signal 34 are connected. Processor 3
2 reads and executes an instruction example. If the instruction to be executed is a memory access instruction, the cache memory 31 is accessed.

【0073】従来同様、プロセッサ32からのアクセス
に対して、キャッシュがヒットすれば、プロセッサ32
はキャッシュメモリ31に対してデータアクセスを行
う。キャッシュがミスすると、キャッシュメモリ31は
リプレースを行う。すなわち不要なデータをキャッシュ
メモリ31上から主メモリ33に追い出し(ライトバッ
ク)、対象データを主メモリ33からロードする。プロ
セッサ32は、リプレース終了後にキャッシュメモリ3
1をアクセスすることになるので、キャッシュがヒット
した場合と比較すると、多大なアクセス時間が必要にな
る。
Similarly to the conventional case, if the cache hits in response to the access from the processor 32, the processor 32
Performs data access to the cache memory 31. When the cache miss occurs, the cache memory 31 replaces it. That is, unnecessary data is expelled from the cache memory 31 to the main memory 33 (write back), and the target data is loaded from the main memory 33. The processor 32 uses the cache memory 3 after the replacement is completed.
Since 1 is accessed, a large access time is required as compared with the case where the cache is hit.

【0074】上述した通常のライトバック以外に、第2
の発明では、プロセッサ32からキャッシュメモリ31
に対して、ライトバック指示信号34がアサートされる
と、キャッシュメモリ31は、既に書き込みが行われ、
まだ主メモリ33上のデータを更新していないブロック
を1つ選択し、主メモリ33にライトバックする。
In addition to the normal write back described above, the second
Of the invention, the processor 32 to the cache memory 31
On the other hand, when the write-back instruction signal 34 is asserted, the cache memory 31 has already been written,
One block in which the data in the main memory 33 has not been updated is selected and written back to the main memory 33.

【0075】プロセッサ32は、メモリアクセスを行わ
ない時間に、うまくライトバック指示信号34をアサー
トすることができれば、特別な時間を必要とすることな
くキャッシュメモリ31から主メモリ33へのライトバ
ックを行うことができるため、処理速度の向上が期待で
きる。以下では、プロセッサ32から、効率よくライト
バック指示信号34をアサートする方法について説明す
る。
If the write-back instruction signal 34 can be successfully asserted during the time when no memory access is performed, the processor 32 performs write-back from the cache memory 31 to the main memory 33 without requiring any special time. Therefore, improvement in processing speed can be expected. Hereinafter, a method of efficiently asserting the write-back instruction signal 34 from the processor 32 will be described.

【0076】まず、ライトバック命令を設ける方法が考
えられる。プロセッサ32は、この命令をデコードする
ことによって、ライトバック指示信号34をアサートす
る。したがって、ライトバック命令の実行時間は、ライ
トバック指示信号34をアサートするだけなので、例え
ば1クロックとなる。
First, a method of providing a write back command can be considered. The processor 32 asserts the write-back instruction signal 34 by decoding this instruction. Therefore, the execution time of the write-back instruction is, for example, one clock because only the write-back instruction signal 34 is asserted.

【0077】ライトバック命令実行後、プロセッサ32
は次の命令の実行を開始できるが、キャッシュメモリ3
1から主メモリ33へのライトバックは並行して行われ
る。ライトバック中は、プロセッサ32からのメモリア
クセス命令は実行できず、ウェイトが入る。つまり、ラ
イトバックを行うことによって処理速度が低下してしま
い、途中でライトバックを行う意味をなさない。
After executing the write-back instruction, the processor 32
Can start executing the next instruction, but cache memory 3
Write back from 1 to the main memory 33 is performed in parallel. During write back, the memory access instruction from the processor 32 cannot be executed and a wait is entered. That is, the processing speed is reduced by performing the write back, and it does not make sense to perform the write back on the way.

【0078】したがってライトバックとプロセッサ32
からのメモリアクセスが重ならないように、ライトバッ
ク命令を効率よくスケジューリングして、オブジェクト
プログラム中に挿入することが必要である。ここでは1
回のライトバックに要する時間をnクロックと仮定す
る。すると、ライトバックは、次のような場合に行えば
よい。
Therefore, write back and processor 32
It is necessary to efficiently schedule write-back instructions and insert them in the object program so that memory accesses from the same will not overlap. Here 1
It is assumed that the time required for write back times is n clocks. Then, write back may be performed in the following cases.

【0079】(1)実行にnクロック要し、かつメモリ
アクセスを行わない命令の実行中。 (2)メモリアクセス命令の間隔がnクロック以上開い
ている。
(1) An instruction that requires n clocks to execute and is not accessed for memory is being executed. (2) The memory access instruction interval is n clocks or more.

【0080】図6に図5の情報処理装置を用いて並列プ
ロセッサを構成した場合の、オブジェクトプログラム中
にライトバック命令を挿入する手順を示す。この並列プ
ロセッサでは、並列処理特有の命令として同期命令と通
信命令を有し、この2つの命令の実行時間はnクロック
であるとする。ライトバック命令を挿入する操作は、コ
ンパイラによってアセンブラコードが生成された後の、
機械語命令に変換される前に行われる。すなわちコンパ
イラのポストプロセッサとして機能する。以下では図6
を用いて手順を説明する。
FIG. 6 shows a procedure for inserting a write-back instruction into an object program when a parallel processor is constructed using the information processing apparatus shown in FIG. This parallel processor has a synchronous instruction and a communication instruction as instructions peculiar to parallel processing, and the execution time of these two instructions is n clocks. The operation to insert the write back instruction is performed after the assembler code is generated by the compiler.
It is performed before it is converted into a machine language instruction. That is, it functions as a post processor of the compiler. Below in FIG.
The procedure will be described using.

【0081】(ステップ301)アセンブラコード段階
でのオブジェクトプログラムを、1つずつ命令をトレー
スする。 (ステップ302)命令列をすべてトレースすれば、終
了する。 (ステップ303)トレースした命令が同期命令なら
ば、この命令の直前にライトバック命令を挿入し、次の
命令に進む。そうでなければ(ステップ304)に進
む。
(Step 301) Instructions are traced one by one in the object program at the assembler code stage. (Step 302) If all the instruction sequences are traced, the process ends. (Step 303) If the traced instruction is a synchronous instruction, a write-back instruction is inserted immediately before this instruction and the process proceeds to the next instruction. Otherwise (step 304), the process proceeds to step 304.

【0082】(ステップ304)トレースした命令が通
信命令ならば、この命令の直前にライトバック命令を挿
入し、次の命令に進む。そうでなければ(ステップ30
5)に進む。 (ステップ305)トレースした命令がloadまたはstor
e 命令ならば(ステップ306)に進む。そうでなけれ
ば、次の命令に進む(ステップ311)。 (ステップ306)現在のloadまたはstore 命令以降の
n命令中にcall,jump,branch命令などの、プログラムカ
ウンタを書き換える命令が存在していれば、ライトバッ
ク命令は挿入できないので、次の命令に進む(ステップ
311)。そうでなければ(ステップ307)に進む。
(Step 304) If the traced instruction is a communication instruction, a write back instruction is inserted immediately before this instruction and the process proceeds to the next instruction. Otherwise (step 30
Proceed to 5). (Step 305) The traced instruction is load or stor
If it is an e command, the process proceeds to step 306. Otherwise, proceed to the next instruction (step 311). (Step 306) If there is an instruction that rewrites the program counter, such as a call, jump, or branch instruction, in the n instructions after the current load or store instruction, the writeback instruction cannot be inserted, so the next instruction is executed. (Step 311). Otherwise, the process proceeds to (step 307).

【0083】(ステップ307)現在のloadまたはstor
e 命令以降のn命令中に、loadまたはstore 命令が存在
していれば、ライトバック命令は挿入できないので、次
の命令に進む(ステップ311)。そうでなければ(ス
テップ308)に進む。 (ステップ308)現在のloadまたはstore 命令以降の
n命令中に、同期または通信命令が存在していなけれ
ば、直後にライトバック命令を挿入する。n命令以内に
同期または通信命令が存在していれば、ここではライト
バック命令は挿入せず、次の命令に進む(ステップ31
1)。
(Step 307) Current load or stor
If there is a load or store instruction in the n instructions after the e instruction, the write-back instruction cannot be inserted, and the process proceeds to the next instruction (step 311). Otherwise (step 308) the process proceeds to step 308. (Step 308) If there is no synchronization or communication command in n commands after the current load or store command, a write back command is inserted immediately after. If there is a synchronization or communication command within n commands, the write-back command is not inserted here and the process proceeds to the next command (step 31).
1).

【0084】以上の手順にしたがって、ライトバック命
令を挿入するとにより、処理を妨げることなくキャッシ
ュメモリ31のライトバックを行うことができる。以上
の手順は、ライトバック命令挿入の一例を示すものであ
り、ライトバックに必要な時間、同期・通信命令の実行
時間の関係によって、さまざまな方法が考えられる。
By inserting the write-back instruction according to the above procedure, the write-back of the cache memory 31 can be performed without hindering the processing. The above procedure shows an example of the write-back instruction insertion, and various methods can be considered depending on the relationship between the time required for write-back and the execution time of the synchronization / communication instruction.

【0085】例えば、1ブロックのライトバックに要す
る時間nクロックに対して、同期・通信命令が2nクロ
ック要する場合、1回のライトバック命令で2ブロック
分のライトバックを行うように、キャシュメモリ31を
構成してもよい、また、ライトバック指示信号34によ
って行うライトバックのブロック数を指示する信号を新
たに付加することで、同期命令と通信命令の実行時間が
異なる場合にもきめ細かく対応できることになる。
For example, when the synchronization / communication command requires 2n clocks for the time n clocks required to write back one block, the cache memory 31 is configured to write back two blocks with one writeback command. In addition, by newly adding a signal for instructing the number of blocks of write back performed by the write back instructing signal 34, it is possible to finely cope with the case where the execution time of the synchronization instruction and the communication instruction are different. Become.

【0086】ライトバック命令を設ける方法の他に、次
のような方法でもライトバック指示信号34をアクティ
ブにすることが考えられる。 (1)並列プロセッサ構成時の同期、通信命令をプロセ
ッサ32がデコードすることによってプロセッサ32が
ライトバック指示信号34をアクティブにする。 (2)並列プロセッサ構成時の同期、通信を行うハード
ウェアが、同期、通信命令によって動作を開始する際
に、ライトバック指示信号34をアクティブにする。
In addition to the method of providing the write-back command, the write-back instruction signal 34 may be activated by the following method. (1) The processor 32 activates the write-back instruction signal 34 by the processor 32 decoding the synchronization and communication instructions in the parallel processor configuration. (2) When the hardware for synchronization and communication in the parallel processor configuration starts the operation by the synchronization and communication command, it activates the write-back instruction signal 34.

【0087】以上で説明したように、第2の発明のキャ
ッシュメモリ制御方法を用いれば、メモリアクセスが、
ライトバックを行なっている間に実行されないと判断さ
れる時に、プロセッサ32がライトバック指示を出すこ
とによって、随時キャッシュメモリ31上のブロック
を、主メモリ33にライトバックすることができる。
As described above, when the cache memory control method of the second invention is used, memory access is
When it is determined not to be executed during the write-back, the processor 32 issues a write-back instruction so that the block on the cache memory 31 can be written back to the main memory 33 at any time.

【0088】したがって、キャッシュミス時のリプレー
スでは、ブロックのライトバックを行う必要がなく、新
たなデータのロードのみで済む可能性が高くなり、キャ
ッシュミスのペナルティを軽減し、処理速度の向上が期
待できる。特に並列プロセッサ構成時は、プロセッサ間
通信や同期など、処理時間の長い処理が多く存在するた
め、このような処理と並行にライトバックを行うように
第2の発明のキャッシュメモリ制御方法を適用すれば、
特に有効である。
Therefore, in the replacement at the time of cache miss, it is not necessary to write back the block, and there is a high possibility that only new data will be loaded, the penalty of cache miss is reduced, and the processing speed is expected to be improved. it can. In particular, when a parallel processor is configured, there are many processes with a long processing time such as inter-processor communication and synchronization. Therefore, the cache memory control method of the second invention may be applied so as to perform write back in parallel with such processes. If
Especially effective.

【0089】第3の発明 図7は、第3の発明のキャッシュメモリの一実施例の構
成を示すブロック図である。
Third Invention FIG. 7 is a block diagram showing the configuration of an embodiment of a cache memory of the third invention.

【0090】第3の発明のキャッシュメモリは、データ
メモリ41、タグメモリ42、ダーティ・フラグ43、
リプレースブロック選択回路44、ライトバックブロッ
ク選択回路45、及びキャッシュ制御回路46から構成
される。キャッシュのマッピング方式は、フルアソシア
ティブ方式を例として説明する。
The cache memory of the third invention comprises a data memory 41, a tag memory 42, a dirty flag 43,
The replacement block selection circuit 44, the write-back block selection circuit 45, and the cache control circuit 46 are included. The cache mapping method will be described by taking the full associative method as an example.

【0091】データメモリ41は、複数のブロックから
構成され、ブロックごとに主メモリ33のある連続した
領域のコピーを保持する。ブロックの大きさは、通常1
6バイト〜32バイト程度の大きさである。タグメモリ
42の各タグは、データメモリ41の各ブロックに1対
1に対応しており、対応するブロックに格納されるデー
タの、主メモリ31上でのアドレス情報を保持する。タ
グメモリ42を検索することによって、ヒット、ミスを
判定することができる。
The data memory 41 is composed of a plurality of blocks, and holds a copy of a continuous area in the main memory 33 for each block. The block size is usually 1
The size is about 6 bytes to 32 bytes. Each tag of the tag memory 42 is in one-to-one correspondence with each block of the data memory 41, and holds address information on the main memory 31 of data stored in the corresponding block. By searching the tag memory 42, a hit or a miss can be determined.

【0092】タグメモリ42の構成は、マッピング方式
によって異なるが、通常のRAMあるいはCAM(Cont
ent Addressable Memory) が用いられる。ダーティ・フ
ラグ43の各構成ビットは、データメモリ41の各ブロ
ックに1対1に対応しており、対応するブロックにプロ
セッサ32から書き込みが行われたかどうかを示す。後
述する制御回路46による制御によって、セット/リセ
ットされる。
The structure of the tag memory 42 differs depending on the mapping method, but it is a normal RAM or CAM (Cont.
ent Addressable Memory) is used. Each constituent bit of the dirty flag 43 has a one-to-one correspondence with each block of the data memory 41, and indicates whether the processor 32 has written to the corresponding block. It is set / reset under the control of the control circuit 46 described later.

【0093】リプレースブロック選択回路44はリプレ
ースによってどのブロックを追い出すかを示す。追い出
しブロックの選択アルゴリズムとしては、LRU(Least
Recently Used)法や、ランダムに選択する方法が一般的
に用いられる。
The replace block selection circuit 44 indicates which block is to be expelled by replacement. As an algorithm for selecting the eviction block, LRU (Least
Recently Used) method and random selection method are generally used.

【0094】ライトバックブロック選択回路45は、ラ
イトバックを行うブロックを選択する。ブロックの選択
は、リプレースブロックの選択方式と関連して、次に示
すようなさまざまな方法が考えられる。 (1)ダーティ・フラグ43のセットされているブロッ
クのうち、ブロック番号の最も小さなもの、あるいはブ
ロック番号の最も大きなものを選択する。 (2)ダーティ・フラグ43のセットされているブロッ
クのうち、LRUスタックによって示される、最もアク
セスされていないブロックを選択する。 (3)ダーティ・フラグ43のセットされているブロッ
クのうち、1つのブロックをランダムに選択する。
The write-back block selection circuit 45 selects a block for write-back. Regarding the selection of blocks, various methods as described below can be considered in relation to the replacement block selection method. (1) Of the blocks in which the dirty flag 43 is set, the block with the smallest block number or the block with the largest block number is selected. (2) Of the blocks in which the dirty flag 43 is set, the least accessed block indicated by the LRU stack is selected. (3) One block is randomly selected from the blocks in which the dirty flag 43 is set.

【0095】リプレース・ブロックの選択方式がLRU
方式の場合は(2)が、ランダム方式の場合は(3)が
適していると思われるが、どの方式でも差し支えない。
また、いずれの方式でも、ライトバックブロック選択回
路45は、簡単な組み合わせ回路で実現でき、いろいろ
な構成方法が考えられる。
The replacement block selection method is LRU
It is considered that (2) is suitable for the system and (3) is suitable for the random system, but any system is acceptable.
In either method, the write-back block selection circuit 45 can be realized by a simple combination circuit, and various configuration methods are possible.

【0096】LRUスタックを用いる場合のリプレース
ブロック選択回路44、ライトバックブロック選択回路
45の構成例を図8に示す。図8において、リプレース
ブロック選択回路44のLRUスタックには、最もアク
セスされていない順にブロック番号が格納されている。
ライトバックブロック選択回路45では、LRUスタッ
クに格納されているブロック番号を、ダーティ・フラグ
43の値によって選択する。
FIG. 8 shows a configuration example of the replace block selection circuit 44 and the write back block selection circuit 45 when the LRU stack is used. In FIG. 8, block numbers are stored in the LRU stack of the replace block selection circuit 44 in the order of least accessed.
The write-back block selection circuit 45 selects the block number stored in the LRU stack according to the value of the dirty flag 43.

【0097】スタック0に格納されているブロック番号
に対して、ダーティ・フラグ43がセットされていれ
ば、このブロック番号がライトバックブロック選択回路
45の出力となる。ダーティ・フラグ43がセットされ
ていなければ、スタック1以降のブロックが選択され
る。すなわち、ライトバックブロック選択回路45は、
ダーティ・フラグ43がセットされているブロックのう
ち、最もアクセスされていないブロックの番号を出力す
る。このようなセレクタを接続することによって、ライ
トバックブロック選択回路45を構成することができ
る。
If the dirty flag 43 is set for the block number stored in the stack 0, this block number becomes the output of the write-back block selection circuit 45. If the dirty flag 43 is not set, the blocks after the stack 1 are selected. That is, the write back block selection circuit 45
Among the blocks in which the dirty flag 43 is set, the number of the least accessed block is output. The write-back block selection circuit 45 can be configured by connecting such a selector.

【0098】制御回路46は、キャッシュメモリ31と
しての動作を制御するブロックである。この制御回路4
6は、キャッシュ制御回路461、メモリアクセス制御
回路462、及びライトバック制御回路463とから構
成される。さらに、制御回路46には、プロセッサ32
から、ライトバック指示信号47が入力される。
The control circuit 46 is a block for controlling the operation of the cache memory 31. This control circuit 4
6 includes a cache control circuit 461, a memory access control circuit 462, and a write back control circuit 463. Further, the control circuit 46 includes a processor 32.
Then, the write-back instruction signal 47 is input.

【0099】制御回路46の処理フロー図を図9に示
す。以下では図9にしたがって、制御回路46の通常時
の動作を説明する。
A processing flow chart of the control circuit 46 is shown in FIG. The normal operation of the control circuit 46 will be described below with reference to FIG.

【0100】プロセッサ32からのメモリアクセス要求
によって、制御回路46が起動されると、まず、アクセ
スされるデータがキャッシュメモリ31上に存在する
か、すなわちヒットかどうかを判定する(ステップ40
1)。ヒット/ミスの判定は、プロセッサ32からのア
ドレスが、タグメモリ42に格納されているか否かで判
定される。格納されている場合、キャッシュは´ヒット
´したことになる。キャッシュがヒットすると、対応す
るデータメモリ41のブロックがアクセスされる(ステ
ップ402)。さらに、アクセスが書き込みならば、対
応するダーティ・フラグ43をセットする(ステップ4
03)。
When the control circuit 46 is activated by a memory access request from the processor 32, it is first determined whether the accessed data exists in the cache memory 31, that is, a hit (step 40).
1). The determination of hit / miss is made based on whether the address from the processor 32 is stored in the tag memory 42. If so, the cache is a'hit '. When the cache hits, the corresponding block of the data memory 41 is accessed (step 402). Furthermore, if the access is a write, the corresponding dirty flag 43 is set (step 4).
03).

【0101】タグメモリ42にプロセッサ32からのア
ドレスが格納されていない場合、すなわちキャッシュが
´ミス´した場合は、主メモリ33上のアクセス対象の
データを含む連続領域と、データメモリ41のブロック
との間でリプレースが行われる。データメモリ41のど
のブロックをリプレースするかは、リプレースブロック
選択回路44によって示される。
When the address from the processor 32 is not stored in the tag memory 42, that is, when the cache “misses”, the continuous area containing the data to be accessed on the main memory 33 and the block of the data memory 41 Will be replaced. Which block of the data memory 41 is to be replaced is indicated by the replace block selection circuit 44.

【0102】リプレースは次のような手順になる。ま
ず、リプレース対象となるブロックのダーティ・フラグ
43がセットされていれば(ステップ404肯定)、こ
のブロックの全データを、メモリアクセス制御回路46
2の制御で主メモリ33に書き戻す(ステップ40
5)。そして、このブロックのダーティ・フラグ43を
リセットする(ステップ406)。その後、新たなアク
セス対象となる一連のデータを、メモリアクセス制御回
路462の制御で主メモリ33からこのブロックにロー
ドする(ステップ407)。
The replacement has the following procedure. First, if the dirty flag 43 of the block to be replaced is set (Yes at step 404), all the data of this block is transferred to the memory access control circuit 46.
It is written back to the main memory 33 under the control of step 2 (step 40).
5). Then, the dirty flag 43 of this block is reset (step 406). After that, a series of data to be newly accessed is loaded from the main memory 33 to this block under the control of the memory access control circuit 462 (step 407).

【0103】リプレース対象となるブロックのダーティ
・フラグ43が既にリセットされている場合(ステップ
404否定)、このブロックには書き込みが行われてい
ないので、主メモリ33に書き戻す必要はない。したが
って、そのまま対象データを主メモリ33からロードす
る(ステップ407)。
If the dirty flag 43 of the block to be replaced has already been reset (No at step 404), there is no need to write back to the main memory 33 because no writing has been done to this block. Therefore, the target data is loaded from the main memory 33 as it is (step 407).

【0104】リプレース後は、対象となるデータがデー
タメモリ41上に存在し、このデータをアクセスする
(ステップ408)。
After the replacement, the target data exists in the data memory 41, and this data is accessed (step 408).

【0105】上述した通常のライトバック以外に、第3
の発明では第2の発明で説明した、プロセッサ32が、
主メモリ33にアクセスせず、かつ実行時間がキャッシ
ュメモリ31のライトバックに要する時間よりも長い命
令を実行している間、あるいはメモリアクセス命令がキ
ャッシュメモリ31のライトバックを行なっている間に
出現しないときに、ライトバックを行なうことができ
る。
In addition to the normal write back described above, the third
In the invention, the processor 32 described in the second invention is
Appears while the main memory 33 is not being accessed and an instruction whose execution time is longer than the time required to write back the cache memory 31 is being executed, or while a memory access instruction is writing back to the cache memory 31. When not, write back can be performed.

【0106】図10にそのライトバック時の制御フロー
図を示す。外部からのライトバック指示信号47によっ
て、ライトバック制御回路463が起動される。ライト
バクブロック選択回路45の示すブロックを、メモリア
クセス制御回路462の制御によって、対応するメモリ
領域に書き戻す(ステップ411,412)。その後、
このブロックに対応するダーティ・フラグ43をリセッ
トする(ステップ413)。
FIG. 10 shows a control flow chart at the time of write back. The write-back control circuit 463 is activated by the write-back instruction signal 47 from the outside. The block indicated by the write back block selection circuit 45 is written back to the corresponding memory area under the control of the memory access control circuit 462 (steps 411, 412). afterwards,
The dirty flag 43 corresponding to this block is reset (step 413).

【0107】メモリアクセス制御回路462は、キャッ
シュ制御回路461およびライトバック制御回路463
の指示により、指定されたデータメモリ41のブロック
の全データを、対応する主メモリ領域(アドレスはタグ
メモリ42に格納されている)に対して書き戻し、ある
いは読み出しを行う。
The memory access control circuit 462 includes a cache control circuit 461 and a write back control circuit 463.
According to the instruction, all the data in the designated block of the data memory 41 is written back to or read from the corresponding main memory area (the address is stored in the tag memory 42).

【0108】以上は、マッピング方式として、フル・ア
ソシアティブ方式の場合についての構成及び動作を説明
した。一般的なキャッシュメモリ31には、セット・ア
ソシアティブ方式やダイレクト・マッピング方式が主に
用いられる。以下では、本発明を用いた4ウェイセット
アソシアティブ、LRU方式のキャッシュメモリ31の
実施例について説明する。キャッシュメモリ全体の構成
は、図7と同じである。
The configuration and operation in the case of the full associative method have been described above as the mapping method. For the general cache memory 31, a set associative method or a direct mapping method is mainly used. An embodiment of the 4-way set associative LRU type cache memory 31 according to the present invention will be described below. The overall structure of the cache memory is the same as in FIG.

【0109】4ウェイセットアソシアテブのキャッシュ
メモリ31では、リプレース時は、プロセッサ32から
のアドレスによって、どのセットがリプレース対象とな
るかが一意に決まる。したがって、セットが決まった
後、セット内のどのブロックをリプレース対象とするか
をLRUスタックで選択する。一方、ライトバックブロ
ック選択回路45は、セット内でのライトバック候補ブ
ロックをLRUスタックの値に基づいて選択するだけで
なく、どのセットを選択するかを決定しなければならな
い。これについてもさまざまな方法が考えられる。
In the 4-way set associative cache memory 31, at the time of replacement, an address from the processor 32 uniquely determines which set is to be replaced. Therefore, after the set is determined, which block in the set is to be replaced is selected by the LRU stack. On the other hand, the write-back block selection circuit 45 must determine not only the write-back candidate block in the set based on the value of the LRU stack, but also which set to select. There are various possible methods for this.

【0110】(1)セット番号順に選択する。 (2)ランダムに選択する。 (3)セットに対するLRUスタックを設け、最もアク
セスされていないセットを選択する。
(1) Select in order of set number. (2) Select at random. (3) Provide an LRU stack for the set and select the least accessed set.

【0111】これらのうち(3)が最も効率がよいと思
われるが、ハードウェア量は多くなる。(3)を用いた
場合のライトバックブロック選択回路45の構成例を図
11に示す。各セット内で、リプレース対象ブロックを
LRUスタックで示す。さらに、このLRUスタックの
値を、ダーティ・フラグ43の値で選択して、セット内
でライトバック対象ブロックを示している。この構成
は、図8に示したものと同じである。
Of these, (3) seems to be the most efficient, but the amount of hardware is large. FIG. 11 shows a configuration example of the write-back block selection circuit 45 when (3) is used. In each set, the replacement target block is indicated by the LRU stack. Further, the value of this LRU stack is selected by the value of the dirty flag 43 to indicate the write-back target block in the set. This structure is the same as that shown in FIG.

【0112】ライトバック時は、さらに、どのセットの
ブロックをライトバックするかを、セットLRUスタッ
クの出力値で選択する。セットLRUスタックは、最も
最近アクセスの行われていないセットを示すスタックで
ある。したがって、プロセッサからキャッシュメモリ3
1がアクセスされたときは、セット内にLRUスタック
だけでなく、全体のLRUスタックをも更新する必要が
ある。
At the time of write back, which set of blocks is to be written back is selected by the output value of the set LRU stack. The set LRU stack is a stack indicating a set that has not been accessed most recently. Therefore, from the processor to the cache memory 3
When a 1 is accessed, not only the LRU stack in the set needs to be updated, but the entire LRU stack as well.

【0113】他のウェイ数のセットアソシアティブ方式
も同様のことが言える。また、ダイレクトマッピング方
式では、ランダムに選択するのがよいと思われる。
The same applies to the set associative method with other ways. In addition, in the direct mapping method, it seems that it is better to select at random.

【0114】以上説明したように、第3の発明のライト
バック方式のキャッシュメモリを用いれば、メモリアク
セスを行わないと思われる時期に、プロセッサ32がラ
イトバック指示を出すことによって、随時キャッシュメ
モリ31上のブロックを、主メモリ33にライトバック
することができる。したがって、キャッシュミス時のリ
プレースでは、ブロックのライトバックを行う必要がな
く、新たなデータのロードのみで済む可能性が高くな
り、キャッシュミスのペナルティを軽減し、処理速度の
向上が期待できる。
As described above, if the cache memory of the write-back system of the third invention is used, the processor 32 issues a write-back instruction at a time when it is considered that no memory access will be performed, so that the cache memory 31 at any time. The upper block can be written back to the main memory 33. Therefore, in the replacement at the time of a cache miss, it is not necessary to write back a block, and there is a high possibility that only new data will be loaded, the penalty of a cache miss can be reduced, and the processing speed can be expected to improve.

【0115】[0115]

【発明の効果】以上、述べたように、第1の発明のキャ
ッシュメモリは、行列の不連続アドレス方向のアクセス
のような、従来のキャッシュメモリでは極端に性能が低
下する演算処理においても、高いヒット率を維持するこ
とができ、また処理速度も向上させることができる。
As described above, the cache memory according to the first aspect of the present invention has high performance even in arithmetic processing such as access in the direction of discontinuous address of a matrix, which is extremely low in performance in the conventional cache memory. The hit rate can be maintained and the processing speed can be improved.

【0116】また、第2の発明のキャッシュメモリ制御
方法、及び第3の発明のキャッシュメモリは、メモリア
クセスを行わないときに、プロセッサからのライトバッ
ク指示によって、ダーティ・フラグのセットされている
ブロックに書き込まれているデータを随時主メモリに書
き戻すため、キャッシュミス発生時におけるリプレース
は主メモリからの新データのロードのみでよい場合が多
くなる。これにより、キャッシュミス時のペナルティを
大きく軽減でき、システム全体の処理速度を向上させる
ことができる。
The cache memory control method according to the second aspect of the invention and the cache memory according to the third aspect of the invention include a block in which a dirty flag is set by a write back instruction from the processor when no memory access is performed. Since the data written in the main memory is written back to the main memory at any time, in many cases replacement at the time of a cache miss is only required by loading new data from the main memory. As a result, the penalty at the time of a cache miss can be greatly reduced, and the processing speed of the entire system can be improved.

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

【図1】第1の発明のキャッシュメモリの構成を示すブ
ロック図。
FIG. 1 is a block diagram showing a configuration of a cache memory of a first invention.

【図2】第1の発明のキャッシュメモリ制御回路の状態
遷移図。
FIG. 2 is a state transition diagram of the cache memory control circuit of the first invention.

【図3】第1の発明のキャッシュメモリ制御回路の追い
出し禁止モード処理のフロー図。
FIG. 3 is a flow chart of eviction prohibition mode processing of the cache memory control circuit of the first invention.

【図4】第1の発明のキャッシュメモリを用いた行列演
算時の動作図。
FIG. 4 is an operation diagram at the time of matrix calculation using the cache memory of the first invention.

【図5】第2の発明のキャッシュメモリ制御方法を説明
するための情報処理装置の構成図。
FIG. 5 is a configuration diagram of an information processing device for explaining a cache memory control method of a second invention.

【図6】第2の発明の一実施例である、ライトバック命
令挿入フロー図。
FIG. 6 is a write-back instruction insertion flow chart, which is an embodiment of the second invention.

【図7】第3の発明のキャッシュメモリの構成図。FIG. 7 is a configuration diagram of a cache memory according to a third invention.

【図8】第3の発明のキャッシュメモリのブロック選択
回路図。
FIG. 8 is a block selection circuit diagram of a cache memory according to a third invention.

【図9】第3の発明のキャッシュメモリの制御フロー
図。
FIG. 9 is a control flow chart of the cache memory of the third invention.

【図10】第3の発明のキャッシュメモリのライトバッ
ク制御フロー図。
FIG. 10 is a write-back control flow chart of the cache memory of the third invention.

【図11】第3の発明のキャッシュメモリの他の実施例
のブロック選択回路図。
FIG. 11 is a block selection circuit diagram of another embodiment of the cache memory of the third invention.

【図12】従来のキャッシュメモリの構成図。FIG. 12 is a configuration diagram of a conventional cache memory.

【図13】従来のキャッシュメモリの処理フロー図。FIG. 13 is a processing flow chart of a conventional cache memory.

【図14】キャッシュメモリの動作を説明するためのサ
ンプルプログラム。
FIG. 14 is a sample program for explaining the operation of the cache memory.

【図15】従来のキャッシュメモリを用いた行列演算時
の動作図。
FIG. 15 is an operation diagram during matrix calculation using a conventional cache memory.

【図16】従来のキャッシュメモリの詳細構成図。FIG. 16 is a detailed configuration diagram of a conventional cache memory.

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

11 データメモリ 12 タグメモリ 13 追い出し禁止フラグ 14 キャッシュ制御回路 15 主メモリ 16 プロセッサ 17 追い出し禁止モード設定信号線 18 追い出し禁止モード解除信号線 141 モード切り換え制御手段 142 通常モード制御手段 143 追い出し禁止モード制御手段 144 リプレース制御手段 31 キャッシュメモリ 32 プロセッサ 33 主メモリ 34 ライトバック指示信号 41 データメモリ 42 タグメモリ 43 ダーティ・フラグ 44 リプレースブロック選択回路 45 ライトバックブロック選択回路 46 制御回路 461 キャッシュ制御回路 462 メモリアクセス制御回路 463 ライトバック制御回路 47 ライトバック指示信号 11 data memory 12 tag memory 13 eviction prohibition flag 14 cache control circuit 15 main memory 16 processor 17 eviction prohibition mode setting signal line 18 eviction prohibition mode release signal line 141 mode switching control means 142 normal mode control means 143 eviction prohibition mode control means 144 Replace control means 31 Cache memory 32 Processor 33 Main memory 34 Write back instruction signal 41 Data memory 42 Tag memory 43 Dirty flag 44 Replace block selection circuit 45 Write back block selection circuit 46 Control circuit 461 Cache control circuit 462 Memory access control circuit 463 Write-back control circuit 47 Write-back instruction signal

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 複数のブロックごとに主メモリのデータ
を保持するデータメモリと、 該データメモリの各ブロックに保持されているデータの
主メモリ上のアドレスを保持するタグメモリと、 前記データメモリの各ブロックごとに備えられたフラグ
手段と、 該フラグ手段の値によって、このフラグ手段に対応する
データメモリのブロックに対するデータの入れ換えを行
うか否かを制御するキャッシュ制御回路とから構成され
ていることを特徴とするキャッシュメモリ。
1. A data memory that holds data in a main memory for each of a plurality of blocks, a tag memory that holds an address on the main memory of data held in each block of the data memory, and a data memory of the data memory. It is composed of a flag means provided for each block, and a cache control circuit for controlling whether or not the data of the block of the data memory corresponding to the flag means is replaced by the value of the flag means. A cache memory characterized by.
【請求項2】 前記キャッシュ制御回路は、外部信号に
よって第1の動作形態と第2の動作形態との切り換えが
可能であり、 第1の動作形態では、前記データメモリ中のデータ入れ
換え対象となるブロックに対応するフラグ手段が第1の
値をとる場合には、該ブロックのデータを入れ換えた
後、該フラグ手段を第2の値に設定し、 前記データメモリ中のデータ入れ換え対象となるブロッ
クに対応するフラグ手段が第2の値をとる場合には、該
ブロックのデータ入れ換えを行わず、前記主メモリに直
接アクセスすることを特徴とする請求項1記載のキャッ
シュメモリ。
2. The cache control circuit is capable of switching between a first operation mode and a second operation mode by an external signal, and in the first operation mode, is a target for data exchange in the data memory. When the flag means corresponding to the block takes the first value, the data of the block is exchanged, then the flag means is set to the second value, and the block in the data memory to be the data exchange target is set. 2. The cache memory according to claim 1, wherein when the corresponding flag means takes the second value, the data of the block is not exchanged and the main memory is directly accessed.
【請求項3】 キャッシュメモリ内の任意のブロックに
書き込まれているデータを主メモリにライトバックする
際、 プロセッサが、主メモリにアクセスせず、かつ実行時間
がキャッシュメモリのライトバックに要する時間よりも
長い命令を実行している間に、前記プロセッサからの指
示によってキャッシュメモリのライトバックを行なうこ
とを特徴とするキャッシュメモリ制御方法。
3. When the data written in an arbitrary block in the cache memory is written back to the main memory, the processor does not access the main memory and the execution time is longer than the time required for the write back of the cache memory. A method for controlling cache memory, wherein write-back of the cache memory is performed by an instruction from the processor while executing a long instruction.
【請求項4】 前記実行時間の長い命令は、並列プロセ
ッサ構成時のプロセッサ間通信命令あるいは同期命令で
あることを特徴とする請求項3記載のキャッシュメモリ
制御方法。
4. The cache memory control method according to claim 3, wherein the instruction having a long execution time is an inter-processor communication instruction or a synchronous instruction in a parallel processor configuration.
【請求項5】 複数のブロックからなるデータメモリ
と、タグメモリと、キャッシュ制御回路と、リプレース
を行うブロックを選択する手段と、データメモリのブロ
ックごと設けられ、対応するブロックに書き込みがある
とセットされるフラグ手段と、外部からのライトバック
指示を伝える手段と、前記フラグ手段によって、書き込
みのあったことを示しているブロックを1つ選択するブ
ロック選択手段と、から構成されるキャッシュメモリで
あって、 前記キャッシュ制御回路は、キャッシュ制御手段と、メ
モリアクセス制御手段と、ライトバック制御手段とから
構成され、 該ライトバック制御手段は、前記外部からのライトバッ
ク指示を認識すると、前記ブロック選択手段が選択した
ブロックに格納されているデータを、主メモリに書き戻
す制御を行うとともに、該ブロックに対応する前記フラ
グ手段をリセットすることを特徴とするキャッシュメモ
リ。
5. A data memory including a plurality of blocks, a tag memory, a cache control circuit, a unit for selecting a block to be replaced, and a block for the data memory are provided for each block, and set when a corresponding block is written. And a block selecting unit for selecting one block indicating that writing has been performed by the flag unit. The cache control circuit includes a cache control unit, a memory access control unit, and a write-back control unit. When the write-back control unit recognizes a write-back instruction from the outside, the block selection unit. The data stored in the block selected by is written back to the main memory. Control performs, cache memory, characterized in that resetting the flag means corresponding to the block.
JP5052262A 1993-03-12 1993-03-12 Cache memory and cache memory control method Pending JPH06266623A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5052262A JPH06266623A (en) 1993-03-12 1993-03-12 Cache memory and cache memory control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5052262A JPH06266623A (en) 1993-03-12 1993-03-12 Cache memory and cache memory control method

Publications (1)

Publication Number Publication Date
JPH06266623A true JPH06266623A (en) 1994-09-22

Family

ID=12909858

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5052262A Pending JPH06266623A (en) 1993-03-12 1993-03-12 Cache memory and cache memory control method

Country Status (1)

Country Link
JP (1) JPH06266623A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005149290A (en) * 2003-11-18 2005-06-09 Seiko Epson Corp Information processing device and cache memory control method
JP2009122787A (en) * 2007-11-13 2009-06-04 Nec Computertechno Ltd Multiprocessor system
JP2013205985A (en) * 2012-03-27 2013-10-07 Fujitsu Ltd Information processor and control method for information processor

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005149290A (en) * 2003-11-18 2005-06-09 Seiko Epson Corp Information processing device and cache memory control method
JP2009122787A (en) * 2007-11-13 2009-06-04 Nec Computertechno Ltd Multiprocessor system
JP2013205985A (en) * 2012-03-27 2013-10-07 Fujitsu Ltd Information processor and control method for information processor

Similar Documents

Publication Publication Date Title
JP2554449B2 (en) Data processing system having cache memory
US5737750A (en) Partitioned single array cache memory having first and second storage regions for storing non-branch and branch instructions
US5091851A (en) Fast multiple-word accesses from a multi-way set-associative cache memory
JPH06348595A (en) Cache device
JPH0588888A (en) Address formation mechanism and method of previously fetching data
JPS624745B2 (en)
JPH06243039A (en) Method for operating order in cache memory system and microprocessor unit
JPS5936350B2 (en) Cash access method
US6560676B1 (en) Cache memory system having a replace way limitation circuit and a processor
JP2001290706A (en) Prefetch for tlb cache
JPS638851A (en) Cache memory control system
JPH06266623A (en) Cache memory and cache memory control method
US5724548A (en) System including processor and cache memory and method of controlling the cache memory
JP3431397B2 (en) Instruction queue
US7062607B2 (en) Filtering basic instruction segments in a processor front-end for power conservation
JP4111645B2 (en) Memory bus access control method after cache miss
JP2972451B2 (en) Cache memory control method by hardware control software
JP4765249B2 (en) Information processing apparatus and cache memory control method
JP3284508B2 (en) Data prefetch control device
JPH0477344B2 (en)
JPH06348596A (en) Cache memory system and method and system for cache memory access
JPH0628258A (en) Microprocessor
JPH0612331A (en) Cache memory controller
JPH07152650A (en) Cache control unit
JPH04288647A (en) Substitution controller for cache memory