JPH0736736A - Microprocessor - Google Patents
MicroprocessorInfo
- Publication number
- JPH0736736A JPH0736736A JP5178921A JP17892193A JPH0736736A JP H0736736 A JPH0736736 A JP H0736736A JP 5178921 A JP5178921 A JP 5178921A JP 17892193 A JP17892193 A JP 17892193A JP H0736736 A JPH0736736 A JP H0736736A
- Authority
- JP
- Japan
- Prior art keywords
- instruction
- address
- instructions
- signal
- fetched
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000012790 confirmation Methods 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 9
- 238000000034 method Methods 0.000 description 5
- 238000012937 correction Methods 0.000 description 2
- 230000010365 information processing Effects 0.000 description 2
- 238000007796 conventional method Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
Landscapes
- Advance Control (AREA)
- Debugging And Monitoring (AREA)
- Microcomputers (AREA)
Abstract
Description
【0001】[0001]
【産業上の利用分野】本発明は情報処理装置に関し、特
にトレース装置により動作が監視されるマイクロプロセ
ッサに関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an information processing device, and more particularly to a microprocessor whose operation is monitored by a trace device.
【0002】[0002]
【従来の技術】マイクロプロセッサなどの情報処理装置
のプログラムをデバッグする際、そのデバッグ効率を上
げるため、プログラムの実行をトレースする装置を用い
ることがある。これは、マイクロプロセッサが命令を実
行する場合には必ずその命令を主記憶から取り込むこと
(命令フェッチ)を利用し、主記憶に対するアドレス指
定と命令取り込みのステータス信号を監視して命令の動
的な実行順序を出力するものである(ただし、キャッシ
ュメモリを使ったシステムの場合は命令アドレスが主記
憶に対して出力されない場合もあるため、ここではキャ
ッシュメモリを使わないシステムを考える)。2. Description of the Related Art When debugging a program of an information processing device such as a microprocessor, a device for tracing the execution of the program is sometimes used in order to improve the debugging efficiency. This utilizes the fact that whenever a microprocessor executes an instruction, it fetches the instruction from the main memory (instruction fetch), and monitors the address signal to the main memory and the status signal of the instruction fetch to dynamically execute the instruction. It outputs the order of execution (however, if the system uses a cache memory, the instruction address may not be output to the main memory, so consider a system that does not use a cache memory here).
【0003】また、主記憶から取り込む効率を上げるた
め、一度に複数の命令をフェッチしてマイクロプロセッ
サの性能を向上させる手法がある。例えば、データバス
が32ビットのマイクロプロセッサの場合、一つの命令
の長さを32ビットにすると一回の命令フェッチで一つ
の命令しか取り込めないが、命令の長さを16ビットに
すれば一回の命令フェッチで二つの命令を取り込めるこ
とになり、命令フェッチの効率が上がる。Further, there is a method of improving the performance of the microprocessor by fetching a plurality of instructions at once in order to increase the efficiency of fetching from the main memory. For example, if the data bus is a 32-bit microprocessor, if one instruction length is 32 bits, only one instruction can be fetched by one instruction fetch, but if the instruction length is 16 bits, one instruction fetch is performed. Two instructions can be fetched by this instruction fetch, and the efficiency of instruction fetch is improved.
【0004】ところが、前記の命令フェッチを使ったト
レース装置をこのような一度に複数の命令をフェッチす
るプロセッサに応用しようとした場合には問題点が発生
する。However, a problem arises when the trace device using the above-mentioned instruction fetch is applied to such a processor that fetches a plurality of instructions at once.
【0005】この問題点について従来例を用いて以下に
説明する。This problem will be described below using a conventional example.
【0006】図4は従来のマイクロプロセッサにトレー
ス装置を接続した例を示す図である。図中、401はマ
イクロプロセッサ(以下MPUと呼ぶ)、402は主記
隠装置(以下メモリと呼ぶ)、403はトレース装置、
404は30ビット幅のアドレスバス、405は32ビ
ット幅のデータバス、406はMPU401がバスサイ
クルを発行していることを示すBUSCY信号、407
はMPU401が出力しているバスサイクルの種類を示
すBUSST信号、408はMPU401が出力してい
るバスサイクルが読み出しであるか書き込みであるかを
示すR/W信号である。FIG. 4 is a diagram showing an example in which a trace device is connected to a conventional microprocessor. In the figure, 401 is a microprocessor (hereinafter referred to as MPU), 402 is a main hidden device (hereinafter referred to as memory), 403 is a trace device,
404 is a 30-bit wide address bus, 405 is a 32-bit wide data bus, 406 is a BUSCY signal indicating that the MPU 401 is issuing a bus cycle, 407.
Is a BUSST signal indicating the type of bus cycle output by the MPU 401, and 408 is an R / W signal indicating whether the bus cycle output by the MPU 401 is read or write.
【0007】MPU401がメモリ402に格納されて
いる命令やデータを読み出し、もしくは書き込むため
に、アドレスバス404に目的のアドレスを乗せ、メモ
リ402がデータバス405に乗せた読み出しデータを
MPU401に取り込み、またはメモリ402に書き込
むデータをデータバス405に乗せることを、バスサイ
クルを発行するという。In order for the MPU 401 to read or write an instruction or data stored in the memory 402, a target address is put on the address bus 404, and the read data put on the data bus 405 by the memory 402 is fetched to the MPU 401, or Putting data to be written in the memory 402 on the data bus 405 is called issuing a bus cycle.
【0008】本従来例のシステムではBUSCY信号4
06が1を出力している期間、バスサイクルが有効であ
る。In the conventional system, the BUSCY signal 4
The bus cycle is valid while 06 outputs 1.
【0009】また、発行しているバスサイクルが命令フ
ェッチのためのものかデータアクセスのためのものかを
区別するためにBUSCY信号406に同期して変化す
るBUSST信号407を用いる。BUSST信号40
7が0の場合はそのバスサイクルがデータアクセスのた
めのものであることを示し、1の場合は命令フェッチの
ためのものであることを示す。A BUSST signal 407 that changes in synchronization with the BUSCY signal 406 is used to distinguish whether the bus cycle being issued is for instruction fetch or for data access. BUSST signal 40
When 7 is 0, the bus cycle is for data access, and when 1 is 1, it is for instruction fetch.
【0010】さらに、バスサイクルがデータアクセスの
場合に読み出しか書き込みかを区別するため、MPU4
01はR/W信号408を出力する。R/W信号408
が0の場合は書き込みを示し、1の場合は読み出しを示
す。Further, in order to distinguish whether the bus cycle is a data access or a read, the MPU4
01 outputs the R / W signal 408. R / W signal 408
When is 0, it indicates writing, and when it is 1, it indicates reading.
【0011】本従来例のシステムは1バイトごとにアド
レスが割り振られるバイトアドレッシングであり、32
ビットのアドレスによる4Gバイトのアドレス空間を持
つ。ただし、データバス405は32ビット幅あるた
め、一度に4バイトのデータをアクセスすることにな
る。よって32ビットアドレスの下位2ビットはメモリ
402に対して指定する必要がないため、アドレスバス
404は30ビット幅となっている。以降、4バイトの
データをひとまとめにしたものをワードデータと呼ぶ。
また、[0000 0004H],[1234 5678H],[FFFF FFFC
H]など、4の倍数になるアドレスをワード境界アドレ
ス、[9876 5432H],[0000 ABCEH]など、アドレスが
4の倍数+2になるアドレスをハーフワード境界アドレ
スと呼ぶ。The system of this conventional example is byte addressing in which an address is assigned for each byte.
It has an address space of 4 GB by a bit address. However, since the data bus 405 has a width of 32 bits, data of 4 bytes is accessed at one time. Therefore, since the lower 2 bits of the 32-bit address do not need to be designated to the memory 402, the address bus 404 has a width of 30 bits. Hereinafter, a group of 4-byte data will be referred to as word data.
In addition, [0000 0004H], [1234 5678H], [FFFF FFFC
Addresses that are multiples of 4 such as [H] are called word boundary addresses, and addresses that are multiples of 4 and +2, such as [9876 5432H] and [0000 ABCEH], are called halfword boundary addresses.
【0012】MPU401が出力する命令は16ビット
固定長である。これに対し、データバス405は32ビ
ット幅であるため、1回の命令フェッチで二つの命令を
同時にMPU401に取り込むことができる。The instruction output by the MPU 401 has a fixed length of 16 bits. On the other hand, since the data bus 405 has a width of 32 bits, two instructions can be simultaneously fetched into the MPU 401 by one instruction fetch.
【0013】トレース装置403はMPU401が出力
するアドレスバス404,BUSCY信号406,BU
SST信号407を監視し、命令フェッチバスサイクル
の有無から命令がどのような順序でMPU401により
実行されているかを検出する付加装置である。The trace device 403 has an address bus 404 output by the MPU 401, a BUSCY signal 406, and a BU.
It is an additional device that monitors the SST signal 407 and detects the order in which the instructions are executed by the MPU 401 from the presence or absence of an instruction fetch bus cycle.
【0014】このようなマイクロプロセッサシステム
が、図5に示すプログラムを実行した場合の動作を図6
および図7に示す。FIG. 6 shows the operation when such a microprocessor system executes the program shown in FIG.
And shown in FIG.
【0015】まず、図5のプログラムについて説明す
る。First, the program shown in FIG. 5 will be described.
【0016】このプログラムはレジスタの内容により複
数の分岐先へ分岐させるマルチウェイブランチの例であ
る。This program is an example of a multi-way branch that branches to a plurality of branch destinations according to the contents of the register.
【0017】あらかじめレジスタr1に入れられた0か
ら3までの値により、[0000 0000H]番地,[0000 000
2H]番地,[0000 0004H]番地,[0000 0006H]番地の
いずれかに分岐する。Depending on the value from 0 to 3 stored in the register r1 in advance, the addresses [0000 0000H], [0000 000
2H], [0000 0004H], or [0000 0006H].
【0018】まず[0000 0100H]番地の[mov #2,r2]
命令により、レジスタr2に定数2が代入される。続い
て[0000 0102H]番地の[mul r1,r2]命令により、レ
ジスタr1とレジスタr2の乗算が行われ、結果がレジ
スタr2に格納される。ここではレジスタr2は定数2
であるため、レジスタr1の内容が二倍されてレジスタ
r2に入ることになる。First, [mov # 2, r2] at the address [0000 0100H]
The instruction substitutes the constant 2 in the register r2. Subsequently, the [mul r1, r2] instruction at the address [0000 0102H] multiplies the registers r1 and r2 and stores the result in the register r2. Here, the register r2 is a constant 2
Therefore, the content of the register r1 is doubled and then stored in the register r2.
【0019】この乗算により分岐先のアドレスが計算さ
れ、[0000 0104H]番地の[jmp [r2]]命令により、レ
ジスタr2が示すアドレスへ分岐する。レジスタr1の
内容が0だった場合には[0000 0000H]番地,1だった
場合には[0000 0002H]番地,というように複数の分岐
先への分岐が一つの分岐命令で実現される。By this multiplication, the branch destination address is calculated, and the [jmp [r2]] instruction at the address [0000 0104H] branches to the address indicated by the register r2. If the content of the register r1 is 0, the address is [0000 0000H], and if the content is 1, the address is [0000 0002H].
【0020】このプログラムを図4に示した装置で実行
する場合、一つの命令フェッチに二つの命令が含まれる
ため、分岐が発生した場合に外部からのバスサイクル観
測だけでは分岐先としてどちらの命令が実行されたかを
特定できないという問題点がある。この問題点について
図6および図7を用いて以下に説明する。When this program is executed by the apparatus shown in FIG. 4, one instruction fetch includes two instructions. Therefore, when a branch occurs, only the instruction of the bus cycle from the outside determines which instruction as the branch destination. There is a problem that it is not possible to determine whether or not was executed. This problem will be described below with reference to FIGS. 6 and 7.
【0021】外部から観測できる命令フェッチバスサイ
クルと、内部の命令実行とを時間順に並べて図示したも
のが図6と図7である。FIG. 6 and FIG. 7 show the instruction fetch bus cycle that can be observed from the outside and the internal instruction execution arranged side by side in chronological order.
【0022】まず、レジスタr1の値が0だった場合の
動作を図6に示す。First, the operation when the value of the register r1 is 0 is shown in FIG.
【0023】図5に示したプログラムにおける[0000 0
100H]番地の[mov #2,r2]命令を実行するため、まず
MPU401は、[0000 0100H]番地から[0000 0103
H]番地までの4バイトを命令フェッチバスサイクルを
発行してメモリ402から取り込む(501)。一つの
命令の長さは16ビットであるため、この4バイトには
二つ分の命令が含まれている。よってMPU401の内
部では[0000 0100H]番地の[mov #2,r2]命令と[000
0 0102H]番地の[mul r1,r2]命令が続けて実行される
(502,503)。図6に示すレジスタr1の初期値
は0であるため、乗算後のレジスタr2の値も0であ
る。[0000 0 in the program shown in FIG.
In order to execute the [mov # 2, r2] instruction of the address [100H], the MPU 401 first moves from the address [0000 0100H] to [0000 0103].
An instruction fetch bus cycle is issued to fetch 4 bytes up to the address H] from the memory 402 (501). Since the length of one instruction is 16 bits, this 4 bytes contains two instructions. Therefore, inside the MPU401, the [mov # 2, r2] instruction at the address [0000 0100H] and [000
[0102H] The [mul r1, r2] instruction at the address is continuously executed (502, 503). Since the initial value of the register r1 shown in FIG. 6 is 0, the value of the register r2 after multiplication is also 0.
【0024】次に、MPU401は[0000 0104H]番地
の[jmp [r2]]命令を実行するため、[0000 0104H]番
地から[0000 0107H]番地までの4バイトをフェッチす
る(504)。この4バイトにも二つの命令が含まれて
いるが、一つ目の命令が無条件分岐命令であるため、二
つ目のnop命令は実行されることなく読み捨てられ
る。Next, since the MPU 401 executes the [jmp [r2]] instruction at the address [0000 0104H], it fetches 4 bytes from the address [0000 0104H] to the address [0000 0107H] (504). Although these 4 bytes also include two instructions, the first instruction is an unconditional branch instruction, so the second nop instruction is not executed and is discarded.
【0025】レジスタr2が0であるため、[jmp [r
2]]命令の実行によりプログラムの実行は[0000 0000
H]番地へ分岐する(505)。MPU401は[0000
0000H]番地にある[命令A]を実行するため、[0000
0000H]番地から[0000 0003H]番地までの4バイトを
フェッチする(506)。[命令A]と[命令B]が連
続して実行された後(507,508)、再び命令フェ
ッチにより二命令を取り込み、連続して実行する、とい
う動作を繰り返す。Since register r2 is 0, [jmp [r
2]] Execution of the command causes the execution of the program to be [0000 0000
H] Branch to the address (505). MPU401 is [0000
[Instruction A] at address [0000H] is executed, so [0000
Four bytes from the address [0000H] to the address [0000 0003H] are fetched (506). After [instruction A] and [instruction B] are continuously executed (507, 508), two operations are fetched again by instruction fetch and continuously executed, which is repeated.
【0026】次にレジスタr1の内容が1だった場合の
動作を図7に示す。Next, the operation when the content of the register r1 is 1 is shown in FIG.
【0027】[0000 0104H]番地の[jmp [r2]]命令を
実行するところまでは図6と同様であるが、レジスタn
の初期値が1であるため、乗算結果であるレジスタr2
の値は2となっており、[jmp [r2]]命令の分岐先は
[0000 0002H]番地になる。The procedure up to the point where the [jmp [r2]] instruction at the address [0000 0104H] is executed is the same as in FIG.
Since the initial value of is 1, the multiplication result of register r2
Is 2, and the branch destination of the [jmp [r2]] instruction is the address [0000 0002H].
【0028】MPU401は[0000 0002H]番地にある
[命令B]を実行するため、[命令B]が格納されてい
るアドレスをフェッチしようとする。ところがMPU4
01は32ビットバスで二命令を同時に取り込むため、
[命令B]は[命令A]と共に[0000 0000H]番地から
[0000 0003H]番地までの4バイトに対する命令フェッ
チで取り込まれ、[命令A]は読み捨てられることにな
る(516)。Since the MPU 401 executes the [instruction B] at the address [0000 0002H], it tries to fetch the address in which the [instruction B] is stored. However, MPU4
01 is a 32-bit bus that fetches two instructions at the same time,
[Instruction B] is fetched together with [Instruction A] by instruction fetch for 4 bytes from [0000 0000H] to [0000 0003H], and [Instruction A] is discarded (516).
【0029】この命令フェッチの後[命令B]が実行さ
れ(518)、以降は図6と同様に命令フェッチにより
二命令を取り込み、連続して実行する、という動作を繰
り返す。After this instruction fetch, the [instruction B] is executed (518), and thereafter, the operation of fetching two instructions by the instruction fetch and continuously executing the same is repeated as in FIG.
【0030】ここでトレース装置403による命令実行
トレースに問題が発生する。図6と図7からわかるよう
に、これら二つの例では内部動作が異なるにも関わらず
命令フェッチバスサイクルはまったく同じように発行さ
れている。トレース装置403は命令フェッチバスサイ
クルに基づいて実行命令の順序を決めるため、図6また
は図7のバスサイクル列だけでは[0000 0000H]番地に
ある[命令A]が実行されたか否かが判定できない。Here, a problem occurs in the instruction execution trace by the trace unit 403. As can be seen from FIGS. 6 and 7, the instruction fetch bus cycles are issued in the same manner in these two examples, although the internal operations are different. Since the trace unit 403 determines the order of the execution instructions based on the instruction fetch bus cycle, it is not possible to judge whether the [instruction A] at the address [0000 0000H] has been executed only by the bus cycle sequence of FIG. 6 or 7. .
【0031】[0031]
【発明が解決しようとする課題】命令フェッチバスサイ
クルを外部から監視することにより命令実行順序を出力
するトレース装置を、1バスサイクルで複数の命令を取
り込むマイクロプロセッサに用いた場合には、取り込ま
れた命令をすべて実行するのか一部を実行するのかをバ
スサイクルだけでは判断できないため、分岐命令の正確
なトレースが不可能になってしまい、マイクロプロセッ
サの動作の監視をトレース装置が正確に行うことができ
ないよいう問題点がある。When a trace device which outputs an instruction execution order by externally monitoring an instruction fetch bus cycle is used in a microprocessor which fetches a plurality of instructions in one bus cycle, the trace device is fetched. Since it is not possible to determine whether all or some of the instructions that have been executed are executed only by the bus cycle, it becomes impossible to accurately trace the branch instruction, and the trace device accurately monitors the operation of the microprocessor. There is a problem that can not be done.
【0032】本発明は上述したような従来の技術が有す
る問題点に鑑みてなされたものであって、分岐命令があ
った場合にもその動作の確認を行うことができるマイク
ロプロセッサを実現することを目的とする。The present invention has been made in view of the problems of the above-mentioned conventional technique, and realizes a microprocessor capable of confirming the operation even when there is a branch instruction. With the goal.
【0033】[0033]
【課題を解決するための手段】本発明のマイクロプロセ
ッサは、命令コードのアドレスを出力するアドレス指定
手段と、n×mビットの幅を持ち、n個のmビット長命
令を同時に取り込むことができる命令コード入力手段
と、前記コード入力手段により同時に取り込まれたn個
の命令のうちの一つを特定する分岐先命令通知手段を有
している。The microprocessor of the present invention has address specifying means for outputting an address of an instruction code and a width of n × m bits, and is capable of simultaneously fetching n m-bit length instructions. It has an instruction code input means and a branch destination instruction notification means for specifying one of the n instructions fetched simultaneously by the code input means.
【0034】[0034]
【作用】命令フェッチにより読み出された複数の命令の
うち、どの命令に対して分岐したかを通知するための信
号がマイクロプロセッサからトレース装置に出力される
ので、1バスサイクルで複数の命令を取り込むマイクロ
プロセッサの命令トレースが可能となる。Since a signal for notifying which instruction of the plurality of instructions read by the instruction fetch has branched is output from the microprocessor to the trace device, the plurality of instructions can be executed in one bus cycle. Enables instruction trace of the capturing microprocessor.
【0035】[0035]
【実施例】次に、本発明の実施例について図面を参照し
て説明する。Embodiments of the present invention will now be described with reference to the drawings.
【0036】図1は本発明の一実施例のマイクロプロセ
ッサにトレース装置を接続した例を示す図である。FIG. 1 is a diagram showing an example in which a trace device is connected to a microprocessor according to an embodiment of the present invention.
【0037】図中、101はマイクロプロセッサ(以下
MPUと呼ぶ)、102は主記憶装置(以下メモリと呼
ぶ)、103はトレース装置、104は30ビット幅の
アドレスバス、105は32ビット幅のデータバス、1
06はMPU401がバスサイクルを発行していること
を示すBUSCY信号、107はMPU401が発行し
ているバスサイクルの種類を示すBUSST信号、10
8はMPU401が発行しているバスサイクルが読み出
しであるか書き込みであるかを示すR/W信号、109
はハーフワード境界に分岐が発生したことをトレース装
置に通知するHWJMP信号である。In the figure, 101 is a microprocessor (hereinafter referred to as MPU), 102 is a main memory (hereinafter referred to as memory), 103 is a trace device, 104 is a 30-bit wide address bus, and 105 is 32-bit wide data. Bus, 1
Reference numeral 06 denotes a BUSCY signal indicating that the MPU 401 issues a bus cycle, 107 indicates a BUSST signal indicating the type of bus cycle issued by the MPU 401, 10
Reference numeral 8 is an R / W signal indicating whether the bus cycle issued by the MPU 401 is read or write, 109
Is a HWJMP signal that notifies the trace device that a branch has occurred at a halfword boundary.
【0038】メモリ102、アドレスバス104、デー
タバス105、BUSCY信号106、BUSSST信
号107およびR/W信号108までの構成要素はそれ
ぞれ図4に示した従来例におけるメモリ402、アドレ
スバス404、データバス405、BUSCY信号40
6、BUSSST信号407およびR/W信号408と
同様であるため、説明を省略する。The memory 102, the address bus 104, the data bus 105, the BUSCY signal 106, the BUSSST signal 107, and the R / W signal 108 are the components of the memory 402, the address bus 404, and the data bus in the conventional example shown in FIG. 405, BUSCY signal 40
6, the same as the BUSSST signal 407 and the R / W signal 408, and thus the description thereof is omitted.
【0039】本実施例におけるMPU101が出力する
HWJMP信号109は、分岐により命令フェッチが発
生した場合に分岐先により異なるものであり、その分岐
先がワード境界である場合には0、分岐先がハーフワー
ド境界である場合には1が出力され、その出力タイミン
グはBUSCY信号106と同じタイミングで出力され
る。The HWJMP signal 109 output by the MPU 101 in this embodiment differs depending on the branch destination when an instruction fetch occurs due to a branch. When the branch destination is a word boundary, it is 0, and the branch destination is half. If it is on a word boundary, 1 is output, and its output timing is output at the same timing as the BUSCY signal 106.
【0040】このようなマイクロプロセッサシステム
が、従来例の場合と同様に図5に示すプログラムを実行
した場合の動作を図2および図3に示す。2 and 3 show the operation when such a microprocessor system executes the program shown in FIG. 5 as in the case of the conventional example.
【0041】図5のプログラムについては、従来例で引
用したものと同じであり、従来例の項の中で説明してい
るため、ここでは説明を省略する。The program shown in FIG. 5 is the same as that cited in the conventional example, and since it has been described in the section of the conventional example, the description thereof is omitted here.
【0042】このプログラムを図1に示した装置で実行
する場合、ハーフワード境界への分岐を示すHWJMP
信号109により、トレース装置103はフェッチされ
たワード中に含まれる二つの命令のうち、どちらに分岐
したかを特定することができる。When this program is executed by the apparatus shown in FIG. 1, HWJMP indicating a branch to a halfword boundary
The signal 109 allows the trace unit 103 to specify which of the two instructions contained in the fetched word the branch has taken.
【0043】外部から観測できる命令フェッチバスサイ
クルと、レジスタr1の値が0および1である場合の内
部の命令実行とを時間順に並べてそれぞれ図示したもの
が図2および図3である。FIGS. 2 and 3 show the instruction fetch bus cycle that can be observed from the outside and the internal instruction execution when the values of the register r1 are 0 and 1, respectively, arranged in chronological order.
【0044】まず、レジスタr1の値が0だった場合の
動作を図2を参照して説明する。First, the operation when the value of the register r1 is 0 will be described with reference to FIG.
【0045】図5のプログラムにおける[0000 0100H]
番地の[mov #2,r2]命令を実行するため、まずMPU
101は[0000 0100H]番地から[0000 0103H]番地ま
での4バイトを命令フェッチバスサイクルを発行してメ
モリ102から取り込む(301)。一つの命令の長さ
は16ビットであるため、この4バイトには二つ分の命
令が含まれている。よってMPU101の内部では[00
00 0100H]番地の[mov #2,r2]命令と[0000 0102H]
番地の[mul r1,r2]命令が続けて実行される(30
2,303)。図2に示した例ではレジスタr2の初期
値は0であるため、乗算後のレジスタr2の値も0であ
る。[0000 0100H] in the program of FIG.
To execute the [mov # 2, r2] instruction at the address, first the MPU
101 issues an instruction fetch bus cycle to fetch 4 bytes from the address [0000 0100H] to the address [0000 0103H] from the memory 102 (301). Since the length of one instruction is 16 bits, this 4 bytes contains two instructions. Therefore, [00
[Mov # 2, r2] instruction at address 00 0100H] and [0000 0102H]
The [mul r1, r2] instruction at the address is continuously executed (30
2, 303). In the example shown in FIG. 2, since the initial value of the register r2 is 0, the value of the register r2 after multiplication is also 0.
【0046】次に、MPU101は[0000 0104H]番地
の[jmp [r2]]命令を実行するため、[0000 0104H]番
地から[0000 0107H]番地までの4バイトをフェッチす
る(304)。この4バイトにも二つの命令が含まれて
いるが、一つ目のの命令が無条件分岐命令であるため、
二つ目のnop命令は実行されることなく読み捨てられ
る。Next, since the MPU 101 executes the [jmp [r2]] instruction at the address [0000 0104H], it fetches 4 bytes from the address [0000 0104H] to the address [0000 0107H] (304). Two instructions are also included in these 4 bytes, but since the first instruction is an unconditional branch instruction,
The second nop instruction is discarded without being executed.
【0047】この後、レジスタr2が0であるため、
[jmp [r2]]命令の実行によりプログラムの実行は[00
00 0000H]番地へ分岐する(305)。MPU101は
[00000000H]番地にある[命令A]を実行するため、
[0000 0000H]番地から[00000003H]番地までの4バ
イトをフェッチする(306)。After this, since the register r2 is 0,
Executing the [jmp [r2]] instruction causes the program to be executed by [00
00 0000H] is branched to (305). Since the MPU 101 executes the [instruction A] at the address [00000000H],
Four bytes from the address [0000 0000H] to the address [00000003H] are fetched (306).
【0048】ここで、[jmp [r2]]命令による分岐先が
ハーフワード境界ではなく、ワード境界であるため、H
WJMP信号109はBUSCY信号106,BUSS
T信号107と同じタイミングで0を出力する(30
9)。この出力がアドレスバス104に乗ったフェッチ
アドレスと共にトレース装置103に入力され、トレー
ス装置103はその命令フェッチにより取り込まれた命
令がすべて実行されることを認識する。Here, since the branch destination of the [jmp [r2]] instruction is not a halfword boundary but a word boundary, H
WJMP signal 109 is BUSCY signal 106, BUSS
0 is output at the same timing as the T signal 107 (30
9). This output is input to the trace unit 103 together with the fetch address on the address bus 104, and the trace unit 103 recognizes that all the instructions fetched by the instruction fetch are executed.
【0049】MPU101では[命令A]と[命令B]
が連続して実行された後(307,308)、再び命令
フェッチにより二命令を取り込み、連続して実行すると
いう動作を繰り返す。[Instruction A] and [Instruction B] in the MPU 101
Are continuously executed (307, 308), two instructions are fetched again by instruction fetch, and the operations are continuously executed.
【0050】次に、レジスタrの内容が1だった場合の
動作を図3を参照して説明する。Next, the operation when the content of the register r is 1 will be described with reference to FIG.
【0051】[0000 0104H]番地の[jmp [r2]]命令を
実行するところまでは図2に示した場合と同様である
が、レジスタr2の初期値が1であるため、乗算結果で
あるレジスタ越の値は2となっており、[jmp [r2]]命
令の分岐先は[0000 0002H]番地になる。Up to the point where the [jmp [r2]] instruction at the address [0000 0104H] is executed, it is the same as the case shown in FIG. 2, but since the initial value of the register r2 is 1, the multiplication result register The value of the crossover is 2, and the branch destination of the [jmp [r2]] instruction is the address [0000 0002H].
【0052】MPU101は、[0000 0002H]番地にあ
る[命令B]を実行するため、[命令B]が格納されて
いるアドレスをフェッチしようとする。ところがMPU
101は32ビットバスで二命令を同時に取り込むた
め、[命令B]は[命令A]と共に[0000 0000H]番地
から[0000 0003H]番地までの4バイトに対する命令フ
ェッチで取り込まれ、[命令A]は読み捨てられること
になる(316)。Since the MPU 101 executes the [instruction B] at the address [0000 0002H], it tries to fetch the address where the [instruction B] is stored. However, MPU
Since 101 uses a 32-bit bus to fetch two instructions at the same time, [Instruction B] is fetched by instruction fetch for 4 bytes from [0000 0000H] to [0000 0003H] with [Instruction A], and [Instruction A] is It will be discarded (316).
【0053】ここで、[jmp [r2]]命令による分岐先が
ハーフワード境界であるため、HWJMP信号109は
BUSCY信号106,BUSST信号107と同じタ
イミングで1を出力する(319)。この出力がアドレ
スバス104に乗ったフェッチアドレスと共にトレース
装置103に入力され、トレース装置103はその命令
フェッチにより取り込まれた命令のうち、[0000 0000
H]番地にある[命令A]はMPU101において実行
されないことを認識する。Here, since the branch destination by the [jmp [r2]] instruction is the halfword boundary, the HWJMP signal 109 outputs 1 at the same timing as the BUSCY signal 106 and the BUSST signal 107 (319). This output is input to the trace unit 103 together with the fetch address on the address bus 104, and the trace unit 103 selects [0000 0000] from among the instructions fetched by the instruction fetch.
It is recognized that the [instruction A] at the address H] is not executed by the MPU 101.
【0054】上記の命令フェッチの後、[命令B]が実
行され(318)、以降は図2と同様に命令フェッチに
より二命令を取り込み、連続して実行する、という動作
を繰り返す。After the above-mentioned instruction fetch, [instruction B] is executed (318), and thereafter, the same operation as in FIG. 2 is repeated by fetching two instructions by instruction fetch and continuously executing them.
【0055】このように、HWJMP信号109を追加
することにより、バスサイクルのみではまったく同じ動
きとなるワード境界への分岐とハーフワード境界への分
岐を、 トレース装置103が区別できるようになり、
正確な命令トレースが可能になる。As described above, by adding the HWJMP signal 109, the trace device 103 can distinguish a branch to a word boundary and a branch to a halfword boundary, which have exactly the same movement in only a bus cycle,
Accurate instruction trace is possible.
【0056】なお、上述した実施例では、アドレスを3
2ビットのものとし、命令が16ビット固定長のもので
あるため、HWJMP信号109に要求される出力内容
は分岐先がワード境界領域か、または、ハーフワード境
界領域であるかの二通りとなり、増加する信号線の数は
1本である。In the above embodiment, the address is set to 3
Since the instruction is 2 bits and the instruction has a fixed length of 16 bits, the output content required for the HWJMP signal 109 has two types, that is, a branch destination is a word boundary area or a half word boundary area. The number of signal lines to be increased is one.
【0057】また、アドレスが64ビットのものであ
り、命令が16ビット固定長のものでであっても、HW
JMP信号109を出力するために増加する信号線の数
は2本であり、本発明を実施した場合に装置を構成する
ためにかかる負担は極めて低いものとなっている。Even if the address is of 64 bits and the instruction has a fixed length of 16 bits, the HW
The number of signal lines that are increased to output the JMP signal 109 is two, and the burden imposed on the device when implementing the present invention is extremely low.
【0058】[0058]
【発明の効果】本発明は以上示したように構成されてい
るので、以下に記載するような効果を奏する。Since the present invention is constructed as described above, it has the following effects.
【0059】一バスサイクルで複数の命令を取り込むマ
イクロプロセッサの命令実行をトレースする場合に、取
り込まれた命令をすべて実行するのか一部を実行するの
かを、HWJMP信号をバスサイクル情報と共に出力さ
れるため、動作を確認するトレース装置が正確に分岐命
令をトレースすることができ、精度の高い動作確認を行
うことができる効果がある。When tracing the instruction execution of the microprocessor which fetches a plurality of instructions in one bus cycle, the HWJMP signal is output together with the bus cycle information as to whether all or some of the fetched instructions are executed. Therefore, the tracing device that confirms the operation can accurately trace the branch instruction, and thus the operation can be confirmed with high accuracy.
【図1】トレース装置が接続された本発明の一実施例の
構成を示す図である。FIG. 1 is a diagram showing a configuration of an embodiment of the present invention to which a trace device is connected.
【図2】図1に示した実施例の動作を示す図である。FIG. 2 is a diagram showing an operation of the embodiment shown in FIG.
【図3】図1に示した実施例の動作を示す図である。FIG. 3 is a diagram showing an operation of the embodiment shown in FIG.
【図4】トレース装置が接続された従来例の構成を示す
図である。FIG. 4 is a diagram showing a configuration of a conventional example to which a trace device is connected.
【図5】図4に示した装置が実行するプログラムの一例
を示す図である。5 is a diagram showing an example of a program executed by the device shown in FIG.
【図6】従来例の動作を示す図である。FIG. 6 is a diagram showing an operation of a conventional example.
【図7】従来例の動作を示す図である。FIG. 7 is a diagram showing an operation of a conventional example.
101 MPU 102 メモリ 103 トレース装置 104 アドレスバス 105 データバス 106 BUSCY信号 107 BUSST信号 108 R/W信号 109 HWJMP信号 101 MPU 102 Memory 103 Trace Device 104 Address Bus 105 Data Bus 106 BUSCY Signal 107 BUSST Signal 108 R / W Signal 109 HWJMP Signal
─────────────────────────────────────────────────────
─────────────────────────────────────────────────── ───
【手続補正書】[Procedure amendment]
【提出日】平成5年11月10日[Submission date] November 10, 1993
【手続補正1】[Procedure Amendment 1]
【補正対象書類名】明細書[Document name to be amended] Statement
【補正対象項目名】特許請求の範囲[Name of item to be amended] Claims
【補正方法】変更[Correction method] Change
【補正内容】[Correction content]
【特許請求の範囲】[Claims]
Claims (1)
ス指定手段と、 n×mビットの幅を持ち、n個のmビット長命令を同時
に取り込むことができる命令コード入力手段と、 前記命令コード入力手段により同時に取り込まれたn個
の命令のうちの一つを特定する分岐先命令通知手段を有
し、 実行しているプログラムの分岐先命令を取り込む場合
に、分岐先の命令アドレスを前記アドレス指定手段と前
記分岐先命令通知手段により外部に通知することを特徴
とするマイクロプロセッサ。1. An instruction designating means for outputting an instruction code address; an instruction code inputting means having a width of n × m bits and capable of simultaneously capturing n m-bit length instructions; Has a branch-destination instruction notifying means for specifying one of the n instructions fetched at the same time, and when the branch-destination instruction of the program being executed is fetched, the branch-destination instruction address is designated by the address designating means. And a branch destination instruction notifying unit for notifying to the outside.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP5178921A JPH0736736A (en) | 1993-07-20 | 1993-07-20 | Microprocessor |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP5178921A JPH0736736A (en) | 1993-07-20 | 1993-07-20 | Microprocessor |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH0736736A true JPH0736736A (en) | 1995-02-07 |
Family
ID=16056980
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP5178921A Pending JPH0736736A (en) | 1993-07-20 | 1993-07-20 | Microprocessor |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0736736A (en) |
Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH03260843A (en) * | 1990-03-12 | 1991-11-20 | Fujitsu Ltd | Execution confirming system |
-
1993
- 1993-07-20 JP JP5178921A patent/JPH0736736A/en active Pending
Patent Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH03260843A (en) * | 1990-03-12 | 1991-11-20 | Fujitsu Ltd | Execution confirming system |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US9032185B2 (en) | Active memory command engine and method | |
| US5481734A (en) | Data processor having 2n bits width data bus for context switching function | |
| US20050257089A1 (en) | Breakpoint logic unit, debug logic and breakpoint method for a data processing apparatus | |
| JPH0527971A (en) | Information processor | |
| JPS623337A (en) | Data storing system | |
| KR20200123799A (en) | Apparatus and method for accessing metadata when debugging a device | |
| US8583897B2 (en) | Register file with circuitry for setting register entries to a predetermined value | |
| US6233675B1 (en) | Facility to allow fast execution of and, or, and test instructions | |
| JPH06295243A (en) | Data processing device | |
| JPH0736736A (en) | Microprocessor | |
| JP2581565B2 (en) | Data processing device that executes guarded instructions | |
| JP2915944B2 (en) | Coverage measurement method and microcomputer | |
| US6289439B1 (en) | Method, device and microprocessor for performing an XOR clear without executing an XOR instruction | |
| JP3523407B2 (en) | Information processing equipment | |
| JPS58195255A (en) | Data processing device | |
| JP2629479B2 (en) | Information processing device | |
| JPH03252731A (en) | Microprocessor | |
| JPS6286442A (en) | data processing equipment | |
| JPH0412855B2 (en) | ||
| JPH0795288B2 (en) | Microcomputer | |
| JPH0546389A (en) | Parallel processor | |
| JPS60193046A (en) | Instruction exception detection method | |
| JPH1055289A (en) | Debug information generation circuit and information processing device using the same | |
| JP2002024012A (en) | Microprocessor | |
| JPH01188941A (en) | Control system for execution of program |