JPH08185341A - Cpu simulator - Google Patents

Cpu simulator

Info

Publication number
JPH08185341A
JPH08185341A JP6339242A JP33924294A JPH08185341A JP H08185341 A JPH08185341 A JP H08185341A JP 6339242 A JP6339242 A JP 6339242A JP 33924294 A JP33924294 A JP 33924294A JP H08185341 A JPH08185341 A JP H08185341A
Authority
JP
Japan
Prior art keywords
state
flag
memory
updated
target
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
JP6339242A
Other languages
Japanese (ja)
Other versions
JP2663895B2 (en
Inventor
Naoyuki Iwashita
直之 岩下
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.)
NEC Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP6339242A priority Critical patent/JP2663895B2/en
Publication of JPH08185341A publication Critical patent/JPH08185341A/en
Application granted granted Critical
Publication of JP2663895B2 publication Critical patent/JP2663895B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

PURPOSE: To reexecute a target program from the same point even when state information stored in a file is reduced. CONSTITUTION: In the case of debugging a target program from a prescribed point plural times, the states of respective addresses or the like of registers and memories in a target CPU of which state is changed from an initial state when a point immediately before the prescribed point is executed at first are previously stored in a state storing file 32. At the time of executing the prescribed point and after, a flag corresponding to a resource of which state is updated out of plural flags corresponding to the addresses or the like of respective registers and memories which are stored in an updating position storing table 42 is turned on. In the case of executing debugging again from the prescribed point, the state is restored to the state obtained at the time of executing the point immediately before the prescribed point at first based upon the contents stored in the file 32 and the contents of the table 42.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、ターゲットCPUの動
作をシミュレーションするCPUシミュレータに関し、
特に、ターゲットCPU用に開発されたプログラム(タ
ーゲットプログラム)のデバッグを効率良く行うことが
できるCPUシミュレータに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a CPU simulator for simulating the operation of a target CPU.
In particular, the present invention relates to a CPU simulator capable of efficiently debugging a program developed for a target CPU (target program).

【0002】[0002]

【従来の技術】ターゲットCPUを含むターゲットマシ
ンの完成前に、或いはターゲットマシン上でのデバッグ
前に、ターゲットCPU用に開発されたターゲットプロ
グラムをデバッグする技術として、ターゲットCPUと
は別のCPUを含むCPUシミュレータ上でターゲット
プログラムにかかるターゲットCPUの動作をシミュレ
ーションする技術がある。
2. Description of the Related Art As a technique for debugging a target program developed for a target CPU before a target machine including the target CPU is completed or before debugging on the target machine, a CPU different from the target CPU is included. There is a technique for simulating the operation of a target CPU according to a target program on a CPU simulator.

【0003】ところで、ターゲットプログラムのデバッ
グを行う場合、ターゲットプログラムの同一の地点から
何回か異なる方法でデバッグを行うことが必要になる場
合がある。例えば、レジスタ等の初期化処理や接続され
ている他の装置の認識処理等を行う起動処理部と、そこ
に続くアプリケーション部とから構成されるターゲット
プログラムをデバッグする場合、アプリケーション部の
開始点から異なる方法でデバッグを何回か行うことが必
要になる場合がある。
When debugging a target program, it may be necessary to perform debugging several times from the same point in the target program in different ways. For example, when debugging a target program including a boot processing unit that performs initialization processing of registers and the like and recognition processing of another connected device, and a subsequent application unit, the debugger starts from the start point of the application unit. You may need to debug several times in different ways.

【0004】このような場合に、ターゲットプログラム
の先頭からプログラムを実行すると、デバッグ対象部分
であるアプリケーション部が実行されるまでに多くの無
駄な時間が費やされてしまう。そこで、従来は、第1回
目のデバッグ時にはターゲットプログラムの先頭からプ
ログラムを実行してターゲットプログラムの起動処理部
が終了した時点に於けるターゲットCPUのメモリやレ
ジスタ等の状態を全てファイルに保存しておき、第2回
目以降のデバッグ時には、上記ファイルに保存されてい
るメモリやレジスタの状態を利用してそれらの状態を起
動処理部終了時の状態に復元し、その後、アプリケーシ
ョン部の開始点からターゲットプログラムを実行するよ
うにしている(例えば、特開平4−332053号)。
このようにすることにより、第2回目以降のデバッグ時
には、起動処理部を実行する必要がなくなるので、デバ
ッグを効率的に行うことが可能になる。
In such a case, if the program is executed from the beginning of the target program, a lot of useless time is spent until the application part, which is the debug target part, is executed. Therefore, conventionally, at the time of the first debugging, the state of the memory and the register of the target CPU at the time when the start processing unit of the target program is completed is executed by executing the program from the beginning of the target program, and all the states are stored in a file. For the second and subsequent debuggings, the state of the memory and registers saved in the above file is used to restore those states to the state at the time of termination of the startup processing unit. The program is executed (for example, Japanese Patent Laid-Open No. Hei 4-332553).
By doing so, it is not necessary to execute the startup processing unit at the time of the second and subsequent debuggings, so that debugging can be performed efficiently.

【0005】[0005]

【発明が解決しようとする課題】しかし、上述した従来
の技術は、ファイルにメモリやレジスタの状態を全て保
存しているため、大容量のファイルが必要になるという
問題があると共に、復元時、ファイル装置から大量の情
報を読み出さなければならないため、復元に時間がかか
るという問題もあった。
However, the above-mentioned conventional technique has a problem that a large capacity file is required because all states of the memory and the register are stored in the file. Since a large amount of information must be read from the file device, there is a problem that restoration takes time.

【0006】そこで、本発明の目的は、ファイルに保存
する状態情報を少なくしてもターゲットプログラムを同
一の地点から再実行できるようにすることにある。
Therefore, an object of the present invention is to enable the target program to be re-executed from the same point even if the state information stored in the file is reduced.

【0007】[0007]

【課題を解決するための手段】本発明は上記目的を達成
するため、シミュレーション対象となるターゲットCP
Uのターゲットプログラムにかかる動作をシミュレーシ
ョンするCPUシミュレータに於いて、前記ターゲット
プログラムにかかる前記ターゲットCPUの動作をシミ
ュレーションした時に状態が更新される可能性があり、
且つ初期状態が決まっている前記ターゲットCPUの資
源それぞれについてのフラグを有する更新位置記憶テー
ブルと、前記ターゲットプログラムにかかる前記ターゲ
ットCPUの動作をシミュレーションしている時に前記
資源の状態が更新された時、状態が更新された資源に対
応する前記更新位置記憶テーブル中のフラグを更新済み
を示すものに変更する更新位置記憶回路と、前記ターゲ
ットプログラムが或る地点まで実行された時の前記更新
位置記憶テーブルの内容と、前記更新位置記憶テーブル
中のフラグが更新済みを示している資源の状態とを状態
保存ファイルに保存すると共に、前記更新位置記憶テー
ブルをクリアする保存処理手段と、前記CPUシミュレ
ータの状態復元時、前記更新位置記憶テーブル中のフラ
グが更新済みを示している各資源について、前記状態保
存ファイルに保存されている対応するフラグが更新を示
している場合には、その状態を前記状態保存ファイルに
保存されている状態に復元し、前記状態保存ファイルに
保存されている対応するフラグが未更新を示している場
合は、その状態を初期状態に復元する復元処理手段とを
備えたものである。
According to the present invention, a target CP to be simulated is provided to achieve the above object.
In a CPU simulator that simulates the operation of the U target program, the state may be updated when the operation of the target CPU of the target program is simulated.
And an update position storage table having a flag for each resource of the target CPU whose initial state is determined, and when the state of the resource is updated while simulating the operation of the target CPU according to the target program, An update position storage circuit for changing a flag in the update position storage table corresponding to the resource whose status has been updated to one indicating that the update has been completed; and the update position storage table when the target program has been executed to a certain point. And a state of the resource in which the flag in the update position storage table indicates that the update has been completed is stored in a state storage file, and the update processing unit clears the update position storage table. At the time of restoration, the flag in the update position storage table indicates that the update has been completed. For each of the resources, if the corresponding flag stored in the state save file indicates an update, that state is restored to the state saved in the state save file, and When the corresponding stored flag indicates that the flag has not been updated, the restoration processing means for restoring the state to the initial state is provided.

【0008】また、本発明は、ファイルに保存する情報
量を更に少なくできるようにするという目的を達成する
ため、前記更新位置記憶テーブルは、前記ターゲットプ
ログラムがロードされる前記ターゲットCPUのメモリ
の各アドレス及び前記ターゲットプログラムがワークエ
リアとして使用する前記ターゲットCPUのメモリの各
アドレス毎のフラグを有し、前記更新位置記憶回路は、
前記ターゲットプログラムのロード時、前記ターゲット
プログラムがロードされたメモリの各アドレスのフラグ
を更新済みを示すものに変更し、且つ、シミュレーショ
ンの実行時に前記メモリの状態が更新されたとき、その
更新されたメモリのアドレスに対応するフラグが更新済
みでなければ更新済みを示すものに変更し、前記保存処
理手段は、前記ターゲットプログラムが或る地点まで実
行された時、前記更新位置記憶テーブル中のフラグが更
新済みを示している、前記ターゲットプログラムがロー
ドされたアドレス及びメモリ状態が更新されたワークエ
リアのアドレスのメモリ状態を前記状態保持ファイルに
保存し、前記復元処理手段は、前記更新位置記憶テーブ
ル中のフラグが更新済みを示している前記メモリの各ア
ドレスについて、前記状態保存ファイルに保存されてい
る対応するフラグが更新を示している場合には、そのメ
モリ状態を前記状態保存ファイルに保存されている状態
に復元し、前記状態保存ファイルに保存されている対応
するフラグが未更新を示している場合は、そのメモリ状
態を初期状態に復元するようにしたものである。
According to the present invention, in order to achieve the object of further reducing the amount of information stored in a file, the update position storage table stores each of the memories of the target CPU into which the target program is loaded. An address and a flag for each address of the memory of the target CPU used as a work area by the target program, the update position storage circuit includes:
When the target program is loaded, the flag of each address of the memory where the target program is loaded is changed to a flag indicating that the memory has been updated, and when the state of the memory is updated when a simulation is executed, the updated If the flag corresponding to the address of the memory has not been updated, the flag is changed to that indicating the update, and when the target program has been executed up to a certain point, the flag in the update position storage table is updated. The state where the target program was loaded and the memory state of the address of the work area where the memory state was updated, indicating the updated state, are stored in the state holding file, and the restoration processing means stores the updated position in the updated position storage table. For each address in the memory where the flag of If the corresponding flag stored in the state save file indicates an update, the memory state is restored to the state saved in the state save file, and the corresponding state saved in the state save file is restored. When the flag to indicate that it has not been updated, the memory state is restored to the initial state.

【0009】[0009]

【作用】ターゲットCPUの資源の内、初期状態が決ま
っているレジスタや入出力ポート用バッファの資源につ
いては、シミュレーション中にその状態が更新される
と、更新位置記憶回路が更新位置記憶テーブル中の上記
資源に対応したフラグを更新済みを示すものに変更して
おく。
With respect to the resources of the registers and the buffers for input / output ports whose initial states are determined among the resources of the target CPU, when the states are updated during the simulation, the update position storage circuit stores The flag corresponding to the above resource is changed to the one indicating that the resource has been updated.

【0010】そして、ターゲットプログラムが、例えば
第1回目のデバッグ開始地点の直前の地点といった特定
の或る地点まで実行されると、保存処理手段が、更新位
置記憶テーブルの内容と、更新位置記憶テーブル中のフ
ラグが更新済みを示している資源の状態とを状態保存フ
ァイルに保存し、その後、更新位置記憶テーブルをクリ
アする。
When the target program is executed up to a specific point, for example, a point immediately before the first debugging start point, the storage processing means stores the contents of the update position storage table and the update position storage table. The state of the resource whose inside flag indicates that the resource has been updated is stored in the state storage file, and then the update position storage table is cleared.

【0011】その後、ターゲットプログラムのデバッグ
対象部分が実行されると、更新位置記憶回路が前述した
と同様の処理を行い、状態が更新された資源に対応する
更新位置記憶テーブル中のフラグを更新済みを示すもの
に変更する。従って、更新位置記憶テーブル中のフラグ
の内、デバッグ開始地点以降の部分の実行中に状態が更
新された資源に対応するフラグのみが更新済みを示すも
のになる。
Thereafter, when the portion to be debugged of the target program is executed, the update position storage circuit performs the same processing as described above, and updates the flag in the update position storage table corresponding to the resource whose status has been updated. Change to what shows. Therefore, of the flags in the update position storage table, only the flag corresponding to the resource whose status has been updated during execution of the part after the debug start point indicates that the status has been updated.

【0012】次回のデバッグ時には、復元処理手段が、
更新位置記憶テーブル及び状態保存ファイルの内容に基
づいてターゲットCPUの資源を、デバッグ開始地点の
直前の地点まで実行された時の状態に復元する。即ち、
更新位置記憶テーブル中のフラグが更新済みを示してい
る各資源について、状態保存ファイルに保存されている
対応するフラグが更新を示している場合には、その状態
を状態保存ファイルに保存されている状態に復元し、状
態保存ファイルに保存されている対応するフラグが未更
新を示している場合は、その状態を初期状態に復元す
る。
At the next debugging, the restoration processing means
Based on the contents of the update position storage table and the state storage file, the resources of the target CPU are restored to the state when they were executed up to the point immediately before the debug start point. That is,
For each resource for which the flag in the update position storage table indicates “updated”, if the corresponding flag stored in the state storage file indicates “update”, the state is stored in the state storage file. The state is restored, and if the corresponding flag stored in the state storage file indicates “not updated”, the state is restored to the initial state.

【0013】また、ターゲットプログラムがロードされ
るターゲットCPUのメモリの各アドレス及びターゲッ
トプログラムがワークエリアとして使用するターゲット
CPUのメモリの各アドレスについては、ターゲットプ
ログラムのロード時、更新位置記憶回路が、ターゲット
プログラムがロードされたアドレスに対応するフラグを
更新済みを示すものに変更しておく。また、更新位置記
憶回路は、シミュレーション時に、メモリの内容が更新
されると、そのメモリアドレスに対応するフラグを更新
済みを示すものに変更する。
For each address of the memory of the target CPU into which the target program is loaded and each address of the memory of the target CPU used as a work area by the target program, when the target program is loaded, the update position storage circuit stores The flag corresponding to the address at which the program was loaded is changed to indicate that the program has been updated. In addition, when the contents of the memory are updated during the simulation, the update position storage circuit changes the flag corresponding to the memory address to the one indicating that the update has been completed.

【0014】そして、ターゲットプログラムがデバッグ
開始地点の直前の地点まで実行されると、対応するフラ
グが更新済みを示しているメモリのアドレスのメモリ状
態、即ちターゲットプログラムがロードされたアドレス
及びメモリ状態が更新されたワークエリアのアドレスの
メモリ状態が保存処理手段によって状態保存ファイルに
保存される。ここで、ワークエリアの内、状態が初期状
態から更新されなかったアドレスのメモリ状態は状態保
存ファイルには保存されないので、状態保存ファイルに
格納される情報量を少ないものにすることができる。
When the target program is executed up to the point immediately before the debug start point, the memory state of the address of the memory whose corresponding flag indicates that the update has been completed, that is, the address and the memory state at which the target program was loaded, is changed. The updated memory state of the address of the work area is stored in the state storage file by the storage processing unit. Here, in the work area, the memory state of the address whose state has not been updated from the initial state is not stored in the state storage file, so that the amount of information stored in the state storage file can be reduced.

【0015】その後、ターゲットプログラムのデバッグ
対象部分が実行されると、更新位置記憶回路が前述した
と同様の処理を行い、状態が更新されたメモリのアドレ
スに対応する更新位置記憶テーブル中のフラグを更新済
みを示すものに変更する。
Thereafter, when the debug target portion of the target program is executed, the update position storage circuit performs the same processing as described above, and sets the flag in the update position storage table corresponding to the address of the memory whose status has been updated. Change it to indicate that it has been updated.

【0016】次回のデバッグ時には、復元処理手段が、
更新位置記憶テーブル及び状態保存ファイルの内容に基
づいてメモリの各アドレスのメモリ状態を、デバッグ開
始地点の直前の地点まで実行された時の状態に復元す
る。
At the next debugging, the restoration processing means
Based on the contents of the update position storage table and the state storage file, the memory state of each address of the memory is restored to the state at the time of execution up to the point immediately before the debug start point.

【0017】[0017]

【実施例】次に本発明の実施例について図面を参照して
詳細に説明する。
Embodiments of the present invention will now be described in detail with reference to the drawings.

【0018】図1は本発明の実施例のブロック図であ
り、メモリ1と、CPU2と、ファイル装置3と、更新
位置記憶装置4とから構成されている。
FIG. 1 is a block diagram of an embodiment of the present invention, which comprises a memory 1, a CPU 2, a file device 3, and an update position storage device 4.

【0019】メモリ1には、シミュレーション対象とす
るターゲットCPUのメモリの状態が格納されるメモリ
部11と、ターゲットCPUのレジスタの状態が格納さ
れるレジスタ部12と、ターゲットCPUのI/O(入
出力)ポート用バッファの状態が格納されるI/Oポー
ト部13とを有している。
The memory 1 has a memory section 11 for storing the state of the memory of the target CPU to be simulated, a register section 12 for storing the state of the register of the target CPU, and an I / O (input / output) of the target CPU. (Output) port buffer state is stored in the I / O port unit 13.

【0020】また、メモリ1には、シミュレーション用
プログラム14と、保存処理用プログラム15と、復元
処理用プログラム16とが格納される。
The memory 1 also stores a simulation program 14, a storage processing program 15, and a restoration processing program 16.

【0021】シミュレーション用プログラム14は、タ
ーゲットプログラムにかかるターゲットCPUの動作を
シミュレーションする機能を有する。保存処理用プログ
ラム15は、メモリ部11,レジスタ部12,I/Oポ
ート部13に格納されているターゲットCPUのメモリ
の各アドレスのメモリ状態,各レジスタの状態,各I/
Oポート用バッファの状態の内、更新位置記憶テーブル
42内の対応するフラグが更新済みを示しているものを
ファイル装置3内の状態保存ファイル32内に保存する
機能を有すると共に、更新位置記憶テーブル42の内容
を状態保存ファイル32に保存する機能を有する。復元
処理用プログラム16は、状態保存ファイル32の内容
及び更新位置記憶テーブル42の内容に従って、メモリ
部11,レジスタ部12,I/Oポート部13の状態を
デバッグ開始地点の直前の状態に復元する機能を有す
る。
The simulation program 14 has a function of simulating the operation of the target CPU according to the target program. The save processing program 15 stores the memory state of each address of the memory of the target CPU stored in the memory unit 11, the register unit 12, and the I / O port unit 13, the state of each register, and each I / O port.
Among the states of the O port buffer, the update position storage table 42 has a function of storing in the state storage file 32 in the file device 3 the corresponding flag in the update position storage table 42 indicating that the update position storage table 42 has been updated. It has a function of saving the contents of 42 in the state saving file 32. The restoration processing program 16 restores the states of the memory unit 11, the register unit 12, and the I / O port unit 13 to the state immediately before the debug starting point according to the contents of the state save file 32 and the contents of the update position storage table 42. Have a function.

【0022】ファイル装置3には、実行形式ファイル3
1と、状態保存ファイル32とが格納される。
The file unit 3 includes an executable file 3
1 and a state storage file 32 are stored.

【0023】実行形式ファイル31には、ターゲットC
PUに実行させる実行形式のターゲットプログラムが格
納される。実行形式ファイル31としては、例えば、イ
ンテルOMFファイル,インテル拡張HEXファイル等
を使用することができる。
The executable file 31 includes a target C
An executable target program to be executed by the PU is stored. As the executable file 31, for example, an Intel OMF file, an Intel extended HEX file, or the like can be used.

【0024】状態保存ファイル32には、更新位置記憶
テーブル42の内容と、メモリ部11,レジスタ部1
2,I/Oポート部13に格納されているターゲットC
PUのメモリの各アドレスのメモリ状態,各レジスタの
状態,各I/Oポート用バッファの状態の内、更新位置
記憶テーブル42内の対応するフラグが更新済みを示し
ているものが格納される。
The state save file 32 includes the contents of the update position storage table 42, the memory unit 11 and the register unit 1.
2, the target C stored in the I / O port unit 13
Among the memory status of each address of the PU memory, the status of each register, and the status of each I / O port buffer, the status indicating that the corresponding flag in the update position storage table 42 has been updated is stored.

【0025】更新位置記憶装置4は、更新位置記憶回路
41と、更新位置記憶テーブル42とを有している。
The update position storage device 4 has an update position storage circuit 41 and an update position storage table 42.

【0026】更新位置記憶テーブル42は、図2に示す
ように、ターゲットプログラムがロードされるターゲッ
トCPUのメモリの各アドレス及びターゲットプログラ
ムがワークエリアとして使用するターゲットCPUのメ
モリの各アドレスに対応するフラグFM1〜FMiと、
ターゲットCPUの各レジスタに対応するフラグFR1
〜FRjと、ターゲットCPUの各i/Oポート用バッ
ファに対応するフラグFB1〜FBkとが格納されてい
る。尚、フラグは、初期状態に於いてはオフになってい
る。また、ワークエリア,レジスタ,I/Oポート用バ
ッファは、初期状態に於いては0になっている。
The update position storage table 42, as shown in FIG. 2, is a flag corresponding to each address of the memory of the target CPU into which the target program is loaded and each address of the memory of the target CPU used as a work area by the target program. FM1 to FMi,
Flag FR1 corresponding to each register of the target CPU
FRj and flags FB1 to FBk corresponding to each i / O port buffer of the target CPU. The flag is off in the initial state. The work area, registers, and I / O port buffers are 0 in the initial state.

【0027】更新位置記憶回路41は、実行形式ファイ
ル31に格納されているターゲットプログラムがメモリ
部11にロードされる際、フラグFM1〜FMiの内、
ターゲットプログラムがロードされたアドレスに対応す
るフラグをオンにする機能と、フラグFM1〜FMiの
内、更新されたアドレスに対応するフラグをオンにする
機能と、フラグFR1〜FRjの内、更新されたレジス
タに対応するフラグをオンにする機能と、フラグFB1
〜FBkの内、更新されたI/Oポート用バッファに対
応するフラグをオンにする機能を有する。
When the target program stored in the execution format file 31 is loaded into the memory unit 11, the update position storage circuit 41 selects one of the flags FM1 to FMi.
The function of turning on the flag corresponding to the address where the target program is loaded, the function of turning on the flag corresponding to the updated address of the flags FM1 to FMi, and the updated of the flags FR1 to FRj The function to turn on the flag corresponding to the register and the flag FB1
Among FBk, it has a function of turning on a flag corresponding to the updated I / O port buffer.

【0028】次に、本実施例の動作を、図3に示すよう
に、レジスタ等の初期設定処理,接続されている装置の
確認処理等を行う起動処理部31aと、アプリケーショ
ン部31bとから構成されるターゲットプログラム31
Pのアプリケーション部31bをデバッグする場合を例
にとって説明する。
Next, as shown in FIG. 3, the operation of this embodiment is composed of a start-up processing unit 31a for performing processing for initializing registers and the like, a processing for confirming connected devices, and an application unit 31b. Target program 31
The case where the application unit 31b of P is debugged will be described as an example.

【0029】先ず、図4に示すように、実行形式ファイ
ル31に格納されているターゲットプログラム31Pを
メモリ部11にロードする。その際、更新位置記憶回路
41は、更新位置記憶テーブル42に格納されているタ
ーゲットCPUのメモリの各アドレスに対応するフラグ
FM1〜FMiの内、ターゲットプログラム31Pがロ
ードされたアドレスに対応するフラグをオンにする。こ
こで、フラグがオンにされるのは、ターゲットプログラ
ム31Pがロードされるアドレスだけであり、ターゲッ
トCPUがワークエリアとして使用するアドレスに対応
するフラグはオンにされない。
First, as shown in FIG. 4, the target program 31P stored in the executable file 31 is loaded into the memory unit 11. At this time, the update position storage circuit 41 sets the flag corresponding to the address at which the target program 31P is loaded among the flags FM1 to FMi stored in the update position storage table 42 and corresponding to each address of the memory of the target CPU. turn on. Here, the flag is turned on only at the address where the target program 31P is loaded, and the flag corresponding to the address used as the work area by the target CPU is not turned on.

【0030】ターゲットプログラム31Pのロードが完
了すると、CPU2にシミュレーション用プログラム1
4に従ってターゲットプログラム31Pの起動処理部3
1aを実行し、更に、アプリケーション部31bの開始
直前の地点におかれるブレークポイント命令を実行す
る。起動処理部31aの実行中、更新位置記憶回路41
は、更新位置記憶テーブル42中の各フラグFM1〜F
Mi,FR1〜FRj,FB1〜FBkの内、更新され
たアドレス,レジスタ,I/Oポート用バッファに対応
するフラグをオンにする。
When the loading of the target program 31P is completed, the simulation program 1
4, the activation processing unit 3 of the target program 31P
1a is executed, and further, a breakpoint command placed at a point immediately before the start of the application unit 31b is executed. During the execution of the activation processing unit 31a, the update position storage circuit 41
Are the flags FM1 to FM in the update position storage table 42.
Among the Mi, FR1 to FRj, and FB1 to FBk, the flag corresponding to the updated address, register, and I / O port buffer is turned on.

【0031】また、CPU2は、ブレークポイント命令
を実行すると、保存処理用プログラム15に従った保存
処理を行う。即ち、更新位置記憶テーブル42の内容を
状態保存ファイル32に保存すると共に、更新位置記憶
テーブル42中の対応するフラグがオンになっているア
ドレス,レジスタ,I/Oポート用バッファの状態を状
態保存ファイル32に保存し、その後、更新位置記憶テ
ーブル42内のフラグを全てオフにする。ここで、レジ
スタ,I/Oポート用バッファについては、状態を状態
保存ファイル32に保存するのは、初期状態から状態が
変更されたレジスタ,I/Oポート用バッファだけであ
り、メモリについては、ターゲットプログラムがロード
されたアドレス及びワークエリアの内の初期状態から状
態が変化したアドレスだけであるので、状態保存ファイ
ル32に保存しておく状態情報の情報量を少ないものに
することができる。
When the CPU 2 executes the breakpoint instruction, the CPU 2 performs a save process in accordance with the save process program 15. That is, the contents of the update position storage table 42 are saved in the state save file 32, and the states of the addresses, registers, and I / O port buffers for which the corresponding flags in the update position storage table 42 are turned on are saved. Save in the file 32, and then turn off all the flags in the update position storage table 42. Here, with regard to the registers and I / O port buffers, only the registers and I / O port buffers whose states have been changed from the initial state save the state in the state saving file 32. Since only the address at which the target program is loaded and the address whose state has changed from the initial state in the work area, the amount of state information stored in the state storage file 32 can be reduced.

【0032】保存処理が終了すると、CPU2は、シミ
ュレーション用プログラム14に従ってターゲットプロ
グラム31Pのアプリケーション部31bを実行し、ア
プリケーション部31bのデバッグを行う。アプリケー
ション部31bの実行中、更新位置記憶回路41は、更
新位置記憶テーブル42中の各フラグFM1〜FMi,
FR1〜FRj,FB1〜FBkの内、更新されたアド
レス,レジスタ,I/Oポート用バッファに対応するフ
ラグをオンにする。
When the saving process is completed, the CPU 2 executes the application section 31b of the target program 31P according to the simulation program 14, and debugs the application section 31b. During the execution of the application unit 31b, the update position storage circuit 41 updates the flags FM1 to FMi,
Flags corresponding to updated addresses, registers, and I / O port buffers among FR1 to FRj and FB1 to FBk are turned on.

【0033】その後、再び、ターゲットプログラム31
Pのアプリケーション部31bからデバッグを行う場合
は、復元処理用プログラム16に従った復元処理をCP
U2に実行させ、ターゲットCPUのメモリ,レジス
タ,I/Oポート用バッファの状態をアプリケーション
部31bの実行開始直前の状態に復元する。
Then, again, the target program 31
When debugging is performed from the application unit 31b of the P, the restoration processing according to the restoration processing program 16 is executed by the CP.
U2 is executed to restore the state of the memory, register, and I / O port buffer of the target CPU to the state immediately before the start of the execution of the application unit 31b.

【0034】即ち、CPU2は、更新位置記憶テーブル
42中のフラグがオンになっているアドレス,レジス
タ,I/Oポート用バッファについては、状態保存ファ
イル32に保存されている更新位置記憶テーブル中の対
応するフラグがオンになっているか否かを判断し、オン
になっていると判断した場合は、その状態を状態保存フ
ァイル32に保存されている状態に復元し、オフになっ
ていると判断した場合は、その状態を初期状態(例え
ば、0)に復元する。
That is, for the addresses, registers, and I / O port buffers for which the flags in the update position storage table 42 are turned on, the CPU 2 reads the update position storage table stored in the state storage file 32. It is determined whether or not the corresponding flag is on. If it is determined that the corresponding flag is on, the state is restored to the state stored in the state storage file 32, and it is determined that the flag is off. If so, the state is restored to the initial state (for example, 0).

【0035】例えば、更新位置記憶テーブル42中のレ
ジスタR1に対応するフラグFR1がオンになっていれ
ば、状態保存ファイル32に保存されている更新位置記
憶テーブルのフラグRF1がオンになっているか否かを
判断し、オンになっている場合は、レジスタ部12中の
レジスタR1に対応するアドレスのメモリ状態を状態保
存ファイル32に保存されている状態に復元し、オフに
なっていると判断した場合は、その状態を初期状態に復
元する。
For example, if the flag FR1 corresponding to the register R1 in the update position storage table 42 is ON, it is determined whether the flag RF1 of the update position storage table stored in the state storage file 32 is ON. If it is on, the memory state of the address corresponding to the register R1 in the register section 12 is restored to the state stored in the state storage file 32, and it is determined that it is off. If so, the state is restored to the initial state.

【0036】その後、CPU2はシミュレーション用プ
ログラム14に従ってターゲットプログラム31Pをア
プリケーション部31bから実行する。
Thereafter, the CPU 2 executes the target program 31P from the application section 31b according to the simulation program 14.

【0037】[0037]

【発明の効果】以上説明したように本発明は、レジスタ
等の初期状態が決まっている資源については、ターゲッ
トプログラムを或る地点まで実行する間に状態が変更さ
れた資源の状態のみを状態保存ファイルに保存しておけ
ば良いので、全ての資源の状態を保存しておくことが必
要であった従来の技術に比較してファイル容量を少なく
することができる効果がある。
As described above, according to the present invention, for resources such as registers whose initial state is determined, only the state of the resource whose state is changed while the target program is executed up to a certain point is saved. Since it suffices to save the file in a file, there is an effect that the file capacity can be reduced as compared with the conventional technique that needs to save the state of all resources.

【0038】更に、本発明は、ロードされるターゲット
プログラムによって初期状態が変わるアドレスが存在す
るメモリについては、ターゲットプログラムがロードさ
れたアドレスのメモリ状態と、ターゲットプログラムを
先頭部分から或る地点まで実行する間に状態が更新され
たアドレスのメモリ状態とを状態保存ファイルに保存し
ておけば良く、メモリ状態が更新されなかったワークエ
リアのアドレスについてはメモリ状態は保存しておく必
要がないので、メモリの全てのアドレスのメモリ状態を
保存しておくことが必要であった従来の技術に比較して
更にファイル容量を少なくすることができる。
Further, according to the present invention, for a memory having an address whose initial state changes depending on the loaded target program, the memory state of the address where the target program is loaded and the target program is executed from the beginning to a certain point. It is sufficient to save the memory status of the address whose status was updated during the process in the status save file, and it is not necessary to save the memory status for the address of the work area whose memory status was not updated. The file capacity can be further reduced as compared with the conventional technique in which the memory state of all the addresses of the memory needs to be stored.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の実施例のブロック図である。FIG. 1 is a block diagram of an embodiment of the present invention.

【図2】更新位置記憶テーブル42の内容例を示す図で
ある。
FIG. 2 is a diagram showing an example of contents of an update position storage table 42.

【図3】実行形式ファイル31に格納するターゲットプ
ログラムの一例を示す図である。
FIG. 3 is a diagram showing an example of a target program stored in an execution format file 31.

【図4】実施例の動作説明図である。FIG. 4 is an operation explanatory diagram of the embodiment.

【符号の説明】[Explanation of symbols]

1…メモリ 11…メモリ部 12…レジスタ部 13…I/Oポート部 14…シミュレーション用プログラム 15…保存処理用プログラム 16…復元処理用プログラム 2…CPU 3…ファイル装置 31…実行形式ファイル 32…状態保存ファイル 4…更新位置記憶装置 41…更新位置記憶回路 42…更新位置記憶テーブル DESCRIPTION OF SYMBOLS 1 ... Memory 11 ... Memory part 12 ... Register part 13 ... I / O port part 14 ... Simulation program 15 ... Save processing program 16 ... Restoration processing program 2 ... CPU 3 ... File device 31 ... Execution format file 32 ... State Save file 4 ... Update position storage device 41 ... Update position storage circuit 42 ... Update position storage table

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 シミュレーション対象となるターゲット
CPUのターゲットプログラムにかかる動作をシミュレ
ーションするCPUシミュレータに於いて、 前記ターゲットプログラムにかかる前記ターゲットCP
Uの動作をシミュレーションした時に状態が更新される
可能性があり、且つ初期状態が決まっている前記ターゲ
ットCPUの資源それぞれについてのフラグを有する更
新位置記憶テーブルと、 前記ターゲットプログラムにかかる前記ターゲットCP
Uの動作をシミュレーションしている時に前記資源の状
態が更新された時、状態が更新された資源に対応する前
記更新位置記憶テーブル中のフラグを更新済みを示すも
のに変更する更新位置記憶回路と、 前記ターゲットプログラムが或る地点まで実行された時
の前記更新位置記憶テーブルの内容と、前記更新位置記
憶テーブル中のフラグが更新済みを示している資源の状
態とを状態保存ファイルに保存すると共に、前記更新位
置記憶テーブルをクリアする保存処理手段と、 前記CPUシミュレータの状態復元時、前記更新位置記
憶テーブル中のフラグが更新済みを示している各資源に
ついて、前記状態保存ファイルに保存されている対応す
るフラグが更新を示している場合には、その状態を前記
状態保存ファイルに保存されている状態に復元し、前記
状態保存ファイルに保存されている対応するフラグが未
更新を示している場合は、その状態を初期状態に復元す
る復元処理手段とを備えたことを特徴とするCPUシミ
ュレータ。
1. A CPU simulator for simulating an operation of a target CPU to be simulated according to a target program, wherein the target CP of the target program is simulated.
An update position storage table having a flag for each resource of the target CPU whose state may be updated when simulating the operation of U and whose initial state has been determined; and the target CP associated with the target program.
An update position storage circuit for changing a flag in the update position storage table corresponding to the resource whose state has been updated to one indicating that the resource has been updated when the state of the resource is updated while simulating the operation of U; Saving the contents of the update position storage table when the target program has been executed to a certain point, and the state of the resource whose flag in the update position storage table indicates that the update has been completed, in a state storage file. Save processing means for clearing the update position storage table; and when restoring the state of the CPU simulator, each resource whose flag in the update position storage table indicates that the update has been completed is stored in the state storage file. If the corresponding flag indicates an update, the state is restored to the state stored in the state storage file. CPU simulator, and corresponding flags are stored in the state storing files If it shows a non-updated, characterized in that a restoration processing means for restoring the state to the initial state.
【請求項2】 前記資源はレジスタ或いは入出力ポート
用バッファであることを特徴とする請求項1記載のCP
Uシミュレータ。
2. The CP according to claim 1, wherein the resource is a register or an input / output port buffer.
U simulator.
【請求項3】 前記更新位置記憶テーブルは、前記ター
ゲットプログラムがロードされる前記ターゲットCPU
のメモリの各アドレス及び前記ターゲットプログラムが
ワークエリアとして使用する前記ターゲットCPUのメ
モリの各アドレス毎のフラグを有し、 前記更新位置記憶回路は、前記ターゲットプログラムの
ロード時、前記ターゲットプログラムがロードされたメ
モリの各アドレスのフラグを更新済みを示すものに変更
し、且つ、シミュレーションの実行時に前記メモリの状
態が更新されたとき、その更新されたメモリのアドレス
に対応するフラグが更新済みでなければ更新済みを示す
ものに変更し、 前記保存処理手段は、前記ターゲットプログラムが或る
地点まで実行された時、前記更新位置記憶テーブル中の
フラグが更新済みを示している、前記ターゲットプログ
ラムがロードされたアドレス及びメモリ状態が更新され
たワークエリアのアドレスのメモリ状態を前記状態保持
ファイルに保存し、 前記復元処理手段は、前記更新位置記憶テーブル中のフ
ラグが更新済みを示している前記メモリの各アドレスに
ついて、前記状態保存ファイルに保存されている対応す
るフラグが更新を示している場合には、そのメモリ状態
を前記状態保存ファイルに保存されている状態に復元
し、前記状態保存ファイルに保存されている対応するフ
ラグが未更新を示している場合は、そのメモリ状態を初
期状態に復元することを特徴とする請求項2記載のCP
Uシミュレータ。
3. The target CPU on which the target program is loaded, wherein the update position storage table is
Of each memory and a flag for each address of the memory of the target CPU used as a work area by the target program, the update position storage circuit loads the target program when the target program is loaded. If the flag corresponding to the updated memory address is not updated when the state of the memory is updated when the simulation is executed, and the flag of each address of the updated memory is updated. When the target program is executed up to a certain point, the storage processing means changes the flag in the update position storage table to indicate that the target program is loaded. Address and memory status of the work area The memory state of the dress is stored in the state storage file, and the restoration processing unit stores in the state storage file for each address of the memory in which the flag in the update position storage table indicates that the update has been completed. When the corresponding flag indicates update, the memory state is restored to the state saved in the state save file, and the corresponding flag saved in the state save file indicates not updated. In that case, the memory state is restored to the initial state.
U simulator.
JP6339242A 1994-12-29 1994-12-29 CPU simulator Expired - Lifetime JP2663895B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6339242A JP2663895B2 (en) 1994-12-29 1994-12-29 CPU simulator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6339242A JP2663895B2 (en) 1994-12-29 1994-12-29 CPU simulator

Publications (2)

Publication Number Publication Date
JPH08185341A true JPH08185341A (en) 1996-07-16
JP2663895B2 JP2663895B2 (en) 1997-10-15

Family

ID=18325606

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6339242A Expired - Lifetime JP2663895B2 (en) 1994-12-29 1994-12-29 CPU simulator

Country Status (1)

Country Link
JP (1) JP2663895B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008040595A (en) * 2006-08-02 2008-02-21 Rohm Co Ltd Information processor
US8725485B2 (en) 2007-02-26 2014-05-13 Spansion Llc Simulation method and simulation apparatus

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008040595A (en) * 2006-08-02 2008-02-21 Rohm Co Ltd Information processor
US8725485B2 (en) 2007-02-26 2014-05-13 Spansion Llc Simulation method and simulation apparatus

Also Published As

Publication number Publication date
JP2663895B2 (en) 1997-10-15

Similar Documents

Publication Publication Date Title
GB2281986A (en) Logging program counter on reset.
JP2663895B2 (en) CPU simulator
JP2552738B2 (en) Data processing device
JP2715988B2 (en) Program simulator device and program debugging method
JP2000076095A (en) Device and method for tracing program and storage medium storing program therefor
JPS5835648A (en) Program execution controlling system
JPH0561717A (en) Program debugging device
JPH02135545A (en) Execution control processing system for debugger
JP3410023B2 (en) In-circuit emulator
JP2000242524A (en) Software simulator for processor
JP2697230B2 (en) Debug support device
JPH0652013A (en) Tracing circuit
JPH0772874B2 (en) Interrupt receiving device
JPS62290942A (en) Debugger starting system
JPH05250208A (en) Program reexecution processing system
JPH06214828A (en) Interactive debug controller
JPH11288371A (en) In-circuit emulator
JPH0981275A (en) Arithmetic processing unit
JPH0764802A (en) Simulation device for real-time system
JPS61210440A (en) Level tracing device
JPS6214240A (en) Program inspecting system
JPH0454548A (en) Memory check system for computer system
JPH08272653A (en) Freeze processing system
JPH04332050A (en) Debugger to be restarted from interrupted point at the time of restarting
JPH01175034A (en) Register group loading accelerating system