JP4952740B2 - MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD - Google Patents

MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD Download PDF

Info

Publication number
JP4952740B2
JP4952740B2 JP2009096802A JP2009096802A JP4952740B2 JP 4952740 B2 JP4952740 B2 JP 4952740B2 JP 2009096802 A JP2009096802 A JP 2009096802A JP 2009096802 A JP2009096802 A JP 2009096802A JP 4952740 B2 JP4952740 B2 JP 4952740B2
Authority
JP
Japan
Prior art keywords
block
logical
physical
physical block
information
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.)
Active
Application number
JP2009096802A
Other languages
Japanese (ja)
Other versions
JP2010250413A (en
Inventor
直樹 向田
俊一 花房
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 JP2009096802A priority Critical patent/JP4952740B2/en
Publication of JP2010250413A publication Critical patent/JP2010250413A/en
Application granted granted Critical
Publication of JP4952740B2 publication Critical patent/JP4952740B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、メモリコントローラ、メモリコントローラを備えるフラッシュメモリシステム、並びにフラッシュメモリの制御方法に関する。   The present invention relates to a memory controller, a flash memory system including the memory controller, and a flash memory control method.

例えば、特許文献1に開示されているように、フラッシュメモリを用いたメモリシステムでは、特定の物理ブロックに書き換えが集中しないようにウェアー・レベリング(Wear-leveling)制御が行われている。このウェアー・レベリング制御には、大きくは2つの方式がある。   For example, as disclosed in Patent Document 1, in a memory system using a flash memory, wear leveling control is performed so that rewriting does not concentrate on a specific physical block. There are roughly two types of wear leveling control.

1つは、書き換えが行われないデータが記憶されている物理ブロックを放置しておき、それ以外の物理ブロックの書き換え回数が平均化されるように制御するウェアー・レベリング制御(ダイナミック・ウェアー・レベリング(Dynamic-wear-leveling)制御方式又はパッシブ・ウェアー・レベリング(Passive-wear-leveling)制御方式と呼ばれている制御方式であり、以下、ダイナミック・ウェアー・レベリングと言う)である。もう一つは、書き換えが行われないデータが記憶されている物理ブロックを含めて、全ての物理ブロックの書き換え回数が平均化されるように制御するウェアー・レベリング制御(スタティック・ウェアー・レベリング(Static-wear-leveling)制御方式又はアクティブ・ウェアー・レベリング(Active-wear-leveling)制御方式と呼ばれている制御方式であり、以下、スタティック・ウェアー・レベリングと言う)である。   One is wear leveling control (dynamic wear leveling) that controls the physical blocks in which data that is not rewritten is stored and the number of rewrites of other physical blocks is averaged. (Dynamic-wear-leveling) control method or control method called passive wear-leveling control method, hereinafter referred to as dynamic wear leveling). The other is wear leveling control (static wear leveling (Static Wear Leveling)) that controls the number of rewrites of all physical blocks, including physical blocks that store data that will not be rewritten. -wear-leveling) control method or active wear-leveling control method (hereinafter referred to as static wear leveling).

ここで、書き換えが行わないデータが記憶されている物理ブロックが少ない場合は、ダイナミック・ウェアー・レベリング制御方式が適している。しかし、書き換えが行われないデータが記憶されている物理ブロックが多い場合は、スタティック・ウェアー・レベリング制御方式が適している。従って、特許文献1には、メモリシステムに記憶されるデータの書き換え頻度に応じて(つまり、書き換えが行われないデータが記憶されている物理ブロックが多いか少ないかに応じて)、ダイナミック・ウェアー・レベリング制御方式、スタティック・ウェアー・レベリング制御方式又はこれらを組み合わせたウェアー・レベリング制御方式のうちのいずれかのウェアー・レベリング制御を行うことが記載されている。   Here, when there are few physical blocks in which data that is not rewritten is stored, the dynamic wear leveling control method is suitable. However, when there are many physical blocks in which data that is not rewritten is stored, the static wear leveling control method is suitable. Therefore, Patent Document 1 discloses dynamic wear according to the frequency of rewriting data stored in the memory system (that is, depending on whether there are many or few physical blocks storing data that is not rewritten). It is described that the wear leveling control is performed among the leveling control method, the static wear leveling control method, or the wear leveling control method combining these.

特開2007−133683号公報JP 2007-133683 A

しかしながら、メモリシステムに記憶されるデータの書き換え頻度に応じて、適切なウェアー・レベリング制御方式を選択することは、必ずしも容易でない。   However, it is not always easy to select an appropriate wear leveling control method according to the frequency of rewriting data stored in the memory system.

また、上述した特許文献1では、ウェアー・レベリング制御方式の選択や条件設定を、ユーザが行うようになっている。その際、ユーザは、適切なウェアー・レベリング制御方式を選択し、その条件設定を行う必要がある。これらは、ユーザにとって負担である。そして、ウェアー・レベリング制御方式の選択が適切でなかった場合、例えば、書き換えが行われないデータが記憶されている物理ブロックが少ないときにスタティック・ウェアー・レベリング制御方式が選択されると、不必要なデータ転送が行われることが多くなる。   In Patent Document 1 described above, the user selects a wear leveling control method and sets conditions. At that time, the user needs to select an appropriate wear leveling control method and set the condition. These are burdens on the user. And if the wear leveling control method is not selected properly, for example, it is unnecessary if the static wear leveling control method is selected when there are few physical blocks that store data that will not be rewritten. Data transfer is often performed.

そこで、本発明は、殆ど書き換えが行われないデータ(書き換え頻度が低いデータ)が記憶されている物理ブロックが存在するときだけ、その物理ブロックを含めたウェアー・レベリング制御が行われるメモリコントローラ、フラッシュメモリシステム、及びフラッシュメモリの制御方法を提供することを目的とする。   Therefore, the present invention provides a memory controller, a flash, and the like that perform wear leveling control including a physical block only when there is a physical block in which data that is hardly rewritten (data with low rewrite frequency) is stored. An object of the present invention is to provide a memory system and a flash memory control method.

本発明の第1の側面に従うメモリコントローラは、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理手段と、
前記アクセス指示により指定された領域が属する前記論理ブロックと対応する前記物理ブロックにホストシステム側から与えられたデータを書き込むデータ書き込み手段と、
前記物理ブロックに対して新たに前記論理ブロックが割り当てられる毎にカウント値を更新するカウント手段と、
前記カウント値に基づいて決定されるカウント情報を、新たに前記論理ブロックが割り当てられた前記物理ブロックに書き込むカウント情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
所定の前記論理ブロックが割り当てられている前記物理ブロックを対象に、前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記カウント値と前記物理ブロックに書き込まれている前記カウント情報に基づいて判断する判断手段と、
前記所定の前記論理ブロックを特定するための情報を保持する情報保持手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段とを備える。
A memory controller according to a first aspect of the present invention is a memory controller that controls access to a flash memory to be erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Block management means for managing a correspondence relationship between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
Data writing means for writing data given from the host system side to the physical block corresponding to the logical block to which the area designated by the access instruction belongs;
Count means for updating a count value every time the logical block is newly assigned to the physical block;
Count information writing means for writing the count information determined based on the count value to the physical block to which the logical block is newly assigned,
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Whether the data stored in the physical block is transferred to the free block detected by the free block search means for the physical block to which the predetermined logical block is assigned is counted as Determination means for determining based on the count information written in the physical block;
Information holding means for holding information for specifying the predetermined logical block;
Data transfer means for transferring data stored in the physical block that is the object of the positive determination to the free block detected by the free block search means when a positive determination is made by the determination means With.

本発明の第2の側面に従うメモリコントローラは、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理手段と、
前記アクセス指示により指定された領域が属する前記論理ブロックと対応する前記物理ブロックにホストシステム側から与えられたデータを書き込むデータ書き込み手段と、
前記物理ブロックに対して新たに前記論理ブロックが割り当てられる毎にカウント値を更新するカウント手段と、
前記カウント値に基づいて決定されるカウント情報を、新たに前記論理ブロックが割り当てられた前記物理ブロックに書き込むカウント情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
所定の前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定手段と、
前記所定の前記論理ブロックを特定するための情報を保持する情報保持手段と、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記カウント値と前記処理対象ブロックに書き込まれている前記カウント情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段とを備える。
A memory controller according to a second aspect of the present invention is a memory controller that controls access to a flash memory to be erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Block management means for managing a correspondence relationship between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
Data writing means for writing data given from the host system side to the physical block corresponding to the logical block to which the area designated by the access instruction belongs;
Count means for updating a count value every time the logical block is newly assigned to the physical block;
Count information writing means for writing the count information determined based on the count value to the physical block to which the logical block is newly assigned,
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Processing target block specifying means for specifying a processing target block that is the physical block to which the predetermined logical block is allocated;
Information holding means for holding information for specifying the predetermined logical block;
Whether to transfer the data stored in the processing target block to the free block detected by the free block searching means is based on the count value and the count information written in the processing target block. A judging means for judging;
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching means when a positive determination is made by the determination means Means.

本発明の第3の側面に従うメモリコントローラは、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックを前記物理ブロックに割り当てる論理ブロック割り当て手段と、
前記論理ブロック割り当て手段により設定された前記論理ブロックと前記物理ブロックとの対応関係を示すアドレス変換テーブルを管理するアドレス変換テーブル管理手段と、
前記アドレス変換テーブル管理手段により前記アドレス変換テーブルの少なくとも一部の前記論理ブロックと前記物理ブロックとの対応関係が変更されたときに、前記アドレス変換テーブルの保存先の前記物理ブロックであるテーブル保存ブロックに、前記アドレス変換テーブルを保存するアドレス変換テーブル保存手段と、
前記テーブル保存ブロックに、前記アドレス変換テーブルを保存するための空き領域が無くなったとき、別の前記物理ブロックを前記テーブル保存ブロックとして新たに割り当てるテーブル保存ブロック管理手段と、
前記テーブル保存ブロック管理手段により新たな前記テーブル保存ブロックの割り当てが行われたときに、空き領域が無くなった前記テーブル保存ブロックに記憶されているカウント値と一致するカウント値である直前のカウント値を更新し、更新後のカウント値である最新のカウント値を、新たに前記テーブル保存ブロックとして割り当てられた前記物理ブロックに書き込むカウント情報書き込み手段と、
前記最新のカウント値に基づいて、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報を決定する版数情報決定手段と、
前記版数情報決定手段により決定された前記版数情報を、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
所定の前記論理ブロックが割り当てられている前記物理ブロックを対象に、前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記物理ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記所定の前記論理ブロックを特定するための情報を保持する情報保持手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段とを備える。
A memory controller according to a third aspect of the present invention is a memory controller that controls access to a flash memory to be erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Logical block allocating means for allocating a logical block composed of a plurality of sectors in the logical address space on the host system side to the physical block;
Address translation table management means for managing an address translation table indicating a correspondence relationship between the logical block and the physical block set by the logical block allocation means;
A table storage block that is the physical block that is the storage destination of the address conversion table when the correspondence relationship between at least some of the logical blocks of the address conversion table and the physical block is changed by the address conversion table management unit Address conversion table storage means for storing the address conversion table;
A table storage block management means for newly allocating another physical block as the table storage block when there is no more free space for storing the address conversion table in the table storage block;
When a new table storage block is assigned by the table storage block management means, the count value immediately before the count value that matches the count value stored in the table storage block that has no free space is obtained. Count information writing means for updating and writing the latest count value that is the updated count value to the physical block newly assigned as the table storage block;
Version number information determining means for determining version number information to be written in the physical block to which the logical block is newly allocated based on the latest count value;
Version number information writing means for writing the version number information determined by the version number information determining means into the physical block to which the logical block is newly assigned;
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Whether to transfer the data stored in the physical block to the free block detected by the free block search means for the physical block to which the predetermined logical block is assigned is determined as the physical block. Determining means for determining based on the version number information written in
Information holding means for holding information for specifying the predetermined logical block;
Data transfer means for transferring data stored in the physical block that is the object of the positive determination to the free block detected by the free block search means when a positive determination is made by the determination means With.

本発明の第4の側面に従うメモリコントローラは、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックを前記物理ブロックに割り当てる論理ブロック割り当て手段と、
前記論理ブロック割り当て手段により設定された前記論理ブロックと前記物理ブロックとの対応関係を示すアドレス変換テーブルを管理するアドレス変換テーブル管理手段と、
前記アドレス変換テーブル管理手段により前記アドレス変換テーブルの少なくとも一部の前記論理ブロックと前記物理ブロックとの対応関係が変更されたときに、前記アドレス変換テーブルの保存先の前記物理ブロックであるテーブル保存ブロックに、前記アドレス変換テーブルを保存するアドレス変換テーブル保存手段と、
前記テーブル保存ブロックに、前記アドレス変換テーブルを保存するための空き領域が無くなったとき、別の前記物理ブロックを前記テーブル保存ブロックとして新たに割り当てるテーブル保存ブロック管理手段と、
前記テーブル保存ブロック管理手段により新たな前記テーブル保存ブロックの割り当てが行われたときに、空き領域が無くなった前記テーブル保存ブロックに記憶されているカウント値と一致するカウント値である直前のカウント値を更新し、更新後のカウント値である最新のカウント値を、新たに前記テーブル保存ブロックとして割り当てられた前記物理ブロックに書き込むカウント情報書き込み手段と、
前記最新のカウント値に基づいて、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報を決定する版数情報決定手段と、
前記版数情報決定手段により決定された前記版数情報を、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
所定の前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定手段と、
前記所定の前記論理ブロックを特定するための情報を保持する情報保持手段と、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段とを備える。
A memory controller according to a fourth aspect of the present invention is a memory controller that controls access to a flash memory to be erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Logical block allocating means for allocating a logical block composed of a plurality of sectors in the logical address space on the host system side to the physical block;
Address translation table management means for managing an address translation table indicating a correspondence relationship between the logical block and the physical block set by the logical block allocation means;
A table storage block that is the physical block that is the storage destination of the address conversion table when the correspondence relationship between at least some of the logical blocks of the address conversion table and the physical block is changed by the address conversion table management unit Address conversion table storage means for storing the address conversion table;
A table storage block management means for newly allocating another physical block as the table storage block when there is no more free space for storing the address conversion table in the table storage block;
When a new table storage block is assigned by the table storage block management means, the count value immediately before the count value that matches the count value stored in the table storage block that has no free space is obtained. Count information writing means for updating and writing the latest count value that is the updated count value to the physical block newly assigned as the table storage block;
Version number information determining means for determining version number information to be written in the physical block to which the logical block is newly allocated based on the latest count value;
Version number information writing means for writing the version number information determined by the version number information determining means into the physical block to which the logical block is newly assigned;
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Processing target block specifying means for specifying a processing target block that is the physical block to which the predetermined logical block is allocated;
Information holding means for holding information for specifying the predetermined logical block;
Judgment to determine whether or not to transfer the data stored in the processing target block to the free block detected by the free block search means based on the version number information written in the processing target block Means,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching means when a positive determination is made by the determination means Means.

本発明の第5の側面に従うメモリコントローラは、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックを前記物理ブロックに割り当てる論理ブロック割り当て手段と、
前記論理ブロック割り当て手段により設定された前記論理ブロックと前記物理ブロックとの対応関係を示すアドレス変換テーブルを管理するアドレス変換テーブル管理手段と、
前記アドレス変換テーブル管理手段により前記アドレス変換テーブルの少なくとも一部の前記論理ブロックと前記物理ブロックとの対応関係が変更されたときに、前記アドレス変換テーブルの保存先の前記物理ブロックであるテーブル保存ブロックに、前記アドレス変換テーブルを保存するアドレス変換テーブル保存手段と、
前記テーブル保存ブロックに、前記アドレス変換テーブルを保存するための空き領域が無くなったとき、別の前記物理ブロックを前記テーブル保存ブロックとして新たに割り当てるテーブル保存ブロック管理手段と、
前記テーブル保存ブロックとして割り当てられている前記物理ブロックが変わったときに、前記テーブル保存ブロックとして割り当てられている前記物理ブロックを示す管理情報を、前記管理情報の保存先の前記物理ブロックである管理情報ブロックに保存する管理情報保存手段と、
前記管理情報ブロックに、前記管理情報を保存するための空き領域が無くなったとき、別の前記物理ブロックを前記管理情報ブロックとして新たに割り当てる管理情報ブロック管理手段と、
前記管理情報ブロック管理手段により新たな前記管理情報ブロックの割り当てが行われたときに、空き領域が無くなった前記管理情報ブロックに記憶されているカウント値と一致するカウント値である直前のカウント値を更新し、更新後のカウント値である最新のカウント値を、新たに前記管理情報ブロックとして割り当てられた前記物理ブロックに書き込むカウント情報書き込み手段と、
前記最新のカウント値に基づいて、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報を決定する版数情報決定手段と、
前記版数情報決定手段により決定された前記版数情報を、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
所定の前記論理ブロックが割り当てられている前記物理ブロックを対象に、前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記物理ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記所定の前記論理ブロックを特定するための情報を保持する情報保持手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段とを備える。
A memory controller according to a fifth aspect of the present invention is a memory controller that controls access to a flash memory to be erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Logical block allocating means for allocating a logical block composed of a plurality of sectors in the logical address space on the host system side to the physical block;
Address translation table management means for managing an address translation table indicating a correspondence relationship between the logical block and the physical block set by the logical block allocation means;
A table storage block that is the physical block that is the storage destination of the address conversion table when the correspondence relationship between at least some of the logical blocks of the address conversion table and the physical block is changed by the address conversion table management unit Address conversion table storage means for storing the address conversion table;
A table storage block management means for newly allocating another physical block as the table storage block when there is no more free space for storing the address conversion table in the table storage block;
When the physical block allocated as the table storage block changes, the management information indicating the physical block allocated as the table storage block is the management information that is the physical block of the storage destination of the management information Management information storage means to be stored in the block;
Management information block management means for newly allocating another physical block as the management information block when there is no free space for storing the management information in the management information block;
When a new management information block is allocated by the management information block management means, the count value immediately before the count value that matches the count value stored in the management information block in which a free area has disappeared is obtained. Count information writing means for updating and writing the latest count value, which is the updated count value, to the physical block newly assigned as the management information block;
Version number information determining means for determining version number information to be written in the physical block to which the logical block is newly allocated based on the latest count value;
Version number information writing means for writing the version number information determined by the version number information determining means into the physical block to which the logical block is newly assigned;
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Whether to transfer the data stored in the physical block to the free block detected by the free block search means for the physical block to which the predetermined logical block is assigned is determined as the physical block. Determining means for determining based on the version number information written in
Information holding means for holding information for specifying the predetermined logical block;
Data transfer means for transferring data stored in the physical block that is the object of the positive determination to the free block detected by the free block search means when a positive determination is made by the determination means With.

本発明の第6の側面に従うメモリコントローラは、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックを前記物理ブロックに割り当てる論理ブロック割り当て手段と、
前記論理ブロック割り当て手段により設定された前記論理ブロックと前記物理ブロックとの対応関係を示すアドレス変換テーブルを管理するアドレス変換テーブル管理手段と、
前記アドレス変換テーブル管理手段により前記アドレス変換テーブルの少なくとも一部の前記論理ブロックと前記物理ブロックとの対応関係が変更されたときに、前記アドレス変換テーブルの保存先の前記物理ブロックであるテーブル保存ブロックに、前記アドレス変換テーブルを保存するアドレス変換テーブル保存手段と、
前記テーブル保存ブロックに、前記アドレス変換テーブルを保存するための空き領域が無くなったとき、別の前記物理ブロックを前記テーブル保存ブロックとして新たに割り当てるテーブル保存ブロック管理手段と、
前記テーブル保存ブロックとして割り当てられている前記物理ブロックが変わったときに、前記テーブル保存ブロックとして割り当てられている前記物理ブロックを示す管理情報を、前記管理情報の保存先の前記物理ブロックである管理情報ブロックに保存する管理情報保存手段と、
前記管理情報ブロックに、前記管理情報を保存するための空き領域が無くなったとき、別の前記物理ブロックを前記管理情報ブロックとして新たに割り当てる管理情報ブロック管理手段と、
前記管理情報ブロック管理手段により新たな前記管理情報ブロックの割り当てが行われたときに、空き領域が無くなった前記管理情報ブロックに記憶されているカウント値と一致するカウント値である直前のカウント値を更新し、更新後のカウント値である最新のカウント値を、新たに前記管理情報ブロックとして割り当てられた前記物理ブロックに書き込むカウント情報書き込み手段と、
前記最新のカウント値に基づいて、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報を決定する版数情報決定手段と、
前記版数情報決定手段により決定された前記版数情報を、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
所定の前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定手段と、
前記所定の前記論理ブロックを特定するための情報を保持する情報保持手段と、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段とを備える。
A memory controller according to a sixth aspect of the present invention is a memory controller that controls access to a flash memory to be erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Logical block allocating means for allocating a logical block composed of a plurality of sectors in the logical address space on the host system side to the physical block;
Address translation table management means for managing an address translation table indicating a correspondence relationship between the logical block and the physical block set by the logical block allocation means;
A table storage block that is the physical block that is the storage destination of the address conversion table when the correspondence relationship between at least some of the logical blocks of the address conversion table and the physical block is changed by the address conversion table management unit Address conversion table storage means for storing the address conversion table;
A table storage block management means for newly allocating another physical block as the table storage block when there is no more free space for storing the address conversion table in the table storage block;
When the physical block allocated as the table storage block changes, the management information indicating the physical block allocated as the table storage block is the management information that is the physical block of the storage destination of the management information Management information storage means to be stored in the block;
Management information block management means for newly allocating another physical block as the management information block when there is no free space for storing the management information in the management information block;
When a new management information block is allocated by the management information block management means, the count value immediately before the count value that matches the count value stored in the management information block in which a free area has disappeared is obtained. Count information writing means for updating and writing the latest count value, which is the updated count value, to the physical block newly assigned as the management information block;
Version number information determining means for determining version number information to be written in the physical block to which the logical block is newly allocated based on the latest count value;
Version number information writing means for writing the version number information determined by the version number information determining means into the physical block to which the logical block is newly assigned;
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Processing target block specifying means for specifying a processing target block that is the physical block to which the predetermined logical block is allocated;
Information holding means for holding information for specifying the predetermined logical block;
Judgment to determine whether or not to transfer the data stored in the processing target block to the free block detected by the free block search means based on the version number information written in the processing target block Means,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching means when a positive determination is made by the determination means Means.

本発明の第7の側面に従うメモリコントローラは、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理手段と、
前記物理ブロックに対して前記論理ブロックが新たに割り当てられる毎にカウント値を更新するカウント手段と
前記カウント値が所定の値に達したときに、前記論理ブロックを割り当てた物理ブロックに書き込む版数情報を更新する版数情報管理手段と、
前記論理ブロックが新たに割り当てられた前記物理ブロックに、前記版数情報を書き込む版数情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
所定の前記論理ブロックが割り当てられている前記物理ブロックを対象に、前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記物理ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記所定の前記論理ブロックを特定するための情報を保持する情報保持手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段とを備える。
A memory controller according to a seventh aspect of the present invention is a memory controller that controls access to a flash memory to be erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Block management means for managing a correspondence relationship between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
Count means for updating the count value each time the logical block is newly assigned to the physical block, and version number information to be written to the physical block to which the logical block is assigned when the count value reaches a predetermined value Version information management means for updating
Version number information writing means for writing the version number information to the physical block to which the logical block is newly assigned;
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Whether to transfer the data stored in the physical block to the free block detected by the free block search means for the physical block to which the predetermined logical block is assigned is determined as the physical block. Determining means for determining based on the version number information written in
Information holding means for holding information for specifying the predetermined logical block;
Data transfer means for transferring data stored in the physical block that is the object of the positive determination to the free block detected by the free block search means when a positive determination is made by the determination means With.

本発明の第8の側面に従うメモリコントローラは、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理手段と、
前記物理ブロックに対して前記論理ブロックが新たに割り当てられる毎にカウント値を更新するカウント手段と
前記カウント値が所定の値に達したときに、前記論理ブロックを割り当てた物理ブロックに書き込む版数情報を更新する版数情報管理手段と、
前記論理ブロックが新たに割り当てられた前記物理ブロックに、前記版数情報を書き込む版数情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
所定の前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定手段と、
前記所定の前記論理ブロックを特定するための情報を保持する情報保持手段と、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段とを備える。
A memory controller according to an eighth aspect of the present invention is a memory controller that controls access to a flash memory to be erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Block management means for managing a correspondence relationship between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
Count means for updating the count value each time the logical block is newly assigned to the physical block, and version number information to be written to the physical block to which the logical block is assigned when the count value reaches a predetermined value Version information management means for updating
Version number information writing means for writing the version number information to the physical block to which the logical block is newly assigned;
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Processing target block specifying means for specifying a processing target block that is the physical block to which the predetermined logical block is allocated;
Information holding means for holding information for specifying the predetermined logical block;
Judgment to determine whether or not to transfer the data stored in the processing target block to the free block detected by the free block search means based on the version number information written in the processing target block Means,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching means when a positive determination is made by the determination means Means.

本発明の第9の側面に従うメモリコントローラは、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックを検索する手段であって、前記フラッシュメモリ内の前記物理ブロックが消去状態であるか否かを所定の順番で判断していく空きブロック検索手段と、
前記空きブロック検索手段で検出された消去状態の前記物理ブロックに対して前記論理ブロックを割り当てる論理ブロック割り当て手段と、
前記空きブロック検索手段における所定の順番の検索が所定回数巡回する毎に、前記論理ブロックを割り当てた物理ブロックに書き込む版数情報を更新する版数情報管理手段と、
前記論理ブロックが新たに割り当てられた前記物理ブロックに、前記版数情報を書き込む版数情報書き込み手段と、
所定の前記論理ブロックが割り当てられている前記物理ブロックを対象に、前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記物理ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記所定の前記論理ブロックを特定するための情報を保持する情報保持手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段とを備える。
A memory controller according to a ninth aspect of the present invention is a memory controller that controls access to a flash memory to be erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Block management means for managing a correspondence relationship between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
Means for searching for the physical block in the erased state in the flash memory, the free block searching means for determining in a predetermined order whether or not the physical block in the flash memory is in an erased state;
Logical block allocation means for allocating the logical block to the physical block in the erased state detected by the free block search means;
Version number information management means for updating the version number information to be written in the physical block to which the logical block is assigned each time the search in the predetermined order in the empty block search means circulates a predetermined number of times,
Version number information writing means for writing the version number information to the physical block to which the logical block is newly assigned;
Whether to transfer the data stored in the physical block to the free block detected by the free block search means for the physical block to which the predetermined logical block is assigned is determined as the physical block. Determining means for determining based on the version number information written in
Information holding means for holding information for specifying the predetermined logical block;
Data transfer means for transferring data stored in the physical block that is the object of the positive determination to the free block detected by the free block search means when a positive determination is made by the determination means With.

本発明の第10の側面に従うメモリコントローラは、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックを検索する手段であって、前記フラッシュメモリ内の前記物理ブロックが消去状態であるか否かを所定の順番で判断していく空きブロック検索手段と、
前記空きブロック検索手段で検出された消去状態の前記物理ブロックに対して前記論理ブロックを割り当てる論理ブロック割り当て手段と、
前記空きブロック検索手段における所定の順番の検索が所定回数巡回する毎に、前記論理ブロックを割り当てた物理ブロックに書き込む版数情報を更新する版数情報管理手段と、
前記論理ブロックが新たに割り当てられた前記物理ブロックに、前記版数情報を書き込む版数情報書き込み手段と、
所定の前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定手段と、
前記所定の前記論理ブロックを特定するための情報を保持する情報保持手段と、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段とを備える。
A memory controller according to a tenth aspect of the present invention is a memory controller that controls access to a flash memory to be erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Block management means for managing a correspondence relationship between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
Means for searching for the physical block in the erased state in the flash memory, the free block searching means for determining in a predetermined order whether or not the physical block in the flash memory is in an erased state;
Logical block allocation means for allocating the logical block to the physical block in the erased state detected by the free block search means;
Version number information management means for updating the version number information to be written in the physical block to which the logical block is assigned each time the search in the predetermined order in the empty block search means circulates a predetermined number of times,
Version number information writing means for writing the version number information to the physical block to which the logical block is newly assigned;
Processing target block specifying means for specifying a processing target block that is the physical block to which the predetermined logical block is allocated;
Information holding means for holding information for specifying the predetermined logical block;
Judgment to determine whether or not to transfer the data stored in the processing target block to the free block detected by the free block search means based on the version number information written in the processing target block Means,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching means when a positive determination is made by the determination means Means.

本発明の第11の側面に従うメモリコントローラでは、前記第1乃至第10の側面に従ういずれかにおいて、前記所定の前記論理ブロックを特定するための情報が、ホストシステムから与えられる情報に基づいて設定される。   In the memory controller according to the eleventh aspect of the present invention, in any one of the first to tenth aspects, information for specifying the predetermined logical block is set based on information given from a host system. The

本発明の第12の側面に従うフラッシュメモリシステムは、前記第1乃至第11のいずれかの側面に従うメモリコントローラと、前記メモリコントローラにより制御されるフラッシュメモリとを備える。   A flash memory system according to a twelfth aspect of the present invention includes a memory controller according to any one of the first to eleventh aspects, and a flash memory controlled by the memory controller.

本発明の第13の側面に従う方法は、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するフラッシュメモリの制御方法であって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理ステップと、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理ステップと、
前記アクセス指示により指定された領域が属する前記論理ブロックと対応する前記物理ブロックにホストシステム側から与えられたデータを書き込むデータ書き込みステップと、
前記物理ブロックに対して新たに前記論理ブロックが割り当てられる毎にカウント値を更新するカウントステップと、
前記カウント値に基づいて決定されるカウント情報を、新たな前記論理ブロックが割り当てられた前記物理ブロックに書き込むカウント情報書き込みステップと、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索ステップと、
所定の前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定ステップと、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するか否かを、前記カウント値と前記処理対象ブロックに書き込まれている前記カウント情報に基づいて判断する判断ステップと、
前記判断ステップで肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するデータ転送ステップとを備える。
A method according to a thirteenth aspect of the present invention is a flash memory control method for controlling access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system.
An erase count management step for managing the erase count of each of the physical blocks constituting the flash memory;
A block management step for managing the correspondence between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
A data writing step of writing data given from the host system side to the physical block corresponding to the logical block to which the area designated by the access instruction belongs;
A count step of updating a count value every time the logical block is newly assigned to the physical block;
Count information writing step for writing count information determined based on the count value to the physical block to which a new logical block is allocated;
A free block search step of searching for a free block that is the physical block in the erased state in the flash memory;
A processing target block specifying step for specifying a processing target block that is the physical block to which the predetermined logical block is assigned;
Whether to transfer the data stored in the processing target block to the free block detected by the free block search step is determined based on the count value and the count information written in the processing target block. A judgment step to judge;
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching step when a positive determination is made in the determination step Steps.

本発明の第14の側面に従う方法は、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するフラッシュメモリの制御方法であって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理ステップと、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックを前記物理ブロックに割り当てる論理ブロック割り当てステップと、
前記論理ブロック割り当てステップにより設定された前記論理ブロックと前記物理ブロックとの対応関係を示すアドレス変換テーブルを管理するアドレス変換テーブル管理ステップと、
前記アドレス変換テーブル管理ステップにより前記アドレス変換テーブルの少なくとも一部の前記論理ブロックと前記物理ブロックとの対応関係が変更されたときに、前記アドレス変換テーブルの保存先の前記物理ブロックであるテーブル保存ブロックに、前記アドレス変換テーブルを保存するアドレス変換テーブル保存ステップと、
前記テーブル保存ブロックに、前記アドレス変換テーブルを保存するための空き領域が無くなったとき、別の前記物理ブロックを前記テーブル保存ブロックとして新たに割り当てるテーブル保存ブロック管理ステップと、
前記テーブル保存ブロック管理ステップにより新たな前記テーブル保存ブロックの割り当てが行われたときに、空き領域が無くなった前記テーブル保存ブロックに記憶されているカウント値と一致するカウント値である直前のカウント値を更新し、更新後のカウント値である最新のカウント値を、新たに前記テーブル保存ブロックとして割り当てられた前記物理ブロックに書き込むカウント情報書き込みステップと、
前記最新のカウント値に基づいて、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報を決定する版数情報決定ステップと、
前記版数情報決定ステップにより決定された前記版数情報を、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報書き込みステップと、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索ステップと、
所定の前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定ステップと、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断ステップと、
前記判断ステップにより肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するデータ転送ステップとを備える。
A method according to a fourteenth aspect of the present invention is a flash memory control method for controlling access to a flash memory to be erased in units of physical blocks based on an access instruction given from a host system,
An erase count management step for managing the erase count of each of the physical blocks constituting the flash memory;
A logical block allocation step for allocating a logical block composed of a plurality of sectors in the logical address space on the host system side to the physical block;
An address translation table management step for managing an address translation table indicating a correspondence relationship between the logical block and the physical block set by the logical block allocation step;
A table storage block that is the physical block that is the storage destination of the address conversion table when the correspondence relationship between at least some of the logical blocks of the address conversion table and the physical block is changed by the address conversion table management step And an address conversion table storing step for storing the address conversion table;
A table storage block management step for newly allocating another physical block as the table storage block when there is no more free space in the table storage block for storing the address conversion table;
When a new table storage block is assigned by the table storage block management step, the count value immediately before the count value that matches the count value stored in the table storage block that has no free space is obtained. A count information writing step of updating and writing the latest count value, which is the updated count value, into the physical block newly assigned as the table storage block;
A version number information determining step for determining version number information to be written in the physical block to which the logical block is newly allocated based on the latest count value;
A version number information writing step of writing the version number information determined in the version number information determination step into the physical block to which the logical block is newly assigned;
A free block search step of searching for a free block that is the physical block in the erased state in the flash memory;
A processing target block specifying step for specifying a processing target block that is the physical block to which the predetermined logical block is assigned;
Judgment for determining whether to transfer the data stored in the processing target block to the free block detected by the free block search step based on the version number information written in the processing target block Steps,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching step when a positive determination is made in the determination step Steps.

本発明の第15の側面に従う方法は、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するフラッシュメモリの制御方法であって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理ステップと、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックを前記物理ブロックに割り当てる論理ブロック割り当てステップと、
前記論理ブロック割り当てステップにより設定された前記論理ブロックと前記物理ブロックとの対応関係を示すアドレス変換テーブルを管理するアドレス変換テーブル管理ステップと、
前記アドレス変換テーブル管理ステップにより前記アドレス変換テーブルの少なくとも一部の前記論理ブロックと前記物理ブロックとの対応関係が変更されたときに、前記アドレス変換テーブルの保存先の前記物理ブロックであるテーブル保存ブロックに、前記アドレス変換テーブルを保存するアドレス変換テーブル保存ステップと、
前記テーブル保存ブロックに、前記アドレス変換テーブルを保存するための空き領域が無くなったとき、別の前記物理ブロックを前記テーブル保存ブロックとして新たに割り当てるテーブル保存ブロック管理ステップと、
前記テーブル保存ブロックとして割り当てられている前記物理ブロックが変わったときに、前記テーブル保存ブロックとして割り当てられている前記物理ブロックを示す管理情報を、前記管理情報の保存先の前記物理ブロックである管理情報ブロックに保存する管理情報保存ステップと、
前記管理情報ブロックに、前記管理情報を保存するための空き領域が無くなったとき、別の前記物理ブロックを前記管理情報ブロックとして新たに割り当てる管理情報ブロック管理ステップと、
前記管理情報ブロック管理ステップにより新たな前記管理情報ブロックの割り当てが行われたとき、空き領域が無くなった前記管理情報ブロックに記憶されているカウント値と一致するカウント値である直前のカウント値を更新し、更新後のカウント値である最新のカウント値を、新たに前記管理情報ブロックとして割り当てられた前記物理ブロックに書き込むカウント情報書き込みステップと、
前記最新のカウント値に基づいて、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報を決定する版数情報決定ステップと、
前記版数情報決定ステップにより決定された前記版数情報を、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報書き込みステップと、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索ステップと、
所定の前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定ステップと、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断ステップと、
前記判断ステップにより肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するデータ転送ステップとを備える。
A method according to a fifteenth aspect of the present invention is a flash memory control method for controlling access to a flash memory to be erased in units of physical blocks based on an access instruction given from a host system,
An erase count management step for managing the erase count of each of the physical blocks constituting the flash memory;
A logical block allocation step for allocating a logical block composed of a plurality of sectors in the logical address space on the host system side to the physical block;
An address translation table management step for managing an address translation table indicating a correspondence relationship between the logical block and the physical block set by the logical block allocation step;
A table storage block that is the physical block that is the storage destination of the address conversion table when the correspondence relationship between at least some of the logical blocks of the address conversion table and the physical block is changed by the address conversion table management step And an address conversion table storing step for storing the address conversion table;
A table storage block management step for newly allocating another physical block as the table storage block when there is no more free space in the table storage block for storing the address conversion table;
When the physical block allocated as the table storage block changes, the management information indicating the physical block allocated as the table storage block is the management information that is the physical block of the storage destination of the management information A management information storage step to be stored in the block;
A management information block management step for newly assigning another physical block as the management information block when there is no more free space in the management information block for storing the management information;
When a new management information block is allocated by the management information block management step, the count value immediately before that is the count value that matches the count value stored in the management information block that has no free space is updated. A count information writing step of writing the latest count value, which is the updated count value, into the physical block newly assigned as the management information block;
A version number information determining step for determining version number information to be written in the physical block to which the logical block is newly allocated based on the latest count value;
A version number information writing step of writing the version number information determined in the version number information determination step into the physical block to which the logical block is newly assigned;
A free block search step of searching for a free block that is the physical block in the erased state in the flash memory;
A processing target block specifying step for specifying a processing target block that is the physical block to which the predetermined logical block is assigned;
Judgment for determining whether to transfer the data stored in the processing target block to the free block detected by the free block search step based on the version number information written in the processing target block Steps,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching step when a positive determination is made in the determination step Steps.

本発明の第16の側面に従う方法は、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するフラッシュメモリの制御方法であって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消
去回数管理ステップと、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理ステップと、
前記物理ブロックに対して前記論理ブロックが新たに割り当てられる毎にカウント値を更新するカウントステップと
前記カウント値が所定の値に達したときに、前記論理ブロックを割り当てた物理ブロックに書き込む版数情報を更新する版数情報管理ステップと、
前記論理ブロックが新たに割り当てられた前記物理ブロックに、前記版数情報を書き込む版数情報書き込みステップと、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索ステップと、
所定の前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定ステップと、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断ステップと、
前記判断ステップにより肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するデータ転送ステップとを備える。
A method according to a sixteenth aspect of the present invention is a flash memory control method for controlling access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
An erase count management step for managing the erase count of each of the physical blocks constituting the flash memory;
A block management step for managing the correspondence between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
A count step of updating a count value each time the logical block is newly assigned to the physical block, and version number information to be written to the physical block to which the logical block is assigned when the count value reaches a predetermined value Version number information management step to update,
A version number information writing step for writing the version number information to the physical block to which the logical block is newly assigned;
A free block search step of searching for a free block that is the physical block in the erased state in the flash memory;
A processing target block specifying step for specifying a processing target block that is the physical block to which the predetermined logical block is assigned;
Judgment for determining whether to transfer the data stored in the processing target block to the free block detected by the free block search step based on the version number information written in the processing target block Steps,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching step when a positive determination is made in the determination step Steps.

本発明の第17の側面に従う方法は、ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するフラッシュメモリの制御方法であって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理ステップと、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理ステップと、
前記フラッシュメモリ内の消去状態の前記物理ブロックを検索するステップであって、前記フラッシュメモリ内の前記物理ブロックが消去状態であるか否かを所定の順番で判断していく空きブロック検索ステップと、
前記空きブロック検索ステップで検出された消去状態の前記物理ブロックに対して前記論理ブロックを割り当てる論理ブロック割り当てステップと、
前記空きブロック検索ステップにおける所定の順番の検索が所定回数巡回する毎に、前記論理ブロックを割り当てた物理ブロックに書き込む版数情報を更新する版数情報管理ステップと、
前記論理ブロックが新たに割り当てられた前記物理ブロックに、前記版数情報を書き込む版数情報書き込みステップと、
所定の前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定ステップと、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断ステップと、
前記判断ステップにより肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するデータ転送ステップとを備える。
A method according to a seventeenth aspect of the present invention is a flash memory control method for controlling access to a flash memory to be erased in units of physical blocks based on an access instruction given from a host system,
An erase count management step for managing the erase count of each of the physical blocks constituting the flash memory;
A block management step for managing the correspondence between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
A search for the physical block in the erased state in the flash memory, and a free block search step for determining in a predetermined order whether or not the physical block in the flash memory is in an erased state;
A logical block allocation step of allocating the logical block to the physical block in the erased state detected in the empty block search step;
A version number information management step for updating version number information to be written in the physical block to which the logical block is allocated each time the search in the predetermined order in the empty block search step circulates a predetermined number of times,
A version number information writing step for writing the version number information to the physical block to which the logical block is newly assigned;
A processing target block specifying step for specifying a processing target block that is the physical block to which the predetermined logical block is assigned;
Judgment for determining whether to transfer the data stored in the processing target block to the free block detected by the free block search step based on the version number information written in the processing target block Steps,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching step when a positive determination is made in the determination step Steps.

本発明の第18の側面に従う方法では、前記第13乃至第17の側面のいずれかにおいて、ホストシステムから与えられる情報に基づいて前記所定の前記論理ブロックが設定される。   In the method according to the eighteenth aspect of the present invention, in any of the thirteenth to seventeenth aspects, the predetermined logical block is set based on information given from a host system.

本発明によれば、論理ブロック単位で、それぞれの論理ブロックに対応するデータが記憶されている物理ブロックをウェアー・レベリング制御の対象とするか否かを適宜設定することができる。従って、ホストシステムから与えられるデータに、ウェアー・レベリング制御の対象としたいデータとウェアー・レベリング制御の対象としたくないデータが含まれている場合には、ウェアー・レベリング制御の対象としたいデータだけをウェアー・レベリング制御の対象として設定することができる。   According to the present invention, it is possible to appropriately set whether or not a physical block in which data corresponding to each logical block is stored is subject to wear leveling control in units of logical blocks. Therefore, if the data given by the host system includes data that you want to be subject to wear leveling control and data that you do not want to be subject to wear leveling control, only the data that you want to be subject to wear leveling control. It can be set as a target of wear leveling control.

本発明の一実施形態に係るフラッシュメモリシステムの概略構成を示すブロック図である。1 is a block diagram showing a schematic configuration of a flash memory system according to an embodiment of the present invention. 論理ブロックと物理ブロックの対応関係を示す図である。It is a figure which shows the correspondence of a logical block and a physical block. 物理ブロックに対して新たに論理ブロックが割り当てられた場合に行われる処理の説明図である。It is explanatory drawing of the process performed when a logical block is newly allocated with respect to the physical block. 書き換え頻度の低いデータが記憶されている物理ブロックが検出された場合に行われるウェアー・レベリング制御の説明図である。It is explanatory drawing of the wear leveling control performed when the physical block in which the data with low rewriting frequency is memorize | stored is detected. 本発明の一実施形態で行われる処理の流れを示すフローチャートである。It is a flowchart which shows the flow of the process performed by one Embodiment of this invention. テーブル管理情報及びアドレス変換テーブルとそれらの保存の仕方とを示す。Table management information and address conversion tables and how to store them are shown. 図7Aは、書替マークの変更規則を示す。図7Bは、物理ブロックに対して新たに論理ブロックが割り当てられた場合に行われる処理の説明図である。FIG. 7A shows a rewrite mark change rule. FIG. 7B is an explanatory diagram of processing performed when a logical block is newly assigned to a physical block. 書き換え頻度の低いデータが記憶されている物理ブロックが検出された場合に行われるデータ転送処理の説明図である。It is explanatory drawing of the data transfer process performed when the physical block in which the data with low rewriting frequency are memorize | stored is detected. 本発明の一実施形態で行われる処理の流れを示すフローチャートである。It is a flowchart which shows the flow of the process performed by one Embodiment of this invention. 図10Aは、書替マークが記憶されている物理ブロックと変更カウント値が記憶されている物理ブロックとが混在するフラッシュメモリを示す。図10Bは、書替マークが更新される第1の例に関する処理の流れを示す。FIG. 10A shows a flash memory in which a physical block storing a rewrite mark and a physical block storing a change count value are mixed. FIG. 10B shows the flow of processing relating to the first example in which the rewrite mark is updated. 図11Aは、書替マークが記憶されている物理ブロックと切替カウント値が記憶されている物理ブロックとが混在するフラッシュメモリを示す。図11Bは、書替マークが更新される第2の例に関する処理の流れを示す。FIG. 11A shows a flash memory in which a physical block storing a rewrite mark and a physical block storing a switching count value are mixed. FIG. 11B shows the flow of processing relating to the second example in which the rewrite mark is updated. 図12Aは、書替マークが更新される第3の例に関する処理の流れを示す。図12Bは、書替マークが更新される第4の例に関する処理の流れを示す。FIG. 12A shows the flow of processing relating to the third example in which the rewrite mark is updated. FIG. 12B shows the flow of processing relating to the fourth example in which the rewrite mark is updated.

以下、本発明の幾つかの実施の形態を、図面を参照しながら詳細に説明する。   Hereinafter, some embodiments of the present invention will be described in detail with reference to the drawings.

図1は、本発明の第一の実施形態に係るフラッシュメモリシステム1を概略的に示すブロック図である。   FIG. 1 is a block diagram schematically showing a flash memory system 1 according to the first embodiment of the present invention.

図1に示すように、フラッシュメモリシステム1は、フラッシュメモリ2と、それを制御するメモリコントローラ3とで構成されている。   As shown in FIG. 1, the flash memory system 1 includes a flash memory 2 and a memory 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 is composed of 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は、図1に示すように、マイクロプロセッサ6と、ホストインターフェースブロック7と、ワークエリア8と、バッファ9と、フラッシュメモリインターフェースブロック10と、ECC(Error Correcting Code)ブロック11と、ROM(Read Only Memory)12とから構成される。メモリコントローラ3は、内部バス14を介してフラッシュメモリ2と接続されている。これら機能ブロックによって構成されるメモリコントローラ3は、一つの半導体チップ上に集積される。以下、各機能ブロックについて説明する。   As shown in FIG. 1, the memory 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 Correcting Code) block 11, and a ROM. (Read Only Memory) 12. The memory controller 3 is connected to the flash memory 2 via the internal bus 14. The memory controller 3 constituted by these functional blocks is integrated on one semiconductor chip. Hereinafter, each functional block will be described.

ホストインターフェースブロック7は、ホストシステム4との間でデータ、アドレス情報、ステータス情報、外部コマンド等の授受を行なう。外部コマンドとは、ホストシステム4がフラッシュメモリシステム1に対して処理の実行を指示するためのコマンドである。ホストシステム4よりフラッシュメモリシステム1に供給されるデータ等は、ホストインターフェースブロック7を入口としてフラッシュメモリシステム1の内部(例えば、バッファ9)に取り込まれる。また、フラッシュメモリシステム1からホストシステム4に供給されるデータ等は、ホストインターフェースブロック7を出口としてホストシステム4に供給される。   The host interface block 7 exchanges data, address information, status information, external commands and the like with the host system 4. The external command is a command for the host system 4 to instruct the flash memory system 1 to execute processing. Data or the like supplied from the host system 4 to the flash memory system 1 is taken into the flash memory system 1 (for example, the buffer 9) using the host interface block 7 as an entrance. Data supplied from the flash memory system 1 to the host system 4 is supplied to the host system 4 through the host interface block 7 as an exit.

ホストインターフェースブロック7は、コマンドレジスタR1、セクタ数レジスタR2及びLBAレジスタR3を備えている。コマンドレジスタR1、セクタ数レジスタR2及びLBAレジスタR3には、ホストシステム4から与えられる情報が書き込まれる。コマンドレジスタR1には、書き込みコマンド、読み出しコマンド等の外部コマンドが書き込まれる。セクタ数レジスタR2には、アクセス対象領域のセクタ数が書き込まれる。LBAレジスタR3には、アクセス対象領域の先頭のLBA(Logical Block Address)(後述)が書き込まれる。   The host interface block 7 includes a command register R1, a sector number register R2, and an LBA register R3. Information given from the host system 4 is written in the command register R1, the sector number register R2, and the LBA register R3. External commands such as a write command and a read command are written in the command register R1. The number of sectors in the access target area is written in the sector number register R2. LBA (Logical Block Address) (described later) of the access target area is written in the LBA register R3.

ワークエリア8は、フラッシュメモリ2の制御に必要なデータを一時的に格納する作業領域であり、複数のSRAM(Static Random Access Memory)セルによって構成されている。ワークエリア8には、例えば、論理ブロックと物理ブロックとの対応関係を示したアドレス変換テーブル(後述)等が記憶される。   The work area 8 is a work area for temporarily storing data necessary for controlling the flash memory 2, and is composed of a plurality of SRAM (Static Random Access Memory) cells. The work area 8 stores, for example, an address conversion table (described later) indicating the correspondence between logical blocks and physical blocks.

バッファ9は、フラッシュメモリ2から読み出したデータを、ホストシステム4が受け取り可能な状態となるまで保持する。また、バッファ9は、フラッシュメモリ2に書き込むデータを、フラッシュメモリ2が書き込み可能な状態となるまで保持する。   The buffer 9 holds the data read from the flash memory 2 until the host system 4 can receive the data. The buffer 9 holds data to be written to the flash memory 2 until the flash memory 2 is in a writable state.

フラッシュメモリインターフェースブロック10は、内部バス14を介して、フラッシュメモリ2との間でデータ、アドレス情報、ステータス情報、内部コマンド等の授受を行う。ここで、内部コマンドとは、メモリコントローラ3がフラッシュメモリ2に処理の実行を指示するためのコマンドであり、フラッシュメモリ2は、メモリコントローラ3から与えられる内部コマンドに従って動作する。   The flash memory interface block 10 exchanges data, address information, status information, internal commands, and the like with the flash memory 2 via the internal bus 14. Here, the internal command is a command for the memory controller 3 to instruct the flash memory 2 to execute processing, and the flash memory 2 operates in accordance with the internal command given from the memory controller 3.

ECCブロック11は、フラッシュメモリ2に書き込むデータに付加される誤り訂正符号(ECC:Error Correcting Code)を生成するとともに、読み出したデータに付加されている誤り訂正符号に基づいて、読み出したデータに含まれる誤りを検出・訂正する。   The ECC block 11 generates an error correcting code (ECC) added to data to be written to the flash memory 2 and is included in the read data based on the error correcting code added to the read data. Detect and correct errors.

ROM12は、マイクロプロセッサ6による処理の手順を定義するプログラムを格納する不揮発性の記憶素子である。例えば、アドレス変換テーブルの作成等の処理手順を定義するプログラムが格納されている。   The ROM 12 is a non-volatile storage element that stores a program that defines a processing procedure performed by the microprocessor 6. For example, a program that defines a processing procedure such as creation of an address conversion table is stored.

マイクロプロセッサ6は、ROM12に記憶されているプログラムに従って、メモリコントローラ3の全体の動作を制御する。例えば、マイクロプロセッサ6は、ROM12から読み出した各種処理を定義したコマンドセットに基づいてフラッシュメモリインターフェースブロック10に処理を実行させる。   The microprocessor 6 controls the overall operation of the memory controller 3 in accordance with a program stored in the ROM 12. For example, the microprocessor 6 causes the flash memory interface block 10 to execute processes based on a command set that defines various processes read from the ROM 12.

フラッシュメモリ2は、NAND型フラッシュメモリからなる。NAND型フラッシュメモリは、レジスタと、複数のメモリセルが2次元的に配列されたメモリセルアレイを備えている。メモリセルアレイは、複数のメモリセル群と、ワード線とを備える。ここで、メモリセル群は、複数のメモリセルが直列に接続されたものである。各ワード線は、メモリセル群の特定のメモリセルを選択するためのものである。このワード線を介して選択されたメモリセルとレジスタとの間で、レジスタから選択されたメモリセルへのデータの書き込み又は選択されたメモリセルからレジスタへのデータの読み出しが行われる。   The flash memory 2 is a NAND flash memory. The NAND flash memory includes a register and a memory cell array in which a plurality of memory cells are two-dimensionally arranged. The memory cell array includes a plurality of memory cell groups and word lines. Here, the memory cell group is a group in which a plurality of memory cells are connected in series. Each word line is for selecting a specific memory cell in the memory cell group. Data is written from the register to the selected memory cell or data is read from the selected memory cell to the register between the selected memory cell and the register via the word line.

NAND型フラッシュメモリでは、データ読み出し動作及びデータ書き込み動作はページ単位で行われ、データ消去動作はブロック(物理ブロック)単位で行われる。物理ブロックは、複数のページ(物理ページ)で構成される。例えば、1個の物理ページは、所定サイズ(例えば2048バイト)のユーザ領域と、所定サイズ(例えば64バイト)の冗長領域とで構成され、1個の物理ブロックが、所定個数(例えば64個)の物理ページで構成されている。ユーザ領域は、ホストシステム4から与えられるデータを記憶するための領域であり、所定個数(例えば4個)の物理セクタ領域(例えば512バイト単位の記憶領域)で構成されている。冗長領域は、誤り訂正符号(ECC:Error Correcting Code)、論理アドレス情報、ブロックステータス(フラグ)、カウント情報(後述)等の付加データを記憶するための領域である。   In the NAND flash memory, a data read operation and a data write operation are performed in units of pages, and a data erase operation is performed in units of blocks (physical blocks). A physical block is composed of a plurality of pages (physical pages). For example, one physical page includes a user area of a predetermined size (for example, 2048 bytes) and a redundant area of a predetermined size (for example, 64 bytes), and one physical block has a predetermined number (for example, 64). It consists of physical pages. The user area is an area for storing data provided from the host system 4, and is configured by a predetermined number (for example, four) of physical sector areas (for example, a storage area of 512 bytes). The redundant area is an area for storing additional data such as error correcting code (ECC), logical address information, block status (flag), and count information (described later).

論理アドレス情報は、物理ブロックと論理ブロックの対応関係を判別するための情報である。従って、記憶データが消去された物理ブロックのような、対応する論理ブロックの無い物理ブロックについては、その物理ブロックの冗長領域に、論理アドレス情報は格納されていない。なお、以下の説明では、「物理ブロックの冗長領域」とは、物理ブロック内の一又は複数の物理ページが備える冗長領域(例えば、先頭物理ページの冗長領域)で構成された記憶領域を指す。   The logical address information is information for determining the correspondence between physical blocks and logical blocks. Therefore, for a physical block having no corresponding logical block, such as a physical block from which stored data has been erased, no logical address information is stored in the redundant area of the physical block. In the following description, the “redundant area of the physical block” refers to a storage area configured by a redundant area (for example, a redundant area of the first physical page) included in one or more physical pages in the physical block.

ブロックステータス(フラグ)は、物理ブロックの良否を示すフラグである。尚、初期不良の物理ブロックについては、不良ブロック(正常にデータの書き込み等を行うことができない物理ブロック)であることを示すブロックステータス(フラグ)が製造メーカによって書き込まれている。また、この初期不良の物理ブロックを示すブロックステータス(フラグ)を、ユーザ領域に書き込んでいる製造メーカもある。   The block status (flag) is a flag indicating pass / fail of the physical block. For the initial defective physical block, a block status (flag) indicating a defective block (physical block in which data cannot be normally written) is written by the manufacturer. Some manufacturers also write a block status (flag) indicating the initial defective physical block in the user area.

本実施の形態の書き込み処理では、ホストシステム4によって、コマンドレジスタR1に、書き込みコマンドを示すコマンドコードが書き込まれ、セクタ数レジスタR2に、書き込むデータのセクタ数が書き込まれ、LBAレジスタR3には、書き込みを開始する先頭データに対応するLBAが書き込まれる。セクタ数レジスタR2及びLBAレジスタR3に書き込まれた情報に基づいて、アクセス対象の領域である論理アクセス領域が判別され、その論理アクセス領域が含まれる論理ブロックに対応する物理ブロックにホストシステム4から与えられるデータが書き込まれる。   In the writing process of the present embodiment, the host system 4 writes a command code indicating a write command in the command register R1, writes the number of sectors of data to be written in the sector number register R2, and stores in the LBA register R3 The LBA corresponding to the top data to start writing is written. Based on the information written in the sector number register R2 and the LBA register R3, a logical access area that is an access target area is determined and given to the physical block corresponding to the logical block including the logical access area from the host system 4. Data is written.

セクタ数レジスタR2及びLBAレジスタR3に書き込まれた情報に基づいて判別される論理アクセス領域が複数個の論理ブロックに跨っている場合は、データの書き込み先は、複数個の物理ブロックである。従って、論理アクセス領域が複数個の論理ブロックに跨っている場合は、論理アクセス領域が属する論理ブロック毎に領域を分割してデータの書き込み処理が行われる。例えば、論理アクセス領域が2個の論理ブロック(第1の論理ブロックと第2の論理ブロック)に跨っている場合は、第1の論理ブロックに対応する物理ブロックに対する書き込み処理と、第2の論理ブロックに対応する物理ブロックに対する書き込み処理とが行われる。第1の論理ブロックに属する論理アクセス領域に対して書き込むことが指示されたデータは、第1の論理ブロックに対応する物理に書き込まれる。第2の論理ブロックに属する論理アクセス領域に対して書き込むことが指示されたデータは、第2の論理ブロックに対応する物理ブロック内に書き込まれる。   When the logical access area determined based on the information written in the sector number register R2 and the LBA register R3 extends over a plurality of logical blocks, the data write destination is a plurality of physical blocks. Therefore, when the logical access area extends over a plurality of logical blocks, the area is divided for each logical block to which the logical access area belongs, and data write processing is performed. For example, when the logical access area extends over two logical blocks (the first logical block and the second logical block), the write processing for the physical block corresponding to the first logical block and the second logical block Write processing is performed on the physical block corresponding to the block. Data instructed to be written to the logical access area belonging to the first logical block is written to the physical corresponding to the first logical block. Data instructed to be written to the logical access area belonging to the second logical block is written into the physical block corresponding to the second logical block.

ホストシステム4側のアドレス空間は、セクタ(512バイト)単位で分割した領域(以下、論理セクタ領域と言う)に付けた通番であるLBA(Logical Block Address)で管理されている。又、複数個の論理セクタ領域で構成された論理ブロックが形成され、この論理ブロックに対して、1個又は複数個の物理ブロックが割り当てられる。   The address space on the host system 4 side is managed by an LBA (Logical Block Address) which is a serial number assigned to an area (hereinafter referred to as a logical sector area) divided in units of sectors (512 bytes). Also, a logical block composed of a plurality of logical sector areas is formed, and one or a plurality of physical blocks are assigned to the logical block.

この論理ブロックと物理ブロックの対応関係は、ゾーン単位で管理されることが多い。具体的には、複数個の論理ブロックで1個の論理ゾーンが構成され、複数個の物理ブロックで1個の物理ゾーンが構成され、論理ゾーンが物理ゾーンに対応付けられて管理されることが多い。   The correspondence between logical blocks and physical blocks is often managed on a zone basis. Specifically, one logical zone is composed of a plurality of logical blocks, one physical zone is composed of a plurality of physical blocks, and the logical zone is managed in association with the physical zone. Many.

しかし、その場合、特定の論理ゾーンにアクセスが集中した場合、アクセスが集中した論理ゾーンに対応する物理ゾーンに含まれる物理ブロックの書き換え回数が、他の物理ゾーンに含まれる物理ブロックの書き換え回数よりも多くなってしまい好ましくない。   However, in this case, when access is concentrated in a specific logical zone, the number of rewrites of physical blocks included in the physical zone corresponding to the logical zone where access is concentrated is greater than the number of rewrites of physical blocks included in other physical zones. Is also undesirable.

この問題を解決する方法としては、論理ブロックに付した通し番号である論理ブロック番号(LBN)が連続する論理ブロックを各論理ゾーンに振り分ける方法がある。   As a method for solving this problem, there is a method in which logical blocks having consecutive logical block numbers (LBNs), which are serial numbers assigned to the logical blocks, are allocated to each logical zone.

但し、特定の論理ブロックにアクセスが集中した場合(アクセスが集中する範囲が複数個の論理ブロックに跨っていない場合)には、その論理ブロックが含まれる論理ゾーンに対応する物理ゾーンに含まれる物理ブロックの書き換え回数が、他の物理ゾーンに含まれる物理ブロックの書き換え回数よりも多くなってしまう。このような場合は、各論理ゾーンに含まれる論理ブロックに対応させることができる物理ブロックを、制限しない方が好ましい。つまり、物理ゾーンを構成せずに、各論理ゾーンに含まれる論理ブロックをいずれの物理ブロックにも対応させることができるようにすることが好ましい。   However, when access concentrates on a specific logical block (when the access concentration range does not extend over a plurality of logical blocks), the physical included in the physical zone corresponding to the logical zone including the logical block The number of block rewrites is larger than the number of rewrites of physical blocks included in other physical zones. In such a case, it is preferable not to limit the physical blocks that can be associated with the logical blocks included in each logical zone. In other words, it is preferable that a logical block included in each logical zone can correspond to any physical block without forming a physical zone.

また、論理ブロックと物理ブロックとの対応関係は、通常、論理ブロックと物理ブロックとの対応関係を記述したテーブルであるアドレス変換テーブルによって管理される。論理ブロックと物理ブロックの対応関係が変化したときには、ワークエリア(SRAM)8上で、アドレス変換テーブルの更新処理が行われる。アドレス変換テーブルは、一般に、起動時又はアクセス時に、各物理ブロックの冗長領域に記憶されている論理アドレス情報に基づいて作成されるが、フラッシュメモリ2に保存しておき、フラッシュメモリ2から読み出すこともできる。これにより、各物理ブロックの冗長領域から論理アドレス情報を読み出してアドレス変換テーブルを作成することに比べて、短時間で、アドレス変換テーブルを得ることができる。特に、上述のように物理ゾーンを構成せずに、各論理ゾーンに含まれる論理ブロックをいずれの物理ブロックにも対応させることができるようにする場合には、アドレス変換テーブルをフラッシュメモリ2に保存しておく方が好ましい。   The correspondence between logical blocks and physical blocks is usually managed by an address conversion table that is a table describing the correspondence between logical blocks and physical blocks. When the correspondence between the logical block and the physical block changes, the address conversion table is updated in the work area (SRAM) 8. The address conversion table is generally created based on logical address information stored in the redundant area of each physical block at the time of startup or access, but is stored in the flash memory 2 and read from the flash memory 2. You can also. As a result, the address conversion table can be obtained in a shorter time than reading the logical address information from the redundant area of each physical block and creating the address conversion table. In particular, the address translation table is stored in the flash memory 2 when the logical blocks included in each logical zone can be associated with any physical block without configuring the physical zone as described above. It is better to keep it.

また、アドレス変換テーブルをフラッシュメモリ2に保存する場合は、突然の電源遮断に対応するため、常に最新のアドレス変換テーブルがフラッシュメモリ2に保存されているようにすることが好ましい。つまり、論理ブロックと物理ブロックとの対応関係が変化する毎に(つまりワークエリア8上でアドレス変換テーブルが更新される都度に)、最新のアドレス変換テーブルをフラッシュメモリ2に保存するようにすることが好ましい。このアドレス変換テーブルをフラッシュメモリ2に保存するためにかかる時間を考慮すれば、論理ゾーン単位でアドレス変換テーブルを保存(管理)し、各論理ゾーンに含まれる論理ブロックの数を少なくする方が好ましい。   When the address conversion table is stored in the flash memory 2, it is preferable that the latest address conversion table is always stored in the flash memory 2 in order to cope with a sudden power interruption. That is, each time the correspondence between the logical block and the physical block changes (that is, every time the address conversion table is updated on the work area 8), the latest address conversion table is stored in the flash memory 2. Is preferred. Considering the time taken to store the address conversion table in the flash memory 2, it is preferable to store (manage) the address conversion table in units of logical zones and reduce the number of logical blocks included in each logical zone. .

そこで、本実施形態では、図2に示すように、論理ゾーンは形成されるが、物理ゾーンは形成されない。そして、どの論理ゾーンであるかに関わらず、各論理ゾーンに対して、全範囲の物理ブロックが割り当てられている。従って、どの論理ブロックがどの物理ブロックに割り当てられても良い。   Therefore, in this embodiment, as shown in FIG. 2, a logical zone is formed, but a physical zone is not formed. Regardless of which logical zone, the entire range of physical blocks is assigned to each logical zone. Accordingly, any logical block may be assigned to any physical block.

図2を参照して、論理ブロックと物理ブロックの対応関係を説明する。   With reference to FIG. 2, the correspondence between the logical block and the physical block will be described.

本実施形態では、図2に示すように、LBA#0−#2047999からなる2048000個の論理セクタ領域が、8192個の物理ブロックからなるフラッシュメモリ2側の記憶領域に割り当てられている。   In this embodiment, as shown in FIG. 2, 2048000 logical sector areas composed of LBA # 0 to # 20479999 are allocated to a storage area on the flash memory 2 side composed of 8192 physical blocks.

図2では、アドレス(LBA)が連続する256個の論理セクタ領域をまとめたものを論理ブロックとし、この論理ブロックに、前述したLBNが付されている。例えば、LBA#0−#255の256個の論理セクタ領域は、LBN#0の論理ブロックに属し、LBA#256−#511の256個の論理セクタ領域は、LBN#1の論理ブロックに属している。このように、LBA#0−#2047999の2048000個の論理セクタ領域は、LBN#0−#7999の8000個の論理ブロックのいずれかに属している。   In FIG. 2, a group of 256 logical sector areas having consecutive addresses (LBA) is defined as a logical block, and the above-described LBN is attached to this logical block. For example, the 256 logical sector areas of LBA # 0- # 255 belong to the logical block of LBN # 0, and the 256 logical sector areas of LBA # 256- # 511 belong to the logical block of LBN # 1. Yes. As described above, the 2048,000 logical sector areas of LBA # 0 to # 20479999 belong to one of 8000 logical blocks of LBN # 0 to # 7999.

更に、この論理ブロックを複数個まとめたものが論理ゾーンとされ、この論理ゾーンに、前述したLZNが付されている。図2では、LBNが連続する論理ブロックが異なる論理ゾーンに属するように、各論理ブロックが、LZN#0−#7の8個の論理ゾーンに対して順次振り分けられている。例えば、LBN#0の論理ブロックはLZN#0の論理ゾーンに、LBN#1の論理ブロックはLZN#1の論理ゾーンに、LBN#2の論理ブロックはLZN#2の論理ゾーンにという順番で、LZN#7の論理ゾーンまで、論理ブロックが振り分けられていく。以下、同様に、LBN#8の論理ブロックがLZN#0の論理ゾーンに、LBN#9の論理ブロックがLZN#1の論理ゾーンに、LBN#10の論理ブロックがLZN#2の論理ゾーンに振り分けられていく。このような振り分けが行われることにより、書き換え頻度の高い論理アクセス領域に対応する論理ブロックが特定の論理ゾーンに集中する確率を低くすることができる。従って、特定の論理ゾーンに対応したテーブル保存ブロックの変更頻度が、他の論理ゾーンに対応したテーブル保存ブロックの変更頻度よりも、著しく高くなってしまうことを抑制することができる。   In addition, a plurality of logical blocks are collected as a logical zone, and the above-described LZN is added to the logical zone. In FIG. 2, each logical block is sequentially allocated to the eight logical zones LZN # 0 to # 7 so that logical blocks with consecutive LBNs belong to different logical zones. For example, the logical block of LBN # 0 is in the logical zone of LZN # 0, the logical block of LBN # 1 is in the logical zone of LZN # 1, the logical block of LBN # 2 is in the logical zone of LZN # 2, The logical blocks are distributed to the logical zone of LZN # 7. Similarly, the logical block of LBN # 8 is allocated to the logical zone of LZN # 0, the logical block of LBN # 9 is allocated to the logical zone of LZN # 1, and the logical block of LBN # 10 is allocated to the logical zone of LZN # 2. It will be. By performing such distribution, it is possible to reduce the probability that logical blocks corresponding to logical access areas with high rewrite frequency are concentrated in a specific logical zone. Therefore, it is possible to suppress the change frequency of the table storage block corresponding to a specific logical zone from becoming significantly higher than the change frequency of the table storage block corresponding to another logical zone.

フラッシュメモリ2は、例えば8192個の物理ブロックで構成されている。8192個の物理ブロックには、固有の物理ブロックアドレス(PBA)が付されている。フラッシュメモリ2には、出荷時から不良である先天性の不良物理ブロックが存在することがある。更に、フラッシュメモリ2には、出荷時に良品の物理ブロックであっても、使用開始後に劣化して不良ブロックになる物理ブロック(後天性の不良ブロック)が存在することもある。   The flash memory 2 is composed of, for example, 8192 physical blocks. A unique physical block address (PBA) is assigned to 8192 physical blocks. The flash memory 2 may have a congenital defective physical block that is defective from the time of shipment. Further, the flash memory 2 may include a physical block (acquired defective block) that deteriorates after the start of use even if it is a good physical block at the time of shipment.

さて、NAND型フラッシュメモリでは、データ読み出し動作及びデータ書き込み動作はページ単位で行われ、データ消去動作は物理ブロック単位で行われる。データ消去動作は、論理アクセス領域が属する論理ブロック(以下、「書込み先論理ブロック」と言う)に対応した物理ブロックに記憶されているデータ又はそのデータに対応する最新データが別の物理ブロックに書き込まれ、その物理ブロックに記憶されているデータが全て別の物理ブロックに書き込まれたデータで置き換えられたときに行われる。すなわち、書込み先論理ブロックに対応した物理ブロックに記憶されているデータが、全て別の物理ブロックに書き込まれたデータで置き換えられた場合には、その物理ブロックに記憶されているデータが消去され、前述したアドレス変換テーブル(論理ブロックと物理ブロックとの対応関係を記述したテーブル)に記述されている論理ブロックと物理ブロックとの対応関係が更新される。また、書込み先論理ブロックを新たに割り当てる空きの物理ブロック(論理ブロックが未割当ての物理ブロック)を検索するときには、例えば、フラッシュメモリ2内の先頭の物理ブロックから末尾の物理ブロックへと順次に空きの物理ブロックの検索が行われる。そして、検出された空きの物理ブロックに、書込み先論理ブロックが割り当てられる。   In the NAND flash memory, a data read operation and a data write operation are performed in units of pages, and a data erase operation is performed in units of physical blocks. In the data erasure operation, the data stored in the physical block corresponding to the logical block to which the logical access area belongs (hereinafter referred to as “write destination logical block”) or the latest data corresponding to the data is written in another physical block. This is performed when all the data stored in the physical block is replaced with data written in another physical block. That is, when the data stored in the physical block corresponding to the write destination logical block is all replaced with the data written in another physical block, the data stored in the physical block is erased, The correspondence relationship between the logical block and the physical block described in the address conversion table (the table describing the correspondence relationship between the logical block and the physical block) is updated. When searching for a free physical block to which a write destination logical block is newly assigned (a physical block to which no logical block is assigned) is searched, for example, a free space is sequentially provided from the first physical block to the last physical block in the flash memory 2. The physical block is searched. Then, a write destination logical block is allocated to the detected free physical block.

以上のように、物理ブロックに記憶されているデータの書き換えが行われる場合には、その物理ブロックとは別の物理ブロック(空きの物理ブロック)に、その物理ブロックと対応する論理ブロックが新たに割り当てられることになる。また、書込み先論理ブロックに対応する物理ブロックがない場合にも、空きの物理ブロックに論理ブロックが新たに割り当てられることになる。   As described above, when data stored in a physical block is rewritten, a logical block corresponding to the physical block is newly added to a physical block (empty physical block) different from the physical block. Will be assigned. Further, even when there is no physical block corresponding to the write destination logical block, a logical block is newly allocated to an empty physical block.

本実施の形態では、メモリコントローラ3に、物理ブロックに対して新たに論理ブロックを割り当てる毎にカウント値をカウントアップするカウンタ機能が設けられている。具体的には、例えば、マイクロプロセッサ6が、カウンタの役割を果たし、物理ブロックに対して新たに論理ブロックを割り当てる毎に、カウント値をカウントアップする。カウント値は、メモリコントローラ3内の記憶領域、例えばワークエリア6(SRAM等の揮発性メモリ)に記憶され、ワークエリア6に記憶されているカウント値がカウントアップされる。ワークエリア6に記憶されているカウント値は、適時に(例えば、所定回数カウント値が更新される都度に)、フラッシュメモリ2に複写される(書き込まれる)。メモリコントローラ3の電源が遮断された場合、ワークエリア6に記憶されているカウント値は消去されるが、メモリコントローラ3の電源が投入された場合に、フラッシュメモリ2に記憶されているカウント値がワークエリア6に読み出され、以後、その読み出されたカウント値が、カウントアップされる。なお、カウント値は、カウントアップに限らず、カウントダウンなど他の規則に従って更新されても良い。また、カウント値の更新が行われるタイミングは、本実施の形態では、物理ブロックに対して新たに論理ブロックを割り当てる毎であるが、それに限らず、他のタイミング、例えば、物理ブロックの記憶データの消去が行われるタイミングであっても良い。また、メモリコントローラ3が、FeRAM(Ferroelectric Random Access Memory)、MRAM(Magnetic Random Access Memory)等の不揮発性RAMからなる記憶領域を有し、この記憶領域にカウント値を保持するようにしてもよい。このような不揮発性RAMにカウント値が保持されるようにした場合、不揮発性RAM上でカウント値を更新することができ、カウント値をフラッシュメモリ2に複写する必要がなくなる。   In the present embodiment, the memory controller 3 is provided with a counter function that counts up the count value each time a new logical block is allocated to a physical block. Specifically, for example, the microprocessor 6 plays the role of a counter and counts up the count value every time a new logical block is assigned to a physical block. The count value is stored in a storage area in the memory controller 3, for example, a work area 6 (volatile memory such as SRAM), and the count value stored in the work area 6 is counted up. The count value stored in the work area 6 is copied (written) to the flash memory 2 in a timely manner (for example, every time the count value is updated a predetermined number of times). When the memory controller 3 is powered off, the count value stored in the work area 6 is erased. However, when the memory controller 3 is powered on, the count value stored in the flash memory 2 is It is read to the work area 6 and the read count value is counted up thereafter. Note that the count value is not limited to counting up, and may be updated according to other rules such as counting down. Further, in this embodiment, the timing at which the count value is updated is every time a new logical block is allocated to the physical block. However, the timing is not limited to this, but other timing, for example, the storage data of the physical block is updated. The timing at which erasure is performed may be used. Further, the memory controller 3 may have a storage area composed of a nonvolatile RAM such as a FeRAM (Ferroelectric Random Access Memory) or MRAM (Magnetic Random Access Memory), and the count value may be held in this storage area. When the count value is held in such a nonvolatile RAM, the count value can be updated on the nonvolatile RAM, and it is not necessary to copy the count value to the flash memory 2.

物理ブロックに対して新たに論理ブロックが割り当てられた場合、新たに論理ブロックが割り当てられた物理ブロックの冗長領域に、その新たに割り当てられた論理ブロックを示す論理アドレス情報と、カウントアップ前のカウント値(カウントアップ後のカウント値でも良い)に基づくカウント情報とが書き込まれる。具体的には、例えば、図3に示すように、新たに論理ブロックが割り当てられた物理ブロックの冗長領域105に、論理アドレス情報として、割り当てられた論理ブロックを示すLBNが書き込まれ、カウント情報として、カウントアップ前の4バイトのカウント値の上位3バイトの部分が書き込まれる。   When a new logical block is allocated to a physical block, the logical address information indicating the newly allocated logical block and the count before counting up are added to the redundant area of the physical block to which the new logical block is allocated. Count information based on a value (or a count value after counting up) may be written. Specifically, for example, as shown in FIG. 3, LBN indicating the assigned logical block is written as the logical address information in the redundant area 105 of the physical block to which the new logical block is assigned, and the count information is provided as the count information. The upper 3 bytes of the 4-byte count value before counting up are written.

より具体的に言えば、図3に示す例によれば、(3A)に示すように、カウント値(16進数表示)が、“00 00 3F FAh”の場合において、空きの物理ブロックとして検出されたPBA#7の物理ブロックに、LBN#40の論理ブロックが新たに割り当てられると、そのPBA#7の物理ブロックの冗長領域105に、新たに割り当てられた論理ブロックのLBN“#40”と、カウントアップ前のカウント値の上位3バイトであるカウント情報“00 00 3Fh”が書き込まれる。そして、カウント値(16進数表示)が、“00 00 3F FAh”から“00 00 3F FBh”にカウントアップされる。   More specifically, according to the example shown in FIG. 3, as shown in (3A), when the count value (in hexadecimal notation) is “00 00 3F FAh”, it is detected as an empty physical block. When the logical block of LBN # 40 is newly assigned to the physical block of PBA # 7, the LBN “# 40” of the logical block newly assigned to the redundant area 105 of the physical block of PBA # 7, Count information “00 00 3Fh”, which is the upper 3 bytes of the count value before counting up, is written. Then, the count value (in hexadecimal notation) is counted up from “00 00 3F FAh” to “00 00 3F FBh”.

次に、例えば、(3B)に示すように、空きの物理ブロックとして検出されたPBA#12の物理ブロックに、LBN#41の論理ブロックが新たに割り当てられると、そのPBA#12の物理ブロックの冗長領域105に、新たに割り当てられた論理ブロックのLBN“#41”と、カウントアップ前のカウント値の上位3バイトであるカウント情報“00 00 3Fh”が書き込まれる。そして、カウント値が、“00 00 3F FBh”から“00 00 3F FCh”にカウントアップされる。   Next, for example, as shown in (3B), when a logical block of LBN # 41 is newly assigned to a physical block of PBA # 12 detected as an empty physical block, the physical block of that PBA # 12 In the redundant area 105, LBN “# 41” of the newly allocated logical block and count information “00 00 3Fh” which is the upper 3 bytes of the count value before counting up are written. Then, the count value is counted up from “00 00 3F FBh” to “00 00 3F FCh”.

以後も、同様にして、新たに論理ブロックが物理ブロックに割り当てられる毎に、新たに論理ブロックが割り当てられた物理ブロックの冗長領域105に、その割り当てられた論理ブロックのLBNと、カウントアップ前のカウント値の上位3バイトであるカウント情報とが書き込まれ、カウント値がカウントアップされる。例えば、(3C)に示すように、PBA#18の物理ブロックにLBN#42の論理ブロックが割り当てられた場合、PBA#18の物理ブロックの冗長領域105に、LBN“#42”及びカウント情報“00 00 3Fh”が書込まれ、カウント値が、“00 00 3F FCh”から“00 00 3F FDh”にカウントアップされる。その次に、(3D)に示すように、PBA#22の物理ブロックにLBN#43の論理ブロックが割り当てられた場合、PBA#22の物理ブロックの冗長領域105に、LBN“#43”及びカウント情報“00 00 3Fh”が書込まれ、カウント値が、“00 00 3F FDh”から“00 00 3F FEh”にカウントアップされる。その次に、(3E)に示すように、PBA#27の物理ブロックにLBN#44の論理ブロックが割り当てられた場合、PBA#27の物理ブロックの冗長領域105に、LBN“#44”及びカウント情報“00 00 3Fh”が書込まれ、カウント値が、“00 00 3F FEh”から“00 00 3F FFh”にカウントアップされる。その次に、(3F)に示すように、PBA#31の物理ブロックの物理ブロックにLBN#45の論理ブロックが割り当てられた場合、PBA#31の物理ブロックの冗長領域105に、LBN“#45”及びカウント情報“00 00 3Fh”が書込まれ、カウント値が、“00 00 3F FFh”から“00 00 40 00h”にカウントアップされる。   Thereafter, similarly, every time a new logical block is assigned to a physical block, the LBN of the assigned logical block and the LBN of the assigned logical block are added to the redundant area 105 of the newly assigned physical block. The count information which is the upper 3 bytes of the count value is written, and the count value is counted up. For example, as shown in (3C), when a logical block of LBN # 42 is assigned to a physical block of PBA # 18, LBN “# 42” and count information “ “00 00 3Fh” is written, and the count value is counted up from “00 00 3F FCh” to “00 00 3F FDh”. Next, as shown in (3D), when the logical block of LBN # 43 is allocated to the physical block of PBA # 22, LBN “# 43” and the count are added to the redundant area 105 of the physical block of PBA # 22. Information “00 00 3Fh” is written, and the count value is counted up from “00 00 3F FDh” to “00 00 3F FEh”. Next, as shown in (3E), when the logical block of LBN # 44 is allocated to the physical block of PBA # 27, the LBN “# 44” and the count are added to the redundant area 105 of the physical block of PBA # 27. Information “00 00 3Fh” is written, and the count value is counted up from “00 00 3F FEh” to “00 00 3F FFh”. Next, as shown in (3F), when the logical block of LBN # 45 is allocated to the physical block of the physical block of PBA # 31, the LBN “# 45” is assigned to the redundant area 105 of the physical block of PBA # 31. "And count information" 00 00 3Fh "are written, and the count value is counted up from" 00 00 3F FFh "to" 00 00 40 00h ".

尚、新たに論理ブロックが割り当てられる物理ブロックを検索するための空きブロック検索は、物理ゾーン内の物理ブロック又はホストシステムの記憶領域として用いられる全ての物理ブロックを対象にして行われる。物理ゾーン内の物理ブロックを対象とした検索の場合、物理ゾーン内の先頭の物理ブロックから末尾の物理ブロックに向かって、順次、空きブロックの検索が行われる。ホストシステムの記憶領域として用いられる全ての物理ブロックを対象とした検索の場合、それら全ての物理ブロックについて先頭の物理ブロックから末尾の物理ブロックに向かって、順次、空きブロックの検索が行われる。このように、検索対象の範囲に含まれる物理ブロックについて、先頭の物理ブロックから末尾の物理ブロックに向かう順番の空きブロックの検索が繰り返し行われることにより、殆ど書き換えが行われないデータ(書き換え頻度が低いデータ)が記憶されている物理ブロックがなければ、検索対象の範囲に含まれる物理ブロックの書き換え回数は、ほぼ均等になることが期待される。   A free block search for searching for a physical block to which a new logical block is newly assigned is performed for all physical blocks in the physical zone or used as a storage area of the host system. In the search for the physical block in the physical zone, the search for the empty block is sequentially performed from the first physical block in the physical zone to the last physical block. In a search for all physical blocks used as a storage area of the host system, empty blocks are sequentially searched from the first physical block to the last physical block for all the physical blocks. In this way, for the physical blocks included in the range to be searched, the search for empty blocks in the order from the first physical block to the last physical block is repeatedly performed, so that data that is hardly rewritten (rewrite frequency is If there is no physical block in which (low data) is stored, the number of rewrites of the physical block included in the search target range is expected to be substantially equal.

以上の説明によれば、データの書き換え(又は書き込み)を行う過程で、例えば、物理ブロックに対して8192個の論理ブロックの割り当てが新たに行われると、カウント値は、0(16進数表示:00 00 00 00h)から8192(16進数表示:00 00 20 00h)までカウントアップされる。また、各物理ブロックに対して新たな論理ブロックが割り当てられたときに、各物理ブロックの冗長領域105に、カウント値の上位3バイトがカウント情報として書き込まれる。従って、各物理ブロックの冗長領域105には、“00 00 00h”から“00 00 1Fh”までのいずれかの値がカウント情報として書き込まれている。   According to the above description, in the process of rewriting (or writing) data, for example, when 8192 logical blocks are newly assigned to a physical block, the count value is 0 (hexadecimal number display: From 00 00 00 00h) to 8192 (hexadecimal display: 00 00 20 00h). When a new logical block is assigned to each physical block, the upper 3 bytes of the count value are written as count information in the redundant area 105 of each physical block. Therefore, any value from “00 00 00h” to “00 00 1Fh” is written as count information in the redundant area 105 of each physical block.

その後、更に8192個の論理ブロックの割り当てが新たに行われた場合、カウント値は、8192(16進数表示:00 00 20 00h)から16384(16進数表示:00 00 40 00h)までカウントアップされる。この期間に、新たな論理ブロックが割り当てられた物理ブロックの冗長領域105には、“00 00 20h”から“00 00 3Fh”までのいずれかの値がカウント情報として書き込まれている。   After that, when 8192 logical blocks are newly allocated, the count value is counted up from 8192 (hexadecimal display: 00 00 20 00h) to 16384 (hexadecimal display: 00 00 40 00h). . During this period, any value from “00 00 20h” to “00 00 3Fh” is written as count information in the redundant area 105 of the physical block to which a new logical block is allocated.

ここで、“00 00 1Fh”以下の値がカウント情報として書き込まれている物理ブロックについては、カウント値が8192(16進数表示:00 00 20 00h)から16384(16進数表示:00 00 40 00h)までカウントアップされる期間に、新たな論理ブロックが割り当てられていないことが分かる。なぜなら、その期間に新たな論理ブロックが割り当てられた物理ブロックの冗長領域105には、カウント情報として“00 00 20”から“00 00 3F”までのいずれかの値がカウント情報として書き込まれ、“00 00 1Fh”以下の値のカウント情報が書き込まれることは無いためである。また、物理ブロックの総数を、1024個と仮定した場合(図2の例では、8192個であるが、ここでは以降の説明を分かり易くするために、物理ブロックの総数を1024個とする)、この期間中に少なくとも8回(8192÷1024)新たな論理ブロックが割り当てられた物理ブロックが存在することになる。   Here, for a physical block in which a value equal to or less than “00 00 1Fh” is written as count information, the count value is from 8192 (hexadecimal display: 00 00 20 00h) to 16384 (hexadecimal display: 00 00 40 00h). It can be seen that no new logical block is allocated during the period counted up to. This is because any value from “00 00 20” to “00 00 3F” is written as count information in the redundant area 105 of the physical block to which a new logical block is allocated during that period. This is because the count information having a value of “00 00 1Fh” or less is never written. Also, assuming that the total number of physical blocks is 1024 (in the example of FIG. 2, it is 8192, but here the total number of physical blocks is 1024 in order to make the following description easy to understand) There are physical blocks to which a new logical block has been allocated at least 8 times (8192 ÷ 1024) during this period.

本実施の形態では、例えば、カウント値が16384(16進数表示:00 00 40 00h)にカウントアップされたときに、書き換え頻度の低いデータが記憶されている物理ブロックとして、“00 00 1Fh”以下の値がカウント情報として書き込まれている物理ブロックの検索が行われる(例えば、先頭の物理ブロックから末尾の物理ブロックにかけて順次にそのような物理ブロックが検索される)。そして、そのような物理ブロックが検出された場合に、その物理ブロックに記憶されているデータが別の物理ブロックに転送(複写)される。具体的には、その検出された物理ブロック(以下、「転送元の物理ブロック」と言う)に記憶されているデータの転送先となる物理ブロック(以下、「転送先の物理ブロック」と言う)を探す空きブロック検索が行われる。この検索で検出された空きブロック(転送先の物理ブロック)に対して、転送元の物理ブロックに割り当てられている論理ブロックが新たに割り当てられ、この転送先の物理ブロックに、転送元の物理ブロックに記憶されているデータが転送(複写)される。そして、この転送先の物理ブロックの冗長領域105に、新たに割り当てられた論理ブロックのLBN(転送元の物理ブロックに割り当てられている論理ブロックのLBN)と、カウントアップ前のカウント値の上位3バイトであるカウント情報とが書き込まれる。その後、転送元の物理ブロックに記憶されているデータと、その物理ブロックの冗長領域105に記憶されているLBN及びカウント情報等の付加データとが消去される。つまり、転送元の物理ブロックのユーザ領域に記憶されているデータと冗長領域に記憶されている付加データが一括して消去される。また、物理ブロックに対して新たに論理ブロックが割り当てられたため、カウント値がカウントアップされる。以下、図4を参照して具体的に説明する。   In this embodiment, for example, when the count value is counted up to 16384 (hexadecimal notation: 00 00 40 00h), the physical block storing data with low rewrite frequency is “00 00 1Fh” or less. Is searched for (for example, such physical blocks are sequentially searched from the first physical block to the last physical block). When such a physical block is detected, the data stored in the physical block is transferred (copied) to another physical block. Specifically, a physical block that is a transfer destination of data stored in the detected physical block (hereinafter referred to as “transfer source physical block”) (hereinafter referred to as “transfer destination physical block”) An empty block search is performed to search for. A logical block assigned to the transfer source physical block is newly assigned to the free block (transfer destination physical block) detected by this search, and the transfer source physical block is transferred to the transfer destination physical block. The data stored in is transferred (copied). Then, in the redundant area 105 of the physical block of the transfer destination, the LBN of the logical block newly allocated (LBN of the logical block allocated to the physical block of the transfer source) and the upper 3 of the count value before counting up Count information that is a byte is written. Thereafter, the data stored in the transfer source physical block and the additional data such as LBN and count information stored in the redundant area 105 of the physical block are erased. That is, the data stored in the user area of the transfer source physical block and the additional data stored in the redundant area are erased collectively. Further, since a logical block is newly assigned to the physical block, the count value is counted up. Hereinafter, a specific description will be given with reference to FIG.

カウント値が16384(16進数表示:00 00 40 00h)にカウントアップされた場合に、“00 00 1Fh”以下の値を表すカウント情報が記憶されている物理ブロックの検索が行われる。この検索により、まず、“00 00 1Ah”を記憶しているPBA#6の物理ブロックが検出される。この場合、そのPBA#6の物理ブロックに記憶されているデータが、空きの物理ブロックとして検出されたPBA#34の物理ブロックに複写され、且つ、そのPBA#34の物理ブロックの冗長領域105に、PBA#6の物理ブロックに割り当てられていた論理ブロックのLBN“#6”と、カウントアップ前のカウント値の上位3バイトであるカウント情報“00 00 40h”とが書き込まれる((4D)参照)。その後、PBA#6の物理ブロックに記憶されているデータと、そのPBA#6の物理ブロックの冗長領域105に記憶されているLBN“#6”及びカウント情報“00 00 1Ah”等の付加データとが消去される((4A)参照)。また、カウント値が、“00 00 40 00h”から“00 00 40 01h”にカウントアップされる。   When the count value is counted up to 16384 (hexadecimal notation: 00 00 40 00h), a search is made for a physical block in which count information representing a value equal to or less than “00 00 1Fh” is stored. By this search, first, a physical block of PBA # 6 storing “00 00 1Ah” is detected. In this case, the data stored in the physical block of the PBA # 6 is copied to the physical block of the PBA # 34 detected as an empty physical block, and is also stored in the redundant area 105 of the physical block of the PBA # 34. The LBN “# 6” of the logical block allocated to the physical block of PBA # 6 and the count information “00 00 40h” that is the upper 3 bytes of the count value before counting up are written (see (4D)). ). After that, the data stored in the physical block of PBA # 6 and the additional data such as LBN “# 6” and count information “00 00 1Ah” stored in the redundant area 105 of the physical block of PBA # 6 Is deleted (see (4A)). Further, the count value is counted up from “00 00 40 00h” to “00 00 40 01h”.

次に、“00 00 10h”を記憶しているPBA#15の物理ブロックが検出される。この場合、そのPBA#15の物理ブロックに記憶されているデータが、空きの物理ブロックとして検出されたPBA#35の物理ブロックに複写され、且つ、そのPBA#35の物理ブロックの冗長領域105に、PBA#15の物理ブロックに割り当てられていた論理ブロックのLBN“#15”と、カウントアップ前のカウント値の上位3バイトであるカウント情報“00 00 40h”とが書き込まれる((4E)参照)。その後、PBA#15の物理ブロックに記憶されているデータと、そのPBA#15の物理ブロックの冗長領域105に記憶されているLBN“#15”及びカウント情報“00 00 10h”等の付加データとが消去される((4B)参照)。また、カウント値が、“00 00 40 01h”から“00 00 40 02h”にカウントアップされる。   Next, the physical block of PBA # 15 storing “00 00 10h” is detected. In this case, the data stored in the physical block of the PBA # 15 is copied to the physical block of the PBA # 35 detected as an empty physical block, and the data is stored in the redundant area 105 of the physical block of the PBA # 35. The LBN “# 15” of the logical block assigned to the physical block of PBA # 15 and the count information “00 00 40h” that is the upper 3 bytes of the count value before counting up are written (see (4E)). ). After that, the data stored in the physical block of PBA # 15 and the additional data such as LBN “# 15” and count information “00 00 10h” stored in the redundant area 105 of the physical block of PBA # 15 Is deleted (see (4B)). The count value is counted up from “00 00 40 01h” to “00 00 40 02h”.

次に、“00 00 0Fh”を記憶しているPBA#16の物理ブロックが検出される。この場合、そのPBA#16の物理ブロックに記憶されているデータが、空きの物理ブロックとして検出されたPBA#36の物理ブロックに複写され、且つ、そのPBA#36の物理ブロックの冗長領域105に、PBA#16の物理ブロックに割り当てられていた論理ブロックのLBN“#16”と、カウントアップ前のカウント値の上位3バイトであるカウント情報“00 00 40h”とが書き込まれる((4F)参照)。その後、PBA#16の物理ブロックに記憶されているデータと、そのPBA#16の物理ブロックの冗長領域105に記憶されているLBN“#16”及びカウント情報“00 00 0Fh”等の付加データとが消去される((4C)参照)。また、カウント値が、“00 00 40 02h”から“00 00 40 03h”にカウントアップされる。   Next, the physical block of PBA # 16 storing “00 00 0Fh” is detected. In this case, the data stored in the physical block of the PBA # 16 is copied to the physical block of the PBA # 36 detected as an empty physical block, and the data is stored in the redundant area 105 of the physical block of the PBA # 36. The LBN “# 16” of the logical block allocated to the physical block of PBA # 16 and the count information “00 00 40h” which is the upper 3 bytes of the count value before counting up are written (see (4F)). ). After that, the data stored in the physical block of PBA # 16 and additional data such as LBN “# 16” and count information “00 00 0Fh” stored in the redundant area 105 of the physical block of PBA # 16 Is deleted (see (4C)). Also, the count value is counted up from “00 00 40 02h” to “00 00 40 03h”.

以上により、カウント値が8192(16進数表示:00 00 20 00h)から16384(16進数表示:00 00 40 00h)までの期間に新たな論理ブロックが割り当てられていない物理ブロック、つまり、“00 00 1Fh”以下の値がカウント情報として書き込まれている物理ブロックが、書き込み頻度の低い物理ブロックとみなされて、その物理ブロックを含めたウェアー・レベリング制御が行われことになる。言い換えれば、現在のカウント値における上位3バイト(つまりカウント情報に相当する部分)である“00 00 40”との差が所定値以上であるカウント情報(“00 00 1Fh”以下の値を示すカウント情報)が記憶されている物理ブロックが、書き込み頻度の低い物理ブロックとみなされる。尚、この書き込み頻度の低い物理ブロックの検索処理と、この検索処理で検出された物理ブロックに記憶されているデータを別の物理ブロックに複写するデータ転送処理は、必ずしもカウント値が16384(16進数表示:00 00 40 00h)に達した直後に開始する必要はなく、カウント値が16384(16進数表示:00 00 40 00h)に達した後のアイドル時間(例えばホストシステム4からのアクセスが無い期間)に行われてもよい。また、これらの処理の実行中にホストシステム4からのアクセスがあったときは、一旦、処理が中止され、その後、再度アイドル時間が発生したときに処理が再開されてもよい。   As described above, a physical block to which a new logical block is not allocated in a period from a count value of 8192 (hexadecimal display: 00 00 20 00h) to 16384 (hexadecimal display: 00 00 40 00h), that is, “00 00 A physical block in which a value of 1 Fh ″ or less is written as count information is regarded as a physical block with a low writing frequency, and wear leveling control including the physical block is performed. In other words, the count information (the count indicating a value less than “00 00 1Fh”) whose difference from “00 00 40” which is the upper 3 bytes (that is, the portion corresponding to the count information) in the current count value is a predetermined value or more. The physical block in which (information) is stored is regarded as a physical block with a low writing frequency. Note that the search value of the physical block with low write frequency and the data transfer process of copying the data stored in the physical block detected by this search process to another physical block do not necessarily have a count value of 16384 (hexadecimal number). It is not necessary to start immediately after reaching 00 00 40 00h), and idle time after the count value reaches 16384 (hexadecimal display: 00 00 40 00h) (for example, a period when there is no access from the host system 4) ). Further, when there is an access from the host system 4 during execution of these processes, the process may be temporarily stopped, and then the process may be resumed when the idle time occurs again.

この後、更にカウント値が16384(16進数表示:00 00 40 00h)から24576(16進数表示:00 00 60 00h)までカウントアップされたときには、“00 00 3Fh”以下の値がカウント情報として書き込まれている物理ブロックの検索が行われる。そのような物理ブロックが検出された場合には、その物理ブロックに記憶されているデータが別の物理ブロックに複写(転送)される。   Thereafter, when the count value is further counted up from 16384 (hexadecimal display: 00 00 40 00h) to 24576 (hexadecimal display: 00 00 60 00h), a value equal to or less than “00 00 3Fh” is written as count information. A search is made for the physical block being stored. When such a physical block is detected, the data stored in the physical block is copied (transferred) to another physical block.

このように、書き換えが頻繁に行われていない物理ブロックの検索は、物理ブロックの総数(例えば1024)に所定数(例えば、8)を乗じて得られた個数分(例えば8192個分)の新たな論理ブロックの割り当てが行われる毎に実行されることが好ましい。つまり、物理ブロックの総数をn(nは1以上の整数)、所定数k(kは1以上の整数)とした場合、カウント値がn×k増加する毎に、書き換えが頻繁に行われていない物理ブロックの検索が行われる。この検索では、カウント値がn×k増加する期間に新たな物理ブロックが割り当てられなかった物理ブロックの検索が行われ、この検索で検出された物理ブロックが書き換え頻度の低いデータが記憶されている物理ブロックとみなされる。そして、その物理ブロックに記憶されているデータが別の物理ブロックに転送(複写)される。   As described above, the search for physical blocks that are not frequently rewritten is performed by multiplying the total number of physical blocks (for example, 1024) by a predetermined number (for example, 8) to obtain a new number (for example, 8192). It is preferably executed every time a logical block is assigned. That is, when the total number of physical blocks is n (n is an integer equal to or greater than 1) and the predetermined number k (k is an integer equal to or greater than 1), rewrite is frequently performed every time the count value increases by n × k. A search for missing physical blocks is performed. In this search, a search is made for a physical block to which a new physical block has not been assigned in a period in which the count value increases by n × k, and data with a low rewrite frequency is stored in the physical block detected by this search. Considered a physical block. Then, the data stored in the physical block is transferred (copied) to another physical block.

尚、書き換え頻度の低いデータが記憶されている物理ブロックとみなされた物理ブロックは、その物理ブロックに記憶されているデータが別の物理ブロックに転送(複写)された後に記憶データが消去され、空きの物理ブロックとされる。空きとされた物理ブロックは、それまでの書き換え回数が少ない可能性があるが、空きブロックになったことにより、この後の書き換え回数が多くなる可能性が高くなる。逆に、データの複写先となった物理ブロックは、それまでの書き換え回数が多い可能性があるが、書き換え頻度の低いデータが複写されたことにより、この後の書き換え回数が少なくなる可能性が高くなる。このような原理により、フラッシュメモリ2における複数の物理ブロックの書き換え回数が均等化されることが期待できる。   A physical block that is regarded as a physical block in which data with low rewrite frequency is stored is erased after the data stored in the physical block is transferred (copied) to another physical block, It is considered as an empty physical block. There is a possibility that the physical block that has been made empty has a small number of rewrites up to that point. Conversely, the physical block that is the data copy destination may have a large number of rewrites up to that point, but the data with a low rewrite frequency may be copied, which may reduce the number of subsequent rewrites. Get higher. Based on such a principle, it can be expected that the number of rewrites of a plurality of physical blocks in the flash memory 2 is equalized.

なお、フラッシュメモリ内の物理ブロックの総数は、フラッシュメモリ2に書き込まれているID情報(フラッシュメモリ2の構成に関する情報)に基づいて求めることができる。具体的には、例えば、ID情報には、フラッシュメモリ2全体の記憶容量を示す情報と、ブロックサイズ(1個の物理ブロックの記憶容量)を示す情報とが含まれており、それ故、フラッシュメモリ2全体の記憶容量とブロックサイズとから物理ブロックの総数を計算することができる。また、カウント情報は、カウント値の全てのビットであっても一部のビットであってもよいが、所定の期間(カウント値が所定値分増加するまでの期間)書き換えられていない物理ブロックを判別できる情報でなければならない。この判別ができる範囲でカウント値の一部のビットがカウント情報とされるときは、冗長領域の記憶容量と、冗長領域に書き込まれるカウント情報以外の情報の容量とを考慮してカウント情報のビット数が決定されても良い。   Note that the total number of physical blocks in the flash memory can be obtained based on ID information (information on the configuration of the flash memory 2) written in the flash memory 2. Specifically, for example, the ID information includes information indicating the storage capacity of the entire flash memory 2 and information indicating a block size (storage capacity of one physical block). The total number of physical blocks can be calculated from the storage capacity and block size of the entire memory 2. The count information may be all or a part of the count value, but the physical block that has not been rewritten for a predetermined period (the period until the count value increases by a predetermined value). The information must be distinguishable. When some bits of the count value are used as count information within this discriminable range, the count information bits take into account the storage capacity of the redundant area and the capacity of information other than the count information written to the redundant area. The number may be determined.

以下、本実施の形態で行われる処理の流れの概要を、図5を参照して説明する。   Hereinafter, an outline of the flow of processing performed in the present embodiment will be described with reference to FIG.

本実施の形態に係るウェアー・レベリング制御を行う場合には、まず、初期設定が行われる(ステップ101)。具体的には、例えば、メモリコントローラ3が、ID情報をフラッシュメモリ2から読出し、そのID情報から把握されるフラッシュメモリ2全体の記憶容量とブロックサイズとを基に、物理ブロックの総数nを算出する。更に、算出されたnと上記所定数kに基づいてカウント値がn×k増加する毎に、上記検索処理と上記データ転送処理を実行することが決定される。また、カウンタのカウント値が0に設定される。なお、所定数kは、予め決められていても良いし、物理ブロックの総数nに基づいて決定されても良い。また、カウント値の上位何バイトをカウント情報として用いるかは、予め決められていても良いし、物理ブロックの総数nに基づいて決定されても良い。ここでは、カウント値の上位3バイトがカウント情報として用いられる。   When performing wear leveling control according to the present embodiment, first, initial setting is performed (step 101). Specifically, for example, the memory controller 3 reads the ID information from the flash memory 2, and calculates the total number n of physical blocks based on the storage capacity and block size of the entire flash memory 2 ascertained from the ID information. To do. Further, it is determined that the search process and the data transfer process are executed every time the count value increases by n × k based on the calculated n and the predetermined number k. In addition, the count value of the counter is set to zero. The predetermined number k may be determined in advance, or may be determined based on the total number n of physical blocks. Further, the upper bytes of the count value to be used as the count information may be determined in advance or may be determined based on the total number n of physical blocks. Here, the upper 3 bytes of the count value are used as count information.

初期設定の後、メモリコントローラ3は、ホストシステム4から書込みコマンドを受信した場合、その書込みコマンドで指定された論理アクセス領域が属する論理ブロックに対応させる物理ブロックを新たに設定する必要があるかどうかを判断する(ステップ102)。その必要がある場合は(ステップ102でYES)、メモリコントローラ3によって、空きブロックの検索が行われ、検出された空きブロックに書込みコマンドで指定された論理アクセス領域が属する論理ブロックが割り当てられる(ステップ103)。具体的には、検出された空きブロック(物理ブロック)の冗長領域105に、書込みコマンドで指定された論理アクセス領域が属する論理ブロックのLBNと、カウンタのカウント値の上位3バイトであるカウント情報とが書き込まれ、その後、カウンタのカウント値がカウントアップされる。   After the initial setting, when the memory controller 3 receives a write command from the host system 4, it is necessary to newly set a physical block corresponding to the logical block to which the logical access area specified by the write command belongs. Is determined (step 102). If it is necessary (YES in step 102), the memory controller 3 searches for a free block and assigns a logical block to which the logical access area designated by the write command belongs to the detected free block (step). 103). Specifically, the LBN of the logical block to which the logical access area specified by the write command belongs to the redundant area 105 of the detected free block (physical block), and the count information that is the upper 3 bytes of the count value of the counter, Is written, and then the count value of the counter is counted up.

ステップ103でカウントアップされたカウンタのカウント値が、(n×k)の倍数であるか否かが判定される(ステップ104)。(n×k)の倍数とは、前述の例(n=1024、k=8)で言えば、8192、16384、24576、…である。   It is determined whether or not the count value of the counter counted up in step 103 is a multiple of (n × k) (step 104). The multiple of (n × k) is 8192, 16384, 24576,... In the above example (n = 1024, k = 8).

カウントアップ後のカウント値が(n×k)の倍数であるとの判定結果であれば(ステップ104でYES)、書き換え頻度の低いデータが記憶されている物理ブロックの検索処理が行われ、書き換え頻度の低いデータが記憶されている物理ブロックが検出された場合には、検出された物理ブロックに記憶されているデータを別の物理ブロックに複写するデータ転送処理が行われる(ステップ105)。具体的には、カウンタのカウント値が(n×k)の倍数に達したときに、カウント値が(n×k)増加した期間内に論理ブロックが新たに割り当てられていない物理ブロックが検索される。つまり、カウンタのカウント値が(n×k)の倍数に達したときに、そのカウント値から(n×k)の値を引いた値よりも小さい値に対応するカウント情報が書き込まれている物理ブロックの検索が行われる。そして、これに該当する物理ブロックが検出された場合には、検出された物理ブロックの記憶されているデータが別の物理ブロックに転送された後、検出された物理ブロックの記憶データが消去される。   If it is determined that the count value after the count-up is a multiple of (n × k) (YES in step 104), a search process of a physical block storing data with low rewrite frequency is performed, and rewrite is performed. When a physical block in which infrequent data is stored is detected, data transfer processing for copying the data stored in the detected physical block to another physical block is performed (step 105). Specifically, when the count value of the counter reaches a multiple of (n × k), a physical block to which a logical block is not newly allocated is searched within a period in which the count value has increased (n × k). The That is, when the count value of the counter reaches a multiple of (n × k), physical information in which count information corresponding to a value smaller than the value obtained by subtracting the value of (n × k) from the count value is written. A block search is performed. When a physical block corresponding to this is detected, the data stored in the detected physical block is transferred to another physical block, and then the stored data in the detected physical block is erased. .

ステップ105では、書き換え頻度の低いデータが記憶されている物理ブロックが検出されなければ、データ転送処理は行われないが、書き換え頻度の低いデータが記憶されている物理ブロックが検出されば、データ転送処理が行われる。つまり、書き換え頻度の低いデータが記憶されている物理ブロックが存在するときだけ、その物理ブロックに記憶されている書き換え頻度の低いデータを別の物理ブロックに複写するデータ転送処理が行われる。   In step 105, data transfer processing is not performed unless a physical block storing data with low rewrite frequency is detected, but data transfer is performed when a physical block storing data with low rewrite frequency is detected. Processing is performed. That is, only when there is a physical block storing data with low rewrite frequency, data transfer processing for copying data with low rewrite frequency stored in the physical block to another physical block is performed.

以上が、本実施形態についての説明である。   The above is the description of the present embodiment.

本実施形態によれば、メモリコントローラ3に、物理ブロックに対して新たに論理ブロックが割り当てられる毎にカウント値をカウントアップするカウンタ機能が設けられる。そして、新たに論理ブロックが割り当てられた物理ブロックの冗長領域105には、カウンタ機能によって管理されているカウント値に基づくカウント情報が書き込まれる。そして、物理ブロックの冗長領域105にカウント情報が書き込まれた後に、カウント値がカウントアップされる。   According to this embodiment, the memory controller 3 is provided with a counter function that counts up the count value each time a new logical block is assigned to a physical block. The count information based on the count value managed by the counter function is written in the redundant area 105 of the physical block to which the logical block is newly allocated. Then, after the count information is written in the redundant area 105 of the physical block, the count value is counted up.

更に、所定のタイミングで(前述の例では、カウント値がn×k増加する毎に)、書き換え頻度が低いデータが記憶されている物理ブロックの検索が行われる。この検索処理では、カウンタ機能によって管理されているカウント値のカウント情報を示す部分(つまり上位3バイト)の値との差が所定値以上である値を示すカウント情報が記憶されている物理ブロックが、書き換え頻度が低いデータが記憶されている物理ブロックとみなされ、それに該当する物理ブロックの検索が行われる。そして、そのような物理ブロックが検出された場合にのみ、検出された物理ブロックに記憶されているデータが別の物理ブロックに転送(複写)される。つまり、本実施形態によれば、書き換え頻度が低いデータが記憶されている物理ブロックが存在するときだけ、その物理ブロックを含めたウェアー・レベリング制御が行われる。   Furthermore, at a predetermined timing (in the above example, every time the count value increases by n × k), a physical block in which data with low rewrite frequency is stored is searched. In this search process, a physical block in which count information indicating a value that is greater than or equal to a predetermined value from a value of a portion indicating count information of the count value managed by the counter function (that is, the upper 3 bytes) is stored. The physical block in which data with a low rewrite frequency is stored is considered, and the corresponding physical block is searched. Only when such a physical block is detected, the data stored in the detected physical block is transferred (copied) to another physical block. That is, according to the present embodiment, wear leveling control including a physical block is performed only when there is a physical block storing data with low rewrite frequency.

また、本実施形態によれば、どんな場合に書き換え頻度が低いデータが記憶されている物理ブロックを検索するかという条件の設定は、フラッシュメモリ2から読み出されたID情報に基づき算出された物理ブロック総数nに基づいて自動的に行われるため、ユーザによる条件設定は不要である。   Further, according to the present embodiment, the setting of a condition for searching for a physical block in which data with low rewrite frequency is stored is set in the physical calculated based on the ID information read from the flash memory 2. Since it is automatically performed based on the total number n of blocks, it is not necessary to set conditions by the user.

以下、本発明の第二の実施形態を説明する。その際、第一の実施形態との相違点を主に説明し、第一の実施形態との共通点については、説明を省略或いは簡略する。   Hereinafter, a second embodiment of the present invention will be described. In this case, differences from the first embodiment will be mainly described, and description of common points with the first embodiment will be omitted or simplified.

本実施形態では、アドレス変換テーブルが、図6に示すように、論理ゾーン毎に用意される。各アドレス変換テーブルは、対応する論理ゾーンを構成する各論理ブロックについてのみ、どの論理ブロックがどの物理ブロックに対応しているかを管理する。図6では、参照符号103−0は、論理ゾーンに付した通し番号である論理ゾーン番号(LZN)が#0である論理ゾーンに対応したアドレス変換テーブルであり、参照符号103−1は、LZNが#1である論理ゾーンに対応したアドレス変換テーブルである。各アドレス変換テーブル(103−0及び103−1)には、対応する論理ゾーンを構成する各論理ブロックについてのみ、論理ブロックのLBNと、その論理ブロックが割り当てられている物理ブロックの物理ブロックアドレス(PBA)とが記録される。このため、それぞれのアドレス変換テーブル(論理ゾーン毎のアドレス変換テーブル)のサイズは、全ての論理ブロックを一つのアドレス変換テーブルで管理する場合に比べて小さい。論理ゾーン毎のアドレス変換テーブルは、異なる物理ブロックに保存される。言い換えれば、二以上の論理ゾーンに対応する二以上のアドレス変換テーブルが、同時に同一の物理ブロックに保存されることはない。例えば、LZN#0の論理ゾーンに対応したアドレス変換テーブル103−0は、PBA#5の物理ブロックに保存され、LZN#1の論理ゾーンに対応したアドレス変換テーブル103−1は、PBA#1076の物理ブロックに保存される。以下、アドレス変換テーブルの保存先の物理ブロックを、「テーブル保存ブロック」と言う。アドレス変換テーブルは、ワークエリア8上で更新される都度に、図6に示すように、テーブル保存ブロックである物理ブロック内の領域(一以上の空きの物理ページ又は物理ページ内の空き領域)に保存される。例えば、論理ゾーン毎のアドレス変換テーブルを、1つの物理ページに保存できるサイズに設定し、アドレス変換テーブルが更新される毎に先頭の物理ページから順番にアドレス変換テーブルを保存していった場合、テーブル保存ブロックには64個のアドレス変換テーブルを保存することができる。このテーブル保存ブロックに64個のアドレス変換テーブルが保存され、アドレス変換テーブルを保存可能な空きの領域が存在しない場合には、別の物理ブロックがテーブル保存ブロックとして割り当てられる。図6に示すように、LZN#1の論理ゾーンに対応したアドレス変換テーブルのテーブル保存ブロックであるPBA#1076の物理ブロックの最後尾の物理ページ#63までアドレス変換テーブル103−1が保存されている場合、PBA#1076の物理ブロック内にはアドレス変換テーブルを保存するための空きの領域が存在しない。従って、この後に、アドレス変換テーブル103−1が更新されたならば、アドレス変換テーブル103−1のテーブル保存ブロックとして、別の物理ブロック(空きの物理ブロック)が割り当てられ、その別の物理ブロックに、更新後のアドレス変換テーブル103−1が保存される。以下、このような、テーブル保存ブロックとして別の物理ブロックが割り当てられる処理を、「テーブル保存ブロックの変更」と言う。   In this embodiment, an address conversion table is prepared for each logical zone as shown in FIG. Each address conversion table manages which logical block corresponds to which physical block only for each logical block constituting the corresponding logical zone. In FIG. 6, reference numeral 103-0 is an address conversion table corresponding to a logical zone whose logical zone number (LZN), which is a serial number assigned to the logical zone, is # 0. It is an address conversion table corresponding to the logical zone # 1. Each address conversion table (103-0 and 103-1) includes the LBN of the logical block and the physical block address of the physical block to which the logical block is assigned (for each logical block constituting the corresponding logical zone). PBA) is recorded. For this reason, the size of each address conversion table (address conversion table for each logical zone) is smaller than when all logical blocks are managed by one address conversion table. The address conversion table for each logical zone is stored in different physical blocks. In other words, two or more address conversion tables corresponding to two or more logical zones are not simultaneously stored in the same physical block. For example, the address conversion table 103-0 corresponding to the logical zone of LZN # 0 is stored in the physical block of PBA # 5, and the address conversion table 103-1 corresponding to the logical zone of LZN # 1 is stored in PBA # 1076. Stored in physical block. Hereinafter, the physical block where the address translation table is stored is referred to as a “table storage block”. Each time the address conversion table is updated on the work area 8, as shown in FIG. 6, an area in a physical block (one or more free physical pages or a free area in a physical page) that is a table storage block is stored. Saved. For example, if the address conversion table for each logical zone is set to a size that can be stored in one physical page, and the address conversion table is stored in order from the first physical page every time the address conversion table is updated, The table storage block can store 64 address conversion tables. When 64 address conversion tables are stored in this table storage block and there is no free area in which the address conversion table can be stored, another physical block is allocated as a table storage block. As shown in FIG. 6, the address conversion table 103-1 is stored up to the last physical page # 63 of the physical block of PBA # 1076 which is the table storage block of the address conversion table corresponding to the logical zone of LZN # 1. If there is, there is no empty area for storing the address translation table in the physical block of PBA # 1076. Therefore, if the address translation table 103-1 is updated thereafter, another physical block (empty physical block) is assigned as the table storage block of the address translation table 103-1, and the other physical block is assigned to the other physical block. The updated address conversion table 103-1 is stored. Hereinafter, such a process in which another physical block is allocated as a table storage block is referred to as “a table storage block change”.

また、本実施形態では、メモリコントローラ3が、どの論理ゾーンに対応したアドレス変換テーブルがどの物理ブロックに保存されているかを示す情報(以下、「テーブル管理情報」と言う)を管理している。図6に示した例では、テーブル管理情報101に、各論理ゾーンのLZNと、そのLZNの論理ゾーンに対応したアドレス変換テーブルのテーブル保存ブロックのPBAとの対応関係が判別できる情報が含まれている。このテーブル管理情報101を参照することにより、例えば、LZN#0の論理ゾーンに対応したアドレス変換テーブル103−0のテーブル保存ブロックが、PBA#5の物理ブロックであることや、LZN#1の論理ゾーンに対応したアドレス変換テーブル103−1のテーブル保存ブロックが、PBA#1076の物理ブロックであることがわかる。テーブル管理情報101は、予め設定されている2個以上のテーブル管理情報用の物理ブロック(以下、「管理情報ブロック候補」と言う)のうちのいずれかの物理ブロックに保存される。この例では、PBA#0とPBA#1の物理ブロック(つまり2個の物理ブロック)が、管理情報ブロック候補として設定されている。従って、テーブル管理情報は、PBA#0又はPBA#1のいずれかの物理ブロックに保存される。以下、この管理情報ブロック候補(PBA#0とPBA#1の物理ブロック)から選択された、テーブル管理情報の保存先の物理ブロックを、「管理情報ブロック」と言う。テーブル管理情報101は、いずれかの論理ゾーンに対応したアドレス変換テーブルのテーブル保存ブロックが変更されたときに、ワークエリア8上で更新される。テーブル管理情報101は、ワークエリア8上で更新される都度に、管理情報ブロックである物理ブロック(例えばPBA#0の物理ブロック)内の空き領域(一以上の空きの物理ページ又は物理ページ内の空き領域)に保存される。その物理ブロックに、テーブル管理情報を保存可能な空き領域が存在しない場合には、2個の管理情報ブロック候補のうちの別の物理ブロック(例えばPBA#1の物理ブロック)が、管理情報ブロックとして割り当てられる。つまり、予め定められた2個の物理ブロックが、交互に、管理情報ブロックとして使用される。以下、この処理を、「管理情報ブロックの切替え」と言う。   In this embodiment, the memory controller 3 manages information (hereinafter referred to as “table management information”) indicating in which physical block the address translation table corresponding to which logical zone is stored. In the example shown in FIG. 6, the table management information 101 includes information that can determine the correspondence between the LZN of each logical zone and the PBA of the table storage block of the address conversion table corresponding to the logical zone of the LZN. Yes. By referring to this table management information 101, for example, the table storage block of the address translation table 103-0 corresponding to the logical zone of LZN # 0 is a physical block of PBA # 5, or the logical block of LZN # 1 It can be seen that the table storage block of the address conversion table 103-1 corresponding to the zone is a physical block of PBA # 1076. The table management information 101 is stored in any one of two or more preset physical blocks for table management information (hereinafter referred to as “management information block candidates”). In this example, PBA # 0 and PBA # 1 physical blocks (that is, two physical blocks) are set as management information block candidates. Therefore, the table management information is stored in either the physical block of PBA # 0 or PBA # 1. Hereinafter, the physical block of the storage destination of the table management information selected from the management information block candidates (physical blocks of PBA # 0 and PBA # 1) is referred to as “management information block”. The table management information 101 is updated on the work area 8 when the table storage block of the address conversion table corresponding to any logical zone is changed. Each time the table management information 101 is updated on the work area 8, a free area (one or more free physical pages or physical pages in a physical block which is a management information block (for example, a physical block of PBA # 0)) is stored. Saved in free space). If there is no free area that can store the table management information in the physical block, another physical block (for example, a physical block of PBA # 1) of the two management information block candidates is used as the management information block. Assigned. That is, two predetermined physical blocks are alternately used as management information blocks. Hereinafter, this process is referred to as “management information block switching”.

本実施の形態では、論理ブロックが新たに物理ブロックに割り当てられたときに、その物理ブロックの冗長領域に、その新たに割り当てられた論理ブロックを示す論理アドレス情報に加えて、書替マークが書き込まれる。本実施形態で言う「書替マーク」とは、論理ブロックが新たに物理ブロックに割り当てられることに関連した処理の結果が所定の条件に合致したときに更新される版数情報である。「論理ブロックが新たに物理ブロックに割り当てられることに関連した処理」と「所定の条件」については、後に幾つかの例を詳細に説明する。   In this embodiment, when a logical block is newly assigned to a physical block, a rewrite mark is written in the redundant area of the physical block in addition to the logical address information indicating the newly assigned logical block. It is. The “rewrite mark” referred to in the present embodiment is version number information that is updated when a result of processing related to a logical block being newly assigned to a physical block matches a predetermined condition. With respect to “processing related to the logical block being newly assigned to the physical block” and “predetermined condition”, some examples will be described in detail later.

書替マークは、所定の順序で循環する少なくとも3種類の情報である。つまり、この書替マークは、所定の順序で更新され(遷移し)、最終の書替マークになった後は、最初の書替マークに更新される(戻る)。例えば、図7Aに示すように、所定の条件に合致する毎に、メモリコントローラ3によって、書替マークが、第1の書替マーク“55”、第2の書替マーク“5A”、第3の書替マーク“A5”、第4の書替マーク“AA”という順番で更新され、第4の書替マーク“AA”の次は、第1の書替マークに更新される。   The rewrite marks are at least three types of information that circulate in a predetermined order. That is, the rewrite mark is updated (transitioned) in a predetermined order, and after the last rewrite mark is reached, it is updated (returned) to the first rewrite mark. For example, as shown in FIG. 7A, every time a predetermined condition is met, the memory controller 3 changes the rewrite mark to the first rewrite mark “55”, the second rewrite mark “5A”, the third rewrite mark, The rewrite mark “A5” and the fourth rewrite mark “AA” are updated in this order, and the next rewrite mark “AA” is updated to the first rewrite mark.

以下、図7Aを参照して説明した規則で書替マークが更新されることを例に採り、図7B及び図8を参照して、本実施形態で行われる処理を説明する。その際、書替マークが第1の書替マーク“55”であった期間を、「第1の期間」と言い、書替マークが第2の書替マーク“5A”であった期間を「第2の期間」、と言い、書替マークが第3の書替マーク“A5”であった期間を「第3の期間」と言い、書替マークが第4の書替マーク“AA”であった期間を「第4の期間」と言う。書替マークが循環するので、期間も循環する。   Hereinafter, the process performed in the present embodiment will be described with reference to FIGS. 7B and 8, taking as an example that the rewrite mark is updated according to the rule described with reference to FIG. 7A. At this time, a period in which the rewrite mark is the first rewrite mark “55” is referred to as “first period”, and a period in which the rewrite mark is the second rewrite mark “5A” The second period ”, the period when the rewrite mark was the third rewrite mark“ A5 ”is referred to as the“ third period ”, and the rewrite mark is the fourth rewrite mark“ AA ”. This period is called “fourth period”. Since the rewrite mark circulates, the period also circulates.

第1の書替マーク“55”が書き込まれている物理ブロックは、第1の期間に論理ブロックが新たに割り当てられた物理ブロックであり、第2の書替マーク“5A”が書き込まれている物理ブロックは、第2の期間に論理ブロックが新たに割り当てられた物理ブロックであり、第3の書替マーク“A5”が書き込まれている物理ブロックは、第3の期間に論理ブロックが新たに割り当てられた物理ブロックであり、第4の書替マーク“AA”が書き込まれている物理ブロックは、第4の期間に論理ブロックが新たに割り当てられた物理ブロックである。   The physical block in which the first rewrite mark “55” is written is a physical block to which a logical block is newly allocated in the first period, and the second rewrite mark “5A” is written therein. The physical block is a physical block to which a logical block is newly assigned in the second period, and a physical block in which the third rewrite mark “A5” is written is newly added in the third period. The physical block to which the fourth rewrite mark “AA” is written is a physical block to which a logical block is newly allocated in the fourth period.

具体的には、例えば、図7Bにおいて、(4A)に示すように、空きの物理ブロックとして検出されたPBA#12の物理ブロックに、LBN#41の論理ブロックが新たに割り当てられたとき、そのときは第1の期間内であるため、そのPBA#12の物理ブロックの冗長領域105には、新たに割り当てられた論理ブロックのLBN“#41”と、第1の書替マーク“55h”が書き込まれる。   Specifically, for example, in FIG. 7B, when a logical block of LBN # 41 is newly assigned to a physical block of PBA # 12 detected as an empty physical block, as shown in (4A), Since the time is within the first period, the LBN “# 41” of the newly allocated logical block and the first rewrite mark “55h” are stored in the redundant area 105 of the physical block of the PBA # 12. Written.

次に、(4B)に示すように、空きの物理ブロックとして検出されたPBA#18の物理ブロックに、LBN#42の論理ブロックが新たに割り当てられたとき、そのときも第1の期間内であるため、そのPBA#18の物理ブロックの冗長領域105には、新たに割り当てられた論理ブロックのLBN“#42”と、第1の書替マーク“55h”が書き込まれる。   Next, as shown in (4B), when a logical block of LBN # 42 is newly allocated to a physical block of PBA # 18 detected as an empty physical block, at that time also within the first period Therefore, the LBN “# 42” of the newly allocated logical block and the first rewrite mark “55h” are written in the redundant area 105 of the physical block of PBA # 18.

その後、(4C)及び(4D)に示すように、新たに論理ブロックが物理ブロックに割り当てられるが、いずれのときも、第1の期間内であるため、新たに論理ブロックが割り当てられた物理ブロックの冗長領域105には、新たに割り当てられた論理ブロックのLBNと、第1の書替マーク“55h”が書き込まれる。   After that, as shown in (4C) and (4D), a new logical block is allocated to the physical block. However, since both are within the first period, the physical block to which the new logical block is allocated In the redundant area 105, the LBN of the newly allocated logical block and the first rewrite mark “55h” are written.

ここで、(4D)のとき、すなわち、新たにLBA#44の論理ブロックがPBA#27物理ブロックに割り当てられたとき、その割り当てに関連した処理の結果が所定の条件に合致したとする。この場合、書替マークが、第1の書替マーク“55”から第2の書替マーク“5A”に更新される。この時点で、第1の期間が終了し、第2の期間が開始する。   Here, in the case of (4D), that is, when a logical block of LBA # 44 is newly allocated to the PBA # 27 physical block, it is assumed that the result of processing related to the allocation matches a predetermined condition. In this case, the rewrite mark is updated from the first rewrite mark “55” to the second rewrite mark “5A”. At this point, the first period ends and the second period starts.

従って、その後、例えば(4E)に示すように、空きの物理ブロックとして検出されたPBA#31の物理ブロックに、LBN#45の論理ブロックが新たに割り当てられたとき、そのときは第2の期間内であるので、そのPBA#31の物理ブロックの冗長領域105には、新たに割り当てられた論理ブロックのLBN“#45”と、第2の書替マーク“5Ah”が書き込まれる。   Therefore, after that, for example, as shown in (4E), when a logical block of LBN # 45 is newly allocated to a physical block of PBA # 31 detected as an empty physical block, at that time, in the second period Therefore, the LBN “# 45” of the newly allocated logical block and the second rewrite mark “5Ah” are written in the redundant area 105 of the physical block of PBA # 31.

以上のように、どの期間内で、新たに論理ブロックが物理ブロックに割り当てられたかによって、物理ブロックの冗長領域に書き込まれる書替マークが異なる。   As described above, the rewrite mark written in the redundant area of the physical block differs depending on in which period the logical block is newly allocated to the physical block.

尚、新たに論理ブロックが割り当てられる物理ブロックを検索するための空きブロック検索は、ホストシステム4の記憶領域として用いられる全ての物理ブロックを対象にして行われる。その際、それら全ての物理ブロックについて先頭の物理ブロックから末尾の物理ブロックに向かって、順次、空きブロックの検索が行われる。このように、検索対象の範囲に含まれる物理ブロックについて、先頭の物理ブロックから末尾の物理ブロックに向かう順番の空きブロックの検索が繰り返し行われることにより、殆ど書き換えが行われないデータ(書き換え頻度が低いデータ)が記憶されている物理ブロックがなければ、検索対象の範囲に含まれる物理ブロックの書き換え回数は、ほぼ均等になることが期待される。   The free block search for searching for a physical block to which a new logical block is newly assigned is performed for all physical blocks used as a storage area of the host system 4. At that time, empty blocks are sequentially searched from the first physical block toward the last physical block for all the physical blocks. In this way, for the physical blocks included in the range to be searched, the search for empty blocks in the order from the first physical block to the last physical block is repeatedly performed, so that data that is hardly rewritten (rewrite frequency is If there is no physical block in which (low data) is stored, the number of rewrites of the physical block included in the search target range is expected to be substantially equal.

さて、メモリコントローラ3は、所定のタイミングで(例えば、書替マークを更新したときに)、少なくとも1期間より長く書き替え(記憶されているデータを一旦消去した後の書込み)が行われていない物理ブロック、言い換えれば、現在割り当てられている論理ブロックの割り当てが行われてから少なくとも1期間よりも長い期間の経過した物理ブロックが検索される。   Now, the memory controller 3 has not been rewritten at a predetermined timing (for example, when the rewrite mark is updated) for at least one period (writing after the stored data is once erased). A physical block, in other words, a physical block that has passed a period longer than at least one period from the allocation of the currently allocated logical block is searched.

例えば、1期間より長く書き替えが行われていない物理ブロックが検索される。この場合、現在の期間よりも2期間以上前の期間に対応する書替マークが記憶されている物理ブロックが検索される。図8に示すように、現在の書替マークが第2の書替マーク“5Ah”であれば、現在は第2の期間である。故に、第4の書替マーク“AAh”又は第3の書替マーク“A5”が記憶されている物理ブロックは、この第2の期間より1期間前である第1の期間において、データの書き替えが行われていない物理ブロックである。従って、現在の書替マークが第2の書替マーク“5Ah”であれば、第1の書替マーク“55”よりも順番が前である第4の書替マーク“AAh”又は第3の書替マーク“A5”が記憶されている物理ブロックが検索される。つまり、図8の例で言えば、1期間より長く書き替えが行われていない物理ブロックとして、PBA#6、#15及び#16の物理ブロックが検出される。   For example, a physical block that has not been rewritten for longer than one period is searched. In this case, a physical block in which a rewrite mark corresponding to a period two or more periods before the current period is stored is searched. As shown in FIG. 8, if the current rewrite mark is the second rewrite mark “5Ah”, the current period is the second period. Therefore, the physical block in which the fourth rewrite mark “AAh” or the third rewrite mark “A5” is stored is written in the first period, which is one period before the second period. It is a physical block that has not been replaced. Therefore, if the current rewrite mark is the second rewrite mark “5Ah”, the fourth rewrite mark “AAh” or the third rewrite mark that is in the order before the first rewrite mark “55”. The physical block in which the rewrite mark “A5” is stored is searched. That is, in the example of FIG. 8, physical blocks PBA # 6, # 15, and # 16 are detected as physical blocks that have not been rewritten for longer than one period.

本実施形態では、1期間より長く書き換えが行われていない物理ブロックが、書き換え頻度の低いデータが記憶されている物理ブロックとみなされる。このような物理ブロックが検出されたときには、メモリコントローラ3は、空きブロック検索を行って別の物理ブロック(空きブロック)を検出し、書き換え頻度の低いデータが記憶されているとみなされた物理ブロックに記憶されているデータを、その別の物理ブロックに転送(複写)する。更に、メモリコントローラ3は、その別の物理ブロックに、現在の書替マークを書込む。具体的には、例えば、図8の(5A)、(5B)及び(5C)に示すように、検出されたPBA#6、#15及び#16の物理ブロックに記憶されているデータが、空きブロック検索により検出されたPBA#32、#33及び#34の物理ブロックにそれぞれ転送(複写)される。また、冗長領域105には、論理アドレス情報としてLBN#6、#15及び#16が書き込まれ、書替マークとして現在の書替マークである第2の書替マーク“5Ah”が、PBA#32、#33及び#34が書き込まれる。   In the present embodiment, a physical block that has not been rewritten for a period longer than one period is regarded as a physical block in which data with a low rewrite frequency is stored. When such a physical block is detected, the memory controller 3 performs a free block search to detect another physical block (empty block), and a physical block that is considered to store data with a low rewrite frequency. Is transferred (copied) to another physical block. Furthermore, the memory controller 3 writes the current rewrite mark in the other physical block. Specifically, for example, as shown in (5A), (5B), and (5C) of FIG. 8, the data stored in the detected physical blocks of PBA # 6, # 15, and # 16 is empty. Transferred (copied) to the physical blocks PBA # 32, # 33 and # 34 detected by the block search. In addition, LBN # 6, # 15, and # 16 are written as logical address information in the redundant area 105, and the second rewrite mark “5Ah” that is the current rewrite mark is written as PBA # 32 as the rewrite mark. , # 33 and # 34 are written.

この転送処理が終了した後に、転送元の物理ブロックに記憶されているデータ消去される。具体的には、PBA#6、#15及び#16の物理ブロックに記憶されているデータを消去することを指示する内部コマンドが、メモリコントローラ3からフラッシュメモリ2に順次与えられ、この内部コマンドに応答してフラッシュメモリ2は、PBA#6、#15及び#16の物理ブロックに記憶されているデータを消去する。   After this transfer process is completed, the data stored in the transfer source physical block is erased. Specifically, an internal command instructing to erase data stored in the physical blocks of PBA # 6, # 15, and # 16 is sequentially given from the memory controller 3 to the flash memory 2, and the internal command In response, the flash memory 2 erases the data stored in the physical blocks of PBA # 6, # 15 and # 16.

尚、書き換え頻度の低いデータが記憶されている物理ブロックとみなす基準、つまり、何期間より長く書き換えが行われていない物理ブロックを書き換え頻度の低いデータが記憶されている物理ブロックとみなすかは、書替マークが一巡するまでの期間の数(及び/又は、一期間の長さ)などを考慮して、適宜設定することができる。   It should be noted that the criteria for considering data with low rewrite frequency as stored physical blocks, that is, for how long a physical block that has not been rewritten for longer than that is considered as a physical block with low rewrite frequency stored, It can be set as appropriate in consideration of the number of periods (and / or the length of one period) until the rewrite mark is completed.

また、書替マークが一巡するまでの期間の数が少ない場合には、書替マークを更新したときに、変更後の書替マークと同じ書替マークを、一巡前の期間で書き込んだ物理ブロックが残っていることのないように注意する必要がある。具体的には、メモリコントローラ3は、1期間より長く書き換えが行われていない物理ブロックを検索する処理や、検出された物理ブロックに記憶されているデータを別の物理ブロックに転送(複写)する処理を、次に書替マークの更新が行われるときまでに全て終了させる必要がある。メモリコントローラ3は、この管理を確実に行うために、1期間より長く書き換えが行われていない物理ブロックが無くなるまでは、書き換え頻度の低いデータが記憶されている物理ブロックに記憶されているデータの転送処理を優先し、ホストシステム4からのコマンドを受け付けないようにしてもよい。   In addition, when the number of periods until the rewrite mark is completed is small, when the rewrite mark is updated, the physical block in which the same rewrite mark as the changed rewrite mark is written in the period before the rewrite mark Care must be taken that there is no remaining. Specifically, the memory controller 3 searches for a physical block that has not been rewritten for longer than one period, and transfers (copies) data stored in the detected physical block to another physical block. It is necessary to complete the processing by the next time the rewrite mark is updated. In order to ensure this management, the memory controller 3 stores the data stored in the physical block in which data with low rewrite frequency is stored until there is no physical block that has not been rewritten for longer than one period. The transfer process may be prioritized so that commands from the host system 4 are not accepted.

また、現在の書替マークは、例えば、メモリコントローラ3内の記憶領域、例えばワークエリア8(SRAM等の揮発性メモリ)に記憶される。ワークエリア8に記憶されている書替マークは、適時に、フラッシュメモリ2に複写される(書き込まれる)。電源が遮断されると、ワークエリア8に記憶されている書替マークは消去されるが、電源が投入されたときに、フラッシュメモリ2に記憶されている書替マークがワークエリア8に読み出され、以後、その書替マークが、現在の書替マークとして用いられる。メモリコントローラ3内に、FeRAM(Ferroelectric Random Access Memory)、MRAM(Magnetic Random Access Memory)等の不揮発性RAMからなる記憶領域を設け、この記憶領域に書替マークを保持するようにしてもよい。このような不揮発性RAMに書替マークを保持するようにした場合、不揮発性RAM上で書替マークを管理することができ、書替マークをフラッシュメモリ2に複写する必要がなくなる。   The current rewrite mark is stored in, for example, a storage area in the memory controller 3, for example, a work area 8 (a volatile memory such as SRAM). The rewrite mark stored in the work area 8 is copied (written) to the flash memory 2 at an appropriate time. When the power is turned off, the rewrite mark stored in the work area 8 is erased, but when the power is turned on, the rewrite mark stored in the flash memory 2 is read into the work area 8. Thereafter, the rewrite mark is used as the current rewrite mark. The memory controller 3 may be provided with a storage area composed of a nonvolatile RAM such as a FeRAM (Ferroelectric Random Access Memory) or MRAM (Magnetic Random Access Memory), and a rewrite mark may be held in this storage area. When the rewrite mark is held in such a nonvolatile RAM, the rewrite mark can be managed on the nonvolatile RAM, and it is not necessary to copy the rewrite mark to the flash memory 2.

また、書き換え頻度の低いデータが記憶されている物理ブロックとみなされた物理ブロックは、その物理ブロックに記憶されているデータが別の物理ブロックに転送(複写)された後に記憶データが消去され、空きの物理ブロックとされる。空きとされた物理ブロックは、それまでの書き換え回数が少ない可能性があるが、空きブロックになったことにより、この後の書き換え回数が多くなる可能性が高くなる。逆に、データの複写先となった物理ブロックは、それまでの書き換え回数が多い可能性があるが、書き換え頻度の低いデータが複写されたことにより、この後の書き換え回数が少なくなる可能性が高くなる。このような原理により、フラッシュメモリ2における複数の物理ブロックの書き換え回数が均等化されることが期待できる。   In addition, a physical block regarded as a physical block in which data with low rewrite frequency is stored is erased after the data stored in the physical block is transferred (copied) to another physical block, It is considered as an empty physical block. There is a possibility that the physical block that has been made empty has a small number of rewrites up to that point. Conversely, the physical block that is the data copy destination may have a large number of rewrites up to that point, but the data with a low rewrite frequency may be copied, which may reduce the number of subsequent rewrites. Get higher. Based on such a principle, it can be expected that the number of rewrites of a plurality of physical blocks in the flash memory 2 is equalized.

以下、本実施の形態で行われる処理の流れの概要を、図9を参照して説明する。   Hereinafter, an outline of the flow of processing performed in the present embodiment will be described with reference to FIG.

まず、初期設定が行われる(ステップ1101)。例えば、メモリコントローラ3が、現在の書替マークを設定する。   First, initial setting is performed (step 1101). For example, the memory controller 3 sets the current rewrite mark.

初期設定の後、ホストシステム4から書込みコマンドを受信した場合、メモリコントローラ3は、その書込みコマンドで指定された論理アクセス領域が属する論理ブロックに対応させる物理ブロックを新たに設定する必要があるかどうかを判断する(ステップ1102)。その必要がある場合は(ステップ1102でYES)、空きブロックの検索が行われ、検出された空きブロックに、書込みコマンドで指定された論理アクセス領域が属する論理ブロックが割り当てられる(ステップ1103)。具体的には、検出された空きブロック(物理ブロック)の冗長領域105に、書込みコマンドで指定された論理アクセス領域が属する論理ブロックのLBNと、現在の書替マークとが書き込まれる。論理ブロックが新たに物理ブロックに割り当てられることに関連した処理も、このステップ1103において実行される。その処理の結果が、所定の条件に合致していれば、書替マークが更新され、所定の条件に合致していなければ、書替マークの変更は行われない。   When a write command is received from the host system 4 after the initial setting, the memory controller 3 needs to newly set a physical block corresponding to the logical block to which the logical access area specified by the write command belongs. Is determined (step 1102). If this is necessary (YES in step 1102), a free block search is performed, and a logical block to which the logical access area designated by the write command belongs is allocated to the detected free block (step 1103). Specifically, the LBN of the logical block to which the logical access area designated by the write command and the current rewrite mark are written in the redundant area 105 of the detected empty block (physical block). The processing related to newly assigning a logical block to a physical block is also executed in this step 1103. If the result of the process matches a predetermined condition, the rewrite mark is updated, and if the result does not match the predetermined condition, the rewrite mark is not changed.

メモリコントローラ3は、ステップ1103において書替マークを更新したか否かを判断し(ステップ1104)、更新した場合(ステップ1104でYES)、書き換え頻度の低いデータが記憶されている物理ブロックの検索処理を行う。書き換え頻度の低いデータが記憶されている物理ブロックが検出された場合には、メモリコントローラ3は、検出された物理ブロックに記憶されているデータを別の物理ブロックに複写するデータ転送処理を行う(ステップ1105)。具体的には、1期間より長く書き換えが行われていない物理ブロックが検索され、そのような物理ブロックが検出された場合には、検出された物理ブロックの記憶されているデータが別の物理ブロックに転送される。この転送が終了した後、検出された物理ブロックに記憶されているデータが消去される。   The memory controller 3 determines whether or not the rewrite mark has been updated in step 1103 (step 1104), and if it has been updated (YES in step 1104), search processing of the physical block in which data with low rewrite frequency is stored. I do. When a physical block storing data with low rewrite frequency is detected, the memory controller 3 performs a data transfer process for copying the data stored in the detected physical block to another physical block ( Step 1105). Specifically, a physical block that has not been rewritten for a period longer than one period is searched, and when such a physical block is detected, the data stored in the detected physical block is another physical block. Forwarded to After this transfer is completed, the data stored in the detected physical block is erased.

以上の説明によれば、論理ブロックが新たに物理ブロックに割り当てられたときに、その物理ブロックに、書替マークが書き込まれる。書替マークは、論理ブロックが新たに物理ブロックに割り当てられたことに関連した処理の結果が所定の条件に合致したときに更新される版数情報である。更新後の書替マークよりも順番が2つ以上前の書替マークが記憶されている物理ブロックが、書き換え頻度の低いデータが記憶されている物理ブロックとみなされる。そして、そのような書き換え頻度の低いデータが記憶されている物理ブロックが存在するときだけ、その物理ブロックを含めたウェアー・レベリング制御が行われる。   According to the above description, when a logical block is newly assigned to a physical block, a rewrite mark is written to the physical block. The rewrite mark is version number information that is updated when a result of processing related to a logical block newly assigned to a physical block matches a predetermined condition. A physical block in which a rewrite mark two or more orders before the rewritten mark after the update is stored is regarded as a physical block in which data with a low rewrite frequency is stored. The wear leveling control including the physical block is performed only when there is a physical block storing such data with low rewrite frequency.

さて、上述したように、書替マークは、論理ブロックが新たに物理ブロックに割り当てられることに関連した処理の結果が所定の条件に合致したときに更新される版数情報である。論理ブロックが新たに物理ブロックに割り当てられることに関連した処理や、所定の条件としては、以下の第1の例乃至第4の例のうちのいずれかの例を採用することができる。以下、それぞれの例について、詳細に説明する。   As described above, the rewrite mark is version number information that is updated when a result of processing related to a new allocation of a logical block to a physical block matches a predetermined condition. Any of the following first to fourth examples can be adopted as a process related to a new allocation of a logical block to a physical block and a predetermined condition. Hereinafter, each example will be described in detail.

<第1の例>。   <First example>.

第1の例では、「論理ブロックが新たに物理ブロックに割り当てられることに関連した処理」とは、アドレス変換テーブルの保存先の物理ブロック(テーブル保存ブロック)の変更回数を表すカウント値(以下、「変更カウント値」と言う)がカウントアップ(又はカウントダウン)されることであり、「所定の条件」とは、変更カウント値が所定の値になることである。   In the first example, “a process related to a logical block being newly assigned to a physical block” means a count value (hereinafter, referred to as the number of changes of the physical block (table storage block) of the storage destination of the address translation table). (Referred to as “change count value”) is counted up (or counted down), and “predetermined condition” is that the change count value becomes a predetermined value.

変更カウント値は、テーブル保存ブロックが変更される都度に、カウントアップ(又はカウントダウン)される。カウントアップ後(又はカウントダウン後)の変更カウント値は、テーブル保存ブロックに書き込まれる。これにより、テーブル保存ブロックに記憶されている変更カウント値から、テーブル保存ブロックの変更が何回行われたかを把握することができる。なお、前述したように、テーブル保存ブロックには、書替マークではなく変更カウント値が書き込まれるため、図10Aに示すように、フラッシュメモリ2には、ホストシステムから与えられたデータが記憶されている物理ブロック(以下、「データ保存ブロック」と言う)と、アドレス変換テーブルが記憶されているテーブル保存ブロック(PBA#5やPBA#14の物理ブロック)が混在することになる。尚、書替マークと変更カウント値が重複することがないように設定すれば、書替マークが書き込まれているか、又は変更カウント値が書き込まれているかにより、その物理ブロックがデータ保存ブロックであるか、又はテーブル保存ブロックであるかを判別することができる。また、データ保存ブロックについては、論理アドレス情報の代わりに、データ保存ブロックであることを示す情報(どの論理ゾーンのアドレス変換テーブルが保存されているかを示す情報)が書き込まれてもよい。   The change count value is counted up (or counted down) every time the table storage block is changed. The changed count value after counting up (or after counting down) is written to the table storage block. Thereby, it is possible to grasp how many times the table storage block has been changed from the change count value stored in the table storage block. As described above, since the change count value is written in the table storage block instead of the rewrite mark, the data given from the host system is stored in the flash memory 2 as shown in FIG. 10A. Existing physical blocks (hereinafter referred to as “data storage blocks”) and table storage blocks (physical blocks of PBA # 5 and PBA # 14) in which the address translation table is stored are mixed. If the rewrite mark and the change count value are set so as not to overlap, the physical block is a data storage block depending on whether the rewrite mark is written or the change count value is written. Or a table storage block. For the data storage block, information indicating that the data storage block is stored (information indicating which logical zone's address conversion table is stored) may be written instead of the logical address information.

この第1の例では、テーブル保存ブロックの変更が何回行われたときに書替マークを更新するかが予め決められている。つまり、変更カウント値についての所定の値が予め設定されている。テーブル保存ブロックが変更された場合に、変更カウント値がカウントアップ(又はカウントダウン)され、カウントアップ(又はカウントダウン)後の変更カウント値が、所定の値になったならば、書替マークが更新される。例えば、所定の値を15(0Fh)とした場合、新たに割り当てたテーブル保存ブロックに変更カウント値として15(0Fh)を書き込んだ際に、書替マークを更新する。また、本実施の形態の場合には、変更カウント値を15(0Fh)の次に0(00h)に戻すようにすれば、書替マークと変更カウント値が重複することがない。   In this first example, it is determined in advance how many times the table storage block is changed to update the rewrite mark. That is, a predetermined value for the change count value is set in advance. When the table storage block is changed, the change count value is counted up (or counted down). When the changed count value after the count up (or count down) reaches a predetermined value, the rewrite mark is updated. The For example, when the predetermined value is 15 (0Fh), the rewrite mark is updated when 15 (0Fh) is written as the change count value in the newly allocated table storage block. In the case of the present embodiment, if the change count value is returned to 15 (0Fh) and then 0 (00h), the rewrite mark and the change count value will not overlap.

尚、どの論理ゾーンのアドレス変換テーブルが記憶されているテーブル保存ブロックの変更カウント値に基づいて書替マークを更新するかは適宜設定することができる。また、現在の書替マークは、テーブル保存ブロックに保存されてもよい。   Note that it is possible to appropriately set which logical zone's address conversion table is to be updated based on the change count value of the table storage block in which the address conversion table is stored. Further, the current rewrite mark may be stored in the table storage block.

以下、この第1の例に関する処理の流れを説明する。   Hereinafter, the flow of processing relating to the first example will be described.

メモリコントローラ3は、例えば、図9のS103において、図10Bに示す処理を実行する。すなわち、メモリコントローラ3は、新たに論理ブロックを物理ブロックに割り当てたことによりアドレス変更テーブルを更新した場合、テーブル保存ブロックである物理ブロックに、更新後のアドレス変換テーブルを記憶することが可能な空き物理ページが残っているか否かを判断する(S1111)。   For example, the memory controller 3 executes the process shown in FIG. 10B in S103 of FIG. In other words, when the address change table is updated by newly assigning a logical block to a physical block, the memory controller 3 can store the updated address conversion table in the physical block that is a table storage block. It is determined whether or not a physical page remains (S1111).

残っていないとの判断結果であれば(S1111:YES)、メモリコントローラ3は、S1112を実行する。すなわち、メモリコントローラ3は、空きブロック検索により別の物理ブロック(空きブロック)を検索し、検出された別の物理ブロックを新たなテーブル保存ブロックとする(つまりテーブル保存ブロックを変更する)。また、メモリコントローラ3は、変更前のテーブル保存ブロックであった物理ブロックに記憶されている変更カウント値をその物理ブロックから読出し、その変更カウント値をカウントアップ(又はカウントダウン)する。そして、メモリコントローラ3は、変更後のテーブル保存ブロックである上記別の物理ブロック(空きブロック)に、カウントアップ後(又はカウントダウン後)の変更カウント値と、更新後のアドレス変換テーブルとを書き込む。さらに、メモリコントローラ3は、テーブル管理情報101(図6参照)における、そのアドレス変換テーブルに対応する論理ゾーンのLZNに対応したPBAを、変更後のテーブル保存ブロックのPBAに更新する。   If it is a determination result that it does not remain (S1111: YES), the memory controller 3 executes S1112. That is, the memory controller 3 searches for another physical block (empty block) by searching for a free block, and uses the detected other physical block as a new table storage block (that is, changes the table storage block). Further, the memory controller 3 reads the change count value stored in the physical block that was the table storage block before the change from the physical block, and counts up (or counts down) the change count value. Then, the memory controller 3 writes the changed count value after the count-up (or after the count-down) and the updated address conversion table in the other physical block (empty block) that is the table storage block after the change. Further, the memory controller 3 updates the PBA corresponding to the LZN of the logical zone corresponding to the address conversion table in the table management information 101 (see FIG. 6) to the PBA of the changed table storage block.

その後、メモリコントローラ3は、カウントアップ(又はカウントダウン)後の変更カウント値が所定の値であるか否かを判断する(S1113)。変更カウント値が所定の値であれば(S1113:YES)、メモリコントローラ3は、書替マークを更新する(S1114)。   Thereafter, the memory controller 3 determines whether or not the changed count value after counting up (or counting down) is a predetermined value (S1113). If the change count value is a predetermined value (S1113: YES), the memory controller 3 updates the rewrite mark (S1114).

以上が、第1の例についての説明である。尚、現在の書替マークは、フラッシュメモリ2又は不揮発性RAMに保存しておくことが好ましい。   The above is the description of the first example. The current rewrite mark is preferably stored in the flash memory 2 or the nonvolatile RAM.

<第2の例>。   <Second example>.

第2の例では、「論理ブロックが新たに物理ブロックに割り当てられることに関連した処理」とは、テーブル管理情報の保存先の物理ブロック(管理情報ブロック)の切替回数を表すカウント値(以下、「切替カウント値」と言う)がカウントアップ(又はカウントダウン)されることであり、「所定の条件」は、切替カウント値が所定の値になることである。   In the second example, “processing related to a logical block being newly assigned to a physical block” is a count value (hereinafter, referred to as the number of times of switching of a physical block (management information block) as a storage destination of table management information. (Referred to as “switch count value”) is counted up (or counted down), and “predetermined condition” is that the switch count value becomes a predetermined value.

切替カウント値は、管理情報ブロックが変更される都度に、カウントアップ(又はカウントダウン)される。切替カウント値は、管理情報ブロックに書き込まれる。これにより、管理情報ブロックに記憶されている切替カウント値から、管理情報ブロックの切替えが何回行われたかを把握することができる。   The switching count value is counted up (or counted down) every time the management information block is changed. The switching count value is written in the management information block. Thereby, it is possible to grasp how many times the management information block is switched from the switching count value stored in the management information block.

管理情報ブロックは、管理情報ブロック候補の中から選択される。図11Aに示した例では、PBA#0とPBA#1の物理ブロックが管理情報ブロック候補としている。従って、PBA#0又はPBA#1の物理ブロックが管理情報ブロックとして使用される。この管理情報ブロックに、現在の書替マークが書き込まれてもよい。   The management information block is selected from management information block candidates. In the example shown in FIG. 11A, physical blocks PBA # 0 and PBA # 1 are management information block candidates. Therefore, the physical block of PBA # 0 or PBA # 1 is used as the management information block. The current rewrite mark may be written in this management information block.

尚、この例では、PBA#0又はPBA#1の物理ブロックが、テーブル保存ブロック又はデータ保存ブロックに割り当てられることはない。また、テーブル保存ブロックに変更カウント値を書き込む必要はない。   In this example, the physical block of PBA # 0 or PBA # 1 is not assigned to the table storage block or the data storage block. Further, it is not necessary to write the change count value in the table storage block.

この第2の例では、管理情報ブロックの切替が何回行われたときに書替マークを更新するかが予め決められている。つまり、切替カウント値についての所定の値が予め設定されている。管理情報ブロックが切替えられた場合に、切替カウント値がカウントアップ(又はカウントダウン)され、カウントアップ(又はカウントダウン)後の切替カウント値が、所定の値になったならば、書替マークが更新される。所定の値は、1個でも良いし、複数個(例えば或る自然数の倍数)であっても良い。   In this second example, it is determined in advance how many times the management information block is switched to update the rewrite mark. That is, a predetermined value for the switching count value is set in advance. When the management information block is switched, the switching count value is counted up (or counted down). When the switching count value after counting up (or counting down) reaches a predetermined value, the rewrite mark is updated. The The predetermined value may be one or plural (for example, a multiple of a certain natural number).

以下、この第2の例に関する処理の流れを説明する。   Hereinafter, the flow of processing relating to the second example will be described.

メモリコントローラ3は、例えば、図9のS1103において、図11Bに示す処理を実行する。すなわち、メモリコントローラ3は、テーブル保存ブロックの変更に伴ってテーブル管理情報を更新した場合、管理情報ブロックである物理ブロックに、更新後のテーブル管理情報を記憶することが可能な空き物理ページが残っているか否かを判断する(S1121)。   For example, the memory controller 3 executes the process shown in FIG. 11B in S1103 of FIG. That is, when the memory controller 3 updates the table management information in accordance with the change of the table storage block, a free physical page that can store the updated table management information remains in the physical block that is the management information block. It is determined whether or not (S1121).

残っていないとの判断結果であれば(S1121:YES)、メモリコントローラ3は、S1122を実行する。すなわち、メモリコントローラ3は、前述した2個の管理情報ブロック候補のうちの他方の物理ブロックを新たな管理情報ブロックとする(つまり管理情報ブロックを切替る)。また、メモリコントローラ3は、切替前の管理情報ブロックであった物理ブロックに記憶されている切替カウント値をその物理ブロックから読出し、その切替カウント値をカウントアップ(又はカウントダウン)する。そして、メモリコントローラ3は、切替後の管理情報ブロックである上記他方の物理ブロックに、カウントアップ後(又はカウントダウン後)の切替カウント値と、更新後のテーブル管理情報とを書き込む。   If it is a determination result that it does not remain (S1121: YES), the memory controller 3 executes S1122. That is, the memory controller 3 sets the other physical block of the two management information block candidates described above as a new management information block (that is, switches the management information block). Further, the memory controller 3 reads the switching count value stored in the physical block that was the management information block before switching from the physical block, and counts up (or counts down) the switching count value. Then, the memory controller 3 writes the switching count value after counting up (or after counting down) and the updated table management information in the other physical block that is the management information block after switching.

その後、メモリコントローラ3は、カウントアップ(又はカウントダウン)後の切替カウント値が所定の値であるか否かを判断する(S1123)。切替カウント値が所定の値であれば(S1123:YES)、メモリコントローラ3は、書替マークを更新する(S1124)。   Thereafter, the memory controller 3 determines whether or not the switching count value after counting up (or counting down) is a predetermined value (S1123). If the switching count value is a predetermined value (S1123: YES), the memory controller 3 updates the rewrite mark (S1124).

以上が、第2の例についての説明である。尚、現在の書替マークは、フラッシュメモリ2又は不揮発性RAMに保存されることが好ましい。   The above is the description of the second example. The current rewrite mark is preferably stored in the flash memory 2 or the nonvolatile RAM.

<第3の例>。   <Third example>.

第3の例では、「論理ブロックが新たに物理ブロックに割り当てられることに関連した処理」とは、先頭の物理ブロックから末尾の物理ブロックに向かう順番で行われる空きブロックの検索であり、「所定の条件」は、空きブロックの検索が一巡したことである。空きブロック検索が一巡するとは、先頭の物理ブロックから開始した空きブロックの検索が末尾の物理ブロックまでいって先頭の物理ブロックに戻ったことである。   In the third example, “a process related to a logical block being newly assigned to a physical block” is a search for a free block performed in the order from the first physical block to the last physical block. The “condition” is that the search for empty blocks has been completed. A free block search is a complete search for a free block that starts from the first physical block and goes back to the last physical block.

メモリコントローラ3は、例えば、図9のS1103において、図12Aに示す処理を実行する。すなわち、メモリコントローラ3は、空きブロックの検索が一巡したならば(S1131:YES)、書替マークを更新する(S1132)。   For example, the memory controller 3 executes the process shown in FIG. 12A in S1103 of FIG. That is, the memory controller 3 updates the rewrite mark (S1132) when the search for the empty block is completed (S1131: YES).

尚、現在の書替マークは、フラッシュメモリ2又は不揮発性RAMに保存しておくことが好ましい。又、空きブロックの検索における検索開始ブロック(次回の検索を開始する物理ブロック)も、フラッシュメモリ2又は不揮発性RAMに保存しておくことが好ましい。また、この第3の例では、空きブロックの検索が一巡したことを、所定の条件としているが、一巡に限らず、二回以上の所定回数巡回したことが、所定の条件であっても良い。この場合、ワークメモリ(SRAM)8上で、空きブロックの検索の巡回回数を表すカウント値が、空きブロックの検索が一巡する毎に、更新される。この巡回回数も、フラッシュメモリ2又は不揮発性RAMに保存されることが好ましい。   The current rewrite mark is preferably stored in the flash memory 2 or the nonvolatile RAM. Further, it is preferable that the search start block (physical block for starting the next search) in the search for the empty block is also stored in the flash memory 2 or the nonvolatile RAM. In the third example, the predetermined condition is that the search for the empty block has been completed. However, the predetermined condition is that the circulation is not limited to a single cycle, and the predetermined number of cycles may be two or more. . In this case, on the work memory (SRAM) 8, the count value indicating the number of cycles for searching for an empty block is updated every time an empty block search is completed. This number of circulations is also preferably stored in the flash memory 2 or the nonvolatile RAM.

<第4の例>。   <Fourth example>.

第4の例では、「論理ブロックが新たに物理ブロックに割り当てられることに関連した処理」とは、物理ブロックに対して論理ブロックを新たに割り当てた回数を表すカウント値(以下、「割当カウント値」と言う)がカウントアップ(又はカウントダウン)されることであり、「所定の条件」は、割当カウント値が所定の値になることである。   In the fourth example, “processing related to a logical block being newly assigned to a physical block” means a count value indicating the number of times a logical block is newly assigned to a physical block (hereinafter referred to as “allocation count value”). ”) Is counted up (or counted down), and the“ predetermined condition ”is that the assigned count value becomes a predetermined value.

割当カウント値は、物理ブロックに対して論理ブロックを新たに割り当てられる都度に、カウントアップ(又はカウントダウン)される。従って、割当カウント値から、物理ブロックに対して新たに論理ブロックが何回割り当てられたかを把握することができる。   The allocation count value is counted up (or counted down) every time a logical block is newly allocated to a physical block. Therefore, it is possible to grasp how many times a logical block is newly allocated to the physical block from the allocation count value.

この第4の例では、論理ブロックが新たに物理ブロックに何回割り当てられたときに書替マークを更新するかが予め決められている。つまり、割当カウント値についての所定の値が予め設定されている。所定の値は、1個でも良いし、複数個(例えば或る自然数の倍数)であっても良い。   In the fourth example, it is determined in advance how many times a logical block is newly assigned to a physical block when the rewrite mark is updated. That is, a predetermined value for the allocation count value is set in advance. The predetermined value may be one or plural (for example, a multiple of a certain natural number).

メモリコントローラ3は、例えば、図9のS1103において、図12Bに示す処理を実行する。すなわち、メモリコントローラ3は、論理ブロックが新たに物理ブロックに割り当てられた場合に、例えばワークメモリ(SRAM)8上で、割当カウント値をカウントアップ(又はカウントダウン)する(S1141)。そして、メモリコントローラ3は、カウントアップ(又はカウントダウン)後の割当カウント値が、所定の値になったか否かを判断する(S1142)。割当カウント値が所定の値であれば(S1142:YES)、メモリコントローラ3は、書替マークを更新する(S1143)。   For example, the memory controller 3 executes the process shown in FIG. 12B in S1103 of FIG. That is, when a logical block is newly allocated to a physical block, the memory controller 3 counts up (or counts down) the allocation count value, for example, on the work memory (SRAM) 8 (S1141). Then, the memory controller 3 determines whether or not the assigned count value after counting up (or counting down) has reached a predetermined value (S1142). If the allocation count value is a predetermined value (S1142: YES), the memory controller 3 updates the rewrite mark (S1143).

以上が、第4の例についての説明である。尚、現在の書替マーク及び割当カウント値は、フラッシュメモリ2又は不揮発性RAMに保存しておくことが好ましい。また、割当カウント値は、新たに論理ブロックが割り当てられた物理ブロックに書き込まれても良い。   The above is the description of the fourth example. The current rewrite mark and the assigned count value are preferably stored in the flash memory 2 or the nonvolatile RAM. Further, the allocation count value may be written in a physical block to which a new logical block is allocated.

以上、上述した本発明の幾つかの実施形態は、本発明の説明のための例示であり、本発明の範囲をそれらの実施形態にのみ限定する趣旨ではない。当業者は、本発明の要旨を逸脱することなしに、他の様々な態様で本発明を実施することができる。   As mentioned above, some embodiment of this invention mentioned above is the illustration for description of this invention, and is not the meaning which limits the scope of the present invention only to those embodiment. Those skilled in the art can implement the present invention in various other modes without departing from the gist of the present invention.

例えば、第一の実施形態において、書き換え頻度が低いデータが記憶されている物理ブロックを検索するタイミングは、カウント値がn×k増加する毎でなくてもよく、例えば、物理ブロックを検索するタイミングを設定するためのテーブルを設け、そのテーブルに基づいて書き換え頻度が低いデータが記憶されている物理ブロックを検索するタイミングを決定してもよい。このテーブルの例としては、物理ブロックの個数とその個数に対応する検索のタイミング(例えば、物理ブロックの個数が512個の場合はカウント値が4096増加する毎)を記述したテーブルが挙げられる。   For example, in the first embodiment, the timing for searching for a physical block in which data with low rewrite frequency is stored may not be every time the count value increases by n × k. For example, the timing for searching for a physical block May be provided, and based on the table, the timing for searching for a physical block storing data with low rewrite frequency may be determined. As an example of this table, there is a table describing the number of physical blocks and the search timing corresponding to the number (for example, when the number of physical blocks is 512, every time the count value increases by 4096).

また、例えば、第二の実施形態において、メモリコントローラ3は、第1の例乃至第4の例のうちのいずれかを選択し、選択した例に基づいて書替マークを更新しても良い。具体的には、例えば、メモリコントローラ3は、第1の例に基づく条件で書替マークを更新する第1のモードと、第2の例に基づく条件で書替マークを更新する第2のモードと、第3の例に基づく条件で書替マークを更新する第3のモードと、第4の例に基づく条件で書替マークを更新する第4のモードとを有しており、ホストシステム4からの指示又は発生したイベントの結果に従って、第1乃至第4のモードからいずれかのモードを選択し、選択したモードに従って、書替マークを更新するようにしても良い。   For example, in the second embodiment, the memory controller 3 may select any one of the first to fourth examples and update the rewrite mark based on the selected example. Specifically, for example, the memory controller 3 has a first mode in which the rewrite mark is updated under conditions based on the first example, and a second mode in which the rewrite mark is updated under conditions based on the second example. And a third mode in which the rewrite mark is updated under the condition based on the third example, and a fourth mode in which the rewrite mark is updated under the condition based on the fourth example. May be selected from the first to fourth modes in accordance with an instruction from or a result of an event that has occurred, and the rewrite mark may be updated in accordance with the selected mode.

尚、上述した実施の形態で行われるウェアー・レベリング制御(以下、本ウェアー・レベリング制御と言う)の対象となる物理ブロックは、フラッシュメモリ2を構成する全ての物理ブロックではなく、記憶されているデータのLBAの範囲により限定されてもよい。つまり、本ウェアー・レベリング制御の対象となる物理ブロックは、それぞれの物理ブロックに割り当てられている論理ブロックの論理ブロック番号(LBN)の範囲により限定されてもよい。   Note that the physical blocks that are the targets of the wear leveling control (hereinafter referred to as the present wear leveling control) performed in the above-described embodiment are stored, not all the physical blocks that constitute the flash memory 2. It may be limited by the LBA range of the data. That is, the physical block that is the target of the wear leveling control may be limited by the range of the logical block number (LBN) of the logical block assigned to each physical block.

また、本ウェアー・レベリング制御の対象とするLBAの範囲(以下、対象LBA範囲と言う)、又は対象としないLBAの範囲(以下、対象外LBA範囲と言う)は、ホストシステム4からの指示により設定されるようにしてもよい。   In addition, the range of LBA targeted for this wear leveling control (hereinafter referred to as “target LBA range”) or the range of LBA not targeted (hereinafter referred to as “non-target LBA range”) is determined by an instruction from the host system 4. It may be set.

このような設定が行われた場合、その設定に関する情報する情報は、フラッシュメモリ2に格納され、起動時にメモリコントローラ3により読み出され保持されることが好ましい。例えば、メモリコントローラ3は、メモリコントローラ3が有する記憶領域(例えば、ワークメモリ8、或いはマイクロプロセッサ6内のレジスタ)に、ホストシステム4から指示された対象LBA範囲又は対象外LBA範囲を表す情報を保持する。そして、メモリコントローラ3は、その情報を基に、本ウェアー・レベリング制御の対象となる論理ブロック(以下、対象論理ブロックと言う)を特定し、対象論理ブロックが割り当てられている物理ブロックだけを本ウェアー・レベリング制御の対象とし、本ウェアー・レベリング制御の対象とならない論理ブロック(以下、対象外論理ブロックと言う)が割り当てられている物理ブロックを本ウェアー・レベリング制御の対象としない。つまり、カウント情報又は書替マーク(版数情報)に基づいて書き換え頻度の低いデータが記憶されている物理ブロックを検出する処理では、対象論理ブロックが割り当てられている物理ブロックだけが、その処理の対象になる。一方、対象外論理ブロックが割り当てられている物理ブロックについては、カウント情報又は書替マーク(版数情報)に基づいて書き換え頻度の低いデータが記憶されていると判断されるような物理ブロックであっても、書き換え頻度の低いデータが記憶されている物理ブロックとして検出されない。   When such a setting is performed, it is preferable that information relating to the setting is stored in the flash memory 2 and read and held by the memory controller 3 at the time of activation. For example, the memory controller 3 stores information indicating the target LBA range or the non-target LBA range instructed from the host system 4 in a storage area (for example, a work memory 8 or a register in the microprocessor 6) included in the memory controller 3. Hold. Based on the information, the memory controller 3 specifies a logical block (hereinafter referred to as a target logical block) to be subjected to the wear leveling control, and only the physical block to which the target logical block is assigned is stored. A physical block to which a logical block that is not subject to the wear leveling control (hereinafter referred to as a non-target logical block) is assigned as a target of wear leveling control is not subject to the wear leveling control. That is, in the process of detecting a physical block in which data with a low rewrite frequency is stored based on the count information or the rewrite mark (version number information), only the physical block to which the target logical block is assigned is processed. Become a target. On the other hand, a physical block to which a non-target logical block is allocated is a physical block for which it is determined that data with low rewrite frequency is stored based on count information or rewrite mark (version number information). However, it is not detected as a physical block in which data with low rewrite frequency is stored.

ホストシステム4から対象LBA範囲が指示される場合、そのLBAの範囲に含まれる論理ブロックは本ウェアー・レベリング制御の対象となるが、そのLBAの範囲に含まれない論理ブロックは本ウェアー・レベリング制御の対象とならない。ホストシステム4から対象外LBA範囲が指示される場合、そのLBAの範囲に含まれる論理ブロックは本ウェアー・レベリング制御の対象とならないが、そのLBAの範囲に含まれない論理ブロックは本ウェアー・レベリング制御の対象となる。尚、一部が対象LBA範囲に含まれその他の部分が対象外LBA範囲に含まれる論理ブロックを本ウェアー・レベリング制御の対象とするか否かは適宜設定することができる。つまり、対象LBA範囲と対象外LBA範囲の両方を含んだLBA範囲に対応する論理ブロックが本ウェアー・レベリング制御の対象とするか否かは適宜設定することができる。例えば、論理ブロックに対応するLBA範囲のうち対象LBA範囲と対象外LBA範囲のどちらの比率が多いかに応じて、その論理ブロックが本ウェアー・レベリング制御の対象とするか否かがメモリコントローラ3によって自動で決定されても良い。具体的には、例えば、対象LBA範囲が対象外LBA範囲よりも多い論理ブロックは、本ウェアー・レベリング制御の対象とされ、対象外LBA範囲が対象LBA範囲よりも多い論理ブロックは、本ウェアー・レベリング制御の対象とされない。   When the target LBA range is instructed from the host system 4, logical blocks included in the LBA range are subject to the wear leveling control, but logical blocks not included in the LBA range are subject to the wear leveling control. Not subject to When a non-target LBA range is instructed from the host system 4, logical blocks included in the LBA range are not subject to the wear leveling control, but logical blocks not included in the LBA range are not subject to the wear leveling. It becomes the object of control. It should be noted that whether or not a logical block whose part is included in the target LBA range and the other part is included in the non-target LBA range is the target of this wear leveling control can be appropriately set. In other words, whether or not the logical block corresponding to the LBA range including both the target LBA range and the non-target LBA range is the target of this wear leveling control can be appropriately set. For example, depending on which ratio of the target LBA range and the non-target LBA range among the LBA ranges corresponding to the logical block is larger, the memory controller 3 determines whether the logical block is the target of the wear leveling control. It may be determined automatically. Specifically, for example, a logical block having a target LBA range larger than the non-target LBA range is a target of the wear leveling control, and a logical block having a non-target LBA range larger than the target LBA range is Not subject to leveling control.

また、上述した実施の形態で行われるウェアー・レベリング制御は、カウント情報又は書替えマークに基づいて書き換え頻度の低いデータが記憶されている物理ブロックが検出された場合に、その物理ブロックに記憶されているデータを別の物理ブロックに転送するウェアー・レベリング制御について説明した。このウェアー・レベリング制御において、書き換え頻度の低いデータが記憶されている物理ブロックが検出されたときに、その物理ブロックの消去回数に基づいて、その物理ブロックに記憶されているデータを別の物理ブロックに転送するか否かが更に判断されてもよい。つまり、メモリコントローラ3は、カウント情報又は書替えマークに基づいて書き換え頻度の低いデータが記憶されている物理ブロックを検出した場合であっても、その物理ブロックの消去回数に基づいて、その物理ブロックに記憶されているデータを別の物理ブロックに転送しないと最終的に判断するようにしてもよい。   In addition, the wear leveling control performed in the above-described embodiment is stored in a physical block when a physical block storing data with low rewrite frequency is detected based on count information or a rewrite mark. We explained the wear leveling control that transfers existing data to another physical block. In this wear leveling control, when a physical block storing data with low rewrite frequency is detected, the data stored in the physical block is changed to another physical block based on the number of times the physical block has been erased. It may be further determined whether or not to transfer to. That is, even if the memory controller 3 detects a physical block in which data with a low rewrite frequency is stored based on the count information or the rewrite mark, the memory controller 3 stores the physical block on the basis of the erase count of the physical block. The stored data may be finally determined not to be transferred to another physical block.

このような2次的な判断(以下、「転送元判断」という。)を追加する理由としては、カウント情報又は書替えマークに基づいて書き換え頻度の低いデータが記憶されている物理ブロックが検出された場合であって、その物理ブロックに記憶されているデータを別の物理ブロックに転送することが好ましくない場合があるからである。例えば、書き換え頻度の低いデータが記憶されている物理ブロックであっても、その物理ブロックの消去回数が多いときには、その物理ブロックに記憶されているデータを別の物理ブロックに転送しない方が好ましい場合がある。このような好ましくないデータの転送が行われることを回避するには、その物理ブロックの消去回数を基準消去回数と比較し、その物理ブロックの消去回数が基準消去回数以上である場合には、その物理ブロックに記憶されているデータを別の物理ブロックに転送しないと判断するような転送元判断を追加することが好ましい。   The reason for adding such secondary determination (hereinafter referred to as “transfer source determination”) is that a physical block in which data with low rewrite frequency is stored is detected based on count information or a rewrite mark. This is because it may not be preferable to transfer data stored in the physical block to another physical block. For example, even if a physical block stores data with low rewrite frequency, it is preferable not to transfer the data stored in the physical block to another physical block if the physical block is erased a lot There is. In order to avoid such undesired data transfer, the physical block erase count is compared with the reference erase count, and if the physical block erase count is greater than or equal to the reference erase count, It is preferable to add a transfer source determination that determines that data stored in a physical block is not transferred to another physical block.

このような転送元判断(すなわち、転送元の物理ブロックの消去回数に基づいた判断)を追加する場合には、メモリコントローラ3が、それぞれの物理ブロックの消去回数を管理するための消去回数テーブルを作成し、その消去回数テーブルをフラッシュメモリ又は別途設けた不揮発性メモリに保存しておく必要がある。従って、このような物理ブロックの消去回数に基づいた2次的な判断を追加する場合には、メモリコントローラ3内のマイクロプロセッサが、ROM12に記憶されているプログラムに基づいて前述したような消去回数テーブルの作成及び保存を制御するようにする。   When such a transfer source determination (that is, a determination based on the number of erases of the transfer source physical block) is added, the memory controller 3 creates an erase count table for managing the erase count of each physical block. It is necessary to create and store the erase count table in a flash memory or a non-volatile memory provided separately. Therefore, when a secondary determination based on the number of times of erasing the physical block is added, the microprocessor in the memory controller 3 performs the number of times of erasure as described above based on the program stored in the ROM 12. Control the creation and storage of tables.

基準消去回数としては、一定の値であっても、変化する値であってもよい。例えば、フラッシュメモリメーカが保証している消去回数の所定割合、例えば90%を基準消去回数としてもよい。つまり、フラッシュメモリメーカが保証している消去回数が5000回で、所定割合が90%であれば、基準消去回数は4500回になる。また、平均消去回数や消去回数が最大の物理ブロックの消去回数(以下、「最大消去回数」と言う。)を管理するようにして、この平均消去回数又は最大消去回数に基づいて基準消去回数が設定されてもよい。例えば、平均消去回数を基準消去回数とした場合には、メモリコントローラ3は、書き換え頻度の低いデータが記憶されている物理ブロックの消去回数が、平均消去回数より小さい場合にだけ、その物理ブロックに記憶されているデータを別の物理ブロックに転送するように制御することができる。又、最大消去回数の所定割合、例えば90%の消去回数を基準消去回数とした場合には、メモリコントローラ3は、書き換え頻度の低いデータが記憶されている物理ブロックの消去回数が、最大消去回数の90%の消去回数より小さい場合にだけ、その物理ブロックに記憶されているデータを別の物理ブロックに転送するように制御することができる。   The reference erase count may be a constant value or a changing value. For example, a predetermined ratio of the number of erases guaranteed by the flash memory manufacturer, for example, 90% may be set as the reference number of erases. That is, if the number of erases guaranteed by the flash memory manufacturer is 5000 and the predetermined ratio is 90%, the reference number of erases is 4500. Also, the average erase count and the erase count of the physical block with the maximum erase count (hereinafter referred to as “maximum erase count”) are managed, and the reference erase count is set based on the average erase count or the maximum erase count. It may be set. For example, when the average erasure count is set as the reference erasure count, the memory controller 3 adds the physical block to the physical block only when the erasure count of the physical block storing data with low rewrite frequency is smaller than the average erasure count. The stored data can be controlled to be transferred to another physical block. Further, when a predetermined ratio of the maximum number of erase times, for example, 90% of erase times is set as the reference erase number, the memory controller 3 determines that the erase number of the physical block in which data with low rewrite frequency is stored is the maximum erase number. It is possible to control to transfer the data stored in the physical block to another physical block only when it is smaller than 90% of the erase count.

このような、転送元の物理ブロックの消去回数に基づいた転送元判断を追加することにより、より的確なウェアー・レベリング制御を行うことができる。   By adding such a transfer source judgment based on the number of times of erasure of the transfer source physical block, more accurate wear leveling control can be performed.

上記の転送元判断は、転送元の物理ブロック(書き換え頻度の低いデータが記憶されている物理ブロック)の消去回数に基づいた判断であるが、上記の転送元判断に代えて又は加えて、転送先の物理ブロックの消去回数に基づいた2次的な判断(以下、「転送先判断」という。)が追加されてもよい。つまり、転送先の物理ブロックの消去回数が基準消去回数と比較され、その物理ブロックの消去回数が基準消去回数以下である場合には、その物理ブロックに転送元の物理ブロックに記憶されているデータを転送しないと判断するような転送先判断が追加されてもよい。転送先判断での基準消去回数は、転送元判断での基準消去回数と同様の観点で設定されて良い。また、転送先判断での基準消去回数と転送元判断での基準消去回数は同じであっても異なっていても良い。尚、転送先の物理ブロックの消去回数が基準消去回数以下である場合は、消去回数が基準消去回数以上の物理ブロックを検出する空きブロック検索を行うことが好ましい。但し、消去回数が基準消去回数以上の物理ブロックを検出するまで空きブロック検索を継続した場合、検索時間が長くなることがあるため、所定条件の下で消去回数が基準消去回数以上の物理ブロックが検出されなかった場合は、空きブロック検索を中止してデータを転送しないと判断することが好ましい。空きブロック検索を中止する所定条件としては、所定時間内に消去回数が基準消去回数以上の物理ブロックが検出されなかったとき、又は所定個数の空きブロックを検出してそれらの中に消去回数が基準消去回数以上の物理ブロックなかったとき等が挙げられる。   The transfer source determination is based on the number of erasures of a transfer source physical block (a physical block in which data with low rewrite frequency is stored), but instead of or in addition to the transfer source determination, transfer A secondary determination based on the number of erasures of the previous physical block (hereinafter referred to as “transfer destination determination”) may be added. That is, if the erase count of the transfer destination physical block is compared with the reference erase count, and the erase count of the physical block is less than or equal to the reference erase count, the data stored in the transfer source physical block in that physical block A transfer destination determination may be added such that it is determined not to transfer. The reference erase count in the transfer destination determination may be set from the same viewpoint as the reference erase count in the transfer source determination. Further, the reference erase count in the transfer destination judgment and the reference erase count in the transfer source judgment may be the same or different. If the erase count of the transfer destination physical block is equal to or less than the reference erase count, it is preferable to perform a free block search for detecting a physical block having an erase count equal to or greater than the reference erase count. However, if a free block search is continued until a physical block whose erase count is equal to or greater than the reference erase count is detected, the search time may be long. If it is not detected, it is preferable to cancel the empty block search and determine not to transfer the data. The predetermined condition for canceling the empty block search is that when a physical block whose erase count is equal to or greater than the reference erase count is not detected within a predetermined time, or a predetermined number of empty blocks are detected and the erase count is the reference. For example, when there are not more physical blocks than the number of erases.

次に、転送元の物理ブロックの消去回数が転送先の物理ブロックの消去回数より多いときの処理について説明する。この処理については、フラッシュメモリの仕様を考慮する必要がある。一般的に使用されているNAND型フラッシュメモリには、SLC(single level cell)タイプのメモリセルで構成されているものと、MLC(multi level cell)タイプのメモリセルで構成されているものとがある。MLCタイプのメモリセルで構成されたフラッシュメモリのデータ保持期間が短いため、長期間保存されていたデータについてはリフレッシュする必要がある。従って、データのリフレッシュを重視する場合には、転送元の物理ブロックの消去回数が転送先の物理ブロックの消去回数より多い場合であっても、データ転送を行うようにし、フラッシュメモリの寿命を重視する場合には、転送元の物理ブロックの消去回数が転送先の物理ブロックの消去回数より多い場合は、データ転送を行わないようにすればよい。   Next, processing when the number of times of erasing the transfer source physical block is larger than the number of times of erasing the transfer destination physical block will be described. For this processing, it is necessary to consider the specifications of the flash memory. Commonly used NAND flash memories include those composed of SLC (single level cell) type memory cells and those composed of MLC (multi level cell) type memory cells. is there. Since the data retention period of the flash memory composed of the MLC type memory cells is short, it is necessary to refresh the data stored for a long time. Therefore, when emphasizing data refresh, data transfer is performed even when the erase count of the transfer source physical block is larger than the erase count of the transfer destination physical block, and the life of the flash memory is emphasized. In this case, if the erase count of the transfer-source physical block is larger than the erase count of the transfer-destination physical block, data transfer should not be performed.

尚、複数個の物理ブロックを仮想的に結合した仮想ブロックを構成し、仮想ブロック単位で論理ブロックとの対応関係を管理する場合には、仮想ブロックを1個の物理ブロックとみなし、仮想ブロック単位で消去回数を管理し、仮想ブロック単位で空きブロック検索を行うことが好ましい。   In the case where a virtual block is formed by virtually combining a plurality of physical blocks and the correspondence relationship with the logical block is managed in units of virtual blocks, the virtual block is regarded as one physical block, It is preferable to manage the number of erasures and to search for empty blocks in virtual block units.

1…フラッシュメモリシステム、2…フラッシュメモリ、3…メモリコントローラ、6…マイクロプロセッサ DESCRIPTION OF SYMBOLS 1 ... Flash memory system, 2 ... Flash memory, 3 ... Memory controller, 6 ... Microprocessor

Claims (16)

ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理手段と、
前記アクセス指示により指定された領域が属する前記論理ブロックと対応する前記物理ブロックにホストシステム側から与えられたデータを書き込むデータ書き込み手段と、
前記物理ブロックに対して新たに前記論理ブロックが割り当てられる毎にカウント値を更新するカウント手段と、
前記カウント値に基づいて決定されるカウント情報を、新たに前記論理ブロックが割り当てられた前記物理ブロックに書き込むカウント情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持手段と、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックを対象に、前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記カウント値と前記物理ブロックに書き込まれている前記カウント情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段と
を備えるメモリコントローラ。
A memory controller that controls access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Block management means for managing a correspondence relationship between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
Data writing means for writing data given from the host system side to the physical block corresponding to the logical block to which the area designated by the access instruction belongs;
Count means for updating a count value every time the logical block is newly assigned to the physical block;
Count information writing means for writing the count information determined based on the count value to the physical block to which the logical block is newly assigned,
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Information holding means for holding information representing a target logical address range or a non-target logical address range specified by the host system;
A part of the plurality of logical blocks, the physical block to which the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range is assigned Whether to transfer the data stored in the physical block to the empty block detected by the empty block search means based on the count value and the count information written in the physical block. A judging means for judging;
Data transfer means for transferring data stored in the physical block that is the object of the positive determination to the free block detected by the free block search means when a positive determination is made by the determination means And a memory controller.
ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理手段と、
前記アクセス指示により指定された領域が属する前記論理ブロックと対応する前記物理ブロックにホストシステム側から与えられたデータを書き込むデータ書き込み手段と、
前記物理ブロックに対して新たに前記論理ブロックが割り当てられる毎にカウント値を更新するカウント手段と、
前記カウント値に基づいて決定されるカウント情報を、新たに前記論理ブロックが割り当てられた前記物理ブロックに書き込むカウント情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持手段と、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定手段と、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記カウント値と前記処理対象ブロックに書き込まれている前記カウント情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段と
を備えるメモリコントローラ。
A memory controller that controls access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Block management means for managing a correspondence relationship between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
Data writing means for writing data given from the host system side to the physical block corresponding to the logical block to which the area designated by the access instruction belongs;
Count means for updating a count value every time the logical block is newly assigned to the physical block;
Count information writing means for writing the count information determined based on the count value to the physical block to which the logical block is newly assigned,
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Information holding means for holding information representing a target logical address range or a non-target logical address range specified by the host system;
The physical block to which a part of the plurality of logical blocks and the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range are allocated. Processing target block specifying means for specifying the processing target block;
Whether to transfer the data stored in the processing target block to the free block detected by the free block searching means is based on the count value and the count information written in the processing target block. A judging means for judging;
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching means when a positive determination is made by the determination means And a memory controller.
ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックを前記物理ブロックに割り当てる論理ブロック割り当て手段と、
前記論理ブロック割り当て手段により設定された前記論理ブロックと前記物理ブロックとの対応関係を示すアドレス変換テーブルを管理するアドレス変換テーブル管理手段と、
前記アドレス変換テーブル管理手段により前記アドレス変換テーブルの少なくとも一部の前記論理ブロックと前記物理ブロックとの対応関係が変更されたときに、前記アドレス変換テーブルの保存先の前記物理ブロックであるテーブル保存ブロックに、前記アドレス変換テーブルを保存するアドレス変換テーブル保存手段と、
前記テーブル保存ブロックに、前記アドレス変換テーブルを保存するための空き領域が無くなったとき、別の前記物理ブロックを前記テーブル保存ブロックとして新たに割り当てるテーブル保存ブロック管理手段と、
前記テーブル保存ブロック管理手段により新たな前記テーブル保存ブロックの割り当てが行われたときに、空き領域が無くなった前記テーブル保存ブロックに記憶されているカウント値と一致するカウント値である直前のカウント値を更新し、更新後のカウント値である最新のカウント値を、新たに前記テーブル保存ブロックとして割り当てられた前記物理ブロックに書き込むカウント情報書き込み手段と、
前記最新のカウント値に基づいて、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報を決定する版数情報決定手段と、
前記版数情報決定手段により決定された前記版数情報を、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持手段と、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックを対象に、前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記物理ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段と
を備えるメモリコントローラ。
A memory controller that controls access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Logical block allocating means for allocating a logical block composed of a plurality of sectors in the logical address space on the host system side to the physical block;
Address translation table management means for managing an address translation table indicating a correspondence relationship between the logical block and the physical block set by the logical block allocation means;
A table storage block that is the physical block that is the storage destination of the address conversion table when the correspondence relationship between at least some of the logical blocks of the address conversion table and the physical block is changed by the address conversion table management unit Address conversion table storage means for storing the address conversion table;
A table storage block management means for newly allocating another physical block as the table storage block when there is no more free space for storing the address conversion table in the table storage block;
When a new table storage block is assigned by the table storage block management means, the count value immediately before the count value that matches the count value stored in the table storage block that has no free space is obtained. Count information writing means for updating and writing the latest count value that is the updated count value to the physical block newly assigned as the table storage block;
Version number information determining means for determining version number information to be written in the physical block to which the logical block is newly allocated based on the latest count value;
Version number information writing means for writing the version number information determined by the version number information determining means into the physical block to which the logical block is newly assigned;
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Information holding means for holding information representing a target logical address range or a non-target logical address range specified by the host system;
A part of the plurality of logical blocks, the physical block to which the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range is assigned And determining whether to transfer the data stored in the physical block to the empty block detected by the empty block search means based on the version number information written in the physical block. Means,
Data transfer means for transferring data stored in the physical block that is the object of the positive determination to the free block detected by the free block search means when a positive determination is made by the determination means And a memory controller.
ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックを前記物理ブロックに割り当てる論理ブロック割り当て手段と、
前記論理ブロック割り当て手段により設定された前記論理ブロックと前記物理ブロックとの対応関係を示すアドレス変換テーブルを管理するアドレス変換テーブル管理手段と、
前記アドレス変換テーブル管理手段により前記アドレス変換テーブルの少なくとも一部の前記論理ブロックと前記物理ブロックとの対応関係が変更されたときに、前記アドレス変換テーブルの保存先の前記物理ブロックであるテーブル保存ブロックに、前記アドレス変換テーブルを保存するアドレス変換テーブル保存手段と、
前記テーブル保存ブロックに、前記アドレス変換テーブルを保存するための空き領域が無くなったとき、別の前記物理ブロックを前記テーブル保存ブロックとして新たに割り当てるテーブル保存ブロック管理手段と、
前記テーブル保存ブロック管理手段により新たな前記テーブル保存ブロックの割り当てが行われたときに、空き領域が無くなった前記テーブル保存ブロックに記憶されているカウント値と一致するカウント値である直前のカウント値を更新し、更新後のカウント値である最新のカウント値を、新たに前記テーブル保存ブロックとして割り当てられた前記物理ブロックに書き込むカウント情報書き込み手段と、
前記最新のカウント値に基づいて、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報を決定する版数情報決定手段と、
前記版数情報決定手段により決定された前記版数情報を、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持手段と、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定手段と、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段と
を備えるメモリコントローラ。
A memory controller that controls access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Logical block allocating means for allocating a logical block composed of a plurality of sectors in the logical address space on the host system side to the physical block;
Address translation table management means for managing an address translation table indicating a correspondence relationship between the logical block and the physical block set by the logical block allocation means;
A table storage block that is the physical block that is the storage destination of the address conversion table when the correspondence relationship between at least some of the logical blocks of the address conversion table and the physical block is changed by the address conversion table management unit Address conversion table storage means for storing the address conversion table;
A table storage block management means for newly allocating another physical block as the table storage block when there is no more free space for storing the address conversion table in the table storage block;
When a new table storage block is assigned by the table storage block management means, the count value immediately before the count value that matches the count value stored in the table storage block that has no free space is obtained. Count information writing means for updating and writing the latest count value that is the updated count value to the physical block newly assigned as the table storage block;
Version number information determining means for determining version number information to be written in the physical block to which the logical block is newly allocated based on the latest count value;
Version number information writing means for writing the version number information determined by the version number information determining means into the physical block to which the logical block is newly assigned;
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Information holding means for holding information representing a target logical address range or a non-target logical address range specified by the host system;
The physical block to which a part of the plurality of logical blocks and the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range are allocated. Processing target block specifying means for specifying the processing target block;
Judgment to determine whether or not to transfer the data stored in the processing target block to the free block detected by the free block search means based on the version number information written in the processing target block Means,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching means when a positive determination is made by the determination means And a memory controller.
ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックを前記物理ブロックに割り当てる論理ブロック割り当て手段と、
前記論理ブロック割り当て手段により設定された前記論理ブロックと前記物理ブロックとの対応関係を示すアドレス変換テーブルを管理するアドレス変換テーブル管理手段と、
前記アドレス変換テーブル管理手段により前記アドレス変換テーブルの少なくとも一部の前記論理ブロックと前記物理ブロックとの対応関係が変更されたときに、前記アドレス変換テーブルの保存先の前記物理ブロックであるテーブル保存ブロックに、前記アドレス変換テーブルを保存するアドレス変換テーブル保存手段と、
前記テーブル保存ブロックに、前記アドレス変換テーブルを保存するための空き領域が無くなったとき、別の前記物理ブロックを前記テーブル保存ブロックとして新たに割り当てるテーブル保存ブロック管理手段と、
前記テーブル保存ブロックとして割り当てられている前記物理ブロックが変わったときに、前記テーブル保存ブロックとして割り当てられている前記物理ブロックを示す管理情報を、前記管理情報の保存先の前記物理ブロックである管理情報ブロックに保存する管理情報保存手段と、
前記管理情報ブロックに、前記管理情報を保存するための空き領域が無くなったとき、別の前記物理ブロックを前記管理情報ブロックとして新たに割り当てる管理情報ブロック管理手段と、
前記管理情報ブロック管理手段により新たな前記管理情報ブロックの割り当てが行われたときに、空き領域が無くなった前記管理情報ブロックに記憶されているカウント値と一致するカウント値である直前のカウント値を更新し、更新後のカウント値である最新のカウント値を、新たに前記管理情報ブロックとして割り当てられた前記物理ブロックに書き込むカウント情報書き込み手段と、
前記最新のカウント値に基づいて、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報を決定する版数情報決定手段と、
前記版数情報決定手段により決定された前記版数情報を、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持手段と、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックを対象に、前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記物理ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段と
を備えるメモリコントローラ。
A memory controller that controls access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Logical block allocating means for allocating a logical block composed of a plurality of sectors in the logical address space on the host system side to the physical block;
Address translation table management means for managing an address translation table indicating a correspondence relationship between the logical block and the physical block set by the logical block allocation means;
A table storage block that is the physical block that is the storage destination of the address conversion table when the correspondence relationship between at least some of the logical blocks of the address conversion table and the physical block is changed by the address conversion table management unit Address conversion table storage means for storing the address conversion table;
A table storage block management means for newly allocating another physical block as the table storage block when there is no more free space for storing the address conversion table in the table storage block;
When the physical block allocated as the table storage block changes, the management information indicating the physical block allocated as the table storage block is the management information that is the physical block of the storage destination of the management information Management information storage means to be stored in the block;
Management information block management means for newly allocating another physical block as the management information block when there is no free space for storing the management information in the management information block;
When a new management information block is allocated by the management information block management means, the count value immediately before the count value that matches the count value stored in the management information block in which a free area has disappeared is obtained. Count information writing means for updating and writing the latest count value, which is the updated count value, to the physical block newly assigned as the management information block;
Version number information determining means for determining version number information to be written in the physical block to which the logical block is newly allocated based on the latest count value;
Version number information writing means for writing the version number information determined by the version number information determining means into the physical block to which the logical block is newly assigned;
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Information holding means for holding information representing a target logical address range or a non-target logical address range specified by the host system;
A part of the plurality of logical blocks, the physical block to which the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range is assigned And determining whether to transfer the data stored in the physical block to the empty block detected by the empty block search means based on the version number information written in the physical block. Means,
Data transfer means for transferring data stored in the physical block that is the object of the positive determination to the free block detected by the free block search means when a positive determination is made by the determination means And a memory controller.
ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックを前記物理ブロックに割り当てる論理ブロック割り当て手段と、
前記論理ブロック割り当て手段により設定された前記論理ブロックと前記物理ブロックとの対応関係を示すアドレス変換テーブルを管理するアドレス変換テーブル管理手段と、
前記アドレス変換テーブル管理手段により前記アドレス変換テーブルの少なくとも一部の前記論理ブロックと前記物理ブロックとの対応関係が変更されたときに、前記アドレス変換テーブルの保存先の前記物理ブロックであるテーブル保存ブロックに、前記アドレス変換テーブルを保存するアドレス変換テーブル保存手段と、
前記テーブル保存ブロックに、前記アドレス変換テーブルを保存するための空き領域が無くなったとき、別の前記物理ブロックを前記テーブル保存ブロックとして新たに割り当てるテーブル保存ブロック管理手段と、
前記テーブル保存ブロックとして割り当てられている前記物理ブロックが変わったときに、前記テーブル保存ブロックとして割り当てられている前記物理ブロックを示す管理情報を、前記管理情報の保存先の前記物理ブロックである管理情報ブロックに保存する管理情報保存手段と、
前記管理情報ブロックに、前記管理情報を保存するための空き領域が無くなったとき、別の前記物理ブロックを前記管理情報ブロックとして新たに割り当てる管理情報ブロック管理手段と、
前記管理情報ブロック管理手段により新たな前記管理情報ブロックの割り当てが行われたときに、空き領域が無くなった前記管理情報ブロックに記憶されているカウント値と一致するカウント値である直前のカウント値を更新し、更新後のカウント値である最新のカウント値を、新たに前記管理情報ブロックとして割り当てられた前記物理ブロックに書き込むカウント情報書き込み手段と、
前記最新のカウント値に基づいて、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報を決定する版数情報決定手段と、
前記版数情報決定手段により決定された前記版数情報を、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持手段と、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定手段と、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段と
を備えるメモリコントローラ。
A memory controller that controls access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Logical block allocating means for allocating a logical block composed of a plurality of sectors in the logical address space on the host system side to the physical block;
Address translation table management means for managing an address translation table indicating a correspondence relationship between the logical block and the physical block set by the logical block allocation means;
A table storage block that is the physical block that is the storage destination of the address conversion table when the correspondence relationship between at least some of the logical blocks of the address conversion table and the physical block is changed by the address conversion table management unit Address conversion table storage means for storing the address conversion table;
A table storage block management means for newly allocating another physical block as the table storage block when there is no more free space for storing the address conversion table in the table storage block;
When the physical block allocated as the table storage block changes, the management information indicating the physical block allocated as the table storage block is the management information that is the physical block of the storage destination of the management information Management information storage means to be stored in the block;
Management information block management means for newly allocating another physical block as the management information block when there is no free space for storing the management information in the management information block;
When a new management information block is allocated by the management information block management means, the count value immediately before the count value that matches the count value stored in the management information block in which a free area has disappeared is obtained. Count information writing means for updating and writing the latest count value, which is the updated count value, to the physical block newly assigned as the management information block;
Version number information determining means for determining version number information to be written in the physical block to which the logical block is newly allocated based on the latest count value;
Version number information writing means for writing the version number information determined by the version number information determining means into the physical block to which the logical block is newly assigned;
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Information holding means for holding information representing a target logical address range or a non-target logical address range specified by the host system;
The physical block to which a part of the plurality of logical blocks and the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range are allocated. Processing target block specifying means for specifying the processing target block;
Judgment to determine whether or not to transfer the data stored in the processing target block to the free block detected by the free block search means based on the version number information written in the processing target block Means,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching means when a positive determination is made by the determination means And a memory controller.
ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理手段と、
前記物理ブロックに対して前記論理ブロックが新たに割り当てられる毎にカウント値を更新するカウント手段と
前記カウント値が所定の値に達したときに、前記論理ブロックを割り当てた物理ブロックに書き込む版数情報を更新する版数情報管理手段と、
前記論理ブロックが新たに割り当てられた前記物理ブロックに、前記版数情報を書き込む版数情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持手段と、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックを対象に、前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記物理ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段と
を備えるメモリコントローラ。
A memory controller that controls access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Block management means for managing a correspondence relationship between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
Count means for updating the count value each time the logical block is newly assigned to the physical block, and version number information to be written to the physical block to which the logical block is assigned when the count value reaches a predetermined value Version information management means for updating
Version number information writing means for writing the version number information to the physical block to which the logical block is newly assigned;
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Information holding means for holding information representing a target logical address range or a non-target logical address range specified by the host system;
A part of the plurality of logical blocks, the physical block to which the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range is assigned And determining whether to transfer the data stored in the physical block to the empty block detected by the empty block search means based on the version number information written in the physical block. Means,
Data transfer means for transferring data stored in the physical block that is the object of the positive determination to the free block detected by the free block search means when a positive determination is made by the determination means And a memory controller.
ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理手段と、
前記物理ブロックに対して前記論理ブロックが新たに割り当てられる毎にカウント値を更新するカウント手段と
前記カウント値が所定の値に達したときに、前記論理ブロックを割り当てた物理ブロックに書き込む版数情報を更新する版数情報管理手段と、
前記論理ブロックが新たに割り当てられた前記物理ブロックに、前記版数情報を書き込む版数情報書き込み手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索手段と、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持手段と、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定手段と、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段と
を備えるメモリコントローラ。
A memory controller that controls access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Block management means for managing a correspondence relationship between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
Count means for updating the count value each time the logical block is newly assigned to the physical block, and version number information to be written to the physical block to which the logical block is assigned when the count value reaches a predetermined value Version information management means for updating
Version number information writing means for writing the version number information to the physical block to which the logical block is newly assigned;
Empty block search means for searching for an empty block which is the physical block in the erased state in the flash memory;
Information holding means for holding information representing a target logical address range or a non-target logical address range specified by the host system;
The physical block to which a part of the plurality of logical blocks and the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range are allocated. Processing target block specifying means for specifying the processing target block;
Judgment to determine whether or not to transfer the data stored in the processing target block to the free block detected by the free block search means based on the version number information written in the processing target block Means,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching means when a positive determination is made by the determination means And a memory controller.
ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックを検索する手段であって、前記フラッシュメモリ内の前記物理ブロックが消去状態であるか否かを所定の順番で判断していく空きブロック検索手段と、
前記空きブロック検索手段で検出された消去状態の前記物理ブロックに対して前記論理ブロックを割り当てる論理ブロック割り当て手段と、
前記空きブロック検索手段における所定の順番の検索が所定回数巡回する毎に、前記論理ブロックを割り当てた物理ブロックに書き込む版数情報を更新する版数情報管理手段と、
前記論理ブロックが新たに割り当てられた前記物理ブロックに、前記版数情報を書き込む版数情報書き込み手段と、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持手段と、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックを対象に、前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記物理ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記物理ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段と
を備えるメモリコントローラ。
A memory controller that controls access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Block management means for managing a correspondence relationship between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
Means for searching for the physical block in the erased state in the flash memory, the free block searching means for determining in a predetermined order whether or not the physical block in the flash memory is in an erased state;
Logical block allocation means for allocating the logical block to the physical block in the erased state detected by the free block search means;
Version number information management means for updating the version number information to be written in the physical block to which the logical block is assigned each time the search in the predetermined order in the empty block search means circulates a predetermined number of times,
Version number information writing means for writing the version number information to the physical block to which the logical block is newly assigned;
Information holding means for holding information representing a target logical address range or a non-target logical address range specified by the host system;
A part of the plurality of logical blocks, the physical block to which the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range is assigned And determining whether to transfer the data stored in the physical block to the empty block detected by the empty block search means based on the version number information written in the physical block. Means,
Data transfer means for transferring data stored in the physical block that is the object of the positive determination to the free block detected by the free block search means when a positive determination is made by the determination means And a memory controller.
ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するメモリコントローラであって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理手段と、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理手段と、
前記フラッシュメモリ内の消去状態の前記物理ブロックを検索する手段であって、前記フラッシュメモリ内の前記物理ブロックが消去状態であるか否かを所定の順番で判断していく空きブロック検索手段と、
前記空きブロック検索手段で検出された消去状態の前記物理ブロックに対して前記論理ブロックを割り当てる論理ブロック割り当て手段と、
前記空きブロック検索手段における所定の順番の検索が所定回数巡回する毎に、前記論理ブロックを割り当てた物理ブロックに書き込む版数情報を更新する版数情報管理手段と、
前記論理ブロックが新たに割り当てられた前記物理ブロックに、前記版数情報を書き込む版数情報書き込み手段と、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持手段と、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定手段と、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断手段と、
前記判断手段により肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索手段により検出された前記空きブロックに転送するデータ転送手段と
を備えるメモリコントローラ。
A memory controller that controls access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
Erasure count management means for managing the erasure count of each of the physical blocks constituting the flash memory;
Block management means for managing a correspondence relationship between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
Means for searching for the physical block in the erased state in the flash memory, the free block searching means for determining in a predetermined order whether or not the physical block in the flash memory is in an erased state;
Logical block allocation means for allocating the logical block to the physical block in the erased state detected by the free block search means;
Version number information management means for updating the version number information to be written in the physical block to which the logical block is assigned each time the search in the predetermined order in the empty block search means circulates a predetermined number of times,
Version number information writing means for writing the version number information to the physical block to which the logical block is newly assigned;
Information holding means for holding information representing a target logical address range or a non-target logical address range specified by the host system;
The physical block to which a part of the plurality of logical blocks and the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range are allocated. Processing target block specifying means for specifying the processing target block;
Judgment to determine whether or not to transfer the data stored in the processing target block to the free block detected by the free block search means based on the version number information written in the processing target block Means,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching means when a positive determination is made by the determination means And a memory controller.
請求項1乃至10のうちのいずれか1項に記載のメモリコントローラと、
前記メモリコントローラにより制御されるフラッシュメモリと、
を備えるフラッシュメモリシステム。
A memory controller according to any one of claims 1 to 10 ,
A flash memory controlled by the memory controller;
A flash memory system.
ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するフラッシュメモリの制御方法であって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理ステップと、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理ステップと、
前記アクセス指示により指定された領域が属する前記論理ブロックと対応する前記物理ブロックにホストシステム側から与えられたデータを書き込むデータ書き込みステップと、
前記物理ブロックに対して新たに前記論理ブロックが割り当てられる毎にカウント値を更新するカウントステップと、
前記カウント値に基づいて決定されるカウント情報を、新たな前記論理ブロックが割り当てられた前記物理ブロックに書き込むカウント情報書き込みステップと、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索ステップと、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持ステップと、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定ステップと、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するか否かを、前記カウント値と前記処理対象ブロックに書き込まれている前記カウント情報に基づいて判断する判断ステップと、
前記判断ステップで肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するデータ転送ステップと
を備えるフラッシュメモリの制御方法。
A flash memory control method for controlling access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
An erase count management step for managing the erase count of each of the physical blocks constituting the flash memory;
A block management step for managing the correspondence between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
A data writing step of writing data given from the host system side to the physical block corresponding to the logical block to which the area designated by the access instruction belongs;
A count step of updating a count value every time the logical block is newly assigned to the physical block;
Count information writing step for writing count information determined based on the count value to the physical block to which a new logical block is allocated;
A free block search step of searching for a free block that is the physical block in the erased state in the flash memory;
An information holding step for holding information representing a target logical address range or a non-target logical address range specified by the host system;
The physical block to which a part of the plurality of logical blocks and the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range are allocated. A processing target block specifying step for specifying a processing target block;
Whether to transfer the data stored in the processing target block to the free block detected by the free block search step is determined based on the count value and the count information written in the processing target block. A judgment step to judge;
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching step when a positive determination is made in the determination step A method for controlling a flash memory.
ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するフラッシュメモリの制御方法であって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理ステップと、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックを前記物理ブロックに割り当てる論理ブロック割り当てステップと、
前記論理ブロック割り当てステップにより設定された前記論理ブロックと前記物理ブロックとの対応関係を示すアドレス変換テーブルを管理するアドレス変換テーブル管理ステップと、
前記アドレス変換テーブル管理ステップにより前記アドレス変換テーブルの少なくとも一部の前記論理ブロックと前記物理ブロックとの対応関係が変更されたときに、前記アドレス変換テーブルの保存先の前記物理ブロックであるテーブル保存ブロックに、前記アドレス変換テーブルを保存するアドレス変換テーブル保存ステップと、
前記テーブル保存ブロックに、前記アドレス変換テーブルを保存するための空き領域が無くなったとき、別の前記物理ブロックを前記テーブル保存ブロックとして新たに割り当てるテーブル保存ブロック管理ステップと、
前記テーブル保存ブロック管理ステップにより新たな前記テーブル保存ブロックの割り当てが行われたときに、空き領域が無くなった前記テーブル保存ブロックに記憶されているカウント値と一致するカウント値である直前のカウント値を更新し、更新後のカウント値である最新のカウント値を、新たに前記テーブル保存ブロックとして割り当てられた前記物理ブロックに書き込むカウント情報書き込みステップと、
前記最新のカウント値に基づいて、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報を決定する版数情報決定ステップと、
前記版数情報決定ステップにより決定された前記版数情報を、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報書き込みステップと、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索ステップと、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持ステップと、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定ステップと、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断ステップと、
前記判断ステップにより肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するデータ転送ステップと
を備えるフラッシュメモリの制御方法。
A flash memory control method for controlling access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
An erase count management step for managing the erase count of each of the physical blocks constituting the flash memory;
A logical block allocation step for allocating a logical block composed of a plurality of sectors in the logical address space on the host system side to the physical block;
An address translation table management step for managing an address translation table indicating a correspondence relationship between the logical block and the physical block set by the logical block allocation step;
A table storage block that is the physical block that is the storage destination of the address conversion table when the correspondence relationship between at least some of the logical blocks of the address conversion table and the physical block is changed by the address conversion table management step And an address conversion table storing step for storing the address conversion table;
A table storage block management step for newly allocating another physical block as the table storage block when there is no more free space in the table storage block for storing the address conversion table;
When a new table storage block is assigned by the table storage block management step, the count value immediately before the count value that matches the count value stored in the table storage block that has no free space is obtained. A count information writing step of updating and writing the latest count value, which is the updated count value, into the physical block newly assigned as the table storage block;
A version number information determining step for determining version number information to be written in the physical block to which the logical block is newly allocated based on the latest count value;
A version number information writing step of writing the version number information determined in the version number information determination step into the physical block to which the logical block is newly assigned;
A free block search step of searching for a free block that is the physical block in the erased state in the flash memory;
An information holding step for holding information representing a target logical address range or a non-target logical address range specified by the host system;
The physical block to which a part of the plurality of logical blocks and the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range are allocated. A processing target block specifying step for specifying a processing target block;
Judgment for determining whether to transfer the data stored in the processing target block to the free block detected by the free block search step based on the version number information written in the processing target block Steps,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching step when a positive determination is made in the determination step A method for controlling a flash memory.
ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するフラッシュメモリの制御方法であって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理ステップと、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックを前記物理ブロックに割り当てる論理ブロック割り当てステップと、
前記論理ブロック割り当てステップにより設定された前記論理ブロックと前記物理ブロックとの対応関係を示すアドレス変換テーブルを管理するアドレス変換テーブル管理ステップと、
前記アドレス変換テーブル管理ステップにより前記アドレス変換テーブルの少なくとも一部の前記論理ブロックと前記物理ブロックとの対応関係が変更されたときに、前記アドレス変換テーブルの保存先の前記物理ブロックであるテーブル保存ブロックに、前記アドレス変換テーブルを保存するアドレス変換テーブル保存ステップと、
前記テーブル保存ブロックに、前記アドレス変換テーブルを保存するための空き領域が無くなったとき、別の前記物理ブロックを前記テーブル保存ブロックとして新たに割り当てるテーブル保存ブロック管理ステップと、
前記テーブル保存ブロックとして割り当てられている前記物理ブロックが変わったときに、前記テーブル保存ブロックとして割り当てられている前記物理ブロックを示す管理情報を、前記管理情報の保存先の前記物理ブロックである管理情報ブロックに保存する管理情報保存ステップと、
前記管理情報ブロックに、前記管理情報を保存するための空き領域が無くなったとき、別の前記物理ブロックを前記管理情報ブロックとして新たに割り当てる管理情報ブロック管理ステップと、
前記管理情報ブロック管理ステップにより新たな前記管理情報ブロックの割り当てが行われたとき、空き領域が無くなった前記管理情報ブロックに記憶されているカウント値と一致するカウント値である直前のカウント値を更新し、更新後のカウント値である最新のカウント値を、新たに前記管理情報ブロックとして割り当てられた前記物理ブロックに書き込むカウント情報書き込みステップと、
前記最新のカウント値に基づいて、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報を決定する版数情報決定ステップと、
前記版数情報決定ステップにより決定された前記版数情報を、前記論理ブロックが新たに割り当てられた前記物理ブロックに書き込む版数情報書き込みステップと、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索ステップと、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持ステップと、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定ステップと、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断ステップと、
前記判断ステップにより肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するデータ転送ステップと
を備えるフラッシュメモリの制御方法。
A flash memory control method for controlling access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
An erase count management step for managing the erase count of each of the physical blocks constituting the flash memory;
A logical block allocation step for allocating a logical block composed of a plurality of sectors in the logical address space on the host system side to the physical block;
An address translation table management step for managing an address translation table indicating a correspondence relationship between the logical block and the physical block set by the logical block allocation step;
A table storage block that is the physical block that is the storage destination of the address conversion table when the correspondence relationship between at least some of the logical blocks of the address conversion table and the physical block is changed by the address conversion table management step And an address conversion table storing step for storing the address conversion table;
A table storage block management step for newly allocating another physical block as the table storage block when there is no more free space in the table storage block for storing the address conversion table;
When the physical block allocated as the table storage block changes, the management information indicating the physical block allocated as the table storage block is the management information that is the physical block of the storage destination of the management information A management information storage step to be stored in the block;
A management information block management step for newly assigning another physical block as the management information block when there is no more free space in the management information block for storing the management information;
When a new management information block is allocated by the management information block management step, the count value immediately before that is the count value that matches the count value stored in the management information block that has no free space is updated. A count information writing step of writing the latest count value, which is the updated count value, into the physical block newly assigned as the management information block;
A version number information determining step for determining version number information to be written in the physical block to which the logical block is newly allocated based on the latest count value;
A version number information writing step of writing the version number information determined in the version number information determination step into the physical block to which the logical block is newly assigned;
A free block search step of searching for a free block that is the physical block in the erased state in the flash memory;
An information holding step for holding information representing a target logical address range or a non-target logical address range specified by the host system;
The physical block to which a part of the plurality of logical blocks and the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range are allocated. A processing target block specifying step for specifying a processing target block;
Judgment for determining whether to transfer the data stored in the processing target block to the free block detected by the free block search step based on the version number information written in the processing target block Steps,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching step when a positive determination is made in the determination step A method for controlling a flash memory.
ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するフラッシュメモリの制御方法であって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理ステップと、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理ステップと、
前記物理ブロックに対して前記論理ブロックが新たに割り当てられる毎にカウント値を更新するカウントステップと
前記カウント値が所定の値に達したときに、前記論理ブロックを割り当てた物理ブロックに書き込む版数情報を更新する版数情報管理ステップと、
前記論理ブロックが新たに割り当てられた前記物理ブロックに、前記版数情報を書き込む版数情報書き込みステップと、
前記フラッシュメモリ内の消去状態の前記物理ブロックである空きブロックを検索する空きブロック検索ステップと、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持ステップと、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定ステップと、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断ステップと、
前記判断ステップにより肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するデータ転送ステップと
を備えるフラッシュメモリの制御方法。
A flash memory control method for controlling access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
An erase count management step for managing the erase count of each of the physical blocks constituting the flash memory;
A block management step for managing the correspondence between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
A count step of updating a count value each time the logical block is newly assigned to the physical block, and version number information to be written to the physical block to which the logical block is assigned when the count value reaches a predetermined value Version number information management step to update,
A version number information writing step for writing the version number information to the physical block to which the logical block is newly assigned;
A free block search step of searching for a free block that is the physical block in the erased state in the flash memory;
An information holding step for holding information representing a target logical address range or a non-target logical address range specified by the host system;
The physical block to which a part of the plurality of logical blocks and the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range are allocated. A processing target block specifying step for specifying a processing target block;
Judgment for determining whether to transfer the data stored in the processing target block to the free block detected by the free block search step based on the version number information written in the processing target block Steps,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching step when a positive determination is made in the determination step A method for controlling a flash memory.
ホストシステムから与えられるアクセス指示に基づいて、物理ブロック単位で消去が行われるフラッシュメモリに対するアクセスを制御するフラッシュメモリの制御方法であって、
前記フラッシュメモリを構成するそれぞれの前記物理ブロックの消去回数を管理する消去回数管理ステップと、
ホストシステム側の論理アドレス空間における複数セクタの領域で構成された論理ブロックと前記物理ブロックとの対応関係を管理するブロック管理ステップと、
前記フラッシュメモリ内の消去状態の前記物理ブロックを検索するステップであって、前記フラッシュメモリ内の前記物理ブロックが消去状態であるか否かを所定の順番で判断していく空きブロック検索ステップと、
前記空きブロック検索ステップで検出された消去状態の前記物理ブロックに対して前記論理ブロックを割り当てる論理ブロック割り当てステップと、
前記空きブロック検索ステップにおける所定の順番の検索が所定回数巡回する毎に、前記論理ブロックを割り当てた物理ブロックに書き込む版数情報を更新する版数情報管理ステップと、
前記論理ブロックが新たに割り当てられた前記物理ブロックに、前記版数情報を書き込む版数情報書き込みステップと、
前記ホストシステムから指定された対象論理アドレス範囲又は対象外論理アドレス範囲を表す情報を保持する情報保持ステップと、
複数の前記論理ブロックのうちの一部の前記論理ブロックであって前記対象論理アドレス範囲に属する前記論理ブロック又は前記対象外論理アドレス範囲に属さない前記論理ブロックが割り当てられている前記物理ブロックである処理対象ブロックを特定する処理対象ブロック特定ステップと、
前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するか否かを、前記処理対象ブロックに書き込まれている前記版数情報に基づいて判断する判断ステップと、
前記判断ステップにより肯定的な判断がなされたときに、前記肯定的な判断の対象の前記処理対象ブロックに記憶されているデータを前記空きブロック検索ステップにより検出された前記空きブロックに転送するデータ転送ステップと
を備えるフラッシュメモリの制御方法。
A flash memory control method for controlling access to a flash memory that is erased in units of physical blocks based on an access instruction given from a host system,
An erase count management step for managing the erase count of each of the physical blocks constituting the flash memory;
A block management step for managing the correspondence between a logical block composed of a plurality of sectors in the logical address space on the host system side and the physical block;
A search for the physical block in the erased state in the flash memory, and a free block search step for determining in a predetermined order whether or not the physical block in the flash memory is in an erased state;
A logical block allocation step of allocating the logical block to the physical block in the erased state detected in the empty block search step;
A version number information management step for updating version number information to be written in the physical block to which the logical block is allocated each time the search in the predetermined order in the empty block search step circulates a predetermined number of times,
A version number information writing step for writing the version number information to the physical block to which the logical block is newly assigned;
An information holding step for holding information representing a target logical address range or a non-target logical address range specified by the host system;
The physical block to which a part of the plurality of logical blocks and the logical block belonging to the target logical address range or the logical block not belonging to the non-target logical address range are allocated. A processing target block specifying step for specifying a processing target block;
Judgment for determining whether to transfer the data stored in the processing target block to the free block detected by the free block search step based on the version number information written in the processing target block Steps,
Data transfer for transferring data stored in the processing target block to be affirmatively determined to the free block detected by the free block searching step when a positive determination is made in the determination step A method for controlling a flash memory.
JP2009096802A 2009-04-13 2009-04-13 MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD Active JP4952740B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009096802A JP4952740B2 (en) 2009-04-13 2009-04-13 MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009096802A JP4952740B2 (en) 2009-04-13 2009-04-13 MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD

Publications (2)

Publication Number Publication Date
JP2010250413A JP2010250413A (en) 2010-11-04
JP4952740B2 true JP4952740B2 (en) 2012-06-13

Family

ID=43312698

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009096802A Active JP4952740B2 (en) 2009-04-13 2009-04-13 MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD

Country Status (1)

Country Link
JP (1) JP4952740B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11256432B2 (en) 2018-11-21 2022-02-22 Tdk Corporation Memory controller and memory system

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012173778A (en) * 2011-02-17 2012-09-10 Sony Corp Management device and management method
US9104547B2 (en) * 2011-08-03 2015-08-11 Micron Technology, Inc. Wear leveling for a memory device
JP5788369B2 (en) * 2012-09-12 2015-09-30 株式会社東芝 Memory system, computer system, and memory management method
JP6167646B2 (en) * 2013-04-30 2017-07-26 富士通株式会社 Information processing apparatus, control circuit, control program, and control method
JP7438924B2 (en) * 2020-12-15 2024-02-27 株式会社東芝 Information processing device, method and program

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06131891A (en) * 1992-10-14 1994-05-13 Toshiba Corp Semiconductor file device
JP3507132B2 (en) * 1994-06-29 2004-03-15 株式会社日立製作所 Storage device using flash memory and storage control method thereof
JPH1040176A (en) * 1996-07-25 1998-02-13 Canon Inc System and method for memory management of electronic equipment, and storage medium stored with memory management program that computer can read
JP3421581B2 (en) * 1998-06-29 2003-06-30 株式会社日立製作所 Storage device using nonvolatile semiconductor memory
JP4096660B2 (en) * 2002-08-22 2008-06-04 カシオ計算機株式会社 Data recording control device and program
JP2004310650A (en) * 2003-04-10 2004-11-04 Renesas Technology Corp Memory device
KR100526190B1 (en) * 2004-02-06 2005-11-03 삼성전자주식회사 Remapping method for flash memory
JP2007164318A (en) * 2005-12-12 2007-06-28 Renesas Technology Corp Storage system
JP2008146255A (en) * 2006-12-07 2008-06-26 Sony Corp Storage device, computer system, and data processing method for storage device
CN100504814C (en) * 2007-01-17 2009-06-24 忆正存储技术(深圳)有限公司 Flash-memory zone block management method
JP4488048B2 (en) * 2007-09-27 2010-06-23 Tdk株式会社 MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4366420B2 (en) * 2007-10-30 2009-11-18 Tdk株式会社 MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4821845B2 (en) * 2008-12-22 2011-11-24 Tdk株式会社 MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11256432B2 (en) 2018-11-21 2022-02-22 Tdk Corporation Memory controller and memory system

Also Published As

Publication number Publication date
JP2010250413A (en) 2010-11-04

Similar Documents

Publication Publication Date Title
US8239612B2 (en) Memory controller, flash memory system with memory controller, and control method of flash memory
JP4844639B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4666080B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4666081B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
US8239615B2 (en) Memory controller, flash memory system with memory controller, and method of controlling flash memory
JP4952740B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP2010097333A (en) Memory controller, flash memory system equipped with memory controller and method for controlling flash memory
JP5093294B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4821845B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4366420B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4488048B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP5858081B2 (en) Memory controller, memory system, and memory control method
JP4821844B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4952742B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
US8200890B2 (en) Memory controller, flash memory system with memory controller, and method of controlling flash memory
JP4952741B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP2007323159A (en) Memory controller, flash memory system therewith, and method for controlling flash memory
JP4434171B2 (en) Memory controller and flash memory system
JP5520880B2 (en) Flash memory device
JP2013200726A (en) Semiconductor memory
JP6260395B2 (en) Memory controller, memory system, and memory control method
JP4569554B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP2009301491A (en) Memory controller, flash memory system equipped with memory controller, and control method for flash memory
JP2009157807A (en) Memory controller, flash memory system provided with memory controller, and method for controlling flash memory
JP2007172066A (en) Memory controller and flash memory system

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20111128

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A132

Effective date: 20111206

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120126

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: 20120214

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: 20120227

R150 Certificate of patent or registration of utility model

Ref document number: 4952740

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20150323

Year of fee payment: 3