[go: up one dir, main page]

WO2010029694A1 - Cache memory and cache memory system - Google Patents

Cache memory and cache memory system Download PDF

Info

Publication number
WO2010029694A1
WO2010029694A1 PCT/JP2009/004105 JP2009004105W WO2010029694A1 WO 2010029694 A1 WO2010029694 A1 WO 2010029694A1 JP 2009004105 W JP2009004105 W JP 2009004105W WO 2010029694 A1 WO2010029694 A1 WO 2010029694A1
Authority
WO
WIPO (PCT)
Prior art keywords
cache memory
write
word
tag
dirty
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.)
Ceased
Application number
PCT/JP2009/004105
Other languages
French (fr)
Japanese (ja)
Inventor
橋本芳信
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.)
Panasonic Corp
Original Assignee
Panasonic 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 Panasonic Corp filed Critical Panasonic Corp
Publication of WO2010029694A1 publication Critical patent/WO2010029694A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0864Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches using pseudo-associative means, e.g. set-associative or hashing

Definitions

  • the present invention relates to a write-back cache memory.
  • the write-back method is a method in which, when data is written to the cache memory, basically only the cache memory is written, and the main memory is not written at the same time, but is later rewritten appropriately.
  • the writing timing to the cache memory and the main memory is shifted, so a Dirty / Clean flag is provided for managing the consistency of the data held by both. Dirty indicates that the data held in the cache memory is updated, etc., and cannot match the data on the main memory, and Clean indicates the opposite.
  • the Dirty / Clean flag can be used to determine whether the target data is dirty or clean. Dirty data must be written back to main memory at an appropriate timing to ensure consistency.
  • Such a dirty / clean flag is generally managed in units of lines (consisting of several words).
  • lines consisting of several words.
  • it is unclear which word out of several words included in a line is Dirty, so unnecessary write back may be performed.
  • Patent Document 1 it is possible to write back only necessary data and manage unnecessary bus transactions by managing the Dirty / Clean distinction in units smaller than lines (for example, word units). Yes.
  • Other techniques of Patent Documents 2 to 4 are known.
  • JP 2003-108439 A Japanese Unexamined Patent Publication No. 2006-91995 JP-A-8-16467 JP-A-8-221270
  • the improvement of the cache hit rate is generally directly related to the improvement of the performance of the entire computer system.
  • an object of the present invention is to provide a cache memory having a further improved cache hit rate.
  • the cache memory includes a plurality of lines each including a plurality of words, a tag indicating an address in the main memory of data stored in the line, and whether or not the line is being refilled for each line.
  • the tag storage unit that stores the refill bit to be indicated and the dirty bit that indicates whether or not the data in the word is dirty for each word, the tag address that is the cache access target, and the address indicated by the tag match
  • the refill bit of the line indicates refilling
  • the write access is determined to be a write hit
  • the read access is related to The dirty bit corresponding to the word contained in the line If shows the I, it is characterized in that it comprises determining the hit judging unit and read hit the read access.
  • the hit determination unit does not permit the read access to the word until the refill of the line including the word is completed. It does not matter.
  • the hit determination unit determines that the write hit occurs, in writing to the word related to the write access, the dirty bit corresponding to the word is asserted, and the dirty bit is dirty when the line is refilled. It is also possible to provide a control unit that permits overwriting of data for words that do not indicate this, and prohibits overwriting of data for words that indicate that the dirty bit is dirty.
  • the cache memory system is located in a hierarchy between the central processing unit, the cache memory, the central processing unit, the cache memory, and the storage hierarchy, and the central processing unit is transferred to the cache memory.
  • the first write buffer that holds data to be written, the cache memory, the memory to be written back, and the storage hierarchy are located in a hierarchy, and write back from the cache memory to the memory to be written back
  • the cache memory hits / deletes a flag indicating whether refilling is in progress and a dirty bit for each word that has been used for the purpose of reducing bus transactions to the main memory at the time of write back. Used to determine miss hits.
  • a write access to a line being refilled is always determined as a write hit, and a read access is determined as a read hit on the condition that the access target word is dirty.
  • non-blocking cache that is more effective than the conventional one can be constructed together with the write buffer and read buffer prepared in the cache access path.
  • FIG. 50 is a table 50 showing determination results output by the hit determination unit 20 of FIG. 3 according to input. Sequence diagram of CPU 2, cache memory 6, and main memory 4 during write access Sequence diagram of CPU 2, cache memory 6, and main memory 4 during read access Diagram explaining the refill of a word (W0, W1, W2, W3) on a line in time series
  • the write-back cache memory employs a direct map method, and in the event of a cache write miss hit, the write allocation method (once the data at the address to be accessed for write access is transferred from the main memory to the cache memory In this method, after the data is reflected on the line, a write operation equivalent to that at the time of a write hit is performed on the line.
  • FIG. 1 is a configuration diagram of the cache memory system 1.
  • the cache memory system 1 includes a CPU (Central Processing Unit) 2, a main memory 4, a cache memory 6, write buffers 8 and 10, and a read buffer 12.
  • CPU Central Processing Unit
  • main memory 4 main memory 4
  • cache memory 6 write buffers 8 and 10
  • read buffer 12 read buffer 12.
  • the CPU 2 is a central processing unit that performs various arithmetic processes.
  • the main memory 4 is composed of a volatile memory that temporarily stores data such as DRAM.
  • the cache memory 6 temporarily stores data to be stored in the main memory 4.
  • the access speed is higher than that of the main memory 4 and is interposed between the upper CPU 2 and the lower main memory 4 due to the structure of the storage hierarchy.
  • the cache memory 6 is a write-back method, and the data held therein is written back to the main memory 4 when a cache miss hit occurs.
  • the cache memory 6 includes a control unit 6a, a storage unit 6b, a hit determination unit 6c, and an arbitration unit 6d.
  • the control unit (cache memory control unit) 6a controls each functional block, for example, reads / writes data stored in the storage unit 6b and updates tags. Further, data is output to the CPU 2 according to the hit determination result of the hit determination unit 6c.
  • the storage unit 6b includes a data storage unit that stores data, and a tag storage unit that includes a tag as information for identifying the stored data.
  • the hit determination unit 6c determines whether or not the data requested to be accessed by the CPU 2 is stored in the storage unit 6b. Details will be described later.
  • the arbitration unit 6d arbitrates when access to data in the storage unit 6b competes.
  • FIG. 2 is a diagram showing the configuration of the cache memory 6.
  • the address 22 in the upper part of FIG. 2 indicates an address output together with a read / write request from the CPU 2 when the CPU 2 tries to access the cache memory 6.
  • AD [31: 0] 22 is 32 bits, and the upper 16 bits (AD [31:16]) are used as tag addresses, and 12 bits (AD [15: 4]) from bit 4 to bit 15 are used.
  • the cache memory 6 includes a tag storage unit 14, a data storage unit 16, a selector 18, and a hit determination unit 20.
  • the tag storage unit 14 is provided corresponding to 4096 lines in the data storage unit 16, and stores identification information such as data stored in the line.
  • the tag storage unit 14 stores a valid bit (V) indicating whether or not line data is valid, a refill bit (R) indicating whether or not the line is being refilled, and the line. It has a tag bit (Tag) indicating the address of the main data in the main memory.
  • the tag storage unit 14 includes four dirty bits (D0, D1, D2, D3) respectively provided corresponding to four words (Word0, Word1, Word2, Word3) included in the line. It is out. If the dirty bit is dirty, it has been updated by the write operation from the CPU 2, but it has not yet been written back to the main memory, and it cannot be guaranteed that it matches the data in the main memory. If necessary, it is necessary to write back to the main memory.
  • the data storage unit 16 holds 4096 lines with four words as one line.
  • the data storage unit 16 includes an SRAM or the like as a memory separate from the tag storage unit 14.
  • the size per word is 32 bits corresponding to the data access width from the CPU 2, and the bit width of the input / output port of the data storage unit 16 is 32 bits (for one word).
  • the selector 18 selects one word out of four words based on 2 bits (AD [3: 2]) of the address 22.
  • the hit determination unit 20 has a valid bit (V) of a line specified by a signal indicating Read or Write (Read or Write), a tag address (AD [31:16]), and an index address (AD [15: 4]). , Refill bit (R), dirty bit (D0, D1, D2, D3) for every four words, tag bit (Tag) indicating the address of the data stored in the above line, one of the four words It is determined whether it is a hit or a miss based on 10 inputs of the specified word address (AD [3: 2]).
  • FIG. 1 An example of the circuit configuration of the hit determination unit 20 is shown in FIG. 1
  • the hit determination unit 20 includes 2-input 1-output AND circuits 23, 24, 26, 28, and 30, a 3-input 1-output OR circuit 32, NOT circuits 34 and 36, a 4-input 1-output selector 38, and a comparator 40. .
  • the selector 38 selects and outputs one of four of D0, D1, D2, and D3 based on a 2-bit (AD [3: 2]) input. That is, based on an input (AD [3: 2]) that specifies an access target word included in the line, a dirty bit corresponding to the word is output.
  • the comparator 40 compares the tag bit (Tag) held in the access target line of the tag storage unit 14 with the tag address (AD [31:16]), and outputs HIGH when the two match.
  • FIG. 4 is a table 50 showing determination results output by the hit determination unit 20 of FIG. 3 in response to input.
  • the mark “*” means “Don't Care”.
  • hit determination unit 20 There are eight cases from (a) to (h) depending on the combination of values input to the hit determination unit 20. Each case will be described in turn. Note that hit determination in cases (a), (b), (d), (e), (f), and (h) that are not being refilled is basically the same as in the prior art. The cases (c) and (g) during refill are characteristic.
  • the write miss hit data is temporarily held in the write buffer 8 and written to the cache memory 6 after completion of the refill.
  • the write miss hit data is written in the cache memory 6.
  • the dirty bit for each written word is updated to dirty
  • the tag bit (Tag) is updated to the address of the access that caused the write miss hit.
  • a data read request and an address are output to the bus to the main memory 4 in order to refill the write access target line.
  • the CPU 2 waits until the notification is no longer being refilled (waits until the refill is completed), and performs a read hit operation (reads the refilled read access target data) as a read hit after the refill is completed, or the missed read Even if the access is not completed, the process proceeds to the subsequent process.
  • the hit determination unit 20 determines a read hit if the dirty bit corresponding to the read access target word is dirty even if refilling is in progress as in (g). As a result, the read hit rate can be improved.
  • the hit determination unit 20 determines as a write hit even if refilling is in progress as in the case of (c), the write hit rate can be improved as compared with the prior art.
  • the hit determination unit 20 of the cache memory 6 that has received the write access request from the CPU 2 and the tag address (AD [31:16]) of the data address (AD [31: 0]) 22 and the write access request as described above. Hit determination is performed based on comparison with the tag bit (Tag) of the line of the target data or the refill bit (R) of the line.
  • the CPU 2 causes the write buffer 8 to temporarily hold the data and the address (AD [31: 0]) 22 that have become a write miss hit. As a result, the CPU 2 can proceed to the subsequent processing without waiting for the completion of the cache write.
  • the data and address (AD [31: 0]) 22 held in the write buffer 8 are used for data writing in step S11.
  • the data written back to the write buffer 10 is further written back to the main memory 4 at an appropriate timing such as when the bus is free.
  • the cache memory 6 When the write back processing (S3-S8) is completed, the cache memory 6 performs refill / tag update (S9). Specifically, the read buffer 12 overwrites the line of the cache memory 6 with the data of the write access target line that has been read from the main memory 4.
  • the cache memory 6 When the CPU 2 requests read access to the cache memory 6 (S20), the cache memory 6 that has received the request performs the hit determination described above in the hit determination unit 20.
  • the CPU 2 reads data from the word of the line that is the target of the read access request.
  • FIG. 7 is a diagram for explaining the refill of words (W0, W1, W2, W3) on a certain line in time series. The process at the time of write access will be described using (a), and the process at the time of read access will be described using (b).
  • the cache memory 6 completes refilling in the order of W0 ⁇ W1 ⁇ W2 ⁇ W3 at times t0 ⁇ t1 ⁇ t2 ⁇ t3 ⁇ t4, respectively. To do.
  • the refill bit is asserted, and the line tag bit (Tag) is updated to the address of the new line to be refilled.
  • the write access request is received in the middle of refilling and data overwriting is allowed, so that the tag bit (Tag) of the line does not coincide with the tag of the actually overwritten data.
  • the tag is updated at the start of refilling.
  • the hit determination unit 20 determines that it is a write hit as described above, and receives the write access to the word W2 to receive the corresponding dirty. Assert bit (D2). After that, since the dirty bit (D2) of the word W2 is asserted between t2 and t3, the cache memory 6 does not overwrite the word W2 by refilling.
  • the cache memory 6 is in the order of W0 ⁇ W1 ⁇ W2 ⁇ W3 at time t0 ⁇ t1 ⁇ t2 ⁇ t3 ⁇ t4. It is assumed that refilling is completed in order.
  • the hit determination unit 20 determines that it is a read hit as described above. , Accepts read access to word W2.
  • the hit determination unit 20 reads the read miss as described above. At the same time as determining the hit, the fact that refilling is in progress is output. In response to this, the CPU 2 postpones execution of this read access until after the refill is completed.
  • the direct map type cache memory has been described as an example.
  • the present invention is not limited to this, and a cache memory adopting a full associative method or a set associative method may be used.
  • the line to be refilled at the time of a cache miss hit is not determined as a unique line as in the direct map method, but based on algorithms such as the LRU (Least Recently Used) method and the round robin method Is different.
  • the present invention is also applied as a method for configuring and controlling a write-back cache memory in a shared memory type cache memory system in which a plurality of cache memories share a single lower layer memory via a shared bus. be able to.
  • write access from the central processing unit to the cache memory is performed by arranging the write buffers 8 and 10 and the read buffer 12 in the path connected to the input / output of the cache memory 6.
  • the write access from the cache memory to the main memory and the write access from the main memory to the cache memory are buffered, so that more flexible cache memory control is possible.
  • the cache memory may be a deeper hierarchical memory system.
  • the cache memory may be composed of a primary cache memory and a secondary cache memory.
  • the present embodiment may be applied to a primary cache memory or a secondary cache memory.
  • the cache memory of the present invention is useful because it can be used as a cache memory existing in a general semiconductor circuit and can improve the cache hit rate.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

A cache memory (6) includes: a data storage unit (16) having a line containing four words (Word0, Word1, Word2, Word3); and a tag storage unit (14) which stores a tag for identifying each line.  The tag storage unit contains a refill bit (R), dirty bits (D0, D1, D2, D3), and a tag bit (Tag).  If a tag address (AD [31:16]) to be accessed coincides with the address indicated in the tag bit (Tag) and if the refill bit (R) corresponding to the line relating to the access object indicates that refill is in progress, a hit check unit (20) determines that the write access is a write hit.  If the dirty bit corresponding to the word relating to the access object contained in the line indicates dirty, the hit check unit (20) determines that the read access is a read hit.

Description

キャッシュメモリ、キャッシュメモリシステムCache memory, cache memory system

 本発明は、ライトバック方式のキャッシュメモリに関する。 The present invention relates to a write-back cache memory.

 ライトバック方式とは、キャッシュメモリへのデータ書き込み時に、基本的にキャッシュメモリに対してのみ書き込み、主記憶へは同時には書き込まずに、後で適宜書き戻す方式である。 The write-back method is a method in which, when data is written to the cache memory, basically only the cache memory is written, and the main memory is not written at the same time, but is later rewritten appropriately.

 ライトバック方式では、キャッシュメモリと主記憶とへの書き込みタイミングにズレが生じるので、両者が保持しているデータの整合性を管理するためのDirty/Cleanフラグが設けられている。Dirty(ダーティ)は、キャッシュメモリに保持されているデータが更新されるなどして、主記憶上のデータとの一致が保証できない場合を示し、Clean(クリーン)は、その逆を示す。Dirty/Cleanフラグにより、対象のデータがDirtyかCleanかを判断することができる。Dirtyなデータは、適当なタイミングで主記憶に書き戻し、その整合性をとる必要がある。 In the write-back method, the writing timing to the cache memory and the main memory is shifted, so a Dirty / Clean flag is provided for managing the consistency of the data held by both. Dirty indicates that the data held in the cache memory is updated, etc., and cannot match the data on the main memory, and Clean indicates the opposite. The Dirty / Clean flag can be used to determine whether the target data is dirty or clean. Dirty data must be written back to main memory at an appropriate timing to ensure consistency.

 このようなDirty/Cleanフラグは、ライン(数ワードから構成される)単位で管理することが一般的である。もっとも、ライン単位であると、ラインに含まれる数ワードのうちの、どのワードがDirtyかまでは不明なので無用な書き戻しが行われることがある。 Such a dirty / clean flag is generally managed in units of lines (consisting of several words). Of course, in the case of line units, it is unclear which word out of several words included in a line is Dirty, so unnecessary write back may be performed.

 そこで、特許文献1では、ラインより細かい単位(例えば、ワード単位)でDirty/Cleanの別を管理することで、必要なデータのみの書き戻しを可能にし、不要なバス・トランザクションの低減が図れるとしている。なお、他に特許文献2~4の技術が知られている。 Therefore, in Patent Document 1, it is possible to write back only necessary data and manage unnecessary bus transactions by managing the Dirty / Clean distinction in units smaller than lines (for example, word units). Yes. Other techniques of Patent Documents 2 to 4 are known.

特開2003-108439号公報JP 2003-108439 A 特開2006-91995号公報Japanese Unexamined Patent Publication No. 2006-91995 特開平8-16467号公報JP-A-8-16467 特開平8-221270号公報JP-A-8-221270

 キャッシュメモリへのアクセスは、主記憶へのアクセスに比べて高速であるため、キャッシュヒット率の向上は、一般に計算機システム全体の性能向上に直結する。 Since the access to the cache memory is faster than the access to the main memory, the improvement of the cache hit rate is generally directly related to the improvement of the performance of the entire computer system.

 一般に、ライトアロケート制御されるキャッシュメモリにおいては、キャッシュミスヒット時に、対象ラインのデータをキャッシュに持ってくるリフィルという処理が行われる。このリフィルの最中であっても、キャッシュヒット扱いしてアクセスを許可しても問題がない場合も潜在している。しかしながら、前記従来の技術では、リフィルの最中において、当該ラインのキャッシュアクセスは一律に許可されていない。この場合、それ以降のキャッシュアクセスが待たされるため、計算機システムに大きなオーバーヘッドが発生する。また、ノンブロッキングキャッシュなどでは、この種のオーバーヘッドが除かれることが期待できるが、一般にノンブロッキングキャッシュは制御が複雑であり、別途バッファなどの資源が多く必要となる。 Generally, in a cache memory that is subject to write allocation control, when a cache miss occurs, a process called refill is performed to bring the data of the target line to the cache. Even during the refill, there is a possibility that there is no problem even if access is permitted by treating the cache hit. However, in the conventional technique, the cache access of the line is not permitted uniformly during the refill. In this case, since a subsequent cache access is awaited, a large overhead occurs in the computer system. In addition, this type of overhead can be expected to be removed in a non-blocking cache or the like, but in general, a non-blocking cache is complicated to control and requires a lot of resources such as a buffer separately.

 このような背景のもとで、本発明は、よりキャッシュヒット率を向上させたキャッシュメモリを提供することを目的としている。 Under such a background, an object of the present invention is to provide a cache memory having a further improved cache hit rate.

 本発明に係るキャッシュメモリは、それぞれ複数のワードを含む複数のラインと、前記ラインに格納されたデータの主記憶におけるアドレスを示すタグと、前記ライン毎にラインがリフィル中であるか否かを示すリフィルビットと、前記ワード毎にワードにおけるデータがダーティであるか否かを示すダーティビットとを格納するタグ格納部と、キャッシュアクセス対象であるタグアドレスと、前記タグに示されるアドレスが一致するラインのリフィルビットがリフィル中を示している場合、前記キャッシュアクセスがライトアクセスであるときは、当該ライトアクセスをライトヒットと判定し、前記キャッシュアクセスがリードアクセスであるときは、リードアクセス対象に係るラインに含まれるワードに対応するダーティビットがダーティを示していれば、当該リードアクセスをリードヒットと判定するヒット判定部を備えることを特徴としている。 The cache memory according to the present invention includes a plurality of lines each including a plurality of words, a tag indicating an address in the main memory of data stored in the line, and whether or not the line is being refilled for each line. The tag storage unit that stores the refill bit to be indicated and the dirty bit that indicates whether or not the data in the word is dirty for each word, the tag address that is the cache access target, and the address indicated by the tag match When the refill bit of the line indicates refilling, when the cache access is a write access, the write access is determined to be a write hit, and when the cache access is a read access, the read access is related to The dirty bit corresponding to the word contained in the line If shows the I, it is characterized in that it comprises determining the hit judging unit and read hit the read access.

 また、前記ヒット判定部は、前記リードアクセス対象に係るラインに含まれるワードに対応するダーティビットがダーティを示していなければ、当該ワードを含むラインのリフィル終了まで当該ワードへのリードアクセスを許可しないとしても構わない。 In addition, if the dirty bit corresponding to the word included in the line related to the read access target does not indicate the dirty, the hit determination unit does not permit the read access to the word until the refill of the line including the word is completed. It does not matter.

 また、前記ヒット判定部により、ライトヒットと判定された場合に、前記ライトアクセスに係るワードへの書き込みでは、当該ワードに対応するダーティビットをアサートし、ラインのリフィルに際して、ダーティビットがダーティであることを示さないワードに対してはデータの上書きを許可し、ダーティビットがダーティであることを示すワードに対してはデータの上書きを禁止する制御部を備えるとしても構わない。 In addition, when the hit determination unit determines that the write hit occurs, in writing to the word related to the write access, the dirty bit corresponding to the word is asserted, and the dirty bit is dirty when the line is refilled. It is also possible to provide a control unit that permits overwriting of data for words that do not indicate this, and prohibits overwriting of data for words that indicate that the dirty bit is dirty.

 また、本発明に係るキャッシュメモリシステムは、中央処理装置と、上記キャッシュメモリと、前記中央処理装置と前記キャッシュメモリと記憶階層において間の階層に位置し、前記中央処理装置が前記キャッシュメモリへとライトすべきデータを保持する第1ライトバッファと、前記キャッシュメモリとライトバック対象となるメモリと記憶階層において間の階層に位置し、前記キャッシュメモリから前記ライトバック対象となるメモリへとライトバックすべきデータを保持する第2ライトバッファと、前記キャッシュメモリと前記ライトバック対象となるメモリと記憶階層において間の階層に位置し、前記キャッシュメモリがリードすべきデータを保持するリードバッファとを備える。 The cache memory system according to the present invention is located in a hierarchy between the central processing unit, the cache memory, the central processing unit, the cache memory, and the storage hierarchy, and the central processing unit is transferred to the cache memory. The first write buffer that holds data to be written, the cache memory, the memory to be written back, and the storage hierarchy are located in a hierarchy, and write back from the cache memory to the memory to be written back A second write buffer that holds data to be read, and a read buffer that is positioned between the cache memory, the memory to be written back, and the storage hierarchy and holds data to be read by the cache memory.

 本発明に係るキャッシュメモリは、リフィル中であるか否かを示すフラグと、従来はライトバック時の主記憶へのバストランザクションを軽減する目的で用いられていたワード毎のダーティビットとをヒット/ミスヒットの判定に用いる。 The cache memory according to the present invention hits / deletes a flag indicating whether refilling is in progress and a dirty bit for each word that has been used for the purpose of reducing bus transactions to the main memory at the time of write back. Used to determine miss hits.

 つまり本発明に係るヒット判定部では、リフィル中のラインに対するライトアクセスは常にライトヒットと判定し、リードアクセスは、アクセス対象のワードがダーティであることを条件にリードヒットと判定する。 That is, in the hit determination unit according to the present invention, a write access to a line being refilled is always determined as a write hit, and a read access is determined as a read hit on the condition that the access target word is dirty.

 この構成により、キャッシュアクセス対象のラインがリフィル中という状況下において許可されていなかったキャッシュアクセスが、特定の条件において許可され、キャッシュヒット率を向上することができる。これにより、リフィル中にキャッシュアクセスが許可されないことにより発生していた計算機のオーバーヘッドを軽減することができる。 With this configuration, cache access that was not permitted in a situation where the cache access target line is being refilled is permitted under specific conditions, and the cache hit rate can be improved. As a result, it is possible to reduce the overhead of the computer that has occurred due to the fact that cache access is not permitted during refilling.

 また、キャッシュアクセス経路に用意したライトバッファ、リードバッファとあわせて、従来のものより効果的なノンブロッキングキャッシュを構築することが可能となる。 In addition, a non-blocking cache that is more effective than the conventional one can be constructed together with the write buffer and read buffer prepared in the cache access path.

キャッシュメモリシステム1の構成図Configuration diagram of cache memory system 1 キャッシュメモリ6の構成を示す図The figure which shows the structure of the cache memory 6 ヒット判定部20の回路構成例Circuit configuration example of hit determination unit 20 図3のヒット判定部20が入力に応じて出力する判定結果を示す表50の図FIG. 50 is a table 50 showing determination results output by the hit determination unit 20 of FIG. 3 according to input. ライトアクセス時におけるCPU2、キャッシュメモリ6、主記憶4のシーケンス図Sequence diagram of CPU 2, cache memory 6, and main memory 4 during write access リードアクセス時におけるCPU2、キャッシュメモリ6、主記憶4のシーケンス図Sequence diagram of CPU 2, cache memory 6, and main memory 4 during read access あるラインのワード(W0,W1,W2,W3)のリフィルを時系列上で説明する図Diagram explaining the refill of a word (W0, W1, W2, W3) on a line in time series

 以下、図面を用いて本発明の実施の形態について説明する。また、本実施の形態におけるライトバック方式のキャッシュメモリは、ダイレクトマップ方式を採用しており、キャッシュのライトミスヒット時には、ライトアロケート方式(一旦、ライトアクセス対象のアドレスのデータを主記憶からキャッシュメモリのラインに反映させた後、そのラインに対してライトヒット時と同等の書き込み動作を行う方式である。)で処理を行うとして説明する。 Hereinafter, embodiments of the present invention will be described with reference to the drawings. In addition, the write-back cache memory according to the present embodiment employs a direct map method, and in the event of a cache write miss hit, the write allocation method (once the data at the address to be accessed for write access is transferred from the main memory to the cache memory In this method, after the data is reflected on the line, a write operation equivalent to that at the time of a write hit is performed on the line.

 図1は、キャッシュメモリシステム1の構成図である。 FIG. 1 is a configuration diagram of the cache memory system 1.

 キャッシュメモリシステム1は、CPU(中央処理装置:Central Processing Unit)2、主記憶4、キャッシュメモリ6、ライトバッファ8,10、リードバッファ12を含んで構成している。 The cache memory system 1 includes a CPU (Central Processing Unit) 2, a main memory 4, a cache memory 6, write buffers 8 and 10, and a read buffer 12.

 CPU2は、各種演算処理を行う中央処理装置である。 The CPU 2 is a central processing unit that performs various arithmetic processes.

 主記憶4は、DRAMなどデータを一時記憶する揮発性メモリから構成される。 The main memory 4 is composed of a volatile memory that temporarily stores data such as DRAM.

 キャッシュメモリ6は、主記憶4に格納すべきデータを一時的に格納する。主記憶4よりアクセス速度が速く、記憶階層の構造上、上位のCPU2と下位の主記憶4との間に介在している。キャッシュメモリ6はライトバック方式であり、キャッシュミスヒット発生などを契機として保持しているデータを主記憶4へと書き戻す。 The cache memory 6 temporarily stores data to be stored in the main memory 4. The access speed is higher than that of the main memory 4 and is interposed between the upper CPU 2 and the lower main memory 4 due to the structure of the storage hierarchy. The cache memory 6 is a write-back method, and the data held therein is written back to the main memory 4 when a cache miss hit occurs.

 キャッシュメモリ6は、制御部6a、格納部6b、ヒット判定部6c、調停部6dを備える。 The cache memory 6 includes a control unit 6a, a storage unit 6b, a hit determination unit 6c, and an arbitration unit 6d.

 制御部(キャッシュメモリ制御部)6aは、各機能ブロックを制御し、例えば格納部6bに格納されたデータの読み書きやタグの更新を行う。また、ヒット判定部6cのヒット判定結果に応じてCPU2にデータを出力する。 The control unit (cache memory control unit) 6a controls each functional block, for example, reads / writes data stored in the storage unit 6b and updates tags. Further, data is output to the CPU 2 according to the hit determination result of the hit determination unit 6c.

 格納部6bは、データを格納するデータ格納部と、格納されたデータを識別する情報としてのタグを含むタグ格納部とから構成される。 The storage unit 6b includes a data storage unit that stores data, and a tag storage unit that includes a tag as information for identifying the stored data.

 ヒット判定部6cは、CPU2からアクセス要求されたデータが、格納部6bに格納されているかどうかのヒット判定を行う。詳しくは後述する。 The hit determination unit 6c determines whether or not the data requested to be accessed by the CPU 2 is stored in the storage unit 6b. Details will be described later.

 調停部6dは、格納部6b内のデータへのアクセスが競合する場合などに調停する。 The arbitration unit 6d arbitrates when access to data in the storage unit 6b competes.

 図2は、キャッシュメモリ6の構成を示す図である。 FIG. 2 is a diagram showing the configuration of the cache memory 6.

 図2上部のアドレス22は、CPU2がキャッシュメモリ6へとアクセスを試みる際に、CPU2からリード/ライト要求とともに出力されるアドレスを示している。 The address 22 in the upper part of FIG. 2 indicates an address output together with a read / write request from the CPU 2 when the CPU 2 tries to access the cache memory 6.

 アドレス(AD[31:0])22は、32ビットであり、上位16ビット(AD[31:16])をタグアドレスとして、ビット4からビット15の12ビット(AD[15:4])をインデックスアドレスとして、ビット2からビット3の2ビット(AD[3:2])をラインに含まれるワードを特定するワードアドレスとして利用する。なお、インデックスアドレスは12ビットであるので、4096(=2^12)本のラインを指定することができる。このインデックスアドレスによりアクセス対象のラインが一意に特定されることとなる。 Address (AD [31: 0]) 22 is 32 bits, and the upper 16 bits (AD [31:16]) are used as tag addresses, and 12 bits (AD [15: 4]) from bit 4 to bit 15 are used. As an index address, 2 bits (AD [3: 2]) from bit 2 to bit 3 are used as a word address for specifying a word included in the line. Since the index address is 12 bits, 4096 (= 2 ^ 12) lines can be specified. A line to be accessed is uniquely specified by this index address.

 キャッシュメモリ6は、タグ格納部14、データ格納部16、セレクタ18、ヒット判定部20を含む。 The cache memory 6 includes a tag storage unit 14, a data storage unit 16, a selector 18, and a hit determination unit 20.

 タグ格納部14は、データ格納部16における4096本のラインに対応して設けられており、ラインに格納されたデータなどの識別情報を格納している。 The tag storage unit 14 is provided corresponding to 4096 lines in the data storage unit 16, and stores identification information such as data stored in the line.

 具体的には、タグ格納部14は、ラインのデータが有効であるか否かを示すバリッドビット(V)、ラインがリフィル中であるか否かを示すリフィルビット(R)、ラインに格納されたデータの主記憶におけるアドレスを示すタグビット(Tag)を有する。 Specifically, the tag storage unit 14 stores a valid bit (V) indicating whether or not line data is valid, a refill bit (R) indicating whether or not the line is being refilled, and the line. It has a tag bit (Tag) indicating the address of the main data in the main memory.

 これに加えて、タグ格納部14は、ラインに含まれる4つのワード(Word0,Word1,Word2,Word3)に対応してそれぞれ設けられた4つのダーティビット(D0,D1,D2,D3)を含んでいる。ダーティビットがダーティならば、CPU2からのライト動作により更新されたが、主記憶には未だ書き戻されておらず、主記憶のデータとの一致が保証できない状態にあることを意味しているので、適宜、主記憶に書き戻す必要がある。 In addition to this, the tag storage unit 14 includes four dirty bits (D0, D1, D2, D3) respectively provided corresponding to four words (Word0, Word1, Word2, Word3) included in the line. It is out. If the dirty bit is dirty, it has been updated by the write operation from the CPU 2, but it has not yet been written back to the main memory, and it cannot be guaranteed that it matches the data in the main memory. If necessary, it is necessary to write back to the main memory.

 データ格納部16は、4つのワードを1ラインとした4096本のラインを保持している。データ格納部16は、タグ格納部14とは別個のメモリとしてSRAMなどにより構成される。なお、1ワードあたりのサイズは、CPU2からのデータのアクセス幅に対応して32ビットであり、データ格納部16の入出力ポートのビット幅も32ビット(1ワード分)である。 The data storage unit 16 holds 4096 lines with four words as one line. The data storage unit 16 includes an SRAM or the like as a memory separate from the tag storage unit 14. The size per word is 32 bits corresponding to the data access width from the CPU 2, and the bit width of the input / output port of the data storage unit 16 is 32 bits (for one word).

 セレクタ18は、アドレス22の2ビット(AD[3:2])に基づいて、4つのワードのうちの1つのワードを選択する。 The selector 18 selects one word out of four words based on 2 bits (AD [3: 2]) of the address 22.

 ヒット判定部20は、リードかライトを示す信号(Read or Write)、タグアドレス(AD[31:16])、インデックスアドレス(AD[15:4])により特定されたラインのバリッドビット(V)、リフィルビット(R)、4つのワード毎のダーティビット(D0,D1,D2,D3)、上記ラインに格納されたデータのアドレスを示すタグビット(Tag)、4つのワードのうちの1つを特定するワードアドレス(AD[3:2])、の10個の入力に基づいてヒットかミスヒットかを判定する。 The hit determination unit 20 has a valid bit (V) of a line specified by a signal indicating Read or Write (Read or Write), a tag address (AD [31:16]), and an index address (AD [15: 4]). , Refill bit (R), dirty bit (D0, D1, D2, D3) for every four words, tag bit (Tag) indicating the address of the data stored in the above line, one of the four words It is determined whether it is a hit or a miss based on 10 inputs of the specified word address (AD [3: 2]).

 ヒット判定部20の回路構成例を図3に示す。 An example of the circuit configuration of the hit determination unit 20 is shown in FIG.

 ヒット判定部20は、2入力1出力のAND回路23,24,26,28,30、3入力1出力のOR回路32、NOT回路34,36、4入力1出力のセレクタ38、コンパレータ40を備える。 The hit determination unit 20 includes 2-input 1-output AND circuits 23, 24, 26, 28, and 30, a 3-input 1-output OR circuit 32, NOT circuits 34 and 36, a 4-input 1-output selector 38, and a comparator 40. .

 セレクタ38は、2ビット(AD[3:2])の入力に基づいて、D0,D1,D2,D3の4つのうちの1つを選択して出力する。すなわち、ラインに含まれるアクセス対象のワードを特定する入力(AD[3:2])に基づいて、そのワードに対応するダーティビットを出力することとなる。 The selector 38 selects and outputs one of four of D0, D1, D2, and D3 based on a 2-bit (AD [3: 2]) input. That is, based on an input (AD [3: 2]) that specifies an access target word included in the line, a dirty bit corresponding to the word is output.

 コンパレータ40は、タグ格納部14のアクセス対象ラインに保持されているタグビット(Tag)と、タグアドレス(AD[31:16])とを比較し、両者が一致した場合にHIGHを出力する。 The comparator 40 compares the tag bit (Tag) held in the access target line of the tag storage unit 14 with the tag address (AD [31:16]), and outputs HIGH when the two match.

 図4は、図3のヒット判定部20が入力に応じて出力する判定結果を示す表50である。なお、表中”*”のマークは"Don't Care"を意味している。 FIG. 4 is a table 50 showing determination results output by the hit determination unit 20 of FIG. 3 in response to input. In the table, the mark “*” means “Don't Care”.

 ヒット判定部20に入力される値の組み合わせに応じて(a)から(h)までの8つの場合がある。各場合について順に説明する。なお、リフィル中でない(a)、(b)、(d)、(e)、(f)、(h)の場合のヒット判定は基本的には従来と同様である。リフィル中の(c)、(g)の場合が特徴的である。 There are eight cases from (a) to (h) depending on the combination of values input to the hit determination unit 20. Each case will be described in turn. Note that hit determination in cases (a), (b), (d), (e), (f), and (h) that are not being refilled is basically the same as in the prior art. The cases (c) and (g) during refill are characteristic.

 (a)の場合・・・ライトアクセス対象のデータのアドレス22に含まれるタグアドレス(AD[31:16])とタグビット(Tag)とが一致し、リフィル中で無く(R=0)、バリッドビットが有効(V=1)な場合であり、ライトヒットとなる。そして、キャッシュメモリ6は、ワードアドレス(AD[3:2])に示されるワードに書き込み、同時に書き込んだワードに対応するダーティビットをアサートする。 In the case of (a): The tag address (AD [31:16]) included in the address 22 of the write access target data matches the tag bit (Tag), and the refill is not in progress (R = 0). This is a case where the valid bit is valid (V = 1) and a write hit occurs. Then, the cache memory 6 writes to the word indicated by the word address (AD [3: 2]) and asserts a dirty bit corresponding to the simultaneously written word.

 (b)の場合・・・バリッドビットが無効(V=0)であるところだけが(a)と異なる場合であり、V=0でデータが無効であるので、ライトミスヒットとなる。 In the case of (b): Only the place where the valid bit is invalid (V = 0) is different from (a), and since the data is invalid at V = 0, a write miss hit occurs.

 ここで、ライトミスヒットしたデータは、一旦ライトバッファ8に保持し、リフィルの完了を待ってキャッシュメモリ6へと書き込むこととなる。特に本実施の形態では、ライトミスヒットしたデータはキャッシュメモリ6にライトしておく。ライト時には、ライトしたワード毎のダーティビットをダーティに更新し、タグビット(Tag)をライトミスヒットしたアクセスのアドレスに更新する。これに先立って、ライトアクセス対象のラインをリフィルするために、主記憶4へのバスにデータリード要求とアドレスとを出力する。なお、このとき、リードバッファ12に空きが無い場合には、空くまでリード要求の出力を待つか、リードデータが主記憶4から返ってくるよりも以前にリードバッファ12が空くことが確定できるまでリード要求の出力を待つ。 Here, the write miss hit data is temporarily held in the write buffer 8 and written to the cache memory 6 after completion of the refill. In particular, in the present embodiment, the write miss hit data is written in the cache memory 6. At the time of writing, the dirty bit for each written word is updated to dirty, and the tag bit (Tag) is updated to the address of the access that caused the write miss hit. Prior to this, a data read request and an address are output to the bus to the main memory 4 in order to refill the write access target line. At this time, if there is no free space in the read buffer 12, it waits until the read request is output or until it is determined that the read buffer 12 is free before the read data is returned from the main memory 4. Wait for read request output.

 (c)の場合・・・ライトアクセス対象のデータのタグビット(Tag)とタグアドレス(AD[31:16])とが一致し、リフィル中(R=1)の場合であり、ライトヒットとなる。そして、キャッシュメモリ6は、ワードアドレス(AD[3:2])に示されるワードに書き込み、書き込んだワードに対応するダーティビットをアサートする。 In the case of (c): The tag bit (Tag) of the write access target data matches the tag address (AD [31:16]) and refilling is in progress (R = 1). Become. Then, the cache memory 6 writes to the word indicated by the word address (AD [3: 2]) and asserts a dirty bit corresponding to the written word.

 (d)の場合・・・リードアクセス対象のデータのタグビット(Tag)とタグアドレス(AD[31:16])とが一致し、リフィル中で無く(R=0)、バリッドビットが有効(V=1)な場合であり、リードヒットとなる。CPU2はワードアドレス(AD[3:2])に示されるワードのデータを読み出すこととなる。 In the case of (d): The tag bit (Tag) of the data subject to read access matches the tag address (AD [31:16]), not being refilled (R = 0), and the valid bit is valid ( V = 1), which is a read hit. The CPU 2 reads the data of the word indicated by the word address (AD [3: 2]).

 (e)の場合・・・バリッドビットは無効(V=0)であるところだけが(d)と異なる場合であり、V=0でデータが無効であるので、リードミスヒットとなる。 In the case of (e): Only when the valid bit is invalid (V = 0) is different from (d). Since the data is invalid at V = 0, a read miss occurs.

 (f)の場合・・・リードアクセス対象のデータのタグビット(Tag)とタグアドレス(AD[31:16])とが一致し、リフィル中(R=1)であり、ワードアドレス(AD[3:2])に示されるワード(図4ではW0)に対応するダーティビット(図4ではD0)がダーティではない(クリーンである)場合である。この場合は、ミスヒットとなり、キャッシュメモリ6の制御部6aは、リフィル中である旨をCPU2に通知する。CPU2は通知がリフィル中で無くなるまで待機(リフィル完了まで待機)し、リフィル完了後にリードヒットとしてリードヒット時の動作(リフィル済のリードアクセス対象のデータを読み出す)をするか、このミスヒットしたリードアクセスが完了しなくとも進められる後続の処理に移ることとなる。 In the case of (f): The tag bit (Tag) of the read access target data matches the tag address (AD [31:16]), refilling is in progress (R = 1), and the word address (AD [ 3: 2]) is a case where the dirty bit (D0 in FIG. 4) corresponding to the word (W0 in FIG. 4) is not dirty (clean). In this case, a miss hit occurs, and the control unit 6a of the cache memory 6 notifies the CPU 2 that refilling is in progress. The CPU 2 waits until the notification is no longer being refilled (waits until the refill is completed), and performs a read hit operation (reads the refilled read access target data) as a read hit after the refill is completed, or the missed read Even if the access is not completed, the process proceeds to the subsequent process.

 (g)の場合・・・リードアクセス対象のデータのタグビット(Tag)とタグアドレス(AD[31:16])とが一致し、リフィル中(R=1)であり、ワードアドレス(AD[3:2])に示されるワード(図4ではW2)に対応するダーティビット(図4ではD2)がダーティな場合である。この場合は、リードヒットとなり、CPU2は、ワードアドレス(AD[3:2])に示されるワードのデータを読み出す。 In the case of (g): The tag bit (Tag) of the read access target data matches the tag address (AD [31:16]), refilling is in progress (R = 1), and the word address (AD [ 3: 2]) is a case where the dirty bit (D2 in FIG. 4) corresponding to the word (W2 in FIG. 4) is dirty. In this case, a read hit occurs, and the CPU 2 reads the data of the word indicated by the word address (AD [3: 2]).

 (h)の場合・・・タグビット(Tag)とタグアドレス(AD[31:16])とが一致していない場合である。これは、アクセス対象のデータのアドレスとデータ格納部に実際に格納されているデータのアドレスとが異なることを意味するので、他の条件を判断するまでもなく、ライト・リードに関わらずミスヒットとなる。 In the case of (h): This is a case where the tag bit (Tag) and the tag address (AD [31:16]) do not match. This means that the address of the data to be accessed is different from the address of the data that is actually stored in the data storage unit, so it is not necessary to judge other conditions. It becomes.

 以上説明したように、ヒット判定部20は、(g)の場合のように、リフィル中であったとしても、リードアクセス対象のワードに対応するダーティビットがダーティであればリードヒットとして判定するので、従来よりリードヒット率を向上させることができる。 As described above, the hit determination unit 20 determines a read hit if the dirty bit corresponding to the read access target word is dirty even if refilling is in progress as in (g). As a result, the read hit rate can be improved.

 また、ヒット判定部20は、(c)の場合のように、リフィル中であったとしても、ライトヒットとして判定するので、従来よりライトヒット率を向上させることができる。 In addition, since the hit determination unit 20 determines as a write hit even if refilling is in progress as in the case of (c), the write hit rate can be improved as compared with the prior art.

 次に、CPU2、キャッシュメモリ6、主記憶4の処理の流れについて、ライトアクセス時とリードアクセス時を分けて順に説明する。 Next, the processing flow of the CPU 2, cache memory 6, and main memory 4 will be described in order for write access and read access.

 図5は、ライトアクセス時におけるCPU2、キャッシュメモリ6、主記憶4のシーケンス図である。なお、初期状態において、ライトアクセス要求の対象となるラインはリフィル中でない(R=0)として説明する。 FIG. 5 is a sequence diagram of the CPU 2, the cache memory 6, and the main memory 4 at the time of write access. In the initial state, it is assumed that the line that is the target of the write access request is not being refilled (R = 0).

 CPU2からライトアクセス要求を受けたキャッシュメモリ6のヒット判定部20は、前述のようにデータのアドレス(AD[31:0])22のタグアドレス(AD[31:16])とライトアクセス要求の対象となったデータのラインのタグビット(Tag)との比較や、ラインのリフィルビット(R)などに基づいて、ヒット判定を行う。 The hit determination unit 20 of the cache memory 6 that has received the write access request from the CPU 2 and the tag address (AD [31:16]) of the data address (AD [31: 0]) 22 and the write access request as described above. Hit determination is performed based on comparison with the tag bit (Tag) of the line of the target data or the refill bit (R) of the line.

 ライトヒットと判定すれば(S1:Yes)、ライトアクセス要求の対象となるラインのワードにデータを書き込み、必要に応じてそのワードに対応するダーティビットをアサートする(S11)。 If it is determined as a write hit (S1: Yes), data is written to the word of the line that is the target of the write access request, and if necessary, the dirty bit corresponding to the word is asserted (S11).

 ライトミスヒットと判定すれば(S1:No)、CPU2はライトバッファ8に、ライトミスヒットとなったデータとアドレス(AD[31:0])22とを一旦保持させる。これによりCPU2はキャッシュライトの完了を待たずに後続の処理に移ることができるようになっている。なお、ライトバッファ8に保持されたデータとアドレス(AD[31:0])22は、ステップS11のデータ書き込みに用いられることとなる。 If it is determined that it is a write miss hit (S1: No), the CPU 2 causes the write buffer 8 to temporarily hold the data and the address (AD [31: 0]) 22 that have become a write miss hit. As a result, the CPU 2 can proceed to the subsequent processing without waiting for the completion of the cache write. The data and address (AD [31: 0]) 22 held in the write buffer 8 are used for data writing in step S11.

 ライトミスヒットと判定されると(S1:No)、キャッシュメモリ6は、ラインのリフィルビットをアサートし(S2:R=1)、ライトバック処理(S3-S8)に移行する。この時、ライトミスヒットしたライトアクセス要求のタグアドレス(AD[31:16])で、タグビット(Tag)を更新する。 When it is determined as a write miss hit (S1: No), the cache memory 6 asserts the refill bit of the line (S2: R = 1), and proceeds to the write back process (S3-S8). At this time, the tag bits (Tag) are updated with the tag address (AD [31:16]) of the write access request in which a write miss hit occurs.

 ライトバック処理(S3-S8)では、バリッドビットが無効であれば(S3:No,V=0)、ラインが無効であり書き戻すべきデータが無いので処理を終える。 In the write back process (S3-S8), if the valid bit is invalid (S3: No, V = 0), the line is invalid and there is no data to be written back.

 バリッドビットが有効であれば(S3:Yes,V=1)、ライン中のワードにおいて、ワードに対応するダーティビットがダーティ(D=1)なワードだけをライトバッファ10に書き戻す(S4,S5)。書き戻しを終えたワードに対応するダーティビットはクリーン(D=0)にネゲートする(S6)。 If the valid bit is valid (S3: Yes, V = 1), only the word in the line where the dirty bit corresponding to the word is dirty (D = 1) is written back to the write buffer 10 (S4, S5). ). The dirty bit corresponding to the word that has been written back is negated cleanly (D = 0) (S6).

 なお、ライトバッファ10に書き戻されたデータは、バスが空いているときなど適当なタイミングで主記憶4へとさらにライトバックされることとなる。 The data written back to the write buffer 10 is further written back to the main memory 4 at an appropriate timing such as when the bus is free.

 ラインに含まれる4つのワードについてS4からS6までの処理を終えると(S7:Yes)、ラインのバリッドビットを無効化(S8:V=0)する。 When the processing from S4 to S6 is finished for the four words included in the line (S7: Yes), the valid bit of the line is invalidated (S8: V = 0).

 ライトバック処理(S3-S8)を終えると、キャッシュメモリ6は、リフィル・タグ更新を行う(S9)。具体的には、リードバッファ12が主記憶4から読み出し済みのライトアクセス対象のラインのデータを、キャッシュメモリ6のラインに上書きする。 When the write back processing (S3-S8) is completed, the cache memory 6 performs refill / tag update (S9). Specifically, the read buffer 12 overwrites the line of the cache memory 6 with the data of the write access target line that has been read from the main memory 4.

 リードバッファ12が実際に主記憶4からデータを読み出すのには時間を要するが、本実施の形態ではこの間のキャッシュライトアクセスを許し、その際、ライトしたワードのダーティビットがアサートされる。そのため、このリフィルでは、D=0のワードのみが主記憶4からのデータで上書きされることになる。 Although it takes time for the read buffer 12 to actually read data from the main memory 4, in this embodiment, cache write access during this period is allowed, and at that time, the dirty bit of the written word is asserted. Therefore, in this refill, only the word of D = 0 is overwritten with the data from the main memory 4.

 キャッシュメモリ6は、リードバッファ12からの読み込みを完了すると(S9)、ラインを有効化し(S10:V=1)、リフィルビットをネゲート(S10:R=0)して一連のリフィルを終了する。 When the reading from the read buffer 12 is completed (S9), the cache memory 6 validates the line (S10: V = 1), negates the refill bit (S10: R = 0), and ends a series of refills.

 図6は、リードアクセス時におけるCPU2、キャッシュメモリ6、主記憶4のシーケンス図である。なお、初期状態において、リードアクセス要求の対象となるラインはリフィル中でない(R=0)として説明する。 FIG. 6 is a sequence diagram of the CPU 2, the cache memory 6, and the main memory 4 at the time of read access. In the initial state, it is assumed that the line that is the target of the read access request is not being refilled (R = 0).

 CPU2がキャッシュメモリ6にリードアクセスを要求すると(S20)、要求を受けたキャッシュメモリ6はヒット判定部20において前述のヒット判定を行う。 When the CPU 2 requests read access to the cache memory 6 (S20), the cache memory 6 that has received the request performs the hit determination described above in the hit determination unit 20.

 リードヒットと判定すれば(S21:Yes)、CPU2は、リードアクセス要求の対象となるラインのワードからデータを読み出す。 If it is determined as a read hit (S21: Yes), the CPU 2 reads data from the word of the line that is the target of the read access request.

 リードミスヒットと判定すれば(S21:No)、S2からS10までのリフィル処理に移行する。この処理は図5を用いて既に説明したものと同様であるので説明を省略する。 If it is determined as a read miss hit (S21: No), the process proceeds to the refill processing from S2 to S10. Since this process is the same as that already described with reference to FIG.

 次に、キャッシュメモリ6のあるラインがリフィル中の場合に、このライン中のワードへのライト/リードアクセスがあったときの例について説明する。 Next, an example when a line in the cache memory 6 is being refilled and there is a write / read access to a word in this line will be described.

 図7は、あるラインのワード(W0,W1,W2,W3)のリフィルを時系列上で説明する図である。(a)を用いてライトアクセス時の処理について説明し、(b)を用いてリードアクセス時の処理について説明する。 FIG. 7 is a diagram for explaining the refill of words (W0, W1, W2, W3) on a certain line in time series. The process at the time of write access will be described using (a), and the process at the time of read access will be described using (b).

 ライトアクセス時は、図7(a)に示すように、キャッシュメモリ6は、t0→t1→t2→t3→t4の時刻に、それぞれW0→W1→W2→W3の順番でリフィルが完了するものとする。また、リフィル開始時にはリフィルビットをアサートし、リフィルすべき新しいラインのアドレスにラインのタグビット(Tag)を更新する。 At the time of write access, as shown in FIG. 7A, the cache memory 6 completes refilling in the order of W0 → W1 → W2 → W3 at times t0 → t1 → t2 → t3 → t4, respectively. To do. At the start of refill, the refill bit is asserted, and the line tag bit (Tag) is updated to the address of the new line to be refilled.

 本実施の形態においては、リフィル途中にも関わらずライトアクセス要求を受けてデータの上書きを許容するので、ラインのタグビット(Tag)が、現実に上書きしたデータのタグと不一致にならないように、図7(a)に示すように、リフィル開始時にタグを更新する。 In the present embodiment, the write access request is received in the middle of refilling and data overwriting is allowed, so that the tag bit (Tag) of the line does not coincide with the tag of the actually overwritten data. As shown in FIG. 7A, the tag is updated at the start of refilling.

 まず、t0からt2までの間にワードW2へのライトアクセス要求があった場合には、ヒット判定部20は前述のようにライトヒットと判定し、ワードW2へのライトアクセスを受けて対応するダーティビット(D2)をアサートする。その後、t2からt3の間は、ワードW2のダーティビット(D2)がアサートされているので、キャッシュメモリ6は、リフィルによるワードW2への上書きを行わない。 First, if there is a write access request to the word W2 between t0 and t2, the hit determination unit 20 determines that it is a write hit as described above, and receives the write access to the word W2 to receive the corresponding dirty. Assert bit (D2). After that, since the dirty bit (D2) of the word W2 is asserted between t2 and t3, the cache memory 6 does not overwrite the word W2 by refilling.

 なお、上書きを行わない方法としては、例えば、ライトアクセスは行うが、ワードへの書き込みをマスクする信号を利用することが考えられる。また、ワードへのライトアクセス自体を行わずに処理をスキップしてもよい。 Note that, as a method of not overwriting, for example, a write access is performed but a signal for masking writing to a word is used. Further, the processing may be skipped without performing write access to the word itself.

 次に、t2からt3までの間にワードW2へのライトアクセス要求があった場合には、ライトヒットと判定し、ワードW2へのライトアクセスを受けて対応するダーティビット(D2)をアサートする。この場合、ライトアクセス要求時には、ワードW2はリフィルによるライト動作中であるので、キャッシュメモリ6はライト制御を調停して両者の競合を防ぐ。 Next, if there is a write access request to the word W2 between t2 and t3, it is determined as a write hit, and the corresponding dirty bit (D2) is asserted in response to the write access to the word W2. In this case, at the time of a write access request, since the word W2 is being written by refilling, the cache memory 6 arbitrates write control to prevent conflict between them.

 そして、t3からt4までの間にワードW2へのライトアクセス要求があった場合には、ライトヒットと判定し、ワードW2へのライトアクセスを受けて対応するダーティビット(D2)をアサートする。 If there is a write access request to the word W2 between t3 and t4, it is determined as a write hit, and the corresponding dirty bit (D2) is asserted in response to the write access to the word W2.

 リードアクセス時は、図7(b)に示すように、図7(a)同様に、キャッシュメモリ6は、t0→t1→t2→t3→t4の時刻に、それぞれW0→W1→W2→W3の順番でリフィルが完了するものとする。 At the time of read access, as shown in FIG. 7B, as in FIG. 7A, the cache memory 6 is in the order of W0 → W1 → W2 → W3 at time t0 → t1 → t2 → t3 → t4. It is assumed that refilling is completed in order.

 まず、t0からt4までの間にワードW2へのリードアクセス要求があった場合、ワードW2に対応するダーティビットがアサートされているならば、ヒット判定部20は前述のようにリードヒットと判定し、ワードW2へのリードアクセスを受け付ける。 First, if there is a read access request to the word W2 between t0 and t4, if the dirty bit corresponding to the word W2 is asserted, the hit determination unit 20 determines that it is a read hit as described above. , Accepts read access to word W2.

 これに対して、t0からt4までの間にワードW2へのリードアクセス要求があった場合で、ワードW2に対応するダーティビットがアサートされていないならば、ヒット判定部20は前述のようにリードミスヒットと判定すると同時に、リフィル中である旨を出力する。これを受け、CPU2は、このリードアクセスの実行をリフィル完了後まで延期することになる。 On the other hand, if there is a read access request to the word W2 between t0 and t4 and the dirty bit corresponding to the word W2 is not asserted, the hit determination unit 20 reads the read miss as described above. At the same time as determining the hit, the fact that refilling is in progress is output. In response to this, the CPU 2 postpones execution of this read access until after the refill is completed.

 <補足>
 以上、本発明の実施の形態について説明したが、本発明は上記の内容に限定されず、本発明の目的とそれに関連または付随する目的を達成するための各種形態においても実施可能であり、例えば、以下であってもよい。
<Supplement>
As mentioned above, although embodiment of this invention was described, this invention is not limited to said content, It can implement also in the various forms for achieving the objective of this invention, its related or incidental object, for example, It may be the following.

 (1)実施の形態では、ダイレクトマップ方式のキャッシュメモリを例に挙げて説明したが、この方式に限らずフルアソシアティブ方式やセットアソシアティブ方式を採用したキャッシュメモリを用いても構わない。これらの方式の場合には、キャッシュミスヒット時のリフィル対象のラインがダイレクトマップ方式のように一意のラインに決まるのではなく、LRU(Least Recently Used)方式やラウンドロビン方式などのアルゴリズムなどに基づいて行われる点が異なってくる。 (1) In the embodiment, the direct map type cache memory has been described as an example. However, the present invention is not limited to this, and a cache memory adopting a full associative method or a set associative method may be used. In the case of these methods, the line to be refilled at the time of a cache miss hit is not determined as a unique line as in the direct map method, but based on algorithms such as the LRU (Least Recently Used) method and the round robin method Is different.

 また、共有バスを介して複数のキャッシュメモリが下位層の単一のメモリを共有するような共有メモリ型のキャッシュメモリシステムにおいても、ライトバックキャッシュメモリを構成、制御する方法として本発明を適用することができる。 The present invention is also applied as a method for configuring and controlling a write-back cache memory in a shared memory type cache memory system in which a plurality of cache memories share a single lower layer memory via a shared bus. be able to.

 (2)実施の形態では、対応するダーティビットがダーティなワードのみをライトバックする例について説明したが、ダーティワードを含む数ワード、もしくはラインに含まれるワードすべてをライトバックするとしてもよい。また書き戻しの際には、周知の技術のように、ライトバッファ10に積まれたデータが主記憶4に書き戻されるよりも以前に、書き戻されるアドレスのデータが主記憶4から読み出されることが無いようにシステム全体は制御することができる。 (2) In the embodiment, an example in which only a word whose dirty bit is dirty is written back has been described. However, several words including a dirty word or all words included in a line may be written back. At the time of writing back, the data at the address to be written back is read from the main memory 4 before the data accumulated in the write buffer 10 is written back to the main memory 4 as in a known technique. The entire system can be controlled so that there is no.

 (3)実施の形態では、図1に示すように、キャッシュメモリ6の入出力につながるパスにライトバッファ8,10とリードバッファ12を配することで、中央処理装置からキャッシュメモリへのライトアクセス、キャッシュメモリから主記憶へのライトアクセス、主記憶からキャッシュメモリへのライトアクセスが緩衝され、より柔軟なキャッシュメモリ制御が可能となる。 (3) In the embodiment, as shown in FIG. 1, write access from the central processing unit to the cache memory is performed by arranging the write buffers 8 and 10 and the read buffer 12 in the path connected to the input / output of the cache memory 6. The write access from the cache memory to the main memory and the write access from the main memory to the cache memory are buffered, so that more flexible cache memory control is possible.

 (4)実施の形態では、特に詳細を述べなかったが、システム全体へのオーバーヘッドを軽減する別のアプローチも考えられる。具体的には、ライトミスへの対応として、上位層メモリとキャッシュメモリとの間に多機能なライトバッファを配置し、リフィル中のラインへのライトは、上記ライトバッファに一旦行い、以降の該当ラインからのリードはそのライトバッファから読み出す。そして、キャッシュへのリフィルによるデータ書き込み時に、ライトバッファのデータをリフィルデータに上書きするというものである。しかし、この制御は非常に複雑なものとなる。 (4) Although no particular details have been described in the embodiment, another approach for reducing overhead on the entire system is conceivable. Specifically, as a response to a write miss, a multi-functional write buffer is placed between the upper layer memory and the cache memory, and writing to the line being refilled is performed once in the write buffer, and the following Reads from the line are read from the write buffer. Then, when data is written by refilling to the cache, the refill data is overwritten with the data in the write buffer. However, this control is very complicated.

 これに対して、実施の形態では、ヒット判定部20のヒット判定という簡単な制御を通してシステム全体へのオーバーヘッドを軽減することが可能となる。 On the other hand, in the embodiment, it is possible to reduce overhead to the entire system through simple control of hit determination of the hit determination unit 20.

 (5)階層メモリシステムとして、中央処理装置、キャッシュメモリ、主記憶の構成を例示したが、さらに深い階層構成のメモリシステムのキャッシュメモリとしてもよい。例えば、キャッシュメモリが、1次キャッシュメモリと2次キャッシュメモリとから構成される場合がある。この場合、本実施の形態を、1次キャッシュメモリに適用してもよいし、2次キャッシュメモリに適用してもよい。 (5) Although the configuration of the central processing unit, the cache memory, and the main memory is exemplified as the hierarchical memory system, the cache memory may be a deeper hierarchical memory system. For example, the cache memory may be composed of a primary cache memory and a secondary cache memory. In this case, the present embodiment may be applied to a primary cache memory or a secondary cache memory.

 本発明のキャッシュメモリは、一般的な半導体回路内部に存在するキャッシュメモリとして利用でき、キャッシュヒット率を向上できるので有用である。 The cache memory of the present invention is useful because it can be used as a cache memory existing in a general semiconductor circuit and can improve the cache hit rate.

 1 キャッシュメモリシステム
 2 CPU
 4 主記憶
 6 キャッシュメモリ
 8 ライトバッファ
 10 ライトバッファ
 12 リードバッファ
 14 タグ格納部
 20 ヒット判定部
 22 アドレス
1 cache memory system 2 CPU
4 Main memory 6 Cache memory 8 Write buffer 10 Write buffer 12 Read buffer 14 Tag storage unit 20 Hit determination unit 22 Address

Claims (4)

 それぞれ複数のワードを含む複数のラインと、
  前記ラインに格納されたデータの主記憶におけるアドレスを示すタグと、
  前記ライン毎にラインがリフィル中であるか否かを示すリフィルビットと、
  前記ワード毎にワードにおけるデータがダーティであるか否かを示すダーティビットと
を格納するタグ格納部と、
 キャッシュアクセス対象であるタグアドレスと、前記タグに示されるアドレスが一致するラインのリフィルビットがリフィル中を示している場合、
  前記キャッシュアクセスがライトアクセスであるときは、当該ライトアクセスをライトヒットと判定し、
  前記キャッシュアクセスがリードアクセスであるときは、リードアクセス対象に係るラインに含まれるワードに対応するダーティビットがダーティを示していれば、当該リードアクセスをリードヒットと判定する
ヒット判定部を備える
ことを特徴とするキャッシュメモリ。
Multiple lines, each containing multiple words,
A tag indicating an address in the main memory of data stored in the line;
A refill bit indicating whether the line is being refilled for each line;
A tag storage unit for storing a dirty bit indicating whether or not the data in the word is dirty for each word;
When the refill bit of the line where the tag address that is the cache access target matches the address indicated in the tag indicates that refilling is in progress,
When the cache access is a write access, the write access is determined as a write hit,
When the cache access is a read access, if the dirty bit corresponding to the word included in the line related to the read access indicates dirty, a hit determination unit is provided that determines the read access as a read hit. Characteristic cache memory.
 前記ヒット判定部は、前記リードアクセス対象に係るラインに含まれるワードに対応するダーティビットがダーティを示していなければ、当該ワードを含むラインのリフィル終了まで当該ワードへのリードアクセスを許可しないことを特徴とする請求項1に記載のキャッシュメモリ。 If the dirty bit corresponding to the word included in the line related to the read access target does not indicate dirty, the hit determination unit does not permit read access to the word until the refill of the line including the word ends. The cache memory according to claim 1, wherein:  前記ヒット判定部により、ライトヒットと判定された場合に、前記ライトアクセスに係るワードへの書き込みでは、当該ワードに対応するダーティビットをアサートし、
ラインのリフィルに際して、
  ダーティビットがダーティであることを示さないワードに対してはデータの上書きを許可し、
  ダーティビットがダーティであることを示すワードに対してはデータの上書きを禁止する制御部を備える
ことを特徴とする請求項1に記載のキャッシュメモリ。
When the hit determination unit determines that the write hit occurs, in writing to the word related to the write access, assert a dirty bit corresponding to the word,
When refilling a line
Data overwriting is allowed for words that do not indicate that the dirty bit is dirty,
The cache memory according to claim 1, further comprising a control unit that prohibits overwriting of data with respect to a word indicating that the dirty bit is dirty.
 中央処理装置と、
 請求項1に記載のキャッシュメモリと、
 前記中央処理装置と前記キャッシュメモリと記憶階層において間の階層に位置し、前記中央処理装置が前記キャッシュメモリへとライトすべきデータを保持する第1ライトバッファと、
 前記キャッシュメモリとライトバック対象となるメモリと記憶階層において間の階層に位置し、前記キャッシュメモリから前記ライトバック対象となるメモリへとライトバックすべきデータを保持する第2ライトバッファと、
 前記キャッシュメモリと前記ライトバック対象となるメモリと記憶階層において間の階層に位置し、前記キャッシュメモリがリードすべきデータを保持するリードバッファと
を備えることを特徴とするキャッシュメモリシステム。
A central processing unit;
The cache memory according to claim 1;
A first write buffer located in a hierarchy between the central processing unit and the cache memory and the storage hierarchy, and holding data to be written to the cache memory by the central processing unit;
A second write buffer located in a hierarchy between the cache memory and the memory to be written back and the storage hierarchy, and holding data to be written back from the cache memory to the memory to be written back;
A cache memory system comprising: a read buffer that is located in a hierarchy between the cache memory, the memory to be written back, and a storage hierarchy and holds data to be read by the cache memory.
PCT/JP2009/004105 2008-09-09 2009-08-26 Cache memory and cache memory system Ceased WO2010029694A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2008-231461 2008-09-09
JP2008231461A JP2011248389A (en) 2008-09-09 2008-09-09 Cache memory and cache memory system

Publications (1)

Publication Number Publication Date
WO2010029694A1 true WO2010029694A1 (en) 2010-03-18

Family

ID=42004960

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2009/004105 Ceased WO2010029694A1 (en) 2008-09-09 2009-08-26 Cache memory and cache memory system

Country Status (2)

Country Link
JP (1) JP2011248389A (en)
WO (1) WO2010029694A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012014318A (en) * 2010-06-30 2012-01-19 Nec Corp Cache control device and cache control method
JP2015535631A (en) * 2012-11-28 2015-12-14 クゥアルコム・インコーポレイテッドQualcomm Incorporated Memory management using dynamically allocated dirty mask space
CN114398298A (en) * 2022-01-18 2022-04-26 中国人民解放军国防科技大学 Cache pipeline processing method and device
CN115809028A (en) * 2023-01-19 2023-03-17 北京象帝先计算技术有限公司 Cache data replacement method and device, graphic processing system and electronic equipment
CN116126242A (en) * 2023-01-16 2023-05-16 苏州国芯科技股份有限公司 Data writing method, device, equipment and medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101474842B1 (en) * 2013-05-16 2014-12-19 이화여자대학교 산학협력단 Method for replacing cache memory blocks with for lower amount of write traffic and information processing apparatus having cache subsystem using the same

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02188849A (en) * 1989-01-18 1990-07-24 Agency Of Ind Science & Technol Cache memory system
JPH07234819A (en) * 1993-12-27 1995-09-05 Matsushita Electric Ind Co Ltd Cache memory
JP2003059265A (en) * 2001-08-08 2003-02-28 Hitachi Ltd Semiconductor device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02188849A (en) * 1989-01-18 1990-07-24 Agency Of Ind Science & Technol Cache memory system
JPH07234819A (en) * 1993-12-27 1995-09-05 Matsushita Electric Ind Co Ltd Cache memory
JP2003059265A (en) * 2001-08-08 2003-02-28 Hitachi Ltd Semiconductor device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012014318A (en) * 2010-06-30 2012-01-19 Nec Corp Cache control device and cache control method
JP2015535631A (en) * 2012-11-28 2015-12-14 クゥアルコム・インコーポレイテッドQualcomm Incorporated Memory management using dynamically allocated dirty mask space
CN114398298A (en) * 2022-01-18 2022-04-26 中国人民解放军国防科技大学 Cache pipeline processing method and device
CN116126242A (en) * 2023-01-16 2023-05-16 苏州国芯科技股份有限公司 Data writing method, device, equipment and medium
CN115809028A (en) * 2023-01-19 2023-03-17 北京象帝先计算技术有限公司 Cache data replacement method and device, graphic processing system and electronic equipment

Also Published As

Publication number Publication date
JP2011248389A (en) 2011-12-08

Similar Documents

Publication Publication Date Title
CN110226157B (en) Dynamic memory remapping for reducing line buffer conflicts
TW508575B (en) CLFLUSH micro-architectural implementation method and system
TWI522802B (en) Apparatus and method for ensuring data coherency within a cache memory hierarchy of a microprocessor
CN110209599B (en) Coherency Manager
US20110173400A1 (en) Buffer memory device, memory system, and data transfer method
US8683140B2 (en) Cache-based speculation of stores following synchronizing operations
US20110173393A1 (en) Cache memory, memory system, and control method therefor
US6564301B1 (en) Management of caches in a data processing apparatus
US20100293420A1 (en) Cache coherent support for flash in a memory hierarchy
US20030056062A1 (en) Preemptive write back controller
US20090249106A1 (en) Automatic Wakeup Handling on Access in Shared Memory Controller
JP2000250813A (en) Data managing method for i/o cache memory
US20160314069A1 (en) Non-Temporal Write Combining Using Cache Resources
CN113924558A (en) Memory pipeline control in a hierarchical memory system
CN100481026C (en) Cache memory, system and data storage method
WO2010029694A1 (en) Cache memory and cache memory system
CN101617298B (en) Cache coherency maintenance for DMA, task termination and synchronisation operations
US7434007B2 (en) Management of cache memories in a data processing apparatus
US20110167223A1 (en) Buffer memory device, memory system, and data reading method
US20170116126A1 (en) Coherence de-coupling buffer
US7757044B2 (en) Facilitating store reordering through cacheline marking
JP2012043031A (en) Shared cache memory device
CN111480151A (en) flush cache line from shared memory page to memory
KR20160080385A (en) Miss handling module for cache of multi bank memory and miss handling method
CN116150047A (en) technique for operating a cache storage device to cache data associated with a memory address

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 09812843

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

NENP Non-entry into the national phase

Ref country code: JP

122 Ep: pct application non-entry in european phase

Ref document number: 09812843

Country of ref document: EP

Kind code of ref document: A1