WO2017088507A1 - Method and device for updating error checking and correction code - Google Patents

Method and device for updating error checking and correction code Download PDF

Info

Publication number
WO2017088507A1
WO2017088507A1 PCT/CN2016/091840 CN2016091840W WO2017088507A1 WO 2017088507 A1 WO2017088507 A1 WO 2017088507A1 CN 2016091840 W CN2016091840 W CN 2016091840W WO 2017088507 A1 WO2017088507 A1 WO 2017088507A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
code
ecc
written
storage space
Prior art date
Application number
PCT/CN2016/091840
Other languages
French (fr)
Chinese (zh)
Inventor
黄生儒
廉肖洁
薛军
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2017088507A1 publication Critical patent/WO2017088507A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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

Abstract

Disclosed in an embodiment of the invention is a method for updating an error checking and correction (ECC) code. The method is applied in a process of writing data to a storage medium comprising multiple storage blocks. The method comprises: acquiring an ECC code for a total amount of data in each storage block; when a byte of data is randomly written to the storage medium, acquiring the written data, a location in a storage space where the written data is stored, and initial data stored in the storage space prior to the writing of the data; performing a logic operation to acquire a column check code of an ECC code for the total amount of data in the storage block to which the storage space that stored the written byte of data belongs, and revising, according to the written data and the initial data, a row check code of the ECC code for the total amount of data in the storage block to which the storage space belongs; and obtaining an updated ECC code according to the column check code of the ECC code obtained via the operation and the revised row check code of the ECC code. The invention can protect random read and write performance of a storage medium from being degraded when an ECC check is performed.

Description

一种更新错误检测和纠正ECC码的方法及装置Method and device for updating error detection and correcting ECC code
本申请要求于2015年11月26日提交中国专利局,申请号为201510844082.2、发明名称为“一种更新错误检测和纠正ECC码的方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to Chinese Patent Application No. 201510844082.2, entitled "A Method and Apparatus for Updating Error Detection and Correcting ECC Codes", filed on November 26, 2015, the entire contents of which are hereby incorporated by reference. The citations are incorporated herein by reference.
技术领域Technical field
本发明涉及计算机技术领域,尤其涉及一种更新错误检测和纠正ECC码的方法及装置。The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for updating an error detection and correcting an ECC code.
背景技术Background technique
在计算机领域中,目前主流的两种闪存是NAND Flash(内部存储单元采用与非门相连的闪存)和NOR Flash(内部存储单元采用或非门相连的闪存)。其中,NAND Flash容易出现比特反转的问题,若NADN Flash中的重要程序代码或关键数据出现比特反转,则可能会导致计算机系统不能正常运行,因此,为了提高可靠性,NAND Flash应用时需要进行ECC(Error Checking and Correction,错误检测和纠正)校验。In the computer field, the two mainstream flash memories are NAND Flash (internal memory unit with NAND gate connected flash memory) and NOR Flash (internal memory unit with NAND gate connected flash memory). Among them, NAND Flash is prone to bit inversion problem. If bit error is reversed in important program code or key data in NADN Flash, the computer system may not operate normally. Therefore, in order to improve reliability, NAND Flash application is required. Perform ECC (Error Checking and Correction) check.
ECC校验是指,在读写数据的时候以数据块(如将256字节或512字节的数据作为一个数据块)的方式计算ECC码,通过比较写入数据的ECC码与读取数据的ECC码是否一致,确定数据是否发生比特反转。由于NAND Flash本身是以数据块方式读写数据的,因此ECC校验完美适用于NAND Flash。ECC check refers to calculating the ECC code by means of a data block (such as 256 bytes or 512 bytes of data as one data block) when reading and writing data, by comparing the ECC code of the written data with the read data. Whether the ECC codes are consistent or not, and whether the data is bit-reversed is determined. Since NAND Flash itself reads and writes data in the form of data blocks, ECC verification is perfectly suitable for NAND Flash.
进一步地,随着内存工艺尺寸的不断缩小,NOR Flash也越来越容易出现比特反转的问题,目前考虑的是向NOR Flash引入ECC校验。然而,不同于NAND Flash的读写方式,NOR Flash是随机读写方式,即读写数据的大小是随机的,若向NOR Flash直接引入ECC校验,将使其局限于以数据块的方式读写数据,破坏了NOR Flash的随机读写性。Further, as the size of the memory process continues to shrink, NOR Flash is also more and more prone to bit inversion problems. Currently, ECC verification is introduced to NOR Flash. However, unlike NAND Flash reading and writing, NOR Flash is a random read/write method, that is, the size of read and write data is random. If ECC is directly introduced into NOR Flash, it will be limited to reading in blocks. Writing data destroys the random read and write of NOR Flash.
发明内容Summary of the invention
本发明实施例提供了一种更新错误检测和纠正ECC码的方法及装置,可以实现在进行ECC校验时,不破坏存储介质的随机读写性。 Embodiments of the present invention provide a method and apparatus for updating an error detection and correcting an ECC code, which can achieve random read and write performance of a storage medium when performing ECC verification.
本发明实施例第一方面提供了一种更新ECC码的方法,所述方法应用于存储介质的数据写入过程,所述存储介质包括多个存储块,所述方法包括:A first aspect of the embodiments of the present invention provides a method for updating an ECC code, where the method is applied to a data writing process of a storage medium, where the storage medium includes a plurality of storage blocks, and the method includes:
获取每个所述存储块中总数据的ECC码,所述ECC码包括列校验码和行校验码;Obtaining an ECC code of total data in each of the storage blocks, where the ECC code includes a column check code and a row check code;
当向所述存储介质随机写入一字节的数据时,获取写入的数据、所述数据被写入的存储空间的位置以及所述存储空间在写入所述数据之前所存储的原始数据,其中,所述存储空间的位置用以确定所述存储空间所属的存储块;When a byte of data is randomly written to the storage medium, the written data, the location of the storage space where the data is written, and the original data stored by the storage space before the data is written are acquired. Wherein the location of the storage space is used to determine a storage block to which the storage space belongs;
通过对所述写入的数据的ECC码的列校验码、所述原始数据的ECC码的列校验码和所述存储空间所属的存储块中总数据的ECC码的列校验码进行逻辑运算,得到写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码,以及根据所述写入的数据和所述原始数据,修改所述存储空间所属的存储块中总数据的ECC码的行校验码;And performing, by using a column check code of the ECC code of the written data, a column check code of the ECC code of the original data, and a column check code of an ECC code of the total data in the storage block to which the storage space belongs. a logical operation of obtaining a column check code of an ECC code of total data in a storage block to which the storage space belongs after writing one-byte data, and modifying the data according to the written data and the original data a row check code of the ECC code of the total data in the storage block to which the storage space belongs;
根据所述写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码和修改后的所述存储空间所属的存储块中总数据的ECC码的行校验码,得到更新后的所述存储空间所属的存储块中总数据的ECC码。a column check code of the ECC code of the total data in the memory block to which the storage space belongs after the one-byte data is written, and an ECC code of the total data in the memory block to which the modified storage space belongs The check code is obtained, and the ECC code of the total data in the storage block to which the updated storage space belongs is obtained.
在第一方面的第一种可能实现方式中,所述通过对所述写入的数据的ECC码的列校验码、所述原始数据的ECC码的列校验码和所述存储空间所属的存储块中总数据的ECC码的列校验码进行逻辑运算,得到写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码,包括:In a first possible implementation manner of the first aspect, the column check code of the ECC code of the written data, the column check code of the ECC code of the original data, and the storage space belong to The column check code of the ECC code of the total data in the storage block is logically operated, and the column check code of the ECC code of the total data in the storage block to which the storage space belongs after the one-byte data is written is obtained, including:
计算所述写入的数据的ECC码的列校验码,以及所述原始数据的ECC码的列校验码;根据公式
Figure PCTCN2016091840-appb-000001
计算写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码,其中,所述
Figure PCTCN2016091840-appb-000002
表示计算后的所述总数据的ECC码的列校验码,所述ECC_CP表示计算前的所述总数据的ECC码的列校验码,所述Data_ECC_CP表示所述写入的数据的ECC码的列校验码,所述Buf_ECC_CP表示所述原始数据的ECC码的列校验码。其中,公式
Figure PCTCN2016091840-appb-000003
的原理是,由于在异或的运算法则中^既代表增加也代表去除,因此该公式相当于在ECC_CP中增加了Data_ECC_CP,以及去除了Buf_ECC_CP。
Calculating a column check code of the ECC code of the written data, and a column check code of the ECC code of the original data; according to a formula
Figure PCTCN2016091840-appb-000001
Calculating a column check code of an ECC code of total data in a storage block to which the storage space belongs after writing one-byte data, wherein
Figure PCTCN2016091840-appb-000002
a column check code indicating an ECC code of the calculated total data, the ECC_CP indicating a column check code of an ECC code of the total data before calculation, and the Data_ECC_CP indicating an ECC code of the written data A column check code, the Buf_ECC_CP indicating a column check code of the ECC code of the original data. Among them, the formula
Figure PCTCN2016091840-appb-000003
The principle is that since ^ is both an increase and a removal in the XOR algorithm, the formula is equivalent to adding Data_ECC_CP to ECC_CP and removing Buf_ECC_CP.
结合第一方面的第一种可能实现方式,在第二种可能实现方式中,所述根 据所述写入的数据和所述原始数据,修改所述存储空间所属的存储块中总数据的ECC码的行校验码,包括:In conjunction with the first possible implementation of the first aspect, in a second possible implementation, the root And modifying the row check code of the ECC code of the total data in the storage block to which the storage space belongs according to the data to be written and the original data, including:
确定所述写入的数据的奇偶性,以及所述原始数据的奇偶性;判断所述写入的数据的奇偶性与所述原始数据的奇偶性是否相同;若是,则不修改所述总数据的ECC码的行校验码;若否,则确定在所述总数据的ECC码的行校验码中,与所述被写入的存储空间中数据关联的比特位,并对其进行反转,其中,所述反转是指将数据0变为数据1,或将数据1变为数据0。Determining a parity of the written data and a parity of the original data; determining whether a parity of the written data is the same as a parity of the original data; if yes, modifying the total data a row check code of the ECC code; if not, determining a bit associated with the data in the written storage space in the row check code of the ECC code of the total data, and reversing the bit Turning, wherein the inversion refers to changing data 0 to data 1, or changing data 1 to data 0.
结合第一方面以及第一方面的第一或第二种可能实现方式,在第三种可能实现方式中,所述存储块为256个字节的存储空间。一方面,存储块的字节数越少,存储介质中存储块的个数越多,所要记录的ECC码就会越多,另一方面,存储块的字节数越多,存储块中总数据就越大,所要记录的ECC码越复杂,综合上述两方面的因素,设定256个字节最为适中。In conjunction with the first aspect and the first or second possible implementation of the first aspect, in a third possible implementation, the memory block is 256 bytes of storage space. On the one hand, the smaller the number of bytes of the storage block, the more the number of storage blocks in the storage medium, the more ECC codes to be recorded. On the other hand, the more bytes of the storage block, the total in the storage block. The larger the data, the more complex the ECC code to be recorded, and the combination of the above two factors, the most appropriate setting of 256 bytes.
本发明实施例第二方面提供了一种校验ECC码的方法,所述方法应用于存储介质的数据写入过程,所述存储介质包括多个存储块,所述方法包括:A second aspect of the embodiments of the present invention provides a method for verifying an ECC code, where the method is applied to a data writing process of a storage medium, where the storage medium includes a plurality of storage blocks, and the method includes:
当向所述存储介质随机读取数据时,对读取的数据进行奇偶校验;判断所述奇偶校验是否出错;若是,则对所述读取的数据所在存储空间所属的存储块中总数据进行ECC码校验。When randomly reading data to the storage medium, performing parity check on the read data; determining whether the parity is in error; if yes, totaling in a storage block to which the read data is located The data is subjected to ECC code verification.
在第二方面的第一种可能实现方式中,所述对读取的数据所在存储空间的数据进行奇偶校验,包括:In a first possible implementation manner of the second aspect, the performing parity check on the data in the storage space where the read data is located includes:
计算所述读取的数据的奇偶校验码;查询所述读取的数据所在存储空间在写入数据时保存的奇偶校验码;判断计算的奇偶校验码是否与所述保存的奇偶校验码相同;若否,则所述奇偶校验出错;若是,则所述奇偶校验未出错。通过该技术方案,可以先判定读取的数据是否出错。Calculating a parity code of the read data; querying a parity code stored in a storage space of the read data when writing data; determining whether the calculated parity code is related to the saved parity The parity is the same; if not, the parity is erroneous; if so, the parity is not erroneous. With this technical solution, it is possible to first determine whether the read data is in error.
在第二方面的第二种可能实现方式中,所述对所述读取的数据所在存储空间所属的存储块中总数据进行ECC码校验,包括:In a second possible implementation manner of the second aspect, the performing the ECC code check on the total data in the storage block to which the storage space of the read data belongs includes:
计算所述读取的数据所在存储空间所属的存储块中总数据的ECC码;查询所述读取的数据所在存储空间所属的存储块在写入数据时保存的奇偶校验码;通过将计算的所述ECC码与所述保存的ECC码进行比较,确定所述读取 的数据中发生比特反转的比特位,并对其进行反转,其中,所述反转是指将数据0变为数据1,或将数据1变为数据0。通过该技术方案,可以确定读取的数据中出错的比特位,并将其纠正。Calculating an ECC code of the total data in the storage block to which the read data belongs, and querying a parity code saved when the storage block to which the read data belongs is written in the data; The ECC code is compared with the saved ECC code to determine the reading The bit-inverted bit occurs in the data, and is inverted, wherein the inversion refers to changing data 0 to data 1, or changing data 1 to data 0. With this technical solution, it is possible to determine the bit of the error in the read data and correct it.
结合第一方面以及第一方面的第一或第二种可能实现方式,在第三种可能实现方式中,所述存储块为256个字节的存储空间。一方面,存储块的字节数越少,存储介质中存储块的个数越多,所要记录的ECC码就会越多,另一方面,存储块的字节数越多,存储块中总数据就越大,所要记录的ECC码越复杂,综合上述两方面的因素,设定256个字节最为适中。In conjunction with the first aspect and the first or second possible implementation of the first aspect, in a third possible implementation, the memory block is 256 bytes of storage space. On the one hand, the smaller the number of bytes of the storage block, the more the number of storage blocks in the storage medium, the more ECC codes to be recorded. On the other hand, the more bytes of the storage block, the total in the storage block. The larger the data, the more complex the ECC code to be recorded, and the combination of the above two factors, the most appropriate setting of 256 bytes.
本发明实施例第三方面提供了一种更新ECC码的装置,该装置具有实现上述第一方面提供的方法的行为功能,所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。A third aspect of the embodiments of the present invention provides an apparatus for updating an ECC code, where the apparatus has a behavior function for implementing the method provided by the foregoing first aspect, and the function may be implemented by using hardware or by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the functions described above.
本发明实施例第四方面提供了一种校验ECC码的装置,该装置具有实现上述第二方面提供的方法的行为功能,所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。A fourth aspect of the embodiments of the present invention provides an apparatus for verifying an ECC code, where the apparatus has a behavior function for implementing the method provided by the foregoing second aspect, and the function may be implemented by hardware, or may be implemented by hardware. . The hardware or software includes one or more modules corresponding to the functions described above.
本发明实施例第五方面提供了一种存储设备,包括处理器、通信总线、存储介质、存储器以及输入输出接口。其中,所述通信总线用于实现这些组件之间的连接通信;存储介质包括多个虚拟的存储块,用于存储外部设备写入的数据,或送出外部数据读取的数据;所述输入输出接口用于向外部设备提供访问的接口,以读写数据;存储器中存储有程序代码。A fifth aspect of the embodiments of the present invention provides a storage device including a processor, a communication bus, a storage medium, a memory, and an input/output interface. The communication bus is configured to implement connection communication between the components; the storage medium includes a plurality of virtual storage blocks for storing data written by the external device, or sending data read by the external data; the input and output The interface is used to provide an interface to an external device for reading and writing data; the program code is stored in the memory.
一方面,当存储设备处于数据写入过程时,处理器用于调用存储器中存储的程序代码,执行以下操作:In one aspect, when the storage device is in the data writing process, the processor is configured to call the program code stored in the memory, and performs the following operations:
获取每个所述存储块中总数据的ECC码,所述ECC码包括列校验码和行校验码;当向所述存储介质随机写入一字节的数据时,获取写入的数据、所述数据被写入的存储空间的位置以及所述存储空间在写入所述数据之前所存储 的原始数据,其中,所述存储空间的位置用以确定所述存储空间所属的存储块;通过对所述写入的数据的ECC码的列校验码、所述原始数据的ECC码的列校验码和所述存储空间所属的存储块中总数据的ECC码的列校验码进行逻辑运算,得到写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码,以及根据所述写入的数据和所述原始数据,修改所述存储空间所属的存储块中总数据的ECC码的行校验码;根据所述写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码和修改后的所述存储空间所属的存储块中总数据的ECC码的行校验码,得到更新后的所述存储空间所属的存储块中总数据的ECC码。Acquiring an ECC code of total data in each of the storage blocks, the ECC code including a column check code and a row check code; when randomly writing one byte of data to the storage medium, acquiring the written data The location of the storage space in which the data is written and the storage space is stored before the data is written Raw data, wherein the location of the storage space is used to determine a storage block to which the storage space belongs; a column check code of an ECC code for the written data, and a column of an ECC code of the original data The check code and the column check code of the ECC code of the total data in the storage block to which the storage space belongs are logically operated, and the ECC of the total data in the storage block to which the storage space belongs after the one-byte data is written is obtained. a column check code of the code, and modifying a row check code of the ECC code of the total data in the memory block to which the storage space belongs according to the written data and the original data; writing a byte according to the After the data, the column check code of the ECC code of the total data in the storage block to which the storage space belongs and the row check code of the ECC code of the total data in the storage block to which the modified storage space belongs are updated. The ECC code of the total data in the storage block to which the storage space belongs.
可选的,处理器通过对所述写入的数据的ECC码的列校验码、所述原始数据的ECC码的列校验码和所述存储空间所属的存储块中总数据的ECC码的列校验码进行逻辑运算,得到写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码的具体操作为:计算所述写入的数据的ECC码的列校验码,以及所述原始数据的ECC码的列校验码;根据公式
Figure PCTCN2016091840-appb-000004
计算写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码,其中,所述
Figure PCTCN2016091840-appb-000005
表示计算后的所述总数据的ECC码的列校验码,所述ECC_CP表示计算前的所述总数据的ECC码的列校验码,所述Data_ECC_CP表示所述写入的数据的ECC码的列校验码,所述Buf_ECC_CP表示所述原始数据的ECC码的列校验码,所述^表示按位异或的运算。
Optionally, the processor passes the column check code of the ECC code of the written data, the column check code of the ECC code of the original data, and the ECC code of the total data in the storage block to which the storage space belongs. The column check code performs a logical operation, and the specific operation of the column check code of the ECC code of the total data in the storage block to which the storage space belongs after the one-byte data is written is: calculating the written data Column check code of the ECC code, and column check code of the ECC code of the original data; according to the formula
Figure PCTCN2016091840-appb-000004
Calculating a column check code of an ECC code of total data in a storage block to which the storage space belongs after writing one-byte data, wherein
Figure PCTCN2016091840-appb-000005
a column check code indicating an ECC code of the calculated total data, the ECC_CP indicating a column check code of an ECC code of the total data before calculation, and the Data_ECC_CP indicating an ECC code of the written data Column check code, the Buf_ECC_CP represents a column check code of the ECC code of the original data, and the ^ represents a bitwise exclusive OR operation.
又可选的,处理器根据所述写入的数据和所述原始数据,修改所述存储空间所属的存储块中总数据的ECC码的行校验码的具体操作为:确定所述写入的数据的奇偶性,以及所述原始数据的奇偶性;判断所述写入的数据的奇偶性与所述原始数据的奇偶性是否相同;若是,则不修改所述总数据的ECC码的行校验码;若否,则确定在所述总数据的ECC码的行校验码中,与所述被写入的存储空间中数据关联的比特位,并对其进行反转,其中,所述反转是指将数据0变为数据1,或将数据1变为数据0。Optionally, the specific operation of the processor to modify the row check code of the ECC code of the total data in the storage block to which the storage space belongs according to the written data and the original data is: determining the write The parity of the data, and the parity of the original data; determining whether the parity of the written data is the same as the parity of the original data; if so, the row of the ECC code of the total data is not modified a check code; if not, determining a bit associated with the data in the written storage space in the row check code of the ECC code of the total data, and inverting it, wherein The inversion refers to changing data 0 to data 1, or changing data 1 to data 0.
另一方面,当存储设备处于数据读取过程时,处理器用于调用存储器中存储的程序代码,执行以下操作: On the other hand, when the storage device is in the data reading process, the processor is used to call the program code stored in the memory, and performs the following operations:
当通过输入输出接口向所述存储介质随机读取数据时,对读取的数据进行奇偶校验;判断所述奇偶校验是否出错;若是,则对所述读取的数据所在存储空间所属的存储块中总数据进行ECC码校验。When randomly reading data to the storage medium through the input/output interface, performing parity check on the read data; determining whether the parity is in error; if yes, belonging to a storage space where the read data is located The total data in the memory block is subjected to ECC code verification.
可选的,处理器对读取的数据所在存储空间的数据进行奇偶校验的具体操作为:计算所述读取的数据的奇偶校验码;查询所述读取的数据所在存储空间在写入数据时保存的奇偶校验码;判断计算的奇偶校验码是否与所述保存的奇偶校验码相同;若否,则所述奇偶校验出错;若是,则所述奇偶校验未出错。Optionally, the specific operation of the processor to perform parity check on the data of the storage space where the read data is located is: calculating a parity code of the read data; querying a storage space where the read data is written a parity code saved when data is entered; determining whether the calculated parity code is the same as the saved parity code; if not, the parity error occurs; if yes, the parity is not errored .
又可选的,处理器对所述读取的数据所在存储空间所属的存储块中总数据进行ECC码校验的具体操作为:计算所述读取的数据所在存储空间所属的存储块中总数据的ECC码;查询所述读取的数据所在存储空间所属的存储块在写入数据时保存的奇偶校验码;通过将计算的所述ECC码与所述保存的ECC码进行比较,确定所述读取的数据中发生比特反转的比特位,并对其进行反转,其中,所述反转是指将数据0变为数据1,或将数据1变为数据0。Optionally, the specific operation of performing ECC code verification on the total data in the storage block to which the read data belongs is: calculating a total of the storage blocks to which the read data belongs. An ECC code of the data; querying a parity code saved when the storage block to which the read data belongs is written in the data; determining the calculated ECC code by comparing the calculated ECC code with the saved ECC code A bit inverted bit occurs in the read data, and is inverted, wherein the inversion refers to changing data 0 to data 1, or changing data 1 to data 0.
由上可见,本发明实施例在向存储介质随机写入数据时,只需根据写入的数据和写入前的原始数据修改存储块中总数据的ECC码即可,可以解决现有技术中必须完整写入一个存储块的数据后才能计算ECC码的问题,从而不会破坏存储介质的随机写入性;本发明实施例在向存储介质随机读取数据时,先对读取的数据进行奇偶校验,只有在奇偶校验出错时才进行ECC校验,可以解决现有技术中每次读取数据时都要完整读取一个存储块的数据后才能进行ECC校验的问题,从而减少对存储介质的随机读取性的破坏。It can be seen that, in the embodiment of the present invention, when the data is randomly written to the storage medium, the ECC code of the total data in the storage block can be modified only according to the written data and the original data before the writing, which can be solved in the prior art. The data of one storage block must be completely written before the problem of the ECC code can be calculated, so that the random writeability of the storage medium is not damaged. In the embodiment of the present invention, when the data is randomly read from the storage medium, the read data is first performed. Parity check, only when the parity error occurs, the ECC check is performed, which can solve the problem that the ECC check can be performed after the data of one memory block is completely read every time the data is read in the prior art, thereby reducing the problem. Destruction of random readability of storage media.
附图说明DRAWINGS
为了更清楚地说明本发明实施例,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。BRIEF DESCRIPTION OF THE DRAWINGS In the following, the embodiments of the present invention will be briefly described, and the drawings in the following description are merely illustrative of some embodiments of the present invention. Other drawings may also be obtained from those of ordinary skill in the art in light of the inventive work.
图1是本发明实施例提供的一种更新ECC码的方法的流程示意图;1 is a schematic flowchart of a method for updating an ECC code according to an embodiment of the present invention;
图2是本发明实施例提供的一种校验ECC码的方法的流程示意图; 2 is a schematic flowchart of a method for verifying an ECC code according to an embodiment of the present invention;
图3是本发明实施例提供的一种更新ECC码的装置的结构示意图;3 is a schematic structural diagram of an apparatus for updating an ECC code according to an embodiment of the present invention;
图4是本发明实施例提供的一种行列码修改模块的结构示意图;4 is a schematic structural diagram of a row and column code modification module according to an embodiment of the present invention;
图5是本发明实施例提供的一种校验ECC码的装置的结构示意图;FIG. 5 is a schematic structural diagram of an apparatus for verifying an ECC code according to an embodiment of the present invention;
图6是本发明实施例提供的一种奇偶校验模块的结构示意图;6 is a schematic structural diagram of a parity check module according to an embodiment of the present invention;
图7是本发明实施例提供的一种ECC码校验模块的结构示意图;7 is a schematic structural diagram of an ECC code verification module according to an embodiment of the present invention;
图8是本发明实施例提供的一种存储设备的结构示意图。FIG. 8 is a schematic structural diagram of a storage device according to an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
为了便于理解本发明的实施例,这里先介绍下ECC码的计算方法。ECC码包括列校验码与行校验码,其计算对象是数据块,下面以256字节的数据作为一个数据块为例进行说明:In order to facilitate the understanding of the embodiments of the present invention, the calculation method of the ECC code will be described first. The ECC code includes a column check code and a row check code, and the calculation object is a data block. The following is an example of 256 bytes of data as a data block:
第一,计算ECC码的列校验码。First, calculate the column check code of the ECC code.
应理解地,1字节(Byte)包括8位(Bit),那么将256字节按位的方式展开可得到表1。 It should be understood that 1 byte (Byte) includes 8 bits (Bit), then 256 bytes are expanded in a bitwise manner to obtain Table 1.
表1Table 1
Figure PCTCN2016091840-appb-000006
Figure PCTCN2016091840-appb-000006
CP0表示第0列、第2列、第4列和第6列的列极性;CP0 represents the column polarity of the 0th column, the 2nd column, the 4th column, and the 6th column;
CP1表示第1列、第3列、第5列和第7列的列极性;CP1 indicates the column polarity of the first column, the third column, the fifth column, and the seventh column;
CP2表示第0列、第1列、第4列和第5列的列极性;CP2 indicates the column polarity of the 0th column, the 1st column, the 4th column, and the 5th column;
CP3表示第2列、第3列、第6列和第7列的列极性;CP3 indicates the column polarity of the second column, the third column, the sixth column, and the seventh column;
CP4表示第0列、第1列、第2列和第3列的列极性;CP4 indicates the column polarity of the 0th column, the 1st column, the 2nd column, and the 3rd column;
CP5表示第4列、第5列、第6列和第7列的列极性。CP5 indicates the column polarities of the fourth column, the fifth column, the sixth column, and the seventh column.
其中,CP0=[Bit0]^[Bit2]^[Bit4]^[Bit6],^表示按位异或的运算,[Bit0]表示第0列的256个Bit0异或的结果,[Bit2]表示第2列的256个Bit2异或的结果,[Bit4]表示第4列的256个Bit4异或的结果,[Bit6]表示第6列的256个Bit6异或的结果。Where CP0=[Bit0]^[Bit2]^[Bit4]^[Bit6], ^ represents a bitwise XOR operation, [Bit0] represents the result of 256 Bit0 XORs of column 0, [Bit2] indicates the first The result of 256 Bit2 XOR of 2 columns, [Bit4] represents the result of 256 Bit4 XOR of the 4th column, and [Bit6] represents the result of 256 Bit6 XOR of the 6th column.
以此类推,可以求得CP1~CP5。假设ECC_CP表示ECC码的列校验码,则ECC_CP={CP5,CP4,CP3,CP2,CP1,CP0}。By analogy, CP1 to CP5 can be obtained. Assuming that ECC_CP indicates the column check code of the ECC code, ECC_CP = {CP5, CP4, CP3, CP2, CP1, CP0}.
第二,计算ECC码的行校验码。Second, calculate the row check code of the ECC code.
同理,将256字节按位的方式展开可得到表2。 Similarly, 256 bytes are expanded in a bitwise manner to obtain Table 2.
表2Table 2
Figure PCTCN2016091840-appb-000007
Figure PCTCN2016091840-appb-000007
RP0为第0、2、4、6、……252、254行的行极性;RP0 is the row polarity of rows 0, 2, 4, 6, ... 252, 254;
RP1为第1、3、5、7、……253、255行的行极性;RP1 is the row polarity of the first, third, fifth, seventh, ..., 253, and 255 lines;
RP2为第0、1、4、5、……252、254行(处理两行,跳过两行)的行极性;RP2 is the row polarity of lines 0, 1, 4, 5, ... 252, 254 (processing two lines, skipping two lines);
RP3为第2、3、6、7、……254、255行(跳过两行,处理两行)的行极性;RP3 is the row polarity of the 2nd, 3rd, 6th, 7th, ..., 254th, and 255th lines (skip two lines, processing two lines);
RP4为……行(处理四行,跳过四行)的行极性;RP4 is the row polarity of the line (processing four lines, skipping four lines);
RP5为……行(跳过四行,处理四行)的行极性;RP5 is the row polarity of the line (skip four lines, handle four lines);
RP6为……行(处理八行,跳过八行)的行极性;RP6 is the row polarity of the line (processing eight lines, skipping eight lines);
RP7为……行(跳过八行,处理八行)的行极性;RP7 is the row polarity of the line (skip eight lines, handle eight lines);
RP8为……行(处理十六行,跳过十六行)的行极性;RP8 is the row polarity of the line (processing sixteen lines, skipping sixteen lines);
RP9为……行(跳过十六行,处理十六行)的行极性;RP9 is the row polarity of the line (skip six lines, handle sixteen lines);
RP10为……行(处理三十二行,跳过三十二行)的行极性;RP10 is the row polarity of the line (processing thirty-two lines, skipping thirty-two lines);
RP11为……行(跳过三十二行,处理三十二行)的行极性;RP11 is the row polarity of the line (skip thirty-two lines, processing thirty-two lines);
RP12为……行(处理六十四行,跳过六十四行)的行极性;RP12 is the row polarity of the line (processing sixty-four lines, skipping sixty-four lines);
RP13为……行(跳过六十四行,处理六十四行)的行极性;RP13 is the row polarity of the line (skip sixty-four lines, processing sixty-four lines);
RP14为……行(处理一百二十八行,跳过一百二十八行)的行极性; RP14 is the row polarity of the line (handling one hundred and twenty-eight lines, skipping one hundred and twenty-eight lines);
RP15为……行(跳过一百二十八行,处理一百二十八行)的行极性;RP15 is the line polarity of the line (skip one hundred and twenty-eight lines, handle one hundred and twenty-eight lines);
其中,RP0=[Byte0]^[Byte2]^[Byte4]^[Byte6]^......^[Byte252]^[Byte254],^表示异或的运算,[Byte0]表示第0行的8个Bit异或的结果,[Byte2]表示第2行的8个Bit异或的结果,等等。Where RP0=[Byte0]^[Byte2]^[Byte4]^[Byte6]^......^[Byte252]^[Byte254], ^ represents the operation of XOR, [Byte0] represents the 0th line The result of 8 Bit XOR, [Byte2] represents the result of the 8 Bit XOR of the 2nd line, and so on.
以此类推,可以求得RP1~RP15。假设ECC_RP表示ECC码的行校验码,则ECC_RP={RP15,RP14,……,RP3,RP2,RP1,RP0}。By analogy, RP1 ~ RP15 can be obtained. Assuming that ECC_RP indicates the row check code of the ECC code, ECC_RP = {RP15, RP14, ..., RP3, RP2, RP1, RP0}.
综上所述,ECC码包括列校验码ECC_CP与行校验码ECC_RP,在存储介质的ECC校验过程中,在写数据时需要以256字节的数据块为单位写入数据,即每写入256字节的数据便计算一个ECC码,同理在读数据时需要以256字节的数据块为单位读取数据,即每读取256字节的数据便计算一个ECC码。然而,如NOR Flash等随机读写方式的存储介质,在读写数据的时候是以1字节为单位进行随机读写的,其中一个优点是可以对256字节以下的小数据进行随意读写,若直接向随机读写方式的存储介质引入ECC校验,那么该优点将不复存在。In summary, the ECC code includes a column check code ECC_CP and a row check code ECC_RP. In the ECC check process of the storage medium, when writing data, it is necessary to write data in units of 256-byte data blocks, that is, each When an 256-byte data is written, an ECC code is calculated. Similarly, when reading data, it is necessary to read data in units of 256-byte data blocks, that is, an ECC code is calculated every time 256-byte data is read. However, a random read/write storage medium such as NOR Flash performs random read and write in units of 1 byte when reading and writing data. One of the advantages is that small data of 256 bytes or less can be read and written at will. If an ECC check is directly introduced into a random read/write storage medium, the advantage will no longer exist.
图1是本发明实施例中一种更新ECC码的方法的流程示意图,该方法应用于存储介质的数据写入过程,所述存储介质包括多个存储块,可选的,本发明实施例中,设定存储块为256个字节的存储空间。如图所示本实施例中的更新ECC码的方法的流程可以包括:1 is a schematic flowchart of a method for updating an ECC code according to an embodiment of the present invention. The method is applied to a data writing process of a storage medium, where the storage medium includes a plurality of storage blocks, optionally, in the embodiment of the present invention. Set the storage block to 256 bytes of storage space. The flow of the method for updating the ECC code in this embodiment as shown in the figure may include:
S101,获取每个存储块中总数据的ECC码。S101. Obtain an ECC code of total data in each storage block.
具体的,可以通过上文介绍的ECC码的计算方法,计算出每个存储块中256字节的数据对应的ECC码。可选的,若本地已记录有最近一次写入数据后计算得到的ECC码,或者其它情况下最新计算得到的ECC码,则直接查找到该ECC码,而不必再次计算。需要指出的是,获取每个存储块中总数据的ECC码的目的在于,后续向存储介质随机写入数据时,可以通过修改该ECC码来得到新的ECC码。Specifically, the ECC code corresponding to the 256-byte data in each memory block can be calculated by the calculation method of the ECC code introduced above. Optionally, if the ECC code calculated after the last data write is recorded locally, or the newly calculated ECC code in other cases, the ECC code is directly found, and does not need to be calculated again. It should be noted that the purpose of obtaining the ECC code of the total data in each memory block is to obtain a new ECC code by modifying the ECC code when the data is randomly written to the storage medium.
S102,当向所述存储介质随机写入一字节的数据时,获取写入的数据、所述数据被写入的存储空间的位置以及所述存储空间在写入所述数据之前所存储的原始数据。 S102, when randomly writing one byte of data to the storage medium, acquiring the written data, the location of the storage space where the data is written, and the storage space before the writing of the data by the storage space Raw data.
需要指出的是,这里只介绍了写入一字节的数据的情况,但应理解在数据写入过程,一般是写入多个字节的数据的情况,针对这种情况,只需以一字节的方式分别执行多次即可。It should be pointed out that only the case of writing one byte of data is introduced here, but it should be understood that in the case of data writing, generally, data of multiple bytes is written. For this case, only one The byte mode can be executed multiple times.
具体的,当向存储介质随机写入一字节的数据时,获取写入的数据、数据被写入的存储空间的位置以及该存储空间在写入数据之前所存储的原始数据。其中,所述存储空间的位置用以确定存储空间所属的存储块,可选的,所述存储空间的位置可以是存储地址,也可以是字节的序号。以存储空间的位置是字节的序号为例:假设向存储介质随机写入的数据为0xF0,数据被写入的存储空间对应的字节的序号为Byte9,且该存储空间在写入数据前所存储的原始数据为0x31,则获取的信息为0xF0、Byte9和0x31,进一步的,假设Byte 0~Byte255属于第一存储块,由于Byte9落在Byte 0~Byte 255这个区间,则可以确定数据被写入的存储空间属于第一存储块。Specifically, when one byte of data is randomly written to the storage medium, the written data, the location of the storage space where the data is written, and the original data stored by the storage space before the data is written are acquired. The location of the storage space is used to determine a storage block to which the storage space belongs. Optionally, the location of the storage space may be a storage address or a serial number of a byte. Take the serial number of the storage space as an example: assume that the data randomly written to the storage medium is 0xF0, and the byte corresponding to the storage space to which the data is written is Byte9, and the storage space is before the data is written. If the stored original data is 0x31, the obtained information is 0xF0, Byte9, and 0x31. Further, it is assumed that Byte 0 to Byte255 belong to the first storage block, and since Byte9 falls in the interval of Byte 0 to Byte 255, it can be determined that the data is The written storage space belongs to the first storage block.
S103,通过对所述写入的数据的ECC码的列校验码、所述原始数据的ECC码的列校验码和所述存储空间所属的存储块中总数据的ECC码的列校验码进行逻辑运算,得到写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码,以及根据所述写入的数据和所述原始数据,修改所述存储空间所属的存储块中总数据的ECC码的行校验码。S103, a column check code of an ECC code of the written data, a column check code of an ECC code of the original data, and a column check of an ECC code of a total data in a storage block to which the storage space belongs The code performs a logical operation to obtain a column check code of the ECC code of the total data in the storage block to which the storage space belongs after writing the one-byte data, and is modified according to the written data and the original data. A row check code of an ECC code of total data in a storage block to which the storage space belongs.
具体的,由上文可知ECC码包括列校验码和行校验码,因此需根据写入的数据和原始数据,分别修改被写入的字节所属的存储块中总数据的ECC码的列校验码和ECC码的行校验码。Specifically, it can be seen from the above that the ECC code includes a column check code and a row check code, so it is necessary to separately modify the ECC code of the total data in the storage block to which the written byte belongs according to the written data and the original data. The row check code of the column check code and the ECC code.
首先,修改ECC码的列校验码的方法可以是:通过对写入的数据的ECC码的列校验码、原始数据的ECC码的列校验码和存储空间所属的存储块中总数据的ECC码的列校验码进行逻辑运算,得到写入一字节的数据后的存储空间所属的存储块中总数据的ECC码的列校验码。具体实现流程为:First, the method of modifying the column check code of the ECC code may be: a column check code of the ECC code of the written data, a column check code of the ECC code of the original data, and a total data in the storage block to which the storage space belongs. The column check code of the ECC code performs a logical operation to obtain a column check code of the ECC code of the total data in the memory block to which the storage space to which the one-byte data is written. The specific implementation process is:
步骤1,计算写入的数据的ECC码的列校验码,以及原始数据的ECC码的列校验码。Step 1. Calculate the column check code of the ECC code of the written data, and the column check code of the ECC code of the original data.
例如:假设写入的数据为0xF0,原始数据为0x31,Data_ECC_CP表示写入的数据的ECC码的列校验码,Buf_ECC_CP表示原始数据的ECC码的列校验码,则通过上述ECC码的计算方法,可计算得Data_ECC_CP={0,0,0,0,0}, Buf_ECC_CP={0,1,0,1,1,0}。For example, it is assumed that the written data is 0xF0, the original data is 0x31, Data_ECC_CP indicates the column check code of the ECC code of the written data, and Buf_ECC_CP indicates the column check code of the ECC code of the original data, and the calculation of the above ECC code is performed. Method, you can calculate Data_ECC_CP={0,0,0,0,0}, Buf_ECC_CP={0,1,0,1,1,0}.
步骤2,根据公式
Figure PCTCN2016091840-appb-000008
计算写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码。
Step 2, according to the formula
Figure PCTCN2016091840-appb-000008
A column check code of an ECC code of total data in a memory block to which the storage space to which the one-byte data is written is calculated.
其中,
Figure PCTCN2016091840-appb-000009
表示修改后的总数据的ECC码的列校验码,ECC_CP表示修改前的总数据的ECC码的列校验码,^表示按位异或的运算。
among them,
Figure PCTCN2016091840-appb-000009
A column check code indicating an ECC code of the modified total data, ECC_CP indicates a column check code of the ECC code of the total data before the modification, and ^ indicates a bitwise exclusive OR operation.
例如:假设Data_ECC_CP={0,0,0,0,0},Buf_ECC_CP={0,1,0,1,1,0},
Figure PCTCN2016091840-appb-000010
Figure PCTCN2016091840-appb-000011
For example: suppose Data_ECC_CP={0,0,0,0,0}, Buf_ECC_CP={0,1,0,1,1,0},
Figure PCTCN2016091840-appb-000010
then
Figure PCTCN2016091840-appb-000011
这里简单介绍下上述公式的原理:通过分析ECC码的计算方法可知,ECC_CP可以表示成ECC_CP=Byte0_ECC_CP^Byte1_ECC_CP^......^Byte255_ECC_CP的形式,将其简化为ECC_CP=X^Byte9_ECC_CP=X^Buf_ECC_CP(假设Byte 9为被写入的存储空间),又由于ECC_CP^Buf_ECC_CP=X^Buf_ECC_CP^Buf_ECC_CP=X,则
Figure PCTCN2016091840-appb-000012
可见,
Figure PCTCN2016091840-appb-000013
中已经更新了Byte9在写入前和写入后的数据。
Here is a brief introduction to the principle of the above formula: By analyzing the calculation method of the ECC code, the ECC_CP can be expressed in the form of ECC_CP=Byte0_ECC_CP^Byte1_ECC_CP^...^Byte255_ECC_CP, which is simplified to ECC_CP=X^Byte9_ECC_CP=X ^Buf_ECC_CP (assuming Byte 9 is the storage space to be written), and since ECC_CP^Buf_ECC_CP=X^Buf_ECC_CP^Buf_ECC_CP=X, then
Figure PCTCN2016091840-appb-000012
visible,
Figure PCTCN2016091840-appb-000013
The data of Byte9 before and after writing has been updated.
其次,修改ECC码的行校验码的方法可以是:根据写入的数据和原始数据,修改存储空间所属的存储块中总数据的ECC码的行校验码。具体实现流程为:Secondly, the method for modifying the row check code of the ECC code may be: modifying the row check code of the ECC code of the total data in the storage block to which the storage space belongs according to the written data and the original data. The specific implementation process is:
步骤1,确定写入的数据的奇偶性,以及原始数据的奇偶性。Step 1. Determine the parity of the written data and the parity of the original data.
具体实现过程中,分别对两个数据的各Bit位进行异或,若异或结果为0,则奇偶性为偶,若异或结果为1,则为奇偶性为奇。例如:假设写入的数据为0xF0(={1,1,1,1,0,0,0,0}),原始数据为0x31(={0,0,1,1,0,0,0,1}),则对于0xF0,异或结果为1^1^1^1^0^0^0^0=0,其奇偶性为偶,对于0x31,异或结果为0^0^1^1^0^0^0^1=1,其奇偶性为奇。In the specific implementation process, the bit bits of the two data are XORed respectively. If the XOR result is 0, the parity is even. If the XOR result is 1, the parity is odd. For example: suppose the data written is 0xF0 (={1,1,1,1,0,0,0,0}), the original data is 0x31 (={0,0,1,1,0,0,0 , 1}), then for 0xF0, the XOR result is 1^1^1^1^0^0^0^0=0, its parity is even, for 0x31, the XOR result is 0^0^1^ 1^0^0^0^1=1, whose parity is odd.
步骤2,判断写入的数据的奇偶性与原始数据的奇偶性是否相同。In step 2, it is judged whether the parity of the written data is the same as the parity of the original data.
步骤3,若相同,则不修改总数据的ECC码的行校验码;若不同,则确定在总数据的ECC码的行校验码中,与被写入的字节中数据关联的比特位,并对其进行反转。 Step 3: If they are the same, the row check code of the ECC code of the total data is not modified; if different, the bit associated with the data in the byte to be written is determined in the row check code of the ECC code of the total data. Bit and reverse it.
一方面,若写入的数据的奇偶性与原始数据奇偶性相同,通过分析ECC码的计算方法可知,写入的数据和原始数据的变化不会对ECC码的行校验码产生影响,故不用修改ECC码的行校验码。On the one hand, if the parity of the written data is the same as the parity of the original data, by analyzing the calculation method of the ECC code, it can be known that the change of the written data and the original data does not affect the row check code of the ECC code, so It is not necessary to modify the row check code of the ECC code.
另一方面,若写入的数据的奇偶性与原始数据奇偶性不相同,则写入的数据和原始数据的变化会对ECC码的行校验码产生影响,故要修改ECC码的行校验码。具体实现过程中,先确定在256个字节的数据对应的ECC码的行校验码中,与被写入的存储空间中数据关联的比特位,其中,关联关系可以通过查阅表2得知,例如ECC码的行校验码中与Byte0关联的比特位为RP0、RP2、RP4、RP6、RP8、RP10、RP12、RP14和RP16;接着对确定的比特位进行反转,其中,反转是指将数据0变为数据1,或将数据1变为数据0,例如:假设ECC_RP表示修改前的ECC码的行校验码,ECC_RP={RP15,RP14,……,RP3,RP2,RP1,RP0}={1,0,0,0,1,1,0,1,1,1,0,0,1,1,0,1},
Figure PCTCN2016091840-appb-000014
表示修改后的ECC码的行校验码,关联的比特位为RP0、RP2、RP4、RP6、RP8、RP10、RP12和RP14,则
Figure PCTCN2016091840-appb-000015
On the other hand, if the parity of the written data is not the same as the parity of the original data, the change of the written data and the original data may affect the row check code of the ECC code, so the line correction of the ECC code is to be modified. Code verification. In the specific implementation process, first determine the bit associated with the data in the written storage space in the row check code of the ECC code corresponding to the 256-byte data, wherein the association relationship can be obtained by referring to Table 2. For example, the bit associated with Byte0 in the row check code of the ECC code is RP0, RP2, RP4, RP6, RP8, RP10, RP12, RP14, and RP16; then the determined bit is inverted, where the inversion is Refers to changing data 0 to data 1, or changing data 1 to data 0. For example, suppose ECC_RP indicates the row check code of the ECC code before modification, ECC_RP={RP15, RP14, ..., RP3, RP2, RP1, RP0}={1,0,0,0,1,1,0,1,1,1,0,0,1,1,0,1},
Figure PCTCN2016091840-appb-000014
Indicates the row check code of the modified ECC code. The associated bits are RP0, RP2, RP4, RP6, RP8, RP10, RP12, and RP14.
Figure PCTCN2016091840-appb-000015
S104,根据所述写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码和修改后的所述存储空间所属的存储块中总数据的ECC码的行校验码,得到更新后的所述存储空间所属的存储块中总数据的ECC码。S104, according to the column check code of the ECC code of the total data in the storage block to which the storage space belongs after the one-byte data is written, and the ECC of the total data in the storage block to which the modified storage space belongs according to the modification The row check code of the code obtains the ECC code of the total data in the storage block to which the updated storage space belongs.
具体的,由于ECC码包括列校验码和行校验码,因而根据写入一字节的数据后的存储块中总数据的ECC码和修改后的存储块中总数据的ECC码的行校验码,可以得到存储块中总数据的ECC码,该ECC码即为更新后的ECC码。Specifically, since the ECC code includes the column check code and the row check code, the ECC code of the total data in the memory block after writing the data of one byte and the line of the ECC code of the total data in the modified memory block are The check code can obtain the ECC code of the total data in the storage block, and the ECC code is the updated ECC code.
由上可见,本发明实施例在向存储介质随机写入数据时,只需对原有的ECC码进行修改即可,解决了现有技术中必须写入256字节的数据到存储块后才能计算ECC码的问题,从而不会破坏存储介质的随机写入性。另外,本发明实施例无需重新计算ECC码,提高了运算效率。It can be seen that, when the data is randomly written to the storage medium, the embodiment of the present invention only needs to modify the original ECC code, and the prior art must write 256 bytes of data to the storage block. The problem of calculating the ECC code is such that the random writeability of the storage medium is not destroyed. In addition, the embodiment of the present invention does not need to recalculate the ECC code, thereby improving the operation efficiency.
图2是本发明实施例中一种校验ECC码的方法的流程示意图,该方法应用于存储介质的数据读取过程,所述存储介质包括多个存储块,所述存储块为 多个字节组成的存储空间,可选的,本发明实施例中,设定存储块为256个字节组成的存储空间。如图所示本实施例中的校验ECC码的方法的流程可以包括:2 is a schematic flowchart of a method for verifying an ECC code according to an embodiment of the present invention. The method is applied to a data reading process of a storage medium, where the storage medium includes a plurality of storage blocks, and the storage block is A storage space composed of a plurality of bytes. Optionally, in the embodiment of the present invention, the storage block is set to a storage space of 256 bytes. The flow of the method for verifying the ECC code in this embodiment as shown in the figure may include:
S201,当向所述存储介质随机读取数据时,对读取的数据进行奇偶校验。S201. Perform parity check on the read data when the data is randomly read to the storage medium.
具体的,对读取的数据进行奇偶校验的方法流程为:Specifically, the method flow for performing parity check on the read data is:
步骤1,计算读取的数据的奇偶校验码。Step 1. Calculate the parity of the read data.
具体实现过程中,计算奇偶校验码的方法是对读取的数据的各Bit位求取异或结果。例如:假设读取的数据为0xF0(={1,1,1,1,0,0,0,0}),则0xF0的奇偶校验码为1^1^1^1^0^0^0^0=0。In the specific implementation process, the method of calculating the parity code is to obtain an XOR result for each bit bit of the read data. For example, if the read data is 0xF0 (={1,1,1,1,0,0,0,0}), the parity of 0xF0 is 1^1^1^1^0^0^ 0^0=0.
步骤2,查询读取的数据所在存储空间在写入数据时保存的奇偶校验码。Step 2: Query the parity code of the storage space where the read data is stored when the data is written.
需要指出的是,存储介质中的每个字节在写入数据时,都会计算该字节对应的存储空间中数据对应的奇偶校验码,并将其保存。具体实现过程中,在读取数据之后,查询读取的数据所在存储空间所保存的奇偶校验码。It should be noted that each byte in the storage medium, when writing data, calculates the parity code corresponding to the data in the storage space corresponding to the byte and saves it. In the specific implementation process, after reading the data, the parity code stored in the storage space where the read data is located is queried.
步骤3,判断计算的奇偶校验码是否与保存的奇偶校验码相同。In step 3, it is judged whether the calculated parity code is the same as the saved parity code.
步骤4,若步骤3判断结果为不相同,则奇偶校验出错;若步骤3判断结果为相同,则奇偶校验未出错。In step 4, if the result of the determination in step 3 is different, the parity error occurs; if the result of the determination in step 3 is the same, the parity is not in error.
一方面,若计算的奇偶校验码与保存的奇偶校验码不相同,则说明存储的数据发生了比特反转,导致写入的是一个数据,读出的是另一个数据,此时执行步骤S202,以进行ECC校验。On the one hand, if the calculated parity code is different from the saved parity code, it indicates that the stored data has a bit inversion, resulting in writing one data and reading another data. Step S202, to perform an ECC check.
另一方面,若计算的奇偶校验码与保存的奇偶校验码相同,则说明存储的数据未出现异常,此时校验结束,无需再执行步骤S202。ECC校验需要读取整个存储块中256个字节的数据以计算ECC码,使得校验效率低下,由此可见,本发明实施例可以避免每次读取数据都要进行ECC校验,保证了校验可靠性的同时提高了校验效率。On the other hand, if the calculated parity code is the same as the stored parity code, it means that the stored data does not have an abnormality, and the verification is completed, and it is not necessary to execute step S202. The ECC check needs to read 256 bytes of data in the entire storage block to calculate the ECC code, so that the check efficiency is low. Therefore, the embodiment of the present invention can avoid ECC check every time the data is read, and ensure that the ECC check is performed. The verification efficiency is improved while the verification efficiency is improved.
作为一种另可选的实施方式,预先将存储块划分为多个子存储块,如将256字节的存储块划分为8个32字节的存储块,当向存储介质随机读取数据时,对读取的数据所在子存储块中的数据进行奇偶校验,奇偶校验的方式与上述方式相似,唯一区别是不用保存每个字节中数据的奇偶校验码,转而保存32个字节中数据的奇偶校验码,减少了需要保存的奇偶校验码的数量。 As an alternative implementation manner, the storage block is divided into a plurality of sub-memory blocks in advance, such as dividing a 256-byte storage block into eight 32-byte storage blocks, when randomly reading data from the storage medium, Perform parity check on the data in the sub-memory block where the read data is located. The parity check is similar to the above method. The only difference is that the parity code of the data in each byte is not saved, and 32 words are saved instead. The parity of the data in the section reduces the number of parity codes that need to be saved.
S202,判断所述奇偶校验是否出错。S202. Determine whether the parity is in error.
具体的,若奇偶校验出错,则执行步骤S203。Specifically, if the parity is in error, step S203 is performed.
S203,对所述读取的数据所在存储空间所属的存储块中总数据进行ECC码校验。S203. Perform ECC code verification on the total data in the storage block to which the stored data of the read data belongs.
具体的,对读取的数据所在存储空间所属的存储块中总数据进行ECC码校验的方法流程为:Specifically, the method for performing ECC code verification on the total data in the storage block to which the stored data belongs is:
步骤1,计算读取的数据所在存储空间所属的存储块中总数据的ECC码。Step 1: Calculate the ECC code of the total data in the storage block to which the storage space of the read data belongs.
具体实现过程中,确定读取的数据所在存储空间所属的存储块,再读取该存储块中256字节的数据,计算256字节的数据对应的ECC码。In the specific implementation process, the storage block to which the stored data is located is determined, and then 256 bytes of data in the storage block are read, and the ECC code corresponding to the 256-byte data is calculated.
步骤2,查询读取的数据所在存储空间所属的存储块在写入数据时保存的奇偶校验码。Step 2: Query the parity code saved when the storage block to which the read data belongs is written in the data.
需要指出的是,存储介质中的每个存储块在写入数据时,都会计算该存储块中256字节的数据对应的奇偶校验码,并将其保存。具体实现过程中,在读取数据之后,查询读取的数据所在存储空间所属的存储块对应保存的奇偶校验码。It should be noted that each memory block in the storage medium calculates the parity code corresponding to the 256-byte data in the storage block when the data is written, and saves it. In the specific implementation process, after the data is read, the storage block to which the storage space in which the read data belongs is corresponding to the saved parity code.
步骤3,通过将计算的ECC码与保存的ECC码进行比较,确定读取的数据中发生比特反转的比特位,并对其进行反转,其中,所述反转是指将数据0变为数据1,或将数据1变为数据0。Step 3, by comparing the calculated ECC code with the saved ECC code, determining a bit bit in the read data, and inverting the bit, wherein the inversion refers to changing the data 0 Is data 1, or data 1 is changed to data 0.
应理解的,ECC校验可以确定出错的比特位,具体确定方法这里不做赘述。例如:假设读取的数据为0xF0(={1,1,1,1,0,0,0,0}),确定发生比特反转的比特位为Bit0,则纠正后的数据为0xF1(={1,1,1,1,0,0,0,1})。It should be understood that the ECC check can determine the bit of the error, and the specific determination method is not described herein. For example, if the read data is 0xF0 (={1,1,1,1,0,0,0,0}), it is determined that the bit inversion is Bit0, then the corrected data is 0xF1 (= {1,1,1,1,0,0,0,1}).
由上可见,本发明实施例在向存储介质随机读取数据时,先对读取的数据进行奇偶校验,只有在奇偶校验出错时才进一步进行ECC校验,避免了每次读取数据都要进行ECC校验,保证了校验可靠性的同时提高了校验效率。It can be seen that, when the data is randomly read from the storage medium, the embodiment of the present invention first performs parity check on the read data, and performs ECC check only when the parity error occurs, thereby avoiding reading data every time. ECC verification is required to ensure the verification reliability and improve the verification efficiency.
图3是本发明实施例中一种更新ECC码的装置的结构示意图。本发明装置用于实现图1提供的更新ECC码的方法。如图所示本发明实施例中的更新ECC码的装置至少可以包括ECC码获取模块310、数据获取模块320、行列码修改模块330以及ECC码更新模块340,其中: FIG. 3 is a schematic structural diagram of an apparatus for updating an ECC code according to an embodiment of the present invention. The apparatus of the present invention is for implementing the method of updating the ECC code provided in FIG. The device for updating the ECC code in the embodiment of the present invention may include at least an ECC code acquisition module 310, a data acquisition module 320, a row and column code modification module 330, and an ECC code update module 340, where:
ECC码获取模块310,用于获取每个所述存储块中总数据的ECC码,所述ECC码包括列校验码和行校验码。The ECC code obtaining module 310 is configured to obtain an ECC code of total data in each of the storage blocks, where the ECC code includes a column check code and a row check code.
具体的,可以通过上文介绍的ECC码的计算方法,计算出每个存储块中256字节的数据对应的ECC码。可选的,若本地已记录有最近一次写入数据后计算得到的ECC码,或者其它情况下最新计算得到的ECC码,则直接查找到该ECC码,而不必再次计算。需要指出的是,获取每个存储块中总数据的ECC码的目的在于,后续向存储介质随机写入数据时,可以通过修改该ECC码来得到新的ECC码。Specifically, the ECC code corresponding to the 256-byte data in each memory block can be calculated by the calculation method of the ECC code introduced above. Optionally, if the ECC code calculated after the last data write is recorded locally, or the newly calculated ECC code in other cases, the ECC code is directly found, and does not need to be calculated again. It should be noted that the purpose of obtaining the ECC code of the total data in each memory block is to obtain a new ECC code by modifying the ECC code when the data is randomly written to the storage medium.
数据获取模块320,用于当向所述存储介质随机写入一字节的数据时,获取写入的数据、所述数据被写入的存储空间的位置以及所述存储空间在写入所述数据之前所存储的原始数据。The data obtaining module 320 is configured to acquire, when the data is randomly written to the storage medium, the written data, the location of the storage space where the data is written, and the storage space is written in the Raw data stored before the data.
其中,所述存储空间的位置用以确定所述存储空间所属的存储块,可选的,所述存储空间的位置可以是存储地址,也可以是字节的序号。以存储空间的位置是字节的序号为例:假设向存储介质随机写入的数据为0xF0,数据被写入的存储空间对应的字节的序号为Byte9,且该存储空间在写入数据前所存储的原始数据为0x31,则获取的信息为0xF0、Byte9和0x31,进一步的,假设Byte0~Byte 255属于第一存储块,由于Byte9落在Byte 0~Byte 255这个区间,则可以确定数据被写入的存储空间属于第一存储块。The location of the storage space is used to determine a storage block to which the storage space belongs. Optionally, the location of the storage space may be a storage address or a serial number of a byte. Take the serial number of the storage space as an example: assume that the data randomly written to the storage medium is 0xF0, and the byte corresponding to the storage space to which the data is written is Byte9, and the storage space is before the data is written. If the stored original data is 0x31, the obtained information is 0xF0, Byte9, and 0x31. Further, it is assumed that Byte0~Byte 255 belong to the first storage block, and since Byte9 falls in the interval of Byte 0 to Byte 255, it can be determined that the data is The written storage space belongs to the first storage block.
行列码修改模块330,用于通过对所述写入的数据的ECC码的列校验码、所述原始数据的ECC码的列校验码和所述存储空间所属的存储块中总数据的ECC码的列校验码进行逻辑运算,得到写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码,以及根据所述写入的数据和所述原始数据,修改所述存储空间所属的存储块中总数据的ECC码的行校验码。具体实现中,行列码修改模块330可以如图4所示进一步包括列码计算单元331、列码修改单元332、奇偶性确定单元333以及行码修改单元334,其中:a lining code modification module 330, configured to pass a column check code of an ECC code of the written data, a column check code of an ECC code of the original data, and total data in a storage block to which the storage space belongs The column check code of the ECC code performs a logical operation to obtain a column check code of the ECC code of the total data in the memory block to which the storage space belongs after writing the one-byte data, and according to the written data and The original data modifies a row check code of an ECC code of total data in a storage block to which the storage space belongs. In a specific implementation, the row and column code modification module 330 may further include a column code calculation unit 331, a column code modification unit 332, a parity determination unit 333, and a row code modification unit 334 as shown in FIG. 4, wherein:
列码计算单元331,用于计算所述写入的数据的ECC码的列校验码,以及所述原始数据的ECC码的列校验码。The column code calculation unit 331 is configured to calculate a column check code of the ECC code of the written data, and a column check code of the ECC code of the original data.
具体实现过程中,计算写入的数据的ECC码的列校验码,以及原始数据的ECC码的列校验码;根据公式
Figure PCTCN2016091840-appb-000016
计算写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码。
In the specific implementation process, the column check code of the ECC code of the written data is calculated, and the column check code of the ECC code of the original data; according to the formula
Figure PCTCN2016091840-appb-000016
A column check code of an ECC code of total data in a memory block to which the storage space to which the one-byte data is written is calculated.
其中,
Figure PCTCN2016091840-appb-000017
表示修改后的总数据的ECC码的列校验码,ECC_CP表示修改前的总数据的ECC码的列校验码,^表示按位异或的运算。
among them,
Figure PCTCN2016091840-appb-000017
A column check code indicating an ECC code of the modified total data, ECC_CP indicates a column check code of the ECC code of the total data before the modification, and ^ indicates a bitwise exclusive OR operation.
列码修改单元332,用于根据
Figure PCTCN2016091840-appb-000018
计算写入一字节的数据后的所述字节对应的存储空间所属的存储块中总数据的ECC码的列校验码,其中,所述
Figure PCTCN2016091840-appb-000019
表示计算后的所述总数据的ECC码的列校验码,所述ECC_CP表示计算前的所述总数据的ECC码的列校验码,所述Data_ECC_CP表示所述写入的数据的ECC码的列校验码,所述Buf_ECC_CP表示所述原始数据的ECC码的列校验码,所述^表示按位异或的运算。
a column code modification unit 332 for
Figure PCTCN2016091840-appb-000018
Calculating a column check code of an ECC code of total data in a storage block to which the storage space corresponding to the byte corresponding to the one byte of data is written, wherein
Figure PCTCN2016091840-appb-000019
a column check code indicating an ECC code of the calculated total data, the ECC_CP indicating a column check code of an ECC code of the total data before calculation, and the Data_ECC_CP indicating an ECC code of the written data Column check code, the Buf_ECC_CP represents a column check code of the ECC code of the original data, and the ^ represents a bitwise exclusive OR operation.
奇偶性确定单元333,用于确定所述写入的数据的奇偶性,以及所述原始数据的奇偶性。The parity determining unit 333 is configured to determine a parity of the written data and a parity of the original data.
具体实现过程中,分别对两个数据的各Bit位进行异或,若异或结果为0,则奇偶性为偶,若异或结果为1,则为奇偶性为奇。In the specific implementation process, the bit bits of the two data are XORed respectively. If the XOR result is 0, the parity is even. If the XOR result is 1, the parity is odd.
行码修改单元334,用于判断所述写入的数据的奇偶性与所述原始数据的奇偶性是否相同,若是,则不修改所述总数据的ECC码的行校验码;若否,则确定在所述总数据的ECC码的行校验码中,与所述被写入的字节中数据关联的比特位,并对其进行反转,其中,所述反转是指将数据0变为数据1,或将数据1变为数据0。The line code modification unit 334 is configured to determine whether the parity of the written data is the same as the parity of the original data, and if yes, the row check code of the ECC code of the total data is not modified; if not, Determining, in the row check code of the ECC code of the total data, a bit associated with the data in the written byte, and inverting it, wherein the inversion refers to the data 0 becomes data 1, or data 1 becomes data 0.
一方面,若写入的数据的奇偶性与原始数据奇偶性相同,通过分析ECC码的计算方法可知,写入的数据和原始数据的变化不会对ECC码的行校验码产生影响,故不用修改ECC码的行校验码。On the one hand, if the parity of the written data is the same as the parity of the original data, by analyzing the calculation method of the ECC code, it can be known that the change of the written data and the original data does not affect the row check code of the ECC code, so It is not necessary to modify the row check code of the ECC code.
另一方面,若写入的数据的奇偶性与原始数据奇偶性不相同,则写入的数据和原始数据的变化会对ECC码的行校验码产生影响,故要修改ECC码的行校验码。具体实现过程中,先确定在256个字节的数据对应的ECC码的行校验码中,与被写入的存储空间中数据关联的比特位,其中,关联关系可以通过查阅表2得知,例如ECC码的行校验码中与Byte0关联的比特位为RP0、RP2、RP4、RP6、RP8、RP10、RP12、RP14和RP16;接着对确定的比特位进行反转,其中,反转是指将数据0变为数据1,或将数据1变为数据0。 On the other hand, if the parity of the written data is not the same as the parity of the original data, the change of the written data and the original data may affect the row check code of the ECC code, so the line correction of the ECC code is to be modified. Code verification. In the specific implementation process, first determine the bit associated with the data in the written storage space in the row check code of the ECC code corresponding to the 256-byte data, wherein the association relationship can be obtained by referring to Table 2. For example, the bit associated with Byte0 in the row check code of the ECC code is RP0, RP2, RP4, RP6, RP8, RP10, RP12, RP14, and RP16; then the determined bit is inverted, where the inversion is Refers to changing data 0 to data 1, or changing data 1 to data 0.
ECC码更新模块340,用于根据所述写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码和修改后的所述存储空间所属的存储块中总数据的ECC码的行校验码,得到更新后的所述存储空间所属的存储块中总数据的ECC码。The ECC code update module 340 is configured to: according to the column check code of the ECC code of the total data in the storage block to which the storage space belongs after the one-byte data is written, and the modified storage of the storage space The row check code of the ECC code of the total data in the block obtains the ECC code of the total data in the memory block to which the updated storage space belongs.
具体的,由于ECC码包括列校验码和行校验码,因而根据写入一字节的数据后的存储块中总数据的ECC码和修改后的存储块中总数据的ECC码的行校验码,可以得到存储块中总数据的ECC码,该ECC码即为更新后的ECC码。Specifically, since the ECC code includes the column check code and the row check code, the ECC code of the total data in the memory block after writing the data of one byte and the line of the ECC code of the total data in the modified memory block are The check code can obtain the ECC code of the total data in the storage block, and the ECC code is the updated ECC code.
图5是本发明实施例中一种校验ECC码的装置的结构示意图。本发明装置用于实现图2提供的校验ECC码的方法。如图所示本发明实施例中的校验ECC码的装置至少可以包括奇偶校验模块510、校验判断模块520以及ECC码校验模块530,其中:FIG. 5 is a schematic structural diagram of an apparatus for verifying an ECC code according to an embodiment of the present invention. The apparatus of the present invention is for implementing the method of verifying an ECC code provided in FIG. The device for verifying the ECC code in the embodiment of the present invention may include at least a parity check module 510, a check judging module 520, and an ECC code check module 530, where:
奇偶校验模块510,用于当向所述存储介质随机读取数据时,对读取的数据进行奇偶校验。具体实现中,奇偶校验模块510可以如图6所示进一步包括第一计算单元511、第一查询单元512和码值判断单元513,其中:The parity check module 510 is configured to perform parity check on the read data when the data is randomly read to the storage medium. In a specific implementation, the parity check module 510 may further include a first calculating unit 511, a first query unit 512, and a code value determining unit 513 as shown in FIG. 6, wherein:
第一计算单元511,用于计算所述读取的数据的奇偶校验码。The first calculating unit 511 is configured to calculate a parity code of the read data.
具体实现过程中,计算奇偶校验码的方法是对读取的数据的各Bit位求取异或结果。In the specific implementation process, the method of calculating the parity code is to obtain an XOR result for each bit bit of the read data.
第一查询单元512,用于查询所述读取的数据所在存储空间在写入数据时保存的奇偶校验码。The first query unit 512 is configured to query a parity code saved when the read data is stored in the storage space.
需要指出的是,存储介质中的每个存储空间在写入数据时,都会计算该存储空间中数据对应的奇偶校验码,并将其保存。具体实现过程中,在读取数据之后,查询读取的数据所在存储空间对应保存的奇偶校验码。It should be noted that each storage space in the storage medium calculates the parity code corresponding to the data in the storage space when the data is written, and saves it. In the specific implementation process, after the data is read, the storage space of the read data is queried corresponding to the saved parity code.
码值判断单元513,用于判断计算的奇偶校验码是否与所述保存的奇偶校验码相同;若否,则所述奇偶校验出错;若是,则所述奇偶校验未出错。The code value determining unit 513 is configured to determine whether the calculated parity code is the same as the saved parity code; if not, the parity error occurs; if yes, the parity is not erroneous.
一方面,若计算的奇偶校验码与保存的奇偶校验码不相同,则说明存储的数据发生了比特反转,导致写入的是一个数据,读出的是另一个数据,此时触发ECC码校验模块530,以进行ECC校验。 On the one hand, if the calculated parity code is different from the saved parity code, it indicates that the stored data has a bit inversion, resulting in writing one data, and reading another data, which is triggered at this time. The ECC code check module 530 performs ECC check.
另一方面,若计算的奇偶校验码与保存的奇偶校验码相同,则说明存储的数据未出现异常,此时校验结束,无需再触发ECC码校验模块530。ECC校验需要读取整个存储块中256个字节的数据以计算ECC码,使得校验效率低下,由此可见,本发明实施例可以避免每次读取数据都要进行ECC校验,保证了校验可靠性的同时提高了校验效率。On the other hand, if the calculated parity code is the same as the saved parity code, it means that the stored data does not have an abnormality, and the verification ends, and the ECC code verification module 530 does not need to be triggered. The ECC check needs to read 256 bytes of data in the entire storage block to calculate the ECC code, so that the check efficiency is low. Therefore, the embodiment of the present invention can avoid ECC check every time the data is read, and ensure that the ECC check is performed. The verification efficiency is improved while the verification efficiency is improved.
校验判断模块520,用于判断所述奇偶校验是否出错。The verification determining module 520 is configured to determine whether the parity is in error.
ECC码校验模块530,用于当所述校验判断模块判定所述奇偶校验出错时,对所述读取的数据所在存储空间所属的存储块中总数据进行ECC码校验。具体实现中,ECC码校验模块530可以如图7所示进一步包括第二计算单元531、第二查询单元532和比特反转单元533,其中:The ECC code verification module 530 is configured to perform ECC code verification on the total data in the storage block to which the storage space of the read data belongs when the parity determination module determines that the parity error occurs. In a specific implementation, the ECC code verification module 530 may further include a second calculation unit 531, a second query unit 532, and a bit inversion unit 533 as shown in FIG. 7, wherein:
第二计算单元531,用于计算所述读取的数据所在存储空间所属的存储块中总数据的ECC码。The second calculating unit 531 is configured to calculate an ECC code of the total data in the storage block to which the storage space of the read data belongs.
具体实现过程中,确定读取的数据所在存储空间所属的存储块,再读取该存储块中256字节的数据,计算256字节的数据对应的ECC码。In the specific implementation process, the storage block to which the stored data is located is determined, and then 256 bytes of data in the storage block are read, and the ECC code corresponding to the 256-byte data is calculated.
第二查询单元532,用于查询所述读取的数据所在存储空间所属的存储块在写入数据时保存的奇偶校验码。The second query unit 532 is configured to query a parity code that is saved when the storage block to which the read data belongs is written in the data.
需要指出的是,存储介质中的每个存储块在写入数据时,都会计算该存储块中256字节的数据对应的奇偶校验码,并将其保存。具体实现过程中,在读取数据之后,查询读取的数据所在存储空间所属的存储块对应保存的奇偶校验码。It should be noted that each memory block in the storage medium calculates the parity code corresponding to the 256-byte data in the storage block when the data is written, and saves it. In the specific implementation process, after the data is read, the storage block to which the storage space in which the read data belongs is corresponding to the saved parity code.
比特反转单元533,用于通过将计算的所述ECC码与所述保存的ECC码进行比较,确定所述读取的数据中发生比特反转的比特位,并对其进行反转,其中,所述反转是指将数据0变为数据1,或将数据1变为数据0。a bit inverting unit 533, configured to determine, by comparing the calculated ECC code with the saved ECC code, a bit in which bit inversion occurs in the read data, and invert it, wherein The inversion refers to changing data 0 to data 1, or changing data 1 to data 0.
图8是本发明实施例中的一种存储设备的结构示意图,如图8所示,存储设备可以包括:至少一个处理器801,例如CPU,至少一个通信总线802,至少一个存储介质803,存储器804,输入输出接口805。其中,通信总线802用于实现这些组件之间的连接通信。存储介质803包括多个虚拟的存储块,存储块为多个字节的存储空间。存储器804可以是高速RAM存储器,也可以是 非易失的存储器(non-volatile memory),例如至少一个磁盘存储器。输入输出接口805用于向外部设备提供访问的接口,以读写数据。可选的,存储器804还可以是至少一个位于远离前述处理器801的存储装置。存储器804中存储一组程序代码。FIG. 8 is a schematic structural diagram of a storage device according to an embodiment of the present invention. As shown in FIG. 8, the storage device may include: at least one processor 801, such as a CPU, at least one communication bus 802, at least one storage medium 803, and a memory. 804, input and output interface 805. Among them, the communication bus 802 is used to implement connection communication between these components. The storage medium 803 includes a plurality of virtual storage blocks, and the storage block is a storage space of a plurality of bytes. The memory 804 can be a high speed RAM memory or can be Non-volatile memory, such as at least one disk storage. The input/output interface 805 is used to provide an interface for accessing an external device to read and write data. Optionally, the memory 804 may also be at least one storage device located away from the foregoing processor 801. A set of program codes is stored in the memory 804.
其中,在存储介质803的数据写入过程,处理器801用于调用存储器804中存储的程序代码,执行以下操作:Wherein, in the data writing process of the storage medium 803, the processor 801 is configured to call the program code stored in the memory 804, and perform the following operations:
获取每个所述存储块中总数据的ECC码,所述ECC码包括列校验码和行校验码;Obtaining an ECC code of total data in each of the storage blocks, where the ECC code includes a column check code and a row check code;
当向所述存储介质随机写入一字节的数据时,获取写入的数据、所述数据被写入的存储空间的位置以及所述存储空间在写入所述数据之前所存储的原始数据,其中,所述存储空间的位置用以确定存储空间所属的存储块;When a byte of data is randomly written to the storage medium, the written data, the location of the storage space where the data is written, and the original data stored by the storage space before the data is written are acquired. Wherein the location of the storage space is used to determine a storage block to which the storage space belongs;
通过对所述写入的数据的ECC码的列校验码、所述原始数据的ECC码的列校验码和所述存储空间所属的存储块中总数据的ECC码的列校验码进行逻辑运算,得到写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码,以及根据所述写入的数据和所述原始数据,修改所述存储空间所属的存储块中总数据的ECC码的行校验码;And performing, by using a column check code of the ECC code of the written data, a column check code of the ECC code of the original data, and a column check code of an ECC code of the total data in the storage block to which the storage space belongs. a logical operation of obtaining a column check code of an ECC code of total data in a storage block to which the storage space belongs after writing one-byte data, and modifying the data according to the written data and the original data a row check code of the ECC code of the total data in the storage block to which the storage space belongs;
根据所述写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码和修改后的所述存储空间所属的存储块中总数据的ECC码的行校验码,得到更新后的所述存储空间所属的存储块中总数据的ECC码。a column check code of the ECC code of the total data in the memory block to which the storage space belongs after the one-byte data is written, and an ECC code of the total data in the memory block to which the modified storage space belongs The check code is obtained, and the ECC code of the total data in the storage block to which the updated storage space belongs is obtained.
可选的,处理器801通过对所述写入的数据的ECC码的列校验码、所述原始数据的ECC码的列校验码和所述存储空间所属的存储块中总数据的ECC码的列校验码进行逻辑运算,得到写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码的具体操作为:Optionally, the processor 801 passes the column check code of the ECC code of the written data, the column check code of the ECC code of the original data, and the ECC of the total data in the storage block to which the storage space belongs. The column check code of the code performs a logical operation, and the specific operation of the column check code of the ECC code of the total data in the storage block to which the storage space belongs after the data of one byte is written is:
计算所述写入的数据的ECC码的列校验码,以及所述原始数据的ECC码的列校验码;Calculating a column check code of the ECC code of the written data, and a column check code of the ECC code of the original data;
根据公式
Figure PCTCN2016091840-appb-000020
计算写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码,其中,所述
Figure PCTCN2016091840-appb-000021
表示计算后的所述总数据的ECC码的列校验码,所述ECC_CP表示计算前的所述总数据的ECC码的列校验码,所述Data_ECC_CP表示所述写入 的数据的ECC码的列校验码,所述Buf_ECC_CP表示所述原始数据的ECC码的列校验码,所述^表示按位异或的运算。
According to the formula
Figure PCTCN2016091840-appb-000020
Calculating a column check code of an ECC code of total data in a storage block to which the storage space belongs after writing one-byte data, wherein
Figure PCTCN2016091840-appb-000021
a column check code indicating an ECC code of the calculated total data, the ECC_CP indicating a column check code of an ECC code of the total data before calculation, and the Data_ECC_CP indicating an ECC code of the written data Column check code, the Buf_ECC_CP represents a column check code of the ECC code of the original data, and the ^ represents a bitwise exclusive OR operation.
进一步的,处理器801根据所述写入的数据和所述原始数据,修改所述存储空间所属的存储块中总数据的ECC码的行校验码的具体操作为:Further, the specific operation of the processor 801 to modify the row check code of the ECC code of the total data in the storage block to which the storage space belongs according to the written data and the original data is:
确定所述写入的数据的奇偶性,以及所述原始数据的奇偶性;Determining a parity of the written data and a parity of the original data;
判断所述写入的数据的奇偶性与所述原始数据的奇偶性是否相同;Determining whether the parity of the written data is the same as the parity of the original data;
若是,则不修改所述总数据的ECC码的行校验码;If yes, the row check code of the ECC code of the total data is not modified;
若否,则确定在所述总数据的ECC码的行校验码中,与所述被写入的存储空间中数据关联的比特位,并对其进行反转,其中,所述反转是指将数据0变为数据1,或将数据1变为数据0。If not, determining a bit associated with the data in the written storage space in the row check code of the ECC code of the total data, and inverting, wherein the inversion is Refers to changing data 0 to data 1, or changing data 1 to data 0.
可选的,所述存储块为256个字节的存储空间。Optionally, the storage block is 256 bytes of storage space.
另外,在存储介质803的数据读取过程,处理器801用于调用存储器804中存储的程序代码,执行以下操作:In addition, in the data reading process of the storage medium 803, the processor 801 is configured to call the program code stored in the memory 804, and performs the following operations:
当通过输入输出接口向所述存储介质随机读取数据时,对读取的数据进行奇偶校验;Parsing the read data when the data is randomly read to the storage medium through the input/output interface;
判断所述奇偶校验是否出错;Determining whether the parity is erroneous;
若是,则对所述读取的数据所在存储空间所属的存储块中总数据进行ECC码校验。If yes, the ECC code is checked for the total data in the storage block to which the stored data of the read data belongs.
可选的,处理器801对读取的数据所在存储空间的数据进行奇偶校验的具体操作为:Optionally, the specific operation of the processor 801 for performing parity check on the data in the storage space where the read data is located is:
计算所述读取的数据的奇偶校验码;Calculating a parity code of the read data;
查询所述读取的数据所在存储空间在写入数据时保存的奇偶校验码;Querying a parity code stored in the storage space of the read data when the data is written;
判断计算的奇偶校验码是否与所述保存的奇偶校验码相同;Determining whether the calculated parity code is the same as the saved parity code;
若否,则所述奇偶校验出错;若是,则所述奇偶校验未出错。If not, the parity error occurs; if so, the parity is not erroneous.
又可选的,处理器801对所述读取的数据所在存储空间所属的存储块中总数据进行ECC码校验的具体操作为:Optionally, the specific operation of the processor 801 to perform ECC code verification on the total data in the storage block to which the read data belongs is:
计算所述读取的数据所在存储空间所属的存储块中总数据的ECC码;Calculating an ECC code of the total data in the storage block to which the storage space of the read data belongs;
查询所述读取的数据所在存储空间所属的存储块在写入数据时保存的奇偶校验码; Querying a parity code saved when the storage block to which the read data belongs is written in the data;
通过将计算的所述ECC码与所述保存的ECC码进行比较,确定所述读取的数据中发生比特反转的比特位,并对其进行反转,其中,所述反转是指将数据0变为数据1,或将数据1变为数据0。Determining a bit inversion in the read data by comparing the calculated ECC code with the saved ECC code, and inverting the bit, wherein the inversion means Data 0 becomes data 1, or data 1 becomes data 0.
又可选的,所述存储块为256个字节的存储空间。Optionally, the storage block is 256 bytes of storage space.
由上可见,本发明实施例在向存储介质随机写入数据时,只需根据写入的数据和写入前的原始数据修改存储块中总数据的ECC码即可,可以解决现有技术中必须完整写入一个存储块的数据后才能计算ECC码的问题,从而不会破坏存储介质的随机写入性;本发明实施例在向存储介质随机读取数据时,先对读取的数据进行奇偶校验,只有在奇偶校验出错时才进行ECC校验,可以解决现有技术中每次读取数据时都要完整读取一个存储块的数据后才能进行ECC校验的问题,从而减少对存储介质的随机读取性的破坏。It can be seen that, in the embodiment of the present invention, when the data is randomly written to the storage medium, the ECC code of the total data in the storage block can be modified only according to the written data and the original data before the writing, which can be solved in the prior art. The data of one storage block must be completely written before the problem of the ECC code can be calculated, so that the random writeability of the storage medium is not damaged. In the embodiment of the present invention, when the data is randomly read from the storage medium, the read data is first performed. Parity check, only when the parity error occurs, the ECC check is performed, which can solve the problem that the ECC check can be performed after the data of one memory block is completely read every time the data is read in the prior art, thereby reducing the problem. Destruction of random readability of storage media.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。One of ordinary skill in the art can understand that all or part of the process of implementing the foregoing embodiments can be completed by a computer program to instruct related hardware, and the program can be stored in a computer readable storage medium. When executed, the flow of an embodiment of the methods as described above may be included. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
以上所揭露的仅为本发明较佳实施例而已,当然不能以此来限定本发明之权利范围,因此依本发明权利要求所作的等同变化,仍属本发明所涵盖的范围。 The above is only the preferred embodiment of the present invention, and the scope of the present invention is not limited thereto, and thus equivalent changes made in the claims of the present invention are still within the scope of the present invention.

Claims (8)

  1. 一种更新错误检测和纠正ECC码的方法,其特征在于,所述方法应用于存储介质的数据写入过程,所述存储介质包括多个存储块,所述方法包括:A method for updating an error detection and correction ECC code, the method being applied to a data writing process of a storage medium, the storage medium comprising a plurality of storage blocks, the method comprising:
    获取每个所述存储块中总数据的ECC码,所述ECC码包括列校验码和行校验码;Obtaining an ECC code of total data in each of the storage blocks, where the ECC code includes a column check code and a row check code;
    当向所述存储介质随机写入一字节的数据时,获取写入的数据、所述数据被写入的存储空间的位置以及所述存储空间在写入所述数据之前所存储的原始数据,其中,所述存储空间的位置用以确定所述存储空间所属的存储块;When a byte of data is randomly written to the storage medium, the written data, the location of the storage space where the data is written, and the original data stored by the storage space before the data is written are acquired. Wherein the location of the storage space is used to determine a storage block to which the storage space belongs;
    通过对所述写入的数据的ECC码的列校验码、所述原始数据的ECC码的列校验码和所述存储空间所属的存储块中总数据的ECC码的列校验码进行逻辑运算,得到写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码,以及根据所述写入的数据和所述原始数据,修改所述存储空间所属的存储块中总数据的ECC码的行校验码;And performing, by using a column check code of the ECC code of the written data, a column check code of the ECC code of the original data, and a column check code of an ECC code of the total data in the storage block to which the storage space belongs. a logical operation of obtaining a column check code of an ECC code of total data in a storage block to which the storage space belongs after writing one-byte data, and modifying the data according to the written data and the original data a row check code of the ECC code of the total data in the storage block to which the storage space belongs;
    根据所述写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码和修改后的所述存储空间所属的存储块中总数据的ECC码的行校验码,得到更新后的所述存储空间所属的存储块中总数据的ECC码。a column check code of the ECC code of the total data in the memory block to which the storage space belongs after the one-byte data is written, and an ECC code of the total data in the memory block to which the modified storage space belongs The check code is obtained, and the ECC code of the total data in the storage block to which the updated storage space belongs is obtained.
  2. 如权利要求1所述的方法,其特征在于,所述通过对所述写入的数据的ECC码的列校验码、所述原始数据的ECC码的列校验码和所述存储空间所属的存储块中总数据的ECC码的列校验码进行逻辑运算,得到写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码,包括:The method according to claim 1, wherein said column check code of an ECC code of said written data, a column check code of an ECC code of said original data, and said storage space belong to The column check code of the ECC code of the total data in the storage block is logically operated, and the column check code of the ECC code of the total data in the storage block to which the storage space belongs after the one-byte data is written is obtained, including:
    计算所述写入的数据的ECC码的列校验码,以及所述原始数据的ECC码的列校验码;Calculating a column check code of the ECC code of the written data, and a column check code of the ECC code of the original data;
    根据公式
    Figure PCTCN2016091840-appb-100001
    计算写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码,其中,所述
    Figure PCTCN2016091840-appb-100002
    表示计算后的所述总数据的ECC码的列校验码,所述ECC_CP表示计算前的所述总数据的ECC码的列校验码,所述Data_ECC_CP表示所述写入的数据的ECC码的列校验码,所述Buf_ECC_CP表示所述原始数据的ECC码的 列校验码,所述^表示按位异或的运算。
    According to the formula
    Figure PCTCN2016091840-appb-100001
    Calculating a column check code of an ECC code of total data in a storage block to which the storage space belongs after writing one-byte data, wherein
    Figure PCTCN2016091840-appb-100002
    a column check code indicating an ECC code of the calculated total data, the ECC_CP indicating a column check code of an ECC code of the total data before calculation, and the Data_ECC_CP indicating an ECC code of the written data Column check code, the Buf_ECC_CP represents a column check code of the ECC code of the original data, and the ^ represents a bitwise exclusive OR operation.
  3. 如权利要求1所述的方法,其特征在于,所述根据所述写入的数据和所述原始数据,修改所述存储空间所属的存储块中总数据的ECC码的行校验码,包括:The method according to claim 1, wherein said modifying a row check code of an ECC code of total data in a storage block to which said storage space belongs according to said written data and said original data, including :
    确定所述写入的数据的奇偶性,以及所述原始数据的奇偶性;Determining a parity of the written data and a parity of the original data;
    判断所述写入的数据的奇偶性与所述原始数据的奇偶性是否相同;Determining whether the parity of the written data is the same as the parity of the original data;
    若是,则不修改所述总数据的ECC码的行校验码;If yes, the row check code of the ECC code of the total data is not modified;
    若否,则确定在所述总数据的ECC码的行校验码中,与所述被写入的存储空间中数据关联的比特位,并对其进行反转,其中,所述反转是指将数据0变为数据1,或将数据1变为数据0。If not, determining a bit associated with the data in the written storage space in the row check code of the ECC code of the total data, and inverting, wherein the inversion is Refers to changing data 0 to data 1, or changing data 1 to data 0.
  4. 如权利要求1-3任一项所述的方法,其特征在于,所述存储块为256个字节的存储空间。The method of any of claims 1-3, wherein the memory block is 256 bytes of storage space.
  5. 一种更新错误检测和纠正ECC码的装置,其特征在于,所述装置应用于存储介质的数据写入过程,所述存储介质包括多个存储块,所述装置包括:An apparatus for updating an error detection and correction ECC code, wherein the apparatus is applied to a data writing process of a storage medium, the storage medium comprising a plurality of storage blocks, the apparatus comprising:
    ECC码获取模块,用于获取每个所述存储块中总数据的ECC码,所述ECC码包括列校验码和行校验码;An ECC code obtaining module, configured to acquire an ECC code of total data in each of the storage blocks, where the ECC code includes a column check code and a row check code;
    数据获取模块,用于当向所述存储介质随机写入一字节的数据时,获取写入的数据、所述数据被写入的存储空间的位置以及所述存储空间在写入所述数据之前所存储的原始数据,其中,所述存储空间的位置用以确定所述存储空间所属的存储块;a data acquisition module, configured to acquire, when the data is randomly written to the storage medium, the written data, the location of the storage space where the data is written, and the storage space in which the data is written Raw data stored previously, wherein the location of the storage space is used to determine a storage block to which the storage space belongs;
    行列码修改模块,用于通过对所述写入的数据的ECC码的列校验码、所述原始数据的ECC码的列校验码和所述存储空间所属的存储块中总数据的ECC码的列校验码进行逻辑运算,得到写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码,以及根据所述写入的数据和所述原始数据,修改所述存储空间所属的存储块中总数据的ECC码的行校验码;a row and column code modification module, configured to pass a column check code of an ECC code of the written data, a column check code of an ECC code of the original data, and an ECC of total data in a storage block to which the storage space belongs The column check code of the code performs a logical operation to obtain a column check code of the ECC code of the total data in the memory block to which the storage space belongs after writing the one-byte data, and according to the written data and the Determining the original data, modifying a row check code of the ECC code of the total data in the storage block to which the storage space belongs;
    ECC码更新模块,用于根据所述写入一字节的数据后的所述存储空间所 属的存储块中总数据的ECC码的列校验码和修改后的所述存储空间所属的存储块中总数据的ECC码的行校验码,得到更新后的所述存储空间所属的存储块中总数据的ECC码。An ECC code update module, configured to store the one-byte data according to the storage space a row check code of the ECC code of the total data in the storage block of the genus and a row check code of the ECC code of the total data in the storage block to which the modified storage space belongs, and the updated storage of the storage space is obtained. The ECC code of the total data in the block.
  6. 如权利要求5所述的装置,其特征在于,所述行列码修改模块包括:The apparatus according to claim 5, wherein the row and column code modification module comprises:
    列码计算单元,用于计算所述写入的数据的ECC码的列校验码,以及所述原始数据的ECC码的列校验码;a column code calculation unit, configured to calculate a column check code of the ECC code of the written data, and a column check code of the ECC code of the original data;
    列码修改单元,用于根据公式
    Figure PCTCN2016091840-appb-100003
    计算写入一字节的数据后的所述存储空间所属的存储块中总数据的ECC码的列校验码,其中,所述
    Figure PCTCN2016091840-appb-100004
    表示计算后的所述总数据的ECC码的列校验码,所述ECC_CP表示计算前的所述总数据的ECC码的列校验码,所述Data_ECC_CP表示所述写入的数据的ECC码的列校验码,所述Buf_ECC_CP表示所述原始c数据的ECC码的列校验码,所述^表示按位异或的运算。
    Column code modification unit for formulating
    Figure PCTCN2016091840-appb-100003
    Calculating a column check code of an ECC code of total data in a storage block to which the storage space belongs after writing one-byte data, wherein
    Figure PCTCN2016091840-appb-100004
    a column check code indicating an ECC code of the calculated total data, the ECC_CP indicating a column check code of an ECC code of the total data before calculation, and the Data_ECC_CP indicating an ECC code of the written data Column check code, the Buf_ECC_CP represents a column check code of the ECC code of the original c data, and the ^ represents a bitwise exclusive OR operation.
  7. 如权利要求5所述的装置,其特征在于,所述行列码修改模块包括:The apparatus according to claim 5, wherein the row and column code modification module comprises:
    奇偶性确定单元,用于确定所述写入的数据的奇偶性,以及所述原始数据的奇偶性;a parity determining unit, configured to determine a parity of the written data, and a parity of the original data;
    行码修改单元,用于判断所述写入的数据的奇偶性与所述原始数据的奇偶性是否相同;a line code modification unit, configured to determine whether a parity of the written data is the same as a parity of the original data;
    若是,则不修改所述总数据的ECC码的行校验码;If yes, the row check code of the ECC code of the total data is not modified;
    若否,则确定在所述总数据的ECC码的行校验码中,与所述被写入的存储空间中数据关联的比特位,并对其进行反转,其中,所述反转是指将数据0变为数据1,或将数据1变为数据0。If not, determining a bit associated with the data in the written storage space in the row check code of the ECC code of the total data, and inverting, wherein the inversion is Refers to changing data 0 to data 1, or changing data 1 to data 0.
  8. 如权利要求5-7任一项所述的装置,其特征在于,所述存储块为256个字节组成的存储空间。 The apparatus according to any one of claims 5 to 7, wherein the memory block is a storage space of 256 bytes.
PCT/CN2016/091840 2015-11-26 2016-07-27 Method and device for updating error checking and correction code WO2017088507A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510844082.2A CN106802837B (en) 2015-11-26 2015-11-26 Method and device for updating error detection and correcting ECC code
CN201510844082.2 2015-11-26

Publications (1)

Publication Number Publication Date
WO2017088507A1 true WO2017088507A1 (en) 2017-06-01

Family

ID=58762966

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/091840 WO2017088507A1 (en) 2015-11-26 2016-07-27 Method and device for updating error checking and correction code

Country Status (2)

Country Link
CN (1) CN106802837B (en)
WO (1) WO2017088507A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111158948A (en) * 2019-12-30 2020-05-15 深信服科技股份有限公司 Data storage and verification method and device based on duplicate removal and storage medium
CN113053451A (en) * 2021-03-05 2021-06-29 深圳三地一芯电子有限责任公司 Method, system, host and storage medium for generating softbit in Nandflash
CN117349079A (en) * 2023-11-16 2024-01-05 苏州门海微电子科技有限公司 ECC data error correction method for SPI Norflash

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111984457B (en) * 2019-05-23 2022-09-02 华为技术有限公司 Method and device for updating storage information
CN110727541A (en) * 2019-09-02 2020-01-24 广东紫晶信息存储技术股份有限公司 Method and system for checking partitioned storage of optical disk

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1684200A (en) * 2004-04-12 2005-10-19 恩益禧电子股份有限公司 Semiconductor storage device
CN101183565A (en) * 2007-12-12 2008-05-21 深圳市硅格半导体有限公司 Data verification method for storage medium
US7546517B2 (en) * 2004-08-03 2009-06-09 President And Fellows Of Harvard College Error-correcting circuit for high density memory
CN102110028A (en) * 2009-12-25 2011-06-29 康佳集团股份有限公司 NAND flash memory as well as data checking method and device thereof
US8239732B2 (en) * 2007-10-30 2012-08-07 Spansion Llc Error correction coding in flash memory devices
CN102904585A (en) * 2012-11-08 2013-01-30 杭州士兰微电子股份有限公司 Dynamic error correction encoding and decoding method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008027558A (en) * 2006-07-25 2008-02-07 Hitachi Global Storage Technologies Netherlands Bv Data recording device, recording medium, and error detection method
US8316277B2 (en) * 2007-12-06 2012-11-20 Fusion-Io, Inc. Apparatus, system, and method for ensuring data validity in a data storage process
CN101420283A (en) * 2008-12-01 2009-04-29 华为技术有限公司 Data guard method in a kind of SDH (Synchronous Digital Hierarchy), device and communication equipment
CN102339647B (en) * 2010-07-23 2014-05-14 北京兆易创新科技股份有限公司 Detection method and apparatus for error checking and correcting (ECC) check module

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1684200A (en) * 2004-04-12 2005-10-19 恩益禧电子股份有限公司 Semiconductor storage device
US7546517B2 (en) * 2004-08-03 2009-06-09 President And Fellows Of Harvard College Error-correcting circuit for high density memory
US8239732B2 (en) * 2007-10-30 2012-08-07 Spansion Llc Error correction coding in flash memory devices
CN101183565A (en) * 2007-12-12 2008-05-21 深圳市硅格半导体有限公司 Data verification method for storage medium
CN102110028A (en) * 2009-12-25 2011-06-29 康佳集团股份有限公司 NAND flash memory as well as data checking method and device thereof
CN102904585A (en) * 2012-11-08 2013-01-30 杭州士兰微电子股份有限公司 Dynamic error correction encoding and decoding method and device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111158948A (en) * 2019-12-30 2020-05-15 深信服科技股份有限公司 Data storage and verification method and device based on duplicate removal and storage medium
CN111158948B (en) * 2019-12-30 2024-04-09 深信服科技股份有限公司 Data storage and verification method and device based on deduplication and storage medium
CN113053451A (en) * 2021-03-05 2021-06-29 深圳三地一芯电子有限责任公司 Method, system, host and storage medium for generating softbit in Nandflash
CN113053451B (en) * 2021-03-05 2022-05-10 深圳三地一芯电子有限责任公司 Method, system, host and storage medium for generating softbit in Nandflash
CN117349079A (en) * 2023-11-16 2024-01-05 苏州门海微电子科技有限公司 ECC data error correction method for SPI Norflash

Also Published As

Publication number Publication date
CN106802837B (en) 2020-02-21
CN106802837A (en) 2017-06-06

Similar Documents

Publication Publication Date Title
WO2017088507A1 (en) Method and device for updating error checking and correction code
TWI649759B (en) Data storage device and method for writing data into memory device
US8694855B1 (en) Error correction code technique for improving read stress endurance
TWI446350B (en) Method for reducing uncorrectable errors, and associated memory device and controller thereof
KR101343262B1 (en) Method and apparatus to perform concurrent read and write memory operations
US7921339B2 (en) Flash storage device with data correction function
US8782329B2 (en) Method for performing data shaping, and associated memory device and controller thereof
TWI522804B (en) Flash memory controller and data storage device and flash memory control method
US9130597B2 (en) Non-volatile memory error correction
TWI389122B (en) Method for accessing a flash memory, and associated memory device and controller thereof
TWI703499B (en) Data storage device and method for sharing memory of controller thereof
US20140082264A1 (en) Nand flash storage chip checking method and device
WO2017008501A1 (en) Method for recovering data when error occurring in nand flash cannot be corrected by ecc
TW201721435A (en) Data reading method, memory control circuit unit and memory storage apparatus
US9063888B2 (en) Program code loading and accessing method, memory controller, and memory storage apparatus
CN104299637A (en) Flash memory device and operation method thereof
EP1980946B1 (en) Error correction code generation method and memory management device
US8966344B2 (en) Data protecting method, memory controller and memory storage device
US10489244B2 (en) Systems and methods for detecting and correcting memory corruptions in software
TW201915736A (en) Methods of proactive ecc failure handling
US9594629B2 (en) Data error correction from cached error correction information
US11372720B2 (en) Systems and methods for encoding metadata
KR20100031402A (en) Method and apparatus for detecting free page and error correction code decoding method and apparatus using the same
TWI599904B (en) Electronic apparatus and data verification method using the same
US10025652B2 (en) Error location pointers for non volatile memory

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16867734

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16867734

Country of ref document: EP

Kind code of ref document: A1