JP2012022508A - Semiconductor storage device, control device, and method for controlling semiconductor storage device - Google Patents

Semiconductor storage device, control device, and method for controlling semiconductor storage device Download PDF

Info

Publication number
JP2012022508A
JP2012022508A JP2010159685A JP2010159685A JP2012022508A JP 2012022508 A JP2012022508 A JP 2012022508A JP 2010159685 A JP2010159685 A JP 2010159685A JP 2010159685 A JP2010159685 A JP 2010159685A JP 2012022508 A JP2012022508 A JP 2012022508A
Authority
JP
Japan
Prior art keywords
data
flag
valid
error correction
invalid
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2010159685A
Other languages
Japanese (ja)
Inventor
Tetsukazu Yoshida
哲和 吉田
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.)
Toshiba Corp
Original Assignee
Toshiba 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 Toshiba Corp filed Critical Toshiba Corp
Priority to JP2010159685A priority Critical patent/JP2012022508A/en
Publication of JP2012022508A publication Critical patent/JP2012022508A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)
  • Read Only Memory (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a semiconductor storage device, a control device, and a method for controlling the semiconductor storage device capable of managing unreadable data without consuming a storage area of a nonvolatile memory.SOLUTION: The semiconductor storage device includes the nonvolatile memory storing data, and a control unit for controlling to write data in the nonvolatile memory and read data from the nonvolatile memory. The control unit includes: a writing control unit which adds an error correction code, which is generated by adding a first flag indicating that the data is valid or invalid to the data and by executing an error correction process, to the data, and writes them in the nonvolatile memory; and a reading control unit which reads out the data and the error correction code from the nonvolatile memory, adds a second flag that is fixed to either of the valid and invalid to the data read out and executes the error correction process using the error correction code read out to the data with the second flag added thereto.

Description

本発明は、半導体記憶装置、制御装置、及び半導体記憶装置の制御方法に関する。   The present invention relates to a semiconductor memory device, a control device, and a method for controlling a semiconductor memory device.

SSD(Solid State Drive)に内蔵されるNAND型フラッシュメモリのコントローラでは、内部的なデータ管理のために使用する管理テーブルのサイズの都合やECC符号長などの関係で、基本データ転送サイズ(セクタ)よりも大きなサイズでデータ管理を行うことが多い。   In a NAND flash memory controller built in an SSD (Solid State Drive), the basic data transfer size (sector) depends on the convenience of the size of the management table used for internal data management and the ECC code length. In many cases, data management is performed with a larger size.

NAND型フラッシュメモリの経年劣化などにより、NAND型フラッシュメモリから読み出したデータのうちECC(Error Checking and Correction)処理により訂正不能なデータが生じた場合、その訂正不能なデータは、読み出し不能なデータとして管理することが必要である。   When uncorrectable data is generated by ECC (Error Checking and Correction) processing among the data read from the NAND flash memory due to aging degradation of the NAND flash memory, the uncorrectable data is regarded as unreadable data. It is necessary to manage.

特許文献1には、SSDにおいて、NANDメモリ内でECCエラーの発生した読み出し不能なデータをセクタ単位に管理テーブルに登録して管理することが記載されている。また、このような管理データは、不揮発化する必要があるため、特許文献1では、管理テーブルをNANDメモリに保存している。   Patent Document 1 describes that in SSD, unreadable data in which an ECC error has occurred in a NAND memory is registered and managed in a management table in units of sectors. In addition, since such management data needs to be made non-volatile, in Patent Document 1, a management table is stored in a NAND memory.

このように、従来技術では、読み出し不能なデータを管理するための管理テーブルを用意し、この管理テーブルをNANDメモリに保存しているので、NANDメモリ(不揮発性メモリ)の記憶領域が管理テーブルのために消費されるという問題がある。   As described above, in the conventional technique, a management table for managing unreadable data is prepared, and this management table is stored in the NAND memory. Therefore, the storage area of the NAND memory (nonvolatile memory) is stored in the management table. There is a problem of being consumed.

特開2009−211230号公報JP 2009-211130 A

本発明は、不揮発性メモリの記憶領域を消費することなく、訂正不能なデータを管理できる半導体記憶装置、制御装置、及び半導体記憶装置の制御方法を提供する。   The present invention provides a semiconductor memory device, a control device, and a semiconductor memory device control method capable of managing uncorrectable data without consuming a storage area of a nonvolatile memory.

本願発明の一態様によれば、データを記憶する不揮発性メモリと、前記不揮発性メモリへのデータの書き込みと前記不揮発性メモリからのデータの読み出しとを制御する制御部とを備え、前記制御部は、データが有効であるのか無効であるのかを示す第1のフラグをデータに付加して誤り訂正処理を行うことにより生成された誤り訂正符号を前記データに付加して前記不揮発性メモリへ書き込む書き込み制御部と、前記データと前記誤り訂正符号とを前記不揮発性メモリから読み出し、有効及び無効の何れか一方に固定された第2のフラグを前記読み出されたデータに付加し、前記読み出された誤り訂正符号を用いた誤り訂正処理を前記第2のフラグが付加されたデータに対して行う読み出し制御部とを有することを特徴とする半導体記憶装置が提供される。   According to an aspect of the present invention, the control unit includes: a non-volatile memory that stores data; and a control unit that controls writing of data into the non-volatile memory and reading of data from the non-volatile memory. Adds an error correction code generated by adding a first flag indicating whether the data is valid or invalid to the data and performing error correction processing, and writes the error correction code to the nonvolatile memory. A write control unit, reading the data and the error correction code from the nonvolatile memory, adding a second flag fixed to either valid or invalid to the read data, and reading the data A read control unit for performing error correction processing using the error correction code on the data to which the second flag is added. There is provided.

また、本願発明の一態様によれば、不揮発性メモリへのデータの書き込み及び前記不揮発性メモリからのデータの読み出しを制御する制御装置であって、データが有効であるのか無効であるのかを示す第1のフラグをデータに付加して誤り訂正処理を行うことにより生成された誤り訂正符号を前記データに付加して前記不揮発性メモリへ書き込む書き込み制御部と、前記データと前記誤り訂正符号とを前記不揮発性メモリから読み出し、有効及び無効の何れか一方に固定された第2のフラグを前記読み出されたデータに付加し、前記読み出された誤り訂正符号を用いた誤り訂正処理を前記第2のフラグが付加されたデータに対して行う読み出し制御部とを有することを特徴とする制御装置が提供される。   According to another aspect of the present invention, there is provided a control device that controls writing of data into a nonvolatile memory and reading of data from the nonvolatile memory, and indicates whether the data is valid or invalid. A write control unit for adding an error correction code generated by adding an error correction process by adding a first flag to the data and writing the data to the nonvolatile memory; and the data and the error correction code. A second flag read from the non-volatile memory and fixed to either valid or invalid is added to the read data, and error correction processing using the read error correction code is performed. There is provided a control device including a read control unit that performs data read with respect to data with 2 flags.

また、本願発明の一態様によれば、データを記憶する不揮発性メモリを有する半導体記憶装置の制御方法であって、前記不揮発性メモリへ書き込むべきデータが有効であるのか無効であるのかを示す第1のフラグを前記書き込むべきデータに付加して誤り訂正処理を行うことにより誤り訂正符号を生成する第1のステップと、前記書き込むべきデータに前記第1のステップで生成された誤り訂正符号を付加して前記不揮発性メモリへ書き込む第2のステップと、前記データと前記誤り訂正符号とを前記不揮発性メモリから読み出す第3のステップと、有効及び無効の何れか一方に固定された第2のフラグを前記第3のステップで読み出されたデータに付加して、前記第3のステップで読み出された誤り訂正符号を用いた誤り訂正処理を前記第2のフラグが付加されたデータに対して行う第4のステップと、有効に固定された前記第2のフラグが誤りであることを検出した場合、又は無効に固定された前記第2のフラグが正しいことを検出した場合、前記第2のフラグが付加されたデータが無効であると判定し、有効に固定された前記第2のフラグが正しいことを検出した場合、又は無効に固定された前記第2のフラグが誤りであることを検出した場合、前記第2のフラグが付加されたデータが有効であると判定する第5のステップとを備えたことを特徴とする半導体記憶装置の制御方法が提供される。   According to another aspect of the present invention, there is provided a method for controlling a semiconductor memory device having a nonvolatile memory for storing data, wherein the data to be written to the nonvolatile memory is valid or invalid. A first step of generating an error correction code by adding an error flag to the data to be written and performing error correction processing, and adding the error correction code generated in the first step to the data to be written A second step of writing to the non-volatile memory, a third step of reading the data and the error correction code from the non-volatile memory, and a second flag fixed to either valid or invalid Is added to the data read in the third step, and error correction processing using the error correction code read in the third step is performed. The fourth step to be performed on the data to which the flag is added, and when the second flag fixed to valid is detected to be an error, or the second flag fixed to invalid is correct If it is detected that the data to which the second flag has been added is invalid, and the second flag that has been effectively fixed is detected to be correct, or the second flag that has been fixed to invalid is detected. And a fifth step of determining that the data to which the second flag is added is valid when it is detected that the second flag is incorrect. A method for controlling a semiconductor memory device, comprising: Provided.

本発明によれば、不揮発性メモリの記憶領域を消費することなく、訂正不能なデータを管理できる。   According to the present invention, uncorrectable data can be managed without consuming the storage area of the nonvolatile memory.

図1は、第1の実施の形態にかかる半導体記憶装置1の構成を示す図である。FIG. 1 is a diagram showing a configuration of the semiconductor memory device 1 according to the first embodiment. 図2は、第1の実施の形態にかかる半導体記憶装置1の構成を示す図である。FIG. 2 is a diagram illustrating a configuration of the semiconductor memory device 1 according to the first embodiment. 図3は、第1の実施の形態におけるメモリ40内に形成された機能ブロックを示す図である。FIG. 3 is a diagram illustrating functional blocks formed in the memory 40 according to the first embodiment. 図4は、誤り訂正不能なデータをセクタ単位に管理する必要性について説明するための図である。FIG. 4 is a diagram for explaining the necessity of managing data that cannot be corrected in units of sectors. 図5は、第1の実施の形態におけるL1/L2エンコーダ15、L1デコーダ16の内部機能構成例を示す図である。FIG. 5 is a diagram illustrating an internal functional configuration example of the L1 / L2 encoder 15 and the L1 decoder 16 according to the first embodiment. 図6は、第1の実施の形態におけるデータの構成を示す図である。FIG. 6 is a diagram illustrating a data configuration according to the first embodiment. 図7は、第1の実施の形態における書き込み処理の動作手順を示すフローチャートである。FIG. 7 is a flowchart illustrating an operation procedure of the writing process according to the first embodiment. 図8は、第1の実施の形態における読み出し処理の動作手順を示すフローチャートである。FIG. 8 is a flowchart illustrating the operation procedure of the read process according to the first embodiment. 図9は、第1の実施の形態におけるリードモディファイライト処理の動作手順を示すフローチャートである。FIG. 9 is a flowchart showing the operation procedure of the read-modify-write process in the first embodiment. 図10は、有効/無効フラグF1が付加されていないデータに対して行われる第1のECC処理及び第2のECC処理におけるエンコード処理を示す図である。FIG. 10 is a diagram illustrating encoding processing in the first ECC processing and the second ECC processing performed on data to which the valid / invalid flag F1 is not added.

以下に添付図面を参照して、本発明の実施の形態にかかる半導体記憶装置を詳細に説明する。なお、この実施の形態により本発明が限定されるものではない。
(第1の実施の形態)
A semiconductor memory device according to an embodiment of the present invention will be described below in detail with reference to the accompanying drawings. In addition, this invention is not limited by this embodiment.
(First embodiment)

図1は、第1の実施の形態にかかる半導体記憶装置の構成をハードウェア的な側面から示すブロック図である。半導体記憶装置1は、通信媒体を介してホスト装置HAの外部に接続され、ホスト装置HAに対する外部記憶媒体として機能する。ホスト装置HAは、例えば、パーソナルコンピュータ又はCPUコアを含む。半導体記憶装置1は、例えば、SSD(Solid State Drive)を含む。   FIG. 1 is a block diagram showing the configuration of the semiconductor memory device according to the first embodiment from the hardware side. The semiconductor storage device 1 is connected to the outside of the host device HA via a communication medium and functions as an external storage medium for the host device HA. The host device HA includes, for example, a personal computer or a CPU core. The semiconductor memory device 1 includes, for example, an SSD (Solid State Drive).

半導体記憶装置1は、図1に示すように、MPU(プロセッサ)2、不揮発性半導体メモリとしてのNAND型フラッシュメモリ(以下、NANDメモリと略す)30、NANDメモリ30よりも高速動作が可能なメモリ40、通信I/F60、NANDコントローラ10、L2デコーダ20及び内部バス50を備える。NANDメモリ30、メモリ40、通信I/F60、L2デコーダ20及びMPU2は、内部バス50を介して互いに接続されている。   As shown in FIG. 1, the semiconductor memory device 1 includes an MPU (processor) 2, a NAND flash memory (hereinafter abbreviated as a NAND memory) 30 as a nonvolatile semiconductor memory, and a memory capable of operating at higher speed than the NAND memory 30. 40, a communication I / F 60, a NAND controller 10, an L2 decoder 20, and an internal bus 50. The NAND memory 30, the memory 40, the communication I / F 60, the L2 decoder 20 and the MPU 2 are connected to each other via the internal bus 50.

NANDメモリ30は、複数のメモリセルがマトリクス状に配列されたメモリセルアレイを有し、個々のメモリセルは上位ページ及び下位ページを使用して多値記憶が可能である。NANDメモリ30では、データの消去がブロック単位で行われるのに対して、データの書き込み及び読み出しがページ単位で行われる。ブロックは、複数のページをひとまとめにした単位である。また、NANDメモリ30では、MPU2による内部的なデータ管理がクラスタ単位で行われ、データの更新がセクタ単位で行われる。この実施の形態では、ページは、複数のクラスタをひとまとめにした単位であるとし、クラスタは、複数のセクタをひとまとめにした単位であるとする。セクタは、ホスト装置HAからのデータの最小アクセス単位であり、例えば、512Bのサイズを有する。ホスト装置HAは、セクタ単位のLBA(Logical Block Addressing)によってアクセスするデータを指定する。   The NAND memory 30 has a memory cell array in which a plurality of memory cells are arranged in a matrix, and each memory cell can store multiple values using an upper page and a lower page. In the NAND memory 30, data is erased in units of blocks, whereas data is written and read in units of pages. A block is a unit obtained by grouping a plurality of pages. In the NAND memory 30, internal data management by the MPU 2 is performed in units of clusters, and data is updated in units of sectors. In this embodiment, it is assumed that a page is a unit obtained by grouping a plurality of clusters, and a cluster is a unit obtained by grouping a plurality of sectors. The sector is a minimum access unit of data from the host apparatus HA, and has a size of 512B, for example. The host device HA designates data to be accessed by sector unit LBA (Logical Block Addressing).

メモリ40は、図3に示すように、ホスト装置HAとNANDメモリ30との間でのデータ転送用のキャッシュ領域41として、並びに、MPU2が使用する作業領域42として機能する。メモリ40としては、例えば、DRAM(Dynamic Random Access Memory)、又はFeRAM(Ferroelectric Random Access Memory)、MRAM(Magnetoresistive Random Access Memory)、PRAMなど(Phase Change Random Access Memory)を含む。また、メモリ40は、NANDメモリ30から読み出した各種管理テーブルを作業領域42に一時的に記憶する。   As shown in FIG. 3, the memory 40 functions as a cache area 41 for data transfer between the host device HA and the NAND memory 30 and as a work area 42 used by the MPU 2. Examples of the memory 40 include DRAM (Dynamic Random Access Memory), FeRAM (Ferroelectric Random Access Memory), MRAM (Magnetic Resistive Random Access Memory), PRAM, etc. (P Further, the memory 40 temporarily stores various management tables read from the NAND memory 30 in the work area 42.

通信I/F60は、ATAインタフェース(ATA I/F)などのメモリ接続インタフェースであり、ホスト装置HAから受信した命令、データなどを内部バス50に出力し、内部バス50経由で入力されたデータ、MPU2からの応答通知(命令の実行完了を示す通知など)などをホスト装置HAへ送信する。   The communication I / F 60 is a memory connection interface such as an ATA interface (ATA I / F), outputs commands and data received from the host device HA to the internal bus 50, and receives data input via the internal bus 50, A response notification from the MPU 2 (such as a notification indicating completion of instruction execution) is transmitted to the host device HA.

MPU2は、半導体記憶装置1の各構成要素を統括的に制御するもので、ホスト装置HAから通信I/F60及び内部バス50経由での命令を受けた場合に、その命令に従った制御を行う。例えば、MPU2は、NANDコントローラ10と協働して、ホスト装置HAからの命令に従って、NANDメモリ30へのデータの書き込み、NANDメモリ30からのデータの読み出しなどを制御する。すなわち、機能的な側面から見ると、MPU2及びNANDコントローラ10を含む1つの制御部70(図2参照)が実現されている。   The MPU 2 comprehensively controls each component of the semiconductor memory device 1. When receiving a command from the host device HA via the communication I / F 60 and the internal bus 50, the MPU 2 performs control according to the command. . For example, the MPU 2 cooperates with the NAND controller 10 to control data writing to the NAND memory 30 and data reading from the NAND memory 30 in accordance with instructions from the host device HA. That is, from the functional aspect, one control unit 70 (see FIG. 2) including the MPU 2 and the NAND controller 10 is realized.

NANDコントローラ10は、NANDメモリ30とメモリ40との間のデータ転送を制御するもので、命令制御部11、コマンド制御部12、DMAコントローラ13、バッファメモリ14、L1/L2エンコーダ15、L1デコーダ16、及びメモリI/F17を有する。   The NAND controller 10 controls data transfer between the NAND memory 30 and the memory 40, and includes an instruction control unit 11, a command control unit 12, a DMA controller 13, a buffer memory 14, an L1 / L2 encoder 15, and an L1 decoder 16. And a memory I / F 17.

命令制御部11は、MPU2から受けた命令をNANDコントローラ10用のコマンドに変換してコマンド制御部12へ供給する。コマンド制御部12は、供給されたコマンドに従って、DMAコントローラ13、バッファメモリ14、L1/L2エンコーダ、L1デコーダ16、L2デコーダ20、及びメモリI/F17を制御する。   The instruction control unit 11 converts the instruction received from the MPU 2 into a command for the NAND controller 10 and supplies the command to the command control unit 12. The command control unit 12 controls the DMA controller 13, the buffer memory 14, the L1 / L2 encoder, the L1 decoder 16, the L2 decoder 20, and the memory I / F 17 according to the supplied command.

DMAコントローラ13は、コマンド制御部12による制御に従って、バッファメモリ14、L2デコーダ20及びメモリ40の間のデータ転送制御をDMA(Direct Memory Access)方式に従って行う。バッファメモリ14は、DMAコントローラ13からL1/L2エンコーダ15へのデータ転送と、L1デコーダ16からDMAコントローラ13へのデータ転送とのそれぞれにおけるバッファ領域として機能する。   The DMA controller 13 performs data transfer control among the buffer memory 14, the L2 decoder 20, and the memory 40 in accordance with a DMA (Direct Memory Access) method according to control by the command control unit 12. The buffer memory 14 functions as a buffer area in each of data transfer from the DMA controller 13 to the L1 / L2 encoder 15 and data transfer from the L1 decoder 16 to the DMA controller 13.

L1/L2エンコーダ15は、コマンド制御部12による制御に従って、DMAコントローラ13からバッファメモリ14を介して転送されたデータに対して、ECC処理(誤り訂正処理)におけるエンコード処理を行い、エンコード結果をデータに付加して出力する。L1/L2エンコーダ15では、第1のECC符号(L1、誤り訂正符号)及び第2のECC符号(L2、誤り訂正符号)を用いてエンコード処理を行う。第1のECC符号(L1)、第2のECC符号(L2)としては、例えば、ハミング符号、BCH(Bose Chaudhuri Hocqenghem)符号、RS(Reed Solomon)符号、或いはLDPC(Low Density Parity Check)符号等を採用する。第2のECC符号(L2)の訂正能力は、第1のECC符号(L1)の訂正能力よりも高い。   The L1 / L2 encoder 15 performs the encoding process in the ECC process (error correction process) on the data transferred from the DMA controller 13 via the buffer memory 14 according to the control by the command control unit 12, and the encoding result is converted into data. To be output. The L1 / L2 encoder 15 performs an encoding process using the first ECC code (L1, error correction code) and the second ECC code (L2, error correction code). As the first ECC code (L1) and the second ECC code (L2), for example, a Hamming code, BCH (Bose Chaudhuri Hocqchem) code, RS (Reed Solomon) code, LDPC (Low Density Parity Check) code, etc. Is adopted. The correction capability of the second ECC code (L2) is higher than the correction capability of the first ECC code (L1).

L1デコーダ16は、コマンド制御部12による制御に従って、メモリI/F17から転送されたデータに対して、第1のECC符号(L1)を用いたECC処理におけるデコード処理(誤り訂正符号を用いた誤り訂正処理)を行い、誤り訂正されたデータをバッファメモリ14に出力する。メモリI/F17は、L1/L2エンコーダ15から出力されるECC符号が付加されたデータをNANDメモリ30に出力するとともに、NANDメモリ30から入力されたECC符号が付加されたデータをL1デコーダ16に出力する。   Under the control of the command control unit 12, the L1 decoder 16 decodes the data transferred from the memory I / F 17 in the ECC process using the first ECC code (L1) (error using an error correction code). Correction processing) is performed, and the error-corrected data is output to the buffer memory 14. The memory I / F 17 outputs the data to which the ECC code output from the L1 / L2 encoder 15 is added to the NAND memory 30 and the data to which the ECC code input from the NAND memory 30 is added to the L1 decoder 16. Output.

L2デコーダ20は、NANDコントローラ10の外部に設けられ、L1デコーダ16の第1のECC符号(L1)を用いたECC処理におけるデコード処理で、訂正不可能な誤りが生じた場合(ECCエラーが発生した場合)にのみ活性化される。L2デコーダ20は、DMAコントローラ13から転送された、L1デコーダ16で訂正不可能なデータに対して、第2のECC符号(L2)を用いたECC処理におけるデコード処理を行う。   The L2 decoder 20 is provided outside the NAND controller 10, and when an uncorrectable error occurs in the decoding process in the ECC process using the first ECC code (L1) of the L1 decoder 16 (an ECC error occurs) Only when activated). The L2 decoder 20 performs a decoding process in the ECC process using the second ECC code (L2) on the data transferred from the DMA controller 13 and cannot be corrected by the L1 decoder 16.

NANDメモリ30にデータを書き込む場合、L1/L2エンコーダ15は、書き込み対象のデータに対して、セクタデータ毎に、例えば、誤り検出符号(例えば、CRC符号)及びMビットの訂正能力がある第1のECC符号(例えば、ハミング符号)を生成して付加する。また、L1/L2エンコーダ15は、複数のセクタデータから構成されるクラスタに、N(N>M)ビットの訂正能力がある第2のECC符号(例えば、BCH符号)を生成して付加する。誤り検出符号、第1のECC符号、及び第2のECC符号が付加されたデータが、メモリI/F17を介してNANDメモリ30に書き込まれる。   When writing data to the NAND memory 30, the L1 / L2 encoder 15 has a first error correction code (for example, CRC code) and M-bit correction capability for each sector data with respect to data to be written. ECC code (for example, Hamming code) is generated and added. Also, the L1 / L2 encoder 15 generates and adds a second ECC code (for example, BCH code) having a correction capability of N (N> M) bits to a cluster composed of a plurality of sector data. Data to which the error detection code, the first ECC code, and the second ECC code are added is written into the NAND memory 30 via the memory I / F 17.

また、NANDメモリ30からデータを読み出す場合は、L1デコーダ16は、NANDメモリ30から読み出されたデータに対して、まず、第1のECC符号による誤り訂正を行った後、誤り検出符号を用いて誤訂正が発生しているか否かを検出する。L2デコーダ20は、L1デコーダ16によって誤訂正が発生していると判定された場合(L1−ECCエラー)に、すなわち、第1のECC符号の訂正能力以上の誤りが生じて誤訂正が発生した場合に、第2のECC符号による誤り訂正を行う。第2のECC符号による誤り訂正が失敗した場合(L2−ECCエラー)、半導体記憶装置1は、ホスト装置HAに対して読み出しエラーを示す応答を返す。   When reading data from the NAND memory 30, the L1 decoder 16 first performs error correction using the first ECC code on the data read from the NAND memory 30, and then uses the error detection code. To detect whether or not an erroneous correction has occurred. When the L2 decoder 20 determines that an error correction has occurred by the L1 decoder 16 (L1-ECC error), that is, an error exceeding the correction capability of the first ECC code has occurred and the error correction has occurred. In this case, error correction is performed using the second ECC code. When error correction using the second ECC code has failed (L2-ECC error), the semiconductor memory device 1 returns a response indicating a read error to the host device HA.

図2は、第1の実施の形態にかかる半導体記憶装置の構成を機能的な側面から示すブロック図である。半導体記憶装置1は、図2に示すように、データを記憶するNANDメモリ30と、NANDメモリ30へのデータの書き込みとNANDメモリ30からのデータの読み出しとを制御する制御部70とを備える。制御部70は、NANDメモリ30へのデータの書き込みを制御する書き込み制御部71と、NANDメモリ30からのデータの読み出しとを制御する読み出し制御部72とを有する。ここで、書き込み制御部71は、MPU2、命令制御部11、コマンド制御部12、DMAコントローラ13、バッファメモリ14、メモリI/F17のそれぞれにおける書き込み処理に関連した部分と、L1/L2エンコーダ15とに対応している。読み出し制御部72は、MPU2、命令制御部11、コマンド制御部12、DMAコントローラ13、バッファメモリ14、メモリI/F17のそれぞれにおける読み出し処理に関連した部分と、L1デコーダ16と、L2デコーダ20とに対応している。   FIG. 2 is a functional block diagram of the configuration of the semiconductor memory device according to the first embodiment. As shown in FIG. 2, the semiconductor memory device 1 includes a NAND memory 30 that stores data, and a control unit 70 that controls data writing to the NAND memory 30 and data reading from the NAND memory 30. The control unit 70 includes a write control unit 71 that controls writing of data to the NAND memory 30 and a read control unit 72 that controls reading of data from the NAND memory 30. Here, the write control unit 71 includes an MPU 2, an instruction control unit 11, a command control unit 12, a DMA controller 13, a buffer memory 14, a portion related to write processing in the memory I / F 17, an L1 / L2 encoder 15, It corresponds to. The read control unit 72 includes parts related to read processing in the MPU 2, the instruction control unit 11, the command control unit 12, the DMA controller 13, the buffer memory 14, and the memory I / F 17, the L1 decoder 16, and the L2 decoder 20. It corresponds to.

つぎに、ECCエラーが発生した誤り訂正不能なデータを、ホスト装置HAからのデータの最小アクセス単位であるセクタ単位に管理する必要性について図4を用いて説明する。例えば、第2のECC符号による誤り訂正が失敗した結果として、図4(a)に示す複数のセクタ(LBA=N〜N+7のセクタ)が誤り訂正不能(invalid)であるとする。このような誤り訂正不能な複数のセクタの一部が、図4(b)に示すように、新たな書き込み要求によって更新される場合、訂正不能なデータと更新された有効データ(valid)とを組み合わせ、組み合わせたデータから新たなECC符号を作成し、作成したECC符号が付加された組み合わせデータを新たなページに書き込むといった処理が行われる。したがって、この後は、新たなページから読み出した有効セクタ、訂正不能セクタを含む組み合わせデータを、組み合わせデータに付加されたECC符号によって誤り訂正することが可能になる。しかし、更新された有効セクタ以外は依然として誤りを含んでいる可能性があり信頼できるデータとは言えないため、更新セクタ以外は、元々が不正なデータであったことを管理する必要がある。   Next, the necessity of managing the uncorrectable data in which the ECC error has occurred in the sector unit, which is the minimum access unit of the data from the host device HA, will be described with reference to FIG. For example, suppose that a plurality of sectors (sectors LBA = N to N + 7) shown in FIG. 4A are invalid as a result of error correction by the second ECC code. As shown in FIG. 4B, when a part of such a plurality of uncorrectable sectors is updated by a new write request, uncorrectable data and updated valid data (valid) are displayed. A process of creating a new ECC code from the combined data and the combined data and writing the combined data to which the created ECC code is added to a new page is performed. Therefore, thereafter, it becomes possible to correct the error of the combination data including the valid sector and the uncorrectable sector read from the new page by the ECC code added to the combination data. However, since the data other than the updated valid sector may still contain errors and cannot be said to be reliable data, it is necessary to manage that the data other than the updated sector was originally invalid data.

従来は、訂正不能なクラスタ/セクタを管理するための管理テーブルを用意し、この管理テーブルをNANDメモリ30に保存しており、NANDメモリ30の記憶領域が管理テーブルのために消費されている。そこで、本半導体記憶装置1においては、データの有効/無効を示す無効フラグを利用してECC処理を行うことで、管理テーブルを使用することなく、誤り訂正不能なセクタの管理を可能とする。なお、この種の半導体記憶装置においては、無効なデータとは、同一論理アドレスのデータが他の場所に書きこまれ、参照されることがなくなったデータのことを言う場合が多いが、本明細書では、無効なデータとは、特に明記しないかぎり、誤り訂正不能なデータと同じ意味であるとする。   Conventionally, a management table for managing uncorrectable clusters / sectors is prepared, and this management table is stored in the NAND memory 30, and the storage area of the NAND memory 30 is consumed for the management table. Accordingly, in the semiconductor memory device 1, ECC processing is performed using an invalid flag indicating whether data is valid / invalid, thereby enabling management of sectors that cannot be error-corrected without using a management table. In this type of semiconductor memory device, invalid data often refers to data in which data of the same logical address is written to another location and is no longer referred to. In the document, invalid data has the same meaning as uncorrectable data unless otherwise specified.

図5は、L1/L2エンコーダ15、L1デコーダ16の内部機能構成例を示すものである。L1/L2エンコーダ15は、フラグ付加部15a、ECCモジュール15b及びECC合成部15cを有する。   FIG. 5 shows an internal functional configuration example of the L1 / L2 encoder 15 and the L1 decoder 16. The L1 / L2 encoder 15 includes a flag adding unit 15a, an ECC module 15b, and an ECC combining unit 15c.

フラグ付加部15aは、NANDメモリ30へ書き込むべきデータが有効であるのか無効であるのかを示す1〜複数ビットで構成される有効/無効フラグ(第1のフラグ)F1を、セクタ毎に、書き込むべきセクタデータDに付加し、有効/無効フラグF1が付加されたセクタデータDをECCモジュール15bに出力する。すなわち、フラグ付加部15aは、命令制御部11、コマンド制御部12を介して入力されるMPU2からのセレクト信号SLに従って、無効/有効を示す有効/無効フラグF1を選択するセレクタ15aaと、セレクタ15aaから出力される有効/無効フラグF1をセクタデータDの例えば先頭(あるいは最後尾)に付加する付加部15abとを有する。   The flag adding unit 15a writes a valid / invalid flag (first flag) F1 composed of one to a plurality of bits indicating whether data to be written to the NAND memory 30 is valid or invalid for each sector. The sector data D added to the valid sector data D and the valid / invalid flag F1 added is output to the ECC module 15b. That is, the flag adding unit 15a selects a valid / invalid flag F1 indicating invalid / valid according to a select signal SL from the MPU 2 input via the instruction control unit 11 and the command control unit 12, and a selector 15aa. And an addition unit 15ab for adding the valid / invalid flag F1 output from the data to, for example, the head (or tail) of the sector data D.

ECCモジュール15bは、有効/無効フラグF1が付加されたセクタデータD毎に、すなわち有効/無効フラグF1+セクタデータDから構成されるフラグ付きデータ毎に、第1のECC処理(誤り訂正処理)におけるエンコード処理を行い第1のECC符号(L1)Eを生成する。すなわち、ECCモジュール15bは、図6(a)に示すように、有効/無効フラグF11〜F1kが付加された複数セクタのデータD1〜Dkのそれぞれに第1のECC処理(誤り訂正処理)におけるエンコード処理を行う。これにより、ECCモジュール15bは、有効/無効フラグ付きセクタデータ(F11+D1)、(F12+D2)、…、(F1k+Dk)ごとに、第1のECC符号(L1)E1〜Ekを生成する。なお、ECCモジュール15bは、図6(a)に示すように、有効/無効フラグF11〜F1kが付加されたデータD1〜DkのそれぞれにさらにCRC(Cyclic Redundancy Check)符号が追加された形のデータ(有効/無効フラグF1+データD+CRC)にエンコード処理を行うことにより、第1のECC符号(L1)を生成してもよい。   The ECC module 15b performs the first ECC process (error correction process) for each sector data D to which the valid / invalid flag F1 is added, that is, for each flagged data composed of the valid / invalid flag F1 + sector data D. An encoding process is performed to generate a first ECC code (L1) E. That is, as shown in FIG. 6A, the ECC module 15b encodes each of the plurality of sectors of data D1 to Dk to which the valid / invalid flags F11 to F1k are added in the first ECC process (error correction process). Process. Thereby, the ECC module 15b generates first ECC codes (L1) E1 to Ek for each sector data (F11 + D1), (F12 + D2),..., (F1k + Dk) with valid / invalid flags. As shown in FIG. 6A, the ECC module 15b is a data in which a CRC (Cyclic Redundancy Check) code is added to each of the data D1 to Dk to which the valid / invalid flags F11 to F1k are added. The first ECC code (L1) may be generated by performing an encoding process on (valid / invalid flag F1 + data D + CRC).

また、ECCモジュール15bは、有効/無効フラグF11〜F1kがそれぞれ付加された複数のセクタデータD1〜Dkから構成されるクラスタに第2のECC処理(誤り訂正処理)におけるエンコード処理を行う。これにより、ECCモジュール15bは、有効/無効フラグ付きセクタデータの全体(F11+D1、F12+D2、…、F1k+Dk)に対して、第2のECC符号(L2)G1kを生成する(図6(a)参照)。なお、ECCモジュール15bは、図6(a)に示すように、有効/無効フラグF11〜F1kが付加された複数セクタのデータD1〜DkのそれぞれにさらにCRC(Cyclic Redundancy Check)符号が追加された形のデータ(F11+D1+CRC、F12+D2+CRC、…、F1k+Dk+CRC)にエンコード処理を行うことにより、第2のECC符号(L2)を生成してもよい。   The ECC module 15b performs an encoding process in the second ECC process (error correction process) on a cluster composed of a plurality of sector data D1 to Dk to which valid / invalid flags F11 to F1k are added, respectively. Accordingly, the ECC module 15b generates the second ECC code (L2) G1k for the entire sector data with valid / invalid flag (F11 + D1, F12 + D2,..., F1k + Dk) (see FIG. 6A). . As shown in FIG. 6A, the ECC module 15b has a CRC (Cyclic Redundancy Check) code added to each of the data D1 to Dk of the plurality of sectors to which the valid / invalid flags F11 to F1k are added. The second ECC code (L2) may be generated by performing an encoding process on the shape data (F11 + D1 + CRC, F12 + D2 + CRC,..., F1k + Dk + CRC).

すなわち、L1/L2エンコーダ15は、有効/無効フラグ付きセクタごとに第1のECC符号(L1)を生成するとともに、複数の有効/無効フラグ付きセクタをひとまとめにした有効/無効フラグ付きクラスタごとに第2のECC符号(L2)を生成する。   In other words, the L1 / L2 encoder 15 generates the first ECC code (L1) for each sector with valid / invalid flag, and for each cluster with valid / invalid flag that combines a plurality of sectors with valid / invalid flags. A second ECC code (L2) is generated.

ECC合成部15cは、DMAコントローラ13からバッファメモリ14を介して転送されたデータに、L1/L2エンコーダ15から供給された第1のECC符号(L1)及び第2のECC符号(L2)を付加して、図6(b)に示すような、ECC符号付きデータを形成し、形成したデータをメモリI/F17に出力することで、NANDメモリ30に書き込む。例えば、ECC合成部15cは、各セクタのデータD1〜Dkの後に対応する第1のECC符号(L1)E1〜Ekを追加するとともに、複数セクタのデータD1〜Dkの全体の後に第2のECC符号(L2)G1kを追加する。ただし、有効/無効フラグF1は、ECCモジュール15bのエンコードの際にのみ使用され、図6(b)に示されているように、NANDメモリ30に書き込まれるデータには、有効/無効フラグフィールドは存在しない。   The ECC synthesis unit 15c adds the first ECC code (L1) and the second ECC code (L2) supplied from the L1 / L2 encoder 15 to the data transferred from the DMA controller 13 via the buffer memory 14. Then, ECC-signed data as shown in FIG. 6B is formed, and the formed data is output to the memory I / F 17 to be written in the NAND memory 30. For example, the ECC synthesis unit 15c adds the corresponding first ECC codes (L1) E1 to Ek after the data D1 to Dk of each sector, and the second ECC after the entire data D1 to Dk of the plurality of sectors. The code (L2) G1k is added. However, the valid / invalid flag F1 is used only when encoding the ECC module 15b. As shown in FIG. 6B, the valid / invalid flag field is included in the data written to the NAND memory 30. not exist.

L1デコーダ16は、図5に示すように、フラグ付加部16a、ECCモジュール16bを有する。L1デコーダ16には、NANDメモリ30から読み出された第1のECC符号(L1)及びCRC符号付きのデータが、メモリI/F17を介して入力される。データは、バッファメモリ14に一時記憶され、CRCは、L1デコーダ16内のCRCバッファ(図示せず)に一時記憶される。   As shown in FIG. 5, the L1 decoder 16 includes a flag adding unit 16a and an ECC module 16b. The L1 decoder 16 receives the data with the first ECC code (L1) and CRC code read from the NAND memory 30 via the memory I / F 17. Data is temporarily stored in the buffer memory 14, and the CRC is temporarily stored in a CRC buffer (not shown) in the L1 decoder 16.

フラグ付加部16aは、有効であることを示す1〜複数ビットの有効フラグ(有効に固定された第2のフラグ)F2を、メモリI/F17から転送された各セクタのデータDの例えば先頭(あるいは最後尾)に付加する。この有効フラグF2の挿入位置は、有効/無効フラグF1の挿入位置に対応し、有効/無効フラグF1をデータの先頭に付加した場合は、有効フラグF2をデータの先頭に付加するようにし、有効/無効フラグF1をデータの最後尾に付加した場合は、有効フラグF2をデータの最後尾に付加する。すなわち、フラグ付加部16aは、有効フラグF2を発生する有効フラグ発生部16aaと、発生した有効フラグF2を、データDの先頭に付加し、有効フラグF2、データD、第1のECC符号(L1)及びCRCをECCモジュール16bに入力する付加部16abとを有する。   The flag adding unit 16a displays a valid flag (second flag that is validly fixed) F2 indicating that it is valid, for example, at the head (for example, the top of the data D of each sector transferred from the memory I / F 17). Or add to the end). The insertion position of the validity flag F2 corresponds to the insertion position of the validity / invalidity flag F1, and when the validity / invalidity flag F1 is added to the beginning of the data, the validity flag F2 is added to the beginning of the data. When the / invalid flag F1 is added to the end of the data, the valid flag F2 is added to the end of the data. That is, the flag adding unit 16a adds the valid flag generating unit 16aa for generating the valid flag F2 and the generated valid flag F2 to the head of the data D, and the valid flag F2, the data D, the first ECC code (L1 And an adding unit 16ab for inputting the CRC to the ECC module 16b.

ECCモジュール16bは、有効フラグF2が付加された複数セクタのデータD1〜Dkのそれぞれに、第1のECC符号(L1)を用いた第1のECC処理(誤り訂正処理)におけるデコード処理を行う。ECCモジュール16bは、デコード処理の結果に応じて、第1のECC処理におけるエラー有無及び訂正位置情報をMPU2に通知する。   The ECC module 16b performs a decoding process in the first ECC process (error correction process) using the first ECC code (L1) on each of the data D1 to Dk of the plurality of sectors to which the valid flag F2 is added. The ECC module 16b notifies the MPU 2 of the presence / absence of error and the corrected position information in the first ECC process according to the result of the decoding process.

より具体的には、ECCモジュール16bは、有効フラグF2が付加された各セクタのデータに対して、その対応する第1のECC符号(L1)を用いて誤り訂正および復号化を行い、さらに対応する誤り検出符号(CRC)を用いて第1のECC符号(L1)の訂正能力以上の誤りが生じているか否かを判断する。すなわち、ECCモジュール16bは、各セクタデータについて、第1のECC処理が成功したか、あるいは失敗したかを判断する。   More specifically, the ECC module 16b performs error correction and decoding on the data of each sector to which the valid flag F2 is added using the corresponding first ECC code (L1), and further supports it. It is determined whether or not an error exceeding the correction capability of the first ECC code (L1) has occurred using the error detection code (CRC). That is, the ECC module 16b determines whether the first ECC processing has succeeded or failed for each sector data.

ECCモジュール16bは、第1のECC処理が成功である(エラー無し)と判断した場合に、この判断結果及び誤りビット発生位置(訂正位置情報)をMPU2に通知する。MPU2は、誤りビット発生位置が有効フラグF2のビット部分であるか否かを判定し、有効フラグF2のビット部分が正しいことを検出した場合、その有効フラグF2が付加されたセクタデータDが有効であると判定し、一方、有効フラグF2のビット部分が誤りであることを検出した場合、その有効フラグF2が付加されたセクタデータDが無効であると判定する。MPU2は、読出し命令に応答する際において、有効フラグF2が付加されたセクタデータDが無効であると判定した場合は、読み出しエラーをホストHAに通知する。また、ECCモジュール16bは、第1のECC処理が失敗である(エラー有り)と判断した場合は、この判断結果をMPU2に通知し、L2デコーダ20を活性化させるよう要求する。   When the ECC module 16b determines that the first ECC processing is successful (no error), the ECC module 16b notifies the MPU 2 of the determination result and the error bit occurrence position (corrected position information). The MPU 2 determines whether or not the error bit generation position is the bit part of the valid flag F2, and if the MPU 2 detects that the bit part of the valid flag F2 is correct, the sector data D to which the valid flag F2 is added is valid. On the other hand, when it is detected that the bit portion of the valid flag F2 is an error, it is determined that the sector data D to which the valid flag F2 is added is invalid. When the MPU 2 determines that the sector data D to which the valid flag F2 is added is invalid when responding to the read command, the MPU 2 notifies the read error to the host HA. If the ECC module 16b determines that the first ECC processing has failed (there is an error), the ECC module 16b notifies the MPU 2 of the determination result and requests the L2 decoder 20 to be activated.

第1のECC処理により訂正不能な誤りが生じている場合(L1−ECCエラー)、MPU2の制御によって、NANDコントローラ10の外部に配置されるL2デコーダ20には、クラスタを構成する複数のセクタデータD1〜Dk、第2のECC符号(L2)及びCRCが、バッファメモリ14、DMAコントローラ13、及び内部バス50を経由して転送される。   When an uncorrectable error has occurred due to the first ECC processing (L1-ECC error), a plurality of sector data constituting a cluster is stored in the L2 decoder 20 arranged outside the NAND controller 10 under the control of the MPU2. D1 to Dk, the second ECC code (L2), and the CRC are transferred via the buffer memory 14, the DMA controller 13, and the internal bus 50.

L2デコーダ20は、図5に示すように、フラグ付加部20a及びECCモジュール20bを有する。フラグ付加部20aは、“有効”に固定された有効フラグF2を、メモリI/F17から転送されたクラスタを構成する全てのセクタデータD1〜Dkに付加する。ECCモジュール20bは、有効フラグF2がそれぞれ付加された複数のセクタデータD1〜Dk、各CRCの全体に対して、第2のECC符号(L2)を用いた第2のECC処理(誤り訂正処理)におけるデコード処理を行う。   As shown in FIG. 5, the L2 decoder 20 includes a flag adding unit 20a and an ECC module 20b. The flag adding unit 20a adds the valid flag F2 fixed to “valid” to all the sector data D1 to Dk constituting the cluster transferred from the memory I / F 17. The ECC module 20b performs a second ECC process (error correction process) using the second ECC code (L2) on the plurality of sector data D1 to Dk and the entire CRCs to which the valid flag F2 is added, respectively. Perform the decoding process.

より具体的には、ECCモジュール20bは、第2のECC符号(L2)を用いて有効フラグ(有効を示す第2のフラグ)F2がそれぞれ付加された複数のセクタデータD1〜Dk、各CRCを含むクラスタ全体に対して誤り訂正および復号化を行い、さらに誤り検出符号(CRC)を用いて第2のECC符号(L2)の訂正能力以上の誤りが生じているか否かを判断する。すなわち、ECCモジュール20bは、第1のECC処理に失敗したセクタを含むクラスタについて、第2のECC処理が成功したか、あるいは失敗したかを判断する。   More specifically, the ECC module 20b uses the second ECC code (L2) to store a plurality of sector data D1 to Dk, each CRC to which a valid flag (second flag indicating validity) F2 is added. Error correction and decoding are performed on the entire cluster, and an error detection code (CRC) is used to determine whether an error exceeding the correction capability of the second ECC code (L2) has occurred. That is, the ECC module 20b determines whether the second ECC process has succeeded or failed for the cluster including the sector in which the first ECC process has failed.

ECCモジュール20bは、第2のECC処理が成功である(エラー無し)と判断した場合に、この判断結果及び誤りビット発生位置(訂正位置情報)をMPU2に通知する。MPU2は、誤りビット発生位置が有効フラグF2のビット部分であるか否かを判定し、有効フラグF2のビット部分が正しいことを検出した場合、その有効フラグF2が付加されたセクタデータDが有効であると判定し、一方、有効フラグF2のビット部分が誤りであることを検出した場合、その有効フラグF2が付加されたセクタデータDが無効であると判定する。MPU2は、読出し命令に応答する際において、有効フラグF2が付加されたセクタデータDが無効であると判定した場合は、読み出しエラーをホストHAに通知する。   When the ECC module 20b determines that the second ECC processing is successful (no error), the ECC module 20b notifies the MPU 2 of the determination result and the error bit occurrence position (corrected position information). The MPU 2 determines whether or not the error bit generation position is the bit part of the valid flag F2, and if the MPU 2 detects that the bit part of the valid flag F2 is correct, the sector data D to which the valid flag F2 is added is valid. On the other hand, when it is detected that the bit portion of the valid flag F2 is an error, it is determined that the sector data D to which the valid flag F2 is added is invalid. When the MPU 2 determines that the sector data D to which the valid flag F2 is added is invalid when responding to the read command, the MPU 2 notifies the read error to the host HA.

また、ECCモジュール20bは、第2のECC処理が失敗である(エラー有り)と判断した場合は、この判断結果をMPU2に通知する。MPU2は、読出し命令に応答する際において、第2のECC処理が失敗である(L2−ECCエラー)との判断結果を受信した場合、読み出しエラーをホストHAに通知する。更に、MPU2は、第2のECC処理に失敗したクラスタを構成する全てのセクタデータD1〜Dkについて、セレクト信号SLとして無効を選択した上で、L1/L2エンコーダ15によって有効/無効フラグF1を付加し、メモリI/F17を介してNANDメモリ30に書き込む。   Further, when the ECC module 20b determines that the second ECC processing has failed (there is an error), the ECC module 20b notifies the MPU 2 of the determination result. When the MPU 2 receives the determination result that the second ECC process is unsuccessful (L2-ECC error) when responding to the read command, the MPU 2 notifies the read error to the host HA. Further, the MPU 2 selects invalid as the select signal SL for all the sector data D1 to Dk constituting the cluster in which the second ECC processing has failed, and adds the valid / invalid flag F1 by the L1 / L2 encoder 15 Then, the data is written into the NAND memory 30 via the memory I / F 17.

MPU2は、NANDメモリ30に対してデータの書き込みを行う際、セクタ毎にセレクト信号SLを有効にするか無効にするかを決定し、その決定結果を命令制御部11、コマンド制御部12を介してL1/L2エンコーダ15に出力する。セレクト信号SLは、ホストHAからの書き込み要求にしたがって、ホストHAから入力されたデータをNANDメモリ10に書き込む際、ホストHAから入力されたデータに関しては、有効が選択される。すなわち、NANDメモリ10で未使用(データが記憶されていない)の論理アドレス(LBA)に対してホストHAから書き込みが発生したときや、クラスタ内の一部セクタの更新ではなくクラスタ全体の更新のためのNANDメモリ10に対する書き込みのときには、セレクト信号SLとして、有効が選択される。   When writing data to the NAND memory 30, the MPU 2 determines whether the select signal SL is enabled or disabled for each sector, and the determination result is sent via the instruction control unit 11 and the command control unit 12. To the L1 / L2 encoder 15. When the data input from the host HA is written to the NAND memory 10 in accordance with a write request from the host HA, the select signal SL is selected as valid for the data input from the host HA. That is, when a write occurs from the host HA to a logical address (LBA) that is not used (data is not stored) in the NAND memory 10 or when the entire cluster is updated instead of updating some sectors in the cluster. When writing to the NAND memory 10 for this purpose, valid is selected as the select signal SL.

また、クラスタ内の一部セクタの更新を行うときなど、NANDメモリ30の記憶データを読み取って、変更を加えて、書き戻すリード・モディファイ・ライト(RMW)の場合のNANDメモリ30への書き込みの際は、L1デコーダ16及びL2デコーダ20でのデコード結果に基づいて、NANDメモリ30から読み出したデータの各セクタが有効であるか無効であるかを判定し、その判定結果と、加えられる変更内容に基づいて有効を選択させるか無効を選択させるかを決定する。デコード結果に基づき有効と判定されたセクタは有効/無効フラグF1で有効を選択させ、無効と判定されたセクタは、このセクタにホストHAからの更新が発生していない限り、有効/無効フラグF1で無効を選択させる。したがって、リード・モディファイ・ライト時においては、L1デコーダ16及びL2デコーダ20でのデコード結果に基づいて得られた各セクタの有効/無効の判定結果は、NANDメモリ30から読み出されたデータが、有効/無効フラグF1が付加されて再度NANDメモリ30に再記憶されるまでは、例えばメモリ40などの記憶部に一時記憶させておく。   In addition, when updating some sectors in the cluster, the data stored in the NAND memory 30 is read, changed, and written back to the NAND memory 30 in the case of read-modify-write (RMW). In this case, it is determined whether each sector of the data read from the NAND memory 30 is valid or invalid based on the decoding results of the L1 decoder 16 and the L2 decoder 20, and the determination result and the change contents to be added Based on this, it is determined whether to select valid or invalid. A sector that is determined to be valid based on the decoding result is selected to be valid by the valid / invalid flag F1, and a sector that is determined to be invalid is valid / invalid flag F1 unless the sector HA has been updated. Use to select invalid. Therefore, at the time of read-modify-write, the validity / invalidity determination result of each sector obtained based on the decoding results of the L1 decoder 16 and the L2 decoder 20 Until the valid / invalid flag F1 is added and stored again in the NAND memory 30, it is temporarily stored in a storage unit such as the memory 40, for example.

次に、半導体記憶装置1のECC処理に関連した動作を、図7〜図9を用いて説明する。図7は、書き込み処理の動作を示すフローチャートであり、図8は、読み出し処理の動作を示すフローチャートであり、図9は、RMW(リード・モディファイ・ライト)処理の動作を示すフローチャートである。   Next, operations related to the ECC processing of the semiconductor memory device 1 will be described with reference to FIGS. FIG. 7 is a flowchart showing the operation of the writing process, FIG. 8 is a flowchart showing the operation of the reading process, and FIG. 9 is a flowchart showing the operation of the RMW (read-modify-write) process.

まず、図7を用いて書き込み処理の動作を説明する。まず、MPU2は、ホストHAから入力されたコマンドが書き込み命令であるか否かを判定し(ステップS1)、入力コマンドが書き込み命令である場合は、この書込み命令に含まれるLBAと、管理情報として例えばメモリ40に登録されているNANDメモリ10に既に記憶されているデータのLBAとを照合することにより、今回の書き込みが前述したリード・モディファイ・ライト(RMW)処理を必要とするか否かを判定し(ステップS2)、リード・モディファイ・ライト(RMW)処理を必要とすると判断した場合は、図9で説明するRMW処理を実行する(ステップS3)。   First, the operation of the writing process will be described with reference to FIG. First, the MPU 2 determines whether or not the command input from the host HA is a write command (step S1). If the input command is a write command, the LBA included in the write command and management information are determined. For example, by checking the LBA of data already stored in the NAND memory 10 registered in the memory 40, it is determined whether or not the current write requires the above-described read-modify-write (RMW) process. If it is determined (step S2) and it is determined that read-modify-write (RMW) processing is required, RMW processing described in FIG. 9 is executed (step S3).

MPU2は、今回の書き込みがリード・モディファイ・ライト(RMW)処理を必要とせず、例えば未使用のLBAに対する書き込みであると判断すると、ホストHAから通信I/F60を介して入力された書き込みデータを、メモリ40、DMAコントローラ13、バッファメモリ14を経由してL1/L2エンコーダ15に入力して、セレクト信号SLを有効側にする。この結果、L1/L2エンコーダ15のフラグ付加部15aにおいて、有効“0000h”を示す有効/無効フラグF1が書き込みデータのセクタデータD毎に付加される(ステップS4)。つぎに、L1/L2エンコーダ15のECCモジュール15bは、有効“0000h”を示す有効/無効フラグF1が付加されたセクタデータD毎にCRCおよび第1のECC符号(L1)を生成し、さらにクラスタ毎に第2のECC符号を生成する(ステップS5)。つぎに、ECC合成部15cは、DMAコントローラ13からバッファメモリ14を介して転送されたデータと、L1/L2エンコーダ15から供給されたCRC、第1および第2のECC符号(L1、L2)とをマージして(図6(b)参照)、メモリI/F17を介してNANDメモリ30に書き込む(ステップS6)。   When the MPU 2 determines that the current write does not require read-modify-write (RMW) processing, for example, writing to an unused LBA, the MPU 2 reads the write data input from the host HA via the communication I / F 60. The signal is input to the L1 / L2 encoder 15 via the memory 40, the DMA controller 13, and the buffer memory 14, and the select signal SL is set to the effective side. As a result, the flag adding unit 15a of the L1 / L2 encoder 15 adds a valid / invalid flag F1 indicating valid “0000h” for each sector data D of the write data (step S4). Next, the ECC module 15b of the L1 / L2 encoder 15 generates a CRC and a first ECC code (L1) for each sector data D to which a valid / invalid flag F1 indicating valid “0000h” is added. A second ECC code is generated every time (step S5). Next, the ECC combining unit 15c receives the data transferred from the DMA controller 13 via the buffer memory 14, the CRC supplied from the L1 / L2 encoder 15, and the first and second ECC codes (L1, L2). Are merged (see FIG. 6B) and written to the NAND memory 30 via the memory I / F 17 (step S6).

つぎに、図8を用いて読み出し処理の動作を説明する。MPU2は、ホストHAから入力されたコマンドが読み出し命令であるか否かを判定し(ステップS10)、入力コマンドが読み出し命令であると判定した場合は、NANDコントローラ10を制御して、読み出し命令によってアドレスが指定されたデータをNANDメモリ30から読み出させる(ステップS11)。NANDメモリ30からL1デコーダ16に読み出されたデータには、第1および第2のECC符号(L1、L2)が付加されている。   Next, the read processing operation will be described with reference to FIG. The MPU 2 determines whether or not the command input from the host HA is a read command (step S10). When the MPU 2 determines that the input command is a read command, the MPU 2 controls the NAND controller 10 to execute the read command. Data whose address is specified is read from the NAND memory 30 (step S11). First and second ECC codes (L1, L2) are added to the data read from the NAND memory 30 to the L1 decoder 16.

L1デコーダ16のフラグ付加部16aは、第1および第2のECC符号(L1、L2)が付加された読み出しデータに、有効“0000h”を示す有効フラグF2をセクタ毎に付加する(ステップS12)。L1デコーダ16のECCモジュール16bは、有効フラグF2が付加された各セクタデータDに、第1のECC符号(L1)を用いて誤り訂正復号処理を行う(ステップS13)。具体的には、ECCモジュール16bは、第1のECC符号(L1)を用いてセクタ毎に誤り訂正および復号化を行い、さらに誤り検出符号(CRC)を用いて第1のECC符号(L1)の訂正能力以上の誤りが生じているか否かをセクタ毎に判断する(ステップS14)。   The flag adding unit 16a of the L1 decoder 16 adds a valid flag F2 indicating valid “0000h” for each sector to the read data to which the first and second ECC codes (L1, L2) are added (step S12). . The ECC module 16b of the L1 decoder 16 performs error correction decoding processing on each sector data D to which the valid flag F2 is added using the first ECC code (L1) (step S13). Specifically, the ECC module 16b performs error correction and decoding for each sector using the first ECC code (L1), and further uses the error detection code (CRC) to generate the first ECC code (L1). It is determined for each sector whether or not an error exceeding the correction capability is generated (step S14).

L1デコーダ16のECCモジュール16bは、第1のECC符号(L1)を用いた誤り訂正に成功したと判断した場合に、この判断結果及び誤りビットの発生位置をMPU2に通知する。MPU2は、誤りビット発生位置が有効フラグF2のビット部分であるか否かを判定する(ステップS16)。MPU2は、有効フラグF2のビット部分が誤りであることを検出した場合は、その有効フラグF2が付加されたセクタデータDが無効であると判定し(ステップS17)、読み出しエラーをホストHAに通知する(ステップS18)。   When the ECC module 16b of the L1 decoder 16 determines that the error correction using the first ECC code (L1) has succeeded, the ECC module 16b notifies the MPU 2 of the determination result and the error bit generation position. The MPU 2 determines whether or not the error bit occurrence position is the bit portion of the valid flag F2 (step S16). When the MPU 2 detects that the bit portion of the valid flag F2 is in error, the MPU 2 determines that the sector data D to which the valid flag F2 is added is invalid (step S17), and notifies the read error to the host HA. (Step S18).

一方、MPU2は、有効フラグF2のビット部分が正しいことを検出した場合(ステップS16 NO)、その有効フラグF2が付加されたセクタデータDが有効であると判定し(ステップS19)、第1のECC符号(L1)による誤り訂正後のセクタデータDをメモリ40(キャッシュ領域41)、通信I/F60を介してホストHAに出力する(ステップS20)。   On the other hand, when the MPU 2 detects that the bit portion of the valid flag F2 is correct (NO in step S16), the MPU 2 determines that the sector data D to which the valid flag F2 is added is valid (step S19), The sector data D after error correction by the ECC code (L1) is output to the host HA via the memory 40 (cache area 41) and the communication I / F 60 (step S20).

一方、ECCモジュール16bは、第1のECC符号(L1)を用いた誤り訂正に失敗したと判断した場合は(ステップS14 NO)、MPU2に対してL2デコーダ20を活性化させるよう要求する。MPU2によって活性化されたL2デコーダ20のECCモジュール20bは、第2のECC符号(L2)を用いて有効フラグ(有効を示す第2のフラグ)F2がそれぞれ付加された複数のセクタデータD1〜Dk、各CRCを含むクラスタ全体に対して誤り訂正および復号化を行い、さらに誤り検出符号(CRC)を用いて第2のECC符号(L2)の訂正能力以上の誤りが生じているか否かを判断する(ステップS15)。   On the other hand, if the ECC module 16b determines that error correction using the first ECC code (L1) has failed (NO in step S14), the ECC module 16b requests the MPU 2 to activate the L2 decoder 20. The ECC module 20b of the L2 decoder 20 activated by the MPU 2 uses a second ECC code (L2) to add a plurality of sector data D1 to Dk to which a valid flag (second flag indicating validity) F2 is added. Then, error correction and decoding are performed on the entire cluster including each CRC, and it is further determined whether an error exceeding the correction capability of the second ECC code (L2) has occurred using the error detection code (CRC). (Step S15).

ECCモジュール20bは、第2のECC符号(L2)を用いた誤り訂正に成功したと判断した場合は、この判断結果及び誤りビット発生位置をMPU2に通知する。MPU2は、誤りビット発生位置が有効フラグF2のビット部分であるか否かを判定する(ステップS16)。MPU2は、有効フラグF2のビット部分が誤りであることを検出した場合は、その有効フラグF2が付加されたセクタデータDが無効であると判定し(ステップS17)、読み出しエラーをホストHAに通知する(ステップS18)。   If the ECC module 20b determines that the error correction using the second ECC code (L2) has succeeded, the ECC module 20b notifies the MPU 2 of the determination result and the error bit occurrence position. The MPU 2 determines whether or not the error bit occurrence position is the bit portion of the valid flag F2 (step S16). When the MPU 2 detects that the bit portion of the valid flag F2 is in error, the MPU 2 determines that the sector data D to which the valid flag F2 is added is invalid (step S17), and notifies the read error to the host HA. (Step S18).

一方、MPU2は、有効フラグF2のビット部分が正しいことを検出した場合(ステップS16 NO)、その有効フラグF2が付加されたセクタデータDが有効であると判定し(ステップS19)、第2のECC符号(L1)による誤り訂正後のセクタデータDをメモリ40(キャッシュ領域41)、通信I/F60を介してホストHAに出力する(ステップS20)。   On the other hand, when the MPU 2 detects that the bit portion of the valid flag F2 is correct (NO in step S16), the MPU 2 determines that the sector data D to which the valid flag F2 is added is valid (step S19). The sector data D after error correction by the ECC code (L1) is output to the host HA via the memory 40 (cache area 41) and the communication I / F 60 (step S20).

しかし、L2デコーダ20のECCモジュール20bは、第2のECC符号(L2)の訂正能力以上の誤りが生じていることを検出した場合(L2ECCエラー)は、その旨をMPU2に報告する。MPU2は、L2−ECCエラーを受信した場合、読み出しエラーをホストHAに通知する。更に、MPU2は、第2のECC処理に失敗したクラスタを構成する全てのセクタデータD1〜Dkについて、セレクト信号SLとして無効を選択した上で、L1/L2エンコーダ15によって有効/無効フラグF1を付加し、メモリI/F17を介してNANDメモリ30に書き込む(ステップS21)。   However, when the ECC module 20b of the L2 decoder 20 detects that an error exceeding the correction capability of the second ECC code (L2) has occurred (L2ECC error), the ECC module 20b reports that fact to the MPU2. When the MPU 2 receives the L2-ECC error, the MPU 2 notifies the read error to the host HA. Further, the MPU 2 selects invalid as the select signal SL for all the sector data D1 to Dk constituting the cluster in which the second ECC processing has failed, and adds the valid / invalid flag F1 by the L1 / L2 encoder 15 Then, the data is written into the NAND memory 30 via the memory I / F 17 (step S21).

つぎに、図9を用いてリード・モディファイ・ライト(RMW)処理の動作を説明する。MPU2は、今回の処理がRMW処理であるか否かを判定し(ステップS40)、RMW処理であると判断した場合は、NANDコントローラ10を制御して、該当するクラスタデータをNANDメモリ30から読み出させる(ステップS41)。L1デコーダ16のフラグ付加部16aは、第1および第2のECC符号(L1、L2)が付加された読み出しデータに、有効“0000h”を示す有効フラグF2をセクタ毎に付加する(ステップS42)。L1デコーダ16のECCモジュール16bは、有効フラグF2が付加された各セクタデータDに、前記同様、第1のECC符号(L1)を用いて誤り訂正復号処理を行い(ステップS43)、誤り検出符号(CRC)を用いて第1のECC符号(L1)の訂正能力以上の誤りが生じているか否かをセクタ毎に判断する(ステップS44)。   Next, the operation of the read-modify-write (RMW) process will be described with reference to FIG. The MPU 2 determines whether or not the current process is an RMW process (step S40). If the MPU 2 determines that the process is an RMW process, the MPU 2 controls the NAND controller 10 to read the corresponding cluster data from the NAND memory 30. (Step S41). The flag adding unit 16a of the L1 decoder 16 adds a valid flag F2 indicating valid “0000h” for each sector to the read data to which the first and second ECC codes (L1, L2) are added (step S42). . The ECC module 16b of the L1 decoder 16 performs error correction decoding processing on each sector data D to which the valid flag F2 is added using the first ECC code (L1) as described above (step S43), and an error detection code. It is determined for each sector whether or not an error exceeding the correction capability of the first ECC code (L1) has occurred using (CRC) (step S44).

L1デコーダ16のECCモジュール16bは、第1のECC符号(L1)を用いて誤り訂正が不可能と判断した場合は(ステップS44 NO)、MPU2に対してL2デコーダ20を活性化させるよう要求する。MPU2によって活性化されたL2デコーダ20のECCモジュール20bは、第2のECC符号(L2)を用いて有効フラグ(有効を示す第2のフラグ)F2がそれぞれ付加された複数のセクタデータD1〜Dk、各CRCを含むクラスタ全体に対して誤り訂正および復号化を行い、さらに誤り検出符号(CRC)を用いて第2のECC符号(L2)の訂正能力以上の誤りが生じているか否かを判断する(ステップS45)。L2デコーダ20のECCモジュール20bは、第2のECC符号(L2)の訂正能力以上の誤りが生じていることを検出した場合(L2ECCエラー)は、その旨をMPU2に報告する。MPU2は、L2−ECCエラーを受信した場合、そのクラスタを無効にするべく、当該クラスタを構成する全てのセクタデータD1〜Dkにそれぞれ対応するフラグF2部分での判定結果を無効に設定する(ステップS53)。   If the ECC module 16b of the L1 decoder 16 determines that error correction is impossible using the first ECC code (L1) (NO in step S44), it requests the MPU2 to activate the L2 decoder 20. . The ECC module 20b of the L2 decoder 20 activated by the MPU 2 uses a second ECC code (L2) to add a plurality of sector data D1 to Dk to which a valid flag (second flag indicating validity) F2 is added. Then, error correction and decoding are performed on the entire cluster including each CRC, and it is further determined whether an error exceeding the correction capability of the second ECC code (L2) has occurred using the error detection code (CRC). (Step S45). When the ECC module 20b of the L2 decoder 20 detects that an error exceeding the correction capability of the second ECC code (L2) has occurred (L2ECC error), the ECC module 20b reports that fact to the MPU2. When the MPU 2 receives the L2-ECC error, the MPU 2 invalidates the determination result in the flag F2 portion corresponding to all the sector data D1 to Dk constituting the cluster in order to invalidate the cluster (Step S1). S53).

L1デコーダ16またはL2デコーダ20の何れかによって誤り訂正が可能である場合は、L1デコーダ16(またはL2デコーダ20)は、エラーの有無およびエラービット位置情報をMPU2に通知する。MPU2は、エラービット位置情報によって有効フラグF2のビット部分が誤りであるか否かを判定し(ステップS46)、有効フラグF2のビット部分が誤りであることを検出した場合は、その有効フラグF2が付加されたセクタデータDが無効であると判定し(ステップS47)、有効フラグF2のビット部分が正しいことを検出した場合、その有効フラグF2が付加されたセクタデータDが有効であると判定する(ステップS48)。クラスタ内の各セクタについてのフラグ判定結果は、前述したように一時記憶しておく。   When error correction is possible by either the L1 decoder 16 or the L2 decoder 20, the L1 decoder 16 (or L2 decoder 20) notifies the MPU 2 of the presence / absence of an error and error bit position information. The MPU 2 determines whether or not the bit portion of the valid flag F2 is an error based on the error bit position information (step S46). When the MPU 2 detects that the bit portion of the valid flag F2 is an error, the valid flag F2 Is determined to be invalid (step S47), and when it is detected that the bit portion of the valid flag F2 is correct, it is determined that the sector data D to which the valid flag F2 is added is valid. (Step S48). The flag determination result for each sector in the cluster is temporarily stored as described above.

L1デコーダ16(またはL2デコーダ20)で処理された各セクタデータは、バッファメモリ14、DMAコントローラ13を介してメモリ40の作業領域42に書き込まれ、メモリ40の作業領域42で、ホストHAから受信した更新データ(書き込みデータ)との置換処理が実行され、図4(b)に示したような、組み合わせデータが形成される(ステップS49)。MPU2は、一時記憶していたフラグ判定結果のうちのホストHAから受信した更新データに対応するセクタに対応するフラグ判定結果を有効に変更し(ステップS50)、変更したフラグを有効/無効フラグF1として各セクタに付加してL1/L2符号化を行わせる(ステップS51)。すなわち、メモリ40の作業領域42で作成した組み合わせデータを、DMAコントローラ13,バッファメモリ14を経由してL1/L2エンコーダ15に入力して、各セクタの無効/有効に応じてセレクト信号SLを切り替えることでL1/L2エンコーダ15において、有効“0000h”または無効“0001h”を示す有効/無効フラグF1を書き込みデータのセクタデータD毎に付加し、さらに有効/無効フラグF1が付加された各セクタデータD毎にCRCおよび第1のECC符号(L1)を生成し、さらにクラスタ毎に第2のECC符号を生成する。そして、生成したCRC、第1および第2のECC符号(L1、L2)を、バッファメモリ14を介して転送されたデータとマージして、メモリI/F17を介してNANDメモリ30に書き込む(ステップS52)。   Each sector data processed by the L1 decoder 16 (or L2 decoder 20) is written to the work area 42 of the memory 40 via the buffer memory 14 and the DMA controller 13, and is received from the host HA by the work area 42 of the memory 40. The replacement process with the updated data (write data) is executed, and combination data as shown in FIG. 4B is formed (step S49). The MPU 2 effectively changes the flag determination result corresponding to the sector corresponding to the update data received from the host HA among the flag determination results stored temporarily (step S50), and sets the changed flag as the valid / invalid flag F1. Are added to each sector to perform L1 / L2 encoding (step S51). That is, the combination data created in the work area 42 of the memory 40 is input to the L1 / L2 encoder 15 via the DMA controller 13 and the buffer memory 14, and the select signal SL is switched according to the invalidity / validity of each sector. Thus, in the L1 / L2 encoder 15, the valid / invalid flag F1 indicating valid “0000h” or invalid “0001h” is added for each sector data D of the write data, and each sector data to which the valid / invalid flag F1 is further added. A CRC and a first ECC code (L1) are generated for each D, and a second ECC code is generated for each cluster. Then, the generated CRC, the first and second ECC codes (L1, L2) are merged with the data transferred via the buffer memory 14 and written to the NAND memory 30 via the memory I / F 17 (step S52).

図4に示したような、無効なセクタ部分に対する一部更新処理が発生した場合の本実施の形態でRMW動作は次のようになる。図4(a)に示した無効セクタは、L1デコーダ16またはL2デコーダ20でのデコード処理によって検出される。すなわち、L1デコーダ16またはL2デコーダ20でのデコード処理の際に誤り訂正不可能になり、L2ECCエラーが発生することにより、MPU2で無効セクタ化(invalid化)される。この結果、これらの無効セクタには、L1/L2エンコーダ15で無効を示す有効/無効フラグF1が付加されてエンコード処理が行われ、それらのエンコード結果が各セクタに付加されてNANDメモリ30に書き込まれる。   In the present embodiment when the partial update process for the invalid sector portion as shown in FIG. 4 occurs, the RMW operation is as follows. The invalid sector shown in FIG. 4A is detected by the decoding process in the L1 decoder 16 or the L2 decoder 20. That is, error correction becomes impossible during the decoding process in the L1 decoder 16 or the L2 decoder 20, and an L2 ECC error occurs, whereby the MPU2 invalidates (invalidates). As a result, the invalid / invalid flag F1 indicating invalidity is added to the invalid sectors by the L1 / L2 encoder 15 to perform encoding processing, and the encoding results are added to each sector and written to the NAND memory 30. It is.

このような状態で、複数の連続した無効セクタの一部に図4(b)に示すような更新が発生したとする。このような場合、MPU2では、リード・モディファイ・ライト動作を実行する。すなわち、まず、更新セクタを含むクラスタを含むページまたはブロックをNANDメモリ30からリードする。リードされたデータは、L1デコーダ16及びL2デコーダ20で、リードされた各セクタに有効フラグF2が付加される前述のデコード処理が行われ、この結果有効フラグF2部分に誤りがあるとして検出され、これによりMPU2は、これらリードされたセクタは誤り訂正不可能な無効セクタであると判定する。   In such a state, it is assumed that an update as shown in FIG. 4B occurs in a part of a plurality of consecutive invalid sectors. In such a case, the MPU 2 performs a read / modify / write operation. That is, first, a page or block including a cluster including an update sector is read from the NAND memory 30. The read data is subjected to the above-described decoding process in which the valid flag F2 is added to each read sector by the L1 decoder 16 and the L2 decoder 20, and as a result, the valid flag F2 portion is detected as having an error, Accordingly, the MPU 2 determines that these read sectors are invalid sectors that cannot be corrected for errors.

無効と判定されたセクタは、バッファメモリ14、DMAコントローラ13を介してメモリ40の作業領域42に書き込まれ、メモリ40の作業領域42で、ホストHAから受信した更新データと組み合わされて、図4(b)に示すような、組み合わせデータが形成される。この組み合わせデータは、メモリ40の作業領域42からDMAコントローラ13、バッファメモリ14に転送される。   The sector determined to be invalid is written into the work area 42 of the memory 40 via the buffer memory 14 and the DMA controller 13, and is combined with the update data received from the host HA in the work area 42 of the memory 40, as shown in FIG. Combination data as shown in (b) is formed. This combination data is transferred from the work area 42 of the memory 40 to the DMA controller 13 and the buffer memory 14.

MPU2は、組み合わせデータ中の無効セクタ部分については、有効/無効フラグF1の無効フラグを選択し、更新セクタ部分については、有効/無効フラグF1の有効フラグを選択するよう、NANDコントローラ10の命令制御部11に指令を与える。この結果、L1/L2エンコーダ15では、無効セクタには、無効の有効/無効フラグF1を付加してECC符号を作成し、更新セクタには有効の有効/無効フラグF1を付加してECC符号を作成し、作成した各ECC符号を該当セクタにそれぞれ付加してNANDメモリ30の新たなページまたはブロックに書き込む。したがって、このような有効セクタ及び無効セクタが組み合わされたデータをリードした際には、L1デコーダ16及びL2デコーダ20で前述のデコード処理が行われることにより、各セクタが有効であるか無効であるかを適正に判別することが可能となる。   The MPU 2 controls the NAND controller 10 to select the invalid flag of the valid / invalid flag F1 for the invalid sector portion in the combination data and to select the valid flag of the valid / invalid flag F1 for the updated sector portion. Commands are given to part 11. As a result, the L1 / L2 encoder 15 creates an ECC code by adding an invalid valid / invalid flag F1 to an invalid sector, and adds an valid valid / invalid flag F1 to an updated sector and adds an ECC code. The created ECC code is added to the corresponding sector and written to a new page or block of the NAND memory 30. Accordingly, when data in which such a valid sector and invalid sector are combined is read, the above-described decoding process is performed by the L1 decoder 16 and the L2 decoder 20 so that each sector is valid or invalid. It is possible to properly determine whether or not.

図10は、有効/無効フラグF1が、ECC処理単位における未使用領域を効率的に利用して付加され得ることを示すものである。図10では、L1/L2エンコーダ15は、データ部分及びCRC部分に、更に未使用領域「DR」を加えたデータを処理単位として、第1のECC処理を行う。ここで未使用領域とは、エンコード処理及びデコード処理において使用されるが、実際にはNANDメモリ30に書き込まれないデータのことである。なお、未使用領域の一部データについては、実際にNANDメモリ30に書き込んでも良い。このような未使用領域は、ECC処理単位にデータ部分以外のCRC部分等を含める場合に端数として発生し得る。本実施形態では、例えば、この様なECC処理単位における未使用領域の少なくとも一部のビットを、有効/無効フラグF1として利用することができる。この場合、元々活用されていなかったECC処理単位内の未使用領域を効率的に利用することができる。   FIG. 10 shows that the valid / invalid flag F1 can be added by efficiently using an unused area in the ECC processing unit. In FIG. 10, the L1 / L2 encoder 15 performs the first ECC processing using data obtained by adding an unused area “DR” to the data portion and the CRC portion as a processing unit. Here, the unused area is data that is used in the encoding process and the decoding process, but is not actually written in the NAND memory 30. Note that some data in the unused area may actually be written in the NAND memory 30. Such an unused area may be generated as a fraction when a CRC part other than the data part is included in the ECC processing unit. In the present embodiment, for example, at least some bits of the unused area in such an ECC processing unit can be used as the valid / invalid flag F1. In this case, an unused area in the ECC processing unit that has not been used originally can be used efficiently.

未使用領域内の各ビットには、例えば、仮想的に“0”データを割り当てることでデコード処理がなされる。この場合、本実施形態では、有効フラグ表すビットについても同様に“0”データ(“0000h”)に設定する。これにより、エンコード処理時に有効フラグをセットしてECC処理を行った有効データについては通常通りデコード処理が実行され、エンコード処理時に無効フラグをセットしてECC処理を行った無効データについては、未使用領域内のフラグ位置に誤りが検出されることで、有効データ/無効データを判別することが可能になる。従って、ECC処理単位における未使用領域の少なくとも一部のビットを仮想的な有効/無効フラグとして効率的に利用することが可能になる。   Each bit in the unused area is decoded, for example, by virtually assigning “0” data. In this case, in this embodiment, the bit representing the valid flag is similarly set to “0” data (“0000h”). As a result, the valid data that has been subjected to ECC processing by setting the valid flag during the encoding process is decoded as usual, and the invalid data that has been subjected to ECC processing by setting the invalid flag during the encoding process is unused. By detecting an error at the flag position in the area, it is possible to determine valid data / invalid data. Therefore, it is possible to efficiently use at least some bits of the unused area in the ECC processing unit as a virtual valid / invalid flag.

以上のように、本実施の形態においては、ECC符号生成時に、データに加え、データの有効/無効を識別する仮想的なフラグについても処理単位に含める。NANDメモリ30への書き込み時にはECC演算で使用したフラグは対象としない。NANDメモリ30からの読み出し時には、上記フラグ情報は書き込んでいないため存在しないので、仮に有効フラグが付与されているものとしてECC演算を行う。ECC演算結果として、当該フラグに誤りがあるとして検出された場合は無効データとして扱い、当該フラグに誤りがなければ有効データとして扱うことができる。   As described above, in the present embodiment, at the time of ECC code generation, in addition to data, a virtual flag for identifying validity / invalidity of data is also included in the processing unit. At the time of writing to the NAND memory 30, the flag used in the ECC calculation is not targeted. At the time of reading from the NAND memory 30, the flag information does not exist because it has not been written, so an ECC operation is performed assuming that a valid flag is provided. If the flag is detected as having an error as an ECC calculation result, it can be treated as invalid data, and if the flag has no error, it can be treated as valid data.

セクタデータの有効/無効を示す有効/無効フラグF1をセクタデータに付加してECC処理を行うことにより、ECC符号(L1、L2)を生成するので、ECC処理単位における未使用領域にフラグF1の値を示す情報(セクタデータの有効/無効を示す情報)を含ませることができる。そして、そのように生成されたECC符号(L1、L2)をセクタデータに付加してNANDメモリ30へ書き込むので、セクタデータの有効/無効を管理するための情報により、NANDメモリ30の記憶領域が消費されないようにすることができる。ここで、データ+付加情報の組でECC符号化処理を行うが、NANDメモリ30に対してはデータのみ、もしくはデータ+付加情報の一部のみを書き込み対象として取り扱い、読み出し時は削除した付加情報を予め準備した値で補完してECC復号処理を行う。   The ECC code (L1, L2) is generated by adding the valid / invalid flag F1 indicating the validity / invalidity of the sector data to the sector data, so that the ECC code (L1, L2) is generated. Information indicating a value (information indicating validity / invalidity of sector data) can be included. Then, since the ECC code (L1, L2) generated in this way is added to the sector data and written to the NAND memory 30, the storage area of the NAND memory 30 is determined by information for managing the validity / invalidity of the sector data. It can be prevented from being consumed. Here, ECC encoding processing is performed with a set of data + additional information, but only the data or only a part of the data + additional information is treated as a write target for the NAND memory 30, and the additional information deleted at the time of reading. Is complemented with a value prepared in advance to perform ECC decoding processing.

また、セクタデータとECC符号との組を複数含むデータをNANDメモリから読み出し、有効に固定された有効フラグF2を読み出されたセクタデータ毎に付加し、読み出された(フラグF1の値を示す情報が含まれた)ECC符号を用いたECC処理を有効フラグF2が付加されたセクタデータに対して行う。これにより、有効フラグF2が誤りであるか否かを検出して、エンコード処理時に付加した有効/無効フラグF1の値を推定することができる。すなわち、ECC処理により有効フラグF2が誤りであることを検出した場合、有効フラグF2が付加されたセクタデータが無効であると判定することができる。また、ECC処理により有効フラグF2が正しいことを検出した場合、有効フラグF2が付加されたセクタデータが有効であると判定することができる。   Also, data including a plurality of sets of sector data and ECC codes is read from the NAND memory, and a valid flag F2 that is effectively fixed is added to each read sector data and read (the value of the flag F1 is changed). ECC processing using an ECC code (including information indicating the above) is performed on the sector data to which the valid flag F2 is added. As a result, it is possible to detect whether the validity flag F2 is an error and to estimate the value of the validity / invalidity flag F1 added during the encoding process. That is, when it is detected by ECC processing that the valid flag F2 is incorrect, it can be determined that the sector data to which the valid flag F2 is added is invalid. Further, when it is detected by the ECC process that the valid flag F2 is correct, it can be determined that the sector data to which the valid flag F2 is added is valid.

したがって、第1の実施の形態によれば、NANDメモリ30の記憶領域を消費することなく、セクタデータの有効/無効を管理することができる。例えば、バッドクラスタテーブル、及びバッドクラスタテーブルに登録されたクラスタを構成する各セクタの有効/無効を示すセクタビットマップ等を作成する必要が無くなる。   Therefore, according to the first embodiment, the validity / invalidity of the sector data can be managed without consuming the storage area of the NAND memory 30. For example, it is not necessary to create a bad cluster table and a sector bitmap indicating the validity / invalidity of each sector constituting a cluster registered in the bad cluster table.

なお、本実施の形態では、2段階のECC処理(L1、L2)を行うようにしたが、第1のECC処理(L1)及び第2のECC処理(L2)のいずれか一方のみを行うようにしてもよい。あるいは、第1のECC処理および第2のECC処理とは異なるフォーマットで誤り訂正符号を生成し、3段階以上のECC処理を行うようにしてもよい。   In this embodiment, the two-stage ECC processing (L1, L2) is performed, but only one of the first ECC processing (L1) and the second ECC processing (L2) is performed. It may be. Alternatively, an error correction code may be generated in a format different from the first ECC process and the second ECC process, and three or more stages of ECC processes may be performed.

また、上記実施の形態では、L1デコーダ16、L2デコーダ20で使用するフラグF2として、有効フラグを採用したが、無効フラグを採用してもよい。この場合、MPU2は、ECC処理により無効フラグ(無効に固定された第2のフラグ)F2のビット部分が誤りであることを検出した場合、無効フラグF2が付加されたセクタデータDが有効であると判定する。MPU2は、ECC処理により無効フラグF2のビット部分が正しいことを検出した場合、無効フラグF2が付加されたセクタデータDが無効であると判定する。   In the above embodiment, the valid flag is employed as the flag F2 used in the L1 decoder 16 and the L2 decoder 20, but an invalid flag may be employed. In this case, if the MPU 2 detects that the bit portion of the invalid flag (second flag fixed to invalid) F2 is erroneous by the ECC process, the sector data D to which the invalid flag F2 is added is valid. Is determined. When the MPU 2 detects that the bit portion of the invalid flag F2 is correct by the ECC processing, the MPU 2 determines that the sector data D to which the invalid flag F2 is added is invalid.

1 半導体記憶装置、 2 MPU、 10 NANDコントローラ、 11 命令制御部、 12 コマンド制御部、 13 DMAコントローラ、 14 バッファメモリ、 15 L1/L2エンコーダ、 15a フラグ付加部、 15aa セレクタ、 15ab 付加部、 15b ECCモジュール、 15c ECC合成部、 16 L1デコーダ、 16a フラグ付加部、 16aa 有効フラグ発生部、 16ab 付加部、 16b ECCモジュール、 17 メモリI/F、 20 L2デコーダ、 20a フラグ付加部、 20b ECCモジュール、 30 NANDメモリ、 40 メモリ、 41 キャッシュ領域、 42 作業領域、 50 内部バス、 60 通信I/F、 70 制御部、 71 書き込み制御部、 72 読み出し制御部、 F1、F11〜F1k 有効/無効フラグ、 F2 有効フラグ   DESCRIPTION OF SYMBOLS 1 Semiconductor memory device, 2 MPU, 10 NAND controller, 11 Command control part, 12 Command control part, 13 DMA controller, 14 Buffer memory, 15 L1 / L2 encoder, 15a Flag addition part, 15aa selector, 15ab addition part, 15b ECC Module, 15c ECC synthesis unit, 16 L1 decoder, 16a flag addition unit, 16aa valid flag generation unit, 16ab addition unit, 16b ECC module, 17 memory I / F, 20 L2 decoder, 20a flag addition unit, 20b ECC module, 30 NAND memory, 40 memory, 41 cache area, 42 work area, 50 internal bus, 60 communication I / F, 70 control unit, 71 write control unit, 72 read control Control, F1, F11-F1k valid / invalid flag, F2 valid flag

Claims (7)

データを記憶する不揮発性メモリと、
前記不揮発性メモリへのデータの書き込みと前記不揮発性メモリからのデータの読み出しとを制御する制御部と、
を備え、
前記制御部は、
データが有効であるのか無効であるのかを示す第1のフラグをデータに付加して誤り訂正処理を行うことにより生成された誤り訂正符号を前記データに付加して前記不揮発性メモリへ書き込む書き込み制御部と、
前記データと前記誤り訂正符号とを前記不揮発性メモリから読み出し、有効及び無効の何れか一方に固定された第2のフラグを前記読み出されたデータに付加し、前記読み出された誤り訂正符号を用いた誤り訂正処理を前記第2のフラグが付加されたデータに対して行う読み出し制御部と、
を有する
ことを特徴とする半導体記憶装置。
Non-volatile memory for storing data;
A control unit that controls writing of data to the nonvolatile memory and reading of data from the nonvolatile memory;
With
The controller is
Write control for adding an error correction code generated by adding a first flag indicating whether the data is valid or invalid to the data and performing error correction processing to the data and writing to the nonvolatile memory And
The data and the error correction code are read from the nonvolatile memory, a second flag fixed to either valid or invalid is added to the read data, and the read error correction code A read control unit that performs error correction processing on the data with the second flag added thereto;
A semiconductor memory device comprising:
前記読み出し制御部は、誤り訂正処理により有効に固定された前記第2のフラグが誤りであることを検出した場合、又は誤り訂正処理により無効に固定された前記第2のフラグが正しいことを検出した場合、前記第2のフラグが付加されたデータが無効であると判定し、誤り訂正処理により有効に固定された前記第2のフラグが正しいことを検出した場合、又は誤り訂正処理により無効に固定された前記第2のフラグが誤りであることを検出した場合、前記第2のフラグが付加されたデータが有効であると判定し、
前記書き込み制御部は、前記読み出し制御部により無効であると判定されたデータに、無効であることを示す前記第1のフラグを付加し、前記読み出し制御部により有効であると判定されたデータに、有効であることを示す前記第1のフラグを付加する
ことを特徴とする請求項1に記載の半導体記憶装置。
The read control unit detects that the second flag effectively fixed by the error correction process is an error, or detects that the second flag fixed invalid by the error correction process is correct If it is determined that the data to which the second flag has been added is invalid and it is detected that the second flag, which is effectively fixed by error correction processing, is correct, or invalidated by error correction processing. When it is detected that the fixed second flag is an error, it is determined that the data with the second flag added is valid;
The write control unit adds the first flag indicating invalidity to data determined to be invalid by the read control unit, and sets the data determined to be valid by the read control unit. 2. The semiconductor memory device according to claim 1, wherein the first flag indicating validity is added.
前記書き込み制御部は、ホスト装置から入力されたデータを前記不揮発性メモリへ書き込む場合は、書き込むデータに有効であることを示す前記第1のフラグを付加する
ことを特徴とする請求項2に記載の半導体記憶装置。
The write control unit, when writing data input from a host device into the nonvolatile memory, adds the first flag indicating that the data is valid for the write data. Semiconductor memory device.
不揮発性メモリへのデータの書き込み及び前記不揮発性メモリからのデータの読み出しを制御する制御装置であって、
データが有効であるのか無効であるのかを示す第1のフラグをデータに付加して誤り訂正処理を行うことにより生成された誤り訂正符号を前記データに付加して前記不揮発性メモリへ書き込む書き込み制御部と、
前記データと前記誤り訂正符号とを前記不揮発性メモリから読み出し、有効及び無効の何れか一方に固定された第2のフラグを前記読み出されたデータに付加し、前記読み出された誤り訂正符号を用いた誤り訂正処理を前記第2のフラグが付加されたデータに対して行う読み出し制御部と、
を有する
ことを特徴とする制御装置。
A control device for controlling writing of data to a nonvolatile memory and reading of data from the nonvolatile memory,
Write control for adding an error correction code generated by adding a first flag indicating whether the data is valid or invalid to the data and performing error correction processing to the data and writing to the nonvolatile memory And
The data and the error correction code are read from the nonvolatile memory, a second flag fixed to either valid or invalid is added to the read data, and the read error correction code A read control unit that performs error correction processing on the data with the second flag added thereto;
A control device comprising:
前記読み出し制御部は、誤り訂正処理により有効に固定された前記第2のフラグが誤りであることを検出した場合、又は誤り訂正処理により無効に固定された前記第2のフラグが正しいことを検出した場合、前記第2のフラグが付加されたデータが無効であると判定し、誤り訂正処理により有効に固定された前記第2のフラグが正しいことを検出した場合、又は誤り訂正処理により無効に固定された前記第2のフラグが誤りであることを検出した場合、前記第2のフラグが付加されたデータが有効であると判定し、
前記書き込み制御部は、前記読み出し制御部により無効であると判定されたデータに、無効であることを示す前記第1のフラグを付加し、前記読み出し制御部により有効であると判定されたデータに、有効であることを示す前記第1のフラグを付加する
ことを特徴とする請求項4に記載の制御装置。
The read control unit detects that the second flag effectively fixed by the error correction process is an error, or detects that the second flag fixed invalid by the error correction process is correct If it is determined that the data to which the second flag has been added is invalid and it is detected that the second flag, which is effectively fixed by error correction processing, is correct, or invalidated by error correction processing. When it is detected that the fixed second flag is an error, it is determined that the data with the second flag added is valid;
The write control unit adds the first flag indicating invalidity to data determined to be invalid by the read control unit, and sets the data determined to be valid by the read control unit. The control device according to claim 4, wherein the first flag indicating that it is valid is added.
前記書き込み制御部は、ホスト装置から入力されたデータを前記不揮発性メモリへ書き込む場合は、書き込むデータに有効であることを示す前記第1のフラグを付加する
ことを特徴とする請求項5に記載の制御装置。
The write control unit, when writing data input from a host device to the nonvolatile memory, adds the first flag indicating that the data is valid for the write data. Control device.
データを記憶する不揮発性メモリを有する半導体記憶装置の制御方法であって、
前記不揮発性メモリへ書き込むべきデータが有効であるのか無効であるのかを示す第1のフラグを前記書き込むべきデータに付加して誤り訂正処理を行うことにより誤り訂正符号を生成する第1のステップと、
前記書き込むべきデータに前記第1のステップで生成された誤り訂正符号を付加して前記不揮発性メモリへ書き込む第2のステップと、
前記データと前記誤り訂正符号とを前記不揮発性メモリから読み出す第3のステップと、
有効及び無効の何れか一方に固定された第2のフラグを前記第3のステップで読み出されたデータに付加して、前記第3のステップで読み出された誤り訂正符号を用いた誤り訂正処理を前記第2のフラグが付加されたデータに対して行う第4のステップと、
有効に固定された前記第2のフラグが誤りであることを検出した場合、又は無効に固定された前記第2のフラグが正しいことを検出した場合、前記第2のフラグが付加されたデータが無効であると判定し、有効に固定された前記第2のフラグが正しいことを検出した場合、又は無効に固定された前記第2のフラグが誤りであることを検出した場合、前記第2のフラグが付加されたデータが有効であると判定する第5のステップと、
を備えたことを特徴とする半導体記憶装置の制御方法。
A method for controlling a semiconductor memory device having a nonvolatile memory for storing data,
A first step of generating an error correction code by performing error correction processing by adding a first flag indicating whether data to be written to the nonvolatile memory is valid or invalid to the data to be written; ,
A second step of adding the error correction code generated in the first step to the data to be written and writing to the nonvolatile memory;
A third step of reading the data and the error correction code from the nonvolatile memory;
Error correction using the error correction code read in the third step by adding a second flag fixed to either valid or invalid to the data read in the third step A fourth step of performing processing on the data to which the second flag is added;
When it is detected that the second flag fixed to valid is an error, or when the second flag fixed to invalid is detected to be correct, the data to which the second flag is added is When it is determined that the second flag fixed to be valid is correct, or when the second flag fixed to be invalid is detected to be erroneous, the second flag is determined to be invalid. A fifth step of determining that the data to which the flag is added is valid;
A method of controlling a semiconductor memory device, comprising:
JP2010159685A 2010-07-14 2010-07-14 Semiconductor storage device, control device, and method for controlling semiconductor storage device Pending JP2012022508A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010159685A JP2012022508A (en) 2010-07-14 2010-07-14 Semiconductor storage device, control device, and method for controlling semiconductor storage device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010159685A JP2012022508A (en) 2010-07-14 2010-07-14 Semiconductor storage device, control device, and method for controlling semiconductor storage device

Publications (1)

Publication Number Publication Date
JP2012022508A true JP2012022508A (en) 2012-02-02

Family

ID=45776753

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010159685A Pending JP2012022508A (en) 2010-07-14 2010-07-14 Semiconductor storage device, control device, and method for controlling semiconductor storage device

Country Status (1)

Country Link
JP (1) JP2012022508A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9170934B2 (en) 2012-06-14 2015-10-27 Kabushiki Kaisha Toshiba Server and drive control device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9170934B2 (en) 2012-06-14 2015-10-27 Kabushiki Kaisha Toshiba Server and drive control device

Similar Documents

Publication Publication Date Title
US8281065B2 (en) Systems and methods for determining the status of memory locations in a non-volatile memory
US9135112B2 (en) Policy for read operations addressing on-the-fly decoding failure in non-volatile memory
US7437597B1 (en) Write-back cache with different ECC codings for clean and dirty lines with refetching of uncorrectable clean lines
KR101730510B1 (en) Non-regular parity distribution detection via metadata tag
JP4901987B1 (en) Storage device, electronic device, and error data correction method
JP5202130B2 (en) Cache memory, computer system, and memory access method
TWI703499B (en) Data storage device and method for sharing memory of controller thereof
US20130191705A1 (en) Semiconductor storage device
JP2012234363A (en) Memory system
JP2015018451A (en) Memory controller, storage device, and memory control method
JP2012155430A (en) Memory system and operation method thereof
JP2011165063A (en) Semiconductor storage device
JP2011081776A (en) Nonvolatile memory apparatus, memory controller, and memory system
JP2011198272A (en) Semiconductor storage device and control method thereof
JP2011180831A (en) Semiconductor memory device
JP2009301194A (en) System for controlling semiconductor memory device
JP2016143085A (en) Device and method
WO2015102035A1 (en) Techniques for storing data in bandwidth optimized or coding rate optimized code words based on data access frequency
JP7177338B2 (en) MEMORY CONTROLLER DEVICE, MEMORY DEVICE HAVING MEMORY CONTROLLER DEVICE, AND MEMORY CONTROL METHOD
TWI550627B (en) Storage device and operating method thereof
JP2012003569A (en) Memory controller, flash memory system including memory controller, and method of controlling flash memory
JP2012022508A (en) Semiconductor storage device, control device, and method for controlling semiconductor storage device
US11182231B2 (en) Host system and computing system including the host system
CN114333968A (en) Memory control method, memory controller and electronic device
US10922025B2 (en) Nonvolatile memory bad row management