JP5542643B2 - Simulation apparatus and simulation program - Google Patents

Simulation apparatus and simulation program Download PDF

Info

Publication number
JP5542643B2
JP5542643B2 JP2010275797A JP2010275797A JP5542643B2 JP 5542643 B2 JP5542643 B2 JP 5542643B2 JP 2010275797 A JP2010275797 A JP 2010275797A JP 2010275797 A JP2010275797 A JP 2010275797A JP 5542643 B2 JP5542643 B2 JP 5542643B2
Authority
JP
Japan
Prior art keywords
time
simulation
event
unit
instruction
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.)
Expired - Fee Related
Application number
JP2010275797A
Other languages
Japanese (ja)
Other versions
JP2012123726A (en
Inventor
正勝 外山
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 JP2010275797A priority Critical patent/JP5542643B2/en
Publication of JP2012123726A publication Critical patent/JP2012123726A/en
Application granted granted Critical
Publication of JP5542643B2 publication Critical patent/JP5542643B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

この発明は、例えば組込み装置で実行されるプログラムをシミュレーションする、シミュレーション装置及びシミュレーションプログラムに関する。   The present invention relates to a simulation apparatus and a simulation program for simulating a program executed by, for example, an embedded apparatus.

組込み装置のアーキテクチャ設計、動作検証、性能解析、ソフトウェア開発などを目的とし、組込み装置のハードウェアの持つ機能をソフトウェアでモデル化し、その上でターゲットソフトウェア131を実行するための仮想環境を提供する手段として、シミュレータがある。シミュレータは、シミュレーションの対象範囲、目的、ハードウェア機能をモデル化するときの抽象度や精度によって、多様な形態が存在する。そのなかの1つの形態として、ターゲットとなる組込み装置で使われるCPU用にコンパイル、リンクされたオブジェクトコードを、ターゲットとは異なるCPUで動作するホストコンピュータにおいて解釈し、メモリやレジスタの内容の変化を擬似的に再現する、命令セットシミュレータがある。命令セットシミュレータは、ターゲットCPUの命令列をそのまま実行可能であるため、ターゲットソフトウェア131の構成や処理内容に関与しない。そのため、実行すべき処理が無くなりCPUが空き状態となっている、CPUアイドル処理であっても、実際のCPUと同様に命令列の解釈、実行を行う。
CPUアイドル処理は、ジャンプ命令を繰り返し実行する、単純なループ処理で実現されることが多い。これに対し、特許文献1では、実行した命令列の履歴からループ処理を検出し、ループを規定回数繰り返した後のメモリやレジスタの内容を予測し、結果を反映することで、ループ回数分の命令実行を短縮する手段が開示されている。
Means for providing a virtual environment for modeling the functions of the hardware of the embedded device with software and executing the target software 131 on it for the purpose of architecture design, operation verification, performance analysis, software development, etc. of the embedded device As a simulator. There are various types of simulators depending on the target range of simulation, the purpose, and the level of abstraction and accuracy when modeling hardware functions. As one form, the object code compiled and linked for the CPU used in the target embedded device is interpreted by a host computer that operates on a CPU different from the target, and changes in the contents of the memory and registers are interpreted. There is an instruction set simulator that reproduces the simulation. Since the instruction set simulator can execute the instruction sequence of the target CPU as it is, it does not participate in the configuration or processing contents of the target software 131. Therefore, even in the CPU idle process where there is no process to be executed and the CPU is in an empty state, the instruction sequence is interpreted and executed in the same manner as the actual CPU.
The CPU idle process is often realized by a simple loop process that repeatedly executes a jump instruction. On the other hand, in Patent Document 1, loop processing is detected from the history of executed instruction sequences, the contents of the memory and register after the loop is repeated a specified number of times, and the result is reflected, thereby reflecting the number of loops. Means for shortening instruction execution are disclosed.

特開平8−69392号公報JP-A-8-69392

コントローラのような入出力処理の完了が実時間で要求される組込み装置では、リアルタイムオペレーティングシステム(RTOS)が導入され、処理をタスクや割込みハンドラという単位で実行する。通常タスクや割込みハンドラは、ある決められた実時間制約(デッドライン)に確実に処理が完了するよう、最悪ケースでの実行時間で処理内容が設計される。そのため、通常ケースではマージン分はCPUアイドル処理となり、次の割込み事象を待つために時間を消費するための命令列を実行することになる。   In an embedded device such as a controller that requires completion of input / output processing in real time, a real-time operating system (RTOS) is introduced, and processing is executed in units of tasks and interrupt handlers. The processing contents of normal tasks and interrupt handlers are designed with the worst case execution time so that the processing can be completed with certain real time constraints (deadline). Therefore, in the normal case, the margin is CPU idle processing, and an instruction sequence for consuming time is executed to wait for the next interrupt event.

CPUアイドル処理は、空き時間に実行される意味のない処理であるため、その命令列を忠実にシミュレーションしたとしても、意味のある演算結果は得られない。この意味のない命令実行に対しても、ホストコンピュータのCPUリソースが割り当てられ、一定の処理時間がかかる。従って、CPUアイドル処理のためにCPUリソースを使わないようにすれば、シミュレーション時間は短縮され、実行結果を早く得ることができる。
その1つの手段として、特許文献1では、ループに係る命令をスキップする方式が示されている。なお、CPUアイドル処理は、単純なループ処理で実現する他に、CPUコアを停止させて低消費電力状態に移行し待機する処理として実現する場合があり、その場合CPUの命令実行は停止してしまうため、特許文献1に記載のループを短縮する手法は使えない。
Since the CPU idle process is a meaningless process executed in the idle time, even if the instruction sequence is faithfully simulated, a meaningful calculation result cannot be obtained. Even for this meaningless instruction execution, CPU resources of the host computer are allocated, and a certain processing time is required. Therefore, if the CPU resource is not used for the CPU idle process, the simulation time is shortened and the execution result can be obtained quickly.
As one means for that, Patent Document 1 discloses a method of skipping instructions related to a loop. Note that the CPU idle processing may be implemented as a processing that stops the CPU core, shifts to a low power consumption state, and waits in addition to the simple loop processing. In this case, the CPU instruction execution is stopped. Therefore, the method of shortening the loop described in Patent Document 1 cannot be used.

ここで、CPUアイドル処理が解除される条件に注目すると、CPUに対し割込みなどの外部事象を与える必要があることがわかる。従って、本発明では、現在シミュレーション実行している命令のCPUアイドル処理の部分であることを検出する手段により、ターゲットソフトウェアがCPUアイドル処理の実行に遷移したことを検出した際に、次の入出力イベントが発生する時刻までシミュレータ内部の時間を強制的に進める。その結果、ターゲットソフトウェアでは、CPUアイドル処理に入った瞬間に次の割込みが発生し、CPUアイドル処理はキャンセルされ、割込みハンドラやタスク処理が実行される。これにより、CPUアイドル処理に係るシミュレーション時間を短縮することを目的とする。   Here, when attention is paid to the condition for releasing the CPU idle process, it is understood that an external event such as an interrupt needs to be given to the CPU. Therefore, in the present invention, when it is detected that the target software has shifted to the execution of the CPU idle process by the means for detecting that it is a part of the CPU idle process of the instruction currently being simulated, the next input / output Force the simulator's internal time until the event occurs. As a result, in the target software, the next interrupt occurs at the moment of entering the CPU idle process, the CPU idle process is canceled, and the interrupt handler and task process are executed. This aims at shortening the simulation time related to the CPU idle process.

この発明のシミュレーション装置は、
ターゲットとなるソフトウェアをシミュレーションするシミュレーション装置において、
前記ソフトウェアの命令を実行する命令セットシミュレータ部と、
前記命令セットシミュレータ部による前記命令の実行に応じて進行させる時刻であって、実時間の進行による現実の時刻とは異なるシミュレーション時刻を進行させるシミュレーション時刻管理部と、
前記命令セットシミュレータ部の実行している前記命令がアイドル処理かどうかを判定するアイドル判定処理を実行するアイドル処理判定部と、
前記アイドル処理判定部によって、前記命令セットシミュレータ部の実行中の命令がアイドル処理と判定されると、前記シミュレーション時刻管理部の管理する前記シミュレーション時刻を前記アイドル処理の終了まで進行させる時間補正部と
を備えたことを特徴とする。
The simulation apparatus of the present invention
In a simulation device that simulates target software,
An instruction set simulator for executing instructions of the software;
A simulation time management unit for advancing a simulation time different from the actual time due to the progress of real time, according to the execution of the instruction by the instruction set simulator unit;
An idle process determination unit for executing an idle determination process for determining whether the instruction being executed by the instruction set simulator unit is an idle process;
A time correction unit that advances the simulation time managed by the simulation time management unit until the end of the idle processing when the idle processing determination unit determines that the instruction being executed by the instruction set simulator unit is idle processing; It is provided with.

この発明により、ターゲットとなるソフトウェアをシミュレーションするシミュレーション装置において、CPUアイドル処理となるシミュレーション時間を短縮するシミュレーション装置を提供できる。   According to the present invention, in a simulation apparatus that simulates target software, it is possible to provide a simulation apparatus that shortens the simulation time for CPU idle processing.

実施の形態1におけるターゲットシステムシミュレータ100のブロック図。FIG. 3 is a block diagram of target system simulator 100 in the first embodiment. 実施の形態1における命令セットシミュレータ部110のフローチャート。3 is a flowchart of an instruction set simulator unit 110 in the first embodiment. 実施の形態1におけるアイドル処理判定部170のフローチャート。5 is a flowchart of an idle process determination unit 170 in the first embodiment. 実施の形態1における時間補正部180のフローチャート。5 is a flowchart of a time correction unit 180 in the first embodiment. 図2、図3、図4を連結した図。The figure which connected FIG.2, FIG.3, FIG.4. 実施の形態1におけるI/Oシミュレータ部120によるイベント管理部150への登録処理を示すローチャート。6 is a flowchart showing registration processing in the event management unit 150 by the I / O simulator unit 120 according to the first embodiment. 実施の形態1におけるイベント管理部150のもつイベントキューを示す図。FIG. 3 is a diagram illustrating an event queue included in the event management unit 150 according to the first embodiment. 実施の形態1におけるイベント管理部150によるイベント処理動作を示すフローチャート。6 is a flowchart showing an event processing operation by the event management unit 150 according to the first embodiment. 実施の形態1におけるイベント管理部150のイベント処理動作を説明する図。FIG. 6 illustrates an event processing operation of the event management unit 150 in the first embodiment. 実施の形態1におけるイベント管理部150のイベント処理動作を説明する図。FIG. 6 illustrates an event processing operation of the event management unit 150 in the first embodiment. 実施の形態1における効果を示す図。FIG. 5 shows effects in the first embodiment. 実施の形態2におけるターゲットシステムシミュレータ100−2のブロック図。FIG. 10 is a block diagram of a target system simulator 100-2 in the second embodiment. 実施の形態2における実時間調整部190のフローチャート。9 is a flowchart of real time adjustment unit 190 in the second embodiment. 実施の形態3におけるターゲットシステムシミュレータを実行する計算機の外観。The external appearance of the computer which runs the target system simulator in Embodiment 3. FIG. 実施の形態3におけるターゲットシステムシミュレータを実行する計算機のハードウェア構成。FIG. 10 is a hardware configuration of a computer that executes a target system simulator according to Embodiment 3. FIG.

実施の形態1.
図1は、実施の形態1におけるターゲットシステムシミュレータ100の構成を示している。ターゲットシステムシミュレータ100は、ターゲットである組込み装置をソフトウェアで模擬した装置である。ターゲットシステムシミュレータ100は、CPU命令をシミュレーションする命令セットシミュレータ部110と、周辺装置の割込みや入出力をシミュレーションするI/Oシミュレータ部120(イベントシミュレータ)と、ターゲットメモリ130と、ターゲットレジスタ140と、イベント管理部150、シミュレーション時刻管理部160、アイドル処理判定部170、時間補正部180を備える。
Embodiment 1 FIG.
FIG. 1 shows a configuration of a target system simulator 100 according to the first embodiment. The target system simulator 100 is a device that simulates a target embedded device with software. The target system simulator 100 includes an instruction set simulator unit 110 that simulates CPU instructions, an I / O simulator unit 120 (event simulator) that simulates interrupts and input / output of peripheral devices, a target memory 130, a target register 140, An event management unit 150, a simulation time management unit 160, an idle process determination unit 170, and a time correction unit 180 are provided.

ターゲットメモリ130は、ターゲットのメモリ内容を再現し保持する。また、ターゲットレジスタ140は、ターゲットのレジスタ内容を再現し保持する。ターゲットシステムシミュレータ100で実行するターゲットソフトウェア131は、ターゲットメモリ130にロードされる。   The target memory 130 reproduces and holds the target memory contents. The target register 140 reproduces and holds the target register contents. Target software 131 executed by the target system simulator 100 is loaded into the target memory 130.

命令セットシミュレータ部110は、ターゲットメモリ130からターゲットソフトウェア131の命令コードを取り出し、解釈、実行する。その際、ターゲットレジスタ140、ターゲットメモリ130およびI/Oシミュレータ部120に対し、その命令の演算結果を反映する。   The instruction set simulator unit 110 takes out the instruction code of the target software 131 from the target memory 130, interprets it, and executes it. At that time, the operation result of the instruction is reflected on the target register 140, the target memory 130, and the I / O simulator unit 120.

I/Oシミュレータ部120は、CPU以外の周辺装置の機能をソフトウェアでモデル化したものである。I/Oシミュレータ部120は、命令セットシミュレータ部110からの入出力要求に対応してデータを供給する他に、仕様により規定されるタイミングで、命令セットシミュレータ部110に対し割込み要求を出す。   The I / O simulator unit 120 models the functions of peripheral devices other than the CPU with software. In addition to supplying data in response to an input / output request from the instruction set simulator unit 110, the I / O simulator unit 120 issues an interrupt request to the instruction set simulator unit 110 at a timing specified by the specification.

この割込みの発生や入出力の変化をイベントとして、イベント管理部150は、イベントの発生タイミングを管理する。イベント管理部150は、シミュレーション時刻管理部160が管理するシミュレーション時刻に従って、イベントの発生タイミングを把握する。   The event management unit 150 manages the occurrence timing of the event by using the occurrence of the interrupt or the change in input / output as an event. The event management unit 150 grasps the event occurrence timing according to the simulation time managed by the simulation time management unit 160.

シミュレーション時刻管理部160が管理するのは、シミュレーション実行にかかっている実時間ではなく、シミュレーションのターゲットとなっているシステム内で進行し把握される時間である。例えば、実際の組込み装置上で10000命令実行するのに1ミリ秒かかっており、シミュレータで10000命令実行するのに10ミリ秒かかっていたとする。このとき、実時間では10ミリ秒の時間が経過していたとしても、ターゲットの内部状態は1ミリ秒相当分しか進行していないため、シミュレーション時刻は1ミリ秒となる。シミュレーション時刻は、命令セットシミュレータ部110が命令をシミュレーション実行した結果、その命令実行にかかるマシンサイクル数をシミュレーション時刻管理部160に通知し、シミュレーション時刻管理部160は通知されたマシンサイクルに相当する時間を進める。   The simulation time management unit 160 manages not the actual time required for the simulation execution but the time that is progressed and grasped in the simulation target system. For example, it is assumed that it takes 1 millisecond to execute 10,000 instructions on an actual embedded device, and 10 milliseconds to execute 10,000 instructions in the simulator. At this time, even if 10 milliseconds have elapsed in real time, the internal state of the target has progressed only for 1 millisecond, so the simulation time is 1 millisecond. The simulation time is obtained by notifying the simulation time management unit 160 of the number of machine cycles required to execute the instruction as a result of the instruction set simulator unit 110 executing the simulation, and the simulation time management unit 160 corresponds to the notified machine cycle. To proceed.

アイドル処理判定部170は、実行中のターゲットソフトウェア131がアイドル状態に遷移しているかどうかを判定する手段である。アイドル処理判定部170は、アイドル状態を検出した場合は、時間補正部180に対し、シミュレーション時刻を進めるよう要求する。   The idle process determination unit 170 is a means for determining whether the target software 131 being executed has transitioned to the idle state. When the idle process determination unit 170 detects an idle state, the idle process determination unit 170 requests the time correction unit 180 to advance the simulation time.

時間補正部180は、イベント管理部150に対して次のイベントが発生するまでの時間を問い合わせ、その結果をもとにシミュレーション時刻管理部160に対し時間を強制的に進める要求を出す。   The time correction unit 180 inquires of the event management unit 150 about the time until the next event occurs, and issues a request to forcibly advance the time to the simulation time management unit 160 based on the result.

(動作の説明)
次に動作について説明する。
図2は、命令セットシミュレータ部110に追加する処理内容を示したフローチャートである。
図3は、アイドル処理判定部170の処理内容を示したフローチャートである。
図4は、時間補正部180のフローチャートを示す。
図5は、図2、図3、図4の関係を示した。
(Description of operation)
Next, the operation will be described.
FIG. 2 is a flowchart showing the processing contents added to the instruction set simulator unit 110.
FIG. 3 is a flowchart showing the processing contents of the idle processing determination unit 170.
FIG. 4 shows a flowchart of the time correction unit 180.
FIG. 5 shows the relationship between FIG. 2, FIG. 3, and FIG.

命令セットシミュレータ部110は、通常は、CPUの命令フェッチ、デコード、データフェッチ、命令実行、結果格納の、5つの実行ステージを機能単位とし、プログラムカウンタを進めながら1命令につき1ループ回してシミュレーション実行を進めていく。図2に示す追加処理は、結果格納ステージの後に追加する。S100では、命令セットシミュレータ部110は、今回の実行ループで実行した命令の種別を判定する。もしジャンプ命令を実行していた場合は、S101でアイドル処理判定部170を呼び出す。   The instruction set simulator unit 110 normally has five execution stages of CPU instruction fetch, decode, data fetch, instruction execution, and result storage as functional units, and executes simulation by rotating one loop per instruction while advancing the program counter. Will continue. The addition process shown in FIG. 2 is added after the result storage stage. In S100, the instruction set simulator unit 110 determines the type of instruction executed in the current execution loop. If a jump instruction has been executed, the idle process determination unit 170 is called in S101.

図3に示すように、S200では、アイドル処理判定部170は、実行したジャンプ命令のジャンプ先のアドレスが、ターゲットソフトウェア131のCPUアイドル処理の命令コードが配置してあるアドレスの範囲内にあるかどうかを判定する。CPUアイドル処理のアドレスは、シンボル情報から取得することができる。もしジャンプ先がCPUアイドル処理であることを検出した場合は、アイドル処理判定部170は、S201で時間補正部180を呼び出す。   As shown in FIG. 3, in S200, the idle process determination unit 170 determines whether the jump destination address of the executed jump instruction is within the address range where the CPU idle process instruction code of the target software 131 is located. Determine if. The CPU idle processing address can be obtained from the symbol information. If it is detected that the jump destination is the CPU idle process, the idle process determination unit 170 calls the time correction unit 180 in S201.

図4は、時間補正部180の処理を表すフローチャートを示している。
なお、イベント管理部150の管理するイベントキュー、イベント発生時刻については、図6〜図8の説明で後述する。
S500では、時間補正部180は、イベント管理部150が管理しているイベントキューを参照し、次のイベント発生時刻を取得する。イベントがなにも登録されていなければ0とする。次に、S501では、時間補正部180は、シミュレーション時刻管理部160に対し、S500で取得した次のイベント発生時刻をシミュレーション時刻に加算するよう要求する。この結果、次回のイベント管理部150の定期処理において、必ずイベントが発生することになる。これにより割込みが発生すれば、ターゲットソフトウェア131はCPUアイドル処理を即座に抜け出し、割込みハンドラ処理を実行する。
FIG. 4 is a flowchart showing the processing of the time correction unit 180.
The event queue and event occurrence time managed by the event management unit 150 will be described later with reference to FIGS.
In S500, the time correction unit 180 refers to the event queue managed by the event management unit 150 and acquires the next event occurrence time. Set to 0 if no event is registered. Next, in S501, the time correction unit 180 requests the simulation time management unit 160 to add the next event occurrence time acquired in S500 to the simulation time. As a result, an event always occurs in the next periodic process of the event management unit 150. As a result, if an interrupt occurs, the target software 131 immediately exits the CPU idle process and executes the interrupt handler process.

図6は、I/Oシミュレータ部120が、割込み等のCPUの命令実行に対して非同期に発生する入出力事象を実現するために、その事象に対応するイベント(イベント識別子)を発生タイミング(イベント発生時刻)と共に、イベント管理部150に登録する処理を示したフローチャートである。本処理は、I/Oシミュレータ部120内で行われる割込み処理等に対応するイベント識別子と、その発生時刻(追加イベント発生時刻)とをパラメータとして呼び出される。なお、イベント発生時刻(後述する図5に記載)は、実時間ではなくシミュレーション時刻を基準とし、現在からどれだけ時間が経過した後にイベントを通知するかを、相対時間で指定するものである。   FIG. 6 shows the timing of generating an event (event identifier) corresponding to the event (event identifier) in order for the I / O simulator unit 120 to realize an input / output event that occurs asynchronously with respect to CPU instruction execution such as an interrupt. 6 is a flowchart illustrating a process of registering in the event management unit 150 together with an occurrence time). This process is called by using an event identifier corresponding to an interrupt process or the like performed in the I / O simulator unit 120 and its occurrence time (additional event occurrence time) as parameters. Note that the event occurrence time (described in FIG. 5 to be described later) is based on the simulation time instead of the actual time, and specifies how much time has elapsed from the present time as a relative time.

図7は、イベント管理部150の有するイベントキューの構造を示す図である。図6の動作の主体は、I/Oシミュレータ部120である。最初にS300では、I/Oシミュレータ部120は、図7の構造のイベントキューを調べ、既にイベントが登録されているか確認する。イベントキューは、イベントを管理する個々の構造体要素をポインタで繋いだものである。イベント発生時刻は、ひとつ手前の構造体要素からの経過時間が格納される。最終要素のポインタはNULLとなっている。イベントが何も登録されていない場合は、イベントキュー自体がNULLになる。従って、I/Oシミュレータ部120はイベントキューがNULLであれば、S308でキューにイベント要素を追加する。それ以外はS301に進む。S301では、イベントキューの先頭要素を参照し、イベント識別子とイベント発生時刻(キューイベント発生時刻)を取得する。S302では、キューイベント発生時刻と追加イベント発生時刻の値を比較する。キューイベント発生時刻の方が大きければ、キューイベント発生時刻から追加イベント発生時刻を引き、S308でキューイベントの要素の手前に追加イベントの要素を挿入する。追加イベント発生時刻の方が大きければ、S303で追加イベント発生時刻からキューイベント発生時刻を引き、S304でキューイベントの次の要素を参照する。そして、S305でイベント要素が終端のNULLであるかチェックし、NULLであればS308でその手前(キューの最後)に追加イベントの要素を挿入する。次のイベント要素がある場合は、S302に戻り、同様の処理を繰り返すことにより、イベントが発生する順番にソートされ、さらに各イベント要素は手前のイベント発生時点からの経過時間で管理されるようになる。   FIG. 7 is a diagram illustrating a structure of an event queue included in the event management unit 150. 6 is the I / O simulator unit 120. First, in S300, the I / O simulator unit 120 checks the event queue having the structure shown in FIG. 7 to check whether an event has already been registered. The event queue is a structure in which individual structure elements that manage events are connected by pointers. The event occurrence time stores the elapsed time from the previous structure element. The pointer of the last element is NULL. If no event is registered, the event queue itself becomes NULL. Accordingly, if the event queue is NULL, the I / O simulator unit 120 adds an event element to the queue in S308. Otherwise, the process proceeds to S301. In S301, an event identifier and an event occurrence time (queue event occurrence time) are acquired by referring to the head element of the event queue. In S302, the queue event occurrence time is compared with the value of the additional event occurrence time. If the queue event occurrence time is larger, the additional event occurrence time is subtracted from the queue event occurrence time, and the additional event element is inserted before the queue event element in S308. If the additional event occurrence time is greater, the queue event occurrence time is subtracted from the additional event occurrence time in S303, and the next element of the queue event is referred to in S304. Then, in S305, it is checked whether the event element is the terminal NULL, and if it is NULL, an additional event element is inserted immediately before (the end of the queue) in S308. If there is a next event element, the process returns to S302, and the same processing is repeated to sort the events in the order in which the events occur, and each event element is managed by the elapsed time from the previous event occurrence point. Become.

図8は、イベント管理部150が、命令セットシミュレータ部110から定期的に呼ばれて、イベントの発生有無をチェックする処理を表すフローチャートである。図8の動作の主体は、イベント管理部150である。
また図9、図10は、図8を説明するための図である。図9、図10を参照しながら図8を説明する。
FIG. 8 is a flowchart showing a process in which the event management unit 150 is periodically called from the instruction set simulator unit 110 to check whether an event has occurred. The subject of the operation in FIG. 8 is the event management unit 150.
9 and 10 are diagrams for explaining FIG. 8 will be described with reference to FIGS.

S400で、イベント管理部150は、図7のイベントキューの要素を調べ、NULLであれば、S410で、シミュレーション時刻管理部160によって管理している現在のシミュレーション時刻を参照し、イベント処理時刻として内部に保存した後、処理を終了する。
イベント要素が有れば、S401に進む。以下では説明のためにシミュレーション時刻を用いて説明するが説明の便宜のため、時間の単位は「秒」とした。
In S400, the event management unit 150 checks the elements of the event queue of FIG. 7. If NULL, the current simulation time managed by the simulation time management unit 160 is referred to in S410, and the event processing time is set as the internal event processing time. After saving, the process is terminated.
If there is an event element, the process proceeds to S401. In the following description, the simulation time is used for explanation, but the unit of time is “second” for convenience of explanation.

S401では、シミュレーション時刻管理部160によって管理している現在のシミュレーション時刻(20:19:23)を参照するとともに、
S410にて保存されている前回処理した時刻を示すイベント処理時刻(20:19:18)を取得し、その差分によって経過時間(23−18=5秒)を算出する。
S402でイベントキューの先頭要素を参照し、S403ではS401で求めた経過時間とキューイベント発生時刻を比較する。なお、前述のようにイベント発生時刻はひとつ手前の構造体要素(言い換えれば前回のイベント処理時刻(S410))からの経過時間であるので、経過時間とイベント発生時刻との比較が可能である。
In S401, referring to the current simulation time (20:19:23) managed by the simulation time management unit 160,
The event processing time (20:19:18) indicating the previous processing time stored in S410 is acquired, and the elapsed time (23-18 = 5 seconds) is calculated from the difference.
In S402, the head element of the event queue is referred to, and in S403, the elapsed time obtained in S401 is compared with the queue event occurrence time. As described above, since the event occurrence time is the elapsed time from the previous structural element (in other words, the previous event processing time (S410)), it is possible to compare the elapsed time with the event occurrence time.

(経過時間<イベント発生時刻の場合)
図9に示すように経過時間(5秒)のほうが小さければ(例えばイベント発生時刻が8秒とする)、S404でキューイベント発生時刻(8秒)から経過時間(5秒)を引いて3秒を算出し、取得したイベントキューのイベント発生時刻を算出した差分(3秒)に書き換える。その後、S410に進み、イベント処理時刻を取得した現在の時刻(20:19:23)に更新する。すなわち、取得した次回発生するべきイベントの発生時刻を差分(3秒)に書き換えることは、更新された現在の時刻(20:19:23)からのイベント発生時刻としたことを意味する。
(Elapsed time <event occurrence time)
As shown in FIG. 9, if the elapsed time (5 seconds) is smaller (for example, the event occurrence time is 8 seconds), the elapsed time (5 seconds) is subtracted from the queue event occurrence time (8 seconds) in S404 to obtain 3 seconds. And the event occurrence time of the acquired event queue is rewritten to the calculated difference (3 seconds). Then, it progresses to S410 and is updated to the present time (20:19:23) which acquired event processing time. That is, rewriting the occurrence time of the acquired event to be generated next time with a difference (3 seconds) means that the event occurrence time is from the updated current time (20:19:23).

(経過時間>イベント発生時刻の場合)
図10はキューイベント発生時刻の方が小さい場合を示す。図10に示すように、経過時間(5秒)よりも、キューイベント発生時刻(3秒とする)の方が小さいか同じであれば、イベント発生時刻が経過していることになる。このため、イベント管理部150は、S405以降のイベント通知処理に進む。
S405では、経過時間(5秒)からキューイベント発生時刻(3秒)を引いておく。そして、図10に示すように、得られた差分(2秒)だけ、次のイベント発生時刻からを差し引いておく。これは、この後にS410に進んだときに、イベント処理時刻を取得した現在の時刻(20:19:23)に更新するので、現在の時刻(20:19:23)を基準に次回のイベント(「T−2」秒後)を発生させるためである。
S406では、ポインタを操作することによって該当キューイベント要素(イベント発生時刻に到達した要素)をイベントキューの接続構造から削除し、
S407では、該当キューイベントのイベント識別子(実行要求通知の一例)をI/Oシミュレータ部120に送信することで、指定されたイベントの発生時刻となったことを知らせる。この処理に対応し、I/Oシミュレータ部120では、イベント識別子に対応するイベントのシミュレーションが行われ、その結果割込みの要求が発生した場合は、命令セットシミュレータ部110に対し割込み要求を出力することになる。
S408では、イベント管理部150は、キューイベントの次の要素を参照し、
S409で次のイベント要素がないと判断されれば(S409のNO)、S410(取得した現在のシミュレーション時刻に更新する処理)に進む。次のイベント要素があれば、S403に戻り、同様の処理を繰り返す。
(Elapsed time> event occurrence time)
FIG. 10 shows a case where the queue event occurrence time is smaller. As shown in FIG. 10, if the queue event occurrence time (3 seconds) is smaller or the same as the elapsed time (5 seconds), the event occurrence time has elapsed. Therefore, the event management unit 150 proceeds to the event notification process after S405.
In S405, the queue event occurrence time (3 seconds) is subtracted from the elapsed time (5 seconds). Then, as shown in FIG. 10, only the obtained difference (2 seconds) is subtracted from the next event occurrence time. This is because the event processing time is updated to the current time (20:19:23) acquired when the process proceeds to S410, and the next event (20:19:23) is used as a reference. This is for generating "T-2" seconds later).
In S406, the corresponding queue event element (the element that has reached the event occurrence time) is deleted from the connection structure of the event queue by operating the pointer,
In S407, the event identifier (an example of the execution request notification) of the corresponding queue event is transmitted to the I / O simulator unit 120 to notify that the specified event occurrence time has come. Corresponding to this processing, the I / O simulator unit 120 simulates an event corresponding to the event identifier, and if an interrupt request is generated as a result, an interrupt request is output to the instruction set simulator unit 110. become.
In S408, the event management unit 150 refers to the next element of the queue event,
If it is determined in S409 that there is no next event element (NO in S409), the process proceeds to S410 (a process for updating to the acquired current simulation time). If there is a next event element, the process returns to S403 and the same processing is repeated.

本実施の形態1によれば、CPUアイドル処理から抜け出すきっかけとなる割込みの発生が早められる。このため、CPUアイドル処理として実行されるはずの命令列のシミュレーションがスキップされ、その結果、シミュレーションにかかる実時間が削減される。また、CPUアイドル処理の命令列を操作するものではないため、CPUアイドル処理が単純なビジーループ処理で実現されていても、または消費電力を低減するためにCPUスリープ命令でCPUの動作自体を停止する処理で実現されていても適用可能である。
図11の(a)はターゲットシステムシミュレータ100の方式を適用しない場合(実施前)を示し、(b)はターゲットシステムシミュレータ100の方式を適用する場合(実施後)を示す図である。図11に示すように、100ms間隔で発生するタイマ割込みに対応してハンドラが起動され、そこからタスク処理が行われた後、CPUアイドル状態に遷移する処理モデルとなっている。シミュレーション実行速度はターゲットの組込み装置の実行速度の1/10、つまりシミュレーション時間は10倍かかるものとする。本実施の形態1の方式を適用しない(a)の場合は、実時間1700msの時点からCPUアイドル処理となり、実時間2000msの時点で割込みが発生することでCPUアイドル処理を抜け出し、次の周期処理を行っている。一方、本実施の形態1を適用する(b)の場合は、CPUアイドル処理に入るはずの1700msの時点で、シミュレーション時刻を強制的に進めてしまうため、即座に割込みが発生し、次の周期処理が実行される。この例では、この周期処理を実行するためにかかるシミュレーションの実時間を300ms削減できている。
According to the first embodiment, the occurrence of an interrupt that triggers the exit from the CPU idle process is accelerated. For this reason, the simulation of the instruction sequence that should be executed as the CPU idle process is skipped, and as a result, the actual time required for the simulation is reduced. Further, since the CPU idle processing instruction sequence is not operated, the CPU operation itself is stopped by the CPU sleep command in order to reduce power consumption even if the CPU idle processing is realized by simple busy loop processing. Even if it is realized by processing, it is applicable.
FIG. 11A shows a case where the method of the target system simulator 100 is not applied (before implementation), and FIG. 11B shows a case where the method of the target system simulator 100 is applied (after implementation). As shown in FIG. 11, a handler is activated in response to a timer interrupt that occurs at an interval of 100 ms, a task process is performed from there, and then a processing model for transitioning to a CPU idle state. The simulation execution speed is 1/10 of the execution speed of the target embedded device, that is, the simulation time is 10 times longer. In the case of (a) in which the method of the first embodiment is not applied, the CPU idle process starts from the time point of 1700 ms in real time, and the CPU idle process is exited when an interrupt occurs at the time point of 2000 ms in real time. It is carried out. On the other hand, in the case of (b) to which the first embodiment is applied, the simulation time is forcibly advanced at the time of 1700 ms, which is supposed to enter the CPU idle process. Processing is executed. In this example, the actual simulation time required to execute this periodic process can be reduced by 300 ms.

実施の形態2.
図12、図13を参照して実施の形態2を説明する。
図11は、実施の形態2におけるターゲットシステムシミュレータ100−2の機能構成を示している。図1との違いは、図12では実時間調整部190を有する点である。シミュレーション時刻管理部160がシミュレーション時刻を進める際に呼び出された場合に、実時間調整部190は、シミュレーション時刻が実時間よりも進んでいる場合にシミュレーション時刻を実時間に合わせるために、ターゲットシステムシミュレータ100−2が実行されているホストコンピュータのCPUリソースを解放する機能を持つ。
Embodiment 2. FIG.
The second embodiment will be described with reference to FIGS.
FIG. 11 shows a functional configuration of the target system simulator 100-2 in the second embodiment. The difference from FIG. 1 is that FIG. 12 includes a real time adjustment unit 190. When the simulation time management unit 160 is called when advancing the simulation time, the real time adjustment unit 190 sets the simulation time to the real time when the simulation time is ahead of the real time. It has a function of releasing CPU resources of the host computer on which 100-2 is executed.

次に動作について説明する。
図13は、実施の形態2で追加された実時間調整部190の処理内容を示したフローチャートである。
最初にS600では、シミュレーション実行を開始してから経過した「実時間」を算出する。時間情報は、ホストコンピュータのタイマを、ホストコンピュータ上で動作しているOSのAPIによって参照して取得する。起点となる実時間は、シミュレーション実行開始時に内部情報として保持されている。
次にS601で、シミュレーション時刻管理部160で管理されているシミュレーション時刻と、S600で算出した実時間を比較する。高速なCPUを備えるホストコンピュータ上において低速なCPUを備えるターゲットの組込み装置をシミュレーションする場合、シミュレーション実行の速度が実際のターゲットの組込み装置の実行速度よりも早くなる場合がある。また、CPUアイドル処理に相当する時間をスキップしたことにより、シミュレーション時刻が実時間を追い越す場合がある。以上のような場合には、シミュレーション時刻の方が実時間よりも大きくなるため、そのときはS602以降の処理を実行する。
S602では、進んでいるシミュレーション時刻から実時間を引いて、相対的な差分時間を算出する。
そしてS603では、ホストコンピュータのOSのAPIによって「差分時間の分だけ」シミュレータのプロセス、あるいはスレッドを停止させる。これにより、ターゲットシステムシミュレータ100−2によるホストコンピュータのCPUリソースの使用を放棄する。すなわち、シミュレーション時刻と実時間が一致したとき、シミュレータの実行が再開される。
Next, the operation will be described.
FIG. 13 is a flowchart showing the processing contents of the real-time adjustment unit 190 added in the second embodiment.
First, in S600, "real time" that has elapsed since the start of simulation execution is calculated. The time information is obtained by referring to the timer of the host computer using the API of the OS running on the host computer. The actual time as a starting point is held as internal information at the start of simulation execution.
In step S601, the simulation time managed by the simulation time management unit 160 is compared with the actual time calculated in step S600. When a target embedded device having a low-speed CPU is simulated on a host computer having a high-speed CPU, the simulation execution speed may be faster than the execution speed of the actual target embedded device. Further, the simulation time may pass the real time by skipping the time corresponding to the CPU idle processing. In such a case, since the simulation time is larger than the real time, the processing after S602 is executed at that time.
In S602, the relative time difference is calculated by subtracting the actual time from the simulation time that is proceeding.
In step S <b> 603, the simulator process or thread is stopped by “the difference time” by the API of the OS of the host computer. Thereby, the use of the CPU resource of the host computer by the target system simulator 100-2 is abandoned. That is, when the simulation time matches the real time, execution of the simulator is resumed.

本実施の形態2によれば、ターゲットの組込み装置が待機状態の時などの処理負荷が低い状態をシミュレーションする場合に、CPUアイドル処理の命令実行をスキップするためにシミュレーション時刻を強制的に進めるとともに、実時間に比べて進みすぎた時間分だけホストコンピュータのCPUリソースを解放する。このため、シミュレーション実行時のホストコンピュータの処理負荷を下げられ、他のアプリケーション(例えばエディッタ)の実行により多くのCPUリソースを割り当てることが可能となる。シミュレーションの方法としては、できるだけ早く結果を得るためにホストコンピュータのCPUリソースを占有して処理を行う場合と、ターゲットの組込み装置と同じタイミングで動作を確認したい場合とがあり、本実施例は後者をより低負荷、より効率的に実現するものである。   According to the second embodiment, when simulating a low processing load state such as when the target embedded device is in a standby state, the simulation time is forcibly advanced in order to skip instruction execution of CPU idle processing. The CPU resources of the host computer are released only for the time that has advanced too much compared to the real time. For this reason, the processing load on the host computer at the time of simulation execution can be reduced, and more CPU resources can be allocated for execution of other applications (for example, editors). As a simulation method, there are a case where processing is performed while occupying the CPU resources of the host computer in order to obtain a result as soon as possible, and a case where the operation is to be confirmed at the same timing as the target embedded device. Is realized more efficiently with lower load.

実施の形態3.
図14、図15を参照して実施の形態3を説明する。実施の形態3は、コンピュータであるターゲットシステムシミュレータ100、100−2のハードウェア構成を説明する。
図14は、コンピュータであるターゲットシステムシミュレータの外観の一例を示す図である。
図15は、ターゲットシステムシミュレータのハードウェア資源の一例を示す図である。
Embodiment 3 FIG.
The third embodiment will be described with reference to FIGS. 14 and 15. In the third embodiment, the hardware configuration of the target system simulators 100 and 100-2, which are computers, will be described.
FIG. 14 is a diagram illustrating an example of the appearance of a target system simulator that is a computer.
FIG. 15 is a diagram illustrating an example of hardware resources of the target system simulator.

外観を示す図14において、ターゲットシステムシミュレータは、システムユニット830、CRT(Cathode・Ray・Tube)やLCD(液晶)の表示画面を有する表示装置813、キーボード814(Key・Board:K/B)、マウス815、コンパクトディスク装置818(CDD:Compact Disk Drive)などのハードウェア資源を備え、これらはケーブルや信号線で接続されている。システムユニット830はネットワークに接続している。   In FIG. 14 showing the appearance, the target system simulator includes a system unit 830, a display device 813 having a CRT (Cathode / Ray / Tube) or LCD (liquid crystal) display screen, a keyboard 814 (Key / Board: K / B), Hardware resources such as a mouse 815 and a compact disk device 818 (CDD: Compact Disk Drive) are provided, and these are connected by cables and signal lines. The system unit 830 is connected to the network.

またハードウェア資源を示す図15において、ターゲットシステムシミュレータは、プログラムを実行するCPU810(Central Processing Unit)を備えている。CPU810は、バス825を介してROM(Read Only Memory)811、RAM(Random Access Memory)812、表示装置813、キーボード814、マウス815、通信ボード816、CDD818、磁気ディスク装置820と接続され、これらのハードウェアデバイスを制御する。磁気ディスク装置820の代わりに、光ディスク装置、フラッシュメモリなどの記憶装置でもよい。   In FIG. 15 showing hardware resources, the target system simulator includes a CPU 810 (Central Processing Unit) for executing a program. The CPU 810 is connected to a ROM (Read Only Memory) 811, a RAM (Random Access Memory) 812, a display device 813, a keyboard 814, a mouse 815, a communication board 816, a CDD 818, and a magnetic disk device 820 via a bus 825. Control hardware devices. Instead of the magnetic disk device 820, a storage device such as an optical disk device or a flash memory may be used.

RAM812は、揮発性メモリの一例である。ROM811、CDD818、磁気ディスク装置820等の記憶媒体は、不揮発性メモリの一例である。これらは、「記憶装置」あるいは記憶部、格納部、バッファの一例である。通信ボード816、キーボード814などは、入力部、入力装置の一例である。また、通信ボード816、表示装置813などは、出力部、出力装置の一例である。通信ボード816は、ネットワークに接続されている。   The RAM 812 is an example of a volatile memory. Storage media such as the ROM 811, the CDD 818, and the magnetic disk device 820 are examples of nonvolatile memories. These are examples of a “storage device” or a storage unit, a storage unit, and a buffer. The communication board 816, the keyboard 814, and the like are examples of an input unit and an input device. The communication board 816, the display device 813, and the like are examples of an output unit and an output device. The communication board 816 is connected to the network.

磁気ディスク装置820には、オペレーティングシステム821(OS)、ウィンドウシステム822、プログラム群823、ファイル群824が記憶されている。プログラム群823のプログラムは、CPU810、オペレーティングシステム821、ウィンドウシステム822により実行される。   The magnetic disk device 820 stores an operating system 821 (OS), a window system 822, a program group 823, and a file group 824. The programs in the program group 823 are executed by the CPU 810, the operating system 821, and the window system 822.

上記プログラム群823には、以上の実施の形態の説明において「〜部」として説明した機能を実行するプログラムが記憶されている。プログラムは、CPU810により読み出され実行される。   The program group 823 stores programs that execute the functions described as “˜units” in the description of the above embodiments. The program is read and executed by the CPU 810.

ファイル群824には、以上の実施の形態の説明において、「〜の判定結果」、「〜の算出結果」、「〜の抽出結果」、「〜の生成結果」、「〜の処理結果」として説明した情報や、データや信号値や変数値やパラメータなどが、「〜ファイル」や「〜データベース」の各項目として記憶されている。「〜ファイル」や「〜データベース」は、ディスクやメモリなどの記録媒体に記憶される。ディスクやメモリなどの記憶媒体に記憶された情報やデータや信号値や変数値やパラメータは、読み書き回路を介してCPU810によりメインメモリやキャッシュメモリに読み出され、抽出・検索・参照・比較・演算・計算・処理・出力・印刷・表示などのCPUの動作に用いられる。抽出・検索・参照・比較・演算・計算・処理・出力・印刷・表示のCPUの動作の間、情報やデータや信号値や変数値やパラメータは、メインメモリやキャッシュメモリやバッファメモリに一時的に記憶される。   In the description of the above embodiment, the file group 824 includes “to determination result”, “to calculation result”, “to extraction result”, “to generation result”, and “to processing result”. The described information, data, signal values, variable values, parameters, and the like are stored as items of “˜file” and “˜database”. The “˜file” and “˜database” are stored in a recording medium such as a disk or a memory. Information, data, signal values, variable values, and parameters stored in a storage medium such as a disk or memory are read out to the main memory or cache memory by the CPU 810 via a read / write circuit, and extracted, searched, referenced, compared, and calculated. Used for CPU operations such as calculation, processing, output, printing, and display. Information, data, signal values, variable values, and parameters are temporarily stored in the main memory, cache memory, and buffer memory during the CPU operations of extraction, search, reference, comparison, operation, calculation, processing, output, printing, and display. Is remembered.

また、以上に述べた実施の形態の説明において、データや信号値は、RAM812のメモリ、CDD818のコンパクトディスク、磁気ディスク装置820の磁気ディスク、その他光ディスク、ミニディスク、DVD(Digital・Versatile・Disk)等の記録媒体に記録される。また、データや信号は、バス825や信号線やケーブルその他の伝送媒体によりオンライン伝送される。   In the description of the embodiment described above, the data and signal values are the memory of the RAM 812, the compact disk of the CDD 818, the magnetic disk of the magnetic disk device 820, other optical disks, mini disks, and DVDs (Digital Versatile Disk). Or the like. Data and signals are transmitted on-line via the bus 825, signal lines, cables, and other transmission media.

また、以上の実施の形態の説明において、「〜部」として説明したものは、「〜手段」、であってもよく、また、「〜ステップ」、「〜手順」、「〜処理」であってもよい。すなわち、「〜部」として説明したものは、ソフトウェアのみ、或いは、ソフトウェアとハードウェアとの組み合わせ、さらには、ファームウェアとの組み合わせで実施されても構わない。ファームウェアとソフトウェアは、プログラムとして、磁気ディスク、フレキシブルディスク、光ディスク、コンパクトディスク、ミニディスク、DVD等の記録媒体に記憶される。プログラムはCPU810により読み出され、CPU810により実行される。すなわち、プログラムは、以上に述べた「〜部」としてコンピュータを機能させるものである。あるいは、以上に述べた「〜部」の手順や方法をコンピュータに実行させるものである。   In the above description of the embodiment, what has been described as “to part” may be “to means”, and “to step”, “to procedure”, and “to processing”. May be. That is, what has been described as “˜unit” may be implemented by software alone, a combination of software and hardware, or a combination of firmware. Firmware and software are stored as programs in a recording medium such as a magnetic disk, a flexible disk, an optical disk, a compact disk, a mini disk, and a DVD. The program is read by the CPU 810 and executed by the CPU 810. That is, the program causes the computer to function as the “˜unit” described above. Alternatively, the computer executes the procedure and method of “to part” described above.

以上の実施の形態では、シミュレーション装置としてのターゲットシステムシミュレータを説明したが、のターゲットシステムシミュレータはシミュレーションプログラムとしても把握できることは以上の説明から当然である。   In the above embodiment, the target system simulator as a simulation apparatus has been described. However, it is obvious from the above description that the target system simulator can also be grasped as a simulation program.

以上の実施の形態では以下を特徴とするシミュレーション装置を説明した。
(1)ターゲットシステムシミュレータ100は、ターゲットの組込み装置のハードウェア構成をソフトウェアで実現したもので、ターゲットの組込み装置用にコンパイル、リンクされたターゲットソフトウェア131のCPU命令コードを解釈し実行する命令セットシミュレータ部110と、ターゲットの組込み装置のハードウェア仕様に従って命令セットシミュレータ部110に対して割込みや入出力を仮想的に発生させるI/Oシミュレータ部120との組み合わせによって成り立っている。
(2)命令セットシミュレータ部110がターゲットソフトウェア131のCPU命令コードに従い操作する対象となるターゲットメモリ130とターゲットレジスタ140を備え、ターゲットソフトウェア131はターゲットメモリ130内にロードされている。
(3)I/Oシミュレータ部120の割込みや入出力をイベントとして一元管理するイベント管理部150と、イベントの発生タイミングを把握するためのシミュレーション時刻管理部160を備える。
(4)命令セットシミュレータ部110が実行中の命令コードがCPUアイドル処理に含まれるものか判別するアイドル処理判定部170と、CPUアイドル処理を検出した場合にシミュレーション時刻を強制的に進める時間補正部180を備える。
(5)ホストコンピュータのアプリケーションとしてターゲットシミュレータは実行される。
In the above embodiment, a simulation apparatus having the following features has been described.
(1) The target system simulator 100 implements the hardware configuration of the target embedded device in software, and an instruction set for interpreting and executing the CPU instruction code of the target software 131 compiled and linked for the target embedded device The simulator unit 110 includes a combination of the simulator unit 110 and an I / O simulator unit 120 that virtually generates an interrupt or an input / output to / from the instruction set simulator unit 110 according to the hardware specifications of the target embedded device.
(2) The instruction set simulator unit 110 includes a target memory 130 and a target register 140 to be operated according to the CPU instruction code of the target software 131, and the target software 131 is loaded in the target memory 130.
(3) An event management unit 150 that centrally manages interrupts and inputs / outputs of the I / O simulator unit 120 as events, and a simulation time management unit 160 for grasping the occurrence timing of events are provided.
(4) An idle process determination unit 170 that determines whether the instruction code being executed by the instruction set simulator unit 110 is included in the CPU idle process, and a time correction unit that forcibly advances the simulation time when the CPU idle process is detected 180.
(5) The target simulator is executed as an application of the host computer.

以上の実施の形態では以下を特徴とするシミュレーション装置を説明した。
(1)命令セットシミュレータ部110がジャンプ命令を実行した際に、アイドル処理判定部170を呼び出す。
(2)命令セットシミュレータ部110で実行しているターゲットソフトウェア131のCPU命令コードがCPUアイドル処理に含まれることをアイドル処理判定部170が検出した場合、時間補正部180によってイベント管理部150に登録されているイベントで最も早いタイミングで発生するものの発生時刻まで、シミュレーション時刻管理部160で管理しているシミュレーション時刻を強制的に進める。
In the above embodiment, a simulation apparatus having the following features has been described.
(1) When the instruction set simulator unit 110 executes a jump instruction, the idle process determination unit 170 is called.
(2) When the idle process determination unit 170 detects that the CPU instruction code of the target software 131 being executed by the instruction set simulator unit 110 is included in the CPU idle process, the time correction unit 180 registers it in the event management unit 150 The simulation time managed by the simulation time management unit 160 is forcibly advanced until the occurrence time of the event that occurs at the earliest timing.

以上の実施の形態では以下を特徴とするシミュレーション装置を説明した。
(1)シミュレーション時刻と実時間を合わせるためにターゲットシステムシミュレータ100の動作/停止状態を制御する実時間調整部190を備える。
In the above embodiment, a simulation apparatus having the following features has been described.
(1) A real-time adjustment unit 190 that controls the operation / stop state of the target system simulator 100 in order to match the simulation time with the real time is provided.

以上の実施の形態では以下を特徴とするシミュレーション装置を説明した。
シミュレーション時刻が実時間よりも進んでいる場合に、実時間調整部190によって進行している差分時間分だけターゲットシステムシミュレータ100の実行を停止させ、ホストコンピュータのCPUリソースを解放する。
In the above embodiment, a simulation apparatus having the following features has been described.
When the simulation time is ahead of the real time, the execution of the target system simulator 100 is stopped by the difference time progressed by the real time adjustment unit 190, and the CPU resources of the host computer are released.

100,100−2 ターゲットシステムシミュレータ、110 命令セットシミュレータ部、120 I/Oシミュレータ部、130 ターゲットメモリ、131 ターゲットソフトウェア、140 ターゲットレジスタ、150 イベント管理部、160 シミュレーション時刻管理部、170 アイドル処理判定部、180 時間補正部、190 時間調整部。   100, 100-2 Target system simulator, 110 Instruction set simulator section, 120 I / O simulator section, 130 Target memory, 131 Target software, 140 Target register, 150 Event management section, 160 Simulation time management section, 170 Idle processing determination section , 180 hours correction unit, 190 hours adjustment unit.

Claims (5)

ターゲットとなるソフトウェアをシミュレーションするシミュレーション装置において、
前記ソフトウェアの命令を実行する命令セットシミュレータ部と、
前記命令セットシミュレータ部による前記命令の実行に応じて進行させる時刻であって、実時間の進行による現実の時刻とは異なるシミュレーション時刻を進行させるシミュレーション時刻管理部と、
前記命令セットシミュレータ部の実行している前記命令がアイドル処理かどうかを判定するアイドル判定処理を実行するアイドル処理判定部と、
前記アイドル処理判定部によって、前記命令セットシミュレータ部の実行中の命令がアイドル処理と判定されると、前記シミュレーション時刻管理部の管理する前記シミュレーション時刻を前記アイドル処理の終了まで進行させる時間補正部と
を備えたことを特徴とするシミュレーション装置。
In a simulation device that simulates target software,
An instruction set simulator for executing instructions of the software;
A simulation time management unit for advancing a simulation time different from the actual time due to the progress of real time, according to the execution of the instruction by the instruction set simulator unit;
An idle process determination unit for executing an idle determination process for determining whether the instruction being executed by the instruction set simulator unit is an idle process;
A time correction unit that advances the simulation time managed by the simulation time management unit until the end of the idle processing when the idle processing determination unit determines that the instruction being executed by the instruction set simulator unit is idle processing; A simulation apparatus comprising:
前記シミュレーション装置は、さらに、
所定のイベントのシミュレーションの実行要求を通知する実行要求通知を受信すると、前記実行要求通知の通知する前記イベントのシミュレーションを実行し、前記イベントの前記シミュレーションの結果に応じて、前記命令セットシミュレータ部に割り込み要求を送信するイベントシミュレータ部と、
前記イベントシミュレータ部のシミュレーションするべき少なくとも一つのイベントであって、前記シミュレーション時刻を基準とする発生時刻を示すイベント発生時刻を持つイベントを管理すると共に、前記シミュレーション時刻管理部の管理する前記シミュレーション時刻を参照することにより前記イベントが前記発生時刻に達していると判断した場合には、前記発生時刻に達している前記イベントに関する前記実行要求通知を前記イベントシミュレータ部に通知するイベント管理部と
を備え、
前記時間補正部は、
前記アイドル処理判定部によって、前記命令セットシミュレータ部の実行中の命令がアイドル処理と判定されると、前記イベント管理部の管理する前記イベントのうち次に発生するべき前記イベントの前記発生時刻を参照し、次に発生するべき前記イベントの前記発生時刻まで前記シミュレーション時刻管理部の管理する前記シミュレーション時刻を進行させることを特徴とする請求項1記載のシミュレーション装置。
The simulation apparatus further includes:
Upon receiving an execution request notification for notifying the execution request for simulation of a predetermined event, the simulation of the event notified by the execution request notification is executed, and depending on the result of the simulation of the event, the instruction set simulator unit An event simulator that sends an interrupt request;
Managing at least one event to be simulated by the event simulator unit having an event occurrence time indicating an occurrence time based on the simulation time, and managing the simulation time managed by the simulation time management unit When it is determined that the event has reached the occurrence time by referring to, the event management unit that notifies the event simulator unit of the execution request notification related to the event that has reached the occurrence time,
The time correction unit is
When the idle process determination unit determines that the instruction being executed by the instruction set simulator unit is an idle process, the generation time of the event to be generated next among the events managed by the event management unit is referred to The simulation apparatus according to claim 1, wherein the simulation time managed by the simulation time management unit is advanced to the generation time of the event to be generated next.
前記命令セットシミュレータ部は、
ジャンプ命令を実行したときに、前記アイドル処理判定部を呼び出し、
前記アイドル処理判定部は、
前記命令セットシミュレータ部に呼び出されたときに、前記アイドル判定処理を実行することを特徴とする請求項1または2のいずれかに記載のシミュレーション装置。
The instruction set simulator unit is
When the jump instruction is executed, the idle process determination unit is called,
The idle process determination unit
The simulation apparatus according to claim 1, wherein the idle determination process is executed when called by the instruction set simulator unit.
前記シミュレーション装置は、さらに、
実時間の進行による現実の時刻を管理すると共に、前記シミュレーション時刻管理部が進行させる前記シミュレーション時刻が前記現実の時刻よりも進んでいる場合には、前記命令セットシミュレータ部による前記ソフトウェアの命令の実行を一時停止させて、前記シミュレーション時刻管理部によって管理される前記シミュレーション時刻を前記現実の時刻に合わせる実時間調整部を備えたことを特徴とする請求項1〜3のいずれかに記載のシミュレーション装置。
The simulation apparatus further includes:
When the simulation time managed by the simulation time management unit is advanced from the actual time, the software instruction is executed by the instruction set simulator unit. The simulation apparatus according to claim 1, further comprising: a real-time adjustment unit that temporarily stops the simulation and adjusts the simulation time managed by the simulation time management unit to the actual time. .
ターゲットとなるソフトウェアをシミュレーションするシミュレーションプログラムにおいて、
(1)前記ソフトウェアの命令を実行する処理と、
(2)前記命令の実行に応じて進行させる時刻であって、実時間の進行による現実の時刻とは異なるシミュレーション時刻を進行させる処理と、
(3)実行している前記命令がアイドル処理かどうかを判定する処理と、
(4)実行中の命令がアイドル処理と判定されると、前記シミュレーション時刻を前記アイドル処理の終了まで進行させる処理と、
をコンピュータに実行させるためのシミュレーションプログラム。
In a simulation program that simulates target software,
(1) processing for executing instructions of the software;
(2) a process of advancing a simulation time that is a time to be advanced in accordance with the execution of the instruction and is different from an actual time due to the progress of real time;
(3) a process of determining whether the instruction being executed is an idle process;
(4) When the instruction being executed is determined to be idle processing, processing to advance the simulation time until the end of the idle processing;
A simulation program for causing a computer to execute.
JP2010275797A 2010-12-10 2010-12-10 Simulation apparatus and simulation program Expired - Fee Related JP5542643B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010275797A JP5542643B2 (en) 2010-12-10 2010-12-10 Simulation apparatus and simulation program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010275797A JP5542643B2 (en) 2010-12-10 2010-12-10 Simulation apparatus and simulation program

Publications (2)

Publication Number Publication Date
JP2012123726A JP2012123726A (en) 2012-06-28
JP5542643B2 true JP5542643B2 (en) 2014-07-09

Family

ID=46505076

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010275797A Expired - Fee Related JP5542643B2 (en) 2010-12-10 2010-12-10 Simulation apparatus and simulation program

Country Status (1)

Country Link
JP (1) JP5542643B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108027748A (en) * 2015-07-23 2018-05-11 国立大学法人东京工业大学 Instruction set simulator and its simulator generation method
US20210240592A1 (en) * 2018-06-22 2021-08-05 Hitachi Automotive Systems, Ltd. Simulation device

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6676883B2 (en) * 2015-06-01 2020-04-08 株式会社Ihi Simulation equipment
CN115292102A (en) * 2022-05-20 2022-11-04 芯华章科技股份有限公司 Simulation method, electronic device, and readable storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07160537A (en) * 1993-12-03 1995-06-23 Matsushita Electric Ind Co Ltd Simulator
JP2000010813A (en) * 1998-06-25 2000-01-14 Hitachi Ltd Simulation test system
JP2001154881A (en) * 1999-12-01 2001-06-08 Yamatake Corp Simulation device and program recording medium to be used for the same device
JP2003186936A (en) * 2001-12-17 2003-07-04 Oki Data Corp Method and device for executing operation verification simulation and its program
JP5425445B2 (en) * 2008-11-07 2014-02-26 インターナショナル・ビジネス・マシーンズ・コーポレーション Processing control system, method and program

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108027748A (en) * 2015-07-23 2018-05-11 国立大学法人东京工业大学 Instruction set simulator and its simulator generation method
CN108027748B (en) * 2015-07-23 2019-09-10 国立大学法人东京工业大学 Instruction set simulator and its simulator generation method
US20210240592A1 (en) * 2018-06-22 2021-08-05 Hitachi Automotive Systems, Ltd. Simulation device

Also Published As

Publication number Publication date
JP2012123726A (en) 2012-06-28

Similar Documents

Publication Publication Date Title
US8484006B2 (en) Method for dynamically adjusting speed versus accuracy of computer platform simulation
US8793115B2 (en) Interface converter for unified view of multiple computer system simulations
JP4667206B2 (en) Multi-core model simulation program, recording medium storing the program, multi-core model simulator, and multi-core model simulation method
US20170161175A1 (en) Application development environment for portable electronic devices
JP5270330B2 (en) Multicore microcomputer system simulation method and simulation apparatus
US10552190B2 (en) Precise error injection for driver testing
CN1633644A (en) Operating system-independent method and system of determining CPU utilization
JP5542643B2 (en) Simulation apparatus and simulation program
WO2018149495A1 (en) A method and system to fetch multicore instruction traces from a virtual platform emulator to a performance simulation model
US9317636B1 (en) System and method for stopping integrated circuit simulation
US9880931B2 (en) Safepoints for guest languages on a virtual machine
AU2017438670B2 (en) Simulation device, simulation method, and simulation program
JP5354102B2 (en) Multi-core processor system, communication control method, and communication control program
JP6584655B2 (en) Graphics context scheduling based on flip-queue management
JP5440083B2 (en) Simulation apparatus, method and program
US8914274B1 (en) Method and system for instruction set simulation with concurrent attachment of multiple debuggers
WO2006093762A1 (en) Computer platform simulation
JP5425445B2 (en) Processing control system, method and program
JPH0934918A (en) Method and apparatus for simulation of digital circuit
JP2008112243A (en) Simulation program, and apparatus, method and program for generating the same
JP2002366378A (en) Method and device for debugging program and storage medium
JP2003256239A (en) Method and device for executing operation verification simulation, and its program
JP2001125805A (en) Software simulator
JPH1166037A (en) Simulator
JP2015144023A (en) Processor system, and control program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20130905

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20140326

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: 20140408

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140507

R150 Certificate of patent or registration of utility model

Ref document number: 5542643

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees