CN113312274B - Data sorting method of memory, memory storage device and control circuit unit - Google Patents
Data sorting method of memory, memory storage device and control circuit unit Download PDFInfo
- Publication number
- CN113312274B CN113312274B CN202010125393.4A CN202010125393A CN113312274B CN 113312274 B CN113312274 B CN 113312274B CN 202010125393 A CN202010125393 A CN 202010125393A CN 113312274 B CN113312274 B CN 113312274B
- Authority
- CN
- China
- Prior art keywords
- data
- block addresses
- physical
- logical block
- logical
- 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
- 230000005055 memory storage Effects 0.000 title claims abstract description 59
- 238000000034 method Methods 0.000 title claims abstract description 35
- 230000008878 coupling Effects 0.000 claims description 5
- 238000010168 coupling process Methods 0.000 claims description 5
- 238000005859 coupling reaction Methods 0.000 claims description 5
- 238000011156 evaluation Methods 0.000 claims 1
- 238000013467 fragmentation Methods 0.000 abstract description 17
- 238000006062 fragmentation reaction Methods 0.000 abstract description 17
- 238000013507 mapping Methods 0.000 abstract description 14
- 230000005540 biological transmission Effects 0.000 description 12
- 238000010586 diagram Methods 0.000 description 12
- 238000012937 correction Methods 0.000 description 9
- 238000005516 engineering process Methods 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 239000012634 fragment Substances 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 230000008520 organization Effects 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 108010001267 Protein Subunits Proteins 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 239000000758 substrate Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/0223—User address space allocation, e.g. contiguous or non contiguous base addressing
- G06F12/023—Free address space management
- G06F12/0238—Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
- G06F12/0246—Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/08—Error detection or correction by redundancy in data representation, e.g. by using checking codes
- G06F11/10—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
- G06F11/1008—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices
- G06F11/1044—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices with specific ECC/EDC distribution
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
本发明提供一种存储器的数据整理方法、存储器存储装置及存储器控制电路单元,其用于包括可复写式非易失性存储器模块的存储器存储装置。所述存储器的数据整理方法包括:从主机系统接收指令,其中指令包括数据区间;根据数据区间的多个逻辑区块地址的逻辑估计值及逻辑区块地址映射的多个实体抹除单元的实体估计值计算数据散乱度;以及根据数据散乱度与阀值判断是否执行数据整理操作以根据逻辑区块地址搬移实体抹除单元中的数据。
The invention provides a memory data organizing method, a memory storage device and a memory control circuit unit, which are used in a memory storage device including a rewritable non-volatile memory module. The data organizing method of the memory includes: receiving an instruction from a host system, wherein the instruction includes a data interval; and erasing entities of multiple physical erase units based on logical estimates of multiple logical block addresses of the data interval and logical block address mapping. The estimated value is used to calculate the data fragmentation degree; and based on the data fragmentation degree and the threshold value, it is determined whether to perform a data defragmentation operation to move the data in the physical erasure unit according to the logical block address.
Description
技术领域Technical field
本发明涉及一种存储器数据整理技术,尤其涉及一种存储器的数据整理方法、存储器存储装置及存储器控制电路单元。The present invention relates to a memory data sorting technology, and in particular to a memory data sorting method, a memory storage device and a memory control circuit unit.
背景技术Background technique
数码相机、移动电话与MP3播放器在这几年来的成长十分迅速,使得消费者对存储媒体的需求也急速增加。由于可复写式非易失性存储器模块(rewritable non-volatilememory module)(例如,快闪存储器)具有数据非易失性、省电、体积小,以及无机械结构等特性,所以非常适合内建于上述所举例的各种可携式多媒体装置中。Digital cameras, mobile phones and MP3 players have grown rapidly in recent years, causing consumer demand for storage media to increase rapidly. Since the rewriteable non-volatile memory module (e.g., flash memory) has the characteristics of non-volatile data, power saving, small size, and no mechanical structure, it is very suitable for built-in Among the various portable multimedia devices exemplified above.
然而,若来自于主机系统的写入数据属于不连续的数据,例如,写入数据属于不连续的逻辑子单元,则一个逻辑单元中的逻辑子单元可能会映射至不同的实体抹除单元的实体程序化单元。在此情况下,当主机系统欲读取属于一个逻辑单元中对应连续地址的多个逻辑子单元的数据时,控制器可能需载入不同的逻辑-实体映射表来找出分散在不同的实体抹除单元的多个实体程序化单元。之后,控制器需再发送多个读取指令以从这些分散的实体程序化单元中读取数据,以至于耗费相当长的时间来执行读取操作,而造成数据读取速度变慢。However, if the write data from the host system belongs to discontinuous data, for example, the write data belongs to discontinuous logical sub-units, then the logical sub-units in one logical unit may be mapped to different physical erase units. Entity programming unit. In this case, when the host system wants to read data belonging to multiple logical subunits corresponding to consecutive addresses in a logical unit, the controller may need to load different logical-entity mapping tables to find out the data scattered in different entities. Erase multiple physical programmed units of a unit. Afterwards, the controller needs to send multiple read instructions to read data from these scattered physical programming units, so that it takes a long time to perform the read operation, causing the data read speed to slow down.
发明内容Contents of the invention
本发明提供一种存储器的数据整理方法、存储器存储装置及存储器控制电路单元,其可判断是否需要进行数据整理操作。The invention provides a memory data sorting method, a memory storage device and a memory control circuit unit, which can determine whether a data sorting operation is required.
本发明的实施例提供一种存储器的数据整理方法用于包括可复写式非易失性存储器模块的存储器存储装置。所述存储器的数据整理方法包括:从主机系统接收指令,其中所述指令包括数据区间;根据所述数据区间的多个逻辑区块地址的逻辑估计值及所述逻辑区块地址映射的多个实体抹除单元的实体估计值计算数据散乱度;以及根据所述数据散乱度与阀值判断是否执行数据整理操作以根据所述逻辑区块地址搬移所述实体抹除单元中的数据。Embodiments of the present invention provide a memory data organization method for use in a memory storage device including a rewritable non-volatile memory module. The data organizing method of the memory includes: receiving an instruction from a host system, wherein the instruction includes a data interval; logical estimates of multiple logical block addresses according to the data interval and multiple logical block address mappings. The physical estimation value of the physical erasure unit calculates the data scattering degree; and determines whether to perform a data sorting operation to move the data in the physical erasure unit according to the logical block address according to the data scattering degree and the threshold value.
在本发明的一实施例中,所述指令包括碎片重组指令。In an embodiment of the present invention, the instructions include fragment reassembly instructions.
在本发明的一实施例中,根据所述数据区间的所述逻辑区块地址的所述逻辑估计值及所述逻辑区块地址映射的所述实体抹除单元的所述实体估计值计算所述数据散乱度的步骤包括:根据所述数据区间的所述逻辑区块地址的数量、所述逻辑区块地址的容量与所述可复写式非易失性存储器模块的实体页面容量计算所述逻辑估计值;根据所述逻辑区块地址映射的所述实体抹除单元中的实体页面数量决定所述实体估计值;以及计算所述逻辑估计值与所述实体估计值的比值以决定所述数据散乱度。In an embodiment of the present invention, the method is calculated based on the logical estimated value of the logical block address of the data interval and the physical estimated value of the physical erasure unit mapped by the logical block address. The step of describing the data scatter degree includes: calculating the said data according to the number of the logical block addresses in the data interval, the capacity of the logical block address and the physical page capacity of the rewritable non-volatile memory module. a logical estimated value; determining the physical estimated value according to the number of physical pages in the physical erasure unit mapped by the logical block address; and calculating a ratio of the logical estimated value to the physical estimated value to determine the Data scatter.
在本发明的一实施例中,根据所述数据区间的所述逻辑区块地址的所述数量、所述逻辑区块地址的所述容量与所述可复写式非易失性存储器模块的所述实体页面容量计算所述逻辑估计值的步骤包括:根据所述逻辑区块地址的所述数量与所述逻辑区块地址的所述容量计算所述数据区间的数据容量;以及根据所述数据容量与所述可复写式非易失性存储器模块的所述实体页面容量计算所述逻辑估计值。In an embodiment of the present invention, according to the number of the logical block addresses of the data interval, the capacity of the logical block address and all the values of the rewritable non-volatile memory module The step of calculating the logical estimated value of the physical page capacity includes: calculating the data capacity of the data interval according to the number of the logical block addresses and the capacity of the logical block address; and according to the data The logical estimate is calculated using the capacity and the physical page capacity of the rewritable non-volatile memory module.
在本发明的一实施例中,根据所述数据散乱度与所述阀值判断是否执行所述数据整理操作以根据所述逻辑区块地址搬移所述实体抹除单元中的数据的步骤包括:在所述数据散乱度不大于第一阀值时根据所述逻辑区块地址执行所述数据整理操作。In an embodiment of the present invention, the step of determining whether to perform the data sorting operation to move the data in the physical erasure unit according to the logical block address according to the data fragmentation degree and the threshold value includes: When the data fragmentation is not greater than the first threshold, the data sorting operation is performed according to the logical block address.
在本发明的一实施例中,根据所述数据区间的所述逻辑区块地址的所述逻辑估计值及所述逻辑区块地址映射的所述实体抹除单元的所述实体估计值计算所述数据散乱度的步骤包括:根据所述数据区间的所述逻辑区块地址对应的逻辑页面数量决定所述逻辑估计值;根据所述逻辑区块地址映射的所述实体抹除单元所对应的实体平面数量决定所述实体估计值;以及根据所述逻辑估计值与所述实体估计值计算所述数据散乱度。In an embodiment of the present invention, the method is calculated based on the logical estimated value of the logical block address of the data interval and the physical estimated value of the physical erasure unit mapped by the logical block address. The step of describing the data scatter degree includes: determining the logical estimated value according to the number of logical pages corresponding to the logical block address of the data interval; and determining the logical estimation value according to the physical erasure unit corresponding to the logical block address mapping. The number of entity planes determines the entity estimate value; and the data scatter degree is calculated based on the logical estimate value and the entity estimate value.
在本发明的一实施例中,根据所述数据散乱度与所述阀值判断是否执行所述数据整理操作以根据所述逻辑区块地址搬移所述实体抹除单元中的数据的步骤包括:根据所述数据散乱度与第三阀值计算第二阀值;以及在所述逻辑区块地址映射的所述实体抹除单元所对应的其中之一实体平面中配置的页面数量不小于所述第二阀值时,根据所述逻辑区块地址执行所述数据整理操作。In an embodiment of the present invention, the step of determining whether to perform the data sorting operation to move the data in the physical erasure unit according to the logical block address according to the data fragmentation degree and the threshold value includes: Calculate a second threshold based on the data fragmentation and the third threshold; and the number of pages configured in one of the physical planes corresponding to the physical erasure unit mapped by the logical block address is not less than the At the second threshold, the data sorting operation is performed according to the logical block address.
本发明提出一种存储器存储装置,包括连接接口单元、可复写式非易失性存储器模块以及存储器控制电路单元。所述连接接口单元用以耦接至主机系统。所述存储器控制电路单元耦接至所述连接接口单元与所述可复写式非易失性存储器模块。所述存储器控制电路单元用以从所述主机系统接收指令,其中所述指令包括数据区间。所述存储器控制电路单元还用以根据所述数据区间的多个逻辑区块地址的逻辑估计值及所述逻辑区块地址映射的多个实体抹除单元的实体估计值计算数据散乱度。并且所述存储器控制电路单元还用以根据所述数据散乱度与阀值判断是否执行数据整理操作以根据所述逻辑区块地址搬移所述实体抹除单元中的数据。The invention proposes a memory storage device, which includes a connection interface unit, a rewritable non-volatile memory module and a memory control circuit unit. The connection interface unit is used for coupling to a host system. The memory control circuit unit is coupled to the connection interface unit and the rewritable non-volatile memory module. The memory control circuit unit is configured to receive instructions from the host system, where the instructions include data intervals. The memory control circuit unit is further configured to calculate a data scatter degree based on logical estimation values of multiple logical block addresses of the data interval and physical estimation values of multiple physical erasure units mapped by the logical block address. And the memory control circuit unit is also used to determine whether to perform a data sorting operation according to the data scatter degree and the threshold value to move the data in the physical erasure unit according to the logical block address.
在本发明的一实施例中,所述指令包括碎片重组指令。In an embodiment of the present invention, the instructions include fragment reassembly instructions.
在本发明的一实施例中,所述存储器控制电路单元还用以根据所述数据区间的所述逻辑区块地址的所述逻辑估计值及所述逻辑区块地址映射的所述实体抹除单元的所述实体估计值计算所述数据散乱度的操作包括:根据所述数据区间的所述逻辑区块地址的数量、所述逻辑区块地址的容量与所述可复写式非易失性存储器模块的实体页面容量计算所述逻辑估计值;根据所述逻辑区块地址映射的所述实体抹除单元中的实体页面数量决定所述实体估计值;以及计算所述逻辑估计值与所述实体估计值的比值以决定所述数据散乱度。In an embodiment of the present invention, the memory control circuit unit is further configured to perform physical erasure based on the logical estimate of the logical block address of the data interval and the physical erase of the logical block address mapping. The operation of calculating the data scatter degree based on the physical estimate value of the unit includes: based on the number of the logical block addresses of the data interval, the capacity of the logical block address and the rewritable non-volatile Calculate the logical estimated value based on the physical page capacity of the memory module; determine the physical estimated value according to the number of physical pages in the physical erasure unit mapped by the logical block address; and calculate the logical estimated value and the The ratio of entity estimates to determine the data scatter.
在本发明的一实施例中,根据所述数据区间的所述逻辑区块地址的所述数量、所述逻辑区块地址的所述容量与所述可复写式非易失性存储器模块的所述实体页面容量计算所述逻辑估计值的操作包括:根据所述逻辑区块地址的所述数量与所述逻辑区块地址的所述容量计算所述数据区间的数据容量;以及根据所述数据容量与所述可复写式非易失性存储器模块的所述实体页面容量计算所述逻辑估计值。In an embodiment of the present invention, according to the number of the logical block addresses of the data interval, the capacity of the logical block address and all the values of the rewritable non-volatile memory module The operation of calculating the logical estimated value of the physical page capacity includes: calculating the data capacity of the data interval according to the number of the logical block addresses and the capacity of the logical block address; and according to the data The logical estimate is calculated using the capacity and the physical page capacity of the rewritable non-volatile memory module.
在本发明的一实施例中,所述存储器控制电路单元还用以根据所述数据散乱度与所述阀值判断是否执行所述数据整理操作以根据所述逻辑区块地址搬移所述实体抹除单元中的数据的操作包括:在所述数据散乱度不大于第一阀值时根据所述逻辑区块地址执行所述数据整理操作。In an embodiment of the present invention, the memory control circuit unit is further used to determine whether to perform the data sorting operation according to the data fragmentation degree and the threshold value to move the physical erase according to the logical block address. The operation of removing data in the unit includes: performing the data sorting operation according to the logical block address when the data fragmentation degree is not greater than a first threshold.
在本发明的一实施例中,所述存储器控制电路单元还用以根据所述数据区间的所述逻辑区块地址的所述逻辑估计值及所述逻辑区块地址映射的所述实体抹除单元的所述实体估计值计算所述数据散乱度的操作包括:根据所述数据区间的所述逻辑区块地址对应的逻辑页面数量决定所述逻辑估计值;根据所述逻辑区块地址映射的所述实体抹除单元所对应的实体平面数量决定所述实体估计值;以及根据所述逻辑估计值与所述实体估计值计算所述数据散乱度。In an embodiment of the present invention, the memory control circuit unit is further configured to perform physical erasure based on the logical estimate of the logical block address of the data interval and the physical erase of the logical block address mapping. The operation of calculating the data scatter degree based on the physical estimated value of the unit includes: determining the logical estimated value based on the number of logical pages corresponding to the logical block address of the data interval; and determining the logical estimated value based on the logical block address mapping. The number of entity planes corresponding to the entity erasure unit determines the entity estimate value; and the data scatter degree is calculated based on the logical estimate value and the entity estimate value.
在本发明的一实施例中,其中所述存储器控制电路单元还用以根据所述数据散乱度与所述阀值判断是否执行所述数据整理操作以根据所述逻辑区块地址搬移所述实体抹除单元中的数据的操作包括:根据所述数据散乱度与第三阀值计算第二阀值;以及在所述逻辑区块地址映射的所述实体抹除单元所对应的其中之一实体平面中配置的页面数量不小于所述第二阀值时,根据所述逻辑区块地址执行所述数据整理操作。In an embodiment of the present invention, the memory control circuit unit is further used to determine whether to perform the data sorting operation to move the entity according to the logical block address according to the data fragmentation degree and the threshold value. The operation of erasing the data in the unit includes: calculating a second threshold based on the data scatter degree and a third threshold; and erasing one of the entities corresponding to the physical erasure unit mapped to the logical block address. When the number of pages configured in the plane is not less than the second threshold, the data sorting operation is performed according to the logical block address.
本发明提出一种存储器控制电路单元,用于控制包括可复写式非易失性存储器模块的存储器存储装置,且所述存储器控制电路单元包括主机接口、存储器接口以及存储器管理电路。所述主机接口用以耦接至主机系统。所述存储器接口用以耦接至所述可复写式非易失性存储器模块。所述存储器管理电路耦接至所述主机接口与所述存储器接口。所述存储器控制电路单元用以从所述主机系统接收指令,其中所述指令包括数据区间。所述存储器控制电路单元还用以根据所述数据区间的多个逻辑区块地址的逻辑估计值及所述逻辑区块地址映射的多个实体抹除单元的实体估计值计算数据散乱度。并且所述存储器控制电路单元还用以根据所述数据散乱度与阀值判断是否执行数据整理操作以根据所述逻辑区块地址搬移所述实体抹除单元中的数据。The present invention proposes a memory control circuit unit for controlling a memory storage device including a rewritable non-volatile memory module, and the memory control circuit unit includes a host interface, a memory interface and a memory management circuit. The host interface is used to couple to a host system. The memory interface is used to couple to the rewritable non-volatile memory module. The memory management circuit is coupled to the host interface and the memory interface. The memory control circuit unit is configured to receive instructions from the host system, where the instructions include data intervals. The memory control circuit unit is further configured to calculate a data scatter degree based on logical estimation values of multiple logical block addresses of the data interval and physical estimation values of multiple physical erasure units mapped by the logical block address. And the memory control circuit unit is also used to determine whether to perform a data sorting operation according to the data scatter degree and the threshold value to move the data in the physical erasure unit according to the logical block address.
在本发明的一实施例中,所述指令包括碎片重组指令。In an embodiment of the present invention, the instructions include fragment reassembly instructions.
在本发明的一实施例中,所述存储器控制电路单元还用以根据所述数据区间的所述逻辑区块地址的所述逻辑估计值及所述逻辑区块地址映射的所述实体抹除单元的所述实体估计值计算所述数据散乱度的操作包括:根据所述数据区间的所述逻辑区块地址的数量、所述逻辑区块地址的容量与所述可复写式非易失性存储器模块的实体页面容量计算所述逻辑估计值;根据所述逻辑区块地址映射的所述实体抹除单元中的实体页面数量决定所述实体估计值;以及计算所述逻辑估计值与所述实体估计值的比值以决定所述数据散乱度。In an embodiment of the present invention, the memory control circuit unit is further configured to perform physical erasure based on the logical estimate of the logical block address of the data interval and the physical erase of the logical block address mapping. The operation of calculating the data scatter degree based on the physical estimate value of the unit includes: based on the number of the logical block addresses of the data interval, the capacity of the logical block address and the rewritable non-volatile Calculate the logical estimated value based on the physical page capacity of the memory module; determine the physical estimated value according to the number of physical pages in the physical erasure unit mapped by the logical block address; and calculate the logical estimated value and the The ratio of entity estimates to determine the data scatter.
在本发明的一实施例中,根据所述数据区间的所述逻辑区块地址的所述数量、所述逻辑区块地址的所述容量与所述可复写式非易失性存储器模块的所述实体页面容量计算所述逻辑估计值的操作包括:根据所述逻辑区块地址的所述数量与所述逻辑区块地址的所述容量计算所述数据区间的数据容量;以及根据所述数据容量与所述可复写式非易失性存储器模块的所述实体页面容量计算所述逻辑估计值。In an embodiment of the present invention, according to the number of the logical block addresses of the data interval, the capacity of the logical block address and all the values of the rewritable non-volatile memory module The operation of calculating the logical estimated value of the physical page capacity includes: calculating the data capacity of the data interval according to the number of the logical block addresses and the capacity of the logical block address; and according to the data The logical estimate is calculated using the capacity and the physical page capacity of the rewritable non-volatile memory module.
在本发明的一实施例中,所述存储器控制电路单元还用以根据所述数据散乱度与所述阀值判断是否执行所述数据整理操作以根据所述逻辑区块地址搬移所述实体抹除单元中的数据的操作包括:在所述数据散乱度不大于第一阀值时根据所述逻辑区块地址执行所述数据整理操作。In an embodiment of the present invention, the memory control circuit unit is further used to determine whether to perform the data sorting operation according to the data fragmentation degree and the threshold value to move the physical erase according to the logical block address. The operation of removing data in the unit includes: performing the data sorting operation according to the logical block address when the data fragmentation degree is not greater than a first threshold.
在本发明的一实施例中,所述存储器控制电路单元还用以根据所述数据区间的所述逻辑区块地址的所述逻辑估计值及所述逻辑区块地址映射的所述实体抹除单元的所述实体估计值计算所述数据散乱度的操作包括:根据所述数据区间的所述逻辑区块地址对应的逻辑页面数量决定所述逻辑估计值;根据所述逻辑区块地址映射的所述实体抹除单元所对应的实体平面数量决定所述实体估计值;以及根据所述逻辑估计值与所述实体估计值计算所述数据散乱度。In an embodiment of the present invention, the memory control circuit unit is further configured to perform physical erasure based on the logical estimate of the logical block address of the data interval and the physical erase of the logical block address mapping. The operation of calculating the data scatter degree based on the physical estimated value of the unit includes: determining the logical estimated value based on the number of logical pages corresponding to the logical block address of the data interval; and determining the logical estimated value based on the logical block address mapping. The number of entity planes corresponding to the entity erasure unit determines the entity estimate value; and the data scatter degree is calculated based on the logical estimate value and the entity estimate value.
在本发明的一实施例中,所述存储器控制电路单元还用以根据所述数据散乱度与所述阀值判断是否执行所述数据整理操作以根据所述逻辑区块地址搬移所述实体抹除单元中的数据的操作包括:根据所述数据散乱度与第三阀值计算第二阀值;以及在所述逻辑区块地址映射的所述实体抹除单元所对应的其中之一实体平面中配置的页面数量不小于所述第二阀值时,根据所述逻辑区块地址执行所述数据整理操作。In an embodiment of the present invention, the memory control circuit unit is further used to determine whether to perform the data sorting operation according to the data fragmentation degree and the threshold value to move the physical erase according to the logical block address. The operation of erasing the data in the unit includes: calculating a second threshold based on the data scatter degree and a third threshold; and erasing one of the physical planes corresponding to the physical erase unit mapped in the logical block address. When the number of pages configured in is not less than the second threshold, the data sorting operation is performed according to the logical block address.
基于上述,本发明的实施例所提供的存储器的数据整理方法、存储器存储装置及存储器控制电路单元,可根据指令包括的数据区间的多个逻辑区块地址的逻辑估计值及逻辑区块地址映射的多个实体抹除单元的实体估计值计算数据散乱度,并比较数据散乱度与阀值,以判断数据为集中或分散。藉此,可决定此数据区间是否需要进行数据整理操作,并进而提升读取数据的速度。Based on the above, the memory data sorting method, memory storage device and memory control circuit unit provided by embodiments of the present invention can be based on the logical estimation values and logical block address mapping of multiple logical block addresses in the data interval included in the instruction. Calculate the data scatter degree based on the entity estimation values of multiple entity erasure units, and compare the data scatter degree with the threshold to determine whether the data is concentrated or scattered. In this way, it can be determined whether this data interval requires data sorting operation, and thereby improve the speed of reading data.
附图说明Description of drawings
图1是根据一范例实施例所示出的主机系统、存储器存储装置及输入/输出(I/O)装置的示意图;FIG. 1 is a schematic diagram of a host system, a memory storage device, and an input/output (I/O) device according to an example embodiment;
图2是根据另一范例实施例所示出的主机系统、存储器存储装置及输入/输出(I/O)装置的示意图;FIG. 2 is a schematic diagram of a host system, a memory storage device, and an input/output (I/O) device according to another example embodiment;
图3是根据另一范例实施例所示出的主机系统与存储器存储装置的示意图;Figure 3 is a schematic diagram of a host system and a memory storage device according to another example embodiment;
图4是根据本发明的一范例实施例所示出的存储器存储装置的概要方块图;Figure 4 is a schematic block diagram of a memory storage device according to an exemplary embodiment of the present invention;
图5是根据本发明的一范例实施例所示出的存储器控制电路单元的概要方块图;FIG. 5 is a schematic block diagram of a memory control circuit unit according to an exemplary embodiment of the present invention;
图6与图7是根据本发明的一范例实施例所示出的管理实体区块的范例示意图;6 and 7 are exemplary schematic diagrams of management entity blocks according to an exemplary embodiment of the present invention;
图8是根据本发明的一范例实施例所示出的存储器的数据整理方法的流程图;Figure 8 is a flow chart of a data organizing method in a memory according to an exemplary embodiment of the present invention;
图9是根据本发明的一范例实施例所示出的存储器的数据整理方法的流程图;Figure 9 is a flow chart of a data organizing method in a memory according to an exemplary embodiment of the present invention;
图10是根据本发明的一范例实施例所示出的存储器的数据整理方法的流程图。FIG. 10 is a flow chart of a memory data organizing method according to an exemplary embodiment of the present invention.
附图标号说明Explanation of reference numbers
10、30:存储器存储装置10, 30: Memory storage device
11、31:主机系统11, 31: Host system
110:系统总线110: System bus
111:处理器111: Processor
112:随机存取存储器112: Random Access Memory
113:只读存储器113: Read-only memory
114:数据传输接口114: Data transmission interface
12:输入/输出(I/O)装置12: Input/output (I/O) device
20:主机板20: Motherboard
201:U盘201: USB flash drive
202:存储卡202: Memory card
203:固态硬盘203: Solid state drive
204:无线存储器存储装置204: Wireless memory storage device
205:全球定位系统模块205: Global Positioning System Module
206:网络接口卡206: Network interface card
207:无线传输装置207: Wireless transmission device
208:键盘208: Keyboard
209:屏幕209: Screen
210:喇叭210: Speaker
32:SD卡32: SD card
33:CF卡33: CF card
34:嵌入式存储装置34: Embedded storage device
341:嵌入式多媒体卡341: Embedded multimedia card
342:嵌入式多芯片封装存储装置342: Embedded multi-chip package storage device
402:连接接口单元402: Connect interface unit
404:存储器控制电路单元404: Memory control circuit unit
406:可复写式非易失性存储器模块406: Rewritable non-volatile memory module
410(0)~410(N):实体抹除单元410(0)~410(N): Physical erase unit
502:存储器管理电路502: Memory management circuit
504:主机接口504: Host interface
506:存储器接口506: Memory interface
508:错误检查与校正电路508: Error checking and correction circuit
510:缓冲存储器510: Buffer memory
512:电源管理电路512: Power management circuit
602:数据区602: Data area
604:闲置区604: Idle area
606:系统区606: System area
608:取代区608: Replacement area
LBA(0)~LBA(H):逻辑区块地址LBA(0)~LBA(H): logical block address
LZ(0)~LZ(M):逻辑区域LZ(0)~LZ(M): logical area
S802~S806,S902~S912,S1002~S1014:步骤。S802~S806, S902~S912, S1002~S1014: steps.
具体实施方式Detailed ways
现将详细地参考本发明的示范性实施例,示范性实施例的实例说明于附图中。只要有可能,相同元件符号在附图和描述中用来表示相同或相似部分。Reference will now be made in detail to the exemplary embodiments of the present invention, examples of which are illustrated in the accompanying drawings. Whenever possible, the same reference numbers are used in the drawings and description to refer to the same or similar parts.
一般而言,存储器存储装置(亦称,存储器存储系统)包括可复写式非易失性存储器模块与控制器(亦称,控制电路单元)。通常存储器存储装置是与主机系统一起使用,以使主机系统可将数据写入至存储器存储装置或从存储器存储装置中读取数据。Generally speaking, a memory storage device (also called a memory storage system) includes a rewritable non-volatile memory module and a controller (also called a control circuit unit). Typically a memory storage device is used with a host system so that the host system can write data to or read data from the memory storage device.
图1是根据一范例实施例所示出的主机系统、存储器存储装置及输入/输出(I/O)装置的示意图。且图2是根据另一范例实施例所示出的主机系统、存储器存储装置及输入/输出(I/O)装置的示意图。FIG. 1 is a schematic diagram of a host system, a memory storage device, and an input/output (I/O) device according to an example embodiment. 2 is a schematic diagram of a host system, a memory storage device, and an input/output (I/O) device according to another exemplary embodiment.
请参照图1与图2,主机系统11一般包括处理器111、随机存取存储器(randomaccess memory,RAM)112、只读存储器(read only memory,ROM)113及数据传输接口114。处理器111、随机存取存储器112、只读存储器113及数据传输接口114皆耦接至系统总线(system bus)110。Referring to FIGS. 1 and 2 , the host system 11 generally includes a processor 111 , a random access memory (RAM) 112 , a read only memory (ROM) 113 and a data transmission interface 114 . The processor 111 , the random access memory 112 , the read-only memory 113 and the data transmission interface 114 are all coupled to a system bus 110 .
在本范例实施例中,主机系统11是通过数据传输接口114与存储器存储装置10耦接。例如,主机系统11可经由数据传输接口114将数据写入至存储器存储装置10或从存储器存储装置10中读取数据。此外,主机系统11是通过系统总线110与I/O装置12耦接。例如,主机系统11可经由系统总线110将输出信号传送至I/O装置12或从I/O装置12接收输入信号。In this exemplary embodiment, the host system 11 is coupled to the memory storage device 10 through the data transmission interface 114 . For example, the host system 11 can write data to or read data from the memory storage device 10 via the data transmission interface 114 . In addition, the host system 11 is coupled to the I/O device 12 through the system bus 110 . For example, host system 11 may transmit output signals to or receive input signals from I/O device 12 via system bus 110 .
在本范例实施例中,处理器111、随机存取存储器112、只读存储器113及数据传输接口114是可设置在主机系统11的主机板20上。数据传输接口114的数目可以是一或多个。通过数据传输接口114,主机板20可以经由有线或无线方式耦接至存储器存储装置10。存储器存储装置10可例如是U盘201、存储卡202、固态硬盘(Solid State Drive,SSD)203或无线存储器存储装置204。无线存储器存储装置204可例如是近距离无线通信(Near FieldCommunication Storage,NFC)存储器存储装置、无线传真(WiFi)存储器存储装置、蓝牙(Bluetooth)存储器存储装置或低功耗蓝牙存储器存储装置(例如,iBeacon)等以各式无线通信技术为基础的存储器存储装置。此外,主机板20也可以通过系统总线110耦接至全球定位系统(Global Positioning System,GPS)模块205、网络接口卡206、无线传输装置207、键盘208、屏幕209、喇叭210等各式I/O装置。例如,在一范例实施例中,主机板20可通过无线传输装置207存取无线存储器存储装置204。In this exemplary embodiment, the processor 111 , the random access memory 112 , the read-only memory 113 and the data transmission interface 114 can be disposed on the motherboard 20 of the host system 11 . The number of data transmission interfaces 114 may be one or more. Through the data transmission interface 114, the motherboard 20 can be coupled to the memory storage device 10 via wired or wireless methods. The memory storage device 10 may be, for example, a USB flash drive 201, a memory card 202, a solid state drive (SSD) 203 or a wireless memory storage device 204. The wireless memory storage device 204 may be, for example, a Near Field Communication Storage (NFC) memory storage device, a wireless fax (WiFi) memory storage device, a Bluetooth (Bluetooth) memory storage device, or a Bluetooth low energy memory storage device (eg, iBeacon) and other memory storage devices based on various wireless communication technologies. In addition, the motherboard 20 can also be coupled to various I/Os such as a Global Positioning System (GPS) module 205, a network interface card 206, a wireless transmission device 207, a keyboard 208, a screen 209, a speaker 210, etc. through the system bus 110. O device. For example, in an exemplary embodiment, the motherboard 20 can access the wireless memory storage device 204 through the wireless transmission device 207 .
在一范例实施例中,所提及的主机系统为可实质地与存储器存储装置配合以存储数据的任意系统。虽然在上述范例实施例中,主机系统是以电脑系统来作说明,然而,图3是根据另一范例实施例所示出的主机系统与存储器存储装置的示意图。请参照图3,在另一范例实施例中,主机系统31也可以是数码相机、摄影机、通信装置、音频播放器、视频播放器或平板电脑等系统,而存储器存储装置30可为其所使用的SD卡32、CF卡33或嵌入式存储装置34等各式非易失性存储器存储装置。嵌入式存储装置34包括嵌入式多媒体卡(embeddedMMC,eMMC)341和/或嵌入式多芯片封装(embedded Multi Chip Package,eMCP)存储装置342等各类型将存储器模块直接耦接于主机系统的基板上的嵌入式存储装置。In an example embodiment, the host system is substantially any system that can cooperate with a memory storage device to store data. Although in the above exemplary embodiment, the host system is described as a computer system, FIG. 3 is a schematic diagram of a host system and a memory storage device according to another exemplary embodiment. Please refer to FIG. 3 . In another exemplary embodiment, the host system 31 can also be a digital camera, video camera, communication device, audio player, video player or tablet computer, and the memory storage device 30 can be used therefor. Various non-volatile memory storage devices such as SD card 32, CF card 33 or embedded storage device 34. The embedded storage device 34 includes an embedded multimedia card (embeddedMMC, eMMC) 341 and/or an embedded multi-chip package (embedded Multi Chip Package, eMCP) storage device 342. The memory module is directly coupled to the substrate of the host system. embedded storage device.
图4是根据本发明的一范例实施例所示出的存储器存储装置的概要方块图。请参照图4,存储器存储装置10包括连接接口单元402、存储器控制电路单元404与可复写式非易失性存储器模块406。FIG. 4 is a schematic block diagram of a memory storage device according to an exemplary embodiment of the present invention. Referring to FIG. 4 , the memory storage device 10 includes a connection interface unit 402 , a memory control circuit unit 404 and a rewritable non-volatile memory module 406 .
连接接口单元402用以将存储器存储装置10耦接至主机系统11。存储器存储装置10可通过连接接口单元402与主机系统11通信。在本范例实施例中,连接接口单元402是相容于串行高级技术附件(Serial Advanced Technology Attachment,SATA)标准。然而,必须了解的是,本发明不限于此,连接接口单元402亦可以是符合并行高级技术附件(Parallel Advanced Technology Attachment,PATA)标准、电气和电子工程师协会(Institute of Electrical and Electronic Engineers,IEEE)1394标准、高速周边零件连接接口(Peripheral Component Interconnect Express,PCI Express)标准、通用串行总线(Universal Serial Bus,USB)标准、SD接口标准、超高速一代(Ultra High Speed-I,UHS-I)接口标准、超高速二代(Ultra High Speed-II,UHS-II)接口标准、存储棒(MemoryStick,MS)接口标准、MCP接口标准、MMC接口标准、eMMC接口标准、通用快闪存储器(Universal Flash Storage,UFS)接口标准、eMCP接口标准、CF接口标准、整合式驱动电子接口(Integrated Device Electronics,IDE)标准或其他适合的标准。连接接口单元402可与存储器控制电路单元404封装在一个芯片中,或者连接接口单元402是布设于一包含存储器控制电路单元404的芯片外。The connection interface unit 402 is used to couple the memory storage device 10 to the host system 11 . The memory storage device 10 may communicate with the host system 11 through the connection interface unit 402 . In this exemplary embodiment, the connection interface unit 402 is compatible with the Serial Advanced Technology Attachment (SATA) standard. However, it must be understood that the present invention is not limited thereto, and the connection interface unit 402 may also be in compliance with the Parallel Advanced Technology Attachment (PATA) standard, Institute of Electrical and Electronic Engineers (IEEE) 1394 standard, high-speed peripheral component interface (Peripheral Component Interconnect Express, PCI Express) standard, Universal Serial Bus (USB) standard, SD interface standard, Ultra High Speed-I (UHS-I) Interface standards, Ultra High Speed-II (UHS-II) interface standards, Memory Stick (MS) interface standards, MCP interface standards, MMC interface standards, eMMC interface standards, Universal Flash Memory (Universal Flash Storage (UFS) interface standard, eMCP interface standard, CF interface standard, Integrated Device Electronics (IDE) standard or other suitable standards. The connection interface unit 402 and the memory control circuit unit 404 may be packaged in a chip, or the connection interface unit 402 may be arranged outside a chip including the memory control circuit unit 404.
存储器控制电路单元404用以执行以硬件型式或固件型式实作的多个逻辑门或控制指令并且根据主机系统11的指令在可复写式非易失性存储器模块406中进行数据的写入、读取与抹除等运作。The memory control circuit unit 404 is used to execute multiple logic gates or control instructions implemented in hardware or firmware and write and read data in the rewritable non-volatile memory module 406 according to the instructions of the host system 11 Operations such as fetching and erasing.
可复写式非易失性存储器模块406是耦接至存储器控制电路单元404并且用以存储主机系统11所写入的数据。可复写式非易失性存储器模块406可以是单阶存储单元(Single Level Cell,SLC)NAND型快闪存储器模块(即,一个存储单元中可存储1个比特的快闪存储器模块)、多阶存储单元(Multi Level Cell,MLC)NAND型快闪存储器模块(即,一个存储单元中可存储2个比特的快闪存储器模块)、三阶存储单元(Triple Level Cell,TLC)NAND型快闪存储器模块(即,一个存储单元中可存储3个比特的快闪存储器模块)、四阶存储单元(Quad Level Cell,QLC)NAND型快闪存储器模块(即,一个存储单元中可存储4个比特的快闪存储器模块)、其他快闪存储器模块或其他具有相同特性的存储器模块。The rewritable non-volatile memory module 406 is coupled to the memory control circuit unit 404 and used to store data written by the host system 11 . The rewritable non-volatile memory module 406 may be a single-level cell (SLC) NAND flash memory module (that is, a flash memory module that can store 1 bit in one memory cell), a multi-level Memory cell (Multi Level Cell, MLC) NAND type flash memory module (that is, a flash memory module that can store 2 bits in one memory cell), Triple Level Cell (Triple Level Cell, TLC) NAND type flash memory module (that is, a flash memory module that can store 3 bits in one storage unit), Quad Level Cell (QLC) NAND flash memory module (that is, a flash memory module that can store 4 bits in one storage unit) flash memory module), other flash memory modules, or other memory modules with the same characteristics.
可复写式非易失性存储器模块406中的每一个存储单元是以电压(以下亦称为临界电压)的改变来存储一或多个比特。具体来说,每一个存储单元的控制栅极(controlgate)与通道之间有一个电荷捕捉层。通过施予一写入电压至控制栅极,可以改变电荷补捉层的电子量,进而改变存储单元的临界电压。此改变存储单元的临界电压的操作亦称为“把数据写入至存储单元”或“程序化(programming)存储单元”。随着临界电压的改变,可复写式非易失性存储器模块406中的每一个存储单元具有多个存储状态。通过施予读取电压可以判断一个存储单元是属于哪一个存储状态,藉此取得此存储单元所存储的一或多个比特。Each memory cell in the rewritable non-volatile memory module 406 stores one or more bits based on changes in voltage (hereinafter also referred to as critical voltage). Specifically, there is a charge trapping layer between the control gate and the channel of each memory cell. By applying a write voltage to the control gate, the amount of electrons in the charge trapping layer can be changed, thereby changing the critical voltage of the memory cell. This operation of changing the threshold voltage of the memory cell is also called "writing data to the memory cell" or "programming the memory cell." As the threshold voltage changes, each memory cell in the rewritable non-volatile memory module 406 has multiple memory states. By applying a read voltage, it is possible to determine which storage state a memory cell belongs to, thereby obtaining one or more bits stored in the memory cell.
在本范例实施例中,可复写式非易失性存储器模块406的存储单元可构成多个实体程序化单元,并且此些实体程序化单元可构成多个实体抹除单元。具体来说,同一条字线上的存储单元可组成一或多个实体程序化单元。若每一个存储单元可存储2个以上的比特,则同一条字线上的实体程序化单元可至少可被分类为下实体程序化单元与上实体程序化单元。例如,一存储单元的最低有效位(Least Significant Bit,LSB)是属于下实体程序化单元,并且一存储单元的最高有效位(Most Significant Bit,MSB)是属于上实体程序化单元。一般来说,在MLC NAND型快闪存储器中,下实体程序化单元的写入速度会大于上实体程序化单元的写入速度,和/或下实体程序化单元的可靠度是高于上实体程序化单元的可靠度。In this exemplary embodiment, the storage units of the rewritable non-volatile memory module 406 may constitute multiple physical programming units, and these physical programming units may constitute multiple physical erasing units. Specifically, memory cells on the same word line may form one or more physical programming units. If each storage unit can store more than 2 bits, the physical programming units on the same word line can be at least classified into lower physical programming units and upper physical programming units. For example, the Least Significant Bit (LSB) of a storage unit belongs to the lower physical programming unit, and the Most Significant Bit (MSB) of a storage unit belongs to the upper physical programming unit. Generally speaking, in MLC NAND flash memory, the writing speed of the lower physical programming unit will be greater than the writing speed of the upper physical programming unit, and/or the reliability of the lower physical programming unit is higher than that of the upper physical programming unit. Reliability of programmed units.
在本范例实施例中,实体程序化单元为程序化的最小单元。即,实体程序化单元为写入数据的最小单元。例如,实体程序化单元可为实体页面(page)或是实体扇(sector)。若实体程序化单元为实体页面,则此些实体程序化单元可包括数据比特区与冗余(redundancy)比特区。数据比特区包含多个实体扇,用以存储使用者数据,而冗余比特区用以存储系统数据(例如,错误更正码等管理数据)。在本范例实施例中,数据比特区包含32个实体扇,且一个实体扇的大小为512字节(byte,B)。然而,在其他范例实施例中,数据比特区中也可包含8个、16个或数目更多或更少的实体扇,并且每一个实体扇的大小也可以是更大或更小。另一方面,实体抹除单元为抹除的最小单位。亦即,每一实体抹除单元含有最小数目之一并被抹除的存储单元。例如,实体抹除单元为实体区块(block)。In this exemplary embodiment, the physical programming unit is the smallest unit of programming. That is, the physical programming unit is the smallest unit for writing data. For example, the entity programming unit may be an entity page (page) or an entity sector (sector). If the physical programming units are physical pages, these physical programming units may include data bit areas and redundancy bit areas. The data bit area contains multiple physical sectors to store user data, while the redundant bit area is used to store system data (for example, management data such as error correction codes). In this exemplary embodiment, the data bit area includes 32 physical sectors, and the size of one physical sector is 512 bytes (byte, B). However, in other example embodiments, the data bit zone may also include 8, 16, or more or less physical sectors, and the size of each physical sector may also be larger or smaller. On the other hand, the physical erasure unit is the smallest unit of erasure. That is, each physical erase unit contains one of the minimum number of erased memory cells. For example, the physical erasure unit is a physical block.
图5是根据本发明的一范例实施例所示出的存储器控制电路单元的概要方块图。请参照图5,存储器控制电路单元404包括存储器管理电路502、主机接口504及存储器接口506。FIG. 5 is a schematic block diagram of a memory control circuit unit according to an exemplary embodiment of the present invention. Referring to FIG. 5 , the memory control circuit unit 404 includes a memory management circuit 502 , a host interface 504 and a memory interface 506 .
存储器管理电路502用以控制存储器控制电路单元404的整体运作。具体来说,存储器管理电路502具有多个控制指令,并且在存储器存储装置10运作时,此些控制指令会被执行以进行数据的写入、读取与抹除等运作。以下说明存储器管理电路502的操作时,等同于说明存储器控制电路单元404的操作。The memory management circuit 502 is used to control the overall operation of the memory control circuit unit 404. Specifically, the memory management circuit 502 has a plurality of control instructions, and when the memory storage device 10 is operating, these control instructions will be executed to perform data writing, reading, erasing and other operations. When the operation of the memory management circuit 502 is described below, it is equivalent to describing the operation of the memory control circuit unit 404.
在本范例实施例中,存储器管理电路502的控制指令是以固件型式来实作。例如,存储器管理电路502具有微处理器单元(未示出)与只读存储器(未示出),并且此些控制指令是被烧录至此只读存储器中。当存储器存储装置10运作时,此些控制指令会由微处理器单元来执行以进行数据的写入、读取与抹除等运作。In this exemplary embodiment, the control instructions of the memory management circuit 502 are implemented in firmware form. For example, the memory management circuit 502 has a microprocessor unit (not shown) and a read-only memory (not shown), and the control instructions are burned into the read-only memory. When the memory storage device 10 is operating, these control instructions will be executed by the microprocessor unit to perform data writing, reading, erasing and other operations.
在另一范例实施例中,存储器管理电路502的控制指令亦可以代码型式存储于可复写式非易失性存储器模块406的特定区域(例如,存储器模块中专用于存放系统数据的系统区)中。此外,存储器管理电路502具有微处理器单元(未示出)、只读存储器(未示出)及随机存取存储器(未示出)。特别是,此只读存储器具有开机码(boot code),并且当存储器控制电路单元404被致能时,微处理器单元会先执行此开机码来将存储于可复写式非易失性存储器模块406中的控制指令载入至存储器管理电路502的随机存取存储器中。之后,微处理器单元会运转此些控制指令以进行数据的写入、读取与抹除等运作。In another exemplary embodiment, the control instructions of the memory management circuit 502 can also be stored in a specific area of the rewritable non-volatile memory module 406 in code form (for example, a system area in the memory module dedicated to storing system data). . In addition, the memory management circuit 502 has a microprocessor unit (not shown), a read-only memory (not shown), and a random access memory (not shown). In particular, this read-only memory has a boot code, and when the memory control circuit unit 404 is enabled, the microprocessor unit will first execute the boot code to store the data in the rewritable non-volatile memory module. The control instructions in 406 are loaded into the random access memory of the memory management circuit 502 . Afterwards, the microprocessor unit will run these control instructions to perform operations such as writing, reading and erasing data.
此外,在另一范例实施例中,存储器管理电路502的控制指令亦可以一硬件型式来实作。例如,存储器管理电路502包括微控制器、存储单元管理电路、存储器写入电路、存储器读取电路、存储器抹除电路与数据处理电路。存储单元管理电路、存储器写入电路、存储器读取电路、存储器抹除电路与数据处理电路是耦接至微控制器。存储单元管理电路用以管理可复写式非易失性存储器模块406的存储单元或存储单元群组。存储器写入电路用以对可复写式非易失性存储器模块406下达写入指令序列以将数据写入至可复写式非易失性存储器模块406中。存储器读取电路用以对可复写式非易失性存储器模块406下达读取指令序列以从可复写式非易失性存储器模块406中读取数据。存储器抹除电路用以对可复写式非易失性存储器模块406下达抹除指令序列以将数据从可复写式非易失性存储器模块406中抹除。数据处理电路用以处理欲写入至可复写式非易失性存储器模块406的数据以及从可复写式非易失性存储器模块406中读取的数据。写入指令序列、读取指令序列及抹除指令序列可分别包括一或多个代码或指令码并且用以指示可复写式非易失性存储器模块406执行相对应的写入、读取及抹除等操作。在一范例实施例中,存储器管理电路502还可以下达其他类型的指令序列给可复写式非易失性存储器模块406以指示执行相对应的操作。In addition, in another exemplary embodiment, the control instructions of the memory management circuit 502 can also be implemented in a hardware form. For example, the memory management circuit 502 includes a microcontroller, a memory unit management circuit, a memory writing circuit, a memory reading circuit, a memory erasing circuit and a data processing circuit. The memory cell management circuit, the memory writing circuit, the memory reading circuit, the memory erasing circuit and the data processing circuit are coupled to the microcontroller. The memory cell management circuit is used to manage the memory cells or memory cell groups of the rewritable non-volatile memory module 406 . The memory writing circuit is used to issue a write instruction sequence to the rewritable non-volatile memory module 406 to write data into the rewritable non-volatile memory module 406 . The memory reading circuit is used to issue a read instruction sequence to the rewritable non-volatile memory module 406 to read data from the rewritable non-volatile memory module 406 . The memory erasure circuit is used to issue an erasure instruction sequence to the rewritable non-volatile memory module 406 to erase data from the rewritable non-volatile memory module 406 . The data processing circuit is used to process data to be written to the rewritable non-volatile memory module 406 and data to be read from the rewritable non-volatile memory module 406 . The write command sequence, the read command sequence and the erase command sequence may respectively include one or more codes or instruction codes and are used to instruct the rewritable non-volatile memory module 406 to perform corresponding writing, reading and erasing. Divide and other operations. In an exemplary embodiment, the memory management circuit 502 can also issue other types of instruction sequences to the rewritable non-volatile memory module 406 to instruct the execution of corresponding operations.
主机接口504是耦接至存储器管理电路502。存储器管理电路502可通过主机接口504与主机系统11通信。主机接口504可用以接收与识别主机系统11所传送的指令与数据。例如,主机系统11所传送的指令与数据可通过主机接口504来传送至存储器管理电路502。此外,存储器管理电路502可通过主机接口504将数据传送至主机系统11。在本范例实施例中,主机接口504是相容于SATA标准。然而,必须了解的是本发明不限于此,主机接口504亦可以是相容于PATA标准、IEEE 1394标准、PCI Express标准、USB标准、SD标准、UHS-I标准、UHS-II标准、MS标准、MMC标准、eMMC标准、UFS标准、CF标准、IDE标准或其他适合的数据传输标准。Host interface 504 is coupled to memory management circuit 502 . Memory management circuitry 502 may communicate with host system 11 through host interface 504. The host interface 504 can be used to receive and identify instructions and data transmitted by the host system 11 . For example, instructions and data transmitted by the host system 11 may be transmitted to the memory management circuit 502 through the host interface 504 . In addition, the memory management circuit 502 can transmit data to the host system 11 through the host interface 504 . In this example embodiment, the host interface 504 is compatible with the SATA standard. However, it must be understood that the present invention is not limited thereto. The host interface 504 may also be compatible with the PATA standard, IEEE 1394 standard, PCI Express standard, USB standard, SD standard, UHS-I standard, UHS-II standard, and MS standard. , MMC standard, eMMC standard, UFS standard, CF standard, IDE standard or other suitable data transmission standards.
存储器接口506是耦接至存储器管理电路502并且用以存取可复写式非易失性存储器模块406。也就是说,欲写入至可复写式非易失性存储器模块406的数据会经由存储器接口506转换为可复写式非易失性存储器模块406所能接受的格式。具体来说,若存储器管理电路502要存取可复写式非易失性存储器模块406,存储器接口506会传送对应的指令序列。例如,这些指令序列可包括指示写入数据的写入指令序列、指示读取数据的读取指令序列、指示抹除数据的抹除指令序列、以及用以指示各种存储器操作(例如,改变读取电压电平或执行垃圾收集操作等)的相对应的指令序列。这些指令序列例如是由存储器管理电路502产生并且通过存储器接口506传送至可复写式非易失性存储器模块406。这些指令序列可包括一或多个信号,或是在总线上的数据。这些信号或数据可包括指令码或代码。例如,在读取指令序列中,会包括读取的识别码、存储器地址等信息。The memory interface 506 is coupled to the memory management circuit 502 and used to access the rewritable non-volatile memory module 406 . That is to say, the data to be written to the rewritable non-volatile memory module 406 will be converted into a format acceptable to the rewritable non-volatile memory module 406 through the memory interface 506 . Specifically, if the memory management circuit 502 wants to access the rewritable non-volatile memory module 406, the memory interface 506 will transmit a corresponding instruction sequence. For example, these instruction sequences may include a write instruction sequence instructing to write data, a read instruction sequence instructing to read data, an erase instruction sequence instructing to erase data, and to instruct various memory operations (e.g., change read corresponding instruction sequence to obtain voltage levels or perform garbage collection operations, etc.). These instruction sequences are generated, for example, by the memory management circuit 502 and transmitted to the rewritable non-volatile memory module 406 through the memory interface 506 . These command sequences may include one or more signals, or data on the bus. These signals or data may include instruction codes or codes. For example, the read instruction sequence will include the read identification code, memory address and other information.
在一范例实施例中,存储器控制电路单元404还包括错误检查与校正电路508、缓冲存储器510与电源管理电路512。In an exemplary embodiment, the memory control circuit unit 404 also includes an error checking and correction circuit 508, a buffer memory 510 and a power management circuit 512.
错误检查与校正电路508是耦接至存储器管理电路502并且用以执行错误检查与校正操作以确保数据的正确性。具体来说,当存储器管理电路502从主机系统11中接收到写入指令时,错误检查与校正电路508会为对应此写入指令的数据产生对应的错误更正码(error correcting code,ECC)和/或错误检查码(error detecting code,EDC),并且存储器管理电路502会将对应此写入指令的数据与对应的错误更正码和/或错误检查码写入至可复写式非易失性存储器模块406中。之后,当存储器管理电路502从可复写式非易失性存储器模块406中读取数据时会同时读取此数据对应的错误更正码和/或错误检查码,并且错误检查与校正电路508会依据此错误更正码和/或错误检查码对所读取的数据执行错误检查与校正操作。The error checking and correcting circuit 508 is coupled to the memory management circuit 502 and is used to perform error checking and correcting operations to ensure the accuracy of data. Specifically, when the memory management circuit 502 receives a write command from the host system 11, the error checking and correction circuit 508 generates a corresponding error correcting code (ECC) and /or error detecting code (EDC), and the memory management circuit 502 will write the data corresponding to this write instruction and the corresponding error correction code and/or error checking code into the rewritable non-volatile memory In module 406. Afterwards, when the memory management circuit 502 reads data from the rewritable non-volatile memory module 406, it will also read the error correction code and/or error checking code corresponding to the data, and the error checking and correction circuit 508 will This error correction code and/or error checking code performs error checking and correction operations on the data being read.
缓冲存储器510是耦接至存储器管理电路502并且用以暂存来自于主机系统11的数据与指令或来自于可复写式非易失性存储器模块406的数据。电源管理电路512是耦接至存储器管理电路502并且用以控制存储器存储装置10的电源。The buffer memory 510 is coupled to the memory management circuit 502 and used to temporarily store data and instructions from the host system 11 or data from the rewritable non-volatile memory module 406 . The power management circuit 512 is coupled to the memory management circuit 502 and used to control the power supply of the memory storage device 10 .
在一范例实施例中,图4的可复写式非易失性存储器模块406亦称为快闪(flash)存储器模块,且存储器控制电路单元404亦称为用于控制快闪存储器模块的快闪存储器控制器。在一范例实施例中,图5的存储器管理电路502亦称为快闪存储器管理电路。In an exemplary embodiment, the rewritable non-volatile memory module 406 of FIG. 4 is also called a flash memory module, and the memory control circuit unit 404 is also called a flash memory module for controlling the flash memory module. memory controller. In an exemplary embodiment, the memory management circuit 502 of FIG. 5 is also called a flash memory management circuit.
图6与图7是根据本发明的一范例实施例所示出的管理实体区块的范例示意图。请参照图6,存储器控制电路单元404(或存储器管理电路502)会将实体抹除单元410(0)~410(N)逻辑地分组为数据区602、闲置区604、系统区606与取代区608。6 and 7 are exemplary schematic diagrams of management entity blocks according to an exemplary embodiment of the present invention. Referring to FIG. 6, the memory control circuit unit 404 (or the memory management circuit 502) will logically group the physical erasure units 410(0)˜410(N) into a data area 602, an idle area 604, a system area 606 and a replacement area. 608.
逻辑上属于数据区602与闲置区604的实体抹除单元是用以存储来自于主机系统11的数据。具体来说,数据区602的实体抹除单元是被视为已存储数据的实体抹除单元,而闲置区604的实体抹除单元是用以替换数据区602的实体抹除单元。也就是说,当从主机系统11接收到写入指令与欲写入的数据时,存储器控制电路单元404(或存储器管理电路502)会使用从闲置区604中提取实体抹除单元来写入数据,以替换数据区602的实体抹除单元。The physical erase units logically belonging to the data area 602 and the free area 604 are used to store data from the host system 11 . Specifically, the physically erased units of the data area 602 are regarded as the physically erased units that have stored data, and the physically erased units of the free area 604 are used to replace the physical erased units of the data area 602 . That is to say, when receiving a write command and data to be written from the host system 11, the memory control circuit unit 404 (or the memory management circuit 502) will use the physical erase unit to extract the data from the idle area 604 to write the data. , to replace the physically erased unit of the data area 602.
逻辑上属于系统区606的实体抹除单元是用以记录系统数据。例如,系统数据包括关于可复写式非易失性存储器模块的制造商与型号、可复写式非易失性存储器模块的实体抹除单元数、每一实体抹除单元的实体程序化单元数等。The physical erasure unit logically belonging to the system area 606 is used to record system data. For example, the system data includes information about the manufacturer and model of the rewritable non-volatile memory module, the number of physical erasure units of the rewritable non-volatile memory module, the number of physical programming units for each physical erasure unit, etc. .
逻辑上属于取代区608中的实体抹除单元是用于坏实体抹除单元取代程序,以取代损坏的实体抹除单元。具体来说,倘若取代区608中仍存有正常的实体抹除单元并且数据区602的实体抹除单元损坏时,存储器控制电路单元404(或存储器管理电路502)会从取代区608中提取正常的实体抹除单元来更换损坏的实体抹除单元。The physical erase units logically belonging to the replacement area 608 are used for the bad physical erase unit replacement process to replace the damaged physical erase units. Specifically, if there are still normal physical erasure units in the replacement area 608 and the physical erasure units in the data area 602 are damaged, the memory control circuit unit 404 (or the memory management circuit 502) will extract the normal physical erasure units from the replacement area 608. Use the physical erasure unit to replace the damaged physical erasure unit.
特别是,数据区602、闲置区604、系统区606与取代区608的实体抹除单元的数量会根据不同的存储器规格而有所不同。此外,必须了解的是,在存储器存储装置10的运作中,实体抹除单元关联至数据区602、闲置区604、系统区606与取代区608的分组关系会动态地变动。例如,当闲置区604中的实体抹除单元损坏而被取代区608的实体抹除单元取代时,则原本取代区608的实体抹除单元会被关联至闲置区604。In particular, the number of physical erase units in the data area 602, the free area 604, the system area 606 and the replacement area 608 will vary according to different memory specifications. In addition, it must be understood that during the operation of the memory storage device 10 , the grouping relationship between the physical erasure unit and the data area 602 , the free area 604 , the system area 606 and the replacement area 608 may dynamically change. For example, when the physical erasure unit in the free area 604 is damaged and replaced by the physical erasure unit in the replacement area 608, the physical erasure unit originally in the replacement area 608 will be associated with the free area 604.
请参照图7,存储器控制电路单元404(或存储器管理电路502)会配置逻辑区块地址LBA(0)~LBA(H)以映射数据区602的实体抹除单元,其中每一逻辑区块地址具有多个逻辑地址以映射对应的实体抹除单元的实体程序化单元。并且,当主机系统11欲写入数据至逻辑地址或更新存储于逻辑地址中的数据时,存储器控制电路单元404(或存储器管理电路502)会从闲置区604中提取一个实体抹除单元作为作动实体抹除单元来写入数据,以轮替数据区602的实体抹除单元。并且,当此作为作动实体抹除单元的实体抹除单元被写满时,存储器管理电路502会再从闲置区604中提取空的实体抹除单元作为作动实体抹除单元,以继续写入对应来自于主机系统1000的写入指令的更新数据。此外,当闲置区604中可用的实体抹除单元的数目小于预设值时,存储器管理电路502会执行垃圾收集(garbagecollection)操作(亦称为,有效数据合并操作)来整理数据区602中的有效数据,以将数据区602中无存储有效数据的实体抹除单元重新关联至闲置区604。Referring to FIG. 7 , the memory control circuit unit 404 (or the memory management circuit 502 ) configures the logical block addresses LBA(0)˜LBA(H) to map the physical erase unit of the data area 602 , where each logical block address A physical programming unit having multiple logical addresses to map corresponding physical erasure units. Moreover, when the host system 11 wants to write data to a logical address or update data stored in the logical address, the memory control circuit unit 404 (or the memory management circuit 502) will extract a physical erase unit from the idle area 604 as a function. The physical erase unit is moved to write data to alternate the physical erase units of the data area 602. Moreover, when the physical erasure unit as the active physical erasure unit is full, the memory management circuit 502 will extract an empty physical erasure unit from the idle area 604 as an active physical erasure unit to continue writing. Update data corresponding to the write command from the host system 1000 is entered. In addition, when the number of available physical erase units in the free area 604 is less than a preset value, the memory management circuit 502 will perform a garbage collection operation (also known as a valid data merging operation) to organize the data in the data area 602 Valid data, so as to re-associate the physical erase units in the data area 602 that do not store valid data to the idle area 604.
需先说明的是,以下说明存储器控制电路单元404的操作时,可视为说明存储器管理电路502的操作。It should be noted that when the operation of the memory control circuit unit 404 is described below, it can be regarded as describing the operation of the memory management circuit 502 .
为了解决连续的数据散乱在不同的实体页面而造成数据读取速度变慢的问题,本实施例的存储器的数据整理方法用于包括可复写式非易失性存储器模块406的存储器存储装置10,可通过分析数据为集中或散乱来决定是否重整数据。在另一实施例中,还可通过分析数据是否均匀分布在各通道来决定是否重整数据。在又一实施例中,更可同时分析数据为集中或散乱,并分析数据是否均匀分布在各通道来决定是否重整数据。In order to solve the problem of slow data reading speed caused by continuous data being scattered in different physical pages, the data organization method of the memory in this embodiment is used in the memory storage device 10 including the rewritable non-volatile memory module 406. You can decide whether to reshape the data by analyzing whether it is concentrated or scattered. In another embodiment, whether to reshape the data can also be determined by analyzing whether the data is evenly distributed in each channel. In yet another embodiment, it is possible to simultaneously analyze whether the data is concentrated or scattered, and whether the data is evenly distributed in each channel to determine whether to reorganize the data.
存储器控制电路单元404从主机系统11接收指令。主机系统11传送的指令为碎片重组(defragment)指令,并且指令包括数据区间。此数据区间即是主机系统11判断需要进行数据整理操作的范围。The memory control circuit unit 404 receives instructions from the host system 11 . The instruction transmitted by the host system 11 is a defragment instruction, and the instruction includes a data interval. This data interval is the range within which the host system 11 determines that data sorting operation is required.
在本实施例中,存储器控制电路单元404从主机系统11接收指令后,可根据数据区间的多个逻辑区块地址(Logical Block Address,LBA)的逻辑估计值及这些逻辑区块地址映射的多个实体抹除单元的实体估计值计算数据散乱度。并且,存储器控制电路单元404可根据数据散乱度与一阀值判断是否执行数据整理操作以根据逻辑区块地址搬移实体抹除单元中的数据。存储器控制电路单元404执行数据整理操作,可根据逻辑区块地址将属于逻辑区块地址中连续的逻辑子单元分别映射的实体抹除单元复制至相同的实体抹除单元中。在此,连续的逻辑子单元是指其中一个逻辑子单元的逻辑区块地址是接续在另一个逻辑子单元的逻辑区块地址之后。换句话说,其中一个逻辑子单元的起始逻辑区块地址是接续在另一个逻辑子单元的结束逻辑区块地址之后。须注意的是,所属技术领域技术人员应当知晓如何执行数据整理操作,故在此便不赘述。In this embodiment, after receiving the instruction from the host system 11, the memory control circuit unit 404 can calculate the logical estimation values of multiple logical block addresses (Logical Block Address, LBA) in the data interval and the number of mappings of these logical block addresses. The entity estimation value of each entity erasure unit is used to calculate the data scatter. Furthermore, the memory control circuit unit 404 can determine whether to perform a data sorting operation to move the data in the physical erasure unit according to the logical block address according to the data fragmentation degree and a threshold value. The memory control circuit unit 404 performs a data sorting operation and can copy the physical erasure units corresponding to the respective mappings of the consecutive logical subunits in the logical block address to the same physical erasure unit according to the logical block address. Here, continuous logical subunits means that the logical block address of one logical subunit continues after the logical block address of another logical subunit. In other words, the starting logical block address of one logical subunit is continued after the ending logical block address of another logical subunit. It should be noted that those skilled in the art should know how to perform data sorting operations, so they will not be described in detail here.
在第一实施例中,数据的散乱度是通过分析数据为集中或散乱来决定。亦即,通过判断数据对应的实体抹除单元实际分布在实体页面的实体页面数量来决定数据为集中或是散乱,并根据判断结果决定是否重整数据。In the first embodiment, the degree of data scatter is determined by analyzing whether the data is concentrated or scattered. That is, whether the data is concentrated or scattered is determined by judging the number of physical pages that the physical erasure units corresponding to the data are actually distributed on the physical page, and whether to reorganize the data is decided based on the judgment result.
详细而言,假设一个实体页面的容量为16K,而存储器控制电路单元404从主机系统11接收到的指令包括的数据区间为一段连续逻辑行地址LCA(0)~LCA(7),总共8个4K的数据,即32K的数据。理想上32K的数据只需要用2个实体页面来存储。换句话说,在最小实体配置量的状况下,32K的数据排列分布在32/16=2个实体页面,存储器控制电路单元404只需要读取两次可复写式非易失性存储器模块406即可读取所有数据。然而若在最大实体配置量的状况下,32K的数据排列分布在32/4=8个实体页面,存储器控制电路单元404则需要读取八次可复写式非易失性存储器模块406才可读取所有数据,而会造成读取速度较慢。基此,本实施例提供的方法计算逻辑估计值与实体估计值,并根据逻辑估计值(即,最小实体配置量)与实体估计值(即,实际实体配置量)的比值决定数据散乱度,以判断数据为集中或散乱。并且将计算出的数据散乱度与一阀值(亦称第一阀值)比较以判断是否执行数据整理。于此,第一阀值例如预设为0.75或其他预设阀值,本发明不加以限制。In detail, assume that the capacity of a physical page is 16K, and the instruction received by the memory control circuit unit 404 from the host system 11 includes a data interval of a continuous logical row address LCA(0)~LCA(7), a total of 8 4K data is 32K data. Ideally, 32K of data only needs to be stored in 2 physical pages. In other words, under the condition of minimum physical configuration, 32K data is arranged in 32/16 = 2 physical pages, and the memory control circuit unit 404 only needs to read the rewritable non-volatile memory module 406 twice. All data can be read. However, if under the maximum physical configuration, 32K data is arranged in 32/4 = 8 physical pages, the memory control circuit unit 404 needs to read the rewritable non-volatile memory module 406 eight times before it can be read. fetch all the data, resulting in slower reading speed. Based on this, the method provided by this embodiment calculates the logical estimate value and the entity estimate value, and determines the data scatter degree based on the ratio of the logical estimate value (ie, the minimum entity configuration amount) and the entity estimate value (ie, the actual entity configuration amount), Determine whether the data is concentrated or scattered. And the calculated data scatter degree is compared with a threshold (also called the first threshold) to determine whether to perform data sorting. Here, the first threshold is, for example, preset to 0.75 or other preset thresholds, which is not limited by the present invention.
具体而言,存储器控制电路单元404从主机系统11接收指令后,可根据指令包括的数据区间的逻辑区块地址的逻辑区块数量、逻辑区块容量与可复写式非易失性存储器模块406的实体页面容量计算逻辑估计值。详细而言,存储器控制电路单元404根据逻辑区块数量与逻辑区块容量计算数据区间的数据容量,并根据数据容量与可复写式非易失性存储器模块406的实体页面容量计算逻辑估计值。Specifically, after receiving the instruction from the host system 11 , the memory control circuit unit 404 can determine the number of logical blocks, the logical block capacity, and the rewritable non-volatile memory module 406 according to the logical block address of the data interval included in the instruction. Logical estimate of physical page capacity calculation. In detail, the memory control circuit unit 404 calculates the data capacity of the data interval based on the number of logical blocks and the logical block capacity, and calculates the logical estimation value based on the data capacity and the physical page capacity of the rewritable non-volatile memory module 406 .
并且,存储器控制电路单元404根据逻辑区块地址映射的实体抹除单元中的实体页面数量决定实体估计值,其中每一逻辑区块地址具有多个逻辑地址以映射对应至实体抹除单元的实体区块地址(Physical Block Address,PBA)。Furthermore, the memory control circuit unit 404 determines the physical estimation value according to the number of physical pages in the physical erasure unit mapped by the logical block address, where each logical block address has multiple logical addresses to map entities corresponding to the physical erasure unit. Physical Block Address (PBA).
接着,存储器控制电路单元404计算逻辑估计值与实体估计值的比值以决定数据散乱度,并且根据数据散乱度与第一阀值判断是否执行数据整理操作以根据逻辑区块地址搬移实体抹除单元中的数据。详细而言,存储器控制电路单元404可判断数据散乱度是否不大于第一阀值,并在数据散乱度不大于第一阀值时根据逻辑区块地址执行数据整理操作。Next, the memory control circuit unit 404 calculates the ratio of the logical estimate value and the physical estimate value to determine the data scatter degree, and determines whether to perform a data sorting operation to move the physical erase unit according to the logical block address according to the data scatter degree and the first threshold. data in. In detail, the memory control circuit unit 404 can determine whether the data fragmentation is not greater than the first threshold, and when the data fragmentation is not greater than the first threshold, perform a data sorting operation according to the logical block address.
举例来说,存储器控制电路单元404获取指令包括的数据区间中多个逻辑区块地址对应的逻辑区块数量、各逻辑区块的容量与可复写式非易失性存储器模块406的实体页面的容量,并根据以下方程式(1)、(2)计算逻辑估计值。并且,存储器控制电路单元404获取这些逻辑区块地址映射的多个实体抹除单元对应的实体页面的数量,并将实体页面数量设定为实体估计值。For example, the memory control circuit unit 404 obtains the number of logical blocks corresponding to multiple logical block addresses in the data interval included in the instruction, the capacity of each logical block, and the physical page of the rewritable non-volatile memory module 406 capacity, and calculate the logical estimate based on the following equations (1), (2). Furthermore, the memory control circuit unit 404 obtains the number of physical pages corresponding to the multiple physical erasure units mapped by these logical block addresses, and sets the number of physical pages as the physical estimated value.
逻辑区块数量×逻辑区块容量=数据容量 (1)Number of logical blocks × logical block capacity = data capacity (1)
数据容量÷实体页面容量=逻辑估计值 (2)Data capacity ÷ entity page capacity = logical estimate (2)
以存储器控制电路单元404接收到包括的数据区间为一段连续逻辑行地址LCA(0)~LCA(7)的指令为例,其逻辑区块数量为8,逻辑页面容量假设为4K,实体页面容量假设为16K,并且逻辑行地址LCA(0)~LCA(7)映射的多个实体抹除单元中的实体页面的数量为3。据以,计算出的逻辑估计值为8×4÷16=2,而实体估计值为3。需说明的是,本发明并不限制逻辑页面容量以及实体页面容量,逻辑页面容量以及实体页面容量可依据不同规格的存储器存储装置而不同。在本实施例中,存储器控制电路单元404可计算出逻辑估计值与实体估计值的比值为2/3,即比例为0.66。由于计算出的比例为0.66(即,数据散乱度),小于第一阀值(在本实施例中例如是0.75),代表此数据区间的数据不够集中,因此必须执行数据整理操作。For example, take the memory control circuit unit 404 receiving an instruction whose data interval is a continuous logical row address LCA(0)~LCA(7). The number of logical blocks is 8, the logical page capacity is assumed to be 4K, and the physical page capacity is assumed to be 4K. Assume that it is 16K, and the number of physical pages in the multiple physical erasure units mapped by the logical row addresses LCA(0) to LCA(7) is 3. Accordingly, the calculated logical estimate is 8×4÷16=2, while the physical estimate is 3. It should be noted that the present invention does not limit the logical page capacity and physical page capacity, and the logical page capacity and physical page capacity may vary according to memory storage devices of different specifications. In this embodiment, the memory control circuit unit 404 can calculate that the ratio of the logical estimated value to the physical estimated value is 2/3, that is, the ratio is 0.66. Since the calculated ratio is 0.66 (that is, the data scatter degree), which is less than the first threshold (for example, 0.75 in this embodiment), it means that the data in this data interval is not concentrated enough, so a data sorting operation must be performed.
在相同存储器存储装置的另一实施例中,逻辑行地址LCA(0)~LCA(7)映射的多个实体抹除单元对应的实体页面的数量为2,因此实体估计值为2。据以,存储器控制电路单元404可计算出逻辑估计值与实体估计值的比值为2/2,即比例为1。由于计算出的比例为1,大于第一阀值(在本实施例中例如是0.75),代表此数据区间的数据集中,因此不需要执行数据整理操作。In another embodiment of the same memory storage device, the number of physical pages corresponding to the multiple physical erasure units mapped by the logical row addresses LCA(0)˜LCA(7) is 2, so the physical estimation value is 2. Accordingly, the memory control circuit unit 404 can calculate that the ratio of the logical estimated value to the physical estimated value is 2/2, that is, the ratio is 1. Since the calculated ratio is 1, which is greater than the first threshold (for example, 0.75 in this embodiment), it represents that the data in this data interval is concentrated, so there is no need to perform data sorting operations.
在第二实施例中,数据的散乱度是通过分析数据是否均匀分布在各通道来决定。亦即,通过判断数据对应的逻辑页面分布在平面上的数量是否平均来决定是否重整数据。In the second embodiment, the degree of data scatter is determined by analyzing whether the data is evenly distributed in each channel. That is, whether to reorganize the data is determined by judging whether the number of logical pages corresponding to the data distributed on the plane is even.
假设一个实体页面的容量为16K,而存储器控制电路单元404从主机系统11接收到的指令包括的数据区间为一段连续逻辑行地址LCA(0)~LCA(7),总共8个4K的数据,即32K的数据。理想上32K的数据只需要用2个实体页面来存储。而在较佳的状态下,此2个实体页面分布在不同实体平面上,表示每个实体平面上的数据平均。在此情况中,存储器控制电路单元404可在每个实体平面都读取到数据,读取效率较佳。反之,若此2个实体页面分布在相同实体平面上,表示每个实体平面上的数据集中,此情况中存储器控制电路单元404的读取效率较差。基此,本实施例提供的方法计算逻辑页面数量与实体平面数量决定数据散乱度,以判断每个实体平面包括的数据为集中或平均。并且将数据区间包括的逻辑区块地址映射的实体抹除单元所对应的其中之一实体平面中配置的页面数量与第二阀值比较,以判断是否执行数据整理。其中,此处页面数量指的是实体页面的数量。于此,第二阀值是通过第三阀值与数据散乱度来决定,第三阀值例如预设为2或其他预设阀值,本发明不加以限制。Assume that the capacity of a physical page is 16K, and the data interval included in the instruction received by the memory control circuit unit 404 from the host system 11 is a continuous logical row address LCA(0)~LCA(7), a total of eight pieces of 4K data, That is 32K of data. Ideally, 32K of data only needs to be stored in 2 physical pages. In a better state, these two entity pages are distributed on different entity planes, which means that the data on each entity plane is average. In this case, the memory control circuit unit 404 can read data in each physical plane, and the reading efficiency is better. On the contrary, if the two physical pages are distributed on the same physical plane, it means that the data on each physical plane is concentrated. In this case, the reading efficiency of the memory control circuit unit 404 is poor. Based on this, the method provided in this embodiment calculates the number of logical pages and the number of physical planes to determine the degree of data scatter, so as to determine whether the data included in each physical plane is concentrated or average. And the number of pages configured in one of the physical planes corresponding to the physical erasure unit mapped by the logical block address included in the data interval is compared with the second threshold to determine whether to perform data defragmentation. Among them, the number of pages here refers to the number of physical pages. Here, the second threshold is determined by the third threshold and the data scatter degree. The third threshold is, for example, preset to 2 or other preset thresholds, which is not limited by the present invention.
具体而言,存储器控制电路单元404从主机系统11接收指令后,会根据指令包括的数据区间的逻辑区块地址对应的逻辑页面数量决定逻辑估计值。并且,存储器控制电路单元404根据逻辑区块地址映射的实体抹除单元所对应的实体平面数量决定实体估计值。接着,存储器控制电路单元404根据逻辑估计值与实体估计值计算数据散乱度,并且根据数据散乱度与第三阀值计算第二阀值。在逻辑区块地址映射的实体抹除单元所对应的其中之一实体平面中配置的页面数量不小于第二阀值时,存储器控制电路单元404根据逻辑区块地址执行数据整理操作。Specifically, after receiving the instruction from the host system 11 , the memory control circuit unit 404 determines the logical estimation value according to the number of logical pages corresponding to the logical block address of the data interval included in the instruction. Furthermore, the memory control circuit unit 404 determines the physical estimation value according to the number of physical planes corresponding to the physical erasure unit mapped by the logical block address. Next, the memory control circuit unit 404 calculates the data scatter degree according to the logical estimate value and the physical estimate value, and calculates the second threshold value according to the data scatter degree and the third threshold value. When the number of pages configured in one of the physical planes corresponding to the physical erase unit mapped by the logical block address is not less than the second threshold, the memory control circuit unit 404 performs a data sorting operation according to the logical block address.
详细而言,存储器控制电路单元404获取指令包括的数据区间中多个逻辑区块地址对应的逻辑页面数量,并设定为逻辑估计值。并且,存储器控制电路单元404获取这些逻辑区块地址映射的多个实体抹除单元所对应的实体平面数量,并设定为实体估计值。接着,存储器控制电路单元404依据以下方程式(3)、(4)计算数据散乱度。In detail, the memory control circuit unit 404 obtains the number of logical pages corresponding to multiple logical block addresses in the data interval included in the instruction, and sets it as a logical estimated value. Furthermore, the memory control circuit unit 404 obtains the number of physical planes corresponding to the multiple physical erasure units mapped by these logical block addresses, and sets them as physical estimated values. Next, the memory control circuit unit 404 calculates the data scatter degree according to the following equations (3) and (4).
逻辑估计值÷实体估计值=A (3)Logical estimate ÷ entity estimate = A (3)
逻辑估计值%实体估计值=B (4)Logical estimate % entity estimate = B (4)
计算出的A设定为数据散乱度,表示数据平均的理想状况下,一个实体平面中配置的最小页面数量,计算出的A+B表示每个实体平面最佳的最大页面数量。而最不理想的状况是每个逻辑页面配置集中在相同的实体平面。本实施例会预设一第三阀值作为每个实体平面中配置的页面数量的容许阀值,而根据第三阀值与数据散乱度来决定第二阀值。The calculated A is set as the data scatter degree, which represents the minimum number of pages configured in an entity plane under ideal data average conditions. The calculated A+B represents the optimal maximum number of pages for each entity plane. The least ideal situation is that each logical page configuration is concentrated on the same entity plane. In this embodiment, a third threshold is preset as the allowable threshold for the number of pages configured in each entity plane, and the second threshold is determined based on the third threshold and the degree of data scatter.
举例来说,以存储器控制电路单元404接收到包括的数据区间包括的多个逻辑区块地址对应的逻辑页面数量为17,而这些逻辑区块地址映射的多个实体抹除单元所对应的实体平面数量为4作为范例。亦即在本实施例中,逻辑估计值为17,而实体估计值为4。存储器控制电路单元404可根据方程式(3)计算出A=4,并计算出第二阀值为A+第三阀值(在本实施例中例如是2)=6。若存储器控制电路单元404判断数据区间包括的逻辑区块地址映射的实体抹除单元所对应的实体平面中配置的页面数量不小于6(即,第二阀值),表示数据过于集中在某些实体平面,则存储器控制电路单元404根据逻辑区块地址执行数据整理操作。反之,若存储器控制电路单元404判断数据区间包括的逻辑区块地址映射的实体抹除单元所对应的实体平面中配置的页面数量小于6(即,第二阀值),表示数据均匀分散在各实体平面,则存储器控制电路单元404不执行数据整理操作。For example, the number of logical pages corresponding to the multiple logical block addresses included in the data interval received by the memory control circuit unit 404 is 17, and the entities corresponding to the multiple physical erasure units mapped by these logical block addresses are The number of planes is 4 as an example. That is, in this embodiment, the logical estimated value is 17, and the physical estimated value is 4. The memory control circuit unit 404 may calculate A=4 according to equation (3), and calculate the second threshold value as A+the third threshold value (for example, 2 in this embodiment)=6. If the memory control circuit unit 404 determines that the number of pages configured in the physical plane corresponding to the physical erasure unit mapped by the logical block address included in the data interval is not less than 6 (ie, the second threshold), it means that the data is too concentrated in some physical plane, the memory control circuit unit 404 performs a data sorting operation according to the logical block address. On the contrary, if the memory control circuit unit 404 determines that the number of pages configured in the physical plane corresponding to the physical erasure unit mapped by the logical block address included in the data interval is less than 6 (ie, the second threshold), it means that the data is evenly dispersed in each physical plane, the memory control circuit unit 404 does not perform data sorting operations.
在第三实施例中,存储器控制电路单元404可同时使用第一实施例及第二实施例的方法来来决定是否重整数据。第一实施例及第二实施例的方法详细说明如上,在此便不再赘述。In the third embodiment, the memory control circuit unit 404 may simultaneously use the methods of the first embodiment and the second embodiment to determine whether to reorganize data. The methods of the first embodiment and the second embodiment are described in detail as above, and will not be described again here.
图8是根据本发明的一范例实施例所示出的存储器的数据整理方法的流程图。请参照图8,在步骤S802中,从主机系统接收指令,其中指令包括第一数据区间。在步骤S804中,根据第一数据区间的多个逻辑区块地址的逻辑估计值及逻辑区块地址映射的多个实体抹除单元的实体估计值计算数据散乱度。在步骤S806中,根据数据散乱度与阀值判断是否执行数据整理操作以根据逻辑区块地址搬移实体抹除单元中的数据。FIG. 8 is a flow chart of a memory data organizing method according to an exemplary embodiment of the present invention. Referring to FIG. 8, in step S802, an instruction is received from the host system, where the instruction includes a first data interval. In step S804, the data scatter degree is calculated based on the logical estimation values of the plurality of logical block addresses in the first data interval and the physical estimation values of the plurality of physical erasure units mapped by the logical block address. In step S806, it is determined whether to perform a data sorting operation to move the data in the physical erasure unit according to the logical block address according to the data fragmentation degree and the threshold value.
图9是根据本发明的一范例实施例所示出的存储器的数据整理方法的流程图。请参照图9,在步骤S902中,从主机系统接收指令,其中指令包括第一数据区间。在步骤S904中,根据第一数据区间的逻辑区块地址的逻辑区块数量、逻辑区块容量与可复写式非易失性存储器模块的实体页面容量计算逻辑估计值。在步骤S906中,根据逻辑区块地址映射的实体抹除单元中的实体页面数量决定实体估计值。在步骤S908中,计算逻辑估计值与实体估计值的比值以决定数据散乱度。在步骤S910中,判断数据散乱度是否不大于第一阀值。若数据散乱度不大于第一阀值(步骤S910,判断为是),则在步骤S912中,根据逻辑区块地址执行数据整理操作。若数据散乱度大于第一阀值(步骤S910,判断为否),则回到步骤S902等待接收指令。FIG. 9 is a flowchart of a data organizing method in a memory according to an exemplary embodiment of the present invention. Referring to FIG. 9, in step S902, an instruction is received from the host system, where the instruction includes a first data interval. In step S904, a logical estimate is calculated based on the number of logical blocks of the logical block address of the first data interval, the logical block capacity, and the physical page capacity of the rewritable non-volatile memory module. In step S906, the physical estimation value is determined according to the number of physical pages in the physical erasure unit mapped by the logical block address. In step S908, the ratio of the logical estimate value and the entity estimate value is calculated to determine the data scatter degree. In step S910, it is determined whether the data scatter degree is not greater than a first threshold. If the data fragmentation is not greater than the first threshold (step S910, the determination is yes), then in step S912, a data sorting operation is performed according to the logical block address. If the data scatter is greater than the first threshold (step S910, judged as No), then return to step S902 to wait for receiving instructions.
图10是根据本发明的一范例实施例所示出的存储器的数据整理方法的流程图。在步骤S1002,从主机系统接收指令,其中指令包括第一数据区间。在步骤S1004,根据第一数据区间的逻辑区块地址对应的逻辑页面数量决定逻辑估计值。在步骤S1006,根据逻辑区块地址映射的实体抹除单元对应的实体平面数量决定实体估计值。在步骤S1008,根据逻辑估计值与实体估计值计算数据散乱度。在步骤S1010,根据数据散乱度与第三阀值计算第二阀值。在步骤S1012,判断逻辑区块地址映射的实体抹除单元所对应的其中之一实体平面中配置的页面数量是否不小于第二阀值。若页面数量不小于第二阀值(步骤S1012,判断为是),则在步骤S1014中,根据逻辑区块位址地址执行数据整理操作。若页面数量小于第二阀值(步骤S1012,判断为否),则回到步骤S1002等待接收指令。FIG. 10 is a flow chart of a memory data organizing method according to an exemplary embodiment of the present invention. In step S1002, an instruction is received from the host system, where the instruction includes a first data interval. In step S1004, the logical estimation value is determined according to the number of logical pages corresponding to the logical block address of the first data interval. In step S1006, the physical estimation value is determined according to the number of physical planes corresponding to the physical erasure unit mapped by the logical block address. In step S1008, the data scatter degree is calculated based on the logical estimation value and the entity estimation value. In step S1010, the second threshold is calculated based on the data scatter degree and the third threshold. In step S1012, it is determined whether the number of pages configured in one of the physical planes corresponding to the physical erasure unit mapped by the logical block address is not less than a second threshold. If the number of pages is not less than the second threshold (step S1012, the determination is yes), then in step S1014, a data sorting operation is performed according to the logical block address. If the number of pages is less than the second threshold (step S1012, determination is No), then return to step S1002 to wait for receiving instructions.
值得注意的是,图8至图10中各步骤可以实作为多个代码或是电路,本发明不加以限制。此外,图8至图10的方法可以搭配以上范例实施例使用,也可以单独使用,本发明不加以限制。It is worth noting that each step in Figures 8 to 10 can be implemented as multiple codes or circuits, and the present invention is not limited thereto. In addition, the methods in Figures 8 to 10 can be used in conjunction with the above exemplary embodiments or can be used alone, and are not limited by the present invention.
综上所述,本发明的实施例所提供的存储器的数据整理方法、存储器存储装置及存储器控制电路单元,可根据指令包括的数据区间的多个逻辑区块地址的逻辑估计值及逻辑区块地址映射的多个实体抹除单元的实体估计值计算数据散乱度,并比较数据散乱度与阀值,以判断数据为集中或分散。藉此,可决定此数据区间是否需要进行数据整理操作,并进而提升读取数据的速度。To sum up, the memory data sorting method, memory storage device and memory control circuit unit provided by the embodiments of the present invention can be based on the logical estimation values and logical blocks of multiple logical block addresses in the data interval included in the instruction. The entity estimation value of multiple entity erasure units of address mapping calculates the data scatter degree, and compares the data scatter degree with the threshold value to determine whether the data is concentrated or scattered. In this way, it can be determined whether this data interval requires data sorting operation, and thereby improve the speed of reading data.
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, but not to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions described in the foregoing embodiments can still be modified, or some or all of the technical features can be equivalently replaced; and these modifications or substitutions do not deviate from the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention. scope.
Claims (18)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010125393.4A CN113312274B (en) | 2020-02-27 | 2020-02-27 | Data sorting method of memory, memory storage device and control circuit unit |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010125393.4A CN113312274B (en) | 2020-02-27 | 2020-02-27 | Data sorting method of memory, memory storage device and control circuit unit |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113312274A CN113312274A (en) | 2021-08-27 |
CN113312274B true CN113312274B (en) | 2024-03-22 |
Family
ID=77370288
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010125393.4A Active CN113312274B (en) | 2020-02-27 | 2020-02-27 | Data sorting method of memory, memory storage device and control circuit unit |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113312274B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116149569A (en) | 2023-02-24 | 2023-05-23 | 合肥兆芯电子有限公司 | File system-based data sorting method, storage device and control circuit |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104238956A (en) * | 2013-06-24 | 2014-12-24 | 群联电子股份有限公司 | Data writing method, memory controller and memory storage device |
CN106990921A (en) * | 2017-03-24 | 2017-07-28 | 合肥兆芯电子有限公司 | Method for writing data, memory storage apparatus and memorizer control circuit unit |
CN109491588A (en) * | 2017-09-13 | 2019-03-19 | 群联电子股份有限公司 | Memory management method, memory control circuit unit and memory storage device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP6785205B2 (en) * | 2017-09-21 | 2020-11-18 | キオクシア株式会社 | Memory system and control method |
-
2020
- 2020-02-27 CN CN202010125393.4A patent/CN113312274B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104238956A (en) * | 2013-06-24 | 2014-12-24 | 群联电子股份有限公司 | Data writing method, memory controller and memory storage device |
CN106990921A (en) * | 2017-03-24 | 2017-07-28 | 合肥兆芯电子有限公司 | Method for writing data, memory storage apparatus and memorizer control circuit unit |
CN109491588A (en) * | 2017-09-13 | 2019-03-19 | 群联电子股份有限公司 | Memory management method, memory control circuit unit and memory storage device |
Also Published As
Publication number | Publication date |
---|---|
CN113312274A (en) | 2021-08-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104765569B (en) | Data writing method, memory control circuit unit and memory storage device | |
CN105005450A (en) | Data writing method, memory storage device and memory control circuit unit | |
CN106484307A (en) | Memory management method, memory control circuit unit and memory storage device | |
CN110308876B (en) | Memory management method, memory storage device and memory control circuit unit | |
CN109273033B (en) | Memory management method, memory control circuit unit and memory storage device | |
CN113312274B (en) | Data sorting method of memory, memory storage device and control circuit unit | |
CN117636967A (en) | Memory control method, memory storage device and memory control circuit unit | |
TWI760697B (en) | Data arrangement method of memory, memory storage device and memory control circuit unit | |
CN107122308A (en) | Average wear method, memory control circuit unit and memory storage device | |
CN106445397A (en) | Memory management method, memory control circuit unit and memory storage device | |
CN107103930A (en) | Data writing method, memory control circuit unit and memory storage device | |
CN113504880B (en) | Memory buffer management method, memory control circuit unit and memory device | |
US20230021668A1 (en) | Temperature control method, memory storage apparatus, and memory control circuit unit | |
CN112486417B (en) | Memory control method, memory storage device and memory control circuit unit | |
CN111831210B (en) | Memory management method, memory control circuit unit and memory storage device | |
TWI724427B (en) | Data writing method, memory storage device and memory control circuit unit | |
TWI867977B (en) | Memory management method, memory storage device and memory control circuit unit | |
CN107102814B (en) | Memory management method, memory control circuit unit and memory storage device | |
TWI823792B (en) | Mapping table updating method, memory storage device and memory control circuit unit | |
TWI831366B (en) | Data writing method, memory storage device and memory control circuit unit | |
CN117632038B (en) | Wear leveling method, memory storage device and memory control circuit unit | |
TWI818370B (en) | Data storing allocation method, memory storage apparatus and memory control circuit unit | |
CN114527941B (en) | Memory control method, memory storage device and memory control circuit unit | |
CN111414128B (en) | Memory management method, memory storage device and memory control circuit unit | |
CN111723022B (en) | Data storage method, memory storage device and memory control circuit unit |
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 |