JP2004038601A - Cache memory device - Google Patents

Cache memory device Download PDF

Info

Publication number
JP2004038601A
JP2004038601A JP2002195324A JP2002195324A JP2004038601A JP 2004038601 A JP2004038601 A JP 2004038601A JP 2002195324 A JP2002195324 A JP 2002195324A JP 2002195324 A JP2002195324 A JP 2002195324A JP 2004038601 A JP2004038601 A JP 2004038601A
Authority
JP
Japan
Prior art keywords
cache
holding unit
data
address
instruction data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2002195324A
Other languages
Japanese (ja)
Inventor
Satoshi Ogura
小椋 里
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP2002195324A priority Critical patent/JP2004038601A/en
Publication of JP2004038601A publication Critical patent/JP2004038601A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Advance Control (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To enable the efficient use of a cache memory by suppressing the capacity consumption of the cache memory without increasing the hardware quantity even in the presence of a repeated command generated by loop unrolling. <P>SOLUTION: When the same command data are present in a cache data holding part 22 in the execution of a repeated command string generated by loop unrolling, a pointer corresponding to the command data is stored in a reuse information retention part 24 to prevent the consumption of the entry of the cache data holding part 22. Therefore, even if the repeated command generated by loop unrolling or the like is present, the capacity consumption of the cache memory can be suppressed without increasing the hardware quantity to efficiently use the cache memory. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は、コンピュータシステムにおいて、メモリアクセス性能を向上させるキャッシュメモリ装置に関し、特にループ展開等による繰返し命令を処理する場合に容量を有効に用いるキャッシュメモリ装置に関する。
【0002】
【従来の技術】
近年半導体技術の向上によってプロセッサの性能は著しく向上している。
しかしながら、中央処理装置の性能向上に対して、中央処理装置が実行する命令を記憶するメモリの性能向上は比較的緩やかであるため、中央処理装置の命令待ちが発生し、プロセッサの性能がメモリによって律速されるという問題が発生している。
【0003】
これに対処するため、高性能なプロセッサでは主記憶装置と中央処理装置の間にキャッシュシステムを設け、中央処理装置がアクセスした命令をキャッシュメモリ装置が保持することによって、2度目以降のアクセスを高速化し、主記憶装置の実質的なアクセス速度を高速化している。
【0004】
以下、図21,図22,図23,図24,図25を用いて従来のキャッシュメモリ装置について説明する。
図21は従来のキャッシュメモリ装置の構成を示すブロック図であり、図22は従来のキャッシュメモリ装置の動作フローを示すフローチャートである。図23は展開前のC言語によるプログラムを表す図,図24は展開後のプログラムを表す図,図25は従来の技術において展開したプログラムがキャッシュデータ保持部に格納された様子を例示する図である。
【0005】
図21において、プロセッサの構成要素であり命令を実行する中央処理装置1と、中央処理装置1が実行する命令を格納する主記憶装置3も同時に示している。
【0006】
中央処理装置1は、キャッシュメモリ装置7を介して主記憶装置3から読み出された命令を順次実行するように構成されている。
キャッシュメモリ装置7は、キャッシュメモリ装置全体の制御を行うキャッシュ制御部71と、キャッシュ制御部71の制御に従って主記憶装置3上の命令データを16バイト単位で最大4エントリ記憶するキャッシュデータ保持部72から構成されている。
【0007】
図22において、この制御フローは、中央処理装置1によるフェッチ要求信号S11が出力された際に開始される。
次に、キャッシュデータ保持部72を制御し、フェッチアドレスA11に対応する命令データがキャッシュデータ保持部72に存在するか否かを判定する(S415)。
【0008】
次に、命令データが存在する場合、キャッシュデータ保持部72を制御し、キャッシュデータ保持部72が保持するフェッチアドレスA11に対応する命令データを中央処理装置1に出力する(S416)。
【0009】
命令データが存在しない場合は、アクセス要求信号S71および、アクセスアドレスA71を制御し、主記憶装置3から、16バイト単位で命令データを読み出す(S417)。
【0010】
次に、キャッシュデータ保持部72を制御し、フェッチアドレスA11と、リードデータD31をキャッシュデータ保持部72に登録してS416に進める(S418)。
【0011】
上記のように、中央処理装置のフェッチ要求に対して、キャッシュデータ保持部72が読み出された命令データを記憶することにより、同一アドレスに対する次からのフェッチ要求に対しては、キャッシュデータ保持部72が直接データを提供することが可能になり、主記憶装置へのアクセスが不要になるため、中央処理装置に対する主記憶装置の見かけ上のアクセス速度を向上することが可能になる。
【0012】
しかしながら、従来の構成のキャッシュメモリ装置では、ループ展開等によって生成される繰返し命令の実行時に効率が低下するという課題があった。以下にこの状態を説明する。
【0013】
ループ展開はプログラムのループ内で実行される命令列を複数回並べることによって、ループ終了の条件判定を行う命令や、ループ繰返しのための分岐命令の実行回数を減らす手法である。
【0014】
例えば、図23のC言語のプログラムに対して、ループ展開を実施した場合、図24のような繰り返し命令を含む命令データが生成される。
この命令データを従来の構成のキャッシュメモリ装置を備えるプロセッサで実行した場合、中央処理装置1が命令データ831、命令データ832、命令データ833、命令データ834を実行していくのに従って、キャッシュデータ保持部72の各エントリに命令データ831、命令データ832、命令データ833、命令データ834の各命令データが記憶されていく。
【0015】
その後、中央処理装置1が後続する命令データ835を実行する場合、キャッシュデータ保持部には空きのエントリがないため、すでに命令データが格納されているエントリを置き換えて新たな命令データを記憶する必要がある。
【0016】
この結果、中央処理装置が図23の命令データを実行した後には、キャッシュデータ保持部に格納されているデータは図25のようになり、中央処理装置が再度命令データ831を実行しようとした場合、命令データ831はすでにキャッシュデータ保持部に存在しないため、再度主記憶装置から読み出してくる必要がある。
【0017】
このように、従来のキャッシュメモリ装置を搭載したプロセッサでは、ループ展開などによって生成された繰返しの命令列を実行した場合、キャッシュメモリの容量が不足するようになり、キャッシュメモリ装置が効率的に動作しないという問題点があった。
【0018】
【発明が解決しようとする課題】
この問題点を解決する手法の一つとして、キャッシュデータ保持部のエントリ数を増加させるという方法があるが、この場合、キャッシュデータを記憶するメモリの量が増大し、キャッシュメモリ装置のハードウェア量が増大するという別の問題点が発生するようになる。
【0019】
上記課題に鑑み本発明のキャッシュメモリ装置は、ループ展開によって生成される繰返し命令等が存在する場合においても、ハードウェア量を増加することなく、キャッシュメモリの容量消費を抑制し、キャッシュメモリの効率的な使用を可能とすることを目的とする。
【0020】
【課題を解決するための手段】
上記目的を達成するために本発明の請求項1記載のキャッシュメモリ装置は、主記憶装置の命令データのうち過去に使用した命令データを記憶して効率的に命令フェッチするキャッシュシステムを設けたキャッシュメモリ装置であって、中央処理装置の要求するアドレスに対応した命令データを主記憶装置から読み出してそのアドレスと命令データとを記憶するキャッシュデータ保持部と、前記中央処理装置の要求するアドレスに対応した前記キャッシュデータ保持部の命令データを指示するポインタと前記アドレスを記憶する再利用情報保持部と、前記主記憶装置から読み出した命令データと同一の命令データが前記キャッシュデータ保持部に存在しているか否かを判断する再利用判定部と、前記中央処理装置の要求するアドレスが前記キャッシュデータ保持部または前記再利用情報保持部に記憶されている場合には対応する命令データを前記中央処理装置に供給するキャッシュ制御部とを有し、前記中央処理装置の要求するアドレスが前記キャッシュデータ保持部に存在する場合は前記キャッシュデータ保持部に記憶された前記中央処理装置の要求するアドレスに対応する命令データを前記中央処理装置に出力し、前記中央処理装置の要求するアドレスが前記キャッシュデータ保持部に存在せず前記再利用情報保持部に存在する場合は前記キャッシュデータ保持部に記憶された前記中央処理装置の要求するアドレスに対応するポインタによって指示された命令データを前記中央処理装置に出力し、前記中央処理装置の要求するアドレスが前記キャッシュデータ保持部にも前記再利用情報保持部にも存在しない場合は前記主記憶装置から前記中央処理装置の要求するアドレスに対応する命令データを読み出して前記中央処理装置に出力すると共に前記主記憶装置から読み出した命令データと同一の命令データが前記キャッシュデータ保持部に存在しないと判断した場合は前記キャッシュデータ保持部に前記主記憶装置から読み出した命令データおよび対応するアドレスを記憶し前記中央処理装置の要求するアドレスと異なるアドレスであっても前記主記憶装置から読み出した命令データと同一の命令データが前記キャッシュデータ保持部に存在すると判断した場合は前記主記憶装置から読み出したデータを前記キャッシュデータ保持部には記憶せずに前記アドレスと前記同一の命令データを指示するポインタを前記再利用情報保持部に記憶することを特徴とする。
【0021】
請求項2記載のキャッシュメモリ装置は、請求項1記載のキャッシュメモリ装置において、前記キャッシュデータ保持部は前記主記憶装置に格納された命令データを所定のサイズのキャッシュライン単位で記憶し、前記再利用情報保持部へ記憶するポインタとして前記キャッシュラインを指示するポインタを記憶し、前記再利用判定部での命令データの比較を前記キャッシュライン単位で行うことを特徴とする。
【0022】
請求項3記載のキャッシュメモリ装置は、請求項1または請求項2記載のキャッシュメモリ装置において、直前のキャッシュミスの際に前記主記憶装置から読み出した前記中央処理装置の要求するアドレスに対応した命令データを記憶するリードデータ保持部を有し、前記中央処理装置の要求するアドレスが前記キャッシュデータ保持部にも前記再利用情報保持部にも存在しない場合は、前記主記憶装置から前記中央処理装置の要求するアドレスに対応する命令データを読み出して前記主記憶装置に出力すると共に、前記主記憶装置から読み出した命令データと前記リードデータ保持部の命令データを比較し、一致しない場合は前記キャッシュデータ保持部に前記主記憶装置から読み出した命令データとそのアドレスを記憶し、一致した場合は前記中央処理装置の要求するアドレスと異なるアドレスであっても前記主記憶装置から読み出したデータを前記キャッシュデータ保持部には記憶せずに前記アドレスと前記同一の命令データを指示するポインタを前記再利用情報保持部に記憶することを特徴とする。
【0023】
請求項4記載のキャッシュメモリ装置は、請求項1または請求項2記載のキャッシュメモリ装置において、直前のキャッシュヒットの際に前記キャッシュデータ保持部から出力した前記中央処理装置の要求するアドレスに対応した命令データを記憶するフェッチライン保持部を有し、前記中央処理装置の要求するアドレスが前記キャッシュデータ保持部にも前記再利用情報保持部にも存在しない場合は、前記主記憶装置から前記中央処理装置の要求するアドレスに対応する命令データを読み出して前記主記憶装置に出力すると共に、前記主記憶装置から読み出した命令データと前記フェッチライン保持部の命令データを比較し、一致しない場合は前記キャッシュデータ保持部に前記主記憶装置から読み出した命令データとそのアドレスを記憶し、一致した場合は前記中央処理装置の要求するアドレスと異なるアドレスであっても前記主記憶装置から読み出したデータを前記キャッシュデータ保持部には記憶せずに前記アドレスと前記同一の命令データを指示するポインタを前記再利用情報保持部に記憶することを特徴とする。
【0024】
以上の構成により、ループ展開によって生成される繰返し命令等が存在する場合においても、ハードウェア量を増加することなく、キャッシュメモリの容量消費を抑制し、キャッシュメモリの効率的な使用を可能とすることができる。
【0025】
【発明の実施の形態】
本発明の実施の形態について図面を用いて詳細に説明する。
(実施の形態1)
以下、本発明の実施の形態1について図1,図2,図3,図4,図5,図6を用いて説明する。
【0026】
図1は本発明の実施の形態1におけるキャッシュメモリ装置の構成を示すブロック図であり、図2は本発明の実施の形態1におけるキャッシュメモリ装置の動作フローを示すフローチャートである。図3は実施の形態1における展開前のC言語によるプログラムを表す図,図4は実施の形態1における展開後のプログラムを表す図である。図5,図6,図7,図8は実施の形態1において展開したプログラムがキャッシュデータ保持部および再利用情報保持部に格納された様子を例示する図であり、プログラムを徐々に展開していく様子を示している。
【0027】
図1において、プロセッサの構成要素であり命令を実行する中央処理装置1と、中央処理装置1が実行する命令を格納する主記憶装置3も同時に示している。中央処理装置1は、キャッシュメモリ装置2を介して主記憶装置3から読み出された命令を順次実行するように構成されている。
【0028】
キャッシュメモリ装置2は、キャッシュメモリ装置全体の制御を行うキャッシュ制御部21と、キャッシュ制御部21の制御に従って中央処理装置1の要求するアドレスに対応する主記憶装置3上の命令データを16バイト単位で最大4エントリ記憶するキャッシュデータ保持部22と、主記憶装置3から読み込まれたリードデータD31と同一の命令データがキャッシュデータ保持部22に存在するか否かを判定する再利用判定部23と、キャッシュ制御部21の制御に従って中央処理装置1の要求するアドレスに対応するポインタを最大4エントリ記憶する再利用情報保持部24から構成されている。
【0029】
図2において、この制御フローは、まず、中央処理装置1によるフェッチ要求信号S11が出力された際に開始される。
次に、中央処理装置1の要求するフェッチアドレスA11と一致するアドレスがキャッシュデータ保持部22に存在するか否かを判定して、要求する命令データが存在するか否かを判定する(S411)。
【0030】
要求する命令データが存在しない場合、再利用情報保持部24を制御し、フェッチアドレスA11に対応するポインタが再利用情報保持部24に存在するか否かを判定する(402)。
【0031】
ポインタが存在しない場合、アクセス要求信号S21および、アクセスアドレスA21を制御信号とし、主記憶装置3から16バイト単位で命令データを読み出し(403)、ポインタが存在する場合、再利用情報保持部24が保持するフェッチアドレスA11に対応するポインタによって指示されるキャッシュデータ保持部22に登録された命令データを中央処理装置1に出力する(S408)。
【0032】
次に、主記憶装置3から読み出されたリードデータD31と同一の命令データがキャッシュデータ保持部22に存在するか否かを再利用判定部23にて判定する(S404)。
【0033】
同一の命令データがキャッシュデータ保持部22に存在する場合、リードデータD31と同一の命令データを保持するキャッシュラインのポインタとフェッチアドレスA11を再利用情報保持部24に登録する(S405)。
【0034】
S404において、リードデータD31と同一の命令データがキャッシュデータ保持部22に存在しない場合、フェッチアドレスA11と、リードデータD31をキャッシュデータ保持部22に登録し(S406)、その命令データを中央処理装置1に出力する(S407)。
【0035】
また、S401にてキャッシュデータ保持部22にフェッチアドレスA11に対応する命令データが保持されている場合、キャッシュデータ保持部22が記憶するフェッチアドレスA11に対応する命令データを中央処理装置1に出力する(S407)。
【0036】
S402にて再利用情報保持部24にフェッチアドレスA11に対応するポインタが保持されている場合、再利用情報保持部24が保持するフェッチアドレスA11に対応するポインタによって指示されるキャッシュデータ保持部22登録された命令データを中央処理装置1に出力する(S408)。
【0037】
上記のように構成されたキャッシュメモリ装置2について、図3に示したC言語プログラムを実行した場合の動作を説明する。
図4に示したアセンブラプログラムは、図3に示したC言語プログラムにループ展開を伴うコンパイルを実施した結果の一例である。なお、この例ではプロセッサの命令は4バイトの固定長としている。
【0038】
以下に、図1のキャッシュメモリ装置における図4のアセンブラプログラムを実行した場合の動作について説明する。
なお、初期状態ではキャッシュデータ保持部22はいかなる命令データも保持せず、再利用情報保持部24はいかなるポインタも保持していないとする。
【0039】
まず、中央処理装置1は、フェッチ要求信号S11、フェッチアドレスA11を制御信号として0x0000番地の命令データの供給をキャッシュメモリ装置2に要求する。
【0040】
この要求を受け、キャッシュ制御部21は、キャッシュデータ保持部22に0x0000番地の命令データが存在するか否かを判定する(図2のS401)。その結果、キャッシュデータ保持部22は初期状態では0x0000番地に対応する命令データを保持していないため、キャッシュ制御部21は再利用情報保持部24に0x0000番地に対応するポインタが登録されているか否かを判定する(図2のS402)。
【0041】
その結果、再利用情報保持部24は初期状態では0x0000番地に対応するポインタを保持していないため、キャッシュ制御部21はアクセス要求信号S21および、アクセスアドレスA21を制御信号とし、主記憶装置3から0x0000番地を先頭とする16バイトの命令データ811を読み出す(図2のS403)。
【0042】
次に、キャッシュ制御部21は、主記憶装置3から読み出された16バイトの命令データ811と同一の命令データがキャッシュデータ保持部22に存在するか否かを判定する(図2のS404)。
【0043】
その結果、キャッシュデータ保持部22は初期状態では、上記の命令データを保持していないため、キャッシュ制御部21は、フェッチアドレス0x0000と主記憶装置3から読み出されたアドレス0x0000から始まる命令データ811をキャッシュデータ保持部22に登録する(図2のS406)。
【0044】
次に、キャッシュ制御部21は、キャッシュデータ保持部22が記憶する0x0000番地の命令データを中央処理装置1に出力させる(図2のS407)。以上の動作によって、中央処理装置1は要求した0x0000番地の命令データを得て、命令の実行を開始する。
【0045】
また、上記の動作によって、キャッシュデータ保持部22および再利用情報保持部24がそれぞれ記憶する情報は図5のように、キャッシュデータ保持部22には0x0000に対応する命令データ811を記憶し、再利用情報保持部24には何も記憶されていない状態になる。
【0046】
次に、中央処理装置1は後続する命令を実行するためにフェッチ要求信号S11、フェッチアドレスA11を制御信号として0x0004番地の命令データの供給をキャッシュメモリ装置2に要求する。
【0047】
この要求を受け、キャッシュ制御部21は、キャッシュデータ保持部22に0x0004番地の命令データが存在するか否かを判定する(図2のS401)。その結果、キャッシュデータ保持部22は0x0004番地に対応する命令データを保持しているため、キャッシュデータ保持部22が記憶する0x0004番地の命令データを中央処理装置1に出力させる(図2のS407)。
【0048】
以上の動作によって、中央処理装置1は要求した0x0004番地の命令データを得て命令の実行を開始することができる。
以降、0x0008番地、0x000Cの番地の命令データについてもキャッシュデータ保持部22が該当するアドレスに対応する命令データを保持しているため、図2のフローチャートのS407の動作によってキャッシュデータ保持部22が記憶する命令データが中央処理装置1に出力される。
【0049】
次に、0x0010番地、0x0014番地、0x0018番地、0x001C番地の命令データについては、先述の0x0000番地、0x0004番地、0x0008番地、0x000C番地と同様の制御によって、0x0010番地から始まる16バイトの命令データ812がキャッシュデータ保持部に格納された後に、キャッシュメモリ装置2が中央処理装置1に命令データを出力し、その結果、キャッシュデータ保持部22および再利用情報保持部24がそれぞれ記憶する情報は図6のように命令データ812の命令データが加えられる。
【0050】
次に、中央処理装置1は後続する命令を実行するためフェッチ要求信号S11、フェッチアドレスA11を制御信号として0x0020番地の命令データをキャッシュメモリ装置2に要求する。
【0051】
キャッシュデータ保持部22および再利用情報保持部24は該当するアドレスを保持していないため、キャッシュ制御部21はアクセス要求信号S21および、アクセスアドレスA21を制御信号とし、主記憶装置3から0x0020番地を先頭とする16バイトの命令データ813を読み出す(図2のS403)。
【0052】
次に、キャッシュ制御部21は、主記憶装置3から読み出された16バイトの命令データ813と同一の命令データがキャッシュデータ保持部22に存在するか否かを判定する(図2のS404)。
【0053】
その結果、キャッシュデータ保持部22は上記命令データと同一の命令データを保持しているため(図6のキャッシュデータ保持部のエントリ”1”)、キャッシュ制御部21は再利用情報保持部24にフェッチアドレス0x0020と上記命令データを保持しているキャッシュデータ保持部22のエントリ”1”を登録する(図2のS405)。
【0054】
次に、キャッシュ制御部21は、再利用情報保持部24が記憶するフェッチアドレス0x0020に対応するエントリ”1”についてキャッシュデータ保持部22が記憶する命令データとして0x0010番地に対応する命令データを中央処理装置1に出力する(図2のS408)。
【0055】
以上の動作によって中央処理装置1は要求した0x0020番地の命令データを得て命令の実行を開始することができる。
また、上記の動作によって、キャッシュデータ保持部22および再利用情報保持部24がそれぞれ記憶する情報は図7のように変化する。
【0056】
次に、中央処理装置1は後続する命令を実行するためフェッチ要求信号S11、フェッチアドレスA11を制御信号として0x0024番地の命令データをキャッシュメモリ装置2に要求する。
【0057】
この要求を受け、キャッシュ制御部21は、キャッシュデータ保持部22に0x0024番地の命令データが存在するか否かを判定する(図2のS401)。その結果、キャッシュデータ保持部22は0x0024番地に対応する命令データを保持していないため、キャッシュ制御部21は、再利用情報保持部24に0x0024番地の命令データに対応するポインタが登録されているか否かを判定する(図2のS402)。
【0058】
その結果、再利用情報保持部24は0x0024番地の命令データに対応するポインタを保持しているため、キャッシュ制御部21は、再利用情報保持部24が記憶するフェッチアドレス0x0024に対応するエントリ”1”についてキャッシュデータ保持部22が記憶する命令データとして実際には0x0014番地に対応する命令データを中央処理装置1に出力する(図2のS408)。
【0059】
以上の動作によって、中央処理装置1は要求した0x0024番地の命令データを得て命令の実行を開始することができる。
以降、0x0028番地、0x002Cの番地の命令データについても再利用情報保持部24が該当するポインタに対応する命令データを保持しているため、図2のフローチャートのS408の動作によって再利用情報保持部24が保持する該当アドレスに対応するエントリ”1”についてキャッシュデータ保持部22が記憶する命令データを中央処理装置1に出力する。
【0060】
次に、0x0030番地から0x005C番地までの命令データについても、先述の0x0020番地から0x002C番地までと同様の制御によって、キャッシュメモリ装置が中央処理装置1に命令データを出力し、その結果キャッシュデータ保持部22および再利用情報保持部24がそれぞれ記憶する情報は図8のように変化する。
【0061】
以上のように、本実施の形態1によるキャッシュメモリ装置では、ループ展開によって生成された繰返し命令列を実行した際にも、同一命令データがキャッシュデータ保持部に存在する場合は、再利用情報保持部にその命令データに対応するポインタを格納して、キャッシュデータ保持部のエントリを消費しないため、ループ展開によって生成される繰返し命令等が存在する場合においても、ハードウェア量を増加することなく、キャッシュメモリの容量消費を抑制し、キャッシュメモリの効率的な使用を可能とすることができる。
(実施の形態2)
次に、本発明の実施の形態2におけるキャッシュメモリ装置について、図3,図4,図9,図10,図11,図12,図13,図14を用いて説明する。
【0062】
図9は本発明の実施の形態2におけるキャッシュメモリ装置の構成を示すブロック図であり、図10は本発明の実施の形態2におけるキャッシュメモリ装置の動作フローを示すフローチャートである。図11,図12,図13,図14は実施の形態2において展開したプログラムがキャッシュデータ保持部および再利用情報保持部に格納された様子を例示する図であり、プログラムを徐々に展開していく様子を示している。
【0063】
なお、図9には、プロセッサの構成要素であり命令を実行する中央処理装置1と、中央処理装置1が実行する命令を格納する主記憶装置3も同時に示している。
【0064】
中央処理装置1は、キャッシュメモリ装置5を介して主記憶装置3から読み出された命令を順次実行するように構成されている。
キャッシュメモリ装置5は、キャッシュメモリ装置全体の制御を行うキャッシュ制御部51と、キャッシュ制御部51の制御に従って中央処理装置1の要求するアドレスに対応する主記憶装置3上の命令データを16バイト単位で最大4エントリ記憶するキャッシュデータ保持部22と、キャッシュ制御部51の制御に従って直前にキャッシュミスした時に読み出したリードデータD31を記憶するリードデータ保持部531と、主記憶装置から読み込まれたリードデータD31と、リードデータ保持部531に格納された命令データが同一か否かを判定する再利用判定部532と、キャッシュ制御部51の制御に従って中央処理装置1の要求するアドレスに対応する再利用情報を最大4エントリ記憶する再利用情報保持部24から構成されている。
【0065】
次に、図10を用いてキャッシュメモリ装置の動作について説明する。
図10において、まず、中央処理装置1によるフェッチ要求信号S11が出力される。
【0066】
S401、S402、S403、S406、S407、S408については、実施の形態1における図2のフローチャートで示した動作と同一であるので説明を省略する。
【0067】
フェッチアドレスA11に対応する命令データを主記憶装置3から読み出した後、キャッシュ制御部51は、主記憶装置3より読み出されたリードデータD31と、リードデータ保持部531に格納された直前にキャッシュミスした時の命令データが同一であるか否かを判定する(S409)。
【0068】
同一である場合、キャッシュ制御部51は、フェッチアドレスA11と、リードデータ保持部531が保持するポインタを再利用情報保持部24に格納する(S410)。
【0069】
同一でない場合、フェッチアドレスA11とリードデータD31をキャッシュデータ保持部22に登録し(S406)、キャッシュ制御部51は、主記憶装置より読み出されたリードデータD31と、それが格納されたキャッシュデータ保持部22のエントリをリードデータ保持部531に格納する(S411)。
【0070】
上記のように構成されたキャッシュメモリ装置5について、図3に示したC言語プログラムを実行した場合の動作を説明する。
以下に、図9のキャッシュメモリ装置5における図4のアセンブラプログラムを実行した場合の動作について説明する。
【0071】
なお、初期状態ではキャッシュデータ保持部22はいかなる命令データも保持せず、再利用情報保持部24はいかなるポインタも保持せず、リードデータ保持部531はいかなる命令データも保持していないとする。
【0072】
まず、中央処理装置1は、フェッチ要求信号S11、フェッチアドレスA11を制御信号として0x0000番地の命令データをキャッシュメモリ装置5に要求する。
【0073】
この要求を受け、キャッシュ制御部51は、キャッシュデータ保持部22に0x0000番地の命令データが存在するか否かを判定する(図10のS401)。
【0074】
その結果、キャッシュデータ保持部22は初期状態では0x0000番地に対応する命令データを保持していないため、キャッシュ制御部51は再利用情報保持部24に0x0000番地に対応するポインタが登録されているか否かを判定する(図10のS402)。
【0075】
その結果、再利用情報保持部24は初期状態では0x0000番地に対応するポインタを保持していないため、キャッシュ制御部51はアクセス要求信号S51および、アクセスアドレスA51を制御信号とし、主記憶装置3から0x0000番地を先頭とする16バイトの命令データ811を読み出す(図10のS403)。
【0076】
次に、キャッシュ制御部51は、主記憶装置から読み出された命令データ811と、リードデータ保持部531が保持する命令データが一致するか否かを判定する(図10のS409)。
【0077】
その結果、リードデータ保持部531は初期状態ではいかなる命令データも保持せず、命令データは一致しないため、キャッシュ制御部51はフェッチアドレス0x0000と主記憶装置3から読み出された命令データ811をキャッシュデータ保持部22に登録する(図10のS406)。
【0078】
次に、キャッシュ制御部51は、主記憶装置3から読み出された命令データ811と、リードデータD31を格納したキャッシュデータ保持部のエントリ(ここでは”0”とする)をリードデータ保持部531に登録する(図10のS411)。
【0079】
次に、キャッシュ制御部51は、キャッシュデータ保持部22を制御し、キャッシュデータ保持部22が記憶する0x0000番地の命令データを中央処理装置1に出力させる(図10のS407)。
【0080】
以上の動作によって、中央処理装置1は要求した0x0000番地の命令を得て、命令の実行を開始する。
また、上記の動作によって、キャッシュデータ保持部22および再利用情報保持部24および、リードデータ保持部531がそれぞれ記憶する情報は図11のように、キャッシュデータ保持部22,リードデータ保持部531には0x0000に対応する命令データ811を記憶し、再利用情報保持部24には何も記憶されていない状態になる。
【0081】
次に、中央処理装置1は後続する命令を実行するためにフェッチ要求信号S11、フェッチアドレスA11を制御信号として0x0004番地の命令データをキャッシュメモリ装置5に要求する。
【0082】
この要求を受け、キャッシュ制御部51は、キャッシュデータ保持部22に0x0004番地の命令データが存在するか否かを判定する(図10のS401)。
【0083】
その結果、キャッシュデータ保持部22は0x0004番地に対応する命令データを保持しているため、キャッシュ制御部51はキャッシュデータ保持部22が記憶する0x0004番地の命令データを中央処理装置1に出力させる(図10のS407)。
【0084】
以上の動作によって、中央処理装置1は要求した0x0004番地の命令データを得て命令の実行を開始することができる。
以降、0x0008番地、0x000Cの番地の命令データについてもキャッシュデータ保持部22が該当するアドレスに対応する命令データを保持しているため、図10のフローチャートのS407の動作によってキャッシュデータ保持部22が記憶する命令データを中央処理装置1に出力する。
【0085】
次に、中央処理装置1は後続する命令を実行するためにフェッチ要求信号S11、フェッチアドレスA11を制御信号として0x0010番地の命令データをキャッシュメモリ装置5に要求する。
【0086】
この要求を受け、キャッシュ制御部51は、キャッシュデータ保持部22に0x0010番地の命令データが存在するか否かを判定する(図10のS401)。
【0087】
その結果、キャッシュデータ保持部22は0x0010番地に対応する命令データを保持していないため、キャッシュ制御部51は再利用情報保持部24に0x0010番地に対応するポインタが登録されているか否かを判定する(図10のS402)。
【0088】
その結果、再利用情報保持部24は0x0010番地に対応するポインタを保持していないため、キャッシュ制御部51はアクセス要求信号S51および、アクセスアドレスA51を制御信号とし、主記憶装置3から0x0010番地を先頭とする16バイトの命令データ812を読み出す(図10のS403)。
【0089】
次に、キャッシュ制御部51は、主記憶装置から読み出された命令データ812と、リードデータ保持部531が保持する命令データが一致するか否かを判定する(図10のS409)。
【0090】
その結果、リードデータ保持部531が保持する命令データ811と、主記憶装置3から読み出された命令データ812は一致しないため、フェッチアドレス0x0010と主記憶装置3から読み出された命令データ812をキャッシュデータ保持部22に登録する(図10のS406)。
【0091】
次に、キャッシュ制御部51は、主記憶装置3から読み出された命令データ812と、それが格納されているキャッシュデータ保持部22のエントリ(ここでは”1”とする)をリードデータ保持部531に登録する(図10のS411)。
【0092】
次に、キャッシュ制御部51は、キャッシュデータ保持部22が記憶する0x0010番地の命令データを中央処理装置1に出力する(図10のS407)。以上の動作によって、中央処理装置1は要求した0x0010番地の命令データを得て、命令の実行を開始する。
【0093】
次に、0x0014番地、0x0018番地、0x001C番地の命令データについては、先述の0x0004番地、0x0008番地、0x000C番地と同様の制御によって、キャッシュメモリ装置5が中央処理装置1に命令データを出力し、その結果、キャッシュデータ保持部22および再利用情報保持部24およびリードデータ保持部531がそれぞれ記憶する情報は図12のように変化する。
【0094】
次に、中央処理装置1は後続する命令を実行するためフェッチ要求信号S11、フェッチアドレスA11を制御信号として0x0020番地の命令データをキャッシュメモリ装置5に要求する。
【0095】
キャッシュデータ保持部22および再利用情報保持部24は該当するアドレスを保持していないため、キャッシュ制御部51はアクセス要求信号S51および、アクセスアドレスA51を制御信号とし、主記憶装置3から0x0020番地を先頭とする16バイトの命令データ813を読み出す(図10のS403)。
【0096】
次に、キャッシュ制御部51は、主記憶装置から読み出された命令データ813と、リードデータ保持部531が保持する命令データが一致するか否かを判定する(図10のS409)。
【0097】
その結果、リードデータ保持部531が記憶する命令データ812と、主記憶装置3から読み出された命令データ813は一致するため、キャッシュ制御部51は再利用情報保持部24にフェッチアドレス0x0020とリードデータ保持部が記憶しているエントリ番号”1”を登録する(図10のS410)。
【0098】
次に、キャッシュ制御部51は、再利用情報保持部24が記憶するフェッチアドレス0x0020に対応するエントリ”1”についてキャッシュデータ保持部22が記憶する命令データとして実際には0x0010番地に対応する命令データを中央処理装置1に出力する(図10のS408)。
【0099】
以上の動作によって中央処理装置1は要求した0x0020番地の命令データを得て命令の実行を開始することができる。
また、上記の動作によって、キャッシュデータ保持部22および再利用情報保持部24およびリードデータ保持部531がそれぞれ記憶する情報は図13のように変化する。
【0100】
次に、中央処理装置1は後続する命令を実行するためフェッチ要求信号S11、フェッチアドレスA11を制御信号として0x0024番地の命令データをキャッシュメモリ装置5に要求する。
【0101】
この要求を受け、キャッシュ制御部51は、キャッシュデータ保持部22に0x0024番地の命令データが存在するか否かを判定する(図10のS401)。
【0102】
その結果、キャッシュデータ保持部22は0x0024番地に対応する命令データを保持していないため、キャッシュ制御部51は再利用情報保持部24に0x0024番地の命令データに対応するポインタが登録されているか否かを判定する(図10のS402)。
【0103】
その結果、再利用情報保持部24は0x0024番地の命令データに対応するポインタを保持しているため、キャッシュ制御部51は、再利用情報保持部24が記憶するフェッチアドレス0x0024に対応するエントリ”1”についてキャッシュデータ保持部22が記憶する命令データ(実際には0x0014番地に対応する命令データ)を中央処理装置1に出力する(図10のS408)。
【0104】
以上の動作によって、中央処理装置1は要求した0x0024番地の命令データを得て命令の実行を開始することができる。
以降、0x0028番地、0x002C番地の命令データについても再利用情報保持部24が該当するアドレスに対応する命令データを保持しているため、図10のフローチャートのS408の動作によって再利用情報保持部24が保持する該当アドレスに対応するエントリ”1”についてキャッシュデータ保持部22が記憶する命令データが中央処理装置1に出力される。
【0105】
次に、0x0030番地から0x005C番地までの命令データについても、先述の0x0020番地から0x002C番地までと同様の制御によって、キャッシュメモリ装置が中央処理装置1に命令データを出力し、その結果キャッシュデータ保持部22および再利用情報保持部24がそれぞれ記憶する情報は図14のように変化する。
【0106】
以上のように、本実施の形態2によるキャッシュメモリ装置では、ループ展開によって生成された繰返し命令列を実行した際にも、同一命令データがキャッシュデータ保持部に存在する場合は、再利用情報保持部にその命令データに対応するポインタを格納し、さらに、主記憶装置から読み出した命令データと、直前のキャッシュミス時にリードした命令データとを比較する再利用判定部を備えることにより、主記憶装置から読み出された命令データの比較の対象を直前に主記憶装置から読み出された命令データに限定することができ、ループ展開によって生成される繰返し命令等が存在する場合においても、ハードウェア量を増加することなく、キャッシュメモリの容量消費を抑制し、キャッシュメモリの効率的な使用を可能とすることができる。
(実施の形態3)
次に、本発明の実施の形態3におけるキャッシュメモリ装置について、図3,図4,図15,図16,図17,図18,図19,図20を用いて説明する。
【0107】
図15は本発明の実施の形態3におけるキャッシュメモリ装置の構成を示すブロック図であり、図16は本発明の実施の形態3におけるキャッシュメモリ装置の動作フローを示すフローチャートである。図17,図18,図19,図20は実施の形態3において展開したプログラムがフェッチライン保持部および再利用情報保持部に格納された様子を例示する図であり、プログラムを徐々に展開していく様子を示している。
【0108】
なお、図15には、プロセッサの構成要素であり命令を実行する中央処理装置1と、中央処理装置1が実行する命令を格納する主記憶装置3も同時に示している。
【0109】
中央処理装置1は、キャッシュメモリ装置6を介して主記憶装置3から読み出された命令を順次実行するように構成されている。
キャッシュメモリ装置6は、キャッシュメモリ装置全体の制御を行うキャッシュ制御部61と、キャッシュ制御部61の制御に従って中央処理装置1の要求するアドレスに対応する主記憶装置3上の命令データを16バイト単位で最大4エントリ記憶するキャッシュデータ保持部22と、キャッシュ制御部61の制御に従ってキャッシュデータ保持部の保持する直前にキャッシュヒットしたキャッシュラインの命令データを記憶するフェッチライン保持部631と、主記憶装置から読み込まれたリードデータD31と、フェッチライン保持部631に格納された命令データが同一か否かを判定する再利用判定部632と、キャッシュ制御部51の制御に従ってフェッチアドレスA11およびフェッチアドレスA11に対応するポインタを最大4エントリ記憶する再利用情報保持部24から構成されている。
【0110】
図16において、この制御フローは、中央処理装置1によるフェッチ要求信号S11が出力された際に開始される。
S401、S402、S403、S406、S407、S408については、実施の形態2における図9のフローチャートで示した動作と同一であるので説明を省略する。
【0111】
S403においてフェッチアドレスに対応する命令データを読み出した後、キャッシュ制御部61は、主記憶装置3より読み出されたリードデータD31と、フェッチライン保持部631に格納された命令データが同一であるか否かを判定する(S412)。
【0112】
一致した場合、キャッシュ制御部61は、再利用情報保持部24を制御し、フェッチアドレスA11と、フェッチライン保持部631が保持するポインタを再利用情報保持部24に格納する(S413)。
【0113】
S407で命令データを中央処理装置1に出力してから、キャッシュ制御部61は、キャッシュデータ保持部22が中央処理装置1に対して出力した命令データを含むキャッシュラインへのポインタおよびキャッシュラインに格納されている命令データをフェッチライン保持部631に格納させる(S414)。
【0114】
上記のように構成されたキャッシュメモリ装置6について、図3に示したC言語プログラムを実行した場合の動作を説明する。
図4に示したアセンブラプログラムは、図3に示したC言語プログラムにループ展開を伴うコンパイルを実施した結果の一例である。なお、この例ではプロセッサの命令は4バイトの固定長としている。
【0115】
以下に、図15のキャッシュメモリ装置6に対して図4のアセンブラプログラムを実行した場合の動作について説明する。
なお、初期状態では、キャッシュデータ保持部22はいかなる命令データも保持せず、再利用情報保持部24はいかなるポインタも保持せず、フェッチライン保持部631はいかなる命令データも保持していないとする。
【0116】
中央処理装置1は、フェッチ要求信号S11、フェッチアドレスA11を制御して0x0000番地の命令の供給をキャッシュメモリ装置6に要求する。
この要求を受け、キャッシュ制御部61は、キャッシュデータ保持部22を制御し、キャッシュデータ保持部22に0x0000番地の命令が存在するか否かを判定する(図16のS401)。
【0117】
その結果、キャッシュデータ保持部22は初期状態では0x0000番地に対応する命令データを保持していないため、キャッシュ制御部61は、再利用情報保持部24に0x0000番地のアドレスに対応するポインタが登録されているか否かを判定する(図16のS402)。
【0118】
その結果、再利用情報保持部24は初期状態では0x0000番地に対応するポインタを保持していないため、キャッシュ制御部61はアクセス要求信号S21および、アクセスアドレスA21を制御信号とし、主記憶装置3から0x0000番地を先頭とする16バイトの命令データ811を読み出す(図16のS403の動作)。
【0119】
次に、キャッシュ制御部61は、主記憶装置から読み出された命令データ811と、リードデータ保持部631が保持する命令データが一致するか否かを判定する(図16のS412動作)。
【0120】
その結果、リードデータ保持部631は初期状態ではいかなる命令データも保持せず、命令データは一致しないため、キャッシュ制御部61は、フェッチアドレス0x0000と主記憶装置3から読み出された命令データ811をキャッシュデータ保持部22に登録する(図16のS406の動作)。
【0121】
次に、キャッシュ制御部61は、キャッシュデータ保持部22が記憶する0x0000番地の命令データを中央処理装置1に出力する(図16のS407の動作)。
【0122】
次に、キャッシュ制御部61は、キャッシュデータ保持部が中央処理装置1に対して出力した0x0000番地の命令データを含むキャッシュラインへのポインタ”0”と、キャッシュラインに含まれる命令データをフェッチライン保持部631に記憶する。
【0123】
以上の動作によって、中央処理装置1は要求した0x0000番地の命令データを得て、命令の実行を開始する。
また、上記の動作によって、キャッシュデータ保持部22および再利用情報保持部24および、フェッチライン保持部631がそれぞれ記憶する情報は図17のようになる。
【0124】
次に、中央処理装置1は後続する命令を実行するためにフェッチ要求信号S11、フェッチアドレスA11を制御信号として0x0004番地の命令データの供給をキャッシュメモリ装置5に要求する。
【0125】
この要求を受け、キャッシュ制御部51は、キャッシュデータ保持部22に0x0004番地の命令データが存在するか否かを判定する(図16のS401の動作)。
【0126】
その結果、キャッシュデータ保持部22は0x0004番地に対応する命令データを保持しているため、キャッシュ制御部51は、キャッシュデータ保持部22が記憶する0x0004番地の命令データを中央処理装置1に出力する(図16のS407の動作)。
【0127】
次に、キャッシュ制御部61は、キャッシュデータ保持部が中央処理装置1に対して出力した0x0004番地の命令データを含むキャッシュラインへのポインタ”0”と、キャッシュラインに含まれる命令データをフェッチライン保持部631に記憶させる。
【0128】
以上の動作によって、中央処理装置1は要求した0x0004番地の命令データを得て命令の実行を開始することができる。
以降、0x0008番地、0x000Cの番地の命令データについてもキャッシュデータ保持部22が該当するアドレスに対応する命令データを保持しているため、図16のフローチャートの407の動作によってキャッシュデータ保持部22が記憶する命令データが中央処理装置1に出力される。
【0129】
次に、中央処理装置1は後続する命令を実行するためにフェッチ要求信号S11、フェッチアドレスA11を制御信号として0x0010番地の命令データをキャッシュメモリ装置6に要求する。
【0130】
この要求を受け、キャッシュ制御部61は、キャッシュデータ保持部22に0x0010番地の命令データが存在するか否かを判定する(図16のS401の動作)。
【0131】
その結果、キャッシュデータ保持部22は0x0010番地に対応する命令データを保持していないため、キャッシュ制御部61は、再利用情報保持部24に0x0010番地に対するポインタが登録されているか否かを判定する(図16のS402の動作)。
【0132】
その結果、再利用情報保持部24は0x0010番地に対応するアドレスを保持していないため、キャッシュ制御部61はアクセス要求信号S61および、アクセスアドレスA61を制御信号とし、主記憶装置3から0x0010番地を先頭とする16バイトの命令データ812を読み出す(図16のS403の動作)。
【0133】
次に、キャッシュ制御部61は、再利用判定部632を制御し、主記憶装置3から読み出された命令データ812と、フェッチライン保持部631が保持する命令データが一致するか否かを判定する(図16のS412の動作)。
【0134】
その結果、フェッチライン保持部631が保持する命令データ811と、主記憶装置3から読み出された命令データ812は一致しないため、フェッチアドレス0x0010と主記憶装置3から読み出された命令データ812をキャッシュデータ保持部22に登録する(図16のS406の動作)。
【0135】
次に、キャッシュ制御部61は、キャッシュデータ保持部22が記憶する0x0010番地の命令データを中央処理装置1に出力する(図16のS407の動作)。
【0136】
次に、キャッシュ制御部61は、キャッシュデータ保持部22が中央処理装置1に対して出力した0x0010番地の命令データを含むキャッシュラインへのポインタ”1”と、キャッシュラインに含まれる命令データをフェッチライン保持部631に記憶する。
【0137】
以上の動作によって、中央処理装置1は要求した0x0010番地の命令データを得て、命令の実行を開始する。
次に、0x0014番地、0x0018番地、0x001C番地の命令データについては、先述の0x0004番地、0x0008番地、0x000C番地と同様の制御によって、キャッシュメモリ装置6が中央処理装置1に命令データを出力し、その結果、キャッシュデータ保持部22および再利用情報保持部24がそれぞれ記憶する情報は図18のように変化する。
【0138】
次に、中央処理装置1は後続する命令を実行するためフェッチ要求信号S11、フェッチアドレスA11を制御信号として0x0020番地の命令データの供給をキャッシュメモリ装置6に要求する。
【0139】
キャッシュデータ保持部22および再利用情報保持部24は該当するアドレスを保持していないため、キャッシュ制御部61はアクセス要求信号S61および、アクセスアドレスA61を制御信号とし、主記憶装置3から0x0020番地を先頭とする16バイトの命令データ813を読み出す(図16のS403の動作)。
【0140】
次に、キャッシュ制御部61は、主記憶装置3から読み出された命令データ813と、フェッチライン保持部631が保持する命令データ812が一致するか否かを判定する(図16のS412の動作)。
【0141】
その結果、フェッチライン保持部631が記憶する命令データ812と、主記憶装置3から読み出された命令データ813は一致するため、キャッシュ制御部61は再利用情報保持部24にフェッチアドレス0x0020とリードデータ保持部が記憶しているポインタ”1”を登録する(図16のS413の動作)。
【0142】
次に、キャッシュ制御部61は、再利用情報保持部24が記憶するフェッチアドレス0x0020に対応するエントリ”1”についてキャッシュデータ保持部22が記憶する命令データとして実際には0x0010番地に対応する命令データを中央処理装置1に出力する(図16のS408の動作)。
【0143】
次に、キャッシュ制御部61は、キャッシュデータ保持部22および、フェッチライン保持部631を制御し、キャッシュデータ保持部が中央処理装置1に対して出力した0x0010番地の命令を含むキャッシュラインへのポインタ”1”と、キャッシュラインに含まれる命令データをフェッチライン保持部631に記憶する。
【0144】
以上の動作によって中央処理装置1は要求した0x0020番地の命令データを得て命令の実行を開始することができる。
また、上記の動作によって、キャッシュデータ保持部22および再利用情報保持部24がそれぞれ記憶する情報は図19のように変化する。
【0145】
次に、中央処理装置1は後続する命令を実行するためフェッチ要求信号S11、フェッチアドレスA11を制御信号として0x0024番地の命令データの供給をキャッシュメモリ装置6に要求する。
【0146】
この要求を受け、キャッシュ制御部61は、キャッシュデータ保持部22を制御し、キャッシュデータ保持部22に0x0024番地の命令データが存在するか否かを判定する(図16のS401の動作)。
【0147】
その結果、キャッシュデータ保持部22は0x0024番地に対応する命令データを保持していないため、キャッシュ制御部61は、再利用情報保持部24に0x0024番地のアドレスに対応するポインタが登録されているか否かを判定する(図16のS402の動作)。
【0148】
その結果、再利用情報保持部24は0x0024番地のアドレスに対応するポインタを保持しているため、キャッシュ制御部61は、再利用情報保持部24が記憶するフェッチアドレス0x0024に対応するポインタ”1”についてキャッシュデータ保持部22が記憶する命令データとして実際には0x0014番地に対応する命令データを中央処理装置1に出力する(図16のS408の動作)。
【0149】
次に、キャッシュ制御部61は、キャッシュデータ保持部が中央処理装置1に対して出力した0x0010番地の命令データを含むキャッシュラインへのポインタ”1”と、キャッシュラインに含まれる命令データをフェッチライン保持部631に記憶する(図16のS414の動作)。
【0150】
以上の動作によって、中央処理装置1は要求した0x0024番地の命令データを得て命令の実行を開始することができる。
以降、0x0028番地、0x002Cの番地の命令データについても再利用情報保持部24が該当するアドレスに対応するポインタを保持しているため、図16のフローチャートのS408の動作によって再利用情報保持部24が保持する該当アドレスに対応するエントリ”1”についてキャッシュデータ保持部22が記憶する命令データが中央処理装置1に出力される。
【0151】
次に、0x0030番地から0x005C番地までの命令データについても、先述の0x0020番地から0x002C番地までと同様の制御によって、キャッシュメモリ装置が中央処理装置1に命令データを出力し、その結果キャッシュデータ保持部22および再利用情報保持部24がそれぞれ記憶する情報は図20のように変化する。
【0152】
以上のように、本実施の形態3によるキャッシュメモリ装置では、ループ展開によって生成された繰返し命令列を実行した際にも、同一命令データがキャッシュデータ保持部に存在する場合は、再利用情報保持部にその命令データに対応するポインタを格納し、命令データの比較の対象を直前にキャッシュヒットしたキャッシュラインの命令データに限定することにより、ループ展開によって生成される繰返し命令等が存在する場合においても、ハードウェア量を増加することなく、キャッシュメモリの容量消費を抑制し、キャッシュメモリの効率的な使用を可能とすることができる。
【0153】
【発明の効果】
以上のように、本発明によるキャッシュメモリ装置では、ループ展開によって生成された繰返し命令列を実行した際にも、同一命令データがキャッシュデータ保持部に存在する場合は、再利用情報保持部にその命令データに対応するポインタを格納して、キャッシュデータ保持部のエントリを消費しないため、ループ展開によって生成される繰返し命令等が存在する場合においても、ハードウェア量を増加することなく、キャッシュメモリの容量消費を抑制し、キャッシュメモリの効率的な使用を可能とすることができる。
【0154】
また、主記憶装置から読み出した命令データと、直前のキャッシュミス時にリードした命令データとを比較する再利用判定部を備えることにより、主記憶装置から読み出された命令データの比較の対象を直前に主記憶装置から読み出された命令データに限定することができ、ループ展開によって生成される繰返し命令等が存在する場合においても、ハードウェア量を増加することなく、キャッシュメモリの容量消費を抑制し、キャッシュメモリの効率的な使用を可能とすることができる。
【0155】
さらに、命令データの比較の対象を直前にキャッシュヒットしたキャッシュラインの命令データに限定することにより、ループ展開によって生成される繰返し命令等が存在する場合においても、ハードウェア量を増加することなく、キャッシュメモリの容量消費を抑制し、キャッシュメモリの効率的な使用を可能とすることができる。
【図面の簡単な説明】
【図1】本発明の実施の形態1におけるキャッシュメモリ装置の構成を示すブロック図
【図2】本発明の実施の形態1におけるキャッシュメモリ装置の動作フローを示すフローチャート
【図3】実施の形態1における展開前のC言語によるプログラムを表す図
【図4】実施の形態1における展開後のプログラムを表す図
【図5】実施の形態1において展開したプログラムがキャッシュデータ保持部および再利用情報保持部に格納された様子を例示する図
【図6】実施の形態1において展開したプログラムがキャッシュデータ保持部および再利用情報保持部に格納された様子を例示する図
【図7】実施の形態1において展開したプログラムがキャッシュデータ保持部および再利用情報保持部に格納された様子を例示する図
【図8】実施の形態1において展開したプログラムがキャッシュデータ保持部および再利用情報保持部に格納された様子を例示する図
【図9】本発明の実施の形態2におけるキャッシュメモリ装置の構成を示すブロック図
【図10】本発明の実施の形態2におけるキャッシュメモリ装置の動作フローを示すフローチャート
【図11】実施の形態2において展開したプログラムがキャッシュデータ保持部および再利用情報保持部およびリードデータ保持部に格納された様子を例示する図
【図12】実施の形態2において展開したプログラムがキャッシュデータ保持部および再利用情報保持部およびリードデータ保持部に格納された様子を例示する図
【図13】実施の形態2において展開したプログラムがキャッシュデータ保持部および再利用情報保持部およびリードデータ保持部に格納された様子を例示する図
【図14】実施の形態2において展開したプログラムがキャッシュデータ保持部および再利用情報保持部およびリードデータ保持部に格納された様子を例示する図
【図15】本発明の実施の形態3におけるキャッシュメモリ装置の構成を示すブロック図
【図16】本発明の実施の形態3におけるキャッシュメモリ装置の動作フローを示すフローチャート
【図17】実施の形態3において展開したプログラムがフェッチライン保持部および再利用情報保持部に格納された様子を例示する図
【図18】実施の形態3において展開したプログラムがフェッチライン保持部および再利用情報保持部に格納された様子を例示する図
【図19】実施の形態3において展開したプログラムがフェッチライン保持部および再利用情報保持部に格納された様子を例示する図
【図20】実施の形態3において展開したプログラムがフェッチライン保持部および再利用情報保持部に格納された様子を例示する図
【図21】従来のキャッシュメモリ装置の構成を示すブロック図
【図22】従来のキャッシュメモリ装置の動作フローを示すフローチャート
【図23】展開前のC言語によるプログラムを表す図
【図24】展開後のプログラムを表す図
【図25】従来の技術において展開したプログラムがキャッシュデータ保持部に格納された様子を例示する図
【符号の説明】
1  中央処理装置
S11  フェッチ要求信号
A11  フェッチアドレス
2  キャッシュメモリ装置
21  キャッシュ制御部
22  キャッシュデータ保持部
23  再利用判定部
24  再利用情報保持部
S21  アクセス要求信号
A21  アクセスアドレス
3  主記憶装置
D31  リードデータ
5  キャッシュメモリ装置
51  キャッシュ制御部
531  リードデータ保持部
532  再利用判定部
S51  アクセス要求信号
A51  アクセスアドレス
6  キャッシュメモリ装置
61  キャッシュ制御部
631  フェッチライン保持部
632  再利用判定部
S61  アクセス要求信号
A61  アクセスアドレス
7  キャッシュメモリ装置
71  キャッシュ制御部
72  キャッシュデータ保持部
S71  アクセス要求信号
A71  アクセスアドレス
811  命令データ
812  命令データ
813  命令データ
814  命令データ
815  命令データ
816  命令データ
831  命令データ
832  命令データ
833  命令データ
834  命令データ
835  命令データ
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a cache memory device for improving memory access performance in a computer system, and more particularly to a cache memory device that effectively uses a capacity when processing a repetition instruction by loop unrolling or the like.
[0002]
[Prior art]
2. Description of the Related Art In recent years, the performance of processors has been remarkably improved due to improvements in semiconductor technology.
However, since the performance improvement of the memory for storing the instructions executed by the central processing unit is relatively gradual in comparison with the performance improvement of the central processing unit, the instruction waiting of the central processing unit occurs, and the performance of the processor depends on the memory. There is a problem of being limited.
[0003]
To cope with this, a high-performance processor has a cache system between the main storage device and the central processing unit, and the cache memory device retains instructions accessed by the central processing unit, so that the second and subsequent accesses can be performed at high speed. And the substantial access speed of the main storage device is increased.
[0004]
Hereinafter, a conventional cache memory device will be described with reference to FIGS. 21, 22, 23, 24, and 25.
FIG. 21 is a block diagram showing a configuration of a conventional cache memory device, and FIG. 22 is a flowchart showing an operation flow of the conventional cache memory device. FIG. 23 is a diagram showing a program in C language before expansion, FIG. 24 is a diagram showing a program after expansion, and FIG. 25 is a diagram exemplifying a state in which a program expanded in the prior art is stored in a cache data holding unit. is there.
[0005]
FIG. 21 also shows a central processing unit 1 that is a component of the processor and executes instructions, and a main storage device 3 that stores instructions to be executed by the central processing unit 1.
[0006]
The central processing unit 1 is configured to sequentially execute the instructions read from the main storage device 3 via the cache memory device 7.
The cache memory device 7 includes a cache control unit 71 that controls the entire cache memory device, and a cache data holding unit 72 that stores a maximum of four entries of instruction data in the main storage device 3 in 16-byte units under the control of the cache control unit 71. It is composed of
[0007]
In FIG. 22, this control flow is started when the central processing unit 1 outputs a fetch request signal S11.
Next, the cache data holding unit 72 is controlled to determine whether or not the instruction data corresponding to the fetch address A11 exists in the cache data holding unit 72 (S415).
[0008]
Next, when the instruction data exists, the cache data holding unit 72 is controlled, and the instruction data corresponding to the fetch address A11 held by the cache data holding unit 72 is output to the central processing unit 1 (S416).
[0009]
If the instruction data does not exist, the access request signal S71 and the access address A71 are controlled, and the instruction data is read from the main storage device 3 in units of 16 bytes (S417).
[0010]
Next, the cache data holding unit 72 is controlled, the fetch address A11 and the read data D31 are registered in the cache data holding unit 72, and the process proceeds to S416 (S418).
[0011]
As described above, the cache data holding unit 72 stores the read instruction data in response to the fetch request of the central processing unit, so that the cache data holding unit 72 stores the next fetch request for the same address. Since the data can be directly supplied to the central processing unit 72 and the access to the main storage device is not required, the apparent access speed of the main storage device to the central processing unit can be improved.
[0012]
However, in the cache memory device having the conventional configuration, there is a problem that the efficiency is reduced at the time of executing a repeat instruction generated by loop unrolling or the like. Hereinafter, this state will be described.
[0013]
Loop unrolling is a method of arranging an instruction sequence executed in a loop of a program a plurality of times, thereby reducing the number of executions of an instruction for determining a loop end condition or a branch instruction for loop repetition.
[0014]
For example, when loop expansion is performed on the C language program in FIG. 23, instruction data including a repetition instruction as shown in FIG. 24 is generated.
When this instruction data is executed by a processor having a cache memory device having a conventional configuration, the cache data holding is performed as the central processing unit 1 executes the instruction data 831, instruction data 832, instruction data 833, and instruction data 834. Instruction data 831, instruction data 832, instruction data 833, and instruction data 834 are stored in each entry of the unit 72.
[0015]
After that, when the central processing unit 1 executes the subsequent instruction data 835, since there is no empty entry in the cache data holding unit, it is necessary to replace the entry in which the instruction data is already stored and store new instruction data. There is.
[0016]
As a result, after the central processing unit executes the instruction data of FIG. 23, the data stored in the cache data holding unit is as shown in FIG. 25, and when the central processing unit attempts to execute the instruction data 831 again. Since the instruction data 831 does not already exist in the cache data holding unit, it is necessary to read it again from the main storage device.
[0017]
As described above, in a processor equipped with a conventional cache memory device, when a repetitive instruction sequence generated by loop unrolling or the like is executed, the capacity of the cache memory becomes insufficient, and the cache memory device operates efficiently. There was a problem that not.
[0018]
[Problems to be solved by the invention]
One method of solving this problem is to increase the number of entries in the cache data holding unit. In this case, however, the amount of memory for storing cache data increases, and the hardware amount of the cache memory device increases. The other problem that the number of the pixels increases.
[0019]
In view of the above problems, the cache memory device of the present invention suppresses the capacity consumption of the cache memory without increasing the amount of hardware even when there is a repeat instruction or the like generated by loop unrolling. The purpose is to enable the use of the system.
[0020]
[Means for Solving the Problems]
In order to achieve the above object, a cache memory device according to claim 1 of the present invention is a cache memory provided with a cache system for storing instruction data used in the past among instruction data in a main storage device and efficiently fetching instructions. A cache data holding unit that reads instruction data corresponding to an address requested by the central processing unit from a main storage device and stores the address and the instruction data, and a memory device that corresponds to the address requested by the central processing unit. A pointer indicating the instruction data of the cache data holding unit and a reuse information holding unit storing the address; and the same instruction data as the instruction data read from the main storage device are present in the cache data holding unit. A reuse judging unit for judging whether or not there is an address requested by the central processing unit. A cache control unit that supplies corresponding instruction data to the central processing unit when stored in the cache data holding unit or the reuse information holding unit, and the address requested by the central processing unit is the cache data. When present in the holding unit, the instruction data corresponding to the address requested by the central processing unit stored in the cache data holding unit is output to the central processing unit, and the address requested by the central processing unit is the cache data. If not present in the holding unit but present in the reuse information holding unit, the instruction data indicated by the pointer corresponding to the address requested by the central processing unit stored in the cache data holding unit is sent to the central processing unit. And the address requested by the central processing unit is also stored in the cache data holding unit. If the instruction data does not exist in the main information storage unit, the instruction data corresponding to the address requested by the central processing unit is read from the main storage unit and output to the central processing unit, and is the same as the instruction data read from the main storage unit. When it is determined that the instruction data does not exist in the cache data holding unit, the instruction data read from the main storage device and the corresponding address are stored in the cache data holding unit and are different from the address requested by the central processing unit. If it is determined that the same instruction data as the instruction data read from the main storage device exists even in the address, the data read from the main storage device is stored in the cache data storage portion. Without reusing the pointer pointing to the same instruction data as the address. It is stored in an information holding unit.
[0021]
2. The cache memory device according to claim 1, wherein the cache data holding unit stores the instruction data stored in the main storage device in units of cache lines of a predetermined size. A pointer for indicating the cache line is stored as a pointer to be stored in the usage information holding unit, and the comparison of instruction data in the reuse determination unit is performed in units of the cache line.
[0022]
The cache memory device according to claim 3 is the cache memory device according to claim 1 or 2, wherein the instruction corresponding to the address requested by the central processing unit read from the main storage device at the time of the last cache miss. A read data holding unit for storing data, wherein when the address requested by the central processing unit does not exist in either the cache data holding unit or the reuse information holding unit, the central processing unit Read the instruction data corresponding to the address requested by the main storage device and output the read instruction data to the main storage device, and compare the instruction data read from the main storage device with the instruction data in the read data holding unit. When the instruction data read from the main storage device and its address are stored in the holding unit and the addresses match. Even if the address is different from the address requested by the central processing unit, the data read from the main storage device is not stored in the cache data holding unit, and the pointer pointing to the same instruction data as the address is rewritten. It is stored in a usage information holding unit.
[0023]
According to a fourth aspect of the present invention, in the cache memory device according to the first or second aspect, an address requested by the central processing unit output from the cache data holding unit at the time of a previous cache hit is provided. A fetch line holding unit for storing instruction data, wherein if the address requested by the central processing unit does not exist in the cache data holding unit or the reuse information holding unit, the central processing unit The instruction data corresponding to the address requested by the device is read and output to the main storage device, and the instruction data read from the main storage device is compared with the instruction data in the fetch line holding unit. Instruction data read from the main storage device and its address are stored in a data holding unit. If the addresses match, even if the address is different from the address requested by the central processing unit, the data read from the main storage device is not stored in the cache data holding unit, and the same instruction data as the address is designated. The pointer to be used is stored in the reuse information holding unit.
[0024]
With the above configuration, even when there is a repeat instruction or the like generated by loop unrolling, it is possible to suppress the cache memory capacity consumption and increase the efficiency of the cache memory without increasing the amount of hardware. be able to.
[0025]
BEST MODE FOR CARRYING OUT THE INVENTION
Embodiments of the present invention will be described in detail with reference to the drawings.
(Embodiment 1)
Hereinafter, a first embodiment of the present invention will be described with reference to FIGS. 1, 2, 3, 4, 5, and 6. FIG.
[0026]
FIG. 1 is a block diagram showing a configuration of the cache memory device according to the first embodiment of the present invention, and FIG. 2 is a flowchart showing an operation flow of the cache memory device according to the first embodiment of the present invention. FIG. 3 is a diagram illustrating a program in C language before expansion according to the first embodiment, and FIG. 4 is a diagram illustrating a program after expansion according to the first embodiment. FIG. 5, FIG. 6, FIG. 7, and FIG. 8 are diagrams illustrating an example in which the program developed in the first embodiment is stored in the cache data holding unit and the reuse information holding unit. It shows how it goes.
[0027]
FIG. 1 also shows a central processing unit 1 that is a component of the processor and executes instructions, and a main storage device 3 that stores instructions to be executed by the central processing unit 1. The central processing unit 1 is configured to sequentially execute the instructions read from the main storage device 3 via the cache memory device 2.
[0028]
The cache memory device 2 includes a cache control unit 21 that controls the entire cache memory device, and instruction data in the main storage device 3 corresponding to an address requested by the central processing unit 1 in 16-byte units under the control of the cache control unit 21. And a reuse determination unit 23 that determines whether the same instruction data as the read data D31 read from the main storage device 3 exists in the cache data storage unit 22. And a reuse information holding unit 24 that stores a maximum of four pointers corresponding to the address requested by the central processing unit 1 under the control of the cache control unit 21.
[0029]
In FIG. 2, this control flow is started when the central processing unit 1 outputs a fetch request signal S11.
Next, it is determined whether or not an address that matches the fetch address A11 requested by the central processing unit 1 exists in the cache data holding unit 22, and whether or not the requested instruction data exists (S411). .
[0030]
If the requested instruction data does not exist, it controls the reuse information holding unit 24 and determines whether or not the pointer corresponding to the fetch address A11 exists in the reuse information holding unit 24 (402).
[0031]
When the pointer does not exist, the access request signal S21 and the access address A21 are used as control signals, and the instruction data is read from the main storage device 3 in units of 16 bytes (403). When the pointer exists, the reuse information holding unit 24 The instruction data registered in the cache data holding unit 22 indicated by the pointer corresponding to the fetch address A11 to be held is output to the central processing unit 1 (S408).
[0032]
Next, the reuse determining unit 23 determines whether the same instruction data as the read data D31 read from the main storage device 3 exists in the cache data holding unit 22 (S404).
[0033]
If the same instruction data exists in the cache data holding unit 22, the pointer of the cache line holding the same instruction data as the read data D31 and the fetch address A11 are registered in the reuse information holding unit 24 (S405).
[0034]
In S404, if the same instruction data as the read data D31 does not exist in the cache data holding unit 22, the fetch address A11 and the read data D31 are registered in the cache data holding unit 22 (S406), and the instruction data is stored in the central processing unit. 1 (S407).
[0035]
Further, when the instruction data corresponding to the fetch address A11 is held in the cache data holding unit 22 in S401, the instruction data corresponding to the fetch address A11 stored in the cache data holding unit 22 is output to the central processing unit 1. (S407).
[0036]
When the pointer corresponding to the fetch address A11 is held in the reuse information holding unit 24 in S402, the registration of the cache data holding unit 22 indicated by the pointer corresponding to the fetch address A11 held by the reuse information holding unit 24 The instruction data thus output is output to the central processing unit 1 (S408).
[0037]
The operation of the cache memory device 2 configured as described above when the C language program shown in FIG. 3 is executed will be described.
The assembler program shown in FIG. 4 is an example of the result of compiling the C language program shown in FIG. 3 with loop unrolling. In this example, the instruction of the processor has a fixed length of 4 bytes.
[0038]
The operation of the cache memory device of FIG. 1 when the assembler program of FIG. 4 is executed will be described below.
In the initial state, the cache data holding unit 22 does not hold any instruction data, and the reuse information holding unit 24 does not hold any pointer.
[0039]
First, the central processing unit 1 requests the cache memory device 2 to supply instruction data at address 0x0000 using the fetch request signal S11 and the fetch address A11 as control signals.
[0040]
Upon receiving this request, the cache control unit 21 determines whether or not the instruction data at the address 0x0000 exists in the cache data holding unit 22 (S401 in FIG. 2). As a result, since the cache data holding unit 22 does not hold the instruction data corresponding to the address 0x0000 in the initial state, the cache control unit 21 determines whether the pointer corresponding to the address 0x0000 is registered in the reuse information holding unit 24. Is determined (S402 in FIG. 2).
[0041]
As a result, since the reuse information holding unit 24 does not hold the pointer corresponding to the address 0x0000 in the initial state, the cache control unit 21 uses the access request signal S21 and the access address A21 as control signals, The 16-byte instruction data 811 starting at address 0x0000 is read (S403 in FIG. 2).
[0042]
Next, the cache control unit 21 determines whether the same instruction data as the 16-byte instruction data 811 read from the main storage device 3 exists in the cache data holding unit 22 (S404 in FIG. 2). .
[0043]
As a result, in the initial state, the cache data holding unit 22 does not hold the above-described instruction data, so that the cache control unit 21 sets the fetch address 0x0000 and the instruction data 811 starting from the address 0x0000 read from the main storage device 3. Is registered in the cache data holding unit 22 (S406 in FIG. 2).
[0044]
Next, the cache control unit 21 causes the central processing unit 1 to output the instruction data at the address 0x0000 stored in the cache data holding unit 22 (S407 in FIG. 2). With the above operation, the central processing unit 1 obtains the requested instruction data at the address 0x0000 and starts executing the instruction.
[0045]
According to the above operation, the information stored in the cache data holding unit 22 and the reuse information holding unit 24 respectively store the instruction data 811 corresponding to 0x0000 in the cache data holding unit 22 as shown in FIG. Nothing is stored in the usage information holding unit 24.
[0046]
Next, the central processing unit 1 requests the cache memory device 2 to supply the instruction data at the address 0x0004 using the fetch request signal S11 and the fetch address A11 as control signals in order to execute the subsequent instruction.
[0047]
Upon receiving this request, the cache control unit 21 determines whether or not the instruction data at the address 0x0004 exists in the cache data holding unit 22 (S401 in FIG. 2). As a result, since the cache data holding unit 22 holds the instruction data corresponding to the address 0x0004, the instruction data at the address 0x0004 stored in the cache data holding unit 22 is output to the central processing unit 1 (S407 in FIG. 2). .
[0048]
Through the above operation, the central processing unit 1 can obtain the requested instruction data at the address 0x0004 and start executing the instruction.
Thereafter, since the cache data holding unit 22 holds the instruction data corresponding to the corresponding address also for the instruction data of the addresses 0x0008 and 0x000C, the cache data holding unit 22 stores the instruction data in the operation of S407 in the flowchart of FIG. Is output to the central processing unit 1.
[0049]
Next, with respect to the instruction data at addresses 0x0010, 0x0014, 0x0018, and 0x001C, 16-byte instruction data 812 starting from address 0x0010 is obtained by the same control as the above-mentioned addresses 0x0000, 0x0004, 0x0008, and 0x000C. After being stored in the cache data holding unit, the cache memory device 2 outputs the instruction data to the central processing unit 1, and as a result, the information respectively stored in the cache data holding unit 22 and the reuse information holding unit 24 is as shown in FIG. Thus, the instruction data of the instruction data 812 is added.
[0050]
Next, the central processing unit 1 requests the cache memory device 2 to issue instruction data at address 0x0020 using the fetch request signal S11 and the fetch address A11 as control signals in order to execute the subsequent instruction.
[0051]
Since the cache data holding unit 22 and the reuse information holding unit 24 do not hold the corresponding addresses, the cache control unit 21 uses the access request signal S21 and the access address A21 as control signals, and stores the address 0x0020 from the main storage device 3. The first 16 bytes of instruction data 813 are read (S403 in FIG. 2).
[0052]
Next, the cache control unit 21 determines whether the same instruction data as the 16-byte instruction data 813 read from the main storage device 3 exists in the cache data holding unit 22 (S404 in FIG. 2). .
[0053]
As a result, since the cache data holding unit 22 holds the same instruction data as the above-mentioned instruction data (entry “1” of the cache data holding unit in FIG. 6), the cache control unit 21 The fetch address 0x0020 and the entry “1” of the cache data holding unit 22 holding the instruction data are registered (S405 in FIG. 2).
[0054]
Next, the cache control unit 21 centrally processes the instruction data corresponding to the address 0x0010 as the instruction data stored in the cache data storage unit 22 for the entry “1” corresponding to the fetch address 0x0020 stored in the reuse information storage unit 24. Output to the device 1 (S408 in FIG. 2).
[0055]
With the above operation, the central processing unit 1 can obtain the requested instruction data at the address 0x0020 and start executing the instruction.
Further, the information stored in the cache data holding unit 22 and the reuse information holding unit 24 change as shown in FIG. 7 by the above operation.
[0056]
Next, the central processing unit 1 requests the cache memory device 2 to issue instruction data at address 0x0024 using the fetch request signal S11 and the fetch address A11 as control signals in order to execute the subsequent instruction.
[0057]
Upon receiving this request, the cache control unit 21 determines whether or not the instruction data at the address 0x0024 exists in the cache data holding unit 22 (S401 in FIG. 2). As a result, since the cache data holding unit 22 does not hold the instruction data corresponding to the address 0x0024, the cache control unit 21 determines whether the pointer corresponding to the instruction data at the address 0x0024 is registered in the reuse information holding unit 24. It is determined whether or not it is (S402 in FIG. 2).
[0058]
As a result, since the reuse information holding unit 24 holds the pointer corresponding to the instruction data at the address 0x0024, the cache control unit 21 sets the entry “1” corresponding to the fetch address 0x0024 stored in the reuse information holding unit 24. The instruction data corresponding to the address 0x0014 is actually output to the central processing unit 1 as the instruction data stored in the cache data holding unit 22 ("S408" in FIG. 2).
[0059]
Through the above operation, the central processing unit 1 can obtain the requested instruction data at the address 0x0024 and start executing the instruction.
Thereafter, since the reuse information holding unit 24 holds the instruction data corresponding to the corresponding pointer also at the instruction data of the addresses 0x0028 and 0x002C, the operation of the reuse information holding unit 24 is performed by the operation of S408 in the flowchart of FIG. The instruction data stored in the cache data holding unit 22 is output to the central processing unit 1 for the entry “1” corresponding to the corresponding address held by.
[0060]
Next, with respect to the instruction data from address 0x0030 to address 0x005C, the cache memory device outputs the instruction data to the central processing unit 1 by the same control as the above-mentioned address from address 0x0020 to address 0x002C. The information stored in the storage 22 and the reuse information storage unit 24 change as shown in FIG.
[0061]
As described above, in the cache memory device according to the first embodiment, when the same instruction data exists in the cache data holding unit even when the repeated instruction sequence generated by the loop unrolling is executed, the reuse information is held. Since a pointer corresponding to the instruction data is stored in the section and the entry of the cache data holding section is not consumed, even when there is a repeated instruction generated by loop unrolling, without increasing the amount of hardware, The capacity consumption of the cache memory can be suppressed, and the cache memory can be used efficiently.
(Embodiment 2)
Next, a cache memory device according to a second embodiment of the present invention will be described with reference to FIGS. 3, 4, 9, 10, 11, 12, 13, and 14. FIG.
[0062]
FIG. 9 is a block diagram illustrating a configuration of a cache memory device according to the second embodiment of the present invention, and FIG. 10 is a flowchart illustrating an operation flow of the cache memory device according to the second embodiment of the present invention. FIGS. 11, 12, 13, and 14 are diagrams illustrating a state where the program developed in the second embodiment is stored in the cache data holding unit and the reuse information holding unit. It shows how it goes.
[0063]
FIG. 9 also shows a central processing unit 1 that is a component of the processor and executes instructions, and a main storage device 3 that stores instructions to be executed by the central processing unit 1.
[0064]
The central processing unit 1 is configured to sequentially execute the instructions read from the main storage device 3 via the cache memory device 5.
The cache memory device 5 includes a cache control unit 51 that controls the entire cache memory device, and command data in the main storage device 3 corresponding to an address requested by the central processing unit 1 in 16-byte units under the control of the cache control unit 51 A cache data holding unit 22 for storing a maximum of four entries, a read data holding unit 531 for storing read data D31 read when a cache miss occurred immediately before under the control of the cache control unit 51, and a read data read from the main storage device. D31, a reuse determination unit 532 that determines whether the instruction data stored in the read data holding unit 531 is the same, and reuse information corresponding to an address requested by the central processing unit 1 under the control of the cache control unit 51. And a reuse information holding unit 24 for storing up to four entries of There.
[0065]
Next, the operation of the cache memory device will be described with reference to FIG.
In FIG. 10, first, a fetch request signal S11 from the central processing unit 1 is output.
[0066]
Steps S401, S402, S403, S406, S407, and S408 are the same as the operations shown in the flowchart of FIG.
[0067]
After reading the instruction data corresponding to the fetch address A11 from the main storage device 3, the cache control unit 51 determines whether the read data D31 read from the main storage device 3 and the cache data immediately before being stored in the read data holding unit 531. It is determined whether the instruction data at the time of the miss is the same (S409).
[0068]
If they are the same, the cache control unit 51 stores the fetch address A11 and the pointer held by the read data holding unit 531 in the reuse information holding unit 24 (S410).
[0069]
If they are not the same, the fetch address A11 and the read data D31 are registered in the cache data holding unit 22 (S406), and the cache control unit 51 reads the read data D31 read from the main storage device and the cache data in which the read data D31 is stored. The entry of the holding unit 22 is stored in the read data holding unit 531 (S411).
[0070]
The operation of the cache memory device 5 configured as described above when the C language program shown in FIG. 3 is executed will be described.
The operation of the cache memory device 5 of FIG. 9 when the assembler program of FIG. 4 is executed will be described below.
[0071]
In the initial state, the cache data holding unit 22 does not hold any instruction data, the reuse information holding unit 24 does not hold any pointer, and the read data holding unit 531 does not hold any instruction data.
[0072]
First, the central processing unit 1 requests the cache memory device 5 for instruction data at address 0x0000 using the fetch request signal S11 and the fetch address A11 as control signals.
[0073]
Upon receiving this request, the cache control unit 51 determines whether or not the instruction data at the address 0x0000 exists in the cache data holding unit 22 (S401 in FIG. 10).
[0074]
As a result, since the cache data holding unit 22 does not hold the instruction data corresponding to the address 0x0000 in the initial state, the cache control unit 51 determines whether the pointer corresponding to the address 0x0000 is registered in the reuse information holding unit 24. Is determined (S402 in FIG. 10).
[0075]
As a result, since the reuse information holding unit 24 does not hold the pointer corresponding to the address 0x0000 in the initial state, the cache control unit 51 sets the access request signal S51 and the access address A51 as control signals, and The 16-byte instruction data 811 starting from address 0x0000 is read (S403 in FIG. 10).
[0076]
Next, the cache control unit 51 determines whether the instruction data 811 read from the main storage device matches the instruction data held by the read data holding unit 531 (S409 in FIG. 10).
[0077]
As a result, the read data holding unit 531 does not hold any instruction data in the initial state, and the instruction data does not match. Therefore, the cache control unit 51 caches the fetch address 0x0000 and the instruction data 811 read from the main storage device 3. It is registered in the data holding unit 22 (S406 in FIG. 10).
[0078]
Next, the cache control unit 51 stores the instruction data 811 read from the main storage device 3 and the entry (here, “0”) of the cache data holding unit storing the read data D31 in the read data holding unit 531. (S411 in FIG. 10).
[0079]
Next, the cache control unit 51 controls the cache data holding unit 22 to cause the central processing unit 1 to output the instruction data at the address 0x0000 stored in the cache data holding unit 22 (S407 in FIG. 10).
[0080]
With the above operation, the central processing unit 1 obtains the requested instruction at the address 0x0000 and starts executing the instruction.
By the above operation, the information stored in the cache data holding unit 22, the reuse information holding unit 24, and the read data holding unit 531 are stored in the cache data holding unit 22, the read data holding unit 531 as shown in FIG. Stores instruction data 811 corresponding to 0x0000, and nothing is stored in the reuse information holding unit 24.
[0081]
Next, the central processing unit 1 requests the cache memory device 5 to issue instruction data at address 0x0004 using the fetch request signal S11 and the fetch address A11 as control signals in order to execute the subsequent instruction.
[0082]
In response to this request, the cache control unit 51 determines whether or not the instruction data at the address 0x0004 exists in the cache data holding unit 22 (S401 in FIG. 10).
[0083]
As a result, since the cache data holding unit 22 holds the instruction data corresponding to the address 0x0004, the cache control unit 51 causes the central processing unit 1 to output the instruction data at the address 0x0004 stored in the cache data holding unit 22 ( S407 in FIG. 10).
[0084]
Through the above operation, the central processing unit 1 can obtain the requested instruction data at the address 0x0004 and start executing the instruction.
Thereafter, since the cache data holding unit 22 holds the instruction data corresponding to the corresponding address also for the instruction data of the addresses 0x0008 and 0x000C, the cache data holding unit 22 stores the instruction data in the operation of S407 in the flowchart of FIG. Command data to be output to the central processing unit 1.
[0085]
Next, the central processing unit 1 requests the cache memory device 5 to issue instruction data at the address 0x0010 using the fetch request signal S11 and the fetch address A11 as control signals in order to execute a subsequent instruction.
[0086]
Upon receiving this request, the cache control unit 51 determines whether or not the instruction data at the address 0x0010 exists in the cache data holding unit 22 (S401 in FIG. 10).
[0087]
As a result, since the cache data holding unit 22 does not hold the instruction data corresponding to the address 0x0010, the cache control unit 51 determines whether the pointer corresponding to the address 0x0010 is registered in the reuse information holding unit 24. (S402 in FIG. 10).
[0088]
As a result, since the reuse information holding unit 24 does not hold the pointer corresponding to the address 0x0010, the cache control unit 51 uses the access request signal S51 and the access address A51 as control signals, and stores the address 0x0010 from the main storage device 3. The first 16 bytes of instruction data 812 are read (S403 in FIG. 10).
[0089]
Next, the cache control unit 51 determines whether the instruction data 812 read from the main storage device matches the instruction data held by the read data holding unit 531 (S409 in FIG. 10).
[0090]
As a result, since the instruction data 811 held by the read data holding unit 531 does not match the instruction data 812 read from the main storage device 3, the fetch address 0x0010 and the instruction data 812 read from the main storage device 3 are It is registered in the cache data holding unit 22 (S406 in FIG. 10).
[0091]
Next, the cache control unit 51 stores the instruction data 812 read from the main storage device 3 and the entry (here, “1”) of the cache data holding unit 22 in which the instruction data 812 is stored, in the read data holding unit. 531 (S411 in FIG. 10).
[0092]
Next, the cache control unit 51 outputs the instruction data at the address 0x0010 stored in the cache data holding unit 22 to the central processing unit 1 (S407 in FIG. 10). With the above operation, the central processing unit 1 obtains the requested instruction data at the address 0x0010 and starts executing the instruction.
[0093]
Next, for the instruction data at addresses 0x0014, 0x0018, and 0x001C, the cache memory device 5 outputs the instruction data to the central processing unit 1 under the same control as the addresses 0x0004, 0x0008, and 0x000C described above. As a result, the information stored in the cache data holding unit 22, the reuse information holding unit 24, and the read data holding unit 531 changes as shown in FIG.
[0094]
Next, the central processing unit 1 requests the instruction data at the address 0x0020 to the cache memory device 5 using the fetch request signal S11 and the fetch address A11 as control signals to execute the subsequent instruction.
[0095]
Since the cache data holding unit 22 and the reuse information holding unit 24 do not hold the corresponding addresses, the cache control unit 51 uses the access request signal S51 and the access address A51 as control signals, and stores the address 0x0020 from the main storage device 3. The first 16 bytes of instruction data 813 are read (S403 in FIG. 10).
[0096]
Next, the cache control unit 51 determines whether the instruction data 813 read from the main storage device matches the instruction data held by the read data holding unit 531 (S409 in FIG. 10).
[0097]
As a result, since the instruction data 812 stored in the read data holding unit 531 matches the instruction data 813 read from the main storage device 3, the cache control unit 51 stores the fetch address 0x0020 in the reuse information holding unit 24 with the fetch address 0x0020. The entry number “1” stored in the data holding unit is registered (S410 in FIG. 10).
[0098]
Next, the cache control unit 51 determines that the entry data “1” corresponding to the fetch address 0x0020 stored in the reuse information storage unit 24 is the instruction data actually stored in the cache data storage unit 22 as the instruction data corresponding to the address 0x0010. Is output to the central processing unit 1 (S408 in FIG. 10).
[0099]
With the above operation, the central processing unit 1 can obtain the requested instruction data at the address 0x0020 and start executing the instruction.
Further, by the above operation, the information stored in the cache data holding unit 22, the reuse information holding unit 24, and the read data holding unit 531 change as shown in FIG.
[0100]
Next, the central processing unit 1 requests the instruction data at the address 0x0024 to the cache memory device 5 using the fetch request signal S11 and the fetch address A11 as control signals to execute the subsequent instruction.
[0101]
Upon receiving this request, the cache control unit 51 determines whether or not the instruction data at the address 0x0024 exists in the cache data holding unit 22 (S401 in FIG. 10).
[0102]
As a result, since the cache data holding unit 22 does not hold the instruction data corresponding to the address 0x0024, the cache control unit 51 determines whether the pointer corresponding to the instruction data at the address 0x0024 is registered in the reuse information holding unit 24. Is determined (S402 in FIG. 10).
[0103]
As a result, since the reuse information holding unit 24 holds the pointer corresponding to the instruction data at the address 0x0024, the cache control unit 51 sets the entry “1” corresponding to the fetch address 0x0024 stored in the reuse information holding unit 24. The instruction data (actually, the instruction data corresponding to the address 0x0014) stored in the cache data holding unit 22 is output to the central processing unit 1 (S408 in FIG. 10).
[0104]
Through the above operation, the central processing unit 1 can obtain the requested instruction data at the address 0x0024 and start executing the instruction.
Thereafter, since the reuse information holding unit 24 holds the instruction data corresponding to the corresponding address also for the instruction data at the addresses 0x0028 and 0x002C, the reuse information holding unit 24 performs the operation of S408 in the flowchart of FIG. The instruction data stored in the cache data holding unit 22 for the entry “1” corresponding to the held address is output to the central processing unit 1.
[0105]
Next, with respect to the instruction data from address 0x0030 to address 0x005C, the cache memory device outputs the instruction data to the central processing unit 1 by the same control as the above-mentioned address from address 0x0020 to address 0x002C. The information stored in the storage unit 22 and the information stored in the reuse information storage unit 24 change as shown in FIG.
[0106]
As described above, in the cache memory device according to the second embodiment, when the same instruction data exists in the cache data holding unit even when the repeated instruction sequence generated by the loop unrolling is executed, the reuse information is held. A storage unit for storing a pointer corresponding to the instruction data, and further comprising a reuse determination unit for comparing the instruction data read from the main storage device with the instruction data read at the time of the immediately preceding cache miss. The target of comparison of the instruction data read from the main memory can be limited to the instruction data read immediately before from the main storage device. Even if there is a repeated instruction generated by loop unrolling, the amount of hardware can be reduced. It is possible to reduce cache memory capacity consumption and increase the efficiency of cache memory usage without increasing Kill.
(Embodiment 3)
Next, a cache memory device according to the third embodiment of the present invention will be described with reference to FIGS. 3, 4, 15, 15, 16, 17, 18, 19, and 20. FIG.
[0107]
FIG. 15 is a block diagram showing a configuration of the cache memory device according to the third embodiment of the present invention, and FIG. 16 is a flowchart showing an operation flow of the cache memory device according to the third embodiment of the present invention. FIG. 17, FIG. 18, FIG. 19, and FIG. 20 are diagrams illustrating an example in which the program developed in the third embodiment is stored in the fetch line holding unit and the reuse information holding unit. It shows how it goes.
[0108]
FIG. 15 also shows a central processing unit 1 that is a component of the processor and executes instructions, and a main storage device 3 that stores instructions to be executed by the central processing unit 1.
[0109]
The central processing unit 1 is configured to sequentially execute the instructions read from the main storage device 3 via the cache memory device 6.
The cache memory device 6 includes a cache control unit 61 that controls the entire cache memory device, and instruction data in the main storage device 3 corresponding to an address requested by the central processing unit 1 in 16-byte units under the control of the cache control unit 61 A fetch line holding unit 631 for storing instruction data of a cache line that has just hit a cache hit immediately before being held by the cache data holding unit under the control of the cache control unit 61 under the control of the cache control unit 61; From the read data D31 read from the fetch line holding unit 631, the reuse determination unit 632 that determines whether the instruction data is the same as the instruction data stored in the fetch line holding unit 631, and the fetch address A11 and the fetch address A11 according to the control of the cache control unit 51. Up to the corresponding pointer And a re-use information holding unit 24 for entry storage.
[0110]
In FIG. 16, this control flow is started when the central processing unit 1 outputs a fetch request signal S11.
Steps S401, S402, S403, S406, S407, and S408 are the same as the operations shown in the flowchart of FIG.
[0111]
After reading the instruction data corresponding to the fetch address in S403, the cache control unit 61 determines whether the read data D31 read from the main storage device 3 is the same as the instruction data stored in the fetch line holding unit 631. It is determined whether or not it is (S412).
[0112]
If they match, the cache control unit 61 controls the reuse information holding unit 24, and stores the fetch address A11 and the pointer held by the fetch line holding unit 631 in the reuse information holding unit 24 (S413).
[0113]
After outputting the instruction data to the central processing unit 1 in S407, the cache control unit 61 stores a pointer to the cache line containing the instruction data output from the cache data holding unit 22 to the central processing unit 1 and the cache line. The stored instruction data is stored in the fetch line holding unit 631 (S414).
[0114]
The operation of the cache memory device 6 configured as described above when the C language program shown in FIG. 3 is executed will be described.
The assembler program shown in FIG. 4 is an example of the result of compiling the C language program shown in FIG. 3 with loop unrolling. In this example, the instruction of the processor has a fixed length of 4 bytes.
[0115]
The operation when the assembler program of FIG. 4 is executed on the cache memory device 6 of FIG. 15 will be described below.
In the initial state, the cache data holding unit 22 does not hold any instruction data, the reuse information holding unit 24 does not hold any pointer, and the fetch line holding unit 631 does not hold any instruction data. .
[0116]
The central processing unit 1 requests the cache memory device 6 to supply the instruction at the address 0x0000 by controlling the fetch request signal S11 and the fetch address A11.
Upon receiving this request, the cache control unit 61 controls the cache data holding unit 22 and determines whether or not an instruction at the address 0x0000 exists in the cache data holding unit 22 (S401 in FIG. 16).
[0117]
As a result, since the cache data holding unit 22 does not hold the instruction data corresponding to the address 0x0000 in the initial state, the cache control unit 61 registers the pointer corresponding to the address of the address 0x0000 in the reuse information holding unit 24. It is determined whether or not it has been performed (S402 in FIG. 16).
[0118]
As a result, since the reuse information holding unit 24 does not hold the pointer corresponding to the address 0x0000 in the initial state, the cache control unit 61 uses the access request signal S21 and the access address A21 as control signals, The 16-byte instruction data 811 starting at address 0x0000 is read (operation of S403 in FIG. 16).
[0119]
Next, the cache control unit 61 determines whether the instruction data 811 read from the main storage device matches the instruction data held by the read data holding unit 631 (operation S412 in FIG. 16).
[0120]
As a result, the read data holding unit 631 does not hold any instruction data in the initial state, and the instruction data does not match. It is registered in the cache data holding unit 22 (operation of S406 in FIG. 16).
[0121]
Next, the cache control unit 61 outputs the instruction data at the address 0x0000 stored in the cache data holding unit 22 to the central processing unit 1 (operation of S407 in FIG. 16).
[0122]
Next, the cache control unit 61 stores a pointer “0” to the cache line including the instruction data at the address 0x0000 output from the cache data holding unit to the central processing unit 1 and fetches the instruction data included in the cache line into the fetch line. It is stored in the holding unit 631.
[0123]
With the above operation, the central processing unit 1 obtains the requested instruction data at the address 0x0000 and starts executing the instruction.
By the above operation, the information stored in the cache data holding unit 22, the reuse information holding unit 24, and the fetch line holding unit 631, respectively, becomes as shown in FIG.
[0124]
Next, the central processing unit 1 requests the cache memory device 5 to supply the instruction data at the address 0x0004 using the fetch request signal S11 and the fetch address A11 as control signals in order to execute the subsequent instruction.
[0125]
Upon receiving this request, the cache control unit 51 determines whether or not the instruction data at the address 0x0004 exists in the cache data holding unit 22 (operation of S401 in FIG. 16).
[0126]
As a result, since the cache data holding unit 22 holds the instruction data corresponding to the address 0x0004, the cache control unit 51 outputs the instruction data at the address 0x0004 stored in the cache data holding unit 22 to the central processing unit 1. (Operation of S407 in FIG. 16).
[0127]
Next, the cache control unit 61 stores a pointer “0” to the cache line containing the instruction data at the address 0x0004 output from the cache data holding unit to the central processing unit 1 and fetches the instruction data contained in the cache line into the fetch line. The data is stored in the holding unit 631.
[0128]
Through the above operation, the central processing unit 1 can obtain the requested instruction data at the address 0x0004 and start executing the instruction.
Thereafter, since the cache data holding unit 22 holds the instruction data corresponding to the corresponding addresses also at the instruction data of the addresses 0x0008 and 0x000C, the cache data holding unit 22 stores the instruction data at the operation 407 in the flowchart of FIG. Is output to the central processing unit 1.
[0129]
Next, the central processing unit 1 requests the cache memory device 6 for instruction data at address 0x0010 using the fetch request signal S11 and the fetch address A11 as control signals in order to execute the subsequent instruction.
[0130]
Upon receiving this request, the cache control unit 61 determines whether or not the instruction data at the address 0x0010 exists in the cache data holding unit 22 (operation of S401 in FIG. 16).
[0131]
As a result, since the cache data holding unit 22 does not hold the instruction data corresponding to the address 0x0010, the cache control unit 61 determines whether a pointer to the address 0x0010 is registered in the reuse information holding unit 24. (Operation of S402 of FIG. 16).
[0132]
As a result, since the reuse information holding unit 24 does not hold the address corresponding to the address 0x0010, the cache control unit 61 uses the access request signal S61 and the access address A61 as control signals, and stores the address 0x0010 from the main storage device 3. The 16-byte instruction data 812 at the head is read (operation of S403 in FIG. 16).
[0133]
Next, the cache control unit 61 controls the reuse determination unit 632 to determine whether the instruction data 812 read from the main storage device 3 matches the instruction data held by the fetch line holding unit 631. (Operation of S412 in FIG. 16).
[0134]
As a result, since the instruction data 811 held by the fetch line holding unit 631 does not match the instruction data 812 read from the main storage device 3, the fetch address 0x0010 and the instruction data 812 read from the main storage device 3 are It is registered in the cache data holding unit 22 (operation of S406 in FIG. 16).
[0135]
Next, the cache control unit 61 outputs the instruction data at the address 0x0010 stored in the cache data holding unit 22 to the central processing unit 1 (operation of S407 in FIG. 16).
[0136]
Next, the cache control unit 61 fetches the pointer “1” to the cache line including the instruction data at the address 0x0010 output from the cache data holding unit 22 to the central processing unit 1 and the instruction data included in the cache line. It is stored in the line holding unit 631.
[0137]
With the above operation, the central processing unit 1 obtains the requested instruction data at the address 0x0010 and starts executing the instruction.
Next, for the instruction data at addresses 0x0014, 0x0018, and 0x001C, the cache memory device 6 outputs the instruction data to the central processing unit 1 under the same control as the addresses 0x0004, 0x0008, and 0x000C described above. As a result, the information respectively stored in the cache data holding unit 22 and the reuse information holding unit 24 changes as shown in FIG.
[0138]
Next, the central processing unit 1 requests the cache memory device 6 to supply the instruction data at the address 0x0020 using the fetch request signal S11 and the fetch address A11 as control signals to execute the subsequent instruction.
[0139]
Since the cache data holding unit 22 and the reuse information holding unit 24 do not hold the corresponding address, the cache control unit 61 uses the access request signal S61 and the access address A61 as control signals, and stores the address 0x0020 from the main storage device 3. The 16-byte instruction data 813 at the head is read (operation of S403 in FIG. 16).
[0140]
Next, the cache control unit 61 determines whether the instruction data 813 read from the main storage device 3 matches the instruction data 812 held by the fetch line holding unit 631 (operation of S412 in FIG. 16). ).
[0141]
As a result, the instruction data 812 stored in the fetch line holding unit 631 and the instruction data 813 read from the main storage device 3 match, so that the cache control unit 61 stores the fetch address 0x0020 in the reuse information holding unit 24 with the read address 0x0020. The pointer “1” stored in the data holding unit is registered (operation of S413 in FIG. 16).
[0142]
Next, the cache control unit 61 determines that the entry data “1” corresponding to the fetch address 0x0020 stored in the reuse information storage unit 24 is the instruction data actually stored in the cache data storage unit 22 as the instruction data corresponding to the address 0x0010. Is output to the central processing unit 1 (operation of S408 in FIG. 16).
[0143]
Next, the cache control unit 61 controls the cache data holding unit 22 and the fetch line holding unit 631, and sets a pointer to a cache line containing the instruction at the address 0x0010 output to the central processing unit 1 by the cache data holding unit. “1” and the instruction data included in the cache line are stored in the fetch line holding unit 631.
[0144]
With the above operation, the central processing unit 1 can obtain the requested instruction data at the address 0x0020 and start executing the instruction.
Further, by the above operation, the information stored in the cache data holding unit 22 and the information stored in the reuse information holding unit 24 change as shown in FIG.
[0145]
Next, the central processing unit 1 requests the cache memory device 6 to supply the instruction data at the address 0x0024 using the fetch request signal S11 and the fetch address A11 as control signals to execute the subsequent instruction.
[0146]
In response to this request, the cache control unit 61 controls the cache data holding unit 22 and determines whether or not the instruction data at the address 0x0024 exists in the cache data holding unit 22 (operation of S401 in FIG. 16).
[0147]
As a result, since the cache data holding unit 22 does not hold the instruction data corresponding to the address 0x0024, the cache control unit 61 determines whether or not the pointer corresponding to the address of the address 0x0024 is registered in the reuse information holding unit 24. Is determined (operation of S402 in FIG. 16).
[0148]
As a result, since the reuse information holding unit 24 holds the pointer corresponding to the address of the address 0x0024, the cache control unit 61 sets the pointer “1” corresponding to the fetch address 0x0024 stored in the reuse information holding unit 24. The instruction data corresponding to the address 0x0014 is actually output to the central processing unit 1 as the instruction data stored in the cache data holding unit 22 (operation of S408 in FIG. 16).
[0149]
Next, the cache control unit 61 stores a pointer “1” to the cache line containing the instruction data at the address 0x0010 output from the cache data holding unit to the central processing unit 1 and fetches the instruction data contained in the cache line into the fetch line. The information is stored in the holding unit 631 (operation of S414 in FIG. 16).
[0150]
Through the above operation, the central processing unit 1 can obtain the requested instruction data at the address 0x0024 and start executing the instruction.
Thereafter, since the reuse information holding unit 24 holds the pointer corresponding to the corresponding address also for the instruction data of the addresses 0x0028 and 0x002C, the reuse information holding unit 24 operates by the operation of S408 in the flowchart of FIG. The instruction data stored in the cache data holding unit 22 for the entry “1” corresponding to the held address is output to the central processing unit 1.
[0151]
Next, for the instruction data from addresses 0x0030 to 0x005C, the cache memory device outputs the instruction data to the central processing unit 1 under the same control as the above-mentioned addresses from 0x0020 to 0x002C. The information stored in the storage 22 and the information stored in the reuse information storage unit 24 change as shown in FIG.
[0152]
As described above, in the cache memory device according to the third embodiment, when the same instruction data exists in the cache data holding unit even when the repeated instruction sequence generated by the loop unrolling is executed, the reuse information is held. Section stores a pointer corresponding to the instruction data, and limits the comparison of the instruction data to the instruction data of the cache line that has just hit the cache. In addition, the capacity consumption of the cache memory can be suppressed without increasing the amount of hardware, and the cache memory can be used efficiently.
[0153]
【The invention's effect】
As described above, in the cache memory device according to the present invention, when the same instruction data is present in the cache data holding unit even when the repeated instruction sequence generated by the loop unrolling is executed, the same is stored in the reuse information holding unit. Since the pointer corresponding to the instruction data is stored and the entry of the cache data holding unit is not consumed, even when there is a repeat instruction generated by loop unrolling, the amount of hardware in the cache memory is not increased without increasing the amount of hardware. Capacity consumption can be suppressed, and efficient use of the cache memory can be achieved.
[0154]
In addition, by providing a reuse determination unit that compares the instruction data read from the main storage device with the instruction data read at the time of the immediately preceding cache miss, the target of comparison of the instruction data read from the main storage device is set to Can be limited to the instruction data read from the main storage device, and even when there are repeated instructions generated by loop unrolling, the capacity consumption of the cache memory is suppressed without increasing the amount of hardware. However, efficient use of the cache memory can be enabled.
[0155]
Further, by limiting the comparison of the instruction data to the instruction data of the cache line that has just hit the cache, even if there is a repeated instruction generated by loop unrolling, the amount of hardware is not increased. The capacity consumption of the cache memory can be suppressed, and the cache memory can be used efficiently.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration of a cache memory device according to a first embodiment of the present invention.
FIG. 2 is a flowchart showing an operation flow of the cache memory device according to the first embodiment of the present invention;
FIG. 3 is a diagram showing a program in C language before expansion according to the first embodiment.
FIG. 4 is a diagram showing an expanded program according to the first embodiment;
FIG. 5 is a diagram illustrating an example in which a program developed in the first embodiment is stored in a cache data holding unit and a reuse information holding unit;
FIG. 6 is a diagram exemplifying a state where a program developed in the first embodiment is stored in a cache data holding unit and a reuse information holding unit;
FIG. 7 is a diagram illustrating an example of a state where a program developed in the first embodiment is stored in a cache data holding unit and a reuse information holding unit;
FIG. 8 is a diagram illustrating an example in which a program developed in the first embodiment is stored in a cache data holding unit and a reuse information holding unit;
FIG. 9 is a block diagram showing a configuration of a cache memory device according to a second embodiment of the present invention.
FIG. 10 is a flowchart showing an operation flow of the cache memory device according to the second embodiment of the present invention;
FIG. 11 is a diagram illustrating an example in which a program developed in the second embodiment is stored in a cache data holding unit, a reuse information holding unit, and a read data holding unit;
FIG. 12 is a diagram illustrating an example in which a program developed in the second embodiment is stored in a cache data holding unit, a reuse information holding unit, and a read data holding unit;
FIG. 13 is a diagram illustrating an example in which a program developed in the second embodiment is stored in a cache data holding unit, a reuse information holding unit, and a read data holding unit;
FIG. 14 is a diagram illustrating an example in which a program developed in the second embodiment is stored in a cache data holding unit, a reuse information holding unit, and a read data holding unit;
FIG. 15 is a block diagram showing a configuration of a cache memory device according to a third embodiment of the present invention.
FIG. 16 is a flowchart showing an operation flow of the cache memory device according to the third embodiment of the present invention;
FIG. 17 is a diagram illustrating an example of a state where a program developed in the third embodiment is stored in a fetch line holding unit and a reuse information holding unit;
FIG. 18 is a diagram exemplifying a state where a program developed in the third embodiment is stored in a fetch line holding unit and a reuse information holding unit;
FIG. 19 is a diagram exemplifying a state where a program developed in the third embodiment is stored in a fetch line holding unit and a reuse information holding unit;
FIG. 20 is a diagram exemplifying a state where a program developed in the third embodiment is stored in a fetch line holding unit and a reuse information holding unit;
FIG. 21 is a block diagram showing a configuration of a conventional cache memory device;
And FIG. 22 is a flowchart showing an operation flow of a conventional cache memory device.
FIG. 23 is a diagram showing a program in C language before expansion.
FIG. 24 is a diagram showing a program after expansion.
FIG. 25 is a diagram illustrating an example of a state where a program developed in the related art is stored in a cache data holding unit.
[Explanation of symbols]
1 Central processing unit
S11 Fetch request signal
A11 Fetch address
2 Cache memory device
21 Cache control unit
22 Cache data holding unit
23 Reuse determination unit
24 Reuse information storage
S21 access request signal
A21 access address
3 Main storage device
D31 Read data
5 Cache memory device
51 Cache control unit
531 Read data holding unit
532 Reuse determination unit
S51 Access request signal
A51 access address
6. Cache memory device
61 Cache control unit
631 fetch line holding unit
632 Reuse determination unit
S61 Access request signal
A61 access address
7 Cache memory device
71 Cache control unit
72 Cache data holding unit
S71 Access request signal
A71 access address
811 Instruction data
812 instruction data
813 Instruction data
814 instruction data
815 instruction data
816 instruction data
831 instruction data
832 instruction data
833 instruction data
834 instruction data
835 instruction data

Claims (4)

主記憶装置の命令データのうち過去に使用した命令データを記憶して効率的に命令フェッチするキャッシュシステムを設けたキャッシュメモリ装置であって、中央処理装置の要求するアドレスに対応した命令データを主記憶装置から読み出してそのアドレスと命令データとを記憶するキャッシュデータ保持部と、
前記中央処理装置の要求するアドレスに対応した前記キャッシュデータ保持部の命令データを指示するポインタと前記アドレスを記憶する再利用情報保持部と、
前記主記憶装置から読み出した命令データと同一の命令データが前記キャッシュデータ保持部に存在しているか否かを判断する再利用判定部と、
前記中央処理装置の要求するアドレスが前記キャッシュデータ保持部または前記再利用情報保持部に記憶されている場合には対応する命令データを前記中央処理装置に供給するキャッシュ制御部と
を有し、前記中央処理装置の要求するアドレスが前記キャッシュデータ保持部に存在する場合は前記キャッシュデータ保持部に記憶された前記中央処理装置の要求するアドレスに対応する命令データを前記中央処理装置に出力し、前記中央処理装置の要求するアドレスが前記キャッシュデータ保持部に存在せず前記再利用情報保持部に存在する場合は前記キャッシュデータ保持部に記憶された前記中央処理装置の要求するアドレスに対応するポインタによって指示された命令データを前記中央処理装置に出力し、前記中央処理装置の要求するアドレスが前記キャッシュデータ保持部にも前記再利用情報保持部にも存在しない場合は前記主記憶装置から前記中央処理装置の要求するアドレスに対応する命令データを読み出して前記中央処理装置に出力すると共に前記主記憶装置から読み出した命令データと同一の命令データが前記キャッシュデータ保持部に存在しないと判断した場合は前記キャッシュデータ保持部に前記主記憶装置から読み出した命令データおよび対応するアドレスを記憶し前記中央処理装置の要求するアドレスと異なるアドレスであっても前記主記憶装置から読み出した命令データと同一の命令データが前記キャッシュデータ保持部に存在すると判断した場合は前記主記憶装置から読み出したデータを前記キャッシュデータ保持部には記憶せずに前記アドレスと前記同一の命令データを指示するポインタを前記再利用情報保持部に記憶することを特徴とするキャッシュメモリ装置。
A cache memory device provided with a cache system for storing instruction data used in the past and efficiently fetching instruction data among instruction data in a main storage device, wherein instruction data corresponding to an address requested by a central processing unit is mainly stored. A cache data holding unit that reads from the storage device and stores the address and the instruction data;
A reuse information holding unit that stores the address and the pointer that indicates the instruction data of the cache data holding unit corresponding to the address requested by the central processing unit,
A reuse determination unit that determines whether the same instruction data as the instruction data read from the main storage device exists in the cache data holding unit;
A cache control unit that supplies corresponding instruction data to the central processing unit when an address requested by the central processing unit is stored in the cache data holding unit or the reuse information holding unit; When the address requested by the central processing unit is present in the cache data holding unit, the instruction data corresponding to the address requested by the central processing unit stored in the cache data holding unit is output to the central processing unit, When the address requested by the central processing unit does not exist in the cache data holding unit but exists in the reuse information holding unit, the pointer corresponding to the address requested by the central processing unit stored in the cache data holding unit is used. The designated instruction data is output to the central processing unit, and an address requested by the central processing unit is output. If the cache does not exist in the cache data holding unit or the reuse information holding unit, the command data corresponding to the address requested by the central processing unit is read from the main storage device and output to the central processing unit. If it is determined that the same instruction data as the instruction data read from the main storage device does not exist in the cache data holding unit, the instruction data read from the main storage device and the corresponding address are stored in the cache data holding unit. If it is determined that the same instruction data as the instruction data read from the main storage device exists in the cache data holding unit even if the address is different from the address requested by the central processing unit, the instruction data is read from the main storage device. The data is not stored in the cache data holding unit but is stored in the same address as the address. Cache memory device and to store the pointer to the instruction data to the re-use information holding unit.
前記キャッシュデータ保持部は前記主記憶装置に格納された命令データを所定のサイズのキャッシュライン単位で記憶し、
前記再利用情報保持部へ記憶するポインタとして前記キャッシュラインを指示するポインタを記憶し、
前記再利用判定部での命令データの比較を前記キャッシュライン単位で行うことを特徴とする請求項1記載のキャッシュメモリ装置。
The cache data holding unit stores the instruction data stored in the main storage device in units of cache lines of a predetermined size,
Storing a pointer indicating the cache line as a pointer to be stored in the reuse information holding unit,
2. The cache memory device according to claim 1, wherein the comparison of the instruction data in the reuse determination unit is performed for each cache line.
直前のキャッシュミスの際に前記主記憶装置から読み出した前記中央処理装置の要求するアドレスに対応した命令データを記憶するリードデータ保持部
を有し、
前記中央処理装置の要求するアドレスが前記キャッシュデータ保持部にも前記再利用情報保持部にも存在しない場合は、前記主記憶装置から前記中央処理装置の要求するアドレスに対応する命令データを読み出して前記主記憶装置に出力すると共に、前記主記憶装置から読み出した命令データと前記リードデータ保持部の命令データを比較し、一致しない場合は前記キャッシュデータ保持部に前記主記憶装置から読み出した命令データとそのアドレスを記憶し、一致した場合は前記中央処理装置の要求するアドレスと異なるアドレスであっても前記主記憶装置から読み出したデータを前記キャッシュデータ保持部には記憶せずに前記アドレスと前記同一の命令データを指示するポインタを前記再利用情報保持部に記憶することを特徴とする請求項1または請求項2記載のキャッシュメモリ装置。
A read data holding unit that stores instruction data corresponding to an address requested by the central processing unit read from the main storage device at the time of the last cache miss,
If the address requested by the central processing unit does not exist in the cache data holding unit nor in the reuse information holding unit, read instruction data corresponding to the address requested by the central processing unit from the main storage device. The command data output to the main storage device and the command data read from the main storage device are compared with the command data in the read data holding unit. If they do not match, the command data read from the main storage device is stored in the cache data holding unit. And if the addresses match, the data read from the main storage device is not stored in the cache data holding unit even if the address is different from the address requested by the central processing unit, and the address and the address are stored. A pointer pointing to the same instruction data is stored in the reuse information holding unit. Claim 1 or the cache memory apparatus according to claim 2, wherein.
直前のキャッシュヒットの際に前記キャッシュデータ保持部から出力した前記中央処理装置の要求するアドレスに対応した命令データを記憶するフェッチライン保持部
を有し、
前記中央処理装置の要求するアドレスが前記キャッシュデータ保持部にも前記再利用情報保持部にも存在しない場合は、前記主記憶装置から前記中央処理装置の要求するアドレスに対応する命令データを読み出して前記主記憶装置に出力すると共に、前記主記憶装置から読み出した命令データと前記フェッチライン保持部の命令データを比較し、一致しない場合は前記キャッシュデータ保持部に前記主記憶装置から読み出した命令データとそのアドレスを記憶し、一致した場合は前記中央処理装置の要求するアドレスと異なるアドレスであっても前記主記憶装置から読み出したデータを前記キャッシュデータ保持部には記憶せずに前記アドレスと前記同一の命令データを指示するポインタを前記再利用情報保持部に記憶することを特徴とする請求項1または請求項2記載のキャッシュメモリ装置。
A fetch line holding unit that stores instruction data corresponding to an address requested by the central processing unit output from the cache data holding unit at the time of the last cache hit,
If the address requested by the central processing unit does not exist in the cache data holding unit nor in the reuse information holding unit, read instruction data corresponding to the address requested by the central processing unit from the main storage device. The instruction data output to the main storage device and the instruction data read from the main storage device are compared with the instruction data in the fetch line holding unit. If they do not match, the instruction data read from the main storage device is stored in the cache data holding unit. And if the addresses match, the data read from the main storage device is not stored in the cache data holding unit even if the address is different from the address requested by the central processing unit, and the address and the address are stored. A pointer pointing to the same instruction data is stored in the reuse information holding unit. Motomeko 1 or the cache memory apparatus according to claim 2, wherein.
JP2002195324A 2002-07-04 2002-07-04 Cache memory device Pending JP2004038601A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002195324A JP2004038601A (en) 2002-07-04 2002-07-04 Cache memory device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002195324A JP2004038601A (en) 2002-07-04 2002-07-04 Cache memory device

Publications (1)

Publication Number Publication Date
JP2004038601A true JP2004038601A (en) 2004-02-05

Family

ID=31703731

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002195324A Pending JP2004038601A (en) 2002-07-04 2002-07-04 Cache memory device

Country Status (1)

Country Link
JP (1) JP2004038601A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014002736A (en) * 2012-06-15 2014-01-09 Apple Inc Loop buffer packing
US9471322B2 (en) 2014-02-12 2016-10-18 Apple Inc. Early loop buffer mode entry upon number of mispredictions of exit condition exceeding threshold
US9557999B2 (en) 2012-06-15 2017-01-31 Apple Inc. Loop buffer learning

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014002736A (en) * 2012-06-15 2014-01-09 Apple Inc Loop buffer packing
US9557999B2 (en) 2012-06-15 2017-01-31 Apple Inc. Loop buffer learning
US9753733B2 (en) 2012-06-15 2017-09-05 Apple Inc. Methods, apparatus, and processors for packing multiple iterations of loop in a loop buffer
US9471322B2 (en) 2014-02-12 2016-10-18 Apple Inc. Early loop buffer mode entry upon number of mispredictions of exit condition exceeding threshold

Similar Documents

Publication Publication Date Title
US6978350B2 (en) Methods and apparatus for improving throughput of cache-based embedded processors
US20050086435A1 (en) Cache memory controlling apparatus, information processing apparatus and method for control of cache memory
JP3718319B2 (en) Hardware mechanism for optimizing instruction and data prefetching
US20100250853A1 (en) Prefetch engine based translation prefetching
JPH02224023A (en) Processor control type interface having instruction stream function
US8341382B2 (en) Memory accelerator buffer replacement method and system
JP2004110786A (en) Data processor and data processing method
JPH11143775A (en) Cache memory system
US20150286484A1 (en) Processor subroutine cache
US9367455B2 (en) Using predictions for store-to-load forwarding
JP2005524170A (en) Integrated circuit with non-volatile memory and method for fetching data from said memory
JP2005536798A (en) Processor prefetching that matches the memory bus protocol characteristics
KR100985239B1 (en) Reducing cache trashing of certain pieces
JP2009116621A (en) Arithmetic processing apparatus
JP4144990B2 (en) Data processing system and initialization method
JP2004192403A (en) Information processing system and method for managing data in cache memory
JP2004038601A (en) Cache memory device
JP2009093559A (en) Processor, information processing device and cache control method of processor
US9645825B2 (en) Instruction cache with access locking
US12106110B2 (en) Multiple interfaces for multiple threads of a hardware multi-thread microprocessor
JP2014194586A (en) Semiconductor device
JP2003162446A (en) Microcomputer
JP2008090411A (en) Information processor, instruction control mechanism and instruction control method
JP5644539B2 (en) Processor, information processing apparatus, information processing method, and system startup program
JP2000347934A (en) Cache memory device