Method and device for generating data-code mapping sequence by using annealing simulation algorithm

The data-encoding mapping sequence is generated through the annealing simulation algorithm, which solves the problem of high computational cost of better encoding mapping schemes in STT-RAM, and realizes efficient optimization when the number of bits increases, avoiding the trap of local optimality.

CN119781673AActive Publication Date: 2025-04-08HUNAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411779168.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-04-08
Estimated Expiration
2044-12-05

AI Technical Summary

Technical Problem

In the prior art, when looking for better data-encoding mapping schemes in multi-layer unit spin transfer torque random access memory (STT-RAM), the calculation amount is too large, especially when the number of possible encoding mapping schemes increases explosively, resulting in the enumeration of all possible solutions being completely unfeasible.

Method used

The data-encoded mapping sequence is generated by annealing simulation algorithm. By simulating the physical annealing process, it gradually decreases from the initial higher temperature, and uses a certain probability to optimize it within the global scope, and ultimately tends to the global optimal solution to avoid falling into the local optimal.

Benefits of technology

While looking for an optimal coding mapping scheme, the calculation amount is significantly reduced, the local optimal trap is avoided, and efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119781673A_ABST
    Figure CN119781673A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a method and a device for generating a data-code mapping sequence by using an annealing simulation algorithm, which simulate a physical annealing process, start from a relatively high initial temperature, jump in a global situation at a certain probability along with the continuous decrease of the temperature, and finally tend to be globally optimal. The kick characteristic tending to zero probability in the search process can effectively prevent the algorithm from falling into local optimum. Therefore, on the premise of finding a better coding mapping scheme, the calculation amount can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of memory, and more particularly to a method and device for generating a data-code mapping sequence using an annealing simulation algorithm. Background Art

[0002] Multi-Level Cell (MLC) Spin-Transfer Torque Random-Access Memory (STT-RAM) is a non-volatile memory technology with fast access time, low standby power consumption and small size. Compared with traditional static random access memory (SRAM), it has higher storage density. It divides a basic storage cell into two parts: hard domain and soft domain. The voltage / current required for switching data states in the soft domain and hard domain are different, and the conversion between different states may require different energy consumption and produce different delays. That is, rewriting the data stored in STT-RAM to different data will produce different rewrite costs.

[0003] Currently, in many fields, it involves mapping M-bit data to N-bit codes (M is less than N). That is, each data can correspond to multiple codes. Then different mapping schemes from M-bit data to N-bit codes may be generated, that is, when the M-bit data is in a fixed order from small to large, the corresponding N-bit codes are listed in sequence to form a sequence, and sequences of different orders are different mapping schemes. The rewrite costs corresponding to these mapping schemes are different, and it is necessary to find a better coding mapping scheme to reduce the overhead. At present, the enumeration method is mainly used to find a better coding mapping scheme, that is, by evaluating the rewrite cost corresponding to each scheme, and finding the scheme with the smallest rewrite cost as the optimal coding mapping scheme. However, as the number of bits increases, the number of possible coding mapping schemes will explode, and it is completely infeasible to enumerate all possible coding mapping schemes. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a method and apparatus for generating a data-code mapping sequence using an annealing simulation algorithm, which can reduce the amount of calculation while finding a better code mapping solution.

[0005] In a first aspect, a method for generating a data-code mapping sequence using an annealing simulation algorithm is provided. After the i-th iteration, a memory stores a first sequence and a first objective function value corresponding to the first sequence, wherein the first sequence includes x N-bit codes arranged in a first order, and the x N-bit codes included in the first sequence are uniformly mapped to y M-bit data arranged in a preset order in sequence, wherein x, y, M and N are all positive integers, and x=2 N , y = 2 M , and M is less than N, the first objective function value is used to characterize the rewrite cost of writing the M-bit data into a spin transfer torque random access memory STT-RAM when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the first sequence, the annealing temperature stored in the memory is a first temperature, and i is a natural number;

[0006] In the (i+1)th iteration, the method includes:

[0007] Generate a second sequence, the second sequence comprising x N-bit codes arranged in a second order, the x N-bit codes included in the second sequence are sequentially and evenly mapped to y M-bit data arranged in the preset order, and the second order is different from the first order;

[0008] calculating a second objective function value for characterizing a rewrite cost when writing the M-bit data into the spin transfer torque random access memory STT-RAM when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the second sequence;

[0009] If the second objective function value is less than the first objective function value, the first sequence and the first objective function value stored in the memory are updated to the second sequence and the second objective function value respectively, or

[0010] If the second objective function value is not less than the first objective function value, it is further determined whether the value p calculated by the following formula is greater than the random value r generated between 0 and 1, and if p is greater than r, the first sequence and the second objective function value stored in the memory are updated to the second sequence and the second objective function value: Wherein, f(y) is the second objective function value, f(x) is the first objective function value, and t is the current annealing temperature;

[0011] reducing the annealing temperature to a second temperature;

[0012] Determine whether the iteration termination condition is met;

[0013] If the iteration termination condition is met, output the second sequence and the second objective function value, the second sequence being used as a coding mapping scheme for y M-bit data arranged in the preset order;

[0014] If the iteration termination condition is not met, the (i+2)th iteration is continued until the iteration termination condition is met, and the latest sequence stored in the memory and its corresponding objective function value are output.

[0015] In a possible implementation, generating the second sequence includes: exchanging the order of the p-th code and the q-th code among the x N-bit codes included in the first sequence to generate the second sequence, where 1≤p≤N, 1≤q≤N, and p≠q.

[0016] In a possible implementation, the calculating, when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the second sequence, a second objective function value for characterizing a rewrite cost when writing the M-bit data into a spin transfer torque random access memory STT-RAM includes:

[0017] The second objective function value is calculated according to the following formula:

[0018] f(y)=f(x)-g(p)-g(q)+g'(p)+g'(q);

[0019] Among them, g(p) and g(q) are respectively the third objective function value used to characterize the rewrite cost at the position where the p-th code is located and the fourth objective function value used to characterize the rewrite cost at the position where the q-th code is located when the M-bit code is written into the spin transfer torque random access memory STT-RAM in the case where the y M-bit data arranged in the preset order are mapped to the x N-bit codes included in the first sequence, and g'(p) and g'(q) are respectively the fifth objective function value used to characterize the rewrite cost at the position where the p-th code is located and the sixth objective function value used to characterize the rewrite cost at the position where the q-th code is located when the M-bit code is written into the spin transfer torque random access memory STT-RAM in the case where the y M-bit data arranged in the preset order are mapped to the x N-bit codes included in the second sequence.

[0020] In a possible implementation, determining whether an iteration termination condition is satisfied includes:

[0021] Determine whether the current number of iterations has reached the preset number of iterations, or

[0022] Determine whether the current annealing temperature is less than a preset temperature threshold.

[0023] In a possible implementation, the objective function value includes the number of two-step state transitions TT.

[0024] In a second aspect, a device for generating a data-code mapping sequence using an annealing simulation algorithm, a processor, and a memory connected to the processor in communication are provided, wherein after the i-th iteration, the memory stores a first sequence and a first objective function value corresponding to the first sequence, the first sequence includes x N-bit codes arranged in a first order, and the x N-bit codes included in the first sequence are uniformly mapped to y M-bit data arranged in a preset order in sequence, wherein x, y, M and N are all positive integers, and x=2 N , y = 2 M , and M is less than N, the first objective function value is used to characterize the rewrite cost of writing the M-bit data into a spin transfer torque random access memory STT-RAM when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the first sequence, the annealing temperature stored in the memory is a first temperature, and i is a natural number;

[0025] In the (i+1)th iteration, the processor is configured to:

[0026] Generate a second sequence, the second sequence comprising x N-bit codes arranged in a second order, the x N-bit codes included in the second sequence are sequentially and evenly mapped to y M-bit data arranged in the preset order, and the second order is different from the first order;

[0027] calculating a second objective function value for characterizing a rewrite cost when writing the M-bit data into a spin transfer torque random access memory STT-RAM when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the second sequence;

[0028] If the second objective function value is less than the first objective function value, the first sequence and the first objective function value stored in the memory are updated to the second sequence and the second objective function value respectively, or

[0029] If the second objective function value is not less than the first objective function value, further determine that the value p calculated by the following formula is greater than the random value r generated between 0 and 1, and if p is greater than r, update the first sequence and the second objective function value stored in the memory to the second sequence and the second objective function value: Wherein, f(y) is the second objective function value, f(x) is the first objective function value, and t is the current annealing temperature;

[0030] reducing the annealing temperature to a second temperature;

[0031] Determine whether the iteration termination condition is met;

[0032] If the iteration termination condition is met, output the second sequence and the second objective function value, the second sequence being used as a coding mapping scheme for y M-bit data arranged in the preset order;

[0033] If the iteration termination condition is not met, the (i+2)th iteration is continued until the iteration termination condition is met, and the latest sequence stored in the memory and its corresponding objective function value are output.

[0034] In a possible implementation manner, the processor is configured to generate a second sequence, including:

[0035] The order of the p-th code and the q-th code among the x N-bit codes included in the first sequence is exchanged to generate the second sequence, where 1≤p≤N, 1≤q≤N, and p≠q.

[0036] In a possible implementation, the processor is configured to calculate a second objective function value for characterizing a rewrite cost when writing the M-bit data into a spin transfer torque random access memory STT-RAM when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the second sequence, including:

[0037] The second objective function value is calculated according to the following formula:

[0038] f(y)=f(x)-g(p)-g(q)+g'(p)+g'(q);

[0039] Among them, g(p) and g(q) are respectively the third objective function value used to characterize the rewrite cost at the position where the p-th code is located and the fourth objective function value used to characterize the rewrite cost at the position where the q-th code is located when the M-bit code is written into the spin transfer torque random access memory STT-RAM in the case where the y M-bit data arranged in the preset order are mapped to the x N-bit codes included in the first sequence, and g'(p) and g'(q) are respectively the fifth objective function value used to characterize the rewrite cost at the position where the p-th code is located and the sixth objective function value used to characterize the rewrite cost at the position where the q-th code is located when the M-bit code is written into the spin transfer torque random access memory STT-RAM in the case where the y M-bit data arranged in the preset order are mapped to the x N-bit codes included in the second sequence.

[0040] In a possible implementation manner, the processor is configured to determine whether an iteration termination condition is satisfied, including:

[0041] Determine whether the current number of iterations has reached the preset number of iterations, or

[0042] Determine whether the current annealing temperature is less than a preset temperature threshold.

[0043] In a possible implementation, the objective function value includes the number of two-step state transitions TT.

[0044] In a third aspect, a computer-readable storage medium is provided, which includes a stored program, wherein when the program is run, the device where the computer-readable storage medium is located is controlled to execute a method for generating a data-coding mapping sequence using an annealing simulation algorithm as in the first aspect and any possible implementation method of the first aspect.

[0045] Based on the technical solution of the embodiment of the present application, it simulates the physical annealing process, starting from a relatively high initial temperature, and as the temperature continues to drop, it jumps globally with a certain probability to search for the best, and finally tends to the global optimum. The jump characteristic tending to zero probability during the search process can effectively prevent the algorithm from falling into the local optimum. Therefore, under the premise of finding a better coding mapping solution, the amount of calculation can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the drawings without paying creative work.

[0047] Figure 1 A mapping scheme from 3-bit data to 4-bit extension code is shown.

[0048] Figure 2 A schematic block diagram of a method for generating a data-code mapping sequence using an annealing simulation algorithm according to an embodiment of the present application is shown.

[0049] Figure 3 A schematic flowchart of a method for generating a data-code mapping sequence using an annealing simulation algorithm according to an embodiment of the present application is shown.

[0050] Figure 4 A schematic block diagram of an apparatus for generating a data-code mapping sequence using an annealing simulation algorithm according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0052] Multi-Level Cell (MLC) Spin-Transfer Torque Random-Access Memory (STT-RAM) is a non-volatile memory technology with fast access time, low standby power consumption and small size. Compared with traditional static random access memory (SRAM), it has higher storage density. It divides a basic storage unit into two parts: hard domain and soft domain. The soft domain can be regarded as the magnetization direction characteristics of the free layer magnetic material in the magnetic tunnel junction (MTJ) that are relatively easy to change, such as the magnetization direction of some weak magnetic areas on the free layer surface; the hard domain represents the magnetization direction deep inside the magnetic material or the relatively stable area with strong magnetism, and changing it requires greater energy input.

[0053] Since the voltage / current required for switching data states in the soft domain and the hard domain are different, the transition between different states may require different energy consumption and produce different delays. It can usually be divided into four types: (1) Zero Transition (ZT): that is, keep the original state, such as 00->00; (2) Soft Transition (ST): that is, apply a small current to change the state of the soft domain, such as 00->01; (3) Hard Transition (HT): that is, apply a large current to change the state of the soft domain and the hard domain, such as 00->11; (4) Two-step State Transition (TT): that is, the combination of HT and ST, change the state of the hard domain and keep the original state of the soft domain, such as 00->10. Among them, TT requires more energy and will produce greater delay. Therefore, we need to try to avoid the occurrence of TT to obtain better performance.

[0054] Currently, in many fields, it involves mapping M-bit data to N-bit codes (M is less than N), and each data can correspond to multiple codes. For example, if 1-bit data is mapped to 2-bit codes, then 1-bit data includes two data "0" and "1", and 2-bit codes include "00", "01", "10" and "11". Among them, 1 data can correspond to 2 codes, which may produce different mapping schemes from 1-bit data to 2-bit codes. For example, data "0" can be mapped to "00" and "01", and data "1" can be mapped to "10" and "11". For another example, data "0" can be mapped to "01" and "10", and data "1" can be mapped to "00" and "11". For another example, data "0" can be mapped to "10" and "11", data "1" can be mapped to "00" and "01", and for another example, data "0" can be mapped to "00" and "11", and data "1" can be mapped to "01" and "10". That is, there are 4 mapping schemes for mapping 1-bit data to 2-bit codes.

[0055] Under a certain mapping scheme, since one data corresponds to multiple codes, when a certain data is written into STT-RAM, the original code in STT-RAM may be rewritten into multiple codes corresponding to the data, and the energy consumed to rewrite the original code into different codes may also be different. Figure 1 A mapping scheme from 3-bit data to 4-bit extended coding is shown. Under this mapping scheme, the energy consumption corresponding to the two codes corresponding to the written data when the original code is rewritten is different. For example, the existing code is 0001. For the written data 101, there are two candidate codes 0101 and 1111. Through calculation, it can be obtained that 1 ZT and 1 ST occur when 0001 is rewritten as 0101, and 2 HTs occur when 0001 is rewritten as 1111. Obviously, the energy consumption of rewriting 0001 as code 0101 is lower, so we tend to rewrite the state as code 0101, representing data 101.

[0056] Under a certain mapping scheme, since each code may be used as the original code, and each data may be used as the target data to be written, by calculating the minimum cost of writing the target data each time and accumulating it, the rewrite cost of the mapping scheme can be obtained, which can also be called the overall overhead. Taking the target data as 1-bit data, the mapping scheme determined is that data "0" is mapped to "00" and "01", and data "1" is mapped to "10" and "11". It can be calculated that the original code is 00 and the minimum rewrite cost when the data to be written is 0; the minimum rewrite cost when the original code is 00 and the data to be written is 1; the minimum rewrite cost when the original code is 01 and the data to be written is 0; the minimum rewrite cost when the original code is 01 and the data to be written is 1; the minimum rewrite cost when the original code is 10 and the data to be written is 0; the minimum rewrite cost when the original code is 10 and the data to be written is 1; the minimum rewrite cost when the original code is 11 and the data to be written is 0; the minimum rewrite cost when the original code is 11 and the data to be written is 1. Then, by summing up the minimum rewriting costs calculated above, we can obtain the rewriting costs of the mapping scheme in which data "0" is mapped to "00" and "01", and data "1" is mapped to "10" and "11".

[0057] Obviously, the overall overhead of different mapping schemes is different, that is, the minimum number of state transitions required by different mapping schemes is different. Therefore, how to choose a mapping scheme with lower overhead is a direction that needs to be studied.

[0058] At present, in order to obtain a mapping scheme with low overhead, an enumeration method is often used, that is, by evaluating the rewriting cost corresponding to each mapping scheme, and finding the scheme with the lowest rewriting cost as the optimal encoding mapping scheme. However, as the number of bits increases, the number of possible encoding mapping schemes will explode, and it is completely infeasible to enumerate all possible encoding mapping schemes.

[0059] In view of this, the embodiment of the present application provides a method for generating a data-code mapping sequence using an annealing simulation algorithm, which simulates the physical annealing process, starting from a relatively high initial temperature, and as the temperature continues to drop, it performs a global optimization search with a certain probability of sudden jumps, and eventually tends to the global optimum. The sudden jump characteristic tending to zero probability during the search process can effectively prevent the algorithm from falling into a local optimum. Therefore, under the premise of finding a better code mapping scheme, the amount of calculation can be reduced.

[0060] Figure 2A schematic block diagram of a method for generating a data-code mapping sequence using an annealing simulation algorithm according to an embodiment of the present application is shown. The method 100 can be executed by a computer, for example, the computer includes a processor and a memory communicatively connected to the processor. The method 100 is executed by a processor in a computer, and mainly executes any iterative process, for example, the (i+1)th iteration, where i is a natural number. Before the (i+1)th iteration, that is, after the i-th iteration, the memory stores a first sequence and a first objective function value corresponding to the first sequence, the first sequence includes x N-bit codes arranged in a first order, the x N-bit codes included in the first sequence are uniformly mapped in sequence to y M-bit data arranged in a preset order, wherein x, y, M and N are all positive integers, and x=2 N , y = 2 M , and M is less than N, the first objective function value is used to characterize the rewrite cost when writing the M-bit data into the spin transfer torque random access memory STT-RAM when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the first sequence, the annealing temperature stored in the memory is the first temperature, and in the (i+1)th iteration, the method 100 includes some or all of the following steps.

[0061] S110, generating a second sequence, the second sequence comprising x N-bit codes arranged in a second order, the x N-bit codes included in the second sequence being uniformly mapped to y M-bit data arranged in the preset order in sequence, and the second order is different from the first order;

[0062] S120, calculating a second objective function value for characterizing a rewrite cost when writing the M-bit data into the spin transfer torque random access memory STT-RAM in the case where the y M-bit data arranged in the preset order are mapped to the x N-bit codes included in the second sequence;

[0063] S130: if the second objective function value is less than the first objective function value, updating the first sequence and the first objective function value stored in the memory to the second sequence and the second objective function value respectively; or

[0064] If the second objective function value is not less than the first objective function value, it is further determined whether the value p calculated by the following formula is greater than the random value r generated between 0 and 1, and if p is greater than r, the first sequence and the second objective function value stored in the memory are updated to the second sequence and the second objective function value: Wherein, f(y) is the second function value, f(x) is the first function value, and t is the current annealing temperature;

[0065] S140, lowering the annealing temperature to a second temperature;

[0066] S150, determining whether an iteration termination condition is met;

[0067] S160: if the iteration termination condition is met, output the second sequence and the second objective function value, the second sequence being used as a coding mapping scheme for y M-bit data arranged in the preset order;

[0068] S170, if the iteration termination condition is not met, then continue with the (i+2)th iteration until the iteration termination condition is met, and output the latest sequence stored in the memory and its corresponding objective function value.

[0069] First, let’s briefly introduce the annealing simulation algorithm.

[0070] Simulated Annealing (SA) is an iterative algorithm. It starts from an initial solution and gradually improves the quality of the solution through continuous iteration to find an approximate optimal solution. The algorithm is inspired by the solid annealing process. In solid annealing, the material is first heated to a high temperature to allow the particles to move freely, and then slowly cooled to allow the particles to gradually form a low-energy ordered state. The simulated annealing algorithm also adopts a similar idea by introducing a control parameter (similar to temperature) to control the search process.

[0071] Annealing simulation algorithm usually includes four steps: initialization, iterative cycle, temperature update and termination condition judgment. In the embodiment of the present application, before using the annealing simulation algorithm to generate the data-coding mapping sequence, it is also necessary to set an initial temperature, a termination temperature (preset temperature threshold), a temperature drop rate and an initial solution. The initial solution can be a coding sequence randomly generated for a data sequence of a fixed number of bits. In addition, the objective function value corresponding to the initial solution can also be calculated and stored in a memory. Then generate a candidate solution, and similarly, the candidate solution can be a coding sequence for a data sequence of the same fixed number of bits, and the order of coding in the coding sequence of the candidate solution is different from the order of coding in the coding sequence of the initial solution. In addition, the objective function value corresponding to the candidate solution can also be calculated. And by comparing the objective function value of the candidate solution with the objective function value of the initial solution, and determining a better current solution therefrom, it is stored in a memory. That is, if the candidate solution is judged to be better than the initial solution based on the objective function value of the initial solution and the objective function value of the candidate solution, the initial solution and its corresponding objective function value stored in the memory are replaced with the candidate solution and its corresponding function value. If the initial solution is finally judged to be better than the candidate solution, the initial solution and its corresponding objective function value stored in the memory are not updated, and one iteration is completed. Then, by lowering the annealing temperature and judging whether the iteration termination condition is met, and if the iteration termination condition is not met, iterating again until the iteration termination condition is met, the optimal solution and its corresponding function value are finally output.

[0072] It should be understood that the i-th iteration in the embodiment of the present application can be understood as before the iteration starts, and can also be understood as any iteration in the iteration loop. That is, the (i+1)-th iteration can be understood as the first iteration, and can also be understood as any iteration in the iteration loop. The first sequence can be the initial solution, or any candidate solution generated in the iteration loop. The second sequence can also be any candidate solution generated in the iteration loop.

[0073] Optionally, the objective function value corresponding to any solution can be calculated by the following formula:

[0074]

[0075] Where Maxdata is the maximum value in the data sequence. Maxcode is the maximum value in the coding sequence. f(x) is the objective function value, g(j) is the sum of the minimum rewrite costs required to write each code in the coding sequence to data[j], and t(code[i],data[j]) is the minimum rewrite cost required to write from code[i] to data[j].

[0076] The following describes the embodiment of the present application in detail by mapping 3-bit data to 4-bit code. Assuming that for the data sequence [000, 001, 010, 011, 100, 101, 110, 110], the first sequence is the code sequence [0000, 1010, 0001, 1110, 0010, 1101, 0011, 1001, 0100, 1011, 0101, 1111, 0110, 1100, 0111, 1000], the first objective function value corresponding to the first sequence can be calculated by the above formula (1), wherein Maxdata = 7, Maxcode = 15. The second sequence is [0000, 1010, 0001, 0110, 0010, 1101, 0011, 1001, 0100, 1011, 0101, 1111, 1110, 1100, 0111, 1000]. The second objective function value corresponding to the second sequence can be calculated by the above formula (1), where Maxdata = 7 and Maxcode = 15.

[0077] See below for more information. Figure 3 Taking the first iteration as an example, the iterative process of the embodiment of the present application is described in detail. Before the first iteration, the memory stores an initial solution and an objective function value corresponding to the initial solution, and the annealing temperature stored in the memory is the initial temperature. The initial solution is the above-mentioned first sequence.

[0078] First, a candidate solution is generated, that is, the second sequence mentioned above. The order of the multiple codes included in the second sequence is different from the order of the multiple codes included in the first sequence. In one embodiment, the order of the two codes in the first sequence can be swapped to generate the second sequence. That is, S110 can include: swapping the order of the pth code and the qth code of the x N-bit codes included in the first sequence to generate the second sequence, where 1≤p≤N, 1≤q≤N, and p≠q.

[0079] For example, by swapping the positions of 0110 and 1110 in the initial solution [0000,1010,0001,1110,0010,1101,0011,1001,0100,1011,0101,1111,0110,1100,0111,1000], we can generate the candidate solution [0000,1010,0001,0110,0010,1101,0011,1001,0100,1011,0101,1111,1110,1100,0111,1000].

[0080] After obtaining the candidate solution, the above formula 1 is used again to calculate the objective function value corresponding to the candidate solution.

[0081] Next, the objective function value corresponding to the initial solution and the objective function value corresponding to the candidate solution will be compared. If the objective function value corresponding to the candidate solution is smaller than the objective function value corresponding to the initial solution, the candidate solution is considered to be better than the initial solution, and the candidate solution can be made the current solution, that is, the initial solution and its corresponding objective function value stored in the memory are replaced with the candidate solution and its corresponding objective function value.

[0082] If the objective function value corresponding to the candidate solution is not less than the objective function value corresponding to the initial solution, then according to the idea of ​​the annealing simulation algorithm, the probability value calculated based on the following formula can be used to decide whether to make the candidate solution the current solution.

[0083]

[0084] Among them, f(y) is the second objective function value, for example, the objective function value corresponding to the above candidate solution, f(x) is the first objective function value, for example, the objective function value corresponding to the above initial solution, and t is the current annealing temperature, for example, the above initial annealing temperature.

[0085] The calculated probability value p is compared with a randomly generated value r between 0 and 1. If p is greater than r, the candidate solution is considered to be the current solution. If p is not greater than r, the candidate solution is considered not better than the initial solution, that is, the initial solution and its corresponding objective function value stored in the memory are not updated, and the iteration process ends.

[0086] Next, the annealing temperature may be decreased at a preset temperature decrease rate. For example, the annealing temperature may be decreased from a first temperature to a second temperature. It should be noted that, each time an iteration process is performed, the annealing temperature will decrease regardless of whether the current solution in the memory and its corresponding objective function value are replaced.

[0087] After the annealing temperature is lowered, it can be further determined whether the iteration termination condition is met. For example, it can be determined whether the current annealing temperature meets the preset temperature threshold, that is, the above-mentioned termination temperature. If the current annealing temperature reaches the preset temperature threshold, the iteration is terminated, and if the current annealing temperature does not reach the preset temperature threshold, the iteration continues. For another example, it can be determined whether the current number of iterations reaches the preset number of iterations. If the current number of iterations reaches the preset number of iterations, the iteration is terminated, and if the current number of iterations does not reach the preset number of iterations, the iteration continues.

[0088] After determining that the iteration termination condition is met, the optimal solution obtained by the current iteration and its corresponding objective function value are directly output. If it is determined that the iteration termination condition is not met, the iteration is continued until the iteration termination condition is met, and the optimal solution obtained by the last iteration process and its corresponding objective function value are output.

[0089] Calculating the objective function value corresponding to a coding sequence is a key step. At the same time, calculating the objective function value corresponding to a coding sequence is a relatively complex operation because it is necessary to count the sum of the overhead of writing the target data for each possible current encoding. As the number of bits increases, the time required to calculate the rewrite cost of a coding sequence will also explode.

[0090] As mentioned above, if the candidate solution is obtained by swapping the positions of two codes in the initial solution, for the entire cost of the two solutions, only the cost contributed by the target data corresponding to the two swapped codes will be affected, and the rest will not change. Therefore, starting from the overall cost of the initial solution, for the two affected codes, subtract the cost before the swap and add the cost after the swap, the entire cost of the candidate solution can be obtained. This method can reduce a lot of calculation processes. For long sequences, this method is reduced to linear complexity, that is, we only need to perform a complete cost calculation for the initial solution, and each subsequent candidate solution can be obtained based on the previous solution.

[0091] That is, S120 may include: calculating the second objective function value according to the following formula:

[0092] f(y)=f(x)-g(p)-g(q)+g'(p)+g'(q) (3);

[0093] Among them, g(p) and g(q) are respectively the third objective function value used to characterize the rewrite cost at the position where the p-th code is located and the fourth objective function value used to characterize the rewrite cost at the position where the q-th code is located when the M-bit code is written into the spin transfer torque random access memory STT-RAM in the case where the y M-bit data arranged in the preset order are mapped to the x N-bit codes included in the first sequence, and g'(p) and g'(q) are respectively the fifth objective function value used to characterize the rewrite cost at the position where the p-th code is located and the sixth objective function value used to characterize the rewrite cost at the position where the q-th code is located when the M-bit code is written into the spin transfer torque random access memory STT-RAM in the case where the y M-bit data arranged in the preset order are mapped to the x N-bit codes included in the second sequence.

[0094] For a coding scheme with a sequence length of N, if the complete cost is to be calculated once, the time complexity is O(N 2 ), square level, large amount of calculation. If the above formula is used for calculation, its time complexity is O(N), linear level, which reduces the complexity.

[0095] Optionally, the rewrite costs and overheads described in the various embodiments above may refer to the overheads corresponding to the number of state transitions. In one embodiment, the various objective function values ​​described above include the total overheads corresponding to the number of state transitions of ZT, HT, ST and TT. For example, different coefficients may be set for different state transitions. As mentioned above, the overheads required for the four state transitions are TT>HT>ST>ZT, respectively. Then the coefficients of the four state transitions may also be set in this order, that is, the coefficient of TT is the largest, and the coefficient of ZT is the smallest. The number of the four state transitions is multiplied by their respective coefficients and then added together to obtain the total overheads corresponding to the number of the four state transitions. For another example, the objective function value may only include the number of state transitions of TT.

[0096] In some embodiments, the number of TT conversions corresponding to the first sequence and the number of TT conversions corresponding to the second sequence can be compared first. If the number of TT conversions of the second sequence is less than the number of TT conversions of the first sequence, the first sequence is superior to the second sequence. If the number of TT conversions of the first sequence and the number of TT conversions of the second sequence are equal, the total overhead corresponding to the number of all state conversions of the second sequence and the total overhead corresponding to the number of all state conversions of the first sequence can be further compared.

[0097] Based on the same idea, the embodiment of the present application also provides a device for generating a data-code mapping sequence using an annealing simulation algorithm. Figure 4 As shown, the device 200 for generating a data-code mapping sequence using an annealing simulation algorithm includes a processor 210 and a memory 220 communicatively connected to the processor, wherein when the program instructions are executed by the processor 210, the device for generating a data-code mapping sequence using an annealing simulation algorithm executes the above-mentioned various method embodiments.

[0098] Specifically, after the i-th iteration, the memory 220 stores a first sequence and a first objective function value corresponding to the first sequence, wherein the first sequence includes x N-bit codes arranged in a first order, and the x N-bit codes included in the first sequence are uniformly mapped to y M-bit data arranged in a preset order in sequence, wherein x, y, M and N are all positive integers, and x=2 N , y = 2 M , and M is less than N, the first objective function value is used to characterize the rewrite cost of writing the M-bit data into a spin transfer torque random access memory STT-RAM when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the first sequence, the annealing temperature stored in the memory is a first temperature, and i is a natural number;

[0099] In the (i+1)th iteration, the processor 210 is configured to:

[0100] Generate a second sequence, the second sequence comprising x N-bit codes arranged in a second order, the x N-bit codes included in the second sequence are sequentially and evenly mapped to y M-bit data arranged in the preset order, and the second order is different from the first order;

[0101] calculating a second objective function value for characterizing a rewrite cost when writing the M-bit data into a spin transfer torque random access memory STT-RAM when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the second sequence;

[0102] If the second objective function value is less than the first objective function value, the first sequence and the first objective function value stored in the memory 220 are updated to the second sequence and the second objective function value respectively, or

[0103] If the second objective function value is not less than the first objective function value, further determine that the value p calculated by the following formula is greater than the random value r generated between 0 and 1, and if p is greater than r, update the first sequence and the second objective function value stored in the memory 220 to the second sequence and the second objective function value: Wherein, f(y) is the second objective function value, f(x) is the first objective function value, and t is the current annealing temperature;

[0104] reducing the annealing temperature to a second temperature;

[0105] Determine whether the iteration termination condition is met;

[0106] If the iteration termination condition is met, output the second sequence and the second objective function value, the second sequence being used as a coding mapping scheme for y M-bit data arranged in the preset order;

[0107] If the iteration termination condition is not satisfied, the (i+2)th iteration is continued until the iteration termination condition is satisfied, and the latest sequence stored in the memory 220 and its corresponding objective function value are output.

[0108] In a possible embodiment, the processor 210 is configured to generate the second sequence, including:

[0109] The order of the p-th code and the q-th code among the x N-bit codes included in the first sequence is exchanged to generate the second sequence, where 1≤p≤N, 1≤q≤N, and p≠q.

[0110] In a possible embodiment, the processor 210 is used to calculate a second objective function value for characterizing a rewrite cost when writing M-bit data into a spin transfer torque random access memory STT-RAM when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the second sequence, including:

[0111] The second objective function value is calculated according to the following formula:

[0112] f(y)=f(x)-g(p)-g(q)+g'(p)+g'(q);

[0113] Among them, g(p) and g(q) are respectively the third objective function value used to characterize the rewrite cost at the position where the p-th code is located and the fourth objective function value used to characterize the rewrite cost at the position where the q-th code is located when the M-bit code is written into the spin transfer torque random access memory STT-RAM in the case where the y M-bit data arranged in the preset order are mapped to the x N-bit codes included in the first sequence, and g'(p) and g'(q) are respectively the fifth objective function value used to characterize the rewrite cost at the position where the p-th code is located and the sixth objective function value used to characterize the rewrite cost at the position where the q-th code is located when the M-bit code is written into the spin transfer torque random access memory STT-RAM in the case where the y M-bit data arranged in the preset order are mapped to the x N-bit codes included in the second sequence.

[0114] In a possible embodiment, the processor 210 is configured to determine whether an iteration termination condition is satisfied, including:

[0115] Determine whether the current number of iterations has reached the preset number of iterations, or

[0116] Determine whether the current annealing temperature is less than a preset temperature threshold.

[0117] In a possible embodiment, the objective function value includes the number of two-step state transitions TT.

[0118] It should be noted that the detailed contents of the device side embodiment can be found in the method side embodiment, and for the sake of brevity, they will not be repeated here.

[0119] Based on the same idea, an embodiment of the present application also provides a computer-readable storage medium, which includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute the above-mentioned various method embodiments.

[0120] Although the present application has been described with reference to preferred embodiments, various modifications may be made thereto and parts thereof may be replaced with equivalents without departing from the scope of the present application. In particular, the various technical features mentioned in the various embodiments may be combined in any manner as long as there are no structural conflicts. The present application is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.

Claims

1. A method for generating a data-code mapping sequence using an annealing simulation algorithm, characterized in that: After the i-th iteration, the memory stores a first sequence and a first objective function value corresponding to the first sequence, wherein the first sequence includes x N-bit codes arranged in a first order, and the x N-bit codes included in the first sequence are uniformly mapped to y M-bit data arranged in a preset order in sequence, wherein x, y, M and N are all positive integers, and x=2 N , y = 2 M , and M is less than N, the first objective function value is used to characterize the rewrite cost of writing the M-bit data into a spin transfer torque random access memory STT-RAM when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the first sequence, the annealing temperature stored in the memory is a first temperature, and i is a natural number; In the (i+1)th iteration, the method includes: Generate a second sequence, the second sequence comprising x N-bit codes arranged in a second order, the x N-bit codes included in the second sequence are sequentially and evenly mapped to y M-bit data arranged in the preset order, and the second order is different from the first order; calculating a second objective function value for characterizing a rewrite cost when writing the M-bit data into the spin transfer torque random access memory STT-RAM when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the second sequence; If the second objective function value is less than the first objective function value, the first sequence and the first objective function value stored in the memory are updated to the second sequence and the second objective function value respectively, or If the second objective function value is not less than the first objective function value, it is further determined whether the value p calculated by the following formula is greater than the random value r generated between 0 and 1, and if p is greater than r, the first sequence and the second objective function value stored in the memory are updated to the second sequence and the second objective function value: Wherein, f(y) is the second objective function value, f(x) is the first objective function value, and t is the current annealing temperature; reducing the annealing temperature to a second temperature; Determine whether the iteration termination condition is met; If the iteration termination condition is met, output the second sequence and the second objective function value, the second sequence being used as a coding mapping scheme for y M-bit data arranged in the preset order; If the iteration termination condition is not met, the (i+2)th iteration is continued until the iteration termination condition is met, and the latest sequence stored in the memory and its corresponding objective function value are output.

2. The method according to claim 1, characterized in that: The generating of the second sequence comprises: The order of the p-th code and the q-th code among the x N-bit codes included in the first sequence is exchanged to generate the second sequence, where 1≤p≤N, 1≤q≤N, and p≠q.

3. The method according to claim 2, characterized in that The calculating, when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the second sequence, a second objective function value for characterizing the rewriting cost when writing the M-bit data into a spin transfer torque random access memory STT-RAM, comprises: The second objective function value is calculated according to the following formula: f(y)=f(x)-g(p)-g(q)+g'(p)+g'(q); Among them, g(p) and g(q) are respectively the third objective function value used to characterize the rewrite cost at the position where the p-th code is located and the fourth objective function value used to characterize the rewrite cost at the position where the q-th code is located when the M-bit code is written into the spin transfer torque random access memory STT-RAM in the case where the y M-bit data arranged in the preset order are mapped to the x N-bit codes included in the first sequence, and g'(p) and g'(q) are respectively the fifth objective function value used to characterize the rewrite cost at the position where the p-th code is located and the sixth objective function value used to characterize the rewrite cost at the position where the q-th code is located when the M-bit code is written into the spin transfer torque random access memory STT-RAM in the case where the y M-bit data arranged in the preset order are mapped to the x N-bit codes included in the second sequence.

4. The method according to claim 1, characterized in that The determining whether the iteration termination condition is satisfied includes: Determine whether the current number of iterations has reached the preset number of iterations, or Determine whether the current annealing temperature is less than a preset temperature threshold.

5. The method according to any one of claims 1 to 4, characterized in that The objective function value includes the number of two-step state transitions TT.

6. A device for generating a data-code mapping sequence using an annealing simulation algorithm, characterized in that: include: A processor and a memory connected to the processor in communication, wherein after the i-th iteration, the memory stores a first sequence and a first objective function value corresponding to the first sequence, the first sequence includes x N-bit codes arranged in a first order, the x N-bit codes included in the first sequence are uniformly mapped to y M-bit data arranged in a preset order in sequence, wherein x, y, M and N are all positive integers, and x=2 N , y = 2 M , and M is less than N, the first objective function value is used to characterize the rewrite cost of writing the M-bit data into a spin transfer torque random access memory STT-RAM when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the first sequence, the annealing temperature stored in the memory is a first temperature, and i is a natural number; In the (i+1)th iteration, the processor is configured to: Generate a second sequence, the second sequence comprising x N-bit codes arranged in a second order, the x N-bit codes included in the second sequence are sequentially and evenly mapped to y M-bit data arranged in the preset order, and the second order is different from the first order; calculating a second objective function value for characterizing a rewrite cost when writing the M-bit data into a spin transfer torque random access memory STT-RAM when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the second sequence; If the second objective function value is less than the first objective function value, the first sequence and the first objective function value stored in the memory are updated to the second sequence and the second objective function value respectively, or If the second objective function value is not less than the first objective function value, further determine that the value p calculated by the following formula is greater than the random value r generated between 0 and 1, and if p is greater than r, update the first sequence and the second objective function value stored in the memory to the second sequence and the second objective function value: Wherein, f(y) is the second objective function value, f(x) is the first objective function value, and t is the current annealing temperature; reducing the annealing temperature to a second temperature; Determine whether the iteration termination condition is met; If the iteration termination condition is met, output the second sequence and the second objective function value, the second sequence being used as a coding mapping scheme for y M-bit data arranged in the preset order; If the iteration termination condition is not met, the (i+2)th iteration is continued until the iteration termination condition is met, and the latest sequence stored in the memory and its corresponding objective function value are output.

7. The device according to claim 6, characterized in that The processor is configured to generate a second sequence, including: The order of the p-th code and the q-th code among the x N-bit codes included in the first sequence is exchanged to generate the second sequence, where 1≤p≤N, 1≤q≤N, and p≠q.

8. The device according to claim 7, characterized in that The processor is used to calculate a second objective function value for characterizing a rewrite cost when writing the M-bit data into a spin transfer torque random access memory STT-RAM when mapping the y M-bit data arranged in the preset order to the x N-bit codes included in the second sequence, including: The second objective function value is calculated according to the following formula: f(y)=f(x)-g(p)-g(q)+g'(p)+g'(q); Among them, g(p) and g(q) are respectively the third objective function value used to characterize the rewrite cost at the position where the p-th code is located and the fourth objective function value used to characterize the rewrite cost at the position where the q-th code is located when the M-bit code is written into the spin transfer torque random access memory STT-RAM in the case where the y M-bit data arranged in the preset order are mapped to the x N-bit codes included in the first sequence, and g'(p) and g'(q) are respectively the fifth objective function value used to characterize the rewrite cost at the position where the p-th code is located and the sixth objective function value used to characterize the rewrite cost at the position where the q-th code is located when the M-bit code is written into the spin transfer torque random access memory STT-RAM in the case where the y M-bit data arranged in the preset order are mapped to the x N-bit codes included in the second sequence.

9. The device according to claim 6, characterized in that The processor is used to determine whether an iteration termination condition is met, including: Determine whether the current number of iterations has reached the preset number of iterations, or Determine whether the current annealing temperature is less than a preset temperature threshold.

10. The device according to any one of claims 6 to 9, characterized in that The objective function value includes the number of two-step state transitions TT.

Citation Information

Patent Citations

  • Mechanical structure optimization design method based on simulated annealing algorithm and storage medium

    CN115017651A

  • Systems and method for optimizing state encoding

    US20180025101A1