JP2005209172A - Semiconductor integrated circuit, development support device and execution history restoration method - Google Patents
Semiconductor integrated circuit, development support device and execution history restoration method Download PDFInfo
- Publication number
- JP2005209172A JP2005209172A JP2004369944A JP2004369944A JP2005209172A JP 2005209172 A JP2005209172 A JP 2005209172A JP 2004369944 A JP2004369944 A JP 2004369944A JP 2004369944 A JP2004369944 A JP 2004369944A JP 2005209172 A JP2005209172 A JP 2005209172A
- Authority
- JP
- Japan
- Prior art keywords
- trace
- address
- destination address
- instruction
- execution
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
- Microcomputers (AREA)
Abstract
Description
本発明は、半導体集積回路、開発支援装置及び実行履歴復元方法に関し、特に、プログラム実行に係るトレース情報を出力する「トレース情報出力機能」を有するプロセッサ、及びプロセッサから出力されたトレース情報に基づいてプロセッサによるプログラム実行履歴を復元する開発支援装置及びその方法に関するものである。 The present invention relates to a semiconductor integrated circuit, a development support apparatus, and an execution history restoration method, and in particular, based on a processor having a “trace information output function” for outputting trace information related to program execution, and trace information output from the processor. The present invention relates to a development support apparatus and method for restoring a program execution history by a processor.
「トレース情報出力機能」は、プロセッサのプログラム実行状態を、外部のホストコンピュータ上で動作しているデバッガに出力する機能である。システムが何らかの異常動作を検出した場合に、蓄積されたトレース情報を用いることによって、その時点から遡った実行履歴をシステム開発者が確認し、その原因を特定できるようにする。 The “trace information output function” is a function for outputting the program execution state of the processor to a debugger operating on an external host computer. When the system detects any abnormal operation, the accumulated trace information is used so that the system developer can confirm the execution history going back from that point and identify the cause.
ところが、上記のような開発支援を行うには、プロセッサにトレース情報の出力を行なうためのピンを設けなければならず、その本数や動作周波数(トレース情報出力のバンド幅)が制限される。また、トレース情報を蓄積するメモリ容量にも限界がある。そのため、限られたバンド幅やメモリ容量で最大限にその効果を発揮するためには、トレース情報の圧縮が必要となる。 However, in order to support development as described above, a pin for outputting trace information must be provided in the processor, and the number and operating frequency (bandwidth of trace information output) are limited. There is also a limit to the memory capacity for storing trace information. Therefore, in order to maximize the effect with a limited bandwidth and memory capacity, it is necessary to compress the trace information.
トレース情報の圧縮手法の一例として、従来、いわゆる「分岐トレース」と呼ばれるトレース情報取得手法が知られている(例えば、特許文献1及び非特許文献1参照)。この手法によると、分岐発生ごとに分岐先アドレスをチップ外部に出力する機構を設け、出力された分岐先アドレスに基づいて実行履歴が復元される。さらに、出力されたトレース情報を元にソースプログラムを解析することにより、必ずしも全ての分岐先アドレスがなくても実行履歴が復元され得ることが示唆されている。例えば、ソースプログラムに明示的に分岐先アドレスが記述されている直接分岐の場合には、分岐先アドレスが出力されなくともソースプログラムから実行履歴を復元することができる。一方、ソースプログラムに分岐先アドレスが明示的に記述されておらず、実行時にそれが決定するような間接分岐の場合には、分岐先アドレスの出力が必要である。また、間接分岐の中でも、関数コール命令に対するリターン命令の実行時には、コールとリターンとの関係がトレース情報から追跡できれば、分岐先アドレスが出力されなくてもよい。
As an example of a method for compressing trace information, conventionally, a so-called “branch trace” trace information acquisition method is known (see, for example,
以下、これら示唆するところを実現するハードウェアと実行履歴復元ソフトウェアを従来例として挙げ、図面を参照しながら説明する。図46は、従来のトレース情報出力機能を有する半導体集積回路の構成を示す。トレースパケット制御部200は、CPU100からの命令完了信号(EOI)101、直接分岐命令実行信号(JMPDIR)102、間接分岐命令実行信号(JMPIND)103、リターン命令実行信号(RET)106、及び条件分岐命令実行時の条件成立信号(JMPTKN)104を受け、図47に示した状態デコード表に従ってデコードを行い、トレース状態符号204及び分岐先アドレスのシフトレジスタ700への分岐先アドレスロードイネーブル信号(TPCLD)201を生成する。なお、トレース状態ポート(PCST)901に出力される符号204のコード及び意味は次に示す通りである。
符号/コード/意味
SEQ "000" シーケンシャルな命令実行
STL "010" CPUがストールしている状態
NPC "101" 分岐先アドレス出力を伴わない分岐命令実行
JMP "100" 分岐先アドレス出力を伴う分岐命令実行
EXP "110" 割込み分岐実行(分岐先アドレス出力を伴う)
図47の状態デコード表に示したように、リターン命令以外の間接分岐命令が実行されたときにのみ、CPU100から出力された分岐先アドレス110がシフトレジスタ700にロードされ、シフト出力が開始される。これ以外の分岐命令が実行された場合には、符号204として"NPC"が出力され、分岐先アドレス出力ポート(TPC)902からは有意なデータは出力されない。
Hereinafter, hardware that realizes these suggestions and execution history restoration software will be described as conventional examples and described with reference to the drawings. FIG. 46 shows a configuration of a conventional semiconductor integrated circuit having a trace information output function. The trace
Sign / Code / Meaning
SEQ "000" Sequential instruction execution
STL "010" CPU is stalled
NPC "101" Branch instruction execution without branch destination address output
JMP "100" Branch instruction execution with branch destination address output
EXP "110" Interrupt branch execution (with branch destination address output)
As shown in the state decode table of FIG. 47, only when an indirect branch instruction other than the return instruction is executed, the
一方、図48は、開発支援装置の構成を示す。開発支援装置は、トレース情報蓄積装置2及びホストコンピュータ3からなる。トレース情報蓄積装置2は、半導体集積回路(プロセッサ)1からのトレース状態信号911及び分岐先アドレス信号912を受け、トレース情報としてトレースメモリ1030に蓄積する。ホストコンピュータ3は、トレース情報蓄積装置2にトレースメモリ読み出し要求1041を送り、トレースメモリ出力1031を取得する。
On the other hand, FIG. 48 shows the configuration of the development support apparatus. The development support device includes a trace
次に、半導体集積回路1から出力されたトレース情報に基づいて、半導体集積回路1のプログラム実行履歴を復元する方法について、図49に示したプログラムを例に説明する。なお、半導体集積回路1は図49に示したプログラムを実行することによって図50に示したトレース情報を出力したものとする。また、トレース開始はプログラム実行開始と同じ実行順番"1"(アドレス"0x40000000")であるとする。
Next, a method for restoring the program execution history of the semiconductor integrated
図51は、従来の実行履歴復元方法のフローチャートである。ホストコンピュータ3は、図51に示したフローに従って実行履歴を復元する。まず、ステップ5001で、実行ポインタIP=0x40000000及びトレースポインタTP=0がそれぞれ設定される。次に、ステップ5006でIP=0x40000000の命令"命令1"が表示される。TP=0のときの符号は"SEQ"であるので(ステップ5007,5008,5015,5019及び5021)、ステップ5022でIPがインクリメントされ(IP=0x40000004)、ステップ5023でTPがインクリメントされ(TP=1)、ステップ5006に戻る。TP=1,3,4,6,7,8,10,11,15,16のときの符号"SEQ"についても同様に処理される。
FIG. 51 is a flowchart of a conventional execution history restoration method. The
TP=2のときIP=0x40000008であり、ステップ5006でIP=0x40000008の命令"call Sub_A"が表示される。TP=2のときの符号は"NPC"であり(ステップ5007及び5008)、IP=0x40000008の命令はコール命令(CALL)であることから(ステップ5009及び5012)、ステップ5013で次の命令のアドレス"0x4000000c"がソフトウェア的に実現された模擬スタック(以下、ソフトスタックと称する)にプッシュされる。そして、ステップ5014でIPがソースプログラムから得られる"0x40000100"(Sub_A)に設定され、ステップ5023でTPがインクリメントされ(TP=3)、ステップ5006に戻る。TP=5のときの符号"NPC"についても同様に処理される。
When TP = 2, IP = 0x40000008, and in
TP=9のときIP=0x4000020cであり、ステップ5006でIP=0x4000020cの命令"call (a0)"が表示される。TP=9のときの符号は"JMP"であり(ステップ5007,5008及び5015)、IP=0x4000020cの命令はコール命令(CALL)であることから(ステップ5016)、ステップ5017で次の命令のアドレス"0x40000210"がソフトスタックにプッシュされ、ステップ5018でIPがTP=9のときの分岐先アドレス"0x40000300"に設定され、ステップ5023でTPがインクリメントされ(TP=10)、ステップ5006に戻る。
When TP = 9, IP = 0x4000020c, and in
TP=12のときIP=0x40000308であり、ステップ5006でIP=0x40000308の命令"ret"が表示される。TP=12のときの符号は"NPC"であり(ステップ5007及び5008)、IP=0x40000308の命令はリターン命令(RET)であることから(ステップ5009)、ステップ5010でソフトスタックから復帰先アドレスがポップされ、ステップ5011でIPがポップされたアドレス"0x40000210"に設定され、ステップ5023でTPがインクリメントされ(TP=13)、ステップ5006に戻る。TP=13,14のときの符号"NPC"についても同様に処理される。
When TP = 12, IP = 0x40000308, and in
図52は、上記の実行履歴復元方法を実行することによって得られた復元結果を示す。図52に示したように、図49に示したソースプログラムと図50に示したトレース情報とに基づいて、プロセッサ1の実行履歴が正しく復元されている。
上述した従来の技術には、以下のようにいくつかの問題点がある。 The conventional technology described above has several problems as follows.
(1)関数リターン命令や割込みリターン命令等のリターン命令についてはその分岐先アドレスの出力が常に省略されるため、タスク切替え(コンテキストスイッチ)でスタックを切り替えた場合、分岐先アドレス情報がソースプログラムから常に得られるとは限らない。同様に、何らかの要因でCPUが使用するスタックが破壊されて復帰先アドレスが不正になる場合にも、復帰先アドレスを正しく復元することができない。 (1) For return instructions such as function return instructions and interrupt return instructions, the output of the branch destination address is always omitted. Therefore, when the stack is switched by task switching (context switch), the branch destination address information is obtained from the source program. Not always available. Similarly, even when the stack used by the CPU is destroyed for some reason and the return address becomes invalid, the return address cannot be correctly restored.
(2)プログラムの先頭からでなく途中からトレースを開始する場合、リターン命令に対応する関数コール命令や割込み分岐の実行がトレース情報として残っていないため、分岐先アドレス情報を得ることができず、リターン命令の復帰先アドレスを復元することができない。 (2) When tracing starts from the middle instead of from the beginning of the program, the function call instruction corresponding to the return instruction and the execution of the interrupt branch do not remain as trace information, so the branch destination address information cannot be obtained. The return address of the return instruction cannot be restored.
同様に、ディレイドトリガ方式でトレースを行なう場合、トレースメモリがサイクリックに使用されるため、過去のトレースデータが上書きされ、リターン命令に対応する分岐命令の実行に係るトレース情報がない場合、正常に実行履歴を復元することができない。 Similarly, when tracing with the delayed trigger method, the trace memory is used cyclically, so the past trace data is overwritten and there is no trace information related to the execution of the branch instruction corresponding to the return instruction. The execution history cannot be restored.
(3)間接分岐が連続する場合に、履歴復元に必要な情報が欠落が発生する場合がある。この問題については、全ての分岐先アドレスが出力されるまで、次の命令実行を停止させる動作モード(フルトレースモード)を設けることで一応の解決が可能である。しかし、フルトレースモードでプロセッサを動作させた場合、プログラムの実行時間に影響を及ぼし、特に、リアルタイム制御においてはシステムが成り立たなくおそれがある。 (3) When indirect branching continues, information necessary for history restoration may be lost. This problem can be temporarily solved by providing an operation mode (full trace mode) in which execution of the next instruction is stopped until all branch destination addresses are output. However, when the processor is operated in the full trace mode, the execution time of the program is affected. In particular, the system may not be established in the real-time control.
また、特に、分岐先アドレスを分岐先アドレスレジスタに、また分岐先の命令を分岐先命令レジスタにそれぞれ格納することにより、分岐実行時のペナルティをなくして高速に分岐を行なう「高速分岐命令」を実装したアーキテクチャが存在する。このような高速分岐命令は間接分岐命令であるため、トレース情報として分岐先アドレスを出力する必要がある。高速分岐命令が威力を発揮するのは、繰り返しループの分岐として用いられる場合である。しかし、ポート902に分岐先アドレスを出力するサイクル数よりもCPUが分岐命令を実行する間隔の方が短いため、CPUを停止させない動作モード(非フルトレースモード)でトレース出力した場合、トレース情報が欠如して、完全な履歴を復元することができない。一方、フルトレースモードでトレース出力した場合には、CPUの動作時間に影響を及ぼし、特に、リアルタイム応用においてはシステムが成立しない可能性が高くなる。
In particular, by storing the branch destination address in the branch destination address register and the branch destination instruction in the branch destination instruction register, a “high-speed branch instruction” that branches at high speed without penalizing the branch execution is provided. There is an implemented architecture. Since such a high-speed branch instruction is an indirect branch instruction, it is necessary to output a branch destination address as trace information. The high-speed branch instruction is effective when it is used as a branch of a repeated loop. However, since the interval at which the CPU executes the branch instruction is shorter than the number of cycles for outputting the branch destination address to the
(4)高速分岐命令について、従来技術と同様に、分岐先アドレスレジスタの設定命令と高速分岐命令とを対応付けて高速分岐命令の分岐先アドレスの出力を抑制することで、上記(3)の問題は解決されるが、今度は、高速分岐命令に先行する分岐先アドレスレジスタの設定命令のトレース情報がトレースメモリに残っていない場合に、分岐先アドレスの復元ができなくなるといった上記(2)と同様の問題が生じる。 (4) As for the high-speed branch instruction, as in the prior art, the setting instruction of the branch destination address register and the high-speed branch instruction are associated with each other to suppress the output of the branch destination address of the high-speed branch instruction. The problem is solved, but this time the branch destination address cannot be restored when the trace information of the setting instruction of the branch destination address register preceding the fast branch instruction does not remain in the trace memory. Similar problems arise.
上記問題に鑑み、本発明は、プログラムを実行可能な半導体集積回路について、トレース情報出力の最適化を課題とする。また、本発明は、そのような半導体集積回路から出力されたトレース情報に基づいて、プログラム実行履歴を正確に復元することを課題とする。 In view of the above problems, an object of the present invention is to optimize the output of trace information for a semiconductor integrated circuit that can execute a program. Another object of the present invention is to accurately restore a program execution history based on trace information output from such a semiconductor integrated circuit.
上記課題を解決するために本発明が講じた手段は、半導体集積回路として、コール命令を実行したとき、第1の信号をアサートするとともにこのコール命令に係る分岐先アドレス及び復帰先アドレスを出力し、割込み分岐を実行したとき、第2の信号をアサートするとともにこの割込み分岐に係る分岐先アドレス及び復帰先アドレスを出力し、復帰命令を実行したとき、第3の信号をアサートするとともにこの復帰命令に係る分岐先アドレスを出力するCPUと、第1及び第2の信号のいずれかがアサートされたとき、CPUから出力された復帰先アドレスをプッシュし、第3の信号がアサートされたとき、プッシュされている復帰先アドレスをポップするスタックメモリと、スタックメモリからポップされた復帰先アドレスとCPUから出力された分岐先アドレスとを比較する比較器と、CPUから第1から第3の信号を含む複数の信号を受け、これら複数の信号に基づいてトレース状態符号を出力するトレースパケット制御部と、CPUから出力された分岐先アドレスを受け、トレースパケット制御部の制御により当該アドレスを出力するアドレスレジスタとを備えたものとする。ここで、トレースパケット制御部は、第3の信号がアサートされ、かつ、比較器から受けた比較結果が不一致を示すとき、アドレスレジスタにアドレス出力を指示するものとする。 Means taken by the present invention to solve the above problems is that, as a semiconductor integrated circuit, when a call instruction is executed, the first signal is asserted and a branch destination address and a return destination address related to the call instruction are output. When the interrupt branch is executed, the second signal is asserted, the branch destination address and the return destination address related to the interrupt branch are output, and when the return instruction is executed, the third signal is asserted and the return instruction When the CPU that outputs the branch destination address and any of the first and second signals are asserted, the return destination address output from the CPU is pushed, and when the third signal is asserted, the push is performed. Stack memory that pops the return destination address that has been popped, and the return destination address popped from the stack memory and the CPU A comparator that compares the branch destination address, a trace packet control unit that receives a plurality of signals including first to third signals from the CPU and outputs a trace status code based on the plurality of signals, and a CPU And an address register that receives the branch destination address output from the terminal and outputs the address under the control of the trace packet control unit. Here, it is assumed that the trace packet control unit instructs the address register to output an address when the third signal is asserted and the comparison result received from the comparator indicates a mismatch.
この発明によると、CPUによってコール命令又は割込み分岐が実行されたとき、スタックメモリにその復帰先アドレスがプッシュされ、CPUによって復帰命令が実行されたときスタックメモリにプッシュされている復帰先アドレスがポップされ、比較器によって、このポップされたアドレスとCPUから出力された実際の分岐先との比較が行われ、不一致の場合、トレースパケット制御部から指示を受けたアドレスレジスタによって、CPUから出力された分岐先アドレスがトレース情報として出力される。すなわち、復帰命令が実行されたとき、その分岐先が予想している分岐先と異なる場合にのみ、その分岐先アドレスがトレース情報として出力され、トレース情報出力が最適化される。 According to the present invention, when a call instruction or an interrupt branch is executed by the CPU, the return destination address is pushed to the stack memory, and when the return instruction is executed by the CPU, the return destination address pushed to the stack memory is popped. The comparator compares the popped address with the actual branch destination output from the CPU, and if there is a mismatch, the address is output from the CPU by the address register instructed by the trace packet control unit. The branch destination address is output as trace information. That is, when the return instruction is executed, only when the branch destination is different from the predicted branch destination, the branch destination address is output as the trace information, and the trace information output is optimized.
また、この半導体集積回路から出力されたトレース情報に基づいてプログラム実行履歴を復元する開発支援装置として、この半導体集積回路から出力されたトレース状態符号及びアドレスをトレース情報として格納するトレースメモリと、この半導体集積回路におけるCPUによって実行されたソースプログラムとトレースメモリに格納されたトレース情報とを順に対応させながら、このCPUによるソースプログラムの実行履歴を復元する実行履歴復元部とを備えたものとし、実行履歴復元部は、ソースプログラムからコール命令を検出したとき及びトレース情報から割込み分岐の実行を示す符号を検出したときのいずれかのとき、ソースプログラムから復帰先アドレスを得てプッシュするとともにトレース情報から分岐先アドレスを得て復元し、ソースプログラムから復帰命令を検出したとき、プッシュされている復帰先アドレスをポップして復元するものとする。 Further, as a development support apparatus for restoring the program execution history based on the trace information output from the semiconductor integrated circuit, a trace memory for storing the trace state code and address output from the semiconductor integrated circuit as trace information, and this An execution history restoring unit that restores the execution history of the source program executed by the CPU while sequentially corresponding the source program executed by the CPU in the semiconductor integrated circuit and the trace information stored in the trace memory is provided. The history restoration unit obtains a return destination address from the source program and pushes it from the trace information when a call instruction is detected from the source program or when a code indicating execution of an interrupt branch is detected from the trace information. Get branch destination address And source, upon detection of a return instruction from a source program, shall be restored by popping the return address that is pushed.
この発明によると、実行履歴復元部によって、ソースプログラムからコール命令が検出されたとき又はトレースメモリに格納されたトレース情報から割込み分岐の実行を示す符号が検出されたとき、ソースプログラムから得た復帰先アドレスがプッシュされるとともにトレース情報から得た分岐先アドレスが復元され、また、ソースプログラムから復帰命令が検出されたとき、プッシュされている復帰先アドレスがポップされて復元される。したがって、ソースプログラムからだけでは追跡できないタスク切替えや割込み処理時の分岐先アドレスがトレース情報から獲得され、正確にプログラム実行履歴が復元される。 According to the present invention, when the call history is detected from the source program by the execution history restoring unit or the code indicating execution of the interrupt branch is detected from the trace information stored in the trace memory, the return obtained from the source program is obtained. The destination address is pushed and the branch destination address obtained from the trace information is restored. When a return instruction is detected from the source program, the pushed return destination address is popped and restored. Therefore, the branch destination address at the time of task switching or interrupt processing that cannot be traced only from the source program is acquired from the trace information, and the program execution history is accurately restored.
また、この半導体集積回路からトレース情報としてトレース状態符号及びアドレスを得て、この半導体集積回路におけるCPUによって実行されたソースプログラムとトレース情報とを順に対応させながら、このCPUによるソースプログラムの実行履歴を復元する方法として、ソースプログラムからコール命令を検出するステップと、トレース情報から割込み分岐の実行を示す符号を検出するステップと、ソースプログラムから復帰命令を検出するステップと、上記のコール命令及び符号のいずれか一方が検出されたとき、ソースプログラムから復帰先アドレスを得てプッシュするステップと、上記のコール命令及び符号のいずれか一方が検出されたとき、トレース情報から分岐先アドレスを得て復元するステップと、上記の復帰命令が検出されたとき、プッシュされている復帰先アドレスをポップして復元するステップとを備えたものとする。 Also, the trace status code and address are obtained as trace information from this semiconductor integrated circuit, and the source program execution history by this CPU is correlated with the source program executed by the CPU in this semiconductor integrated circuit and the trace information in order. As a restoration method, a step of detecting a call instruction from a source program, a step of detecting a code indicating execution of an interrupt branch from trace information, a step of detecting a return instruction from the source program, and the above-described call instruction and code When either one is detected, the return destination address is obtained from the source program and pushed, and when any one of the above call instructions and codes is detected, the branch destination address is obtained from the trace information and restored. Step and the above return instruction When it is assumed that a step of restoring pops the return address that is pushed.
この発明によると、ソースプログラムからコール命令が検出されたとき又は格納されたトレース情報から割込み分岐の実行を示す符号が検出されたとき、ソースプログラムから得た復帰先アドレスがプッシュされるとともにトレース情報から得た分岐先アドレスが復元され、また、ソースプログラムから復帰命令が検出されたとき、プッシュされている復帰先アドレスがポップされて復元される。したがって、ソースプログラムからだけでは追跡できないタスク切替えや割込み処理時の分岐先アドレスがトレース情報から獲得され、正確にプログラム実行履歴が復元される。 According to the present invention, when a call instruction is detected from the source program or when a code indicating execution of an interrupt branch is detected from the stored trace information, the return destination address obtained from the source program is pushed and the trace information The branch destination address obtained from the above is restored, and when a return instruction is detected from the source program, the pushed return destination address is popped and restored. Therefore, the branch destination address at the time of task switching or interrupt processing that cannot be traced only from the source program is acquired from the trace information, and the program execution history is accurately restored.
好ましくは、上記の半導体集積回路において、トレースパケット制御部は、第3の信号がアサートされ、かつ、スタックメモリにアンダーフローが発生しているとき、アドレスレジスタにアドレス出力を指示するものとする。 Preferably, in the semiconductor integrated circuit, the trace packet control unit instructs the address register to output an address when the third signal is asserted and an underflow occurs in the stack memory.
この発明によると、スタックメモリが空であるにもかかわらず復帰命令が実行されたとき、予想外となる分岐先アドレスがトレース情報として出力される。 According to the present invention, when a return instruction is executed even though the stack memory is empty, an unexpected branch destination address is output as trace information.
また、好ましくは、上記の半導体集積回路は、トレースが開始されたとき、第4の信号をアサートする同期要求生成回路を備えているものとする。また、スタックメモリは、第4の信号がアサートされたとき、記憶内容を初期化するものとする。 Preferably, the semiconductor integrated circuit includes a synchronization request generation circuit that asserts a fourth signal when tracing is started. In addition, the stack memory initializes the stored contents when the fourth signal is asserted.
この発明によると、プログラム実行の途中からトレースが開始された場合、スタックメモリの内容が初期化され、トレース開始よりも前に実行されたコール命令等に対応する復帰命令が実行されたとき、スタックメモリに空の状態となっているため、その復帰命令の分岐先アドレスと不一致を起こし、以降の復帰命令に係る分岐先アドレスがトレース情報として出力される。これにより、開発支援装置によって、トレース開始以前の実行履歴が正確に復元される。 According to the present invention, when the trace is started in the middle of the program execution, the contents of the stack memory are initialized, and when the return instruction corresponding to the call instruction or the like executed before the start of the trace is executed, the stack is Since the memory is empty, a mismatch occurs with the branch destination address of the return instruction, and the branch destination address related to the subsequent return instruction is output as trace information. As a result, the development history before the start of tracing is accurately restored by the development support apparatus.
より好ましくは、CPUは、命令を実行したとき、この実行した命令の実行アドレスを出力するものであり、上記の半導体集積回路は、CPUから出力された分岐先アドレス及び実行アドレスのいずれか一方を選択的に出力するセレクタを備えているものとする。ここで、アドレスレジスタは、CPUから出力された分岐先アドレスに代えて、セレクタから出力されたアドレスを受け、トレースパケット制御部の制御により当該アドレスを出力するものとし、また、トレースパケット制御部は、第4の信号がアサートされたとき、トレース状態符号としてトレース開始を示す符号を出力し、さらに、第1及び第2の信号がネゲートされているとき、セレクタに実行アドレスの選択を指示する一方、これ以外のとき、セレクタに、分岐先アドレスの選択を指示するものとする。 More preferably, the CPU outputs an execution address of the executed instruction when the instruction is executed, and the semiconductor integrated circuit outputs either one of the branch destination address and the execution address output from the CPU. It is assumed that a selector that selectively outputs is provided. Here, the address register receives the address output from the selector instead of the branch destination address output from the CPU, and outputs the address under the control of the trace packet control unit. The trace packet control unit When the fourth signal is asserted, a code indicating a trace start is output as the trace status code, and when the first and second signals are negated, the selector is instructed to select an execution address. In other cases, the selector is instructed to select a branch destination address.
この発明によると、トレースを開始したとき、実行される命令が通常の順次実行命令であればトレース情報としてその実行アドレスが出力され、分岐命令であればその分岐先アドレスが出力される。これにより、トレース開始点のアドレス情報が出力される。 According to the present invention, when the trace is started, if the executed instruction is a normal sequential execution instruction, its execution address is output as trace information, and if it is a branch instruction, its branch destination address is output. As a result, the address information of the trace start point is output.
また、この半導体集積回路から出力されたトレース情報に基づいてプログラム実行履歴を復元する開発支援装置として、この半導体集積回路から出力されたトレース状態符号及びアドレスをトレース情報として格納するトレースメモリと、この半導体集積回路におけるCPUによって実行されたソースプログラムとトレースメモリに格納されたトレース情報とを順に対応させながら、このCPUによるソースプログラムの実行履歴を復元する実行履歴復元部とを備えたものとし、実行履歴復元部は、ソースプログラムからコール命令を検出したとき及びトレース情報から割込み分岐の実行を示す符号を検出したときのいずれかのとき、ソースプログラムから復帰先アドレスを得てプッシュするとともにトレース情報から分岐先アドレスを得て復元し、ソースプログラムから復帰命令を検出したとき、プッシュされている復帰先アドレスをポップして復元するものであり、かつ、トレース情報からトレース開始を示す符号を検出したとき、プッシュしている復帰先アドレスを初期化するとともに、トレース情報から当該符号に対応する実行アドレス及び分岐先アドレスのいずれかを得て復元するものとする。 Further, as a development support apparatus for restoring the program execution history based on the trace information output from the semiconductor integrated circuit, a trace memory for storing the trace state code and address output from the semiconductor integrated circuit as trace information, and this An execution history restoring unit that restores the execution history of the source program executed by the CPU while sequentially corresponding the source program executed by the CPU in the semiconductor integrated circuit and the trace information stored in the trace memory is provided. The history restoration unit obtains a return destination address from the source program and pushes it from the trace information when a call instruction is detected from the source program or when a code indicating execution of an interrupt branch is detected from the trace information. Get branch destination address When a return instruction is detected from the source program, the pushed return destination address is popped and restored, and when a code indicating the trace start is detected from the trace information, the pushed return is detected. It is assumed that the destination address is initialized, and either the execution address or the branch destination address corresponding to the code is obtained from the trace information and restored.
この発明によると、実行履歴復元部によって、トレースメモリに格納されたトレース情報からトレース開始を示す符号が検出されたとき、プッシュしている復帰先アドレスが初期化され、トレース情報から得た当該符号に対応する実行アドレス及び分岐先アドレスのいずれかが復元される。したがって、トレース開始直後から実行履歴が正確に復元される。 According to the present invention, when the code indicating the start of tracing is detected from the trace information stored in the trace memory by the execution history restoring unit, the return destination address being pushed is initialized, and the code obtained from the trace information is initialized. One of the execution address and the branch destination address corresponding to is restored. Therefore, the execution history is accurately restored immediately after the trace starts.
また、この半導体集積回路からトレース情報としてトレース状態符号及びアドレスを得て、この半導体集積回路におけるCPUによって実行されたソースプログラムとトレース情報とを順に対応させながら、このCPUによるソースプログラムの実行履歴を復元する方法として、ソースプログラムからコール命令を検出するステップと、ソースプログラムから復帰命令を検出するステップと、トレース情報から割込み分岐の実行を示す第1の符号を検出するステップと、トレース情報からトレース開始を示す第2の符号を検出するステップと、コール命令及び第1の符号のいずれか一方が検出されたとき、ソースプログラムから復帰先アドレスを得てプッシュするステップと、コール命令及び第1の符号のいずれか一方が検出されたとき、トレース情報から分岐先アドレスを得て復元するステップと、復帰命令が検出されたとき、プッシュされている復帰先アドレスをポップして復元するステップと、第2の符号が検出されたとき、プッシュされた復帰先アドレスを初期化するステップと、第2の符号が検出されたとき、トレース情報から第2の符号に対応する実行アドレス及び分岐先アドレスのいずれかを得て復元するステップとを備えたものとする。 Also, the trace status code and address are obtained as trace information from this semiconductor integrated circuit, and the source program execution history by this CPU is correlated with the source program executed by the CPU in this semiconductor integrated circuit and the trace information in order. As a restoration method, a step of detecting a call instruction from the source program, a step of detecting a return instruction from the source program, a step of detecting a first code indicating execution of an interrupt branch from the trace information, and a trace from the trace information A step of detecting a second code indicating a start; a step of obtaining and pushing a return destination address from the source program when one of the call instruction and the first code is detected; and the call instruction and the first code When either one of the codes is detected, A branch destination address is obtained from the source information and restored; when a return instruction is detected, a step of popping and restoring the pushed return destination address; and when a second code is detected, push Initializing the restored return address, and obtaining and restoring either the execution address or the branch destination address corresponding to the second code from the trace information when the second code is detected. Shall be.
この発明によると、トレース情報からトレース開始を示す符号が検出されたとき、プッシュしている復帰先アドレスが初期化され、トレース情報から得た当該符号に対応する実行アドレス及び分岐先アドレスのいずれかが復元される。したがって、トレース開始直後から実行履歴が正確に復元される。 According to the present invention, when the code indicating the trace start is detected from the trace information, the return destination address being pushed is initialized, and either the execution address or the branch destination address corresponding to the code obtained from the trace information is initialized. Is restored. Therefore, the execution history is accurately restored immediately after the trace starts.
一方、上記課題を解決するために本発明が講じた手段は、半導体集積回路として、レジスタに格納された分岐先アドレスに分岐する間接分岐命令を持つCPUであって、このレジスタを更新したとき、第1の信号をアサートし、間接分岐命令を実行したとき、第2の信号をアサートするとともにこの間接分岐命令に係る分岐先アドレスを出力するCPUと、第1の信号がアサートされてから第2の信号がアサートされるまでの間、第3の信号をアサートするループ検出回路と、CPUから第2の信号を含む複数の信号を受け、これら複数の信号に基づいてトレース状態符号を出力するトレースパケット制御部と、CPUから出力された分岐先アドレスを受け、トレースパケット制御部の制御により当該アドレスを出力するアドレスレジスタとを備えたものとする。ここで、トレースパケット制御部は、第2及び第3の信号がアサートされたとき、アドレスレジスタにアドレス出力を指示するものとする。 On the other hand, the means taken by the present invention to solve the above problem is a CPU having an indirect branch instruction that branches to a branch destination address stored in a register as a semiconductor integrated circuit, and when this register is updated, When the first signal is asserted and the indirect branch instruction is executed, the second signal is asserted and the branch destination address related to the indirect branch instruction is output, and the second signal after the first signal is asserted. Until the signal of the signal is asserted, a loop detection circuit that asserts the third signal, and a trace that receives a plurality of signals including the second signal from the CPU and outputs a trace status code based on the plurality of signals A packet control unit and an address register that receives the branch destination address output from the CPU and outputs the address under the control of the trace packet control unit; It is assumed that with. Here, it is assumed that the trace packet control unit instructs the address register to output an address when the second and third signals are asserted.
この発明によると、ループ検出回路によって、高速分岐命令を伴う高速ループ処理の開始が検出され、CPUによってそのループ処理において1回目の間接分岐命令が実行されたとき、その分岐先アドレスがトレース情報として出力され、2回目以降の間接分岐命令の実行に対しては、分岐先アドレスが出力されない。これにより、間接分岐命令を実装した半導体集積回路のトレース情報出力が最適化される。 According to the present invention, when the loop detection circuit detects the start of high-speed loop processing with a high-speed branch instruction and the CPU executes the first indirect branch instruction in the loop processing, the branch destination address is used as trace information. The branch destination address is not output for the execution of the second and subsequent indirect branch instructions. Thereby, the trace information output of the semiconductor integrated circuit in which the indirect branch instruction is mounted is optimized.
また、この半導体集積回路から出力されたトレース情報に基づいてプログラム実行履歴を復元する開発支援装置として、この半導体集積回路から出力されたトレース状態符号及びアドレスをトレース情報として格納するトレースメモリと、この半導体集積回路におけるCPUによって実行されたソースプログラムとトレースメモリに格納されたトレース情報とを順に対応させながら、このCPUによるソースプログラムの実行履歴を復元する実行履歴復元部とを備えたものとし、実行履歴復元部は、ソースプログラムから間接分岐命令を検出し、かつ、トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す符号を検出したとき、この分岐先アドレスを記憶するとともにこの分岐先アドレスを復元し、ソースプログラムから間接分岐命令を検出し、かつ、トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す符号を検出したとき、記憶した分岐先アドレスを復元するものとする。 Further, as a development support apparatus for restoring the program execution history based on the trace information output from the semiconductor integrated circuit, a trace memory for storing the trace state code and address output from the semiconductor integrated circuit as trace information, and this An execution history restoring unit that restores the execution history of the source program executed by the CPU while sequentially corresponding the source program executed by the CPU in the semiconductor integrated circuit and the trace information stored in the trace memory is provided. When the history restoring unit detects an indirect branch instruction from the source program and detects a code indicating execution of the indirect branch instruction with the branch destination address from the trace information, the history restoring unit stores the branch destination address and the branch destination. Restore address and indirectly from source program Detecting a 岐命 age, and when detecting a code indicating the execution of the indirect branch instruction without a branch address from the trace information shall restore the stored branch address.
この発明によると、実行履歴復元部によって、ソースプログラムから間接分岐命令が検出され、かつ、トレースメモリに格納されたトレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す符号が検出されたとき、この分岐先アドレスが記憶されるとともにこの分岐先アドレスが復元され、また、ソースプログラムから間接分岐命令が検出され、かつ、トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す符号が検出されたとき、記憶した分岐先アドレスが復元される。したがって、間接分岐命令を含む高速ループ処理に関してトレース情報に2回目以降の実行に係る間接分岐命令の分岐先アドレスが含まれていない場合であっても、正確にプログラム実行履歴が復元される。 According to the present invention, the execution history restoring unit detects an indirect branch instruction from the source program, and detects a code indicating execution of the indirect branch instruction with the branch destination address from the trace information stored in the trace memory. When this branch destination address is stored, this branch destination address is restored, an indirect branch instruction is detected from the source program, and a code indicating execution of the indirect branch instruction without the branch destination address from the trace information When is detected, the stored branch destination address is restored. Accordingly, even when the trace information does not include the branch destination address of the indirect branch instruction related to the second and subsequent executions regarding the high-speed loop processing including the indirect branch instruction, the program execution history is accurately restored.
また、この半導体集積回路からトレース情報としてトレース状態符号及びアドレスを得て、この半導体集積回路におけるCPUによって実行されたソースプログラムとトレース情報とを順に対応させながら、このCPUによる前記ソースプログラムの実行履歴を復元する方法として、ソースプログラムから間接分岐命令を検出するステップと、トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す第1の符号を検出するステップと、トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す第2の符号を検出するステップと、間接分岐命令及び第1の符号が検出されたとき、第1の符号に伴った分岐先アドレスを記憶するステップと、間接分岐命令及び第1の符号が検出されたとき、第1の符号に伴った分岐先アドレスを復元するステップと、間接分岐命令及び第2の符号が検出されたとき、記憶された分岐先アドレスを復元するステップとを備えたものとする。
ことを特徴とする実行履歴復元方法。
Further, a trace state code and an address are obtained as trace information from the semiconductor integrated circuit, and the source program executed by the CPU in the semiconductor integrated circuit is sequentially associated with the trace information, and the execution history of the source program executed by the CPU. Are detected as follows: a step of detecting an indirect branch instruction from a source program; a step of detecting a first code indicating execution of an indirect branch instruction with a branch destination address from trace information; and a branch destination address from trace information Detecting a second code indicative of execution of an indirect branch instruction without the step; storing a branch destination address associated with the first code when the indirect branch instruction and the first code are detected; When the indirect branch instruction and the first code are detected, the branch destination address associated with the first code is detected. And restoring the less, when the indirect branch instruction and the second code is detected, it is assumed that a step of restoring the stored branch destination address.
An execution history restoration method characterized by the above.
この発明によると、ソースプログラムから間接分岐命令が検出され、かつ、トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す第1の符号が検出されたとき、この分岐先アドレスが記憶されるとともにこの分岐先アドレスが復元され、また、ソースプログラムから間接分岐命令が検出され、かつ、トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す第2の符号が検出されたとき、記憶した分岐先アドレスが復元される。したがって、間接分岐命令を含む高速ループ処理に関してトレース情報に2回目以降の実行に係る間接分岐命令の分岐先アドレスが含まれていない場合であっても、正確にプログラム実行履歴が復元される。 According to the present invention, when an indirect branch instruction is detected from the source program and the first code indicating execution of the indirect branch instruction with the branch destination address is detected from the trace information, the branch destination address is stored. And the branch destination address is restored, the indirect branch instruction is detected from the source program, and the second code indicating the execution of the indirect branch instruction without the branch destination address is detected from the trace information, The stored branch destination address is restored. Accordingly, even when the trace information does not include the branch destination address of the indirect branch instruction related to the second and subsequent executions regarding the high-speed loop processing including the indirect branch instruction, the program execution history is accurately restored.
具体的には、上記の半導体集積回路において、ループ検出回路は、第1の信号がアサートされたとき、第3の信号をアサートされた状態に保持する保持回路と、第2の信号がアサートされたとき、保持回路によって保持された状態をリセットするリセット回路とを有するものとする。 Specifically, in the above-described semiconductor integrated circuit, when the first signal is asserted, the loop detection circuit is asserted with a holding circuit that holds the third signal in an asserted state and a second signal. And a reset circuit for resetting the state held by the holding circuit.
好ましくは、上記の半導体集積回路は、トレースが開始されたとき、第4の信号をアサートする同期要求生成回路を備えているものとする。また、ループ検出回路は、第4の信号がアサートされてから前記の信号がアサートされるまでの間、第3の信号をアサートするものとする。 Preferably, the semiconductor integrated circuit includes a synchronization request generation circuit that asserts a fourth signal when tracing is started. The loop detection circuit asserts the third signal during the period from when the fourth signal is asserted to when the signal is asserted.
この発明によると、プログラム実行の途中からトレースが開始された場合、再度、ループ検出回路によってループ処理が検出され、トレース開始よりも前に開始された高速ループ処理において2回目以降の実行であってトレース開始後の初めて実行に係る間接分岐命令の分岐先アドレスが、トレース情報として出力される。これにより、開発支援装置によって、トレース開始以前の実行履歴が正確に復元される。 According to the present invention, when the trace is started in the middle of the program execution, the loop process is detected again by the loop detection circuit, and the second and subsequent executions in the high-speed loop process started before the trace start. The branch destination address of the indirect branch instruction related to the first execution after the trace is started is output as trace information. As a result, the development history before the start of tracing is accurately restored by the development support apparatus.
より好ましくは、CPUは、命令を実行したとき、この実行した命令の実行アドレスを出力するものであり、上記の半導体集積回路は、CPUから出力された分岐先アドレス及び実行アドレスのいずれか一方を選択的に出力するセレクタを備えているものとする。ここで、アドレスレジスタは、CPUから出力された分岐先アドレスに代えて、セレクタから出力されたアドレスを受け、トレースパケット制御部の制御により当該アドレスを出力するものとし、また、トレースパケット制御部は、第4の信号がアサートされたとき、トレース状態符号としてトレース開始を示す符号を出力し、さらに、第2の信号がネゲートされているとき、セレクタに実行アドレスの選択を指示する一方、これ以外のとき、セレクタに、分岐先アドレスの選択を指示するものとする。 More preferably, the CPU outputs an execution address of the executed instruction when the instruction is executed, and the semiconductor integrated circuit outputs either one of the branch destination address and the execution address output from the CPU. It is assumed that a selector that selectively outputs is provided. Here, the address register receives the address output from the selector instead of the branch destination address output from the CPU, and outputs the address under the control of the trace packet control unit. The trace packet control unit When the fourth signal is asserted, a code indicating the trace start is output as the trace status code, and when the second signal is negated, the selector is instructed to select the execution address. In this case, the selector is instructed to select a branch destination address.
この発明によると、トレースを開始したとき、実行される命令が通常の順次実行命令であればトレース情報としてその実行アドレスが出力され、間接分岐命令であればその分岐先アドレスが出力される。これにより、トレース開始点のアドレス情報が出力される。 According to the present invention, when the trace is started, if the instruction to be executed is a normal sequential execution instruction, its execution address is output as trace information, and if it is an indirect branch instruction, its branch destination address is output. As a result, the address information of the trace start point is output.
また、この半導体集積回路から出力されたトレース情報に基づいてプログラム実行履歴を復元する開発支援装置として、この半導体集積回路から出力されたトレース状態符号及びアドレスをトレース情報として格納するトレースメモリと、この半導体集積回路におけるCPUによって実行されたソースプログラムとトレースメモリに格納されたトレース情報とを順に対応させながら、このCPUによる前記ソースプログラムの実行履歴を復元する実行履歴復元部とを備えたものとし、実行履歴復元部は、ソースプログラムから間接分岐命令を検出し、かつ、トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す符号を検出したとき、分岐先アドレスを記憶するとともにこの分岐先アドレスを復元し、ソースプログラムから間接分岐命令を検出し、かつ、トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す符号を検出したとき、記憶した分岐先アドレスを復元するものであり、かつ、トレース情報からトレース開始を示す符号を検出したとき、トレース情報から当該符号に対応する実行アドレス及び分岐先アドレスのいずれかを得て復元するものとする。 Further, as a development support apparatus for restoring the program execution history based on the trace information output from the semiconductor integrated circuit, a trace memory for storing the trace state code and address output from the semiconductor integrated circuit as trace information, and this An execution history restoring unit that restores the execution history of the source program by the CPU while sequentially corresponding the source program executed by the CPU in the semiconductor integrated circuit and the trace information stored in the trace memory, When the execution history restoring unit detects an indirect branch instruction from the source program and detects a code indicating execution of the indirect branch instruction with the branch destination address from the trace information, the execution history restoring unit stores the branch destination address and the branch destination. Restore address and indirectly from source program When the branch instruction is detected and the code indicating the execution of the indirect branch instruction without the branch destination address is detected from the trace information, the stored branch destination address is restored, and the trace start is started from the trace information. When the code shown is detected, either the execution address or the branch destination address corresponding to the code is obtained from the trace information and restored.
この発明によると、実行履歴復元部によって、トレースメモリに格納されたトレース情報からトレース開始を示す符号が検出されたとき、トレース情報から得た当該符号に対応する実行アドレス及び分岐先アドレスのいずれかが復元される。したがって、トレース開始直後から実行履歴が正確に復元される。 According to the present invention, when the execution history restoring unit detects a code indicating the start of tracing from the trace information stored in the trace memory, either the execution address or the branch destination address corresponding to the code obtained from the trace information is detected. Is restored. Therefore, the execution history is accurately restored immediately after the trace starts.
また、この半導体集積回路からトレース情報としてトレース状態符号及びアドレスを得て、この半導体集積回路におけるCPUによって実行されたソースプログラムとトレース情報とを順に対応させながら、このCPUによるソースプログラムの実行履歴を復元する方法として、ソースプログラムから間接分岐命令を検出するステップと、トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す第1の符号を検出するステップと、トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す第2の符号を検出するステップと、トレース情報からトレース開始を示す第3の符号を検出するステップと、間接分岐命令及び第1の符号が検出されたとき、第1の符号に伴った分岐先アドレスを記憶するステップと、間接分岐命令及び第1の符号が検出されたとき、第1の符号に伴った分岐先アドレスを復元するステップと、間接分岐命令及び第2の符号が検出されたとき、記憶された分岐先アドレスを復元するステップと、第3の符号が検出されたとき、トレース情報から第3の符号に対応する実行アドレス及び分岐先アドレスのいずれかを得て復元するステップとを備えたものとする。 Also, the trace status code and address are obtained as trace information from this semiconductor integrated circuit, and the source program execution history by this CPU is correlated with the source program executed by the CPU in this semiconductor integrated circuit and the trace information in order. As a restoration method, a step of detecting an indirect branch instruction from a source program, a step of detecting a first code indicating execution of an indirect branch instruction accompanied by a branch destination address from trace information, and a branch destination address from trace information Detecting a second code indicating execution of an indirect branch instruction without accompanying; detecting a third code indicating start of tracing from the trace information; and detecting an indirect branch instruction and the first code, Storing a branch destination address associated with the first code, and indirect branching A step of restoring the branch destination address associated with the first code when the instruction and the first code are detected; and a stored branch destination address when the indirect branch instruction and the second code are detected. And a step of obtaining and restoring either the execution address or the branch destination address corresponding to the third code from the trace information when the third code is detected.
この発明によると、トレース情報からトレース開始を示す符号が検出されたとき、トレース情報から得た当該符号に対応する実行アドレス及び分岐先アドレスのいずれかが復元される。したがって、トレース開始直後から実行履歴が正確に復元される。 According to the present invention, when a code indicating a trace start is detected from the trace information, either the execution address or the branch destination address corresponding to the code obtained from the trace information is restored. Therefore, the execution history is accurately restored immediately after the trace starts.
一方、上記課題を解決するために本発明が講じた手段は、半導体集積回路として、レジスタに格納された分岐先アドレスに分岐する間接分岐命令を持つCPUであって、間接分岐命令を実行したとき、第1の信号をアサートするとともにこの間接分岐命令に係る分岐先アドレスを出力するCPUと、第1の信号がアサートされたとき、格納しているアドレスを出力し、CPUから出力された分岐先アドレスを格納する第1のアドレスレジスタと、第1のアドレスレジスタから出力された分岐先アドレスとCPUから出力された分岐先アドレスとを比較する比較器と、CPUから第1の信号を含む複数の信号を受け、これら複数の信号に基づいてトレース状態符号を出力するトレースパケット制御部と、CPUから出力された分岐先アドレスを受け、トレースパケット制御部の制御により当該アドレスを出力する第2のアドレスレジスタとを備えたものとする。ここで、トレースパケット制御部は、第1の信号がアサートされ、かつ、比較器から受けた比較結果が不一致を示すとき、第2のアドレスレジスタにアドレス出力を指示するものとする。 On the other hand, the means taken by the present invention to solve the above problems is a CPU having an indirect branch instruction that branches to a branch destination address stored in a register as a semiconductor integrated circuit, and executes the indirect branch instruction. The CPU that asserts the first signal and outputs the branch destination address related to the indirect branch instruction, and outputs the stored address when the first signal is asserted, and the branch destination output from the CPU A first address register for storing an address; a comparator for comparing a branch destination address output from the first address register with a branch destination address output from the CPU; and a plurality of signals including a first signal from the CPU A trace packet control unit that receives a signal and outputs a trace status code based on the plurality of signals, and a branch destination address output from the CPU. Only, and that a second address register for outputting the address under the control of the trace packet control unit. Here, it is assumed that the trace packet control unit instructs the second address register to output an address when the first signal is asserted and the comparison result received from the comparator indicates a mismatch.
この発明によると、CPUによって間接分岐命令が実行されると、第1のアドレスレジスタに格納されている分岐先アドレスが出力されその内容は更新され、比較器によって、当該実行された間接分岐命令の分岐先アドレスと第1のアドレスレジスタから出力された分岐先アドレスが不一致のとき、CPUから出力された分岐先アドレスがトレース情報として出力され、一致のときは出力されない。すなわち、間接分岐命令を含む高速ループ処理において1回目の間接分岐命令の実行に対してはその分岐先アドレスがトレース情報として出力され、2回目以降の間接分岐命令の実行に対しては、分岐先アドレスが出力されない。これにより、間接分岐命令を実装した半導体集積回路のトレース情報出力が最適化される。 According to the present invention, when the indirect branch instruction is executed by the CPU, the branch destination address stored in the first address register is output and the content is updated, and the comparator executes the indirect branch instruction. When the branch destination address and the branch destination address output from the first address register do not match, the branch destination address output from the CPU is output as trace information, and is not output when they match. That is, in high-speed loop processing including an indirect branch instruction, the branch destination address is output as trace information for the first indirect branch instruction execution, and the branch destination for the second and subsequent indirect branch instruction executions. The address is not output. Thereby, the trace information output of the semiconductor integrated circuit in which the indirect branch instruction is mounted is optimized.
また、この半導体集積回路から出力されたトレース情報に基づいてプログラム実行履歴を復元する開発支援装置として、この半導体集積回路から出力されたトレース状態符号及びアドレスをトレース情報として格納するトレースメモリと、この半導体集積回路におけるCPUによって実行されたソースプログラムとトレースメモリに格納されたトレース情報とを順に対応させながら、このCPUによるソースプログラムの実行履歴を復元する実行履歴復元部とを備えたものとし、実行履歴復元部は、ソースプログラムから間接分岐命令を検出し、かつ、トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す符号を検出したとき、この分岐先アドレスを記憶するとともにこの分岐先アドレスを復元し、ソースプログラムから間接分岐命令を検出し、かつ、トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す符号を検出したとき、記憶した分岐先アドレスを復元するものとする。 Further, as a development support apparatus for restoring the program execution history based on the trace information output from the semiconductor integrated circuit, a trace memory for storing the trace state code and address output from the semiconductor integrated circuit as trace information, and this An execution history restoring unit that restores the execution history of the source program executed by the CPU while sequentially corresponding the source program executed by the CPU in the semiconductor integrated circuit and the trace information stored in the trace memory is provided. When the history restoring unit detects an indirect branch instruction from the source program and detects a code indicating execution of the indirect branch instruction with the branch destination address from the trace information, the history restoring unit stores the branch destination address and the branch destination. Restore address and indirectly from source program Detecting a 岐命 age, and when detecting a code indicating the execution of the indirect branch instruction without a branch address from the trace information shall restore the stored branch address.
この発明によると、実行履歴復元部によって、ソースプログラムから間接分岐命令が検出され、かつ、トレースメモリに格納されたトレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す符号が検出されたとき、この分岐先アドレスが記憶されるとともにこの分岐先アドレスが復元され、また、ソースプログラムから間接分岐命令が検出され、かつ、トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す符号が検出されたとき、記憶した分岐先アドレスが復元される。したがって、間接分岐命令を含む高速ループ処理に関してトレース情報に2回目以降の実行に係る間接分岐命令の分岐先アドレスが含まれていない場合であっても、正確にプログラム実行履歴が復元される。 According to the present invention, the execution history restoring unit detects an indirect branch instruction from the source program, and detects a code indicating execution of the indirect branch instruction with the branch destination address from the trace information stored in the trace memory. When this branch destination address is stored, this branch destination address is restored, an indirect branch instruction is detected from the source program, and a code indicating execution of the indirect branch instruction without the branch destination address from the trace information When is detected, the stored branch destination address is restored. Accordingly, even when the trace information does not include the branch destination address of the indirect branch instruction related to the second and subsequent executions regarding the high-speed loop processing including the indirect branch instruction, the program execution history is accurately restored.
また、この半導体集積回路からトレース情報としてトレース状態符号及びアドレスを得て、この半導体集積回路におけるCPUによって実行されたソースプログラムとトレース情報とを順に対応させながら、このCPUによる前記ソースプログラムの実行履歴を復元する方法として、ソースプログラムから間接分岐命令を検出するステップと、トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す第1の符号を検出するステップと、トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す第2の符号を検出するステップと、間接分岐命令及び第1の符号が検出されたとき、第1の符号に伴った分岐先アドレスを記憶するステップと、間接分岐命令及び第1の符号が検出されたとき、第1の符号に伴った分岐先アドレスを復元するステップと、間接分岐命令及び第2の符号が検出されたとき、記憶された分岐先アドレスを復元するステップとを備えたものとする。
ことを特徴とする実行履歴復元方法。
Further, a trace state code and an address are obtained as trace information from the semiconductor integrated circuit, and the source program executed by the CPU in the semiconductor integrated circuit is sequentially associated with the trace information, and the execution history of the source program executed by the CPU. Are detected as follows: a step of detecting an indirect branch instruction from a source program; a step of detecting a first code indicating execution of an indirect branch instruction with a branch destination address from trace information; and a branch destination address from trace information Detecting a second code indicative of execution of an indirect branch instruction without the step; storing a branch destination address associated with the first code when the indirect branch instruction and the first code are detected; When the indirect branch instruction and the first code are detected, the branch destination address associated with the first code is detected. And restoring the less, when the indirect branch instruction and the second code is detected, it is assumed that a step of restoring the stored branch destination address.
An execution history restoration method characterized by the above.
この発明によると、ソースプログラムから間接分岐命令が検出され、かつ、トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す第1の符号が検出されたとき、この分岐先アドレスが記憶されるとともにこの分岐先アドレスが復元され、また、ソースプログラムから間接分岐命令が検出され、かつ、トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す第2の符号が検出されたとき、記憶した分岐先アドレスが復元される。したがって、間接分岐命令を含む高速ループ処理に関してトレース情報に2回目以降の実行に係る間接分岐命令の分岐先アドレスが含まれていない場合であっても、正確にプログラム実行履歴が復元される。 According to the present invention, when an indirect branch instruction is detected from the source program and the first code indicating execution of the indirect branch instruction with the branch destination address is detected from the trace information, the branch destination address is stored. And the branch destination address is restored, the indirect branch instruction is detected from the source program, and the second code indicating the execution of the indirect branch instruction without the branch destination address is detected from the trace information, The stored branch destination address is restored. Accordingly, even when the trace information does not include the branch destination address of the indirect branch instruction related to the second and subsequent executions regarding the high-speed loop processing including the indirect branch instruction, the program execution history is accurately restored.
好ましくは、上記の半導体集積回路は、トレースが開始されたとき、第2の信号をアサートする同期要求生成回路を備えているものとする。また、第1のアドレスレジスタは、第2の信号がアサートされたとき、記憶内容を初期化するものとする。 Preferably, the semiconductor integrated circuit includes a synchronization request generation circuit that asserts the second signal when tracing is started. The first address register initializes the stored contents when the second signal is asserted.
この発明によると、プログラム実行の途中からトレースが開始された場合、第1のアドレスレジスタの記憶内容が初期化され、トレース開始よりも前に開始された高速ループ処理において2回目以降の実行であってトレース開始後の初めて実行に係る間接分岐命令の分岐先アドレスが、トレース情報として出力される。これにより、開発支援装置によって、トレース開始以前の実行履歴が正確に復元される。 According to the present invention, when tracing is started in the middle of program execution, the storage contents of the first address register are initialized, and the second and subsequent executions are performed in the high-speed loop processing started before the start of tracing. Thus, the branch destination address of the indirect branch instruction related to the first execution after the trace is started is output as trace information. As a result, the development history before the start of tracing is accurately restored by the development support apparatus.
より好ましくは、CPUは、命令を実行したとき、この実行した命令の実行アドレスを出力するものであり、上記の半導体集積回路は、CPUから出力された分岐先アドレス及び実行アドレスのいずれか一方を選択的に出力するセレクタを備えているものとする。ここで、第2のアドレスレジスタは、CPUから出力された分岐先アドレスに代えて、セレクタから出力されたアドレスを受け、トレースパケット制御部の制御により当該アドレスを出力するものとし、また、トレースパケット制御部は、第2の信号がアサートされたとき、トレース状態符号としてトレース開始を示す符号を出力し、さらに、第1の信号がネゲートされているとき、セレクタに実行アドレスの選択を指示する一方、これ以外のとき、セレクタに、分岐先アドレスの選択を指示するものとする。 More preferably, the CPU outputs an execution address of the executed instruction when the instruction is executed, and the semiconductor integrated circuit outputs either one of the branch destination address and the execution address output from the CPU. It is assumed that a selector that selectively outputs is provided. Here, the second address register receives the address output from the selector instead of the branch destination address output from the CPU, and outputs the address under the control of the trace packet control unit. When the second signal is asserted, the control unit outputs a code indicating a trace start as a trace status code, and further instructs the selector to select an execution address when the first signal is negated. In other cases, the selector is instructed to select a branch destination address.
この発明によると、トレースを開始したとき、実行される命令が通常の順次実行命令であればトレース情報としてその実行アドレスが出力され、間接分岐命令であればその分岐先アドレスが出力される。これにより、トレース開始点のアドレス情報が出力される。 According to the present invention, when the trace is started, if the instruction to be executed is a normal sequential execution instruction, its execution address is output as trace information, and if it is an indirect branch instruction, its branch destination address is output. As a result, the address information of the trace start point is output.
また、この半導体集積回路から出力されたトレース情報に基づいてプログラム実行履歴を復元する開発支援装置として、この半導体集積回路から出力されたトレース状態符号及びアドレスをトレース情報として格納するトレースメモリと、この半導体集積回路におけるCPUによって実行されたソースプログラムとトレースメモリに格納されたトレース情報とを順に対応させながら、このCPUによる前記ソースプログラムの実行履歴を復元する実行履歴復元部とを備えたものとし、実行履歴復元部は、ソースプログラムから間接分岐命令を検出し、かつ、トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す符号を検出したとき、分岐先アドレスを記憶するとともにこの分岐先アドレスを復元し、ソースプログラムから間接分岐命令を検出し、かつ、トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す符号を検出したとき、記憶した分岐先アドレスを復元するものであり、かつ、トレース情報からトレース開始を示す符号を検出したとき、トレース情報から当該符号に対応する実行アドレス及び分岐先アドレスのいずれかを得て復元するものとする。 Further, as a development support apparatus for restoring the program execution history based on the trace information output from the semiconductor integrated circuit, a trace memory for storing the trace state code and address output from the semiconductor integrated circuit as trace information, and this An execution history restoring unit that restores the execution history of the source program by the CPU while sequentially corresponding the source program executed by the CPU in the semiconductor integrated circuit and the trace information stored in the trace memory, When the execution history restoring unit detects an indirect branch instruction from the source program and detects a code indicating execution of the indirect branch instruction with the branch destination address from the trace information, the execution history restoring unit stores the branch destination address and the branch destination. Restore address and indirectly from source program When the branch instruction is detected and the code indicating the execution of the indirect branch instruction without the branch destination address is detected from the trace information, the stored branch destination address is restored, and the trace start is started from the trace information. When the code shown is detected, either the execution address or the branch destination address corresponding to the code is obtained from the trace information and restored.
この発明によると、実行履歴復元部によって、トレースメモリに格納されたトレース情報からトレース開始を示す符号が検出されたとき、トレース情報から得た当該符号に対応する実行アドレス及び分岐先アドレスのいずれかが復元される。したがって、トレース開始直後から実行履歴が正確に復元される。 According to the present invention, when the execution history restoration unit detects a code indicating the start of tracing from the trace information stored in the trace memory, either the execution address or the branch destination address corresponding to the code obtained from the trace information is detected. Is restored. Therefore, the execution history is accurately restored immediately after the trace starts.
また、この半導体集積回路からトレース情報としてトレース状態符号及びアドレスを得て、この半導体集積回路におけるCPUによって実行されたソースプログラムとトレース情報とを順に対応させながら、このCPUによるソースプログラムの実行履歴を復元する方法として、ソースプログラムから間接分岐命令を検出するステップと、トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す第1の符号を検出するステップと、トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す第2の符号を検出するステップと、トレース情報からトレース開始を示す第3の符号を検出するステップと、間接分岐命令及び第1の符号が検出されたとき、第1の符号に伴った分岐先アドレスを記憶するステップと、間接分岐命令及び第1の符号が検出されたとき、第1の符号に伴った分岐先アドレスを復元するステップと、間接分岐命令及び第2の符号が検出されたとき、記憶された分岐先アドレスを復元するステップと、第3の符号が検出されたとき、トレース情報から第3の符号に対応する実行アドレス及び分岐先アドレスのいずれかを得て復元するステップとを備えたものとする。 Also, the trace status code and address are obtained as trace information from this semiconductor integrated circuit, and the source program execution history by this CPU is correlated with the source program executed by the CPU in this semiconductor integrated circuit and the trace information in order. As a restoration method, a step of detecting an indirect branch instruction from a source program, a step of detecting a first code indicating execution of an indirect branch instruction accompanied by a branch destination address from trace information, and a branch destination address from trace information Detecting a second code indicating execution of an indirect branch instruction without accompanying; detecting a third code indicating start of tracing from the trace information; and detecting an indirect branch instruction and the first code, Storing a branch destination address associated with the first code, and indirect branching A step of restoring the branch destination address associated with the first code when the instruction and the first code are detected; and a stored branch destination address when the indirect branch instruction and the second code are detected. And a step of obtaining and restoring either the execution address or the branch destination address corresponding to the third code from the trace information when the third code is detected.
この発明によると、トレース情報からトレース開始を示す符号が検出されたとき、トレース情報から得た当該符号に対応する実行アドレス及び分岐先アドレスのいずれかが復元される。したがって、トレース開始直後から実行履歴が正確に復元される。 According to the present invention, when a code indicating a trace start is detected from the trace information, either the execution address or the branch destination address corresponding to the code obtained from the trace information is restored. Therefore, the execution history is accurately restored immediately after the trace starts.
本発明によると、プログラム実行履歴復元の際にソースプログラムの参照によって復元可能な分岐先アドレスはトレース情報として出力されず、ソースプログラムの参照のみでは辿れなくなるであろう分岐先アドレス、例えば、タスク切替えや割込み処理等が発生した場合やプログラム実行よりも遅れてトレースが開始された場合等の復帰命令に係る分岐先アドレスがトレース情報として出力される。これにより、半導体集積回路のトレース情報出力が最適化される。また、このような半導体集積回路から出力されたトレース情報に基づいて、正確なプログラム実行履歴が復元される。 According to the present invention, the branch destination address that can be restored by referring to the source program when restoring the program execution history is not output as trace information, and cannot be traced only by referring to the source program, for example, task switching. The branch destination address related to the return instruction is output as the trace information when an interrupt process or the like occurs or when the trace is started later than the program execution. Thereby, the trace information output of the semiconductor integrated circuit is optimized. Further, an accurate program execution history is restored based on the trace information output from such a semiconductor integrated circuit.
以下、本発明を実施するための最良の形態について、図面を参照しながら説明する。 The best mode for carrying out the present invention will be described below with reference to the drawings.
(第1の実施形態)
図1は、本発明の第1の実施形態に係る半導体集積回路の構成を示す。本実施形態に係る半導体集積回路1は、CPU100、トレースパケット制御部200、スタックメモリ300、比較器400、及びシフトレジスタ700を備えている。
(First embodiment)
FIG. 1 shows a configuration of a semiconductor integrated circuit according to the first embodiment of the present invention. The semiconductor integrated
CPU100は、命令実行が完了したとき、命令実行完了信号(EOI)101を、直接分岐命令を実行したとき、直接分岐命令実行信号(JMPDIR)102を、間接分岐命令を実行したとき、間接分岐命令実行信号(JMPIND)103を、条件分岐命令を実行したとき、条件成立信号(JMPTKN)104を、関数コール命令を実行したとき、関数コール命令実行信号(CALL)105を、関数リターン命令又は割込みリターン命令を実行したとき、リターン命令実行信号(RET)106を、そして、割込みを受理し分岐を実行したとき、割込み実行信号(EXP)108を、それぞれアサートする。また、CPU100は、関数コール命令、割込み分岐、関数リターン命令、又は割込みリターン命令を実行したとき、その分岐先アドレス110を、関数コール命令又は割込み分岐を実行したとき、その復帰先アドレス120を、それぞれ出力する。
The
スタックメモリ300は、OR回路350によって演算された信号CALL及びEXPの論理和をプッシュ信号として、信号RETをポップ信号として、そして、復帰先アドレス120をデータとして、それぞれ受ける。すなわち、スタックメモリ300は、CPU100によって関数コール命令又は割込み分岐が実行されたとき、CPU100から出力された復帰先アドレス120をプッシュし、関数リターン命令又は割込みリターン命令が実行されたとき、プッシュしている復帰先アドレスをポップしてスタックトップデータ301を出力する。この出力されたデータ301は、いわば復帰先アドレスの期待値を表している。また、スタックメモリ300は、スタック内容が有効であるとき、スタック有効信号302をアサートする。
The
比較器400は、スタックメモリ300から出力されたデータ301とCPU100から出力された分岐先アドレス110とを比較し、これらの一致/不一致を比較結果信号401として出力する。比較結果信号401は、一致のときはアサートされ、不一致のときはネゲートされる。なお、比較結果信号401及びスタック有効信号302はAND回路500によって論理積がとられ、復帰先アドレス一致信号501としてトレースパケット制御部200に送られる。
The
図2は、トレースパケット制御部200の状態デコード表を示す。トレースパケット制御部200は、信号EOI、JMPDIR、JMPIND、CALL、RET、JMPTKN及びEXP、並びに復帰先アドレス一致信号501を受け、図2に示した状態デコード表に従って、分岐先アドレスロードイネーブル信号(TPCLDEN)201及びトレース状態ポート(PCST)901に出力する符号204を決定する。
FIG. 2 shows a state decoding table of the trace
シフトレジスタ700は、信号TPCLDENがアサートされたとき、分岐先アドレス110をロードし、これをシリアルデータ化してデータ701を分岐先アドレス出力ポート(TPC)902に送る。
When the signal TPCLDEN is asserted, the
一方、本実施形態に係る開発支援装置は、図48に示した開発支援装置と同様の構成をしている。トレース情報蓄積装置2におけるトレースメモリ制御部1010及びシリアル−パラレル変換器1020は、それぞれ、半導体集積回路1から出力されたトレース状態信号911及び分岐先アドレス信号912を整形し、トレースメモリ1030にトレース情報として蓄積する。ホストコンピュータ3は、トレース情報蓄積装置2にトレースメモリ読み出し要求1041を送り、トレースメモリ出力1031を取得し、この取得した情報とソースプログラムと順に対応させながら、半導体集積回路1のプログラム実行履歴を復元する。なお、実行履歴復元部としてのホストコンピュータ3の動作が従来とは異なる。これについては後述する。
On the other hand, the development support apparatus according to the present embodiment has the same configuration as the development support apparatus shown in FIG. The trace
次に、本実施形態に係る半導体集積回路1及び開発支援装置によるトレース情報出力及び実行履歴復元について、図3に示したプログラムを実行する場合を例に説明する。この例では、半導体集積回路1は、アドレス"0x50000000"(実行順番"1")の命令"命令1"からプログラム実行及びトレースを開始し、アドレス"0x50000210"(実行順番"14")の命令"ret"を実行した後、割込みを受理して分岐を実行し、割込みハンドラ"int0h"でタスク"taskA"からタスク"taskB"へタスク切替えを行い、アドレス"0x40000110"(実行順番"19")の命令"rti"によってアドレス"0x50000610"に復帰する。なお、レジスタ等の保存・復帰の処理は省略している。
Next, trace information output and execution history restoration by the semiconductor integrated
図4は、半導体集積回路1が図3に示したプログラムを実行したときに出力するトレース情報を示す。図4に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、以下の説明において、スタックメモリ300にA,B,C,Dの順にアドレスがプッシュされた場合、そのスタック内容を(D,C,B,A)として表すものとする。スタックメモリ300がポップされるとD,C,B,Aの順にスタックトップデータ301が出力される。
FIG. 4 shows trace information output when the semiconductor integrated
CPU100が実行順番"1,2,4,5,7,8,9,11,12,15,16,17,18,22,23"の通常の順次実行命令を実行したとき、信号EOIのみがアサートされる(出力"1")。このとき、信号TPCLDENはアサートされず(出力"0")、トレース情報として符号"SEQ"のみが出力される。
When the
CPU100がアドレス"0x50000008"(実行順番"3")のコール命令"call Sub_A"を実行したとき、信号JMPDIR、CALL、JMPTKN及びEOIがアサートされる。このとき、OR回路350から出力されたプッシュ信号がアサートされることによって、CPU100から出力された復帰先アドレス120("0x5000000c")がプッシュされ、スタックメモリ300の内容は、
(0x5000000c)
となる。また、このとき、信号TPCLDENはアサートされず、トレース情報として符号"NPC"のみが出力される。
When the
(0x5000000c)
It becomes. At this time, the signal TPCLDEN is not asserted, and only the code “NPC” is output as the trace information.
同様に、CPU100がアドレス"0x50000108"(実行順番"6")のコール命令"call Sub_B"を実行したとき、復帰先アドレス120("0x5000010c")がプッシュされ、スタックメモリ300の内容は、
(0x5000010c,0x5000000c)
となる。このとき、トレース情報として符号"NPC"のみが出力される。
Similarly, when the
(0x5000010c, 0x5000000c)
It becomes. At this time, only the code “NPC” is output as the trace information.
CPU100がアドレス"0x5000020c"(実行順番"10")のコール命令"call (a0)"を実行したとき、復帰先アドレス120("0x50000210")がプッシュされ、スタックメモリ300の内容は、
(0x50000210,0x5000010c,0x5000000c)
となる。このとき、分岐条件が成立しているため信号JMPINDがアサートされ、信号TPCLDENがアサートされる(出力"1")。これにより、トレース情報として符号"JMP"が出力される。また、信号TPCLDENがアサートされることにより、シフトレジスタ700は、CPU100から出力された分岐先アドレス110("0x50000300")を受け、トレース情報として分岐先アドレス"0x50000300"が出力される。
When the
(0x50000210,0x5000010c, 0x5000000c)
It becomes. At this time, since the branch condition is satisfied, the signal JMPIND is asserted and the signal TPCLDEN is asserted (output “1”). As a result, the code “JMP” is output as the trace information. When the signal TPCLDEN is asserted, the
CPU100がアドレス"0x50000308"(実行順番"13")のリターン命令"ret"を実行したとき、信号RETがアサートされる。そして、復帰先アドレスの期待値"0x500000210"がポップされ、スタックメモリ300の内容は、
(0x5000010c,0x5000000c)
となる。このとき、ポップされた期待値("0x500000210")とCPU100から出力された実際の分岐先アドレス110("0x500000210")とは一致するため、比較結果信号401がアサートされる(出力"1")。また、このとき、スタックメモリ300の内容は有効であることからスタック有効信号302がアサートされており、復帰先アドレス一致信号501がアサートされる(出力"1")。信号RET及び復帰先アドレス一致信号501がアサートされているとき、信号TPCLDENはアサートされず、トレース情報として符号"NPC"のみが出力される。
When the
(0x5000010c, 0x5000000c)
It becomes. At this time, since the popped expected value (“0x500000210”) matches the actual branch destination address 110 (“0x500000210”) output from the
同様に、CPU100が実行順番"14"(アドレス"0x50000210")のリターン命令"ret"を実行したとき、復帰先アドレスの期待値"0x5000010c"がポップされ、スタックメモリ300の内容は、
(0x5000000c)
となる。このとき、ポップされた期待値("0x5000010c")とCPU100から出力された分岐先アドレス110("0x5000010c")とは一致するため、トレース情報として符号"NPC"のみが出力される。
Similarly, when the
(0x5000000c)
It becomes. At this time, since the popped expected value (“0x5000010c”) matches the branch destination address 110 (“0x5000010c”) output from the
実行順番"14"(アドレス"0x50000210")のリターン命令"ret"の実行後、その復帰先アドレス"0x5000010c"のリターン命令"ret"の実行前に割込みが発生し、CPU100はこの割込みを受理し、信号EXPがアサートされる。このとき、OR回路350から出力されたプッシュ信号がアサートされることによって、CPU100から出力された復帰先アドレス120("0x5000010c")がプッシュされ、スタックメモリ300の内容は、
(0x5000010c,0x5000000c)
となる。また、このとき、信号TPCLDENがアサートされ、トレース情報として符号"EXP"及び分岐先アドレス"0x40000100"が出力される。
An interrupt occurs after execution of the return instruction “ret” of the execution order “14” (address “0x50000210”) and before execution of the return instruction “ret” of the return destination address “0x5000010c”, and the
(0x5000010c, 0x5000000c)
It becomes. At this time, the signal TPCLDEN is asserted, and the code “EXP” and the branch destination address “0x40000100” are output as the trace information.
割込みハンドラ"int0h"ではスタックの切替えが行われ、CPUが実行順番"19"(アドレス"0x40000110")の割込みリターン命令"rti"を実行したとき、信号RETがアサートされる。そして、復帰先アドレスの期待値"0x5000010c"がポップされ、スタックメモリ300の内容は、
(0x5000000c)
となる。このとき、CPU100から出力された分岐先アドレス110は"0x50000610"であり、ポップされた期待値"0x5000010c"と一致しないため、比較結果信号401はアサートされず(出力"0")、復帰先アドレス一致信号501もまたアサートされない。信号RETがアサートされ、かつ、復帰先アドレス一致信号501がアサートされていないとき、信号TPCLDENがアサートされ、トレース情報として符号"JMP"及び分岐先アドレス"0x50000610"が出力される。
In the interrupt handler “int0h”, the stack is switched, and when the CPU executes the interrupt return instruction “rti” in the execution order “19” (address “0x40000110”), the signal RET is asserted. Then, the expected value “0x5000010c” of the return destination address is popped, and the contents of the
(0x5000000c)
It becomes. At this time, since the
同様に、CPU100が実行順番"20"(アドレス"0x50000610")のリターン命令"ret"を実行したとき、復帰先アドレスの期待値"0x5000000c"がポップされ、スタックメモリ300の内容は、
()
となる。このとき、CPU100から出力された分岐先アドレス110は"0x5000050c"であり、ポップされた期待値"0x5000000c"と一致しないため、トレース情報として符号"JMP"及び分岐先アドレス"0x5000050c"が出力される。
Similarly, when the
()
It becomes. At this time, the
CPU100が実行順番"21"(アドレス"0x5000050c")のリターン命令"ret"を実行したとき、信号RETがアサートされるが、スタックメモリ300は空の状態であるためアンダーフローが発生する。これにより、スタック有効信号302がネゲートされ(出力"0")、復帰先アドレス一致信号501もまたネゲートされる(出力"0")。信号RETがアサートされ、かつ、復帰先アドレス一致信号501がアサートされていないとき、信号TPCLDENがアサートされ、トレース情報として符号"JMP"及び分岐先アドレス"0x5000040c"が出力される。
When the
以上の動作によって、本実施形態に係る半導体集積回路1から、図4に示したトレース情報が出力される。
With the above operation, the trace information shown in FIG. 4 is output from the semiconductor integrated
一方、図5及び図6は、本実施形態に係る開発支援装置によって実行される実行履歴復元方法のフローチャートである。また、図7は、本実施形態に係る開発支援装置によって復元されたプログラム実行履歴を示す。図7に示したプログラム実行履歴は、以下に説明する実行履歴復元方法の実行の結果として得られたものである。 On the other hand, FIG. 5 and FIG. 6 are flowcharts of the execution history restoration method executed by the development support apparatus according to this embodiment. FIG. 7 shows a program execution history restored by the development support apparatus according to the present embodiment. The program execution history shown in FIG. 7 is obtained as a result of execution of the execution history restoring method described below.
処理開始時のトレースポインタ(TP)は"24"であり(IP=24)、まず、ステップ2001で、エンドトレースポインタ(ETP)が現在のトレースポインタに(ETP=24)、トレースポインタ(TP)がトレースメモリの先頭アドレスに(TP=0)、そして、実行ポインタ(IP)がトレース開始アドレスに(IP=0x50000000)、それぞれ設定される。
The trace pointer (TP) at the start of processing is “24” (IP = 24). First, in
TP=0のとき、IP=0x50000000であり、ステップ2006で、ソースプログラムから得られるプログラム部分"0x50000000 taskA:命令1"が復元され表示される。このとき、トレース情報に示された符号は"SEQ"であるので(ステップ2007,2008,2017,2024及び2032)、ステップ2033でIPがインクリメントされ(IP=0x5000004)、ステップ2034でTPがインクリメントされた後(TP=1)、ステップ2006に戻る。TP=1,3,4,6,7,8,10,11,15,16,17,18,22,23のときも同様に処理される。
When TP = 0, IP = 0x50000000, and in
TP=2のとき、IP=0x50000008であり、トレース情報に示された符号は"NPC"であり(ステップ2007及び2008)、ソースプログラムに示された命令は"call Sub_A"、すなわち、コール命令(CALL)であることから(ステップ2009及び2014)、ステップ2015で復帰先アドレスとして現在のIPの次のアドレス"0x5000000c"がソフトスタックにプッシュされ、ソフトスタックの内容は、
(0x5000000c)
となる。そして、ステップ2016でIPがソースプログラムに示された命令"call Sub_A"の分岐先アドレスに設定され(IP=0x50000100)、ステップ2034でTPがインクリメントされた後(TP=3)、ステップ2006に戻る。TP=5のときも同様に処理され、ソフトスタックの内容は、
(0x5000010c,0x5000000c)
となる。
When TP = 2, IP = 0x50000008, the sign shown in the trace information is “NPC” (
(0x5000000c)
It becomes. In
(0x5000010c, 0x5000000c)
It becomes.
TP=9のとき、IP=0x5000020cであり、トレース情報に示された符号は"JMP"であり(ステップ2007,2008及び2017)、ソースプログラムに示された命令は"call (a0)"、すなわち、コール命令(CALL)であることから(ステップ2018及び2020)、ステップ2021で復帰先アドレスとして現在のIPの次のアドレス"0x50000210"がソフトスタックにプッシュされ、ソフトスタックの内容は、
(0x50000210,0x5000010c,0x5000000c)
となる。そして、ステップ2028でIPがトレース情報に示されたTP=9に対応する分岐先アドレス"0x50000300"に設定され(IP=0x50000300)、ステップ2034でTPがインクリメントされた後(TP=10)、ステップ2006に戻る。
When TP = 9, IP = 0x5000020c, the code shown in the trace information is “JMP” (
(0x50000210,0x5000010c, 0x5000000c)
It becomes. Then, in
TP=12のとき、IP=0x50000308であり、トレース情報に示された符号は"NPC"であり(ステップ2007及び2008)、ソースプログラムに示された命令は"ret"、すなわち、リターン命令(RET)であることから(ステップ2009)、ステップ2010でソフトスタックから復帰先アドレス"0x50000210"がポップされ、ソフトスタックの内容は、
(0x5000010c,0x5000000c)
となる。そして、ステップ2011でIPがポップされたアドレスに設定され(IP=0x50000210)、ステップ2034でTPがインクリメントされた後(TP=13)、ステップ2006に戻る。
When TP = 12, IP = 0x50000308, the sign shown in the trace information is “NPC” (
(0x5000010c, 0x5000000c)
It becomes. In
TP=13のときもTP=12のときと同様に処理され、IPがポップされたアドレスに設定される(IP=0x5000010c)。なお、TP=13の処理終了時のソフトスタックの内容は、
(0x5000000c)
となる。
When TP = 13, the same processing is performed as when TP = 12, and the IP is set to the popped address (IP = 0x5000010c). The contents of the soft stack at the end of the process of TP = 13 are
(0x5000000c)
It becomes.
TP=14のとき、IP=0x5000010cであり、トレース情報に示された符号は"EXP"であることから(ステップ2007,2008,2017及び2024)、ステップ2025で現在のIPが示すアドレス"0x5000010c"がソフトスタックにプッシュされ、ソフトスタックの内容は、
(0x5000010c,0x5000000c)
となる。そして、ステップ2028でIPがトレース情報に示されたTP=14に対応する分岐先アドレス"0x40000100"に設定され(IP=0x40000100)、ステップ2034でTPがインクリメントされた後(TP=15)、ステップ2006に戻る。
When TP = 14, IP = 0x5000010c, and the code indicated in the trace information is “EXP” (
(0x5000010c, 0x5000000c)
It becomes. Then, in
TP=19のとき、IP=0x40000110であり、トレース情報に示された符号は"JMP"であり(ステップ2007,2008及び2017)、ソースプログラムに示された命令は"rti"、すなわち、リターン命令(RET)であることから(ステップ2018)、ステップ2019でソフトスタックから復帰先アドレス"0x5000010c"がポップされ、ソフトスタックの内容は、
(0x5000000c)
となる。しかし、トレース情報にTP=19に対応する分岐先アドレス"0x50000610"が含まれているため、ポップされた復帰先アドレス"0x5000010c"は破棄され、ステップ2028でIPがトレース情報に示されたTP=19に対応する分岐先アドレス"0x50000610"に設定され(IP=0x50000610)、ステップ2034でTPがインクリメントされた後(TP=20)、ステップ2006に戻る。TP=20,21のときも同様に処理される。
When TP = 19, IP = 0x40000110, the sign shown in the trace information is “JMP” (
(0x5000000c)
It becomes. However, since the branch destination address “0x50000610” corresponding to TP = 19 is included in the trace information, the popped return destination address “0x5000010c” is discarded, and the TP = IP indicated in the trace information in
以上の処理によって、本実施形態に係る開発支援装置によって、図7に示したプログラム実行履歴が復元される。 With the above processing, the program execution history shown in FIG. 7 is restored by the development support apparatus according to the present embodiment.
以上、本実施形態によると、CPUによるプログラム実行のトレース情報として、リターン命令に係る分岐先アドレスは、通常は出力されず、スタック切替えや割込み処理等によって期待した復帰先と異なる場合にのみ出力される。すなわち、スタック切替えや割込み処理等が発生した場合であっても正確なプログラム実行履歴を復元することができるように、必要最低限のリターン命令に係る分岐先アドレスが出力され、トレース情報出力が最適化される。また、このように最適化されたトレース情報から、正確にプログラム実行履歴を復元することができる。 As described above, according to the present embodiment, the branch destination address related to the return instruction is not normally output as trace information of the program execution by the CPU, and is output only when it is different from the expected return destination by stack switching or interrupt processing. The In other words, even if stack switching, interrupt processing, etc. occurs, the branch destination address related to the minimum return instruction is output so that the correct program execution history can be restored, and the trace information output is optimal It becomes. In addition, the program execution history can be accurately restored from the trace information optimized in this way.
(第2の実施形態)
図8は、本発明の第2の実施形態に係る半導体集積回路の構成を示す。本実施形態に係る半導体集積回路1は、第1の実施形態に係る半導体集積回路に、同期要求要求生成回路800及びセレクタ750を追加した構成をしている。以下、第1の実施形態に係る半導体集積回路と比較して異なる部分について説明する。
(Second Embodiment)
FIG. 8 shows a configuration of a semiconductor integrated circuit according to the second embodiment of the present invention. The semiconductor integrated
CPU100は、命令を実行したとき、その命令の実行アドレス111を出力する。セレクタ750は、CPU100から分岐先アドレス110及び実行アドレス111を受け、トレースパケット制御部200から出力される選択信号202に従って、これら入力したアドレスのいずれか一方を出力する。シフトレジスタ700は、セレクタ750から出力されたアドレス751を受ける。
When the
同期要求生成回路800は、半導体集積回路1の起動時等のシステムリセット時、CPU100によってタスクが切替えられたとき等のタスク切替え時、トレース情報出力を開始するトレース開始時、開発支援装置からの要求時、又は一定周期毎に、同期要求信号801をアサートする。これにより、例えば、図48に示した開発支援装置におけるトレースメモリ1030がオーバーフローしそうな場合に、開発支援装置からの要求により同期要求信号801がアサートされる。また、例えば、一定周期で同期要求信号801がアサートされることにより、トレース情報出力が一定周期で初期化される。なお、スタックメモリ300は、同期要求信号801がアサートされたとき、スタックポインタを初期化し、プッシュしているスタック内容を無効にする。
The synchronization
図9は、トレースパケット制御部200の状態デコード表を示す。本実施形態に係るトレースパケット制御部200は、第1の実施形態と比較して、入力として同期要求信号801が、出力として選択信号(TPCSEL)202が追加されている。また、出力符号として"SYN"及び"JMPS"が追加されている。
FIG. 9 shows a state decoding table of the trace
一方、本実施形態に係る開発支援装置は、図48に示した開発支援装置と同様の構成をしている。しかし、実行履歴復元部としてのホストコンピュータ3の動作が従来とは異なる。これについては後述する。
On the other hand, the development support apparatus according to the present embodiment has the same configuration as the development support apparatus shown in FIG. However, the operation of the
次に、本実施形態に係る半導体集積回路1及び開発支援装置によるトレース情報出力及び実行履歴復元について、図10に示したプログラムを実行する場合を例に説明する。この例では、半導体集積回路1は、アドレス"0x50000000"(実行順番"1")からプログラム実行を開始し、アドレス"0x50000008"(実行順番"3")でサブルーチン"Sub_A"がコールされアドレス"0x50000100"にジャンプする。そして、アドレス"0x50000104"(実行順番"5")の命令"命令4"が実行されるとき、トレースが開始される。その後、半導体集積回路1は、アドレス"0x50000108"(実行順番"6")でアドレス"0x50000200"のサブルーチン"Sub_B"にジャンプし、アドレス"0x5000020c"(実行順番"10")でアドレス"0x50000300"のサブルーチン"Sub_C"にジャンプし、アドレス"0x50000308"から"0x50000210,0x5000010c,0x5000010"の順に呼び出し元に復帰する。
Next, trace information output and execution history restoration by the semiconductor integrated
図11は、半導体集積回路1が図10に示したプログラムを実行したときに出力するトレース情報を示す。図11に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。
FIG. 11 shows trace information output when the semiconductor integrated
トレース開始前、アドレス"0x50000008"(実行順番"3")のコール命令"call Sub_A"の実行によって、スタックメモリ300の内容は、
(0x5000000c)
となっている。しかし、実行順番"5"のときトレースが開始され、同期要求信号801がアサートされる。これにより、スタックメモリ300は初期化され、その内容は、
()
となる。
By executing the call instruction “call Sub_A” at the address “0x50000008” (execution order “3”) before the trace is started, the contents of the
(0x5000000c)
It has become. However, when the execution order is “5”, tracing starts and the
()
It becomes.
CPU100がアドレス"0x50000104"(実行順番"5")の命令"命令4"を実行したとき、信号EOIがアサートされるとともに実行アドレス111("0x50000104")が出力される。このとき、信号JMPTKNはアサートされず、図9に示した状態デコード表に従って、トレースパケット制御部200は、信号TPCLDENをアサートし、信号TPCSELの値を"0"に設定し、符号204として"SYN"を出力する。信号TPCSELの値が"0"のとき、セレクタ750は、実行アドレス111("0x5000104")を選択し、シフトレジスタ700に入力する。また、信号TPCLDENがアサートされることにより、シフトレジスタ700は、セレクタ750から受けたアドレス751("0x50000104")をデータ701としてポート902に順次出力する。すなわち、CPU100が分岐命令以外の通常の順次実行命令を実行したときであって同期要求信号801がアサートされたとき、トレースパケット制御部200は、符号204として"SEQ"ではなく"SYN"を出力するとともに、データ701として分岐先アドレス110ではなく実行アドレス111が出力されるべく信号TPCLDEN及び信号TPCSELの値を設定する。
When the
その後、実行順番"14"までは、第1の実施形態で説明したのと同様にトレース情報が出力される。特に、アドレス"0x5000020c"(実行順番"10")のコール命令"call (a0)"が実行されたとき、トレースパケット制御部200は、信号TPCLDENをアサートし、信号TPCSELの値を"1"に設定し、符号204として"JMP"を出力する。これにより、セレクタ750によって分岐先アドレス110("0x50000300")が選択され、シフトレジスタ700から出力される。なお、スタックメモリ300は、実行順番"6"及び"10"でプッシュされ、実行順番"13"及び"14"でポップされ、アドレス"0x50000210"(実行順番"14")の命令が実行された時点で空の状態となっている。
Thereafter, until the execution order “14”, trace information is output in the same manner as described in the first embodiment. In particular, when the call instruction “call (a0)” at the address “0x5000020c” (execution order “10”) is executed, the trace
次に、CPU100がアドレス"0x5000010c"(実行順番"15")のリターン命令"ret"を実行したとき、スタックメモリ300にアンダーフローが発生し、復帰先アドレス一致信号501はアサートされない。トレースパケット制御部200は、図9に示した状態デコード表に従って、信号TPCLDENをアサートし、信号TPCSELの値を"1"に設定し、符号204として"JMP"を出力する。これにより、シフトレジスタ700から分岐先アドレス110("0x5000000c")がデータ701としてポート902に順次出力される。
Next, when the
以上の動作によって、本実施形態に係る半導体集積回路1から、図11に示したトレース情報が出力される。
With the above operation, the trace information shown in FIG. 11 is output from the semiconductor integrated
一方、図12及び図13は、本実施形態に係る開発支援装置によって実行される実行履歴復元方法のフローチャートである。また、図14は、本実施形態に係る開発支援装置によって復元されたプログラム実行履歴を示す。図14に示したプログラム実行履歴は、以下に説明する実行履歴復元方法の実行の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。 On the other hand, FIGS. 12 and 13 are flowcharts of an execution history restoration method executed by the development support apparatus according to the present embodiment. FIG. 14 shows a program execution history restored by the development support apparatus according to the present embodiment. The program execution history shown in FIG. 14 is obtained as a result of execution of the execution history restoring method described below. A characteristic part of this embodiment will be described.
ステップ2001で、現在のトレースポインタ(TP=13)をエンドトレースポインタ(ETP)に設定し、トレースポインタは、現在のトレースポインタより前のトレースデータで符号が"SYN"又は"JMPS"であるトレースポインタに設定される(TP=0)。TP=0のときの符号は"SYN"であるため(ステップ2002)、ステップ2003で、IPがトレース情報に示されたTP=0に対応する実行アドレス"0x50000104"に設定され(IP=0x50000104)、ステップ2006に進む。この後の処理は、第1の実施形態で説明した内容と同様である。特に、TP=10のときのリターン命令"ret"の分岐先アドレスを復元する際、ソフトスタックの内容は空であり無効となっているが、トレース情報にその分岐先アドレス"0x5000000c"が含まれており、ステップ2028で、IPがトレース情報に示されたTP=10に対応する分岐先アドレス"0x5000000c"に設定され(IP=0x5000000c)、復元処理が続行される。
In
以上の処理によって、本実施形態に係る開発支援装置によって、図14に示したプログラム実行履歴が復元される。 Through the above processing, the program execution history shown in FIG. 14 is restored by the development support apparatus according to the present embodiment.
次に、本実施形態に係る半導体集積回路1によるトレース情報出力及び開発支援装置による実行履歴復元の別例について、図15に示したプログラムを実行する場合を例に説明する。この例は、プログラム自体は図10に示した先の例と同じであるが、トレースの開始が先の例よりも1命令後のアドレス"0x50000108"(実行順番"6")の命令から始まっている。
Next, another example of trace information output by the semiconductor integrated
図16は、半導体集積回路1が図15に示したプログラムを実行したときに出力するトレース情報を示す。図16に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。
FIG. 16 shows trace information output when the semiconductor integrated
トレース開始前、アドレス"0x50000008"(実行順番"3")のコール命令"call Sub_A"及びアドレス"0x5000108"(実行順番"6")のコール命令"call Sub_B"の実行によって、スタックメモリ300の内容は、
(0x500010c,0x5000000c)
となっている。しかし、実行順番"6"のときトレースが開始され、同期要求信号801がアサートされる。これにより、スタックメモリ300は初期化され、その内容は、
()
となる。
The contents of the
(0x500010c, 0x5000000c)
It has become. However, when the execution order is “6”, tracing is started and the
()
It becomes.
CPU100がアドレス"0x5000108"(実行順番"6")の命令"call Sub_B"を実行したとき、信号CALL及びJMPTKNがアサートされる。このとき、トレースパケット制御部200は、図9に示した状態デコード表に従って、信号TPCLDENをアサートし、信号TPCSELの値を"1"に設定し、符号204として"JMPS"を出力する。信号TPCSELの値が"1"のとき、セレクタ750は、分岐先アドレス110("0x50000200")を選択し、シフトレジスタ700に入力する。また、信号TPCLDENがアサートされることにより、シフトレジスタ700は、セレクタ750から受けたアドレス751("0x50000200")をデータ701としてポート902に順次出力する。すなわち、CPU100が分岐命令を実行したときであって同期要求信号801がアサートされたとき、トレースパケット制御部200は、符号204として"NPC"又は"JMP"ではなく"JMPS"を出力するとともに、データ701として分岐先アドレス110が出力されるべく信号TPCLDEN及び信号TPCSELの値を設定する。
When the
その後の動作は、先の例と同様である。特に、スタックメモリ300は、実行順番"10"でプッシュされ、実行順番"13"でポップされ、アドレス"0x50000308"(実行順番"13")の命令が実行された時点で空の状態となっている。このため、実行順番"10"及び"15"で命令が実行されたとき、スタックメモリ300にアンダーフローが発生し、復帰先アドレス一致信号501はアサートされず、符号204として"JMP"が出力されるとともに、分岐先アドレス110がデータ701としてポート902に順次出力される。
The subsequent operation is the same as in the previous example. In particular, the
以上の動作によって、本実施形態に係る半導体集積回路1から、図16に示したトレース情報が出力される。
With the above operation, the trace information shown in FIG. 16 is output from the semiconductor integrated
一方、図17は、本実施形態に係る開発支援装置によって復元されたプログラム実行履歴を示す。図14に示したプログラム実行履歴は、図12及び図13に示したフローに従って得られたものである。 On the other hand, FIG. 17 shows a program execution history restored by the development support apparatus according to the present embodiment. The program execution history shown in FIG. 14 is obtained according to the flow shown in FIGS.
先の例とは異なり、TP=0のときの符号は"JMPS"であるため(ステップ2001及び2002)、ステップ2004でIPがトレース情報中のTP=0に対応する分岐先アドレスに設定され(IP=0x50000200)、ステップ2005でTPがインクリメントされた後(TP=1)、ステップ2006に進む。以降の処理は、先の例と同様である。
Unlike the previous example, since the sign when TP = 0 is “JMPS” (
以上、本実施形態によると、プログラムの実行が開始された後に遅れてトレースが開始された場合であっても、トレース開始時の実行アドレス又は分岐先アドレスが出力され、また、トレース開始前に実行されたコール命令に対応するリターン命令が実行されたとき、その分岐先アドレスがトレース情報として出力される。これにより、プログラム実行の途中からトレースが開始されても、トレース開始時のプログラム部分を復元し、さらに、トレース開始前に実行されたプログラム部分までも復元することができる。 As described above, according to the present embodiment, even when the trace is started after execution of the program is started, the execution address or the branch destination address at the start of the trace is output, and is also executed before the start of the trace. When a return instruction corresponding to the issued call instruction is executed, the branch destination address is output as trace information. Thereby, even if the trace is started in the middle of the program execution, the program part at the start of the trace can be restored, and further, the program part executed before the trace can be restored.
(第3の実施形態)
図18は、本発明の第3の実施形態に係る半導体集積回路の構成を示す。本実施形態に係る半導体集積回路1は、CPU100、トレースパケット制御部200、ループ検出回路600、及びシフトレジスタ700を備えている。なお、シフトレジスタ700については、第1の実施形態と同様であるため、説明を省略する。
(Third embodiment)
FIG. 18 shows a configuration of a semiconductor integrated circuit according to the third embodiment of the present invention. The semiconductor integrated
CPU100は、高速分岐命令としてレジスタ間接分岐命令を実装しており、例えば、プログラムのループ部分を実行するとき、ループアドレスレジスタ(LAR)150及びループ命令レジスタ(LIR)160に、それぞれ、分岐先アドレス及び分岐先の命令を格納し、これらレジスタを参照してループ部分を実行することによって高速分岐が可能となっている。CPU100は、レジスタ150を更新したとき、LAR更新信号130をアサートし、レジスタ150に格納された分岐先アドレスへの分岐命令を実行したとき、LAR間接分岐命令実行信号(LCC)をアサートする。これ以外の点については、第1の実施形態に係る半導体集積回路1におけるCPU100と同様であるため、説明を省略する。
The
ループ検出回路600は、保持回路610及びリセット回路620を備えている。保持回路610は、RSフリップフロップで構成され、LAR更新信号130をセット端子に、リセット回路620から出力されるリセット信号621をリセット端子に、それぞれ受け、LAR更新フラグ信号601を出力する。リセット回路620は、信号LCC及びJMPTKNの論理積を演算するAND回路630、及びAND回路630の出力を受け、リセット信号621を出力するDフリップフロップ640を備えている。Dフリップフロップ640は、保持回路610のセット/リセットのタイミングを調整すべく、AND回路630の出力を遅延させるために設けている。以上の構成により、ループ検出回路600は、レジスタ150が更新されてLAR更新信号130がアサートされたとき、LAR更新フラグ信号601をアサートし、ループ初回の信号LCC及びJMPTKNがアサートされたとき、LAR更新フラグ信号601をネゲートする。すなわち、ループ検出回路600は、あるループ部分の実行が開始され、レジスタ間接分岐命令が初めて実行されたときにのみLAR更新フラグ信号601をアサートし、2回目以降のレジスタ間接分岐命令の実行についてはアサートしない。なお、図19に示したように、ループ検出回路600における保持回路610をDフリップフロップで構成してもよい。
The
図20は、トレースパケット制御部200の状態デコード表を示す。トレースパケット制御部200は、信号EOI、JMPDIR、JMPIND、RET、LCC、JMPTKN及びEXP、並びにLAR更新フラグ信号601を受け、図20に示した状態デコード表に従って、分岐先アドレスロードイネーブル信号(TPCLDEN)201及びトレース状態ポート(PCST)901に出力する符号204を決定する。
FIG. 20 shows a state decoding table of the trace
一方、本実施形態に係る開発支援装置は、図48に示した開発支援装置と同様の構成をしている。しかし、実行履歴復元部としてのホストコンピュータ3の動作が従来とは異なる。これについては後述する。
On the other hand, the development support apparatus according to the present embodiment has the same configuration as the development support apparatus shown in FIG. However, the operation of the
次に、本実施形態に係る半導体集積回路1及び開発支援装置によるトレース情報出力及び実行履歴復元について、図21に示したプログラムを実行する場合を例に説明する。この例では、半導体集積回路1は、アドレス"0x50000000"(実行順番"1")からプログラム実行及びトレースを開始し、アドレス"0x50000004"(実行順番"2")の命令"setlb"によって、レジスタ150にループ"loop0"の分岐先アドレス"0x50000008"を、レジスタ160に同ループの先頭の命令"命令2"を、それぞれ格納する。そして、アドレス"0x50000010"(実行順番"5"及び"8")のレジスタ間接分岐命令"leq"によってループを2回実行した後、3回目のループ実行中に割込みを受理し、アドレス"0x40000100"(実行順番"10")の割り込みハンドラ"int0h"の実行を開始する。割り込みハンドラ"int0h"において、レジスタ間接分岐命令"lne"を伴う別のループ"loop1"を2回実行した後、先ほどのループ"loop0"に復帰し、4回目のループを実行した後、同ループは終了する。
Next, trace information output and execution history restoration by the semiconductor integrated
図22は、半導体集積回路1が図21に示したプログラムを実行したときに出力するトレース情報を示す。図22に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。
FIG. 22 shows trace information output when the semiconductor integrated
CPU100がアドレス"0x50000004"(実行順番"2")の命令"setlb"を実行したとき、LAR更新信号130がアサートされ、LAR更新フラグ信号601がアサートされるが、信号LCC及びJMPTKNはまだアサートされないため、トレースパケット制御部200は、図20に示した状態デコード表に従って、符号204として"SEQ"を出力する。その後、アドレス"0x50000010"(実行順番"5")のレジスタ間接分岐命令"leq"を実行したとき、LAR更新フラグ信号601及び信号LCC及びJMPTKNがアサートされるため、符号204として"JMP"が出力されるとともに、データ701としてアドレス"0x50000008"が出力される。
When the
アドレス"0x50000010"(実行順番"5")のレジスタ間接分岐命令"leq"が実行されてから1サイクル後に、保持回路610がリセットされ、LAR更新フラグ信号601がネゲートされる。これにより、CPU100がアドレス"0x50000010"(実行順番"8")のレジスタ間接分岐命令"leq"を実行したとき、信号LCC及びJMPTKNはアサートされるが、LAR更新フラグ信号601がネゲートされているため、図20に示した状態デコード表に従って、トレースパケット制御部200から符号204として"NPC"が出力されるのみである。
One cycle after the execution of the register indirect branch instruction “leq” at the address “0x50000010” (execution order “5”), the holding
CPU100が割込みを受理して分岐を実行し、割込みハンドラ"int0h"に処理が移った後、同様に、CPU100がアドレス"0x40000104"(実行順番"11")の命令"setlb"を実行したとき、LAR更新信号130がアサートされ、LAR更新フラグ信号601がアサートされるが、信号LCC及びJMPTKNはまだアサートされないため、トレースパケット制御部200は、図20に示した状態デコード表に従って、符号204として"SEQ"を出力する。その後、CPU100がアドレス"0x40000110"(実行順番"14")のレジスタ間接分岐命令"lne"を実行したとき、この命令は、ループ"loop1"における初回の高速分岐命令であるため、符号204として"JMP"が出力されるとともに、データ701として"0x40000108"が出力される。一方、同じレジスタ間接分岐命令"lne"でも、実行順番"17"のとき、分岐条件が成立しないため、信号JMPTKNはアサートされず、符号204として"SEQ"が出力される。
Similarly, after the
CPU100がアドレス"0x40000114"(実行順番"18")の命令"movm (sp),regs"を実行したとき、LAR更新信号130がアサートされ、LAR更新フラグ信号601がアサートされる。そして、CPU100がアドレス"0x50000010"(実行順番"21")のレジスタ間接分岐命令"leq"を実行したとき、この命令は、ループ"loop0"における初回のレジスタ間接分岐命令ではないが、LAR更新フラグ信号601がアサートされ、また、信号LCC及びJMPTKNがアサートされるため、符号204として"JMP"が出力されるとともに、データ701としてアドレス"0x50000008"が出力される。その後、CPU100が実行順番"24"のレジスタ間接分岐命令"leq"を実行したとき、分岐条件が成立しないため、信号JMPTKNはアサートされず、符号204として"SEQ"が出力される。
When the
以上の動作によって、本実施形態に係る半導体集積回路1から、図22に示したトレース情報が出力される。
With the above operation, the trace information shown in FIG. 22 is output from the semiconductor integrated
一方、図23及び図24は、本実施形態に係る開発支援装置によって実行される実行履歴復元方法のフローチャートである。また、図25は、本実施形態に係る開発支援装置によって復元されたプログラム実行履歴を示す。図25に示したプログラム実行履歴は、以下に説明する実行履歴復元方法の実行の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。 On the other hand, FIG. 23 and FIG. 24 are flowcharts of the execution history restoration method executed by the development support apparatus according to the present embodiment. FIG. 25 shows a program execution history restored by the development support apparatus according to the present embodiment. The program execution history shown in FIG. 25 is obtained as a result of execution of the execution history restoring method described below. A characteristic part of this embodiment will be described.
TP=4のとき、トレース情報に示された符号は"JMP"であり(ステップ2007,2008及び2017)、ソースプログラムに示された命令はレジスタ間接分岐命令"leq"(LCC)であることから(ステップ2018,2020及び2022)、ステップ2023でソフトウェア的に実現された模擬ループアドレスレジスタ(以下、ソフトLARと称する)に、トレース情報に示されたTP=4に対応する分岐先アドレス"0x50000008"が格納される。その後、ステップ2028でIPがトレース情報に示されたTP=4に対応する分岐先アドレス"0x50000008"に設定され(IP=0x50000008)、ステップ2034でTPがインクリメントされた後(TP=5)、ステップ2006に戻る。TP=14,21のときも同様に処理される。
When TP = 4, the sign shown in the trace information is “JMP” (
一方、TP=7のとき、トレース情報に示された符号は"NPC"であり(ステップ2007及び2008)、ソースプログラムに示された命令はTP=4のときと同じくレジスタ間接分岐命令"leq"(LCC)であることから(ステップ2009及び2012)、ステップ2013でIPがソフトLARに格納された分岐先アドレス"0x50000008"に設定される(IP=0x50000008)。そして、ステップ2034でTPがインクリメントされた後(TP=8)、ステップ2006に戻る。
On the other hand, when TP = 7, the sign shown in the trace information is “NPC” (
以上の処理によって、本実施形態に係る開発支援装置によって、図25に示したプログラム実行履歴が復元される。 Through the above processing, the program execution history shown in FIG. 25 is restored by the development support apparatus according to the present embodiment.
以上、本実施形態によると、レジスタ間接分岐命令を含むループ処理において、初回のレジスタ間接分岐命令の実行に対して、トレース情報としてその分岐先アドレスが出力され、2回目以降のレジスタ間接分岐命令の実行に対してはトレース情報として分岐先アドレスが出力されないため、トレース情報出力に関してバンド幅が圧迫されることがない。すなわち、レジスタ間接分岐命令を実装した半導体集積回路のトレース情報出力が最適化され、半導体集積回路を実際の動作条件で動作させてトレースした場合であっても、正確なプログラム実行履歴を復元することができる。 As described above, according to the present embodiment, in the loop processing including the register indirect branch instruction, the branch destination address is output as trace information for the first execution of the register indirect branch instruction, and the second and subsequent register indirect branch instructions are output. For execution, since the branch destination address is not output as trace information, the bandwidth is not compressed for the output of trace information. In other words, the trace information output of the semiconductor integrated circuit that implements the register indirect branch instruction is optimized, and even when the semiconductor integrated circuit is traced by operating under actual operating conditions, the accurate program execution history can be restored. Can do.
(第4の実施形態)
図26は、本発明の第4の実施形態に係る半導体集積回路の構成を示す。本実施形態に係る半導体集積回路1は、第3の実施形態に係る半導体集積回路に、第2の実施形態で説明した同期要求要求生成回路800及びセレクタ750を追加した構成をしている。以下、第2及び第3の実施形態に係る半導体集積回路と比較して異なる部分について説明する。
(Fourth embodiment)
FIG. 26 shows a configuration of a semiconductor integrated circuit according to the fourth embodiment of the present invention. The semiconductor integrated
ループ検出回路600におけるOR回路650は、LAR更新信号130及び同期要求信号801の論理和を演算し、この論理和は保持回路610のセット信号となる。すなわち、同期要求信号801がアサートされると、信号LCC及びJMPTKNが次にアサートされるまで、LAR更新フラグ信号601がアサートされる。なお、同期要求信号801がアサートされるタイミングは、第2の実施形態で説明したとおりである。
The OR
図27は、トレースパケット制御部200の状態デコード表を示す。本実施形態に係るトレースパケット制御部200は、第3の実施形態と比較して、入力として同期要求信号801が、出力として選択信号(TPCSEL)202が追加されている。また、出力符号として"SYN"及び"JMPS"が追加されている。
FIG. 27 shows a state decoding table of the trace
一方、本実施形態に係る開発支援装置は、図48に示した開発支援装置と同様の構成をしている。しかし、実行履歴復元部としてのホストコンピュータ3の動作が従来とは異なる。これについては後述する。
On the other hand, the development support apparatus according to the present embodiment has the same configuration as the development support apparatus shown in FIG. However, the operation of the
次に、本実施形態に係る半導体集積回路1及び開発支援装置によるトレース情報出力及び実行履歴復元について、図28に示したプログラムを実行する場合を例に説明する。この例では、半導体集積回路1は、ループ"loop0"を4回実行するうち、2回目の実行のとき、実行順番"6"でトレースが開始される。
Next, trace information output and execution history restoration by the semiconductor integrated
図29は、半導体集積回路1が図28に示したプログラムを実行したときに出力するトレース情報を示す。図29に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。
FIG. 29 shows trace information output when the semiconductor integrated
実行順番"6"のときトレースが開始され、同期要求信号801がアサートされ、LAR更新フラグ信号601がアサートされる。CPU100がアドレス"0x40000008"(実行順番"6")の命令"命令2"を実行したとき、信号EOIがアサートされるとともに実行アドレス111("0x40000008")が出力される。このとき、信号LCCはアサートされず、図27に示した状態デコード表に従って、トレースパケット制御部200は、信号TPCLDENをアサートし、信号TPCSELの値を"0"に設定し、符号204として"SYN"を出力する。また、シフトレジスタ700からはこのときの実行アドレス"0x40000008"がデータ701として出力される。
When the execution order is “6”, tracing is started, the
その後、CPU100がアドレス"0x40000010"(実行順番"8")のレジスタ間接分岐命令"leq"を実行したとき、信号LCC及びJMPTKNがアサートされる。このとき、LAR更新フラグ信号601がアサートされており、符号204として"JMP"が出力されるとともに、データ701として分岐先アドレス"0x40000008"が出力される。
Thereafter, when the
一方、図30及び図31は、本実施形態に係る開発支援装置によって実行される実行履歴復元方法のフローチャートである。また、図32は、本実施形態に係る開発支援装置によって復元されたプログラム実行履歴を示す。図32に示したプログラム実行履歴は、以下に説明する実行履歴復元方法の実行の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。 On the other hand, FIGS. 30 and 31 are flowcharts of an execution history restoration method executed by the development support apparatus according to the present embodiment. FIG. 32 shows a program execution history restored by the development support apparatus according to the present embodiment. The program execution history shown in FIG. 32 is obtained as a result of execution of the execution history restoring method described below. A characteristic part of this embodiment will be described.
TP=0のとき、トレース情報に示された符号は"SYN"であるため(ステップ2002)、ステップ2003で、IPがトレース情報に示されたTP=0に対応する実行アドレス"0x40000008"に設定され(IP=0x40000008)、ステップ2006に進む。
When TP = 0, the sign indicated in the trace information is “SYN” (step 2002), so in
TP=2のとき、トレース情報に示された符号は"JMP"であり(ステップ2007,2008及び2017)、ソースプログラムに示された命令はレジスタ間接分岐命令"leq"(LCC)であることから(ステップ2018,2020及び2022)、ステップ2023でソフトLARに、トレース情報に示されたTP=4に対応する分岐先アドレス"0x40000008"が格納される。その後、ステップ2028でIPがトレース情報に示されたTP=4に対応する分岐先アドレス"0x40000008"に設定され(IP=0x40000008)、ステップ2034でTPがインクリメントされた後(TP=3)、ステップ2006に戻る。
When TP = 2, the sign indicated in the trace information is “JMP” (
一方、TP=5のとき、トレース情報に示された符号は"NPC"であり(ステップ2007及び2008)、ソースプログラムに示された命令はTP=2のときと同じくレジスタ間接分岐命令"leq"(LCC)であることから(ステップ2009及び2012)、ステップ2013でIPがソフトLARに格納された分岐先アドレス"0x40000008"に設定される(IP=0x40000008)。そして、ステップ2034でTPがインクリメントされた後(TP=6)、ステップ2006に戻る。
On the other hand, when TP = 5, the sign shown in the trace information is “NPC” (
次に、本実施形態に係る半導体集積回路1によるトレース情報出力及び開発支援装置による実行履歴復元の別例について、図33に示したプログラムを実行する場合を例に説明する。この例は、プログラム自体は図28に示した先の例と同じであるが、トレースの開始が先の例よりも1命令前のアドレス"0x40000010"(実行順番"5")の命令から始まっている。
Next, another example of trace information output by the semiconductor integrated
図34は、半導体集積回路1が図33に示したプログラムを実行したときに出力するトレース情報を示す。図34に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。
FIG. 34 shows trace information output when the semiconductor integrated
先の例とは異なり、TP=0のとき、トレース情報に示された符号は"JMPS"であるため(ステップ2001及び2002)、ステップ2004でIPがトレース情報に示されたTP=0に対応する分岐先アドレス"0x40000008"に設定され(IP=0x40000008)、ステップ2005でTPがインクリメントされた後(TP=1)、ステップ2006に進む。以降の処理は、先の例と同様である。
Unlike the previous example, when TP = 0, the code indicated in the trace information is “JMPS” (
以上、本実施形態によると、プログラムの実行が開始された後にトレースが開始された場合であっても、トレース開始時の実行アドレス又は分岐先アドレスが出力され、また、ループ処理の途中でトレースが開始された場合、トレース開始後にループ先頭に分岐する間接分岐命令が初めて実行されたとき、その分岐先アドレスが出力される。これにより、プログラム実行の途中からトレースが開始されても、トレース開始時のプログラム部分を復元し、さらに、高速分岐命令を含むループのプログラム部分の実行履歴がが正確に復元される。 As described above, according to the present embodiment, even when the trace is started after the execution of the program is started, the execution address or the branch destination address at the start of the trace is output, and the trace is performed during the loop processing. When started, when the indirect branch instruction that branches to the top of the loop after the trace starts is executed for the first time, the branch destination address is output. As a result, even when tracing is started in the middle of program execution, the program portion at the start of tracing is restored, and the execution history of the program portion of the loop including the high-speed branch instruction is accurately restored.
(第5の実施形態)
図36は、本発明の第5の実施形態に係る半導体集積回路の構成を示す。本実施形態に係る半導体集積回路1は、CPU100、トレースパケット制御部200、比較器400、アドレスレジスタ670、シフトレジスタ700、セレクタ750、及び同期要求生成回路800を備えている。このうち、シフトレジスタ700、セレクタ750、及び同期要求生成回路800は、第2の実施形態の場合と同様である。以下、CPU100、比較器400、及びアドレスレジスタ670について説明する。
(Fifth embodiment)
FIG. 36 shows a configuration of a semiconductor integrated circuit according to the fifth embodiment of the present invention. The semiconductor integrated
CPU100は、高速分岐命令として、図示しない汎用のレジスタに格納された分岐先アドレスに分岐する間接分岐命令を実装している。CPU100は、分岐条件が成立し、間接分岐命令を実行したとき、信号JMPIND及びJMPTKNをアサートし、その分岐先アドレス110を出力する。また、CPU100は、命令を実行したとき、その命令の実行アドレス111を出力する。これ以外の点については、一部の信号を省略している以外は、第2の実施形態の場合と同様である。
The
アドレスレジスタ670は、AND回路660によって演算された信号JMPIND及びJMPTKNの論理積をロード信号661として、CPU100から出力された分岐先アドレス110をデータとして、それぞれ受ける。すなわち、アドレスレジスタ670は、CPU100によって間接分岐命令令が実行されたとき、格納しているアドレスを出力し、分岐先アドレス110を格納する。また、アドレスレジスタ670は、同期要求信号801がアサートされたとき、格納している内容を初期化する。
The
比較器400は、アドレスレジスタ670から出力されたデータ671とCPU100から出力された分岐先アドレス110とを比較し、これらの一致/不一致を比較結果信号401として出力する。比較結果信号401は、一致のときはアサートされ、不一致のときはネゲートされる。
The
図37は、トレースパケット制御部200の状態デコード表を示す。トレースパケット制御部200は、信号EOI、JMPDIR、JMPIND、JMPTKN及びEXP、並びに比較結果信号401及び同期要求信号801を受け、図37に示した状態デコード表に従って、分岐先アドレスロードイネーブル信号(TPCLDEN)201、選択信号(TPCSEL)202、及びトレース状態ポート(PCST)901に出力する符号204を決定する。
FIG. 37 shows a state decoding table of the trace
一方、本実施形態に係る開発支援装置は、図48に示した開発支援装置と同様の構成をしている。しかし、実行履歴復元部としてのホストコンピュータ3の動作が従来とは異なる。これについては後述する。
On the other hand, the development support apparatus according to the present embodiment has the same configuration as the development support apparatus shown in FIG. However, the operation of the
次に、本実施形態に係る半導体集積回路1及び開発支援装置によるトレース情報出力及び実行履歴復元について、図38に示したプログラムを実行する場合を例に説明する。この例では、半導体集積回路1は、ループ"loop0"を4回実行するうち、2回目の実行のとき、実行順番"6"でトレースが開始される。
Next, trace information output and execution history restoration by the semiconductor integrated
図39は、半導体集積回路1が図38に示したプログラムを実行したときに出力するトレース情報を示す。図39に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。
FIG. 39 shows trace information output when the semiconductor integrated
CPU100がアドレス"0x40000010"(実行順番"5")の間接分岐命令"beq (a0)"を実行したとき、信号JMPIND及びJMPTKNがアサートされ、アドレスレジスタ670に分岐先アドレス110("0x40000008")が格納される。なお、命令"beq (a0)"は、条件が成立したとき、レジスタ"a0"に格納した分岐先アドレスに分岐するといった間接分岐命令である。
When the
次に、実行順番"6"のときトレースが開始され、同期要求信号801がアサートされ、アドレスレジスタ670が初期化される。CPU100がアドレス"0x40000008"(実行順番"6")の命令"命令2"を実行したとき、信号EOIがアサートされるとともに実行アドレス111("0x40000008")が出力される。このとき、信号JMPIND及びJMPTKNはアサートされず、図37に示した状態デコード表に従って、トレースパケット制御部200は、信号TPCLDENをアサートし、信号TPCSELの値を"0"に設定し、符号204として"SYN"を出力する。また、シフトレジスタ700からは実行順番"6"の命令"命令2"の実行アドレス"0x40000008"がデータ701として出力される。
Next, when the execution order is “6”, tracing is started, the
その後、CPU100がアドレス"0x40000010"(実行順番"8")の間接分岐命令"beq (a0)"を実行したとき、信号JMPIND及びJMPTKNがアサートされ、アドレスレジスタ670に格納されているアドレスと分岐先アドレス110とが比較される。アドレスレジスタ670は、トレース開始時に初期化されているため、これら両アドレスは一致せず、比較結果信号401はアサートされない。これにより、トレースパケット制御部200は、図37に示した状態デコード表に従って、信号TPCLDENをアサートし、信号TPCSELの値を"1"に設定し、符号204として"JMP"を出力する。また、シフトレジスタ700からは実行順番"6"の命令"命令2"の実行アドレス"0x40000008"がデータ701として出力される。
Thereafter, when the
一方、CPU100がアドレス"0x40000010"(実行順番"11")の間接分岐命令"beq (a0)"を実行したとき、信号JMPIND及びJMPTKNがアサートされ、アドレスレジスタ670に格納されているアドレスと分岐先アドレス110"0x40000008"とが比較される。アドレスレジスタ670には、実行順番"8"の間接分岐命令"beq (a0)"の実行によってアドレス"0x40000008"が格納されているため、これらの両アドレスは一致し、比較結果信号401がアサートされる。これにより、図37に示した状態デコード表に従って、符号204として"NPC"が出力される。このとき、シフトレジスタ700からデータ701は出力されない。
On the other hand, when the
以上の動作によって、本実施形態に係る半導体集積回路1から、図39に示したトレース情報が出力される。
With the above operation, the trace information shown in FIG. 39 is output from the semiconductor integrated
一方、図40及び図41は、本実施形態に係る開発支援装置によって実行される実行履歴復元方法のフローチャートである。また、図42は、本実施形態に係る開発支援装置によって復元されたプログラム実行履歴を示す。図42に示したプログラム実行履歴は、以下に説明する実行履歴復元方法の実行の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。 On the other hand, FIGS. 40 and 41 are flowcharts of the execution history restoration method executed by the development support apparatus according to the present embodiment. FIG. 42 shows a program execution history restored by the development support apparatus according to the present embodiment. The program execution history shown in FIG. 42 is obtained as a result of execution of the execution history restoration method described below. A characteristic part of this embodiment will be described.
TP=0のとき、トレース情報に示された符号は"SYN"であるため(ステップ2002)、ステップ2003で、IPがトレース情報に示されたTP=0に対応する実行アドレス"0x40000008"に設定され(IP=0x40000008)、ステップ2006に進む。
When TP = 0, the sign indicated in the trace information is “SYN” (step 2002), so in
TP=2のとき、トレース情報に示された符号は"JMP"であり(ステップ2007,2008及び2017)、ソースプログラムに示された命令は間接分岐命令"beq (a0)"であることから(ステップ2018,2020及び2042)、ステップ2043でソフトウェア的に実現された模擬レジスタ(以下、ソフトレジスタと称する)に、トレース情報に示されたTP=4に対応する分岐先アドレス"0x40000008"が格納される。その後、ステップ2028でIPがトレース情報に示されたTP=4に対応する分岐先アドレス"0x40000008"に設定され(IP=0x40000008)、ステップ2034でTPがインクリメントされた後(TP=3)、ステップ2006に戻る。
When TP = 2, the sign shown in the trace information is “JMP” (
一方、TP=5のとき、トレース情報に示された符号は"NPC"であり(ステップ2007及び2008)、ソースプログラムに示された命令はTP=2のときと同じく間接分岐命令"beq (a0)"であることから(ステップ2009及び2040)、ステップ2041でIPがソフトレジスタに格納された分岐先アドレス"0x40000008"に設定される(IP=0x40000008)。そして、ステップ2034でTPがインクリメントされた後(TP=6)、ステップ2006に戻る。
On the other hand, when TP = 5, the sign shown in the trace information is “NPC” (
次に、本実施形態に係る半導体集積回路1によるトレース情報出力及び開発支援装置による実行履歴復元の別例について、図43に示したプログラムを実行する場合を例に説明する。この例は、プログラム自体は図38に示した先の例と同じであるが、トレースの開始が先の例よりも1命令前のアドレス"0x40000010"(実行順番"5")の命令から始まっている。
Next, another example of trace information output by the semiconductor integrated
図44は、半導体集積回路1が図43に示したプログラムを実行したときに出力するトレース情報を示す。図44に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。
FIG. 44 shows trace information output when the semiconductor integrated
先の例とは異なり、TP=0のとき、トレース情報に示された符号は"JMPS"であるため(ステップ2001及び2002)、ステップ2004でIPがトレース情報に示されたTP=0に対応する分岐先アドレス"0x40000008"に設定され(IP=0x40000008)、ステップ2005でTPがインクリメントされた後(TP=1)、ステップ2006に進む。以降の処理は、先の例と同様である。
Unlike the previous example, when TP = 0, the code indicated in the trace information is “JMPS” (
以上、本実施形態によると、間接分岐命令を含むループ処理において、初回の間接分岐命令の実行に対して、トレース情報としてその分岐先アドレスが出力され、2回目以降の間接分岐命令の実行に対してはトレース情報として分岐先アドレスが出力されないため、トレース情報出力に関してバンド幅が圧迫されることがない。すなわち、間接分岐命令を実装した半導体集積回路のトレース情報出力が最適化され、半導体集積回路を実際の動作条件で動作させてトレースした場合であっても、正確なプログラム実行履歴を復元することができる。 As described above, according to the present embodiment, in the loop processing including the indirect branch instruction, the branch destination address is output as the trace information for the first indirect branch instruction execution, and the second and subsequent indirect branch instruction executions are performed. In this case, since the branch destination address is not output as the trace information, the bandwidth is not compressed with respect to the output of the trace information. In other words, the trace information output of the semiconductor integrated circuit in which the indirect branch instruction is implemented is optimized, and even when the semiconductor integrated circuit is traced by operating under actual operating conditions, an accurate program execution history can be restored. it can.
さらに、プログラムの実行が開始された後にトレースが開始された場合であっても、トレース開始時の実行アドレス又は分岐先アドレスが出力され、また、ループ処理の途中でトレースが開始された場合、トレース開始後にループ先頭に分岐する間接分岐命令が初めて実行されたとき、ループの先頭アドレスが出力される。これにより、プログラム実行の途中からトレースが開始されても、トレース開始時のプログラム部分を復元し、さらに、高速分岐命令を含むループのプログラム部分の実行履歴がが正確に復元される。 Furthermore, even if tracing is started after program execution has started, the execution address or branch destination address at the start of tracing is output, and if tracing is started during loop processing, tracing When the indirect branch instruction that branches to the top of the loop after the start is executed for the first time, the top address of the loop is output. As a result, even when tracing is started in the middle of program execution, the program portion at the start of tracing is restored, and the execution history of the program portion of the loop including the high-speed branch instruction is accurately restored.
なお、第1及び第3の実施形態と同様に、同期要求生成回路800及びセレクタ750を備えない構成として、本発明によって奏されるトレース情報出力の最適化という効果は何ら損なわれない。
As in the first and third embodiments, the configuration that does not include the synchronization
また、上記各実施形態に係る半導体集積回路は、シフトレジスタ700に代えて、保持データをパラレル出力するアドレスレジスタを備えていてもよい。分岐先アドレスをパラレル出力する場合であっても、本発明が奏する効果は何ら損なわれない。
In addition, the semiconductor integrated circuit according to each of the above embodiments may include an address register that outputs retained data in parallel instead of the
また、説明の便宜上、上記各実施形態に係る開発支援装置は、それぞれ、上記各実施形態に係る半導体集積回路から出力されたトレース情報に基づいてプログラム実行履歴を復元するとしたが、上記以外の半導体集積回路から出力されたトレース情報に基づいてプログラム実行履歴を復元することが可能である。 For convenience of explanation, the development support apparatus according to each of the above embodiments restores the program execution history based on the trace information output from the semiconductor integrated circuit according to each of the above embodiments. It is possible to restore the program execution history based on the trace information output from the integrated circuit.
本発明に係る半導体集積回路及び開発支援装置は、プロセッサの動作を外部から解析、評価する手段として有用である。 The semiconductor integrated circuit and the development support apparatus according to the present invention are useful as means for analyzing and evaluating the operation of the processor from the outside.
1 半導体集積回路
100 CPU
300 スタックメモリ
400 比較器
200 トレースパケット制御部
700 シフトレジスタ(アドレスレジスタ、第2のアドレスレジスタ)
800 同期要求生成回路
750 セレクタ
600 ループ検出回路
610 保持回路
620 リセット回路
670 アドレスレジスタ(第1のアドレスレジスタ)
1030 トレースメモリ
3 ホストコンピュータ(実行履歴復元部)
1
300
800 Synchronization
1030
Claims (28)
前記第1及び第2の信号のいずれかがアサートされたとき、前記CPUから出力された復帰先アドレスをプッシュし、前記第3の信号がアサートされたとき、プッシュされている復帰先アドレスをポップするスタックメモリと、
前記スタックメモリからポップされた復帰先アドレスと前記CPUから出力された分岐先アドレスとを比較する比較器と、
前記CPUから前記第1から第3の信号を含む複数の信号を受け、当該複数の信号に基づいてトレース状態符号を出力するトレースパケット制御部と、
前記CPUから出力された分岐先アドレスを受け、前記トレースパケット制御部の制御により当該アドレスを出力するアドレスレジスタとを備え、
前記トレースパケット制御部は、前記第3の信号がアサートされ、かつ、前記比較器から受けた比較結果が不一致を示すとき、前記アドレスレジスタにアドレス出力を指示する
ことを特徴とする半導体集積回路。 When the call instruction is executed, the first signal is asserted and the branch destination address and the return destination address related to the call instruction are output. When the interrupt branch is executed, the second signal is asserted and the interrupt branch is set. A CPU that outputs the branch destination address and the return destination address and outputs a branch destination address related to the return instruction while asserting a third signal when the return instruction is executed;
When one of the first and second signals is asserted, the return address output from the CPU is pushed, and when the third signal is asserted, the pushed return address is popped. Stack memory to
A comparator that compares the return destination address popped from the stack memory with the branch destination address output from the CPU;
A trace packet control unit that receives a plurality of signals including the first to third signals from the CPU and outputs a trace state code based on the plurality of signals;
An address register that receives a branch destination address output from the CPU and outputs the address under the control of the trace packet control unit;
The trace packet control unit instructs the address register to output an address when the third signal is asserted and the comparison result received from the comparator indicates a mismatch.
前記トレースパケット制御部は、前記第3の信号がアサートされ、かつ、前記スタックメモリにアンダーフローが発生しているとき、前記アドレスレジスタにアドレス出力を指示する
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 1,
The trace packet control unit instructs the address register to output an address when the third signal is asserted and an underflow occurs in the stack memory.
トレースが開始されたとき、第4の信号をアサートする同期要求生成回路を備え、
前記スタックメモリは、前記第4の信号がアサートされたとき、記憶内容を初期化する
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 1,
A synchronization request generation circuit for asserting a fourth signal when tracing is started;
The stack memory initializes stored contents when the fourth signal is asserted. A semiconductor integrated circuit, wherein:
前記CPUは、命令を実行したとき、当該実行した命令の実行アドレスを出力するものであり、
当該半導体集積回路は、
前記CPUから出力された分岐先アドレス及び実行アドレスのいずれか一方を選択的に出力するセレクタを備え、
前記アドレスレジスタは、前記CPUから出力された分岐先アドレスに代えて、前記セレクタから出力されたアドレスを受け、前記トレースパケット制御部の制御により当該アドレスを出力するものであり、
前記トレースパケット制御部は、前記第4の信号がアサートされたとき、トレース状態符号としてトレース開始を示す符号を出力し、さらに、前記第1及び第2の信号がネゲートされているとき、前記セレクタに前記実行アドレスの選択を指示する一方、これ以外のとき、前記セレクタに、前記分岐先アドレスの選択を指示するものである
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 3,
When the CPU executes an instruction, it outputs an execution address of the executed instruction,
The semiconductor integrated circuit is
A selector that selectively outputs one of a branch destination address and an execution address output from the CPU;
The address register receives the address output from the selector instead of the branch destination address output from the CPU, and outputs the address under the control of the trace packet control unit,
The trace packet control unit outputs a code indicating a trace start as a trace status code when the fourth signal is asserted, and further, when the first and second signals are negated, the selector In the semiconductor integrated circuit, the selection of the execution address is instructed, and in other cases, the selector is instructed to select the branch destination address.
前記同期要求生成回路は、システムリセット、タスク切り替え、及びトレース開始の少なくともいずれかのとき、前記第4の信号をアサートする
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 3,
The synchronization request generation circuit asserts the fourth signal at least one of system reset, task switching, and trace start.
前記同期要求生成回路は、外部から指示があったとき、前記第4の信号をアサートする
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 3,
The synchronization request generation circuit asserts the fourth signal when instructed from outside.
前記同期要求生成回路は、一定周期で、前記第4の信号をアサートする
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 3,
The synchronization request generation circuit asserts the fourth signal at a constant period.
前記第1の信号がアサートされてから前記第2の信号がアサートされるまでの間、第3の信号をアサートするループ検出回路と、
前記CPUから前記第2の信号を含む複数の信号を受け、当該複数の信号に基づいてトレース状態符号を出力するトレースパケット制御部と、
前記CPUから出力された分岐先アドレスを受け、前記トレースパケット制御部の制御により当該アドレスを出力するアドレスレジスタとを備え、
前記トレースパケット制御部は、前記第2及び第3の信号がアサートされたとき、前記アドレスレジスタにアドレス出力を指示する
ことを特徴とする半導体集積回路。 A CPU having an indirect branch instruction that branches to a branch destination address stored in a register, asserts a first signal when the register is updated, and outputs a second signal when the indirect branch instruction is executed. CPU that asserts and outputs a branch destination address related to the indirect branch instruction;
A loop detection circuit that asserts a third signal between the assertion of the first signal and the assertion of the second signal;
A trace packet control unit that receives a plurality of signals including the second signal from the CPU and outputs a trace status code based on the plurality of signals;
An address register that receives a branch destination address output from the CPU and outputs the address under the control of the trace packet control unit;
The trace packet control unit instructs the address register to output an address when the second and third signals are asserted.
前記ループ検出回路は、
前記第1の信号がアサートされたとき、前記第3の信号をアサートされた状態に保持する保持回路と、
前記第2の信号がアサートされたとき、前記保持回路によって保持された状態をリセットするリセット回路とを有する
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 8, wherein
The loop detection circuit
A holding circuit for holding the third signal in an asserted state when the first signal is asserted;
And a reset circuit that resets the state held by the holding circuit when the second signal is asserted.
トレースが開始されたとき、第4の信号をアサートする同期要求生成回路を備え、
前記ループ検出回路は、前記第4の信号がアサートされてから前記第2の信号がアサートされるまでの間、前記第3の信号をアサートする
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 8, wherein
A synchronization request generation circuit for asserting a fourth signal when tracing is started;
The semiconductor integrated circuit, wherein the loop detection circuit asserts the third signal between the assertion of the fourth signal and the assertion of the second signal.
前記CPUは、命令を実行したとき、当該実行した命令の実行アドレスを出力するものであり、
当該半導体集積回路は、
前記CPUから出力された分岐先アドレス及び実行アドレスのいずれか一方を選択的に出力するセレクタを備え、
前記アドレスレジスタは、前記CPUから出力された分岐先アドレスに代えて、前記セレクタから出力されたアドレスを受け、前記トレースパケット制御部の制御により当該アドレスを出力するものであり、
前記トレースパケット制御部は、前記第4の信号がアサートされたとき、トレース状態符号としてトレース開始を示す符号を出力し、さらに、前記第2の信号がネゲートされているとき、前記セレクタに前記実行アドレスの選択を指示する一方、これ以外のとき、前記セレクタに、前記分岐先アドレスの選択を指示するものである
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 10,
When the CPU executes an instruction, it outputs an execution address of the executed instruction,
The semiconductor integrated circuit is
A selector that selectively outputs one of a branch destination address and an execution address output from the CPU;
The address register receives the address output from the selector instead of the branch destination address output from the CPU, and outputs the address under the control of the trace packet control unit,
The trace packet control unit outputs a code indicating a trace start as a trace status code when the fourth signal is asserted, and further, when the second signal is negated, executes the execution to the selector. A semiconductor integrated circuit characterized by instructing selection of an address, and instructing the selector to select the branch destination address at other times.
前記同期要求生成回路は、システムリセット、タスク切り替え、及びトレース開始の少なくともいずれかのとき、前記第4の信号をアサートする
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 10,
The synchronization request generation circuit asserts the fourth signal at least one of system reset, task switching, and trace start.
前記同期要求生成回路は、外部から指示があったとき、前記第4の信号をアサートする
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 10,
The synchronization request generation circuit asserts the fourth signal when instructed from outside.
前記同期要求生成回路は、一定周期で、前記第4の信号をアサートする
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 10,
The synchronization request generation circuit asserts the fourth signal at a constant period.
前記第1の信号がアサートされたとき、格納しているアドレスを出力し、前記CPUから出力された分岐先アドレスを格納する第1のアドレスレジスタと、
前記第1のアドレスレジスタから出力された分岐先アドレスと前記CPUから出力された分岐先アドレスとを比較する比較器と、
前記CPUから前記第1の信号を含む複数の信号を受け、当該複数の信号に基づいてトレース状態符号を出力するトレースパケット制御部と、
前記CPUから出力された分岐先アドレスを受け、前記トレースパケット制御部の制御により当該アドレスを出力する第2のアドレスレジスタとを備え、
前記トレースパケット制御部は、前記第1の信号がアサートされ、かつ、前記比較器から受けた比較結果が不一致を示すとき、前記第2のアドレスレジスタにアドレス出力を指示する
ことを特徴とする半導体集積回路。 A CPU having an indirect branch instruction that branches to a branch destination address stored in a register, and when the indirect branch instruction is executed, asserts a first signal and outputs a branch destination address related to the indirect branch instruction CPU,
A first address register that outputs a stored address when the first signal is asserted, and stores a branch destination address output from the CPU;
A comparator that compares the branch destination address output from the first address register with the branch destination address output from the CPU;
A trace packet controller that receives a plurality of signals including the first signal from the CPU and outputs a trace status code based on the plurality of signals;
A second address register that receives the branch destination address output from the CPU and outputs the address under the control of the trace packet control unit;
The trace packet control unit instructs the second address register to output an address when the first signal is asserted and the comparison result received from the comparator indicates a mismatch. Integrated circuit.
トレースが開始されたとき、第2の信号をアサートする同期要求生成回路を備え、
前記第1のアドレスレジスタは、前記第2の信号がアサートされたとき、記憶内容を初期化する
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 15, wherein
A synchronization request generation circuit that asserts a second signal when tracing is started;
The semiconductor integrated circuit according to claim 1, wherein the first address register initializes stored contents when the second signal is asserted.
前記CPUは、命令を実行したとき、当該実行した命令の実行アドレスを出力するものであり、
当該半導体集積回路は、
前記CPUから出力された分岐先アドレス及び実行アドレスのいずれか一方を選択的に出力するセレクタを備え、
前記第2のアドレスレジスタは、前記CPUから出力された分岐先アドレスに代えて、前記セレクタから出力されたアドレスを受け、前記トレースパケット制御部の制御により当該アドレスを出力するものであり、
前記トレースパケット制御部は、前記第2の信号がアサートされたとき、トレース状態符号としてトレース開始を示す符号を出力し、さらに、前記第1の信号がネゲートされているとき、前記セレクタに前記実行アドレスの選択を指示する一方、これ以外のとき、前記セレクタに、前記分岐先アドレスの選択を指示するものである
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 16, wherein
When the CPU executes an instruction, it outputs an execution address of the executed instruction,
The semiconductor integrated circuit is
A selector that selectively outputs one of a branch destination address and an execution address output from the CPU;
The second address register receives the address output from the selector instead of the branch destination address output from the CPU, and outputs the address under the control of the trace packet control unit,
The trace packet control unit outputs a code indicating a trace start as a trace status code when the second signal is asserted, and further, when the first signal is negated, executes the execution to the selector. A semiconductor integrated circuit characterized by instructing selection of an address, and instructing the selector to select the branch destination address at other times.
前記同期要求生成回路は、システムリセット、タスク切り替え、及びトレース開始の少なくともいずれかのとき、前記第2の信号をアサートする
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 16, wherein
The synchronization request generation circuit asserts the second signal at least one of system reset, task switching, and trace start.
前記同期要求生成回路は、外部から指示があったとき、前記第2の信号をアサートする
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 16, wherein
The synchronization request generation circuit asserts the second signal when instructed from the outside.
前記同期要求生成回路は、一定周期で、前記第2の信号をアサートする
ことを特徴とする半導体集積回路。 The semiconductor integrated circuit according to claim 16, wherein
The synchronization request generation circuit asserts the second signal at a constant cycle.
前記半導体集積回路におけるCPUによって実行されたソースプログラムと前記トレースメモリに格納されたトレース情報とを順に対応させながら、前記CPUによる前記ソースプログラムの実行履歴を復元する実行履歴復元部とを備え、
前記実行履歴復元部は、
前記ソースプログラムからコール命令を検出したとき及び前記トレース情報から割込み分岐の実行を示す符号を検出したときのいずれかのとき、前記ソースプログラムから復帰先アドレスを得てプッシュするとともに前記トレース情報から分岐先アドレスを得て復元し、前記ソースプログラムから復帰命令を検出したとき、プッシュされている復帰先アドレスをポップして復元する
ことを特徴とする開発支援装置。 A trace memory that stores the trace status code and address output from the semiconductor integrated circuit according to claim 1 as trace information;
An execution history restoring unit that restores the execution history of the source program by the CPU while sequentially corresponding the source program executed by the CPU in the semiconductor integrated circuit and the trace information stored in the trace memory;
The execution history restoration unit
When a call instruction is detected from the source program or when a code indicating execution of an interrupt branch is detected from the trace information, a return destination address is obtained from the source program and pushed and branched from the trace information A development support apparatus, wherein a destination address is obtained and restored, and when a return instruction is detected from the source program, the pushed return destination address is popped and restored.
前記半導体集積回路におけるCPUによって実行されたソースプログラムと前記トレースメモリに格納されたトレース情報とを順に対応させながら、前記CPUによる前記ソースプログラムの実行履歴を復元する実行履歴復元部とを備え、
前記実行履歴復元部は、
前記ソースプログラムからコール命令を検出したとき及び前記トレース情報から割込み分岐の実行を示す符号を検出したときのいずれかのとき、前記ソースプログラムから復帰先アドレスを得てプッシュするとともに前記トレース情報から分岐先アドレスを得て復元し、前記ソースプログラムから復帰命令を検出したとき、プッシュされている復帰先アドレスをポップして復元するものであり、かつ、
前記トレース情報からトレース開始を示す符号を検出したとき、プッシュしている復帰先アドレスを初期化するとともに、前記トレース情報から当該符号に対応する実行アドレス及び分岐先アドレスのいずれかを得て復元する
ことを特徴とする開発支援装置。 A trace memory for storing a trace state code and an address output from the semiconductor integrated circuit according to claim 4 as trace information;
An execution history restoring unit that restores the execution history of the source program by the CPU while sequentially corresponding the source program executed by the CPU in the semiconductor integrated circuit and the trace information stored in the trace memory;
The execution history restoration unit
When a call instruction is detected from the source program or when a code indicating execution of an interrupt branch is detected from the trace information, a return destination address is obtained from the source program and pushed and branched from the trace information Obtain and restore the destination address, and when the return instruction is detected from the source program, the return destination address being pushed is popped and restored, and
When a code indicating a trace start is detected from the trace information, the return destination address being pushed is initialized, and either the execution address or the branch destination address corresponding to the code is obtained from the trace information and restored. Development support device characterized by that.
前記半導体集積回路におけるCPUによって実行されたソースプログラムと前記トレースメモリに格納されたトレース情報とを順に対応させながら、前記CPUによる前記ソースプログラムの実行履歴を復元する実行履歴復元部とを備え、
前記実行履歴復元部は、
前記ソースプログラムから間接分岐命令を検出し、かつ、前記トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す符号を検出したとき、前記分岐先アドレスを記憶するとともに前記分岐先アドレスを復元し、前記ソースプログラムから間接分岐命令を検出し、かつ、前記トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す符号を検出したとき、前記記憶した分岐先アドレスを復元する
ことを特徴とする開発支援装置。 A trace memory that stores the trace status code and address output from the semiconductor integrated circuit according to any one of claims 8 and 15 as trace information;
An execution history restoring unit that restores the execution history of the source program by the CPU while sequentially corresponding the source program executed by the CPU in the semiconductor integrated circuit and the trace information stored in the trace memory;
The execution history restoration unit
When an indirect branch instruction is detected from the source program and a code indicating execution of an indirect branch instruction with a branch destination address is detected from the trace information, the branch destination address is stored and the branch destination address is restored. When the indirect branch instruction is detected from the source program and the code indicating the execution of the indirect branch instruction without the branch destination address is detected from the trace information, the stored branch destination address is restored. Development support device.
前記半導体集積回路におけるCPUによって実行されたソースプログラムと前記トレースメモリに格納されたトレース情報とを順に対応させながら、前記CPUによる前記ソースプログラムの実行履歴を復元する実行履歴復元部とを備え、
前記実行履歴復元部は、
前記ソースプログラムから間接分岐命令を検出し、かつ、前記トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す符号を検出したとき、前記分岐先アドレスを記憶するとともに前記分岐先アドレスを復元し、前記ソースプログラムから間接分岐命令を検出し、かつ、前記トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す符号を検出したとき、前記記憶した分岐先アドレスを復元するものであり、かつ、
前記トレース情報からトレース開始を示す符号を検出したとき、前記トレース情報から当該符号に対応する実行アドレス及び分岐先アドレスのいずれかを得て復元する
ことを特徴とする開発支援装置。 A trace memory that stores a trace state code and an address output from the semiconductor integrated circuit according to claim 11 as trace information;
An execution history restoring unit that restores the execution history of the source program by the CPU while sequentially corresponding the source program executed by the CPU in the semiconductor integrated circuit and the trace information stored in the trace memory;
The execution history restoration unit
When an indirect branch instruction is detected from the source program and a code indicating execution of an indirect branch instruction with a branch destination address is detected from the trace information, the branch destination address is stored and the branch destination address is restored. When the indirect branch instruction is detected from the source program and the code indicating the execution of the indirect branch instruction without the branch destination address is detected from the trace information, the stored branch destination address is restored. ,And,
When a code indicating a trace start is detected from the trace information, the development support apparatus obtains either the execution address or the branch destination address corresponding to the code from the trace information and restores it.
前記ソースプログラムからコール命令を検出するステップと、
前記トレース情報から割込み分岐の実行を示す符号を検出するステップと、
前記ソースプログラムから復帰命令を検出するステップと、
前記コール命令及び符号のいずれか一方が検出されたとき、前記ソースプログラムから復帰先アドレスを得てプッシュするステップと、
前記コール命令及び符号のいずれか一方が検出されたとき、前記トレース情報から分岐先アドレスを得て復元するステップと、
前記復帰命令が検出されたとき、プッシュされている復帰先アドレスをポップして復元するステップとを備えた
ことを特徴とする実行履歴復元方法。 A trace state code and an address are obtained as trace information from the semiconductor integrated circuit according to claim 1, and the source program executed by the CPU in the semiconductor integrated circuit and the trace information are sequentially associated with the source by the CPU. In the method of restoring the program execution history,
Detecting a call instruction from the source program;
Detecting a code indicating execution of an interrupt branch from the trace information;
Detecting a return instruction from the source program;
When one of the call instruction and the code is detected, obtaining and returning a return destination address from the source program; and
When one of the call instruction and code is detected, obtaining and restoring a branch destination address from the trace information; and
And a step of popping and restoring the pushed return destination address when the return instruction is detected.
前記ソースプログラムからコール命令を検出するステップと、
前記ソースプログラムから復帰命令を検出するステップと、
前記トレース情報から割込み分岐の実行を示す第1の符号を検出するステップと、
前記トレース情報からトレース開始を示す第2の符号を検出するステップと、
前記コール命令及び第1の符号のいずれか一方が検出されたとき、前記ソースプログラムから復帰先アドレスを得てプッシュするステップと、
前記コール命令及び第1の符号のいずれか一方が検出されたとき、前記トレース情報から分岐先アドレスを得て復元するステップと、
前記復帰命令が検出されたとき、プッシュされている復帰先アドレスをポップして復元するステップと、
前記第2の符号が検出されたとき、前記プッシュされた復帰先アドレスを初期化するステップと、
前記第2の符号が検出されたとき、前記トレース情報から前記第2の符号に対応する実行アドレス及び分岐先アドレスのいずれかを得て復元するステップとを備えた
ことを特徴とする実行履歴復元方法。 5. The trace state code and address are obtained as trace information from the semiconductor integrated circuit according to claim 4, and the source program executed by the CPU in the semiconductor integrated circuit and the trace information are sequentially associated with the source by the CPU. In the method of restoring the program execution history,
Detecting a call instruction from the source program;
Detecting a return instruction from the source program;
Detecting a first code indicating execution of an interrupt branch from the trace information;
Detecting a second code indicating a trace start from the trace information;
When one of the call instruction and the first code is detected, obtaining and returning a return destination address from the source program; and
When one of the call instruction and the first code is detected, obtaining and restoring a branch destination address from the trace information; and
Popping and restoring the pushed return destination address when the return instruction is detected; and
Initializing the pushed return address when the second code is detected;
An execution history restoration comprising: obtaining and restoring either an execution address or a branch destination address corresponding to the second code from the trace information when the second code is detected Method.
前記ソースプログラムから間接分岐命令を検出するステップと、
前記トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す第1の符号を検出するステップと、
前記トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す第2の符号を検出するステップと、
前記間接分岐命令及び第1の符号が検出されたとき、前記第1の符号に伴った分岐先アドレスを記憶するステップと、
前記間接分岐命令及び第1の符号が検出されたとき、前記第1の符号に伴った分岐先アドレスを復元するステップと、
前記間接分岐命令及び第2の符号が検出されたとき、前記記憶された分岐先アドレスを復元するステップとを備えた
ことを特徴とする実行履歴復元方法。 A trace status code and an address are obtained as trace information from the semiconductor integrated circuit according to any one of claims 8 and 15, and a source program executed by a CPU in the semiconductor integrated circuit and the trace information are sequentially associated with each other. However, in the method of restoring the execution history of the source program by the CPU,
Detecting an indirect branch instruction from the source program;
Detecting a first code indicating execution of an indirect branch instruction with a branch destination address from the trace information;
Detecting a second code indicating execution of an indirect branch instruction without a branch destination address from the trace information;
Storing the branch destination address associated with the first code when the indirect branch instruction and the first code are detected;
Restoring the branch destination address associated with the first code when the indirect branch instruction and the first code are detected;
An execution history restoring method comprising: restoring the stored branch destination address when the indirect branch instruction and the second code are detected.
前記ソースプログラムから間接分岐命令を検出するステップと、
前記トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す第1の符号を検出するステップと、
前記トレース情報から分岐先アドレスを伴わない間接分岐命令の実行を示す第2の符号を検出するステップと、
前記トレース情報からトレース開始を示す第3の符号を検出するステップと、
前記間接分岐命令及び第1の符号が検出されたとき、前記第1の符号に伴った分岐先アドレスを記憶するステップと、
前記間接分岐命令及び第1の符号が検出されたとき、前記第1の符号に伴った分岐先アドレスを復元するステップと、
前記間接分岐命令及び第2の符号が検出されたとき、前記記憶された分岐先アドレスを復元するステップと、
前記第3の符号が検出されたとき、前記トレース情報から前記第3の符号に対応する実行アドレス及び分岐先アドレスのいずれかを得て復元するステップとを備えた
ことを特徴とする実行履歴復元方法。
A trace state code and an address are obtained as trace information from the semiconductor integrated circuit according to claim 11, and a source program executed by a CPU in the semiconductor integrated circuit and the trace information are sequentially associated with each other. However, in the method of restoring the execution history of the source program by the CPU,
Detecting an indirect branch instruction from the source program;
Detecting a first code indicating execution of an indirect branch instruction with a branch destination address from the trace information;
Detecting a second code indicating execution of an indirect branch instruction without a branch destination address from the trace information;
Detecting a third code indicating a trace start from the trace information;
Storing the branch destination address associated with the first code when the indirect branch instruction and the first code are detected;
Restoring the branch destination address associated with the first code when the indirect branch instruction and the first code are detected;
Restoring the stored branch destination address when the indirect branch instruction and the second code are detected;
An execution history restoration comprising: a step of obtaining and restoring either an execution address or a branch destination address corresponding to the third code from the trace information when the third code is detected Method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004369944A JP2005209172A (en) | 2003-12-24 | 2004-12-21 | Semiconductor integrated circuit, development support device and execution history restoration method |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003426865 | 2003-12-24 | ||
JP2004369944A JP2005209172A (en) | 2003-12-24 | 2004-12-21 | Semiconductor integrated circuit, development support device and execution history restoration method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2005209172A true JP2005209172A (en) | 2005-08-04 |
JP2005209172A5 JP2005209172A5 (en) | 2008-01-24 |
Family
ID=34913989
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2004369944A Pending JP2005209172A (en) | 2003-12-24 | 2004-12-21 | Semiconductor integrated circuit, development support device and execution history restoration method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2005209172A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021075531A1 (en) * | 2019-10-18 | 2021-04-22 | ローム株式会社 | Trace circuit, semiconductor device, tracer, and trace system |
-
2004
- 2004-12-21 JP JP2004369944A patent/JP2005209172A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021075531A1 (en) * | 2019-10-18 | 2021-04-22 | ローム株式会社 | Trace circuit, semiconductor device, tracer, and trace system |
JP7489398B2 (en) | 2019-10-18 | 2024-05-23 | ローム株式会社 | Trace circuit, semiconductor device, tracer, trace system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3629181B2 (en) | Program development support device | |
US5724505A (en) | Apparatus and method for real-time program monitoring via a serial interface | |
US7194610B2 (en) | Processor and pipeline reconfiguration control method | |
JP3583937B2 (en) | Information processing equipment | |
US6760835B1 (en) | Instruction branch mispredict streaming | |
JP4846493B2 (en) | Debug system and debug circuit | |
JP2004013896A (en) | Tracing of instruction in data processing system | |
JP2003085000A (en) | Trace information production device and its method | |
US7080239B2 (en) | Loop control circuit and loop control method | |
US5095426A (en) | Data processing system for effectively handling exceptions during execution of two different types of instructions | |
US6839869B2 (en) | Trace control circuit for tracing CPU operation in real time | |
KR20080014062A (en) | Efficient subprogram return in microprocessors | |
JP2513417B2 (en) | Information processing device | |
EP0497485A2 (en) | Computer for implementing two-operand instructions | |
US7533251B2 (en) | Semiconductor integrated circuit, development support system and execution history tracing method | |
JP2005209172A (en) | Semiconductor integrated circuit, development support device and execution history restoration method | |
JPS62117039A (en) | Controller | |
JPH1078887A (en) | Debug system and debug method | |
JPH11345121A (en) | Instruction extracting device for program control unit and method thereof | |
JP2004510248A (en) | FIFO write / LIFO read trace buffer with software and hardware loop compression | |
US6795879B2 (en) | Apparatus and method for wait state analysis in a digital signal processing system | |
US7124281B1 (en) | Processing system having sequential address indicator signals | |
JPH10214209A (en) | Data processor having debugging function | |
JP2792351B2 (en) | Program development support device | |
JP2004171040A (en) | Timer circuit |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20071129 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20071129 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20100108 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20110111 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20111004 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20120306 |