Random number seed generator and method thereof
Through an improved random number seed generator, physical address processing is used to generate random number seeds, which solves the correlation problem between adjacent physical pages, improves data randomness and reading correctness, and achieves more efficient data storage and error identification.
Patent Information
- Application Number
- CN202010181840.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-16
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2040-03-16
AI Technical Summary
In the prior art, the random number seed generator has a high correlation between adjacent physical pages, which affects the randomness of data in the NVM chip and makes it difficult to identify whether the data output by the NVM chip comes from the correct physical address.
A random number seed generator consisting of a random number register, selector, XOR unit and mask register is used to generate a random number seed by processing the physical address. It is combined with XOR operation and error correction coding to ensure the randomness and correctness of data when writing and reading.
The randomness of data in the NVM chip is improved, the correlation between adjacent physical pages is reduced, and the correctness of the read data can be effectively identified, reducing the probability of errors.
Smart Images

Figure CN113407155B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to a random number seed generator for data randomization, a method implemented by the random number seed generator, and a storage device using the random number seed generator. Background Art
[0002] See Figure 1 , shows a block diagram of a storage device. Storage device 102 is coupled to a host to provide storage capabilities for the host. The host and storage device 102 can be coupled via various methods, including but not limited to connecting the host and storage device 102 via, for example, SATA, IDE, USB, PCIE, NVMe (NVM Express), SAS, Ethernet, Fibre Channel, or a wireless communication network. The host can be an information processing device capable of communicating with the storage device via the aforementioned methods, such as a personal computer, tablet, server, portable computer, network switch, router, cellular phone, or personal digital assistant. Storage device 102 includes an interface 103, a control unit 104, one or more NVM (non-volatile memory) chips 105, and optionally, firmware memory 110. Interface 103 can be adapted to exchange data with the host via, for example, SATA, IDE, USB, PCIE, NVMe, SAS, Ethernet, or Fibre Channel. The control component 104 is used to control data transmission between the interface 103, the NVM chip 105, and the firmware memory 110. It is also used for storage management, mapping host logical addresses to flash physical addresses, erase leveling, bad block management, etc. The control component 104 can be implemented in various ways such as software, hardware, firmware, or a combination thereof. The control component 104 can be in the form of an FPGA (Field-Programmable Gate Array), an ASIC (Application Specific Integrated Circuit), or a combination thereof. The control component 104 can also include a processor or a controller. The control component 104 loads firmware from the firmware memory 110 during operation. The firmware memory 110 can be a NOR flash memory, a ROM, an EEPROM, or can also be part of the NVM chip 105.
[0003] Control unit 104 includes a flash memory interface controller (also known as a media interface controller or flash memory lane controller). The flash memory interface controller is coupled to NVM chip 105 and issues commands to NVM chip 105 in accordance with the interface protocol of NVM chip 105 to operate NVM chip 105, and receives command execution results output from NVM chip 105. Known NVM chip interface protocols include "Toggle" and "ONFI".
[0004] A memory target is one or more logical units (LUs) within a NAND flash memory package that share a chip enable (CE) signal. Each LU has a LU number (LUN). A NAND flash memory package may include one or more dies. Typically, a LU corresponds to a single die. A LU may include multiple planes. Multiple planes within a LU can be accessed in parallel, while multiple LUs within a NAND flash memory chip can execute commands and report status independently of each other. The prior art also provides definitions of targets, LUs, LUNs, and planes.
[0005] Data on storage media is typically stored and read in pages. Data is erased in blocks. A block (also called a physical block) contains multiple pages. Pages on storage media (called physical pages) have a fixed size, for example, 17,664 bytes. Physical pages can also have different sizes.
[0006] NVM chips, such as NAND flash memory, require that data written to them possess certain statistical properties. For example, the number of "0s" and "1s" must be roughly equal, avoiding consecutive "0s" or "1s," and the "0s" and "1s" stored in the memory cells surrounding a physical memory cell must be roughly evenly spaced. To meet these requirements, data is scrambled before being written to the NVM chip, randomizing the data being written.
[0007] Figure 2 Schematic diagram of the data scrambling method in the prior art.
[0008] Randomizer 200 is used to scramble data to be written to the NVM chip. It includes an m-sequence generator 210 and an exclusive-OR unit. The exclusive-OR unit performs an exclusive-OR operation on the input data and the output of the m-sequence generator 210, generating output data corresponding to the input data as the result of scrambling the input data. A random number seed is provided to the m-sequence generator 210.
[0009] For example, to write data to a physical page P of an NVM chip, the physical address of physical page P is used as a random number seed to initialize the m-sequence generator 210. The entire page of input data is divided into small blocks corresponding to the size of the m-sequence generator 210. Each small block of data is sequentially provided to the XOR unit and XORed with the value output by the m-sequence generator 210. The XOR result serves as the scrambled data. After performing the XOR operation on each small block, the m-sequence generator 210 advances to generate a new value.
[0010] When reading data from physical page P, a similar approach is used to descramble the read data to obtain the original data. For example, the physical address of physical page P is used as a seed to initialize the m-sequence generator. Each small block of read data is XORed with the value of the m-sequence generator to obtain the corresponding small block of original data, and the m-sequence generator is advanced.
[0011] There are also other random number generator structures in the prior art. For example, Chinese utility model patent ZL 2016 21458968.X provides another randomized scrambler and randomized descrambler.
[0012] NVM chips are also rapidly developing, with the emergence of 3D NAND storage media, where each memory cell stores 1 bit (SLC), 2 bits (MLC), 3 bits (TLC), or even more bits of data. 3D NAND consists of multiple layers in the Z direction (perpendicular to the wafer plane) of the wafer on which it is stored. A physical block sets word lines on each layer.
[0013] Figure 3 Shows the architecture diagram of 3D NAND storage media.
[0014] A 3D NAND flash memory chip includes multiple physical blocks arranged in the XY direction ( Figure 3 Block 0 and block 200 are shown in FIG). Physical blocks include multiple layers, Figure 3 Layers L3, L4, L30, and L31 are shown in Figure 1. Each layer comprises multiple sectors (segments 0 through 3 are shown). Each sector comprises a wordline. Taking TLC storage media as an example, a wordline comprises three physical pages, which are referred to as the LSB (least significant bit) page, CSB (center significant bit) page, and MSB (most significant bit) page. Each physical page has a unique physical address. Physical pages in the NVM chip are accessed using the physical address. The physical address may or may not represent the physical location of the physical page in the storage medium.
[0015] The need for randomization of data written into the NVM chip is also related to the spatial location of the data being written. For example, the LSB page, CSB page, and MSB page of the same block share the same word line. In addition to hoping that the data written into each physical page is random, it is also hoped that the data written into the LSB page, CSB page, and MSB page of the same word line have no correlation or minimal correlation. It is also hoped that the data written into these three physical pages will make the potential (or charge) recorded by each storage cell in the word line also random. Still as an example, see Figure 3Block 0 of layer L3 and block 0 of layer L4 of physical block 0 are located at the same position on the XY plane and are adjacent on the Z axis. Therefore, it is desirable that the physical pages belonging to these two blocks 0 have no correlation or minimal correlation. Similarly, it is desirable that the physical pages belonging to the same physical block and adjacent blocks of the same layer (for example, block 0 and block 1) have no correlation or minimal correlation.
[0016] With the development of NVM chips, there will be new requirements for the randomness of data written into NVM chips.
[0017] In the prior art, physical page addresses are commonly used as random number seeds. However, since the physical addresses of adjacent physical pages are often adjacent, the random number seeds used for adjacent physical pages have a strong correlation, for example, the difference between the two random number seeds is 0.
[0018] Figure 4 Shows the bit differences between seeds applied to adjacent physical pages when the physical page address is used as the random number seed.
[0019] The bit difference represents the number of times the same or different bits in the same position of two binary numbers occur. Figure 4 In the example, the random number seeds used by all physical pages in a physical block are counted. In many cases, for two binary numbers with adjacent values, only one bit differs while the other bits are the same. Summary of the Invention
[0020] Using physical page addresses as random number seeds results in a high correlation between random number seeds applied to adjacent physical pages. Adjacent physical pages are likely to be physically adjacent to each other on the storage medium, which affects the randomness of data written to the storage medium. It is desirable to improve or eliminate this effect.
[0021] The NVM chip outputs the read data in response to a read command. However, some NVM chips have defects, and in response to a read command accessing physical address P1, data at physical address P2 is output. However, it is difficult for the control unit of the storage device to be aware of the occurrence of this error. In order to check that the data output by the NVM chip is from the accessed address, the data written to the NVM chip is related to the physical address to which the data is written. For example, the physical address is used as a random number seed to scramble the data to be written. Therefore, when data is read from a specified address of the NVM chip, a random number seed is generated again using the specified address. If the regenerated random number seed is consistent with the random number seed read from the NVM chip, it means that the data output by the NVM chip is from the accessed address. Otherwise, it means that the NVM chip may have provided data from an incorrect address. However, this further increases the correlation between the random number seeds used by adjacent physical pages.
[0022] It is also desirable for the scrambled data to exhibit sufficient randomness. For example, the values of each bit of the data in a physical page are random, there is low or no correlation between data in spatially related (e.g., adjacent) physical pages, there is low or no correlation between data in physical pages belonging to the same word line, and the voltage distribution of each memory cell in the word line is random.
[0023] According to a first aspect of the present application, a first random number seed generator according to the first aspect of the present application is provided, comprising a random number register, a selector and an XOR unit; the random number register stores a plurality of random numbers; the input signal of the random number seed generator is coupled to a control end of the selector; the selector generates an index based on the input signal of the random number seed generator, selects one of the plurality of random numbers stored in the random number register and provides the index to the XOR unit; the input signal of the random number seed generator is also coupled to the input of the XOR unit, and the output of the XOR unit serves as a random number seed generated by the random number seed generator based on the input signal.
[0024] According to the first random number seed generator of the first aspect of the present application, a second random number seed generator according to the first aspect of the present application is provided, further comprising an AND gate and a mask register; the output of the XOR unit is coupled to the AND gate; the output of the mask register is also coupled to the AND gate; the AND gate performs an AND operation on the output of the XOR unit and the output of the mask register; the output of the AND gate serves as a random number seed generated by the random number seed generator according to an input signal; wherein the value of the mask register is used to select a specified bit of the output of the XOR unit through the AND gate.
[0025] According to the first or second random number seed generator of the first aspect of the present application, there is provided a third random number seed generator according to the first aspect of the present application, wherein the input signal of the random number seed generator is a physical address for accessing a storage medium.
[0026] According to the third random number seed generator of the first aspect of the present application, a fourth random number seed generator according to the first aspect of the present application is provided, wherein the first part of the bits of the physical address are coupled to the selector as a control signal of the selector; the second part of the bits of the physical address are coupled to the XOR unit; and the number of the first part of the bits is less than the number of the second part of the bits.
[0027] According to the fourth random number seed generator of the first aspect of the present application, there is provided a fifth random number seed generator according to the first aspect of the present application, wherein the number of bits of the first part is suitable for indexing the random number stored in the random number register.
[0028] According to the second aspect of the present application, a first random number seed generator according to the second aspect of the present application is provided, comprising a random number register, a selector, an XOR unit, an address selection unit, a multiplier and an adder; the input of the random number seed generator is coupled to the address selection unit; the address selection unit outputs a first part of bits and a second part of bits of the input of the random number seed generator; the first part of bits output by the address selection unit is coupled to the input of the multiplier; the second part of bits output by the address selection unit is coupled to the input of the adder; the output of the multiplier is coupled to the input of the adder; the random number register stores multiple random numbers; the selector selects one of the multiple random numbers stored in the random number register according to the output of the adder and provides it to the XOR unit; the XOR unit is also coupled to the index output by the adder; the output of the XOR unit serves as the random number seed generated by the random number seed generator according to the input signal.
[0029] According to the first random number seed generator of the second aspect of the present application, a second random number seed generator according to the second aspect of the present application is provided, further comprising an AND gate and a mask register; the output of the XOR unit is coupled to the input of the AND gate; the output of the mask register is also coupled to the input of the AND gate; the AND gate performs an AND operation on the output of the XOR unit and the output of the mask register; the output of the AND gate serves as a random number seed generated by the random number seed generator according to an input signal; wherein the value of the mask register is used to select a specified bit of the output of the XOR unit through the AND gate.
[0030] According to the first or second random number seed generator of the second aspect of the present application, there is provided a third random number seed generator according to the second aspect of the present application, wherein the input signal of the random number seed generator is a physical address for accessing a storage medium.
[0031] According to one of the first to third random number seed generators of the second aspect of the present application, a fourth random number seed generator according to the second aspect of the present application is provided, wherein the multiplier performs a multiplication operation on the first part of bits output by the address selection unit and a specified value, and the product is the output of the multiplier.
[0032] According to the third random number seed generator of the second aspect of the present application, a fifth random number seed generator according to the second aspect of the present application is provided, wherein the first part output by the address selection unit is the number of the physical block indicated by the physical address within the independent unit; the second part output by the address selection unit is the number of the physical page indicated by the physical address within the physical block.
[0033] According to the fourth random number seed generator of the second aspect of the present application, there is provided a sixth random number seed generator according to the second aspect of the present application, wherein the designated value is the number of physical pages within the physical block.
[0034] According to a third aspect of the present application, a first randomized scrambler according to the third aspect of the present application is provided, comprising one of the random number seed generators according to the first and second aspects of the present application, a random number generation unit, and a second XOR unit; the output of the random number seed generator is coupled to the random number generation unit; the output of the random number generation unit is coupled to the second XOR unit; the second XOR unit performs an XOR operation on data to be scrambled and the output of the random number generation unit.
[0035] According to the first randomized scrambler of the third aspect of the present application, a second randomized scrambler according to the third aspect of the present application is provided, the random number seed generated by the random number seed generator is provided to the random number generation unit; and the random number generation unit generates a random number according to the random number seed.
[0036] According to the first or second randomized scrambler of the third aspect of the present application, a third randomized scrambler according to the third aspect of the present application is provided, wherein the physical address of the storage medium to which the data is to be written is used as the input of the random number seed generator; and the data to be written to the storage medium is used as the input of the second XOR unit.
[0037] According to a fourth aspect of the present application, a first method for a storage device according to the fourth aspect of the present application is provided, comprising: obtaining data to be written to a storage device and a physical address of a storage medium of the storage device carrying the data; generating a random number seed using the physical address by means of one of the random number seed generators described above; scrambling the data using the random number seed; and writing the scrambled data and the random number seed into a storage medium using the physical address.
[0038] According to the first method for a storage device according to the fourth aspect of the present application, a second method for a storage device according to the fourth aspect of the present application is provided, wherein error correction encoding is performed on the scrambled data and the random number seed to obtain check data; and the scrambled data, the check data and the random number seed are written to a storage medium using the physical address.
[0039] According to the first method for a storage device according to the fourth aspect of the present application, a third method for a storage device according to the fourth aspect of the present application is provided, which also includes: in response to reading data from a storage medium using a first physical address, generating a first random number seed using the first physical address by the random number seed generator described in the first and second aspects of the present application, and obtaining a second random number seed from the read data; if the first random number seed is different from the second random number seed, identifying that there is an error in the data read from the storage medium using the first physical address.
[0040] According to the third method for a storage device according to the fourth aspect of the present application, a fourth method for a storage device according to the fourth aspect of the present application is provided, which also includes: if the first random number seed is the same as the second random number seed, identifying that the data read from the storage medium using the first physical address is correct.
[0041] According to the second method for a storage device according to the fourth aspect of the present application, a fifth method for a storage device according to the fourth aspect of the present application is provided, which also includes: in response to reading data from a storage medium using a first physical address, performing error checking decoding on the read data, generating a first random number seed using the first physical address through one of the random number seed generators described above, and obtaining a second random number seed from the data obtained by the error checking decoding; if the first random number seed is different from the second random number seed, identifying that there is an error in the data read from the storage medium using the first physical address.
[0042] According to the fifth method for a storage device according to the fourth aspect of the present application, a sixth method for a storage device according to the fourth aspect of the present application is provided, which also includes: if the first random number seed is the same as the second random number seed, identifying that the data read from the storage medium using the first physical address is correct.
[0043] According to a fifth aspect of the present application, a method for generating a random number seed for data of a physical address to be written to a storage medium according to the first aspect of the fifth aspect of the present application is provided, comprising: selecting a first part of the physical address as an index, obtaining a first random number from a plurality of random numbers; performing an XOR operation on the first random number with the second part of the physical address; and obtaining a random number seed using the result of the XOR operation.
[0044] According to the first method of the fifth aspect of the present application for generating a random number seed for data of a physical address to be written to a storage medium, a second method of generating a random number seed for data of a physical address to be written to a storage medium according to the fifth aspect of the present application is provided, wherein a specified mask is used to select some bits of the result of the XOR operation as the random number seed.
[0045] According to the first or second method of the fifth aspect of the present application, a method of generating a random number seed for data of a physical address to be written to a storage medium is provided, wherein the number of bits of the first part of the physical address is less than the number of bits of the second part.
[0046] According to the first method of the fifth aspect of the present application for generating a random number seed for data of a physical address to be written to a storage medium, a fourth method of generating a random number seed for data of a physical address to be written to a storage medium according to the fifth aspect of the present application is provided, wherein a block number and a page number are extracted from the physical address; the extracted block number is multiplied by the number of pages in the block, and then the extracted page number is added, and a specified bit of the result is used as an index to obtain a first random number from multiple random numbers; an XOR operation is performed on the obtained result and the first random number, and a random number seed is obtained using the result of the XOR operation.
[0047] According to the fourth method of the fifth aspect of the present application for generating a random number seed for data of a physical address to be written to a storage medium, a fifth method of generating a random number seed for data of a physical address to be written to a storage medium according to the fifth aspect of the present application is provided, wherein a specified mask is used to select some bits of the result of the XOR operation as the random number seed.
[0048] According to the sixth aspect of the present application, a first method for a storage device according to the sixth aspect of the present application is provided, comprising: obtaining data to be written to the storage device and a physical address of a storage medium of the storage device carrying the data; generating a random number seed for the physical address according to one of the methods described in the fifth aspect of the present application; scrambling the data to be written to the storage device using the random number seed; and writing the scrambled data and the random number seed into the storage medium using the physical address.
[0049] According to the first method for a storage device according to the sixth aspect of the present application, a second method for a storage device according to the sixth aspect of the present application is provided, wherein error correction encoding is performed on the scrambled data and the random number seed to obtain verification data; and the scrambled data, the verification data and the random number seed are written to a storage medium using the physical address.
[0050] According to the first method for a storage device according to the sixth aspect of the present application, a third method for a storage device according to the sixth aspect of the present application is provided, which also includes: in response to reading data from a storage medium using a first physical address, generating a first random number seed for the first physical address according to one of the above methods, and obtaining a second random number seed from the read data; if the first random number seed is different from the second random number seed, identifying that there is an error in the data read from the storage medium using the first physical address.
[0051] According to the third method for a storage device according to the sixth aspect of the present application, a fourth method for a storage device according to the sixth aspect of the present application is provided, which also includes: if the first random number seed is the same as the second random number seed, identifying that the data read from the storage medium using the first physical address is correct.
[0052] According to the second method for a storage device according to the sixth aspect of the present application, a fifth method for a storage device according to the sixth aspect of the present application is provided, which also includes: in response to reading data from a storage medium using a first physical address, performing error checking decoding on the read data, generating a first random number seed for the first physical address according to one of the above methods, and obtaining a second random number seed from the data obtained by the error checking decoding; if the first random number seed is different from the second random number seed, identifying that there is an error in the data read from the storage medium using the first physical address.
[0053] According to the fifth method for a storage device according to the sixth aspect of the present application, a sixth method for a storage device according to the sixth aspect of the present application is provided, further comprising: if the first random number seed is the same as the second random number seed, identifying that the data read from the storage medium using the first physical address is correct.
[0054] According to the seventh aspect of the present application, a first method for a storage device according to the seventh aspect of the present application is provided, comprising: in response to reading data from a storage medium using a first physical address, generating a first random number seed for the first physical address according to one of the methods described in the fifth aspect of the present application; and obtaining a second random number seed from the read data; if the first random number seed is different from the second random number seed, identifying that there is an error in the data read from the storage medium using the first physical address.
[0055] According to the first method for a storage device according to the seventh aspect of the present application, a second method for a storage device according to the seventh aspect of the present application is provided, including: if the first random number seed is the same as the second random number seed, identifying that the data read from the storage medium using the first physical address is correct.
[0056] According to the eighth aspect of the present application, a first method for a storage device according to the eighth aspect of the present application is provided, comprising: in response to reading data from a storage medium using a first physical address, performing error checking and decoding on the read data, generating a first random number seed for the first physical address according to one of the methods described in the fifth aspect of the present application, and obtaining a second random number seed from the data obtained by the error checking and decoding; if the first random number seed is different from the second random number seed, identifying that there is an error in the data read from the storage medium using the first physical address.
[0057] According to the first method for a storage device according to the eighth aspect of the present application, a second method for a storage device according to the eighth aspect of the present application is provided, which also includes: if the first random number seed is the same as the second random number seed, identifying that the data read from the storage medium using the first physical address is correct.
[0058] According to the ninth aspect of the present application, a first storage device according to the ninth aspect of the present application is provided, comprising a memory, a processor, and a program stored on the memory and runnable on the processor, characterized in that when the processor executes the program, it implements one of the methods for a storage device according to the sixth aspect of the present application, one of the methods for a storage device according to the seventh aspect, or one of the methods for a storage device according to the eighth aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0060] Figure 1 is a block diagram of a storage device of the prior art;
[0061] Figure 2 A schematic diagram of a data scrambling method in the prior art;
[0062] Figure 3 Shows the architecture diagram of 3D NAND storage media;
[0063] Figure 4 Shows the bit differences between seeds applied to adjacent physical pages when the physical page address is used as the random number seed;
[0064] Figure 5 A schematic diagram of generating data written into an NVM chip according to an embodiment of the present application is shown;
[0065] Figure 6 A block diagram of a random seed generator according to an embodiment of the present application is shown;
[0066] Figure 7 Shows the basis Figure 6 An embodiment of the present invention is applied to bit differences of seeds of adjacent physical pages; and
[0067] Figure 8 A block diagram of a random seed generator according to another embodiment of the present application is shown. DETAILED DESCRIPTION
[0068] The following is a clear and complete description of the technical solutions in the embodiments of this application in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection requested by this application.
[0069] Figure 5 A schematic diagram of generating data written into an NVM chip according to an embodiment of the present application is shown.
[0070] User data 552 is generated by a user's write command to the storage device. Physical address 550 is the address of the NVM chip assigned by the storage device to carry user data 552. Random number seed generator 510 generates a random number seed 560 based on physical address 550. Randomizer 520 generates scrambled user data 562 based on random number seed 560 and user data 552.
[0071] Random number seed 560 and scrambled user data 562 are provided to ECC (Error Correction Code) encoder 540. ECC encoder 540 uses the combination of random number 560 and scrambled user data 562 as a message codeword and generates check data 566 based on a parity check matrix (not shown). Random number seed 560, scrambled user data 562, and check data 566 are written to the NVM chip.
[0072] When reading data from the NVM chip, the ECC decoder decodes the data, and the decoded data includes a random number seed 560. The random number seed is generated using the physical address used to read the data in the same manner as when writing the data. The random number seed 560 read from the NVM chip is compared with the random number seed generated based on the physical address to determine whether the data read from the NVM chip is from the specified physical address.
[0073] Figure 6 A block diagram of a random number seed generator according to an embodiment of the present application is shown.
[0074] The random number seed generator 600 includes a random number register 610 , a selector 620 , an XOR unit 630 , an AND gate 640 , and a mask register 644 .
[0075] The random number register 610 stores a plurality of random numbers. For example, the random number register 610 stores 32, 64, or more random numbers. Each random number stored in the random number register 610 can be accessed individually. The selector 620 provides an index to the random number register 610 for selecting one of the stored random numbers.
[0076] Data 680 is the data to be written to the NVM chip, and physical address 682 indicates the physical address of the NVM chip assigned to carry the data to be written. Some bits of physical address 682 are truncated and provided to selector 620, which uses them as an index to select the random number stored in random number register 610. The random number selected by selector 620 is provided to XOR unit 630. Physical address 682 is also provided to XOR unit 630. XOR unit 630 performs an XOR operation on the random number selected by selector 620 and physical address 682, and outputs the XOR result to AND gate 640.
[0077] By using physical address 682 as an index to select a random number, the random number seeds calculated from physical address 682 are free from any correlation with each other. For example, random number register 610 stores 32 random numbers, and the lower 5 bits of physical address 682 are used as an index, so that the correlation between the random numbers selected based on 32 consecutive physical addresses is minimized. Between every 32 physical addresses, the random number is reused, causing a certain correlation between the corresponding random number seeds. Alternatively, by increasing the size of random number register 610 so that it can store a larger number of random numbers, the probability of random numbers being reused is reduced, and the correlation between the corresponding random number seeds is also reduced. Since the number of physical pages of the NVM chip is large, providing a dedicated random number for each physical page will result in a very large number of random numbers and occupy a large amount of storage space, which is not feasible in practice. In order to establish a stronger correlation between the random number seed and the physical address so that the physical address and random number seed can be used to check whether the data provided by the NVM chip comes from the correct accessed physical address, the physical address 682 needs to be directly used in the calculation of the random number seed, and the number of random number seeds generated can be increased (much greater than the number of random numbers stored in the random number register 610).
[0078] Continue to read Figure 6 The input of XOR unit 630 is provided to AND gate 640. AND gate 640 performs a bitwise AND operation on the output of XOR unit 630 and the value stored in mask register 644. The calculation result is provided to random number generation unit 660. The value stored in the mask register is, for example, 0x7FFF, which is used to intercept specified bits from the output of XOR unit 630 to adapt to the input port of random number generation unit 660. The output of AND gate 640 is the random number seed obtained by random number seed generator 600 from physical address 682.
[0079] The random number generation unit 660 is, for example, an m-sequence generator, including an LFSR (Linear Feedback Shifting Register) generator, a CS6 sequence generator, an AI CS6 sequence generator, or a NERO sequence generator.
[0080] The random number generation unit 660 generates a random number based on the random number seed and provides it to the XOR unit 670. The XOR unit 670 performs an XOR operation on the data 680 using the random number provided by the random number generation unit 660 to scramble the data 680. The scrambled data is then written into the NVM chip.
[0081] According to an optional embodiment, error correction check data is also generated based on the scrambled data. The scrambled data, the random number seed generated by the random number seed generator 600 to obtain the scrambled data, and the check data are all written together into the NVM chip. When reading data from the NVM chip, the physical address used to read the data is denoted as P1. The random number seed generator 600 generates a random number seed (denoted as RS1) based on physical address P1. The random number seed (denoted as RS2) is extracted from the data read from the NVM chip. Optionally, error correction decoding is first performed on the data read from the NVM chip, and the random number seed RS2 is extracted from the decoding result. RS1 and RS2 are compared to determine whether they are identical to check whether the data read from the NVM chip is from physical address P1. Optionally, if it is determined that the data read from the NVM chip is not from physical address P1, an error has occurred. The error is addressed by, for example, attempting to reread the data at physical address P1 from the NVM chip, or by using other data recovery or reconstruction methods to obtain the data that should be stored at physical address P1.
[0082] Figure 7 Shows the basis Figure 6 The embodiments are applied to bit differences of seeds of adjacent physical pages.
[0083] according to Figure 6 The bit difference of the random number seeds applied to adjacent physical pages generated by the embodiment is distributed between 4 bits and 12 bits, and the statistical value corresponding to the number of each difference bit is the same. Figure 4 Compared with , the distribution is more uniform. Figure 6 The random number seed generator of the embodiment generates a random number seed applied to each physical page with higher quality and lower correlation between the random number seeds corresponding to each physical page. Figure 6 The embodiment does not introduce complex calculations, and the cost of generating random number seeds is low.
[0084] Figure 8 A block diagram of a random seed generator according to another embodiment of the present application is shown.
[0085] The random seed generator 800 includes a random number register 810 , a selector 820 , an XOR unit 830 , an AND gate 840 , a mask register 844 , an independent unit address selection unit 822 , a multiplier 824 , and an adder 826 .
[0086] The random number register 810 stores a plurality of random numbers.
[0087] Data 880 is data to be written into the NVM chip, and physical address 882 indicates the physical address of the NVM chip allocated to carry the data to be written.
[0088] The independent unit address selection unit 822 intercepts some bits of the physical address 882. The independent unit includes, for example, a die (DIE), a logic unit (LUN), or a plane of an NVM chip. Figure 8 In an embodiment, a random number seed is generated for each physical page of an independent unit. The random number seeds corresponding to the physical pages of multiple independent units may be the same. For example, the portion of bits of the physical address 882 intercepted by the independent unit address selection unit 822 are bits used to address the physical blocks and physical pages within the independent unit. Optionally, the portion of bits of the intercepted physical address 882 also include bits addressing a data frame of a physical page, where the physical page includes two, four, or another number of data frames.
[0089] Based on the partial bits of the intercepted physical address 882, the independent unit address selection unit 822 outputs a block number 884 representing the physical block and an intra-block page number 886 representing the physical page. Block number 884 is the number of the physical block accessed by physical address 882, and the intra-block page number is the number of the physical page accessed by physical address 882 within the physical block to which it belongs. The random number seed generator 800 is also configured to record an intra-block page number 888, which indicates the number of physical pages within the physical block of the NVM chip used by the storage device.
[0090] Block number 884 and page number 888 within the block are provided to multiplier 824. Multiplier 824 outputs the multiplication result of block number 884 and page number 888 within the block and provides it to adder 826. Page number 886 within the block is also provided to adder 826. Adder 826 adds the result output by multiplier 826 and page number 886 within the block, and the result is used as physical page index 889. Thus, physical page index 889 is a unique number of all physical pages within the independent unit to which the physical page accessed by physical address 882 belongs.
[0091] Some bits of physical page index 889 are truncated and provided to selector 820, which uses them as an index to select a random number stored in random number register 810. The random number selected by selector 820 is provided to XOR unit 830. Physical page index 889 is also provided to XOR unit 830. XOR unit 830 performs an XOR operation on the random number selected by selector 820 and physical page index 889, and outputs the XOR result to AND gate 840.
[0092] Since the physical addresses of the physical pages are distributed discontinuously in the physical address space, some of the values are not used. However, the random numbers in the random number register 810 are stored continuously. Therefore, the random number index obtained by truncating the physical address will make some random numbers unable to be indexed, resulting in a waste of random numbers. Figure 8 embodiment, relative to Figure 6In this embodiment, the physical pages within the individual units are renumbered, each assigned a unique number, and the values of this number are continuous within the value space. The random number index generated from this number (physical page index 889) can utilize each random number stored in the random number register 810.
[0093] Continue to read Figure 8 The input of XOR unit 830 is provided to AND gate 840. AND gate 840 performs a bitwise AND operation on the output of XOR unit 830 and the value stored in mask register 844, and the calculation result is provided to random number generation unit 860. The output of AND gate 840 is the random number seed obtained by randomization seed generator 800 from physical address 882.
[0094] The random number generation unit 860 generates a random number based on a random number seed and provides the random number to the XOR unit 870. The XOR unit 870 performs an XOR operation on the data 8880 using the random number provided by the random number generation unit 860 to scramble the data 880.
[0095] Although preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic inventive concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of this application. Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if such changes and modifications fall within the scope of the claims of this application and their equivalents, then this application is intended to include such changes and modifications.
Claims
1. A random number seed generator, comprising a random number register, a selector, an XOR unit, an address selection unit, a multiplier, and an adder; An input of the random number seed generator is coupled to the address selection unit; The address selection unit outputs a first portion of bits and a second portion of bits of the input of the random number seed generator; The first portion of bits output by the address selection unit is coupled to an input of the multiplier; The second portion of bits output by the address selection unit is coupled to the input of the adder; The output of the multiplier is coupled to the input of the adder; The random number register stores multiple random numbers; A selector selects one of the multiple random numbers stored in the random number register according to the output of the adder and provides the selected number to the exclusive OR unit; The XOR unit is also coupled to the index output by the adder; The output of the XOR unit is used as a random number seed generated by the random number seed generator according to the input signal; The input signal of the random number seed generator is a physical address for accessing a storage medium.
2. The random number seed generator according to claim 1, further comprising an AND gate and a mask register; The output of the XOR unit is coupled to the input of the AND gate; the output of the mask register is also coupled to the input of the AND gate; The AND gate performs an AND operation on the output of the XOR unit and the output of the mask register; The output of the AND gate serves as a random number seed generated by the random number seed generator according to the input signal; The value of the mask register is used to select a specified bit of the output of the XOR unit through the AND gate.
3. The random number seed generator according to any one of claims 1-2, wherein the multiplier performs a multiplication operation on the first part of bits output by the address selection unit and a specified value, and the product is the output of the multiplier.
4. The random number seed generator according to claim 3, wherein the first part output by the address selection unit is the number of the physical block indicated by the physical address within the independent unit; and the second part output by the address selection unit is the number of the physical page indicated by the physical address within the physical block.
5. The random number seed generator of claim 4, wherein the specified value is the number of physical pages within a physical block.
6. A randomized scrambler comprising the random number seed generator according to any one of claims 1 to 5, a random number generation unit, and a second XOR unit; The output of the random number seed generator is coupled to the random number generation unit; An output of the random number generating unit is coupled to the second XOR unit; The second XOR unit performs an XOR operation on the data to be scrambled and the output of the random number generation unit; The physical address of the storage medium where data is to be written is taken as input to the random number seed generator.
7. The randomization scrambler according to claim 6, wherein the random number seed generated by the random number seed generator is provided to the random number generation unit; and the random number generation unit generates a random number according to the random number seed.
8. The randomizing scrambler according to claim 6 or 7, wherein the data to be written to the storage medium is taken as input to the second XOR unit.
9. A method for storing a device, comprising: Obtaining data to be written into a storage device and a physical address of a storage medium of the storage device carrying the data; Generate a random number seed using the physical address by using the random number seed generator according to any one of claims 1 to 5; Scrambling the data using the random number seed; The scrambled data and the random number seed are written into a storage medium using the physical address.
10. The method according to claim 9, wherein: Also includes: In response to reading data from a storage medium using a first physical address, generating a first random number seed using the first physical address by the random number seed generator according to any one of claims 1 to 5, and obtaining a second random number seed from the read data; If the first random number seed is different from the second random number seed, it is recognized that the data read from the storage medium using the first physical address has an error.
11. The method according to claim 10, wherein error correction coding is performed on the scrambled data and the random number seed to obtain check data; and the scrambled data, the check data and the random number seed are written into a storage medium using the physical address.
12. The method according to claim 10, further comprising: In response to reading data from a storage medium using a first physical address, error checking and decoding are performed on the read data, a first random number seed is generated using the first physical address by the random number seed generator described in one of claims 1 to 5, and a second random number seed is obtained from the data obtained by the error checking and decoding; if the first random number seed is different from the second random number seed, it is recognized that there is an error in the data read from the storage medium using the first physical address.
13. The method according to claim 12, further comprising: If the first random number seed is the same as the second random number seed, it is recognized that the data read from the storage medium using the first physical address is correct.
Citation Information
Patent Citations
Change scrambler at random and change descrambler at random
CN206470746U
Random number seed generator and randomized scrambler
CN211454576U
Nonvolatile memory device and nonvolatile memory system and random data read method thereof
US20120272017A1