Method for accessing flash memory module and related flash memory controller and memory device
By planning super blocks in flash memory modules and storing temporary verification codes in special areas in buffers, the frequent exchange of verification codes caused by limited RAID buffer space is solved, and the efficiency of flash memory controller is improved and data protection capabilities.
Patent Information
- Application Number
- CN202410074143.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-05-31
- Filing Date
- 2024-01-18
- Publication Date
- 2024-12-03
AI Technical Summary
In flash memory controllers, due to the limited space of RAID buffer, the verification code needs to be frequently exchanged/moved between the RAID buffer and DRAM, which affects the efficiency of the encoder.
By planning super blocks in flash memory modules, combining multiple blocks into one encoding unit, and storing temporary verification codes in a dedicated area in the buffer, reducing the verification code between the DRAM and RAID buffers Number of moves.
Reduces the number of times the verification code is exchanged/moved between DRAM and RAID buffers, and improves the efficiency and data protection capabilities of the flash memory controller.
Smart Images

Figure CN119068944A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a flash memory controller. Background Art
[0002] In order to better protect the data in the flash memory module, the encoder in the flash memory controller uses a redundant array of independent disks (RAID) encoding method to encode the data written to the flash memory module to generate multiple parity codes. However, since the space of the RAID buffer in the encoder is limited, during the RAID encoding process, the parity codes that are not currently required to be encoded need to be moved to the dynamic random access memory (DRAM) to release the RAID buffer space for other parity codes to be encoded. Therefore, since the parity codes need to be repeatedly exchanged / moved between the RAID buffer and the DRAM during the RAID encoding process, the efficiency of the encoder is affected. Summary of the invention
[0003] Therefore, one of the objectives of the present invention is to provide a flash memory controller which can reduce the number of times the check code is exchanged / moved between the RAID buffer and the DRAM, so as to solve the problems described in the prior art.
[0004] In one embodiment of the present invention, a method for accessing a flash memory module is disclosed, wherein the flash memory module includes a plurality of dies, each of which includes a plurality of blocks, each of which includes a plurality of data pages, and the control method includes: configuring the flash memory module to plan a super block, wherein the super block includes a plurality of blocks respectively located in the plurality of dies; respectively encoding M pieces of data to sequentially generate M temporary check codes, wherein M is a positive integer greater than 2, and each piece of data in the M pieces of data is used to be written to each of the plurality of blocks; a data page of a block; sequentially storing the M temporary check codes into N areas of a buffer, wherein N is less than M, each of the N areas can store only one temporary check code, and a first part of the N areas fixedly stores a part of the M temporary check codes and subsequent updated temporary check codes, but does not store other parts of the M temporary check codes or subsequent updated temporary check codes; generating M check codes according to the M temporary check codes, and writing the M check codes into the super block.
[0005] In one embodiment of the present invention, a flash memory controller is disclosed, wherein the flash memory controller is used to access a flash memory module, the flash memory module includes a plurality of dies, each of the dies includes a plurality of blocks, each of the blocks includes a plurality of data pages, and the flash memory controller includes a read-only memory, a microprocessor, an encoder and a buffer. The microprocessor configures the flash memory module to plan a super block, wherein the super block includes multiple blocks respectively located in the multiple dies; the encoder respectively encodes M pieces of data to sequentially generate M temporary check codes, wherein M is a positive integer greater than 2, and each piece of data in the M pieces of data is used to be written into a data page of each block in the multiple blocks; the encoder sequentially stores the M temporary check codes into N areas of the buffer, wherein N is less than M, each of the N areas can only store one temporary check code, and the N areas have a first part area that fixedly stores a part of the M temporary check codes and subsequent updated temporary check codes, but does not store other parts of the M temporary check codes or subsequent updated temporary check codes; and the encoder generates M check codes based on the M temporary check codes, and writes the M check codes into the super block.
[0006] In one embodiment of the present invention, a memory device is disclosed, which includes a flash memory module and a flash memory controller. The flash memory module includes a plurality of dies, each of which includes a plurality of blocks, and each of which includes a plurality of data pages. The flash memory controller is used to access the flash memory module, and the flash memory controller performs the following operations: configuring the flash memory module to plan a super block, wherein the super block includes multiple blocks respectively located in the multiple grains; respectively encoding M pieces of data to sequentially generate M temporary check codes, wherein M is a positive integer greater than 2, and each piece of data in the M pieces of data is used to be written into a data page of each block in the multiple blocks; and sequentially storing the M temporary check codes into N areas of a buffer, wherein N is less than M, each of the N areas can only store one temporary check code, and the N areas have a first part area that fixedly stores a part of the M temporary check codes and subsequent updated temporary check codes, but does not store other parts of the M temporary check codes or subsequent updated temporary check codes; generating M check codes based on the M temporary check codes, and writing the M check codes into the super block. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] Figure 1 FIG. 4 is a schematic diagram of a memory device according to an embodiment of the present invention.
[0008] Figure 2 FIG. 4 is a schematic diagram of writing data into a super block according to an embodiment of the present invention.
[0009] Figure 3 FIG. 4 is a schematic diagram of generating a verification code according to an embodiment of the present invention.
[0010] Figure 4 , Figure 5 , Figure 6 FIG. 4 is a schematic diagram of accessing a RAID buffer and a DRAM according to an embodiment of the present invention.
[0011] Figure 7 FIG. 4 is a flow chart of a method for accessing a flash memory module according to an embodiment of the present invention.
[0012]
Explanation of symbols
[0013] 100: Memory Device
[0014] 110: Flash memory controller
[0015] 112: Microprocessor
[0016] 112M: Read-only memory
[0017] 112C: Program code
[0018] 114: Control Logic
[0019] 116: Buffer memory
[0020] 118: Interface Logic
[0021] 120: Flash memory module
[0022] 130: Main device
[0023] 132: Encoder
[0024] 134:Decoder
[0025] 136:RAID Buffer
[0026] 140: DRAM
[0027] 200:Super Block
[0028] 202,204,206,208: Blocks
[0029] D1~D1784: Data
[0030] P1~P448: Data page
[0031] PAR1~PAR8: check code
[0032] PAR1'~PAR8': Temporary checksum
[0033] WL1~WL112: word line DETAILED DESCRIPTION
[0034] Figure 1 1 is a schematic diagram of a memory device 100 according to an embodiment of the present invention. The memory device 100 includes a flash memory module 120 and a flash memory controller 110, and the flash memory controller 110 is used to access the flash memory module 120. According to this embodiment, the flash memory controller 110 includes a microprocessor 112, a read only memory (ROM) 112M, a control logic 114, a buffer memory 116, and an interface logic 118. The ROM 112M is used to store a program code 112C, and the microprocessor 112 is used to execute the program code 112C to control the access to the flash memory module 120. The control logic 114 includes an encoder 132, a decoder 134 and a RAID buffer 136, wherein the encoder 132 is used to encode the data written into the flash memory module 120 to generate a corresponding check code (or error correction code (ECC)), the decoder 134 is used to decode the data read from the flash memory module 120, and the RAID buffer 136 is used to temporarily store the check code generated by the encoder 132 when encoding the data.
[0035] In a typical case, the flash memory module 120 includes a plurality of flash memory chips, and each flash memory chip includes a plurality of blocks. The flash memory controller 110 performs operations such as copying, erasing, and merging data on the flash memory module 120 in units of blocks. In addition, a block can record a specific number of data pages, and the flash memory controller 110 performs operations such as writing data to the flash memory module 120 in units of data pages. In other words, a block is a minimum erase unit in the flash memory module 120, and a data page is a minimum write unit in the flash memory module 120.
[0036] In practice, the flash memory controller 110, which executes the program code 112C through the microprocessor 112, can use its own internal components to perform various control operations, such as using the control logic 114 to control the access operation of the flash memory module 120 (especially the access operation to at least one block or at least one data page), using the buffer memory 116 and / or a DRAM 140 to perform the required buffer processing, and using the interface logic 118 to communicate with a host device 130.
[0037] In one embodiment, the memory device 100 may be a portable memory device (e.g., a memory card that complies with SD / MMC, CF, MS, or XD standards), and the host device 130 is an electronic device that can be connected to the memory device, such as a mobile phone, a notebook computer, a desktop computer, etc. In another embodiment, the memory device 100 may be a solid state drive or an embedded storage device that complies with Universal Flash Storage (UFS) or Embedded Multi Media Card (EMMC) specifications, and is disposed in an electronic device, such as a mobile phone, a watch, a portable medical detection device (e.g., a medical bracelet), a notebook computer, or a desktop computer, and the host device 130 may be a processor of the electronic device.
[0038] Figure 2 FIG. 2 is a schematic diagram of writing data into a super block according to an embodiment of the present invention. Figure 2 As shown, it is assumed that the flash memory module 120 includes four dies (die 1 to die 4), and each die includes multiple blocks. At this time, the microprocessor 112 can configure the blocks belonging to different data planes or different dies in the flash memory module 120 into a super block to facilitate the management of data access. In this embodiment, it is explained that a die has only one data plane, but the present invention is not limited to this. Figure 2As shown, die 1 to die 4 include blocks (physical blocks) 202, 204, 206, 208 respectively, and the microprocessor 112 can configure the blocks 202, 204, 206, 208 as a super block 200, and the flash memory controller 122 is similar to a general block when accessing the super block 200. For example, the super block 200 itself is an erase unit, that is, although the four blocks 202, 204, 206, 208 of the super block 200 can be erased separately, the flash memory controller 110 will definitely erase the four blocks 202, 204, 206, 208 together; in addition, when writing data to the super block 200, the first data page P1 of the block 202, the first data page P1 of the block 204, the first data page P1 of the block 206, and the first data page P1 of the block 208 can be sequentially written. Data is written to a data page P1, and after the first data page P1 of block 208 is written, data is sequentially written to the second data page P2 of block 202, the second data page P2 of block 204, ..., and so on. In other words, the flash memory controller 110 will write the first data page P1 of each block 202, 204, 206, 208 in the super block 200, and then continue to write the second data page P2 of each block 202, 204, 206, 208 in the super block 200. The flash memory controller 110 of the super block is a logically set block for the convenience of managing the flash memory module 120, not a physical set block. In addition, when performing garbage collection, calculating the valid page of the block, and calculating the length of the block write time, the calculation can also be performed in units of super blocks.
[0039] In this embodiment, the flash memory module 120 is a 3D NAND flash memory module, wherein each block is composed of a plurality of word lines, a plurality of bit lines, and a plurality of memory cells. Since the 3D NAND flash memory architecture is well known to those skilled in the art, it will not be described in detail in the specification. In the present embodiment, it is assumed that each of the blocks 202, 204, 206, and 208 is a single-level cell (SLC) block having 112 word lines, and one word line corresponds to four data pages, for example, word line WL1 corresponds to data pages P1-P4, word line WL2 corresponds to data pages P5-P8, word line WL3 corresponds to data pages P9-P12, ..., word line WL111 corresponds to data pages P441-P444, and word line WL112 corresponds to data pages P445-P448.
[0040] In order to better protect the data in the flash memory module 120, the encoder 132 uses a RAID encoding mechanism to encode the data written into the blocks 202, 204, 206, and 208 to generate multiple sets of check codes (parity). In addition, since the data on adjacent word lines in the flash memory module 120 are easily affected by each other, that is, if a data write error or abnormal power failure occurs when writing data to the data pages P5 to P8 corresponding to the word line WL2, the data on the data pages P1 to P4 corresponding to the word line WL1 will also be erroneous. Therefore, the encoder 132 will skip word lines when performing RAID encoding, that is, the data on the data pages on adjacent word lines will not be encoded together. Specifically, refer to Figure 2 , 3 The encoder 132 sequentially performs an exclusive or (XOR) operation on the data D1 of the first data page P1 of block 202, the data D2 of the first data page P1 of block 204, the data D3 of the first data page P1 of block 206, the data D4 of the first data page P1 of block 208, the data D33 of the ninth data page P9 of block 202, the data D34 of the ninth data page P9 of block 204, the data D35 of the ninth data page P9 of block 206, the data D36 of the ninth data page P9 of block 208, the data D1761 of the 441st data page P441 of block 202, the data D1762 of the 441st data page P441 of block 204, and the data D1763 of the 441st data page P441 of block 206 to generate a check code PAR1. Similarly, the encoder 132 sequentially performs an exclusive OR (XOR) operation on data D5 of the second data page P2 of block 202, data D6 of the second data page P2 of block 204, data D7 of the second data page P2 of block 206, data D8 of the second data page P2 of block 208, data D37 of the tenth data page P10 of block 202, data D38 of the tenth data page P10 of block 204, data D39 of the tenth data page P10 of block 206, data D40 of the tenth data page P10 of block 208, data D1764 of the 442nd data page P442 of block 202, data D1765 of the 442nd data page P442 of block 204, and data D1766 of the 442nd data page P442 of block 206 to generate a check code PAR2. Similar to the above operation, the encoder 132 generates the check codes PAR3 ˜ PAR8 . In addition, the check codes PAR1 ˜ PAR8 are respectively stored in the data pages P441 ˜ P448 of the block 208 .
[0041] It should be noted that Figure 2 , 3Each of D1-D1784 shown includes original data from the host device 130 and a corresponding error correction code, that is, the encoder 132 encodes the first data from the host device 130 to generate data D1, encodes the second data to generate data D2, and so on.
[0042] because Figure 2 , 3 The data D1-D1784 shown are sequentially generated and written into the super block 200, so in the process of generating the check codes PAR1-PAR8, temporary check codes PAR1'-PAR8' are generated and continuously updated, and temporarily stored in the RAID buffer 136. However, since the RAID buffer 136 is usually implemented using a relatively expensive static random access memory, its capacity is limited and it cannot store all the temporary check codes PAR1'-PAR8', wherein the size of each temporary check code PAR1'-PAR8' is equivalent to the size of a data page. Therefore, in the case where the RAID buffer 136 can only store part of the temporary check codes PAR1'-PAR8', the temporary check codes that do not need to be processed at present will be first moved to the DRAM 140, and then loaded from the DRAM 140 to the RAID buffer 136 for processing when encoding is required. However, since the temporary check codes PAR1'-PAR8' need to be frequently moved between the DRAM 140 and the RAID buffer 136, the performance of the flash memory controller 110 will be affected. Therefore, the present invention proposes a control method having a special parity swap mechanism to reduce the number of times the temporary parity is transferred between the DRAM 140 and the RAID buffer 136 , so as to improve the performance of the flash memory controller 110 .
[0043] Specifically, refer to Figures 4 to 6, assuming that the size of the RAID buffer 136 is equal to 4 data pages, that is, the RAID buffer 136 can only store four temporary check codes. First, the encoder 132 receives data from the main device 130 and encodes to sequentially generate data D1, D2, D3, and D4, and the encoder 132 sequentially performs an exclusive OR operation on D1, D2, D3, and D4 to generate a temporary check code PAR1', and stores the temporary check code PAR1' in the first area of the RAID buffer 136. Next, the encoder 132 receives data from the main device 130 and encodes to sequentially generate data D5, D6, D7, and D8, and the encoder 132 sequentially performs an exclusive OR operation on D5, D6, D7, and D8 to generate a temporary check code PAR2', and stores the temporary check code PAR2' in the second area of the RAID buffer 136. The encoder 132 receives data from the main device 130 and encodes to sequentially generate data D9, D10, D11, and D12, and the encoder 132 sequentially performs an exclusive OR operation on D9, D10, D11, and D12 to generate a temporary check code PAR3′, and stores the temporary check code PAR3′ in the third area of the RAID buffer 136. The encoder 132 receives data from the main device 130 and encodes to sequentially generate data D13, D14, D15, and D16, and the encoder 132 sequentially performs an exclusive OR operation on D13, D14, D15, and D16 to generate a temporary check code PAR4′, and stores the temporary check code PAR4′ in the fourth area of the RAID buffer 136.
[0044] Next, the encoder 132 receives data from the autonomous device 130 and encodes it to start sequentially generating data D17, D18, D19, and D20. At this time, since the RAID buffer 136 has no space to store the temporary check code PAR5', the microprocessor 112 moves the temporary check code PAR1' from the first area of the RAID buffer 136 to the DRAM 140. Thereafter, the encoder 132 sequentially performs an exclusive OR operation on D17, D18, D19, and D20 to generate a temporary check code PAR5', and stores the temporary check code PAR5' in the first area of the RAID buffer 136.
[0045] Next, the encoder 132 receives data from the autonomous device 130 and encodes it to start sequentially generating data D21, D22, D23, and D24. At this time, since the RAID buffer 136 has no space to store the temporary check code PAR6', the microprocessor 112 moves the temporary check code PAR5' from the first area of the RAID buffer 136 to the DRAM 140. Thereafter, the encoder 132 sequentially performs an exclusive OR operation on D21, D22, D23, and D24 to generate a temporary check code PAR6', and stores the temporary check code PAR6' in the first area of the RAID buffer 136.
[0046] Next, the encoder 132 receives data from the autonomous device 130 and encodes it to start sequentially generating data D25, D26, D27, and D28. At this time, since the RAID buffer 136 has no space to store the temporary check code PAR7', the microprocessor 112 moves the temporary check code PAR6' from the first area of the RAID buffer 136 to the DRAM 140. Thereafter, the encoder 132 sequentially performs an exclusive OR operation on D25, D26, D27, and D28 to generate a temporary check code PAR7', and stores the temporary check code PAR7' in the first area of the RAID buffer 136.
[0047] At Figure 5 Next, the encoder 132 receives data from the autonomous device 130 and encodes it to start sequentially generating data D29, D30, D31, and D32. At this time, since the RAID buffer 136 has no space to store the temporary check code PAR8', the microprocessor 112 moves the temporary check code PAR7' from the first area of the RAID buffer 136 to the DRAM 140. Thereafter, the encoder 132 sequentially performs an exclusive OR operation on D29, D30, D31, and D32 to generate a temporary check code PAR8', and stores the temporary check code PAR8' in the first area of the RAID buffer 136.
[0048] Next, the encoder 132 receives data from the autonomous device 130 and encodes the data to start sequentially generating data D33, D34, D35, and D36. At this time, since the RAID buffer 136 has no space to store the temporary check code PAR1', the microprocessor 112 moves the temporary check code PAR8' from the first area of the RAID buffer 136 to the DRAM 140, and moves the temporary check code PAR1' stored in the DRAM 140 to the first area of the RAID buffer 136. Afterwards, the encoder 132 performs an exclusive OR operation on the temporary check codes PAR1', D29, D30, D31, and D32 currently stored in the RAID buffer 136 to generate an updated temporary check code PAR1', and stores the updated temporary check code PAR1' in the first area of the RAID buffer 136. At this time, the updated temporary check code PAR1' is the result of performing an exclusive OR operation on D1, D2, D3, D4, D33, D34, D35, and D36 in sequence.
[0049] Next, the encoder 132 receives data from the autonomous device 130 and encodes the data to start sequentially generating data D37, D38, D39, and D40. At this time, since the RAID buffer 136 has already stored the temporary check code PAR2′, the microprocessor 112 does not need to move data between the RAID buffer 136 and the DRAM 140, and the encoder 132 can directly perform exclusive OR operations on the temporary check codes PAR2′, D37, D38, D39, and D40 currently stored in the RAID buffer 136 in sequence to generate an updated temporary check code PAR2′, and store the updated temporary check code PAR2′ in the second area of the RAID buffer 136.
[0050] Next, the encoder 132 receives data from the autonomous device 130 and encodes it to start sequentially generating data D41, D42, D43, and D44. At this time, since the RAID buffer 136 has already stored the temporary check code PAR3', the microprocessor 112 does not need to move data between the RAID buffer 136 and the DRAM 140, and the encoder 132 can directly perform mutually exclusive OR operations on the temporary check codes PAR3', D41, D42, D43, and D44 currently stored in the RAID buffer 136 in sequence to generate an updated temporary check code PAR3', and store the updated temporary check code PAR3' in the third area of the RAID buffer 136.
[0051] At Figure 6Then, the encoder 132 receives data from the autonomous device 130 and encodes it to start sequentially generating data D45, D46, D47, and D48. At this time, since the RAID buffer 136 has already stored the temporary check code PAR4', the microprocessor 112 does not need to move data between the RAID buffer 136 and the DRAM 140, and the encoder 132 can directly perform exclusive OR operations on the temporary check codes PAR4', D45, D46, D47, and D48 currently stored in the RAID buffer 136 in sequence to generate an updated temporary check code PAR4', and store the updated temporary check code PAR4' in the fourth area of the RAID buffer 136.
[0052] Next, the encoder 132 receives data from the main device 130 and encodes it to start sequentially generating data D49, D50, D51, and D52. At this time, since the RAID buffer 136 has no space for storing the temporary check code PAR5', the microprocessor 112 moves the temporary check code PAR1' from the first area of the RAID buffer 136 to the DRAM 140, and moves the temporary check code PAR5' stored in the DRAM 140 to the first area of the RAID buffer 136. Afterwards, the encoder 132 performs an exclusive OR operation on the temporary check code PAR5', D49, D50, D51, and D52 currently temporarily stored in the RAID buffer 136 to generate an updated temporary check code PAR5', and stores the updated temporary check code PAR5' in the first area of the RAID buffer 136.
[0053] Next, the encoder 132 receives data from the main device 130 and encodes it to start sequentially generating data D53, D54, D55, and D56. At this time, since the RAID buffer 136 has no space for storing the temporary check code PAR6', the microprocessor 112 moves the temporary check code PAR5' from the first area of the RAID buffer 136 to the DRAM 140, and moves the temporary check code PAR6' stored in the DRAM 140 to the first area of the RAID buffer 136. After that, the encoder 132 performs an exclusive OR operation on the temporary check code PAR6', D53, D54, D55, and D56 currently temporarily stored in the RAID buffer 136 to generate an updated temporary check code PAR6', and stores the updated temporary check code PAR6' in the first area of the RAID buffer 136.
[0054] Next, the encoder 132 receives data from the main device 130 and encodes it to start sequentially generating data D57, D58, D59, and D60. At this time, since the RAID buffer 136 has no space for storing the temporary check code PAR7', the microprocessor 112 moves the temporary check code PAR6' from the first area of the RAID buffer 136 to the DRAM 140, and moves the temporary check code PAR7' stored in the DRAM 140 to the first area of the RAID buffer 136. After that, the encoder 132 performs an exclusive OR operation on the temporary check code PAR7', D57, D58, D59, and D60 currently stored in the RAID buffer 136 to generate an updated temporary check code PAR7', and stores the updated temporary check code PAR7' in the first area of the RAID buffer 136.
[0055] Similar to the above operation, the encoder 132 continuously encodes and performs exclusive OR operations on the subsequent data to sequentially and cyclically generate temporary check codes PAR1 ′-PAR8 ′ until the last data is encoded to generate check codes PAR1 -PAR8 .
[0056] In the above embodiment, since the temporary parity codes PAR2′-PAR4′ can be temporarily stored in the RAID buffer 136 without being moved to the DRAM 140 , the speed of updating the temporary parity codes PAR2′-PAR4′ by the encoder 132 can be increased to improve the efficiency of the flash memory controller 110 .
[0057] exist Figures 4 to 6 In the embodiment of the present invention, the second to fourth areas of the RAID buffer 136 are always occupied by the temporary check codes PAR2'-PAR4', and only the first area is used to temporarily store the temporary check codes PAR1', PAR5', PAR6', PAR7', and PAR8' in sequence, but the present invention is not limited thereto. For example, the RAID buffer 136 can allocate any three areas of the four areas to specific three temporary check codes (i.e., any three of PAR1'-PAR8'), and the remaining area is used to temporarily store the remaining five temporary check codes in sequence. In another example, the RAID buffer 136 can allocate part of the areas (e.g., two areas) of the four areas to specific numbers of temporary check codes (e.g., any two of PAR1'-PAR8'), and the remaining area is used to temporarily store the remaining temporary check codes in sequence. These design changes should belong to the scope of the present invention.
[0058] exist Figure 2 , 3In the embodiment of the present invention, the hypothetical super block 200 includes blocks 202, 204, 206, and 208 respectively located in four dies, each of the blocks 202, 204, 206, and 208 is an SLC block, one word line corresponds to four data pages, and the encoder 132 encodes the data written to the super block 200 to generate 8 check codes PAR1-PAR8 generated by different data, but the present invention is not limited to this. In other embodiments, the number of blocks included in the super block 200 may be changed according to the architecture of the flash memory module 120 and the designer's considerations. The blocks included in the super block 200 may be multi-level cell (MLC) blocks, triple-level cell (TLC) blocks, or quad-level cell (QLC) blocks. The number of multiple check codes generated by the encoder 132 and the interval between multiple data pages corresponding to the data used to generate each check code may also be changed according to the architecture of the flash memory module 120, the type of blocks, and the designer's considerations. Specifically, assuming that the gap between the data pages corresponding to the data used to generate each check code is M data pages, the number of the check codes generated by the encoder 132 is M, and the data pages corresponding to the data used to generate the first check code PAR1 are P1, P(1+M), P(1+2*M), P(1+3*M), ..., the data pages corresponding to the data used to generate the second check code PAR2 are P2, P(2+M), P(2+2*M), P(2+3*M), ..., and the data pages corresponding to the data used to generate the Mth check code are P(M), P(M+M), P(M+2*M), P(M+3*M), .... In addition, the number of areas included in the RAID buffer 136 can be any positive integer N less than M, and is not limited to the four areas described in the above embodiment, wherein each area of the RAID buffer 136 can only be used to store data of one data page (that is, the data of each check code or temporary check code).
[0059] In the above embodiments, before generating any temporary check code, if the RAID buffer 136 does not have a previous temporary check code for encoding to generate the temporary check code, the microprocessor 112 can start searching from the first area of the RAID buffer 136 for an area whose data is not currently used for encoding as a specific area; and move other temporary check codes of the specific area of the RAID buffer 136 to the DRAM 140, and move the previous temporary check code from the DRAM 140 to the specific area of the RAID buffer 136 for encoding to generate the temporary check code.
[0060] Figure 7 1 is a flow chart of a method for accessing the flash memory module 120 according to an embodiment of the present invention. Referring to the contents described in the above embodiments, the process is described as follows.
[0061] Step 700: The process starts.
[0062] Step 702: Configure the flash memory module to plan a super block, wherein the super block includes a plurality of blocks respectively located in the plurality of dies.
[0063] Step 704: Encode M pieces of data respectively to sequentially generate M temporary check codes, wherein M is a positive integer greater than 2, and each piece of data in the M pieces of data is used to be written into a data page of each block in the plurality of blocks.
[0064] Step 706: Sequentially store the M temporary check codes into N areas of a buffer, wherein N is less than M, each of the N areas can only store one temporary check code, and the N areas have a first portion of the areas that fixedly stores a portion of the M temporary check codes and their subsequent updated temporary check codes, but does not store other portions of the M temporary check codes or their subsequent updated temporary check codes.
[0065] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made according to the scope of the patent application of the present invention should fall within the scope of the present invention.
Claims
1. A method for accessing a flash memory module, wherein the flash memory module comprises a plurality of dies, each of which comprises a plurality of blocks, each of which comprises a plurality of data pages, and the method comprises: The flash memory module is configured to plan a super block, wherein the super block includes a plurality of blocks respectively located in the plurality of dies; Encoding M pieces of data respectively to sequentially generate M temporary check codes, wherein M is a positive integer greater than 2, and each piece of data in the M pieces of data is used to be written into a data page of each block in the plurality of blocks; The M temporary check codes are sequentially stored in N areas of a buffer, wherein N is less than M, each of the N areas can store only one temporary check code, and a first part of the N areas is used to store a part of the temporary check codes and subsequent updated temporary check codes, but other parts of the temporary check codes or subsequent updated temporary check codes are not stored; as well as M check codes are generated according to the M temporary check codes, and the M check codes are written into the super block.
2. The method according to claim 1, characterized in that (N-1) areas in the N areas fixedly store the part of the temporary check codes in the M temporary check codes and the subsequent updated temporary check codes.
3. The method according to claim 1, characterized in that Also included: For any temporary check code among the M temporary check codes: Before generating the temporary check code, if the buffer does not have a previous temporary check code for encoding to generate the temporary check code, other temporary check codes in a second portion of the buffer are moved to a memory, and the previous temporary check code is moved from the memory to the second portion of the buffer for encoding to generate the temporary check code.
4. The method according to claim 3, characterized in that The second partial area is a specific area of the buffer.
5. The method according to claim 4, characterized in that Before generating the temporary check code, if the buffer does not have the previous temporary check code for encoding to generate the temporary check code, the step of moving other temporary check codes in the second part of the buffer to the memory, and moving the previous temporary check code from the memory to the second part of the buffer for encoding to generate the temporary check code comprises: If the buffer does not have the previous temporary check code used for encoding to generate the temporary check code, searching from the first area of the buffer for an area containing data that is not currently used for encoding as the specific area; as well as The other temporary check code in the specific area of the buffer is moved to the memory, and the previous temporary check code is moved from the memory to the specific area of the buffer for encoding to generate the temporary check code.
6. A flash memory controller, wherein the flash memory controller is used to access a flash memory module, the flash memory module includes a plurality of dies, each of which includes a plurality of blocks, each of which includes a plurality of data pages, and the flash memory controller includes: A read-only memory for storing a program code; a microprocessor, used to execute the program code to control access to the flash memory module; An encoder; as well as a buffer; The microprocessor configures the flash memory module to plan a super block, wherein the super block includes a plurality of blocks respectively located in the plurality of dies; the encoder respectively encodes M pieces of data to sequentially generate M temporary check codes, wherein M is a positive integer greater than 2, and each piece of data in the M pieces of data is used to be written into a data page of each block in the plurality of blocks; the encoder sequentially stores the M temporary check codes in N areas of the buffer, wherein N is less than M, each of the N areas can only store one temporary check code, and the N areas have a first part area that fixedly stores a part of the M temporary check codes and subsequent updated temporary check codes, but does not store other parts of the M temporary check codes or subsequent updated temporary check codes; The encoder generates M check codes according to the M temporary check codes, and writes the M check codes into the super block.
7. The flash memory controller according to claim 6, wherein: (N-1) areas among the N areas are used to permanently store the part of the temporary check codes among the M temporary check codes and the subsequent updated temporary check codes.
8. The flash memory controller according to claim 6, wherein: For any temporary check code among the M temporary check codes: before generating the temporary check code, if the buffer does not have a previous temporary check code for encoding to generate the temporary check code, the microprocessor moves other temporary check codes in a second partial area of the buffer to a memory, and moves the previous temporary check code from the memory to the second partial area of the buffer for encoding to generate the temporary check code.
9. The flash memory controller according to claim 8, wherein: The second partial area is a specific area of the buffer.
10. The flash memory controller according to claim 9, wherein: If the buffer does not have the previous temporary check code used for encoding to generate the temporary check code, the microprocessor searches from the first area of the buffer for an area containing data that is not currently used for encoding as the specific area; The microprocessor moves the other temporary check code of the specific area of the buffer to the memory, and moves the previous temporary check code from the memory to the specific area of the buffer for encoding to generate the temporary check code.
11. A memory device comprising: A flash memory module comprising a plurality of dies, each of which comprises a plurality of blocks, each of which comprises a plurality of data pages; and a flash memory controller for accessing the flash memory module; The flash memory controller performs the following operations: The flash memory module is configured to plan a super block, wherein the super block includes a plurality of blocks respectively located in the plurality of dies; Encoding M pieces of data respectively to sequentially generate M temporary check codes, wherein M is a positive integer greater than 2, and each piece of data in the M pieces of data is used to be written into a data page of each block in the plurality of blocks; The M temporary check codes are sequentially stored in N areas of a buffer, wherein N is less than M, each of the N areas can store only one temporary check code, and a first portion of the N areas is used to fixedly store a portion of the temporary check codes of the M temporary check codes and subsequent updated temporary check codes, but other portions of the temporary check codes of the M temporary check codes or subsequent updated temporary check codes are not stored; as well as M check codes are generated according to the M temporary check codes, and the M check codes are written into the super block.
12. The memory device according to claim 11, characterized in that (N-1) areas among the N areas are used to permanently store the part of the temporary check codes among the M temporary check codes and the subsequent updated temporary check codes.
13. The memory device according to claim 11, characterized in that Also included: For any temporary check code among the M temporary check codes: Before generating the temporary check code, if the buffer does not have a previous temporary check code for encoding to generate the temporary check code, other temporary check codes in a second portion of the buffer are moved to a memory, and the previous temporary check code is moved from the memory to the second portion of the buffer for encoding to generate the temporary check code.
14. The memory device according to claim 13, characterized in that The second partial area is a specific area of the buffer.
15. The memory device according to claim 14, characterized in that Before generating the temporary check code, if the buffer does not have the previous temporary check code for encoding to generate the temporary check code, the step of moving other temporary check codes in the second part of the buffer to the memory, and moving the previous temporary check code from the memory to the second part of the buffer for encoding to generate the temporary check code comprises: If the buffer does not have the previous temporary check code used for encoding to generate the temporary check code, searching from the first area of the buffer for an area containing data that is not currently used for encoding as the specific area; as well as The other temporary check code in the specific area of the buffer is moved to the memory, and the previous temporary check code is moved from the memory to the specific area of the buffer for encoding to generate the temporary check code.
