JP4519151B2 - Cache control circuit - Google Patents
Cache control circuit Download PDFInfo
- Publication number
- JP4519151B2 JP4519151B2 JP2007073099A JP2007073099A JP4519151B2 JP 4519151 B2 JP4519151 B2 JP 4519151B2 JP 2007073099 A JP2007073099 A JP 2007073099A JP 2007073099 A JP2007073099 A JP 2007073099A JP 4519151 B2 JP4519151 B2 JP 4519151B2
- Authority
- JP
- Japan
- Prior art keywords
- cache
- rate
- way
- miss
- ratio
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Memory System Of A Hierarchy Structure (AREA)
Description
本発明は、一般にメモリ制御回路に関し、詳しくはキャッシュメモリを制御するキャッシュ制御回路に関する。 The present invention generally relates to a memory control circuit, and more particularly to a cache control circuit that controls a cache memory.
コンピュータシステムにおいては一般に、主記憶とは別に小容量で高速なキャッシュメモリが設けられる。主記憶に記憶される情報の一部をキャッシュにコピーしておき、この情報をアクセスする場合には主記憶からではなくキャッシュから読み出すことで、高速な情報の読み出しが可能となる。 In general, in a computer system, a small-capacity and high-speed cache memory is provided separately from the main memory. A part of the information stored in the main memory is copied to the cache, and when this information is accessed, the information is read from the cache instead of the main memory, thereby enabling high-speed information reading.
通信の分野等で使われるプロセッサにおいては、通信方式の要求を満足する高い処理性能と低消費電力という、互いにトレードオフとなる条件が要求される。プロセッサの処理性能とキャッシュのヒット率とには密接な関係があり、ヒット率が高いほどプロセッサは本来の性能を十分に発揮することができる。ヒットとは、キャッシュに格納してある外部メモリへのアクセス履歴に今回のアクセスが当てはまる場合、即ち、アクセス対象のデータがキャッシュに格納されている場合のことである。逆に今回のアクセスがアクセス履歴に当てはまらない場合を、キャッシュのミスヒットと呼ぶ。この場合には新たに履歴を格納するが、新たな履歴を格納する容量がない場合には、履歴を上書き更新する必要がある。 A processor used in the field of communication or the like is required to have a trade-off condition of high processing performance and low power consumption that satisfy the requirements of the communication method. There is a close relationship between the processing performance of the processor and the hit rate of the cache, and the higher the hit rate, the better the processor can exhibit its original performance. A hit is when the current access is applied to the access history to the external memory stored in the cache, that is, when the access target data is stored in the cache. Conversely, when the current access does not apply to the access history, it is called a cache miss. In this case, a new history is stored, but when there is no capacity for storing a new history, the history needs to be overwritten and updated.
一般に、アドレスの全ビットのうちで、所定数の下位ビットがキャッシュのインデックスとなり、それより上位に位置する残りのビットがキャッシュのタグ(履歴)となる。データをアクセスする場合には、アクセス先を示すアドレス中のインデックス部分を用いて、キャッシュ中の対応するインデックスのタグ(履歴)を読み出す。読み出したタグと、アドレス中のタグ部分のビットパターンが一致するか否かを判断する。一致しない場合にはキャッシュミスとなる。一致する場合には、キャッシュヒットとなり、当該インデックスに対応するキャッシュデータ(1キャッシュライン分の所定ビット数のデータ)がアクセスされる。 Generally, out of all bits of the address, a predetermined number of lower bits serve as a cache index, and the remaining bits positioned higher than that serve as a cache tag (history). When accessing data, a tag (history) of the corresponding index in the cache is read using the index portion in the address indicating the access destination. It is determined whether or not the read tag matches the bit pattern of the tag portion in the address. If they do not match, a cache miss occurs. If they match, a cache hit occurs, and the cache data corresponding to the index (data of a predetermined number of bits for one cache line) is accessed.
各キャッシュラインに対して1つだけタグを設けたキャッシュの構成を、ダイレクトマッピング方式と呼ぶ。各キャッシュラインに対してN個のタグを設けたキャッシュの構成をNウェイセットアソシアティブと呼ぶ。Nウェイのキャッシュでは、1つのキャッシュラインに対して、N個のデータを格納することができる。 A cache configuration in which only one tag is provided for each cache line is called a direct mapping method. A cache configuration in which N tags are provided for each cache line is called an N-way set associative. In the N-way cache, N data can be stored in one cache line.
キャッシュサイズが大きければ大きいほどヒット率は増加する。しかしキャッシュはコアの近くで高速に動作するので、キャッシュサイズを大きくすると消費電力が大きくなってしまうという問題点がある。プロセッサ全体の消費電力に対するキャッシュの消費電力の比率は高いことが知られている。 The larger the cache size, the higher the hit rate. However, since the cache operates at high speed near the core, there is a problem that the power consumption increases when the cache size is increased. It is known that the ratio of the power consumption of the cache to the power consumption of the entire processor is high.
一般にアプリケーションの状態によって、必要なキャッシュの容量は異なる。そこで、キャッシュの起動停止をウェイ単位で制御できる機構を設け、駆動ウェイ数を変化させてキャッシュ容量及び消費電力を制御する技術がある(特許文献1)。この技術では、キャッシュのミスヒット率を常に測定しておき、ミスヒット率が高くなったらウェイを起動させ、低くなったらウェイを順次停止させる。これにより、動的にキャッシュサイズを必要最小限にすることで、性能の劣化を防ぎつつ低消費電力化をはかっている。 Generally, the required cache capacity varies depending on the state of the application. Therefore, there is a technique for controlling the cache capacity and power consumption by changing the number of drive ways by providing a mechanism that can control the start and stop of the cache in units of ways (Patent Document 1). In this technique, the cache miss hit rate is always measured, and when the miss hit rate becomes high, the way is started, and when the miss hit rate becomes low, the way is sequentially stopped. As a result, by dynamically minimizing the cache size to the minimum necessary, power consumption is reduced while preventing performance degradation.
しかし、測定項目がミスヒット率だけでは、以下に説明するように問題がある。例えば現在のキャッシュのサイズ(現在の駆動ウェイ数)が現在のアプリケーションの状態に対して最適でヒット率が高い場合、測定されるミスヒット率が低い状態が維持されるので、ウェイを停止するのが適切と判断されウェイが1つ停止されてしまう。しかし1つウェイが停止されると現在のキャッシュのサイズ(現在の駆動ウェイ数)が十分ではなくなり、測定されるミスヒット率が高い状態となる。その結果、ウェイを起動するのが適切と判断されウェイが1つ起動される。このようにウェイの停止・起動が繰り返し実行されることになり、性能が低下してしまう。この現象は、ミスヒット率のみで現在のウェイ数の是非を判断し、キャッシュがどの程度使われているかの情報(埋まり具合や使用率)を無視したためにおこると考えられる。
以上を鑑みて、本発明は、現在のアプリケーションの状態に対して適切なサイズにキャッシュ容量を制御可能なキャッシュ制御回路を提供することを目的とする。 In view of the above, an object of the present invention is to provide a cache control circuit capable of controlling the cache capacity to an appropriate size for the current application state.
複数のウェイを含むセットアソシアティブ方式のキャッシュメモリを制御するキャッシュ制御回路は、該キャッシュメモリの該複数のウェイのうち有効データが占めている割合に応じたデータ占有割合と、該キャッシュメモリがアクセスされた頻度に応じた使用率と、該キャッシュメモリへのアクセスのミスの割合に応じたミス率とを求める測定部と、該データ占有割合と、該使用率と、該ミス率とに応じて該キャッシュメモリの該複数のウェイ毎の起動及び停止を制御する制御部を含むことを特徴とする。 A cache control circuit for controlling a set associative cache memory including a plurality of ways has a data occupancy ratio according to a ratio of valid data in the plurality of ways of the cache memory, and the cache memory is accessed. A measurement unit that obtains a usage rate according to the frequency and a miss rate according to the miss rate of access to the cache memory, the data occupation rate, the usage rate, and the miss rate according to the miss rate. A control unit that controls activation and deactivation of the plurality of ways of the cache memory is included.
本発明の少なくとも1つの実施例によれば、ミス率だけではなく、複数のウェイのうち有効データが占めている割合に応じたデータ占有割合とキャッシュメモリがアクセスされた頻度に応じた使用率とを考慮することにより、現在のアプリケーションの状態に即したウェイ毎の起動制御及び停止制御を行うことが可能となる。これにより、現在のアプリケーションの状態に対して適切なサイズにキャッシュ容量を制御することができる。 According to at least one embodiment of the present invention, not only the miss rate, but also the data occupation rate according to the proportion of valid data in a plurality of ways and the usage rate according to the frequency at which the cache memory is accessed, Considering the above, it becomes possible to perform start control and stop control for each way in accordance with the current application state. As a result, the cache capacity can be controlled to an appropriate size for the current application state.
以下に、本発明の実施例を、添付の図面を用いて詳細に説明する。 Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
図1は、本発明によるキャッシュ装置の構成の一例を示すブロック図である。 FIG. 1 is a block diagram showing an example of the configuration of a cache device according to the present invention.
図1のキャッシュ装置は、タグ格納部11、データレジスタ部12、判定ユニット13、コントローラ14、アドレス変換部15、及びセレクタ16を含む。例えば、論理アドレスが32ビット長であるとすると、アドレスの最下位4ビットがアドレスオフセットとなり、それより上位に位置する所定数のビットがキャッシュのインデックスとなり、更にそれより上位に位置する残りのビットがキャッシュのタグとなる。
1 includes a tag storage unit 11, a
データをアクセスする場合には、アクセス先を示すアドレス中のインデックス部分(論理アドレスの第7ビット(6)から第13ビット(12)の7ビット)を用いて、タグ格納部11の対応するインデックスのタグを読み出す。このとき、タグ格納部11の当該インデックスの有効ビットVが有効値1であるときに限り、タグを有効データとして読み出すようにしてよい。タグの読出しと並行して、アクセス先を示すアドレスの上位ビット(論理アドレス[31:13]:論理アドレスの第14ビット(13)から第32ビット(31))を、アドレス変換部15により物理アドレス[31:13]に変換する。
When accessing data, the index part (7 bits from the 7th bit (6) to the 13th bit (12) of the logical address) in the address indicating the access destination is used to correspond to the corresponding index in the tag storage unit 11. Read the tag. At this time, the tag may be read as valid data only when the valid bit V of the index in the tag storage unit 11 is a
このようにしてタグ格納部11から読み出したタグとアドレス変換部15から出力される物理アドレス[31:13]とを、判定ユニット13の比較器13aにより比較し、ビットパターンが一致するか否かを判断する。比較動作は4ウェイの4つのタグに対して実行され、そのうちの1つについて比較結果が一致を示すと、対応する判定ユニット13の出力がアサートされる。アクセスがヒットの場合には判定ユニット13の何れかの出力がアサートされ、アクセスがミスの場合には判定ユニット13の何れの出力もアサートされない。
The tag read out from the tag storage unit 11 in this manner and the physical address [31:13] output from the
アクセス先の論理アドレスに応じてデータレジスタ部12から読み出された4つのウェイのデータのうち、判定ユニット13のアサート出力に対応するウェイのデータがセレクタ16に供給される。セレクタ16は、アクセス先の論理アドレス中のオフセット部分が示すワードを選択し、キャッシュからの読み出しデータとする。
Of the four way data read from the
コントローラ14は、キャッシュ管理に関わる種々の制御動作を実行する。例えば、有効ビットVの設定をしたり、タグの設定をしたり、有効ビットをチェックすることで利用可能なキャッシュラインを検索したり、例えばLRU(least recently used)アルゴリズム等に基づいて置換対象となるキャッシュラインを選択したり、データレジスタ部12へのデータ書き込み動作を制御したりする。またコントローラ14は、本発明によるキャッシュの起動停止制御を実行する。図1に示されるコントローラ14のブロック構成は、このキャッシュの起動停止制御に関する部分に対応する。
The controller 14 executes various control operations related to cache management. For example, a valid bit V can be set, a tag can be set, an available cache line can be searched by checking a valid bit, and a replacement target can be determined based on, for example, an LRU (least recently used) algorithm. Or a data write operation to the
コントローラ14は、パワー制御部21、動的閾値制御部22、ウェイ数制御部23、比較部24、ミス率測定部25、使用率測定部26、キャッシュ状態測定部27、及び設定レジスタ28を含む。キャッシュ状態測定部27では以下の2つの状態を随時監視し、使用率表として保持する。
The controller 14 includes a
監視対象の状態の一つめは、キャッシュライン毎の埋まり具合である。例えばキャッシュのウェイが3つ起動しており、あるラインにおいて、これら3つのウェイ全てに有効なデータが入っている場合、このラインの埋まり具合は1であり、これら3つのウェイのうちで有効なデータが入っていないウェイが1つでもある場合、このラインの埋まり具合は0である。このように、ライン毎に全ての起動中のウェイで有効なデータがはいっているときそのラインの埋まり具合を1とし、1つでも有効なデータがないウェイがあるときそのラインの埋まり具合を0と定義する。図2に示すように、使用率表31には起動中のウェイが示されており、このうち有効データの入っているウェイには1がフラグとして記録されている。起動中のウェイのフラグのANDをとることで、埋まり具合のデータ1/0が求められる。
The first state to be monitored is the degree of filling for each cache line. For example, if three cache ways are activated and valid data is stored in all three ways on a line, the line is filled with 1, and the valid of these three ways is valid. If there is even one way that does not contain data, the degree of filling of this line is zero. As described above, when valid data is inserted in all active ways for each line, the degree of filling of the line is 1, and when there is a way without any valid data, the degree of filling of the line is 0. It is defined as As shown in FIG. 2, the usage rate table 31 shows the active way, and 1 is recorded as a flag in the way containing valid data. By taking the AND of the flag of the way being activated, the
監視対象の状態の一つめは、キャッシュライン毎の使用率である。ここで使用率は以下のようにして求める。キャッシュアクセス毎に、アクセスされたキャッシュラインの番号(ラインナンバー)を、図2に示すFIFO32に格納する。FIFO32に新規格納されたラインナンバーのラインの使用率を、使用率表31において1増加させる。またFIFO32から出力されるラインナンバーのラインの使用率を、使用率表31において1減少させる。FIFO32の長さがN+1であり、過去N+1回のキャッシュアクセスのうちm回がラインkに対するアクセスであったとすると、使用率表31におけるラインkの使用率はmとなる。
The first status to be monitored is the usage rate for each cache line. Here, the usage rate is obtained as follows. For each cache access, the number (line number) of the accessed cache line is stored in the
ミス率測定部25では、キャッシュアクセス毎にヒットならば0でありミスならば1である数値を生成し、アクセスされたラインの埋まり具合が1ならば予め設定された1より大きい係数Cをこの数値に掛けて、その結果をFIFO32に格納する(図2参照)。このFIFO32の格納データの合計値を、ウェイ起動の判断基準のための測定値(ミス率)としてミス率測定部25から出力する。この出力測定値であるミス率は、過去の所定回のアクセスのうちでミスが多いほど大きくなり、またミスの場合のアクセスされたラインに空きがないほど大きくなる。この出力測定値を、ウェイ起動の判断基準として利用する。係数Cとの積を求めることにより、起動検出が従来よりも係数設定値倍早くなる。
The miss
使用率測定部26は、キャッシュの埋まり具合と使用頻度とから、ウェイを停止するのが適切か否かを判定するための測定値を計算する。図3に示すようにキャッシュの埋まり具合が歯抜けの状態になっている場合、ウェイを停止して使用箇所をつめても、ヒット率にさほど影響を与えることなく電力削減効果を得ることができる。例えば埋まり具合が1(即ち空きがない状態)であるライン0については、使用率が比較的小さいので、ウェイを減らしてしまっても影響は少ないと考えられる。具体的には、iをラインナンバーとしてiについての和である
Σ{埋まり具合i×使用率i} (式1)
の値が小さい場合には、ウェイを減らすことが妥当であると考えられる。使用率測定部26は、上記のようにして求めた値を総合使用率として出力する
比較部24は、ミス率測定部25からのミス率と使用率測定部26からの総合使用率とをそれぞれの閾値と比較する。これら閾値は、予めシミュレーションなどで決めた値であり、例えばレジスタ設定等により可変に設定できる値である。比較部24は、ミス率が閾値を超えたら起動の指示をウェイ数制御部23へ出す。ミス率が閾値を超えていない状態で総合使用率が閾値以下になった場合、比較部24は停止の指示をウェイ数制御部23へ出す。どちらの条件も満たしていない場合、比較部24は起動及び停止の何れの指示も出さない。
The usage
If the value of is small, it is considered reasonable to reduce the way. The usage
図4は、ウェイ数制御部23の構成の一例を示す図である。
FIG. 4 is a diagram illustrating an example of the configuration of the way
ウェイ数制御部23は、比較部24からの起動/停止指示と現在のウェイの起動状況とを基にしてウェイ数を制御する。内部にウェイ使用数測定部35を持ち、所定のアクセス回数における各ウェイの使用状況を表として保持している。また、ウェイの起動状況をウェイ起動状態表36として保持する機構をもつ。起動判定は、比較部24から起動指示があり、かつ停止中のウェイがあり、かつタイマ待ち状態でない場合に制御判定部39により行われる。制御判定部39は、起動判定すると、起動状況を更新し、起動状況を起動指示と合わせてパワー制御部21に送る。タイマ待ち状態とは、前回起動からウェイの電源が安定するまでの時間、及び、ウェイが起動した直後の一回目のアクセスがミスとなり履歴をキャッシュ内部に格納するために必要な時間(αレジスタ37の格納値が示す時間)、における待ち状態のことである。この時間はシミュレーションなどで予め決めておき、レジスタ37に可変に設定可能な構成とする。起動判定とともに起動し待ち時間を計時するタイマ38を内部に持つ。
The way
ウェイ数制御部23による停止判定は、起動指示がなく、タイマ待ちではなく、停止指示があり、且つウェイが2つ以上起動している状態の場合に制御判定部39により行われる。制御判定部39は、停止の判定が行われたら、測定していたウェイ毎の使用率を基に最も使用率の低いウェイナンバーを停止させ、ウェイ起動状況を更新し、起動状況を停止指示と合わせてパワー制御部21に送る。
The stop determination by the way
パワー制御部21では、ウェイ数制御部23の指示に従って各ウェイの電源のオン/オフを制御する。
The
前記の閾値は、動的に可変制御してもよい。閾値の設定値は、予めシミュレーションなどにより測定されたある程度妥当な値であることを想定している。しかし適切なシミュレーションができない場合等には、適当な推量値に設定するしかなく、その結果、ウェイの起動停止動作が全く起きない設定になってしまう場合が考えられる。このような場合でも閾値をレジスタ設定により変更することができるが、人手によらずに自動で変更したい場合或いはより早く変えたい場合等の補助機能として、動的閾値制御部22を設けてよい。
The threshold value may be dynamically variably controlled. It is assumed that the set value of the threshold value is a reasonable value measured in advance by simulation or the like. However, when an appropriate simulation cannot be performed, etc., there is no choice but to set an appropriate guess value. As a result, there is a case where the way start / stop operation does not occur at all. Even in such a case, the threshold value can be changed by register setting. However, the dynamic threshold
図5は、動的閾値制御部22の構成の一例を示す図である。動的制御ONとともにタイマ40は起動する。カウンタ41は起動指示数をカウントする。起動閾値の制御の場合、セレクタ42は、タイマ終了時にカウンタ41のカウント値が閾値を超えていたら、以前の値(FFの値)に"+1"した値を選択する。カウンタ41のカウント値が0の場合には、以前の値(FFの値)に"−1"した値を選択する。カウンタ41のカウント値が閾値以上でなく且つ0でない場合には、以前の値(FFの値)を選択する。タイマ40およびカウンタ41はタイマ終了時にリセットされる。停止閾値の制御動作も同じである。ただし、起動指示数ではなく停止指示数を監視し、閾値の"±"が起動閾値の場合と反対となる。
FIG. 5 is a diagram illustrating an example of the configuration of the dynamic threshold
図6は、本発明によるキャッシュ起動停止制御の流れを示すフローチャートである。このフローチャートに示す処理はキャッシュアクセス毎に行われる。 FIG. 6 is a flowchart showing the flow of cache start / stop control according to the present invention. The processing shown in this flowchart is performed for each cache access.
測定値更新フェーズ(S1)では、各測定値の計算を行う。図1のキャッシュ状態測定部27の動作に相当する。
In the measurement value update phase (S1), each measurement value is calculated. This corresponds to the operation of the cache
起動条件測定フェーズ(S2)では、測定値を基にミス率の計算を行い、起動の有無を判定する。図1のミス率測定部25及び比較部24の起動関連部分の動作に相当する。
In the activation condition measurement phase (S2), the miss rate is calculated based on the measured value to determine the presence or absence of activation. This corresponds to the operation of the activation-related portion of the error
停止条件判定フェーズ(S3)では、測定値を基に総合使用率の計算を行い、その結果を閾値と比較して停止の判定をする。図1の使用率測定部26及び比較部24の停止関連部分の動作に相当する。
In the stop condition determination phase (S3), the total usage rate is calculated based on the measured value, and the result is compared with a threshold value to determine stop. This corresponds to the operation of the stop-related portion of the usage
起動停止フェーズ(S4)では、ウェイの起動停止判定を行う。図1のウェイ数制御部23の動作に相当する。
In the start / stop phase (S4), the start / stop determination of the way is performed. This corresponds to the operation of the way
動的閾値制御フェーズ(S5)では、各閾値を動的に制御する。図1の動的閾値制御部22の動作に相当する。ここ処理だけは、キャッシュアクセスサイクルではなく、タイマのカウントするクロックサイクルに同期して動作する。なお動的閾値制御フェーズを図6に示す手順の先頭において実行し、制御後の閾値を利用して、図6示す各ステップの処理を実行してもよい。また動的閾値制御機能は、レジスタ設定などによりオン・オフ制御できるようにしてよい。
In the dynamic threshold control phase (S5), each threshold is dynamically controlled. This corresponds to the operation of the dynamic
パワー制御起動(S6)及びパワー制御停止(S7)では、それぞれウェイの起動及び最も使用頻度の低いウェイの停止の動作を行う。図1のパワー制御部21の動作に相当する。その後、処理を終了し次のキャッシュアクセスを待つ。
In the power control start (S6) and the power control stop (S7), the way activation and the least frequently used way stop operation are performed, respectively. This corresponds to the operation of the
図7は、図6のS1に対応する各測定値の計算の手順を示すフローチャートである。各ステップの順不同である。埋まり具合更新(S1)では、起動ウェイのライン毎に有効データがある場合には1、無い場合には0としてANDをとった結果を表として保持する。使用率更新(S2)では、保持していた最も古いアクセスラインナンバーに当たるラインの使用数を1減らし、今回アクセスしたラインナンバーの使用数を1増やす。ウェイ毎使用数更新(S3)では、最も古いアクセス情報が示すウェイの使用数を1減らし、今回アクセスしたウェイの使用数を"+1"する。 FIG. 7 is a flowchart showing a procedure for calculating each measurement value corresponding to S1 of FIG. The order of each step is random. In the padding state update (S1), the result of ANDing is held as a table when the valid data exists for each line of the activation way, and when there is no valid data, it is 0. In the usage rate update (S2), the number of used lines corresponding to the oldest access line number held is reduced by 1, and the number of used line numbers accessed this time is increased by 1. In the usage number update for each way (S3), the way usage number indicated by the oldest access information is reduced by 1, and the usage number of the way accessed this time is incremented by "+1".
図8は、図6のS2に対応する起動条件判定の手順を示すフローチャートである。 FIG. 8 is a flowchart showing a procedure for determining the activation condition corresponding to S2 of FIG.
まず最も古いヒット又はミスの情報を削除する(S1)。今回のアクセスのヒット/ミスを判定し(S2)、ヒットなら測定値(ミス率)を±0する(S3)。S2でミスし、ミスしたラインの埋まり具合が1(S4でYES)ならば、測定値を+Cする(S5)。S2でミスし、ミスしたラインの埋まり具合が0(S4でNO)ならば測定値を+1する(S6)。測定値と閾値との比較を行い(S7)、閾値を超えたら、起動条件を満たしたと判定し起動停止フェーズへ移行する(S8)。閾値を超えなかった場合には、停止条件判定フェーズへ移行する(S9)。 First, the oldest hit or miss information is deleted (S1). The hit / miss of the current access is determined (S2), and if it is a hit, the measured value (miss rate) is set to ± 0 (S3). If the missed line is missed in S2 and the filling level of the missed line is 1 (YES in S4), the measured value is incremented by + C (S5). If the missed line is missed in S2 and the filling level of the missed line is 0 (NO in S4), the measured value is incremented by 1 (S6). The measured value is compared with the threshold value (S7), and if the threshold value is exceeded, it is determined that the activation condition is satisfied, and the process proceeds to the activation stop phase (S8). If the threshold is not exceeded, the process proceeds to the stop condition determination phase (S9).
図9は、図6のS3に対応する停止条件判定の手順を示すフローチャートである。 FIG. 9 is a flowchart showing a stop condition determination procedure corresponding to S3 of FIG.
総合使用率を所定の式に従い計算する(S1)。総合使用率が閾値以上であれば(S2でYES)、起動停止フェーズへ移行する(S3)。総合使用率が閾値より小さければ(S2でNO)、処理を終了し次のキャッシュアクセスを待つ(S4)。 The total usage rate is calculated according to a predetermined formula (S1). If the total usage rate is equal to or greater than the threshold (YES in S2), the process proceeds to the start / stop phase (S3). If the total usage rate is smaller than the threshold (NO in S2), the process is terminated and the next cache access is awaited (S4).
図10は、図6のS4に対応する起動停止動作の手順を示すフローチャートである。 FIG. 10 is a flowchart showing the procedure of the start / stop operation corresponding to S4 of FIG.
起動指示があり(S1でYES)、電源安定+α待ちのタイマは終了しており(S2でYES)、停止ウェイがある場合(S3でYES)には、電源安定+α待ちのタイマを起動し(S4)、ウェイ起動指示とともに動的閾値制御フェーズへ移行する(S5)。起動指示があっても電源安定+α待ちのタイマ待ち(S2でNO)、または停止ウェイが無い場合(S3でNO)には、指示を出さずに動的閾値制御フェーズへ移行する(S6)。起動指示がなく(S1でNO)、停止指示があり(S7でYES)、稼動ウェイ数が2以上の場合(S8でYES)には、停止指示とともに動的閾値制御フェーズへ移行する(S9)。停止指示がない(S7でNO)または稼動ウェイ数が1つの場合(S8でNO)には、指示を出さずに動的閾値制御フェーズへ移行する(S10)。 If there is a start instruction (YES in S1), the timer for power stabilization + α waiting has ended (YES in S2), and if there is a stop way (YES in S3), a timer for power stabilization + α waiting is started ( S4), together with the way activation instruction, shifts to the dynamic threshold control phase (S5). Even if there is an activation instruction, if the timer waits for power stabilization + α (NO in S2) or if there is no stop way (NO in S3), the process proceeds to the dynamic threshold control phase without issuing an instruction (S6). If there is no start instruction (NO in S1), there is a stop instruction (YES in S7), and the number of operating ways is 2 or more (YES in S8), the process proceeds to the dynamic threshold control phase together with the stop instruction (S9). . If there is no stop instruction (NO in S7) or the number of operating ways is one (NO in S8), the process proceeds to the dynamic threshold control phase without issuing an instruction (S10).
図11Aは、図6のS5に対応する動的閾値制御動作の手順を示すフローチャートである。図11Aは、起動閾値の制御の手順を示す。 FIG. 11A is a flowchart showing a procedure of the dynamic threshold control operation corresponding to S5 of FIG. FIG. 11A shows a procedure for controlling the activation threshold.
動的制御設定がON(S1でYES)されたら、変化指令値(何段階閾値を変化させるかを保持した値)をリセットし、タイマが起動する。タイマが動いている間、起動指令をカウントする(S2,S3)。タイマ終了時(S4でYES)、カウンタが閾値以上(S5でYES)ならば、閾値が低すぎると判断し変化指令値を"+1"し、カウンタリセットする(S6)。カウンタが閾値以上でなく(S5でNO)且つ0(S7でYES)ならば、閾値が高すぎると判断し変化指令値を−1する(S8)。どちらでもない場合には変化指令値は現状のままとする。タイマをリセットして再起動するとともに、変化指令値と変化幅とを乗算し閾値に加算して、比較部で利用する(S9)。 When the dynamic control setting is turned on (YES in S1), the change command value (a value that holds how many threshold values are changed) is reset, and the timer is started. While the timer is running, the start command is counted (S2, S3). When the timer ends (YES in S4), if the counter is equal to or greater than the threshold (YES in S5), it is determined that the threshold is too low, the change command value is incremented by "+1", and the counter is reset (S6). If the counter is not equal to or greater than the threshold (NO in S5) and 0 (YES in S7), it is determined that the threshold is too high and the change command value is decremented by 1 (S8). If it is neither, the change command value is left as it is. The timer is reset and restarted, and the change command value and the change width are multiplied and added to the threshold value and used in the comparison unit (S9).
図11Bは、図6のS5に対応する動的閾値制御動作の手順を示すフローチャートである。図11Bは、停止閾値の制御の手順を示す。 FIG. 11B is a flowchart showing the procedure of the dynamic threshold control operation corresponding to S5 of FIG. FIG. 11B shows a procedure for controlling the stop threshold.
タイマが動いている間停止指令をカウントする(S1,S2)。タイマ終了時(S3でYES)、カウンタが閾値以上(S4でYES)ならば、閾値が高すぎると判断し変化指令値を−1し、カウンタリセットする(S5)。カウンタが閾値以上でなく(S4でNO)且つ0(S6でYES)ならば閾値が低すぎると判断し、変化指令値を+1する(S7)。どちらでもない場合には変化指令値は現状のままとする。タイマをリセットして再起動するとともに、変化指令値と変化幅とを乗算し閾値に加算して、比較部で利用する(S8)。 While the timer is running, the stop command is counted (S1, S2). When the timer ends (YES in S3), if the counter is equal to or greater than the threshold (YES in S4), it is determined that the threshold is too high, the change command value is decremented by 1, and the counter is reset (S5). If the counter is not equal to or greater than the threshold (NO in S4) and 0 (YES in S6), it is determined that the threshold is too low, and the change command value is incremented by 1 (S7). If it is neither, the change command value is left as it is. The timer is reset and restarted, and the change command value and the change width are multiplied and added to the threshold value and used in the comparison unit (S8).
図12は、キャッシュ状態測定部27の構成の一例を示す図である。
FIG. 12 is a diagram illustrating an example of the configuration of the cache
起動ウェイ情報を基に、停止ウェイの有効データフラグはマスクし且つ起動ウェイの有効データフラグはそのままにして、ライン毎に複数のウェイの有効データフラグのANDをとり、その結果を埋まり具合表51に格納する。使用率表52においては、キャッシュアクセス毎に選択したラインナンバーをFIFO53にためておき、入力ナンバーAと出力ナンバーBとを比較して、ライン毎に両方にあてはまらなければ使用率を±0、入力に当てはまれば+1、出力に当てはまれば−1、両方にあてはまれば±0として更新した値を保持する。ウェイの使用率は、ウェイ毎にFIFO54をもち、キャッシュアクセス毎に自分のウェイへのアクセスなら1、さもなければ0を入力し、FIFO54の総和を使用数として保持する。
Based on the activation way information, the valid data flag of the stop way is masked and the valid data flag of the activation way is left as it is, and the AND of the valid data flags of a plurality of ways is taken for each line, and the result is filled up. To store. In the usage rate table 52, the line number selected for each cache access is stored in the
図13は、ミス率測定部25の構成の一例を示す図である。キャッシュアクセスがヒットだった場合は0、ミスかつミスしたラインの埋まり具合が1の場合には係数C、ミスかつミスしたラインの埋まり具合が0の場合には1を、FIFO55に挿入する。FIFO55の各レジスタの値の総和を測定値(ミス率)とする。
FIG. 13 is a diagram illustrating an example of the configuration of the miss
なおミス率測定の係数Cを1に設定すること、或いはC又は1の選択機構自体を削除することにより、埋まり具合を考慮しない単純なヒット/ミスの割合を判定基準(ミス率)として使用するようにしてもよい。この場合でも、本願の停止制御方式を用いることにより、従来とは異なるキャッシュ制御が可能となる。性能(ヒット率)をある値以下に落としたくない場合に、ミス率測定の閾値を変更して使用するのが効果的である。 In addition, by setting the coefficient C of the miss rate measurement to 1 or deleting the selection mechanism itself of C or 1, a simple hit / miss rate that does not consider the degree of filling is used as a criterion (miss rate). You may do it. Even in this case, the cache control different from the conventional one can be performed by using the stop control method of the present application. When it is not desired to drop the performance (hit rate) below a certain value, it is effective to change the threshold value for measuring the miss rate.
図14は、使用率測定部26の構成の一例を示す図である。複数の掛け算器56と加算器57により、使用率表からライン毎の埋まり具合と使用率との積和を求め測定値(総合使用率)として出力する。
FIG. 14 is a diagram illustrating an example of the configuration of the usage
図15は、比較部24の構成の一例を示す図である。比較部24は、加算器61及び62と、比較回路63及び64を含む。これら加算器及び比較回路により、起動及び停止のそれぞれについて測定値と閾値との比較を行う。閾値を超えたら起動又は停止指示をだす。閾値は動的閾値制御部22からの閾値の変更値をレジスタ設定値に加算した値とする。動的閾値制御部22が設けられていない場合には、レジスタ設定値をそのまま閾値としてよい。
FIG. 15 is a diagram illustrating an example of the configuration of the
図16は、パワー制御部21の構成の一例を示す図である。パワー制御部21は、指示検出回路71、稼働状態レジスタ72、複数のアンド回路73を含む。指示検出回路71は、ウェイ数制御部23から供給される起動/停止指示信号を検出して、取り込みトリガ信号を出力する。この取り込みトリガ信号に応答して、稼働状態レジスタ72は、ウェイ数制御部23から供給される更新後のウェイ稼動状態情報を取り込む。これにより内部のウェイ稼動状態情報を更新する。この更新結果によりAND回路73を制御して、各電源ラインをマスクすることにより、各ウェイの電源をオン/オフ制御する。
FIG. 16 is a diagram illustrating an example of the configuration of the
図17は、本発明によるキャッシュ装置の変形例を示すブロック図である。図17において、図1と同一の構成要素は同一の番号で参照し、その説明は省略する。 FIG. 17 is a block diagram showing a modification of the cache device according to the present invention. In FIG. 17, the same components as those in FIG. 1 are referred to by the same numerals, and a description thereof will be omitted.
図17のキャッシュ装置は、図1のキャッシュ装置と比較して、コントローラ14の代わりにコントローラ14Aが設けられていることが異なる。コントローラ14Aは、パワー制御部21、ウェイ数制御部23A、キャッシュ状態測定部27A、及び設定レジスタ28Aを含む。
The cache device of FIG. 17 differs from the cache device of FIG. 1 in that a
この構成では、埋まり具合をライン毎ではなく、起動中のウェイ全体でみる。即ち、起動中のウェイ全体でのデータ有効フラグの総数を埋まり具合とする。またキャッシュアクセス単位ではなく、コアのクロック単位で動くFIFOを設け、キャッシュアクセス有りの場合には1を、無しの場合には0をFIFOに入力するようにする。このFIFOの格納データの合計(1の数)を使用率とする。このような構成とすることにより、保持用のレジスタ、計算用の回路の構造が単純かつ小さくなる。 In this configuration, the degree of filling is seen not for each line but for the entire active way. That is, the total number of data valid flags in the entire active way is filled. Also, a FIFO that operates in units of core clocks, not cache access units, is provided so that 1 is input to the FIFO when there is cache access and 0 is input when there is no cache access. The total (number of 1) of the data stored in the FIFO is used. With such a configuration, the structure of the holding register and the calculation circuit is simple and small.
図18は、キャッシュ状態測定部27Aの構成の一例を示す図である。図18において、図12と同一の構成要素は同一の番号で参照し、その説明は省略する。
FIG. 18 is a diagram illustrating an example of the configuration of the cache
図18の構成の場合、起動ウェイ情報を基に、停止ウェイの有効データフラグはマスクし且つ起動ウェイの有効データフラグはそのままにして、全ての有効データフラグの和を求め、その結果を使用率表81に埋まり具合として格納する。この場合、ライン単位の埋まり具合がわからないので、ミス率に係数Cをかけることはできなくなる。ミス率はキャッシュのミス率をそのまま流用する。FIFO82によりキャッシュの使用率を求め、その結果を使用率表81に格納する。
In the case of the configuration of FIG. 18, based on the activation way information, the effective data flag of the stop way is masked and the effective data flag of the activation way is left as it is, and the sum of all the effective data flags is obtained, and the result is used. It is stored in Table 81 as the degree of filling. In this case, since the degree of filling in line units is not known, the coefficient C cannot be applied to the miss rate. Miss rate uses cache miss rate as it is. The usage rate of the cache is obtained by the
図19は、埋まり具合、使用率、ミス率の値と制御動作との対応関係を示す表である。図19の表に基づいて、動作の列の動作(ウェイ起動、そのまま、停止)を実行すればよい。具体的には、ミス率が低く、埋まり具合及び使用率の少なくとも一方が低い場合には、ウェイ停止と判断をする。また、ミス率が高く、埋まり具合及び使用率の少なくとも一方が高い場合には、ウェイ起動と判断する。それ以外の場合には、ウェイの起動停止を行わない。 FIG. 19 is a table showing a correspondence relationship between the value of the degree of filling, the usage rate, the error rate, and the control operation. Based on the table of FIG. 19, the operations in the column of operations (way activation, as it is, as it is stopped) may be executed. Specifically, when the error rate is low and at least one of the degree of filling and the usage rate is low, it is determined that the way is stopped. Further, when the error rate is high and at least one of the degree of filling and the usage rate is high, it is determined that the way is activated. In other cases, the way is not started or stopped.
図20は、ウェイ数制御部23Aの構成の一例を示す図である。ウェイ数制御部23Aは、比較器85乃至87、判定部88、及びウェイ起動状態表89を含む。比較器85乃至87により、それぞれ埋まり具合、使用率、及びミス率とレジスタ設定の閾値との比較を行う。この比較結果と、ウェイ起動状態表89が示す現在のウェイ起動状態とに応じて、判定部88が判定を行い、起動指示、停止指示、及びウェイ稼働状況を出力する。判定条件は、図20において判定部88に記載の条件であり、図19の表に対応する。
FIG. 20 is a diagram illustrating an example of the configuration of the way
図21は、本発明によるキャッシュ装置の更なる変形例を示すブロック図である。図21において、図1及び図17と同一の構成要素は同一の番号で参照し、その説明は省略する。 FIG. 21 is a block diagram showing a further modification of the cache device according to the present invention. In FIG. 21, the same components as those in FIGS. 1 and 17 are referred to by the same numerals, and a description thereof will be omitted.
図21のキャッシュ装置は、図17のキャッシュ装置と比較して、コントローラ14の代わりにコントローラ14Bが設けられていることが異なる。コントローラ14Bは、パワー制御部21、動的閾値制御部22、ウェイ数制御部23B、キャッシュ状態測定部27A、及び設定レジスタ28Aを含む。動的閾値制御部22を設けることにより、図1の構成の場合と同様な動的閾値制御を可能としている。
The cache device of FIG. 21 differs from the cache device of FIG. 17 in that a controller 14B is provided instead of the controller 14. The controller 14B includes a
図22は、ウェイ数制御部23Bの構成の一例を示す図である。図22において、図20と同一の構成要素は同一の番号で参照し、その説明は省略する。
FIG. 22 is a diagram illustrating an example of the configuration of the way
ウェイ数制御部23Bは、図20の構成に加え、更に加算器91乃至93を含む。加算器91乃至93は、動的閾値制御部22からの閾値上昇値をレジスタ設定の閾値に加算して、動的に変化する閾値を生成する。この動的に変化する閾値が、比較器85乃至87における比較動作に使用される。
The way
図23は、図17に示す構成におけるキャッシュ起動停止制御の流れを示すフローチャートである。このフローチャートに示す処理はキャッシュアクセス毎に行われる。 FIG. 23 is a flowchart showing the flow of cache start / stop control in the configuration shown in FIG. The processing shown in this flowchart is performed for each cache access.
測定値更新フェーズ(S1)では、各測定値の計算を行う。図17のキャッシュ状態測定部27Aの動作に相当する。
In the measurement value update phase (S1), each measurement value is calculated. This corresponds to the operation of the cache
条件測定フェーズ(S2)では、起動及び停止の条件の有無を判定する。起動の判定及び停止の判定は、条件判定フェーズに集約して簡略化できる。起動停止フェーズ(S3)では、ウェイの起動停止判定を行う。図17のウェイ数制御部23Aの動作に相当する。
In the condition measurement phase (S2), it is determined whether or not there are start and stop conditions. The determination of activation and the determination of stop can be simplified by integrating them into the condition determination phase. In the start / stop phase (S3), the start / stop determination of the way is performed. This corresponds to the operation of the way
パワー制御起動(S4)及びパワー制御停止(S5)では、それぞれウェイの起動及び最も使用頻度の低いウェイの停止の動作を行う。図17のパワー制御部21の動作に相当する。その後、処理を終了し次のキャッシュアクセスを待つ。
In the power control start (S4) and the power control stop (S5), the way activation and the least frequently used way stop operation are performed, respectively. This corresponds to the operation of the
図24は、図23のS1に対応する各測定値の計算の手順を示すフローチャートである。埋まり具合は、キャッシュの有効ウェイの有効データフラグの総和を求めることで計算する(S1)。使用率は、最も古いキャッシュ使用情報を削除し、キャッシュを使用したら+1、使用しなかったら+0とすることにより更新して求める(S2)。ウェイ使用数更新は、図7の場合と同様である。なおこれらのステップの処理は順不同でよい。 FIG. 24 is a flowchart showing the procedure for calculating each measured value corresponding to S1 in FIG. The degree of filling is calculated by obtaining the sum of the valid data flags of the cache valid ways (S1). The usage rate is obtained by deleting the oldest cache usage information and updating it by setting it to +1 if the cache is used and +0 if it is not used (S2). The way usage number update is the same as in FIG. Note that these steps may be performed in any order.
図25は、図23のS2に対応する条件判定処理の手順を示すフローチャートである。まずミス率の閾値判定を行う(S1)。ミス率が閾値以上の場合(S1でYES)、さらに使用率の閾値判定(S2)、埋まり具合の閾値判定(S3)を行い、何れかの判定で閾値以上と判明した場合には起動と判定する(S4,S5)。ミス率が閾値以上でなく(S1でNO)且つ閾値以下である場合(S6でYES)、使用率の閾値判定(S7)、埋まり具合の閾値判定(S8)を行い、何れかの判定で閾値以下と判明した場合には停止と判定する(S9,S10)。それ以外の場合には起動停止は行わない。なお使用率、埋まり具合の判断の順番は入れ替え可能である。 FIG. 25 is a flowchart showing the procedure of the condition determination process corresponding to S2 in FIG. First, a threshold determination of a miss rate is performed (S1). If the error rate is greater than or equal to the threshold (YES in S1), the threshold determination for usage rate (S2) and the threshold determination for the degree of filling (S3) are performed. (S4, S5). When the miss rate is not equal to or greater than the threshold (NO in S1) and is equal to or less than the threshold (YES in S6), the threshold determination for the usage rate (S7) and the threshold determination for the degree of filling (S8) are performed. If it is determined that the following is true, it is determined to be stopped (S9, S10). In other cases, start and stop are not performed. Note that the order of determination of the usage rate and the degree of filling can be changed.
図26は、図21に示す構成におけるキャッシュ起動停止制御の流れを示すフローチャートである。このフローチャートに示す処理はキャッシュアクセス毎に行われる。図26においては、図23のフローチャートに対して動的閾値制御フェーズ(SA)が追加されたことのみが異なる。他の処理は、図23と同様である。また動的閾値制御フェーズ(SA)の処理は、図11A及び図11Bに示す手順でよい。 FIG. 26 is a flowchart showing the flow of cache start / stop control in the configuration shown in FIG. The processing shown in this flowchart is performed for each cache access. 26 differs from the flowchart of FIG. 23 only in that a dynamic threshold control phase (SA) is added. Other processes are the same as those in FIG. The dynamic threshold control phase (SA) may be processed according to the procedure shown in FIGS. 11A and 11B.
なお上記変形例の説明において、図19の表に示されるキャッシュの状態と動作の関係を、ユーザーが設定変更できるようにしてもよい。即ち、図19の表の動作の列の内容を例えばレジスタ設定により可変な構成としてよい。このようなレジスタ設定を用いた構成により、例えば図19の状態1に対して動作が「停止」と定義されているのを、「起動」或いは「そのまま」と変更することが可能である。図20又は図22に示す判定部88で、判定結果をレジスタ設定に応じて実行すればよい。
In the description of the above modification, the user may be able to change the setting of the relationship between the cache state and the operation shown in the table of FIG. That is, the contents of the operation column in the table of FIG. 19 may be variable by, for example, register setting. With the configuration using such register setting, for example, the operation defined as “stop” for the
図27は、動作内容をレジスタ設定可能とした場合の条件判定フェーズのフローチャートを示す。埋まり具合、使用率、及びミス率に関して閾値判定を行い各閾値との比較を行う(S1)。比較結果に応じてレジスタの設定内容を読み出す(S2)。高低は閾値以上及び以下を示し、中は閾値以上でも以下でもない場合を示す。レジスタから読み出した結果に応じて「起動」、「停止」、又は「そのまま」に分岐する(S3)。 FIG. 27 shows a flowchart of the condition determination phase when the operation contents can be set in the register. Threshold determination is performed with respect to the degree of filling, usage rate, and miss rate, and comparison with each threshold value is performed (S1). The setting contents of the register are read according to the comparison result (S2). High and low indicate values above and below the threshold value, and medium indicates a value that is not above and below the threshold value. The process branches to “start”, “stop”, or “as is” according to the result read from the register (S3).
以下に、本発明の少なくとも1つの実施例の効果について説明する。 The effects of at least one embodiment of the present invention will be described below.
(式1)で示した値は、キャッシュの利用効率を随時測定している式である。図3の説明で示したとおり、この式の値が低い場合、埋まっているラインの使用率が低く、ラインの空きが大きい、つまりつめられる上体をあらわしている。 The value shown in (Expression 1) is an expression that measures the cache usage efficiency as needed. As shown in the explanation of FIG. 3, when the value of this equation is low, the use rate of the buried line is low, and the vacancy of the line is large, that is, the upper body to be pinched is shown.
例えばJPEGなどの画像処理の場合、図28のように特定の処理を繰り返し行い、終了したらアイドル状態となる動作を繰り返す。このとき、命令コード領域をみると、エンコード処理中は特定の処理を繰り返すためメモリ空間上の特定の領域が繰り返し使われる。そこでキャッシュは使用率が高く、埋まり具合が高く、ヒット率の高い状態となる。アイドル処理中は、通常自分への分岐といった極簡単な処理が繰り返しおこなわれるため特定のメモリ領域だけ使用される。そのためキャッシュの使用率は高く、埋まり具合は低く、ヒット率が高い状態となる。図29にこの場合の本発明と従来技術(特許文献1)との効果の差を示す。 For example, in the case of image processing such as JPEG, specific processing is repeatedly performed as shown in FIG. At this time, when looking at the instruction code area, a specific area in the memory space is repeatedly used because the specific process is repeated during the encoding process. Therefore, the cache has a high usage rate, a high degree of filling, and a high hit rate. During idle processing, usually simple processing such as branching to itself is repeated, so that only a specific memory area is used. Therefore, the usage rate of the cache is high, the degree of filling is low, and the hit rate is high. FIG. 29 shows the difference in effect between the present invention and the prior art (Patent Document 1) in this case.
従来技術の場合、ヒット率のみに依存するためヒット率が高い状態がつづくとウェイを停止させる。そのためキャッシュ容量が不足しミス率が高くなる。そのため今度は起動の判定条件を満たし起動する。すると再びヒット率の高い状態に戻る。これを繰り返すため処理時間が遅くなる。アイドル状態に入るとウェイと停止させる。キャッシュの制御なしの場合と比べて消費電力は下がるがスループットも落ちてしまう。 In the case of the prior art, the way is stopped when a state with a high hit rate continues because it depends only on the hit rate. Therefore, the cache capacity is insufficient and the miss rate is increased. For this reason, this time the system satisfies the start determination condition and starts up. Then, it returns to a state with a high hit rate again. Since this is repeated, the processing time is delayed. When entering the idle state, the way is stopped. Compared to the case without cache control, power consumption is reduced, but throughput is also reduced.
それに対し本発明の場合は、ライン毎の埋まり具合も判断基準に加えるためヒット率の高い状態が続くこの場合でもウェイの停止判断をしない。そのため性能はキャッシュの制御の無い場合と同様に維持される。アイドル状態では使用率が下がるためウェイを停止させ、従来技術と同様の省電力効果が期待できる。つまりキャッシュの制御無しの場合と比べてスループットを落とさず省電力化を行うことができる。 On the other hand, in the case of the present invention, since the degree of burying for each line is also added to the judgment criterion, the way stop judgment is not made even in this case where the state of high hit rate continues. Therefore, the performance is maintained in the same manner as when there is no cache control. Since the usage rate is lowered in the idle state, the way is stopped, and the same power saving effect as in the prior art can be expected. That is, power can be saved without reducing the throughput as compared with the case without cache control.
図30でミス率と起動判定の時間変化を本発明と従来技術で比べた。本発明では係数Cを掛けているため測定したミス率の上昇が早く、そのため起動判定を早く行うことができる。 In FIG. 30, the error rate and the time change of activation determination are compared between the present invention and the prior art. In the present invention, since the coefficient C is multiplied, the measured error rate increases rapidly, so that the activation determination can be performed quickly.
さらに図31で定量的に比較結果をまとめた。起動が早くなる結果、平均性能は本発明の方が高くなる。また、図中の仮定より、従来技術に比べ平均C倍、検出が早くなる。 Furthermore, the comparison results are summarized quantitatively in FIG. As a result of faster start-up, the average performance is higher with the present invention. In addition, the detection is faster by an average C times than the conventional technique.
キャシュは複数のキャッシュラインを含み、主記憶からキャシュへの情報のコピーはキャシュライン単位で実行される。主記憶のメモリ空間はキャッシュライン単位で分割され、分割されたメモリ領域を順番にキャッシュラインに割当てておく。キャッシュの容量は主記憶の容量よりも小さいので、主記憶のメモリ領域を繰り返して同一のキャッシュラインに割当てることになる。 The cache includes a plurality of cache lines, and copying of information from the main memory to the cache is executed in units of cache lines. The memory space of the main memory is divided in units of cache lines, and the divided memory areas are sequentially assigned to the cache lines. Since the capacity of the cache is smaller than the capacity of the main memory, the memory area of the main memory is repeatedly assigned to the same cache line.
キャッシュはアクセス履歴を格納するためアドレスをデコードする。その際、通常アドレスのすべてのビットをデコードはしない。キャッシュ内部をライン単位でわけてアドレスの一部はそのままラインナンバーに割り当てる。このためライン毎に使えるアドレスは周期的に決まっている。そこで、同じラインを使用する場所の利用頻度が高ければウェイを起動した場合ライン数が増えヒット率が上昇(性能向上)する。図2で埋まり具合が1のときに係数Cをかけるとは、同じラインをよく使ってミスした場合を強調するためのものである。したがって起動検出効率の向上が期待できる。 The cache decodes the address to store the access history. At that time, all bits of the normal address are not decoded. The cache is divided into lines, and a part of the address is assigned to the line number as it is. For this reason, the addresses that can be used for each line are periodically determined. Therefore, if the use frequency of the place where the same line is used is high, the number of lines increases and the hit rate increases (performance improvement) when the way is activated. Applying the coefficient C when the filling level is 1 in FIG. 2 is for emphasizing a case where a mistake is made by frequently using the same line. Therefore, improvement in startup detection efficiency can be expected.
以上、本発明を実施例に基づいて説明したが、本発明は上記実施例に限定されるものではなく、特許請求の範囲に記載の範囲内で様々な変形が可能である。 As mentioned above, although this invention was demonstrated based on the Example, this invention is not limited to the said Example, A various deformation | transformation is possible within the range as described in a claim.
11 タグ格納部
12 データレジスタ部
13 判定ユニット
14 コントローラ
15 アドレス変換部
16 セレクタ
21 パワー制御部
22 動的閾値制御部
23 ウェイ数制御部
24 比較部
25 ミス率測定部
26 使用率測定部
27 キャッシュ状態測定部
28 設定レジスタ
11
Claims (5)
該キャッシュメモリの該複数のウェイのうち有効データが占めているデータ占有割合と、該キャッシュメモリがアクセスされた頻度に応じた使用率と、該キャッシュメモリへのアクセスのミスの割合に応じたミス率とを求める測定部と、
該データ占有割合と、該使用率と、該ミス率とに応じて該キャッシュメモリの該複数のウェイ毎の起動及び停止を制御する制御部と
を含むことを特徴とするキャッシュ制御回路。 A cache control circuit for controlling a cache memory including a plurality of ways,
The data occupying ratio occupied by valid data among the plurality of ways of the cache memory, the usage ratio according to the frequency of accessing the cache memory, and the miss according to the ratio of miss of accessing the cache memory A measuring unit for determining the rate,
A cache control circuit comprising: a control unit that controls activation and deactivation of each of the plurality of ways of the cache memory according to the data occupying ratio, the usage rate, and the miss rate.
該複数のウェイのうち有効データが占めている割合に応じた該データ占有割合をキャッシュライン毎に求め、過去所定回のキャッシュアクセスのうちで着目キャッシュラインがアクセスされた頻度に応じた該使用率をキャッシュライン毎に求めるキャッシュ状態測定部と、
該過去所定回のキャッシュアクセスのうちで、該データ占有割合が空き有を示すキャッシュラインへのキャッシュアクセスがミスした頻度の重みと、該データ占有割合が空き無を示すキャッシュラインへのキャッシュアクセスがミスした頻度の重みとを異ならせて、ミスの頻度として該ミス率を計算するミス率測定部と、
該キャッシュライン毎の該データ占有割合と該使用率との積を全てのキャッシュラインについて合計した総合使用率を求める使用率測定部と
を含み、
該制御部は、該ミス率と所定の閾値との比較結果及び該総合使用率と所定の閾値との比較結果とに応じて該キャッシュメモリの該複数のウェイ毎の起動及び停止を制御することを特徴とする請求項1記載のキャッシュ制御回路。 The measurement unit is
The data occupation ratio corresponding to the ratio occupied by valid data among the plurality of ways is obtained for each cache line, and the usage ratio according to the frequency at which the target cache line is accessed in the past predetermined cache accesses For each cache line,
Among the predetermined number of cache accesses in the past, the weight of the frequency of missed cache access to the cache line whose data occupancy ratio indicates that there is free space, and the cache access to the cache line whose data occupancy ratio indicates that there is no space A miss rate measurement unit that calculates the miss rate as a miss frequency by differentiating the weight of the miss frequency,
A usage rate measuring unit for obtaining a total usage rate obtained by summing up the products of the data occupying ratio and the usage rate for each cache line for all the cache lines;
The control unit controls activation and stop of the cache memory for each of the plurality of ways according to a comparison result between the miss rate and a predetermined threshold and a comparison result between the total usage rate and a predetermined threshold. The cache control circuit according to claim 1.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007073099A JP4519151B2 (en) | 2007-03-20 | 2007-03-20 | Cache control circuit |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007073099A JP4519151B2 (en) | 2007-03-20 | 2007-03-20 | Cache control circuit |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2008234320A JP2008234320A (en) | 2008-10-02 |
JP4519151B2 true JP4519151B2 (en) | 2010-08-04 |
Family
ID=39907016
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2007073099A Expired - Fee Related JP4519151B2 (en) | 2007-03-20 | 2007-03-20 | Cache control circuit |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4519151B2 (en) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP5492156B2 (en) | 2011-08-05 | 2014-05-14 | 株式会社東芝 | Information processing apparatus and cache method |
JP5674611B2 (en) * | 2011-09-22 | 2015-02-25 | 株式会社東芝 | Control system, control method and program |
US9703704B2 (en) | 2012-05-01 | 2017-07-11 | Semiconductor Energy Laboratory Co., Ltd. | Semiconductor device |
KR101475931B1 (en) * | 2013-05-24 | 2014-12-23 | 고려대학교 산학협력단 | Cache and method for operating the same |
US10089238B2 (en) | 2014-07-17 | 2018-10-02 | Qualcomm Incorporated | Method and apparatus for a shared cache with dynamic partitioning |
JP5714169B2 (en) * | 2014-11-04 | 2015-05-07 | 株式会社東芝 | Control device and information processing device |
WO2016082205A1 (en) * | 2014-11-28 | 2016-06-02 | 华为技术有限公司 | Method, apparatus and device for controlling power consumption of multi-level cache |
JP7142289B2 (en) * | 2018-08-23 | 2022-09-27 | 日本電信電話株式会社 | Processor, Multi-Hierarchical Cache Memory Control Method, and Multi-Hierarchical Cache Memory Control Program |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2000181793A (en) * | 1998-12-16 | 2000-06-30 | Nec Corp | Cache memory |
JP2005078264A (en) * | 2003-08-29 | 2005-03-24 | Matsushita Electric Ind Co Ltd | Computer system, compiler device and operating system |
JP2005316842A (en) * | 2004-04-30 | 2005-11-10 | Nec Corp | Cache memory and cache control method |
JP2006309734A (en) * | 2005-03-31 | 2006-11-09 | Semiconductor Energy Lab Co Ltd | Arithmetic processing unit and electronic device using arithmetic processing unit |
JP2008210142A (en) * | 2007-02-26 | 2008-09-11 | Fujitsu Ltd | Cache way degeneration monitoring device, cache way degeneration monitoring method and cache way degeneration monitoring program |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0675857A (en) * | 1992-06-03 | 1994-03-18 | Mitsubishi Electric Corp | Buffer storage device |
JPH0950401A (en) * | 1995-08-09 | 1997-02-18 | Toshiba Corp | Cache memory and information processor provided with the same |
-
2007
- 2007-03-20 JP JP2007073099A patent/JP4519151B2/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2000181793A (en) * | 1998-12-16 | 2000-06-30 | Nec Corp | Cache memory |
JP2005078264A (en) * | 2003-08-29 | 2005-03-24 | Matsushita Electric Ind Co Ltd | Computer system, compiler device and operating system |
JP2005316842A (en) * | 2004-04-30 | 2005-11-10 | Nec Corp | Cache memory and cache control method |
JP2006309734A (en) * | 2005-03-31 | 2006-11-09 | Semiconductor Energy Lab Co Ltd | Arithmetic processing unit and electronic device using arithmetic processing unit |
JP2008210142A (en) * | 2007-02-26 | 2008-09-11 | Fujitsu Ltd | Cache way degeneration monitoring device, cache way degeneration monitoring method and cache way degeneration monitoring program |
Also Published As
Publication number | Publication date |
---|---|
JP2008234320A (en) | 2008-10-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4519151B2 (en) | Cache control circuit | |
JP6267314B2 (en) | Dynamic power supply for each way in multiple set groups based on cache memory usage trends | |
US7899993B2 (en) | Microprocessor having a power-saving instruction cache way predictor and instruction replacement scheme | |
KR101361928B1 (en) | Cache prefill on thread migration | |
EP1769364B1 (en) | Information processing apparatus and information processing method | |
JP5674611B2 (en) | Control system, control method and program | |
US20150212572A1 (en) | Control system, control method, and computer program product | |
US20100318742A1 (en) | Partitioned Replacement For Cache Memory | |
US10496550B2 (en) | Multi-port shared cache apparatus | |
JP2008040606A (en) | Low power consumption memory management method and computer using its method | |
JP4189402B2 (en) | Cache circuit | |
JP3236287B2 (en) | Multiprocessor system | |
JP6627629B2 (en) | Arithmetic processing device and method of controlling arithmetic processing device | |
US8856453B2 (en) | Persistent prefetch data stream settings | |
KR101472967B1 (en) | Cache memory and method capable of write-back operation, and system having the same | |
US7761665B2 (en) | Handling of cache accesses in a data processing apparatus | |
CN113641596A (en) | Cache management method, cache management device and processor | |
JP5045163B2 (en) | Arithmetic processing device and control method of arithmetic processing device | |
US9645825B2 (en) | Instruction cache with access locking | |
JP6477352B2 (en) | Arithmetic processing device, control method for arithmetic processing device, and control program for arithmetic processing device | |
CA2832223C (en) | Multi-port shared cache apparatus | |
JPH11143774A (en) | Cache control mechanism | |
US20070239939A1 (en) | Apparatus for Performing Stream Prefetch within a Multiprocessor System | |
JP5714169B2 (en) | Control device and information processing device | |
JP2008269365A (en) | Information processor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20091208 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20100209 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20100409 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20100511 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20100518 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130528 Year of fee payment: 3 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130528 Year of fee payment: 3 |
|
LAPS | Cancellation because of no payment of annual fees |