JP2004240783A - Simulator - Google Patents

Simulator Download PDF

Info

Publication number
JP2004240783A
JP2004240783A JP2003030187A JP2003030187A JP2004240783A JP 2004240783 A JP2004240783 A JP 2004240783A JP 2003030187 A JP2003030187 A JP 2003030187A JP 2003030187 A JP2003030187 A JP 2003030187A JP 2004240783 A JP2004240783 A JP 2004240783A
Authority
JP
Japan
Prior art keywords
access
cache
memory model
cache memory
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
JP2003030187A
Other languages
Japanese (ja)
Inventor
Takeshi Ishigure
毅 石槫
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.)
Oki Electric Industry Co Ltd
Original Assignee
Oki Data Corp
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 Oki Data Corp filed Critical Oki Data Corp
Priority to JP2003030187A priority Critical patent/JP2004240783A/en
Publication of JP2004240783A publication Critical patent/JP2004240783A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To realize a simulator capable of saving the system resources of a host to be simulated. <P>SOLUTION: A cache hit determination means 8 determines a cache hit when an access request address coincides with tag information stored in a tag information storage means 10 and a status bit in a status information storage means 11 is valid. When the cache hit determination means 8 determines the cache hit, an access time calculation means 9 counts the operation time of the access as access time to a cache memory model 2. Even when the cache is hit, an access means 12 accesses the information whose cache is hit with respect to a main memory model 1. <P>COPYRIGHT: (C)2004,JPO&NCIPI

Description

【0001】
【発明の属する技術分野】
本発明は、ハードウェアの制御にCPUを利用する装置を、ワークステーションなどのホスト上でその動作を再現するシミュレータに関する。
【0002】
【従来の技術】
従来、ワークステーションなどのホスト上で、あるターゲットのハードウェアをモデル化し、そのCPUモデルの動作を模擬(シミュレート)し、そのターゲットの動作に必要な時間を積算するシミュレータがあった。
このようなシミュレータは、命令を一つずつ命令メモリから取り出し、解析した結果に基づき逐一実行し、必要時間を算出する方法で処理を進めていた(例えば、特許文献1参照。)。
【0003】
図9は、従来のシミュレータの構成図である。
図示のように、シミュレータは、ROMモデルとRAMモデルから構成されている主メモリモデル101、キャッシュコントローラモデルとRAMモデルで構成されているキャッシュメモリモデル102、主メモリモデル101に格納されている命令を解釈し実行するCPUモデル103と、CPUモデル103等が必要としたシミュレーション時間を測定する計数部104からなる。また、キャッシュメモリモデル102は、第1レベル(L1)キャッシュメモリモデル105(命令用第1レベル(L1)キャッシュメモリモデル105aおよびデータ用第1レベル(L1)キャッシュメモリモデル105b)と、第2レベル(L2)キャッシュメモリモデル106からなる。
【0004】
このようなキャッシュメモリモデル102は、ホストのメモリ上にキャッシュメモリの動作を模擬するためのキャッシュ情報格納モデル107を設けている。キャッシュ情報格納モデル107は、キャッシュメモリモデル102に格納している情報(命令・データ)に対応する主メモリモデル101のアドレスを記憶しているタグ108と、キャッシュの状態を示す状態ビット109と、情報を格納しているメモリ領域110からなる。
【0005】
キャッシュメモリは、ラインと呼ばれる単位で管理されており、1ラインには連続したアドレスを持つ複数バイトの情報が格納されている(ここでは16バイト単位とする)。例えば、アドレス0x12345670から0x1234567Fの値がキャッシュメモリにキャッシュされている場合、タグ108の値は0x1234567であり、そのラインに0x12345670から0x1234567F迄の値がキャッシュされている。ライン当たりのバイト数は、シミュレータの初期設定において適当な大きさにすることが可能である。また、L2キャッシュメモリのラインは、L1キャッシュメモリのそれ以上の大きさとなっている。
状態ビット109はライン毎に設定されており、そのラインのキャッシュが有効・変更済み・無効等の状態を表している。
【0006】
図10は、従来のシミュレータの全体の処理を示すフローチャートである。
先ず、CPUモデル103は実行すべき命令のアドレスを取得する(ステップS101)。次に、キャッシュメモリモデル102をチェックし、命令取得時間(ペナルティ)を算出し、命令を読み取る(ステップS102)。その後、その命令を解釈し、実行する(ステップS103)。実行の際、データの読み取り・書き込みが必要ならば、キャッシュメモリモデル102をチェックし、データ取得時間(ペナルティ)を算出し、データの読み書きを行う(ステップS104、S105)。次に、実行にかかった時間を計算し、CPUモデル103のサイクル(シミュレーション時間)を更新する(ステップS106)。最後に、模擬終了の判定を行う(ステップS107)。
【0007】
図11は、従来のシミュレータにおけるキャッシュチェックの処理を示すフローチャートである。
先ず、該当する命令用またはデータ用L1キャッシュメモリモデル105a、105bのタグ108を検索し(ステップS201)、該当するタグがあるかを調べる(ステップS202)。このステップS202において、該当するタグが無ければL2キャッシュメモリモデル106のタグ108を検索する(ステップS202)。それでも該当するタグが無ければキャッシュミスとなる。一方、ステップS202において、キャッシュメモリモデル102内のタグがあった、つまりキャッシュヒットならば、状態ビット109を調査し(ステップS203)、無効でなければキャッシュヒットとなる。キャッシュヒットしたのならば、ペナルティを算出し(ステップS204)、該当するキャッシュメモリモデル102のメモリ領域110より命令・データの読み書きを行い、必要に応じて状態ビット109を変更する(ステップS205)。キャッシュミスしたのならば、ペナルティを算出し(ステップS206)、主メモリモデル101より命令・データの読み書きを行い、該当するキャッシュしているメモリの内容とタグと状態ビットを更新する(ステップS207)。
【0008】
【特許文献1】
特開2001−249829号公報
【0009】
【発明が解決しようとする課題】
しかしながら、上記のような従来のシミュレータでは、キャッシュメモリモデルの分だけ、シミュレーションするホストのメモリを使用してしまい、ホストのシステムリソースを圧迫する恐れがあった。
また、毎回、キャッシュメモリをチェックするため、シミュレータとしての動作速度が低下してしまう、特に、タグを検索するための時間が多くかかってしまうという問題点を有していた。
【0010】
【課題を解決するための手段】
本発明は、前述の課題を解決するため次の構成を採用する。
本発明のシミュレータは、主メモリと、キャッシュメモリと、演算処理装置とを備えた情報処理装置のプログラム実行動作を模擬し、その動作時間を計数するシミュレータにおいて、キャッシュメモリの動作を模擬するキャッシュメモリモデルに格納されている情報に対応させた、主メモリの動作を模擬する主メモリモデルのアドレス情報をタグ情報として格納するタグ情報格納手段と、キャッシュメモリモデルに格納されている情報と、その情報に対応する主メモリモデルに格納された情報との一致状態を示す状態情報を格納する状態情報格納手段と、キャッシュメモリモデルに対するアクセス要求を検出した場合、そのアクセス要求のアドレスが、タグ情報格納手段で格納したタグ情報と一致し、かつ、状態情報格納手段の状態情報が一致状態であった場合に、キャッシュヒットと判定するキャッシュヒット判定手段と、キャッシュヒット判定手段がキャッシュヒットと判定した場合に、そのアクセスの動作時間をキャッシュメモリモデルに対するアクセス時間として計数するアクセス時間算出手段と、キャッシュヒット判定手段がキャッシュヒットと判定した場合は、主メモリモデルに対して情報のアクセスを行うアクセス手段とを備えたことを特徴とするものである。
【0011】
【発明の実施の形態】
以下、本発明の実施の形態を具体例を用いて詳細に説明する。
《具体例1》
〈構成〉
図1は、本発明のシミュレータの具体例1を示す構成図である。
図示のシミュレータは、主メモリモデル1、キャッシュメモリモデル2、CPUモデル3からなり、キャッシュメモリモデル2は、L1キャッシュメモリモデル4(命令用L1キャッシュメモリモデル4a、データ用L1キャッシュメモリモデル4b)、L2キャッシュメモリモデル5を含んでいる。
【0012】
主メモリモデル1は、ROMモデルとRAMモデルとからなる主メモリの動作を模擬するモデルである。命令用L1キャッシュメモリモデル4aおよびデータ用L1キャッシュメモリモデル4bは、キャッシュコントローラとRAMで構成されているL1キャッシュメモリの動作を模擬するものである。L2キャッシュメモリモデル5は、L2キャッシュメモリの動作を模擬するモデルである。CPUモデル3は、主メモリに格納されている命令を解釈し実行する演算装置の動作を模擬するモデルである。尚、本具体例でも計数部を備えているが、従来と同様の構成であるためここでの説明は省略する。
【0013】
キャッシュメモリモデル2は、キャッシュコントローラモデル6とキャッシュ情報格納モデル7を備えている。キャッシュコントローラモデル6は、キャッシュコントローラの動作を模擬するモデルであり、キャッシュヒット判定手段8とアクセス時間算出手段9を備えている。また、キャッシュ情報格納モデル7は、キャッシュメモリのタグや状態ビットといったキャッシュ情報を模擬するためのものであり、タグ情報格納手段10と状態情報格納手段11とを備えている。
【0014】
タグ情報格納手段10は、キャッシュメモリモデル2に格納されているとした情報(命令・データ)に対応させた、主メモリモデル1のアドレス情報をタグ情報として格納する機能を有している。状態情報格納手段11は、キャッシュメモリモデル2に格納されているとした情報と、この情報に対応する主メモリモデル1に格納された情報との一致状態を示す状態情報(状態ビット)を格納する機能を有している。即ち、本具体例では、キャッシュしているメモリを実装していないが、実装しているものとしてタグと状態ビットが設定されている。例えば、ラインの長さが16で、タグの値が0x1234567であったとしたら、そのラインに、アドレス0x12345670から0x1234567Fの値がキャッシュされていると見なされる。ライン当たりのバイト数は、シミュレータの初期設定において適当な大きさにすることが可能である。状態ビットは、ライン毎に設定されており、そのラインのキャッシュが有効・変更済み・無効等の状態を示している。尚、状態ビットの「変更済み」とは、キャッシュメモリに保持されているデータが変更されていることを示しており、CPUが主メモリに書き戻しを行うか否かを判断するための状態ビットである。
【0015】
キャッシュヒット判定手段8は、CPUモデル3からのキャッシュメモリモデル2に対するアクセス要求を検出した場合、そのアクセス要求のアドレスが、タグ情報格納手段10で格納したタグ情報と一致し、かつ、状態情報格納手段11の状態情報が一致状態であった場合に、キャッシュヒットと判定する機能を有している。アクセス時間算出手段9は、キャッシュヒット判定手段8がキャッシュヒットと判定した場合に、そのアクセスの動作時間をキャッシュメモリに対するアクセス時間として計数する機能を有している。
【0016】
また、本具体例のシミュレータでは、アクセス手段12を備えている。このアクセス手段12は、キャッシュヒット判定手段8がキャッシュヒットと判定した場合は、主メモリモデル1に対して、キャッシュヒットした情報のアクセスを行う機能を有している。
【0017】
〈動作〉
次に、具体例1の動作について説明する。
具体例1における全体の処理の基本的な流れは図10で示した従来の動作と同様であるため、ここでの説明は省略し、キャッシュチェックの処理を説明する。
図2は、具体例1におけるキャッシュチェックのフローチャートである。
先ず、該当するL1キャッシュメモリモデル4のタグ情報格納手段10におけるタグを検索し(ステップS1)、該当するタグがあるかを調べる(ステップS2)。無ければL2キャッシュメモリモデル5のタグを検索する。それでもなければキャッシュミスとなる。キャッシュメモリ内のタグがあった、つまりキャッシュヒットならば、状態情報格納手段11における状態ビットを調査し(ステップS3)、無効でなければキャッシュヒット判定手段8はキャッシュヒットと判定する。キャッシュヒットしたのならば、アクセス時間算出手段9は、情報取得時間(ペナルティ)を算出し、必要に応じてタグと状態ビットを変更する(ステップS4)。キャッシュミスしたのならば、情報取得時間(ペナルティ)を算出し、必要に応じてタグと状態ビットを変更する(ステップS5)。
【0018】
次に、キャッシュヒット・キャッシュミスにかかわらず、アクセス手段12は、命令またはデータを主メモリモデル1より読み取る、または、書き込む(ステップS6)。ここで、キャッシュヒットした場合には、書き込みの場合に主メモリモデル1とキャッシュメモリモデル2とのデータを一致させているため、主メモリモデル1から命令の読み取りまたはデータの読み取り・書き込みを行い、ペナルティだけをキャッシュメモリにキャッシュヒットした場合とする。即ち、アクセス時間算出手段9は、キャッシュヒットした場合のアクセス時間をCPUモデル3に通知し、実際にアクセス手段12がアクセスした時間はアクセス時間としては算出しない。尚、これらのアクセス時間は、L1キャッシュメモリモデル4でキャッシュヒットしたか、L2キャッシュメモリモデル5でキャッシュヒットしたか等に基づいてアクセス時間算出手段9において予め決められている。
【0019】
このような動作は、シミュレータの場合、キャッシュメモリモデルも実際には主メモリモデル1と同様に主メモリ上に展開されていることから、データのアクセス動作そのものは、キャッシュメモリと主メモリとでほとんど同様と見なすことができるからである。
また、データの書き込みでキャッシュヒットした場合、データは主メモリモデル1に書き込むが、その状態ビットは「変更済み」とする。これにより、実際のキャッシュメモリと同様のシミュレーションを行うことができる。
【0020】
一方、キャッシュミスの場合は、L1キャッシュメモリモデル4またはL2キャッシュメモリモデル5とCPUモデル3から主メモリモデル1へのデータアクセスが発生するため、従来と同様のペナルティの算出が可能となる。このように、キャッシュメモリにキャッシュしているメモリを省略しても、キャッシュメモリのタグと状態ビットを模擬すれば、ペナルティの算出は可能であることが分かる。
また、シミュレータであるため、主メモリとキャッシュメモリからの読み取る場合の時間はホスト上では変わらない。ただ、必要とされるリソースが軽減されるため、ホスト上の時間は短くなる場合がある。
【0021】
〈効果〉
以上のように、具体例1によれば、キャッシュメモリモデル2のタグと状態ビットに基づいてペナルティを算出し、キャッシュメモリモデルの命令またはデータへのアクセス時間とし、命令またはデータのアクセスは別途主メモリモデル1に対して行うようにしたので、模擬するホストのメモリを節約することができる。
【0022】
《具体例2》
具体例2のシミュレータは、命令の前回アクセスタグを設け、アクセス要求命令のアドレスが前回アクセスタグと一致した場合は、タグの検索および状態ビットの調査をすることなく、キャッシュヒットと判定するようにしたものである。
【0023】
〈構成〉
図3は、具体例2の構成図である。
具体例3のシミュレータは、キャッシュ情報格納モデル7として、命令用L1キャッシュメモリモデル4aに対する前回アクセスタグ情報格納手段13を備えている。
前回アクセスタグ情報格納手段13は、命令用L1キャッシュメモリモデル4aに対する前回の命令アクセスのタグ情報を保存する機能を有するものである。
【0024】
具体例2のキャッシュヒット判定手段8aは、具体例1のキャッシュヒット判定手段8と同様の機能を有する共に、キャッシュメモリに対するアクセス要求が命令アクセスで、かつ、そのアクセス要求のアドレスが前回アクセスタグ情報格納手段13の前回アクセスタグと一致した場合は、その時点でキャッシュヒットと判定する機能を有している。また、アクセス時間算出手段9は、具体例1のアクセス時間算出手段9と同様の機能を有している。
【0025】
アクセス手段12は、具体例1と同様の機能を有している。即ち、キャッシュヒット判定手段8aが、命令アクセスで前回アクセスタグと一致したことでキャッシュヒットと判定した場合は、その命令を主メモリモデル1から読み取る機能を有している。
これ以外の構成は、具体例1と同様であるため、対応する部分に同一符号を付してその説明を省略する。
【0026】
〈動作〉
具体例2においても、シミュレータとしての全体の処理の流れは具体例1と同様であるため、ここでの説明は省略し、キャッシュチェックの処理を説明する。
図4は、具体例2におけるキャッシュチェックのフローチャートである。
先ず、アクセス要求が命令の読み取りのためならば、キャッシュヒット判定手段8aは、命令のアドレスからタグを算出し、そのタグが命令用L1キャッシュメモリモデル4aに対応した前回アクセスタグ情報格納手段13の前回アクセスタグと一致するか否かを調べる(ステップS11)。一致したならば、キャッシュヒット判定手段8aはキャッシュヒットしたと見なし、アクセス時間算出手段9はペナルティの算出を行い、更にアクセス手段12によりその命令を主メモリモデル1から読み取る(ステップS15、ステップS17)。
【0027】
ここで、前回アクセスタグと命令アドレスのタグが一致しただけでキャッシュヒットと判定しているが、これは、命令用L1キャッシュメモリにはCPUからの書き込みは発生しない(状態ビットの変更も起きない)ため、前回キャッシュヒットしたライン(前回キャッシュヒットしたタグ)については必ずキャッシュヒットし、また、前回キャッシュミスしたラインであっても命令用L1キャッシュメモリが更新されているので必ずキャッシュヒットするからである。
【0028】
また、全ての命令でタグの検索を行わなくてもよいため、ホストから見たシミュレータの速度を向上させることができる。特に、これは、キャッシュメモリのサイズを大きくしたり、1ラインの大きさを大きくしたり、連続したアドレスの命令が実行された場合に顕著となる。
【0029】
一方、ステップS11において、前回アクセスタグと一致しない場合はステップS12以降の処理を行う。ステップS12〜ステップS17の処理は、具体例1におけるステップS1〜ステップS6の処理と同様である。また、ステップS18では、命令の読み取りアクセスであった場合は、アクセスした命令のアドレスから算出したタグを前回アクセスタグ情報格納手段13の前回アクセスタグに保存し、終了する。
【0030】
〈効果〉
以上のように、具体例2によれば、具体例1の構成に加えて、命令アクセスのための前回アクセスタグ情報格納手段13を設け、命令のアクセス要求のタグが前回アクセスタグと一致した場合は、直ちにキャッシュヒットと判定するようにしたので、シミュレータとしての速度向上を図ることができる。
【0031】
《具体例3》
具体例3は、データ用の前回アクセスタグと前回アクセス状態ビットを設け、アクセス要求データのアドレスが前回アクセスタグと一致し、かつ、その状態ビットが有効であった場合は、タグを検索することなく、キャッシュヒットと判定するようにしたものである。
【0032】
〈構成〉
図5は、具体例3の構成図である。
具体例3のシミュレータは、キャッシュ情報格納モデル7として、データ用L1キャッシュメモリモデル4bに対する前回アクセスタグ情報格納手段14と前回状態情報格納手段15を備えている。
前回アクセスタグ情報格納手段14は、データ用L1キャッシュメモリモデル4bに対する前回のデータアクセスのタグ情報を保存する機能を有し、リード用前回アクセスタグ14aとライト用前回アクセスタグ14bを備えている。これらは、データのリードとライトとに対応した前回アクセスタグを保存するためのものである。
【0033】
前回状態情報格納手段15は、リード用前回アクセスタグ14aおよびライト用前回アクセスタグ14bに対応した状態ビットを示すものであり、これらの前回アクセスタグに対応して、リード用前回アクセス状態ビット15aおよびライト用前回アクセス状態ビット15bを備えている。
【0034】
具体例3のキャッシュヒット判定手段8bは、キャッシュメモリに対するアクセス要求がデータであり、かつ、そのデータのアドレスが前回アクセスタグ情報格納手段14のリード用前回アクセスタグ14aまたはライト用前回アクセスタグ14bのタグと一致し、かつ、一致したリード用前回アクセスタグ14aまたはライト用前回アクセスタグ14bに対応したリード用前回アクセス状態ビット15aまたはライト用前回アクセス状態ビット15bの状態ビットが有効であった場合は、その時点でキャッシュヒットと判定する機能を有している。尚、このようにリード用/ライト用のアクセスタグおよび状態ビットを設けているため、リード/ライトを区別しない場合に比べて前回アクセスタグに一致する確率は高くなる。
図5における他の各構成は、具体例1、2と同様であるため、対応する部分に同一符号を付してその説明を省略する。
【0035】
〈動作〉
具体例3においても、シミュレータとしての全体の処理の流れは具体例1、2と同様であるため、ここでの説明は省略し、キャッシュチェックの処理を説明する。
図6は、具体例3におけるキャッシュチェックのフローチャートである。
先ず、データの読み取り(書き込み)のためならば、そのアドレスからタグを算出し、そのタグがリード用前回アクセスタグ14aまたはライト用前回アクセスタグ14bと一致するか否かを調べる(ステップS21)。一致するならば、更にリード用前回アクセス状態ビット15aまたはライト用前回アクセス状態ビット15bを調べ(ステップS22)、その状態ビットが無効でなければキャッシュヒット判定手段8bはキャッシュヒットしたと見なす。そしてキャッシュヒット判定手段8bがキャッシュヒットと判定した場合は、アクセス時間算出手段9はペナルティの算出を行い、また、アクセス手段12は主メモリモデル1からデータを読み取るまたは書き込む(ステップS26、ステップS28)。
【0036】
ここで、リード用前回アクセスタグ14aまたはライト用前回アクセスタグ14bと、アクセス要求データのアドレスのタグが一致し、リード用前回アクセス状態ビット15aまたはライト用前回アクセス状態ビット15bが無効でなければキャッシュヒットとしているが、これは、前回キャッシュヒットしたライン(前回キャッシュヒットしたタグ)で、前回アクセス状態ビットが無効でなければ必ずキャッシュヒットし、また、前回キャッシュミスしたラインであっても、データ用L1キャッシュメモリモデル4bが更新され、リード用前回アクセス状態ビット15aまたはライト用前回アクセス状態ビット15bが無効でなければキャッシュヒットするからである。
尚、キャッシュの書き込みの際に状態ビットを無効とする場合があるため、状態ビットを必ずチェックしている。
【0037】
また、全てのデータでタグの検索を行わなくてよいため、ホストから見たシミュレータの速度を向上させることができる。特に、これは、キャッシュメモリのサイズを大きくしたり、1ラインの大きさを大きくしたり、データアクセスが連続したアドレスに発生した場合に顕著となる。
【0038】
一方、ステップS21において、リード用前回アクセスタグ14aまたはライト用前回アクセスタグ14bと一致しない場合およびステップS22において、リード用前回アクセス状態ビット15aまたはライト用前回アクセス状態ビット15bが無効であった場合は、ステップS23以降の処理を行う。ステップS23〜ステップS28の処理は、具体例1におけるステップS1〜ステップS6の処理と同様である。また、ステップS29では、リード用前回アクセスタグ14aまたはライト用前回アクセスタグ14bに、アクセスしたデータのアドレスから算出したタグを保存し、かつ、リード用前回アクセス状態ビット15aまたはライト用前回アクセス状態ビット15bを更新する。
【0039】
〈効果〉
以上説明したように、具体例3によれば、データ用L1キャッシュメモリモデル4bに対応した前回アクセスタグ情報格納手段14と前回アクセスタグ情報格納手段14とを設け、アクセス要求データのタグと、前回アクセスタグが一致し、かつ、その前回状態ビットが無効でなかった場合は、即座にキャッシュヒットと判定するようにしたので、ホストから見たシミュレータの速度を向上させることができる。
【0040】
《具体例4》
具体例4は、L2キャッシュメモリモデル5へのデータアクセス時のシミュレーションに関するものである。
【0041】
〈構成〉
図7は、具体例4の構成図である。
具体例4のシミュレータは、キャッシュ情報格納モデル7として、L2キャッシュメモリモデル5に対する前回アクセスタグ情報格納手段16と前回状態情報格納手段17を備えている。
前回アクセスタグ情報格納手段16は、L2キャッシュメモリモデル5に対する前回の命令アクセスとデータアクセスのタグ情報を保存する機能を有し、命令用前回アクセスタグ16aとデータ用前回アクセスタグ16bを備えている。これらは、命令とデータに対応した前回アクセスタグを保存するためのものである。
前回状態情報格納手段17は、データ用前回アクセス状態ビット17aを備えている。このデータ用前回アクセス状態ビット17aは、データ用前回アクセスタグ16bに対応したデータに対応した状態ビットを示すものである。
【0042】
具体例4のキャッシュヒット判定手段8cは、キャッシュメモリに対するアクセス要求が命令であり、かつ、そのアクセス要求のアドレスが命令用前回アクセスタグ16aと一致した場合、および、キャッシュメモリに対するアクセス要求がデータであり、かつ、そのアクセス要求のアドレスがデータ用前回アクセスタグ16bと一致すると共に、データ用前回アクセス状態ビット17aが有効であった場合は、その時点でキャッシュヒットと判定する機能を有している。
図7における他の各構成は、具体例1〜3と同様であるため、対応する部分に同一符号を付してその説明を省略する。
【0043】
〈動作〉
具体例4においても、シミュレータとしての全体の処理の流れは具体例1〜3と同様であるため、ここでの説明は省略し、キャッシュチェックの処理を説明する。
図8は、具体例4におけるキャッシュチェックのフローチャートである。
L1キャッシュメモリモデル4からL2キャッシュメモリモデル5へのアクセスが発生した場合、そのアドレスからタグを算出し、命令用前回アクセスタグ16aまたはデータ用前回アクセスタグ16bと一致するか否かを調べる(ステップS31)。どちらかのタグが一致した場合、データアクセスか否かを判定する(ステップS32)。このステップS32においてデータアクセスでない、つまり命令アクセスならば、その時点でL2キャッシュメモリモデル5のキャッシュヒットと見なす。
【0044】
ステップS32において、データアクセスであったならばデータ用前回アクセス状態ビット17aを調べ(ステップS33)、状態ビットが無効でなければ、L2キャッシュメモリモデル5のキャッシュヒットと見なす。L2キャッシュメモリモデル5のキャッシュヒットと見なされたならば、アクセス時間算出手段9はペナルティの算出を行い、また、アクセス手段12により、主メモリモデル1から命令を読み取る、またはデータのリード/ライトを行う(ステップS37、ステップS39)。
【0045】
ここで、命令用前回アクセスタグ16aまたはデータ用前回アクセスタグ16bが一致し、また、データの場合はデータ用前回アクセス状態ビット17aが無効でなければキャッシュヒットとしている。これは、命令の場合はL2キャッシュメモリにはCPUからの書き込みは発生しない(状態ビットの変更も起きない)ため、前回キャッシュヒットしたライン(前回キャッシュヒットしたタグ)については必ずキャッシュヒットし、また、前回キャッシュミスしたラインであっても、L2キャッシュメモリが更新されているので必ずキャッシュヒットするからである。
尚、データの場合、キャッシュの書き込みの際に状態ビットを無効とすることがあるため、状態ビットを必ずチェックしている。
【0046】
また、全てのデータでタグの検索を行わなくてよいため、ホストから見たシミュレータの速度を向上させることができる。特に、これは、キャッシュメモリのサイズを大きくしたり、1ラインの大きさを大きくしたり、データアクセスが連続したアドレスに発生した場合に顕著となる。
【0047】
一方、ステップS31において、命令用前回アクセスタグ16aまたはデータ用前回アクセスタグ16bと一致しない場合およびステップS33において、データ用前回アクセス状態ビット17aが無効であった場合は、ステップS34以降の処理を行う。ステップS34〜ステップS39の処理は、具体例1におけるステップS1〜ステップS6の処理と同様である。
また、ステップS40では、アクセスした命令やデータのアドレスから算出したタグ、状態ビットを、命令用前回アクセスタグ16aやデータ用前回アクセスタグ16bおよびデータ用前回アクセス状態ビット17aに保存し、終了する。
【0048】
〈効果〉
以上説明したように、具体例4によれば、L2キャッシュメモリモデル5において、命令の読み取りの際のタグと前回アクセスタグが一致した場合、また、データの読み取り・書き込みの際のタグと、前回アクセスタグが一致し、かつ、その前回状態ビットが無効で無かった場合は、即座にキャッシュヒットと判定するようにしたので、ホストから見たシミュレータの速度を向上させることができる。
【0049】
《利用形態》
・上記具体例2では命令用L1キャッシュメモリモデル4aに関する構成、具体例3ではデータ用L1キャッシュメモリモデル4bに関する構成としたがこれらの構成を組み合わせてもよい。
・具体例3では前回アクセスタグや前回アクセス状態ビットを、リード/ライト用別々に設けたが、これらリード/ライトの区別を行わない前回アクセスタグや前回アクセス状態ビットとしてもよい。また、具体例4において、具体例3のように、前回データアクセスに関して前回アクセスタグや前回アクセス状態ビットをリード/ライト別々に設けてもよい。
【0050】
【発明の効果】
以上のように、本発明によれば、キャッシュメモリモデルにキャッシュヒットした場合は、このアクセスの動作時間をキャッシュメモリモデルに対するアクセス時間として計数し、キャッシュヒットした情報は、別途主メモリモデルに対してアクセスするようにしたので、実行時間を正確に模擬することができる、かつ、ホスト上のキャッシュメモリモデルのためのメモリ領域を不要とすることができるため、模擬するホストのシステムリソースを節約することができる。また、シミュレータの速度を向上させることができる。
【図面の簡単な説明】
【図1】本発明の具体例1のシミュレータの構成図である。
【図2】具体例1におけるキャッシュチェックのフローチャートである。
【図3】本発明の具体例2のシミュレータの構成図である。
【図4】具体例2におけるキャッシュチェックのフローチャートである。
【図5】本発明の具体例3のシミュレータの構成図である。
【図6】具体例3におけるキャッシュチェックのフローチャートである。
【図7】本発明の具体例4のシミュレータの構成図である。
【図8】具体例4におけるキャッシュチェックのフローチャートである。
【図9】従来のシミュレータの構成図である。
【図10】従来のシミュレータにおける全体の処理を示すフローチャートである。
【図11】従来のシミュレータにおけるキャッシュチェックのフローチャートである。
【符号の説明】
1 主メモリモデル
2 キャッシュメモリモデル
3 CPUモデル
4 L1キャッシュメモリモデル
5 L2キャッシュメモリモデル
8、8a、8b、8c キャッシュヒット判定手段
9 アクセス時間算出手段
10 タグ情報格納手段
11 状態情報格納手段
12 アクセス手段
13、14、16 前回アクセスタグ情報格納手段
15、17 前回状態情報格納手段
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a simulator that reproduces the operation of an apparatus using a CPU for controlling hardware on a host such as a workstation.
[0002]
[Prior art]
2. Description of the Related Art Conventionally, there has been a simulator that models the hardware of a target on a host such as a workstation, simulates (simulates) the operation of the CPU model, and integrates the time required for the operation of the target.
Such a simulator fetches instructions one by one from an instruction memory, executes the instructions one by one based on a result of analysis, and proceeds with a process of calculating a required time (for example, see Patent Document 1).
[0003]
FIG. 9 is a configuration diagram of a conventional simulator.
As shown in the figure, the simulator executes a main memory model 101 composed of a ROM model and a RAM model, a cache memory model 102 composed of a cache controller model and a RAM model, and an instruction stored in the main memory model 101. It comprises a CPU model 103 for interpretation and execution, and a counting unit 104 for measuring a simulation time required by the CPU model 103 and the like. The cache memory model 102 includes a first level (L1) cache memory model 105 (a first level (L1) cache memory model 105a for instructions and a first level (L1) cache memory model 105b for data) and a second level (L1) cache memory model 105b. (L2) The cache memory model 106 is used.
[0004]
In such a cache memory model 102, a cache information storage model 107 for simulating the operation of the cache memory is provided on the memory of the host. The cache information storage model 107 includes a tag 108 storing an address of the main memory model 101 corresponding to information (instruction / data) stored in the cache memory model 102, a state bit 109 indicating a cache state, It comprises a memory area 110 for storing information.
[0005]
The cache memory is managed in a unit called a line, and one line stores a plurality of bytes of information having a continuous address (here, a unit of 16 bytes). For example, when the values of the addresses 0x12345670 to 0x123456F are cached in the cache memory, the value of the tag 108 is 0x1234567, and the values from 0x12345670 to 0x123456F are cached in that line. The number of bytes per line can be set to an appropriate size in the initialization of the simulator. The line of the L2 cache memory is larger than that of the L1 cache memory.
The status bit 109 is set for each line, and indicates the status of the cache of the line such as valid, changed, or invalid.
[0006]
FIG. 10 is a flowchart showing the entire processing of the conventional simulator.
First, the CPU model 103 acquires an address of an instruction to be executed (step S101). Next, the cache memory model 102 is checked, an instruction acquisition time (penalty) is calculated, and the instruction is read (step S102). Thereafter, the command is interpreted and executed (step S103). At the time of execution, if data reading / writing is necessary, the cache memory model 102 is checked, a data acquisition time (penalty) is calculated, and data reading / writing is performed (steps S104, S105). Next, the time required for execution is calculated, and the cycle (simulation time) of the CPU model 103 is updated (step S106). Finally, the simulation end is determined (step S107).
[0007]
FIG. 11 is a flowchart showing a cache check process in a conventional simulator.
First, the tag 108 of the corresponding instruction or data L1 cache memory model 105a, 105b is searched (step S201), and it is checked whether there is a corresponding tag (step S202). If there is no corresponding tag in this step S202, the tag 108 of the L2 cache memory model 106 is searched (step S202). If there is no corresponding tag, a cache miss occurs. On the other hand, in step S202, if there is a tag in the cache memory model 102, that is, if there is a cache hit, the status bit 109 is checked (step S203). If a cache hit occurs, a penalty is calculated (step S204), instructions and data are read from and written to the memory area 110 of the corresponding cache memory model 102, and the status bit 109 is changed as necessary (step S205). If a cache miss has occurred, a penalty is calculated (step S206), instructions and data are read and written from the main memory model 101, and the contents, tags and status bits of the corresponding cached memory are updated (step S207). .
[0008]
[Patent Document 1]
JP 2001-249829 A
[0009]
[Problems to be solved by the invention]
However, in the above-described conventional simulator, the memory of the host to be simulated is used by the amount of the cache memory model, and there is a possibility that the system resources of the host may be squeezed.
Further, since the cache memory is checked every time, there is a problem that the operation speed as a simulator is reduced, and in particular, it takes much time to search for a tag.
[0010]
[Means for Solving the Problems]
The present invention employs the following configuration to solve the above-described problem.
A simulator according to the present invention is a simulator that simulates a program execution operation of an information processing device including a main memory, a cache memory, and an arithmetic processing device, and counts the operation time. Tag information storage means for storing, as tag information, address information of a main memory model that simulates the operation of a main memory corresponding to information stored in the model; information stored in a cache memory model; State information storage means for storing state information indicating a state of coincidence with information stored in the main memory model corresponding to the main memory model, and when an access request to the cache memory model is detected, the address of the access request is stored in the tag information storage means. And the status information in the status information storage means matches A cache hit judging means for judging a cache hit in the state, and an access time calculating means for counting an operation time of the access as an access time for the cache memory model when the cache hit judging means judges a cache hit And an access unit for accessing information in the main memory model when the cache hit determination unit determines that the cache hit has occurred.
[0011]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described in detail using specific examples.
<< Specific Example 1 >>
<Constitution>
FIG. 1 is a configuration diagram showing a specific example 1 of the simulator of the present invention.
The illustrated simulator includes a main memory model 1, a cache memory model 2, and a CPU model 3, and the cache memory model 2 includes an L1 cache memory model 4 (an instruction L1 cache memory model 4a, a data L1 cache memory model 4b), L2 cache memory model 5 is included.
[0012]
The main memory model 1 is a model that simulates the operation of a main memory including a ROM model and a RAM model. The instruction L1 cache memory model 4a and the data L1 cache memory model 4b simulate the operation of the L1 cache memory composed of a cache controller and a RAM. The L2 cache memory model 5 is a model that simulates the operation of the L2 cache memory. The CPU model 3 is a model that simulates the operation of an arithmetic unit that interprets and executes instructions stored in the main memory. Although the counting section is also provided in this specific example, the description is omitted here because it has the same configuration as the conventional one.
[0013]
The cache memory model 2 includes a cache controller model 6 and a cache information storage model 7. The cache controller model 6 is a model that simulates the operation of the cache controller, and includes a cache hit determination unit 8 and an access time calculation unit 9. The cache information storage model 7 is for simulating cache information such as a tag and a state bit of a cache memory, and includes a tag information storage unit 10 and a state information storage unit 11.
[0014]
The tag information storage means 10 has a function of storing, as tag information, address information of the main memory model 1 corresponding to information (instruction / data) assumed to be stored in the cache memory model 2. The state information storage means 11 stores state information (state bits) indicating a matching state between the information stored in the cache memory model 2 and the information stored in the main memory model 1 corresponding to this information. Has a function. That is, in this specific example, the cached memory is not mounted, but the tag and the status bit are set as mounted. For example, if the length of the line is 16 and the value of the tag is 0x1234567, it is considered that the values of the addresses 0x12345670 to 0x1234567F are cached in the line. The number of bytes per line can be set to an appropriate size in the initialization of the simulator. The status bit is set for each line, and indicates a status such as a valid / changed / invalid state of the cache of the line. The "changed" status bit indicates that the data held in the cache memory has been changed, and is a status bit for the CPU to determine whether or not to write back to the main memory. It is.
[0015]
When the cache hit determination means 8 detects an access request from the CPU model 3 to the cache memory model 2, the address of the access request matches the tag information stored in the tag information storage means 10 and the state information storage When the status information of the means 11 is in a coincidence state, it has a function of determining a cache hit. The access time calculation means 9 has a function of counting the operation time of the access as the access time to the cache memory when the cache hit determination means 8 determines that the cache hit has occurred.
[0016]
Further, the simulator of this specific example includes an access unit 12. The access unit 12 has a function of accessing the main memory model 1 with information on the cache hit when the cache hit determination unit 8 determines that the cache hit has occurred.
[0017]
<motion>
Next, the operation of the specific example 1 will be described.
Since the basic flow of the entire process in the specific example 1 is the same as the conventional operation shown in FIG. 10, the description is omitted here and the cache check process will be described.
FIG. 2 is a flowchart of a cache check in the first specific example.
First, the tag in the tag information storage unit 10 of the corresponding L1 cache memory model 4 is searched (step S1), and it is checked whether there is a corresponding tag (step S2). If not, the tag of the L2 cache memory model 5 is searched. Otherwise, a cache miss will occur. If there is a tag in the cache memory, that is, if there is a cache hit, the status bit in the status information storage means 11 is checked (step S3). If not, the cache hit determination means 8 determines that there is a cache hit. If a cache hit has occurred, the access time calculation means 9 calculates the information acquisition time (penalty), and changes the tag and the status bit as necessary (step S4). If a cache miss has occurred, the information acquisition time (penalty) is calculated, and the tag and the status bit are changed as necessary (step S5).
[0018]
Next, regardless of a cache hit or a cache miss, the access unit 12 reads or writes an instruction or data from the main memory model 1 (step S6). Here, in the case of a cache hit, since the data in the main memory model 1 and the data in the cache memory model 2 are matched in the case of writing, reading of an instruction or reading / writing of data from the main memory model 1 is performed. Assume that only a penalty is hit in the cache memory. That is, the access time calculation means 9 notifies the CPU model 3 of the access time in the case of a cache hit, and does not calculate the time actually accessed by the access means 12 as the access time. These access times are determined in advance by the access time calculation means 9 based on whether a cache hit occurs in the L1 cache memory model 4 or a cache hit occurs in the L2 cache memory model 5.
[0019]
In the case of such an operation, in the case of the simulator, since the cache memory model is actually developed on the main memory similarly to the main memory model 1, the data access operation itself is almost the same between the cache memory and the main memory. This is because they can be regarded as similar.
If a cache hit occurs during data writing, the data is written to the main memory model 1, but its status bit is "changed". As a result, a simulation similar to that of an actual cache memory can be performed.
[0020]
On the other hand, in the case of a cache miss, data access from the L1 cache memory model 4 or L2 cache memory model 5 and the CPU model 3 to the main memory model 1 occurs, so that a penalty can be calculated in the same manner as in the related art. Thus, even if the memory cached in the cache memory is omitted, the penalty can be calculated by simulating the tag and the status bit of the cache memory.
Also, since the simulator is used, the time for reading from the main memory and the cache memory does not change on the host. However, the time on the host may be reduced because the required resources are reduced.
[0021]
<effect>
As described above, according to the specific example 1, the penalty is calculated based on the tag and the status bit of the cache memory model 2, and the access time to the instruction or data of the cache memory model is used. Since the process is performed for the memory model 1, the memory of the simulated host can be saved.
[0022]
<< Specific Example 2 >>
The simulator of the specific example 2 is provided with a previous access tag of the instruction, and when the address of the access request instruction matches the previous access tag, determines that the cache hit occurs without searching the tag and checking the status bit. It was done.
[0023]
<Constitution>
FIG. 3 is a configuration diagram of the specific example 2.
The simulator of the specific example 3 includes, as the cache information storage model 7, a previous access tag information storage unit 13 for the instruction L1 cache memory model 4a.
The previous access tag information storage means 13 has a function of storing tag information of a previous instruction access to the instruction L1 cache memory model 4a.
[0024]
The cache hit judging means 8a of the specific example 2 has the same function as the cache hit judging means 8 of the specific example 1, and the access request to the cache memory is the instruction access, and the address of the access request is the last access tag information. If it matches the previous access tag in the storage unit 13, it has a function of determining a cache hit at that time. The access time calculation means 9 has the same function as the access time calculation means 9 of the first embodiment.
[0025]
The access unit 12 has a function similar to that of the first embodiment. That is, when the cache hit determination unit 8a determines that a cache hit has occurred due to a match with the previous access tag in the instruction access, the cache hit determination unit 8a has a function of reading the instruction from the main memory model 1.
The other configuration is the same as that of the first embodiment, and the corresponding portions are denoted by the same reference numerals and description thereof will be omitted.
[0026]
<motion>
Also in the specific example 2, the flow of the entire process as the simulator is the same as that of the specific example 1, so that the description here is omitted, and the cache check processing will be described.
FIG. 4 is a flowchart of the cache check in the specific example 2.
First, if the access request is for reading an instruction, the cache hit determination means 8a calculates a tag from the address of the instruction, and the tag is stored in the previous access tag information storage means 13 corresponding to the instruction L1 cache memory model 4a. It is checked whether it matches the previous access tag (step S11). If they match, the cache hit determining means 8a regards that a cache hit has occurred, the access time calculating means 9 calculates a penalty, and the access means 12 reads the instruction from the main memory model 1 (steps S15 and S17). .
[0027]
Here, the cache hit is determined only by the match between the previous access tag and the tag of the instruction address. This is because no writing from the CPU occurs in the instruction L1 cache memory (the state bit is not changed). Therefore, a cache hit always occurs for the line that has hit the previous cache (the tag that has hit the last cache), and a cache hit always occurs for the line that has missed the cache because the instruction L1 cache memory has been updated. is there.
[0028]
In addition, since it is not necessary to search for tags in all instructions, the speed of the simulator as viewed from the host can be improved. In particular, this becomes remarkable when the size of the cache memory is increased, the size of one line is increased, or instructions of consecutive addresses are executed.
[0029]
On the other hand, if it is determined in step S11 that the access tag does not match the previous access tag, the processes in and after step S12 are performed. The processing of steps S12 to S17 is the same as the processing of steps S1 to S6 in the first specific example. Further, in step S18, if the access is for reading the instruction, the tag calculated from the address of the accessed instruction is stored in the previous access tag of the previous access tag information storage unit 13, and the process ends.
[0030]
<effect>
As described above, according to the specific example 2, in addition to the configuration of the specific example 1, the previous access tag information storage unit 13 for accessing the instruction is provided, and the tag of the access request of the instruction matches the previous access tag. Is immediately determined to be a cache hit, so that the speed as a simulator can be improved.
[0031]
<< Specific Example 3 >>
Specific example 3 is to provide a previous access tag and a previous access status bit for data, and to search for a tag when the address of the access request data matches the previous access tag and the status bit is valid. Instead, it is determined to be a cache hit.
[0032]
<Constitution>
FIG. 5 is a configuration diagram of the third example.
The simulator of the specific example 3 includes, as the cache information storage model 7, a previous access tag information storage unit 14 and a previous state information storage unit 15 for the data L1 cache memory model 4b.
The previous access tag information storage unit 14 has a function of storing tag information of previous data access to the data L1 cache memory model 4b, and includes a read last access tag 14a and a write previous access tag 14b. These are for storing previous access tags corresponding to data read and write.
[0033]
The previous state information storage means 15 indicates the state bits corresponding to the previous access tag 14a for read and the previous access tag 14b for write, and the last access state bit 15a for read and It has a previous access status bit for write 15b.
[0034]
The cache hit determination unit 8b of the specific example 3 determines that the access request to the cache memory is data and the address of the data is the last access tag 14a for reading or the last access tag 14b for writing of the last access tag information storage unit 14. When the status bit of the read last access status bit 15a or write last access status bit 15b corresponding to the tag and matching the previous read access tag 14a or the previous access tag 14b for writing is valid. Has a function of determining a cache hit at that time. Since the read / write access tag and the status bit are provided in this manner, the probability that the read / write access tag matches the previous access tag becomes higher than when the read / write is not distinguished.
The other components in FIG. 5 are the same as those in the first and second embodiments. Therefore, corresponding portions are denoted by the same reference numerals and description thereof is omitted.
[0035]
<motion>
Also in the specific example 3, since the flow of the entire process as the simulator is the same as that of the specific examples 1 and 2, the description here will be omitted and the cache check processing will be described.
FIG. 6 is a flowchart of the cache check in the third example.
First, for reading (writing) data, a tag is calculated from the address, and it is checked whether the tag matches the previous access tag 14a for reading or the previous access tag 14b for writing (step S21). If they match, the previous access status bit 15a for read or the previous access status bit 15b for write is checked (step S22). If the status bit is not invalid, the cache hit determination means 8b considers that a cache hit has occurred. If the cache hit determination means 8b determines that the cache hit, the access time calculation means 9 calculates a penalty, and the access means 12 reads or writes data from the main memory model 1 (steps S26 and S28). .
[0036]
Here, if the previous access tag 14a for reading or the previous access tag 14b for writing and the tag of the address of the access request data match, and the previous access status bit 15a for reading or the previous access status bit 15b for writing is invalid, the cache This is a hit, but this is the last cache hit line (the last cache hit tag). If the last access status bit is not invalid, a cache hit will always occur. This is because the cache hit occurs unless the L1 cache memory model 4b is updated and the previous access state bit 15a for read or the previous access state bit 15b for write is invalid.
Note that the status bit is always checked because the status bit may be invalidated when writing to the cache.
[0037]
Further, since it is not necessary to search for tags in all data, the speed of the simulator viewed from the host can be improved. In particular, this becomes remarkable when the size of the cache memory is increased, the size of one line is increased, or data access occurs at consecutive addresses.
[0038]
On the other hand, if the previous access tag for reading 14a or the previous access tag for writing 14b does not match in step S21, and if the previous access status bit 15a for reading or the previous access status bit 15b for writing is invalid in step S22, , And performs the processing after step S23. The processing of steps S23 to S28 is the same as the processing of steps S1 to S6 in the first specific example. In step S29, the tag calculated from the address of the accessed data is stored in the read last access tag 14a or the write last access tag 14b, and the read last access state bit 15a or the write last access state bit 15a is stored. 15b is updated.
[0039]
<effect>
As described above, according to the specific example 3, the previous access tag information storage unit 14 and the previous access tag information storage unit 14 corresponding to the data L1 cache memory model 4b are provided, and the tag of the access request data and the previous access tag information are stored. If the access tag matches and the previous status bit is not invalid, it is immediately determined that a cache hit has occurred, so that the speed of the simulator as viewed from the host can be improved.
[0040]
<< Specific Example 4 >>
Example 4 relates to a simulation when data is accessed to the L2 cache memory model 5.
[0041]
<Constitution>
FIG. 7 is a configuration diagram of the specific example 4.
The simulator of the specific example 4 includes, as the cache information storage model 7, a previous access tag information storage unit 16 and a previous state information storage unit 17 for the L2 cache memory model 5.
The previous access tag information storage means 16 has a function of storing tag information of previous instruction access and data access to the L2 cache memory model 5, and includes an instruction previous access tag 16a and a data previous access tag 16b. . These are for storing the previous access tag corresponding to the command and the data.
The previous state information storage means 17 has a previous access state bit 17a for data. The previous access status bit for data 17a indicates a status bit corresponding to data corresponding to the previous access tag for data 16b.
[0042]
The cache hit determination means 8c of the specific example 4 determines that the access request to the cache memory is an instruction and the address of the access request matches the previous access tag 16a for the instruction, and that the access request to the cache memory is data. If the address of the access request matches the previous access tag 16b for data and the previous access status bit 17a for data is valid, a function is provided to determine a cache hit at that time. .
The other components in FIG. 7 are the same as those of the first to third examples, and the corresponding portions are denoted by the same reference numerals and description thereof will be omitted.
[0043]
<motion>
Also in the specific example 4, the flow of the entire process as the simulator is the same as that of the specific examples 1 to 3, and the description here is omitted, and the cache check processing will be described.
FIG. 8 is a flowchart of the cache check in the specific example 4.
When an access from the L1 cache memory model 4 to the L2 cache memory model 5 occurs, a tag is calculated from the address, and it is checked whether the tag matches the previous access tag for instruction 16a or the previous access tag for data 16b (step). S31). If either tag matches, it is determined whether the access is a data access (step S32). If it is not a data access in step S32, that is, if it is an instruction access, it is regarded as a cache hit of the L2 cache memory model 5 at that time.
[0044]
In step S32, if it is a data access, the previous access status bit for data 17a is checked (step S33). If the status bit is not invalid, it is regarded as a cache hit of the L2 cache memory model 5. If it is determined that the cache hit has occurred in the L2 cache memory model 5, the access time calculation means 9 calculates a penalty, and the access means 12 reads an instruction from the main memory model 1 or reads / writes data. Perform (Step S37, Step S39).
[0045]
Here, the previous access tag 16a for instruction or the previous access tag 16b for data matches, and in the case of data, unless the previous access status bit 17a for data is invalid, a cache hit is determined. This is because, in the case of an instruction, writing from the CPU does not occur in the L2 cache memory (the state bit does not change), so that the line that has hit the cache previously (the tag that has hit the previous cache) always hits the cache. This is because the L2 cache memory is updated even if the line has a cache miss last time, so that a cache hit always occurs.
In the case of data, the status bit is always checked because the status bit may be invalidated when writing to the cache.
[0046]
Further, since it is not necessary to search for tags in all data, the speed of the simulator viewed from the host can be improved. In particular, this becomes remarkable when the size of the cache memory is increased, the size of one line is increased, or data access occurs at consecutive addresses.
[0047]
On the other hand, if the previous access tag for instruction 16a or the previous access tag for data 16b does not match in step S31, and if the previous access status bit for data 17a is invalid in step S33, the processing after step S34 is performed. . Steps S34 to S39 are the same as steps S1 to S6 in the first specific example.
In step S40, the tag and the status bit calculated from the address of the accessed instruction or data are stored in the previous access tag for instruction 16a, the previous access tag for data 16b, and the previous access status bit for data 17a, and the process ends.
[0048]
<effect>
As described above, according to the specific example 4, in the L2 cache memory model 5, when the tag at the time of reading an instruction matches the previous access tag, or when reading and writing data, If the access tag matches and the previous status bit is not invalid, it is immediately determined that a cache hit has occurred, so that the speed of the simulator viewed from the host can be improved.
[0049]
《Usage form》
In the specific example 2, the configuration related to the instruction L1 cache memory model 4a is used, and in the specific example 3, the configuration is related to the data L1 cache memory model 4b. However, these configurations may be combined.
In the specific example 3, the previous access tag and the previous access state bit are separately provided for read / write, but the previous access tag and the previous access state bit which do not distinguish between read / write may be used. Further, in the specific example 4, as in the specific example 3, a previous access tag and a previous access state bit may be separately provided for read / write for the previous data access.
[0050]
【The invention's effect】
As described above, according to the present invention, when a cache hit occurs in the cache memory model, the operation time of this access is counted as the access time to the cache memory model, and the information of the cache hit is separately transmitted to the main memory model. Since access is made, execution time can be accurately simulated, and a memory area for a cache memory model on the host can be made unnecessary, thereby saving system resources of the simulated host. Can be. Further, the speed of the simulator can be improved.
[Brief description of the drawings]
FIG. 1 is a configuration diagram of a simulator according to a first embodiment of the present invention.
FIG. 2 is a flowchart of a cache check in a specific example 1.
FIG. 3 is a configuration diagram of a simulator according to Embodiment 2 of the present invention.
FIG. 4 is a flowchart of a cache check in a specific example 2;
FIG. 5 is a configuration diagram of a simulator according to a third embodiment of the present invention.
FIG. 6 is a flowchart of a cache check in a specific example 3;
FIG. 7 is a configuration diagram of a simulator according to Embodiment 4 of the present invention.
FIG. 8 is a flowchart of a cache check in a specific example 4.
FIG. 9 is a configuration diagram of a conventional simulator.
FIG. 10 is a flowchart showing an entire process in a conventional simulator.
FIG. 11 is a flowchart of a cache check in a conventional simulator.
[Explanation of symbols]
1 Main memory model
2 Cache memory model
3 CPU model
4 L1 cache memory model
5 L2 cache memory model
8, 8a, 8b, 8c Cache hit determination means
9 Access time calculation means
10 Tag information storage means
11 State information storage means
12 access means
13, 14, 16 Last access tag information storage means
15, 17 Last state information storage means

Claims (4)

主メモリと、キャッシュメモリと、演算処理装置とを備えた情報処理装置のプログラム実行動作を模擬し、その動作時間を計数するシミュレータにおいて、
前記キャッシュメモリの動作を模擬するキャッシュメモリモデルに格納されている情報に対応させた、前記主メモリの動作を模擬する主メモリモデルのアドレス情報をタグ情報として格納するタグ情報格納手段と、
前記キャッシュメモリモデルに格納されている情報と、当該情報に対応する前記主メモリモデルに格納された情報との一致状態を示す状態情報を格納する状態情報格納手段と、
前記キャッシュメモリモデルに対するアクセス要求を検出した場合、そのアクセス要求のアドレスが、前記タグ情報格納手段で格納したタグ情報と一致し、かつ、前記状態情報格納手段の状態情報が一致状態であった場合に、キャッシュヒットと判定するキャッシュヒット判定手段と、
前記キャッシュヒット判定手段がキャッシュヒットと判定した場合に、当該アクセスの動作時間を前記キャッシュメモリモデルに対するアクセス時間として計数するアクセス時間算出手段と、
前記キャッシュヒット判定手段がキャッシュヒットと判定した場合は、前記主メモリモデルに対して前記情報のアクセスを行うアクセス手段とを備えたことを特徴とするシミュレータ。
In a simulator that simulates a program execution operation of an information processing device including a main memory, a cache memory, and an arithmetic processing device and counts the operation time,
Tag information storage means for storing, as tag information, address information of a main memory model simulating the operation of the main memory, corresponding to information stored in a cache memory model simulating the operation of the cache memory;
State information storage means for storing state information indicating a matching state between information stored in the cache memory model and information stored in the main memory model corresponding to the information;
When an access request to the cache memory model is detected, the address of the access request matches the tag information stored in the tag information storage unit, and the status information of the status information storage unit is in a matching state A cache hit determining means for determining a cache hit;
An access time calculation unit that counts an operation time of the access as an access time to the cache memory model when the cache hit determination unit determines a cache hit;
An access means for accessing the information to the main memory model when the cache hit determination means determines that the cache hit has occurred.
主メモリと、キャッシュメモリと、演算処理装置とを備えた情報処理装置のプログラム実行動作を模擬し、その動作時間を計数するシミュレータにおいて、
前記キャッシュメモリの動作を模擬するキャッシュメモリモデルに格納されている命令に対応させた、前記主メモリの動作を模擬する主メモリモデルのアドレス情報をタグ情報として格納するタグ情報格納手段と、
前回の命令アクセスのタグ情報を保存する前回アクセスタグ情報格納手段と、
前記キャッシュメモリモデルに対するアクセス要求が命令アクセスであり、かつ、当該アクセス要求のアドレスが前記前回アクセスタグ情報と一致した場合は、キャッシュヒットと判定するキャッシュヒット判定手段と、
前記キャッシュヒット判定手段がキャッシュヒットと判定した場合に、当該アクセスの動作時間を前記キャッシュメモリモデルに対するアクセス時間として計数するアクセス時間算出手段と、
前記キャッシュヒット判定手段がキャッシュヒットと判定した場合は、前記主メモリモデルから前記命令の読み取りを行うアクセス手段とを備えたことを特徴とするシミュレータ。
In a simulator that simulates a program execution operation of an information processing device including a main memory, a cache memory, and an arithmetic processing device and counts the operation time,
Tag information storage means for storing, as tag information, address information of a main memory model simulating the operation of the main memory, corresponding to instructions stored in a cache memory model simulating the operation of the cache memory;
Last access tag information storage means for storing tag information of the last instruction access;
A cache hit determination unit that determines a cache hit when an access request to the cache memory model is an instruction access and an address of the access request matches the previous access tag information;
An access time calculation unit that counts an operation time of the access as an access time to the cache memory model when the cache hit determination unit determines a cache hit;
An access unit that reads the instruction from the main memory model when the cache hit determination unit determines that the cache hit has occurred.
主メモリと、キャッシュメモリと、演算処理装置とを備えた情報処理装置のプログラム実行動作を模擬し、その動作時間を計数するシミュレータにおいて、
前記キャッシュメモリの動作を模擬するキャッシュメモリモデルに格納されているデータに対応させた、前記主メモリの動作を模擬する主メモリモデルのアドレス情報をタグ情報として格納するタグ情報格納手段と、
前記キャッシュメモリモデルに格納されているデータと、当該データに対応する前記主メモリモデルに格納されたデータとの一致状態を示す状態情報を格納する状態情報格納手段と、
前記キャッシュメモリモデルへの前回のデータアクセスのタグ情報を保存する前回アクセスタグ情報格納手段と、
前回のデータアクセスのデータに対して、前記キャッシュメモリモデルに格納されている情報と、当該情報に対応する前記主メモリモデルに格納された情報との一致状態を示す状態情報を格納する前回状態情報格納手段と、
前記キャッシュメモリモデルに対するアクセス要求がデータアクセスであった場合、当該要求のアドレスが前記前回アクセスタグ情報と一致し、かつ、前記前回状態情報が一致状態であった場合は、キャッシュヒットと判定するキャッシュヒット判定手段と、
前記キャッシュヒット判定手段がキャッシュヒットと判定した場合に、当該アクセスの動作時間を前記キャッシュメモリモデルに対するアクセス時間として計数するアクセス時間算出手段と、
前記キャッシュヒット判定手段がキャッシュヒットと判定した場合は、前記主メモリモデルに対して前記データアクセスを行うアクセス手段とを備えたことを特徴とするシミュレータ。
In a simulator that simulates a program execution operation of an information processing device including a main memory, a cache memory, and an arithmetic processing device and counts the operation time,
Tag information storage means for storing, as tag information, address information of a main memory model simulating the operation of the main memory, corresponding to data stored in a cache memory model simulating the operation of the cache memory;
State information storage means for storing state information indicating a matching state between data stored in the cache memory model and data stored in the main memory model corresponding to the data;
Last access tag information storage means for storing tag information of previous data access to the cache memory model;
For the data of the previous data access, the previous state information for storing the state information indicating the matching state between the information stored in the cache memory model and the information stored in the main memory model corresponding to the information. Storage means;
If the access request for the cache memory model is a data access, the cache that determines a cache hit if the address of the request matches the previous access tag information and the previous state information matches. Hit determination means,
An access time calculation unit that counts an operation time of the access as an access time to the cache memory model when the cache hit determination unit determines a cache hit;
An access unit for performing the data access to the main memory model when the cache hit determination unit determines that a cache hit has occurred.
主メモリと、キャッシュメモリと、演算処理装置とを備えた情報処理装置のプログラム実行動作を模擬し、その動作時間を計数するシミュレータにおいて、
前記キャッシュメモリの動作を模擬するキャッシュメモリモデルに格納されている命令またはデータに対応させた、前記主メモリの動作を模擬する主メモリモデルのアドレス情報をタグ情報として格納するタグ情報格納手段と、
前記キャッシュメモリモデルに格納されているデータと、当該データに対応する前記主メモリモデルに格納されたデータとの一致状態を示す状態情報を格納する状態情報格納手段と、
前記キャッシュメモリモデルへの前回の命令またはデータアクセスのタグ情報を保存する前回アクセスタグ情報格納手段と、
前記キャッシュメモリモデルへの前回のデータアクセスのデータに対して、前記キャッシュメモリモデルに格納されているデータと、当該データに対応する前記主メモリモデルに格納されたデータとの一致状態を示す状態情報を格納する前回状態情報格納手段と、
前記キャッシュメモリモデルに対するアクセス要求が命令アクセスであり、かつ、当該アクセス要求のアドレスが前記アクセスタグ情報格納手段の前回命令アクセスタグ情報と一致した場合、および、前記キャッシュメモリモデルに対するアクセス要求がデータアクセスであり、かつ、当該アクセス要求のアドレスが前記前回アクセスタグ情報格納手段の前回アクセスタグ情報と一致すると共に、前記前回状態情報格納手段の状態情報が一致状態であった場合は、キャッシュヒットと判定するキャッシュヒット判定手段と、
前記キャッシュヒット判定手段がキャッシュヒットと判定した場合に、当該アクセスの動作時間を前記キャッシュメモリモデルに対するアクセス時間として計数するアクセス時間算出手段と、
前記キャッシュヒット判定手段がキャッシュヒットと判定した場合は、前記主メモリモデルに対して前記命令またはデータのアクセスを行うアクセス手段とを備えたことを特徴とするシミュレータ。
In a simulator that simulates a program execution operation of an information processing device including a main memory, a cache memory, and an arithmetic processing device and counts the operation time,
Tag information storage means for storing, as tag information, address information of a main memory model simulating the operation of the main memory corresponding to an instruction or data stored in a cache memory model simulating the operation of the cache memory;
State information storage means for storing state information indicating a matching state between data stored in the cache memory model and data stored in the main memory model corresponding to the data;
Last access tag information storage means for storing tag information of the last instruction or data access to the cache memory model;
Status information indicating the matching status between the data stored in the cache memory model and the data stored in the main memory model corresponding to the data with respect to the data of the previous data access to the cache memory model Last state information storage means for storing
When the access request to the cache memory model is an instruction access, and the address of the access request matches the previous instruction access tag information of the access tag information storage means, and the access request to the cache memory model is a data access. And if the address of the access request matches the previous access tag information of the previous access tag information storage means and the status information of the previous status information storage means is in a matching state, it is determined that a cache hit has occurred. A cache hit determination means to perform
An access time calculation unit that counts an operation time of the access as an access time to the cache memory model when the cache hit determination unit determines a cache hit;
An access unit for accessing the instruction or data to the main memory model when the cache hit determination unit determines that the cache hit has occurred.
JP2003030187A 2003-02-07 2003-02-07 Simulator Pending JP2004240783A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003030187A JP2004240783A (en) 2003-02-07 2003-02-07 Simulator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003030187A JP2004240783A (en) 2003-02-07 2003-02-07 Simulator

Publications (1)

Publication Number Publication Date
JP2004240783A true JP2004240783A (en) 2004-08-26

Family

ID=32957137

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003030187A Pending JP2004240783A (en) 2003-02-07 2003-02-07 Simulator

Country Status (1)

Country Link
JP (1) JP2004240783A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100409203C (en) * 2005-10-14 2008-08-06 杭州中天微系统有限公司 Method of realizing low power consumption high speed buffer storying and high speed buffer storage thereof
CN101770391B (en) * 2010-02-02 2011-10-19 北京航空航天大学 Cache simulator based on GPU and time parallel speedup simulating method thereof
JP2014241031A (en) * 2013-06-11 2014-12-25 富士通株式会社 Calculation device, calculation method, and calculation program

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100409203C (en) * 2005-10-14 2008-08-06 杭州中天微系统有限公司 Method of realizing low power consumption high speed buffer storying and high speed buffer storage thereof
CN101770391B (en) * 2010-02-02 2011-10-19 北京航空航天大学 Cache simulator based on GPU and time parallel speedup simulating method thereof
JP2014241031A (en) * 2013-06-11 2014-12-25 富士通株式会社 Calculation device, calculation method, and calculation program

Similar Documents

Publication Publication Date Title
US8458408B2 (en) Cache directed sequential prefetch
TWI338218B (en) Method and apparatus for prefetching data from a data structure
KR100292642B1 (en) Systems and Methods for Interfering Code Instrumentation
US6247107B1 (en) Chipset configured to perform data-directed prefetching
JP3587591B2 (en) Method of controlling cache miss and computer system thereof
KR100747127B1 (en) Cache which provides partial tags from non-predicted ways to direct search if way prediction misses
US9086987B2 (en) Detection of conflicts between transactions and page shootdowns
JPH07253926A (en) Method for reduction of time penalty due to cache mistake
CN102236541A (en) Preload instruction control
US8650012B1 (en) Caching information to map simulation addresses to host addresses in computer system simulations
JP2006040175A (en) Cache memory device and cache memory control method
WO2018028629A1 (en) Pattern based preload engine
KR20160035545A (en) Descriptor ring management
US11036639B2 (en) Cache apparatus and method that facilitates a reduction in energy consumption through use of first and second data arrays
US20060136190A1 (en) Method of evaluating system performance
CN108874690A (en) The implementation method and processor of data pre-fetching
CN108874691A (en) Data prefetching method and Memory Controller Hub
JP2004240783A (en) Simulator
CN113391974B (en) Memory monitoring method, device, processor and storage medium
CN107229574A (en) Caching and its control method
JP2000148584A (en) Prefetching method and device
JPH1173329A (en) Software development support system
JP2002334128A (en) Method for simulating power consumption of semiconductor integrated circuit
CN111198827B (en) Page table prefetching method and device
JP2760228B2 (en) Microprocessor with built-in cache memory and its trace analyzer