JPH06349286A - Writing controller and control method for flash memory - Google Patents

Writing controller and control method for flash memory

Info

Publication number
JPH06349286A
JPH06349286A JP13465693A JP13465693A JPH06349286A JP H06349286 A JPH06349286 A JP H06349286A JP 13465693 A JP13465693 A JP 13465693A JP 13465693 A JP13465693 A JP 13465693A JP H06349286 A JPH06349286 A JP H06349286A
Authority
JP
Japan
Prior art keywords
data
flash memory
entry
write
written
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
JP13465693A
Other languages
Japanese (ja)
Inventor
Yoshitaka Kuroda
剛毅 黒田
Makoto Tazumi
誠 田積
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial 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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP13465693A priority Critical patent/JPH06349286A/en
Publication of JPH06349286A publication Critical patent/JPH06349286A/en
Pending legal-status Critical Current

Links

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)
  • Read Only Memory (AREA)

Abstract

PURPOSE:To shorten the writing time by comparing a data written in a flash memory with a data to be written therein thereby deciding the necessity of erasure and retreating the overwritten data or written data before the writing is effected. CONSTITUTION:A bit data read out from a flash memory 3, stored at a read out data storing section 5 and written in the flash memory 3 is compared with a bit data stored at the read out data storing section 4 and written in the memory 3 at same address. A write deciding section 10 decides the necessity of erasing the bit data in the memory 3. Data is overwritten in the memory 3 if the erasure is not necessary whereas the corresponding data of the memory 3 is retreated to a retreat memory 11 before the writing is effected if the erasure is necessary thus eliminating the need of time consuming erasure and shortening the writing time of the flash memory.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、メモリへの書き込みに
関し、特に電気的に消去可能なフラッシュメモリの書き
込み制御の方法および装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to writing to a memory, and more particularly to a method and apparatus for controlling writing in an electrically erasable flash memory.

【0002】[0002]

【従来の技術】従来、例えば『日経エレクトロニクス』
1992 2-17,no.547,pp.133-186 に記載されているごと
く、書き込みのあるある種の不揮発性メモリ(EEPROM,
フラッシュメモリなど)に新規作成や書き換えで新たに
データを書き込むこととなる場合には、直接新たなデー
タをそのまま書き込むこと(オーバーライト)を行なわ
ず、それに先立ちメモリの値を全て1に揃える消去動作
(以下、単に「消去」という)といわれるものを行なっ
ていた。(そのような性質を有する不揮発性メモリとし
てはフラッシュメモリが代表的であること、MNOS型SRAM
等の消去動作なしに書き込みが可能な不揮発性メモリと
容易に区別可能なことを考慮の上、本明細書ではかかる
性質を有する不揮発性メモリをフラッシュメモリとい
う。)ところでこの消去は、電源喪失時でも記憶内容が
破壊されない等のこのメモリの特質上、プログラム動作
で行うことはできない。このため、いったんフラッシュ
メモリに書き込みがなされた後に、同じアドレス(番
地)に新たなデータの書き込み要求が発生すると、この
先に書き込まれたメモリを全て一度消去した上で新たに
書き込み要求のあったデータを書き込むという繁雑な手
順をふんでいる。しかもこの際、読み込みと書き込みは
バイト単位で行えるが消去は設備や各種の制約の都合上
ブロック単位(2バイト以上)またはチップ全体でしか
行えない。このため、同一消去ブロック上の書き込み対
象のアドレスでないアドレスのデータは、消去されても
差し障りがないようにいったん退避させ、消去終了後に
再度書き込むという余計な作業まで行なっていた。
2. Description of the Related Art Conventionally, for example, "Nikkei Electronics"
1992 2-17, no.547, pp.133-186, some kind of non-volatile memory (EEPROM,
If new data is to be written to the flash memory, etc. by new creation or rewriting, new data is not written directly (overwriting), but all memory values are set to 1 prior to the erase operation. I was doing what is called (hereinafter simply called "erasure"). (Flash memory is a typical non-volatile memory with such characteristics, MNOS SRAM
In this specification, a nonvolatile memory having such a property is referred to as a flash memory in consideration of being easily distinguishable from a writable nonvolatile memory such as the above. By the way, this erasure cannot be performed by the program operation due to the characteristics of this memory such that the stored contents are not destroyed even when the power is lost. For this reason, if a new data write request occurs at the same address (address) once it has been written to the flash memory, all the previously written memory will be erased once, and the newly requested data will be written. It contains the complicated procedure of writing. Moreover, at this time, reading and writing can be performed in byte units, but erasing can be performed only in block units (2 bytes or more) or the entire chip due to facility and various restrictions. For this reason, the data at the address which is not the write target address on the same erase block is temporarily saved so as not to cause any trouble even if it is erased, and the extra work of rewriting after the erase is performed.

【0003】[0003]

【発明が解決しようとする課題】しかしながら、消去は
読み出しに対して3〜4桁も遅いので、上記のような方
法では、フラッシュメモリの書き込み性能が大きく劣化
することとなる。ひいては、計算機のフラッシュメモリ
へのアクセスも遅れることとなる。本発明はかかる課題
に鑑み、フラッシュメモリの特性を有効に利用すること
によりデータ書き込み時間を大幅に短縮可能なメモリ制
御方法およびメモリ制御装置を提供することを目的とし
てなされたものである。
However, since erasing is slower than reading by 3 to 4 digits, writing performance of the flash memory is greatly deteriorated by the above method. Consequently, access to the flash memory of the computer will also be delayed. The present invention has been made in view of the above problems, and an object thereof is to provide a memory control method and a memory control device capable of significantly reducing the data writing time by effectively utilizing the characteristics of a flash memory.

【0004】[0004]

【課題を解決するための手段】上記目的を達成するため
に、請求項1の発明においては、フラッシュメモリに既
に書き込まれているデータと該データの書き込まれてい
るアドレスへ新規に書き込もうとするデータの各ビット
を比較しビットの組合せから消去が必要かどうかを判定
するステップと、前記ステップの結果、消去を必要とし
ないと判定された場合には書き込み前の消去を省略して
新規に書き込むデータをオーバーライトするステップと
を有していることを特徴とするフラッシュメモリ用書き
込み制御方法としている。
In order to achieve the above object, in the invention of claim 1, the data already written in the flash memory and the data to be newly written in the address where the data is written. The step of comparing each bit of No. 1 to determine whether or not erasing is necessary from the combination of bits, and if the result of the above step is that erasing is not necessary, erasing before writing is omitted and newly written data And a step of overwriting the write control method for a flash memory.

【0005】請求項2の発明においては、フラッシュメ
モリと、前記フラッシュメモリへ新規に書き込むデータ
およびそのアドレスを格納する書き込みデータ格納部
と、新規に書き込むデータが書き込まれるべきフラッシ
ュメモリ上のアドレスに既に書き込まれた上記憶されて
いるデータを読み出すデータ読み出し部と、前記データ
読み出し部が読み出したデータを格納する読み出しデー
タ格納部と、前記書き込みデータ格納部のデータと前記
読み出しデータ格納部のデータの相応するアドレスの各
ビット値を比較して消去を必要とするビットの組み合せ
の有無を判定する書き込み判定部と、前記書き込み判定
部が消去を必要とするビットの組み合せが無いと判定し
たときには、フラッシュメモリへの書き込み前の消去を
省略して新規に書き込むデータをそのまま書き込むデー
タ書き込み部と、同じく前記書き込み判定部が消去が必
要であると判定したときには、フラッシュメモリの消去
されるアドレスのデータを退避させた上で消去を行わ
せ、消去終了後に新規に書き込むデータおよび退避して
いたデータのうち必要なものの書き込みを行わせる書き
込み消去制御部とを備えたことを特徴とするフラッシュ
メモリ用書き込み制御装置としている。
According to the second aspect of the present invention, the flash memory, the write data storage section for storing the data to be newly written to the flash memory and the address thereof, and the address on the flash memory to which the newly written data is to be written are already stored. A data read unit for reading the written and stored data, a read data storage unit for storing the data read by the data read unit, and a corresponding data of the write data storage unit and the read data storage unit. Write determination unit that determines the presence or absence of a combination of bits that need to be erased by comparing the bit values of the addresses to be erased, and if the write determination unit determines that there is no combination of bits that needs to be erased, the flash memory Newly write without erasing before writing to When the data write unit that writes the data as it is and the write determination unit also determines that the erase is necessary, the data of the address to be erased in the flash memory is saved and then erased. A write control device for a flash memory, comprising: a write / erase control unit for writing necessary data among the data to be written in and the saved data.

【0006】請求項3の発明においては、フラッシュメ
モリとキャッシュメモリとコヒーレンシプロトコルによ
りこれら両メモリが記憶すべきデータの一貫性を保つべ
く作用するコヒーレンシ部とを有する構成において、フ
ラッシュメモリへ書き込むデータとキャッシュメモリ上
のデータとを比較するステップと、前記コヒーレンシ部
が採用するコヒーレンシプロトコルを前記判定するステ
ップの結果に応じて所定の手順で切り替えるステップと
を有していることを特徴とするフラッシュメモリ用書き
込み制御方法としている。
According to the third aspect of the present invention, in a configuration having a flash memory, a cache memory, and a coherency unit that acts to keep the data to be stored in both memories by a coherency protocol, data to be written to the flash memory Flash memory characterized by having a step of comparing with data on a cache memory and a step of switching a coherency protocol adopted by the coherency unit in a predetermined procedure according to a result of the step of judging. The write control method is used.

【0007】請求項4の発明においては、新規に書き込
むデータとフラッシュメモリ上のデータとを比較して、
書き込みに際しての消去の必要性を所定の手順で判定す
るステップと、前記判定の結果消去を必要としないとさ
れた場合にはキャッシュメモリ上の該当するエントリの
コヒーレンシプロトコルをライトスルー方式にして、新
規に書き込むデータをキャッシュメモリに書き込んだ直
後にフラッシュメモリにも書き込むステップと、同じく
消去を必要とすると判定された場合にはキャッシュメモ
リ上の該当するエントリのコヒーレンシプロトコルをコ
ピーバック方式にして、新規に書き込むデータをキャッ
シュメモリのみに書き込み、フラッシュメモリに書き込
むのはキャッシュメモリ上の該当するエントリがリプレ
ースされるときまで延期するステップとを有しているこ
とを特徴とする請求項3記載のフラッシュメモリ用書き
込み制御方法としている。
According to the fourth aspect of the invention, the newly written data and the data on the flash memory are compared,
A step of determining the necessity of erasing at the time of writing by a predetermined procedure, and if the result of the determination is that erasing is not required, the coherency protocol of the corresponding entry in the cache memory is set to the write-through method, and a new The step of writing to the flash memory immediately after writing the data to be written to the cache memory, and if it is determined that erasing is also required, set the coherency protocol of the corresponding entry in the cache memory to the copy back method and newly 4. The flash memory according to claim 3, further comprising the step of writing the data to be written only in the cache memory and deferring the writing to the flash memory until the corresponding entry in the cache memory is replaced. Write control method There.

【0008】請求項5の発明においては、キャッシュメ
モリと、前記キャッシュメモリと前記フラッシュメモリ
とのデータの一貫性をコヒーレンシプロトコルに従って
保持するコヒーレンシ部と、前記書き込み判定部の判定
結果に従って前記コヒーレンシ部の使用するコヒーレン
シプロトコルを切り替えるコヒーレンシプロトコル制御
部とを備えたことを特徴とする請求項2記載のフラッシ
ュメモリ用書き込み制御装置としている。
According to a fifth aspect of the present invention, a cache memory, a coherency unit for maintaining data consistency between the cache memory and the flash memory according to a coherency protocol, and a coherency unit for the coherency unit according to the determination result of the write determination unit. The flash memory write control device according to claim 2, further comprising a coherency protocol control unit for switching a coherency protocol to be used.

【0009】請求項6の発明においては、キャッシュメ
モリ上のデータがフラッシュメモリ上のデータと一致し
ていない場合にはその旨を表すダーティビットをセット
するステップと、 キャッシュメモリのエントリのリプ
レースが必要になった場合にダーティビットがセットさ
れていないエントリがプレースの対象として優先して選
択されるステップと、ダーティビットがセットされてい
ないエントリがないときにはエントリ内の全てにダーテ
ィビットがセットされているエントリが次に優先して選
択されるステップと、ダーティビットがセットされてい
ないエントリが選択されたときはフラッシュメモリ上の
リプレースの対象となっているデータをキャッシュメモ
リ上の当該エントリにオーバーライトし、リプレースさ
れるキャッシュメモリのエントリに記憶されていたデー
タはフラッシュメモリに書き戻さないステップと、ダー
ティビットが全てセットされているエントリが選択され
たときは当該エントリに記憶されているデータをフラッ
シュメモリ上に書き戻し、フラッシュメモリ上のリプレ
ースの対象となっているデータを新たにキャッシュメモ
リのリプレースされるべきエントリに書き込むステップ
とを有していることを特徴とする請求項4に記載のフラ
ッシュメモリ用書き込み制御方法としている。
In the sixth aspect of the invention, when the data in the cache memory does not match the data in the flash memory, a step of setting a dirty bit indicating that fact and replacement of the entry in the cache memory are necessary. If the dirty bit is not set, the entry is preferentially selected as a place target, and when there is no entry with the dirty bit not set, the dirty bit is set in all entries. When the entry is selected next with priority, and when the entry in which the dirty bit is not set is selected, the data to be replaced in the flash memory is overwritten in the entry in the cache memory. , Replaced cache memo The data stored in the memory entry is not written back to the flash memory, and when the entry with all dirty bits set is selected, the data stored in the entry is written back to the flash memory. 5. The flash memory write control method according to claim 4, further comprising: writing data to be replaced on the flash memory to an entry to be newly replaced in the cache memory. There is.

【0010】請求項7の発明においては、前記コヒーレ
ンシ部の制御のもとでキャッシュメモリ上のデータがフ
ラッシュメモリ上のデータと一致していない場合にはそ
の旨を表すダーティビットをセットするダーティビット
セット部と、キャッシュメモリのエントリのリプレース
が必要になった場合にダーティビットがセットされてい
ないエントリをリプレースの対象として優先して選択
し、かかるエントリがないときは全てのダーティビット
がセットされているエントリを次に優先して選択するリ
プレースエントリ選択部と、前記リプレースエントリ選
択部がダーティビットがセットされていないエントリを
選択したときはフラッシュメモリ上のリプレースの対象
となっているデータをキャッシュメモリ上の当該エント
リにオーバーライトし、リプレースされるキャッシュメ
モリのエントリに記憶されていたデータはフラッシュメ
モリに書き戻さず、全てのビットにダーティビットがセ
ットされているエントリが選択されたときは当該エント
リに記憶されているデータをフラッシュメモリ上に書き
戻し、フラッシュメモリ上のリプレースの対象となって
いるデータを新たにキャッシュメモリのリプレースされ
るべきエントリに書き込むエントリリプレース制御部と
を備えたことを特徴とする請求項5記載のフラッシュメ
モリ用書き込み制御装置としている。
According to another aspect of the present invention, if the data in the cache memory does not match the data in the flash memory under the control of the coherency unit, a dirty bit indicating that fact is set. When it is necessary to replace the set part and the cache memory entry, the entry for which the dirty bit is not set is selected with priority for the replacement target. If there is no such entry, all the dirty bits are set. The replacement entry selection unit that selects the entry that has the next priority, and when the replacement entry selection unit selects the entry in which the dirty bit is not set, the data that is the replacement target on the flash memory is stored in the cache memory. Overwrite the entry above , The data stored in the replaced cache memory entry is not written back to the flash memory, and when the entry with the dirty bit set in all bits is selected, the data stored in the entry is flushed. 6. The flash memory according to claim 5, further comprising an entry replacement control unit that writes back the data on the memory and writes the data to be replaced on the flash memory to an entry to be newly replaced in the cache memory. It is used as a memory write controller.

【0011】[0011]

【作用】請求項1の発明においては、既にデータが書き
込まれているフラッシュメモリに、新規作成、新規発生
や書き換え要求により新たにデータを書き込む必要が生
じた場合に、既に書き込まれているデータと該データの
書き込まれているアドレス(address,記憶位置, 番地)
へ新規に書き込もうとするデータの各ビットを比較して
書き込みに先立っての消去の必要性の有無が判定され
る。消去を必要とするビットの組み合せがないと判定さ
れた場合には書き込み前の消去を省略して新規に書き込
むデータをオーバーライト(直接そのまま書き込むこ
と)する。
According to the first aspect of the present invention, when it is necessary to write new data to a flash memory in which data has already been written due to a new creation, a new generation, or a rewrite request, the data already written Address where the data is written (address, storage location, address)
It is determined whether or not there is a need for erasing prior to writing by comparing each bit of data to be newly written to. If it is determined that there is no bit combination that requires erasing, erasing before writing is omitted and newly written data is overwritten (directly written as it is).

【0012】請求項2の発明においては、書き込みデー
タ格納部はフラッシュメモリに新規に書き込むデータお
よびそのアドレスを格納(少なくも必要な時間だけは記
憶)する。データ読み出し部は、新規に書き込むデータ
が書き込まれるべきフラッシュメモリ上のアドレスに既
に書き込まれた上記憶されているデータを読み出す。読
み出しデータ格納部は、前記データ読み出し部が読み出
したデータを格納する。書き込み判定部は、前記書き込
みデータ格納部のデータと読み出しデータ格納部のデー
タの各ビットを比較して消去を必要とするビットの組み
合せの有無を判定する。データ書き込み部は、前記書き
込み判定部が消去を必要とするビットの組み合せがない
と判定するとフラッシュメモリの書き込み前の消去を省
略して新規に書き込むデータをオーバーライトする。書
き込み消去制御部は、前記書き込み判定部が消去が必要
と判定したときには、フラッシュメモリの消去されるア
ドレスのデータをいったん退避させた上で消去を行わ
せ、消去終了後に新規に書き込むデータおよび退避して
いたデータのうち必要なものをフラッシュメモリに書き
込ませる。
According to the second aspect of the present invention, the write data storage unit stores new write data and its address in the flash memory (stores at least the necessary time). The data reading unit reads the data already written and stored at the address on the flash memory where the newly written data should be written. The read data storage unit stores the data read by the data read unit. The write determination unit compares each bit of the data of the write data storage unit and the data of the read data storage unit and determines whether there is a combination of bits that need to be erased. When the write determination unit determines that there is no combination of bits that need to be erased, the data write unit omits the erase before writing in the flash memory and overwrites newly written data. When the write determination unit determines that the erase is necessary, the write / erase control unit temporarily saves the data of the address to be erased in the flash memory and then performs the erase, and newly writes and saves the data after the erase is completed. The necessary data is written in the flash memory.

【0013】請求項3の発明においては、フラッシュメ
モリとキャッシュメモリとコヒーレンシプロトコル(co
herency protocol, 一貫性保持用規則)によりこれら両
メモリが記憶すべきデータの一貫性を保つべく作用する
コヒーレンシ部とを有する構成において、フラッシュメ
モリへ書き込むデータとフラッシュメモリ上のデータを
比較して、消去の必要性が判定される。次いで、前記コ
ヒーレンシ部が採用するコヒーレンシプロトコルが、前
記判定するステップの結果に応じて所定の手順で切り替
えられる。
According to the third aspect of the invention, the flash memory, the cache memory and the coherency protocol (co
In a configuration having a coherency unit that acts to maintain the consistency of the data to be stored in these memories according to the herency protocol, a rule for maintaining consistency), the data written to the flash memory and the data on the flash memory are compared, The need for erasure is determined. Then, the coherency protocol adopted by the coherency unit is switched in a predetermined procedure according to the result of the determining step.

【0014】請求項4の発明においては、新規に書き込
むデータとフラッシュメモリ上のデータとを比較して書
き込みに際しての消去の必要性が所定の手順で判定され
る。その結果消去を必要としないと判定された場合に
は、キャッシュメモリ上の該当するエントリのコヒーレ
ンシプロトコルをライトスルー方式にしてデータをキャ
ッシュメモリに書き込んだ直後にフラッシュメモリにも
書き込みがなされる。消去を必要とすると判定された場
合には、キャッシュメモリ上の該当するエントリのコヒ
ーレンシプロトコルをコピーバック方式にしてデータを
キャッシュメモリのみに書き込み、フラッシュメモリに
書き込むのは該当するエントリがリプレースされるとき
まで延期する。
According to the invention of claim 4, the newly written data is compared with the data on the flash memory, and the necessity of erasing at the time of writing is judged by a predetermined procedure. As a result, when it is determined that erasing is not necessary, the coherency protocol of the corresponding entry in the cache memory is set to the write-through method, and immediately after the data is written in the cache memory, the flash memory is also written. If it is determined that erasing is necessary, the coherency protocol of the corresponding entry in the cache memory is set to the copy back method and the data is written only in the cache memory, and the flash memory is written when the corresponding entry is replaced. Postponed until.

【0015】請求項5の発明においては、コヒーレンシ
プロトコル制御部は前記書き込み判定部の書き込みに際
しての消去の必要性の有無の結果によってコヒーレンシ
プロトコルを切り替える。コヒーレンシ部は、この切り
換えられたプロトコルに従ってキャッシュメモリとフラ
ッシュメモリのデータの一貫性を保持する。請求項6の
発明においては、キャッシュメモリ上のデータがフラッ
シュメモリ上のデータと一致していない場合にはその旨
を表すダーティビットがセットされる。キャッシュメモ
リのエントリのリプレースが必要になった場合に、ダー
ティビットがセットされていないエントリがレプレース
の対象として優先して選択される。ダーティビットがセ
ットされていないエントリがないときには、エントリ内
の全てにダーティビットがセットされているエントリが
次に優先して選択される。ダーティビットがセットされ
ていないエントリが選択されると、フラッシュメモリ上
のリプレースの対象となっているデータをキャッシュメ
モリの当該エントリにオーバーライトし、キャッシュメ
モリのレプレースされたエントリに記憶されていたデー
タはフラッシュメモリに書き戻さない。ダーティビット
が全てセットされているエントリが選択されると、キャ
ッシュメモリ上の当該エントリのデータをフラッシュメ
モリ上に書き戻し、しかる後レプレースの対象となって
いるフラッシュメモリ上のデータが新たにキャッシュメ
モリのエントリに書き込まれる。
In a fifth aspect of the present invention, the coherency protocol control unit switches the coherency protocol according to the result of the necessity of erasing at the time of writing by the write determination unit. The coherency unit maintains the consistency of the data in the cache memory and the flash memory according to this switched protocol. In the sixth aspect of the invention, when the data in the cache memory does not match the data in the flash memory, the dirty bit indicating that fact is set. When the cache memory entry needs to be replaced, the entry for which the dirty bit is not set is preferentially selected as the replacement target. When there is no entry in which the dirty bit is not set, the entry in which all the dirty bits are set is preferentially selected next. When an entry in which the dirty bit is not set is selected, the data that is the target of replacement on the flash memory is overwritten on the relevant entry in the cache memory, and the data stored in the replaced entry in the cache memory is overwritten. Does not write back to flash memory. When an entry for which all dirty bits are set is selected, the data of that entry in the cache memory is written back to the flash memory, and then the data in the flash memory to be replaced is newly added to the cache memory. Written in the entry.

【0016】請求項7の発明においては、ダーティビッ
ト部が、コヒーレンシ部の制御のもとで、キャッシュメ
モリ上のデータがフラッシュメモリ上のデータと一致し
ていない場合には、その旨を表すダーティビットをセッ
トする。リプレースエントリ選択部は、キャッシュメモ
リのエントリのリプレースが必要になった場合、ダーテ
ィビットがセットされていないエントリをリプレースの
対象として優先して選択し、かかるエントリがないとき
には、全てのダーティビットがセットされているエント
リを次に優先して選択する。エントリリプレース制御部
は、前記リプレースエントリ選択部がダーティビットが
セットされていないエントリを選択した場合には、フラ
ッシュメモリ上のリプレースの対象となっているデータ
をキャッシュメモリの当該エントリにオーバーライト
し、キャッシュメモリのリプレースの対象とされたエン
トリに記憶されていたデータをフラッシュメモリに書き
戻さない。全てのダーティビットがセットされているエ
ントリが選択された場合は、キャッシュメモリ上の当該
エントリのデータをフラッシュメモリ上に書き戻し、し
かる後レプレースの対象となっているフラッシュメモリ
上のデータが新たにキャッシュメモリの当該エントリに
書き込まれる。
According to another aspect of the present invention, when the data in the cache memory does not match the data in the flash memory under the control of the coherency unit, the dirty bit unit indicates that fact. Set the bit. When it is necessary to replace an entry in the cache memory, the replace entry selection unit preferentially selects an entry for which the dirty bit is not set as a target for replacement, and when there is no such entry, all dirty bits are set. The selected entry with the next priority. When the replacement entry selection unit selects an entry in which the dirty bit is not set, the entry replacement control unit overwrites the data to be replaced on the flash memory in the entry of the cache memory, Do not write back the data stored in the entry targeted for replacement of the cache memory to the flash memory. When an entry with all dirty bits set is selected, the data of that entry in the cache memory is written back to the flash memory, and then the data in the flash memory that is the target of replacement is newly added. It is written in the entry of the cache memory.

【0017】[0017]

【実施例】以下、本発明を実施例に基づいて説明する。
図1は、本発明に係るメモリ制御装置の一実施例の構成
図である。本図に示すように本実施例のフラッシュメモ
リ用書き込み制御装置及び方法は、CPU部1と、キャ
ッシュメモリ(cache memory, 高速一時記憶装置)2
と、主記憶装置用のフラッシュメモリ3と、書き込みデ
ータ格納部4と、読み出しデータ格納部5と、データ書
き込み部7とデータ読み出し部8と消去制御部9とを内
蔵したデータ制御部6と、書き込み判定部10と、退避
メモリ11と、コヒーレンシプロトコル制御部12と、
リプレースエントリ選択部13と、エントリリプレース
制御部14と、キャッシュ制御部15とを備えたCPU
システムに関するものである。
EXAMPLES The present invention will be described below based on examples.
FIG. 1 is a configuration diagram of an embodiment of a memory control device according to the present invention. As shown in the figure, the flash memory write control device and method according to the present embodiment includes a CPU unit 1 and a cache memory (high speed temporary storage device) 2.
A flash memory 3 for a main storage device, a write data storage unit 4, a read data storage unit 5, a data control unit 6 including a data write unit 7, a data read unit 8 and an erase control unit 9, A write determination unit 10, a save memory 11, a coherency protocol control unit 12,
A CPU including a replacement entry selection unit 13, an entry replacement control unit 14, and a cache control unit 15.
It is about the system.

【0018】ここに、フラッシュメモリ3は、複数ブロ
ックまたはチップ全体でしかフラッシュメモリの消去が
行えず、またビット値を0から1に書き換えるには消去
が必要であり、逆の1から0への変化は書き込み動作で
行える。また、既に書き込まれているデータのビット値
と新しく書き込まれるデータのビット値が同じ値の場合
には、そもそも当該アドレスには書き込みが必要でな
い。このため、図4の判定表(a)に示すように、既に
書き込まれているデータのビット値が0であり、当該ア
ドレスに新たに書き込むべきデータのビット値が1であ
ることが1カ所もない場合のみフラッシュメモリの消去
なしに新規なデータの書き込みができることとなる。
(なお、ここに「新しく書き込まれるデータ」とは、
「既に書き込まれているデータ」とは区別するためかか
る表現をしているものであり、必ずしも「新規に作成さ
れ、発生し、その結果として新しく追加して記憶される
データ」に限定されず、「書き換えアドレスの変更等で
書き込まれる以前からどこかで記憶されているデータ」
等も含む。)書き込みデータ格納部4は、CPU部1か
らの書き込みデータそのものおよびそのアドレスを保持
する。読み出しデータ格納部5は、書き込みアドレスに
格納されているフラッシュメモリ3上のデータを保持す
る。データ書き込み部7は、CPU部1からの書き込み
データおよびそのアドレスを書き込みデータ格納部4に
格納すると同時に、キャッシュヒットしていればデータ
をキャッシュメモリ2に書き込む。データ読み出し部8
は、書き込みアドレスに格納されているフラッシュメモ
リ上のデータを読み出した上で、これを読み出しデータ
格納部5に格納する。書き込み判定部10は、書き込み
データ格納部4のデータと読み出しデータ格納部5の相
応するアドレスのデータの各ビット値を比較して、消去
の単位たる複数ブロック毎に消去を必要とするビットが
有るか否かを判定する。消去制御部9は、フラッシュメ
モリに対してオーバーライト以外の書き込みの必要性が
発生すると、書き込みアドレスを含む消去の対象となる
ブロックの既に書き込まれているデータを退避メモリ1
1に退避させ、この後フラッシュメモリ3の当該ブロッ
クを消去する。そして、この上で新しく書き込むデータ
および退避させたデータのうち書き込みアドレス以外の
データをフラッシュメモリ3に書き込ませる。データ制
御部6は、データ書き込み部7、データ読み出し部8、
消去制御部9を内蔵し、更にこれらと書き込み判定部1
0を制御する。キャッシュ制御部15は、CPU部1か
らのアクセスに対してヒット/ミスヒットの判定、ダー
ティビット(1ブロック毎に立てる)のセット/リセッ
ト(1を立てる/0にする)等のキャッシュの適切な作
用のための基本的な制御を行なう。コヒーレンシプロト
コル制御部12は、書き込み判定部10の判定結果に従
い、消去が不要な書き込みの場合には書き込みデータを
キャッシュおよびフラッシュメモリにそのまま書き込
み、消去が必要な書き込みの場合にはそのデータをキャ
ッシュメモリにのみ書き込ませる。エントリリプレース
制御部14は、キャッシュメモリ内のエントリ(entry,
アドレスタグにより区分けをされており、複数のブロッ
クからなる記憶用のライン)のリプレース要求(主記憶
たるフラッシュメモリ3のデータを新しく記憶し、今あ
るデータは追い出すこと。)が発生すると、第1にエン
トリ内の全ブロックに対してダーティビットがリセット
されているエントリをリプレースの対象として優先して
選択し、エントリ内のデータをフラッシュメモリ3に書
き戻さずに、新たにフラッシュメモリ上のデータをエン
トリに格納し、全ブロックにダーティビットセットされ
ていないエントリがない場合にはエントリ内のダーティ
ビットがついたブロックの数が多い順にリプレースの対
象として選択し、そのエントリ内のデータをフラッシュ
メモリ3に書き戻し、新たにフラッシュメモリ3上のデ
ータをキャッシュメモリ2のエントリに記憶させる。
Here, the flash memory 3 can be erased only in a plurality of blocks or in the entire chip, and in order to rewrite the bit value from 0 to 1, erasing is necessary, and vice versa. The change can be done by a write operation. Further, when the bit value of already written data and the bit value of newly written data are the same value, it is not necessary to write to the address in the first place. Therefore, as shown in the determination table (a) of FIG. 4, the bit value of the data already written is 0, and the bit value of the data to be newly written in the address is 1 in one place. Only when there is no new data can be written without erasing the flash memory.
(Here, "newly written data" means
This expression is used to distinguish it from "already written data", and is not necessarily limited to "data newly created, generated, and newly added and stored as a result". "Data stored somewhere before being written due to change of rewriting address"
Etc. are also included. The write data storage unit 4 holds the write data itself from the CPU unit 1 and its address. The read data storage unit 5 holds the data on the flash memory 3 stored at the write address. The data writing unit 7 stores the write data from the CPU unit 1 and its address in the write data storage unit 4 and, at the same time, writes the data in the cache memory 2 if there is a cache hit. Data reading section 8
Reads out the data on the flash memory stored at the write address and stores it in the read data storage unit 5. The write determination unit 10 compares each bit value of the data of the write data storage unit 4 and the data of the corresponding address of the read data storage unit 5 and has a bit that needs to be erased for each of a plurality of blocks that is a unit of erase. Or not. When it is necessary to write data other than overwrite to the flash memory, the erase control unit 9 saves the already written data of the block to be erased including the write address to the save memory 1
1 and then erases the block in the flash memory 3. Then, the data other than the write address among the newly written data and the saved data is written in the flash memory 3 on this. The data control unit 6 includes a data writing unit 7, a data reading unit 8,
The erasure control unit 9 is built in, and these and the write determination unit 1
Control 0. The cache control unit 15 determines appropriate hits / misses for accesses from the CPU unit 1, sets / resets dirty bits (set for each block) (sets 1 / sets 0), etc. Performs basic control for action. According to the determination result of the write determination unit 10, the coherency protocol control unit 12 writes the write data to the cache and the flash memory as it is in the case of the write that does not need to be erased, and writes the write data in the cache memory if the erase is necessary. Only write to. The entry replacement control unit 14 uses the entries (entry,
When a replacement request for a storage line composed of a plurality of blocks) (data of main memory flash memory 3 is newly stored and existing data is expelled.) First, an entry whose dirty bit is reset for all blocks in the entry is selected as a replacement target with priority, and the data in the entry is newly written to the flash memory 3 without being written back to the flash memory 3. If there is no entry that is stored in the entry and the dirty bit is not set in all the blocks, it is selected as the replacement target in the order of the number of blocks with the dirty bit in the entry and the data in the entry is selected in the flash memory 3 To the cache and newly cache the data on the flash memory 3. It is stored in the entry memory 2.

【0019】次に上記メモリ制御装置の動作について、
図2および図3のフローチャートを参照しながら説明す
る。まず、CPU部1からメモリアクセスがあり、その
内容が書き込み要求であり(s1)、キャッシュ制御部
15がキャッシュヒット(s2)と判定した場合につい
て説明する。
Next, regarding the operation of the memory control device,
This will be described with reference to the flowcharts of FIGS. 2 and 3. First, a case will be described in which there is a memory access from the CPU unit 1, the content is a write request (s1), and the cache control unit 15 determines a cache hit (s2).

【0020】CPU部1より書き込み要求が発生する
と、データ書き込み部7はこの要求のあったデータたる
書き込みデータおよびその書き込まれるべきアドレスを
書き込みデータ格納部4に格納し、併せて書き込みデー
タをキャッシュメモリ2に格納する(s3)。データ読
み出し部8は、フラッシュメモリ3上の書き込み要求ア
ドレスのデータを読み出した上で読み出しレジスタ部5
に格納する。次に書き込み判定部10は、書き込みデー
タ格納部4のデータと読み出しデータ格納部5のデータ
とを比較して、前者のデータをフラッシュメモリ2に書
き込むに際して消去を必要とするビット(値を0から1
へ変換することとなるビット)の有無を消去単位毎に判
定する(s4)。図4の(b)上欄に示すようにかかる
ビットがない場合には、コヒーレンシプロトコル制御部
12はライトスループロトコルを採り、このプロトコル
のもとキャッシュメモリ2に書き込まれたデータを即座
にフラッシュメモリ3にオーバーライトする(s5)。
この上でキャッシュ制御部15はダーティビットをリセ
ットする(s6)。また図4の(b)下欄に示すように
消去を必要とするビットの組み合せが1つでもある場合
には、コピーバックプロトコルを採り、このプロトコル
のもとキャッシュ制御部15はダーティビットをセット
し(s7)、フラッシュメモリ3への書き込みはエント
リのリプレースが発生するまで遅延される。(このた
め、ライトスループロトコルの場合に比較して複数回の
アクセスがあったときには、フラッシュメモリ3への書
き込みの回数が減ることとなる。)なお、データ制御部
6は、書き込み判定部10、データ書き込み部7、デー
タ読み出し部8の上記動作を制御する。
When a write request is issued from the CPU unit 1, the data write unit 7 stores the write data, which is the requested data, and the address to be written in the write data storage unit 4, and also stores the write data in the cache memory. It is stored in 2 (s3). The data reading unit 8 reads the data of the write request address on the flash memory 3 and then reads it
To store. Next, the write determination unit 10 compares the data in the write data storage unit 4 with the data in the read data storage unit 5, and when writing the former data to the flash memory 2, a bit that needs to be erased (values from 0 1
Whether or not there is a bit to be converted into) is determined for each erase unit (s4). If there is no such bit as shown in the upper column of FIG. 4B, the coherency protocol control unit 12 adopts the write-through protocol and immediately writes the data written in the cache memory 2 under this protocol to the flash memory. Overwrite 3 (s5).
Then, the cache control unit 15 resets the dirty bit (s6). Further, as shown in the lower column of FIG. 4B, if there is even one combination of bits that need to be erased, the copyback protocol is adopted, and under this protocol, the cache control unit 15 sets the dirty bit. However, the writing to the flash memory 3 is delayed (s7) until the replacement of the entry occurs. (For this reason, the number of times of writing to the flash memory 3 is reduced when the access is made a plurality of times compared to the case of the write-through protocol.) Note that the data control unit 6 causes the write determination unit 10, The above operations of the data writing unit 7 and the data reading unit 8 are controlled.

【0021】CPU部1からのアクセスが書き込み動作
であり、キャッシュ制御部15がキャッシュミスヒット
と判定した場合について説明する(s2)(s3)。C
PU部1より書き込み要求が発生すると、データ書き込
み部7は書き込みデータおよびそのアドレスを書き込み
データ格納部4に格納するが、キャッシュメモリ2には
書き込まない。データ読み出し部8は、フラッシュメモ
リ3上の書き込み要求アドレスのデータを読み出し、こ
れを読み出しデータ格納部5に格納する。次に書き込み
判定部10は、書き込みデータ格納部4のデータと読み
出しデータ格納部5のデータとを比較して、消去の必要
性の有無を判定する(s8)。消去が不必要の場合に
は、データ書き込み部7は書き込みデータ格納部4のデ
ータをフラッシュメモリ2にそのまま書き込む(s
9)。また、消去が必要な場合には、消去制御部9が書
き込みアドレスを含む消去の際の単位となる複数ブロッ
クのデータを退避メモリ部11に退避させた上で(s1
0)フラッシュメモリ3の当該ブロックの既に記憶され
ているデータを消去し(s12)、しかる後書き込みデ
ータ(s7)を書き込み、また書き込みアドレス以外の
退避させていたデータをフラッシュメモリ3に再度書き
込む(s13)。
The case where the access from the CPU unit 1 is a write operation and the cache control unit 15 determines that the cache is a mishit will be described (s2) (s3). C
When a write request is issued from the PU unit 1, the data writing unit 7 stores the write data and its address in the write data storage unit 4, but does not write it in the cache memory 2. The data reading unit 8 reads the data of the write request address on the flash memory 3 and stores it in the read data storage unit 5. Next, the write determination unit 10 compares the data in the write data storage unit 4 with the data in the read data storage unit 5, and determines whether there is a need for erasing (s8). When erasing is unnecessary, the data writing unit 7 writes the data in the write data storage unit 4 to the flash memory 2 as it is (s
9). When erasing is necessary, the erasing control unit 9 saves data of a plurality of blocks, which is a unit for erasing including the write address, in the save memory unit 11 (s1
0) The data already stored in the block of the flash memory 3 is erased (s12), and then the write data (s7) is written, and the saved data other than the write address is written again in the flash memory 3 ( s13).

【0022】CPU部1からのアクセスが読み出し動作
であり(s14)、キャッシュ制御部15がキャッシュ
ヒットと判定した場合について説明する(s15)。デ
ータ読み出し部8が、キャッシュメモリからデータを読
み出しCPU部1に出力する(s15)。CPU部1か
らのアクセスが読み出し動作であり、キャッシュ制御部
15がキャッシュミスヒットと判定した場合について説
明する。
A case where the access from the CPU unit 1 is a read operation (s14) and the cache control unit 15 determines that a cache hit occurs (s15) will be described. The data reading unit 8 reads the data from the cache memory and outputs it to the CPU unit 1 (s15). A case in which the access from the CPU unit 1 is a read operation and the cache control unit 15 determines that a cache miss has occurred will be described.

【0023】フラッシュメモリ3からデータを読み出
し、これをキャッシュメモリ2に格納せずに直接CPU
部1に出力する(s16)。次にエントリのリプレース
要求が発生した場合の制御について説明する。まず、リ
プレースエントリ選択部13は、キャッシュメモリ2の
エントリ内の各ブロックのダーティビットの論理和およ
び論理積をとり、第1に論理和が0のエントリが存在す
る場合にはそのエントリをリプレースの対象として選択
する(t1)。かかる論理和が0のエントリが存在しな
い場合には論理積が1のエントリを第2のリプレース対
象とする(t2)。また、かかるエントリもなければ、
ダーティビットのセットされている数の多いエントリを
選択する(t3)。なお、リプレース対象が複数存在し
たり、上記第1若しくは第2の選択条件に合致するエン
トリが複数存在する場合には、LRU(least receitly
used,最後に参照された時刻が古いのを優先する。)法
やランダム法などの既存アルゴリズムを用いて決定す
る。エントリリプレース制御部14は、論理和が0のエ
ントリが存在する場合にはフラッシュメモリ3上のデー
タをそのエントリにオーバーライトする(t4)。論理
和が0のエントリが存在しない場合は消去制御部9がリ
プレースエントリを含むフラッシュメモリ上の消去の対
象となるブロックのデータを退避メモリ11にいったん
退避させ(t5)、当該ブロックの消去を実行した後
(t6)、書き込みデータ(t7)を書き込み、次いで
退避メモリ11に退避しているデータのうち書き込みデ
ータのアドレス以外のデータをフラッシュメモリに書き
込む(t8)。
Data is read from the flash memory 3 and stored directly in the CPU without storing it in the cache memory 2.
It is output to the section 1 (s16). Next, control when an entry replacement request occurs will be described. First, the replace entry selecting unit 13 calculates the logical sum and the logical product of the dirty bits of each block in the entry of the cache memory 2, and first, if there is an entry whose logical sum is 0, replaces that entry. It is selected as a target (t1). When there is no such entry having a logical sum of 0, the entry having a logical product of 1 is set as a second replacement target (t2). Also, if there is no such entry,
An entry having a large number of dirty bits set is selected (t3). If there are a plurality of replacement targets or there are a plurality of entries that match the first or second selection condition, LRU (least receitly).
used, priority is given to the last referenced time. ) Method or random method is used to determine the existing algorithm. If there is an entry whose logical sum is 0, the entry replacement control unit 14 overwrites the data in the flash memory 3 on the entry (t4). If there is no entry having a logical sum of 0, the erase control unit 9 temporarily saves the data of the block to be erased on the flash memory including the replace entry in the save memory 11 (t5) and executes the erase of the block. After that (t6), write data (t7) is written, and then data other than the address of the write data among the data saved in the save memory 11 is written in the flash memory (t8).

【0024】それは、以下の理由による。通常キャッシ
ュメモリのリプレースはエントリ単位で行われるが、エ
ントリに含まれる複数のブロック全てにダーティビット
がリセットされていなければ、当該データはフラッシュ
メモリに存在するためキャッシュメモリ2から消去して
も問題はない。このため、リードだけが行われライトが
行われないのでフラッシュメモリに書き戻す必要がな
い。
The reason is as follows. Normally, replacement of the cache memory is performed in entry units. However, if the dirty bit is not reset in all the blocks included in the entry, the data exists in the flash memory, so there is no problem even if it is erased from the cache memory 2. Absent. Therefore, it is not necessary to write back to the flash memory because only reading is performed and writing is not performed.

【0025】次に、ダーティビットがエントリ内で1つ
以上セットされている場合は、もしそのエントリにダー
ティビットがセットされていないブロックがあると、そ
こには今後セットされる可能性がある。このため、その
エントリをリプレースの対象として選択してフラッシュ
メモリに書き戻すと、その後ダーティビットがセットさ
れていなかったブロックに書き込み要求が発生した場合
にはフラッシュメモリから再度キャッシュメモリに読み
込みがなされ、このためそのエントリに記憶されている
データがコピーバックされるときにまたフラッシュメモ
リの消去が必要となる。従ってダーティビットが全てセ
ットされているエントリから、そしてかかるエントリが
なければその数の多いエントリから先にレプレースする
方が消去の回数は削減されることによる。
Next, if one or more dirty bits are set in an entry, and there is a block in which that dirty bit is not set, it may be set in the future. Therefore, if you select that entry as a replacement target and write it back to the flash memory, if a write request is subsequently issued to a block for which the dirty bit was not set, the flash memory is read again to the cache memory. Therefore, it is necessary to erase the flash memory again when the data stored in the entry is copied back. Therefore, it is possible to reduce the number of erasures by replacing an entry in which all dirty bits are set, and if there is no such entry, replacing the entry with the larger number first.

【0026】以上、本発明を実施例に基づき説明した
が、本発明は何も上記実施例に限定されないのは勿論で
ある。すなわち例えば、 フラッシュメモリとは、書き込みに際してその内容の
如何によっては消去が必要な不揮発性メモリという意味
であり、EPPROM(electrically programamable read onl
y memory) 、EEPROM(electrically erasable) 等をも含
む。 実施例では、0から1への書き込みは消去なしにはで
きないものとしたが、逆に1から0への書き込みが消去
なしにはできないものであってもよい。 本発明を採用したシステムとして、CPUの主記憶装
置としてフラッシュメモリを採用し、更にキャッシュメ
モリを有する計算機を例にとって説明したが、これも何
も計算機に限定されず、主記憶装置とその予備の記憶装
置とを有する純粋なファイルシステムとしてもよい。ま
た、CPUの主記憶装置の全てがフラッシュメモリでな
く、フラッシュメモリを採用している部分についてのみ
本発明を採用するものであってもよい。予備の記憶装置
は、部分的にはキャッシュメモリ以外の他のものであっ
てもよい。 キャッシュメモリのダーティビットは1つのブロック
に1つ持つものとしているが、これも消去の際の一単位
をどのようにするかや記憶するデータの内容によって、
2ブロックに1つ等、適宜最適な方式が選択されえるの
は勿論である。 請求項3及び請求項4の発明におけるフラッシュメモ
リへ書き込みデータとキャッシュメモリ上のデータとを
比較するステップの内容としては、各データのビット値
が0か1を直接比較すること、キャッシュメモリのブロ
ック毎のダーティビットにより間接的に比較することの
他、書き込みが全く新しい入力データであるためキャッ
シュメモリに比較対象となるデータがないような場合の
検出等をも含む概念であるのは当然である。 請求項3及び請求項4の発明におけるコヒーレンシプ
ロトコルとしては、基本的にはライトスルー方式とコピ
ーバック方式であるが、全ての主記憶がフラッシュメモ
リとは限らないこと、全くの新規発生データの書き込み
がありえること、銀行における預金者リストのごとく重
要なデータは主記憶が複数あること等のため、適宜小変
更がなされてもよいのは勿論である。
Although the present invention has been described above based on the embodiments, it goes without saying that the present invention is not limited to the above embodiments. That is, for example, flash memory means a non-volatile memory that needs to be erased depending on the contents when writing, and EPPROM (electrically programmable read onl
y memory), EEPROM (electrically erasable), etc. are also included. In the embodiment, writing from 0 to 1 cannot be done without erasing, but conversely, writing from 1 to 0 cannot be done without erasing. As a system adopting the present invention, a computer in which a flash memory is adopted as a main memory of a CPU and a cache memory is further described as an example. However, this is not limited to any computer, and the main memory and its spare It may be a pure file system having a storage device. Further, the present invention may be applied only to the part that uses the flash memory instead of the flash memory for all of the main storage devices of the CPU. The spare storage device may be partially other than the cache memory. It is assumed that one block has one dirty bit in the cache memory, but this also depends on how one unit is used for erasing and the contents of the stored data.
Of course, an optimum method can be selected, such as one for every two blocks. The contents of the step of comparing the write data to the flash memory with the data in the cache memory in the inventions of claims 3 and 4 are as follows: the bit value of each data is directly compared between 0 and 1. It is natural that the concept includes not only indirectly comparing each dirty bit but also detecting when there is no data to be compared in the cache memory because the writing is completely new input data. . The coherency protocol in the inventions of claims 3 and 4 is basically a write-through method and a copy-back method, but not all the main memory is a flash memory, and writing of completely new data. However, since important data such as a depositor list in a bank has a plurality of main memories, it is a matter of course that a small change may be appropriately made.

【0027】[0027]

【発明の効果】以上説明したように各請求項の発明によ
れば、書き込みに先立ち消去が必要な不揮発性メモリに
書き込み要求が発生すると、直接的若しくは間接的に既
に書き込まれているデータと書き込もうとするデータと
を比較して、消去を必要としなければ、書き込もうとす
るデータをそのまま書き込むこととなるので、書き込み
要求によるデータの退避および消去が必ずしも発生しな
い。このため、書き込みが高速化される。
As described above, according to the invention of each claim, when a write request is issued to a non-volatile memory which needs to be erased before writing, the already written data and the written data are also written. If the data to be written is compared with the data to be written and the erasing is not necessary, the data to be written is written as it is, so that the saving and erasing of the data by the write request do not always occur. Therefore, the writing speed is increased.

【0028】また、請求項3、請求項4及び請求項5の
発明においては、フラッシュメモリにそのままオーバー
ライトできる場合には、キャッシュメモリのコヒーレン
シプロトコルをライトスルーにして、キャッシュメモリ
への書き込みと同時にフラッシュメモリへも書き込みを
行ない、オーバーライトできない場合には、そのコヒー
レンシプロトコルをコピーバックにすることにより、消
去が必要となる書き込みをまとめ、その結果不揮発性メ
モリへの書き込みが高速となる。
Further, in the inventions of claim 3, claim 4, and claim 5, when the flash memory can be directly overwritten, the coherency protocol of the cache memory is set to write-through, and at the same time writing to the cache memory is performed. When the flash memory is also written and if the overwrite cannot be performed, the coherency protocol is set to copy-back, so that the writes that need to be erased are put together, and as a result, the writing to the nonvolatile memory becomes faster.

【0029】また、請求項6及び請求項7の発明におい
ては、CPUとフラッシュメモリとの間にキャッシュメ
モリを設けた場合にリプレース要求が発生したときに、
第1にキャッシュメモリのダーティビットがセットされ
ていないエントリを優先してリプレースし、第2にダー
ティビットが全てセットされているエントリを優先して
リプレースする。これにより、フラッシュメモリの消去
(データの退避およびブロック消去)の回数を低減さ
せ、ひいてはそれへの書き込みが高速となる。
Further, in the inventions of claims 6 and 7, when a replace request is generated when a cache memory is provided between the CPU and the flash memory,
First, an entry in which the dirty bit of the cache memory is not set is replaced with priority, and secondly, an entry in which all the dirty bits are set is replaced with priority. As a result, the number of times of erasing (storing data and block erasing) of the flash memory is reduced, and in turn writing to it becomes faster.

【0030】更にまた、各請求項の発明、特に請求項
4、請求項5、請求項6及び請求項7の発明は、CPU
のフラッシュメモリへのより高速なアクセスが可能とな
る。
Furthermore, the invention of each claim, particularly the inventions of claim 4, claim 5, claim 6 and claim 7, is a CPU
It enables faster access to the flash memory.

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

【図1】本発明に係るフラッシュメモリ用の書き込み制
御装置及び制御方法の一実施例を採用した計算機システ
ムの構成図である。
FIG. 1 is a configuration diagram of a computer system adopting an embodiment of a write control device and a control method for a flash memory according to the present invention.

【図2】上記実施例の動作流れ図である。FIG. 2 is an operation flow chart of the above embodiment.

【図3】上記実施例の動作流れ図である。FIG. 3 is an operation flow chart of the above embodiment.

【図4】(a)フラッシュメモリへの書き込みに際し
て、消去が必要となるビット値の組み合わせ表である。 (b)同じく、消去が必要となる場合と不必要な場合の
既に書き込まれているデータと書き込みデータの例であ
る。
FIG. 4A is a combination table of bit values that need to be erased when writing to the flash memory. (B) Similarly, it is an example of already written data and write data when erasing is necessary and unnecessary.

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

1 CPU部 2 キャッシュメモリ 3 フラッシュメモリ 4 書き込みデータ格納部 5 読み出しデータ格納部 6 データ制御部 7 データ書き込み部 8 データ読み出し部 9 消去制御部 10 書き込み判定部 11 退避メモリ 12 コヒーレンシプロトコル制御部 13 リプレースエントリ選択部 14 エントリリプレース制御部 15 キャッシュ制御部 1 CPU part 2 Cache memory 3 Flash memory 4 Write data storage part 5 Read data storage part 6 Data control part 7 Data writing part 8 Data reading part 9 Erase control part 10 Write determination part 11 Save memory 12 Coherency protocol control part 13 Replace entry Selection unit 14 Entry replacement control unit 15 Cache control unit

Claims (7)

【特許請求の範囲】[Claims] 【請求項1】 フラッシュメモリに既に書き込まれてい
るデータと該データの書き込まれているアドレスへ新規
に書き込もうとするデータの各ビットを比較しビットの
組合せから消去が必要かどうかを判定するステップと、 前記判定の結果、消去を必要としないと判定された場合
には書き込み前の消去を省略して新規に書き込むデータ
をオーバーライトするステップとを有していることを特
徴とするフラッシュメモリ用書き込み制御方法。
1. A step of comparing data already written in a flash memory with each bit of data to be newly written in an address where the data is written, and determining whether or not erasing is necessary from a combination of bits. If the result of the determination is that erasing is not required, erasing before writing is omitted and newly written data is overwritten. Control method.
【請求項2】 フラッシュメモリと、 前記フラッシュメモリへ新規に書き込むデータおよびそ
のアドレスを格納する書き込みデータ格納部と、 新規に書き込むデータが書き込まれるべきフラッシュメ
モリ上のアドレスに既に書き込まれた上記憶されている
データを読み出すデータ読み出し部と、 前記データ読み出し部が読み出したデータを格納する読
み出しデータ格納部と、 前記書き込みデータ格納部のデータと前記読み出しデー
タ格納部のデータの相応するアドレスの各ビット値を比
較して消去を必要とするビットの組み合せの有無を判定
する書き込み判定部と、 前記書き込み判定部が消去を必要とするビットの組み合
せが無いと判定したときには、フラッシュメモリへの書
き込み前の消去を省略して新規に書き込むデータをその
まま書き込むデータ書き込み部と、 同じく前記書き込み判定部が消去が必要であると判定し
たときには、フラッシュメモリの消去されるアドレスの
データを退避させた上で消去を行わせ、消去終了後に新
規に書き込むデータおよび退避していたデータのうち必
要なものの書き込みを行わせる書き込み消去制御部とを
備えたことを特徴とするフラッシュメモリ用書き込み制
御装置。
2. A flash memory, a write data storage unit for storing data to be newly written to the flash memory and an address thereof, and a new data to be written already stored at an address on the flash memory to be written. A data reading unit for reading the stored data, a read data storing unit for storing the data read by the data reading unit, and bit values of corresponding addresses of the data of the write data storing unit and the data of the read data storing unit. And a write determination unit that determines whether or not there is a combination of bits that need to be erased, and if the write determination unit determines that there is no combination of bits that needs to be erased, erase before writing to the flash memory. Omitting and writing new data as it is Similarly, when the data write unit to be inserted and the write determination unit determine that the erase is necessary, the data of the address to be erased in the flash memory is saved and then erased. A write control device for a flash memory, comprising: a write / erase control unit for writing necessary data among the saved data.
【請求項3】 フラッシュメモリとキャッシュメモリと
コヒーレンシプロトコルによりこれら両メモリが記憶す
べきデータの一貫性を保つべく作用するコヒーレンシ部
とを有する構成において、 フラッシュメモリへ書き込むデータとキャッシュメモリ
上のデータとを比較するステップと、 前記コヒーレンシ部が採用するコヒーレンシプロトコル
を、前記判定するステップの結果に応じて所定の手順で
切り替えるステップとを有していることを特徴とするフ
ラッシュメモリ用書き込み制御方法。
3. A configuration comprising a flash memory, a cache memory, and a coherency unit which acts to maintain consistency of data to be stored in these memories by a coherency protocol, in which data to be written to the flash memory and data in the cache memory And a step of switching the coherency protocol adopted by the coherency unit in a predetermined procedure according to the result of the determining step.
【請求項4】 新規に書き込むデータとフラッシュメモ
リ上のデータとを比較して、書き込みに際しての消去の
必要性を所定の手順で判定するステップと、 前記判定の結果、消去を必要としないとされた場合には
キャッシュメモリ上の該当するエントリのコヒーレンシ
プロトコルをライトスルー方式にして、新規に書き込む
データをキャッシュメモリに書き込んだ直後にフラッシ
ュメモリにも書き込むステップと、 同じく消去を必要とすると判定された場合にはキャッシ
ュメモリ上の該当するエントリのコヒーレンシプロトコ
ルをコピーバック方式にして、新規に書き込むデータを
キャッシュメモリのみに書き込み、フラッシュメモリに
書き込むのはキャッシュメモリ上の該当するエントリが
リプレースされるときまで延期するステップとを有して
いることを特徴とする請求項3記載のフラッシュメモリ
用書き込み制御方法。
4. A step of comparing newly written data with data on the flash memory to determine the necessity of erasing at the time of writing by a predetermined procedure, and as a result of the determination, erasing is not required. If it is determined that the coherency protocol of the corresponding entry in the cache memory is set to the write-through method and the data to be newly written is written in the cache memory, it is also written in the flash memory immediately after it is determined that erasing is also required. In this case, set the coherency protocol of the corresponding entry in the cache memory to the copy back method, write the newly written data only in the cache memory, and write it in the flash memory until the corresponding entry in the cache memory is replaced. The steps to postpone 3. Flash memory write control method according to characterized in that it.
【請求項5】 キャッシュメモリと、 前記キャッシュメモリと前記フラッシュメモリとのデー
タの一貫性をコヒーレンシプロトコルに従って保持する
コヒーレンシ部と、 前記書き込み判定部の判定結果に従って前記コヒーレン
シ部の使用するコヒーレンシプロトコルを切り替えるコ
ヒーレンシプロトコル制御部とを備えたことを特徴とす
る請求項2記載のフラッシュメモリ用書き込み制御装
置。
5. A cache memory, a coherency unit that retains data consistency between the cache memory and the flash memory according to a coherency protocol, and a coherency protocol used by the coherency unit according to a determination result of the write determination unit. 3. The flash memory write controller according to claim 2, further comprising a coherency protocol controller.
【請求項6】 キャッシュメモリ上のデータがフラッシ
ュメモリ上のデータと一致していない場合にはその旨を
表すダーティビットをセットするステップと、キャッシ
ュメモリのエントリのリプレースが必要になった場合
に、ダーティビットがセットされていないエントリがレ
プレースの対象として優先して選択されるステップと、 ダーティビットがセットされていないエントリがないと
きには、エントリ内の全てにダーティビットがセットさ
れているエントリが次に優先して選択されるステップ
と、 ダーティビットがセットされていないエントリが選択さ
れたときはフラッシュメモリ上のリプレースの対象とな
っているデータをキャッシュメモリ上の当該エントリに
オーバーライトし、リプレースされるキャッシュメモリ
のエントリに記憶されていたデータはフラッシュメモリ
に書き戻さないステップと、 ダーティビットが全てセットされているエントリが選択
されたときは、当該エントリに記憶されているデータを
フラッシュメモリ上に書き戻し、フラッシュメモリ上の
リプレースの対象となっているデータを新たにキャッシ
ュメモリのリプレースされるべきエントリに書き込むス
テップとを有していることを特徴とする請求項4に記載
のフラッシュメモリ用書き込み制御方法。
6. The step of setting a dirty bit indicating that the data on the cache memory does not match the data on the flash memory, and the replacement of the entry of the cache memory is required, The step of preferentially selecting an entry for which the dirty bit is not set for replacement, and when there is no entry for which the dirty bit is not set, the entry with the dirty bit set for all is next. Steps that are selected with priority, and when an entry for which the dirty bit is not set is selected, the data that is the target of replacement in flash memory is overwritten in the entry in cache memory and replaced. Stored in cache memory entry If the entry in which all the dirty bits are set is selected, the data stored in the entry is written back to the flash memory and the step of not writing back the stored data to the flash memory. 5. The flash memory write control method according to claim 4, further comprising the step of writing data to be replaced to a new entry in the cache memory to be replaced.
【請求項7】 前記コヒーレンシ部の制御のもとでキャ
ッシュメモリ上のデータがフラッシュメモリ上のデータ
と一致していない場合には、その旨を表すダーティビッ
トをセットするダーティビットセット部と、 キャッシュメモリのエントリのリプレースが必要になっ
た場合に、ダーティビットがセットされていないエント
リをリプレースの対象として優先して選択し、かかるエ
ントリがないときは、全てのダーティビットがセットさ
れているエントリを次に優先して選択するリプレースエ
ントリ選択部と、 前記リプレースエントリ選択部がダーティビットがセッ
トされていないエントリを選択したときは、フラッシュ
メモリ上のリプレースの対象となっているデータをキャ
ッシュメモリ上の当該エントリにオーバーライトし、リ
プレースされるキャッシュメモリのエントリに記憶され
ていたデータはフラッシュメモリに書き戻さず、全ての
ビットにダーティビットがセットされているエントリが
選択されたときは、当該エントリに記憶されているデー
タをフラッシュメモリ上に書き戻し、フラッシュメモリ
上のリプレースの対象となっているデータを新たにキャ
ッシュメモリのリプレースされるべきエントリに書き込
むエントリリプレース制御部とを備えたことを特徴とす
る請求項5記載のフラッシュメモリ用書き込み制御装
置。
7. When the data in the cache memory does not match the data in the flash memory under the control of the coherency unit, a dirty bit setting unit for setting a dirty bit indicating that, and a cache When a memory entry needs to be replaced, the entry for which the dirty bit is not set is preferentially selected for replacement, and if there is no such entry, the entry for which all dirty bits are set is selected. Next, when the replacement entry selection unit that preferentially selects and the replacement entry selection unit selects an entry in which the dirty bit is not set, the data that is the replacement target on the flash memory is stored on the cache memory. The entry is overwritten and replaced. The data stored in the cache memory entry is not written back to the flash memory, and when the entry with the dirty bit set in all bits is selected, the data stored in the entry is stored in the flash memory. 6. The flash memory according to claim 5, further comprising: an entry replacement controller that writes back the data to be replaced in the flash memory to an entry to be newly replaced in the cache memory. Write control device.
JP13465693A 1993-06-04 1993-06-04 Writing controller and control method for flash memory Pending JPH06349286A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP13465693A JPH06349286A (en) 1993-06-04 1993-06-04 Writing controller and control method for flash memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP13465693A JPH06349286A (en) 1993-06-04 1993-06-04 Writing controller and control method for flash memory

Publications (1)

Publication Number Publication Date
JPH06349286A true JPH06349286A (en) 1994-12-22

Family

ID=15133485

Family Applications (1)

Application Number Title Priority Date Filing Date
JP13465693A Pending JPH06349286A (en) 1993-06-04 1993-06-04 Writing controller and control method for flash memory

Country Status (1)

Country Link
JP (1) JPH06349286A (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000090678A (en) * 1998-09-10 2000-03-31 Hitachi Ltd Nonvolatile memory and system
JP2003036201A (en) * 2001-07-24 2003-02-07 Sony Corp Memory access management device
JP2003234000A (en) * 2002-02-08 2003-08-22 Matsushita Electric Ind Co Ltd Semiconductor integrated circuit device, ic card, and test device
EP1653340A1 (en) 2004-10-27 2006-05-03 Sony Corporation Storage device and information processing system
JP2007528079A (en) * 2004-03-08 2007-10-04 サンディスク コーポレイション Flash controller cache structure
JP2008242944A (en) * 2007-03-28 2008-10-09 Toshiba Corp Integrated memory management device and method
JP2009020833A (en) * 2007-07-13 2009-01-29 Internatl Business Mach Corp <Ibm> Technology for caching data
US7571282B2 (en) 2005-07-29 2009-08-04 Sony Corporation Computer system having a flash memory storage device
JP2010097333A (en) * 2008-10-15 2010-04-30 Tdk Corp Memory controller, flash memory system equipped with memory controller and method for controlling flash memory
US7779199B2 (en) 2005-10-20 2010-08-17 Sony Corporation Storage device, computer system, and data writing method
US9076533B2 (en) 2012-05-30 2015-07-07 Samsung Electronics Co., Ltd. Method of reprogramming nonvolatile memory comprising marking some cells as blanks

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000090678A (en) * 1998-09-10 2000-03-31 Hitachi Ltd Nonvolatile memory and system
JP2003036201A (en) * 2001-07-24 2003-02-07 Sony Corp Memory access management device
JP2003234000A (en) * 2002-02-08 2003-08-22 Matsushita Electric Ind Co Ltd Semiconductor integrated circuit device, ic card, and test device
JP2007528079A (en) * 2004-03-08 2007-10-04 サンディスク コーポレイション Flash controller cache structure
US9678877B2 (en) 2004-03-08 2017-06-13 Sandisk Technologies Llc Flash controller cache architecture
EP1653340A1 (en) 2004-10-27 2006-05-03 Sony Corporation Storage device and information processing system
US7571282B2 (en) 2005-07-29 2009-08-04 Sony Corporation Computer system having a flash memory storage device
US7779199B2 (en) 2005-10-20 2010-08-17 Sony Corporation Storage device, computer system, and data writing method
US7890695B2 (en) 2005-10-20 2011-02-15 Sony Corporation Storage device, computer system, and data writing method
JP2008242944A (en) * 2007-03-28 2008-10-09 Toshiba Corp Integrated memory management device and method
JP2009020833A (en) * 2007-07-13 2009-01-29 Internatl Business Mach Corp <Ibm> Technology for caching data
JP2010097333A (en) * 2008-10-15 2010-04-30 Tdk Corp Memory controller, flash memory system equipped with memory controller and method for controlling flash memory
JP4632180B2 (en) * 2008-10-15 2011-02-16 Tdk株式会社 MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
US9076533B2 (en) 2012-05-30 2015-07-07 Samsung Electronics Co., Ltd. Method of reprogramming nonvolatile memory comprising marking some cells as blanks

Similar Documents

Publication Publication Date Title
KR100725390B1 (en) Apparatus and method for storing data in nonvolatile cache memory considering update ratio
US6038636A (en) Method and apparatus for reclaiming and defragmenting a flash memory device
JP5192228B2 (en) Flash controller cache structure
JP4058322B2 (en) Memory card
US8041878B2 (en) Flash file system
US7698495B2 (en) Computer system having logically ordered cache management
US20070016719A1 (en) Memory device including nonvolatile memory and memory controller
US10496334B2 (en) Solid state drive using two-level indirection architecture
US20030110343A1 (en) File system including non-volatile semiconductor memory device having a plurality of banks
US20130103889A1 (en) Page-buffer management of non-volatile memory-based mass storage devices
JP2004318940A (en) Storage device
JP5536655B2 (en) Cache memory, memory system, and data copy method
US8909870B2 (en) Cache evictions from data cache based on content of address translation table cache and address translation table
JP2013200889A (en) Hybrid solid-state memory system having volatile memory and non-volatile memory
KR100787856B1 (en) Method for changing page in flash memory storage
US20100318726A1 (en) Memory system and memory system managing method
JPH06349286A (en) Writing controller and control method for flash memory
JP2001147855A (en) Method for writing data in non-volatile memory and information processor and recording medium
JP4175881B2 (en) Nonvolatile memory storage method and storage device
JP5036078B2 (en) Storage device
US20200394131A1 (en) Data storage device and non-volatile memory control method
JPH11272569A (en) Data restoration system for outer storage device using flash memory
JP4183237B2 (en) Storage device
JP3123274B2 (en) Memory programming equipment
US20220164135A1 (en) Apparatus, method and computer program for managing memory page updates within non-volatile memory