CN106782646B - Method for writing data back to storage device and data access system - Google Patents
Method for writing data back to storage device and data access system Download PDFInfo
- Publication number
- CN106782646B CN106782646B CN201610120755.4A CN201610120755A CN106782646B CN 106782646 B CN106782646 B CN 106782646B CN 201610120755 A CN201610120755 A CN 201610120755A CN 106782646 B CN106782646 B CN 106782646B
- Authority
- CN
- China
- Prior art keywords
- data
- energy
- group
- write
- groups
- 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
Links
Classifications
-
- G—PHYSICS
- G11—INFORMATION STORAGE
- G11C—STATIC STORES
- G11C13/00—Digital stores characterised by the use of storage elements not covered by groups G11C11/00, G11C23/00, or G11C25/00
- G11C13/0002—Digital stores characterised by the use of storage elements not covered by groups G11C11/00, G11C23/00, or G11C25/00 using resistive RAM [RRAM] elements
- G11C13/0021—Auxiliary circuits
- G11C13/0069—Writing or programming circuits or methods
-
- G—PHYSICS
- G11—INFORMATION STORAGE
- G11C—STATIC STORES
- G11C11/00—Digital stores characterised by the use of particular electric or magnetic storage elements; Storage elements therefor
- G11C11/56—Digital stores characterised by the use of particular electric or magnetic storage elements; Storage elements therefor using storage elements with more than two stable states represented by steps, e.g. of voltage, current, phase, frequency
- G11C11/5678—Digital stores characterised by the use of particular electric or magnetic storage elements; Storage elements therefor using storage elements with more than two stable states represented by steps, e.g. of voltage, current, phase, frequency using amorphous/crystalline phase transition storage elements
Landscapes
- Chemical & Material Sciences (AREA)
- Crystallography & Structural Chemistry (AREA)
- Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
- Static Random-Access Memory (AREA)
- Read Only Memory (AREA)
Abstract
一种将数据自内存写回储存装置的方法,内存包括多个数据单元以储存数据,该方法包括:针对各数据单元,计算将数据写回储存装置所对应的写回能量;依据各数据单元所对应的写回能量,将这些数据单元分类成多个群组,这些群组各自对应一写回能量等级;自这些群组中挑选一目标组,其中这些群组中对应较低写回能量等级的群组被赋予较高的机率被选为该目标组;从目标组中选择目标数据单元,并将目标数据单元的数据写回储存装置。
A method for writing data from a memory back to a storage device, wherein the memory includes a plurality of data units for storing data, the method comprising: for each data unit, calculating the write-back energy corresponding to writing the data back to the storage device; classifying the data units into a plurality of groups according to the write-back energy corresponding to each data unit, wherein each of the groups corresponds to a write-back energy level; selecting a target group from the groups, wherein the groups corresponding to the lower write-back energy level in the groups are given a higher probability of being selected as the target group; selecting a target data unit from the target group, and writing the data of the target data unit back to the storage device.
Description
技术领域technical field
本发明关于一种将数据自内存写回(write back)储存装置的方法及数据存取系统。The present invention relates to a method and a data access system for writing data back from a memory to a storage device.
背景技术Background technique
相变化内存(Phase-Change Memory,PCM)因具有高速存取以及关闭电源后仍保留数据的特性,故已广泛地被使用在各种非挥发性(Non-Volatile)储存装置当中。实务上,在对相变化内存进行写入/编程操作时,可通过加热电极的方式来改变存储单元中相变化材质的结晶状态,以使其呈现对应写入数据的电阻值。举例来说,相变化内存的多阶存储单元(Multi-Level Cell,MLC)可被编程至四种可能的电阻值分布,以分别表示“11”、“10”、“00”、“01”等二位数据。Phase-Change Memory (PCM) has been widely used in various non-volatile storage devices due to its high-speed access and data retention after power off. In practice, when writing/programming the phase-change memory, the crystallization state of the phase-change material in the memory cell can be changed by heating the electrodes so that it exhibits a resistance value corresponding to the written data. For example, a multi-level memory cell (Multi-Level Cell, MLC) of a phase-change memory can be programmed to four possible resistance value distributions to represent "11", "10", "00", and "01" respectively Wait for two digits.
然而,虽然相变化内存的多阶存储单元可储存较多位的数据,但在进行编程时,其相较于编程单阶存储单元(Single-Level Cell,SLC)需要花费更多的能量,使得系统能耗增加。However, although the multi-level memory cell of the phase-change memory can store more bits of data, it requires more energy than programming a single-level memory cell (Single-Level Cell, SLC) when programming, so that System power consumption increases.
因此,如何降低对储存装置写入数据所需的能量以降低整体系统耗能,乃目前业界所致力的课题之一。Therefore, how to reduce the energy required for writing data into the storage device so as to reduce the overall system energy consumption is one of the topics that the industry is currently working on.
发明内容Contents of the invention
本发明关于一种将数据自内存写回储存装置的方法及的数据存取系统,可让具有较低写回能量的数据有较高的机率被写回储存装置,从而降低对储存装置写入数据所需耗费的能量。The present invention relates to a method and a data access system for writing data from internal memory back to a storage device, which allows data with lower write-back energy to have a higher probability of being written back to the storage device, thereby reducing writing to the storage device The energy consumed by the data.
根据本发明的一方面,提出一种将数据自内存写回储存装置的方法,内存包括多个数据单元以储存数据,该方法包括以下步骤:针对各数据单元,计算将数据写回储存装置所对应的写回能量;依据各数据单元所对应的写回能量,将这些数据单元分类成多个群组,这些群组各自对应一写回能量等级;自这些群组中挑选一目标组,其中这些群组中对应较低写回能量等级的群组被赋予较高的机率被选为该目标组;从目标组中选择目标数据单元,并将目标数据单元的数据写回储存装置。According to one aspect of the present invention, a method for writing data from the internal memory back to the storage device is proposed. The internal memory includes a plurality of data units for storing data. Corresponding write-back energy; according to the write-back energy corresponding to each data unit, classify these data units into a plurality of groups, and each of these groups corresponds to a write-back energy level; select a target group from these groups, wherein Among the groups, the group corresponding to the lower write-back energy level is given a higher probability to be selected as the target group; the target data unit is selected from the target group, and the data of the target data unit is written back to the storage device.
根据本发明的一方面,提出一种数据存取系统,其包括处理单元、内存以及储存装置。内存包括多个数据单元以储存数据。储存装置耦接内存。处理单元耦接内存,用以针对各数据单元计算将数据写回储存装置所对应的写回能量,并依据各数据单元所对应的写回能量,将这些数据单元分类成多个群组,这些群组各自对应一写回能量等级,其中处理单元在内存空间已满时系执行一写回程序,该写回程序包括:自这些群组中挑选一目标组,其中这些群组中对应较低写回能量等级的群组被赋予较高的机率被选为该目标组;以及从目标组中选择目标数据单元,并将目标数据单元的数据写回储存装置。According to an aspect of the present invention, a data access system is provided, which includes a processing unit, a memory, and a storage device. The memory includes multiple data units to store data. The storage device is coupled to the memory. The processing unit is coupled to the memory, and is used for calculating the write-back energy corresponding to writing data back to the storage device for each data unit, and classifying these data units into multiple groups according to the write-back energy corresponding to each data unit. Each group corresponds to a write-back energy level, wherein the processing unit executes a write-back procedure when the memory space is full, and the write-back procedure includes: selecting a target group from these groups, wherein the corresponding lower A group with a writeback energy level is given a higher probability to be selected as the target group; and a target data unit is selected from the target group, and data of the target data unit is written back to the storage device.
为了对本发明的上述及其他方面有更好的了解,下文特举优选实施例,并配合所附附图,作详细说明如下。In order to have a better understanding of the above and other aspects of the present invention, preferred embodiments will be described below in detail together with the accompanying drawings.
附图说明Description of drawings
图1示出依据本发明一实施例的数据存取系统的简化方块图;Figure 1 shows a simplified block diagram of a data access system according to an embodiment of the present invention;
图2示出依据本发明一实施例的将数据自内存写回储存装置的方法流程图;FIG. 2 shows a flow chart of a method for writing data from internal memory back to a storage device according to an embodiment of the present invention;
图3示出依据本发明一实施例的内存的数据结构的示意图;FIG. 3 shows a schematic diagram of a data structure of a memory according to an embodiment of the present invention;
图4示出依据本发明一实施例的对应不同写回能量等级的群组的示意图;FIG. 4 shows a schematic diagram of groups corresponding to different write-back energy levels according to an embodiment of the present invention;
图5示出依据本发明一实施例的数据存取系统的操作流程图;Fig. 5 shows the operation flowchart of the data access system according to an embodiment of the present invention;
图6示出依据本发明一实施例的写回数据挑选程序的操作流程图。FIG. 6 shows an operation flowchart of the writeback data selection program according to an embodiment of the present invention.
【符号说明】【Symbol Description】
100:数据存取系统100: Data Access System
102:处理单元102: Processing unit
104:内存104: memory
106:储存装置106: storage device
A1、A2:路径A1, A2: path
步骤:202、204、206、208、502、504、506、508、510、512、514、516、518、602、604、606、608、610、612、614、616Steps: 202, 204, 206, 208, 502, 504, 506, 508, 510, 512, 514, 516, 518, 602, 604, 606, 608, 610, 612, 614, 616
302:数据计数器302: Data counter
DU、DU11~DU1i、DU21~DU2j、DUn1~DUnk:数据单元DU, DU11~DU1i, DU21~DU2j, DUn1~DUnk: data unit
CL:快取线CL: cache line
DB:脏位DB: dirty bits
G1~Gn:群组G1~Gn: Group
LV1~LVn:写回能量等级LV1~LVn: write back energy level
E:最大写回能量E: maximum writeback energy
具体实施方式Detailed ways
在本文中,参照所附附图仔细地描述本发明的一些实施例,但不是所有实施例都有表示在附图中。实际上,这些发明可使用多种不同的变形,且并不限于本文中的实施例。相对的,本发明提供这些实施例以满足应用的法定要求。附图中相同的附图标记用来表示相同或相似的组件。Herein, some embodiments of the present invention are described in detail with reference to the accompanying drawings, but not all embodiments are shown in the drawings. Indeed, these inventions can use many different variations and are not limited to the examples herein. Rather, the present invention provides these embodiments to meet the statutory requirements of the application. The same reference numerals are used in the drawings to designate the same or similar components.
图1示出依据本发明一实施例的数据存取系统100的简化方块图。数据存取系统100包括处理单元102、内存104以及储存装置106。处理单元102例如是中央处理单元(Central Processing Unit,CPU)、处理器、控制器或其它运算控制电路。内存104耦接处理单元102。内存104例如是系统的主存储器(Main Memory),可供处理单元102储存/暂存运算时所需的数据。内存104可由动态随机存取内存(Dynamic Random Access Memory,DRAM)或其他形式的挥发性(Volatile)内存来实现,也可通过非挥发性(Non-Volatile)内存来实现。储存装置106耦接内存104。储存装置106可例如由非挥发性内存来实现,比如相变化内存(Phase-Change Memory,PCM)、NAND闪存、磁阻式随机存取内存(MagnetoresistiveRandom Access Memory,MRAM)、可变电阻式内存(Resistive Random Access Memory、ReRAM)等等,可供永久性地储存数据。FIG. 1 shows a simplified block diagram of a data access system 100 according to an embodiment of the present invention. The data access system 100 includes a processing unit 102 , a memory 104 and a storage device 106 . The processing unit 102 is, for example, a central processing unit (Central Processing Unit, CPU), a processor, a controller or other operation control circuits. The memory 104 is coupled to the processing unit 102 . The memory 104 is, for example, the main memory of the system, which can be used by the processing unit 102 to store/temporarily store data required for operations. The memory 104 can be implemented by Dynamic Random Access Memory (Dynamic Random Access Memory, DRAM) or other forms of volatile (Volatile) memory, and can also be implemented by non-volatile (Non-Volatile) memory. The storage device 106 is coupled to the memory 104 . The storage device 106 can be realized by non-volatile memory, such as phase-change memory (Phase-Change Memory, PCM), NAND flash memory, magnetoresistive random access memory (MagnetoresistiveRandom Access Memory, MRAM), variable resistance memory ( Resistive Random Access Memory, ReRAM), etc., can store data permanently.
在操作上,数据存取系统100可视为一种非对称的存取架构。举例来说,程序会先储存在储存装置106当中,接着程序被加载内存104以供处理单元102执行(如路径A1所示)。处理单元102执行期间所产生的相关运算结果可先暂存至内存104。当内存104空间被填满、或是有特定数据必需存回储存装置106时,处理单元102将执行写回(write back)动作,以将数据从内存104写回储存装置106(如路径A2所示)。由于将数据写回储存装置106需花费一定的写回能量(例如对相变化内存施加热能以进行编程所花费的能量),倘若能减少执行写回操作时所需耗费的写回能量,将能有效降低系统耗能。In terms of operation, the data access system 100 can be regarded as an asymmetric access architecture. For example, the program is first stored in the storage device 106 , and then the program is loaded into the memory 104 for execution by the processing unit 102 (as shown by path A1 ). The relevant calculation results generated during the execution of the processing unit 102 can be temporarily stored in the memory 104 . When the space of the memory 104 is full, or when certain data must be stored back into the storage device 106, the processing unit 102 will perform a write back (write back) action to write the data from the memory 104 back to the storage device 106 (as indicated by path A2 Show). Since writing data back into the storage device 106 requires a certain amount of write-back energy (for example, the energy spent on programming the phase-change memory by applying thermal energy), if the write-back energy required to perform the write-back operation can be reduced, it will be possible Effectively reduce system energy consumption.
依据本发明的实施例,处理单元102可先对内存104中各数据单元的写回能量作评估,再将这些数据单元依其对应的写回能量归类至对应不同写回能量等级的群组。之后,再配合机率选择的方式,使得对应低能量等级的群组有较高的机率被选取,进而从所选的群组中找到合适的写回数据。通过此方式,可让被选为要写回储存装置106的数据大多是对应低写回能量,使得系统耗能可有效地被降低。According to an embodiment of the present invention, the processing unit 102 can first evaluate the write-back energy of each data unit in the memory 104, and then classify these data units into groups corresponding to different write-back energy levels according to their corresponding write-back energy . Afterwards, combined with the method of probability selection, the group corresponding to the low energy level has a higher probability to be selected, and then finds suitable write-back data from the selected group. In this way, most of the data selected to be written back to the storage device 106 corresponds to low write-back energy, so that the system power consumption can be effectively reduced.
图2示出依据本发明一实施例的将数据自内存104写回储存装置106的方法流程图。在步骤202,处理单元102针对内存104的各数据单元,计算将数据写回储存装置106所对应的写回能量。所述的数据单元可以是内存页(memory page)或其他的数据管理单位,视系统的存取架构而定。FIG. 2 shows a flowchart of a method for writing data from the memory 104 back to the storage device 106 according to an embodiment of the invention. In step 202 , the processing unit 102 calculates write-back energy corresponding to writing data back to the storage device 106 for each data unit of the memory 104 . The data unit may be a memory page or other data management units, depending on the access architecture of the system.
在一实施例中,可通过计数各数据单元中高能阶数据的数目,以决定各数据单元所对应的写回能量。所述的高能阶数据是指须花费较多能量进行编程才能达到目标数据位准的数据,其例如对应一或多个特定位样式(bit pattern)。举例来说,在对相变化内存的存储单元进行编程时,可先基于类似编程单阶存储单元(Single-Level Cell,SLC)的方式来写入数据的第一个位,以形成对应数据“1”(或“11”)、“0”(或“00”)的电阻值分布。之后若要再写入第二个位,则需进行较精准的编程控制,以进一步分出对应数据“10”、“01”的电阻值分布。因此,写入数据“10”、“01”所需花费的能量将明显高于写入数据“11”、“00”所需花费的能量。故在此例中,位样式为“10”、“01”的数据将被视为高能阶数据,处理单元102可通过计数数据单元中包含多少个位样式为“10”及“01”的数据来估计该数据单元所对应的写回能量。In one embodiment, the write-back energy corresponding to each data unit can be determined by counting the number of high-energy level data in each data unit. The high-level data refers to data that requires more energy to be programmed to reach a target data level, for example, corresponding to one or more specific bit patterns. For example, when programming a storage cell of a phase-change memory, the first bit of data can be written in a manner similar to programming a single-level cell (Single-Level Cell, SLC) to form the corresponding data " 1" (or "11"), "0" (or "00") resistance value distribution. If the second bit is to be written later, more precise programming control is required to further separate the resistance value distribution corresponding to the data "10" and "01". Therefore, the energy required to write data "10", "01" will be significantly higher than the energy required to write data "11", "00". Therefore, in this example, the data with the bit pattern of "10" and "01" will be regarded as high-level data, and the processing unit 102 can count how many data with the bit pattern of "10" and "01" contained in the data unit to estimate the writeback energy corresponding to the data unit.
可理解本发明并不以上述实施例为限,不同存储单元分布所对应的数据当可视不同的设计而调整,使得高能阶数据所对应的位样式有所不同。在其他例子中,处理单元102也可进一步考虑其他因素来计算数据单元所对应的写回能量。相关叙述将配合图3进行说明。It can be understood that the present invention is not limited to the above-mentioned embodiments, and the data corresponding to different memory cell distributions can be adjusted according to different designs, so that the bit patterns corresponding to high-level data are different. In other examples, the processing unit 102 may further consider other factors to calculate the write-back energy corresponding to the data unit. Relevant descriptions will be described in conjunction with FIG. 3 .
在步骤204,处理单元102可依据各数据单元所对应的写回能量,将这些数据单元分类成多个群组,其中这些群组各自对应一写回能量等级。举例来说,处理单元102可将写回能量位于第一写回能量区间(如50焦耳至150焦耳)的数据单元归类至第一群组,并将写回能量位于第二写回能量区间(如150焦耳至250焦耳)的数据单元归类至第二群组,以此类推,直到将所有的数据单元均分类至合适的群组。此时,第一群组相当于对应一较低的写回能量等级,其中包含写回能量落在50焦耳至150焦耳之间的数据单元,而第二群组则相当于对应一较高的写回能量等级,其中包含写回能量落在150焦耳至250焦耳之间的数据单元。换言之,所谓对应相对低写回能量等级的群组,是指该群组中所包含的数据单元的写回能量落在一相对低的写回能量区间;而所谓对应相对高写回能量等级的群组,是指该群组中所包含的数据单元的写回能量落在一相对高的写回能量区间。In step 204, the processing unit 102 may classify the data units into a plurality of groups according to the write-back energy corresponding to each data unit, wherein each of the groups corresponds to a write-back energy level. For example, the processing unit 102 can classify the data units whose write-back energy is in the first write-back energy range (such as 50 Joules to 150 Joules) into the first group, and put the write-back energy in the second write-back energy range The data units (for example, 150 Joules to 250 Joules) are classified into the second group, and so on until all the data units are classified into appropriate groups. At this time, the first group corresponds to a lower write-back energy level, which includes data units whose write-back energy falls between 50 Joules and 150 Joules, and the second group corresponds to a higher write-back energy level. Writeback energy level, which includes data units whose writeback energy falls between 150 Joules and 250 Joules. In other words, the so-called group corresponding to a relatively low write-back energy level means that the write-back energy of the data units contained in the group falls within a relatively low write-back energy range; and the so-called relatively high write-back energy level A group means that the writeback energy of the data units included in the group falls within a relatively high writeback energy range.
在步骤206,处理单元102自这些群组中挑选一目标组,其中这些群组中对应较低写回能量等级的群组被赋予较高的机率被选为该目标组。举例来说,若处理单元102以随机方式来挑选目标组,则可在随机选择的样本空间中增加对应低写回能量等级群组的样本数,并减少对应高写回能量等级群组的样本数,从而提高低写回能量等级群组被选为目标组的机率。举例来说,假设有三个群组A、B、C,其所对应的写回能量范围例如分别是0~100焦耳、200~300焦耳、300~400焦耳,且此三个群组A、B、C分别被赋予不同的权重,例如分别为4、2、1,此时,挑选到群组A的机率为4/7,挑选到群组B的机率是2/7,而挑选到群组C的机率是1/7。因此,具有相对低写回能量的群组A被挑到的机率将比其他群组B、C高。通过此方式,储存装置106将有较大的机率是被写回低写回能量的数据,进而降低对储存装置106执行写回操作所需耗费的能量。In step 206 , the processing unit 102 selects a target group from the groups, wherein a group corresponding to a lower writeback energy level among the groups is assigned a higher probability to be selected as the target group. For example, if the processing unit 102 selects the target group in a random manner, the number of samples corresponding to groups with low writeback energy levels may be increased in the randomly selected sample space, and the number of samples corresponding to groups with high writeback energy levels may be decreased. number, thereby increasing the probability that a group with a low writeback energy level will be selected as the target group. For example, suppose there are three groups A, B, and C, and the corresponding write-back energy ranges are, for example, 0-100 Joules, 200-300 Joules, and 300-400 Joules respectively, and the three groups A, B , C are given different weights, for example, 4, 2, 1 respectively. At this time, the probability of selecting group A is 4/7, the probability of selecting group B is 2/7, and the probability of selecting group The probability of C is 1/7. Therefore, group A with relatively low writeback energy will have a higher probability of being picked than other groups B, C. In this way, the storage device 106 will have a higher probability of being written back with low write-back energy data, thereby reducing the energy consumed for the write-back operation on the storage device 106 .
在一实施例中,机率挑选群组的权重设定可以是从对应最高写回能量等级的群组开始,指定其权重为1,第二高的为2,第三高的为4,以此类推,之后再把这些权重加起来当作分母,分子为对应的群组的权重(即,对应群组的权重除以权重总和),以得到该群组所对应的被挑选机率。如此一来,具有相对低写回能量的群组将具有较高的被挑选机率。可理解上述实施例所采用的权重值设定仅是作为说明用途,并非用以限制本发明。在其他实施例中,权重值的设定也可视不同应用而作调整。In one embodiment, the weight setting of the probabilistic selection group can start from the group corresponding to the highest writeback energy level, specifying its weight as 1, the second highest as 2, and the third highest as 4, so that By analogy, these weights are then added together as the denominator, and the numerator is the weight of the corresponding group (that is, the weight of the corresponding group divided by the sum of the weights), so as to obtain the probability of being selected corresponding to the group. In this way, groups with relatively low writeback energy will have a higher probability of being selected. It can be understood that the setting of the weight values adopted in the above-mentioned embodiments is only for illustration purposes, and is not intended to limit the present invention. In other embodiments, the setting of the weight value can also be adjusted according to different applications.
此外,通过机率的散布性,可消除因为冷数据(Cold Data)、热数据(Hot Data)对能耗的影响。进一步说,有些数据虽然具备低写回能量,但其被写回的频率高(热数据),使得整体的写回能量仍是高的。通过机率选择方式,将可使部分写回能量虽高、但写回频率低的数据(冷数据)有机会被选择写回,从而减缓冷、热数据对能耗的影响。In addition, through the distribution of probability, the influence of cold data (Cold Data) and hot data (Hot Data) on energy consumption can be eliminated. Furthermore, although some data has low write-back energy, its write-back frequency is high (hot data), so that the overall write-back energy is still high. Through the probability selection method, some data (cold data) with high write-back energy but low write-back frequency will have the opportunity to be selected for write-back, thereby slowing down the impact of cold and hot data on energy consumption.
在步骤208,处理单元102系从所选的目标组中选择目标数据单元,并将目标数据单元的数据写回储存装置106。处理单元102可基于随机方式或是一定规则来挑选目标数据单元。由于各数据单元已经过分类,且对应低写回能量等级的群组被赋予较高的被选机率,故处理单元102并不需一一比较各数据单元的写回能量以找出相对低写回能量的数据后再将其写回。因此,处理单元102可通过此方式快速地挑选出欲写回储存装置106的数据,从而缩短整体编程时间。In step 208 , the processing unit 102 selects the target data unit from the selected target group, and writes the data of the target data unit back to the storage device 106 . The processing unit 102 may select the target data unit based on a random method or a certain rule. Since each data unit has been classified, and the group corresponding to the low writeback energy level is given a higher probability of being selected, the processing unit 102 does not need to compare the writeback energy of each data unit one by one to find out the relatively low writeback energy level. Write back the energy data. Therefore, the processing unit 102 can quickly select the data to be written back to the storage device 106 in this way, thereby shortening the overall programming time.
在一实施例中,处理单元102在对内存104执行写入操作后即会对相关的数据单元进行如步骤202及204的管理及分类,并在内存104空间被填满时,执行如步骤206及208的写回程序。In one embodiment, after the processing unit 102 performs the write operation on the memory 104, it will manage and classify the relevant data units as in steps 202 and 204, and when the space of the memory 104 is full, perform the operations as in step 206 And the write-back procedure of 208.
图3示出依据本发明一实施例的内存的数据结构的示意图。为方便说明,此处所述的内存以图1的内存104为例,但并不以此限制本发明。FIG. 3 shows a schematic diagram of a data structure of a memory according to an embodiment of the present invention. For convenience of description, the memory described here takes the memory 104 in FIG. 1 as an example, but this does not limit the present invention.
在图3的例子中,内存104包括多个数据单元DU,各数据单元DU系包括多条快取线CL。数据单元DU例如是一数据页,其大小例如是4K字节(Byte)或4M字节,而一条快取线CL的大小例如是64字节或128字节,视实际应用而定。In the example of FIG. 3 , the memory 104 includes a plurality of data units DU, and each data unit DU includes a plurality of cache lines CL. The data unit DU is, for example, a data page, and its size is, for example, 4K bytes (Byte) or 4M bytes, and the size of a cache line CL is, for example, 64 bytes or 128 bytes, depending on the actual application.
各数据单元DU分别被赋予一个数据计数器302,各数据计数器302用以计算对应的数据单元DU中有多少个高耗能数据(如位样式为“10”及“01”的数据),以供处理单元102估算各数据单元DU所对应的写回能量。Each data unit DU is assigned a data counter 302 respectively, and each data counter 302 is used to calculate how many high-energy-consuming data (such as data whose bit patterns are "10" and "01") in the corresponding data unit DU, for The processing unit 102 estimates the write-back energy corresponding to each data unit DU.
在一实施例中,数据计数器302并不需计数对应数据单元DU中所有快取线CL所包含的高耗能数据数量,而仅需计数曾被修改过数据的快取线CL中的高耗能数据数量即可。进一步说,各快取线CL被赋予一个脏位(dirty bit)DB以指示其是否曾被修改过数据/被写入。当一快取线CL被脏位DB标记(例如脏位DB的值=1),表示该快取线CL曾被修改过数据。反之,当快取线CL未被脏位DB标记(例如脏位DB的值=0),则表示该快取线CL未曾被修改过数据。一般而言,只有被修改过的数据才可能有写回储存装置106的需要,故数据计数器302可通过计数各数据单元DU中被脏位DB标记的快取线CL所包含的高能阶数据的数目,以供处理单元102计算各数据单元DU所对应的写回能量。举例来说,处理单元102可基于以下公式计算数据单元DU所对应的写回能量:In one embodiment, the data counter 302 does not need to count the amount of high-power consumption data contained in all the cache lines CL in the corresponding data unit DU, but only needs to count the high-power consumption data in the cache lines CL that have modified data. The amount of data can be used. Furthermore, each cache line CL is assigned a dirty bit DB to indicate whether data has been modified/written to it. When a cache line CL is marked by the dirty bit DB (for example, the value of the dirty bit DB=1), it means that data has been modified on the cache line CL. On the contrary, when the cache line CL is not marked by the dirty bit DB (for example, the value of the dirty bit DB=0), it means that the cache line CL has not been modified data. Generally speaking, only modified data may need to be written back to the storage device 106, so the data counter 302 can count the high-level data contained in the cache line CL marked by the dirty bit DB in each data unit DU. The number is used for the processing unit 102 to calculate the write-back energy corresponding to each data unit DU. For example, the processing unit 102 can calculate the writeback energy corresponding to the data unit DU based on the following formula:
(式一) (Formula 1)
其中Epf表示一数据单元DU所对应的写回能量,Cpc表示数据计数器302的计数结果,Cdirty表示数据单元DU中被脏位DB标记的快取线CL的数量,Ncl表示一快取线CL中的位数,Ehe表示写入高能阶数据(如数据“01”或“10”)的平均写回能量,Ele表示写入低能阶数据(如数据“00”或“11”)的平均写回能量。Wherein Epf represents the write-back energy corresponding to a data unit DU, Cpc represents the counting result of the data counter 302, Cdirty represents the number of cache lines CL marked by the dirty bit DB in the data unit DU, and Ncl represents the number of cache lines CL in a data unit DU. Ehe represents the average write-back energy of writing high-level data (such as data "01" or "10"), and Ele represents the average write-back energy of writing low-level data (such as data "00" or "11") energy.
进一步说,项次Ncl×Cdirty为所有被脏位DB标记的快取线CL所包含的位计数,而对于多阶存储单元(MLC)来说,由于每次写入操作都是写入两个位的信息,故在(式一)中,将项次Ncl×Cdirty除以2以计算其实际写入的动作。另外,在(式一)中未将项次Cpc×Ehe除以2的原因在于Cpc本身即记录了高能阶数据(如数据“01”或“10”)的个数,而不是分别纪录有几个位,故不需除以2。Furthermore, the item Ncl×Cdirty is the number of bits contained in all the cache lines CL marked by the dirty bit DB, and for a multi-level memory cell (MLC), since each write operation is to write two Therefore, in (Equation 1), divide the term Ncl×Cdirty by 2 to calculate the actual writing action. In addition, the reason why the term Cpc×Ehe is not divided by 2 in (Formula 1) is that Cpc itself records the number of high-level data (such as data "01" or "10"), rather than recording how many The ones digit, so there is no need to divide by 2.
可理解本发明并不以上述实施例为限,凡是基于数据单元中高能阶数据的数量来评估对应数据单元的写回能量,均属本发明精神的范畴。It can be understood that the present invention is not limited to the above-mentioned embodiments, and any evaluation of the writeback energy of a corresponding data unit based on the amount of high-energy level data in the data unit falls within the spirit of the present invention.
图4示出依据本发明一实施例的对应不同写回能量等级的群组的示意图。在图4的例子中,设有n个群组G1~Gn,其中n为正整数。群组G1~Gn分别对应至写回能量等级LV1~LVn,并由低写回能量至高写回能量依序排列。对应同一写回能量等级/写回能量区间的数据群组被归类至同一群组。如图4所示,对应写回能量等级LV1的数据单元DU11~DU1i被归类至群组G1;对应写回能量等级LV2的数据单元DU21~DU2j被归类至群组G2;对应写回能量等级LVn的数据单元DUnl~DUnk被归类至群组Gn,其中i、j、k为正整数。举例来说,假设写回能量等级LV1表示写回能量为100焦耳至200焦耳的等级,而写回能量等级LV2表示写回能量为200焦耳至400焦耳的等级,此时,若第一数据单元、第二数据单元以及第三数据单元被写回储存装置106所需耗费的能量分别为130焦耳、180焦耳以及300焦耳,则第一、二数据单元将被分类至同一群组G1,而第三数据单元将被分类至群组G2。FIG. 4 shows a schematic diagram of groups corresponding to different writeback energy levels according to an embodiment of the invention. In the example shown in FIG. 4 , there are n groups G1 -Gn, where n is a positive integer. The groups G1-Gn respectively correspond to the write-back energy levels LV1-LVn, and are arranged sequentially from low write-back energy to high write-back energy. Data groups corresponding to the same writeback energy level/writeback energy range are classified into the same group. As shown in Figure 4, data units DU11~DU1i corresponding to writeback energy level LV1 are classified into group G1; data units DU21~DU2j corresponding to writeback energy level LV2 are classified into group G2; The data units DUnl˜DUnk of the level LVn are classified into the group Gn, where i, j, k are positive integers. For example, assuming that the write-back energy level LV1 indicates that the write-back energy is 100 Joules to 200 Joules, and the write-back energy level LV2 indicates that the write-back energy is 200 Joules to 400 Joules, at this time, if the first data unit , the second data unit, and the third data unit are written back to the storage device 106 to consume 130 joules, 180 joules, and 300 joules of energy respectively, then the first and second data units will be classified into the same group G1, and the second Three data units will be classified into group G2.
在一实施例中,各群组G1~Gn所对应的写回能量区间可以是平均划分。举例来说,若最大写回能量为E,则各群组G1~Gn所对应的写回能量区间的区间宽度可以均设定为E/n。此时,群组G1对应0至的写回能量区间,群组G2对应至的写回能量区间,群组G3系对应至的写回能量区间,以此类推。In an embodiment, the write-back energy intervals corresponding to the groups G1 -Gn may be equally divided. For example, if the maximum write-back energy is E, the interval widths of the write-back energy intervals corresponding to the groups G1 -Gn may all be set as E/n. At this time, group G1 corresponds to 0 to The writeback energy range of the group G2 corresponds to to The writeback energy interval of the group G3 corresponds to to The writeback energy range of , and so on.
又一实施例中,各群组G1~Gn所对应的写回能量区间可以是非平均划分。举例来说,若最大写回能量为E,则各群组G1~Gn所对应的写回能量区间可基于一特定底数Q的幂次方来划分。以底数Q等于2为例,群组G1对应0至的写回能量区间,群组G2对应至的写回能量区间,群组G3对应至的写回能量区间,以此类推。若群组G1~Gn按照写回能量的高低由低至高依序排列,低写回能量群组所对应的写回能量区间宽度是高写回能量群组所对应的写回能量区间宽度的QR倍,其中Q表示幂次方划分最大写回能量E的底数,R表示两群组间的序数差,Q、R均为正整数。以前述例子为例,在底数Q等于2的情况下,群组G1(对应序数为1)的写回能量区间宽度是群组G3(对应序数为3)的写回能量区间宽度的2(3-1)倍。In yet another embodiment, the write-back energy intervals corresponding to the groups G1 -Gn may be divided unevenly. For example, if the maximum write-back energy is E, the write-back energy intervals corresponding to the groups G1 -Gn can be divided based on the power of a specific base Q. Taking base Q equal to 2 as an example, group G1 corresponds to 0 to The writeback energy range of the group G2 corresponds to to The writeback energy range of the group G3 corresponds to to The writeback energy range of , and so on. If the groups G1-Gn are arranged in order from low to high according to the write-back energy level, the write-back energy interval width corresponding to the low write-back energy group is Q of the write-back energy interval width corresponding to the high write-back energy group R times, where Q represents the base of the maximum write-back energy E divided by the power, R represents the ordinal difference between the two groups, and both Q and R are positive integers. Taking the aforementioned example as an example, when the base Q is equal to 2, the writeback energy interval width of group G1 (corresponding to ordinal number 1) is 2 (3 -1) times.
可理解本发明并不以上述例示为限。各群组所对应的写回能量区间也可基于其他规则来划分,视不同应用而定。It can be understood that the present invention is not limited to the above examples. The writeback energy range corresponding to each group may also be divided based on other rules, depending on different applications.
图5示出依据本发明一实施例的数据存取系统的操作流程图。为方便说明,此处所述的数据存取系统以图1的数据存取系统100为例,但并不以此限制本发明。FIG. 5 shows an operation flowchart of the data access system according to an embodiment of the present invention. For convenience of description, the data access system described here takes the data access system 100 in FIG. 1 as an example, but this does not limit the present invention.
在步骤502,处理单元102先是判断所欲存取的数据单元(例如数据页)是否存在内存104中。若是,则接续步骤504,处理单元102将判断是对该数据单元进行读取或写入操作。若否,则接续步骤516,处理单元102接着判断内存104是否空间已满。若是,则进入步骤506,处理单元102执行写回数据挑选程序,以自内存104选取合适的写回数据并将其写回储存装置106当中。所述挑选程序的一例示性细部流程将配合图6进行说明。In step 502 , the processing unit 102 first determines whether the data unit (such as a data page) to be accessed exists in the memory 104 . If yes, continue to step 504, and the processing unit 102 will determine whether to perform a read or write operation on the data unit. If not, then proceed to step 516, and the processing unit 102 then determines whether the memory 104 is full. If yes, enter step 506 , the processing unit 102 executes the write-back data selection program to select the appropriate write-back data from the memory 104 and write it back into the storage device 106 . An exemplary detailed flow of the selection program will be described with reference to FIG. 6 .
若步骤516的判断结果为否,也就是内存104的空间尚未被填满,处理单元102将执行步骤518,以在内存104中建立欲存取的数据单元。举例来说,处理单元102可以从储存装置106读出或者是直接在内存104上建立内容为空的内存页面以供读写。If the result of step 516 is negative, that is, the space of the memory 104 has not been filled, the processing unit 102 will execute step 518 to create the data unit to be accessed in the memory 104 . For example, the processing unit 102 can read from the storage device 106 or directly create an empty memory page on the memory 104 for reading and writing.
在步骤510,当处理单元102判断出欲对数据单元进行读取操作,处理单元102将自该数据单元读取数据。In step 510, when the processing unit 102 determines that a read operation is to be performed on the data unit, the processing unit 102 reads data from the data unit.
在步骤508,当处理单元102判断出欲对数据单元进行写入操作,处理单元102将对该数据单元写入数据。接着如步骤512及514所示,针对写入后的数据单元,处理单元102将计算其对应的写回能量,并依据求得的写回能量将其归类至对应的群组,以便之后写回数据的挑选。In step 508, when the processing unit 102 determines that a write operation is to be performed on the data unit, the processing unit 102 will write data to the data unit. Then, as shown in steps 512 and 514, for the written data units, the processing unit 102 will calculate their corresponding write-back energy, and classify them into corresponding groups according to the obtained write-back energy, so that they can be written later. Back to the selection of data.
图6示出依据本发明一实施例的写回数据挑选程序的操作流程图。此操作流程图可例如作为图5中步骤506的细部流程图,但本发明并不以此为限。FIG. 6 shows an operation flowchart of the writeback data selection program according to an embodiment of the present invention. The operation flow chart can be, for example, a detailed flow chart of step 506 in FIG. 5 , but the invention is not limited thereto.
在步骤602,处理单元102先是初始化一循环计数器的值,例如将其重置为0。In step 602 , the processing unit 102 first initializes a value of a loop counter, for example, resets it to 0.
在步骤604,处理单元102以随机方式选取群组。各群组例如被赋予不同的被选机率,使得低能量等级的群组比高能量等级的群组更容易被挑选到。In step 604, the processing unit 102 randomly selects groups. For example, each group is given a different probability of being selected, so that a group with a low energy level is easier to be selected than a group with a high energy level.
在步骤606,处理单元102调整循环计数器的值,以计数处理单元102随机选取群组的次数。举例来说,可基于以下公式来调整循环计数器的值:In step 606 , the processing unit 102 adjusts the value of the loop counter to count the number of times the processing unit 102 randomly selects groups. For example, the loop counter value can be adjusted based on the following formula:
i=i+1 (式二)i=i+1 (Formula 2)
其中i表示循环计数器的值。where i represents the value of the loop counter.
在步骤608,处理单元102判断所选的群组中是否有任何数据单元。若否,则表示处理单元102需重新选取群组。如步骤612所示,处理单元102将判断循环计数器的值是否超过一预定阀值,并在判断出循环计数器的值尚未超过该预定阀值时,再次执行步骤604以重新挑选群组。反之,当循环计数器的值超过该预定阀值,表示处理单元102已进行多次随机选取程序仍无法挑选到有效的群组(即当中有存放数据单元的群组),此时,处理单元102将执行步骤614,改以一固定顺序搜寻有效的群组,例如从对应最低写回能量等级的群组开始寻找第一个具有数据单元的群组。In step 608, the processing unit 102 determines whether there are any data units in the selected group. If not, it means that the processing unit 102 needs to reselect the group. As shown in step 612 , the processing unit 102 will determine whether the value of the loop counter exceeds a predetermined threshold, and when it is determined that the value of the loop counter has not exceeded the predetermined threshold, execute step 604 again to reselect groups. Conversely, when the value of the loop counter exceeds the predetermined threshold, it means that the processing unit 102 has performed multiple random selection procedures and still cannot select a valid group (that is, a group with data units stored therein). At this time, the processing unit 102 Step 614 will be executed to search for valid groups in a fixed order, for example, starting from the group corresponding to the lowest writeback energy level to find the first group with data units.
被挑选到的有效群组可视为目标组。在挑选出目标组后,处理单元102将自所选的目标组中挑选出目标数据单元,并将该目标数据单元写回储存装置106,如步骤610及616所示。在完成如图6所示的写回数据挑选程序后,处理单元102可例如接续如图5的步骤518,以执行后续对内存104的相关操作。The selected effective group can be regarded as the target group. After the target group is selected, the processing unit 102 selects the target data unit from the selected target group and writes the target data unit back to the storage device 106 , as shown in steps 610 and 616 . After completing the write-back data selection procedure shown in FIG. 6 , the processing unit 102 may, for example, proceed to step 518 in FIG. 5 to perform subsequent related operations on the memory 104 .
综上所述,本发明所提出的将数据自内存写回储存装置的方法及数据存取系统,可先对内存中各数据单元的写回能量作估计,再将这些数据单元依其对应的写回能量归类至对应不同写回能量等级的群组。之后,再配合机率选择的方式,使得对应低能量等级的群组有较高的机率被选取,进而从所选的群组中找到合适的写回数据。通过此方式,不仅可以有效地降低系统耗能,更可提升选取合适写回数据的速度,进而缩短整体编程时间。To sum up, the method and data access system for writing data back from the memory to the storage device proposed by the present invention can first estimate the write-back energy of each data unit in the memory, and then write these data units according to their corresponding Writeback energies are grouped into groups corresponding to different writeback energy levels. Afterwards, combined with the method of probability selection, the group corresponding to the low energy level has a higher probability to be selected, and then finds suitable write-back data from the selected group. In this way, not only can the system energy consumption be effectively reduced, but also the speed of selecting suitable write-back data can be increased, thereby shortening the overall programming time.
虽然本发明已以优选实施例公开如上,然其并非用以限定本发明。本领域技术人员,在不脱离本发明的精神和范围内,当可作各种的更动与润饰。因此,本发明的保护范围当视前附的权利要求书所界定者为准。Although the present invention has been disclosed above with preferred embodiments, it is not intended to limit the present invention. Those skilled in the art may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention should be defined by the appended claims.
Claims (10)
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US201562259659P | 2015-11-25 | 2015-11-25 | |
US62/259,659 | 2015-11-25 |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106782646A CN106782646A (en) | 2017-05-31 |
CN106782646B true CN106782646B (en) | 2019-11-05 |
Family
ID=58972032
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610120755.4A Active CN106782646B (en) | 2015-11-25 | 2016-03-03 | Method for writing data back to storage device and data access system |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN106782646B (en) |
TW (1) | TWI611405B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8332591B2 (en) * | 2007-12-14 | 2012-12-11 | Samsung Electronics Co., Ltd. | Cache memory unit with early write-back capability and method of early write back for cache memory unit |
CN104681100A (en) * | 2013-11-29 | 2015-06-03 | 慧荣科技股份有限公司 | Error correction code unit for flash memory device, self-test method and controller |
US9112536B2 (en) * | 2011-01-31 | 2015-08-18 | Everspin Technologies, Inc. | Method of reading and writing to a spin torque magnetic random access memory with error correcting code |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101443231B1 (en) * | 2007-11-27 | 2014-09-19 | 삼성전자주식회사 | Cache memory capable of adjusting burst length of write-back data in write-back operation |
JP2012033047A (en) * | 2010-07-30 | 2012-02-16 | Toshiba Corp | Information processor, memory management device, memory management method and program |
US8949544B2 (en) * | 2012-11-19 | 2015-02-03 | Advanced Micro Devices, Inc. | Bypassing a cache when handling memory requests |
US9965397B2 (en) * | 2013-02-26 | 2018-05-08 | Avago Technologies General Ip (Singapore) Pte. Ltd. | Fast read in write-back cached memory |
GB2516831B (en) * | 2013-07-31 | 2020-10-21 | Advanced Risc Mach Ltd | Error code management in systems permitting partial writes |
JP2015111334A (en) * | 2013-12-06 | 2015-06-18 | 富士通株式会社 | Storage control device, storage control program, and storage control method |
-
2016
- 2016-03-03 CN CN201610120755.4A patent/CN106782646B/en active Active
- 2016-03-03 TW TW105106541A patent/TWI611405B/en active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8332591B2 (en) * | 2007-12-14 | 2012-12-11 | Samsung Electronics Co., Ltd. | Cache memory unit with early write-back capability and method of early write back for cache memory unit |
US9112536B2 (en) * | 2011-01-31 | 2015-08-18 | Everspin Technologies, Inc. | Method of reading and writing to a spin torque magnetic random access memory with error correcting code |
CN104681100A (en) * | 2013-11-29 | 2015-06-03 | 慧荣科技股份有限公司 | Error correction code unit for flash memory device, self-test method and controller |
Also Published As
Publication number | Publication date |
---|---|
TWI611405B (en) | 2018-01-11 |
TW201719656A (en) | 2017-06-01 |
CN106782646A (en) | 2017-05-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI652679B (en) | Memory controller, memory system and control method | |
US11681442B2 (en) | Performing hybrid wear leveling operations based on a sub-total write counter | |
TWI647702B (en) | Memory controller, memory system, and method for managing data configuration in a memory | |
US10216422B2 (en) | Storage device including nonvolatile memory device and access method for nonvolatile memory device | |
CN104216665B (en) | The memory management method of multilevel-cell solid state hard disc | |
CN111095226B (en) | Memory device with dynamic cache management | |
US9098395B2 (en) | Logical block management method for a flash memory and control circuit storage system using the same | |
CN104572490B (en) | Semiconductor devices and its operating method | |
US8738876B2 (en) | Method for performing block management, and associated memory device and controller thereof | |
CN104156317A (en) | Wiping and writing management method and system for non-volatile flash memory | |
CN108399110B (en) | Soft information management in high capacity solid state drives | |
US11704024B2 (en) | Multi-level wear leveling for non-volatile memory | |
TW201719663A (en) | Data allocating method and electric system using the same | |
CN110603529A (en) | Method for sketch-based memory management and memory device using the same | |
CN101609431B (en) | Operation method of flash memory device and flash memory device | |
US9898406B2 (en) | Caching of data in data storage systems by managing the size of read and write cache based on a measurement of cache reliability | |
CN106782646B (en) | Method for writing data back to storage device and data access system | |
CN111435403B (en) | Wear leveling method and device for flash memory system | |
TWI575445B (en) | Method, system, and computer-readable recording medium for automated storage tiering | |
TWI453747B (en) | Method for managing a plurality of blocks of a flash memory, and associated memory device and controller thereof | |
CN101989458A (en) | Method and memory device for averagely using a plurality of blocks of a flash memory, and controller | |
CN105045724A (en) | Space allocation based wear leveling method for nonvolatile memory | |
Zhou | Towards successful application of phase change memories: Addressing challenges from write operations |
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 |