JP2915944B2 - Coverage measurement method and microcomputer - Google Patents
Coverage measurement method and microcomputerInfo
- Publication number
- JP2915944B2 JP2915944B2 JP1342966A JP34296689A JP2915944B2 JP 2915944 B2 JP2915944 B2 JP 2915944B2 JP 1342966 A JP1342966 A JP 1342966A JP 34296689 A JP34296689 A JP 34296689A JP 2915944 B2 JP2915944 B2 JP 2915944B2
- Authority
- JP
- Japan
- Prior art keywords
- instruction
- branch
- coverage
- information area
- microcomputer
- 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.)
- Expired - Fee Related
Links
Landscapes
- Debugging And Monitoring (AREA)
Description
【発明の詳細な説明】 〔産業上の利用分野〕 本発明はマイクロコンピュータ応用システムのソフト
ウェアデバッグ技術、さらにはマイクロコンピュータに
よって実行される命令のカバレージ測定を可能とする方
法、及び当該方法の実施に用いられるマイクロコンピュ
ータに関する。The present invention relates to a technique for software debugging of a microcomputer application system, a method for measuring the coverage of instructions executed by a microcomputer, and an implementation of the method. It relates to a microcomputer used.
マイクロコンピュータ応用機器の開発において、その
応用システムのデバッグやそのシステムの詳細な評価を
行うため、インサーキットエミュレータが使用されてい
る。斯るインサーキットエミュレータは、ソフトウェア
開発用の親計算機(ホストコンピュータ)などのシステ
ム開発装置と、開発中の応用機器との間に接続され、そ
の応用機器に含まれるマイクロプロセッサ(ターゲット
マイクロプロセッサ)の機能を代行する一方でデバッガ
としての機能を持ち、詳細なシステムデバッグを支援す
る。In the development of microcomputer application equipment, an in-circuit emulator is used to debug the application system and to evaluate the system in detail. Such an in-circuit emulator is connected between a system development device such as a parent computer (host computer) for software development and an application device under development, and includes a microprocessor (target microprocessor) included in the application device. It acts as a debugger while acting on behalf of the function, and supports detailed system debugging.
尚、インサーキットエミュレータについて記載された
文献の例としては、昭和63年10月1日に日立マイクロコ
ンピュータエンジニアリング株式会社より発行された
「日立マイコ技報(第2巻、第2号)」がある。An example of a document describing the in-circuit emulator is "Hitachi Maiko Technical Report (Vol. 2, No. 2)" issued by Hitachi Microcomputer Engineering Co., Ltd. on October 1, 1988. .
ところで、このようなインサーキットエミュレータに
おいては、応用機器側のプログラム(ターゲットプログ
ラム)の評価を可能とする手段としてリアルタイムトレ
ース機能の他にカバレージトレース機能を備えたものが
ある。このカバーレージトレース機能によれば、ターゲ
ットマイクロプロセッサによって実行されるプログラム
の通過アドレスに応じてフラグなどの所定の情報が単一
のカバレジトレースメモリに順次蓄えられる。この情報
によって、ターゲットプログラムの中の命令語の何パー
セントをテストできたかを測定することができる。Incidentally, among such in-circuit emulators, there is an in-circuit emulator having a coverage tracing function in addition to a real-time tracing function as a means capable of evaluating a program (a target program) on an application device side. According to this coverage trace function, predetermined information such as a flag is sequentially stored in a single coverage trace memory in accordance with a passing address of a program executed by a target microprocessor. With this information, it is possible to measure what percentage of the instructions in the target program could be tested.
しかしながら、上記従来技術によれば次のような問題
点のあることが本発明者によって見い出された。However, the inventor has found the following problems according to the related art.
従来技術において命令分岐命令の実行状況例えば当該
分岐命令によって分岐されたか否かを検出するには、マ
イクロコンピュータの外部に配置されたハードウェアに
よってトレースしなければならない。しかしながら、命
令キャッシュやメモリマネージメントユニットなどの周
辺回路を内蔵してシステムオンチップ化することにより
高機能化されたマイクロコンピュータでは、分岐命令の
実行状況を検出するに十分な信号をマイクロコンピュー
タの外部に出力することができなくなっているため、マ
イクロコンピュータの外部に配置されたハードウェアで
は分岐命令の実行状況をトレースするのが困難になる。
また仮にそのような信号をマイクロコンピュータの外部
に出力することが可能であっても内部処理が高速で行わ
れるため、外付けハードウェアで分岐命令の実行状況を
検出するのが困難になる。更に、仮想メモリシステムな
どのように単一のメモリが複数のプログラムによって時
分割で使用される場合には、プログラムの種類だけカバ
レージトレースメモリを用意し、現在実行されるプログ
ラムに対応するように当該メモリの切換え制御を行わな
ければならず、外付けハードウェアにおいてこのような
メモリ切換え制御を行うのは非常に困難となる。In the prior art, in order to detect the execution state of an instruction branch instruction, for example, whether or not a branch was taken by the branch instruction, it is necessary to trace by hardware arranged outside the microcomputer. However, in microcomputers that have been enhanced by incorporating a peripheral circuit such as an instruction cache and memory management unit into a system-on-chip, a signal sufficient to detect the execution status of a branch instruction is output to the outside of the microcomputer. Since the output cannot be performed, it is difficult to trace the execution status of the branch instruction with hardware arranged outside the microcomputer.
Even if such a signal can be output to the outside of the microcomputer, the internal processing is performed at a high speed, which makes it difficult to detect the execution state of the branch instruction by external hardware. Further, when a single memory is used in a time-sharing manner by a plurality of programs as in a virtual memory system, etc., a coverage trace memory is prepared for each type of program, and the corresponding coverage trace memory is prepared so as to correspond to the currently executed program. Control of memory switching must be performed, and it is very difficult to perform such memory switching control in external hardware.
本発明の目的は、外部とやりとりされる信号に内部動
作状態が反映さえない若しくは反映されても内部処理が
高速に行われることから分岐命令の実行状態を検知する
ことができないような高機能化されたマイクロプロセッ
サであるにもかかわらず、プログラムのカバレージ測定
を適確に行い得る技術を提供することにある。SUMMARY OF THE INVENTION It is an object of the present invention to provide an advanced function in which an internal operation state is not reflected in a signal exchanged with an external device, or even if an internal operation state is reflected, an execution state of a branch instruction cannot be detected because internal processing is performed at high speed. It is an object of the present invention to provide a technique capable of accurately measuring the coverage of a program despite the fact that the microprocessor is used.
本願の前記ならびにそのほかの目的と新規な特徴は、
本明細書の記述及び添付図面から明らかになるであろ
う。The above and other objects and novel features of the present application are:
It will be apparent from the description of this specification and the accompanying drawings.
本願において開示される発明のうち代表的なものの概
要を簡単に説明すれば下記の通りである。The outline of a representative invention among the inventions disclosed in the present application will be briefly described as follows.
すなわち、分岐命令コードの特定ビットの状態を変更
するとともに当該命令コードに情報エリアを付加し、こ
の情報エリアが付加された分岐命令を含むプログラムを
マイクロコンピュータに実行させ、当該分岐命令の実行
状況を上記情報エリアに記録させるようにし、この情報
エリアの記録内容に基づいて当該分岐命令のカバレージ
解析を行う、というものである。ここで上記分岐命令の
実行状況として、マイクロコンピュータに含まれる演算
器の演算結果を保持するコンディションコードレジスタ
を参照して判定される分岐条件が成立するか否かの情報
を含める。That is, the state of a specific bit of the branch instruction code is changed, an information area is added to the instruction code, the microcomputer executes a program including the branch instruction to which the information area is added, and the execution status of the branch instruction is changed. The information is recorded in the information area, and the coverage analysis of the branch instruction is performed based on the recorded contents of the information area. Here, the execution status of the branch instruction includes information as to whether or not a branch condition determined by referring to a condition code register holding an operation result of an arithmetic unit included in the microcomputer is satisfied.
また、情報エリアを備えたカバレージ命令を、分岐命
令の分岐パスと通過パスとの双方に挿入し、当該カバレ
ージ命令がフェッチされた場合に当該カバレージ命令の
実行回数を上記情報エリアに記録させるようにし、この
情報エリアの記録内容に基づいて分岐命令の実行状態を
間接的に把握してカバレージ解析を行う、というもので
ある。Further, a coverage instruction having an information area is inserted into both the branch path and the passing path of the branch instruction, and when the coverage instruction is fetched, the number of times of execution of the coverage instruction is recorded in the information area. Then, based on the recorded contents of the information area, the execution state of the branch instruction is indirectly grasped and the coverage analysis is performed.
ここで上記分岐命令コードの特定ビットの状態変更や
分岐コードへの情報エリアの付加、又は上記カバレージ
命令の挿入はソースプログラムを機械語に翻訳する段階
で行うことができる。Here, the state change of a specific bit of the branch instruction code, the addition of an information area to the branch code, or the insertion of the coverage instruction can be performed at the stage of translating the source program into a machine language.
そして上記のようなカバレージ測定に使用されるマイ
クロコンピュータを、以下のように構成したものであ
る。The microcomputer used for the above-described coverage measurement is configured as follows.
すなわち、分岐命令コードの特定ビットの状態が変更
され且つ命令コードに情報エリアが付加された分岐命令
をフェッチした場合に当該情報エリアへの情報記録制御
信号を生成する命令制御部と、この情報記録制御信号に
従って上記分岐命令コードの実行状況を情報エリアに記
録する実行部とを含んでマイクロコンピュータを形成し
たものである。また、情報エリアを含むカバレージ命令
をフェッチした場合に当該情報エリアへの情報記録制御
信号を生成する命令制御部と、この情報記録制御信号に
従ってカバレージ命令の実行回数を上記情報エリアに記
録する実行部とを含んでマイクロコンピュータを形成し
たものである。That is, when a state of a specific bit of a branch instruction code is changed and a branch instruction in which an information area is added to the instruction code is fetched, an instruction control unit that generates an information recording control signal for the information area; A microcomputer that includes an execution unit that records the execution status of the branch instruction code in an information area according to a control signal. An instruction control unit for generating an information recording control signal for the information area when the coverage instruction including the information area is fetched; and an execution unit for recording the execution number of the coverage instruction in the information area in accordance with the information recording control signal. And a microcomputer is formed.
上記手段によれば、分岐命令もしくはカバレージ命令
がフェッチされた場合の情報エリアへの記録内容に基づ
いてカバレージ解析が可能とされ、このことが、マイク
ロコンピュータの高機能化にかかわらず適確なカバレー
ジ測定を可能とするように作用する。このときマイクロ
コンピュータは、上記分岐命令若しくはカバレージ命令
がフェッチされた場合に情報記録制御信号を生成し、こ
の情報記録制御信号に従って上記情報エリアに当該分岐
命令若しくはカバレージ命令の実行状況をセットするよ
うに作用する。According to the above means, it is possible to perform a coverage analysis based on the contents recorded in the information area when a branch instruction or a coverage instruction is fetched, and this enables accurate coverage irrespective of the performance of the microcomputer. Acts to allow measurement. At this time, the microcomputer generates an information recording control signal when the branch instruction or the coverage instruction is fetched, and sets the execution status of the branch instruction or the coverage instruction in the information area according to the information recording control signal. Works.
〔実施例1〕 第1図には本発明の第1実施例方法を適用したマイク
ロコンピュータ開発システムが示される。Embodiment 1 FIG. 1 shows a microcomputer development system to which the method of the first embodiment of the present invention is applied.
同図に示されるマイクロコンピュータ開発システム
は、特に制限されないが、マイクロコンピュータ応用機
器としてのユーザ開発装置10、ユーザプログラムのデバ
ッグを可能とするインサーキットエミュレータ17、アセ
ンブラやリンケージエディタ更にはカバレージ解析ソフ
トウェアの動作環境が形成されるホストコンピュータ11
を含む。The microcomputer development system shown in FIG. 1 is not particularly limited, but includes a user development device 10 as a microcomputer application device, an in-circuit emulator 17 capable of debugging a user program, an assembler and a linkage editor, and furthermore, a coverage analysis software. Host computer 11 on which operating environment is formed
including.
ユーザ開発装置10は、プログラム及びその他の必要デ
ータの書込み/読出しが可能とされるRAM(ランダム・
アクセス・メモリ)12と、当該ユーザ開発装置10の初期
設定用プログラムなどが保持されたROM(リード・オン
リ・メモリ)13と、外部との間でデータのやりとりを行
うI/O(インプット・アウトプット)14を有する。更に
このユーザ開発装置10には、当該装置10の動作制御や演
算処理を行うマイクロコンピュータを搭載するためのIC
ソケット11が設けられている。ソフトウェアデバッグに
おいてこのICソケット11には、インサーキットエミュレ
ータ18のインタフェースケーブル26の先端に設けられた
プラグ25が結合される。このインターフェースケーブル
26の中間部にはポッド23が配置され、このポッド23に、
ユーザ開発装置10に搭載されるべきマイクロコンピュー
タと同等の機能を有する評価用のマイクロコンピュータ
(以下評価チップと称する)24が装着される。インサー
キットエミュレータ18は、ユーザ開発装置10とホストコ
ンピュータ19との間に配置され、トレース機能やブレー
ク機能によりソフトウェアデバッグを支援する。このイ
ンサーキットエミュレータ18とホストコンピュータ19と
はシリアル回線バスラインによって結合され、このバス
ラインによって両者間でのデータのやりとりが可能とさ
れる。デバッグ対象とされるプログラムは、I/O14を介
して、若しくはインサーキットエミュレータ18を介し
て、ホストコンピュータ19から供給され、RAM12に格納
される。このRAM12に格納されるプログラムは機械語に
翻訳されており、この機械語への翻訳はホストコンピュ
ータ19においてアセンブラソフトを実行することにより
行われる。そしてこの翻訳過程においては、後に詳述す
るように、分岐命令の特定ビット例えば最上位ビットの
状態が変更されることにより当該分岐命令がカバレージ
測定対象として認識可能とされるとともに、当該命令コ
ードに分岐命令の実行状況を記録するための情報エリア
が形成される。この情報エリアの形成は、特に制限され
ないが、当該分岐命令を1ワード拡張することによって
行われる。そして上記RAM12に格納されたプログラム中
の命令は、評価チップ24によって順次実行され。このプ
ログラム実行において、上記分岐命令がフェッチされた
場合に当該命令の実行状況が当該分岐命令の情報エリア
に記録されるようになっている。この実行状況の記録
は、具体的には上記RAM12内において当該分岐命令の情
報エリアに対応するアドレスに当該実行状況が書込まれ
ることによって行われる。The user development device 10 includes a random access memory (RAM) in which programs and other necessary data can be written / read.
An access memory) 12, a ROM (read only memory) 13 holding an initial setting program of the user development device 10, and an I / O (input / output) for exchanging data with an external device. G) has 14. Further, the user development device 10 has an IC for mounting a microcomputer for controlling the operation of the device 10 and performing arithmetic processing.
A socket 11 is provided. In software debugging, a plug 25 provided at the end of the interface cable 26 of the in-circuit emulator 18 is connected to the IC socket 11. This interface cable
A pod 23 is arranged in the middle of 26, and in this pod 23,
A microcomputer for evaluation (hereinafter referred to as an evaluation chip) 24 having the same function as the microcomputer to be mounted on the user development device 10 is mounted. The in-circuit emulator 18 is arranged between the user development device 10 and the host computer 19, and supports software debugging by a trace function and a break function. The in-circuit emulator 18 and the host computer 19 are connected by a serial line bus line, and the bus line enables data exchange between the two. The program to be debugged is supplied from the host computer 19 via the I / O 14 or the in-circuit emulator 18 and stored in the RAM 12. The program stored in the RAM 12 is translated into a machine language, and the translation into the machine language is performed by executing assembler software in the host computer 19. In this translation process, as will be described later in detail, the state of a specific bit, for example, the most significant bit of the branch instruction is changed so that the branch instruction can be recognized as a coverage measurement target, and the instruction code is An information area for recording the execution status of the branch instruction is formed. The formation of the information area is not particularly limited, but is performed by extending the branch instruction by one word. The instructions in the program stored in the RAM 12 are sequentially executed by the evaluation chip 24. In this program execution, when the branch instruction is fetched, the execution status of the instruction is recorded in the information area of the branch instruction. The execution status is recorded by writing the execution status in the RAM 12 at an address corresponding to the information area of the branch instruction.
このようにしてデバッグ対象プログラムの実行が終了
された後、上記RAM12内のプログラムは、後にホストコ
ンピュータ19で行われるカバレージ解析に供される。After the execution of the program to be debugged is completed in this way, the program in the RAM 12 is subjected to a coverage analysis performed later by the host computer 19.
上記RAM12からホストコンピュータ19へのプログラム
転送経路には、特に制限されないが、図中破線で示され
るように3通りある。すなわち、ユーザ開発装置10にフ
ロッピーディスク装置(図示せず)が備えられている場
合にはI/O14を介してこのフロッピーディスク装置にRAM
12内のプログラムを転送し、ここで当該プログラムが書
込まれたフロッピーディスク16をホストコンピュータ19
に装着することによってプログラム転送を可能とする第
1の転送経路L1、インサーキットエミュレータ18にフロ
ッピーディスク装置(図示せず)が備えられている場合
には評価チップ24及びインサーキットエミュレータ18を
介してこのフロッピーディスク装置に上記RAM12内のプ
ログラムを転送し、ここで当該プログラムが格納された
フロッピーディスク17をホストコンピュータ19に装着す
ることによってプログラム転送を可能とする第2の転送
経路L2、更に、フロッピーディスクを介することなく評
価チップ24及びインサーキットエミュレータ18を介して
直接ホストコンピュータ19にプログラムを転送する第3
の転送経路L3である。尚、ホストコンピュータ19でのカ
バレージ解析結果は表示装置22に表示され、また必要に
応じてフロップーディスク21に格納され、あるいはプリ
ンタ20によってプリントアウトされる。Although there is no particular limitation on the program transfer path from the RAM 12 to the host computer 19, there are three types as shown by broken lines in the figure. That is, when the user development device 10 has a floppy disk device (not shown), the floppy disk device is connected to the RAM via the I / O 14.
The program stored in the host computer 19 is transferred to the floppy disk 16 on which the program is written.
A first transfer path L1 that enables a program transfer by being mounted on the in-circuit emulator 18. If the in-circuit emulator 18 is provided with a floppy disk device (not shown), the evaluation chip 24 and the in-circuit emulator 18 are used. The program in the RAM 12 is transferred to the floppy disk device, and the floppy disk 17 storing the program is loaded in the host computer 19 to enable the program transfer. Third, a program is directly transferred to the host computer 19 via the evaluation chip 24 and the in-circuit emulator 18 without using a disk.
Is the transfer path L3. The result of the coverage analysis by the host computer 19 is displayed on the display device 22 and is stored in the flop-flop disk 21 or printed out by the printer 20 as necessary.
第2図には上記評価チップ24の詳細な構成の一例が示
される。同図に示される評価チップ24は、特に制限され
ないが、基本命令レベルの高速実行を可能とするため各
種キャッシュを内蔵し、高速なパイプライン処理を実行
可能とされる。FIG. 2 shows an example of a detailed configuration of the evaluation chip 24. Although not particularly limited, the evaluation chip 24 shown in FIG. 1 includes various caches to enable high-speed execution at the basic instruction level, and can execute high-speed pipeline processing.
命令プリフェッチユニット30は命令キャッシュ30aを内
蔵し、実行すべき命令を先行してフェッチする。また分
岐命令系の高速化のため、4本の分岐ウィンドウ30bを
有する。これにヒットした場合には分岐先命令のフェッ
チが簡略化される。入出力ユニット35はユーザ開発装置
10及びインサーキットエミュレータ18に結合され、命令
やオペランドの入出力を制御する。命令デコードユニッ
ト31はフェッチした命令のデコードを行う。このデコー
ド結果は、マイクロプログラムを内蔵する制御ユニット
32に伝達され、演算器33aや各種レジスタ群33bを含む実
行ユニット33を制御してオペランドの処理を行わせる。
処理されたオペランドは再び入出力制御ユニット35に転
送され、ストアバッファ35bに格納される。スタック情
報の場合にはスタックキャッシュ35aにも格納される。
オペランドがストアバッファ35bに格納された段階で、
次の命令の処理が開始される。また外部メモリのアクセ
スはメモリ管理ユニット34による保護条件のチェックと
アドレス変換を経て行われる。この処理は命令実行処理
と並行される。The instruction prefetch unit 30 incorporates an instruction cache 30a and fetches an instruction to be executed in advance. It also has four branch windows 30b for speeding up the branch instruction system. If this is hit, the fetch of the branch destination instruction is simplified. I / O unit 35 is a user-developed device
10 and an in-circuit emulator 18 for controlling the input and output of instructions and operands. The instruction decode unit 31 decodes the fetched instruction. This decoding result is output to the control unit that contains the microprogram.
It is transmitted to the control unit 32 and controls the execution unit 33 including the arithmetic unit 33a and the various register groups 33b to perform the processing of the operand.
The processed operand is transferred to the input / output control unit 35 again and stored in the store buffer 35b. In the case of stack information, it is also stored in the stack cache 35a.
At the stage when the operand is stored in the store buffer 35b,
Processing of the next instruction is started. Further, access to the external memory is performed through checking of protection conditions and address conversion by the memory management unit 34. This processing is performed in parallel with the instruction execution processing.
尚、上記制御ユニット32におけるマイクロプログラム
の実行によって、分岐命令を含む種々の命令に対応する
制御信号の発生が可能とされる。本発明における命令制
御部はこの制御ユニット32と命令デコードユニット31と
を含んで実現される。The execution of the microprogram in the control unit 32 enables generation of control signals corresponding to various instructions including a branch instruction. The instruction control unit according to the present invention is realized including the control unit 32 and the instruction decode unit 31.
ここで、上記実行ユニット33におけるレジスタ群33b
には、特に制限されないが、第5図に示されるように、
アキュムレータ(Accumulator:ACCA)、インデックスレ
ジスタ(Index Register:IX),プログラムカウンタ(P
rogram Counter:PC),スタックポインタ(Stack Point
er:SP),コンディションコードレジスタ(Condition C
odes Register)が含まれる。上記アキュムレータはA,B
で区別されるように8ビット構成のものが2つ備えられ
る。上記インデックスレジスタ,プログラムカウンタ及
びスタックポインタは16ビット構成とされ、コンディシ
ョンレジスタは8ビット構成とされる。特にこのコンデ
ィションコードレジスタは、上記実行ユニット33におい
て演算器33aの演算結果が保持され、当該レジスタに
は、ネガティブ(Negative:N),ゼロ(Zero:Z),オー
バフロー(Overflow:V),ビット7からのキャリ(Carr
y:C),ビット3からのハーフキャリ(Half Carry)の
各フラグが存在し、条件分岐命令の実行において、これ
ら各フラグのうち所定のフラグが参照されることにより
当該分岐命令の条件が成立するか否かの判別が可能とさ
れる。Here, the register group 33b in the execution unit 33
Although not particularly limited, as shown in FIG.
Accumulator (ACCA), index register (Index Register: IX), program counter (P
rogram Counter: PC), Stack Pointer (Stack Point)
er: SP), condition code register (Condition C
odes Register). The accumulator is A, B
As shown in FIG. 2, two 8-bit units are provided. The index register, the program counter, and the stack pointer have a 16-bit configuration, and the condition register has an 8-bit configuration. In particular, the condition code register holds the operation result of the arithmetic unit 33a in the execution unit 33. The register includes negative (Negative: N), zero (Zero: Z), overflow (Overflow: V), bit 7 From Carr
y: C), and half carry (Half Carry) flags from bit 3 exist. In execution of the conditional branch instruction, a predetermined flag is referred to among these flags to satisfy the condition of the branch instruction. It is possible to determine whether or not to perform.
上記のように本実施例における評価チップ24は多様な
分散キャッシュと並列処理により高機能化されており、
このようなマイクロコンピュータを含むシステムのソフ
トウェァデバッグ、特に条件分岐命令の適確なカバレー
ジ測定を可能とするため、本実施例では以下のようなカ
バレージ測定専用の分岐命令が使用される。As described above, the evaluation chip 24 in this embodiment is highly functionalized by various distributed caches and parallel processing.
In order to enable software debugging of a system including such a microcomputer, particularly accurate coverage measurement of a conditional branch instruction, the present embodiment uses the following branch instruction dedicated to coverage measurement.
第6図には本実施例における評価チップ24において実
行可能とされる種々の分岐命令とその分岐条件との関係
が示される。FIG. 6 shows the relationship between various branch instructions executable by the evaluation chip 24 in this embodiment and their branch conditions.
例えば条件分岐命令BEQは通常第3図に示されるよう
に、機械語で“67FE"と表わされる。このうち“67"は当
該命令が分岐命令であることを示し、“FE"は分岐先ま
での相対アドレスを示している。本実施例においてこの
“67FE"は通常モードの分岐命令とされる。一方、カバ
レージ測定モードの場合この命令コードは特に制限され
ないが、“E7FE"とされ、通常モード時の命令コードの
最上位ビットが1に変更される。第3図における“E7"
がこれを意味する。そしてこれと同時にワード拡張がな
され、16ビット構成の情報エリア40が形成される。この
情報エリア40は更に3つのエリア40a,40b,40cに分かれ
ている。当該分岐命令によって分岐された場合には第1
のエリア40aにフラグが立てられ、当該分岐命令によっ
て分岐されずに通過された場合には第2のエリア40bに
フラグが立てられる。従ってこの第1,第2のエリア40a,
40bのフラグ状態をチェックすることで当該分岐命令に
従って分岐されたか否かの判別が可能となる。更に本実
施例では、単に分岐されたか否かの判別のみならず、分
岐された場合の分岐条件の種類が記録されるようになっ
ている。この記録は、第3のエリア40cの該当箇所にフ
ラグを立てることによって行われる。For example, the conditional branch instruction BEQ is usually expressed in machine language as "67FE" as shown in FIG. Of these, "67" indicates that the instruction is a branch instruction, and "FE" indicates a relative address up to the branch destination. In this embodiment, "67FE" is a branch instruction in the normal mode. On the other hand, in the coverage measurement mode, this instruction code is not particularly limited, but is set to “E7FE”, and the most significant bit of the instruction code in the normal mode is changed to 1. "E7" in Fig. 3
Means this. At the same time, word expansion is performed, and an information area 40 having a 16-bit configuration is formed. The information area 40 is further divided into three areas 40a, 40b, 40c. When the branch is taken by the branch instruction, the first
A flag is set in the area 40a of the second area 40a, and when the branch instruction is passed without branching, the flag is set in the second area 40b. Therefore, the first and second areas 40a,
By checking the flag state of 40b, it is possible to determine whether or not the branch has been taken in accordance with the branch instruction. Further, in the present embodiment, not only the determination as to whether or not the branch is taken, but also the type of the branch condition when the branch is taken is recorded. This recording is performed by setting a flag at a corresponding location in the third area 40c.
以上のような分岐命令のフォーマット形成は、第1図
に示されるホストコンピュータ19において、高級言語で
記述されたプログラムをアセンブラにより機械語に翻訳
する段階でモード指定に応じて行われる。つまり上記分
岐命令BEQの場合、通常モードの指定がなされれば“67F
E"と翻訳されるのに対して、カバレージ測定モードの指
定がなされた場合には“E7FE"と翻訳され、これとほぼ
同時に当該命令コードに情報エリア40が付加される。The above-described branch instruction format is formed in the host computer 19 shown in FIG. 1 in accordance with the mode designation at the stage of translating a program described in a high-level language into a machine language by an assembler. In other words, in the case of the above branch instruction BEQ, if the normal mode is specified, “67F
When translated to "E", when the coverage measurement mode is designated, it is translated to "E7FE", and almost simultaneously with this, an information area 40 is added to the instruction code.
そしてこのようなカバレージ測定モードの分岐命令が
評価チップ24においてフェッチされると、制御ユニット
32は、当該分岐命令の“E7"により当該分岐命令が、カ
バレージ測定モードにおけるBEQであることを認識し、
情報エリアへの情報記録制御信号を生成する。すると実
行ユニット33は制御ユニット32の制御下で分岐条件の判
定を行い、この判定において分岐条件成立により分岐す
る場合には情報エリア40aにフラグ“1"を立て、また条
件不成立により分岐せずに通過する場合には第2のエリ
ア40bにフラグ“1"を立てる。更に分岐条件成立により
分岐する場合には、第3のエリアにおいて予め分岐条件
との対応関係がとられている該当条件ビットにフラグ
“1"を立てる。従ってかかる情報エリアへの記録内容に
よれば、フラグ“1"の有無によって、分岐条件成立によ
り分岐されたか否か、及び分岐された場合の分岐条件の
種類判別が可能とされる。Then, when such a branch instruction in the coverage measurement mode is fetched in the evaluation chip 24, the control unit
32 recognizes that the branch instruction is a BEQ in the coverage measurement mode by “E7” of the branch instruction,
An information recording control signal for the information area is generated. Then, the execution unit 33 determines a branch condition under the control of the control unit 32, and in this determination, sets a flag “1” in the information area 40a when branching is performed when the branch condition is satisfied. When passing, a flag "1" is set in the second area 40b. Further, when the branch is taken due to the establishment of the branch condition, a flag “1” is set in the corresponding condition bit in the third area, which has a correspondence with the branch condition in advance. Therefore, according to the contents recorded in the information area, it is possible to determine whether or not the branch condition is satisfied and whether the type of the branch condition is satisfied by the presence or absence of the flag “1”.
例えば上記の分岐命令BEQの場合の分岐条件は、第6
図に示されるように、Z=1であり、これは、コンディ
ションコードレジスタのゼロフラグ(第5図参照)が
“1"であることを示しており、当該分岐命令BEQの直前
における演算結果がゼロであることを意味する。従って
この分岐命令BEQの条件が成立するか否かの判別は、コ
ンディションコードレジスタのゼロフラグの状態判別に
よって可能とされる。For example, the branch condition in the case of the above-described branch instruction BEQ is the sixth
As shown in the figure, Z = 1, which indicates that the zero flag (see FIG. 5) of the condition code register is "1", and the operation result immediately before the branch instruction BEQ is zero. Means that Therefore, it is possible to determine whether or not the condition of the branch instruction BEQ is satisfied by determining the state of the zero flag of the condition code register.
分岐命令BEQの分岐条件はZ=1のみであるが、例え
ば分岐条件BLEの分岐条件は、第6図に示されるよう
に、 Z+(NV)=1 であり、この条件が成立する場合は3通りある。すなわ
ち、Z=1の場合と、(Z=0)・(N=1)・(V=
0)の場合と、(Z=0)・(N=0)・(V=1)の
場合である。このうちどの条件が成立して分岐されたか
の判別を可能とするため、本実施例では特に制限されな
いが、情報エリア40における第3のエリア40cにおける
ビットb8,b9,b10に上記3通りの成立条件が割付けら
れ、該当するビットにフラグ“1"が立てられる。従って
当該分岐命令BLEのように条件の成立する場合が複数通
りある場合でも、第3のエリア40cのセット内容によっ
て分岐条件の種類を適確に把握することが可能とされ
る。The branch condition of the branch instruction BEQ is only Z = 1. For example, the branch condition of the branch condition BLE is Z + (NV) = 1, as shown in FIG. There is a street. That is, when Z = 1, (Z = 0) · (N = 1) · (V =
0) and (Z = 0). (N = 0). (V = 1). Although the present embodiment is not particularly limited in order to make it possible to determine which of the conditions has been satisfied and the branch has occurred, the bits b8, b9, and b10 in the third area 40c in the information area 40 indicate the above three conditions. Is assigned, and a flag “1” is set to the corresponding bit. Therefore, even when there are a plurality of cases where the condition is satisfied as in the case of the branch instruction BLE, it is possible to accurately grasp the type of the branch condition by the set contents of the third area 40c.
本実施例システムにおいてカバレージ測定は次のよう
に行われる。In the system of the present embodiment, the coverage measurement is performed as follows.
第4図には、I/O14若しくはインサーキットエミュレ
ータ18を介してホストコンピュータ19より転送されRAM1
2内に格納された命令語の配置とそれに対応する機械語
コードとの関係が示される。同図において分岐命令BEQ
及びBNEは、ホストコンピュータ19での翻訳過程にてカ
バレージ測定モードが選択されることにより、命令コー
ドの最上位ビットが“1"とされ、ワード拡張により情報
エリア40が付加されている。この情報エリアは同図に示
されるように初期値として16進数の(0000)がセットさ
れている。FIG. 4 shows the RAM 1 transferred from the host computer 19 via the I / O 14 or the in-circuit emulator 18.
The relationship between the arrangement of the instruction words stored in 2 and the corresponding machine language code is shown. In the figure, the branch instruction BEQ
When the coverage measurement mode is selected in the translation process by the host computer 19, the most significant bit of the instruction code is set to "1", and the information area 40 is added by word expansion. In this information area, hexadecimal (0000) is set as an initial value as shown in FIG.
そして評価チップ24によりRAM12内の命令が順次実行
され、当該分岐命令BEQ又はBNEがフェッチされた場合、
当該分岐命令についての分岐条件に応じて当該命令の情
報エリア40に当該命令の実行状況が記録される。この実
行状況の記録は、RAM12内において当該命令の情報エリ
ア40に対応するアドレスに実行状況を書込むことによっ
て行われる。また、この実行状況の記録は、当該命令の
前回実行時の状況を保存するため、今回実行時の状況と
前回実行時の状況との論理和をとって行われる。When the instructions in the RAM 12 are sequentially executed by the evaluation chip 24 and the branch instruction BEQ or BNE is fetched,
The execution status of the instruction is recorded in the information area 40 of the instruction according to the branch condition for the instruction. The recording of the execution status is performed by writing the execution status at an address corresponding to the information area 40 of the instruction in the RAM 12. In addition, the recording of the execution status is performed by ORing the status at the time of the current execution and the status at the time of the previous execution in order to save the status at the time of the previous execution of the instruction.
RAM12内のプログラムの一通りのテストが終了した後
に、当該RAM12内のプログラムを基にホストコンピュー
タ19においてカバレージ測定結果の情報解析が行われ
る。RAM12からホストコンピュータ19へのデータ転送に
おいて、第2のルートL2又は第3のルートL3を経る場合
には、ホストコンピュータ19において第12図に示される
ような分岐命令ファイルを用いることによりカバレージ
情報のみを抽出することができる。同図に示される分岐
命令ファイルは、アセンブラ/リンケージエディタによ
り、テスト対象プログラムから分岐命令だけを抜出して
作成されるファイルであり、アドレス、命令語、飛び
先、分岐条件の各項目が設けられている。更にホストコ
ンピュータ19では、上記分岐命令ファイルを用いてカバ
レージ測定結果の分析を行い、第13図に示されるような
カバレージ解析結果を得る。このカバレージ解析結果に
は、分岐、通過、実行済分岐条件、テスト完了命令の各
項目が含まれる。このような解析結果は表示装置22に表
示され、必要に応じてプリンタ20によりハードコピーさ
れる。After one test of the program in the RAM 12 is completed, information analysis of the coverage measurement result is performed in the host computer 19 based on the program in the RAM 12. When data is transferred from the RAM 12 to the host computer 19 via the second route L2 or the third route L3, the host computer 19 uses a branch instruction file as shown in FIG. Can be extracted. The branch instruction file shown in the figure is a file created by extracting only a branch instruction from a test target program by an assembler / linkage editor, and includes items of an address, an instruction word, a jump destination, and a branch condition. I have. Further, the host computer 19 analyzes the coverage measurement result using the branch instruction file, and obtains a coverage analysis result as shown in FIG. The coverage analysis result includes items such as branch, pass, executed branch condition, and test completion instruction. Such an analysis result is displayed on the display device 22, and is hard-copied by the printer 20 as necessary.
また、RAM12からホストコンピュータ19へのデータ転
送が第1のルートL1を経て行われる場合において、ユー
ザ開発装置10にカバレージ解析のためのプログラムを載
せれば、上記の分岐命令ファイルをホストコンピュータ
19からユーザ開発装置10に転送してユーザ開発装置10で
カバレージ情報だけを取出し、それをフロッピーディス
ク16に格納することによりホストコンピュータ19に伝達
することもできる。尚、ユーザ開発装置10に表示装置や
プリンタが備えられている場合には、カバレージ解析及
びその解析結果の出力までユーザ開発装置10で行うこと
もできる。In the case where the data transfer from the RAM 12 to the host computer 19 is performed via the first route L1, if the program for the coverage analysis is loaded on the user development device 10, the above-mentioned branch instruction file is stored in the host computer.
The coverage information can be transferred from the user development device 10 to the user development device 10, and the user development device 10 can extract only the coverage information and store it on the floppy disk 16 to transmit the coverage information to the host computer 19. If the user development device 10 includes a display device and a printer, the coverage analysis and the output of the analysis result can be performed by the user development device 10.
本実施例システムによれば以下の作用効果を得ること
ができる。According to the system of the present embodiment, the following effects can be obtained.
(1)分岐命令コードの特定ビットの状態が変更され、
且つ、情報エリアが付加された分岐命令が評価チップ24
によってフェッチされた場合に、当該分岐命令の実行状
況が当該情報エリアに記録されるので、この情報エリア
のセット内容に基づいて当該分岐命令のカバレージ解析
を行うことができ、この解析によって本実施例の分岐命
令や分岐条件を明らかにすることにより、より高度なソ
フトウェア管理が可能となる。(1) The state of a specific bit of the branch instruction code is changed,
In addition, the branch instruction to which the information area is added is
When the branch instruction is fetched, the execution status of the branch instruction is recorded in the information area, so that the coverage analysis of the branch instruction can be performed based on the set contents of the information area. By clarifying the branch instruction and the branch condition, more sophisticated software management becomes possible.
(2)上記(1)の作用効果により、テスト対象プログ
ラムについて一通りのカバレージ測定が終了された後
に、すべての分岐命令の情報エリア40の記録内容を抜出
して、各分岐命令毎に、条件成立により分岐したか否か
の判別、及び条件成立により分岐した場合においての当
該分岐の成立条件の判別を行うことができるので、ソフ
トウェアデバッグ特に分岐命令に関してのテストを詳細
に行うことができ、高品質ソフトウェアの開発を支援す
ることができる。(2) Due to the effect of the above (1), after a complete coverage measurement is completed for the test target program, the recorded contents of the information area 40 of all branch instructions are extracted, and the condition is satisfied for each branch instruction. Can be used to determine whether or not a branch has been taken, and when a branch has been taken due to a condition being satisfied, the condition for the branch to be taken. Can support software development.
(3)また、ホストコンピュータ19においてはカバレー
ジ測定モードと通常動作モードとの切換えが可能とされ
ているため、カバレージ測定モードによりテスト対象プ
ログラムのデバッグが十分に行われた後、特に当該テス
ト対象プログラムが実稼動に移行される場合に、分岐命
令コードを通常モードに簡単に戻すことができ、これに
より、分岐命令のワード長がカバレージ測定時より減少
され、実稼動に移行された場合のプログラム実行の効率
低下を抑制できる。(3) Since the host computer 19 can switch between the coverage measurement mode and the normal operation mode, after the debug of the test target program is sufficiently performed in the coverage measurement mode, particularly, Can easily return the branch instruction code to the normal mode when the operation is shifted to the actual operation, so that the word length of the branch instruction is reduced from that at the time of the coverage measurement, and the program is executed when the operation is shifted to the actual operation. Efficiency can be suppressed.
(4)更に上記(1),(2)の作用効果は、カバレー
ジ測定モードにおいて形成された分岐命令を用いること
で得られるもので、外付けハードウェアによって得るも
のではないため、命令キャッシュを内蔵するなど、評価
チップが高機能化されたものであるにもかかわらず、デ
バッグ対象プログラムのカバレージ測定を適確に行うこ
とができる。換言すれば、本実施例でのカバレージ測定
方法によれば、特殊なハードウェアを必要とせずに、テ
スト対象プログラムの実行環境そのものにおいてテスト
することができるので、マイクロコンピュータが高機能
化されても、それに対処し得る。(4) Further, the effects of the above (1) and (2) can be obtained by using the branch instruction formed in the coverage measurement mode, and cannot be obtained by external hardware. Thus, the coverage of the program to be debugged can be accurately measured, even though the evaluation chip has a higher function. In other words, according to the coverage measuring method in the present embodiment, the test can be performed in the execution environment itself of the test target program without requiring special hardware, so that even if the microcomputer is sophisticated, , Can deal with it.
〔実施例2〕 第7図には、仮想記憶システムへの適用例が示され
る。同図に示されるように、このシステムは、特に制限
されないが、多様な分散キャッシュと並列処理により高
機能化されたマイクロコンピュータ50と、テスト対象プ
ログラムなどが格納されるRAM51と、本実施例システム
の初期設定用のプログラムなどが格納されたROM52と、
記憶装置54との間でデータの入出力を可能とするI/O53
とを有する。尚、マイクロコンピュータ50の基本的構成
は第2図に示されるのと等しい。記憶装置54には例えば
フロッピーディスク装置が適用され、A,B,Cで区別され
るように複数のプログラムが格納されている。このプロ
グラムA,B,CがI/O53を介して選択的にRAM51に転送され
ることにより、当該複数のプログラムA,B,Cが時分割で
使用可能とされる。かかるシステムにおいて外部記憶装
置54内の複数のプログラムA,B,Cの全てがテスト対象と
される場合でも、上記実施例と同様に、分岐命令の特定
ビット例えば最上位ビットの状態を変更するとともに当
該命令コードに分岐命令の実行状況をセットするための
情報エリアを付加することにより(第3図参照)、当該
分岐命令のカバレージ測定を適確に行うことができる。
例えばプログラムAがRAM51に転送され、それがマイク
ロコンピュータ50により実行されると、上記の分岐命令
フェッチにより当該分岐命令の情報エリアに当該命令の
実行状況が記録される。情報エリア及び当該エリアへの
実行状況の記録については上記第1実施例の場合と同様
であるのでここでは詳述しない。そしてこのプログラム
Aから他のプログラム例えばプログラムCの実行に移行
される場合、RAM51内にはプログラムCが格納されるこ
とになるが、RAM51にこのプログラムCが転送される前
に当該RAM51内のプログラムAが記憶装置54に退避され
る。これにより、上記プログラムAについてのカバレー
ジ測定結果が消滅されるのを防止することができる。そ
してその後にRAM51にプログラムCが転送され、上記プ
ログラムAと同様にマイクロコンピュータ50により当該
RAM51内のプログラムCが実行され、当該分岐命令の実
行状況が当該分岐命令の情報エリアに記録される。尚、
他のプログラムへ移行される場合にも上記と同様にプロ
グラムの退避が行われる。そして同一分岐命令が複数回
実行される場合には、上記実施例の場合と同様に、情報
エリアに既に記録されている実行状況と今回の実行状況
との論理和がとられ、それが新たな実行状況として当該
情報エリアに記録される。Second Embodiment FIG. 7 shows an example of application to a virtual storage system. As shown in the figure, this system is not particularly limited, but includes a microcomputer 50 that has been enhanced by various distributed caches and parallel processing, a RAM 51 that stores a test target program and the like, and a system according to the present embodiment. ROM52 in which a program for initial setting and the like are stored,
I / O 53 that enables input and output of data to and from storage device 54
And The basic configuration of the microcomputer 50 is the same as that shown in FIG. For example, a floppy disk device is applied to the storage device 54, and a plurality of programs are stored so as to be distinguished by A, B, and C. By selectively transferring the programs A, B, and C to the RAM 51 via the I / O 53, the plurality of programs A, B, and C can be used in a time-division manner. In such a system, even when all of the plurality of programs A, B, and C in the external storage device 54 are to be tested, the state of the specific bit of the branch instruction, for example, the state of the most significant bit is changed as in the above embodiment. By adding an information area for setting the execution status of the branch instruction to the instruction code (see FIG. 3), it is possible to accurately measure the coverage of the branch instruction.
For example, when the program A is transferred to the RAM 51 and executed by the microcomputer 50, the execution status of the instruction is recorded in the information area of the branch instruction by the above-described branch instruction fetch. The information area and the recording of the execution status in the area are the same as in the first embodiment, and will not be described in detail here. When the program A is shifted to the execution of another program, for example, the program C, the program C is stored in the RAM 51. However, before the program C is transferred to the RAM 51, the program in the RAM 51 is executed. A is saved in the storage device 54. As a result, it is possible to prevent the coverage measurement result for the program A from disappearing. After that, the program C is transferred to the RAM 51, and the microcomputer 50 performs the transfer in the same manner as the program A.
The program C in the RAM 51 is executed, and the execution status of the branch instruction is recorded in the information area of the branch instruction. still,
When the program is shifted to another program, the program is saved as described above. When the same branch instruction is executed a plurality of times, the logical sum of the execution status already recorded in the information area and the current execution status is obtained, as in the case of the above-described embodiment. The execution status is recorded in the information area.
このようにして全てのテスト対象プログラムについて
の一通りのテストが終了された時点で、記憶装置54内に
退避されたプログラムから分岐命令を抽出することによ
り、上記実施例の場合と同様に分岐命令のカバレージ解
析を適確に行うことができる。尚、このカバレージ解析
については上記実施例と同様に、ホストコンピュータ19
(第1図参照)によって、若しくはマイクロコンピュー
タ50によって行うことができる。When a series of tests for all the test target programs are completed in this way, by extracting a branch instruction from the program saved in the storage device 54, the branch instruction is extracted in the same manner as in the above embodiment. Can be accurately analyzed. Note that this coverage analysis is performed in the same manner as in the above embodiment.
(See FIG. 1) or by the microcomputer 50.
〔実施例3〕 第8図には、他の実施例において使用されるCVR(カ
バレージ)命令のフォーマットが示される。同図に示さ
れるCVR命令は、特に制限されないが、60で示される命
令コードと、61で示される情報エリアとから成る。この
命令コード(5555)は、当該命令がCVR命令であること
を示しているが、CVR命令を示す限り、どのような値で
もよい。この命令がマイクロコンピュータで実行される
場合には、情報エリア61に当該命令の実行回数が記録さ
れるようになっている。Third Embodiment FIG. 8 shows a format of a CVR (coverage) instruction used in another embodiment. Although not particularly limited, the CVR instruction shown in the figure includes an instruction code indicated by 60 and an information area indicated by 61. This instruction code (5555) indicates that the instruction is a CVR instruction, but may have any value as long as it indicates a CVR instruction. When this instruction is executed by the microcomputer, the information area 61 records the number of times the instruction is executed.
第9図には分岐命令を含む通常のプログラムの基本的
な流れが示され、第10図には上記CVR命令が含まれるプ
ログラムの流れが示される。FIG. 9 shows a basic flow of an ordinary program including a branch instruction, and FIG. 10 shows a flow of a program including the above CVR instruction.
上記のCVR命令を用いてカバレージ測定を行う場合、
第10図に示されるように、分岐命令の通過パス62と分岐
命令の分岐パス63とにCVR命令64,65が挿入される。この
ようなCVR命令挿入は、テスト対象プログラムのアセン
ブラ段階で行うことができる。CVRの情報エリア61には
当該CVR命令の実行回数が記録されるが、その初期値は1
6進数で(0000)とされる。CVR命令の実行回数は当該CV
R命令を実行するマイクロコンピュータによって行われ
る。例えば第1図に示されるシステムを使用する場合、
分岐命令に情報エリアを形成する必要はないが、ホスト
コンピュータ19において当該分岐命令の直後、すなわち
当該分岐命令の通過パス62と分岐パス63とに上記CVR命
令が挿入される。そしてこのCVR命令を含むプログラム
がRAM12に転送され、評価チップ24で当該プログラムが
実行される。このプログラム実行において第10図の分岐
命令がフェッチされ、当該分岐命令の条件不成立により
当該分岐命令が通過された場合には、CVR命令64におけ
る情報エリア61の値が+1され、また分岐条件成立によ
り分岐された場合にはCVR命令65における情報エリア61
の値が+1される。このようなインクリメントは、制御
ユニット32の制御下で実行ユニット33によって行われ
る。尚、このインクリメントは、16進数の(FFFF)で終
了される。この情報エリアの値は分岐命令の通過回数又
は分岐回数を示し、これによって分岐命令の実行状況を
間接的に把握することができ、従って上記実施例と同様
の効果を得ることができる。When performing coverage measurement using the above CVR instruction,
As shown in FIG. 10, CVR instructions 64 and 65 are inserted into a branch instruction passing path 62 and a branch instruction branch path 63. Such CVR instruction insertion can be performed at the assembler stage of the test target program. The number of executions of the CVR instruction is recorded in the CVR information area 61, and its initial value is 1
Hexadecimal (0000). The execution count of the CVR instruction is
This is done by a microcomputer executing the R instruction. For example, when using the system shown in FIG.
It is not necessary to form an information area in the branch instruction, but the CVR instruction is inserted in the host computer 19 immediately after the branch instruction, that is, in the passing path 62 and the branch path 63 of the branch instruction. Then, the program including the CVR instruction is transferred to the RAM 12, and the evaluation chip 24 executes the program. In the execution of this program, the branch instruction in FIG. 10 is fetched, and when the branch instruction is passed because the condition of the branch instruction is not satisfied, the value of the information area 61 in the CVR instruction 64 is incremented by 1 and the branch condition is satisfied. Information area 61 in CVR instruction 65 when branching
Is incremented by one. Such an increment is performed by the execution unit 33 under the control of the control unit 32. This increment is terminated by hexadecimal (FFFF). The value of the information area indicates the number of times the branch instruction has passed or the number of branches, whereby the execution status of the branch instruction can be indirectly grasped, and the same effect as in the above embodiment can be obtained.
尚、CVR命令は、カバレージ測定が完了された後は不
必要となるから削除される。Note that the CVR instruction is unnecessary after the coverage measurement is completed, and thus is deleted.
〔実施例4〕 第11図には、他の実施例において使用されるCVR命令
のフォーマットが示される。同図に示されるCVR命令は
上記第3実施例と同様に、CVR命令を示すコード(555
5)を含んで成るが、このコードの最上位ビットが情報
エリアとして利用される。すなわちこのCVR命令がマイ
クロコンピュータによって実行された場合、上記CVRの
命令コード(5555)の最上位ビットが“1"とされ、16進
数の(D555)とされる。ただし、2回目以降のCVR命令
フェッチ時には当該最上位ビットへの書込みサイクルは
発生されない。Fourth Embodiment FIG. 11 shows a format of a CVR instruction used in another embodiment. The CVR instruction shown in the figure is a code (555) indicating the CVR instruction, as in the third embodiment.
5), but the most significant bit of this code is used as an information area. That is, when the CVR instruction is executed by the microcomputer, the most significant bit of the instruction code (5555) of the CVR is set to "1" and is set to a hexadecimal number (D555). However, at the time of the second or subsequent CVR instruction fetch, a write cycle to the most significant bit is not generated.
本実施例におけるCVR命令は、上記第3実施例と同様
に分岐命令の通過パスと分岐パスとの双方に挿入される
ことにより、上記実施例と同様に評価チップ24で実行さ
れ、それぞれ通過、分岐に応じた1ビット情報により分
岐命令の実行状況の記録が可能とされる。従って本実施
例においても、上記実施例と同様の効果を得ることがで
きる。特に本実施例では、カバレージ測定において2回
目以降のCVR命令フェッチ時には情報エリア(命令コー
ドの最上位ビット)への書込みサイクルが発生されない
ため、高速システムのテスト時においてもカバレージ測
定に起因するプログラム実行速度の低下を阻止すること
ができる。The CVR instruction in the present embodiment is inserted into both the passing path and the branch path of the branch instruction in the same manner as in the third embodiment, and is executed by the evaluation chip 24 in the same manner as in the above embodiment. The execution status of the branch instruction can be recorded by 1-bit information corresponding to the branch. Therefore, also in this embodiment, the same effect as in the above embodiment can be obtained. In particular, in the present embodiment, in the second and subsequent CVR instruction fetches in the coverage measurement, a write cycle to the information area (the most significant bit of the instruction code) is not generated, so that even when testing a high-speed system, program execution caused by the coverage measurement is performed. A decrease in speed can be prevented.
以上本発明者によってなされた発明を実施例に基づい
て具体的に説明したが、本発明は上記実施例に限定され
ず、その要旨を逸脱しない範囲において種々変更可能で
ある。Although the invention made by the inventor has been specifically described based on the embodiment, the invention is not limited to the above embodiment, and can be variously modified without departing from the gist thereof.
例えば、上記実施例では評価チップ24によって、分岐
命令を含む各種命令を実行するようにしたが、ユーザ実
機に搭載される実チップを使用することもできる。ま
た、上記実施例ではテスト対象プログラムをユーザ開発
装置10内のRAM12内に格納するようにしたが、インサー
キットエミュレータ18内の貸出しメモリやその他の書込
み/読出し可能な外部メモリを使用することもできる。
更に上記第1実施例において、カバレージ測定の簡略化
を図るため、分岐条件の種類を記録するための第3のエ
リア40cを省略してもよい。For example, in the above embodiment, various instructions including a branch instruction are executed by the evaluation chip 24, but an actual chip mounted on the actual user machine may be used. Further, in the above embodiment, the test target program is stored in the RAM 12 in the user development device 10, but a lending memory in the in-circuit emulator 18 or another writable / readable external memory may be used. .
Further, in the first embodiment, the third area 40c for recording the type of the branch condition may be omitted in order to simplify the coverage measurement.
以上の説明では主として本発明者によってなされた発
明をその背景となった利用分野であるマイクロコンピュ
ータ開発システムや仮想記憶システムに適用した場合に
ついて説明したが、本発明はそれに限定されるものでは
なく、例えば中、大型の全てのコンピュータシステム及
びその開発システムなどにも広く適用することができ
る。本発明は少なくともソフトウェアデバッグを必要と
する条件のものに適用することができる。In the above description, mainly the case where the invention made by the present inventor is applied to a microcomputer development system or a virtual storage system which is a utilization field as the background has been described, but the present invention is not limited thereto. For example, it can be widely applied to all medium and large computer systems and their development systems. The present invention can be applied to at least a condition requiring software debugging.
本願において開示される発明のうち代表的なものによ
って得られる効果を簡単に説明すれば、下記の通りであ
る。The effect obtained by the representative one of the inventions disclosed in the present application will be briefly described as follows.
すなわち、分岐命令コードの特定ビットの状態を変更
して当該命令コードをカバレージ測定対象として認識可
能とするとともに、当該命令コードに情報エリアを付加
し、若しくは情報エリアが付加されたカバレージ命令を
分岐命令の直後に挿入することにより、当該情報エリア
に、当該分岐命令実行状況を記録させ、当該情報エリア
の記録内容を解析することで適確なカバレージ測定を行
うことができる。しかも、かかるカバレージ測定方法に
おける分岐命令実行状況検出は、マイクロコンピュータ
の外部に出力される信号を用いるのではなく、マイクロ
コンピュータに実行状況を書込ませることで可能として
いるので、マイクロコンピュータが高機能化されている
場合においても、分岐命令の実行状況を直接若しくはカ
バレージ命令の実行状況により間接的に検出することが
でき、ソフトウェアの品質向上に大きく寄与できる。That is, the state of a specific bit of the branch instruction code is changed so that the instruction code can be recognized as a coverage measurement target, and an information area is added to the instruction code, or the coverage instruction to which the information area is added is a branch instruction. By inserting it immediately after the information area, the execution status of the branch instruction is recorded in the information area, and by analyzing the recorded contents of the information area, accurate coverage measurement can be performed. In addition, the detection of the branch instruction execution status in such a coverage measurement method can be performed by writing the execution status in the microcomputer instead of using a signal output to the outside of the microcomputer. In this case, the execution state of the branch instruction can be detected directly or indirectly based on the execution state of the coverage instruction, which greatly contributes to the improvement of software quality.
更に、上記のように情報エリアが付加された分岐命令
若しくはカバレージ命令がフェッチされた場合に当該情
報エリアに分岐命令実行状況若しくはカバレージ命令の
実行状況を記録可能なマイクロコンピュータによって、
上記のようなカバレージ測定を適確に行うことができ
る。Further, when a branch instruction or a coverage instruction to which an information area is added as described above is fetched, a microcomputer capable of recording a branch instruction execution state or a coverage instruction execution state in the information area,
The above-described coverage measurement can be accurately performed.
第1図は本発明の第1実施例方法を適用したマイクロコ
ンピュータ開発システムのブロック図、 第2図は第1図に示されるマイクロコンピュータ(評価
チップ)の詳細な構成ブロック図、 第3図は分岐命令のフォーマット図、 第4図は第1図に示されるシステムにおけるRAMの命令
語配置と当該命令の機械語コードとの関係説明図、 第5図はマイクロコンピュータ内の主要レジスタとその
ビット構成との説明図、 第6図は各種分岐命令とそれに対応する分岐条件との説
明図、 第7図は他の実施例システムのブロック図、 第8図は他の実施例方法に係るカバレージ命令のフォー
マット説明図、 第9図は分岐命令を含むプログラムの基本的な流れを示
すフローチャート、 第10図はカバレージ命令が挿入されたプログラムの基本
的な流れを示すフローチャート、 第11図は他の実施例方法に係るカバレージ命令のフォー
マット説明図、 第12図は分岐命令ファイルの説明図、 第13図はカバレージ解析結果の説明図である。 10…ユーザ開発装置、12,51…RAM、13,52…ROM、14,53
…I/O、16,17,21…フロッピーディスク、18…インサー
キットエミュレータ、19…ホストコンピュータ、20…プ
リンタ、22…表示装置、23…ポッド、24,50…マイクロ
コンピュータ、30…命令プリフェッチユニット、31…命
令デコードユニット、32…制御ユニット、33…実行ユニ
ット、34…メモリ管理ユニット、35…入出力制御ユニッ
ト、40,61…情報エリア、40a…第1のエリア、40b…第
2のエリア、40c…第3のエリア、54…記憶装置、60…
命令コード、62…通過パス、63…分岐パス、64,65…CVR
命令。FIG. 1 is a block diagram of a microcomputer development system to which the method of the first embodiment of the present invention is applied, FIG. 2 is a detailed block diagram of the microcomputer (evaluation chip) shown in FIG. 1, and FIG. FIG. 4 is a view for explaining the relationship between the instruction word arrangement in the RAM and the machine language code of the instruction in the system shown in FIG. 1, and FIG. 5 is a diagram showing the main registers in the microcomputer and their bit configuration. FIG. 6 is an explanatory diagram of various branch instructions and corresponding branch conditions. FIG. 7 is a block diagram of a system of another embodiment. FIG. 8 is a block diagram of a coverage instruction according to a method of another embodiment. Format explanation diagram, FIG. 9 is a flowchart showing a basic flow of a program including a branch instruction, and FIG. 10 shows a basic flow of a program in which a coverage instruction is inserted. Flowcharts, FIG. 11 is the format explanatory diagram of a coverage instruction according to another embodiment the method, FIG. 12 is an explanatory view of a branch instruction file 13 is an explanatory diagram of the coverage analysis results. 10 ... User development device, 12,51 ... RAM, 13,52 ... ROM, 14,53
... I / O, 16,17,21 ... Floppy disk, 18 ... In-circuit emulator, 19 ... Host computer, 20 ... Printer, 22 ... Display device, 23 ... Pod, 24,50 ... Microcomputer, 30 ... Instruction prefetch unit 31 instruction decoding unit, 32 control unit, 33 execution unit, 34 memory management unit, 35 input / output control unit, 40,61 information area, 40a first area, 40b second area , 40c ... third area, 54 ... storage device, 60 ...
Instruction code, 62: passing path, 63: branching path, 64, 65: CVR
order.
Claims (5)
して当該命令コードをカバレージ測定対象として認識可
能とするとともに、当該命令コードに情報エリアを付加
するステップと、この情報エリアが付加された分岐命令
を含むプログラムをマイクロコンピュータに実行させ、
当該分岐命令の実行状況を当該情報エリアに記録させる
ステップと、この情報エリアの記録内容に基づいて当該
分岐命令のカバレージ解析を行うステップとを含むカバ
レージ測定方法であって、 上記情報エリアは、上記マイクロコンピュータに含まれ
る演算器の演算結果を保持するコンディションコードレ
ジスタを参照して判定される分岐条件に対応する記憶エ
リアを有し、 上記分岐命令の実行によって判定された上記分岐条件が
成立するか否かの情報が、対応する上記記憶エリアに書
き込まれることを特徴とするカバレージ測定方法。A step of changing a state of a specific bit of a branch instruction code so that the instruction code can be recognized as an object of coverage measurement, adding an information area to the instruction code, and adding the information area to the instruction code. Causing a microcomputer to execute a program including a branch instruction,
A coverage measurement method including a step of recording the execution status of the branch instruction in the information area, and a step of performing a coverage analysis of the branch instruction based on the recorded contents of the information area, wherein the information area is A storage area corresponding to a branch condition determined with reference to a condition code register holding an operation result of an arithmetic unit included in the microcomputer, and whether the branch condition determined by execution of the branch instruction is satisfied A method of measuring coverage, wherein information on whether or not the data is written is stored in the corresponding storage area.
ドと命令実行回数を記録するための情報エリアとを備え
たカバレージ命令を、分岐命令の分岐パスと通過パスと
の双方に挿入するステップと、このカバレージ命令が挿
入されたプログラムをマイクロコンピュータに実行さ
せ、上記分岐命令の分岐パス又は通過パスにおいてそれ
ぞれ対応するカバレージ命令が上記マイクロコンピュー
タで実行される毎に、当該カバレージ命令の情報エリア
に記録されている命令実行回数をインクリメントするス
テップと、上記カバレージ命令における情報エリアの命
令実行回数に基づいて上記分岐命令のカバレージ解析を
行うステップとを含むことを特徴とするカバレージ測定
方法。2. A step of inserting a coverage instruction including an instruction code indicating a coverage instruction and an information area for recording the number of times of instruction execution into both a branch path and a passing path of a branch instruction. The program in which the coverage instruction is inserted is executed by the microcomputer, and each time the corresponding coverage instruction is executed by the microcomputer in the branch path or the passing path of the branch instruction, the program is recorded in the information area of the coverage instruction. Incrementing the number of executed instructions, and performing a coverage analysis of the branch instruction based on the number of executed instructions in the information area of the coverage instruction.
更及び分岐命令コードへの情報エリアの付加、又は上記
カバレージ命令の挿入は、高級言語で記述されたソース
プログラムを機械語に翻訳する段階で行われる請求項1
又は2記載のカバレージ測定方法。3. Changing the state of a specific bit of the branch instruction code and adding an information area to the branch instruction code or inserting the coverage instruction at the stage of translating a source program described in a high-level language into a machine language. Claim 1 to be performed
Or the coverage measuring method according to 2.
よる演算結果が保持されるコンディションコードレジス
タとを含むマイクロコンピュータであって、 上記コンディションコードレジスタを参照して判定され
る分岐条件に対応する記憶エリアを含む情報エリアが付
加された分岐命令をフェッチした場合に、当該情報エリ
アへの情報記録制御信号を生成する命令制御部と、 上記情報記録制御信号に従って上記分岐命令の実行状況
を当該分岐命令の情報エリアに記録する実行部とを含
み、 上記実行部は、上記分岐命令の実行によって判定された
上記分岐条件が成立するか否かの情報を、対応する上記
記憶エリアに書き込むための手段を含んで成ることを特
徴とするマイクロコンピュータ。4. A microcomputer comprising: an arithmetic unit for performing a predetermined operation; and a condition code register for storing an operation result of the arithmetic unit, wherein a branch condition determined with reference to the condition code register is An instruction control unit that, when fetching a branch instruction to which an information area including a corresponding storage area is added, generates an information recording control signal for the information area; An execution unit for recording in the information area of the branch instruction, the execution unit writes information on whether or not the branch condition determined by execution of the branch instruction is satisfied into the corresponding storage area. A microcomputer comprising the means of (1).
ドと命令実行回数を記録するための情報エリアとを含む
カバレージ命令が、分岐命令の分岐パスと通過パスとの
双方に挿入されて成るプログラムを実行するマイクロコ
ンピュータであって、 上記分岐命令の分岐パス又は通過パスにおいてそれぞれ
対応するカバレージ命令が実行される毎に、当該カバレ
ージ命令の情報エリアに記録されている命令実行回数を
インクリメントする実行部を含むことを特徴とするマイ
クロコンピュータ。5. A program in which a coverage instruction including an instruction code indicating a coverage instruction and an information area for recording the number of executed instructions is inserted into both a branch path and a passing path of a branch instruction. A microcomputer that executes, each time a corresponding coverage instruction is executed in a branch path or a passing path of the branch instruction, an execution unit that increments an instruction execution number recorded in an information area of the coverage instruction. A microcomputer characterized by including:
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP1342966A JP2915944B2 (en) | 1989-12-29 | 1989-12-29 | Coverage measurement method and microcomputer |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP1342966A JP2915944B2 (en) | 1989-12-29 | 1989-12-29 | Coverage measurement method and microcomputer |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPH03204044A JPH03204044A (en) | 1991-09-05 |
| JP2915944B2 true JP2915944B2 (en) | 1999-07-05 |
Family
ID=18357893
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP1342966A Expired - Fee Related JP2915944B2 (en) | 1989-12-29 | 1989-12-29 | Coverage measurement method and microcomputer |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2915944B2 (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| GB2487355B (en) * | 2011-01-13 | 2020-03-25 | Advanced Risc Mach Ltd | Processing apparatus, trace unit and diagnostic apparatus |
| US11822468B2 (en) | 2019-05-24 | 2023-11-21 | Microsoft Technology Licensing, Llc | Executable code branch annotations for objective branch verification |
-
1989
- 1989-12-29 JP JP1342966A patent/JP2915944B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JPH03204044A (en) | 1991-09-05 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US6430741B1 (en) | System and method for data coverage analysis of a computer program | |
| US8266608B2 (en) | Post-compile instrumentation of object code for generating execution trace data | |
| US5134701A (en) | Test apparatus performing runtime replacement of program instructions with breakpoint instructions for processor having multiple instruction fetch capabilities | |
| US5889981A (en) | Apparatus and method for decoding instructions marked with breakpoint codes to select breakpoint action from plurality of breakpoint actions | |
| US5345580A (en) | Microprocessor device and emulator device thereof | |
| JP4190114B2 (en) | Microcomputer | |
| US6321331B1 (en) | Real time debugger interface for embedded systems | |
| EP0528585B1 (en) | Data processing system with internal instruction cache | |
| US9152531B2 (en) | Post-compile instrumentation of object code for generating execution trace data | |
| EP0453268A2 (en) | A microprocessor for inserting a bus cycle to output an internal information for an emulation | |
| US6141791A (en) | Debug aid device, program compiler device, storage medium storing computer-readable debugger program, and storage medium storing program compiler program | |
| JP2005276201A (en) | Method and apparatus for autonomic test case feedback using hardware assistance for code coverage | |
| US10824426B2 (en) | Generating and verifying hardware instruction traces including memory data contents | |
| EP0199009A2 (en) | Path coverage measuring system in a programme | |
| CN117892661A (en) | Simulator comparison system based on RISC-V processor verification | |
| US7110934B2 (en) | Analysis of the performance of a portion of a data processing system | |
| CN114691520A (en) | Instruction programmable buffer area design system based on processor debugging framework | |
| JP2915944B2 (en) | Coverage measurement method and microcomputer | |
| US7596725B2 (en) | Efficient trace triggering | |
| CN116541266A (en) | Program running method, device, equipment and medium | |
| JPH096646A (en) | Program simulation device | |
| KR100273280B1 (en) | Debugging logic control circuit | |
| JPS62164140A (en) | Testing of data processing system | |
| JP2919406B2 (en) | Performance evaluation method | |
| JP2923570B2 (en) | In-circuit emulator and microprocessor |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| LAPS | Cancellation because of no payment of annual fees |