JPH04262437A - Cache data replacer in cache memory - Google Patents

Cache data replacer in cache memory

Info

Publication number
JPH04262437A
JPH04262437A JP3022064A JP2206491A JPH04262437A JP H04262437 A JPH04262437 A JP H04262437A JP 3022064 A JP3022064 A JP 3022064A JP 2206491 A JP2206491 A JP 2206491A JP H04262437 A JPH04262437 A JP H04262437A
Authority
JP
Japan
Prior art keywords
data
cache
memory
block
replace
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
JP3022064A
Other languages
Japanese (ja)
Inventor
Yukio Kumazawa
熊澤幸夫
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.)
Fujifilm Business Innovation Corp
Original Assignee
Fuji Xerox Co Ltd
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 Fuji Xerox Co Ltd filed Critical Fuji Xerox Co Ltd
Priority to JP3022064A priority Critical patent/JPH04262437A/en
Publication of JPH04262437A publication Critical patent/JPH04262437A/en
Pending legal-status Critical Current

Links

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)

Abstract

PURPOSE:To reduce queuing time of a processor and to improve the throughput of the processor system by reducing the number of times of data transfer between a cache memory and the main memory. CONSTITUTION:In a cache data replacer for cache memory where write action is carried out for a cache memory divided into a plurality of blocks, where writing of cache data in a block for which the writing was carried out is carried out for the main memory when replacing cache data, replace memories 24 and 25 for storing history data for block are provided. The memory 24 stores therein data indicating an update history, and in memory 25 data indicating a replace history is stored. When cache data in the cache memory is changed, a bit corresponding to a block where the history data was changed is set at '1', and when replacing cache data, cache data in a block whose corresponding bit of the history data is '0' is replaced prior to others.

Description

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

【0001】0001

【産業上の利用分野】本発明は、プロセッサを高速に動
作させるためのキャッシュメモリのリプレース装置に関
し、特にライトバック方式のN(N≧2)ウェイセット
アソシアティブのキャッシュメモリにおけるキャッシュ
データリプレース装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a cache memory replacement device for operating a processor at high speed, and more particularly to a cache data replacement device in a write-back type N (N≧2) way set associative cache memory.

【0002】0002

【従来の技術】プロセッサを高速に動作させるために、
プロセッサと主記憶装置との間に小容量ではあるが高速
動作が可能なキャッシュメモリを配置することが一般に
行われている。主記憶装置の記憶領域は複数のブロック
に分割され、一部の複数ブロックの記憶データがキャッ
シュメモリにロードされる。プロセッサは、まずキャッ
シュメモリにアクセスし、キャッシュメモリ上にアクセ
スされたアドレスのデータが存在する場合には、すなわ
ち、キャッシュヒットしたときは、キャッシュメモリ上
のデータにそのままアクセスし、読み出し或いは書込み
を行う。また、キャッシュメモリ上に該当アドレスのデ
ータがない場合には、すなわち、キャッシュミスしたと
きは、新しいブロックを主記憶装置から読み出し、既に
キャッシュメモリ上にある古いブロックのどれかと置き
換える。この置き換えは、一般にリプレースと呼ばれる
。このとき、どのブロックを置き換えるかを決める方式
はリプレースアルゴリズムと呼ばれる。このリプレース
アルゴリズムとしては、最も長い時間使用されなかった
ブロックを置き換えの対象とするLRU(Least 
Recently Used) 方式、最も以前にキャ
ッシュメモリに読み出されたブロックを置き換えの対象
とするFIFO(First In First Ou
t)方式等が知られている。
[Background Art] In order to make a processor operate at high speed,
It is common practice to arrange a cache memory, which has a small capacity but can operate at high speed, between a processor and a main storage device. The storage area of the main storage device is divided into a plurality of blocks, and some of the storage data of the plurality of blocks is loaded into the cache memory. The processor first accesses the cache memory, and if data at the accessed address exists on the cache memory, that is, when there is a cache hit, the processor directly accesses the data on the cache memory and reads or writes it. . Furthermore, when there is no data at the corresponding address on the cache memory, that is, when a cache miss occurs, a new block is read from the main memory and replaced with any old block already on the cache memory. This replacement is generally called a replacement. At this time, the method for determining which block to replace is called a replacement algorithm. This replacement algorithm uses the LRU (Least
FIFO (First In First O) method, which targets the block most recently read into the cache memory
t) method etc. are known.

【0003】また、キャッシュメモリ上のデータは、プ
ロセッサからのライトアクセスにより更新されることが
あるが、リプレースの際に一括してキャッシュメモリ上
の或るブロックの全てのデータを主記憶装置に書き込む
方式は、ライトバック(write−back)方式と
呼ばれる。なお、ライトバック(write−back
)方式は,コピーバック(copy−back) 方式
と呼ばれることもある。プロセッサが、高速動作可能な
キャッシュメモリをアクセスすることで、全体で見たと
きの処理速度は高速になる。
[0003]Also, data on the cache memory may be updated by write access from the processor, but when replacing, all data in a certain block on the cache memory is written to the main memory at once. The method is called a write-back method. Note that write-back
) method is sometimes called a copy-back method. When the processor accesses the cache memory that can operate at high speed, the overall processing speed becomes faster.

【0004】従来のキャッシュメモリにおいては、リプ
レースアルゴリズムとして、上述したLRU方式やFI
FO方式が使用されているが、これらの方式は、データ
の利用頻度や入力した順番にのみ着目し、リプレースの
対象となるブロックのデータの変更の有無、すなわち、
書込みが行われたか否かに関係なく、ライトバックによ
るリプレースを行っていた。
[0004] In conventional cache memory, the above-mentioned LRU method and FI
The FO method is used, but these methods only focus on the frequency of data use and the order in which it was input, and check whether or not the data in the block to be replaced has changed, that is,
Replacement was performed by write-back regardless of whether writing was performed or not.

【0005】[0005]

【発明が解決しようとする課題】しかしながら、リプレ
ースの際に、無条件にキャッシュメモリ上のデータを主
記憶装置にライトバックすると、主記憶装置への書込み
には時間を要するため、プロセッサの待ち時間が増加し
、システムのスループットが低下するという問題があっ
た。
[Problems to be Solved by the Invention] However, when data in the cache memory is unconditionally written back to the main memory during replacement, it takes time to write to the main memory, so the wait time of the processor increases. There was a problem that the system throughput decreased due to the increase in the amount of data.

【0006】本発明は、前記問題に鑑み、データが変更
されているキャッシュメモリのブロックから主記憶装置
へのライトバック回数を減らすことにより、キャッシュ
メモリと主記憶装置との間のデータ転送回数を減らし、
これによりプロセッサの待ち時間を減らし、システムの
スループットを向上させることを目的とする。
In view of the above problem, the present invention reduces the number of times data is transferred between the cache memory and the main memory by reducing the number of writes back from a cache memory block in which data has been changed to the main memory. reduce,
The purpose of this is to reduce processor latency and improve system throughput.

【0007】[0007]

【課題を解決するための手段】本発明は、前記目的を達
成するため、書込み動作が複数ブロックに分割されたキ
ャッシュメモリに対して行われ書込みがあったブロック
のキャッシュデータの主記憶装置への書込みがリプレー
ス時に行われるキャッシュメモリのキャッシュデータリ
プレース装置において、各ブロックに対応する複数ビッ
トからなる履歴データを記憶するための履歴データメモ
リを設け、初期状態においては前記履歴データのビット
を第1の状態に設定し、キャッシュメモリ内のキャッシ
ュデータが変更されたときに前記履歴データの変更され
たブロックに対応するビットを第2の状態に設定し、キ
ャッシュデータのリプレースの際には、前記履歴データ
のビットが第1の状態に設定されているブロックのキャ
ッシュデータを優先的にリプレースすることを特徴とす
る。
[Means for Solving the Problems] In order to achieve the above object, the present invention provides that a write operation is performed on a cache memory divided into a plurality of blocks, and the cache data of the written block is transferred to a main storage device. A cache data replacement device for a cache memory in which writing is performed at the time of replacement is provided with a history data memory for storing history data consisting of a plurality of bits corresponding to each block, and in an initial state, the bits of the history data are stored in a first memory. state, and when the cache data in the cache memory is changed, a bit corresponding to the changed block of the history data is set to a second state, and when the cache data is replaced, the history data The cache data of the block whose bit is set to the first state is preferentially replaced.

【0008】[0008]

【作用】本発明においては、初期状態においては履歴デ
ータメモリに記憶されている履歴データのビットが、た
とえば、“0”とされる。そして、キャッシュメモリ内
のキャッシュデータが変更されると対応するビットが、
たとえば、“1”とされる。キャッシュデータのリプレ
ースの際には、たとえば、“0”とされているブロック
、すなわち、変更がないブロックのキャッシュデータが
優先的にリプレースされる。プロセッサにより内容が変
更されたブロックのデータは、最終的にはリプレースす
る必要があるが、リプレースの際にはキャッシュメモリ
から主記憶装置へのライトバックが必要であり、このラ
イトバックには時間を要する。そこで本発明においては
、キャッシュデータが変更されていないブロック、すな
わち、ライトバックの必要がないブロックを優先的にリ
プレースすることにより、ライトバックの必要があるブ
ロックがキャッシュメモリから追い出される比率を低く
する。これにより、ライトバックの回数が削減され、シ
ステムのスループットが向上する。
According to the present invention, in the initial state, the bits of the history data stored in the history data memory are set to, for example, "0". Then, when the cache data in the cache memory is changed, the corresponding bit becomes
For example, it is set to "1". When replacing cache data, for example, cache data in blocks that are set to "0", that is, blocks that have not been changed, are preferentially replaced. The data in the block whose contents have been changed by the processor will eventually need to be replaced, but replacement requires writing back from the cache memory to the main memory, and this write back takes time. It takes. Therefore, in the present invention, by preferentially replacing blocks whose cache data has not been changed, that is, blocks that do not require write back, the rate at which blocks that require write back are evicted from the cache memory is reduced. . This reduces the number of write-backs and improves system throughput.

【0009】[0009]

【実施例】以下、図面を参照しながら実施例に基づいて
本発明の特徴を具体的に説明する。
DESCRIPTION OF THE PREFERRED EMBODIMENTS Hereinafter, features of the present invention will be specifically explained based on embodiments with reference to the drawings.

【0010】図1は、本発明が適用されるキャッシュメ
モリの模式図を示す。なお、本実施例においては、4ウ
ェイセットアソシアティブ方式のキャッシュメモリを例
に挙げて説明する。セットアソシアティブ方式とは、主
記憶装置上のデータをキャッシュメモリ上のどこに対応
付けるかを決定するための方式の一つであり、キャッシ
ュメモリと主記憶装置の記憶領域を四つのブロック単位
に分割し、このブロック単位で対応付けるものである。 セットアソシアティブ方式自体については、たとえば、
村木,黒田,新堂「キャッシュ・メモリの方式とトレー
ドオフ」,32ビット・マイクロプロセサの全容,日経
マグロウヒル社,p242〜265等に記載がある。セ
ットアソシアティブ方式においては、キャッシュメモリ
は、ブロックを要素とするE行S列のマトリクスから構
成される。Eはエレメント数、Sはセット数と呼ばれ、
エレメント数がNのものをNウェイセットアソシアティ
ブ方式と呼ぶ。なお、E,S,Nは1以上の整数である
FIG. 1 shows a schematic diagram of a cache memory to which the present invention is applied. In this embodiment, a 4-way set associative cache memory will be described as an example. The set associative method is a method for determining where on the cache memory the data on the main storage device should be associated, and the storage area of the cache memory and main storage device is divided into four blocks. The correspondence is made in units of blocks. Regarding the set associative method itself, for example,
Muraki, Kuroda, Shindo, "Cache Memory Methods and Trade-offs," Complete Guide to 32-Bit Microprocessors, Nikkei McGraw-Hill Publishing, pp. 242-265. In the set associative system, the cache memory is composed of a matrix with E rows and S columns, each of which has blocks as elements. E is called the number of elements, S is called the number of sets,
A method in which the number of elements is N is called an N-way set associative method. Note that E, S, and N are integers of 1 or more.

【0011】図1において、1は図示しないプロセッサ
からの実アドレス情報を模式的に示すプロセッサアドレ
ス部であり、このプロセッサアドレス部1には、タグア
ドレス2,セットアドレス3及びワードアドレス4が含
まれている。プロセッサアドレス部1からのセットアド
レス3は、リプレース回路5、タグメモリ6及びバリッ
ドメモリ7、データメモリ8のメモリ本体8aに供給さ
れる。また、ワードアドレス4は、データメモリ8のセ
レクタ8bに供給される。
In FIG. 1, numeral 1 is a processor address section schematically showing real address information from a processor (not shown), and this processor address section 1 includes a tag address 2, a set address 3, and a word address 4. ing. The set address 3 from the processor address section 1 is supplied to the replacement circuit 5, the tag memory 6, the valid memory 7, and the memory main body 8a of the data memory 8. Further, the word address 4 is supplied to the selector 8b of the data memory 8.

【0012】プロセッサアドレス部1からのタグアドレ
ス2は、コンパレータ9においてタグメモリ6からのタ
グデータ13と比較され、両者が一致したときにキャッ
シュヒット信号10が出力される。このキャッシュヒッ
ト信号10はシーケンサ11に供給され、シーケンサ1
1からはデータ選択信号12が出力される。このデータ
選択信号12は、データメモリ8のセレクタ8cに供給
され、セットアドレス3及びワードアドレス4に基づい
てデータメモリ8から目的のキャッシュデータ14が出
力される。
The tag address 2 from the processor address unit 1 is compared with the tag data 13 from the tag memory 6 in a comparator 9, and when the two match, a cache hit signal 10 is output. This cache hit signal 10 is supplied to the sequencer 11, and the sequencer 1
1 outputs a data selection signal 12. This data selection signal 12 is supplied to the selector 8c of the data memory 8, and target cache data 14 is output from the data memory 8 based on the set address 3 and word address 4.

【0013】上述のキャッシュメモリにおいては、キャ
ッシュミスした場合には、リプレース回路5により、新
しいブロックを主記憶装置から読み出し、既にキャッシ
ュメモリ上にある古いブロックのどれかと置き換える。 以下、リプレース回路5について、図2を参照して詳細
に説明する。
In the cache memory described above, when a cache miss occurs, the replacement circuit 5 reads a new block from the main memory and replaces it with any old block already on the cache memory. Hereinafter, the replacement circuit 5 will be explained in detail with reference to FIG. 2.

【0014】リプレース回路5は、図1に示すプロセッ
サアドレス部1からのセットアドレス3でアクセスされ
てデータが更新されたブロックを記憶する更新履歴デー
タ用リプレースメモリ24、リプレースされたブロック
を記憶するリプレース履歴データ用リプレースメモリ2
5、リプレースメモリ24からの更新履歴データ26と
リプレースメモリ25からのリプレース履歴データ27
により、リプレースするブロックを決定するリプレース
決定回路28等から構成されている。リプレース決定回
路28からはリプレースデータ29が出力され、このリ
プレースデータ29は、リプレースメモリ24,25に
データとして供給されるとともに、タグメモリ6及びバ
リッドメモリ7に供給される。
The replace circuit 5 includes an update history data replace memory 24 that stores blocks accessed by the set address 3 from the processor address section 1 shown in FIG. 1 and whose data has been updated, and a replace memory 24 that stores the replaced blocks. Historical data replacement memory 2
5. Update history data 26 from the replace memory 24 and replace history data 27 from the replace memory 25
It is comprised of a replacement determining circuit 28, etc., which determines a block to be replaced. Replace data 29 is output from the replace determination circuit 28, and this replace data 29 is supplied as data to the replace memories 24 and 25, as well as to the tag memory 6 and valid memory 7.

【0015】また、リプレース信号(図中、RPで示す
)30,キャッシュヒット信号(図中、C−Hで示す)
31及びプロセッサライト信号(図中、P−wrで示す
)21からAND回路22によりリプレースメモリ24
に対するリプレース更新信号(図中、R−wrで示す)
33が生成される。また、リプレース信号30及びキャ
ッシュミス信号(図中、C−Mで示す)32からAND
回路23によりリプレースメモリ25に対するリプレー
ス更新信号(図中、R−wrで示す)34が生成される
[0015] Also, a replace signal (indicated by RP in the figure) 30, a cache hit signal (indicated by C-H in the figure)
31 and a processor write signal (indicated by P-wr in the figure) 21 through an AND circuit 22 to replace the memory 24.
Replace update signal for (indicated by R-wr in the figure)
33 is generated. Also, AND from the replace signal 30 and the cache miss signal (indicated by C-M in the figure) 32.
The circuit 23 generates a replace update signal (indicated by R-wr in the figure) 34 for the replace memory 25.

【0016】プロセッサライト信号21は、プロセッサ
が書き込みを行うときにプロセッサから出力され、リプ
レース信号30は、キャッシュデータのリプレースが必
要なとき(キャッシュミスで且つキャッシュメモリが有
効データで一杯のとき)シーケンサ11から出力される
。また、キャッシュヒット信号31は、キャッシュヒッ
トのとき(キャッシュヒット信号10が有効になったと
き)シーケンサ11から出力され、キャッシュミス信号
32は、キャッシュミス時(キャッシュヒット信号10
が無効になったとき)シーケンサ11から出力される。
The processor write signal 21 is output from the processor when the processor writes, and the replace signal 30 is output from the sequencer when cache data needs to be replaced (when there is a cache miss and the cache memory is full of valid data). It is output from 11. Further, the cache hit signal 31 is output from the sequencer 11 when there is a cache hit (when the cache hit signal 10 becomes valid), and the cache miss signal 32 is output from the sequencer 11 when there is a cache miss (when the cache hit signal 10 becomes valid).
output from the sequencer 11).

【0017】上記のリプレース更新信号33,34は、
リプレースメモリ24,25に対するデータの書込み条
件を決める信号である。なお、更新履歴データ26、リ
プレース履歴データ27、リプレースデータ29のビッ
ト幅は、セットの数すなわちウェイ数と同じであり、2
ウェイなら2ビット、4ウェイなら4ビットである。実
施例では4ウェイの場合を説明している。
The above replace update signals 33 and 34 are as follows:
This signal determines the conditions for writing data into the replacement memories 24 and 25. Note that the bit width of the update history data 26, replace history data 27, and replace data 29 is the same as the number of sets, that is, the number of ways, and 2
If it is a way, it is 2 bits, and if it is 4 ways, it is 4 bits. In the embodiment, a 4-way case is explained.

【0018】上記データ更新ブロック記憶用のリプレー
スメモリ24は、キャッシュメモリがライトヒットした
ときに更新され、リプレースブロック記憶用のリプレー
スメモリ25は、キャッシュミスでデータブロックのリ
プレースが発生したときに更新される。
The replace memory 24 for storing the data update block is updated when the cache memory has a write hit, and the replace memory 25 for storing the replace block is updated when a data block is replaced due to a cache miss. Ru.

【0019】以下、上述の4ウェイセットアソシアティ
ブ方式のキャッシュメモリにおけるリプレースの動作を
、各場合に分けて説明する。
The replacement operation in the above-mentioned 4-way set associative cache memory will be explained below for each case.

【0020】(1)リードヒットの場合。(1) In case of lead hit.

【0021】これは、プロセッサからのアクセスの種別
が読み出しであり、また、アクセスされたアドレスのデ
ータがキャッシュメモリ上にあることを意味している。 この場合、キャッシュメモリのデータブロックの更新及
びリプレースはなく、リプレースメモリ24,25の更
新もないので、リプレース決定回路28は何も動作しな
い。なお、リプレース決定回路28が動作可能となるの
は、以下に説明するリードミス、ライトヒット、ライト
ミスのときである。
This means that the type of access from the processor is read, and that the data at the accessed address is on the cache memory. In this case, the data blocks in the cache memory are not updated or replaced, and the replacement memories 24 and 25 are not updated, so the replacement determination circuit 28 does not operate. Note that the replacement determination circuit 28 becomes operable in the case of a read miss, write hit, or write miss, which will be described below.

【0022】(2)リードミスの場合。(2) In case of read error.

【0023】これは、プロセッサからのアクセスの種別
が読み出しであり、また、アクセスされたアドレスのデ
ータがキャッシュメモリ上にないことを意味している。 この場合、ミスしたデータを主記憶装置からキャッシュ
メモリに転送する必要があるため、リプレース決定回路
28によりキャッシュメモリ内の転送先ブロックを、セ
ットアドレス3で指定される四つのセットの中から一つ
決定する。いま、プロセッサアドレス部1のセットアド
レス3によりアクセスされたセットの履歴データが、図
3(a)の更新履歴データ26,リプレース履歴データ
27で示される状態であったとする。なお、図中■〜■
は各ブロックの番号を示す。図3(a)において、“0
010”の更新履歴データ26は、これまでにブロック
■のデータが変更されたことがあることを示しており、
“0001”のリプレース履歴データ27は、ブロック
■がリプレースされたことがあることを示している。リ
プレース決定回路28は、この二つのデータを基に、リ
プレースするブロックの場所を決定する。この例の場合
、ブロック■とブロック■のフラグがセットされている
ので、ブロック■或いはブロック■がリプレースブロッ
クとして選択可能であるが、図3(a)の例では、“0
100”のリプレースデータ29で示されるようにブロ
ック■が選択されている。なお、ブロック■と■のどち
らを選択するかは任意であり、たとえば、ランダム或い
はブロック番号の昇順等で決めてもよい。リプレースデ
ータ29はシーケンサ11に入力され、シーケンサ11
はリプレースデータ29をもとに該当するブロックのキ
ャッシュデータのリプレースを実行する。
This means that the type of access from the processor is read, and that the data at the accessed address is not on the cache memory. In this case, since it is necessary to transfer the missed data from the main memory to the cache memory, the replacement determining circuit 28 selects one of the four sets specified by the set address 3 as the transfer destination block in the cache memory. decide. Assume now that the history data of the set accessed by the set address 3 of the processor address section 1 is in the state shown by the update history data 26 and the replacement history data 27 in FIG. 3(a). In addition, ■~■ in the diagram
indicates the number of each block. In FIG. 3(a), “0
The update history data 26 of "010" indicates that the data of block ■ has been changed in the past.
The replacement history data 27 of "0001" indicates that block (2) has been replaced. The replacement determining circuit 28 determines the location of the block to be replaced based on these two pieces of data. In this example, since the flags of block ■ and block ■ are set, block ■ or block ■ can be selected as the replacement block, but in the example of FIG.
Block ■ is selected as indicated by the replacement data 29 of ``100''. Note that it is optional to select either block ■ or block ■, and for example, it may be determined randomly or in ascending order of block numbers. .The replacement data 29 is input to the sequencer 11,
executes replacement of the cache data of the corresponding block based on the replacement data 29.

【0024】そして、ブロック■のリプレースが終了す
ると、リプレース信号30とキャッシュミス信号32が
アサートされ、リプレースメモリ25の内容は図3(b
)のように更新される。すなわち、リプレース履歴デー
タ27のブロック■に対応するビットが“1”になる。
When the replacement of block (2) is completed, the replace signal 30 and the cache miss signal 32 are asserted, and the contents of the replace memory 25 are changed to those shown in FIG. 3(b).
) will be updated as follows. That is, the bit corresponding to block (2) of the replacement history data 27 becomes "1".

【0025】(3)ライトヒットの場合。(3) In the case of a light hit.

【0026】これは、プロセッサからのアクセスの種別
が書込みであり、また、アクセスされたアドレスのデー
タがキャッシュメモリ上にあることを意味している。こ
こでは、セットアドレス3で指定されるセットのブロッ
ク■がライトヒットしたとする(図4参照)。セットア
ドレス3により、リプレース信号30,キャッシュヒッ
ト信号31及びプロセッサ・ライト信号21がアサート
され、リプレースメモリ24の内容は、図4(b)の更
新履歴データ26のように更新される。
This means that the type of access from the processor is write, and that the data at the accessed address is on the cache memory. Here, it is assumed that block (2) of the set specified by set address 3 has been write-hit (see FIG. 4). Due to the set address 3, the replace signal 30, cache hit signal 31, and processor write signal 21 are asserted, and the contents of the replace memory 24 are updated as shown in the update history data 26 of FIG. 4(b).

【0027】(4)ライトミスの場合。(4) In case of write error.

【0028】リードミスのときと同様に、リプレース履
歴データ27のブロック■に対応するビットが“1”に
なるように、リプレースメモリ25の内容が図5(a)
から図5(b)のように更新される。また、リプレース
メモリ24,25から履歴データ26,27が出力され
る(図4(a)参照)。リプレース決定回路28は、こ
の二つのデータを基に、リードミスのときと同様にして
リプレースデータ29を出力する。
As in the case of a read miss, the contents of the replace memory 25 are changed as shown in FIG. 5(a) so that the bit corresponding to block ■ of the replace history data 27 becomes "1".
The information is updated as shown in FIG. 5(b). Further, history data 26 and 27 are output from the replacement memories 24 and 25 (see FIG. 4(a)). The replace determining circuit 28 outputs replace data 29 based on these two data in the same manner as in the case of a read error.

【0029】上記各場合における各信号21,30,3
1,32のレベル関係は以下の通りである。
[0029] Each signal 21, 30, 3 in each of the above cases
The level relationship between numbers 1 and 32 is as follows.

【0030】                          
         リード    リード    ライ
ト    ライト                 
                 ヒット    ミ
ス      ヒット    ミスプロセッサライト信
号  21          0        0
        1        1リプレース信号
        30          0    
    1        0        1キャ
ッシュヒット信号  31          1  
      0        1        0
キャッシュミス信号    32          
0        1        0      
  1(5)どのブロックの履歴データも“1”になる
場合。
[0030]
Read Read Write Write
Hit Miss Hit Miss processor write signal 21 0 0
1 1 replace signal 30 0
1 0 1 cache hit signal 31 1
0 1 0
Cache miss signal 32
0 1 0
1 (5) When the history data of any block is "1".

【0031】リプレースとデータの更新が行われて行く
と、どのブロックの履歴データ(更新履歴データ26,
リプレース履歴データ27)も“1”になる場合がある
(図6(a)参照)。このとき、リプレース決定回路2
8は、データのリプレース終了時又はデータの更新後、
リプレースデータ29に“0000”を出力する。出力
と同時にクリア信号35がアサートされ、リプレースメ
モリ24,25に“0”が書き込まれ、初期状態に戻る
(図6(b)参照)。
As replacements and data updates are performed, which block's history data (update history data 26,
The replacement history data 27) may also become "1" (see FIG. 6(a)). At this time, the replacement determination circuit 2
8 is at the end of data replacement or after data update,
Output “0000” to the replacement data 29. At the same time as the output, the clear signal 35 is asserted, and "0" is written in the replacement memories 24 and 25, returning to the initial state (see FIG. 6(b)).

【0032】上記実施例の説明では、リプレースメモリ
24,25の何方も“1”でないブロックをリプレース
したが、この条件を以下のように変更することもできる
In the explanation of the above embodiment, a block in which neither of the replace memories 24 and 25 is "1" is replaced, but this condition can also be changed as follows.

【0033】いま、リプレースメモリ24,25が図7
(a)に示す状態であったとする。まず、リプレースメ
モリ24,25の少なくとも一方の出力が“0”のもの
をリプレースする。図7(a)の例ではブロック■〜■
がリプレースの対象となる。リプレースメモリ25のリ
プレースしたブロックのビットは“1”に変える。図7
(b)に示すように、リプレースメモリ25の出力が全
て“1”になったら、次に、リプレースメモリ24が“
0”でリプレースメモリ25が“1”のブロックをリプ
レースする。図7(b)の例ではブロック■,■,■が
リプレースの対象となる。このとき、リプレースメモリ
24の内容を“1”に変更する。そして、図7(c)に
示すように、リプレースメモリ24の出力が全て“1”
になったら、図7(d)に示すように、リプレースメモ
リ24,25を“0”に初期化する。
Now, the replacement memories 24 and 25 are shown in FIG.
Assume that the situation is as shown in (a). First, at least one of the replace memories 24 and 25 whose output is "0" is replaced. In the example of FIG. 7(a), blocks ■~■
is subject to replacement. The bit of the replaced block in the replacement memory 25 is changed to "1". Figure 7
As shown in (b), when all the outputs of the replace memory 25 become "1", next, the replace memory 24 outputs "1".
0" and the replace memory 25 is "1". In the example of FIG. Then, as shown in FIG. 7(c), all outputs of the replace memory 24 are "1".
When this happens, the replacement memories 24 and 25 are initialized to "0" as shown in FIG. 7(d).

【0034】また、ライトヒットでは、先に述べた実施
例と同様に、リプレースメモリ25のみを更新する。こ
のように、プロセッサのライトによるリプレースメモリ
の更新と、リプレースによるリプレースメモリの更新と
に重み付けを行い、リプレース順序を決定する。なお、
図7に示す例では、ライト:リプレース=2:1の重み
付けを行っている。このように重み付けを行なうことに
より、リプレースする順序を変えることが可能となり、
アプリケーションプログラムの種類によっては性能を向
上させることができる。
Furthermore, in a write hit, only the replace memory 25 is updated, similar to the previously described embodiment. In this way, the replacement order is determined by weighting the update of the replace memory by writing by the processor and the update of the replace memory by replacing. In addition,
In the example shown in FIG. 7, weighting is performed at write:replace=2:1. By weighting in this way, it is possible to change the order of replacement,
Performance can be improved depending on the type of application program.

【0035】なお、図2に示す実施例においては、更新
履歴データ26とリプレース履歴データ27をそれぞれ
別のリプレースメモリ24,25に格納したが、図8に
示すように、両方のメモリを一つのリプレースメモリ3
7に統合することもできる。なお、図2に示す実施例と
対応する部材等には同一符号を付して説明は省略する。
In the embodiment shown in FIG. 2, the update history data 26 and the replacement history data 27 are stored in separate replacement memories 24 and 25, but as shown in FIG. Replace memory 3
7 can also be integrated. Incidentally, members and the like corresponding to those in the embodiment shown in FIG. 2 are given the same reference numerals, and explanations thereof will be omitted.

【0036】図8に示す実施例においては、リプレース
更新信号33,34はOR回路36を介してリプレース
メモリ37に供給される。また、リプレースメモリ37
にはアドレス信号として、図1に示すプロセッサアドレ
ス部1からタグアドレス2が供給され、リプレースメモ
リ37からは、更新履歴データとリプレース履歴データ
の両方のデータを含んだリプレース履歴データ38がリ
プレース決定回路28に供給される。
In the embodiment shown in FIG. 8, the replace update signals 33 and 34 are supplied to a replace memory 37 via an OR circuit 36. In addition, the replacement memory 37
The tag address 2 is supplied as an address signal from the processor address section 1 shown in FIG. 28.

【0037】なお、上述の実施例においては、初期状態
での履歴データのビットを“0”とし、更新された或い
はリプレースされたブロックのビットを“1”としたが
、ビットの“1”と“0”は反転してもよい。
[0037] In the above embodiment, the bit of the history data in the initial state is set to "0", and the bit of the updated or replaced block is set to "1". “0” may be inverted.

【0038】[0038]

【発明の効果】以上に述べたように、本発明においては
、キャッシュメモリ内のキャッシュデータが変更された
ときに、履歴データの変更されたブロックに対応するビ
ットを、たとえば、“1”とし、キャッシュデータのリ
プレースの際には、たとえば、“0”とされているブロ
ックのキャッシュデータを優先的にリプレースすること
により、プロセッサにより変更されたブロックのデータ
は、キャッシュメモリから追い出される比率が低くなる
。これにより、ライトバックの回数を削減でき、プロセ
ッサの待ち時間が減り、システムのスループットが向上
する。
As described above, in the present invention, when the cache data in the cache memory is changed, the bit corresponding to the changed block of history data is set to "1", for example, When replacing cache data, for example, by preferentially replacing cache data in blocks that are set to "0", the ratio of data in blocks modified by the processor to be evicted from the cache memory will be lowered. . This reduces the number of writebacks, reduces processor latency, and increases system throughput.

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

【図1】本発明が適用されるキャッシュメモリの模式図
を示す。
FIG. 1 shows a schematic diagram of a cache memory to which the present invention is applied.

【図2】図1のキャッシュメモリにおいて使用されるリ
プレース回路の構成例を示すブロック図である。
FIG. 2 is a block diagram showing a configuration example of a replacement circuit used in the cache memory of FIG. 1;

【図3】リードミスのときのリプレースメモリのデータ
の遷移図である。
FIG. 3 is a diagram showing the transition of data in a replacement memory when a read miss occurs.

【図4】ライトヒットのときのリプレースメモリのデー
タの遷移図である。
FIG. 4 is a diagram showing the transition of data in a replace memory when a write hit occurs.

【図5】ライトミスのときのリプレースメモリのデータ
の遷移図である。
FIG. 5 is a diagram showing the transition of data in a replacement memory when a write error occurs.

【図6】データが全て“1”のときのリプレースメモリ
のデータ遷移図である。
FIG. 6 is a data transition diagram of the replacement memory when all data is “1”.

【図7】重み付けしてリプレースしたときのリプレース
メモリのデータ遷移図である。
FIG. 7 is a data transition diagram of a replacement memory when weighted replacement is performed.

【図8】リプレース回路の他の構成例を示すブロック図
である。
FIG. 8 is a block diagram showing another configuration example of a replacement circuit.

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

1  プロセッサアドレス部 2  タグアドレス 3  セットアドレス 4  ワードアドレス 5  リプレース回路 6  タグメモリ 7  バリッドメモリ 8  データメモリ 9  コンパレータ 10  キャッシュヒット信号 11  シーケンサ 12  データ選択信号 13  タグデータ 14  キャッシュデータ 21  プロセッサライト信号 22,23  AND回路 24  更新履歴データ用リプレースメモリ25  リ
プレース履歴データ用リプレースメモリ26  更新履
歴データ 27  リプレース履歴データ 28  リプレース決定回路 29  リプレースデータ 30  リプレース信号 31  キャッシュヒット信号 32  キャッシュミス信号 33,34  リプレース更新信号 35  クリア信号 36  OR回路 37  リプレースメモリ 38  リプレース履歴データ
1 Processor address section 2 Tag address 3 Set address 4 Word address 5 Replace circuit 6 Tag memory 7 Valid memory 8 Data memory 9 Comparator 10 Cache hit signal 11 Sequencer 12 Data selection signal 13 Tag data 14 Cache data 21 Processor write signals 22, 23 AND circuit 24 Replace memory for update history data 25 Replace memory for replace history data 26 Update history data 27 Replace history data 28 Replace decision circuit 29 Replace data 30 Replace signal 31 Cache hit signal 32 Cache miss signals 33, 34 Replace update signal 35 Clear Signal 36 OR circuit 37 Replace memory 38 Replace history data

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】  書込み動作が複数ブロックに分割され
たキャッシュメモリに対して行われ書込みがあったブロ
ックのキャッシュデータの主記憶装置への書込みがリプ
レース時に行われるキャッシュメモリのキャッシュデー
タリプレース装置において、各ブロックに対応する複数
ビットからなる履歴データを記憶するための履歴データ
メモリを設け、初期状態においては前記履歴データのビ
ットを第1の状態に設定し、キャッシュメモリ内のキャ
ッシュデータが変更されたときに前記履歴データの変更
されたブロックに対応するビットを第2の状態に設定し
、キャッシュデータのリプレースの際には、前記履歴デ
ータのビットが第1の状態に設定されているブロックの
キャッシュデータを優先的にリプレースすることを特徴
とするキャッシュメモリにおけるキャッシュデータリプ
レース装置。
1. A cache data replacement device for a cache memory in which a write operation is performed on a cache memory divided into a plurality of blocks, and cache data of the written block is written to a main storage device at the time of replacement. A history data memory is provided for storing history data consisting of a plurality of bits corresponding to each block, and in an initial state, the bits of the history data are set to a first state, and the cache data in the cache memory is changed. when the bit corresponding to the changed block of the historical data is set to a second state, and when replacing the cache data, the cache of the block whose bit of the historical data is set to the first state; A cache data replacement device in a cache memory, which replaces data preferentially.
JP3022064A 1991-02-15 1991-02-15 Cache data replacer in cache memory Pending JPH04262437A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3022064A JPH04262437A (en) 1991-02-15 1991-02-15 Cache data replacer in cache memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3022064A JPH04262437A (en) 1991-02-15 1991-02-15 Cache data replacer in cache memory

Publications (1)

Publication Number Publication Date
JPH04262437A true JPH04262437A (en) 1992-09-17

Family

ID=12072472

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3022064A Pending JPH04262437A (en) 1991-02-15 1991-02-15 Cache data replacer in cache memory

Country Status (1)

Country Link
JP (1) JPH04262437A (en)

Similar Documents

Publication Publication Date Title
US5584013A (en) Hierarchical cache arrangement wherein the replacement of an LRU entry in a second level cache is prevented when the cache entry is the only inclusive entry in the first level cache
US5826052A (en) Method and apparatus for concurrent access to multiple physical caches
US4811209A (en) Cache memory with multiple valid bits for each data indication the validity within different contents
US5689679A (en) Memory system and method for selective multi-level caching using a cache level code
US5465342A (en) Dynamically adaptive set associativity for cache memories
US6990557B2 (en) Method and apparatus for multithreaded cache with cache eviction based on thread identifier
US6023747A (en) Method and system for handling conflicts between cache operation requests in a data processing system
US5787478A (en) Method and system for implementing a cache coherency mechanism for utilization within a non-inclusive cache memory hierarchy
US6212605B1 (en) Eviction override for larx-reserved addresses
US6996679B2 (en) Cache allocation mechanism for saving multiple elected unworthy members via substitute victimization and imputed worthiness of multiple substitute victim members
US6993628B2 (en) Cache allocation mechanism for saving elected unworthy member via substitute victimization and imputed worthiness of substitute victim member
US7343455B2 (en) Cache mechanism and method for avoiding cast out on bad victim select and recycling victim select operation
JPH0364893B2 (en)
US20060036811A1 (en) Method for software controllable dynamically lockable cache line replacement system
US8621152B1 (en) Transparent level 2 cache that uses independent tag and valid random access memory arrays for cache access
US7831774B2 (en) Pipelining D states for MRU steerage during MRU-LRU member allocation
US5809526A (en) Data processing system and method for selective invalidation of outdated lines in a second level memory in response to a memory request initiated by a store operation
US7356650B1 (en) Cache apparatus and method for accesses lacking locality
US7039760B2 (en) Programming means for dynamic specifications of cache management preferences
US6240489B1 (en) Method for implementing a pseudo least recent used (LRU) mechanism in a four-way cache memory within a data processing system
US5905997A (en) Set-associative cache memory utilizing a single bank of physical memory
US5953747A (en) Apparatus and method for serialized set prediction
US7010649B2 (en) Performance of a cache by including a tag that stores an indication of a previously requested address by the processor not stored in the cache
JP3929872B2 (en) Cache memory, processor and cache control method
US6240487B1 (en) Integrated cache buffers