Memory data search method applied to data storage device
By dividing the data storage device into sub-blocks and using identifiers, inverted identifiers, error correction codes, and inverted error correction codes to determine the reliability of the sub-blocks, the problems of reading errors and long reading times are solved, and fast and reliable code information acquisition is achieved.
Patent Information
- Application Number
- CN202010175858.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-01-15
- Filing Date
- 2020-03-13
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2040-03-13
AI Technical Summary
Existing data storage devices are prone to generating bad lines when reading code information, leading to erroneous readings. Furthermore, searching for code information in large amounts of data is time-consuming, and reading interference must be avoided to maintain reliability.
The storage block is divided into multiple sub-blocks, each containing a tag block and an address information block. The reliability of the sub-block is determined by the identifier, the inverted identifier, the error correction code, and the inverted error correction code, and the address information is read from the reliable block to obtain the storage address.
It enables fast and reliable acquisition of code information, reduces erroneous reading and search time, and improves the reliability of data storage devices.
Smart Images

Figure CN113127253B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a data storage device and a method for searching memory data, and in particular to a data storage device for recording a large amount of data and a method for searching memory data. Background Art
[0002] In response to the needs of big data analysis, today's data storage devices are often used to record large amounts of data. The memory of the data storage device can also be used to record code information about memory parameters. When searching and reading code information, the following problems may occur: First, the wrong code information is read because of the bad column problem in the storage row where the code information is located; second, it often takes a lot of time to search for the code information to be read in the memory that stores a large amount of data; third, in the memory reading operation, the problem of read interference must be avoided to maintain the reliability of the read code information.
[0003] Based on the above problems, how to quickly and reliably obtain code information has become an important issue for designers in this field. Summary of the invention
[0004] The present invention is directed to a data storage device and a method for searching memory data, which can quickly search for required information in a large amount of data.
[0005] According to an embodiment of the present invention, a method for searching data in a memory includes: distinguishing a storage block into multiple sub-blocks, each sub-block is divided into a label block and an address information block, wherein the label block records multiple identifiers, multiple inverted identifiers, multiple error correction codes, and multiple inverted error correction codes; selecting one of the sub-blocks as a selected sub-block; reading the identifier, inverted identifier, error correction code, and inverted error correction code in the label block of the selected sub-block, and judging whether the selected sub-block is a reliable data block based on the identifier, inverted identifier, error correction code, and inverted error correction code; when the selected sub-block is a reliable data block, reading the address information block of the selected sub-block to obtain storage address information of the code information.
[0006] In an embodiment according to the present invention, the above-mentioned identifier, inverted identifier, error correction code and inverted error correction code identifier are alternately arranged in the tag block.
[0007] In an embodiment of the present invention, the step of judging whether a selected sub-block is a reliable data block based on the identifier, the inverted identifier, the error correction code and the inverted error correction code comprises: calculating a first number of identifiers equal to a first set value; calculating a second number of inverted identifiers equal to the first inverted set value; when both the first number and the second number are not less than a first threshold value, reading the error correction code and the inverted error correction code; selecting a selected error correction code and a selected inverted error correction code, wherein the selected selected error correction code and the selected inverted error correction code are complementary; the selected error correction code and the selected inverted error correction code are respectively a standard error correction code and a standard inverted error correction code, calculating a third number of error correction codes equal to the standard error correction code, and calculating a fourth number of inverted error correction codes equal to the standard inverted error correction code; when both the third number and the fourth number are not less than the second threshold value, judging that the selected sub-block is a reliable data block.
[0008] In an embodiment of the present invention, the data of the above-mentioned identifiers are the same, the data of the inverted identifiers are the same, and the data content of each identifier and the corresponding inverted identifier are complementary.
[0009] In an embodiment of the present invention, the data of the above-mentioned error correction codes are the same, the data of the inverse error correction codes are the same, and the data content of each error correction code is complementary to that of the corresponding error correction codes.
[0010] In an embodiment of the present invention, the address information block records a plurality of address information and a plurality of inverted address information in an interleaved arrangement, and the address information and the corresponding inverted address information form the same group of address information pairs.
[0011] In an embodiment of the present invention, each of the above-mentioned address information includes a plurality of bytes, and each of the inverted address information includes a plurality of bytes, wherein when a sub-block is selected as a reliable data block, the step of reading the address information block of the selected sub-block to obtain the storage address information of the code information includes: selecting one of the address information pairs for comparison, the address information in the selected address information pair is complementary to the inverted address information, and this pair of address information is called standard address information and standard inverted address information; comparing each byte of the standard address information with each of the address information one by one, and recording a first quantity whose comparison result is the same; judging whether the first quantity is greater than a first threshold value, so as to record each byte of the corresponding address information to obtain storage location information; comparing each byte of the standard inverted address information with each of the inverted address information one by one, and recording a second quantity whose comparison result is the same; and judging whether each second quantity is greater than a second threshold value, so as to record each byte of the corresponding inverted address information to obtain inverted storage location information.
[0012] In an embodiment of the present invention, the above-mentioned search method includes reading code information in the memory according to storage address information.
[0013] In an embodiment according to the present invention, the block selection code is read and one of the sub-blocks is selected as a selected sub-block according to the block selection code.
[0014] According to an embodiment of the present invention, a data storage device includes a memory and a controller. The memory stores code information. The controller is coupled to the memory to execute the memory data search method as described above.
[0015] Based on the above, the embodiment of the present invention sets a label block in multiple sub-blocks of the memory, and determines the reliability of the corresponding sub-block through the identifier, inverted identifier, error correction code and inverted error correction code in the label block, and then reads through the address information stored in the reliable data block, so as to quickly obtain the storage address information of the code information with high reliability, and thereby quickly read the correct code information. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings are included to provide a further understanding of the present invention and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the present invention and together with the description serve to explain the principles of the present invention.
[0017] Figure 1 A method for searching data in a memory according to an embodiment of the present invention;
[0018] Figure 2 is a schematic diagram of a sub-block of a memory according to an embodiment of the present invention;
[0019] Figure 3 It is an action flow chart of a method for searching data in a memory according to another embodiment of the present invention;
[0020] Figure 4 is a schematic diagram of a sub-block according to an embodiment of the present invention;
[0021] Figure 5 A schematic diagram of an implementation of an identifier and an inverted identifier according to an embodiment of the present invention;
[0022] Figure 6 A flowchart of the steps of determining a reliable data block according to an embodiment of the present invention;
[0023] Figure 7 A schematic diagram of an implementation of an error correction code and an inverse error correction code according to an embodiment of the present invention;
[0024] Figure 8 A flowchart of the steps of determining a reliable data block according to an embodiment of the present invention;
[0025] Fig. 9 A schematic diagram of an implementation of an address information block according to an embodiment of the present invention;
[0026] Fig.10 A flowchart of an address information search operation according to an embodiment of the present invention;
[0027] Fig.11 FIG. 1 is a schematic diagram of a data storage device according to an embodiment of the present invention.
[0028] Description of Figure Numbers
[0029] 1110: controller;
[0030] 1120: Memory;
[0031] 1130: Select code generator;
[0032] 11: Data storage device;
[0033] 210: storage block;
[0034] 211-214: sub-block;
[0035] 400: sub-block;
[0036] ADD: address information block;
[0037] AG1~AGM: address information pair;
[0038] CIADD1~CIADDM: address information;
[0039] CIADDI1~CIADDIM: inverted address information;
[0040] ECC1~ECCN: error correction code;
[0041] ECCI1~ECCIN: inverse error correction code;
[0042] G1~GN: group;
[0043] S1010-S1050: step of searching address information;
[0044] S110-S140, S310-S380: steps of searching for data in the memory;
[0045] S610-S640, S810-S840: reliable data block determination steps;
[0046] SEL: selection code;
[0047] TAG: tag block;
[0048] TG1~TGN, TAG1~TAG256: identifier;
[0049] TGI1~TGIN, TAGI1~TAGI256: inverted identifier. DETAILED DESCRIPTION
[0050] Reference will now be made in detail to exemplary embodiments of the present invention, examples of which are illustrated in the accompanying drawings. Whenever possible, the same reference numerals are used in the drawings and the description to refer to the same or like parts.
[0051] Please refer to Figure 1 , Figure 1 The present invention shows a method for searching data in a memory according to an embodiment of the present invention. In step S110, a storage block is divided into a plurality of sub-blocks, each of which has a label block and an address information block. The label block records a plurality of identifiers, a plurality of inverted identifiers, a plurality of error correction codes, and a plurality of inverted error correction codes. The address information block records a plurality of address information and a plurality of inverted address information, wherein the address information is the storage address of the code information in the memory.
[0052] You can refer to this synchronously Figure 2 , Figure 2 A schematic diagram of a sub-block of a memory according to an embodiment of the present invention is shown, wherein a storage block 210 of the memory can be divided into, for example, four sub-blocks 211 - 214 .
[0053] Please note that in this embodiment, when the storage block records the storage address of the code information, multiple identifiers, multiple inverted identifiers, multiple error correction codes, multiple inverted error correction codes, multiple address information, and multiple inverted address information are recorded in a sub-block (e.g., sub-block 211), and the data of this sub-block 211 is copied to other sub-blocks (e.g., sub-blocks 212 to 214). That is, in the initial state, the same data is recorded in multiple sub-blocks of the storage block. However, after the sub-blocks 211 to 214 have been read for a certain period of time, part of the data in the sub-blocks 211 to 214 is mutated due to read interference or other factors.
[0054] Re-reference Figure 1 In step S120, one of the plurality of sub-blocks is selected as a selected sub-block. In step S120, the selection of the sub-block may be performed based on a block selection code. The block selection code may come from outside the memory and may have a plurality of bits. The number of bits of the selection code may be determined based on the number of sub-blocks. The number of sub-blocks must be less than or equal to 2 to the power of A, where A is the number of bits of the selection code.
[0055] In step S130, the action of reading the identifier, inverted identifier, error correction code and inverted error correction code in the tag block of the selected sub-block is performed. And based on the identifier, inverted identifier, error correction code and inverted error correction code, it is determined whether the selected sub-block is a reliable data block. Please note that in this embodiment, a plurality of identifiers and a plurality of inverted identifiers are recorded in a tag block. The identifier and the plurality of inverted identifiers are all pre-set values, and in the initial state, the data of all identifiers recorded in a tag block are the same, and the data of all inverted identifiers are also the same, and the data of the identifier and the inverted identifier are complementary.
[0056] On the other hand, the pre-set identifier may have multiple bits, wherein the data contents of two adjacent bits of these bits are complementary. That is, taking the identifier having 8 bits as an example, the identifier may be 0x55 or 0xAA in hexadecimal. In contrast, in the initial state, the identifier and the inverted identifier are complementary, also taking 8 bits as an example, when the identifier is 0x55 in hexadecimal, the inverted identifier is 0xAA in hexadecimal; when the identifier is 0xAA in hexadecimal, the inverted identifier is 0x55 in hexadecimal.
[0057] Regarding the error correction code and the inverted error correction code, the error correction code and the inverted error correction code can be preset values. In the initial state, the data of all error correction codes recorded in a label block are the same, and the data of all inverted error correction codes recorded in a label block are also the same. In addition, in the initial state, the data of the error correction code and the inverted error correction code are complementary. For example, taking the error correction code having 8 bits as an example, the error correction code can be preset to hexadecimal 0x80; conversely, the inverted error correction code can be hexadecimal 0x7F.
[0058] In this embodiment, the identifier and the inverted identifier can be alternately set at consecutive addresses in the tag block, and the error correction code and the inverted error correction code can also be alternately set at consecutive addresses in the tag block. In one embodiment of the present invention, the identifier, the inverted identifier, the error correction code and the inverted error correction code can be sequentially set at consecutive addresses in the tag block.
[0059] Of course, the address order of the identifier, inverted identifier, error correction code and inverted error correction code in the tag block is not limited to the above method, and the designer can set any order according to actual needs. In addition, there is no specific restriction on the number of bits of the identifier, inverted identifier, error correction code and inverted error correction code. The above 8-bit example is only for convenience of explanation and is not intended to limit the scope of implementation of the present invention.
[0060] In step S130, the present embodiment can determine whether the corresponding sub-block is a reliable data block by reading the identifier, the inverted identifier, the error correction code and the inverted error correction code in the tag block, and by checking the complementary state of the data of the identifier and the inverted identifier, and checking the variation state of the error correction code and the inverted error correction code. And, according to the judgment result of step S130, when the sub-block is a reliable data block, the address information block of the sub-block is read to obtain the storage address information of the code information.
[0061] Please refer to the following Figure 3 , Figure 3 The flowchart of the method for searching data in the memory of another embodiment of the present invention is shown. The storage block of the memory is, for example, 8k bytes. Figure 3 In the embodiment, after the big data search starts, step S310 determines the block selection code, and executes step S321 when the block selection code is binary b10; executes step S322 when the block selection code is binary b00; and executes step S323 when the block selection code is binary b11 or b01.
[0062] In step S321, a search is performed on the 4k-6k sub-blocks (range 2) in the storage block; in step S322, a search is performed on the 0k-2k sub-blocks (range 0) in the storage block; and in step S323, a search is performed on the 2k-4k sub-blocks (range 1) in the storage block.
[0063] Step S330 determines whether the current search range is less than or equal to 3. If the search range is less than or equal to 3, it means that not all sub-blocks have been searched, and step S340 can be executed to continue the search. Conversely, if the search range is greater than 3, it means that all sub-blocks have been searched, and step S360 is entered to indicate that the search has failed.
[0064] In step S340, it is determined whether the address information of the code information has been obtained, and when the address information of the code information has been obtained, step S380 is executed to indicate that the search is successful. In addition, when the address information of the code information has not been obtained, step S350 is executed, and when the result matching number is less than the threshold value but greater than the retry threshold value, the search range moves to the next sub-block (search range + 1) (step S370), and step S330 is re-executed. When the result matching number is not greater than the retry threshold value, step S360 is entered to indicate that the block search action has failed.
[0065] Under the condition that the address information of the code information has been obtained, the required code information can be read out from the memory according to the address information of the code information.
[0066] Please refer to Figure 4 , Figure 4 A schematic diagram of a sub-block according to an embodiment of the present invention is shown. The sub-block 400 has a tag block TAG and an address information block ADD. The tag block TAG records identifiers TG1-TGN, inverted identifiers TGI1-TGIN, error correction codes ECC1-ECCN, and inverted error correction codes ECCI1-ECCIN of a plurality of groups G1-GN. Taking the first group G1 as an example, the first group G1 records the identifier TG1, the inverted identifier TGI1, the error correction code ECC1, and the inverted error correction code ECCI1 in sequence.
[0067] In addition, in the address information block ADD, address information CIADD1-CIADDM and inverted address information CIADDI1-CIADDIM of code information are recorded in sequence. The address information CIADD1-CIADDM and inverted address information CIADDI1-CIADDIM are alternately arranged in the address information block ADD.
[0068] In addition, the address information CIADD1-CIADDM and the corresponding inverted address information CIADDI1-CIADDIM respectively form a plurality of address information groups AG1-AGM, and each of the address information CIADD1-CIADDM and the corresponding inverted address information CIADDI1-CIADDIM form an address information pair).
[0069] Please refer to Figure 5 , Figure 5 A schematic diagram showing an implementation of an identifier and an inverted identifier according to an embodiment of the present invention. Figure 5 In the tag block TAG, for example, 256 identifiers TAG1-TAG256 are recorded, wherein the identifiers TAG1-TAG256 are all equal to hexadecimal 0x55 in the initial state. The tag block TAG also records inverted identifiers TAGI1-TAGI256 corresponding to the identifiers TAG1-TAG256, respectively, and in the initial state, the inverted identifiers TAGI1-TAGI256 are all equal to hexadecimal 0xAA.
[0070] Please refer to this synchronously Figure 6FIG. 6 is a flowchart of the steps for determining a reliable data block according to an embodiment of the present invention. In step S610, the 256 identifiers TAG1 to TAG256 in the tag block TAG are read, and it is determined whether the number of the identifiers TAG1 to TAG256 equal to 0x55 is greater than or equal to the threshold value (=64) (1 / 4 of the total number of the identifiers TAG1 to TAG256). If it is determined that no less than 1 / 4 of the read identifiers TAG1 to TAG256 have not undergone data mutation, step S620 can be executed. Conversely, if it is determined that the number of the read identifiers TAG1 to TAG256 that have undergone data mutation exceeds 3 / 4, it indicates that the corresponding sub-block is an unreliable sub-block, and step S640 is executed to indicate failure information.
[0071] Step S620 reads the 256 inverted identifiers TAGI1-TAGI256 in TAG, and determines whether the number of inverted identifiers TAGI1-TAGI256 equal to 0xAA is greater than or equal to a reference value (=64) (1 / 4 of the total number of inverted identifiers TAGI1-TAGI256). If it is determined that no less than 1 / 4 of the read inverted identifiers TAGI1-TAGI256 have not undergone data mutation, step S630 can be executed to search for error correction codes and inverted error correction codes. Conversely, if it is determined that the number of read inverted identifiers TAGI1-TAGI256 that have undergone data mutation exceeds 3 / 4, it indicates that the corresponding sub-block is an unreliable sub-block, and step S640 is executed to indicate failure information.
[0072] Please note that the above reference value is not necessarily set to 64. The designer can set the size of the threshold value according to the required rigor. When the rigor of determining whether a sub-block is a reliable data block is relatively high, the threshold value can be set to be greater than 64, that is, a relatively high proportion of all identifiers TAG1 to TAG256 and inverted identifiers TAGI1 to TAGI256. Conversely, when the rigor of determining whether a sub-block is a reliable data block is relatively low, the threshold value can be set to be less than 64, that is, a relatively low proportion of all identifiers TAG1 to TAG256 and inverted identifiers TAGI1 to TAGI256.
[0073] Please refer to the following synchronously Figure 7 as well as Figure 8 , Figure 7 A schematic diagram showing an implementation of an error correction code and an inverse error correction code according to an embodiment of the present invention is shown. Figure 8 FIG. 4 is a flowchart showing the steps of determining a reliable data block according to an embodiment of the present invention. Figure 7In the tag block, error correction codes ECC1-ECC256 and the corresponding inverse error correction codes ECCI1-ECCI256 are recorded. In the initial state, the data of the error correction codes ECC1-ECC256 are all the same, and are equal to, for example, hexadecimal 0x80, and the data of the inverse error correction codes ECCI1-ECCI256 are all the same, and are equal to, for example, hexadecimal 0x7F, wherein the error correction codes ECC1-ECC256 in the initial state are complementary to the inverse error correction codes ECCI1-ECCI256.
[0074] In addition, Figure 8 In step S810, one of the error correction codes ECC1 to ECC256 is read (for example, the first group of error correction code ECC1 is read), and the corresponding inverted error correction code ECCI1 is read, and it is determined whether the error correction code ECC1 and the inverted error correction code ECCI1 are complementary. If the error correction code ECC1 and the inverted error correction code ECCI1 are complementary, it means that the error correction code ECC1 and the inverted error correction code ECCI1 have no data mutation, and can be set as a standard error correction code and a standard inverted error correction code respectively, and step S820 is executed. Conversely, if the error correction code ECC1 and the inverted error correction code ECCI1 are not complementary, it means that the error correction code ECC1 and the inverted error correction code ECCI1 have data mutation, then step S811 is performed to check the next group of error correction codes (for example, error correction code ECC2) and the next group of inverted error correction codes (for example, inverted error correction code ECCI2), and then step S810 is re-executed.
[0075] In step S820, the error correction codes ECC1-ECC256 of each group are compared with the standard error correction code, and the number of error correction codes ECC1-ECC256 that are the same as the standard error correction code is calculated to see whether it is greater than a threshold value (=64). If the number of error correction codes ECC1-ECC256 that are the same as the standard error correction code is not less than the threshold value, step S830 is executed. Conversely, if the number of error correction codes ECC1-ECC256 that are the same as the standard error correction code is less than the threshold value, step S850 is executed to indicate that the search has failed.
[0076] In step S830, each group of inverse error correction codes ECCI1-ECCI256 is compared with the standard inverse error correction code, and it is calculated whether the number of inverse error correction codes ECCI1-ECCI256 that are the same as the standard inverse error correction code is greater than a threshold value (=64). If the number of inverse error correction codes ECCI1-ECCI256 that are the same as the standard inverse error correction code is not less than the threshold value, step S840 is executed to perform an address information search operation.
[0077] It should be noted that in step S830, the operation of comparing each group of inverted error correction codes ECCI1-ECCI256 with the standard inverted error correction code may be changed to determining whether each group of inverted error correction codes ECCI1-ECCI256 and the standard error correction code are complementary.
[0078] For more information about address information search, please refer to Fig. 9 as well as Fig.10 ,in Fig. 9 A schematic diagram showing an implementation scheme of an address information block according to an embodiment of the present invention is shown. Fig.10 FIG. 4 is a flowchart showing the address information search operation according to an embodiment of the present invention. Fig. 9 In the address information block, a plurality of address information CIADD1-CIADD128 and a plurality of inverted address information CIADDI1-CIADDI128 storing code information are recorded. In the initial state, all the address information CIADD1-CIADD128 are the same, and are equal to, for example, 0x12345678 in hexadecimal. Also, in the initial state, all the inverted address information CIADDI1-CIADDI128 are the same, and are equal to, for example, 0xEDCBA987 in hexadecimal. The address information CIADD1-CIADD128 and the inverted address information CIADDI1-CIADDI128 are alternately arranged in the address information block, and the address information CIADD1-CIADD128 and the respectively corresponding inverted address information CIADDI1-CIADDI128 form a plurality of address information pairs CADDP1-CADDP128.
[0079] exist Fig.10 In step S1010, one of the address information CIADD1-CIADD128 (for example, the first group of address information CIADD1) is read, the corresponding inverted address information CIADDI1 is read, and it is determined whether the address information CIADD1 and the inverted address information CIADDI1 are complementary. When the address information CIADD1 and the inverted address information CIADDI1 are complementary, the address information CIADD1 and the inverted address information CIADDI1 can be set as standard address information and standard inverted address information, respectively, and step S1021 is executed. Conversely, when the address information CIADD1 and the inverted address information CIADDI1 are not complementary, step S1011 is executed to read and determine the next group of address information (for example, the second group of address information CIADD2) and the inverted address information (for example, the second group of inverted address information CIADDI2).
[0080] In this embodiment, the address information CIADD1 is taken as an example, and the address information CIADD1 has a plurality of bytes (4 bytes in this embodiment), which are respectively the 0th byte composed of "7, 8"; the 1st byte composed of "5, 6"; the 2nd byte composed of "3, 4"; and the 3rd byte composed of "2, 1". Similarly, taking the inverted address information CIADDI1 as an example, the inverted address information CIADDI1 has the same number of bytes (4 bytes), which are respectively the 0th byte composed of "8, 7"; the 1st byte composed of "A, 9"; the 2nd byte composed of "C, B"; and the 3rd byte composed of "E, D".
[0081] Based on the above, steps S1021 to S1024 compare each of the address information CIADD1-CIADD128 with the standard address information byte by byte. In detail, in step S1021, the 0th byte of each of the address information CIADD1-CIADD128 is compared with the 0th byte of the standard address information, and the comparison result is calculated to be the same number. If the calculated number is not less than the threshold value (=32), step S1022 is executed. Conversely, if the calculated number is less than the threshold value (=32), step S1050 is executed to indicate that the search result is a failure.
[0082] Next, in step S1022, the first byte of each of the address information CIADD1-CIADD128 is compared with the first byte of the standard address information, and the comparison result is calculated to be the same number. If the calculated number is not less than the threshold value (=32), step S1023 is executed. Conversely, if the calculated number is less than the threshold value (=32), step S1050 is executed to indicate that the search result is a failure.
[0083] Similarly, steps S1023 and S1024 compare the second and third bytes of each of the address information CIADD1-CIADD128 with the second and third bytes of the standard address information, respectively, and if the calculated numbers are not less than the threshold value (=32), step S1031 is executed. If the number calculated in one of steps S1023 and S1024 is less than the threshold value (=32), step S1050 is executed to indicate that the search result is a failure.
[0084] Steps S1031 to S1034 compare each byte of the inverted address information CIADDI1-CIADDI128 with the standard address information byte by byte, and determine whether the two are complementary. In detail, step S1031 calculates the number of complements of each 0th byte of the inverted address information CIADDI1-CIADDI128 and the 0th byte of the standard address information. If the calculated number is not less than the threshold value (=32), step S1032 is executed. Conversely, if the calculated number is less than the threshold value (=32), step S1050 is executed to indicate that the search result is a failure.
[0085] Step S1032 calculates the number of each first byte of the inverted address information CIADDI1-CIADDI128 that is complementary to the first byte of the standard address information. If the calculated number is not less than the threshold value (=32), step S1033 is executed. Conversely, if the calculated number is less than the threshold value (=32), step S1050 is executed to indicate that the search result is a failure.
[0086] Similarly, steps S1033 and S1034 respectively calculate the number of complements of the second and third bytes of the inverted address information CIADDI1-CIADDI128 and the second and third bytes of the standard address information. If the calculated numbers are not less than the threshold value (=32), step S1040 is executed to obtain the output address information of the code information (equal to the standard address information). Conversely, if one of the numbers calculated above is less than the threshold value (=32), step S1050 is executed to indicate that the search result is a failure.
[0087] Incidentally, the actions of steps S1031 to S1034 can be changed to a byte-by-byte comparison of each byte of the inverted address information CIADDI1~CIADDI128 with the standard inverted address information, and step S1040 or S1050 is executed by calculating the relationship between the number of comparison results that are the same and the threshold value (=32).
[0088] In addition, there is no restriction on the execution order of steps S1021 to 1024, and the designer can design the execution order of steps S1021 to 1024. Similarly, there is no restriction on the execution order of steps S1031 to 1034, and steps S1031 to 1034 can also be executed in priority to steps S1021 to 1024.
[0089] In addition, step S1040 can obtain the address information of the stored code information when the execution results of steps S1021 to 1024 and steps S1031 to 1034 are real-time. In this way, by reading the code information according to the output address information, the code information stored in the memory can be quickly and correctly obtained.
[0090] Please refer to the following Fig.11 , Fig.11 1 is a schematic diagram of a data storage device according to an embodiment of the present invention. The data storage device 11 includes a controller 1110, a memory 1120, and a selection code generator 1130. The selection code generator 1130 may be a hardware fuse device and is used to provide a selection code SEL. The controller 1110 is coupled to the memory 1120 and the selection code generator 1130, and performs the following according to the selection code SEL: Figure 3 The controller 1110 also performs the following steps: Figure 6 , Figure 8 , Fig.10 The action flow shown reads the code information stored in the memory recording the big data by quickly and safely obtaining the storage address information of the code information.
[0091] In this embodiment, the memory 1120 may be a memory in any form. In the embodiment of the present invention, the memory 1120 may be a flash memory, such as a NAND flash memory. The controller 1110 may be a processor with computing capabilities. Alternatively, the controller 1110 may be a hardware circuit designed by a hardware description language (HDL) or any other digital circuit design method known to those skilled in the art, and implemented by a field programmable gate array (FPGA), a complex programmable logic device (CPLD) or an application-specific integrated circuit (ASIC).
[0092] In summary, the present invention divides a storage block into multiple sub-blocks, and makes the sub-block have a label block and an address information block. By judging the identifier, inverted identifier, error correction code and inverted error correction code in the label block, the reliability of the sub-block can be known. Accordingly, the address information block of the reliable sub-block can be read, and the storage address information of the reliable code information can be quickly obtained, and the code information can be obtained accordingly.
[0093] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for searching data in memory. It is characterized in that include: Distinguishing a storage block into a plurality of sub-blocks, each of the sub-blocks being divided into a label block and an address information block, wherein the label block records a plurality of identifiers, a plurality of inverted identifiers, a plurality of error correction codes, and a plurality of inverted error correction codes; Selecting one of the plurality of sub-blocks as a selected sub-block; reading the multiple identifiers, the multiple inverted identifiers, the multiple error correction codes, and the multiple inverted error correction codes in the tag block of the selected sub-block, and determining whether the selected sub-block is a reliable data block according to the multiple identifiers, the multiple inverted identifiers, the multiple error correction codes, and the multiple inverted error correction codes; as well as When the selected sub-block is the reliable data block, reading the address information block of the selected sub-block to obtain storage address information of code information, The step of determining whether the selected sub-block is the reliable data block according to the multiple identifiers, the multiple inverted identifiers, the multiple error correction codes, and the multiple inverted error correction codes comprises: Calculate a first number of the plurality of identifiers equal to a first set value; Calculating a second number of the plurality of inversion identifiers equal to the first inversion setting value; When both the first number and the second number are not less than a first threshold value, reading the plurality of error correction codes and the plurality of inverse error correction codes; Selecting a selected error correction code and a selected inverse error correction code, wherein the selected error correction code and the selected inverse error correction code are complementary, and the selected error correction code and the selected inverse error correction code are respectively a standard error correction code and a standard inverse error correction code; calculating a third number of the plurality of error correction codes equal to the standard error correction code; calculating a fourth number of the plurality of inverse error correction codes equal to the standard inverse error correction code; and When both the third number and the fourth number are not less than a second threshold value, the selected sub-block is determined to be the reliable data block.
2. The search method according to claim 1, It is characterized in that The plurality of identifiers, the plurality of inverted identifiers, the plurality of error correction codes, and the plurality of inverted error correction code identifiers are alternately arranged in the tag block.
3. The search method according to claim 2, It is characterized in that The data of the multiple identifiers are the same, the data of the multiple inverted identifiers are the same, and the data content of each identifier is complementary to the corresponding inverted identifier.
4. The search method according to claim 2, It is characterized in that The data of the multiple error correction codes are the same, the data of the multiple inverted error correction codes are the same, and the data content of each of the error correction codes is complementary to the corresponding data content of each of the error correction codes.
5. The search method according to claim 1, It is characterized in that The address information block records a plurality of address information and a plurality of inverted address information in an interleaved arrangement, and the plurality of address information and the corresponding plurality of inverted address information form a plurality of address information pairs.
6. The search method according to claim 5, It is characterized in that Each of the address information includes a plurality of bytes, each of the inverted address information includes a plurality of bytes, Wherein, when the selected sub-block is the reliable data block, the step of reading the address information block of the selected sub-block to obtain the storage address information of the code information includes: Selecting one of the plurality of address information pairs as a standard address information pair, wherein the standard address information in the standard address information pair is complementary to the standard inverted address information; Comparing the standard address information with each of the address information byte by byte, and recording a plurality of first quantities for which the comparison results are the same; Determining whether each of the first numbers is greater than a first threshold value to record each of the bytes of the corresponding address information to obtain each byte of the storage address information; Comparing the standard inverted address information with each of the inverted address information byte by byte, and recording a plurality of second quantities whose comparison results are the same; and It is determined whether each of the second numbers is greater than a second threshold value to record each of the corresponding bytes of the inverted address information to obtain each byte of the inverted storage address information.
7. The search method according to claim 1, It is characterized in that The method also includes reading the code information from the memory according to the storage address information.
8. The search method according to claim 1, It is characterized in that The step of selecting one of the plurality of sub-blocks as the selected sub-block includes: A selection code is read, and one of the plurality of sub-blocks is selected according to the selection code to serve as the selected sub-block.
9. The search method according to claim 8, It is characterized in that Also includes: When the selected sub-block is not the reliable data block, the selection code is changed, and another one of the plurality of sub-blocks is selected as the selected sub-block.
10. The search method according to claim 1, It is characterized in that The identifier has a plurality of bits, and data contents of two adjacent bits in the plurality of bits are complementary.
11. A data storage device, It is characterized in that include: Memory, storing code information; as well as A controller, coupled to the memory, for: Distinguishing a storage block into a plurality of sub-blocks, each of the sub-blocks having a label block and an address information block, wherein the label block records a plurality of identifiers, a plurality of inverted identifiers, a plurality of error correction codes, and a plurality of inverted error correction codes; Selecting one of the plurality of sub-blocks as a selected sub-block; reading the multiple identifiers, the multiple inverted identifiers, the multiple error correction codes, and the multiple inverted error correction codes in the tag block of the selected sub-block, and determining whether the selected sub-block is a reliable data block according to the multiple identifiers, the multiple inverted identifiers, the multiple error correction codes, and the multiple inverted error correction codes; as well as When the selected sub-block is the reliable data block, the address information block of the selected sub-block is read to obtain the storage address information of the code information. The controller is also used to: Calculate a first number of the plurality of identifiers equal to a first set value; Calculating a second number of the plurality of inversion identifiers equal to the first inversion setting value; When both the first number and the second number are not less than a first threshold value, reading the plurality of error correction codes and the plurality of inverse error correction codes; Selecting a standard error correction code and a standard inverted error correction code, wherein the standard error correction code and the standard inverted error correction code are complementary; calculating a third number of the plurality of error correction codes equal to the standard error correction code; calculating a fourth number of the plurality of inverse error correction codes equal to the standard inverse error correction code; as well as When both the third number and the fourth number are not less than a second threshold value, the selected sub-block is determined to be the reliable data block.
12. The data storage device according to claim 11, It is characterized in that The data of the multiple identifiers are the same, the data of the multiple inverted identifiers are the same, and the data content of each identifier is complementary to the corresponding inverted identifier.
13. The data storage device according to claim 11, It is characterized in that The data of the multiple error correction codes are the same, the data of the multiple inverted error correction codes are the same, and the data content of each of the error correction codes is complementary to the corresponding data content of each of the error correction codes.
14. The data storage device according to claim 11, It is characterized in that The address information block records a plurality of address information and a plurality of inverted address information in an interleaved arrangement, and the plurality of address information and the corresponding plurality of inverted address information form a plurality of address information pairs.
15. The data storage device according to claim 14, It is characterized in that Each of the address information includes a plurality of bytes, each of the inverted address information includes a plurality of bytes, and the controller is further used for: Selecting one of the plurality of address information pairs as a standard address information pair, wherein a standard address information in the standard address information pair is complementary to a standard inverted address information; Comparing the standard address information with each of the address information byte by byte, and recording a plurality of first quantities for which the comparison results are the same; Determining whether each of the first numbers is greater than a first threshold value to record each of the bytes of the corresponding address information to obtain each byte of the storage address information; Comparing the standard inverted address information with each of the inverted address information byte by byte, and recording a plurality of second quantities whose comparison results are the same; and It is determined whether each of the second quantities is greater than a second threshold value to record each of the bytes of the corresponding inverted address information to obtain each byte of the inverted output position information.
16. The data storage device according to claim 11, It is characterized in that The controller is further used to read the code information from the memory according to the storage address information.
17. The data storage device according to claim 11, It is characterized in that Also includes: A selection code generator is coupled to the controller and is used to provide a selection code. The controller selects one of the plurality of sub-blocks as the selected sub-block according to the selection code.
18. The data storage device according to claim 17, It is characterized in that When the selected sub-block is not the reliable data block, the controller changes the selection code and selects another one of the plurality of sub-blocks as the selected sub-block.
