JPH0535538A - Micro Processor - Google Patents
Micro ProcessorInfo
- Publication number
- JPH0535538A JPH0535538A JP3192265A JP19226591A JPH0535538A JP H0535538 A JPH0535538 A JP H0535538A JP 3192265 A JP3192265 A JP 3192265A JP 19226591 A JP19226591 A JP 19226591A JP H0535538 A JPH0535538 A JP H0535538A
- Authority
- JP
- Japan
- Prior art keywords
- counter
- runaway
- value
- instruction
- time
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Debugging And Monitoring (AREA)
Abstract
(57)【要約】
【目的】本発明は、ファームウェアに依存することな
く、分岐命令や割込み命令も含めた全ての命令処理に於
いて即座に暴走検出を可能としたことを特徴とする。
【構成】サブルーチンコールの毎にカウンタ11をカウ
ントアップし、スタックにプッシュして、リターン時に
ポップされるカウンタ値とそのときのカウンタ値とを比
較器12で比較し、異なっていたならば暴走と見做すこ
とにより、サブルーチンジャンプからのリターン時に即
座にプログラムの暴走検出が可能なハードウェアをもつ
構成としたことを特徴とする。
(57) [Summary] [Object] The present invention is characterized in that runaway detection can be immediately performed in all instruction processing including branch instructions and interrupt instructions without depending on firmware. [Structure] Each time a subroutine call is made, a counter 11 is incremented, pushed onto a stack, and the counter value that is popped at the time of return is compared with the counter value at that time by a comparator 12, and if they are different, a runaway It is characterized by having a hardware capable of detecting runaway of a program immediately upon return from a subroutine jump.
Description
【0001】[0001]
【産業上の利用分野】本発明はプログラム暴走検出回路
を内蔵したマイクロプロセッサに関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microprocessor incorporating a program runaway detection circuit.
【0002】[0002]
【従来の技術】近年、半導体技術の進歩により、マイク
ロプロセッサ、周辺制御用LSI、メモリLSIが非常
に安価に供給されるようになり、これらを適宜組合わせ
ることにより比較的高性能なパーソナルコンピュータを
構築できるようになった。2. Description of the Related Art In recent years, advances in semiconductor technology have made it possible to supply microprocessors, peripheral control LSIs, and memory LSIs at a very low cost. Now you can build.
【0003】特にこの種パーソナルコンピュータに於け
る制御中枢となるマイクロプロセッサの性能向上は目覚
ましく、8ビット、16ビット、32ビットデータ処理
は勿論のこと、最近では64ビット処理あるいはキャッ
シュ内蔵のものまで出現してきた。In particular, the performance of the microprocessor, which is the control center of this kind of personal computer, has been remarkably improved, and not only 8-bit, 16-bit and 32-bit data processing but also 64-bit processing or those with a built-in cache have recently appeared. I've been
【0004】ところで、上述したパーソナルコンピュー
タは内蔵のメモリにプログラムを格納し、プログラムカ
ウンタに設定されるアドレスに従い、その内容を読み出
しながらデータ処理を実行する。プログラムカウンタは
次に実行すべき命令のメモリアドレスを示しており、1
命令の実行が終了する毎に更新され、次のアドレスが設
定される。このようなシステムにて、通常のデータ処理
中、プログラムの暴走を検出するには、従来、例えば、
ウォッチドッグタイマのようにファームウェアに依存
し、プログラム中にタイマをリセットさせる命令を入れ
ておいて、プログラムカウンタの値がある設定値以上に
なった場合に暴走と判断し暴走検出を行なっていた。By the way, the above-mentioned personal computer stores a program in a built-in memory, and executes data processing while reading the content according to an address set in a program counter. The program counter indicates the memory address of the next instruction to be executed,
It is updated every time the instruction is executed and the next address is set. In such a system, in order to detect a program runaway during normal data processing, conventionally, for example,
Depending on the firmware, such as a watchdog timer, an instruction to reset the timer is included in the program, and when the value of the program counter exceeds a certain set value, it is judged as a runaway and the runaway is detected.
【0005】[0005]
【発明が解決しようとする課題】従来はタイマのカウン
トアップがある一定値を示すことで暴走検出を行なって
いたため、即座に暴走検出を行なうことができない。い
ずれにせよプログラムに手を加える必要があり、プログ
ラマによる負担が大きかった。これを解決するためにマ
イクロプロセッサ内部に、プログラムカウンタの値をコ
ンペアにより検査する回路を持ち、ファームウェアに依
存せず、即座に暴走を検出するハードウェアが考えられ
る。しかしながら、メモリに格納された命令がシーケン
シャルに実行される場合は良いとしても分岐命令や割込
み命令処理時にコンペア操作を禁止するための手段が必
要となり、従って暴走検出ができず、その時点で暴走し
ていても検出不可能であった。Conventionally, since the runaway is detected by counting up the timer to show a certain value, the runaway cannot be detected immediately. In any case, the program had to be modified, which puts a heavy burden on the programmer. In order to solve this problem, it is conceivable that the microprocessor has a circuit for inspecting the value of the program counter by a compare and that detects the runaway immediately without depending on the firmware. However, even if the instructions stored in the memory are executed sequentially, a means for prohibiting the compare operation at the time of processing a branch instruction or an interrupt instruction is necessary, and therefore a runaway cannot be detected and a runaway occurs at that time. However, it was not detectable.
【0006】本発明は、ファームウェアに依存すること
なく、分岐命令や割込み命令も含めた全ての命令処理に
おいて即座に暴走検出可能なマイクロプロセッサを提供
することを目的とする。It is an object of the present invention to provide a microprocessor which can detect runaway immediately in all instruction processing including branch instructions and interrupt instructions without depending on firmware.
【0007】[0007]
【0008】[0008]
【課題を解決するための手段】本発明のマイクロプロセ
ッサは、命令を解読するデコード回路と、デコード回路
によりサブルーチンコールもしくはリターン命令を検出
することによりnビットデータの更新を行なうカウンタ
と、サブルーチンコールの毎に上記カウンタを更新して
記憶装置にプッシュし、リターンの毎にその値をポップ
するスタック制御回路と、ポップした値とその時点での
カウンタの値を比較する比較回路とを具備し、比較回路
による比較結果によってプログラム暴走を検出すること
を特徴とする。A microprocessor of the present invention includes a decode circuit for decoding instructions, a counter for updating n-bit data by detecting a subroutine call or a return instruction by the decode circuit, and a subroutine call. A stack control circuit that updates the counter each time and pushes it to the storage device and pops the value at each return, and a comparison circuit that compares the popped value and the counter value at that time The feature is that a program runaway is detected based on a comparison result by a circuit.
【0009】[0009]
【作用】上述した構成にて、サブルーチンコール毎にカ
ウンタをカウントアップし、スタックにプッシュする。
リターン時にポップされるカウンタの値とそのときのカ
ウンタ値とを比較し、異なっていたならば暴走と見做
す。これらの処理をファームウェアによらず全てハード
ウェアで実現することによりサブルーチンジャンプから
のリターン時に、即座にプログラムの暴走検出が可能と
なる。With the above-mentioned configuration, the counter is incremented for each subroutine call and pushed on the stack.
The value of the counter popped at the time of return is compared with the counter value at that time, and if they are different, it is considered as a runaway. By implementing all of these processes by hardware without using firmware, it is possible to immediately detect runaway of a program when returning from a subroutine jump.
【0010】[0010]
【実施例】図1は本発明が使用されるパーソナルコンピ
ュータの構成例を示すブロック図である。1 is a block diagram showing an example of the configuration of a personal computer in which the present invention is used.
【0011】図において、1はマイクロプロセッサ(μ
CPU)であり、システムRAM2に格納されたプログ
ラムもしくはBIOS−ROM3(基本入出力システ
ム)に格納されたプログラムを読み出し、演算制御もし
くはシステムに接続される各入出力装置の制御を行な
う。システムRAM2にはプログラム領域の他に本発明
にて使用されるスタック領域も割り付けられる。In the figure, 1 is a microprocessor (μ
It is a CPU) and reads a program stored in the system RAM 2 or a program stored in the BIOS-ROM 3 (basic input / output system) to perform arithmetic control or control of each input / output device connected to the system. A stack area used in the present invention is allocated to the system RAM 2 in addition to the program area.
【0012】4,5,6はそれぞれ入出力装置であり、
4はデータ入力を行なうキーボード(KB)、5は外部
記憶となるフロッピーディスク装置(FDD)、6はデ
ータ表示がなされるディスプレイ装置(CRT)であ
る。これら入出力装置はいずれもBIOSプログラムの
制御を受け、いずれもマイクロプロセッサ1によってプ
ログラム可能な入出力コントローラであるキーボードコ
ントローラ(KBC)7、フロッピーディスクコントロ
ーラ(FDC)8、ディスプレイコントローラ(CRT
C)9を介して接続される。Reference numerals 4, 5 and 6 are input / output devices,
Reference numeral 4 is a keyboard (KB) for inputting data, 5 is a floppy disk device (FDD) serving as an external storage, and 6 is a display device (CRT) for displaying data. All of these input / output devices are controlled by a BIOS program, and all of them are keyboard controller (KBC) 7, floppy disk controller (FDC) 8, display controller (CRT) which are input / output controllers programmable by the microprocessor 1.
C) Connected via 9.
【0013】図2は本発明の実施例を示すブロック図で
あり、図1に示すマイクロプロセッサ1のうち、本発明
と関係する部分のみ抽出して示したものである。FIG. 2 is a block diagram showing an embodiment of the present invention, and shows only a portion of the microprocessor 1 shown in FIG. 1 which is relevant to the present invention.
【0014】図において、11はカウンタであり、分岐
命令を検出することによりnビットデータのアップ/ダ
ウンがなされる。12は比較回路であり、上述したカウ
ンタ11の値と図示しない記憶装置(スタック機構)か
ら読み込んだ値との比較を行なう。13はセレクタであ
り、カウンタ11の値とスタック機構から得られる値と
を切り替え、比較回路12に供給する。In the figure, reference numeral 11 is a counter, which raises / downs n-bit data by detecting a branch instruction. Reference numeral 12 is a comparison circuit, which compares the value of the counter 11 described above with the value read from a storage device (stack mechanism) not shown. Reference numeral 13 is a selector, which switches the value of the counter 11 and the value obtained from the stack mechanism and supplies the value to the comparison circuit 12.
【0015】以下、本発明の実施例の動作について説明
する。The operation of the embodiment of the present invention will be described below.
【0016】本発明は上述したように、サブルーチンコ
ール毎にカウンタをカウントアップし、スタックにプッ
シュする。リターン時にポップされるカウンタの値とそ
のときのカウンタ値とを比較し、異なっていたならば暴
走とみなす。上記処理機能をファームウェアによらず、
全てハードウェアで実現することにより、サブルーチン
ジャンプからのリターン時、即座にプログラムの暴走検
出を可能とする。このために、サブルーチンコール、リ
ターン命令等を検出する命令デコード回路を備える。As described above, the present invention counts up the counter for each subroutine call and pushes it on the stack. The value of the counter popped on return is compared with the counter value at that time, and if they are different, it is considered as a runaway. The above processing functions are not dependent on the firmware,
By implementing all in hardware, it is possible to immediately detect runaway programs when returning from a subroutine jump. For this purpose, an instruction decoding circuit for detecting a subroutine call, a return instruction, etc. is provided.
【0017】以下、図2を使用して本発明の実施例によ
る動作を説明する。The operation of the embodiment of the present invention will be described below with reference to FIG.
【0018】まず、サブルーチンコール命令実行時にカ
ウンタ11の値を更新(アップカウント)し、記憶装置
(スタック)にプッシュする。First, when the subroutine call instruction is executed, the value of the counter 11 is updated (up-counted) and pushed to the storage device (stack).
【0019】分岐命令が繰り返された場合も同様の動作
を繰り返す。The same operation is repeated when the branch instruction is repeated.
【0020】次にリターン命令によって分岐先より分岐
地点に戻る場合は、上述した記憶装置から値をポップ
し、セレクタ13を介して比較回路12にてカウンタ1
1値と比較し、データの不一致を示していたなら暴走と
判断する。Next, when returning to the branch point from the branch destination by the return instruction, the value is popped from the above-mentioned memory device, and the counter 1 is counted by the comparison circuit 12 via the selector 13.
Compared with 1 value, if data disagreement is shown, it is judged as a runaway.
【0021】データが一致していたならば正常動作と判
断し、カウンタ11をダウンカウントし、次の命令処理
に進む。If the data match, it is determined that the operation is normal, the counter 11 is down-counted, and the process proceeds to the next instruction processing.
【0022】リターン命令が繰り返された場合も同様の
動作を繰り返す。The same operation is repeated when the return instruction is repeated.
【0023】比較回路12の出力によってはプログラム
暴走回避のためにマイクロプロセッサの動作を停止させ
たり、初期ルーチンへ強制的に戻す回路を付加すること
で暴走回避が可能である。Depending on the output of the comparison circuit 12, the runaway can be avoided by stopping the operation of the microprocessor for avoiding the program runaway or adding a circuit for forcibly returning to the initial routine.
【0024】[0024]
【発明の効果】上記したように本発明によれば、分岐命
令を含む全ての命令処理に於いて即座にプログラムの暴
走検出が可能となり、信頼性の向上が図れる。As described above, according to the present invention, runaway of a program can be immediately detected in all instruction processing including branch instructions, and reliability can be improved.
【図1】本発明が適用されるパーソナルコンピュータの
構成例を示すブロック図。FIG. 1 is a block diagram showing a configuration example of a personal computer to which the present invention is applied.
【図2】本発明の実施例を示すブロック図。FIG. 2 is a block diagram showing an embodiment of the present invention.
11…カウンタ,12…比較回路,13…セレクタ。 11 ... Counter, 12 ... Comparison circuit, 13 ... Selector.
Claims (1)
コード回路でサブルーチンコール又はリターン命令を検
出することによりnビットデータの更新を行なうカウン
タと、上記サブルーチンコール検出の度に上記カウンタ
を更新して記憶装置にプッシュし、リターンの毎にその
値をポップするスタック制御回路と、ポップした値とそ
の時点でのカウンタの値を比較する比較回路とを具備
し、上記比較回路の比較結果によってプログラム暴走を
検出することを特徴とするマイクロプロセッサ。Claim: What is claimed is: 1. A decoding circuit for decoding an instruction, a counter for updating n-bit data by detecting a subroutine call or a return instruction by this decoding circuit, and a counter for each detection of the subroutine call. The comparison circuit includes a stack control circuit that updates the counter and pushes it to a storage device, and pops the value at each return, and a comparison circuit that compares the popped value with the counter value at that time. A microprocessor characterized by detecting a program runaway according to the result of comparison.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP3192265A JPH0535538A (en) | 1991-07-31 | 1991-07-31 | Micro Processor |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP3192265A JPH0535538A (en) | 1991-07-31 | 1991-07-31 | Micro Processor |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH0535538A true JPH0535538A (en) | 1993-02-12 |
Family
ID=16288408
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP3192265A Pending JPH0535538A (en) | 1991-07-31 | 1991-07-31 | Micro Processor |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0535538A (en) |
-
1991
- 1991-07-31 JP JP3192265A patent/JPH0535538A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP3176093B2 (en) | Microprocessor interrupt controller | |
| EP0538817A2 (en) | High-speed processor capable of handling multiple interrupts | |
| US7421431B2 (en) | Providing access to system management information | |
| US6880030B2 (en) | Unified exception handling for hierarchical multi-interrupt architectures | |
| JPH02202642A (en) | Device for supervising program action | |
| US7206920B2 (en) | Min/max value validation by repeated parallel comparison of the value with multiple elements of a set of data elements | |
| US5867658A (en) | Method and apparatus for implementing a stop state for a processor in a multiprocessor system | |
| US4764869A (en) | Method and apparatus for controlling interruption in the course of instruction execution in a processor | |
| US20080148016A1 (en) | Multiprocessor system for continuing program execution upon detection of abnormality | |
| JP2008535072A (en) | Selective subroutine return structure | |
| JPH0535538A (en) | Micro Processor | |
| US5774687A (en) | Central processing unit detecting and judging whether operation result executed by ALU in response to a first instruction code meets a predetermined condition | |
| JP2000020352A (en) | Stack overflow detection method and stack underflow detection method | |
| JPH08255476A (en) | Apparatus and method for memory extended stack in data-processing system | |
| JPH04364531A (en) | Microprocessor | |
| JPH05257815A (en) | Central processing unit | |
| JPS6158054A (en) | Run away detection of program | |
| JP2503210B2 (en) | Micro program controller | |
| JPH06139084A (en) | Information processing equipment | |
| JP3616588B2 (en) | Micro program check system | |
| JP2002536759A (en) | Microprocessor and addressing method in microprocessor | |
| JPH03208132A (en) | Single chip microcomputer | |
| JPH04235638A (en) | Microprocessor provided with prefetching function | |
| JPH045729A (en) | Processor device | |
| JPH0528053A (en) | Method for memory check of program during system operation |