The write operation method of PCMTechnical field
The present invention relates to computer memory technical field, particularly the write operation method of a kind of PCM.
Background technology
Phase transition storage (Phase Change Memory) is called for short PCM, is a kind of novel memory technology, has great application prospect.Compare advantages such as to have read or write speed fast, and the life-span is long with flash memory (Flash).But the storage particle of PCM has limited life cycle equally, and erasable number of times is 108~109Inferior.Because the advantage of read or write speed and low-power consumption aspect also can be compared the substitute of PCM as main memory DRAM with DRAM, PCM has the integration density height, and is low in energy consumption, non-volatile characteristics, but its read or write speed is slow slightly, and limited erasable number of times still is the problem of its high-lighting.How reducing the data that write back PCM becomes a kind of remarkable method of wild phase transition storage storage life.
PCM is that step-by-step is that unit is operated, and a PCM storage unit uses a kind of phase transformation material that is called to store 1 bit information.This medium can be stable have a two states: non-crystal state and crystal state.Can be used for representing in logic ' 0 ' and ' 1 '.Two states can carry out state exchange by heating.This material can also form the multiple state that can distinguish by the difference of heating-up temperature and store more information.
Summary of the invention
(1) technical matters that will solve
The technical problem to be solved in the present invention is: how to reduce the data volume that writes back to PCM, with wild phase transition storage storage life.
(2) technical scheme
The write operation method of a kind of PCM may further comprise the steps:
S1: the data block to be written that will write back in the PCM storage unit is done pre-service, obtains pretreated data block, and described pre-service comprises:
With described data block step-by-step negate to be written, and set pre-servicesign 01;
Described data block to be written and auxiliary constant are made XOR, and set pre-servicesign 10;
Described data block to be written and auxiliary constant are made same exclusive disjunction, and set pre-service sign 11;
If not pre-service, then pre-service is masked as 00;
S2: from the storage unit of PCM, read and the described corresponding original data block of data block to be written;
S3: calculate the Hamming distance between data block to be written or described pretreated data block and the described original data block, and choose the storage unit of the data block back original data block corresponding, and described pre-service sign is write back in the described storage unit with described original data block Hamming distance minimum value.
Wherein, the auxiliary constant among the described step S1 is stored in the background register newly-increased in the PCM controller.
Wherein, the length of described background register is the length of data block, and is initialized as the data that " 0 " and " 1 " replaces.
Wherein, described data block is used to store described pre-service zone bit to zone bit should be arranged.
Wherein, the mode of calculating Hamming distance is among the described step S3:.
With two length identical data step-by-step XORs, obtain the identical data of another length, the number of " 1 " is exactly their Hamming distance in these data.
Wherein, when from PCM storage unit read block, check the zone bit of data block correspondence earlier,
If 00, directly read;
If 01, then will read after the data block negate;
If 10, read after then data block and described auxiliary constant being done XOR;
If 11, then data block and described auxiliary constant are done with reading behind the exclusive disjunction.
(3) beneficial effect
The present invention is by doing pre-service to the data that will write PCM, and pretreated data and raw data are done the Hamming distance computing, the data of smallest hamming distance are written in the storage unit of raw data, reduced write operation number of times, from having prolonged the serviceable life of PCM to the PCM storage unit.
Description of drawings
Fig. 1 is the write operation method process flow diagram of a kind of PCM of the embodiment of the invention;
Fig. 2 is the structural representation of the data block in the storage unit of PCM;
Fig. 3 of the present invention through minimizing write back data volume after the schematic flow sheet of sense data.
Embodiment
Below in conjunction with drawings and Examples, the specific embodiment of the present invention is described in further detail.Following examples are used to illustrate the present invention, but are not used for limiting the scope of the invention.
The invention provides a kind of thinking of data conversion of utilizing and reduce the design that writes back data volume, this method occurs in when the data in the buffer memory of upper strata and changes need write back the storage unit of phase transition storage PCM the time, and following steps are primarily implemented in the controller of phase transition storage PCM.As shown in Figure 1, reduce and to write back method of operating and comprise:
Step S101, the data block to be written that will write back in the PCM storage unit is done pre-service, obtains pretreated data block, and described pre-service comprises:
Should data block step-by-step negate to be written, and set pre-servicesign 01;
Should data block to be written and auxiliary constant make XOR, and set pre-servicesign 10;
Should data block to be written and auxiliary constant make same exclusive disjunction, and set pre-service sign 11;
If not pre-service, then pre-service is masked as 00.
Wherein, increase a background register R1 in the controller of PCM, preserve data isometric with data block, as the auxiliary operation constant, this register R1 is initially the data that replace for " 0 " and " 1 ", as 0101...0101 or 1010...1010.
Each data block of PCM increases by two zone bits, and as shown in Figure 2, zone bit has two in the present embodiment, can represent 4 kinds of data modes, respectively expression: 00 raw data, 01 negate data, 10 xor datas, 11 same or data are put corresponding marker bit when data write back.
Step S102 reads the original data block corresponding with this data block to be written from the storage unit of PCM.
Step S103 calculates the Hamming distance between this data block to be written or pretreated data block and the original data block.The account form of Hamming distance has a variety of, and purpose is to calculate the minor increment of two data interblocks.Account form in the present embodiment is: data block to be written and pretreated data block respectively with original data block step-by-step XOR, obtain the identical data of another length respectively, the number of " 1 " is exactly their Hamming distance in these data, the few more expression Hamming distance of the number of " 1 " is more little, treat that promptly write data or pretreated data and raw data are relatively, identical bit position different value is minimum, writes the fashionable least number of times that writes like this.
Direct and original data block calculating Hamming distance is designated as result 1 with this data block to be written;
This data block to be written is designated as result 2 through calculating Hamming distance with original data block behind the inversion operation;
The carrying out of auxiliary constant among this data block to be written and the register R1 calculated Hamming distance with original data block behind the XOR, is designated as result 3;
Auxiliary constant among this data block to be written and the register R1 carries out being designated as result 4 with calculating Hamming distance with original data block behind the exclusive disjunction.
Choose the storage unit of the data block back original data block corresponding, and the pre-service sign of correspondence is write back in the data block respective flag position with described original data block Hamming distance minimum value.
As shown in Figure 3, when from PCM storage unit read block, check the zone bit of data block correspondence earlier:
If 00, directly read;
If 01, then will read after the data block negate;
If 10, read after then the auxiliary constant among data block and the background register R1 being done XOR;
If 11, then the auxiliary constant among data block and the background register R1 is done with reading behind the exclusive disjunction.
Above embodiment only is used to illustrate the present invention; and be not limitation of the present invention; the those of ordinary skill in relevant technologies field; under the situation that does not break away from the spirit and scope of the present invention; can also make various variations and modification; therefore all technical schemes that are equal to also belong to category of the present invention, and scope of patent protection of the present invention should be defined by the claims.