Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP5412900B2 - Embedded program simulator and simulation method - Google Patents
[go: Go Back, main page]

JP5412900B2 - Embedded program simulator and simulation method - Google Patents

Embedded program simulator and simulation method Download PDF

Info

Publication number
JP5412900B2
JP5412900B2 JP2009063203A JP2009063203A JP5412900B2 JP 5412900 B2 JP5412900 B2 JP 5412900B2 JP 2009063203 A JP2009063203 A JP 2009063203A JP 2009063203 A JP2009063203 A JP 2009063203A JP 5412900 B2 JP5412900 B2 JP 5412900B2
Authority
JP
Japan
Prior art keywords
instruction
peripheral device
target processor
simulator
conditional branch
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
JP2009063203A
Other languages
Japanese (ja)
Other versions
JP2010218143A (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.)
Ricoh Co Ltd
Original Assignee
Ricoh Co Ltd
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 Ricoh Co Ltd filed Critical Ricoh Co Ltd
Priority to JP2009063203A priority Critical patent/JP5412900B2/en
Publication of JP2010218143A publication Critical patent/JP2010218143A/en
Application granted granted Critical
Publication of JP5412900B2 publication Critical patent/JP5412900B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Description

本発明は、組み込み用プログラムのシミュレータ及びシミュレーション方法に関する。   The present invention relates to an embedded program simulator and simulation method.

組み込み用プログラムのデバッグを行う場合、ターゲットハードウェアシステムが未完成である間は、PC等のコンピュータ機器上において、対象プロセッサのシミュレータがしばしば用いられる。   When debugging an embedded program, a simulator of a target processor is often used on a computer device such as a PC while the target hardware system is incomplete.

組み込み用プログラムは、プロセッサとその周辺装置との間での入出力動作を通常含む。この周辺装置の動作をシミューションするには、例えば、周辺装置用のシミュレータを別途作成する、若しくは、対象プロセッサのシミュレータそのものにその振る舞いを予め規定するという仕組みを組み込んでおく、等のやり方がある。   The embedded program usually includes an input / output operation between the processor and its peripheral devices. In order to simulate the operation of the peripheral device, for example, a simulator for the peripheral device is separately created, or a mechanism for predefining the behavior in the simulator of the target processor is incorporated. is there.

しかしながら、これらの周辺装置用の振る舞いを予め規定するという仕組みを作成するには、相応の手間がかかる。そのような仕組みが無いならば、開発中のプログラムのデバッグ作業では、周辺装置との入出力に関する命令部分で一旦プログラムをブレークし、その上で様々な変数の値やプログラムカウンタの値を変更する必要がある。特に、周辺装置の状態を条件としてループして待つようなプログラムの場合には、このような変更を強制的に行わないと、プログラムが無限ループに陥り、プログラムが先に進むことができなくなる。   However, it takes considerable effort to create a mechanism for predefining the behavior for these peripheral devices. If there is no such mechanism, in debugging the program under development, the program is temporarily broken at the instruction part related to input / output with the peripheral device, and then the values of various variables and the program counter are changed. There is a need. In particular, in the case of a program that loops and waits on the condition of the peripheral device as a condition, if such a change is not forced, the program falls into an infinite loop and the program cannot proceed.

なお、周辺装置の動作を規定し、プログラムを実行することなくプロセッサの命令を解析することにより、条件分岐部分を検出する技術は、特許文献1及び2に開示されている。また、周辺装置の動作を規定し、プログラムのシミュレーションを実行する技術は、特許文献2に開示されている。いずれにおいても、周辺装置の動作を予め規定しておく必要があり、特許文献1及び2の技術では、プログラムが実行されないため、間接アドレッシングを用いて複数のソースファイルにまたがるようなプログラムでは、周辺装置との入出力の検出が見逃される可能性もある。   Patent Documents 1 and 2 disclose a technique for detecting a conditional branch portion by defining the operation of a peripheral device and analyzing a processor instruction without executing a program. A technique for defining the operation of a peripheral device and executing a program simulation is disclosed in Patent Document 2. In any case, it is necessary to preliminarily specify the operation of the peripheral device. In the techniques of Patent Documents 1 and 2, the program is not executed. Therefore, in a program that spans multiple source files using indirect addressing, Detection of input / output with the device may be missed.

本発明は、周辺装置の状態を待ち条件とするループ部分を自動的に検出し、プログラム上の周辺装置の状態をループを抜ける状態に設定して、開発プログラムを先に進めることができる組み込み用プログラムのシミュレータを提供することを目的とする。   The present invention automatically detects a loop portion having a peripheral device state as a waiting condition, sets the peripheral device state on the program to a state that exits the loop, and allows the development program to proceed. The purpose is to provide a simulator for the program.

本発明は、上記の目的を達成するために為されたものである。本発明に係る請求項1に記載のシミュレータは、
対象のプロセッサの動作を別のコンピュータ上でシミュレーションし、対象のプロセッサの命令により条件分岐部分を検出する、組み込み用プログラムのシミュレータにおいて、
対象のプロセッサに接続される周辺装置とのデータの入出力を行うときの周辺装置の状態を待ち条件として処理を進めるプログラミング部分を、シミュレーションする場合、対象のプロセッサの命令の組み合せと、その実効アドレスにより上記組み込み用プログラムにおける、周辺装置とのデータの入出力に関する待ち部分を検出する手段と、
上記周辺装置の状態を示す対象のプロセッサの内部レジスタ値を書き換える手段と
を有する。
The present invention has been made to achieve the above object. The simulator according to claim 1 according to the present invention includes:
In a simulator of an embedded program that simulates the operation of the target processor on another computer and detects a conditional branch portion by an instruction of the target processor.
When simulating the programming part that advances the processing based on the status of the peripheral device when inputting / outputting data with the peripheral device connected to the target processor, the combination of instructions of the target processor and its effective address Means for detecting a waiting portion related to data input / output with a peripheral device in the embedded program according to
Means for rewriting the internal register value of the target processor indicating the state of the peripheral device.

本発明に係る請求項2に記載のシミュレータは、
上記待ち部分を検出する手段が、
条件分岐命令とその分岐先アドレスの組み合わせと共に、対象とするプロセッサにより規定されるプログラム領域、データ領域、及び周辺装置領域のメモリ空間情報を元に、実効アドレスが周辺装置領域である入出力用命令が用いられていることを条件として検出する手段であることを特徴とする
請求項1に記載のシミュレータである。
The simulator according to claim 2 according to the present invention includes:
The means for detecting the waiting portion is
A combination of a conditional branch instruction and its branch destination address, and an input / output instruction whose effective address is the peripheral device area based on the memory space information of the program area, data area, and peripheral device area specified by the target processor The simulator according to claim 1, wherein the simulator is a means for detecting that is used as a condition.

本発明に係る請求項3に記載のシミュレータは、
上記待ち部分を検出する手段が、
対象とするプロセッサが周辺装置専用の入出力用命令を具備する場合、
条件分岐命令とその分岐先アドレスの組み合わせと共に、上記周辺装置専用の入出力用命令が用いられていることを条件として検出する手段であることを特徴とする
請求項1に記載のシミュレータである。
The simulator according to claim 3 according to the present invention,
The means for detecting the waiting portion is
If the target processor has a dedicated input / output instruction for the peripheral device,
2. The simulator according to claim 1, wherein said simulator is a means for detecting on condition that said peripheral input / output instruction is used together with a combination of a conditional branch instruction and its branch destination address.

本発明に係る請求項4に記載のシミュレーション方法は、
対象のプロセッサの動作を別のホストコンピュータ上でシミュレーションし、対象のプロセッサの命令により条件分岐部分を検出する、シミュレーション方法において、
対象のプロセッサに接続される周辺装置とのデータの入出力を行うときの周辺装置の状態を待ち条件として処理を進めるプログラミング部分を、シミュレーションする場合、対象のプロセッサの命令の組み合わせと、その実効アドレスにより、上記プログラミング部分に係る組み込み用プログラムにおける、周辺装置とのデータの入出力に関する待ち部分を検出するステップと、
上記周辺装置の状態を示す対象のプロセッサの内部レジスタ値を書き換えて、上記待ち部分を抜け出すステップと
を含む。
The simulation method according to claim 4 according to the present invention includes:
In the simulation method of simulating the operation of the target processor on another host computer, and detecting the conditional branch portion by the instruction of the target processor,
When simulating the programming part that advances the processing based on the status of the peripheral device when performing data input / output with the peripheral device connected to the target processor , the combination of the target processor 's instructions and its effective address A step of detecting a waiting portion related to input / output of data with a peripheral device in the embedded program related to the programming portion ;
Rewriting the internal register value of the target processor indicating the state of the peripheral device, and exiting the waiting portion.

本発明を利用することにより、組み込み用プログラムのシミュレータにおいて、周辺装置の状態を待ち条件とするループ部分を自動的に検出し、プログラム上の周辺装置の状態をループを抜ける状態に設定して、開発プログラムを先に進めることができる。   By utilizing the present invention, in the simulator for the embedded program, automatically detects the loop part having the peripheral device state as a waiting condition, and sets the state of the peripheral device on the program to a state out of the loop, The development program can be advanced.

本発明に係るシミュレータで開発する対象の組み込み用プログラムが実稼動するプロセッサにおけるメモリ空間の例である。It is an example of the memory space in the processor in which the installation program to be developed by the simulator according to the present invention actually operates. 本発明に係るシミュレータでシミュレーションされるプログラムの例(1)である。It is an example (1) of the program simulated with the simulator which concerns on this invention. 本発明に係るシミュレータでシミュレーションされるプログラムの例(2)である。It is an example (2) of the program simulated with the simulator which concerns on this invention. 本発明に係るシミュレータでシミュレーションされるプログラムの例(3)である。It is an example (3) of the program simulated with the simulator which concerns on this invention. 本発明に係るシミュレータでシミュレーションされるプログラムの例(4)である。It is an example (4) of the program simulated with the simulator which concerns on this invention. 本発明に係るシミュレータでシミュレーションされるプログラムの例(5)である。It is an example (5) of the program simulated with the simulator which concerns on this invention. 辺装置の状態によるループ部分を検出する本発明に係るシミュレータの動作を示すフローチャートである。It is a flowchart which shows operation | movement of the simulator based on this invention which detects the loop part by the state of a side apparatus. 図2から図6に示すプログラム内で記述している命令の動作内容を示す。The operation content of the instruction described in the program shown in FIGS.

以下、図面を参照して本発明に係る好適な実施形態を説明する。本発明は、組み込み用プログラムを開発するための、プロセッサのシミュレータに関するものであり、PC等のコンピュータ機器上で動作するものである。   DESCRIPTION OF EXEMPLARY EMBODIMENTS Hereinafter, preferred embodiments according to the invention will be described with reference to the drawings. The present invention relates to a processor simulator for developing an embedded program, and operates on a computer device such as a PC.

図1は、本発明に係るシミュレータで開発する対象の組み込み用プログラムが実稼動するプロセッサにおけるメモリ空間1の例である。全メモリ空間を64Kバイトとし、0h番地から1FFFh番地を周辺装置用領域2とし、2000h番地から7FFFh番地をデータRAM領域4とし、8000h番地からFFFFh番地をプログラム領域6とする(“h”は16進数であることを示す)。   FIG. 1 shows an example of a memory space 1 in a processor in which an embedded program to be developed by a simulator according to the present invention is actually operated. The total memory space is 64 Kbytes, addresses 0h to 1FFFh are the peripheral device area 2, 2000h to 7FFFh are the data RAM area 4, and 8000h to FFFFh are the program area 6 (“h” is 16). Indicates a decimal number).

このメモリ空間に従い、本発明に係るプロセッサ用シミュレータは、各命令のシミュレーションを行うとき、各命令の実効アドレスが、どの領域を対象としているかを判別することができる。なお、このプロセッサは、演算結果の状態を示すステータスレジスタを持つことを前提としている。このステータスレジスタには、演算結果が0であったとき“1”にセットされるゼロフラグ、負の数であったときに“1”にセットされるネガティブフラグなどが含まれる。   In accordance with this memory space, the processor simulator according to the present invention can determine which area the effective address of each instruction targets when simulating each instruction. This processor is premised on having a status register indicating the state of the operation result. This status register includes a zero flag that is set to “1” when the operation result is 0, a negative flag that is set to “1” when the result is a negative number, and the like.

図2から図6は、本発明に係るシミュレータでシミュレーションされるプログラムの例である。なお、図8はプログラム内で記述している命令の動作内容を示す。   2 to 6 are examples of programs that are simulated by the simulator according to the present invention. FIG. 8 shows the operation content of instructions described in the program.

図2に示すプログラム例は、周辺装置の状態を表すポートからその値をロードし、その値による条件分岐においてその条件を満たす場合は、それより前の番地に戻るものである。図3に示すプログラム例は、同様の条件分岐において、その条件を満たす場合は、後の番地に分岐するものである。図4に示すプログラム例は、同様に条件を満たす場合は後の番地に分岐するが、満たさない場合は更に条件分岐があり、その条件を満たす場合は、前に戻るものである。   The program example shown in FIG. 2 loads the value from the port representing the state of the peripheral device, and returns to the previous address when the condition is satisfied in the conditional branching based on the value. The program example shown in FIG. 3 branches to a later address if the same conditional branch satisfies the condition. The program example shown in FIG. 4 similarly branches to a subsequent address if the condition is satisfied, but there are further conditional branches if the condition is not satisfied, and returns to the previous if the condition is satisfied.

図5に示すプログラム例は、図2と略同様の内容であるが、周辺装置用アドレスが間接指定されていることが図2と異なる。図6に示すプログラム例は、図4とほぼ同様の内容であるが、最初の条件分岐の後に、無条件分岐があることが図4と異なる。   The program example shown in FIG. 5 has substantially the same contents as those in FIG. 2, except that the peripheral device address is indirectly specified. The program example shown in FIG. 6 has almost the same contents as those in FIG. 4, but differs from FIG. 4 in that there is an unconditional branch after the first conditional branch.

まず、図2に示すプログラム例にて、本発明に係るシミュレータの動作を説明する。図2において、(a)の条件分岐命令は、条件成立の場合それより前に戻るものである。その条件分岐で参照するフラグ条件を操作した命令を遡って検索すると、一つ手前のand命令であったことがわかる。このand命令で比較する対象のレジスタは、g0レジスタである。さらに遡ってこのg0レジスタにデータがロードされるのは、その一つ前のld命令であることがわかる。しかもこのld命令の実効アドレスは、周辺装置用領域のものであることがわかる。つまり、上記の条件分岐命令は、周辺装置の状態を条件としていることがわかり、しかもその分岐先が、上記で検索した命令群を再度実行するようなより前の番地であることから、この一連のブロック部分は、条件分岐が成立したままであると、無限ループに陥ることが判明する。   First, the operation of the simulator according to the present invention will be described with reference to the program example shown in FIG. In FIG. 2, the conditional branch instruction (a) returns before the condition is satisfied. If the instruction that manipulated the flag condition to be referred to in the conditional branch is retrieved retroactively, it can be seen that the instruction is the previous and instruction. The register to be compared by this and instruction is the g0 register. Further, it can be seen that data is loaded back into the g0 register in the previous ld instruction. In addition, it can be seen that the effective address of the ld instruction is in the peripheral device area. In other words, it can be seen that the above conditional branch instruction is conditional on the state of the peripheral device, and the branch destination is an address before the instruction group searched above is executed again. If the conditional branch remains established, the block portion of is found to fall into an infinite loop.

このとき本発明に係るシミュレータは、and命令で対象としているg0の値を変化させて、条件が成立せずループを抜けるような値に設定する。図2の例の場合には、g0を例えば10hに設定すればよい。   At this time, the simulator according to the present invention changes the value of g0 targeted by the and instruction, and sets the value so that the condition is not satisfied and the loop is exited. In the example of FIG. 2, g0 may be set to 10h, for example.

もし、条件分岐先アドレスまで遡っても、周辺装置領域からのデータのロードが検出されない場合は、そこで検出作業は終わる。つまり、この条件分岐は、周辺装置の状態を条件としているものではないので、本発明に係るシミュレータはレジスタ値の操作は行わない。   If data loading from the peripheral device area is not detected even after going back to the conditional branch destination address, the detection operation ends there. That is, since this conditional branch is not based on the state of the peripheral device, the simulator according to the present invention does not manipulate the register value.

図5に示すプログラム例では、g0レジスタへのデータロードがg3レジスタによる間接アドレスであるが、その実効アドレスから、上記図2の例のための手法により、周辺装置領域からのデータロードであることが判明する。図5のように一つのソースファイル内でg3レジスタへのアドレス設定が行われる場合には、シミュレータによる実行を行わなくともソースファイルを解析する従来技術だけで、上記の判明は可能ではある。しかしながら、例えば別のソースファイルでg3レジスタへのアドレス設定が行われる場合などには、ソースファイルを解析する従来技術だけでは上記判明は不可能である。これに対して、本発明に係るシミュレータは、上記図2の例のための手法により、別のソースファイルでg3レジスタへのアドレス設定が行われる場合でも、判明が可能である。   In the example of the program shown in FIG. 5, the data load to the g0 register is an indirect address by the g3 register, but from the effective address, the data load from the peripheral device area is performed by the method for the example of FIG. Becomes clear. When the address is set to the g3 register in one source file as shown in FIG. 5, the above-described finding is possible only by the conventional technique for analyzing the source file without executing by the simulator. However, for example, when an address is set to the g3 register in another source file, the above-described determination is impossible only by the conventional technique for analyzing the source file. On the other hand, the simulator according to the present invention can be identified by the method for the example of FIG. 2 even when the address setting to the g3 register is performed by another source file.

図3に示すプログラム例では、(b)の条件分岐命令の分岐先アドレスが後方にあり、その分岐先アドレスまでの間に、条件分岐命令も無条件分岐命令も無いので、(b)の命令と分岐先アドレスの間が無限ループとなることはない。従って、図3に示すプログラム例では、本発明に係るシミュレータがレジスタ値の操作を行う必要はない。   In the example of the program shown in FIG. 3, since the branch destination address of the conditional branch instruction (b) is behind and there is neither a conditional branch instruction nor an unconditional branch instruction until the branch destination address, the instruction (b) And the branch destination address do not become an infinite loop. Therefore, in the program example shown in FIG. 3, it is not necessary for the simulator according to the present invention to operate the register value.

しかしながら、図4に示すプログラム例のように、(c)の条件分岐命令の分岐先アドレスが後方にあるものの、その分岐先アドレスまでの間に(d)のような前方のアドレスに戻る条件分岐命令が存在する場合、図2に示すプログラム例と同様に、(d)の条件によっては、無限ループに陥る可能性があることになる。この場合は、図2とは逆に(c)の条件分岐命令の条件が成立するようにg0レジスタの値を変化させて(d)の条件分岐部分に進まないようにする。ここでは、例えばg0レジスタの値を0hにすればよい。   However, as in the example of the program shown in FIG. 4, although the branch destination address of the conditional branch instruction in (c) is behind, the conditional branch that returns to the front address as in (d) until that branch destination address. When there is an instruction, there is a possibility of falling into an infinite loop depending on the condition (d) as in the example of the program shown in FIG. In this case, contrary to FIG. 2, the value of the g0 register is changed so that the condition of the conditional branch instruction of (c) is satisfied, so that it does not proceed to the conditional branch part of (d). Here, for example, the value of the g0 register may be set to 0h.

さらに、図6に示すプログラム例のように、(f)の条件分岐命令の分岐先アドレスが後方にあるものの、その分岐先アドレスまでの間に(g)のような無条件分岐命令が存在し、それが(f)より前方のアドレスに戻るものである場合、図4に示すプログラム例と同様に、(f)の条件が成立するようにg0レジスタの値を変化させる。ここでも、例えばg0レジスタの値を0hにすればよい。   Further, as in the example of the program shown in FIG. 6, although the branch destination address of the conditional branch instruction (f) is behind, there is an unconditional branch instruction as shown in (g) between the branch destination addresses. If it returns to an address ahead of (f), the value of the g0 register is changed so that the condition of (f) is satisfied, as in the example of the program shown in FIG. Here, for example, the value of the g0 register may be set to 0h.

以上のように、本発明に係るシミュレータは、条件分岐命令を検出したときに、分岐先がそれより前方のアドレスであり、かつその前方アドレスから条件分岐命令の間で、周辺装置領域からのロード値を元に条件判定を行っているのであれば、その前方アドレスから条件分岐命令の間のブロック部分は、周辺装置の状態を待つループ部分であることを判別する。ここで本発明に係るシミュレータは、上記ループ部分が無限ループに陥らないように、条件分岐命令で対象となるレジスタ値を条件非成立になるように強制的に変更し、ループを抜け出し、対象となるプログラムのデバッグを進めるようにする。   As described above, the simulator according to the present invention, when a conditional branch instruction is detected, the branch destination is an address ahead of it, and the load from the peripheral device area between the front branch address and the conditional branch instruction. If the condition is determined based on the value, it is determined that the block portion between the front address and the conditional branch instruction is a loop portion waiting for the state of the peripheral device. Here, the simulator according to the present invention forcibly changes the target register value by the conditional branch instruction so that the condition does not hold so that the loop portion does not fall into an infinite loop, exits the loop, Proceed with debugging the program.

また、本発明に係るシミュレータは、条件分岐命令を検出したとき、分岐先がそれより後方のアドレスであり、その条件分岐命令からその後方アドレスまでの間に、前方のアドレスへ戻る無条件分岐命令、若しくは条件分岐命令があり、かつその前方アドレスから無条件分岐命令若しくは条件分岐命令の間で、最初の条件分岐命令が、周辺装置領域からのロード値を元に条件判定を行っているのであれば、上記の前方アドレスから無条件分岐命令若しくは条件分岐命令の間のブロック部分は、周辺装置の状態を待つループ部分であることを判別する。ここで本発明に係るシミュレータは、上記ループ部分が無限ループに陥らないように、最初の条件分岐命令で対象となるレジスタ値を条件成立になるように強制的に変更して、ループを抜け出し、対象となるプログラムのデバッグを進めるようにする。   Further, the simulator according to the present invention, when detecting a conditional branch instruction, the branch destination is an address behind it, and an unconditional branch instruction that returns to the front address between the conditional branch instruction and the backward address Or, there is a conditional branch instruction, and the first conditional branch instruction makes a conditional judgment based on the load value from the peripheral device area between the unconditional branch instruction or the conditional branch instruction from the front address. For example, it is determined that the block portion between the above-described forward address and the unconditional branch instruction or the conditional branch instruction is a loop portion that waits for the state of the peripheral device. Here, the simulator according to the present invention forcibly changes the register value that is the target in the first conditional branch instruction so that the loop part does not fall into an infinite loop, and exits the loop, Proceed with debugging the target program.

図7は、周辺装置の状態によるループ部分を検出する本発明に係るシミュレータの動作を示すフローチャートである。   FIG. 7 is a flowchart showing the operation of the simulator according to the present invention for detecting a loop portion according to the state of the peripheral device.

まず、命令を取得する(S04)。条件分岐命令でなければ(S06・NO)次の命令を取得する。条件分岐命令であれば(S06・YES)、分岐先は前方か後方か判断する(S08)。分岐先が前方であればS10に進み、分岐先が後方であれば、S20に進む。   First, an instruction is acquired (S04). If it is not a conditional branch instruction (NO in S06), the next instruction is acquired. If it is a conditional branch instruction (S06: YES), it is determined whether the branch destination is forward or backward (S08). If the branch destination is forward, the process proceeds to S10, and if the branch destination is backward, the process proceeds to S20.

まず、分岐先が前方である場合を説明する。分岐先が前方であれば、一つ前の命令を取得する(S10)。この命令が条件分岐命令で使用するフラグの変更命令であるか否か、判断する(S12)。条件分岐命令で使用するフラグの変更命令であれば(S12・YES)、S14に進む。条件分岐命令で使用するフラグの変更命令でなければ(S12・NO)、更に一つ前の命令を取得する。一つ前の命令の取得を繰り返して分岐先アドレスの前まで戻ってしまったら、このブロックでは無限ループは生じないから、フローの“A”に戻り、次の命令の取得を行う。   First, the case where the branch destination is ahead will be described. If the branch destination is ahead, the previous instruction is acquired (S10). It is determined whether this instruction is a change instruction of a flag used in the conditional branch instruction (S12). If it is a change instruction of the flag used in the conditional branch instruction (S12, YES), the process proceeds to S14. If it is not a change instruction for the flag used in the conditional branch instruction (NO in S12), the previous instruction is acquired. If the acquisition of the previous instruction is repeated and the process returns to the position before the branch destination address, an infinite loop does not occur in this block, so the process returns to “A” in the flow to acquire the next instruction.

S14では、更に一つ前の命令を取得し、この命令が周辺機器からのデータリードに関するものであるか否か、判断する(S16)。周辺機器からのデータリードに関するものであれば(S16・YES)、S18に進む。周辺機器からのデータリードに関するものでなければ(S16・NO)、更に一つ前の命令を取得する。一つ前の命令の取得を繰り返して分岐先アドレスの前まで戻ってしまったら、このブロックでは無限ループは生じないから、フローの“A”に戻り、次の命令の取得を行う。   In S14, a previous command is acquired, and it is determined whether this command is related to data reading from the peripheral device (S16). If it is related to data reading from the peripheral device (YES at S16), the process proceeds to S18. If it is not related to data reading from the peripheral device (NO in S16), the previous command is acquired. If the acquisition of the previous instruction is repeated and the process returns to the position before the branch destination address, an infinite loop does not occur in this block, so the process returns to “A” in the flow to acquire the next instruction.

S18では、条件分岐命令で使用するフラグのレジスタ値を、条件分岐が非成立になるように書換える。その後、S04に進み、命令の取得を続ける。   In S18, the register value of the flag used in the conditional branch instruction is rewritten so that the conditional branch is not established. Thereafter, the process proceeds to S04, and the instruction acquisition is continued.

次に、分岐先が後方である場合を説明する。分岐先が後方であれば、次の命令を取得する(S20)。この命令が条件分岐命令若しくは無条件分岐命令であり、且つ、最初の条件分岐命令の前方のアドレスに分岐するか否か、判断する(S22)。『この命令が条件分岐命令若しくは無条件分岐命令であり、且つ、最初の条件分岐命令の前方のアドレスに分岐する』のであれば(S22・YES)、S24に進む。『この命令が条件分岐命令若しくは無条件分岐命令であり、且つ、最初の条件分岐命令の前方のアドレスに分岐する』のでなければ(S22・NO)、更に次の命令を取得する。次の命令の取得を繰り返して分岐先アドレスの前まで進んでしまったら、このブロックでは無限ループは生じないから、フローの“A”に戻り、次の命令の取得を行う。   Next, a case where the branch destination is backward will be described. If the branch destination is backward, the next instruction is acquired (S20). It is determined whether this instruction is a conditional branch instruction or an unconditional branch instruction, and whether or not to branch to an address ahead of the first conditional branch instruction (S22). If “this instruction is a conditional branch instruction or an unconditional branch instruction and branches to an address ahead of the first conditional branch instruction” (YES at S22), the process proceeds to S24. If “this instruction is a conditional branch instruction or an unconditional branch instruction and branches to an address ahead of the first conditional branch instruction” (S22 / NO), the next instruction is further acquired. If the acquisition of the next instruction is repeated until the branch destination address is reached, an infinite loop does not occur in this block, so the flow returns to “A” in the flow to acquire the next instruction.

S24では、最初の条件分岐命令を基準として、一つ前の命令を取得する(S24)。この命令が条件分岐命令で使用するフラグの変更命令であるか否か、判断する(S26)。条件分岐命令で使用するフラグの変更命令であれば(S26・YES)、S28に進む。条件分岐命令で使用するフラグの変更命令でなければ(S26・NO)、更に一つ前の命令を取得する。一つ前の命令の取得を繰り返して分岐先アドレスの前まで戻ってしまったら、このブロックでは無限ループは生じないから、フローの“A”に戻り、次の命令の取得を行う。   In S24, the previous instruction is acquired based on the first conditional branch instruction (S24). It is determined whether this instruction is a change instruction of a flag used in the conditional branch instruction (S26). If it is a change instruction of a flag used in the conditional branch instruction (S26 / YES), the process proceeds to S28. If it is not a change instruction of the flag used in the conditional branch instruction (NO in S26), the previous instruction is acquired. If the acquisition of the previous instruction is repeated and the process returns to the position before the branch destination address, an infinite loop does not occur in this block, so the process returns to “A” in the flow to acquire the next instruction.

S28では、更に一つ前の命令を取得し、この命令が周辺機器からのデータリードに関するものであるか否か、判断する(S30)。周辺機器からのデータリードに関するものであれば(S30・YES)、S32に進む。周辺機器からのデータリードに関するものでなければ(S30・NO)、更に一つ前の命令を取得する。一つ前の命令の取得を繰り返して分岐先アドレスの前まで戻ってしまったら、このブロックでは無限ループは生じないから、フローの“A”に戻り、次の命令の取得を行う。   In S28, the previous command is acquired, and it is determined whether this command is related to data reading from the peripheral device (S30). If it is related to data reading from the peripheral device (S30, YES), the process proceeds to S32. If it is not related to data reading from the peripheral device (S30, NO), the previous command is acquired. If the acquisition of the previous instruction is repeated and the process returns to the position before the branch destination address, an infinite loop does not occur in this block, so the process returns to “A” in the flow to acquire the next instruction.

S32では、条件分岐命令で使用するフラグのレジスタ値を、条件分岐が非成立になるように書換える。その後、S04に進み、命令の取得を続ける。   In S32, the register value of the flag used in the conditional branch instruction is rewritten so that the conditional branch is not established. Thereafter, the process proceeds to S04, and the instruction acquisition is continued.

S04にて、最後まで命令を取得し終わったら、処理の全体が終了する。   When the instruction has been acquired to the end in S04, the entire process is completed.

以上、説明した本発明に係るシミュレータは、上述の内容に限定されるものではない。例えば、判別したループ部分において、一度もループを実行せずに抜けるのではなく、任意の回数分ループを実行するように該当のレジスタ値を設定し、その後にそのレジスタ値を変更してループを抜け出すようにしてもよい。このような設定は、プログラム実行のタイミングの調整に利用することができる。   The simulator according to the present invention described above is not limited to the above-described content. For example, in the determined loop part, the corresponding register value is set so as to execute the loop for an arbitrary number of times, rather than exiting without executing the loop, and then the register value is changed to change the loop. You may make it escape. Such a setting can be used for adjusting the timing of program execution.

また、対象のプロセッサが周辺装置専用の入出力命令を持つものであるならば、上述の実効アドレスではなく、命令そのものを利用して、ループ部分を検出してループ部分の実行を制御できることになる。   Further, if the target processor has an input / output instruction dedicated to the peripheral device, it is possible to detect the loop part and control the execution of the loop part using the instruction itself instead of the effective address described above. .

1・・・メモリ空間、2・・・周辺装置用領域、4・・・データRAM領域、6・・・プログラム領域。 DESCRIPTION OF SYMBOLS 1 ... Memory space, 2 ... Peripheral device area | region, 4 ... Data RAM area | region, 6 ... Program area | region.

特公平8−20972号公報Japanese Patent Publication No. 8-20972 特公平8−20973号公報Japanese Patent Publication No. 8-20973 特開2004−94800号公報JP 2004-94800 A

Claims (4)

対象のプロセッサの動作を別のコンピュータ上でシミュレーションし、対象のプロセッサの命令により条件分岐部分を検出する、組み込み用プログラムのシミュレータにおいて、
対象のプロセッサに接続される周辺装置とのデータの入出力を行うときの周辺装置の状態を待ち条件として処理を進めるプログラミング部分を、シミュレーションする場合、対象のプロセッサの命令の組み合せと、その実効アドレスにより、上記組み込み用プログラムにおける、周辺装置とのデータの入出力に関する待ち部分を検出する手段と、
上記周辺装置の状態を示す対象のプロセッサの内部レジスタ値を書き換えて、上記待ち部分を抜け出す手段と
を有することを特徴とするシミュレータ。
In a simulator of an embedded program that simulates the operation of the target processor on another computer and detects a conditional branch portion by an instruction of the target processor.
When simulating the programming part that advances the processing based on the status of the peripheral device when inputting / outputting data with the peripheral device connected to the target processor, the combination of instructions of the target processor and its effective address Means for detecting a waiting portion related to data input / output with a peripheral device in the embedded program;
A simulator comprising means for rewriting an internal register value of a target processor indicating the state of the peripheral device and exiting the waiting portion.
上記待ち部分を検出する手段が、
条件分岐命令とその分岐先アドレスの組み合わせと共に、対象とするプロセッサにより規定されるプログラム領域、データ領域、及び周辺装置領域のメモリ空間情報を元に、実効アドレスが周辺装置領域である入出力用命令が用いられていることを条件として検出する手段であることを特徴とする
請求項1に記載のシミュレータ。
The means for detecting the waiting portion is
A combination of a conditional branch instruction and its branch destination address, and an input / output instruction whose effective address is the peripheral device area based on the memory space information of the program area, data area, and peripheral device area specified by the target processor The simulator according to claim 1, wherein the simulator is a means for detecting that is used as a condition.
上記待ち部分を検出する手段が、
対象とするプロセッサが周辺装置専用の入出力用命令を具備する場合、
条件分岐命令とその分岐先アドレスの組み合わせと共に、上記周辺装置専用の入出力用命令が用いられていることを条件として検出する手段であることを特徴とする
請求項1に記載のシミュレータ。
The means for detecting the waiting portion is
If the target processor has a dedicated input / output instruction for the peripheral device,
2. The simulator according to claim 1, wherein said simulator is a means for detecting on condition that said peripheral input / output instruction is used together with a combination of a conditional branch instruction and its branch destination address.
対象のプロセッサの動作を別のホストコンピュータ上でシミュレーションし、対象のプロセッサの命令により条件分岐部分を検出する、シミュレーション方法において、
対象のプロセッサに接続される周辺装置とのデータの入出力を行うときの周辺装置の状態を待ち条件として処理を進めるプログラミング部分を、シミュレーションする場合、対象のプロセッサの命令の組み合わせと、その実効アドレスにより、上記プログラミング部分に係る組み込み用プログラムにおける、周辺装置とのデータの入出力に関する待ち部分を検出するステップと、
上記周辺装置の状態を示す対象のプロセッサの内部レジスタ値を書き換えて、上記待ち部分を抜け出すステップと
を含むことを特徴とするシミュレーション方法。
In the simulation method of simulating the operation of the target processor on another host computer, and detecting the conditional branch portion by the instruction of the target processor,
When simulating the programming part that advances the processing based on the status of the peripheral device when performing data input / output with the peripheral device connected to the target processor , the combination of the target processor 's instructions and its effective address A step of detecting a waiting portion related to input / output of data with a peripheral device in the embedded program related to the programming portion ;
And rewriting the internal register value of the target processor indicating the state of the peripheral device to exit the waiting portion.
JP2009063203A 2009-03-16 2009-03-16 Embedded program simulator and simulation method Expired - Fee Related JP5412900B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009063203A JP5412900B2 (en) 2009-03-16 2009-03-16 Embedded program simulator and simulation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009063203A JP5412900B2 (en) 2009-03-16 2009-03-16 Embedded program simulator and simulation method

Publications (2)

Publication Number Publication Date
JP2010218143A JP2010218143A (en) 2010-09-30
JP5412900B2 true JP5412900B2 (en) 2014-02-12

Family

ID=42976942

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009063203A Expired - Fee Related JP5412900B2 (en) 2009-03-16 2009-03-16 Embedded program simulator and simulation method

Country Status (1)

Country Link
JP (1) JP5412900B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5723675B2 (en) * 2011-05-30 2015-05-27 株式会社 日立産業制御ソリューションズ Simulation apparatus and simulation method
CN116302332A (en) * 2023-02-27 2023-06-23 蔚来软件科技(上海)有限公司 Simulator processing method, device, computer equipment, storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS61239345A (en) * 1985-04-16 1986-10-24 Hitachi Electronics Eng Co Ltd I/o simulator
JPH064298A (en) * 1992-06-18 1994-01-14 Hitachi Ltd Program development environment construction system
JP3362972B2 (en) * 1994-08-30 2003-01-07 松下電器産業株式会社 Software simulator
JP2003186936A (en) * 2001-12-17 2003-07-04 Oki Data Corp Method for executing operation verification simulation, simulation execution device, and program

Also Published As

Publication number Publication date
JP2010218143A (en) 2010-09-30

Similar Documents

Publication Publication Date Title
US8726255B2 (en) Recompiling with generic to specific replacement
US11216258B2 (en) Direct function call substitution using preprocessor
US20120159461A1 (en) Program optimizing apparatus, program optimizing method, and program optimizing article of manufacture
CN102063286B (en) Program flow controls
KR20080093108A (en) Program parallel execution system and method
JP2003131902A (en) Software debugger, system level debugger, debugging method, and debugging program
KR20180137521A (en) Apparatus and method for address conflict management in performing vector operations
KR100316710B1 (en) Method and Apparatus for Instruction issuing in Out-of-Order for Parallel Processor
US11989537B2 (en) Dataflow-based computer program visualization and refactoring
Fog Optimizing software in C++
JP5412900B2 (en) Embedded program simulator and simulation method
US20070234307A1 (en) Methods and apparatus to inline conditional software instrumentation
KR101826828B1 (en) System and method for managing log data
US20110320784A1 (en) Verification of processor architectures allowing for self modifying code
KR20160098794A (en) Apparatus and method for skeleton code generation based on device program structure modeling
CN120104189A (en) Instruction generation method, electronic device and storage medium
US11301252B2 (en) Executing mutually exclusive vector instructions according to a vector predicate instruction
KR101700405B1 (en) Register, processor and method for controlling processor
JP4952317B2 (en) Saved data discrimination method, saved data discrimination program, and saved data discrimination device
JP5161022B2 (en) Analysis apparatus, analysis method, and analysis program
JP6548848B2 (en) INFORMATION PROCESSING APPARATUS, INFORMATION PROCESSING METHOD, AND INFORMATION PROCESSING PROGRAM
RU2818498C1 (en) Method of distributing data on multifunctional processor units with very long command line
JP7333889B2 (en) Software design support system, software design support method and software design support program
US9830174B2 (en) Dynamic host code generation from architecture description for fast simulation
Pearce Anti-Reverse-Engineering: Malware Analysis Day 6 [Slides]

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120228

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120621

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130424

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130514

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130712

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130730

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130925

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20131028

R151 Written notification of patent or utility model registration

Ref document number: 5412900

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

LAPS Cancellation because of no payment of annual fees