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 PDF

Info

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
Application number
JP2004369944A
Other languages
Japanese (ja)
Other versions
JP2005209172A5 (en
Inventor
Atsushi Ubukata
篤 生形
Akira Ueda
亮 上田
Shigeyoshi Oda
繁義 小田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP2004369944A priority Critical patent/JP2005209172A/en
Publication of JP2005209172A publication Critical patent/JP2005209172A/en
Publication of JP2005209172A5 publication Critical patent/JP2005209172A5/ja
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)
  • Microcomputers (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To optimize trace information output, in a semiconductor integrated circuit capable of executing a program. <P>SOLUTION: When a call instruction or an interrupt branch is executed by a CPU 100, a stack memory 300 pushes its return destination address, and pops the return destination address being pushed when a return instruction is executed. When an return instruction is executed by the CPU 100, a comparator 400 compares a branch destination address outputted from the CPU 100 with an address outputted from the stack memory 300. As a result of the comparison, the branch destination address is not outputted as trace information in the case of coincidence, and a shift register 700 receives the branch destination address 110 from the CPU 100 to output it as trace information in the case of inconsistency. <P>COPYRIGHT: (C)2005,JPO&NCIPI

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, Patent Document 1 and Non-Patent Document 1). According to this method, a mechanism for outputting the branch destination address to the outside of the chip every time a branch occurs is provided, and the execution history is restored based on the output branch destination address. Further, it is suggested that by analyzing the source program based on the output trace information, the execution history can be restored without necessarily having all branch destination addresses. For example, in the case of a direct branch in which the branch destination address is explicitly described in the source program, the execution history can be restored from the source program without outputting the branch destination address. On the other hand, in the case of an indirect branch in which the branch destination address is not explicitly described in the source program and is determined at the time of execution, it is necessary to output the branch destination address. In addition, even during an indirect branch, when executing a return instruction for a function call instruction, the branch destination address need not be output if the relationship between the call and the return can be traced from the trace information.

以下、これら示唆するところを実現するハードウェアと実行履歴復元ソフトウェアを従来例として挙げ、図面を参照しながら説明する。図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 packet control unit 200 includes an instruction completion signal (EOI) 101 from the CPU 100, a direct branch instruction execution signal (JMPDIR) 102, an indirect branch instruction execution signal (JMPIND) 103, a return instruction execution signal (RET) 106, and a conditional branch. In response to the condition fulfillment signal (JMPTKN) 104 at the time of instruction execution, decoding is performed in accordance with the state decoding table shown in FIG. 201 is generated. Note that the code and meaning of reference numeral 204 output to the trace status port (PCST) 901 are as follows.
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 branch destination address 110 output from the CPU 100 is loaded into the shift register 700 and shift output is started. . When a branch instruction other than this is executed, “NPC” is output as reference numeral 204 and no significant data is output from the branch destination address output port (TPC) 902.

一方、図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 information storage device 2 and a host computer 3. The trace information storage device 2 receives the trace state signal 911 and the branch destination address signal 912 from the semiconductor integrated circuit (processor) 1 and stores them in the trace memory 1030 as trace information. The host computer 3 sends a trace memory read request 1041 to the trace information storage device 2 and acquires a trace memory output 1031.

次に、半導体集積回路1から出力されたトレース情報に基づいて、半導体集積回路1のプログラム実行履歴を復元する方法について、図49に示したプログラムを例に説明する。なお、半導体集積回路1は図49に示したプログラムを実行することによって図50に示したトレース情報を出力したものとする。また、トレース開始はプログラム実行開始と同じ実行順番"1"(アドレス"0x40000000")であるとする。   Next, a method for restoring the program execution history of the semiconductor integrated circuit 1 based on the trace information output from the semiconductor integrated circuit 1 will be described using the program shown in FIG. 49 as an example. It is assumed that the semiconductor integrated circuit 1 outputs the trace information shown in FIG. 50 by executing the program shown in FIG. The trace start is assumed to be the same execution order “1” (address “0x40000000”) as the program execution start.

図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 host computer 3 restores the execution history according to the flow shown in FIG. First, in step 5001, an execution pointer IP = 0x40000000 and a trace pointer TP = 0 are set. Next, in step 5006, an instruction “instruction 1” with IP = 0x40000000 is displayed. Since the sign when TP = 0 is “SEQ” (steps 5007, 5008, 5015, 5019 and 5021), IP is incremented at step 5022 (IP = 0x40000004), and TP is incremented at step 5023 (TP = 1) Return to step 5006. The code “SEQ” when TP = 1,3,4,6,7,8,10,11,15,16 is similarly processed.

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 step 5006, the instruction “call Sub_A” with IP = 0x40000008 is displayed. Since the sign when TP = 2 is “NPC” (steps 5007 and 5008) and the instruction with IP = 0x40000008 is a call instruction (CALL) (steps 5009 and 5012), the address of the next instruction in step 5013 “0x4000000c” is pushed to a simulation stack implemented as software (hereinafter referred to as “soft stack”). In step 5014, IP is set to “0x40000100” (Sub_A) obtained from the source program. In step 5023, TP is incremented (TP = 3), and the process returns to step 5006. The same processing is performed for the code “NPC” when TP = 5.

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 step 5006, the instruction “call (a0)” with IP = 0x4000020c is displayed. Since the sign when TP = 9 is “JMP” (steps 5007, 5008 and 5015) and the instruction with IP = 0x4000020c is a call instruction (CALL) (step 5016), the address of the next instruction in step 5017 “0x40000210” is pushed onto the soft stack, the branch destination address “0x40000300” when IP is TP = 9 is set at step 5018, TP is incremented at step 5023 (TP = 10), and the processing returns to step 5006.

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 step 5006, the instruction “ret” with IP = 0x40000308 is displayed. Since the sign when TP = 12 is “NPC” (steps 5007 and 5008) and the instruction with IP = 0x40000308 is a return instruction (RET) (step 5009), the return destination address is returned from the soft stack in step 5010. In step 5011, the IP address is set to “0x40000210”. In step 5023, TP is incremented (TP = 13), and the process returns to step 5006. The same processing is performed for the code “NPC” when TP = 13 and 14.

図52は、上記の実行履歴復元方法を実行することによって得られた復元結果を示す。図52に示したように、図49に示したソースプログラムと図50に示したトレース情報とに基づいて、プロセッサ1の実行履歴が正しく復元されている。
特開平8−185336号公報 矢野 達男、他1名、"リアルタイム・トレースを50MHzの量産用MPUで実現"、日経エレクトロニクス1995.7.31(no.641) p.133〜140
FIG. 52 shows a restoration result obtained by executing the above-described execution history restoration method. As shown in FIG. 52, the execution history of the processor 1 is correctly restored based on the source program shown in FIG. 49 and the trace information shown in FIG.
JP-A-8-185336 Tatsuo Yano and one other, “Real-time tracing was realized with a 50MHz MPU for mass production”, Nikkei Electronics 1995.7.31 (no.641) p.133-140

上述した従来の技術には、以下のようにいくつかの問題点がある。   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 port 902, the trace information is displayed when the trace is output in the operation mode (non-full trace mode) in which the CPU is not stopped. In the absence of a complete history cannot be restored. On the other hand, when the trace output is performed in the full trace mode, the operation time of the CPU is affected, and in particular, there is a high possibility that the system is not established in the real-time application.

(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 circuit 1 according to the present embodiment includes a CPU 100, a trace packet control unit 200, a stack memory 300, a comparator 400, and a shift register 700.

CPU100は、命令実行が完了したとき、命令実行完了信号(EOI)101を、直接分岐命令を実行したとき、直接分岐命令実行信号(JMPDIR)102を、間接分岐命令を実行したとき、間接分岐命令実行信号(JMPIND)103を、条件分岐命令を実行したとき、条件成立信号(JMPTKN)104を、関数コール命令を実行したとき、関数コール命令実行信号(CALL)105を、関数リターン命令又は割込みリターン命令を実行したとき、リターン命令実行信号(RET)106を、そして、割込みを受理し分岐を実行したとき、割込み実行信号(EXP)108を、それぞれアサートする。また、CPU100は、関数コール命令、割込み分岐、関数リターン命令、又は割込みリターン命令を実行したとき、その分岐先アドレス110を、関数コール命令又は割込み分岐を実行したとき、その復帰先アドレス120を、それぞれ出力する。   The CPU 100 executes the instruction execution completion signal (EOI) 101 when the instruction execution is completed, the direct branch instruction execution signal (JMPDIR) 102 when the direct branch instruction is executed, and the indirect branch instruction when the indirect branch instruction is executed. When the execution signal (JMPIND) 103 is executed, when the conditional branch instruction is executed, the condition establishment signal (JMPTKN) 104 is executed. When the function call instruction is executed, the function call instruction execution signal (CALL) 105 is sent as the function return instruction or interrupt return. When an instruction is executed, a return instruction execution signal (RET) 106 is asserted. When an interrupt is accepted and a branch is executed, an interrupt execution signal (EXP) 108 is asserted. Further, the CPU 100 executes the function call instruction, interrupt branch, function return instruction, or interrupt return instruction when the function call instruction or interrupt branch is executed. Output each.

スタックメモリ300は、OR回路350によって演算された信号CALL及びEXPの論理和をプッシュ信号として、信号RETをポップ信号として、そして、復帰先アドレス120をデータとして、それぞれ受ける。すなわち、スタックメモリ300は、CPU100によって関数コール命令又は割込み分岐が実行されたとき、CPU100から出力された復帰先アドレス120をプッシュし、関数リターン命令又は割込みリターン命令が実行されたとき、プッシュしている復帰先アドレスをポップしてスタックトップデータ301を出力する。この出力されたデータ301は、いわば復帰先アドレスの期待値を表している。また、スタックメモリ300は、スタック内容が有効であるとき、スタック有効信号302をアサートする。   The stack memory 300 receives the logical sum of the signals CALL and EXP calculated by the OR circuit 350 as a push signal, the signal RET as a pop signal, and the return destination address 120 as data. That is, the stack memory 300 pushes the return address 120 output from the CPU 100 when the function call instruction or interrupt branch is executed by the CPU 100, and pushes when the function return instruction or interrupt return instruction is executed. The return address that is present is popped and the stack top data 301 is output. The output data 301 represents the expected value of the return destination address. Further, the stack memory 300 asserts the stack valid signal 302 when the stack contents are valid.

比較器400は、スタックメモリ300から出力されたデータ301とCPU100から出力された分岐先アドレス110とを比較し、これらの一致/不一致を比較結果信号401として出力する。比較結果信号401は、一致のときはアサートされ、不一致のときはネゲートされる。なお、比較結果信号401及びスタック有効信号302はAND回路500によって論理積がとられ、復帰先アドレス一致信号501としてトレースパケット制御部200に送られる。   The comparator 400 compares the data 301 output from the stack memory 300 with the branch destination address 110 output from the CPU 100, and outputs a match / mismatch as a comparison result signal 401. The comparison result signal 401 is asserted when they match and is negated when they do not match. The comparison result signal 401 and the stack valid signal 302 are ANDed by the AND circuit 500 and sent to the trace packet control unit 200 as a return destination address match signal 501.

図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 packet control unit 200. The trace packet control unit 200 receives the signals EOI, JMPDIR, JMPIND, CALL, RET, JMPTKN and EXP, and the return destination address match signal 501, and according to the state decode table shown in FIG. 2, the branch destination address load enable signal (TPCLDEN ) 201 and the code 204 to be output to the trace status port (PCST) 901 is determined.

シフトレジスタ700は、信号TPCLDENがアサートされたとき、分岐先アドレス110をロードし、これをシリアルデータ化してデータ701を分岐先アドレス出力ポート(TPC)902に送る。   When the signal TPCLDEN is asserted, the shift register 700 loads the branch destination address 110, converts it into serial data, and sends the data 701 to the branch destination address output port (TPC) 902.

一方、本実施形態に係る開発支援装置は、図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 memory control unit 1010 and the serial-parallel converter 1020 in the trace information storage device 2 reshape the trace state signal 911 and the branch destination address signal 912 output from the semiconductor integrated circuit 1, respectively, and store the trace information in the trace memory 1030. Accumulate as. The host computer 3 sends a trace memory read request 1041 to the trace information storage device 2, acquires the trace memory output 1031, and restores the program execution history of the semiconductor integrated circuit 1 while sequentially matching the acquired information and the source program. To do. The operation of the host computer 3 as the execution history restoring unit is different from the conventional one. This will be described later.

次に、本実施形態に係る半導体集積回路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 circuit 1 and the development support apparatus according to the present embodiment will be described by taking the case of executing the program shown in FIG. 3 as an example. In this example, the semiconductor integrated circuit 1 starts program execution and tracing from the instruction “instruction 1” at the address “0x50000000” (execution order “1”), and the instruction “at the address“ 0x50000210 ”(execution order“ 14 ”)” After executing "ret", the interrupt is accepted and the branch is executed, the task is switched from task "taskA" to task "taskB" with interrupt handler "int0h", and address "0x40000110" (execution order "19") The instruction “rti” returns to the address “0x50000610”. Note that saving / restoring processing of registers and the like is omitted.

図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 circuit 1 executes the program shown in FIG. The trace information shown in FIG. 4 is obtained as a result of the operation of the semiconductor integrated circuit 1 described below. In the following description, when addresses are pushed to the stack memory 300 in the order of A, B, C, and D, the contents of the stack are represented as (D, C, B, A). When the stack memory 300 is popped, the stack top data 301 is output in the order of D, C, B, and A.

CPU100が実行順番"1,2,4,5,7,8,9,11,12,15,16,17,18,22,23"の通常の順次実行命令を実行したとき、信号EOIのみがアサートされる(出力"1")。このとき、信号TPCLDENはアサートされず(出力"0")、トレース情報として符号"SEQ"のみが出力される。   When the CPU 100 executes the normal sequential execution instructions in the execution order “1, 2, 4, 5, 7, 8, 9, 11, 12, 15, 16, 17, 18, 22, 23”, only the signal EOI is Asserted (output "1"). At this time, the signal TPCLDEN is not asserted (output “0”), and only the code “SEQ” is output as the trace information.

CPU100がアドレス"0x50000008"(実行順番"3")のコール命令"call Sub_A"を実行したとき、信号JMPDIR、CALL、JMPTKN及びEOIがアサートされる。このとき、OR回路350から出力されたプッシュ信号がアサートされることによって、CPU100から出力された復帰先アドレス120("0x5000000c")がプッシュされ、スタックメモリ300の内容は、
(0x5000000c)
となる。また、このとき、信号TPCLDENはアサートされず、トレース情報として符号"NPC"のみが出力される。
When the CPU 100 executes the call instruction “call Sub_A” at the address “0x50000008” (execution order “3”), the signals JMPDIR, CALL, JMPTKN, and EOI are asserted. At this time, when the push signal output from the OR circuit 350 is asserted, the return destination address 120 ("0x5000000c") output from the CPU 100 is pushed, and the contents of the stack memory 300 are:
(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 CPU 100 executes the call instruction “call Sub_B” at the address “0x50000108” (execution order “6”), the return destination address 120 (“0x5000010c”) is pushed, and the contents of the stack memory 300 are:
(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 CPU 100 executes the call instruction “call (a0)” at the address “0x5000020c” (execution order “10”), the return address 120 (“0x50000210”) is pushed, and the contents of the stack memory 300 are
(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 shift register 700 receives the branch destination address 110 (“0x50000300”) output from the CPU 100, and outputs the branch destination address “0x50000300” as trace information.

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 CPU 100 executes the return instruction “ret” at the address “0x50000308” (execution order “13”), the signal RET is asserted. Then, the expected value “0x500000210” of the return destination address is popped, and the contents of the stack memory 300 are
(0x5000010c, 0x5000000c)
It becomes. At this time, since the popped expected value (“0x500000210”) matches the actual branch destination address 110 (“0x500000210”) output from the CPU 100, the comparison result signal 401 is asserted (output “1”). . At this time, since the contents of the stack memory 300 are valid, the stack valid signal 302 is asserted, and the return address match signal 501 is asserted (output “1”). When the signal RET and the return address match signal 501 are asserted, the signal TPCLDEN is not asserted, and only the code “NPC” is output as the trace information.

同様に、CPU100が実行順番"14"(アドレス"0x50000210")のリターン命令"ret"を実行したとき、復帰先アドレスの期待値"0x5000010c"がポップされ、スタックメモリ300の内容は、
(0x5000000c)
となる。このとき、ポップされた期待値("0x5000010c")とCPU100から出力された分岐先アドレス110("0x5000010c")とは一致するため、トレース情報として符号"NPC"のみが出力される。
Similarly, when the CPU 100 executes the return instruction “ret” in the execution order “14” (address “0x50000210”), the expected value “0x5000010c” of the return destination address is popped, and the contents of the stack memory 300 are
(0x5000000c)
It becomes. At this time, since the popped expected value (“0x5000010c”) matches the branch destination address 110 (“0x5000010c”) output from the CPU 100, only the code “NPC” is output as the trace information.

実行順番"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 CPU 100 accepts this interrupt. , Signal EXP is asserted. At this time, when the push signal output from the OR circuit 350 is asserted, the return address 120 (“0x5000010c”) output from the CPU 100 is pushed, and the contents of the stack memory 300 are:
(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 stack memory 300 are
(0x5000000c)
It becomes. At this time, since the branch destination address 110 output from the CPU 100 is “0x50000610” and does not match the popped expected value “0x5000010c”, the comparison result signal 401 is not asserted (output “0”), and the return destination address The match signal 501 is also not asserted. When the signal RET is asserted and the return destination address match signal 501 is not asserted, the signal TPCLDEN is asserted, and the code “JMP” and the branch destination address “0x50000610” are output as the trace information.

同様に、CPU100が実行順番"20"(アドレス"0x50000610")のリターン命令"ret"を実行したとき、復帰先アドレスの期待値"0x5000000c"がポップされ、スタックメモリ300の内容は、
()
となる。このとき、CPU100から出力された分岐先アドレス110は"0x5000050c"であり、ポップされた期待値"0x5000000c"と一致しないため、トレース情報として符号"JMP"及び分岐先アドレス"0x5000050c"が出力される。
Similarly, when the CPU 100 executes the return instruction “ret” in the execution order “20” (address “0x50000610”), the expected value “0x5000000c” of the return destination address is popped, and the contents of the stack memory 300 are
()
It becomes. At this time, the branch destination address 110 output from the CPU 100 is “0x5000050c” and does not match the popped expected value “0x5000000c”, so the code “JMP” and the branch destination address “0x5000050c” are output as the trace information. .

CPU100が実行順番"21"(アドレス"0x5000050c")のリターン命令"ret"を実行したとき、信号RETがアサートされるが、スタックメモリ300は空の状態であるためアンダーフローが発生する。これにより、スタック有効信号302がネゲートされ(出力"0")、復帰先アドレス一致信号501もまたネゲートされる(出力"0")。信号RETがアサートされ、かつ、復帰先アドレス一致信号501がアサートされていないとき、信号TPCLDENがアサートされ、トレース情報として符号"JMP"及び分岐先アドレス"0x5000040c"が出力される。   When the CPU 100 executes the return instruction “ret” in the execution order “21” (address “0x5000050c”), the signal RET is asserted. However, since the stack memory 300 is empty, an underflow occurs. As a result, the stack valid signal 302 is negated (output “0”), and the return address match signal 501 is also negated (output “0”). When the signal RET is asserted and the return destination address match signal 501 is not asserted, the signal TPCLDEN is asserted, and the code “JMP” and the branch destination address “0x5000040c” are output as the trace information.

以上の動作によって、本実施形態に係る半導体集積回路1から、図4に示したトレース情報が出力される。   With the above operation, the trace information shown in FIG. 4 is output from the semiconductor integrated circuit 1 according to the present embodiment.

一方、図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 step 2001, the end trace pointer (ETP) becomes the current trace pointer (ETP = 24), and the trace pointer (TP). Is set to the start address of the trace memory (TP = 0), and the execution pointer (IP) is set to the trace start address (IP = 0x50000000).

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 step 2006, the program part “0x50000000 taskA: instruction 1” obtained from the source program is restored and displayed. At this time, since the code indicated in the trace information is “SEQ” (steps 2007, 2008, 2017, 2024 and 2032), IP is incremented in step 2033 (IP = 0x5000004), and TP is incremented in step 2034. (TP = 1), the process returns to step 2006. The same processing is performed when TP = 1,3,4,6,7,8,10,11,15,16,17,18,22,23.

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” (steps 2007 and 2008), and the instruction shown in the source program is “call Sub_A”, that is, a call instruction ( CALL) (steps 2009 and 2014), the next address “0x5000000c” of the current IP is pushed to the soft stack as the return destination address in step 2015, and the contents of the soft stack are
(0x5000000c)
It becomes. In step 2016, IP is set to the branch destination address of the instruction “call Sub_A” indicated in the source program (IP = 0x50000100), TP is incremented in step 2034 (TP = 3), and the process returns to step 2006. . The same processing is performed when TP = 5.
(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” (steps 2007, 2008 and 2017), and the instruction shown in the source program is “call (a0)”, that is, Since this is a call instruction (CALL) (steps 2018 and 2020), the next address “0x50000210” of the current IP is pushed to the soft stack as the return destination address in step 2021, and the contents of the soft stack are
(0x50000210,0x5000010c, 0x5000000c)
It becomes. Then, in step 2028, IP is set to the branch destination address “0x50000300” corresponding to TP = 9 indicated in the trace information (IP = 0x50000300), and TP is incremented in step 2034 (TP = 10). Return to 2006.

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” (steps 2007 and 2008), and the instruction shown in the source program is “ret”, that is, a return instruction (RET ) (Step 2009), the return address “0x50000210” is popped from the soft stack in step 2010, and the contents of the soft stack are
(0x5000010c, 0x5000000c)
It becomes. In step 2011, the IP is set to the popped address (IP = 0x50000210). In step 2034, TP is incremented (TP = 13), and the process returns to step 2006.

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” (steps 2007, 2008, 2017, and 2024). Therefore, the address “0x5000010c” indicated by the current IP in step 2025 Is pushed onto the soft stack and the contents of the soft stack are
(0x5000010c, 0x5000000c)
It becomes. Then, in step 2028, IP is set to the branch destination address “0x40000100” corresponding to TP = 14 indicated in the trace information (IP = 0x40000100), and in step 2034, TP is incremented (TP = 15). Return to 2006.

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” (steps 2007, 2008 and 2017), and the instruction shown in the source program is “rti”, that is, a return instruction (RET) (step 2018), the return address “0x5000010c” is popped from the soft stack in step 2019, and the contents of the soft stack are
(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 step 2028 The branch destination address “0x50000610” corresponding to 19 is set (IP = 0x50000610), TP is incremented in step 2034 (TP = 20), and the process returns to step 2006. The same processing is performed when TP = 20 and 21.

以上の処理によって、本実施形態に係る開発支援装置によって、図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 circuit 1 according to the present embodiment has a configuration in which a synchronization request request generation circuit 800 and a selector 750 are added to the semiconductor integrated circuit according to the first embodiment. Hereinafter, a different part from the semiconductor integrated circuit according to the first embodiment will be described.

CPU100は、命令を実行したとき、その命令の実行アドレス111を出力する。セレクタ750は、CPU100から分岐先アドレス110及び実行アドレス111を受け、トレースパケット制御部200から出力される選択信号202に従って、これら入力したアドレスのいずれか一方を出力する。シフトレジスタ700は、セレクタ750から出力されたアドレス751を受ける。   When the CPU 100 executes an instruction, the CPU 100 outputs an execution address 111 of the instruction. The selector 750 receives the branch destination address 110 and the execution address 111 from the CPU 100, and outputs one of these input addresses in accordance with the selection signal 202 output from the trace packet control unit 200. Shift register 700 receives address 751 output from selector 750.

同期要求生成回路800は、半導体集積回路1の起動時等のシステムリセット時、CPU100によってタスクが切替えられたとき等のタスク切替え時、トレース情報出力を開始するトレース開始時、開発支援装置からの要求時、又は一定周期毎に、同期要求信号801をアサートする。これにより、例えば、図48に示した開発支援装置におけるトレースメモリ1030がオーバーフローしそうな場合に、開発支援装置からの要求により同期要求信号801がアサートされる。また、例えば、一定周期で同期要求信号801がアサートされることにより、トレース情報出力が一定周期で初期化される。なお、スタックメモリ300は、同期要求信号801がアサートされたとき、スタックポインタを初期化し、プッシュしているスタック内容を無効にする。   The synchronization request generation circuit 800 is a request from the development support apparatus at the time of system reset such as when the semiconductor integrated circuit 1 is started up, at the time of task switching such as when the task is switched by the CPU 100, at the start of tracing to start outputting trace information The synchronization request signal 801 is asserted every hour or every fixed period. Thereby, for example, when the trace memory 1030 in the development support apparatus shown in FIG. 48 is likely to overflow, the synchronization request signal 801 is asserted in response to a request from the development support apparatus. Also, for example, when the synchronization request signal 801 is asserted at a constant cycle, the trace information output is initialized at a constant cycle. When the synchronization request signal 801 is asserted, the stack memory 300 initializes the stack pointer and invalidates the pushed stack contents.

図9は、トレースパケット制御部200の状態デコード表を示す。本実施形態に係るトレースパケット制御部200は、第1の実施形態と比較して、入力として同期要求信号801が、出力として選択信号(TPCSEL)202が追加されている。また、出力符号として"SYN"及び"JMPS"が追加されている。   FIG. 9 shows a state decoding table of the trace packet control unit 200. Compared to the first embodiment, the trace packet control unit 200 according to the present embodiment is added with a synchronization request signal 801 as an input and a selection signal (TPCSEL) 202 as an output. Also, “SYN” and “JMPS” are added as output codes.

一方、本実施形態に係る開発支援装置は、図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 host computer 3 as the execution history restoring unit is different from the conventional one. This will be described later.

次に、本実施形態に係る半導体集積回路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 circuit 1 and the development support apparatus according to the present embodiment will be described by taking the case of executing the program shown in FIG. 10 as an example. In this example, the semiconductor integrated circuit 1 starts program execution from the address “0x50000000” (execution order “1”), the subroutine “Sub_A” is called at the address “0x50000008” (execution order “3”), and the address “0x50000100” "Jump to. Then, when the instruction “instruction 4” at the address “0x50000104” (execution order “5”) is executed, the trace is started. Thereafter, the semiconductor integrated circuit 1 jumps to the subroutine “Sub_B” of the address “0x50000200” at the address “0x50000108” (execution order “6”), and the address “0x50000300” at the address “0x5000020c” (execution order “10”). Jump to the subroutine “Sub_C” and return to the caller in the order of “0x50000210, 0x5000010c, 0x5000010” from the address “0x50000308”.

図11は、半導体集積回路1が図10に示したプログラムを実行したときに出力するトレース情報を示す。図11に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。   FIG. 11 shows trace information output when the semiconductor integrated circuit 1 executes the program shown in FIG. The trace information shown in FIG. 11 is obtained as a result of the operation of the semiconductor integrated circuit 1 described below. A characteristic part of this embodiment will be described.

トレース開始前、アドレス"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 stack memory 300 are
(0x5000000c)
It has become. However, when the execution order is “5”, tracing starts and the synchronization request signal 801 is asserted. Thereby, the stack memory 300 is initialized, and its contents are
()
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 CPU 100 executes the instruction “instruction 4” at the address “0x50000104” (execution order “5”), the signal EOI is asserted and the execution address 111 (“0x50000104”) is output. At this time, the signal JMPTKN is not asserted, and the trace packet control unit 200 asserts the signal TPCLDEN and sets the value of the signal TPCSEL to “0” according to the state decoding table shown in FIG. "Is output. When the value of the signal TPCSEL is “0”, the selector 750 selects the execution address 111 (“0x5000104”) and inputs it to the shift register 700. When the signal TPCLDEN is asserted, the shift register 700 sequentially outputs the address 751 (“0x50000104”) received from the selector 750 to the port 902 as data 701. That is, when the CPU 100 executes a normal sequential execution instruction other than the branch instruction and the synchronization request signal 801 is asserted, the trace packet control unit 200 outputs “SYN” instead of “SEQ” as the reference numeral 204. At the same time, the values of the signal TPCLDEN and the signal TPCSEL are set so that the execution address 111 is output as the data 701 instead of the branch destination address 110.

その後、実行順番"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 packet control unit 200 asserts the signal TPCLDEN and sets the value of the signal TPCSEL to “1”. Set and output “JMP” as reference numeral 204. As a result, the branch destination address 110 (“0x50000300”) is selected by the selector 750 and output from the shift register 700. The stack memory 300 is pushed in the execution order “6” and “10”, popped in the execution order “13” and “14”, and the instruction at the address “0x50000210” (execution order “14”) is executed. It is empty at the time.

次に、CPU100がアドレス"0x5000010c"(実行順番"15")のリターン命令"ret"を実行したとき、スタックメモリ300にアンダーフローが発生し、復帰先アドレス一致信号501はアサートされない。トレースパケット制御部200は、図9に示した状態デコード表に従って、信号TPCLDENをアサートし、信号TPCSELの値を"1"に設定し、符号204として"JMP"を出力する。これにより、シフトレジスタ700から分岐先アドレス110("0x5000000c")がデータ701としてポート902に順次出力される。   Next, when the CPU 100 executes the return instruction “ret” at the address “0x5000010c” (execution order “15”), an underflow occurs in the stack memory 300 and the return destination address match signal 501 is not asserted. The trace packet control unit 200 asserts the signal TPCLDEN according to the state decoding table shown in FIG. 9, sets the value of the signal TPCSEL to “1”, and outputs “JMP” as the code 204. As a result, the branch destination address 110 (“0x5000000c”) is sequentially output from the shift register 700 to the port 902 as data 701.

以上の動作によって、本実施形態に係る半導体集積回路1から、図11に示したトレース情報が出力される。   With the above operation, the trace information shown in FIG. 11 is output from the semiconductor integrated circuit 1 according to the present embodiment.

一方、図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 step 2001, the current trace pointer (TP = 13) is set to the end trace pointer (ETP), and the trace pointer is trace data having a sign of “SYN” or “JMPS” before the current trace pointer. Set to pointer (TP = 0). Since the sign when TP = 0 is “SYN” (step 2002), in step 2003, IP is set to the execution address “0x50000104” corresponding to TP = 0 indicated in the trace information (IP = 0x50000104) The process proceeds to step 2006. The subsequent processing is the same as that described in the first embodiment. In particular, when restoring the branch destination address of the return instruction “ret” when TP = 10, the contents of the soft stack are empty and invalid, but the branch information “0x5000000c” is included in the trace information. In step 2028, IP is set to the branch destination address “0x5000000c” corresponding to TP = 10 indicated in the trace information (IP = 0x5000000c), and the restoration process is continued.

以上の処理によって、本実施形態に係る開発支援装置によって、図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 circuit 1 according to the present embodiment and execution history restoration by the development support apparatus will be described taking the case of executing the program shown in FIG. 15 as an example. In this example, the program itself is the same as the previous example shown in FIG. 10, but the trace starts from the instruction at address “0x50000108” (execution order “6”) one instruction after the previous example. Yes.

図16は、半導体集積回路1が図15に示したプログラムを実行したときに出力するトレース情報を示す。図16に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。   FIG. 16 shows trace information output when the semiconductor integrated circuit 1 executes the program shown in FIG. The trace information shown in FIG. 16 is obtained as a result of the operation of the semiconductor integrated circuit 1 described below. A characteristic part of this embodiment will be described.

トレース開始前、アドレス"0x50000008"(実行順番"3")のコール命令"call Sub_A"及びアドレス"0x5000108"(実行順番"6")のコール命令"call Sub_B"の実行によって、スタックメモリ300の内容は、
(0x500010c,0x5000000c)
となっている。しかし、実行順番"6"のときトレースが開始され、同期要求信号801がアサートされる。これにより、スタックメモリ300は初期化され、その内容は、
()
となる。
The contents of the stack memory 300 are obtained by executing the call instruction “call Sub_A” at the address “0x50000008” (execution order “3”) and the call instruction “call Sub_B” at the address “0x5000108” (execution order “6”) before starting the trace. Is
(0x500010c, 0x5000000c)
It has become. However, when the execution order is “6”, tracing is started and the synchronization request signal 801 is asserted. Thereby, the stack memory 300 is initialized, and its contents are
()
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 CPU 100 executes the instruction “call Sub_B” at the address “0x5000108” (execution order “6”), the signals CALL and JMPTKN are asserted. At this time, the trace packet control unit 200 asserts the signal TPCLDEN, sets the value of the signal TPCSEL to “1”, and outputs “JMPS” as a symbol 204 in accordance with the state decoding table shown in FIG. When the value of the signal TPCSEL is “1”, the selector 750 selects the branch destination address 110 (“0x50000200”) and inputs it to the shift register 700. When the signal TPCLDEN is asserted, the shift register 700 sequentially outputs the address 751 (“0x50000200”) received from the selector 750 to the port 902 as data 701. That is, when the CPU 100 executes a branch instruction and the synchronization request signal 801 is asserted, the trace packet control unit 200 outputs “JMPS” instead of “NPC” or “JMP” as a reference numeral 204. The values of the signal TPCLDEN and the signal TPCSEL are set so that the branch destination address 110 is output as the data 701.

その後の動作は、先の例と同様である。特に、スタックメモリ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 stack memory 300 is pushed in the execution order “10”, popped in the execution order “13”, and becomes empty when the instruction at the address “0x50000308” (execution order “13”) is executed. Yes. For this reason, when instructions are executed in the execution order “10” and “15”, an underflow occurs in the stack memory 300, the return address match signal 501 is not asserted, and “JMP” is output as the code 204. In addition, the branch destination address 110 is sequentially output to the port 902 as data 701.

以上の動作によって、本実施形態に係る半導体集積回路1から、図16に示したトレース情報が出力される。   With the above operation, the trace information shown in FIG. 16 is output from the semiconductor integrated circuit 1 according to the present embodiment.

一方、図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” (steps 2001 and 2002), IP is set to the branch destination address corresponding to TP = 0 in the trace information in step 2004 ( IP = 0x50000200), after TP is incremented in step 2005 (TP = 1), the process proceeds to step 2006. The subsequent processing is the same as in the previous example.

以上、本実施形態によると、プログラムの実行が開始された後に遅れてトレースが開始された場合であっても、トレース開始時の実行アドレス又は分岐先アドレスが出力され、また、トレース開始前に実行されたコール命令に対応するリターン命令が実行されたとき、その分岐先アドレスがトレース情報として出力される。これにより、プログラム実行の途中からトレースが開始されても、トレース開始時のプログラム部分を復元し、さらに、トレース開始前に実行されたプログラム部分までも復元することができる。   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 circuit 1 according to the present embodiment includes a CPU 100, a trace packet control unit 200, a loop detection circuit 600, and a shift register 700. Note that the shift register 700 is the same as that in the first embodiment, and a description thereof will be omitted.

CPU100は、高速分岐命令としてレジスタ間接分岐命令を実装しており、例えば、プログラムのループ部分を実行するとき、ループアドレスレジスタ(LAR)150及びループ命令レジスタ(LIR)160に、それぞれ、分岐先アドレス及び分岐先の命令を格納し、これらレジスタを参照してループ部分を実行することによって高速分岐が可能となっている。CPU100は、レジスタ150を更新したとき、LAR更新信号130をアサートし、レジスタ150に格納された分岐先アドレスへの分岐命令を実行したとき、LAR間接分岐命令実行信号(LCC)をアサートする。これ以外の点については、第1の実施形態に係る半導体集積回路1におけるCPU100と同様であるため、説明を省略する。   The CPU 100 implements a register indirect branch instruction as a high-speed branch instruction. For example, when executing a loop portion of a program, the branch address is stored in the loop address register (LAR) 150 and the loop instruction register (LIR) 160, respectively. The branch destination instruction is stored, and the loop portion is executed by referring to these registers, thereby enabling high-speed branching. The CPU 100 asserts the LAR update signal 130 when the register 150 is updated, and asserts the LAR indirect branch instruction execution signal (LCC) when executing the branch instruction to the branch destination address stored in the register 150. Since the other points are the same as those of the CPU 100 in the semiconductor integrated circuit 1 according to the first embodiment, description thereof is omitted.

ループ検出回路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 loop detection circuit 600 includes a holding circuit 610 and a reset circuit 620. The holding circuit 610 is configured by an RS flip-flop, and receives the LAR update signal 130 at the set terminal and the reset signal 621 output from the reset circuit 620 at the reset terminal, and outputs the LAR update flag signal 601. The reset circuit 620 includes an AND circuit 630 that calculates a logical product of the signals LCC and JMPTKN, and a D flip-flop 640 that receives the output of the AND circuit 630 and outputs a reset signal 621. The D flip-flop 640 is provided to delay the output of the AND circuit 630 in order to adjust the set / reset timing of the holding circuit 610. With the above configuration, the loop detection circuit 600 asserts the LAR update flag signal 601 when the register 150 is updated and the LAR update signal 130 is asserted, and when the loop initial signal LCC and JMPTKN are asserted, The update flag signal 601 is negated. That is, the loop detection circuit 600 asserts the LAR update flag signal 601 only when the execution of a certain loop portion is started and the register indirect branch instruction is executed for the first time, and the second and subsequent register indirect branch instructions are executed. Do not assert. As shown in FIG. 19, the holding circuit 610 in the loop detection circuit 600 may be configured with a D flip-flop.

図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 packet control unit 200. The trace packet control unit 200 receives the signals EOI, JMPDIR, JMPIND, RET, LCC, JMPTKN and EXP, and the LAR update flag signal 601, and receives the branch destination address load enable signal (TPCLDEN) according to the state decoding table shown in FIG. 201 and a code 204 to be output to the trace status port (PCST) 901 are determined.

一方、本実施形態に係る開発支援装置は、図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 host computer 3 as the execution history restoring unit is different from the conventional one. This will be described later.

次に、本実施形態に係る半導体集積回路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 circuit 1 and the development support apparatus according to the present embodiment will be described by taking the case of executing the program shown in FIG. 21 as an example. In this example, the semiconductor integrated circuit 1 starts program execution and tracing from the address “0x50000000” (execution order “1”), and by the instruction “setlb” at the address “0x50000004” (execution order “2”), the register 150 The branch destination address “0x50000008” of the loop “loop0” is stored in the register 160, and the first instruction “instruction 2” of the loop is stored in the register 160, respectively. Then, after executing the loop twice by the register indirect branch instruction “leq” at the address “0x50000010” (execution order “5” and “8”), the interrupt is accepted during the third loop execution, and the address “0x40000100” Starts execution of the interrupt handler "int0h" (execution order "10"). In the interrupt handler “int0h”, after executing another loop “loop1” with the register indirect branch instruction “lne” twice, return to the previous loop “loop0”, execute the fourth loop, and then execute the same loop. Ends.

図22は、半導体集積回路1が図21に示したプログラムを実行したときに出力するトレース情報を示す。図22に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。   FIG. 22 shows trace information output when the semiconductor integrated circuit 1 executes the program shown in FIG. The trace information shown in FIG. 22 is obtained as a result of the operation of the semiconductor integrated circuit 1 described below. A characteristic part of this embodiment will be described.

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 CPU 100 executes the instruction “setlb” at the address “0x50000004” (execution order “2”), the LAR update signal 130 is asserted and the LAR update flag signal 601 is asserted, but the signals LCC and JMPTKN are not asserted yet. Therefore, the trace packet control unit 200 outputs “SEQ” as the reference numeral 204 in accordance with the state decoding table shown in FIG. Thereafter, when the register indirect branch instruction “leq” at the address “0x50000010” (execution order “5”) is executed, the LAR update flag signal 601 and the signals LCC and JMPTKN are asserted. At the same time, the address “0x50000008” is output as data 701.

アドレス"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 circuit 610 is reset and the LAR update flag signal 601 is negated. Thus, when the CPU 100 executes the register indirect branch instruction “leq” at the address “0x50000010” (execution order “8”), the signals LCC and JMPTKN are asserted, but the LAR update flag signal 601 is negated. In accordance with the state decoding table shown in FIG. 20, only “NPC” is output as the reference numeral 204 from the trace packet control unit 200.

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 CPU 100 accepts the interrupt and executes the branch, and the processing moves to the interrupt handler “int0h”, when the CPU 100 executes the instruction “setlb” at the address “0x40000104” (execution order “11”), Since the LAR update signal 130 is asserted and the LAR update flag signal 601 is asserted, but the signals LCC and JMPTKN are not yet asserted, the trace packet control unit 200 uses the state decode table shown in FIG. "SEQ" is output. Thereafter, when the CPU 100 executes the register indirect branch instruction “lne” at the address “0x40000110” (execution order “14”), this instruction is the first high-speed branch instruction in the loop “loop1”. “JMP” is output, and “0x40000108” is output as data 701. On the other hand, even with the same register indirect branch instruction “lne”, when the execution order is “17”, since the branch condition is not satisfied, the signal JMPTKN is not asserted, and “SEQ” is output as the code 204.

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 CPU 100 executes the instruction “movm (sp), regs” at the address “0x40000114” (execution order “18”), the LAR update signal 130 is asserted and the LAR update flag signal 601 is asserted. When the CPU 100 executes the register indirect branch instruction “leq” at the address “0x50000010” (execution order “21”), this instruction is not the first register indirect branch instruction in the loop “loop0”, but the LAR update flag Since the signal 601 is asserted and the signals LCC and JMPTKN are asserted, “JMP” is output as the reference numeral 204 and the address “0x50000008” is output as the data 701. After that, when the CPU 100 executes the register indirect branch instruction “leq” in the execution order “24”, the branch condition is not satisfied, and therefore the signal JMPTKN is not asserted and “SEQ” is output as the code 204.

以上の動作によって、本実施形態に係る半導体集積回路1から、図22に示したトレース情報が出力される。   With the above operation, the trace information shown in FIG. 22 is output from the semiconductor integrated circuit 1 according to the present embodiment.

一方、図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” (steps 2007, 2008 and 2017), and the instruction shown in the source program is the register indirect branch instruction “leq” (LCC). (Steps 2018, 2020, and 2022) and the branch destination address “0x50000008” corresponding to TP = 4 indicated in the trace information in the simulated loop address register (hereinafter referred to as software LAR) implemented in software in Step 2023 Is stored. Thereafter, in step 2028, IP is set to the branch destination address “0x50000008” corresponding to TP = 4 indicated in the trace information (IP = 0x50000008), and after TP is incremented in step 2034 (TP = 5), step Return to 2006. The same processing is performed when TP = 14,21.

一方、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” (steps 2007 and 2008), and the instruction shown in the source program is the register indirect branch instruction “leq” as in TP = 4. Since it is (LCC) (steps 2009 and 2012), in step 2013, IP is set to the branch destination address “0x50000008” stored in the software LAR (IP = 0x50000008). Then, after TP is incremented in Step 2034 (TP = 8), the process returns to Step 2006.

以上の処理によって、本実施形態に係る開発支援装置によって、図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 circuit 1 according to the present embodiment has a configuration in which the synchronization request request generation circuit 800 and the selector 750 described in the second embodiment are added to the semiconductor integrated circuit according to the third embodiment. Hereinafter, a different part compared with the semiconductor integrated circuit which concerns on 2nd and 3rd embodiment is demonstrated.

ループ検出回路600におけるOR回路650は、LAR更新信号130及び同期要求信号801の論理和を演算し、この論理和は保持回路610のセット信号となる。すなわち、同期要求信号801がアサートされると、信号LCC及びJMPTKNが次にアサートされるまで、LAR更新フラグ信号601がアサートされる。なお、同期要求信号801がアサートされるタイミングは、第2の実施形態で説明したとおりである。   The OR circuit 650 in the loop detection circuit 600 calculates a logical sum of the LAR update signal 130 and the synchronization request signal 801, and this logical sum becomes a set signal of the holding circuit 610. That is, when the synchronization request signal 801 is asserted, the LAR update flag signal 601 is asserted until the signals LCC and JMPTKN are next asserted. Note that the timing at which the synchronization request signal 801 is asserted is as described in the second embodiment.

図27は、トレースパケット制御部200の状態デコード表を示す。本実施形態に係るトレースパケット制御部200は、第3の実施形態と比較して、入力として同期要求信号801が、出力として選択信号(TPCSEL)202が追加されている。また、出力符号として"SYN"及び"JMPS"が追加されている。   FIG. 27 shows a state decoding table of the trace packet control unit 200. Compared with the third embodiment, the trace packet control unit 200 according to the present embodiment is added with a synchronization request signal 801 as an input and a selection signal (TPCSEL) 202 as an output. Also, “SYN” and “JMPS” are added as output codes.

一方、本実施形態に係る開発支援装置は、図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 host computer 3 as the execution history restoring unit is different from the conventional one. This will be described later.

次に、本実施形態に係る半導体集積回路1及び開発支援装置によるトレース情報出力及び実行履歴復元について、図28に示したプログラムを実行する場合を例に説明する。この例では、半導体集積回路1は、ループ"loop0"を4回実行するうち、2回目の実行のとき、実行順番"6"でトレースが開始される。   Next, trace information output and execution history restoration by the semiconductor integrated circuit 1 and the development support apparatus according to the present embodiment will be described taking the case of executing the program shown in FIG. 28 as an example. In this example, the semiconductor integrated circuit 1 starts the trace in the execution order “6” at the second execution of the loop “loop0” four times.

図29は、半導体集積回路1が図28に示したプログラムを実行したときに出力するトレース情報を示す。図29に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。   FIG. 29 shows trace information output when the semiconductor integrated circuit 1 executes the program shown in FIG. The trace information shown in FIG. 29 is obtained as a result of the operation of the semiconductor integrated circuit 1 described below. A characteristic part of this embodiment will be described.

実行順番"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 synchronization request signal 801 is asserted, and the LAR update flag signal 601 is asserted. When the CPU 100 executes the instruction “instruction 2” at the address “0x40000008” (execution order “6”), the signal EOI is asserted and the execution address 111 (“0x40000008”) is output. At this time, the signal LCC is not asserted, and according to the state decoding table shown in FIG. 27, the trace packet control unit 200 asserts the signal TPCLDEN, sets the value of the signal TPCSEL to “0”, "Is output. Further, the execution address “0x40000008” at this time is output from the shift register 700 as data 701.

その後、CPU100がアドレス"0x40000010"(実行順番"8")のレジスタ間接分岐命令"leq"を実行したとき、信号LCC及びJMPTKNがアサートされる。このとき、LAR更新フラグ信号601がアサートされており、符号204として"JMP"が出力されるとともに、データ701として分岐先アドレス"0x40000008"が出力される。   Thereafter, when the CPU 100 executes the register indirect branch instruction “leq” at the address “0x40000010” (execution order “8”), the signals LCC and JMPTKN are asserted. At this time, the LAR update flag signal 601 is asserted, “JMP” is output as the reference numeral 204, and the branch destination address “0x40000008” is output as the data 701.

一方、図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 step 2003, IP is set to the execution address “0x40000008” corresponding to TP = 0 indicated in the trace information. (IP = 0x40000008), the process proceeds to step 2006.

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” (steps 2007, 2008 and 2017), and the instruction indicated in the source program is the register indirect branch instruction “leq” (LCC). (Steps 2018, 2020 and 2022) In step 2023, the branch destination address “0x40000008” corresponding to TP = 4 indicated in the trace information is stored in the software LAR. Thereafter, in step 2028, IP is set to the branch destination address “0x40000008” corresponding to TP = 4 indicated in the trace information (IP = 0x40000008), and after TP is incremented in step 2034 (TP = 3), step Return to 2006.

一方、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” (steps 2007 and 2008), and the instruction shown in the source program is the register indirect branch instruction “leq” as in TP = 2. Since (LCC) (steps 2009 and 2012), in step 2013, the IP is set to the branch destination address “0x40000008” stored in the software LAR (IP = 0x40000008). Then, after TP is incremented in step 2034 (TP = 6), the process returns to step 2006.

次に、本実施形態に係る半導体集積回路1によるトレース情報出力及び開発支援装置による実行履歴復元の別例について、図33に示したプログラムを実行する場合を例に説明する。この例は、プログラム自体は図28に示した先の例と同じであるが、トレースの開始が先の例よりも1命令前のアドレス"0x40000010"(実行順番"5")の命令から始まっている。   Next, another example of trace information output by the semiconductor integrated circuit 1 according to the present embodiment and execution history restoration by the development support apparatus will be described taking the case of executing the program shown in FIG. In this example, the program itself is the same as the previous example shown in FIG. 28, but the trace starts from the instruction at the address “0x40000010” (execution order “5”) one instruction before the previous example. Yes.

図34は、半導体集積回路1が図33に示したプログラムを実行したときに出力するトレース情報を示す。図34に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。   FIG. 34 shows trace information output when the semiconductor integrated circuit 1 executes the program shown in FIG. The trace information shown in FIG. 34 is obtained as a result of the operation of the semiconductor integrated circuit 1 described below. A characteristic part of this embodiment will be described.

先の例とは異なり、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” (steps 2001 and 2002), so that IP corresponds to TP = 0 indicated in the trace information in step 2004. Branch destination address “0x40000008” is set (IP = 0x40000008), TP is incremented in step 2005 (TP = 1), and then the process proceeds to step 2006. The subsequent processing is the same as in the previous example.

以上、本実施形態によると、プログラムの実行が開始された後にトレースが開始された場合であっても、トレース開始時の実行アドレス又は分岐先アドレスが出力され、また、ループ処理の途中でトレースが開始された場合、トレース開始後にループ先頭に分岐する間接分岐命令が初めて実行されたとき、その分岐先アドレスが出力される。これにより、プログラム実行の途中からトレースが開始されても、トレース開始時のプログラム部分を復元し、さらに、高速分岐命令を含むループのプログラム部分の実行履歴がが正確に復元される。   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 circuit 1 according to the present embodiment includes a CPU 100, a trace packet control unit 200, a comparator 400, an address register 670, a shift register 700, a selector 750, and a synchronization request generation circuit 800. Among these, the shift register 700, the selector 750, and the synchronization request generation circuit 800 are the same as those in the second embodiment. Hereinafter, the CPU 100, the comparator 400, and the address register 670 will be described.

CPU100は、高速分岐命令として、図示しない汎用のレジスタに格納された分岐先アドレスに分岐する間接分岐命令を実装している。CPU100は、分岐条件が成立し、間接分岐命令を実行したとき、信号JMPIND及びJMPTKNをアサートし、その分岐先アドレス110を出力する。また、CPU100は、命令を実行したとき、その命令の実行アドレス111を出力する。これ以外の点については、一部の信号を省略している以外は、第2の実施形態の場合と同様である。   The CPU 100 implements an indirect branch instruction that branches to a branch destination address stored in a general-purpose register (not shown) as a high-speed branch instruction. When the branch condition is satisfied and the indirect branch instruction is executed, the CPU 100 asserts signals JMPIND and JMPTKN and outputs the branch destination address 110. Further, when the CPU 100 executes an instruction, the CPU 100 outputs an execution address 111 of the instruction. The other points are the same as in the second embodiment except that some signals are omitted.

アドレスレジスタ670は、AND回路660によって演算された信号JMPIND及びJMPTKNの論理積をロード信号661として、CPU100から出力された分岐先アドレス110をデータとして、それぞれ受ける。すなわち、アドレスレジスタ670は、CPU100によって間接分岐命令令が実行されたとき、格納しているアドレスを出力し、分岐先アドレス110を格納する。また、アドレスレジスタ670は、同期要求信号801がアサートされたとき、格納している内容を初期化する。   The address register 670 receives the logical product of the signals JMPIND and JMPTKN calculated by the AND circuit 660 as a load signal 661 and the branch destination address 110 output from the CPU 100 as data. That is, the address register 670 outputs the stored address and stores the branch destination address 110 when an indirect branch instruction is executed by the CPU 100. The address register 670 initializes the stored contents when the synchronization request signal 801 is asserted.

比較器400は、アドレスレジスタ670から出力されたデータ671とCPU100から出力された分岐先アドレス110とを比較し、これらの一致/不一致を比較結果信号401として出力する。比較結果信号401は、一致のときはアサートされ、不一致のときはネゲートされる。   The comparator 400 compares the data 671 output from the address register 670 with the branch destination address 110 output from the CPU 100, and outputs a match / mismatch as a comparison result signal 401. The comparison result signal 401 is asserted when they match and is negated when they do not match.

図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 packet control unit 200. The trace packet control unit 200 receives the signals EOI, JMPDIR, JMPIND, JMPTKN and EXP, the comparison result signal 401 and the synchronization request signal 801, and follows the branch destination address load enable signal (TPCLDEN) according to the state decoding table shown in FIG. 201, the selection signal (TPCSEL) 202, and the code | symbol 204 output to the trace status port (PCST) 901 are determined.

一方、本実施形態に係る開発支援装置は、図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 host computer 3 as the execution history restoring unit is different from the conventional one. This will be described later.

次に、本実施形態に係る半導体集積回路1及び開発支援装置によるトレース情報出力及び実行履歴復元について、図38に示したプログラムを実行する場合を例に説明する。この例では、半導体集積回路1は、ループ"loop0"を4回実行するうち、2回目の実行のとき、実行順番"6"でトレースが開始される。   Next, trace information output and execution history restoration by the semiconductor integrated circuit 1 and the development support apparatus according to the present embodiment will be described by taking the case of executing the program shown in FIG. 38 as an example. In this example, the semiconductor integrated circuit 1 starts the trace in the execution order “6” at the second execution of the loop “loop0” four times.

図39は、半導体集積回路1が図38に示したプログラムを実行したときに出力するトレース情報を示す。図39に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。   FIG. 39 shows trace information output when the semiconductor integrated circuit 1 executes the program shown in FIG. The trace information shown in FIG. 39 is obtained as a result of the operation of the semiconductor integrated circuit 1 described below. A characteristic part of this embodiment will be described.

CPU100がアドレス"0x40000010"(実行順番"5")の間接分岐命令"beq (a0)"を実行したとき、信号JMPIND及びJMPTKNがアサートされ、アドレスレジスタ670に分岐先アドレス110("0x40000008")が格納される。なお、命令"beq (a0)"は、条件が成立したとき、レジスタ"a0"に格納した分岐先アドレスに分岐するといった間接分岐命令である。   When the CPU 100 executes the indirect branch instruction “beq (a0)” at the address “0x40000010” (execution order “5”), the signals JMPIND and JMPTKN are asserted, and the branch destination address 110 (“0x40000008”) is stored in the address register 670. Stored. The instruction “beq (a0)” is an indirect branch instruction that branches to the branch destination address stored in the register “a0” when the condition is satisfied.

次に、実行順番"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 synchronization request signal 801 is asserted, and the address register 670 is initialized. When the CPU 100 executes the instruction “instruction 2” at the address “0x40000008” (execution order “6”), the signal EOI is asserted and the execution address 111 (“0x40000008”) is output. At this time, the signals JMPIND and JMPTKN are not asserted, and the trace packet control unit 200 asserts the signal TPCLDEN and sets the value of the signal TPCSEL to “0” according to the state decoding table shown in FIG. Output "SYN". Further, the execution address “0x40000008” of the instruction “instruction 2” in the execution order “6” is output as data 701 from the shift register 700.

その後、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 CPU 100 executes the indirect branch instruction “beq (a0)” at the address “0x40000010” (execution order “8”), the signals JMPIND and JMPTKN are asserted, and the address stored in the address register 670 and the branch destination Address 110 is compared. Since the address register 670 is initialized at the start of tracing, these addresses do not match and the comparison result signal 401 is not asserted. Accordingly, the trace packet control unit 200 asserts the signal TPCLDEN, sets the value of the signal TPCSEL to “1”, and outputs “JMP” as the reference numeral 204 in accordance with the state decoding table shown in FIG. The shift register 700 outputs the execution address “0x40000008” of the instruction “instruction 2” in the execution order “6” as data 701.

一方、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 CPU 100 executes the indirect branch instruction “beq (a0)” at the address “0x40000010” (execution order “11”), the signals JMPIND and JMPTKN are asserted, and the address stored in the address register 670 and the branch destination The address 110 “0x40000008” is compared. Since the address register 670 stores the address “0x40000008” by executing the indirect branch instruction “beq (a0)” of the execution order “8”, these two addresses match and the comparison result signal 401 is asserted. The As a result, “NPC” is output as reference numeral 204 in accordance with the state decoding table shown in FIG. At this time, data 701 is not output from the shift register 700.

以上の動作によって、本実施形態に係る半導体集積回路1から、図39に示したトレース情報が出力される。   With the above operation, the trace information shown in FIG. 39 is output from the semiconductor integrated circuit 1 according to the present embodiment.

一方、図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 step 2003, IP is set to the execution address “0x40000008” corresponding to TP = 0 indicated in the trace information. (IP = 0x40000008), the process proceeds to step 2006.

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” (steps 2007, 2008 and 2017), and the instruction shown in the source program is the indirect branch instruction “beq (a0)” ( The branch destination address “0x40000008” corresponding to TP = 4 indicated in the trace information is stored in the simulation register (hereinafter referred to as “soft register”) realized by software in steps 204, 2020 and 2042) and 2043). The Thereafter, in step 2028, IP is set to the branch destination address “0x40000008” corresponding to TP = 4 indicated in the trace information (IP = 0x40000008), and after TP is incremented in step 2034 (TP = 3), step Return to 2006.

一方、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” (steps 2007 and 2008), and the instruction shown in the source program is the indirect branch instruction “beq (a0) as in TP = 2. ) "(Steps 2009 and 2040), the IP is set to the branch destination address" 0x40000008 "stored in the soft register in step 2041 (IP = 0x40000008). Then, after TP is incremented in step 2034 (TP = 6), the process returns to step 2006.

次に、本実施形態に係る半導体集積回路1によるトレース情報出力及び開発支援装置による実行履歴復元の別例について、図43に示したプログラムを実行する場合を例に説明する。この例は、プログラム自体は図38に示した先の例と同じであるが、トレースの開始が先の例よりも1命令前のアドレス"0x40000010"(実行順番"5")の命令から始まっている。   Next, another example of trace information output by the semiconductor integrated circuit 1 according to the present embodiment and execution history restoration by the development support apparatus will be described taking the case of executing the program shown in FIG. In this example, the program itself is the same as the previous example shown in FIG. 38, but the trace starts from the instruction at the address “0x40000010” (execution order “5”) one instruction before the previous example. Yes.

図44は、半導体集積回路1が図43に示したプログラムを実行したときに出力するトレース情報を示す。図44に示したトレース情報は、以下に説明する半導体集積回路1の動作の結果として得られたものである。なお、本実施形態の特徴的な部分について説明する。   FIG. 44 shows trace information output when the semiconductor integrated circuit 1 executes the program shown in FIG. The trace information shown in FIG. 44 is obtained as a result of the operation of the semiconductor integrated circuit 1 described below. A characteristic part of this embodiment will be described.

先の例とは異なり、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” (steps 2001 and 2002), so that IP corresponds to TP = 0 indicated in the trace information in step 2004. Branch destination address “0x40000008” is set (IP = 0x40000008), TP is incremented in step 2005 (TP = 1), and then the process proceeds to step 2006. The subsequent processing is the same as in the previous example.

以上、本実施形態によると、間接分岐命令を含むループ処理において、初回の間接分岐命令の実行に対して、トレース情報としてその分岐先アドレスが出力され、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 request generation circuit 800 and the selector 750 does not impair the effect of optimizing the output of trace information according to the present invention.

また、上記各実施形態に係る半導体集積回路は、シフトレジスタ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 shift register 700. Even when the branch destination address is output in parallel, the effect of the present invention is not impaired.

また、説明の便宜上、上記各実施形態に係る開発支援装置は、それぞれ、上記各実施形態に係る半導体集積回路から出力されたトレース情報に基づいてプログラム実行履歴を復元するとしたが、上記以外の半導体集積回路から出力されたトレース情報に基づいてプログラム実行履歴を復元することが可能である。   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の実施形態に係る半導体集積回路の構成図である。1 is a configuration diagram of a semiconductor integrated circuit according to a first embodiment of the present invention. 本発明の第1の実施形態に係る半導体集積回路におけるトレースパケット制御部の状態デコード表である。It is a state decoding table of the trace packet control unit in the semiconductor integrated circuit according to the first embodiment of the present invention. プログラム例及び実行順番を示す図である。It is a figure which shows a program example and execution order. 本発明の第1の実施形態に係る半導体集積回路が図3に示したプログラムを実行したときに出力するトレース情報を示す図である。It is a figure which shows the trace information output when the semiconductor integrated circuit which concerns on the 1st Embodiment of this invention runs the program shown in FIG. 本発明の第1の実施形態に係る開発支援装置による実行履歴復元方法のフローチャートである。It is a flowchart of the execution log | history restoration method by the development assistance apparatus which concerns on the 1st Embodiment of this invention. 本発明の第1の実施形態に係る開発支援装置による実行履歴復元方法のフローチャートである。It is a flowchart of the execution history restoration method by the development assistance apparatus which concerns on the 1st Embodiment of this invention. 本発明の第1の実施形態に係る開発支援装置によって復元されたプログラム実行履歴を示す図である。It is a figure which shows the program execution log decompress | restored by the development assistance apparatus which concerns on the 1st Embodiment of this invention. 本発明の第2の実施形態に係る半導体集積回路の構成図である。It is a block diagram of the semiconductor integrated circuit which concerns on the 2nd Embodiment of this invention. 本発明の第2の実施形態に係る半導体集積回路におけるトレースパケット制御部の状態デコード表である。It is a state decoding table | surface of the trace packet control part in the semiconductor integrated circuit which concerns on the 2nd Embodiment of this invention. プログラム例及び実行順番を示す図である。It is a figure which shows a program example and execution order. 本発明の第2の実施形態に係る半導体集積回路が図10に示したプログラムを実行したときに出力するトレース情報を示す図である。It is a figure which shows the trace information output when the semiconductor integrated circuit which concerns on the 2nd Embodiment of this invention runs the program shown in FIG. 本発明の第2の実施形態に係る開発支援装置による実行履歴復元方法のフローチャートである。It is a flowchart of the execution log restoration method by the development assistance apparatus which concerns on the 2nd Embodiment of this invention. 本発明の第2の実施形態に係る開発支援装置による実行履歴復元方法のフローチャートである。It is a flowchart of the execution log restoration method by the development assistance apparatus which concerns on the 2nd Embodiment of this invention. 本発明の第2の実施形態に係る開発支援装置によって復元されたプログラム実行履歴を示す図である。It is a figure which shows the program execution log | history decompress | restored by the development assistance apparatus which concerns on the 2nd Embodiment of this invention. プログラム例及び実行順番を示す図である。It is a figure which shows a program example and execution order. 本発明の第2の実施形態に係る半導体集積回路が図15に示したプログラムを実行したときに出力するトレース情報を示す図である。FIG. 16 is a diagram showing trace information output when the semiconductor integrated circuit according to the second embodiment of the present invention executes the program shown in FIG. 15. 本発明の第2の実施形態に係る開発支援装置によって復元されたプログラム実行履歴を示す図である。It is a figure which shows the program execution log | history decompress | restored by the development assistance apparatus which concerns on the 2nd Embodiment of this invention. 本発明の第3の実施形態に係る半導体集積回路の構成図である。It is a block diagram of the semiconductor integrated circuit which concerns on the 3rd Embodiment of this invention. ループ検出回路の別の構成図である。It is another block diagram of a loop detection circuit. 本発明の第3の実施形態に係る半導体集積回路におけるトレースパケット制御部の状態デコード表である。It is a state decoding table | surface of the trace packet control part in the semiconductor integrated circuit which concerns on the 3rd Embodiment of this invention. プログラム例及び実行順番を示す図である。It is a figure which shows a program example and execution order. 本発明の第3の実施形態に係る半導体集積回路が図21に示したプログラムを実行したときに出力するトレース情報を示す図である。It is a figure which shows the trace information output when the semiconductor integrated circuit which concerns on the 3rd Embodiment of this invention runs the program shown in FIG. 本発明の第3の実施形態に係る開発支援装置による実行履歴復元方法のフローチャートである。It is a flowchart of the execution log restoration method by the development assistance apparatus which concerns on the 3rd Embodiment of this invention. 本発明の第3の実施形態に係る開発支援装置による実行履歴復元方法のフローチャートである。It is a flowchart of the execution log restoration method by the development assistance apparatus which concerns on the 3rd Embodiment of this invention. 本発明の第3の実施形態に係る開発支援装置によって復元されたプログラム実行履歴を示す図である。It is a figure which shows the program execution log decompress | restored by the development assistance apparatus which concerns on the 3rd Embodiment of this invention. 本発明の第4の実施形態に係る半導体集積回路の構成図である。It is a block diagram of the semiconductor integrated circuit which concerns on the 4th Embodiment of this invention. 本発明の第4の実施形態に係る半導体集積回路におけるトレースパケット制御部の状態デコード表である。It is a state decoding table | surface of the trace packet control part in the semiconductor integrated circuit which concerns on the 4th Embodiment of this invention. プログラム例及び実行順番を示す図である。It is a figure which shows a program example and execution order. 本発明の第4の実施形態に係る半導体集積回路が図28に示したプログラムを実行したときに出力するトレース情報を示す図である。It is a figure which shows the trace information output when the semiconductor integrated circuit which concerns on the 4th Embodiment of this invention runs the program shown in FIG. 本発明の第4の実施形態に係る開発支援装置による実行履歴復元方法のフローチャートである。It is a flowchart of the execution log restoration method by the development assistance apparatus which concerns on the 4th Embodiment of this invention. 本発明の第4の実施形態に係る開発支援装置による実行履歴復元方法のフローチャートである。It is a flowchart of the execution log restoration method by the development assistance apparatus which concerns on the 4th Embodiment of this invention. 本発明の第4の実施形態に係る開発支援装置によって復元されたプログラム実行履歴を示す図である。It is a figure which shows the program execution log decompress | restored by the development assistance apparatus which concerns on the 4th Embodiment of this invention. プログラム例及び実行順番を示す図である。It is a figure which shows a program example and execution order. 本発明の第4の実施形態に係る半導体集積回路が図33に示したプログラムを実行したときに出力するトレース情報を示す図である。It is a figure which shows the trace information output when the semiconductor integrated circuit which concerns on the 4th Embodiment of this invention runs the program shown in FIG. 本発明の第4の実施形態に係る開発支援装置によって復元されたプログラム実行履歴を示す図である。It is a figure which shows the program execution log decompress | restored by the development assistance apparatus which concerns on the 4th Embodiment of this invention. 本発明の第5の実施形態に係る半導体集積回路の構成図である。It is a block diagram of the semiconductor integrated circuit which concerns on the 5th Embodiment of this invention. 本発明の第5の実施形態に係る半導体集積回路におけるトレースパケット制御部の状態デコード表である。It is a state decoding table | surface of the trace packet control part in the semiconductor integrated circuit which concerns on the 5th Embodiment of this invention. プログラム例及び実行順番を示す図である。It is a figure which shows a program example and execution order. 本発明の第5の実施形態に係る半導体集積回路が図38に示したプログラムを実行したときに出力するトレース情報を示す図である。FIG. 39 is a diagram showing trace information output when the semiconductor integrated circuit according to the fifth embodiment of the present invention executes the program shown in FIG. 38. 本発明の第5の実施形態に係る開発支援装置による実行履歴復元方法のフローチャートである。It is a flowchart of the execution log restoration method by the development assistance apparatus which concerns on the 5th Embodiment of this invention. 本発明の第5の実施形態に係る開発支援装置による実行履歴復元方法のフローチャートである。It is a flowchart of the execution log restoration method by the development assistance apparatus which concerns on the 5th Embodiment of this invention. 本発明の第5の実施形態に係る開発支援装置によって復元されたプログラム実行履歴を示す図である。It is a figure which shows the program execution log decompress | restored by the development assistance apparatus which concerns on the 5th Embodiment of this invention. プログラム例及び実行順番を示す図である。It is a figure which shows a program example and execution order. 本発明の第5の実施形態に係る半導体集積回路が図43に示したプログラムを実行したときに出力するトレース情報を示す図である。It is a figure which shows the trace information output when the semiconductor integrated circuit which concerns on the 5th Embodiment of this invention runs the program shown in FIG. 本発明の第5の実施形態に係る開発支援装置によって復元されたプログラム実行履歴を示す図である。It is a figure which shows the program execution log decompress | restored by the development assistance apparatus which concerns on the 5th Embodiment of this invention. 従来のトレース情報出力機能を有する半導体集積回路の構成図である。It is a block diagram of a semiconductor integrated circuit having a conventional trace information output function. 図46の半導体集積回路におけるトレースパケット制御部の状態デコード表である。47 is a state decode table of a trace packet control unit in the semiconductor integrated circuit of FIG. 開発支援装置の構成図である。It is a block diagram of a development support apparatus. 実行プログラム例及び実行順番を示す図である。It is a figure which shows the example of an execution program, and execution order. 図49のプログラムの実行によって出力されたトレース情報を示す図である。It is a figure which shows the trace information output by execution of the program of FIG. 従来の実行履歴復元方法のフローチャートである。It is a flowchart of the conventional execution history restoration method. 図50のトレース情報に基づいて復元されたプログラム実行履歴を示す図である。It is a figure which shows the program execution log | history restored | restored based on the trace information of FIG.

符号の説明Explanation of symbols

1 半導体集積回路
100 CPU
300 スタックメモリ
400 比較器
200 トレースパケット制御部
700 シフトレジスタ(アドレスレジスタ、第2のアドレスレジスタ)
800 同期要求生成回路
750 セレクタ
600 ループ検出回路
610 保持回路
620 リセット回路
670 アドレスレジスタ(第1のアドレスレジスタ)
1030 トレースメモリ
3 ホストコンピュータ(実行履歴復元部)
1 Semiconductor Integrated Circuit 100 CPU
300 Stack Memory 400 Comparator 200 Trace Packet Control Unit 700 Shift Register (Address Register, Second Address Register)
800 Synchronization request generation circuit 750 Selector 600 Loop detection circuit 610 Holding circuit 620 Reset circuit 670 Address register (first address register)
1030 Trace memory 3 Host computer (execution history restoration unit)

Claims (28)

コール命令を実行したとき、第1の信号をアサートするとともに前記コール命令に係る分岐先アドレス及び復帰先アドレスを出力し、割込み分岐を実行したとき、第2の信号をアサートするとともに前記割込み分岐に係る分岐先アドレス及び復帰先アドレスを出力し、復帰命令を実行したとき、第3の信号をアサートするとともに前記復帰命令に係る分岐先アドレスを出力するCPUと、
前記第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.
請求項1に記載の半導体集積回路において、
前記トレースパケット制御部は、前記第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.
請求項1に記載の半導体集積回路において、
トレースが開始されたとき、第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:
請求項3に記載の半導体集積回路において、
前記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.
請求項3に記載の半導体集積回路において、
前記同期要求生成回路は、システムリセット、タスク切り替え、及びトレース開始の少なくともいずれかのとき、前記第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.
請求項3に記載の半導体集積回路において、
前記同期要求生成回路は、外部から指示があったとき、前記第4の信号をアサートする
ことを特徴とする半導体集積回路。
The semiconductor integrated circuit according to claim 3,
The synchronization request generation circuit asserts the fourth signal when instructed from outside.
請求項3に記載の半導体集積回路において、
前記同期要求生成回路は、一定周期で、前記第4の信号をアサートする
ことを特徴とする半導体集積回路。
The semiconductor integrated circuit according to claim 3,
The synchronization request generation circuit asserts the fourth signal at a constant period.
レジスタに格納された分岐先アドレスに分岐する間接分岐命令を持つCPUであって、前記レジスタを更新したとき、第1の信号をアサートし、前記間接分岐命令を実行したとき、第2の信号をアサートするとともに前記間接分岐命令に係る分岐先アドレスを出力するCPUと、
前記第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.
請求項8に記載の半導体集積回路において、
前記ループ検出回路は、
前記第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.
請求項8に記載の半導体集積回路において、
トレースが開始されたとき、第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.
請求項10に記載の半導体集積回路において、
前記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.
請求項10に記載の半導体集積回路において、
前記同期要求生成回路は、システムリセット、タスク切り替え、及びトレース開始の少なくともいずれかのとき、前記第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.
請求項10に記載の半導体集積回路において、
前記同期要求生成回路は、外部から指示があったとき、前記第4の信号をアサートする
ことを特徴とする半導体集積回路。
The semiconductor integrated circuit according to claim 10,
The synchronization request generation circuit asserts the fourth signal when instructed from outside.
請求項10に記載の半導体集積回路において、
前記同期要求生成回路は、一定周期で、前記第4の信号をアサートする
ことを特徴とする半導体集積回路。
The semiconductor integrated circuit according to claim 10,
The synchronization request generation circuit asserts the fourth signal at a constant period.
レジスタに格納された分岐先アドレスに分岐する間接分岐命令を持つCPUであって、前記間接分岐命令を実行したとき、第1の信号をアサートするとともに前記間接分岐命令に係る分岐先アドレスを出力するCPUと、
前記第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.
請求項15に記載の半導体集積回路において、
トレースが開始されたとき、第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.
請求項16に記載の半導体集積回路において、
前記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.
請求項16に記載の半導体集積回路において、
前記同期要求生成回路は、システムリセット、タスク切り替え、及びトレース開始の少なくともいずれかのとき、前記第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.
請求項16に記載の半導体集積回路において、
前記同期要求生成回路は、外部から指示があったとき、前記第2の信号をアサートする
ことを特徴とする半導体集積回路。
The semiconductor integrated circuit according to claim 16, wherein
The synchronization request generation circuit asserts the second signal when instructed from the outside.
請求項16に記載の半導体集積回路において、
前記同期要求生成回路は、一定周期で、前記第2の信号をアサートする
ことを特徴とする半導体集積回路。
The semiconductor integrated circuit according to claim 16, wherein
The synchronization request generation circuit asserts the second signal at a constant cycle.
請求項1に記載の半導体集積回路から出力されたトレース状態符号及びアドレスをトレース情報として格納するトレースメモリと、
前記半導体集積回路における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.
請求項4に記載の半導体集積回路から出力されたトレース状態符号及びアドレスをトレース情報として格納するトレースメモリと、
前記半導体集積回路における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.
請求項8及び15のいずれか一つに記載の半導体集積回路から出力されたトレース状態符号及びアドレスをトレース情報として格納するトレースメモリと、
前記半導体集積回路における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.
請求項11及び17のいずれか一つに記載の半導体集積回路から出力されたトレース状態符号及びアドレスをトレース情報として格納するトレースメモリと、
前記半導体集積回路における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.
請求項1に記載の半導体集積回路からトレース情報としてトレース状態符号及びアドレスを得て、前記半導体集積回路におけるCPUによって実行されたソースプログラムと前記トレース情報とを順に対応させながら、前記CPUによる前記ソースプログラムの実行履歴を復元する方法において、
前記ソースプログラムからコール命令を検出するステップと、
前記トレース情報から割込み分岐の実行を示す符号を検出するステップと、
前記ソースプログラムから復帰命令を検出するステップと、
前記コール命令及び符号のいずれか一方が検出されたとき、前記ソースプログラムから復帰先アドレスを得てプッシュするステップと、
前記コール命令及び符号のいずれか一方が検出されたとき、前記トレース情報から分岐先アドレスを得て復元するステップと、
前記復帰命令が検出されたとき、プッシュされている復帰先アドレスをポップして復元するステップとを備えた
ことを特徴とする実行履歴復元方法。
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.
請求項4に記載の半導体集積回路からトレース情報としてトレース状態符号及びアドレスを得て、前記半導体集積回路におけるCPUによって実行されたソースプログラムと前記トレース情報とを順に対応させながら、前記CPUによる前記ソースプログラムの実行履歴を復元する方法において、
前記ソースプログラムからコール命令を検出するステップと、
前記ソースプログラムから復帰命令を検出するステップと、
前記トレース情報から割込み分岐の実行を示す第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.
請求項8及び15のいずれか一つに記載の半導体集積回路からトレース情報としてトレース状態符号及びアドレスを得て、前記半導体集積回路におけるCPUによって実行されたソースプログラムと前記トレース情報とを順に対応させながら、前記CPUによる前記ソースプログラムの実行履歴を復元する方法において、
前記ソースプログラムから間接分岐命令を検出するステップと、
前記トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す第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.
請求項11及び17のいずれか一つに記載の半導体集積回路からトレース情報としてトレース状態符号及びアドレスを得て、前記半導体集積回路におけるCPUによって実行されたソースプログラムと前記トレース情報とを順に対応させながら、前記CPUによる前記ソースプログラムの実行履歴を復元する方法において、
前記ソースプログラムから間接分岐命令を検出するステップと、
前記トレース情報から分岐先アドレスを伴った間接分岐命令の実行を示す第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.
JP2004369944A 2003-12-24 2004-12-21 Semiconductor integrated circuit, development support device and execution history restoration method Pending JP2005209172A (en)

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)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021075531A1 (en) * 2019-10-18 2021-04-22 ローム株式会社 Trace circuit, semiconductor device, tracer, and trace system

Cited By (2)

* Cited by examiner, † Cited by third party
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