JP2007206835A - Memory controller and flash memory system - Google Patents

Memory controller and flash memory system Download PDF

Info

Publication number
JP2007206835A
JP2007206835A JP2006022885A JP2006022885A JP2007206835A JP 2007206835 A JP2007206835 A JP 2007206835A JP 2006022885 A JP2006022885 A JP 2006022885A JP 2006022885 A JP2006022885 A JP 2006022885A JP 2007206835 A JP2007206835 A JP 2007206835A
Authority
JP
Japan
Prior art keywords
block
physical
zone
logical
flash memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2006022885A
Other languages
Japanese (ja)
Other versions
JP4213166B2 (en
Inventor
Hirotoshi Takagi
宏寿 高木
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 JP2006022885A priority Critical patent/JP4213166B2/en
Publication of JP2007206835A publication Critical patent/JP2007206835A/en
Application granted granted Critical
Publication of JP4213166B2 publication Critical patent/JP4213166B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Memory System (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a memory controller and a flash memory system, so as not to search only a specific physical block for an empty block. <P>SOLUTION: An address conversion table 100 which is stored in a work area and formed for each set of corresponding logical zone and physical zone stores the correspondence between logical block number LZIBN in the logical zone and physical block number PZIBN in the physical zone. When a certain logical block is accessed, LZIBN of this logical block is inspected, and PZIBN of a physical block corresponding to this logical block is acquired using the address conversion table 100. Search of empty block is started from a physical block having a PZIBN obtained by adding one to the acquired PZIBN of the physical block in the order of PZIBN. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

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

近年、不揮発性の記憶媒体であるフラッシュメモリの開発が行われ、デジタルカメラ等の情報機器(ホストシステム)の記憶媒体として普及している。
このような機器が扱うデータが大容量化したことに伴い、フラッシュメモリの記憶容量も大容量化が進んでいる。このように大容量化したフラッシュメモリを円滑に管理するため、近年は、この記憶領域を複数のゾーンに分割して管理する手法が用いられている(たとえば、特許文献1を参照)。
In recent years, a flash memory, which is a non-volatile storage medium, has been developed and is widely used as a storage medium for information devices (host systems) such as digital cameras.
As the data handled by such devices has increased in capacity, the storage capacity of flash memory has also increased. In order to smoothly manage the flash memory having such a large capacity, a method of managing this storage area by dividing it into a plurality of zones has been used in recent years (see, for example, Patent Document 1).

従来の複数のゾーンを有するフラッシュメモリの記憶領域を、より具体的に示せば、例えば図11に示す形に区画され、管理されていた。   More specifically, the storage area of the conventional flash memory having a plurality of zones is partitioned and managed in the form shown in FIG. 11, for example.

すなわち、データの物理的な読み書きの単位であるページを所定数含んだ、データ消去の単位である物理ブロックには、それぞれに固有の物理ブロックアドレス(PBA)が割り当てられている。各物理ブロックは、複数の物理ゾーンのいずれかに分類され、各物理ゾーンには、それぞれに固有の物理ゾーン番号(PZN)が割り当てられる。図11の例では、計2048個の物理ブロックに#0〜#2047の連続するPBAが割り当てられており、PBA#0〜#511の計512個の物理ブロックがPZN#0の物理ゾーンに属し、PBA#512〜#1023の計512個の物理ブロックがPZN#1の物理ゾーンに属し、PBA#1024〜#1535の計512個の物理ブロックがPZN#2の物理ゾーンに属し、PBA#1536〜#2047の計512個の物理ブロックがPZN#3の物理ゾーンに属する。   That is, a specific physical block address (PBA) is assigned to each physical block that is a unit of data erasing and includes a predetermined number of pages that are units of physical data reading and writing. Each physical block is classified into one of a plurality of physical zones, and a unique physical zone number (PZN) is assigned to each physical zone. In the example of FIG. 11, continuous PBAs # 0 to # 2047 are assigned to a total of 2048 physical blocks, and a total of 512 physical blocks PBA # 0 to # 511 belong to the physical zone of PZN # 0. , PBA # 512 to # 1023 total 512 physical blocks belong to PZN # 1 physical zone, and PBA # 1024 to # 1535 total 512 physical blocks belong to PZN # 2 physical zone, PBA # 1536 A total of 512 physical blocks of ˜ # 2047 belong to the physical zone of PZN # 3.

また、各ページには物理ページアドレス(PPA)が割り当てられている。PPAは、ページが属する物理ブロックのPBAの下位に、当該物理ブロック内での当該ページの通番であるページ番号(PN)を付加した形をとっている。   Each page is assigned a physical page address (PPA). The PPA has a form in which a page number (PN), which is a serial number of the page in the physical block, is added to the lower level of the PBA of the physical block to which the page belongs.

一方、ホストシステム側のアドレス空間は、セクタ(512バイト)単位で分割した領域に付けた通番であるLBA(Logical Block Address)で管理されている。更に、複数個のセクタをまとめたものを論理ブロックと呼び、複数個の論理ブロックをまとめたものを論理ゾーンと呼んでいる。又、論理ブロックに付けられた通番を論理ブロック番号(LBN)と呼び、論理ゾーンに付けられた通番を論理ゾーン番号(LZN)と呼んでいる。又、各論理ゾーンに含まれる論理ブロックの、各論理ゾーン内での通番を論理ゾーン内ブロック番号(LZIBN)と呼んでいる。   On the other hand, the address space on the host system side is managed by an LBA (Logical Block Address) which is a serial number assigned to an area divided in units of sectors (512 bytes). Further, a group of a plurality of sectors is called a logical block, and a group of a plurality of logical blocks is called a logical zone. The serial number assigned to the logical block is called a logical block number (LBN), and the serial number assigned to the logical zone is called a logical zone number (LZN). Further, the serial number in each logical zone of the logical block included in each logical zone is called a logical zone block number (LZIBN).

従って、各論理ゾーンに含まれる論理ブロック数をnとした場合、LBNをnで割ったときの商がLZNに対応し、余りがLZIBNに対応する。   Therefore, when the number of logical blocks included in each logical zone is n, the quotient when LBN is divided by n corresponds to LZN, and the remainder corresponds to LZIBN.

又、各論理ゾーンにはそれぞれ1個の物理ゾーンが割り当てられ、論理ゾーンに含まれる各論理ブロックに対応するデータは、その論理ゾーンに割り当てられた物理ゾーンに含まれる物理ブロックに書き込まれる。更に、データが書き込まれた物理ブロックの冗長領域には、そのデータに対応する論理ブロックのLZIBN(又は、LBN)が書き込まれる。   In addition, one physical zone is allocated to each logical zone, and data corresponding to each logical block included in the logical zone is written to a physical block included in the physical zone allocated to the logical zone. Further, LZIBN (or LBN) of the logical block corresponding to the data is written in the redundant area of the physical block in which the data is written.

なお、物理ブロックと論理ブロックとの対応関係は、データの書き込みや消去が行われる毎に変化する。このため、個々の時点における両者の対応関係を管理するためアドレス変換テーブルが作成され、対応関係が変化する毎にアドレス変換テーブルが更新される。このアドレス変換テーブルは論理ゾーン毎に作成することができる。つまり、論理ゾーンと物理ゾーンとの対応関係は予め設定されているので、アクセス対象の物理ゾーンに含まれる物理ブロックの冗長領域に書き込まれているLZIBNを参照することによりアドレス変換テーブルを作成することができる。   Note that the correspondence between the physical block and the logical block changes every time data is written or erased. Therefore, an address conversion table is created in order to manage the correspondence between the two at each time point, and the address conversion table is updated each time the correspondence changes. This address conversion table can be created for each logical zone. That is, since the correspondence relationship between the logical zone and the physical zone is set in advance, an address conversion table is created by referring to the LZIBN written in the redundant area of the physical block included in the physical zone to be accessed. Can do.

ここで、冗長領域に書き込まれる論理ブロックを特定する情報(以下、論理アドレス情報という。)は、LBNであってもアドレス変換テーブルを作成することができるが、一般的にはデータ量の少ないLZIBNが論理アドレス情報として冗長領域に書き込まれる。   Here, even if the information (hereinafter referred to as logical address information) specifying the logical block to be written in the redundant area is LBN, an address conversion table can be created, but generally LZIBN with a small amount of data is used. Is written in the redundant area as logical address information.

一般的に、各論理ゾーンには、LBAが連続する複数のセクタが割り当てられている。図11の例では、LZN#0の論理ゾーンにLBA#0〜#15999のセクタが、LZN#1の論理ゾーンにLBA#16000〜#31999のセクタが、LZN#2の論理ゾーンにLBA#32000〜#47999のセクタが、LZN#3の論理ゾーンにLBA#48000〜#63999のセクタが、それぞれ割り当てられている。なお、この例では、フラッシュメモリの1個のページが1個のセクタに対応し、各物理ブロックは、32個のページで構成されている。   In general, a plurality of sectors having consecutive LBAs are allocated to each logical zone. In the example of FIG. 11, LBA # 0 to # 15999 sectors are in the LZN # 0 logical zone, LBA # 16000 to # 31999 sectors are in the LZN # 1 logical zone, and LBA # 32000 is in the LZN # 2 logical zone. ... To # 47999, and LBA # 48000 to # 63999 are assigned to the logical zone of LZN # 3, respectively. In this example, one page of the flash memory corresponds to one sector, and each physical block is composed of 32 pages.

各論理ゾーンに割り当てられた16000個のセクタは、論理ゾーン内でLBAが連続する32個のセクタ単位で論理ブロックとして管理されている。従って、言い換えれば、LBAが連続する32個のセクタを論理ブロックとして、LBNが連続する論理ブロックを各論理ゾーンに500個(LZIBN#0〜#499)ずつ割り当てている。ここで、論理ブロックに含まれるセクタ数については、1個の論理ブロックと1個又は複数個の物理ブロックの容量が一致するよう適宜設定される。又、物理ブロックの各ページにはLBAの順番でデータが格納されるので、各論理ゾーンに含まれる論理ブロックと、その論理ゾーンに対応する物理ゾーンに含まれる物理ブロックとの対応関係に基づいて、フラッシュメモリ内のアクセス先を特定することができる。
特開2005−18490号公報
The 16000 sectors assigned to each logical zone are managed as logical blocks in units of 32 sectors in which LBAs are continuous in the logical zone. Therefore, in other words, 32 sectors with consecutive LBAs are assigned as logical blocks, and 500 logical blocks with consecutive LBNs (LZIBN # 0 to # 499) are allocated to each logical zone. Here, the number of sectors included in the logical block is set as appropriate so that the capacities of one logical block and one or a plurality of physical blocks coincide. In addition, since data is stored in the LBA order in each page of the physical block, based on the correspondence between the logical block included in each logical zone and the physical block included in the physical zone corresponding to the logical zone. The access destination in the flash memory can be specified.
JP 2005-18490 A

データを新たにフラッシュメモリに書き込む際には、書き込む論理ゾーンに対応する物理ゾーンを検索し、その物理ゾーン内の使用されていない物理ブロック(空きブロック)を検索し、その空きブロックに対してデータを書き込む必要がある。この空きブロック検索では、通常、各物理ゾーンに含まれる物理ブロックの使用状況を物理ブロックアドレスの順番で走査していくことにより空きブロックを検出する。又、この使用状況の走査は、前回の検索で検出された空きブロックの次の物理ブロックアドレスから開始される。つまり、この使用状況の走査は、空きブロックを検出すると終了し、次回の走査は、この空きブロックの次の物理ブロックアドレスから開始される。しかし、電源をオンした後(起動後)の最初の検索で、前回の検索で検出された空きブロックの次の物理ブロックアドレスから走査を開始するためには、前回の検索で検出された空きブロックの物理ブロックアドレスを特定する情報を不揮発性メモリに記憶させておかなければならない。又、電源をオンした後(起動後)の最初の検索については、所定の物理ブロックアドレスから検索を開始するようにしてもよいが、その場合、空きブロックの検索が特定の物理ブロックに偏ってしまう。   When writing new data to the flash memory, the physical zone corresponding to the logical zone to be written is searched, the unused physical block (empty block) in the physical zone is searched, and the data for the empty block is searched. Need to write. In this free block search, a free block is usually detected by scanning the usage status of physical blocks included in each physical zone in the order of physical block addresses. Also, this usage status scan starts from the physical block address next to the empty block detected in the previous search. In other words, the scan of this usage status is completed when an empty block is detected, and the next scan is started from the physical block address next to this empty block. However, in order to start scanning from the physical block address next to the free block detected in the previous search in the first search after turning on the power (after startup), the free block detected in the previous search The information specifying the physical block address must be stored in the nonvolatile memory. In addition, for the first search after the power is turned on (after startup), the search may be started from a predetermined physical block address. In this case, the search for an empty block is biased to a specific physical block. End up.

本発明は、上記問題点に鑑みてなされたものであり、空きブロックの検索を特定の物理ブロックに偏らせないメモリコントローラおよびフラッシュメモリシステムを提供することを目的とする。   The present invention has been made in view of the above problems, and an object of the present invention is to provide a memory controller and a flash memory system that do not bias the search for an empty block to a specific physical block.

上記課題を解決するため、本発明の第1の観点に係るメモリコントローラは、
ホストシステムからの命令に応答してフラッシュメモリへのアクセスを制御するメモリコントローラであって、
前記フラッシュメモリにおける消去単位である物理ブロックを複数個集めた物理ゾーンと前記ホストシステムにおけるアクセス単位であるセクタを複数集めた論理ゾーンとの対応関係を管理するゾーン管理手段と、
対応関係にある前記論理ゾーンと前記物理ゾーンとの間で、該論理ゾーン内の論理アドレスと該物理ゾーン内の物理アドレスとの対応関係を管理するアドレス管理手段と、
前記物理ゾーン内の物理ブロックの使用状況を順次走査していくことにより空きブロックを検出する空きブロック検索手段と、
を備え、
前記空きブロック検索手段は、前回の走査で検出された空きブロックに関する情報が保持されている場合は、前回の走査で検出された空きブロックの次の物理ブロックから使用状況の走査を開始し、前回の走査で検出された空きブロックに関する情報が保持されていない場合は、検出した空きブロックに書き込む新データと対応関係にある旧データが記憶されている物理ブロックの次の物理ブロックから使用状況の走査を開始するように構成されている、
ことを特徴とする。
In order to solve the above problems, a memory controller according to the first aspect of the present invention provides:
A memory controller that controls access to a flash memory in response to a command from a host system,
Zone management means for managing a correspondence relationship between a physical zone that collects a plurality of physical blocks that are erase units in the flash memory and a logical zone that collects a plurality of sectors that are access units in the host system;
Address management means for managing the correspondence between the logical address in the logical zone and the physical address in the physical zone between the logical zone and the physical zone in a correspondence relationship;
Empty block search means for detecting empty blocks by sequentially scanning the usage status of physical blocks in the physical zone;
With
The empty block search means starts scanning the usage status from the physical block next to the empty block detected in the previous scan when information on the empty block detected in the previous scan is held. If the information about the free block detected in the previous scan is not retained, the usage status scan starts from the physical block next to the physical block in which the old data corresponding to the new data to be written to the detected free block is stored. Is configured to start,
It is characterized by that.

上記課題を解決するため、本発明の第2の観点に係るメモリコントローラは、
ホストシステムからの命令に応答してフラッシュメモリへのアクセスを制御するメモリコントローラであって、
前記フラッシュメモリにおける消去単位である物理ブロックを複数個集めた物理ゾーンと前記ホストシステムにおけるアクセス単位であるセクタを複数集めた論理ゾーンとの対応関係を管理するゾーン管理手段と、
対応関係にある前記論理ゾーンと前記物理ゾーンとの間で、該論理ゾーン内の論理アドレスと該物理ゾーン内の物理アドレスとの対応関係を管理するアドレス管理手段と、
前記物理ゾーン内の物理ブロックの使用状況を順次走査していくことにより空きブロックを検出する空きブロック検索手段と、
を備え、
前記空きブロック検索手段は、検出した空きブロックに書き込む新データと対応関係にある旧データが記憶されている物理ブロックの次の物理ブロックから使用状況の走査を開始するように構成されている、
ことを特徴とする。
In order to solve the above problems, a memory controller according to a second aspect of the present invention provides:
A memory controller that controls access to a flash memory in response to a command from a host system,
Zone management means for managing a correspondence relationship between a physical zone that collects a plurality of physical blocks that are erase units in the flash memory and a logical zone that collects a plurality of sectors that are access units in the host system;
Address management means for managing the correspondence between the logical address in the logical zone and the physical address in the physical zone between the logical zone and the physical zone in a correspondence relationship;
Empty block search means for detecting empty blocks by sequentially scanning the usage status of physical blocks in the physical zone;
With
The empty block search means is configured to start a scan of usage status from a physical block next to a physical block in which old data that is associated with new data to be written to the detected empty block is stored.
It is characterized by that.

前記空きブロック検索手段は、起動後に各ビットの論理値が対応関係にある前記物理ブロックの使用状況を示している複数ビットの記憶領域で構成された空きブロック検索テーブルを作成し、該空きブロック検索テーブルを用いて前記物理ブロックの使用状況の走査を行う、
ようにしてもよい。
The free block search means creates a free block search table composed of a plurality of bits of storage area indicating the usage status of the physical block in which the logical value of each bit is in a correspondence relationship after startup, and the free block search Scan the physical block usage status using a table,
You may do it.

上記課題を解決するため、本発明の第3の観点に係るフラッシュメモリシステムは、
上記のメモリコントローラと、
フラッシュメモリと、
から構成されることを特徴とする。
In order to solve the above problem, a flash memory system according to a third aspect of the present invention provides:
The above memory controller;
Flash memory,
It is comprised from these.

本発明によれば、物理ゾーン内の物理ブロックの使用状況を順次走査していくことにより空きブロックを検出するように構成されているメモリコントローラで、前回の検索で検出された空きブロックに関する情報が保持されていない場合に、空きブロックに書き込む書き換えデータに対応する旧データが記憶されている物理ブロックの次の物理ブロックから空きブロックの検索を開始するので、空きブロック検索を特定の物理ブロックに偏らせないメモリコントローラおよびフラッシュメモリシステムを提供できる。   According to the present invention, in the memory controller configured to detect the empty blocks by sequentially scanning the usage status of the physical blocks in the physical zone, information on the empty blocks detected in the previous search is stored. If not, the search for the empty block is started from the physical block next to the physical block in which the old data corresponding to the rewrite data to be written to the empty block is stored. Therefore, the empty block search is biased to a specific physical block. Memory controller and flash memory system can be provided.

以下、本発明の実施形態について、図面を参照して説明する。   Hereinafter, embodiments of the present invention will be described with reference to the drawings.

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

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

フラッシュメモリ2は、不揮発性メモリであり、レジスタと、メモリセルアレイとから構成される。フラッシュメモリ2は、レジスタとメモリセルとの間でデータの複写を行って、データの書き込み又は読み出しを行う。   The flash memory 2 is a non-volatile memory and includes a register and a memory cell array. The flash memory 2 writes or reads data by copying data between a register and a memory cell.

メモリセルアレイは、複数のメモリセル群と、ワード線とを備える。各メモリセル群は、複数のメモリセルが直列に接続されたものである。ワード線は、メモリセル群の特定のメモリセルを選択するためのものである。このワード線を介して選択されたメモリセルとレジスタとの間で、データの複写、即ち、レジスタから選択されたメモリセルへの複写又は選択されたメモリセルからレジスタへのデータの複写が行われる。   The memory cell array includes a plurality of memory cell groups and word lines. Each memory cell group includes a plurality of memory cells connected in series. The word line is for selecting a specific memory cell in the memory cell group. Data is copied between the selected memory cell and the register via the word line, that is, data is copied from the register to the selected memory cell, or data is copied from the selected memory cell to the register. .

メモリセルアレイを構成するメモリセルは、2つのゲートを備えたMOSトランジスタによって構成される。ここで、上側のゲート、下側のゲートは、それぞれ、コントロールゲート、フローティングゲートと呼ばれており、フローティングゲートに電荷(電子)を注入若しくはフローティングゲートから電荷(電子)を排出することによって、データの書き込み若しくはデータの消去が行われる。   A memory cell constituting the memory cell array is constituted by a MOS transistor having two gates. Here, the upper gate and the lower gate are referred to as a control gate and a floating gate, respectively. By injecting charges (electrons) into the floating gate or discharging charges (electrons) from the floating gate, data can be obtained. Is written or data is erased.

このフローティングゲートは、周囲を絶縁体で囲まれているので、注入された電子は長期間にわたって保持される。なお、フローティングゲートに電子を注入するときは、コントロールゲートが高電位側となる高電圧をコントロールゲートとフローティングゲート間に印加する。また、フローティングゲートから電子を排出するときは、コントロールゲートが低電位側となる高電圧をコントロールゲートとフローティングゲート間に印加する。   Since the floating gate is surrounded by an insulator, the injected electrons are held for a long period of time. Note that, when electrons are injected into the floating gate, a high voltage at which the control gate is on the high potential side is applied between the control gate and the floating gate. Further, when electrons are discharged from the floating gate, a high voltage at which the control gate becomes a low potential side is applied between the control gate and the floating gate.

ここで、フローティングゲートに電子が注入されている状態が書き込み状態であり、論理値「0」に対応する。また、フローティングゲートから電子が排出されている状態が消去状態であり、論理値「1」に対応する。   Here, a state where electrons are injected into the floating gate is a write state, which corresponds to a logical value “0”. The state in which electrons are discharged from the floating gate is an erased state, which corresponds to a logical value “1”.

このようなフラッシュメモリ2のアドレス空間を図2に示す。フラッシュメモリ2のアドレス空間は、“ページ”及び“ブロック(物理ブロック)”で構成されている。   Such an address space of the flash memory 2 is shown in FIG. The address space of the flash memory 2 is composed of “pages” and “blocks (physical blocks)”.

ページは、フラッシュメモリ2にて行われるデータ読み出し動作及びデータ書き込み動作における処理単位である。物理ブロックは、フラッシュメモリ2にて行われるデータ消去動作における処理単位であり、複数個のページで構成されている。   A page is a processing unit in a data read operation and a data write operation performed in the flash memory 2. The physical block is a processing unit in the data erasing operation performed in the flash memory 2, and is composed of a plurality of pages.

図2に示したフラッシュメモリ2では、1つのページは、1セクタ(512バイト)のユーザ領域25と、16バイトの冗長領域26で構成され、1つの物理ブロックは32個のページで構成されている。なお、1つのページが4セクタのユーザ領域と64バイトの冗長領域で構成され、1つの物理ブロックが64個のページで構成されているフラッシュメモリもある。ユーザ領域25は、ホストシステム4から供給されるユーザデータを記憶するための領域である。   In the flash memory 2 shown in FIG. 2, one page is composed of a user area 25 of 1 sector (512 bytes) and a redundant area 26 of 16 bytes, and one physical block is composed of 32 pages. Yes. There is a flash memory in which one page is composed of a 4-sector user area and a 64-byte redundant area, and one physical block is composed of 64 pages. The user area 25 is an area for storing user data supplied from the host system 4.

冗長領域26は、ECC(Error Correcting Code)、論理アドレス情報、ブロックステータス(フラグ)等の付加データを記憶するための領域である。   The redundant area 26 is an area for storing additional data such as ECC (Error Correcting Code), logical address information, and block status (flag).

ECCは、ユーザ領域25に記憶されているデータに含まれる誤りを検出し、訂正するためのデータである。   The ECC is data for detecting and correcting an error included in the data stored in the user area 25.

論理アドレス情報は、フラッシュメモリ2の各物理ブロックに含まれている少なくとも1個のページのユーザ領域25に有効なデータが格納されているとき、そのデータに対応する論理ブロックを特定するための情報である。   The logical address information is information for specifying a logical block corresponding to the data when valid data is stored in the user area 25 of at least one page included in each physical block of the flash memory 2. It is.

なお、ユーザ領域25に有効なデータが格納されていない物理ブロックについては、そのブロックの冗長領域26に、論理アドレス情報は格納されていない。   For a physical block in which valid data is not stored in the user area 25, logical address information is not stored in the redundant area 26 of the block.

したがって、冗長領域26に論理アドレス情報が格納されているか否かを判定することにより、その冗長領域26が含まれている物理ブロックに有効なデータが格納されているか否かを判定することができる。つまり、冗長領域26に論理アドレス情報が格納されていないとき、その物理ブロックには、有効なデータが格納されていないと判定される。   Therefore, by determining whether or not logical address information is stored in the redundant area 26, it is possible to determine whether or not valid data is stored in the physical block including the redundant area 26. . That is, when logical address information is not stored in the redundant area 26, it is determined that valid data is not stored in the physical block.

上述のように、1つの物理ブロックは、複数のページを含んでいる。これらのページには、データの上書きができない。このため、1つのページに格納されたデータのみを書き換えるときであっても、そのページが含まれた物理ブロック内の全ページに格納されたデータを、再度書き込まなければならない。   As described above, one physical block includes a plurality of pages. Data cannot be overwritten on these pages. For this reason, even when only the data stored in one page is rewritten, the data stored in all the pages in the physical block including the page must be rewritten.

つまり、通常のデータ書き換えでは、書き換えるページが含まれる物理ブロックの全ページに格納されたデータが、別の消去されている物理ブロックに書き込まれる。この際、データが変更されないページに格納されているデータは、以前に格納されていたデータがそのまま再度書き込まれる。   That is, in normal data rewriting, data stored in all pages of a physical block including a page to be rewritten is written to another erased physical block. At this time, as for the data stored in the page where the data is not changed, the previously stored data is rewritten as it is.

上記のようにデータを書き換えるにあたっては、通常、書き換えられたデータは、以前に格納されていた物理ブロックとは異なる物理ブロックに書き込まれる。このため、論理ブロックアドレスと物理ブロックアドレスの間の対応関係は、フラッシュメモリ2にてデータが書き換えられる毎に、動的に変化する。   In rewriting data as described above, normally, the rewritten data is written in a physical block different from the physical block stored previously. For this reason, the correspondence relationship between the logical block address and the physical block address dynamically changes every time data is rewritten in the flash memory 2.

したがって、論理ブロックと物理ブロックとの対応関係を管理する必要があり、通常、この対応関係は、アドレス変換テーブルによって管理される。このアドレス変換テーブルは、相互対応する論理ゾーンと物理ゾーンとの組毎に構成され、論理ゾーンに含まれる論理ブロックと物理ゾーンに含まれる物理ブロックとの対応関係を示している。又、このアドレス変換テーブルは、各物理ブロックの冗長領域26に記憶されている論理アドレス情報(LZIBN又はLBN)に基づいて作成される。   Therefore, it is necessary to manage the correspondence between the logical block and the physical block, and this correspondence is usually managed by the address conversion table. This address conversion table is configured for each pair of logical zones and physical zones corresponding to each other, and shows the correspondence between the logical blocks included in the logical zone and the physical blocks included in the physical zone. The address conversion table is created based on logical address information (LZIBN or LBN) stored in the redundant area 26 of each physical block.

ブロックステータス(フラグ)は、ブロックの良否を示すフラグである。正常にデータの書き込み等を行うことができないブロックは、不良ブロックと判別され、冗長領域26には、不良ブロックであることを示すブロックステータス(フラグ)が書き込まれる。   The block status (flag) is a flag indicating whether the block is good or bad. A block in which data cannot be normally written is determined as a defective block, and a block status (flag) indicating a defective block is written in the redundant area 26.

このようなフラッシュメモリ2は、コントローラ3から、データ、アドレス情報、内部コマンド等を受信して、データの読み出し処理、書き込み処理、ブロック消去処理、転送処理等の各処理を行う。   Such a flash memory 2 receives data, address information, internal commands, and the like from the controller 3 and performs various processes such as a data read process, a write process, a block erase process, and a transfer process.

ここで、内部コマンドとは、コントローラ3がフラッシュメモリ2に処理の実行を指示するためのコマンドであり、フラッシュメモリ2は、コントローラ3から与えられる内部コマンドに従って動作する。これに対して、外部コマンドとは、ホストシステム4がフラッシュメモリシステム1に対して処理の実行を指示するためのコマンドである。   Here, the internal command is a command for the 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 controller 3. In contrast, the external command is a command for the host system 4 to instruct the flash memory system 1 to execute processing.

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

マイクロプロセッサ6は、ROM12に記憶されているプログラムに従って、コントローラ3の全体の動作を制御する。例えば、マイクロプロセッサ6は、各種処理等を定義したコマンドセットをROM12から読み出してフラッシュメモリインターフェースブロック10に供給し、フラッシュメモリインターフェースブロック10に処理を実行させる。
マイクロプロセッサ6は、たとえば、シフトレジスタとフラグレジスタとを備え、フラグレジスタはシフトレジスタの演算によりキャリーが発生した場合、キャリーフラグを立てる。
The microprocessor 6 controls the overall operation of the controller 3 in accordance with a program stored in the ROM 12. For example, the microprocessor 6 reads a command set defining various processes from the ROM 12, supplies the command set to the flash memory interface block 10, and causes the flash memory interface block 10 to execute processes.
The microprocessor 6 includes, for example, a shift register and a flag register, and the flag register sets a carry flag when a carry is generated by the operation of the shift register.

ホストインターフェースブロック7は、ホストシステム4との間の、データ、アドレス情報、ステータス情報、外部コマンド等の授受を行なう。ホストシステム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. 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.

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

バッファ9は、フラッシュメモリ2から読み出されたデータ及びフラッシュメモリ2に書き込むべきデータを一時的に蓄積する。すなわち、フラッシュメモリ2から読み出されたデータは、ホストシステム4が受け取り可能な状態となるまでバッファ9に保持され、フラッシュメモリ2に書き込むべきデータは、フラッシュメモリ2が書き込み可能な状態となるまでバッファ9に保持される。   The buffer 9 temporarily stores data read from the flash memory 2 and data to be written to the flash memory 2. That is, data read from the flash memory 2 is held in the buffer 9 until the host system 4 can receive the data, and data to be written to the flash memory 2 is stored until the flash memory 2 becomes writable. It is held in the buffer 9.

フラッシュメモリインターフェースブロック10は、内部バス14を介して、フラッシュメモリ2とデータ、アドレス情報、ステータス情報、内部コマンド等の授受を行う。より詳細には、フラッシュメモリインターフェースブロック10は、アドレス処理部、コマンドレジスタ、命令処理ブロック等から構成される。   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. More specifically, the flash memory interface block 10 includes an address processing unit, a command register, an instruction processing block, and the like.

フラッシュメモリインターフェースブロック10は、命令処理ブロックによって出力される内部コマンド、アドレス情報等をフラッシュメモリ2に供給することにより、フラッシュメモリ2に読み出し、書き込み等を実行させる。   The flash memory interface block 10 supplies the flash memory 2 with internal commands, address information, and the like output from the instruction processing block, thereby causing the flash memory 2 to execute reading and writing.

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

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

上述のアドレス変換テーブルの一例を図3に示す。このアドレス変換テーブル100は、論理ゾーンに含まれる論理ブロックと物理ゾーンに含まれる物理ブロックとの対応関係を、
論理ゾーン内ブロック番号LZIBNと物理ゾーン内ブロック番号PZIBNとを用いて示している。ここで、物理ゾーン内ブロック番号PZIBNは、各物理ゾーンに含まれる物理ブロックにつけられた、各物理ゾーン内での通番である。
An example of the above-described address conversion table is shown in FIG. This address conversion table 100 shows the correspondence between the logical blocks included in the logical zone and the physical blocks included in the physical zone.
The block number LZIBN in the logical zone and the block number PZIBN in the physical zone are used. Here, the intra-physical zone block number PZIBN is a serial number in each physical zone assigned to a physical block included in each physical zone.

アドレス変換テーブル100は、起動時に作成する場合や、アドレス変換テーブル100が未作成の論理ゾーンに対してアクセスがあったときに、その論理ゾーンについて作成する場合がある。なお、このアドレス変換テーブル100は、ワークエリア8に作成される。   The address translation table 100 may be created at the time of startup, or may be created for a logical zone when the address translation table 100 is accessed for an uncreated logical zone. The address conversion table 100 is created in the work area 8.

又、本実施の形態のフラッシュメモリシステム1では、論理ゾーンを1000個の論理ブロックで構成し、物理ゾーンを1024個の物理ブロックで構成するようにしたので、図3に示したアドレス変換テーブル100では、LZIBN#0〜#999の論理ブロックとPZIBN#0〜#1023の物理ブロックの対応関係が示されている。例えば、LZIBN#0の論理ブロックに対応するデータはPZIBN#35の物理ブロックに、LZIBN#1の論理ブロックに対応するデータはPZIBN#10の物理ブロックに、LZIBN#2の論理ブロックに対応するデータはPZIBN#15の物理ブロックに記憶されている。又、LZIBN#13の論理ブロックに対応するデータは記憶されていない。   Further, in the flash memory system 1 of the present embodiment, the logical zone is composed of 1000 logical blocks and the physical zone is composed of 1024 physical blocks, so the address conversion table 100 shown in FIG. 4 shows the correspondence between the logical blocks of LZIBN # 0 to # 999 and the physical blocks of PZIBN # 0 to # 1023. For example, the data corresponding to the logical block of LZIBN # 0 is the physical block of PZIBN # 35, the data corresponding to the logical block of LZIBN # 1 is the physical block of PZIBN # 10, and the data corresponds to the logical block of LZIBN # 2. Is stored in the physical block of PZIBN # 15. Data corresponding to the logical block of LZIBN # 13 is not stored.

又、本実施の形態のフラッシュメモリシステム1では、上記アドレス変換テーブル100と共に、図4に示したような空きブロック検索テーブル200が作成される。この空きブロック検索テーブル200は、データの書き込み先となる空きブロックを検索するときに使用される。つまり、データの書き換え等で新規なデータを書き込むときには、この空きブロック検索テーブル200を用いて検出された空きブロックにデータが書き込まれる。   Further, in the flash memory system 1 of the present embodiment, an empty block search table 200 as shown in FIG. 4 is created together with the address conversion table 100. This free block search table 200 is used when searching for a free block as a data write destination. That is, when new data is written by data rewriting or the like, data is written in the empty block detected using this empty block search table 200.

この空きブロック検索テーブル200は、物理ゾーンに含まれる物理ブロックの使用状況を示すテーブルであり、ワークエリア8上に物理ゾーン毎に作成される。物理ゾーンに含まれる1024個の物理ブロックは、それぞれ空きブロック検索テーブル200上の1個のビットに割り当てられ、各ビットの論理値(“0”又は“1”)によって、そのビットに対応する物理ブロックが空きブロックであるか否かを示している。 図4に示した空きブロック検索テーブル200では、物理ブロックが使用されている場合又は不良ブロックである場合を論理値の“0”で示し、物理ブロックが空きブロックである(書き込み可能である)場合を論理値の“1”で示している。又、空きブロック検索テーブル200では、上のビット列(行)から下のビット列(行)へ、各ビット列(各行)の8ビットについては下位側(右側)から上位側(左側)へPZIBNの順番で各物理ブロックが割り当てられている。   This free block search table 200 is a table showing the usage status of physical blocks included in the physical zone, and is created on the work area 8 for each physical zone. Each of the 1024 physical blocks included in the physical zone is assigned to one bit on the empty block search table 200, and the physical value corresponding to the bit is determined by the logical value (“0” or “1”) of each bit. Indicates whether the block is an empty block. In the free block search table 200 shown in FIG. 4, the case where a physical block is used or a bad block is indicated by a logical value “0”, and the physical block is a free block (writable). Is represented by a logical value “1”. In the empty block search table 200, the upper bit string (row) is changed to the lower bit string (row), and the 8 bits of each bit string (each row) are assigned in the order of PZIBN from the lower side (right side) to the upper side (left side). Each physical block is allocated.

次に、アドレス変換テーブル100と空きブロック検索テーブル200との作成処理について説明する。   Next, a process for creating the address conversion table 100 and the empty block search table 200 will be described.

この作成処理では、マイクロプロセッサ6は、ワークエリア8にアドレス変換テーブル100を作成するための領域と空きブロック検索テーブル200を作成するための領域を確保する。アドレス変換テーブル100を作成するための領域については、LZIBN#0〜#999のそれぞれに対応するPZIBNを書き込むための領域を確保する。空きブロック検索テーブル200を作成するための領域については、PZIBN#0〜#1023の物理ブロックに対応する128バイト(1024ビット)の領域を確保する。更に、この空きブロック検索テーブル200を作成するための領域の全てのビットを論理値“0”に初期設定する。又、空きブロック検索テーブル200を作成するときは、空きブロック検索テーブル200を用いて空きブロックを検索するときに、走査を開始するビットを示す情報を設定しておくポインタ領域も確保し、このポインタ領域をクリア状態(走査を開始するビットを示す情報が設定されていない状態)に初期設定する。   In this creation process, the microprocessor 6 secures an area for creating the address conversion table 100 and an area for creating the free block search table 200 in the work area 8. Regarding the area for creating the address conversion table 100, an area for writing PZIBN corresponding to each of LZIBN # 0 to # 999 is secured. As an area for creating the free block search table 200, an area of 128 bytes (1024 bits) corresponding to the physical blocks of PZIBN # 0 to # 1023 is secured. Further, all bits in the area for creating this empty block search table 200 are initialized to a logical value “0”. When the empty block search table 200 is created, a pointer area for setting information indicating a bit to start scanning is secured when searching for an empty block using the empty block search table 200. The area is initialized to a clear state (a state in which information indicating a bit for starting scanning is not set).

続いて、マイクロプロセッサ6は、PZIBN#0〜#1023の物理ブロックの冗長領域26に書き込まれている論理アドレス情報(LZIBN)とブロックステータスとを順次読み出し、論理アドレス情報(LZIBN)が書き込まれている場合には、アドレス変換テーブル100を作成するための領域の、そのLZIBNに対応する箇所に、そのLZIBNが書き込まれていた物理ブロックのPZIBNを書き込む。一方、論理アドレス情報(LZIBN)が書き込まれていない場合は、ブロックステータスに基づいてその物理ブロックが不良ブロックであるか否かを判別する。その結果、不良ブロックでないと判別した場合は、空きブロック検索テーブル200を作成するための領域の、その物理ブロックのPZIBNに対応するビットの論理値を“1”に変更する。   Subsequently, the microprocessor 6 sequentially reads the logical address information (LZIBN) and the block status written in the redundant areas 26 of the physical blocks PZIBN # 0 to # 1023, and the logical address information (LZIBN) is written. If there is, the PZIBN of the physical block in which the LZIBN has been written is written in a location corresponding to the LZIBN in the area for creating the address conversion table 100. On the other hand, when the logical address information (LZIBN) is not written, it is determined whether or not the physical block is a bad block based on the block status. As a result, when it is determined that the block is not a bad block, the logical value of the bit corresponding to PZIBN of the physical block in the area for creating the empty block search table 200 is changed to “1”.

ここで、空きブロック検索テーブル200の作成処理について、図5に示したフローチャートを参照して、詳細に説明する。このフローチャートでは、他のテーブル(アドレス変換テーブル100等)の作成処理を省略している。   Here, the process of creating the empty block search table 200 will be described in detail with reference to the flowchart shown in FIG. In this flowchart, processing for creating other tables (such as the address conversion table 100) is omitted.

最初に、マイクロプロセッサ6は、この空きブロック検索テーブル200の作成処理で、参照中の物理ブロックのPZIBN#n(#nは#0〜#1023)を設定する領域(以下、この領域を参照物理ブロック設定領域という。)をワークエリア8に確保し、この参照物理ブロック設定領域に“0”を設定(n=0)する(ステップS1)。   First, the microprocessor 6 creates an area for setting PZIBN #n (#n is # 0 to # 1023) of the physical block being referred to in the creation process of the empty block search table 200 (hereinafter, this area is referred to as the physical reference). Block setting area) is secured in the work area 8, and "0" is set (n = 0) in this reference physical block setting area (step S1).

続いて、マイクロプロセッサ6は、参照物理ブロック設定領域に設定されているPZIBNの物理ブロック(PZIBN#nの物理ブロック)の冗長領域26の論理アドレス情報が書き込まれる領域を参照し、その領域に論理アドレス情報が記憶されているか否かを判別する(ステップS2)。論理アドレス情報が記憶されている場合は、その物理ブロックが使用されていると判別し、ステップS4に進む(ステップS2;Yes)。論理アドレス情報が記憶されていない場合は、その物理ブロックが使用されていないと判別し、ステップS3に進む(ステップS2;No)。   Subsequently, the microprocessor 6 refers to the area in which the logical address information of the redundant area 26 of the PZIBN physical block (PZIBN # n physical block) set in the reference physical block setting area is written, and stores the logical address in that area. It is determined whether or not address information is stored (step S2). When the logical address information is stored, it is determined that the physical block is used, and the process proceeds to step S4 (step S2; Yes). If the logical address information is not stored, it is determined that the physical block is not used, and the process proceeds to step S3 (step S2; No).

物理ブロックの冗長領域26に論理アドレス情報が記憶されていない場合(ステップS2;No)、続いて、マイクロプロセッサ6は、その物理ブロックの冗長領域26に記憶されているブロックステータスを参照し、その物理ブロックが不良ブロックであるか否かを判別する(ステップS3)。その物理ブロックが不良ブロックであると判別した場合は、ステップS4に進み(ステップS3;Yes)、その物理ブロックが不良ブロックでないと判別した場合は、ステップS5に進む(ステップS3;No)。   When the logical address information is not stored in the redundant area 26 of the physical block (step S2; No), the microprocessor 6 refers to the block status stored in the redundant area 26 of the physical block, and It is determined whether or not the physical block is a bad block (step S3). If it is determined that the physical block is a defective block, the process proceeds to step S4 (step S3; Yes), and if it is determined that the physical block is not a defective block, the process proceeds to step S5 (step S3; No).

物理ブロックの冗長領域26に論理アドレス情報が記憶されている場合(ステップS2;Yes)又はブロックステータスが不良ブロックであることを示している場合(ステップS3;Yes)、マイクロプロセッサ6は、空きブロック検索テーブル200の、その物理ブロック(参照中の物理ブロック)に対応するビットに“0”を設定する(ステップS4)。ここで、対応するビットは、参照物理ブロック設定領域に設定されているn(10ビットの値)を、ビット列に含まれるビットの数である8で割ったときの商(nの上位7ビットの値に対応する)と余り(nの下位3ビットの値に対応する)に基づいて特定することができる。例えば、商がlで、余りがmの場合は、空きブロック検索テーブル200の上からl+1番目のビット列の下位からm+1ビット目のビットが、参照中の物理ブロックに対応するビットになる。   When logical address information is stored in the redundant area 26 of the physical block (step S2; Yes) or when the block status indicates a bad block (step S3; Yes), the microprocessor 6 “0” is set to the bit corresponding to the physical block (physical block being referred to) in the search table 200 (step S4). Here, the corresponding bit is the quotient (the upper 7 bits of n) when n (10-bit value) set in the reference physical block setting area is divided by 8 which is the number of bits included in the bit string. It corresponds to the value) and the remainder (corresponding to the value of the lower 3 bits of n). For example, when the quotient is l and the remainder is m, the bit of the (m + 1) th bit from the lower order of the l + 1th bit string from the top of the empty block search table 200 becomes the bit corresponding to the physical block being referred to.

物理ブロックの冗長領域26に論理アドレス情報が記憶されておらず(ステップS2;No)、ブロックステータスが不良ブロックであることを示していない場合(ステップS3;No)、つまり、その物理ブロック(参照中の物理ブロック)が空きブロックであると判別された場合、マイクロプロセッサ6は、空きブロック検索テーブル200の、その物理ブロック(参照中の物理ブロック)に対応するビットに“1”を設定する(ステップS5)。   When the logical address information is not stored in the redundant area 26 of the physical block (step S2; No) and the block status does not indicate that it is a bad block (step S3; No), that is, the physical block (reference) When it is determined that the (internal physical block) is an empty block, the microprocessor 6 sets “1” in the bit corresponding to the physical block (the physical block being referred to) in the empty block search table 200 ( Step S5).

尚、ステップS4又はステップS5の処理の後にステップS6に進むが、空きブロック検索テーブル200を作成するための領域を最初に論理値“0”に初期設定しておけば、ステップS4の処理を行わずにステップS6に進むことができる。   The process proceeds to step S6 after the process of step S4 or step S5, but if the area for creating the empty block search table 200 is initially set to the logical value “0”, the process of step S4 is performed. Without proceeding to step S6.

ステップS4又はステップS5の処理が終了することにより、参照中の物理ブロックに対応するビットの設定が終了するので、マイクロプロセッサ6は、参照物理ブロック設定領域に設定されているnの値を1増加させ(ステップS6)、ステップS7に進む。   Since the setting of the bit corresponding to the physical block being referred to is completed when the processing of step S4 or step S5 is completed, the microprocessor 6 increases the value of n set in the reference physical block setting area by one. (Step S6), the process proceeds to Step S7.

マイクロプロセッサ6は、参照物理ブロック設定領域に設定されているnの値、つまり、ステップS6で1増加させたnの値が、物理ゾーンに含まれる物理ブロックの数を超えているか否かを判別する。つまり、nの値が1023を越えているか否かを判別する(ステップS7)。nの値が1023以下の場合は、ステップS2に進み(ステップS7;Yes)、nの値が1023を越えている場合は空きブロック検索テーブル200の作成処理は終了する(ステップS7;No)。   The microprocessor 6 determines whether or not the value of n set in the reference physical block setting area, that is, the value of n increased by 1 in step S6 exceeds the number of physical blocks included in the physical zone. To do. That is, it is determined whether or not the value of n exceeds 1023 (step S7). When the value of n is 1023 or less, the process proceeds to step S2 (step S7; Yes), and when the value of n exceeds 1023, the creation process of the empty block search table 200 ends (step S7; No).

次に、空きブロック検索テーブル200を用いた空きブロック検索の処理について、図6〜図8のフローチャートを参照して説明する。   Next, the empty block search process using the empty block search table 200 will be described with reference to the flowcharts of FIGS.

空きブロック検索を開始するときは、ワークエリア8に設けられたポインタ領域が参照され、マイクロプロセッサ6は、ポインタ領域に設定されている値に対応する空きブロック検索テーブル200上のビットの次のビットから使用状況(論理値の“0”又な“1”で示された情報)の走査を開始する。ここで、空きブロック検索が2回目以降であれば、ポインタ領域には、前回の空きブロック検索で検出された空きブロックのPZIBNの値が設定されているが、最初の空きブロック検索の場合には、ポインタ領域に値が設定されていない。従って、本発明に係るフラッシュメモリシステムでは、このような場合に、検出した空きブロックに書き込む新データと対応関係にある旧データが記憶されている物理ブロックの次の物理ブロックに対応するビットからの走査を開始するように構成されている。つまり、新データに書き換えられる旧データが格納されている物理ブロックの次の物理ブロックに対応するビットから走査が開始され、検出された空きブロックには書き換え後のデータである新データが書き込まれる。   When starting the free block search, the pointer area provided in the work area 8 is referred to, and the microprocessor 6 reads the bit next to the bit on the free block search table 200 corresponding to the value set in the pointer area. From this point, scanning of the usage status (information indicated by logical values “0” or “1”) is started. Here, if the empty block search is performed for the second time or later, the PZIBN value of the empty block detected in the previous empty block search is set in the pointer area, but in the case of the first empty block search, No value is set in the pointer area. Therefore, in the flash memory system according to the present invention, in such a case, from the bit corresponding to the physical block next to the physical block in which the old data having a correspondence relationship with the new data to be written to the detected empty block is stored. It is configured to start scanning. In other words, scanning is started from the bit corresponding to the physical block next to the physical block in which the old data to be rewritten with new data is stored, and new data which is data after rewriting is written in the detected empty block.

例えば、LZN#3に含まれるLZIBN#5の論理ブロックに対する書き込み処理が、ホストシステム4から与えられ、このアクセス要求を契機にPZN#3の空きブロック検索テーブル200作成された場合について具体的に説明する。この場合には、LZIBN#5の論理ブロックに対応する物理ブロックのPZIBNを、アドレス変換テーブル100を参照して求める。LZIBN#5の論理ブロックがPZIBN#11の物理ブロックに対応する場合には、PZIBN#12の物理ブロックに対応するビットから走査を開始する。   For example, a specific description will be given of a case where a write process to a logical block of LZIBN # 5 included in LZN # 3 is given from the host system 4 and the free block search table 200 of PZN # 3 is created in response to this access request To do. In this case, the PZIBN of the physical block corresponding to the logical block of LZIBN # 5 is obtained with reference to the address conversion table 100. When the logical block of LZIBN # 5 corresponds to the physical block of PZIBN # 11, scanning is started from the bit corresponding to the physical block of PZIBN # 12.

空きブロック検索テーブル200上の空きブロックに対応するビットを検出する走査は、例えば、8ビットのシフトレジスタ(図示せず)を用いることにより行うことができる。このシフトレジスタを用いた走査では、ポインタ領域に設定されている値に対応するビットの次のビットが含まれるビット列から順番に、ビット列が参照され、その値が0(二進数表記;000 0000)でない場合に、そのビット列の値がシフトレジスタに書き込まれる。尚、走査を開始するビットがビット列の最下位ビットでない場合には、走査を開始するビットより下位側のビットが全て“0”になるようなマスク処理が施される。例えば、走査を開始するビットがビット列の下位から5ビット目のときは、そのビット列の下位から数えて4ビット目から1ビット目までのビットが“0”になるようなマスク処理が施される。つまり、このマスク処理では、走査を開始するビットより下位側のビットが“0”で、それ以外のビットが“1”のマスクデータでAND演算を実行する。   The scan for detecting the bit corresponding to the empty block on the empty block search table 200 can be performed by using, for example, an 8-bit shift register (not shown). In the scan using this shift register, the bit string is referred to in order from the bit string including the next bit of the bit corresponding to the value set in the pointer area, and the value is 0 (binary notation; 000 0000) Otherwise, the value of the bit string is written into the shift register. If the bit for starting scanning is not the least significant bit of the bit string, mask processing is performed so that all the bits on the lower side of the bit for starting scanning become “0”. For example, when the bit to start scanning is the fifth bit from the lower order of the bit string, a mask process is performed so that the bits from the fourth bit to the first bit from the lower order of the bit string become “0”. . In other words, in this mask processing, an AND operation is executed with mask data in which the lower bits from the bit to start scanning are “0” and the other bits are “1”.

続いて、シフトレジスタに設定されたビット列を下位方向にシフトさせ、何回のシフトでキャリーが立ったかで、下位から何ビット目のビットが空きブロックに対応するビットであるかを判別する。つまり、以上の処理により、空きブロックに対応するビットが、何番目のビット列であるかと、そのビット列の下位から何ビット目のビットであるかが判別される。このようにして空きブロックに対応するビットを判別した後に、このビットに割り当てられている物理ブロックのPZIBNが求められる。ここで、ビット列に含まれるビットの数がkで、a番目のビット列の下位からbビット目のビットが空きブロックに対応するビットである場合、そのビットに対応する物理ブロックのPZIBNはk×(a−1)+(b−1)で求められる。又、このようにして求めたPZIBNの値がポインタ領域に設定される。   Subsequently, the bit string set in the shift register is shifted in the lower direction, and it is determined how many bits from the lower order correspond to the empty block by the number of shifts. That is, by the above processing, it is determined which bit sequence the bit corresponding to the empty block is and what bit is the lower bit of the bit sequence. After determining the bit corresponding to the empty block in this way, the PZIBN of the physical block assigned to this bit is obtained. Here, when the number of bits included in the bit string is k and the bit from the lower bit of the a-th bit string is a bit corresponding to an empty block, the PZIBN of the physical block corresponding to that bit is k × ( a-1) + (b-1). Further, the value of PZIBN obtained in this way is set in the pointer area.

まず、マイクロプロセッサ6は、ポインタ領域を参照し(ステップS102)、前回の空きブロック検索で検出された空きブロックのPZIBNの値(以下、ポインタ領域に設定されているPZIBNの値をpbという。)が設定されている場合は、ステップS103に進み(ステップS102;Yes)、PZIBNの値が設定されていない場合は、ステップS108に進む(ステップS102;No)。ここで、ポインタ領域には、pbが設定されているか否かを示すためのビット(フラグビット)が設けられており、このフラグビットの情報に基づいてpbが設定されているか否かが判断される。従って、ポインタ領域に最初にPZIBNの値を書き込むときに、このフラグビットが示す情報が、pbが設定されていることを示す情報に変更される。   First, the microprocessor 6 refers to the pointer area (step S102), and the PZIBN value of the empty block detected in the previous empty block search (hereinafter, the PZIBN value set in the pointer area is referred to as pb). Is set (step S102; Yes), and if the value of PZIBN is not set, the process proceeds to step S108 (No). Here, the pointer area is provided with a bit (flag bit) for indicating whether or not pb is set, and it is determined whether or not pb is set based on the information of the flag bit. The Therefore, when the value of PZIBN is first written in the pointer area, the information indicated by this flag bit is changed to information indicating that pb is set.

ポインタ領域にpbが設定されている場合は(ステップS102;Yes)、マイクロプロセッサ6は、走査を開始する物理ブロックのPZIBNを設定するスタートポインタ領域(以下、スタートポインタ領域に設定されている値をjという。)に、pb+1の値を書き込む(ステップS103)。尚、スタートポインタ領域には、pb+1の下位10ビットだけを設定する。従って、pbが1023(二進数表記;11 1111 1111)の場合、jは0(二進数表記;00 0000 0000)になる。   If pb is set in the pointer area (step S102; Yes), the microprocessor 6 sets a start pointer area (hereinafter, a value set in the start pointer area) for setting the PZIBN of the physical block from which scanning is started. j)), the value of pb + 1 is written (step S103). In the start pointer area, only the lower 10 bits of pb + 1 are set. Therefore, when pb is 1023 (binary notation; 11 1111 1111), j is 0 (binary notation; 00 0000 0000).

ポインタ領域にpbが設定されていない場合は(ステップS102;No)、アクセス対象指示領域に設定されているLZIBNの値が参照され(ステップS108)、このLZIBNの値に対応するPZIBNが存在する場合は、ステップS112に進み(ステップS108;Yes)、このLZIBNに対応するPZIBNが存在しない場合は、ステップS109に進む(ステップS108;No)。   When pb is not set in the pointer area (step S102; No), the LZIBN value set in the access target instruction area is referred to (step S108), and there is a PZIBN corresponding to the LZIBN value. Proceeds to step S112 (step S108; Yes), and if there is no PZIBN corresponding to this LZIBN, proceeds to step S109 (step S108; No).

アクセス対象指示領域に設定されているLZIBNに対応するPZIBNが存在する場合は(ステップS108;Yes)、スタートポインタ領域にそのPZIBNに1を加算した値を書き込む(ステップS112)。つまり、jの値としてアクセス対象指示領域に設定されているLZIBNに対応するPZIBNに1を加算した値が設定される。尚、上記と同様にアクセス対象指示領域に設定されているLZIBNに対応するPZIBNの値が1023(二進数表記;11 1111 1111)の場合、jは0(二進数表記;00 0000 0000)になる。   If there is a PZIBN corresponding to the LZIBN set in the access target instruction area (step S108; Yes), a value obtained by adding 1 to the PZIBN is written in the start pointer area (step S112). That is, a value obtained by adding 1 to PZIBN corresponding to LZIBN set in the access target instruction area is set as the value of j. Similarly to the above, when the value of PZIBN corresponding to LZIBN set in the access target instruction area is 1023 (binary notation; 11 1111 1111), j is 0 (binary notation; 00 0000 0000). .

アクセス対象指示領域に設定されているLZIBNに対応するPZIBNが存在しない場合は(ステップS108;No)、スタートポインタ領域に0を書き込む(ステップS109)。つまり、jの値として0が設定される。   If there is no PZIBN corresponding to LZIBN set in the access target instruction area (step S108; No), 0 is written in the start pointer area (step S109). That is, 0 is set as the value of j.

尚、説明を簡略化するため、アクセス対象指示領域に設定されているLZIBNに対応するPZIBNが存在しない場合は、スタートポインタ領域に0を設定するようにしたが、アクセス対象指示領域に設定されているLZIBNを1ずつ減算していき、減算されたLZIBNに対応するPZIBNがあったときに、そのPZIBNをアクセス対象指示領域に設定するようにしてもよい。例えば、1回減算したLZIBNに対応するPZIBNがなく、2回減算したLZIBNに対応するPZIBNがなく、3回減算したLZIBNに対応するPZIBNがあった場合は、3回減算したLZIBNに対応するPZIBNに1を加算した値をスタートポインタ領域に設定する。又、このように順次LZIBNを1ずつ減算していき、LZIBNが0になっても対応するPZIBNが見つからなかった場合は、スタートポインタ領域に0を設定する。   To simplify the explanation, when there is no PZIBN corresponding to the LZIBN set in the access target instruction area, 0 is set in the start pointer area, but the PZIBN is set in the access target instruction area. The LZIBN may be subtracted one by one, and when there is a PZIBN corresponding to the subtracted LZIBN, the PZIBN may be set as the access target instruction area. For example, if there is no PZIBN corresponding to LZIBN subtracted once, there is no PZIBN corresponding to LZIBN subtracted twice, and there is PZIBN corresponding to LZIBN subtracted three times, PZIBN corresponding to LZIBN subtracted three times A value obtained by adding 1 to is set in the start pointer area. In addition, LZIBN is sequentially subtracted by 1 in this way, and if the corresponding PZIBN is not found even when LZIBN becomes 0, 0 is set in the start pointer area.

ステップS103、ステップS109又はステップS112でスタートポインタ領域に空きブロック検索を開始する物理ブロックのPZIBNの値を設定した後にステップS115に進み、検索対象のビット列とそのビット列でマスクされるビット数を指定する情報を設定する。   In step S103, step S109, or step S112, the PZIBN value of the physical block for starting the empty block search is set in the start pointer area, and then the process proceeds to step S115 to specify the bit string to be searched and the number of bits masked by the bit string. Set the information.

図4に示した空きブロック検索テーブル200で、各ビット列は8ビットなので、j(10ビットの値)の上位7ビットの値を、ビット列を指定するビット列指定領域に書き込み、j(10ビットの値)の下位3ビットの値を、マスクされるビット数を指定するマスク情報領域に書き込む(ステップS115)。以下の説明では、ビット列指定領域に設定されている値をp、マスク情報領域に書き込まれる値をqとする。ここで、スタートポインタ領域に設定されている値jを各ビット列に含まれるビットの数で割ったときの商がj(10ビットの値)の上位7ビットの値に対応し、余りがj(10ビットの値)の下位3ビットの値に対応する。又、(p+1)番目のビット列の下位から(q+1)ビット目のビットが走査を開始するビットに対応する。   Since each bit string is 8 bits in the free block search table 200 shown in FIG. 4, the value of the upper 7 bits of j (10-bit value) is written to the bit string designating area for designating the bit string, and j (10-bit value) ) Is written in the mask information area for designating the number of bits to be masked (step S115). In the following description, it is assumed that a value set in the bit string designation area is p and a value written in the mask information area is q. Here, the quotient obtained by dividing the value j set in the start pointer area by the number of bits included in each bit string corresponds to the value of the upper 7 bits of j (10-bit value), and the remainder is j ( Corresponds to the value of the lower 3 bits of the 10-bit value). Further, the (q + 1) -th bit from the lower order of the (p + 1) -th bit string corresponds to a bit for starting scanning.

続いて、(p+1)番目のビット列の下位qビットにマスク処理を施し、マスク処理が施されたビット列のデータが0(二進数表記;0000 0000)の場合はステップS121に進み(ステップS120;Yes)、マスク処理が施されたビット列のデータが0(二進数表記;0000 0000)でない場合はステップS124に進む(ステップS120;No)。尚、q=0の場合はマスク処理が施されないため、そのままのビット列のデータが0であるか否かが判別される。   Subsequently, the lower q bits of the (p + 1) th bit string are masked. If the bit string data subjected to the mask process is 0 (binary notation; 0000 0000), the process proceeds to step S121 (step S120; Yes). ) If the bit string data subjected to the mask processing is not 0 (binary notation; 0000 0000), the process proceeds to step S124 (No in step S120). Note that when q = 0, mask processing is not performed, so it is determined whether or not the data of the bit string is 0 as it is.

マスク処理が施されたビット列のデータ又はそのままのビット列のデータが0である場合は(ステップS120;Yes)、ビット列指定領域に設定されている値に1を加算し、マスク情報領域に設定されている値を0に変更し、ステップS120に進む(ステップS121)。ここで、ビット列指定領域に設定されている値pは7ビットの値なので、ビット列指定領域に設定されている値が127(二進数表記;111 1111)の場合、加算した値の下位7ビットに対応する0(二進数表記;000 0000)をビット列指定領域に書き込む。尚、ステップS121の後にステップS120に進んだ場合は、q=0なのでマスク処理を行わずに、(p+1)番目(pは新たにビット列指定領域に設定された値)のビット列のデータが0であるか否かを判別する。   When the bit string data subjected to the mask processing or the bit string data as it is is 0 (step S120; Yes), 1 is added to the value set in the bit string designation area, and the mask information area is set. Is changed to 0, and the process proceeds to step S120 (step S121). Here, since the value p set in the bit string designation area is a 7-bit value, when the value set in the bit string designation area is 127 (binary notation; 111 1111), the lower 7 bits of the added value are Corresponding 0 (binary notation; 000 0000) is written in the bit string designation area. When the process proceeds to step S120 after step S121, since q = 0, the mask process is not performed and the data of the (p + 1) th bit string (p is a value newly set in the bit string designation area) is 0. It is determined whether or not there is.

マスク処理が施されたビット列のデータ又はそのままのビット列のデータが0でない場合は(ステップS120;No)、そのビット列のデータをシフトレジスタに書き込み、ステップS125に進む(ステップS124)。   If the bit string data subjected to the mask processing or the bit string data as it is is not 0 (step S120; No), the bit string data is written to the shift register, and the process proceeds to step S125 (step S124).

シフトレジスタに書き込まれているビット列のデータを、キャリーフラグが立つまで下位(右)方向にシフトさせ、キャリーフラグが立つまでのシフト回数をカウントする(ステップS125)。   The bit string data written in the shift register is shifted in the lower (right) direction until the carry flag is set, and the number of shifts until the carry flag is set is counted (step S125).

続いて、ビット列指定領域に設定されている値p(7ビット)の下位側に、キャリーフラグが立つまでのシフト回数から1を減算した値k(3ビット)を付加した10ビットの値をポインタ領域に書き込む(ステップS128)。ポインタ領域に書き込まれた10ビットの値が検出された空きブロックのPZIBNに対応する。   Subsequently, a 10-bit value obtained by adding a value k (3 bits) obtained by subtracting 1 from the number of shifts until the carry flag is set to the lower side of the value p (7 bits) set in the bit string specifying area is a pointer. Write in the area (step S128). The 10-bit value written in the pointer area corresponds to the detected empty block PZIBN.

次に、図9のフローチャートにしたがって、フラッシュメモリ2にデータを書き込む際に行われる処理について説明する。なお、フラッシュメモリ2にデータを書き込む処理自体は、従来と同様なので、特に、空きブロック検索テーブル200の内容を変更する処理について説明する。   Next, processing performed when data is written to the flash memory 2 will be described with reference to the flowchart of FIG. Note that the process of writing data to the flash memory 2 itself is the same as the conventional process, and therefore the process of changing the contents of the empty block search table 200 will be described in particular.

マイクロプロセッサ6は、空きブロックを検索し、空きブロックのPZIBNを取得し(ステップS201)、取得したPZIBNに基づいて、この空きブロックのPBAを求める。   The microprocessor 6 searches for a free block, acquires the PZIBN of the free block (step S201), and obtains the PBA of this free block based on the acquired PZIBN.

続いて、マイクロプロセッサ6は、ステップS201で検出された空きブロックのPBAを含むアドレス情報と、ROM12から読み出したコマンドセット等をフラッシュメモリインターフェースブロック10に供給する。フラッシュメモリインターフェースブロック10は、与えられたアドレス情報とコマンドセット等に従ってステップS201で検出された空きブロックにデータを書き込む処理を実行する(ステップS202)。   Subsequently, the microprocessor 6 supplies the flash memory interface block 10 with address information including the PBA of the empty block detected in step S201, a command set read from the ROM 12, and the like. The flash memory interface block 10 executes a process of writing data to the empty block detected in step S201 according to the given address information and command set (step S202).

空きブロックにデータが書き込まれると、マイクロプロセッサ6は、この空きブロックのPZIBNに対応する空きブロック検索テーブル200のビットを“0”に書き換えて(ステップS203)、処理を終了する。   When data is written in the empty block, the microprocessor 6 rewrites the bit of the empty block search table 200 corresponding to PZIBN of this empty block to “0” (step S203), and ends the process.

次に、図10のフローチャートにしたがって、フラッシュメモリ2からデータを消去する際に行われる処理について説明する。なお、フラッシュメモリ2からデータを消去する処理自体は、従来と同様なので、特に、空きブロック検索テーブル200の内容を変更する処理について説明する。   Next, processing performed when data is erased from the flash memory 2 will be described with reference to the flowchart of FIG. Since the process itself for erasing data from the flash memory 2 is the same as the conventional process, the process for changing the contents of the empty block search table 200 will be described in particular.

消去処理は、例えば、書き換えデータが空きブロックに書き込まれ、旧データが不要になったときに行われる。このような場合、書き換えデータが空きブロックに書き込まれた後に、旧データが記憶されていた物理ブロックの消去処理が行われ、続いてアドレス変換テーブルのこの書き換え係る箇所のPZIBNが、旧データが記憶されていた物理ブロックのPZIBNから書き換え後の新データが記憶されている物理ブロックのPZIBNに変更される。   The erasing process is performed, for example, when rewritten data is written in an empty block and old data becomes unnecessary. In such a case, after the rewrite data is written in the empty block, the physical block in which the old data is stored is erased, and then the PZIBN in the rewrite-related portion of the address translation table is stored in the old data. The PZIBN of the physical block that has been changed is changed to PZIBN of the physical block in which the new data after rewriting is stored.

旧データが記憶されている物理ブロックのデータを消去する場合は、まず、アドレス変換テーブルに用いて旧データが記憶されている物理ブロックのPBIZNを取得し、更に、取得したPBIZNに基づいて、旧データが記憶されている物理ブロックのPBAを求める(ステップS301)。   When erasing data of a physical block in which old data is stored, first, the PBIZN of the physical block in which the old data is stored is obtained using the address conversion table, and further, the old data is obtained based on the acquired PBIZN. The PBA of the physical block storing the data is obtained (step S301).

続いて、マイクロプロセッサ6は、旧データが記憶されている物理ブロックのPBAと、ROM12から読み出したコマンドセット等をフラッシュメモリインターフェースブロック10に供給する。フラッシュメモリインターフェースブロック10は、与えられたPBAとコマンドセット等に従って旧データが記憶されている物理ブロックの記憶データを消去する(ステップS302)。   Subsequently, the microprocessor 6 supplies the PBA of the physical block in which the old data is stored, the command set read from the ROM 12 and the like to the flash memory interface block 10. The flash memory interface block 10 erases the stored data of the physical block in which the old data is stored in accordance with the given PBA and command set (step S302).

ステップS302の消去処理が終了した後に、フラッシュメモリ2から処理ステータスを読み出し、処理ステータス(処理が正常に終了したか否かの情報を含むステータス)に基づいて旧データが記憶されていた物理ブロックが不良ブロックか否かを判断する(ステップS303)。   After the erasure process in step S302 is completed, the process status is read from the flash memory 2, and the physical block in which the old data is stored based on the process status (status including information indicating whether the process has been completed normally) It is determined whether or not the block is a bad block (step S303).

旧データが記憶されていた物理ブロックが不良ブロックでないと判断した場合は(ステップS303;No)、この物理ブロックに対応する空きブロック検索テーブル200上のビットを“1”に書き換える(ステップS304)。   When it is determined that the physical block in which the old data is stored is not a bad block (step S303; No), the bit on the empty block search table 200 corresponding to this physical block is rewritten to “1” (step S304).

旧データが記憶されていた物理ブロックが不良ブロックであると判断した場合は(ステップS303;Yes)、空きブロック検索テーブル200の更新は行わず処理を終了する。尚、旧データが記憶されていた物理ブロックの冗長領域26には、不良ブロックであることを示すブロックステータスを書き込む。   If it is determined that the physical block in which the old data is stored is a bad block (step S303; Yes), the process is terminated without updating the free block search table 200. Note that a block status indicating a defective block is written in the redundant area 26 of the physical block in which the old data was stored.

以上説明したように、本発明に係るコントローラ3は、前回の検索で検出された空きブロックに関する情報が保持されていない場合に、空きブロックに書き込む新データと対応関係にある旧データ(新データで書き換えられるデータ)が記憶されている物理ブロックの次の物理ブロックから空きブロックの検索を開始する。従って、前回の検索で検出された空きブロックに関する情報が保持されていない場合に、空きブロック検索を開始する物理ブロックが特定の物理ブロックに偏ることを回避することができる。   As described above, the controller 3 according to the present invention, when the information about the empty block detected in the previous search is not held, the old data (new data in the new data) corresponding to the new data to be written in the empty block. The search for an empty block is started from the physical block next to the physical block storing the data to be rewritten. Therefore, it is possible to avoid that the physical block for starting the empty block search is biased to a specific physical block when the information regarding the empty block detected in the previous search is not held.

尚、上記の実施の形態では、前回の検索で検出された空きブロックに関する情報が保持されていない場合にだけ、つまり、起動した後の最初の空きブロック検索の場合だけ、空きブロックに書き込む新データと対応関係にある旧データ(新データで書き換えられるデータ)が記憶されている物理ブロックの次の物理ブロックから空きブロックの検索を開始するようにしたが、毎回、旧データが記憶されている物理ブロックの次の物理ブロックから空きブロックの検索を開始するようにしてもよい。   In the above embodiment, the new data to be written into the empty block only when the information about the empty block detected in the previous search is not held, that is, only in the case of the first empty block search after starting. The search for the empty block is started from the physical block next to the physical block in which the old data (data to be rewritten with the new data) is stored, but the physical in which the old data is stored each time The search for an empty block may be started from the physical block next to the block.

この発明は、上述の実施形態に限定されず、種々の変形及び応用が可能である。   The present invention is not limited to the above-described embodiment, and various modifications and applications are possible.

各物理ゾーンの物理ブロック数は1024個に限られず、自由に設定できる。同様に各論理ゾーンの論理ブロック数は1000個に限られず、自由に設定できる。   The number of physical blocks in each physical zone is not limited to 1024 and can be set freely. Similarly, the number of logical blocks in each logical zone is not limited to 1000 and can be set freely.

本実施形態では、空きブロック検索テーブル200の各ビット列は8ビットであったが、8ビットに限られず、自由に設定してもよい。尚、シフトレジスタのビット長は、ビット列のビット数に合わせて適宜設定しなければならない。   In the present embodiment, each bit string of the empty block search table 200 is 8 bits, but is not limited to 8 bits and may be set freely. Note that the bit length of the shift register must be appropriately set according to the number of bits of the bit string.

空きブロック検索テーブル200を作成せずに、冗長領域26に記憶されている論理アドレス情報とブロックステータスを直接参照して空きブロック検索を行ってもよい。   Instead of creating the free block search table 200, the free block search may be performed by directly referring to the logical address information and block status stored in the redundant area 26.

フラッシュメモリシステムの一例を示すブロック図である。1 is a block diagram illustrating an example of a flash memory system. フラッシュメモリのアドレス空間の構造の一例を示す図である。It is a figure which shows an example of the structure of the address space of flash memory. アドレス変換テーブルの構造を示す図である。It is a figure which shows the structure of an address conversion table. 空きブロック検索テーブルの構造を示す図である。It is a figure which shows the structure of an empty block search table. 空きブロック検索テーブルを作成する処理のフローチャートである。It is a flowchart of the process which creates an empty block search table. 空きブロックを検索する処理のフローチャートである。It is a flowchart of the process which searches an empty block. 空きブロックを検索する処理のフローチャートである。It is a flowchart of the process which searches an empty block. 空きブロックを検索する処理のフローチャートである。It is a flowchart of the process which searches an empty block. フラッシュメモリにデータを書き込む処理のフローチャートである。It is a flowchart of the process which writes data in flash memory. フラッシュメモリからデータを消去する処理のフローチャートである。4 is a flowchart of processing for erasing data from a flash memory. 従来のフラッシュメモリのアドレス空間の構造を概略的に示す図である。It is a figure which shows schematically the structure of the address space of the conventional flash memory.

符号の説明Explanation of symbols

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

Claims (4)

ホストシステムからの命令に応答してフラッシュメモリへのアクセスを制御するメモリコントローラであって、
前記フラッシュメモリにおける消去単位である物理ブロックを複数個集めた物理ゾーンと前記ホストシステムにおけるアクセス単位であるセクタを複数集めた論理ゾーンとの対応関係を管理するゾーン管理手段と、
対応関係にある前記論理ゾーンと前記物理ゾーンとの間で、該論理ゾーン内の論理アドレスと該物理ゾーン内の物理アドレスとの対応関係を管理するアドレス管理手段と、
前記物理ゾーン内の物理ブロックの使用状況を順次走査していくことにより空きブロックを検出する空きブロック検索手段と、
を備え、
前記空きブロック検索手段は、前回の走査で検出された空きブロックに関する情報が保持されている場合は、前回の走査で検出された空きブロックの次の物理ブロックから使用状況の走査を開始し、前回の走査で検出された空きブロックに関する情報が保持されていない場合は、検出した空きブロックに書き込む新データと対応関係にある旧データが記憶されている物理ブロックの次の物理ブロックから使用状況の走査を開始するように構成されている、
ことを特徴とするメモリコントローラ。
A memory controller that controls access to a flash memory in response to a command from a host system,
Zone management means for managing a correspondence relationship between a physical zone that collects a plurality of physical blocks that are erase units in the flash memory and a logical zone that collects a plurality of sectors that are access units in the host system;
Address management means for managing the correspondence between the logical address in the logical zone and the physical address in the physical zone between the logical zone and the physical zone in a correspondence relationship;
Empty block search means for detecting empty blocks by sequentially scanning the usage status of physical blocks in the physical zone;
With
The empty block search means starts scanning the usage status from the physical block next to the empty block detected in the previous scan when information on the empty block detected in the previous scan is held. If the information about the free block detected in the previous scan is not retained, the usage status scan starts from the physical block next to the physical block in which the old data corresponding to the new data to be written to the detected free block is stored. Is configured to start,
A memory controller characterized by that.
ホストシステムからの命令に応答してフラッシュメモリへのアクセスを制御するメモリコントローラであって、
前記フラッシュメモリにおける消去単位である物理ブロックを複数個集めた物理ゾーンと前記ホストシステムにおけるアクセス単位であるセクタを複数集めた論理ゾーンとの対応関係を管理するゾーン管理手段と、
対応関係にある前記論理ゾーンと前記物理ゾーンとの間で、該論理ゾーン内の論理アドレスと該物理ゾーン内の物理アドレスとの対応関係を管理するアドレス管理手段と、
前記物理ゾーン内の物理ブロックの使用状況を順次走査していくことにより空きブロックを検出する空きブロック検索手段と、
を備え、
前記空きブロック検索手段は、検出した空きブロックに書き込む新データと対応関係にある旧データが記憶されている物理ブロックの次の物理ブロックから使用状況の走査を開始するように構成されている、
ことを特徴とするメモリコントローラ。
A memory controller that controls access to a flash memory in response to a command from a host system,
Zone management means for managing a correspondence relationship between a physical zone that collects a plurality of physical blocks that are erase units in the flash memory and a logical zone that collects a plurality of sectors that are access units in the host system;
Address management means for managing the correspondence between the logical address in the logical zone and the physical address in the physical zone between the logical zone and the physical zone in a correspondence relationship;
Empty block search means for detecting empty blocks by sequentially scanning the usage status of physical blocks in the physical zone;
With
The empty block search means is configured to start a scan of usage status from a physical block next to a physical block in which old data that is associated with new data to be written to the detected empty block is stored.
A memory controller characterized by that.
前記空きブロック検索手段は、起動後に各ビットの論理値が対応関係にある前記物理ブロックの使用状況を示している複数ビットの記憶領域で構成された空きブロック検索テーブルを作成し、該空きブロック検索テーブルを用いて前記物理ブロックの使用状況の走査を行う、
ことを特徴とする請求項1または2に記載のメモリコントローラ。
The free block search means creates a free block search table composed of a plurality of bits of storage area indicating the usage status of the physical block in which the logical value of each bit is in a correspondence relationship after startup, and the free block search Scan the physical block usage status using a table,
The memory controller according to claim 1, wherein the memory controller is a memory controller.
請求項1から3のいずれか1項に記載のメモリコントローラと、
フラッシュメモリと、
から構成されることを特徴とするフラッシュメモリシステム。
The memory controller according to any one of claims 1 to 3,
Flash memory,
A flash memory system comprising:
JP2006022885A 2006-01-31 2006-01-31 Memory controller and flash memory system Expired - Fee Related JP4213166B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006022885A JP4213166B2 (en) 2006-01-31 2006-01-31 Memory controller and flash memory system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006022885A JP4213166B2 (en) 2006-01-31 2006-01-31 Memory controller and flash memory system

Publications (2)

Publication Number Publication Date
JP2007206835A true JP2007206835A (en) 2007-08-16
JP4213166B2 JP4213166B2 (en) 2009-01-21

Family

ID=38486280

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006022885A Expired - Fee Related JP4213166B2 (en) 2006-01-31 2006-01-31 Memory controller and flash memory system

Country Status (1)

Country Link
JP (1) JP4213166B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016017321A1 (en) * 2014-07-29 2016-02-04 ソニー株式会社 Memory controller, storage device, information processing system, and method of controlling memory controller

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016017321A1 (en) * 2014-07-29 2016-02-04 ソニー株式会社 Memory controller, storage device, information processing system, and method of controlling memory controller

Also Published As

Publication number Publication date
JP4213166B2 (en) 2009-01-21

Similar Documents

Publication Publication Date Title
JP4171749B2 (en) Memory controller and flash memory system
JP4235646B2 (en) Memory controller and flash memory system
JP4366420B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4501881B2 (en) Memory controller and flash memory system
JP4488048B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4661497B2 (en) Memory controller, flash memory system, and flash memory control method
JP4710753B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM USING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4661191B2 (en) Memory controller, flash memory system, and flash memory control method
JP4636005B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4434171B2 (en) Memory controller and flash memory system
JP4153535B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM PROVIDED WITH MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4241741B2 (en) Memory controller and flash memory system
JP4213166B2 (en) Memory controller and flash memory system
JP4254933B2 (en) Memory controller and flash memory system
JP4661748B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP3934659B1 (en) Memory controller and flash memory system
JP4513782B2 (en) Memory controller, flash memory system, and flash memory control method
JP4227989B2 (en) Memory controller and flash memory system
JP4569554B2 (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM HAVING MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP4273109B2 (en) Memory controller and flash memory system
JP4497124B2 (en) Memory controller, flash memory system, and flash memory control method
JP2006048746A (en) Memory card
JP2005276071A (en) Memory controller, flash memory system comprising the same, and control method of flash memory
JP4245594B2 (en) Memory controller and flash memory system
JP2008046727A (en) Memory controller, flash memory system and method for controlling flash memory

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20081017

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

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

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

Free format text: PAYMENT UNTIL: 20111107

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20121107

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees