WO2015154298A1 - Data processing method and apparatus - Google Patents

Data processing method and apparatus Download PDF

Info

Publication number
WO2015154298A1
WO2015154298A1 PCT/CN2014/075141 CN2014075141W WO2015154298A1 WO 2015154298 A1 WO2015154298 A1 WO 2015154298A1 CN 2014075141 W CN2014075141 W CN 2014075141W WO 2015154298 A1 WO2015154298 A1 WO 2015154298A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
target
type
storage unit
unit
Prior art date
Application number
PCT/CN2014/075141
Other languages
French (fr)
Chinese (zh)
Inventor
刘海燕
徐君
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201480003909.0A priority Critical patent/CN105556489B/en
Priority to PCT/CN2014/075141 priority patent/WO2015154298A1/en
Publication of WO2015154298A1 publication Critical patent/WO2015154298A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present invention relates to the field of electronic technologies, and in particular, to a data processing method and apparatus. Background technique
  • Non-volatile memory such as Phase-change Random Access Memory (PCM)
  • PCM Phase-change Random Access Memory
  • the data unit generally includes one or two types of data, for example: data including a data value of 1 and/or data having a data value of 0.
  • the existing method of storing the data unit in the storage unit of the PCM memory is to pre-fill all the digits of the storage unit into data with a data value of 1, and when the data unit needs to be stored in the storage unit, the data unit is searched.
  • the data in which the data value is 0 is at the target position in the data unit, and then the data having the digital value of 0 is written into the storage location corresponding to the target location in the storage unit, so that the data unit is stored in the storage unit.
  • Embodiments of the present invention provide a data processing method and apparatus, which can efficiently store a target data unit into a target storage unit, and consume less power.
  • a first aspect of the present invention provides a data processing method, which may include:
  • the number of the first data in the target data unit and the number of the second data are obtained, the type of the first data is a first type, and the type of the second data is a Two types; If the number of the first data is greater than the number of the second data, acquiring a first target location of the second data in the target data unit, and pre-populating the second type The first type of data is written in the first target location in a target storage unit of data.
  • the method further includes: if the number of the first data is less than or equal to the number of the second data, acquiring the first data a second target location in the target data unit, and writing the first type of data into the second target location in a target storage unit pre-filled with the second type of data.
  • a second possible implementation if the number of the first data is greater than the number of the second data, acquiring the second data After the first target location in the target data unit and the first target location in the target storage location pre-filled with the second type of data is written in the first type of data, :
  • the first identifier is used to identify that data stored in the target storage unit is not original data in the target data unit.
  • a data is in a second target location in the target data unit, and after the first type of data is written in the second target location in a target storage unit pre-filled with the second type of data, Also includes:
  • the second identifier is used to identify that the data stored in the target storage unit is original data in the target data unit.
  • the method further includes:
  • the flag bit is the first identifier, converting the first type of data in the target storage unit into the second type of data, and the second type of the target storage unit Converting data into the first type of data, and determining the converted data as the target data unit stored in the target storage unit;
  • a second aspect of the present invention provides a data processing apparatus, which may include:
  • An acquiring module configured to acquire, when the target data unit needs to be stored, the number of the first data and the number of the second data in the target data unit, where the type of the first data is the first type, the second The type of data is the second type;
  • a first writing module configured to acquire, when the number of the first data is greater than the number of the second data, a first target location of the second data in the target data unit, and Writing the first type of data into the first target location in a target storage unit populated with the second type of data.
  • the device further includes: a second writing module, configured to: if the number of the first data is less than or equal to the number of the second data, And acquiring a second target location of the first data in the target data unit, and writing the first target location in the target storage unit pre-filled with the second type of data into the first target location Type of data.
  • a second writing module configured to: if the number of the first data is less than or equal to the number of the second data, And acquiring a second target location of the first data in the target data unit, and writing the first target location in the target storage unit pre-filled with the second type of data into the first target location Type of data.
  • the apparatus further includes:
  • a first setting module configured to set a flag bit of the target storage unit as a first identifier, where the first identifier is used to identify that data stored in the target storage unit is not original data in the target data unit .
  • the second setting module is configured to set a flag of the target storage unit to a second identifier, where the second identifier is The data used to identify the target storage unit is the original data in the target data unit.
  • the apparatus further includes:
  • a reading module configured to read a flag bit of the target storage unit when the target data unit stored in the target storage unit needs to be acquired
  • a conversion determining module configured to: if the flag bit is the first identifier, the target storage list Transforming the first type of data into the second type of data, converting the second type of data in the target storage unit into the first type of data, and converting the processed Determining data as the target data unit stored in the target storage unit;
  • a read determining module configured to: if the flag bit is the second identifier, read the target to store the target data unit.
  • a third aspect of the present invention provides a data processing apparatus, which may include a processor, where: the processor is configured to acquire, when the target data unit needs to be stored, the number of the first data in the target data unit and the second The number of the data, the type of the first data is a first type, and the type of the second data is a second type;
  • the processor is further configured to: if the number of the first data is greater than the number of the second data, acquire a first target location of the second data in the target data unit, and pre-populate Writing the first type of data into the first target location in a target storage unit of the second type of data.
  • the processor is further configured to acquire the first data if the number of the first data is less than or equal to the number of the second data. And writing, in the second target location in the target data unit, the first type of data in the second target location in a target storage unit pre-filled with the second type of data.
  • the processor is further configured to set a flag of the target storage unit as a first identifier, where the first identifier is used
  • the data stored in the target storage unit is not the original data in the target data unit.
  • the processor is further configured to set a flag of the target storage unit to a second identifier, where the second identifier is The data used to identify the target storage unit is the original data in the target data unit.
  • the processor is further configured to: when the target data unit stored in the target storage unit needs to be acquired, read Taking the flag of the target storage unit;
  • the processor is further configured to: if the flag bit is the first identifier, then the target storage unit Converting the first type of data into the second type of data, converting the second type of data in the target storage unit into the first type of data, and converting the processed Data is determined to be the target data unit stored in the target storage unit;
  • the processor is further configured to read the target storage target data unit if the flag bit is the second identifier.
  • the number of the first data of the first type and the second type of the second type of the type in the target data unit are obtained, when the first When the number of data is greater than the number of second data, a target position of the second data in the target data unit is obtained, and a target in the target storage unit of the second type of data is pre-filled
  • the location is written to the first type of data, in place of the second data in the target data unit.
  • the first type of data in the target storage unit is used to replace the second type of data in the target data unit, in the target data.
  • FIG. 1 is a schematic flow chart of a data processing method provided by the present invention.
  • FIG. 2 is a schematic flow chart of another data processing method provided by the present invention.
  • FIG. 3 is a storage structure diagram provided by the present invention.
  • FIG. 4 is a schematic structural diagram of a data processing apparatus according to the present invention.
  • FIG. 5 is a schematic structural diagram of another data processing apparatus according to the present invention.
  • FIG. 6 is a schematic structural diagram of still another data processing apparatus according to the present invention.
  • the technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
  • the first type of data may be data with a data value of 0, and the second type of data may be data with a data value of 1.
  • the first type of data may be data with a data value of 1.
  • the second type of data may be data having a data value of zero.
  • the data processing method of the embodiment of the present invention can be applied to an application scenario for storing data in a computer memory.
  • computer memory is generally stored by a non-volatile memory NVM, such as PCM memory, and its expansion. Better performance, greater density, greater capacity, and lower energy consumption.
  • the data stored in the memory can be binary data. When writing '0' to the PCM, add a higher voltage for a shorter duration. When writing T to the PCM, add a lower voltage for the duration. Longer time.
  • FIG. 1 is a schematic flowchart diagram of a data processing method according to an embodiment of the present invention; the method may include the following steps S100-S101.
  • the target data unit when the target data unit needs to be stored, acquiring the number of the first data and the number of the second data in the target data unit, the type of the first data is a first type, and the type of the second data For the second type;
  • the target data unit when the target data unit needs to be stored in the target storage unit, firstly, the number of the first data and the second data in the target data unit needs to be acquired, and the data is stored in the computer system.
  • it is stored in the form of data units, and one data unit can include 8 bits of data. Therefore, there are multiple data in the target data unit, and the types of data included in the target data unit may also be various.
  • the types included in the target data unit are Two types, the first type and the second type, the first type of data may be data having a data value of 0, and the second type of data may be data having a data value of 1, then the first data in the target data unit is All data with a data value of 0, the second data is data with a total data value of 1.
  • the first type of data may also be data with a data value of 1, second.
  • the type of data may be data with a data value of 0, and the first data in the target data unit is data with all data values of 1, and the second data is data with all data values of 0.
  • the first type of data is written in the first target location in the target storage unit of the type of data.
  • the computer memory when the data is stored in the computer memory, in order to reduce the amount of data written to the data, and reduce the delay, the computer memory is generally pre-filled, that is, each storage unit is pre-filled with one type.
  • Type data when storing data to a storage unit, directly modify the number of bits of the data value directly in the storage unit. Because the number of bits that need to be modified is too large, and a large amount of data needs to be written, the power consumption is long and the delay is long. Therefore, in the embodiment of the present invention, the pre-filled data type is the second type of data.
  • the first target position of the second type of data in the target data unit is directly obtained, and Writing the first type of data into the first target location in the target storage unit, replacing the second type of data in the target data unit with the first type of data, and replacing the first type of the target data unit with the second type of data Data is equivalent to flipping the data in the target data unit.
  • the binary data is stored in the target storage unit as an example. Since power consumption and delay are comprehensively considered, data of a data value of 1 is generally pre-filled in the target storage unit, that is, the second type of data is a data value.
  • the first type of data is data with a data value of zero.
  • the target data unit is 10000100
  • the data value is 0, the data number is 6, and the data value is 1. If the number of data with the data value of 0 is greater than the number of data with the data value of 1, the first target position of the data with the data value of 1 in the target data unit is obtained.
  • the first target When the position is the first bit and the sixth bit, the data having the data value of 0 is written in the first bit and the sixth bit of the target memory unit, and the data having the data value of 1 in the target data unit is replaced in the target storage unit.
  • the stored data is 01111011, and the stored data is not the original data of the target data unit, but the inversed data of the original data.
  • the number of the first data of the first type and the second type of the second type of the type in the target data unit are obtained.
  • the number of the first data is greater than the number of the second data
  • the target position of the second data in the target data unit is obtained in a relatively small number
  • the target storage unit of the second type of data is pre-filled
  • the first type of data is used to replace the second type of data in the target data unit.
  • the second type of data in the target data unit is replaced by the first type of data in the target storage unit. There is more data of the first type in the target data unit.
  • FIG. 2 is a schematic flowchart diagram of another data processing method according to an embodiment of the present invention; the method may include the following steps S200-S207.
  • the target data unit when the target data unit needs to be stored, acquiring the number of the first data and the number of the second data in the target data unit, the type of the first data is a first type, and the type of the second data For the second type;
  • Step S200 of the embodiment of the present invention can refer to step S100 shown in FIG. 1 , and no further description is provided herein.
  • the first type of data is written in the first target location in the target storage unit of the type of data.
  • Step S201 of the embodiment of the present invention can refer to step S101 shown in FIG. 1 , and no further description is provided herein.
  • the flag of the target storage unit needs to be set, when the data stored in the target storage unit is not the original of the target data unit.
  • the data that is, when stored, is stored according to the method of step S201, and the flag bit of the target storage unit is set as the first identifier, and the first identifier is the data non-target data unit stored in the identifier target storage unit.
  • the original data in FIG. 3 is a scene graph for storing binary data in the PCM memory.
  • the flag bit is set with the first identifier, and the first identifier is replaced by the data with the data value of 0. .
  • the number stored in the target storage unit According to 01111011, it is not the original data of the target data unit.
  • the data in the target storage unit needs to be bit-inverted.
  • the number of the first data is less than or equal to the number of the second data, acquire a second target location of the first data in the target data unit, and pre-populate the The first type of data is written in the second target location in a target storage unit of the second type of data.
  • the type of the first data is a first type
  • the type of the second data is a second type
  • the type of the data pre-filled in the target storage unit is the second type. Since the number of the first data in the target data unit is less than or equal to the number of the second data, in order to write a smaller amount of data in the target storage unit, Then, the first type of data can be directly written in the corresponding position in the target storage unit, that is, the data stored in the target storage unit is the original data in the target data unit.
  • the binary data is stored in the target storage unit as an example. Since power consumption and delay are comprehensively considered, data of a data value of 1 is generally pre-filled in the target storage unit, that is, the second type of data is a data value.
  • the first type of data is data with a data value of zero.
  • the target data unit is 11111010
  • the data value is 0, the data number is 2, and the data value is 1.
  • the number of data is 6, the number of data whose data value is 0 is smaller than the number of data whose data value is 1, and the first target position of the data whose data value is 0 in the target data unit is obtained.
  • the target position is the sixth bit and the eighth bit
  • the data with the data value of 0 is written in the sixth and eighth bits of the target storage unit, and the data of the data value of 0 in the target data unit is replaced, and the target storage is performed.
  • the data stored in the unit is 11111010, and the stored data is the original data of the target data unit, specifically, the second storage unit in the PCM memory as described in FIG.
  • S204 Set a flag of the target storage unit to a second identifier, where the second identifier is used to identify that the data stored in the target storage unit is original data in the target data unit.
  • the flag of the target storage unit needs to be set, when the data stored in the target storage unit is the original of the target data unit.
  • the data that is, stored, according to the method of step S203, sets the flag of the target storage unit to the second identifier, and the second identifier is the scene graph for storing the binary data in the target memory.
  • the flag is set.
  • the second identifier, the second identifier is replaced by data having a data value of 1.
  • the data 11111010 stored in the target storage unit is the original data of the target data unit, and when the target data unit stored in the target storage unit needs to be read, the data in the target storage unit is directly read.
  • the target data unit needs to be acquired from the target storage unit.
  • the method for acquiring the target data unit is based on the rule of storing the target data unit in the target storage unit, so when the target data unit stored in the target storage unit needs to be acquired, the target storage unit is first read.
  • the flag bit is used to identify whether the data stored in the target storage unit is the original data in the target data unit.
  • the flag of the target storage unit is the first identifier, indicating that the data stored in the target storage unit is the original data of the non-target data unit, when it is required to acquire the target stored in the target storage unit.
  • the target data units stored in the target storage unit are sequentially.
  • the description is continued by taking the binary data stored in the target storage unit as an example.
  • the flag of the first target storage unit is the first identifier, that is, the data with the data bit value of 0 is It indicates that the data stored in the target storage unit needs to be converted.
  • the first type of data that is, the data with the data value of 0 needs to be converted into the second type of data, that is, the data with the data value of 1;
  • the second type of data That is, the data with a data value of 1 needs to be converted into the first type of data, that is, the data with the data value of 0. Therefore, the data stored in the target storage unit is sequentially converted.
  • the obtained binary data is: 10000100, and the data 10000100 is determined as the target data unit stored in the target storage unit.
  • the flag bit of the target storage unit is the second identifier
  • the flag of the target storage unit is the second identifier, that is, the data with the data value of 1, the target storage unit.
  • the data 11111010 stored in the target data unit is the original data in the target data unit, so when it is necessary to acquire the target data unit stored in the target storage unit, only the stored data 11111010 needs to be read from the target storage unit, and the data 11111010 is determined.
  • the target data unit stored for the target storage unit is the original data in the target data unit.
  • the number of the first data of the first type and the second type of the second type of the type in the target data unit are obtained, when the first When the number of data is greater than the number of second data, a target position of the second data in the target data unit is obtained, and a target in the target storage unit of the second type of data is pre-filled
  • the location is written to the first type of data, in place of the second data in the target data unit.
  • the first type of data in the target storage unit is used to replace the second type of data in the target data unit, in the target data.
  • FIG. 4 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention
  • the data processing apparatus may include: an obtaining module 100 and a first writing module 101.
  • the obtaining module 100 is configured to acquire, when the target data unit needs to be stored, the number of the first data and the second data in the target data unit, where the type of the first data is a first type, The type of the second data is the second type;
  • the first acquiring module 100 when the target data unit needs to be stored in the target storage unit, the first acquiring module 100 needs to acquire the number of the first data and the second data in the target data unit, and compare the data in the computer system.
  • it is generally stored in the form of data units, and one data unit can include 8 bits of data. Therefore, there are multiple data in the target data unit, and the types of data included in the target data unit may also be various.
  • the types included in the target data unit are Two types, the first type and the second type, the first type of data may be data having a data value of 0, and the second type of data may be data having a data value of 1, then the first data in the target data unit is All data with a data value of 0, the second data is data with a total data value of 1.
  • the first type of data may also be data with a data value of 1
  • the second type of data may be data with a data value of 0, and the first data in the target data unit is all data values of 1.
  • Data, the second data is all data with a data value of 0
  • the first writing module 101 is configured to: if the number of the first data is greater than the number of the second data, acquire a first target location of the second data in the target data unit, and The first type of data is written in the first target location in a target storage unit pre-filled with the second type of data.
  • the computer memory when the data is stored in the computer memory, in order to reduce the amount of data written to the data, and reduce the delay, the computer memory is generally pre-filled, that is, each storage unit is pre-filled with one type.
  • Type data when storing data to a storage unit, directly modify the number of bits of the data value directly in the storage unit. Because the number of bits that need to be modified is too large, and a large amount of data needs to be written, the power consumption is long and the delay is long. Therefore, in the embodiment of the present invention, the pre-filled data type is the second type of data.
  • the first writing module 101 When the number of the first data of the first type in the target data unit is greater than the number of the second data of the second type, the first writing module 101 directly acquires the second type of data in the target data unit. a first target location, and writing the first type of data in the first target location in the target storage unit, replacing the second type of data in the target data unit with the first type of data, and replacing the target data with the second type of data
  • the first type of data in the unit is equivalent to flipping the data in the target data unit.
  • the binary data is stored in the target storage unit as an example. Since power consumption and delay are comprehensively considered, data of a data value of 1 is generally pre-filled in the target storage unit, that is, the second type of data is a data value.
  • the first type of data is data with a data value of zero.
  • the target data unit is 10000100
  • the data value is 0, the data number is 6, and the data value is 1.
  • the first target position of the data with the data value of 1 in the target data unit is obtained.
  • the first target When the position is the first bit and the sixth bit, the data having the data value of 0 is written in the first bit and the sixth bit of the target memory unit, and the data having the data value of 1 in the target data unit is replaced in the target storage unit.
  • the stored data is 01111011, and the stored data is not the original data of the target data unit, but the inversed data of the original data.
  • the number of the first data of the first type and the second type of the second type of the type in the target data unit are obtained, when the first When the number of data is greater than the number of second data, a target position of the second data in the target data unit is obtained, and a target in the target storage unit of the second type of data is pre-filled
  • the location is written to the first type of data, in place of the second data in the target data unit.
  • the first type of data in the target storage unit is used to replace the second type of data in the target data unit, in the target data.
  • FIG. 5 is a schematic structural diagram of another data processing apparatus according to an embodiment of the present invention.
  • the data processing apparatus may include: an obtaining module 100, a first writing module 101, a first setting module 102, and a second writing.
  • a first setting module 102 configured to set a flag bit of the target storage unit as a first identifier, where the first identifier is used to identify that data stored in the target storage unit is not original in the target data unit data.
  • the first setting module 102 needs to set the flag bit of the target storage unit, when the data stored in the target storage unit is not The original data of the target data unit, the first setting module 102 sets the flag bit of the target storage unit as the first identifier, where the first identifier is the original data in the non-target data unit of the data stored in the target storage unit, such as As shown in FIG.
  • the data in the target storage unit needs to be bit-inverted.
  • a second writing module 103 configured to acquire a second target position of the first data in the target data unit, if the number of the first data is less than or equal to the number of the second data, And writing the first type of data into the second target location in a target storage unit pre-filled with the second type of data.
  • the type of the first data is a first type
  • the type of the second data is a second type
  • the type of the data pre-filled in the target storage unit is the second type. Since the number of the first data in the target data unit is less than or equal to the number of the second data, in order to write a smaller amount of data in the target storage unit, Then the second write module 103 can directly source the corresponding data of the corresponding bits in the target storage unit.
  • the binary data is stored in the target storage unit as an example. Since power consumption and delay are comprehensively considered, data of a data value of 1 is generally pre-filled in the target storage unit, that is, the second type of data is a data value.
  • the first type of data is data with a data value of zero.
  • the target data unit is 11111010
  • the data value is 0, the data number is 2, and the data value is 1.
  • the number of data is 6, the number of data having a data value of 0 is smaller than the number of data having a data value of 1, and the second writing module 103 acquires the first target position of the data having the data value of 0 in the target data unit.
  • the first target position is the sixth bit and the eighth bit
  • the second writing module 103 writes the data with the data value of 0 in the sixth and eighth bits of the target storage unit, and replaces the target data. If the data value of the unit is 0, the data stored in the target storage unit is 11111010, and the stored data is the target.
  • the raw data of the data unit specifically, the second storage unit in the PCM memory as described in FIG.
  • a second setting module 104 configured to set a flag bit of the target storage unit as a second identifier, where the second identifier is used to identify that data stored in the target storage unit is original in the target data unit data.
  • the second setting module 104 needs to set the flag bit of the target storage unit, when the data stored in the target storage unit is The raw data of the target data unit, the second setting module 104 sets the flag bit of the target storage unit as the second identifier, and the second identifier is that the data stored in the target storage unit is the original data in the target data unit, such as As shown in FIG. 3, which is a scene graph for storing binary data in the PCM memory, in the second target storage unit, the flag bit is set with the second identifier, and the second identifier is replaced with the data with the data value of 1. Then, the data 11111010 stored in the target storage unit is the original data of the target data unit, and when the target data unit stored in the target storage unit needs to be read, the data in the target storage unit is directly read.
  • the reading module 105 is configured to read a flag bit of the target storage unit when the target data unit stored in the target storage unit needs to be acquired;
  • the target data unit needs to be acquired from the target storage unit.
  • the method for acquiring the target data unit is based on the rule of storing the target data unit in the target storage unit, so when the target data unit stored in the target storage unit needs to be acquired, the reading module 105 reads first.
  • the flag bit of the target storage unit is used to identify whether the data stored in the target storage unit is the original data in the target data unit.
  • the conversion determining module 106 is configured to: if the flag bit is the first identifier, convert the first type of data in the target storage unit into the second type of data, and use the target storage unit The second type of data is converted into the first type of data, and the conversion processed as an optional implementation manner, if the target storage unit flag is the first identifier, indicating the target The data stored in the storage unit is not the original data of the target data unit. When it is required to acquire the target data unit stored in the target storage unit, the conversion determination module 106 needs to target the storage unit. The data stored in is subjected to a series of conversion processing.
  • the conversion determining module 106 converts the first type of data into the second type of data, and if the data in the target storage unit is the second type of data, the conversion determines Module 106 converts the second type of data into the first type of data.
  • the conversion determination module 106 sequentially pairs the target data units stored in the target storage unit.
  • the description is continued by taking the binary data stored in the target storage unit as an example.
  • the flag of the first target storage unit is the first identifier, that is, the data with the data bit value of 0 is It indicates that the data stored in the target storage unit needs to be converted.
  • the first type of data that is, the data with the data value of 0 needs to be converted into the second type of data, that is, the data with the data value of 1;
  • the second type of data That is, the data with the data value of 1 needs to be converted into the first type of data, that is, the data with the data value of 0. Therefore, the conversion determining module 106 sequentially converts the binary data obtained by converting each data stored in the target storage unit into : 10000100, the data 10000100 is determined as the target data unit stored by the target storage unit.
  • the read determining module 107 is configured to read the target data unit of the target storage if the flag bit is the second identifier.
  • the read determination module 107 directly reads the destination target data unit.
  • the description is continued by taking the binary data stored in the target storage unit as an example.
  • the flag of the target storage unit is the second identifier, that is, the data with the data value of 1.
  • the data 11111010 stored in the target storage unit is the original data in the target data unit, and therefore, when the target data unit stored in the target storage unit needs to be acquired, only the read determination module 107 needs to read from the target storage unit.
  • the stored data 11111010 is determined as the target data unit stored by the target storage unit.
  • the target data unit when the target data unit needs to be stored, the target data unit is acquired.
  • the number of the first data of the first type and the number of the second data of the second type are relatively small when the number of the first data is greater than the number of the second data.
  • the second data is in a target location in the target data unit, and the target location in the target storage unit pre-filled with the second type of data is written into the first type of data, in place of the second data in the target data unit,
  • the first type of data in the target storage unit is used to replace the second type of data in the target data unit.
  • FIG. 6 is a schematic structural diagram of still another data processing apparatus according to an embodiment of the present invention.
  • the data processing apparatus may include: a processor 200.
  • the processor 200 is configured to acquire, when the target data unit needs to be stored, the number of the first data and the second data in the target data unit, where the type of the first data is the first type, The type of the second data is the second type;
  • the target data unit needs to be stored in the target storage unit, first, the number of the first data and the second data in the target data unit are acquired, and when the data is stored in the computer system, generally It is stored in the form of data units, and one data unit can include 8 bits of data. Therefore, there are multiple data in the target data unit, and the types of data included in the target data unit may also be various.
  • the types included in the target data unit are Two types, the first type and the second type, the first type of data may be data having a data value of 0, and the second type of data may be data having a data value of 1, then the first data in the target data unit is All data with a data value of 0, the second data is data with a total data value of 1.
  • the first type of data may also be data with a data value of 1
  • the second type of data may be data with a data value of 0, and the first data in the target data unit is all data values of 1.
  • the second data is the data with all data values of 0.
  • the processor 200 is further configured to: if the number of the first data is greater than the number of the second data, acquire a first target location of the second data in the target data unit, and pre-populate Writing the first type of data into the first target location in a target storage unit of the second type of data.
  • the computer memory is generally pre-filled, that is, each type of storage unit is pre-filled with a type. Data, when storing data to a storage unit, directly modify the number of bits of the data value directly in the storage unit.
  • the pre-filled data type is the second type of data.
  • the number of the first data of the first type in the target data unit is greater than the number of the second data of the second type, the first target position of the second type of data in the target data unit is directly obtained, and Writing the first type of data into the first target location in the target storage unit, replacing the second type of data in the target data unit with the first type of data, and replacing the first type of the target data unit with the second type of data Data is equivalent to flipping the data in the target data unit.
  • the binary data is stored in the target storage unit as an example. Since power consumption and delay are comprehensively considered, data of a data value of 1 is generally pre-filled in the target storage unit, that is, the second type of data is a data value.
  • the first type of data is data with a data value of zero.
  • the target data unit is 10000100
  • the data value is 0, the data number is 6, and the data value is 1. If the number of data with the data value of 0 is greater than the number of data with the data value of 1, the first target position of the data with the data value of 1 in the target data unit is obtained.
  • the first target When the position is the first bit and the sixth bit, the data having the data value of 0 is written in the first bit and the sixth bit of the target memory unit, and the data having the data value of 1 in the target data unit is replaced in the target storage unit.
  • the stored data is 01111011, and the stored data is not the original data of the target data unit, but the inversed data of the original data.
  • the processor 200 is further configured to: if the number of the first data is less than or equal to the number of the second data, acquire the first data in the target data. a second target location in the cell, and writing the first type of data in the second target location in a target storage unit pre-filled with the second type of data.
  • the type of the first data is a first type
  • the type of the second data is a second type
  • the type of data pre-filled in the target storage unit is the second type, since the number of the first data in the target data unit is less than or equal to the number of the second data, in order to write less data in the target storage unit Quantity, then the first type of data can be directly written in the corresponding position in the target storage unit, that is, the target is described here by storing binary data in the target storage unit as an example, due to comprehensive consideration of power consumption and delay, generally Data having a data value of 1 is pre-filled in the target storage unit, that is, data of the second type is data having a data value of 1, and data of the first type is data having a data value of zero.
  • the target data unit is 11111010
  • the data value is 0, the data number is 2, and the data value is 1.
  • the number of data is 6, the number of data whose data value is 0 is smaller than the number of data whose data value is 1, and the first target position of the data whose data value is 0 in the target data unit is obtained.
  • the target position is the sixth bit and the eighth bit
  • the data with the data value of 0 is written in the sixth and eighth bits of the target storage unit, and the data of the data value of 0 in the target data unit is replaced, and the target storage is performed.
  • the data stored in the unit is 11111010, and the stored data is the original data of the target data unit, specifically, the second storage unit in the PCM memory as described in FIG.
  • the processor 200 is further configured to set a flag of the target storage unit as a first identifier, where the first identifier is used to identify data stored in the target storage unit. Not raw data in the target data unit.
  • the flag of the target storage unit needs to be set, and when the data stored in the target storage unit is not the original data of the target data unit, that is, When the storage is performed according to the method of step S201, the flag bit of the target storage unit is set as the first identifier, and the first identifier is the original data in the non-target data unit of the data stored in the target storage unit.
  • the flag bit is set with the first identifier, and the first identifier is replaced by the data with the data value of 0.
  • the data 01111011 stored in the target storage unit is not the original data of the target data unit.
  • the data in the target storage unit needs to be bit-inverted.
  • the processor 200 is further configured to set a flag bit of the target storage unit as a second identifier, where the second identifier is used to identify data stored in the target storage unit. Is the raw data in the target data unit.
  • the target needs to be The flag of the storage unit.
  • the data stored in the target storage unit is the original data of the target data unit, that is, when stored, according to the method of step S203, the flag of the target storage unit is set.
  • the second identifier is that the data stored in the target storage unit is the original data in the target data unit, as shown in FIG. 3, is a scene graph for storing binary data in the PCM memory, in the second In the target storage unit, the flag bit is set with the second identifier, and the second identifier is replaced by the data with the data value of 1.
  • the data 11111010 stored in the target storage unit is the original data of the target data unit, and when the target data unit stored in the target storage unit needs to be read, the data in the target storage unit is directly read.
  • the processor 200 is further configured to: when the target data unit stored in the target storage unit needs to be acquired, read a flag of the target storage unit; After the target data unit is stored to the target data unit, when the target data unit is to be called, the target data unit needs to be acquired from the target storage unit.
  • the method for acquiring the target data unit is based on the rule of storing the target data unit in the target storage unit, so when the target data unit stored in the target storage unit needs to be acquired, the target storage unit is first read. The flag bit is used to identify whether the data stored in the target storage unit is the original data in the target data unit.
  • the processor 200 is further configured to: if the flag bit is the first identifier, convert the first type of data in the target storage unit into the second type of data, and store the target Converting the second type of data in the unit into the first type of data, and determining the converted data as the target data unit stored in the target storage unit;
  • the flag of the target storage unit is the first identifier, indicating that the data stored in the target storage unit is the original data of the non-target data unit
  • a series of conversion processing is performed on the data stored in the target storage unit. If the data in the target storage unit is the first type of data, converting the first type of data into the second type of data, and if the data in the target storage unit is the second type of data, the second type of data is Convert to the first type of data.
  • the following is a description of all the data stored in the target storage unit, and the binary data stored in the target storage unit is taken as an example. As shown in FIG.
  • the flag of the first target storage unit is the first identifier, that is, Is the flag bit as the data value is 0
  • the data indicates that the data stored in the target storage unit needs to be converted.
  • the first type of data that is, the data with the data value of 0 needs to be converted into the second type of data, that is, the data with the data value of 1;
  • the second type of data that is, the data having the data value of 1 needs to be converted into the first type of data, that is, the data having the data value of 0. Therefore, the binary data obtained by converting the respective data stored in the target storage unit in turn is : 10000100, the data 10000100 is determined as the target data unit stored by the target storage unit.
  • the processor 200 is further configured to read the target data unit of the target storage if the flag bit is the second identifier.
  • the flag bit of the target storage unit is the second identifier, it indicates that the data stored in the target storage unit is the original data of the target data unit, and therefore, when the target data unit stored in the target storage unit needs to be acquired, And directly reading the data stored in the target storage unit, and determining the read data as the target data unit stored in the target storage unit.
  • the description is continued by taking the binary data stored in the target storage unit as an example.
  • the flag of the target storage unit is the second identifier, that is, the data with the data value of 1.
  • the data 11111010 stored in the target storage unit is the original data in the target data unit. Therefore, when the target data unit stored in the target storage unit needs to be acquired, only the stored data 11111010 needs to be read from the target storage unit.
  • the data 11111010 is determined as the target data unit stored by the target storage unit.
  • the number of the first data of the first type and the second type of the second type of the type in the target data unit are obtained, when the first When the number of data is greater than the number of second data, a target position of the second data in the target data unit is obtained, and a target in the target storage unit of the second type of data is pre-filled
  • the location is written to the first type of data, in place of the second data in the target data unit.
  • the first type of data in the target storage unit is used to replace the second type of data in the target data unit, in the target data.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Disclosed are a data processing method and apparatus. The data processing method comprises: when a target data unit needs to be stored, obtaining the number of first data and the number of second data in the target data unit, with the type of the first data being a first type and the type of the second data being a second type; and if the number of the first data is larger than the number of the second data, obtaining a first target location of the second data in the target data unit, and writing data of the first type into the first target location in a target storage unit prefilled as data of the second type. The use of the present invention enables an efficient storage of the target data unit into the target storage unit, and there is small power consumption.

Description

一种数据处理方法、 装置  Data processing method and device
技术领域 Technical field
本发明涉及电子技术领域, 尤其涉及一种数据处理方法、 装置。 背景技术  The present invention relates to the field of electronic technologies, and in particular, to a data processing method and apparatus. Background technique
随着各种应用的发展, 往往需要对各种应用中所用到的数据进行存储, 通常是将各种应用的数据存储在计算机的内存中,现今各种计算机内存是釆用 新型的非易失性存储器 ( non- volatile memory , NVM ) , 例如相变存储器 ( Phase-change Random Access memory, PCM ), PCM存储器中包括多个存储 单元, 当需要对各种应用数据进行存储时, 将应用数据划分为数据单元, 然后 向 PCM存储器的存储单元中存入相应的数据单元,数据单元一般包括一种或者 两种类型数据, 例如: 包括数据值为 1的数据和 /或数据值为 0的数据。  With the development of various applications, it is often necessary to store the data used in various applications, usually storing the data of various applications in the memory of the computer. Nowadays, various computer memories use new nonvolatiles. Non-volatile memory (NVM), such as Phase-change Random Access Memory (PCM), which includes multiple storage units. When it is necessary to store various application data, the application data is divided. As a data unit, the corresponding data unit is then stored in the memory unit of the PCM memory. The data unit generally includes one or two types of data, for example: data including a data value of 1 and/or data having a data value of 0.
现有的将数据单元存储至 PCM存储器的存储单元中的方法为, 将存储单 元的所有位数预填充为数据值为 1的数据, 当需要往存储单元中存储数据单元 时, 则查找数据单元中数据值为 0的数据在数据单元中的目标位置, 然后向存 储单元中对应于目标位置的存储位置中写入数字值为 0的数据, 这样就将数据 单元存储在存储单元中。 这种方法在数据单元中所包括的数字值为 0的数据个 数少于数字值为 1的数据的个数时, 减少了存储数据的功耗与延时, 但是当数 据单元中所包括的数字值为 0的数据个数多于数字值为 1的数据的个数时,这种 方法由于需要去查找数据单元中数字值为 0的数据的目标位置, 反而会增加存 储数据的功耗与延时, 所以这种方法在数据单元中数字值为 0的数据个数大于 数字值为 1的数据个数时, 效率比较低, 并且功耗比较大。 发明内容  The existing method of storing the data unit in the storage unit of the PCM memory is to pre-fill all the digits of the storage unit into data with a data value of 1, and when the data unit needs to be stored in the storage unit, the data unit is searched. The data in which the data value is 0 is at the target position in the data unit, and then the data having the digital value of 0 is written into the storage location corresponding to the target location in the storage unit, so that the data unit is stored in the storage unit. In this method, when the number of data having a digital value of 0 included in the data unit is less than the number of data having a digital value of 1, the power consumption and delay of the stored data are reduced, but when included in the data unit When the number of data with a digital value of 0 is greater than the number of data with a digital value of 1, the method needs to find the target position of the data with a digital value of 0 in the data unit, which will increase the power consumption of the stored data. Delay, so this method has a lower efficiency and a higher power consumption when the number of data with a digital value of 0 in the data unit is greater than the number of data with a digital value of 1. Summary of the invention
本发明实施例提供了一种数据处理方法、装置, 可以高效率地将目标数据 单元存储至目标存储单元中, 并且功耗较小。  Embodiments of the present invention provide a data processing method and apparatus, which can efficiently store a target data unit into a target storage unit, and consume less power.
本发明第一方面提供一种数据处理方法, 可包括:  A first aspect of the present invention provides a data processing method, which may include:
当需要对目标数据单元进行存储时,获取目标数据单元中第一数据的个数 与第二数据的个数, 所述第一数据的类型为第一类型, 所述第二数据的类型为 第二类型; 若所述第一数据的个数大于所述第二数据的个数,则获取所述第二数据在 所述目标数据单元中的第一目标位置,并将预填充为所述第二类型的数据的目 标存储单元中所述第一目标位置中写入所述第一类型的数据。 When the target data unit needs to be stored, the number of the first data in the target data unit and the number of the second data are obtained, the type of the first data is a first type, and the type of the second data is a Two types; If the number of the first data is greater than the number of the second data, acquiring a first target location of the second data in the target data unit, and pre-populating the second type The first type of data is written in the first target location in a target storage unit of data.
基于第一方面, 在第一种可行的实施方式中, 所述方法还包括: 若所述第一数据的个数小于或者等于所述第二数据的个数,则获取所述第 一数据在所述目标数据单元中的第二目标位置,并将预填充为所述第二类型的 数据的目标存储单元中所述第二目标位置中写入所述第一类型的数据。  Based on the first aspect, in a first possible implementation, the method further includes: if the number of the first data is less than or equal to the number of the second data, acquiring the first data a second target location in the target data unit, and writing the first type of data into the second target location in a target storage unit pre-filled with the second type of data.
基于第一方面第一种可行的实施方式, 在第二种可行的实施方式中, 所述 若所述第一数据的个数大于所述第二数据的个数,则获取所述第二数据在所述 目标数据单元中的第一目标位置,并将预填充为所述第二类型的数据的目标存 储单元中所述第一目标位置中写入所述第一类型的数据之后, 还包括:  According to the first possible implementation manner of the first aspect, in a second possible implementation, if the number of the first data is greater than the number of the second data, acquiring the second data After the first target location in the target data unit and the first target location in the target storage location pre-filled with the second type of data is written in the first type of data, :
将所述目标存储单元的标志位设置为第一标识,所述第一标识用于标识所 述目标存储单元中所存储的数据非所述目标数据单元中的原始数据。  Setting a flag bit of the target storage unit as a first identifier, the first identifier is used to identify that data stored in the target storage unit is not original data in the target data unit.
基于第一方面第二种可行的实施方式, 在第三种可行的实施方式中, 所述 若所述第一数据的个数小于或者等于所述第二数据的个数,则获取所述第一数 据在所述目标数据单元中的第二目标位置,并将预填充为所述第二类型的数据 的目标存储单元中所述第二目标位置中写入所述第一类型的数据之后, 还包 括:  Based on the second possible implementation manner of the first aspect, in a third possible implementation, if the number of the first data is less than or equal to the number of the second data, a data is in a second target location in the target data unit, and after the first type of data is written in the second target location in a target storage unit pre-filled with the second type of data, Also includes:
将所述目标存储单元的标志位设置为第二标识,所述第二标识用于标识所 述目标存储单元中所存储的数据为所述目标数据单元中的原始数据。  Setting a flag bit of the target storage unit as a second identifier, the second identifier is used to identify that the data stored in the target storage unit is original data in the target data unit.
基于第一方面第三种可行的实施方式, 在第四种可行的实施方式中, 所述 方法还包括:  Based on the third possible implementation manner of the first aspect, in a fourth possible implementation manner, the method further includes:
当需要获取所述目标存储单元中所存储的所述目标数据单元时,读取所述 目标存储单元的标志位;  When the target data unit stored in the target storage unit needs to be acquired, reading a flag bit of the target storage unit;
若所述标志位为所述第一标识,则将所述目标存储单元中所述第一类型的 数据转化为所述第二类型的数据,将所述目标存储单元中所述第二类型的数据 转化为所述第一类型的数据,并将转化处理后的所述数据确定为所述目标存储 单元中所存储的所述目标数据单元;  If the flag bit is the first identifier, converting the first type of data in the target storage unit into the second type of data, and the second type of the target storage unit Converting data into the first type of data, and determining the converted data as the target data unit stored in the target storage unit;
若所述标志位为所述第二标识, 则读取所述目标存储单元中所存储的数 元。 Reading the number stored in the target storage unit if the flag bit is the second identifier Yuan.
本发明第二方面提供一种数据处理装置, 可包括:  A second aspect of the present invention provides a data processing apparatus, which may include:
获取模块, 用于当需要对目标数据单元进行存储时, 获取目标数据单元中 第一数据的个数与第二数据的个数, 所述第一数据的类型为第一类型, 所述第 二数据的类型为第二类型;  An acquiring module, configured to acquire, when the target data unit needs to be stored, the number of the first data and the number of the second data in the target data unit, where the type of the first data is the first type, the second The type of data is the second type;
第一写入模块, 用于若所述第一数据的个数大于所述第二数据的个数, 则 获取所述第二数据在所述目标数据单元中的第一目标位置,并将预填充为所述 第二类型的数据的目标存储单元中所述第一目标位置中写入所述第一类型的 数据。  a first writing module, configured to acquire, when the number of the first data is greater than the number of the second data, a first target location of the second data in the target data unit, and Writing the first type of data into the first target location in a target storage unit populated with the second type of data.
基于第二方面, 在第一种可行的实施方式中, 所述装置还包括: 第二写入模块,用于若所述第一数据的个数小于或者等于所述第二数据的 个数, 则获取所述第一数据在所述目标数据单元中的第二目标位置, 并将预填 充为所述第二类型的数据的目标存储单元中所述第二目标位置中写入所述第 一类型的数据。  Based on the second aspect, in a first possible implementation, the device further includes: a second writing module, configured to: if the number of the first data is less than or equal to the number of the second data, And acquiring a second target location of the first data in the target data unit, and writing the first target location in the target storage unit pre-filled with the second type of data into the first target location Type of data.
基于第二方面第一种可行的实施方式, 在第二种可行的实施方式中, 所述 装置还包括:  Based on the first possible implementation manner of the second aspect, in a second possible implementation manner, the apparatus further includes:
第一设置模块, 用于将所述目标存储单元的标志位设置为第一标识, 所述 第一标识用于标识所述目标存储单元中所存储的数据非所述目标数据单元中 的原始数据。  a first setting module, configured to set a flag bit of the target storage unit as a first identifier, where the first identifier is used to identify that data stored in the target storage unit is not original data in the target data unit .
基于第二方面的第二种可行的实施方式,在第三种可行的实施方式中, 第 二设置模块, 用于将所述目标存储单元的标志位设置为第二标识, 所述第二标 识用于标识所述目标存储单元中所存储的数据为所述目标数据单元中的原始 数据。  Based on the second possible implementation of the second aspect, in a third possible implementation, the second setting module is configured to set a flag of the target storage unit to a second identifier, where the second identifier is The data used to identify the target storage unit is the original data in the target data unit.
基于第二方面的第三种可行的实施方式,在第四种可行的实施方式中, 所 述装置还包括:  Based on the third possible implementation manner of the second aspect, in a fourth possible implementation manner, the apparatus further includes:
读取模块,用于当需要获取所述目标存储单元中所存储的所述目标数据单 元时, 读取所述目标存储单元的标志位;  a reading module, configured to read a flag bit of the target storage unit when the target data unit stored in the target storage unit needs to be acquired;
转化确定模块, 用于若所述标志位为所述第一标识, 则将所述目标存储单 元中所述第一类型的数据转化为所述第二类型的数据,将所述目标存储单元中 所述第二类型的数据转化为所述第一类型的数据,并将转化处理后的所述数据 确定为所述目标存储单元中所存储的所述目标数据单元; a conversion determining module, configured to: if the flag bit is the first identifier, the target storage list Transforming the first type of data into the second type of data, converting the second type of data in the target storage unit into the first type of data, and converting the processed Determining data as the target data unit stored in the target storage unit;
读取确定模块, 用于若所述标志位为所述第二标识, 则读取所述目标存储 所述目标数据单元。  And a read determining module, configured to: if the flag bit is the second identifier, read the target to store the target data unit.
本发明第三方面提供一种数据处理装置, 可包括处理器, 其中: 所述处理器, 用于当需要对目标数据单元进行存储时, 获取目标数据单元 中第一数据的个数与第二数据的个数, 所述第一数据的类型为第一类型, 所述 第二数据的类型为第二类型;  A third aspect of the present invention provides a data processing apparatus, which may include a processor, where: the processor is configured to acquire, when the target data unit needs to be stored, the number of the first data in the target data unit and the second The number of the data, the type of the first data is a first type, and the type of the second data is a second type;
所述处理器还用于若所述第一数据的个数大于所述第二数据的个数,则获 取所述第二数据在所述目标数据单元中的第一目标位置,并将预填充为所述第 二类型的数据的目标存储单元中所述第一目标位置中写入所述第一类型的数 据。  The processor is further configured to: if the number of the first data is greater than the number of the second data, acquire a first target location of the second data in the target data unit, and pre-populate Writing the first type of data into the first target location in a target storage unit of the second type of data.
基于第三方面,在第一种可行的实施方式中, 所述处理器还用于若所述第 一数据的个数小于或者等于所述第二数据的个数,则获取所述第一数据在所述 目标数据单元中的第二目标位置,并将预填充为所述第二类型的数据的目标存 储单元中所述第二目标位置中写入所述第一类型的数据。  According to the third aspect, in a first possible implementation, the processor is further configured to acquire the first data if the number of the first data is less than or equal to the number of the second data. And writing, in the second target location in the target data unit, the first type of data in the second target location in a target storage unit pre-filled with the second type of data.
基于第三方面第一种可行的实施方式, 在第二种可行的实施方式中, 所述 处理器还用于将所述目标存储单元的标志位设置为第一标识,所述第一标识用 于标识所述目标存储单元中所存储的数据非所述目标数据单元中的原始数据。  Based on the first possible implementation manner of the third aspect, in a second possible implementation, the processor is further configured to set a flag of the target storage unit as a first identifier, where the first identifier is used The data stored in the target storage unit is not the original data in the target data unit.
基于第三方面的第二种可行的实施方式,在第三种可行的实施方式中, 所 述处理器还用于将所述目标存储单元的标志位设置为第二标识,所述第二标识 用于标识所述目标存储单元中所存储的数据为所述目标数据单元中的原始数 据。  According to a second possible implementation manner of the third aspect, in a third possible implementation, the processor is further configured to set a flag of the target storage unit to a second identifier, where the second identifier is The data used to identify the target storage unit is the original data in the target data unit.
基于第三方面的第三种可行的实施方式,在第四种可行的实施方式中, 所 述处理器还用于当需要获取所述目标存储单元中所存储的所述目标数据单元 时, 读取所述目标存储单元的标志位;  According to a third possible implementation manner of the third aspect, in a fourth possible implementation, the processor is further configured to: when the target data unit stored in the target storage unit needs to be acquired, read Taking the flag of the target storage unit;
所述处理器还用于若所述标志位为所述第一标识,则将所述目标存储单元 中所述第一类型的数据转化为所述第二类型的数据,将所述目标存储单元中所 述第二类型的数据转化为所述第一类型的数据,并将转化处理后的所述数据确 定为所述目标存储单元中所存储的所述目标数据单元; The processor is further configured to: if the flag bit is the first identifier, then the target storage unit Converting the first type of data into the second type of data, converting the second type of data in the target storage unit into the first type of data, and converting the processed Data is determined to be the target data unit stored in the target storage unit;
所述处理器还用于若所述标志位为所述第二标识,则读取所述目标存储单 述目标数据单元。  The processor is further configured to read the target storage target data unit if the flag bit is the second identifier.
本发明实施例中, 当需要对目标数据单元进行存储时, 获取目标数据单元 中类型为第一类型的第一数据的个数与类型为第二类型的第二数据的个数,当 第一数据的个数大于第二数据的个数时,则获取个数相对较少的第二数据在目 标数据单元中的目标位置,并将预先填充了第二类型的数据的目标存储单元中 的目标位置写入第一类型的数据, 用于代替目标数据单元中第二数据, 本发明 实施例中,用目标存储单元中第一类型的数据代替目标数据单元中第二类型的 数据, 在目标数据单元中第一类型数据较多, 第二类型数据较少时, 也只需要 写入较少的第一类型的数据用于代替目标数据单元中相对较少的第二类型数 据, 所以效率比较高, 并且由于写入数据较少, 所以功耗也比较低。 附图说明  In the embodiment of the present invention, when the target data unit needs to be stored, the number of the first data of the first type and the second type of the second type of the type in the target data unit are obtained, when the first When the number of data is greater than the number of second data, a target position of the second data in the target data unit is obtained, and a target in the target storage unit of the second type of data is pre-filled The location is written to the first type of data, in place of the second data in the target data unit. In the embodiment of the present invention, the first type of data in the target storage unit is used to replace the second type of data in the target data unit, in the target data. When there is more data of the first type in the unit, and less data of the second type, only less data of the first type needs to be written to replace the second type of data in the target data unit, so the efficiency is relatively high. And because the write data is less, the power consumption is also lower. DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施 例中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是 本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的 前提下, 还可以根据这些附图获得其他的附图。  In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings to be used in the embodiments will be briefly described below. Obviously, the drawings in the following description are only some of the present invention. For the embodiments, those skilled in the art can obtain other drawings according to the drawings without any creative work.
图 1 为本发明提供的一种数据处理方法的流程示意图;  1 is a schematic flow chart of a data processing method provided by the present invention;
图 2 为本发明提供的另一种数据处理方法的流程示意图;  2 is a schematic flow chart of another data processing method provided by the present invention;
图 3 为本发明提供的一种存储结构图;  3 is a storage structure diagram provided by the present invention;
图 4 为本发明提供的一种数据处理装置的结构示意图;  4 is a schematic structural diagram of a data processing apparatus according to the present invention;
图 5 为本发明提供的另一种数据处理装置的结构示意图;  FIG. 5 is a schematic structural diagram of another data processing apparatus according to the present invention; FIG.
图 6 为本发明提供的又一种数据处理装置的结构示意图; 具体实施方式 下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清 楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是 全部的实施例。基于本发明中的实施例, 本领域普通技术人员在没有作出创造 性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。 FIG. 6 is a schematic structural diagram of still another data processing apparatus according to the present invention; The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
本发明实施例中, 第一类型的数据可以是数据值为 0的数据, 则第二类型 的数据可以是数据值为 1的数据; 第一类型的数据可以是数据值为 1的数据, 则第二类型的数据可以是数据值为 0的数据。本发明实施例的数据处理方法可 以应用于向计算机内存中存储数据的应用场景中, 随着各种应用的发展, 计算 机内存一般用非易失性存储器 NVM进行存储, 例如 PCM存储器, 它的扩展 性能更好, 密度更大, 可以做到更大的容量, 并且能耗更低。 向内存中所存储 的数据可以是二进制数据, 当向 PCM中写 '0, 时, 加一个较高的电压, 持续 时间较短, 当向 PCM中写 T 时, 加一个较低的电压, 持续时间较长。 下面将结合附图 1-附图 3,对本发明实施例提供的数据处理方法进行详细 介绍。  In the embodiment of the present invention, the first type of data may be data with a data value of 0, and the second type of data may be data with a data value of 1. The first type of data may be data with a data value of 1. The second type of data may be data having a data value of zero. The data processing method of the embodiment of the present invention can be applied to an application scenario for storing data in a computer memory. With the development of various applications, computer memory is generally stored by a non-volatile memory NVM, such as PCM memory, and its expansion. Better performance, greater density, greater capacity, and lower energy consumption. The data stored in the memory can be binary data. When writing '0' to the PCM, add a higher voltage for a shorter duration. When writing T to the PCM, add a lower voltage for the duration. Longer time. The data processing method provided by the embodiment of the present invention will be described in detail below with reference to the accompanying drawings.
请参见图 1, 为本发明实施例提供的一种数据处理方法的流程示意图; 该 方法可包括以下步骤 S 100-步骤 S 101。  FIG. 1 is a schematic flowchart diagram of a data processing method according to an embodiment of the present invention; the method may include the following steps S100-S101.
S100, 当需要对目标数据单元进行存储时,获取目标数据单元中第一数据 的个数与第二数据的个数, 所述第一数据的类型为第一类型, 所述第二数据的 类型为第二类型;  S100, when the target data unit needs to be stored, acquiring the number of the first data and the number of the second data in the target data unit, the type of the first data is a first type, and the type of the second data For the second type;
在一个实施例中, 当需要将目标数据单元存储至目标存储单元中时, 首先 需要获取目标数据单元中第一数据的个数与第二数据的个数,在计算机系统中 对数据进行存储时, 一般是以数据单元的形式进行存储, 一个数据单元可以包 括 8bit数据。 因此目标数据单元中有多个数据, 并且目标数据单元中所包括的 数据的类型也可以有多种, 例如, 当数据是以二进制的形式进行存储时, 则目 标数据单元中所包括的类型有两种, 第一类型和第二类型, 第一类型的数据可 以是数据值为 0的数据, 第二类型的数据可以是数据值为 1的数据, 则目标数 据单元中的第一数据即是全部数据值为 0的数据,第二数据即是全部数据值为 1的数据。 需要说明的是, 第一类型的数据也可以是数据值为 1的数据, 第二 类型的数据可以是数据值为 0的数据,则目标数据单元中的第一数据即是全部 数据值为 1的数据, 第二数据即是全部数据值为 0的数据。 In an embodiment, when the target data unit needs to be stored in the target storage unit, firstly, the number of the first data and the second data in the target data unit needs to be acquired, and the data is stored in the computer system. Generally, it is stored in the form of data units, and one data unit can include 8 bits of data. Therefore, there are multiple data in the target data unit, and the types of data included in the target data unit may also be various. For example, when the data is stored in binary form, the types included in the target data unit are Two types, the first type and the second type, the first type of data may be data having a data value of 0, and the second type of data may be data having a data value of 1, then the first data in the target data unit is All data with a data value of 0, the second data is data with a total data value of 1. It should be noted that the first type of data may also be data with a data value of 1, second. The type of data may be data with a data value of 0, and the first data in the target data unit is data with all data values of 1, and the second data is data with all data values of 0.
S101 ,若所述第一数据的个数大于所述第二数据的个数,则获取所述第二 数据在所述目标数据单元中的第一目标位置,并将预填充为所述第二类型的数 据的目标存储单元中所述第一目标位置中写入所述第一类型的数据。  S101. If the number of the first data is greater than the number of the second data, obtain a first target location of the second data in the target data unit, and pre-populate the second data. The first type of data is written in the first target location in the target storage unit of the type of data.
在一个实施例中, 在对数据存储至计算机内存中时, 为了减少写入数据的 数据量, 同时减少延时, 一般都会将计算机内存进行预填充, 即是预先在每一 个存储单元填充一种类型的数据, 当存储数据至存储单元时, 则直接在存储单 元中修改数据值不同的位数。 由于有时需要修改的位数过多, 需要写入大量的 数据, 会造成功耗较大延时较长, 因此, 在本发明实施例中, 预填充的数据类 型为第二类型的数据,当目标数据单元中类型为第一类型的第一数据的个数大 于类型为第二类型的第二数据的个数时,则直接获取目标数据单元中第二类型 的数据的第一目标位置,并将目标存储单元中第一目标位置中写入第一类型的 数据, 用第一类型的数据代替目标数据单元中第二类型的数据, 用第二类型的 数据代替目标数据单元中第一类型的数据,相当于对目标数据单元中的各个数 据进行翻转存储。  In one embodiment, when the data is stored in the computer memory, in order to reduce the amount of data written to the data, and reduce the delay, the computer memory is generally pre-filled, that is, each storage unit is pre-filled with one type. Type data, when storing data to a storage unit, directly modify the number of bits of the data value directly in the storage unit. Because the number of bits that need to be modified is too large, and a large amount of data needs to be written, the power consumption is long and the delay is long. Therefore, in the embodiment of the present invention, the pre-filled data type is the second type of data. When the number of the first data of the first type in the target data unit is greater than the number of the second data of the second type, the first target position of the second type of data in the target data unit is directly obtained, and Writing the first type of data into the first target location in the target storage unit, replacing the second type of data in the target data unit with the first type of data, and replacing the first type of the target data unit with the second type of data Data is equivalent to flipping the data in the target data unit.
这里以在目标存储单元中存储二进制数据为例来进行说明,由于综合考虑 功耗和延时, 一般在目标存储单元中预先填充数据值为 1的数据, 即是第二类 型的数据为数据值为 1的数据, 第一类型的数据为数据值为 0的数据。 当目标 数据单元中数据值为 0的数据个数大于数据值为 1的数据的个数,例如目标数 据单元为 10000100,数据值为 0的数据个数为 6,数据值为 1的数据的个数为 2, 数据值为 0的数据个数大于数据值为 1的数据的个数, 则获取目标数据单 元中数据值为 1的数据的第一目标位置,在本实施例中, 第一目标位置为第一 位和第六位, 则在目标存储单元的第一位和第六位写入数据值为 0的数据, 以 来代替目标数据单元中数据值为 1的数据,则目标存储单元中所存储的数据为 01111011 , 所存储的数据并非目标数据单元的原始数据, 而是原始数据的取反 运算后的数据。  Here, the binary data is stored in the target storage unit as an example. Since power consumption and delay are comprehensively considered, data of a data value of 1 is generally pre-filled in the target storage unit, that is, the second type of data is a data value. For data of 1, the first type of data is data with a data value of zero. When the number of data whose data value is 0 in the target data unit is larger than the number of data whose data value is 1, for example, the target data unit is 10000100, the data value is 0, the data number is 6, and the data value is 1. If the number of data with the data value of 0 is greater than the number of data with the data value of 1, the first target position of the data with the data value of 1 in the target data unit is obtained. In this embodiment, the first target When the position is the first bit and the sixth bit, the data having the data value of 0 is written in the first bit and the sixth bit of the target memory unit, and the data having the data value of 1 in the target data unit is replaced in the target storage unit. The stored data is 01111011, and the stored data is not the original data of the target data unit, but the inversed data of the original data.
本发明实施例中, 当需要对目标数据单元进行存储时, 获取目标数据单元 中类型为第一类型的第一数据的个数与类型为第二类型的第二数据的个数,当 第一数据的个数大于第二数据的个数时,则获取个数相对较少的第二数据在目 标数据单元中的目标位置,并将预先填充了第二类型的数据的目标存储单元中 的目标位置写入第一类型的数据, 用于代替目标数据单元中第二数据, 本发明 实施例中,用目标存储单元中第一类型的数据代替目标数据单元中第二类型的 数据, 在目标数据单元中第一类型数据较多, 第二类型数据较少时, 也只需要 写入较少的第一类型的数据用于代替目标数据单元中相对较少的第二类型数 据, 所以效率比较高, 并且由于写入数据较少, 所以功耗也比较低。 请参见图 2, 为本发明实施例提供的另一种数据处理方法的流程示意图; 该方法可包括以下步骤 S200-步骤 S207。 In the embodiment of the present invention, when the target data unit needs to be stored, the number of the first data of the first type and the second type of the second type of the type in the target data unit are obtained. When the number of the first data is greater than the number of the second data, the target position of the second data in the target data unit is obtained in a relatively small number, and the target storage unit of the second type of data is pre-filled In the embodiment of the present invention, the first type of data is used to replace the second type of data in the target data unit. In the embodiment of the present invention, the second type of data in the target data unit is replaced by the first type of data in the target storage unit. There is more data of the first type in the target data unit. When the data of the second type is less, only less first type of data needs to be written to replace the second type of data in the target data unit, so the efficiency is It is relatively high, and since the write data is small, the power consumption is also low. FIG. 2 is a schematic flowchart diagram of another data processing method according to an embodiment of the present invention; the method may include the following steps S200-S207.
5200, 当需要对目标数据单元进行存储时,获取目标数据单元中第一数据 的个数与第二数据的个数, 所述第一数据的类型为第一类型, 所述第二数据的 类型为第二类型;  5200, when the target data unit needs to be stored, acquiring the number of the first data and the number of the second data in the target data unit, the type of the first data is a first type, and the type of the second data For the second type;
本发明实施例步骤 S200可以参见图 1所示的步骤 S100,在此不再进行赞 述。  Step S200 of the embodiment of the present invention can refer to step S100 shown in FIG. 1 , and no further description is provided herein.
5201 ,若所述第一数据的个数大于所述第二数据的个数,则获取所述第二 数据在所述目标数据单元中的第一目标位置,并将预填充为所述第二类型的数 据的目标存储单元中所述第一目标位置中写入所述第一类型的数据。  5201, if the number of the first data is greater than the number of the second data, acquiring a first target location of the second data in the target data unit, and pre-populating the second data The first type of data is written in the first target location in the target storage unit of the type of data.
本发明实施例步骤 S201可以参见图 1所示的步骤 S101,在此不再进行赞 述。  Step S201 of the embodiment of the present invention can refer to step S101 shown in FIG. 1 , and no further description is provided herein.
5202,将所述目标存储单元的标志位设置为第一标识, 所述第一标识用于 标识所述目标存储单元中所存储的数据非所述目标数据单元中的原始数据。  5202. Set a flag of the target storage unit to a first identifier, where the first identifier is used to identify that data stored in the target storage unit is not original data in the target data unit.
作为一种可选的实施方式,在存储完目标数据单元之后, 为了方便读取数 据, 需要在目标存储单元的标志位进行设置, 当在目标存储单元中所存储的数 据非目标数据单元的原始数据, 即是在存储时, 是按照步骤 S201的方法进行 存储的, 则将目标存储单元的标志位设置为第一标识, 第一标识即是标识目标 存储单元中所存储的数据非目标数据单元中的原始数据,如图 3所述,为 PCM 存储器中存储二进制数据的场景图,在第一个目标存储单元中, 标志位设置了 第一标识, 第一标识用数据值为 0的数据代替。 则目标存储单元中所存储的数 据 01111011 不是目标数据单元的原始数据, 当需要读取该目标存储单元中所 存储的目标数据单元时, 需要将目标存储单元中的数据进行按位取反。 As an optional implementation manner, after the target data unit is stored, in order to facilitate the reading of the data, the flag of the target storage unit needs to be set, when the data stored in the target storage unit is not the original of the target data unit. The data, that is, when stored, is stored according to the method of step S201, and the flag bit of the target storage unit is set as the first identifier, and the first identifier is the data non-target data unit stored in the identifier target storage unit. The original data in FIG. 3 is a scene graph for storing binary data in the PCM memory. In the first target storage unit, the flag bit is set with the first identifier, and the first identifier is replaced by the data with the data value of 0. . Then the number stored in the target storage unit According to 01111011, it is not the original data of the target data unit. When it is necessary to read the target data unit stored in the target storage unit, the data in the target storage unit needs to be bit-inverted.
5203 ,若所述第一数据的个数小于或者等于所述第二数据的个数,则获取 所述第一数据在所述目标数据单元中的第二目标位置,并将预填充为所述第二 类型的数据的目标存储单元中所述第二目标位置中写入所述第一类型的数据。  5203. If the number of the first data is less than or equal to the number of the second data, acquire a second target location of the first data in the target data unit, and pre-populate the The first type of data is written in the second target location in a target storage unit of the second type of data.
作为一种可选的实施方式, 第一数据的类型为第一类型, 第二数据的类型 为第二类型。 目标存储单元中预填充的数据的类型为第二类型, 由于目标数据 单元中第一数据的个数小于或者等于第二数据的个数,为了在目标存储单元中 写入较少的数据量,则可以直接在目标存储单元中相应的位置写入第一类型的 数据, 即是目标存储单元中所存储的数据是目标数据单元中的原始数据。  As an optional implementation manner, the type of the first data is a first type, and the type of the second data is a second type. The type of the data pre-filled in the target storage unit is the second type. Since the number of the first data in the target data unit is less than or equal to the number of the second data, in order to write a smaller amount of data in the target storage unit, Then, the first type of data can be directly written in the corresponding position in the target storage unit, that is, the data stored in the target storage unit is the original data in the target data unit.
这里以在目标存储单元中存储二进制数据为例来进行说明,由于综合考虑 功耗和延时, 一般在目标存储单元中预先填充数据值为 1的数据, 即是第二类 型的数据为数据值为 1的数据, 第一类型的数据为数据值为 0的数据。 当目标 数据单元中数据值为 0的数据个数小于或者等于数据值为 1的数据的个数,例 如目标数据单元为 11111010, 数据值为 0的数据个数为 2, 数据值为 1的数据 的个数为 6, 数据值为 0的数据个数小于数据值为 1的数据的个数, 则获取目 标数据单元中数据值为 0的数据的第一目标位置, 在本实施例中, 第一目标位 置为第六位和第八位, 则在目标存储单元的第六位和第八位写入数据值为 0 的数据, 以来代替目标数据单元中数据值为 0的数据, 则目标存储单元中所存 储的数据为 11111010, 所存储的数据是目标数据单元的原始数据, 具体的, 如 图 3所述的 PCM存储器中的第二个存储单元。  Here, the binary data is stored in the target storage unit as an example. Since power consumption and delay are comprehensively considered, data of a data value of 1 is generally pre-filled in the target storage unit, that is, the second type of data is a data value. For data of 1, the first type of data is data with a data value of zero. When the number of data whose data value is 0 in the target data unit is less than or equal to the number of data whose data value is 1, for example, the target data unit is 11111010, the data value is 0, the data number is 2, and the data value is 1. The number of data is 6, the number of data whose data value is 0 is smaller than the number of data whose data value is 1, and the first target position of the data whose data value is 0 in the target data unit is obtained. In this embodiment, When the target position is the sixth bit and the eighth bit, the data with the data value of 0 is written in the sixth and eighth bits of the target storage unit, and the data of the data value of 0 in the target data unit is replaced, and the target storage is performed. The data stored in the unit is 11111010, and the stored data is the original data of the target data unit, specifically, the second storage unit in the PCM memory as described in FIG.
5204,将所述目标存储单元的标志位设置为第二标识, 所述第二标识用于 标识所述目标存储单元中所存储的数据为所述目标数据单元中的原始数据。  S204: Set a flag of the target storage unit to a second identifier, where the second identifier is used to identify that the data stored in the target storage unit is original data in the target data unit.
作为一种可选的实施方式,在存储完目标数据单元之后, 为了方便读取数 据, 需要在目标存储单元的标志位进行设置, 当在目标存储单元中所存储的数 据是目标数据单元的原始数据, 即是在存储时, 是按照步骤 S203的方法进行 存储的, 则将目标存储单元的标志位设置为第二标识, 第二标识即是标识目标 存储器中存储二进制数据的场景图,在第二个目标存储单元中, 标志位设置了 第二标识, 第二标识用数据值为 1的数据代替。 则目标存储单元中所存储的数 据 11111010是目标数据单元的原始数据, 当需要读取该目标存储单元中所存 储的目标数据单元时, 直接读取目标存储单元中的数据。 As an optional implementation manner, after the target data unit is stored, in order to facilitate the reading of the data, the flag of the target storage unit needs to be set, when the data stored in the target storage unit is the original of the target data unit. The data, that is, stored, according to the method of step S203, sets the flag of the target storage unit to the second identifier, and the second identifier is the scene graph for storing the binary data in the target memory. In the two target storage units, the flag is set. The second identifier, the second identifier is replaced by data having a data value of 1. Then, the data 11111010 stored in the target storage unit is the original data of the target data unit, and when the target data unit stored in the target storage unit needs to be read, the data in the target storage unit is directly read.
5205, 当需要获取所述目标存储单元中所存储的所述目标数据单元时,读 取所述目标存储单元的标志位;  S205, when the target data unit stored in the target storage unit needs to be acquired, reading a flag bit of the target storage unit;
作为一种可选的实施方式,将目标数据单元存储至目标数据单元后, 当要 调用目标数据单元时, 则需要从目标存储单元中去获取目标数据单元。在本发 明实施例中,获取目标数据单元的方法基于向目标存储单元中存储目标数据单 元的规则, 所以, 当需要获取目标存储单元中所存储的目标数据单元时, 首先 读取目标存储单元的标志位,标志位的作用是为了标识目标存储单元中所存储 的数据是否为目标数据单元中的原始数据。  As an optional implementation manner, after the target data unit is stored to the target data unit, when the target data unit is to be called, the target data unit needs to be acquired from the target storage unit. In the embodiment of the present invention, the method for acquiring the target data unit is based on the rule of storing the target data unit in the target storage unit, so when the target data unit stored in the target storage unit needs to be acquired, the target storage unit is first read. The flag bit is used to identify whether the data stored in the target storage unit is the original data in the target data unit.
5206,若所述标志位为所述第一标识, 则将所述目标存储单元中所述第一 类型的数据转化为所述第二类型的数据,将所述目标存储单元中所述第二类型 的数据转化为所述第一类型的数据,并将转化处理后的所述数据确定为所述目 标存储单元中所存储的所述目标数据单元;  S206, if the flag bit is the first identifier, converting the first type of data in the target storage unit into the second type of data, and the second in the target storage unit Converting data of the type into the data of the first type, and determining the data after the conversion processing as the target data unit stored in the target storage unit;
作为一种可选的实施方式,如果目标存储单元的标志位为第一标识, 则表 明目标存储单元中所存储的数据非目标数据单元的原始数据,当需要获取目标 存储单元中所存储的目标数据单元时,需要将目标存储单元中所存储的数据进 行一系列的转化处理。若目标存储单元中的数据为第一类型的数据, 则将第一 类型的数据转化为第二类型的数据,若目标存储单元中的数据为第二类型的数 据, 则将第二类型的数据转化为第一类型的数据。依次对目标存储单元中所存 的目标数据单元。  As an optional implementation manner, if the flag of the target storage unit is the first identifier, indicating that the data stored in the target storage unit is the original data of the non-target data unit, when it is required to acquire the target stored in the target storage unit. In the case of a data unit, it is necessary to perform a series of conversion processing on the data stored in the target storage unit. If the data in the target storage unit is the first type of data, the first type of data is converted into the second type of data, and if the data in the target storage unit is the second type of data, the second type of data is Convert to the first type of data. The target data units stored in the target storage unit are sequentially.
这里继续以目标存储单元中存储二进制数据为例来进行说明, 如图 3 所 述, 在第一个目标存储单元的标志位为第一标识, 即是标志位为数据值为 0 的数据, 则表明需要对目标存储单元中所存储的数据需要进行转化, 第一类型 数据, 即是数据值为 0的数据需要转化为第二类型数据, 即是数据值为 1的数 据; 第二类型数据, 即是数据值为 1的数据需要转化为第一类型数据, 即是数 据值为 0的数据, 因此,依次对目标存储单元中所存储的各个数据进行转化后 得到的二进制数据为: 10000100, 将数据 10000100确定为该目标存储单元所 存储的目标数据单元。 Here, the description is continued by taking the binary data stored in the target storage unit as an example. As shown in FIG. 3, when the flag of the first target storage unit is the first identifier, that is, the data with the data bit value of 0 is It indicates that the data stored in the target storage unit needs to be converted. The first type of data, that is, the data with the data value of 0 needs to be converted into the second type of data, that is, the data with the data value of 1; the second type of data, That is, the data with a data value of 1 needs to be converted into the first type of data, that is, the data with the data value of 0. Therefore, the data stored in the target storage unit is sequentially converted. The obtained binary data is: 10000100, and the data 10000100 is determined as the target data unit stored in the target storage unit.
S207,若所述标志位为所述第二标识, 则读取所述目标存储单元中所存储 单元。  S207. If the flag bit is the second identifier, read the unit stored in the target storage unit.
作为一种可选的实施方式,如果目标存储单元的标志位为第二标识, 则表 取目标存储单元中所存储的目标数据单元时,则直接读取目标存储单元中所存 这里继续以目标存储单元中存储二进制数据为例来进行说明, 如图 3 所 述, 在第二个目标存储单元中, 目标存储单元的标志位为第二标识, 即是数据 值为 1的数据, 则目标存储单元中所存储的数据 11111010是目标数据单元中 的原始数据, 因此需要获取目标存储单元中所存储的目标数据单元时,仅仅需 要从目标存储单元中读取所存储的数据 11111010, 并将数据 11111010确定为 该目标存储单元所存储的目标数据单元。  As an optional implementation manner, if the flag bit of the target storage unit is the second identifier, when the target data unit stored in the target storage unit is taken, the target storage unit stored in the target storage unit is directly read to continue to store the target. The binary data is stored in the unit as an example. As shown in FIG. 3, in the second target storage unit, the flag of the target storage unit is the second identifier, that is, the data with the data value of 1, the target storage unit. The data 11111010 stored in the target data unit is the original data in the target data unit, so when it is necessary to acquire the target data unit stored in the target storage unit, only the stored data 11111010 needs to be read from the target storage unit, and the data 11111010 is determined. The target data unit stored for the target storage unit.
本发明实施例中, 当需要对目标数据单元进行存储时, 获取目标数据单元 中类型为第一类型的第一数据的个数与类型为第二类型的第二数据的个数,当 第一数据的个数大于第二数据的个数时,则获取个数相对较少的第二数据在目 标数据单元中的目标位置,并将预先填充了第二类型的数据的目标存储单元中 的目标位置写入第一类型的数据, 用于代替目标数据单元中第二数据, 本发明 实施例中,用目标存储单元中第一类型的数据代替目标数据单元中第二类型的 数据, 在目标数据单元中第一类型数据较多, 第二类型数据较少时, 也只需要 写入较少的第一类型的数据用于代替目标数据单元中相对较少的第二类型数 据, 所以效率比较高, 并且由于写入数据较少, 所以功耗也比较低。 下面将结合附图 4-附图 6,对本发明实施例提供的数据处理装置的结构进 行详细介绍。 需要说明的是, 下述的数据处理装置可以应用于上述方法中。  In the embodiment of the present invention, when the target data unit needs to be stored, the number of the first data of the first type and the second type of the second type of the type in the target data unit are obtained, when the first When the number of data is greater than the number of second data, a target position of the second data in the target data unit is obtained, and a target in the target storage unit of the second type of data is pre-filled The location is written to the first type of data, in place of the second data in the target data unit. In the embodiment of the present invention, the first type of data in the target storage unit is used to replace the second type of data in the target data unit, in the target data. When there is more data of the first type in the unit, and less data of the second type, only less data of the first type needs to be written to replace the second type of data in the target data unit, so the efficiency is relatively high. And because the write data is less, the power consumption is also lower. The structure of the data processing apparatus according to the embodiment of the present invention will be described in detail below with reference to Figs. It should be noted that the data processing device described below can be applied to the above method.
请参见图 4, 为本发明实施例提供的一种数据处理装置的结构示意图; 该 数据处理装置可包括: 获取模块 100和第一写入模块 101。 获取模块 100, 用于当需要对目标数据单元进行存储时, 获取目标数据单 元中第一数据的个数与第二数据的个数, 所述第一数据的类型为第一类型, 所 述第二数据的类型为第二类型; FIG. 4 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention; the data processing apparatus may include: an obtaining module 100 and a first writing module 101. The obtaining module 100 is configured to acquire, when the target data unit needs to be stored, the number of the first data and the second data in the target data unit, where the type of the first data is a first type, The type of the second data is the second type;
在一个实施例中, 当需要将目标数据单元存储至目标存储单元中时, 首先 获取模块 100需要获取目标数据单元中第一数据的个数与第二数据的个数,在 计算机系统中对数据进行存储时,一般是以数据单元的形式进行存储, 一个数 据单元可以包括 8bit数据。 因此目标数据单元中有多个数据, 并且目标数据单 元中所包括的数据的类型也可以有多种, 例如, 当数据是以二进制的形式进行 存储时, 则目标数据单元中所包括的类型有两种, 第一类型和第二类型, 第一 类型的数据可以是数据值为 0的数据,第二类型的数据可以是数据值为 1的数 据, 则目标数据单元中的第一数据即是全部数据值为 0的数据, 第二数据即是 全部数据值为 1的数据。 需要说明的是, 第一类型的数据也可以是数据值为 1 的数据, 第二类型的数据可以是数据值为 0的数据, 则目标数据单元中的第一 数据即是全部数据值为 1的数据, 第二数据即是全部数据值为 0的数据  In an embodiment, when the target data unit needs to be stored in the target storage unit, the first acquiring module 100 needs to acquire the number of the first data and the second data in the target data unit, and compare the data in the computer system. When storing, it is generally stored in the form of data units, and one data unit can include 8 bits of data. Therefore, there are multiple data in the target data unit, and the types of data included in the target data unit may also be various. For example, when the data is stored in binary form, the types included in the target data unit are Two types, the first type and the second type, the first type of data may be data having a data value of 0, and the second type of data may be data having a data value of 1, then the first data in the target data unit is All data with a data value of 0, the second data is data with a total data value of 1. It should be noted that the first type of data may also be data with a data value of 1, and the second type of data may be data with a data value of 0, and the first data in the target data unit is all data values of 1. Data, the second data is all data with a data value of 0
第一写入模块 101, 用于若所述第一数据的个数大于所述第二数据的个 数, 则获取所述第二数据在所述目标数据单元中的第一目标位置, 并将预填充 为所述第二类型的数据的目标存储单元中所述第一目标位置中写入所述第一 类型的数据。  The first writing module 101 is configured to: if the number of the first data is greater than the number of the second data, acquire a first target location of the second data in the target data unit, and The first type of data is written in the first target location in a target storage unit pre-filled with the second type of data.
在一个实施例中, 在对数据存储至计算机内存中时, 为了减少写入数据的 数据量, 同时减少延时, 一般都会将计算机内存进行预填充, 即是预先在每一 个存储单元填充一种类型的数据, 当存储数据至存储单元时, 则直接在存储单 元中修改数据值不同的位数。 由于有时需要修改的位数过多, 需要写入大量的 数据, 会造成功耗较大延时较长, 因此, 在本发明实施例中, 预填充的数据类 型为第二类型的数据,当目标数据单元中类型为第一类型的第一数据的个数大 于类型为第二类型的第二数据的个数时,则第一写入模块 101直接获取目标数 据单元中第二类型的数据的第一目标位置,并将目标存储单元中第一目标位置 中写入第一类型的数据,用第一类型的数据代替目标数据单元中第二类型的数 据, 用第二类型的数据代替目标数据单元中第一类型的数据,相当于对目标数 据单元中的各个数据进行翻转存储。 这里以在目标存储单元中存储二进制数据为例来进行说明,由于综合考虑 功耗和延时, 一般在目标存储单元中预先填充数据值为 1的数据, 即是第二类 型的数据为数据值为 1的数据, 第一类型的数据为数据值为 0的数据。 当目标 数据单元中数据值为 0的数据个数大于数据值为 1的数据的个数,例如目标数 据单元为 10000100,数据值为 0的数据个数为 6,数据值为 1的数据的个数为 2, 数据值为 0的数据个数大于数据值为 1的数据的个数, 则获取目标数据单 元中数据值为 1的数据的第一目标位置,在本实施例中, 第一目标位置为第一 位和第六位, 则在目标存储单元的第一位和第六位写入数据值为 0的数据, 以 来代替目标数据单元中数据值为 1的数据,则目标存储单元中所存储的数据为 01111011 , 所存储的数据并非目标数据单元的原始数据, 而是原始数据的取反 运算后的数据。 In one embodiment, when the data is stored in the computer memory, in order to reduce the amount of data written to the data, and reduce the delay, the computer memory is generally pre-filled, that is, each storage unit is pre-filled with one type. Type data, when storing data to a storage unit, directly modify the number of bits of the data value directly in the storage unit. Because the number of bits that need to be modified is too large, and a large amount of data needs to be written, the power consumption is long and the delay is long. Therefore, in the embodiment of the present invention, the pre-filled data type is the second type of data. When the number of the first data of the first type in the target data unit is greater than the number of the second data of the second type, the first writing module 101 directly acquires the second type of data in the target data unit. a first target location, and writing the first type of data in the first target location in the target storage unit, replacing the second type of data in the target data unit with the first type of data, and replacing the target data with the second type of data The first type of data in the unit is equivalent to flipping the data in the target data unit. Here, the binary data is stored in the target storage unit as an example. Since power consumption and delay are comprehensively considered, data of a data value of 1 is generally pre-filled in the target storage unit, that is, the second type of data is a data value. For data of 1, the first type of data is data with a data value of zero. When the number of data whose data value is 0 in the target data unit is larger than the number of data whose data value is 1, for example, the target data unit is 10000100, the data value is 0, the data number is 6, and the data value is 1. If the number of data with the data value of 0 is greater than the number of data with the data value of 1, the first target position of the data with the data value of 1 in the target data unit is obtained. In this embodiment, the first target When the position is the first bit and the sixth bit, the data having the data value of 0 is written in the first bit and the sixth bit of the target memory unit, and the data having the data value of 1 in the target data unit is replaced in the target storage unit. The stored data is 01111011, and the stored data is not the original data of the target data unit, but the inversed data of the original data.
本发明实施例中, 当需要对目标数据单元进行存储时, 获取目标数据单元 中类型为第一类型的第一数据的个数与类型为第二类型的第二数据的个数,当 第一数据的个数大于第二数据的个数时,则获取个数相对较少的第二数据在目 标数据单元中的目标位置,并将预先填充了第二类型的数据的目标存储单元中 的目标位置写入第一类型的数据, 用于代替目标数据单元中第二数据, 本发明 实施例中,用目标存储单元中第一类型的数据代替目标数据单元中第二类型的 数据, 在目标数据单元中第一类型数据较多, 第二类型数据较少时, 也只需要 写入较少的第一类型的数据用于代替目标数据单元中相对较少的第二类型数 据, 所以效率比较高, 并且由于写入数据较少, 所以功耗也比较低。 请参见图 5, 为本发明实施例提供的另一种数据处理装置的结构示意图; 该数据处理装置可包括:获取模块 100、第一写入模块 101、第一设置模块 102、 第二写入模块 103、 第二设置模块 104、 读取模块 105、 转化确定模块 106和 读取确定模块 107, 其中, 获取模块 100和第一写入模块 101请参阅图 4, 在 此不赘述。  In the embodiment of the present invention, when the target data unit needs to be stored, the number of the first data of the first type and the second type of the second type of the type in the target data unit are obtained, when the first When the number of data is greater than the number of second data, a target position of the second data in the target data unit is obtained, and a target in the target storage unit of the second type of data is pre-filled The location is written to the first type of data, in place of the second data in the target data unit. In the embodiment of the present invention, the first type of data in the target storage unit is used to replace the second type of data in the target data unit, in the target data. When there is more data of the first type in the unit, and less data of the second type, only less data of the first type needs to be written to replace the second type of data in the target data unit, so the efficiency is relatively high. And because the write data is less, the power consumption is also lower. FIG. 5 is a schematic structural diagram of another data processing apparatus according to an embodiment of the present invention. The data processing apparatus may include: an obtaining module 100, a first writing module 101, a first setting module 102, and a second writing. The module 103, the second setting module 104, the reading module 105, the conversion determining module 106, and the reading determining module 107, wherein the obtaining module 100 and the first writing module 101 are referred to FIG. 4, and details are not described herein.
第一设置模块 102, 用于将所述目标存储单元的标志位设置为第一标识, 所述第一标识用于标识所述目标存储单元中所存储的数据非所述目标数据单 元中的原始数据。 作为一种可选的实施方式,在存储完目标数据单元之后, 为了方便读取数 据, 第一设置模块 102需要在目标存储单元的标志位进行设置, 当在目标存储 单元中所存储的数据非目标数据单元的原始数据,则第一设置模块 102将目标 存储单元的标志位设置为第一标识,第一标识即是标识目标存储单元中所存储 的数据非目标数据单元中的原始数据, 如图 3所述, 为 PCM存储器中存储二 进制数据的场景图, 在第一个目标存储单元中, 标志位设置了第一标识, 第一 标识用数据值为 0的数据代替。 则目标存储单元中所存储的数据 01111011不 是目标数据单元的原始数据,当需要读取该目标存储单元中所存储的目标数据 单元时, 需要将目标存储单元中的数据进行按位取反。 a first setting module 102, configured to set a flag bit of the target storage unit as a first identifier, where the first identifier is used to identify that data stored in the target storage unit is not original in the target data unit data. As an optional implementation manner, after storing the target data unit, in order to facilitate reading data, the first setting module 102 needs to set the flag bit of the target storage unit, when the data stored in the target storage unit is not The original data of the target data unit, the first setting module 102 sets the flag bit of the target storage unit as the first identifier, where the first identifier is the original data in the non-target data unit of the data stored in the target storage unit, such as As shown in FIG. 3, a scene graph for storing binary data in the PCM memory, in the first target storage unit, the flag bit is set with the first identifier, and the first identifier is replaced by data with a data value of 0. Then, the data 01111011 stored in the target storage unit is not the original data of the target data unit. When the target data unit stored in the target storage unit needs to be read, the data in the target storage unit needs to be bit-inverted.
第二写入模块 103, 用于若所述第一数据的个数小于或者等于所述第二数 据的个数, 则获取所述第一数据在所述目标数据单元中的第二目标位置, 并将 预填充为所述第二类型的数据的目标存储单元中所述第二目标位置中写入所 述第一类型的数据。  a second writing module 103, configured to acquire a second target position of the first data in the target data unit, if the number of the first data is less than or equal to the number of the second data, And writing the first type of data into the second target location in a target storage unit pre-filled with the second type of data.
作为一种可选的实施方式, 第一数据的类型为第一类型, 第二数据的类型 为第二类型。 目标存储单元中预填充的数据的类型为第二类型, 由于目标数据 单元中第一数据的个数小于或者等于第二数据的个数,为了在目标存储单元中 写入较少的数据量,则第二写入模块 103可以直接在目标存储单元中相应的位 的原始数据。  As an optional implementation manner, the type of the first data is a first type, and the type of the second data is a second type. The type of the data pre-filled in the target storage unit is the second type. Since the number of the first data in the target data unit is less than or equal to the number of the second data, in order to write a smaller amount of data in the target storage unit, Then the second write module 103 can directly source the corresponding data of the corresponding bits in the target storage unit.
这里以在目标存储单元中存储二进制数据为例来进行说明,由于综合考虑 功耗和延时, 一般在目标存储单元中预先填充数据值为 1的数据, 即是第二类 型的数据为数据值为 1的数据, 第一类型的数据为数据值为 0的数据。 当目标 数据单元中数据值为 0的数据个数小于或者等于数据值为 1的数据的个数,例 如目标数据单元为 11111010, 数据值为 0的数据个数为 2, 数据值为 1的数据 的个数为 6, 数据值为 0的数据个数小于数据值为 1的数据的个数, 则第二写 入模块 103获取目标数据单元中数据值为 0的数据的第一目标位置,在本实施 例中, 第一目标位置为第六位和第八位, 则第二写入模块 103在目标存储单元 的第六位和第八位写入数据值为 0的数据,以来代替目标数据单元中数据值为 0的数据, 则目标存储单元中所存储的数据为 11111010, 所存储的数据是目标 数据单元的原始数据, 具体的, 如图 3所述的 PCM存储器中的第二个存储单 元。 Here, the binary data is stored in the target storage unit as an example. Since power consumption and delay are comprehensively considered, data of a data value of 1 is generally pre-filled in the target storage unit, that is, the second type of data is a data value. For data of 1, the first type of data is data with a data value of zero. When the number of data whose data value is 0 in the target data unit is less than or equal to the number of data whose data value is 1, for example, the target data unit is 11111010, the data value is 0, the data number is 2, and the data value is 1. The number of data is 6, the number of data having a data value of 0 is smaller than the number of data having a data value of 1, and the second writing module 103 acquires the first target position of the data having the data value of 0 in the target data unit. In this embodiment, the first target position is the sixth bit and the eighth bit, and the second writing module 103 writes the data with the data value of 0 in the sixth and eighth bits of the target storage unit, and replaces the target data. If the data value of the unit is 0, the data stored in the target storage unit is 11111010, and the stored data is the target. The raw data of the data unit, specifically, the second storage unit in the PCM memory as described in FIG.
第二设置模块 104, 用于将所述目标存储单元的标志位设置为第二标识, 所述第二标识用于标识所述目标存储单元中所存储的数据为所述目标数据单 元中的原始数据。  a second setting module 104, configured to set a flag bit of the target storage unit as a second identifier, where the second identifier is used to identify that data stored in the target storage unit is original in the target data unit data.
作为一种可选的实施方式,在存储完目标数据单元之后, 为了方便读取数 据, 第二设置模块 104需要在目标存储单元的标志位进行设置, 当在目标存储 单元中所存储的数据是目标数据单元的原始数据,则第二设置模块 104将目标 存储单元的标志位设置为第二标识,第二标识即是标识目标存储单元中所存储 的数据是目标数据单元中的原始数据, 如图 3所述, 为 PCM存储器中存储二 进制数据的场景图, 在第二个目标存储单元中, 标志位设置了第二标识, 第二 标识用数据值为 1的数据代替。 则目标存储单元中所存储的数据 11111010是 目标数据单元的原始数据,当需要读取该目标存储单元中所存储的目标数据单 元时, 直接读取目标存储单元中的数据。  As an optional implementation manner, after storing the target data unit, in order to facilitate reading data, the second setting module 104 needs to set the flag bit of the target storage unit, when the data stored in the target storage unit is The raw data of the target data unit, the second setting module 104 sets the flag bit of the target storage unit as the second identifier, and the second identifier is that the data stored in the target storage unit is the original data in the target data unit, such as As shown in FIG. 3, which is a scene graph for storing binary data in the PCM memory, in the second target storage unit, the flag bit is set with the second identifier, and the second identifier is replaced with the data with the data value of 1. Then, the data 11111010 stored in the target storage unit is the original data of the target data unit, and when the target data unit stored in the target storage unit needs to be read, the data in the target storage unit is directly read.
读取模块 105, 用于当需要获取所述目标存储单元中所存储的所述目标数 据单元时, 读取所述目标存储单元的标志位;  The reading module 105 is configured to read a flag bit of the target storage unit when the target data unit stored in the target storage unit needs to be acquired;
作为一种可选的实施方式,将目标数据单元存储至目标数据单元后, 当要 调用目标数据单元时, 则需要从目标存储单元中去获取目标数据单元。在本发 明实施例中,获取目标数据单元的方法基于向目标存储单元中存储目标数据单 元的规则, 所以, 当需要获取目标存储单元中所存储的目标数据单元时, 首先 读取模块 105读取目标存储单元的标志位,标志位的作用是为了标识目标存储 单元中所存储的数据是否为目标数据单元中的原始数据。  As an optional implementation manner, after the target data unit is stored to the target data unit, when the target data unit is to be called, the target data unit needs to be acquired from the target storage unit. In the embodiment of the present invention, the method for acquiring the target data unit is based on the rule of storing the target data unit in the target storage unit, so when the target data unit stored in the target storage unit needs to be acquired, the reading module 105 reads first. The flag bit of the target storage unit is used to identify whether the data stored in the target storage unit is the original data in the target data unit.
转化确定模块 106, 用于若所述标志位为所述第一标识, 则将所述目标存 储单元中所述第一类型的数据转化为所述第二类型的数据,将所述目标存储单 元中所述第二类型的数据转化为所述第一类型的数据,并将转化处理后的所述 作为一种可选的实施方式,如果目标存储单元的标志位为第一标识, 则表 明目标存储单元中所存储的数据非目标数据单元的原始数据,当需要获取目标 存储单元中所存储的目标数据单元时,转化确定模块 106需要将目标存储单元 中所存储的数据进行一系列的转化处理。若目标存储单元中的数据为第一类型 的数据, 则转化确定模块 106将第一类型的数据转化为第二类型的数据, 若目 标存储单元中的数据为第二类型的数据,则转化确定模块 106将第二类型的数 据转化为第一类型的数据。转化确定模块 106依次对目标存储单元中所存储的 标数据单元。 The conversion determining module 106 is configured to: if the flag bit is the first identifier, convert the first type of data in the target storage unit into the second type of data, and use the target storage unit The second type of data is converted into the first type of data, and the conversion processed as an optional implementation manner, if the target storage unit flag is the first identifier, indicating the target The data stored in the storage unit is not the original data of the target data unit. When it is required to acquire the target data unit stored in the target storage unit, the conversion determination module 106 needs to target the storage unit. The data stored in is subjected to a series of conversion processing. If the data in the target storage unit is the first type of data, the conversion determining module 106 converts the first type of data into the second type of data, and if the data in the target storage unit is the second type of data, the conversion determines Module 106 converts the second type of data into the first type of data. The conversion determination module 106 sequentially pairs the target data units stored in the target storage unit.
这里继续以目标存储单元中存储二进制数据为例来进行说明, 如图 3 所 述, 在第一个目标存储单元的标志位为第一标识, 即是标志位为数据值为 0 的数据, 则表明需要对目标存储单元中所存储的数据需要进行转化, 第一类型 数据, 即是数据值为 0的数据需要转化为第二类型数据, 即是数据值为 1的数 据; 第二类型数据, 即是数据值为 1的数据需要转化为第一类型数据, 即是数 据值为 0的数据, 因此,转化确定模块 106依次对目标存储单元中所存储的各 个数据进行转化后得到的二进制数据为: 10000100, 将数据 10000100确定为 该目标存储单元所存储的目标数据单元。  Here, the description is continued by taking the binary data stored in the target storage unit as an example. As shown in FIG. 3, when the flag of the first target storage unit is the first identifier, that is, the data with the data bit value of 0 is It indicates that the data stored in the target storage unit needs to be converted. The first type of data, that is, the data with the data value of 0 needs to be converted into the second type of data, that is, the data with the data value of 1; the second type of data, That is, the data with the data value of 1 needs to be converted into the first type of data, that is, the data with the data value of 0. Therefore, the conversion determining module 106 sequentially converts the binary data obtained by converting each data stored in the target storage unit into : 10000100, the data 10000100 is determined as the target data unit stored by the target storage unit.
读取确定模块 107, 用于若所述标志位为所述第二标识, 则读取所述目标 储的所述目标数据单元。  The read determining module 107 is configured to read the target data unit of the target storage if the flag bit is the second identifier.
作为一种可选的实施方式,如果目标存储单元的标志位为第二标识, 则表 明目标存储单元中所存储的数据是目标数据单元的原始数据, 因此, 当需要获 取目标存储单元中所存储的目标数据单元时,则读取确定模块 107直接读取目 的目标数据单元。  As an optional implementation manner, if the flag of the target storage unit is the second identifier, it indicates that the data stored in the target storage unit is the original data of the target data unit, and therefore, when it is required to acquire the storage in the target storage unit. When the target data unit is reached, the read determination module 107 directly reads the destination target data unit.
这里继续以目标存储单元中存储二进制数据为例来进行说明, 如图 3 所 述, 在第二个目标存储单元中, 目标存储单元的标志位为第二标识, 即是数据 值为 1的数据, 则目标存储单元中所存储的数据 11111010是目标数据单元中 的原始数据, 因此需要获取目标存储单元中所存储的目标数据单元时,仅仅需 要读取确定模块 107从目标存储单元中读取所存储的数据 11111010,并将数据 11111010确定为该目标存储单元所存储的目标数据单元。  Here, the description is continued by taking the binary data stored in the target storage unit as an example. As shown in FIG. 3, in the second target storage unit, the flag of the target storage unit is the second identifier, that is, the data with the data value of 1. Then, the data 11111010 stored in the target storage unit is the original data in the target data unit, and therefore, when the target data unit stored in the target storage unit needs to be acquired, only the read determination module 107 needs to read from the target storage unit. The stored data 11111010 is determined as the target data unit stored by the target storage unit.
本发明实施例中, 当需要对目标数据单元进行存储时, 获取目标数据单元 中类型为第一类型的第一数据的个数与类型为第二类型的第二数据的个数,当 第一数据的个数大于第二数据的个数时,则获取个数相对较少的第二数据在目 标数据单元中的目标位置,并将预先填充了第二类型的数据的目标存储单元中 的目标位置写入第一类型的数据, 用于代替目标数据单元中第二数据, 本发明 实施例中,用目标存储单元中第一类型的数据代替目标数据单元中第二类型的 数据, 在目标数据单元中第一类型数据较多, 第二类型数据较少时, 也只需要 写入较少的第一类型的数据用于代替目标数据单元中相对较少的第二类型数 据, 所以效率比较高, 并且由于写入数据较少, 所以功耗也比较低。 请参见图 6, 为本发明实施例提供的又一种数据处理装置的结构示意图; 该数据处理装置可包括: 处理器器 200。 In the embodiment of the present invention, when the target data unit needs to be stored, the target data unit is acquired. The number of the first data of the first type and the number of the second data of the second type are relatively small when the number of the first data is greater than the number of the second data The second data is in a target location in the target data unit, and the target location in the target storage unit pre-filled with the second type of data is written into the first type of data, in place of the second data in the target data unit, In the embodiment of the present invention, the first type of data in the target storage unit is used to replace the second type of data in the target data unit. When the first type of data is more in the target data unit, and the second type of data is less, only The lesser first type of data is written to replace the relatively smaller second type of data in the target data unit, so the efficiency is higher, and since the write data is less, the power consumption is also lower. FIG. 6 is a schematic structural diagram of still another data processing apparatus according to an embodiment of the present invention; the data processing apparatus may include: a processor 200.
处理器 200, 用于当需要对目标数据单元进行存储时, 获取目标数据单元 中第一数据的个数与第二数据的个数, 所述第一数据的类型为第一类型, 所述 第二数据的类型为第二类型;  The processor 200 is configured to acquire, when the target data unit needs to be stored, the number of the first data and the second data in the target data unit, where the type of the first data is the first type, The type of the second data is the second type;
可选的, 当需要将目标数据单元存储至目标存储单元中时, 首先需要获取 目标数据单元中第一数据的个数与第二数据的个数,在计算机系统中对数据进 行存储时, 一般是以数据单元的形式进行存储, 一个数据单元可以包括 8bit 数据。 因此目标数据单元中有多个数据, 并且目标数据单元中所包括的数据的 类型也可以有多种, 例如, 当数据是以二进制的形式进行存储时, 则目标数据 单元中所包括的类型有两种, 第一类型和第二类型, 第一类型的数据可以是数 据值为 0的数据, 第二类型的数据可以是数据值为 1的数据, 则目标数据单元 中的第一数据即是全部数据值为 0的数据,第二数据即是全部数据值为 1的数 据。 需要说明的是, 第一类型的数据也可以是数据值为 1的数据, 第二类型的 数据可以是数据值为 0的数据,则目标数据单元中的第一数据即是全部数据值 为 1的数据, 第二数据即是全部数据值为 0的数据。  Optionally, when the target data unit needs to be stored in the target storage unit, first, the number of the first data and the second data in the target data unit are acquired, and when the data is stored in the computer system, generally It is stored in the form of data units, and one data unit can include 8 bits of data. Therefore, there are multiple data in the target data unit, and the types of data included in the target data unit may also be various. For example, when the data is stored in binary form, the types included in the target data unit are Two types, the first type and the second type, the first type of data may be data having a data value of 0, and the second type of data may be data having a data value of 1, then the first data in the target data unit is All data with a data value of 0, the second data is data with a total data value of 1. It should be noted that the first type of data may also be data with a data value of 1, and the second type of data may be data with a data value of 0, and the first data in the target data unit is all data values of 1. The second data is the data with all data values of 0.
处理器 200, 还用于若所述第一数据的个数大于所述第二数据的个数, 则 获取所述第二数据在所述目标数据单元中的第一目标位置,并将预填充为所述 第二类型的数据的目标存储单元中所述第一目标位置中写入所述第一类型的 数据。 可选的, 在对数据存储至计算机内存中时, 为了减少写入数据的数据量, 同时减少延时,一般都会将计算机内存进行预填充, 即是预先在每一个存储单 元填充一种类型的数据, 当存储数据至存储单元时, 则直接在存储单元中修改 数据值不同的位数。 由于有时需要修改的位数过多, 需要写入大量的数据, 会 造成功耗较大延时较长, 因此, 在本发明实施例中, 预填充的数据类型为第二 类型的数据,当目标数据单元中类型为第一类型的第一数据的个数大于类型为 第二类型的第二数据的个数时,则直接获取目标数据单元中第二类型的数据的 第一目标位置, 并将目标存储单元中第一目标位置中写入第一类型的数据, 用 第一类型的数据代替目标数据单元中第二类型的数据,用第二类型的数据代替 目标数据单元中第一类型的数据,相当于对目标数据单元中的各个数据进行翻 转存储。 The processor 200 is further configured to: if the number of the first data is greater than the number of the second data, acquire a first target location of the second data in the target data unit, and pre-populate Writing the first type of data into the first target location in a target storage unit of the second type of data. Optionally, when the data is stored in the computer memory, in order to reduce the amount of data written in the data, and reduce the delay, the computer memory is generally pre-filled, that is, each type of storage unit is pre-filled with a type. Data, when storing data to a storage unit, directly modify the number of bits of the data value directly in the storage unit. Because the number of bits that need to be modified is too large, and a large amount of data needs to be written, the power consumption is long and the delay is long. Therefore, in the embodiment of the present invention, the pre-filled data type is the second type of data. When the number of the first data of the first type in the target data unit is greater than the number of the second data of the second type, the first target position of the second type of data in the target data unit is directly obtained, and Writing the first type of data into the first target location in the target storage unit, replacing the second type of data in the target data unit with the first type of data, and replacing the first type of the target data unit with the second type of data Data is equivalent to flipping the data in the target data unit.
这里以在目标存储单元中存储二进制数据为例来进行说明,由于综合考虑 功耗和延时, 一般在目标存储单元中预先填充数据值为 1的数据, 即是第二类 型的数据为数据值为 1的数据, 第一类型的数据为数据值为 0的数据。 当目标 数据单元中数据值为 0的数据个数大于数据值为 1的数据的个数,例如目标数 据单元为 10000100,数据值为 0的数据个数为 6,数据值为 1的数据的个数为 2, 数据值为 0的数据个数大于数据值为 1的数据的个数, 则获取目标数据单 元中数据值为 1的数据的第一目标位置,在本实施例中, 第一目标位置为第一 位和第六位, 则在目标存储单元的第一位和第六位写入数据值为 0的数据, 以 来代替目标数据单元中数据值为 1的数据,则目标存储单元中所存储的数据为 01111011 , 所存储的数据并非目标数据单元的原始数据, 而是原始数据的取反 运算后的数据。  Here, the binary data is stored in the target storage unit as an example. Since power consumption and delay are comprehensively considered, data of a data value of 1 is generally pre-filled in the target storage unit, that is, the second type of data is a data value. For data of 1, the first type of data is data with a data value of zero. When the number of data whose data value is 0 in the target data unit is larger than the number of data whose data value is 1, for example, the target data unit is 10000100, the data value is 0, the data number is 6, and the data value is 1. If the number of data with the data value of 0 is greater than the number of data with the data value of 1, the first target position of the data with the data value of 1 in the target data unit is obtained. In this embodiment, the first target When the position is the first bit and the sixth bit, the data having the data value of 0 is written in the first bit and the sixth bit of the target memory unit, and the data having the data value of 1 in the target data unit is replaced in the target storage unit. The stored data is 01111011, and the stored data is not the original data of the target data unit, but the inversed data of the original data.
作为一种可选的实施方式,所述处理器 200还用于若所述第一数据的个数 小于或者等于所述第二数据的个数,则获取所述第一数据在所述目标数据单元 中的第二目标位置,并将预填充为所述第二类型的数据的目标存储单元中所述 第二目标位置中写入所述第一类型的数据。  As an optional implementation manner, the processor 200 is further configured to: if the number of the first data is less than or equal to the number of the second data, acquire the first data in the target data. a second target location in the cell, and writing the first type of data in the second target location in a target storage unit pre-filled with the second type of data.
可选的, 第一数据的类型为第一类型, 第二数据的类型为第二类型。 目标 存储单元中预填充的数据的类型为第二类型,由于目标数据单元中第一数据的 个数小于或者等于第二数据的个数, 为了在目标存储单元中写入较少的数据 量, 则可以直接在目标存储单元中相应的位置写入第一类型的数据, 即是目标 这里以在目标存储单元中存储二进制数据为例来进行说明,由于综合考虑 功耗和延时, 一般在目标存储单元中预先填充数据值为 1的数据, 即是第二类 型的数据为数据值为 1的数据, 第一类型的数据为数据值为 0的数据。 当目标 数据单元中数据值为 0的数据个数小于或者等于数据值为 1的数据的个数,例 如目标数据单元为 11111010, 数据值为 0的数据个数为 2, 数据值为 1的数据 的个数为 6, 数据值为 0的数据个数小于数据值为 1的数据的个数, 则获取目 标数据单元中数据值为 0的数据的第一目标位置, 在本实施例中, 第一目标位 置为第六位和第八位, 则在目标存储单元的第六位和第八位写入数据值为 0 的数据, 以来代替目标数据单元中数据值为 0的数据, 则目标存储单元中所存 储的数据为 11111010, 所存储的数据是目标数据单元的原始数据, 具体的, 如 图 3所述的 PCM存储器中的第二个存储单元。 Optionally, the type of the first data is a first type, and the type of the second data is a second type. The type of data pre-filled in the target storage unit is the second type, since the number of the first data in the target data unit is less than or equal to the number of the second data, in order to write less data in the target storage unit Quantity, then the first type of data can be directly written in the corresponding position in the target storage unit, that is, the target is described here by storing binary data in the target storage unit as an example, due to comprehensive consideration of power consumption and delay, generally Data having a data value of 1 is pre-filled in the target storage unit, that is, data of the second type is data having a data value of 1, and data of the first type is data having a data value of zero. When the number of data whose data value is 0 in the target data unit is less than or equal to the number of data whose data value is 1, for example, the target data unit is 11111010, the data value is 0, the data number is 2, and the data value is 1. The number of data is 6, the number of data whose data value is 0 is smaller than the number of data whose data value is 1, and the first target position of the data whose data value is 0 in the target data unit is obtained. In this embodiment, When the target position is the sixth bit and the eighth bit, the data with the data value of 0 is written in the sixth and eighth bits of the target storage unit, and the data of the data value of 0 in the target data unit is replaced, and the target storage is performed. The data stored in the unit is 11111010, and the stored data is the original data of the target data unit, specifically, the second storage unit in the PCM memory as described in FIG.
作为一种可选的实施方式,所述处理器 200还用于将所述目标存储单元的 标志位设置为第一标识,所述第一标识用于标识所述目标存储单元中所存储的 数据非所述目标数据单元中的原始数据。  As an optional implementation manner, the processor 200 is further configured to set a flag of the target storage unit as a first identifier, where the first identifier is used to identify data stored in the target storage unit. Not raw data in the target data unit.
可选的, 在存储完目标数据单元之后, 为了方便读取数据, 需要在目标存 储单元的标志位进行设置,当在目标存储单元中所存储的数据非目标数据单元 的原始数据, 即是在存储时, 是按照步骤 S201的方法进行存储的, 则将目标 存储单元的标志位设置为第一标识,第一标识即是标识目标存储单元中所存储 的数据非目标数据单元中的原始数据, 如图 3所述, 为 PCM存储器中存储二 进制数据的场景图, 在第一个目标存储单元中, 标志位设置了第一标识, 第一 标识用数据值为 0的数据代替。 则目标存储单元中所存储的数据 01111011不 是目标数据单元的原始数据,当需要读取该目标存储单元中所存储的目标数据 单元时, 需要将目标存储单元中的数据进行按位取反。  Optionally, after the target data unit is stored, in order to facilitate the reading of the data, the flag of the target storage unit needs to be set, and when the data stored in the target storage unit is not the original data of the target data unit, that is, When the storage is performed according to the method of step S201, the flag bit of the target storage unit is set as the first identifier, and the first identifier is the original data in the non-target data unit of the data stored in the target storage unit. As shown in FIG. 3, for the scene graph in which the binary data is stored in the PCM memory, in the first target storage unit, the flag bit is set with the first identifier, and the first identifier is replaced by the data with the data value of 0. Then, the data 01111011 stored in the target storage unit is not the original data of the target data unit. When the target data unit stored in the target storage unit needs to be read, the data in the target storage unit needs to be bit-inverted.
作为一种可选的实施方式,所述处理器 200还用于将所述目标存储单元的 标志位设置为第二标识,所述第二标识用于标识所述目标存储单元中所存储的 数据为所述目标数据单元中的原始数据。  As an optional implementation manner, the processor 200 is further configured to set a flag bit of the target storage unit as a second identifier, where the second identifier is used to identify data stored in the target storage unit. Is the raw data in the target data unit.
可选的, 在存储完目标数据单元之后, 为了方便读取数据, 需要在目标 存储单元的标志位进行设置,当在目标存储单元中所存储的数据是目标数据单 元的原始数据, 即是在存储时, 是按照步骤 S203的方法进行存储的, 则将目 标存储单元的标志位设置为第二标识,第二标识即是标识目标存储单元中所存 储的数据是目标数据单元中的原始数据, 如图 3所述, 为 PCM存储器中存储 二进制数据的场景图, 在第二个目标存储单元中, 标志位设置了第二标识, 第 二标识用数据值为 1 的数据代替。 则目标存储单元中所存储的数据 11111010 是目标数据单元的原始数据,当需要读取该目标存储单元中所存储的目标数据 单元时, 直接读取目标存储单元中的数据。 Optionally, after storing the target data unit, in order to facilitate the reading of the data, the target needs to be The flag of the storage unit is set. When the data stored in the target storage unit is the original data of the target data unit, that is, when stored, according to the method of step S203, the flag of the target storage unit is set. Set as the second identifier, the second identifier is that the data stored in the target storage unit is the original data in the target data unit, as shown in FIG. 3, is a scene graph for storing binary data in the PCM memory, in the second In the target storage unit, the flag bit is set with the second identifier, and the second identifier is replaced by the data with the data value of 1. Then, the data 11111010 stored in the target storage unit is the original data of the target data unit, and when the target data unit stored in the target storage unit needs to be read, the data in the target storage unit is directly read.
作为一种可选的实施方式,所述处理器 200还用于当需要获取所述目标存 储单元中所存储的所述目标数据单元时, 读取所述目标存储单元的标志位; 可选的,将目标数据单元存储至目标数据单元后, 当要调用目标数据单元 时, 则需要从目标存储单元中去获取目标数据单元。 在本发明实施例中, 获取 目标数据单元的方法基于向目标存储单元中存储目标数据单元的规则, 所以, 当需要获取目标存储单元中所存储的目标数据单元时,首先读取目标存储单元 的标志位,标志位的作用是为了标识目标存储单元中所存储的数据是否为目标 数据单元中的原始数据。  As an optional implementation manner, the processor 200 is further configured to: when the target data unit stored in the target storage unit needs to be acquired, read a flag of the target storage unit; After the target data unit is stored to the target data unit, when the target data unit is to be called, the target data unit needs to be acquired from the target storage unit. In the embodiment of the present invention, the method for acquiring the target data unit is based on the rule of storing the target data unit in the target storage unit, so when the target data unit stored in the target storage unit needs to be acquired, the target storage unit is first read. The flag bit is used to identify whether the data stored in the target storage unit is the original data in the target data unit.
所述处理器 200还用于若所述标志位为所述第一标识,则将所述目标存储 单元中所述第一类型的数据转化为所述第二类型的数据,将所述目标存储单元 中所述第二类型的数据转化为所述第一类型的数据,并将转化处理后的所述数 据确定为所述目标存储单元中所存储的所述目标数据单元;  The processor 200 is further configured to: if the flag bit is the first identifier, convert the first type of data in the target storage unit into the second type of data, and store the target Converting the second type of data in the unit into the first type of data, and determining the converted data as the target data unit stored in the target storage unit;
可选的,如果目标存储单元的标志位为第一标识, 则表明目标存储单元中 所存储的数据非目标数据单元的原始数据,当需要获取目标存储单元中所存储 的目标数据单元时,需要将目标存储单元中所存储的数据进行一系列的转化处 理。若目标存储单元中的数据为第一类型的数据, 则将第一类型的数据转化为 第二类型的数据, 若目标存储单元中的数据为第二类型的数据, 则将第二类型 的数据转化为第一类型的数据。依次对目标存储单元中所存储的所有数据进行 这里继续以目标存储单元中存储二进制数据为例来进行说明, 如图 3 所 述, 在第一个目标存储单元的标志位为第一标识, 即是标志位为数据值为 0 的数据, 则表明需要对目标存储单元中所存储的数据需要进行转化, 第一类型 数据, 即是数据值为 0的数据需要转化为第二类型数据, 即是数据值为 1的数 据; 第二类型数据, 即是数据值为 1的数据需要转化为第一类型数据, 即是数 据值为 0的数据, 因此,依次对目标存储单元中所存储的各个数据进行转化后 得到的二进制数据为: 10000100, 将数据 10000100确定为该目标存储单元所 存储的目标数据单元。 Optionally, if the flag of the target storage unit is the first identifier, indicating that the data stored in the target storage unit is the original data of the non-target data unit, when it is required to acquire the target data unit stored in the target storage unit, A series of conversion processing is performed on the data stored in the target storage unit. If the data in the target storage unit is the first type of data, converting the first type of data into the second type of data, and if the data in the target storage unit is the second type of data, the second type of data is Convert to the first type of data. The following is a description of all the data stored in the target storage unit, and the binary data stored in the target storage unit is taken as an example. As shown in FIG. 3, the flag of the first target storage unit is the first identifier, that is, Is the flag bit as the data value is 0 The data indicates that the data stored in the target storage unit needs to be converted. The first type of data, that is, the data with the data value of 0 needs to be converted into the second type of data, that is, the data with the data value of 1; The second type of data, that is, the data having the data value of 1 needs to be converted into the first type of data, that is, the data having the data value of 0. Therefore, the binary data obtained by converting the respective data stored in the target storage unit in turn is : 10000100, the data 10000100 is determined as the target data unit stored by the target storage unit.
所述处理器 200还用于若所述标志位为所述第二标识,则读取所述目标存 的所述目标数据单元。  The processor 200 is further configured to read the target data unit of the target storage if the flag bit is the second identifier.
可选的,如果目标存储单元的标志位为第二标识, 则表明目标存储单元中 所存储的数据是目标数据单元的原始数据, 因此, 当需要获取目标存储单元中 所存储的目标数据单元时, 则直接读取目标存储单元中所存储的数据, 并将所 读取的数据确定为目标存储单元中所存储的目标数据单元。  Optionally, if the flag bit of the target storage unit is the second identifier, it indicates that the data stored in the target storage unit is the original data of the target data unit, and therefore, when the target data unit stored in the target storage unit needs to be acquired, And directly reading the data stored in the target storage unit, and determining the read data as the target data unit stored in the target storage unit.
这里继续以目标存储单元中存储二进制数据为例来进行说明, 如图 3 所 述, 在第二个目标存储单元中, 目标存储单元的标志位为第二标识, 即是数据 值为 1的数据, 则目标存储单元中所存储的数据 11111010是目标数据单元中 的原始数据, 因此需要获取目标存储单元中所存储的目标数据单元时,仅仅需 要从目标存储单元中读取所存储的数据 11111010, 并将数据 11111010确定为 该目标存储单元所存储的目标数据单元。  Here, the description is continued by taking the binary data stored in the target storage unit as an example. As shown in FIG. 3, in the second target storage unit, the flag of the target storage unit is the second identifier, that is, the data with the data value of 1. The data 11111010 stored in the target storage unit is the original data in the target data unit. Therefore, when the target data unit stored in the target storage unit needs to be acquired, only the stored data 11111010 needs to be read from the target storage unit. The data 11111010 is determined as the target data unit stored by the target storage unit.
本发明实施例中, 当需要对目标数据单元进行存储时, 获取目标数据单元 中类型为第一类型的第一数据的个数与类型为第二类型的第二数据的个数,当 第一数据的个数大于第二数据的个数时,则获取个数相对较少的第二数据在目 标数据单元中的目标位置,并将预先填充了第二类型的数据的目标存储单元中 的目标位置写入第一类型的数据, 用于代替目标数据单元中第二数据, 本发明 实施例中,用目标存储单元中第一类型的数据代替目标数据单元中第二类型的 数据, 在目标数据单元中第一类型数据较多, 第二类型数据较少时, 也只需要 写入较少的第一类型的数据用于代替目标数据单元中相对较少的第二类型数 据, 所以效率比较高, 并且由于写入数据较少, 所以功耗也比较低。  In the embodiment of the present invention, when the target data unit needs to be stored, the number of the first data of the first type and the second type of the second type of the type in the target data unit are obtained, when the first When the number of data is greater than the number of second data, a target position of the second data in the target data unit is obtained, and a target in the target storage unit of the second type of data is pre-filled The location is written to the first type of data, in place of the second data in the target data unit. In the embodiment of the present invention, the first type of data in the target storage unit is used to replace the second type of data in the target data unit, in the target data. When there is more data of the first type in the unit, and less data of the second type, only less data of the first type needs to be written to replace the second type of data in the target data unit, so the efficiency is relatively high. And because the write data is less, the power consumption is also lower.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程, 是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算 机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。 其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory, ROM )或随机存储记忆体 ( Random Access Memory, RAM )等。 One of ordinary skill in the art can understand all or part of the process in implementing the above embodiments. This may be accomplished by a computer program instructing the associated hardware, which may be stored in a computer readable storage medium, which, when executed, may include the flow of an embodiment of the methods described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
以上所揭露的仅为本发明较佳实施例而已,当然不能以此来限定本发明之 权利范围,因此依本发明权利要求所作的等同变化,仍属本发明所涵盖的范围。  The above is only the preferred embodiment of the present invention, and the scope of the present invention is not limited thereto, and the equivalent changes made by the claims of the present invention are still within the scope of the present invention.

Claims

权 利 要 求 Rights request
1、 一种数据处理方法, 其特征在于, 所述方法包括: 1. A data processing method, characterized in that the method includes:
当需要对目标数据单元进行存储时,获取目标数据单元中第一数据的个数 与第二数据的个数, 所述第一数据的类型为第一类型, 所述第二数据的类型为 第二类型; When it is necessary to store the target data unit, the number of first data and the number of second data in the target data unit are obtained, the type of the first data is the first type, and the type of the second data is the first type. Type II;
若所述第一数据的个数大于所述第二数据的个数,则获取所述第二数据在 所述目标数据单元中的第一目标位置,并将预填充为所述第二类型的数据的目 标存储单元中所述第一目标位置中写入所述第一类型的数据。 If the number of the first data is greater than the number of the second data, obtain the first target position of the second data in the target data unit, and prefill it as the second type. The first type of data is written in the first target location in the data target storage unit.
2、 如权利要求 1所述的方法, 其特征在于, 所述方法还包括: 2. The method of claim 1, characterized in that, the method further includes:
若所述第一数据的个数小于或者等于所述第二数据的个数,则获取所述第 一数据在所述目标数据单元中的第二目标位置,并将预填充为所述第二类型的 数据的目标存储单元中所述第二目标位置中写入所述第一类型的数据。 If the number of the first data is less than or equal to the number of the second data, obtain the second target position of the first data in the target data unit, and prefill it as the second The data of the first type is written in the second target location of the target storage unit.
3、 如权利要求 2所述的方法, 其特征在于, 所述若所述第一数据的个数 大于所述第二数据的个数,则获取所述第二数据在所述目标数据单元中的第一 目标位置,并将预填充为所述第二类型的数据的目标存储单元中所述第一目标 位置中写入所述第一类型的数据之后, 还包括: 3. The method of claim 2, wherein if the number of the first data is greater than the number of the second data, obtaining the second data in the target data unit the first target location, and after writing the first type of data into the first target location in the target storage unit prefilled with the second type of data, the method further includes:
将所述目标存储单元的标志位设置为第一标识,所述第一标识用于标识所 述目标存储单元中所存储的数据非所述目标数据单元中的原始数据。 The flag bit of the target storage unit is set to a first identification, and the first identification is used to identify that the data stored in the target storage unit is not the original data in the target data unit.
4、 如权利要求 3所述的方法, 其特征在于, 所述若所述第一数据的个数 小于或者等于所述第二数据的个数,则获取所述第一数据在所述目标数据单元 中的第二目标位置,并将预填充为所述第二类型的数据的目标存储单元中所述 第二目标位置中写入所述第一类型的数据之后, 还包括: 4. The method of claim 3, wherein if the number of the first data is less than or equal to the number of the second data, obtaining the first data in the target data and writing the first type of data into the second target location in the target storage unit that is prefilled with the second type of data. The method further includes:
将所述目标存储单元的标志位设置为第二标识,所述第二标识用于标识所 述目标存储单元中所存储的数据为所述目标数据单元中的原始数据。 The flag bit of the target storage unit is set to a second identification, and the second identification is used to identify that the data stored in the target storage unit is the original data in the target data unit.
5、 如权利要求 4所述的方法, 其特征在于, 所述方法还包括: 当需要获取所述目标存储单元中所存储的所述目标数据单元时,读取所述 目标存储单元的标志位; 5. The method of claim 4, further comprising: when it is necessary to obtain the target data unit stored in the target storage unit, reading the flag bit of the target storage unit. ;
若所述标志位为所述第一标识,则将所述目标存储单元中所述第一类型的 数据转化为所述第二类型的数据,将所述目标存储单元中所述第二类型的数据 转化为所述第一类型的数据,并将转化处理后的所述数据确定为所述目标存储 单元中所存储的所述目标数据单元; If the flag bit is the first identifier, the first type of data in the target storage unit is converted into the second type of data, and the second type of data in the target storage unit is converted into Convert the data into the first type of data, and determine the converted data as the target data unit stored in the target storage unit;
若所述标志位为所述第二标识, 则读取所述目标存储单元中所存储的数 元。 If the flag bit is the second identifier, read the number stored in the target storage unit.
6、 一种数据处理装置, 其特征在于, 所述装置包括: 6. A data processing device, characterized in that the device includes:
获取模块, 用于当需要对目标数据单元进行存储时, 获取目标数据单元中 第一数据的个数与第二数据的个数, 所述第一数据的类型为第一类型, 所述第 二数据的类型为第二类型; An acquisition module, configured to acquire the number of first data and the number of second data in the target data unit when the target data unit needs to be stored, where the type of the first data is the first type, and the second type The type of data is the second type;
第一写入模块, 用于若所述第一数据的个数大于所述第二数据的个数, 则 获取所述第二数据在所述目标数据单元中的第一目标位置,并将预填充为所述 第二类型的数据的目标存储单元中所述第一目标位置中写入所述第一类型的 数据。 A first writing module, configured to obtain the first target position of the second data in the target data unit if the number of the first data is greater than the number of the second data, and store the preset data in the target data unit. The first type of data is written into the first target location in the target storage unit filled with the second type of data.
7、 如权利要求 6所述的装置, 其特征在于, 所述装置还包括: 7. The device according to claim 6, characterized in that, the device further includes:
第二写入模块,用于若所述第一数据的个数小于或者等于所述第二数据的 个数, 则获取所述第一数据在所述目标数据单元中的第二目标位置, 并将预填 充为所述第二类型的数据的目标存储单元中所述第二目标位置中写入所述第 一类型的数据。 A second writing module, configured to obtain the second target position of the first data in the target data unit if the number of the first data is less than or equal to the number of the second data, and The first type of data is written into the second target location in the target storage unit prefilled with the second type of data.
8、 如权利要求 7所述的装置, 其特征在于, 所述装置还包括: 8. The device according to claim 7, wherein the device further includes:
第一设置模块, 用于将所述目标存储单元的标志位设置为第一标识, 所述 第一标识用于标识所述目标存储单元中所存储的数据非所述目标数据单元中 的原始数据。 A first setting module, configured to set the flag bit of the target storage unit to a first identifier, and the first identifier is used to identify that the data stored in the target storage unit is not in the target data unit. of raw data.
9、 如权利要求 8所述的装置, 其特征在于, 所述装置还包括: 9. The device according to claim 8, characterized in that, the device further includes:
第二设置模块, 用于将所述目标存储单元的标志位设置为第二标识, 所述 第二标识用于标识所述目标存储单元中所存储的数据为所述目标数据单元中 的原始数据。 The second setting module is used to set the flag bit of the target storage unit to a second identification, and the second identification is used to identify the data stored in the target storage unit as the original data in the target data unit. .
10、 如权利要求 9所述的装置, 其特征在于, 所述装置还包括: 读取模块,用于当需要获取所述目标存储单元中所存储的所述目标数据单 元时, 读取所述目标存储单元的标志位; 10. The device according to claim 9, wherein the device further includes: a reading module, configured to read the target data unit stored in the target storage unit when it is necessary to obtain the target data unit. The flag bit of the target storage unit;
转化确定模块, 用于若所述标志位为所述第一标识, 则将所述目标存储单 元中所述第一类型的数据转化为所述第二类型的数据,将所述目标存储单元中 所述第二类型的数据转化为所述第一类型的数据,并将转化处理后的所述数据 确定为所述目标存储单元中所存储的所述目标数据单元; A conversion determination module, configured to convert the first type of data in the target storage unit into the second type of data if the flag bit is the first identification, and convert the first type of data in the target storage unit to the second type of data. Convert the second type of data into the first type of data, and determine the converted data as the target data unit stored in the target storage unit;
读取确定模块, 用于若所述标志位为所述第二标识, 则读取所述目标存储 单元中所存储的数据, ^ A reading determination module, configured to read the data stored in the target storage unit if the flag bit is the second identification, ^
所述目标数据单元。 The target data unit.
11、 一种数据处理装置, 其特征在于, 包括处理器, 其中: 11. A data processing device, characterized in that it includes a processor, wherein:
所述处理器, 用于当需要对目标数据单元进行存储时, 获取目标数据单元 中第一数据的个数与第二数据的个数, 所述第一数据的类型为第一类型, 所述 第二数据的类型为第二类型; The processor is configured to obtain the number of first data and the number of second data in the target data unit when it is necessary to store the target data unit, and the type of the first data is a first type, and the The type of the second data is the second type;
所述处理器还用于若所述第一数据的个数大于所述第二数据的个数,则获 取所述第二数据在所述目标数据单元中的第一目标位置,并将预填充为所述第 二类型的数据的目标存储单元中所述第一目标位置中写入所述第一类型的数 据。 The processor is also configured to obtain the first target position of the second data in the target data unit if the number of the first data is greater than the number of the second data, and pre-fill the Writing the first type of data into the first target location in the target storage unit for the second type of data.
12、 如权利要求 11所述的数据处理装置, 其特征在于, 12. The data processing device according to claim 11, characterized in that,
所述处理器还用于若所述第一数据的个数小于或者等于所述第二数据的 个数, 则获取所述第一数据在所述目标数据单元中的第二目标位置, 并将预填 充为所述第二类型的数据的目标存储单元中所述第二目标位置中写入所述第 一类型的数据。 The processor is also configured to: if the number of the first data is less than or equal to the number of the second data number, then obtain the second target position of the first data in the target data unit, and write the second target position in the target storage unit prefilled with the second type of data. Describe the first type of data.
13、 如权利要求 12所述的数据处理装置, 其特征在于, 13. The data processing device according to claim 12, characterized in that,
所述处理器还用于将所述目标存储单元的标志位设置为第一标识,所述第 一标识用于标识所述目标存储单元中所存储的数据非所述目标数据单元中的 原始数据。 The processor is further configured to set a flag bit of the target storage unit to a first identification, and the first identification is used to identify that the data stored in the target storage unit is not the original data in the target data unit. .
14、 如权利要求 13所述的数据处理装置, 其特征在于, 14. The data processing device according to claim 13, characterized in that,
所述处理器还用于将所述目标存储单元的标志位设置为第二标识,所述第 二标识用于标识所述目标存储单元中所存储的数据为所述目标数据单元中的 原始数据。 The processor is further configured to set the flag bit of the target storage unit to a second identification, and the second identification is used to identify that the data stored in the target storage unit is the original data in the target data unit. .
15、 如权利要求 14所述的数据处理装置, 其特征在于, 15. The data processing device according to claim 14, characterized in that,
所述处理器还用于当需要获取所述目标存储单元中所存储的所述目标数 据单元时, 读取所述目标存储单元的标志位; The processor is also configured to read the flag bit of the target storage unit when it is necessary to obtain the target data unit stored in the target storage unit;
所述处理器还用于若所述标志位为所述第一标识,则将所述目标存储单元 中所述第一类型的数据转化为所述第二类型的数据,将所述目标存储单元中所 述第二类型的数据转化为所述第一类型的数据,并将转化处理后的所述数据确 定为所述目标存储单元中所存储的所述目标数据单元; The processor is also configured to convert the first type of data in the target storage unit into the second type of data if the flag bit is the first identification, and convert the target storage unit to the second type of data. Convert the second type of data into the first type of data, and determine the converted data as the target data unit stored in the target storage unit;
所述处理器还用于若所述标志位为所述第二标识,则读取所述目标存储单 元中所存储的数据, ^ The processor is also configured to read the data stored in the target storage unit if the flag bit is the second identification, ^
述目标数据单元。 Describe the target data unit.
PCT/CN2014/075141 2014-04-11 2014-04-11 Data processing method and apparatus WO2015154298A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201480003909.0A CN105556489B (en) 2014-04-11 2014-04-11 A kind of data processing method, device
PCT/CN2014/075141 WO2015154298A1 (en) 2014-04-11 2014-04-11 Data processing method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/075141 WO2015154298A1 (en) 2014-04-11 2014-04-11 Data processing method and apparatus

Publications (1)

Publication Number Publication Date
WO2015154298A1 true WO2015154298A1 (en) 2015-10-15

Family

ID=54287136

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/075141 WO2015154298A1 (en) 2014-04-11 2014-04-11 Data processing method and apparatus

Country Status (2)

Country Link
CN (1) CN105556489B (en)
WO (1) WO2015154298A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101083138A (en) * 2007-05-30 2007-12-05 忆正存储技术(深圳)有限公司 Flash memory data read-write processing method
CN101930791A (en) * 2009-06-24 2010-12-29 索尼公司 Storer and data processing method
CN103034649A (en) * 2011-09-30 2013-04-10 阿里巴巴集团控股有限公司 Method and system for realizing data storage and search
US20130329492A1 (en) * 2012-06-06 2013-12-12 Silicon Motion Inc. Flash memory control method, controller and electronic apparatus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101083138A (en) * 2007-05-30 2007-12-05 忆正存储技术(深圳)有限公司 Flash memory data read-write processing method
CN101930791A (en) * 2009-06-24 2010-12-29 索尼公司 Storer and data processing method
CN103034649A (en) * 2011-09-30 2013-04-10 阿里巴巴集团控股有限公司 Method and system for realizing data storage and search
US20130329492A1 (en) * 2012-06-06 2013-12-12 Silicon Motion Inc. Flash memory control method, controller and electronic apparatus

Also Published As

Publication number Publication date
CN105556489B (en) 2019-04-26
CN105556489A (en) 2016-05-04

Similar Documents

Publication Publication Date Title
US10983729B2 (en) Method and apparatus for performing multi-object transformations on a storage device
TWI457932B (en) Method and system to improve the performance of a multi-level cell (mlc) nand flash memory
US7461233B2 (en) Method for identifying data characteristics for flash memory
US9690490B2 (en) Method for writing data, memory storage device and memory control circuit unit
TW201539187A (en) Flash memory compression
JP6034183B2 (en) Semiconductor memory device
TWI660346B (en) Memory management method and storage controller
US10389380B2 (en) Efficient data path architecture for flash devices configured to perform multi-pass programming
JP6130971B2 (en) Method for writing data to flash memory device, flash memory device and storage system
US20170004070A1 (en) Controller, storage device, and computer program product
US9984000B2 (en) Electronic device data distribution
KR20170036075A (en) Caching technologies employing data compression
US20140280387A1 (en) System and method for expanding storage space of network device
JP2018527681A (en) Data deduplication using a solid-state drive controller
US20170286293A1 (en) Wear leveling based on a swapping operation between sets of physical block addresses of a non-volatile memory
CN103955440A (en) Nonvolatile storage equipment and method of carrying out data manipulation therethrough
CN103714013A (en) Method and device for allocating storage space of file system
US20150227424A1 (en) Data storage device and data checking and correction for volatile memory
CN115756312A (en) Data access system, data access method, and storage medium
US20140219041A1 (en) Storage device and data processing method thereof
US9952771B1 (en) Method and system for choosing an optimal compression algorithm
US10289334B2 (en) Valid data merging method, memory controller and memory storage apparatus
WO2015154298A1 (en) Data processing method and apparatus
WO2016056290A1 (en) Memory controller, memory system, storage device, information processing system, and storage control method
TWI670599B (en) Memory management method and storage controller

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201480003909.0

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14888628

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14888628

Country of ref document: EP

Kind code of ref document: A1