[go: up one dir, main page]

CN106874139A - It is a kind of for error checking and the decoding method corrected, device and processor - Google Patents

It is a kind of for error checking and the decoding method corrected, device and processor Download PDF

Info

Publication number
CN106874139A
CN106874139A CN201510920256.9A CN201510920256A CN106874139A CN 106874139 A CN106874139 A CN 106874139A CN 201510920256 A CN201510920256 A CN 201510920256A CN 106874139 A CN106874139 A CN 106874139A
Authority
CN
China
Prior art keywords
data
ldpc
level
importance
bch
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN201510920256.9A
Other languages
Chinese (zh)
Inventor
刘安生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
MediaTek Singapore Pte Ltd
Original Assignee
MediaTek Singapore Pte Ltd
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 MediaTek Singapore Pte Ltd filed Critical MediaTek Singapore Pte Ltd
Priority to CN201510920256.9A priority Critical patent/CN106874139A/en
Publication of CN106874139A publication Critical patent/CN106874139A/en
Withdrawn legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1008Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices
    • G06F11/1068Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices in sector programmable memories, e.g. flash disk

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Detection And Correction Of Errors (AREA)

Abstract

This application discloses a kind of for error checking and the decoding method corrected, device and processor, wherein, the coding method includes:Storage control analyzes the significance level of the data when the write instruction of data is received;When the significance level of the data belongs to the first importance level, BCH and LDPC is respectively adopted the data are encoded, or use the LDPC of not higher than the first code check to encode the data;When the significance level of the data belongs to the second importance level, the data are encoded using the BCH or higher than the LDPC of first code check;The data after by coding are written in memory, and preserve the coding information of the data.Through the above way, code encoding/decoding mode can intelligently be configured for different pieces of information.

Description

一种用于错误检查和纠正的编解码方法、装置及处理器A codec method, device and processor for error checking and correction

技术领域technical field

本申请涉及存储技术领域,特别是一种用于错误检查和纠正的编解码方法、装置及处理器。The present application relates to the field of storage technologies, in particular to a codec method, device and processor for error checking and correction.

背景技术Background technique

NAND存储器是目前使用广泛的数据存储工具。数据在NAND存储器内部的传输和保存的过程中,可能会由于存储器的硬件故障、软件故障、硬盘错误等导致该数据的损坏。故,为了保证用户数据的完整性,则需要对存储数据进行错误检查和纠正(Error Correcting Code,简称:ECC)。NAND memory is currently a widely used data storage tool. During the process of data transmission and storage inside the NAND memory, the data may be damaged due to hardware failure, software failure, hard disk error, etc. of the memory. Therefore, in order to ensure the integrity of user data, it is necessary to perform error checking and correction (Error Correcting Code, ECC for short) on the stored data.

通常,NAND存储器在写入数据时,需要对该数据进行编码使得编码后的该数据可实现错误检查和纠正,再将该可实现错误检查和纠正的数据写入到存储器中。在需要读出数据时,对存储的数据进行对应解码以实现错误检查和纠正,进而输出经过错误检查和纠正得到的准确数据。Generally, when writing data into a NAND memory, the data needs to be encoded so that the encoded data can implement error checking and correction, and then the data that can implement error checking and correction can be written into the memory. When the data needs to be read out, the stored data is correspondingly decoded to realize error checking and correction, and then the accurate data obtained after the error checking and correction is output.

然而,现有存储器都是固定采用一种编解码方式,并不能针对不同数据而灵活配置编解码方式。However, the existing memory always adopts a codec mode fixedly, and the codec mode cannot be flexibly configured for different data.

发明内容Contents of the invention

本申请提供一种用于错误检查和纠正的编解码方法、装置及处理器,能够针对不同数据智能配置编解码方式。The present application provides a codec method, device and processor for error checking and correction, which can intelligently configure codec modes for different data.

本申请第一方面提供一种用于错误检查和纠正的编码方法,包括:存储控制器在接收到数据的写入指令时,分析所述数据的重要程度;在所述数据的重要程度属于第一重要级时,分别采用BCH和低密度奇偶校验码LDPC对所述数据进行编码,或采用不高于第一码率的LDPC对所述数据进行编码;在所述数据的重要程度属于第二重要级时,采用所述BCH或者高于所述第一码率的LDPC对所述数据进行编码,其中,所述第一重要级的重要程度高于所述第二重要级的重要程度;以及将编码后的所述数据写入到存储器中,并保存所述数据的编码信息,其中,所述数据的编码信息包括所述数据采用的编码方式。The first aspect of the present application provides an encoding method for error checking and correction, including: when the storage controller receives a data write instruction, analyze the importance of the data; when the importance of the data belongs to the first When an important level, adopt BCH and low-density parity-check code LDPC to encode described data respectively, or adopt the LDPC that is not higher than the first coding rate to encode described data; When two important levels are used, the data is encoded by using the BCH or LDPC higher than the first code rate, wherein the importance of the first important level is higher than that of the second important level; and writing the coded data into the memory, and saving the coding information of the data, wherein the coding information of the data includes the coding method adopted by the data.

其中,所述分析所述数据的重要程度的步骤,包括:分析所述数据的来源、属性及类型中的至少一种,得到所述数据的重要程度值;当所述重要程度值超过第一预设值时,确定所述数据的重要程度属于第一重要级;以及当所述重要程度值不超过所述第一预设值时,确定所述数据的重要程度属于第二重要级。Wherein, the step of analyzing the importance of the data includes: analyzing at least one of the source, attribute and type of the data to obtain the importance of the data; when the importance exceeds the first determining that the importance of the data belongs to the first level; and when the value of the importance does not exceed the first preset value, determining that the importance of the data belongs to the second level.

其中,所述第二重要级包括第一重要子级和第二重要子级;所述当所述重要程度值不超过所述第一预设值时,确定所述数据的重要程度属于第二重要级的步骤包括:当所述重要程度值不超过所述第一预设值且超过第二预设值时,确定所述数据的重要程度属于所述第一重要子级;当所述重要程度值不超过所述第二预设值时,确定所述数据的重要程度属于所述第二重要子级,其中,所述第一预设值大于所述第二预设值;以及所述在所述数据的重要程度属于第二重要级时,采用所述BCH或者高于所述第一码率的LDPC对所述数据进行编码的步骤,包括:在所述数据的重要程度属于所述第一重要子级时,采用高于预设校验位数的BCH或高于所述第一码率且低于第二码率的LDPC对所述数据进行编码,在所述数据的重要程度属于所述第二重要子级时,采用不高于所述预设校验位数的BCH或不低于所述第二码率的LDPC对所述数据进行编码,其中,所述第一码率高于所述第二码率。Wherein, the second importance level includes a first importance sub-level and a second importance sub-level; when the value of the importance level does not exceed the first preset value, it is determined that the importance level of the data belongs to the second The step of the importance level includes: when the importance degree value does not exceed the first preset value and exceeds the second preset value, determining that the importance degree of the data belongs to the first importance sub-level; When the degree value does not exceed the second preset value, it is determined that the importance of the data belongs to the second important sub-level, wherein the first preset value is greater than the second preset value; and the When the importance of the data belongs to the second importance level, the step of encoding the data by using the BCH or LDPC higher than the first code rate includes: when the importance of the data belongs to the In the first important sub-level, the data is encoded by using BCH higher than the preset parity number or LDPC higher than the first code rate and lower than the second code rate, in the importance of the data When it belongs to the second important sub-level, the data is encoded by using BCH not higher than the preset parity number or LDPC not lower than the second code rate, wherein the first code The rate is higher than the second code rate.

其中,所述存储器为SLC、MLC或TLC类型的NAND存储器;在所述将编码后的所述数据写入到存储器中,并保存所述数据的编码信息的步骤之前,所述方法还包括:确定所述存储器的类型,并当所述存储器的类型为SLC时,将LDPC解码中的有限域GF(2^q)中的所述q取值为1;当所述存储器的类型为MLC时,将所述q取值为2;当所述存储器的类型为TLC时,将所述q取值为3;以及所述数据的编码信息还包括所述q的取值。Wherein, the memory is a NAND memory of SLC, MLC or TLC type; before the step of writing the encoded data into the memory and saving the encoding information of the data, the method also includes: Determine the type of the memory, and when the type of the memory is SLC, the value of q in the finite field GF (2^q) in LDPC decoding is 1; when the type of the memory is MLC , set the value of q to 2; when the type of the memory is TLC, set the value of q to 3; and the encoding information of the data further includes the value of q.

其中,所述BCH的生成矩阵按照所述BCH的校验位数进行选择,和/或,所述LDPC的生成矩阵按照所述LDPC的码率进行选择。Wherein, the generation matrix of the BCH is selected according to the check digit of the BCH, and/or the generation matrix of the LDPC is selected according to the code rate of the LDPC.

本申请第二方面提供一种用于错误检查和纠正的解码方法,包括:存储控制器在接收到数据的读取指令时,从存储器中读取所述数据及所述数据的编码信息,其中,所述编码信息包括所述数据采用的编码方式,所述数据采用的编码方式取决于所述数据的重要程度,在所述数据的重要程度为第一重要级时,采用BCH和低密度奇偶校验码LDPC的结合或不高于第一码率的LDPC的编码方式;在所述数据的重要程度为第二重要级时,采用所述BCH或者高于所述第一码率的LDPC的编码方式,所述第一重要级的重要程度大于所述第二重要级的重要程度;根据所述编码信息确定所述数据的编码方式,并采用与所述编码方式对应的解码方式对所述数据进行解码,其中,所述解码方式包括BCH和LDPC的结合、不高于第一码率的LDPC、BCH或者高于所述第一码率的LDPC;以及输出进行所述解码后得到的数据。The second aspect of the present application provides a decoding method for error checking and correction, including: when a memory controller receives a data read instruction, reads the data and the encoding information of the data from the memory, wherein , the encoding information includes the encoding method adopted by the data, the encoding method adopted by the data depends on the importance of the data, and when the importance of the data is the first importance level, BCH and low-density parity are used A combination of check code LDPC or an encoding method of LDPC not higher than the first code rate; when the importance of the data is the second important level, the BCH or LDPC higher than the first code rate is used encoding method, the importance of the first importance level is greater than the importance of the second importance level; determine the encoding method of the data according to the encoding information, and use the decoding method corresponding to the encoding method to encode the Data is decoded, wherein the decoding method includes a combination of BCH and LDPC, LDPC not higher than the first code rate, BCH or LDPC higher than the first code rate; and outputting the data obtained after the decoding .

其中,所述第二重要级包括第一重要子级和第二重要子级,所述第一重要子级的重要程度大于所述第二重要子级的重要程度;所述数据采用的编码方式还包括在所述数据的重要程度为所述第一重要子级时而采用的高于预设校验位数的BCH或高于所述第一码率且低于第二码率的LDPC的编码方式,在所述数据的重要程度为所述第二重要子级时而采用的不高于所述预设校验位数的BCH或不低于所述第二码率的LDPC的编码方式,其中,所述第一码率高于所述第二码率;以及所述BCH或者高于所述第一码率的LDPC解码方式包括高于预设校验位数的BCH、高于所述第一码率且低于第二码率的LDPC、不高于所述预设校验位数的BCH、或不低于所述第二码率的LDPC的解码方式。Wherein, the second importance level includes a first important sublevel and a second important sublevel, and the importance of the first important sublevel is greater than that of the second important sublevel; the encoding method adopted by the data It also includes the encoding of BCH higher than the preset check digit or LDPC higher than the first code rate and lower than the second code rate when the importance of the data is the first important sub-level mode, when the importance of the data is at the second important sub-level, the encoding mode of BCH not higher than the preset check digit or LDPC not lower than the second code rate is adopted, wherein , the first code rate is higher than the second code rate; and the BCH or the LDPC decoding method higher than the first code rate includes BCH higher than the preset check digit, higher than the second code rate A decoding method of LDPC with a code rate lower than the second code rate, BCH with the preset parity number not higher than the preset check digit, or LDPC with the second code rate not lower than the second code rate.

其中,在所述根据所述编码信息确定所述数据的编码方式,并采用与所述编码方式对应的解码方式对所述数据进行解码的步骤之后,所述方法还包括检测到所述BCH的错误比特数超过预设比特值和/或所述LDPC的实际迭代次数超过预设次数时,发出所述存储器中存储所述数据的块出现问题的警报。Wherein, after the step of determining the encoding method of the data according to the encoding information, and decoding the data by using a decoding method corresponding to the encoding method, the method further includes detecting the BCH When the number of erroneous bits exceeds a preset bit value and/or the actual number of iterations of the LDPC exceeds a preset number, an alarm is sent out that there is a problem with the block storing the data in the memory.

其中,所述存储器为SLC、MLC或TLC类型的NAND存储器;所述数据的编码信息还包括q的取值,当所述存储器的类型为SLC时,所述q取值为1,当所述存储器的类型为MLC时,所述q取值为2,当所述存储器的类型为TLC时,所述q取值为3;以及在所述采用与所述编码方式对应的解码方式对所述数据进行解码的步骤中,若进行所述LDPC解码,则将所述编码信息中的所述q的取值作为所述LDPC解码中的有限域GF(2^q)中的q的取值,以进行所述LDPC解码。Wherein, the memory is a NAND memory of SLC, MLC or TLC type; the encoding information of the data also includes the value of q, when the type of the memory is SLC, the value of q is 1, when the When the type of the memory is MLC, the value of q is 2; when the type of the memory is TLC, the value of q is 3; In the step of decoding data, if the LDPC decoding is performed, the value of q in the encoded information is used as the value of q in the finite field GF(2^q) in the LDPC decoding, to perform the LDPC decoding.

其中,所述BCH的校验矩阵按照所述BCH的校验位数进行选择,和/或,所述LDPC的校验矩阵按照所述LDPC的码率进行选择。Wherein, the check matrix of the BCH is selected according to the number of check digits of the BCH, and/or the check matrix of the LDPC is selected according to the code rate of the LDPC.

本申请第三方面提供一种用于错误检查和纠正的编码装置,包括:分析模块,用于在接收到数据的写入指令时,分析所述数据的重要程度;编码模块,用于在所述数据的重要程度属于第一重要级时,分别采用BCH和低密度奇偶校验码LDPC对所述数据进行编码,或采用不高于第一码率的LDPC对所述数据进行编码;在所述数据的重要程度属于第二重要级时,采用所述BCH或者高于所述第一码率的LDPC对所述数据进行编码,其中,所述第一重要级的重要程度高于所述第二重要级的重要程度;以及写入模块,用于将编码后的所述数据写入到存储器中,并保存所述数据的编码信息,其中,所述数据的编码信息包括所述数据采用的编码方式。The third aspect of the present application provides an encoding device for error checking and correction, including: an analysis module, configured to analyze the importance of the data when receiving a data write instruction; an encoding module, configured to When the importance of the data belongs to the first importance level, respectively adopt BCH and low density parity check code LDPC to encode the data, or adopt LDPC not higher than the first code rate to encode the data; When the importance of the data belongs to the second importance level, the data is encoded by using the BCH or LDPC higher than the first code rate, wherein the importance of the first importance level is higher than that of the second The importance of two important levels; and a writing module, configured to write the encoded data into the memory, and store the encoding information of the data, wherein the encoding information of the data includes the encoding information used by the data Encoding.

本申请第四方面提供一种用于错误检查和纠正的解码装置,包括:读取模块,用于存储控制器在接收到数据的读取指令时,从存储器中读取所述数据及所述数据的编码信息,其中,所述编码信息包括所述数据采用的编码方式,所述数据采用的编码方式取决于所述数据的重要程度,在所述数据的重要程度为第一重要级时,采用BCH和低密度奇偶校验码LDPC的结合或不高于第一码率的LDPC的编码方式;在所述数据的重要程度为第二重要级时,采用所述BCH或者高于所述第一码率的LDPC的编码方式,所述第一重要级的重要程度大于所述第二重要级的重要程度;解码模块,用于根据所述编码信息确定所述数据的编码方式,并采用与所述编码方式对应的解码方式对所述数据进行解码,其中,所述解码方式包括BCH和LDPC的结合、不高于第一码率的LDPC、BCH或者高于所述第一码率的LDPC;以及输出模块,用于输出进行所述解码后得到的数据。The fourth aspect of the present application provides a decoding device for error checking and correction, including: a reading module, used to read the data and the Data encoding information, wherein the encoding information includes the encoding method adopted by the data, the encoding method adopted by the data depends on the importance of the data, and when the importance of the data is the first importance level, A combination of BCH and low-density parity-check code LDPC or an LDPC encoding method not higher than the first code rate is used; when the importance of the data is the second important level, the BCH or higher than the first code rate is used In an LDPC encoding method with a code rate, the importance of the first importance level is greater than the importance of the second importance level; the decoding module is used to determine the encoding method of the data according to the encoding information, and adopt the same method as The decoding method corresponding to the encoding method decodes the data, wherein the decoding method includes a combination of BCH and LDPC, LDPC not higher than the first code rate, BCH or LDPC higher than the first code rate ; and an output module, configured to output the data obtained after the decoding.

本申请第五方面提供一种用于错误检查和纠正的编解码处理器,包括上述的编码装置和/或上述的解码装置。A fifth aspect of the present application provides a codec processor for error checking and correction, including the above encoding device and/or the above decoding device.

上述方案中,存储控制器通过分析数据的重要程度,并根据不同重要程度为数据配置不同的编码方式及解码方式,即越重要的数据配置错误检查及纠正能力越强的编码方式及解码方式,实现了存储器对数据编解码方式的智能配置,且保证了重要数据的可靠及准确存储。同时,存储控制器对于重要程度低的数据选择错误检查及纠正能力较低的编码方式及解码方式,降低了其所需编码能力及校验码长,提高了编码效率和节省了存储空间。In the above solution, the storage controller analyzes the importance of the data, and configures different encoding and decoding methods for the data according to different degrees of importance, that is, the more important the data, the stronger the encoding and decoding capabilities of error checking and correction. It realizes the intelligent configuration of memory for data encoding and decoding, and ensures the reliable and accurate storage of important data. At the same time, the storage controller selects encoding and decoding methods with low error checking and correcting capabilities for data with low importance, which reduces the required encoding capability and check code length, improves encoding efficiency and saves storage space.

附图说明Description of drawings

图1是本申请用于错误检查和纠正编码方法一实施方式的流程图;Fig. 1 is a flow chart of an embodiment of an error checking and correcting coding method used in the present application;

图2是本申请用于错误检查和纠正的编码方法另一实施方式的流程图;Fig. 2 is a flow chart of another embodiment of the encoding method used for error checking and correction in the present application;

图3是本申请用于错误检查和纠正的编码方法再一实施方式中保存的编码信息的示意图。Fig. 3 is a schematic diagram of encoding information stored in another embodiment of the encoding method for error checking and correction of the present application.

图4是本申请用于错误检查和纠正解码方法一实施方式的流程图;Fig. 4 is a flowchart of an embodiment of the error checking and correcting decoding method used in the present application;

图5是本申请用于错误检查和纠正的解码方法另一实施方式的流程图;Fig. 5 is a flow chart of another embodiment of the decoding method used for error checking and correction in the present application;

图6是本申请用于错误检查和纠正的解码方法再一实施方式中的LDPC解码时的LLR概率示意图;Fig. 6 is a schematic diagram of LLR probability during LDPC decoding in another embodiment of the decoding method for error checking and correction in the present application;

图7a是本申请用于错误检查和纠正的编码装置一实施方式的结构示意图;Fig. 7a is a schematic structural diagram of an embodiment of an encoding device used for error checking and correction in the present application;

图7b是本申请用于错误检查和纠正的编码装置的编译模块一实施方式的结构示意图。Fig. 7b is a schematic structural diagram of an embodiment of a compiling module of an encoding device for error checking and correction according to the present application.

图8是本申请本申请用于错误检查和纠正的解码装置一实施方式的结构示意图。FIG. 8 is a schematic structural diagram of an embodiment of a decoding device used for error checking and correction in the present application.

具体实施方式detailed description

以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、接口、技术之类的具体细节,以便透彻理解本申请。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施方式中也可以实现本申请。在其它情况中,省略对众所周知的装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, for purposes of illustration rather than limitation, specific details, such as specific system architectures, interfaces, and techniques, are set forth in order to provide a thorough understanding of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.

请参阅图1,图1是本申请用于错误检查和纠正的编码方法一实施方式的流程图。本实施方式可由存储器中的存储控制器执行,该方法包括:Please refer to FIG. 1 . FIG. 1 is a flowchart of an embodiment of an encoding method for error checking and correction in this application. This implementation manner may be executed by a storage controller in a memory, and the method includes:

S11:存储控制器在接收到数据的写入指令时,分析所述数据的重要程度。S11: When the storage controller receives a data write instruction, analyze the importance of the data.

存储控制器先将所需写入的数据划分重要程度级如包括第一重要级和第二重要级,并按照该数据的重要程度选择相应编码方式。例如,存储器作为计算机的存储设备,存储控制器在接收到计算机文件系统下发的数据的写入指令时,接收该数据,并分析该数据的重要程度属于第一重要级或第二重要级。The storage controller first divides the data to be written into importance levels, such as including the first importance level and the second importance level, and selects a corresponding encoding method according to the importance of the data. For example, the memory is used as the storage device of the computer, and when the storage controller receives a data write instruction issued by the computer file system, it receives the data and analyzes whether the importance of the data belongs to the first important level or the second important level.

具体地,存储控制器可根据该分析所述数据的参数确定其重要程度。例如,存储器中预存不同数据参数分别对应的重要程度值。在接收到数据的写入指令时,存储控制器在上述预存信息中,查找所述数据的参数对应的重要程度值以得到该数据的重要程度值,并判断该数据的重要程度值是否超过第一预设值,当所述重要程度值超过第一预设值时,确定所述数据的重要程度属于第一重要级;以及当所述重要程度值不超过所述第一预设值时,确定所述数据的重要程度属于第二重要级。其中,该数据的参数可包括数据的来源、属性及类型中的至少一种。Specifically, the storage controller may determine the importance of the parameter according to the analyzed data. For example, importance values corresponding to different data parameters are prestored in the memory. When receiving a data write instruction, the storage controller searches the above-mentioned pre-stored information for the importance value corresponding to the parameter of the data to obtain the data's importance value, and judges whether the data's importance value exceeds the first a preset value, when the importance degree value exceeds the first preset value, it is determined that the importance degree of the data belongs to the first importance level; and when the importance degree value does not exceed the first preset value, Determining the importance of the data belongs to the second importance level. Wherein, the parameters of the data may include at least one of the source, attribute and type of the data.

S12:存储控制器在所述数据的重要程度属于第一重要级时,分别采用BCH和LDPC对所述数据进行编码,或采用不高于第一码率的LDPC对所述数据进行编码;在所述数据的重要程度属于第二重要级时,采用所述BCH或者高于所述第一码率的LDPC对所述数据进行编码,其中,所述第一重要级的重要程度高于所述第二重要级的重要程度。S12: When the importance of the data belongs to the first importance level, the storage controller uses BCH and LDPC to encode the data respectively, or uses LDPC not higher than the first code rate to encode the data; When the importance of the data belongs to the second importance level, the data is encoded by using the BCH or LDPC higher than the first code rate, wherein the importance of the first importance level is higher than the The importance of the second level of importance.

本申请存储控制器可按照数据重要程度采用不同的编码方式。其中,可采用的编码方式包括BCH(取自Bose、Ray-Chaudhuri与Hocquenghem的缩写)、低密度奇偶校验码(英文:Low Density ParityCheck Code,简称:LDPC)、或BCH和LDPC的结合。上述三种编码方式的错误检查和纠正能力由强至弱依序为:BCH和LDPC的结合、LCPD、BCH。而且,存储控制器可自适应采用不同码率(英文:code rate)的LDPC。对于一定码长的原始数据,当采用的LDPC的码率越大,其编码后得到的校验码越多,且其错误检查和纠正能力则越强。The storage controller of this application can adopt different encoding methods according to the importance of data. Among them, the encoding methods that can be used include BCH (from the abbreviation of Bose, Ray-Chaudhuri and Hocquenghem), Low Density Parity Check Code (English: Low Density Parity Check Code, LDPC for short), or a combination of BCH and LDPC. The order of the error checking and correcting capabilities of the above three encoding methods from strong to weak is: the combination of BCH and LDPC, LCPD, and BCH. Moreover, the storage controller can adaptively adopt LDPC with different code rates (English: code rate). For the original data with a certain code length, when the code rate of LDPC is higher, more check codes will be obtained after encoding, and the error detection and correction capabilities will be stronger.

本实施例中,存储控制器对重要级越高的数据,采用错误检查和纠正能力越强的编码方式。具体地,存储控制器在判断所需写入的数据的重要程度属于第一重要级时,分别采用BCH和LDPC(即前述的BCH和LDPC的结合)对所述数据进行编码,其中,该LDPC的码率可为低于或高于该第一码率,且进行BCH、LDPC编码的顺序不限定,如可先进行BCH编码再对BCH编码的输出进行LDPC编码,或先进行LDPC编码再对LDPC编码的输出进行BCH编码;或存储控制器在判断所需写入的数据的重要程度属于第一重要级时,采用不高于第一码率的LDPC对所述数据进行编码。存储控制器在判断所需写入的数据的重要程度属于第二重要级时,采用所述BCH对所述数据进行编码,或者采用高于所述第一码率的LDPC对所述数据进行编码。在实际应用中,该第一码率可由用户配置并保存在存储器中,该第一码率通常取值为0.2-0.7,具体如为0.2、0.3、0.5、0.6或0.7。在采用以上编码方式时,对于同一重要级的数据,存储控制器可根据该数据的重要程度值而具体采用不同码率,如数据的重要程度值越高,其采用的LDPC的码率越低。在一实施例中,存储器可预存16种码率如0.5,0.6,0.650.7,0.75,0.8,0.85,0.9,0.95等,存储控制器根据其重要程度值选择其中一种码率。当然,存储控制器也可对同一重要级的所有数据均采用相同码率。In this embodiment, the storage controller adopts a coding method with stronger error checking and correcting capabilities for data with a higher importance level. Specifically, when the storage controller judges that the importance of the data to be written belongs to the first importance level, BCH and LDPC (that is, the aforementioned combination of BCH and LDPC) are used to encode the data respectively, wherein the LDPC The code rate can be lower than or higher than the first code rate, and the order of BCH and LDPC encoding is not limited, such as first performing BCH encoding and then performing LDPC encoding on the output of BCH encoding, or performing LDPC encoding first and then performing LDPC encoding on the output of BCH encoding The output of the LDPC code is BCH coded; or when the storage controller judges that the importance of the data to be written belongs to the first importance level, the data is coded with LDPC not higher than the first code rate. When the storage controller judges that the importance of the data to be written belongs to the second important level, the data is encoded by using the BCH, or the data is encoded by LDPC higher than the first code rate . In practical applications, the first code rate can be configured by the user and stored in the memory, and the first code rate is usually 0.2-0.7, specifically 0.2, 0.3, 0.5, 0.6 or 0.7. When using the above encoding method, for the data of the same importance level, the storage controller can use different code rates according to the importance value of the data. For example, the higher the importance value of the data, the lower the LDPC code rate it adopts. . In one embodiment, the memory can pre-store 16 code rates such as 0.5, 0.6, 0.650.7, 0.75, 0.8, 0.85, 0.9, 0.95, etc., and the storage controller selects one of the code rates according to its importance. Of course, the storage controller can also use the same code rate for all data of the same importance level.

S13:存储控制器将编码后的所述数据写入到存储器中,并保存所述数据的编码信息,其中,所述数据的编码信息包括所述数据采用的编码方式。S13: The storage controller writes the encoded data into the memory, and saves encoding information of the data, where the encoding information of the data includes an encoding mode adopted by the data.

所需写入的数据按照上述S12的编码方式进行编码后,得到的编码后的数据包括原始数据和检验码,并将该编码后的数据写入存储器中。而且,由于本实施例中可根据不同数据配置不同编码方式。为了便于解码,存储控制器还将该数据的编码信息保存在存储器中,或保存在软件层如新技术文件系统(英文:New Technology File System,简称:NTFS)、或无排序区块图像文件系统(英文:Unsorted Block Image File System,简称:UBIFS)中。存储控制器还可通过列表方式将该数据与其编码信息建立映射关系,以将该数据及其编码信息关联起来。当需要对该编码后数据进行解码时,存储控制器可读取相应编码信息以得到其编码方式,并以对应该编码方式的解码方式进行解码。After the data to be written is encoded according to the above-mentioned encoding method of S12, the obtained encoded data includes original data and a check code, and the encoded data is written into the memory. Moreover, in this embodiment, different encoding modes can be configured according to different data. In order to facilitate decoding, the storage controller also saves the encoding information of the data in the memory, or in a software layer such as a new technology file system (English: New Technology File System, referred to as: NTFS), or a non-sorted block image file system (English: Unsorted Block Image File System, referred to as: UBIFS). The storage controller may also establish a mapping relationship between the data and its encoding information in a list manner, so as to associate the data and its encoding information. When the encoded data needs to be decoded, the storage controller can read the corresponding encoding information to obtain its encoding mode, and decode it in a decoding mode corresponding to the encoding mode.

请参阅图2,图2是本申请用于错误检查和纠正的编码方法另一实施方式的流程图。本方法包括以下步骤:Please refer to FIG. 2 . FIG. 2 is a flow chart of another embodiment of an encoding method for error checking and correction in the present application. This method comprises the following steps:

S21:存储控制器在接收到数据的写入指令时,分析所述数据的来源、属性及类型中的至少一种,得到所述数据的重要程度值。S21: When the storage controller receives the data write instruction, analyze at least one of the source, attribute and type of the data to obtain an importance value of the data.

例如,存储器预存有该数据不同的来源、属性及类型分别对应的重要程度值。如数据来源为管理员账户,则其重要程度值为80%;数据来源为游客账户,则其重要程度值为30%;数据的类型为引导状态程序(英文:boot loader),则其重要程度值为100%,数据类型为视频或音频,则其重要程度值为20%。存储控制器查找该预存信息,得到数据的重要程度值。其中,当存储控制器分析的数据参数包括两种以上,则由该两种以上数据参数对应的重要程度值的平均值作为该数据重要程度值。如存储控制器分析数据为管理员账号的视频,则数据重要程度值为(80%+30%)/2=55%。For example, the memory pre-stores importance values corresponding to different sources, attributes and types of the data. If the data source is an administrator account, its importance value is 80%; if the data source is a tourist account, its importance value is 30%; if the data type is a boot loader (English: boot loader), its importance value The value is 100%, and the data type is video or audio, then its importance value is 20%. The storage controller looks up the pre-stored information to obtain the value of the importance of the data. Wherein, when the data parameters analyzed by the storage controller include two or more types, the average value of the importance values corresponding to the two or more data parameters is used as the data importance value. If the data analyzed by the storage controller is the video of the administrator account, the value of the data importance is (80%+30%)/2=55%.

S22:当所述重要程度值超过第一预设值时,存储控制器确定所述数据的重要程度属于第一重要级;以及当所述重要程度值不超过所述第一预设值时,存储控制器确定所述数据的重要程度属于第二重要级。S22: When the importance degree value exceeds a first preset value, the storage controller determines that the importance degree of the data belongs to the first importance level; and when the importance degree value does not exceed the first preset value, The storage controller determines that the importance of the data belongs to the second importance level.

本实施例以第一预设值为重要程度值的界线,将数据划分包括两个主要重要级:第一重要级和第二重要级。进一步地,本实施例的第二重要级还可包括第一重要子级和第二重要子级。上述S22中,所述当所述重要程度值不超过所述第一预设值时,确定所述数据的重要程度属于第二重要级的步骤包括:当所述重要程度值不超过所述第一预设值且超过第二预设值时,确定所述数据的重要程度属于所述第一重要子级;当所述重要程度值不超过所述第二预设值时,确定所述数据的重要程度属于所述第二重要子级,其中,所述第一预设值大于所述第二预设值。该第一预设值、第二预设值可由用户设置。第一预设值可为50%至80%,第二预设值可为30%至60%。In this embodiment, the first preset value is used as the boundary of the importance level, and the data is divided into two main importance levels: the first importance level and the second importance level. Further, the second importance level in this embodiment may also include the first importance sub-level and the second importance sub-level. In the above S22, when the importance value does not exceed the first preset value, the step of determining that the importance of the data belongs to the second importance level includes: when the importance value does not exceed the first preset value When a preset value exceeds a second preset value, it is determined that the importance of the data belongs to the first sub-level of importance; when the value of the importance does not exceed the second preset value, it is determined that the data The degree of importance of belongs to the second importance sub-level, wherein the first preset value is greater than the second preset value. The first preset value and the second preset value can be set by the user. The first preset value may be 50% to 80%, and the second preset value may be 30% to 60%.

例如,第一预设值为60%,第二预设值为40%。存储控制器由S21获得需写入数据的重要程度值为55%,未超过60%但超过40%,故确定该数据属于第二重要级,且属于第二重要级中的第一重要子级。For example, the first preset value is 60%, and the second preset value is 40%. The storage controller obtains from S21 that the importance value of the data to be written is 55%, not exceeding 60% but exceeding 40%, so it is determined that the data belongs to the second important level and belongs to the first important sub-level in the second important level .

S23:存储控制器在所述数据的重要程度属于第一重要级时,分别采用BCH和LDPC对所述数据进行编码,或采用不高于第一码率的LDPC对所述数据进行编码;在所述数据的重要程度属于所述第一重要子级时,采用高于预设校验位数的BCH或高于所述第一码率且低于第二码率的LDPC对所述数据进行编码,在所述数据的重要程度属于所述第二重要子级时,采用不高于所述预设校验位数的BCH或不低于所述第二码率的LDPC对所述数据进行编码,其中,所述第一重要级的重要程度高于所述第二重要级的重要程度,所述第一码率高于所述第二码率。S23: When the importance of the data belongs to the first importance level, the storage controller uses BCH and LDPC to encode the data respectively, or uses LDPC not higher than the first code rate to encode the data; When the importance of the data belongs to the first important sub-level, the data is processed by using BCH higher than the preset check digit or LDPC higher than the first code rate and lower than the second code rate encoding, when the importance of the data belongs to the second important sub-level, the data is processed by using BCH not higher than the preset parity number or LDPC not lower than the second code rate encoding, wherein the importance of the first importance level is higher than that of the second importance level, and the first code rate is higher than the second code rate.

基于上一实施方式,存储控制器还可自适应采用不同检验位数的BCH。当采用的BCH的校验位数越多,其错误检查和纠正能力则越强。该预设校验位数可为50bit至500bit。该第一码率通常取值为0.2-0.7,第二码率通常取值为0.7-0.95。Based on the previous implementation manner, the storage controller can also adaptively adopt BCHs with different check digits. The more check digits the BCH uses, the stronger its error detection and correction capabilities will be. The preset check digit can be 50bit to 500bit. The first code rate usually takes a value of 0.2-0.7, and the second code rate usually takes a value of 0.7-0.95.

例如,预设检验位数为80bit,第一码率为0.6,第二码率为0.8。存储控制器在需要写入的数据属于第一重要级时,分别采用BCH和LDPC对所述数据进行编码,或采用码率不高于0.6的LDPC对所述数据进行编码;在所述数据的重要程度属于所述第一重要子级时,采用高于80bit校验位的BCH对所述数据进行编码,或采用码率高于0.6且低于0.8的LDPC对所述数据进行编码;在所述数据的重要程度属于所述第二重要子级时,采用不高于80bit校验位的BCH对所述数据进行编码,或采用码率不低于0.8的LDPC对所述数据进行编码。在采用以上编码方式时,存储控制器可根据该数据的重要程度值而具体采用不同码率和不同校验位,如数据的重要程度值越高,其采用的LDPC的码率越低,且采用的BCH的校验位数越多。For example, the default check bit is 80 bits, the first code rate is 0.6, and the second code rate is 0.8. When the data to be written belongs to the first important level, the storage controller uses BCH and LDPC to encode the data respectively, or uses LDPC with a code rate not higher than 0.6 to encode the data; When the degree of importance belongs to the first important sub-level, the data is encoded using a BCH higher than 80 bit check bits, or using LDPC with a code rate higher than 0.6 and lower than 0.8 to encode the data; When the importance of the data belongs to the second important sub-level, the data is encoded by using BCH with a parity bit not higher than 80 bits, or by LDPC with a code rate not lower than 0.8. When using the above encoding method, the storage controller can specifically use different code rates and different check digits according to the importance of the data, such as the higher the importance of the data, the lower the code rate of LDPC it adopts, and The more check digits the BCH adopts.

其中,该BCH的生成矩阵按照所述BCH的校验位数进行选择,和/或,该LDPC的生成矩阵按照所述LDPC的码率进行选择。例如,存储器可预存分别多个分别对应不同校验位数的BCH的生成矩阵G1,以及多个分别对应不同码率的LDPC的生成矩阵G2。当存储控制器为需写入的数据确定编码方式时,可对应其确定的码率和/或校验位数,读取对应的BCH的生成矩阵G1以进行相应的BCH编码,和/或读取LDPC的生成矩阵G2以进行相应的LDPC编码。进一步地,存储控制器在读取生成矩阵后,可分析该生成矩阵是否存在规律,若存在规律,则将该生成矩阵分成若干个小矩阵,采用该若干个小矩阵对该数据进行编码,以提高编码效率。Wherein, the generation matrix of the BCH is selected according to the check digit of the BCH, and/or the generation matrix of the LDPC is selected according to the code rate of the LDPC. For example, the memory may pre-store a plurality of BCH generator matrices G1 corresponding to different parity digits, and a plurality of LDPC generator matrices G2 corresponding to different code rates. When the storage controller determines the encoding method for the data to be written, it can read the corresponding BCH generation matrix G1 to perform corresponding BCH encoding, and/or read Take the generator matrix G2 of LDPC for corresponding LDPC encoding. Further, after the storage controller reads the generated matrix, it can analyze whether there is a rule in the generated matrix, and if there is a rule, divide the generated matrix into several small matrices, and use the several small matrices to encode the data, so as to Improve coding efficiency.

可选地,由于不同编码方式,所得到的校验码位数不同,通常,编码方式的纠错能力越强,其校验码位数越多。故,存储控制器还可在按照重要程度确定编码方式时,检查该存储器自身配置的校验码的存储空间大小,预算该校验码存储空间是否足够存放采用选择的编码方式对需写入的数据进行编码所得到的校验码,如果能,则确定采用该编码方式进行编码,否则,提高该LDPC的码率和/或降低BCH的校验位数,以保证与该校验码存储空间大小匹配。Optionally, due to different encoding modes, the number of check code bits obtained is different. Generally, the stronger the error correction capability of the encoding mode, the more check code bits. Therefore, the storage controller can also check the size of the storage space of the check code configured by the memory itself when determining the encoding method according to the degree of importance, and estimate whether the storage space of the check code is sufficient to store the selected encoding method to be written. The check code obtained by encoding the data, if it can, then determine that the encoding method is used for encoding, otherwise, increase the code rate of the LDPC and/or reduce the check digit of the BCH to ensure the storage space of the check code The size matches.

S24:存储控制器确定所述存储器的类型,并当所述存储器的类型为SLC时,将LDPC解码中的有限域GF(2^q)中的所述q取值为1;当所述存储器的类型为MLC时,将所述q取值为2;当所述存储器的类型为TLC时,将所述q取值为3。S24: The storage controller determines the type of the memory, and when the type of the memory is SLC, sets the value of q in the finite field GF(2^q) in LDPC decoding to 1; when the memory When the type of memory is MLC, the value of q is 2; when the type of the memory is TLC, the value of q is 3.

本实施例中,该存储器可为单层单元(英文:Single-Level Cell,简称:SLC)、多层单元(英文:Multi-Level Cell,简称:MLC)或三层单元(英文:Trinary-Level_Cell,简称:TLC)类型的NAND存储器,该NAND存储器具体可为Raw Nand、或固态硬盘(英文:Solid State Drives,简称:SSD)等。由于SLC类型为每个单元存储1bit,需划分为21=2个电压状态表示;MLC类型为每个单元存储2bit,需划分为22=4个电压状态表示;TLC类型为每个单元存储3bit,需划分为23=8个电压状态表示。相应地,SLC、MLC、TLC类型存储器对错误检查和纠正的需求不同且为顺序增大。故,针对不同类型存储器的错误检查和纠正需求,存储控制器可预先确定该存储器的类型,并由所述存储器的类型确定该LDPC解码中的有限域GF(2^q)中的所述q的取值,具体为若SLC类型则将q取值为1,若MLC类型则将q取值为2,若TLC类型则将q取值为3。In this embodiment, the memory may be a single-level cell (English: Single-Level Cell, referred to as: SLC), a multi-level cell (English: Multi-Level Cell, referred to as: MLC) or a triple-level cell (English: Trinary-Level_Cell , referred to as: TLC) type NAND memory, the NAND memory specifically can be Raw Nand, or solid state hard drive (English: Solid State Drives, referred to as: SSD) and the like. Since the SLC type stores 1 bit for each unit, it needs to be divided into 2 1 = 2 voltage state representations; the MLC type stores 2 bits for each unit, and needs to be divided into 2 2 = 4 voltage state representations; the TLC type stores 2 bits for each unit 3 bits need to be divided into 2 3 =8 voltage state representations. Correspondingly, SLC, MLC, and TLC type memories have different and sequentially increasing requirements for error checking and correction. Therefore, for the error checking and correction requirements of different types of memory, the memory controller can predetermine the type of the memory, and determine the q in the finite field GF(2^q) in the LDPC decoding by the type of the memory Specifically, if the SLC type, set q to 1, if the MLC type, set q to 2, and if the TLC type, set q to 3.

可以理解的是,该S24未必在执行S21-23之后进行,在其他实施例中,存储控制器可在接收到数据写入指令后至S25步骤之间的任何时刻执行。It can be understood that S24 may not be performed after S21-23 is performed, and in other embodiments, the storage controller may perform it at any time between receiving the data writing instruction and step S25.

S25:存储控制器将编码后的所述数据写入到存储器中,并保存所述数据的编码信息,其中,所述数据的编码信息包括所述数据采用的编码方式和所述q的取值。S25: The storage controller writes the encoded data into the memory, and saves the encoding information of the data, where the encoding information of the data includes the encoding method adopted by the data and the value of q .

例如,该编码信息中的编码方式可由以下组成的码组表示:“是否采用LDPC”、“LDPC的码率”、“是否采用BCH”、“BCH的校验位数”。其中,该是否采用LDPC、是否采用BCH均可由但不限由1bit表示,如0表示是,1表示否。q的取值可由但不限由1bit或2bit表示,如01表示q为1,10表示q为2,11表示q为3。LDPC的码率、BCH的校验位数可由但不限由2bit-6bit表示,如为4bit。可选地,用于记载编码信息的码组还可预留1bit-2bit作为扩展使用。For example, the encoding method in the encoding information can be represented by a code group consisting of: "whether to use LDPC", "code rate of LDPC", "whether to use BCH", "check digit of BCH". Wherein, whether to adopt LDPC and whether to adopt BCH can be represented by but not limited to 1 bit, for example, 0 means yes, and 1 means no. The value of q can be represented by but not limited to 1bit or 2bit, for example, 01 represents that q is 1, 10 represents that q is 2, and 11 represents that q is 3. The code rate of LDPC and the check digit of BCH can be represented by but not limited to 2bit-6bit, for example, 4bit. Optionally, the code group used to record the encoding information can also reserve 1 bit-2 bits for extension.

可以理解的是,该用于记载编码信息的码组可根据实际编码方式进行适应性设置。例如,若在一实施例中,该存储控制器所采用的编码方式只为BCH和LDPC的结合、或不同码率的LDPC,则该用于记载编码信息的码组可为图3所示的格式,即不包含“是否采用LDPC”项,以及“BCH的检验位数”项,该编码信息为每页1byte。It can be understood that the code group used to record the coding information can be adaptively set according to the actual coding method. For example, if in one embodiment, the encoding method adopted by the storage controller is only a combination of BCH and LDPC, or LDPC with different code rates, then the code group used to record the encoding information can be as shown in Figure 3 The format, that is, does not include the item "whether to use LDPC" and the item "BCH check digit", and the encoding information is 1 byte per page.

存储控制器在接收到读取该数据的指令时,则可根据该编码信息确定该数据所采用的编码方式,并按照相应解码方式对其进行解码。When the storage controller receives the instruction to read the data, it can determine the encoding method adopted by the data according to the encoding information, and decode it according to the corresponding decoding method.

上述方案中,存储控制器通过分析数据的重要程度,并根据不同重要程度为数据配置不同的编码方式,即越重要的数据配置错误检查及纠正能力越强的编码方式,实现了存储器对数据编码方式的自适应配置,且保证了重要数据的可靠及准确存储。同时,由于错误检查及纠正能力越强的编码方式,所需的编码能力越强及所需校验码长越多。存储控制器对于重要程度低的数据选择错误检查及纠正能力较低的编码方式,降低了其所需编码能力及校验码长,提高了编码效率和节省了存储空间。In the above solution, the storage controller analyzes the importance of data and configures different encoding methods for the data according to different degrees of importance, that is, the more important the data, the stronger the encoding method for error checking and correcting capabilities is, and the data encoding by the memory is realized. The adaptive configuration of the mode ensures the reliable and accurate storage of important data. At the same time, due to the encoding method with stronger error checking and correcting capability, the required encoding capability is stronger and the required check code length is longer. The storage controller selects a coding method with low error checking and correcting capabilities for data with low importance, which reduces its required coding capability and check code length, improves coding efficiency and saves storage space.

请参阅图4,图4是本申请用于错误检查和纠正的解码方式一实施方式的流程图。本实施方法中,存储控制器进行解码的数据可为由以上实施方式进行编码得到的数据。该方法包括以下步骤:Please refer to FIG. 4 . FIG. 4 is a flowchart of an embodiment of a decoding method for error checking and correction in this application. In this implementation method, the data decoded by the storage controller may be the data obtained by encoding in the above implementation manner. The method includes the following steps:

S41:存储控制器在接收到数据的读取指令时,从存储器中读取所述数据及所述数据的编码信息。S41: The storage controller reads the data and the encoding information of the data from the memory when receiving a data read instruction.

例如,存储器作为计算机的存储设备,存储控制器在接收到计算机文件系统下发的数据的读取指令时,获取该读取指令中携带的存储地址,并从存储器的该存储地址中读取该数据,以及通过查表查找到与该数据具有映射关系的编码信息。For example, the memory is used as the storage device of the computer. When the storage controller receives the data reading instruction issued by the computer file system, it obtains the storage address carried in the reading instruction, and reads the data from the storage address of the memory. data, and the coded information that has a mapping relationship with the data is found by looking up the table.

其中,所述编码信息包括所述数据采用的编码方式,所述数据采用的编码方式取决于所述数据的重要程度,在所述数据的重要程度为第一重要级时,采用BCH和低密度奇偶校验码LDPC的结合或不高于第一码率的LDPC的编码方式;在所述数据的重要程度为第二重要级时,采用所述BCH或者高于所述第一码率的LDPC的编码方式,所述第一重要级的重要程度大于所述第二重要级的重要程度。例如,该数据和编码信息为图1所示实施方式编码得到的数据以及保存的编码信息。Wherein, the encoding information includes the encoding method adopted by the data, and the encoding method adopted by the data depends on the importance of the data. When the importance of the data is the first importance level, BCH and low-density A combination of parity check code LDPC or an encoding method of LDPC not higher than the first code rate; when the importance of the data is the second important level, the BCH or LDPC higher than the first code rate is used In a coding manner, the importance degree of the first importance level is greater than the importance degree of the second importance level. For example, the data and encoding information are the encoded data and stored encoding information in the embodiment shown in FIG. 1 .

S42:存储控制器根据所述编码信息确定所述数据的编码方式,并采用与所述编码方式对应的解码方式对所述数据进行解码,其中,所述解码方式包括BCH和LDPC的结合、不高于第一码率的LDPC、BCH或者高于所述第一码率的LDPC。S42: The storage controller determines the encoding method of the data according to the encoding information, and uses a decoding method corresponding to the encoding method to decode the data, where the decoding method includes a combination of BCH and LDPC, not LDPC and BCH higher than the first code rate or LDPC higher than the first code rate.

具体地,存储控制器在确定所述数据的编码方式为BCH和LDPC的结合时,其对应的解码方式则为BCH和LDPC的结合,即分别采用BCH和LDPC对该数据进行解码。其中,进行BCH、LDPC解码的顺序不限定,如可先进行BCH解码再对BCH解码的输出进行LDPC解码,或先进行LDPC解码再对LDPC解码的输出进行BCH解码。存储控制器在确定所述数据的编码方式为不高于第一码率的LDPC编码时,其对应的解码方式则为不高于第一码率的LDPC解码。存储控制器在确定所述数据的编码方式为BCH编码时,其对应的解码方式则为不高于第一码率的BCH解码。存储控制器在确定所述数据的编码方式为高于所述第一码率的LDPC编码时,其对应的解码方式则为高于所述第一码率的LDPC解码。Specifically, when the storage controller determines that the encoding method of the data is a combination of BCH and LDPC, the corresponding decoding method is a combination of BCH and LDPC, that is, the data is decoded by using BCH and LDPC respectively. Wherein, the order of performing BCH and LDPC decoding is not limited, for example, BCH decoding may be performed first and then LDPC decoding is performed on the output of BCH decoding, or LDPC decoding may be performed first and then BCH decoding may be performed on the output of LDPC decoding. When the storage controller determines that the encoding method of the data is LDPC encoding with a code rate not higher than the first code rate, the corresponding decoding method is LDPC decoding with a code rate not higher than the first code rate. When the storage controller determines that the encoding method of the data is BCH encoding, its corresponding decoding method is BCH decoding not higher than the first code rate. When the storage controller determines that the encoding method of the data is LDPC encoding higher than the first code rate, its corresponding decoding method is LDPC decoding higher than the first code rate.

其中,S41中获取的编码信息包括LDPC的码率,存储控制器将该编码信息中的码率作为LDPC解码时的码率。Wherein, the encoding information obtained in S41 includes the code rate of LDPC, and the storage controller uses the code rate in the encoding information as the code rate during LDPC decoding.

S43:存储控制器输出进行所述解码后得到的数据。S43: The storage controller outputs the data obtained after performing the decoding.

由于本实施例解码方法与该数据的编码方式对应,对重要程度高的数据选择错误检查和纠正能力较高的编解码方式,对重要程度低的选择错误检查和纠正能力较低的编解码方式,实现了存储器对数据编解码方式的自适应配置,且保证了重要数据的可靠及准确存储。同时,也降低了重要程度低数据所需的解码能力,提高了解码效率。Since the decoding method in this embodiment corresponds to the encoding method of the data, a codec method with higher error checking and correction capabilities is selected for data with a high degree of importance, and a codec method with lower error detection and correction capabilities is selected for data with a lower degree of importance. , which realizes the self-adaptive configuration of the memory for data encoding and decoding, and ensures the reliable and accurate storage of important data. At the same time, the decoding capability required for data with low importance is also reduced, and the decoding efficiency is improved.

请参阅图5,图5是本申请用于错误检查和纠正的解码方法另一实施方式的流程图。本方法包括以下步骤:Please refer to FIG. 5 . FIG. 5 is a flow chart of another embodiment of a decoding method for error checking and correction in the present application. This method comprises the following steps:

S51:存储控制器在接收到数据的读取指令时,从存储器中读取所述数据及所述数据的编码信息。S51: When the storage controller receives a data read instruction, read the data and the encoding information of the data from the memory.

其中,所述编码信息包括所述数据采用的编码方式,所述数据采用的编码方式取决于所述数据的重要程度为第一重要级或第二重要级,所述第二重要级包括第一重要子级和第二重要子级。在所述数据的重要程度为第一重要级时,采用BCH和低密度奇偶校验码LDPC的结合或不高于第一码率的LDPC的编码方式;在所述数据的重要程度为所述第一重要子级时而采用的高于预设校验位数的BCH或高于所述第一码率且低于第二码率的LDPC的编码方式,在所述数据的重要程度为所述第二重要子级时而采用的不高于所述预设校验位数的BCH或不低于所述第二码率的LDPC的编码方式,所述第一重要级的重要程度大于所述第二重要级的重要程度,所述第一重要子级的重要程度大于所述第二重要子级的重要程度,所述第一码率高于所述第二码率。例如,该数据和编码信息为图2所示实施方式编码得到的数据以及保存的编码信息Wherein, the encoding information includes the encoding method adopted by the data, and the encoding method adopted by the data depends on the importance of the data as the first importance level or the second importance level, and the second importance level includes the first The most important child and the second most important child. When the importance of the data is the first importance level, a combination of BCH and low-density parity check code LDPC or an encoding method of LDPC not higher than the first code rate is used; when the importance of the data is the first The first important sub-level sometimes adopts a BCH encoding method higher than the preset check digit or an LDPC encoding method higher than the first code rate and lower than the second code rate, when the importance of the data is the The second important sub-level sometimes adopts the BCH encoding method not higher than the preset parity number or the LDPC encoding method not lower than the second code rate, and the importance of the first important level is greater than that of the second important level. The importance of two important levels, the importance of the first important sub-level is greater than the importance of the second important sub-level, and the first code rate is higher than the second code rate. For example, the data and coded information are the data encoded by the embodiment shown in Figure 2 and the stored coded information

S52:存储控制器根据所述编码信息确定所述数据的编码方式,并采用与所述编码方式对应的解码方式对所述数据进行解码,其中,所述解码方式包括BCH和LDPC的结合、不高于第一码率的LDPC、高于预设校验位数的BCH、高于所述第一码率且低于第二码率的LDPC、不高于所述预设校验位数的BCH、或不低于所述第二码率的LDPC的解码方式。S52: The storage controller determines the encoding method of the data according to the encoding information, and uses a decoding method corresponding to the encoding method to decode the data, where the decoding method includes a combination of BCH and LDPC, not LDPC higher than the first code rate, BCH higher than the preset check digit, LDPC higher than the first code rate and lower than the second code rate, and not higher than the preset check digit A decoding method of BCH or LDPC with a code rate not lower than the second code rate.

基于图4所示实施方式,本实施方式中的BCH或者高于所述第一码率的LDPC解码方式包括高于预设校验位数的BCH、高于所述第一码率且低于第二码率的LDPC、不高于所述预设校验位数的BCH、或不低于所述第二码率的LDPC的解码方式。具体地,存储控制器在确定所述数据的编码方式为高于预设校验位数的BCH编码时,其对应的解码方式则为高于预设校验位数的BCH解码。存储控制器在确定所述数据的编码方式为高于所述第一码率且低于第二码率的LDPC编码时,其对应的解码方式则为高于所述第一码率且低于第二码率的LDPC解码。存储控制器在确定所述数据的编码方式为不高于所述预设校验位数的BCH编码时,其对应的解码方式则为不高于所述预设校验位数的BCH解码。存储控制器在确定所述数据的编码方式为不低于所述第二码率的LDPC编码时,其对应的解码方式则为不低于所述第二码率的LDPC解码。Based on the embodiment shown in Figure 4, the BCH in this embodiment or the LDPC decoding method higher than the first code rate includes BCH higher than the preset check digit, higher than the first code rate and lower than A decoding method of LDPC with a second code rate, BCH with a check digit not higher than the preset check digit, or LDPC with a code rate not lower than the second code rate. Specifically, when the storage controller determines that the encoding method of the data is BCH encoding with a higher than the preset check digit, the corresponding decoding method is BCH decoding with a higher than the preset check digit. When the storage controller determines that the encoding method of the data is LDPC encoding that is higher than the first code rate and lower than the second code rate, its corresponding decoding method is higher than the first code rate and lower than LDPC decoding of the second code rate. When the storage controller determines that the encoding method of the data is BCH encoding not higher than the preset check digit, the corresponding decoding method is BCH decoding not higher than the preset check digit. When the memory controller determines that the encoding method of the data is LDPC encoding with a code rate not lower than the second code rate, the corresponding decoding method is LDPC decoding with a code rate not lower than the second code rate.

其中,该BCH的校验矩阵按照所述BCH的校验位数进行选择,和/或,该LDPC的校验矩阵按照所述LDPC的码率进行选择。例如,存储器可预存分别多个分别对应不同校验位数的BCH的校验矩阵H1,以及多个分别对应不同码率的LDPC的校验矩阵H2。当存储控制器为需写入的数据确定解码方式时,可对应其确定的码率和/或校验位数,读取对应的BCH的校验矩阵H1以进行相应的BCH解码,和/或读取LDPC的校验矩阵H2以进行相应的LDPC解码。Wherein, the check matrix of the BCH is selected according to the number of check digits of the BCH, and/or the check matrix of the LDPC is selected according to the code rate of the LDPC. For example, the memory may pre-store a plurality of BCH parity check matrices H1 corresponding to different parity digits, and a plurality of LDPC parity check matrices H2 corresponding to different code rates. When the storage controller determines the decoding mode for the data to be written, it can read the corresponding BCH parity check matrix H1 to perform corresponding BCH decoding corresponding to the determined code rate and/or parity digits, and/or Read the check matrix H2 of LDPC to perform corresponding LDPC decoding.

S53:存储控制器检测到所述BCH的错误比特数超过预设比特值和/或所述LDPC的实际迭代次数超过预设次数时,发出所述存储器中存储所述数据的块出现问题的警报。S53: When the storage controller detects that the number of erroneous bits of the BCH exceeds a preset bit value and/or the actual number of iterations of the LDPC exceeds a preset number of times, it issues an alarm that there is a problem with the block storing the data in the memory .

本实施例中,存储控制器还可对保存该数据的块进行预警。存储控制器在进行BCH解码时,检测该BCH的错误比特数是否超过预设比特值,若在进行LDPC解码时,检测该LDPC的实际迭代次数是否超过预设次数,若上述两种检测中的其中一个为超过,则发出所述存储器中存储所述数据的块出现问题的警报,例如向包含该BCH的错误比特数或LDPC的实际迭代次数的警报消息发送给上层计算机系统。其中,该预设比特值、预设次数可由用户设置,该预设比特值具体可为但不限为该数据的数据量的1/1000至5/100中的任意比特值,该预设次数可为但不限为2-10次。In this embodiment, the storage controller may also give an early warning to the block storing the data. When the storage controller performs BCH decoding, it detects whether the number of erroneous bits of the BCH exceeds the preset bit value. If it performs LDPC decoding, it detects whether the actual number of iterations of the LDPC exceeds the preset number of times. If one of them is exceeded, an alarm is issued to indicate that there is a problem with the block storing the data in the memory, for example, an alarm message containing the number of error bits of the BCH or the actual number of iterations of LDPC is sent to the upper computer system. Wherein, the preset bit value and the preset number of times can be set by the user, and the preset bit value can specifically be but not limited to any bit value in 1/1000 to 5/100 of the data amount of the data, and the preset number of times It can be but not limited to 2-10 times.

其中,该存储器可为SLC、MLC或TLC类型的NAND存储器,,该NAND存储器具体可为Raw Nand、或SSD等。所述数据的编码信息还包括q的取值,当所述存储器的类型为SLC时,所述q取值为1,当所述存储器的类型为MLC时,所述q取值为2,当所述存储器的类型为TLC时,所述q取值为3。在该S53步骤中,若进行所述LDPC解码,则将所述编码信息中的所述q的取值作为所述LDPC解码中的有限域GF(2^q)中的q的取值,以进行所述LDPC解码。Wherein, the memory may be a NAND memory of SLC, MLC or TLC type, specifically, the NAND memory may be Raw Nand, SSD or the like. The encoding information of the data also includes the value of q, when the type of the memory is SLC, the value of q is 1, when the type of the memory is MLC, the value of q is 2, when When the type of the memory is TLC, the value of q is 3. In the S53 step, if the LDPC decoding is performed, the value of q in the encoded information is used as the value of q in the finite field GF(2^q) in the LDPC decoding, to The LDPC decoding is performed.

S54:存储控制器输出进行所述解码后得到的数据。S54: The storage controller outputs the data obtained after performing the decoding.

下面对以上实施例中的LDPC的具体编码及解码进行说明。The specific encoding and decoding of the LDPC in the above embodiments will be described below.

1)LDPC编码:1) LDPC code:

存储器中存储有分别对应不同码率的生成矩阵,存储控制器根据确定的LDPC的码率获取相应的生成矩阵G,由公式v=u·G得到编码后的数据。其中,v为编码过后的码字,包括信息码和校验码;u为需写入的原始数据。Generating matrices corresponding to different code rates are stored in the memory, and the memory controller acquires corresponding generating matrices G according to the determined LDPC code rates, and the coded data is obtained by the formula v=u·G. Among them, v is the encoded codeword, including information code and check code; u is the original data to be written.

另外,BCH的编码类同于上,即同样由v=u·G得到编码数据。但具体BCH与LDPC的实现不同。在本申请中,BCH编码中的有限域GF(2^q)中的q的取值也可配置,一般来说,为提高抗突发性错误能力,q的取值与NAND的类型相关,如若SLC类型则将q取值为1,若MLC类型则将q取值为2,若TLC类型则将q取值为3,即采用非二进制编码。当然对于任何类型的NAND,q都可以取1,即采用二进制LDPC编码。In addition, the encoding of BCH is similar to the above, that is, the encoded data is also obtained from v=u·G. But the implementation of BCH and LDPC is different. In this application, the value of q in the finite field GF(2^q) in BCH coding can also be configured. Generally speaking, in order to improve the ability to resist burst errors, the value of q is related to the type of NAND. If it is an SLC type, set q to a value of 1, if it is an MLC type, set q to a value of 2, and if it is a TLC type, set q to a value of 3, that is, use non-binary encoding. Of course, for any type of NAND, q can be 1, that is, binary LDPC encoding is used.

2)LDPC解码:2) LDPC decoding:

a、初始化:对于每个变量节点(v=1…N),对数似然比(英文:Log-Likelihood Ratio,简称:LLR)消息设为:a. Initialization: For each variable node (v=1...N), the log-likelihood ratio (English: Log-Likelihood Ratio, abbreviated: LLR) message is set to:

b、变量节点更新:每个变量节点有dv个输入消息{Uvp}p=1…dv∈Rq,其中,Rq表示以q为单位构成的集合;b. Variable node update: each variable node has dv input messages {U vp }p=1...dv∈R q , where R q represents a set formed with q as the unit;

c、校验节点更新:对于每个变量节点,可认为有dc个输入消息{Ucp}p=1…dc∈Rq,其中,Rq表示以q为单位构成的集合;c. Check node update: For each variable node, it can be considered that there are dc input messages {U cp }p=1...dc∈R q , where R q represents a set composed of units of q;

d、根据校验矩阵H来判断所译出的码字是否正确,如果正确,则停止迭代;否则继续迭代进行译码,直到迭代次数达到所设定的最大次数,如果此时仍未正确译码,则译码失败。该校验矩阵H与该数据编码时的生成矩阵G对偶,即G·H=0。d. Judging whether the decoded codeword is correct according to the check matrix H, if it is correct, stop the iteration; otherwise, continue to iterate and decode until the number of iterations reaches the set maximum number of times, if it is still not correctly decoded at this time code, the decoding fails. The parity check matrix H is dual to the generator matrix G when the data is encoded, that is, G·H=0.

在以上LDPC解码过程中,通过LLR得到某点的概率,以确定其电压表示的数值,即如图6所示,t点更靠近11的电压范围,即通过LLR得到t点为11的概率最大,故该t点电压表示的数值为11,其中,图6中的P(v)表示概率,Vth表示电压。例如,b0=1的初始LLR可由以下公式计算得出:In the above LDPC decoding process, the probability of a certain point is obtained through LLR to determine the value represented by its voltage, that is, as shown in Figure 6, point t is closer to the voltage range of 11, that is, the probability of point t being 11 obtained through LLR is the largest , so the value represented by the voltage at point t is 11, where P(v) in FIG. 6 represents probability, and Vth represents voltage. For example, the initial LLR for b 0 =1 can be calculated by the following formula:

请参阅图7a,图7a是本申请用于错误检查和纠正的编码装置一实施方式结构示意图。该编码装置700用于将数据进行编码并写入存储器中。该编码装置700包括分析模块710、编码模块720及写入模块730。Please refer to FIG. 7a, which is a schematic structural diagram of an embodiment of an encoding device for error checking and correction in the present application. The encoding device 700 is used to encode data and write it into a memory. The encoding device 700 includes an analyzing module 710 , an encoding module 720 and a writing module 730 .

分析模块710用于在接收到数据的写入指令时,分析所述数据的重要程度。The analysis module 710 is configured to analyze the importance of the data when receiving the data write instruction.

编码模块720用于在所述数据的重要程度属于第一重要级时,分别采用BCH和低密度奇偶校验码LDPC对所述数据进行编码,或采用不高于第一码率的LDPC对所述数据进行编码;在所述数据的重要程度属于第二重要级时,采用所述BCH或者高于所述第一码率的LDPC对所述数据进行编码,其中,所述第一重要级的重要程度高于所述第二重要级的重要程度。The coding module 720 is configured to respectively use BCH and low density parity check code LDPC to code the data when the importance of the data belongs to the first important level, or use LDPC not higher than the first code rate to code the data encoding the data; when the importance of the data belongs to the second importance level, the data is encoded by using the BCH or LDPC higher than the first code rate, wherein the first importance level The importance degree is higher than the importance degree of the second importance level.

写入模块730用于将编码后的所述数据写入到存储器中,并保存所述数据的编码信息,其中,所述数据的编码信息包括所述数据采用的编码方式。The writing module 730 is configured to write the encoded data into the memory, and save the encoding information of the data, wherein the encoding information of the data includes the encoding method adopted by the data.

可选地,分析模块710执行所述分析所述数据的重要程度的步骤包括:分析所述数据的来源、属性及类型中的至少一种,得到所述数据的重要程度值;当所述重要程度值超过第一预设值时,确定所述数据的重要程度属于第一重要级;以及当所述重要程度值不超过所述第一预设值时,确定所述数据的重要程度属于第二重要级。Optionally, the analysis module 710 performing the step of analyzing the importance of the data includes: analyzing at least one of the source, attribute, and type of the data to obtain an importance value of the data; when the importance When the degree value exceeds the first preset value, it is determined that the importance of the data belongs to the first importance level; and when the importance degree value does not exceed the first preset value, it is determined that the importance of the data belongs to the first level Second level.

可选地,所述第二重要级包括第一重要子级和第二重要子级。所述分析模块710执行所述当所述重要程度值不超过所述第一预设值时,确定所述数据的重要程度属于第二重要级的步骤包括:当所述重要程度值不超过所述第一预设值且超过第二预设值时,确定所述数据的重要程度属于所述第一重要子级;当所述重要程度值不超过所述第二预设值时,确定所述数据的重要程度属于所述第二重要子级,其中,所述第一预设值大于所述第二预设值。编码模块720执行所述在所述数据的重要程度属于第二重要级时,采用所述BCH或者高于所述第一码率的LDPC对所述数据进行编码的步骤包括:在所述数据的重要程度属于所述第一重要子级时,采用高于预设校验位数的BCH或高于所述第一码率且低于第二码率的LDPC对所述数据进行编码,在所述数据的重要程度属于所述第二重要子级时,采用不高于所述预设校验位数的BCH或不低于所述第二码率的LDPC对所述数据进行编码,其中,所述第一码率高于所述第二码率。Optionally, the second importance level includes a first importance sub-level and a second importance sub-level. The analysis module 710 performing the step of determining that the importance of the data belongs to the second importance level when the importance level value does not exceed the first preset value includes: when the importance level value does not exceed the preset value When the first preset value exceeds the second preset value, it is determined that the importance of the data belongs to the first importance sub-level; when the importance does not exceed the second preset value, it is determined that the The importance of the data belongs to the second importance sub-level, wherein the first preset value is greater than the second preset value. When the encoding module 720 performs the step of encoding the data using the BCH or LDPC higher than the first code rate when the importance of the data belongs to the second importance level, the step includes: When the importance level belongs to the first important sub-level, the data is encoded by using BCH higher than the preset parity number or LDPC higher than the first code rate and lower than the second code rate, and in the When the importance of the data belongs to the second important sub-level, the data is encoded by using BCH not higher than the preset check digit or LDPC not lower than the second code rate, wherein, The first code rate is higher than the second code rate.

可选地,所述存储器为SLC、MLC或TLC类型的NAND存储器。该编码装置还可包括取值模块,用于确定所述存储器的类型,并当所述存储器的类型为SLC时,将LDPC解码中的有限域GF(2^q)中的所述q取值为1;当所述存储器的类型为MLC时,将所述q取值为2;当所述存储器的类型为TLC时,将所述q取值为3。而且,所述写入模块730保存的所述数据的编码信息还包括所述q的取值。Optionally, the memory is an SLC, MLC or TLC type NAND memory. The encoding device may also include a value module, configured to determine the type of the memory, and when the type of the memory is SLC, obtain the value of the q in the finite field GF(2^q) in the LDPC decoding is 1; when the type of the memory is MLC, the value of q is 2; when the type of the memory is TLC, the value of q is 3. Moreover, the encoding information of the data saved by the writing module 730 also includes the value of q.

可选地,所述BCH的生成矩阵按照所述BCH的校验位数进行选择,和/或,所述LDPC的生成矩阵按照所述LDPC的码率进行选择。Optionally, the generation matrix of the BCH is selected according to the parity number of the BCH, and/or the generation matrix of the LDPC is selected according to the code rate of the LDPC.

在一应用实施例中,该编码模块720可如图7b所示,包括BCH编码器721、LDPC编码器722、选择器723及控制器724。控制器724用于根据分析模块710得到的数据重要程度确定编码方式,并将是否进行BCH的信号bypass发送至选择器723,将LDPC的码率codrate信号发送至LDPC编码器722。该选择器723用于根据bypass信号,确定是否需要对该数据进行BCH编码,如需要,则选择BCH编码器721的输出连接LDPC编码器722的输入,如不需要,则将原始数据不经BCH编码器721直接输入至LDPC编码器722。BCH编码器721用于对输入进行BCH编码。LDPC编码器722用于根据coderate信号确定码率,并按照确定的码率对输入进行LDPC编码。In an application embodiment, the encoding module 720 may include a BCH encoder 721 , an LDPC encoder 722 , a selector 723 and a controller 724 as shown in FIG. 7 b . The controller 724 is used to determine the encoding method according to the importance of the data obtained by the analysis module 710 , and send the signal whether to bypass the BCH to the selector 723 , and send the code rate signal of LDPC to the LDPC encoder 722 . The selector 723 is used to determine whether the data needs to be BCH encoded according to the bypass signal. If necessary, the output of the BCH encoder 721 is selected to be connected to the input of the LDPC encoder 722. If not, the original data is not encoded by the BCH The encoder 721 is directly input to the LDPC encoder 722 . The BCH encoder 721 is used to BCH encode the input. The LDPC encoder 722 is configured to determine a code rate according to the coderate signal, and perform LDPC encoding on the input according to the determined code rate.

请参阅图8,图8是本申请用于错误检查和纠正的解码装置一实施方式的结构示意图。该解码装置800用于从存储器中读取数据并解码。该解码装置800包括读取模块810、解码模块820及输出模块830。Please refer to FIG. 8 . FIG. 8 is a schematic structural diagram of an embodiment of a decoding device for error checking and correction in the present application. The decoding device 800 is used for reading data from a memory and decoding it. The decoding device 800 includes a reading module 810 , a decoding module 820 and an output module 830 .

读取模块810用于存储控制器在接收到数据的读取指令时,从存储器中读取所述数据及所述数据的编码信息,其中,所述编码信息包括所述数据采用的编码方式,所述数据采用的编码方式取决于所述数据的重要程度,在所述数据的重要程度为第一重要级时,采用BCH和低密度奇偶校验码LDPC的结合或不高于第一码率的LDPC的编码方式;在所述数据的重要程度为第二重要级时,采用所述BCH或者高于所述第一码率的LDPC的编码方式,所述第一重要级的重要程度大于所述第二重要级的重要程度。The reading module 810 is used to read the data and the coding information of the data from the memory when the storage controller receives the data reading instruction, wherein the coding information includes the coding method adopted by the data, The encoding method adopted by the data depends on the importance of the data. When the importance of the data is at the first importance level, the combination of BCH and low-density parity-check code LDPC is adopted or the code rate is not higher than the first code rate. The LDPC encoding method; when the importance of the data is the second importance level, the BCH or the LDPC encoding method higher than the first code rate is adopted, and the importance of the first importance level is greater than the State the importance of the second level of importance.

解码模块820用于根据所述编码信息确定所述数据的编码方式,并采用与所述编码方式对应的解码方式对所述数据进行解码,其中,所述解码方式包括BCH和LDPC的结合、不高于第一码率的LDPC、BCH或者高于所述第一码率的LDPC。The decoding module 820 is configured to determine the encoding method of the data according to the encoding information, and decode the data by using a decoding method corresponding to the encoding method, wherein the decoding method includes a combination of BCH and LDPC, or a combination of BCH and LDPC. LDPC and BCH higher than the first code rate or LDPC higher than the first code rate.

输出模块830用于输出进行所述解码后得到的数据。The output module 830 is configured to output the data obtained after the decoding.

可选地,所述第二重要级包括第一重要子级和第二重要子级,所述第一重要子级的重要程度大于所述第二重要子级的重要程度。所述数据采用的编码方式还包括在所述数据的重要程度为所述第一重要子级时而采用的高于预设校验位数的BCH或高于所述第一码率且低于第二码率的LDPC的编码方式,在所述数据的重要程度为所述第二重要子级时而采用的不高于所述预设校验位数的BCH或不低于所述第二码率的LDPC的编码方式,其中,所述第一码率高于所述第二码率。所述BCH或者高于所述第一码率的LDPC解码方式包括高于预设校验位数的BCH、高于所述第一码率且低于第二码率的LDPC、不高于所述预设校验位数的BCH、或不低于所述第二码率的LDPC的解码方式。Optionally, the second importance level includes a first importance sub-level and a second importance sub-level, and the importance degree of the first importance sub-level is greater than that of the second importance sub-level. The encoding method adopted by the data also includes BCH which is higher than the preset check digit or higher than the first code rate and lower than the first code rate when the importance of the data is the first important sub-level. The encoding method of LDPC with two code rates, when the importance of the data is the second important sub-level, the BCH that is not higher than the preset check digit or not lower than the second code rate is adopted The LDPC encoding method, wherein the first code rate is higher than the second code rate. The BCH or the LDPC decoding method higher than the first code rate includes BCH higher than the preset check digit, LDPC higher than the first code rate and lower than the second code rate, not higher than the The decoding method of the BCH with the preset parity number or the LDPC with the second code rate not lower than the second code rate.

可选地,该解码装置800还可包括警报模块,用于检测到所述BCH的错误比特数超过预设比特值和/或所述LDPC的实际迭代次数超过预设次数时,发出所述存储器中存储所述数据的块出现问题的警报。Optionally, the decoding device 800 may also include an alarm module, which is used to send out a Alerts that there is a problem with the block in which the data is stored.

可选地,所述存储器为SLC、MLC或TLC类型的NAND存储器。所述数据的编码信息还包括q的取值,当所述存储器的类型为SLC时,所述q取值为1,当所述存储器的类型为MLC时,所述q取值为2,当所述存储器的类型为TLC时,所述q取值为3。解码模块820在所述采用与所述编码方式对应的解码方式对所述数据进行解码的步骤中,若解码模块820进行所述LDPC解码,则解码模块820具体用于将所述编码信息中的所述q的取值作为所述LDPC解码中的有限域GF(2^q)中的q的取值,以进行所述LDPC解码。Optionally, the memory is an SLC, MLC or TLC type NAND memory. The encoding information of the data also includes the value of q, when the type of the memory is SLC, the value of q is 1, when the type of the memory is MLC, the value of q is 2, when When the type of the memory is TLC, the value of q is 3. In the step of decoding the data using the decoding method corresponding to the encoding method, if the decoding module 820 performs the LDPC decoding, the decoding module 820 is specifically used to convert the The value of q is used as the value of q in the finite field GF(2^q) in the LDPC decoding to perform the LDPC decoding.

可选地,所述BCH的校验矩阵按照所述BCH的校验位数进行选择,和/或,所述LDPC的校验矩阵按照所述LDPC的码率进行选择。Optionally, the check matrix of the BCH is selected according to the number of check digits of the BCH, and/or the check matrix of the LDPC is selected according to the code rate of the LDPC.

上述编码装置的各模块具体用于执行上述编码方法中的对应步骤,上述解码装置的各模块具体用于执行上述解码方法中的对应步骤,具体请参阅以上相关说明,在此不作赘述。Each module of the above-mentioned encoding device is specifically used to execute the corresponding steps in the above-mentioned encoding method, and each module of the above-mentioned decoding device is specifically used to execute the corresponding steps in the above-mentioned decoding method. For details, please refer to the relevant description above, and details are not repeated here.

本申请还提供一种用于错误检查和纠正的编解码处理器的实施方式,该编解码处理器可设置在存储器中,并该编解码处理器可包括以上实施例中的编码装置和/或以上实施例中的解码装置。例如,在一实施例中,该存储器包括编码装置和解码装置。编码装置为以上实施例中的编码装置。解码装置为以上实施例中的解码装置。The present application also provides an implementation manner of a codec processor for error checking and correction, the codec processor may be set in a memory, and the codec processor may include the encoding device in the above embodiments and/or The decoding device in the above embodiments. For example, in one embodiment, the memory includes encoding means and decoding means. The encoding device is the encoding device in the above embodiments. The decoding means is the decoding means in the above embodiments.

上述方案中,存储控制器通过分析数据的重要程度,并根据不同重要程度为数据配置不同的编码方式,即越重要的数据配置错误检查及纠正能力越强的编码方式,实现了存储器对数据编码方式的自适应配置,且保证了重要数据的可靠及准确存储。同时,存储控制器对于重要程度低的数据选择错误检查及纠正能力较低的编码方式,降低了其所需编码能力及校验码长,提高了编码效率和节省了存储空间。In the above solution, the storage controller analyzes the importance of data and configures different encoding methods for the data according to different degrees of importance, that is, the more important the data, the stronger the encoding method for error checking and correcting capabilities is, and the data encoding by the memory is realized. The adaptive configuration of the mode ensures the reliable and accurate storage of important data. At the same time, the storage controller selects a coding method with low error checking and correction capabilities for data with low importance, which reduces the required coding capability and check code length, improves coding efficiency and saves storage space.

在本申请所提供的几个实施方式中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施方式仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several implementation manners provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other ways. For example, the device implementations described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be Incorporation may either be integrated into another system, or some features may be omitted, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施方式方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本申请各个实施方式中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本申请各个实施方式所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) execute all or part of the steps of the methods described in various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes. .

Claims (13)

1. it is a kind of for error checking and correct coding method, it is characterised in that including:
Storage control analyzes the important journey of the data when the write instruction of data is received Degree;
When the significance level of the data belongs to the first importance level, BCH and LDPC is respectively adopted The data are encoded, or the LDPC of use not higher than the first code check is carried out to the data Coding;When the significance level of the data belongs to the second importance level, using the BCH or LDPC higher than first code check is encoded to the data, wherein, described first is important Significance level of the significance level of level higher than second importance level;And
The data after by coding are written in memory, and preserve the coding letter of the data Breath, wherein, the coding information of the data includes the coded system that the data are used.
2. it is according to claim 1 for error checking and correct coding method, its feature It is, the step of the significance level of the analysis data, including:
At least one in source, attribute and the type of the data is analyzed, the data are obtained Importance value;
When the importance value is more than the first preset value, the significance level category of the data is determined In the first importance level;And when the importance value is no more than first preset value, it is determined that The significance level of the data belongs to the second importance level.
3. it is according to claim 2 for error checking and correct coding method, its feature It is that second importance level includes the first important sub- level and the second important sub- level;
It is described when the importance value be no more than first preset value when, determine the data The step of significance level belongs to the second importance level includes:
When the importance value is no more than first preset value and during more than the second preset value, really The significance level of the fixed data belongs to the described first important sub- level;When the importance value does not surpass When crossing second preset value, determine that the significance level of the data belongs to the described second important son Level, wherein, first preset value is more than second preset value;And
When the significance level in the data belongs to the second importance level, using the BCH or The step of person encodes higher than the LDPC of first code check to the data, including:
When the significance level of the data belongs to the first important sub- level, using higher than default school Test digit BCH or higher than first code check and less than the second code check LDPC to the number According to being encoded, when the significance level of the data belongs to the second important sub- level, using not Higher than it is described it is default verification digit BCH or be not less than the LDPC of second code check to described Data are encoded, wherein, first code check is higher than second code check.
4. according to any one of claims 1 to 3 for error checking and correct coding staff Method, it is characterised in that the memory is stored for the NAND of SLC, MLC or TLC type Device;
It is described by coding after the data be written to memory, and preserve the volume of the data Before the step of code information, methods described also includes:
Determine the type of the memory, and when the type of the memory is SLC, by LDPC The q values in finite field gf (2^q) in decoding are 1;When the type of the memory It is 2 by the q values during for MLC;When the type of the memory is TLC, by institute It is 3 to state q values;And
The coding information of the data also value including the q.
5. according to any one of claims 1 to 3 for error checking and correct coding staff Method, it is characterised in that the generator matrix of the BCH is carried out according to the verification digit of the BCH Selection, and/or, the generator matrix of the LDPC is selected according to the code check of the LDPC.
6. it is a kind of for error checking and correct coding/decoding method, it is characterised in that including:
Storage control reads the data when the reading for receiving data is instructed from memory And the coding information of the data, wherein, the coding information includes the coding that the data are used Mode, the coded system that the data are used depends on the significance level of the data, in the number According to significance level be the first importance level when, using the combination of BCH and LDPC or not higher than the The coded system of the LDPC of one code check;When the significance level of the data is the second importance level, The coded system of the LDPC using the BCH or higher than first code check, described first Significance level of the significance level of importance level more than second importance level;
The coded system of the data is determined according to the coding information, and is used and the coding staff The corresponding decoding process of formula is decoded to the data, wherein, the decoding process includes BCH With the combination of LDPC, it is not higher than LDPC, BCH of the first code check or higher than described first yard The LDPC of rate;And
Output carries out the data obtained after the decoding.
7. it is according to claim 6 for error checking and correct coding/decoding method, its feature It is that second importance level includes the first important sub- level and the second important sub- level, first weight The significance level of sub- level is wanted more than the significance level of the described second important sub- level;
The significance level that the coded system that the data are used is additionally included in the data is described Used during one important sub- level higher than it is default verification digit BCH or higher than first code check And the coded system of the LDPC less than the second code check, it is described the in the significance level of the data The BCH of the not higher than described default verification digit used during two important sub- levels is not less than described The coded system of the LDPC of the second code check, wherein, first code check is higher than second code check; And
The BCH includes higher than default higher than the LDPC decoding processes of first code check Verify the BCH of digit, the LDPC higher than first code check and less than the second code check, not higher than The decoding side of the BCH or the LDPC for being not less than second code check of the default verification digit Formula.
8. it is according to claim 6 for error checking and correct coding/decoding method, its feature It is in the coded system that the data are determined according to the coding information, and to use and institute After stating the step of the corresponding decoding process of coded system is decoded to the data, methods described Also include:
The error bit number for detecting the BCH exceedes predetermined bit value and/or the LDPC When actual iterations exceedes preset times, send and the block of the data is stored in the memory go out The alarm of existing problem.
9. according to claim 6 or 7 for error checking and correct coding/decoding method, its It is characterised by, the memory is the nand memory of SLC, MLC or TLC type;Institute State the coding information also value including q of data, when the type of the memory is SLC, institute It is 1 to state q values, and when the type of the memory is MLC, the q values are 2, work as institute When the type for stating memory is TLC, the q values are 3;And
The data are decoded using decoding process corresponding with the coded system described The step of in, if carrying out the LDPC decodings, by taking for the q in the coding information It is worth the value of the q in the finite field gf (2^q) in being decoded as the LDPC, to carry out institute State LDPC decodings.
10. according to claim 6 or 7 for error checking and correct coding/decoding method, its It is characterised by, the check matrix of the BCH is selected according to the verification digit of the BCH, And/or, the check matrix of the LDPC is selected according to the code check of the LDPC.
11. it is a kind of for error checking and correct code device, it is characterised in that including:
Analysis module, for when the write instruction of data is received, analyzing the important of the data Degree;
Coding module, for when the significance level of the data belongs to the first importance level, adopting respectively The data are encoded with BCH and LDPC, or using the LDPC of not higher than the first code check The data are encoded;When the significance level of the data belongs to the second importance level, use The BCH is encoded higher than the LDPC of first code check to the data, wherein, Significance level of the significance level of first importance level higher than second importance level;And
Writing module, is written in memory for the data after by coding, and preserves described The coding information of data, wherein, the coding information of the data includes the coding that the data are used Mode.
12. it is a kind of for error checking and correct decoding apparatus, it is characterised in that including:
Read module, for storage control when the reading for receiving data is instructed, from memory The middle coding information for reading the data and the data, wherein, the coding information includes described The coded system that data are used, the coded system that the data are used depends on the important of the data Degree, when the significance level of the data is the first importance level, using BCH's and LDPC With reference to or the not higher than coded system of the LDPC of the first code check;It is in the significance level of the data During the second importance level, the coding of the LDPC using the BCH or higher than first code check Mode, the significance level of the significance level more than second importance level of first importance level;
Decoder module, for determining the coded system of the data according to the coding information, and adopts The data are decoded with decoding process corresponding with the coded system, wherein, the solution The combination of code mode including BCH and LDPC, not higher than LDPC, BCH of the first code check or LDPC of the person higher than first code check;And
Output module, for exporting the data for obtained after the decoding.
13. it is a kind of for error checking and correct codec processor, it is characterised in that including power Profit requires the decoding apparatus described in code device and/or claim 12 described in 11.
CN201510920256.9A 2015-12-10 2015-12-10 It is a kind of for error checking and the decoding method corrected, device and processor Withdrawn CN106874139A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510920256.9A CN106874139A (en) 2015-12-10 2015-12-10 It is a kind of for error checking and the decoding method corrected, device and processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510920256.9A CN106874139A (en) 2015-12-10 2015-12-10 It is a kind of for error checking and the decoding method corrected, device and processor

Publications (1)

Publication Number Publication Date
CN106874139A true CN106874139A (en) 2017-06-20

Family

ID=59177967

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510920256.9A Withdrawn CN106874139A (en) 2015-12-10 2015-12-10 It is a kind of for error checking and the decoding method corrected, device and processor

Country Status (1)

Country Link
CN (1) CN106874139A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107682020A (en) * 2017-10-26 2018-02-09 北京邮电大学 A kind of coding based on Turbo code, coding/decoding method and device
CN113168562A (en) * 2019-05-15 2021-07-23 西部数据技术公司 Optimized neural network data organization
CN114390278A (en) * 2022-01-04 2022-04-22 北京银河信通科技有限公司 H.265 code stream unequal error protection method and system based on LDPC coding and electronic equipment
CN114911424A (en) * 2022-06-21 2022-08-16 维沃移动通信有限公司 Data storage method, data storage device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101119353A (en) * 2006-07-25 2008-02-06 北京凌讯华业科技有限公司 Ldpc coding based tds-ofdm communication system transmitter
US20090027238A1 (en) * 2007-07-25 2009-01-29 Samsung Electronics Co., Ltd. Apparatuses and methods for encoding and decoding
CN101902296A (en) * 2010-06-23 2010-12-01 中兴通讯股份有限公司 Encoding and decoding method and device for fountain code
CN101917625A (en) * 2010-06-03 2010-12-15 北京邮电大学 A Scalable Video Stream Transmission Method Based on Joint Source-Network Coding
CN103067131A (en) * 2012-12-26 2013-04-24 陈宏滨 Reliable sensor network communication method for digital channel

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101119353A (en) * 2006-07-25 2008-02-06 北京凌讯华业科技有限公司 Ldpc coding based tds-ofdm communication system transmitter
US20090027238A1 (en) * 2007-07-25 2009-01-29 Samsung Electronics Co., Ltd. Apparatuses and methods for encoding and decoding
CN101917625A (en) * 2010-06-03 2010-12-15 北京邮电大学 A Scalable Video Stream Transmission Method Based on Joint Source-Network Coding
CN101902296A (en) * 2010-06-23 2010-12-01 中兴通讯股份有限公司 Encoding and decoding method and device for fountain code
CN103067131A (en) * 2012-12-26 2013-04-24 陈宏滨 Reliable sensor network communication method for digital channel

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107682020A (en) * 2017-10-26 2018-02-09 北京邮电大学 A kind of coding based on Turbo code, coding/decoding method and device
CN113168562A (en) * 2019-05-15 2021-07-23 西部数据技术公司 Optimized neural network data organization
CN113168562B (en) * 2019-05-15 2024-03-26 西部数据技术公司 Optimized neural network data organization
CN114390278A (en) * 2022-01-04 2022-04-22 北京银河信通科技有限公司 H.265 code stream unequal error protection method and system based on LDPC coding and electronic equipment
CN114911424A (en) * 2022-06-21 2022-08-16 维沃移动通信有限公司 Data storage method, data storage device and electronic equipment
CN114911424B (en) * 2022-06-21 2025-08-19 维沃移动通信有限公司 Data storage method, data storage device and electronic equipment

Similar Documents

Publication Publication Date Title
US8769374B2 (en) Multi-write endurance and error control coding of non-volatile memories
US11025274B2 (en) Memory controller and method of data bus inversion using an error detection correction code
US9973213B2 (en) Decoding method, and memory storage apparatus and memory control circuit unit using the same
US20120254686A1 (en) Non-volatile semiconductor memory devices and error correction methods
US9471421B2 (en) Data accessing method, memory storage device and memory controlling circuit unit
CN102110481A (en) Semiconductor memory system having ECC circuit and method of controlling thereof
JP2019125910A (en) Memory system
TW201603039A (en) Decoding method, memory controlling circuit unit and memory storage device
CN104733051B (en) Decoding method of parity check code, memory storage device and control circuit unit
US10191801B2 (en) Error correction code management of write-once memory codes
TWI460733B (en) Memory controller with low density parity check code decoding capability and relevant memory controlling method
TWI672698B (en) Memory control method, memory storage device and memory control circuit unit
TW201916046A (en) Decoding method, memory controlling circuit unit and memory storage device
TW201913382A (en) Decoding method, memory storage device and memory control circuit unit
CN106874139A (en) It is a kind of for error checking and the decoding method corrected, device and processor
CN105023613A (en) Decoding method, memory storage device and memory control circuit unit
TWI536749B (en) Decoding method, memory storage device and memory controlling circuit unit
CN105022674A (en) Decoding method, memory storage device, memory control circuit unit
TWI634556B (en) Decoding method, memory storage device and memory control circuit unit
CN111580741B (en) Data writing method, memory control circuit unit and memory storage device
US10855314B2 (en) Generating and using invertible, shortened Bose-Chaudhuri-Hocquenghem codewords
US10649841B2 (en) Supporting multiple page lengths with unique error correction coding via galois field dimension folding
CN106301389B (en) Decoding method and device
CN106897023B (en) Data reading method, memory control circuit unit and memory storage device
TWI537971B (en) Storage device and access method thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20170620

WW01 Invention patent application withdrawn after publication