CN115357523A - Randomization method and data reading and writing method - Google Patents

Randomization method and data reading and writing method Download PDF

Info

Publication number
CN115357523A
CN115357523A CN202210800195.2A CN202210800195A CN115357523A CN 115357523 A CN115357523 A CN 115357523A CN 202210800195 A CN202210800195 A CN 202210800195A CN 115357523 A CN115357523 A CN 115357523A
Authority
CN
China
Prior art keywords
data
write
random
erase count
digit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210800195.2A
Other languages
Chinese (zh)
Inventor
约翰·普莱斯特
桑尼·赖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Rongming Microelectronics Jinan Co ltd
Original Assignee
Rongming Microelectronics Jinan Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Rongming Microelectronics Jinan Co ltd filed Critical Rongming Microelectronics Jinan Co ltd
Priority to CN202210800195.2A priority Critical patent/CN115357523A/en
Publication of CN115357523A publication Critical patent/CN115357523A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The invention discloses a randomization method and a data reading and writing method, which comprise the following steps: generating base value data based on a physical address of a target write sector and a write/erase count of a current block of write data; providing a random data table, and searching random numbers from the random data table based on the base value data; and executing a logic operation based on the searched random number to generate a random seed according to the result of the logic operation. The embodiment of the invention generates the base value data based on the physical address and the write/erase count, so that the generated random number has better randomness, thereby improving the reliability of flash data.

Description

Randomization method and data reading and writing method
Technical Field
The invention relates to the technical field of storage, in particular to a randomization method and a data reading and writing method.
Background
The Flash data stored in the SSD needs to be randomized, and if the Flash data is not random enough, the Flash data will interfere with each other.
Typically, the data is randomized prior to writing to flash memory by a scrambler, the ability of which to generate random data is controlled by its decision and seed. The seed is the starting point for the scrambler to generate the random number sequence.
In current storage schemes, nand Flash is often used as a storage device. Compared with the method that only one Cell (bit) in a Single bit memory Cell (Single Level, SLC) stores 2bits (bit), the method increases the Level threshold value and increases the probability of bit (bit) inversion. Because the Nand Flash has low reliability, the reliability of the Nand Flash needs to be ensured when in use, all zero or all one data cannot be written in, and adjacent data are ensured to be different as much as possible.
Random seeds generated by a conventional method, if the same data is written into a nearby sector, the seeds are almost the same, and the scrambled data has insufficient randomness.
Disclosure of Invention
The embodiment of the invention provides a randomization method and a data reading and writing method, which are used for enabling the randomness of flash data to be better and improving the reliability of the flash data, and the generation of random numbers does not only depend on physical addresses, so that a scrambler can realize better randomness of the flash data.
The embodiment of the invention provides a randomization method, which comprises the following steps:
generating base value data based on a physical address of a target write sector and a write/erase count of a current block of write data;
providing a random data table, and searching a random number from the random data table based on the base value data;
and executing a logic operation based on the searched random number to generate a random seed according to the result of the logic operation.
Optionally, the physical address of the target write sector includes: lun, block, page, plane, and sector numbers;
generating base value data based on the physical address of the target write sector and the write/erase count of the current block of write data comprises:
base value data of a target number of bits is generated based on a physical address of the target write sector and a value of a specified number of bits of a write/erase count of the current block.
Optionally, the random data table contains a specified number of random numbers;
looking up a random number from the random data table based on the base value data comprises:
dividing the generated base value data of the target digit into a plurality of sub-value data with the same digit;
using the sub-value data as an index, and inquiring a random number based on the random data table;
and forming the random numbers obtained by query into the random numbers with the required target digits according to the reverse order of the splitting order.
Optionally, executing a logical operation based on the found random number to generate a random seed according to a result of the logical operation includes:
carrying out XOR operation on the found random number of the target digit and the shifted copy of the first digit;
the result of the XOR operation with the shift copy of the first digit is then XOR-operated with the shift copy of the second digit;
and carrying out XOR operation on the result of the XOR operation with the shifted copy of the second digit and the shifted copy of the third digit, wherein the first digit, the second digit and the third digit are different.
Optionally, after the logic operation is performed, the method further includes:
and repeatedly searching for the random number by taking the result of the logic operation as base value data to generate a random seed.
In the alternative,
the write/erase count for the current block is stored as metadata in memory, and the metadata is written in SLC mode;
for an area storing a write/erase count, determining base value data directly based on a physical address of a corresponding write sector to generate a random seed for the area;
in the case of a memory restart, a retrieval is performed to obtain a write/erase count of the corresponding area.
Optionally, in the case that the current block loses metadata of the write/erase count, the write/erase count is restored by:
assigning a value Y to the write/erase count of the current block based on the number X of erroneous erases in the current block;
generating a random seed based on Y +1, and reading data by using the generated random seed;
and if the data reading is wrong, repeating Y +1 to generate the random seed until the data reading is correct so as to determine that the current block loses the write/erase count value.
The application also provides a data reading and writing method, which comprises the following steps:
under the condition of data writing, the random seed generated by the randomization method is written into a hardware register of the scrambler, and the hardware register of the scrambler scrambles data by using the generated random seed, transmits the scrambled data to a flash memory controller and sends the scrambled data to the flash memory;
in the case of data reading, the random seed generated by the foregoing randomization method is written into a hardware register of the scrambler, and data is read from the flash memory, and the hardware register of the scrambler descrambles the read data by using the generated random seed.
The present application also proposes a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the aforementioned method.
The embodiment of the invention generates the base value data based on the physical address and the write/erase count, so that the generated random number has better randomness, thereby improving the reliability of flash data.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a basic flow diagram of a randomization method according to an embodiment of the present application;
FIG. 2 is an example of a process for writing data using a random seed generated according to an embodiment of the present application;
fig. 3 is a flowchart illustrating a data reading process using a random seed generated according to an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
An embodiment of the present invention provides a randomization method, as shown in fig. 1, including:
in step S101, base value data is generated based on the physical address of the target write sector and the write/erase count of the current block of write data. In particular, the lifetime of an SSD is limited to its number of reads and writes. It is more likely that programming and erasing the same memory cell will result in the memory cell being permanently damaged. To avoid this, a special algorithm called "Wear-Leveling" is deployed into the SSD in order to distribute the erase/write cycles evenly across all storage units of the SSD. Therefore, continuous erasing/writing operation on the same storage unit is avoided, and the service life of the SSD is effectively prolonged. To ensure wear leveling of SSDs, a Flash Translation Layer (FTL) is typically used to provide management of logical to physical address mappings while erase count management is performed on flash and invalid block mappings. The number of times each block is erased is recorded in a table called an Erase Count Table (ECT). When a block is erased once, the ECT automatically increments the number of times the block is erased. In this example, the base value data is generated based on the physical address of the target write sector and the write/erase count of the current block of the write data, and specifically, a value of a fixed bit (bit) may be generated as the base value data, for example, 32bits of base value data.
In step S102, a random data table is provided, and a random number is looked up from the random data table based on the base value data. A particular random data table may include a plurality of random numbers, such as 256. It is thus possible to look up the random number in the random data table based on the aforementioned 32bits base value data.
In step S103, a logical operation is performed based on the found random number to generate a random seed according to the result of the logical operation. In this example, the found random number is further subjected to a logical operation, and thus a random seed is generated according to a result of the logical operation.
The embodiment of the invention generates the base value data based on the physical address and the write/erase count, thereby generating the random number with better randomness, and further improving the reliability of the flash data.
In some embodiments, the physical address of the target write sector comprises: lun, block, page, plane, and sector numbers.
Generating base value data based on the physical address of the target write sector and the write/erase count of the current block of write data comprises:
base value data of a target number of bits is generated based on a physical address of the target write sector and a value of a specified number of bits of a write/erase count of the current block. Again, taking the base value data for generating 32bits as an example in this example, the write/erase count of the current block of write data may be based, for example, only the lower 6 bits of the write/erase count may be used, or other bits may be used. Namely mod (write/erase count, 64).
In some embodiments, the random data table contains a specified number of random numbers;
looking up a random number from the random data table based on the base value data comprises:
and splitting the generated base value data of the target digit into a plurality of sub-value data with the same digit.
And taking the sub-value data as an index, and inquiring random numbers based on the random data table. For example, the 32bits base value data can be divided into 4 8-bit numbers as the index of the random number table, the random number can be searched, and the specific splitting mode can also be determined according to the actual requirement.
And forming the random numbers obtained by query into the random numbers with the required target digits according to the reverse order of the splitting order. Taking 4 numbers of 8 bits as an example, the 4 numbers of 8 bits of the query can be put back into one 32bits data in reverse order.
In some embodiments, performing a logical operation based on the found random number to generate a random seed according to a result of the logical operation comprises:
and carrying out exclusive OR operation on the searched random number of the target digit and the shifted copy of the first digit.
The result of the exclusive-or operation with the shifted copy of the first digit is then exclusive-or operated with the shifted copy of the second digit.
And performing XOR operation on the result of the XOR operation with the shifted copy of the second digit and the shifted copy of the third digit, wherein the first digit, the second digit and the third digit are different.
Further introduced in this example is also or shift operation, such as exclusive or of the 32-bit data obtained based on the aforementioned query with its 13-bit shifted copy. And then exclusive-ored with its 17-bit shifted copy. Then the 5-bit shifted copy is xored again, and the result is returned, which is also 32bits of data.
In some embodiments, after performing the logical operation, further comprising:
and repeatedly searching for the random number by taking the result of the logic operation as base value data to generate a random seed.
Specifically, the aforementioned operations of querying the random data table and shifting the random data table may be repeated multiple times based on the result value of shifting the random data table or the result value of shifting the random data table, and the result of the multiple operations may be used as the random seed, thereby further increasing the randomness of the obtained random seed.
In some embodiments, the write/erase count for the current block is stored as metadata in memory, and the metadata is written in SLC mode. The metadata is written in SLC mode in this example. SLC mode is less susceptible to data randomness than other SSDs written in TLC mode. Metadata is rather random compared to other data.
In some specific examples, the write/erase count is stored as metadata on the SSD, and the write/erase count of the metadata is not known at power up. For the region where the write/erase count is stored in this example, the base value data is determined directly based on the physical address of the corresponding write sector to generate a random seed for the region. The random seed generated for the area in which the metadata is stored thus does not contain the write/erase count, whereby a search can be performed to obtain the write/erase count for the corresponding area in case of a memory reboot, thereby enabling reading out the write/erase count without knowing the write/erase count.
In some scenarios, if the metadata storing the write/erase count is lost, the scrambler seed will be erroneous, and descrambling will not return the correct data during data read. Since the data is protected by the data correction code, the read-back data can be determined to be correct or not. That is, in some embodiments, in the event that the current block loses metadata of the write/erase count, the write/erase count is restored by:
based on the number of erroneous erasures X of the current block, a value Y is assigned to the write/erase count of the current block. In this example, the number of erroneous erasures X of the current block may be determined as the write/erase count value Y of the current block.
And generating a random seed based on Y +1, and reading data by using the generated random seed. Since the stored write/erase counts can only be from 0 to 63, using different scrambler seed read retries generated from write/erase counts 0 to 63 in this example, Y is set to 0 if Y +1= 64.
And if the data reading is wrong, repeating Y +1 to generate the random seed until the data reading is correct so as to determine that the current block loses the write/erase count value.
With respect to the characteristics of SSDs, the seed generation method of the present disclosure ensures that even a small change in physical address or write/erase count results in a very different seed, thereby greatly improving randomness. The problem of scrambler duplication in the time dimension is solved.
The reliability of the metadata is improved by adopting optimization (SLC mode) for the storage mode of the metadata. And meanwhile, erasing counting information is not used in a scrambling mode of the metadata, so that the metadata can be normally read when being electrified. Aiming at the special condition of metadata loss, the method for recovering the data is further provided, and the reliability and the fault tolerance of the storage system are improved.
The application also provides a data reading and writing method, which comprises the following steps:
in the case of data writing, as shown in fig. 2, the random seed generated by the foregoing randomization method is written into the hardware register of the scrambler, and the hardware register of the scrambler scrambles the data by using the generated random seed and transfers the scrambled data to the flash memory controller, and sends the data to the flash memory;
in the case of data reading, as illustrated in fig. 3, the random seed generated using the foregoing randomization method is written to a hardware register of the scrambler, and data is read from the flash memory, and the hardware register of the scrambler descrambles the read data using the generated random seed.
The present application also proposes a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the aforementioned method.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a component of' 8230; \8230;" does not exclude the presence of another like element in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (9)

1. A randomization method, comprising:
generating base value data based on a physical address of a target write sector and a write/erase count of a current block of write data;
providing a random data table, and searching random numbers from the random data table based on the base value data;
and executing a logic operation based on the searched random number to generate a random seed according to the result of the logic operation.
2. The randomization method of claim 1, wherein the physical address of the target write sector comprises: lun, block, page, plane, and sector numbers;
generating base value data based on the physical address of the target write sector and the write/erase count of the current block of write data comprises:
base value data of a target number of bits is generated based on a physical address of the target write sector and a value of a specified number of bits of a write/erase count of the current block.
3. The randomization method of claim 2, wherein the random data table contains a specified number of random numbers;
looking up a random number from the random data table based on the base value data comprises:
dividing the generated base value data of the target digit into a plurality of sub-value data with the same digit;
using the sub-value data as an index, and inquiring a random number based on the random data table;
and forming the random numbers obtained by query into the random numbers with the required target digits according to the reverse order of the splitting order.
4. The randomization method of claim 3, wherein performing a logical operation based on the found random numbers to generate a random seed according to a result of the logical operation comprises:
carrying out XOR operation on the found random number of the target digit and the shifted copy of the first digit;
the result of the XOR operation with the shift copy of the first digit is then XOR-operated with the shift copy of the second digit;
and carrying out XOR operation on the result of the XOR operation with the shifted copy of the second digit and the shifted copy of the third digit, wherein the first digit, the second digit and the third digit are different.
5. The randomization method of claim 4, after performing the logical operation, further comprising:
and repeatedly searching for the random number by taking the result of the logic operation as base value data to generate a random seed.
6. The randomization method of claim 1, wherein the write/erase count for the current block is stored in memory as metadata, and the metadata is written in SLC mode;
for an area storing a write/erase count, determining base value data directly based on a physical address of a corresponding write sector to generate a random seed for the area;
in the case of a memory restart, a retrieval is performed to obtain a write/erase count of the corresponding area.
7. The randomization method of claim 6, wherein in case a current block loses metadata of the write/erase count, the write/erase count is restored by:
assigning a value Y to the write/erase count of the current block based on the number X of erroneous erases in the current block;
generating a random seed based on Y +1, and reading data by using the generated random seed;
and if the data reading is wrong, repeating Y +1 to generate the random seed until the data reading is correct so as to determine that the current block loses the write/erase count value.
8. A method for reading and writing data, comprising:
in case of data writing, writing a random seed generated using the randomization method as recited in any of claims 1-7 into a hardware register of a scrambler, which scrambles data using the generated random seed and transfers it to a flash memory controller and transmits it to a flash memory;
in case of data reading, the data is read from the flash memory by writing a random seed generated by the randomization method of any of claims 1-7 into a hardware register of the scrambler, which descrambles the read data by using the generated random seed.
9. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 8.
CN202210800195.2A 2022-07-08 2022-07-08 Randomization method and data reading and writing method Pending CN115357523A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210800195.2A CN115357523A (en) 2022-07-08 2022-07-08 Randomization method and data reading and writing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210800195.2A CN115357523A (en) 2022-07-08 2022-07-08 Randomization method and data reading and writing method

Publications (1)

Publication Number Publication Date
CN115357523A true CN115357523A (en) 2022-11-18

Family

ID=84032613

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210800195.2A Pending CN115357523A (en) 2022-07-08 2022-07-08 Randomization method and data reading and writing method

Country Status (1)

Country Link
CN (1) CN115357523A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102208210A (en) * 2010-03-31 2011-10-05 深圳市朗科科技股份有限公司 Flash memory device and data storage method thereof
CN102543182A (en) * 2010-12-14 2012-07-04 炬力集成电路设计有限公司 Randomization circuit, memory control unit, memory, communicating system and method
CN103403670A (en) * 2011-06-03 2013-11-20 株式会社东芝 Semiconductor memory device for pseudo-random number generation
CN109542394A (en) * 2017-09-22 2019-03-29 爱思开海力士有限公司 Controller, semiconductor memory system and the storage system with them

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102208210A (en) * 2010-03-31 2011-10-05 深圳市朗科科技股份有限公司 Flash memory device and data storage method thereof
CN102543182A (en) * 2010-12-14 2012-07-04 炬力集成电路设计有限公司 Randomization circuit, memory control unit, memory, communicating system and method
CN103403670A (en) * 2011-06-03 2013-11-20 株式会社东芝 Semiconductor memory device for pseudo-random number generation
CN109542394A (en) * 2017-09-22 2019-03-29 爱思开海力士有限公司 Controller, semiconductor memory system and the storage system with them

Similar Documents

Publication Publication Date Title
KR100526190B1 (en) Remapping method for flash memory
KR101482242B1 (en) Method for accessing flash memory and associated flash memory controller
US8397101B2 (en) Ensuring a most recent version of data is recovered from a memory
US10218503B2 (en) Encryption key storage and modification in a data storage device
US20180321874A1 (en) Flash management optimization for data update with small block sizes for write amplification mitigation and fault tolerance enhancement
US7702844B2 (en) Address mapping method and mapping information managing method for flash memory, and flash memory using the same
KR101587464B1 (en) System, method and memory device providing data scrambling compatible with on-chip copy operation
JP6112595B2 (en) Erase management in memory systems
US8370561B2 (en) Randomizing for suppressing errors in a flash memory
CN104572489B (en) Wear leveling method and device
KR101517185B1 (en) Memory system and operating method thereof
CN112596667B (en) High throughput method and system for organizing NAND blocks and placing data in a solid state drive to facilitate random writing
US20120278529A1 (en) Selective Purge of Confidential Data From a Non-Volatile Memory
US10417122B2 (en) Data randomization using memory block access counts
US10489246B2 (en) Data storage device and data maintenance method thereof
KR20080085574A (en) Apparatus and method for garbage collection of non-volatile memory
US20110016263A1 (en) Method for performing data pattern management regarding data accessed by a controller of a flash memory, and associated memory device and controller thereof
US20100064094A1 (en) Memory managing method for non-volatile memory and controller using the same
JP6994136B1 (en) Monotonic counter in memory
TW201131572A (en) Solid state storage system for controlling reserved area and method of controlling the same
JP2010079486A (en) Semiconductor recording device
CN111913890A (en) Non-volatile memory random read-write method based on security module
US8996786B2 (en) Nonvolatile memory system and block management method
CN115357523A (en) Randomization method and data reading and writing method
TWI661300B (en) Data management method for memory and memory apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination