JP2011060080A - Simulation apparatus, simulation method and program for simulation - Google Patents

Simulation apparatus, simulation method and program for simulation Download PDF

Info

Publication number
JP2011060080A
JP2011060080A JP2009210234A JP2009210234A JP2011060080A JP 2011060080 A JP2011060080 A JP 2011060080A JP 2009210234 A JP2009210234 A JP 2009210234A JP 2009210234 A JP2009210234 A JP 2009210234A JP 2011060080 A JP2011060080 A JP 2011060080A
Authority
JP
Japan
Prior art keywords
instruction
decode
command
memory
simulation
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.)
Granted
Application number
JP2009210234A
Other languages
Japanese (ja)
Other versions
JP5322867B2 (en
JP2011060080A5 (en
Inventor
Yaku Uma
躍 馬
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.)
Renesas Electronics Corp
Original Assignee
Renesas Electronics 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 Renesas Electronics Corp filed Critical Renesas Electronics Corp
Priority to JP2009210234A priority Critical patent/JP5322867B2/en
Publication of JP2011060080A publication Critical patent/JP2011060080A/en
Publication of JP2011060080A5 publication Critical patent/JP2011060080A5/en
Application granted granted Critical
Publication of JP5322867B2 publication Critical patent/JP5322867B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To solve such a problem that when an instruction is directly edited by a memory window or the like of a debugger in a conventional simulator (simulation apparatus), the edited contents may be made different from the contents of a decode cache and a correct instruction cannot be executed. <P>SOLUTION: A simulator (simulation apparatus 10) includes: an instruction change notification part 1211 which, when the contents of a memory are rewritten and the contents are an instruction, sets a change flag in a decode cache of the corresponding instruction; and an execution simulation part 123 for detecting whether the change flag exists in the decode cache during execution of the instruction, and when the change flag exists, performing re-fetch and decoding. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、シミュレーション装置に関し、特にマイコンの動作をシミュレーションしデバッグするシミュレーション装置に関する。   The present invention relates to a simulation apparatus, and more particularly to a simulation apparatus that simulates and debugs the operation of a microcomputer.

ここでは、計算機等の動作をシミュレーションするシミュレーション装置をシミュレータと呼ぶ。従来技術のシミュレータの一例として、特開2005−63165号公報(特許文献1)に仮想計算機の高速エミュレータが開示されている。この従来技術では、エミュレータに、命令フェッチとデコードの処理の結果を保存しておくデコードキャッシュを設ける。命令の最初の実行時に、デコードキャッシュにデコードした結果を保存しておく。次回の実行の際には保存したキャッシュの内容を再利用する。デコードキャッシュには、仮想命令ポインタをキーとして実行処理ルーチンのアドレスと対応させて保持する。実行処理ルーチンでは、仮想命令に対応した実行処理を行なう。仮想命令ポインタに基づいて命令のフェッチ時にデコードキャッシュを調べ、デコード結果が存在すればそれを使用し、デコード結果が存在しなければ仮想命令ポインタに基づいて命令をデコードし、結果をデコードキャッシュに登録する。   Here, a simulation device that simulates the operation of a computer or the like is called a simulator. As an example of a prior art simulator, Japanese Unexamined Patent Application Publication No. 2005-63165 (Patent Document 1) discloses a high-speed emulator for a virtual machine. In this prior art, the emulator is provided with a decode cache for storing the results of instruction fetch and decode processing. At the first execution of the instruction, the decoded result is stored in the decode cache. The saved cache contents are reused at the next execution. In the decode cache, a virtual instruction pointer is used as a key and held in correspondence with the address of the execution processing routine. In the execution processing routine, execution processing corresponding to the virtual instruction is performed. Checks the decode cache when fetching an instruction based on the virtual instruction pointer, uses the decode result if it exists, decodes the instruction based on the virtual instruction pointer if the decode result does not exist, and registers the result in the decode cache To do.

従来技術のシミュレータでは、命令がデバッガのメモリウィンドウ等で直接編集された場合、デコード・キャッシュの内容と異なってしまい、正しい命令の実行が行えない。   In the simulator of the prior art, when the instruction is directly edited in the memory window of the debugger, the contents are different from the contents of the decode cache, and the correct instruction cannot be executed.

従来技術のシミュレータでは、シミュレータに命令フェッチとデコードの処理の結果を保存しておくデコード・キャッシュを設ける。命令の最初の実行時に、デコード・キャッシュにデコードした結果を保存しておく。次回の実行の際には保存したキャッシュの内容を再利用し、実行を高速化することができた。   In the prior art simulator, the simulator is provided with a decode cache for storing the results of instruction fetch and decode processing. At the first execution of the instruction, the decoded result is stored in the decode cache. At the next execution, the saved cache contents could be reused to speed up the execution.

従来技術の問題点は、命令がデバッガのメモリウィンドウ等で直接編集され、デコード・キャッシュの内容と異なってしまった場合の考慮がない点である。   The problem with the prior art is that there is no consideration when the instruction is directly edited in the memory window of the debugger or the like and differs from the contents of the decode cache.

特開2005−63165号公報JP 2005-63165 A

従来技術の課題であったメモリ上で書き換えが発生した場合の考慮に関して、デコード・キャッシュに変更フラグを追加することで対処する。メモリ上で書き換えが発生した場合には、変更フラグをセットし、実行時に、対象命令のデコード・キャッシュに変更フラグがあれば、再フェッチ・デコードを行うという工夫を行うことで解決を図る。   Regarding the consideration when rewriting occurs on the memory, which is a problem of the prior art, it is dealt with by adding a change flag to the decode cache. When rewriting occurs in the memory, the change flag is set, and if there is a change flag in the decoding cache of the target instruction at the time of execution, the solution is achieved by performing refetching / decoding.

本発明のシミュレータ(シミュレーション装置)は、命令変更通知部と、実行シミュレーション部を具備する。命令変更通知部は、メモリが書き換えられた際、書き換えられた内容が命令であれば、該当する命令のデコード・キャッシュに変更フラグを立てる。実行シミュレーション部は、該当命令実行時に、デコード・キャッシュに変更フラグがあるかを検出し、変更フラグがあれば、再フェッチ・デコードを行う。   The simulator (simulation apparatus) of the present invention includes an instruction change notification unit and an execution simulation unit. When the memory is rewritten and the rewritten content is an instruction, the instruction change notification unit sets a change flag in the decode cache of the corresponding instruction. The execution simulation unit detects whether there is a change flag in the decode cache at the time of execution of the corresponding instruction, and if there is a change flag, performs refetch / decode.

メモリ上の変更情報をデコード・キャッシュに通知する手段を確立し、メモリ上に変更があった際、デコード・キャッシュに変更フラグを立て、実行時に変更フラグがあった場合、メモリから再度フェッチ・デコードを行ってから、随時正しい命令実行することができる。   Establishing a means to notify the decoding cache of the change information in the memory. When there is a change in the memory, a change flag is set in the decode cache. If there is a change flag at the time of execution, fetch / decode from the memory again. After executing the above, the correct instruction can be executed at any time.

本発明のシミュレータ(シミュレーション装置)の構成例を示すブロック図である。It is a block diagram which shows the structural example of the simulator (simulation apparatus) of this invention. 本発明のシミュレータの動作を示すフローチャートである。It is a flowchart which shows operation | movement of the simulator of this invention. 本発明のシミュレータの動作を示すフローチャートである。It is a flowchart which shows operation | movement of the simulator of this invention.

以下に、本発明の第1実施形態について添付図面を参照して説明する。
本発明のシミュレータは、マイコンの動作をシミュレーションするシミュレーション装置であり、PC(パソコン)と、当該PC上で動くアプリケーションプログラムとの組み合わせにより実現される。本発明のシミュレータを使うことにより、PC上でマイコンの動作をシミュレーションすることが可能となる。なお、PCは一例に過ぎない。他にも、本発明のシミュレータを実現するハードウェアの例として、I/O(Input/Output)ボード、シンクライアントサーバ、ワークステーション、メインフレーム、スーパーコンピュータ、携帯端末、家庭用ゲーム機、情報家電(information home appliance)、POS(Point of Sale)端末、OA(Office Automation)機器等が考えられる。また、本発明のシミュレータは、端末やサーバに限らず、中継機器や周辺機器でも良い。但し、実際には、これらの例に限定されない。
Hereinafter, a first embodiment of the present invention will be described with reference to the accompanying drawings.
The simulator of the present invention is a simulation device that simulates the operation of a microcomputer, and is realized by a combination of a PC (personal computer) and an application program that runs on the PC. By using the simulator of the present invention, it is possible to simulate the operation of the microcomputer on the PC. A PC is only an example. Other examples of hardware for realizing the simulator of the present invention include an I / O (Input / Output) board, a thin client server, a workstation, a mainframe, a supercomputer, a portable terminal, a home game machine, and an information appliance. (Information home application), POS (Point of Sale) terminals, OA (Office Automation) devices, and the like are conceivable. The simulator of the present invention is not limited to a terminal or a server, and may be a relay device or a peripheral device. However, actually, it is not limited to these examples.

図1の本発明のシミュレータの構成図を参考して、説明する。
本発明のシミュレータ(シミュレーション装置)10は、デバッガ部11と、シミュレーション部12を備える。
This will be described with reference to the block diagram of the simulator of the present invention in FIG.
A simulator (simulation apparatus) 10 according to the present invention includes a debugger unit 11 and a simulation unit 12.

デバッガ部11は、コマンド入力部111と、実行コマンド処理部112と、メモリ書き込み処理部113を含む。   The debugger unit 11 includes a command input unit 111, an execution command processing unit 112, and a memory write processing unit 113.

シミュレーション部12は、メモリシミュレーション部121と、デコード・キャッシュ122と、実行シミュレーション部123を含む。   The simulation unit 12 includes a memory simulation unit 121, a decode cache 122, and an execution simulation unit 123.

メモリシミュレーション部121は、マイコンのメモリをシミュレーションする部分である。デコード・キャッシュ122は、命令の先頭アドレスと、デコード情報に加え、命令の書き換えの有無を示す変更フラグを持つ。実行シミュレーション部123は、マイコンの命令実行処理をシミュレーションする部分である。   The memory simulation unit 121 is a part that simulates the memory of the microcomputer. The decode cache 122 has a change flag indicating whether or not the instruction is rewritten, in addition to the instruction start address and decode information. The execution simulation unit 123 is a part that simulates instruction execution processing of the microcomputer.

メモリシミュレーション部121は、命令変更通知部1211を含む。   The memory simulation unit 121 includes an instruction change notification unit 1211.

実行シミュレーション部123は、実行管理部1231と、フェッチ・デコード部1232と、実行部1233を含む。   The execution simulation unit 123 includes an execution management unit 1231, a fetch / decode unit 1232, and an execution unit 1233.

実行対象プログラム110は、本発明のシミュレータ10がシミュレーションするマイコン上で動作する、コンパイラ等で言語処理されたオブジェクトファイルである。この実行対象プログラム110は、デバッガ部11にダウンロードされた際、コマンド入力部111から、メモリ書き込み処理部113を介してメモリシミュレーション部121にダウンロードされる。   The execution target program 110 is an object file that is language-processed by a compiler or the like that operates on a microcomputer that is simulated by the simulator 10 of the present invention. When the execution target program 110 is downloaded to the debugger unit 11, it is downloaded from the command input unit 111 to the memory simulation unit 121 via the memory write processing unit 113.

コマンド入力部111は、実行コマンドが入力されると、入力された実行コマンドを、実行コマンド処理部112を介して、実行シミュレーション部123の実行管理部1231へ通知する。   When an execution command is input, the command input unit 111 notifies the execution management unit 1231 of the execution simulation unit 123 of the input execution command via the execution command processing unit 112.

実行管理部1231は、デコード・キャッシュ122上で、次に実行する命令と一致するアドレスを検索することで、その命令のデコード情報がキャッシュされていないか検索を行う。フェッチ・デコード部1232は、該当命令のデコード情報がない場合、デコードを行い、デコード・キャッシュ122にアドレスとデコード情報を登録する。その後、実行部1233は、デコード・キャッシュ122に登録されたデコード情報を使って、命令実行する。また、実行部1233は、該当命令のデコード情報がある場合、そのデコード情報を使って、命令実行する。   The execution management unit 1231 searches the decode cache 122 for an address that matches the instruction to be executed next, thereby searching whether the decode information of the instruction is cached. The fetch / decode unit 1232 performs decoding when there is no decode information of the corresponding instruction, and registers an address and decode information in the decode cache 122. Thereafter, the execution unit 1233 executes the instruction using the decode information registered in the decode cache 122. Further, when there is decode information of the corresponding instruction, the execution unit 1233 executes the instruction using the decode information.

但し、実行管理部1231がデコード・キャッシュ122上の該当命令に変更フラグが立っていることを発見した場合には、フェッチ・デコード部1232は、再フェッチ・デコードを行い、デコード情報を更新し、変更フラグをリセットする。実行部1233は、更新されたデコード情報を使って、命令実行する。   However, if the execution management unit 1231 finds that a change flag is set in the corresponding instruction on the decode cache 122, the fetch / decode unit 1232 performs refetch / decode, updates the decode information, Reset the change flag. The execution unit 1233 executes the instruction using the updated decode information.

コマンド入力部111から命令に対する書き換え要求があった場合には、メモリ書き込み処理部113は、当該書き換え要求をメモリシミュレーション部121へ通知する。メモリシミュレーション部121によるメモリ書換え後に、命令変更通知部1211は、デコード・キャッシュ122の該当場所に変更フラグをセットする。   When there is a rewrite request for an instruction from the command input unit 111, the memory write processing unit 113 notifies the memory simulation unit 121 of the rewrite request. After the memory rewrite by the memory simulation unit 121, the instruction change notification unit 1211 sets a change flag at the corresponding location in the decode cache 122.

例えば、デバッガ部11及びシミュレーション部12は、プログラムで駆動されるCPU等のハードウェアと、そのハードウェアを駆動して所望の処理を実行するソフトウェアと、そのソフトウェアを格納する記憶装置によって実現される。なお、コマンド入力部111は、外部の入力装置や記憶装置から情報を取得するためのインターフェース(I/F:interface)を有していても良い。   For example, the debugger unit 11 and the simulation unit 12 are realized by hardware such as a CPU that is driven by a program, software that drives the hardware to execute a desired process, and a storage device that stores the software. . The command input unit 111 may have an interface (I / F: interface) for acquiring information from an external input device or storage device.

デバッガ部11及びシミュレーション部12を実現するハードウェアの例として、CPU(Central Processing Unit)、マイクロプロセッサ(microprocessor)、マイクロコントローラ、或いは、同様の機能を有する半導体集積回路(Integrated Circuit(IC))等が考えられる。但し、実際には、これらの例に限定されない。   Examples of hardware for realizing the debugger unit 11 and the simulation unit 12 include a CPU (Central Processing Unit), a microprocessor (microprocessor), a microcontroller, or a semiconductor integrated circuit (Integrated Circuit (IC)) having similar functions. Can be considered. However, actually, it is not limited to these examples.

デバッガ部11及びシミュレーション部12で使用されるプログラムやデータを格納する記憶装置の例として、RAM(Random Access Memory)やEEPROM(Electrically Erasable and Programmable Read Only Memory)やフラッシュメモリ等の半導体記憶装置、HDD(Hard Disk Drive)やSSD(Solid State Drive)等の補助記憶装置、又は、DVD(Digital Versatile Disk)やメモリカード等の記憶媒体(メディア)等が考えられる。なお、コンピュータ本体に内蔵された記憶装置に限らず、周辺機器(外付けHDD等)や外部のサーバ(ストレージサーバ等)に設置された記憶装置、或いは、NAS(Network Attached Storage)でも良い。但し、実際には、これらの例に限定されない。   Examples of storage devices that store programs and data used in the debugger unit 11 and the simulation unit 12 include semiconductor storage devices such as a RAM (Random Access Memory), an EEPROM (Electrically Erasable and Programmable Read Only Memory), a flash memory, and the like. An auxiliary storage device such as (Hard Disk Drive) or SSD (Solid State Drive), or a storage medium (media) such as a DVD (Digital Versatile Disk) or a memory card can be considered. The storage device is not limited to a storage device built in the computer main body, and may be a storage device installed in a peripheral device (external HDD or the like), an external server (storage server or the like), or NAS (Network Attached Storage). However, actually, it is not limited to these examples.

図2A、図2Bに、本発明のシミュレータの動作のフローチャートを示す。   2A and 2B show a flowchart of the operation of the simulator of the present invention.

(1)ステップS201
ユーザ操作あるいは起動設定により、シミュレータ10を起動する。これにより、シミュレータ10は、稼動状態となる。
(1) Step S201
The simulator 10 is activated by a user operation or activation setting. Thereby, simulator 10 will be in an operation state.

(2)ステップS202
シミュレータ10は、シミュレーション/デバッグ対象のプログラム(実行対象プログラム110)をダウンロードする。
(2) Step S202
The simulator 10 downloads a simulation / debug target program (execution target program 110).

(3)ステップS203
その後、シミュレータ10は、コマンド待ち状態となる。
(3) Step S203
Thereafter, the simulator 10 enters a command waiting state.

(4)ステップS204
シミュレータ10に対してコマンド実行が行われる。コマンド入力部111は、シミュレータ10がコマンド待ち状態の時に、実行コマンドの入力を受け付ける。
(4) Step S204
Command execution is performed on the simulator 10. The command input unit 111 receives an execution command input when the simulator 10 is in a command waiting state.

(5)ステップS205
コマンド入力部111は、実行コマンドが入力されると、入力された実行コマンドが一命令実行コマンドかどうか判定する。コマンド入力部111は、入力された実行コマンドが一命令実行コマンドであれば、入力された実行コマンドを、実行コマンド処理部112を介して、実行シミュレーション部123の実行管理部1231へ通知する。
(5) Step S205
When an execution command is input, the command input unit 111 determines whether the input execution command is a one-instruction execution command. If the input execution command is a one-command execution command, the command input unit 111 notifies the execution management unit 1231 of the execution simulation unit 123 of the input execution command via the execution command processing unit 112.

(6)ステップS206
実行管理部1231は、通知された実行コマンドに示された命令(対象命令)と一致するアドレスがないか、デコード・キャッシュ122を検索する。
(6) Step S206
The execution management unit 1231 searches the decode cache 122 for an address that matches the instruction (target instruction) indicated in the notified execution command.

(7)ステップS207
実行管理部1231は、デコード・キャッシュ122に対象命令のデコード情報がキャッシュされていているかどうか確認することで、対象命令が存在するかどうか確認する。
(7) Step S207
The execution management unit 1231 confirms whether the target instruction exists by confirming whether the decode information of the target instruction is cached in the decode cache 122.

(8)ステップS208
実行管理部1231は、対象命令のデコード情報がキャッシュされている場合、デコード・キャッシュ122上の対象命令に変更フラグがセットされているか確認する。
(8) Step S208
When the decode information of the target instruction is cached, the execution management unit 1231 checks whether the change flag is set for the target instruction on the decode cache 122.

(9)ステップS209
フェッチ・デコード部1232は、対象命令のデコード情報がキャッシュされていない場合、あるいは変更フラグがセットされていない場合、対象命令が存在しないと判断し、フェッチ・デコードを行う。
(9) Step S209
When the decoding information of the target instruction is not cached or when the change flag is not set, the fetch / decode unit 1232 determines that the target instruction does not exist and performs fetch / decode.

(10)ステップS210
フェッチ・デコード部1232は、フェッチ・デコードを行った結果、得られたデコード情報をデコード・キャッシュ122に登録する。
(10) Step S210
The fetch / decode unit 1232 registers the decode information obtained as a result of the fetch / decode in the decode cache 122.

(11)ステップS211
フェッチ・デコード部1232は、デコード・キャッシュ122上の対象命令に変更フラグがセットされていた場合は、変更フラグをリセットする。
(11) Step S211
The fetch / decode unit 1232 resets the change flag when the change flag is set in the target instruction on the decode cache 122.

(12)ステップS212
実行部1233は、デコード・キャッシュ122上の対象命令に変更フラグがセットされていない状態であれば、そのまま対象命令を実行する。対象命令の実行後、シミュレータ10は、コマンド待ち状態となる。
(12) Step S212
If the change flag is not set in the target instruction on the decode cache 122, the execution unit 1233 executes the target instruction as it is. After execution of the target instruction, the simulator 10 enters a command waiting state.

(13)ステップS213
また、実行部1233は、デコード・キャッシュ122上に対象命令のデコード情報がキャッシュされていて、変更フラグがセットされていなければ、このデコード情報を基に、対象命令を実行する。対象命令の実行後、シミュレータ10は、コマンド待ち状態となる。
(13) Step S213
The execution unit 1233 executes the target instruction based on the decode information when the decode information of the target instruction is cached on the decode cache 122 and the change flag is not set. After execution of the target instruction, the simulator 10 enters a command waiting state.

(14)ステップS214
また、コマンド入力部111は、入力された実行コマンドが一命令実行コマンドでなければ、入力された実行コマンドがメモリ書換えコマンドかどうか判定する。
(14) Step S214
Further, if the input execution command is not a one-instruction execution command, the command input unit 111 determines whether the input execution command is a memory rewrite command.

(15)ステップS215
コマンド入力部111は、入力された実行コマンドがメモリ書換えコマンドでない場合、その他のコマンドであったと判断し、その他のコマンドを処理すべき処理部に通知し、その他のコマンドに対する処理を行う。その他のコマンドに対する処理の実行後、シミュレータ10は、コマンド待ち状態となる。
(15) Step S215
If the input execution command is not a memory rewrite command, the command input unit 111 determines that the command is another command, notifies the processing unit to process the other command, and performs processing for the other command. After execution of processing for other commands, the simulator 10 enters a command waiting state.

(16)ステップS216
コマンド入力部111は、入力された実行コマンドがメモリ書換えコマンドである場合、メモリ書き込み処理部113を介して、メモリ書換えコマンドをメモリシミュレーション部121へ通知する。メモリシミュレーション部121は、メモリ書換えコマンドに応じて、メモリの内容を書き換える。
(16) Step S216
If the input execution command is a memory rewrite command, the command input unit 111 notifies the memory rewrite command to the memory simulation unit 121 via the memory write processing unit 113. The memory simulation unit 121 rewrites the contents of the memory in response to the memory rewrite command.

(17)ステップS217
メモリシミュレーション部121は、そのメモリ書換えコマンドが対象命令に対する書き換え要求であったかどうか確認する。そのメモリ書換えコマンドが対象命令に対する書き換え要求でなかった場合、シミュレータ10は、コマンド待ち状態となる。
(17) Step S217
The memory simulation unit 121 checks whether the memory rewrite command is a rewrite request for the target instruction. If the memory rewrite command is not a rewrite request for the target instruction, the simulator 10 enters a command waiting state.

(18)ステップS218
命令変更通知部1211は、そのメモリ書換えコマンドが対象命令に対する書き換え要求であった場合、デコード・キャッシュ122の該当場所に変更フラグをセットする。
(18) Step S218
If the memory rewrite command is a rewrite request for the target instruction, the instruction change notification unit 1211 sets a change flag at the corresponding location in the decode cache 122.

以下に、実際の動作の全体概要(実施例)について説明する。
本発明のシミュレータ10を起動し(ステップS201)、シミュレーション/デバッグ対象のプログラムをダウンロードする(ステップS202)。
The overall outline (example) of the actual operation will be described below.
The simulator 10 of the present invention is activated (step S201), and a simulation / debug target program is downloaded (step S202).

その後、シミュレータ10は、コマンド待ち(ステップS203)状態となるが、コマンド実行され(ステップS204)、そのコマンドが一命令実行コマンドであれば(ステップS205)、デコード・キャッシュ122を検索し(ステップS206)、対象命令が存在しない場合には、フェッチ・デコードを行い(ステップS209)、デコード・キャッシュ122に登録する(ステップS210)。変更フラグもセットされていない場合は(ステップS211)、そのまま実行を行う(ステップS212)。   Thereafter, the simulator 10 enters a command waiting state (step S203). However, if the command is executed (step S204) and the command is a one-instruction execution command (step S205), the decode cache 122 is searched (step S206). If the target instruction does not exist, fetch / decode is performed (step S209) and registered in the decode cache 122 (step S210). If the change flag is not set (step S211), the execution is performed as it is (step S212).

次に、シミュレータ10は、この命令を実行する際に、デコード・キャッシュ122を検索して(ステップS206)、対象命令のデコード情報がキャッシュされていて(ステップS207)、変更フラグがセットされていなければ(ステップS208)、このデコード情報を基に実行できる(ステップS213)。   Next, when executing this instruction, the simulator 10 searches the decode cache 122 (step S206), the decode information of the target instruction is cached (step S207), and the change flag must be set. (Step S208), it can be executed based on this decoding information (step S213).

メモリ書換えコマンド(ステップS214)を使って、命令の書換え要求が来た場合には、本発明のシミュレータ10はメモリの内容を書き換えた後(ステップS216)、その書き換えた領域が命令であることを確認して(ステップS217)、デコード・キャッシュ122の該当命令に変更フラグをセットする(ステップS218)。   When an instruction rewrite request is received using the memory rewrite command (step S214), the simulator 10 of the present invention rewrites the contents of the memory (step S216) and then confirms that the rewritten area is an instruction. After confirmation (step S217), a change flag is set for the corresponding instruction in the decode cache 122 (step S218).

その後、変更された命令を実行する際には、デコード・キャッシュ122を検索し(ステップS206)、その対象命令情報があっても(ステップS207)、変更フラグがあることから(ステップS208)、再フェッチ・デコードが必要と判断し、デコード・キャッシュ122に再登録し(ステップS210)、変更フラグをクリアし(ステップS211)、実行を行う(ステップS212)。   Thereafter, when executing the changed instruction, the decode cache 122 is searched (step S206), and even if there is the target instruction information (step S207), there is a change flag (step S208). It is determined that fetch / decode is necessary, re-registering in the decode cache 122 (step S210), clearing the change flag (step S211), and executing (step S212).

こうして、命令の書換えが発生した場合に、正しく命令実行が行える。   Thus, the instruction can be correctly executed when the instruction is rewritten.

このように、本発明のシミュレータでは、メモリシミュレーション部に、メモリを書換えた時に、その書き換えたメモリが命令であれば、デコード・キャッシュに変更フラグを立てる命令変更通知部を用意し、命令の書換えを実行時に検知する実行管理部を用意することで、命令が書き換われた場合も、正しく実行できるようにした。   As described above, in the simulator of the present invention, when the memory is rewritten in the memory simulation unit, if the rewritten memory is an instruction, an instruction change notification unit for setting a change flag in the decode cache is prepared. By preparing an execution management unit that detects when the command is executed, it can be executed correctly even if the command is rewritten.

以上、本発明の実施形態を詳述してきたが、実際には、上記の実施形態に限られるものではなく、本発明の要旨を逸脱しない範囲の変更があっても本発明に含まれる。   As mentioned above, although embodiment of this invention was explained in full detail, actually, it is not restricted to said embodiment, Even if there is a change of the range which does not deviate from the summary of this invention, it is included in this invention.

10… シミュレータ(シミュレーション装置)
11… デバッガ部
110… 実行対象プログラム
111… コマンド入力部
112… 実行コマンド処理部
113… メモリ書き込み処理部
12… シミュレーション部
121… メモリシミュレーション部
1211… 命令変更通知部
122… デコード・キャッシュ
123… 実行シミュレーション部
1231… 実行管理部
1232… フェッチ・デコード部
1233… 実行部
10 ... Simulator (simulation device)
DESCRIPTION OF SYMBOLS 11 ... Debugger part 110 ... Execution object program 111 ... Command input part 112 ... Execution command processing part 113 ... Memory write processing part 12 ... Simulation part 121 ... Memory simulation part 1211 ... Instruction change notification part 122 ... Decode cache 123 ... Execution simulation Unit 1231 ... Execution management unit 1232 ... Fetch / decode unit 1233 ... Execution unit

Claims (15)

メモリが書き換えられた際、書き換えられた内容が命令であれば、当該命令のデコード・キャッシュに変更フラグを立てる命令変更通知部と、
命令の実行時に、前記命令のデコード・キャッシュに変更フラグがあるか確認し、前記デコード・キャッシュに変更フラグがあれば、再フェッチ・デコードを行う実行シミュレーション部と
を具備する
シミュレーション装置。
When the memory is rewritten, if the rewritten content is an instruction, an instruction change notification unit that sets a change flag in the decode cache of the instruction, and
A simulation apparatus comprising: an execution simulation unit that checks whether or not there is a change flag in the decode cache of the instruction at the time of execution of the instruction, and performs refetch / decode if the change flag is in the decode cache.
請求項1に記載のシミュレーション装置であって、
前記実行シミュレーション部は、
前記命令の実行時に、前記デコード・キャッシュ上で、前記命令と一致するアドレスを検索し、前記命令のデコード情報がキャッシュされていないか検索を行う実行管理部と、
前記命令のデコード情報がキャッシュされていない場合、フェッチ・デコードを行い、前記デコード・キャッシュにアドレスとデコード情報を登録するフェッチ・デコード部と、
前記命令のデコード情報がキャッシュされていない場合、前記フェッチ・デコード部により前記デコード・キャッシュに登録されたデコード情報を使って前記命令を実行し、前記命令のデコード情報がキャッシュされている場合、前記キャッシュされているデコード情報を使って前記命令を実行する実行部と
を更に具備する
シミュレーション装置。
The simulation apparatus according to claim 1,
The execution simulation unit
An execution management unit that searches the decode cache for an address that matches the instruction at the time of execution of the instruction, and searches whether the decode information of the instruction is cached;
If the instruction decode information is not cached, fetch / decode, and a fetch / decode unit that registers an address and decode information in the decode cache;
When the decode information of the instruction is not cached, the instruction is executed using the decode information registered in the decode cache by the fetch / decode unit, and when the decode information of the instruction is cached, A simulation apparatus further comprising: an execution unit that executes the instruction using cached decode information.
請求項2に記載のシミュレーション装置であって、
前記フェッチ・デコード部は、前記実行シミュレーション部が前記デコード・キャッシュ上の前記命令に変更フラグが立っていることを発見した場合には、再フェッチ・デコードを行い、既存のデコード情報を更新し、変更フラグをリセットする
シミュレーション装置。
The simulation apparatus according to claim 2,
When the execution simulation unit finds that a change flag is set in the instruction on the decode cache, the fetch / decode unit performs re-fetch / decode, updates existing decode information, Simulation device that resets the change flag.
請求項1乃至3のいずれか一項に記載のシミュレーション装置であって、
メモリをシミュレーションするメモリシミュレーション部と、
実行コマンドが入力されると、前記入力された実行コマンドが一命令実行コマンドかどうか判定し、前記入力された実行コマンドが一命令実行コマンドでなければ、前記入力された実行コマンドがメモリ書換えコマンドかどうか判定するコマンド入力部と、
前記入力された実行コマンドが一命令実行コマンドであれば、前記一命令実行コマンドを前記実行シミュレーション部へ通知する実行コマンド処理部と、
前記入力された実行コマンドがメモリ書換えコマンドであれば、前記メモリ書換えコマンドを前記メモリシミュレーション部へ通知するメモリ書き込み処理部と
を更に具備する
シミュレーション装置。
The simulation apparatus according to any one of claims 1 to 3,
A memory simulation unit for simulating a memory;
When an execution command is input, it is determined whether the input execution command is a single instruction execution command. If the input execution command is not a single instruction execution command, the input execution command is a memory rewrite command. A command input section for determining whether or not
If the input execution command is a one-instruction execution command, an execution command processing unit that notifies the execution simulation unit of the one-instruction execution command;
A simulation apparatus, further comprising: a memory write processor that notifies the memory rewrite command of the memory rewrite command if the input execution command is a memory rewrite command.
請求項4に記載のシミュレーション装置であって、
前記メモリシミュレーション部は、前記メモリ書換えコマンドに応じて、メモリの内容を書き換え、前記メモリ書換えコマンドが前記命令に対する書き換え要求であったかどうか確認し、
前記命令変更通知部は、前記メモリ書換えコマンドが前記命令に対する書き換え要求であった場合、前記メモリシミュレーション部によるメモリ書換え後に、前記デコード・キャッシュの該当場所に変更フラグをセットする
シミュレーション装置。
The simulation apparatus according to claim 4,
The memory simulation unit rewrites the contents of the memory in response to the memory rewrite command, and checks whether the memory rewrite command is a rewrite request for the instruction,
The instruction change notification unit, when the memory rewrite command is a rewrite request for the instruction, sets a change flag at a corresponding location in the decode cache after the memory rewrite by the memory simulation unit.
コンピュータにより実施されるシミュレーション方法であって、
メモリが書き換えられた際、書き換えられた内容が命令であれば、当該命令のデコード・キャッシュに変更フラグを立て、
命令の実行時に、前記命令のデコード・キャッシュに変更フラグがあるか確認し、前記デコード・キャッシュに変更フラグがあれば、再フェッチ・デコードを行う
シミュレーション方法。
A computer-implemented simulation method comprising:
If the rewritten content is an instruction when the memory is rewritten, a change flag is set in the decode cache of the instruction,
A simulation method in which, when an instruction is executed, whether or not there is a change flag in the decode cache of the instruction, and if there is a change flag in the decode cache, refetch / decode is performed.
請求項6に記載のシミュレーション方法であって、
前記命令の実行時に、前記デコード・キャッシュ上で、前記命令と一致するアドレスを検索し、前記命令のデコード情報がキャッシュされていないか検索を行い、
前記命令のデコード情報がキャッシュされていない場合、フェッチ・デコードを行い、前記デコード・キャッシュにアドレスとデコード情報を登録し、前記デコード・キャッシュに登録されたデコード情報を使って前記命令を実行し、
前記命令のデコード情報がキャッシュされている場合、前記キャッシュされているデコード情報を使って前記命令を実行する
シミュレーション方法。
The simulation method according to claim 6, comprising:
When the instruction is executed, the address that matches the instruction is searched on the decode cache, and whether the decode information of the instruction is cached is searched.
If the decode information of the instruction is not cached, fetch and decode, register an address and decode information in the decode cache, execute the instruction using the decode information registered in the decode cache,
When the decode information of the instruction is cached, the instruction is executed using the cached decode information.
請求項7に記載のシミュレーション方法であって、
前記デコード・キャッシュ上の前記命令に変更フラグが立っていることを発見した場合には、再フェッチ・デコードを行い、既存のデコード情報を更新し、変更フラグをリセットする
シミュレーション方法。
The simulation method according to claim 7, comprising:
A simulation method in which when it is found that a change flag is set in the instruction on the decode cache, refetch / decode is performed, existing decode information is updated, and the change flag is reset.
請求項6乃至8のいずれか一項に記載のシミュレーション方法であって、
実行コマンドが入力されると、前記入力された実行コマンドが一命令実行コマンドかどうか判定し、
前記入力された実行コマンドが一命令実行コマンドであれば、前記一命令実行コマンドに基づいて命令実行処理をシミュレーションし、
前記入力された実行コマンドが一命令実行コマンドでなければ、前記入力された実行コマンドがメモリ書換えコマンドかどうか判定し、
前記入力された実行コマンドがメモリ書換えコマンドであれば、前記メモリ書換えコマンドに基づいてメモリの内容を書き換える
シミュレーション方法。
A simulation method according to any one of claims 6 to 8,
When an execution command is input, it is determined whether the input execution command is a one-instruction execution command,
If the input execution command is a single instruction execution command, the instruction execution process is simulated based on the single instruction execution command,
If the input execution command is not a one-instruction execution command, determine whether the input execution command is a memory rewrite command;
A simulation method for rewriting memory contents based on the memory rewrite command if the input execution command is a memory rewrite command.
請求項9に記載のシミュレーション方法であって、
前記メモリ書換えコマンドに基づいてメモリの内容を書き換えた際、前記メモリ書換えコマンドが前記命令に対する書き換え要求であったかどうか確認し、
前記メモリ書換えコマンドが前記命令に対する書き換え要求であった場合、メモリ書換え後に、前記デコード・キャッシュの該当場所に変更フラグをセットする
シミュレーション方法。
The simulation method according to claim 9, wherein
When rewriting the contents of the memory based on the memory rewrite command, check whether the memory rewrite command is a rewrite request for the instruction,
When the memory rewrite command is a rewrite request for the instruction, a change flag is set at a corresponding location in the decode cache after the memory is rewritten.
コンピュータにより実施されるシミュレーション用プログラムであって、
メモリが書き換えられた際、書き換えられた内容が命令であれば、当該命令のデコード・キャッシュに変更フラグを立てるステップと、
命令の実行時に、前記命令のデコード・キャッシュに変更フラグがあるか確認し、前記デコード・キャッシュに変更フラグがあれば、再フェッチ・デコードを行うステップと
をコンピュータに実行させるための
シミュレーション用プログラム。
A simulation program executed by a computer,
If the rewritten content is an instruction when the memory is rewritten, a step of setting a change flag in the decode cache of the instruction;
A simulation program for causing a computer to check whether or not there is a change flag in the decode cache of the instruction at the time of executing the instruction, and to perform refetch / decode if there is a change flag in the decode cache.
請求項11に記載のシミュレーション用プログラムであって、
前記命令の実行時に、前記デコード・キャッシュ上で、前記命令と一致するアドレスを検索し、前記命令のデコード情報がキャッシュされていないか検索を行うステップと、
前記命令のデコード情報がキャッシュされていない場合、フェッチ・デコードを行い、前記デコード・キャッシュにアドレスとデコード情報を登録し、前記デコード・キャッシュに登録されたデコード情報を使って前記命令を実行するステップと、
前記命令のデコード情報がキャッシュされている場合、前記キャッシュされているデコード情報を使って前記命令を実行するステップと
を更にコンピュータに実行させるための
シミュレーション用プログラム。
A simulation program according to claim 11, comprising:
Searching for an address that matches the instruction on the decode cache when the instruction is executed, and searching whether the decode information of the instruction is cached;
If the decode information of the instruction is not cached, performing fetch / decode, registering an address and decode information in the decode cache, and executing the instruction using the decode information registered in the decode cache When,
A simulation program for causing a computer to further execute a step of executing the instruction using the cached decoding information when the decoding information of the instruction is cached.
請求項12に記載のシミュレーション用プログラムであって、
前記デコード・キャッシュ上の前記命令に変更フラグが立っていることを発見した場合には、再フェッチ・デコードを行い、既存のデコード情報を更新し、変更フラグをリセットするステップ
を更にコンピュータに実行させるための
シミュレーション用プログラム。
A simulation program according to claim 12, comprising:
When it is found that a change flag is set in the instruction on the decode cache, the computer is further executed to perform refetch / decode, update the existing decode information, and reset the change flag. Simulation program for.
請求項11乃至13のいずれか一項に記載のシミュレーション用プログラムであって、
実行コマンドが入力されると、前記入力された実行コマンドが一命令実行コマンドかどうか判定するステップと、
前記入力された実行コマンドが一命令実行コマンドであれば、前記一命令実行コマンドに基づいて命令実行処理をシミュレーションするステップと、
前記入力された実行コマンドが一命令実行コマンドでなければ、前記入力された実行コマンドがメモリ書換えコマンドかどうか判定するステップと、
前記入力された実行コマンドがメモリ書換えコマンドであれば、前記メモリ書換えコマンドに基づいてメモリの内容を書き換えるステップと
を更にコンピュータに実行させるための
シミュレーション用プログラム。
A simulation program according to any one of claims 11 to 13,
When an execution command is input, determining whether the input execution command is a one-instruction execution command;
If the input execution command is a single instruction execution command, simulating instruction execution processing based on the single instruction execution command;
If the input execution command is not a one-instruction execution command, determining whether the input execution command is a memory rewrite command; and
A simulation program for causing a computer to further execute a step of rewriting the contents of a memory based on the memory rewrite command if the input execution command is a memory rewrite command.
請求項14に記載のシミュレーション用プログラムであって、
前記メモリ書換えコマンドに基づいてメモリの内容を書き換えた際、前記メモリ書換えコマンドが前記命令に対する書き換え要求であったかどうか確認するステップと、
前記メモリ書換えコマンドが前記命令に対する書き換え要求であった場合、メモリ書換え後に、前記デコード・キャッシュの該当場所に変更フラグをセットするステップと
を更にコンピュータに実行させるための
シミュレーション用プログラム。
A simulation program according to claim 14,
When rewriting the contents of the memory based on the memory rewrite command, checking whether the memory rewrite command is a rewrite request for the instruction;
A simulation program for causing a computer to further execute a step of setting a change flag at a corresponding location in the decode cache after a memory rewrite when the memory rewrite command is a rewrite request for the instruction.
JP2009210234A 2009-09-11 2009-09-11 Simulation device Expired - Fee Related JP5322867B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009210234A JP5322867B2 (en) 2009-09-11 2009-09-11 Simulation device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009210234A JP5322867B2 (en) 2009-09-11 2009-09-11 Simulation device

Publications (3)

Publication Number Publication Date
JP2011060080A true JP2011060080A (en) 2011-03-24
JP2011060080A5 JP2011060080A5 (en) 2012-03-29
JP5322867B2 JP5322867B2 (en) 2013-10-23

Family

ID=43947621

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009210234A Expired - Fee Related JP5322867B2 (en) 2009-09-11 2009-09-11 Simulation device

Country Status (1)

Country Link
JP (1) JP5322867B2 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000231495A (en) * 1999-02-10 2000-08-22 Nec Corp Virtual machine
JP2002024086A (en) * 2000-07-12 2002-01-25 Mitsubishi Electric Corp Microcomputer, computer system and instruction code update method
JP2007094986A (en) * 2005-09-30 2007-04-12 Fujitsu Ltd Simulation apparatus and simulation method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000231495A (en) * 1999-02-10 2000-08-22 Nec Corp Virtual machine
JP2002024086A (en) * 2000-07-12 2002-01-25 Mitsubishi Electric Corp Microcomputer, computer system and instruction code update method
JP2007094986A (en) * 2005-09-30 2007-04-12 Fujitsu Ltd Simulation apparatus and simulation method

Non-Patent Citations (6)

* Cited by examiner, † Cited by third party
Title
CSND200300525008; 中森 章: 'コンピュータアーキテクチャ その直感的アプローチ(3)' Oh!X 2001春号, 20010301, p.240-255, ソフトバンクパブリッシング株式会社 *
CSND200300525010; 中森 章: 'コンピュータアーキテクチャ その直感的アプローチ(5)' Oh!X 2001春号, 20010301, p.276-285, ソフトバンクパブリッシング株式会社 *
CSNG200600108002; 大津 金光: '新世代マイクロプロセッサアーキテクチャ(後編)' 情報処理 IPSJ MAGAZINE 第46巻 第11号, 20051115, p.1224-1229, 社団法人情報処理学会 *
JPN6013033733; 中森 章: 'コンピュータアーキテクチャ その直感的アプローチ(3)' Oh!X 2001春号, 20010301, p.240-255, ソフトバンクパブリッシング株式会社 *
JPN6013033735; 中森 章: 'コンピュータアーキテクチャ その直感的アプローチ(5)' Oh!X 2001春号, 20010301, p.276-285, ソフトバンクパブリッシング株式会社 *
JPN6013033738; 大津 金光: '新世代マイクロプロセッサアーキテクチャ(後編)' 情報処理 IPSJ MAGAZINE 第46巻 第11号, 20051115, p.1224-1229, 社団法人情報処理学会 *

Also Published As

Publication number Publication date
JP5322867B2 (en) 2013-10-23

Similar Documents

Publication Publication Date Title
US9256428B2 (en) Load latency speculation in an out-of-order computer processor
TWI522915B (en) Method and apparatus for guest return address stack emulation supporting speculation
JP6507435B2 (en) Instruction emulation processor, method, and system
JP5608594B2 (en) Preload instruction control
US9753730B2 (en) Decoding instructions from multiple instructions sets
US9858057B2 (en) Methods and apparatus to validate translated guest code in a dynamic binary translator
US10318419B2 (en) Flush avoidance in a load store unit
JP2007525737A5 (en)
US10824494B2 (en) Operation of a multi-slice processor implementing exception handling in a nested translation environment
JP5318197B2 (en) Device emulation support in the host data processor
US9652245B2 (en) Branch prediction for indirect jumps by hashing current and previous branch instruction addresses
JP6234639B2 (en) Simulation apparatus, simulation method, and simulation program
JP5536593B2 (en) Optimization device, optimization method, and compiler program
JP5322867B2 (en) Simulation device
CN108446186B (en) Method for recovering Dex source file from shelled Android application program
CN113835927B (en) Instruction execution method, computing device and storage medium
CN114036066A (en) Unit testing method and device, computing equipment and readable storage medium
CN117270967A (en) Automatic generation method and device of instruction set architecture simulator based on model driving
CN117130721A (en) WebAssemblely code execution method and device
Ai et al. The research of code relocation about U-boot transplant based on embedded systems
CN114911483A (en) Method for realizing QXL (QXL) display of virtual machine in UEFI (unified extensible firmware interface) operation stage
Lynch How to port Linux when the hardware turns soft

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120213

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120213

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130626

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20130709

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130716

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees