JPH03113646A - Trace circuit - Google Patents

Trace circuit

Info

Publication number
JPH03113646A
JPH03113646A JP1252598A JP25259889A JPH03113646A JP H03113646 A JPH03113646 A JP H03113646A JP 1252598 A JP1252598 A JP 1252598A JP 25259889 A JP25259889 A JP 25259889A JP H03113646 A JPH03113646 A JP H03113646A
Authority
JP
Japan
Prior art keywords
address
loop
trace
execution
memory
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.)
Granted
Application number
JP1252598A
Other languages
Japanese (ja)
Other versions
JPH0748183B2 (en
Inventor
Tadashi Ito
直史 伊藤
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.)
Yokogawa Electric Corp
Original Assignee
Yokogawa Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yokogawa Electric Corp filed Critical Yokogawa Electric Corp
Priority to JP1252598A priority Critical patent/JPH0748183B2/en
Publication of JPH03113646A publication Critical patent/JPH03113646A/en
Publication of JPH0748183B2 publication Critical patent/JPH0748183B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

PURPOSE:To effectively use a memory by detecting a loop which is previously registered on a real time basis when it exists in the middle of trace and preventing the execution part of the loop from being stored overlapping in the trace memory. CONSTITUTION:When a real execution address reaches a loop leading address which is previously registered in a loop address register 5, it is detected whether it reaches the address for the first time as the result of the sequential execution of the program or as the result of branching to the head of the loop by a branching command for executing the loop. When it branches to the head of the loop, the execution result is not written into the new address of the trace memory 1 but it is overwritten in the address where data obtained when the loop is sequentially executed for the first time is stored. Thus, the substantial decrease of effective trace data owing to the execution of the loop is prevented and the trace memory is used at a maximum.

Description

【発明の詳細な説明】 (産業上の利用分野) 本発明はトレース回路に関し、特に、マイクロプロセッ
サ用インサーキットエミュレータ等に具備されるプログ
ラム実行トレース回路に関する。
DETAILED DESCRIPTION OF THE INVENTION (Field of Industrial Application) The present invention relates to a trace circuit, and particularly to a program execution trace circuit included in an in-circuit emulator for a microprocessor or the like.

(従来の技術) 従来のインサーキットエミュレータのトレース回路は、
トレース開始から常にマイクロプロセッサのバスアクセ
スをトレースし、トレースメモリ(通常、数にステップ
程度を記憶可能)にサイクリックに記憶していき、トレ
ース終了条件が成立した時にトレースメモリへの書込み
を停止I−するようになっている。
(Conventional technology) The trace circuit of a conventional in-circuit emulator is
It constantly traces the microprocessor's bus accesses from the start of tracing, stores them cyclically in the trace memory (which can usually store a number of steps), and stops writing to the trace memory when the trace end condition is met. - It is designed to be done.

(発明が解決しようとする課題) 調べたい個所とトレース終了条件が成立する個所の間で
は、通常の場合、多くの命令が実行される。その間でル
ープが実行されると、従来の方法では、ループの実行結
果ばかりがトレースメモリに残ることになり、調べたい
個所をトレースできない場合があった。
(Problem to be Solved by the Invention) Normally, many instructions are executed between the location to be investigated and the location where the trace end condition is met. If a loop is executed during that time, with the conventional method, only the loop execution results remain in the trace memory, making it sometimes impossible to trace the part you want to investigate.

例えば第5図(a)に示すように、トレース条件が成立
するまでにループ(G−H間)を何回も実行する必要が
あるとする。この場合、トレースメモリにプログラム実
行結果をすべて書込んでいき、容量オーバーとなると最
初のメモリーアドレスに戻ってオーバーライドしていく
とすると、最終的にはループの実行結果ばかりが記録さ
れ、調べたい個所Fの実行結果は消えてしまい、トレー
スできない。
For example, as shown in FIG. 5(a), it is assumed that the loop (between G and H) needs to be executed many times before the trace condition is satisfied. In this case, if you write all the program execution results to the trace memory, and if the capacity is exceeded, you go back to the first memory address and override it, eventually only the loop execution results will be recorded, and you will not be able to find the part you want to examine. The execution result of F disappears and cannot be traced.

また、このような問題を回避するためには大量のトレー
スメモリが必要となり、回路規模が大型化し、専有面積
の増大を招く等の問題があった。
Further, in order to avoid such problems, a large amount of trace memory is required, which causes problems such as an increase in circuit scale and an increase in exclusive area.

本発明は上述した問題点に鑑みてなされたものであり、
その目的は、ループの実行による有効なトレースデータ
の実質的な減少を防止し、トレースメモリを最大限に活
用できるトレース回路を提供することにある。
The present invention has been made in view of the above-mentioned problems, and
The purpose is to provide a trace circuit that prevents effective trace data from being substantially reduced due to loop execution and that makes full use of trace memory.

(課題を解決するための手段) 本発明のトレース回路は、トレース開始から終了に至る
まで実行されるループの先頭アドレスを記憶しているル
ープアドレスレジスタと、該ループアドレスレジスタの
記憶しているループ先頭アドレスと、ターゲットシステ
ムのアドレスバスの現在のアドレスとの一致を検出する
比較器と、該比較器により一致が検出された場合に、該
現在のアドレスの前記トレースメモリへの書込みアドレ
スを保持する記憶回路と、前記比較器により一致が検出
された場合に前記現在のアドレスが直前のアドレスに連
続するアドレスであるか、あるいは不連続なアドレスで
あるかを検出する比較器と、該比較器により現在のアド
レスと直前のアドレスとが不連続であることが検出され
た場合、前記記憶回路が保持しているアドレスを前記ト
レースメモリへの書込みアドレスとして選択するセレク
タとを有することを特徴とする。
(Means for Solving the Problems) The trace circuit of the present invention includes a loop address register that stores the start address of a loop that is executed from the start to the end of the trace, and a loop that stores the loop address register. a comparator that detects a match between the start address and a current address on an address bus of the target system; and, when a match is detected by the comparator, holds an address for writing the current address into the trace memory. a memory circuit; a comparator for detecting whether the current address is a contiguous address or a discontinuous address from the immediately previous address when a match is detected by the comparator; The present invention is characterized by comprising a selector that selects an address held by the storage circuit as a write address to the trace memory when it is detected that the current address and the previous address are discontinuous.

(作用) あらかじめループアドレスレジスタに登録されているル
ープ先頭アドレスに実際の実行アドレスが到達すると、
それがプログラムをシーケンシャルに実行した結果始め
て到達したものであるか、あるいはループを実行するた
めに分岐命令によってループ先頭に分岐してきた結果で
あるかを検出し、ループ先頭に分岐してきた場合には、
この実行結果をトレースメモリの新たな番地に書込まず
、一番最初にシーケンシャルに実行した時のデータが記
憶されている番地にオーバーライドすることにより、ル
ープの実行部分が重複してトレースメモリに記録されな
いようにし、メモリの有効利用を達成する。
(Operation) When the actual execution address reaches the loop start address registered in the loop address register in advance,
It detects whether the result is reached for the first time as a result of sequentially executing the program, or whether it is the result of branching to the beginning of the loop by a branch instruction to execute the loop, and if it branches to the beginning of the loop, ,
By not writing this execution result to a new address in the trace memory, but overriding it to the address where the data from the first sequential execution is stored, the executed part of the loop is recorded in the trace memory in duplicate. To achieve effective use of memory.

(実施例) 次に、本発明の実施例について図面を参照して説明する
(Example) Next, an example of the present invention will be described with reference to the drawings.

第1図は本発明のトレース回路の一実施例のブロック図
である。
FIG. 1 is a block diagram of one embodiment of the trace circuit of the present invention.

本実施例は、ターゲットマイクロプロセッサのデータバ
スおよびアドレスバスの状態を記録するトレースメモリ
1と、命令フェッチサイクルであることを検出するデコ
ーダ2と、現在実行中の命令アドレスに1を加算する加
算器3aと、そのアドレスを保持するラッチ4と、ルー
プ先頭アドレスを保持するループアドレスレジスタ5と
、現在の命令アドレスを、直前の命令アドレスに1を加
算したものおよびループ先頭アドレスと比較して一致を
検出するコンパレータ6b、6aと、トレースメモリへ
の書込みアドレスを保持するラッチ7と、ループ先頭ア
ドレスをトレースメモリに書込んだときのトレースメモ
リアドレスを保持するラッチ8と、トレースメモリアド
レスを通常の命令実行の場合と、ループ先頭への分岐が
起きた場合とで切り換えるセレクタ9と、次のトレース
メモリアドレスを生成するための加算器3bと、ループ
の回数をカウントするループカウンタ11とから構成さ
れている。
This embodiment includes a trace memory 1 that records the states of the data bus and address bus of the target microprocessor, a decoder 2 that detects an instruction fetch cycle, and an adder that adds 1 to the address of the instruction currently being executed. 3a, a latch 4 that holds the address, a loop address register 5 that holds the loop start address, and compares the current instruction address with the previous instruction address plus 1 and the loop start address to find a match. Comparators 6b and 6a to detect, a latch 7 that holds the write address to the trace memory, a latch 8 that holds the trace memory address when the loop start address is written to the trace memory, and a latch 8 that holds the trace memory address when the loop start address is written to the trace memory, and a It consists of a selector 9 that switches between execution and when a branch to the top of the loop occurs, an adder 3b that generates the next trace memory address, and a loop counter 11 that counts the number of loops. There is.

以上の回路により、通常の命令実行では、十レースメモ
リアドレスを+1ずつインクリメントしながら、トレー
スを行い、ループ先頭命令をシーケンシャルに実行した
場合には、その時のトレースメモリアドレスを記憶しく
ラッチ8)、ループ先頭命令へ分岐して来て実行した場
合には、トレースメモリアドレスを、前にループ先頭命
令を格納したトレースメモリアドレス(ラッチ8の内容
)に設定することにより、ループ実行部分は最新の実行
結果のみトレースする機能を実現したものである。
With the above circuit, during normal instruction execution, tracing is performed while incrementing the ten-race memory address by +1, and when the loop top instruction is executed sequentially, the trace memory address at that time is memorized and latched 8). When branching to and executing a loop top instruction, the loop execution part is updated to the latest execution by setting the trace memory address to the trace memory address (contents of latch 8) that previously stored the loop top instruction. This realizes a function that traces only the results.

各回路の機能は以下のとおりである。The functions of each circuit are as follows.

トレースメモリ1は、データ、アドレスおよびループ先
頭に分岐してきたことを示すビットを記憶する。
The trace memory 1 stores data, addresses, and a bit indicating that a branch has been made to the beginning of the loop.

デコーダ2は、命令フェッチサイクルであればFETC
HをLOWにする。
Decoder 2 uses FETC in the instruction fetch cycle.
Set H to LOW.

加算器3a、3bはアドレスに1を加算する。Adders 3a and 3b add 1 to the address.

ラッチ4は、直前の命令フェッチサイクルのアドレス+
1を保持する。
Latch 4 is the address of the previous instruction fetch cycle +
Hold 1.

ループアドレスレジスタ5には、ループ先頭アドレスを
設定しておく。
The loop start address is set in the loop address register 5.

コンパレータ6a、6bは、アドレスの一致を検出する
FETCHにより制御され、命令フェッチサイクルでの
み動作する。
Comparators 6a and 6b are controlled by FETCH, which detects address coincidence, and operate only in instruction fetch cycles.

ラッチ7は、トレースメモリの書込みアドレスを保持す
る。
Latch 7 holds the write address of the trace memory.

ラッチ8は、ループ先頭が実行されたときのトレースメ
モリアドレスを保持する。
Latch 8 holds the trace memory address when the beginning of the loop was executed.

セレクタ9は、通常はラッチ7のアドレスをトレースメ
モリアドレスとして与える。ループ先頭へ分岐してきた
場合は、ラッチ8をセレクトする。
Selector 9 normally provides the address of latch 7 as a trace memory address. When branching to the beginning of the loop, latch 8 is selected.

ループカウンタ11は、ループの実行回数をカウントす
る。
The loop counter 11 counts the number of times a loop is executed.

次に、本実施例の動作を第2図および第3図を用いて具
体的に説明する。
Next, the operation of this embodiment will be specifically explained using FIGS. 2 and 3.

(1)ループ先頭をシーケンシャルに実行した場合ルー
プアドレスレジスタ5に設定されているループ先頭アド
レスNと現在のアドレスとが一致すると比較器6aから
出力される信号HITが一時的にローレベルとなる(す
なわち負パルスが出力される)。また、現在のアドレス
とラッチ4の出力(直前のアドレス+1)とが共にNで
あり、一致しているため、C0NTもローレベルとなっ
て負パルスが出力される。これにより、ナントゲートT
1の出力がローレベルとなってサンプリングパルスがラ
ッチ8に供給され、ループ先頭データを格納したトレー
スメモリのアドレスTがこのラッチ8に保持される。
(1) When the loop start address is executed sequentially When the loop start address N set in the loop address register 5 matches the current address, the signal HIT output from the comparator 6a temporarily becomes low level ( In other words, a negative pulse is output). Further, since the current address and the output of the latch 4 (previous address +1) are both N and match, C0NT also becomes low level and a negative pulse is output. As a result, Nantes Gate T
1 becomes low level, a sampling pulse is supplied to the latch 8, and the address T of the trace memory storing the loop head data is held in the latch 8.

すなわち、ナントゲートT2の出力はハイレベル(“l
”)であるため、セレクタの出力YはAfliJ子の入
力(ラッチ7の出力T)に等しくこのラッチ7の出力T
がトレースメモリへの書込みアドレスとなり、一方で、
このアドレスTが後のループ実行に備えてラッチ8に保
持される。
That is, the output of the Nant gate T2 is at a high level (“l
”), the output Y of the selector is equal to the input of the AfliJ child (output T of latch 7), and the output T of this latch 7 is
becomes the write address to the trace memory, and on the other hand,
This address T is held in latch 8 in preparation for later loop execution.

(2)ループ先頭に分岐してきた場合 この場合、ループ先頭アドレス(現在のアドレス)Nと
ラッチ4の出力アドレスM+1とが一致しないためC0
NTはハイレベルを維持する。これにより、ナントゲー
トT2の出力がローレベル(”O” )となってセレク
タ9はラッチ8の出力アドレスを選択する。すなわち、
ラッチ8の内容Tがトレースメモリの書込みアドレスと
なり、ラッチ7にT+lをロードして、以下シーケンシ
ャルに実行した場合と同じアドレスにデータがオーバー
ライドされる。
(2) When branching to the beginning of the loop In this case, the loop beginning address (current address) N does not match the output address M+1 of latch 4, so C0
NT maintains a high level. As a result, the output of the Nant gate T2 becomes low level ("O"), and the selector 9 selects the output address of the latch 8. That is,
The content T of the latch 8 becomes the write address of the trace memory, T+l is loaded into the latch 7, and the data is overwritten to the same address as in the case of sequential execution.

第4図(a)、  (b)は本実施例のトレース動作の
一例を示す図である。
FIGS. 4(a) and 4(b) are diagrams showing an example of the tracing operation of this embodiment.

同図(a)のようなプロセッサ動作が行なわれる場合、
ループが実行される部分B、 Dは、最新のループ実行
結果のみがトレースメモリに残り、それ以前の−ものは
オーバーライドされる(同図(b))。
When the processor operates as shown in (a) of the same figure,
In portions B and D where the loop is executed, only the latest loop execution result remains in the trace memory, and the previous results are overwritten (FIG. 2(b)).

この場合、ループカウンタ11は、トレース終了後、ル
ープDのループ実行回数を保持している。
In this case, the loop counter 11 holds the number of loop executions of loop D after the trace ends.

また、ループB、 Dの先頭では、ループ先頭への分岐
があったことを示すビットがオンになっている。
Furthermore, at the beginning of loops B and D, a bit indicating that there is a branch to the beginning of the loop is turned on.

以上、本発明を実施例を用いて説明したが、木発明はこ
れに限定されるものでなく、種々、変形、応用が可能で
ある。例えば、ループアドレスレジスタを含む検出回路
を複数設け、多重ループおよび複数シーケンシャルルー
プにも対応可能とすることもできる。
Although the present invention has been described above using examples, the wooden invention is not limited thereto, and various modifications and applications are possible. For example, multiple detection circuits including loop address registers may be provided to support multiple loops and multiple sequential loops.

また、本発明はインサーキットエミュレータのトレース
回路だけではなく、例えば、マイクロプログラムのトレ
ース回路等にも利用できる。
Further, the present invention can be used not only for trace circuits of in-circuit emulators but also for example, trace circuits for microprograms.

(発明の効果) 以上説明したように本発明は、トレース中に、あらかじ
め登録しておいたループがあると、これをリアルタイム
に検出して、ループの実行部分が重複してトレースメモ
リに記録されないようにすることにより、メモリを有効
に利用するトレース機能を実現できる効果がある。
(Effects of the Invention) As explained above, the present invention detects in real time if there is a loop registered in advance during tracing, and prevents the loop execution portion from being duplicated and recorded in the trace memory. By doing so, it is possible to realize a trace function that makes effective use of memory.

これにより、従来のトレース機能ではとらえられなかっ
た現象も、トレースメモリの容量を増大させることなく
トレースすることがIIJ能となる。
This makes it possible to trace phenomena that could not be captured by conventional trace functions without increasing the capacity of the trace memory.

【図面の簡単な説明】[Brief explanation of drawings]

第1図は本発明のトレース回路の一実施例のブロック図
、 第2図はループ先頭をシーケンシャルに実行した場合の
動作を説明するためのタイミングチャート、 第3図はループ先頭に分岐してきた場合の動作を説明す
るためのタイミングチャート、第4図(a)、  (b
)は第1図の実施例のトレース動作の一例を示す図であ
り、(a)はターゲットプロセッサの動作、(b)はト
レースメモリの内容を示す図であり、 第5図(a)、  (b)は従来例のトレース動作の一
例を示す図である。 1・・・トレースメモリ  2・・・デコーダ3a、3
b・・・1加算器 4・・・ラッチ5・・・ループアド
レスレジスタ
Fig. 1 is a block diagram of an embodiment of the trace circuit of the present invention, Fig. 2 is a timing chart for explaining the operation when the beginning of a loop is executed sequentially, and Fig. 3 is a case where a branch is made to the beginning of the loop. Timing charts for explaining the operation of FIGS. 4(a) and 4(b)
) is a diagram showing an example of the trace operation of the embodiment of FIG. 1, (a) is a diagram showing the operation of the target processor, (b) is a diagram showing the contents of the trace memory, and ( b) is a diagram showing an example of a conventional tracing operation. 1...Trace memory 2...Decoder 3a, 3
b...1 adder 4...latch 5...loop address register

Claims (1)

【特許請求の範囲】 ターゲットシステムにプログラムを実行させ、該ターゲ
ットシステムのバスアクセスをモニターしながらデータ
バスおよびアドレスバスの状態をトレースメモリに記録
するトレース回路において、トレース開始から終了に至
るまでに実行されるループの先頭アドレスを記憶してい
るループアドレスレジスタ(5)と、 該ループアドレスレジスタ(5)の記憶しているループ
先頭アドレスと、ターゲットシステムのアドレスバスの
現在のアドレスとの一致を検出する比較器(6a)と、 該比較器(6a)により一致が検出された場合に、該現
在のアドレスの前記トレースメモリへの書込みアドレス
を保持する記憶回路(8)と、前記比較器(6a)によ
り一致が検出された場合に前記現在のアドレスが直前の
アドレスに連続するアドレスであるか、あるいは不連続
なアドレスであるかを検出する比較器(6b)と、 該比較器(6b)により現在のアドレスと直前のアドレ
スとが不連続であることが検出された場合、前記記憶回
路が保持しているアドレスを前記トレースメモリへの書
込みアドレスとして選択するセレクタ(9)とを有する
ことを特徴とするトレース回路。
[Scope of Claim] A trace circuit that causes a target system to execute a program and records the states of a data bus and an address bus in a trace memory while monitoring bus accesses of the target system. The loop address register (5) that stores the start address of the loop to be processed matches the loop start address stored in the loop address register (5) and the current address of the address bus of the target system. a comparator (6a) that stores the current address in the trace memory when a match is detected by the comparator (6a); ), the comparator (6b) detects whether the current address is a contiguous address to the previous address or a discontinuous address when a match is detected by the comparator (6b); and a selector (9) that selects an address held by the storage circuit as a write address to the trace memory when it is detected that the current address and the previous address are discontinuous. trace circuit.
JP1252598A 1989-09-28 1989-09-28 Trace circuit Expired - Lifetime JPH0748183B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1252598A JPH0748183B2 (en) 1989-09-28 1989-09-28 Trace circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1252598A JPH0748183B2 (en) 1989-09-28 1989-09-28 Trace circuit

Publications (2)

Publication Number Publication Date
JPH03113646A true JPH03113646A (en) 1991-05-15
JPH0748183B2 JPH0748183B2 (en) 1995-05-24

Family

ID=17239598

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1252598A Expired - Lifetime JPH0748183B2 (en) 1989-09-28 1989-09-28 Trace circuit

Country Status (1)

Country Link
JP (1) JPH0748183B2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100407548B1 (en) * 2000-11-27 2003-11-28 미쓰비시덴키 가부시키가이샤 Trace control circuit
US7155570B1 (en) 2000-09-29 2006-12-26 Intel Corporation FIFO write/LIFO read trace buffer with software and hardware loop compression
JP2012098979A (en) * 2010-11-04 2012-05-24 Fujitsu Semiconductor Ltd Trace compression device and trace compression program
JP2019509575A (en) * 2016-03-23 2019-04-04 エイアールエム リミテッド Program loop control

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7155570B1 (en) 2000-09-29 2006-12-26 Intel Corporation FIFO write/LIFO read trace buffer with software and hardware loop compression
KR100407548B1 (en) * 2000-11-27 2003-11-28 미쓰비시덴키 가부시키가이샤 Trace control circuit
JP2012098979A (en) * 2010-11-04 2012-05-24 Fujitsu Semiconductor Ltd Trace compression device and trace compression program
JP2019509575A (en) * 2016-03-23 2019-04-04 エイアールエム リミテッド Program loop control

Also Published As

Publication number Publication date
JPH0748183B2 (en) 1995-05-24

Similar Documents

Publication Publication Date Title
JPH03204737A (en) Debug circuit of signal processing processor
JPH03113646A (en) Trace circuit
JPH02127731A (en) Bypass check system for arithmetic register
JP2001005689A (en) Trace sampling circuit
JPH0475147A (en) Time monitoring device in information processing system
JPH0261731A (en) Microprocessor
JPH06103110A (en) Breakpoint setting system
JPS626341A (en) Information processor
JPH04167146A (en) Address tracing system for information processor
JPH04328644A (en) Debug back-up device
JPH04310138A (en) Debugging method for data transmitter
JPH04195552A (en) Address tracer
JPH07281924A (en) Trace device and emulator using the trace device
JPS6385940A (en) Testing system for information processor
JPH04242455A (en) Inter-processor communication trace circuit
JPH09319592A (en) Microcomputer
JPS63639A (en) Program debugging system
JPH03194625A (en) Address tracing system for information processor
JPH02103642A (en) History information storing system
JPH0362233A (en) Address match timing tracing mechanism
JPS5960657A (en) Device for analyzing execution bus
JPS5968067A (en) Specifying system for number of run steps
JPS6222153A (en) Method and apparatus for analyzing operation of microprocessor
JPS6168648A (en) Method for storing branch trace address
JPS6240550A (en) Program debug device