Embodiments described herein relate generally to a memory controller, a storage device, and a memory control method.
There is a method of doubly protecting data stored in a NAND flash memory (hereinafter referred to as a NAND memory) by two-stage error-correction coding.
In general, according to one embodiment, a memory controller according to an embodiment includes an encoding unit which performs 1st stage error-correction coding on 1st data, performs 2nd stage error-correction coding on 2nd data, and performs 3rd stage error-correction coding on 3rd data, the 1st data including 4 sub-unit data included in 1st unit data, the 2nd data including 4 sub-unit data included in the 1st data and 2nd data, and the 3rd data including 4 sub-unit data included in the 1st to 4th unit data.
Exemplary embodiments of a memory controller, a storage device, a memory control method will be explained below in detail with reference to the accompanying drawings. The present invention is not limited to the following embodiments.
The semiconductor memory unit 3 is a nonvolatile memory configured to store data in a nonvolatile manner. The semiconductor memory unit 3 is, for example, a NAND memory. In this embodiment, a NAND memory is used as the semiconductor memory unit 3. However, a storage unit other than the NAND memory can be used as the semiconductor memory unit 3. The NAND memory generally writes and reads data in a page unit.
The memory controller 2 controls writing to the semiconductor memory unit 3 in accordance with a write command (request) from the host 4. The memory controller 2 also controls reading from the semiconductor memory unit 3 in accordance with a read command (request) from the host 4. The memory controller 2 includes a Host I/F 21 (first interface unit), a memory I/F (second interface unit) 22, a control unit 23, an encoding/decoding unit 24, and a data buffer 27, these of which are interconnected with an internal bus 20. The encoding/decoding unit 24 includes an encoding unit 25 and a decoding unit 26.
The Host I/F 21 outputs a command or user data received from the host 4 to the internal bus 20. The Host I/F 21 also transmits user data read from the semiconductor memory unit 3 or a response from the control unit 23 to the host 4.
The memory I/F 22 controls a process of writing write data onto the semiconductor memory unit 3 and a process of reading the data from the semiconductor memory unit 3 based upon the instruction from the control unit 23.
The control unit 23 generally controls the memory controller 2. The control unit 23 is a CPU (Central Processing Unit), or MPU (Micro Processing Unit), for example. When receiving a command from the host 4 via the Host I/F 21, the control unit 23 executes a control according to this command. For example, the control unit 23 instructs the memory I/F 22 to write user data and a parity to the semiconductor memory unit 3, or to read user data and a parity from the semiconductor memory unit 3 in accordance with the command from the host 4.
The control unit 23 decides a storage area (memory area) on the semiconductor memory unit 3 to the user data stored in the data buffer 27. The user data is data transmitted from the host 4 as the data to be written onto the semiconductor memory unit 3. The user data is stored in the data buffer 27 via the internal bus 20. The control unit 23 decides the memory area to data on a page basis (page data) that is a writing unit. In the present specification, user data of a predetermined size (first data size) stored in one page of the semiconductor memory unit 3 is defined as unit data. As described later, 1 unit data and parity are stored in 1 page of the semiconductor memory 3 as 1 page data. In the present specification, 1 page of the semiconductor memory 3 indicates a memory area composed of a memory cell group commonly connected to 1 word line. When the memory cell is a single-level cell, the memory cells commonly connected to 1 word line correspond to 1 page. When the memory cell is a multiple level cell, the memory cells commonly connected to 1 word line correspond to plural pages. For example, when a multiple level cell that can store 2 bits is used, the memory cells commonly connected to 1 word line correspond to 2 pages. A physical address is allocated to the memory area in the semiconductor memory 3. The control unit 23 manages the memory area, which is the destination to which the page data is to be written, using the physical address. The control unit 23 instructs the memory I/F 22 to write the user data onto the decided memory area (physical address) in the semiconductor memory unit 3. The control unit 23 manages a correspondence between a logical address (logical address managed by the host 4) and a physical address of user data. When receiving a read command including a logical address from the host 4, the control unit 23 specifies the physical address corresponding to the logical address, and instructs the memory I/F 22 to read the user data from the specified physical address.
The encoding unit 25 executes a multi-stage error-correction coding process to generate a parity based upon the user data stored in the data buffer 27 as described later.
The decoding unit 26 executes a decoding process based upon the user data and the parity read from the semiconductor memory unit 3. In the present embodiment, a multi-stage error-correction decoding process is executed as described later. When the user data has no error (bit error), the decoding unit 26 outputs the user data read from the semiconductor memory unit 3 to the internal bus 20 as it is. When the user data has an error, the decoding unit 26 executes the multi-stage error correction decoding process, and then, outputs the user data to the internal bus 20.
The data buffer 27 temporarily stores the data received from the host 4 until it is stored in the semiconductor memory unit 3. The data buffer 27 also temporarily stores the data read from the semiconductor memory unit 3 until it is transmitted to the host 4. The data buffer 27 is composed of a general-purpose memory such as a SRAM (Static Random Access Memory) or DRAM (Dynamic Random Access Memory).
Next, the multi-stage error-correction coding process (hereinafter merely referred to as “encoding process”) and the multi-stage error-correction decoding process (hereinafter merely referred to as “decoding process”) according to the present embodiment will be described. In the present embodiment, the encoding process is executed in multiple stages including the 1st stage, the 2nd stage, the 3rd stage, and so on. User data inputted in i-th (i is an integer not less than 3) stage coding process is specified as data #i. It is supposed that the data #i is distributed to be stored on ki pages on the semiconductor memory unit 3 (if ki=1, the data is stored in a single page without being distributed). In other words, the encoding unit 25 executes the i-stage (i is an integer not less than 3) encoding process using the user data stored in ki page in the semiconductor memory unit 3. In the present embodiment, the number of pages for the user data inputted in the encoding process is increased in a stepwise manner by establishing ki+1>ki.
Any codes may be used as an error correction code used in the encoding process according to the present embodiment. For example, BCH code or RS (Reed-Solomon) code can be used. A different error correction code may be used for each stage, or the same error correction code may be used for all stages.
The user data stored in the semiconductor memory unit 3 is temporarily stored in the data buffer 27. The storage area (physical address) on the semiconductor memory unit 3 is allocated to each unit data of the user data in the data buffer 27. The unit data in the data buffer 27 and the page in the semiconductor memory unit 3 have one-to-one correspondence, and the control unit 23 manages this correspondence. Specifically, the control unit 23 manages the write user data on the data buffer 27 in the first data size, thereby generating each unit data on the data buffer 27. During the writing process to the semiconductor memory unit 3, the memory I/F 22 controls to write each unit data on the corresponding page in the semiconductor memory unit 3 based upon the instruction from the control unit 23.
As illustrated in
Next, in the 2nd stage coding process, the control unit 23 controls to input the first half of the unit data #1 and the last half of the unit data #2 (the data indicated by a solid line in the figure for the 2nd stage in
In the 3rd stage encoding process, the control unit 23 specifies the data that is ¼ of each of the unit data #1 to #4 as the sub-unit data, and controls to input the 1st sub-unit data of the unit data #1+the 2nd sub-unit data of the unit data #2+the 3rd sub-unit data of the unit data #3+the 4th sub-unit data of the unit data #4 (the data indicated by the solid line in the figure for the 3rd stage in
As illustrated in
As illustrated in
The combination (the combination of sub-unit data in
When the 1st stage error-correction coding process is ended to all data in L pages (step S3, Yes), the control unit 23 controls to input the user data (user data partly extracted from each of M unit data) stored in M pages of the semiconductor memory unit 3 to the encoding unit 25 (step S5). The control unit 23 instructs the encoding unit 25 to execute the 2nd stage coding process. The encoding unit 25 executes the 2nd stage encoding process to generate the parity #2 (step S6). The control unit 23 checks whether the 2nd stage encoding process is ended or not for all data in M pages on the semiconductor memory unit 3 (step S7). When there is data to which the encoding process is not ended out of data in M pages (step S7, No), the control unit 23 changes the input data for the encoding process (step S8), and then, returns to step S5.
When the 2nd stage error-correction coding process is ended to all data in M pages (step S7, Yes), the control unit 23 controls to input the user data (user data partly extracted from each of N unit data) stored in N pages of the semiconductor memory unit 3 to the encoding unit 25 (step S9). The control unit 23 instructs the encoding unit 25 to execute the 3rd stage encoding process. The encoding unit 25 executes the 3rd stage encoding process to generate the parity #3 (step S10). The control unit 23 checks whether the 3rd stage encoding process is ended or not for all data in N pages on the semiconductor memory unit 3 (step S11). When there is data to which the encoding process is not ended out of data in N pages (step S11, No), the control unit 23 changes the input data for the encoding process (step S12), and then, returns to step S9.
When the 3rd stage error-correction coding process is ended to all data in N pages (step S11, Yes), the control unit 23 ends the encoding process.
According to the above procedure, the parity #1, the parity #2, and the parity #3 are generated. The parity #1, the parity #2, and the parity #3 are written on the semiconductor memory unit 3 together with the user data.
The parity #1 generated using the unit data #1 is stored in the Page #1, the parity #1 generated using the unit data #2 is stored in the Page #2, the parity #1 generated using the unit data #3 is stored in the Page #3, and the parity #1 generated using the unit data #4 is stored in the Page #4.
The parity #2 generated using the first half of the unit data #1+the last half of the unit data #2 is stored in the Page #1, and the parity #2 generated using the last half of the unit data #1+the first half of the unit data #2 is stored in the Page #2. The parity #2 generated using the first half of the unit data #3+the last half of the unit data #4 is stored in the Page #3, and the parity #2 generated using the last half of the unit data #3+the first half of the unit data #4 is stored in the Page #4.
The parity #3 generated using the 1st sub-unit data of the unit data #1+the 2nd sub-unit data of the unit data #2+the 3rd sub-unit data of the unit data #3+the 4th sub-unit data of the unit data #4 is stored in the Page #1. The other parities #3 that are not illustrated with an arrow for simplification are also stored in the Pages #2, #3, and #4, respectively.
The control unit 23 checks whether the error correction is successful or not by the 1st stage decoding process (step S24). When the error correction is unsuccessful (step S24, No), the control unit instructs the memory I/F 22 to read a page that is not yet read in M pages (step S25). The M page has stored therein the user data from which the parity #2 that is to protect the user data in the L page to be read is generated. This user data is distributed to be stored in the M page.
The control unit 23 inputs a set of user data and the parity #2, among the sets of user data and the parities #2 of the read M page, to the decoding unit 26 (step S26). The control unit 23 instructs the decoding unit 26 to execute the 2nd stage decoding process (step S27). The decoding unit 26 executes the 2nd stage decoding process using the inputted user data and the parity #2, and notifies the control unit 23 of whether the error correction is successful or not.
The control unit 23 checks whether the process is ended to all sets of the user data and the parity #2 in the M page (step S28). When there is the set to which the process is not ended (step S28, No), the control unit 23 changes the input data of the decoding unit 26 (step S29), and returns to step S26. When the process is ended to all sets of the user data and the parity #2 in the M page (step S28, Yes), the control unit 23 checks whether the error correction is successful or not by the 2nd stage decoding process (step S30). In step S30, it is checked that the error correction is successful when the error correction is successful to all sets of the user data and the parity #2 in the M page, and if there is only one set to which the error correction is unsuccessful, it is checked that the error correction is unsuccessful.
When the control unit 23 checks in step S30 that the error correction is unsuccessful (step S30, No), it instructs the memory I/F 22 to read the page that is not yet read, among the N pages (step S31). The N page has stored therein the user data from which the parity #3 that is to protect the user data in the L page to be read is generated. This user data is distributed to be stored in the N page.
The control unit 23 inputs a set of the user data and the parity #3, among the user data and the parities #3 in the read N page, to the decoding unit 26 (step S32). The control unit 23 instructs the decoding unit 26 to execute the 3rd stage decoding process (step S33). The decoding unit 26 executes the 3rd stage decoding process, and notifies the control unit 23 of whether the error correction is successful or not.
The control unit 23 checks whether the process is ended to all sets of the user data and the parity #3 in the N pages (step S34). When there is the set to which the process is not ended (step S34, No), the control unit 23 changes the input data of the decoding unit 26 (step S35), and returns to step S32. When the process is ended to all sets in step S34 (step S34, Yes), the control unit 23 ends the process.
When checking in step S24 that the error correction is successful (step S24, Yes), or when checking in step S30 that the error correction is successful (step S30, Yes), the control unit 23 ends the process. When the error correction is successful by the 1st stage error decoding process, the control unit 23 transfers the user data corrected by the 1st stage decoding process (when there is no error, the user data read from the semiconductor memory unit 3) to the host 4. When the error correction is successful by the 2nd stage error decoding process, the control unit 23 transfers the user data to be read, among the user data corrected by the 2nd stage decoding process, to the host 4. When the error correction is successful by the 3rd stage error decoding process, the control unit 23 transfers the user data to be read, among the user data corrected by the 3rd stage decoding process, to the host 4. When the error cannot be corrected even by the 3rd stage decoding process, the control unit 23 executes a predetermined process such as a process of giving notification of this situation to the host 4.
In the description above, the 1st stage decoding process, the 2nd stage decoding process, and the 3rd stage decoding process are each executed at most once. However, when the 1st stage decoding process is again executed after the result of the 2nd stage decoding process is reflected, an error might be capable of being corrected. Similarly, when the 1st stage decoding process is again executed after the result of the 3rd stage decoding process is reflected, an error might be capable of being corrected. The probability of correcting an error can be improved by repeatedly executing the decoding process in each stage. Therefore, all of the processes in steps S23 to S34 in
In the description above, the user data is triply protected by three types of different parities. Each parity may be multiply protected.
As described above, in the present embodiment, the encoding process is executed in each of three or more stages to generate parity for each stage, wherein 1 user data is protected by parities in all stages, and i-th parity is distributed and stored in ki page, satisfying ki+1>ki, on the semiconductor memory unit 3 (when ki=1, the user data is stored in a single page without being distributed). In other words, when user data of the first data size is specified as the unit data, the parity in i-th stage is generated using the user data extracted at least partly from ki unit data, and each unit data is stored in a different page on the semiconductor memory unit 3. For example, when the 3rd stage encoding process is executed, the parity #1 is generated using the user data extracted at least partly from L unit data, the parity #2 is generated using the user data extracted at least partly from M (M>L) unit data, and the parity #3 is generated using the user data extracted at least partly from N (N>M) unit data. Thus, each bit of the user data is protected by the parity #1, the parity #2, and the parity #3. Accordingly, the error correction capability according to the number of error bits included in each unit data can be provided.
While certain embodiments have been described, these embodiments have been presented by way of example only, and are not intended to limit the scope of the inventions. Indeed, the novel embodiments described herein may be embodied in a variety of other forms; furthermore, various omissions, substitutions and changes in the form of the embodiments described herein may be made without departing from the spirit of the inventions. The accompanying claims and their equivalents are intended to cover such forms or modifications as would fall within the scope and spirit of the inventions.
This application is based upon and claims the benefit of priority from Provisional Patent Application No. 61/875,783, filed on Sep. 10, 2013; the entire contents of which are incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
61875783 | Sep 2013 | US |