Data storage method and device, storage medium and computer equipment
By converting signed binary data into unsigned data and adding redundant bits, and writing and reading multi-valued memory cells one after another for correction, the problem of high power consumption and time consumption in the writing and verification process of multi-valued unit memory is solved. , improving memory performance and life.
Patent Information
- Application Number
- CN202410563934.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-08
- Publication Date
- 2024-08-23
AI Technical Summary
Multi-value unit memory consumes a lot of power and time during the writing and verification process, resulting in reduced memory performance and service life.
By converting the signed binary data to be stored into unsigned data and adding redundant bits, the multi-valued storage unit is written and read successively, and corrections are made based on the read results until the data is completely stored, avoiding the write verification process.
The accuracy of data storage is improved, the power consumption and time consumption of the memory are reduced, and the service life of the memory is extended.
Smart Images

Figure CN118535090A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of memory technology, and in particular to a data storage method, circuit, storage medium and computer equipment. Background Art
[0002] With the development of non-volatile memory, many new types of non-volatile memory have emerged, such as PCM (phase change memory), resistive random access memory, MRAM (magnetic random access memory), etc. These new memories have shown great potential in operating power consumption, integration density and process compatibility.
[0003] Multi-Level Cell (MLC) is an important concept in non-volatile memory technology. MLC technology can significantly improve the storage density of non-volatile memory. However, due to factors such as limited signal margin and device variation, these memories are susceptible to errors, and the error rate of multi-level cells is high. In order to cope with these challenges, write and verify methods are widely used.
[0004] Although the write and verify method can effectively suppress the error rate, it usually requires 3 to 10 write-verify iterations depending on the accuracy requirements of the multi-valued cells, which results in very high power consumption and time consumption of weight programming, ultimately leading to a serious degradation of the performance and service life of the memory. Summary of the invention
[0005] In view of this, the present application provides a data storage method, circuit, storage medium and computer device, the main purpose of which is to solve the technical problem that the power consumption and time consumption of data storage are large, resulting in a serious decline in the performance and service life of the memory.
[0006] According to a first aspect of the present invention, there is provided a data storage method, which is applied to a non-volatile memory, and comprises:
[0007] In response to the data storage instruction, acquiring data to be stored, wherein the data to be stored is signed binary data;
[0008] Converting the data to be stored into unsigned data, and adding a preset number of redundant bits to the unsigned data to obtain converted non-binary data;
[0009] The following steps are executed cyclically in order from high to low bits until all the non-binary data are written into the multi-value storage unit of the non-volatile memory: the data to be encoded in the non-binary data is written into a multi-value storage unit, and the data written in the multi-value storage unit is read, and the non-binary data not written into the multi-value storage unit is corrected according to the reading result.
[0010] According to a second aspect of the present invention, there is provided a data storage circuit, which is arranged in a non-volatile memory. The circuit includes a non-binary coding module, which is connected to a multi-value storage unit in the non-volatile memory and is used to implement the above-mentioned data storage method.
[0011] According to a third aspect of the present invention, there is provided a storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned data storage method is implemented.
[0012] According to a fourth aspect of the present invention, there is provided a computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned data storage method when executing the program.
[0013] The present invention provides a data storage method, circuit, storage medium and computer equipment. When storing data, the data to be stored is first converted into unsigned data, and redundant bits of a preset number of bits are added to the unsigned data to obtain the converted non-binary data. Then, in order from high to low, the data to be encoded in the non-binary data is written into a multi-value storage unit, and the data written in the multi-value storage unit is read out, and then the non-binary data not written into the multi-value storage unit is corrected according to the reading result, and the corrected data is stored in the next multi-value storage unit, and so on, until all the non-binary data are written into the multi-value storage unit of the non-volatile memory, so as to complete the data storage. The above method can improve the accuracy of data storage to the greatest extent by writing, reading, comparing and correcting the data stored in each multi-value storage unit in the process of data storage, reduce the influence of the high error rate of the multi-value unit memory encoding, and avoid the process of write verification, effectively reduce the operation of repeated reading and writing of the memory, reduce the power consumption and time consumption of the memory, reduce the degree of damage to the memory device, and improve the life of the memory.
[0014] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0016] Figure 1 A schematic diagram of the structure of a data storage circuit in the prior art provided by the present invention is shown;
[0017] Figure 2 A schematic diagram of a data storage method provided by an embodiment of the present invention is shown;
[0018] Figure 3 A schematic diagram showing a flow chart of another data storage method provided by an embodiment of the present invention;
[0019] Figure 4 A schematic structural diagram of a data storage circuit provided by an embodiment of the present invention is shown;
[0020] Figure 5 A schematic diagram showing a corresponding relationship between storage data and input and output values provided by an embodiment of the present invention;
[0021] Figure 6 A schematic diagram showing a corresponding relationship between an output value of storage data and a storage error rate provided by an embodiment of the present invention;
[0022] Figure 7 A schematic diagram showing a corresponding relationship between storage data and accuracy provided by an embodiment of the present invention;
[0023] Among them, Figure 2 In the figure, the circuit modules corresponding to each number are as follows:
[0024] 1- non-binary encoding module; 2- multi-value storage unit; 3- redundant bit; 4- readout circuit; 5- basis weight; 6- non-binary decoding module. DETAILED DESCRIPTION
[0025] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0026] Non-volatile memory refers to a type of memory that can retain stored information even after power is removed. Traditional non-volatile memory cells can usually only store two states, corresponding to one bit of information (0 or 1). In MLC technology, each memory cell is designed to store multiple bits of information, so that multiple bits of data can be represented in one memory cell. For example, in a double-layer cell (2-bit MLC), a memory cell can store four possible states (00, 01, 10, 11), which is equivalent to storing two bits of information, thereby improving the storage density of non-volatile memory. Furthermore, there are triple-layer cells (TLC) and quad-layer cells (QLC), which can store 3 bits of information and 4 bits of information, respectively.
[0027] In the prior art, the value represented by each memory cell of a multi-valued unit memory is usually based on base two, and the state of the memory corresponds to the represented value one by one. Figure 1 The basic principle of binary encoding of data in a multi-valued unit memory in the prior art is shown. Taking the storage of 8-bit data (IN<7:0>) as an example, assuming that each memory cell can store 2 bits of data (2 bits / cell), when storing data, 8 bits of data (bit 0 to bit 7) can be stored in 4 cells with a base of 2; when reading data, the read results can be directly spliced and read out in sequence (OUT<7:0>). However, due to the fluctuation of device parameters between devices and between cycles in non-volatile memory, in order to ensure the accuracy of data writing, multiple write and verification cycles may be required during the reading and writing process. For example, if a specific multi-value state is written, the storage controller will not only perform a write operation once, but also perform a read verification afterwards to confirm whether the written state meets the expectations. If the preset threshold is not reached, it needs to be adjusted and rewritten again. This process may be repeated 3 to 10 times, depending on the technical implementation and the required data reliability level. Each write and verification consumes power and time resources, especially when multiple iterations are required for successful programming, the accumulated power consumption and write delay will increase significantly. This not only directly affects the overall performance of the memory, but also has an impact on the service life of the memory. Since non-volatile memory has its inherent write endurance limitations, too many write operations will cause the memory to age faster and fail.
[0028] In order to solve the above-mentioned problem of large memory power consumption and time consumption, and serious degradation of memory performance and service life, in one embodiment, as Figure 2 As shown, a data storage method is provided, which is described by taking the method applied to an encoding module of a non-volatile memory as an example, and includes the following steps:
[0029] 101. In response to a data storage instruction, obtain data to be stored, wherein the data to be stored is signed binary data.
[0030] Specifically, when the memory receives a data storage instruction, the data to be stored can be obtained, wherein the data format of the data to be stored is signed binary data. In this embodiment, the memory can obtain the data to be stored in the form of signed binary data, or it can obtain the data to be stored in the form of signed binary data after performing data conversion processing on the acquired data. Among them, the signed representation of the data to be obtained can be a positive number, a negative number or zero. In the field of data storage, signed data is usually represented in the form of a binary complement, in which the highest bit (also called the sign bit) is used to indicate the positive or negative of the data. By obtaining signed binary data as the data to be stored, this embodiment can make the range of data storage cover positive numbers, negative numbers, zero and other data, and binary as the basic format for computer storage and processing of data can also improve the efficiency of data encoding.
[0031] 102. Convert the data to be stored into unsigned data, and add a preset number of redundant bits to the unsigned data to obtain converted non-binary data.
[0032] Specifically, after obtaining the data to be stored, the signed binary data to be stored can be subjected to data conversion, offset and other data processing to convert it into unsigned data. Among them, the purpose of the conversion is to eliminate the sign bit in the data so that all data are regarded as positive numbers or zero, thereby simplifying the subsequent data encoding process. Further, in order to enhance the reliability and robustness of the data, a preset number of redundant bits can be added to the unsigned data. These redundant bits do not contain any information of the original data, but they can provide additional error detection and correction capabilities during data storage. The number of redundant bits can be determined according to specific application scenarios and requirements, and is usually selected based on the importance of the data and the expected error tolerance, or is pre-set based on actual test results. After the above conversion and the addition of redundant bits, the converted non-binary data can be obtained. This means that the data no longer exists entirely in the traditional binary form of 0 and 1, but contains information in other forms or encoding methods to meet specific storage requirements. Such conversion and enhancement processing helps to ensure the integrity and accuracy of the data in subsequent encoding operations, thereby improving the performance and reliability of the data encoding process.
[0033] 103. Write the data to be encoded in the non-binary data into a multi-value storage unit in order from high bits to low bits.
[0034] Specifically, the data of each position in the non-binary data can be written into the multi-value storage unit of the corresponding position in order from high to low, wherein the process of data writing involves accurately mapping the data bits to different numerical states in the multi-value storage unit. For example, assuming that the data to be stored is 8-bit data, the redundant bit is 2 bits, and the converted non-binary data is 10-bit data, then according to the mapping relationship of data storage, the two highest bits of data in the non-binary data can be stored in the multi-value storage unit of the highest position, and so on, until the two lowest bits of data in the non-binary data are stored in the multi-value storage unit of the lowest position, thereby completing the data storage. In this scenario, 10 bits of non-binary data need to occupy a total of 5 multi-value storage units.
[0035] In the present embodiment, the sequential storage mode from high to low can help ensure the correct layout and access of data in the storage unit. In addition, the multi-value storage unit can store data of multiple different numerical states, and can provide more storage options and higher storage density compared to traditional binary storage units. Therefore, non-binary data is written into the multi-value storage unit, and its multi-value characteristics can be fully utilized to achieve effective and compact storage of data. It should be noted that the multi-value storage unit may face some challenges in the process of writing, such as state stability, read noise and other problems. Therefore, in the process of writing data into the multi-value storage unit, the problem of write error may occur.
[0036] 104. Read the data written in the multi-value storage unit, correct the non-binary data not written in the multi-value storage unit according to the reading result, and re-determine the data to be encoded in the non-binary data.
[0037] Specifically, step 103 and step 104 are a cyclic execution process, that is, each time step 103 executes the operation of writing the data to be encoded in the non-binary data into a multi-value storage unit, step 104 is executed once to read, compare and correct the written data. Among them, the process of data reading needs to be precisely controlled to ensure that the data stored in the storage unit can be accurately read. Further, after reading the numerical state in the multi-value storage unit, it can be verified whether the read data is the same as the data written in the non-binary data. If they are the same, no correction is required; if they are not the same, the non-binary data that has not yet been written into the multi-value storage unit needs to be corrected.
[0038] In the present embodiment, before non-binary data is written into the multi-value storage unit, redundant bits have been added in the non-binary data to improve the reliability of data. Therefore, by comparing the reading result with the original non-binary data, it is possible to detect whether a write error occurs in the data, and then utilize these redundant bits to correct the data that are not written into the storage unit, so as to restore the accuracy of the data. Further, after completing the data correction, the data to be encoded in the non-binary data can be re-determined, wherein the data to be encoded in the non-binary data refers to the data that are about to be written into the next multi-value storage unit in the non-binary data in the order from high position to low position. When the data read are inconsistent with the data written, the correction operation has changed some positions of the non-binary data, so it is necessary to write the non-binary data after the correction into the multi-value storage unit. In this way, it is possible to ensure that only the latest, corrected data are written into the storage unit, so as to improve the integrity and accuracy of the data.
[0039] 105. When all the non-binary data are written into the multi-value storage unit of the non-volatile memory, the storage of the data to be stored is completed.
[0040] Specifically, after all the non-binary data are written into the multi-value storage unit of the memory, it can be considered that the storage task of the data to be stored has been completed. At this point, the data to be stored has been safely stored in the non-volatile memory and can be read and used at any time when needed. In this embodiment, after the data storage is completed, the memory does not need to perform other additional operations such as reading and verification, so the power consumption and time consumption during data storage can be greatly reduced, and the performance and service life of the memory can be improved.
[0041] The data storage method provided in this embodiment can maximize the accuracy of data storage, reduce the impact of high error rate of multi-value unit memory encoding, and avoid the write verification process by successively writing, reading, comparing and correcting the data stored in each multi-value memory unit during the data storage process, effectively reduce the repeated reading and writing operations of the memory, reduce the power consumption and time consumption of the memory, reduce the degree of damage to the memory device, and increase the life of the memory.
[0042] In one embodiment, step 102 may be implemented by:
[0043] 102-1. Shift the data to be stored by a preset number of offset bits to obtain unsigned data, wherein the number of offset bits is determined according to the number of data bits of the data to be stored.
[0044] Specifically, after obtaining the data to be stored, the signed binary data to be stored can be offset to convert it into unsigned data. The purpose of the offset is to eliminate the influence of the sign bit so that the data can exist in an unsigned form to facilitate subsequent processing and storage. In this embodiment, the number of offset bits is determined based on the number of data bits of the data to be stored. Specifically, the number of bits to be offset can be calculated based on the actual number of bits of the data and the position of the sign bit. In this way, by appropriately moving the bit position of the data, the sign bit can be removed to obtain unsigned data. For example, when the data to be stored is 8-bit signed binary data, its highest bit is the sign bit. At this time, by offsetting the data by 128 (decimal value), 8-bit unsigned data can be obtained.
[0045] 102-2. Add a preset number of redundant bits to the unsigned data to obtain converted non-binary data, wherein the preset number of bits is an integer multiple of the number of data storage bits of the multi-value storage unit and is smaller than the number of bits of the unsigned data.
[0046] Specifically, after obtaining the unsigned data, redundant bits can be added to the unsigned data to generate converted non-binary data. The purpose of this step is to improve the robustness and reliability of the data to ensure that the data can detect and correct potential errors during storage. Among them, the redundant bits of the preset number of bits are determined according to the data storage bit number of the multi-value storage unit. In order to ensure that the data can adapt to the storage requirements of the multi-value storage unit, the selected redundant bits should be an integer multiple of the data storage bit number of the multi-value storage unit. For example, when the data storage bit number of the multi-value storage unit is two, the number of redundant bits can be set to be two. In this way, the storage capacity of the multi-value storage unit can be fully utilized while avoiding waste or truncation of data. At the same time, the selection of the redundant bits should also be less than the number of bits of the unsigned data to ensure that the increased redundant bits will not excessively increase the overall size of the data, thereby maintaining the compactness and efficiency of the data. After the above conversion, a non-binary data can be obtained, which not only contains the original unsigned data, but also increases the redundant bits to improve the reliability of the data. Next, these data will be ready to be written into the multi-value storage unit for storage.
[0047] In one embodiment, step 104 may be implemented by:
[0048] 104-1. Determine whether the data read from the multi-value storage unit is the same as the data to be encoded in the non-binary data.
[0049] Specifically, after writing the data to be encoded in the non-binary data into a multi-value storage unit, the written data can be read and checked to see whether the read data is the same as the written data. The purpose of this step is to verify whether the data in the multi-value storage unit is accurate and whether the written data has changed due to some reasons, such as noise, interference or hardware failure.
[0050] 104-2. If the data read from the multi-value storage unit is different from the data to be encoded in the non-binary data, the read data is assigned to the data to be encoded in the non-binary data.
[0051] Specifically, if it is found through comparison that the data read from the multi-value storage unit is inconsistent with the data to be encoded in the non-binary data, it means that the data in the multi-value storage unit may be wrong. In this case, in order to reduce the number of read and write times of data, the data written into the multi-value storage unit can be kept unchanged, and the read data can be assigned to the part to be encoded in the non-binary data. In this way, it is convenient to calculate the difference between the decoded value of the non-binary data that has been written with an error and the target value (the value corresponding to the data to be stored), so as to perform data error correction.
[0052] 104-3. Change the value of the non-binary data not written into the multi-value storage unit so that the difference between the decoded value of the changed non-binary data and the data to be stored is the smallest among all the differences.
[0053] Specifically, after assigning values to the data to be encoded in the non-binary data, the non-binary data that has not been written into the storage unit can be adjusted based on the assigned non-binary data. The goal of this step is to change the value of the non-binary data so that the difference between the decoded value and the original data to be stored is minimized. This step can be calculated using an existing optimization algorithm to ensure that the adjusted data can meet the storage requirements while retaining the characteristics and information of the original data as much as possible.
[0054] In an optional embodiment, step 104-3 can be implemented in the following manner: changing the value of the non-binary data not written in the multi-value storage unit, wherein the number of data changes is determined according to the value combination of the non-binary data not written in the multi-value storage unit; after each change of the value of the non-binary data not written in the multi-value storage unit, calculating the difference between the decoded value of the changed non-binary data and the data to be stored; determining the non-binary data corresponding to the smallest difference among all the differences, and determining the non-binary data corresponding to the smallest difference as the changed non-binary data.
[0055] Specifically, before writing non-binary data into a multi-value storage unit, a series of processing needs to be performed on the unwritten data part to ensure that the written data can be as close to the original data to be stored as possible and meet the storage requirements of the multi-value storage unit. First, it is necessary to determine the number of data changes. In this process, the number of data changes can be determined according to the numerical combination mode of the non-binary data not written into the multi-value storage unit. This usually involves a comprehensive consideration of the number of bits, encoding mode and storage capacity of the multi-value storage unit of the non-binary data. Through reasonable algorithms and strategies, it can be determined how many data change operations are required. Then, the value of the non-binary data can be changed. In this process, the value of the non-binary data not written into the multi-value storage unit can be changed in turn according to the determined number of times. These changes can be the values of replacing certain bits, and the purpose is to explore different numerical combinations to find the encoding mode closest to the data to be stored. Further, the difference can be calculated. That is, after each change in the value of the non-binary data, the difference between the value of the changed non-binary data after decoding and the data to be stored can be calculated. This difference reflects the degree of deviation between the current encoding mode and the original data. The smaller the difference, the closer the encoding method is to the original data. Further, the non-binary data corresponding to the minimum difference can be determined. In this process, the minimum difference can be found among all the calculated differences, and the non-binary data corresponding to the difference can be determined. This non-binary data is the encoding method that can be as close to the data to be stored as possible under the current conditions. Finally, the changed non-binary data can be determined, that is, by determining the non-binary data corresponding to the minimum difference as the changed non-binary data, these data will be used as candidate data for writing into the multi-value storage unit in the next step to ensure the accuracy and storage efficiency of the data.
[0056] Through the above steps, under the premise of ensuring data accuracy, by adjusting the numerical combination of non-binary data, the encoding method closest to the data to be stored can be found. This helps to reduce errors in the data storage and reading process and improve the performance and reliability of the multi-value storage system.
[0057] 104 - 4 . Determine the data to be written into the next multi-value storage unit in the changed non-binary data as the data to be encoded in the non-binary data.
[0058] Specifically, after adjusting the value of the non-binary data, the data in the non-binary data that is about to be written into the next multi-value storage unit can be determined as the data to be encoded in the non-binary data, so that the data to be encoded can be written into a multi-value storage unit in the next cycle. In this step, it is necessary to determine the part of the changed non-binary data to be written into the next storage unit as the data to be encoded. In this way, it can be written into the multi-value storage unit according to the new data order and format, thereby completing the updating and storage of data.
[0059] 104-5. If the data read from the multi-value storage unit is the same as the data to be encoded in the non-binary data, the data to be written into the next multi-value storage unit in the non-binary data is determined as the data to be encoded in the non-binary data.
[0060] Specifically, if the data read from the multi-value storage unit is consistent with the data to be encoded in the non-binary data, it means that the data in the multi-value storage unit is accurate. In this case, no adjustment or correction is required, and the part of the non-binary data to be written into the next storage unit is directly determined as the data to be encoded. In this way, the coherence and consistency of the data are guaranteed, and the efficiency of data processing is improved.
[0061] The above embodiment can ensure the consistency between the data in the multi-value storage unit and the non-binary data through the processing of the above five steps, and adjust and optimize the data that is not written into the storage unit when necessary, so as to achieve more efficient and reliable data storage and processing, avoid the process of writing and verifying the multi-value storage unit multiple times, and reduce the power consumption and time consumption in the storage process.
[0062] In one embodiment, a data storage method is provided, such as Figure 3 As shown, the method is applied to a decoding module of a non-volatile memory as an example for explanation, and the method includes the following steps:
[0063] 201. In response to a data read instruction, read data stored in a plurality of multi-valued storage units.
[0064] Specifically, when receiving a data read instruction, the memory can read the stored data in multiple multi-value storage cells. These multi-value storage cells have previously stored encoded and processed non-binary data. During the reading process, the memory will accurately control the access to the storage cells to ensure that the numerical state stored in each multi-value storage cell can be accurately obtained.
[0065] 202. Add the result of multiplying the data read from each multi-value storage unit by the base weight corresponding to the multi-value storage unit to obtain unsigned data to be read, wherein the base weight corresponding to the multi-value storage unit is predetermined according to the storage position of the redundant bit.
[0066] Specifically, after reading the data in multiple multi-valued storage cells, the memory can decode and convert the data. The key to this step is to use the base weight to restore the original unsigned data. Among them, each multi-valued storage cell has a corresponding base weight, and these base weights are predetermined according to the storage location of the redundant bits. By multiplying the data read in each storage cell with its corresponding base weight and adding all the results, the unsigned data to be read can be obtained. This process is actually part of the decoding process, which uses the redundant bits and base weight information added during storage to restore the original unsigned data.
[0067] 203. Convert the unsigned data to be read into signed binary data to obtain the data to be read.
[0068] Specifically, after obtaining the unsigned data to be read, it can be converted back to signed binary data so that the data can be correctly interpreted and used. This step usually involves rearranging the data bits and restoring the sign bits. Through appropriate conversion algorithms and processing logic, the unsigned data can be converted back to the original signed binary data format. In this way, we get the final data to be read, which can be used for further processing, calculation or output.
[0069] Through the above three steps, this embodiment can accurately read the stored data from multiple multi-value storage cells, and restore it to the original signed binary data through the decoding and conversion process for subsequent use. This reading and conversion mechanism ensures the integrity and accuracy of the data and improves the reliability and read-write performance of the multi-value storage system.
[0070] In one embodiment, a data storage method is provided, and a specific example is provided to illustrate the entire process of non-binary encoding and decoding. In this embodiment, an 8-bit storage scheme is used as an example. In this example, a redundant memory unit is added, and there are five memory units that support multiple values. This will add two redundant bits. These two redundant bits will be allocated to different positions according to the different base weights of the memory units. The final effect is that one value can correspond to multiple actual deployment schemes. Figure 4 As shown, the redundant bits are respectively allocated to bit 7 and bit 5. The following non-binary coding and decoding schemes all take this allocation scheme as an example.
[0071] The encoding process of 8-bit data is as follows: first, the input signed number is offset by 128 and converted to unsigned data (such as -1 offset 128 becomes 127). Secondly, the unsigned data IN<7:0> is encoded into any corresponding non-binary data INNB<9:0> (which contains two redundant bits), and the memory cell is programmed again from the high bit, and then the programmed value is read out and compared with the target value. If they are not equal, the current programming bit in INNB is updated to the read bit value, and the subsequent bits in INNB are updated to minimize the difference between the value of INNB and the target IN<7:0>. Finally, the above process is repeated to program the remaining bits. Until all programming is completed. Decoding process: First, each memory cell is read out, multiplied by the corresponding base weight, and finally these values are added to obtain the final output result.
[0072] The following is the detailed implementation process of each step:
[0073] Step 1: Convert the input signed number to a positive integer by shifting it by 128.
[0074] This step describes a method for converting an 8-bit signed integer to an equivalent 8-bit unsigned integer, especially for the case where the signed number is negative. In an 8-bit signed integer, the highest bit (the 7th bit) is usually used as the sign bit, 0 represents a positive number, 1 represents a negative number, and the remaining 7 bits are used to represent the magnitude of the value. In this scenario, assuming that w is an 8-bit signed integer, its valid value range is from -128 (-10000000) to 127 (01111111). In order to store this signed number as a positive integer, it can be achieved by offsetting the signed number by 128 (10000000) to ensure that all values (whether positive or negative) are positive in the new representation. The range of the converted unsigned positive integer becomes 0 (00000000) to 255 (11111111). In this way, all negative values are converted to positive values, and the value range is extended from 0 to 255. In short, the purpose of this conversion is to map a signed 8-bit integer to an unsigned 8-bit integer representation where all values are positive.
[0075] Step 2: Encode IN<7:0> into any corresponding INNB<9:0>, where INNB<9:0> contains two redundant bits.
[0076] In this step, it is necessary to expand the 8-bit binary data into 10-bit non-binary data, and at the same time, it is necessary to ensure that the 10-bit data contains two redundant bits, wherein the redundant bits can help detect and correct bit errors. In the initialization phase, the redundant bit can be any value between 0 and 1, and is usually set to 0. In this embodiment, the number of redundant bits is an integer multiple of the number of bits of data stored in the multi-valued unit. Taking the stored data as 8-bit data and the multi-valued storage unit as a double-layer unit as an example, the number of redundant bits can be set to 2, and the two redundant bits can be set at any position, for example, at the 5th and 7th positions (experimentally verified that the error rate of these two positions is the lowest), and the position of the redundant bit setting is related to the base weight to ensure that the encoded data can be decoded into the original data.
[0077] Step 3: Program the memory cell starting from the high bit, and loop the following steps until all the remaining bits are programmed: read the programmed value and compare it with the target value (original value). If they are not equal, update the bit to be encoded in INNB to the read bit value, and update the subsequent bits in INNB to minimize the difference between the value of INNB and the target IN<7:0>.
[0078] In this step, programming starts from the high bit, the purpose is to facilitate error correction of subsequent bits, so that the error between the encoded data and the original data is minimized, and the final memory stores the value obtained after error correction. This encoding method is suitable for storage and computing, and for scenarios where storage accuracy requirements are not very strict, such as storing values such as neural network weights in the field of artificial intelligence. In this scenario, the small error between the values has little effect on the final calculation result, and the degree of damage to the device is also small.
[0079] Step 4: Decode INNB<9:0> to IN<7:0> by reading the value in each memory cell, multiplying it by the corresponding basis weight, and adding these values to obtain the final output result.
[0080] In this step, the value read out is the value after error correction. The reading process directly multiplies the value stored in each unit according to the preset base weight, and then adds them together to obtain the final output result.
[0081] The above method can maximize the accuracy of data storage by reading, comparing and correcting the data stored in each unit during the storage process, avoiding repeated read and write operations, reducing the power consumption and time consumption of the memory, reducing the degree of device damage, and increasing the life of the memory.
[0082] The above technical effects can be verified by the following experimental data:
[0083] First, refer to Figure 5 , Figure 5 The corresponding relationship between the actual stored value and the input and output in the traditional binary coding and non-binary coding is shown. For illustration, the five units storing data in the non-binary coding scheme are represented by the traditional binary coding. Figure 5 As can be seen from the schematic diagram, after using the non-binary coding scheme, the redundancy and robustness of data storage can be effectively improved, and the error correction capability of the data can be improved.
[0084] Secondly, refer to Figure 6 , Figure 6 The comparison of storage error rates between the traditional binary scheme and the non-binary encoding scheme is shown. In the traditional scheme, the average storage error rate exceeds 30%, while in the non-binary encoding scheme, the average storage error rate is reduced by 24.13%. It can be seen that when storing 8-bit values and using 2 bits / unit, adding 2 bits of redundancy can reduce the average error rate to less than 10%, thereby effectively reducing the error rate of data storage.
[0085] Finally, refer to Figure 7 , Figure 7 The comparison results of the traditional binary solution and the non-binary encoding and decoding solution under the storage and computing integration are shown, using the ResNet8 network trained on the cifar10 dataset. Among them, the traditional test is based on multi-valued units without write verification. The final results show that after using the non-binary encoding and decoding solution, the application of neural network reasoning based on storage and computing integration is significantly better than the traditional situation.
[0086] It should be noted that the data involved in this application (including but not limited to stored data and read data, etc.) are all information and data authorized by the user or fully authorized by all parties. In addition, the numbers corresponding to the various steps in the above embodiments only serve as identification and are not used as a limitation on the order in which the steps are executed. The order in which the steps are executed in each embodiment can be set according to actual conditions.
[0087] Further, as Figure 2 , Figure 3 The specific implementation of the method shown in the embodiment provides a data storage circuit, which is arranged in a non-volatile memory, such as Figure 4 As shown, the circuit includes a non-binary coding module, wherein the non-binary coding module is connected to a multi-value storage unit in a non-volatile memory and can be used to implement the following method:
[0088] In response to the data storage instruction, acquiring data to be stored, wherein the data to be stored is signed binary data;
[0089] Converting the data to be stored into unsigned data, and adding a preset number of redundant bits to the unsigned data to obtain converted non-binary data;
[0090] The following steps are executed cyclically in order from high bit to low bit until all the non-binary data are written into the multi-value storage unit of the non-volatile memory: the data to be encoded in the non-binary data is written into a multi-value storage unit, and the data written in the multi-value storage unit is read, and the non-binary data not written into the multi-value storage unit is corrected according to the reading result.
[0091] In a specific application scenario, the non-binary encoding module can specifically implement the following steps: offset the data to be stored by a preset offset bit number to obtain the unsigned data, wherein the offset bit number is determined according to the number of data bits of the data to be stored; add a preset number of redundant bits to the unsigned data to obtain the converted non-binary data, wherein the preset number of bits is an integer multiple of the number of data storage bits of the multi-value storage unit and is less than the number of bits of the unsigned data.
[0092] In a specific application scenario, the non-binary encoding module can specifically implement the following steps: determine whether the data read from the multi-value storage unit is the same as the data to be encoded in the non-binary data; if the data read from the multi-value storage unit is not the same as the data to be encoded in the non-binary data, assign the read data to the data to be encoded in the non-binary data; change the value of the non-binary data not written in the multi-value storage unit so that the difference between the decoded value of the changed non-binary data and the data to be stored is the smallest among all differences; determine the data to be written into the next multi-value storage unit in the changed non-binary data as the data to be encoded in the non-binary data.
[0093] In a specific application scenario, the non-binary encoding module can specifically implement the following steps: changing the numerical value of the non-binary data not written in the multi-value storage unit, wherein the number of data changes is determined according to the numerical value combination of the non-binary data not written in the multi-value storage unit; after each change of the numerical value of the non-binary data not written in the multi-value storage unit, calculating the difference between the decoded numerical value of the changed non-binary data and the data to be stored; determining the non-binary data corresponding to the smallest difference among all the differences, and determining the non-binary data corresponding to the smallest difference as the changed non-binary data.
[0094] In a specific application scenario, the non-binary encoding module can specifically implement the following steps: if the data read from the multi-value storage unit is the same as the data to be encoded in the non-binary data, the data to be written into the next multi-value storage unit in the non-binary data is determined as the data to be encoded in the non-binary data.
[0095] In specific application scenarios, such as Figure 4 As shown, the data storage circuit further includes a non-binary decoding module, which is connected to the readout circuit of the multi-value storage unit in the non-volatile memory and can be used to implement the following method: in response to a data read instruction, read the data stored in a plurality of the multi-value storage units; add the result of multiplying the data read from each of the multi-value storage units with the base weight corresponding to the multi-value storage unit to obtain unsigned data to be read, wherein the base weight corresponding to the multi-value storage unit is predetermined according to the storage position of the redundant bit; convert the unsigned data to be read into signed binary data to obtain the data to be read.
[0096] It should be noted that other corresponding descriptions of the functional units involved in the data storage circuit provided in this embodiment can be referred to in Figure 2 and Figure 3 The corresponding description in will not be repeated here.
[0097] Based on the above Figure 2 , Figure 3 The method shown in the embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned Figure 2 , Figure 3 The data storage method shown.
[0098] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product. The software product to be identified can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0099] Based on the above Figure 2 , Figure 3 The method shown, and Figure 4In order to achieve the above-mentioned purpose, the present embodiment also provides a computer device for data storage, which can be a personal computer, a server, a smart phone, a tablet computer, a smart watch, or other network devices, etc. The computer device includes a storage medium and a processor; the storage medium is used to store computer programs and operating systems; the processor is used to execute computer programs to achieve the above-mentioned Figure 3 and Figure 4 The method shown.
[0100] Optionally, the computer device may further include an internal memory, a communication interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, a display, an input device such as a keyboard, etc. Optionally, the communication interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.
[0101] Those skilled in the art will appreciate that the computer device structure for identifying an operation action provided in this embodiment does not constitute a limitation on the computer device, and may include more or fewer components, or a combination of certain components, or different component arrangements.
[0102] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the above-mentioned computer device hardware and the software resources to be identified, and supports the operation of the information processing program and other software and / or programs to be identified. The network communication module is used to realize the communication between the components inside the storage medium, and the communication with other hardware and software in the information processing computer device.
[0103] Through the description of the above implementation mode, the technicians in this field can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by hardware. By applying the technical solution of the present application, the data to be stored is first converted into unsigned data, and redundant bits of a preset number of bits are added to the unsigned data to obtain the converted non-binary data, and then the data to be encoded in the non-binary data is written into a multi-value storage unit in the order from high to low, and the data written in the multi-value storage unit is read out, and then the non-binary data not written into the multi-value storage unit is corrected according to the reading result, and the corrected data is stored in the next multi-value storage unit, and so on, until all the non-binary data are written into the multi-value storage unit of the non-volatile memory, so as to complete the storage of data. Compared with the prior art, the above method can improve the accuracy of data storage, reduce the high error rate of multi-value unit memory encoding, and avoid the process of write verification, effectively reduce the operation of repeated reading and writing of the memory, reduce the power consumption and time consumption of the memory, reduce the degree of damage to the memory device, and thus improve the life of the memory.
[0104] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.
[0105] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.
Claims
1. A data storage method, characterized in that: The method is applied to a non-volatile memory, and the method comprises: In response to the data storage instruction, acquiring data to be stored, wherein the data to be stored is signed binary data; Converting the data to be stored into unsigned data, and adding a preset number of redundant bits to the unsigned data to obtain converted non-binary data; The following steps are executed cyclically in order from high bit to low bit until all the non-binary data are written into the multi-value storage unit of the non-volatile memory: the data to be encoded in the non-binary data is written into a multi-value storage unit, and the data written in the multi-value storage unit is read, and the non-binary data not written into the multi-value storage unit is corrected according to the reading result.
2. The method according to claim 1, characterized in that The step of converting the data to be stored into unsigned data and adding a preset number of redundant bits to the unsigned data to obtain converted non-binary data includes: The data to be stored is offset by a preset offset bit number to obtain the unsigned data, wherein the offset bit number is determined according to the data bit number of the data to be stored; A preset number of redundant bits is added to the unsigned data to obtain converted non-binary data, wherein the preset number of bits is an integer multiple of the number of data storage bits of the multi-value storage unit and is smaller than the number of bits of the unsigned data.
3. The method according to claim 1, characterized in that The correcting the non-binary data not written into the multi-value storage unit according to the reading result comprises: Determining whether the data read from the multi-value storage unit is the same as the data to be encoded in the non-binary data; If the data read from the multi-value storage unit is different from the data to be encoded in the non-binary data, assigning the read data to the data to be encoded in the non-binary data; Changing the value of the non-binary data not written into the multi-value storage unit so that the difference between the decoded value of the changed non-binary data and the data to be stored is the smallest among all the differences; The data to be written into the next multi-value storage unit in the changed non-binary data is determined as the data to be encoded in the non-binary data.
4. The method according to claim 3, characterized in that The step of changing the value of the non-binary data not written into the multi-value storage unit so that the difference between the decoded value of the changed non-binary data and the data to be stored is the smallest among all the differences comprises: Changing the value of the non-binary data not written into the multi-value storage unit, wherein the number of data changes is determined according to the combination of the values of the non-binary data not written into the multi-value storage unit; After each change in the value of the non-binary data not written into the multi-value storage unit, calculating the difference between the decoded value of the changed non-binary data and the data to be stored; The non-binary data corresponding to the smallest difference value is determined among all the difference values, and the non-binary data corresponding to the smallest difference value is determined as the changed non-binary data.
5. The method according to claim 3, characterized in that: The method further comprises: If the data read from the multi-value storage unit is the same as the data to be encoded in the non-binary data, the data to be written into the next multi-value storage unit in the non-binary data is determined as the data to be encoded in the non-binary data.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: In response to a data read instruction, reading data stored in a plurality of the multi-value storage units; Adding the result of multiplying the data read from each of the multi-valued storage cells by the base weight corresponding to the multi-valued storage cell to obtain the unsigned data to be read, wherein the base weight corresponding to the multi-valued storage cell is predetermined according to the storage position of the redundant bit; The unsigned data to be read is converted into signed binary data to obtain the data to be read.
7. A data storage circuit, characterized in that: The circuit is arranged in a non-volatile memory, and comprises a non-binary coding module, wherein the non-binary coding module is connected to a multi-value storage unit in the non-volatile memory and is used to implement the method according to any one of claims 1 to 5.
8. The circuit according to claim 7, characterized in that The circuit further comprises a non-binary decoding module, wherein the non-binary encoding module is connected to a readout circuit of a multi-value storage unit in the non-volatile memory and is used to implement the method according to claim 6.
9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
