JPH086821A - Microprocessor - Google Patents

Microprocessor

Info

Publication number
JPH086821A
JPH086821A JP6136778A JP13677894A JPH086821A JP H086821 A JPH086821 A JP H086821A JP 6136778 A JP6136778 A JP 6136778A JP 13677894 A JP13677894 A JP 13677894A JP H086821 A JPH086821 A JP H086821A
Authority
JP
Japan
Prior art keywords
address
stack pointer
data access
execution unit
stack
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
JP6136778A
Other languages
Japanese (ja)
Inventor
Fumihiro Yoshimura
文博 吉村
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 JP6136778A priority Critical patent/JPH086821A/en
Publication of JPH086821A publication Critical patent/JPH086821A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

PURPOSE:To detect an error of a program which accesses a tentative variable that is not present any more. CONSTITUTION:The program is so generated that the addresses of all data access are above the address of a stack painter 5. Comparing the address of the stack painter 5 with an address of data access, the address of correct data access is above the address of the stack pointer 5. A comparator 4 compares the address of the stack pointer 5 with the address of data access at all times and a processor exception is generated when the large/small relation between the addresses is inverted.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、プログラムの誤りを検
出するマイクロプロセッサに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microprocessor for detecting a program error.

【0002】[0002]

【従来の技術】従来のマイクロプロセッサにおいては、
プログラムの誤りのために、正しくないメモリアクセス
を行った場合には、セグメントのリミット値を比較する
ことにより、あるいはページングにおけるアクセス可否
をチェックすることにより、メモリアクセスの誤りを検
出している。
2. Description of the Related Art In a conventional microprocessor,
When an incorrect memory access is performed due to a program error, the memory access error is detected by comparing the segment limit values or by checking the accessibility of paging.

【0003】[0003]

【発明が解決しようとする課題】この従来のマイクロプ
ロセッサでは、スタック上に一時変数を確保、使用して
解放した後に、すでに存在しない一時変数をプログラム
の誤りのために使用したとしても、これを検出すること
ができなかった。
In this conventional microprocessor, even if a temporary variable that does not already exist is used due to a program error after the temporary variable is secured on the stack, used, and released, this is still used. It could not be detected.

【0004】本発明の目的は、すでに存在しない一時変
数をアクセスするプログラムの誤りを検出するマイクロ
プロセッサを提供することにある。
An object of the present invention is to provide a microprocessor that detects an error in a program that accesses a temporary variable that does not already exist.

【0005】[0005]

【課題を解決するための手段】本発明のマイクロプロセ
ッサは、スタックポインタを含むレジスタ群と例外通知
信号を受付可能な実行ユニットと、データアクセスアド
レスを生成するアドレスユニットと、スタックポインタ
の値とアドレスユニットの生成したデータアクセスアド
レスを比較して実行ユニットに結果を渡す比較器とを備
えることを特徴としている。
A microprocessor according to the present invention comprises a register group including a stack pointer, an execution unit capable of receiving an exception notification signal, an address unit for generating a data access address, a stack pointer value and an address. And a comparator which compares the data access addresses generated by the units and passes the result to the execution unit.

【0006】[0006]

【実施例】次に、本発明の実施例について図面を参照し
て説明する。
Embodiments of the present invention will now be described with reference to the drawings.

【0007】図1は、本発明のマイクロプロセッサの一
実施例を示すブロック図である。本実施例は、スタック
ポインタ5を含むレジスタ群1と、実行ユニット2と、
アドレスユニット3と、比較器4とにより構成されてお
り、スタックポインタ5とアドレスユニット3は、比較
器4の2つの入力にそれぞれ接続され、比較器4の出力
は実行ユニット2に接続されている。
FIG. 1 is a block diagram showing an embodiment of the microprocessor of the present invention. In this embodiment, a register group 1 including a stack pointer 5, an execution unit 2,
It is composed of an address unit 3 and a comparator 4. The stack pointer 5 and the address unit 3 are respectively connected to two inputs of the comparator 4, and the output of the comparator 4 is connected to the execution unit 2. .

【0008】本実施例において、レジスタ群1は、スタ
ックポインタ5を含むレジスタの集合である。スタック
ポインタ5は、スタックのプッシュ・ポップ操作におけ
るメモリアクセスを示すレジスタである。実行ユニット
2は、プログラムを実行し、例外通知信号を受け付け
る。アドレスユニット3は、メモリアクセスのためのア
ドレスを生成する。比較器4は、アドレスユニット3で
生成されたアドレスと、スタックポインタ5の値とを比
較し、不正な値であったときは、実行ユニット2に通知
する。
In this embodiment, the register group 1 is a set of registers including the stack pointer 5. The stack pointer 5 is a register indicating memory access in push / pop operation of the stack. The execution unit 2 executes the program and receives an exception notification signal. The address unit 3 generates an address for memory access. The comparator 4 compares the address generated by the address unit 3 with the value of the stack pointer 5, and when the value is incorrect, notifies the execution unit 2 of it.

【0009】次に、本実施例の動作を説明する。Next, the operation of this embodiment will be described.

【0010】図2は、本実施例の動作概念図である。本
実施例においては、プログラムでアクセスする全てのデ
ータは、常にスタックポインタより上位アドレス側とな
るようにプログラミングする。これにより、全ての正し
いデータアクセスは、スタックポインタの値と比較し
て、同じアドレスかまたは上位側のアドレスとなり、ス
タックポインタの値より下位側のデータアクセスは、全
て誤りとみなすことができる。
FIG. 2 is a conceptual diagram of the operation of this embodiment. In this embodiment, all data accessed by the program is programmed so that it is always on the upper address side of the stack pointer. As a result, all correct data accesses are made to the same address or higher addresses as compared with the stack pointer value, and all data accesses lower than the stack pointer value can be regarded as errors.

【0011】図2(a)の状態からスタック上に一時変
数の領域を確保すると、図2(b)の状態となる。この
とき、一時変数の領域は、スタックポインタの値以上に
あるため、アクセスは成功する。一時変数の領域を解放
すると、図2(c)の状態になる。このとき、解放され
てしまって、すでに存在しない一時変数の領域に対して
データアクセスを行うと、そのアドレスは、スタックポ
インタの値より小さいため、比較器4により無効なデー
タアクセスであることを検出することができる。
When a temporary variable area is secured on the stack from the state shown in FIG. 2A, the state shown in FIG. 2B is obtained. At this time, since the temporary variable area is equal to or larger than the stack pointer value, the access is successful. When the temporary variable area is released, the state shown in FIG. At this time, when the data is accessed to the area of the temporary variable that has been released and does not already exist, the address is smaller than the value of the stack pointer, so the comparator 4 detects that the data access is invalid. can do.

【0012】[0012]

【発明の効果】以上説明したように本発明は、スタック
ポインタの値とデータアクセスのアドレスを比較するこ
とにより、解放された一時変数へのアクセスというプロ
グラムの誤りを検出することができるという効果を有す
る。
As described above, according to the present invention, by comparing the value of the stack pointer and the address of the data access, it is possible to detect the error of the program of accessing the released temporary variable. Have.

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

【図1】本発明のマイクロプロセッサの一実施例を示す
ブロック図である。
FIG. 1 is a block diagram showing an embodiment of a microprocessor of the present invention.

【図2】本実施例の動作概念図である。FIG. 2 is an operation conceptual diagram of the present embodiment.

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

1 レジスタ群 2 実行ユニット 3 アドレスユニット 4 比較器 5 スタックポインタ 1 register group 2 execution unit 3 address unit 4 comparator 5 stack pointer

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】スタックポインタを含むレジスタ群と例外
通知信号を受付可能な実行ユニットと、 データアクセスアドレスを生成するアドレスユニット
と、 スタックポインタの値とアドレスユニットの生成したデ
ータアクセスアドレスを比較して実行ユニットに結果を
渡す比較器とを備えることを特徴とするマイクロプロセ
ッサ。
1. A register group including a stack pointer, an execution unit capable of receiving an exception notification signal, an address unit for generating a data access address, a stack pointer value and a data access address generated by the address unit are compared. And a comparator for passing a result to an execution unit.
【請求項2】プログラムでアクセスする全てのデータが
常にスタックポインタの値より上位アドレス側となるよ
うにプログラミングし、前記比較器が、スタックポイン
タの値より下位側のデータアクセスを全て誤りとみなす
結果を前記実行ユニットに渡すことを特徴とする請求項
1記載のマイクロプロセッサ。
2. A result of programming such that all data accessed by a program are always on the upper address side of the stack pointer value, and the comparator regards all data access on the lower side of the stack pointer value as an error. Is passed to the execution unit.
【請求項3】スタック上に一時変数の領域をスタックポ
インタの値以上となるように確保し、一時変数の領域を
解放したときに、前記比較器が、すでに存在しない一時
変数の領域に対するデータアクセスを全て誤りとみなす
結果を前記実行ユニットに渡すことを特徴とする請求項
2記載のマイクロプロセッサ。
3. A data access to an area of a temporary variable which does not already exist when the area of the temporary variable is secured on the stack so as to be equal to or larger than the value of the stack pointer and the area of the temporary variable is released. 3. The microprocessor according to claim 2, wherein a result which regards all as an error is passed to the execution unit.
JP6136778A 1994-06-20 1994-06-20 Microprocessor Pending JPH086821A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6136778A JPH086821A (en) 1994-06-20 1994-06-20 Microprocessor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6136778A JPH086821A (en) 1994-06-20 1994-06-20 Microprocessor

Publications (1)

Publication Number Publication Date
JPH086821A true JPH086821A (en) 1996-01-12

Family

ID=15183303

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6136778A Pending JPH086821A (en) 1994-06-20 1994-06-20 Microprocessor

Country Status (1)

Country Link
JP (1) JPH086821A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS61148538A (en) * 1984-12-24 1986-07-07 Canon Inc Operation processor
JPH0375833A (en) * 1989-08-17 1991-03-29 Matsushita Electric Ind Co Ltd Micro program controller
JPH0484224A (en) * 1990-07-26 1992-03-17 Nec Corp Stack area protection circuit

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS61148538A (en) * 1984-12-24 1986-07-07 Canon Inc Operation processor
JPH0375833A (en) * 1989-08-17 1991-03-29 Matsushita Electric Ind Co Ltd Micro program controller
JPH0484224A (en) * 1990-07-26 1992-03-17 Nec Corp Stack area protection circuit

Similar Documents

Publication Publication Date Title
US5717851A (en) Breakpoint detection circuit in a data processor and method therefor
US5606662A (en) Auto DRAM parity enable/disable mechanism
US6052801A (en) Method and apparatus for providing breakpoints on a selectable address range
JPH086821A (en) Microprocessor
JPH03132829A (en) Parity inspection system
JP3166167B2 (en) Microcomputer
JPS59123055A (en) Instruction processing system
JPH01160547U (en)
JPS5965356A (en) Single-chip microcomputer
JPS5898900A (en) Microprocessor controlling system
JPS63250753A (en) Memory access checking system
JPS61292756A (en) Program debug auxiliary circuit
JPS6075945A (en) Program control type data processor provided with trigger timing function
JPS6270947A (en) Control system for debug interruption
JPH0371236A (en) Error detecting system
JPH01201735A (en) Microprocessor device
JPH07281926A (en) Protection device for information processor
JPH10320269A (en) Method for detecting size of loaded memory
JPH05113903A (en) Address coincidence detecting circuit
JPH0520205A (en) Detecting circuit for memory error address
JPH03158915A (en) Power supply voltage drop detector
JPH04320545A (en) Memory access monitoring system
JPH05158747A (en) Microprogram controller
JPH01196645A (en) Memory device
JPH02144744A (en) Lsi with external memory diagnozing function