JP4904802B2 - Cache memory and processor - Google Patents
Cache memory and processor Download PDFInfo
- Publication number
- JP4904802B2 JP4904802B2 JP2005366569A JP2005366569A JP4904802B2 JP 4904802 B2 JP4904802 B2 JP 4904802B2 JP 2005366569 A JP2005366569 A JP 2005366569A JP 2005366569 A JP2005366569 A JP 2005366569A JP 4904802 B2 JP4904802 B2 JP 4904802B2
- Authority
- JP
- Japan
- Prior art keywords
- data
- processor
- memory
- read
- stored
- 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 relates to a cache memory and a processor, and more particularly to a cache memory provided in a processor that executes a plurality of processes in parallel, such as a multithread processor, and a processor including such a cache memory.
近年、複数のスレッドやタスク(実施形態1ではスレッドに統一して記す)を並列に実行するマルチプロセッサ(マルチコア)、あるいはマルチスレッドプロセッサが注目されている。このようなプロセッサは、総称してマルチプロセッサシステムとも呼ばれる。マルチプロセッサシステムでは、データ等が蓄積されている外部メモリへのアクセスを効率化するため、外部メモリからいったん読み出されたデータのうちの処理に使用される可能性のあるデータを保存しておくキャッシュメモリを備えるマルチプロセッサシステムがある。このような構成の従来技術として、例えば、特許文献1が掲げられる。 In recent years, attention has been paid to a multiprocessor (multicore) or a multithread processor that executes a plurality of threads and tasks (in the first embodiment, unified as threads) in parallel. Such processors are collectively referred to as multiprocessor systems. In a multiprocessor system, data that may be used for processing out of data once read from the external memory is stored in order to improve the efficiency of access to the external memory in which data or the like is stored. There are multiprocessor systems with cache memory. For example, Patent Document 1 is cited as a conventional technique having such a configuration.
また、特許文献1に示したようなキャッシュメモリを備えたマルチプロセッサでは、複数のプロセッサ間で処理に使用されるデータの一致性(コヒーレンシー)を保つことが必要である。従来のプロセッサでは、データのコヒーレンシーを保つためにバス・スヌープが多く採用されている。バス・スヌープとは、各プロセッサ間で共有されるメモリインターフェイスバス上のトランザクションを観察し、自身に割り当てられているキャッシュメモリ上にあるデータにかかるトランザクションが発生したか否かを検出する機能である。 In addition, in a multiprocessor having a cache memory as shown in Patent Document 1, it is necessary to maintain consistency (coherency) of data used for processing among a plurality of processors. Conventional processors often employ bus snoops to maintain data coherency. Bus snoop is a function for observing a transaction on a memory interface bus shared between processors and detecting whether a transaction related to data in a cache memory allocated to the processor has occurred. .
自身に割り当てられたキャッシュメモリ上にあるデータのトランザクションが発生した場合、プロセッサは、キャッシュメモリの該当するエントリを更新し、マルチプロセッサシステムにおける各プロセッサのキャッシュメモリ領域等に保存されているデータの内容を統一する。バス・スヌープには多くの実装法があり、例えばライトワンスやバークレイプロトコルがある。
しかしながら、上記した特許文献1の発明は、キャッシュメモリの記憶領域を独立の領域に分割し、マルチプロセッサシステムで同時に実行されるスレッドごとに割り当てている。このような特許文献1によれば、キャッシュメモリに必要とされるデータが保存されていて、このデータに対するアクセスの成功(ヒット)の割合(ヒット率)が低下するという不具合がある。 However, the above-described invention of Patent Document 1 divides the storage area of the cache memory into independent areas and assigns them to threads that are simultaneously executed in the multiprocessor system. According to Patent Document 1 described above, there is a problem in that data required for the cache memory is stored, and the rate (hit rate) of successful access (hit) to the data decreases.
さらに、特許文献1に記した構成でバス・スヌープの機能を用いコヒーレンシーを保持する場合、バスをモニタする回路によってマルチプロセッサシステムのハードウェア構成が大規模化する。また、バスを常時モニタするために消費電力が高まり、キャッシュメモリの独立した各領域に各々アクセスしてデータを書き換えるため、コヒーレンシー保持の動作効率が低いという課題が生じる。 Furthermore, when the coherency is maintained using the bus snoop function in the configuration described in Patent Document 1, the hardware configuration of the multiprocessor system is enlarged by a circuit that monitors the bus. Further, power consumption increases because the bus is constantly monitored, and data is rewritten by accessing each independent area of the cache memory, resulting in low coherency holding operation efficiency.
本発明は、上記した点に鑑みてなされたものであって、マルチプロセッサシステムにあって装置構成を大きくする、あるいは消費電力を高めることがなく、プロセッサ間でデータのコヒーレンシーを動作効率よく保つことができるキャッシュメモリ及びこのキャッシュメモリを備えたプロセッサを提供することを目的とする。 The present invention has been made in view of the above-described points, and maintains data coherency between processors efficiently in a multiprocessor system without increasing the device configuration or increasing power consumption. It is an object of the present invention to provide a cache memory capable of performing the above and a processor including the cache memory.
以上の課題を解決するため、本発明のキャッシュメモリは、複数のプロセッサによって記憶装置から読み出されたデータの少なくとも一部をキャッシュしておき、キャッシュされたデータの少なくとも一部を前記プロセッサに供給するキャッシュメモリであって、前記記憶装置から読み出されたデータが保存されるデータ保存手段と、前記データ保存手段に記憶されているデータのアドレスを、前記データ保存手段が記憶しているデータ全体について一括して管理するアドレス管理手段と、前記プロセッサによって供給を要求されたデータのアドレスを前記アドレス管理手段によって管理されているアドレスと照合し、供給を要求されたデータが前記データ保存手段から読出し可能であるか否か検出するヒット検出手段と、前記ヒット検出手段によってデータが読出し可能であることが検出された場合、検出されたデータを前記プロセッサに供給するデータ供給手段と、を備えることを特徴とする。 In order to solve the above problems, the cache memory of the present invention caches at least a part of data read from a storage device by a plurality of processors, and supplies at least a part of the cached data to the processor. A data storage means for storing data read from the storage device, and an address of the data stored in the data storage means, the entire data stored in the data storage means Address management means that collectively manage the data, and the address of the data requested to be supplied by the processor is checked against the address managed by the address management means, and the data requested to be supplied is read from the data storage means Hit detection means for detecting whether or not possible, and the hit detection means Data if it is detected is readable, characterized in that it comprises a data supply means for supplying the detected data to said processor by.
このような発明によれば、複数のプロセッサによってキャッシュされたデータのデータ保存手段におけるアドレスを一括して管理することができるので、複数のプロセッサでキャッシュされたデータを実質的に1つのデータ保存手段に保存することになり、データ保存手段内におけるデータの不統一をなくすことができる。このため、プロセッサ間でデータのコヒーレンシーを動作効率よく保つことができるキャッシュメモリを提供することができる。さらに、データのコヒーレンシーを保つにあたり、別途回路等を追加する必要がないため、キャッシュメモリの装置構成を大きくする、あるいは消費電力を高めることがない。 According to such an invention, since the addresses in the data storage means of the data cached by the plurality of processors can be collectively managed, the data cached by the plurality of processors is substantially stored in one data storage means. Therefore, it is possible to eliminate data inconsistency in the data storage means. Therefore, it is possible to provide a cache memory that can keep data coherency between processors efficiently. Furthermore, since it is not necessary to add a separate circuit or the like to maintain data coherency, the cache memory device configuration is not increased or the power consumption is not increased.
また、本発明のキャッシュメモリは、前記データ保存手段から読み出されたデータ、前記データ保存手段に書き込まれるデータの少なくとも一方を一時的に保存するバッファ手段をさらに備えることを特徴とする。
このような発明によれば、データ管理手段及びデータ保存手段に対するアクセス回数が低減し、キャッシュメモリへのアクセス速度を高め、キャッシュメモリを採用したプロセッサの処理速度を向上することができる。
The cache memory according to the present invention further includes buffer means for temporarily storing at least one of data read from the data storage means and data written to the data storage means.
According to such an invention, the number of accesses to the data management means and the data storage means can be reduced, the access speed to the cache memory can be increased, and the processing speed of the processor employing the cache memory can be improved.
また、本発明のキャッシュメモリは、前記データ供給手段が、前記ヒット検出手段によってデータが読出し可能であることが検出された場合、検出されたデータを前記プロセッサに供給すると共に、前記プロセッサに供給されたデータと連続するデータを含むデータを、前記データ保存手段から読み出されたデータを一時的に保存する前記バッファ手段にも供給することを特徴とする。 The cache memory according to the present invention supplies the detected data to the processor and the processor when the data supply means detects that the data can be read by the hit detection means. The data including the continuous data is also supplied to the buffer means for temporarily storing the data read from the data storage means.
このような発明によれば、プロセッサに供給されたデータに続くデータを予めバッファに保存することができ、次回にこのデータが要求されたときデータ管理手段及びデータ保存手段にアクセスする必要がなくなる。このため、データ管理手段及びデータ保存手段に対するアクセス回数が低減し、キャッシュメモリへのアクセス速度を高め、キャッシュメモリを採用したプロセッサの処理速度を向上することができる。 According to such an invention, data following the data supplied to the processor can be stored in the buffer in advance, and there is no need to access the data management means and the data storage means when this data is requested next time. Therefore, the number of accesses to the data management unit and the data storage unit can be reduced, the access speed to the cache memory can be increased, and the processing speed of the processor employing the cache memory can be improved.
また、本発明のキャッシュメモリは、前記プロセッサによって供給が要求されることが予想されるデータをキャッシュしておく先読みデータ保存手段をさらに備えることを特徴とする。
このような発明によれば、データ管理手段及びデータ保存手段に対するアクセス回数が低減し、キャッシュメモリへのアクセス速度を高め、キャッシュメモリを採用したプロセッサの処理速度を向上することができる。
The cache memory according to the present invention further includes pre-read data storage means for caching data expected to be supplied by the processor.
According to such an invention, the number of accesses to the data management means and the data storage means can be reduced, the access speed to the cache memory can be increased, and the processing speed of the processor employing the cache memory can be improved.
また、本発明のキャッシュメモリは、前記データ管理手段が、前記データ保存手段のアドレスを複数のウェイとして管理すると共に、データ保存手段に保存されているデータを前記データ保存手段にデータを保持する際の優先度である保存優先度を前記ウェイごとに付し、かつ、各ウェイに付される保存優先度を該ウェイで管理されているデータに対するアクセスの状態に基づいて決定することを特徴とする。 In the cache memory according to the present invention, the data management unit manages the address of the data storage unit as a plurality of ways, and stores data stored in the data storage unit in the data storage unit. The storage priority is assigned to each way, and the storage priority assigned to each way is determined based on the state of access to the data managed by the way. .
このような発明によれば、データを複数のウェイで管理する場合にもLRU方式を採用してキャッシュのヒット率を高めることができる。
また、本発明のキャッシュメモリは、前記データ保存手段、前記データ管理手段の少なくとも一方がマルチポートメモリであることを特徴とする。
このような発明によれば、複数のプロセッサがデータメモリ、タグメモリに高速にアクセスすることが可能になってマルチプロセッサの処理能力を向上させることができる。
According to such an invention, even when data is managed by a plurality of ways, the cache hit rate can be increased by adopting the LRU method.
The cache memory according to the present invention is characterized in that at least one of the data storage means and the data management means is a multiport memory.
According to such an invention, it becomes possible for a plurality of processors to access the data memory and the tag memory at high speed, and the processing capability of the multiprocessor can be improved.
また、本発明のプロセッサは、複数のプロセッサによって記憶装置から読み出されたデータの少なくとも一部をキャッシュしておき、キャッシュされたデータの少なくとも一部を前記プロセッサに供給するキャッシュメモリを備えたプロセッサであって、前記キャッシュメモリは、前記記憶装置から読み出されたデータが保存されるデータ保存手段と、前記データ保存手段に記憶されているデータのアドレスを、前記データ保存手段が記憶しているデータ全体について一括して管理するアドレス管理手段と、前記プロセッサによって供給を要求されたデータのアドレスを前記アドレス管理手段によって管理されているアドレスと照合し、供給を要求されたデータが前記データ保存手段から読出し可能か否かを検出するヒット検出手段と、前記ヒット検出手段によってデータが読出し可能であることが検出された場合、検出されたデータを前記プロセッサに供給するデータ供給手段と、を備えることを特徴とする。 The processor of the present invention includes a cache memory that caches at least part of data read from the storage device by a plurality of processors and supplies at least part of the cached data to the processor. In the cache memory, the data storage means stores the data storage means for storing the data read from the storage device, and the address of the data stored in the data storage means. Address management means for collectively managing the entire data, the address of the data requested to be supplied by the processor is collated with the address managed by the address management means, and the data requested to be supplied is the data storage means Hit detection means for detecting whether or not reading is possible, and If the data by Tsu preparative detecting means is detected to be readable, characterized in that it comprises a data supply means for supplying the detected data to said processor.
このような発明によれば、複数のプロセッサによってキャッシュされたデータのデータ保存手段におけるアドレスを一括して管理することができるので、複数のプロセッサでキャッシュされたデータを実質的に1つのデータ保存手段に保存することになり、データ保存手段内におけるデータの不統一をなくすことができる。このため、プロセッサ間でデータのコヒーレンシーを動作効率よく保つことができるプロセッサを提供することができる。さらに、データのコヒーレンシーを保つにあたり、別途回路等を追加する必要がないため、プロセッサにあって装置構成を大きくする、あるいは消費電力を高めることがない。 According to such an invention, since the addresses in the data storage means of the data cached by the plurality of processors can be collectively managed, the data cached by the plurality of processors is substantially stored in one data storage means. Therefore, it is possible to eliminate data inconsistency in the data storage means. For this reason, it is possible to provide a processor that can maintain data coherency between processors efficiently. Furthermore, since it is not necessary to add a separate circuit or the like to maintain data coherency, the apparatus configuration in the processor is not increased, or power consumption is not increased.
また、本発明のキャッシュメモリは、複数の前記プロセッサの各々が、スレッドごとに処理を実行すると共に、処理の実行中に実行されているスレッドを他のスレッドと変更し得ることを特徴とする。
このような発明によれば、1つのプロセッサが共通するデータにアクセスする可能性が高いマルチスレッドプロセッサにあってもプロセッサ間でデータのコヒーレンシーを動作効率よく保つことができる。
In addition, the cache memory according to the present invention is characterized in that each of the plurality of processors executes processing for each thread and can change a thread being executed during the processing to another thread.
According to such an invention, even in a multithread processor in which one processor is likely to access common data, data coherency can be maintained between the processors with high operational efficiency.
以下、図を参照して本発明に係るキャッシュメモリ及びこのキャッシュメモリを備えたプロセッサの実施の形態1、実施形態2を説明する。 Hereinafter, a first embodiment and a second embodiment of a cache memory according to the present invention and a processor including the cache memory will be described with reference to the drawings.
(実施形態1)
図1は、本発明の実施形態1、実施形態2に共通のキャッシュメモリを備えたマルチスレッドプロセッサ101を示した図である。マルチスレッドプロセッサ101は、外部メモリ105からデータを読み出す、あるいは実行されたスレッドの結果等を外部メモリ105に書込んでいる。
(Embodiment 1)
FIG. 1 is a diagram showing a
また、マルチスレッドプロセッサ101は、キャッシュメモリ109を備え、外部メモリ105に対し、キャッシュメモリ109を介してデータを読み出す、あるいは書込んでいる。キャッシュメモリ109は、マルチスレッドプロセッサ101に含まれる複数のプロセッサによってキャッシュされたデータを保存しておき、キャッシュされたデータの少なくとも一部を複数のプロセッサのいずれかに供給する。このため、マルチスレッドプロセッサ101は、外部メモリ105にアクセスすることなくデータの多くの供給を受けることができる。
In addition, the
キャッシュメモリ109は、一般的に外部メモリ105よりもプロセッサが高速にアクセス可能な構成を有している。このため、キャッシュメモリ109にアクセスしてデータを取得する構成は、マルチスレッドプロセッサ101のデータの読出し及び書込みを高速化すると共に外部メモリ105に対するアクセス回数を低減し、マルチスレッドプロセッサ101の処理速度及び処理効率を高めることができる。
The
また、マルチスレッドプロセッサ101は、複数のスレッドと、スレッドの実行に使用されるプロセッサとを一対一に割り付けるものでなく、複数のプロセッサの各々が、スレッドごとに処理を実行すると共に、処理の実行中に実行されているスレッドを他のスレッドと変更し得る。このようなマルチスレッドプロセッサ101は、マルチスレッドOSによって動作するものである。
In addition, the
すなわち、マルチスレッドプロセッサ101では、複数のプロセッサが、スレッドの優先順位に応じて実行されるスレッドを動的に変更する。このような動作を図2に例示する。図2に示した例では、マルチスレッドプロセッサ101がプロセッサ0からプロセッサ3の4つのプロセッサを備えている。そして、いずれのプロセッサもスレッドの実行中により優先度の高いスレッドの割込みが入り、割り込んだスレッドに処理を切り換えている。
That is, in the
スレッドが切り替えられる場合、マルチスレッドプロセッサ101は、切り替え直前のスレッドの状態や結果(コンテキスト)を退避させると共に、次に実行されるスレッドのコンテキストをプロセッサ設定する。
マルチスレッドプロセッサ101では、プロセッサ0からプロセッサ3のいずれでもOSが動作し、他のプロセッサを制御し得る。このようなマルチスレッドプロセッサは、複数のプロセッサが同等な立場で処理を分担するものであって、対称型マルチプロセッサ(SMP:Symmetric Multi Processor)とも呼ばれている。
When the thread is switched, the
In the
また、キャッシュメモリ109は、データの保存に使用されるキャッシュメモリ部107と、キャッシュメモリ部107に対するデータの保存を制御するキャッシュ制御部103とを備えている。キャッシュメモリ部107は、後に図示するように、データに付されたアドレスや状態を管理するタグメモリと、データ本体を保存するためのデータメモリとを含んでいる。
Further, the
図3は、キャッシュメモリ109の構成をより詳細に示した図である。なお、実施形態1では、キャッシュメモリ109がプロセッサ0からプロセッサ3までの4つのプロセッサと接続し、4つのプロセッサからデータの要求を受けると共に、4つのプロセッサから受け取ったデータを書き込むことが可能である。なお、各プロセッサがキャッシュメモリ109に対して行うデータの要求を、実施形態1では以降読出し命令と記す。
FIG. 3 is a diagram showing the configuration of the
キャッシュメモリ109は、図1に示したように、キャッシュ制御部103と、キャッシュメモリ部107と、ヒット検出部208とを備えている。キャッシュメモリ部107は、タグメモリ206とデータメモリ207とを有し、データメモリ207は、外部メモリ105から読み出されたデータが保存される構成である。また、タグメモリ206は、外部メモリ105から読み出されたデータを保存するデータメモリ207や後述するリード・バッファにおけるアドレスを一括して管理する構成である。
As shown in FIG. 1, the
タグメモリ206は、データの外部メモリ105におけるデータと、このデータが現在保存されているアドレスとを対応付けるデータを例えばテーブル等によって保存するメモリである。データは、外部メモリ105の他、データメモリ207にも保存されている可能性があるから、データが現在保存されているアドレスは、データメモリ207のアドレスをもとり得るものである。
The
なお、実施形態1では、タグメモリ206が、データのアドレスの他、状態(ステータス)をも管理する。ここでいうステータスとは、データの有効、無効やダーティ(外部メモリ105から読み出された後に変更された)であるか否か等を示す情報である。
また、キャッシュ制御部103は、アドレス制御部201、バッファ管理部202、ライト・バッファ203、リード・バッファ205を備えている。
In the first embodiment, the
The
アドレス制御部201は、プロセッサから入力された読出し命令から要求されたデータのアドレスを取得し、タグメモリ206及びデータメモリ207をアクセスする際のアドレスに変換してタグメモリ206に出力する。あるいは、データメモリ207にキャッシュされているデータを読み出す際、タグメモリ206およびデータメモリ207に読み出されるデータのアドレスを出力する。さらに、データメモリ207にキャッシュされていないデータを外部メモリ105から読み出す際、外部メモリ105のアドレスを生成し、外部メモリ105に出力する。
The
キャッシュ制御部103は、アドレス制御部201で生成されたアドレスに基づいてタグメモリ206とデータメモリ207とに対するアクセスを制御する。また、キャッシュ制御部103は、タグメモリ206およびデータメモリ207へのアクセスが実際に生じるときだけ、メモリアクセスのクロックを供給するなどの方法によって消費電力を低減することも可能である。
The
ライト・バッファ203は、データメモリ207に書き込まれるデータを一時的に保存(バッファリング)するバッファであって、プロセッサ0からプロセッサ3の各々に対応するバッファ203a、203b、203c、203dを備えている。また、リード・バッファ205は、データメモリ207から読み出されたデータをバッファリングするバッファであって、ライト・バッファ203と同様に、プロセッサ0からプロセッサ3の各々に対応するバッファ205a、205b、205c、205dを備えている。ライト・バッファ203、リード・バッファ205は、データメモリ207に対する書込みあるいは読出しのタイミングを調整するために設けられた構成である。
The
さらに、キャッシュ制御部103は、バッファ管理部202を備えている。バッファ管理部202は、ライト・バッファ203とリード・バッファ205との間のデータの整合性をとるための構成である。すなわち、バッファ管理部202は、ライト・バッファ203に保存されているデータとリード・バッファ205に保存されているデータとを比較し、本来同じデータであるべきデータの不一致が検出された場合には、例えばリード・バッファ205に保存されている側のデータを更新、あるいは削除することによって両者を一致させている。
Further, the
ヒット検出部208は、プロセッサによって供給を要求されたデータのアドレスをタグメモリ206で管理されているアドレスと照合し、データメモリ207に対して供給を要求されたデータがあるか否か検出する。さらに、実施形態1では、供給を要求されたデータが検出された場合、ヒット検出部208が検出されたデータをマルチスレッドプロセッサ101に供給している。
The
次に、以上述べた構成の動作を、キャッシュメモリ109に対するリードとライトとについて説明する。
Next, the operation of the above-described configuration will be described for reading and writing with respect to the
(リード動作)
マルチスレッドプロセッサ101は、複数のプロセッサのうちの例えばプロセッサ0から読出し命令を出力する。読出し命令は、供給が要求されるデータの外部メモリ105におけるアドレス(読出しアドレス)と、読出しを指示する信号(読出し制御信号)とを含んでいる。アドレス制御部201は、リード・バッファ205のプロセッサ0に対応するバッファ205aに保存されているデータを検出する。
(Read operation)
The
そして、バッファ205aにデータが保存されている場合、保存されているデータに付されたタグアドレスと、読出しアドレスとを照合する。そして、読出しアドレスがリード・バッファ205のバッファ205aに保存されているデータのタグアドレスと一致した場合、バッファ205aに保存されているデータをプロセッサ0に出力し、読出し処理を完了させる。
When data is stored in the
読出しアドレスに対応するタグアドレスが付されたデータがリード・バッファ205に保存されていない場合、アドレス制御部201は、タグメモリ206にアクセスして読出しアドレスを照合する。なお、プロセッサは、読出しアドレスとして、外部メモリ105におけるアドレスを使用する。実施形態1では、アドレス制御部201が外部メモリ105におけるアドレスをデータメモリ207にアクセスする際のアドレスに変換する。
When the data with the tag address corresponding to the read address is not stored in the
タグメモリ206は、読出しの対象となるデータのデータメモリ207におけるアドレスとステータスとを対応付けて保存している。タグメモリ206における照合の結果、読出しアドレスによって指定されたデータがデータメモリ207にあった場合、タグメモリ206は、ヒット検出部208にデータのステータスを出力する。また、タグメモリ206における照合結果はデータメモリ207にも出力され、データメモリ207からヒット検出部208へプロセッサ0によって読出されるデータが出力される。ヒット検出部208は、データのステータスに基づいてデータが読出し可能である、つまりキャッシュヒットしたと判断した場合、ヒットしたデータをプロセッサ0へ出力する。
The
また、ヒット検出部208は、データの出力と同時に出力されたデータにかかる1エントリ分のデータをリード・バッファ205に転送する。このような処理により、次回のアクセス時に転送されたデータが読み出される場合、キャッシュ制御部103がタグメモリ206とデータメモリ207とにアクセスすることなくデータの読出しが可能になる。
一方、読出しアドレスに対応するデータがタグメモリにない、あるいはデータのステータスが無効である等の理由によってデータが読み出せない(キャッシュミスヒットした)場合、キャッシュ制御部103は、外部メモリ105からデータメモリに読み込むと共にリード・バッファ205に転送した後にプロセッサ0へ出力する。また、キャッシュヒットした場合と同様に1エントリ分のデータをリード・バッファ205に転送する。
The
On the other hand, if the data corresponding to the read address is not in the tag memory or the data cannot be read because the data status is invalid (cache miss hit), the
なお、以上述べた実施形態1では、リード・バッファ205が複数のプロセッサの各々に対応するバッファ205a〜205dを備えている。しかし、実施形態1は、このような構成に限定されるものでなく、プロセッサ0による読出し命令の読出しアドレスと一致するタグアドレスが付されたデータがバッファ205a以外のバッファに保存されていた場合にもバッファ205a以外のバッファに保存されているデータを読み出す機能を追加することもできる。
In the first embodiment described above, the
複数のプロセッサが動的にスレッドを切り換えて処理を実行するマルチスレッドプロセッサは、複数の異なるプロセッサによって同一のデータが繰り返し使用される可能性がある。このため、上記したように、読出し命令を出力したプロセッサがリード・バッファ205にあるバッファ205a〜205dのいずれにもアクセス可能とすれば、例えばプロセッサ0が他のプロセッサの処理時にリード・バッファ205に転送されたデータを読み出すことができる。
In a multi-thread processor in which a plurality of processors dynamically execute processing by switching threads, the same data may be repeatedly used by a plurality of different processors. For this reason, as described above, if the processor that has output the read command can access any of the
このような処理によれば、キャッシュ制御部103がタグメモリ206、データメモリ207にアクセスする回数が低減し、マルチスレッドプロセッサ101のデータ読出しに係る処理効率が向上する。
また、以上述べた実施形態1は、プロセッサ間でデータのコヒーレンシーを動作効率よく保つことができる。すなわち、例えばプロセッサごとにタグメモリやデータメモリを備える構成では、同じタグアドレスを持つデータが複数の異なるデータメモリに保存されることになる。そして、複数のデータメモリに存在するデータのうちの一部だけが更新される等の理由によってプロセッサ間におけるデータの不一致が発生する。
According to such processing, the number of times that the
Further, the first embodiment described above can maintain data coherency between processors with high operational efficiency. That is, for example, in a configuration including a tag memory and a data memory for each processor, data having the same tag address is stored in a plurality of different data memories. Then, data mismatch between processors occurs because only a part of data existing in a plurality of data memories is updated.
しかし、実施形態1によれば、外部メモリ105から読み出されたデータのデータメモリ207におけるアドレスをタグメモリ206が一括して管理するため、実質的に唯一のデータメモリによって読出されたデータを保存することになり、キャッシュメモリにおけるデータの不一致をなくすことができる。また、このために実施形態1は、バスを監視する必要がなく、バスを監視するための回路や消費電量が不要である。したがって、プロセッサ間でデータのコヒーレンシーを保つためにマルチプロセッサシステムの装置構成を大きくする、あるいは消費電力を高めることがない。
However, according to the first embodiment, since the
さらに、実施形態1のマルチスレッドプロセッサは、図2に示したように、1つのプロセッサが複数のスレッドを動的に切り替えて実行するマルチスレッドOSのように、データの不一致が生じやすい構成に適用した場合に特に有利である。
また、実施形態1は、ヒットしたデータの読出しと共に、このデータにかかる1エントリ分のデータをリード・バッファ205に転送しておく。このため、プロセッサがタグメモリ206やデータメモリ207にアクセスする回数を低減し、データの読出しにかかるマルチスレッドプロセッサの負荷を軽減することができる。
Furthermore, as shown in FIG. 2, the multi-thread processor according to the first embodiment is applied to a configuration in which data mismatch is likely to occur, such as a multi-thread OS in which a single processor dynamically switches and executes a plurality of threads This is particularly advantageous.
In the first embodiment, the data for one entry related to this data is transferred to the read
つまり、読出しの対象となるデータを保存するデータメモリは、一般にバッファに比べてアクセスタイムが遅く、プロセッサのパフォーマンス向上のボトルネックになりやすい。データメモリの前段にリード・バッファやライト・バッファを設けることによってメモリアクセスの遅延を見かけ上隠すことが可能になり、結果としてプロセッサの性能向上を図ることができる。 In other words, a data memory that stores data to be read generally has a slower access time than a buffer and is likely to become a bottleneck for improving the performance of the processor. By providing a read buffer and a write buffer in front of the data memory, it becomes possible to apparently hide the delay of memory access, and as a result, the performance of the processor can be improved.
(ライト動作)
次に、実施形態1のマルチスレッドプロセッサによるライト動作について説明する。なお、以下に述べるライト動作は、ライトバックを例にしているが、ライトスルーにも適用することができる。
マルチスレッドプロセッサ101は、複数のプロセッサのうちの例えばプロセッサ0からデータを書き込むよう指示する命令(書込み命令)を出力する。書込み命令は、書込みが要求されるデータの外部メモリ105におけるアドレス(書込みアドレス)と、書込みを指示する信号(書込み制御信号)とを含んでいる。また、書込み動作にあっては、書込み命令と共に書込まれるデータ(書込みデータ)もがプロセッサから送出される。
(Light operation)
Next, a write operation by the multithread processor of the first embodiment will be described. The write operation described below uses write back as an example, but can also be applied to write through.
The
書込みデータは、キャッシュメモリ109において、先ず、書込みアドレスと共にライト・バッファ203に保存される。ライト・バッファ203は、FIFOメモリ(First In First Out memory)でなり、書込まれたデータを書込みの順にデータメモリ207に書き込んでいる。
キャッシュ制御部103は、データをデータメモリ207に書き込むため、先ず、タグメモリ206のタグアドレスに書込みアドレスを照合すると共に、データのステータスを検出する。この結果、データメモリ207にデータの書込みが可能である、つまりキャッシュヒットしたと判断された場合、書込みデータをデータメモリ207に書込む。また、タグメモリに保存されているデータのステータスを示すフラグを「ダーティ」にする。
Write data is first stored in the
In order to write data to the
また、キャッシュ制御部103は、データメモリ207にデータの書込みが不可能である、つまりキャッシュミスヒットしたと判断した場合、外部メモリ105から書込みデータに該当するデータをデータメモリ207に読み出す。そして、ライト・バッファ203に書き込む、タグメモリ206を更新する。
実施形態1ではライト・バッファ203にFIFOメモリを採用したため、プロセッサによるライト・バッファ203への書込みが、ライト・バッファ203が一杯になるまで次々と行われる。また、ライト・バッファ203に書き込まれたデータは、タグメモリ206、データメモリ207に対するアクセス状況に応じ、他の処理と調停しながら空き時間を利用して書き込まれる。
In addition, when the
In the first embodiment, since the FIFO memory is employed for the
なお、バッファ管理部202は、上記のリード動作におけるリード・バッファ205への書込み、ライト動作におけるライト・バッファ203への書込みや読出しを調停する。また、ライト・バッファ203、リード・バッファ205間でデータ一致性(コヒーレンシー)を保障する。
ライト・バッファ203、リード・バッファ205間のデータ一致性は、ライト・バッファ203に書込まれたデータがデータメモリ207書き込まれる前、同一のデータであってリード・バッファ205にあるものにリードアクセスが生じたときに問題となる。このような場合、バッファ管理部202は、リード・バッファ205の内容をライトされたデータに更新する。あるいは、いったんリード・バッファ205のデータを無効にし、書き込みデータをライト・バッファ203からデータメモリ207に書込んだ後、書込まれたデータをリードすることも考えられる。
Note that the
The data consistency between the
なお、処理効率の観点からは、リード・バッファ205の内容をライトされたデータに更新することが望ましい。
また、このようなリード・バッファ205の更新にあたっては、プロセッサ0がリード・バッファ205の対応するリード・バッファ部分にアクセスした場合にも、他のプロセッサに対応するリード・バッファ205も更新対象にする必要がある。すなわち、同一のデータが複数のスレッドで使用されることも考えられるので、プロセッサ0による書込み
に対して、プロセッサ0以外のプロセッサによる読出しと書込みとのデータ一致性を保証する必要がある。
From the viewpoint of processing efficiency, it is desirable to update the contents of the read
In addition, when the
以上述べた実施形態1によれば、書込みデータが、タグメモリ206によってアドレスが一括して管理されるデータメモリ207に書き込まれるため実質的に唯一のデータメモリによって読出されたデータを保存することになり、キャッシュメモリにおけるデータの不一致をなくすことができる。また、このために実施形態1は、バスを監視する必要がなく、バスを監視するための回路や消費電量が不要である。したがって、プロセッサ間でデータのコヒーレンシーを保つためにマルチプロセッサシステムの装置構成を大きくする、あるいは消費電力を高めることがない。
According to the first embodiment described above, since the write data is written to the
図4は、以上述べた実施形態1のキャッシュメモリにおいて実行されるデータの読出しあるいは書込みの動作を説明するためのフローチャートである。また、図5は、図4と比較するため、従来のキャッシュメモリで実行されるデータの読出しの動作を説明するためのフローチャートである。
図4に示したように、実施形態1のキャッシュメモリは、複数のプロセッサのうちの1つ(プロセッサkとする)が、キャッシュメモリ109にアクセスを要求した場合、タグメモリ206においてキャッシュヒットを検出する処理を行う(S401)。この結果、キャッシュヒットが検出された場合(S402:Yes)、データメモリ207にアクセスし、読出しの対象となるデータを読み出す(S406)。また、タグメモリ206におけるデータのステータスを更新する(S407)。
FIG. 4 is a flowchart for explaining the data read or write operation executed in the cache memory of the first embodiment described above. FIG. 5 is a flowchart for explaining the data read operation executed in the conventional cache memory for comparison with FIG.
As shown in FIG. 4, the cache memory of the first embodiment detects a cache hit in the
また、キャッシュメモリ109は、ステップS402において、キャッシュミスヒットを検出した場合(S402:No)、データメモリ207に保存されているデータのうち入れ替えられるデータを決定する(S403)。そして、データメモリ207からダーティ・データを書き出し(S404)、外部メモリ105に保存されている新規なデータをデータメモリ207に読み出す(S405)。
When the
図5に処理を示した従来のキャッシュメモリは、k個のプロセッサの各々が独立したタグメモリ及びデータメモリを備える点で実施形態1のキャッシュメモリと相違する。このため、ステップS502の判断において、従来のキャッシュメモリは、アクセスを要求したプロセッサkに対応するデータメモリに対してアクセスし(S506)、プロセッサkに対応するタグメモリを更新する(S507)。 The conventional cache memory whose processing is shown in FIG. 5 is different from the cache memory of the first embodiment in that each of k processors includes an independent tag memory and data memory. Therefore, in the determination in step S502, the conventional cache memory accesses the data memory corresponding to the processor k that requested access (S506), and updates the tag memory corresponding to the processor k (S507).
さらに、プロセッサkのアクセスが書込みであるか否か判断し(S508)、書込であった場合には(S508:Yes)、プロセッサk以外のプロセッサに対応するデータメモリ及びタグメモリのデータをも更新し、データメモリ間におけるデータのコヒーレンシーを調整している。
また、以上述べた本実施形のキャッシュメモリは、以上述べた構成に限定されるものでなく、データの先読み機能を付加した構成とすることも可能である。図6は、実施形態1のキャッシュメモリを命令キャッシュにも適用し、先読みキャッシュとして構成したものである。
Further, it is determined whether or not the access of the processor k is writing (S508). If it is writing (S508: Yes), the data in the data memory and the tag memory corresponding to the processors other than the processor k are stored. Updates and adjusts data coherency between data memories.
The cache memory according to the present embodiment described above is not limited to the configuration described above, and may be configured with a data pre-read function. In FIG. 6, the cache memory of the first embodiment is also applied to an instruction cache and configured as a prefetch cache.
図6に示した構成は、プロセッサによって供給が要求されることが予想されるデータ(命令)をキャッシュしておく先読みデータ保存手段である先読みバッファをさらに備えている。キャッシュメモリと接続する複数のプロセッサは、各々独立に別のプログラムにアクセスするため、先読みバッファは、プロセッサの個数に対応した数必要になる。先読みキャッシュのアドレス制御部601は、先読みのためアドレスの連続性を検出するため、あるいはタグメモリおよびデータメモリをキャッシュのエントリ単位で行うためにエントリの境界をまたがる度に次のタグメモリのアドレスを生成する。
The configuration shown in FIG. 6 further includes a prefetch buffer that is a prefetch data storage unit that caches data (instructions) expected to be supplied by the processor. Since a plurality of processors connected to the cache memory independently access different programs, the number of prefetch buffers corresponding to the number of processors is required. The
なお、先読みバッファの機能は、従来はタグメモリおよびデータメモリに対するアクセス回数を低減して低消費電力化することを目的にしていた。しかし、先読みの機能をマルチスレッドプロセッサに適用する場合、図3に示したリード・バッファ205、ライト・バッファ203と同様に、メモリデータにクセス回数を低減してメモリアクセスのボトルネックを解消し、処理速度の向上を図ることができる。
The function of the prefetch buffer has heretofore been aimed at reducing power consumption by reducing the number of accesses to the tag memory and data memory. However, when applying the read-ahead function to a multi-thread processor, as with the read
(実施形態2)
次に、本発明の実施形態2について説明する。
実施形態2のキャッシュメモリは、実施形態1で説明した図3の構成を有している。このため、実施形態2では、キャッシュメモリの構成の図示及び説明の一部を省くものとする。実施形態2のキャッシュメモリは、データメモリ207、タグメモリ206少なくとも一方がマルチポートメモリである。データメモリ207をマルチポートメモリとする場合、このマルチポートメモリは、プロセッサの数にウェイの数を乗じた数のポートが必要になる。また、タグメモリ206をマルチポートメモリとする場合、このマルチポートメモリは、プロセッサの数のポートが必要になる。
(Embodiment 2)
Next,
The cache memory of the second embodiment has the configuration of FIG. 3 described in the first embodiment. For this reason, in the second embodiment, a part of the illustration and description of the configuration of the cache memory is omitted. In the cache memory according to the second embodiment, at least one of the
実施形態2のプロセッサは、実施形態2で説明したキャッシュメモリのデータ書出し(データをデータメモリ207から外部メモリ105に書き出す動作)に関する構成を説明するものである。
実施形態2では、読み込み及び書き出しの操作に対し、いわゆるLRU(Least Recently Used algorithm)方式を採用している。LRUとは、キャッシュされているデータのうち、プロセッサがアクセスした後最も長い時間が経過したものをキャッシュメモリから取り除く方法によりデータに対するプロセッサの供給要求の状態に基づいて決定している。このような方式によれば、常にプロセッサの要求頻度が多いデータをデータメモリ207にキャッシュしておくことができ、キャッシュメモリを採用した構成の処理効率を高めることができる。
The processor according to the second embodiment describes a configuration related to data writing (operation for writing data from the
In the second embodiment, a so-called LRU (Least Recently Used algorithm) system is adopted for reading and writing operations. LRU is determined based on the state of a processor supply request for data by removing from cache memory data that has passed the longest time after being accessed by the processor among the cached data. According to such a system, data frequently requested by the processor can always be cached in the
また、キャッシュメモリの方式には種々のものがあるが、実施形態2では、キャッシュメモリ109が、2ウェイ(ウェイA,B)のセット・アソシアティブ方式のキャッシュメモリであるものとする。なお、セット・アソシアティブ方式とは、キャッシュメモリを複数の領域(ウェイ)に分割し、それぞれのウェイに、メモリデバイス上の異なるアドレスのデータを格納しておくことにより、ヒット率を向上させることができる方式である。
There are various cache memory systems. In the second embodiment, the
実施形態2のキャッシュメモリは、タグメモリ206が、データメモリ207のアドレスを複数のウェイとして管理する。そして、データメモリ207に保存されているデータを前記データ保存手段にデータを保持する際の優先度である保存優先度を前記ウェイごとに付し、かつ、各ウェイに付される保存優先度を該ウェイで管理されているデータに対す
なお、実施形態2では、保存優先度を決定する基となるアクセスの状態を、現在に比較的近い所定の期間のアクセス回数とする。このような実施形態2によれば、
先ず、実施形態2のタグメモリ206及びデータメモリ207の構成を詳細に説明する。図7(a)、(b)、(c)は、タグメモリ206、データメモリ207に記憶されるデータの構造を説明するための図である。(a)は、タグメモリ206によって管理されるステータスのフラグを示している。
In the cache memory of the second embodiment, the
First, the configuration of the
フラグは、プロセッサ0〜3の各々ごとにタグメモリ206に保存されていて、実施形態2では、データのステータスをValid flag、Dirty flag、Used flagの3つのフラグによって示している。Valid flagは、データの有効性を示すフラグである。Dirty flagは、キャッシュされているデータが読み込んだ値から交信されている状態(ダーティデータ)であることを示し、Used flagは、書出しの優先度(書出し優先度)を示している。
なお、実施形態2では、各ウェイの書出し優先度をUsedフラグに基づいてテーブル(Usedテーブル)で管理する。Usedテーブルについては、図8に示して説明する。
The flags are stored in the
In the second embodiment, the writing priority of each way is managed in a table (Used table) based on the Used flag. The Used table will be described with reference to FIG.
図7(b)は、タグメモリ206のデータ構造を説明するための図である。また、図7(c)は、データメモリ207のデータ構造を説明するための図である。2ウェイのセット・アソシアティブ方式を採用した実施形態2では、プロセッサ0〜プロセッサ3の各々について2つのウェイを持っていて、タグメモリ206は、データメモリ207を合計8個のウェイ(W0〜U7)として管理している。
FIG. 7B is a diagram for explaining the data structure of the
タグメモリ206に保存されるデータ(タグ情報)は、データのヒット、ミスヒットを検出するためのデータであって、アクセスされるデータのアドレスの16ビット分が保存されている。また、タグ情報に基づいて読み出されるデータは、1ワードが32ビットのデータとしてデータメモリにキャッシュされている。
図8(a)、(b)は、実施形態2のLRUの処理を説明するための図であって、データの読出しの前後のUsedテーブルを示している。実施形態2では、Usedテーブルをタグメモリ206に保存し、キャッシュ制御部103によって更新するものとした。
Data (tag information) stored in the
FIGS. 8A and 8B are diagrams for explaining LRU processing according to the second embodiment, and show used tables before and after data reading. In the second embodiment, the Used table is stored in the
プロセッサ0〜3によって読み出されたデータは、データメモリ207のウェイU0〜U7のいずれかにおいてキャッシュされる。ウェイU0〜U7においてキャッシュ可能な数のデータがキャッシュされた後、さらに他のデータをキャッシュする必要がある場合、キャッシュ制御部103は、現在ウェイU0〜U7にキャッシュされているデータの1つを外部メモリ105に書き出す。そして、新たにキャッシュされた他のデータを書き出されたデータがキャッシュされていた領域に保存する。
Data read by the processors 0 to 3 is cached in any of the ways U0 to U7 of the
合計8つのウェイのキャッシュメモリを持つ実施形態2では、ウェイU0〜U7にキャッシュされているデータのいずれを書き出すかを、ウェイに対するプロセッサの供給要求の状態に基づいて決定している。そして、決定したウェイにあって最もアクセス回数が少なかったデータを書き出すものとする。
このような実施形態2において、アクセス回数の判断を短い時間に限定すれば、直前のデータアクセスの有無によってデータ書出しの対象となるウェイを決定することも可能である。
In the second embodiment having a total of eight ways of cache memory, which of the data cached in the ways U0 to U7 is to be written is determined based on the state of the processor supply request to the way. It is assumed that data having the smallest number of accesses in the determined way is written out.
In the second embodiment, if the determination of the number of accesses is limited to a short time, it is possible to determine the way to which data is to be written depending on the presence or absence of the previous data access.
書出し優先順位は、図8(a)、(b)の表中にLRU順位としてUsedテーブルに記録されている。実施形態2でいうLRU順位は、0〜7の数値によって表されていて、0は最高のLRU順位を示し、1は最低のLRU順位を示す。そして、LRU順位7が付されたウェイのデータは、次に起こるキャッシュミスヒット時に他のウェイのデータに優先して外部メモリ105に書き出される。
The writing priority order is recorded in the Used table as the LRU order in the tables of FIGS. The LRU ranking referred to in the second embodiment is represented by a numerical value of 0 to 7, where 0 indicates the highest LRU ranking and 1 indicates the lowest LRU ranking. The data of the way assigned with the
図8(a)は、プロセッサによって要求されたデータがデータメモリ207にミスヒットした場合のLRU順位の決定について説明するための図である。プロセッサが要求したデータがタグメモリ206に管理されるデータにないため、プロセッサは、外部メモリ105にアクセスしてデータを読み出し、データメモリ207にキャッシュする。この際、キャッシュ制御部103は、Usedテーブルを参照し、ウェイU0〜U7のLRU順位を参照する。
FIG. 8A is a diagram for explaining the determination of the LRU order when the data requested by the processor mis-hits in the
図8(a)の場合、ウェイU6のLRU順位が最低の7であるから、キャッシュ制御部103は、ウェイU6にキャッシュされていて、キャッシュされたウェイ6のLRU順位を0にし、他のウェイUのLRUデータに対するプロセッサの供給要求の状態に基づいて決定している。プロセッサがアクセスした後最も長い時間が経過したものをキャッシュメモリから取り除く方法によりデータを書き出す。そして、最新のデータが順位をそれぞれ1つずつ低下させる。
In the case of FIG. 8A, since the LRU rank of the way U6 is the lowest 7, the
また、図8(b)は、プロセッサが要求したデータがデータメモリ207で管理されているデータにヒットした場合のLRU順位の決定について説明するための図である。プロセッサが要求したデータがウェイU4のデータにヒットした場合、キャッシュ制御部103は、このデータを読み出してプロセッサに供給する。このとき、データの書出しは必要ないが、直前にヒットしたウェイU4のLRU順位を0に更新し、この更新に伴ってヒット前のウェイU4のLRU順位(4)より高位のLRU順位を更新する。
FIG. 8B is a diagram for explaining determination of the LRU order when the data requested by the processor hits data managed in the
図9は、以上述べた実施形態2のうち、キャッシュの制御を説明するためのフローチャートである。キャッシュ制御部103は、プロセッサからデータアクセスの要求を受け、タグメモリ206に要求されたデータがヒットするか否かを検出する(S701)。プロセッサに対応して管理されているデータにヒットしたか否か判断し(S702)、ヒットが検出された場合には(S702:Yes)、アクセスがデータの書出しを要求するものか否か判断する(S707)。データの書出しが要求された場合(S707:Yes)、データメモリのタグに対応するウェイ(Way(n))へデータを書き込む(S710)。
FIG. 9 is a flowchart for explaining cache control in the second embodiment described above. The
また、ステップS707において、アクセスがデータの書出しを目的とするものでないと判断された場合(S707:No)、Way(n)にキャッシュされているデータを読み出し、アクセスしたプロセッサに供給する(S708)。そして、キャッシュ制御部103は、LRUにしたがってこのデータのアクセス履歴等を示す情報をタグメモリ206において更新する(S709)。
If it is determined in step S707 that the access is not intended to write data (S707: No), the data cached in Way (n) is read and supplied to the accessed processor (S708). . Then, the
一方、ステップS702において、データがヒットしないと判断された場合(S702:No)、キャッシュ制御部103は、アクセス回数が最も少ないウェイ(Way(n))を検出し、さらにウェイ(Way(n))においてプロセッサがアクセスした後最も長い時間が経過したデータをLRUのアルゴリズムによって検出する(S703)。そして、検出されたデータがダーティデータであるか否か判断する(S704)。データがダーティデータである場合(S704:Yes)、このデータをデータメモリ207から書出し(S705)、書き出された領域に外部メモリ105からデータを読み出す(S706)。
On the other hand, if it is determined in step S702 that the data does not hit (S702: No), the
図10は、図9に示した処理のうち、UsedテーブルのLRU順位を変更するための処理を説明するためのフローチャートである。キャッシュ制御部103は、プロセッサによって要求されたデータをタグメモリ206に照会し、要求されたデータがいずれかのウェイにヒットしたか否か判断する(S801)。ヒットしたと判断された場合(S801:Yes)、ヒットしたウェイのLRU順位を0に更新する(S806)。
FIG. 10 is a flowchart for explaining processing for changing the LRU order of the Used table in the processing shown in FIG. The
次に、キャッシュ制御部103は、変数sを0に設定し(S807)、複数のプロセッサの各ウェイのLRU順位sを順次s+1に更新する(S808)。この更新は、更新後のLRU順位が、ヒットしたプロセッサのウェイのヒット直前のLRU順位に達するまで行われる(S809)。
一方、プロセッサkが要求したデータがキャッシュにヒットしないとき(S801:No)、キャッシュ制御部103は、LRU順位が最も低いウェイを検出する。そして、このウェイのLRU順位を0に更新する(S802)。なお、この際、外部メモリ105から読み出されたデータは、今回LRU順位が0に更新されたウェイにキャッシュされる。
Next, the
On the other hand, when the data requested by the processor k does not hit the cache (S801: No), the
そして、キャッシュ制御部103は、変数sを0に設定し(S808)、複数のプロセッサの各ウェイのLRU順位sを順次s+1に更新する(S809)。この更新は、全てのウェイについて行われる。
以上述べた実施形態2によれば、ウェイを複数備えたマルチプロセッサに適したLRU方式を実現し、キャッシュヒット率を高めることができる。また、データメモリやタグメモリをマルチポートメモリとしたことによって複数のプロセッサがキャッシュメモリに同時にアクセスすることができる。このため、実施形態2は、マルチプロセッサの処理能力を向上させることができる。
Then, the
According to the second embodiment described above, an LRU method suitable for a multiprocessor having a plurality of ways can be realized, and the cache hit rate can be increased. In addition, since the data memory and the tag memory are multi-port memories, a plurality of processors can simultaneously access the cache memory. For this reason,
なお、複数のプロセッサが同時にキャッシュメモリにアクセスした場合のLRU順位の更新は、例えば、プロセッサに対して予め優先順位を付しておき、この優先順位にしたがう順序で更新するようにすることも可能である。 It should be noted that the update of the LRU order when a plurality of processors simultaneously access the cache memory can be performed, for example, by assigning priorities to the processors in advance and updating them in the order according to the priorities. It is.
101 マルチスレッドプロセッサ、103 キャッシュ制御部、105 外部メモリ、107 キャッシュメモリ部、109 キャッシュメモリ、201 アドレス制御部、202 バッファ管理部、203 ライト・バッファ、205 リード・バッファ、206 タグメモリ、207 データメモリ、208 ヒット検出部
101 multi-thread processor, 103 cache control unit, 105 external memory, 107 cache memory unit, 109 cache memory, 201 address control unit, 202 buffer management unit, 203 write buffer, 205 read buffer, 206 tag memory, 207
Claims (7)
複数の前記プロセッサによってキャッシュされたデータが保存されるデータ保存手段と、
前記データ保存手段に記憶されているデータのアドレスを、前記データ保存手段が記憶しているデータ全体について一括して管理するアドレス管理手段と、
前記プロセッサによって供給を要求されたデータのアドレスを前記アドレス管理手段によって管理されているアドレスと照合し、供給を要求されたデータが前記データ保存手段から読出し可能であるか否か検出するヒット検出手段と、
前記ヒット検出手段によってデータが読出し可能であることが検出された場合、検出されたデータを前記プロセッサに供給するデータ供給手段と、
前記データ保存手段から読み出されたデータのみを、該データが前記プロセッサに出力されるまで一時的に保存するためのリード・バッファと、
前記プロセッサから送出されたデータのみを、該データが前記データ保存手段に書き込まれるまで一時的に保存するためのライト・バッファと、
前記リード・バッファに保存されているデータと前記ライト・バッファに保存されているデータとを比較し、前記リード・バッファに保存されているデータと前記ライト・バッファに保存されているデータとの間で本来同じデータであるべきデータの不一致が検出された場合、前記リード・バッファに保存されているデータを前記データ保存手段に書き込まれたデータに更新する、または、前記リード・バッファに保存されているデータをいったん無効にし、前記ライト・バッファからデータを前記データ保存手段に書き込んだ後、書き込まれたデータを読み出すことにより、前記リード・バッファに保存されているデータと前記ライト・バッファに保存されているデータとを一致させるキャッシュ制御部と、を含むことを特徴とするキャッシュメモリ。 A cache memory that caches at least a part of data read from a storage device by a plurality of processors and supplies at least a part of the cached data to the processor;
A data storage means cached data is stored by a plurality of said processors,
Address management means for collectively managing addresses of data stored in the data storage means for the entire data stored in the data storage means;
Hit detection means for comparing the address of the data requested to be supplied by the processor with the address managed by the address management means and detecting whether the data requested to be supplied is readable from the data storage means When,
Data supply means for supplying the detected data to the processor when the hit detection means detects that the data is readable;
A read buffer for temporarily storing only the data read from the data storage means until the data is output to the processor;
A write buffer for temporarily storing only data transmitted from the processor until the data is written to the data storage means;
The data stored in the read buffer is compared with the data stored in the write buffer, and the data stored in the read buffer and the data stored in the write buffer are compared. When a data mismatch that should be the same data is detected, the data stored in the read buffer is updated to the data written in the data storage means, or stored in the read buffer. The data stored in the read buffer and the write buffer are saved by invalidating the data once written and writing the data from the write buffer to the data storage means and then reading the written data. And a cache control unit that matches the received data. Yumemori.
前記キャッシュメモリは、
複数の前記プロセッサによってキャッシュされたデータが保存されるデータ保存手段と、
前記データ保存手段に記憶されているデータのアドレスを、前記データ保存手段が記憶しているデータ全体について一括して管理するアドレス管理手段と、
前記プロセッサによって供給を要求されたデータのアドレスを前記アドレス管理手段によって管理されているアドレスと照合し、供給を要求されたデータが前記データ保存手段から読出し可能であるか否か検出するヒット検出手段と、
前記ヒット検出手段によってデータが読出し可能であることが検出された場合、検出されたデータを前記プロセッサに供給するデータ供給手段と、
前記データ保存手段から読み出されたデータのみを、該データが前記プロセッサに出力されるまで一時的に保存するためのリード・バッファと、
前記プロセッサから送出されたデータのみを、該データが前記データ保存手段に書き込まれるまで一時的に保存するためのライト・バッファと、
前記リード・バッファに保存されているデータと前記ライト・バッファに保存されているデータとを比較し、前記リード・バッファに保存されているデータと前記ライト・バッファに保存されているデータとの間で本来同じデータであるべきデータの不一致が検出された場合、前記リード・バッファに保存されているデータを前記データ保存手段に書き込まれたデータに更新する、または、前記リード・バッファに保存されているデータをいったん無効にし、前記ライト・バッファからデータを前記データ保存手段に書き込んだ後、書き込まれたデータを読み出すことにより、前記リード・バッファに保存されているデータと前記ライト・バッファに保存されているデータとを一致させるキャッシュ制御部と、
を備えることを特徴とするプロセッサ。 A processor comprising a cache memory that caches at least part of data read from a storage device by a plurality of processors and supplies at least part of the cached data to the processor,
The cache memory is
A data storage means cached data is stored by a plurality of said processors,
Address management means for collectively managing addresses of data stored in the data storage means for the entire data stored in the data storage means;
Hit detection means for comparing the address of the data requested to be supplied by the processor with the address managed by the address management means and detecting whether the data requested to be supplied is readable from the data storage means When,
Data supply means for supplying the detected data to the processor when the hit detection means detects that the data is readable;
A read buffer for temporarily storing only the data read from the data storage means until the data is output to the processor;
A write buffer for temporarily storing only data transmitted from the processor until the data is written to the data storage means;
The data stored in the read buffer is compared with the data stored in the write buffer, and the data stored in the read buffer and the data stored in the write buffer are compared. When a data mismatch that should be the same data is detected, the data stored in the read buffer is updated to the data written in the data storage means, or stored in the read buffer. The data stored in the read buffer and the write buffer are saved by invalidating the data once written and writing the data from the write buffer to the data storage means and then reading the written data. A cache control unit that matches the stored data;
A processor comprising:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2005366569A JP4904802B2 (en) | 2005-02-01 | 2005-12-20 | Cache memory and processor |
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2005024976 | 2005-02-01 | ||
JP2005024976 | 2005-02-01 | ||
JP2005366569A JP4904802B2 (en) | 2005-02-01 | 2005-12-20 | Cache memory and processor |
Publications (3)
Publication Number | Publication Date |
---|---|
JP2006244460A JP2006244460A (en) | 2006-09-14 |
JP2006244460A5 JP2006244460A5 (en) | 2009-01-15 |
JP4904802B2 true JP4904802B2 (en) | 2012-03-28 |
Family
ID=37050782
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2005366569A Expired - Fee Related JP4904802B2 (en) | 2005-02-01 | 2005-12-20 | Cache memory and processor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4904802B2 (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW201015321A (en) * | 2008-09-25 | 2010-04-16 | Panasonic Corp | Buffer memory device, memory system and data trnsfer method |
JP5417879B2 (en) | 2009-02-17 | 2014-02-19 | 富士通セミコンダクター株式会社 | Cache device |
GB2499765B (en) | 2010-12-09 | 2014-02-19 | Ibm | Multicore system and method of reading the core data |
WO2019043710A1 (en) * | 2017-08-31 | 2019-03-07 | Rail Vision Ltd | System and method for high throughput in multiple computations |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH02224041A (en) * | 1988-11-17 | 1990-09-06 | Nec Ic Microcomput Syst Ltd | Cache memory control circuit |
JPH02204834A (en) * | 1989-02-03 | 1990-08-14 | Nec Corp | Operand replacing system |
JP3609656B2 (en) * | 1999-07-30 | 2005-01-12 | 株式会社日立製作所 | Computer system |
US6901450B1 (en) * | 2000-09-22 | 2005-05-31 | Hitachi, Ltd. | Multiprocessor machine and cache control method for providing higher priority to shared cache that is accessed by multiprocessors |
-
2005
- 2005-12-20 JP JP2005366569A patent/JP4904802B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2006244460A (en) | 2006-09-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5359723A (en) | Cache memory hierarchy having a large write through first level that allocates for CPU read misses only and a small write back second level that allocates for CPU write misses only | |
EP1388065B1 (en) | Method and system for speculatively invalidating lines in a cache | |
US6834327B2 (en) | Multilevel cache system having unified cache tag memory | |
US6957304B2 (en) | Runahead allocation protection (RAP) | |
US7925840B2 (en) | Data processing apparatus and method for managing snoop operations | |
US6272602B1 (en) | Multiprocessing system employing pending tags to maintain cache coherence | |
JP3348367B2 (en) | Multiple access method and multiple access cache memory device | |
EP1902370B1 (en) | Method and apparatus for managing cache memory accesses | |
US20110173393A1 (en) | Cache memory, memory system, and control method therefor | |
US20090327616A1 (en) | Snoop filtering mechanism | |
US8700863B2 (en) | Computer system having a cache memory and control method of the same | |
US20110173400A1 (en) | Buffer memory device, memory system, and data transfer method | |
US20070239940A1 (en) | Adaptive prefetching | |
JP4803983B2 (en) | Arithmetic processing unit | |
JP2008117388A (en) | Cache and cache bypass function method | |
CN113853590A (en) | Pseudo-random way selection | |
GB2468007A (en) | Data processing apparatus and method dependent on streaming preload instruction. | |
US8332592B2 (en) | Graphics processor with snoop filter | |
US11036639B2 (en) | Cache apparatus and method that facilitates a reduction in energy consumption through use of first and second data arrays | |
US20110167223A1 (en) | Buffer memory device, memory system, and data reading method | |
US8473686B2 (en) | Computer cache system with stratified replacement | |
JP5157424B2 (en) | Cache memory system and cache memory control method | |
US6446168B1 (en) | Method and apparatus for dynamically switching a cache between direct-mapped and 4-way set associativity | |
US6477622B1 (en) | Simplified writeback handling | |
JP4904802B2 (en) | Cache memory and processor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20081120 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20081120 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20110809 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20111007 |
|
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: 20111213 |
|
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: 20111226 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20150120 Year of fee payment: 3 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |