JP2004157642A - Processor simulator - Google Patents

Processor simulator Download PDF

Info

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
Application number
JP2002320860A
Other languages
Japanese (ja)
Inventor
Koji Nishikawa
浩司 西川
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric 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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2002320860A priority Critical patent/JP2004157642A/en
Publication of JP2004157642A publication Critical patent/JP2004157642A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Retry When Errors Occur (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To reduce an imitating scale, and to shorten a processing time in a system of a host processor imitating a target processor. <P>SOLUTION: When checkpoint execution which means a hardware resource update is performed in processing after code conversion, a checkpoint detecting part for detecting the checkpoint execution is provided, and the processing is performed by converted the code (S6) while the execution of the checkpoint is performed. When the host processor detects unexpected exception processing, processing (S8) for restoring the checkpoint immediately before the detected point is performed. <P>COPYRIGHT: (C)2004,JPO

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 conversion buffer 203 as a converted code (Y in S1 of FIG. 17). In this case, the converted code is executed (S6P in FIG. 17), and if the converted code does not exist in the conversion buffer 203 (N in S1 in FIG. 17), the number of executions up to the specified number is performed. It is determined whether or not it has reached (S2 in FIG. 17). If the specified number of times has not been reached (N in S2 of FIG. 17), the interpreter 201 performs the sequential processing of the target CPU instruction (S3 of FIG. 17). When the occurrence of an exception is detected during execution of the interpreter 201 (Y in S4 of FIG. 17), the exception handler of the target CPU (S11 of FIG. 17) is executed. If no exception occurs during the execution of the interpreter 201 (N in S4 of FIG. 17), it is checked whether the target CPU instruction to be executed next exists in the conversion buffer 203 as a converted code (FIG. 17). S1).
[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 GATE pointer 152 indicating the boundary between committed and uncommitted in the Gated store buffer 156 is aligned with the TAIL pointer 151. If an event occurs in which the instruction sequence of the host CPU instruction that considers that there is no exception during execution of the converted code (in the case of Y in S7 of FIG. 17), the instruction in which the exception has occurred is the target CPU instruction. In order to specify whether or not the host CPU instruction has been executed, the state of the host CPU is restored until execution of the converted code (S12 in FIG. 17). That is, by returning the TAIL pointer 151 indicating the last uncommitted in the Gated store buffer 156 to the GATE pointer 152 indicating that the commit has been completed, the operation of the target CPU instruction sequence is returned to the state before executing the converted code. . Thereafter, the interpreter sequentially executes processing (S9 and S10 in FIG. 17), identifies the target CPU instruction that caused the exception, and determines that an exception has occurred due to execution of the target CPU instruction. S11) is performed.
[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
Embodiment 1 FIG.
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 program execution unit 101 mounted on the host CPU 100, and configured to fetch, dispatch, and operate an instruction. A host CPU register 102 used for executing an operation, a CP (checkpoint) detection unit 103 for detecting a checkpoint execution event for updating a hardware resource of the host CPU 100, an exception for detecting an event such as an exception A detection unit 104, a target CPU register 105 allocated as a register of the target CPU on the host CPU register 102, and a host CPU store buffer 106 for buffering information on memory update executed by the program execution unit 101 A checkpoint (CP) execution restoring unit 107 for executing a checkpoint according to the notification from the CP detection unit 103 and restoring the hardware resources of the host CPU to the last executed checkpoint according to the notification from the exception detection unit 104; A cache memory 108 for holding instructions and data used by the execution unit 101, a host memory subsystem 200 connected to the host CPU 100, an interpreter program 201 for sequentially executing target CPU instructions, and converting target CPU instructions to host CPU instructions. A translator program 202, a conversion buffer 203 for storing the converted code converted by the translator program 202, and hardware resources of the target system allocated in the host memory subsystem 200. Consisting each component of over scan 204.
[0010]
FIG. 2 shows a flowchart of the CPU simulator operating on the host CPU 100.
Next, the operation will be described with reference to FIGS.
If the target CPU instruction to be executed exists in the conversion buffer 203 as a converted code (Y in S1 in FIG. 2), the converted code is executed (S6 in FIG. 2). At this time, a checkpoint is executed even during execution of the converted code. The execution of the checkpoint is detected by the CP detection unit 103, and the CP execution restoration unit 107 executes the checkpoint. If the converted code does not exist in the conversion buffer 203 (in the case of N in S1 of FIG. 2), it is determined whether the number of executions so far has reached a specified number (S2 of FIG. 2). If the specified number has not been reached (N in S2 of FIG. 2), the interpreter 201 performs the sequential processing of the target CPU instruction (S3 of FIG. 2). When the occurrence of an exception is detected during execution of the interpreter 201 (Y in S4 of FIG. 2), the exception handler of the target CPU (S11 of FIG. 2) is executed. If no exception occurs during the execution of the interpreter 201 (N in S4 of FIG. 2), it is checked whether the target CPU instruction to be executed next exists in the conversion buffer 203 as a converted code (FIG. 2). S1).
[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 conversion buffer 203 as the converted code. (S1 in FIG. 2). When the exception detection unit 104 detects an exception during the execution of the converted code (Y in S7 of FIG. 2), the CP execution restoration unit 107 restores the state of the host CPU to the state of the last checkpoint executed. (S8 in FIG. 2). After that, the interpreter performs sequential processing (S9 and S10 in FIG. 2), identifies the target CPU instruction that caused the exception, and determines that an exception has occurred due to the execution of the target CPU instruction. S11) is performed.
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 unit 110 for detecting a checkpoint accompanying execution of a target CPU instruction, and a checkpoint execution detected by the TCCP detecting unit 110 as a CP. A TCCP notifying unit 111 for notifying the execution restoring unit 107, a TC (target CPU) exception detecting unit 112 for detecting an exceptional event caused by execution of the target CPU instruction, and a CP execution restoring unit for detecting an exceptional event detected by the TC exception detecting unit 112. The TC exception notifying unit 113 notifies the TCCP receiving unit 107 of the detection of the checkpoint accompanying the execution of the target CPU instruction from the TCCP notifying unit 111. Execute points P execution unit 115, TC exception reception unit 116 that receives from the TC exception notification unit 113 that the exception accompanying the execution of the target CPU instruction is detected, and TC that collects and holds the update information of the hardware resources of the target system. There is a CP restoring unit 117 that restores the TC update information holding unit 118 to the last executed checkpoint state based on the notification to the update information holding unit 118 and the TC exception receiving unit 116. The other numbered components are the same as those in FIG.
[0013]
Next, the operation will be described with reference to FIG. That is, by providing the TCCP detection unit 110 and the TCCP notification unit 111 as the checkpoint detection unit 103b, only the checkpoint accompanying the instruction execution of the target CPU is extracted and detected, and notified to the CP execution restoration unit 107b. Execute In addition, by providing the TC exception detecting unit 112 and the TC exception notifying unit 113 as the exception detecting unit 104b, only the exception accompanying the instruction execution of the target CPU is extracted and detected, and the exception is notified to the CP execution restoring unit 107 and checked. Restore points. In addition, by providing the TCCP receiving unit 114, the CP executing unit 115, the TC exception receiving unit 116, the CP restoring unit 117, and the TC update information holding unit 118 as the CP execution restoring unit 107b, the target CPU executes instructions. The history of only the update information of the target system is retained, and the checkpoint is executed and restored.
[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 execution restoring unit 107 can be reduced, and the processing time when an exception occurs can be reduced.
[0015]
Embodiment 2 FIG.
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 TCCP detection unit 110c that detects a checkpoint accompanying execution of a target CPU instruction, and a TCCP notification unit 111 therein. . It also has an instruction decoder 120 for the host CPU. Further, the TCCP detection unit 110c includes a TCCP determination unit 121a that determines whether a checkpoint is detected by executing a target CPU instruction.
[0016]
Next, the operation will be described.
First, a translator 202c that is a conversion unit that converts a target CPU instruction sequence into a host CPU instruction will be described with reference to FIG.
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 translator 202c performs optimization so as to eliminate the stall of the pipeline by rearranging the instructions a1, b1, c1, a2, and b1. The translator 202c divides the instruction sequence of the target CPU into several instruction sequences and performs optimization. At this time, a converted code in which a checkpoint execution instruction α indicating a break of the instruction of the target CPU is embedded in the divided gap is generated and stored in the conversion buffer 203 allocated on the host memory subsystem 200. The place where the instruction α is embedded is not limited to the divided gap, but may be any place where the instruction position of the target CPU can be specified.
[0017]
Next, detection of a checkpoint during execution of the converted code converted by the translator 202c will be described with reference to FIG.
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 CPU instruction decoder 120 includes an input including the instruction α generated by the translator 202c. Then, the host CPU instruction decoder 120 performs instruction decoding according to the bit pattern of the input instruction code. At this time, when the bit pattern of the instruction α is decoded, the TCCP determining unit 121a is notified that the instruction α has been decoded. The TCCP determining unit 121a determines that the instruction α has been executed according to the notification indicating that the instruction α has been decoded from the host CPU instruction decoder 120 and the instruction execution signal, and detects the execution of the checkpoint.
[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 CP detection unit 103d includes a TCCP detection unit 110d that detects a checkpoint accompanying execution of a target CPU instruction, and a TCCP notification unit 111. The TCCP detection unit 110d sets the TC execution flag holding unit 123 internally indicating execution of the target CPU instruction, sets the TC execution flag holding unit 123 at the start of execution of the converted instruction code, and sets the TC execution flag holding unit 123 at the end. It has a TC execution flag setting unit 123 to reset, and a TCCP determination unit 121b that determines checkpoint detection based on the end of execution of the converted instruction code of the target CPU instruction.
[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 flag holding unit 123 using the TC execution flag setting unit 122. Further, when the execution of the converted code ends, the reset signal is transmitted to the TC execution flag holding unit 123 using the TC execution flag setting unit 122. The TC execution flag holding unit 123 holds a target CPU execution flag indicating execution of a target CPU instruction according to a set / reset signal from the TC execution flag setting unit 122. The TCCP determining unit 121b observes that the target CPU execution flag held in the TC execution flag holding unit 123 has changed from the set state to the reset state, and determines that a checkpoint has been executed along with execution of the target CPU instruction. , To the TCCP notification unit 111.
[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 execution restoring unit 107 can be reduced in size and the processing time when an exception occurs can be reduced.
[0022]
FIG. 7 is a diagram illustrating another specific configuration of the checkpoint detection unit.
In FIG. 7, the CP detection unit 103e includes a TCCP detection unit 110e that detects a checkpoint accompanying execution of a target CPU instruction, and a TCCP notification unit. Further, the CP detection unit 110e includes a TCCP determination unit 121e that determines a checkpoint detection based on the completion of execution of the converted instruction code of the target CPU instruction, and a memory update detection unit 124 that detects a memory update of the CPU 100. The other elements are the same as the elements of the same numbers shown in FIG.
[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 flag setting unit 122 transmits a set signal to the TC execution flag holding unit 123. When the execution of the converted code ends, a reset signal is transmitted to the TC execution flag holding unit 123. The TC execution flag holding unit 123 thus holds the set / reset of the target CPU execution flag. The memory update detection unit 124 detects a memory update event from the memory access information, and notifies the TCCP determination unit 121c that a memory update has occurred. The TCCP determining unit 121c receives the notification that the target CPU execution flag held in the TC execution flag holding unit 123 is set, and the memory update detection unit 124 notifies that the memory update has occurred. It is determined that the checkpoint is to be executed, and the TCCP notification unit 111 is notified.
[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 execution restoring unit 107 can be reduced in size, and the processing time when an exception occurs can be reduced.
[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 area setting unit 125 for setting the start address and end address of the target system 204 internally allocated on the host memory subsystem 200 in the T area holding unit, and an allocation on the host memory subsystem 200. The T (target system) area holding unit 126c for holding the start address and the end address of the target system 204, the memory update detection unit 124 for detecting the memory update of the host CPU 100, and the T area holding unit 126 for holding the memory access. A memory area detection unit 127 for detecting whether the access is to the target system 204 indicated by the start address of the T system and an end address of the T system, and a TCCP determination unit 12 for determining the checkpoint detection by updating the memory of the target system 204. With a d.
[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 target system 204 to be allocated to the host memory subsystem 200 when the CPU simulator is started is determined, and the start address and the end address of the target system 204 are set in the T area holding unit 126 using the T area setting unit 125. The memory area detection unit 127 monitors the address information in the memory access information, and detects whether the memory access is to the target system 204 indicated by the held T system start address and T area end address. When it is detected that the memory access is a memory access to the target system 204, a notification is sent to the TCCP determining unit 121d. The memory update detection unit 124 detects a memory update event from the memory access information, and notifies the TCCP determination unit 121d that a memory update has occurred. The TCCP determination unit 121d receives the notification from the memory area detection unit 127 that the memory access is within the range of the target system 204, receives a notification from the memory update detection unit 124 that a memory update has occurred, and checks by executing the target CPU instruction. It is determined that the point has been executed, and the TCCP notification unit 111 is notified.
[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 CP detecting unit 103g has a TCCP detecting unit 110g for detecting a checkpoint therein and a TCCP notifying unit. The TCCP detection unit 110g includes a conversion buffer area setting unit 128 that sets the start address and the end address of the conversion buffer 203 internally allocated on the host memory subsystem 200 in the conversion buffer area holding unit; A conversion buffer area holding unit 129 that holds the allocated start address and end address of the conversion buffer 203, a memory update detection unit 124, and a TCCP determination unit that determines the checkpoint detection by updating the memory for executing the converted code of the target CPU instruction. 121e.
[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 conversion buffer 203 to be allocated to the host memory subsystem 200 is determined, and the start address and the end address of the conversion buffer 203 are set in the conversion buffer area holding unit 129 using the conversion buffer area setting unit 128. The memory update detection unit 124 detects a memory update event from the memory access information, and notifies the TCCP determination unit 121e that a memory update has occurred. The TCCP determining unit 121e monitors the program counter of the host CPU, and executes instructions in the conversion buffer 203 indicated by the conversion buffer start address and the conversion buffer end address held by the conversion buffer area holding unit 129. Receiving the notification that the memory update has occurred from 124, it determines that a checkpoint has been executed by executing the target CPU instruction, and notifies the TCCP notification unit 111.
[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 TCCP notifying unit 111 and the TCCP judging unit 121h shown together with the memory update detecting unit 124 for detecting the memory update of the host CPU 100 detect the checkpoint by the memory update of the execution of the converted code of the target CPU instruction. to decide. A memory update specified number setting unit 130 that sets the specified number of memory updates in the memory update specified number holding unit, a memory update specified number storage unit 131 that holds the specified number of memory updates, and a memory update detection unit 124 The memory update count unit 132 counts the number of detected memory updates and the memory update count counted by the memory update count count unit 132 matches the specified count held by the memory update count holding unit 131. It has a memory update count comparison unit 133 that issues a reset request to the update count unit 132 and notifies the TCCP notification unit that a target CPU checkpoint has been detected.
[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 number holding unit 131 using the memory update specified number setting unit 130. I do. As described above, the TCCP determination units 121c to 121e not only determine that the memory update due to the execution of the target CPU instruction is the execution of the checkpoint of the execution of the target CPU instruction, but also determine the number of times of memory update by the memory update number counting unit 132. The counted value is compared with the value of the memory update count holding unit 131 that holds the preset specified count by the memory update count comparison unit 133. If the counted value matches or exceeds the specified value, It is determined that the checkpoint is executed by executing the target CPU instruction, and the TCCP notification unit 111 is notified. At the same time, a reset request is notified to the memory update number counting unit 132 that counts the number of memory updates. The memory update number counting unit 132 clears the number of memory updates in response to the reset request from the memory update number comparison unit 133. Thereafter, counting of the number of memory updates is started again.
[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]
Embodiment 3 FIG.
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 exception detection unit 104c that detects an event such as an exception includes a TC exception detection unit 112c that internally detects an exception event caused by execution of a target CPU instruction, and an exception event detected by the TC exception detection unit 112c. It has a TC exception notifying unit 113 that notifies the CP execution restoring unit 107. Further, the TC exception detection unit 112c internally sets a TC execution flag holding unit at the start of execution of the converted instruction code and resets the TC execution flag at the end thereof, and holds a TC execution flag indicating execution of the target CPU instruction. A unit 123 and a TC exception determination unit 140a for detecting a target CPU exception by setting the target CPU execution flag holding unit 123 when an exception event occurs in the host CPU.
[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 flag setting unit 122 transmits a set signal to the TC execution flag holding unit 123. When the execution of the converted code is completed, the TC execution flag setting unit 122 transmits a reset signal to the TC execution flag holding unit 123. The TC execution flag holding unit 123 holds a target CPU execution flag indicating execution of a target CPU instruction according to a set / reset signal from the TC execution flag setting unit 122. If the target CPU execution flag holding unit 123 is set when an exception event occurs in the host CPU, the TC exception determination unit 140a determines that the exception is accompanied by the execution of the target CPU instruction, and the TC exception notification unit 113 The occurrence of an exception accompanying the execution of the target CPU instruction is notified.
[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 exception detection unit 104d has a TC exception detection unit 112d and a TC exception notification unit 113 inside. The exception detection means 112d includes a conversion buffer area setting unit 128 for setting the start address and the end address of the conversion buffer 203 internally allocated on the host memory subsystem 200 in the conversion buffer area holding unit, A conversion buffer area holding unit 129 for holding the assigned start address and end address of the conversion buffer 203, and a conversion buffer for holding the program counter of the host CPU when the exception event occurs in the host CPU in the conversion buffer area holding unit 129. A TC exception judging unit 140b judges whether or not the address is included in the area designated by the start address and the end address of 203, and detects the target CPU exception when it is included.
[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 conversion buffer 203 to be allocated to the host memory subsystem 200 is determined, and the start address and the end address of the conversion buffer 203 are set in the conversion buffer area holding unit 129 using the conversion buffer area setting unit 128. The TC exception judging unit monitors the value of the program counter of the host CPU, and when an exception event occurs in the host CPU, the program counter of the host CPU stores the conversion buffer start address and the end of the conversion buffer held in the conversion buffer area holding unit 129. Since the instruction is executed in the conversion buffer 203 indicated by the address, it is determined that the instruction is an exception accompanying the execution of the target CPU instruction, and the TC exception notification unit 113 is notified of the occurrence of the exception accompanying the execution of the target CPU instruction.
[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]
Embodiment 4 FIG.
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 host CPU 100 and configured to fetch, dispatch, and operate instructions is internally provided with a host CPU register 102 used for performing an operation and the like, and a host CPU register 102 on the host CPU register 102. It has a target CPU register 105 allocated as a register of the target CPU, and a TC update information holding unit 118 that collects and holds update information of hardware resources of the target system. In addition, the CP execution unit 115 that executes a checkpoint based on a checkpoint execution notification to the TCCP receiving unit 114 and the TC update information holding unit 118 are restored to the last executed checkpoint state based on a notification to the TC exception receiving unit 116. And a register backup unit 150 that backs up a register of the target CPU allocated to the host CPU register 102 by executing a checkpoint.
[0041]
In FIG. 14, a TC update information holding unit 118 internally stores a TC memory update history holding unit 154 that holds a pair of an update address and an update data of a memory update accompanying execution of a target CPU instruction, and a TC (target CPU). A TAIL pointer 151 indicating the last uncommitted in the memory update history holding unit 154, a GATE pointer 152 indicating a boundary between committed and uncommitted in the TC memory update history holding unit 154, and committed in the TC memory update history holding unit 154. The HEAD pointer 153 indicates that the memory update information is reflected in the cache memory 108. Other elements are the same as the elements of the same numbers shown in FIGS.
[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 CP execution unit 115 requested to execute the checkpoint by detecting the checkpoint execution event performs the checkpoint by copying the target CPU register 105 assigned to the host CPU register 102 to the register backup unit 150. The CP restoring unit 117, which has been requested to restore the checkpoint by detecting the exceptional event, stores the target CPU register information stored in the register backup unit 150 at the time of executing the last checkpoint in the target assigned to the host CPU register 102. The checkpoint is restored by writing back to the CPU register 105. If the checkpoint is executed before the checkpoint is restored, the register information of the current target CPU register 105 is overwritten on the register backup unit 150 without restoring the checkpoint.
The assignment of the target CPU register 105 in the host CPU register 102 may be fixed or may be set when the CPU simulator is activated.
[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 CPU store buffer 106, and the memory update information by executing the target CPU instruction is stored in the TC memory update history holding unit 154. The determination as to whether the update of the memory is due to the execution of the target CPU instruction or the execution of the host CPU instruction is performed by the TC execution flag setting unit 122, the TC execution flag holding unit 123, the memory update detection unit 124, and the TCCP determination unit 121c. To include, a T area setting unit 125, a T area holding unit 126, a memory update detecting unit 124, a memory area detecting unit 127, and a TCCP determining unit 121d, or a conversion buffer area setting unit 128 and a conversion buffer area holding This can be achieved by including a unit 129, a memory area detection unit 127, and a TCCP determination unit 121e.
The TC memory update history holding unit 154 holds a pair of a memory update address and information on update data by executing a target CPU instruction.
[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 history holding unit 154, a TAIL pointer 151 indicating the last uncommitted state of the TC memory update history holding unit 154, a GATE pointer 152 indicating a boundary between committed and uncommitted, a committed memory update There are three pointers, a HEAD pointer 153, indicating that the information has been reflected in the cache memory 108. The initial state of the three pointers indicates the same location in the TC memory update history holding unit 154. In this case, the location pointed to may be the beginning, end, or middle of the TC memory update history holding unit 154. When the memory update due to the execution of the target CPU instruction is detected, the information of the memory update address and the update data is held as a pair at the position of the TC memory update history holding unit 154 indicated by the TAIL pointer 151, and the TAIL pointer 151 is moved by one. I do. Thereafter, when a memory update due to execution of the target CPU instruction is detected, the same processing is performed. On the other hand, when the execution of the checkpoint due to the execution of the target CPU instruction is detected, the contents of the TAIL pointer 151 are copied to the GATE pointer 152 according to an instruction from the CP execution unit 115. The TAIL pointer 151 is updated while holding the information of the memory update address and the update data in the TC memory update history holding unit 154 until the checkpoint is detected by executing the next target CPU instruction.
[0045]
When an exception due to execution of the target CPU instruction is detected, the contents of the GATE pointer 152 are copied to the TAIL pointer 151 according to an instruction from the CP restoring unit 117, and the TC memory update history holding unit 154 returns to the state at the time of the last checkpoint execution. Will be restored. The memory update information committed by the checkpoint execution notifies the cache memory 108 of a pair of a memory update address and update data held by the TC memory update history holding unit 154 indicated by the HEAD pointer 153, and updates the cache memory at the same time. , HEAD pointer 153 is updated. The HEAD pointer 153 is controlled independently of the TAIL pointer 151 and the GATE pointer 152. However, since the uncommitted memory update information is stored in the cache memory 108, the HEAD pointer 153 cannot overtake the GATE pointer 152.
[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 information holding unit 118c has a TC memory update history holding unit 155 that holds a pair of an update address, update data, and pre-update data of a memory update accompanying execution of a target CPU instruction. That is, as compared with the configuration of FIG. 14, the pre-update data is held as a pair.
[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 CPU store buffer 106, and the memory update information by executing the target CPU instruction is stored in the TC memory update history holding unit 154. The determination as to whether the update of the memory is due to the execution of the target CPU instruction or the execution of the host CPU instruction is performed by the TC execution flag setting unit 122, the TC execution flag holding unit 123, the memory update detection unit 124, and the TCCP determination unit 121c. Or a T area setting unit 125, a T area holding unit 126, a memory update detecting unit 124, a memory area detecting unit 127, and a TCCP determining unit 121d, or a conversion buffer area setting unit 128 and a conversion buffer area holding unit. 129, a memory area detection unit 127, and a TCCP determination unit 121e. The TC memory update history holding unit 155 holds a pair of the memory update address, the updated data, and the information of the data before update by executing the target CPU instruction.
[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 history holding unit 155, a TAIL pointer 151 indicating the last uncommitted, a GATE pointer 152 indicating the boundary between committed and uncommitted, and a memory update committed by the TC memory update history holding unit 155 There are three pointers, a HEAD pointer 153, indicating that the information has been reflected in the cache memory 108. The initial state of the three pointers indicates the same location. When the memory update by the execution of the target CPU instruction is detected, the cache memory 108 is referred to by the memory update address, the data before the update is acquired, and the TC memory update history holding unit 155 indicated by the TAIL pointer 151 stores the memory update address and the memory update address. The information of the update data and the information of the data before update are held in pairs, and the TAIL pointer 151 is moved by one.
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 TAIL pointer 151 are copied to the GATE pointer 152. Until the checkpoint is detected by executing the next target CPU instruction, the TAIL pointer 151 is updated while holding the memory update address, the update data, and the information of the pre-update data in the TC memory update history holding unit 155 as a pair.
When an exception due to execution of the target CPU instruction is detected, the contents of the GATE pointer 152 are copied to the TAIL pointer 151, and the TC memory update history holding unit 155 is restored to the state at the time of the last checkpoint execution. The memory update information committed by the checkpoint execution notifies the cache memory 108 of the pair of the memory update address and the update data at the position held by the TC memory update history holding unit 155 indicated by the HEAD pointer 153, and At the same time as updating, the HEAD pointer 153 is updated. The HEAD pointer 153 is controlled independently of the TAIL pointer 151 and the GATE pointer 152.
In the state where the HEAD pointer 153 overtakes the GATE pointer 152 and updates the cache memory 108, if a checkpoint is restored by detecting an exception, the TC memory update history between the HEAD pointer 153 and the GATE pointer 152 is retained. The content of the pre-update data held by the unit 155 is stored in the cache memory 108 according to the memory update address, thereby restoring the cache memory 108. Further, the contents of the GATE pointer 152 are copied to the HEAD pointer 153.
[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 Embodiment 1 of the present invention.
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 Embodiment 4 of the present invention.
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記載のプロセッサ・シミュレータ。2. A checkpoint update information holding unit for holding checkpoint update information, wherein at the time of checkpoint restoration processing, restoration processing is performed based on the information of the checkpoint update information holding unit. Processor simulator as described. ターゲット・プロセッサのコードをホスト・プロセッサのコードに変換する際に、チェックポイント実行命令に相当するパターンを埋め込み、
チェックポイント検出部は、上記埋め込まれたパターンを検出するパターン判断部を備えたことを特徴とする請求項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記載のプロセッサ・シミュレータ。2. The processor according to claim 1, further comprising: a memory update detection unit that detects a memory update on the host processor side, wherein the checkpoint detection unit determines the memory update as detection of a checkpoint. Simulator. 所定模擬動作の対象となるターゲット・プロセッサ側のコードがあるメモリ範囲か、または所定模擬動作を変換後の割付メモリ範囲、を記憶するメモリ範囲保持部を備えて、該範囲内のコード実行であることをメモリ更新検出に付加するようにしたことを特徴とする請求項5記載のプロセッサ・シミュレータ。A memory range holding unit for storing a memory range where a code of a target processor to be subjected to a predetermined simulation operation is located or an allocated memory range after conversion of the predetermined simulation operation is provided, and code execution within the range is performed. 6. The processor simulator according to claim 5, wherein the fact is added to the memory update detection. メモリ更新回数記憶部を備えて、メモリ更新検出は、上記メモリ更新回数記憶部が規定以上の回数ある場合にメモリ更新検出としたことを特徴とする請求項5記載のプロセッサ・シミュレータ。6. The processor simulator according to claim 5, further comprising a memory update count storage unit, wherein the memory update detection is a memory update detection when the memory update count storage unit has a predetermined number of times or more. ターゲット・プロセッサのコードを変換して所定模擬動作を開始する時にセットされ、該所定模擬動作が終わるとリセットされるチェックポイント実行情報保持部を備えて、
ホスト・プロセッサが予期しない例外処理を検出すると、上記チェックポイント実行情報保持部がセットされている場合に例外処理があったと判断するようにしたことを特徴とする請求項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.
チェックポイント更新情報保持部は、ターゲットプロセッサのコード実行によりメモリされると、これをメモリ更新アドレスと、更新データを対にして記憶するようにしたことを特徴とする請求項10記載のプロセッサ・シミュレータ。11. The processor simulator according to claim 10, wherein the checkpoint update information holding unit stores, when stored by execution of code of the target processor, a memory update address and update data as a pair. .
JP2002320860A 2002-11-05 2002-11-05 Processor simulator Pending JP2004157642A (en)

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)

* Cited by examiner, † Cited by third party
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

Cited By (1)

* Cited by examiner, † Cited by third party
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