JP2004157642A - Processor simulator - Google Patents
Processor simulator Download PDFInfo
- Publication number
- JP2004157642A JP2004157642A JP2002320860A JP2002320860A JP2004157642A JP 2004157642 A JP2004157642 A JP 2004157642A JP 2002320860 A JP2002320860 A JP 2002320860A JP 2002320860 A JP2002320860 A JP 2002320860A JP 2004157642 A JP2004157642 A JP 2004157642A
- Authority
- JP
- Japan
- Prior art keywords
- checkpoint
- unit
- execution
- memory
- update
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Retry When Errors Occur (AREA)
Abstract
Description
【0001】
【発明の属する技術分野】
この発明は、シミュレーション対象となるターゲットCPUの動作をホストCPU上でシミュレーションするCPUシミュレータであって、ホストCPU上でターゲットCPUの動作を逐次処理しながら動作履歴を収集し、実行頻度の高い部分を抽出し、ターゲットCPUの機械語レベルの命令コードをまとめてホストCPUの命令列に変換し、実行するようにしたCPUシミュレータに関するものである。
【0002】
【従来の技術】
従来、ターゲットCPU命令をホストCPUで直接実行できるように命令コードの変換を行う際は、ターゲットCPU命令を1つずつ単純にホストCPU命令に変換していては性能向上を実現できないため、複数のターゲットCPU命令列をホストCPU命令に変換した後、ホストCPU命令の並び替えなどの最適化を実施している(特許文献1参照)。
図16は従来の構成を示す図であり、図17は従来のCPUシミュレータの動作を示すフローチャートである。
【0003】
次に動作について説明する。
ターゲットCPU命令列をまとめて、ホストCPUの命令列に変換しているが、その際、実行するターゲットCPU命令が変換済コードとして変換バッファ203に存在していれば(図17のS1でYの場合)、変換済コードの実行(図17のS6P)を行い、変換済コードが変換バッファ203に存在していなければ(図17のS1でNの場合)、これまでの実行回数が規定回数に達しているかの判断を行う(図17のS2)。規定回数に達していなければ(図17のS2でNの場合)、インタプリタ201によるターゲットCPU命令の逐次処理を行う(図17のS3)。インタプリタ201実行中に例外発生を検出した場合(図17のS4でYの場合)、ターゲットCPUの例外ハンドラ(図17のS11)を実行する。インタプリタ201実行中に例外が発生しなければ(図17のS4でNの場合)、次に実行するターゲットCPU命令が変換済コードとして変換バッファ203に存在しているかの確認を行う(図17のS1)。
【0004】
次に実行するターゲットCPU命令が変換済コードとして存在せず、次に実行するターゲットCPU命令の実行が規定回数に達していた場合(図17のS2でYの場合)には、ターゲットCPUの命令列をホストCPUの命令列に変換した(図17のS5)後、変換済コードを実行(図17のS6)する。変換済コードの実行が完了する(例外が発生しなかった)と(図17のS7でNの場合)、チェックポイントの実行(図17のS13)を行う。つまり、Gatedストアバッファ156内のコミット済と未コミットの境界を示すGATEポインタ152をTAILポインタ151にあわせこみを行う。変換済コードの実行中に例外はないと考えているホストCPU命令の命令シーケンスが変更されるような事象が発生すると(図17のS7でYの場合)、例外が発生した命令がターゲットCPU命令を実行したためか、ホストCPU命令を実行したかを特定するために、変換済コードの実行前まで、ホストCPUの状態を復元する(図17のS12)。つまり、Gatedストアバッファ156内の最後の未コミットを示すTAILポインタ151をコミットが済んだことを示すGATEポインタ152にまで戻すことで、ターゲットCPU命令列の動作を変換済コード実行前の状態に戻す。その後、インタプリタによる逐次処理実行(図17のS9およびS10)を行い、例外を引き起こしたターゲットCPU命令を特定し、ターゲットCPU命令実行による例外発生と判断した場合に、ターゲットCPUの例外ハンドラ(図17のS11)を実行する。
【0005】
【特許文献1】
USP 6,011,908
【0006】
【発明が解決しようとする課題】
従来のCPUシミュレータは、変換済コード実行中すべての動作履歴を保持するため大規模なハードウェアを必要とし、例外が発生したターゲットCPUを特定するための処理時間が長くなるという課題があった。
【0007】
この発明は上記のような課題を解決するためになされたもので、ハードウェアの小型化、および処理性能の向上を目的とする。
【0008】
【課題を解決するための手段】
この発明に係るプロセッサ・シミュレータは、対象となるターゲット・プロセッサのコードをホスト・プロセッサのコードに変換して動作を模擬する構成において、
コード変換後の処理にハードウェア・リソース更新を意味するチェックポイント実行があると、このチェックポイント実行を検出するチェックポイント検出部を備えて、
上記変換後のコードによる処理をチェックポイントの実行も含めて行ない、かつホスト・プロセッサが予期しない例外処理を検出すると、この検出点から直前のチェックポイントを復元する処理を行なうようにした。
【0009】
【発明の実施の形態】
実施の形態1.
図1はこの発明の一実施の形態に係るCPUシミュレータの構成を示すブロック図である。
図1において本装置は、ターゲットCPUの命令を実行するホスト・プロセッサ(CPU)100、ホストCPU100上に実装され、命令の取り出し、ディスパッチ、演算ユニットなどから構成されるプログラム実行部101、プログラム実行部101に実装され、演算実行時等に使用するホストCPUレジスタ102、ホストCPU100のハードウェアリソース更新のチェックポイント実行の事象を検出するCP(チェックポイント)検出部103、例外などの事象を検出する例外検出部104、ホストCPUレジスタ102上でターゲットCPUのレジスタとして割り当てられたターゲットCPUレジスタ105、プログラム実行部101で実行されるメモリ更新の情報をバッファリングしておくホストCPUストアバッファ106、CP検出部103からの通知によりチェックポイントの実行を行い、例外検出部104からの通知により最後に実行したチェックポイントにホストCPUのハードウェアリソースを復元するチェックポイント(CP)実行復元部107、プログラム実行部101で使用する命令、データを保持するキャッシュメモリ108、ホストCPU100に接続されたホストメモリサブシステム200、ターゲットCPU命令を逐次処理実行するインタプリタプログラム201、ターゲットCPU命令をホストCPU命令に変換するトランスレータプログラム202、トランスレータプログラム202が変換した変換済コードを保存する変換バッファ203、ホストメモリサブシステム200内に割り付けられたターゲットシステムのハードウェアリソース204の各構成要素からなる。
【0010】
図2は、ホストCPU100上で動作するCPUシミュレータのフローチャートを示している。
次に図1と図2を用いて動作を説明する。
実行するターゲットCPU命令が変換済コードとして変換バッファ203に存在していれば(図2のS1でYの場合)、変換済コードの実行(図2のS6)を行う。その際、変換済コードの実行中であっても、チェックポイントの実行を行う。チェックポイントの実行は、CP検出部103により検出され、CP実行復元部107においてチェックポイントが実行される。変換済コードが変換バッファ203に存在していなければ(図2のS1でNの場合)、これまでの実行回数が規定回数に達しているかの判断を行う(図2のS2)。規定回数に達していなければ(図2のS2でNの場合)、インタプリタ201によるターゲットCPU命令の逐次処理を行う(図2のS3)。インタプリタ201実行中に例外発生を検出した場合(図2のS4でYの場合)、ターゲットCPUの例外ハンドラ(図2のS11)を実行する。インタプリタ201実行中に例外が発生しなければ(図2のS4でNの場合)、次に実行するターゲットCPU命令が変換済コードとして変換バッファ203に存在しているかの確認を行う(図2のS1)。
【0011】
次に実行するターゲットCPU命令が変換済コードとして存在せず、次に実行するターゲットCPU命令の実行が規定回数に達していた場合(図2のS2でYの場合)には、ターゲットCPUの命令列をホストCPUの命令列に変換した(図2のS5)後、変換済コードを実行(図2のS6)する。変換済コードの実行が完了する(例外が発生しなかった)と(図2のS7でNの場合)、次に実行するターゲットCPU命令が変換済コードとして変換バッファ203に存在しているかの確認を行う(図2のS1)。変換済コードの実行中に例外検出部104が例外を検出する(図2のS7でYの場合)と、CP実行復元部107によって最後に実行したチェックポイントの状態にホストCPUの状態を復元する(図2のS8)。その後、インタプリタによる逐次処理実行(図2のS9およびS10)を行い、例外を引き起こしたターゲットCPU命令を特定し、ターゲットCPU命令実行による例外発生と判断した場合に、ターゲットCPUの例外ハンドラ(図2のS11)を実行する。
以上のように、変換済コード実行中においても、任意のポイントでチェックポイントを実行することで、CP実行復元のハードウェアを小型化し、例外発生時の処理時間を短縮できる。
【0012】
プログラム実行部の具体例について説明する。
図3はCPUシミュレータのプログラム実行部100bの詳細を示すブロック図である。図1に示す構成要素に追加された構成要素として、ターゲットCPU命令実行に伴なうチェックポイントを検出するTCCP(ターゲットCPUチェックポイント)検出部110、TCCP検出部110において検出したチェックポイント実行をCP実行復元部107に通知するTCCP通知部111、ターゲットCPU命令の実行に起因する例外事象を検出するTC(ターゲットCPU)例外検出部112、TC例外検出部112において検出した例外事象をCP実行復元部107に通知するTC例外通知部113、TCCP通知部111からターゲットCPU命令実行に伴なうチェックポイントが検出されたことを受信するTCCP受信部114、TCCP受信部114へのチェックポイント実行通知によりチェックポイントを実行するCP実行部115、TC例外通知部113からターゲットCPU命令実行に伴なう例外が検出されたことを受信するTC例外受信部116、ターゲットシステムのハードウェアリソースの更新情報を採取し、保持するTC更新情報保持部118、TC例外受信部116への通知により、最後に実行したチェックポイント状態にTC更新情報保持部118を復元するCP復元部117がある。その他の番号の構成要素は図1のそれと同ものである。
【0013】
次に動作について図3を例に説明する。即ちチェックポイント検出部103bとして、TCCP検出部110及びTCCP通知部111を設けることで、ターゲットCPUの命令実行に伴なうチェックポイントのみを抽出検出し、CP実行復元部107bに通知し、チェックポイントを実行する。また、例外検出部104bとして、TC例外検出部112及びTC例外通知部113を設けることで、ターゲットCPUの命令実行に伴なう例外のみを抽出検出し、CP実行復元部107に通知し、チェックポイントを復元する。また、CP実行復元部107bとして、TCCP受信部114、CP実行部115、TC例外受信部116、CP復元部117及びTC更新情報保持部118を設けることで、ターゲットCPUの命令実行に伴なうターゲットシステムの更新情報のみの履歴を保持し、チェックポイントの実行及び復元を行う。
【0014】
以上のように、ターゲットCPUの命令実行に伴なうターゲットシステムの更新情報のみの履歴を保持し、ターゲットCPU命令実行に伴なうチェックポイントを実行し、ターゲットCPU命令実行に伴なう例外のみを検出するようにしたことで、CP実行復元部107を小型化し、例外発生時の処理時間が短縮できる。
【0015】
実施の形態2.
図4は、ターゲットCPU命令列をホストCPU命令列に変換する変換部での変換例を示す図であり、図5は、チェックポイント検出部の具体的な103の構成を示す図である。
図5において、ハードウェアリソース更新のチェックポイント実行の事象を検出するCP検出部103は、内部にターゲットCPU命令実行に伴なうチェックポイントを検出するTCCP検出部110cと、TCCP通知部111を持つ。またホストCPUの命令デコーダ120を持つ。更にTCCP検出部110cは、ターゲットCPU命令実行によるチェックポイント検出を判断するTCCP判断部121aを内部に持つ。
【0016】
次に動作について説明する。
まず、ターゲットCPU命令列をホストCPU命令に変換する変換部であるトランスレータ202cについて、図4を例に説明する。
ターゲットCPUの命令aは、ホストCPUの命令a1と命令a2で実現される。ターゲットCPUの命令bは、ホストCPUの命令b1と命令b2で実現される。ターゲットCPUの命令cは、ホストCPUの命令c1で実現される。通常、ターゲットCPUの命令が命令a、命令b、命令cの順に出現するなら、ホストCPUの命令を使ってターゲットCPUの動作を行うには、命令a1、命令a2、命令b1、命令b2、命令c1と変換すればよい。しかし、命令a1、命令a2、命令b1、命令b2、命令c1の順序を実行すると、ホストCPUのパイプラインにストールが発生してしまう。高速化を実現するためには、命令a1、命令b1、命令c1、命令a2、命令b1と並び替えてパイプラインのストールをなくすようにトランスレータ202cは最適化を行う。トランスレータ202cは、ターゲットCPUの命令列をいくつかの命令列に分割して、最適化を行う。その際、分割した隙間にターゲットCPUの命令の切れ目を示すチェックポイント実行命令αを埋め込んだ変換済コードを生成し、ホストメモリサブシステム200上に割り当てた変換バッファ203に格納する。命令αを埋め込む場所は、分割した隙間に限らず、ターゲットCPUの命令位置が特定可能な場所であれば、どこでもかまわない。
【0017】
次に、トランスレータ202cで変換した変換済コードの実行中でのチェックポイント検出について図5を例に説明する。
ターゲットCPU命令をホストCPU命令に変換した変換済コード実行(図2のS6)で、ホストCPU命令デコーダ120に実行すべきホストCPU命令として、上記のトランスレータ202cが生成した命令αを含む入力があると、ホストCPU命令デコーダ120は、入力された命令コードのビットパターンに従い、命令デコードを行う。その際、命令αのビットパターンをデコードすると、TCCP判断部121aに命令αをデコードしたことを通知する。TCCP判断部121aはホストCPU命令デコーダ120からの命令αをデコードしたことを示す通知と命令実行信号に従い、命令αを実行したと判断し、チェックポイントの実行を検出する。
【0018】
以上のように、変換部とTCCP判断部を備えることで、ターゲットCPUの命令実行中であっても、ターゲットCPU命令実行に伴なうチェックポイントを認識できるので、CP実行復元部107のハードウェアの小型化と、例外発生時の処理時間の短縮ができる。
【0019】
図6は、チェックポイント検出部の他の具体的な構成を示す図である。
図6において、CP検出部103dは、内部にターゲットCPU命令実行に伴なうチェックポイントを検出するTCCP検出部110dと、TCCP通知部111を持つ。またTCCP検出部110dは、内部にターゲットCPU命令の実行を示すTC実行フラグ保持部123、変換済命令コードの実行開始時にTC実行フラグ保持部123をセットし、終了時にTC実行フラグ保持部123をリセットするTC実行フラグ設定部123、ターゲットCPU命令の変換済命令コード実行終了によってチェックポイント検出を判断するTCCP判断部121bを持つ。
【0020】
ターゲットCPU命令の実行に伴なうチェックポイントの検出動作を図6に基いて説明する。
ターゲットCPU命令を変換した変換済コードを開始するときに、TC実行フラグ設定部122を用いてTC(チェックポイント)実行フラグ保持部123にセット信号を送信する。また、変換済コード実行が終了するときに、TC実行フラグ設定部122を用いてTC実行フラグ保持部123にリセット信号を送信する。TC実行フラグ保持部123は、TC実行フラグ設定部122からのセット/リセット信号に従い、ターゲットCPU命令の実行を示すターゲットCPU実行フラグを保持する。TCCP判断部121bは、TC実行フラグ保持部123で保持しているターゲットCPU実行フラグがセット状態からリセット状態に変化したことを観測し、ターゲットCPU命令実行に伴なうチェックポイントの実行と判断し、TCCP通知部111に通知する。
【0021】
以上のように、TC実行フラグ設定部とTC実行フラグ保持部とTCCP判断部を備えることにより、ターゲットCPUの命令実行で命令αのような明示的なチェックポイント実行の命令がなくても、ターゲットCPU命令の実行に伴なうチェックポイントを認識できるので、CP実行復元部107のハードウェアの小型化と例外発生時の処理時間の短縮ができる。
【0022】
図7はチェックポイント検出部の他の具体的な構成を示す図である。
図7において、CP検出部103eは、内部にターゲットCPU命令実行に伴なうチェックポイントを検出するTCCP検出部110eと、TCCP通知部を持つ。また、CP検出部110eはターゲットCPU命令の変換済命令コード実行終了によってチェックポイント検出を判断するTCCP判断部121eとCPU100のメモリ更新を検出するメモリ更新検出部124を持つ。その他の各要素は、図6に記載の同番号の要素と同様のものである。
【0023】
ターゲットCPU命令の実行に伴なうチェックポイントの検出動作を図7に基いて説明する。
ターゲットCPU命令を変換した変換済コードを開始するときに、TC実行フラグ設定部122は、TC実行フラグ保持部123にセット信号を送信する。また、変換済コード実行が終了するときには、TC実行フラグ保持部123にリセット信号を送信する。TC実行フラグ保持部123は、こうしてターゲットCPU実行フラグのセット/リセットを保持する。メモリ更新検出部124はメモリアクセス情報からメモリ更新事象を検出し、メモリ更新が発生したことをTCCP判断部121cに通知する。TCCP判断部121cは、TC実行フラグ保持部123で保持しているターゲットCPU実行フラグがセット状態であり、メモリ更新検出部124からメモリ更新が発生したことの通知を受けて、ターゲットCPU命令実行によるチェックポイントの実行と判断し、TCCP通知部111に通知する。
【0024】
以上のように、TC実行フラグ設定部とTC実行フラグ保持部とメモリ更新検出部とTCCP判断部を備えることにより、ターゲットCPUの命令実行であっても、ターゲットCPU命令のメモリ更新動作をターゲットCPU命令の実行に伴なうチェックポイントを認識できるので、CP実行復元部107のハードウェアの小型化ができ、例外発生時の処理時間が短縮できる。
【0025】
図8はチェックポイント検出部の他の具体的な構成を示す図である。
図8において、CP検出部103fは、内部にチェックポイントを検出するTCCP検出部110fと、TCCP通知部を持つ。またTCCP検出部110fは、内部にホストメモリサブシステム200上に割り付けたターゲットシステム204の先頭番地及び終了番地をTエリア保持部に設定するTエリア設定部125と、ホストメモリサブシステム200上に割り付けたターゲットシステム204の先頭番地及び終了番地を保持するT(ターゲットシステム)エリア保持部126c、ホストCPU100のメモリ更新を検出するメモリ更新検出部124と、メモリアクセスがTエリア保持部126で保持しているTシステム先頭番地とTシステム終了番地で示されるターゲットシステム204へのアクセスであるかどうかを検出するメモリエリア検出部127と、ターゲットシステム204のメモリ更新によってチェックポイント検出を判断するTCCP判断部121dを持つ。
【0026】
ターゲットCPU命令の実行に伴なうチェックポイントの検出動作を図8に基いて説明する。
CPUシミュレータ起動時にホストメモリサブシステム200に割り付けるターゲットシステム204のエリアを決定し、Tエリア設定部125を用いてTエリア保持部126にターゲットシステム204の先頭番地と終了番地を設定する。メモリエリア検出部127は、メモリアクセス情報のうちアドレス情報を監視し、保持しているTシステム先頭番地とTエリア終了番地で示されるターゲットシステム204へのメモリアクセスかどうかを検出する。メモリアクセスがターゲットシステム204へのメモリアクセスであることを検出すると、TCCP判断部121dに通報を行う。メモリ更新検出部124はメモリアクセス情報からメモリ更新事象を検出し、メモリ更新が発生したことをTCCP判断部121dに通知する。TCCP判断部121dは、メモリエリア検出部127からの通報でメモリアクセスがターゲットシステム204の範囲であり、メモリ更新検出部124からメモリ更新が発生したことの通知を受けて、ターゲットCPU命令実行によるチェックポイントの実行と判断し、TCCP通知部111に通知する。
【0027】
以上のように、Tエリア設定部とTエリア保持部とメモリエリア検出部とメモリ更新検出部とTCCP判断部を備えることにより、ターゲットCPUの命令実行であっても、ターゲットCPU命令のメモリ更新動作をターゲットCPU命令の実行に伴なうチェックポイントを認識できる。
【0028】
図9はチェックポイント検出部の他の具体的な構成を示す図である。
図9において、CP検出部103gは、内部にチェックポイントを検出するTCCP検出部110gと、TCCP通知部を持つ。またTCCP検出部110gは、内部にホストメモリサブシステム200上に割り付けた変換バッファ203の先頭番地及び終了番地を変換バッファエリア保持部に設定する変換バッファエリア設定部128と、ホストメモリサブシステム200に割り付けた変換バッファ203の先頭番地及び終了番地を保持する変換バッファエリア保持部129と、メモリ更新検出部124と、ターゲットCPU命令の変換済コード実行のメモリ更新によってチェックポイント検出を判断するTCCP判断部121eを持つ。
【0029】
ターゲットCPU命令の実行に伴なうチェックポイントの検出動作を図9に基いて説明する。
CPUシミュレータ起動時にホストメモリサブシステム200に割り付ける変換バッファ203のエリアを決定し、変換バッファエリア設定部128を用いて変換バッファエリア保持部129に変換バッファ203の先頭番地と終了番地を設定する。メモリ更新検出部124はメモリアクセス情報からメモリ更新事象を検出し、メモリ更新が発生したことをTCCP判断部121eに通知する。TCCP判断部121eは、ホストCPUのプログラムカウンタを監視し、変換バッファエリア保持部129が保持する変換バッファ先頭番地と変換バッファ終了番地で示される変換バッファ203での命令実行であり、メモリ更新検出部124からメモリ更新が発生したことの通知を受けて、ターゲットCPU命令実行によるチェックポイントの実行と判断し、TCCP通知部111に通知する。
【0030】
以上のように、変換バッファエリア設定部と変換バッファエリア保持部とメモリ更新検出部とTCCP判断部を備えることにより、ターゲットCPUの命令実行であっても、ターゲットCPU命令のメモリ更新動作をターゲットCPU命令の実行に伴なうチェックポイントを認識できる。
【0031】
図10は、チェックポイントの判断を行うTCCP判断部の他の具体構成を示す図である。
図10において、TCCP通知部111と、ホストCPU100のメモリ更新を検出するメモリ更新検出部124と共に示されているTCCP判断部121hは、ターゲットCPU命令の変換済コード実行のメモリ更新によってチェックポイント検出を判断する。そして内部に、メモリ更新規定回数保持部にメモリ更新規定回数を設定するメモリ更新規定回数設定部130と、メモリ更新の規定回数を保持するメモリ更新規定回数保持部131と、メモリ更新検出部124において検出したメモリ更新の回数をカウントするメモリ更新回数カウント部132と、メモリ更新規定回数保持部131が保持する規定回数と、メモリ更新回数カウント部132がカウントするメモリ更新回数が一致した場合に、メモリ更新回数カウント部132にリセット要求を発行し、ターゲットCPUチェックポイント検出したとしてTCCP通知部に通知するメモリ更新回数比較部133と持つ。
【0032】
ターゲットCPU命令の実行に伴なうチェックポイントの判断動作を図10に基いて説明する。
CPUシミュレータ起動時(あるいは起動中)にターゲットCPU命令によるメモリ更新が何回実行されるとチェックポイント実行とみなすかをメモリ更新規定回数設定部130を用いて、メモリ更新規定回数保持部131に設定する。先に説明したように、TCCP判断部121c〜121eでターゲットCPU命令実行によるメモリ更新をターゲットCPU命令実行のチェックポイントの実行と判断するだけでなく、メモリ更新回数カウント部132でメモリ更新の回数をカウントした値と、あらかじめ設定されている規定回数を保持しているメモリ更新規定回数保持部131の値をメモリ更新回数比較部133で比較し、カウントした値が規定値と一致あるいは超えた場合に、ターゲットCPU命令実行によるチェックポイントの実行と判断し、TCCP通知部111に通知する。同時に、メモリ更新の回数をカウントしているメモリ更新回数カウント部132に対して、リセット要求を通知する。メモリ更新回数カウント部132は、メモリ更新回数比較部133からのリセット要求に従い、メモリ更新の回数をクリアする。その後、再び、メモリ更新の回数をカウントしはじめる。
【0033】
以上のように、TCCP判断部にメモリ更新規定回数設定部とメモリ更新規定回数保持部とメモリ更新回数カウント部とメモリ更新回数比較部を備えたので、ターゲットCPU命令の実行であっても、任意にターゲットCPU命令のメモリ更新動作をターゲットCPU命令の実行に伴なうチェックポイントを認識できる。
【0034】
実施の形態3.
本実施の形態では、例外検出部の具体的な構成と動作を説明する。
図11は本実施の形態におけるターゲットCPU命令の実行に伴なう例外検出を行うTC例外検出部の構成を示すブロック図である。
図11において、例外などの事象を検出する例外検出部104cは、内部にターゲットCPU命令の実行に起因する例外事象を検出するTC例外検出部112cと、TC例外検出部112cにおいて検出した例外事象をCP実行復元部107に通知するTC例外通知部113を持つ。更にTC例外検出部112cは、内部に変換済命令コードの実行開始時にTC実行フラグ保持部をセットし、終了時にリセットするTC実行フラグ設定部122と、ターゲットCPU命令の実行を示すTC実行フラグ保持部123と、ホストCPUでの例外事象が発生した時にターゲットCPU実行フラグ保持部123がセットされていることで、ターゲットCPU例外検出とするTC例外判断部140aを持つ。
【0035】
ターゲットCPU命令の実行に伴なう例外の検出動作を図11に基いて説明する。
ターゲットCPU命令を変換した変換済コードを開始するときに、TC実行フラグ設定部122によりTC実行フラグ保持部123にセット信号を送信する。変換済コード実行が終了すると、TC実行フラグ設定部122は、TC実行フラグ保持部123にリセット信号を送信する。TC実行フラグ保持部123は、TC実行フラグ設定部122からのセット/リセット信号に従い、ターゲットCPU命令の実行を示すターゲットCPU実行フラグを保持する。TC例外判断部140aは、ホストCPUでの例外事象が発生した時にターゲットCPU実行フラグ保持部123がセットされていれば、ターゲットCPU命令実行に伴なう例外と判断し、TC例外通知部113にターゲットCPU命令実行に伴なう例外発生を通知する。
【0036】
以上のように、TC例外検出部にTC実行フラグ設定部とTC実行フラグ保持部とTC例外判断部を備えることにより、ホストCPUでの例外発生であっても、ターゲットCPU命令の実行に伴なう例外発生を認識できる。
【0037】
図12は、TC例外検出部の他の具体的な構成を示す図である。
図12において、例外検出部104dは、内部にTC例外検出部112dと、TC例外通知部113を持つ。また例外検出手段112dは、内部にホストメモリサブシステム200上に割り付けた変換バッファ203の先頭番地及び終了番地を変換バッファエリア保持部に設定する変換バッファエリア設定部128と、ホストメモリサブシステム200に割り付けた変換バッファ203の先頭番地及び終了番地を保持する変換バッファエリア保持部129と、ホストCPUでの例外事象が発生した時のホストCPUのプログラムカウンタが変換バッファエリア保持部129で保持する変換バッファ203の先頭番地及び終了番地で指定されたエリアに含まれるかどうかを判断し、含まれている場合にターゲットCPU例外検出とするTC例外判断部140bを持つ。
【0038】
ターゲットCPU命令の実行に伴なう例外の検出動作を図12に基いて説明する。
CPUシミュレータ起動時にホストメモリサブシステム200に割り付ける変換バッファ203のエリアを決定し、変換バッファエリア設定部128を用いて変換バッファエリア保持部129に変換バッファ203の先頭番地と終了番地を設定する。TC例外判断部はホストCPUのプログラムカウンタの値を監視し、ホストCPUでの例外事象が発生した時に、ホストCPUのプログラムカウンタが変換バッファエリア保持部129で保持する変換バッファ先頭番地と変換バッファ終了番地で示される変換バッファ203での命令実行であることで、ターゲットCPU命令実行に伴なう例外と判断し、TC例外通知部113にターゲットCPU命令実行に伴なう例外発生を通知する。
【0039】
以上のように、TC例外検出部に変換バッファエリア設定部と変換バッファエリア保持部とTC例外判断部を備えることにより、ホストCPUでの例外発生であっても、ターゲットCPU命令の実行に伴なう例外発生を認識できる。
【0040】
実施の形態4.
本実施の形態では、プログラム実行部におけるTC更新情報に基づくターゲットCPUのチェックポイントの動作について説明する。
図13はターゲットCPU命令実行に伴なうレジスタ更新情報を保持するレジスタバックアップ部を含むプログラム実行部の構成を示す図であり、図14は、ターゲットCPU命令実行に伴なうメモリ更新の履歴情報を保持するTCメモリ更新履歴部の構成を示す図である。
図13において、ホストCPU100上に実装され、命令の取り出し、ディスパッチ、演算ユニットなどから構成されるプログラム実行部は内部に、演算実行時等に使用するホストCPUレジスタ102と、ホストCPUレジスタ102上でターゲットCPUのレジスタとして割り当てられたターゲットCPUレジスタ105と、ターゲットシステムのハードウェアリソースの更新情報を採取し、保持するTC更新情報保持部118を持つ。また、TCCP受信部114へのチェックポイント実行通知によりチェックポイントを実行するCP実行部115と、TC例外受信部116への通知により、最後に実行したチェックポイント状態にTC更新情報保持部118を復元するCP復元部117と、ホストCPUレジスタ102に割り付けたターゲットCPUのレジスタをチェックポイント実行でバックアップするレジスタ・バックアップ部150とを使用する。
【0041】
図14において、TC更新情報保持部118は、内部にターゲットCPU命令実行に伴なうメモリ更新の更新アドレス、更新データを対にして保持するTCメモリ更新履歴保持部154と、TC(ターゲットCPU)メモリ更新履歴保持部154の最後の未コミットを示すTAILポインタ151と、TCメモリ更新履歴保持部154のコミット済と未コミットの境界を示すGATEポインタ152と、TCメモリ更新履歴保持部154でコミット済のメモリ更新情報をキャッシュメモリ108に反映したことを示すHEADポインタ153を持つ。その他の要素は、図1、図13に示す同番号の要素と同等のものである。
【0042】
ターゲットCPUのレジスタ情報のチェックポイント実行と復元動作を、図13に基いて説明する。
ターゲットCPU命令の変換済コードは、高速化のためホストCPUレジスタ上にターゲットCPUのレジスタを割り付けて実行する。チェックポイント実行事象の検出によりチェックポイント実行を要求されたCP実行部115は、ホストCPUレジスタ102に割り当てられたターゲットCPUレジスタ105をレジスタバックアップ部150にコピーを行うことで、チェックポイントを実行する。例外事象の検出によりチェックポイント復元を要求されたCP復元部117は、レジスタバックアップ部150に保存されている、最後のチェックポイント実行時のターゲットCPUレジスタ情報をホストCPUレジスタ102上に割り当てられたターゲットCPUレジスタ105に書き戻すことで、チェックポイントを復元する。チェックポイントの復元がされる前に、チェックポイントの実行がされた場合には、チェックポイントを復元することなく、現在のターゲットCPUレジスタ105のレジスタ情報をレジスタバックアップ部150に上書きする。
ホストCPUレジスタ102でのターゲットCPUレジスタ105の割付は、固定であっても構わないし、CPUシミュレータ起動時に設定しても構わない。
【0043】
ターゲットCPUのメモリ更新情報のチェックポイント実行とチェックポイント復元動作を、図14に基いて説明する。
まず、ターゲットCPUのメモリ更新情報の履歴保持について説明する。
メモリの更新情報のうち、ホストCPU命令実行によるメモリ更新情報はホストCPUストアバッファ106に保存し、ターゲットCPU命令実行によるメモリ更新情報はTCメモリ更新履歴保持部154に保存する。メモリの更新がターゲットCPU命令実行によるか、ホストCPU命令実行によるかの判断は、先に述べたTC実行フラグ設定部122とTC実行フラグ保持部123とメモリ更新検出部124とTCCP判断部121cを備えることや、Tエリア設定部125とTエリア保持部126とメモリ更新検出部124とメモリエリア検出部127とTCCP判断部121dを備えることや、または、変換バッファエリア設定部128と変換バッファエリア保持部129とメモリエリア検出部127とTCCP判断部121eを備えることで可能である。
TCメモリ更新履歴保持部154は、ターゲットCPU命令実行によるメモリ更新アドレスと更新データの情報を対で保持する。
【0044】
次いで、ターゲットCPUのメモリ更新のチェックポイント実行及びチェックポイント復元動作を説明する。
TCメモリ更新履歴保持部154の書き込み及び読み出しポインタとして、TCメモリ更新履歴保持部154の最後の未コミットを示すTAILポインタ151、コミット済と未コミットの境界を示すGATEポインタ152、コミット済のメモリ更新情報をキャッシュメモリ108に反映したことを示すHEADポインタ153の3つのポインタがある。3つのポインタの初期状態は、TCメモリ更新履歴保持部154の同じ場所を示している。この場合、指し示す場所はTCメモリ更新履歴保持部154の先頭であっても、最後であっても、中間であってもよい。ターゲットCPU命令の実行によるメモリ更新が検出されると、TAILポインタ151が示すTCメモリ更新履歴保持部154の位置にメモリ更新アドレスと更新データの情報を対で保持し、TAILポインタ151を1つ移動する。その後も、ターゲットCPU命令の実行によるメモリ更新が検出されると、同様の処理が行われる。一方、ターゲットCPU命令実行によるチェックポイント実行が検出されると、CP実行部115からの指示でGATEポインタ152にTAILポインタ151の内容がコピーされる。次のターゲットCPU命令実行によるチェックポイント検出まで、TCメモリ更新履歴保持部154にメモリ更新アドレスと更新データの情報を対で保持しながら、TAILポインタ151を更新していく。
【0045】
ターゲットCPU命令実行による例外が検出されると、CP復元部117からの指示でTAILポインタ151にGATEポインタ152の内容がコピーされ、最後のチェックポイント実行時の状態にTCメモリ更新履歴保持部154が復元される。チェックポイント実行でコミットしたメモリ更新情報は、HEADポインタ153が指し示すTCメモリ更新履歴保持部154が保持しているメモリ更新アドレスと更新データの対をキャッシュメモリ108に通知し、キャッシュメモリを更新すると同時に、HEADポインタ153を更新する。HEADポインタ153はTAILポインタ151やGATEポインタ152と独立に制御されるが、未コミットのメモリ更新情報をキャッシュメモリ108に格納することになるため、HEADポインタ153はGATEポインタ152を追い越すことはできない。
【0046】
以上のように、TC情報保持部にレジスタバックアップ部とTC枝盛更新履歴保持部を備えることにより、ターゲットCPU命令実行によるチェックポイントのみを実行、及び復元することが可能となる。
【0047】
図15はTC履歴情報保持部の他の具体的な構成を示す図である。
図15において、TC更新情報保持部118cは、ターゲットCPU命令実行に伴なうメモリ更新の更新アドレス、更新データ、更新前データを対にして保持するTCメモリ更新履歴保持部155を持っている。即ち図14の構成に比べて、更新前データも対にして保持する。
【0048】
次に図14の構成とは異なる図15構成に固有の新しい動作について説明する。
まず、ターゲットCPUのメモリ更新情報の履歴保持について説明する。
メモリの更新情報のうち、ホストCPU命令実行によるメモリ更新情報はホストCPUストアバッファ106に保存し、ターゲットCPU命令実行によるメモリ更新情報はTCメモリ更新履歴保持部154に保存する。メモリの更新がターゲットCPU命令実行によるか、ホストCPU命令実行によるかの判断は、先に述べたTC実行フラグ設定部122とTC実行フラグ保持部123とメモリ更新検出部124とTCCP判断部121cを備えることや、Tエリア設定部125とTエリア保持部126とメモリ更新検出部124とメモリエリア検出部127とTCCP判断部121dを備えることや、または変換バッファエリア設定部128と変換バッファエリア保持部129とメモリエリア検出部127とTCCP判断部121eを備えることで可能である。TCメモリ更新履歴保持部155は、ターゲットCPU命令実行によるメモリ更新アドレスと更新データと更新前データの情報を対で保持する。
【0049】
次いで、ターゲットCPUのメモリ更新のチェックポイント実行及びチェックポイント復元について説明する。
TCメモリ更新履歴保持部155の書き込み及び読み出しポインタとして、最後の未コミットを示すTAILポインタ151、コミット済と未コミットの境界を示すGATEポインタ152、TCメモリ更新履歴保持部155でコミット済のメモリ更新情報をキャッシュメモリ108に反映したことを示すHEADポインタ153の3つのポインタがあり、3つのポインタの初期状態は、同じ場所を示している。ターゲットCPU命令の実行によるメモリ更新が検出されると、メモリ更新アドレスでキャッシュメモリ108を参照し、更新前データを取得し、TAILポインタ151が示すTCメモリ更新履歴保持部155に、メモリ更新アドレスと更新データと更新前データの情報を対で保持し、TAILポインタ151を1移動する。
その後も、ターゲットCPU命令の実行によるメモリ更新が検出されると、同様の処理が行われる。
【0050】
ターゲットCPU命令実行によるチェックポイント実行が検出されると、GATEポインタ152にTAILポインタ151の内容がコピーされる。次のターゲットCPU命令実行によるチェックポイント検出まで、TCメモリ更新履歴保持部155にメモリ更新アドレスと更新データと更新前データの情報を対で保持しながら、TAILポインタ151を更新していく。
ターゲットCPU命令実行による例外が検出されると、TAILポインタ151にGATEポインタ152の内容がコピーされ、最後のチェックポイント実行時の状態にTCメモリ更新履歴保持部155が復元される。チェックポイント実行でコミットしたメモリ更新情報は、HEADポインタ153が指し示すTCメモリ更新履歴保持部155が保持している位置の、メモリ更新アドレスと更新データの対をキャッシュメモリ108に通知し、キャッシュメモリを更新すると同時に、HEADポインタ153を更新する。HEADポインタ153はTAILポインタ151やGATEポインタ152と独立に制御される。
HEADポインタ153がGATEポインタ152を追い越して、キャッシュメモリ108を更新した状態で、例外検出によるチェックポイントの復元が発生した場合には、HEADポインタ153とGATEポインタ152が示す間のTCメモリ更新履歴保持部155が保持している更新前データの内容をメモリ更新アドレスに従い、キャッシュメモリ108に格納することで、キャッシュメモリ108の復元を行う。また、HEADポインタ153にGATEポインタ152の内容がコピーされる。
【0051】
以上のように、TC情報保持部にレジスタバックアップ部とTCメモリ更新履歴保持部を備えることにより、ターゲットCPU命令実行によるチェックポイントのみを実行、及び復元することが可能となる。
【0052】
【発明の効果】
以上のようにこの発明によれば、チェックポイントを含めて変換後の命令を実行し、例外処理時にはチェックポイントの復元処理に戻るようにしたので、シミュレーション規模を抑えて、処理時間を短縮できる効果がある。
【図面の簡単な説明】
【図1】この発明の実施の形態1におけるプロセッサ・シミュレータの構成図である。
【図2】実施の形態1におけるプロセッサ・シミュレータの動作フロー図である。
【図3】実施の形態1におけるプログラム実行部の構成図である。
【図4】この発明の実施の形態2におけるインタプリタタの動作を説明する変換例の図である。
【図5】実施の形態2におけるチェックポイント検出部の構成を示す図である。
【図6】実施の形態2における他のチェックポイント検出部の構成図である。
【図7】実施の形態2における他のチェックポイント検出部の構成図である。
【図8】実施の形態2における他のチェックポイント検出部の構成図である。
【図9】実施の形態2における他のチェックポイント検出部の構成図である。
【図10】実施の形態2における他のチェックポイント検出部の細部構成図である。
【図11】この発明の実施の形態3における例外検出部の構成を示す図である。
【図12】実施の形態3における他の例外検出部の構成図である。
【図13】この発明の実施の形態4におけるプログラム実行部の構成を示す図である。
【図14】実施の形態4におけるチェックポイント更新情報保持部の構成を示す図である。
【図15】実施の形態4における他のチェックポイント更新情報保持部の構成を示す図である。
【図16】従来のプロセッサ・シミュレータの構成を示す図である。
【図17】従来のプロセッサ・シミュレータの動作を示すフロー図である。
【符号の説明】
100,101b ホスト・プロセッサ、101,101b,101c プログラム実行部、103,103c,103d,103e,103f,103g チェックポイント検出部、104,104c,104d 例外検出部、107 チェックポイント実行復元部、110,110c,110d,110e,110f,110g ターゲットCPUチェックポイント検出部、111 ターゲットCPUチェックポイント通知部、112,112c,112d ターゲットCPU例外検出部、113 ターゲットCPU例外通知部、114 ターゲットCPUチェックポイント受信部、115 チェックポイント実行部、116 チェックポイント例外受信部、117 チェックポイント復元部、118,118c チェックポイント更新情報保持部、119 ホスト・プロセッサ命令デコーダ、121a,121b,121c,121d,121e,121h ターゲットCPU判断部、123 チェックポイント(TC)実行フラグ保持部、124 メモリ更新検出部、126 ターゲット・エリア保持部、127 メモリエリア検出部、129 変換バッファエリア保持部、132 メモリ更新回数カウント部、133メモリ更新回数比較部、140a,140b チェックポイント例外判断部、150 レジスタ・バックアップ部、154,155 ターゲットCPUメモリ更新履歴保持部、200 ホストメモリサブシステム、201 インタプリタ、S6 変換後コードの実行ステップ、S7 チェックポイント復元ステップ。[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a CPU simulator that simulates the operation of a target CPU to be simulated on a host CPU. The CPU simulator sequentially collects an operation history while sequentially processing the operation of the target CPU on the host CPU, and deletes a frequently executed part. The present invention relates to a CPU simulator that extracts and converts instruction codes at a machine language level of a target CPU into an instruction sequence of a host CPU, and executes the instruction sequence.
[0002]
[Prior art]
Conventionally, when an instruction code is converted so that a target CPU instruction can be directly executed by a host CPU, performance improvement cannot be realized by simply converting the target CPU instruction one by one into a host CPU instruction. After converting a target CPU instruction sequence into a host CPU instruction, optimization such as rearrangement of the host CPU instruction is performed (see Patent Document 1).
FIG. 16 is a diagram showing a conventional configuration, and FIG. 17 is a flowchart showing an operation of a conventional CPU simulator.
[0003]
Next, the operation will be described.
The target CPU instruction sequence is collectively converted into the host CPU instruction sequence. At this time, if the target CPU instruction to be executed exists in the
[0004]
If the target CPU instruction to be executed next does not exist as converted code and the execution of the target CPU instruction to be executed next has reached the specified number of times (Y in S2 of FIG. 17), the instruction of the target CPU is executed. After converting the sequence into the instruction sequence of the host CPU (S5 in FIG. 17), the converted code is executed (S6 in FIG. 17). When the execution of the converted code is completed (no exception has occurred) (in the case of N in S7 of FIG. 17), the checkpoint is executed (S13 of FIG. 17). That is, the
[0005]
[Patent Document 1]
USP 6,011,908
[0006]
[Problems to be solved by the invention]
The conventional CPU simulator requires large-scale hardware to hold all operation histories during execution of the converted code, and has a problem that the processing time for specifying the target CPU in which the exception has occurred becomes long.
[0007]
The present invention has been made to solve the above-described problems, and has as its object to reduce the size of hardware and improve processing performance.
[0008]
[Means for Solving the Problems]
A processor simulator according to the present invention has a configuration in which a target processor code is converted into a host processor code to simulate an operation,
If there is a checkpoint execution that means hardware resource update in the process after code conversion, a checkpoint detection unit that detects this checkpoint execution is provided,
The processing by the converted code is performed including the execution of the checkpoint, and when the host processor detects an unexpected exception processing, the processing for restoring the immediately preceding checkpoint from the detected point is performed.
[0009]
BEST MODE FOR CARRYING OUT THE INVENTION
FIG. 1 is a block diagram showing a configuration of a CPU simulator according to one embodiment of the present invention.
In FIG. 1, the present apparatus includes a host processor (CPU) 100 that executes an instruction of a target CPU, a
[0010]
FIG. 2 shows a flowchart of the CPU simulator operating on the
Next, the operation will be described with reference to FIGS.
If the target CPU instruction to be executed exists in the
[0011]
If the target CPU instruction to be executed next does not exist as the converted code and the execution of the target CPU instruction to be executed next has reached the specified number of times (Y in S2 of FIG. 2), the instruction of the target CPU is executed. After converting the sequence into an instruction sequence of the host CPU (S5 in FIG. 2), the converted code is executed (S6 in FIG. 2). When the execution of the converted code is completed (no exception has occurred) (in the case of N in S7 of FIG. 2), it is checked whether the target CPU instruction to be executed next exists in the
As described above, even during the execution of the converted code, by executing the checkpoint at an arbitrary point, the hardware for restoring the CP execution can be downsized, and the processing time when an exception occurs can be reduced.
[0012]
A specific example of the program execution unit will be described.
FIG. 3 is a block diagram showing details of the program execution unit 100b of the CPU simulator. As components added to the components shown in FIG. 1, a TCCP (target CPU checkpoint) detecting
[0013]
Next, the operation will be described with reference to FIG. That is, by providing the
[0014]
As described above, the history of only the update information of the target system accompanying the instruction execution of the target CPU is retained, the checkpoint accompanying the execution of the target CPU instruction is executed, and only the exception accompanying the execution of the target CPU instruction is executed. Is detected, the size of the CP
[0015]
FIG. 4 is a diagram illustrating an example of conversion in a conversion unit that converts a target CPU instruction sequence into a host CPU instruction sequence, and FIG. 5 is a diagram illustrating a specific configuration of a checkpoint detection unit 103.
In FIG. 5, a CP detection unit 103 that detects a checkpoint execution event of hardware resource update has a
[0016]
Next, the operation will be described.
First, a
The instruction a of the target CPU is realized by the instructions a1 and a2 of the host CPU. The instruction b of the target CPU is realized by the instructions b1 and b2 of the host CPU. The instruction c of the target CPU is realized by the instruction c1 of the host CPU. Normally, if the instruction of the target CPU appears in the order of the instruction a, the instruction b, and the instruction c, the operation of the target CPU using the instruction of the host CPU requires the instruction a1, the instruction a2, the instruction b1, the instruction b2, and the instruction b2. What is necessary is just to convert into c1. However, if the order of the instructions a1, a2, b1, b2, and c1 is executed, a stall occurs in the pipeline of the host CPU. In order to realize high speed, the
[0017]
Next, detection of a checkpoint during execution of the converted code converted by the
In the execution of the converted code obtained by converting the target CPU instruction into the host CPU instruction (S6 in FIG. 2), the host CPU instruction to be executed by the host
[0018]
As described above, the provision of the conversion unit and the TCCP determination unit enables the recognition of the checkpoint accompanying the execution of the target CPU instruction even during the execution of the instruction of the target CPU. And the processing time when an exception occurs can be reduced.
[0019]
FIG. 6 is a diagram illustrating another specific configuration of the checkpoint detection unit.
6, the
[0020]
The detection operation of the checkpoint accompanying the execution of the target CPU instruction will be described with reference to FIG.
When the converted code obtained by converting the target CPU instruction is started, a set signal is transmitted to the TC (checkpoint) execution
[0021]
As described above, by including the TC execution flag setting unit, the TC execution flag holding unit, and the TCCP determination unit, even if there is no explicit checkpoint execution command such as the command α in the command execution of the target CPU, the target Since the checkpoint accompanying the execution of the CPU instruction can be recognized, the hardware of the CP
[0022]
FIG. 7 is a diagram illustrating another specific configuration of the checkpoint detection unit.
In FIG. 7, the
[0023]
An operation of detecting a checkpoint accompanying execution of a target CPU instruction will be described with reference to FIG.
When starting the converted code obtained by converting the target CPU instruction, the TC execution
[0024]
As described above, by including the TC execution flag setting unit, the TC execution flag holding unit, the memory update detection unit, and the TCCP determination unit, even when executing the instruction of the target CPU, the memory update operation of the target CPU instruction can be performed. Since the checkpoint accompanying the execution of the instruction can be recognized, the hardware of the CP
[0025]
FIG. 8 is a diagram illustrating another specific configuration of the checkpoint detection unit.
In FIG. 8, the CP detection unit 103f has a TCCP detection unit 110f that detects a checkpoint inside, and a TCCP notification unit. The TCCP detection unit 110f further includes a T
[0026]
The detection operation of the checkpoint accompanying the execution of the target CPU instruction will be described with reference to FIG.
The area of the
[0027]
As described above, by including the T area setting unit, the T area holding unit, the memory area detection unit, the memory update detection unit, and the TCCP determination unit, even when the target CPU executes the instruction, the memory update operation of the target CPU instruction can be performed. Can be recognized as a checkpoint accompanying execution of the target CPU instruction.
[0028]
FIG. 9 is a diagram illustrating another specific configuration of the checkpoint detection unit.
In FIG. 9, the
[0029]
The detection operation of the checkpoint accompanying the execution of the target CPU instruction will be described with reference to FIG.
When the CPU simulator is started, the area of the
[0030]
As described above, by including the conversion buffer area setting unit, the conversion buffer area holding unit, the memory update detection unit, and the TCCP determination unit, even when executing the instruction of the target CPU, the memory update operation of the target CPU instruction can be performed. Checkpoints associated with the execution of instructions can be recognized.
[0031]
FIG. 10 is a diagram illustrating another specific configuration of the TCCP determination unit that determines a checkpoint.
In FIG. 10, the
[0032]
The operation of determining the checkpoint accompanying the execution of the target CPU instruction will be described with reference to FIG.
The number of times the memory update by the target CPU instruction is executed when the CPU simulator is started (or during the start) is set as the checkpoint execution in the memory update specified
[0033]
As described above, the TCCP determination unit is provided with the specified memory update count setting unit, the specified memory update count holding unit, the memory update count unit, and the memory update count comparison unit. Then, the checkpoint accompanying the execution of the target CPU instruction by the memory update operation of the target CPU instruction can be recognized.
[0034]
In the present embodiment, a specific configuration and operation of the exception detection unit will be described.
FIG. 11 is a block diagram illustrating a configuration of a TC exception detection unit that detects an exception accompanying execution of a target CPU instruction in the present embodiment.
In FIG. 11, an
[0035]
An operation of detecting an exception accompanying execution of the target CPU instruction will be described with reference to FIG.
When starting the converted code obtained by converting the target CPU instruction, the TC execution
[0036]
As described above, by providing the TC exception detection unit with the TC execution flag setting unit, the TC execution flag holding unit, and the TC exception determination unit, even if an exception has occurred in the host CPU, it is necessary to execute the target CPU instruction. Can recognize that an exception has occurred.
[0037]
FIG. 12 is a diagram illustrating another specific configuration of the TC exception detection unit.
12, the
[0038]
The operation of detecting an exception accompanying execution of the target CPU instruction will be described with reference to FIG.
When the CPU simulator is started, the area of the
[0039]
As described above, by providing the TC exception detection unit with the conversion buffer area setting unit, the conversion buffer area holding unit, and the TC exception determination unit, even if an exception occurs in the host CPU, it is not necessary to execute the target CPU instruction. Can recognize that an exception has occurred.
[0040]
In the present embodiment, a checkpoint operation of the target CPU based on the TC update information in the program execution unit will be described.
FIG. 13 is a diagram showing a configuration of a program execution unit including a register backup unit for holding register update information accompanying execution of a target CPU instruction, and FIG. 14 shows history information of memory update accompanying execution of a target CPU instruction. FIG. 6 is a diagram illustrating a configuration of a TC memory update history unit that holds the information.
In FIG. 13, a program execution unit mounted on the
[0041]
In FIG. 14, a TC update
[0042]
The checkpoint execution and restoration operation of the register information of the target CPU will be described with reference to FIG.
The converted code of the target CPU instruction is executed by allocating the register of the target CPU to the host CPU register for speeding up. The
The assignment of the target CPU register 105 in the
[0043]
The checkpoint execution and the checkpoint restoration operation of the memory update information of the target CPU will be described with reference to FIG.
First, the history retention of the memory update information of the target CPU will be described.
Of the memory update information, the memory update information by executing the host CPU instruction is stored in the host
The TC memory update
[0044]
Next, a description will be given of a checkpoint execution and a checkpoint restoration operation of memory update of the target CPU.
As the write and read pointers of the TC memory update
[0045]
When an exception due to execution of the target CPU instruction is detected, the contents of the
[0046]
As described above, by providing the TC information holding unit with the register backup unit and the TC branch update history holding unit, it is possible to execute and restore only the checkpoint by executing the target CPU instruction.
[0047]
FIG. 15 is a diagram showing another specific configuration of the TC history information holding unit.
15, the TC update
[0048]
Next, a new operation unique to the configuration in FIG. 15 different from the configuration in FIG. 14 will be described.
First, the history retention of the memory update information of the target CPU will be described.
Of the memory update information, the memory update information by executing the host CPU instruction is stored in the host
[0049]
Next, checkpoint execution and checkpoint restoration of memory update of the target CPU will be described.
As the write and read pointers of the TC memory update
Thereafter, when a memory update due to execution of the target CPU instruction is detected, the same processing is performed.
[0050]
When the checkpoint execution by the execution of the target CPU instruction is detected, the contents of the
When an exception due to execution of the target CPU instruction is detected, the contents of the
In the state where the
[0051]
As described above, by providing the TC information holding unit with the register backup unit and the TC memory update history holding unit, it is possible to execute and restore only the checkpoint by executing the target CPU instruction.
[0052]
【The invention's effect】
As described above, according to the present invention, the converted instruction including the checkpoint is executed, and the process returns to the checkpoint restoring process at the time of exception processing. Therefore, the simulation scale can be suppressed and the processing time can be reduced. There is.
[Brief description of the drawings]
FIG. 1 is a configuration diagram of a processor simulator according to
FIG. 2 is an operation flowchart of a processor simulator according to the first embodiment.
FIG. 3 is a configuration diagram of a program execution unit according to the first embodiment.
FIG. 4 is a diagram of a conversion example illustrating an operation of an interpreter according to a second embodiment of the present invention.
FIG. 5 is a diagram illustrating a configuration of a checkpoint detection unit according to the second embodiment.
FIG. 6 is a configuration diagram of another checkpoint detection unit according to the second embodiment.
FIG. 7 is a configuration diagram of another checkpoint detection unit according to the second embodiment.
FIG. 8 is a configuration diagram of another checkpoint detection unit according to the second embodiment.
FIG. 9 is a configuration diagram of another checkpoint detection unit according to the second embodiment.
FIG. 10 is a detailed configuration diagram of another checkpoint detection unit according to the second embodiment.
FIG. 11 is a diagram showing a configuration of an exception detection unit according to a third embodiment of the present invention.
FIG. 12 is a configuration diagram of another exception detection unit according to the third embodiment.
FIG. 13 is a diagram showing a configuration of a program execution unit according to
FIG. 14 is a diagram showing a configuration of a checkpoint update information holding unit according to the fourth embodiment.
FIG. 15 is a diagram showing a configuration of another checkpoint update information holding unit according to the fourth embodiment.
FIG. 16 is a diagram showing a configuration of a conventional processor simulator.
FIG. 17 is a flowchart showing the operation of a conventional processor simulator.
[Explanation of symbols]
100, 101b host processor, 101, 101b, 101c program execution unit, 103, 103c, 103d, 103e, 103f, 103g checkpoint detection unit, 104, 104c, 104d exception detection unit, 107 checkpoint execution restoration unit, 110, 110c, 110d, 110e, 110f, 110g Target CPU checkpoint detection unit, 111 Target CPU checkpoint notification unit, 112, 112c, 112d Target CPU exception detection unit, 113 Target CPU exception notification unit, 114 Target CPU checkpoint reception unit, 115 checkpoint executing unit, 116 checkpoint exception receiving unit, 117 checkpoint restoring unit, 118, 118c checkpoint update information holding unit, 119 Strike processor instruction decoder, 121a, 121b, 121c, 121d, 121e, 121h target CPU determination unit, 123 checkpoint (TC) execution flag storage unit, 124 memory update detection unit, 126 target area storage unit, 127 memory area detection Section, 129 conversion buffer area holding section, 132 memory update count section, 133 memory update count comparison section, 140a, 140b checkpoint exception judgment section, 150 register backup section, 154, 155 target CPU memory update history holding section, 200 Host memory subsystem, 201 interpreter, S6 Step of executing converted code, S7 Checkpoint restoring step.
Claims (11)
上記コード変換後の処理にハードウェア・リソース更新を意味するチェックポイント実行があると、該チェックポイント実行を検出するチェックポイント検出部を備えて、
上記変換後のコードによる処理を上記チェックポイントの実行も含めて行ない、かつ上記ホスト・プロセッサが予期しない例外処理を検出すると、該検出点から直前の上記チェックポイントを復元する処理を行なうようにしたことを特徴とするプロセッサ・シミュレータ。In a configuration that simulates the operation by converting the code of the target processor to be the code of the host processor,
When there is a checkpoint execution meaning hardware resource update in the processing after the code conversion, a checkpoint detection unit that detects the checkpoint execution is provided,
The processing based on the converted code is performed including the execution of the checkpoint, and when the host processor detects an unexpected exception processing, the processing for restoring the checkpoint immediately before the detected point is performed. A processor simulator, characterized in that:
チェックポイント検出部は、上記埋め込まれたパターンを検出するパターン判断部を備えたことを特徴とする請求項1記載のプロセッサ・シミュレータ。When converting the code of the target processor to the code of the host processor, embed a pattern corresponding to a checkpoint execution instruction,
2. The processor simulator according to claim 1, wherein the checkpoint detection unit includes a pattern determination unit that detects the embedded pattern.
チェックポイント検出部は、上記チェックポイント実行情報保持部の状態でチェックポイント検出としたことを特徴とする請求項1記載のプロセッサ・シミュレータ。A checkpoint execution information holding unit that is set when the predetermined simulation operation is started by converting the code of the target processor and is reset when the predetermined simulation operation ends,
2. The processor simulator according to claim 1, wherein the checkpoint detector detects the checkpoint in a state of the checkpoint execution information holding unit.
ホスト・プロセッサが予期しない例外処理を検出すると、上記チェックポイント実行情報保持部がセットされている場合に例外処理があったと判断するようにしたことを特徴とする請求項1記載のプロセッサ・シミュレータ。A checkpoint execution information holding unit that is set when the predetermined simulation operation is started by converting the code of the target processor and is reset when the predetermined simulation operation ends,
2. The processor simulator according to claim 1, wherein when the host processor detects unexpected exception processing, it is determined that the exception processing has occurred when the checkpoint execution information holding unit is set.
ホスト・プロセッサが予期しない例外処理を検出すると、上記メモリ範囲保持部が記憶するメモリ範囲内である場合に例外処理があったと判断するようにしたことを特徴とする請求項1記載のプロセッサ・シミュレータ。A conversion memory range holding unit that stores a memory range allocated by converting a predetermined simulation operation of the target processor,
2. The processor simulator according to claim 1, wherein when the host processor detects an unexpected exception process, it is determined that the exception process has occurred when the exception is within the memory range stored in the memory range holding unit. .
チェックポイント復元時には、上記レジスタ・バックアップ部が記憶する値を書き戻すようにしたことを特徴とする請求項1記載のプロセッサ・シミュレータ。The checkpoint update information holding unit includes a register backup unit that stores register information of the target processor,
2. The processor simulator according to claim 1, wherein the value stored in said register backup unit is written back when the checkpoint is restored.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002320860A JP2004157642A (en) | 2002-11-05 | 2002-11-05 | Processor simulator |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002320860A JP2004157642A (en) | 2002-11-05 | 2002-11-05 | Processor simulator |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2004157642A true JP2004157642A (en) | 2004-06-03 |
Family
ID=32801582
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2002320860A Pending JP2004157642A (en) | 2002-11-05 | 2002-11-05 | Processor simulator |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2004157642A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9733990B2 (en) | 2013-03-29 | 2017-08-15 | Fujitsu Limited | Information processing system and program migration method |
-
2002
- 2002-11-05 JP JP2002320860A patent/JP2004157642A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9733990B2 (en) | 2013-03-29 | 2017-08-15 | Fujitsu Limited | Information processing system and program migration method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6694427B1 (en) | Method system and apparatus for instruction tracing with out of order processors | |
US7689809B2 (en) | Transparent return to parallel mode by rampoline instruction subsequent to interrupt processing to accommodate slave processor not supported by operating system | |
US8607239B2 (en) | Lock mechanism to reduce waiting of threads to access a shared resource by selectively granting access to a thread before an enqueued highest priority thread | |
EP0828217A1 (en) | Cache flush apparatus and computer system having the same | |
EP3462324B1 (en) | Pointers in a memory managed system | |
TW201218080A (en) | Apparatus, method, and system for dynamically optimizing code utilizing adjustable transaction sizes based on hardware limitations | |
US20050055490A1 (en) | Collision handling apparatus and method | |
JP2006099800A (en) | Scheduling enhancement method and device in advanced microprocessor | |
CN111149094B (en) | Handling errors in buffers | |
US10613895B2 (en) | Virtualization of storage buffers used by asynchronous processes | |
CN107003895B (en) | Instruction sampling within transactions | |
US7765388B2 (en) | Interrupt verification support mechanism | |
US9110791B2 (en) | Optimistic object relocation | |
US9400655B2 (en) | Technique for freeing renamed registers | |
US6681321B1 (en) | Method system and apparatus for instruction execution tracing with out of order processors | |
US8601488B2 (en) | Controlling the task switch timing of a multitask system | |
JP3170472B2 (en) | Information processing system and method having register remap structure | |
JP2004157642A (en) | Processor simulator | |
JPWO2006001051A1 (en) | Multiprocessor device and control method thereof | |
US11379233B2 (en) | Apparatus and data processing method for transactional memory | |
EP0374598A2 (en) | Control store addressing from multiple sources | |
JP5376042B2 (en) | Multi-core processor system, thread switching control method, and thread switching control program | |
JP3767521B2 (en) | Cache fill control method and CPU | |
US11681527B2 (en) | Electronic device and multiplexing method of spatial | |
JP2901573B2 (en) | Super scalar information processing device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD04 | Notification of resignation of power of attorney |
Effective date: 20040519 Free format text: JAPANESE INTERMEDIATE CODE: A7424 |
|
RD04 | Notification of resignation of power of attorney |
Effective date: 20041025 Free format text: JAPANESE INTERMEDIATE CODE: A7424 |