JP2005301387A - Cache memory controller and cache memory control method - Google Patents

Cache memory controller and cache memory control method Download PDF

Info

Publication number
JP2005301387A
JP2005301387A JP2004112768A JP2004112768A JP2005301387A JP 2005301387 A JP2005301387 A JP 2005301387A JP 2004112768 A JP2004112768 A JP 2004112768A JP 2004112768 A JP2004112768 A JP 2004112768A JP 2005301387 A JP2005301387 A JP 2005301387A
Authority
JP
Japan
Prior art keywords
replacement
address
entry
tag
bit
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
JP2004112768A
Other languages
Japanese (ja)
Inventor
Hideki Hirai
秀樹 平井
Jiro Miyake
二郎 三宅
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 Holdings Corp
Original Assignee
Matsushita Electric Industrial 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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP2004112768A priority Critical patent/JP2005301387A/en
Publication of JP2005301387A publication Critical patent/JP2005301387A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To solve the problem that data in a cache memory can not be completely protected from replacement in a conventional cache memory replacement system. <P>SOLUTION: Each memory of a tag memory is provided with a replacement protection bit L(replacement protection bit) indicating that it is a replacement protection status, and the address region of data to be protected from replacement is designated. When the data in the address region are written in a cache memory according to cache mistake, the replacement protection bit L of the write entry is set as a valid value. When a replacement object way is selected according to the cache mistake according to following access to any region other than the address region, the way of the entry whose replacement protection bit L is valid is prevented from being selected so that the data on the cache memory can be protected from being replaced. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

本発明は、キャッシュメモリ制御装置およびその制御方法にかかわり、特に、高速処理を行う必要があるデータのキャッシュのヒット率を上げるために、キャッシュのリプレースを制御するようにした技術に関する。   The present invention relates to a cache memory control apparatus and a control method therefor, and more particularly to a technique for controlling cache replacement in order to increase a cache hit rate of data that needs to be processed at high speed.

キャッシュメモリは、メインメモリへのアクセスを高速化し、CPU(中央演算処理装置)等の動作性能を決めるアクセス速度が高速な一時記憶装置として一般的に使用されている。   The cache memory is generally used as a temporary storage device that speeds up access to the main memory and has a high access speed that determines operation performance of a CPU (Central Processing Unit) or the like.

キャッシュメモリの記憶容量は、メインメモリの記憶容量に比べてかなり小さいのが普通である。キャッシュメモリの任意のエントリに保持されているデータは、キャッシュメモリの利用状況によって破棄され、そのエントリに新しいデータのリプレース(置き換え)が必要となる。複数ウェイで構成されるキャッシュメモリでは、リプレースすべきエントリのウェイを決定する方式として、LRU(Least Recently Used)方式、FIFO(First-In First-Out)方式、ランダム方式などがある。   The storage capacity of the cache memory is usually considerably smaller than the storage capacity of the main memory. Data held in an arbitrary entry in the cache memory is discarded depending on the usage state of the cache memory, and replacement (replacement) of new data is required for the entry. In a cache memory composed of a plurality of ways, there are a LRU (Least Recently Used) method, a FIFO (First-In First-Out) method, a random method, and the like as methods for determining the way of an entry to be replaced.

2ウェイ構成のキャッシュメモリにおいて、図4のようなメインプログラムの“Loop”ラベルと“Loop”ラベルへの条件分岐命令により3つのサブルーチンが繰り返しコールされる場合を説明する。ここでは、3つのサブルーチン1〜3は、キャッシュメモリ上では同じエントリを使用するアドレスにマッピングされているものとする。サブルーチン1〜3が逐次コールされ実行されると、キャッシュのウェイが2つしかないので、サブルーチン1とサブルーチン2は2つのウェイのそれぞれに格納される。そして、サブルーチン3を実行する場合、サブルーチン1かサブルーチン2のいずれかを破棄してサブルーチン3を格納する必要がある。LRU方式やFIFO方式では、サブルーチン1がリプレースされる。次にサブルーチン1がコールされると、サブルーチン1はキャッシュメモリには存在しないのでキャッシュミスとなり、サブルーチン2がリプレースされる。   A case will be described where three subroutines are repeatedly called by a conditional branch instruction to the “Loop” label and “Loop” label of the main program as shown in FIG. Here, it is assumed that the three subroutines 1 to 3 are mapped to addresses using the same entry on the cache memory. When subroutines 1 to 3 are sequentially called and executed, there are only two cache ways, so subroutine 1 and subroutine 2 are stored in each of the two ways. When executing the subroutine 3, it is necessary to discard either the subroutine 1 or the subroutine 2 and store the subroutine 3. In the LRU method and the FIFO method, subroutine 1 is replaced. Next, when subroutine 1 is called, subroutine 1 does not exist in the cache memory, so a cache miss occurs, and subroutine 2 is replaced.

このように従来のキャッシュメモリではキャッシュミスが多発し、性能低下を生じるという問題がある。   As described above, the conventional cache memory has a problem that cache misses frequently occur and performance is deteriorated.

さらに、特定のサブルーチンを高速実行したい場合でも、キャッシュヒットはアクセスのアドレスの順番などに依存するため予測ができず、高速実行の保証が困難であるという問題がある。   Furthermore, even when a specific subroutine is desired to be executed at high speed, the cache hit depends on the order of access addresses and so cannot be predicted, and it is difficult to guarantee high speed execution.

特許文献1に記載された発明では、キャッシュミスによるリプレース動作を行うときに、リプレース優先順位レジスタに設定されているリプレース優先順位をタグメモリのエントリに格納する。そして、以降のキャッシュミスによるリプレース動作時に、リプレースを行うエントリを選択するが、このときリプレースから優先的に保護する機能を任意のアドレス領域に対して実現する。これにより、前述のようなキャッシュメモリの利用効率低下の問題を改善している。
特開平10-198604号公報(第3−6頁、第1,4図)
In the invention described in Patent Document 1, when a replace operation due to a cache miss is performed, the replace priority set in the replace priority register is stored in the entry of the tag memory. In the subsequent replacement operation due to a cache miss, an entry to be replaced is selected. At this time, a function of preferentially protecting from replacement is realized for an arbitrary address area. As a result, the above-described problem of a decrease in utilization efficiency of the cache memory is improved.
JP-A-10-198604 (pages 3-6, FIGS. 1 and 4)

しかしながら、特許文献1に記載された発明では、あくまでもリプレース優先度が設定されるだけで、特定の命令やデータをリプレースしないようにするものではない。そのため、ある期間、キャッシュメモリに確実に保持しておきたい命令やデータをリプレース動作から確実に保護することができないという問題点がある。   However, the invention described in Patent Document 1 merely sets a replacement priority, and does not prevent a specific instruction or data from being replaced. For this reason, there is a problem that it is impossible to reliably protect an instruction or data that is to be reliably held in the cache memory for a certain period from the replacement operation.

さらに、キャッシュメモリに特定の命令やデータを保持して高速実行を行う必要性が動的に変化する場合に、効率良く対応できないという問題がある。   Furthermore, there is a problem that it is not possible to efficiently cope with the need for high-speed execution by holding a specific instruction or data in the cache memory dynamically.

本発明は、上記の課題を解決するために次のような手段を講じる。   The present invention takes the following means in order to solve the above problems.

本発明における第1のキャッシュメモリ制御装置は、複数ウェイで構成されるキャッシュメモリにおいて、
有効ビットとリプレース保護ビットとタグアドレスを保持するエントリを複数備えるタグメモリと、
前記タグメモリのエントリに対応したデータを保持するデータメモリと、
前記タグメモリから出力される前記タグアドレスとアクセス要求アドレスとの比較および前記有効ビットの値に基づいてキャッシュヒットを検出するキャッシュヒット検出手段と、
リプレース保護対象のアドレス領域と前記アクセス要求アドレスとを比較して、一致するときにロック領域ヒット信号を出力するロック領域判定手段と、
前記タグメモリが保持する前記有効ビットの値と前記リプレース保護ビットの値を入力とし、リプレース対象ウェイを選択するリプレース制御手段とを備え、
前記タグメモリは、前記ロック領域ヒット信号に応じて該当する前記エントリの前記リプレース保護ビットを有効にし、
前記リプレース制御手段は、前記リプレース保護ビットが有効でないエントリを優先的にリプレース対象として選択することを特徴とする。
The first cache memory control device according to the present invention is a cache memory composed of a plurality of ways.
A tag memory having a plurality of entries holding valid bits, replacement protection bits, and tag addresses;
A data memory for holding data corresponding to the entry of the tag memory;
A cache hit detection means for detecting a cache hit based on a comparison between the tag address output from the tag memory and an access request address and a value of the valid bit;
A lock area determination unit that compares the address area to be replaced with the access request address and outputs a lock area hit signal when they match,
A replacement control means for selecting the way to be replaced, using the value of the effective bit held by the tag memory and the value of the replacement protection bit as inputs; and
The tag memory enables the replace protection bit of the entry corresponding to the lock area hit signal,
The replacement control means preferentially selects an entry for which the replacement protection bit is not valid as a replacement target.

この構成によれば、リプレース保護を必要とするアドレス領域をあらかじめ指定しておく。そして、指定したアドレス領域のデータをキャッシュメモリへ格納するときにリプレース保護ビットを有効にする。これにより、このアドレス領域のデータを以降のリプレース動作から確実に保護することができ、指定した領域を高速にアクセスすることができる。   According to this configuration, an address area requiring replacement protection is designated in advance. Then, the replace protection bit is validated when data in the designated address area is stored in the cache memory. As a result, the data in this address area can be reliably protected from the subsequent replacement operation, and the designated area can be accessed at high speed.

なお、上記構成において、前記ロック領域判定手段としては、前記リプレース保護対象のアドレス領域を指定するアドレス領域指定手段と、前記アドレス領域指定手段が保持する値と前記アクセス要求アドレスを比較する比較手段とを備えた構成が好ましい。   In the above configuration, the lock area determination unit includes an address area designating unit that designates the address area to be replaced, and a comparison unit that compares the access request address with a value held by the address area designating unit. The structure provided with is preferable.

また、上記構成において、前記タグメモリがさらにリプレース保護をソフトウェアにより制御可能なリプレース保護許可ビットを備え、前記リプレース制御手段は、前記リプレース保護許可ビットに基づいて有効となっているリプレース保護の無効化を行うように構成することも好ましい。   In the above configuration, the tag memory further includes a replacement protection permission bit capable of controlling replacement protection by software, and the replacement control means invalidates the replacement protection that is enabled based on the replacement protection permission bit. It is also preferable to perform the configuration.

ところで、上記第1のキャッシュメモリ制御装置では、リプレースから保護したい領域へのアクセス頻度がプログラムの実行時の状態で変わる場合の問題がある。すなわち、リプレース保護対象のアドレス領域に該当するデータをキャッシュメモリに格納しているときに、リプレース保護対象のアドレス領域へのアクセス頻度がプログラムの実行時の状態で変われば、リプレース保護の有効/無効の切り替えをプログラムで制御するのが困難になったり、状態を判定するためにプログラムが増大する。この課題を含めて解決するのが、次に述べる第2のキャッシュメモリ制御装置である。   By the way, the first cache memory control device has a problem in that the access frequency to the area to be protected from replacement changes depending on the state at the time of execution of the program. In other words, when data corresponding to the address area subject to replacement protection is stored in the cache memory, if the access frequency to the address area subject to replacement protection changes depending on the state at the time of execution of the program, the replacement protection is enabled / disabled. It becomes difficult to control the switching by a program, or the program increases to determine the state. The second cache memory control device described below solves this problem.

本発明における第2のキャッシュメモリ制御装置は、複数ウェイで構成されるキャッシュメモリにおいて、
有効ビットとリプレース保護ビットとタグアドレスを保持するエントリを複数備えるタグメモリと、
前記タグメモリのエントリに対応したデータを保持するデータメモリと、
前記タグメモリから出力される前記タグアドレスとアクセス要求アドレスとの比較および前記有効ビットの値に基づいてキャッシュヒットを検出するキャッシュヒット検出手段と、
リプレース保護対象のアドレス領域と前記アクセス要求アドレスとを比較して、一致するときにロック領域ヒット信号を出力するロック領域判定手段と、
前記ロック領域判定手段が出力する前記ロック領域ヒット信号によりリプレース保護対象のアドレス領域へのアクセス頻度を評価し、前記アクセス頻度の低下を検出したときにアクセス頻度低下信号を出力するアクセス頻度評価手段と、
前記タグメモリが保持する前記有効ビットの値と前記リプレース保護ビットの値と前記アクセス頻度評価手段が出力する前記アクセス頻度低下信号を入力とし、リプレース対象ウェイを選択するリプレース制御手段とを備え、
前記タグメモリは、前記ロック領域ヒット信号に応じて該当する前記エントリの前記リプレース保護ビットを有効にし、
前記リプレース制御手段は、前記アクセス頻度低下信号が有効な場合はリプレース保護を無効化してリプレース対象エントリを選択し、前記アクセス頻度低下信号が無効な場合は前記リプレース保護ビットが有効でないエントリを優先的にリプレース対象として選択することを特徴とするものである。
The second cache memory control device according to the present invention is a cache memory composed of a plurality of ways.
A tag memory having a plurality of entries holding valid bits, replacement protection bits, and tag addresses;
A data memory for holding data corresponding to the entry of the tag memory;
A cache hit detection means for detecting a cache hit based on a comparison between the tag address output from the tag memory and an access request address and a value of the valid bit;
A lock area determination unit that compares the address area to be replaced with the access request address and outputs a lock area hit signal when they match,
An access frequency evaluation unit that evaluates the access frequency to the address area to be replaced by the lock area hit signal output from the lock area determination unit and outputs an access frequency decrease signal when the decrease in the access frequency is detected; ,
A replacement control means for selecting a replacement target way with the value of the effective bit held by the tag memory, the value of the replacement protection bit, and the access frequency lowering signal output by the access frequency evaluation means as inputs;
The tag memory enables the replace protection bit of the entry corresponding to the lock area hit signal,
When the access frequency lowering signal is valid, the replacement control unit invalidates the replacement protection and selects a replacement target entry, and when the access frequency lowering signal is invalid, the replacement control unit preferentially selects an entry whose replacement protection bit is not valid. And selecting a replacement target.

この構成によれば、リプレース保護対象のアドレス領域へのアクセス頻度がプログラムの実行時の状態で変わり、保護対象から外れる状況になった場合には、リプレース保護の無効化を自動的にかつプログラムの増大を招かずに実現でき、キャッシュメモリのさらなる効率的な利用が可能となる。   According to this configuration, when the frequency of access to the address area targeted for replacement changes depending on the state at the time of execution of the program and the situation falls outside the protection target, the replacement protection is automatically disabled and the program is disabled. This can be realized without causing an increase, and the cache memory can be used more efficiently.

上記構成において、前記ロック領域判定手段としては、前記リプレース保護対象のアドレス領域を指定するアドレス領域指定手段と、前記アドレス領域指定手段が保持する値と前記アクセス要求アドレスを比較する比較手段とを備えた構成が好ましい。   In the above configuration, the lock area determination unit includes an address area designating unit that designates the replacement-protected address area, and a comparison unit that compares the access request address with a value held by the address area designating unit. The configuration is preferable.

また、上記構成において、さらに、前記有効ビットと前記リプレース保護ビットの両方が有効な値を持つすべてのエントリの前記有効ビットを無効化するエントリ無効手段を備え、前記リプレース制御手段は、前記アクセス頻度低下信号が有効になったときに前記タグメモリの前記エントリ無効手段を動作させるように構成されていることも好ましい。   Further, in the above configuration, the system further comprises entry invalidating means for invalidating the valid bits of all entries in which both the valid bits and the replacement protection bits have valid values, and the replacement control means includes the access frequency. It is also preferable that the entry invalidating means of the tag memory is operated when the lowering signal becomes valid.

ところで、上記第2のキャッシュメモリ制御装置では、ロック領域判定手段が1つであれば、リプレース保護領域が1つの連続したものではなく、間にリプレース保護が不要の領域を挟んで分断されたものである場合に、リプレース保護に際して、リプレース保護が不要の領域も含んで保護してしまい、リプレース保護の負担が増大する。この課題を含めて解決するのが、次に述べる第3のキャッシュメモリ制御装置である。   By the way, in the second cache memory control device, if there is one lock area determination means, the replacement protection area is not one continuous one, but is divided with an area that does not require replacement protection in between. In such a case, in the replacement protection, the protection including the area where the replacement protection is unnecessary is included, and the burden of the replacement protection increases. The third cache memory control device described below solves this problem.

本発明における第3のキャッシュメモリ制御装置は、複数ウェイで構成されるキャッシュメモリにおいて、
有効ビットとリプレース保護ビットとタグアドレスを保持するエントリを複数備えるタグメモリと、
前記タグメモリのエントリに対応したデータを保持するデータメモリと、
前記タグメモリから出力される前記タグアドレスとアクセス要求アドレスとの比較および前記有効ビットの値に基づいてキャッシュヒットを検出するキャッシュヒット検出手段と、
リプレース保護対象のアドレス領域と前記アクセス要求アドレスとを比較して、一致するときにロック領域ヒット信号を出力する複数のロック領域判定手段と、
前記ロック領域判定手段が出力する前記ロック領域ヒット信号によりリプレース保護対象のアドレス領域へのアクセス頻度を評価し、前記アクセス頻度の低下を検出したときにアクセス頻度低下信号を出力するアクセス頻度評価手段と、
前記タグメモリが保持する前記有効ビットの値と前記リプレース保護ビットの値と前記アクセス頻度評価手段が出力する前記アクセス頻度低下信号を入力とし、リプレース対象ウェイを選択するリプレース制御手段とを備え、
複数の前記ロック領域判定手段で複数のアドレス領域にリプレース保護を設定し、
前記タグメモリは、前記ロック領域ヒット信号に応じて該当する前記エントリの前記リプレース保護ビットを有効にし、
前記リプレース制御手段は、前記アクセス頻度低下信号が有効な場合はリプレース保護を無効化してリプレース対象エントリを選択し、前記アクセス頻度低下信号が無効な場合は前記リプレース保護ビットが有効でないエントリを優先的にリプレース対象として選択することを特徴とするものである。
The third cache memory control device according to the present invention is a cache memory composed of a plurality of ways.
A tag memory having a plurality of entries holding valid bits, replacement protection bits, and tag addresses;
A data memory for holding data corresponding to the entry of the tag memory;
A cache hit detection means for detecting a cache hit based on a comparison between the tag address output from the tag memory and an access request address and a value of the valid bit;
A plurality of lock area determination means for comparing the address area to be replaced with the access request address and outputting a lock area hit signal when they match;
An access frequency evaluation unit that evaluates the access frequency to the address area to be replaced by the lock area hit signal output from the lock area determination unit and outputs an access frequency decrease signal when the decrease in the access frequency is detected; ,
A replacement control means for selecting a replacement target way with the value of the effective bit held by the tag memory, the value of the replacement protection bit, and the access frequency lowering signal output by the access frequency evaluation means as inputs;
Set replacement protection for a plurality of address areas by a plurality of the lock area determination means,
The tag memory enables the replace protection bit of the entry corresponding to the lock area hit signal,
When the access frequency lowering signal is valid, the replacement control unit invalidates the replacement protection and selects a replacement target entry, and when the access frequency lowering signal is invalid, the replacement control unit preferentially selects an entry whose replacement protection bit is not valid. And selecting a replacement target.

ここでの技術的特徴は、ロック領域判定手段を複数備え、複数のリプレース保護領域を個別的に設定するということである。   The technical feature here is that a plurality of lock area determination means are provided, and a plurality of replacement protection areas are individually set.

この構成によれば、ロック領域判定手段を複数使用することにより、リプレース保護を行う領域を複数設定することが可能となり、効果的なリプレース保護を実現できる。   According to this configuration, by using a plurality of lock area determination means, it is possible to set a plurality of areas to be subjected to replacement protection, thereby realizing effective replacement protection.

ところで、上記第3のキャッシュメモリ制御装置では、複数のアドレス領域をリプレース保護に指定できるが、アクセス頻度評価手段とタグメモリのリプレース保護ビットを複数のロック領域判定手段が共有するため、ロック領域判定手段ごとにリプレース保護の設定/解除ができない。この課題を含めて解決するのが、次に述べる第4のキャッシュメモリ制御装置である。   By the way, in the third cache memory control device, a plurality of address areas can be designated for replacement protection. However, since the access frequency evaluation means and the replacement protection bits of the tag memory are shared by the plurality of lock area determination means, the lock area determination The replacement protection cannot be set / released for each means. The fourth cache memory control device described below solves this problem.

本発明における第4のキャッシュメモリ制御装置は、複数ウェイで構成されるキャッシュメモリにおいて、
有効ビットと複数のリプレース保護ビットとタグアドレスを保持するエントリを複数備えるタグメモリと、
前記タグメモリのエントリに対応したデータを保持するデータメモリと、
前記タグメモリから出力される前記タグアドレスとアクセス要求アドレスとの比較および前記有効ビットの値に基づいてキャッシュヒットを検出するキャッシュヒット検出手段と、
リプレース保護対象のアドレス領域と前記アクセス要求アドレスとを比較して、一致するときにロック領域ヒット信号を出力する複数のロック領域判定手段と、
前記ロック領域判定手段が出力する前記ロック領域ヒット信号によりリプレース保護対象のアドレス領域へのアクセス頻度を評価し、前記アクセス頻度の低下を検出したときにアクセス頻度低下信号を出力する複数のアクセス頻度評価手段と、
前記タグメモリが保持する前記有効ビットの値と複数の前記リプレース保護ビットの値と複数の前記アクセス頻度評価手段が出力する前記アクセス頻度低下信号を入力とし、リプレース対象ウェイを選択するリプレース制御手段とを備え、
複数の前記ロック領域判定手段で複数のアドレス領域にリプレース保護を設定し、
前記タグメモリは、複数の前記ロック領域ヒット信号に応じて該当する前記エントリの前記ロック領域ヒット信号に対応する前記リプレース保護ビットを有効にし、
前記リプレース制御手段は、前記アクセス頻度低下信号が有効な場合はリプレース保護を無効化してリプレース対象エントリを選択し、前記アクセス頻度低下信号が無効な場合は前記リプレース保護ビットが有効でないエントリを優先的にリプレース対象として選択することを特徴とするものである。
The fourth cache memory control device according to the present invention is a cache memory composed of a plurality of ways.
A tag memory having a plurality of entries holding valid bits, a plurality of replacement protection bits, and a tag address;
A data memory for holding data corresponding to the entry of the tag memory;
A cache hit detection means for detecting a cache hit based on a comparison between the tag address output from the tag memory and an access request address and a value of the valid bit;
A plurality of lock area determination means for comparing the address area to be replaced with the access request address and outputting a lock area hit signal when they match;
A plurality of access frequency evaluations that evaluate the access frequency to the address area to be replaced by the lock area hit signal output by the lock area determination means and output an access frequency decrease signal when the access frequency decrease is detected Means,
A replacement control means for selecting a replacement target way by inputting the value of the effective bit held in the tag memory, the values of the plurality of replacement protection bits, and the access frequency decrease signal output by the plurality of access frequency evaluation means; With
Set replacement protection for a plurality of address areas by a plurality of the lock area determination means,
The tag memory enables the replace protection bit corresponding to the lock area hit signal of the entry corresponding to a plurality of the lock area hit signals,
When the access frequency lowering signal is valid, the replacement control unit invalidates the replacement protection and selects a replacement target entry, and when the access frequency lowering signal is invalid, the replacement control unit preferentially selects an entry whose replacement protection bit is not valid. And selecting a replacement target.

ここでの技術的特徴は、タグメモリが複数のリプレース保護ビットを有することと、複数のロック領域判定手段にそれぞれアクセス頻度評価手段が対応しているということである。   The technical feature here is that the tag memory has a plurality of replacement protection bits and that the access frequency evaluation means corresponds to the plurality of lock area determination means.

この構成によれば、ロック領域判定手段ごとにアクセス頻度評価手段を持っていて、リプレース保護領域ごとのアクセス頻度の評価を行うことで、リプレース制御手段がリプレース保護領域ごとにリプレース保護の設定/解除を行うことが可能となり、効果的なリプレース保護を実現できる。   According to this configuration, the lock area determination unit has the access frequency evaluation unit, and the replacement control unit sets / cancels the replacement protection for each replacement protection region by evaluating the access frequency for each replacement protection region. It is possible to perform effective replacement protection.

ところで、上記第1のキャッシュメモリ制御装置では、タグメモリに対してエントリごとにリプレース保護状態を示すリプレース保護ビットを追加しているが、キャッシュメモリの容量が大きい場合にはタグメモリのエントリ数が増加するので、リプレース保護ビットの追加はタグメモリの物理面積の増加を招く。この課題を含めて解決するのが、次に述べる第5のキャッシュメモリ制御装置である。   By the way, in the first cache memory control device, a replacement protection bit indicating a replacement protection state is added to the tag memory for each entry. However, if the capacity of the cache memory is large, the number of entries in the tag memory is small. Therefore, the addition of the replacement protection bit increases the physical area of the tag memory. The fifth cache memory control device described below solves this problem.

本発明における第5のキャッシュメモリ制御装置は、複数ウェイで構成されるキャッシュメモリにおいて、
有効ビットとタグアドレスを保持するエントリを複数備えるタグメモリと、
前記タグメモリのエントリに対応したデータを保持するデータメモリと、
前記タグメモリから出力される前記タグアドレスとアクセス要求アドレスとの比較および前記有効ビットの値に基づいてキャッシュヒットを検出するキャッシュヒット検出手段と、
リプレース保護対象のアドレス領域と前記タグメモリから出力される前記タグアドレスとを比較して、一致するときにロック領域ヒット信号を出力する複数のロック領域判定手段と、
前記タグメモリが保持する前記有効ビットの値と前記ロック領域ヒット信号を入力とし、リプレース対象ウェイを選択するリプレース制御手段とを備え、
それらによってアドレス空間を指定したリプレース保護を行うことを特徴とするものである。
The fifth cache memory control device according to the present invention is a cache memory composed of a plurality of ways.
A tag memory having a plurality of entries holding valid bits and tag addresses;
A data memory for holding data corresponding to the entry of the tag memory;
A cache hit detection means for detecting a cache hit based on a comparison between the tag address output from the tag memory and an access request address and a value of the valid bit;
A plurality of lock area determination means for comparing the address area to be protected for replacement with the tag address output from the tag memory and outputting a lock area hit signal when they match.
A replacement control means for selecting the way to be replaced with the value of the effective bit held in the tag memory and the lock area hit signal as inputs, and
Thus, replacement protection is performed by designating an address space.

ここでの技術的特徴は、タグメモリにおいてはリプレース保護ビットを有していないということと、ロック領域判定手段ではリプレース保護対象のアドレス領域の比較対象を、タグメモリから直接読み出したタグアドレスとするということである。   The technical feature here is that the tag memory does not have a replacement protection bit, and the lock area determination means uses the tag address directly read from the tag memory as the comparison target of the address area to be replaced. That's what it means.

この構成によれば、リプレース保護ビットをもったタグメモリを使用しなくてもリプレース保護を実現することが可能となり、リプレース保護ビットの追加によるタグメモリの面積増加を招くことなく、リプレース保護が可能となる。   According to this configuration, replacement protection can be realized without using a tag memory having a replacement protection bit, and replacement protection is possible without increasing the area of the tag memory due to the addition of the replacement protection bit. It becomes.

本発明における第6のキャッシュメモリ制御装置は、複数ウェイで構成されるキャッシュメモリにおいて、
有効ビットとリプレース保護ビットとタグアドレスを保持するエントリを複数備えるタグメモリと、
前記タグメモリのエントリに対応したデータを保持するデータメモリと、
前記タグメモリから出力される前記タグアドレスとアクセス要求アドレスとの比較および前記有効ビットの値に基づいてキャッシュヒットを検出するキャッシュヒット検出手段と、
リプレース保護対象のタスクIDとCPUが出力する実行中のタスクIDとを比較して、一致するときにロック領域ヒット信号を出力するロック領域判定手段と、
前記タグメモリが保持する前記有効ビットの値と前記リプレース保護ビットの値を入力とし、リプレース対象ウェイを選択するリプレース制御手段とを備え、
それらによって、タスクIDを指定したリプレース保護を行うことを特徴とするものである。
A sixth cache memory control device according to the present invention is a cache memory composed of a plurality of ways.
A tag memory having a plurality of entries holding valid bits, replacement protection bits, and tag addresses;
A data memory for holding data corresponding to the entry of the tag memory;
A cache hit detection means for detecting a cache hit based on a comparison between the tag address output from the tag memory and an access request address and a value of the valid bit;
A lock area determination unit that compares a task ID to be replaced with a task ID being executed output by the CPU and outputs a lock area hit signal when they match,
A replacement control means for selecting the way to be replaced, using the value of the effective bit held by the tag memory and the value of the replacement protection bit as inputs; and
Thus, replacement protection with a task ID specified is performed.

ここでの技術的特徴は、リプレース保護の判定の基準を、アドレス領域ではなく、タスクIDにしているということである。   The technical feature here is that the criterion for determination of replacement protection is not an address area but a task ID.

この構成によれば、リプレース保護の指定をメモリアドレスではなく、タスクIDとすることで、タスク単位でのリプレース保護が可能となる。すなわち、タスクで使用するアドレス領域を調べる必要がなく、容易なリプレース保護設定が可能となる。   According to this configuration, replacement protection can be performed in units of tasks by specifying replacement protection as a task ID instead of a memory address. That is, it is not necessary to check the address area used in the task, and easy replacement protection setting is possible.

本発明の第7のキャッシュメモリ制御装置は、複数ウェイで構成されるキャッシュメモリにおいて、
有効ビットとリプレース保護ビットとタグアドレスを保持するエントリを複数備えるタグメモリと、
前記タグメモリから出力される前記タグアドレスとアクセス要求アドレスとの比較および前記有効ビットの値に基づいてキャッシュヒットを検出するキャッシュヒット検出手段と、
リプレース保護対象の割り込みレベルとCPUが出力する実行中の割り込みレベルとを比較して、一致するときにロック領域ヒット信号を出力するロック領域判定手段と、
前記タグメモリが保持する前記有効ビットの値と前記リプレース保護ビットの値を入力とし、リプレース対象ウェイを選択するリプレース制御手段とを備え、
それらによって、割り込みレベルを指定したリプレース保護を行うように構成することも好ましい。
A seventh cache memory control device according to the present invention is a cache memory composed of a plurality of ways.
A tag memory having a plurality of entries holding valid bits, replacement protection bits, and tag addresses;
A cache hit detection means for detecting a cache hit based on a comparison between the tag address output from the tag memory and an access request address and a value of the valid bit;
A lock area determination unit that compares the interrupt level to be replaced with the interrupt level being executed output by the CPU and outputs a lock area hit signal when they match,
A replacement control means for selecting the way to be replaced, using the value of the effective bit held by the tag memory and the value of the replacement protection bit as inputs; and
It is also preferable that the replacement protection is performed by designating the interrupt level.

また、キャッシュメモリ制御方法としては、次のように構成することが好ましい。   The cache memory control method is preferably configured as follows.

すなわち、CPUからのアクセス要求がリプレース保護対象のアドレス領域へのアクセスであるかを判定する領域判定ステップと、
キャッシュミスによるリプレースを行うエントリとして有効ビットが設定されていないエントリを選択する選択ステップ1と、
前記選択ステップ1でリプレースを行うエントリを選択できなかった場合に、リプレース保護ビットが設定されていないエントリを選択する選択ステップ2と、
前記選択ステップ1、選択ステップ2のいずれかによって選択されたエントリへデータを書き込む書き込みステップと、
前記領域判定ステップの結果を選択されたエントリのリプレース保護ビットに書き込む保護設定ステップとを含むものである。
That is, an area determination step for determining whether an access request from the CPU is an access to an address area targeted for replacement protection;
Selection step 1 for selecting an entry for which a valid bit is not set as an entry to be replaced due to a cache miss;
A selection step 2 for selecting an entry in which the replacement protection bit is not set when an entry to be replaced cannot be selected in the selection step 1;
A writing step of writing data to the entry selected by either the selection step 1 or the selection step 2;
And a protection setting step of writing the result of the area determination step into the replacement protection bit of the selected entry.

また、次の方式のキャッシュメモリ制御方法も好ましい。   The following cache memory control method is also preferable.

CPUからのアクセス要求がリプレース保護対象のアドレス領域へのアクセスであるかを判定する領域判定ステップと、
前記リプレース保護対象のアドレス領域へのアクセス頻度を評価し、前記アクセス頻度が低下するとアクセス頻度低下信号を出力するアクセス頻度評価ステップと、
キャッシュミスによるリプレースを行うエントリとして有効ビットが設定されていないエントリを選択する選択ステップ1と、
前記選択ステップ1でリプレースを行うエントリを選択できず、かつ前記アクセス頻度低下信号によりアクセス頻度が低下していないことが示された場合に、リプレースを行うエントリとしてリプレース保護ビットが設定されていないエントリを選択する選択ステップ2と、
前記選択ステップ1でリプレースを行うエントリを選択できず、かつ前記アクセス頻度低下信号によりアクセス頻度の低下が示された場合に、前記リプレース保護ビットに関係なくリプレースすべきエントリを選択する選択ステップ3と、
前記選択ステップ1、選択ステップ2、選択ステップ3のいずれかによって選択されたエントリへデータを書き込む書き込みステップと、
前記領域判定ステップの結果を選択されたエントリのリプレース保護ビットに書き込む保護設定ステップとを含むものである。
An area determination step for determining whether an access request from the CPU is an access to an address area targeted for replacement protection;
An access frequency evaluation step of evaluating an access frequency to the replacement protected address area and outputting an access frequency decrease signal when the access frequency decreases;
Selection step 1 for selecting an entry for which a valid bit is not set as an entry to be replaced due to a cache miss;
An entry in which the replacement protection bit is not set as an entry to be replaced when the entry to be replaced cannot be selected in the selection step 1 and the access frequency lowering signal indicates that the access frequency has not decreased. Selection step 2 for selecting
A selection step 3 for selecting an entry to be replaced regardless of the replacement protection bit when the entry to be replaced cannot be selected in the selection step 1 and the access frequency decrease signal indicates a decrease in the access frequency; ,
A writing step of writing data to the entry selected by any of the selection step 1, the selection step 2 and the selection step 3;
And a protection setting step of writing the result of the area determination step into the replacement protection bit of the selected entry.

第1のキャッシュメモリ制御装置によれば、リプレース動作から保護する領域を設定するもので、ある期間はキャッシュメモリに確実に保持しておきたい命令やデータをリプレース動作から確実に保護することができる。また、特定の命令やデータをキャッシュメモリに保持して高速実行を行う必要がある場合に、その高速実行を確実に実現できる。   According to the first cache memory control device, an area to be protected from the replace operation is set, and it is possible to reliably protect an instruction or data that is to be reliably held in the cache memory for a certain period from the replace operation. . Further, when it is necessary to execute a high-speed execution by holding a specific instruction or data in the cache memory, the high-speed execution can be reliably realized.

第2のキャッシュメモリ制御装置によれば、第1のキャッシュメモリ制御装置よりもキャッシュメモリの利用効率を向上することができる。   According to the second cache memory control device, the utilization efficiency of the cache memory can be improved as compared with the first cache memory control device.

第3のキャッシュメモリ制御装置によれば、第2のキャッシュメモリ制御装置よりも緻密なリプレース保護が可能となり、キャッシュメモリの利用効率を向上させることができる。   According to the third cache memory control device, it is possible to perform more precise replacement protection than the second cache memory control device, and it is possible to improve the use efficiency of the cache memory.

第4のキャッシュメモリ制御装置によれば、第3のキャッシュメモリ制御装置よりもさらに緻密なリプレース保護が可能となり、キャッシュメモリの利用効率を向上させることができる。   According to the fourth cache memory control device, more precise replacement protection can be achieved than in the third cache memory control device, and the utilization efficiency of the cache memory can be improved.

第5のキャッシュメモリ制御装置によれば、第1のキャッシュメモリ制御装置と同様の効果を得ながら、タグメモリの面積を削減することができる。   According to the fifth cache memory control device, the area of the tag memory can be reduced while obtaining the same effect as that of the first cache memory control device.

第6のキャッシュメモリ制御装置によれば、リプレース動作から保護するタスクIDを設定し、リプレース動作から確実に保護することで、指定したタスクIDの高速な実行ができる。   According to the sixth cache memory control device, the task ID to be protected from the replace operation is set, and the specified task ID can be executed at high speed by reliably protecting from the replace operation.

第7のキャッシュメモリ制御装置によれば、リプレース動作から保護する割り込みレベルを設定し、リプレース動作から確実に保護することで、指定した割り込みレベルの割り込み処理を高速な実行ができる。   According to the seventh cache memory control device, by setting the interrupt level to be protected from the replace operation and reliably protecting from the replace operation, the interrupt processing at the designated interrupt level can be executed at high speed.

以下、本発明にかかわるキャッシュメモリ制御装置の実施の形態を図面に基づいて詳細に説明する。   Embodiments of a cache memory control device according to the present invention will be described in detail below with reference to the drawings.

(第1の実施の形態)
図1は本発明の第1の実施の形態におけるキャッシュメモリ制御装置の構成を示すブロック図、図2は第1の実施の形態のキャッシュメモリアクセス制御の動作を示すフローチャート、図3はロック領域判定回路の動作を示すフローチャート、図4は第1の実施の形態で実行されるプログラムの一部を示すものである。
(First embodiment)
FIG. 1 is a block diagram showing a configuration of a cache memory control apparatus according to the first embodiment of the present invention, FIG. 2 is a flowchart showing an operation of cache memory access control according to the first embodiment, and FIG. FIG. 4 shows a part of a program executed in the first embodiment.

本実施の形態のキャッシュメモリ制御装置は、ウェイ0のタグメモリ100とウェイ1のタグメモリ101とウェイ0のデータメモリ102とウェイ1のデータメモリ103とヒット検出器104,105と出力回路106,107とロック領域判定回路111とリプレース制御回路112から構成されている。108はCPU、800は外部メモリである。   The cache memory control device according to the present embodiment includes a tag memory 100 of way 0, a tag memory 101 of way 1, a data memory 102 of way 0, a data memory 103 of way 1, hit detectors 104 and 105, an output circuit 106, 107, a lock area determination circuit 111, and a replacement control circuit 112. Reference numeral 108 denotes a CPU, and 800 denotes an external memory.

ウェイ0のタグメモリ100とウェイ1のタグメモリ101は、各ウェイのエントリ毎にタグアドレス、エントリの有効性を示す有効ビットV、エントリのロック状態を示すリプレース保護ビットLの保持を行うものである。   The tag memory 100 of way 0 and the tag memory 101 of way 1 hold a tag address, a valid bit V indicating the validity of the entry, and a replacement protection bit L indicating the lock state of the entry for each way entry. is there.

ヒット検出器104,105は、次の比較を行う。比較の一方の要素は、CPU108からアドレスバスを介して出力されたアクセス要求アドレスの上位部である。比較のもう一方の要素は、アクセス要求アドレスの下位部を用いてウェイ0のタグメモリ100、ウェイ1のタグメモリ101から読み出されたエントリに保持されているタグアドレスである。ヒット検出器104,105は、アクセス要求アドレスの上位部と読み出されたタグアドレスとの比較を行い、結果が一致し、かつ有効ビットVが“1”であるときは、ヒット信号Shを出力回路106,107へ出力するように構成されている。   The hit detectors 104 and 105 perform the following comparison. One element of the comparison is the upper part of the access request address output from the CPU 108 via the address bus. The other element of the comparison is the tag address held in the entry read from the tag memory 100 of way 0 and the tag memory 101 of way 1 using the lower part of the access request address. The hit detectors 104 and 105 compare the upper part of the access request address with the read tag address, and output a hit signal Sh when the results match and the valid bit V is “1”. It is configured to output to the circuits 106 and 107.

出力回路106,107は、ヒット検出器104,105より出力されるウェイごとのヒット信号Shに基づいて、ウェイ0のデータメモリ102とウェイ1のデータメモリ103が出力するデータの出力制御を行うように構成されている。   The output circuits 106 and 107 perform output control of data output from the data memory 102 of way 0 and the data memory 103 of way 1 based on the hit signal Sh for each way output from the hit detectors 104 and 105. It is configured.

ロック領域判定回路111は、ロック領域を保持するアドレス領域指定レジスタ110と比較器109を備えている。比較器109は、CPU108からメモリアクセスのためにアドレスバスに出力されたアクセス要求アドレスと、アドレス領域指定レジスタ110に指定されているアドレス領域の比較を行う。そして、ロック領域の範囲内のアクセスであった場合には、ウェイ0のタグメモリ100とウェイ1のタグメモリ101の該当するエントリのリプレース保護ビットLに“1”をセットするためのロック領域ヒット信号Slを出力するように構成されている。   The lock area determination circuit 111 includes an address area designation register 110 that holds a lock area and a comparator 109. The comparator 109 compares the access request address output from the CPU 108 to the address bus for memory access and the address area designated in the address area designation register 110. If the access is within the range of the lock area, a lock area hit for setting “1” to the replacement protection bit L of the corresponding entry in the tag memory 100 of way 0 and the tag memory 101 of way 1 The signal S1 is output.

リプレース制御回路112は、ウェイ0のタグメモリ100とウェイ1のタグメモリ101の各エントリのリプレース保護ビットL、有効ビットVを入力信号とし、リプレース動作を行うウェイの選択の制御を行うように構成されている。   The replace control circuit 112 is configured to control selection of a way to perform a replace operation using the replace protection bit L and the valid bit V of each entry of the tag memory 100 of way 0 and the tag memory 101 of way 1 as input signals. Has been.

次に、キャッシュメモリ制御装置のリプレース制御動作を図2、図3のフローチャートを用いて説明する。   Next, the replacement control operation of the cache memory control device will be described with reference to the flowcharts of FIGS.

まず、キャッシュメモリアクセス制御の基本の動作を図2のフローチャートに基づいて説明する。   First, the basic operation of the cache memory access control will be described based on the flowchart of FIG.

キャッシュメモリアクセス制御動作は、CPU108からのアクセス要求により、ステップA1以降の処理を開始する。   The cache memory access control operation starts the processing after step A1 in response to an access request from the CPU.

ステップA1において、CPU108がアクセスをするデータがキャッシュヒットかキャッシュミスかの判定を行い、キャッシュヒットの場合はステップA2へ分岐し、キャッシュミスの場合はステップA3へ分岐する。   In step A1, the CPU 108 determines whether the data to be accessed is a cache hit or a cache miss. If it is a cache hit, the process branches to step A2, and if it is a cache miss, the process branches to step A3.

キャッシュヒットの場合のステップA2においては、キャッシュメモリへのアクセスを行い、CPU108からのアクセスは終了する。   In step A2 in the case of a cache hit, the cache memory is accessed, and the access from the CPU 108 ends.

一方、キャッシュミスの場合のステップA3においては、アクセスの対象となるエントリに有効ビットVが“0”になっているエントリがあるか否かの判定を行い、ある場合はステップA6へ分岐し、ない場合はステップA4へ分岐する。   On the other hand, in step A3 in the case of a cache miss, it is determined whether or not there is an entry whose effective bit V is “0” in the entry to be accessed. If there is, branch to step A6. If not, the process branches to step A4.

有効ビットVが“0”になっているエントリがある場合のステップA6においては、有効ビットVが“0”であるエントリのうち1つを選択する。そして、ステップA10に進む。   In step A6 when there is an entry for which the valid bit V is “0”, one of the entries for which the valid bit V is “0” is selected. Then, the process proceeds to Step A10.

一方、有効ビットVが“0”になっているエントリがない場合のステップA4においては、アクセスの対象となるエントリにリプレース保護ビットLが“0”になっているエントリがあるか否かの判定を行い、ある場合はステップA7へ分岐し、ない場合はステップA5へ分岐する。   On the other hand, in step A4 when there is no entry for which the valid bit V is “0”, it is determined whether or not there is an entry for which the replacement protection bit L is “0” in the entry to be accessed. If there is, the process branches to step A7, and if not, the process branches to step A5.

アクセスの対象となるエントリにリプレース保護ビットLが“0”になっているエントリがある場合のステップA7においては、リプレース保護ビットLが“0”であるエントリのうち1つを選択する。そして、ステップA10に進む。   In step A7 when there is an entry whose replacement protection bit L is “0” among the entries to be accessed, one of the entries whose replacement protection bit L is “0” is selected. Then, the process proceeds to Step A10.

一方、アクセスの対象となるエントリにリプレース保護ビットLが“0”になっているエントリがない場合のステップA5においては、ロック領域ヒット信号Slが“1”か否かの判定を行い、“1”である場合はステップA8へ分岐し、“0”である場合はステップA9へ分岐する。   On the other hand, in the case where there is no entry whose replacement protection bit L is “0” in the entry to be accessed, it is determined whether or not the lock area hit signal S1 is “1”. If "", the process branches to step A8. If "0", the process branches to step A9.

ロック領域ヒット信号Slが“1”である場合のステップA8においては、アクセスの対象となるエントリのうち1つを選択する。このときエントリを選択する方式としては、LRU方式やFIFO方式やランダムに選択する方式などを用いることができる。次いで、ステップA10に進む。   In step A8 when the lock area hit signal S1 is "1", one entry to be accessed is selected. At this time, as a method for selecting an entry, an LRU method, a FIFO method, a method for selecting at random, or the like can be used. Next, the process proceeds to Step A10.

一方、ロック領域ヒット信号Slが“0”である場合のステップA9においては、外部メモリ800に対して、CPU108が要求するアクセスを実行し、アクセスは終了する。   On the other hand, in step A9 when the lock area hit signal S1 is “0”, the access requested by the CPU 108 is executed with respect to the external memory 800, and the access ends.

1つのエントリが選択されたあとのステップA10においては、CPU108が要求するデータを外部メモリ800から読み出し、選択したエントリへ書き込みを行う。   In step A10 after one entry is selected, data requested by the CPU 108 is read from the external memory 800 and written to the selected entry.

次いで、ステップA11において、ロック領域ヒット信号Slが“1”か否かの判定を行い、“1”である場合はステップA12へ分岐し、“0”である場合はステップA13へ分岐する。そして、ステップA14に進む。   Next, in Step A11, it is determined whether or not the lock area hit signal S1 is “1”. If “1”, the process branches to Step A12, and if it is “0”, the process branches to Step A13. Then, the process proceeds to Step A14.

ロック領域ヒット信号Slが“1”である場合のステップA12においては、選択したエントリのリプレース保護ビットLに“1”をセットする。   In Step A12 when the lock area hit signal S1 is “1”, “1” is set to the replacement protection bit L of the selected entry.

一方、ロック領域ヒット信号Slが“0”である場合のステップA13においては、選択したエントリのリプレース保護ビットLに“0”をセットする。そして、ステップA14に進む。   On the other hand, in step A13 when the lock area hit signal S1 is “0”, “0” is set to the replacement protection bit L of the selected entry. Then, the process proceeds to Step A14.

ステップA14においては、CPU108が要求するアクセスを実行し、アクセスは終了する。   In step A14, the access requested by the CPU 108 is executed, and the access ends.

次に、ロック領域判定回路111の動作を図3のフローチャートに基づいて説明する。   Next, the operation of the lock area determination circuit 111 will be described based on the flowchart of FIG.

ロック領域判定回路111は、CPU108からのアクセス要求により、ステップB1以降の処理を開始する。   In response to an access request from the CPU 108, the lock area determination circuit 111 starts the processing after step B1.

ステップB1において、CPU108からのアクセス要求アドレスが、アドレス領域指定レジスタ110に指定された範囲か否かの評価を行い、範囲内である場合はステップB2へ分岐し、範囲外である場合はステップB3へ分岐する。   In step B1, it is evaluated whether or not the access request address from the CPU 108 is within the range designated in the address area designation register 110. If it is within the range, the process branches to step B2, and if outside the range, step B3 is entered. Branch to

ステップB2においては、ロック領域ヒット信号Slに“1”を出力し、フローを終了する。   In step B2, "1" is output to the lock area hit signal S1 and the flow is terminated.

一方、ステップB3においては、ロック領域ヒット信号Slに“0”を出力し、フローを終了する。   On the other hand, in step B3, "0" is output to the lock area hit signal S1 and the flow is terminated.

具体的な例として、図4に示すようなプログラムにおける本実施の形態上でのキャッシュリプレース制御の動作を以下に示す。   As a specific example, the operation of the cache replacement control in the present embodiment in the program as shown in FIG. 4 is shown below.

図1、図2、図3に示されるキャッシュリプレース方式のキャッシュメモリ制御装置において、図4のようなメインプログラムから繰り返しコールされ、かつキャッシュメモリ上では同じエントリを使用するアドレスにマッピングされているサブルーチン1〜3があるとする。さらに、その中でもサブルーチン1は高速実行が必要なプログラムであるとする。   In the cache replacement control cache memory control device shown in FIGS. 1, 2, and 3, a subroutine that is repeatedly called from the main program as shown in FIG. 4 and is mapped to an address that uses the same entry on the cache memory. Suppose there are 1-3. Furthermore, it is assumed that subroutine 1 is a program that requires high-speed execution.

図4のメインプログラムでラベル“Loop”を先頭とする繰り返しの処理を実行する前に、あらかじめプログラムによってロック領域判定回路111におけるアドレス領域指定レジスタ110に、高速実行が必要なサブルーチン1の先頭番地と末尾番地がロック領域として指定されている。また、キャッシュメモリはウェイ0、ウェイ1ともに初期化が行われており、すべてのエントリの有効ビットVは“0”にクリアされている。   Before executing the repeated processing starting with the label “Loop” in the main program of FIG. 4, the address of the subroutine 1 that requires high-speed execution is stored in the address area designation register 110 in the lock area determination circuit 111 in advance by the program. The end address is specified as the lock area. The cache memory is initialized for both way 0 and way 1, and the valid bits V of all entries are cleared to “0”.

以降、メインプログラムはサブルーチン1〜3のコールを繰り返し実行する。   Thereafter, the main program repeatedly executes calls of subroutines 1 to 3.

まず、サブルーチン1がメインプログラムからコールされ、サブルーチン1の命令が実行される。この場合、初回であるので、キャッシュミスが発生する。リプレース制御回路112の制御によりウェイ0が選択され、外部メモリ800から読み出されたデータによりウェイ0の該当するエントリがリプレースされる(ステップA1→ステップA3→ステップA6→ステップA10)。   First, subroutine 1 is called from the main program, and the instruction of subroutine 1 is executed. In this case, since this is the first time, a cache miss occurs. The way 0 is selected by the control of the replacement control circuit 112, and the corresponding entry of the way 0 is replaced by the data read from the external memory 800 (step A1, step A3, step A6, step A10).

このときロック領域判定回路111はアクセスを行うアドレスバスのアドレスが指定されているアドレス領域のアドレスであるか否かの判定を行い(ステップA11)、サブルーチン1の場合は範囲内であるため、ロック領域ヒット信号Slに“1”をセットする。   At this time, the lock area determination circuit 111 determines whether the address of the address bus to be accessed is the address of the designated address area (step A11). “1” is set to the area hit signal S1.

ウェイ0のタグメモリ100は前記のロック領域判定回路111のロック領域ヒット信号Slが“1”にセットされていることにより、リプレースを行ったエントリのリプレース保護ビットLを“1”にセットする(ステップA12)。   The tag memory 100 of the way 0 sets the replacement protection bit L of the entry that has been replaced to “1” when the lock area hit signal S1 of the lock area determination circuit 111 is set to “1” ( Step A12).

そして、CPU108は、外部メモリ800から読み出したデータを実行する(ステップA14)。   Then, the CPU 108 executes the data read from the external memory 800 (Step A14).

サブルーチン1の処理が終わり、メインプログラムへ復帰すると、次にサブルーチン2がメインプログラムからコールされ、サブルーチン2の命令が実行される。このときサブルーチン2の命令実行でもキャッシュミスが発生し、リプレース制御回路112の制御により有効ビットV、リプレース保護ビットLともに“0”のウェイ1が選択され、外部メモリ800から読み出されたデータによりウェイ1の該当するエントリがリプレースされる(ステップA1→ステップA3→ステップA6→ステップA10)。   When the processing of the subroutine 1 is completed and the process returns to the main program, the subroutine 2 is called from the main program and the instruction of the subroutine 2 is executed. At this time, a cache miss occurs even when the instruction of subroutine 2 is executed, and way 1 with both valid bit V and replacement protection bit L being “0” is selected by the control of replacement control circuit 112, and the data read from external memory 800 is used. The corresponding entry of way 1 is replaced (step A1 → step A3 → step A6 → step A10).

このときロック領域判定回路111はアクセスを行うアドレスバスのアドレスが指定されているアドレス領域のアドレスであるか否かの判定を行い(ステップA11)、サブルーチン2の場合は範囲内でないため、ロック領域ヒット信号Slに“0”をセットする。   At this time, the lock area determination circuit 111 determines whether or not the address of the address bus to be accessed is the address of the designated address area (step A11). “0” is set to the hit signal S1.

ウェイ1のタグメモリ101は前記のロック領域判定回路111のロック領域ヒット信号Slが“0”にセットされていることにより、リプレースを行ったエントリのリプレース保護ビットLを“0”にセットする(ステップA13)。   The tag memory 101 of way 1 sets the replacement protection bit L of the entry that has been replaced to “0” when the lock area hit signal S1 of the lock area determination circuit 111 is set to “0” ( Step A13).

そして、CPU108は、外部メモリ800から読み出したデータを実行する(ステップA14)。   Then, the CPU 108 executes the data read from the external memory 800 (Step A14).

サブルーチン2の処理が終わり、メインプログラムへ復帰すると、次にサブルーチン3がメインプログラムからコールされ、サブルーチン3の命令が実行される。このときサブルーチン3の命令実行でもキャッシュミスが発生する。すでにウェイ0、ウェイ1ともに、有効ビットVが“1”にセットされている。そこで、ステップA4に進んで、リプレース制御回路112の制御により、リプレース保護ビットLが“0”であるウェイ1が選択される。外部メモリ800から読み出されたデータによりウェイ1の該当するエントリがリプレースされる(ステップA1→ステップA3→ステップA4→ステップA7→ステップA10)。   When the processing of the subroutine 2 is completed and the process returns to the main program, the subroutine 3 is called from the main program and the instruction of the subroutine 3 is executed. At this time, a cache miss also occurs when the instruction of subroutine 3 is executed. The valid bit V is already set to “1” for both way 0 and way 1. Therefore, the process proceeds to step A4, and the way 1 whose replacement protection bit L is “0” is selected by the control of the replacement control circuit 112. The corresponding entry of the way 1 is replaced by the data read from the external memory 800 (step A1 → step A3 → step A4 → step A7 → step A10).

すなわち、ウェイ0に格納されているサブルーチン1は、リプレース保護ビットLが“1”であるため、リプレースから保護されてキャッシュメモリに保持される。   That is, the subroutine 1 stored in the way 0 is protected from the replacement and held in the cache memory because the replacement protection bit L is “1”.

このときロック領域判定回路111は、アクセスを行うアドレスバスのアドレスが指定されているアドレス領域のアドレスであるか否かの判定を行い(ステップA11)、サブルーチン3の場合は範囲内でないため、ロック領域ヒット信号Slに“0”をセットする。   At this time, the lock area determination circuit 111 determines whether or not the address of the address bus to be accessed is an address of the designated address area (step A11). “0” is set to the area hit signal S1.

ウェイ1のタグメモリ101は前記のロック領域判定回路111のロック領域ヒット信号Slが“0”にセットされていることにより、リプレースを行ったエントリのリプレース保護ビットLを“0”にセットする(ステップA13)。   The tag memory 101 of way 1 sets the replacement protection bit L of the entry that has been replaced to “0” when the lock area hit signal S1 of the lock area determination circuit 111 is set to “0” ( Step A13).

そして、CPU108は、外部メモリ800から読み出したデータを実行する(ステップA14)。   Then, the CPU 108 executes the data read from the external memory 800 (Step A14).

サブルーチン3の処理が終わり、メインプログラムへ復帰すると、次にある条件分岐命令を実行する。条件分岐命令では、条件の判定によりLoopラベルへの分岐が行われ、再びメインプログラムはサブルーチン1をコールする。キャッシュヒットとなり、CPU108はキャッシュメモリから命令を読み出し実行する(ステップA1→ステップA2)。   When the processing of the subroutine 3 is completed and the process returns to the main program, the next conditional branch instruction is executed. In the conditional branch instruction, the branch to the Loop label is performed according to the determination of the condition, and the main program calls the subroutine 1 again. A cache hit occurs, and the CPU 108 reads and executes an instruction from the cache memory (step A1 → step A2).

サブルーチン1の処理が完了すると、メインプログラムは前述したようにサブルーチン2、サブルーチン3を逐次コールし、それらの処理が行われるが、サブルーチン2、サブルーチン3の命令が実行されるときのリプレース制御回路112の動作は前述のものと同様にリプレース保護ビットLが“0”であるウェイ1のエントリへリプレースされる(ステップA1→ステップA3→ステップA4→ステップA7→ステップA10)。   When the processing of the subroutine 1 is completed, the main program sequentially calls the subroutine 2 and the subroutine 3 as described above, and the processing is performed. However, the replacement control circuit 112 when the instructions of the subroutine 2 and the subroutine 3 are executed is performed. In the same way as described above, the replacement is made to the entry of the way 1 whose replacement protection bit L is “0” (step A 1 → step A 3 → step A 4 → step A 7 → step A 10).

このように、高速実行が必要なサブルーチン1の命令を、キャッシュミスによるリプレース動作から確実に保護することが可能になる。   In this way, it is possible to reliably protect the instruction of subroutine 1 that requires high-speed execution from the replace operation due to a cache miss.

以上のように本実施の形態によれば、特定の領域をアドレス領域指定レジスタ110で指定し、指定した領域をキャッシュメモリへ格納するときにリプレース保護ビットLを“1”に設定することで、以降のリプレース動作から確実に保護することができ、指定した領域を高速にアクセスすることができる。   As described above, according to the present embodiment, a specific area is designated by the address area designation register 110, and when the designated area is stored in the cache memory, the replace protection bit L is set to “1”. The subsequent replacement operation can be surely protected, and the designated area can be accessed at high speed.

なお、本実施の形態で説明したリプレース制御回路112の前述した機能に加え、ソフトウェアにより制御されるリプレース保護イネーブルレジスタを設け、それによりリプレース制御でリプレース保護の有効/無効の制御を行うように構成すれば、キャッシュメモリをより効率的に利用することができる。   In addition to the above-described function of the replacement control circuit 112 described in the present embodiment, a replacement protection enable register controlled by software is provided, thereby enabling the replacement protection to be enabled / disabled by the replacement control. Then, the cache memory can be used more efficiently.

(第2の実施の形態)
本発明の第2の実施の形態は、上記の第1の実施の形態における次のような問題点にも配慮したものである。それは、リプレースから保護したい領域へのアクセス頻度がプログラムの実行時の状態で変わる場合の問題である。すなわち、第1の実施の形態においては、ロック領域判定回路111内のアドレス領域指定レジスタ110にリプレース保護対象のアドレス領域を指定する。その範囲に該当するデータをキャッシュメモリに格納しているときに、リプレース保護対象のアドレス領域へのアクセス頻度がプログラムの実行時の状態で変われば、リプレース保護の有効/無効の切り替えをプログラムで制御するのが困難になったり、状態を判定するためにプログラムが増大するという問題がある。
(Second Embodiment)
The second embodiment of the present invention also takes into consideration the following problems in the first embodiment. This is a problem when the frequency of access to the area to be protected from replacement changes depending on the program execution state. That is, in the first embodiment, the address area to be replaced is specified in the address area specifying register 110 in the lock area determination circuit 111. When data corresponding to that range is stored in the cache memory, if the access frequency to the address area subject to replacement protection changes depending on the program execution status, the program controls whether to enable or disable replacement protection. There is a problem that it is difficult to do, or that the program increases to determine the state.

第2の実施の形態では、アクセス頻度の情報を用いて、自動的にリプレース保護の有効/無効の切り替えを行うものである。   In the second embodiment, the replacement protection is automatically switched between valid / invalid using the access frequency information.

図5は本発明の第2の実施の形態におけるキャッシュメモリ制御装置の構成を示すブロック図、図6は第2の実施の形態のキャッシュメモリアクセス制御の動作を示すフローチャート、図7はロック領域判定回路の動作を示すフローチャートである。   FIG. 5 is a block diagram showing the configuration of the cache memory control device according to the second embodiment of the present invention, FIG. 6 is a flowchart showing the operation of the cache memory access control according to the second embodiment, and FIG. It is a flowchart which shows operation | movement of a circuit.

本実施の形態のキャッシュメモリ制御装置は、第1の実施の形態で説明したウェイ0のタグメモリ100とウェイ1のタグメモリ101とウェイ0のデータメモリ102とウェイ1のデータメモリ103とヒット検出器104,105と出力回路106,107とロック領域判定回路111と今回構造を変更したリプレース制御回路112aとアクセス頻度カウンタ113から構成されている。   The cache memory control device according to the present embodiment includes the way 0 tag memory 100, the way 1 tag memory 101, the way 0 data memory 102, the way 1 data memory 103, and the hit detection described in the first embodiment. And 104, 105, output circuits 106 and 107, a lock area determination circuit 111, a replacement control circuit 112a whose structure has been changed this time, and an access frequency counter 113.

以下では、第1の実施の形態とは異なる部分のアクセス頻度カウンタ113とリプレース制御回路112aについて説明する。   Hereinafter, the access frequency counter 113 and the replacement control circuit 112a, which are different from those in the first embodiment, will be described.

アクセス頻度カウンタ113は、一定時間ごとに値を減算するダウンカウンタであり、ロック領域判定回路111から出力されるロック領域ヒット信号Slの出力が“1”になることにより、カウント値をあらかじめ指定された値へ設定するとともに、カウント値がアンダーフローを起こすと、アクセス頻度低下信号Sfを出力するように構成されている。   The access frequency counter 113 is a down counter that subtracts a value at regular intervals, and the count value is designated in advance when the output of the lock area hit signal S1 output from the lock area determination circuit 111 is “1”. When the count value underflows, the access frequency decrease signal Sf is output.

リプレース制御回路112aは、ウェイ0のタグメモリ100とウェイ1のタグメモリ101の各エントリのリプレース保護ビットL、有効ビットVとアクセス頻度カウンタ113から出力されるアクセス頻度低下信号Sfとを入力信号とし、リプレース動作を行うウェイの選択の制御を行う。   The replacement control circuit 112a receives, as input signals, the replacement protection bit L and the valid bit V of each entry of the tag memory 100 of way 0 and the tag memory 101 of way 1 and the access frequency decrease signal Sf output from the access frequency counter 113. Controls the selection of the way to perform the replacement operation.

以下に、キャッシュメモリ制御装置のリプレース制御動作を図6、図7のフローチャートを用いて説明する。   The replacement control operation of the cache memory control device will be described below with reference to the flowcharts of FIGS.

まず、キャッシュリプレース制御の動作を図6のフローチャートに基づいて説明する。ここでは、図2に示す第1の実施の形態でのキャッシュリプレース制御動作からの変更点を説明する。   First, the operation of the cache replacement control will be described based on the flowchart of FIG. Here, changes from the cache replacement control operation in the first embodiment shown in FIG. 2 will be described.

ステップC1において、アクセスの対象となるエントリに有効ビットVが“0”になっているエントリがあるか否かの判定を行い、ある場合はステップA6へ分岐し、ない場合はステップC2へ分岐する。   In step C1, it is determined whether or not there is an entry whose effective bit V is “0” in the entry to be accessed. If there is, the process branches to step A6, and if not, the process branches to step C2. .

ステップC2においては、ロック領域判定回路111から出力されたアクセス頻度低下信号Sfが“1”であるか否かの判定を行い、“1”である場合はステップC3へ分岐し、“1”でない場合はステップA4へ分岐する。   In step C2, it is determined whether or not the access frequency decrease signal Sf output from the lock area determination circuit 111 is “1”. If it is “1”, the process branches to step C3 and is not “1”. In this case, the process branches to step A4.

ステップC3においては、エントリのリプレース保護ビットLの値に関係なく、アクセスの対象となるエントリのうち1つを選択する。このときエントリを選択する方式はLRU方式とする。なお、エントリを選択する方式はLRU方式だけではなく、FIFO方式やランダムに選択する方式でもよい。   In step C3, regardless of the value of the replacement protection bit L of the entry, one of the entries to be accessed is selected. At this time, the entry selection method is the LRU method. Note that the method for selecting an entry is not limited to the LRU method, but may be a FIFO method or a method of selecting at random.

次に、ロック領域判定回路111の動作を図7のフローチャートに基づいて説明する。ここでは、図3に示す第1の実施の形態でのキャッシュリプレース制御動作からの変更点を説明する。   Next, the operation of the lock area determination circuit 111 will be described based on the flowchart of FIG. Here, changes from the cache replacement control operation in the first embodiment shown in FIG. 3 will be described.

ステップB4において、比較器109が出力するロック領域ヒット信号Slが“1”になることで、アクセス頻度カウンタ113のカウント値があらかじめ設定された初期値に設定され、同時にダウンカウントが開始される。   In step B4, when the lock area hit signal S1 output from the comparator 109 becomes “1”, the count value of the access frequency counter 113 is set to a preset initial value, and down-counting is started at the same time.

ステップB5において、アドレスカウンタでアンダーフローが発生しているか否かの判定を行い、発生していない場合はステップB6へ、発生している場合はステップB7へ分岐する。   In step B5, it is determined whether or not an underflow has occurred in the address counter. If not, the process branches to step B6, and if it has occurred, the process branches to step B7.

アンダーフローが発生していない場合のステップB6においては、アクセス頻度低下信号Sfに“0”を出力し、フローを終了する。   In step B6 when no underflow has occurred, “0” is output to the access frequency lowering signal Sf, and the flow is terminated.

アンダーフローが発生している場合のステップB7においては、アクセス頻度低下信号Sfに“1”を出力し、フローを終了する。   In step B7 when underflow has occurred, "1" is output to the access frequency lowering signal Sf, and the flow ends.

以上のように本実施の形態によれば、ロック領域判定回路111においてリプレース保護を設定されたアドレス領域のデータがキャッシュメモリに格納された後に、CPU108から発行されるアクセスが指定した領域内となる頻度をアクセス発生により初期値にセットされるダウンカウンタで評価することにより、プログラムがリプレースから保護している命令の実行を行わない実行状況になったことを検出し、リプレース保護を自動的に無効化することを実現できるようになり、キャッシュメモリの効率的な利用が可能となる。   As described above, according to the present embodiment, after the data in the address area for which replacement protection is set in the lock area determination circuit 111 is stored in the cache memory, the access issued by the CPU 108 is within the designated area. By evaluating the frequency with a down counter that is set to the initial value when an access occurs, it is detected that the program has entered an execution state that does not execute instructions protected from replacement, and replacement protection is automatically disabled. This makes it possible to implement the cache memory efficiently.

なお、図8は本実施の形態の変形の形態のキャッシュメモリ制御装置の構成を示すブロック図である。   FIG. 8 is a block diagram showing a configuration of a cache memory control device according to a modification of the present embodiment.

これは、リプレース制御回路112bを次のように構成したものである。条件に応じて、リプレース制御回路112bからウェイ0のタグメモリ100とウェイ1のタグメモリ101に対してロックエントリ無効化信号Siを出力するようになっている。すなわち、アクセス頻度カウンタ113からアクセス頻度低下信号Sfが“1”で出力されると、リプレース保護ビットLが“1”になっているエントリは不要になったとして、リプレース制御回路112bがロックエントリ無効化信号Siを出力する。その場合、ウェイ0のタグメモリ100とウェイ1のタグメモリ101においては、リプレース保護ビットLが“1”となっているエントリの有効ビットVを一括で“0”にクリアすることにより、エントリを無効化する。その結果として、キャッシュメモリの効率的な利用を実現できる。   This is a replacement control circuit 112b configured as follows. Depending on the conditions, a lock entry invalidation signal Si is output from the replacement control circuit 112b to the tag memory 100 of way 0 and the tag memory 101 of way 1. That is, when the access frequency lowering signal Sf is output as “1” from the access frequency counter 113, the replacement control circuit 112b determines that the entry with the replacement protection bit L set to “1” becomes unnecessary and the replacement control circuit 112b disables the lock entry. The synthesize signal Si is output. In that case, in the tag memory 100 of way 0 and the tag memory 101 of way 1, the entry is cleared by clearing the valid bit V of the entry whose replacement protection bit L is “1” to “0”. Disable it. As a result, efficient use of the cache memory can be realized.

なお、アクセス頻度低下信号Sfではなく、CPU108が特別な命令を実行して出力する制御信号により、リプレース保護ビットLが“1”であるエントリの有効ビットVを“0”にクリアして無効化しても良い。   Note that the valid bit V of the entry whose replacement protection bit L is “1” is cleared to “0” and invalidated by a control signal output by the CPU 108 executing a special instruction instead of the access frequency lowering signal Sf. May be.

なお、アクセス頻度カウンタは一定時間ごとに値を減算するとしたが、これに代えて、アクセス毎に値を減算するとしてもよい。また、ダウンカウンタの代わりに値を加算するアップカウンタとし、オーバーフローによりアクセス頻度低下信号Sfを出力するとしても良い。   Note that the access frequency counter subtracts the value every fixed time, but instead, the value may be subtracted for each access. Further, instead of the down counter, an up counter that adds values may be used, and the access frequency lowering signal Sf may be output due to overflow.

(第3の実施の形態)
本発明の第3の実施の形態は、上記の第2の実施の形態における次のような問題点にも配慮したものである。
(Third embodiment)
The third embodiment of the present invention also takes into account the following problems in the second embodiment.

第2の実施の形態において、高速実行の必要のためにキャッシュメモリ上で保持を行う必要がある命令に対して、命令の配置されているアドレス領域をリプレース保護領域としてロック領域判定回路に指定し、リプレース保護領域のデータをキャッシュメモリに格納するときにタグメモリのエントリのリプレース保護ビットLを“1”にセットすることでリプレース動作からの保護を可能とし、キャッシュメモリの効率的な利用が可能となった。   In the second embodiment, for an instruction that needs to be held in the cache memory due to the necessity of high-speed execution, the address area where the instruction is arranged is designated as a replacement protection area in the lock area determination circuit. When the data in the replacement protection area is stored in the cache memory, the replacement protection bit L of the tag memory entry is set to “1” to enable protection from the replacement operation, and the cache memory can be used efficiently. It became.

しかし、リプレースから保護を行いたい命令が1つの連続したアドレス領域ではなく、間にリプレースから保護を行う必要のないアドレス領域を挟んだ2つ以上のアドレス領域である場合に、リプレースから保護を行うためには保護の必要のない領域を含んだ1つのアドレス空間として保護を行わなくてはいけないという問題がある。   However, if the instruction to be protected from replacement is not one continuous address area, but two or more address areas with an address area that does not need to be protected from replacement in between, the protection is performed from replacement. Therefore, there is a problem that protection must be performed as one address space including an area that does not need protection.

図9は本発明の第3の実施の形態におけるキャッシュメモリ制御装置の構成を示すブロック図である。   FIG. 9 is a block diagram showing the configuration of the cache memory control apparatus according to the third embodiment of the present invention.

本実施の形態のキャッシュメモリ制御装置は、第2の実施の形態で説明したウェイ0のタグメモリ100とウェイ1のタグメモリ101とウェイ0のデータメモリ102とウェイ1のデータメモリ103とヒット検出器104,105と出力回路106,107とロック領域判定回路111とリプレース制御回路112aと今回新たに追加したロック領域判定回路121とOR回路118から構成されている。   The cache memory control device according to the present embodiment includes the way 0 tag memory 100, the way 1 tag memory 101, the way 0 data memory 102, the way 1 data memory 103, and the hit detection described in the second embodiment. And 104, 105, output circuits 106 and 107, a lock area determination circuit 111, a replacement control circuit 112a, a lock area determination circuit 121 newly added this time, and an OR circuit 118.

以下では、第2の実施の形態とは異なる部分について説明する。   Below, a different part from 2nd Embodiment is demonstrated.

ロック領域判定回路121は、ロック領域判定回路111と同じ構成である。OR回路118は、2つのロック領域判定回路111,121から出力されたロック領域ヒット信号の論理和をロック領域ヒット信号Slとして出力するように構成されている。   The lock area determination circuit 121 has the same configuration as the lock area determination circuit 111. The OR circuit 118 is configured to output the logical sum of the lock area hit signals output from the two lock area determination circuits 111 and 121 as the lock area hit signal S1.

本実施の形態のキャッシュリプレース制御のフローは図6、図7に示される第2の実施の形態と同様であるので、ここでの説明は省略する。   Since the flow of the cache replacement control of the present embodiment is the same as that of the second embodiment shown in FIGS. 6 and 7, the description thereof is omitted here.

本実施の形態によれば、ロック領域判定回路を複数個使用することにより、リプレース保護を行う領域を複数個設定することが可能となり、効果的なリプレース保護を実現できる。   According to the present embodiment, by using a plurality of lock area determination circuits, it is possible to set a plurality of areas to be subjected to replacement protection, thereby realizing effective replacement protection.

なお、本実施の形態では説明を簡単に行うために、アドレス領域指定レジスタと比較器からなるロック領域判定回路を2つとし、OR回路118で2つの比較器の出力の論理和をとるようにしているが、アドレス領域指定レジスタと比較器からなるロック領域判定回路を3つ以上使用し、すべての比較器の出力の論理和を行うOR回路を使用する構成とすることも可能である。   In this embodiment, in order to simplify the description, two lock area determination circuits each including an address area designation register and a comparator are provided, and an OR circuit 118 performs a logical sum of outputs from the two comparators. However, it is also possible to use a configuration in which three or more lock area determination circuits each including an address area designation register and a comparator are used, and an OR circuit that performs a logical sum of outputs from all the comparators is used.

(第4の実施の形態)
本発明の第4の実施の形態は、上記の第3の実施の形態における次のような問題点にも配慮したものである。
(Fourth embodiment)
The fourth embodiment of the present invention also takes into account the following problems in the third embodiment.

第3の実施の形態において、ロック領域判定回路を複数個使用することで複数のアドレス領域へのリプレース保護を実現し、効率的なリプレース保護が可能になった。   In the third embodiment, replacement protection to a plurality of address areas is realized by using a plurality of lock area determination circuits, thereby enabling efficient replacement protection.

しかし、第3の実施の形態でのキャッシュメモリ制御装置の構成では、複数のアドレス領域をリプレース保護に指定できるが、アクセス頻度カウンタとタグメモリのリプレース保護ビットLを複数のロック領域判定回路が共有するため、ロック領域判定回路ごとにリプレース保護の設定/解除ができないという問題がある。   However, in the configuration of the cache memory control device according to the third embodiment, a plurality of address areas can be designated for replacement protection, but the access frequency counter and the tag memory replacement protection bit L are shared by a plurality of lock area determination circuits. Therefore, there is a problem that replacement protection cannot be set / released for each lock area determination circuit.

図10は本発明の第4の実施の形態におけるキャッシュメモリ制御装置の構成を示すブロック図である。   FIG. 10 is a block diagram showing the configuration of the cache memory control device according to the fourth embodiment of the present invention.

本実施の形態にかかわるキャッシュメモリ制御装置は、第3の実施の形態で説明したウェイ0のデータメモリ102とウェイ1のデータメモリ103とヒット検出器104,105と出力回路106,107とロック領域判定回路111,121と今回変更したウェイ0のタグメモリ200とウェイ1のタグメモリ201とリプレース制御回路112cと今回新たに追加したアクセス頻度カウンタ123から構成されている。第3の実施の形態の図9に示すOR回路118はない。   The cache memory control device according to the present embodiment includes the way 0 data memory 102, the way 1 data memory 103, the hit detectors 104 and 105, the output circuits 106 and 107, and the lock area described in the third embodiment. It comprises a judgment circuit 111, 121, a tag memory 200 of way 0 changed this time, a tag memory 201 of way 1, a replacement control circuit 112c, and an access frequency counter 123 newly added this time. There is no OR circuit 118 shown in FIG. 9 of the third embodiment.

以下では、第3の実施の形態とは異なる部分について説明する。   Below, a different part from 3rd Embodiment is demonstrated.

ウェイ0のタグメモリ200とウェイ1のタグメモリ201は、各ウェイのエントリ毎にタグアドレス、エントリの有効性を示す有効ビットV、エントリのロック状態を示す複数のビットで構成されたリプレース保護ビットLの保持を行う。今回、リプレース保護ビットLは2ビットで構成され、0ビット目はロック領域判定回路121から出力されるロック領域ヒット信号Sl1によって制御され、1ビット目はロック領域判定回路111から出力されるロック領域ヒット信号Sl2によって制御される。 The tag memory 200 of way 0 and the tag memory 201 of way 1 are a replacement protection bit composed of a tag address for each entry of each way, a valid bit V indicating the validity of the entry, and a plurality of bits indicating the lock state of the entry. L is held. This time, the replacement protection bit L is composed of 2 bits, the 0th bit is controlled by the lock area hit signal S1 1 output from the lock area determination circuit 121, and the 1st bit is the lock output from the lock area determination circuit 111. It is controlled by the area hit signal Sl 2.

リプレース制御回路112cは、ウェイ0のタグメモリ200とウェイ1のタグメモリ201の各エントリのリプレース保護ビットL(2ビット)、有効ビットVとアクセス頻度カウンタ113,123から出力されるアクセス頻度低下信号Sf2,Sf1を入力信号とし、リプレース動作を行うウェイの選択の制御を行う。 The replacement control circuit 112c is configured to replace the protection bits L (2 bits) and the valid bits V of the entries in the tag memory 200 of way 0 and the tag memory 201 of way 1 and the access frequency lowering signal output from the access frequency counters 113 and 123. Sf 2 and Sf 1 are used as input signals to control the way selection for the replacement operation.

アクセス頻度カウンタ123は、アクセス頻度カウンタ113と同じ構成であり、ロック領域判定回路121から出力されるロック領域ヒット信号Sl1をカウンタの初期値設定信号とする。 Access frequency counter 123 has the same configuration as the access frequency counter 113, the lock area hit signal Sl 1 outputted from the lock region determining circuit 121 and the counter initial value setting signal.

本実施の形態のキャッシュリプレース制御のフローは図6、図7に示される第2の実施の形態と同様であるので、ここでの説明は省略する。   Since the flow of the cache replacement control of the present embodiment is the same as that of the second embodiment shown in FIGS. 6 and 7, the description thereof is omitted here.

本実施の形態によれば、ロック領域判定回路を複数個使用し、複数領域のリプレース保護を行うキャッシュメモリにおいて、タグメモリのリプレース保護ビットLをどのリプレース保護領域のリプレース保護を行っているか特定できるビット数で構成することと、ロック領域判定回路ごとにアクセス頻度カウンタを持ってリプレース保護領域ごとのアクセス頻度の評価を行うことで、リプレース制御回路がリプレース保護領域ごとにリプレース保護の設定/解除を行うことが可能となり、効果的なリプレース保護を実現できる。   According to the present embodiment, in a cache memory that uses a plurality of lock area determination circuits and performs replacement protection for a plurality of areas, the replacement protection bit L of the tag memory can identify which replacement protection area is being replaced. By configuring the number of bits and having an access frequency counter for each lock area determination circuit to evaluate the access frequency for each replacement protection area, the replacement control circuit sets / releases the replacement protection for each replacement protection area. This makes it possible to implement effective replacement protection.

なお、複数のロック領域判定回路で設定されるリプレース保護領域のそれぞれに対して、リプレース保護優先度をリプレース制御回路112cにリプレース保護優先度に応じたリプレース保護制御を行う機能を加えることにより、キャッシュミスを生じたアドレスがリプレース保護領域内であり、リプレースの対象となるエントリのすべてのリプレース保護ビットLが“1”である場合に、優先度の低いエントリをリプレースし、優先度の高い領域の命令をキャッシュメモリに保持でき、キャッシュメモリの効果的な利用が可能となる。   For each of the replacement protection areas set by the plurality of lock area determination circuits, a function for performing replacement protection control according to the replacement protection priority is added to the replacement control circuit 112c for the replacement protection priority. If the address where the miss occurred is in the replacement protection area and all the replacement protection bits L of the entry to be replaced are “1”, the entry with the lower priority is replaced, The instruction can be held in the cache memory, and the cache memory can be effectively used.

(第5の実施の形態)
本発明の第5の実施の形態は、上記の第1の実施の形態における次のような問題点にも配慮したものである。
(Fifth embodiment)
The fifth embodiment of the present invention also takes into account the following problems in the first embodiment.

第1の実施の形態では、リプレース保護を実現するために、従来のタグメモリに対してエントリごとにリプレース保護状態を示すリプレース保護ビットLを追加している。リプレース保護ビットLの追加はリプレース保護を行うには有効な手段ではあるが、キャッシュメモリの容量が大きい場合にはタグメモリのエントリ数が増加するので、リプレース保護ビットLの追加によるタグメモリの物理面積増加が無視できなくなるという問題がある。   In the first embodiment, in order to realize the replacement protection, a replacement protection bit L indicating a replacement protection state for each entry is added to the conventional tag memory. Although the addition of the replacement protection bit L is an effective means for performing the replacement protection, the number of tag memory entries increases when the capacity of the cache memory is large. There is a problem that the increase in area cannot be ignored.

図11は本発明の第5の実施の形態のキャッシュメモリ制御装置の構成を示すブロック図である。   FIG. 11 is a block diagram showing the configuration of the cache memory control apparatus according to the fifth embodiment of the present invention.

本実施の形態のキャッシュメモリ制御装置は、ウェイ0のタグメモリ600とウェイ1のタグメモリ601とウェイ0のデータメモリ102とウェイ1のデータメモリ103とヒット検出器104,105と出力回路106,107とCPU108と比較器109とアドレス領域指定レジスタ110とロック領域判定回路111とリプレース制御回路112dから構成されている。108はCPU、800は外部メモリである。   The cache memory control apparatus according to the present embodiment includes a tag memory 600 of way 0, a tag memory 601 of way 1, a data memory 102 of way 0, a data memory 103 of way 1, hit detectors 104 and 105, an output circuit 106, 107, a CPU 108, a comparator 109, an address area designation register 110, a lock area determination circuit 111, and a replacement control circuit 112d. Reference numeral 108 denotes a CPU, and 800 denotes an external memory.

以下では、第1の実施の形態とは異なる部分について説明する。   Below, a different part from 1st Embodiment is demonstrated.

ウェイ0のタグメモリ600とウェイ1のタグメモリ601は、各ウェイのエントリ毎にタグアドレス、エントリの有効性を示す有効ビットVの保持を行う。   The tag memory 600 of way 0 and the tag memory 601 of way 1 hold a tag address and a valid bit V indicating the validity of the entry for each entry of each way.

リプレース制御回路112dは、ウェイ0のタグメモリ600とウェイ1のタグメモリ601の各エントリの有効ビットVとロック領域判定回路111から出力されるロック領域ヒット信号Slを入力信号とし、ロック領域判定回路111へ入力するウェイ0およびウェイ1のタグメモリ600,601から出力されているタグアドレスを選択するセレクタ161の制御信号を出力信号とし、リプレース動作を行うウェイの選択の制御を行う。   The replace control circuit 112d receives the valid bit V of each entry in the tag memory 600 of way 0 and the tag memory 601 of way 1 and the lock area hit signal S1 output from the lock area determination circuit 111 as input signals, and uses the lock area determination circuit. The control signal of the selector 161 that selects the tag addresses output from the tag memories 600 and 601 of the way 0 and the way 1 input to the control unit 111 is used as an output signal to control selection of the way to perform the replacement operation.

本実施の形態によれば、リプレース制御回路112dは、リプレース動作を実行するときに、ウェイ0、ウェイ1のリプレース対象となるエントリのタグアドレスを逐次、ロック領域判定回路111で比較を行い、キャッシュメモリに保持されているデータがリプレース動作から確実に保護するデータであるかの判定を行う。   According to the present embodiment, when executing the replacement operation, the replacement control circuit 112d sequentially compares the tag addresses of the entries to be replaced in the way 0 and the way 1 by the lock area determination circuit 111, and performs the cache operation. It is determined whether the data held in the memory is data that reliably protects from the replace operation.

これによって、リプレース保護ビットLをもったタグメモリを使用しなくてもリプレース保護を実現することが可能となり、リプレース保護ビットLの追加によるタグメモリの面積増加を招くことなく、リプレース保護が可能となる。   As a result, replacement protection can be realized without using a tag memory having the replacement protection bit L, and replacement protection can be performed without increasing the area of the tag memory due to the addition of the replacement protection bit L. Become.

なお、比較器109を複数設け、複数のウェイのタグアドレスとアドレス領域指定レジスタ110の値の比較を同時に行っても良い。   Note that a plurality of comparators 109 may be provided, and the tag addresses of a plurality of ways and the value of the address area designation register 110 may be compared simultaneously.

(第6の実施の形態)
図12は本発明の第6の実施の形態におけるキャッシュメモリ制御装置の構成を示すブロック図である。
(Sixth embodiment)
FIG. 12 is a block diagram showing the configuration of the cache memory control apparatus according to the sixth embodiment of the present invention.

第1の実施の形態は、指定されたアドレス領域に対してリプレースの保護を行うものであるが、本実施の形態ではタスク単位でリプレース保護を行うものである。   In the first embodiment, replacement protection is performed for a designated address area. In this embodiment, replacement protection is performed in units of tasks.

本実施の形態のキャッシュメモリ制御装置は、第1の実施の形態で説明したウェイ0のタグメモリ100とウェイ1のタグメモリ101とウェイ0のデータメモリ102とウェイ1のデータメモリ103とヒット検出器104,105と出力回路106,107とリプレース制御回路112と今回構造を変更したロック領域判定回路501から構成されている。ロック領域判定回路501は、リプレース保護対象のタスクIDを保持するタスクID指定レジスタ500と比較器109aから構成されている。   The cache memory control device according to the present embodiment includes the way 0 tag memory 100, the way 1 tag memory 101, the way 0 data memory 102, the way 1 data memory 103, and the hit detection described in the first embodiment. And 104, the output circuits 106 and 107, the replacement control circuit 112, and the lock region determination circuit 501 whose structure has been changed this time. The lock area determination circuit 501 includes a task ID specification register 500 that holds a task ID to be replaced and a comparator 109a.

以下では、第1の実施の形態とは異なる部分について説明する。   Below, a different part from 1st Embodiment is demonstrated.

CPU108は、現在実行中のタスクが持つタスクIDをロック領域判定回路501へ出力するように構成されている。   The CPU 108 is configured to output the task ID of the currently executing task to the lock area determination circuit 501.

ロック領域判定回路501は、その比較器109aにおいて、タスクID指定レジスタ500に保持されたリプレース保護対象のタスクIDとCPU108から出力された実行中のタスクのタスクIDとを比較し、結果が一致した場合にロック領域ヒット信号Slを出力するように構成されている。そのロック領域ヒット信号Slは、ウェイ0のタグメモリ100とウェイ1のタグメモリ101の該当するエントリのリプレース保護ビットLに“1”をセットする。   In the comparator 109a, the lock area determination circuit 501 compares the task ID of the replacement protection target held in the task ID designation register 500 with the task ID of the task being executed output from the CPU 108, and the results match. In this case, the lock area hit signal S1 is output. The lock area hit signal S1 sets “1” to the replacement protection bit L of the corresponding entry in the tag memory 100 of way 0 and the tag memory 101 of way 1.

本実施の形態によれば、リプレース保護の指定をメモリアドレスではなく、タスクIDとすることで、タスク単位でのリプレース保護を行うことが可能となり、タスクで使用するアドレス領域を調べる必要がなく、容易なリプレース保護設定が可能となる。   According to the present embodiment, by specifying replacement protection as a task ID instead of a memory address, replacement protection can be performed in units of tasks, and there is no need to examine an address area used in a task. Easy replacement protection setting is possible.

(第7の実施の形態)
図13は本発明の第7の実施の形態のキャッシュメモリ制御装置の構成を示すブロック図である。
(Seventh embodiment)
FIG. 13 is a block diagram showing the configuration of the cache memory control apparatus according to the seventh embodiment of the present invention.

これは、第4の実施の形態などにあるアクセス頻度カウンタ113と同様の機能を有するタスク頻度カウンタ113aを設けたものである。このタスク頻度カウンタ113aは、ロック領域判定回路501から出力されるロック領域ヒット信号Slを用いて、プログラムがリプレースから保護しているタスクの実行を行わない実行状況になったことを検出し、その検出信号をリプレース制御回路112dに出力する。検出信号を受け取ったリプレース制御回路112dは、リプレース保護を自動的に無効化する。これにより、キャッシュメモリの効率的な利用が可能となる。   This is a task frequency counter 113a having the same function as the access frequency counter 113 in the fourth embodiment. The task frequency counter 113a uses the lock area hit signal S1 output from the lock area determination circuit 501 to detect that the program has entered an execution state in which the task protected from replacement is not executed. The detection signal is output to the replacement control circuit 112d. The replacement control circuit 112d that has received the detection signal automatically disables the replacement protection. Thereby, the cache memory can be used efficiently.

また、図14はリプレース保護をタクス単位で行う代わりにCPU108から出力される割り込みレベルに変更した実施の形態のキャッシュメモリ制御装置の構成を示すブロック図である。   FIG. 14 is a block diagram showing the configuration of the cache memory control device according to the embodiment in which the replacement protection is changed to the interrupt level output from the CPU 108 instead of performing the protection in units of tasks.

図12におけるタスクID指定レジスタ500を割り込みレベル指定レジスタ510に変更して、割り込みレベル単位でリプレース保護を行うものである。その場合、割り込みレベル指定レジスタ510にあらかじめ設定された値と、CPU108が出力する割り込みレベル信号を比較して、ロック領域ヒット信号Slを出力し、これによってエントリのリプレース保護ビットLが設定され、リプレース時のウェイ選択に用いる。   The task ID designation register 500 in FIG. 12 is changed to the interrupt level designation register 510, and replacement protection is performed in units of interrupt levels. In that case, the value set in advance in the interrupt level designation register 510 is compared with the interrupt level signal output from the CPU 108, and the lock area hit signal S1 is output. Thereby, the replace protection bit L of the entry is set and replaced. Used for time way selection.

なお、第1〜第6の実施の形態では、命令に対するキャッシュのアクセスについて説明したが、データのアクセスについても同様である。   In the first to sixth embodiments, cache access to instructions has been described, but the same applies to data access.

また、キャッシュメモリとして2ウェイ構成のものについて説明したが、2ウェイ以外の構成でも同様である。   Further, the cache memory having the 2-way configuration has been described, but the configuration is the same for configurations other than the 2-way.

また、ロック領域を指定するのに、アドレス領域指定レジスタ110にロック領域の先頭アドレスと最終アドレスを設定するとしたが、領域のアドレスに共通な上位部を設定するとしても良い。これにより設定された上位部のみと比較することで、アドレスがロック領域に含まれるか判定される。   In order to specify the lock area, the start address and the final address of the lock area are set in the address area specifying register 110. However, a common upper part may be set for the address of the area. In this way, it is determined whether or not the address is included in the lock area by comparing only with the set upper part.

本発明のキャッシュメモリ制御装置および制御方法は、リプレース保護を設定する機能を有し、マイクロプロセッサやキャッシュメモリを使用する情報処理装置等に対して有用である。   The cache memory control device and the control method of the present invention have a function of setting replacement protection, and are useful for an information processing device using a microprocessor or a cache memory.

本発明の第1の実施の形態のキャッシュメモリ制御装置の構成を示すブロック図The block diagram which shows the structure of the cache memory control apparatus of the 1st Embodiment of this invention 第1の実施の形態のキャッシュメモリアクセス制御の動作を示すフローチャートThe flowchart which shows the operation | movement of the cache memory access control of 1st Embodiment 第1の実施の形態のロック領域判定回路の動作を示すフローチャートThe flowchart which shows operation | movement of the lock area | region determination circuit of 1st Embodiment. 第1の実施の形態で実行されるプログラムの一部Part of the program executed in the first embodiment 本発明の第2の実施の形態のキャッシュメモリ制御装置の構成を示すブロック図The block diagram which shows the structure of the cache memory control apparatus of the 2nd Embodiment of this invention 第2の実施の形態のキャッシュメモリアクセス制御の動作を示すフローチャートThe flowchart which shows the operation | movement of the cache memory access control of 2nd Embodiment 第2の実施の形態のロック領域判定回路の動作を示すフローチャートThe flowchart which shows operation | movement of the lock area | region determination circuit of 2nd Embodiment. 本発明の第2の実施の形態の変形の形態のキャッシュメモリ制御装置の構成を示すブロック図The block diagram which shows the structure of the cache memory control apparatus of the deformation | transformation form of the 2nd Embodiment of this invention. 本発明の第3の実施の形態のキャッシュメモリ制御装置の構成を示すブロック図The block diagram which shows the structure of the cache memory control apparatus of the 3rd Embodiment of this invention 本発明の第4の実施の形態のキャッシュメモリ制御装置の構成を示すブロック図The block diagram which shows the structure of the cache memory control apparatus of the 4th Embodiment of this invention 本発明の第5の実施の形態のキャッシュメモリ制御装置の構成を示すブロック図The block diagram which shows the structure of the cache memory control apparatus of the 5th Embodiment of this invention 本発明の第6の実施の形態のキャッシュメモリ制御装置の構成を示すブロック図The block diagram which shows the structure of the cache memory control apparatus of the 6th Embodiment of this invention 本発明の第7の実施の形態のキャッシュメモリ制御装置の構成を示すブロック図The block diagram which shows the structure of the cache memory control apparatus of the 7th Embodiment of this invention 本発明の第7の実施の形態の変形の形態のキャッシュメモリ制御装置の構成を示すブロック図Block diagram showing a configuration of a cache memory control device according to a modification of the seventh embodiment of the present invention

符号の説明Explanation of symbols

100,200,301,600 ウェイ0のタグメモリ
101,201,302,601 ウェイ1のタグメモリ
102 ウェイの0データメモリ
103 ウェイ1のデータメモリ
104,105 ヒット検出器
106,107 出力回路
108 CPU
109,109a 比較器
110 アドレス領域指定レジスタ
111,121,501,511 ロック領域判定回路
112,112a,112b,112c,112d リプレース制御回路
113,123 アクセス頻度カウンタ
113a タスク頻度カウンタ
118 OR回路
500 タスクID指定レジスタ
510 割り込みレベル指定レジスタ
800 外部メモリ
100, 200, 301, 600 Way 0 tag memory 101, 201, 302, 601 Way 1 tag memory 102 Way 0 data memory 103 Way 1 data memory 104, 105 Hit detector 106, 107 Output circuit 108 CPU
109, 109a Comparator 110 Address area designation register 111, 121, 501, 511 Lock area determination circuit 112, 112a, 112b, 112c, 112d Replacement control circuit 113, 123 Access frequency counter 113a Task frequency counter 118 OR circuit 500 Task ID designation Register 510 Interrupt level specification register 800 External memory

Claims (19)

有効ビットとリプレース保護ビットとタグアドレスを保持するエントリを複数備えるタグメモリと、
前記タグメモリのエントリに対応したデータを保持するデータメモリと、
前記タグメモリから出力される前記タグアドレスとアクセス要求アドレスとの比較および前記有効ビットの値に基づいてキャッシュヒットを検出するキャッシュヒット検出手段と、
リプレース保護対象のアドレス領域と前記アクセス要求アドレスとを比較して、一致するときにロック領域ヒット信号を出力するロック領域判定手段と、
前記タグメモリが保持する前記有効ビットの値と前記リプレース保護ビットの値を入力とし、リプレース対象ウェイを選択するリプレース制御手段とを備え、
前記タグメモリは、前記ロック領域ヒット信号に応じて該当する前記エントリの前記リプレース保護ビットを有効にし、
前記リプレース制御手段は、前記リプレース保護ビットが有効でないエントリを優先的にリプレース対象として選択することを特徴とするキャッシュメモリ制御装置。
A tag memory having a plurality of entries holding valid bits, replacement protection bits, and tag addresses;
A data memory for holding data corresponding to the entry of the tag memory;
A cache hit detection means for detecting a cache hit based on a comparison between the tag address output from the tag memory and an access request address and a value of the valid bit;
A lock area determination unit that compares the address area to be replaced with the access request address and outputs a lock area hit signal when they match,
A replacement control means for selecting the way to be replaced, using the value of the effective bit held by the tag memory and the value of the replacement protection bit as inputs; and
The tag memory enables the replace protection bit of the entry corresponding to the lock area hit signal,
The cache memory control device, wherein the replacement control means preferentially selects an entry for which the replacement protection bit is not valid as a replacement target.
前記ロック領域判定手段は、
前記リプレース保護対象のアドレス領域を指定するアドレス領域指定手段と、
前記アドレス領域指定手段が保持する値と前記アクセス要求アドレスを比較する比較手段とを備えている請求項1に記載のキャッシュメモリ制御装置。
The lock area determination means includes
Address area specifying means for specifying the address area to be replaced,
2. The cache memory control device according to claim 1, further comprising a comparison unit that compares the value held by the address area designating unit with the access request address.
前記タグメモリがさらにリプレース保護をソフトウェアにより制御可能なリプレース保護許可ビットを備え、前記リプレース制御手段は、前記リプレース保護許可ビットに基づいて有効となっているリプレース保護の無効化を行うことを特徴とする請求項1または請求項2に記載のキャッシュメモリ制御装置。   The tag memory further includes a replacement protection permission bit capable of controlling replacement protection by software, and the replacement control means invalidates the replacement protection that is enabled based on the replacement protection permission bit. The cache memory control device according to claim 1 or 2. 有効ビットとリプレース保護ビットとタグアドレスを保持するエントリを複数備えるタグメモリと、
前記タグメモリのエントリに対応したデータを保持するデータメモリと、
前記タグメモリから出力される前記タグアドレスとアクセス要求アドレスとの比較および前記有効ビットの値に基づいてキャッシュヒットを検出するキャッシュヒット検出手段と、
リプレース保護対象のアドレス領域と前記アクセス要求アドレスとを比較して、一致するときにロック領域ヒット信号を出力するロック領域判定手段と、
前記ロック領域判定手段が出力する前記ロック領域ヒット信号によりリプレース保護対象のアドレス領域へのアクセス頻度を評価し、前記アクセス頻度の低下を検出したときにアクセス頻度低下信号を出力するアクセス頻度評価手段と、
前記タグメモリが保持する前記有効ビットの値と前記リプレース保護ビットの値と前記アクセス頻度評価手段が出力する前記アクセス頻度低下信号を入力とし、リプレース対象ウェイを選択するリプレース制御手段とを備え、
前記タグメモリは、前記ロック領域ヒット信号に応じて該当する前記エントリの前記リプレース保護ビットを有効にし、
前記リプレース制御手段は、前記アクセス頻度低下信号が有効な場合はリプレース保護を無効化してリプレース対象エントリを選択し、前記アクセス頻度低下信号が無効な場合は前記リプレース保護ビットが有効でないエントリを優先的にリプレース対象として選択することを特徴とするキャッシュメモリ制御装置。
A tag memory having a plurality of entries holding valid bits, replacement protection bits, and tag addresses;
A data memory for holding data corresponding to the entry of the tag memory;
A cache hit detection means for detecting a cache hit based on a comparison between the tag address output from the tag memory and an access request address and a value of the valid bit;
A lock area determination unit that compares the address area to be replaced with the access request address and outputs a lock area hit signal when they match,
An access frequency evaluation unit that evaluates the access frequency to the address area to be replaced by the lock area hit signal output from the lock area determination unit and outputs an access frequency decrease signal when the decrease in the access frequency is detected; ,
A replacement control means for selecting a replacement target way with the value of the effective bit held by the tag memory, the value of the replacement protection bit, and the access frequency lowering signal output by the access frequency evaluation means as inputs;
The tag memory enables the replace protection bit of the entry corresponding to the lock area hit signal,
When the access frequency lowering signal is valid, the replacement control unit invalidates the replacement protection and selects a replacement target entry, and when the access frequency lowering signal is invalid, the replacement control unit preferentially selects an entry whose replacement protection bit is not valid. The cache memory control device is characterized in that it is selected as a replacement target.
前記ロック領域判定手段は、
前記リプレース保護対象のアドレス領域を指定するアドレス領域指定手段と、
前記アドレス領域指定手段が保持する値と前記アクセス要求アドレスを比較する比較手段とを備えている請求項4に記載のキャッシュメモリ制御装置。
The lock area determination means includes
Address area specifying means for specifying the address area to be replaced,
5. The cache memory control device according to claim 4, further comprising a comparison unit that compares the value held by the address area designating unit with the access request address.
さらに、前記有効ビットと前記リプレース保護ビットの両方が有効な値を持つすべてのエントリの前記有効ビットを無効化するエントリ無効手段を備え、
前記リプレース制御手段は、前記アクセス頻度低下信号が有効になったときに前記タグメモリの前記エントリ無効手段を動作させるように構成されている請求項4または請求項5に記載のキャッシュメモリ制御装置。
Furthermore, an entry invalidating means for invalidating the valid bit of all entries in which both the valid bit and the replacement protection bit have valid values,
6. The cache memory control device according to claim 4, wherein the replacement control means is configured to operate the entry invalidation means of the tag memory when the access frequency lowering signal becomes valid.
有効ビットとリプレース保護ビットとタグアドレスを保持するエントリを複数備えるタグメモリと、
前記タグメモリのエントリに対応したデータを保持するデータメモリと、
前記タグメモリから出力される前記タグアドレスとアクセス要求アドレスとの比較および前記有効ビットの値に基づいてキャッシュヒットを検出するキャッシュヒット検出手段と、
リプレース保護対象のアドレス領域と前記アクセス要求アドレスとを比較して、一致するときにロック領域ヒット信号を出力する複数のロック領域判定手段と、
前記ロック領域判定手段が出力する前記ロック領域ヒット信号によりリプレース保護対象のアドレス領域へのアクセス頻度を評価し、前記アクセス頻度の低下を検出したときにアクセス頻度低下信号を出力するアクセス頻度評価手段と、
前記タグメモリが保持する前記有効ビットの値と前記リプレース保護ビットの値と前記アクセス頻度評価手段が出力する前記アクセス頻度低下信号を入力とし、リプレース対象ウェイを選択するリプレース制御手段とを備え、
複数の前記ロック領域判定手段で複数のアドレス領域にリプレース保護を設定し、
前記タグメモリは、前記ロック領域ヒット信号に応じて該当する前記エントリの前記リプレース保護ビットを有効にし、
前記リプレース制御手段は、前記アクセス頻度低下信号が有効な場合はリプレース保護を無効化してリプレース対象エントリを選択し、前記アクセス頻度低下信号が無効な場合は前記リプレース保護ビットが有効でないエントリを優先的にリプレース対象として選択することを特徴とするキャッシュメモリ制御装置。
A tag memory having a plurality of entries holding valid bits, replacement protection bits, and tag addresses;
A data memory for holding data corresponding to the entry of the tag memory;
A cache hit detection means for detecting a cache hit based on a comparison between the tag address output from the tag memory and an access request address and a value of the valid bit;
A plurality of lock area determination means for comparing the address area to be replaced with the access request address and outputting a lock area hit signal when they match;
An access frequency evaluation unit that evaluates the access frequency to the address area to be replaced by the lock area hit signal output from the lock area determination unit and outputs an access frequency decrease signal when the decrease in the access frequency is detected; ,
A replacement control means for selecting a replacement target way with the value of the effective bit held by the tag memory, the value of the replacement protection bit, and the access frequency lowering signal output by the access frequency evaluation means as inputs;
Set replacement protection for a plurality of address areas by a plurality of the lock area determination means,
The tag memory enables the replace protection bit of the entry corresponding to the lock area hit signal,
When the access frequency lowering signal is valid, the replacement control unit invalidates the replacement protection and selects a replacement target entry, and when the access frequency lowering signal is invalid, the replacement control unit preferentially selects an entry whose replacement protection bit is not valid. The cache memory control device is characterized in that it is selected as a replacement target.
前記ロック領域判定手段は、
前記リプレース保護対象のアドレス領域を指定するアドレス領域指定手段と、
前記アドレス領域指定手段が保持する値と前記アクセス要求アドレスを比較する比較手段とを備えている請求項7に記載のキャッシュメモリ制御装置。
The lock area determination means includes
Address area specifying means for specifying the address area to be replaced,
8. The cache memory control device according to claim 7, further comprising a comparison unit that compares the value held by the address area designating unit with the access request address.
有効ビットと複数のリプレース保護ビットとタグアドレスを保持するエントリを複数備えるタグメモリと、
前記タグメモリのエントリに対応したデータを保持するデータメモリと、
前記タグメモリから出力される前記タグアドレスとアクセス要求アドレスとの比較および前記有効ビットの値に基づいてキャッシュヒットを検出するキャッシュヒット検出手段と、
リプレース保護対象のアドレス領域と前記アクセス要求アドレスとを比較して、一致するときにロック領域ヒット信号を出力する複数のロック領域判定手段と、
前記ロック領域判定手段が出力する前記ロック領域ヒット信号によりリプレース保護対象のアドレス領域へのアクセス頻度を評価し、前記アクセス頻度の低下を検出したときにアクセス頻度低下信号を出力する複数のアクセス頻度評価手段と、
前記タグメモリが保持する前記有効ビットの値と複数の前記リプレース保護ビットの値と複数の前記アクセス頻度評価手段が出力する前記アクセス頻度低下信号を入力とし、リプレース対象ウェイを選択するリプレース制御手段とを備え、
複数の前記ロック領域判定手段で複数のアドレス領域にリプレース保護を設定し、
前記タグメモリは、複数の前記ロック領域ヒット信号に応じて該当する前記エントリの前記ロック領域ヒット信号に対応する前記リプレース保護ビットを有効にし、
前記リプレース制御手段は、前記アクセス頻度低下信号が有効な場合はリプレース保護を無効化してリプレース対象エントリを選択し、前記アクセス頻度低下信号が無効な場合は前記リプレース保護ビットが有効でないエントリを優先的にリプレース対象として選択することを特徴とするキャッシュメモリ制御装置。
A tag memory having a plurality of entries holding valid bits, a plurality of replacement protection bits, and a tag address;
A data memory for holding data corresponding to the entry of the tag memory;
A cache hit detection means for detecting a cache hit based on a comparison between the tag address output from the tag memory and an access request address and a value of the valid bit;
A plurality of lock area determination means for comparing the address area to be replaced with the access request address and outputting a lock area hit signal when they match;
A plurality of access frequency evaluations that evaluate the access frequency to the address area to be replaced by the lock area hit signal output by the lock area determination means and output an access frequency decrease signal when the access frequency decrease is detected Means,
A replacement control means for selecting a replacement target way by inputting the value of the effective bit held in the tag memory, the values of the plurality of replacement protection bits, and the access frequency decrease signal output by the plurality of access frequency evaluation means; With
Set replacement protection for a plurality of address areas by a plurality of the lock area determination means,
The tag memory enables the replace protection bit corresponding to the lock area hit signal of the entry corresponding to a plurality of the lock area hit signals,
When the access frequency lowering signal is valid, the replacement control unit invalidates the replacement protection and selects a replacement target entry, and when the access frequency lowering signal is invalid, the replacement control unit preferentially selects an entry whose replacement protection bit is not valid. The cache memory control device is characterized in that it is selected as a replacement target.
前記ロック領域判定手段は、
前記リプレース保護対象のアドレス領域を指定するアドレス領域指定手段と、
前記アドレス領域指定手段が保持する値と前記アクセス要求アドレスを比較する比較手段とを備えている請求項9に記載のキャッシュメモリ制御装置。
The lock area determination means includes
Address area specifying means for specifying the address area to be replaced,
The cache memory control device according to claim 9, further comprising a comparison unit that compares the value held by the address area designating unit with the access request address.
有効ビットとタグアドレスを保持するエントリを複数備えるタグメモリと、
前記タグメモリのエントリに対応したデータを保持するデータメモリと、
前記タグメモリから出力される前記タグアドレスとアクセス要求アドレスとの比較および前記有効ビットの値に基づいてキャッシュヒットを検出するキャッシュヒット検出手段と、
リプレース保護対象のアドレス領域と前記タグメモリから出力される前記タグアドレスとを比較して、一致するときにロック領域ヒット信号を出力する複数のロック領域判定手段と、
前記タグメモリが保持する前記有効ビットの値と前記ロック領域ヒット信号を入力とし、リプレース対象ウェイを選択するリプレース制御手段とを備え、
それらによってアドレス空間を指定したリプレース保護を行うことを特徴とするキャッシュメモリ制御装置。
A tag memory having a plurality of entries holding valid bits and tag addresses;
A data memory for holding data corresponding to the entry of the tag memory;
A cache hit detection means for detecting a cache hit based on a comparison between the tag address output from the tag memory and an access request address and a value of the valid bit;
A plurality of lock area determination means for comparing the address area to be protected for replacement with the tag address output from the tag memory and outputting a lock area hit signal when they match.
A replacement control means for selecting the way to be replaced with the value of the effective bit held in the tag memory and the lock area hit signal as inputs, and
A cache memory control device that performs replacement protection by designating an address space by them.
前記ロック領域判定手段は、
前記リプレース保護対象のアドレス領域を指定するアドレス領域指定手段と、
前記アドレス領域指定手段が保持する値と前記アクセス要求アドレスを比較する比較手段とを備えている請求項11に記載のキャッシュメモリ制御装置。
The lock area determination means includes
Address area specifying means for specifying the address area to be replaced,
12. The cache memory control device according to claim 11, further comprising a comparison unit that compares the value held by the address area designating unit with the access request address.
有効ビットとリプレース保護ビットとタグアドレスを保持するエントリを複数備えるタグメモリと、
前記タグメモリのエントリに対応したデータを保持するデータメモリと、
前記タグメモリから出力される前記タグアドレスとアクセス要求アドレスとの比較および前記有効ビットの値に基づいてキャッシュヒットを検出するキャッシュヒット検出手段と、
リプレース保護対象のタスクIDとCPUが出力する実行中のタスクIDとを比較して、一致するときにロック領域ヒット信号を出力するロック領域判定手段と、
前記タグメモリが保持する前記有効ビットの値と前記リプレース保護ビットの値を入力とし、リプレース対象ウェイを選択するリプレース制御手段とを備え、
それらによって、タスクIDを指定したリプレース保護を行うことを特徴とするキャッシュメモリ制御装置。
A tag memory having a plurality of entries holding valid bits, replacement protection bits, and tag addresses;
A data memory for holding data corresponding to the entry of the tag memory;
A cache hit detection means for detecting a cache hit based on a comparison between the tag address output from the tag memory and an access request address and a value of the valid bit;
A lock area determination unit that compares a task ID to be replaced with a task ID being executed output by the CPU and outputs a lock area hit signal when they match,
A replacement control means for selecting the way to be replaced, using the value of the effective bit held by the tag memory and the value of the replacement protection bit as inputs; and
A cache memory control device that performs replacement protection by designating a task ID using them.
前記ロック領域判定手段は、
前記リプレース保護対象のタスクIDを指定するタスクID指定手段と、
前記タスクID指定手段が保持するタスクIDと前記実行中のタスクIDを比較する比較手段とを備えている請求項13に記載のキャッシュメモリ制御装置。
The lock area determination means includes
Task ID designation means for designating the task ID of the replacement protection target;
14. The cache memory control device according to claim 13, further comprising a comparison unit that compares the task ID held by the task ID designating unit with the task ID being executed.
さらに、前記ロック領域判定手段が出力する前記ロック領域ヒット信号によりリプレース保護対象のタスクの実行頻度を評価し、前記実行頻度の低下を検出したときに実行頻度低下信号を出力するタスク実行頻度評価手段を備え、
前記リプレース制御手段は、前記タスク実行頻度評価手段が出力する実行頻度低下信号を入力として加え、前記実行頻度低下信号が有効な場合はリプレース保護を無効化してリプレース対象エントリを選択するように構成されている請求項13または請求項14に記載のキャッシュメモリ制御装置。
Further, a task execution frequency evaluation unit that evaluates the execution frequency of a task subject to replacement protection based on the lock region hit signal output from the lock region determination unit and outputs an execution frequency decrease signal when the decrease in the execution frequency is detected. With
The replacement control unit is configured to add an execution frequency decrease signal output from the task execution frequency evaluation unit as an input, and when the execution frequency decrease signal is valid, invalidate the replacement protection and select a replacement target entry. 15. The cache memory control device according to claim 13 or claim 14.
有効ビットとリプレース保護ビットとタグアドレスを保持するエントリを複数備えるタグメモリと、
前記タグメモリから出力される前記タグアドレスとアクセス要求アドレスとの比較および前記有効ビットの値に基づいてキャッシュヒットを検出するキャッシュヒット検出手段と、
リプレース保護対象の割り込みレベルとCPUが出力する実行中の割り込みレベルとを比較して、一致するときにロック領域ヒット信号を出力するロック領域判定手段と、
前記タグメモリが保持する前記有効ビットの値と前記リプレース保護ビットの値を入力とし、リプレース対象ウェイを選択するリプレース制御手段とを備え、
それらによって、割り込みレベルを指定したリプレース保護を行うことを特徴とするキャッシュメモリ制御装置。
A tag memory having a plurality of entries holding valid bits, replacement protection bits, and tag addresses;
A cache hit detection means for detecting a cache hit based on a comparison between the tag address output from the tag memory and an access request address and a value of the valid bit;
A lock area determination unit that compares the interrupt level to be replaced with the interrupt level being executed output by the CPU and outputs a lock area hit signal when they match,
A replacement control means for selecting the way to be replaced, using the value of the effective bit held by the tag memory and the value of the replacement protection bit as inputs; and
A cache memory control device that performs replacement protection by designating an interrupt level.
前記ロック領域判定手段は、
前記リプレース保護対象の割り込みレベルを指定する割り込みレベル指定手段と、
前記割り込みレベル指定手段が保持する割り込みレベルと前記実行中の割り込みレベルを比較する比較手段とを備えている請求項16に記載のキャッシュメモリ制御装置。
The lock area determination means includes
Interrupt level designating means for designating the interrupt level to be replaced,
17. The cache memory control device according to claim 16, further comprising a comparison unit that compares the interrupt level held by the interrupt level designating unit with the interrupt level being executed.
CPUからのアクセス要求がリプレース保護対象のアドレス領域へのアクセスであるかを判定する領域判定ステップと、
キャッシュミスによるリプレースを行うエントリとして有効ビットが設定されていないエントリを選択する選択ステップ1と、
前記選択ステップ1でリプレースを行うエントリを選択できなかった場合に、リプレース保護ビットが設定されていないエントリを選択する選択ステップ2と、
前記選択ステップ1、選択ステップ2のいずれかによって選択されたエントリへデータを書き込む書き込みステップと、
前記領域判定ステップの結果を選択されたエントリのリプレース保護ビットに書き込む保護設定ステップとを含むことを特徴とするキャッシュメモリ制御方法。
An area determination step for determining whether an access request from the CPU is an access to an address area targeted for replacement protection;
Selection step 1 for selecting an entry for which a valid bit is not set as an entry to be replaced due to a cache miss;
A selection step 2 for selecting an entry in which the replacement protection bit is not set when an entry to be replaced cannot be selected in the selection step 1;
A writing step of writing data to the entry selected by either the selection step 1 or the selection step 2;
A cache memory control method comprising: a protection setting step of writing a result of the area determination step into a replacement protection bit of a selected entry.
CPUからのアクセス要求がリプレース保護対象のアドレス領域へのアクセスであるかを判定する領域判定ステップと、
前記リプレース保護対象のアドレス領域へのアクセス頻度を評価し、前記アクセス頻度が低下するとアクセス頻度低下信号を出力するアクセス頻度評価ステップと、
キャッシュミスによるリプレースを行うエントリとして有効ビットが設定されていないエントリを選択する選択ステップ1と、
前記選択ステップ1でリプレースを行うエントリを選択できず、かつ前記アクセス頻度低下信号によりアクセス頻度が低下していないことが示された場合に、リプレースを行うエントリとしてリプレース保護ビットが設定されていないエントリを選択する選択ステップ2と、
前記選択ステップ1でリプレースを行うエントリを選択できず、かつ前記アクセス頻度低下信号によりアクセス頻度の低下が示された場合に、前記リプレース保護ビットに関係なくリプレースすべきエントリを選択する選択ステップ3と、
前記選択ステップ1、選択ステップ2、選択ステップ3のいずれかによって選択されたエントリへデータを書き込む書き込みステップと、
前記領域判定ステップの結果を選択されたエントリのリプレース保護ビットに書き込む保護設定ステップとを含むことを特徴とするキャッシュメモリ制御方法。
An area determination step for determining whether an access request from the CPU is an access to an address area targeted for replacement protection;
An access frequency evaluation step of evaluating an access frequency to the replacement protected address area and outputting an access frequency decrease signal when the access frequency decreases;
Selection step 1 for selecting an entry for which a valid bit is not set as an entry to be replaced due to a cache miss;
An entry in which the replacement protection bit is not set as an entry to be replaced when the entry to be replaced cannot be selected in the selection step 1 and the access frequency lowering signal indicates that the access frequency has not decreased. Selection step 2 for selecting
A selection step 3 for selecting an entry to be replaced regardless of the replacement protection bit when the entry to be replaced cannot be selected in the selection step 1 and the access frequency decrease signal indicates a decrease in the access frequency; ,
A writing step of writing data to the entry selected by any of the selection step 1, the selection step 2 and the selection step 3;
A cache memory control method comprising: a protection setting step of writing a result of the area determination step into a replacement protection bit of a selected entry.
JP2004112768A 2004-04-07 2004-04-07 Cache memory controller and cache memory control method Pending JP2005301387A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004112768A JP2005301387A (en) 2004-04-07 2004-04-07 Cache memory controller and cache memory control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004112768A JP2005301387A (en) 2004-04-07 2004-04-07 Cache memory controller and cache memory control method

Publications (1)

Publication Number Publication Date
JP2005301387A true JP2005301387A (en) 2005-10-27

Family

ID=35332887

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004112768A Pending JP2005301387A (en) 2004-04-07 2004-04-07 Cache memory controller and cache memory control method

Country Status (1)

Country Link
JP (1) JP2005301387A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007048286A (en) * 2005-08-05 2007-02-22 Fujitsu Ltd Power consumption reduction method in cache, logical unit, and system
JP2007048285A (en) * 2005-08-05 2007-02-22 Fujitsu Ltd Power consumption reducing method and logical device and system in cache
JP2008269224A (en) * 2007-04-19 2008-11-06 Internatl Business Mach Corp <Ibm> Technique for caching data
JP2009122787A (en) * 2007-11-13 2009-06-04 Nec Computertechno Ltd Multiprocessor system
JP2011129101A (en) * 2009-12-16 2011-06-30 Intel Corp Replacing cache line in cache memory
JP2011221900A (en) * 2010-04-13 2011-11-04 Mitsubishi Electric Corp Data storage device
JP2019114013A (en) * 2017-12-22 2019-07-11 株式会社富士通アドバンストエンジニアリング Arithmetic processing apparatus and control method of arithmetic processing apparatus

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007048286A (en) * 2005-08-05 2007-02-22 Fujitsu Ltd Power consumption reduction method in cache, logical unit, and system
JP2007048285A (en) * 2005-08-05 2007-02-22 Fujitsu Ltd Power consumption reducing method and logical device and system in cache
JP2008269224A (en) * 2007-04-19 2008-11-06 Internatl Business Mach Corp <Ibm> Technique for caching data
JP2009122787A (en) * 2007-11-13 2009-06-04 Nec Computertechno Ltd Multiprocessor system
JP2011129101A (en) * 2009-12-16 2011-06-30 Intel Corp Replacing cache line in cache memory
US8990506B2 (en) 2009-12-16 2015-03-24 Intel Corporation Replacing cache lines in a cache memory based at least in part on cache coherency state information
JP2011221900A (en) * 2010-04-13 2011-11-04 Mitsubishi Electric Corp Data storage device
JP2019114013A (en) * 2017-12-22 2019-07-11 株式会社富士通アドバンストエンジニアリング Arithmetic processing apparatus and control method of arithmetic processing apparatus
JP7144670B2 (en) 2017-12-22 2022-09-30 富士通株式会社 Arithmetic processing device and method of controlling arithmetic processing device

Similar Documents

Publication Publication Date Title
JP4098347B2 (en) Cache memory and control method thereof
CN102687128B (en) Computational processing device
JP5536655B2 (en) Cache memory, memory system, and data copy method
US20200341770A1 (en) Multiple-table branch target buffer
JP4574712B2 (en) Arithmetic processing apparatus, information processing apparatus and control method
US7447844B2 (en) Data processing system, processor and method of data processing in which local memory access requests are serviced on a fixed schedule
WO2010004497A1 (en) Cache management systems and methods
JP4008947B2 (en) Cache memory and control method thereof
KR101472967B1 (en) Cache memory and method capable of write-back operation, and system having the same
JP2000148590A (en) Device and method for locking cache
US20050188158A1 (en) Cache memory with improved replacement policy
JP3438650B2 (en) Cache memory
JP4009304B2 (en) Cache memory and cache memory control method
JP2005301387A (en) Cache memory controller and cache memory control method
US20070083718A1 (en) Cache memory and control method thereof
KR20050007907A (en) Cache memory device having dynamically-allocated or deallocated buffers, digital data processing system comprising it and method thereof
JP5699854B2 (en) Storage control system and method, replacement method and method
EP2159707A1 (en) Arithmetic processing unit, entry control program, and entry control method
US20110179227A1 (en) Cache memory and method for cache entry replacement based on modified access order
US8255632B2 (en) Pre-fetch control apparatus
JP2006091995A (en) Write-back device of cache memory
JP6477352B2 (en) Arithmetic processing device, control method for arithmetic processing device, and control program for arithmetic processing device
JP6451475B2 (en) Arithmetic processing device, information processing device, and control method of arithmetic processing device
JP4765249B2 (en) Information processing apparatus and cache memory control method
JP7311959B2 (en) Data storage for multiple data types