[go: up one dir, main page]

JPH11272472A - Microcomputer - Google Patents

Microcomputer

Info

Publication number
JPH11272472A
JPH11272472A JP10078779A JP7877998A JPH11272472A JP H11272472 A JPH11272472 A JP H11272472A JP 10078779 A JP10078779 A JP 10078779A JP 7877998 A JP7877998 A JP 7877998A JP H11272472 A JPH11272472 A JP H11272472A
Authority
JP
Japan
Prior art keywords
flash memory
address area
rewriting
data
signal
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.)
Granted
Application number
JP10078779A
Other languages
Japanese (ja)
Other versions
JP3197865B2 (en
Inventor
Toru Watanabe
徹 渡辺
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.)
Sanyo Electric Co Ltd
Original Assignee
Sanyo Electric 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 Sanyo Electric Co Ltd filed Critical Sanyo Electric Co Ltd
Priority to JP07877998A priority Critical patent/JP3197865B2/en
Priority to TW088104408A priority patent/TW432329B/en
Priority to KR1019990010376A priority patent/KR100341424B1/en
Publication of JPH11272472A publication Critical patent/JPH11272472A/en
Application granted granted Critical
Publication of JP3197865B2 publication Critical patent/JP3197865B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11CSTATIC STORES
    • G11C16/00Erasable programmable read-only memories
    • G11C16/02Erasable programmable read-only memories electrically programmable
    • G11C16/06Auxiliary circuits, e.g. for writing into memory
    • G11C16/22Safety or protection circuits preventing unauthorised or accidental access to memory cells

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Storage Device Security (AREA)
  • Microcomputers (AREA)
  • Stored Programmes (AREA)

Abstract

PROBLEM TO BE SOLVED: To permit the rewriting of the program instruction of the first storage area of a flash memory according to the rewriting instruction of the second storage area of the flash memory only when protected data are correct. SOLUTION: At the time of rewriting the program instruction of an address area A of a flash memory 9 according to the decoded result of the rewriting instruction of an address area B of the flash memory 9, an on-board signal OB is always turned into a logical value '1'. Therefore, when protected data are not used, a protected data identifying circuit 16 outputs a logical value '0', and a page buffer 14 stores 128 word program data, and a control signal WRT is risen so that the flash memory 9 can be turned into a writing inhibiting state. Therefore, only when the protected data are correct, the flash memory 9 can be turned into the writing allowable state.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、データの一括又は
部分的な電気消去及びデータの書き込み読み出しが可能
な特性を有する不揮発性メモリ(フラッシュメモリ)を
内蔵したマイクロコンピュータに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer having a built-in non-volatile memory (flash memory) having characteristics capable of collectively or partially erasing data and writing / reading data.

【0002】[0002]

【従来の技術】図9はフラッシュメモリ装置を示すブロ
ック図であり、マイクロコンピュータに内蔵され機能す
るものである。図9において、(1)はフラッシュメモ
リであり、データを一括又は部分的(例えばページ(1
28ワード)単位)で電気消去でき且つデータを繰り返
し書き込み及び読み出しできる不揮発性の特性を有す
る。フラッシュメモリ(1)はマイクロコンピュータの
プログラムメモリとして機能し、アドレス領域Aの内部
セルには各種論理演算を実行させる為のプログラム命令
が格納され、アドレス領域Bの内部セルにはアドレス領
域Aのプログラム命令を書き換える為の書き換え命令が
格納されている。フラッシュメモリ(1)は、通常はア
ドレス領域Aが指定され、アドレス領域Aのプログラム
内容を書き換える為の割り込み要求が発生した時のみア
ドレス領域Bが指定される様にアドレス領域Aからジャ
ンプする。マイクロコンピュータは、フラッシュメモリ
(1)のアドレス領域Aから読み出されたプログラム命
令の解読結果に従って各種論理演算動作を実行し、一
方、フラッシュメモリ(1)のアドレス領域Bから読み
出された書き換え命令の解読結果に従って、アドレス領
域Aの内容の書き換え動作を実行する。尚、フラッシュ
メモリ(1)のアドレス領域Aの書き換えデータは、マ
イクロコンピュータの内部に事前準備する方法(マスク
ROMを別途設けてテーブルデータとして格納する方法
等)、又は、マイクロコンピュータの外部から供給する
方法(PROMライタから供給する方法等)の何れでも
良い。
2. Description of the Related Art FIG. 9 is a block diagram showing a flash memory device, which is built in a microcomputer and functions. In FIG. 9, reference numeral (1) denotes a flash memory, which collectively or partially stores data (for example, page (1)
28 words), and has a nonvolatile property of repeatedly writing and reading data. The flash memory (1) functions as a program memory of the microcomputer. The internal cells of the address area A store program instructions for executing various logical operations, and the internal cells of the address area B store the program of the address area A. A rewrite instruction for rewriting the instruction is stored. The flash memory (1) normally jumps from the address area A so that the address area A is designated and the address area B is designated only when an interrupt request for rewriting the program contents of the address area A is generated. The microcomputer executes various logical operations in accordance with the result of decoding the program instruction read from the address area A of the flash memory (1), while the microcomputer executes the rewrite instruction read from the address area B of the flash memory (1). The rewriting operation of the contents of the address area A is executed in accordance with the result of decryption. The rewrite data in the address area A of the flash memory (1) is prepared in advance in the microcomputer (eg, a mask ROM is separately provided and stored as table data) or supplied from outside the microcomputer. Any method (such as a method of supplying from a PROM writer) may be used.

【0003】(2)はアドレスデコーダであり、フラッ
シュメモリ(1)をアドレス指定する為のアドレスデー
タを解読するものである。(3)は検出回路であり、フ
ラッシュメモリ(1)のアドレス領域Aのプログラム命
令が使用者の意思に反して誤って書き換えられる不都合
を防止するものである。詳しくは、検出回路(3)は、
複数のレジスタ(4)及びデコーダ(5)を含む。複数
のレジスタ(4)は、フラッシュメモリ(2)のアドレ
ス領域Aのプログラム命令(ページ単位)を書き換えよ
うとする前段階で、使用者が予め用意した保護データ
(AAH、55H等)を格納するものである。デコーダ
(5)は、複数のレジスタ(4)の値が使用者の意図す
る値であるかどうかを解読し、複数のレジスタ(4)の
全ての値が正しい場合はフラッシュメモリ(1)の書き
換え動作を許可し、複数のレジスタ(4)の値が1つで
も誤っている場合はフラッシュメモリ(1)の書き換え
動作を禁止する様な論理構造となっている。(6)はペ
ージバッファ(スタティックRAM等の揮発性メモリ)
であり、フラッシュメモリ(1)のアドレス領域Aのプ
ログラム命令を1ページ単位で書き換える為の128ワ
ードの記憶容量を有する。ページバッファ(6)は、自
らをアドレス指定する為のインクリメント機能を有す
る。書き換えデータは、ページバッファ(6)に一旦格
納された後、フラッシュメモリ(1)のアドレス領域A
の指定ページに書き込まれる。
An address decoder (2) decodes address data for addressing the flash memory (1). Reference numeral (3) denotes a detection circuit for preventing a problem that the program instruction in the address area A of the flash memory (1) is erroneously rewritten against the user's intention. Specifically, the detection circuit (3)
It includes a plurality of registers (4) and a decoder (5). The plurality of registers (4) store protection data (AAH, 55H, etc.) prepared in advance by the user before rewriting the program instruction (in page units) of the address area A of the flash memory (2). Things. The decoder (5) decodes whether the values of the plurality of registers (4) are values intended by the user, and rewrites the flash memory (1) if all the values of the plurality of registers (4) are correct. The logic structure is such that the operation is permitted, and the rewriting operation of the flash memory (1) is prohibited if at least one of the values of the plurality of registers (4) is incorrect. (6) is a page buffer (volatile memory such as static RAM)
And has a storage capacity of 128 words for rewriting the program instruction in the address area A of the flash memory (1) in units of one page. The page buffer (6) has an increment function for addressing itself. The rewrite data is temporarily stored in the page buffer (6), and then stored in the address area A of the flash memory (1).
Is written to the specified page.

【0004】[0004]

【発明が解決しようとする課題】フラッシュメモリ
(1)のアドレス領域Aのプログラム命令の書き換え方
法は、PROMライタを用いる外部制御方法、フラッシ
ュメモリ(1)のアドレス領域Bの書き換え命令を用い
る内部制御方法が考えられる。ここで、フラッシュメモ
リ(1)は、アドレス領域A及びアドレス領域Bの内部
セルの他、保護データの要否を判別する為の保護用セル
(7)を有している。保護用セル(7)は1ビットで良
い。検出回路(3)は保護用セル(7)の値に応じて制
御される。即ち、検出回路(3)は、保護用セル(7)
の内容が論理値「0」(リセット状態)の時、保護デー
タの存在の有無に関わらず、フラッシュメモリ(1)の
アドレス領域Aの書き換え動作を許可する為の信号を出
力する。一方、検出回路(3)は、保護用セル(7)の
内容が論理値「1」(セット状態)の時、保護データが
存在しない場合はフラッシュメモリ(1)のアドレス領
域Aの書き換え動作を禁止し、保護データが存在し且つ
正しい場合のみフラッシュメモリ(1)のアドレス領域
Aの書き換え動作を許可する。
A method for rewriting a program instruction in the address area A of the flash memory (1) includes an external control method using a PROM writer and an internal control method using a rewrite instruction for the address area B in the flash memory (1). A method is conceivable. Here, the flash memory (1) has, in addition to the internal cells in the address area A and the address area B, a protection cell (7) for determining whether protection data is necessary. The protection cell (7) may be 1 bit. The detection circuit (3) is controlled according to the value of the protection cell (7). That is, the detection circuit (3) includes the protection cell (7)
Is a logical value "0" (reset state), a signal for permitting the rewriting operation of the address area A of the flash memory (1) is output regardless of the presence or absence of the protection data. On the other hand, when the content of the protection cell (7) is a logical value "1" (set state) and the protection data does not exist, the detection circuit (3) performs the rewriting operation of the address area A of the flash memory (1). Forbidden, and only when the protected data exists and is correct, the rewriting operation of the address area A of the flash memory (1) is permitted.

【0005】前者のPROMライタを用いる外部制御方
法の場合、マイクロコンピュータの動作を停止させた状
態で、保護用セル(7)に論理値「0」又は論理値
「1」を格納し、保護データの要否を選択できる様にな
っている。例えば、PROMライタは固定の保護データ
を予め用意しており、PROMライタが異なる2つのマ
イクロコンピュータに対して前記保護データを供給する
と、何れか一方のマイクロコンピュータしか前記保護デ
ータを認識できない場合がある。そこで、PROMライ
タ及び各種マイクロコンピュータ間で常に互換性を持た
せたい場合は、保護用セル(7)に論理値「0」を記憶
させれば良い。これより、検出回路(3)は、保護デー
タの存在及び状態に関わらず、フラッシュメモリ(1)
のアドレス領域Aの書き換え動作を許可する。即ち、前
記互換性が保護データの要否を選択できる様にした主要
因である。PROMライタは、フラッシュメモリ(1)
のアドレス領域Aの内、書き換え対象となる128ワー
ドのプログラム命令をページバッファ(6)に供給し、
その後、フラッシュメモリ(1)のアドレス領域Aの書
き換え対象となっているページ単位のアドレスデータを
アドレスデコーダ(2)に順次供給する。従って、フラ
ッシュメモリ(1)のアドレス領域Aの指定ページにペ
ージバッファ(6)の内容が書き込まれ、書き換え動作
が終了する。
In the case of the former external control method using a PROM writer, a logic value "0" or a logic value "1" is stored in a protection cell (7) while the operation of the microcomputer is stopped, and the protection data is stored. Can be selected. For example, a PROM writer prepares fixed protection data in advance, and if the PROM writer supplies the protection data to two different microcomputers, only one of the microcomputers may recognize the protection data. . Therefore, when it is desired to always maintain compatibility between the PROM writer and the various microcomputers, the logic value "0" may be stored in the protection cell (7). As a result, the detection circuit (3) operates the flash memory (1) regardless of the existence and state of the protection data.
Rewriting operation of the address area A is permitted. That is, the compatibility is the main factor that enables the selection of the necessity of protected data. PROM writer is a flash memory (1)
Of the address area A, the program instruction of 128 words to be rewritten is supplied to the page buffer (6),
After that, the address data of the page unit to be rewritten in the address area A of the flash memory (1) is sequentially supplied to the address decoder (2). Therefore, the contents of the page buffer (6) are written to the designated page in the address area A of the flash memory (1), and the rewrite operation ends.

【0006】後者のフラッシュメモリ(1)のアドレス
領域Bの書き換え命令を用いる内部制御方法の場合、従
来は保護用セル(7)の内容を制御できなかった。詳し
くは、フラッシュメモリ(1)のアドレス領域Aの書き
換えは、保護用セル(7)の初期状態(通常はリセット
状態)又はPROMライタを用いて外部制御を行った後
の保護用セル(7)の状態の何れか一方に依存してい
た。後者の内部制御方法の場合、他のマイクロコンピュ
ータと互換性を持つ必要が無い為、誤書き込み防止用の
保護データを使用することが好ましい。しかし、使用者
の意思に反して、保護用セル(7)に論理値「0」が記
憶されていると、書き換え命令の解読結果に従い書き換
え動作を実行する際、プログラム処理の暴走に伴い保護
データが誤った状態でレジスタ(4)にセットされた場
合でも、アドレス領域Aのプログラム命令の書き換えを
実行してしまい、これより、アドレス領域Aのプログラ
ム命令を正しく書き換えできなくなる問題があった。
In the case of the latter internal control method using a rewrite instruction of the address area B of the flash memory (1), it has not been possible to control the contents of the protection cell (7) conventionally. Specifically, the address area A of the flash memory (1) is rewritten in the initial state (normally the reset state) of the protection cell (7) or in the protection cell (7) after external control using a PROM writer. Depending on one of the states. In the case of the latter internal control method, it is not necessary to have compatibility with other microcomputers, so it is preferable to use protected data for preventing erroneous writing. However, if the logic value "0" is stored in the protection cell (7) contrary to the user's intention, when the rewriting operation is executed in accordance with the result of decoding the rewriting instruction, the protection data is run out due to the runaway of the program processing. Is set in the register (4) in an erroneous state, the program instruction in the address area A is rewritten. As a result, the program instruction in the address area A cannot be correctly rewritten.

【0007】そこで、本発明は、不揮発性メモリの第2
記憶領域の書き換え命令を用いて第1記憶領域のプログ
ラム命令を書き換える際、保護データが正しい場合のみ
書き換え動作を許可できる様にすることを目的とする。
Therefore, the present invention relates to a second nonvolatile memory.
An object of the present invention is to allow a rewrite operation to be permitted only when protected data is correct when rewriting a program instruction in a first storage area using a rewrite instruction for a storage area.

【0008】[0008]

【課題を解決するための手段】本発明は、前記問題点を
解決する為に成されたものであり、データを一括又は部
分的に電気消去でき且つデータを書き込み及び読み出し
できる特性を有し、第1記憶領域に各種論理演算を実行
させる為のプログラム命令が格納され、第2記憶領域に
前記第1記憶領域の内容を書き換える為の書き換え命令
が格納された不揮発性メモリ、前記不揮発性メモリの第
1記憶領域の誤書き換えを防止する為の保護データがセ
ットされるレジスタ、前記レジスタの値を解読し解読結
果に応じて前記不揮発性メモリの第1記憶領域の書き換
えを許可又は禁止するデコーダ、を有するマイクロコン
ピュータにおいて、前記不揮発性メモリの第2記憶領域
の書き換え命令を用いて第1記憶領域のプログラム命令
を書き換える時、前記レジスタに正しい保護データがセ
ットされた場合のみ、前記不揮発性メモリの第1記憶領
域の書き換えを許可する手段を設けたことを特徴とす
る。
SUMMARY OF THE INVENTION The present invention has been made to solve the above problems, and has a characteristic that data can be collectively or partially electrically erased and data can be written and read. A nonvolatile memory in which program instructions for executing various logical operations are stored in a first storage area, and a rewrite instruction for rewriting the contents of the first storage area are stored in a second storage area; A register in which protection data for preventing erroneous rewriting of the first storage area is set, a decoder for decoding a value of the register and permitting or prohibiting rewriting of the first storage area of the nonvolatile memory according to a result of the decoding; When rewriting a program instruction in a first storage area using a rewrite instruction in a second storage area of the nonvolatile memory, If the correct protection data to serial register is set only, characterized in that a means for permitting a rewriting of the first storage area of the nonvolatile memory.

【0009】[0009]

【発明の実施の形態】本発明の詳細を図面に従って具体
的に説明する。図1は本発明のマイクロコンピュータを
示す回路ブロック図である。図1において、(8)はク
ロックジェネレータであり、発振回路(水晶、セラミッ
ク等の発振振動子を設けた自走発振又は他走発振の何れ
でも良い)の発振クロックが供給され、発振クロックに
分周等の論理処理を施して各種論理演算を実行する為の
システムクロックを発生するものである。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS The details of the present invention will be specifically described with reference to the drawings. FIG. 1 is a circuit block diagram showing a microcomputer of the present invention. In FIG. 1, reference numeral (8) denotes a clock generator to which an oscillation clock of an oscillation circuit (which may be either free-running oscillation provided with an oscillator such as crystal or ceramic or other free-running oscillation) is supplied. It is to generate a system clock for performing various logical operations by performing logical processing such as a round.

【0010】(9)はフラッシュメモリ(不揮発性メモ
リ)であり、データを一括又は部分的(例えばページ
(128ワード)単位)で電気消去でき且つデータを繰
り返し書き込み及び読み出しできる不揮発性の特性を有
する。フラッシュメモリ(9)はマイクロコンピュータ
のプログラムメモリとして機能し、アドレス領域Aの内
部セルには各種論理演算を実行させる為のプログラム命
令が格納され、アドレス領域Bの内部セルにはアドレス
領域Aのプログラム命令を書き換える為の書き換え命令
が格納されている。フラッシュメモリ(9)は、通常は
アドレス領域Aが指定され、アドレス領域Aのプログラ
ム内容を書き換える為の割り込み要求が発生した時のみ
アドレス領域Bが指定される様にアドレス領域Aからジ
ャンプする。マイクロコンピュータは、フラッシュメモ
リ(9)のアドレス領域Aから読み出されたプログラム
命令の解読結果に従って各種論理演算動作を実行し、一
方、フラッシュメモリ(9)のアドレス領域Bから読み
出された書き換え命令の解読結果に従って、アドレス領
域Aの内容の書き換え動作を実行する。尚、フラッシュ
メモリ(9)のアドレス領域Aの書き換えデータは、マ
イクロコンピュータの内部に事前準備する方法(マスク
ROMを別途設けてテーブルデータとして格納する方法
等)、又は、マイクロコンピュータの外部から供給する
方法(PROMライタから供給する方法等)の何れでも
良い。
A flash memory (non-volatile memory) (9) has a non-volatile characteristic in which data can be electrically erased collectively or partially (for example, in units of pages (128 words)) and data can be repeatedly written and read. . The flash memory (9) functions as a program memory of the microcomputer. The internal cells of the address area A store program instructions for executing various logical operations, and the internal cells of the address area B store the program of the address area A. A rewrite instruction for rewriting the instruction is stored. The flash memory (9) normally jumps from the address area A so that the address area A is designated and the address area B is designated only when an interrupt request for rewriting the program content of the address area A is generated. The microcomputer executes various logical operation operations according to the result of decoding the program instruction read from the address area A of the flash memory (9), and on the other hand, the rewrite instruction read from the address area B of the flash memory (9). The rewriting operation of the contents of the address area A is executed in accordance with the result of decryption. The rewrite data in the address area A of the flash memory (9) is prepared in advance in the microcomputer (eg, a mask ROM is separately provided and stored as table data) or supplied from outside the microcomputer. Any method (such as a method of supplying from a PROM writer) may be used.

【0011】フラッシュメモリ(9)は、データ記憶用
内部セルの他に、以下の周辺回路を含む。(10)はア
ドレスデコーダであり、フラッシュメモリ(9)をアド
レス指定する為のアドレスデータ(mビット)を解読す
るものである。(11)は検出回路であり、フラッシュ
メモリ(9)のアドレス領域Aのプログラム命令が使用
者の意思に反して誤って書き換えられる不都合を防止す
るものである。詳しくは、検出回路(11)は、複数の
レジスタ(12)及びデコーダ(13)を含む。複数の
レジスタ(12)は、フラッシュメモリ(9)のアドレ
ス領域Aのプログラム命令(ページ単位)を書き換えよ
うとする前段階で、使用者が予め用意した保護データ
(AAH、55H等)を格納するものである。デコーダ
(13)は、複数のレジスタ(12)の値が使用者の意
図する値であるかどうかを解読し、複数のレジスタ(1
2)の全ての値が正しい場合はフラッシュメモリ(9)
の書き換え動作を許可し、複数のレジスタ(12)の値
が1つでも誤っている場合はフラッシュメモリ(9)の
書き換え動作を禁止する様な論理構造となっている。
(14)はページバッファ(スタティックRAM等の揮
発性メモリ)であり、フラッシュメモリ(9)のアドレ
ス領域Aのプログラム命令を1ページ単位で書き換える
為の128ワードの記憶容量を有する。ページバッファ
(14)は、自らをアドレス指定する為のインクリメン
ト機能を有する。書き換えデータは、ページバッファ
(14)に一旦格納された後、フラッシュメモリ(9)
のアドレス領域Aの指定ページに書き込まれる。
The flash memory (9) includes the following peripheral circuits in addition to the data storage internal cells. An address decoder (10) decodes address data (m bits) for addressing the flash memory (9). (11) is a detection circuit for preventing a problem that the program instruction in the address area A of the flash memory (9) is erroneously rewritten against the user's intention. Specifically, the detection circuit (11) includes a plurality of registers (12) and a decoder (13). The plurality of registers (12) store protection data (AAH, 55H, etc.) prepared in advance by the user before rewriting the program instruction (in page units) of the address area A of the flash memory (9). Things. The decoder (13) decodes whether the value of the plurality of registers (12) is a value intended by the user, and decodes the plurality of registers (1).
If all values of 2) are correct, flash memory (9)
The rewriting operation of the flash memory (9) is prohibited, and the rewriting operation of the flash memory (9) is prohibited if at least one of the values of the plurality of registers (12) is incorrect.
Reference numeral (14) denotes a page buffer (volatile memory such as a static RAM), which has a storage capacity of 128 words for rewriting a program instruction in the address area A of the flash memory (9) in units of one page. The page buffer (14) has an increment function for addressing itself. The rewrite data is temporarily stored in the page buffer (14) and then stored in the flash memory (9).
Is written to the designated page in the address area A of the first address.

【0012】(15)は保護用セルであり、PROMラ
イタを用いてアドレス領域Aのプログラム命令を書き換
える時、PROMライタの制御指示に従って論理値
「0」又は論理値「1」が記憶されるものである。保護
用セル(15)が論理値「0」(リセット状態)の時、
検出回路(11)はアドレス領域Aに対する誤書き込み
防止用の保護データの有無に関わらず、フラッシュメモ
リ(9)を書き換え許可状態とする。一方、保護用セル
(15)が論理値「1」(セット状態)の時、検出回路
(11)は保護データが存在し且つ正しい場合のみ、フ
ラッシュメモリ(9)を書き換え許可状態とする。
Reference numeral (15) denotes a protection cell which stores a logical value "0" or a logical value "1" in accordance with a control instruction of the PROM writer when rewriting the program instruction of the address area A using the PROM writer. It is. When the protection cell (15) has a logical value “0” (reset state),
The detection circuit (11) sets the flash memory (9) to a rewrite permission state regardless of the presence or absence of protection data for preventing erroneous writing to the address area A. On the other hand, when the protection cell (15) has the logical value "1" (set state), the detection circuit (11) sets the flash memory (9) to the rewrite permission state only when the protection data exists and is correct.

【0013】(16)は保護データ識別回路であり、複
数のレジスタ(12)に保護データがセットされた時、
論理値「1」を出力するものである。ここで、後述のC
PUは、フラッシュメモリ(9)のアドレス領域Bの書
き換え命令を用いてアドレス領域Aのプログラム命令を
書き換える時、論理値「1」のオンボード信号OBを出
力する。保護用セル(15)の値及びオンボード信号O
BはNORゲート(17)に供給される。即ち、保護用
セル(15)の値が論理値「0」の時、NORゲート
(17)の出力はオンボード信号OBの値に応じて変化
する。更に、保護データ識別回路(16)の値及びNO
Rゲート(17)の出力論理値はNORゲート(18)
に供給される。即ち、保護用セル(15)の値又はオン
ボード信号OBが論理値「1」の時、NORゲート(1
8)の出力は保護データ識別回路(16)の値に応じて
変化する。D型フリップフロップ(19)は、複数のレ
ジスタ(12)の値の解読結果に従いフラッシュメモリ
(9)が書き込み動作許可状態となった後、ページバッ
ファ(14)が1ページ単位のプログラム命令を格納し
た直後に発生するクロックCLK2に同期して、NOR
ゲート(19)の出力論理値を保持するものである。
(16) is a protection data identification circuit, and when protection data is set in a plurality of registers (12),
It outputs a logical value "1". Here, C
The PU outputs an on-board signal OB having a logical value "1" when rewriting the program instruction in the address area A using the rewrite instruction in the address area B of the flash memory (9). Protection cell (15) value and on-board signal O
B is supplied to a NOR gate (17). That is, when the value of the protection cell (15) is a logical value "0", the output of the NOR gate (17) changes according to the value of the on-board signal OB. Further, the value of the protected data identification circuit (16) and the NO
The output logic value of the R gate (17) is the NOR gate (18)
Supplied to That is, when the value of the protection cell (15) or the on-board signal OB is a logical value "1", the NOR gate (1
The output of 8) changes according to the value of the protection data identification circuit (16). In the D-type flip-flop (19), the page buffer (14) stores the program instruction of one page unit after the flash memory (9) is in a write operation enabled state according to the result of decoding the values of the plurality of registers (12). In synchronization with the clock CLK2 generated immediately after
This holds the output logic value of the gate (19).

【0014】(20)は制御回路であり、フラッシュメ
モリ(9)のアドレス領域Aのプログラム命令の解読結
果に従って動作し、フラッシュメモリ(9)に対し、動
作許可信号*CE、書き込み許可信号*WE、読み出し
許可信号*OE、書き込み禁止信号WI、書き込み終了
信号EOWを供給するものである。(21)は識別回路
であり、動作許可信号*CE及び書き込み許可信号*W
Eの立ち下がりに同期して論理値「1」を出力するもの
である。D型フリップフロップ(19)の出力論理値、
書き込み禁止信号WI、書き込み終了信号EOWはOR
ゲート(22)に供給される。(25)はNORゲート
(23)(24)から成るRS型フリップフロップであ
り、識別回路(21)の出力論理値がNORゲート(2
3)の一方の入力端子(セット端子)に供給され、OR
ゲート(22)の出力論理値がNORゲート(24)の
一方の入力端子(リセット端子)に供給され、フラッシ
ュメモリ(9)のアドレス領域Aの内部セルを書き込み
可能状態とする為の制御信号WRTを出力するものであ
る。詳しくは、制御信号WRTは、識別回路(21)の
値が論理値「1」となった時に立ち上がり、D型フリッ
プフロップ(19)の値、書き込み禁止信号WI、書き
込み終了信号EOWの何れか1つが論理値「1」となっ
た時に立ち下がる。制御信号WRTはハイアクティブと
する。尚、図2は動作許可信号*CE、書き込み許可信
号*WE、読み出し許可信号*OE、書き込み禁止信号
WIの相対関係を示すタイムチャートである。書き込み
禁止信号WIは、フラッシュメモリ(9)のアドレス領
域Bの書き換え命令の解読結果に従って、動作許可信号
*CE及び書き込み許可信号*WEがローレベルに変化
から一定時間後に発生する。詳しくは、書き込み禁止信
号WIは、動作許可信号*CE及び書き込み許可信号*
WEがハイレベルに変化した直後から動作許可信号*C
E及び読み出し許可信号*OEがローレベルに変化する
迄の記間で発生する。
A control circuit (20) operates in accordance with the result of decoding the program instruction in the address area A of the flash memory (9), and supplies an operation enable signal * CE and a write enable signal * WE to the flash memory (9). , A read enable signal * OE, a write inhibit signal WI, and a write end signal EOW. (21) is an identification circuit, which includes an operation permission signal * CE and a write permission signal * W
The logic value "1" is output in synchronization with the fall of E. An output logical value of the D-type flip-flop (19),
The write inhibit signal WI and the write end signal EOW are OR
It is supplied to a gate (22). (25) is an RS-type flip-flop composed of NOR gates (23) and (24), and the output logic value of the identification circuit (21) is NOR gate (2).
3) supplied to one input terminal (set terminal)
The output logical value of the gate (22) is supplied to one input terminal (reset terminal) of the NOR gate (24), and the control signal WRT for enabling the internal cell in the address area A of the flash memory (9) to be in a writable state. Is output. More specifically, the control signal WRT rises when the value of the identification circuit (21) becomes a logical value "1", and is one of the value of the D-type flip-flop (19), the write inhibit signal WI, and the write end signal EOW. One falls when the logical value becomes “1”. The control signal WRT is set to high active. FIG. 2 is a time chart showing the relative relationship among the operation permission signal * CE, the write permission signal * WE, the read permission signal * OE, and the write prohibition signal WI. The write inhibit signal WI is generated after a lapse of a predetermined time from the change of the operation enable signal * CE and the write enable signal * WE to the low level in accordance with the result of decoding the rewrite instruction of the address area B of the flash memory (9). Specifically, the write inhibit signal WI includes an operation enable signal * CE and a write enable signal *
Immediately after WE changes to high level, the operation permission signal * C
This occurs between the time when E and the read enable signal * OE change to low level.

【0015】制御回路(20)はフラグ(26)を含
む。フラグ(26)は、制御信号WRTの状態に関わら
ずフラッシュメモリ(9)を強制的に書き込み可能状態
に設定する為の強制設定信号PLが、フラッシュメモリ
(9)のアドレス領域Bの書き換え命令の解読結果に従
って設定されるものである。フラグ(26)は、ページ
バッファ(14)からアドレス領域Aへの書き込みが終
了した時点の制御信号WRTの立ち下がりWRTDOW
Nに応じてリセットされる。制御信号WRT及び強制設
定信号PLはORゲート(27)を介して検出回路(1
1)のリセット端子に供給され、複数のレジスタ(5)
の値はORゲート(27)の出力がローレベルに変化し
た時にリセットされる。強制設定信号PLの作用効果と
して、制御信号WRTが立ち下がっても複数のレジスタ
(12)の値がリセットされない為、検出回路(11)
は保護データの正誤を確実に検出できる。
The control circuit (20) includes a flag (26). The flag (26) is set so that the forcible setting signal PL for forcibly setting the flash memory (9) to the writable state regardless of the state of the control signal WRT corresponds to the instruction for rewriting the address area B of the flash memory (9). This is set according to the decoding result. The flag (26) indicates the falling WRTDOWN of the control signal WRT at the time when writing from the page buffer (14) to the address area A is completed.
It is reset according to N. The control signal WRT and the forcible setting signal PL are supplied to the detection circuit (1) via the OR gate (27).
A plurality of registers (5) supplied to the reset terminal of (1)
Is reset when the output of the OR gate (27) changes to a low level. As an effect of the forced setting signal PL, since the values of the plurality of registers (12) are not reset even when the control signal WRT falls, the detection circuit (11)
Can reliably detect whether the protected data is correct or not.

【0016】(28)はCPUであり、フラッシュメモ
リ(9)のアドレス領域A、Bから読み出された命令の
解読結果に従って各種論理演算動作を実行するものであ
り、ALU、ACC、各種レジスタ等を含む。(29)
はプログラムカウンタであり、フラッシュメモリ(9)
をアドレス指定する為のアドレスデータ(mビット)を
発生するものである。プログラムカウンタ(29)は、
フラッシュメモリ(9)から命令を読み出す時に使用す
る。(30)はm個のラッチ回路であり、フラッシュメ
モリ(9)のアドレス領域Bから読み出された書き換え
命令の解読結果に従って、CPU(28)が発生するア
ドレス領域Aの一部領域を指定する為のアドレスデータ
(mビット)をクロックCK0に同期してラッチするも
のである。同様に、(31)はn個のラッチ回路であ
り、フラッシュメモリ(9)のアドレス領域Aの書き換
え用の新規プログラムデータ(nビット)をクロックC
K1に同期してラッチするものである。ラッチ回路(3
0)(31)は、フラッシュメモリ(9)のアドレス領
域Aのプログラム命令を書き換える時に使用する。AN
Dゲート(32)(33)及びORゲート(34)から
成る切換回路は、プログラムカウンタ(29)又はラッ
チ回路(30)の何れか一方のアドレスデータをフラッ
シュメモリ(9)に切換出力するものである。(35)
は選択回路であり、前記切換回路にアドレスデータの切
り換えを指示する為の選択信号SELECTを供給する
ものである。即ち、選択信号SELECTは、プログラ
ムカウンタ(29)の値をフラッシュメモリ(9)に供
給する時にハイレベルとなり、ラッチ回路(30)の値
をフラッシュメモリ(9)に供給する時にローレベルと
なる。前記切換回路から切換出力されるアドレスデータ
は、フラッシュメモリ(9)をアドレス指定する為にア
ドレスデコーダ(10)に供給され且つ複数のレジスタ
(12)を選択する為に検出回路(11)にも供給され
るが、アドレスデコーダ(10)及び検出回路(11)
の同時動作はあり得ない為、何ら問題ない。ラッチ回路
(31)から出力されるプログラムデータは複数のレジ
スタ(12)及びページバッファ(14)に供給され
る。
Reference numeral (28) denotes a CPU which executes various logical operation operations in accordance with the result of decoding the instructions read from the address areas A and B of the flash memory (9), and includes ALU, ACC, various registers and the like. including. (29)
Is a program counter, and a flash memory (9)
To generate address data (m bits) for specifying the address. The program counter (29)
Used when reading an instruction from the flash memory (9). Reference numeral (30) denotes m latch circuits, which designate a partial area of the address area A generated by the CPU (28) according to the result of decoding the rewrite instruction read from the address area B of the flash memory (9). Address data (m bits) is latched in synchronization with the clock CK0. Similarly, (31) is an n number of latch circuits, and new program data (n bits) for rewriting the address area A of the flash memory (9) is clocked by the clock C.
It latches in synchronization with K1. Latch circuit (3
0) and (31) are used when rewriting the program instruction in the address area A of the flash memory (9). AN
The switching circuit including the D gates (32) and (33) and the OR gate (34) switches and outputs one of the address data of the program counter (29) and the latch circuit (30) to the flash memory (9). is there. (35)
Is a selection circuit for supplying a selection signal SELECT for instructing the switching circuit to switch address data. That is, the selection signal SELECT goes high when the value of the program counter (29) is supplied to the flash memory (9), and goes low when the value of the latch circuit (30) is supplied to the flash memory (9). Address data switched and output from the switching circuit is supplied to an address decoder (10) for addressing the flash memory (9), and is also supplied to a detection circuit (11) for selecting a plurality of registers (12). Supplied, the address decoder (10) and the detection circuit (11)
There is no problem because the simultaneous operation cannot be performed. Program data output from the latch circuit (31) is supplied to a plurality of registers (12) and a page buffer (14).

【0017】CPU(28)は、フラッシュメモリ
(9)のアドレス領域Bの書き換え命令を用いてアドレ
ス領域Aのプログラム命令を書き換える時、ハイレベル
のオンボード信号OBを出力し、保護用セル(15)の
値と共にNORゲート(17)に供給する。先ず、PR
OMライタを用いてフラッシュメモリ(9)のアドレス
領域Aのプログラム命令を書き換える場合について説明
する。
When the CPU (28) rewrites the program instruction in the address area A using the rewrite instruction in the address area B of the flash memory (9), it outputs a high-level on-board signal OB and outputs the high-level on-board signal OB. ) Is supplied to the NOR gate (17). First, PR
A case will be described in which the OM writer is used to rewrite the program instruction in the address area A of the flash memory (9).

【0018】図3は、保護用セル(15)をリセット
し、保護データを供給する場合の動作を示すタイムチャ
ートである。マイクロコンピュータの動作を停止させた
状態で、PROMライタからフラッシュメモリ(9)へ
各種信号を供給する。動作許可信号*CE及び書き込み
許可信号*WEが立ち下がると、RS型フリップフロッ
プ(25)のセットに伴い制御信号WRTが立ち上が
り、フラッシュメモリ(9)のアドレス領域Aの内部セ
ルは書き込み可能状態となる。保護データは動作許可信
号*CE及び書き込み許可信号*WEの変化に同期して
レジスタ(12)にセットされる。尚、保護用セル(1
5)の値が論理値「0」の為、保護データ識別回路(1
6)の出力に関わらず、D型フリップフロップ(19)
の入力は論理値「0」である。また、書き込み禁止信号
WIは発生しない。従って、書き込み終了信号EOWが
発生した時、RS型フリップフロップ(25)のリセッ
トに伴い制御信号WRTは立ち下がる。換言すれば、最
初の動作許可信号*CE及び書き込み許可信号*WEが
発生してから書き込み終了信号EOWが発生する迄、制
御信号WRTはハイレベルを継続する。レジスタ(1
2)に対する保護データのセット及びページバッファ
(14)に対する128ワードのプログラムデータの格
納が終了すると、消去信号ERASEが発生し、フラッ
シュメモリ(9)のアドレス領域Aの書き換え対象ペー
ジの内容は消去され、書き込み信号PROGRAMが発
生し、ページバッファ(14)の内容がフラッシュメモ
リ(9)のアドレス領域Aに書き込まれる。ここで、書
き込み信号PROGRAMが立ち上がると、保護用セル
(15)は論理値「1」となる。即ち、今後は、フラッ
シュメモリ(9)のアドレス領域Aの書き換えを実行す
る為には、保護データが必要となる。また、書き込み信
号PROGRAMが立ち下がると、書き込み終了信号E
OWが発生する。即ち、RS型フリップフロップ(2
5)のリセットに伴い制御信号WRTは立ち下がる。
FIG. 3 is a time chart showing the operation when resetting the protection cell (15) and supplying the protection data. While the operation of the microcomputer is stopped, various signals are supplied from the PROM writer to the flash memory (9). When the operation permission signal * CE and the write permission signal * WE fall, the control signal WRT rises in accordance with the setting of the RS flip-flop (25), and the internal cells in the address area A of the flash memory (9) become in a writable state. Become. The protection data is set in the register (12) in synchronization with the change of the operation permission signal * CE and the write permission signal * WE. The protection cell (1
Since the value of 5) is a logical value "0", the protected data identification circuit (1
Regardless of the output of 6), the D-type flip-flop (19)
Is a logical value "0". Further, no write inhibit signal WI is generated. Therefore, when the write end signal EOW is generated, the control signal WRT falls with the reset of the RS flip-flop (25). In other words, the control signal WRT remains at the high level after the first operation enable signal * CE and the write enable signal * WE are generated until the write end signal EOW is generated. Register (1
When the protection data setting for 2) and the storage of the 128-word program data in the page buffer (14) are completed, an erase signal ERASE is generated, and the contents of the page to be rewritten in the address area A of the flash memory (9) are erased. , A write signal PROGRAM is generated, and the contents of the page buffer (14) are written to the address area A of the flash memory (9). Here, when the write signal PROGRAM rises, the protection cell (15) becomes a logical value "1". That is, in order to execute rewriting of the address area A of the flash memory (9) in the future, protection data will be required. When the write signal PROGRAM falls, the write end signal E
OW occurs. That is, the RS flip-flop (2
With the reset of 5), the control signal WRT falls.

【0019】図4は、保護用セル(15)をリセット
し、保護データを供給しない場合の動作を示すタイムチ
ャートである。マイクロコンピュータの動作を停止させ
た状態で、PROMライタからフラッシュメモリ(9)
へ各種信号を供給する。動作許可信号*CE及び書き込
み許可信号*WEが立ち下がると、RS型フリップフロ
ップ(25)のセットに伴い制御信号WRTが立ち上が
り、フラッシュメモリ(9)のアドレス領域Aの内部セ
ルは書き込み可能状態となる。尚、保護用セル(15)
の値が論理値「0」の為、保護データ識別回路(16)
の出力に関わらず、D型フリップフロップ(19)の入
力は論理値「0」である。また、書き込み禁止信号WI
は発生しない。従って、書き込み終了信号EOWが発生
した時、RS型フリップフロップ(25)のリセットに
伴い制御信号WRTは立ち下がる。換言すれば、最初の
動作許可信号*CE及び書き込み許可信号*WEが発生
してから書き込み終了信号EOWが発生する迄、制御信
号WRTはハイレベルを継続する。ページバッファ(1
4)に対する128ワードのプログラムデータの格納が
終了すると、消去信号ERASEが発生し、フラッシュ
メモリ(9)のアドレス領域Aの書き換え対象ページの
内容は消去され、書き込み信号PROGRAMが発生
し、ページバッファ(14)の内容がフラッシュメモリ
(9)のアドレス領域Aに書き込まれる。ここで、保護
用セル(15)の値は論理値「0」のままである。ま
た、書き込み信号PROGRAMが立ち下がると、書き
込み終了信号EOWが発生する。即ち、RS型フリップ
フロップ(25)のリセットに伴い制御信号WRTは立
ち下がる。
FIG. 4 is a time chart showing an operation when the protection cell (15) is reset and protection data is not supplied. With the operation of the microcomputer stopped, the flash memory (9) is read from the PROM writer.
Supply various signals to When the operation permission signal * CE and the write permission signal * WE fall, the control signal WRT rises in accordance with the setting of the RS flip-flop (25), and the internal cells in the address area A of the flash memory (9) become in a writable state. Become. In addition, the protection cell (15)
Is the logical value "0", the protected data identification circuit (16)
, The input of the D-type flip-flop (19) has the logical value "0". Also, the write inhibit signal WI
Does not occur. Therefore, when the write end signal EOW is generated, the control signal WRT falls with the reset of the RS flip-flop (25). In other words, the control signal WRT remains at the high level after the first operation enable signal * CE and the write enable signal * WE are generated until the write end signal EOW is generated. Page buffer (1
When the storage of the 128-word program data for 4) is completed, an erase signal ERASE is generated, the contents of the page to be rewritten in the address area A of the flash memory (9) are erased, a write signal PROGRAM is generated, and the page buffer ( The content of 14) is written to the address area A of the flash memory (9). Here, the value of the protection cell (15) remains at the logical value “0”. When the write signal PROGRAM falls, a write end signal EOW is generated. That is, the control signal WRT falls with the reset of the RS flip-flop (25).

【0020】図5は、保護用セル(15)をセットし、
保護データを供給する場合の動作を示すタイムチャート
である。マイクロコンピュータの動作を停止させた状態
で、PROMライタからフラッシュメモリ(9)へ各種
信号を供給する。動作許可信号*CE及び書き込み許可
信号*WEが立ち下がると、RS型フリップフロップ
(25)のセットに伴い制御信号WRTが立ち上がり、
フラッシュメモリ(9)のアドレス領域Aの内部セルは
書き込み可能状態となる。保護データは動作許可信号*
CE及び書き込み許可信号*WEの変化に同期してレジ
スタ(12)にセットされる。尚、保護用セル(15)
の値が論理値「1」の為、D型フリップフロップ(1
9)の入力は保護データ識別回路(16)の出力に依存
する。即ち、保護データ識別回路(16)の出力が論理
値「1」の為、D型フリップフロップ(19)の入力は
論理値「0」である。また、書き込み禁止信号WIは発
生しない。従って、書き込み終了信号EOWが発生した
時、RS型フリップフロップ(25)のリセットに伴い
制御信号WRTは初めて立ち下がる。換言すれば、最初
の動作許可信号*CE及び書き込み許可信号*WEが発
生してから書き込み終了信号EOWが発生する迄、制御
信号WRTはハイレベルを継続する。保護データの解読
結果が正しい場合はフラッシュメモリ(9)の書き込み
動作が許可され、ページバッファ(14)に128ワー
ドのプログラムデータが格納される。その後、消去信号
ERASEが発生し、フラッシュメモリ(9)のアドレ
ス領域Aの書き換え対象ページの内容は消去される。そ
の後、書き込み信号PROGRAMが発生し、ページバ
ッファ(14)の内容がフラッシュメモリ(9)のアド
レス領域Aに書き込まれる。書き込み信号PROGRA
Mが立ち下がると、書き込み終了信号EOWが発生する
為、RS型フリップフロップ(25)のリセットに伴い
制御信号WRTは立ち下がる。
FIG. 5 shows the setting of the protection cell (15),
9 is a time chart illustrating an operation when supplying protection data. While the operation of the microcomputer is stopped, various signals are supplied from the PROM writer to the flash memory (9). When the operation permission signal * CE and the write permission signal * WE fall, the control signal WRT rises with the setting of the RS flip-flop (25),
The internal cells in the address area A of the flash memory (9) are in a writable state. Protected data is an operation enable signal *
It is set in the register (12) in synchronization with the change of the CE and the write enable signal * WE. In addition, the protection cell (15)
Is a logical value “1”, the D-type flip-flop (1
The input of 9) depends on the output of the protected data identification circuit (16). That is, since the output of the protection data identification circuit (16) has the logical value "1", the input of the D-type flip-flop (19) has the logical value "0". Further, no write inhibit signal WI is generated. Therefore, when the write end signal EOW is generated, the control signal WRT falls for the first time due to the reset of the RS flip-flop (25). In other words, the control signal WRT remains at the high level after the first operation enable signal * CE and the write enable signal * WE are generated until the write end signal EOW is generated. If the result of decoding the protected data is correct, the write operation of the flash memory (9) is permitted, and the page buffer (14) stores 128 words of program data. Thereafter, an erase signal ERASE is generated, and the contents of the page to be rewritten in the address area A of the flash memory (9) are erased. Thereafter, a write signal PROGRAM is generated, and the contents of the page buffer (14) are written to the address area A of the flash memory (9). Write signal PROGRA
When M falls, a write end signal EOW is generated, and the control signal WRT falls with the reset of the RS flip-flop (25).

【0021】図6は、保護用セル(15)をセットし、
保護データを供給しない場合の動作を示すタイムチャー
トである。マイクロコンピュータの動作を停止させた状
態で、PROMライタからフラッシュメモリ(9)へ各
種信号を供給する。動作許可信号*CE及び書き込み許
可信号*WEが立ち下がると、RS型フリップフロップ
(25)のセットに伴い制御信号WRTが立ち上がり、
フラッシュメモリ(9)のアドレス領域Aの内部セルは
書き込み可能状態となる。尚、保護用セル(15)の値
が論理値「1」の為、D型フリップフロップ(19)の
入力は保護データ識別回路(16)の出力に依存する。
即ち、保護データ識別回路(16)の出力が論理値
「0」の為、D型フリップフロップ(19)の入力は論
理値「1」である。また、書き込み禁止信号WIは発生
しない。従って、ページバッファ(14)に対するデー
タ格納動作終了から所定時間(例えば300μsec)
経過後に発生するクロックCLK2に同期して、D型フ
リップフロップ(19)は論理値「1」を保持する。即
ち、RS型フリップフロップ(25)のリセットに伴い
制御信号WRTは立ち下がってしまい、フラッシュメモ
リ(9)の書き込み動作は禁止される。
FIG. 6 shows the setting of the protection cell (15),
6 is a time chart illustrating an operation when protection data is not supplied. While the operation of the microcomputer is stopped, various signals are supplied from the PROM writer to the flash memory (9). When the operation permission signal * CE and the write permission signal * WE fall, the control signal WRT rises with the setting of the RS flip-flop (25),
The internal cells in the address area A of the flash memory (9) are in a writable state. Since the value of the protection cell (15) is a logical value "1", the input of the D-type flip-flop (19) depends on the output of the protection data identification circuit (16).
That is, since the output of the protection data identification circuit (16) has the logical value "0", the input of the D-type flip-flop (19) has the logical value "1". Further, no write inhibit signal WI is generated. Therefore, a predetermined time (for example, 300 μsec) from the end of the data storage operation to the page buffer (14)
The D-type flip-flop (19) holds the logical value "1" in synchronization with the clock CLK2 generated after the elapse. That is, the control signal WRT falls with the reset of the RS flip-flop (25), and the write operation of the flash memory (9) is prohibited.

【0022】次に、フラッシュメモリ(9)のアドレス
領域Bの書き換え命令を用いてアドレス領域Aのプログ
ラム命令を書き換える場合について説明する。図7は保
護データを供給する場合の動作を示すタイムチャートで
ある。マイクロコンピュータがフラッシュメモリ(9)
のアドレス領域Aのプログラム命令の解読結果に従って
各種論理演算動作を実行している時、アドレス領域Aの
プログラム命令を書き換える為の割り込み要求が発生す
ると、プログラムカウンタ(29)の値がアドレス領域
Aからアドレス領域Bへジャンプする。そして、マイク
ロコンピュータはアドレス領域Bの書き換え命令の解読
結果に従って書き換え動作を開始する。この時、CPU
(28)は論理値「1」のオンボード信号OBを常時出
力する。動作許可信号*CE及び書き込み許可信号*W
Eが立ち下がると、RS型フリップフロップ(25)の
セットに伴い制御信号WRTが立ち上がり、フラッシュ
メモリ(9)のアドレス領域Aの内部セルは書き込み可
能状態となる。保護データは動作許可信号*CE及び書
き込み許可信号*WEの変化に同期してレジスタ(1
2)にセットされる。尚、オンボード信号OBが論理値
「1」の為、D型フリップフロップ(19)の入力は保
護データ識別回路(16)の出力に依存する。即ち、保
護データ識別回路(16)の出力が論理値「1」の為、
D型フリップフロップ(19)の入力は論理値「0」で
ある。また、書き込み禁止信号WIはページバッファ
(14)に対する格納が終了する迄周期的間隔で発生す
るが、強制設定信号PLが論理値「1」の為、レジスタ
(12)の解読に支障はない。そして、保護データの解
読結果が正しい場合は、消去信号ERASEが発生し、
フラッシュメモリ(9)のアドレス領域Aの書き換え対
象ページの内容が消去される。その後、書き込み信号P
ROGRAMが発生し、動作許可信号*CE及び書き込
み許可信号*WEが立ち下がりに同期して制御信号WR
Tが立ち上がり、ページバッファ(14)の内容がフラ
ッシュメモリ(9)のアドレス領域Aに書き込まれる。
書き込み信号PROGRAMが立ち下がると、書き込み
終了信号EOWが発生する為、RS型フリップフロップ
(25)のリセットに伴い制御信号WRTは立ち下が
る。
Next, a case in which a program instruction in the address area A is rewritten by using a rewrite instruction in the address area B of the flash memory (9) will be described. FIG. 7 is a time chart showing an operation when supplying protection data. Microcomputer is flash memory (9)
During execution of various logical operations in accordance with the result of decoding the program instruction in the address area A, when an interrupt request for rewriting the program instruction in the address area A occurs, the value of the program counter (29) changes from the address area A to Jump to address area B. Then, the microcomputer starts the rewriting operation in accordance with the result of decoding the rewriting instruction in the address area B. At this time, CPU
(28) constantly outputs the on-board signal OB having the logical value "1". Operation enable signal * CE and write enable signal * W
When E falls, the control signal WRT rises with the setting of the RS flip-flop (25), and the internal cells in the address area A of the flash memory (9) are in a writable state. The protection data is stored in the register (1) in synchronization with the change of the operation permission signal * CE and the write permission signal * WE.
Set to 2). Since the on-board signal OB has the logical value "1", the input of the D-type flip-flop (19) depends on the output of the protection data identification circuit (16). That is, since the output of the protection data identification circuit (16) is a logical value "1",
The input of the D-type flip-flop (19) has a logical value "0". The write prohibition signal WI is generated at periodic intervals until the storage in the page buffer (14) is completed. However, since the forcible setting signal PL has the logical value "1", there is no problem in reading the register (12). If the decryption result of the protected data is correct, an erase signal ERASE is generated,
The contents of the page to be rewritten in the address area A of the flash memory (9) are erased. After that, the write signal P
ROGRAM is generated, and the operation permission signal * CE and the write permission signal * WE are synchronized with the fall of the control signal WR.
T rises, and the contents of the page buffer (14) are written to the address area A of the flash memory (9).
When the write signal PROGRAM falls, a write end signal EOW is generated, so that the control signal WRT falls with the reset of the RS flip-flop (25).

【0023】図8は保護データを供給しない場合の動作
を示すタイムチャートである。マイクロコンピュータが
フラッシュメモリ(9)のアドレス領域Aのプログラム
命令の解読結果に従って各種論理演算動作を実行してい
る時、アドレス領域Aのプログラム命令を書き換える為
の割り込み要求が発生すると、プログラムカウンタ(2
9)の値がアドレス領域Aからアドレス領域Bへジャン
プする。そして、マイクロコンピュータはアドレス領域
Bの書き換え命令の解読結果に従って書き換え動作を開
始する。この時、CPU(28)は論理値「1」のオン
ボード信号OBを常時出力する。動作許可信号*CE及
び書き込み許可信号*WEが立ち下がると、RS型フリ
ップフロップ(25)のセットに伴い制御信号WRTが
立ち上がり、フラッシュメモリ(9)のアドレス領域A
の内部セルは書き込み可能状態となる。保護データは動
作許可信号*CE及び書き込み許可信号*WEの変化に
同期してレジスタ(12)にセットされる。尚、オンボ
ード信号OBが論理値「1」の為、D型フリップフロッ
プ(19)の入力は保護データ識別回路(16)の出力
に依存する。即ち、保護データ識別回路(16)の出力
が論理値「0」の為、D型フリップフロップ(19)の
入力は論理値「1」である。また、書き込み禁止信号W
Iはページバッファ(14)に対する格納が終了する迄
周期的間隔で発生するが、強制設定信号PLが論理値
「1」の為、レジスタ(12)の解読に支障はない。そ
して、ページバッファ(14)に対するデータ格納動作
終了から所定時間(例えば300μsec)経過後に発
生するクロックCLK2に同期して、D型フリップフロ
ップ(19)は論理値「1」を保持する。即ち、RS型
フリップフロップ(25)のリセットに伴い制御信号W
RTは立ち下がってしまい、フラッシュメモリ(9)の
書き込み動作は禁止される。
FIG. 8 is a time chart showing the operation when no protection data is supplied. When the microcomputer is performing various logical operations in accordance with the result of decoding the program instruction in the address area A of the flash memory (9), when an interrupt request for rewriting the program instruction in the address area A occurs, the program counter (2)
The value of 9) jumps from the address area A to the address area B. Then, the microcomputer starts the rewriting operation in accordance with the result of decoding the rewriting instruction in the address area B. At this time, the CPU (28) constantly outputs the on-board signal OB having the logical value "1". When the operation permission signal * CE and the write permission signal * WE fall, the control signal WRT rises with the setting of the RS flip-flop (25), and the address area A of the flash memory (9).
Are in a writable state. The protection data is set in the register (12) in synchronization with the change of the operation permission signal * CE and the write permission signal * WE. Since the on-board signal OB has the logical value "1", the input of the D-type flip-flop (19) depends on the output of the protection data identification circuit (16). That is, since the output of the protection data identification circuit (16) has the logical value "0", the input of the D-type flip-flop (19) has the logical value "1". Also, the write inhibit signal W
I occurs at a periodic interval until the storage in the page buffer (14) is completed. However, since the forcible setting signal PL has the logical value "1", there is no problem in decoding the register (12). Then, the D-type flip-flop (19) holds the logical value “1” in synchronization with the clock CLK2 generated after a predetermined time (for example, 300 μsec) has elapsed from the end of the data storage operation to the page buffer (14). That is, when the RS flip-flop (25) is reset, the control signal W
RT falls, and the write operation of the flash memory (9) is prohibited.

【0024】以上より、本発明の実施の形態によれば、
フラッシュメモリ(9)のアドレス領域Bの書き換え命
令を用いてアドレス領域Aのプログラム命令を書き換え
る場合、保護用セル(15)の状態に関わらず、保護デ
ータの解読結果が正しい場合のみフラッシュメモリ
(9)の書き換え動作を許可する様にした。従って、マ
イクロコンピュータのプログラム処理が暴走して保護デ
ータが誤った場合、フラッシュメモリ(9)のアドレス
領域Aの書き換え動作を確実に禁止できる。
As described above, according to the embodiment of the present invention,
When rewriting the program instruction in the address area A using the rewrite instruction in the address area B of the flash memory (9), regardless of the state of the protection cell (15), the flash memory (9) is used only when the result of decoding the protected data is correct. ) Is allowed to be rewritten. Therefore, when the program processing of the microcomputer runs away and the protection data is erroneous, the rewriting operation of the address area A of the flash memory (9) can be reliably inhibited.

【0025】[0025]

【発明の効果】本発明によれば、不揮発性メモリの第2
記憶領域の書き換え命令を用いて第1記憶領域のプログ
ラム命令を書き換える場合、保護用セルの状態に関わら
ず、保護データの解読結果が正しい場合のみ不揮発性メ
モリの書き換え動作を許可する様にした。従って、マイ
クロコンピュータのプログラム処理が暴走して保護デー
タが誤った場合、不揮発性メモリの第1記憶領域の書き
換え動作を確実に禁止できる利点が得られる。
According to the present invention, the second nonvolatile memory can be used.
When rewriting the program instruction of the first storage area using the rewrite instruction of the storage area, the rewrite operation of the nonvolatile memory is permitted only when the result of decoding the protected data is correct, regardless of the state of the protection cell. Therefore, when the program processing of the microcomputer runs away and the protection data is erroneous, an advantage is obtained that the rewriting operation of the first storage area of the nonvolatile memory can be reliably inhibited.

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

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

【図2】各波形の相対関係を示すタイムチャートであ
る。
FIG. 2 is a time chart showing a relative relationship between waveforms.

【図3】PROMライタを用い、保護用セルをリセット
した状態で保護データを使用する場合の動作を示すタイ
ムチャートである。
FIG. 3 is a time chart showing an operation in a case where protection data is used in a state where a protection cell is reset using a PROM writer.

【図4】PROMライタを用い、保護用セルをリセット
した状態で保護データを使用しない場合の動作を示すタ
イムチャートである。
FIG. 4 is a time chart showing an operation in a case where protection data is not used in a state where a protection cell is reset using a PROM writer.

【図5】PROMライタを用い、保護用セルをセットし
た状態で保護データを使用する場合の動作を示すタイム
チャートである。
FIG. 5 is a time chart showing an operation in a case where protection data is used with a protection cell set using a PROM writer.

【図6】PROMライタを用い、保護用セルをセットし
た状態で保護データを使用しない場合の動作を示すタイ
ムチャートである。
FIG. 6 is a time chart showing an operation when protection data is not used in a state where a protection cell is set using a PROM writer.

【図7】フラッシュメモリのアドレス領域Bの書き換え
命令を用い、保護データを使用する場合の動作を示すタ
イムチャートである。
FIG. 7 is a time chart showing an operation in a case where protection data is used by using a rewrite instruction of an address area B of a flash memory.

【図8】フラッシュメモリのアドレス領域Bの書き換え
命令を用い、保護データを使用しない場合の動作を示す
タイムチャートである。
FIG. 8 is a time chart showing an operation in the case where a rewrite instruction for an address area B of a flash memory is used and protection data is not used.

【図9】従来のフラッシュメモリ装置を示すブロック図
である。
FIG. 9 is a block diagram showing a conventional flash memory device.

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

(9) フラッシュメモリ (12) レジスタ (13) デコーダ (14) ページバッファ (15) 保護用セル (28) CPU (9) Flash memory (12) Register (13) Decoder (14) Page buffer (15) Protecting cell (28) CPU

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 データを一括又は部分的に電気消去でき
且つデータを書き込み及び読み出しできる特性を有し、
第1記憶領域に各種論理演算を実行させる為のプログラ
ム命令が格納され、第2記憶領域に前記第1記憶領域の
内容を書き換える為の書き換え命令が格納された不揮発
性メモリ、前記不揮発性メモリの第1記憶領域の誤書き
換えを防止する為の保護データがセットされるレジス
タ、前記レジスタの値を解読し解読結果に応じて前記不
揮発性メモリの第1記憶領域の書き換えを許可又は禁止
するデコーダ、を有するマイクロコンピュータにおい
て、前記不揮発性メモリの第2記憶領域の書き換え命令
を用いて第1記憶領域のプログラム命令を書き換える
時、前記レジスタに正しい保護データがセットされた場
合のみ、前記不揮発性メモリの第1記憶領域の書き換え
を許可する手段を設けたことを特徴とするマイクロコン
ピュータ。
1. It has a characteristic that data can be collectively or partially electrically erased, and data can be written and read,
A nonvolatile memory in which program instructions for executing various logical operations are stored in a first storage area, and a rewrite instruction for rewriting the contents of the first storage area are stored in a second storage area; A register in which protection data for preventing erroneous rewriting of the first storage area is set, a decoder for decoding a value of the register and permitting or prohibiting rewriting of the first storage area of the nonvolatile memory according to a result of the decoding; When rewriting the program instruction of the first storage area using the rewrite instruction of the second storage area of the nonvolatile memory, only when correct protection data is set in the register, the microcomputer of the nonvolatile memory A microcomputer provided with means for permitting rewriting of the first storage area.
JP07877998A 1998-03-26 1998-03-26 Microcomputer Expired - Fee Related JP3197865B2 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
JP07877998A JP3197865B2 (en) 1998-03-26 1998-03-26 Microcomputer
TW088104408A TW432329B (en) 1998-03-26 1999-03-20 Microcomputor
KR1019990010376A KR100341424B1 (en) 1998-03-26 1999-03-25 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP07877998A JP3197865B2 (en) 1998-03-26 1998-03-26 Microcomputer

Publications (2)

Publication Number Publication Date
JPH11272472A true JPH11272472A (en) 1999-10-08
JP3197865B2 JP3197865B2 (en) 2001-08-13

Family

ID=13671390

Family Applications (1)

Application Number Title Priority Date Filing Date
JP07877998A Expired - Fee Related JP3197865B2 (en) 1998-03-26 1998-03-26 Microcomputer

Country Status (3)

Country Link
JP (1) JP3197865B2 (en)
KR (1) KR100341424B1 (en)
TW (1) TW432329B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002149623A (en) * 2000-11-10 2002-05-24 Sanyo Electric Co Ltd Microcomputer
JP2002297563A (en) * 2001-03-30 2002-10-11 Hitachi Ltd Microcomputer and data processing apparatus
JP2008140343A (en) * 2006-12-05 2008-06-19 Denso Corp Electronic apparatus
JP2010170579A (en) * 2010-04-19 2010-08-05 Renesas Technology Corp Data processor
CN119127749A (en) * 2024-11-08 2024-12-13 湖南进芯电子科技有限公司 Flash memory interface circuit, flash memory control method, electronic device and storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6300308B1 (en) 1997-12-31 2001-10-09 Board Of Regents, The University Of Texas System Methods and compositions for inducing autoimmunity in the treatment of cancers
JP2002245023A (en) * 2001-02-16 2002-08-30 Mitsubishi Electric Corp Microcomputer

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002149623A (en) * 2000-11-10 2002-05-24 Sanyo Electric Co Ltd Microcomputer
JP2002297563A (en) * 2001-03-30 2002-10-11 Hitachi Ltd Microcomputer and data processing apparatus
JP2008140343A (en) * 2006-12-05 2008-06-19 Denso Corp Electronic apparatus
JP2010170579A (en) * 2010-04-19 2010-08-05 Renesas Technology Corp Data processor
CN119127749A (en) * 2024-11-08 2024-12-13 湖南进芯电子科技有限公司 Flash memory interface circuit, flash memory control method, electronic device and storage medium

Also Published As

Publication number Publication date
TW432329B (en) 2001-05-01
KR19990078265A (en) 1999-10-25
JP3197865B2 (en) 2001-08-13
KR100341424B1 (en) 2002-06-22

Similar Documents

Publication Publication Date Title
JP3884839B2 (en) Semiconductor memory device
KR100408223B1 (en) A method and apparatus for hardware block locking in a nonvolatile memory
KR100375217B1 (en) Microcontroller incorporating an electrically rewritable non-volatile memory
US5890191A (en) Method and apparatus for providing erasing and programming protection for electrically erasable programmable read only memory
KR100444537B1 (en) Data processor
US5991849A (en) Rewriting protection of a size varying first region of a reprogrammable non-volatile memory
US20010000816A1 (en) Volatile lock architecture for individual block locking on flash memory
US20020129195A1 (en) Microcomputer with built-in programmable nonvolatile memory
CN110968254B (en) Partition protection method and device for nonvolatile memory
KR100604877B1 (en) Apparatus and method for controlling the mapping of memory addresses in embedded systems
US6189070B1 (en) Apparatus and method for suspending operation to read code in a nonvolatile writable semiconductor memory
US6948041B2 (en) Permanent memory block protection in a flash memory device
JPH11110293A (en) Nonvolatile memory control circuit
KR970066888A (en) Microcomputers Using Nonvolatile Memory
JP3197865B2 (en) Microcomputer
JP2003051195A (en) Semiconductor memory device
JP3695931B2 (en) Microcomputer
US6842371B2 (en) Permanent master block lock in a memory device
JP3028567B2 (en) Microcomputer with built-in EEPROM
JP2005107608A (en) Electronic device, nonvolatile memory, and method for rewriting data of nonvolatile memory
JP4118023B2 (en) Memory control circuit
JP2000276461A (en) Microcomputer
JP4848126B2 (en) Microcomputer, data protection method for nonvolatile memory in microcomputer
JP3510780B2 (en) Microcomputer
JPH11232245A (en) Microcomputer

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees