JPH0619752A - Microcomputer - Google Patents

Microcomputer

Info

Publication number
JPH0619752A
JPH0619752A JP4175131A JP17513192A JPH0619752A JP H0619752 A JPH0619752 A JP H0619752A JP 4175131 A JP4175131 A JP 4175131A JP 17513192 A JP17513192 A JP 17513192A JP H0619752 A JPH0619752 A JP H0619752A
Authority
JP
Japan
Prior art keywords
program
instruction
execution
execution time
address
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
Application number
JP4175131A
Other languages
Japanese (ja)
Inventor
Hisaharu Oba
久晴 大場
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP4175131A priority Critical patent/JPH0619752A/en
Publication of JPH0619752A publication Critical patent/JPH0619752A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Microcomputers (AREA)

Abstract

PURPOSE:To considerably accurately measure only time when a program to be messured is really executed while an environment for naturally executing CPU at the time of executing the program to be messured and the other peripheral hardware is maintained. CONSTITUTION:A program memory 170, CPU 110 provided with PC 150, IR 130 and a timing signal generation circuit 140 generating a timing signal based on IR 130, and program execution time measurement circuit 160 measuring the execution time of a prescribed program by the output of PC 150 and the timing signal are provided. The program execution time measurement circuit 160 is provided with comparison registers 161 and 162 executing comparison with the output of PC 150 and storing the start address and the end address of the program to be measured and a timer 165 executing increment only within the execution time of an instruction based on an instruction read indication signal 141, an instruction execution termination indication signal 142 and comparison coincidence signals EQS and EQE.

Description

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

【0001】[0001]

【産業上の利用分野】本発明はマイクロコンピュータに
関し、特にプログラムの実行時間を計測する機能を備え
たマイクロコンピュータに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer, and more particularly to a microcomputer having a function of measuring a program execution time.

【0002】[0002]

【従来の技術】近年、マイクロコンピュータを用いたシ
ステムにおいて、マイクロコンピュータの高速化に対応
し、またマイクロコンピュータ処理の高精度化をはかる
ために、高機能な周辺ハードウエアをマイクロコンピュ
ータに内蔵したり、より高速な周辺ハードウエアを外部
に接続することが増えている。しかも、マイクロコンピ
ュータのCPUとこれらの周辺ハードウエアのインター
ヘェースをとるために、割り込み制御回路をマイクロコ
ンピュータ内部に搭載するなどして、より高速かつ高精
度の処理を実現しようとしている。
2. Description of the Related Art In recent years, in a system using a microcomputer, high-performance peripheral hardware has been built into the microcomputer in order to cope with the speeding up of the microcomputer and to improve the accuracy of microcomputer processing. , There is an increasing trend to connect faster peripheral hardware to the outside world. Moreover, in order to provide an interface between the CPU of the microcomputer and these peripheral hardware, an interrupt control circuit is mounted inside the microcomputer to realize faster and more accurate processing.

【0003】従って、プログラム開発において、例えば
周辺ハードウエアに対するCPUの割り込み処理の実行
時間等を常に意識し、その応答時間を正しく認識してプ
ログラム開発(デバッグ)にあたる必要がある。そこ
で、作成されたプログラムの実行時間を計測するため
に、例えば計測しようとするプログラムの直前および直
後に、マイクロコンピュータ内部あるいは外部に被計測
プログラムの開始と終了に相当するタイミングを知らし
めることができる命令をおき、これらの命令の実行によ
っておこる事象を観測することにより、その実行時間を
計測している。
Therefore, in the program development, for example, it is necessary to always be aware of the execution time of the interrupt processing of the CPU with respect to the peripheral hardware, and to correctly recognize the response time for the program development (debugging). Therefore, in order to measure the execution time of the created program, for example, immediately before and after the program to be measured, it is possible to inform the inside or outside of the microcomputer of the timings corresponding to the start and end of the measured program. The execution time is measured by placing instructions and observing the events that occur due to the execution of these instructions.

【0004】具体的な方法としては、例えば被計測プロ
グラムの直前に且つ周辺ハードウエアのポートに”1”
をセットする命令を行い、被計測プログラムの直後にポ
ートを”0”にリセットする命令を行い、そしてポート
の変化を観測しポートが”1”の期間を計測することで
被計測プログラムの実行時間を計測するという方法があ
る。
As a concrete method, for example, "1" is set to the port of the peripheral hardware immediately before the measured program.
Is executed, the port is reset to "0" immediately after the program to be measured, and the change of the port is observed, and the period when the port is "1" is measured. There is a method of measuring.

【0005】また、内部および外部の周辺ハードウエア
にタイマがある場合には、被計測プログラムの直前にタ
イマをリードする命令を実行することにより、そのタイ
マのリードデータから被計測プログラムの実行時間を計
測する等の方法もある。
If the internal and external peripheral hardware have timers, the instruction to read the timer is executed immediately before the program to be measured, and the execution time of the program to be measured is read from the read data of the timer. There are also methods such as measuring.

【0006】要するに、かかるプログラムの開発はプロ
グラムの実行時間を知り、それをプログラム開発の際の
デバッグ情報として用いることにより進められる。
[0006] In short, the development of such a program proceeds by knowing the execution time of the program and using it as debug information during program development.

【0007】[0007]

【発明が解決しようとする課題】上述した従来のマイク
ロコンピュータは、その実行時間を計測するにあたり、
被計測プログラムの直前および直後においたマイクロコ
ンピュータ外部および内部に事象の変化を与える命令を
行うことは、被計測プログラムの実行開始および実行終
了に相当するタイミングを知るための代替の行為であ
り。被計測プログラムの真の実行終了タイミングとは必
ずしも一致していない。すなわち、これらの命令が実行
され、マイクロコンピュータ外部および内部に事象の変
化を生じる際の応答の遅れが発生する事は避けられな
い。
The above-mentioned conventional microcomputer has the following problems in measuring the execution time.
Issuing an instruction that causes a change in an event outside and inside the microcomputer immediately before and after the measured program is an alternative action for knowing the timing corresponding to the start and end of execution of the measured program. It does not always coincide with the true execution end timing of the measured program. That is, it is unavoidable that a delay in response occurs when these instructions are executed and a change in an event occurs inside or outside the microcomputer.

【0008】また、被計測プログラムの直前・直後に本
来必要のない命令をおき、しかも周辺ハードウエアの一
部を計測手段として使用するため、非計測プログラムが
本来実行されようとしていた環境とは異なってしまう可
能性がある。
Further, since an unnecessary instruction is placed immediately before and after the program to be measured, and a part of the peripheral hardware is used as a measuring means, it is different from the environment where the non-measurement program is supposed to be executed. There is a possibility that it will end up.

【0009】さらに、被計測プログラムの直前および直
後においた命令により周辺ハードウエアを動作させるこ
とから、被計測プログラム内では同一の周辺ハードウエ
アを使用できないことになり、これを避けるためには計
測プログラムに応じて複数の周辺ハードウエアを計測手
段として使い分けること等が必要となるため、実行時間
の計測のための操作が非常に繁雑になってしまう。
Further, since the peripheral hardware is operated by the instructions placed immediately before and after the program to be measured, the same peripheral hardware cannot be used in the program to be measured. Depending on the situation, it is necessary to properly use a plurality of peripheral hardware as the measuring means, which makes the operation for measuring the execution time very complicated.

【0010】本発明の目的は、プログラムの実行時間を
計測する際に、被計測プログラムの実行時のCPUやそ
の他周辺ハードウエア等を本来実行しようとする環境を
維持したまま、しかも被計測プログラムが真に実行され
ている時間のみを極めて正確に測ることのできるマイク
ロコンピュータを提供することにある。
An object of the present invention is to measure a program execution time while maintaining the environment in which the CPU, other peripheral hardware, etc. at the time of execution of the measured program are originally intended to be executed, An object of the present invention is to provide a microcomputer capable of extremely accurately measuring only the time when it is truly executed.

【0011】[0011]

【課題を解決するための手段】本発明のマイクロコンピ
ュータは、プログラムを格納するプログラムメモリと、
命令の実行アドレスを示すプログラムカウンタ,実行す
る命令を格納する命令格納レジスタおよび前記命令格納
レジスタの内容をデコードし種々のタイミング信号を発
生するタイミング信号発生回路を備えた中央処理装置
と、前記プログラムカウンタおよび前記タイミング信号
発生回路が出力するタイミング信号に基づき所定のプロ
グラムの実行時間を計測するプログラム実行時間計測回
路とを有し、前記プログラム実行時間計測回路は、被計
測プログラムの開始および終了アドレスを記憶するアド
レス記憶手段と、前記プログラムカウンタと前記アドレ
ス記憶手段および前記タイミング信号発生回路が出力す
るタイミング信号に基づき前記被計測プログラムの実行
開始時刻から実行終了時刻までを測定する測定手段とを
備え、前記被計測プログラムの開始アドレスおよび終了
アドレスを前記アドレス記憶手段に設定することにより
前記被計測プログラムの実行時間を計測するように構成
される。
A microcomputer of the present invention includes a program memory for storing a program,
A central processing unit including a program counter indicating an instruction execution address, an instruction storage register for storing an instruction to be executed, and a timing signal generation circuit for decoding the contents of the instruction storage register to generate various timing signals, and the program counter And a program execution time measuring circuit that measures the execution time of a predetermined program based on the timing signal output from the timing signal generating circuit, and the program execution time measuring circuit stores the start and end addresses of the measured program. Address storage means for performing the program counter, the address storage means and measuring means for measuring from the execution start time to the execution end time of the measured program based on the timing signal output from the timing signal generation circuit, Measured Configured to measure the execution time of the object to be measured program by setting the start address and end address of grams to the address storage means.

【0012】[0012]

【実施例】次に、本発明の実施例について図面を参照し
て説明する。図1は本発明の第1の実施例を示すマイク
ロコンピュータのブロック図である。図1に示すよう
に、本実施例のマイクロコンピュータ100は、中央処
理装置(以下CPLと記す)100と実行時間計測回路
160およびプログラムメモリ170とを有し、これら
は互いにアドレス・データバス180により接続され
る。CPU110はアドレス・データバス制御回路12
0と、命令格納レジスタ(以下IRと記す)130と、
タイミング信号発生回路140と、プログラムカウンタ
(以下PCと記す)150とからなる。
Embodiments of the present invention will now be described with reference to the drawings. FIG. 1 is a block diagram of a microcomputer showing a first embodiment of the present invention. As shown in FIG. 1, the microcomputer 100 of the present embodiment has a central processing unit (hereinafter referred to as CPL) 100, an execution time measuring circuit 160 and a program memory 170, which are mutually connected by an address / data bus 180. Connected. The CPU 110 is an address / data bus control circuit 12
0, an instruction storage register (hereinafter referred to as IR) 130,
It is composed of a timing signal generation circuit 140 and a program counter (hereinafter referred to as PC) 150.

【0013】まず、かかるマイクロコンピュータ100
において、アドレス・データバス制御回路120は、ア
ドレス・データバス180を介してプログラムメモリ1
70からのプログラムのリード制御を行なう。また、I
R130は、プログラムメモリ170から読み出された
オペコードを格納するレジスタであり、その内容はタイ
ミング信号発生回路140に出力される。このタイミン
グ信号発生回路140はIR130に格納されているオ
ペコードをデコードしマイクロコンピュータ100の各
部の動作を制御するための種々の制御信号を発生する回
路である。ここでは、プログラムメモリ170からのオ
ペコードの読みだしを指示する信号(以下PRD信号と
記す)141や、命令の実行終了タイミングを示す信号
(以下PEND信号と記す)142等を出力している。
First, the microcomputer 100
At the address / data bus control circuit 120, the program memory 1 is accessed via the address / data bus 180.
Read control of the program from 70 is performed. Also, I
The R 130 is a register that stores the operation code read from the program memory 170, and the content thereof is output to the timing signal generation circuit 140. The timing signal generation circuit 140 is a circuit that decodes the operation code stored in the IR 130 and generates various control signals for controlling the operation of each unit of the microcomputer 100. Here, a signal (hereinafter referred to as a PRD signal) 141 for instructing the reading of the operation code from the program memory 170, a signal (hereinafter referred to as a PEND signal) 142 for indicating the execution end timing of the instruction, and the like are output.

【0014】次に、PC150はプログラムメモリ17
0からのプログラムの読みだしアドレスを示すカウンタ
であり、タイミング信号発生回路140からPRD信号
141が出力されると+1インクリメントする。このP
C150の内容は実行時間計測回路160に出力されて
いる。
Next, the PC 150 uses the program memory 17
It is a counter that indicates the read address of the program from 0, and increments by +1 when the PRD signal 141 is output from the timing signal generation circuit 140. This P
The content of C150 is output to the execution time measuring circuit 160.

【0015】一方、プログラムメモリ170は実行する
プログラムを格納するメモリである。しかも、PC15
0およびアドレス・データバス制御回路120が出力す
るアドレスに基づいて命令(オペコード)のリードがア
ドレス・データバス180を介して行なわれる。また、
アドレス・データバス180はCPU110と実行時間
計測回路160とプログラムメモリ170およびマイク
ロコンピュータ内部および外部の周辺ハードウエアとの
接続を行なうためのバスであり、アドレスおよびデータ
がこのバスを介しやりとりされる。
On the other hand, the program memory 170 is a memory for storing a program to be executed. Moreover, PC15
Based on 0 and the address output from the address / data bus control circuit 120, an instruction (opcode) is read via the address / data bus 180. Also,
The address / data bus 180 is a bus for connecting the CPU 110, the execution time measuring circuit 160, the program memory 170, and peripheral hardware inside and outside the microcomputer, and addresses and data are exchanged via this bus.

【0016】図2は図1に示す実行時間計測回路の構成
図である。図2に示すように、この実行時間計測回路1
60は、プログラムメモリ170からのオペコードの読
みだしを指示するPRD信号141と命令の実行終了タ
イミングを示すPEND信号142およびPC150の
内容が入力され、2つのコンペアレジスタ(以下CMS
およびCMEと記す)161および162を有する。こ
れらのレジスタ161,162はアドレス・データバス
180を介し、CPU110からのデータの読み出しと
書き込みが可能なレジスタであり、その保持値とPC1
50の内容とを常に比較し、一致した場合にはそれぞれ
一致信号EQSおよびEQEをアクティブ”1”にす
る。
FIG. 2 is a block diagram of the execution time measuring circuit shown in FIG. As shown in FIG. 2, this execution time measuring circuit 1
A PRD signal 141 for instructing the reading of the operation code from the program memory 170, a PEND signal 142 indicating the execution end timing of the instruction, and the contents of the PC 150 are input to 60, and two compare registers (hereinafter referred to as CMS).
And CME) 161 and 162. These registers 161 and 162 are registers capable of reading and writing data from the CPU 110 via the address / data bus 180, and hold values thereof and PC1.
The contents of 50 are constantly compared, and if they match, the match signals EQS and EQE are made active "1".

【0017】また、実行時間計測回路160は、各種の
ゲートとフリップフロップ163,164およびタイマ
165とを備えている。ゲートG6とG7は反転素子で
あり、それぞれEQEおよびEQSを入力する。また、
ゲートG1〜G5およびG8は論理積(AND)素子で
あり、ANDゲートG1はPRD信号141とEQSを
入力し、ANDゲートG2はANDゲートG1の出力と
反転素子G6の出力を入力する。更に、ANDゲートG
3はEQEとPRD信号141を入力し、ANDゲート
G4PEND信号142とフリップフロップ163の出
力および反転素子G6の出力を入力する。しかもAND
ゲートG5はフリップフロップ164の出力とクロック
φを入力し、ANDゲートG8はEQSとANDゲート
G1の出力を入力する。
The execution time measuring circuit 160 also includes various gates, flip-flops 163 and 164, and a timer 165. The gates G6 and G7 are inverting elements and input EQE and EQS, respectively. Also,
The gates G1 to G5 and G8 are logical product (AND) elements, the AND gate G1 inputs the PRD signal 141 and EQS, and the AND gate G2 inputs the output of the AND gate G1 and the output of the inverting element G6. Furthermore, AND gate G
3 inputs the EQE and the PRD signal 141, and inputs the AND gate G4PEND signal 142, the output of the flip-flop 163 and the output of the inverting element G6. And AND
The gate G5 inputs the output of the flip-flop 164 and the clock φ, and the AND gate G8 inputs EQS and the output of the AND gate G1.

【0018】一方、フリップフロップ(以下F/Fと記
す)163はANDゲートG3の出力が”1”の時に”
1”にセットされ、ANDゲートG2の出力が”1”の
時に”0”にリセットされ、その出力はANDゲートG
4に入力される。また、F/F164は、ANDゲート
G1の出力が”1”の時に”0”にリセットされ、その
出力はANDゲートG5に入力される。タイマ(以下T
Mと記す)165はANDゲートG8の出力が”1”の
時にゼロにクリアされ、ANDゲートG5の出力が”
1”の時に+1のインクリメントを行うタイマである。
これにより、アドレス・データバス180を介しCPU
110からTM165のタイマ値をリードすることがで
きる。
On the other hand, the flip-flop (hereinafter referred to as F / F) 163 is "" when the output of the AND gate G3 is "1".
It is set to "1", and when the output of the AND gate G2 is "1", it is reset to "0", and its output is the AND gate G.
4 is input. The F / F 164 is reset to "0" when the output of the AND gate G1 is "1", and its output is input to the AND gate G5. Timer (hereinafter T
165) is cleared to zero when the output of the AND gate G8 is "1", and the output of the AND gate G5 is "1".
It is a timer that increments by 1 when "1".
This allows the CPU to operate via the address / data bus 180.
The timer value of TM165 can be read from 110.

【0019】次に、マイクロコンピュータ100が、プ
ログラムメモリ170に格納された命令(オペコード
群)をCPU110で実行する動作を説明する。
Next, the operation of the microcomputer 100 for executing the instructions (opcode group) stored in the program memory 170 by the CPU 110 will be described.

【0020】まず、オペコードの読みだしを指示するP
RD信号141がアクティブ”1”になると、CPU1
10はプログラムメモリ170からPC150が示すア
ドレスのオペコードをアドレス・データバス180を介
して読みだし、命令格納レジスタIR130に格納す
る。この時、PC150はPRD信号141により+1
インクリメントされる。次に、IR130に格納された
オペコードはタイミング信号発生回路140に入力され
るので、タイミング信号発生回路140はこれをデコー
ドしてマイクロコンピュータ100内の各部の動作を制
御する信号を発生し、命令実行を開始する。以下、順次
命令を構成するオペコードの数だけの読みだし動作を行
い、1つ命令の実行が終了すると、タイミング信号発生
回路140は命令実行終了タイミングであるPRD信号
142をアクティブ”1”にするとともに、PRD信号
141をアクティブ”1”にし、次の命令実行のために
オペコードの読みだし動作を行なう。以上の動作が1命
令におけるオペコードの読みだし動作および実行動作で
あり、以下順次同様の動作を続けて行く。
First, P for instructing the reading of the opcode
When the RD signal 141 becomes active "1", the CPU1
10 reads out the operation code of the address indicated by the PC 150 from the program memory 170 via the address / data bus 180 and stores it in the instruction storage register IR130. At this time, the PC 150 adds +1 by the PRD signal 141.
Incremented. Next, since the operation code stored in the IR 130 is input to the timing signal generation circuit 140, the timing signal generation circuit 140 decodes the operation code to generate a signal for controlling the operation of each unit in the microcomputer 100 and execute the instruction. To start. After that, when the read operation is performed by the number of opcodes forming the sequential instruction and the execution of one instruction is completed, the timing signal generation circuit 140 sets the PRD signal 142, which is the instruction execution end timing, to active “1”. , PRD signal 141 is activated to "1", and the operation of reading the operation code is performed for the execution of the next instruction. The above operation is the operation of reading and executing the operation code in one instruction, and thereafter, the same operation is sequentially continued.

【0021】次に、マイクロコンピュータ100のプロ
グラム実行時間を計測する場合の動作を図3を参照して
説明する。
Next, the operation of the microcomputer 100 when measuring the program execution time will be described with reference to FIG.

【0022】図3は図2に示す実行時間計測回路の動作
を説明するためのタイミング図である。図3に示すよう
に、この実行時間計測回路160は、まずCPU110
がプログラムの実行時間の計測に先立ち、計測しようと
するプログラムの先頭アドレスおよび終了アドレスをC
MS161およびCME162に格納しておく。ここで
は、被計測プログラムが命令1で始まり命令Nで終わる
プログラムとし且つその先頭アドレスを0100H(H
は16進表記を示す)および終了アドレスを0200H
であるとして説明する。
FIG. 3 is a timing chart for explaining the operation of the execution time measuring circuit shown in FIG. As shown in FIG. 3, the execution time measuring circuit 160 first detects the CPU 110.
C measures the start address and end address of the program to be measured before measuring the program execution time.
It is stored in the MS 161 and the CME 162. Here, the measured program is a program that starts with instruction 1 and ends with instruction N, and its start address is 0100H (H
Indicates hexadecimal notation) and end address is 0200H
Will be described.

【0023】まず、PC150が0100Hとなった
時、CMS161の格納値0100Hと一致するので、
一致信号EQSがアクティブ”1”になる。この時、E
QSが”1”であり、しかもPRD信号141が”0”
の時にゲートG7の出力が”1”であるので、ゲートG
8の出力は”1”となる。従ってTM165はゼロにク
リアされる。また、PC150は常に次に実行すべき命
令のアドレスを示しているので、この時点ではまだプロ
グラムメモリ170からは0100H番地の命令は読み
出されておらず、00FFHまでの命令が実行されてい
る。
First, when the PC 150 becomes 0100H, it matches the stored value 0100H of the CMS 161.
The coincidence signal EQS becomes active "1". At this time, E
QS is "1" and the PRD signal 141 is "0"
Since the output of the gate G7 is "1" at
The output of 8 becomes "1". Therefore, TM165 is cleared to zero. Further, since the PC 150 always indicates the address of the next instruction to be executed, the instruction at address 0100H has not been read from the program memory 170 at this point, and the instructions up to 00FFH have been executed.

【0024】次に、PRD信号141がアクティブ”
1”になると、プログラムメモリ170から0100番
地のオペコードが読み出され、IR0130を経てタイ
ミング信号発生回路140でデコードされることによ
り、命令実行がスタートする。この時、EQSがすで
に”1”であるため、ゲートG1の出力が”1”にな
る。また、EQEが”0”であるため、ゲートG6が”
1”になり、しかもG1の出力が”1”となるので、ゲ
ートG2の出力が”1”になる。よって、F/F163
は”0”にリセットされ、またF/F164は”1”に
セットされる。さらに、G8が”0”となることでTM
165に対するクリア動作が解除され、またゲートG5
の出力がクロックφ毎にアクティブ”1”となるため、
TM165は0000Hから0001H,0002H,
のように、+1のインクリメント動作を開始する。な
お、本実施例ではPRD信号141がアクティブ”1”
になった時点を命令の開始タイミングとしている。
Next, the PRD signal 141 is active "
When it becomes 1 ", the operation code at address 0100 is read from the program memory 170 and decoded by the timing signal generation circuit 140 via IR0130, so that the instruction execution is started. At this time, EQS is already" 1 ". Therefore, the output of the gate G1 becomes “1.” Since the EQE is “0”, the gate G6 becomes “1”.
Since the output of G1 becomes "1" and the output of G1 becomes "1", the output of the gate G2 becomes "1".
Is reset to "0" and the F / F 164 is set to "1". Furthermore, when G8 becomes "0", TM
The clear operation for 165 is canceled, and the gate G5
Output becomes active "1" every clock φ,
TM165 is 0000H to 0001H, 0002H,
, The increment operation of +1 is started. In this embodiment, the PRD signal 141 is active “1”.
Is the start timing of the instruction.

【0025】次に、PC150がインクリメントされ0
101Hとなったため、CMS161の一致信号EQS
は不一致となり、インアクティブ”0”となる。さら
に、PRD信号141がアクティブ”1”になると、P
C150が示す0101Hのオペコードがプログラムメ
モリ170から読み出され、IR130を経てタイミン
グ信号発生回路140でデコードされるので、さらに命
令実行動作を行う。このとき、EQSはすでに”0”で
あるため、ゲートG1〜G7およびF/F163,16
4に変化を与えない。なお、最初に実行している命令
は、0100H番地と0100H番地の2つのオペコー
ドからなる命令であるとし、これを命令1と呼ぶことに
する。
Next, the PC 150 is incremented to 0.
Since it becomes 101H, the coincidence signal EQS of the CMS 161
Are inconsistent and become inactive "0". Further, when the PRD signal 141 becomes active "1", P
Since the operation code of 0101H indicated by C150 is read from the program memory 170 and is decoded by the timing signal generation circuit 140 via the IR 130, the instruction execution operation is further performed. At this time, since EQS is already "0", the gates G1 to G7 and the F / Fs 163, 16 are
4 is not changed. Note that the instruction that is being executed first is an instruction consisting of two opcodes at addresses 0100H and 0100H, and this is called instruction 1.

【0026】かかる命令1の実行が終了する時、タイミ
ング発生回路140は命令実行の終了タイミングを示す
PEND信号142をアクティブ”1”にするととも
に、次なる命令2を読み出すためにPRD信号141を
アクティブ”1”にし、0102H番地のオペコードを
読み出す動作を行う。以下、順次同様の動作を継続する
とともに、TM165はインクリメント動作を継続して
行く。
When the execution of the instruction 1 is completed, the timing generation circuit 140 activates the PEND signal 142 indicating the completion timing of the instruction execution to "1" and activates the PRD signal 141 to read the next instruction 2. The operation code is set to "1" and the operation code at address 0102H is read. Hereinafter, the same operation is sequentially continued, and the TM 165 continues the increment operation.

【0027】さらに、命令の実行が進み、PC150が
0200Hとなったとき、CME162は一致信号EQ
Eをアクティブ”1”とする。この時点では、まだ01
FFHまでの命令N−1が実行されている。次に、02
00Hのオペコードを読み出すためにPRD信号141
がアクティブ”1”になると、EQEが”1”であるこ
とからゲートG3の出力が”1”となり、F/F163
は”1”にセットされる。このとき同時に、命令N−1
の実行終了を示すPEND信号142がアクティブ”
1”になるが、G6が”0”であることから、ゲートG
4は”0”のままである。なお、0200Hのオペコー
ドは1つで命令Nを構成するものとする。
Further, when the instruction execution progresses and the PC 150 becomes 0200H, the CME 162 causes the coincidence signal EQ.
E is set to active "1". At this point still 01
Instruction N-1 up to FFH has been executed. Then 02
PRD signal 141 to read the operation code of 00H
Becomes active "1", EQE is "1", the output of the gate G3 becomes "1", and the F / F163
Is set to "1". At this time, at the same time, the instruction N-1
PEND signal 142 indicating the end of execution of
Although it becomes 1 ", since G6 is" 0 ", the gate G
4 remains "0". It is assumed that one opcode of 0200H constitutes the instruction N.

【0028】次に、命令Nの終了タイミングを示すPE
ND信号142がアクティブ”1”になると、F/F1
63が”1”で且つG6が”0”であることから、ゲー
トG4が”1”となり、F/F164は”0”にリセッ
トされる。これ以降、ゲートG5は常に”0”となるの
で、TM165のインクリメント動作は停止する。
Next, PE indicating the end timing of the instruction N
When the ND signal 142 becomes active "1", F / F1
Since 63 is "1" and G6 is "0", the gate G4 becomes "1" and the F / F 164 is reset to "0". After that, since the gate G5 is always "0", the increment operation of the TM165 is stopped.

【0029】以上の動作により、プログラムの開始アド
レスと終了アドレスを予め設定しプログラムの開始から
終了時間までタイマのインクリメント動作を行うことに
より、プログラムの実行時間の計測が行える。この後、
CPU110はTM165の値をリードすることで、そ
のリード値とクロックφから計測しようとしたプログラ
ムの実行時間を知ることができる。
By the above operation, the start address and end address of the program are set in advance, and the increment operation of the timer is performed from the start to the end time of the program, whereby the execution time of the program can be measured. After this,
By reading the value of TM165, the CPU 110 can know the execution time of the program to be measured from the read value and the clock φ.

【0030】また、CMS161とCME162への開
始と終了アドレスの設定は、被計測プログラムの実行前
であればいつの時点でも良い。従って、被計測プログラ
ムの実行時の環境に影響を与えることがない。さらに、
コンペアレジスタCMS161およびCME162に設
定する被計測プログラムの先頭および終了アドレスを同
一にすれば、最低1つのオペコードからなる命令の実行
時間の計測を行うことも可能であり、複数の命令の中か
らより命令実行時間の少ない命令を選択する際の手段と
することができる。なお、本実施例では、PC150お
よびTM165に格納されるアドレスおよびデータを4
桁の16進数(すなわち16ビット)で表記したが、特
にこれに限定されるものではない。
The start and end addresses of the CMS 161 and CME 162 may be set at any time before execution of the measured program. Therefore, it does not affect the environment at the time of execution of the measured program. further,
If the start and end addresses of the program to be measured set in the compare registers CMS161 and CME162 are the same, it is possible to measure the execution time of an instruction consisting of at least one opcode. It can be used as a means for selecting an instruction having a short execution time. In this embodiment, the address and data stored in the PC 150 and the TM 165 are set to 4
The hexadecimal number of digits (that is, 16 bits) is shown, but the present invention is not limited to this.

【0031】図4は本発明の第2の実施例を示すマイク
ロコンピュータのブロック図であり、図5は図4に示す
実行時間計測回路の構成図である。図4および図5に示
すように、本実施例は、前述した第1の実施例で述べた
実行時間計測回路160にTM165に対するクリア動
作を許可するフラグ166およびこのフラグ166の出
力とゲートG8の出力からTM165に対するクリア信
号を生成するAND素子G9を新たに追加した実行時間
計測回路160aを用いている。これ以外の構成および
動作は第1の実施例で述べたものと同一であるので、こ
こでの説明は省略する。
FIG. 4 is a block diagram of a microcomputer showing a second embodiment of the present invention, and FIG. 5 is a block diagram of the execution time measuring circuit shown in FIG. As shown in FIGS. 4 and 5, in this embodiment, a flag 166 for permitting the execution time measuring circuit 160 described in the first embodiment to clear the TM 165, an output of the flag 166, and a gate G8. The execution time measuring circuit 160a is used in which an AND element G9 that generates a clear signal for the TM165 from the output is newly added. The rest of the configuration and operation are the same as those described in the first embodiment, so description thereof will be omitted here.

【0032】本実施例では、第1の実施例で被計測プロ
グラムの開始時に、EQSが”1”で且つゲートG8
が”1”になることで行っていたTM165に対するク
リア動作を変更している。すなわち、フラグ166な”
1”を設定すると、プログラム開始のTM165に対す
るクリア動作を許可し、ゲートG9が”1”となること
でTM165をクリアする。また、フラグ166を”
0”に設定すると、プログラム開始時のTM168に対
するクリア動作を禁止し、ゲートG8が”1”になって
もゲート9が”0”となることでTM165に対するク
リア動作を行わないようにしている。
In this embodiment, when the program to be measured in the first embodiment is started, EQS is "1" and the gate G8 is set.
Is changed to "1", the clear operation for the TM165, which was performed, is changed. That is, the flag 166
When "1" is set, the clear operation for the TM165 at the start of the program is permitted, and the TM165 is cleared when the gate G9 becomes "1". Further, the flag 166 is set to "1".
When it is set to "0", the clear operation for the TM168 at the start of the program is prohibited, and even if the gate G8 becomes "1", the gate 9 becomes "0" so that the clear operation for the TM165 is not performed.

【0033】これは、複数のプログラムの実行時間を計
測する際に、それらの実行時間を通算して計測する事を
可能とするものである。その使用例を以下に図6
(a),(b)を用いて説明する。
This makes it possible to totalize the execution times of a plurality of programs when measuring the execution times of the programs. An example of its use is shown below in FIG.
A description will be given using (a) and (b).

【0034】図6(a),(b)はそれぞれ図5に示す
実行時間計測回路およびその内部のタイマ(TM)の動
作を説明するためのフロー図である。図(a),(b)
に示すように、実行時間計測回160aにおいて、まず
第1の計測プログラムの実行開始に先立ち、開始アドレ
スと終了アドレスをCMS161とCME162に設定
するが、この時はフラグ166に”1”を設定してお
く。従って、第1の計測プログラムの開始時にTM16
5はクリアされ、タイマ値0000Hからインクリメン
ト動作を開始する。
FIGS. 6A and 6B are flow charts for explaining the operation of the execution time measuring circuit and the internal timer (TM) shown in FIG. 5, respectively. Figures (a), (b)
In the execution time measurement time 160a, first, the start address and the end address are set in the CMS 161 and the CME 162 before the execution of the first measurement program is started. At this time, the flag 166 is set to "1". Keep it. Therefore, when the first measurement program is started, the TM16
5 is cleared and the increment operation is started from the timer value 0000H.

【0035】次に、第1の計測プログラムの実行終了
後、第2の計測プログラムの開始アドレスと終了アドレ
スをCMS161とCME162に設定するが、この時
はフラグ166を”0”に設定する。従って、第2の計
測プログラムの実行開始時にはTM165をクリアせず
に、第1の計測プログラムの実行終了時のタイマ値から
インクリメントを開始する。
Next, after the execution of the first measurement program is completed, the start address and end address of the second measurement program are set in CMS 161 and CME 162. At this time, the flag 166 is set to "0". Therefore, the TM 165 is not cleared at the start of execution of the second measurement program, and the increment is started from the timer value at the end of execution of the first measurement program.

【0036】以下、第3の計測プログラム以降の計測プ
ログラムを計測する場合も同様に行うが、フラグ166
は”0”のまま設定を行わず、フラグ166を再度”
1”と設定するまで、TM165は継続してインクリメ
ント動作を行うため、プログラム1からプログラムNま
での通算の実行時間を計測することができる。
The same applies to the case of measuring the measurement programs after the third measurement program, but the flag 166 is used.
Does not set "0" and sets the flag 166 again.
Since the TM 165 continuously performs the increment operation until it is set to "1", the total execution time from the program 1 to the program N can be measured.

【0037】[0037]

【発明の効果】以上述べたように、本発明のマイクロコ
ンピュータは、プログラムの実行時間を計測する際に、
プログラムの開始アドレスと終了アドレスを実行時間計
測回路のコンペアレジスタに設定し、プログラムカウン
タ(PC)との常なる比較動作に基づき発生する一致信
号と、タイミング信号発生回路が発生する命令の読み出
し指示信号および命令実行終了信号により直接専用のタ
イマをプログラムの実行時間内だけインクリメントしプ
ログラム実行終了後にこのタイマをリードすることでプ
ログラムの実行時間を計測するので、被計測プログラム
の内容によらず、またプログラムの実行前後の動作を全
く含まないため、極めて正確にプログラムの実行時間を
計測することができるという効果がある。
As described above, the microcomputer of the present invention, when measuring the execution time of the program,
A start address and an end address of the program are set in the compare register of the execution time measurement circuit, and a match signal generated based on a constant comparison operation with the program counter (PC) and a read instruction signal of an instruction generated by the timing signal generation circuit And the instruction execution end signal directly increments the dedicated timer within the program execution time and reads the timer after the program execution is finished to measure the program execution time. Since the operation before and after execution of is not included at all, there is an effect that the execution time of the program can be measured extremely accurately.

【0038】また、本発明のマイクロコンピュータにお
ける計測動作は、すべて専用のハードウエアにより行わ
れるため、被計測プログラム内で使用されるCPUおよ
び周辺ハードウエアの動作には全く影響を与える事な
く、しかも被計測プログラムが実行されようとした本来
の環境を保持したまま実行時間の計測を行なうことがで
きるという効果がある。
Further, since all the measuring operations in the microcomputer of the present invention are performed by dedicated hardware, there is no influence on the operations of the CPU and peripheral hardware used in the program to be measured, and There is an effect that the execution time can be measured while maintaining the original environment in which the measured program was to be executed.

【0039】さらに、本発明は実行時間を計測するタイ
マのクリア動作を制御するフラグの指定により、プログ
ラム開始時のタイマのクリア/非クリアを指定すること
ができるので、複数の計測プログラムの通算の実行時間
を計測することもできるという効果がある。
Further, according to the present invention, the clearing / non-clearing of the timer at the start of the program can be designated by designating the flag for controlling the clearing operation of the timer for measuring the execution time. The effect is that the execution time can also be measured.

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

【図1】本発明の第1の実施例を示すマイクロコンピュ
ータのブロック図である。
FIG. 1 is a block diagram of a microcomputer showing a first embodiment of the present invention.

【図2】図1に示す実行時間計測回路の構成図である。FIG. 2 is a configuration diagram of an execution time measuring circuit shown in FIG.

【図3】図2に示す実行時間計測回路の動作を説明する
ためのタイミング図である。
FIG. 3 is a timing chart for explaining the operation of the execution time measuring circuit shown in FIG.

【図4】本発明の第2の実施例を示すマイクロコンピュ
ータのブロック図である。
FIG. 4 is a block diagram of a microcomputer showing a second embodiment of the present invention.

【図5】図4に示す実行時間計測回路の構成図である。5 is a configuration diagram of an execution time measuring circuit shown in FIG.

【図6】図5に示す実行時間計測回路およびその内部の
タイマの動作を説明するための、フロー図である。
FIG. 6 is a flowchart for explaining the operation of the execution time measuring circuit shown in FIG. 5 and a timer therein.

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

100 マイクロコンピュータ 110 CPU 120 アドレス・データバス制御回路 130 命令格納レジスタ(IR) 140 タイミング信号発生回路 141 命令読みだし指示信号 142 命令実行終了信号 150 プログラムカウンタ(PC) 160,160a 実行時間計測回路 161,162 コンペアレジスタ 163,164 フリップフロップ 165 タイマ(TM) 166 タイマクリア許可フラグ 170 プログラムメモリ 180 アドレス・データバス EQS,EQE 一致信号 G1〜G5,G8,G9 論理積素子 G6,G7 反転素子 100 Microcomputer 110 CPU 120 Address / Data Bus Control Circuit 130 Instruction Storage Register (IR) 140 Timing Signal Generation Circuit 141 Instruction Read Instruction Signal 142 Instruction Execution End Signal 150 Program Counter (PC) 160, 160a Execution Time Measurement Circuit 161, 162 compare register 163, 164 flip-flop 165 timer (TM) 166 timer clear enable flag 170 program memory 180 address / data bus EQS, EQE coincidence signal G1 to G5, G8, G9 AND element G6, G7 inversion element

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 プログラムを格納するプログラムメモリ
と、命令の実行アドレスを示すプログラムカウンタ,実
行する命令を格納する命令格納レジスタおよび前記命令
格納レジスタの内容をデコードし種々のタイミング信号
を発生するタイミング信号発生回路を備えた中央処理装
置と、前記プログラムカウンタおよび前記タイミング信
号発生回路が出力するタイミング信号に基づき所定のプ
ログラムの実行時間を計測するプログラム実行時間計測
回路とを有し、前記プログラム実行時間計測回路は、被
計測プログラムの開始および終了アドレスを記憶するア
ドレス記憶手段と、前記プログラムカウンタと前記アド
レス記憶手段および前記タイミング信号発生回路が出力
するタイミング信号に基づき前記被計測プログラムの実
行開始時刻から実行終了時刻までを測定する測定手段と
を備え、前記被計測プログラムの開始アドレスおよび終
了アドレスを前記アドレス記憶手段に設定することによ
り前記被計測プログラムの実行時間を計測することを特
徴とするマイクロコンピュータ。
1. A program memory for storing a program, a program counter for indicating an execution address of an instruction, an instruction storage register for storing an instruction to be executed, and a timing signal for decoding various contents of the instruction storage register to generate various timing signals. A central processing unit having a generation circuit; and a program execution time measurement circuit for measuring the execution time of a predetermined program based on the timing signals output from the program counter and the timing signal generation circuit. The circuit is executed from an execution start time of the measured program based on an address storage unit that stores start and end addresses of the measured program, a timing signal output from the program counter, the address storage unit, and the timing signal generation circuit. A microcomputer comprising: a measuring unit that measures up to an end time, and the execution time of the measured program is measured by setting a start address and an end address of the measured program in the address storage unit.
JP4175131A 1992-07-02 1992-07-02 Microcomputer Pending JPH0619752A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4175131A JPH0619752A (en) 1992-07-02 1992-07-02 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4175131A JPH0619752A (en) 1992-07-02 1992-07-02 Microcomputer

Publications (1)

Publication Number Publication Date
JPH0619752A true JPH0619752A (en) 1994-01-28

Family

ID=15990833

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4175131A Pending JPH0619752A (en) 1992-07-02 1992-07-02 Microcomputer

Country Status (1)

Country Link
JP (1) JPH0619752A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9447370B2 (en) 2007-06-14 2016-09-20 Suntory Holdings Limited Distilled liquors and spirits having the fresh and natural fragrance of shiso and processes for producing the same

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6284347A (en) * 1985-10-08 1987-04-17 Mitsubishi Electric Corp Electronic computer
JPH01243140A (en) * 1988-03-25 1989-09-27 Hitachi Ltd Controller

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6284347A (en) * 1985-10-08 1987-04-17 Mitsubishi Electric Corp Electronic computer
JPH01243140A (en) * 1988-03-25 1989-09-27 Hitachi Ltd Controller

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9447370B2 (en) 2007-06-14 2016-09-20 Suntory Holdings Limited Distilled liquors and spirits having the fresh and natural fragrance of shiso and processes for producing the same

Similar Documents

Publication Publication Date Title
US6915416B2 (en) Apparatus and method for microcontroller debugging
JPH0619752A (en) Microcomputer
JPS61267858A (en) Microcomputer
JPS62197831A (en) Data processor
JPS60124746A (en) Data processing unit
JP2575025B2 (en) In-circuit emulator
JP2758624B2 (en) Speed control method of micro program
JPS6242301B2 (en)
JPS594051B2 (en) One-chip microprocessor test processing method
JP2786033B2 (en) Time measuring device
JP2020140290A (en) Central processing unit
JPH0231247A (en) Data processor
JPH05333956A (en) Timer circuit
JPH08292903A (en) Information processor
JPH0354645A (en) Program execution time measuring instrument
JPH04245332A (en) Data processor
JPS6232509B2 (en)
JPS59221710A (en) Measuring system for arithmetic processing time of sequence program
JPH0433136A (en) Microprocessor
JPH0296848A (en) Method for measuring execution time of instruction
JPS619733A (en) Test device
JPS6146857B2 (en)
JPH0343842A (en) Tracer memory
JPS6144346B2 (en)
JPS6211744B2 (en)

Legal Events

Date Code Title Description
A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 19980616