JP2003150410A - Watchdog timer device - Google Patents

Watchdog timer device

Info

Publication number
JP2003150410A
JP2003150410A JP2001351330A JP2001351330A JP2003150410A JP 2003150410 A JP2003150410 A JP 2003150410A JP 2001351330 A JP2001351330 A JP 2001351330A JP 2001351330 A JP2001351330 A JP 2001351330A JP 2003150410 A JP2003150410 A JP 2003150410A
Authority
JP
Japan
Prior art keywords
access
key data
cpu
data
mode
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
JP2001351330A
Other languages
Japanese (ja)
Inventor
Yasuhiro Tanaka
靖弘 田中
Taketoshi Hayakawa
武利 早川
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.)
Renesas Micro Systems Co Ltd
Original Assignee
Renesas Micro Systems Co Ltd
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 Renesas Micro Systems Co Ltd filed Critical Renesas Micro Systems Co Ltd
Priority to JP2001351330A priority Critical patent/JP2003150410A/en
Publication of JP2003150410A publication Critical patent/JP2003150410A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a watchdog timer capable of specifying a mode for combination of clock frequency and overflow control value in accordance with a program of application executed by a CPU and improving the prevention property so that mode change unintended by a user does not occur due to runaway of control of the CPU. SOLUTION: This watchdog timer 2 is constituted in such a way that it can specify a mode for combination of clock frequency and overflow control value by providing a mode register 11. Moreover, it is provided with an access number detection circuit 21 detecting access number to the mode register 11 so that it determines that, when there is the second access to the mode register 11, it is illegal access and the CPU runs away of control to output runaway-of- control detection interruption INT to the outside.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、ウォッチドッグタ
イマ装置に関し、特に、CPUの暴走検出の信頼性を向
上させたウォッチドッグタイマ装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a watchdog timer device, and more particularly to a watchdog timer device with improved reliability of CPU runaway detection.

【0002】[0002]

【従来の技術】ウォッチドッグタイマは、CPUが実行
中のプログラム暴走検出手段として一般的に使用されて
いる。図9(a)は、ウォッチドッグタイマを含むコン
ピュータシステムを示すブロック図である。コンピュー
タシステムは、システムバス4にCPU1、ウォッチド
ッグタイマ2a、割込みコントローラ3およびメモリ5
が接続されて構成されている。
2. Description of the Related Art A watchdog timer is generally used as a means for detecting runaway programs being executed by a CPU. FIG. 9A is a block diagram showing a computer system including a watchdog timer. The computer system includes a CPU 1, a watchdog timer 2a, an interrupt controller 3 and a memory 5 on a system bus 4.
Are connected and configured.

【0003】CPU1はメモリ5に記憶されているプロ
グラムを実行する。プログラムは、タイマカウンタがオ
ーバーフローする所定時間Tovfよりも短い時間で処
理できる個々の処理単位に分割され、処理単位毎にCP
U1からウォッチドッグタイマ2aへのアクセス命令が
埋め込まれる。ウォッチドッグタイマ2aは、CPU1
がプログラムの実行を開始すると内部のタイマカウンタ
でクロックパルスのカウントを行う。タイマカウンタの
カウント値がオーバーフローするよりも前にCPU1か
らのアクセス命令があり、命令に付随したライトデータ
がウォッチドッグタイマ内に予め保持されたキービット
と一致する場合には正常に処理が実行されたとして、タ
イマカウンタが一旦クリアされてから再度クロックパル
スのカウントを開始する。CPU1はプログラム中の次
の処理を実行する。
The CPU 1 executes a program stored in the memory 5. The program is divided into individual processing units that can be processed in a time shorter than a predetermined time Tovf when the timer counter overflows, and the CP is divided for each processing unit.
An access instruction from U1 to the watchdog timer 2a is embedded. The watchdog timer 2a is the CPU 1
When starts executing the program, the internal timer counter counts clock pulses. If there is an access instruction from the CPU 1 before the count value of the timer counter overflows and the write data accompanying the instruction matches the key bit held in advance in the watchdog timer, the processing is executed normally. If the timer counter is once cleared, the clock pulse counting is started again. The CPU 1 executes the next process in the program.

【0004】これに対して、CPU1からウォッチドッ
グタイマ2aへのアクセスがなくタイマカウンタのカウ
ント値がオーバーフローしてしまった場合、または、C
PU1からウォッチドッグタイマ2aへのアクセスがあ
ったがライトデータがキービットと一致しなかった場合
には、ウォッチドッグタイマ2aは、プログラム実行に
異常が生じてCPU1が暴走状態になったと判断して暴
走検出割込みINTを出力する。割込みコントローラ3
は、ウォッチドッグタイマ2aから暴走検出割込みIN
Tを入力すると、CPUリセット信号CPURSTをC
PU1に送り、CPU1をリセットする。
On the other hand, when the CPU 1 does not access the watchdog timer 2a and the count value of the timer counter overflows, or C
When the PU1 has accessed the watchdog timer 2a but the write data does not match the key bit, the watchdog timer 2a determines that the CPU 1 has gone into a runaway state due to an abnormality in program execution. Runaway detection interrupt INT is output. Interrupt controller 3
Is the runaway detection interrupt IN from the watchdog timer 2a.
When T is input, the CPU reset signal CPURST changes to C
Send to PU1 to reset CPU1.

【0005】図9(b)は、従来のウォッチドッグタイ
マ2aの動作の概略を示す図である。時間とともにタイ
マカウンタのカウント値が増加し、CPU1からのアク
セスがあってCPU1からのライトデータがキービット
と一致する毎にタイマカウンタがクリアされて0からカ
ウントを再開する。CPU1からのアクセスがなくタイ
マカウンタのカウント値がオーバーフロー判定値(OV
F値)になったときに、ウォッチドッグタイマは暴走判
定する。
FIG. 9B is a diagram showing an outline of the operation of the conventional watchdog timer 2a. The count value of the timer counter increases with time, and the timer counter is cleared and restarts counting from 0 each time there is access from the CPU 1 and the write data from the CPU 1 matches the key bit. There is no access from the CPU 1 and the count value of the timer counter is the overflow judgment value (OV
When it reaches the F value, the watchdog timer makes a runaway decision.

【0006】従来のウォッチドッグタイマでは、ウォッ
チドッグタイマ内に予め設定されるキービットが1ビッ
トであったため、何らかの原因でCPUからのライトデ
ータが反転した場合に、暴走状態のCPUを正常動作し
ていると判定する危険性があり、正常アクセス認定の信
頼性に問題があった。
In the conventional watchdog timer, since the key bit preset in the watchdog timer is 1 bit, if the write data from the CPU is inverted for some reason, the CPU in the runaway state is normally operated. There is a risk that it will be judged that there is a problem with the reliability of normal access certification.

【0007】これに対して、特開平2−208748号
公報にはキーデータを複数ビット構成にしてライトデー
タとキーデータとの一致検出の信頼性を向上させたウォ
ッチドッグタイマが記載されており、また、特開平1−
147643号公報にはタイマカウンタがクリアされる
毎に+1インクリメントされるインクリメントカウンタ
のカウント値をキーデータとして使用して一致検出の信
頼性を向上させたウォッチドッグタイマが記載されてい
る。これらの改良技術により、暴走状態にあるCPUか
らの複数ビットからなるライトデータが偶然にキーデー
タと一致してしまう確率を極めて小さくすることがで
き、正常アクセス認定の信頼性を飛躍的に向上させるこ
とが可能となる。
On the other hand, Japanese Unexamined Patent Publication No. 2-208748 discloses a watchdog timer in which the key data is composed of a plurality of bits to improve the reliability of match detection between the write data and the key data. In addition, JP-A-1-
Japanese Patent No. 147643 discloses a watchdog timer in which the count value of an increment counter that is incremented by 1 each time the timer counter is cleared is used as key data to improve the reliability of match detection. With these improved technologies, the probability that the write data consisting of multiple bits from the runaway CPU coincidentally coincides with the key data can be made extremely small, and the reliability of normal access authorization can be dramatically improved. It becomes possible.

【0008】[0008]

【発明が解決しようとする課題】一方、クロック周波数
とオーバーフロー判定値との組み合わせをCPUが実行
するアプリケーションのプログラムに合わせて設定変更
できるようにしたいという要求が強い。しかしながら、
設定変更できるようにするとプログラム実行中にプログ
ラムミス、CPUの暴走などの理由によってクロック周
波数、オーバーフロー判定値が適切に設定されたものか
ら変更されることになる。例えばオーバーフロー判定値
が大きい値に変更されてしまった場合には、本来オーバ
ーフローが発生して暴走検出割込みが出力されるべき状
態においても正常動作と誤判定されることになる。クロ
ック周波数の高いクロックを選択するように変更された
場合にも同様に暴走状態が正常動作と誤判定される。
On the other hand, there is a strong demand for the setting of the combination of the clock frequency and the overflow judgment value to be changed according to the program of the application executed by the CPU. However,
If the setting can be changed, the clock frequency and the overflow determination value are changed from those appropriately set due to a program error during the program execution, a CPU runaway, or the like. For example, if the overflow determination value has been changed to a large value, it will be erroneously determined to be a normal operation even in the state where an overflow should occur and a runaway detection interrupt should be output. Similarly, when the clock is changed to select a clock with a high clock frequency, the runaway state is also erroneously determined to be normal operation.

【0009】特開平2−208748号公報に記載の改
良技術、特開平1−147643号公報に記載の改良技
術では、キーデータとライトデータとの一致の信頼性を
向上させることができるものの、ウォッチドッグタイマ
のクロック周波数、オーバーフロー判定値の予期しない
ミスによる書き換えに対しては無力であった。
According to the improved technique disclosed in Japanese Patent Laid-Open No. 2-208748 and the improved technique described in Japanese Laid-Open Patent Publication No. 1-147643, the reliability of matching of key data and write data can be improved. It was useless for rewriting due to an unexpected mistake in the dog timer clock frequency and overflow judgment value.

【0010】本発明の目的は、クロック周波数、オーバ
ーフロー判定値などの組み合わせをCPUが実行するア
プリケーションのプログラムに合わせてモード指定で
き、且つ、CPUの暴走等によってユーザの意図しない
モード変更が発生しないように防御性を向上させたウォ
ッチドッグタイマを提供することにある。
It is an object of the present invention to specify a mode such as a combination of a clock frequency and an overflow judgment value in accordance with an application program executed by the CPU, and to prevent a mode change not intended by the user due to a runaway of the CPU. To provide a watchdog timer with improved protection.

【0011】[0011]

【課題を解決するための手段】本発明のウォッチドッグ
タイマ装置は、外部から複数のクロックを入力しクロッ
クの中からモード情報にしたがってカウントクロックを
選択して出力するクロック選択回路と、クリア信号に基
づいてカウント値がクリアされ、前記カウントクロック
を入力しパルス数をカウントするタイマカウンタと、前
記モード情報にしたがってオーバーフロー判定値が設定
され前記タイマカウンタのカウント値を監視して該カウ
ント値が前記オーバーフロー判定値以上になったことを
検出してオーバーフロー信号を出力するオーバーフロー
検出回路と、モードデータを入力して格納しモードデー
タに基づき前記モード情報を出力するモードレジスタ
と、CPUからのアクセスを検出し該アクセスが前記モ
ードレジスタに対するアクセスであるときには1回目の
アクセスであればCPUからのデータを前記モードレジ
スタに書き込み2回目のアクセスであれば第1の暴走検
知信号を出力し、CPUからのアクセスが前記モードレ
ジスタに対するアクセスでないときにCPUからのデー
タを複数ビットからキーデータと比較して一致すれば前
記クリア信号を出力し不一致であれば第2の暴走検知信
号を出力する不正アクセス判定部と、前記オーバーフロ
ー信号、前記第1の暴走検知信号および前記第2の暴走
検知信号のうち少なくともひとつを入力したときに暴走
検出割込みを外部へ送信する暴走検出割込み生成回路と
を備えている。
A watchdog timer device according to the present invention includes a clock selection circuit for inputting a plurality of clocks from the outside and selecting and outputting a count clock from the clocks according to mode information, and a clear signal. A count value is cleared based on the above, and a timer counter that inputs the count clock and counts the number of pulses, and an overflow determination value is set according to the mode information, monitors the count value of the timer counter, and the count value overflows. An overflow detection circuit that detects that the threshold value is exceeded and outputs an overflow signal, a mode register that inputs and stores mode data and outputs the mode information based on the mode data, and an access from the CPU is detected. The access is to the mode register When the access is the first access, the data from the CPU is written to the mode register, and when the second access is the first runaway detection signal is output, and when the access from the CPU is not the access to the mode register In addition, comparing the data from the CPU with the key data from a plurality of bits, the clear signal is output if they match, and the second runaway detection signal is output if they do not match; the overflow signal, the first signal. And a runaway detection interrupt generation circuit for transmitting a runaway detection interrupt to the outside when at least one of the runaway detection signal and the second runaway detection signal is input.

【0012】また、前記不正アクセス判定部は、CPU
からのアクセスを検出し該アクセスが前記モードレジス
タに対するアクセスであるときには1回目のアクセスで
あればCPUからのデータを前記モードレジスタに書き
込み2回目のアクセスであれば第1の暴走検知信号を出
力するアクセス回数検出回路と、CPUからのアクセス
が前記モードレジスタに対するアクセスでないときにC
PUからのデータを格納するカウンタ制御レジスタと、
複数ビットからなるキーデータが設定されるキーデータ
設定回路と、前記カウンタ制御レジスタに格納されたデ
ータと前記キーデータとを比較して一致すれば前記クリ
ア信号を出力し不一致であれば第2の暴走検知信号を出
力する比較回路とを有して構成することができる。
Further, the unauthorized access determination unit is a CPU
Access from the CPU is detected, and when the access is to the mode register, if the access is the first time, the data from the CPU is written to the mode register, and if the access is the second time, the first runaway detection signal is output. The access count detection circuit and C when the access from the CPU is not an access to the mode register
A counter control register for storing data from the PU,
The key data setting circuit in which key data consisting of a plurality of bits is set is compared with the data stored in the counter control register and the key data, and if they match, the clear signal is output, and if they do not match, the second signal is output. And a comparator circuit that outputs a runaway detection signal.

【0013】[0013]

【発明の実施の形態】本発明について、図面を参照して
詳細に説明する。本発明のウォッチドッグタイマ2を含
むコンピュータシステムは、図9(a)の従来のコンピ
ュータシステムのブロック図におけるウォッチドッグタ
イマ2aをウォッチドッグタイマ2に置き換えたものに
相当し、ライトデータWDATに加えてモードデータM
DATがCPU1よりウォッチドッグタイマ2に書き込
まれる。図1は、本発明のウォッチドッグタイマ2の一
実施形態のブロック図である。
DETAILED DESCRIPTION OF THE INVENTION The present invention will be described in detail with reference to the drawings. A computer system including the watchdog timer 2 of the present invention corresponds to a computer system including the watchdog timer 2a in the block diagram of the conventional computer system of FIG. Mode data M
DAT is written in the watchdog timer 2 by the CPU 1. FIG. 1 is a block diagram of an embodiment of a watchdog timer 2 of the present invention.

【0014】ウォッチドッグタイマ2は、モードレジス
タ11、クロック選択回路12、カウント動作制御回路
13、タイマカウンタ14、オーバーフロー検出回路1
5、暴走検出割込み16および不正アクセス判定部17
を備えて構成される。
The watchdog timer 2 includes a mode register 11, a clock selection circuit 12, a count operation control circuit 13, a timer counter 14, and an overflow detection circuit 1.
5, runaway detection interrupt 16 and unauthorized access determination unit 17
It is configured with.

【0015】モードレジスタ11は、CPU1より送信
されたモードデータMDATを不正アクセス判定部17
を介して入力し格納するとともに、格納されたモードデ
ータMDATに基づいてカウントクロックの選択とオー
バーフロー判定値との組み合わせ情報を含むモード情報
MODEを出力する。
The mode register 11 uses the mode data MDAT transmitted from the CPU 1 to determine the unauthorized access determination unit 17.
It is input and stored via the control unit and the mode information MODE including the combination information of the count clock selection and the overflow determination value is output based on the stored mode data MDAT.

【0016】クロック選択回路12は、外部から複数の
クロックCK1,CK2,CK3を入力し、これら入力
クロックの中からモード情報MODEにしたがってカウ
ントクロックCKCを選択して出力する。
The clock selection circuit 12 inputs a plurality of clocks CK1, CK2, CK3 from the outside, selects the count clock CKC from the input clocks according to the mode information MODE, and outputs it.

【0017】カウント動作制御回路13は、モードレジ
スタ11からのモード情報を受けるとタイマカウンタ1
4にクリア信号CCLRを出力し、その後にクロック選
択回路12から入力したカウントクロックCKCをその
まま出力する。また、カウント動作制御回路13は、不
正アクセス判定部17からクリア信号CLRを受け取っ
たときにタイマカウンタ14にクリア信号CCLRを出
力する。
When the count operation control circuit 13 receives the mode information from the mode register 11, the timer counter 1
The clear signal CCLR is output to 4 and then the count clock CKC input from the clock selection circuit 12 is output as it is. Further, the count operation control circuit 13 outputs the clear signal CCLR to the timer counter 14 when receiving the clear signal CLR from the unauthorized access determination unit 17.

【0018】タイマカウンタ14は、カウント動作制御
回路13からのクリア信号CCLRによりカウント値が
クリアされ、カウント動作制御回路13からカウントク
ロックCKCを入力してカウントクロックのパルスをカ
ウントする。
The count value of the timer counter 14 is cleared by the clear signal CCLR from the count operation control circuit 13, and the count clock CKC is input from the count operation control circuit 13 to count the pulses of the count clock.

【0019】オーバーフロー検出回路15は、モードレ
ジスタ11からのモード情報MODEによりオーバーフ
ロー判定値が設定される。また、オーバーフロー検出回
路15は、タイマカウンタ14のカウント値を監視し、
カウント値がオーバーフロー判定値以上になったことを
検出したときにはオーバーフロー信号OVFを出力す
る。
In the overflow detection circuit 15, the overflow judgment value is set by the mode information MODE from the mode register 11. Further, the overflow detection circuit 15 monitors the count value of the timer counter 14,
When it is detected that the count value has exceeded the overflow determination value, the overflow signal OVF is output.

【0020】不正アクセス判定部17は、CPU1から
のアクセスを検出し、そのアクセスがモードレジスタ1
1に対するアクセスであるときには、CPU1の立ち上
げ後の1回目のアクセスであるかまたは2回目のアクセ
スであるかを検出する。1回目のアクセスであればCP
U1からのモードデータMDATを前記モードレジスタ
に書き込み2回目のアクセスであれば第1の暴走検知信
号RAaを出力する。CPU1からのアクセスがモード
レジスタ11に対するアクセスでないときには、CPU
1からのライトデータWDATと内部に設定されている
キーデータとを比較し、一致すればクリア信号CLRを
出力する。不一致であれば第2の暴走検知信号RAbを
出力する。
The unauthorized access judging section 17 detects an access from the CPU 1, and the access is detected by the mode register 1
When it is an access to 1, it is detected whether it is the first access or the second access after the CPU 1 is started up. CP for the first access
The mode data MDAT from U1 is written in the mode register, and if it is the second access, the first runaway detection signal RAa is output. When the access from the CPU 1 is not the access to the mode register 11, the CPU
The write data WDAT from 1 is compared with the key data set inside, and if they match, a clear signal CLR is output. If they do not match, the second runaway detection signal RAb is output.

【0021】暴走検出割込み生成回路16は、オーバー
フロー検出回路15からオーバーフロー信号OVFを受
けた場合、不正アクセス判定部17から第1の暴走検知
信号RAaを受けた場合、および、不正アクセス判定部
17から第2の暴走検知信号RAbを受けた場合のうち
少なくとも1つの場合が実際に生じたときには暴走検出
割込みINTを外部の割込みコントローラ3へ送信す
る。
The runaway detection interrupt generation circuit 16 receives the overflow signal OVF from the overflow detection circuit 15, receives the first runaway detection signal RAa from the unauthorized access determination unit 17, and from the unauthorized access determination unit 17. When at least one of the cases where the second runaway detection signal RAb is received actually occurs, the runaway detection interrupt INT is transmitted to the external interrupt controller 3.

【0022】不正アクセス判定部17は、さらに、アク
セス回数検出回路21、キーデータ設定回路22、カウ
ンタ制御レジスタ23および比較回路24を備えて構成
されている。
The unauthorized access determination section 17 is further provided with an access count detection circuit 21, a key data setting circuit 22, a counter control register 23 and a comparison circuit 24.

【0023】アクセス回数検出回路は、CPU1からの
アクセスを検出し、そのアクセスがモードレジスタ11
に対するアクセスであるときには、1回目のアクセスで
あればCPU1からのモードデータMDATをモードレ
ジスタ11に書き込み、2回目のアクセスであれば不正
なアクセスでありCPU1が暴走したとして第1の暴走
検知信号RAaを出力する。
The access number detection circuit detects an access from the CPU 1, and the access is detected by the mode register 11
If it is the first access, the mode data MDAT from the CPU 1 is written in the mode register 11 if it is the first access, and if it is the second access, it is an unauthorized access and the first runaway detection signal RAa Is output.

【0024】キーデータ設定回路22には複数ビットか
らなるキーデータが設定される。カウンタ制御レジスタ
23には、CPU1からのアクセスがモードレジスタ1
1に対するアクセスでなければCPU1からのライトデ
ータWDATが格納される。比較回路24は、カウンタ
制御レジスタ23に格納されたライトデータとキーデー
タ設定回路22に設定されたキーデータとを比較し、一
致すればクリア信号CLRを出力し、不一致であれば第
2の暴走検知信号RAbを出力する。
Key data having a plurality of bits is set in the key data setting circuit 22. The counter control register 23 is accessed by the CPU 1 in the mode register 1
If it is not an access to 1, the write data WDAT from the CPU 1 is stored. The comparison circuit 24 compares the write data stored in the counter control register 23 with the key data set in the key data setting circuit 22, outputs a clear signal CLR if they match, and outputs a second runaway if they do not match. The detection signal RAb is output.

【0025】図2は、第1実施例におけるライトデータ
とキーデータとの比較部分の回路図である。本実施例で
は図1のキーデータ設定回路22として予め8ビットの
固定データ(例えばデータACH。末尾のHは16進表
現であることを示す)が設定されたキーデータ設定回路
22aを用いる。CPU1にも同じ固定データ(AC
H)が設定されていて、プログラム中の処理が正常に実
行される毎にCPU1から固定データがライトデータと
してウォッチドッグタイマ2に送られてカウンタ制御レ
ジスタ23に格納される。キーデータ設定回路22aの
固定データ(ACH)とカウンタ制御レジスタ23に格
納された8ビットのライトデータWDATとが同じ(A
CH)であるときには、比較回路24はクリア信号CL
Rを出力する。ライトデータWDATが(ACH)以外
のデータであるときには、CPU1における処理が正常
に実行されなかったことを示すので暴走状態にあるとし
て比較回路24は第2の暴走検知信号RAbを出力す
る。
FIG. 2 is a circuit diagram of a comparison portion of write data and key data in the first embodiment. In the present embodiment, as the key data setting circuit 22 of FIG. 1, a key data setting circuit 22a in which fixed data of 8 bits (for example, data ACH; H at the end indicates that it is a hexadecimal representation) is used. The same fixed data (AC
H) is set and fixed data is sent from the CPU 1 to the watchdog timer 2 as write data and stored in the counter control register 23 every time the processing in the program is normally executed. The fixed data (ACH) of the key data setting circuit 22a and the 8-bit write data WDAT stored in the counter control register 23 are the same (A
CH), the comparison circuit 24 outputs the clear signal CL.
Output R. When the write data WDAT is data other than (ACH), it indicates that the process in the CPU 1 has not been normally executed, and therefore the comparator circuit 24 outputs the second runaway detection signal RAb as the runaway state.

【0026】キーデータ設定回路22aは、固定データ
(ACH)を出力するように論理ゲートで構成してもよ
く、またレジスタにキーデータ(ACH)を固定的に格
納して実現してもよい。
The key data setting circuit 22a may be configured by a logic gate so as to output fixed data (ACH), or may be realized by fixedly storing the key data (ACH) in a register.

【0027】図3は、本実施例のウォッチドッグタイマ
の動作フロー図である。図1、図2、図3を参照して本
実施例の動作について説明する。
FIG. 3 is an operation flow chart of the watchdog timer of this embodiment. The operation of this embodiment will be described with reference to FIGS. 1, 2, and 3.

【0028】まず、CPU1の電源投入後またはCPU
1のリセット後に、ステップS1で、モードレジスタ1
1およびアクセス回数検出回路21が、外部から(例え
ばCPU1から)の信号によりクリアされる。
First, after powering on the CPU 1 or the CPU
After the reset of 1, the mode register 1
1 and the access count detection circuit 21 are cleared by a signal from the outside (for example, from the CPU 1).

【0029】CPU1からアクセスがあるまで、ステッ
プS2でNOとなり、ステップS8でNOとなって待機
する。ステップS2でCPU1からのアクセスがあった
ときにステップS3へ進み、そのアクセスがモードレジ
スタ11へのアクセスかを判定する。CPU1からの最
初のアクセスはモードレジスタ11にモードデータMD
ATを書き込むためのアクセスであるはずなので、ステ
ップS4へ進む。
Until there is an access from the CPU 1, the answer is NO in step S2, and the answer is NO in step S8 to wait. When there is an access from the CPU 1 in step S2, the process proceeds to step S3, and it is determined whether the access is to the mode register 11. The first access from the CPU 1 is the mode data MD in the mode register 11.
Since the access should be for writing the AT, the process proceeds to step S4.

【0030】ステップS4では、最初のモードレジスタ
11へのアクセスなので、アクセス回数検出回路21の
アクセス回数値は0であり、ステップS5に進む。ステ
ップS5では、カウントクロックの選択情報とオーバー
フロー判定値の組み合わせ情報を含むモードデータMD
ATをモードレジスタに書き込み、アクセス回数検出回
路21のアクセス回数値を1にする。次にステップ6に
進み、モードレジスタ11からのモード情報MODEに
より、タイマカウンタをクリアし、クロック選択回路1
2において外部から入力する複数のクロックからカウン
トクロックCKCを選択し、また、オーバーフロー検出
回路15にオーバーフロー判定値を設定する。次に、ス
テップS7でタイマカウンタ14のカウントを開始す
る。
In step S4, since the mode register 11 is accessed for the first time, the access count value of the access count detection circuit 21 is 0, and the flow advances to step S5. In step S5, the mode data MD including the combination information of the count clock selection information and the overflow determination value is included.
AT is written in the mode register, and the access count value of the access count detection circuit 21 is set to 1. Next, in step 6, the timer counter is cleared by the mode information MODE from the mode register 11, and the clock selection circuit 1
In 2, the count clock CKC is selected from a plurality of clocks input from the outside, and the overflow determination value is set in the overflow detection circuit 15. Next, in step S7, the timer counter 14 starts counting.

【0031】タイマカウンタ14のカウント中には、常
にステップS2でCPU1からのアクセスがあるかを判
断し、アクセスがない場合にはステップS8でオーバー
フローの発生を判断する。ステップS8でタイマカウン
タ14のカウント値がオーバーフロー判定値に達したと
してオーバーフロー検出回路15からオーバーフロー信
号OVFが出力されたときには、CPU1の暴走を検出
したとして暴走検出割込み生成回路16が暴走検出割込
みINTを外部の割込みコントローラ3へ出力する。割
込みコントローラ3では、暴走検出割込みINTを受信
するとCPUリセット信号CPURSTをCPU1へ送
り、CPU1をリセットする。
While the timer counter 14 is counting, it is always determined in step S2 whether there is an access from the CPU 1, and if there is no access, it is determined in step S8 whether an overflow has occurred. When the overflow signal OVF is output from the overflow detection circuit 15 because the count value of the timer counter 14 has reached the overflow determination value in step S8, the runaway detection interrupt generation circuit 16 detects the runaway of the CPU 1 and outputs the runaway detection interrupt INT. Output to the external interrupt controller 3. Upon receiving the runaway detection interrupt INT, the interrupt controller 3 sends a CPU reset signal CPURST to the CPU 1 to reset the CPU 1.

【0032】タイマカウンタ14のカウント中にCPU
1からアクセスがあった場合には、ステップS2からス
テップS3に進みモードレジスタ11へのアクセスであ
るかを否か判断する。モードレジスタへのアクセスであ
る場合には、アクセス回数検出回路21のアクセス回数
値は既に1になっているのでステップS4でNOとな
り、アクセス回数検出回路21が第1の暴走検知信号R
Aaを出力する。第1の暴走検知信号RAaを受けて暴
走検出割込み生成回路16が暴走検出割込みINTを割
込みコントローラ3へ出力し、割込みコントローラ3は
CPU1をリセットする。
While the timer counter 14 is counting, the CPU
If there is an access from 1, the process proceeds from step S2 to step S3, and it is determined whether or not it is an access to the mode register 11. In the case of access to the mode register, the access count value of the access count detection circuit 21 has already become 1, so that the determination in step S4 is NO, and the access count detection circuit 21 outputs the first runaway detection signal R.
Output Aa. In response to the first runaway detection signal RAa, the runaway detection interrupt generation circuit 16 outputs a runaway detection interrupt INT to the interrupt controller 3, and the interrupt controller 3 resets the CPU 1.

【0033】タイマカウンタ14のカウント中にCPU
1からアクセスがあり、ステップS3でモードレジスタ
11へのアクセスではないと判断された場合には、ステ
ップS9に進んでCPU1からのライトデータWDAT
とキーデータ設定回路22に設定されているキーデータ
が一致しているか否か判断する。比較回路24により一
致していると判断された場合には、ステップS10に進
んでタイマカウンタ14のカウント値を一旦クリアした
のちに、ステップS7に移ってタイマカウンタ14のカ
ウントを再開する。ステップS9でライトデータとキー
データが一致していないと比較回路24により判断され
た場合には、比較回路24は第2の暴走検知信号RAb
を出力する。第2の暴走検知信号RAbを受けて暴走検
出割込み生成回路16が割込みコントローラ3へ暴走検
出割込みINTを出力し、割込みコントローラ3はCP
U1をリセットする。
While the timer counter 14 is counting, the CPU
If it is determined that the mode register 11 is not accessed in step S3, the process proceeds to step S9 and the write data WDAT from the CPU 1 is accessed.
It is determined whether or not the key data set in the key data setting circuit 22 match. If the comparison circuit 24 determines that they match, the process proceeds to step S10 to clear the count value of the timer counter 14 once, and then moves to step S7 to restart the counting of the timer counter 14. If the comparison circuit 24 determines in step S9 that the write data and the key data do not match, the comparison circuit 24 determines that the second runaway detection signal RAb has occurred.
Is output. In response to the second runaway detection signal RAb, the runaway detection interrupt generation circuit 16 outputs a runaway detection interrupt INT to the interrupt controller 3, and the interrupt controller 3 sends CP.
Reset U1.

【0034】すなわち、CPU1がプログラムを正常に
実行しているときには、ウォッチドッグタイマ2はステ
ップS2からステップS3、ステップS9、ステップS
10、ステップS7を通って再びステップS2へ戻るル
ープを繰り返して動作する。CPU1からアクセスがな
くタイマカウンタ14の計数値がオーバーフロー値に達
した場合(ステップS8でYES)と、モードレジスタ
へ2度目のアクセスがあった場合(ステップS4でN
O)と、ライトデータとキーデータとが一致しなかった
場合(ステップS9でNO)との3つの場合のうち少な
くとも1つが発生したときにウォッチドッグタイマ2は
CPU1が暴走状態にあると判定する。
That is, when the CPU 1 is executing the program normally, the watchdog timer 2 operates from step S2 to step S3, step S9 and step S9.
10. The loop that returns to step S2 again through step S7 is repeated to operate. When there is no access from the CPU 1 and the count value of the timer counter 14 reaches the overflow value (YES in step S8), and when the mode register is accessed for the second time (N in step S4).
O) and the write data and the key data do not match (NO in step S9), the watchdog timer 2 determines that the CPU 1 is in the runaway state when at least one of the three cases occurs. .

【0035】このように、本実施例のウォッチドッグタ
イマでは、モードレジスタ11を設けたことによりクロ
ック周波数、オーバーフロー判定値などの組み合わせを
モード指定できるようにし、また、不正アクセス検出部
17内にモードレジスタ11へのアクセス回数を検出す
る機構(アクセス回数検出回路21)を設けてモードレ
ジスタへの2回目のアクセスがあったときには不正アク
セスでありCPU1が暴走したとして外部へ暴走検出割
込みINTを出力するように構成している。これによ
り、CPUが実行するアプリケーションのプログラムに
合わせてクロック周波数とオーバーフロー判定値との組
み合わせを選択することができ、且つ、ユーザが意図し
ないモード変更のアクセスに対する防御性を著しく改善
することができる。また、キーデータを複数ビットとし
ているのでキーデータとライトデータとの一致認定にお
いて特開平2−208748号公報に記載の従来例と同
等の信頼性が保証される。
As described above, in the watchdog timer of this embodiment, the mode register 11 is provided so that the combination of the clock frequency and the overflow determination value can be designated as the mode, and the mode can be set in the unauthorized access detection unit 17. A mechanism (access count detection circuit 21) for detecting the number of accesses to the register 11 is provided, and when the mode register is accessed for the second time, it is an illegal access and the CPU 1 is out of control, and a runaway detection interrupt INT is output to the outside. Is configured as follows. As a result, it is possible to select a combination of the clock frequency and the overflow determination value according to the application program executed by the CPU, and it is possible to remarkably improve the protection against access for mode change not intended by the user. Further, since the key data has a plurality of bits, the same reliability as that of the conventional example disclosed in Japanese Patent Application Laid-Open No. 2-208748 is guaranteed in the coincidence recognition of the key data and the write data.

【0036】次に、本発明の第2実施例について説明す
る。図4は、第2実施例におけるライトデータとキーデ
ータとの比較部分の回路図である。
Next, a second embodiment of the present invention will be described. FIG. 4 is a circuit diagram of a comparison part of write data and key data in the second embodiment.

【0037】第2実施例では、図1におけるキーデータ
設定回路22に替えてキーデータ設定回路22bを設け
る点のみが異なり、他の構成は図1と同一である。キー
データ設定回路22bは、クリア信号CLRが比較回路
24から出力される毎にこれを入力して1ずつインクリ
メントするインクリメントカウンタ31を備え、インク
リメントカウンタ31のカウント値がキーデータとして
設定される。
The second embodiment is different only in that a key data setting circuit 22b is provided in place of the key data setting circuit 22 in FIG. 1, and the other structure is the same as that in FIG. The key data setting circuit 22b includes an increment counter 31 that inputs the clear signal CLR each time it is output from the comparison circuit 24 and increments it by one. The count value of the increment counter 31 is set as key data.

【0038】CPU1では、実行中のプログラムでのウ
ォッチドッグタイマへのアクセス回数をカウントするこ
とにより、ウォッチドッグタイマ2内でクリア信号が発
生する回数、すなわちインクリメントカウンタのカウン
ト値を、容易にCPU1内に再現できる。
The CPU 1 easily counts the number of times the clear signal is generated in the watchdog timer 2, that is, the count value of the increment counter, by counting the number of accesses to the watchdog timer in the program being executed. Can be reproduced.

【0039】CPU1はプログラム中の処理が正常に実
行されると、CPU1側で再現したキーデータ(図4の
例では(01H))をライトデータWDATとしてウォ
ッチドッグタイマ2に送る。キーデータ設定回路22b
のインクリメントカウンタ31のカウント値(01H)
とカウンタ制御レジスタ23に格納されたCPU1から
のライトデータWDATとが一致するときには、比較回
路24はクリア信号CLRを出力する。インクリメント
カウンタ31のカウント値とライトデータWDATとが
一致しないときには、CPU1における処理が正常に実
行されなかったことを示すので暴走状態にあるとして比
較回路24は第2の暴走検知信号RAbを出力する。
When the processing in the program is normally executed, the CPU 1 sends the key data ((01H) in the example of FIG. 4) reproduced on the CPU 1 side to the watchdog timer 2 as the write data WDAT. Key data setting circuit 22b
Count value of the increment counter 31 (01H)
And the write data WDAT from the CPU 1 stored in the counter control register 23 match, the comparison circuit 24 outputs the clear signal CLR. When the count value of the increment counter 31 and the write data WDAT do not match, it indicates that the process in the CPU 1 has not been normally executed, and therefore the comparator circuit 24 outputs the second runaway detection signal RAb as the runaway state.

【0040】図5は、第2実施例のウォッチドッグタイ
マの動作フロー図である。第1実施例と異なるところ
は、ステップS10でクリア信号CLRによりタイマカ
ウンタ14のカウント値をクリアした後に、新たに挿入
されたステップS21でキーデータを更新し、その後に
ステップS7に移ってタイマカウンタ14のカウントを
再開する点のみである。第2実施例では、ステップS2
1においては、キーデータ設定回路22bが比較回路2
4からクリア信号CLRが出力される毎にこれを入力し
て1ずつインクリメントするインクリメントカウンタ3
1を備え、インクリメントカウンタ31のカウント値が
キーデータとして設定することによりキーデータが更新
される。
FIG. 5 is an operation flow chart of the watchdog timer of the second embodiment. The difference from the first embodiment is that after the count value of the timer counter 14 is cleared by the clear signal CLR in step S10, the key data is updated in the newly inserted step S21, after which the process moves to step S7 and the timer counter is moved. The only point is to restart the count of 14. In the second embodiment, step S2
1, the key data setting circuit 22b is the comparison circuit 2
Increment counter 3 that inputs the clear signal CLR every time it is output from 4 and increments it by 1
1, the key data is updated by setting the count value of the increment counter 31 as the key data.

【0041】CPU1がプログラムを正常に実行してい
るときには、ウォッチドッグタイマ2はステップS2か
らステップS3、ステップS9、ステップS10、ステ
ップ21、ステップS7を通って再びステップS2へ戻
るループを繰り返して動作する。インクリメントカウン
タ31が8ビット構成とするとこのループを1回通る毎
にキーデータは(00H)から(01H)、(02H)
…(FFH)と増加し、再び(00H)に戻る。
When the CPU 1 is executing the program normally, the watchdog timer 2 repeats the loop from step S2 to step S3, step S9, step S10, step 21, step S7 and back to step S2. To do. When the increment counter 31 has an 8-bit structure, the key data is (00H) to (01H), (02H) every time this loop is passed once.
(Increases to (FFH) and returns to (00H) again.

【0042】第2実施例においても第1実施例と同様に
CPUが実行するアプリケーションのプログラムに合わ
せてクロック周波数とオーバーフロー判定値との組み合
わせを選択することができ、且つ、ユーザが意図しない
モード変更のアクセスに対する防御性を著しく改善する
ことができる。また、クリア信号をカウントするインク
リメントカウンタによりキーデータを生成しているの
で、CPUからのアクセス毎にキーデータが変更される
ため、キーデータとライトデータとの一致認定において
第1実施例よりもさらに精度が向上し、特開平1−14
7643号公報に記載の改良された従来例と同等な高信
頼性が保証される。
In the second embodiment as well, similar to the first embodiment, the combination of the clock frequency and the overflow judgment value can be selected according to the program of the application executed by the CPU, and the mode change not intended by the user. Can significantly improve the protection against access. In addition, since the key data is generated by the increment counter that counts the clear signal, the key data is changed each time the CPU accesses it. With improved accuracy,
High reliability equivalent to that of the improved conventional example described in Japanese Patent No. 7643 is guaranteed.

【0043】次に、本発明の第3実施例について説明す
る。図6は、第3実施例におけるライトデータとキーデ
ータとの比較部分の回路図である。
Next, a third embodiment of the present invention will be described. FIG. 6 is a circuit diagram of a comparison portion of write data and key data in the third embodiment.

【0044】第3実施例では、図1におけるキーデータ
設定回路22に替えてキーデータ設定回路22cを設け
る点のみが異なり、他の構成は図1と同一である。キー
データ設定回路22cは、比較回路24からクリア信号
CLRが出力される毎にこれを入力してインクリメント
する同一ビット長(例では4ビット)の2個のインクリ
メントカウンタ41,42を備え、2個のインクリメン
トカウンタのうちインクリメントカウンタ42のカウン
ト値を上位桁としインクリメントカウンタ41のカウン
ト値を下位桁として8ビットのキーデータが設定され
る。
The third embodiment is the same as FIG. 1 except for the point that a key data setting circuit 22c is provided instead of the key data setting circuit 22 in FIG. The key data setting circuit 22c is provided with two increment counters 41 and 42 of the same bit length (4 bits in the example) that input and increment the clear signal CLR each time the comparison circuit 24 outputs the clear signal CLR. Among the increment counters, the 8-bit key data is set with the count value of the increment counter 42 as the upper digit and the count value of the increment counter 41 as the lower digit.

【0045】設定されるキーデータは、クリア信号CL
Rを入力する毎に、(00H)から(11H)、(22
H)、(33H)…(FFH)と変化し、再び(00
H)に戻る。
The set key data is the clear signal CL.
Each time R is input, (00H) to (11H), (22
H), (33H) ... (FFH), and again (00
Return to H).

【0046】本実施例においても、第2実施例と同様
に、CPU1では、実行中のプログラムでのウォッチド
ッグタイマへのアクセス回数をカウントすることによ
り、2個のインクリメントカウンタのカウント値を再現
してキーデータを容易に生成できる。
In this embodiment as well, as in the second embodiment, the CPU 1 reproduces the count values of the two increment counters by counting the number of accesses to the watchdog timer in the program being executed. Key data can be easily generated.

【0047】CPU1はプログラム中の処理が正常に実
行されると、CPU1側で再現したキーデータ(図6の
例では(11H))をライトデータWDATとしてウォ
ッチドッグタイマ2に送る。キーデータ設定回路22c
の上位桁のインクリメントカウンタ42のカウント値
(1H)と下位桁のインクリメントカウンタ41のカウ
ント値(1H)とを合成して設定されたキーデータ(1
1H)とカウンタ制御レジスタ23に格納されたライト
データWDATとが一致するときには、比較回路24は
クリア信号CLRを出力する。インクリメントカウンタ
42のカウント値を上位桁としインクリメントカウンタ
41のカウント値を下位桁として設定されたキーデータ
とライトデータWDATとが一致しないときには、CP
U1における処理が正常に実行されなかったことを示す
ので暴走状態にあるとして比較回路24は第2の暴走検
知信号RAbを出力する。
When the processing in the program is normally executed, the CPU 1 sends the key data ((11H) in the example of FIG. 6) reproduced on the CPU 1 side to the watchdog timer 2 as the write data WDAT. Key data setting circuit 22c
Of the key data (1H) set by synthesizing the count value (1H) of the upper digit increment counter 42 and the count value (1H) of the lower digit increment counter 41.
1H) and the write data WDAT stored in the counter control register 23 match, the comparison circuit 24 outputs a clear signal CLR. When the key data set with the count value of the increment counter 42 as the upper digit and the count value of the increment counter 41 as the lower digit do not match the write data WDAT, CP
The comparison circuit 24 outputs the second runaway detection signal RAb because it is in a runaway state because it indicates that the process in U1 has not been normally executed.

【0048】本実施例においても第1実施例および第2
実施例と同様にCPUが実行するアプリケーションのプ
ログラムに合わせてクロック周波数とオーバーフロー判
定値との組み合わせを選択することができ、且つ、ユー
ザが意図しないモード変更のアクセスに対する防御性を
著しく改善することができる。
Also in this embodiment, the first embodiment and the second embodiment
Similar to the embodiment, the combination of the clock frequency and the overflow judgment value can be selected according to the program of the application executed by the CPU, and the protection against the access of the mode change not intended by the user can be remarkably improved. it can.

【0049】また、2個のインクリメントカウンタのカ
ウント値を合成してキーデータを生成しているので、キ
ーデータが更新される際には2ビット以上のビット数が
変更されたキーデータに変更されるために前のキーデー
タとの関連性を希薄化でき、第2実施例に比較してキー
データとライトデータとの一致認定においてさらに精度
を向上させることが可能である。
Further, since the count values of the two increment counters are combined to generate the key data, when the key data is updated, the number of bits of 2 bits or more is changed to the changed key data. Therefore, the relationship with the previous key data can be diluted, and it is possible to further improve the accuracy in recognizing the coincidence between the key data and the write data as compared with the second embodiment.

【0050】次に、本発明の第4実施例について説明す
る。図7は、第4実施例におけるライトデータとキーデ
ータとの比較部分の回路図である。
Next, a fourth embodiment of the present invention will be described. FIG. 7 is a circuit diagram of a comparison part of write data and key data in the fourth embodiment.

【0051】第4実施例では、図1におけるキーデータ
設定回路22に替えてキーデータ設定回路22dを設け
る点のみが異なり、他の構成は図1と同一である。キー
データ設定回路22dは、比較回路24からクリア信号
CLRが出力される毎にこれを入力してインクリメント
するインクリメントカウンタ51と、パリティビット5
2と、パリティビット52の値を決めるパリティ生成回
路53とを備えている。キーデータは上位桁をインクリ
メントカウンタ51のカウント値とし最下位桁をパリテ
ィビット52の値として設定される。図7ではインクリ
メントカウンタ51が7ビット(bit7〜bit1)
で、偶数パリティ方式のパリティ生成回路53によりパ
リティビット(bit0)52の値が定められる例であ
る。
The fourth embodiment is the same as FIG. 1 except for the point that a key data setting circuit 22d is provided instead of the key data setting circuit 22 in FIG. The key data setting circuit 22d includes an increment counter 51 that inputs and increments a clear signal CLR each time the comparison circuit 24 outputs the clear signal CLR, and a parity bit 5.
2 and a parity generation circuit 53 that determines the value of the parity bit 52. The key data is set such that the upper digit is the count value of the increment counter 51 and the least significant digit is the value of the parity bit 52. In FIG. 7, the increment counter 51 has 7 bits (bit7 to bit1).
The value of the parity bit (bit0) 52 is determined by the parity generation circuit 53 of the even parity method.

【0052】この例では設定されるキーデータは、クリ
ア信号CLRを入力する毎に、(00H)から(03
H)、(05H)、(06H)…(FFH)と変化し、
再び(00H)に戻る。
In this example, the set key data is from (00H) to (03) every time the clear signal CLR is input.
H), (05H), (06H) ... (FFH)
Return to (00H) again.

【0053】本実施例においても、CPU1では、実行
中のプログラムでのウォッチドッグタイマへのアクセス
回数をカウントすることにより、インクリメントカウン
タのカウント値を再現できるので、再現したカウント値
に対してCPU1内でパリティ生成を行って合成するこ
とにより、容易にキーデータを再現できる。
Also in this embodiment, the CPU 1 can reproduce the count value of the increment counter by counting the number of accesses to the watchdog timer in the program being executed. The key data can be easily reproduced by performing parity generation and combining with.

【0054】CPU1はプログラム中の処理が正常に実
行されると、CPU1側で再現したキーデータ(図7の
例では(59H))をライトデータWDATとしてウォ
ッチドッグタイマ2に送る。キーデータ設定回路22d
におけるインクリメントカウンタ51のカウント値(0
101100)と偶数パリティによるパリティビット5
2の値(1)を合成して(01011001)すなわち
(59H)が設定されたキーデータと、カウンタ制御レ
ジスタ23に格納されたライトデータWDATとが一致
するときには、比較回路24はクリア信号CLRを出力
する。インクリメントカウンタ51のカウント値とパリ
ティビット52の値とを合成して設定されたキーデータ
とライトデータWDATとが一致しないときには、CP
U1における処理が正常に実行されなかったことを示す
ので暴走状態にあるとして比較回路24は第2の暴走検
知信号RAbを出力する。
When the processing in the program is normally executed, the CPU 1 sends the key data ((59H) in the example of FIG. 7) reproduced on the CPU 1 side to the watchdog timer 2 as the write data WDAT. Key data setting circuit 22d
Count value of the increment counter 51 (0
101100) and parity bit 5 with even parity
When the key data in which the value (1) of 2 is combined (01011001), that is, (59H), and the write data WDAT stored in the counter control register 23 match, the comparison circuit 24 outputs the clear signal CLR. Output. When the key data set by combining the count value of the increment counter 51 and the value of the parity bit 52 do not match the write data WDAT, CP
The comparison circuit 24 outputs the second runaway detection signal RAb because it is in a runaway state because it indicates that the process in U1 has not been normally executed.

【0055】本実施例においても他の実施例と同様にC
PUが実行するアプリケーションのプログラムに合わせ
てクロック周波数とオーバーフロー判定値との組み合わ
せを選択することができ、且つ、ユーザが意図しないモ
ード変更のアクセスに対する防御性を著しく改善するこ
とができる。
In this embodiment as well, as in the other embodiments, C
The combination of the clock frequency and the overflow determination value can be selected according to the program of the application executed by the PU, and the protection against access for mode change not intended by the user can be significantly improved.

【0056】また、インクリメントカウンタのカウント
値とパリティビット値を合成してキーデータを生成して
いるので、キーデータが更新される際に前のキーデータ
との関連性を希薄化でき、第2実施例に比較してキーデ
ータとライトデータとの一致認定においてさらに精度を
向上させることが可能である。
Further, since the count value of the increment counter and the parity bit value are combined to generate the key data, the relevance to the previous key data can be diluted when the key data is updated. It is possible to further improve the accuracy in recognizing the coincidence of the key data and the write data as compared with the embodiment.

【0057】なお、図7では、パリティ生成回路53は
偶数パリティ方式を用いてパリティビット52の値を決
定したが、パリティ生成回路53が奇数パリティ方式を
用いるものであってもよい。また、キーデータ生成にお
いて、パリティビット52を最上位桁とし、インクリメ
ントカウンタ51を下位桁として合成してもよい。
Although the parity generation circuit 53 determines the value of the parity bit 52 using the even parity method in FIG. 7, the parity generation circuit 53 may use the odd parity method. In the key data generation, the parity bit 52 may be the highest digit and the increment counter 51 may be the lower digit.

【0058】次に、本発明の第5実施例について説明す
る。図8は、第5実施例におけるライトデータとキーデ
ータとの比較部分の回路図である。
Next, a fifth embodiment of the present invention will be described. FIG. 8 is a circuit diagram of a comparison part of write data and key data in the fifth embodiment.

【0059】第5実施例では、図1におけるキーデータ
設定回路22に替えてキーデータ設定回路22eを設け
る点のみが異なり、他の構成は図1と同一である。キー
データ設定回路22eは、所定の連続したアドレス(図
8ではXX0H〜XX7H)に互いに異なるデータを記
憶したメモリ61と、比較回路24からクリア信号CL
Rが出力され、これを入力する毎にメモリ61の読出ア
ドレスADRに1を加えて新たな読出アドレスADRに
更新し、所定の連続したアドレスのうちの最後尾のアド
レス(XX7H)が読出アドレスのときにクリア信号C
LRを入力した場合には先頭のアドレス(XX0H)に
読出アドレスを更新するリングアドレス生成回路62
と、リングアドレス生成回路62の読出アドレスADR
が指すメモリ61のアドレスに記憶されたデータを格納
するキーデータレジスタ63とを備えている。キーデー
タレジスタ63の格納データがキーデータとして設定さ
れる。
The fifth embodiment is the same as FIG. 1 except for the point that a key data setting circuit 22e is provided instead of the key data setting circuit 22 in FIG. The key data setting circuit 22e includes a memory 61 storing different data at predetermined consecutive addresses (XX0H to XX7H in FIG. 8) and a clear signal CL from the comparison circuit 24.
R is output, and every time it is input, 1 is added to the read address ADR of the memory 61 to update to a new read address ADR, and the last address (XX7H) of the predetermined consecutive addresses is the read address. Sometimes clear signal C
When LR is input, the ring address generation circuit 62 that updates the read address to the top address (XX0H)
And the read address ADR of the ring address generation circuit 62.
And a key data register 63 for storing the data stored at the address of the memory 61 pointed to by. The data stored in the key data register 63 is set as the key data.

【0060】図8の実施例では、メモリ61は、クリア
信号CLRを入力する毎に読出アドレスADRの下位
が、(0H)、(1H)…(7H)、(0H)と循環し
て指定され、リングバッファとして使用される。これに
より、設定されるキーデータは、クリア信号CLRを入
力する毎に、アドレス順に(48H)から(93H)…
(65H)と変化し、再び(48H)に戻る。
In the embodiment of FIG. 8, in the memory 61, every time the clear signal CLR is input, the lower part of the read address ADR is cyclically designated as (0H), (1H) ... (7H), (0H). , Used as a ring buffer. As a result, the set key data is from (48H) to (93H) ... in order of address every time the clear signal CLR is input.
It changes to (65H) and returns to (48H) again.

【0061】本実施例においても、CPU1では、実行
中のプログラムでのウォッチドッグタイマへのアクセス
回数をカウントすることにより、リングアドレス生成回
路62の読出アドレスを再現できる。図9(a)におい
て、システムバス4に接続されたメモリ5内にメモリ6
1と同じデータを格納したリングバッファをソフトウェ
アにより構成しておけば、CPU1は再現した読出アド
レスを基にメモリ5内に設けたリングバッファから容易
にキーデータを得ることができる。
Also in this embodiment, the CPU 1 can reproduce the read address of the ring address generation circuit 62 by counting the number of accesses to the watchdog timer in the program being executed. In FIG. 9A, the memory 6 is connected to the memory 5 connected to the system bus 4.
If the ring buffer storing the same data as 1 is configured by software, the CPU 1 can easily obtain the key data from the ring buffer provided in the memory 5 based on the reproduced read address.

【0062】CPU1はプログラム中の処理が正常に実
行されると、CPU1側で再現したキーデータ(図8の
例では(ACH))をライトデータWDATとしてウォ
ッチドッグタイマ2に送る。キーデータ設定回路22e
における読出アドレスADRに指定されたアドレス(X
X3H)から読み出されてキーデータレジスタ63に設
定されたキーデータ(ACH)と、カウンタ制御レジス
タ23に格納されたライトデータWDATとが一致する
ときには、比較回路24はクリア信号CLRを出力す
る。キーデータレジスタ63に設定されたキーデータと
ライトデータWDATとが一致しないときには、CPU
1における処理が正常に実行されなかったことを示すの
で暴走状態にあるとして比較回路24は第2の暴走検知
信号RAbを出力する。
When the processing in the program is normally executed, the CPU 1 sends the key data ((ACH) in the example of FIG. 8) reproduced on the CPU 1 side to the watchdog timer 2 as the write data WDAT. Key data setting circuit 22e
At the read address ADR (X
When the key data (ACH) read from X3H) and set in the key data register 63 matches the write data WDAT stored in the counter control register 23, the comparison circuit 24 outputs a clear signal CLR. When the key data set in the key data register 63 does not match the write data WDAT, the CPU
The comparison circuit 24 outputs the second runaway detection signal RAb because it is in the runaway state because it indicates that the process in 1 is not normally executed.

【0063】本実施例においても他の実施例と同様にC
PUが実行するアプリケーションのプログラムに合わせ
てクロック周波数とオーバーフロー判定値との組み合わ
せを選択することができ、且つ、ユーザが意図しないモ
ード変更のアクセスに対する防御性を著しく改善するこ
とができる。
In this embodiment as well, as in the other embodiments, C
The combination of the clock frequency and the overflow determination value can be selected according to the program of the application executed by the PU, and the protection against access for mode change not intended by the user can be significantly improved.

【0064】また、本実施例ではメモリ61に記憶させ
た複数のデータ間には、例えば疑似ランダム数として生
成したデータを用いることにより、関連性がないように
設定することができるので、第2実施例、第3実施例、
第4実施例に比較してキーデータとライトデータとの一
致認定においてさらに信頼性を向上させることができ
る。
Further, in the present embodiment, since a plurality of data stored in the memory 61 can be set so as not to be related to each other by using data generated as a pseudo-random number, the second data can be set. Example, Third Example,
Compared to the fourth embodiment, the reliability can be further improved in recognizing the matching of the key data and the write data.

【0065】なお、第5実施例においてメモリ61を図
9(a)のメモリ5内に設けてもよい。このように構成
した場合には、リングアドレス生成回路62からの読出
アドレスADRはシステムバス4を介してメモリ5に送
られ、メモリ5内に設けられたメモリ61の領域のデー
タが読み出されキーデータレジスタ63に格納されてキ
ーデータとして設定される。CPU1は再生した読出ア
ドレスを基にメモリ5内に設けられたメモリ61の領域
からキーデータを得る。キーデータ設定回路22e内に
メモリ61を物理的に設ける必要がないので、キーデー
タ設定回路22eの面積が削減できる。
In the fifth embodiment, the memory 61 may be provided in the memory 5 of FIG. 9 (a). In the case of such a configuration, the read address ADR from the ring address generation circuit 62 is sent to the memory 5 via the system bus 4, the data in the area of the memory 61 provided in the memory 5 is read, and the key is read. It is stored in the data register 63 and set as key data. The CPU 1 obtains the key data from the area of the memory 61 provided in the memory 5 based on the reproduced read address. Since it is not necessary to physically provide the memory 61 in the key data setting circuit 22e, the area of the key data setting circuit 22e can be reduced.

【0066】[0066]

【発明の効果】以上のように、本発明のウォッチドッグ
タイマでは、モードレジスタを設けたことによりクロッ
ク周波数、オーバーフロー判定値などの組み合わせをモ
ード指定できるようにし、また、モードレジスタへのア
クセス回数を検出する機構を設けてモードレジスタへの
2回目のアクセスがあったときには不正アクセスであり
CPUが暴走したとして外部へ暴走検出割込みを出力す
るように構成したので、CPUが実行するアプリケーシ
ョンのプログラムに合わせてクロック周波数とオーバー
フロー判定値との組み合わせを選択することができ、且
つ、ユーザが意図しないモード変更のアクセスに対する
防御性を著しく改善することが可能となる。
As described above, in the watchdog timer of the present invention, the mode register is provided so that the combination of the clock frequency, the overflow judgment value and the like can be designated as the mode, and the number of accesses to the mode register can be set. When a second access to the mode register is provided with a detection mechanism, it is configured to output a runaway detection interrupt to the outside assuming that the CPU has runaway due to illegal access. It is possible to select a combination of the clock frequency and the overflow determination value, and it is possible to remarkably improve the protection against access for mode change not intended by the user.

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

【図1】本発明のウォッチドッグタイマ2の一実施形態
のブロック図である。
FIG. 1 is a block diagram of an embodiment of a watch dog timer 2 of the present invention.

【図2】第1実施例におけるライトデータとキーデータ
との比較部分の回路図である。
FIG. 2 is a circuit diagram of a comparison portion of write data and key data in the first embodiment.

【図3】第1実施例のウォッチドッグタイマの動作フロ
ー図である。
FIG. 3 is an operational flowchart of the watchdog timer of the first embodiment.

【図4】第2実施例におけるライトデータとキーデータ
との比較部分の回路図である。
FIG. 4 is a circuit diagram of a comparison part of write data and key data in the second embodiment.

【図5】第2実施例のウォッチドッグタイマの動作フロ
ー図である。
FIG. 5 is an operation flowchart of the watchdog timer of the second embodiment.

【図6】第3実施例におけるライトデータとキーデータ
との比較部分の回路図である。
FIG. 6 is a circuit diagram of a comparison part of write data and key data in the third embodiment.

【図7】第4実施例におけるライトデータとキーデータ
との比較部分の回路図である。
FIG. 7 is a circuit diagram of a comparison part of write data and key data in the fourth embodiment.

【図8】第5実施例におけるライトデータとキーデータ
との比較部分の回路図である。
FIG. 8 is a circuit diagram of a comparison part of write data and key data in the fifth embodiment.

【図9】(a)は、ウォッチドッグタイマを含むコンピ
ュータシステムを示すブロック図であり、従来のウォッ
チドッグタイマの動作の概略を示す図である。
FIG. 9A is a block diagram showing a computer system including a watchdog timer, and is a diagram showing an outline of operation of a conventional watchdog timer.

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

1 CPU 2,2a ウォッチドッグタイマ 3 割込みコントローラ 4 システムバス 5,61 メモリ 11 モードレジスタ 12 クロック選択回路 13 カウント動作制御回路 14 タイマカウンタ 15 オーバーフロー検出回路 16 暴走検出割込み生成回路 17 不正アクセス判定部 21 アクセス回数検出回路 22,22a,22b,22c,22d,22e キ
ーデータ設定回路 23 カウンタ制御レジスタ 24 比較回路 31,41,42,51 インクリメントカウンタ 52 パリティビット 53 パリティ生成回路 62 リングアドレス生成回路 63 キーデータレジスタ
1 CPU 2, 2a Watchdog timer 3 Interrupt controller 4 System bus 5, 61 Memory 11 Mode register 12 Clock selection circuit 13 Count operation control circuit 14 Timer counter 15 Overflow detection circuit 16 Runaway detection interrupt generation circuit 17 Unauthorized access determination unit 21 Access Count detection circuit 22, 22a, 22b, 22c, 22d, 22e Key data setting circuit 23 Counter control register 24 Comparison circuit 31, 41, 42, 51 Increment counter 52 Parity bit 53 Parity generation circuit 62 Ring address generation circuit 63 Key data register

───────────────────────────────────────────────────── フロントページの続き (72)発明者 早川 武利 神奈川県川崎市中原区小杉町一丁目403番 53 エヌイーシーマイクロシステム株式会 社内 Fターム(参考) 5B042 JJ13 JJ21 JJ24 JJ29 JJ38 KK01 LA20 MC25    ─────────────────────────────────────────────────── ─── Continued front page    (72) Inventor Takehito Hayakawa             1-403 Kosugi-cho, Nakahara-ku, Kawasaki-shi, Kanagawa             53 NC Micro Systems Stock Association             In-house F-term (reference) 5B042 JJ13 JJ21 JJ24 JJ29 JJ38                       KK01 LA20 MC25

Claims (7)

【特許請求の範囲】[Claims] 【請求項1】 外部から複数のクロックを入力しクロッ
クの中からモード情報にしたがってカウントクロックを
選択して出力するクロック選択回路と、 クリア信号に基づいてカウント値がクリアされ、前記カ
ウントクロックを入力しパルス数をカウントするタイマ
カウンタと、 前記モード情報にしたがってオーバーフロー判定値が設
定され前記タイマカウンタのカウント値を監視して該カ
ウント値が前記オーバーフロー判定値以上になったこと
を検出してオーバーフロー信号を出力するオーバーフロ
ー検出回路と、 モードデータを入力して格納しモードデータに基づき前
記モード情報を出力するモードレジスタと、 CPUからのアクセスを検出し該アクセスが前記モード
レジスタに対するアクセスであるときには1回目のアク
セスであればCPUからのデータを前記モードレジスタ
に書き込み2回目のアクセスであれば第1の暴走検知信
号を出力し、CPUからのアクセスが前記モードレジス
タに対するアクセスでないときにCPUからのデータを
複数ビットからキーデータと比較して一致すれば前記ク
リア信号を出力し不一致であれば第2の暴走検知信号を
出力する不正アクセス判定部と、 前記オーバーフロー信号、前記第1の暴走検知信号およ
び前記第2の暴走検知信号のうち少なくともひとつを入
力したときに暴走検出割込みを外部へ送信する暴走検出
割込み生成回路とを備えることを特徴とするウォッチド
ッグタイマ装置。
1. A clock selection circuit for inputting a plurality of clocks from the outside and selecting and outputting a count clock from the clocks according to mode information, and a count value that is cleared based on a clear signal and the count clock is input. A timer counter that counts the number of pulses, and an overflow determination value is set according to the mode information, and the count value of the timer counter is monitored to detect that the count value is equal to or greater than the overflow determination value. An overflow detection circuit for outputting the mode data, a mode register for inputting and storing the mode data and outputting the mode information based on the mode data, an access from the CPU, and when the access is an access to the mode register, the first time Access When the data from the PU is written to the mode register and the second access is made, the first runaway detection signal is output, and when the access from the CPU is not the access to the mode register, the data from the CPU is converted from a plurality of bits to key data. And an unlawful access determination section that outputs the clear signal if they match and a second runaway detection signal if they do not match, and the overflow signal, the first runaway detection signal, and the second runaway detection. A watchdog timer device, comprising: a runaway detection interrupt generation circuit that transmits a runaway detection interrupt to the outside when at least one of the signals is input.
【請求項2】 前記不正アクセス判定部は、 CPUからのアクセスを検出し該アクセスが前記モード
レジスタに対するアクセスであるときには1回目のアク
セスであればCPUからのデータを前記モードレジスタ
に書き込み2回目のアクセスであれば第1の暴走検知信
号を出力するアクセス回数検出回路と、 CPUからのアクセスが前記モードレジスタに対するア
クセスでないときにCPUからのデータを格納するカウ
ンタ制御レジスタと、 複数ビットからなるキーデータが設定されるキーデータ
設定回路と、 前記カウンタ制御レジスタに格納されたデータと前記キ
ーデータとを比較して一致すれば前記クリア信号を出力
し不一致であれば第2の暴走検知信号を出力する比較回
路とを有することを特徴とする請求項1記載のウォッチ
ドッグタイマ装置。
2. The unauthorized access determination unit detects an access from a CPU, and when the access is an access to the mode register, if the access is a first access, writes data from the CPU to the mode register and a second access. If it is an access, an access frequency detection circuit that outputs a first runaway detection signal, a counter control register that stores data from the CPU when the access from the CPU is not an access to the mode register, and key data composed of multiple bits Is compared with the key data setting circuit, and the data stored in the counter control register is compared with the key data. If they match, the clear signal is output, and if they do not match, the second runaway detection signal is output. The watchdog according to claim 1, further comprising a comparison circuit. Timer devices.
【請求項3】 前記キーデータ設定回路には、複数ビッ
トからなる予め固定的に定められたデータが設定される
ことを特徴とする請求項2記載のウォッチドッグタイマ
装置。
3. The watch dog timer device according to claim 2, wherein the key data setting circuit is set with a fixedly fixed data consisting of a plurality of bits.
【請求項4】 前記キーデータ設定回路は、前記クリア
信号を入力する毎にインクリメントするインクリメント
カウンタを備え、該インクリメントカウンタのカウント
値がキーデータとして設定されることを特徴とする請求
項2記載のウォッチドッグタイマ装置。
4. The key data setting circuit includes an increment counter that increments each time the clear signal is input, and the count value of the increment counter is set as key data. Watchdog timer device.
【請求項5】 前記キーデータ設定回路は、前記クリア
信号を入力する毎にインクリメントする同一ビット長の
2個のインクリメントカウンタを備え、前記2個のイン
クリメントカウンタのうち1個のカウント値を上位桁と
し他の1個のカウント値を下位桁としてキーデータが設
定されることを特徴とする請求項2記載のウォッチドッ
グタイマ装置。
5. The key data setting circuit includes two increment counters having the same bit length that are incremented each time the clear signal is input, and one count value of the two increment counters is a higher digit. 3. The watchdog timer device according to claim 2, wherein the key data is set with the other one count value as a lower digit.
【請求項6】 前記キーデータ設定回路は、前記クリア
信号を入力する毎にインクリメントするインクリメント
カウンタと、パリティビットと、前記パリティビットの
値を決めるパリティ生成回路とを備え、前記インクリメ
ントカウンタのカウント値と前記パリティビットの値と
を合成してキーデータが設定されることを特徴とする請
求項2記載のウォッチドッグタイマ装置。
6. The key data setting circuit includes an increment counter that increments each time the clear signal is input, a parity bit, and a parity generation circuit that determines the value of the parity bit, and the count value of the increment counter. 3. The watchdog timer device according to claim 2, wherein key data is set by synthesizing the value of the parity bit with the value of the parity bit.
【請求項7】 前記キーデータ設定回路は、所定の連続
したアドレスに互いに異なるデータを記憶したメモリ
と、前記クリア信号を入力する毎に前記メモリの読出ア
ドレスに1を加えて新たな読出アドレスに更新し前記所
定の連続したアドレスのうちの最後尾のアドレスが読出
アドレスアドレスのときに前記クリア信号を入力した場
合には前記所定の連続したアドレスのうちの先頭のアド
レスに読出アドレスを更新するリングアドレス生成回路
と、前記リングアドレス生成回路の読出アドレスが指す
前記メモリのアドレスに記憶されたデータを格納するレ
ジスタとを備え、前記レジスタの格納データがキーデー
タとして設定されることを特徴とする請求項2記載のウ
ォッチドッグタイマ装置。
7. The key data setting circuit adds a new read address by adding 1 to the read address of the memory each time the clear signal is input, and a memory in which different data are stored at predetermined consecutive addresses. A ring for updating the read address to the first address of the predetermined continuous addresses when the clear signal is input when the last address of the predetermined continuous addresses is the read address address. An address generation circuit and a register for storing data stored at an address of the memory pointed to by a read address of the ring address generation circuit, wherein the data stored in the register is set as key data. Item 2. A watchdog timer device according to item 2.
JP2001351330A 2001-11-16 2001-11-16 Watchdog timer device Pending JP2003150410A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001351330A JP2003150410A (en) 2001-11-16 2001-11-16 Watchdog timer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001351330A JP2003150410A (en) 2001-11-16 2001-11-16 Watchdog timer device

Publications (1)

Publication Number Publication Date
JP2003150410A true JP2003150410A (en) 2003-05-23

Family

ID=19163657

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001351330A Pending JP2003150410A (en) 2001-11-16 2001-11-16 Watchdog timer device

Country Status (1)

Country Link
JP (1) JP2003150410A (en)

Similar Documents

Publication Publication Date Title
US7600090B2 (en) Microcontroller based flash memory digital controller system
US5233613A (en) Reliable watchdog timer
US6088740A (en) Command queuing system for a hardware accelerated command interpreter engine
US4144562A (en) System and method for increasing microprocessor output data rate
US5594865A (en) Watchdog timer that can detect processor runaway while processor is accessing storage unit using data comparing unit to reset timer
RU2249247C2 (en) Method for protection of computer core from unsanctioned outside changes
JP2016143422A (en) Configuring serial devices
JP2003150410A (en) Watchdog timer device
US5796996A (en) Processor apparatus and its control method for controlling a processor having a CPU for executing an instruction according to a control program
JP2900627B2 (en) Interrupt control device
JP3082721B2 (en) Timer device
EP0554819B1 (en) Transfer control unit, processor element and data transferring method
KR100525537B1 (en) Applied Program Bungle Detection Apparatus and Method by Interrupt
JP2001297039A (en) Data processor
JPH04253244A (en) Circuit for protecting data in memory case of program run-away
JP2783285B2 (en) Information processing device
JP3152014B2 (en) Timer circuit
JPS61199104A (en) Memory multiplexing control system
JPH04156641A (en) Register access device
CN118152176A (en) Microcontroller, control system and control method
JP5045692B2 (en) Operation mode control circuit and microcomputer
JP2923869B2 (en) Event input circuit
JP2978626B2 (en) DMA controller
JP2001290755A (en) Method for accessing eeprom and electronic device having eeprom
JPH064687A (en) Single chip microcomputer

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20050215

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050222

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050422

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050726

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050922

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20051025