JPH0895945A - Microprocessor with built-in trace memory and trace method - Google Patents

Microprocessor with built-in trace memory and trace method

Info

Publication number
JPH0895945A
JPH0895945A JP6229888A JP22988894A JPH0895945A JP H0895945 A JPH0895945 A JP H0895945A JP 6229888 A JP6229888 A JP 6229888A JP 22988894 A JP22988894 A JP 22988894A JP H0895945 A JPH0895945 A JP H0895945A
Authority
JP
Japan
Prior art keywords
instruction
address
trace
output
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
JP6229888A
Other languages
Japanese (ja)
Other versions
JP2666737B2 (en
Inventor
Masayuki Daito
正行 大東
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.)
NEC Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP6229888A priority Critical patent/JP2666737B2/en
Publication of JPH0895945A publication Critical patent/JPH0895945A/en
Application granted granted Critical
Publication of JP2666737B2 publication Critical patent/JP2666737B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Abstract

PURPOSE: To provide a microprocessor with built-in trace memory and a trace method by which instruction trace can be realized without impairing real-time processing by reducing the memory capacity of a circuit for instruction trace inside the microprocessor. CONSTITUTION: This microprocessor 101 for performing pipeline processing is incorporated with a cache memory 803 and provided with an incorporated register 811, an execution resources 812, an interruption receiving means 809, an instruction counter 802, an instruction decode means 810, an external input/ output means 804 and a trace memory 126. The microprocessor is provided with a first securing means 128, a second securing means 808, a first selecting means 117 and an external output means 127, and the trace memory 126 stores an output 118 of the first selecting means 117. Besides, the microprocessor is provided with a second selecting means 109, and the output 822 of the second selecting means 109 is connected to the write terminal of the incorporated register 811.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】マイクロプロセッサに関し、特に
キャッシュメモリを内蔵してパイプライン処理を行うト
レースメモリ内蔵マイクロプロセッサおよびトレース方
法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microprocessor, and more particularly to a trace memory built-in microprocessor and a tracing method that include a cache memory and perform pipeline processing.

【0002】[0002]

【従来の技術】ボードシステムでの不具合発生時の有効
なデバグ手段としては、マイクロプロセッサがボード上
でどのような順序でプログラムを実行したかを調査して
不具合の原因を究明する命令トレースがある。
2. Description of the Related Art As an effective debugging means when a failure occurs in a board system, there is an instruction trace for investigating the order in which a microprocessor executes a program on a board to determine the cause of the failure. .

【0003】図6は従来例の命令トレースを実現するマ
イクロプロセッサの構成を示す図である。図6を用いて
従来のマイクロプロセッサについて説明する。ボードシ
ステム912上にマイクロプロセッサ801が実装され
ており、マイクロプロセッサ801は外部との接続手段
として、アドレス端子815とデータ端子816と命令
フェッチ端子817と割り込み入力端子820とを有し
ている。また、アドレス端子815およびデータ端子8
16には、ボードシステム912上でアドレスバス90
1およびデータバス902が接続されている。
FIG. 6 is a diagram showing a structure of a microprocessor for realizing a conventional instruction trace. A conventional microprocessor will be described with reference to FIG. A microprocessor 801 is mounted on the board system 912, and the microprocessor 801 has an address terminal 815, a data terminal 816, an instruction fetch terminal 817, and an interrupt input terminal 820 as means for connecting to the outside. Further, the address terminal 815 and the data terminal 8
16 includes an address bus 90 on the board system 912.
1 and the data bus 902 are connected.

【0004】マイクロプロセッサ801の命令トレース
を実現するために、ボードシステム912にはインサー
キットエミュレータ(以下、ICEと記述する)906
と呼ばれる外部回路が接続されている。実際にはボード
システム912上のアドレスバス901、データバス9
02、および命令フェッチ端子817に、それぞれアド
レスバス接続手段909、データバス接続手段908、
および命令フェッチ信号接続手段910が接続されてい
る。
In order to realize the instruction trace of the microprocessor 801, an in-circuit emulator (hereinafter referred to as ICE) 906 is provided in the board system 912.
An external circuit called is connected. Actually, the address bus 901 and the data bus 9 on the board system 912
02 and the instruction fetch terminal 817 to the address bus connecting means 909, the data bus connecting means 908,
And the instruction fetch signal connection means 910 is connected.

【0005】割り込み入力端子820から入力される割
り込み信号は割り込み受け付け手段809に入力され、
割り込み受け付け手段809から出力される割り込み分
岐アドレスは割り込み分岐アドレスバス821を介して
次命令アドレスレジスタ818に入力される。
[0005] The interrupt signal input from the interrupt input terminal 820 is input to the interrupt receiving means 809,
The interrupt branch address output from the interrupt accepting unit 809 is input to the next instruction address register 818 via the interrupt branch address bus 821.

【0006】次命令アドレスレジスタ818の出力はア
ドレスインクリメンタ802、キャッシュメモリ80
3、および命令アドレスレジスタ805に入力される。
アドレスインクリメンタ802の出力は再度、次命令ア
ドレスレジスタ818に入力される。
The output of the next instruction address register 818 is the address incrementer 802 and the cache memory 80.
3, and input to the instruction address register 805.
The output of the address incrementer 802 is input to the next instruction address register 818 again.

【0007】次命令アドレスレジスタ818の出力は命
令フェッチを行うと同時に命令アドレスレジスタ805
に格納され、命令アドレスレジスタ805の出力は命令
アドレスレジスタ806に入力され、命令アドレスレジ
スタ806の出力は命令アドレスレジスタ807に入力
され、命令アドレスレジスタ807の出力は命令アドレ
スレジスタ808に入力されて格納される。
The output of the next instruction address register 818 outputs the instruction address register 805 at the same time as performing the instruction fetch.
The output of the instruction address register 805 is input to the instruction address register 806, the output of the instruction address register 806 is input to the instruction address register 807, and the output of the instruction address register 807 is input to and stored in the instruction address register 808. To be done.

【0008】キャッシュメモリ803には次命令アドレ
スレジスタ818の出力が入力され、キャッシュメモリ
803は外部入出力手段804に接続されている。外部
入出力手段804は外部のアドレス端子815、外部の
データ端子816、および命令フェッチ端子817に接
続されている。キャッシュメモリ803から出力される
命令は、命令バス819を介して命令デコーダ810に
入力される。
The output of the next instruction address register 818 is input to the cache memory 803, and the cache memory 803 is connected to the external input / output unit 804. The external input / output unit 804 is connected to the external address terminal 815, the external data terminal 816, and the instruction fetch terminal 817. The instruction output from the cache memory 803 is input to the instruction decoder 810 via the instruction bus 819.

【0009】命令デコーダ810の出力は内蔵レジスタ
811および実行資源812に入力され、内蔵レジスタ
811の出力は実行資源812に入力される。
The output of the instruction decoder 810 is input to a built-in register 811 and an execution resource 812, and the output of the built-in register 811 is input to an execution resource 812.

【0010】実行資源812は、ロジカル演算器、数値
演算器、実効アドレス生成器等を含み、命令デコーダ8
10から出力される信号によって動作する。実行資源8
12から出力されるメモリアクセスアドレスは結果レジ
スタ813および次命令アドレスレジスタ818に入力
され、またメモリアクセスアドレスバス823を介して
外部入出力手段804に入力される。結果レジスタ81
3から出力されるメモリアクセスデータは結果レジスタ
814に入力され、またメモリアクセスデータバス82
4を介して外部入出力手段804に入力される。結果レ
ジスタ814の出力は結果書き込みバス822を介して
適切なタイミングで内蔵レジスタ811に書き戻され
る。
The execution resource 812 includes a logical arithmetic unit, a numerical arithmetic unit, an effective address generator, etc., and the instruction decoder 8
It operates by the signal output from 10. Execution resource 8
The memory access address output from 12 is input to the result register 813 and the next instruction address register 818, and is also input to the external input / output means 804 via the memory access address bus 823. Result register 81
3 is input to the result register 814, and the memory access data bus 82
4 to the external input / output means 804. The output of the result register 814 is written back to the internal register 811 at an appropriate timing via the result write bus 822.

【0011】ボードシステム912上に実装されている
マイクロプロセッサ801が命令を実行する手順を説明
する。初めに、外部入出力手段804を経由して、実行
しようとする命令の格納されているアドレスをアドレス
端子815からアドレスバス901に出力すると同時
に、命令フェッチ信号をアクティブにして命令フェッチ
端子817に出力する。その後、アドレス端子815か
ら出力されたアドレスに対応する命令をデータバス90
2を介してデータ端子816から入力し、外部入出力手
段804およびキャッシュメモリ803を経由して、内
部の命令バス819を介して命令デコーダ810に格納
する。そして、命令デコーダ810から出力される信号
が内蔵レジスタ811および実行資源812に入力さ
れ、内蔵レジスタ811の内容が読み出しポートから読
み出されて実行資源812に入力される。このようにし
て、命令デコーダ810から読み出された信号は内蔵レ
ジスタ811を経由して実行資源812に入力される。
A procedure in which the microprocessor 801 mounted on the board system 912 executes an instruction will be described. First, the address in which the instruction to be executed is stored is output from the address terminal 815 to the address bus 901 via the external input / output unit 804, and at the same time, the instruction fetch signal is activated and output to the instruction fetch terminal 817. To do. After that, an instruction corresponding to the address output from the address terminal 815 is issued to the data bus 90.
The data is input from the data terminal 816 via 2 and stored in the instruction decoder 810 via the internal input / output unit 804 and the cache memory 803 and the internal instruction bus 819. Then, a signal output from the instruction decoder 810 is input to the built-in register 811 and the execution resource 812, and the content of the built-in register 811 is read from the read port and input to the execution resource 812. In this way, the signal read from the instruction decoder 810 is input to the execution resource 812 via the internal register 811.

【0012】実行資源812が命令デコーダ810から
出力される信号によって動作した後、または動作すると
同時に、アドレスインクリメンタ802によって計算さ
れた次の命令アドレスが次命令アドレスレジスタ818
に格納され、次命令アドレスレジスタ818の出力がキ
ャッシュメモリ803を経由して外部入出力手段804
に入力される。外部入出力手段804はアドレス端子8
15から次命令アドレスを出力すると同時に命令フェッ
チ信号をアクティブにして命令フェッチ端子817に出
力する。
After or simultaneously with the execution resource 812 operating according to the signal output from the instruction decoder 810, the next instruction address calculated by the address incrementer 802 is stored in the next instruction address register 818.
And the output of the next instruction address register 818 is stored in the external input / output unit 804 via the cache memory 803.
Entered in. The external input / output means 804 has the address terminal 8
The instruction fetch signal is activated at the same time as outputting the next instruction address from No. 15 and output to the instruction fetch terminal 817.

【0013】分岐命令実行時の動作を説明する。命令デ
コーダ810において分岐命令と判断された場合、実行
資源812において計算された分岐先アドレスがメモリ
アクセスアドレスバス823を介して次命令アドレスレ
ジスタ818に格納され、キャッシュメモリ803を経
由して外部入出力手段804からアドレス端子815に
出力される。
The operation when the branch instruction is executed will be described. When the instruction decoder 810 determines that the branch instruction is a branch instruction, the branch destination address calculated by the execution resource 812 is stored in the next instruction address register 818 via the memory access address bus 823, and external input / output via the cache memory 803. It is output from the means 804 to the address terminal 815.

【0014】割り込み実行時の動作を説明する。外部の
割り込み入力端子820から入力された割り込み信号は
割り込み受け付け手段809に入力され、割り込みの種
類および受け付け可能な割り込みかどうかを判断する。
受け付け可能な割り込みであれば、その割り込みの種類
に応じた割り込みエントリアドレスが割り込み分岐アド
レスバス821およびメモリアクセスアドレスバス82
3を介して次命令アドレスレジスタ818に入力され、
次命令アドレスレジスタ818およびキャッシュメモリ
803を経由して、外部入出力手段804からアドレス
端子815に出力される。
The operation at the time of executing an interrupt will be described. The interrupt signal input from the external interrupt input terminal 820 is input to the interrupt receiving unit 809, and determines the type of interrupt and whether the interrupt is an acceptable interrupt.
If the interrupt can be accepted, an interrupt entry address corresponding to the type of the interrupt is stored in the interrupt branch address bus 821 and the memory access address bus 82.
3 to the next instruction address register 818,
The data is output from the external input / output unit 804 to the address terminal 815 via the next instruction address register 818 and the cache memory 803.

【0015】命令トレースを開始すると、ICE906
に内蔵されているICE取り込み手段903は、命令フ
ェッチ端子817から出力された命令フェッチ信号がア
クティブのときのアドレスバス901の内容をアドレス
バス接続手段909を経由して取り込み、ICEトレー
スメモリ904に格納する。
When instruction tracing is started, ICE 906
The ICE fetching means 903 incorporated in the CPU fetches the content of the address bus 901 when the instruction fetch signal output from the instruction fetch terminal 817 is active via the address bus connecting means 909 and stores it in the ICE trace memory 904. To do.

【0016】トレース結果907を参照する場合には、
ICE906に内蔵されているスーパバイザマイクロプ
ロセッサ905によってICEトレースメモリ904の
内容を参照し、出力手段911を介してトレース結果9
07を得る。
When referring to the trace result 907,
The contents of the ICE trace memory 904 are referred to by the supervisor microprocessor 905 incorporated in the ICE 906, and the trace result 9 is output via the output means 911.
I get 07.

【0017】また例えばある命令を実行してから100
クロック後に実行している命令等を検索する場合にも、
スーパバイザマイクロプロセッサ905がICEトレー
スメモリ904の内容を参照しながら実行する。
Also, for example, after executing a certain instruction, 100
When searching for an instruction executed after the clock,
The supervisor microprocessor 905 executes while referring to the contents of the ICE trace memory 904.

【0018】[0018]

【発明が解決しようとする課題】従来のマイクロプロセ
ッサ801の端子に外部回路を付加する場合、以下の2
つの問題点がある。
When an external circuit is added to the terminal of the conventional microprocessor 801, the following two methods are required.
There are two problems.

【0019】(1)データバス接続手段908、アドレ
スバス接続手段909、および命令フェッチ信号接続手
段910を用いてマイクロプロセッサ801のデータ端
子8116、アドレス端子815、および命令フェッチ
端子817から出力された値をICE906が取り込む
ので、それらの端子の電気的特性が悪くなる。このた
め、ICE906を付加しない状態では正常に動作する
ボードシステム912であっても、ICE906をこれ
らの接続手段を通じて接続することによって正常動作し
なくなるという問題点がある。
(1) Values output from the data terminal 8116, the address terminal 815, and the instruction fetch terminal 817 of the microprocessor 801 by using the data bus connecting means 908, the address bus connecting means 909, and the instruction fetch signal connecting means 910. Are taken in by the ICE 906, the electrical characteristics of those terminals deteriorate. Therefore, there is a problem that even the board system 912 that operates normally without the ICE 906 added does not operate normally by connecting the ICE 906 through these connecting means.

【0020】(1)の問題点について説明する。近年マ
イクロプロセッサ801の動作速度が向上するにしたが
って、マイクロプロセッサ801が搭載されたボードシ
ステム912の動作周波数も向上してきた。このため近
年のボードシステムは、高い動作速度を実現するために
一切の余裕を省いた設計を行うことが多い。
The problem (1) will be described. As the operating speed of the microprocessor 801 has increased in recent years, the operating frequency of the board system 912 in which the microprocessor 801 is mounted has also improved. For this reason, board systems in recent years are often designed without any margin in order to realize a high operation speed.

【0021】ICE906はマイクロプロセッサ801
の各出力端子に接続手段を用いて接続されている。この
ためマイクロプロセッサ801の各出力端子は、ボード
上に設置されている各種資源以外にデータバス接続手段
908、アドレスバス接続手段909、および命令フェ
ッチ信号接続手段910にも信号を伝達しなければなら
ない。したがって、ICE906を接続していないとき
と比較すると、ICE906を接続したときのボード上
の電気的特性に余裕がなくなる。
The ICE 906 is a microprocessor 801
Are connected to the respective output terminals using connection means. Therefore, each output terminal of the microprocessor 801 must transmit signals to the data bus connecting unit 908, the address bus connecting unit 909, and the instruction fetch signal connecting unit 910 in addition to the various resources installed on the board. . Therefore, compared to the case where the ICE 906 is not connected, there is no room for the electrical characteristics on the board when the ICE 906 is connected.

【0022】従来であれば、ICE906を接続してい
るときと接続していないときの電気的特性の違いはボー
ドシステムの動作周波数に比べて非常に微々たるもので
あったので、問題にはならなかった。しかし、近年ボー
ドシステム912自体の動作周波数が向上するにつれ、
この微々たる電気的特性の差異のために、ボードシステ
ム912にマイクロプロセッサ801を直接実装した状
態では動作するがマイクロプロセッサ801とボードシ
ステム912との間にICE906が介入するだけで動
作が不安定になる事例が多数存在する。さらに、動作不
安定だけでなく動作不良を引き起こすことも少なくな
い。
In the prior art, the difference in electrical characteristics between when the ICE 906 was connected and when it was not connected was very small compared to the operating frequency of the board system, so no problem occurred. There wasn't. However, as the operating frequency of the board system 912 itself has improved in recent years,
Due to this slight difference in the electrical characteristics, the board system 912 operates in a state where the microprocessor 801 is directly mounted, but the operation becomes unstable only when the ICE 906 intervenes between the microprocessor 801 and the board system 912. There are many cases where In addition to unstable operation, it often causes defective operation.

【0023】(2)キャッシュメモリ803を内蔵して
いるマイクロプロセッサ801の場合、キャッシュメモ
リ803に格納されているアドレスへの分岐は外部アド
レス信号を駆動しないので、外部信号から内部の命令実
行順序を推測することが困難となるという問題点があ
る。
(2) In the case of the microprocessor 801 incorporating the cache memory 803, the branch to the address stored in the cache memory 803 does not drive the external address signal. There is a problem that it is difficult to guess.

【0024】(2)の問題点について説明する。近年の
マイクロプロセッサ801は高速処理を実現するために
キャッシュメモリ803を内蔵してパイプライン処理を
行っている。通常ICE906では、マイクロプロセッ
サ801の命令フェッチ端子817から出力される命令
フェッチ信号によってICE906内部のICEトレー
スメモリ904にインストラクションフェッチアドレス
を保存し、ICE906内部のスーパバイザマイクロプ
ロセッサ905がICEトレースメモリ904の内容を
参照しながらマイクロプロセッサ801が取り込んだ命
令の種類を判定して、命令実行のトレースを実現してい
る。
The problem (2) will be described. The microprocessor 801 in recent years has a built-in cache memory 803 and performs pipeline processing in order to realize high-speed processing. In the normal ICE 906, the instruction fetch address output from the instruction fetch terminal 817 of the microprocessor 801 stores the instruction fetch address in the ICE trace memory 904 inside the ICE 906, and the supervisor microprocessor 905 inside the ICE 906 stores the contents of the ICE trace memory 904. The type of the instruction fetched by the microprocessor 801 is determined while referring to the instruction execution trace.

【0025】まずパイプライン処理を行うマイクロプロ
セッサ801の問題点を述べる。パイプライン処理を行
うマイクロプロセッサ801の場合、命令要求アドレス
と実際に実行している命令のアドレスが異なる。このた
め、命令順序を変化させる分岐命令等が要求された場合
には、この分岐命令が実行されるまでの間にマイクロプ
ロセッサ801がフェッチし続けた命令は、マイクロプ
ロセッサ801に取り込まれるが分岐によって実行され
ない。従来のマイクロプロセッサでは、このような実行
されなかった命令に関する命令フェッチの経過もICE
トレースメモリ904に格納されてしまう。このため、
ICE906内部のスーパバイザマイクロプロセッサ9
05によって、実行されなかった命令を省く等の処理を
施してトレースを実現していた。しかし、分岐命令の種
類や分岐命令を実行するときのマイクロプロセッサ80
1の状態によって省くべき命令の数が異なることがある
ので、正確なトレースは困難であった。
First, the problems of the microprocessor 801 which performs pipeline processing will be described. In the case of the microprocessor 801 that performs pipeline processing, the instruction request address differs from the address of the instruction that is actually being executed. Therefore, when a branch instruction or the like that changes the instruction order is requested, the instruction that has been fetched by the microprocessor 801 until the execution of the branch instruction is taken into the microprocessor 801. Not executed. In the conventional microprocessor, the progress of instruction fetch for such an unexecuted instruction is
It is stored in the trace memory 904. For this reason,
Supervisor microprocessor 9 inside ICE906
In 05, a trace is realized by performing processing such as omitting an unexecuted instruction. However, the type of branch instruction and the microprocessor 80 when executing the branch instruction
Accurate tracing has been difficult because the number of instructions to be omitted may vary depending on the state of 1.

【0026】次にキャッシュメモリ803を内蔵してい
るマイクロプロセッサ801が実行する命令をトレース
するときの問題点を述べる。キャッシュメモリ内蔵マイ
クロプロセッサは、命令フェッチ時に以下の動作をす
る。次命令アドレスレジスタ818の出力がキャッシュ
メモリ803に入力され、キャッシュメモリ803にお
いてミスヒットした(必要とするアドレスの内容がキャ
ッシュメモリ803内部になかった)場合、キャッシュ
メモリ803から外部入出力手段804に対して次命令
アドレスが伝達され、外部入出力手段804が外部に対
してアクセスを開始する。一方、キャッシュメモリ80
3においてヒットした(必要とするアドレスの内容がキ
ャッシュメモリ803内部に格納されていた)場合、キ
ャッシュメモリ803から命令を取り込み、外部入出力
手段804を動作させない。
Next, a problem in tracing an instruction executed by the microprocessor 801 incorporating the cache memory 803 will be described. The microprocessor with a cache memory operates as follows when fetching an instruction. When the output of the next instruction address register 818 is input to the cache memory 803 and there is a mishit in the cache memory 803 (the content of the required address is not inside the cache memory 803), the cache memory 803 outputs to the external input / output unit 804. On the other hand, the next instruction address is transmitted, and the external input / output unit 804 starts access to the outside. On the other hand, the cache memory 80
3 is hit (the content of the required address is stored in the cache memory 803), the instruction is fetched from the cache memory 803 and the external input / output unit 804 is not operated.

【0027】このようにキャッシュメモリ803におい
てヒットした場合には、外部入出力手段804は命令ア
ドレスを出力せず、命令フェッチ信号をもアクティブに
しない。このため、アドレスバス901には実行しよう
とする命令のアドレスが出力されず、ICEトレースメ
モリ904にトレースデータを取り込むことができず、
どのように命令を実行しているかを解析することがまっ
たくできない。したがって、正確な命令のトレースが実
現できない。
When a hit occurs in the cache memory 803, the external input / output means 804 does not output an instruction address and does not activate an instruction fetch signal. Therefore, the address of the instruction to be executed is not output to the address bus 901, and the trace data cannot be captured in the ICE trace memory 904.
There is no way to analyze how instructions are being executed. Therefore, accurate instruction tracing cannot be realized.

【0028】このような理由によって従来は、トレース
を行うときにはキャッシュメモリ803を使用禁止に
し、またマイクロプロセッサ801に1命令を処理する
たびに割り込みを入力することで実質的にパイプライン
動作をさせなくして、トレースを実施していた。この方
法でトレースを行う場合には、実際のアプリケーション
動作時との処理スピードと比較して10倍以上も遅い。
このため、組込制御等の実時間処理を必要とする分野に
おいては、実際の動作速度を実現したままトレースを実
現することが重要な課題となってきている。
For these reasons, conventionally, when tracing is performed, use of the cache memory 803 is prohibited, and an interrupt is input to the microprocessor 801 each time one instruction is processed, thereby substantially preventing the pipeline operation. Had been tracing. When tracing is performed by this method, the processing speed is at least 10 times slower than the processing speed at the time of actual application operation.
Therefore, in a field requiring real-time processing such as built-in control, it has become an important issue to realize the trace while realizing the actual operation speed.

【0029】上記の問題を解決するための方法として、
特開平4−44125号公報に記載のマイクロプロセッ
サの発明(以下、公報1の発明と記述する)や実開平4
−40339号公報に記載のマイクロプロセッサの考案
(以下、公報2の考案と記述する)がある。
As a method for solving the above problem,
The invention of the microprocessor described in Japanese Unexamined Patent Publication No. 4-44125 (hereinafter, referred to as the invention of Japanese Patent Laid-Open No. 4-12525) and the actual invention
There is a device of a microprocessor described in Japanese Patent Publication No.-40339 (hereinafter, referred to as a device of Publication 2).

【0030】公報1の発明は、マイクロプロセッサが分
岐命令等の命令を実行したとき、外部端子に分岐先アド
レスと分岐元アドレスを出力するものである。このよう
に命令順序を変化させる分岐命令等が要求されたとき
に、インストラクションフェッチ等以外の方法で外部に
分岐先アドレスを出力することによって、マイクロプロ
セッサ外部に接続されているICEに分岐の発生と分岐
先のアドレスを通達することができる。しかし依然外部
にICEを接続しなければ命令トレースは実現できず、
上記(1)の問題点が存在し、高速なボード上での命令
トレースは実現できない。また、キャッシュメモリを内
蔵しているマイクロプロセッサの命令トレースも困難で
ある。
[0030] The invention of Publication 1 is to output a branch destination address and a branch source address to external terminals when a microprocessor executes an instruction such as a branch instruction. When a branch instruction or the like for changing the instruction order is requested in this way, the branch destination address is output to the outside by a method other than the instruction fetch or the like, so that the occurrence of the branch in the ICE connected to the outside of the microprocessor is detected. The address of the branch destination can be communicated. However, instruction trace cannot be realized without connecting ICE to the outside,
Due to the problem (1), instruction tracing on a high-speed board cannot be realized. Also, it is difficult to trace an instruction of a microprocessor having a built-in cache memory.

【0031】公報2の考案は小規模のトレースメモリを
マイクロプロセッサの内部に持つことによってマイクロ
プロセッサの実行命令列を記憶しておき、トレースを実
行するときには、そのトレースメモリの内容をマイクロ
プロセッサ外部のメモリに出力する等の手段によって命
令トレースを実現する。しかしこの方法では、以下の問
題が存在する。
The device disclosed in Japanese Unexamined Patent Publication (Kokai) No. 2 has a small-scale trace memory inside the microprocessor to store a sequence of instructions to be executed by the microprocessor. When a trace is executed, the contents of the trace memory are stored outside the microprocessor. Instruction tracing is realized by means such as outputting to a memory. However, this method has the following problems.

【0032】(A)大容量のトレースメモリはマイクロ
プロセッサに内蔵することができないので、長時間の命
令トレースができない。
(A) Since a large-capacity trace memory cannot be built in the microprocessor, it is impossible to trace instructions for a long time.

【0033】(B)分岐命令以外にはマイクロプロセッ
サの実行順序を変更する命令の命令トレースができな
い。
(B) Instruction tracing of instructions for changing the execution order of the microprocessor other than branch instructions cannot be performed.

【0034】(C)トレースメモリの内容を外部データ
バスを経由しなければ取り出せないので、命令トレース
結果はボード上のメモリ等に格納しなければならず、ボ
ード等の動作の正常性を検証するための命令トレースで
あるにもかかわらず、ボード上のメモリの動作保証を必
要とする。ボード上のメモリを使用しない場合には、ボ
ード上のデータバスおよびアドレスバスにトレース用の
メモリを別途接続する必要があり、マイクロプロセッサ
のデータバス、アドレスバスの電気的特性が劣化する。
(C) Since the contents of the trace memory cannot be taken out without passing through an external data bus, the result of the instruction trace must be stored in a memory or the like on the board, and the normal operation of the board or the like is verified. Despite the instruction trace, the operation of the memory on the board needs to be guaranteed. When the memory on the board is not used, it is necessary to separately connect a memory for tracing to the data bus and the address bus on the board, and the electrical characteristics of the data bus and address bus of the microprocessor deteriorate.

【0035】(A)の問題点を解決するために、分岐命
令の実行時に分岐先アドレスと分岐元アドレスのみをト
レースメモリに保存する手法もある。この手法を使用す
ると、少量のトレースメモリで多くのトレースメモリと
同様の効果を得られる。しかし、1つの分岐命令に対し
て2種類のアドレスを保存するので、2ワード分のトレ
ースメモリを使用するという欠点がある。
In order to solve the problem (A), there is also a method of saving only the branch destination address and the branch source address in the trace memory when the branch instruction is executed. Using this method, a small amount of trace memory can achieve the same effect as many trace memories. However, since two types of addresses are stored for one branch instruction, there is a disadvantage in that a trace memory for two words is used.

【0036】この欠点を克服するために、1つの分岐命
令に対して1ワード分のトレースメモリしか使用しない
方法が考えられる。この方法では、分岐命令の分岐先ア
ドレスだけをトレースメモリに保存する方法と、分岐命
令の分岐元アドレスだけをトレースメモリに保存する方
法の2通りが考えられる。しかし、分岐命令だけに対応
するのであれば分岐先アドレスだけの命令トレースで良
いが、分岐は分岐命令が実行されたときだけではなく、
割り込みや命令実行中例外が実行されたときにも発生す
る。この場合には割り込みが入る直前まで実行していた
命令が重要になる。
In order to overcome this drawback, a method is conceivable in which only one word of trace memory is used for one branch instruction. In this method, two methods are conceivable: a method of saving only the branch destination address of the branch instruction in the trace memory and a method of saving only the branch source address of the branch instruction in the trace memory. However, if only the branch instruction is supported, an instruction trace of only the branch destination address is sufficient, but the branch is not limited to when the branch instruction is executed.
It also occurs when an interrupt or an exception during instruction execution is executed. In this case, the instruction executed until immediately before the interruption is important.

【0037】このため、割り込みや命令実行中例外によ
る分岐の場合も情報を失わずに命令トレースを実行する
ためには、分岐命令時、割り込み時にかかわらず分岐元
のアドレスをトレースメモリに格納するのが良い。しか
し、分岐命令以外のマイクロプロセッサの命令実行アド
レスを変更するもの、例えば割り込み動作(割り込みが
入った時点での命令の動作をキャンセルし、割り込み処
理の開始番地に制御を移す動作)を実行する場合、公報
2の考案の構成で実現しようとすると、分岐命令時のト
レースでは分岐命令のアドレス(すなわち実行完了して
分岐する)が格納されるが、割り込み処理時のトレース
では割り込みが入った時点での命令のアドレスがトレー
スメモリに格納される。この結果割り込みが入った時点
での命令は、実際には実行されていないにもかかわらず
トレースメモリに格納されることになる。つまり、トレ
ースメモリに格納されているアドレスすべてが実行終了
しているものとは限らなくなる。また命令の種類によっ
ては、命令の実行を完了せずに分岐動作をする命令も用
途によって必要となる。この場合も、トレースメモリに
格納されたすべてのアドレスが実行完了したものとは限
らなくなり混乱を招く。
Therefore, in order to execute the instruction trace without losing information even in the case of a branch due to an interrupt or an exception during instruction execution, the address of the branch source is stored in the trace memory regardless of the branch instruction or the interrupt. Is good. However, when changing the instruction execution address of the microprocessor other than the branch instruction, for example, when executing an interrupt operation (operation of canceling the operation of the instruction at the time of interruption and transferring control to the start address of the interrupt processing) In the trace of the branch instruction, the address of the branch instruction (that is, execution completion and branching) is stored in the trace of the branch instruction. Is stored in the trace memory. As a result, the instruction at the time when the interrupt is input is stored in the trace memory although it is not actually executed. That is, it is not always the case that all the addresses stored in the trace memory have been executed. In addition, depending on the type of instruction, an instruction that performs a branch operation without completing the execution of the instruction is also required depending on the application. Also in this case, not all the addresses stored in the trace memory have been completely executed, which causes confusion.

【0038】このような点に鑑み本発明は、マイクロプ
ロセッサ内部の命令トレース用回路のメモリ容量を少な
くして、実時間処理を損なわずに命令トレースを実現す
ることが可能な、トレースメモリ内蔵マイクロプロセッ
サおよびトレース方法を提供することを目的とする。
In view of such a point, the present invention has a trace memory built-in micro-processor capable of realizing an instruction trace without deteriorating the real-time processing by reducing the memory capacity of the instruction trace circuit in the microprocessor. It is an object to provide a processor and a tracing method.

【0039】[0039]

【課題を解決するための手段】上記課題を解決するため
に本発明のトレースメモリ内蔵マイクロプロセッサは、
内蔵レジスタと、実行資源と、割り込み受け付け手段
と、次命令のアドレスを計算する命令カウンタと、命令
デコード手段と、外部入出力手段と、トレースメモリと
を備え、キャッシュメモリを内蔵してパイプライン処理
を行うマイクロプロセッサであり、直前に実行が終了し
た命令のプログラムカウンタの値を確保する第1の確保
手段と、現在実行している命令の該プログラムカウンタ
の値を確保する第2の確保手段と、該第1および第2の
確保手段の出力のうちのどちらか1つを選択する第1の
選択手段と、該内蔵レジスタの内容を出力する外部出力
手段とを有し、該トレースメモリが該第1の選択手段の
出力を格納する。
In order to solve the above-mentioned problems, a microprocessor with a built-in trace memory according to the present invention comprises:
It has a built-in register, an execution resource, an interrupt accepting means, an instruction counter for calculating an address of a next instruction, an instruction decoding means, an external input / output means, and a trace memory. A first securing unit for securing the value of the program counter of the instruction that has just been executed, and a second securing unit for securing the value of the program counter of the currently executed instruction. A first selecting means for selecting one of the outputs of the first and second securing means, and an external output means for outputting the contents of the built-in register. The output of the first selecting means is stored.

【0040】上記本発明のトレースメモリ内蔵マイクロ
プロセッサは、前記トレースメモリから出力されるトレ
ース結果と前記実行資源の出力とのうちのどちらか1つ
を選択する第2の選択手段を有し、該第2の選択手段の
出力が前記内蔵レジスタの書き込み端子に接続されてい
る。
The microprocessor with a built-in trace memory according to the present invention has a second selecting means for selecting one of a trace result output from the trace memory and an output of the execution resource. An output of the second selecting means is connected to a write terminal of the built-in register.

【0041】上記本発明のトレースメモリ内蔵マイクロ
プロセッサを用いる本発明のトレース方法は、前記第1
の選択手段が、前記割り込み受け付け手段から出力され
る割り込み要求信号によってプログラムの実行列が変化
するときには前記第1の確保手段が確保している値を選
択して出力し、プログラムの実行順序を変更する命令に
よってプログラムの実行列が変化するときには前記第2
の確保手段が確保している値を選択して出力する。
The tracing method of the present invention using the microprocessor with trace memory of the present invention is the first method described above.
Selecting means for selecting and outputting the value secured by the first securing means when the execution sequence of the program is changed by an interrupt request signal output from the interrupt accepting means, and changing the execution order of the program When the execution sequence of the program changes due to the instruction
The value secured by the securing means of is selected and output.

【0042】上記本発明のトレースメモリ内蔵マイクロ
プロセッサを用いる本発明のトレース方法は、前記第1
の選択手段が、前記割り込み受け付け手段から出力され
る特定の割り込み検出信号によってプログラムの実行列
が変化するときには前記第2の確保手段が確保している
値を選択して出力し、前記プログラムの実行順序を変更
する命令によってプログラムの実行列が変化するときに
は、前記命令デコード手段から出力される特定命令検出
信号にしたがって前記第1の確保手段が確保している値
を選択して出力する。
The tracing method of the present invention using the microprocessor with a trace memory of the present invention is the first method described above.
Selecting means for selecting and outputting a value secured by the second securing means when the execution sequence of the program is changed by a specific interrupt detection signal output from the interrupt receiving means, and executing the program When the execution sequence of the program is changed by the instruction for changing the order, the value secured by the first securing means is selected and output according to the specific instruction detection signal output from the instruction decoding means.

【0043】また、上記本発明のトレース方法は、前記
第2の選択手段が、トレースメモリ読み出し命令検出手
段によって読み出し命令を検出したときには、前記トレ
ース結果を選択して出力することができる。
Further, in the tracing method of the present invention, when the second selecting means detects the read instruction by the trace memory read instruction detecting means, the trace result can be selected and output.

【0044】さらに、上記本発明のトレース方法は、前
記外部出力手段が、前記内蔵レジスタの内容を外部に出
力することができる。
Further, in the above tracing method of the present invention, the external output means can output the contents of the internal register to the outside.

【0045】[0045]

【作用】上記の構成をとることによって、本発明は以下
の作用を有する。
With the above construction, the present invention has the following actions.

【0046】(1)トレースメモリにトレース結果を書
き込む場合に、第1の選択手段が、割り込み受け付け手
段から出力される割り込み要求信号によってプログラム
の実行列が変化するときには第1の確保手段が確保して
いる値を選択して出力するので、割り込みを受け付けた
ときまでに実行を完了している命令のアドレスをトレー
スメモリに格納することができる。また、第1の選択手
段が、プログラムの実行順序を変更する命令によってプ
ログラムの実行列が変化するときには第2の確保手段が
確保している値を選択して出力するので、プログラムの
実行順序を変更する命令自身のアドレスをトレースメモ
リに格納することができる。
(1) When writing the trace result in the trace memory, the first selecting means secures the first securing means when the execution sequence of the program is changed by the interrupt request signal output from the interrupt accepting means. Since the selected value is selected and output, the address of the instruction whose execution has been completed by the time the interrupt is accepted can be stored in the trace memory. When the execution sequence of the program is changed by an instruction to change the execution order of the program, the first selection means selects and outputs the value secured by the second securing means. The address of the instruction to be changed can be stored in the trace memory.

【0047】(2)トレースメモリにトレース結果を書
き込む場合に、第1の選択手段が、割り込み受け付け手
段から出力される特定の割り込み検出信号によってプロ
グラムの実行列が変化するときには第2の確保手段が確
保している値を選択して出力するので、割り込み自身の
アドレスをトレースメモリに格納することができる。ま
た、第1の選択手段が、プログラムの実行順序を変更す
る命令によってプログラムの実行列が変化するときには
第1の確保手段が確保している値を選択して出力するの
で、プログラムの実行順序を変更する命令を受け付けた
ときまでに実行を完了している命令のアドレスをトレー
スメモリに格納することができる。
(2) When writing the trace result in the trace memory, the first selecting means sets the second securing means when the execution sequence of the program is changed by a specific interrupt detection signal output from the interrupt receiving means. Since the reserved value is selected and output, the address of the interrupt itself can be stored in the trace memory. Further, the first selecting means selects and outputs the value secured by the first securing means when the execution sequence of the program is changed by an instruction for changing the execution sequence of the program, and therefore the execution order of the programs is changed. The address of the instruction that has been executed by the time the instruction to be changed is accepted can be stored in the trace memory.

【0048】(3)トレースメモリに格納されているト
レース情報を読み出す場合に、第2の選択手段が、トレ
ースメモリ読み出し命令検出手段によって読み出し命令
を検出したときにはトレース情報を選択するので、トレ
ース情報を内蔵レジスタに格納することができる。
(3) When reading the trace information stored in the trace memory, the second selecting means selects the trace information when the read instruction is detected by the trace memory read instruction detecting means. It can be stored in a built-in register.

【0049】(4)外部出力手段が内蔵レジスタの内容
を外部に出力するので、外部入出力手段の電気的特性を
劣化させることなく、トレース結果を出力することがで
きる。
(4) Since the external output means outputs the contents of the internal register to the outside, the trace result can be output without deteriorating the electrical characteristics of the external input / output means.

【0050】[0050]

【実施例】以下に、本発明の第1および第2の実施例を
図面を参照して説明する。
DESCRIPTION OF THE PREFERRED EMBODIMENTS First and second embodiments of the present invention will be described below with reference to the drawings.

【0051】[第1の実施例]図1は本発明の第1の実
施例の構成を示す図である。初めに本発明の第1の実施
例の構成を図1を用いて説明する。図1の構成において
従来例の図6の構成と同様の部分には同じ符号を付し、
異なる部分のみ説明する。
[First Embodiment] FIG. 1 is a diagram showing a configuration of a first embodiment of the present invention. First, the configuration of the first embodiment of the present invention will be described with reference to FIG. In the configuration of FIG. 1, the same parts as those of the configuration of FIG.
Only different parts will be described.

【0052】マイクロプロセッサ101はトレース結果
の外部への出力手段として、外部出力手段127を有し
ている。割り込み受け付け手段809から出力される割
り込み種類信号および割り込み受け付け信号は、割り込
み種類信号線105および割り込み受け付け信号線10
6を介して終了判定手段112に入力される。また、割
り込み種類信号線105はトレースアドレス決定手段1
11およびトレース検出手段113にも入力される。命
令デコーダ810から出力される分岐命令種類信号およ
び命令種類信号は、分岐命令種類信号線103および命
令種類信号線104を介してトレース検出手段113お
よびトレースアドレス決定手段111に入力され、命令
実行信号は命令実行信号線107を介して終了判定手段
112に入力される。終了判定手段112から出力され
る終了命令アドレス書き込み信号は終了命令アドレス書
き込み信号線110を介して実行終了命令アドレスレジ
スタ128に入力される。
The microprocessor 101 has an external output means 127 as an output means for outputting the trace result to the outside. The interrupt type signal and the interrupt acceptance signal output from the interrupt acceptance unit 809 are the interrupt type signal line 105 and the interrupt acceptance signal line 10.
It is input to the end determination means 112 via 6. Further, the interrupt type signal line 105 is connected to the trace address determining means 1.
11 and trace detection means 113. The branch instruction type signal and the instruction type signal output from the instruction decoder 810 are input to the trace detection unit 113 and the trace address determination unit 111 via the branch instruction type signal line 103 and the instruction type signal line 104, and the instruction execution signal is It is input to the end determination means 112 via the instruction execution signal line 107. The end instruction address write signal output from the end determination means 112 is input to the execution end instruction address register 128 via the end instruction address write signal line 110.

【0053】トレースアドレス決定手段111には、割
り込み受け付け手段809の出力である割り込み種類信
号線105および命令デコーダ810の出力である命令
種類信号線104が入力され、トレースアドレス決定手
段111から出力されるトレースアドレス選択信号はト
レースアドレス選択信号線116を介してトレースアド
レス選択手段117の選択信号入力端子に入力される。
An interrupt type signal line 105 output from the interrupt accepting unit 809 and an instruction type signal line 104 output from the instruction decoder 810 are input to the trace address determining unit 111 and output from the trace address determining unit 111. The trace address selection signal is input to the selection signal input terminal of the trace address selection means 117 via the trace address selection signal line 116.

【0054】命令アドレスレジスタ808の出力は、ト
レースアドレス選択手段117の一方の被選択信号入力
端子および実行終了命令アドレスレジスタ128に入力
され、実行終了命令アドレスレジスタ128の出力はト
レースアドレス選択手段117の他方の被選択信号入力
端子に入力される。トレースアドレス選択手段117の
出力はトレースアドレスバス118を介してトレースメ
モリ126の書き込みポートに入力される。
The output of the instruction address register 808 is input to one selected signal input terminal of the trace address selection means 117 and the execution end instruction address register 128, and the output of the execution end instruction address register 128 is output from the trace address selection means 117. It is input to the other selected signal input terminal. The output of the trace address selecting means 117 is input to the write port of the trace memory 126 via the trace address bus 118.

【0055】結果レジスタ813の出力はトレースメモ
リアドレス選択手段115の被選択信号入力端子のうち
の1つに入力され、さらにメモリアクセスデータバス8
24および接続手段125を介して外部出力手段127
に接続されている。
The output of the result register 813 is input to one of the selected signal input terminals of the trace memory address selecting means 115, and furthermore, the memory access data bus 8
24 and the external output means 127 via the connection means 125
It is connected to the.

【0056】トレース検出手段113から出力されるト
レースメモリ書き込み信号線120はトレースメモリ1
26に入力され、トレースメモリアドレスホールド選択
信号およびトレースメモリアドレスインクリメント選択
信号は、トレースメモリアドレスインクリメント選択信
号線122およびトレースメモリアドレスホールド選択
信号線123を介してトレースメモリアドレス選択手段
115の選択信号入力端子のうちの2つに入力される。
トレースメモリアドレス選択手段115の出力はトレー
スメモリアドレスレジスタ114に入力され、トレース
メモリアドレスレジスタ114の出力はトレースメモリ
アドレス選択手段115の被選択信号入力端子のうちの
1つ、トレースメモリアドレスインクリメンタ121、
およびトレースメモリ126に入力される。トレースメ
モリアドレスインクリメンタ121の出力はトレースメ
モリアドレス選択手段115の被選択信号入力端子のう
ちの1つに入力される。
The trace memory write signal line 120 output from the trace detecting means 113 is connected to the trace memory 1
26, the trace memory address hold selection signal and the trace memory address increment selection signal are supplied to the trace memory address selection means 115 via the trace memory address increment selection signal line 122 and the trace memory address hold selection signal line 123. Input to two of the terminals.
The output of the trace memory address selecting means 115 is input to the trace memory address register 114, and the output of the trace memory address register 114 is one of the selected signal input terminals of the trace memory address selecting means 115, the trace memory address incrementer 121 ,
And to the trace memory 126. The output of the trace memory address incrementer 121 is input to one of the selected signal input terminals of the trace memory address selecting means 115.

【0057】キャッシュメモリ803から出力される命
令は、命令バス819を介してトレースメモリ読み出し
検出手段102にも入力される。
The instruction output from the cache memory 803 is also input to the trace memory read detection means 102 via the instruction bus 819.

【0058】トレースメモリ読み出し検出手段102か
ら出力されるレジスタ書き込み選択信号線108はレジ
スタ書き込み信号選択手段109の選択信号入力端子に
入力され、トレースメモリアドレスセット選択信号線1
24はトレースメモリアドレス選択手段115の選択信
号入力端子のうちの1つに入力され、トレースメモリ読
み出し信号線129はトレースメモリ126に入力され
る。
The register write selection signal line 108 output from the trace memory read detection means 102 is input to the selection signal input terminal of the register write signal selection means 109, and the trace memory address set selection signal line 1
24 is input to one of the selection signal input terminals of the trace memory address selection means 115, and the trace memory read signal line 129 is input to the trace memory 126.

【0059】トレースメモリ126にはトレース検出手
段113から出力されるトレースメモリ書き込み信号線
120およびトレースメモリ読み出し検出手段102か
ら出力されるトレースメモリ読み出し信号線129が入
力される。トレースメモリ126の読み出しポートの出
力はトレースメモリ読み出しバス119を介してレジス
タ書き込み信号選択手段109の一方の被選択信号入力
端子に入力される。結果レジスタ814の出力はレジス
タ書き込み信号選択手段109の他方の被選択信号入力
端子に入力される。レジスタ書き込み信号選択手段10
9の出力は内蔵レジスタの結果書き込みバス822を介
して内蔵レジスタ811の書き込みポートに入力され
る。
A trace memory write signal line 120 output from the trace detection means 113 and a trace memory read signal line 129 output from the trace memory read detection means 102 are input to the trace memory 126. The output of the read port of the trace memory 126 is input to one selected signal input terminal of the register write signal selection means 109 via the trace memory read bus 119. The output of the result register 814 is input to the other selected signal input terminal of the register write signal selection means 109. Register write signal selection means 10
The output of 9 is input to the write port of the internal register 811 via the result write bus 822 of the internal register.

【0060】表1は図1の終了判定手段の動作論理を示
す図である。表1を用いて、図1のマイクロプロセッサ
101においてトレースメモリ126にトレースデータ
を保存する場合の、終了判定手段112における命令の
種類と終了命令アドレス書き込み信号線110の値との
関係を説明する。
Table 1 is a diagram showing the operation logic of the end determination means of FIG. The relationship between the type of instruction and the value of the end instruction address write signal line 110 in the end determination means 112 when the trace data is stored in the trace memory 126 in the microprocessor 101 of FIG. 1 will be described using Table 1.

【0061】[0061]

【表1】 図1のマイクロプロセッサ101では、分岐命令、未定
義命令、トラップ命令、実行前トラップ命令、割り込
み、アドレストラップ、命令実行中例外、および実行後
割り込みによって命令の実行アドレスが変更される。
[Table 1] In the microprocessor 101 of FIG. 1, the instruction execution address is changed by a branch instruction, an undefined instruction, a trap instruction, a trap instruction before execution, an interrupt, an address trap, an exception during instruction execution, and an interrupt after execution.

【0062】分岐命令は分岐命令の指示するアドレスへ
分岐し、命令は正常終了する。未定義命令は未定義命令
例外エントリアドレスへ分岐し、命令は正常終了する。
トラップ命令はトラップ命令例外エントリアドレスへ分
岐し、命令は正常終了する。実行前トラップ命令はトラ
ップ命令例外エントリアドレスへ分岐し、命令はキャン
セルされ終了しない。割り込みは割り込み分岐アドレス
へ分岐し、割り込みが発生したときに実行していた命令
はキャンセルされ終了しない。アドレストラップはマイ
クロプロセッサ101がアドレストラップ用にあらかじ
め設定してあるアドレスにアクセスした場合に発生し、
アドレストラップエントリアドレスへ分岐し、そのメモ
リアクセスを実行する命令はキャンセルされ終了しな
い。命令実行中例外は例えばゼロ除算を実行したときな
どに発生し、各命令実行中例外ごとに設定されている例
外エントリアドレスへ分岐し、命令はキャンセルされ
る。実行後割り込みは実行後割り込みエントリアドレス
へ分岐し、割り込みが起こったときに実行していた命令
は正常終了する。この割り込みは、常時割り込みをいれ
ておけば1命令ごとに割り込みを発生し、シングル命令
実行を行う。
The branch instruction branches to the address indicated by the branch instruction, and the instruction ends normally. The undefined instruction branches to the undefined instruction exception entry address, and the instruction ends normally.
The trap instruction branches to the trap instruction exception entry address, and the instruction ends normally. The pre-execution trap instruction branches to the trap instruction exception entry address, and the instruction is canceled and does not end. The interrupt branches to the interrupt branch address, and the instruction being executed when the interrupt occurs is canceled and does not end. The address trap occurs when the microprocessor 101 accesses an address preset for the address trap,
Address trap entry The instruction branching to the address and executing the memory access is canceled and does not end. The exception during instruction execution occurs when, for example, division by zero is executed. The instruction branches to the exception entry address set for each exception during instruction execution, and the instruction is canceled. The post-execution interrupt branches to the post-execution interrupt entry address, and the instruction being executed when the interrupt occurred ends normally. As for this interrupt, if an interrupt is always inserted, an interrupt is generated for each instruction and a single instruction is executed.

【0063】表2は図1のトレースアドレス決定手段の
動作論理を示す図である。表2を用いて、図1のトレー
スアドレス決定手段111における命令の種類とトレー
スアドレス選択信号線116の値との関係を説明する。
Table 2 is a diagram showing the operation logic of the trace address determining means of FIG. The relationship between the type of instruction and the value of the trace address selection signal line 116 in the trace address determining means 111 of FIG. 1 will be described using Table 2.

【0064】[0064]

【表2】 図1のマイクロプロセッサでは、分岐命令、未定義命
令、トラップ命令、実行前トラップ命令、割り込み、ア
ドレストラップ、命令実行中例外、および実行後割り込
みによって命令の実行アドレスが変更される。
[Table 2] In the microprocessor of FIG. 1, the instruction execution address is changed by a branch instruction, an undefined instruction, a trap instruction, a pre-execution trap instruction, an interrupt, an address trap, an instruction execution exception, and a post-execution interrupt.

【0065】図1のマイクロプロセッサ101では、分
岐命令、未定義命令、トラップ命令、実行前トラップ命
令、割り込み、アドレストラップ、命令実行中例外、お
よび実行後割り込みによって命令の実行アドレスが変更
される。
In the microprocessor 101 of FIG. 1, the execution address of an instruction is changed by a branch instruction, an undefined instruction, a trap instruction, a pre-execution trap instruction, an interrupt, an address trap, an instruction execution exception, and a post-execution interrupt.

【0066】分岐命令は分岐命令の指示するアドレスへ
分岐し、トレースアドレスは現在実行している命令アド
レスである。未定義命令は未定義命令例外エントリアド
レスへ分岐し、トレースアドレスは現在実行している命
令アドレスである。トラップ命令はトラップ命令例外エ
ントリアドレスへ分岐し、トレースアドレスは現在実行
している命令アドレスである。実行前トラップ命令はト
ラップ命令例外エントリアドレスへ分岐し、トレースア
ドレスは直前に実行した命令アドレスである。割り込み
は割り込み分岐アドレスへ分岐し、トレースアドレスは
直前に実行した命令アドレスである。アドレストラップ
はアドレストラップエントリアドレスへ分岐し、トレー
スアドレスは直前に実行した命令アドレスである。命令
実行中例外は各命令実行中例外ごとに設定されている例
外エントリアドレスへ分岐し、トレースアドレスは直前
に実行した命令アドレスである。実行後割り込みは実行
後割り込みエントリアドレスへ分岐し、トレースアドレ
スは現在実行している命令アドレスである。
The branch instruction branches to the address indicated by the branch instruction, and the trace address is the address of the instruction currently being executed. The undefined instruction branches to the undefined instruction exception entry address, and the trace address is the instruction address currently being executed. The trap instruction branches to the trap instruction exception entry address, and the trace address is the instruction address currently being executed. The pre-execution trap instruction branches to the trap instruction exception entry address, and the trace address is the instruction address executed immediately before. The interrupt branches to the interrupt branch address, and the trace address is the instruction address executed immediately before. The address trap branches to the address trap entry address, and the trace address is the instruction address executed immediately before. The instruction executing exception branches to the exception entry address set for each instruction executing exception, and the trace address is the instruction address executed immediately before. The post-execution interrupt branches to the post-execution interrupt entry address, and the trace address is the currently executed instruction address.

【0067】次に本発明の第1の実施例の動作を図1な
いし図4を用いて説明する。
Next, the operation of the first embodiment of the present invention will be described with reference to FIGS.

【0068】(1)分岐命令を実行する場合の動作論理
を説明する。図1のマイクロプロセッサ101において
は、命令の実行が終了すると正常に終了したかどうかを
終了判定手段112が判断し、実行が正常終了した命令
の命令アドレスは実行終了命令アドレスレジスタ128
に格納される。
(1) The operation logic for executing a branch instruction will be described. In the microprocessor 101 shown in FIG. 1, when the execution of the instruction is completed, the termination determining unit 112 determines whether or not the instruction is normally terminated, and the instruction address of the instruction that is normally terminated is the execution termination instruction address register 128.
Stored in.

【0069】終了判定手段112は、命令デコーダ81
0から出力される命令実行信号線107と割り込み受け
付け手段809から出力される割り込み受け付け信号線
106とを入力して、命令実行開始を受けた命令が正常
終了したかどうかを判断する。命令実行開始を受けた命
令が終了しないうちに割り込み受け付け信号線106が
アクティブになった場合には正常終了しなかったと判断
し、終了命令アドレス書き込み信号線110をアクティ
ブにしない。命令実行開始を受けた命令が終了するまで
割り込み受け付け信号線106がアクティブにならなか
った場合には正常終了したと判断し、終了命令アドレス
書き込み信号線110をアクティブにする。終了判定手
段112の判断結果は、終了命令アドレス書き込み信号
線110によって実行終了命令アドレスレジスタ128
に伝達される。
The end judging means 112 is the instruction decoder 81.
The instruction execution signal line 107 output from 0 and the interrupt reception signal line 106 output from the interrupt reception unit 809 are input, and it is determined whether or not the instruction that has received the instruction execution has ended normally. If the interrupt acceptance signal line 106 becomes active before the instruction receiving the instruction execution start is completed, it is determined that the interrupt acceptance signal line 106 is not normally completed, and the end instruction address write signal line 110 is not activated. If the interrupt acceptance signal line 106 has not been activated until the instruction which has received the instruction execution is completed, it is determined that the operation has been completed normally, and the end instruction address write signal line 110 is activated. The result of the judgment by the end judging means 112 is transmitted to the execution end instruction address register 128 by the end instruction address write signal line 110.
Be transmitted to.

【0070】ただし、実行前トラップ命令の場合のみ
は、例外の動作をする。実行前トラップ命令は通常プロ
グラムの実行を一時的に変更するために使用する。実行
前トラップ命令の代表的な使用方法を以下に示す。
However, the exception operation is performed only in the case of the pre-execution trap instruction. The pre-execution trap instruction is usually used to temporarily change the execution of the program. A typical usage of the pre-execution trap instruction is shown below.

【0071】実行前トラップ命令を本来の命令の代わり
に命令ストリームに設定し、その前の命令までをCPU
(マイクロプロセッサ)に実行させ、実行前トラップ命
令によってCPU(マイクロプロセッサ)の実行を一時
的に停止させる。実行前トラップ命令を実行すると、C
PU(マイクロプロセッサ)はトラップ処理を行うため
にトラップハンドラアドレスに格納されているトラップ
ハンドラプログラムを起動する。このトラップハンドラ
プログラムにおいては、所定の処理を実行した後に、本
来の命令の代わりに命令ストリーム中にある実行前トラ
ップ命令を本来の命令に戻し、その戻した命令からプロ
グラムの実行を再開する。この所定の処理はアプリケー
ションによって異なる。命令ストリームの流れに着目し
た場合の上記の動作を表3に示す。
The pre-execution trap instruction is set in the instruction stream instead of the original instruction, and up to the previous instruction is set in the CPU
(Microprocessor) to execute, and the execution of the CPU (microprocessor) is temporarily stopped by the pre-execution trap instruction. When the pre-execution trap instruction is executed, C
A PU (microprocessor) activates a trap handler program stored at a trap handler address to perform a trap process. In this trap handler program, after executing a predetermined process, the pre-execution trap instruction in the instruction stream is returned to the original instruction instead of the original instruction, and the execution of the program is resumed from the returned instruction. This predetermined process differs depending on the application. Table 3 shows the above operation when paying attention to the flow of the instruction stream.

【0072】[0072]

【表3】 ここで、XXXX、YYYY等は、CPU(マイクロプ
ロセッサ)が解釈できる命令であり、各命令の前につい
ている番号はその命令が格納されているメモリアドレス
である。トラップハンドラアドレスは100となってお
り、これは実行前トラップ命令を実行すると制御をアド
レス100に移動することを示している。本来の命令ス
トリームをトレースすると表3の動作はメモリアドレス
4に格納されている命令を2回実行しているように見え
る。しかし、実行前トラップ命令は本来の命令ストリー
ムを書き換えた後に本来の命令を実行するので、本来の
命令ストリーム上ではメモリアドレス4に格納されてい
る命令は1回のみ実行されているはずであり、混乱を生
じる。
[Table 3] Here, XXXX, YYYY, and the like are instructions that can be interpreted by a CPU (microprocessor), and the number preceding each instruction is a memory address where the instruction is stored. The trap handler address is 100, which indicates that execution of the pre-execution trap instruction transfers control to address 100. Tracing the original instruction stream, the operations in Table 3 appear to execute the instruction stored at memory address 4 twice. However, since the pre-execution trap instruction executes the original instruction after rewriting the original instruction stream, the instruction stored at the memory address 4 should be executed only once on the original instruction stream, Create confusion.

【0073】そこで実行前トラップ命令を実行したとき
には、実行前トラップ命令の実行が正常終了していても
終了していないと解釈し、終了命令アドレス書き込み信
号線110をインアクティブにし、かつトレースアドレ
スを直前に実行した命令に戻すためにトレースアドレス
選択信号線116をアクティブにする。これによって、
表3の実行前トラップ命令はキャンセルされ、本来の命
令ストリームを正確にトレースすることができる。
Therefore, when the pre-execution trap instruction is executed, it is interpreted that the execution of the pre-execution trap instruction is not completed even if it is normally completed, the end instruction address write signal line 110 is made inactive, and the trace address is changed. The trace address selection signal line 116 is activated to return to the instruction executed immediately before. by this,
The pre-execution trap instruction in Table 3 is canceled and the original instruction stream can be traced accurately.

【0074】分岐命令は、キャッシュメモリ803から
命令バス819を介して命令デコーダ810およびトレ
ースメモリ読み出し検出手段102に入力される。同時
に、次命令アドレスレジスタ818の出力は、アドレス
インクリメンタ802において次命令アドレスとなり、
再度次命令アドレスレジスタ818に格納される。次命
令アドレスレジスタ818の出力は、キャッシュメモリ
803に入力されて分岐先の命令フェッチを行うと同時
に、命令アドレスレジスタ805にも格納される。この
とき、命令アドレスレジスタ805の内容は命令アドレ
スレジスタ806に入力され、命令アドレスレジスタ8
06の内容は命令アドレスレジスタ807に入力され、
命令アドレスレジスタ807の内容は命令アドレスレジ
スタ808に入力されて格納される。分岐命令は命令デ
コーダ810で分岐命令と判断された後、実行資源81
2を操作して分岐先アドレスを生成し、分岐先アドレス
は次命令アドレスレジスタ818に入力されて保持され
る。
The branch instruction is input from the cache memory 803 to the instruction decoder 810 and the trace memory read detection means 102 via the instruction bus 819. At the same time, the output of the next instruction address register 818 becomes the next instruction address in the address incrementer 802,
It is stored in the next instruction address register 818 again. The output of the next instruction address register 818 is input to the cache memory 803 to fetch the instruction at the branch destination, and is also stored in the instruction address register 805. At this time, the contents of the instruction address register 805 are input to the instruction address
06 is input to the instruction address register 807,
The contents of the instruction address register 807 are input to and stored in the instruction address register 808. After the branch instruction is determined by the instruction decoder 810 to be a branch instruction, the execution resources 81
2 to generate a branch destination address, and the branch destination address is input to and held in the next instruction address register 818.

【0075】次のサイクルでは、次命令アドレスレジス
タ818に格納された分岐先アドレスがキャッシュメモ
リ803に入力され、分岐命令の次の命令をフェッチす
る。また同時に、命令デコーダ810によって検出され
た分岐命令の種類は、分岐命令種類信号線103および
命令種類信号線104を介して、トレース検出手段11
3およびトレースアドレス決定手段111に入力され
る。トレース検出手段113では、マイクロプロセッサ
101が命令トレースを実施可能な状態になっているか
どうかを判断し、トレース可の状態かつ、分岐命令種類
信号線103によって伝えられた命令がトレースメモリ
に登録する命令であれば、適切なタイミングでトレース
メモリアドレスホールド選択信号線123をインアクテ
ィブにし、トレースメモリアドレスインクリメント選択
信号線122をアクティブにする。
In the next cycle, the branch destination address stored in the next instruction address register 818 is input to the cache memory 803, and the instruction next to the branch instruction is fetched. At the same time, the type of the branch instruction detected by the instruction decoder 810 is transmitted to the trace detection unit 11 via the branch instruction type signal line 103 and the instruction type signal line 104.
3 and the trace address determining means 111. The trace detection unit 113 determines whether the microprocessor 101 is in a state in which instruction tracing can be performed, and the traceable state and the instruction transmitted by the branch instruction type signal line 103 is registered in the trace memory. If so, the trace memory address hold selection signal line 123 is made inactive and the trace memory address increment selection signal line 122 is made active at an appropriate timing.

【0076】その次のサイクルでは、トレース検出手段
113はトレースメモリ書き込み信号線120をアクテ
ィブにする。トレースメモリアドレスインクリメント選
択信号線122がアクティブでありトレースメモリアド
レスホールド選択信号線123がインアクティブであっ
た場合には、トレースメモリアドレス選択手段115は
トレースメモリアドレスインクリメンタ121の出力を
選択し、トレースメモリアドレスレジスタ114に格納
する。トレースメモリアドレスレジスタ114の出力は
トレースメモリ126のメモリアドレスとなり、トレー
スメモリ書き込み信号線120がアクティブであるのを
受けてトレースメモリ126にトレースアドレスバス1
18の値を書き込む。トレースメモリアドレスインクリ
メンタ121のアドレスは、トレースメモリの容量を超
えた場合にはラップアラウンドに最初の番地に戻る構成
になっており、トレースメモリの容量を超えることはな
い。
In the next cycle, the trace detection means 113 activates the trace memory write signal line 120. When the trace memory address increment selection signal line 122 is active and the trace memory address hold selection signal line 123 is inactive, the trace memory address selection means 115 selects the output of the trace memory address incrementer 121 and The data is stored in the memory address register 114. The output of the trace memory address register 114 becomes the memory address of the trace memory 126, and when the trace memory write signal line 120 is active, the trace address bus 1 is sent to the trace memory 126.
Write the value of 18. When the address of the trace memory address incrementer 121 exceeds the capacity of the trace memory, the address is configured to return to the first address in the wraparound, and does not exceed the capacity of the trace memory.

【0077】分岐を起こさない命令であった場合、トレ
ース検出手段113は、トレースメモリアドレスホール
ド選択信号線123をアクティブにし、トレースメモリ
アドレスインクリメント選択信号線122をインアクテ
ィブにする。このとき、トレースメモリアドレス選択手
段115は、トレースメモリアドレスレジスタ114の
出力信号を選択し、トレースメモリアドレスレジスタ1
14に再格納する。
If the instruction does not cause a branch, the trace detecting means 113 activates the trace memory address hold selection signal line 123 and inactivates the trace memory address increment selection signal line 122. At this time, the trace memory address selecting means 115 selects the output signal of the trace memory address register 114, and the trace memory address register 1
Restore in 14.

【0078】トレースアドレス決定手段111では、命
令デコーダ810から命令種類信号線104によって伝
達される命令の種類に合わせてトレースアドレス選択信
号線116を適切なタイミングでトレースアドレス選択
手段117に出力する。トレースアドレス選択信号線1
16がアクティブであった場合には、トレースアドレス
選択手段117は実行終了命令アドレスレジスタ128
から出力されたアドレスを選択してトレースアドレスバ
ス118に出力する。トレースアドレス選択信号線11
6がインアクティブであった場合には、トレースアドレ
ス選択手段117はレジスタ808から出力されたアド
レスを選択してトレースアドレスバス118に出力す
る。
The trace address determination means 111 outputs the trace address selection signal line 116 to the trace address selection means 117 at an appropriate timing in accordance with the type of instruction transmitted from the instruction decoder 810 via the instruction type signal line 104. Trace address selection signal line 1
16 is active, the trace address selecting means 117 executes the execution end instruction address register 128
The address output from is selected and output to the trace address bus 118. Trace address selection signal line 11
When 6 is inactive, the trace address selecting means 117 selects the address output from the register 808 and outputs it to the trace address bus 118.

【0079】図2は分岐命令実行時の動作を示すタイミ
ングチャートである。分岐命令の命令アドレスが命令ア
ドレスレジスタ808へ格納されると、終了判定手段1
12は終了命令アドレス書き込み信号線110をアクテ
ィブにして実行終了命令アドレスレジスタ128に送
り、実行終了命令アドレスレジスタ128は命令アドレ
スレジスタ808の内容を格納する。
FIG. 2 is a timing chart showing an operation at the time of execution of a branch instruction. When the instruction address of the branch instruction is stored in the instruction address register 808, the end determination means 1
12 activates the end instruction address write signal line 110 and sends it to the execution end instruction address register 128, and the execution end instruction address register 128 stores the contents of the instruction address register 808.

【0080】図2において命令(jmp0020)は
命令アドレスを0020に設定する命令で、命令アド
レスレジスタ806のステージにおいて命令アドレス
を変更する()。同様に命令(jmp0040)は
命令アドレスを0040に設定し、命令アドレスレジ
スタ806のステージにおいて命令アドレスを変更す
る()。図2中の網掛された命令はキャンセルされた
命令であり、命令アドレスレジスタ808の出力()
のうち網掛されていないアドレスが命令ストリームの流
れである。この命令アドレスレジスタ808の出力が、
トレースアドレス選択手段117を経由してトレースア
ドレスバス118を介し、トレースメモリ各込み信号線
120がアクティブであるタイミングでトレースメモリ
126に書き込まれる。
In FIG. 2, the instruction (jmp0020) is an instruction for setting the instruction address to 0020, and the instruction address is changed at the stage of the instruction address register 806 (). Similarly, the instruction (jmp0040) sets the instruction address to 0040 and changes the instruction address at the stage of the instruction address register 806 (). The shaded instruction in FIG. 2 is a canceled instruction, and the output of the instruction address register 808 ()
Among them, the addresses not shaded are the flow of the instruction stream. The output of this instruction address register 808 is
Data is written in the trace memory 126 via the trace address bus 118 via the trace address selection means 117 at the timing when each trace memory embedded signal line 120 is active.

【0081】このようにして図2においては、最初のジ
ャンプ命令である命令ではアドレス0002がトレー
スメモリ126に書き込まれ、次のジャンプ命令である
命令ではアドレス0020がトレースメモリ126に
書き込まれる。
In FIG. 2, address 0002 is written to trace memory 126 for the first jump instruction, and address 0020 is written to trace memory 126 for the next jump instruction.

【0082】(2)割り込みによって命令実行が不連続
になった場合の動作論理を説明する。割り込み信号はマ
イクロプロセッサ101の割り込み入力端子820から
入力され、割り込み受け付け手段809に入力される。
割り込み受け付け手段809での受け付け結果は割り込
み受け付け信号線106を介して終了判定手段112に
伝達される。終了判定手段112は割り込み受け付け結
果を受けて、現在実行している命令に対して終了命令ア
ドレス書き込み信号線110をインアクティブにして、
実行終了命令アドレスレジスタ128への命令アドレス
の書き込みを禁止する。
(2) The operation logic when instruction execution becomes discontinuous due to an interrupt will be described. The interrupt signal is input from the interrupt input terminal 820 of the microprocessor 101 and input to the interrupt accepting unit 809.
The result of the reception by the interrupt receiving unit 809 is transmitted to the end determining unit 112 via the interrupt receiving signal line 106. The end determination means 112 receives the interrupt acceptance result, inactivates the end instruction address write signal line 110 for the currently executed instruction,
Writing of an instruction address to the execution end instruction address register 128 is prohibited.

【0083】ただし、実行後割り込み時のみ、例外の動
作をする。実行後割り込みは1命令ごとに実行するステ
ップ実行の場合に使用する割り込みである。通常の割り
込みは割り込みを受け付けた命令をキャンセルして割り
込みハンドラアドレスへ制御を移動し、割り込みハンド
ラアドレスにおいて所定の処理を行った後、キャンセル
された命令に戻る。この通常の割り込みをCPU(マイ
クロプロセッサ)に対して実行し続けた場合の動作を表
4に示す。
However, an exception operation is performed only at the time of an interrupt after execution. The post-execution interrupt is an interrupt used when step execution is executed for each instruction. The normal interrupt cancels the instruction that accepted the interrupt, transfers control to the interrupt handler address, performs predetermined processing at the interrupt handler address, and then returns to the canceled instruction. Table 4 shows the operation when the normal interrupt is continuously executed for the CPU (microprocessor).

【0084】[0084]

【表4】 ここで、XXXX、YYYY等は、CPU(マイクロプ
ロセッサ)が解釈できる命令であり、各命令の前につい
ている番号はその命令が格納されているメモリアドレス
であり、→は割り込み信号である。表4から分かるよう
に通常の割り込みを実行した場合には、割り込みハンド
ラプログラムのアドレス101の命令が割り込みを受け
付けた命令に戻すために命令シーケンスが進まない。そ
こで、表4の割り込み信号を実行後割り込みとしたとき
の動作を表5に示す。
[Table 4] Here, XXXX, YYYY, and the like are instructions that can be interpreted by a CPU (microprocessor), the number preceding each instruction is a memory address where the instruction is stored, and → is an interrupt signal. As can be seen from Table 4, when the normal interrupt is executed, the instruction sequence does not proceed because the instruction at the address 101 of the interrupt handler program returns to the instruction that accepted the interrupt. Table 5 shows the operation when the interrupt signal shown in Table 4 is set as an interrupt after execution.

【0085】[0085]

【表5】 ここで、割り込み信号→は実行後割り込み信号である。
実行後割り込みにおいては、割り込みを受け付けた命令
が正常終了したと解釈して書き込み終了命令アドレス書
き込み信号線110をアクティブにし、トレースアドレ
スとして現在の命令アドレスを指定するためにトレース
アドレス選択信号線116をインアクティブにすること
によって、実行後割り込みが実現されて1命令ごとの実
行が可能となる。
[Table 5] Here, the interrupt signal → is a post-execution interrupt signal.
In the post-execution interrupt, the instruction that accepted the interrupt is interpreted as having ended normally, the write end instruction address write signal line 110 is activated, and the trace address selection signal line 116 is used to specify the current instruction address as the trace address. By making it inactive, an interrupt after execution is realized, and execution for each instruction becomes possible.

【0086】割り込みを受け付けたときに実行中の命令
は、通常通りキャッシュメモリ803から命令バス81
9を介して命令デコーダ810およびトレースメモリ読
み出し検出手段102に入力される。同時に、次命令ア
ドレスレジスタ818の出力は、アドレスインクリメン
タ802において次命令アドレスとなり、再度次命令ア
ドレスレジスタ818に格納される。次命令アドレスレ
ジスタ818の出力はキャッシュメモリ803に格納さ
れて分岐先の命令フェッチを行うと同時に、命令アドレ
スレジスタ805にも格納される。このとき、命令アド
レスレジスタ805の内容は命令アドレスレジスタ80
6に入力され、命令アドレスレジスタ806の内容は命
令アドレスレジスタ807に入力され、命令アドレスレ
ジスタ807の内容は命令アドレスレジスタ808に入
力されて格納される。
The instruction being executed when the interrupt is accepted is sent from the cache memory 803 to the instruction bus 81 as usual.
9 to the instruction decoder 810 and the trace memory read detection means 102. At the same time, the output of the next instruction address register 818 becomes the next instruction address in the address incrementer 802 and is stored again in the next instruction address register 818. The output of the next instruction address register 818 is stored in the cache memory 803 to fetch the branch destination instruction, and at the same time, is also stored in the instruction address register 805. At this time, the contents of the instruction address register 805 are
6, the contents of the instruction address register 806 are input to the instruction address register 807, and the contents of the instruction address register 807 are input to and stored in the instruction address register 808.

【0087】次のサイクルでは、次命令アドレスレジス
タ818に格納されたアドレスがキャッシュメモリ80
3に入力され、割り込みの次の命令をフェッチする。割
り込み受け付け手段809が出力する割り込み種類信号
は、割り込み種類信号線105を介してトレース検出手
段113に入力される。トレース検出手段113では、
マイクロプロセッサ101が命令トレースを実施可能な
状態になっているかどうかを判断し、トレース可の状態
かつ、分岐命令種類信号線103によって伝えられた割
り込みがトレースメモリに登録する割り込みであれば、
適切なタイミングでトレースメモリアドレスホールド選
択信号線123をインアクティブにし、トレースメモリ
アドレスインクリメント選択信号線122をアクティブ
にする。
In the next cycle, the address stored in the next instruction address register 818 is stored in the cache memory 80.
3 and fetches the instruction following the interrupt. The interrupt type signal output by the interrupt receiving unit 809 is input to the trace detection unit 113 via the interrupt type signal line 105. In the trace detecting means 113,
The microprocessor 101 determines whether or not the instruction tracing can be performed. If the tracing is enabled and the interrupt transmitted by the branch instruction type signal line 103 is an interrupt to be registered in the trace memory,
At an appropriate timing, the trace memory address hold selection signal line 123 is made inactive, and the trace memory address increment selection signal line 122 is made active.

【0088】その次のサイクルでは、トレース検出手段
113はトレースメモリ書き込み信号線120をアクテ
ィブにする。トレースメモリアドレスインクリメント選
択信号線122がアクティブでありトレースメモリアド
レスホールド選択信号線123がインアクティブであっ
た場合には、トレースメモリアドレス選択手段115は
トレースメモリアドレスインクリメンタ121の出力を
選択し、トレースメモリアドレスレジスタ114に格納
する。トレースメモリアドレスレジスタ114の出力は
トレースメモリ126のメモリアドレスとなり、トレー
スメモリ書き込み信号線120がアクティブであるのを
受けてトレースメモリ126にトレースアドレスバス1
18の値を書き込む。
In the next cycle, the trace detecting means 113 activates the trace memory write signal line 120. When the trace memory address increment selection signal line 122 is active and the trace memory address hold selection signal line 123 is inactive, the trace memory address selection means 115 selects the output of the trace memory address incrementer 121 and The data is stored in the memory address register 114. The output of the trace memory address register 114 becomes the memory address of the trace memory 126, and when the trace memory write signal line 120 is active, the trace address bus 1 is sent to the trace memory 126.
Write the value of 18.

【0089】トレースアドレス決定手段111では、割
り込み受け付け手段809から出力される割り込み種類
信号線105によって伝達される割り込みの種類に合わ
せて、トレースアドレス選択信号線116を適切なタイ
ミングでトレースアドレス選択手段117に出力する。
トレースアドレス選択信号線116がアクティブであっ
た場合には、トレースアドレス選択手段117は実行終
了命令アドレスレジスタ128から出力されたアドレス
を選択してトレースアドレスバス118に出力する。ト
レースアドレス選択信号線116がインアクティブであ
った場合には、トレースアドレス選択手段117はレジ
スタ808から出力されたアドレスを選択してトレース
アドレスバス118に出力する。
In the trace address determination means 111, the trace address selection signal line 116 is set at an appropriate timing according to the type of the interrupt transmitted by the interrupt type signal line 105 output from the interrupt reception means 809. Output to.
When the trace address selection signal line 116 is active, the trace address selection means 117 selects the address output from the execution end instruction address register 128 and outputs it to the trace address bus 118. If the trace address selection signal line 116 is inactive, the trace address selection means 117 selects the address output from the register 808 and outputs it to the trace address bus 118.

【0090】図3は割り込み実行時の動作を示すタイミ
ングチャートである。最後に割り込みを受け付けたとき
に実行中であった命令の命令アドレスが命令アドレスレ
ジスタ808へ格納されると、終了判定手段112は終
了命令アドレス書き込み信号線110をアクティブにし
て実行終了命令アドレスレジスタ128に送り、実行終
了命令アドレスレジスタ128は命令アドレスレジスタ
808の内容を格納する。
FIG. 3 is a timing chart showing an operation at the time of executing an interrupt. When the instruction address of the instruction that was being executed when the interrupt was finally accepted is stored in the instruction address register 808, the end determination unit 112 activates the end instruction address write signal line 110 and the execution end instruction address register 128. The execution end instruction address register 128 stores the contents of the instruction address register 808.

【0091】図3において命令(jmp1000)は
命令アドレスを1000に設定する命令で、命令アド
レスレジスタ806のステージにおいて命令アドレス
を変更する()。命令(normal)は命令アド
レスが1000に対応しており、命令が命令アドレ
スを1000に設定した後に実行を開始するが、割り
込みが入力されているので命令はキャンセルされ
る。図3中の網掛された命令はキャンセルされた命令で
あり、命令アドレスレジスタ808の出力のうち網掛さ
れていないアドレスが命令ストリームの流れである。こ
こで、命令は割り込みによってキャンセルされてお
り、本来命令が実行する動作をせずに、命令アドレス
レジスタ806のステージにおいて命令アドレスを割
り込みハンドラアドレスである2000に設定する
()。
In FIG. 3, an instruction (jmp1000) is an instruction for setting the instruction address to 1000, and the instruction address is changed at the stage of the instruction address register 806 (). The instruction (normal) has an instruction address corresponding to 1000, and starts executing after the instruction sets the instruction address to 1000, but the instruction is canceled because an interrupt is input. The shaded instructions in FIG. 3 are canceled instructions, and the non-shaded addresses of the output of the instruction address register 808 are the flow of the instruction stream. Here, the instruction has been canceled by the interrupt, and the instruction address is set to 2000, which is the interrupt handler address, at the stage of the instruction address register 806 without performing the operation originally performed by the instruction ().

【0092】このようにして図3においては、ジャンプ
命令である命令のアドレス0002がトレースメモリ
126に書き込まれ、命令の実行中に入力された割り
込みによって、アドレス0002がトレースメモリ1
26に書き込まれる。
In FIG. 3, address 0002 of the instruction which is a jump instruction is written in trace memory 126, and address 0002 is stored in trace memory 1 by an interrupt input during execution of the instruction.
26.

【0093】(3)トレースメモリの内容を読み出す場
合の動作を説明する。図4はトレースメモリの読み出し
動作を示すタイミングチャートである。第1の実施例で
は、命令によってマイクロプロセッサ101内部のトレ
ースメモリ126を読み出すことができる。トレースメ
モリ読み出し命令は、キャッシュメモリ803から命令
バス819を介してトレースメモリ読み出し検出手段1
02に入力される。トレースメモリ読み出し検出手段1
02は、トレースメモリ読み出し命令を検出するとトレ
ースメモリアドレスセット選択信号線124を適切なタ
イミングでトレースメモリアドレス選択手段115に出
力する。トレースメモリアドレス選択手段115は、ト
レースメモリアドレスセット選択信号線124がアクテ
ィブであれば、実行資源812の出力を保持している結
果レジスタ813の出力を選択し、トレースメモリアド
レスレジスタ114にその値を保持させる。
(3) The operation for reading the contents of the trace memory will be described. FIG. 4 is a timing chart showing the read operation of the trace memory. In the first embodiment, the instruction can read the trace memory 126 inside the microprocessor 101. The trace memory read instruction is sent from the cache memory 803 via the instruction bus 819 to the trace memory read detection unit 1.
It is input to 02. Trace memory read detection means 1
02 detects the trace memory read command and outputs the trace memory address set selection signal line 124 to the trace memory address selection means 115 at an appropriate timing. If the trace memory address set selection signal line 124 is active, the trace memory address selection means 115 selects the output of the result register 813 holding the output of the execution resource 812, and stores the value in the trace memory address register 114. Hold.

【0094】図4において、命令(readTM4r
2)はトレースメモリを読み出す命令であり、トレース
メモリのアドレス4の内容を読み出して、r2で示され
るレジスタに格納する。この動作は命令が命令アドレ
スレジスタ808から出力されるときに実行され、この
サイクル中にr2で示されるレジスタに格納される。こ
のように、命令レジスタ808から出力されるまで命令
を読み出さないことによって、直前の命令で起こった
トレース結果を正常にトレースメモリに書き込み、また
読み出すことができる。
In FIG. 4, the instruction (readTM4r
2) is an instruction to read the trace memory, which reads the content of address 4 of the trace memory and stores it in the register indicated by r2. This operation is performed when the instruction is output from the instruction address register 808, and is stored in the register indicated by r2 during this cycle. In this way, by not reading the instruction until it is output from the instruction register 808, the trace result generated by the immediately preceding instruction can be normally written in and read from the trace memory.

【0095】次のサイクルでは、トレースメモリ読み出
し検出手段102はトレースメモリ読み出し信号線12
9をアクティブにすると同時に、レジスタ書き込み選択
信号線108をアクティブにする。トレースメモリ12
6は、トレースメモリ読み出し信号線129がアクティ
ブになったのを受けて、トレースメモリアドレスレジス
タ114から出力されたアドレスによってトレースメモ
リ126の読み出しを行い、読み出したトレース結果を
トレースメモリ読み出しバス119に出力する。トレー
スメモリ読み出しバス119の出力は、レジスタ書き込
み信号選択手段109を経由し、結果書き込みバス82
2を介して内蔵レジスタ811に書き込まれる。
In the next cycle, the trace memory read detection means 102 sets the trace memory read signal line 12
At the same time when 9 is activated, the register write selection signal line 108 is activated. Trace memory 12
In response to the activation of the trace memory read signal line 129, the reference numeral 6 reads the trace memory 126 by the address output from the trace memory address register 114, and outputs the read trace result to the trace memory read bus 119. To do. The output of the trace memory read bus 119 passes through the register write signal selecting means 109, and the result write bus 82
2 is written to the built-in register 811.

【0096】また内蔵レジスタ811に格納されたトレ
ースメモリ126の読み出し結果はマイクロプロセッサ
101によって自由に処理や加工ができるので、図6に
示したような従来のICE906内部のスーパバイザマ
イクロプロセッサ905によって実現していた機能等
を、マイクロプロセッサ101単体で実現することがで
きる。マイクロプロセッサ101においてスーパバイザ
マイクロプロセッサ905の機能を実現したときの結果
は、マイクロプロセッサ101内部にある接続手段12
5を介して外部出力手段127に伝達される。外部出力
手段127の出力を観測することによって、命令トレー
スの詳細を知ることができる。
Since the read result of the trace memory 126 stored in the internal register 811 can be freely processed and processed by the microprocessor 101, it is realized by the supervisor microprocessor 905 in the conventional ICE 906 as shown in FIG. The functions and the like that have been used can be realized by the microprocessor 101 alone. The result of realizing the function of the supervisor microprocessor 905 in the microprocessor 101 is obtained by the connection means 12 in the microprocessor 101.
5 to the external output means 127. By observing the output of the external output means 127, the details of the instruction trace can be known.

【0097】[第2の実施例]図5は本発明の第2の実
施例の構成を示す図であり、正確な命令トレースを実現
する2並列のスーパスケーラの例である。第2の実施例
では、キャッシュメモリ803を内蔵してパイプライン
処理を行い、かつスーパスケーラ手法を採用しているマ
イクロプロセッサ701に応用する。
[Second Embodiment] FIG. 5 is a diagram showing the configuration of the second embodiment of the present invention, which is an example of a two parallel superscalar for realizing an accurate instruction trace. The second embodiment is applied to the microprocessor 701 which incorporates the cache memory 803 for pipeline processing and adopts the superscalar method.

【0098】従来のスーパスケーラプロセッサでは、特
に命令の非順序実行をサポートしているものにおいて
は、命令の実行順序がダイナミックに変化するために命
令トレースは非常に困難であった。
In the conventional superscalar processor, especially in those supporting out-of-order execution of instructions, instruction tracing has been extremely difficult because the execution order of instructions dynamically changes.

【0099】図5の構成において、図1の構成と同様の
部分には同じ符号を付し、異なる部分のみ説明する。
In the configuration of FIG. 5, the same parts as those in FIG. 1 are denoted by the same reference numerals, and only different parts will be described.

【0100】図5に示したマイクロプロセッサ701は
2組のパイプライン構成を有しており、同時に2つの命
令を実行することができる。具体的には図1に示した第
1の実施例の構成に加えて、次命令アドレスレジスタ7
02および703と、命令アドレスレジスタ707ない
し710と、実行終了命令アドレスレジスタ711と、
トレースアドレス選択手段712と、終了判定手段71
6と、終了判定手段716から出力されて実行終了命令
アドレスレジスタ711に入力されるレジスタ書き込み
許可信号線715と、実行資源717と、結果レジスタ
718とを有する構成となっている。また、命令イシュ
手段706と、トレースアドレス選択手段713とを有
しており、トレースアドレス決定手段111からはトレ
ースアドレス選択信号線714が出力されてトレースア
ドレス選択手段713に入力され、トレースアドレス選
択手段712の出力と128の出力とを選択して出力す
る。さらに、命令バス704および命令デコーダ705
は、図1に示した第1の実施例の命令バス819および
命令デコーダ810に相当するが、バス幅が大きく、一
度に2つの命令を扱うことができる。
The microprocessor 701 shown in FIG. 5 has two sets of pipeline configurations and can execute two instructions at the same time. Specifically, in addition to the configuration of the first embodiment shown in FIG.
02 and 703, instruction address registers 707 to 710, an execution end instruction address register 711,
Trace address selection means 712 and end determination means 71
6, a register write enable signal line 715 output from the end determination unit 716 and input to the execution end instruction address register 711, an execution resource 717, and a result register 718. It also has instruction issue means 706 and trace address selection means 713. Trace address selection signal line 714 is output from trace address determination means 111 and input to trace address selection means 713, and trace address selection means The output of 712 and the output of 128 are selected and output. Further, the instruction bus 704 and the instruction decoder 705.
Corresponds to the instruction bus 819 and the instruction decoder 810 of the first embodiment shown in FIG. 1, but has a large bus width and can handle two instructions at a time.

【0101】アドレスインクリメンタ802によって生
成されたアドレスは、次命令アドレスレジスタ818を
経由してキャッシュメモリ803に入力される。キャッ
シュメモリ803内の該当するアドレスに蓄えられてい
る命令は、命令バス704を介して命令デコーダ705
に入力される。命令バス704は第1の実施例における
命令バス819と比較してバス幅が大きく、一度に2つ
の命令を命令デコーダ705に入力することができる。
このとき、命令デコーダ705に入力された命令に対応
するキャッシュメモリ上のアドレスは、次命令アドレス
レジスタ(フェッチポインタキュー)702、703、
および818に格納される。
The address generated by the address incrementer 802 is input to the cache memory 803 via the next instruction address register 818. The instruction stored at the corresponding address in the cache memory 803 is sent to the instruction decoder 705 via the instruction bus 704.
Entered in. The instruction bus 704 has a larger bus width than the instruction bus 819 in the first embodiment, and two instructions can be input to the instruction decoder 705 at one time.
At this time, the address in the cache memory corresponding to the instruction input to the instruction decoder 705 is the next instruction address register (fetch pointer queue) 702, 703,
And 818.

【0102】命令デコーダ705は入力された命令のう
ちから同時に実行可能な2命令を選択し、選択した命令
にしたがって実行資源717および812を同時に独立
して動作させる。このようにして、マイクロプロセッサ
701は1回の動作によって2命令の実行が可能とな
る。また、実行資源717で処理されている命令に対応
するキャッシュメモリ上のアドレスを命令アドレスレジ
スタ707に格納し、実行資源812で処理されている
命令に対応するキャッシュメモリ上のアドレスを命令ア
ドレスレジスタ805に格納する。さらに、命令アドレ
スレジスタ707および805に格納されているアドレ
スは、それらに対応する命令がマイクロプロセッサ70
1における処理に伴ってそれぞれ、命令レジスタ708
および806に入力され、命令レジスタ708および8
06のアドレスは命令レジスタ709および807に入
力され、命令レジスタ709および807の内容は命令
レジスタ710または実行終了命令アドレスレジスタ7
11、および命令レジスタ808または実行終了命令ア
ドレスレジスタ128に格納される。
The instruction decoder 705 selects two instructions that can be simultaneously executed from the input instructions, and operates the execution resources 717 and 812 independently at the same time according to the selected instructions. In this way, the microprocessor 701 can execute two instructions by one operation. Further, an address in the cache memory corresponding to the instruction processed by the execution resource 717 is stored in the instruction address register 707, and an address in the cache memory corresponding to the instruction processed by the execution resource 812 is stored in the instruction address register 805. To be stored. Further, in the addresses stored in the instruction address registers 707 and 805, the instructions corresponding to them are the microprocessor 70.
1 in the instruction register 708.
And 806, and input to instruction registers 708 and 8
06 is input to instruction registers 709 and 807, and the contents of instruction registers 709 and 807 are stored in instruction register 710 or execution end instruction address register 7.
11, and stored in the instruction register 808 or the execution end instruction address register 128.

【0103】このとき、格納された2命令のうちのどち
らかがトレースメモリ126に格納される条件を満足し
ている場合には、該当するパイプラインにおいて第1の
実施例と同様の処理を行う。この処理結果はトレースア
ドレス選択手段712または117から出力されるが、
トレースアドレス決定手段111から出力されるトレー
スアドレス選択信号線714によってトレースアドレス
選択手段713を切り替えて、トレースメモリ126に
格納される条件を満足しているパイプラインを選択して
トレースアドレスバス118に出力する。
At this time, if one of the stored two instructions satisfies the condition stored in the trace memory 126, the same processing as in the first embodiment is performed in the corresponding pipeline. . This processing result is output from the trace address selecting means 712 or 117,
The trace address selection means 713 is switched by the trace address selection signal line 714 output from the trace address determination means 111 to select a pipeline satisfying the conditions stored in the trace memory 126 and output to the trace address bus 118 I do.

【0104】また、格納された2つの命令がどちらもト
レースメモリ126に格納される条件を満足している場
合には、両方のパイプラインにおいて第1の実施例と同
様の処理を行う。トレースアドレス選択手段712およ
び117から出力される処理結果は、まず命令ストリー
ム上で前に位置する命令(先に実行されるべき命令)の
実行を行うパイプラインの処理結果をトレースアドレス
選択手段713で選択してトレースメモリ126に格納
する。続けてもう一方のパイプラインの処理結果をトレ
ースアドレス選択手段713で選択してトレースメモリ
126に格納する。
If the two stored instructions both satisfy the condition stored in the trace memory 126, the same processing as in the first embodiment is performed in both pipelines. The processing results output from the trace address selecting means 712 and 117 are firstly processed by the trace address selecting means 713 by using the processing result of the pipeline for executing the instruction located earlier on the instruction stream (the instruction to be executed first). Select and store in the trace memory 126. Subsequently, the processing result of the other pipeline is selected by the trace address selecting means 713 and stored in the trace memory 126.

【0105】このような構成および動作によって、命令
トレースが非常に困難な構成であるスーパスケーラプロ
セッサにおいてもリアルタイムに正確な命令トレースを
実現することができる。
With such a configuration and operation, an accurate instruction trace can be realized in real time even in a superscalar processor having a configuration in which instruction tracing is extremely difficult.

【0106】また、第2の実施例の構成は、2系列のパ
イプラインにおける2命令の同時実行時の命令トレース
に限らず、3系列以上の複数のパイプラインにおける3
つ以上の複数命令の同時実行時の命令トレースにも適用
することができる。
The configuration of the second embodiment is not limited to the instruction trace when two instructions are simultaneously executed in a two-series pipeline, but in a plurality of three-series or more pipelines.
It can also be applied to the instruction trace at the time of simultaneously executing one or more plural instructions.

【0107】[0107]

【発明の効果】以上説明したように本発明は、以下の効
果を有する。
As described above, the present invention has the following effects.

【0108】(1)マイクロプロセッサ内部に内蔵する
トレースメモリが小容量であっても、比較的長い期間の
割り込み等にも対応可能なリアルタイム命令トレースが
実現できるという効果を有する。
(1) Even if the trace memory built in the microprocessor has a small capacity, it is possible to realize a real-time instruction trace capable of handling an interrupt or the like for a relatively long period.

【0109】具体的には、分岐命令の頻度は大体8〜1
0命令に1命令の割合であることから、32wordの
トレースメモリを内蔵しておけば256命令から320
命令をトレースできる。従来であれば256wordの
メモリを内蔵しなければならないことを考えると、トレ
ースメモリの容量は8分の1で済む。またマイクロプロ
セッサでの分岐の発生時に分岐元アドレスと分岐先アド
レスをトレースメモリに格納していく方法に比較して
も、2分の1のトレースメモリの容量で同じ効果を得る
ことができる。
Specifically, the frequency of the branch instruction is approximately 8 to 1
Since the ratio of 0 instructions is 1 instruction, if a 32 word trace memory is built in, 256 instructions can be converted to 320 instructions.
You can trace instructions. Considering that a conventional 256 word memory must be built in, the capacity of the trace memory can be reduced to 1/8. In addition, the same effect can be obtained with a half trace memory capacity as compared with a method of storing the branch source address and the branch destination address in the trace memory when a branch occurs in the microprocessor.

【0110】トレースメモリの面積がマイクロプロセッ
サ全体の面積を占有する割合は比較的大きく、本発明に
よってマイクロプロセッサ全体の面積を小さくすること
ができるので、同程度の命令トレース機能をもったマイ
クロプロセッサの価格を下げることができるという効果
を有する。
The area of the trace memory occupies a relatively large area of the entire microprocessor, and the area of the entire microprocessor can be reduced by the present invention. It has the effect of reducing the price.

【0111】(2)さらに、割り込み動作(あるプログ
ラムカウンタでの命令をキャンセルし、割り込み処理の
開始アドレスへ制御を移す)の場合であっても、トレー
スメモリに格納されるアドレスはすべて実行済のアドレ
スが格納されることになり、従来スーパバイザマイクロ
プロセッサが実行していた処理を大幅に減らすことがで
きるという効果を有する。
(2) Further, even in the case of the interrupt operation (the instruction at a certain program counter is canceled and the control is transferred to the start address of the interrupt processing), all the addresses stored in the trace memory have already been executed. Since the address is stored, it is possible to significantly reduce the processing conventionally executed by the supervisor microprocessor.

【0112】(3)また、トレースメモリの内容をマイ
クロプロセッサが自由に操作できる内蔵レジスタに読み
出すことによって、従来スーパバイザマイクロプロセッ
サがしなければならなかったことを、マイクロプロセッ
サ自身に実行させることができるという効果を有する。
(3) By reading the contents of the trace memory into a built-in register that can be freely operated by the microprocessor, the microprocessor itself can execute what the supervisor microprocessor had to do conventionally. It has the effect of.

【0113】(4)さらに、ボード実装時のための外部
入出力手段の他に外部出力手段を備えることによって、
本発明のマイクロプロセッサによって処理したトレース
結果をボード実装用の外部入出力端子の電気的特性の劣
化なしに外部に伝達できるという効果を有する。
(4) Furthermore, by providing external output means in addition to external input / output means for mounting the board,
This has the effect that the trace result processed by the microprocessor of the present invention can be transmitted to the outside without deterioration of the electrical characteristics of the external input / output terminal for board mounting.

【0114】(5)これらの機能を活用することによっ
て、ボード上の資源に接続する外部端子にICEを接続
することなく、すなわちボード上の電気的特性を変化さ
せることなくトレースが実現でき、トレース結果をボー
ド上の資源を使うことなく専用の外部端子から取り出せ
るので、50MHz以上のボード周波数であっても安定
してリアルタイム命令トレースを実施できるという効果
を有する。
(5) By utilizing these functions, the trace can be realized without connecting the ICE to the external terminal connected to the resource on the board, that is, without changing the electrical characteristics on the board. Since the result can be taken out from the dedicated external terminal without using the resources on the board, there is an effect that the real-time instruction trace can be stably executed even at the board frequency of 50 MHz or more.

【0115】(6)並列のスーパスケーラ手法を採用し
ているマイクロプロセッサにおいても、複数系列のパイ
プラインのそれぞれが本発明の構成を有することによっ
て、リアルタイムに正確な命令トレースを実現すること
ができるという効果を有する。
(6) Even in a microprocessor adopting the parallel superscaler method, an accurate instruction trace can be realized in real time because each of a plurality of pipelines has the configuration of the present invention. It has the effect of.

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

【図1】本発明の第1の実施例の構成を示す図である。FIG. 1 is a diagram showing a configuration of a first exemplary embodiment of the present invention.

【図2】分岐命令実行時の動作を示すタイミングチャー
トである。
FIG. 2 is a timing chart showing an operation when a branch instruction is executed.

【図3】割り込み実行時の動作を示すタイミングチャー
トである。
FIG. 3 is a timing chart showing an operation at the time of executing an interrupt.

【図4】トレースメモリの読み出し動作を示すタイミン
グチャートである。
FIG. 4 is a timing chart showing a read operation of a trace memory.

【図5】本発明の第2の実施例の構成を示す図である。FIG. 5 is a diagram showing a configuration of a second exemplary embodiment of the present invention.

【図6】従来例の命令トレースを実現するマイクロプロ
セッサの構成を示す図である。
FIG. 6 is a diagram showing a configuration of a microprocessor that realizes a conventional instruction trace.

【符号の説明】[Explanation of symbols]

101、701、801 マイクロプロセッサ 102 トレースメモリ読み出し検出手段 103 分岐命令種類信号線 104 命令種類信号線 105 割り込み種類信号線 106 割り込み受け付け信号線 107 命令実行信号線 108 レジスタ書き込み選択信号線 109 レジスタ書き込み信号選択手段 110 終了命令アドレス書き込み信号線 111 トレースアドレス決定手段 112、716 終了判定手段 113 トレース検出手段 114 トレースメモリアドレスレジスタ 115 トレースメモリアドレス選択手段 116、714 トレースアドレス選択信号線 117、712、713 トレースアドレス選択手段 118 トレースアドレスバス 119 トレースメモリ読み出しバス 120 トレースメモリ書き込み信号線 121 トレースメモリアドレスインクリメンタ 122 トレースメモリアドレスインクリメント選択
信号線 123 トレースメモリアドレスホールド選択信号線 124 トレースメモリアドレスセット選択信号線 125 接続手段 126 トレースメモリ 127 外部出力手段 128、711 実行終了命令アドレスレジスタ 129 トレースメモリ読み出し信号線 702、703、818 次命令アドレスレジスタ 704、819 命令バス 705、810 命令デコーダ 706 命令イシュ手段 707、708、709、710、805、806、8
07、808 命令アドレスレジスタ 715 レジスタ書き込み許可信号線 717、812 実行資源 718、813、814 結果レジスタ 802 アドレスインクリメンタ 803 キャッシュメモリ 804 外部入出力手段 809 割り込み受け付け手段 811 内蔵レジスタ 815 アドレス端子 816 データ端子 817 命令フェッチ端子 820 割り込み入力端子 821 割り込み分岐アドレスバス 822 結果書き込みバス 823 メモリアクセスアドレスバス 824 メモリアクセスデータバス 901 アドレスバス 902 データバス 903 ICE(インサーキットエミュレータ)取り
込み手段 904 ICEトレースメモリ 905 スーパバイザマイクロプロセッサ 906 ICE 907 トレース結果 908 データバス接続手段 909 アドレスバス接続手段 910 命令フェッチ信号接続手段 911 出力手段 912 ボードシステム
101, 701, 801 Microprocessor 102 Trace memory read detection means 103 Branch instruction type signal line 104 Instruction type signal line 105 Interrupt type signal line 106 Interrupt acceptance signal line 107 Instruction execution signal line 108 Register write selection signal line 109 Register write signal selection Means 110 End instruction address write signal line 111 Trace address determination means 112,716 End judgment means 113 Trace detection means 114 Trace memory address register 115 Trace memory address selection means 116,714 Trace address selection signal lines 117, 712, 713 Trace address selection Means 118 Trace address bus 119 Trace memory read bus 120 Trace memory write signal line 121 Trace memory Readdress incrementer 122 Trace memory address increment selection signal line 123 Trace memory address hold selection signal line 124 Trace memory address set selection signal line 125 Connection means 126 Trace memory 127 External output means 128,711 Execution end instruction address register 129 Trace memory read Signal lines 702, 703, 818 Next instruction address registers 704, 819 Instruction buses 705, 810 Instruction decoder 706 Instruction issue means 707, 708, 709, 710, 805, 806, 8
07,808 Instruction address register 715 Register write enable signal line 717,812 Execution resource 718,813,814 Result register 802 Address incrementer 803 Cache memory 804 External input / output means 809 Interrupt acceptance means 811 Internal register 815 Address terminal 816 Data terminal 817 Instruction fetch terminal 820 Interrupt input terminal 821 Interrupt branch address bus 822 Result write bus 823 Memory access address bus 824 Memory access data bus 901 Address bus 902 Data bus 903 ICE (in-circuit emulator) fetching means 904 ICE trace memory 905 Supervisor microprocessor 906 ICE 907 Trace result 908 Data bus connection means 9 9 Address bus connection means 910 instruction fetch signal connection means 911 output unit 912 Board System

Claims (6)

【特許請求の範囲】[Claims] 【請求項1】 内蔵レジスタと、実行資源と、割り込み
受け付け手段と、次命令のアドレスを計算する命令カウ
ンタと、命令デコード手段と、外部入出力手段と、トレ
ースメモリとを備え、キャッシュメモリを内蔵してパイ
プライン処理を行うマイクロプロセッサにおいて、 直前に実行が終了した命令のプログラムカウンタの値を
確保する第1の確保手段と、 現在実行している命令の該プログラムカウンタの値を確
保する第2の確保手段と、 該第1および第2の確保手段の出力のうちのどちらか1
つを選択する第1の選択手段と、 該内蔵レジスタの内容を出力する外部出力手段とを有
し、 該トレースメモリが該第1の選択手段の出力を格納する
ことを特徴とする、トレースメモリ内蔵マイクロプロセ
ッサ。
1. An internal register, an execution resource, an interrupt acceptance unit, an instruction counter for calculating the address of the next instruction, an instruction decoding unit, an external input / output unit, a trace memory, and a cache memory. In a microprocessor that performs pipeline processing, a first securing unit that secures a value of a program counter of an instruction that has just been executed, and a second securing unit that secures a value of the program counter of an instruction that is currently being executed. Securing means and one of the outputs of the first and second securing means
Trace memory, comprising: first selection means for selecting one; and external output means for outputting the contents of the built-in register, wherein the trace memory stores an output of the first selection means. Built-in microprocessor.
【請求項2】 前記トレースメモリから出力されるトレ
ース結果と前記実行資源の出力とのうちのどちらか1つ
を選択する第2の選択手段を有し、 該第2の選択手段の出力が前記内蔵レジスタの書き込み
端子に接続されている、請求項1に記載のトレースメモ
リ内蔵マイクロプロセッサ。
2. A second selection unit for selecting one of a trace result output from the trace memory and an output of the execution resource, wherein the output of the second selection unit is the output unit. The trace memory built-in microprocessor according to claim 1, which is connected to a write terminal of the built-in register.
【請求項3】 前記第1の選択手段が、 前記割り込み受け付け手段から出力される割り込み要求
信号によってプログラムの実行列が変化するときには前
記第1の確保手段が確保している値を選択して出力し、 プログラムの実行順序を変更する命令によってプログラ
ムの実行列が変化するときには前記第2の確保手段が確
保している値を選択して出力する、請求項1または2に
記載のトレースメモリ内蔵マイクロプロセッサを用いる
トレース方法。
3. When the execution sequence of a program changes according to an interrupt request signal output from the interrupt accepting unit, the first selecting unit selects and outputs a value secured by the first securing unit. 3. The micro-computer with a built-in trace memory according to claim 1, wherein a value secured by said second securing means is selected and output when an execution sequence of the program is changed by an instruction for changing a program execution order. Trace method using a processor.
【請求項4】 前記第1の選択手段が、 前記割り込み受け付け手段から出力される特定の割り込
み検出信号によってプログラムの実行列が変化するとき
には前記第2の確保手段が確保している値を選択して出
力し、 前記プログラムの実行順序を変更する命令によってプロ
グラムの実行列が変化するときには、前記命令デコード
手段から出力される特定命令検出信号にしたがって前記
第1の確保手段が確保している値を選択して出力する、
請求項1または2に記載のトレースメモリ内蔵マイクロ
プロセッサを用いるトレース方法。
4. The first selecting means selects a value secured by the second securing means when the execution sequence of the program is changed by a specific interrupt detection signal output from the interrupt accepting means. When the execution sequence of the program is changed by the instruction for changing the execution order of the program, the value secured by the first securing means is output according to the specific instruction detection signal output from the instruction decoding means. Select and output,
A trace method using the microprocessor with a built-in trace memory according to claim 1.
【請求項5】 前記第2の選択手段が、トレースメモリ
読み出し命令検出手段によって読み出し命令を検出した
ときには、前記トレース結果を選択して出力する、請求
項3または4に記載のトレース方法。
5. The tracing method according to claim 3, wherein the second selecting means selects and outputs the trace result when the read instruction is detected by the trace memory read instruction detecting means.
【請求項6】 前記外部出力手段が、前記内蔵レジスタ
の内容を外部に出力する、請求項3ないし5のいずれか
1項に記載のトレース方法。
6. The tracing method according to claim 3, wherein the external output means outputs the contents of the internal register to the outside.
JP6229888A 1994-09-26 1994-09-26 Microprocessor with built-in trace memory and trace method Expired - Fee Related JP2666737B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6229888A JP2666737B2 (en) 1994-09-26 1994-09-26 Microprocessor with built-in trace memory and trace method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6229888A JP2666737B2 (en) 1994-09-26 1994-09-26 Microprocessor with built-in trace memory and trace method

Publications (2)

Publication Number Publication Date
JPH0895945A true JPH0895945A (en) 1996-04-12
JP2666737B2 JP2666737B2 (en) 1997-10-22

Family

ID=16899294

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6229888A Expired - Fee Related JP2666737B2 (en) 1994-09-26 1994-09-26 Microprocessor with built-in trace memory and trace method

Country Status (1)

Country Link
JP (1) JP2666737B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6883117B2 (en) 2001-11-15 2005-04-19 International Business Machines Corporation Bus trace analysis a posteriori

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6883117B2 (en) 2001-11-15 2005-04-19 International Business Machines Corporation Bus trace analysis a posteriori

Also Published As

Publication number Publication date
JP2666737B2 (en) 1997-10-22

Similar Documents

Publication Publication Date Title
US7020871B2 (en) Breakpoint method for parallel hardware threads in multithreaded processor
US6959367B2 (en) System having read-modify-write unit
JPH0689174A (en) Computer memory system
JP2001525568A (en) Instruction decoder
US10073797B2 (en) Data processor device supporting selectable exceptions and method thereof
US6189093B1 (en) System for initiating exception routine in response to memory access exception by storing exception information and exception bit within architectured register
JP2535252B2 (en) Parallel processor
JPH07120338B2 (en) Method for a data processor to coordinate the execution of instructions by a coprocessor and the data processor
EP1770507A2 (en) Pipeline processing based on RISC architecture
US7831979B2 (en) Processor with instruction-based interrupt handling
US5287522A (en) External procedure invocation apparatus utilizing internal branch vector interrupts and vector address generation, in a RISC chip
JP2666737B2 (en) Microprocessor with built-in trace memory and trace method
JP2004192021A (en) Microprocessor
US6990569B2 (en) Handling problematic events in a data processing apparatus
JP2003263313A (en) Digital processor and method of selecting command
US7130988B2 (en) Status register update logic optimization
JPH05241827A (en) Command buffer controller
JP5012562B2 (en) Microcomputer
US8417924B2 (en) Data processing device and method of halting exception processing
JP3112861B2 (en) Microprocessor
JPH087713B2 (en) Microprocessor
US7124281B1 (en) Processing system having sequential address indicator signals
JPH08171505A (en) Semiconductor device
JP3900660B2 (en) Sequence controller
JP2817675B2 (en) Program debug device

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees