CN111176561A - Writing method and device of memory - Google Patents

Writing method and device of memory Download PDF

Info

Publication number
CN111176561A
CN111176561A CN201911329230.1A CN201911329230A CN111176561A CN 111176561 A CN111176561 A CN 111176561A CN 201911329230 A CN201911329230 A CN 201911329230A CN 111176561 A CN111176561 A CN 111176561A
Authority
CN
China
Prior art keywords
data
writing
written
memory
time
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.)
Granted
Application number
CN201911329230.1A
Other languages
Chinese (zh)
Other versions
CN111176561B (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

Images

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 writing method and a device of a memory, wherein the method comprises the following steps: determining data writing requirements; grouping the data according to the data writing requirements; the packet data is written into the memory in sequence. The method determines the suitable data writing requirements according to the data characteristics of the data to be written, and then dynamically groups the data to be written according to the data writing requirements, so that each group of grouped data contains the number of data bits which need to be written actually as much as possible, thereby reducing the data writing times, improving the data writing efficiency and shortening the time occupied by data writing.

Description

Writing method and device of memory
Technical Field
The present invention relates to the field of storage device technologies, and in particular, to a method and an apparatus for writing in a memory
Background
At present, when data is written into a memory, data to be written is generally grouped first, and then each group of data is written into the memory sequentially according to the group.
In the related art, when grouping data to be written, generally, data to be written is fixedly grouped according to bits that can be written by the memory at most once, for example, due to the limitation of memory driving capability, if the memory can write 4-bit 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 be 4-bit.
However, the applicant finds that, since the data to be written may have a large number of invalid bits, 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 data writing times required is large, the data writing efficiency is low, and the time consumption is long.
Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the related art.
Therefore, a first object of the present invention is to provide a method for writing in a memory, which determines a suitable data writing requirement according to data characteristics of data to be written, and further dynamically groups the data to be written according to the data writing requirement, so that each group of grouped data contains data bits actually required to be written as many as possible, thereby reducing the number of times of writing in the data, improving the efficiency of writing in the data, and shortening the time occupied by writing in the data.
The second objective of the present invention is to provide a writing device for a memory.
In order 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 data writing requirements;
grouping the data according to the data writing requirements;
the packet data is written into the memory in sequence.
The writing method 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 method determines a suitable data writing requirement according to the data characteristics of the data to be written, dynamically groups the data to be written according to the data writing requirement, and enables each group of grouped data to contain data digits needing to be written as much as possible, thereby reducing the data writing times, improving the data writing efficiency and shortening the time occupied by data writing.
In addition, the writing method of the memory according to the embodiment of the present invention further includes the following additional technical features:
in one embodiment of the present invention, determining a data write request comprises: determining the number of data bits required to be written in each time and the corresponding grouping bits; and determining the data writing requirement according to the number of the data bits required to be written each time and the corresponding grouping bits.
In one embodiment of the present invention, grouping data according to data writing requirements includes: and grouping the data according to the number of data bits required to be written each time and the corresponding grouping bits.
In one embodiment of the present invention, writing packet data into a memory in sequence comprises: determining the number of writing times according to the number of groups; determining the current target group data needing to be written according to the data bit needing to be written each time; writing the target group data to the memory.
In an embodiment of the present invention, determining the data writing requirement further includes: determining the number of bits of the memory which can be written at most at one time; and determining the data writing requirement according to the bit number which can be written in the memory at most at one time.
In an embodiment of the present invention, grouping data according to the data writing requirement further includes: grouping the data for the first time according to the most writable bit number at one time of the memory to obtain at least one first grouped data; and performing second grouping on the at least one first grouped data, and sequentially dividing each first grouped data into at least one second grouped data, so that each second grouped data at most comprises one data bit number required to be written.
In an embodiment of the present invention, writing packet data into the memory sequentially further includes: selecting a second grouped data from each first grouped data in sequence, and forming each selected second grouped data into the target grouped data which needs to be written currently; writing the target group data to the memory.
In order to achieve the above object, a second embodiment of the present invention provides a writing apparatus for a memory, including:
the determining module is used for determining data writing requirements;
the grouping module is used for grouping the data according to the data writing requirement;
and the writing module is used for writing the grouped data into the memory in sequence.
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 a suitable data writing requirement according to the data characteristics of the data to be written, dynamically groups the data to be written according to the data writing requirement, and enables each group of grouped data to contain data digits needing to be written as much as possible, thereby reducing the writing times of the data, improving the data writing efficiency and shortening the time occupied by data writing.
In addition, the writing device of the memory in the embodiment of the present invention further includes the following additional technical features:
in one embodiment of the invention, the determining module is configured to determine the number of data bits required to be written each time and the corresponding number of grouped bits, and determine the data writing requirement according to the number of data bits required to be written each time and the corresponding number of grouped bits.
In one embodiment of the invention, the grouping module is used for grouping the data according to the number of data bits required to be written each time and the corresponding number of grouping bits.
In one embodiment of the invention, the writing module is used for determining the writing times according to the grouping number, determining the target group data which needs to be written currently according to the data bit which needs to be written each time, and writing the target group data into the memory.
In one embodiment of the invention, the determining module is further configured to: determining the bit number which can be written in the memory at most at one time, and determining the data writing requirement according to the bit number which can be written in the memory at most at one time.
In one embodiment of the invention, the grouping module is further configured to: grouping the data for the first time according to the most writable bit number at one time of the memory to obtain at least one first grouped data; and performing second grouping on the at least one first grouped data, and sequentially dividing each first grouped data into at least one second grouped data, so that each second grouped data at most comprises one data bit number required to be written.
In one embodiment of the present invention, the write module is further configured to: selecting a second grouped data from each first grouped data in sequence, and forming each selected second grouped data into the target grouped data which needs to be written currently; writing the target group data to 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 present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a flow chart illustrating a method for writing into a memory according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for writing to a memory according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a writing apparatus of a memory according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
The embodiment of the invention mainly aims at the technical problems that in the related technology, when data are written into a memory in groups in a fixed grouping mode, the number of the groups of the data to be written is more due to the fact that the data to be written possibly have more invalid bit numbers, and the number of bits actually required to be written in each group of data is less, so that the required data writing times are more, and the data writing efficiency is lower.
For example, if the data to be written is 16 bits of data: 1010_0000_0001_0110, if the maximum allowable write-in capacity of the memory is 2-bit data at a time, the data to be written needs to be divided into 8 groups, that is, (bit0, bit1) is the first group, (bit2, bit3) is the second group, and so on. And because the bit of the data value 0 is an invalid bit, no write operation is required, the number of bits actually required to be written in each group of data is only 1bit, and the write operation required to be performed on the data is as follows: bit1 is written for the first time (bit0 is 0, no write is needed), bit2 is written for the second time (bit3 is 0, no write is needed), bit4 is written for the third time (bit5 is 0, no write is needed), bit13 is written for the fourth time (bit12 is 0, no write is needed), and bit15 is written for the fifth time (bit14 is 0, no write is needed). Therefore, the data on the valid bit can be written into the memory only by 5 write operations, which is inefficient and takes a long time. Therefore, there is a need for an improvement to the memory writing methods in the prior art.
A writing method of a memory and a writing apparatus of a memory according to an embodiment of the present invention are described below with reference to the drawings.
Fig. 1 is a flowchart illustrating 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 data writing requirements.
And 102, grouping the data according to the data writing requirement.
And 103, writing the grouped data into the memory in sequence.
Specifically, the data writing requirement is a data writing manner when the current data to be written is 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 grouped data, and the like. Furthermore, the data is dynamically grouped according to the data writing requirement, the total number of bits of each grouped data can be different after grouping, each grouped data comprises the number of data bits which need to be written actually as much as possible, thereby reducing the number of the grouped data, and then the grouped data is written into the memory in sequence, thereby reducing the number of times of writing the data into the memory.
Therefore, the writing method of the memory provided by the embodiment of the invention dynamically groups the data, so that each group of grouped data contains the data bits needing to be written as much as possible, thereby reducing the writing times of the data and improving the data writing efficiency.
In order to more clearly describe the writing method of the memory according to the embodiment of the present invention, the method is described in detail below.
Specifically, the data writing requirement may be determined according to a data structure of the data to be written.
As a first possible implementation manner, the number of data bits to be written and the corresponding grouping number of bits may be determined according to the total number of data bits of the data to be written, the number of significant bits (i.e. the number of data bits that actually need to be written), the number of invalid bits, the position relationship between each significant bit and each invalid bit, and the bits that can be written by the memory at most at one time.
The number of data bits required to be written in each time is the number of data bits actually written in the memory each time, namely the number of effective data bits in the data written in the memory, and the number of data bits required to be written in each time can be equal to or less than the maximum allowable number of bits written in the memory at one time, so that the effective data can be written in the memory at the maximum driving capacity, and the data writing efficiency is improved. The number of grouped bits corresponding to the number of data bits to be written each time is the total number of bits of a group of data, namely the bit width of the group of data, when the group of data is written into the memory, and the number of grouped bits includes a valid bit number and an invalid bit number.
Specifically, the number of data bits to be written at each time is determined according to the most writable bits at one time of the memory and the significant digit of the data to be written. When the current remaining effective digit in the data is larger than the maximum allowable bit number of the memory, the maximum allowable bit number of the memory at one time is used as the data bit number required to be written at the time, the maximum allowable bit number of the memory at one time is subtracted from the current remaining effective digit in the data until the remaining effective digit in the data is smaller than the maximum allowable bit number of the memory at one time, and when the remaining effective digit in the data is not 0, the remaining effective digit in the data is used as the data bit number required to be written at the last time.
And further, determining the grouping bit number corresponding to the data bit number required to be written each time according to the data bit number required to be written each time, the total data bit number of the data to be written and the position relation between each effective bit and each ineffective bit. In specific implementation, each grouping bit number is determined in turn from the bit0 of the data according to the principle that the grouping bit number should be greater than or equal to the corresponding data bit number required to be written each time and the significant bit number in the grouping bit number is equal to the corresponding data bit number required to be written each time. That is, if the m-th bit of the data is reached after the number of packets is determined last time, 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 k-th valid bit is searched, the number of bits at this time is recorded as the n-th bit, and the number of packets 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 two adjacent groups, the number of grouping bits corresponding to the number of data bits to be written at each time is not fixed, and therefore, on the basis of ensuring that the number of grouping bits should be greater than or equal to the corresponding number of data bits to be written at each time and the number of significant bits in the number of grouping bits is equal to the corresponding number of data bits to be written at each time, the number of grouping bits corresponding to the number of data bits to be written at each time may be determined according to actual needs. For example, continuing with reference to 16 bits of data in the above example: 1010_0000_0001_0110, if the number of the data bits to be written for the first time is 2, the invalid bit3 may be divided into a first group or a second group, so the number of the grouped bits corresponding to the number of the data bits to be written for the first time may be 3 or 4, and in specific implementation, the number may be determined according to a preset invalid bit division principle.
Therefore, the data writing requirements are determined according to the number of the data bits required to be written each time and the corresponding grouping number of bits, and the data to be written are conveniently grouped subsequently.
Further, when grouping data according to the determined data writing requirement, as a possible implementation manner, continuing with the above example, if the determined data writing requirement includes the number of data bits that need to be written each time when writing data to the memory and the corresponding number of grouping bits, grouping the data according to the number of data bits that need to be written each time and the corresponding number of grouping bits.
Specifically, starting from bit0 at the right end of the data, the number of data bits included in the first group of data is determined according to the number of grouping bits corresponding to the number of data bits to be written for the first time, and the first group of data is formed by the data within the number of data bits, so that the corresponding number of data bits to be written for the first time is included in the first group of data, for example, with reference to the 16-bit data in the above example: 1010_0000_0001_0110, if the number of data bits required 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 required to be written for the first time is determined to be 3, the data "110" on bits 0 to 2 form a first group of data. And determining the number of data bits contained in the second group of data according to the group number corresponding to the number of data bits required to be written for the second time from the next bit of the last bit of the first group of data, forming the second group of data by the data in the number of data bits, and so on, and grouping the data to be written.
Therefore, the grouping method carries out dynamic grouping according to the data structure, the grouping bit number of each group of data can be different, and each group of data contains significant digits as much as possible.
Furthermore, after the data to be written are grouped, each grouped data is formed, the sequence of each grouped data corresponds to the sequence of the data required to be written each time, and each group of data is sequentially written into the memory according to the sequence of each grouped data.
In a specific implementation, as a possible implementation manner, the number of writing times is first determined according to the number of groups, for example, if the data is divided into four groups, the data is written into the memory four times. And then, determining current target group data needing to be written according to the grouped data needing to be written each time, namely, taking the grouped first group data as the target group data needing to be written for the first time, taking the grouped second group data as the target group data needing to be written for the second time, and so on, sequentially determining the target data needing to be written each time, and further sequentially writing the determined target group data into the memory.
Therefore, each target group data contains a large number of significant digits, and the number of times of writing data into the memory is reduced compared with the method of writing data into the memory in fixed packets, so that the efficiency of writing data into the memory is improved, and the time consumed for writing data into the memory is reduced.
It should be noted that, in practical applications, the data actually written into the memory may not be consistent with the data value of the data to be written, which is dynamically grouped. As an example, the data value of the grouped data may represent whether the data on the data bit needs to be modified, for example, when the current grouped data is 0101, it does not represent that the data is actually written into the memory, but the data in the grouped data that is "1" indicates that the data on the position needs to be modified, the data that is "0" indicates that the data on the position does not need to be written, that is, the current grouped data 0101 indicates that the data on bit0 and bit2 needs to be written into the memory, and the bits that are 0, that is, bit1/3, do not operate, and the data value on bit0 and bit2 that is specifically written into the memory may be determined according to whether the current operation is write 1 or write 0. Therefore, in some embodiments of the present invention, when writing the packet data into the memory in sequence, the data that needs to be written and is indicated by the packet data may also be written into the memory according to the values at the positions of the packet data and the current writing operation state.
For example, when 4-bit data "1101" is originally stored in the memory, if data "0110" needs to be written, when a write 1 operation is performed first, data that needs to be written 1 but is 0 in the memory is compared, and then 4-bit data "0010" is generated, where the data is the data that determines the write requirement in step 101, and then the generated data is dynamically grouped according to the method in the above step, and when the maximum allowable number of bits to be written in the memory at one time is 2, the grouped data is determined to be "0010", and then when "0010" is written in the memory, 1 is written to bit 1. Similarly, in 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 according to 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, first determining a data bit number to be written each time, then determining a corresponding grouping bit number according to the data bit number to be written for the first time from a lowest bit of the data, making the grouping bit number equal to a data bit number between a last valid data and a first valid data in valid data to be written for the first time, further dividing the data into a first grouping data and a remaining data, and then writing the first grouping data into the memory. Then, other grouped data are determined in turn from the lowest bit of the rest data, and after the determined grouped data are written into the memory, the next group of grouped data are determined until the highest bit of the data.
That is, it is first determined that the maximum significant digit is n bits each time, and when a write operation is performed, 1 (i.e., a significant digit) is found from the lowest order digit to the higher order digit of data; when the kth bit in the data is found, if the number of 1 reaches n, the valid bit required to be written for the first time is met, the data is not searched, and the data from bitk to bit0 are written into the memory; then, continuing to determine the next group of packet data, and writing the data into the memory each time n 1 s are found; and when the highest bit of the data is found, stopping searching, and writing the last group of fractional data into the memory until all the data to be written are written.
The writing method of the memory of the embodiment determines the corresponding packet bit number according to the data bit number required to be written each time, then divides the data into the packet data to be written currently and the residual data according to the packet bit number, and then divides the packet data required to be written next time from the residual data and writes the packet data after the packet data to be written currently is taken as the target packet data and is written into the memory, thereby realizing the grouping of the data according to the data writing requirement and sequentially writing the packet data into the memory. Therefore, the method also realizes that each target group data contains more significant digits, reduces the number of times of writing data into the memory compared with a 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 write method for the memory according to the embodiment of the present invention, the data write requirement is determined first, then the data is grouped according to the data write requirement, and finally the grouped data is written into the memory in sequence. The method determines a suitable data writing requirement according to the data characteristics of the data to be written, and then dynamically groups the data according to the data writing requirement, so that each group of grouped data contains the data bit number which needs to be written as much as possible, thereby reducing the data writing frequency, improving the data writing efficiency and shortening the occupied time of data writing.
Based on the above embodiments, in practical applications, in order to make the physical locations of the memory cells written in the memory more uniform, the present invention further provides a specific memory writing method.
Fig. 2 is a flowchart illustrating a specific method for writing into a memory according to an embodiment of the present invention. As shown in fig. 2, the method includes:
step 201, determining the bit number which can be written in the memory at one time, and performing first grouping on the data according to the bit number which can be written in the memory at one time to obtain a plurality of first grouped data.
Specifically, after the number of bits that can be written at one time of the memory is determined according to the system driving capability of the memory, when the data is grouped for the first time, the data may be fixedly grouped according to the number of bits that can be written at one time of the memory, so that the number of grouped bits of each first grouped data is the same, for example, if the number of bits of the data is N and the number of bits that can be written at one time of the memory is K, the bit width of each first grouped data is N/K. Thus, the data is evenly divided into a plurality of first packet data from the lower bits to the upper bits of the data.
And step 202, grouping each first grouped data for the second time, dividing each first grouped data into a plurality of second grouped data, and enabling each second grouped data to contain one bit of data bit number required to be written at most.
Specifically, each generated first packet data is grouped for the second time, wherein when the grouping for the second time is performed, each first packet data can be sequentially divided into a plurality of second packet data according to a principle that each second packet data is limited to only contain one data bit number (namely, a valid bit number) to be written at most, and the sum of the valid bit numbers which can be written at most each time of each second packet data corresponding to each first packet data is equal to the bit number which can be written at most at one time of the memory.
For example, if the bit number of the memory which can be written at one time is 4 bits, after dividing the 32-bit data into 4 groups of first packet data according to the bit number of the memory which can be written at one time, each first packet data can be divided into a plurality of second packet data, wherein, the order of each second grouping data can correspond to the order of dividing, or can be set according to the actual writing requirement, and each second grouping data only writes 1bit of data at most each time, that is, each second packet data contains at most only one bit of data that needs to be written, thereby facilitating the subsequent selection of 4 corresponding sets of second packet data in sequence in the first packet data, the sum of the number of data bits actually needed to be written contained in the selected 4 groups of second grouped data is equal to the maximum number of bits that can be written by the memory at one time, namely 4 bits.
Step 203, sequentially selecting a second group of data from each first group of data, forming each selected second group of data into target group of data which needs to be written currently, and writing the target group of data into the memory.
Specifically, after each first grouped data is divided into corresponding second grouped data, each second grouped data corresponding to the current writing times is sequentially selected from the first grouped data according to the sequence of the second grouped data, and the selected second grouped data is combined into target grouped data which needs to be written into the memory at present. In the process of writing data, all selected second grouped data are written into the memory at one time, and the sum of the effective digits contained in each second grouped data is equal to the bit which can be written by the memory at most at one time, so that the number of actually written data bits is equal to the number of data bits which can be written by storing more data bits which can be written by one time when data are written into the memory at each time, the number of data bits which need to be written actually at each time is maximized, and the data writing efficiency is improved.
In addition, when the data is grouped for the second time, the number of the second grouped data and the number of the most writable significant bits of the second grouped data at each time can be set according to needs, so that the position of writing the data into the memory can be controlled, and the writing memory cells are 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 improves the uniformity of the written memory cells on the physical position of the memory.
In order to more clearly describe the specific implementation process of the writing method of the memory according to the embodiment of the present invention, two specific embodiments are described below.
When the data to be written is 32-bit data: 0100_1010_0101_1111_1000_1101_0001_1001, the data includes a 16-bit significant digit number, and the positional relationship between the significant digit and the invalid digit is as described above.
When the maximum allowable number of bits written at one time in the memory is 4, it is determined that the number of data bits required to be written at each time is 4. Further, if each group of grouped data includes the same 4-bit valid data, the group corresponding to the data written each time can be determined from bit0 according to the positional relationship between each valid bit and each invalid bit as shown in table 1.
TABLE 1
Data to be written 0100_1010_0101_1111_1000_1101_0001_1001
First group 1_0001_1001
Second group 1_1000_110
Third group 1_111
Fourth group 100_1010_010
As can be seen from table 1, if each group of data after grouping includes four 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 data writing method of the fixed grouping in the prior art, data needs to be divided into 8 groups, and the data is written through 8 times of writing operations, so that compared with the writing method in the prior art, the writing method of the memory provided by the embodiment of the invention reduces 4 times of writing operations, and improves the writing efficiency of the data.
With continued reference to the first example described above, when the data to be written is 16-bit data in the above example: 1010_0000_0001_0110, when the maximum allowable data of 2 bits can be written into the memory at one time, the data comprises 5 significant bits according to the data structure, if the data bit number required to be written into each time is 2, the division of 5 by 2 is equal to 2 and the rest is 1, the data bit number required to be written into the previous two times is 2, and the data bit number required to be written into the last time is the rest 1 significant bit. Further, the packet corresponding to the data to be written each time is determined from bit0 based on the positional relationship between each significant digit and each invalid digit as shown in table 2.
TABLE 2
Data to be written 1010_0000_0001_0110
First group 0110
Second group 10_0000_0001
Third group 10
As can be seen from table 1, the data needs to be divided into three groups, and the data can be written into the memory by 3 write operations. Therefore, compared with the write-in method in the prior art, the write-in method of the memory provided by the embodiment of the invention reduces 2 write-in operations, improves the write-in efficiency of data, and saves the time consumed by data write-in.
In order to implement the foregoing embodiments, an embodiment of the present invention further provides a writing device for a memory. Fig. 3 is a schematic structural diagram of a writing apparatus of a memory according to an embodiment of the present invention. As shown in fig. 3, the writing apparatus 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.
And the grouping module 200 is used for grouping the data according to the data writing requirement.
And a writing module 300, configured to write the packet data into the memory in sequence.
Specifically, in a possible implementation manner of the embodiment of the present invention, the determining module 100 is specifically configured to determine the number of data bits required to be written each time and a corresponding number of grouped bits, and determine the data writing requirement according to the number of data bits required to be written each time and the corresponding number of grouped bits.
Further, in an embodiment of the present invention, the grouping module 200 is specifically configured to group the data according to the number of data bits required to be written each time and the corresponding number of grouping bits.
Further, in an embodiment of the present invention, the writing module 300 is specifically configured to determine the number of times of writing according to the number of groups, determine target group 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 group data into the memory.
In an embodiment of the invention, the determining module is further configured to determine a number of bits that can be written by the memory at one time at most, and determine the data writing requirement according to the number of bits that can be written by the memory at one time at most.
Further, in an embodiment of the present invention, the grouping module is further configured to: the data is grouped for the first time according to the bit number which can be written in the memory at most once to obtain at least one first grouped data, then the at least one first grouped data is grouped for the second time, each first grouped data is sequentially divided into at least one second grouped data, and each second grouped data comprises at most one bit of data bit number which needs to be written in.
Further, in an embodiment of the present invention, the writing module is further configured to: and sequentially selecting a second group of data from each first group of data, forming the selected second group of data into the target group of data which needs to be written currently, and writing the target group of data into the memory.
It should be noted that the foregoing explanation of the embodiment of the writing method for a memory is also applicable to the writing apparatus for a memory in this embodiment, and therefore is not repeated herein.
In summary, the writing device of the memory according to the embodiment of the present invention first determines the data writing requirement, then groups the data according to the data writing requirement, and finally sequentially writes the grouped data into the memory. The device determines a suitable data writing requirement according to the data characteristics of the data to be written, and then dynamically groups the data to be written according to the data writing requirement, so that each group of grouped data contains the number of data bits which need to be written actually as much as possible, thereby reducing the writing times of the data, improving the data writing efficiency, and shortening the time occupied by data writing.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean 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 invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer 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, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited 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 steps of a custom logic function or process, and alternate 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, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement 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). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can 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 should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (14)

1. A method for writing to a memory, comprising:
determining data writing requirements;
grouping data according to the data writing requirements;
and writing the grouped data into the memory in sequence.
2. The method according to claim 1, wherein the determining a data writing requirement comprises:
determining the number of data bits required to be written in each time and the corresponding grouping bits;
and determining the data writing requirements according to the number of data bits required to be written each time and the corresponding grouping number of bits.
3. The method for writing into the memory according to claim 1 or 2, wherein the grouping data according to the data writing requirement comprises:
and grouping the data according to the number of data bits required to be written each time and the corresponding grouping bits.
4. The method according to claim 1, wherein the writing packet data into the memory sequentially comprises:
determining the number of writing times according to the number of groups;
determining current target group data needing to be written according to the grouped data needing to be written each time;
writing the target group data to the memory.
5. The method of claim 1, wherein the determining a data write request further comprises:
determining the number of bits of the memory which can be written at most at one time;
and determining the data writing requirement according to the bit number which can be written in the memory at most at one time.
6. The method according to claim 5, wherein the grouping data according to the data writing requirement further comprises:
grouping the data for the first time according to the most writable bit number at one time of the memory to obtain at least one first grouped data;
and performing second grouping on the at least one first grouped data, and sequentially dividing each first grouped data into at least one second grouped data, so that each second grouped data at most comprises one data bit number required to be written.
7. The method according to claim 6, wherein the writing packet data into the memory sequentially further comprises:
selecting a second grouped data from each first grouped data in sequence, and forming each selected second grouped data into the target grouped data which needs to be written currently;
writing the target group data to the memory.
8. A writing apparatus for a memory, comprising:
the determining module is used for determining data writing requirements;
the grouping module is used for grouping data according to the data writing requirements;
and the writing module is used for writing the grouped data into the memory in sequence.
9. The apparatus according to claim 8, wherein the determining module is configured to determine a number of data bits required to be written each time and a corresponding number of grouped bits, and determine the data writing requirement according to the number of data bits required to be written each time and the corresponding number of grouped bits.
10. The writing device of the memory according to claim 8 or 9, wherein the grouping module is configured to group the data according to the number of data bits required to be written each time and the corresponding number of grouping bits.
11. The writing device of the memory according to claim 8, wherein the writing module is configured to determine the number of times of writing according to the number of packets, determine target group data that needs to be written currently according to the packet data that needs to be written each time, and write the target group data into the memory.
12. The memory writing apparatus of claim 8, wherein the determining module is further configured to: determining the bit number which can be written in the memory at most at one time, and determining the data writing requirement according to the bit number which can be written in the memory at most at one time.
13. The memory writing apparatus of claim 12, wherein the grouping module is further configured to:
grouping the data for the first time according to the most writable bit number at one time of the memory to obtain at least one first grouped data;
and performing second grouping on the at least one first grouped data, and sequentially dividing each first grouped data into at least one second grouped data, so that each second grouped data at most comprises one data bit number required to be written.
14. The memory writing apparatus of claim 13, wherein the writing module is further configured to:
selecting a second grouped data from each first grouped data in sequence, and forming each selected second grouped data into the target grouped data which needs to be written currently;
writing the target group data to 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 true CN111176561A (en) 2020-05-19
CN111176561B 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
CN111176561B (en) 2024-02-06

Similar Documents

Publication Publication Date Title
US8825947B1 (en) System and method for managing data access in non-volatile memory
KR101103210B1 (en) Wrap-around sequence numbers for recovering from power-fail in non-volatile memory
US8964464B2 (en) System and method for accelerated sampling
EP2778888B1 (en) Selecting between non-volatile memory units having different minimum addressable data unit sizes
US8493782B2 (en) Memory device and program method thereof
US6430672B1 (en) Method for performing address mapping using two lookup tables
KR101779545B1 (en) Configurable spreading function for memory interleaving
US20120246394A1 (en) Flash Memory Device and Data Writing Method for a Flash Memory
CN115064199A (en) System, method, and apparatus for user-configurable wear leveling of non-volatile memory
US10452533B2 (en) Access network for address mapping in non-volatile memories
US10445232B2 (en) Determining control states for address mapping in non-volatile memories
CN114415972B (en) Data processing method and device of SSD, storage medium and SSD device
CN1236386C (en) Storing device, storing control method and program
KR20170084194A (en) Memory wear leveling
CN112997160A (en) Data relocation in memory
US9921969B2 (en) Generation of random address mapping in non-volatile memories using local and global interleaving
US20140379962A1 (en) Data encoding for non-volatile memory
CN110546709B (en) Memory device providing bad column repair and method of operating the same
US20120117305A1 (en) Method Of Storing Blocks Of Data In A Plurality Of Memory Devices For High Speed Sequential Read, A Memory Controller And A Memory System
CN111176561A (en) Writing method and device of memory
US10452560B2 (en) Wear leveling in non-volatile memories
EP3404662B1 (en) A method and system for implementing a non-volatile counter using non-volatile memory
CN107622781B (en) Coding and decoding method for improving writing performance of three-layer memristor
WO2004040454A2 (en) Method and apparatus for performing multi-page write operations in a non-volatile memory system
US20200012454A1 (en) Semiconductor device for managing addresses of nonvolatile memory 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