TWI698750B - Method for accessing flash memory module and associated flash memory controller and electronic device - Google Patents

Method for accessing flash memory module and associated flash memory controller and electronic device Download PDF

Info

Publication number
TWI698750B
TWI698750B TW108109114A TW108109114A TWI698750B TW I698750 B TWI698750 B TW I698750B TW 108109114 A TW108109114 A TW 108109114A TW 108109114 A TW108109114 A TW 108109114A TW I698750 B TWI698750 B TW I698750B
Authority
TW
Taiwan
Prior art keywords
check code
data
metadata
generate
adjusted
Prior art date
Application number
TW108109114A
Other languages
Chinese (zh)
Other versions
TW201941069A (en
Inventor
楊宗杰
Original Assignee
慧榮科技股份有限公司
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 慧榮科技股份有限公司 filed Critical 慧榮科技股份有限公司
Priority to TW108109114A priority Critical patent/TWI698750B/en
Publication of TW201941069A publication Critical patent/TW201941069A/en
Application granted granted Critical
Publication of TWI698750B publication Critical patent/TWI698750B/en

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The present invention provides a method for accessing a flash memory module, wherein the method includes: receiving data and a corresponding metadata from a host; performing a CRC operation upon the data to generate a CRC code; encoding the metadata and the CRC code to generate an adjusted parity code; encoding the data and the adjusted parity code to generate encoded data, wherein the encoded data includes the data, the adjusted parity code and an error correction code corresponding to the data and the adjusted parity code; and writing the encoded data and the metadata to a page of a block of a flash memory module.

Description

存取快閃記憶體模組的方法及相關的快閃記憶體控制器與電 子裝置 Method for accessing flash memory module and related flash memory controller and electric Sub-device

本發明係有關於快閃記憶體,尤指一種存取快閃記憶體模組的方法。 The present invention relates to flash memory, in particular to a method of accessing flash memory modules.

當快閃記憶體控制器將來自一主裝置的資料寫入至快閃記憶體模組中的一資料頁時,會同時地在該資料頁的一備用區域(spare area)中寫入對應於該資料的一元資料(metadata),以供後續參考使用。上述的元資料可以由快閃記憶體控制器所產生,或是由主裝置所提供。然而,當該元資料是由主裝置所提供時,由於該元資料在寫入到該資料頁的過程中可能會暫時地儲存在快閃記憶體控制器的靜態隨機存取記憶體(Static Random Access Memory,SRAM)以及外部的動態隨機存取記憶體(Dynamic Random Access Memory,DRAM),故在這些階段有可能會造成該元資料的資料有錯誤產生,進而使得寫入到該資料頁的內容也是錯誤的,影響到後續資料讀取時的困擾。 When the flash memory controller writes data from a master device to a data page in the flash memory module, it will simultaneously write data corresponding to a spare area of the data page The metadata of the data for subsequent reference. The above metadata can be generated by the flash memory controller or provided by the host device. However, when the metadata is provided by the host device, the metadata may be temporarily stored in the static random access memory (Static Random Access Memory) of the flash memory controller during the process of writing to the data page. Access Memory (SRAM) and external dynamic random access memory (Dynamic Random Access Memory, DRAM). Therefore, at these stages, the metadata of the metadata may be generated incorrectly, which will cause the content to be written to the data page. It is also wrong, which affects the trouble of subsequent data reading.

因此,本發明的目的之一在於提供一種存取快閃記憶體模組的方 法,其可以將來自主裝置的元資料進行保護,以避免先前技術中所述之因為靜態隨機存取記憶體或是動態隨機存取記憶體存取所造成之元資料錯誤的問題。 Therefore, one of the objectives of the present invention is to provide a method for accessing flash memory modules In this way, the metadata of the autonomous device can be protected to avoid the problem of metadata errors caused by static random access memory or dynamic random access memory as described in the prior art.

在本發明的一個實施例中,揭露一種存取一快閃記憶體模組的方法,其包含有以下步驟:自一主裝置接收一資料及對應於該資料的一元資料;對該資料進行循環冗餘校驗操作以產生一循環冗餘校驗碼;將該元資料與該循環冗餘校驗碼進行編碼操作以產生一調整後校驗碼;將該資料與該調整後校驗碼一併進行編碼操作以產生一編碼後資料,其中該編碼後資料包含了該資料、該調整後校驗碼以及對應於該資料及該調整後校驗碼的一錯誤更正碼;以及將該編碼後資料以及該元資料寫入至該快閃記憶體模組之一區塊中的一資料頁。 In one embodiment of the present invention, a method for accessing a flash memory module is disclosed, which includes the following steps: receiving a data and a meta data corresponding to the data from a host device; looping the data The redundancy check operation is performed to generate a cyclic redundancy check code; the metadata and the cyclic redundancy check code are encoded to generate an adjusted check code; the data and the adjusted check code are one And perform an encoding operation to generate an encoded data, where the encoded data includes the data, the adjusted check code, and an error correction code corresponding to the data and the adjusted check code; and the encoded data The data and the metadata are written to a data page in a block of the flash memory module.

在本發明的另一個實施例中,揭露了一種快閃記憶體控制器,其中該快閃記憶體控制器係用來存取一快閃記憶體模組,且該快閃記憶體控制器包含有一唯讀記憶體、一微處理器以及多個編解碼器,其中該唯讀記憶體用來儲存一程式碼,且該微處理器用來執行該程式碼以控制對該快閃記憶體模組之存取。在快閃記憶體控制器的操作中,當該快閃記憶體控制器自一主裝置接收一資料及對應於該資料的一元資料時,該多個編解碼器對該資料進行循環冗餘校驗操作以產生一循環冗餘校驗碼,將該元資料與該循環冗餘校驗碼進行編碼操作以產生一調整後校驗碼,並將該資料與該調整後校驗碼一併進行編碼操作以產生一編碼後資料,其中該編碼後資料包含了該資料、該調整後校驗碼以及對應於該資料及該調整後校驗碼的一錯誤更正碼;以及該微處理器將該編碼後資料以及該元資料寫入至該快閃記憶體模組之一區塊中的一資料頁。 In another embodiment of the present invention, a flash memory controller is disclosed, wherein the flash memory controller is used to access a flash memory module, and the flash memory controller includes There is a read-only memory, a microprocessor, and multiple codecs, wherein the read-only memory is used to store a program code, and the microprocessor is used to execute the program code to control the flash memory module的Access. In the operation of the flash memory controller, when the flash memory controller receives a piece of data and the unary data corresponding to the piece of data from a host device, the multiple codecs perform cyclic redundancy calibration on the data. Perform a verification operation to generate a cyclic redundancy check code, perform an encoding operation on the metadata and the cyclic redundancy check code to generate an adjusted check code, and perform the data and the adjusted check code together Encoding operation to generate an encoded data, where the encoded data includes the data, the adjusted check code, and an error correction code corresponding to the data and the adjusted check code; and the microprocessor The encoded data and the metadata are written to a data page in a block of the flash memory module.

在本發明的另一個實施例中,揭露了一種電子裝置,其包含有一快 閃記憶體模組以及一快閃記憶體控制器。當該快閃記憶體控制器自一主裝置接收一資料及對應於該資料的一元資料時,該快閃記憶體控制器對該資料進行循環冗餘校驗操作以產生一循環冗餘校驗碼,將該元資料與該循環冗餘校驗碼進行編碼操作以產生一調整後校驗碼,並將該資料與該調整後校驗碼一併進行編碼操作以產生一編碼後資料,其中該編碼後資料包含了該資料、該調整後校驗碼以及對應於該資料及該調整後校驗碼的一錯誤更正碼;以及該快閃記憶體控制器將該編碼後資料以及該元資料寫入至該快閃記憶體模組之一區塊中的一資料頁。 In another embodiment of the present invention, an electronic device is disclosed, which includes a fast Flash memory module and a flash memory controller. When the flash memory controller receives a data and a metadata corresponding to the data from a host device, the flash memory controller performs a cyclic redundancy check operation on the data to generate a cyclic redundancy check Code, the metadata and the cyclic redundancy check code are encoded to generate an adjusted check code, and the data and the adjusted check code are encoded together to generate an encoded data, wherein The encoded data includes the data, the adjusted check code, and an error correction code corresponding to the data and the adjusted check code; and the flash memory controller includes the encoded data and the metadata Write to a data page in a block of the flash memory module.

100:記憶裝置 100: memory device

110:快閃記憶體控制器 110: Flash memory controller

112:微處理器 112: Microprocessor

112C:程式碼 112C: Code

112M:唯讀記憶體 112M: Read only memory

114:控制邏輯 114: Control logic

116:緩衝記憶體 116: buffer memory

118:介面邏輯 118: Interface logic

120:快閃記憶體模組 120: Flash memory module

130:主裝置 130: main device

132:第一編解碼器 132: The first codec

134:第二編解碼器 134: second codec

136:第三編解碼器 136: third codec

200~212、600~614:步驟 200~212, 600~614: steps

D1~D8:第一資料的多個部分 D1~D8: Multiple parts of the first data

M1~M4:元資料的多個部分 M1~M4: Multiple parts of metadata

P1~P8、P11~P41:循環冗餘校驗碼 P1~P8, P11~P41: cyclic redundancy check code

P1’~P8’、P11’~P41’:調整後校驗碼 P1’~P8’, P11’~P41’: Check code after adjustment

ECC1、ECC2:錯誤更正碼 ECC1, ECC2: Error correction code

第1圖為依據本發明一實施例之一種記憶裝置的示意圖。 FIG. 1 is a schematic diagram of a memory device according to an embodiment of the invention.

第2圖為根據本發明一實施例之存取快閃記憶體模組的方法的流程圖。 FIG. 2 is a flowchart of a method for accessing a flash memory module according to an embodiment of the invention.

第3圖為第一筆資料及對應之元資料的示意圖。 Figure 3 is a schematic diagram of the first data and the corresponding metadata.

第4圖為根據本發明一實施例之循環冗餘校驗操作以及互斥或運算的示意圖。 FIG. 4 is a schematic diagram of cyclic redundancy check operation and mutual exclusion OR operation according to an embodiment of the present invention.

第5圖為根據本發明一實施例之錯誤更正碼組塊以及區段組塊的示意圖。 Figure 5 is a schematic diagram of an error correction code block and a sector block according to an embodiment of the invention.

第6圖為根據本發明一實施例之讀取快閃記憶體模組的方法的流程圖。 FIG. 6 is a flowchart of a method for reading a flash memory module according to an embodiment of the invention.

第7圖為根據本發明另一實施例之循環冗餘校驗操作以及互斥或運算的示意圖。 FIG. 7 is a schematic diagram of cyclic redundancy check operation and mutual exclusion OR operation according to another embodiment of the present invention.

請參考第1圖,第1圖為依據本發明一實施例之一種記憶裝置100的示意圖。記憶裝置100包含有一快閃記憶體(Flash Memory)模組120以及一快閃記 憶體控制器110,且快閃記憶體控制器110用來存取快閃記憶體模組120。依據本實施例,快閃記憶體控制器110包含一微處理器112、一唯讀記憶體(Read Only Memory,ROM)112M、一控制邏輯114、一緩衝記憶體116、與一介面邏輯118。唯讀記憶體112M係用來儲存一程式碼112C,而微處理器112則用來執行程式碼112C以控制對快閃記憶體模組120之存取(Access)。控制邏輯114包含了一第一編解碼器132、一第二編解碼器134及一第三編解碼器136,在本實施例中,第一編解碼器132係用來進行循環冗餘校驗(Cyclic redundancy check,CRC)操作,第二編解碼器134係用來進行互斥或(exclusive-OR,XOR)運算,而第三編解碼器136係用來進行低密度奇偶檢查碼(Low-density parity-check code,LDPC code)操作,但本發明並不以此為限。 Please refer to FIG. 1. FIG. 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 (Flash Memory) module 120 and a flash memory The 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 read-only memory 112M is used to store a program code 112C, and the microprocessor 112 is used to execute the program code 112C to control access to the flash memory module 120. The control logic 114 includes a first codec 132, a second codec 134, and a third codec 136. In this embodiment, the first codec 132 is used for cyclic redundancy check (Cyclic redundancy check, CRC) operation, the second codec 134 is used for exclusive-OR (exclusive-OR, XOR) operation, and the third codec 136 is used for low-density parity check code (Low- density parity-check code, LDPC code) operation, but the present invention is not limited to this.

於典型狀況下,快閃記憶體模組120包含了多個快閃記憶體晶片,而每一個快閃記憶體晶片包含複數個區塊(Block),而該控制器(例如:透過微處理器112執行程式碼112C之快閃記憶體控制器110)對快閃記憶體模組120進行抹除等運作係以區塊為單位來進行。另外,一區塊可記錄特定數量的資料頁(Page),其中該控制器(例如:透過微處理器112執行程式碼112C之記憶體控制器110)對快閃記憶體模組120進行寫入資料之運作係以資料頁為單位來進行寫入。在本實施例中,快閃記憶體模組120為一立體NAND型快閃記憶體(3D NAND-type flash)。 In a typical situation, the flash memory module 120 includes a plurality of flash memory chips, and each flash memory chip includes a plurality of blocks, and the controller (for example, through a microprocessor) 112 The flash memory controller 110 that executes the program code 112C) erases the flash memory module 120 and other operations are performed in units of blocks. In addition, a block can record a specific number of pages, where the controller (for example, the memory controller 110 that executes the program code 112C through the microprocessor 112) writes the flash memory module 120 The operation of the data is to write in the data page unit. In this embodiment, the flash memory module 120 is a 3D NAND-type flash.

實作上,透過微處理器112執行程式碼112C之快閃記憶體控制器110可利用其本身內部之元件來進行諸多控制運作,例如:利用控制邏輯114來控制快閃記憶體模組120之存取運作(尤其是對至少一區塊或至少一資料頁之存取運作)、利用緩衝記憶體116進行所需之緩衝處理、以及利用介面邏輯118來與一主 裝置(Host Device)130溝通。緩衝記憶體116可以是靜態隨機存取記憶體(Static RAM,SRAM),但本發明不限於此。 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 many control operations, for example, using the control logic 114 to control the flash memory module 120 Access operations (especially access operations to at least one block or at least one data page), use the buffer memory 116 to perform the required buffer processing, and use the interface logic 118 to communicate with a host The device (Host Device) 130 communicates. The buffer memory 116 may be a static random access memory (Static RAM, SRAM), but the invention is not limited thereto.

在一實施例中,記憶裝置100可以是可攜式記憶裝置(例如:符合SD/MMC、CF、MS、XD標準之記憶卡),且主裝置130為一可與記憶裝置連接的電子裝置,例如手機、筆記型電腦、桌上型電腦...等等。而在另一實施例中,記憶裝置100可以是固態硬碟或符合通用快閃記憶體儲存(Universal Flash Storage,UFS)或嵌入式多媒體記憶卡(Embedded Multi Media Card,EMMC)規格之嵌入式儲存裝置,以設置在一電子裝置中,例如設置在手機、筆記型電腦、桌上型電腦之中,而此時主裝置130可以是該電子裝置的一處理器。 In one embodiment, the memory device 100 may be a portable memory device (for example, a memory card that complies with SD/MMC, CF, MS, and XD standards), and the main device 130 is an electronic device that can be connected to the memory device. Such as mobile phones, laptops, desktop computers... etc. In another embodiment, the memory device 100 may be a solid state drive or an embedded storage that meets Universal Flash Storage (UFS) or Embedded Multi Media Card (EMMC) specifications. The device may be installed in an electronic device, such as a mobile phone, a notebook computer, or a desktop computer. In this case, the main device 130 may be a processor of the electronic device.

第2圖為根據本發明一實施例之存取快閃記憶體模組120的方法的流程圖。在步驟200,流程開始,且快閃記憶體控制器110準備自主裝置130接收資料並儲存至快閃記憶體模組120中。在步驟202中,快閃記憶體控制器110自主裝置130接收第一筆資料及對應於第一筆資料的元資料,其中該元資料可以包含第一筆資料的識別資訊(ID)、雜湊資料(hash data)、服務品質(Quality of Service,QoS)資訊、或是其他的管理資訊,例如邏輯位址(logical address)與資料本身以外的管理資訊...等等。在本實施例中,參考第3圖,第一筆資料的大小為4千位元組(KB),而元資料為8位元組,而在本實施例之以下的操作中,第一筆資料被分為大小為512位元組的八個部分D1~D8,而元資料則被分為大小為2位元組的四個部分M1~M4。 FIG. 2 is a flowchart of a method of accessing the flash memory module 120 according to an embodiment of the invention. In step 200, the process starts, and the flash memory controller 110 prepares the autonomous device 130 to receive data and store it in the flash memory module 120. In step 202, the autonomous device 130 of the flash memory controller 110 receives the first data and the metadata corresponding to the first data, where the metadata may include the identification information (ID) and hash data of the first data. (hash data), Quality of Service (QoS) information, or other management information, such as logical address and management information other than the data itself... etc. In this embodiment, referring to Figure 3, the size of the first piece of data is 4 kilobytes (KB), and the metadata is 8 bytes. In the following operations of this embodiment, the first piece of data The data is divided into eight parts D1~D8 with a size of 512 bytes, and the metadata is divided into four parts M1~M4 with a size of 2 bytes.

在步驟204中,第一編解碼器132對第一筆資料進行循環冗餘校驗操作以產生一循環冗餘校驗碼,且在步驟206中第二編解碼器134將元資料與該循 環冗餘校驗碼進行編碼操作以產生一調整後校驗碼。具體來說,參考第4圖,第一編解碼器132先對第一筆資料的八個部分D1~D8分別進行循環冗餘校驗操作,以產生多個循環冗餘校驗碼P1~P8,其中每一個循環冗餘校驗碼P1~P8的大小為2位元組;之後,第二編解碼器134再將循環冗餘校驗碼P1~P4分別與元資料的四個部分M1~M4進行互斥或運算,以分別產生調整後校驗碼P1’~P4’;以及第二編解碼器134也將循環冗餘校驗碼P5~P8分別與元資料的四個部分M1~M4進行互斥或運算,以分別產生調整後校驗碼P5’~P8’。 In step 204, the first codec 132 performs a cyclic redundancy check operation on the first piece of data to generate a cyclic redundancy check code, and in step 206, the second codec 134 compares the metadata with the cyclic redundancy check code. The ring redundancy check code performs an encoding operation to generate an adjusted check code. Specifically, referring to Figure 4, the first codec 132 first performs a cyclic redundancy check operation on the eight parts D1~D8 of the first data respectively to generate multiple cyclic redundancy check codes P1~P8 , The size of each cyclic redundancy check code P1~P8 is 2 bytes; after that, the second codec 134 then compares the cyclic redundancy check code P1~P4 with the four parts M1~ of the metadata respectively. M4 performs mutually exclusive OR operation to generate adjusted check codes P1'~P4' respectively; and the second codec 134 also combines the cyclic redundancy check codes P5~P8 with the four parts M1~M4 of the metadata respectively Perform mutually exclusive OR operations to generate adjusted check codes P5'~P8' respectively.

需注意的是步驟204及步驟206係在快閃記憶體控制器110接收到第一筆資料以及元資料後便立刻進行,而此時第一筆資料及元資料尚未被儲存至緩衝記憶體116及/或外部的動態隨機存取記憶體(未繪示)中。步驟204中對第一筆資料進行循環冗餘校驗操作的目的是為了避免後續在緩衝記憶體116及/或外部的動態隨機存取記憶體的存取過程中發生錯誤(亦即,提供點對點保護(end to end protection)),而步驟206中將循環冗餘校驗碼P1~P4與元資料的四個部分M1~M4進行互斥或運算的目的則是為了讓調整後校驗碼P1’~P4’也能夠包含元資料的資訊內容,亦即調整後校驗碼P1’~P4’除了可以對第一筆資料提供保護之外,也可以同時地對元資料提供保護。 It should be noted that steps 204 and 206 are performed immediately after the flash memory controller 110 receives the first data and metadata, and at this time the first data and metadata have not been stored in the buffer memory 116. And/or external dynamic random access memory (not shown). The purpose of performing the cyclic redundancy check operation on the first data in step 204 is to avoid subsequent errors in the access process of the buffer memory 116 and/or external dynamic random access memory (that is, to provide point-to-point End to end protection), and in step 206, the cyclic redundancy check code P1~P4 and the four parts M1~M4 of the metadata are mutually exclusive or the purpose is to make the adjusted check code P1 '~P4' can also contain the information content of the metadata, that is, the adjusted check code P1'~P4 can not only protect the first data, but also protect the metadata at the same time.

在步驟208中,第三編解碼器136將第一筆資料與調整後校驗碼一併進行編碼操作以產生一編碼後資料,其中編碼後資料包含了第一筆資料、調整後校驗碼以及對應於第一筆資料及調整後校驗碼的一錯誤更正碼。具體來說,參考第5圖,第三編解碼器136將第一筆資料的四個部分D1~D4以及對應的調整後校驗碼P1’~P4’一併進行編碼(LDPC編碼),以產生一錯誤更正碼ECC1,而第一筆資料的四個部分D1~D4、調整後校驗碼P1’~P4’以及錯誤更正碼ECC1則構成 了一個錯誤更正碼組塊(ECC chunk);且第三編解碼器136也將第一筆資料的另外四個部分D5~D8以及對應的調整後校驗碼P5’~P8’一併進行編碼,以產生一錯誤更正碼ECC2,而第一筆資料的四個部分D5~D8、調整後校驗碼P5’~P8’以及錯誤更正碼ECC2則構成了另一個錯誤更正碼組塊。 In step 208, the third codec 136 performs an encoding operation on the first data and the adjusted check code together to generate an encoded data, where the encoded data includes the first data and the adjusted check code And an error correction code corresponding to the first data and the adjusted check code. Specifically, referring to Figure 5, the third codec 136 encodes the four parts D1~D4 of the first data and the corresponding adjusted check codes P1'~P4' together (LDPC encoding) to An error correction code ECC1 is generated, and the four parts D1~D4 of the first data, the adjusted check code P1'~P4' and the error correction code ECC1 constitute An error correction code block (ECC chunk); and the third codec 136 also encodes the other four parts D5~D8 of the first data and the corresponding adjusted check codes P5'~P8' together , To generate an error correction code ECC2, and the four parts D5~D8 of the first data, the adjusted check code P5'~P8' and the error correction code ECC2 constitute another error correction code block.

在步驟210中,第5圖所示的兩個錯誤更正碼組塊構成了一個區段組塊,並暫存至緩衝記憶體116及/或外部的動態隨機存取記憶體中,其中上述的區段組塊係用來儲存至一資料頁的一個區段中。 In step 210, the two error correction code blocks shown in Figure 5 form a sector block, and are temporarily stored in the buffer memory 116 and/or an external dynamic random access memory, wherein the above The section block is used to store in a section of a data page.

在步驟212中,假設一個資料頁的大小為16千位元組,則快閃記憶體控制器110重複步驟202~210以自主裝置130接收第二、三、四筆資料及對應之元資料並產生對應的區段組塊之後,再將四個區段組塊連同32位元組的元資料寫入至快閃記憶體模組120中一區塊的一個資料頁中,其中元資料係儲存在該資料頁的一備用區域(spare area)中。 In step 212, assuming that the size of a data page is 16 kilobytes, the flash memory controller 110 repeats steps 202 to 210 to receive the second, third, and fourth data and the corresponding metadata with the autonomous device 130 After the corresponding segment block is generated, four segment blocks and 32-byte metadata are written to a data page of a block in the flash memory module 120, where the metadata is stored In a spare area of the data page.

第6圖為根據本發明一實施例之讀取快閃記憶體模組120的方法的流程圖,其中第6圖的流程係接續著第2~5圖所示的實施例,亦即快閃記憶體控制器110讀取儲存有四個區段組塊SC1~SC4以及32位元組之元資料的資料頁。在步驟600,流程開始。在步驟602中,快閃記憶體控制器110接收到來自主裝置130的一讀取命令,而在本實施例中係假設該讀取命令係要求讀取區段組塊SC1的資料以及對應的元資料。 Fig. 6 is a flowchart of a method for reading a flash memory module 120 according to an embodiment of the present invention, wherein the process in Fig. 6 follows the embodiment shown in Figs. 2 to 5, that is, flash The memory controller 110 reads the data page storing the four sector blocks SC1 to SC4 and the 32-byte metadata. At step 600, the process starts. In step 602, the flash memory controller 110 receives a read command from the autonomous device 130. In this embodiment, it is assumed that the read command requires reading the data of the segment block SC1 and the corresponding element. data.

在步驟604中,第三編解碼器136區段組塊SC1中的第一個錯誤更正碼組塊與第二個錯誤更正碼組塊進行解碼,以產生如第5圖所示之第一筆資料的四 個部分D1~D4與調整後校驗碼P1’~P4’、以及第一筆資料的另四個部分D5~D8與調整後校驗碼P5’~P8’。 In step 604, the first error correction code block and the second error correction code block in the section block SC1 of the third codec 136 are decoded to generate the first block as shown in Figure 5. Data four One part D1~D4 and adjusted check code P1’~P4’, and the other four parts D5~D8 of the first data and adjusted check code P5’~P8’.

在步驟606中,第一編解碼器132對解碼所產生的第一筆資料的四個部分D1~D4分別進行循環冗餘校驗操作以產生另一循環冗餘校驗碼,且在步驟608中,第二編解碼器134對該另一循環冗餘校驗碼與自該資料頁中所讀取的元資料進行編碼以產生另一調整後校驗碼。具體來說,參考第7圖,第一編解碼器132先對所解碼出之第一筆資料的四個部分D1~D4分別進行循環冗餘校驗操作,以產生多個循環冗餘校驗碼P11~P41,其中每一個循環冗餘校驗碼P11~P41的大小為2位元組;之後,第二編解碼器134再將循環冗餘校驗碼P11~P41分別與自資料頁中所讀取之元資料的四個部分M1~M4進行互斥或運算,以分別產生調整後校驗碼P11’~P41’。 In step 606, the first codec 132 performs a cyclic redundancy check operation on the four parts D1~D4 of the first data generated by decoding to generate another cyclic redundancy check code, and in step 608 Here, the second codec 134 encodes the other cyclic redundancy check code and the metadata read from the data page to generate another adjusted check code. Specifically, referring to Figure 7, the first codec 132 first performs a cyclic redundancy check operation on the four parts D1~D4 of the first data decoded to generate multiple cyclic redundancy checks. Code P11~P41, the size of each cyclic redundancy check code P11~P41 is 2 bytes; after that, the second codec 134 then connects the cyclic redundancy check code P11~P41 with the data page respectively The four parts M1~M4 of the read metadata perform mutually exclusive OR operations to generate adjusted check codes P11'~P41' respectively.

在步驟610中,微處理器112判斷調整後校驗碼P11’~P41’是否分別與調整後校驗碼P1’~P4’完全相同,若是,流程進入步驟612;若否,則流程進入步驟614。 In step 610, the microprocessor 112 determines whether the adjusted check codes P11'~P41' are exactly the same as the adjusted check codes P1'~P4' respectively. If yes, the process goes to step 612; if not, the process goes to step 614.

在步驟612中,由於整後校驗碼P11’~P41’分別與調整後校驗碼P1’~P4’完全相同,因此可以確保第一筆資料的四個部分D1~D4以及元資料的內容均是正確的,則後續微處理器112可以將第一筆資料的四個部分D1~D4及對應的元資料傳送至主裝置130。此外,在一實施例中,由於元資料的內容已經被確認正確了,故第一筆資料的另外四個部分D5~D8可以直接一起被傳送給主裝置130,而不需要再次進行步驟606~610的操作。 In step 612, since the adjusted check codes P11'~P41' are exactly the same as the adjusted check codes P1'~P4', the contents of the four parts D1~D4 and the metadata of the first data can be ensured If all are correct, the subsequent microprocessor 112 can transmit the four parts D1 to D4 of the first data and the corresponding metadata to the main device 130. In addition, in one embodiment, since the content of the metadata has been confirmed to be correct, the other four parts D5~D8 of the first data can be directly transmitted to the main device 130 together, without the need to perform steps 606~ 610 operations.

在步驟614中,由於整後校驗碼P11’~P41’分別與調整後校驗碼P1’~P4’不完全相同,則由於可能是第一筆資料的內容有錯誤或是元資料的內容有誤,故微處理器112回傳一錯誤訊息至主裝置130。 In step 614, since the adjusted check codes P11'~P41' are not exactly the same as the adjusted check codes P1'~P4', it may be that the content of the first data is incorrect or the content of the metadata There is an error, so the microprocessor 112 returns an error message to the main device 130.

簡要歸納本發明,在本發明的實施例中,在快閃記憶體控制器自主裝置接收到一資料及對應的元資料時,會先對該資料進行循環冗餘校驗操作以產生一循環冗餘校驗碼,並再將元資料與循環冗餘校驗碼一併進行編碼以產生具有相同位元數的調整後校驗碼,以使得調整後校驗碼除了可以對該資料進行點對點保護之外,也可以對元資料進行點對點保護。透過本發明的實施例,可以不需要再額外對元資料進行循環冗餘校驗操作,且也不會額外增加資料量,以盡可能地節省快閃記憶體的空間。以上所述僅為本發明之較佳實施例,凡依本發明申請專利範圍所做之均等變化與修飾,皆應屬本發明之涵蓋範圍。 To briefly summarize the present invention, in the embodiment of the present invention, when the flash memory controller autonomous device receives a data and corresponding metadata, it will first perform a cyclic redundancy check operation on the data to generate a cyclic redundancy. Check code, and then encode the metadata and cyclic redundancy check code together to generate an adjusted check code with the same number of bits, so that the adjusted check code can not only protect the data point-to-point In addition, metadata can also be protected point-to-point. Through the embodiments of the present invention, there is no need to perform additional cyclic redundancy check operations on metadata, and the amount of data is not increased, so as to save the space of the flash memory as much as possible. The foregoing descriptions are only preferred embodiments of the present invention, and all equivalent changes and modifications made in accordance with the scope of the patent application of the present invention shall fall within the scope of the present invention.

200~212:步驟 200~212: steps

Claims (10)

一種存取一快閃記憶體模組的方法,包含有:自一主裝置接收一資料及對應於該資料的一元資料(metadata);在該資料尚未被儲存至一緩衝記憶體或是一動態隨機存取記憶體時,對該資料進行校驗碼計算操作以產生一校驗碼,以進行點對點保護(end to end protection)來避免後續緩衝記憶體或是該動態隨機存取記憶體之存取過程中的錯誤;將該元資料與該校驗碼進行一第一編碼操作以產生一調整後校驗碼;將該資料與該調整後校驗碼一併進行一第二編碼操作以產生一編碼後資料,並將該編碼後資料儲存至該緩衝記憶體或是該動態隨機存取記憶體,其中該編碼後資料包含了該資料、該調整後校驗碼以及對應於該資料及該調整後校驗碼的一錯誤更正碼;以及將該編碼後資料以及該元資料寫入至該快閃記憶體模組之一區塊中的一資料頁。 A method for accessing a flash memory module includes: receiving a data and a metadata corresponding to the data from a host device; when the data has not been stored in a buffer memory or a dynamic When randomly accessing the memory, a check code calculation operation is performed on the data to generate a check code to perform end to end protection to avoid subsequent buffer memory or the storage of the dynamic random access memory. Errors in the fetching process; perform a first encoding operation on the metadata and the check code to generate an adjusted check code; perform a second encoding operation on the data and the adjusted check code together to generate A coded data, and store the coded data in the buffer memory or the dynamic random access memory, where the coded data includes the data, the adjusted check code, and the data and the An error correction code of the adjusted check code; and write the encoded data and the metadata to a data page in a block of the flash memory module. 如申請專利範圍第1項所述之方法,其中將該元資料與該校驗碼進行該第一編碼操作以產生該調整後校驗碼的步驟包含有:將該元資料與該校驗碼進行互斥或(XOR)運算以產生該調整後校驗碼。 For the method described in item 1 of the scope of patent application, the step of performing the first encoding operation on the metadata and the check code to generate the adjusted check code includes: the metadata and the check code Perform exclusive OR (XOR) operation to generate the adjusted check code. 如申請專利範圍第1項所述之方法,其中該資料包含了多個部分,且對該資料進行校驗碼計算操作以產生該校驗碼以及將該元資料與該校驗碼進行該第一編碼操作以產生該調整後校驗碼的步驟包含有:分別對該資料的該多個部分進行校驗碼計算操作以產生該校驗碼的多個部分; 將該元資料劃分為多個部分;以及分別將該元資料的該多個部分與該校驗碼的該多個部分進行該第一編碼操作以分別產生該調整後校驗碼的多個部分。 For example, the method described in item 1 of the scope of patent application, wherein the data includes multiple parts, and the data is subjected to a check code calculation operation to generate the check code, and the metadata and the check code are performed on the first The step of an encoding operation to generate the adjusted check code includes: performing check code calculation operations on the multiple parts of the data to generate multiple parts of the check code; Dividing the metadata into multiple parts; and performing the first encoding operation on the multiple parts of the metadata and the multiple parts of the check code to respectively generate multiple parts of the adjusted check code . 如申請專利範圍第3項所述之方法,其中該元資料的每一個部分的位元數與該校驗碼的每一個部分的位元數相同,且分別將該元資料的該多個部分與該校驗碼的該多個部分進行該第一編碼操作以產生該調整後校驗碼的該多個部分的步驟包含有:將該元資料的該多個部分與該校驗碼的該多個部分進行互斥或運算以產生該調整後校驗碼的該多個部分。 The method described in item 3 of the scope of patent application, wherein the number of bits in each part of the metadata is the same as the number of bits in each part of the check code, and the multiple parts of the metadata are respectively The step of performing the first encoding operation with the multiple parts of the check code to generate the multiple parts of the adjusted check code includes: the multiple parts of the metadata and the check code The multiple parts perform mutually exclusive OR operations to generate the multiple parts of the adjusted check code. 如申請專利範圍第1項所述之方法,另包含有:因應該主裝置的一讀取請求以自該資料頁中讀取該編碼後資料以及該元資料;對該編碼後資料進行解碼以產生該資料以及該調整後校驗碼;將該資料進行校驗碼計算操作以產生另一校驗碼;將該另一校驗碼與自該資料頁中所讀取的該元資料進行編碼以產生另一調整後校驗碼;以及比對該調整後校驗碼以及該另一調整後校驗碼,以判斷儲存在該資料頁中的該元資料是否有錯誤。 For example, the method described in item 1 of the scope of patent application further includes: reading the encoded data and the metadata from the data page in response to a read request from the host device; and decoding the encoded data to Generate the data and the adjusted check code; perform check code calculation operations on the data to generate another check code; encode the other check code with the metadata read from the data page To generate another adjusted check code; and compare the adjusted check code with the another adjusted check code to determine whether the metadata stored in the data page has errors. 如申請專利範圍第5項所述之方法,另包含有:當該調整後校驗碼與該另一調整後校驗碼的內容不完全相同時,判斷儲存在該資料頁中的該元資料有錯誤,並回傳一錯誤訊息至該主裝置;以 及當該調整後校驗碼與該另一調整後校驗碼的內容完全相同時,判斷儲存在該資料頁中的該元資料正確,並將該資料以及該元資料回傳至該主裝置。 For example, the method described in item 5 of the scope of patent application further includes: when the content of the adjusted check code is not exactly the same as the content of the other adjusted check code, determine the metadata stored in the data page There is an error, and an error message is returned to the host device; And when the content of the adjusted check code is exactly the same as the content of the other adjusted check code, determine that the metadata stored in the data page is correct, and return the data and the metadata to the host device . 如申請專利範圍第1項所述之方法,其中該元資料包含該資料的識別資訊、雜湊資料或是服務品質(Quality of Service,QoS)資訊。 Such as the method described in item 1 of the scope of patent application, wherein the metadata includes identification information, hash data, or Quality of Service (QoS) information of the data. 一種快閃記憶體控制器,其中該快閃記憶體控制器係用來存取一快閃記憶體模組,且該快閃記憶體控制器包含有:一唯讀記憶體,用來儲存一程式碼;一微處理器,用來執行該程式碼以控制對該快閃記憶體模組之存取;以及多個編解碼器;其中當該快閃記憶體控制器自一主裝置接收一資料及對應於該資料的一元資料(metadata),在該資料尚未被儲存至一緩衝記憶體或是一動態隨機存取記憶體時,該多個編解碼器對該資料進行校驗碼計算操作以產生一校驗碼,以進行點對點保護(end to end protection)來避免後續緩衝記憶體或是該動態隨機存取記憶體之存取過程中的錯誤;並將該元資料與該校驗碼進行一第一編碼操作以產生一調整後校驗碼,且將該資料與該調整後校驗碼一併進行一第二編碼操作以產生一編碼後資料並儲存至該緩衝記憶體或是該動態隨機存取記憶體,其中該編碼後資料包含了該資料、該調整後校驗碼以及對應於該資料及該調整後校驗碼的一錯誤更正碼;以及該微處理器將該編碼後資料以及該元資料寫入至該快閃記憶體模組之一區塊中的一資料頁。 A flash memory controller, wherein the flash memory controller is used to access a flash memory module, 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; and multiple codecs; wherein when the flash memory controller receives a host device from a Data and metadata corresponding to the data. When the data has not been stored in a buffer memory or a dynamic random access memory, the multiple codecs perform a check code calculation operation on the data A check code is generated to perform end to end protection to avoid errors in the subsequent buffer memory or the access process of the dynamic random access memory; and the metadata and the check code are combined Perform a first encoding operation to generate an adjusted check code, and perform a second encoding operation on the data and the adjusted check code together to generate an encoded data and store it in the buffer memory or the Dynamic random access memory, wherein the encoded data includes the data, the adjusted check code, and an error correction code corresponding to the data and the adjusted check code; and the microprocessor encodes the code The data and the metadata are written to a data page in a block of the flash memory module. 如申請專利範圍第8項所述之快閃記憶體控制器,其中該多個編解碼器將該元資料與該校驗碼進行互斥或(XOR)運算以產生該調整後校驗碼。 The flash memory controller described in item 8 of the patent application, wherein the multiple codecs perform an exclusive OR (XOR) operation on the metadata and the check code to generate the adjusted check code. 如申請專利範圍第8項所述之快閃記憶體控制器,其中該資料包含了多個部分,且該多個編解碼器分別對該資料的該多個部分進行校驗碼計算操作以產生該校驗碼的多個部分,並將該元資料劃分為多個部分,以分別將該元資料的該多個部分與該校驗碼的該多個部分進行該第一編碼操作以分別產生該調整後校驗碼的多個部分。 The flash memory controller described in item 8 of the scope of patent application, wherein the data includes multiple parts, and the multiple codecs respectively perform check code calculation operations on the multiple parts of the data to generate The multiple parts of the check code, and divide the metadata into multiple parts to perform the first encoding operation on the multiple parts of the metadata and the multiple parts of the check code to respectively generate The multiple parts of the adjusted check code.
TW108109114A 2018-03-20 2018-03-20 Method for accessing flash memory module and associated flash memory controller and electronic device TWI698750B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW108109114A TWI698750B (en) 2018-03-20 2018-03-20 Method for accessing flash memory module and associated flash memory controller and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW108109114A TWI698750B (en) 2018-03-20 2018-03-20 Method for accessing flash memory module and associated flash memory controller and electronic device

Publications (2)

Publication Number Publication Date
TW201941069A TW201941069A (en) 2019-10-16
TWI698750B true TWI698750B (en) 2020-07-11

Family

ID=69023435

Family Applications (1)

Application Number Title Priority Date Filing Date
TW108109114A TWI698750B (en) 2018-03-20 2018-03-20 Method for accessing flash memory module and associated flash memory controller and electronic device

Country Status (1)

Country Link
TW (1) TWI698750B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4712215A (en) * 1985-12-02 1987-12-08 Advanced Micro Devices, Inc. CRC calculation machine for separate calculation of checkbits for the header packet and data packet
CN1266316A (en) * 1999-03-06 2000-09-13 德国汤姆森-布兰特有限公司 Memory bus interface and method used in IC
US7055085B2 (en) * 2002-03-07 2006-05-30 Broadcom Corporation System and method for protecting header information using dedicated CRC
US20090271532A1 (en) * 2008-04-24 2009-10-29 Allison Brian D Early header CRC in data response packets with variable gap count

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4712215A (en) * 1985-12-02 1987-12-08 Advanced Micro Devices, Inc. CRC calculation machine for separate calculation of checkbits for the header packet and data packet
CN1266316A (en) * 1999-03-06 2000-09-13 德国汤姆森-布兰特有限公司 Memory bus interface and method used in IC
US7055085B2 (en) * 2002-03-07 2006-05-30 Broadcom Corporation System and method for protecting header information using dedicated CRC
US20090271532A1 (en) * 2008-04-24 2009-10-29 Allison Brian D Early header CRC in data response packets with variable gap count

Also Published As

Publication number Publication date
TW201941069A (en) 2019-10-16

Similar Documents

Publication Publication Date Title
TWI658364B (en) Method for accessing flash memory module and associated flash memory controller and electronic device
US9817749B2 (en) Apparatus and method of offloading processing from a data storage device to a host device
US8726140B2 (en) Dummy data padding and error code correcting memory controller, data processing method thereof, and memory system including the same
US20170177259A1 (en) Techniques to Use Open Bit Line Information for a Memory System
US10691534B2 (en) Data encoding method, data decoding method and storage controller
TWI640865B (en) Decoding method, memory storage device and memory control circuit unit
TW201721435A (en) Data reading method, memory control circuit unit and memory storage apparatus
KR20190117117A (en) Data storage device and operating method thereof
TW201826285A (en) Method for performing data management in memory device, and associated memory device and controller thereof
TW202009942A (en) Data access method,memory control circuit unit and memory storage device
TW201926042A (en) Method for performing access control in a memory device, and associated memory device and controller thereof
TWI640997B (en) Data protecting method, memory control circuit unit and memory storage apparatus
US9928137B2 (en) Data storage device and error correction method
TWI661353B (en) Method for performing data processing for error handling in memory device, associated memory device and controller thereof, and associated electronic device
TW201919048A (en) Method for controlling operations of memory device, associated memory device and controller thereof, and associated electronic device
KR102350644B1 (en) Memory controller and memory system having the same
TW201303881A (en) Data processing method, memory controller, and memory storage device
US20190164625A1 (en) Memory system for error test
TWI575533B (en) Data correcting method, memory control circuit unit and memory storage device
CN108664350B (en) Data protection method, memory storage device and memory control circuit unit
CN112051963A (en) Data writing method, memory control circuit unit and memory storage device
TWI698750B (en) Method for accessing flash memory module and associated flash memory controller and electronic device
TWI634561B (en) Data protecting method, memory storage device and memory control circuit unit
CN106897023B (en) Data reading method, memory control circuit unit and memory storage device
US10942862B2 (en) Controller for minimizing flushing operations for mapping table, memory system and operating method thereof