CN111176561B - Memory writing method and device - Google Patents

Memory writing method and device Download PDF

Info

Publication number
CN111176561B
CN111176561B CN201911329230.1A CN201911329230A CN111176561B CN 111176561 B CN111176561 B CN 111176561B CN 201911329230 A CN201911329230 A CN 201911329230A CN 111176561 B CN111176561 B CN 111176561B
Authority
CN
China
Prior art keywords
data
writing
written
memory
grouping
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201911329230.1A
Other languages
Chinese (zh)
Other versions
CN111176561A (en
Inventor
崔海亮
张皓
马向超
吴瑞仁
王坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xin Yi Technology Co ltd
Original Assignee
Beijing Xin Yi Technology Co ltd
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 Beijing Xin Yi Technology Co ltd filed Critical Beijing Xin Yi Technology Co ltd
Priority to CN201911329230.1A priority Critical patent/CN111176561B/en
Publication of CN111176561A publication Critical patent/CN111176561A/en
Application granted granted Critical
Publication of CN111176561B publication Critical patent/CN111176561B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Read Only Memory (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a method and a device for writing into a memory, wherein the method comprises the following steps: determining a data writing requirement; grouping data according to the data writing requirements; packet data is written into the memory sequentially. According to the method, the proper data writing requirements are determined according to the data characteristics of the data to be written, and then the data to be written is dynamically grouped according to the data writing requirements, so that each group of grouped data contains as many data bits which are actually required to be written, the number of times of writing the data is reduced, the efficiency of writing the data is improved, and the time occupied by writing the data is shortened.

Description

Memory writing method and device
Technical Field
The present invention relates to the field of storage device technologies, and in particular, to a method and apparatus for writing into a memory
Background
Currently, when writing data into a memory, it is common to group the data to be written into the memory first, and then sequentially write each group of data into the memory by group.
In the related art, when data to be written is grouped, the data to be written is generally grouped according to the bits that can be written into the memory at most once, for example, if the memory is limited by the driving capability of the memory, and if the memory can write 4 bits of data at most once, and the data to be written is 32 bits, the data to be written needs to be divided into 8 groups, and each group of data is fixed to 4 bits.
However, the applicant finds that, since there may be a large number of invalid bits in the data to be written, when the data is written in groups according to the above data writing method, the number of data bits actually required to be written in each group of data is small, the number of required data writing times is large, the writing efficiency of the data is low, and the time period is long.
Disclosure of Invention
The present invention aims to solve at least one of the technical problems in the related art to some extent.
Therefore, a first object of the present invention is to provide a method for writing data into a memory, which determines a suitable data writing requirement according to the data characteristics of the data to be written, and dynamically groups the data to be written according to the data writing requirement, so that each group of data after grouping contains as many data bits actually required to be written as possible, thereby reducing the number of times of writing the data, improving the efficiency of writing the data, and shortening the time occupied by writing the data.
A second object of the present invention is to provide a writing device for a memory.
To achieve the above object, an embodiment of a first aspect of the present invention provides a method for writing into a memory, including:
determining a data writing requirement;
grouping data according to the data writing requirements;
packet data is written into the memory sequentially.
According to the writing method of the memory, firstly, the data writing requirement is determined, then the data is grouped according to the data writing requirement, and finally, the grouped data are sequentially written into the memory. According to the method, the proper data writing requirements are determined according to the data characteristics of the data to be written, the data to be written is dynamically grouped according to the data writing requirements, and each group of grouped data contains as many data bits which are actually required to be written, so that the number of times of writing the data is reduced, the efficiency of writing the data is improved, and the time occupied by writing the data is shortened.
In addition, the writing method of the memory according to the embodiment of the invention further includes the following additional technical features:
in one embodiment of the invention, determining the data write requirements includes: determining the number of data bits to be written each time and the corresponding grouping bit number; and determining the data writing requirement according to the number of data bits required to be written each time and the corresponding grouping bit number.
In one embodiment of the present invention, grouping data according to data write requirements includes: the data is grouped according to the number of data bits to be written each time and the corresponding grouping bits.
In one embodiment of the present invention, sequentially writing packet data into a memory includes: determining the number of writing times according to the number of the packets; determining the current target group data to be written according to the data bits to be written each time; and writing the target group data into the memory.
In one embodiment of the present invention, determining the data write requirements further comprises: determining the number of bits that the memory can write at most once; and determining the data writing requirement according to the bit number which can be written into the memory at most once.
In one embodiment of the present invention, grouping data according to the data writing requirement further includes: first grouping the data according to the bit number which can be written most once by the memory to obtain at least one first grouping data; and carrying out second grouping on the at least one first grouping data, and dividing each first grouping data into at least one second grouping data in sequence, so that each second grouping data contains at most one data bit number required to be written.
In one embodiment of the present invention, writing packet data into the memory sequentially further includes: sequentially selecting one second packet data from each first packet data, and forming each selected second packet data into the target packet data which needs to be written currently; and writing the target group data into the memory.
To achieve the above object, a second aspect of the present invention provides a writing device of a memory, including:
the determining module is used for determining the data writing requirement;
the grouping module is used for grouping the data according to the data writing requirements;
and the writing module is used for sequentially writing the packet data into the memory.
The writing device of the memory of the embodiment of the invention firstly determines the data writing requirement, then groups the data according to the data writing requirement, and finally writes the grouped data into the memory in sequence. The device determines proper data writing requirements according to the data characteristics of the data to be written, dynamically groups the data to be written according to the data writing requirements, and makes each group of data after grouping contain as many data bits which are actually required to be written as possible, thereby reducing the number of times of writing the data, improving the efficiency of writing the data and shortening the time occupied by writing the data.
In addition, the writing device of the memory of the embodiment of the invention further comprises the following additional technical characteristics:
in one embodiment of the present invention, the determining module is configured to determine the number of data bits to be written each time and the corresponding number of packet bits, and determine the data writing requirement according to the number of data bits to be written each time and the corresponding number of packet bits.
In one embodiment of the invention, the grouping module is configured to group the data according to the number of data bits to be written each time and the corresponding number of grouping bits.
In one embodiment of the present invention, the writing module is configured to determine the number of writing times according to the number of packets, determine the target group data that needs to be written currently according to the data bits that need to be written each time, and write the target group data into the memory.
In one embodiment of the invention, the determining module is further configured to: and determining the bit number which can be written to the memory at most once, and determining the data writing requirement according to the bit number which can be written to the memory at most once.
In one embodiment of the invention, the grouping module is further configured to: first grouping the data according to the bit number which can be written most once by the memory to obtain at least one first grouping data; and carrying out second grouping on the at least one first grouping data, and dividing each first grouping data into at least one second grouping data in sequence, so that each second grouping data contains at most one data bit number required to be written.
In one embodiment of the invention, the writing module is further configured to: sequentially selecting one second packet data from each first packet data, and forming each selected second packet data into the target packet data which needs to be written currently; and writing the target group data into the memory.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings, in which:
FIG. 1 is a flow chart of a method for writing into a memory according to an embodiment of the invention;
FIG. 2 is a flowchart of a specific memory writing method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a writing device of a memory according to an embodiment of the invention.
Detailed Description
Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative and intended to explain the present invention and should not be construed as limiting the invention.
The embodiment of the invention mainly aims at the technical problems that in the related art, when data are written into a memory group by a fixed group mode, the number of groups of the data to be written is large, the number of bits actually needed to be written in each group of data is small because the data to be written possibly have a large number of invalid bits, so that the needed data writing times are large, and the data writing efficiency is low.
For example, if the data to be written is 16-bit data: 1010_0000_0001_0110 if the driving capability of the memory can write 2 bits of data at a time, the data to be written needs to be divided into 8 groups, namely (bit 0, bit 1) as a first group, (bit 2, bit 3) as a second group, and so on. And because the bit with the data value of 0 is an invalid bit, no writing operation is needed, the number of bits actually needed to be written in each group of data is only 1bit, and the writing operation needed to be performed for the data is as follows: first write bit1 (bit 0 is 0, no write is required), second write bit2 (bit 3 is 0, no write is required), third write bit4 (bit 5 is 0, no write is required), fourth write bit13 (bit 12 is 0, no write is required), fifth write bit15 (bit 14 is 0, no write is required). Therefore, the data needs to be written into the memory after 5 writing operations, so that the writing efficiency of the data is low and the time is long. Therefore, there is a need for improvements in the memory writing methods of the prior art.
The writing method of the memory and the writing device of the memory according to the embodiments of the present invention are described below with reference to the drawings.
Fig. 1 is a flowchart of a method for writing into a memory according to an embodiment of the present invention.
As shown in fig. 1, the writing method of the memory includes:
step 101, determining a data writing requirement.
Step 102, grouping the data according to the data writing requirements.
Step 103, writing the packet data into the memory in turn.
Specifically, the data writing requirement is a data writing manner when writing the current data to be written into the memory with higher efficiency, and the data writing requirement may include a manner of grouping the current data to be written, a manner of determining the grouped data, and the like. Furthermore, the data are dynamically grouped according to the data writing requirements, the total bit number of each grouped data after grouping can be different, and each grouped data contains the data bit number which is actually required to be written as much as possible, so that the number of the grouped data is reduced, then the grouped data are sequentially written into the memory, and the number of times of writing the data into the memory is reduced.
Therefore, the writing method of the memory dynamically groups the data, so that each group of grouped data contains as many data bits which are actually required to be written, the writing times of the data are reduced, and the data writing efficiency is improved.
In order to more clearly describe the writing method of the memory according to the embodiment of the present invention, the method will be described in detail below.
Specifically, the data writing requirements may be determined according to the data structure of the data to be written.
As a first possible implementation manner, the number of data bits required to be written each time when writing data into the memory and the corresponding grouping bit number may be determined according to the total number of data bits of the data to be written, the number of valid bits (i.e., the number of data bits actually required to be written), the number of invalid bits, the positional relationship between each valid bit and invalid bit, and the bit that can be written at most once by the memory.
The number of data bits to be written each time is the number of data bits actually written to the memory each time, namely the number of valid data bits in the data written to the memory, and the number of data bits to be written each time can be equal to or smaller than the number of bits which can be written into the memory at one time and can be allowed to be written into the memory at the maximum, so that the valid data can be written into the memory at the maximum driving capability, and the data writing efficiency is improved. The grouping bit number corresponding to the data bit number required to be written each time is the total bit number of the group of data when one group of data is written into the memory each time, namely the bit width of the group of data, and the grouping bit number comprises a valid bit number and an invalid bit number.
Specifically, the number of bits of data to be written each time is first determined according to the bits that can be written at most once in the memory and the number of valid bits of the data to be written. When the current remaining valid bit number in the data is larger than the bit number of the memory which can be written once, taking the bit number of the memory which can be written once as the data bit number which needs to be written once, subtracting the bit number of the memory which can be written once from the current remaining valid bit number in the data until the remaining valid bit number in the data is smaller than the bit number of the memory which can be written once, and when the remaining valid bit number in the data is not 0, taking the remaining valid bit number in the data as the data bit number which needs to be written once last time.
Further, the number of grouping bits corresponding to the number of data bits to be written each time is determined according to the number of data bits to be written each time, the total number of data bits of the data to be written, and the positional relationship between each valid bit and invalid bit. In specific implementation, according to the principle that the grouping bit number is larger than or equal to the corresponding data bit number required to be written each time, and the effective bit number in the grouping bit number is equal to the corresponding data bit number required to be written each time, all the grouping bit numbers are determined in sequence from bit0 of the data. That is, if the mth bit of the data is reached after the last determination of the number of packets and the number of data bits to be written at this time is k, the valid bit is searched from m+1 bits, and when the kth valid bit is searched, the number of bits at this time is recorded as the nth bit, the number of packet bits corresponding to the number of data bits to be written at this time may be (n-m) bits.
It should be noted that, since the invalid bit in the data may be divided into any one of the two adjacent packets, the number of packet bits corresponding to the number of data bits to be written each time is not fixed, so the number of packet bits corresponding to the number of data bits to be written each time may be determined according to the actual need on the basis of ensuring that the number of packet bits is greater than or equal to the corresponding number of data bits to be written each time and the valid bit in the number of packet bits is equal to the corresponding number of data bits to be written each time. For example, with continued reference to 16-bit data in the above example: 1010_0000_0001_0110, if the number of data bits to be written for the first time is 2, the invalid bit3 may be divided into the first group and the second group, so that the number of packet bits corresponding to the number of data bits to be written for the first time may be 3 or 4, and may be determined according to a preset invalid bit division principle when implementing.
Therefore, the data writing requirement is determined according to the number of data bits required to be written each time and the corresponding grouping bit number, so that the data to be written can be conveniently grouped later.
Further, when grouping data according to the determined data writing requirement, as a possible implementation manner, with continued reference to the above example, if the determined data writing requirement includes a number of data bits to be written to each time when writing data to the memory and a corresponding grouping bit number, the data is grouped according to the number of data bits to be written each time and the corresponding grouping bit number.
Specifically, starting from bit0 at the right end of the data, determining the number of data bits included in the first group of data according to the grouping bit number corresponding to the number of data bits required to be written for the first time, and forming the first group of data by the data in the number of data bits, where the first group of data includes the corresponding number of data bits required to be written for the first time, for example, continuing to refer to 16-bit data in the above example: 1010_0000_0001_0110, if the number of data bits to be written for the first time is determined to be 2, and the number of grouping bits corresponding to the number of data bits to be written for the first time is determined to be 3, the first group of data is formed by data '110' on bits 0 to 2. Further, starting from the next bit of the last bit of the first group of data, determining the number of data bits contained in the second group of data according to the grouping number corresponding to the number of data bits required to be written for the second time, forming the second group of data by the data in the number of data bits, and so on, grouping the data to be written.
Therefore, the grouping method dynamically groups according to the data structure, the grouping bit number of each group of data can be different, and each group of data contains the valid bit number as much as possible.
Further, since each group of data is formed after grouping the data to be written, the sequence of each group of data corresponds to the sequence of the data to be written each time, and each group of data is sequentially written into the memory according to the sequence of each group of data.
In implementation, as a possible implementation manner, the number of writing times is first determined according to the number of packets, for example, if the data is divided into four groups, the data is written into the memory four times. And then, determining the target group data to be written currently according to the grouping data to be written each time, namely taking the first group data after grouping as the target group data to be written for the first time, taking the second group data as the target group data to be written for the second time, and so on, sequentially determining the target data to be written each time, and further sequentially writing the determined target group data into a memory.
Therefore, as each target group data contains a large number of significant digits, compared with the mode of writing data into the memory according to fixed groups, the number of times of writing data into the memory is reduced, so that the efficiency of writing data into the memory is improved, and the time consumed by writing data into the memory is reduced.
It should be noted that, in practical applications, data actually written into the memory may not coincide with a data value of data to be written, which is dynamically grouped. As an example, the data value of the packet data after the data is packetized may represent the meaning of whether the data on the data bit needs to be modified, for example, when the current packet data is 0101, instead of representing that the data is actually written to the memory, the data in the packet data being "1" indicates that the data on the location needs to be modified, the data being "0" indicates that the data on the location does not need to be written, i.e., the current packet data 0101 indicates that the data on bit0 and bit2 need to be written to the memory, and those bits that are 0, i.e., bit1/3, do not need to be operated, and specifically the data values on the ingress bit0 and bit2 written to the memory may be determined according to whether the write 1 operation or the write 0 operation is currently performed. Thus, in some embodiments of the present invention, when packet data is written into the memory sequentially, data to be written, which is represented by the packet data, may also be written into the memory according to the values at each location of the packet data and the current writing operation state.
For example, when the memory originally stores 4 bits of data "1101", if the data "0110" needs to be written, when the operation of writing 1 is performed first, the data which needs to be written 1 but is 0 in the memory is compared, so as to generate 4 bits of data "0010", which is the data for determining the writing requirement in step 101, then the generated data is dynamically grouped according to the method in the step, when the number of bits of the memory which can be written once maximally is 2, the grouped grouping data is determined to be "0010", and then when "0010" is written into the memory, 1 is written onto bit 1. Similarly, during the write 0 operation, the generated data is 1001, then the generated data is dynamically grouped according to the method in the above step, the grouped data is determined to be "1001", and then when "1001" is written into the memory, 0 is written onto bit0 and bit 3.
In addition, it should be noted that the first possible implementation manner is only an example, and the writing method of the memory of the present invention may be implemented by other methods.
As a second possible implementation manner, when determining a data writing requirement according to a data structure of data to be written, determining the number of data bits required to be written each time, then determining the corresponding number of packet bits according to the number of data bits required to be written for the first time from the lowest bit of the data, making the number of packet bits equal to the number of data bits between the last valid data and the first valid data in the valid data required to be written for the first time, dividing the data into first packet data and residual data, and then writing the first packet data into a memory. Then, starting from the lowest bit of the rest data, determining other group data in turn, and after writing the determined group data into the memory, determining the next group data until the highest bit of the data.
That is, first, it is determined that the most significant bit number is n bits each time, 1 is found from the lowest bit to the higher bit (i.e., the significant bit) of the data when the write operation is performed; when the kth bit in the data is found, if the number of 1 reaches n, namely the valid bit required to be written for the first time is satisfied, no search is performed, and then the data of bitk-bit0 are written into a memory; then, continuing to determine the next group of data, and writing the data into a memory every time n 1 s are found; when the highest bit of the data is found, the searching is stopped, and the last group of fraction data is written into the memory until all the data to be written are written.
According to the method for writing the memory, the corresponding grouping bit number is determined according to the data bit number required to be written each time, then the data is divided into the current grouping data to be written and the residual data according to the grouping bit number, the current grouping data to be written is used as target grouping data to be written into the memory, then the next grouping data required to be written is divided from the residual data and written, and therefore grouping of the data according to the data writing requirements is achieved, and the grouping data are sequentially written into the memory. Therefore, the method also realizes that each target group data contains more effective digits, reduces the number of times of writing data into the memory compared with the mode of writing data into the memory according to fixed groups, and improves the efficiency of writing data into the memory.
In summary, in the method for writing a memory according to the embodiment of the present invention, the data writing requirement is first determined, then the data is grouped according to the data writing requirement, and finally the grouped data is sequentially written into the memory. According to the method, the proper data writing requirements are determined according to the data characteristics of the data to be written, and then the data are dynamically grouped according to the data writing requirements, so that each group of grouped data contains as many data bits which are actually required to be written, the number of times of writing the data is reduced, the efficiency of writing the data is improved, and the time occupied by writing the data is shortened.
Based on the above embodiment, in practical application, in order to make the physical positions of the storage units written in the memory more uniform, the invention also provides a specific memory writing method.
Fig. 2 is a flowchart of a specific memory writing method according to an embodiment of the present invention. As shown in fig. 2, the method includes:
in step 201, the number of bits that can be written to the memory at most once is determined, and the data is grouped for the first time according to the number of bits that can be written to the memory at most once, so as to obtain a plurality of first group data.
Specifically, after determining the number of bits that can be written most once in the memory according to the system driving capability of the memory, when the data is grouped for the first time, the data can be grouped fixedly according to the number of bits that can be written most once in the memory, so that the grouping number of bits of each first grouping data after grouping is consistent, for example, if the number of bits of the data is N and the number of bits that can be written most once in the memory is K, the bit width of each first grouping data is N/K. Thus, the data is uniformly divided into a plurality of first packet data from the lower bits to the upper bits of the data.
Step 202, performing a second grouping on each first grouping data, and dividing each first grouping data into a plurality of second grouping data, so that each second grouping data contains at most one bit of data bit to be written.
Specifically, each generated first packet data is subjected to a second grouping, wherein when the second grouping is performed, each first packet data can be divided into a plurality of second packet data in turn according to the principle of limiting the number of data bits (namely the number of valid bits) required to be written into each second packet data to be only one bit at most, and the sum of the number of valid bits which can be written into each second packet data corresponding to each first packet data is equal to the number of bits which can be written into the memory at most.
For example, if the number of bits that can be written at most once is 4 bits, after dividing the 32-bit data into 4 groups of first packet data according to the number of bits that can be written at most once, each first packet data may be divided into multiple second packet data, where the order of each second packet data may correspond to the order of dividing, or may be set according to the actual writing requirement, and each second packet data only writes at most 1bit of data at most, i.e. each second packet data only contains at most one bit of data that needs to be written actually, so that when the corresponding 4 groups of second packet data are selected in order in the first packet data, the sum of the number of bits that need to be written and contained in the selected 4 groups of second packet data is equal to the number of bits that can be written at most once, i.e. 4 bits.
Step 203, sequentially selecting a second packet data from each first packet data, forming each selected second packet data into the target packet data to be written currently, and writing the target packet data into the memory.
Specifically, after each first packet data is divided into corresponding second packet data, each second packet data corresponding to the current writing times is sequentially selected from the first packet data according to the sequence of the second packet data, and each selected second packet data is formed into target packet data which needs to be written into a memory at present. In the process of writing data, all the selected second packet data are written into the memory at one time, and the sum of the valid bit numbers contained in the second packet data is equal to the bit number which can be written into the memory at most once, so that the actual written data bit number is equal to the stored data bit number which can be written into the memory at one time, thereby maximizing the actual written data bit number at each time and improving the data writing efficiency.
In addition, when the data is grouped for the second time, the number of the second grouping data and the maximum writable valid bit number of the second grouping data can be set according to the requirement, so that the position of writing the data into the memory can be controlled, and the writing storage unit is more uniform in physical position.
In summary, the memory writing method of the embodiment not only improves the data writing efficiency and speeds up the data writing speed, but also can control the position of writing data into the memory and improve the uniformity of the written memory cells in the physical position of the memory.
In order to more clearly describe the specific implementation process of the memory writing method according to the embodiment of the present invention, two specific embodiments are described below.
When the data to be written is 32-bit data: when 0100_1010_0101_1111_1000_1101_0001_1001, it is first known from the data structure that the data includes 16 significant bits, and the positional relationship between each significant bit and each invalid bit is as described above.
When the number of bits of the memory that is the maximum allowable write at a time is 4, the number of data bits required to be written at a time is determined to be 4. Further, if each group of data after grouping is made to contain the same 4-bit valid data, the grouping corresponding to each written data can be determined from bit0 according to the positional relationship between each valid bit and invalid bit as shown in table 1.
TABLE 1
Data to be written 0100_1010_0101_1111_1000_1101_0001_1001
First group of 1_0001_1001
Second group of 1_1000_110
Third group of 1_111
Fourth group 100_1010_010
As can be seen from table 1, if each group of data after grouping is made to contain four bits of valid data, the data needs to be divided into four groups, and the data is written into the memory by four write operations. According to the fixed packet data writing method in the prior art, the data is required to be divided into 8 groups and written through 8 writing operations, so that compared with the writing method in the prior art, the writing method of the memory in the embodiment of the invention reduces 4 writing operations and improves the writing efficiency of the data.
With continued reference to the first example above, when the data to be written is 16-bit data in the example above: when the driving capability of the memory is written with 2 bits of data at a maximum, the data structure firstly indicates that the data contains 5 bits of significant bit, and if the number of bits of data to be written is 2 each time, the number of bits of data to be written in the previous two times is 2 and the number of bits of data to be written in the last time is the remaining 1 bits of significant bit, which is indicated by dividing 5 by 2 and being equal to more than 2 and 1. Further, the packet corresponding to each written data is determined from bit0 according to the positional relationship between each significant bit and each invalid bit as shown in table 2.
TABLE 2
Data to be written 1010_0000_0001_0110
First group of 0110
Second group of 10_0000_0001
Third group of 10
As can be seen from table 1, the data needs to be divided into three groups, and can be written into the memory by 3 write operations. Therefore, compared with the writing method in the prior art, the writing method of the memory provided by the embodiment of the invention reduces 2 writing operations, improves the writing efficiency of data, and saves the time consumed by data writing.
In order to achieve the above embodiments, the embodiments of the present invention further provide a writing device of a memory. Fig. 3 is a schematic diagram of a writing device of a memory according to an embodiment of the invention. As shown in fig. 3, the writing device of the memory includes: a determination module 100, a grouping module 200 and a writing module 300.
The determining module 100 is configured to determine a data writing requirement.
The grouping module 200 is configured to group data according to a data writing requirement.
A writing module 300 for sequentially writing the packet data into the memory.
Specifically, in one possible implementation manner of the embodiment of the present invention, the determining module 100 is specifically configured to determine the number of data bits to be written each time and the corresponding number of packet bits, and determine the data writing requirement according to the number of data bits to be written each time and the corresponding number of packet bits.
Further, in one embodiment of the present invention, the grouping module 200 is specifically configured to group data according to the number of data bits required to be written each time and the corresponding number of grouping bits.
Further, in one embodiment of the present invention, the writing module 300 is specifically configured to determine the number of writing times according to the number of packets, determine the target set of data that needs to be written currently according to the number of data bits that need to be written each time, and write the target set of data into the memory.
In one embodiment of the present invention, the determining module is further configured to determine a number of bits that can be written to by the memory at most once, and determine the data writing requirement according to the number of bits that can be written to by the memory at most once.
Further, in one embodiment of the present invention, the grouping module is further configured to: and carrying out first grouping on the data according to the bit number which can be written at most once of the memory to obtain at least one first grouping data, then carrying out second grouping on the at least one first grouping data, and dividing each first grouping data into at least one second grouping data in turn, so that each second grouping data contains at most one bit of data bit number required to be written.
Still further, in one embodiment of the present invention, the writing module is further configured to: and sequentially selecting one second packet data from each first packet data, forming each selected second packet data into the target packet data which needs to be written currently, and writing the target packet data into a memory.
It should be noted that the explanation of the embodiment of the writing method for the memory is also applicable to the writing device for the memory of this embodiment, and thus will not be repeated here.
In summary, the writing device of the memory according to the embodiment of the present invention determines the data writing requirement first, then groups the data according to the data writing requirement, and finally writes the grouped data into the memory sequentially. The device determines proper data writing requirements according to the data characteristics of the data to be written, and further dynamically groups the data to be written according to the data writing requirements, so that each group of grouped data contains as many data bits which are actually required to be written as possible, the number of times of writing the data is reduced, the efficiency of writing the data is improved, and the time occupied by writing the data is shortened.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present invention, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and additional implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order from that shown or discussed, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiments of the present invention.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). In addition, the computer readable medium may even be paper or other suitable medium on which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. As with the other embodiments, if implemented in hardware, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
Those of ordinary skill in the art will appreciate that all or a portion of the steps carried out in the method of the above-described embodiments may be implemented by a program to instruct related hardware, where the program may be stored in a computer readable storage medium, and where the program, when executed, includes one or a combination of the steps of the method embodiments.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing module, or each unit may exist alone physically, or two or more units may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules may also be stored in a computer readable storage medium if implemented in the form of software functional modules and sold or used as a stand-alone product.
The above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, or the like. While embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the invention, and that variations, modifications, alternatives and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the invention.

Claims (10)

1. A method for writing to a memory, comprising:
determining a data writing requirement, wherein the number of data bits required to be written each time and the corresponding grouping bit number are determined according to the total number of data bits, the number of valid bits, the number of invalid bits, the position relation between each valid bit and invalid bit of data to be written and the bit which can be written into the memory at most once;
grouping the data according to the data writing requirements;
and writing packet data into the memory in turn.
2. The method of writing to a memory of claim 1, wherein said grouping data according to said data writing requirements comprises:
the data is grouped according to the number of data bits to be written each time and the corresponding grouping bits.
3. The method of writing to a memory according to claim 1, wherein the sequentially writing packet data to the memory comprises:
determining the number of writing times according to the number of the packets;
determining target group data to be written currently according to the group data to be written each time;
and writing the target group data into the memory.
4. The method of writing to a memory of claim 1, wherein said grouping data according to said data writing requirements further comprises:
first grouping the data according to the bit number which can be written most once by the memory to obtain at least one first grouping data;
and carrying out second grouping on the at least one first grouping data, and dividing each first grouping data into at least one second grouping data in sequence, so that each second grouping data contains at most one data bit number required to be written.
5. The method of writing to a memory according to claim 4, wherein the sequentially writing packet data to the memory further comprises:
sequentially selecting one second packet data from each first packet data, and forming each selected second packet data into target packet data to be written currently;
and writing the target group data into the memory.
6. A writing device of a memory, comprising:
the determining module is used for determining the data writing requirement, wherein the number of data bits required to be written each time and the corresponding grouping bit number are determined according to the total number of data bits, the number of valid bits, the number of invalid bits, the position relation between each valid bit and each invalid bit of the data to be written and the bit which can be written by the memory at most once;
the grouping module is used for grouping the data according to the data writing requirements;
and the writing module is used for sequentially writing the packet data into the memory.
7. The memory writing apparatus of claim 6, wherein the grouping module is configured to group data according to a number of data bits to be written each time and a corresponding number of grouping bits.
8. The writing device of claim 7, wherein the writing module is configured to determine the number of writing times according to the number of packets, determine the target group data currently required to be written according to the packet data required to be written each time, and write the target group data into the memory.
9. The memory writing apparatus of claim 6, wherein the grouping module is further configured to:
first grouping the data according to the bit number which can be written most once by the memory to obtain at least one first grouping data;
and carrying out second grouping on the at least one first grouping data, and dividing each first grouping data into at least one second grouping data in sequence, so that each second grouping data contains at most one data bit number required to be written.
10. The memory writing apparatus of claim 9, wherein the writing module is further configured to:
sequentially selecting one second packet data from each first packet data, and forming each selected second packet data into target packet data to be written currently;
and writing the target group data into the memory.
CN201911329230.1A 2019-12-20 2019-12-20 Memory writing method and device Active CN111176561B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911329230.1A CN111176561B (en) 2019-12-20 2019-12-20 Memory writing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911329230.1A CN111176561B (en) 2019-12-20 2019-12-20 Memory writing method and device

Publications (2)

Publication Number Publication Date
CN111176561A CN111176561A (en) 2020-05-19
CN111176561B true CN111176561B (en) 2024-02-06

Family

ID=70648878

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911329230.1A Active CN111176561B (en) 2019-12-20 2019-12-20 Memory writing method and device

Country Status (1)

Country Link
CN (1) CN111176561B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005157781A (en) * 2003-11-26 2005-06-16 Sony Corp Information processor and information processing method
CN102457283A (en) * 2010-10-28 2012-05-16 阿里巴巴集团控股有限公司 Data compression and decompression method and equipment
CN106406756A (en) * 2016-09-05 2017-02-15 华为技术有限公司 Space allocation method of file system, and apparatuses
CN108196799A (en) * 2013-11-22 2018-06-22 华为技术有限公司 The wiring method and writing station of storage device
CN110096228A (en) * 2019-03-29 2019-08-06 联想(北京)有限公司 Date storage method, data storage device and data-storage system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005157781A (en) * 2003-11-26 2005-06-16 Sony Corp Information processor and information processing method
CN102457283A (en) * 2010-10-28 2012-05-16 阿里巴巴集团控股有限公司 Data compression and decompression method and equipment
CN108196799A (en) * 2013-11-22 2018-06-22 华为技术有限公司 The wiring method and writing station of storage device
CN106406756A (en) * 2016-09-05 2017-02-15 华为技术有限公司 Space allocation method of file system, and apparatuses
CN110096228A (en) * 2019-03-29 2019-08-06 联想(北京)有限公司 Date storage method, data storage device and data-storage system

Also Published As

Publication number Publication date
CN111176561A (en) 2020-05-19

Similar Documents

Publication Publication Date Title
US11086529B2 (en) Data storage systems and methods for improved data relocation based on read-level voltages associated with error recovery
US7882300B2 (en) Apparatus and method for managing nonvolatile memory
US20210327504A1 (en) Multi-Level Cell Programming Using Optimized Multiphase Mapping with Balanced Gray Code
JP3347015B2 (en) Adaptive localization method and apparatus for frequently accessed and randomly addressed data
US8493782B2 (en) Memory device and program method thereof
JP4686358B2 (en) Control device with flash memory
KR100699062B1 (en) Disk Drive Controller Circuit and Method for Skipping Defective and/or Undesired Sectors
CN112289360B (en) Read retry threshold voltage selection
US20050162947A1 (en) Data management apparatus and method of flash memory
JP2021061028A (en) System, method, and device for user configurable wear leveling of non-volatile memory
EP2713519A1 (en) Electronic counter in non-volatile limited endurance memory
WO2009053963A2 (en) Methods for adaptively programming flash memory devices and flash memory systems incorporating same
US9569114B2 (en) Deduplication using a master and a slave
KR101996072B1 (en) Wear management for flash memory devices
US20120246394A1 (en) Flash Memory Device and Data Writing Method for a Flash Memory
US10445232B2 (en) Determining control states for address mapping in non-volatile memories
US20170177470A1 (en) Access network for address mapping in non-volatile memories
US20150095595A1 (en) Configurable spreading function for memory interleaving
CN1236386C (en) Storing device, storing control method and program
CN107918524A (en) Data storage device and data maintenance method
US8345370B2 (en) Magnetic disk drive and refresh method for the same
CN114415972A (en) Data processing method and device of SSD, storage medium and SSD device
US9921969B2 (en) Generation of random address mapping in non-volatile memories using local and global interleaving
CN112306397A (en) Memory controller, memory system including the same, and method of operating the same
CN111176561B (en) Memory writing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant