JP2006318303A - Memory controller, flash memory system, and control method for flash memory - Google Patents

Memory controller, flash memory system, and control method for flash memory Download PDF

Info

Publication number
JP2006318303A
JP2006318303A JP2005141680A JP2005141680A JP2006318303A JP 2006318303 A JP2006318303 A JP 2006318303A JP 2005141680 A JP2005141680 A JP 2005141680A JP 2005141680 A JP2005141680 A JP 2005141680A JP 2006318303 A JP2006318303 A JP 2006318303A
Authority
JP
Japan
Prior art keywords
data
flash memory
block
memory controller
checksum
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
JP2005141680A
Other languages
Japanese (ja)
Other versions
JP4332134B2 (en
Inventor
Shunichi Hanabusa
俊一 花房
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.)
TDK Corp
Original Assignee
TDK Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by TDK Corp filed Critical TDK Corp
Priority to JP2005141680A priority Critical patent/JP4332134B2/en
Publication of JP2006318303A publication Critical patent/JP2006318303A/en
Application granted granted Critical
Publication of JP4332134B2 publication Critical patent/JP4332134B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Storage Device Security (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a control method for a flash memory for detecting data which is rewritten by an illegal means, and also to provide a memory controller, and a flash memory system equipped with the memory controller. <P>SOLUTION: The memory controller comprises a writing means of writing data to the flash memory in response to an instruction from a host system using the flash memory as a storage medium, a reading means of reading the data written to the flash memory by the writing means in response to an instruction from the host system, and a check sum calculating means of finding a check sum value by sectioning the data read by the reading means into specified numbers of bits and adding them one after another in response to an instruction from the host system. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、メモリコントローラ及び当該メモリコントローラを備えるフラッシュメモリシステムに関する。   The present invention relates to a memory controller and a flash memory system including the memory controller.

パーソナルコンピュータ等のCPU(Central Processing Unit)を備えた装置は、その動作を定義するプログラム等のデータを、不揮発性の記録媒体に格納している。そして、装置を起動する際、当該記録媒体に格納されたプログラム等を読み出して実行することにより、所定の動作を実現する。従来、このような用途に用いられる記録媒体として、ROM(Read Only Memory)やハードディスクが用いられることが多かった。   An apparatus having a CPU (Central Processing Unit) such as a personal computer stores data such as a program that defines its operation in a nonvolatile recording medium. When the apparatus is started, a predetermined operation is realized by reading and executing a program stored in the recording medium. Conventionally, ROM (Read Only Memory) and hard disks are often used as recording media for such applications.

しかし、近年、フラッシュメモリの性能(記憶容量、信頼性、動作速度等)が向上し、上述のような不揮発性の記録媒体として、プログラム等を格納する用途に用いられつつある。   However, in recent years, the performance (storage capacity, reliability, operation speed, etc.) of flash memory has been improved, and it is being used for the purpose of storing programs and the like as a nonvolatile recording medium as described above.

ところで、上述の用途にフラッシュメモリを用いる場合、データの書き換え途中での電源断等のトラブルによりデータが正常に書き込まれない状況が生じると、当該データに従って動作する装置は、所望の動作ができなくなるおそれがある。   By the way, when a flash memory is used for the above-mentioned application, if a situation occurs in which data is not normally written due to a trouble such as a power cut during data rewriting, a device that operates according to the data cannot perform a desired operation. There is a fear.

このような問題を回避するため、データの書き換え後に、チェックサムが期待値と整合しているかを確認し、整合していない場合には、意図せぬプログラムを実行しないように所定の動作をする手法が提案されている(例えば特許文献1を参照)。
特開2004−355064号公報
To avoid such problems, after rewriting data, check whether the checksum matches the expected value, and if it does not match, perform a predetermined operation so that an unintended program is not executed. A method has been proposed (see, for example, Patent Document 1).
JP 2004-355064 A

しかしながら、フラッシュメモリに格納されたデータが、不正により書き換られた場合、当該データに従って動作する装置が意図せぬ動作をするおそれがある。   However, when the data stored in the flash memory is rewritten illegally, a device that operates according to the data may perform an unintended operation.

本発明は上記の実情に鑑みてなされてもので、データが不正な手段により書き換られたことを検出できるフラッシュメモリの制御方法、メモリコントローラ及び当該メモリコントローラを備えるフラッシュメモリシステムを提供することを目的とする。   The present invention has been made in view of the above circumstances, and provides a flash memory control method, a memory controller, and a flash memory system including the memory controller, which can detect that data has been rewritten by unauthorized means. Objective.

本発明の第1の観点に係るメモリコントローラは、フラッシュメモリを記憶媒体として利用するホストシステムからの命令に応答して、前記フラッシュメモリのユーザ領域にデータを書き込むとともに、前記フラッシュメモリの冗長領域に記録されたデータの管理に用いる付加的なデータを書き込む、書き込み手段と、前記ホストシステムからの命令に応答して、前記書き込み手段によって前記ユーザ領域に記録されたデータと前記冗長領域に記録されたデータとを読み出す、読み出し手段と、前記ホストシステムからの命令に応答して、前記読み出し手段によって読み出された前記ユーザ領域に記録されたデータと前記冗長領域に記録されたデータとを所定のビット毎に区切って順次加算してチェックサム値を求めるチェックサム算出手段と、から構成される、ことを特徴とする。
なお、本発明において、ホストシステムとは、フラッシュメモリを記録媒体として利用する装置を指すものとする。
また、本発明において、ユーザ領域とは、ホストシステムが利用するデータが記録される領域を指し、冗長領域とは、ユーザ領域に記録されたデータの管理に用いる付加的な情報が記録される領域を指すものとする。
A memory controller according to a first aspect of the present invention writes data in a user area of the flash memory in response to an instruction from a host system that uses the flash memory as a storage medium, and stores the data in a redundant area of the flash memory. Write additional data used to manage the recorded data, writing means, and data recorded in the user area and the redundant area by the writing means in response to an instruction from the host system A read means for reading data, and in response to a command from the host system, the data recorded in the user area and the data recorded in the redundant area read by the read means in a predetermined bit Checksum calculation means that obtains a checksum value by dividing and adding each item sequentially Characterized constructed, that from.
In the present invention, the host system refers to a device that uses a flash memory as a recording medium.
In the present invention, the user area refers to an area where data used by the host system is recorded, and the redundant area refers to an area where additional information used for managing data recorded in the user area is recorded. Shall be pointed to.

メモリコントローラは、予め定められたチェックサム期待値と、前記チェックサム算出手段が算出するチェックサム値とを照合し、照合結果情報を前記ホストシステムに出力するチェックサム照合手段を更に有してもよい。   The memory controller further includes a checksum collating unit that collates a predetermined expected checksum value with a checksum value calculated by the checksum calculating unit and outputs collation result information to the host system. Good.

メモリコントローラは、所定のパスワードを記憶し、当該所定のパスワードと前記ホストシステムから供給されるパスワードとが一致するか否かを判別する、パスワード照合手段を更に有し、前記チェックサム算出手段は、前記パスワード照合手段が、当該所定のパスワードと前記ホストシステムから供給されるパスワードとが一致すると判別した場合にチェックサム値を算出してもよい。
これにより、不正にチェックサム値を得ることを防止できる。
The memory controller stores a predetermined password, and further includes a password verification unit that determines whether or not the predetermined password matches the password supplied from the host system, and the checksum calculation unit includes: The checksum value may be calculated when the password verification unit determines that the predetermined password matches the password supplied from the host system.
This can prevent the checksum value from being obtained illegally.

前記チェックサム算出手段は、前記冗長領域のデータのうち、特定の領域に書き込まれたデータを所定の値に置換し、置換した後のデータを所定のビット数毎に区切って順次加算してチェックサム値を算出してもよい。   The checksum calculation means replaces the data written in a specific area of the data in the redundant area with a predetermined value, and sequentially adds the data after being divided into predetermined bits. A sum value may be calculated.

前記チェックサム算出手段は、データを区切る所定のビット数を、前記ホストシステムからの命令に応じて変更してもよい。   The checksum calculation means may change a predetermined number of bits separating the data in accordance with an instruction from the host system.

前記書き込み手段は、誤り訂正符号を付加したデータをフラッシュメモリに書き込み、前記読み出し手段は、読み出したデータに付加されている誤り訂正符号に基づいて誤りを訂正し、前記チェックサム算出手段は、誤りが訂正されたデータを所定のビット毎に区切って順次加算してチェックサム値を算出してもよい。   The writing means writes data with an error correction code added to a flash memory, the reading means corrects an error based on an error correction code added to the read data, and the checksum calculation means The checksum value may be calculated by dividing the corrected data into predetermined bits and sequentially adding the data.

本発明の第2の観点に係るフラッシュメモリシステムは、上記の特徴のうち少なくともいずれか一つを有するメモリコントローラと、フラッシュメモリとを備えることを特徴とする。   A flash memory system according to a second aspect of the present invention includes a memory controller having at least one of the above characteristics and a flash memory.

本発明の第3の観点に係るフラッシュメモリの制御方法は、フラッシュメモリからデータを読み出す読み出しステップと、前記読み出しステップで読み出されたデータを所定のビット毎に区切って順次加算してチェックサム値を求めるチェックサム算出ステップと、前記チェックサム算出ステップで算出されたチェックサム値に基づいて、データが書き換えられたか否かを判定する判定ステップと、から構成される、ことを特徴とする。   A flash memory control method according to a third aspect of the present invention includes a read step for reading data from a flash memory, and a checksum value obtained by sequentially adding the data read in the read step in a predetermined bit interval And a determination step for determining whether or not the data has been rewritten based on the checksum value calculated in the checksum calculation step.

本発明によれば、フラッシュメモリから読み出したデータを所定のビット毎に区切って加算することで得られるチェックサム値によって、データが不正な手段により書き換られたことを検出できる。   According to the present invention, it is possible to detect that data has been rewritten by an illegal means by using a checksum value obtained by dividing and adding data read from the flash memory every predetermined bit.

以下、図面に基づき、本発明の実施の形態について詳細に説明する。   Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.

[フラッシュメモリシステム1の説明]
図1は、本発明に係るフラッシュメモリシステム1を概略的に示すブロック図である。図1に示したようにフラッシュメモリシステム1は、フラッシュメモリ2と、それを制御するコントローラ3で構成されている。
[Description of flash memory system 1]
FIG. 1 is a block diagram schematically showing a flash memory system 1 according to the present invention. As shown in FIG. 1, the flash memory system 1 includes a flash memory 2 and a controller 3 that controls the flash memory 2.

なお、フラッシュメモリシステム1は、外部バス13を介してホストシステム4と接続される。ホストシステム4は、ホストシステム4の全体の動作を制御するためのCPU(Central Processing Unit)、フラッシュメモリシステム1との情報の授受を担うコンパニオンチップ等から構成される。ホストシステム4は、例えば、文字、音声、あるいは画像情報等の種々の情報を処理するパーソナルコンピュータやデジタルスチルカメラをはじめとする各種情報処理装置であってもよい。   The flash memory system 1 is connected to the host system 4 via the external bus 13. The host system 4 includes a CPU (Central Processing Unit) for controlling the entire operation of the host system 4, a companion chip for transferring information to and from the flash memory system 1, and the like. The host system 4 may be various information processing apparatuses such as a personal computer and a digital still camera that process various types of information such as characters, sounds, and image information.

コントローラ3は、マイクロプロセッサ6と、ホストインターフェースブロック7と、ワークエリア8と、バッファ9と、フラッシュメモリインターフェースブロック10と、ECC(エラー・コレクション・コード)ブロック11と、ROM(Read Only Memory)12と、から構成される。これら機能ブロックによって構成されるコントローラ3は、一つの半導体チップ上に集積される。以下に各機能ブロックについて説明する。   The controller 3 includes a microprocessor 6, a host interface block 7, a work area 8, a buffer 9, a flash memory interface block 10, an ECC (Error Collection Code) block 11, and a ROM (Read Only Memory) 12. And. The controller 3 constituted by these functional blocks is integrated on one semiconductor chip. Each functional block will be described below.

マイクロプロセッサ6は、ROM12に記録されたプログラムに従って、コントローラ3の全体の動作を制御する。具体的には、マイクロプロセッサ6は、フラッシュメモリ2にデータを書き込むための書き込み処理、データを読み出すための読み出し処理、チェックサム値を算出するためのチェックサム処理、アドレス変換テーブルの作成、消去済ブロック検索用テーブルの作成等の処理を実行するように各部を制御する。   The microprocessor 6 controls the overall operation of the controller 3 according to the program recorded in the ROM 12. Specifically, the microprocessor 6 performs a write process for writing data to the flash memory 2, a read process for reading data, a checksum process for calculating a checksum value, creation of an address conversion table, and erased Each unit is controlled to execute processing such as creation of a block search table.

ホストインターフェースブロック7は、ホストシステム4とデータ、アドレス情報、ステータス情報、外部コマンド情報等の授受を行なう。すなわち、フラッシュメモリシステム1とホストシステム4は、外部バス13を介して相互に接続される。かかる状態において、ホストシステム4よりフラッシュメモリシステム1に供給されるデータ等は、ホストインターフェースブロック7を入口としてコントローラ3の内部に取り込まれ、フラッシュメモリシステム1からホストシステム4に供給されるデータ等は、ホストインターフェースブロック7を出口としてホストシステム4に供給される。   The host interface block 7 exchanges data, address information, status information, external command information, and the like with the host system 4. That is, the flash memory system 1 and the host system 4 are connected to each other via the external bus 13. In such a state, the data supplied from the host system 4 to the flash memory system 1 is taken into the controller 3 through the host interface block 7 and the data supplied from the flash memory system 1 to the host system 4 is The host interface block 7 is supplied to the host system 4 as an exit.

より詳細には、ホストインターフェースブロック7は、ホストシステム4より供給される外部コマンドを一時的に格納するコマンドレジスタ、書き込み又は読み出しを行うデータのサイズを格納するセクタ数レジスタ、書き込み又は読み出しを行うデータの論理ブロックアドレスを格納するLBA(Logical Block Addressing)レジスタ、等を有する。そして、これらのレジスタを介してホストシステム4との情報の授受を行う。   More specifically, the host interface block 7 includes a command register that temporarily stores an external command supplied from the host system 4, a sector number register that stores the size of data to be written or read, and data to be written or read. And an LBA (Logical Block Addressing) register for storing the logical block address. Information is exchanged with the host system 4 via these registers.

ワークエリア8は、フラッシュメモリ2の制御に必要なデータが一時的に格納される作業領域であり、複数のSRAM(Static Random Access Memory)セルによって構成される。   The work area 8 is a work area in which data necessary for controlling the flash memory 2 is temporarily stored, and is composed of a plurality of SRAM (Static Random Access Memory) cells.

バッファ9は、フラッシュメモリ2から読み出したデータ及びフラッシュメモリ2に書き込むデータを一時的に保持する。   The buffer 9 temporarily holds data read from the flash memory 2 and data to be written to the flash memory 2.

フラッシュメモリインターフェースブロック10は、内部バス14を介して、フラッシュメモリ2とデータ、アドレス情報、ステータス情報、内部コマンド情報等の授受を行う。   The flash memory interface block 10 exchanges data, address information, status information, internal command information, and the like with the flash memory 2 via the internal bus 14.

ECCブロック11は、フラッシュメモリ2に書き込むデータに付加されるエラーコレクションコードを生成するとともに、読み出しデータに付加されたエラーコレクションコードに基づいて、読み出したデータに含まれる誤りを検出・訂正する。   The ECC block 11 generates an error correction code added to data to be written to the flash memory 2 and detects and corrects an error included in the read data based on the error correction code added to the read data.

ROM12は、マイクロプロセッサ6による処理の手順を定義するプログラムを格納する不揮発性の記憶素子である。また、ROM12は、上記のプログラムの他、チェックサム処理において用いられるパスワードを格納する。   The ROM 12 is a non-volatile storage element that stores a program that defines a processing procedure performed by the microprocessor 6. In addition to the above program, the ROM 12 stores a password used in the checksum process.

[フラッシュメモリの説明]
次に、フラッシュメモリ2について説明する。図2は、フラッシュメモリ2のメモリ構造を概略的に示す図である。図2に示したように、フラッシュメモリ2はデータの読み出し及び書き込みにおける処理単位であるページと、データの消去単位であるブロックで構成されている。
[Description of flash memory]
Next, the flash memory 2 will be described. FIG. 2 is a diagram schematically showing a memory structure of the flash memory 2. As shown in FIG. 2, the flash memory 2 includes a page that is a processing unit for reading and writing data and a block that is a data erasing unit.

上記ページは、例えば、512バイトのユーザ領域25と、16バイトの冗長領域26によって構成される。ユーザ領域25は、主に、ホストシステム4から供給されるデータが格納される領域であり、冗長領域26は、エラーコレクションコード、ブロックステータス、対応論理ブロックアドレス、新旧識別情報等の付加情報が格納される領域である。   The page is composed of a 512-byte user area 25 and a 16-byte redundant area 26, for example. The user area 25 is an area mainly storing data supplied from the host system 4, and the redundant area 26 stores additional information such as an error collection code, a block status, a corresponding logical block address, and old and new identification information. It is an area to be done.

エラーコレクションコードは、ユーザ領域25及び冗長領域26に格納されたデータに含まれる誤りを訂正するための付加情報であり、ECCブロック11によって生成される。このエラーコレクションコードに基づき、ユーザ領域25及び冗長領域26に格納されたデータに含まれる誤りが所定数以下であれば、その誤りが訂正される。   The error collection code is additional information for correcting an error included in the data stored in the user area 25 and the redundant area 26 and is generated by the ECC block 11. Based on the error collection code, if the number of errors included in the data stored in the user area 25 and the redundant area 26 is equal to or less than a predetermined number, the error is corrected.

ブロックステータスは、そのブロックが不良ブロック(正常にデータの書き込み等を行なうことができないブロック)であるか否かを示すフラグであり、そのブロックが不良ブロックであると判断された場合には、不良ブロックであることを示すフラグが設定される。   The block status is a flag indicating whether or not the block is a bad block (a block in which data cannot be normally written). If it is determined that the block is a bad block, the block status is bad. A flag indicating a block is set.

対応論理ブロックアドレスは、そのブロックにデータが格納されている場合に、そのブロックがどの論理ブロックアドレスに対応するかを示している。なお、そのブロックにデータが格納されていない場合は、対応論理ブロックアドレスも格納されていないので、対応論理ブロックアドレスが格納されているか否かで、そのブロックが消去済ブロックであるか否かを判断することができる。つまり、対応論理ブロックアドレスが格納されていない場合は消去済ブロックであると判断できる。   The corresponding logical block address indicates to which logical block address the block corresponds when data is stored in the block. If no data is stored in the block, the corresponding logical block address is not stored, so whether the corresponding logical block address is stored or not is determined whether the block is an erased block. Judgment can be made. That is, when the corresponding logical block address is not stored, it can be determined that the block is an erased block.

新旧識別情報は、そのブロックの対応論理ブロックアドレスに書き込まれたデータの更新順序の先後を識別するための情報である。例えば、新旧識別情報は、同一の論理ブロックアドレスに対応するブロックのデータが更新される度に、1ずつ加算される。そして、データの更新途中に電源が切断される等により、同一の対応論理ブロックアドレスをもつブロックが並存した場合には、新旧識別情報の値が大きいブロックのデータが最新のデータとして識別される。   The old and new identification information is information for identifying the update order of data written to the corresponding logical block address of the block. For example, the new / old identification information is incremented by one each time the data of the block corresponding to the same logical block address is updated. Then, when blocks having the same corresponding logical block address coexist due to the power being cut off during the data update, the data of the block having a large new / old identification information value is identified as the latest data.

本実施の形態のフラッシュメモリ2では、図3に示すように、各情報を割り当てるものとする。すなわち、新旧識別情報には最上位の1バイトが割り当てられる。また、対応論理ブロックアドレスには、次の2バイトが割り当てられる。また、ブロックステータスには次の1バイトが割り当てられる。また、ユーザ領域25に書き込まれているデータに含まれる誤りを訂正するためのエラーコレクションコードには次の10バイトが割り当てられる。また、冗長領域26に書き込まれている対応論理ブロックアドレスに含まれる誤りを検出・訂正するためのエラーコレクションコードには、次の2バイトが割り当てられる。   In the flash memory 2 of the present embodiment, each information is assigned as shown in FIG. That is, the most significant 1 byte is assigned to the new and old identification information. Further, the next 2 bytes are assigned to the corresponding logical block address. The next 1 byte is assigned to the block status. Further, the next 10 bytes are assigned to an error collection code for correcting an error included in the data written in the user area 25. Further, the next two bytes are assigned to the error correction code for detecting and correcting the error included in the corresponding logical block address written in the redundant area 26.

[論理ブロックアドレスと物理ブロックアドレスの説明]
フラッシュメモリ2はデータの上書きができないため、データの書き換えを行なう場合には、ブロック消去されている消去済ブロックに新たなデータ(書き換え後のデータ)を書き込み、古いデータ(書き換え前のデータ)が書き込まれていたブロックを消去するという2段階の処理を行なわなければならない。このとき、消去はブロック単位で処理されるため、古いデータ(書き換え前のデータ)が書き込まれていたページが含まれるブロックの、全ページのデータが消去されてしまう。従って、データの書き換えを行なう場合、書き換えるページが含まれるブロックの、他のページのデータについても、消去済ブロックに移動させる処理が必要となる。
[Description of logical block address and physical block address]
Since the flash memory 2 cannot overwrite data, when data is rewritten, new data (data after rewriting) is written to the erased block that has been erased, and old data (data before rewriting) is written. A two-stage process of erasing the written block must be performed. At this time, since erasure is processed in units of blocks, data of all pages in a block including a page in which old data (data before rewriting) is written is erased. Therefore, when data is rewritten, it is necessary to perform processing for moving the data of other pages of the block including the page to be rewritten to the erased block.

上記のようにデータを書き換える場合、書き換え後のデータは書き換え前と異なるブロックに書き込まれるため、ホストシステム4側から与えられる論理ブロックアドレスと、フラッシュメモリ2内でのブロックアドレスである物理ブロックアドレスとの対応関係は、データを書き換える毎に動的に変化する。このため、論理ブロックアドレスと物理ブロックアドレスの対応関係を示したアドレス変換テーブルが必要となる。なお、このアドレス変換テーブルは、フラッシュメモリ2の冗長領域26に書き込まれている対応論理ブロックアドレスに基づいて作成され、データが書き換えられる毎に、その書き換えに関わった部分の対応関係が更新される。   When data is rewritten as described above, since the data after rewriting is written in a different block from that before rewriting, a logical block address given from the host system 4 side and a physical block address which is a block address in the flash memory 2 The correspondence relationship changes dynamically every time data is rewritten. For this reason, an address conversion table showing the correspondence between logical block addresses and physical block addresses is required. This address conversion table is created based on the corresponding logical block address written in the redundant area 26 of the flash memory 2, and each time data is rewritten, the correspondence relationship of the part involved in the rewriting is updated. .

[ゾーンの構成の説明]
次に、フラッシュメモリ2内の複数のブロックで構成したゾーンを、論理ブロックアドレスの空間に割当てるゾーン管理について図面を参照して説明する。図4は、512のブロックでゾーンを構成した例を示している。図4に示した例では、ゾーンは、512のブロックB0000〜B0511(物理ブロックアドレスの0000〜0511)で構成され、各ブロックは、読み出し及び書き込み処理の単位である32のページP00〜P31で構成されている。ここで、ブロックは消去処理の単位であり、ページは読み出し及び書き込み処理の単位である。
[Description of zone configuration]
Next, zone management for assigning a zone composed of a plurality of blocks in the flash memory 2 to a logical block address space will be described with reference to the drawings. FIG. 4 shows an example in which a zone is configured by 512 blocks. In the example shown in FIG. 4, the zone is composed of 512 blocks B0000 to B0511 (physical block addresses 0000 to 0511), and each block is composed of 32 pages P00 to P31 which are units of read and write processing. Has been. Here, the block is a unit of erasing processing, and the page is a unit of reading and writing processing.

また、このゾーンを、論理ブロックアドレスの空間に割当てる場合、不良ブロックの発生を考慮して、ゾーンを構成するブロック数よりも少ないブロック数の論理ブロックアドレスの空間に割当てられる。この割当は、通常、フラッシュメモリ2の仕様に応じて行なわれるが、例えば、512のブロックで構成されたゾーンを、500ブロック分の論理ブロックアドレスの空間に割当てたり、490ブロック分の論理ブロックアドレスの空間に割当てたりすることができる。この際、論理ブロックアドレスの空間に割当てるブロック数を増やせば、フラッシュメモリの使用効率は良くなるが、不良ブロックの発生に対する許容量(許容できる不良ブロックの発生数)は少なくなる。
なお、本実施の形態のフラッシュメモリシステム1においては、図5に示すように、512ブロックで構成されたゾーンを、496ブロック分の論理ブロックアドレスの空間に割当てるものとする。
In addition, when this zone is allocated to a logical block address space, it is allocated to a logical block address space having a smaller number of blocks than the number of blocks constituting the zone in consideration of the occurrence of defective blocks. This allocation is normally performed according to the specifications of the flash memory 2. For example, a zone composed of 512 blocks is allocated to a logical block address space of 500 blocks, or a logical block address of 490 blocks. Can be assigned to the space. At this time, if the number of blocks allocated to the space of the logical block address is increased, the use efficiency of the flash memory is improved, but the allowable amount for the generation of defective blocks (the allowable number of defective blocks generated) is reduced.
In the flash memory system 1 according to the present embodiment, as shown in FIG. 5, a zone composed of 512 blocks is assigned to a space of logical block addresses for 496 blocks.

[アドレス変換テーブルの説明]
次に、アドレス変換テーブルについて、説明する。アドレス変換テーブルは、論理ブロックアドレスと物理ブロックアドレスの対応関係と、論理ブロックアドレスと新旧識別情報の対応関係とを一括して管理する。
図6は、図5に示したゾーン0に対するアドレス変換テーブルの一例を示したものであり、各論理ブロックアドレスに対応するデータが格納されているフラッシュメモリ2内での物理ブロックアドレスと、当該物理ブロックアドレスに格納されたデータの新旧識別情報とが、論理ブロックアドレス順に記述されている。また、フラッシュメモリ2にデータが格納されていない論理ブロックアドレスについては、アドレス変換テーブルのその論理ブロックアドレスに対応した部分に、物理ブロックアドレスではなく、データが格納されていないことを示すフラグ(以下、対応するデータが格納されていないことを示すフラグを未格納フラグと言う)が設定される。
[Description of address translation table]
Next, the address conversion table will be described. The address conversion table collectively manages the correspondence between logical block addresses and physical block addresses and the correspondence between logical block addresses and old / new identification information.
FIG. 6 shows an example of an address conversion table for the zone 0 shown in FIG. 5, and the physical block address in the flash memory 2 in which data corresponding to each logical block address is stored, and the physical The old and new identification information of the data stored in the block address is described in the order of the logical block address. For a logical block address in which no data is stored in the flash memory 2, a flag indicating that no data is stored in the portion corresponding to the logical block address in the address translation table (not a physical block address) , A flag indicating that the corresponding data is not stored is referred to as an unstored flag).

例えば、図5に示したゾーン0のアドレス変換テーブルを作成する場合、マイクロプロセッサ6は、496ブロック分の物理ブロックアドレスを記述できる領域をSRAM上に確保し、その物理ブロックアドレスを記述する領域に初期設定として未格納フラグを設定する。その後、マイクロプロセッサ6は、フラッシュメモリインターフェースブロック10を制御してフラッシュメモリ2のゾーン0を構成するブロックの冗長領域26を順次読み出していき、冗長領域26に論理ブロックアドレス(対応論理ブロックアドレスとして記述されている論理ブロックアドレス)が記述されている場合には、アドレス変換テーブルのその論理ブロックアドレスに対応する部分に、その論理ブロックアドレスが記述されているブロックの物理ブロックアドレスを記述する。また、論理ブロックアドレスと共に記述されている新旧識別情報を、テーブルのその論理ブロックアドレスに対応した部分に記述する。   For example, when the address conversion table for zone 0 shown in FIG. 5 is created, the microprocessor 6 secures an area where the physical block addresses for 496 blocks can be described on the SRAM, and the area where the physical block addresses are described. The unstored flag is set as an initial setting. Thereafter, the microprocessor 6 controls the flash memory interface block 10 to sequentially read the redundant areas 26 of the blocks constituting the zone 0 of the flash memory 2, and writes the logical block addresses (corresponding to the corresponding logical block addresses) in the redundant areas 26. In the address conversion table, the physical block address of the block in which the logical block address is described is described in the portion corresponding to the logical block address. Also, the old and new identification information described together with the logical block address is described in the part corresponding to the logical block address of the table.

なお、このアドレス変換テーブルの作成処理で物理ブロックアドレスが記述されなかった部分については、初期設定で記述された未格納フラグがそのまま残る。   It should be noted that the unstored flag described in the initial setting remains as it is for the part where the physical block address is not described in the address conversion table creation process.

[新旧識別情報による識別]
データの更新途中に電源が切断される等により、同一の対応論理ブロックアドレスをもつブロックが並存する状況が生じると、アドレス変換テーブルを作成する際に、一つの論理ブロックアドレスに対し物理ブロックアドレスが二つ併存することとなる。
このとき、マイクロプロセッサ6は、併存する二つの物理ブロックアドレスのそれぞれの冗長領域26に書き込まれた新旧識別情報を比較し、新旧識別情報の値が大きいものを新しいデータ(真のデータ)が書き込まれたブロックと判別し、アドレス変換テーブルを作成する。
[Identification by old and new identification information]
When a situation occurs in which blocks with the same corresponding logical block address coexist due to the power being cut off during the data update, when creating the address conversion table, the physical block address is assigned to one logical block address. Two will coexist.
At this time, the microprocessor 6 compares the new and old identification information written in the redundant areas 26 of the two coexisting physical block addresses, and writes the new data (true data) with the larger value of the old and new identification information. It is determined that the block is a block, and an address conversion table is created.

[消去済ブロック検索用テーブルの説明]
次に、消去済ブロック検索用テーブルについて、図面を参照して説明する。消去済ブロック検索用テーブルは、データの書き込み先とすることができる消去済ブロックを検索するためのテーブルである。
[Description of erased block search table]
Next, the erased block search table will be described with reference to the drawings. The erased block search table is a table for searching for erased blocks that can be data write destinations.

まず、消去済ブロック検索用テーブルを用いて、消去済ブロックを検索する方法について説明する。例えば、図5に示したゾーンの消去済ブロックを検索する場合、マイクロプロセッサ6は、512ビットの領域をSRAM上に確保し、その領域の各ビットにゾーンを構成する各ブロックを割当てた消去済ブロック検索用テーブルを作成する。   First, a method for searching for an erased block using the erased block search table will be described. For example, when searching for erased blocks in the zone shown in FIG. 5, the microprocessor 6 secures a 512-bit area on the SRAM, and erased blocks in which each block constituting the zone is assigned to each bit in the area. Create a block search table.

図7は、図5に示したゾーン0とゾーン1の消去済ブロック検索用テーブルを概念的に示した概念図である。ここで、ゾーン0の消去済ブロック検索用テーブル上のビットは、ブロックB0000〜B0511(物理ブロックアドレスの0000〜0511)に対応し、ゾーン1の消去済ブロック検索用テーブル上のビットは、ブロックB0512〜B1023(物理ブロックアドレスの0512〜1023)に対応する。   FIG. 7 is a conceptual diagram conceptually showing the erased block search table for zone 0 and zone 1 shown in FIG. Here, bits on the erased block search table for zone 0 correspond to blocks B0000 to B0511 (physical block addresses 0000 to 0511), and bits on the erased block search table for zone 1 correspond to block B0512. To B1023 (physical block addresses 0512 to 1023).

また、消去済ブロック検索用テーブル上のビットと、ゾーンを構成するブロックとの対応関係については、図7に示した消去済ブロック検索用テーブル上のビットを、上の行から下の行へ、各行を左から右へ物理ブロックアドレス順に対応させている。従って、ゾーン0の消去済ブロック検索用テーブルでは、左上のビットが、B0000(物理ブロックアドレスの0000)のブロックに対応し、右下のビットが、B0511(物理ブロックアドレスの0511)のブロックに対応する。   For the correspondence between the bits on the erased block search table and the blocks constituting the zone, the bits on the erased block search table shown in FIG. 7 are changed from the upper row to the lower row. Each row is associated from left to right in the order of physical block addresses. Therefore, in the erased block search table for zone 0, the upper left bit corresponds to the block B0000 (physical block address 0000) and the lower right bit corresponds to the block B0511 (physical block address 0511). To do.

また、消去済ブロック検索用テーブル上のビットは、「0」と「1」で消去済ブロックであるか否かを示しており、例えば、データが書き込まれている場合(または不良ブロックであることを示すブロックステータスが記述されている場合)は、そのビットに「0」を、データが書き込まれていない場合(消去済ブロックの場合)は、そのビットに「1」を設定する。   The bit on the erased block search table indicates whether the block is an erased block by “0” and “1”. For example, when data is written (or it is a defective block) Is set to “0” in the bit, and “1” is set in the bit when data is not written (in the case of an erased block).

なお、この消去済ブロック検索用テーブルは、アドレス変換テーブルを作成する際に一緒に作成することができる。例えば、マイクロプロセッサ6は、消去済ブロック検索用テーブルを作成するSRAM上の領域に「0」を設定しておき、各ブロックの冗長領域26に対応論理ブロックアドレスも不良ブロックであることを示すブロックステータスも記述されていないときに、そのブロックに対応するビットに「1」を設定するようにすれば、アドレス変換テーブルを作成する際に一緒に作成することができる。つまり、ゾーンを構成するブロックの冗長領域26に記述されているデータを読み出したときにこの処理を行なえば、消去済ブロックに対応するビットだけに「1」が設定され、消去済ブロックでないブロックに対応するビットは予め設定した「0」のままになる。   The erased block search table can be created together when creating the address conversion table. For example, the microprocessor 6 sets “0” in the area on the SRAM for creating the erased block search table, and indicates that the corresponding logical block address in the redundant area 26 of each block is also a bad block. When the status is not described, if the bit corresponding to the block is set to “1”, the address conversion table can be created together. In other words, if this process is performed when data described in the redundant area 26 of the block constituting the zone is read, only “1” is set to the bit corresponding to the erased block, and the block is not an erased block. The corresponding bit remains “0” set in advance.

また、マイクロプロセッサ6は、消去済ブロックにデータが書き込まれたときに、そのブロックに対応するビットを「1」から「0」に変更し、データが書き込まれているブロックがブロック消去されたときに、そのブロックに対応するビットを「0」から「1」に変更することで、消去済ブロック検索用テーブルを随時更新する。   Further, when data is written in the erased block, the microprocessor 6 changes the bit corresponding to the block from “1” to “0”, and the block in which the data is written is erased. In addition, the erased block search table is updated as needed by changing the bit corresponding to the block from “0” to “1”.

次に、この消去済ブロック検索用テーブルを用いて消去済ブロックを検索する場合について図8を参照して説明する。図8は、ゾーン0の消去済ブロック検索用テーブルを示している。例えば、一番上の行の各ビットは、ブロックB0000〜B0007(物理ブロックアドレスの0000〜0007)に対応し、一番下の行はブロックB0504〜B0511(物理ブロックアドレスの0504〜0511)に対応する。   Next, a case where an erased block is searched using this erased block search table will be described with reference to FIG. FIG. 8 shows an erased block search table for zone 0. For example, each bit in the top row corresponds to blocks B0000 to B0007 (physical block addresses 0000 to 0007), and the bottom row corresponds to blocks B0504 to B0511 (physical block addresses 0504 to 0511). To do.

マイクロプロセッサ6は、消去済ブロック検索用テーブルを、上の行から下の行へと走査する。また、マイクロプロセッサ6は、消去済ブロック検索用テーブル内の各行を左から右へと走査する。すなわち、マイクロプロセッサ6は、ブロックB0000(物理ブロックアドレスの0000)に対応するビット(一番上の行の、一番左のビット)から、ブロックB0511(物理ブロックアドレスの0511)に対応するビット(一番下の行の、一番右のビット)までを走査していき、消去済ブロックに対応する「1」のビットを検索する。   The microprocessor 6 scans the erased block search table from the upper row to the lower row. The microprocessor 6 scans each row in the erased block search table from left to right. That is, the microprocessor 6 starts from the bit corresponding to the block B0000 (physical block address 0000) (the leftmost bit in the top row) to the bit corresponding to the block B0511 (physical block address 0511) ( The rightmost bit in the bottom row is scanned, and the bit “1” corresponding to the erased block is searched.

図8に示した消去済ブロック検索用テーブルを検索する場合、上から2番目の行の、左から3番目のビットが「1」なので、マイクロプロセッサ6は、ここで検索を終了し、このビットに対応するブロックB0010(物理ブロックアドレスの0010)を、データの書き込み先のブロックとして特定する。   When searching the erased block search table shown in FIG. 8, since the third bit from the left in the second row from the top is “1”, the microprocessor 6 ends the search here, and this bit The block B0010 (physical block address 0010) corresponding to is specified as the data write destination block.

また、次回の検索は、上から2番目の行の、左から4番目のビットから走査を開始し、上から4番目の行の、左から5番目のビットが「1」なので、マイクロプロセッサ6は、ここで検索を終了し、このビットに対応するブロックB0028(物理ブロックアドレスの0028)を、データの書き込み先のブロックとして特定する。その後も、このような検索を続けていき、一番下の行の、一番右のビットまで走査が進んだときは、一番上の行の、一番左のビットに戻る。   The next search starts scanning from the fourth bit from the left in the second row from the top. Since the fifth bit from the left in the fourth row from the top is “1”, the microprocessor 6 The search ends here, and the block B0028 (physical block address 0028) corresponding to this bit is specified as the data write destination block. Thereafter, such a search is continued, and when the scanning proceeds to the rightmost bit in the bottom row, the processing returns to the leftmost bit in the top row.

[書き込み処理の説明]
書き込み処理は、ホストシステム4からのコマンドに応答して実行される。
ホストシステム4からの書き込み処理の実行を要求するコマンドは、ホストインターフェースブロック7のコマンドレジスタに書き込まれる。また、データの書き込み先の論理ブロックアドレスと、書き込むデータのサイズとは、それぞれホストインターフェースブロック7のLBAレジスタと、セクタ数レジスタとに書き込まれる。
[Description of writing process]
The writing process is executed in response to a command from the host system 4.
A command requesting execution of write processing from the host system 4 is written to the command register of the host interface block 7. The logical block address to which data is written and the size of the data to be written are written to the LBA register and the sector number register of the host interface block 7, respectively.

コマンドレジスタに書き込まれた命令に応答して、マイクロプロセッサ6は、消去済ブロック検索用テーブルを検索することにより特定したブロックに対して、データを書き込む。この書き込み処理では、マイクロプロセッサ6は、フラッシュメモリインターフェースブロック10を制御して、内部バス14を介して、書き込み先のブロック内のページに、データを書き込む。マイクロプロセッサ6は、データを書き込んだブロックの冗長領域26に、エラーコレクションコード、論理ブロックアドレス、新旧識別情報等を書き込む。   In response to the instruction written in the command register, the microprocessor 6 writes data to the block specified by searching the erased block search table. In this writing process, the microprocessor 6 controls the flash memory interface block 10 to write data to a page in the write destination block via the internal bus 14. The microprocessor 6 writes an error correction code, a logical block address, new / old identification information, and the like in the redundant area 26 of the block in which data is written.

また、上記書き込み処理で、ホストシステム4側から供給された論理ブロックアドレスに対応する旧データが存在する場合(上書きをする場合)は、上記新データの書き込み処理の後に旧データの消去処理が行なわれる。なお、消去する旧データが格納されているブロックの物理ブロックアドレスは、図6に示したアドレス変換テーブルに基づいて得ることができる。この消去処理では、マイクロプロセッサ6は、フラッシュメモリインターフェースブロック10を制御して、フラッシュメモリ2の旧データが格納されているブロックのデータを消去する。   Further, in the above write processing, when old data corresponding to the logical block address supplied from the host system 4 side exists (when overwriting), the old data is erased after the new data write processing. It is. The physical block address of the block in which the old data to be erased is stored can be obtained based on the address conversion table shown in FIG. In this erasing process, the microprocessor 6 controls the flash memory interface block 10 to erase the data in the block in which the old data of the flash memory 2 is stored.

[読み出し処理の説明]
読み出し処理は、ホストシステム4からのコマンドに応答して実行される。
ホストシステム4からの読み出し処理の実行を要求するコマンドは、ホストインターフェースブロック7のコマンドレジスタに書き込まれる。また、読み出すデータの論理ブロックアドレスは、ホストインターフェースブロック7のLBAレジスタに書き込まれる。
[Description of read processing]
The read process is executed in response to a command from the host system 4.
A command requesting execution of read processing from the host system 4 is written in the command register of the host interface block 7. Further, the logical block address of the data to be read is written in the LBA register of the host interface block 7.

コマンドレジスタに書き込まれた命令に応答して、マイクロプロセッサ6は、LBAレジスタに書き込まれた論理ブロックアドレスを、図6に示したアドレス変換テーブルに基づき物理ブロックアドレス(論理ブロックアドレスに対応するデータが格納されているブロックの物理ブロックアドレス)に変換する。   In response to the instruction written in the command register, the microprocessor 6 converts the logical block address written in the LBA register into a physical block address (data corresponding to the logical block address is based on the address conversion table shown in FIG. 6). Converted to the physical block address of the stored block).

続いて、マイクロプロセッサ6は、フラッシュメモリインターフェースブロック10を制御して、内部バス14を介して、ホストシステム4側から与えられる論理ブロックアドレスに対応するデータが格納されているブロック内のページに格納されているデータを、バッファ9に読み出す。   Subsequently, the microprocessor 6 controls the flash memory interface block 10 and stores it in the page in the block in which data corresponding to the logical block address given from the host system 4 side is stored via the internal bus 14. The read data is read out to the buffer 9.

ECCブロック11は、バッファ9に読み出したデータを、当該データに付加されているエラーコレクションコードに基づいて誤りを訂正する。そして、マイクロプロセッサ6は、訂正後のデータを、ホストインターフェースブロック7を制御して、外部バス13を介してホストシステム4に供給する。   The ECC block 11 corrects an error in the data read out to the buffer 9 based on an error correction code added to the data. Then, the microprocessor 6 controls the host interface block 7 to supply the corrected data to the host system 4 via the external bus 13.

[チェックサム処理の説明]
チェックサム処理は、フラッシュメモリ2に書き込まれたデータが書き換えられたか否かを確認するための処理で、ホストシステム4からのコマンドに応答して実行される。
ホストシステム4は、例えば、電源投入時やユーザが所定の操作を実施した場合等にチェックサム処理の実行を要求するコマンドをフラッシュメモリシステム1に送る。ホストシステム4からのチェックサム処理の実行を要求するコマンドは、ホストインターフェースブロック7のコマンドレジスタに書き込まれる。また、セクタ数レジスタには、チェックサムを計算するときに区切りとするビット数(以下、区切りビット数と呼ぶ)が書き込まれる。マイクロプロセッサ6は、チェックサム処理の実行を要求するコマンドとともに、論理ブロックアドレスと区切りビット数とを受け取り、これらに基づいてチェックサム処理を実行する。
以下、図9に示すフローチャートを参照して、チェックサム処理の手順を説明する。
[Explanation of checksum processing]
The checksum process is a process for confirming whether or not the data written in the flash memory 2 has been rewritten, and is executed in response to a command from the host system 4.
For example, the host system 4 sends a command requesting execution of the checksum process to the flash memory system 1 when the power is turned on or when a user performs a predetermined operation. A command requesting execution of checksum processing from the host system 4 is written in the command register of the host interface block 7. Also, the number of bits used as a delimiter when calculating the checksum (hereinafter referred to as delimiter bit number) is written in the sector number register. The microprocessor 6 receives the logical block address and the number of delimiter bits together with the command requesting execution of the checksum process, and executes the checksum process based on these.
Hereinafter, the procedure of the checksum process will be described with reference to the flowchart shown in FIG.

チェックサム処理の実行を要求するコマンドを受け取ると、マイクロプロセッサ6は、ホストシステム4に対し、パスワードを要求する(ステップS100)。これに応答して、ホストシステム4は、所定のパスワードをフラッシュメモリシステム1に送信し、マイクロプロセッサ6は、ホストインターフェースブロック7を介してこれを受信する(ステップS110)。なお、パスワードはLBAレジスタに書き込まれるようにしてもよい。
マイクロプロセッサ6は、受信したパスワードと、ROM12に格納されたパスワードとを照合し、両者が一致するか否かを判定する(ステップS120)。
パスワードが一致しない場合(ステップS120;No)、チェックサム処理は終了される。
When receiving a command requesting execution of the checksum process, the microprocessor 6 requests a password from the host system 4 (step S100). In response to this, the host system 4 transmits a predetermined password to the flash memory system 1, and the microprocessor 6 receives the password via the host interface block 7 (step S110). The password may be written in the LBA register.
The microprocessor 6 collates the received password with the password stored in the ROM 12 and determines whether or not they match (step S120).
If the passwords do not match (step S120; No), the checksum process ends.

一方、パスワードが一致する場合(ステップS120;Yes)には、冗長領域26に対応論理ブロックアドレスが書き込まれている全ブロックのチェックサム値の算出を実行するため、マイクロプロセッサ6は処理をステップS140に進める。なお、ホストシステム4側から、チェックサム値を算出する対象となる論理ブロックの範囲を指定してもよい。   On the other hand, if the passwords match (step S120; Yes), the microprocessor 6 calculates the checksum values of all the blocks in which the corresponding logical block addresses are written in the redundant area 26, so that the microprocessor 6 performs the process in step S140. Proceed to It should be noted that a range of logical blocks for which a checksum value is to be calculated may be specified from the host system 4 side.

チェックサム値の算出が開始されると、マイクロプロセッサ6は、フラッシュメモリインターフェースブロック10を制御して、内部バス14を介して、対応論理ブロックアドレスが書き込まれているブロック内のページに格納されているデータを、バッファ9に読み出す(ステップS140)。   When calculation of the checksum value is started, the microprocessor 6 controls the flash memory interface block 10 and stores it in the page in the block in which the corresponding logical block address is written via the internal bus 14. The read data is read out to the buffer 9 (step S140).

マイクロプロセッサ6は、バッファ9に読み出したデータに含まれる誤りを、当該データに付加されているエラーコレクションコードに基づいて訂正する(ステップS150)。   The microprocessor 6 corrects the error included in the data read out to the buffer 9 based on the error collection code added to the data (step S150).

次に、マイクロプロセッサ6は、誤りが訂正されたデータからチェックサム値を算出するための算出処理を実行する(ステップS160)。
算出処理では、誤りが訂正されたデータを、区切りビット数毎に区切って、順次加算することにより、チェックサム値が算出される。例えば、区切りビット数が8ビットである場合、図10に示すように、1ページ分のデータを8ビット毎に分割し、それを順次加算する。
Next, the microprocessor 6 executes a calculation process for calculating a checksum value from the data whose error has been corrected (step S160).
In the calculation process, the checksum value is calculated by dividing the error-corrected data for each delimiter bit number and sequentially adding the data. For example, when the number of delimiter bits is 8 bits, as shown in FIG. 10, the data for one page is divided every 8 bits and added sequentially.

次に、マイクロプロセッサ6は、算出処理を実施したページが最終ブロックの最終ページか否かを判別する(ステップS161)。最終ブロックの最終ページでないと判別した場合(ステップS161;No)、それ以後のページについても同様にデータ読み出し(ステップS140)、誤り訂正(ステップS150)、及び算出処理(ステップS160)を繰り返す(ステップS161)。そして、最終ブロックの最終ページの算出処理が終了したとき(ステップS161;Yes)、加算した結果をチェックサム値としてホストシステム4に供給する(ステップS170)。   Next, the microprocessor 6 determines whether or not the page on which the calculation process has been performed is the last page of the last block (step S161). If it is determined that the page is not the last page of the last block (step S161; No), data reading (step S140), error correction (step S150), and calculation process (step S160) are repeated for the subsequent pages (step S160). S161). When the calculation process of the final page of the final block is completed (step S161; Yes), the addition result is supplied to the host system 4 as a checksum value (step S170).

なお、マイクロプロセッサ6は、算出処理において、冗長領域26に書き込まれているデータについても加算する。その際、誤り訂正と、データ置換処理とを施してから加算する。
このデータ置換処理では、冗長領域26に書き込まれているデータのうち、対応論理ブロックアドレスのように、個体差のないデータについては、値を置換しない。一方、新旧識別情報のように、データの書き換え履歴により個体差が生じるデータ(以下、置換対象データと呼ぶ)については、データを所定の値(例えば、全ビットを0)に置換する。また、誤り訂正が施されないデータについても所定のデータに置換する(誤り訂正が施されないデータも置換対象データに含まれるものとする)。そして、このような処理が施された後のデータを、区切りビット数毎に区切って、順次加算する。
Note that the microprocessor 6 also adds data written in the redundant area 26 in the calculation process. At this time, addition is performed after error correction and data replacement processing.
In this data replacement process, values are not replaced for data written in the redundant area 26, such as the corresponding logical block address, with no individual difference. On the other hand, for data in which individual differences occur due to data rewrite history (hereinafter referred to as replacement target data), such as new and old identification information, the data is replaced with a predetermined value (for example, all bits are 0). Further, data that is not subjected to error correction is also replaced with predetermined data (data that is not subjected to error correction is also included in the replacement target data). Then, the data after such processing is divided for each number of delimiter bits and sequentially added.

図11は、算出処理の手順を具体的に示すフローチャートである。算出処理が開始されると、マイクロプロセッサ6は、チェックサム処理の対象データ(バッファ9に読み出されたデータ)を分割するためのカウント値を0にリセットする(ステップS200)。   FIG. 11 is a flowchart specifically illustrating the procedure of the calculation process. When the calculation process is started, the microprocessor 6 resets the count value for dividing the target data (data read into the buffer 9) of the checksum process to 0 (step S200).

次に、マイクロプロセッサ6は、カウント値と区切りビット数とに基づき、加算するデータを区切って切り出す(ステップS210)。例えば、マイクロプロセッサ6は、区切りビット数とカウント値の積から加算するデータの先頭ビットを特定し、その先頭ビットから区切りビット数分だけのデータを、加算するデータ(以下、加算データと呼ぶ)として抽出する。   Next, the microprocessor 6 delimits and cuts out the data to be added based on the count value and the number of delimiter bits (step S210). For example, the microprocessor 6 specifies the first bit of data to be added from the product of the number of delimiter bits and the count value, and adds data corresponding to the number of delimiter bits from the first bit (hereinafter referred to as addition data). Extract as

次に、マイクロプロセッサ6は、切り出された加算データが、置換対象データを含むか否かを判別する(ステップS220)。そして、置換対象データを含まないと判別した場合(ステップS220;No)には、ステップS240に処理を進める。   Next, the microprocessor 6 determines whether or not the extracted addition data includes replacement target data (step S220). If it is determined that the data to be replaced is not included (step S220; No), the process proceeds to step S240.

一方、置換対象データを含むと判別した場合(ステップS220;Yes)、加算データに含まれる置換対象データを0に置換し(ステップS230)、ステップS240に処理を進める。   On the other hand, when it is determined that the replacement target data is included (step S220; Yes), the replacement target data included in the addition data is replaced with 0 (step S230), and the process proceeds to step S240.

ステップS240において、マイクロプロセッサ6は、チェックサム値に加算データを加算する(ステップS240)。そして、マイクロプロセッサ6は、チェックサム処理の対象データの最後に達した否かを判別する(ステップS250)。   In step S240, the microprocessor 6 adds the addition data to the checksum value (step S240). Then, the microprocessor 6 determines whether or not the end of the checksum processing target data has been reached (step S250).

チェックサム処理の対象データの最後に達したと判別した場合(ステップS250;Yes)、マイクロプロセッサ6は、算出処理を終了する。
一方、チェックサム処理の対象データの最後に未だ達していないと判別した場合(ステップS250;No)、マイクロプロセッサ6は、カウント値を+1し(ステップS260)、処理をステップS210に戻す。
If it is determined that the end of the target data for the checksum process has been reached (step S250; Yes), the microprocessor 6 ends the calculation process.
On the other hand, when it is determined that the end of the target data for the checksum processing has not yet been reached (step S250; No), the microprocessor 6 increments the count value by 1 (step S260) and returns the processing to step S210.

マイクロプロセッサ6は、対象データの最後まで加算すると、算出処理を終了する。その後、チェックサム処理の対象データが新たにバッファ9に読み出されたときには、前回の算出処理終了時のチェックサム値に加算データを加算する。なお、上記チェックサム処理では、予め定められたビット数だけを有効データ(チェックサム値)として扱い、桁溢れした上位ビットのデータは無視している。   When the microprocessor 6 adds up to the end of the target data, it ends the calculation process. After that, when the target data for the checksum process is newly read out to the buffer 9, the added data is added to the checksum value at the end of the previous calculation process. In the checksum process, only a predetermined number of bits are treated as valid data (checksum value), and the data of higher bits overflowing is ignored.

ホストシステム4は、チェックサム値を受け取ると、それを予め取得しておいたチェックサム期待値と比較し、両者が一致した場合には不正な書き換えがされなかったと判別することができる。
例えば、ホストシステム4は、データの書き換え時に所定のチェックサム期待値を与えられてもよい。また、データの書き込みが終了した後に、チェックサム処理を実行してチェックサム値を取得し、そのときに得られたチェックサム値をチェックサム期待値としてもよい。
When the host system 4 receives the checksum value, it compares the checksum value with the expected checksum value acquired in advance, and if the two match, it can be determined that unauthorized rewriting has not been performed.
For example, the host system 4 may be given a predetermined expected checksum value when rewriting data. Further, after the data writing is completed, a checksum process may be executed to obtain a checksum value, and the checksum value obtained at that time may be used as the expected checksum value.

以上で説明したように、本実施の形態のフラッシュメモリシステム1は、チェックサム処理を行うことより不正に書き換えられたことを検出できる。   As described above, the flash memory system 1 of the present embodiment can detect fraudulent rewriting by performing checksum processing.

また、本実施の形態のフラッシュメモリシステム1は、チェックサム処理の実行時にパスワードの照合をし、パスワードが一致しない場合、チェックサム値を出力せずに処理を終了する。このため、不正にチェックサムの値を得ることが困難である。   Further, the flash memory system 1 according to the present embodiment collates the password when executing the checksum process. If the passwords do not match, the process ends without outputting the checksum value. For this reason, it is difficult to obtain a checksum value illegally.

また、本実施の形態のフラッシュメモリシステム1は、ユーザが自由にデータを書き込むことができない冗長領域26に書き込まれているデータをもチェックサム値の算出に用いるため、チェックサムを一致させるような不正書き込みが更に困難である。   Further, the flash memory system 1 of the present embodiment uses the data written in the redundant area 26 to which the user cannot freely write data for calculating the checksum value, so that the checksums are matched. Unauthorized writing is even more difficult.

また、本実施の形態のフラッシュメモリシステム1は、冗長領域26に書き込まれているデータのうち、フラッシュメモリ2の個体差に依存するデータついては、データを所定の値に置き換えてからチェックサムを計算する。その結果、複数のフラッシュメモリシステム1に同じデータを書き込んだ場合、データ書き換えの履歴によらず等しいチェックサム値が得られるため、フラッシュメモリシステム1の管理が容易になる。   Further, the flash memory system 1 according to the present embodiment calculates a checksum after replacing the data written in the redundant area 26 with the predetermined value for the data depending on the individual difference of the flash memory 2. To do. As a result, when the same data is written in a plurality of flash memory systems 1, the same checksum value can be obtained regardless of the data rewriting history, so that the management of the flash memory system 1 is facilitated.

また、本実施の形態のフラッシュメモリシステムは、区切りビット数を指定できるため、チェックサムを一致させるような不正書き込みをするための難易度が高まり、不正な書き込みを抑止できる。   In addition, since the flash memory system according to the present embodiment can specify the number of delimiter bits, the degree of difficulty for performing illegal writing that matches the checksums increases, and illegal writing can be suppressed.

上記の実施の形態では、フラッシュメモリシステムが、算出したチェックサム値をホストシステムに供給する場合を例に説明したが、フラッシュメモリシステムは、自ら(例えばROM)チェックサム期待値を保持し、算出したチェックサム値とチェックサム期待値とが一致するか否かを判別して、その判別結果をホストシステムに供給するようにしてもよい。   In the above embodiment, the case where the flash memory system supplies the calculated checksum value to the host system has been described as an example. However, the flash memory system holds the expected checksum value itself (for example, ROM) and calculates it. It may be determined whether or not the checksum value matches the expected checksum value, and the determination result may be supplied to the host system.

本発明に係るフラッシュメモリシステムを概略的に示すブロック図である。1 is a block diagram schematically showing a flash memory system according to the present invention. フラッシュメモリのアドレス空間の構造を概略的に示す図である。It is a figure which shows roughly the structure of the address space of flash memory. 冗長領域に対するデータの割り当てについて示す図である。It is a figure shown about allocation of the data with respect to a redundant area. 512のブロックでゾーンを構成した例を示す図である。It is a figure which shows the example which comprised the zone by the block of 512. FIG. ゾーンの構成例を示す図である。It is a figure which shows the structural example of a zone. アドレス変換テーブルの例を示した図である。It is the figure which showed the example of the address conversion table. 消去済ブロック検索用テーブルの例を示す概念図である。It is a conceptual diagram which shows the example of the erased block search table. 消去済ブロック検索用テーブルを用いた消去済ブロックの検索方法を説明するための図である。It is a figure for demonstrating the search method of the erased block using the erased block search table. チェックサム処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of a checksum process. チェックサム値の算出方法を示す図である。It is a figure which shows the calculation method of a checksum value. チェックサム値を算出するための算出処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the calculation process for calculating a checksum value.

符号の説明Explanation of symbols

1 フラッシュメモリシステム
2 フラッシュメモリ
3 コントローラ
4 ホストシステム
6 マイクロプロセッサ
7 ホストインターフェースブロック
8 ワークエリア
9 バッファ
10 フラッシュメモリインターフェースブロック
11 ECCブロック
12 ROM
13 外部バス
14 内部バス
25 ユーザ領域
26 冗長領域
1 Flash memory system 2 Flash memory 3 Controller 4 Host system 6 Microprocessor 7 Host interface block 8 Work area 9 Buffer 10 Flash memory interface block 11 ECC block 12 ROM
13 External bus 14 Internal bus 25 User area 26 Redundant area

Claims (8)

フラッシュメモリを記憶媒体として利用するホストシステムからの命令に応答して、前記フラッシュメモリのユーザ領域にデータを書き込むとともに、前記フラッシュメモリの冗長領域に記録されたデータの管理に用いる付加的なデータを書き込む、書き込み手段と、
前記ホストシステムからの命令に応答して、前記書き込み手段によって前記ユーザ領域に記録されたデータと前記冗長領域に記録されたデータとを読み出す、読み出し手段と、
前記ホストシステムからの命令に応答して、前記読み出し手段によって読み出された前記ユーザ領域に記録されたデータと前記冗長領域に記録されたデータとを所定のビット毎に区切って順次加算してチェックサム値を求めるチェックサム算出手段と、から構成される、
ことを特徴とするメモリコントローラ。
In response to an instruction from the host system that uses the flash memory as a storage medium, the data is written to the user area of the flash memory and additional data used for managing the data recorded in the redundant area of the flash memory. Writing, writing means,
In response to a command from the host system, reading means for reading the data recorded in the user area and the data recorded in the redundant area by the writing means;
In response to a command from the host system, the data recorded in the user area read by the reading unit and the data recorded in the redundant area are sequentially added by being divided into predetermined bits and checked. Checksum calculation means for obtaining a sum value,
A memory controller characterized by that.
予め定められたチェックサム期待値と、前記チェックサム算出手段が算出するチェックサム値とを照合し、照合結果情報を前記ホストシステムに出力するチェックサム照合手段を更に有する、
ことを特徴とする請求項1に記載のメモリコントローラ。
A checksum verification unit that collates a predetermined expected checksum value with a checksum value calculated by the checksum calculation unit and outputs verification result information to the host system;
The memory controller according to claim 1.
所定のパスワードを記憶し、当該所定のパスワードと前記ホストシステムから供給されるパスワードとが一致するか否かを判別する、パスワード照合手段を更に有し、
前記チェックサム算出手段は、前記パスワード照合手段が、当該所定のパスワードと前記ホストシステムから供給されるパスワードとが一致すると判別した場合にチェックサム値を算出する、
ことを特徴とする請求項1又は2に記載のメモリコントローラ。
A password verification unit that stores a predetermined password and determines whether or not the predetermined password matches the password supplied from the host system;
The checksum calculation unit calculates a checksum value when the password verification unit determines that the predetermined password matches the password supplied from the host system.
The memory controller according to claim 1, wherein the memory controller is a memory controller.
前記チェックサム算出手段は、前記冗長領域のデータのうち、特定の領域に書き込まれたデータを所定の値に置換し、置換した後のデータを所定のビット数毎に区切って順次加算してチェックサム値を算出する、
ことを特徴とする請求項1乃至3のいずれか1項に記載のメモリコントローラ。
The checksum calculation means replaces data written in a specific area of the data in the redundant area with a predetermined value, and sequentially adds the data after the replacement after dividing the data into a predetermined number of bits. Calculate the sum value,
The memory controller according to claim 1, wherein the memory controller is a memory controller.
前記チェックサム算出手段は、データを区切る所定のビット数を、前記ホストシステムからの命令に応じて変更する、
ことを特徴とする請求項1乃至4のいずれか1項に記載のメモリコントローラ。
The checksum calculation means changes a predetermined number of bits delimiting data in accordance with an instruction from the host system.
The memory controller according to claim 1, wherein the memory controller is a memory controller.
前記書き込み手段は、誤り訂正符号を付加したデータを前記フラッシュメモリに書き込み、
前記読み出し手段は、読み出したデータに付加されている誤り訂正符号に基づいて誤りを訂正し、
前記チェックサム算出手段は、誤りが訂正されたデータを所定のビット毎に区切って順次加算してチェックサム値を算出する、
ことを特徴とする請求項1乃至5のいずれか1項に記載のメモリコントローラ。
The writing means writes data with an error correction code added to the flash memory,
The reading means corrects an error based on an error correction code added to the read data,
The checksum calculation means calculates the checksum value by sequentially adding the data in which the error has been corrected, divided into predetermined bits.
The memory controller according to any one of claims 1 to 5, wherein:
請求項1乃至6のいずれか1項に記載のメモリコントローラと、フラッシュメモリとを備えることを特徴とするフラッシュメモリシステム。   A flash memory system comprising: the memory controller according to claim 1; and a flash memory. フラッシュメモリからデータを読み出す読み出しステップと、
前記読み出しステップで読み出されたデータを所定のビット毎に区切って順次加算してチェックサム値を求めるチェックサム算出ステップと、
前記チェックサム算出ステップで算出されたチェックサム値に基づいて、データが書き換えられたか否かを判定する判定ステップと、
から構成される、
ことを特徴とするフラッシュメモリの制御方法。
A read step for reading data from the flash memory; and
A checksum calculation step for obtaining a checksum value by dividing the data read in the reading step into predetermined bits and sequentially adding the data;
A determination step of determining whether data has been rewritten based on the checksum value calculated in the checksum calculation step;
Composed of,
A method for controlling a flash memory.
JP2005141680A 2005-05-13 2005-05-13 Memory controller, flash memory system, and flash memory control method Expired - Fee Related JP4332134B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005141680A JP4332134B2 (en) 2005-05-13 2005-05-13 Memory controller, flash memory system, and flash memory control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005141680A JP4332134B2 (en) 2005-05-13 2005-05-13 Memory controller, flash memory system, and flash memory control method

Publications (2)

Publication Number Publication Date
JP2006318303A true JP2006318303A (en) 2006-11-24
JP4332134B2 JP4332134B2 (en) 2009-09-16

Family

ID=37538911

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005141680A Expired - Fee Related JP4332134B2 (en) 2005-05-13 2005-05-13 Memory controller, flash memory system, and flash memory control method

Country Status (1)

Country Link
JP (1) JP4332134B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8474045B2 (en) 2009-04-14 2013-06-25 Samsung Electronics Co., Ltd. Method of detecting program attacks
CN111625199A (en) * 2020-05-28 2020-09-04 深圳忆联信息系统有限公司 Method and device for improving reliability of data path of solid state disk, computer equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8474045B2 (en) 2009-04-14 2013-06-25 Samsung Electronics Co., Ltd. Method of detecting program attacks
CN111625199A (en) * 2020-05-28 2020-09-04 深圳忆联信息系统有限公司 Method and device for improving reliability of data path of solid state disk, computer equipment and storage medium
CN111625199B (en) * 2020-05-28 2023-07-04 深圳忆联信息系统有限公司 Method, device, computer equipment and storage medium for improving reliability of solid state disk data path

Also Published As

Publication number Publication date
JP4332134B2 (en) 2009-09-16

Similar Documents

Publication Publication Date Title
US7009896B2 (en) Apparatus and method for managing bad blocks in a flash memory
JP4245585B2 (en) Memory controller, flash memory system, and flash memory control method
JP4844639B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
US9996462B1 (en) Data storage device and data maintenance method thereof
JP4666080B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
TWI633428B (en) Data storage device and methods for processing data in the data storage device
JPWO2007000862A1 (en) MEMORY CONTROLLER, NONVOLATILE MEMORY DEVICE, NONVOLATILE MEMORY SYSTEM, AND DATA WRITE METHOD
US8316208B2 (en) Memory controller, flash memory system with memory controller, and method of controlling flash memory
JP4666081B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP2004220068A (en) Memory card and method for writing data in memory
US20150277787A1 (en) Memory controller, memory system, and memory control method
JP2006221334A (en) Memory controller, flash memory system, and control method for flash memory
JP4513786B2 (en) Memory controller, memory system, and memory control method
JP4153535B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM PROVIDED WITH MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4332134B2 (en) Memory controller, flash memory system, and flash memory control method
JP4661191B2 (en) Memory controller, flash memory system, and flash memory control method
JP4332132B2 (en) Memory controller, flash memory system, and flash memory control method
JP2012068765A (en) Memory controller, flash memory system with memory controller, and control method of flash memory
JP2012068764A (en) Memory controller, nonvolatile memory system with memory controller, and control method of nonvolatile memory
JP4952742B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4952741B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP3934659B1 (en) Memory controller and flash memory system
JP2008112455A (en) Memory card
JP2012037971A (en) Memory controller, nonvolatile memory system provided with memory controller, and method for controlling nonvolatile memory
JP4569554B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20090324

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20090331

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090427

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20090602

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20090619

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120626

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120626

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130626

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees