JP6127883B2 - Semiconductor device and semiconductor device operation control method - Google Patents

Semiconductor device and semiconductor device operation control method Download PDF

Info

Publication number
JP6127883B2
JP6127883B2 JP2013207171A JP2013207171A JP6127883B2 JP 6127883 B2 JP6127883 B2 JP 6127883B2 JP 2013207171 A JP2013207171 A JP 2013207171A JP 2013207171 A JP2013207171 A JP 2013207171A JP 6127883 B2 JP6127883 B2 JP 6127883B2
Authority
JP
Japan
Prior art keywords
instruction
register
value
flag
trace
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.)
Active
Application number
JP2013207171A
Other languages
Japanese (ja)
Other versions
JP2015072551A (en
Inventor
稔彦 松田
稔彦 松田
康秀 松本
康秀 松本
卓也 平田
卓也 平田
広幸 高木
広幸 高木
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Socionext Inc
Original Assignee
Socionext Inc
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 Socionext Inc filed Critical Socionext Inc
Priority to JP2013207171A priority Critical patent/JP6127883B2/en
Publication of JP2015072551A publication Critical patent/JP2015072551A/en
Application granted granted Critical
Publication of JP6127883B2 publication Critical patent/JP6127883B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Description

本発明は、半導体装置および半導体装置の動作制御方法に関する。   The present invention relates to a semiconductor device and an operation control method for the semiconductor device.

プロセッサを含むシステム装置の開発では、プロセッサが実行するプログラムの実行結果がトレースされ、トレースされた情報は、トレースバッファに格納される。そして、トレースバッファに格納された情報に基づいてプログラムの実行結果がエミュレータ機能を用いて再現され、プログラムおよびシステム装置のデバッグを実施する手法が有用である。   In the development of a system apparatus including a processor, the execution result of a program executed by the processor is traced, and the traced information is stored in a trace buffer. Then, based on the information stored in the trace buffer, a program execution result is reproduced using an emulator function, and a method for debugging the program and the system device is useful.

例えば、同じトレース情報が繰り返し生成される場合、冗長なトレース情報の生成を回避することで、トレースバッファに格納されるトレース情報の量は削減される(例えば、特許文献1参照)。また、アドレスが即値で指定されるコール命令やジャンプ命令等のトレース情報を生成しないことで、トレースバッファに格納されるトレース情報の量は削減される(例えば、特許文献2参照)。さらに、所望のトレース情報を選択的にトレースバッファに格納することで、トレースバッファに格納されるトレース情報の量は削減される(例えば、特許文献3参照)。   For example, when the same trace information is repeatedly generated, the amount of trace information stored in the trace buffer is reduced by avoiding generation of redundant trace information (see, for example, Patent Document 1). Further, by not generating trace information such as a call instruction or a jump instruction whose address is designated as an immediate value, the amount of trace information stored in the trace buffer is reduced (see, for example, Patent Document 2). Furthermore, by selectively storing desired trace information in the trace buffer, the amount of trace information stored in the trace buffer is reduced (see, for example, Patent Document 3).

特開2004−38981号公報JP 2004-38981 A 特表2001−519947号公報Special table 2001-519947 gazette 特開昭61−52748号公報JP 61-52748 A

しかしながら、メモリにアクセスする命令で使用されるレジスタの値を、トレース情報として出力するか否かを判定することで、トレース情報の量を削減する手法は提案されていない。   However, a method for reducing the amount of trace information by determining whether or not to output the value of a register used in an instruction for accessing a memory as trace information has not been proposed.

本件開示の半導体装置および半導体装置の動作制御方法は、トレース情報の量を削減し、それによって、トレース情報を出力する端子の数を削減し、半導体装置の規模を削減することを目的とする。   An object of the semiconductor device and the operation control method of the semiconductor device disclosed herein is to reduce the amount of trace information, thereby reducing the number of terminals that output the trace information, and reducing the scale of the semiconductor device.

一つの観点によれば、半導体装置は、命令を実行する演算部と、演算部で使用する情報を保持するレジスタと、レジスタに対応して設けられ、第1の値または第2の値に設定されるフラグを保持する記憶部と、演算部により実行された命令に基づいてレジスタに格納された情報を再現することが困難な場合にフラグを第1の値に設定し、演算部により実行された命令に基づいてレジスタに格納された情報を再現可能な場合にフラグを第2の値に設定するフラグ制御部と、メモリにアクセスする命令が演算部により実行される場合に、メモリのアクセスに使用される値であって、第1の値に設定されたフラグに対応するレジスタに格納された値をトレース情報として出力するトレース制御部とを有する。   According to one aspect, the semiconductor device is provided corresponding to the arithmetic unit that executes an instruction, a register that holds information used in the arithmetic unit, and is set to the first value or the second value. The flag is set to the first value when it is difficult to reproduce the information stored in the register based on the instruction executed by the arithmetic unit and the storage unit that holds the flag to be executed by the arithmetic unit When the information stored in the register can be reproduced based on the received instruction, the flag control unit sets the flag to the second value, and when the instruction to access the memory is executed by the arithmetic unit, the memory access is performed. A trace control unit that outputs a value to be used and stored as a trace information in a register corresponding to the flag set to the first value.

別の観点によれば、半導体装置の動作制御方法は、命令を実行する演算部と、演算部で使用する情報を保持するレジスタとを備える半導体装置の動作制御方法であって、レジスタに対応して設けられる記憶部のフラグを、演算部による命令の実行結果に応じて、演算部により実行された命令に基づいてレジスタに格納された情報を再現することが困難な場合に第1の値に設定し、演算部により実行された命令に基づいてレジスタに格納された情報を再現可能な場合に第2の値に設定し、メモリにアクセスする命令が演算部により実行される場合に、メモリのアクセスに使用される値であって、第1の値に設定されたフラグに対応するレジスタに格納された値をトレース情報として出力する。   According to another aspect, an operation control method for a semiconductor device is an operation control method for a semiconductor device including an operation unit that executes an instruction and a register that holds information used in the operation unit, and corresponds to the register. Is set to the first value when it is difficult to reproduce the information stored in the register based on the instruction executed by the arithmetic unit according to the execution result of the instruction by the arithmetic unit. If the information stored in the register is reproducible based on the instruction executed by the arithmetic unit, the second value is set. If the instruction to access the memory is executed by the arithmetic unit, A value used for access and stored in a register corresponding to the flag set to the first value is output as trace information.

本件開示の半導体装置および半導体装置の動作制御方法は、トレース情報を出力する端子の数を削減することができ、半導体装置の規模を削減することができる。   The semiconductor device and the semiconductor device operation control method disclosed in the present disclosure can reduce the number of terminals that output trace information, and can reduce the size of the semiconductor device.

半導体装置および半導体装置の動作制御方法の一実施形態を示す図である。It is a figure which shows one Embodiment of the semiconductor device and the operation control method of a semiconductor device. 半導体装置および半導体装置の動作制御方法の別の実施形態を示す図である。It is a figure which shows another embodiment of the semiconductor device and the operation control method of a semiconductor device. 図2に示したプロセッサの例を示す図である。FIG. 3 is a diagram illustrating an example of a processor illustrated in FIG. 2. 図3に示したフラグ制御部によりフラグを書き替える条件の例を示す図である。It is a figure which shows the example of the conditions which rewrite a flag by the flag control part shown in FIG. 図3に示したフラグ制御部によるフラグの書き替え動作の例を示す図である。It is a figure which shows the example of the rewriting operation | movement of the flag by the flag control part shown in FIG. 図2に示したトレース制御部の例を示す図である。It is a figure which shows the example of the trace control part shown in FIG. 図6に示したトレース制御部の動作の例を示す図である。It is a figure which shows the example of operation | movement of the trace control part shown in FIG. 図2に示したプロセッサが実行するプログラムの記述の例を示す図である。It is a figure which shows the example of the description of the program which the processor shown in FIG. 2 performs. 図8に示したプログラムをプロセッサが実行する場合における半導体装置の動作の例を示す図である。It is a figure which shows the example of operation | movement of a semiconductor device in case a processor runs the program shown in FIG. 図8に示したプログラムをプロセッサが実行する場合に出力されるトレース情報の例を示す図である。It is a figure which shows the example of the trace information output when a processor runs the program shown in FIG. 図2に示したエミュレータの動作の例を示す図である。FIG. 3 is a diagram illustrating an example of an operation of the emulator illustrated in FIG. 2. 図11に示したエミュレータの動作により復元されたプロセッサの実行履歴の例を示す図である。It is a figure which shows the example of the execution log | history of the processor decompress | restored by operation | movement of the emulator shown in FIG.

以下、図面を用いて実施形態を説明する。信号が伝達される信号線には、信号名と同じ符号を使用する。図中の二重の四角印は、外部端子を示す。外部端子は、例えば、半導体チップ上のパッド、あるいは半導体チップが収納されるパッケージのリードである。   Hereinafter, embodiments will be described with reference to the drawings. The same reference numerals as the signal names are used for signal lines through which signals are transmitted. Double square marks in the figure indicate external terminals. The external terminal is, for example, a pad on a semiconductor chip or a lead of a package in which the semiconductor chip is stored.

図1は、半導体装置および半導体装置の動作制御方法の一実施形態を示す。例えば、この実施形態の半導体装置SEM1は、演算部OPU、レジスタREG、記憶部MU、フラグ制御部FCNTおよびトレース制御部TCNTを有する。演算部OPUは、例えば、メモリMEMから供給される命令INSを実行する。レジスタREGは、演算部OPUで使用する値を保持する。   FIG. 1 shows an embodiment of a semiconductor device and an operation control method for the semiconductor device. For example, the semiconductor device SEM1 of this embodiment includes an operation unit OPU, a register REG, a storage unit MU, a flag control unit FCNT, and a trace control unit TCNT. The arithmetic unit OPU executes, for example, an instruction INS supplied from the memory MEM. The register REG holds a value used in the arithmetic unit OPU.

記憶部MUは、レジスタREGに対応して設けられ、第1の値(例えば、”0”)または第2の値(例えば、”1”)に設定されるフラグFLGを保持する。なお、半導体装置SEM1は、複数のレジスタREGと、複数のレジスタREGにそれぞれ対応する複数のフラグFLGを含む記憶部MUを有してもよい。   The storage unit MU is provided corresponding to the register REG, and holds a flag FLG set to a first value (for example, “0”) or a second value (for example, “1”). Note that the semiconductor device SEM1 may include a storage unit MU including a plurality of registers REG and a plurality of flags FLG respectively corresponding to the plurality of registers REG.

フラグ制御部FCNTは、演算部OPUによる命令の実行結果に応じて、演算部OPUにより実行された命令INSに基づいてレジスタREGに格納された値を再現することが困難な場合に、フラグFLGを第1の値に設定する。フラグ制御部FCNTは、演算部OPUにより実行された命令INSに基づいてレジスタREGに格納された値を再現可能な場合に、フラグFLGを第2の値に設定する。   The flag control unit FCNT sets the flag FLG when it is difficult to reproduce the value stored in the register REG based on the instruction INS executed by the arithmetic unit OPU according to the execution result of the instruction by the arithmetic unit OPU. Set to the first value. The flag control unit FCNT sets the flag FLG to the second value when the value stored in the register REG can be reproduced based on the instruction INS executed by the arithmetic unit OPU.

トレース制御部TCNTは、メモリMEMにアクセスする命令が演算部OPUにより実行される場合、メモリアクセスに使用される値であって、第1の値に設定されたフラグFLGに対応するレジスタREGに格納された値をトレース情報TRIとして出力する。換言すれば、トレース制御部TCNTは、メモリアクセスに使用される値であって、第2の値に設定されたフラグFLGに対応するレジスタREGに格納された値をトレース情報TRIとして出力することを禁止する。   When an instruction to access the memory MEM is executed by the arithmetic unit OPU, the trace control unit TCNT is a value used for memory access and is stored in the register REG corresponding to the flag FLG set to the first value. The obtained value is output as trace information TRI. In other words, the trace control unit TCNT outputs a value used for memory access and stored in the register REG corresponding to the flag FLG set to the second value as the trace information TRI. Ban.

例えば、トレース制御部TCNTは、第1の値に設定されたフラグFLGに対応するレジスタREGに格納されたデータをメモリMEMに書き込む命令が演算部OPUにより実行される場合に、メモリMEMに書き込むデータをトレース情報TRIとして出力する。トレース制御部TCNTは、第2の値に設定されたフラグFLGに対応するレジスタREGに格納されたデータをメモリMEMに書き込む命令が演算部OPUにより実行される場合に、メモリMEMに書き込むデータのトレース情報TRIとしての出力を禁止する。   For example, the trace control unit TCNT may write data to the memory MEM when an instruction to write the data stored in the register REG corresponding to the flag FLG set to the first value to the memory MEM is executed by the arithmetic unit OPU. Is output as trace information TRI. The trace control unit TCNT traces data to be written to the memory MEM when an instruction to write the data stored in the register REG corresponding to the flag FLG set to the second value to the memory MEM is executed by the arithmetic unit OPU. Output as information TRI is prohibited.

あるいは、トレース制御部TCNTは、第1の値に設定されたフラグFLGに対応するレジスタREGに格納されたアドレスを用いてメモリMEMにアクセスする命令が実行される場合、レジスタREGに格納されたアドレスをトレース情報TRIとして出力する。トレース制御部TCNTは、第2の値に設定されたフラグFLGに対応するレジスタREGに格納されたアドレスを用いてメモリMEMにアクセスする命令が実行される場合、レジスタREGに格納されたアドレスのトレース情報TRIとしての出力を禁止する。   Alternatively, when the instruction to access the memory MEM is executed using the address stored in the register REG corresponding to the flag FLG set to the first value, the trace control unit TCNT uses the address stored in the register REG. Is output as trace information TRI. When the instruction to access the memory MEM is executed using the address stored in the register REG corresponding to the flag FLG set to the second value, the trace control unit TCNT traces the address stored in the register REG. Output as information TRI is prohibited.

例えば、トレース情報TRIは、エミュレータEMLに転送される。なお、トレース情報TRIは、トレースバッファを介してエミュレータEMLに転送されてもよい。エミュレータEMLは、半導体装置SEM1からのトレース情報TRIと、演算部OPUにより実行される命令が記述されたソースプログラムSPGMとに基づいて、実行履歴ELISTを出力する。例えば、実行履歴ELISTは、演算部OPUが実行した命令、演算部OPUが命令を実行した際のレジスタREGの値、およびメモリMEMにアクセスしたときのアドレスおよびデータの値等が含まれる。   For example, the trace information TRI is transferred to the emulator EML. Note that the trace information TRI may be transferred to the emulator EML via the trace buffer. The emulator EML outputs an execution history ELIST based on the trace information TRI from the semiconductor device SEM1 and the source program SPGM in which instructions executed by the arithmetic unit OPU are described. For example, the execution history ELIST includes an instruction executed by the arithmetic unit OPU, a value of the register REG when the arithmetic unit OPU executes the instruction, and an address and data value when the memory MEM is accessed.

この実施形態では、レジスタREGに対応して設けられる記憶部MUに設定されるフラグFLGの値に応じて、演算部OPUの動作により使用されたレジスタREGに格納された値をトレース情報TRIとして出力するか否かが判断される。そして、演算部OPUにより既に実行された命令INSに基づいてレジスタREGに格納された値を再現することが困難な場合に、再現が困難な値がトレース情報TRIとして出力される。換言すれば、演算部OPUにより既に実行された命令INSに基づいてレジスタREGに格納された値を再現可能な場合に、トレース情報TRIは出力されない。   In this embodiment, the value stored in the register REG used by the operation of the arithmetic unit OPU is output as the trace information TRI according to the value of the flag FLG set in the storage unit MU provided corresponding to the register REG. It is determined whether or not to do so. Then, when it is difficult to reproduce the value stored in the register REG based on the instruction INS already executed by the arithmetic unit OPU, a value that is difficult to reproduce is output as the trace information TRI. In other words, the trace information TRI is not output when the value stored in the register REG can be reproduced based on the instruction INS already executed by the arithmetic unit OPU.

これにより、トレース情報TRIの量を従来に比べて削減することができる。トレース情報TRIの量の削減により、トレース情報TRIを出力するために半導体装置SEM1に設けられる端子の数を従来に比べて削減することができる。また、トレース情報TRIが、トレースバッファを介してエミュレータEMLに転送される場合には、トレースバッファの記憶容量を従来に比べて削減することができる。この結果、半導体装置SEM1の規模を削減することができ、半導体装置SEM1が搭載されるシステムの規模を削減することができ、システムコストの削減に寄与することができる。   Thereby, the amount of the trace information TRI can be reduced as compared with the conventional case. By reducing the amount of the trace information TRI, the number of terminals provided in the semiconductor device SEM1 for outputting the trace information TRI can be reduced as compared with the related art. Further, when the trace information TRI is transferred to the emulator EML via the trace buffer, the storage capacity of the trace buffer can be reduced as compared with the conventional case. As a result, the scale of the semiconductor device SEM1 can be reduced, the scale of the system on which the semiconductor device SEM1 is mounted can be reduced, and the system cost can be reduced.

また、トレース情報TRIを出力するために半導体装置SEM1に設けられる端子の数を削減しない場合、演算部OPUの動作とともにリアルタイムでトレース可能な命令数を従来に比べて増やすことができる。例えば、演算部OPUの動作周波数が高くなる場合にも、演算部OPUが実行する命令に同期してリアルタイムでトレース情報TRIを出力することができ、半導体装置SEM1が搭載されるシステムのデバッグ性能を向上することができる。   Further, when the number of terminals provided in the semiconductor device SEM1 is not reduced in order to output the trace information TRI, the number of instructions that can be traced in real time can be increased as compared with the conventional case along with the operation of the arithmetic unit OPU. For example, even when the operating frequency of the arithmetic unit OPU increases, the trace information TRI can be output in real time in synchronization with an instruction executed by the arithmetic unit OPU, and the debugging performance of the system in which the semiconductor device SEM1 is mounted can be improved. Can be improved.

図2は、半導体装置および半導体装置の動作制御方法の別の実施形態を示す。図1に示した実施形態で説明した要素と同一または同様の要素については、同一の符号を付し、これ等については、詳細な説明を省略する。例えば、この実施形態の半導体装置SEM2は、トレースバッファ60とともにデバッグ基板DBGB上に搭載される。なお、デバッグが完了した半導体装置SEM2は、システム基板等に搭載され、出荷される。   FIG. 2 shows another embodiment of the semiconductor device and the operation control method of the semiconductor device. Elements that are the same as or similar to those described in the embodiment shown in FIG. 1 are given the same reference numerals, and detailed descriptions thereof are omitted. For example, the semiconductor device SEM2 of this embodiment is mounted on the debug board DBGB together with the trace buffer 60. The semiconductor device SEM2 that has been debugged is mounted on a system board or the like and shipped.

例えば、半導体装置SEM2は、プロセッサ10、メモリ20、周辺回路30およびユーザロジック40と、プロセッサ10に接続されたトレース制御部50とを有する。プロセッサ10、メモリ20、周辺回路30およびユーザロジック40は、システムバスSBUSを介して互いに接続される。例えば、デバッグ基板DBGBは、コネクタおよびケーブル等を介してエミュレータ100に接続される。なお、半導体装置SEM2は、図2に示した構成に限定されない。例えば、トレースバッファ60は、半導体装置SEM2に搭載されてもよく、周辺回路30およびユーザロジック40は、ユーザのシステム仕様に応じて選択的に半導体メモリMEMに搭載されてもよい。   For example, the semiconductor device SEM2 includes a processor 10, a memory 20, a peripheral circuit 30, and user logic 40, and a trace control unit 50 connected to the processor 10. The processor 10, the memory 20, the peripheral circuit 30, and the user logic 40 are connected to each other via the system bus SBUS. For example, the debug board DBGB is connected to the emulator 100 via a connector and a cable. The semiconductor device SEM2 is not limited to the configuration shown in FIG. For example, the trace buffer 60 may be mounted on the semiconductor device SEM2, and the peripheral circuit 30 and the user logic 40 may be selectively mounted on the semiconductor memory MEM according to the user system specifications.

エミュレータ100は、ICE(In Circuit Emulator)等のコンピュータであり、入力装置110、出力装置120および記憶装置130に接続される。例えば、入力装置110は、キーボードやマウスであり、出力装置120は、ディスプレイやプリンタであり、記憶装置130はハードディスクドライブ等である。   The emulator 100 is a computer such as an ICE (In Circuit Emulator), and is connected to the input device 110, the output device 120, and the storage device 130. For example, the input device 110 is a keyboard or a mouse, the output device 120 is a display or a printer, and the storage device 130 is a hard disk drive or the like.

エミュレータ100は、プログラムを実行することにより、トレースバッファ60に蓄積されたトレース情報TRIと、記憶装置130に記憶されたソースプログラムとに基づいて、プロセッサ10により実行された命令を再現する。なお、プロセッサ10は、ソースプログラムをアセンブルすることにより生成される機械語の命令(メモリ20に格納)を実行する。すなわち、プロセッサ10が実行する命令と、記憶装置130に記憶されたソースプログラムに含まれる命令とは、互いに対応している。そして、デバッグ基板DBGB、エミュレータ100、入力装置110、出力装置120および記憶装置130により、半導体装置SEM2の開発を支援するデバッグシステムDBGSYSが構築される。   The emulator 100 reproduces the instruction executed by the processor 10 based on the trace information TRI accumulated in the trace buffer 60 and the source program stored in the storage device 130 by executing the program. The processor 10 executes a machine language instruction (stored in the memory 20) generated by assembling the source program. That is, the instruction executed by the processor 10 and the instruction included in the source program stored in the storage device 130 correspond to each other. The debug board DBGB, the emulator 100, the input device 110, the output device 120, and the storage device 130 constitute a debug system DBGSYS that supports development of the semiconductor device SEM2.

例えば、プロセッサ10は、メモリ20に格納された命令を実行するCPU(Central Processing Unit)等である。プロセッサ10の例は、図3に示す。メモリ20は、例えば、SRAM(Static Random Access Memory)であり、プロセッサ10が実行する命令および命令の実行で使用するデータ等を記憶する。例えば、周辺回路30は、DMAC(Direct Memory Access Controller)、通信回路、タイマまたはADC(Analog to Digital Converter)等である。ユーザロジック40は、ユーザ毎に実現される固有の論理回路であり、例えば、FPGA(Field Programmable Gate Array)等のプログラマブルロジックデバイスである。   For example, the processor 10 is a CPU (Central Processing Unit) that executes instructions stored in the memory 20. An example of the processor 10 is shown in FIG. The memory 20 is, for example, an SRAM (Static Random Access Memory), and stores instructions executed by the processor 10 and data used for executing the instructions. For example, the peripheral circuit 30 is a DMAC (Direct Memory Access Controller), a communication circuit, a timer, an ADC (Analog to Digital Converter), or the like. The user logic 40 is a unique logic circuit realized for each user, and is a programmable logic device such as an FPGA (Field Programmable Gate Array).

トレース制御部50は、プロセッサ10による命令の実行結果に基づいて、トレースバッファ60に出力するトレース情報TRIを決定する。例えば、トレース制御部50からトレースバッファ60にトレース情報TRIを出力する信号線は、プロセッサ10による命令の実行を中断することなく、トレース情報TRIをリアルタイムでトレースバッファ60に転送できるバス幅に設定される。トレース制御部50の例は、図6に示す。また、トレース制御部50によるトレースバッファ60に出力するトレース情報TRIの決定手法は、図7で説明する。   The trace control unit 50 determines the trace information TRI to be output to the trace buffer 60 based on the instruction execution result by the processor 10. For example, the signal line that outputs the trace information TRI from the trace control unit 50 to the trace buffer 60 is set to a bus width that can transfer the trace information TRI to the trace buffer 60 in real time without interrupting the execution of the instruction by the processor 10. The An example of the trace control unit 50 is shown in FIG. A method for determining the trace information TRI to be output to the trace buffer 60 by the trace control unit 50 will be described with reference to FIG.

トレースバッファ60は、例えば、DRAM(Dynamic Random Access Memory)等のメモリであり、トレース制御部50から出力されるトレース情報TRIを蓄積する。   The trace buffer 60 is a memory such as a DRAM (Dynamic Random Access Memory), for example, and accumulates trace information TRI output from the trace control unit 50.

図3は、図2に示したプロセッサ10の例を示す。例えば、プロセッサ10は、クロックに同期して動作する命令フェッチ部IFU、命令デコーダID、レジスタ部REGU、演算部OPU、フラグ制御部FCNT、セレクタSEL、プログラムカウンタPC、インクリメンタINC、アドレスバスABおよびデータバスDBを有する。なお、プロセッサ10の構成は、図3に限定されない。   FIG. 3 shows an example of the processor 10 shown in FIG. For example, the processor 10 includes an instruction fetch unit IFU, an instruction decoder ID, a register unit REGU, a calculation unit OPU, a flag control unit FCNT, a selector SEL, a program counter PC, an incrementer INC, an address bus AB, which operate in synchronization with a clock. It has a data bus DB. The configuration of the processor 10 is not limited to FIG.

命令フェッチ部IFUは、システムバスSBUSおよびデータバスDBを介してメモリ20から読み出される命令をフェッチし、フェッチした命令を命令デコーダIDに出力する。命令デコーダIDは、命令フェッチ部IFUから供給される命令をデコードし、プロセッサ10の各部の動作を制御する制御信号を生成する。制御信号は、タイミング信号を含んでもよい。例えば、命令デコーダIDは、加算命令をデコードした場合、演算部OPUの演算器OPを加算器として動作させる制御信号と、加算に使用するレジスタREGを選択する制御信号等とを出力する。また、命令デコーダIDは、デコードした命令に即値が含まれる場合、即値をデータバスDBに出力し、レジスタREGに転送する。   The instruction fetch unit IFU fetches an instruction read from the memory 20 via the system bus SBUS and the data bus DB, and outputs the fetched instruction to the instruction decoder ID. The instruction decoder ID decodes an instruction supplied from the instruction fetch unit IFU and generates a control signal that controls the operation of each unit of the processor 10. The control signal may include a timing signal. For example, when the addition instruction is decoded, the instruction decoder ID outputs a control signal for operating the arithmetic unit OP of the arithmetic unit OPU as an adder, a control signal for selecting the register REG used for the addition, and the like. In addition, when the decoded instruction includes an immediate value, the instruction decoder ID outputs the immediate value to the data bus DB and transfers it to the register REG.

レジスタ部REGUは、複数のレジスタREGと、各レジスタREGに対応する記憶部MUを有する。例えば、レジスタREGは、汎用レジスタである。記憶部MUのフラグFLGは、プロセッサ10により既に実行された命令をたどることにより、対応するレジスタREGに保持された値が命令毎に復元可能な場合、例えば、”1”に設定される。フラグFLGは、対応するレジスタREGに保持された値が、プロセッサ10により既に実行された命令をたどっても命令毎に復元が困難な場合、例えば、”0”に設定される。フラグFLGは、フラグ制御部FCNTにより書き替えられる。フラグFLGに設定される”0”は、第1の値の一例であり、フラグFLGに設定される”1”は、第2の値の一例である。   The register unit REGU includes a plurality of registers REG and a storage unit MU corresponding to each register REG. For example, the register REG is a general purpose register. The flag FLG of the storage unit MU is set to “1”, for example, when the value held in the corresponding register REG can be restored for each instruction by following the instruction already executed by the processor 10. The flag FLG is set to, for example, “0” when the value held in the corresponding register REG is difficult to restore for each instruction even after following the instruction already executed by the processor 10. The flag FLG is rewritten by the flag control unit FCNT. “0” set in the flag FLG is an example of a first value, and “1” set in the flag FLG is an example of a second value.

演算部OPUは、演算器OPおよびロード/ストア部LSUを有する。例えば、演算器OPは、命令デコーダIDによりデコードされた命令にしたがって、レジスタREGに格納されたデータ、即値またはメモリ20から読み出されるデータを用いて、四則演算または論理演算を実行する。   The arithmetic unit OPU includes an arithmetic unit OP and a load / store unit LSU. For example, the arithmetic unit OP performs four arithmetic operations or logical operations using the data stored in the register REG, the immediate value, or the data read from the memory 20 according to the instruction decoded by the instruction decoder ID.

ロード/ストア部LSUは、命令デコーダIDがロード命令およびストア命令等のメモリ20にアクセスする命令をデコードした場合に、メモリ20に対するデータ転送を実行する。ロード/ストア部LSUは、ロード命令では、レジスタREGの1つに格納されたアドレスをアドレスバスABに出力してメモリ20の記憶領域にアクセスする。記憶領域から読み出されたデータは、データバスDBを介してレジスタREGの1つに格納される。ロード/ストア部LSUは、ストア命令では、レジスタREGの1つに格納されたデータをデータバスDBに出力し、レジスタREGの別の1つに格納されたアドレスをアドレスバスABに出力する。そして、データは、メモリ20においてアドレスが示す記憶領域に書き込まれる。なお、プロセッサ10は、メモリ20のアクセスを制御する制御信号をメモリ20に出力する。   The load / store unit LSU executes data transfer to the memory 20 when the instruction decoder ID decodes an instruction for accessing the memory 20 such as a load instruction and a store instruction. In the load instruction, the load / store unit LSU accesses the storage area of the memory 20 by outputting the address stored in one of the registers REG to the address bus AB. Data read from the storage area is stored in one of the registers REG via the data bus DB. In the store instruction, the load / store unit LSU outputs the data stored in one of the registers REG to the data bus DB, and outputs the address stored in another one of the registers REG to the address bus AB. Then, the data is written in the memory area indicated by the address in the memory 20. The processor 10 outputs a control signal for controlling access to the memory 20 to the memory 20.

また、ロード/ストア部LSUは、命令の実行に使用するアドレスを示すアドレス情報ADおよび命令の実行に使用するデータを示すデータ情報DTを、トレース制御部50のデータトレース生成部DTGENに出力する。ロード/ストア部LSUは、メモリ20にアクセスする命令を実行することを示すメモリアクセス情報MAを、データトレース生成部DTGENに出力する。ロード/ストア部LSUは、メモリ20にアクセスする命令がストア命令またはロード命令のいずれであるかを示すストアロード情報S/Lをデータトレース生成部DTGENに出力する。例えば、ストアロード情報S/Lは、ストア命令の実行時に”1”に設定され、ロード命令の実行時に”0”に設定される。   Further, the load / store unit LSU outputs address information AD indicating an address used for execution of the instruction and data information DT indicating data used for execution of the instruction to the data trace generation unit DTGEN of the trace control unit 50. The load / store unit LSU outputs memory access information MA indicating that an instruction to access the memory 20 is executed to the data trace generation unit DTGEN. The load / store unit LSU outputs store load information S / L indicating whether the instruction to access the memory 20 is a store instruction or a load instruction to the data trace generation unit DTGEN. For example, the store load information S / L is set to “1” when the store instruction is executed, and is set to “0” when the load instruction is executed.

演算部OPUは、命令の実行/非実行を示す実行情報EXEをトレース制御部50の命令トレース生成部ITGENに出力する。演算部OPUは、命令が実行された場合に実行情報EXEを”E”に設定し、条件付きの命令で条件が成立しない場合に実行情報EXEを”N”に設定する。例えば、”E”は、実行情報EXEを”1”に設定することにより示され、”N”は、実行情報EXEを”0”に設定することにより示される。例えば、条件付きの命令は、分岐命令である。演算部OPUは、分岐条件の不成立によりプログラムカウンタPCの値がインクリメントされる場合に実行情報EXEを”N”に設定し、分岐条件の成立によりプログラムカウンタPCの値が分岐先にジャンプする場合に実行情報EXEを”E”に設定する。実行情報EXE(”E”、”N”)の出力例は、図9および図10に示す。   The arithmetic unit OPU outputs execution information EXE indicating instruction execution / non-execution to the instruction trace generation unit ITGEN of the trace control unit 50. The arithmetic unit OPU sets the execution information EXE to “E” when the instruction is executed, and sets the execution information EXE to “N” when the condition is not satisfied by the conditional instruction. For example, “E” is indicated by setting execution information EXE to “1”, and “N” is indicated by setting execution information EXE to “0”. For example, the conditional instruction is a branch instruction. The arithmetic unit OPU sets the execution information EXE to “N” when the value of the program counter PC is incremented due to the failure of the branch condition, and when the value of the program counter PC jumps to the branch destination when the branch condition is satisfied. Execution information EXE is set to “E”. Examples of output of the execution information EXE (“E”, “N”) are shown in FIGS.

フラグ制御部FCNTは、演算部OPUによる演算の実行毎に、フラグFLGの値を受ける。フラグ制御部FCNTは、演算部OPUで使用したレジスタREGがデータを保持する場合、レジスタREGに対応するフラグFLGの値を、データフラグ線DFLGを介してトレース制御部50のデータトレース生成部DTGENに出力する。また、フラグ制御部FCNTは、演算部OPUで使用したレジスタREGがアドレスを保持する場合、レジスタREGに対応するフラグFLGの値を、アドレスフラグ線AFLGを介してトレース制御部50のデータトレース生成部DTGENに出力する。例えば、演算部OPUで使用したレジスタREGがデータまたはアドレスを保持するか否かを示す情報は、演算器OPおよびロード/ストア部LSUからフラグ制御部FCNTにそれぞれ出力される。   The flag control unit FCNT receives the value of the flag FLG every time the calculation by the calculation unit OPU is executed. When the register REG used in the arithmetic unit OPU holds data, the flag control unit FCNT sends the value of the flag FLG corresponding to the register REG to the data trace generation unit DTGEN of the trace control unit 50 via the data flag line DFLG. Output. In addition, when the register REG used in the arithmetic unit OPU holds an address, the flag control unit FCNT sends the value of the flag FLG corresponding to the register REG to the data trace generation unit of the trace control unit 50 via the address flag line AFLG. Output to DTGEN. For example, information indicating whether or not the register REG used in the operation unit OPU holds data or an address is output from the operation unit OP and the load / store unit LSU to the flag control unit FCNT.

また、フラグ制御部FCNTは、演算器OPおよびロード/ストア部LSUによる命令の実行結果に応じて、フラグ書き替え線FWRに値を出力し、演算部OPUで使用したレジスタREGに対応するフラグFLGの値を書き替える。フラグ制御部FCNTによるフラグFLGの書き替えの例は、図4および図5に示す。   Further, the flag control unit FCNT outputs a value to the flag rewriting line FWR in accordance with the execution result of the instruction by the arithmetic unit OP and the load / store unit LSU, and the flag FLG corresponding to the register REG used in the arithmetic unit OPU. Rewrite the value of. Examples of rewriting the flag FLG by the flag control unit FCNT are shown in FIGS.

プログラムカウンタPCは、演算部OPUが次に実行する命令を格納したメモリ20のアドレスを示す。インクリメンタINCは、命令デコーダIDからの制御信号の1つに応じて、プログラムカウンタPCから出力されるアドレスをインクリメントしてセレクタSELに出力する。   The program counter PC indicates an address of the memory 20 that stores an instruction to be executed next by the arithmetic unit OPU. The incrementer INC increments the address output from the program counter PC in accordance with one of the control signals from the instruction decoder ID, and outputs the incremented address to the selector SEL.

セレクタSELは、インクリメンタINCから出力されるアドレスまたはデータバスDBを介して命令デコーダIDから供給される分岐アドレス(即値)を、命令デコーダIDからの制御信号の1つに応じて選択する。セレクタSELは、選択したアドレスをプログラムカウンタPCに転送する。例えば、分岐命令の分岐条件が成立し、次の命令のフェッチ先がインクリメンタINCから出力されるアドレスと相違する場合、セレクタSELは、命令デコーダIDから供給される分岐アドレスを選択する。   The selector SEL selects the address output from the incrementer INC or the branch address (immediate value) supplied from the instruction decoder ID via the data bus DB according to one of the control signals from the instruction decoder ID. The selector SEL transfers the selected address to the program counter PC. For example, when the branch condition of the branch instruction is satisfied and the fetch destination of the next instruction is different from the address output from the incrementer INC, the selector SEL selects the branch address supplied from the instruction decoder ID.

図4は、図3に示したフラグ制御部FCNTによりフラグFLGを書き替える条件の例を示す。図4に示す条件は、命令デコーダID、演算器OPおよびロード/ストア部LSUからの情報に基づいて、フラグ制御部FCNTにより判定される。   FIG. 4 shows an example of conditions for rewriting the flag FLG by the flag control unit FCNT shown in FIG. The conditions shown in FIG. 4 are determined by the flag control unit FCNT based on information from the instruction decoder ID, the arithmetic unit OP, and the load / store unit LSU.

フラグ制御部FCNTは、レジスタREGに即値が格納される命令が実行されることを判定した場合、即値が代入されるレジスタREGに対応するフラグFLGを”1”に書き替える(条件A)。即値は、プロセッサ10が実行する命令を記述したプログラム(例えば、図8に示すプログラム)中に記述されており、プログラムから再現可能である。   When the flag control unit FCNT determines that an instruction in which the immediate value is stored in the register REG is executed, the flag control unit FCNT rewrites the flag FLG corresponding to the register REG into which the immediate value is substituted (condition A). The immediate value is described in a program (for example, the program shown in FIG. 8) in which an instruction executed by the processor 10 is described, and can be reproduced from the program.

フラグ制御部FCNTは、”1”に設定されたフラグFLGに対応するレジスタREGおよび即値を使用して演算が実行されることを判定した場合、演算結果が格納されるレジスタREGに対応するフラグFLGを”1”に書き替える(条件B)。換言すれば、レジスタREGに書き込まれる値が、プロセッサにより実行された命令(プログラム)をたどることにより判別可能な場合、値が格納されるレジスタに対応するフラグFLGは”1”に設定される。条件Aおよび条件Bでは、再現可能な値が格納されるレジスタREGに対応するフラグFLGに”1”を設定することで、再現可能な値がトレース情報TRIとして出力されることを抑止することができ、トレース情報TRIの量を従来に比べて削減できる。   When the flag control unit FCNT determines that the calculation is performed using the register REG corresponding to the flag FLG set to “1” and the immediate value, the flag FLG corresponding to the register REG in which the calculation result is stored. Is rewritten to “1” (condition B). In other words, when the value written in the register REG can be discriminated by following the instruction (program) executed by the processor, the flag FLG corresponding to the register in which the value is stored is set to “1”. In the condition A and the condition B, by setting “1” to the flag FLG corresponding to the register REG in which the reproducible value is stored, the reproducible value is prevented from being output as the trace information TRI. In addition, the amount of trace information TRI can be reduced as compared with the prior art.

フラグ制御部FCNTは、”0”に設定されたフラグFLGに対応するレジスタREGの少なくとも1つを使用して演算が実行される場合、演算結果が格納されるレジスタREGに対応するフラグFLGを”0”に書き替える(条件C)。また、フラグ制御部FCNTは、メモリ20にアクセスする命令により値が書き込まれるレジスタREGに対応するフラグFLGを”0”に書き替える(条件D)。換言すれば、レジスタREGに書き込まれる値の判別が、プロセッサにより実行された命令(プログラム)をたどっても困難である場合、値が格納されるレジスタに対応するフラグFLGは”0”に設定される。条件Cおよび条件Dでは、再現が困難な値が格納されるレジスタREGに対応するフラグFLGに”0”が設定される。このため、エミュレータ100等は、トレース情報TRIに基づいて、演算部OPU(すなわち、プロセッサ10)により実行された命令の履歴を正しく生成することができる。   When the calculation is executed using at least one of the registers REG corresponding to the flag FLG set to “0”, the flag control unit FCNT sets the flag FLG corresponding to the register REG in which the calculation result is stored. Rewrite to 0 "(Condition C). Further, the flag control unit FCNT rewrites the flag FLG corresponding to the register REG into which a value is written by an instruction to access the memory 20 to “0” (condition D). In other words, if it is difficult to determine the value written in the register REG by following the instruction (program) executed by the processor, the flag FLG corresponding to the register in which the value is stored is set to “0”. The Under conditions C and D, “0” is set in the flag FLG corresponding to the register REG in which a value that is difficult to reproduce is stored. Therefore, the emulator 100 and the like can correctly generate a history of instructions executed by the arithmetic unit OPU (that is, the processor 10) based on the trace information TRI.

フラグ制御部FCNTは、命令の実行によりレジスタREGの値が書き替えられないことを判定した場合、フラグFLGを書き替えない(条件E)。   When the flag control unit FCNT determines that the value of the register REG cannot be rewritten by the execution of the instruction, the flag control unit FCNT does not rewrite the flag FLG (condition E).

図5は、図3に示したフラグ制御部FCNTによるフラグFLGの書き替え動作の例を示す。なお、図5では、フラグ制御部FCNTがフローを順次に実行する例を示しているが、実際には、図5に示すフローは、フラグ制御部FCNTのハードウェアが動作することにより、並列に実行される。すなわち、図4に示した条件A、B、C、D、Eは、それぞれの判定回路により並列に判定される。   FIG. 5 shows an example of the flag FLG rewriting operation by the flag control unit FCNT shown in FIG. FIG. 5 shows an example in which the flag control unit FCNT sequentially executes the flow. However, in actuality, the flow shown in FIG. 5 is performed in parallel by the operation of the hardware of the flag control unit FCNT. Executed. That is, the conditions A, B, C, D, and E shown in FIG. 4 are determined in parallel by the respective determination circuits.

フラグ制御部FCNTは、ステップS100においてレジスタREGに即値を格納する命令の実行を示す情報を命令デコーダIDから受けた場合、ステップS102において即値が格納されたレジスタREGに対応するフラグFLGを”1”に設定する(条件A)。例えば、レジスタREGに即値が格納される命令は、転送命令MOV等である。   When the flag control unit FCNT receives from the instruction decoder ID information indicating execution of an instruction that stores an immediate value in the register REG in step S100, the flag control unit FCNT sets a flag FLG corresponding to the register REG in which the immediate value is stored in step S102 to “1”. (Condition A). For example, an instruction whose immediate value is stored in the register REG is a transfer instruction MOV or the like.

フラグ制御部FCNTは、ステップS100においてレジスタREGに即値が格納される命令が実行されないと判定した場合、ステップS104の判定を実行する。フラグ制御部FCNTは、ステップS104において演算命令の実行を示す情報を演算器OPから受けた場合、ステップS106において、”0”に設定されたフラグFLGに対応するレジスタREGの少なくとも1つを使用して演算が実行されるか否かを判定する。例えば、演算命令は、加算命令ADD、減算命令SUBおよび乗算命令MUL等である。   If the flag control unit FCNT determines in step S100 that the instruction that stores the immediate value in the register REG is not executed, the flag control unit FCNT performs the determination in step S104. When the flag control unit FCNT receives information indicating execution of the operation instruction from the operation unit OP in step S104, the flag control unit FCNT uses at least one of the registers REG corresponding to the flag FLG set to “0” in step S106. To determine whether or not the operation is executed. For example, the operation instructions are an addition instruction ADD, a subtraction instruction SUB, a multiplication instruction MUL, and the like.

そして、”0”に設定されたフラグFLGに対応するレジスタREGの少なくとも1つを使用して演算が実行される場合、ステップS112において、データが格納されるレジスタREGに対応するフラグFLGの値が”0”に設定される(条件C)。一方、”0”に設定されたフラグFLGに対応するレジスタREGを使用して演算が実行されない場合、ステップS108において、フラグ制御部FCNTは、演算結果が格納されるレジスタREGに対応するフラグFLGに”1”を設定する(条件B)。換言すれば、ステップS108は、演算命令で使用する引数が、”1”に設定されたフラグFLGに対応するレジスタREGに格納される場合(オペランドがレジスタ参照)、あるいは即値である場合に実行される。   When the calculation is executed using at least one of the registers REG corresponding to the flag FLG set to “0”, the value of the flag FLG corresponding to the register REG in which data is stored is determined in step S112. “0” is set (condition C). On the other hand, when the calculation is not executed using the register REG corresponding to the flag FLG set to “0”, in step S108, the flag control unit FCNT sets the flag FLG corresponding to the register REG in which the calculation result is stored. “1” is set (condition B). In other words, step S108 is executed when the argument used in the operation instruction is stored in the register REG corresponding to the flag FLG set to "1" (operand is a register reference) or is an immediate value. The

演算命令の実行を示す情報を演算器OPから受けない場合、フラグ制御部FCNTは、演算命令以外の命令が実行されたと判定し、ステップS110において、レジスタREGに値が書き込まれるか否かを判定する。例えば、演算命令以外の命令は、ストア命令STR、ロード命令LDR、コンペア命令CMPおよび分岐命令BNE等である。そして、フラグ制御部FCNTは、レジスタREGに値が書き込まれる命令が実行されると判定した場合、ステップS112において、データが格納されるレジスタREGに対応するフラグFLGの値を”0”に設定する(条件D)。例えば、レジスタREGに値が書き込まれる命令は、ロード命令LDRである。   When the information indicating the execution of the arithmetic instruction is not received from the arithmetic unit OP, the flag control unit FCNT determines that an instruction other than the arithmetic instruction has been executed, and determines whether or not a value is written to the register REG in step S110. To do. For example, instructions other than the operation instruction are a store instruction STR, a load instruction LDR, a compare instruction CMP, a branch instruction BNE, and the like. When the flag control unit FCNT determines that an instruction to write a value to the register REG is executed, the flag control unit FCNT sets the value of the flag FLG corresponding to the register REG in which data is stored to “0” in step S112. (Condition D). For example, an instruction whose value is written to the register REG is a load instruction LDR.

一方、フラグ制御部FCNTは、ステップS110において、レジスタREGに値が書き込まれないと判定した場合、フラグFLGの値を書き替えない(条件E)。   On the other hand, if the flag control unit FCNT determines in step S110 that no value is written in the register REG, the flag control unit FCNT does not rewrite the value of the flag FLG (condition E).

図6は、図2に示したトレース制御部50の例を示す。トレース制御部50は、命令トレース生成部ITGENおよびデータトレース生成部DTGENを有する。命令トレース生成部ITGENは、演算部OPUから出力される実行情報EXE(”E”または”N”)を受け、受けた実行情報EXEをトレース情報TRIとしてトレースバッファ60に出力する。   FIG. 6 shows an example of the trace control unit 50 shown in FIG. The trace control unit 50 includes an instruction trace generation unit ITGEN and a data trace generation unit DTGEN. The instruction trace generation unit ITGEN receives the execution information EXE (“E” or “N”) output from the arithmetic unit OPU, and outputs the received execution information EXE to the trace buffer 60 as the trace information TRI.

データトレース生成部DTGENは、アンド回路AND、データ出力部DOUTおよびアドレス出力部AOUTを有する。データトレース生成部DTGENは、イネーブル端子ENで受けるメモリアクセス情報MAがメモリ20にアクセスする命令の実行を示す場合に動作する。   The data trace generation unit DTGEN includes an AND circuit AND, a data output unit DOUT, and an address output unit AOUT. The data trace generation unit DTGEN operates when the memory access information MA received at the enable terminal EN indicates execution of an instruction to access the memory 20.

アンド回路ANDは、ストアロード情報S/Lが論理0の場合、すなわち、ロード命令が実行された場合に論理0を出力する。アンド回路ANDは、ストアロード情報S/Lが論理1、かつデータフラグ信号DFLGが論理0の場合、すなわち、ストア命令の実行によりメモリ20に格納するデータを保持するレジスタREGに対応するフラグFLGが”0”の場合に論理0を出力する。アンド回路ANDは、ストアロード情報S/Lが論理1、かつデータフラグ信号DFLGが論理1の場合、すなわち、ストア命令の実行によりメモリ20に格納するデータを保持するレジスタREGに対応するフラグFLGが”1”の場合に論理1を出力する。   The AND circuit AND outputs logic 0 when the store load information S / L is logic 0, that is, when a load instruction is executed. In the AND circuit AND, when the store load information S / L is logic 1 and the data flag signal DFLG is logic 0, that is, the flag FLG corresponding to the register REG holding data stored in the memory 20 by execution of the store instruction is When it is “0”, logic 0 is output. In the AND circuit AND, when the store load information S / L is logic 1 and the data flag signal DFLG is logic 1, that is, the flag FLG corresponding to the register REG holding the data to be stored in the memory 20 by executing the store instruction is When “1”, logic 1 is output.

データ出力部DOUTは、メモリアクセス情報MAがメモリ20にアクセスする命令の実行を示す場合に動作し、メモリアクセス情報MAがメモリ20にアクセスする命令の非実行を示す場合に動作を停止する。データ出力部DOUTは、論理0をディセーブル端子DISで受ける期間にオンし、論理1をディセーブル端子DISで受ける期間にオフするスイッチDSWを有する。すなわち、データ出力部DOUTは、論理0をディセーブル端子DISで受ける期間に、演算部OPUからのデータ情報DTをトレースバッファ60に出力する。   The data output unit DOUT operates when the memory access information MA indicates execution of an instruction that accesses the memory 20, and stops operating when the memory access information MA indicates non-execution of an instruction that accesses the memory 20. The data output unit DOUT includes a switch DSW that is turned on during a period when the logic 0 is received by the disable terminal DIS and turned off during a period when the logic 1 is received by the disable terminal DIS. That is, the data output unit DOUT outputs the data information DT from the arithmetic unit OPU to the trace buffer 60 during a period in which the logic 0 is received at the disable terminal DIS.

データ出力部DOUTは、メモリアクセス情報MAがメモリ20にアクセスする命令の非実行を示す期間と、論理1をディセーブル端子DISで受ける期間とに、データ情報DTのトレースバッファ60への出力を禁止する。例えば、データ出力部DOUTは、ロード命令が実行される場合、およびストア命令の実行によりメモリ20に格納するデータを保持するレジスタREGに対応するフラグFLGが”0”の場合、データ情報DTをトレースバッファ60に出力する。   The data output unit DOUT prohibits output of the data information DT to the trace buffer 60 during a period when the memory access information MA indicates non-execution of an instruction to access the memory 20 and a period when the logic 1 is received at the disable terminal DIS. To do. For example, the data output unit DOUT traces the data information DT when the load instruction is executed and when the flag FLG corresponding to the register REG holding the data stored in the memory 20 by executing the store instruction is “0”. Output to buffer 60.

アンド回路ANDおよび論理1をディセーブル端子DISで受ける期間にオフするスイッチDSWは、レジスタREGに格納されたデータのトレース情報TRIとしての出力を禁止するマスク部の一例である。アンド回路ANDおよびスイッチDSWにより、データのトレース情報TRIとしての出力を禁止することで、演算部OPUにより実行される命令が記述されたプログラム(例えば、図8に示すプログラム)から再現可能なデータ情報DTは、トレース情報TRIとして出力されない。このため、トレース情報TRIの量を従来に比べて削減できる。   The switch DSW that is turned off while receiving the AND circuit AND and the logic 1 at the disable terminal DIS is an example of a mask unit that prohibits output of the data stored in the register REG as the trace information TRI. Data information reproducible from a program (for example, the program shown in FIG. 8) in which an instruction executed by the arithmetic unit OPU is described by prohibiting output of data as trace information TRI by the AND circuit AND and the switch DSW. DT is not output as trace information TRI. For this reason, the amount of the trace information TRI can be reduced as compared with the prior art.

アドレス出力部AOUTは、メモリアクセス情報MAがメモリ20にアクセスする命令の実行を示す場合に動作し、メモリアクセス情報MAがメモリ20にアクセスする命令の非実行を示す場合に動作を停止する。アドレス出力部AOUTは、論理0のアドレスフラグ信号AFLGをディセーブル端子DISで受ける期間にオンし、論理1のアドレスフラグ信号AFLGをディセーブル端子DISで受ける期間にオフするスイッチASWを有する。すなわち、アドレス出力部AOUTは、論理0をディセーブル端子DISで受ける期間に、演算部OPUからのアドレス情報ADをトレースバッファ60に出力する。   The address output unit AOUT operates when the memory access information MA indicates execution of an instruction that accesses the memory 20, and stops operating when the memory access information MA indicates non-execution of an instruction that accesses the memory 20. The address output unit AOUT includes a switch ASW that is turned on during a period in which the logic 0 address flag signal AFLG is received by the disable terminal DIS and turned off in a period in which the logic 1 address flag signal AFLG is received by the disable terminal DIS. That is, the address output unit AOUT outputs the address information AD from the arithmetic unit OPU to the trace buffer 60 during a period in which the logic 0 is received at the disable terminal DIS.

アドレス出力部AOUTは、メモリアクセス情報MAがメモリ20にアクセスする命令の非実行を示す期間と、論理1をディセーブル端子DISで受ける期間とに、アドレス情報ADのトレースバッファ60への出力を禁止する。例えば、アドレス出力部AOUTは、命令の実行で使用するレジスタREGに格納された値がアドレスとして使用され、アドレスを格納するレジスタREGに対応するフラグFLGが”0”の場合に、アドレス情報ADをトレースバッファ60に出力する。   The address output unit AOUT prohibits the output of the address information AD to the trace buffer 60 during the period when the memory access information MA indicates non-execution of the instruction to access the memory 20 and the period when the logic 1 is received at the disable terminal DIS To do. For example, the address output unit AOUT receives the address information AD when the value stored in the register REG used for execution of the instruction is used as an address and the flag FLG corresponding to the register REG for storing the address is “0”. Output to the trace buffer 60.

論理1をディセーブル端子DISで受ける期間にオフするスイッチASWは、レジスタREGに格納されたアドレスのトレース情報TRIとしての出力を禁止するマスク部の一例である。スイッチASWにより、アドレスのトレース情報TRIとしての出力を禁止することで、演算部OPUにより実行される命令が記述されたプログラムから再現可能なアドレスは、トレース情報TRIとして出力されない。このため、トレース情報TRIの量を従来に比べて削減することができる。   The switch ASW that is turned off while receiving the logic 1 at the disable terminal DIS is an example of a mask unit that prohibits output of the address stored in the register REG as the trace information TRI. By prohibiting the output of the address as trace information TRI by the switch ASW, an address reproducible from the program in which the instruction executed by the arithmetic unit OPU is described is not output as the trace information TRI. For this reason, the amount of trace information TRI can be reduced as compared with the conventional case.

図7は、図6に示したトレース制御部50の動作の例を示す。なお、図7では、トレース制御部50がフローを順次に実行する例を示している。しかし、実際には、トレース制御部50の命令トレース生成部ITGEN、データ出力部DOUTおよびアドレス出力部AOUTは、並列に動作するため、図7に示すフローは並列に実行される。例えば、ステップS202、S204、S208、S212の判定は、図7に示す順序ではなく、同時に実行されてもよい。   FIG. 7 shows an example of the operation of the trace control unit 50 shown in FIG. FIG. 7 shows an example in which the trace control unit 50 sequentially executes the flow. However, in practice, the instruction trace generation unit ITGEN, the data output unit DOUT, and the address output unit AOUT of the trace control unit 50 operate in parallel, so the flow shown in FIG. 7 is executed in parallel. For example, the determinations in steps S202, S204, S208, and S212 may be performed simultaneously instead of in the order shown in FIG.

ステップS202において、データトレース生成部DTGENは、ロード/ストア部LSUからのメモリアクセス情報MAに基づいて、メモリアクセス命令(ロード命令LDRまたはストア命令STR)が実行されるか否かを判定する。例えば、メモリアクセス情報MAがメモリ20にアクセスする命令の実行を示す場合、処理はステップS204に移行され、メモリアクセス情報MAがメモリ20にアクセスする命令の非実行を示す場合、処理はステップS216に移行される。   In step S202, the data trace generation unit DTGEN determines whether or not a memory access instruction (load instruction LDR or store instruction STR) is executed based on the memory access information MA from the load / store unit LSU. For example, if the memory access information MA indicates execution of an instruction to access the memory 20, the process proceeds to step S204. If the memory access information MA indicates non-execution of an instruction to access the memory 20, the process proceeds to step S216. To be migrated.

ステップS204において、データ出力部DOUTは、ストアロード情報S/Lの論理レベルに基づいてロード命令LDRが実行されるか否かを判定する。ロード命令LDRが実行される場合、処理はステップS206に移行され、ロード命令LDRが実行されない場合、ストア命令STRが実行されるため、処理はステップS208に移行される。   In step S204, the data output unit DOUT determines whether or not the load instruction LDR is executed based on the logical level of the store load information S / L. If the load instruction LDR is executed, the process proceeds to step S206. If the load instruction LDR is not executed, the store instruction STR is executed, and thus the process proceeds to step S208.

ステップS206において、データ出力部DOUTは、レジスタREGにロードしたデータ(データ情報DT)をトレース情報TRIとして出力する。ステップS206の後、処理はステップS212に移行される。ロード命令LDRによりメモリ20から読み出され、レジスタREGに格納されるデータは、演算部OPUが実行する命令が記述されたプログラム(例えば、図2に示すソースプログラム)から再現することが困難である。すなわち、演算部OPUにより既に実行された命令をたどることでは再現が困難なデータをトレース情報TRIとして出力することで、図12に示すように、演算部OPU(すなわち、プロセッサ10)により実行された命令の履歴を正しく生成することができる。   In step S206, the data output unit DOUT outputs the data (data information DT) loaded into the register REG as trace information TRI. After step S206, the process proceeds to step S212. The data read from the memory 20 by the load instruction LDR and stored in the register REG is difficult to reproduce from a program (for example, the source program shown in FIG. 2) in which the instruction executed by the arithmetic unit OPU is described. . That is, by outputting data that is difficult to reproduce by following the instruction already executed by the arithmetic unit OPU as the trace information TRI, the data is executed by the arithmetic unit OPU (that is, the processor 10) as shown in FIG. An instruction history can be generated correctly.

一方、ストア命令STRが実行される場合、ステップS208において、データ出力部DOUTは、メモリ20に書き込むデータを格納したレジスタREGに対応するフラグFLGが”0”か否かを判定する。メモリ20に書き込むデータを格納するレジスタREGに対応するフラグFLGが”0”の場合、処理はステップS210に移行され、メモリ20に書き込むデータを格納するレジスタREGに対応するフラグFLGが”0”でない場合、処理はステップS212に移行される。   On the other hand, when the store instruction STR is executed, in step S208, the data output unit DOUT determines whether or not the flag FLG corresponding to the register REG that stores the data to be written in the memory 20 is “0”. If the flag FLG corresponding to the register REG for storing data to be written to the memory 20 is “0”, the process proceeds to step S210, and the flag FLG corresponding to the register REG for storing data to be written to the memory 20 is not “0”. If so, the process proceeds to step S212.

ステップS210において、データ出力部DOUTは、メモリ20に書き込むデータ(データ情報DT)をトレース情報TRIとして出力する。この後、処理はステップS212に移行される。”0”に設定されたフラグFLGに対応するレジスタREGに保持され、ストア命令STRによりメモリ20に書き込まれるデータは、演算部OPUが実行する命令が記述されたプログラムから再現することが困難である。すなわち、演算部OPUにより既に実行された命令をたどることでは再現が困難なデータをトレース情報TRIとして出力することで、図12に示すように、演算部OPU(すなわち、プロセッサ10)により実行された命令の履歴を正しく生成することができる。   In step S210, the data output unit DOUT outputs data to be written to the memory 20 (data information DT) as trace information TRI. Thereafter, the process proceeds to step S212. The data held in the register REG corresponding to the flag FLG set to “0” and written to the memory 20 by the store instruction STR is difficult to reproduce from the program in which the instruction executed by the arithmetic unit OPU is described. . That is, by outputting data that is difficult to reproduce by following the instruction already executed by the arithmetic unit OPU as the trace information TRI, the data is executed by the arithmetic unit OPU (that is, the processor 10) as shown in FIG. An instruction history can be generated correctly.

ステップS212において、アドレス出力部AOUTは、アドレスを格納するレジスタREGに対応するフラグFLGが”0”か否かを判定する。アドレスを格納するレジスタREGに対応するフラグFLGが”0”の場合、処理はステップS214に移行され、アドレスを格納するレジスタREGに対応するフラグFLGが”0”でない場合、処理はステップS216に移行される。   In step S212, the address output unit AOUT determines whether or not the flag FLG corresponding to the register REG for storing the address is “0”. If the flag FLG corresponding to the register REG for storing the address is “0”, the process proceeds to step S214. If the flag FLG corresponding to the register REG for storing the address is not “0”, the process proceeds to step S216. Is done.

ステップS214において、アドレス出力部AOUTは、レジスタREGに格納されるアドレス(アドレス情報AD)をトレース情報TRIとして出力する。”0”に設定されたフラグFLGに対応するレジスタREGに保持され、メモリ20のアクセスに使用されるアドレスは、演算部OPUが実行する命令が記述されたプログラムから再現することが困難である。すなわち、演算部OPUにより既に実行された命令をたどることでは再現が困難なアドレスをトレース情報TRIとして出力することで、図12に示すように、演算部OPU(すなわち、プロセッサ10)により実行された命令の履歴を正しく生成することができる。   In step S214, the address output unit AOUT outputs the address (address information AD) stored in the register REG as the trace information TRI. The address held in the register REG corresponding to the flag FLG set to “0” and used for accessing the memory 20 is difficult to reproduce from the program in which the instruction executed by the arithmetic unit OPU is described. That is, an address that is difficult to reproduce by following the instruction already executed by the arithmetic unit OPU is output as the trace information TRI, so that it is executed by the arithmetic unit OPU (that is, the processor 10) as shown in FIG. An instruction history can be generated correctly.

ステップS216において、命令トレース生成部ITGENは、演算部OPUから出力される実行情報EXE(”E”または”N”)をトレース情報TRIとしてトレースバッファ60に出力する。   In step S216, the instruction trace generation unit ITGEN outputs the execution information EXE (“E” or “N”) output from the operation unit OPU to the trace buffer 60 as the trace information TRI.

図8は、図2に示したプロセッサ10が実行するプログラムの記述の例を示す。この例では、1番地から16番地に16個の命令が記述される。プログラム中の符号r0、r1、r2、r3、r4は、それぞれレジスタREGを示し、符号#に続く数値は即値を示す。かぎ括弧で囲まれたレジスタは、レジスタに格納された値をアドレスとして使用することを示す(レジスタ間接)。   FIG. 8 shows an example of a description of a program executed by the processor 10 shown in FIG. In this example, 16 instructions are described from address 1 to address 16. Symbols r0, r1, r2, r3, and r4 in the program each indicate a register REG, and a numerical value following the symbol # indicates an immediate value. A register enclosed in angle brackets indicates that a value stored in the register is used as an address (register indirect).

1番地の転送命令MOVでは、レジスタR0に即値1000が格納される。2番地のロード命令LDRでは、レジスタr0に格納されたアドレスが示すメモリ20の記憶領域から読み出した値がレジスタr2に格納される。3番地の転送命令MOVでは、レジスタr1に即値100が格納される。4番地のストア命令STRでは、レジスタr1に格納された値が、レジスタr2に格納されたアドレスが示すメモリ20の記憶領域に書き込まれる。5番目の転送命令MOVでは、レジスタR2に即値2が格納される。   With the transfer instruction MOV at address 1, an immediate value 1000 is stored in the register R0. In the load instruction LDR at address 2, the value read from the storage area of the memory 20 indicated by the address stored in the register r0 is stored in the register r2. In the transfer instruction MOV at address 3, an immediate value 100 is stored in the register r1. In the store instruction STR at address 4, the value stored in the register r1 is written to the storage area of the memory 20 indicated by the address stored in the register r2. In the fifth transfer instruction MOV, the immediate value 2 is stored in the register R2.

6番地の減算命令SUBでは、レジスタr0の値からレジスタr1の値を引いた値がレジスタr0に格納される。7番地の乗算命令MULでは、レジスタr0の値を3倍した値がレジスタr3に格納される。8番地のロード命令LDRでは、レジスタr0に格納されたアドレスが示すメモリ20の記憶領域から読み出した値がレジスタr4に格納される。9番地のストア命令STRでは、レジスタr2に格納された値が、レジスタr3に格納されたアドレスが示すメモリ20の記憶領域に書き込まれる。10番地の減算命令SUBでは、レジスタr2の値から”1”を引いた値がレジスタr2に格納される。   In the subtraction instruction SUB at address 6, a value obtained by subtracting the value of the register r1 from the value of the register r0 is stored in the register r0. In the multiplication instruction MUL at address 7, a value that is three times the value of the register r0 is stored in the register r3. In the load instruction LDR at address 8, the value read from the storage area of the memory 20 indicated by the address stored in the register r0 is stored in the register r4. In the store instruction STR at address 9, the value stored in the register r2 is written to the storage area of the memory 20 indicated by the address stored in the register r3. In the subtraction instruction SUB at address 10, a value obtained by subtracting “1” from the value of the register r2 is stored in the register r2.

11番地の比較命令CMPでは、レジスタr2に格納された値と”0”とが比較される。12番地の分岐命令BNEでは、レジスタr2の値が”0”でない場合、6番地に分岐される。すなわち、10番地の減算命令SUBでカウンタとして機能するレジスタr2の値が”0”より大きい間、6番地から12番地の命令が繰り返される。   In the comparison instruction CMP at address 11, the value stored in the register r2 is compared with “0”. In the branch instruction BNE at the address 12, if the value of the register r2 is not “0”, the process branches to the address 6. That is, while the value of the register r2 functioning as a counter in the subtraction instruction SUB at address 10 is larger than “0”, the instructions at addresses 6 to 12 are repeated.

13番地の加算命令ADDでは、レジスタr0の値とレジスタr3の値とを加算した値がレジスタr0に格納される。14番地のロード命令LDRでは、レジスタr0に格納されたアドレスが示すメモリ20の記憶領域から読み出した値がレジスタr2に格納される。15番地のストア命令STRでは、レジスタr2に格納された値が、レジスタr3に格納されたアドレスが示すメモリ20の記憶領域に書き込まれる。16番地の加算命令ADDでは、レジスタr2の値とレジスタr0の値とを加算した値がレジスタr3に格納される。   In the addition instruction ADD at address 13, a value obtained by adding the value of the register r0 and the value of the register r3 is stored in the register r0. In the load instruction LDR at address 14, the value read from the storage area of the memory 20 indicated by the address stored in the register r0 is stored in the register r2. In the store instruction STR at address 15, the value stored in the register r2 is written into the storage area of the memory 20 indicated by the address stored in the register r3. In the addition instruction ADD at address 16, a value obtained by adding the value of the register r2 and the value of the register r0 is stored in the register r3.

図9は、図8に示したプログラムをプロセッサ10が実行する場合における半導体装置SEM2の動作の例を示す。図9では、レジスタREGとフラグFLGのペアをレジスタr0、r1、r2、r3、r4として示す。命令の前に括弧で示した数値は、命令が格納された番地を示す。白抜きの矢印は、命令がプロセッサ10により実行されることを示す。レジスタREGの下側に付した矢印は、トレース制御部50から出力されるトレース情報TRIを示す。   FIG. 9 shows an example of the operation of the semiconductor device SEM2 when the processor 10 executes the program shown in FIG. In FIG. 9, a pair of a register REG and a flag FLG is shown as registers r0, r1, r2, r3, r4. The numerical value shown in parentheses before the instruction indicates the address where the instruction is stored. A white arrow indicates that the instruction is executed by the processor 10. An arrow attached to the lower side of the register REG indicates the trace information TRI output from the trace control unit 50.

フラグFLGに示した”−”は、レジスタREGに値が格納されていない無効状態を示す。なお、値が格納されていないレジスタREGに対応するフラグFLGは、”0”に設定されてもよい。また、各フラグFLGを2ビットとし、フラグFLGが有効であるか無効であるかの情報を上位ビットに設定し、図4に示した”0”、”1”を下位ビットに設定してもよい。この場合、フラグFLGの”10”は、プロセッサ10により既に実行された命令をたどることではレジスタREGに格納された値を再現することが困難なことを示す。フラグFLGの”11”は、プロセッサ10により既に実行された命令をたどることでレジスタREGに格納された値を再現可能なことを示す。フラグFLGの”10”は、第1の値の一例であり、フラグFLGの”11”は、第2の値の一例である。   “-” Shown in the flag FLG indicates an invalid state in which no value is stored in the register REG. Note that the flag FLG corresponding to the register REG in which no value is stored may be set to “0”. Further, each flag FLG is set to 2 bits, information indicating whether the flag FLG is valid or invalid is set in the upper bits, and “0” and “1” shown in FIG. 4 are set in the lower bits. Good. In this case, the flag FLG “10” indicates that it is difficult to reproduce the value stored in the register REG by following the instruction already executed by the processor 10. The flag FLG “11” indicates that the value stored in the register REG can be reproduced by following the instruction already executed by the processor 10. The flag FLG “10” is an example of a first value, and the flag FLG “11” is an example of a second value.

まず、1番地の転送命令MOVの実行によるレジスタr0への即値1000の格納は、図4に示した条件Aに該当するため、フラグ制御部FCNTは、レジスタr0のフラグFLGを”1”に設定する。図7に示したステップS202の判定は、”偽(No)”であるため、トレース制御部50は、命令の実行を示す実行情報EXE(”E”)をトレース情報TRIとして出力する(図9(a))。   First, since the storage of the immediate value 1000 in the register r0 by the execution of the transfer instruction MOV at the address 1 corresponds to the condition A shown in FIG. 4, the flag control unit FCNT sets the flag FLG of the register r0 to “1”. To do. Since the determination in step S202 shown in FIG. 7 is “false (No)”, the trace control unit 50 outputs execution information EXE (“E”) indicating execution of the instruction as trace information TRI (FIG. 9). (A)).

2番地のロード命令LDRの実行によるレジスタr2への”500”の格納は、図4に示した条件Dに該当するため、フラグ制御部FCNTは、レジスタr2のフラグFLGを”0”に設定する。図7に示したステップS202、S204の判定は、ともに”真(Yes)”である。このため、トレース制御部50は、命令の実行を示す実行情報EXE(”E”)とともに、メモリ20から読み出したデータ(500)を示すデータ情報DTをトレース情報TRIとして出力する(図9(b))。   Since the storage of “500” in the register r2 by the execution of the load instruction LDR at address 2 corresponds to the condition D shown in FIG. 4, the flag control unit FCNT sets the flag FLG of the register r2 to “0”. . The determinations in steps S202 and S204 shown in FIG. 7 are both “true”. Therefore, the trace control unit 50 outputs, as the trace information TRI, the data information DT indicating the data (500) read from the memory 20 together with the execution information EXE (“E”) indicating the execution of the instruction (FIG. 9B). )).

一方、図7に示したステップS212の判定は、”偽(No)”であるため、トレース制御部50は、レジスタr0に格納されたアドレス情報AD(1000)のトレース情報TRIとしての出力を禁止する。なお、2番地のロード命令LDRにおいて、レジスタr0のフラグFLGが”0”の場合、図7に示したステップS212の判定は、”真(Yes)”となる。この場合、レジスタr0に格納されたアドレス情報AD(1000)も、トレース情報TRIとして出力される。   On the other hand, since the determination in step S212 shown in FIG. 7 is “false”, the trace control unit 50 prohibits the output of the address information AD (1000) stored in the register r0 as the trace information TRI. To do. If the flag FLG of the register r0 is “0” in the load instruction LDR at address 2, the determination in step S212 shown in FIG. 7 is “true”. In this case, the address information AD (1000) stored in the register r0 is also output as the trace information TRI.

3番地の転送命令MOVでは、1番地の転送命令MOVと同様に、フラグ制御部FCNTは、レジスタr1のフラグFLGを”1”に設定し、トレース制御部50は、実行情報EXE(”E”)をトレース情報TRIとして出力する(図9(c))。   As with the transfer instruction MOV at the address 3, the flag control unit FCNT sets the flag FLG of the register r1 to “1”, and the trace control unit 50 executes the execution information EXE (“E”). ) Is output as the trace information TRI (FIG. 9C).

4番地のストア命令STRの実行によるレジスタr2の値のメモリ20への書き込みは、条件Eに該当するため、フラグ制御部FCNTは、フラグFLGを書き替えず、図7に示したステップS208の判定は”偽(No)”である。このため、トレース制御部50は、メモリ20に書き込んだデータ(100)を示すデータ情報DTのトレース情報TRIとしての出力を禁止する。一方、図7に示したステップS212の判定は”真(Yes)”であるため、トレース制御部50は、データの書き込み先のアドレス情報AD(500)を、実行情報EXE(”E”)とともにトレース情報TRIとして出力する(図9(d))。   Since the write of the value of the register r2 to the memory 20 by the execution of the store instruction STR at address 4 corresponds to the condition E, the flag control unit FCNT does not rewrite the flag FLG, and the determination in step S208 shown in FIG. Is “No”. For this reason, the trace control unit 50 prohibits the output of the data information DT indicating the data (100) written in the memory 20 as the trace information TRI. On the other hand, since the determination in step S212 shown in FIG. 7 is “true”, the trace control unit 50 sets the address information AD (500) of the data write destination together with the execution information EXE (“E”). Output as trace information TRI (FIG. 9D).

5番目の転送命令MOVでは、フラグ制御部FCNTおよびトレース制御部50は、1番地の転送命令MOVと同様に動作する。そして、実行情報EXE(”E”)がトレース情報TRIとして出力される(図9(e))。   In the fifth transfer instruction MOV, the flag control unit FCNT and the trace control unit 50 operate in the same manner as the transfer instruction MOV at address 1. Then, the execution information EXE (“E”) is output as the trace information TRI (FIG. 9 (e)).

6番地の減算命令SUBの実行により使用されるレジスタr0、r1のフラグFLGは、”1”に設定されており、図4に示した条件Bに該当する。このため、フラグ制御部FCNTは、演算結果を格納するレジスタr0のフラグFLGを”1”に設定する。なお、フラグ制御部FCNTは、フラグFLGに設定された値と、フラグFLGを書き替える値が同じ場合、フラグFLGの書き替え動作を禁止してもよい。図7に示したステップS202の判定は、”偽(No)”であるため、トレース制御部50は、実行情報EXE(”E”)をトレース情報TRIとして出力する(図9(f))。   The flag FLG of the registers r0 and r1 used by the execution of the subtraction instruction SUB at address 6 is set to “1” and corresponds to the condition B shown in FIG. Therefore, the flag control unit FCNT sets the flag FLG of the register r0 that stores the calculation result to “1”. Note that the flag control unit FCNT may prohibit the rewriting operation of the flag FLG when the value set in the flag FLG is the same as the value for rewriting the flag FLG. Since the determination in step S202 shown in FIG. 7 is “false”, the trace control unit 50 outputs the execution information EXE (“E”) as the trace information TRI (FIG. 9F).

7番地の乗算命令MULの実行により使用されるレジスタr0のフラグFLGは、”1”に設定されており、図4に示した条件Bに該当する。このため、フラグ制御部FCNTは、演算結果を格納するレジスタr3のフラグFLGを”1”に設定する。図7に示したステップS202の判定は、”偽(No)”であるため、トレース制御部50は、実行情報EXE(”E”)をトレース情報TRIとして出力する(図9(g))。   The flag FLG of the register r0 used by executing the multiplication instruction MUL at address 7 is set to “1”, which corresponds to the condition B shown in FIG. Therefore, the flag control unit FCNT sets the flag FLG of the register r3 that stores the calculation result to “1”. Since the determination in step S202 shown in FIG. 7 is “false”, the trace control unit 50 outputs the execution information EXE (“E”) as the trace information TRI (FIG. 9 (g)).

8番地のロード命令LDRの実行によるレジスタr4への”10101”の格納は、図4に示した条件Dに該当するため、フラグ制御部FCNTは、レジスタr4のフラグFLGを”0”に設定する。図7に示したステップS202、S204の判定は、ともに”真(Yes)”である。このため、トレース制御部50は、メモリ20から読み出したデータ(10101)を示すデータ情報DTを、実行情報EXE(”E”)とともにトレース情報TRIとして出力する(図9(h))。   Since the storage of “10101” in the register r4 by execution of the load instruction LDR at address 8 corresponds to the condition D shown in FIG. 4, the flag control unit FCNT sets the flag FLG of the register r4 to “0”. . The determinations in steps S202 and S204 shown in FIG. 7 are both “true”. Therefore, the trace control unit 50 outputs the data information DT indicating the data (10101) read from the memory 20 as the trace information TRI together with the execution information EXE (“E”) (FIG. 9 (h)).

9番地のストア命令STRの実行によるレジスタr2の値のメモリ20への書き込みは、条件Eに該当するため、フラグ制御部FCNTは、フラグFLGの書き替えをしない。図7に示したステップS202の判定は、”真(Yes)”であり、ステップS204の判定は、”偽(No)”であり、ステップS208の判定は、”偽(No)”である。このため、トレース制御部50は、メモリ20に書き込んだデータ(100)を示すデータ情報DTのトレース情報TRIとしての出力を禁止する。また、図7に示したステップS212の判定は”偽(No)”であるため、トレース制御部50は、データの書き込み先のアドレス情報AD(500)のトレース情報TRIとしての出力を禁止する。これにより、実行情報EXE(”E”)がトレース情報TRIとして出力される(図9(i))。   Writing the value of the register r2 to the memory 20 by executing the store instruction STR at address 9 corresponds to the condition E. Therefore, the flag control unit FCNT does not rewrite the flag FLG. The determination in step S202 shown in FIG. 7 is “true”, the determination in step S204 is “false”, and the determination in step S208 is “false”. For this reason, the trace control unit 50 prohibits the output of the data information DT indicating the data (100) written in the memory 20 as the trace information TRI. Since the determination in step S212 shown in FIG. 7 is “false”, the trace control unit 50 prohibits the output of the address information AD (500) of the data write destination as the trace information TRI. As a result, the execution information EXE (“E”) is output as the trace information TRI (FIG. 9 (i)).

10番地の減算命令SUBでは、フラグ制御部FCNTおよびトレース制御部50は、6番地の減算命令SUBと同様に動作する。そして、実行情報EXE(”E”)がトレース情報TRIとして出力される(図9(j))。   In the subtraction instruction SUB at address 10, the flag control unit FCNT and the trace control unit 50 operate in the same manner as the subtraction instruction SUB at address 6. Then, the execution information EXE (“E”) is output as the trace information TRI (FIG. 9 (j)).

11番地の比較命令CMPは、条件Eに該当するため、フラグ制御部FCNTは、フラグFLGの書き替えをしない。図7に示したステップS202の判定は、”偽(No)”であるため、トレース制御部50は、実行情報EXE(”E”)をトレース情報TRIとして出力する(図9(k))。   Since the comparison instruction CMP at address 11 corresponds to the condition E, the flag control unit FCNT does not rewrite the flag FLG. Since the determination in step S202 shown in FIG. 7 is “false”, the trace control unit 50 outputs the execution information EXE (“E”) as the trace information TRI (FIG. 9 (k)).

12番地の分岐命令BNEは、条件Eに該当するため、フラグ制御部FCNTは、フラグFLGの書き替えをしない。図7に示したステップS202の判定は、”偽(No)”である。また、レジスタr2の値は”0”でないため、分岐命令BNEによる条件が成立し、トレース制御部50は、実行情報EXE(”E”)をトレース情報TRIとして出力する(図9(l))。   Since the branch instruction BNE at address 12 corresponds to the condition E, the flag control unit FCNT does not rewrite the flag FLG. The determination in step S202 shown in FIG. 7 is “No”. Further, since the value of the register r2 is not “0”, the condition by the branch instruction BNE is satisfied, and the trace control unit 50 outputs the execution information EXE (“E”) as the trace information TRI (FIG. 9 (l)). .

以降、6番地から11番地の命令が再び実行され、フラグ制御部FCNTおよびトレース制御部50は、図9(f)、(g)、(h)、(i)、(j)、(k)に示した動作と同様に動作する(図9(m)、(n)、(o)、(p)、(q)、(r))。   Thereafter, the instructions from address 6 to address 11 are executed again, and the flag control unit FCNT and the trace control unit 50 perform the processes shown in FIGS. 9 (f), (g), (h), (i), (j), (k). The operation is similar to that shown in FIG. 9 (FIGS. 9M, 9N, 9O, 9P, 9Q, 9R).

2回目の12番地の分岐命令BNEは、条件Eに該当するため、フラグ制御部FCNTは、フラグFLGの書き替えをしない。図7に示したステップS202の判定は、”偽(No)”である。また、レジスタr2の値は”0”であり、分岐命令BNEによる条件が成立しないため、トレース制御部50は、実行情報EXE(”N”)をトレース情報TRIとして出力する(図9(s))。   Since the branch instruction BNE at the 12th address corresponds to the condition E, the flag control unit FCNT does not rewrite the flag FLG. The determination in step S202 shown in FIG. 7 is “No”. Since the value of the register r2 is “0” and the condition based on the branch instruction BNE is not satisfied, the trace control unit 50 outputs the execution information EXE (“N”) as the trace information TRI (FIG. 9 (s)). ).

13番地の加算命令ADDの実行により使用されるレジスタr0、r3のフラグFLGは、”1”に設定されており、図4に示した条件Bに該当する。このため、フラグ制御部FCNTは、演算結果を格納するレジスタr0のフラグFLGを”1”に設定する。図7に示したステップS202の判定は、”偽(No)”であるため、トレース制御部50は、実行情報EXE(”E”)をトレース情報TRIとして出力する(図9(t))。   The flag FLG of the registers r0 and r3 used by the execution of the addition instruction ADD at address 13 is set to “1”, which corresponds to the condition B shown in FIG. Therefore, the flag control unit FCNT sets the flag FLG of the register r0 that stores the calculation result to “1”. Since the determination in step S202 shown in FIG. 7 is “false”, the trace control unit 50 outputs the execution information EXE (“E”) as the trace information TRI (FIG. 9 (t)).

14番地のロード命令LDRの実行によるレジスタr2への”30303”の格納は、図4に示した条件Dに該当するため、フラグ制御部FCNTは、レジスタr2のフラグFLGを”0”に設定する。図7に示したステップS202、S204の判定は、ともに”真(Yes)”である。このため、トレース制御部50は、メモリ20から読み出したデータ(30303)を示すデータ情報DTを、実行情報EXE(”E”)とともにトレース情報TRIとして出力する(図9(u))。   Since the storage of “30303” into the register r2 by the execution of the load instruction LDR at address 14 corresponds to the condition D shown in FIG. 4, the flag control unit FCNT sets the flag FLG of the register r2 to “0”. . The determinations in steps S202 and S204 shown in FIG. 7 are both “true”. Therefore, the trace control unit 50 outputs the data information DT indicating the data (30303) read from the memory 20 as the trace information TRI together with the execution information EXE (“E”) (FIG. 9 (u)).

15番地のストア命令STRの実行によるレジスタr2の値のメモリ20への書き込みは、条件Eに該当するため、フラグ制御部FCNTは、フラグFLGの書き替えをしない。図7に示したステップS202の判定は、”真(Yes)”であり、ステップS204の判定は、”偽(No)”であり、ステップS208の判定は、”真(Yes)”である。このため、トレース制御部50は、メモリ20に書き込んだデータ(30303)を示すデータ情報DTを実行情報EXE(”E”)とともにトレース情報TRIとして出力する(図9(v))。一方、図7に示したステップS212の判定は”偽(No)”であるため、トレース制御部50は、データの書き込み先のアドレス情報AD(2400)のトレース情報TRIとしての出力を禁止する。   The writing of the value of the register r2 to the memory 20 by the execution of the store instruction STR at address 15 corresponds to the condition E, and therefore the flag control unit FCNT does not rewrite the flag FLG. The determination in step S202 shown in FIG. 7 is “true”, the determination in step S204 is “false”, and the determination in step S208 is “true”. Therefore, the trace control unit 50 outputs the data information DT indicating the data (30303) written in the memory 20 as the trace information TRI together with the execution information EXE (“E”) (FIG. 9 (v)). On the other hand, since the determination in step S212 shown in FIG. 7 is “false”, the trace control unit 50 prohibits the output of the address information AD (2400) of the data write destination as the trace information TRI.

16番地の加算命令ADDの実行により使用されるレジスタr2のフラグFLGは、”0”に設定されており、図4に示した条件Cに該当する。このため、フラグ制御部FCNTは、演算結果を格納するレジスタr3のフラグFLGを”0”に設定する。図7に示したステップS202の判定は、”偽(No)”であるため、トレース制御部50は、実行情報EXE(”E”)をトレース情報TRIとして出力する(図9(w))。   The flag FLG of the register r2 used by the execution of the addition instruction ADD at address 16 is set to “0”, which corresponds to the condition C shown in FIG. Therefore, the flag control unit FCNT sets the flag FLG of the register r3 that stores the calculation result to “0”. Since the determination in step S202 shown in FIG. 7 is “false”, the trace control unit 50 outputs the execution information EXE (“E”) as the trace information TRI (FIG. 9 (w)).

図10は、図8に示したプログラムをプロセッサ10が実行する場合に出力されるトレース情報TRIの例を示す。実行される命令と、命令の実行により更新されるレジスタREGおよびフラグFLGと、トレース制御部50から出力されるトレース情報TRIは、図9と同じである。なお、図10では、レジスタr0に対応するフラグFLGを符号fr0で示し、レジスタr1に対応するフラグFLGを符号fr1で示す。レジスタr2に対応するフラグFLGを符号fr2で示し、レジスタr3に対応するフラグFLGを符号fr3で示し、レジスタr4に対応するフラグFLGを符号fr4で示す。   FIG. 10 shows an example of the trace information TRI output when the processor 10 executes the program shown in FIG. The instruction to be executed, the register REG and flag FLG updated by the execution of the instruction, and the trace information TRI output from the trace control unit 50 are the same as those in FIG. In FIG. 10, the flag FLG corresponding to the register r0 is indicated by a symbol fr0, and the flag FLG corresponding to the register r1 is indicated by a symbol fr1. A flag FLG corresponding to the register r2 is indicated by a symbol fr2, a flag FLG corresponding to the register r3 is indicated by a symbol fr3, and a flag FLG corresponding to the register r4 is indicated by a symbol fr4.

図10の右端に大きいかぎ括弧で示したトレース情報は、図6に示したデータトレース生成部DTGENを持たないトレース制御部が出力するトレース情報TRIの例を示す。データトレース生成部DTGENがない場合、ロード命令およびストア命令において、プロセッサ10とメモリ20との間で授受される全てのアドレス情報ADおよびデータ情報DTが、トレース情報TRIとして出力される。これに対して、データトレース生成部DTGENを持つトレース制御部50では、プロセッサ10により既に実行された命令をたどることにより復元可能なデータ情報DTおよびアドレス情報ADは、トレース情報TRIとしての出力が禁止される。   Trace information indicated by large brackets at the right end of FIG. 10 shows an example of the trace information TRI output by the trace control unit that does not have the data trace generation unit DTGEN shown in FIG. When there is no data trace generation unit DTGEN, all address information AD and data information DT exchanged between the processor 10 and the memory 20 in the load instruction and the store instruction are output as the trace information TRI. In contrast, in the trace control unit 50 having the data trace generation unit DTGEN, the data information DT and the address information AD that can be restored by following the instruction already executed by the processor 10 are prohibited from being output as the trace information TRI. Is done.

これにより、トレース情報TRIとしてトレースバッファ60に転送する情報量を、データトレース生成部DTGENがない場合に比べて削減できる。例えば、図10では、トレース情報TRIとして出力するデータ情報DTおよびアドレス情報ADは、16個から6個に減らすことができる(62.5%の削減効果)。この結果、プロセッサ10による命令の実行を中断することなく、トレース情報TRIをリアルタイムでトレースバッファ60に転送できるトレース情報線TRIのビット幅を、データトレース生成部DTGENがない場合に比べて小さくすることができる。換言すれば、半導体装置SEM2において、トレース情報TRIを出力する端子の数をデータトレース生成部DTGENがない場合に比べて減らすことができ、半導体装置SEM2のチップサイズを削減することができる。さらに、トレース情報TRIとして保持する情報量が削減できるため、トレースバッファ60の記憶容量を減らすことができる。この結果、半導体装置SEM2の製造コストを削減することができ、トレース機能を有するデバッグ基板DBGBのコストを削減することができる。   As a result, the amount of information transferred to the trace buffer 60 as the trace information TRI can be reduced as compared with the case where there is no data trace generation unit DTGEN. For example, in FIG. 10, the data information DT and the address information AD output as the trace information TRI can be reduced from 16 to 6 (62.5% reduction effect). As a result, the bit width of the trace information line TRI that can transfer the trace information TRI to the trace buffer 60 in real time without interrupting the execution of the instruction by the processor 10 is reduced as compared with the case where there is no data trace generation unit DTGEN. Can do. In other words, in the semiconductor device SEM2, the number of terminals that output the trace information TRI can be reduced compared to the case where the data trace generation unit DTGEN is not provided, and the chip size of the semiconductor device SEM2 can be reduced. Furthermore, since the amount of information held as the trace information TRI can be reduced, the storage capacity of the trace buffer 60 can be reduced. As a result, the manufacturing cost of the semiconductor device SEM2 can be reduced, and the cost of the debug board DBGB having a trace function can be reduced.

一方、トレース情報線TRIのビット幅を小さくしない場合、リアルタイムでトレース可能な命令数を従来に比べて増やすことができる。したがって、プロセッサ10の動作周波数が高くなる場合にも、プロセッサ10が実行する命令に同期してリアルタイムでトレース情報TRIを出力することができ、半導体装置SEM2が搭載されるシステムのデバッグ性能を向上することができる。   On the other hand, when the bit width of the trace information line TRI is not reduced, the number of instructions that can be traced in real time can be increased compared to the conventional case. Therefore, even when the operating frequency of the processor 10 becomes high, the trace information TRI can be output in real time in synchronization with the instruction executed by the processor 10, and the debugging performance of the system in which the semiconductor device SEM2 is mounted is improved. be able to.

図11は、図2に示したエミュレータ100の動作の例を示す。すなわち、図11は、トレースバッファ60に格納されたトレース情報TRIに基づいて、プロセッサ10により実行された命令の実行履歴をエミュレータ100により再現する例を示す。エミュレータ100は、図2に示したプログラムを実行することで、図11に示す動作を実現する。   FIG. 11 shows an example of the operation of the emulator 100 shown in FIG. That is, FIG. 11 shows an example in which the emulator 100 reproduces the execution history of instructions executed by the processor 10 based on the trace information TRI stored in the trace buffer 60. The emulator 100 implements the operation shown in FIG. 11 by executing the program shown in FIG.

まず、ステップS300において、エミュレータ100は、図2に示した記憶装置130に格納されたソースプログラムから1つの番地に対応する命令を読み出す。次に、ステップS302において、エミュレータ100は、ステップS300で読み出した命令に対応するトレース情報TRIをトレースバッファ60から読み出す。なお、エミュレータ100は、トレース情報TRIに含まれる実行情報EXE(”E”)の数をカウントすることにより、読み出す命令と読み出すトレース情報TRIとを一致させる。また、エミュレータ100は、トレース情報TRIに含まれる実行情報EXE(”N”)を検出することにより、分岐命令後の分岐先を判定する。   First, in step S300, the emulator 100 reads an instruction corresponding to one address from the source program stored in the storage device 130 shown in FIG. Next, in step S302, the emulator 100 reads the trace information TRI corresponding to the instruction read in step S300 from the trace buffer 60. The emulator 100 counts the number of execution information EXE (“E”) included in the trace information TRI, thereby matching the read instruction with the read trace information TRI. Further, the emulator 100 determines the branch destination after the branch instruction by detecting the execution information EXE (“N”) included in the trace information TRI.

次に、ステップS304において、エミュレータ100は、読み出したトレース情報TRIにデータ情報DTまたはアドレス情報ADの少なくともいずれかが含まれるか否かを判定する。読み出したトレース情報TRIにデータ情報DTまたはアドレス情報ADの少なくともいずれかが含まれる場合、処理はステップS306に移行される。読み出したトレース情報TRIにデータ情報DTおよびアドレス情報ADが含まれない場合、処理はステップS308に移行される。   Next, in step S304, the emulator 100 determines whether or not the read trace information TRI includes at least one of the data information DT and the address information AD. When the read trace information TRI includes at least one of the data information DT and the address information AD, the process proceeds to step S306. If the read trace information TRI does not include the data information DT and the address information AD, the process proceeds to step S308.

ステップS306において、エミュレータ100は、トレース情報TRIを用いて、プロセッサ10の実行により変化したレジスタREGの値の一部と、メモリ20のアクセスに使用したデータおよびアドレスとの一部を再現する。ここで、トレース情報TRIは、データ情報DTまたはアドレス情報ADの一方、あるいはデータ情報DTまたはアドレス情報ADの両方を含む。例えば、図10に示した2番地のロード命令LDRでは、レジスタr2に格納されるデータ”500”が再現され、4番地のストア命令STRでは、データを書き込むメモリ20のアドレス”500”が再現される。図10に示した15番地のストア命令STRでは、メモリ20に書き込むデータ”30303”が再現される。   In step S <b> 306, the emulator 100 uses the trace information TRI to reproduce a part of the value of the register REG changed by the execution of the processor 10 and a part of the data and address used for accessing the memory 20. Here, the trace information TRI includes either the data information DT or the address information AD, or both the data information DT or the address information AD. For example, in the load instruction LDR at address 2 shown in FIG. 10, the data “500” stored in the register r2 is reproduced, and in the store instruction STR at address 4, the address “500” of the memory 20 to which data is written is reproduced. The In the store instruction STR at the address 15 shown in FIG. 10, the data “30303” to be written in the memory 20 is reproduced.

ステップS308において、エミュレータ100は、既に再現した情報からプロセッサ10による命令の実行により変化したレジスタREGの値およびフラグFLGの値と、メモリ20のアクセスに使用したデータおよびアドレスを再現する。   In step S308, the emulator 100 reproduces the value of the register REG and the value of the flag FLG that have been changed by the execution of the instruction by the processor 10 from the already reproduced information, and the data and address used for accessing the memory 20.

次に、ステップS310において、エミュレータ100は、プロセッサ10により実行された全ての命令が再現されたか否かを判定する。プロセッサ10により実行された全ての命令が再現された場合、プロセッサ10が実行した命令の再現処理は終了する。プロセッサ10により実行された全ての命令が再現されていない場合、処理はステップS312に移行される。なお、所定の範囲の命令列の再現が図2に示した入力装置110を介して指定された場合、エミュレータ100は、ステップS310において、所定の範囲の命令列が再現されたか否かを判定する。   Next, in step S310, the emulator 100 determines whether all instructions executed by the processor 10 have been reproduced. When all the instructions executed by the processor 10 are reproduced, the instruction reproduction processing executed by the processor 10 ends. If not all instructions executed by the processor 10 have been reproduced, the process proceeds to step S312. If reproduction of a predetermined range of instruction sequences is designated via the input device 110 shown in FIG. 2, the emulator 100 determines in step S310 whether or not the predetermined sequence of instruction sequences has been reproduced. .

ステップS312において、再現した命令が分岐命令であるか否かを判定する。再現した命令が分岐命令である場合、処理はステップS314に移行され、再現した命令が分岐命令でない場合、処理はステップS318に移行される。   In step S312, it is determined whether the reproduced instruction is a branch instruction. If the reproduced instruction is a branch instruction, the process proceeds to step S314. If the reproduced instruction is not a branch instruction, the process proceeds to step S318.

ステップS314において、エミュレータ100は、分岐命令で条件が成立したか否かを判定する。分岐命令で条件が成立した場合、処理はステップS316に移行され、分岐命令で条件が成立しない場合、処理はステップS318に移行される。例えば、図10に示した1回目の分岐命令BNEでは、条件が成立するため(レジスタr2の値が”0”でない)、処理がステップS316に移行する。図10に示した2回目の分岐命令BNEでは、条件が成立しないため(レジスタr2の値が”0”)、処理はステップS318に移行する。   In step S314, the emulator 100 determines whether a condition is satisfied by the branch instruction. If the condition is satisfied by the branch instruction, the process proceeds to step S316. If the condition is not satisfied by the branch instruction, the process proceeds to step S318. For example, in the first branch instruction BNE shown in FIG. 10, since the condition is satisfied (the value of the register r2 is not “0”), the process proceeds to step S316. In the second branch instruction BNE shown in FIG. 10, since the condition is not satisfied (the value of the register r2 is “0”), the process proceeds to step S318.

ステップS316において、エミュレータ100は、次に再現する命令の番地を分岐先の番地に変更し、処理をステップS300に戻す。ステップS318において、エミュレータ100は、今回命令を再現した番地をインクリメントして、次に再現する命令の番地を求め、処理をステップS300に戻す。   In step S316, the emulator 100 changes the address of the instruction to be reproduced next to the branch destination address, and returns the process to step S300. In step S318, the emulator 100 increments the address at which the current instruction is reproduced, obtains the address of the instruction to be reproduced next, and returns the process to step S300.

図12は、図11に示したエミュレータ100の動作により復元されたプロセッサ10の実行履歴の例を示す。例えば、図12に示す実行履歴は、エミュレータ100により、出力装置120である表示装置またはプリンタに出力される。なお、図12において、下線を付した数値は、トレース情報TRIから再現された情報を示す。実際の実行履歴では、数値に下線は付かない。   FIG. 12 shows an example of the execution history of the processor 10 restored by the operation of the emulator 100 shown in FIG. For example, the execution history shown in FIG. 12 is output by the emulator 100 to a display device or printer that is the output device 120. In FIG. 12, the underlined numerical values indicate information reproduced from the trace information TRI. In the actual execution history, the numbers are not underlined.

実行履歴では、プロセッサ10により実行された命令と番地とが、符号Codeと符号PCとで示される。各命令の実行後のレジスタREG(r0、r1、r2、r3、r4)の値と、フラグFLG(fr0、fr1、fr2、fr3、fr4)の値が符号Registersとして示される。ロード命令LDRの実行によりメモリ20に出力されたアドレスと、メモリ20から読み出されたデータとが、アドレス情報ADおよびデータ情報DTとして符号Memory Accessの符号Readの領域に示される。ストア命令STRの実行によりメモリ20に出力されたアドレスおよびデータが、アドレス情報ADおよびデータ情報DTとして符号Memory Accessの符号Writeの領域に示される。   In the execution history, the instruction and address executed by the processor 10 are indicated by a code Code and a code PC. The value of the register REG (r0, r1, r2, r3, r4) after the execution of each instruction and the value of the flag FLG (fr0, fr1, fr2, fr3, fr4) are indicated as a sign Registers. The address output to the memory 20 by the execution of the load instruction LDR and the data read from the memory 20 are indicated in the area of the code Read of the code Memory Access as the address information AD and the data information DT. The address and data output to the memory 20 by execution of the store instruction STR are indicated in the area of the code Write of the code Memory Access as address information AD and data information DT.

以上、図2から図12に示した実施形態においても、図1に示した実施形態と同様に、トレース情報TRIを出力する端子の数を削減することができ、半導体装置SEM2の規模を削減することができる。また、トレースバッファ60の記憶容量を従来に比べて削減することができ、半導体装置SEM1が搭載されるシステムの規模を削減することができ、システムコストの削減に寄与することができる。さらに、トレース情報TRIを出力するために半導体装置SEM2に設けられる端子の数を削減しない場合、演算部OPUの動作とともにリアルタイムでトレース可能な命令数を従来に比べて増やすことができる。すなわち、演算部OPUの動作周波数が高くなる場合にも、演算部OPUが実行する命令に同期してリアルタイムでトレース情報TRIを出力することができ、半導体装置SEM2が搭載されるデバッグシステムDBGSYSのデバッグ性能を向上することができる。   As described above, in the embodiment shown in FIGS. 2 to 12 as well, as in the embodiment shown in FIG. 1, the number of terminals that output the trace information TRI can be reduced, and the scale of the semiconductor device SEM2 can be reduced. be able to. Further, the storage capacity of the trace buffer 60 can be reduced as compared with the conventional case, the scale of the system on which the semiconductor device SEM1 is mounted can be reduced, and the system cost can be reduced. Furthermore, when the number of terminals provided in the semiconductor device SEM2 for outputting the trace information TRI is not reduced, the number of instructions that can be traced in real time can be increased as compared with the conventional case along with the operation of the arithmetic unit OPU. That is, even when the operating frequency of the arithmetic unit OPU becomes high, the trace information TRI can be output in real time in synchronization with an instruction executed by the arithmetic unit OPU, and the debug system DBGSYS on which the semiconductor device SEM2 is mounted can be debugged. The performance can be improved.

以上の詳細な説明により、実施形態の特徴点および利点は明らかになるであろう。これは、特許請求の範囲がその精神および権利範囲を逸脱しない範囲で前述のような実施形態の特徴点および利点にまで及ぶことを意図するものである。また、当該技術分野において通常の知識を有する者であれば、あらゆる改良および変更に容易に想到できるはずである。したがって、発明性を有する実施形態の範囲を前述したものに限定する意図はなく、実施形態に開示された範囲に含まれる適当な改良物および均等物に拠ることも可能である。   From the above detailed description, features and advantages of the embodiments will become apparent. This is intended to cover the features and advantages of the embodiments described above without departing from the spirit and scope of the claims. Also, any improvement and modification should be readily conceivable by those having ordinary knowledge in the art. Therefore, there is no intention to limit the scope of the inventive embodiments to those described above, and appropriate modifications and equivalents included in the scope disclosed in the embodiments can be used.

10…プロセッサ;20…メモリ;30…周辺回路;40…ユーザロジック;50…トレース制御部;100…エミュレータ;110…入力装置;120…出力装置;130…記憶装置;AB…アドレスバス;AD…アドレス情報;AFLG…アドレスフラグ信号;AND…アンド回路;AOUT…アドレス出力部;DB…データバス;DBGB…デバッグ基板;DBGSYS…デバッグシステム;DFLG…データフラグ信号;DIS…ディセーブル端子;DOUT…データ出力部;DT…データ情報;DTGEN…データトレース生成部;ELIST…実行履歴;EML…エミュレータ;EN…イネーブル端子;EXE…実行情報;FCNT…フラグ制御部;FLG…フラグ;FWR…フラグ書き替え線;ID…命令デコーダ;IFU…命令フェッチ部;INC…インクリメンタ;INS…命令;ITGEN…命令トレース生成部;LSU…ロード/ストア部;MA…メモリアクセス情報;MEM…メモリ;MU…記憶部;OP…演算器;OPU…演算部;PC…プログラムカウンタ;REG…レジスタ;REGU…レジスタ部;SBUS…システムバス;SEL…セレクタ;SEM1、SEM2…半導体装置;S/L…ストアロード情報;SPGM…ソースプログラム;TCNT…トレース制御部   DESCRIPTION OF SYMBOLS 10 ... Processor; 20 ... Memory; 30 ... Peripheral circuit; 40 ... User logic; 50 ... Trace control part; 100 ... Emulator; 110 ... Input device; 120 ... Output device; 130 ... Storage device; Address information; AFLG ... Address flag signal; AND ... AND circuit; AOUT ... Address output unit; DB ... Data bus; DBGB ... Debug board; DBGSYS ... Debug system; DFLG ... Data flag signal; DIS ... Disable terminal; DT ... Data information; DTGEN ... Data trace generation unit; ELIST ... Execution history; EML ... Emulator; EN ... Enable terminal; EXE ... Execution information; FCNT ... Flag control unit; FLG ... Flag; FWR ... Flag rewriting line ID: Instruction decoder; IFU ... Instruction fetch unit; INC ... incrementer; INS ... instruction; ITGEN ... instruction trace generation unit; LSU ... load / store unit; MA ... memory access information; MEM ... memory; MU ... storage unit; OP ... arithmetic unit; Part: PC: program counter; REG ... register; REGU ... register part; SBUS ... system bus; SEL ... selector; SEM1, SEM2 ... semiconductor device; S / L ... store load information; SPGM ... source program;

Claims (11)

命令を実行する演算部と、
前記演算部で使用する情報を保持するレジスタと、
前記レジスタに対応して設けられ、第1の値または第2の値に設定されるフラグを保持する記憶部と、
前記演算部により実行された命令に基づいて前記レジスタに格納された情報を再現することが困難な場合に前記フラグを前記第1の値に設定し、前記演算部により実行された命令に基づいて前記レジスタに格納された情報を再現可能な場合に前記フラグを前記第2の値に設定するフラグ制御部と、
メモリにアクセスする命令が前記演算部により実行される場合に、前記メモリのアクセスに使用される値であって、前記第1の値に設定された前記フラグに対応する前記レジスタに格納された値をトレース情報として出力するトレース制御部
を備えることを特徴とする半導体装置。
An arithmetic unit for executing instructions;
A register for holding information used in the arithmetic unit;
A storage unit provided corresponding to the register and holding a flag set to the first value or the second value;
The flag is set to the first value when it is difficult to reproduce the information stored in the register based on the instruction executed by the arithmetic unit, and based on the instruction executed by the arithmetic unit A flag control unit that sets the flag to the second value when the information stored in the register is reproducible;
A value used for accessing the memory when an instruction to access the memory is executed by the arithmetic unit, and a value stored in the register corresponding to the flag set to the first value A semiconductor device comprising: a trace control unit that outputs a trace information as trace information.
前記トレース制御部は、前記第1の値に設定された前記フラグに対応する前記レジスタに格納されたデータをメモリに書き込む命令が前記演算部により実行される場合に、前記メモリに書き込むデータをトレース情報として出力するデータ出力部を備えること
を特徴とする請求項1記載の半導体装置。
The trace control unit traces data to be written to the memory when an instruction to write the data stored in the register corresponding to the flag set to the first value to the memory is executed by the arithmetic unit. The semiconductor device according to claim 1, further comprising a data output unit that outputs the information.
前記データ出力部は、前記メモリから読み出したデータを前記レジスタに格納する命令が前記演算部により実行される場合に、前記レジスタに格納するデータを前記トレース情報として出力すること
を特徴とする請求項2記載の半導体装置。
The data output unit outputs data to be stored in the register as the trace information when an instruction to store data read from the memory in the register is executed by the arithmetic unit. 2. The semiconductor device according to 2.
前記データ出力部は、前記第2の値に設定された前記フラグに対応する前記レジスタに格納されたデータを前記メモリに書き込む命令が前記演算部により実行される場合に、前記メモリに書き込むデータの前記トレース情報としての出力を禁止するマスク部を備えること
を特徴とする請求項2または請求項3記載の半導体装置。
The data output unit is configured to store data to be written to the memory when an instruction to write data stored in the register corresponding to the flag set to the second value is executed by the arithmetic unit. The semiconductor device according to claim 2, further comprising a mask unit that prohibits output as the trace information.
前記トレース制御部は、前記第1の値に設定された前記フラグに対応する前記レジスタに格納されたアドレスが示す前記メモリの記憶領域にアクセスする命令が前記演算部により実行される場合に、前記レジスタに格納されたアドレスを前記トレース情報として出力するアドレス出力部を備えること
を特徴とする請求項1ないし請求項4のいずれか1項記載の半導体装置。
The trace control unit, when an instruction to access a storage area of the memory indicated by an address stored in the register corresponding to the flag set to the first value is executed by the arithmetic unit, 5. The semiconductor device according to claim 1, further comprising: an address output unit that outputs an address stored in a register as the trace information.
前記アドレス出力部は、前記第2の値に設定された前記フラグに対応する前記レジスタに格納されたアドレスが示す前記メモリの記憶領域にアクセスする命令が前記演算部により実行される場合に、前記レジスタに格納されたアドレスの前記トレース情報としての出力を禁止するマスク部を備えること
を特徴とする請求項5項記載の半導体装置。
The address output unit, when an instruction to access a storage area of the memory indicated by an address stored in the register corresponding to the flag set to the second value is executed by the arithmetic unit, The semiconductor device according to claim 5, further comprising a mask unit that prohibits output of the address stored in the register as the trace information.
前記フラグ制御部は、前記第1の値に設定された前記フラグに対応する前記レジスタの少なくとも1つを使用した演算命令が前記演算部により実行される場合に、演算結果が格納される前記レジスタに対応する前記フラグを前記第1の値に設定すること
を特徴とする請求項1ないし請求項6のいずれか1項記載の半導体装置。
The flag control unit stores the operation result when an operation instruction using at least one of the registers corresponding to the flag set to the first value is executed by the operation unit. The semiconductor device according to any one of claims 1 to 6, wherein the flag corresponding to is set to the first value.
前記フラグ制御部は、前記メモリからデータを読み出す命令が前記演算部により実行される場合に、前記メモリから読み出したデータが格納される前記レジスタに対応する前記フラグを前記第1の値に設定すること
を特徴とする請求項1ないし請求項7のいずれか1項記載の半導体装置。
The flag control unit sets the flag corresponding to the register in which the data read from the memory is stored to the first value when an instruction to read data from the memory is executed by the arithmetic unit. The semiconductor device according to claim 1, wherein:
前記フラグ制御部は、即値を前記レジスタに格納する命令が前記演算部により実行される場合に、即値が格納される前記レジスタに対応する前記フラグを前記第2の値に設定すること
を特徴とする請求項1ないし請求項8のいずれか1項記載の半導体装置。
The flag control unit sets the flag corresponding to the register in which an immediate value is stored to the second value when an instruction to store an immediate value in the register is executed by the arithmetic unit. The semiconductor device according to any one of claims 1 to 8.
前記フラグ制御部は、前記第2の値に設定された前記フラグに対応する前記レジスタを使用した演算命令が前記演算部により実行される場合に、演算結果が格納される前記レジスタに対応する前記フラグを前記第2の値に設定すること
を特徴とする請求項1ないし請求項9のいずれか1項記載の半導体装置。
The flag control unit corresponds to the register in which an operation result is stored when an operation instruction using the register corresponding to the flag set to the second value is executed by the operation unit. The semiconductor device according to any one of claims 1 to 9, wherein a flag is set to the second value.
命令を実行する演算部と、前記演算部で使用する情報を保持するレジスタとを備える半導体装置の動作制御方法であって、
前記レジスタに対応して設けられる記憶部のフラグを、前記演算部による命令の実行結果に応じて、前記演算部により実行された命令に基づいて前記レジスタに格納された情報を再現することが困難な場合に第1の値に設定し、前記演算部により実行された命令に基づいて前記レジスタに格納された情報を再現可能な場合に第2の値に設定し、
メモリにアクセスする命令が前記演算部により実行される場合に、前記メモリのアクセスに使用される値であって、前記第1の値に設定された前記フラグに対応する前記レジスタに格納された値をトレース情報として出力すること
を特徴とする半導体装置の動作制御方法。
An operation control method for a semiconductor device comprising: an arithmetic unit that executes an instruction; and a register that holds information used in the arithmetic unit,
It is difficult to reproduce the information stored in the register based on the instruction executed by the arithmetic unit based on the execution result of the instruction by the arithmetic unit using the flag of the storage unit provided corresponding to the register In this case, the first value is set, and when the information stored in the register can be reproduced based on the instruction executed by the arithmetic unit, the second value is set.
A value used for accessing the memory when an instruction to access the memory is executed by the arithmetic unit, and a value stored in the register corresponding to the flag set to the first value Is output as trace information. A method for controlling operation of a semiconductor device.
JP2013207171A 2013-10-02 2013-10-02 Semiconductor device and semiconductor device operation control method Active JP6127883B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2013207171A JP6127883B2 (en) 2013-10-02 2013-10-02 Semiconductor device and semiconductor device operation control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2013207171A JP6127883B2 (en) 2013-10-02 2013-10-02 Semiconductor device and semiconductor device operation control method

Publications (2)

Publication Number Publication Date
JP2015072551A JP2015072551A (en) 2015-04-16
JP6127883B2 true JP6127883B2 (en) 2017-05-17

Family

ID=53014885

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2013207171A Active JP6127883B2 (en) 2013-10-02 2013-10-02 Semiconductor device and semiconductor device operation control method

Country Status (1)

Country Link
JP (1) JP6127883B2 (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS52109845A (en) * 1976-03-12 1977-09-14 Hitachi Ltd Tracing method
JPH03158937A (en) * 1989-11-17 1991-07-08 Hitachi Ltd Program execution control system
GB2389432B (en) * 2002-06-07 2005-09-07 Advanced Risc Mach Ltd Instruction tracing in data processing systems

Also Published As

Publication number Publication date
JP2015072551A (en) 2015-04-16

Similar Documents

Publication Publication Date Title
JP2003510682A5 (en)
CN104978284B (en) Processor subroutine cache
KR101924821B1 (en) Alignment control
CN110832455B (en) Bit values inside test vector elements
JP2011039982A (en) Processor
KR100313939B1 (en) Interrupt Controller
US9436466B2 (en) Blank bit and processor instructions employing the blank bit
CN111177067B (en) System on chip
JP6127883B2 (en) Semiconductor device and semiconductor device operation control method
JP2004038327A (en) Data processor
US20100077383A1 (en) Simulation method and storage medium for storing program
US5812845A (en) Method for generating an object code for a pipeline computer process to reduce swapping instruction set
JPS61500992A (en) Improvements in or relating to computer systems
JP2007193572A (en) Cpu, integrated circuit device, microcomputer, and electronic equipment
JPH1011315A (en) In-circuit emulator device and in-circuit emulation method
JP2013539882A (en) Conditional selection of data elements
JP4545777B2 (en) Data processing device
JP2004118518A (en) Simulator, and recording medium recording the simulator readable in computer
JP5263498B2 (en) Signal processor and semiconductor device
JP2021033567A (en) Electronic control device
JPS6220960Y2 (en)
JP4498338B2 (en) Data processing device
JP4382076B2 (en) Data processing device
JPH05250156A (en) Risc processor
JP5311008B2 (en) Signal processor and semiconductor device

Legal Events

Date Code Title Description
A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20150605

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20160426

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20170228

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20170314

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20170327

R150 Certificate of patent or registration of utility model

Ref document number: 6127883

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150