Data storage methods, devices, electronic equipment and storage media
By designing OTP storage schemes for different data types and utilizing difference calculation and bit-inverting operations, the problems of long programming time and high power consumption of antifuse OTP are solved, achieving efficient data storage.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
- Filing Date
- 2026-01-30
- Publication Date
- 2026-06-02
AI Technical Summary
In existing technologies, antifuse-type OTP storage results in excessively long programming times and high power consumption due to the formation of numerous conducting circuits, making it impossible to effectively optimize the data storage format.
Two OTP data storage schemes are designed based on data types. By using difference calculation or bitwise inversion operations, the number of preset values in the data to be stored can be reduced or maintained, thereby reducing the number of OTP programming operations and power consumption.
It effectively reduces the programming time and power consumption of OTP, improves programming efficiency, and adapts to the storage needs of different data types.
Smart Images

Figure CN122131971A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data storage technology, and more specifically to data storage methods, apparatus, electronic devices, and storage media. Background Technology
[0002] One-Time Programmable (OTP) memory is a type of non-volatile memory that can only be written to once. Data is not lost when power is off. Once data is written to an OTP, it cannot be modified or erased; the OTP permanently stores the written data.
[0003] When using an antifuse-type OTP to store data, a high-voltage breakdown of the insulation layer forms a conductive circuit, programming the corresponding data bit to 1, thus writing 1 bit of information to the OTP. When the number of data points with the value 1 in the stored data increases, the number of OTP programming operations increases, resulting in more conductive circuits and higher leakage current, leading to excessive power consumption. Furthermore, the time required to break down the insulation layer is also relatively long, resulting in excessively long programming time when storing data to the OTP. Summary of the Invention
[0004] This invention provides a data storage method, apparatus, electronic device, and storage medium to solve the problem that when using OTP to store data, it is necessary to form a large number of conducting circuits in OTP, resulting in excessively long OTP programming time and excessively high OTP power consumption.
[0005] In a first aspect, this application provides a data storage method, the method comprising:
[0006] Determine the data to be stored and its data type; According to the data storage strategy corresponding to the data type, the data to be stored is adjusted and the adjusted data to be stored is written to the preset storage device. The data storage strategy is used to reduce or maintain the number of preset values in the data to be stored.
[0007] Secondly, this application provides a data storage device, the device comprising: The information determination module is used to determine the data to be stored and the data type of the data to be stored. The data adjustment and storage module is used to adjust the data to be stored according to the data storage strategy corresponding to the data type, and write the adjusted data to be stored to a preset storage device. The data storage strategy is used to reduce or maintain the number of preset values in the data to be stored.
[0008] Thirdly, this application provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the data storage method of the first aspect or any corresponding embodiment described above.
[0009] Fourthly, this application provides a computer-readable storage medium storing computer instructions that cause a computer to perform the data storage method of the first aspect or any corresponding embodiment described above.
[0010] Fifthly, this application provides a computer program product, including computer instructions for causing a computer to execute the data storage method of the first aspect or any corresponding embodiment described above.
[0011] This application addresses the problem in related technologies where OTP (On-Phase Telephony) requires numerous conductive circuits in the OTP for data storage, leading to excessively long programming times and high power consumption. This is achieved by determining the data to be stored and its data type, adjusting the data according to the corresponding data storage strategy to reduce or maintain the number of preset values, and then writing the adjusted data to a preset storage device. The method utilizes a data storage strategy to minimize the number of preset values in the data to be stored, thereby reducing the number of OTP programming iterations and shortening the programming time. Furthermore, reducing the number of preset values decreases the number of conductive circuits in the OTP, thus reducing leakage current and power consumption. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the specific embodiments or related technologies of this application, the drawings used in the description of the specific embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0013] Figure 1 This is a flowchart illustrating a data storage method according to an embodiment of this application; Figure 2 This is a structural diagram of a system for writing continuous data to an OTP according to an embodiment of this application; Figure 3 This is a flowchart illustrating the processing of independent data according to embodiments of this application; Figure 4 This is a structural diagram of a system for writing independent data to an OTP according to an embodiment of this application; Figure 5This is a structural block diagram of a data storage device according to an embodiment of this application; Figure 6 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0014] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0015] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0016] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0017] One-time programmable memory (OTP) is a type of non-volatile memory that can only be written to once. The core characteristics of OTP include: it can only be programmed once, making it suitable for storing fixed data such as encryption keys and device IDs (identity documents); data is not lost when power is off, demonstrating its non-volatility; and once data is written to an OTP, it is permanently stored, making it difficult to tamper with or physically attacked (e.g., antifuse OTP resists probe attacks), resulting in high security. Currently, the main types of OTP are fuse-type and antifuse-type. Antifuse-type OTPs are widely used; they create a conductive circuit by breaking down the insulation layer with high voltage, programming the corresponding data bit to 1, thus writing 1 bit of data information.
[0018] When using OTP to store data, related technologies do not have optimized solutions for the OTP data storage format. In antifuse-type OTPs, a conductive path is formed after programming to 1, leading to higher leakage current. Furthermore, because the insulation layer breakdown takes longer, programming 1 bit of data in an antifuse-type OTP takes tens of times longer than reading data. Moreover, after extensive insulation layer breakdown, the power consumption of the OTP also increases.
[0019] Based on the above, this application provides a data storage method. Two OTP data storage schemes are designed for different data types and application scenarios, both effectively reducing the number of "1"s during OTP storage. Since most OTPs currently used in the market employ antifuse structures, reducing the number of "1"s reduces the programming bit depth of the OTP, thereby improving programming efficiency. It also reduces leakage current and lowers the power consumption of the OTP. This method supports normal data storage in the OTP and provides two flexible methods to reduce the number of OTP programming operations, improve programming efficiency, shorten programming time, reduce leakage current, and lower OTP power consumption for different usage scenarios.
[0020] According to an embodiment of this application, a data storage method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, for example, a computer, a server, etc., and although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0021] This embodiment provides a data storage method. Figure 1 This is a flowchart of a data storage method according to an embodiment of this application, such as... Figure 1 As shown, the process includes the following steps: Step S101: Determine the data to be stored and the data type of the data to be stored.
[0022] Specifically, the data types to be stored include continuous data such as audio and image data, and independent data such as security keys and user IDs. Continuous data exhibits relatively gradual changes, and adjacent data points show some similarity. Independent data points are mutually independent.
[0023] Identify the data to be stored, such as: audio data, image data, security keys, user IDs, etc., and determine which of the above data types the data to be stored is.
[0024] Step S102: Adjust the data to be stored according to the data storage strategy corresponding to the data type, and write the adjusted data to be stored into the preset storage device. The data storage strategy is used to reduce or maintain the number of preset values in the data to be stored.
[0025] Specifically, this embodiment proposes multiple data storage strategies, allowing for flexible selection of different data storage strategies for different data types. Each data storage strategy can reduce the number of "1" values in the data to be stored, thereby reducing the number of OTP programming operations, shortening programming time, improving programming efficiency, reducing leakage current, and reducing OTP power consumption.
[0026] Data storage strategies are as follows: For continuous data, data storage strategy 1 is used. Since there is a certain similarity between adjacent data in continuous data, a simple algorithm is used to obtain the difference between adjacent data in the data to be stored. The value "1" in adjacent data will become the value "0" by calculating the difference. This can effectively reduce the number of values "1" in the data. Subsequently, the data to be stored can be restored by the difference between the first set of data and the subsequent data. For independent data, data storage strategy 2 is used. The number of values "1" in the data to be stored is judged. If it is more than half, the data to be stored is inverted bit by bit. This can change the majority of values "1" to values "0". The data can be inverted bit by bit again to restore the data to be stored. If the number of values "1" is less than half, the data to be stored is not processed and the original data is retained.
[0027] For antifuse OTPs, the default value is "1". For other types of OTPs, the default value can be set according to actual needs. The default storage device can be, for example, an antifuse OTP, other types of OTPs, or other devices with storage capabilities. The above data storage strategy can be used to reduce or maintain the number of default values in the data to be stored.
[0028] Adjust the data to be stored according to the data storage strategy corresponding to the data type, and write the adjusted data to the preset storage device.
[0029] The data storage method provided in this embodiment determines the data to be stored and its data type; adjusts the data to be stored according to the data storage strategy corresponding to the data type to reduce or maintain the number of preset values in the data to be stored; and writes the adjusted data to be stored into a preset storage device. This method utilizes the data storage strategy to minimize the number of preset values in the data to be stored, thereby reducing the number of programming iterations of the OTP and shortening the programming time. Furthermore, reducing the number of preset values reduces the number of conducting circuits in the OTP, thus reducing the leakage current and power consumption of the OTP. This solves the problem in related technologies where storing data using an OTP requires forming numerous conducting circuits in the OTP, leading to excessively long OTP programming time and excessive OTP power consumption.
[0030] As an optional embodiment, the data to be stored is adjusted according to the data storage strategy corresponding to the data type, and the adjusted data to be stored is written to a preset storage device, including: When the data storage strategy corresponding to the data type is the first preset strategy, obtain the preset number of data combinations contained in the data to be stored; Determine the starting data combination and other data combinations outside the preset number of data combinations; Determine the difference between other data combinations and the previous data combination of other data combinations, and write the difference and the starting data combination into a preset storage device. The difference and the starting data combination are used to obtain the adjusted data to be stored.
[0031] Specifically, if the data type is continuous data such as sound data or image data, the data to be stored is processed using a first preset strategy, which is the aforementioned data storage strategy 1.
[0032] Let's illustrate data storage strategy 1 using two adjacent sets of data X and Y as an example. Assume the first set of 32-bit data is X, and the second set is Y. Considering the continuity between adjacent data, the difference between X and Y should be a small value, Δ. X,Y =YX. In hardware design, the difference between adjacent data can be determined using an XOR algorithm, or it can be calculated directly by numerical computation. XORing X with Y yields a new data Z. The new data Z represents the difference between data X and Y. When the difference is small, the newly generated data will effectively reduce the number of "1"s. To restore the original data Y, simply XOR X with Z.
[0033] Get the preset number of data combinations contained in the data to be stored. For example, the data to be stored is a set of audio key data, consisting of 100 data combinations, D0, D1, D2, D3...D99. The preset number means multiple, and there is no specific limit on the number here.
[0034] Determine the starting data combination and other data combinations from a preset number of data combinations. For example, the starting data combination is data combination D0, and the other data combinations are data combinations D1, D2, D3...D99.
[0035] Determine the difference between other data combinations and their preceding data combinations. For example, calculate the difference Δ between data combination D1 and data combination D0. 0,1 Δ 0,1 =D1-D0; Calculate the difference Δ between data combination D99 and data combination D98. 98,99 Δ 98,99 =D99-D98.
[0036] The above differences and the initial data are combined and written to a preset storage device. In the preset storage device, these differences and the initial data are combined to form the adjusted data to be stored. Subsequently, the data to be stored can be restored using the initial data combination and the subsequent differences.
[0037] In this embodiment, a first preset strategy is used to adjust the data to be stored, reducing the number of "1" values in the data, thereby reducing the programming bit width of the OTP and improving programming efficiency. Additionally, it can also reduce the leakage current and power consumption of the OTP.
[0038] As an optional embodiment, determining the difference between other data combinations and the previous data combination, and writing the difference and the initial data combination into a preset storage device, includes: The initial data combination is cached in the cache, and it is used as the cached data combination in the cache. The initial data is combined and written to the preset storage device as the new initial data for the preset storage device; Retrieve the data combination to be written from other data combinations; The combination of cached data in the buffer and the combination of data to be written are XORed to obtain the first calculation result; Clear the cache, and cache the data combination to be written to the cache as the cached data combination; Write the first calculation result to the preset storage device as new data in the preset storage device; The subsequent steps begin by retrieving the data combination to be written from other data combinations and continue until the first calculation result corresponding to the ending data combination is written to the preset storage device, at which point the process ends. The ending data combination is included in the other data combinations.
[0039] Specifically, this embodiment can be implemented using a system that writes continuous data to an OTP, such as... Figure 2 As shown, the system includes a buffer, an XOR device, and an OTP, with the OTP serving as the default storage device in this embodiment.
[0040] Taking a set of audio key data to be stored as an example, the data to be stored consists of 100 data combinations: D0, D1, D2, D3…D99. The starting data combination is D0, and the other data combinations are D1, D2, D3…D99. Because OTP burning is relatively slow, a single data combination burning process is generally used. First, data combination D0 is burned. Once data combination D0 is successfully burned, data combination D1 is burned. If data combination D0 fails to burn, it needs to be burned again.
[0041] If data combination D0 is first burned into the OTP with its original value and recorded as the new starting data E0, when burning data combination D1, since there is no previous data combination D0, it is necessary to cache data combination D0 in the design. Then, when burning data combination D1, the cached data combination D0 and data combination D1 are XORed to generate new data E1, E1 is stored in the OTP, and the cache is refreshed to cache the D1 data.
[0042] The initial data combination is cached in the cache as the cached data combination. The initial data combination is written to the OTP as the new initial data E0 of the OTP.
[0043] According to the order or number of the data combinations, obtain the data combination to be written from other data combinations. For example, if the initial data combination has been written to OTP, then data combination D1 needs to be used as the data combination to be written; if D0, D1, D2, and D3 have been written to OTP, then data combination D4 needs to be used as the data combination to be written.
[0044] The first calculation result is obtained by performing an XOR operation between the cached data combination in the buffer and the data combination to be written. For example, if the cached data combination in the current buffer is D0 and the data combination to be written is D1, the first calculation result is obtained by performing an XOR operation between D0 and D1.
[0045] In the current round, the data combination to be written is D1. Clear the cache and cache the data combination to be written in the cache as the cached data combination. At this time, the cached data combination is D1.
[0046] Write the first calculation result into OTP as the new data E1 of OTP.
[0047] The subsequent steps begin by retrieving the data combination to be written from other data combinations. This involves retrieving the data combination to be written from other data combinations according to their order or number. For example, if D0 and D1 have already been written to OTP, D2 becomes the new data combination to be written, and so on in subsequent rounds. This process is repeated until the first calculation result corresponding to the final data combination is written to OTP, at which point the process ends. The final data combination is D99 from the other data combinations. After writing the first calculation result corresponding to D99 to OTP as the new data E99, the process ends.
[0048] Taking 8-bit data as an example, D0 = 1011_1011, D1 = 1011_1101. D0 and D1 are relatively consecutive data with small differences. XORing D0 with D1 yields the new data E1 = 0000_0100. The newly generated E1 data contains only one value "1", reducing the number of "1" values by 5 compared to data D1. Storing E1 in OTP only requires programming 1 data bit and one high-voltage breakdown. Compared to the previous 5 times, this example improves programming efficiency by 4 times.
[0049] The above process is as follows Figure 2As shown, the data stream is cached in a buffer, and the cached data and the data stream are input into an XOR generator for XOR calculation. Subsequently, the XOR calculation result is written to the OTP via OTP programming (OTP_program).
[0050] In this embodiment, for continuous data, the difference is generated by caching the initial data and XOR calculation, which greatly reduces the number of 1s in OTP, shortens programming time, improves programming efficiency, reduces OTP power consumption, and adapts to continuous data storage scenarios such as audio.
[0051] As an optional embodiment, after writing the adjusted data to be stored to a preset storage device, the method further includes: Retrieve the new starting data and new data from the preset storage device; Retrieve the first data to be recovered from the new data; The first data to be recovered is XORed with the new starting data to obtain the first intermediate data; Retrieve the second set of data to be recovered from the new data; The first intermediate data corresponding to the previous data of the second data to be recovered is XORed with the second intermediate data to be recovered to obtain the first intermediate data of the second data to be recovered. Based on the new starting data and the first intermediate data, the data to be stored is obtained.
[0052] Specifically, this embodiment is used to recover the originally written data to be stored based on the data stored in the OTP. When the OTP is full of E0, E1, E2, E3...E99, reading and restoring the original data is also very simple. Just XOR E0 and E1 to get D1, XOR D1 and E2 to get D2, and so on to recover all the data.
[0053] Retrieve new starting data and new data from the preset storage device. For example, the new starting data is E0, and the new data includes E1, E2, ... E99.
[0054] According to the order or number of the data combination, the first new data in the new data is taken as the first data to be recovered. The first data to be recovered is adjacent to the new starting data E0, and the first data to be recovered is E1.
[0055] Perform an XOR operation between E0 and the first data to be recovered, E1, to obtain the first intermediate data, D'1.
[0056] According to the order or number of the data combinations, retrieve the second data to be recovered from the new data. For example, take E2, E3, ... E99 as the second data to be recovered in sequence.
[0057] The first intermediate data corresponding to the previous data of the second data to be recovered is XORed with the first intermediate data of the previous data to obtain the first intermediate data of the second data to be recovered. For example, the first intermediate data D'1 corresponding to the previous data (E1) of E2 is XORed with the first intermediate data D'2 of E2. And so on, the first intermediate data D'3 of E3, the first intermediate data D'4 of E4, ... the first intermediate data D'99 of E99 are obtained.
[0058] Following the order or numbering of the data combinations, concatenate the new starting data and the first intermediate data. The new starting data E0 can be directly used as D'0. Concatenate D'0, D'1, ... D'99 to obtain the data to be stored.
[0059] The above process is as follows Figure 2 As shown, data is read from OTP (OTP_read), the read data is cached in a buffer, the cached data and the read data are input into an XOR generator for XOR calculation, the calculation result is cached in a buffer, and the data restored in the buffer is output.
[0060] In this embodiment, by successively XORing the new starting data and new data in the OTP to generate first intermediate data, and then concatenating them, the data to be stored can be completely restored. The recovery process is simple, efficient, and convenient to operate, adaptable to corresponding storage solutions, and requires no complex logic.
[0061] As an optional embodiment, the data to be stored is adjusted according to the data storage strategy corresponding to the data type, and the adjusted data to be stored is written to a preset storage device, including: When the data storage strategy corresponding to the data type is the second preset strategy, determine the first quantity of preset values in the data to be stored; If the first quantity exceeds a preset threshold, the data to be stored is inverted to obtain the second intermediate data. The first preset flag is concatenated with the second intermediate data to obtain the adjusted data to be stored; If the first quantity is less than or equal to a preset threshold, the second preset flag is concatenated with the data to be stored to obtain the adjusted data to be stored. Write the adjusted data to be stored to the preset storage device.
[0062] Specifically, if the data type is independent data such as security key or user ID, the data to be stored is processed using the second preset strategy, which is the data storage strategy 2 mentioned above.
[0063] When OTP stores independent data, this embodiment prioritizes design simplicity and utilizes an accumulator and an inverter to process the data. The data writing process to OTP is as follows: Figure 3 As shown, the algorithm determines the number of 1s in the original data. If the number of 1s exceeds half, the original data is bitwise NOTed, which converts the majority of 1s to 0s. If the number of 1s is less than half, the original data is left unchanged.
[0064] This embodiment can be implemented using a system that writes independent data to the OTP, such as... Figure 4 As shown, the system includes an accumulator, an inverter, a judge, and an OTP, which serves as the default storage device in this embodiment.
[0065] For anti-fuse type OTPs, the default value is "1". For other types of OTPs, the default value can be set according to actual needs.
[0066] Determine the first number of preset values in the data to be stored. For example, take a set of 16-bit data A, A=1101_1010_1001_1111, and use an accumulator to accumulate the data A bit by bit to obtain the first number of the value "1", which is 11.
[0067] Preset thresholds can be, for example, half the total number of data items in the data to be stored, or other values set according to actual needs. Let's take a preset threshold of 8 as an example.
[0068] The first quantity is 11, and the preset threshold is 8. If the first quantity is greater than the preset threshold, the data to be stored is inverted to obtain the second intermediate data. For example, if the data to be stored is A=1101_1010_1001_1111, the original data A is inverted to obtain the second intermediate data B, B=0010_0101_0110_0000.
[0069] The first preset flag is, for example, 1_, and the second preset flag is, for example, 0_. The first preset flag and the second preset flag are different, representing inversion or non-inversion, respectively.
[0070] The first preset flag is concatenated with the second intermediate data B to obtain the adjusted data to be stored, for example: 1_0010_0101_0110_0000.
[0071] If the data to be stored is C=0000_1001_0000_1100, and the sum of these values is 4, which is less than 8, then no processing is performed on the data.
[0072] The second preset flag is concatenated with the data to be stored to obtain the adjusted data to be stored. For example, concatenating the second preset flag "0_" with C results in the adjusted data to be stored as 0_0000_1001_0000_1100.
[0073] Write the adjusted data to be stored into the OTP.
[0074] The above process is as follows Figure 4 As shown, the data stream is input into the accumulator to determine the number of 1s in the data. Then, the judge is used to determine whether the number of 1s exceeds half. If it exceeds half, the data stream is inverted using the inverter. The inverted result is written to the OTP through OTP programming (OTP_program).
[0075] In this embodiment, a second preset strategy is used to adjust the independent data, reducing the number of "1" values in the data to be stored, thereby reducing the programming bit width of the OTP and improving programming efficiency. Additionally, it can also reduce the leakage current and power consumption of the OTP.
[0076] As an optional embodiment, after writing the adjusted data to be stored to a preset storage device, the method further includes: Retrieve the adjusted data to be stored from the preset storage device; If the adjusted data to be stored contains a first preset flag, the first preset flag is removed from the adjusted data to be stored to obtain the second intermediate data; Invert the second intermediate data to obtain the data to be stored. If the adjusted data to be stored contains the second preset flag, the second preset flag is removed from the adjusted data to be stored to obtain the data to be stored.
[0077] Specifically, retrieve the adjusted data to be stored in OTP, such as: 1_0010_0101_0110_0000, 0_0000_1001_0000_1100.
[0078] The first preset flag is, for example, 1_, and the second preset flag is, for example, 0_.
[0079] If the adjusted data to be stored contains a first preset flag, remove the first preset flag from the adjusted data to obtain second intermediate data. For example, remove the '1_' from 1_0010_0101_0110_0000 to obtain the second intermediate data 0010_0101_0110_0000. Invert the second intermediate data to obtain the data to be stored as 1101_1010_1001_1111.
[0080] If the adjusted data to be stored contains a second preset flag, remove the second preset flag from the adjusted data to be stored to obtain the data to be stored. For example, remove 0_ from 0_0000_1001_0000_1100 to obtain the data to be stored as 0000_1001_0000_1100.
[0081] The above process is as follows Figure 4 As shown, data is read from OTP (OTP_read), the read data is buffered into the judge to determine whether it contains the first preset flag. If it does, the read data is input into the inverter to perform the inversion operation, and the operation result is output.
[0082] As an optional embodiment, the method further includes writing the difference and the starting data together into a preset storage device: Candidate data are obtained by combining the difference and the initial data; Determine the first number of preset values in the data to be stored and the second number of preset values in the candidate data; If the first quantity is greater than or equal to the second quantity, the adjusted data to be stored is obtained based on the candidate data and the third preset flag; If the first quantity is less than the second quantity, the adjusted data to be stored is obtained based on the data to be stored and the fourth preset flag; Write the adjusted data to be stored to the preset storage device.
[0083] Specifically, the above data storage strategy 1 has some shortcomings. When D0 = 0100_0000 and D1 = 0011_1101, the XOR of D0 and D1 results in E1 = 0111_1101. E1 has one more bit "1" than D1. However, this scenario only occurs when D0 carries over one more bit than D1, which is a very low percentage compared to many other scenarios. This embodiment aims to solve the above shortcomings.
[0084] By combining the difference and the initial data, candidate data are obtained.
[0085] For anti-fuse OTPs, the default value is "1". For other types of OTPs, the default value can be set according to actual needs. The following explanation uses a default value of 1 as an example.
[0086] Determine the first number of 1s in the data to be stored and the second number of 1s in the candidate data.
[0087] The third preset flag is, for example, 1_, and the fourth preset flag is, for example, 0_. The third preset flag is different from the fourth preset flag. The third preset flag indicates that the data to be stored is adjusted using data storage strategy 1, while the fourth preset flag indicates that the data to be stored is not adjusted using data storage strategy 1.
[0088] If the first quantity is greater than the second quantity, it means that the number of 1s in the candidate data is less than the number of 1s in the data to be stored. After adjusting the data to be stored, data storage strategy 1 successfully reduced the number of 1s. The candidate data and the third preset flag are then concatenated to obtain the adjusted data to be stored. If the first quantity equals the second quantity, it means that the quantity of 1 did not change after data storage strategy 1 adjusted the data to be stored. This embodiment uses concatenated candidate data and a third preset flag to obtain the adjusted data to be stored. Alternatively, concatenated candidate data and a fourth preset flag can also be used to obtain the adjusted data to be stored.
[0089] If the first quantity is less than the second quantity, it means that the number of 1s in the candidate data is greater than the number of 1s in the data to be stored. Data storage strategy 1 adjusts the data to be stored by increasing the number of 1s. Therefore, it is not necessary to adjust the data to be stored using data storage strategy 1. Therefore, the data to be stored and the fourth preset flag are combined to obtain the adjusted data to be stored.
[0090] Write the adjusted data to be stored to the preset storage device.
[0091] In this application embodiment, the defect of potentially increasing the number of "1"s is addressed by comparing the number of "1"s in the data to be stored with the number of "1"s in the candidate data, selecting the better data and adding a flag bit for storage, thereby ensuring a reduction in the number of "1"s in the OTP, improving programming efficiency, reducing power consumption, and adapting to different types of OTPs.
[0092] As an optional embodiment, the above step S102, "adjusting the data to be stored according to the data storage strategy corresponding to the data type, and writing the adjusted data to be stored into the preset storage device", may also include steps A1 to A13.
[0093] In this embodiment, instead of relying solely on the previous data, the difference between the current data and the mean / median of the sliding window of the previous N data points is calculated, reducing the increase in the number of 1s caused by a sudden change in a single data point. For example, with a window size of N=3, the current data is Dn, and the mean of the first 3 data points within the window is Avg(Dn-3, Dn-2, Dn-1), the difference Δ is calculated as Dn-Avg, and Δ is stored in the OTP. During recovery, Dn is derived by inversely using Avg+Δ. In the hardware, only a simple mean calculation module (adder, shifter) needs to be added. The mean can be approximated by summing and then shifting to the right, such as summing 3 data points and shifting to the right by 2 bits ≈ dividing by 4, simplifying the calculation and caching the first N data points within the window.
[0094] Step A1: Configure the sliding window size N, reference baseline type, and mutation threshold T to complete hardware parameter initialization.
[0095] Step A2: Initialize the 2-bit storage mode flag to the default value of 00 and clear the sliding window buffer.
[0096] Step A3: Define the OTP storage format, specifying the rules for concatenating flag bits and data, and the allocation of storage bits.
[0097] Step A4: Read the starting data of the continuous data to be stored and write it directly to the OTP.
[0098] Step A5: Store the initial data in the sliding window buffer and read the next data to be processed in sequence.
[0099] Step A6: Determine if the data volume in the sliding window buffer has reached N. If not, add the currently pending data to the buffer and return to step A5 until the window is full.
[0100] Step A7: Calculate the reference baseline value of the data in the sliding window buffer.
[0101] Step A8: Perform an XOR operation between the current data to be processed and the reference baseline value to obtain the difference data.
[0102] Step A9: Count the number of "1"s in the difference data and compare it with the mutation threshold T.
[0103] Step A10: If the number of "1"s is greater than T, set the flag to 10 and write the original data to be processed; if the number of "1"s is less than or equal to T, keep the flag at 00 and write the difference data.
[0104] Step A11: According to the preset OTP storage format, concatenate the flag bit and the data to be written, and write the concatenated data into the OTP.
[0105] Step A12: Refresh the sliding window cache, remove the oldest stored data, and add the currently pending data.
[0106] Step A13: Determine if this is the last piece of data to be stored. If not, return to step A5; if yes, end the overall data storage process.
[0107] In this embodiment, it adapts to continuous data containing mutations, switches the original data storage by XORing the window baseline with the mutation, stably reduces the number of "1"s in OTP, improves programming efficiency, reduces power consumption, is simple to implement in hardware, and has no reverse optimization issues.
[0108] This embodiment also provides a data storage device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0109] This embodiment provides a data storage device, such as... Figure 5 As shown, it includes: Information determination module 501 is used to determine the data to be stored and the data type of the data to be stored. The data adjustment and storage module 502 is used to adjust the data to be stored according to the data storage strategy corresponding to the data type, and write the adjusted data to be stored into a preset storage device. The data storage strategy is used to reduce or maintain the number of preset values in the data to be stored.
[0110] In some alternative implementations, the data adjustment and storage module 502 includes: The first acquisition unit is used to acquire a preset number of data combinations contained in the data to be stored when the data storage strategy corresponding to the data type is a first preset strategy. The first determining unit is used to determine the starting data combination and other data combinations other than the starting data combination from a preset number of data combinations; The first writing unit is used to determine the difference between other data combinations and the previous data combination of other data combinations, and write the difference and the starting data combination into a preset storage device, wherein the difference and the starting data combination are used to obtain the adjusted data to be stored.
[0111] In some alternative implementations, the first writing unit includes: The first cache operation submodule is used to cache the initial data combination into the cache, which serves as the cached data combination in the cache. The first write submodule is used to combine the initial data and write it to the preset storage device as the new initial data of the preset storage device. The first acquisition submodule is used to acquire the data combination to be written from other data combinations; The first calculation submodule is used to perform an XOR operation on the combination of cached data in the buffer and the combination of data to be written to obtain the first calculation result. The second cache operation submodule is used to clear the cache and cache the data to be written into the cache as the cached data combination. The second write submodule is used to write the first calculation result to a preset storage device as new data in the preset storage device. The loop operation submodule is used to start executing subsequent steps from the data combination to be written obtained from other data combinations, until the first calculation result corresponding to the end data combination is written to the preset storage device, and then the process ends. The end data combination is included in other data combinations.
[0112] In some optional implementations, the first writing unit further includes: The second acquisition submodule is used to acquire new starting data and new data from a preset storage device, and to acquire the first data to be recovered from the new data; The second calculation submodule is used to perform an XOR operation on the first data to be recovered and the new starting data to obtain the first intermediate data. The third acquisition submodule is used to acquire the second data to be recovered from the new data; The third calculation submodule is used to perform an XOR operation on the second data to be recovered and the first intermediate data corresponding to the previous data of the second data to be recovered, so as to obtain the first intermediate data of the second data to be recovered. The first submodule is used to obtain the data to be stored based on the new starting data and the first intermediate data.
[0113] In some alternative implementations, the data adjustment and storage module 502 includes: The second determining unit is used to determine the first quantity of preset values in the data to be stored when the data storage strategy corresponding to the data type is the second preset strategy. The inversion operation unit is used to invert the data to be stored when the first quantity is greater than a preset threshold, to obtain the second intermediate data. The first splicing operation unit is used to splice the first preset flag with the second intermediate data to obtain the adjusted data to be stored. The second splicing operation unit is used to splice the second preset flag with the data to be stored when the first quantity is less than or equal to a preset threshold, so as to obtain the adjusted data to be stored. The second writing unit is used to write the adjusted data to be stored into a preset storage device.
[0114] In some alternative implementations, the data adjustment and storage module 502 further includes: The second acquisition unit is used to acquire the adjusted data to be stored from a preset storage device; The first data adjustment unit is used to remove the first preset flag from the adjusted data to be stored, in case the adjusted data to be stored contains the first preset flag, to obtain the second intermediate data. The second data adjustment unit is used to invert the intermediate data to obtain the data to be stored. The third data adjustment unit is used to remove the second preset flag from the adjusted data to be stored if the adjusted data to be stored contains the second preset flag, so as to obtain the data to be stored.
[0115] In some optional implementations, the first writing unit further includes: The second submodule is used to obtain candidate data based on the combination of the difference and the initial data; The determination submodule is used to determine the first number of preset values in the data to be stored and the second number of preset values in the candidate data. The first judgment submodule is used to obtain the adjusted data to be stored based on the candidate data and the third preset flag if the first quantity is greater than or equal to the second quantity. The second judgment submodule is used to obtain the adjusted data to be stored based on the data to be stored and the fourth preset flag if the first quantity is less than the second quantity. The third write submodule is used to write the adjusted data to be stored into the preset storage device.
[0116] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0117] In this embodiment, the data storage device is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0118] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0119] The following is a detailed reference. Figure 6 This diagram illustrates a suitable structural design for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 601, which can perform various appropriate actions and processes based on a program stored in read-only memory (ROM) 602 or a program loaded from memory 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of the electronic device. The processor 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0120] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0121] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a memory 608, or installed from a ROM 602. When the computer program is executed by the processor 601, it performs the functions defined in the data storage method of the embodiments of the present invention.
[0122] Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
[0123] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the data storage method shown in the above embodiments is implemented.
[0124] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0125] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A data storage method, characterized in that, The method includes: Determine the data to be stored and the data type of the data to be stored; According to the data storage strategy corresponding to the data type, the data to be stored is adjusted, and the adjusted data to be stored is written to a preset storage device. The data storage strategy is used to reduce or maintain the number of preset values in the data to be stored.
2. The method according to claim 1, characterized in that, The step of adjusting the data to be stored according to the data storage strategy corresponding to the data type, and writing the adjusted data to be stored into a preset storage device, includes: When the data storage strategy corresponding to the data type is a first preset strategy, a preset number of data combinations contained in the data to be stored are obtained; From the preset number of data combinations, determine the starting data combination and other data combinations besides the starting data combination; Determine the difference between the other data combination and the previous data combination of the other data combination, and write the difference and the starting data combination into the preset storage device, wherein the difference and the starting data combination are used to obtain the adjusted data to be stored.
3. The method according to claim 2, characterized in that, Determining the difference between the other data combinations and the previous data combination, and writing the difference and the starting data combination into the preset storage device, includes: The initial data combination is cached in the cache, and is used as the cached data combination in the cache. The initial data combination is written into the preset storage device as the new initial data for the preset storage device; Obtain the data combination to be written from the other data combinations; The combination of cached data in the buffer and the combination of data to be written are XORed to obtain the first calculation result. Clear the cache, and cache the data combination to be written into the cache as the cached data combination of the cache; The first calculation result is written into the preset storage device as new data in the preset storage device; The subsequent steps are executed starting from obtaining the data combination to be written from the other data combinations until the first calculation result corresponding to the end data combination is written to the preset storage device, and then the process ends, wherein the end data combination is included in the other data combinations.
4. The method according to claim 3, characterized in that, After writing the adjusted data to be stored to the preset storage device, the method further includes: Obtain new initial data and new data from a preset storage device, and obtain the first data to be recovered from the new data; The first data to be recovered is XORed with the new starting data to obtain the first intermediate data; Obtain the second data to be recovered from the new data; The first intermediate data corresponding to the previous data of the second data to be recovered is XORed with the second intermediate data to be recovered to obtain the first intermediate data of the second data to be recovered. The data to be stored is obtained based on the new starting data and the first intermediate data.
5. The method according to claim 1, characterized in that, The step of adjusting the data to be stored according to the data storage strategy corresponding to the data type, and writing the adjusted data to be stored into a preset storage device, includes: When the data storage strategy corresponding to the data type is the second preset strategy, determine the first quantity of the preset value in the data to be stored; If the first quantity is greater than a preset threshold, the data to be stored is inverted to obtain the second intermediate data; The first preset flag is concatenated with the second intermediate data to obtain the adjusted data to be stored; If the first quantity is less than or equal to the preset threshold, the second preset flag is concatenated with the data to be stored to obtain the adjusted data to be stored. The adjusted data to be stored is written to the preset storage device.
6. The method according to claim 5, characterized in that, After writing the adjusted data to be stored to the preset storage device, the method further includes: The adjusted data to be stored is retrieved from the preset storage device; If the adjusted data to be stored contains the first preset flag, the first preset flag is removed from the adjusted data to be stored to obtain the second intermediate data; The intermediate data is inverted to obtain the data to be stored; If the adjusted data to be stored contains the second preset flag, the second preset flag is removed from the adjusted data to be stored to obtain the data to be stored.
7. The method according to claim 2, characterized in that, The method of combining the difference and the starting data and writing them into the preset storage device further includes: Candidate data are obtained by combining the difference and the starting data; Determine a first number of the preset values in the data to be stored and a second number of the preset values in the candidate data; If the first quantity is greater than or equal to the second quantity, the adjusted data to be stored is obtained based on the candidate data and the third preset flag; If the first quantity is less than the second quantity, the adjusted data to be stored is obtained based on the data to be stored and the fourth preset flag; The adjusted data to be stored is written to the preset storage device.
8. A data storage device, characterized in that, The device includes: An information determination module is used to determine the data to be stored and the data type of the data to be stored. The data adjustment and storage module is used to adjust the data to be stored according to the data storage strategy corresponding to the data type, and write the adjusted data to be stored into a preset storage device, wherein the data storage strategy is used to reduce or maintain the number of preset values in the data to be stored.
9. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the data storage method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the data storage method according to any one of claims 1 to 7.