JP2011257800A - Cache memory device, program conversion device, cache memory control method, and program conversion method - Google Patents
Cache memory device, program conversion device, cache memory control method, and program conversion method Download PDFInfo
- Publication number
- JP2011257800A JP2011257800A JP2010129296A JP2010129296A JP2011257800A JP 2011257800 A JP2011257800 A JP 2011257800A JP 2010129296 A JP2010129296 A JP 2010129296A JP 2010129296 A JP2010129296 A JP 2010129296A JP 2011257800 A JP2011257800 A JP 2011257800A
- Authority
- JP
- Japan
- Prior art keywords
- unit
- memory access
- way
- access instruction
- prediction
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/0802—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
- G06F12/0864—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches using pseudo-associative means, e.g. set-associative or hashing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2212/00—Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
- G06F2212/60—Details of cache memory
- G06F2212/608—Details relating to cache mapping
- G06F2212/6082—Way prediction in set-associative cache
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
Description
本発明は、セットアソシアティブ方式のキャッシュメモリ装置に関し、特に、ヒットするウェイの予測を行うキャッシュメモリ装置に関する。 The present invention relates to a set associative cache memory device, and more particularly to a cache memory device that predicts a hit way.
近年、プロセッサからメインメモリへのメモリアクセスを高速化させるために、例えば、SRAM(Static Random Access Memory)などからなる小容量で高速で動作可能なキャッシュメモリが利用されている。例えば、キャッシュメモリを、プロセッサの内部又はその近傍に配置し、メインメモリに保持されたデータの一部をキャッシュメモリに記憶させておくことで、メモリアクセスを高速化させることができる。 In recent years, in order to increase the speed of memory access from a processor to a main memory, a small-capacity cache memory such as an SRAM (Static Random Access Memory) has been used. For example, by arranging the cache memory in or near the processor and storing a part of the data held in the main memory in the cache memory, the memory access can be speeded up.
例えば、特許文献1には、セットアソシアティブ方式のキャッシュメモリについて開示されている。
For example,
特許文献1に記載された従来のメモリ装置は、ウェイがヒットしたかを示すウェイ判定信号を出力するウェイ判定器と、ウェイ判定信号の予測値を発生するウェイ予測部とを備える。そして、従来のメモリ装置は、ウェイ予測部からの予測値に基づき予測されたウェイのデータ格納部だけを活性化する。なお、活性化とは、クロックを供給することである。
The conventional memory device described in
また、従来のメモリ装置は、ウェイ判定器からのウェイ判定信号と予測値とを比較し、不一致の場合にウェイ予測判定信号を出力するウェイ予測判定部を備える。そして、従来のメモリ装置は、ウェイ予測判定部からのウェイ予測判定信号に基づきウェイ予測部の予測値を、ヒットしたウェイを示すウェイ判定信号に変更する。 In addition, the conventional memory device includes a way prediction determination unit that compares the way determination signal from the way determination unit with the predicted value and outputs a way prediction determination signal if they do not match. Then, the conventional memory device changes the predicted value of the way prediction unit to a way determination signal indicating the hit way based on the way prediction determination signal from the way prediction determination unit.
上記構成により、従来のメモリ装置は、消費電力を低減させ、かつ、データ読み出し時のタイムラグを低減させることができる。 With the above configuration, the conventional memory device can reduce power consumption and time lag when reading data.
しかしながら、上記従来技術では、予測が外れた場合に、予測ミスによるオーバーヘッドを回避する手段がなく、キャッシュメモリの性能が劣化するという課題がある。 However, the above-described prior art has a problem that when prediction is lost, there is no means for avoiding overhead due to a prediction error, and the performance of the cache memory deteriorates.
具体的には、特許文献1に記載のメモリ装置では、予測が外れた場合には、ヒットしたウェイを示すウェイ判定信号に予測値を変更する処理が必要であり、処理のサイクル数が増加してしまう。つまり、レイテンシーが大きくなることでキャッシュメモリの性能が劣化してしまう。
Specifically, in the memory device described in
特に、マルチスレッド処理のように、サイクル毎にスレッドを切り替え、又は、1サイクルに複数のスレッドを処理する場合には、予測が外れる場合が大きく、性能の劣化を無視することができない。これに対して、予測が外れる可能性を低くするために、予測の範囲を大きくすることが考えられるが、これでは消費電力の増加を抑制することができない。 In particular, when switching threads for each cycle or processing a plurality of threads in one cycle as in multi-thread processing, the prediction is likely to deviate and performance degradation cannot be ignored. On the other hand, it is conceivable to increase the prediction range in order to reduce the possibility that the prediction will be lost, but this cannot suppress the increase in power consumption.
そこで、本発明は、性能の劣化を抑制するとともに、消費電力の増加を抑制することができるキャッシュメモリ装置及びキャッシュメモリ制御方法を提供することを目的とする。また、本発明は、本発明に係るキャッシュメモリ装置に対応するメモリアクセス命令を生成することができるプログラム変換装置及びプログラム変換方法を提供することも目的とする。 SUMMARY An advantage of some aspects of the invention is that it provides a cache memory device and a cache memory control method capable of suppressing deterioration in performance and suppressing an increase in power consumption. It is another object of the present invention to provide a program conversion apparatus and a program conversion method capable of generating a memory access instruction corresponding to the cache memory device according to the present invention.
上記課題を解決するため、本発明の一態様に係るキャッシュメモリ装置は、複数のプログラムを切り替えながら実行するプロセッサ部に接続されるキャッシュメモリ装置であって、前記プロセッサ部に接続され、タグ格納部及びデータ格納部をそれぞれが含む複数のウェイを備えるセットアソシアティブ方式のキャッシュメモリと、前記プロセッサ部でメモリアクセス命令が解読されたときに、前記複数のウェイのうちのヒットするウェイを予測するウェイ予測部と、前記プロセッサ部で解読されたメモリアクセス命令の種別に基づいて、前記複数のウェイに供給するクロックを制御するクロック制御部とを備え、前記クロック制御部は、第1メモリアクセス命令が前記プロセッサ部で解読された場合に、前記複数のウェイに含まれる複数のデータ格納部のうち、前記ウェイ予測部によって予測されたウェイのデータ格納部のみにクロックを供給し、前記第1メモリアクセス命令とは異なる第2メモリアクセス命令が前記プロセッサ部で解読された場合に、前記ウェイ予測部による予測結果に関わらず、前記複数のウェイに含まれる複数のデータ格納部のうち、予め定められたデータ格納部にクロックを供給する。 In order to solve the above problem, a cache memory device according to an aspect of the present invention is a cache memory device connected to a processor unit that executes a plurality of programs while switching, and is connected to the processor unit and includes a tag storage unit And a set associative cache memory including a plurality of ways each including a data storage unit, and a way prediction for predicting a hit way among the plurality of ways when a memory access instruction is decoded by the processor unit And a clock control unit that controls a clock supplied to the plurality of ways based on a type of the memory access instruction decoded by the processor unit, and the clock control unit includes a first memory access instruction A plurality of ways included in the plurality of ways when decoded by the processor unit; A clock is supplied only to the data storage unit of the way predicted by the way prediction unit of the data storage unit, and a second memory access instruction different from the first memory access instruction is decoded by the processor unit In addition, a clock is supplied to a predetermined data storage unit among a plurality of data storage units included in the plurality of ways regardless of a prediction result by the way prediction unit.
これにより、第2メモリアクセス命令が解読された場合は、ウェイの予測結果を利用せずに、予め定められたウェイのデータ格納部にクロックを供給するので、例えば、予測が外れやすい場合には、予測結果を無視することができるので、予測が外れたことによる処理の繰り返しを抑制することができる。したがって、キャッシュメモリ装置の性能の劣化を抑制することができるとともに、処理の繰り返しによる消費電力の増加も抑制することができる。 As a result, when the second memory access instruction is decoded, the clock is supplied to the data storage unit of the predetermined way without using the way prediction result. Since the prediction result can be ignored, it is possible to suppress the repetition of the processing due to the prediction failure. Therefore, deterioration of the performance of the cache memory device can be suppressed, and an increase in power consumption due to repeated processing can also be suppressed.
また、第1メモリアクセス命令が解読された場合は、ウェイの予測結果を利用し、予測されたウェイのデータ格納部のみにクロックを供給するので、消費電力の増加を抑制することができる。 When the first memory access instruction is decoded, the way prediction result is used and the clock is supplied only to the data storage unit of the predicted way, so that an increase in power consumption can be suppressed.
また、前記第1メモリアクセス命令は、前記複数のプログラムの間において排他の変数をメモリに読み書きする命令であり、前記第2メモリアクセス命令は、前記複数のプログラムの間において共有の変数をメモリに読み書きする命令であってもよい。 The first memory access instruction is an instruction to read / write an exclusive variable between the plurality of programs to / from the memory, and the second memory access instruction is a variable shared between the plurality of programs to the memory. It may be an instruction to read and write.
これにより、共有の変数は、他のプログラム(又は、スレッド)からも参照される可能性があるため、共有の変数をメモリに読み書きする第2メモリアクセス命令が解読された場合、ウェイの予測が外れる可能性が高い。これに対して、排他の変数は、他のプログラムからは参照されないため、排他の変数をメモリに読み書きする第1メモリアクセス命令が解読された場合、ウェイの予測が外れる可能性が低い。したがって、予測が外れる可能性が高い場合には、予測結果を無視し、予測が外れる可能性が低い場合には、予測を利用するので、性能の劣化及び消費電力の増加を抑制することができる。 As a result, the shared variable may be referred to by other programs (or threads). Therefore, when the second memory access instruction for reading / writing the shared variable from / to the memory is decoded, the way prediction is performed. There is a high possibility of coming off. On the other hand, since the exclusive variable is not referred to by other programs, when the first memory access instruction that reads / writes the exclusive variable to / from the memory is decoded, the possibility that the way is unpredictable is low. Therefore, when there is a high possibility of being out of prediction, the prediction result is ignored, and when there is a low possibility of being out of prediction, the prediction is used, so that deterioration in performance and increase in power consumption can be suppressed. .
また、前記第1メモリアクセス命令は、局所変数宣言された変数をメモリに読み書きする命令であり、前記第2メモリアクセス命令は、共有変数宣言された変数をメモリに読み書きする命令であってもよい。 The first memory access instruction may be an instruction for reading / writing a variable declared as a local variable into / from a memory, and the second memory access instruction may be an instruction for reading / writing a variable declared as a shared variable into / from a memory. .
これにより、共有変数宣言された変数は、他のプログラム(又は、スレッド)からも参照される可能性があるため、共有変数宣言された変数をメモリに読み書きする第2メモリアクセス命令が解読された場合、ウェイの予測が外れる可能性が高い。これに対して、局所変数宣言された変数は、他のプログラムからは参照されないため、局所変数宣言された変数をメモリに読み書きする第1メモリアクセス命令が解読された場合、ウェイの予測が外れる可能性が低い。したがって、予測が外れる可能性が高い場合には、予測結果を無視し、予測が外れる可能性が低い場合には、予測を利用するので、性能の劣化及び消費電力の増加を抑制することができる。 As a result, since the variable declared as a shared variable may be referred to by other programs (or threads), the second memory access instruction for reading / writing the variable declared as a memory from / to the memory is decoded. If this is the case, there is a high possibility that the way is unpredictable. On the other hand, since variables declared as local variables are not referred to by other programs, if the first memory access instruction that reads / writes the variables declared as local variables into the memory is decoded, the way may be unpredictable. The nature is low. Therefore, when there is a high possibility of being out of prediction, the prediction result is ignored, and when there is a low possibility of being out of prediction, the prediction is used, so that deterioration in performance and increase in power consumption can be suppressed. .
また、前記第2メモリアクセス命令は、ウェイの予測結果を利用しないことを示す属性ビットを含んでもよい。 The second memory access instruction may include an attribute bit indicating that the way prediction result is not used.
これにより、メモリアクセス命令に含まれるビットを判断するだけで、予測結果を利用するか否かを容易に決定することができる。 Thereby, it is possible to easily determine whether or not to use the prediction result only by determining the bit included in the memory access instruction.
また、前記クロック制御部は、さらに、前記第1メモリアクセス命令が前記プロセッサ部で解読された場合に、前記複数のウェイに含まれる複数のタグ格納部のうち、前記ウェイ予測部によって予測されたウェイのタグ格納部のみにクロックを供給し、前記第2メモリアクセス命令が前記プロセッサ部で解読された場合に、前記ウェイ予測部による予測結果に関わらず、前記複数のウェイに含まれる複数のタグ格納部のうち、予め定められたタグ格納部にクロックを供給してもよい。 The clock control unit is further predicted by the way prediction unit among a plurality of tag storage units included in the plurality of ways when the first memory access instruction is decoded by the processor unit. When a clock is supplied only to the tag storage unit of the way and the second memory access instruction is decoded by the processor unit, a plurality of tags included in the plurality of ways regardless of a prediction result by the way prediction unit Of the storage units, a clock may be supplied to a predetermined tag storage unit.
これにより、ウェイの予測結果に応じて、タグ格納部にクロックを供給するか否かを判定するので、消費電力をさらに低減することができる。 Thus, since it is determined whether or not to supply a clock to the tag storage unit according to the way prediction result, the power consumption can be further reduced.
また、前記クロック制御部は、前記第2メモリアクセス命令が前記プロセッサ部で解読された場合に、前記複数のウェイに含まれる全てのデータ格納部にクロックを供給してもよい。 The clock control unit may supply a clock to all the data storage units included in the plurality of ways when the second memory access instruction is decoded by the processor unit.
これにより、予測が外れる可能性が高い場合には、全てのデータ格納部にクロックを供給するので、タグがヒットした場合に、データがミスヒットすることを防止することができるので、性能の劣化を抑制することができる。 As a result, when there is a high possibility that the prediction will be lost, the clock is supplied to all the data storage units, so that when the tag is hit, it is possible to prevent the data from being mis-hit. Can be suppressed.
また、前記複数のウェイは、前記複数のプログラムに割り当てられ、前記クロック制御部は、前記第2メモリアクセス命令が前記プロセッサ部で解読された場合に、前記複数のウェイに含まれる複数のデータ格納部のうち、前記第2メモリアクセス命令を含むプログラムに割り当てられたウェイに含まれるデータ格納部にクロックを供給してもよい。 The plurality of ways are assigned to the plurality of programs, and the clock control unit stores a plurality of data included in the plurality of ways when the second memory access instruction is decoded by the processor unit. The clock may be supplied to a data storage unit included in a way allocated to the program including the second memory access instruction.
これにより、予測が外れる可能性が高い場合には、プログラムを実行するために割り当てられた1つ以上のウェイの1つ以上のデータ格納部にクロックを供給するので、タグがヒットした場合に、データがミスヒットする可能性を低減することができる。さらに、全てのデータ格納部にクロックを供給する場合に比べて、消費電力を低減することができる。 This provides a clock to one or more data storages of one or more ways allocated to execute the program when there is a high probability of being unpredictable, so when a tag hits, The possibility of data hits being reduced can be reduced. Furthermore, power consumption can be reduced compared to the case where clocks are supplied to all data storage units.
また、前記ウェイ予測部は、ヒットしたウェイの履歴を示す履歴情報を保持する履歴保持部と、前記履歴情報に基づいて、前記ヒットするウェイを予測する予測部と、前記履歴情報を更新する更新部とを備え、前記更新部は、前記第1メモリアクセス命令が前記プロセッサ部で解読された場合に、前記第1メモリアクセス命令によってヒットしたウェイを示す情報を用いて、前記履歴情報を更新し、前記第2メモリアクセス命令が前記プロセッサ部で解読された場合に、前記履歴情報を更新しなくてもよい。 The way prediction unit includes a history holding unit that holds history information indicating a history of hit ways, a prediction unit that predicts the way to be hit based on the history information, and an update that updates the history information. And the update unit updates the history information using information indicating a way hit by the first memory access instruction when the first memory access instruction is decoded by the processor unit. The history information may not be updated when the second memory access instruction is decoded by the processor unit.
これにより、予測が外れる可能性が高い場合には、履歴情報の更新を行わないので、予測のアルゴリズムを壊すことがなく、以降に実行されるメモリアクセス命令に対して適切な予測を行うことができる。 As a result, when there is a high possibility that the prediction will be lost, the history information is not updated, so that the prediction algorithm is not broken, and an appropriate prediction can be made for a memory access instruction to be executed later. it can.
また、前記ウェイ予測部は、ヒットしたウェイの履歴を示す履歴情報を保持する履歴保持部と、前記履歴情報に基づいて、前記ヒットするウェイを予測する予測部と、前記履歴情報を更新する更新部とを備え、前記更新部は、前記第1メモリアクセス命令が前記プロセッサ部で解読された場合に、前記第1メモリアクセス命令によってヒットしたウェイを示す情報を用いて、前記履歴情報を更新し、前記第2メモリアクセス命令が前記プロセッサ部で解読された場合に、前記第2メモリアクセス命令によってヒットしたウェイを示す情報を用いて、前記履歴情報を更新してもよい。 The way prediction unit includes a history holding unit that holds history information indicating a history of hit ways, a prediction unit that predicts the way to be hit based on the history information, and an update that updates the history information. And the update unit updates the history information using information indicating a way hit by the first memory access instruction when the first memory access instruction is decoded by the processor unit. When the second memory access instruction is decoded by the processor unit, the history information may be updated using information indicating a way hit by the second memory access instruction.
これにより、複数のプログラムのうち単一のプログラムのみが一定期間実行されてヒットするウェイの履歴が単一のプログラムにより決定される場合に、予測の当たる確率を向上させることができる。 Thereby, when only a single program among a plurality of programs is executed for a certain period and a history of hit ways is determined by the single program, it is possible to improve the probability of being predicted.
また、本発明の一態様に係るプログラム変換装置は、ウェイの予測機能を有するキャッシュメモリに対応するメモリアクセス命令を生成するプログラム変換装置であって、入力されたプログラムからメモリアクセス命令を抽出する抽出部と、前記抽出部によって抽出されたメモリアクセス命令が示す変数が、グローバル変数であるか否かを判定する判定部と、前記判定部によってグローバル変数であると判定された場合、対応するメモリアクセス命令を、前記キャッシュメモリにウェイの予測結果を利用させないようにするための予測無視メモリアクセス命令に変換する変換部とを備える。 A program conversion apparatus according to an aspect of the present invention is a program conversion apparatus that generates a memory access instruction corresponding to a cache memory having a way prediction function, and extracts a memory access instruction from an input program , A determination unit that determines whether or not the variable indicated by the memory access instruction extracted by the extraction unit is a global variable, and a corresponding memory access when the determination unit determines that the variable is a global variable A conversion unit that converts the instruction into a prediction ignore memory access instruction for preventing the cache memory from using the way prediction result.
これにより、上記のキャッシュメモリ装置のような、ウェイの予測機能を有するキャッシュメモリに対応するメモリアクセス命令を生成することができる。グローバル変数は、他のプログラム(又は、スレッド)からも参照される可能性があるため、グローバル変数をメモリに読み書きするメモリアクセス命令が解読された場合、ウェイの予測が外れる可能性が高い。このため、グローバル変数をメモリに読み書きするメモリアクセス命令を予測無視メモリアクセス命令に変換することで、キャッシュメモリにおいて、予測結果を無視させることができる。したがって、キャッシュメモリの性能の劣化及び消費電力の増加を抑制することができる。 Thereby, a memory access instruction corresponding to a cache memory having a way prediction function, such as the above-described cache memory device, can be generated. Since the global variable may be referred to by other programs (or threads), when a memory access instruction for reading / writing the global variable from / to the memory is decoded, there is a high possibility that the way is unpredictable. Therefore, the prediction result can be ignored in the cache memory by converting the memory access instruction for reading / writing the global variable into / from the memory into the prediction ignoring memory access instruction. Therefore, it is possible to suppress deterioration in performance of the cache memory and increase in power consumption.
また、前記判定部は、前記抽出部によって抽出されたメモリアクセス命令が示す変数が、複数のプログラムの間において共有の変数である場合に、当該変数をグローバル変数であると判定してもよい。 The determination unit may determine that the variable is a global variable when the variable indicated by the memory access instruction extracted by the extraction unit is a shared variable among a plurality of programs.
これにより、共有の変数は、他のプログラム(又は、スレッド)からも参照される可能性があるため、共有の変数をメモリに読み書きするメモリアクセス命令が解読された場合、ウェイの予測が外れる可能性が高い。したがって、予測が外れる可能性が高い場合には、予測結果を無視させるので、性能の劣化及び消費電力の増加を抑制することができる。 As a result, shared variables may be referenced by other programs (or threads), so if a memory access instruction that reads or writes shared variables to / from memory is decoded, the way may be unpredictable. High nature. Therefore, when there is a high possibility that the prediction will be lost, the prediction result is ignored, so that deterioration in performance and increase in power consumption can be suppressed.
また、前記判定部は、前記抽出部によって抽出されたメモリアクセス命令が示す変数が、共有変数宣言された変数である場合に、当該変数をグローバル変数であると判定してもよい。 The determination unit may determine that the variable is a global variable when the variable indicated by the memory access instruction extracted by the extraction unit is a variable declared as a shared variable.
これにより、共有変数宣言された変数は、他のプログラム(又は、スレッド)からも参照される可能性があるため、共有変数宣言された変数をメモリに読み書きするメモリアクセス命令が解読された場合、ウェイの予測が外れる可能性が高い。したがって、予測が外れる可能性が高い場合には、予測結果を無視させるので、性能の劣化及び消費電力の増加を抑制することができる。 As a result, a variable declared as a shared variable may be referred to by other programs (or threads). Therefore, when a memory access instruction that reads / writes a variable declared as a shared variable from / to a memory is decoded, There is a high possibility that the way is unpredictable. Therefore, when there is a high possibility that the prediction will be lost, the prediction result is ignored, so that deterioration in performance and increase in power consumption can be suppressed.
また、前記変換部は、前記判定部によってグローバル変数であると判定された場合、対応するメモリアクセス命令を、ウェイの予測結果を利用しないことを示す属性ビットを含む前記予測無視メモリアクセス命令に変換してもよい。 When the determination unit determines that the variable is a global variable, the conversion unit converts the corresponding memory access instruction into the prediction ignoring memory access instruction including an attribute bit indicating that the way prediction result is not used. May be.
これにより、メモリアクセス命令にビットを追加するだけで、予測無視メモリアクセス命令を生成することができる。 As a result, a predicted ignore memory access instruction can be generated simply by adding a bit to the memory access instruction.
また、本発明の一態様に係るキャッシュメモリ制御方法は、複数のプログラムを切り替えながら実行するプロセッサ部に接続されるキャッシュメモリを制御するキャッシュメモリ制御方法であって、前記キャッシュメモリは、前記プロセッサ部に接続され、タグ格納部及びデータ格納部をそれぞれが含む複数のウェイを備えるセットアソシアティブ方式のキャッシュメモリであり、前記キャッシュメモリ制御方法は、前記プロセッサ部でメモリアクセス命令が解読されたときに、前記複数のウェイのうちヒットするウェイを予測するウェイ予測ステップと、前記プロセッサ部で解読されたメモリアクセス命令の種別に基づいて、前記複数のウェイに供給するクロックを制御するクロック制御ステップとを含み、前記クロック制御ステップでは、第1メモリアクセス命令が前記プロセッサ部で解読された場合に、前記複数のウェイに含まれる複数のデータ格納部のうち、前記ウェイ予測ステップにおいて予測されたウェイのデータ格納部のみにクロックを供給し、前記第1メモリアクセス命令とは異なる第2メモリアクセス命令が前記プロセッサ部で解読された場合に、前記ウェイ予測ステップにおける予測結果に関わらず、前記複数のウェイに含まれる複数のデータ格納部のうち、予め定められたデータ格納部にクロックを供給する。 A cache memory control method according to an aspect of the present invention is a cache memory control method for controlling a cache memory connected to a processor unit that executes a plurality of programs while switching, wherein the cache memory includes the processor unit Is a set associative cache memory including a plurality of ways each including a tag storage unit and a data storage unit, and the cache memory control method is configured such that when a memory access instruction is decoded by the processor unit, A way prediction step for predicting a hit way among the plurality of ways, and a clock control step for controlling a clock supplied to the plurality of ways based on a type of a memory access instruction decoded by the processor unit. In the clock control step, When the first memory access instruction is decoded by the processor unit, the clock is supplied only to the data storage unit of the way predicted in the way prediction step among the plurality of data storage units included in the plurality of ways. When a second memory access instruction different from the first memory access instruction is decoded by the processor unit, a plurality of data storage units included in the plurality of ways are included regardless of a prediction result in the way prediction step. Among them, a clock is supplied to a predetermined data storage unit.
これにより、第2メモリアクセス命令が解読された場合は、ウェイの予測結果を利用せずに、予め定められたウェイのデータ格納部にクロックを供給するので、例えば、予測が外れやすい場合には、予測結果を無視することができるので、予測が外れたことによる処理の繰り返しを抑制することができる。したがって、キャッシュメモリの性能の劣化を抑制することができるとともに、処理の繰り返しによる消費電力の増加も抑制することができる。 As a result, when the second memory access instruction is decoded, the clock is supplied to the data storage unit of the predetermined way without using the way prediction result. Since the prediction result can be ignored, it is possible to suppress the repetition of the processing due to the prediction failure. Therefore, it is possible to suppress the deterioration of the performance of the cache memory and to suppress an increase in power consumption due to repeated processing.
また、第1メモリアクセス命令が解読された場合は、ウェイの予測結果を利用し、予測されたウェイのデータ格納部のみにクロックを供給するので、消費電力の増加を抑制することができる。 When the first memory access instruction is decoded, the way prediction result is used and the clock is supplied only to the data storage unit of the predicted way, so that an increase in power consumption can be suppressed.
また、本発明の一態様に係るプログラム変換方法は、ウェイの予測機能を有するキャッシュメモリに対応するメモリアクセス命令を生成するプログラム変換方法であって、入力されたプログラムからメモリアクセス命令を抽出する抽出ステップと、前記抽出ステップにおいて抽出されたメモリアクセス命令が示す変数が、グローバル変数であるか否かを判定する判定ステップと、前記判定ステップにおいてグローバル変数であると判定された場合、対応するメモリアクセス命令を、前記キャッシュメモリにウェイの予測結果を利用させないようにするための予測無視メモリアクセス命令に変換する変換ステップとを含む。 A program conversion method according to an aspect of the present invention is a program conversion method for generating a memory access instruction corresponding to a cache memory having a way prediction function, and extracting a memory access instruction from an input program And a determination step for determining whether or not the variable indicated by the memory access instruction extracted in the extraction step is a global variable, and if it is determined in the determination step that the variable is a global variable, the corresponding memory access A conversion step of converting the instruction into a prediction ignoring memory access instruction for preventing the cache memory from using the prediction result of the way.
これにより、上記のキャッシュメモリ装置のように、ウェイの予測機能を有するキャッシュメモリに対応するメモリアクセス命令を生成することができる。 Thus, a memory access instruction corresponding to a cache memory having a way prediction function can be generated as in the above-described cache memory device.
本発明によれば、性能の劣化を抑制するとともに、消費電力の増加を抑制することができる。 According to the present invention, it is possible to suppress degradation in performance and suppress an increase in power consumption.
以下では、本発明のキャッシュメモリ装置及びプログラム変換装置について、実施の形態に基づいて、図面を用いて詳細に説明する。 Hereinafter, a cache memory device and a program conversion device of the present invention will be described in detail with reference to the drawings based on embodiments.
(実施の形態1)
本発明の実施の形態1に係るキャッシュメモリ装置は、複数のプログラムを切り替えながら実行するプロセッサに接続されるキャッシュメモリ装置である。実施の形態1に係るキャッシュメモリ装置は、タグ格納部及びデータ格納部を含む複数のウェイを備えるキャッシュメモリと、プロセッサでメモリアクセス命令が実行されるときに、複数のウェイのうちのヒットするウェイを予測するウェイ予測部とを備える。さらに、実施の形態1に係るキャッシュメモリ装置は、クロック制御部を備え、クロック制御部は、第1メモリアクセス命令が解読された場合に、ウェイ予測部によって予測されたウェイのデータ格納部のみにクロックを供給し、第2メモリアクセス命令が解読された場合に、予め定められたデータ格納部にクロックを供給することを特徴とする。
(Embodiment 1)
The cache memory device according to the first embodiment of the present invention is a cache memory device connected to a processor that executes a plurality of programs while switching. The cache memory device according to the first embodiment includes a cache memory including a plurality of ways including a tag storage unit and a data storage unit, and a way that hits among the plurality of ways when a memory access instruction is executed by the processor. A way prediction unit for predicting Furthermore, the cache memory device according to the first embodiment includes a clock control unit, and the clock control unit only stores the data storage unit of the way predicted by the way prediction unit when the first memory access instruction is decoded. A clock is supplied, and the clock is supplied to a predetermined data storage unit when the second memory access instruction is decoded.
言い換えると、本発明の実施の形態1に係るキャッシュメモリ装置は、予測が外れる可能性が高い第2メモリアクセス命令がプロセッサ部で解読された場合には、ウェイ予測部による予測結果を無視して、予め定められたデータ格納部にクロックを供給する。また、本発明の実施の形態1に係るキャッシュメモリ装置は、予測が外れる可能性が低い第1メモリアクセス命令がプロセッサ部で解読された場合には、ウェイ予測部による予測結果に従って、予測されたウェイのデータ格納部にクロックを供給する。 In other words, the cache memory device according to the first embodiment of the present invention ignores the prediction result by the way prediction unit when the second memory access instruction that is highly likely to be predicted is decoded by the processor unit. The clock is supplied to a predetermined data storage unit. In addition, the cache memory device according to the first embodiment of the present invention is predicted according to the prediction result by the way prediction unit when the first memory access instruction that is unlikely to be unpredicted is decoded by the processor unit. A clock is supplied to the data storage unit of the way.
図1は、本発明の実施の形態1に係るキャッシュメモリシステム10の構成の一例を示すブロック図である。
FIG. 1 is a block diagram showing an example of the configuration of a
図1に示すように、本発明の実施の形態1に係るキャッシュメモリシステム10は、キャッシュメモリ装置100と、プロセッサ部200とを備える。
As shown in FIG. 1, the
キャッシュメモリ装置100は、プロセッサ部200及びメインメモリ(図示せず)に接続されている。キャッシュメモリ装置100は、プロセッサ部200によってメモリアクセス命令が実行された場合に、ヒットかミスヒットかを判定する。具体的には、キャッシュメモリ装置100は、メモリアクセス命令が示すアドレスに対応するエントリがキャッシュメモリに存在する(ヒット)か否か(ミスヒット)を判定する。
The
例えば、メモリアクセス命令がリード命令である場合、キャッシュメモリ装置100は、リード命令が示すリードアドレスに対応するエントリがあり、かつ、当該エントリに格納されたデータが有効である場合に、ヒットと判定し、そうでない場合に、ミスヒットと判定する。また、メモリアクセス命令がライト命令である場合、キャッシュメモリ装置100は、ライト命令が示すライトアドレスに対応するエントリがある場合に、ヒットと判定し、そうでない場合に、ミスヒットと判定する。
For example, when the memory access instruction is a read instruction, the
リード命令が実行された場合において、ミスヒットと判定された場合は、キャッシュメモリ装置100は、キャッシュメモリにエントリを作成し、メインメモリから該当するデータを読み出す。そして、キャッシュメモリ装置100は、読み出したデータを、作成したエントリに書き込むとともに、プロセッサ部200に出力する。
When the read instruction is executed and it is determined as a miss hit, the
また、ライト命令が実行された場合において、ミスヒットと判定された場合は、キャッシュメモリ装置100は、キャッシュメモリにエントリを作成し、作成したエントリにデータを書き込む。そして、キャッシュメモリ装置100は、所定のタイミングで、メインメモリに、エントリに書き込んだデータを書き込む。
When the write instruction is executed and it is determined that there is a miss hit, the
図1に示すように、キャッシュメモリ装置100は、キャッシュメモリ110と、ウェイ予測部120と、TLB(Translation Look−aside Buffer)130とを備える。
As shown in FIG. 1, the
キャッシュメモリ110は、n(nは2以上の整数)個のウェイを有するセットアソシアティブ方式のキャッシュメモリであり、プロセッサ部200に接続されている。具体的には、キャッシュメモリ110は、プロセッサ部200が備えるプロセッサ210と接続され、メモリアクセス命令が実行された場合に、当該メモリアクセス命令に含まれるアドレス151が入力される。本発明の実施の形態1では、一例として、キャッシュメモリ110は、2個のウェイを有する。
The
また、キャッシュメモリ110には、ライト命令が実行された場合に、書き込みデータ152が入力される。さらに、キャッシュメモリ110は、リード命令が実行された場合に、読み出しデータ153をプロセッサ210へ出力する。
The
図1に示すように、キャッシュメモリ110は、タグ格納部群111と、データ格納部群112と、クロック制御部113と、ヒット判定部114と、セレクタ115とを備える。
As illustrated in FIG. 1, the
なお、以下の説明では、一例として、キャッシュメモリ110は、物理アドレスを格納する場合について説明する。アドレス151は、論理アドレス(仮想アドレス)であって、TLB130によって物理アドレスに変換される。そして、変換された物理アドレスが、アドレス151として、キャッシュメモリ110に入力されるものとする(この処理を示す経路については図1に示していない)。なお、キャッシュメモリ110は、仮想アドレスを格納してもよい。
In the following description, as an example, the case where the
タグ格納部群111は、n個のタグ格納部、すなわち、ウェイの数と同数のタグ格納部を有し、n個のタグ格納部のそれぞれに、複数のタグアドレスを格納することができる。1つのタグ格納部は、複数の(例えば、16個)エントリを含み、各エントリに1つのタグアドレスを格納することができる。タグアドレスは、例えば、21ビットであり、データの書き込み先、又は、データの読み出し先を示すアドレスである。本実施の形態では、ウェイは2個であるので、タグ格納部群111は、2個のタグ格納部111a及び111bを有する。
The tag
タグ格納部111a及び111bには、アドレス151が入力される。アドレス151は、例えば、タグアドレス、セットインデックス及びワードインデックスを含んでいる。タグ格納部111a及び111bは、アドレス151に含まれるセットインデックスに対応するエントリに格納されたタグアドレスを、タグデータ160a及び160bとして出力する。
An
データ格納部群112は、n個のデータ格納部、すなわち、ウェイの数と同数のデータ格納部を有し、n個のデータ格納部のそれぞれに、複数のデータを格納することができる。1つのデータ格納部は、複数の(例えば、16個)エントリ、すなわち、1つのタグ格納部が有するエントリの個数と同数のエントリを含み、各エントリに1つのデータを格納することができる。1つのデータのサイズは、例えば、64又は128バイトである。本実施の形態では、ウェイは2個であるので、データ格納部群112は、2個のデータ格納部112a及び112bを有する。
The data
データ格納部112a及び112bには、アドレス151が入力される。データ格納部112a及び112bは、アドレス151に含まれるセットインデックスに対応するデータを、データ格納部読み出しデータ161a及び161bとして出力する。
An
なお、タグ格納部111aとデータ格納部112aとは第1ウェイに含まれる。1つのウェイには、複数の(例えば、16個)エントリ(キャッシュライン)が含まれる。複数のエントリのそれぞれが、タグ格納部111aの1つのタグアドレスとデータ格納部112aの1つのデータとを含んでいる。つまり、タグ格納部111aに格納されるタグアドレスと、データ格納部112aに格納されるデータとは、互いに対応付けられている。
The
同様に、タグ格納部111bとデータ格納部112bとが第2ウェイに含まれる。
Similarly, the
また、プロセッサ210で実行されたメモリアクセス命令がライト命令である場合は、データ格納部群112には、アドレス151とともに、書き込みデータ152が入力される。そして、データ格納部群112は、ヒット判定部114から入力されるキャッシュヒット信号162とアドレス151とに基づいて、書き込みを行うウェイ及びエントリを決定し、決定したエントリに書き込みデータ152を書き込む。
When the memory access instruction executed by the
クロック制御部113は、プロセッサ部200で解読されたメモリアクセス命令の種別に基づいて、複数のウェイに供給するクロックを制御する。具体的には、クロック制御部113は、第1メモリアクセス命令が解読された場合に、複数のウェイに含まれる複数のデータ格納部のうち、ウェイ予測部120によって予測されたウェイのデータ格納部のみにクロックを供給する。第1メモリアクセス命令は、例えば、プロセッサ210で実行中の複数のプログラムの間において排他の変数をメモリに読み書きする命令である。
The
また、クロック制御部113は、第2メモリアクセス命令が解読された場合に、ウェイ予測部120による予測結果に関わらず、複数のウェイに含まれる複数のデータ格納部のうち、予め定められたデータ格納部にクロックを供給する。より具体的には、クロック制御部113は、予め定められたデータ格納部として、全てのデータ格納部にクロックを供給する。
In addition, when the second memory access instruction is decoded, the
また、第2メモリアクセス命令は、第1メモリアクセス命令とは異なるタイプの命令である。例えば、第2メモリアクセス命令は、プロセッサ210で実行中の複数のプログラムの間において共有の変数をメモリに読み書きする命令である。
The second memory access instruction is a different type of instruction from the first memory access instruction. For example, the second memory access instruction is an instruction to read / write a shared variable between a plurality of programs being executed by the
図1に示すように、クロック制御部113は、n個のクロック制御信号生成部、すなわち、ウェイの数と同数のクロック制御信号生成部を有する。本実施の形態では、ウェイが2個であるので、クロック制御部113は、2個のクロック制御信号生成部113a及び113bを有する。
As shown in FIG. 1, the
クロック制御信号生成部113a及び113bは、例えば、OR回路によって構成される。具体的には、図1に示すように、クロック制御信号生成部113aには、共有アクセス信号156とウェイ予測部120から出力されるウェイ予測信号158aとが入力される。クロック制御信号生成部113aは、共有アクセス信号156とウェイ予測信号158aとの少なくとも1つがHighレベルであれば、クロック制御信号159aを出力する。
The clock
ウェイ予測信号158aは、第1ウェイがヒットするウェイであると予測されたか否かを示す信号である。ウェイ予測部120によって第1ウェイがヒットするウェイであると予測された場合に、ウェイ予測信号158aはHighレベルとなり、そうでない場合に、ウェイ予測信号158aはLowレベルとなる。
The
また、共有アクセス信号156は、プロセッサ部200から出力される信号であって、プロセッサ部200で第2メモリアクセス命令が解読された場合に、Highレベルとなる信号である。クロック制御信号159aは、第1ウェイに含まれるデータ格納部112aにクロックを供給するための信号である。
The shared
また、クロック制御信号生成部113bには、共有アクセス信号156とウェイ予測部120から出力されるウェイ予測信号158bとが入力される。クロック制御信号生成部113bは、共有アクセス信号156とウェイ予測信号158bとの少なくとも1つがHighレベルであれば、クロック制御信号159bを出力する。
The shared
ウェイ予測信号158bは、第2ウェイがヒットするウェイであると予測されたか否かを示す信号である。ウェイ予測部120によって第2ウェイがヒットするウェイであると予測された場合に、ウェイ予測信号158bはHighレベルとなり、そうでない場合に、ウェイ予測信号158bはLowレベルとなる。クロック制御信号159bは、第2ウェイに含まれるデータ格納部112bにクロックを供給するための信号である。
The
図1に示すように、共有アクセス信号156は、クロック制御部113が備える全てのクロック制御信号生成部に入力される。したがって、全てのクロック制御信号生成部はそれぞれ、クロック制御信号を出力するので、データ格納部群112が備える全てのデータ格納部にクロックが供給される。
As shown in FIG. 1, the shared
つまり、共有アクセス信号156がキャッシュメモリ装置100に入力された場合は、ウェイ予測部120の予測結果に関わらず、予め定められたウェイ、本実施の形態の例では、全てのウェイに含まれる全てのデータ格納部にクロックが供給される。つまり、予測結果が無視される。
In other words, when the shared
ヒット判定部114は、TLB130から出力される物理ページ番号163と、タグデータ160a及び160bとを用いて、ヒットかミスヒットかを判定する。具体的には、ヒット判定部114は、物理ページ番号163に対応するタグアドレスを、タグデータ160a及び160bのいずれかが示す場合を、ヒットと判定する。ヒットの場合は、ヒット判定部114は、ヒットであること、及び、ヒットしたウェイを示すキャッシュヒット信号162をセレクタ115及びウェイ予測部120へ出力する。
The hit determination unit 114 determines a hit or a miss by using the
また、アドレス151が、ライト命令が示すアドレスである場合において、ヒットの場合は、キャッシュヒット信号162をデータ格納部群112へ出力する。
If the
セレクタ115は、キャッシュヒット信号162に基づいて、データ格納部読み出しデータ161a及び161bを選択し、選択したデータを読み出しデータ153としてプロセッサ210へ出力する。
The
ウェイ予測部120は、プロセッサ210でメモリアクセス命令が実行されるときに、複数のウェイのうちのヒットするウェイを予測する。例えば、ウェイ予測部120は、過去にヒットしたウェイの履歴に基づいて、ヒットするウェイを予測する。
The
そして、ウェイ予測部120は、予測したウェイのデータ格納部のみにクロックを供給するように、クロック制御部113を制御する。例えば、ウェイ予測部120は、第1ウェイがヒットするウェイであると予測した場合には、Highレベルとなるウェイ予測信号158aを出力する。また、ウェイ予測部120は、第2ウェイがヒットするウェイであると予測した場合には、Highレベルとなるウェイ予測信号158bを出力する。
Then, the
なお、ウェイ予測部120は、プロセッサ部200から排他アクセス信号157が入力された場合にのみウェイの予測を行い、共有アクセス信号156が入力された場合には、ウェイの予測を行わなくてもよい。排他アクセス信号157は、プロセッサ部200から出力される信号であって、プロセッサ部200で第1メモリアクセス命令が解読された場合に、Highレベルとなる信号である。
The
TLB130は、プロセッサ210からアドレス151が入力される。アドレス151は、論理アドレス(仮想アドレス)であり、TLB130は、高速に論理アドレスを物理アドレスに変換するために用いられるキャッシュメモリである。TLB130は、アドレス151が入力された場合において、ヒットである場合には、物理ページ番号163を出力する。
The
なお、本実施の形態では、キャッシュメモリ装置100がTLB130を備える構成について説明したが、プロセッサ部200がTLB130を備えてもよい。また、キャッシュメモリ装置100及びプロセッサ部200とは別に、TLB130を設けてもよい。
In the present embodiment, the configuration in which the
以上のように、本発明の実施の形態1に係るキャッシュメモリ装置100は、プロセッサ部200から排他アクセス信号157が入力された場合は、ウェイ予測部120によって予測されたウェイのデータ格納部のみにクロックを供給する。また、キャッシュメモリ装置100は、プロセッサ部200から共有アクセス信号156が入力された場合は、ウェイ予測部120による予測結果を無視して、全てのデータ格納部にクロックを供給する。
As described above, in the
このように、本発明の実施の形態1に係るキャッシュメモリ装置100は、プロセッサ部200から入力される信号に基づいて、クロックを供給するデータ格納部を制御する。したがって、予測が当たる可能性が高い場合には、予測されたウェイのデータ格納部だけにクロックを供給することができるので、消費電力の増加を抑制することができる。また、予測が当たる可能性が低い場合には、全てのデータ格納部にクロックを供給することで、予測が外れた場合に、処理が繰り返されるのを防ぐことができるので、レイテンシーの低下を抑制することができ、性能の劣化を抑制することができる。
As described above, the
続いて、図1に示すプロセッサ部200について説明する。
Next, the
プロセッサ部200は、キャッシュメモリ装置100及びメインメモリ(図示せず)に接続され、プログラムを実行することで、キャッシュメモリ装置100及びメインメモリにデータを読み書きする。図1に示すように、プロセッサ部200は、プロセッサ210と、命令解読部220と、命令キャッシュメモリ230とを備える。
The
プロセッサ210は、複数のプログラムを切り替えながら実行する。つまり、プロセッサ210は、マルチタスク処理及びマルチスレッド処理を実行する。したがって、プロセッサ210が実行するメモリアクセス命令は、例えば、以下の2つのタイプのメモリアクセス命令に分類される。第1タイプのメモリアクセス命令である第1メモリアクセス命令は、複数のプログラムの間において排他の変数をメモリに読み書きする命令である。また、第2タイプのメモリアクセス命令である第2メモリアクセス命令は、複数のプログラムの間において共有の変数をメモリに読み書きする命令である。
The
命令解読部220は、命令キャッシュメモリ230から命令コード154を読み出し、読み出した命令コード154を解読することで、命令デコード信号155を生成して、プロセッサ210に出力する。
The
命令解読部220は、複数のプログラムを解読することで、メモリアクセス命令が第1メモリアクセス命令であるか第2メモリアクセス命令であるかを判定する。また、命令解読部220は、判定結果に応じた信号を、キャッシュメモリ装置100に出力する。具体的には、命令解読部220は、第1メモリアクセス命令の場合、排他アクセス信号157を出力し、第2メモリアクセス命令の場合、共有アクセス信号156を出力する。
The
なお、第1メモリアクセス命令は、局所変数宣言された変数、具体的には、ローカル変数をメモリに読み書きする命令であり、第2メモリアクセス命令は、共有変数宣言された変数、具体的には、グローバル変数をメモリに読み書きする命令であってもよい。 The first memory access instruction is a variable declared as a local variable, specifically, an instruction for reading / writing a local variable into / from memory. The second memory access instruction is a variable declared as a shared variable, specifically, An instruction for reading / writing a global variable from / to a memory may be used.
第1メモリアクセス命令は、キャッシュメモリ装置100においてウェイの予測が外れる可能性が低い命令であり、第2メモリアクセス命令は、キャッシュメモリ装置100においてウェイの予測が外れる可能性が高い命令である。例えば、複数のプログラム間で共有の変数、及び、共有変数宣言された変数は、他のプログラムを実行した場合にもアクセスされる変数である。
The first memory access instruction is an instruction with a low possibility of way prediction being missed in the
1つのプログラムを実行した場合に使用されるデータは、同一のウェイに格納されることが多いが、共有の変数及び共有変数宣言された変数は、他のプログラムでも実行される。このため、これらの変数は、処理対象のプログラムを実行するために割り当てられたウェイとは、異なるウェイに格納されている場合が生じる。ウェイの予測は上述したように、過去の履歴に基づいて実行されるので、途中での他のプログラムによるアクセスが割り込むと、予測が外れやすい。したがって、第2メモリアクセス命令は、ウェイの予測が外れる可能性が高いメモリアクセス命令である。 Data used when one program is executed is often stored in the same way, but a shared variable and a variable declared as a shared variable are also executed in another program. For this reason, these variables may be stored in a way different from the way assigned to execute the program to be processed. As described above, since the way prediction is executed based on the past history, if access by another program is interrupted, the prediction is likely to be lost. Therefore, the second memory access instruction is a memory access instruction that is highly likely to be out of the way prediction.
命令キャッシュメモリ230は、プロセッサ210が実行する命令を格納するためのキャッシュメモリである。命令キャッシュメモリ230は、命令解読部220によって解読された命令を格納する。
The
以上のように、本発明の実施の形態1に係るプロセッサ部200は、メモリアクセス命令のタイプに応じて、キャッシュメモリ装置100のウェイ予測機能の制御を行う。具体的には、プロセッサ部200は、第1メモリアクセス命令を実行した場合は、排他アクセス信号157を出力して、キャッシュメモリ装置100に、ウェイ予測の結果を利用させる。また、プロセッサ部200は、第2メモリアクセス命令を実行した場合は、共有アクセス信号156を出力して、キャッシュメモリ装置100に、ウェイ予測の結果を無視させる。
As described above, the
このようにして、本発明の実施の形態1に係るキャッシュメモリシステム10によれば、予測が当たる可能性が高い場合には、予測されたウェイのデータ格納部だけにクロックを供給することができるので、消費電力の増加を抑制することができる。また、予測が当たる可能性が低い場合には、全てのデータ格納部にクロックを供給することで、予測が外れた場合に、処理が繰り返されるのを防ぐことができるので、レイテンシーの低下を抑制することができ、性能の劣化を抑制することができる。
As described above, according to the
続いて、本発明の実施の形態1に係るキャッシュメモリ装置100の具体的な動作について説明する。まず、メモリアクセス命令の具体例について、図2を用いて説明する。図2は、本発明の実施の形態1に係るメモリアクセス命令の一例を示す図である。メモリアクセス命令が、メモリからデータを読み出すためのロード命令である場合について説明する。
Next, a specific operation of the
“load rm,(rn)”は、第1メモリアクセス命令の一例であり、ロード命令であって、複数のプログラム間で排他の領域へのアクセスを意味する命令である。図1に示す命令解読部220は、解読したメモリアクセス命令が“load rm,(rn)”である場合は、排他アクセス信号157を出力する。なお、“load rm,(rn)”は、従来から使用されている通常のロード命令である。
“Load rm, (rn)” is an example of a first memory access instruction, which is a load instruction, and is an instruction that means access to an exclusive area between a plurality of programs. The
“loadcm rm,(rn)”は、第2メモリアクセス命令の一例であり、ロード命令であって、複数のプログラム間で共有の領域へのアクセスを意味する命令である。図1に示す命令解読部220は、解読したメモリアクセス命令が“loadcm rm,(rn)”である場合は、共有アクセス信号156を出力する。“loadcm rm,(rn)”は、後述する本実施の形態に係るプログラム変換装置によって生成される新たなロード命令である。
“Loadcm rm, (rn)” is an example of a second memory access instruction, which is a load instruction, and is an instruction meaning access to a shared area among a plurality of programs. The
なお、“rm”は、読み出したデータを格納するレジスタを示す。また、“rn”は、読み出すデータが格納されているメモリ内の領域を示すアドレスが格納されているレジスタを示す。 “Rm” indicates a register for storing the read data. “Rn” indicates a register in which an address indicating an area in a memory in which data to be read is stored is stored.
つまり、“load rm,(rn)”及び“loadcm rm,(rn)”は、“rn”が示すレジスタに格納されているアドレスが示す、メモリ内の領域からデータを読み出し、読み出したデータを、“rm”が示すレジスタに格納することを意味するロード命令である。 That is, “load rm, (rn)” and “loadcm rm, (rn)” read data from the area in the memory indicated by the address stored in the register indicated by “rn”, This is a load instruction which means storing in a register indicated by “rm”.
図3は、本発明の実施の形態1に係る命令と予測ウェイとアクセスウェイとの関係の一例を示す図である。
FIG. 3 is a diagram showing an example of the relationship among the instruction, the prediction way, and the access way according to
図3において、予測ウェイは、図1に示すウェイ予測部120によるウェイの予測結果を示す。アクセスウェイは、図1に示すクロック制御部113がクロックを供給するウェイを示す。
In FIG. 3, a predicted way indicates a way prediction result by the
例えば、時刻t0において、第1メモリアクセス命令である“load r0,(r1)”が命令解読部220で解読された場合、命令解読部220は、排他アクセス信号157をキャッシュメモリ装置100へ出力する。キャッシュメモリ装置100では、ウェイ予測部120が、過去の履歴などに基づいてヒットするウェイがウェイAであると予測する。そして、ウェイ予測部120は、ウェイAに対応するウェイ予測信号のみ(例えば、ウェイ予測信号158aのみ)をHighレベルとして出力する。
For example, when “load r0, (r1)” that is the first memory access instruction is decoded by the
クロック制御部113は、ウェイ予測部120による予測結果に基づいて、ウェイAに含まれるデータ格納部のみ(例えば、データ格納部112aのみ)にクロックを供給する。具体的には、クロック制御部113には、Highレベルとなったウェイ予測信号158aのみが入力されるので、クロック制御信号生成部113aのみがクロック制御信号159aをデータ格納部群112へ出力する。
The
このようにして、図3に示すように、第1メモリアクセス命令がプロセッサ部200で実行された場合は、予測ウェイとアクセスウェイとが一致する。
In this way, as shown in FIG. 3, when the first memory access instruction is executed by the
これに対して、例えば、時刻t(n−1)において、第2メモリアクセス命令である“load r14,(r15)”が命令解読部220で解読された場合、命令解読部220は、共有アクセス信号156をキャッシュメモリ装置100へ出力する。このとき、キャッシュメモリ装置100では、ウェイ予測部120は、過去の履歴などに基づいてヒットするウェイがウェイAであると予測する。そして、ウェイ予測部120は、ウェイAに対応するウェイ予測信号のみ(例えば、ウェイ予測信号158aのみ)をHighレベルとして出力する。
On the other hand, for example, when “load r14, (r15)” which is the second memory access instruction is decoded by the
クロック制御部113には、Highレベルとなった共有アクセス信号156が入力される。したがって、上述したように、クロック制御部113は、全てのウェイに含まれる全てのデータ格納部にクロックを供給するように、クロック制御信号を出力する。すなわち、クロック制御部113は、ウェイ予測部120による予測結果には基づかずに、言い換えると、予測結果を無視して、予め定められたデータ格納部にクロックを供給する。
The shared
これにより、キャッシュメモリ装置100は、全てのデータ格納部にクロックを供給することで、ウェイの予測が外れた場合であっても、ミスヒットと判定されることなく、読み出しデータ153をプロセッサ部200に出力することができる。また、常に全てのデータ格納部にクロックを供給する場合に比べて、第2メモリアクセス命令のようにウェイの予測が外れる可能性が高い命令が解読された場合のみ、全てのデータ格納部にクロックを供給するので、消費電力の増加を抑制することができる。
As a result, the
ここで、ウェイ予測部120の詳細について、図4を用いて説明する。図4は、本発明の実施の形態1に係るウェイ予測部の構成の一例を示すブロック図である。
Details of the
図4に示すように、ウェイ予測部120は、履歴保持部121と、予測部122と、更新部123とを備える。
As shown in FIG. 4, the
履歴保持部121は、ヒットしたウェイの履歴を示す履歴情報を保持するためのメモリなどである。例えば、履歴保持部121は、実行中のプログラム又はスレッド単位で、ヒットしたウェイの履歴を保持する。つまり、履歴保持部121は、実行中のプログラム又はスレッドが終了するまで、当該プログラム又はスレッドに含まれるメモリアクセス命令に対応するヒットしたウェイの履歴を保持する。あるいは、履歴情報は、直前にヒットしたウェイだけを示す情報であってもよい。
The
予測部122は、履歴保持部121に保持された履歴情報に基づいて、ヒットするウェイを予測する。例えば、予測部122は、直前にヒットしたウェイを、ヒットするウェイと予測してもよい。あるいは、予測部122は、所定の予測アルゴリズムに基づいて、ヒットするウェイを予測してもよい。予測の方法は、上記の例には限られない。
The
更新部123は、履歴保持部121に保持された履歴情報を更新する。具体的には、第1メモリアクセス命令がプロセッサ部200で解読された場合に、当該第1メモリアクセス命令によってヒットしたウェイを示す情報を用いて、履歴情報を更新する。より具体的には、更新部123は、ヒット判定部114から入力されるキャッシュヒット信号162を用いて、履歴情報を更新する。
The
また、第2メモリアクセス命令がプロセッサ部200で解読された場合には、履歴情報を更新しない。つまり、更新部123に共有アクセス信号156が入力された場合、更新部123は、ヒット判定部114から入力されるキャッシュヒット信号162を無視する。
When the second memory access instruction is decoded by the
以下では、図5を用いて、ウェイ予測部120の動作について説明する。図5は、本発明の実施の形態1に係る命令と予測ウェイとアクセスウェイとヒットウェイとの関係の一例を示す図である。
Hereinafter, the operation of the
図5において、アクセスタグウェイは、クロックが供給されるタグ格納部を含むウェイを示す。本発明の実施の形態1では、全てのタグ格納部にクロックが供給されている。
In FIG. 5, an access tag way indicates a way including a tag storage unit to which a clock is supplied. In
アクセスデータウェイは、図3に示すアクセスウェイと同様に、クロック制御部113がクロックを供給するデータ格納部を含むウェイを示す。ヒットウェイは、メモリアクセス命令が実行された場合にヒットしたウェイを示す。具体的には、ヒットウェイは、キャッシュヒット信号162が示すウェイである。
The access data way indicates a way including a data storage unit to which the
図5の例では、時刻t(n−1)において、第2メモリアクセス命令である“load r14,(r15)”が命令解読部220で解読された場合、命令解読部220は、共有アクセス信号156をキャッシュメモリ装置100へ出力する。このとき、キャッシュメモリ装置100では、予測部122は、過去の履歴などに基づいてヒットするウェイがウェイAであると予測する。
In the example of FIG. 5, when “load r14, (r15)” that is the second memory access instruction is decoded by the
クロック制御部113には、Highレベルとなった共有アクセス信号156が入力される。したがって、上述したように、クロック制御部113は、全てのウェイに含まれる全てのデータ格納部にクロックを供給するように、クロック制御信号を出力する。
The shared
そして、ヒット判定部114によってウェイCがヒットしたと判定され、ヒットしたウェイCを示すキャッシュヒット信号162が更新部123に入力される。しかしながら、更新部123には、共有アクセス信号156が入力されているので、ヒットしたウェイCを示すキャッシュヒット信号162を無視して、履歴情報を更新しない。
The hit determination unit 114 determines that the way C has been hit, and the cache hit
したがって、時刻t(n)に示すように、次の第1メモリアクセス命令である“load r16,(r17)”が命令解読部220で解読された場合、予測部122は、ウェイCを示す情報によって更新されていない履歴情報に基づいて、ヒットするウェイがウェイAであると判定している。
Therefore, as shown at time t (n), when the next first memory access instruction “load r16, (r17)” is decoded by the
なお、更新部123は、第2メモリアクセス命令が解読された場合に、予測部122によって予測されたウェイと、ヒットしたウェイとが一致していた場合であっても、キャッシュヒット信号162を無視する。
The
以上のように、本発明の実施の形態1に係るウェイ予測部120は、第2メモリアクセス命令が解読された場合には、以降の命令が実行された場合における予測を行う際に、第2メモリアクセス命令に対応する予測結果を利用しない。これにより、蓄積されてきた予測アルゴリズムを壊すことがないので、以降の命令が実行された場合に、正しい予測を行うことができる。
As described above, when the second memory access instruction is decoded, the
なお、上記の例では、更新部123が履歴情報を更新しない例について説明したが、予測部122が、共有アクセス信号156を受け取り、ウェイの予測を行わなくてもよい。あるいは、予測部122は、共有アクセス信号156が入力された以降において、メモリアクセス命令が実行された場合に、第2メモリアクセス命令に対応する予測結果を用いない予測アルゴリズムに基づいて、ウェイの予測を行ってもよい。
In the above example, the example in which the
続いて、本発明の実施の形態1に係るキャッシュメモリシステム10によって実行されるキャッシュメモリ110の制御方法について、図6を用いて説明する。図6は、本発明の実施の形態1に係るキャッシュメモリ110の制御方法の一例を示すフローチャートである。
Subsequently, a control method of the
まず、ウェイ予測部120は、プロセッサ部200でメモリアクセス命令が解読されたときに、ヒットするウェイを予測する(S110)。予測結果は、クロック制御部113に出力される。
First, the
次に、プロセッサ部200で解読されたメモリアクセス命令が第1メモリアクセス命令である場合(S120で“第1メモリアクセス命令”)、クロック制御部113は、ウェイ予測部120によって予測されたウェイのみにクロックを供給する(S130)。具体的には、クロック制御部113は、複数のウェイに含まれる複数のデータ格納部のうち、予測されたウェイに含まれるデータ格納部のみにクロックを供給する。
Next, when the memory access instruction decoded by the
プロセッサ部200で解読されたメモリアクセス命令が第2メモリアクセス命令である場合(S120で“第2メモリアクセス命令”)、クロック制御部113は、予め定められたウェイにクロックを供給する(S140)。具体的には、クロック制御部113は、全てのウェイにクロックを供給する。より具体的には、クロック制御部113は、複数のウェイに含まれる全てのデータ格納部にクロックを供給する。
When the memory access instruction decoded by the
以上のようにして、本発明の実施の形態1に係るキャッシュメモリ110の制御方法によれば、予測が外れる可能性が高い第2メモリアクセス命令が解読された場合には、全てのデータ格納部にクロックを供給する。これにより、予測が外れても処理が繰り返されることを防ぐことができる。すなわち、予測ミスの発生を防止することができるので、性能の劣化を抑制することができる。
As described above, according to the control method of
また、予測が外れる可能性が低い第1メモリアクセス命令が解読された場合には、予測結果が示すウェイのデータ格納部のみにクロックを供給する。これにより、常に全てのデータ格納部にクロックを供給する場合に比べて、消費電力を抑制することができる。 In addition, when the first memory access instruction that is unlikely to be mispredicted is decoded, the clock is supplied only to the data storage unit of the way indicated by the prediction result. Thereby, power consumption can be suppressed as compared with the case where the clock is always supplied to all the data storage units.
以上のことから、本発明の実施の形態1に係るキャッシュメモリ装置100及びキャッシュメモリの制御方法によれば、性能の劣化を抑制するとともに、消費電力の増加を抑制することができる。
From the above, according to the
続いて、メモリアクセス命令がライト命令(ストア命令)である場合について、説明する。 Next, a case where the memory access instruction is a write instruction (store instruction) will be described.
図7は、本発明の実施の形態1に係るメモリアクセス命令の一例を示す図である。 FIG. 7 is a diagram showing an example of a memory access instruction according to the first embodiment of the present invention.
“store (rn),rm”は、メモリアクセス命令の一例であり、ライト命令である。“rm”は、書き込みデータが格納されているレジスタを示す。“(rn)”は、書き込みデータを書き込むメモリ内の領域を示すアドレスが格納されているレジスタである。つまり、“store (rn),rm”は、“rm”が示すレジスタに格納されているデータを、“rn”が示すレジスタに格納されているアドレスが示す、メモリ内の領域に書き込むことを意味するライト命令である。 “Store (rn), rm” is an example of a memory access instruction and is a write instruction. “Rm” indicates a register in which write data is stored. “(Rn)” is a register in which an address indicating an area in a memory in which write data is written is stored. That is, “store (rn), rm” means that the data stored in the register indicated by “rm” is written to the area in the memory indicated by the address stored in the register indicated by “rn”. Is a write command.
ライト命令がプロセッサ210で実行された場合、キャッシュメモリ装置100は、ヒットしたウェイ及びエントリが決定されるまで、書き込みデータ152をデータ格納部に書き込むことはできない。したがって、ライト命令が実行された場合に、ウェイの予測を行ったとしても、ヒット判定部114の結果を待つ必要があるため、ウェイの予測結果を用いる必要はない。よって、図7に示すように、ライト命令は、第1メモリアクセス命令及び第2メモリアクセス命令への分類は行われない。
When the write instruction is executed by the
図8は、本発明の実施の形態1に係る命令と予測ウェイとアクセスウェイとヒットウェイとの関係の一例を示す図である。
FIG. 8 is a diagram showing an example of the relationship among the instruction, the prediction way, the access way, and the hit way according to
例えば、時刻t3において、ストア命令である“store (r5),r3”がプロセッサ210で実行された場合、ヒット判定部114は、ウェイCがヒットしたウェイであると判定し、ウェイCを示すキャッシュヒット信号162を出力する。そして、データ格納部群112には、キャッシュヒット信号162に基づいて、ウェイCに含まれるデータ格納部のみにクロックが供給される。
For example, when the store instruction “store (r5), r3” is executed by the
このようにして、図8に示すように、ライト命令(ストア命令)がプロセッサ210で実行された場合には、ヒットウェイとアクセスデータウェイとが一致する。
In this way, as shown in FIG. 8, when a write instruction (store instruction) is executed by the
以上のように、ライト命令(ストア命令)が実行された場合は、リード命令の場合に比べて1サイクル分の処理が多く必要となるが、ヒットしたウェイのデータ格納部だけにクロックを供給すればよいので、全てのウェイのデータ格納部にクロックを供給する場合に比べて、消費電力を抑制することができる。 As described above, when a write instruction (store instruction) is executed, more processing for one cycle is required than with a read instruction, but a clock is supplied only to the data storage unit of the hit way. Therefore, power consumption can be suppressed as compared with the case where clocks are supplied to the data storage units of all ways.
続いて、本発明の実施の形態1に係るプログラム変換装置について、図9を用いて説明する。図9は、本発明の実施の形態1に係るプログラム変換装置300の構成の一例を示すブロック図である。
Next, the program conversion apparatus according to
図9に示すプログラム変換装置300は、ウェイの予測機能を有するキャッシュメモリに対応するメモリアクセス命令を生成する。例えば、プログラム変換装置300は、コンパイラであり、メモリアクセス命令の種別を判定し、メモリアクセス命令を変換することで、第2メモリアクセス命令を生成する。第2メモリアクセス命令は、ウェイの予測結果をキャッシュメモリに利用させないようにするための予測無視メモリアクセス命令の一例である。
The
図9に示すように、プログラム変換装置300は、抽出部310と、判定部320と、変換部330とを備える。
As illustrated in FIG. 9, the
抽出部310は、入力されたプログラムからメモリアクセス命令を抽出する。プログラムは、例えば、Perl、JavaScript、C言語などの高級言語で記述されている。
The
判定部320は、抽出部310によって抽出されたメモリアクセス命令の種別を判定する。具体的には、判定部320は、抽出部310によって抽出されたメモリアクセス命令が示す変数がグローバル変数であるか否かを判定する。より具体的には、判定部320は、メモリアクセス命令が示す変数がグローバル変数であるかローカル変数であるかを判定する。
The
変換部330は、判定部320によってメモリアクセス命令が示す変数がグローバル変数であると判定された場合、対応するメモリアクセス命令を、ウェイの予測結果をキャッシュメモリに利用させないようにするための予測無視メモリアクセス命令に変換する。つまり、予測無視メモリアクセス命令は、グローバル変数をメモリに読み書きすることを示すメモリアクセス命令である。
When the
具体的には、予測無視メモリアクセス命令は、例えば、複数のプログラムの間において共有の変数をメモリに読み書きすることを示すメモリアクセス命令である。あるいは、予測無視メモリアクセス命令は、共有変数宣言された変数をメモリに読み書きすることを示すメモリアクセス命令である。 Specifically, the predicted ignore memory access instruction is, for example, a memory access instruction that indicates reading / writing a shared variable between a plurality of programs. Alternatively, the predicted-ignore memory access instruction is a memory access instruction indicating that a variable declared as a shared variable is read from or written to the memory.
以上のように、本発明の実施の形態1に係るプログラム変換装置300は、メモリアクセス命令が示す変数がグローバル変数であるか否かを判定し、グローバル変数である場合は、当該メモリアクセス命令を、ウェイの予測結果を利用させないようにするための予測無視メモリアクセス命令に変換する。
As described above, the
グローバル変数は、複数のプログラム及び複数のスレッドにまたがって参照される変数である。このため、グローバル変数を読み書きするためのメモリアクセス命令が解読されたときにキャッシュメモリ装置100が実行するウェイの予測は、ローカル変数の場合に比べて、外れる可能性が高い。
The global variable is a variable that is referred to across a plurality of programs and a plurality of threads. For this reason, the prediction of the way executed by the
したがって、グローバル変数の読み書きを示すメモリアクセス命令が解読された場合には、キャッシュメモリ装置100によって実行されるウェイの予測結果を無視させることで、キャッシュメモリ装置100における処理の繰り返しを防止することができる。よって、キャッシュメモリ装置100におけるレイテンシーの低下、及び、繰り返しによる消費電力の増加を抑制することができる。
Therefore, when a memory access instruction indicating reading / writing of a global variable is decoded, it is possible to prevent repeated processing in the
また、グローバル変数でない場合、具体的には、ローカル変数である場合には、キャッシュメモリ装置100ではウェイの予測結果を利用して、クロックを供給するデータ格納部を制限する。このため、キャッシュメモリ装置100における消費電力を低減することができる。
If the variable is not a global variable, specifically, if it is a local variable, the
ここで、判定部320の動作について、プログラムを記述している高級言語毎に、説明する。
Here, the operation of the
例えば、Perlで記述されたプログラムでは、変数は、宣言したブロック({}で示される範囲)内だけで使用される。このように、有効な範囲が決められている変数がローカル変数である。言い換えると、ローカル変数は、参照される範囲が決まっている変数である。 For example, in a program written in Perl, a variable is used only within a declared block (a range indicated by {}). In this way, a variable for which an effective range is determined is a local variable. In other words, a local variable is a variable whose reference range is determined.
つまり、Perlで記述されたプログラムでは、{}で囲まれた範囲内に宣言された変数が、ローカル変数である。逆に、{}で囲まれた範囲外で宣言された変数が、グローバル変数である。グローバル変数は、あらゆる場所からの参照が可能な変数である。 That is, in a program written in Perl, a variable declared within a range surrounded by {} is a local variable. Conversely, a variable declared outside the range surrounded by {} is a global variable. Global variables are variables that can be referenced from anywhere.
したがって、判定部320は、変数が宣言されている位置を判定することで、当該変数がグローバル変数であるかローカル変数であるかを判定することができる。
Therefore, the
また、JavaScriptで記述されたプログラムでは、varを付けて変数宣言した場合、当該変数はローカル変数となる。これに対して、何も付けずに変数宣言した場合、当該変数はグローバル変数となる。 Also, in a program written in JavaScript, when a variable is declared with var, the variable becomes a local variable. On the other hand, if a variable is declared with nothing added, the variable becomes a global variable.
したがって、判定部320は、変数宣言されたときにvarが付いているか否かを判定することで、当該変数がグローバル変数であるかローカル変数であるかを判定することができる。
Therefore, the
また、C言語で記述されたプログラムでは、所定の関数内で宣言された変数は、ローカル変数となる。これに対して、グローバル変数は、任意の関数の外側で定義するとともに、使用する関数の中でも改めて、宣言される必要がある。 In a program written in C language, a variable declared in a predetermined function is a local variable. On the other hand, a global variable must be defined outside an arbitrary function and declared again in the function to be used.
この場合、はっきりとexternを用いて宣言するか、あるいは、前後関係から暗黙のうちに宣言すればよい。前後関係から暗黙のうちにとは、特定の関数で使われる以前に、プログラムファイル(ソースファイル)の中でグローバル変数の定義がされていれば、使用する関数内でのexternを用いた宣言は不要である。 In this case, it may be clearly declared using “extern” or may be declared implicitly from the context. Implicitly because of the context, if a global variable is defined in a program file (source file) before being used in a specific function, declaration using extern in the function to be used is It is unnecessary.
したがって、判定部320は、関数の外部で宣言されているとともに、いずれかの関数でexternを用いて宣言されている場合は、当該変数がグローバル変数であると判定することができる。
Therefore, the
なお、他の高級言語で記述されたプログラムの場合も、判定部320は、それぞれのプログラムに基づいて、変数がグローバル変数であるかローカル変数であるかを判定することができる。
In the case of a program written in another high-level language, the
続いて、本発明の実施の形態1に係るプログラム変換装置300の動作について、図10を用いて説明する。図10は、本発明の実施の形態1に係るプログラム変換装置300の動作の一例を示すフローチャートである。
Next, the operation of the
まず、抽出部310は、入力されたプログラムからメモリアクセス命令を抽出する(S210)。例えば、抽出部は、高級言語で記述されたプログラム(ソースコード)からメモリアクセス命令を抽出し、抽出したメモリアクセス命令をコンパイルすることで、図2に示す“load rm,(rn)”などの第1メモリアクセス命令に変換する。
First, the
次に、判定部320は、抽出部310によって抽出されたメモリアクセス命令が示す変数の種別を判定する(S220)。
Next, the
メモリアクセス命令が示す変数がグローバル変数である場合(S220で“グローバル変数”)、変換部330は、対応するメモリアクセス命令を変換することで、予測無視メモリアクセス命令の一例である第2メモリアクセス命令を生成する(S230)。変数がグローバル変数である場合は、変換部330は、第1メモリアクセス命令を、図2に示す“loadcm rm,(rn)”などの第2メモリアクセス命令に変換する。
When the variable indicated by the memory access instruction is a global variable (“global variable” in S220), the
また、メモリアクセス命令が示す変数がローカル変数である場合(S220で“ローカル変数”)、変換部330は、対応するメモリアクセス命令をそのまま出力する。
When the variable indicated by the memory access instruction is a local variable (“local variable” in S220), the
なお、プログラム変換装置300は、ソースコードからメモリアクセス命令を抽出し、コンパイルを行う前に、抽出したメモリアクセス命令が示す変数がグローバル変数であるか否かを判定してもよい。グローバル変数であると判定された場合には、対応するメモリアクセス命令を第2メモリアクセス命令に変換し、ローカル変数であると判定された場合には、対応するメモリアクセス命令を第1メモリアクセス命令に変換する。
Note that the
以上のように、本発明の実施の形態1に係るキャッシュメモリシステム10は、ウェイの予測が外れる可能性が高いメモリアクセス命令が解読された場合には、ウェイの予測結果を無視して、キャッシュメモリ110の全てのデータ格納部にクロックを供給する。これにより、予測が外れても処理が繰り返されることを防ぐことができる。すなわち、予測ミスの発生を防止することができるので、性能の劣化を抑制することができる。
As described above, the
また、キャッシュメモリシステム10は、ウェイの予測が外れる可能性が低いメモリアクセス命令が解読された場合には、ウェイの予測結果に基づいて、予測されたウェイのデータ格納部のみにクロックを供給する。これにより、常に全てのデータ格納部にクロックを供給する場合に比べて、消費電力を抑制することができる。
The
なお、本発明の実施の形態1では、第2メモリアクセス命令がプロセッサ部200で解読された場合には、当該第2メモリアクセス命令に対応するヒット結果を無視したが、ヒット結果を予測アルゴリズムに採用してもよい。
In the first embodiment of the present invention, when the second memory access instruction is decoded by the
図11は、本発明の実施の形態1の変形例に係る命令と予測ウェイとアクセスウェイとヒットウェイとの関係の一例を示す図である。 FIG. 11 is a diagram illustrating an example of a relationship among an instruction, a prediction way, an access way, and a hit way according to a modification of the first embodiment of the present invention.
図11の例では、時刻t(n−1)において、第2メモリアクセス命令である“load r14,(r15)”がプロセッサ部200で解読された場合、命令解読部220は、共有アクセス信号156をキャッシュメモリ装置100へ出力する。このとき、キャッシュメモリ装置100では、予測部122は、過去の履歴などに基づいてヒットするウェイがウェイAであると予測する。
In the example of FIG. 11, when “load r14, (r15)” as the second memory access instruction is decoded by the
クロック制御部113には、Highレベルとなった共有アクセス信号156が入力される。したがって、上述したように、クロック制御部113は、全てのウェイに含まれる全てのデータ格納部にクロックを供給するように、クロック制御信号を出力する。
The shared
そして、ヒット判定部114によってウェイCがヒットしたと判定され、ヒットしたウェイCを示すキャッシュヒット信号162が更新部123に入力される。そして、更新部123は、ヒットしたウェイCを示すキャッシュヒット信号162を用いて、履歴情報を更新する。
The hit determination unit 114 determines that the way C has been hit, and the cache hit
したがって、時刻t(n)に示すように、次の第1メモリアクセス命令である“load r16,(r17)”がプロセッサ部200で解読された場合、予測部122は、ウェイCを示す情報によって更新された履歴情報に基づいて、ヒットするウェイがウェイCであると判定している。
Accordingly, as shown at time t (n), when the next first memory access instruction “load r16, (r17)” is decoded by the
以上のように、本発明の実施の形態1の変形例においては、更新部123は、第1メモリアクセス命令及び第2メモリアクセス命令のいずれがプロセッサ部200で解読された場合であっても、対応するメモリアクセス命令によってヒットしたウェイを示す情報を用いて、履歴情報を更新してもよい。これにより、複数のプログラムのうち単一のプログラムのみが一定期間実行されてヒットするウェイの履歴が単一のプログラムにより決定される場合に、予測の当たる確率を向上させることができる。
As described above, in the modification of the first embodiment of the present invention, the updating
(実施の形態2)
本発明の実施の形態2に係るキャッシュメモリ装置では、クロック制御部が、さらに、第1メモリアクセス命令がプロセッサ部で解読された場合に、複数のウェイに含まれる複数のタグ格納部のうち、ウェイ予測部によって予測されたウェイのタグ格納部のみにクロックを供給し、第2メモリアクセス命令がプロセッサ部で解読された場合に、複数のウェイに含まれる複数のタグ格納部のうち、予め定められたタグ格納部にクロックを供給することを特徴とする。
(Embodiment 2)
In the cache memory device according to the second embodiment of the present invention, when the clock control unit further decodes the first memory access instruction by the processor unit, among the plurality of tag storage units included in the plurality of ways, When a clock is supplied only to the tag storage unit of the way predicted by the way prediction unit and the second memory access instruction is decoded by the processor unit, a predetermined one of the plurality of tag storage units included in the plurality of ways is predetermined. A clock is supplied to the tag storage unit provided.
図12は、本発明の実施の形態2に係るキャッシュメモリ装置400の構成の一例を示すブロック図である。
FIG. 12 is a block diagram showing an example of the configuration of the
図12に示すキャッシュメモリ装置400は、図1に示す実施の形態1に係るキャッシュメモリ装置100と比較して、タグ格納部群111の代わりにタグ格納部群411を備え、クロック制御部113の代わりにクロック制御部413を備える点が異なっている。図12において、図1に示す実施の形態1と同じ構成要素には同じ参照符号を付し、説明を省略し、異なる点を中心に説明する。
A
タグ格納部群411は、n個のタグ格納部、すなわち、ウェイの数と同数のタグ格納部を有し、n個のタグ格納部のそれぞれに、複数のタグアドレスを格納することができる。本実施の形態では、ウェイは2個であるので、タグ格納部群411は、2個のタグ格納部411a及び411bを有する。
The tag
タグ格納部411a及び411bには、アドレス151が入力される。タグ格納部411a及び411bは、アドレス151に含まれるセットインデックスに対応するエントリに格納されたタグアドレスを、タグデータ160a及び160bとして出力する。
The
さらに、タグ格納部群411には、クロック制御部413からクロック制御信号が入力される。つまり、実施の形態1に示すタグ格納部群111では、全てのタグ格納部にクロックが供給されたのに対して、タグ格納部群411は、クロック制御部413からの制御に基づいて、クロックが供給される。
Further, a clock control signal is input from the
クロック制御部413は、プロセッサ部200で解読されたメモリアクセス命令の種別に基づいて、複数のウェイに供給するクロックを制御する。具体的には、クロック制御部413は、第1メモリアクセス命令が解読された場合に、複数のウェイに含まれる複数のタグ格納部及び複数のデータ格納部のうち、ウェイ予測部120によって予測されたウェイのタグ格納部及びデータ格納部のみにクロックを供給する。
The
また、クロック制御部413は、第2メモリアクセス命令が解読された場合に、ウェイ予測部120による予測結果に関わらず、複数のウェイに含まれる複数のタグ格納部及び複数のデータ格納部のうち、予め定められたウェイのタグ格納部及びデータ格納部にクロックを供給する。具体的には、クロック制御部413は、第2メモリアクセス命令が解読された場合に、全てのタグ格納部及び全てのデータ格納部にクロックを供給する。
In addition, when the second memory access instruction is decoded, the
図12に示すように、クロック制御部413は、n個のクロック制御信号生成部、すなわち、ウェイの数と同数のクロック制御信号生成部を有する。本実施の形態では、ウェイが2個であるので、クロック制御部413は、2個のクロック制御信号生成部413a及び413bを有する。
As shown in FIG. 12, the
なお、クロック制御信号生成部413a及び413bの動作は、実施の形態1に係るクロック制御信号生成部113a及び113bとほぼ同様である。データ格納部群112だけでなく、タグ格納部群411にもクロック制御信号を出力する点が異なっている。
The operations of the clock control
具体的には、図12に示すように、クロック制御信号生成部413aは、共有アクセス信号156及びウェイ予測信号158aの少なくとも1つが入力された場合に、クロック制御信号459aをタグ格納部411aとデータ格納部112aとに出力する。同様に、クロック制御信号生成部413bは、共有アクセス信号156及びウェイ予測信号158bの少なくとも1つが入力された場合に、クロック制御信号459bをタグ格納部411bとデータ格納部112bとに出力する。
Specifically, as illustrated in FIG. 12, the clock control
また、第1メモリアクセス命令及び第2メモリアクセス命令については、実施の形態1と同じである。 The first memory access instruction and the second memory access instruction are the same as those in the first embodiment.
続いて、メモリアクセス命令がライト命令(ストア命令)である場合について、説明する。 Next, a case where the memory access instruction is a write instruction (store instruction) will be described.
図13は、本発明の実施の形態2の変形例に係るメモリアクセス命令の一例を示す図である。 FIG. 13 is a diagram showing an example of a memory access instruction according to a modification of the second embodiment of the present invention.
“store (rn),rm”は、第1メモリアクセス命令の一例であり、ライト命令(ストア命令)であって、複数のプログラム間で排他の領域へのアクセスを意味する命令である。図12に示す命令解読部220は、解読したメモリアクセス命令が“store (rn),rm”である場合は、排他アクセス信号157を出力する。なお、“store (rn),rm”は、従来から使用されている通常のライト命令である。
“Store (rn), rm” is an example of a first memory access instruction, which is a write instruction (store instruction), and means an access to an exclusive area between a plurality of programs. The
“storecm (rn),rm”は、第2メモリアクセス命令の一例であり、ライト命令(ストア命令)であって、複数のプログラム間で共有の領域へのアクセスを意味する命令である。図12に示す命令解読部220は、解読したメモリアクセス命令が“storecm (rn),rm”である場合は、共有アクセス信号156を出力する。“storecm (rn),rm”は、本実施の形態に係るプログラム変換装置によって生成される新たなライト命令である。
“Storecm (rn), rm” is an example of a second memory access instruction, which is a write instruction (store instruction), and means an access to a shared area among a plurality of programs. The
なお、“store (rn),rm”及び“storecm (rn),rm”は、“rm”が示すレジスタに格納されているデータを、“rn”が示すレジスタに格納されているアドレスが示す、メモリ内の領域に書き込むことを意味するライト命令である。 Note that “store (rn), rm” and “storecm (rn), rm” indicate the data stored in the register indicated by “rm” and the address stored in the register indicated by “rn”. This is a write command that means writing to an area in memory.
実施の形態1と同様に、ライト命令がプロセッサ210で実行された場合、キャッシュメモリ装置400は、ヒットしたウェイ及びエントリが決定されるまで、書き込みデータ152をデータ格納部に書き込むことはできない。したがって、データ格納部にクロックを供給するか否かを決定するために、ウェイの予測結果を用いる必要はない。
As in the first embodiment, when the write instruction is executed by the
これに対して、本発明の実施の形態2に係るキャッシュメモリ装置400では、タグ格納部にクロックを供給するか否かを決定するのに、ウェイの予測結果を用いることができる。
On the other hand, in the
図14は、本発明の実施の形態2の変形例に係る命令と予測ウェイとアクセスウェイとヒットウェイとの関係の一例を示す図である。 FIG. 14 is a diagram illustrating an example of a relationship among an instruction, a prediction way, an access way, and a hit way according to a modification of the second embodiment of the present invention.
例えば、時刻t2において、第1メモリアクセス命令である“store (r2),r0”が命令解読部220で解読された場合、命令解読部220は、排他アクセス信号157をキャッシュメモリ装置400へ出力する。キャッシュメモリ装置400では、ウェイ予測部120が、過去の履歴などに基づいてヒットするウェイがウェイAであると予測する。そして、ウェイ予測部120は、ウェイAに対応するウェイ予測信号のみ(例えば、ウェイ予測信号158aのみ)をHighレベルとして出力する。
For example, when “store (r2), r0” as the first memory access instruction is decoded by the
クロック制御部413は、ウェイ予測部120による予測結果に基づいて、ウェイAに含まれるタグ格納部のみ(例えば、タグ格納部411aのみ)にクロックを供給する。具体的には、クロック制御部413には、Highレベルとなったウェイ予測信号158aのみが入力されるので、クロック制御信号生成部413aのみがクロック制御信号459aをタグ格納部群411に出力する。
The
このようにして、図14に示すように、第1メモリアクセス命令が命令解読部220で解読された場合は、予測ウェイとアクセスタグウェイとが一致する。
In this way, as shown in FIG. 14, when the first memory access instruction is decoded by the
これに対して、例えば、時刻t4において、第2メモリアクセス命令である“storecm (r5),r3”が命令解読部220で解読された場合、命令解読部220は、共有アクセス信号156をキャッシュメモリ装置400へ出力する。キャッシュメモリ装置400では、ウェイ予測部120は、過去の履歴などに基づいてヒットするウェイがウェイAであると予測する。そして、ウェイ予測部120は、ウェイAに対応するウェイ予測信号のみ(例えば、ウェイ予測信号158aのみ)をHighレベルとして出力する。
On the other hand, for example, when “storecm (r5), r3” as the second memory access instruction is decoded by the
クロック制御部413には、Highレベルとなった共有アクセス信号156が入力される。したがって、上述したように、クロック制御部413は、全てのウェイに含まれる全てのタグ格納部にクロックを供給するように、クロック制御信号を出力する。すなわち、クロック制御部413は、ウェイ予測部120による予測結果には基づかずに、言い換えると、予測結果を無視して、予め定められたタグ格納部にクロックを供給する。
The shared
そして、ヒット判定部114は、ウェイCがヒットしたウェイであると判定し、ウェイCを示すキャッシュヒット信号162を出力する。そして、データ格納部群112には、キャッシュヒット信号162に基づいて、ウェイCに含まれるデータ格納部のみにクロックが供給される。
The hit determination unit 114 determines that the way C is a hit way, and outputs a cache hit
以上のように、ライト命令(ストア命令)が実行された場合、全てのタグ格納部にクロックを供給することで、ウェイの予測が外れた場合であっても、ミスヒットと判定されることなく、書き込みデータ152を書き込むエントリを決定することができる。また、常に全てのタグ格納部にクロックを供給する場合に比べて、第2メモリアクセス命令のように、ウェイの予測が外れる可能性が高い命令が実行された場合のみ、全てのタグ格納部にクロックを供給するので、消費電力の増加を抑制することができる。
As described above, when a write instruction (store instruction) is executed, by supplying a clock to all the tag storage units, even if the way is unpredictable, it is not determined as a miss hit. The entry to which the
以上の構成により、本発明の実施の形態2に係るキャッシュメモリ装置400は、プロセッサ部200から排他アクセス信号157が入力された場合は、ウェイ予測部120によって予測されたウェイのデータ格納部とタグ格納部とのみにクロックを供給する。また、キャッシュメモリ装置400は、プロセッサ部200から共有アクセス信号156が入力された場合は、ウェイ予測部120による予測結果を無視して全てのデータ格納部とタグ格納部とにクロックを供給する。
With the above configuration, the
このように、本発明の実施の形態2に係るキャッシュメモリ装置400は、プロセッサ部200から入力される信号に基づいて、クロックを供給するデータ格納部及びタグ格納部を制御する。したがって、予測が当たる可能性が高い場合には、予測されたデータ格納部とタグ格納部とだけにクロックを供給することができるので、消費電力の増加を抑制することができる。このとき、予測されなかったウェイについては、データ格納部だけでなくタグ格納部にも、クロックを供給しないので、消費電力をさらに低減することができる。
As described above, the
また、予測が当たる可能性が低い場合には、全てのデータ格納部及びタグ格納部にクロックを供給することで、予測が外れた場合に、処理が繰り返されるのを防ぐことができるので、レイテンシーの低下を抑制することができ、性能の劣化を抑制することができる。 In addition, when there is a low possibility of being predicted, by supplying a clock to all the data storage units and tag storage units, it is possible to prevent the processing from being repeated when the prediction is lost, so that the latency Can be suppressed, and degradation of performance can be suppressed.
以上、本発明に係るキャッシュメモリ装置、プログラム変換装置、キャッシュメモリ制御方法及びプログラム変換方法について、実施の形態に基づいて説明したが、本発明は、これらの実施の形態に限定されるものではない。本発明の趣旨を逸脱しない限り、当業者が思いつく各種変形を当該実施の形態に施したものや、異なる実施の形態における構成要素を組み合わせて構築される形態も、本発明の範囲内に含まれる。 The cache memory device, the program conversion device, the cache memory control method, and the program conversion method according to the present invention have been described based on the embodiments. However, the present invention is not limited to these embodiments. . Unless it deviates from the meaning of this invention, the form which carried out the various deformation | transformation which those skilled in the art can think to the said embodiment, and the form constructed | assembled combining the component in a different embodiment is also contained in the scope of the present invention. .
例えば、上記の実施の形態では、第2メモリアクセス命令がプロセッサ部200で解読された場合に、予め定められたデータ格納部及び/又はタグ格納部として、全てのデータ格納部及び/又はタグ格納部にクロックを供給する例について説明した。これに対して、全てのデータ格納部及び/又はタグ格納部ではなく、当該第2メモリアクセス命令を含むプログラムを実行するために割り当てられた1つ以上のウェイに含まれる1つ以上のデータ格納部及び/又はタグ格納部にクロックを供給してもよい。
For example, in the above-described embodiment, when the second memory access instruction is decoded by the
例えば、複数のプログラムに含まれる複数のスレッドはそれぞれ、実行時に利用するウェイが割り当てられていてもよい。図15に示す例では、スレッドAには、ウェイA及びウェイBが割り当てられ、スレッドBにはウェイCが、スレッドDにはウェイDがそれぞれ割り当てられている。 For example, a plurality of threads included in a plurality of programs may be assigned ways to be used at the time of execution. In the example shown in FIG. 15, way A and way B are assigned to thread A, way C is assigned to thread B, and way D is assigned to thread D.
図16は、本発明の実施の形態の変形例に係るキャッシュメモリ装置500の構成の一例を示す図である。同図に示すように、図1に示すキャッシュメモリ装置100と比べて、キャッシュメモリ110は、クロック制御部113の代わりに、クロック制御部513を備える。
FIG. 16 is a diagram showing an example of a configuration of a
クロック制御部513は、例えば、図15に示すようなスレッドとウェイとの対応関係を示すテーブルを参照することで、第2メモリアクセス命令が解読された場合に、当該第2メモリアクセス命令を含むスレッドに割り当てられたウェイにクロックを供給する。図15の例では、スレッドAに含まれる第2メモリアクセス命令がプロセッサ部200で解読された場合は、クロック制御部513は、ウェイA及びウェイBに含まれるデータ格納部のみに、クロックを供給する。
The clock control unit 513 includes the second memory access instruction when the second memory access instruction is decoded, for example, by referring to a table showing the correspondence between threads and ways as shown in FIG. Supply the clock to the way assigned to the thread. In the example of FIG. 15, when the second memory access instruction included in the thread A is decoded by the
図16に示すように、クロック制御部513は、図1に示す実施の形態1に係るクロック制御部113と比較して、新たに、スイッチ516a及び516bと、選択部517とを備える。
As illustrated in FIG. 16, the clock control unit 513 newly includes
スイッチ516a及び516bは、選択部517からの制御信号564a及び564bに基づいて、共有アクセス信号156をクロック制御信号生成部113a及び113bのそれぞれに供給するか否かを決定する。スイッチ516aは、クロック制御信号生成部113a及びデータ格納部112aに対応する。スイッチ516bは、クロック制御信号生成部113b及びデータ格納部112bに対応する。
Based on the
選択部517は、スレッドとウェイとの対応関係を示すテーブルを保持する。選択部517は、当該テーブルを参照することで、第2メモリアクセス命令が解読された場合に、第2メモリアクセス命令を含むスレッドに割り当てられたウェイのデータ格納部に対応したスイッチのみをオンするように制御信号を出力する。
The
例えば、スレッドAとウェイAとが割り当てられている場合において、スレッドAに含まれる第2メモリアクセス命令が解読された場合は、選択部517は、スイッチ516aのみがオンするように制御信号564aを出力する。これにより、スイッチ516aは、共有アクセス信号156をクロック制御信号生成部113aに出力するので、クロック制御信号生成部113aは、データ格納部112aにクロックを供給することができる。
For example, when the thread A and the way A are assigned, and the second memory access instruction included in the thread A is decoded, the
これにより、キャッシュメモリ装置500が備える全てのデータ格納部にクロックを供給する場合に比べて、消費電力を低減することができる。
As a result, power consumption can be reduced as compared with the case where clocks are supplied to all data storage units included in the
また、ウェイ予測部120は、ヒットするウェイとして、複数のウェイを予測してもよい。
Further, the
また、図17に示すように、第2メモリアクセス命令は、ウェイの予測結果を利用しないことを示す属性ビットを含んでいてもよい。図17は、本発明の実施の形態の変形例に係るメモリアクセス命令の一例を示す図である。 As shown in FIG. 17, the second memory access instruction may include an attribute bit indicating that the way prediction result is not used. FIG. 17 is a diagram showing an example of a memory access instruction according to a modification of the embodiment of the present invention.
つまり、プログラム変換装置300が備える変換部330は、判定部320によってメモリアクセス命令が示す変数がグローバル変数であると判定された場合、対応するメモリアクセス命令を、ウェイの予測結果を利用しないことを示す属性ビットを含む第2メモリアクセス命令に変換してもよい。例えば、属性ビットは、予測結果を利用するか否かを示すフラグに相当する。
That is, when the
例えば、図17に示すように、第2メモリアクセス命令を構成する複数のビット(例えば、32ビット)のうち、1ビットが属性ビットである。当該1ビットが、ウェイ予測部120によるウェイの予測結果を利用させないことを示している。
For example, as shown in FIG. 17, 1 bit is an attribute bit among a plurality of bits (for example, 32 bits) constituting the second memory access instruction. The 1 bit indicates that the way prediction result by the
また、上記の各実施の形態では、第2メモリアクセス命令が解読された場合、ウェイ予測部120による予測結果を無視することで、予め定められたデータ格納部にクロックを供給したが、ウェイ予測部120による予測結果を、予め定められたウェイが予測されたことを示す予測結果に置き換えてもよい。この場合、クロック制御部113は、メモリアクセス命令の種別ではなく、予測結果が示すウェイに含まれるデータ格納部にクロックを供給する。
In each of the above embodiments, when the second memory access instruction is decoded, the clock is supplied to the predetermined data storage unit by ignoring the prediction result by the
例えば、ウェイ予測部120において、予測部122は、プロセッサ部200で第2メモリアクセス命令が解読された場合に、共有アクセス信号156を受け取り、予め定められたウェイを予測結果として出力する。すなわち、予測部122は、共有アクセス信号156を受け取った場合、予め定められたウェイ予測信号を出力する。例えば、予測部122は、全てのデータ格納部にクロックを供給するように、全てのウェイ予測信号を出力する。
For example, in the
このように、第2メモリアクセス命令が解読された場合に、例えば全てのウェイが予測されたことを示すダミーの予測結果に、ウェイ予測部による予測結果を置き換えてもよい。 As described above, when the second memory access instruction is decoded, for example, the prediction result by the way prediction unit may be replaced with a dummy prediction result indicating that all ways have been predicted.
また、本発明は、上述したように、キャッシュメモリ装置、プログラム変換装置、キャッシュメモリ制御方法及びプログラム変換方法として実現できるだけではなく、本実施の形態のキャッシュメモリ制御方法及びプログラム変換方法をコンピュータに実行させるためのプログラムとして実現してもよい。また、当該プログラムを記録するコンピュータ読み取り可能なCD−ROMなどの記録媒体として実現してもよい。さらに、当該プログラムを示す情報、データ又は信号として実現してもよい。そして、これらプログラム、情報、データ及び信号は、インターネットなどの通信ネットワークを介して配信されてもよい。 In addition, as described above, the present invention can be implemented not only as a cache memory device, a program conversion device, a cache memory control method, and a program conversion method, but also by executing the cache memory control method and the program conversion method of the present embodiment on a computer You may implement | achieve as a program for making it do. Moreover, you may implement | achieve as recording media, such as computer-readable CD-ROM which records the said program. Furthermore, it may be realized as information, data, or a signal indicating the program. These programs, information, data, and signals may be distributed via a communication network such as the Internet.
また、本発明は、キャッシュメモリ装置及びプログラム変換装置を構成する構成要素の一部又は全部を、1個のシステムLSI(Large Scale Integration)から構成してもよい。システムLSIは、複数の構成部を1個のチップ上に集積して製造された超多機能LSIであり、具体的には、マイクロプロセッサ、ROM及びRAMなどを含んで構成されるコンピュータシステムである。 In the present invention, some or all of the components constituting the cache memory device and the program conversion device may be configured from one system LSI (Large Scale Integration). The system LSI is an ultra-multifunctional LSI manufactured by integrating a plurality of components on a single chip. Specifically, the system LSI is a computer system including a microprocessor, a ROM, a RAM, and the like. .
本発明は、性能の劣化を抑制するとともに、消費電力の増加を抑制することができるという効果を奏し、パーソナルコンピュータ、各種家電機器などのキャッシュメモリを有する機器に利用することができる。 INDUSTRIAL APPLICABILITY The present invention has an effect of suppressing deterioration in performance and suppressing an increase in power consumption, and can be used for a device having a cache memory such as a personal computer and various home appliances.
10 キャッシュメモリシステム
100、400、500 キャッシュメモリ装置
110 キャッシュメモリ
111、411 タグ格納部群
111a、111b、411a、411b タグ格納部
112 データ格納部群
112a、112b データ格納部
113、413、513 クロック制御部
113a、113b、413a、413b クロック制御信号生成部
114 ヒット判定部
115 セレクタ
120 ウェイ予測部
121 履歴保持部
122 予測部
123 更新部
130 TLB
151 アドレス
152 書き込みデータ
153 読み出しデータ
154 命令コード
155 命令デコード信号
156 共有アクセス信号
157 排他アクセス信号
158a、158b ウェイ予測信号
159a、159b、459a、459b クロック制御信号
160a、160b タグデータ
161a、161b データ格納部読み出しデータ
162 キャッシュヒット信号
163 物理ページ番号
200 プロセッサ部
210 プロセッサ
220 命令解読部
230 命令キャッシュメモリ
300 プログラム変換装置
310 抽出部
320 判定部
330 変換部
516a、516b スイッチ
517 選択部
564a、564b 制御信号
10
151
Claims (15)
前記プロセッサ部に接続され、タグ格納部及びデータ格納部をそれぞれが含む複数のウェイを備えるセットアソシアティブ方式のキャッシュメモリと、
前記プロセッサ部でメモリアクセス命令が解読されたときに、前記複数のウェイのうちのヒットするウェイを予測するウェイ予測部と、
前記プロセッサ部で解読されたメモリアクセス命令の種別に基づいて、前記複数のウェイに供給するクロックを制御するクロック制御部とを備え、
前記クロック制御部は、
第1メモリアクセス命令が前記プロセッサ部で解読された場合に、前記複数のウェイに含まれる複数のデータ格納部のうち、前記ウェイ予測部によって予測されたウェイのデータ格納部のみにクロックを供給し、
前記第1メモリアクセス命令とは異なる第2メモリアクセス命令が前記プロセッサ部で解読された場合に、前記ウェイ予測部による予測結果に関わらず、前記複数のウェイに含まれる複数のデータ格納部のうち、予め定められたデータ格納部にクロックを供給する
キャッシュメモリ装置。 A cache memory device connected to a processor unit that executes a plurality of programs while switching,
A set associative cache memory connected to the processor unit and comprising a plurality of ways each including a tag storage unit and a data storage unit;
A way prediction unit that predicts a hit way among the plurality of ways when a memory access instruction is decoded by the processor unit;
A clock control unit that controls a clock supplied to the plurality of ways based on a type of a memory access instruction decoded by the processor unit;
The clock control unit
When the first memory access instruction is decoded by the processor unit, the clock is supplied only to the data storage unit of the way predicted by the way prediction unit among the plurality of data storage units included in the plurality of ways. ,
When a second memory access instruction different from the first memory access instruction is decoded by the processor unit, among the plurality of data storage units included in the plurality of ways regardless of the prediction result by the way prediction unit A cache memory device for supplying a clock to a predetermined data storage unit.
前記第2メモリアクセス命令は、前記複数のプログラムの間において共有の変数をメモリに読み書きする命令である
請求項1記載のキャッシュメモリ装置。 The first memory access instruction is an instruction for reading and writing an exclusive variable between the plurality of programs to and from the memory,
The cache memory device according to claim 1, wherein the second memory access instruction is an instruction for reading / writing a shared variable between the plurality of programs to / from a memory.
前記第2メモリアクセス命令は、共有変数宣言された変数をメモリに読み書きする命令である
請求項1記載のキャッシュメモリ装置。 The first memory access instruction is an instruction to read / write a variable declared as a local variable into / from a memory,
The cache memory device according to claim 1, wherein the second memory access instruction is an instruction to read / write a variable declared as a shared variable from / to a memory.
請求項1記載のキャッシュメモリ装置。 The cache memory device according to claim 1, wherein the second memory access instruction includes an attribute bit indicating that the way prediction result is not used.
前記第1メモリアクセス命令が前記プロセッサ部で解読された場合に、前記複数のウェイに含まれる複数のタグ格納部のうち、前記ウェイ予測部によって予測されたウェイのタグ格納部のみにクロックを供給し、
前記第2メモリアクセス命令が前記プロセッサ部で解読された場合に、前記ウェイ予測部による予測結果に関わらず、前記複数のウェイに含まれる複数のタグ格納部のうち、予め定められたタグ格納部にクロックを供給する
請求項1〜4のいずれか1項に記載のキャッシュメモリ装置。 The clock control unit further includes:
When the first memory access instruction is decoded by the processor unit, a clock is supplied only to the tag storage unit of the way predicted by the way prediction unit among the plurality of tag storage units included in the plurality of ways. And
When the second memory access instruction is decoded by the processor unit, a predetermined tag storage unit among a plurality of tag storage units included in the plurality of ways regardless of a prediction result by the way prediction unit The cache memory device according to claim 1, wherein a clock is supplied to the cache memory device.
前記第2メモリアクセス命令が前記プロセッサ部で解読された場合に、前記複数のウェイに含まれる全てのデータ格納部にクロックを供給する
請求項1〜5のいずれか1項に記載のキャッシュメモリ装置。 The clock control unit
The cache memory device according to claim 1, wherein a clock is supplied to all data storage units included in the plurality of ways when the second memory access instruction is decoded by the processor unit. .
前記クロック制御部は、前記第2メモリアクセス命令が前記プロセッサ部で解読された場合に、前記複数のウェイに含まれる複数のデータ格納部のうち、前記第2メモリアクセス命令を含むプログラムに割り当てられたウェイに含まれるデータ格納部にクロックを供給する
請求項1〜5のいずれか1項に記載のキャッシュメモリ装置。 The plurality of ways are assigned to the plurality of programs,
The clock control unit is assigned to a program including the second memory access instruction among a plurality of data storage units included in the plurality of ways when the second memory access instruction is decoded by the processor unit. The cache memory device according to claim 1, wherein a clock is supplied to a data storage unit included in the way.
ヒットしたウェイの履歴を示す履歴情報を保持する履歴保持部と、
前記履歴情報に基づいて、前記ヒットするウェイを予測する予測部と、
前記履歴情報を更新する更新部とを備え、
前記更新部は、
前記第1メモリアクセス命令が前記プロセッサ部で解読された場合に、前記第1メモリアクセス命令によってヒットしたウェイを示す情報を用いて、前記履歴情報を更新し、
前記第2メモリアクセス命令が前記プロセッサ部で解読された場合に、前記履歴情報を更新しない
請求項1〜7のいずれか1項に記載のキャッシュメモリ装置。 The way prediction unit
A history holding unit for holding history information indicating a history of hit ways;
A prediction unit that predicts the hit way based on the history information;
An update unit for updating the history information,
The update unit
When the first memory access instruction is decoded by the processor unit, the history information is updated using information indicating a way hit by the first memory access instruction,
The cache memory device according to claim 1, wherein the history information is not updated when the second memory access instruction is decoded by the processor unit.
ヒットしたウェイの履歴を示す履歴情報を保持する履歴保持部と、
前記履歴情報に基づいて、前記ヒットするウェイを予測する予測部と、
前記履歴情報を更新する更新部とを備え、
前記更新部は、
前記第1メモリアクセス命令が前記プロセッサ部で解読された場合に、前記第1メモリアクセス命令によってヒットしたウェイを示す情報を用いて、前記履歴情報を更新し、
前記第2メモリアクセス命令が前記プロセッサ部で解読された場合に、前記第2メモリアクセス命令によってヒットしたウェイを示す情報を用いて、前記履歴情報を更新する
請求項1〜7のいずれか1項に記載のキャッシュメモリ装置。 The way prediction unit
A history holding unit for holding history information indicating a history of hit ways;
A prediction unit that predicts the hit way based on the history information;
An update unit for updating the history information,
The update unit
When the first memory access instruction is decoded by the processor unit, the history information is updated using information indicating a way hit by the first memory access instruction,
The history information is updated using information indicating a way hit by the second memory access instruction when the second memory access instruction is decoded by the processor unit. The cache memory device according to 1.
入力されたプログラムからメモリアクセス命令を抽出する抽出部と、
前記抽出部によって抽出されたメモリアクセス命令が示す変数が、グローバル変数であるか否かを判定する判定部と、
前記判定部によってグローバル変数であると判定された場合、対応するメモリアクセス命令を、前記キャッシュメモリにウェイの予測結果を利用させないようにするための予測無視メモリアクセス命令に変換する変換部とを備える
プログラム変換装置。 A program conversion device for generating a memory access instruction corresponding to a cache memory having a way prediction function,
An extraction unit for extracting a memory access instruction from the input program;
A determination unit that determines whether or not the variable indicated by the memory access instruction extracted by the extraction unit is a global variable;
A conversion unit that converts a corresponding memory access instruction into a prediction ignoring memory access instruction for preventing the cache memory from using a way prediction result when the determination unit determines that the variable is a global variable. Program conversion device.
請求項10記載のプログラム変換装置。 The program according to claim 10, wherein when the variable indicated by the memory access instruction extracted by the extraction unit is a variable shared among a plurality of programs, the determination unit determines that the variable is a global variable. Conversion device.
請求項10記載のプログラム変換装置。 The program conversion device according to claim 10, wherein the determination unit determines that the variable is a global variable when the variable indicated by the memory access instruction extracted by the extraction unit is a variable declared as a shared variable.
請求項10記載のプログラム変換装置。 When the determination unit determines that the variable is a global variable, the conversion unit converts a corresponding memory access instruction into the prediction-ignore memory access instruction including an attribute bit indicating that the way prediction result is not used. Item 13. The program conversion device according to Item 10.
前記キャッシュメモリは、
前記プロセッサ部に接続され、タグ格納部及びデータ格納部をそれぞれが含む複数のウェイを備えるセットアソシアティブ方式のキャッシュメモリであり、
前記キャッシュメモリ制御方法は、
前記プロセッサ部でメモリアクセス命令が解読されたときに、前記複数のウェイのうちヒットするウェイを予測するウェイ予測ステップと、
前記プロセッサ部で解読されたメモリアクセス命令の種別に基づいて、前記複数のウェイに供給するクロックを制御するクロック制御ステップとを含み、
前記クロック制御ステップでは、
第1メモリアクセス命令が前記プロセッサ部で解読された場合に、前記複数のウェイに含まれる複数のデータ格納部のうち、前記ウェイ予測ステップにおいて予測されたウェイのデータ格納部のみにクロックを供給し、
前記第1メモリアクセス命令とは異なる第2メモリアクセス命令が前記プロセッサ部で解読された場合に、前記ウェイ予測ステップにおける予測結果に関わらず、前記複数のウェイに含まれる複数のデータ格納部のうち、予め定められたデータ格納部にクロックを供給する
キャッシュメモリ制御方法。 A cache memory control method for controlling a cache memory connected to a processor unit that executes while switching a plurality of programs,
The cache memory is
A set associative cache memory including a plurality of ways connected to the processor unit and each including a tag storage unit and a data storage unit;
The cache memory control method includes:
A way prediction step for predicting a hit way among the plurality of ways when a memory access instruction is decoded in the processor unit;
A clock control step for controlling a clock supplied to the plurality of ways based on a type of a memory access instruction decoded by the processor unit;
In the clock control step,
When the first memory access instruction is decoded by the processor unit, the clock is supplied only to the data storage unit of the way predicted in the way prediction step among the plurality of data storage units included in the plurality of ways. ,
When a second memory access instruction different from the first memory access instruction is decoded by the processor unit, out of a plurality of data storage units included in the plurality of ways regardless of a prediction result in the way prediction step A cache memory control method for supplying a clock to a predetermined data storage unit.
入力されたプログラムからメモリアクセス命令を抽出する抽出ステップと、
前記抽出ステップにおいて抽出されたメモリアクセス命令が示す変数が、グローバル変数であるか否かを判定する判定ステップと、
前記判定ステップにおいてグローバル変数であると判定された場合、対応するメモリアクセス命令を、前記キャッシュメモリにウェイの予測結果を利用させないようにするための予測無視メモリアクセス命令に変換する変換ステップとを含む
プログラム変換方法。 A program conversion method for generating a memory access instruction corresponding to a cache memory having a way prediction function,
An extraction step for extracting a memory access instruction from the input program;
A determination step of determining whether or not the variable indicated by the memory access instruction extracted in the extraction step is a global variable;
A conversion step of converting a corresponding memory access instruction into a prediction ignoring memory access instruction for preventing the cache memory from using a prediction result of a way when it is determined that the variable is a global variable in the determination step. Program conversion method.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010129296A JP2011257800A (en) | 2010-06-04 | 2010-06-04 | Cache memory device, program conversion device, cache memory control method, and program conversion method |
PCT/JP2011/000431 WO2011151944A1 (en) | 2010-06-04 | 2011-01-27 | Cache memory device, program transformation device, cache memory control method, and program transformation method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010129296A JP2011257800A (en) | 2010-06-04 | 2010-06-04 | Cache memory device, program conversion device, cache memory control method, and program conversion method |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2011257800A true JP2011257800A (en) | 2011-12-22 |
Family
ID=45066338
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2010129296A Pending JP2011257800A (en) | 2010-06-04 | 2010-06-04 | Cache memory device, program conversion device, cache memory control method, and program conversion method |
Country Status (2)
Country | Link |
---|---|
JP (1) | JP2011257800A (en) |
WO (1) | WO2011151944A1 (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110107034A1 (en) * | 2009-11-04 | 2011-05-05 | Renesas Electronics Corporation | Cache device |
JP2014085890A (en) * | 2012-10-24 | 2014-05-12 | Fujitsu Ltd | Memory device, arithmetic processing unit, and cache memory control method |
JP2016505971A (en) * | 2012-12-20 | 2016-02-25 | クアルコム,インコーポレイテッド | Instruction cache with multi-bitway prediction mask |
JP2018190372A (en) * | 2017-05-09 | 2018-11-29 | 晶心科技股▲ふん▼有限公司Andes Technology Corporation | Processor and its way prediction method |
US11321235B2 (en) | 2020-01-30 | 2022-05-03 | Samsung Electronics Co., Ltd. | Cache memory device, system including the same, and method of operating the same |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9367468B2 (en) * | 2013-01-15 | 2016-06-14 | Qualcomm Incorporated | Data cache way prediction |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP3589485B2 (en) * | 1994-06-07 | 2004-11-17 | 株式会社ルネサステクノロジ | Set associative memory device and processor |
JPH1139216A (en) * | 1997-07-24 | 1999-02-12 | Hitachi Ltd | Semiconductor storage and cache memory system |
JP4498705B2 (en) * | 2003-09-04 | 2010-07-07 | 株式会社ルネサステクノロジ | Cash system |
-
2010
- 2010-06-04 JP JP2010129296A patent/JP2011257800A/en active Pending
-
2011
- 2011-01-27 WO PCT/JP2011/000431 patent/WO2011151944A1/en active Application Filing
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110107034A1 (en) * | 2009-11-04 | 2011-05-05 | Renesas Electronics Corporation | Cache device |
JP2014085890A (en) * | 2012-10-24 | 2014-05-12 | Fujitsu Ltd | Memory device, arithmetic processing unit, and cache memory control method |
JP2016505971A (en) * | 2012-12-20 | 2016-02-25 | クアルコム,インコーポレイテッド | Instruction cache with multi-bitway prediction mask |
JP2018190372A (en) * | 2017-05-09 | 2018-11-29 | 晶心科技股▲ふん▼有限公司Andes Technology Corporation | Processor and its way prediction method |
US11281586B2 (en) | 2017-05-09 | 2022-03-22 | Andes Technology Corporation | Processor and way prediction method thereof |
US11321235B2 (en) | 2020-01-30 | 2022-05-03 | Samsung Electronics Co., Ltd. | Cache memory device, system including the same, and method of operating the same |
Also Published As
Publication number | Publication date |
---|---|
WO2011151944A1 (en) | 2011-12-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8527707B2 (en) | High-performance cache system and method | |
US9396117B2 (en) | Instruction cache power reduction | |
WO2011151944A1 (en) | Cache memory device, program transformation device, cache memory control method, and program transformation method | |
JP4920378B2 (en) | Information processing apparatus and data search method | |
JP7160956B2 (en) | Selective execution of advance branch prediction based on branch instruction type | |
CN106066831B (en) | Memory management | |
US8151096B2 (en) | Method to improve branch prediction latency | |
JP6457836B2 (en) | Processor and instruction code generation device | |
US7769954B2 (en) | Data processing system and method for processing data | |
JP5159258B2 (en) | Arithmetic processing unit | |
US6810473B2 (en) | Replacement algorithm for a replicated fully associative translation look-aside buffer | |
JPWO2005050454A1 (en) | Cache memory and control method thereof | |
JP2010102623A (en) | Cache memory and control method therefor | |
US20150193348A1 (en) | High-performance data cache system and method | |
JP4354001B1 (en) | Memory control circuit and integrated circuit | |
US9348598B2 (en) | Data processing apparatus and method for pre-decoding instructions to be executed by processing circuitry | |
JP2013073271A (en) | Address converter, control method of address converter and arithmetic processing unit | |
US20140297958A1 (en) | System and method for updating an instruction cache following a branch instruction in a semiconductor device | |
JP2006285727A (en) | Cache memory device | |
US10180907B2 (en) | Processor and method | |
CN117472446B (en) | Branch prediction method of multi-stage instruction fetching target buffer based on processor | |
US20160179676A1 (en) | Cleaning a write-back cache | |
US11550588B2 (en) | Branch target filtering based on memory region access count | |
JP2006330948A (en) | Multiprocessor system and method for selecting swap out level of copy cache information for use therewith | |
KR20210109014A (en) | Instruction tightly coupled memory and instruction cache access prediction |