TW202016937A - Data merge method, memory storage device and memory control circuit unit - Google Patents

Data merge method, memory storage device and memory control circuit unit Download PDF

Info

Publication number
TW202016937A
TW202016937A TW107137810A TW107137810A TW202016937A TW 202016937 A TW202016937 A TW 202016937A TW 107137810 A TW107137810 A TW 107137810A TW 107137810 A TW107137810 A TW 107137810A TW 202016937 A TW202016937 A TW 202016937A
Authority
TW
Taiwan
Prior art keywords
logical
physical
unit
distance value
mapping information
Prior art date
Application number
TW107137810A
Other languages
Chinese (zh)
Other versions
TWI676176B (en
Inventor
陳建文
林庭瑋
Original Assignee
群聯電子股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 群聯電子股份有限公司 filed Critical 群聯電子股份有限公司
Priority to TW107137810A priority Critical patent/TWI676176B/en
Priority to US16/239,535 priority patent/US10810121B2/en
Application granted granted Critical
Publication of TWI676176B publication Critical patent/TWI676176B/en
Publication of TW202016937A publication Critical patent/TW202016937A/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • G06F12/0638Combination of memories, e.g. ROM and RAM such as to permit replacement or supplementing of words in one module by words in another module
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/1027Address translation using associative or pseudo-associative address translation means, e.g. translation look-aside buffer [TLB]
    • G06F12/1045Address translation using associative or pseudo-associative address translation means, e.g. translation look-aside buffer [TLB] associated with a data cache
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/12Replacement control
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0616Improving the reliability of storage systems in relation to life time, e.g. increasing Mean Time Between Failures [MTBF]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/065Replication mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1032Reliability improvement, data loss prevention, degraded operation etc
    • G06F2212/1036Life time enhancement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7201Logical to physical mapping or translation of blocks or pages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7205Cleaning, compaction, garbage collection, erase control
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • G06F3/0607Improving or facilitating administration, e.g. storage management by facilitating the process of upgrading existing storage systems, e.g. for improving compatibility between host and storage device

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Memory System (AREA)

Abstract

A data merge method for a rewritable non-volatile memory module including a plurality of physical units is provided according to an exemplary embodiment of the disclosure. The method includes: obtaining a first logical distance value between a first physical unit and a second physical unit among the physical units, wherein the first logical distance value reflects a logical dispersion degree between at least one first logical unit mapped by the first physical unit and at least one second logical unit mapped by the second physical unit; and performing a data merge operation according to the first logical distance value, so as to copy valid from a source node to a source node.

Description

資料整併方法、記憶體儲存裝置及記憶體控制電路單元Data consolidation method, memory storage device and memory control circuit unit

本發明是有關於一種快閃記憶體技術,且特別是有關於一種資料整併方法、記憶體儲存裝置及記憶體控制電路單元。The invention relates to a flash memory technology, and in particular to a data consolidation method, a memory storage device and a memory control circuit unit.

數位相機、行動電話與MP3播放器在這幾年來的成長十分迅速,使得消費者對儲存媒體的需求也急速增加。由於可複寫式非揮發性記憶體模組(rewritable non-volatile memory module)(例如,快閃記憶體)具有資料非揮發性、省電、體積小,以及無機械結構等特性,所以非常適合內建於上述所舉例的各種可攜式多媒體裝置中。Digital cameras, mobile phones and MP3 players have grown rapidly in recent years, and consumers' demand for storage media has also increased rapidly. The rewritable non-volatile memory module (for example, flash memory) has the characteristics of non-volatile data, power saving, small size, and no mechanical structure, so it is very suitable for internal Built in various portable multimedia devices exemplified above.

當記憶體儲存裝置出廠時,記憶體儲存裝置中一部分的實體單元會被配置為多個閒置實體單元,以使用此些閒置實體單元來儲存新資料。在使用一段時間後,記憶體儲存裝置中的閒置實體單元的數目會逐漸減少。記憶體儲存裝置可藉由資料整併程序(或稱為垃圾收集程序)將有效資料從多個來源節點複製到回收節點(亦稱為目標節點)並抹除屬於來源節點的實體單元以釋放出新的閒置實體單元。但是,在資料整併程序中,若所選擇作為來源節點的多個實體單元所映射的邏輯單元越分散,則越多記載此些邏輯單元之管理資訊(例如映射資訊)的表格需要被存取,從而增加記憶體儲存裝置的存取次數並加速記憶體儲存裝置(例如記憶胞)的損耗。When the memory storage device is shipped from the factory, a part of the physical units in the memory storage device is configured as a plurality of idle physical units to use the idle physical units to store new data. After a period of use, the number of idle physical units in the memory storage device will gradually decrease. The memory storage device can copy the valid data from multiple source nodes to the recycling node (also known as the target node) and erase the physical units belonging to the source node through a data consolidation process (or garbage collection process) to release New idle physical unit. However, in the data consolidation process, the more scattered the logical units mapped to the multiple physical units selected as the source node, the more tables that record the management information (such as mapping information) of these logical units need to be accessed , Thereby increasing the number of accesses to the memory storage device and accelerating the wear and tear of the memory storage device (eg, memory cell).

本發明提供一種資料整併方法、記憶體儲存裝置及記憶體控制電路單元,可有效減少在資料整併程序中對於記憶體儲存裝置的存取次數。The invention provides a data consolidation method, a memory storage device and a memory control circuit unit, which can effectively reduce the number of accesses to the memory storage device in the data consolidation process.

本發明的範例實施例提供一種資料整併方法,其用於可複寫式非揮發性記憶體模組,其中所述可複寫式非揮發性記憶體模組包括多個實體單元。所述資料整併方法包括:獲得所述實體單元中的第一實體單元與第二實體單元之間的第一邏輯距離值,其中所述第一邏輯距離值反映所述第一實體單元所映射的至少一第一邏輯單元與所述第二實體單元所映射的至少一第二邏輯單元之間的邏輯分散度;以及根據所述第一邏輯距離值執行資料整併操作,以將有效資料從所述實體單元中的來源節點複製到所述實體單元中的回收節點。Example embodiments of the present invention provide a data consolidation method for a rewritable non-volatile memory module, where the rewritable non-volatile memory module includes a plurality of physical units. The data consolidation method includes: obtaining a first logical distance value between a first physical unit and a second physical unit of the physical units, wherein the first logical distance value reflects the mapping of the first physical unit The logical dispersion between the at least one first logical unit and the at least one second logical unit mapped by the second physical unit; and performing data consolidation based on the first logical distance value to remove valid data from The source node in the physical unit is copied to the recycling node in the physical unit.

在本發明的一範例實施例中,根據所述第一邏輯距離值執行所述資料整併操作的步驟包括:若所述第一邏輯距離值不大於目標距離值,將所述第一實體單元中的有效資料複製到所述回收節點並將所述第二實體單元中的有效資料複製到所述回收節點;以及若所述邏輯距離值大於所述目標距離值,將所述第一實體單元中的所述有效資料複製到所述回收節點並將所述實體單元中的第三實體單元中的有效資料複製到所述回收節點。In an exemplary embodiment of the present invention, the step of performing the data consolidation operation according to the first logical distance value includes: if the first logical distance value is not greater than the target distance value, the first physical unit Valid data in the copy to the recycling node and copy valid data in the second physical unit to the recycling node; and if the logical distance value is greater than the target distance value, copy the first physical unit The valid data in is copied to the recycling node and the valid data in the third physical unit of the physical units is copied to the recycling node.

在本發明的一範例實施例中,所述的資料整併方法更包括:獲得所述第一實體單元與所述第三實體單元之間的第二邏輯距離值,其中所述目標距離值包括所述第二邏輯距離值。In an exemplary embodiment of the present invention, the data consolidation method further includes: obtaining a second logical distance value between the first physical unit and the third physical unit, wherein the target distance value includes The second logical distance value.

在本發明的一範例實施例中,獲得所述實體單元中的所述第一實體單元與所述第二實體單元之間的所述第一邏輯距離值的步驟包括:根據第一表格映射資訊與第二表格映射資訊獲得所述第一邏輯距離值,其中所述第一表格映射資訊反映所述第一邏輯單元的邏輯至實體映射資訊記載於至少一第一邏輯至實體映射表,且所述第二表格映射資訊反映所述第二邏輯單元的邏輯至實體映射資訊記載於至少一第二邏輯至實體映射表。In an exemplary embodiment of the present invention, the step of obtaining the first logical distance value between the first physical unit and the second physical unit of the physical units includes: mapping information according to a first table Obtaining the first logical distance value with the second table mapping information, wherein the first table mapping information reflects the logic-to-physical mapping information of the first logical unit recorded in at least one first logic-to-physical mapping table, and all The second table mapping information reflects the logic-to-entity mapping information of the second logic unit recorded in at least one second logic-to-entity mapping table.

在本發明的一範例實施例中,中所述第一表格映射資訊包括第一位元,所述第二表格映射資訊包括第二位元,且根據所述第一表格映射資訊與所述第二表格映射資訊獲得所述第一邏輯距離值的步驟包括:對所述第一位元與所述第二位元執行第一運算以獲得第三位元;以及根據所述第三位元獲得所述第一邏輯距離值。In an exemplary embodiment of the present invention, the first table mapping information includes a first bit, the second table mapping information includes a second bit, and according to the first table mapping information and the first The step of obtaining the first logical distance value by the two-table mapping information includes: performing a first operation on the first bit and the second bit to obtain a third bit; and obtaining according to the third bit The first logical distance value.

在本發明的一範例實施例中,所述第一表格映射資訊包括N個第一數值,所述第二表格映射資訊包括N個第二數值,且根據所述第一表格映射資訊與所述第二表格映射資訊獲得所述第一邏輯距離值的步驟包括:獲得所述N個第一數值與所述N個第二數值之間的N維距離;以及根據所述N維距離獲得所述第一邏輯距離值。In an exemplary embodiment of the present invention, the first table mapping information includes N first values, the second table mapping information includes N second values, and according to the first table mapping information and the The step of obtaining the first logical distance value from the second table mapping information includes: obtaining an N-dimensional distance between the N first values and the N second values; and obtaining the N-dimensional distance according to the N-dimensional distance The first logical distance value.

本發明的範例實施例另提供一種記憶體儲存裝置,其包括連接介面單元、可複寫式非揮發性記憶體模組及記憶體控制電路單元。所述連接介面單元用以耦接至主機系統。所述可複寫式非揮發性記憶體模組包括多個實體單元。所述記憶體控制電路單元耦接至所述連接介面單元與所述可複寫式非揮發性記憶體模組。所述記憶體控制電路單元用以獲得所述實體單元中的第一實體單元與第二實體單元之間的第一邏輯距離值。所述第一邏輯距離值反映所述第一實體單元所映射的至少一第一邏輯單元與所述第二實體單元所映射的至少一第二邏輯單元之間的邏輯分散度。所述記憶體控制電路單元更用以根據所述第一邏輯距離值執行資料整併操作,以將有效資料從所述實體單元中的來源節點複製到所述實體單元中的回收節點。An exemplary embodiment of the present invention further provides 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 the host system. The rewritable non-volatile memory module includes multiple physical units. 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 used to obtain a first logical distance value between the first physical unit and the second physical unit of the physical units. The first logical distance value reflects the degree of logical dispersion between at least one first logical unit mapped by the first physical unit and at least one second logical unit mapped by the second physical unit. The memory control circuit unit is further used to perform data consolidation according to the first logical distance value, so as to copy valid data from the source node in the physical unit to the recovery node in the physical unit.

在本發明的一範例實施例中,所述記憶體控制電路單元根據所述第一邏輯距離值執行所述資料整併操作的操作包括:若所述第一邏輯距離值不大於目標距離值,指示將所述第一實體單元中的有效資料複製到所述回收節點並將所述第二實體單元中的有效資料複製到所述回收節點;以及若所述邏輯距離值大於所述目標距離值,指示將所述第一實體單元中的所述有效資料複製到所述回收節點並將所述實體單元中的第三實體單元中的有效資料複製到所述回收節點。In an exemplary embodiment of the present invention, the operation of the memory control circuit unit performing the data consolidation operation according to the first logical distance value includes: if the first logical distance value is not greater than the target distance value, Instruct to copy valid data in the first physical unit to the recycling node and copy valid data in the second physical unit to the recycling node; and if the logical distance value is greater than the target distance value Indicating that the valid data in the first physical unit is copied to the recycling node and the valid data in the third physical unit in the physical unit is copied to the recycling node.

在本發明的一範例實施例中,所述記憶體控制電路單元更用以獲得所述第一實體單元與所述第三實體單元之間的第二邏輯距離值,且所述目標距離值包括所述第二邏輯距離值。In an exemplary embodiment of the present invention, the memory control circuit unit is further used to obtain a second logical distance value between the first physical unit and the third physical unit, and the target distance value includes The second logical distance value.

在本發明的一範例實施例中,所述記憶體控制電路單元獲得所述實體單元中的所述第一實體單元與所述第二實體單元之間的所述第一邏輯距離值的操作包括:根據第一表格映射資訊與第二表格映射資訊獲得所述第一邏輯距離值,其中所述第一表格映射資訊反映所述第一邏輯單元的邏輯至實體映射資訊記載於至少一第一邏輯至實體映射表,且所述第二表格映射資訊反映所述第二邏輯單元的邏輯至實體映射資訊記載於至少一第二邏輯至實體映射表。In an exemplary embodiment of the present invention, the operation of the memory control circuit unit to obtain the first logical distance value between the first physical unit and the second physical unit in the physical unit includes : Obtaining the first logical distance value according to the first table mapping information and the second table mapping information, wherein the first table mapping information reflects the logic-to-physical mapping information of the first logic unit recorded in at least one first logic To an entity mapping table, and the second table mapping information reflects the logic-to-entity mapping information of the second logical unit recorded in at least one second logic-to-entity mapping table.

在本發明的一範例實施例中,所述第一表格映射資訊包括第一位元,所述第二表格映射資訊包括第二位元,且所述記憶體控制電路單元根據所述第一表格映射資訊與所述第二表格映射資訊獲得所述第一邏輯距離值的操作包括:對所述第一位元與所述第二位元執行第一運算以獲得第三位元;以及根據所述第三位元獲得所述第一邏輯距離值。In an exemplary embodiment of the present invention, the first table mapping information includes a first bit, the second table mapping information includes a second bit, and the memory control circuit unit is based on the first table The operation of obtaining the first logical distance value by the mapping information and the second table mapping information includes: performing a first operation on the first bit and the second bit to obtain a third bit; and according to all The third bit obtains the first logical distance value.

在本發明的一範例實施例中,所述第一表格映射資訊包括N個第一數值,所述第二表格映射資訊包括N個第二數值,且所述記憶體控制電路單元根據所述第一表格映射資訊與所述第二表格映射資訊獲得所述第一邏輯距離值的操作包括:獲得所述N個第一數值與所述N個第二數值之間的N維距離;以及根據所述N維距離獲得所述第一邏輯距離值。In an exemplary embodiment of the present invention, the first table mapping information includes N first values, the second table mapping information includes N second values, and the memory control circuit unit is based on the The operation of obtaining the first logical distance value by a table of mapping information and the second table of mapping information includes: obtaining an N-dimensional distance between the N first values and the N second values; and The N-dimensional distance obtains the first logical distance value.

本發明的範例實施例另提供一種記憶體控制電路單元,其用於控制可複寫式非揮發性記憶體模組。所述可複寫式非揮發性記憶體模組包括多個實體單元。所述記憶體控制電路單元包括主機介面、記憶體介面及記憶體管理電路。所述主機介面用以耦接至主機系統。所述記憶體介面用以耦接至所述可複寫式非揮發性記憶體模組。所述記憶體管理電路耦接至所述主機介面與所述記憶體介面。所述記憶體管理電路用以獲得所述實體單元中的第一實體單元與第二實體單元之間的第一邏輯距離值。所述第一邏輯距離值反映所述第一實體單元所映射的至少一第一邏輯單元與所述第二實體單元所映射的至少一第二邏輯單元之間的邏輯分散度。所述記憶體管理電路更用以根據所述第一邏輯距離值執行資料整併操作,以將有效資料從所述實體單元中的來源節點複製到所述實體單元中的回收節點。The exemplary embodiment of the present invention further provides a memory control circuit unit for controlling a rewritable non-volatile memory module. The rewritable non-volatile memory module includes multiple physical units. 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 the 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 management circuit is used to obtain a first logical distance value between the first physical unit and the second physical unit of the physical units. The first logical distance value reflects the degree of logical dispersion between at least one first logical unit mapped by the first physical unit and at least one second logical unit mapped by the second physical unit. The memory management circuit is further used to perform data consolidation according to the first logical distance value, so as to copy valid data from the source node in the physical unit to the recovery node in the physical unit.

在本發明的一範例實施例中,所述第一邏輯單元的邏輯至實體映射資訊記載於至少一第一邏輯至實體映射表,所述第二邏輯單元的邏輯至實體映射資訊記載於至少一第二邏輯至實體映射表,且所述第一邏輯距離值更反映所述第一邏輯至實體映射表與所述第二邏輯至實體映射表之間的重疊程度。In an exemplary embodiment of the present invention, the logical-to-physical mapping information of the first logical unit is recorded in at least one first logical-to-physical mapping table, and the logical-to-physical mapping information of the second logical unit is recorded in at least one A second logical-to-physical mapping table, and the first logical distance value further reflects the degree of overlap between the first logical-to-physical mapping table and the second logical-to-physical mapping table.

在本發明的一範例實施例中,所述記憶體管理電路根據所述第一邏輯距離值執行所述資料整併操作的操作包括:若所述第一邏輯距離值不大於目標距離值,指示將所述第一實體單元中的有效資料複製到所述回收節點並將所述第二實體單元中的有效資料複製到所述回收節點;以及若所述邏輯距離值大於所述目標距離值,指示將所述第一實體單元中的所述有效資料複製到所述回收節點並將所述實體單元中的第三實體單元中的有效資料複製到所述回收節點。In an exemplary embodiment of the present invention, the operation of the memory management circuit performing the data consolidation operation according to the first logical distance value includes: if the first logical distance value is not greater than the target distance value, indicating Copy valid data in the first physical unit to the recycling node and copy valid data in the second physical unit to the recycling node; and if the logical distance value is greater than the target distance value, Instruct to copy the valid data in the first physical unit to the recycling node and copy the valid data in the third physical unit in the physical unit to the recycling node.

在本發明的一範例實施例中,所述記憶體管理電路更用以獲得所述第一實體單元與所述第三實體單元之間的第二邏輯距離值,且所述目標距離值包括所述第二邏輯距離值。In an exemplary embodiment of the present invention, the memory management circuit is further used to obtain a second logical distance value between the first physical unit and the third physical unit, and the target distance value includes Said second logical distance value.

在本發明的一範例實施例中,所述記憶體管理電路獲得所述實體單元中的所述第一實體單元與所述第二實體單元之間的所述第一邏輯距離值的操作包括:根據第一表格映射資訊與第二表格映射資訊獲得所述第一邏輯距離值。所述第一表格映射資訊反映所述第一邏輯單元的一邏輯至實體映射資訊記載於至少一第一邏輯至實體映射表。所述第二表格映射資訊反映所述第二邏輯單元的一邏輯至實體映射資訊記載於至少一第二邏輯至實體映射表。In an exemplary embodiment of the present invention, the operation of the memory management circuit to obtain the first logical distance value between the first physical unit and the second physical unit in the physical unit includes: The first logical distance value is obtained according to the first table mapping information and the second table mapping information. The first table mapping information reflects a logical-to-physical mapping information of the first logical unit recorded in at least one first logical-to-physical mapping table. The second table mapping information reflects a logical-to-physical mapping information of the second logical unit recorded in at least one second logical-to-physical mapping table.

在本發明的一範例實施例中,所述第一表格映射資訊包括第一位元,所述第二表格映射資訊包括第二位元,且所述記憶體管理電路根據所述第一表格映射資訊與所述第二表格映射資訊獲得所述第一邏輯距離值的操作包括:對所述第一位元與所述第二位元執行第一運算以獲得第三位元;以及根據所述第三位元獲得所述第一邏輯距離值。In an exemplary embodiment of the present invention, the first table mapping information includes a first bit, the second table mapping information includes a second bit, and the memory management circuit maps according to the first table The operation of obtaining the first logical distance value by the information and the second table mapping information includes: performing a first operation on the first bit and the second bit to obtain a third bit; and according to the The third bit obtains the first logical distance value.

在本發明的一範例實施例中,所述第一表格映射資訊包括N個第一數值,所述第二表格映射資訊包括N個第二數值,且所述記憶體管理電路根據所述第一表格映射資訊與所述第二表格映射資訊獲得所述第一邏輯距離值的操作包括:獲得所述N個第一數值與所述N個第二數值之間的N維距離;以及根據所述N維距離獲得所述第一邏輯距離值。In an exemplary embodiment of the present invention, the first table mapping information includes N first values, the second table mapping information includes N second values, and the memory management circuit is based on the first The operation of obtaining the first logical distance value by the table mapping information and the second table mapping information includes: obtaining an N-dimensional distance between the N first values and the N second values; and according to the The N-dimensional distance obtains the first logical distance value.

基於上述,在獲得第一實體單元與第二實體單元之間的第一邏輯距離值之後,資料整併操作可根據所述第一邏輯距離值執行,以將有效資料從來源節點複製到回收節點。透過考慮第一實體單元所映射的第一邏輯單元與第二實體單元所映射的第二邏輯單元之間的邏輯分散度,在資料整併程序中記憶體儲存裝置的存取次數可被有效減少,進而提高記憶體儲存裝置的使用壽命。Based on the above, after obtaining the first logical distance value between the first physical unit and the second physical unit, the data consolidation operation may be performed according to the first logical distance value to copy valid data from the source node to the recycling node . By considering the logical dispersion between the first logical unit mapped by the first physical unit and the second logical unit mapped by the second physical unit, the number of accesses to the memory storage device in the data consolidation process can be effectively reduced To further increase the service life of the memory storage device.

為讓本發明的上述特徵和優點能更明顯易懂,下文特舉實施例,並配合所附圖式作詳細說明如下。In order to make the above-mentioned features and advantages of the present invention more obvious and understandable, the embodiments are specifically described below in conjunction with the accompanying drawings for detailed description as follows.

一般而言,記憶體儲存裝置(亦稱,記憶體儲存系統)包括可複寫式非揮發性記憶體模組(rewritable non-volatile memory module)與控制器(亦稱,控制電路)。通常記憶體儲存裝置是與主機系統一起使用,以使主機系統可將資料寫入至記憶體儲存裝置或從記憶體儲存裝置中讀取資料。Generally speaking, a memory storage device (also known as a memory storage system) includes a rewritable non-volatile memory module (rewritable non-volatile memory module) and a controller (also known as a control circuit). Usually, the memory storage device is used together with the host system, so that the host system can write data to the memory storage device 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 exemplary embodiment of the present invention. 2 is a schematic diagram of a host system, a memory storage device, and an I/O device according to another exemplary embodiment of the present invention.

請參照圖1與圖2,主機系統11一般包括處理器111、隨機存取記憶體(random access 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 the system bus 110.

在本範例實施例中,主機系統11是透過資料傳輸介面114與記憶體儲存裝置10耦接。例如,主機系統11可經由資料傳輸介面114將資料儲存至記憶體儲存裝置10或從記憶體儲存裝置10中讀取資料。此外,主機系統11是透過系統匯流排110與I/O裝置12耦接。例如,主機系統11可經由系統匯流排110將輸出訊號傳送至I/O裝置12或從I/O裝置12接收輸入訊號。In the present 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 store 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, the host system 11 can transmit output signals to or receive input signals from the I/O device 12 via the system bus 110.

在本範例實施例中,處理器111、隨機存取記憶體112、唯讀記憶體113及資料傳輸介面114可設置在主機系統11的主機板20上。資料傳輸介面114的數目可以是一或多個。透過資料傳輸介面114,主機板20可以經由有線或無線方式耦接至記憶體儲存裝置10。記憶體儲存裝置10可例如是隨身碟201、記憶卡202、固態硬碟(Solid State Drive, SSD)203或無線記憶體儲存裝置204。無線記憶體儲存裝置204可例如是近距離無線通訊(Near Field Communication, NFC)記憶體儲存裝置、無線傳真(WiFi)記憶體儲存裝置、藍牙(Bluetooth)記憶體儲存裝置或低功耗藍牙記憶體儲存裝置(例如,iBeacon)等以各式無線通訊技術為基礎的記憶體儲存裝置。此外,主機板20也可以透過系統匯流排110耦接至全球定位系統(Global Positioning System, GPS)模組205、網路介面卡206、無線傳輸裝置207、鍵盤208、螢幕209、喇叭210等各式I/O裝置。例如,在一範例實施例中,主機板20可透過無線傳輸裝置207存取無線記憶體儲存裝置204。In the present exemplary embodiment, the processor 111, the random access memory 112, the read-only memory 113, and the data transmission interface 114 may be provided 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 a wired or wireless method. The memory storage device 10 may be, for example, a flash drive 201, a memory card 202, a solid state drive (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 (NFC) memory storage device, a wireless facsimile (WiFi) memory storage device, a Bluetooth memory storage device, or a Bluetooth low energy memory Memory devices such as storage devices (for example, iBeacon) based on various wireless communication technologies. In addition, the motherboard 20 can also be coupled to the Global Positioning System (GPS) module 205, the network interface card 206, the wireless transmission device 207, the keyboard 208, the screen 209, the speaker 210, etc. through the system bus 110 I/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可為其所使用的安全數位(Secure Digital, SD)卡32、小型快閃(Compact Flash, CF)卡33或嵌入式儲存裝置34等各式非揮發性記憶體儲存裝置。嵌入式儲存裝置34包括嵌入式多媒體卡(embedded Multi Media Card, eMMC)341及/或嵌入式多晶片封裝(embedded Multi Chip Package, eMCP)儲存裝置342等各類型將記憶體模組直接耦接於主機系統的基板上的嵌入式儲存裝置。In an exemplary embodiment, the mentioned host system is any system that can substantially cooperate with a memory storage device to store data. Although in the above exemplary embodiment, the host system is described as a computer system, however, FIG. 3 is a schematic diagram of a host system and a memory storage device according to another exemplary embodiment of the present invention. Referring to FIG. 3, in another exemplary embodiment, the host system 31 may also be a digital camera, a video camera, a communication device, an audio player, a video player, or a tablet computer, and the memory storage device 30 may be Various non-volatile memory storage devices such as a Secure Digital (SD) card 32, a Compact Flash (CF) card 33, or an embedded storage device 34 are used. The embedded storage device 34 includes an embedded multi-media card (eMMC) 341 and/or an embedded multi-chip package (eMCP) storage device 342 and other types of memory modules directly coupled to Embedded storage device on the substrate of the host system.

圖4是根據本發明的一範例實施例所繪示的記憶體儲存裝置的概要方塊圖。FIG. 4 is a schematic block diagram of a memory storage device according to an exemplary embodiment of the invention.

請參照圖4,記憶體儲存裝置10包括連接介面單元402、記憶體控制電路單元404與可複寫式非揮發性記憶體模組406。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)介面標準、記憶棒(Memory Stick, 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 can 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 to this, and the connection interface unit 402 may also conform to the Parallel Advanced Technology Attachment (PATA) standard, Institute of Electrical and Electronic Engineers (IEEE) 1394 Standard, High-speed Peripheral Component Interconnect Express (PCI Express) standard, Universal Serial Bus (USB) standard, SD interface standard, Ultra High Speed-I (UHS-I) interface Standard, Ultra High Speed-II (UHS-II) interface standard, Memory Stick (MS) interface standard, MCP interface standard, MMC interface standard, eMMC interface standard, Universal Flash Memory (Universal Flash Storage (UFS) interface standard, eMCP interface standard, CF interface standard, Integrated Drive Electronics Interface (Integrated Device Electronics, IDE) standard or other suitable standards. The connection interface unit 402 can be packaged in one chip with the memory control circuit unit 404, or the connection interface unit 402 can be disposed outside a chip containing the memory control circuit unit 404.

記憶體控制電路單元404用以執行以硬體型式或韌體型式實作的多個邏輯閘或控制指令並且根據主機系統11的指令在可複寫式非揮發性記憶體模組406中進行資料的寫入、讀取與抹除等運作。The memory control circuit unit 404 is used to execute a plurality of logic gates or control commands implemented in a hardware type or a firmware type and execute data in a rewritable non-volatile memory module 406 according to commands of the host system 11 Write, read and erase operations.

可複寫式非揮發性記憶體模組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,TLC)NAND型快閃記憶體模組(即,一個記憶胞中可儲存4個位元的快閃記憶體模組)、其他快閃記憶體模組或其他具有相同特性的記憶體模組。The rewritable non-volatile memory module 406 is coupled to the memory control circuit unit 404 and is used to store data written by the host system 11. The rewritable non-volatile memory module 406 may be a single-level memory cell (SLC) NAND-type flash memory module (ie, a flash memory that can store 1 bit in a memory cell Module), Multi Level Cell (MLC) NAND flash memory module (that is, a flash memory module that can store 2 bits in a memory cell), tertiary memory cell ( Triple Level Cell (TLC) NAND flash memory module (ie, a flash memory module that can store 3 bits in a memory cell), Quad Level Cell (TLC) NAND flash Flash memory modules (that is, flash memory modules that can store 4 bits in one memory cell), other flash memory modules, or other memory modules with the same characteristics.

可複寫式非揮發性記憶體模組406中的每一個記憶胞是以電壓(以下亦稱為臨界電壓)的改變來儲存一或多個位元。具體來說,每一個記憶胞的控制閘極(control gate)與通道之間有一個電荷捕捉層。透過施予一寫入電壓至控制閘極,可以改變電荷補捉層的電子量,進而改變記憶胞的臨界電壓。此改變記憶胞之臨界電壓的操作亦稱為“把資料寫入至記憶胞”或“程式化(programming)記憶胞”。隨著臨界電壓的改變,可複寫式非揮發性記憶體模組406中的每一個記憶胞具有多個儲存狀態。透過施予讀取電壓可以判斷一個記憶胞是屬於哪一個儲存狀態,藉此取得此記憶胞所儲存的一或多個位元。Each memory cell in the rewritable non-volatile memory module 406 stores one or more bits with a change in voltage (hereinafter also referred to as a threshold voltage). Specifically, each memory cell has a charge trapping layer between the control gate and the channel. By applying a write voltage to the control gate, the amount of electrons in the charge trapping layer can be changed, thereby changing the threshold voltage of the memory cell. This operation of changing the critical voltage of the memory cell is also called "writing data to the memory cell" or "programming (programming) the memory cell". As the threshold voltage changes, each memory cell in the rewritable non-volatile memory module 406 has multiple storage states. By applying a read voltage, it can be determined 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 memory cells 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, the memory cells on the same character line may constitute one or more physical programming units. If each memory cell can store more than 2 bits, the physical programming unit on the same character line can be at least classified into a lower physical programming unit and an upper physical programming unit. For example, the least significant bit (LSB) of a memory cell belongs to the lower physical programming unit, and the most significant bit (MSB) of a memory cell belongs to the upper physical programming unit. Generally speaking, in MLC NAND flash memory, the writing speed of the lower physical programming unit is higher than that of the upper physical programming unit, and/or the reliability of the lower physical programming unit is higher than that of the upper Reliability of physical programming 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 to write data. For example, the physical programming unit may be a physical page or a sector. If the physical programming unit is a physical page, these physical programming units may include a data bit area and a redundancy bit area. The data bit area includes multiple physical fans to store user data, and the redundant bit area is used to store system data (eg, error correction codes and other management data). In this exemplary embodiment, the data bit area includes 32 physical fans, and the size of one physical fan is 512 bytes (byte, B). However, in other exemplary embodiments, the data bit area may also include 8, 16 or more or fewer physical fans, and the size of each physical fan may also be larger or smaller. On the other hand, the physical erasing unit is the smallest unit of erasing. That is, each physical erasing unit contains one of the minimum number of memory cells to be erased. For example, the physical erasing unit is a physical block.

圖5是根據本發明的一範例實施例所繪示的記憶體控制電路單元的概要方塊圖。5 is a schematic block diagram of a memory control circuit unit according to an exemplary embodiment of the invention.

請參照圖5,記憶體控制電路單元404包括記憶體管理電路502、主機介面504及記憶體介面506。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 commands, and when the memory storage device 10 is operating, the control commands are executed to perform operations such as writing, reading, and erasing of data. The following description of the operation of the memory management circuit 502 is equivalent to the operation of the memory control circuit unit 404.

在本範例實施例中,記憶體管理電路502的控制指令是以韌體型式來實作。例如,記憶體管理電路502具有微處理器單元(未繪示)與唯讀記憶體(未繪示),並且此些控制指令是被燒錄至此唯讀記憶體中。當記憶體儲存裝置10運作時,此些控制指令會由微處理器單元來執行以進行資料的寫入、讀取與抹除等運作。In the present exemplary embodiment, the control commands of the memory management circuit 502 are implemented in the form of firmware. For example, the memory management circuit 502 has a microprocessor unit (not shown) and a read-only memory (not shown), and the control commands are burned into the read-only memory. When the memory storage device 10 is operating, these control commands are executed by the microprocessor unit to perform operations such as writing, reading, and erasing of data.

在另一範例實施例中,記憶體管理電路502的控制指令亦可以程式碼型式儲存於可複寫式非揮發性記憶體模組406的特定區域(例如,記憶體模組中專用於存放系統資料的系統區)中。此外,記憶體管理電路502具有微處理器單元(未繪示)、唯讀記憶體(未繪示)及隨機存取記憶體(未繪示)。特別是,此唯讀記憶體具有開機碼(boot code),並且當記憶體控制電路單元404被致能時,微處理器單元會先執行此開機碼來將儲存於可複寫式非揮發性記憶體模組406中之控制指令載入至記憶體管理電路502的隨機存取記憶體中。之後,微處理器單元會運轉此些控制指令以進行資料的寫入、讀取與抹除等運作。In another exemplary embodiment, the control commands of the memory management circuit 502 can also be stored in a specific area of the rewritable non-volatile memory module 406 in program code (for example, the memory module is dedicated to storing system data System area). 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, the 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 in the rewritable non-volatile memory The control commands in the body module 406 are loaded into the random access memory of the memory management circuit 502. Afterwards, the microprocessor unit will run these control commands to write, read, and erase data.

此外,在另一範例實施例中,記憶體管理電路502的控制指令亦可以一硬體型式來實作。例如,記憶體管理電路502包括微控制器、記憶胞管理電路、記憶體寫入電路、記憶體讀取電路、記憶體抹除電路與資料處理電路。記憶胞管理電路、記憶體寫入電路、記憶體讀取電路、記憶體抹除電路與資料處理電路是耦接至微控制器。記憶胞管理電路用以管理可複寫式非揮發性記憶體模組406的記憶胞或記憶胞群組。記憶體寫入電路用以對可複寫式非揮發性記憶體模組406下達寫入指令序列以將資料寫入至可複寫式非揮發性記憶體模組406中。記憶體讀取電路用以對可複寫式非揮發性記憶體模組406下達讀取指令序列以從可複寫式非揮發性記憶體模組406中讀取資料。記憶體抹除電路用以對可複寫式非揮發性記憶體模組406下達抹除指令序列以將資料從可複寫式非揮發性記憶體模組406中抹除。資料處理電路用以處理欲寫入至可複寫式非揮發性記憶體模組406的資料以及從可複寫式非揮發性記憶體模組406中讀取的資料。寫入指令序列、讀取指令序列及抹除指令序列可各別包括一或多個程式碼或指令碼並且用以指示可複寫式非揮發性記憶體模組406執行相對應的寫入、讀取及抹除等操作。在一範例實施例中,記憶體管理電路502還可以下達其他類型的指令序列給可複寫式非揮發性記憶體模組406以指示執行相對應的操作。In addition, in another exemplary embodiment, the control commands of the memory management circuit 502 can also be implemented in a hardware type. For example, the memory management circuit 502 includes a microcontroller, a memory cell management circuit, a memory writing circuit, a memory reading circuit, a memory erasing circuit, and a data processing circuit. The memory cell management circuit, memory writing circuit, memory reading circuit, memory erasing circuit and data processing circuit are coupled to the microcontroller. The memory cell management circuit is used to manage memory cells or memory cell groups of the rewritable non-volatile memory module 406. The memory writing circuit is used to issue a write command 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 command sequence to the rewritable non-volatile memory module 406 to read data from the rewritable non-volatile memory module 406. The memory erasing circuit is used to issue an erase command sequence to the rewritable non-volatile memory module 406 to erase data from the rewritable non-volatile memory module 406. The data processing circuit processes data to be written to the rewritable non-volatile memory module 406 and data read from the rewritable non-volatile memory module 406. The write command sequence, read command sequence, and erase command sequence may each include one or more program codes or command codes and are used to instruct the rewritable non-volatile memory module 406 to perform the corresponding write, read Take and erase operations. In an exemplary embodiment, the memory management circuit 502 can also issue other types of command sequences to the rewritable non-volatile memory module 406 to instruct to perform the corresponding operation.

主機介面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標準或其他適合的資料傳輸標準。The host interface 504 is coupled to the memory management circuit 502. The memory management circuit 502 can communicate with the host system 11 through the host interface 504. The host interface 504 can be used to receive and identify commands and data sent by the host system 11. For example, the commands and data transmitted by the host system 11 can 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 exemplary embodiment, the host interface 504 is compatible with the SATA standard. However, it must be understood that the present invention is not limited to this, 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, 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. In other words, the data to be written to the rewritable non-volatile memory module 406 is 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 the corresponding command sequence. For example, these command sequences may include a write command sequence instructing to write data, a read command sequence instructing to read data, an erase command sequence instructing to erase data, and various memory operations (for example, changing the read Take the voltage level or perform the garbage collection operation, etc.) the corresponding instruction sequence. These command sequences are generated by the memory management circuit 502 and transmitted to the rewritable non-volatile memory module 406 through the memory interface 506, for example. These command sequences may include one or more signals or data on the bus. These signals or data may include instruction codes or program codes. For example, in the read command sequence, the read identification code, memory address and other information will be included.

在一範例實施例中,記憶體控制電路單元404還包括錯誤檢查與校正電路508、緩衝記憶體510與電源管理電路512。In an exemplary embodiment, the memory control circuit unit 404 further includes an error check 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 check and correction circuit 508 is coupled to the memory management circuit 502 and is used to perform error check and correction operations to ensure the accuracy of the data. Specifically, when the memory management circuit 502 receives the write command from the host system 11, the error checking and correction circuit 508 generates a corresponding error correcting code (ECC) for the data corresponding to the write command And/or error detection code (EDC), and the memory management circuit 502 writes the data corresponding to the write command and the corresponding error correction code and/or error check code to the rewritable non-volatile The memory module 406. After that, when the memory management circuit 502 reads data from the rewritable non-volatile memory module 406, it simultaneously reads the error correction code and/or error check code corresponding to the data, and the error check and correction circuit 508 Based on this error correction code and/or error check code, error checking and correction operations will be performed on the read data.

緩衝記憶體510是耦接至記憶體管理電路502並且用以暫存來自於主機系統11的資料與指令或來自於可複寫式非揮發性記憶體模組406的資料。電源管理電路512是耦接至記憶體管理電路502並且用以控制記憶體儲存裝置10的電源。The buffer memory 510 is coupled to the memory management circuit 502 and is used to temporarily store data and commands 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 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 referred to as a flash memory module, and the memory control circuit unit 404 is also referred to as a control flash memory The flash memory controller of the module, and/or the memory management circuit 502 of FIG. 5 are also referred to as flash memory management circuits.

圖6是根據本發明的一範例實施例所繪示的管理可複寫式非揮發性記憶體模組的示意圖。6 is a schematic diagram of managing a rewritable non-volatile memory module according to an exemplary embodiment of the present invention.

請參照圖6,記憶體管理電路502可將可複寫式非揮發性記憶體模組406的實體單元610(0)~610(C)邏輯地分組至儲存區601、閒置(spare)區602及系統區603。儲存區601中的實體單元610(0)~610(A)儲存有資料。例如,儲存區601中的實體單元610(0)~610(A)可儲存有效(valid)資料與無效(invalid)資料。閒置區602中的實體單元610(A+1)~610(B)尚未用來儲存資料(例如有效資料)。系統區603中的實體單元610(B+1)~610(C)用以儲存系統資料,例如邏輯至實體映射表、壞塊管理表、裝置型號或其他類型的管理資料。6, the memory management circuit 502 can logically group the physical units 610(0) to 610(C) of the rewritable non-volatile memory module 406 into the storage area 601, the spare area 602 and System area 603. The physical units 610(0) to 610(A) in the storage area 601 store data. For example, the physical units 610(0)-610(A) in the storage area 601 can store valid data and invalid data. The physical units 610(A+1)~610(B) in the idle area 602 have not been used to store data (such as valid data). The physical units 610 (B+1) to 610 (C) in the system area 603 are used to store system data, such as logic to physical mapping tables, bad block management tables, device models, or other types of management data.

記憶體管理電路502可從閒置區602的實體單元610(A+1)~610(B)中選擇一個實體單元並且將來自主機系統11或來自儲存區601中至少一實體單元的資料儲存至所選的實體單元中。同時,所選的實體單元會被關聯至儲存區601。此外,在抹除儲存區601中的某一個實體單元後,所抹除的實體單元會被重新關聯至閒置區602。The memory management circuit 502 can select a physical unit from the physical units 610 (A+1) to 610 (B) in the idle area 602 and store data from the host system 11 or from at least one physical unit in the storage area 601 to all Selected solid element. At the same time, the selected physical unit will be associated with the storage area 601. In addition, after erasing a certain physical unit in the storage area 601, the erased physical unit will be re-associated to the idle area 602.

在本範例實施例中,屬於儲存區601的每一個實體單元亦稱為非閒置(non-spare)實體單元,而屬於閒置區602的每一個實體單元亦稱為閒置實體單元。在本範例實施例中,一個實體單元是指一個實體抹除單元。然而,在另一範例實施例中,一個實體單元亦可以包含多個實體抹除單元。In this exemplary embodiment, each physical unit belonging to the storage area 601 is also referred to as a non-spare physical unit, and each physical unit belonging to the idle area 602 is also referred to as an idle physical unit. In this exemplary embodiment, a physical unit refers to a physical erasing unit. However, in another exemplary embodiment, one physical unit may also include multiple physical erasing units.

記憶體管理電路502可配置邏輯單元612(0)~612(D)以映射儲存區601中的實體單元610(0)~610(A)。在本範例實施例中,每一個邏輯單元是指一個邏輯位址。然而,在另一範例實施例中,一個邏輯單元也可以是指一個邏輯程式化單元、一個邏輯抹除單元或者由多個連續或不連續的邏輯位址組成。此外,邏輯單元612(0)~612(D)中的每一者可被映射至一或多個實體單元。須注意的是,記憶體管理電路502可不配置映射至系統區603的邏輯單元,以防止儲存於系統區603的系統資料被使用者修改。The memory management circuit 502 can configure the logical units 612(0)-612(D) to map the physical units 610(0)-610(A) in the storage area 601. In this exemplary embodiment, each logical unit refers to a logical address. However, in another exemplary embodiment, a logic unit may also refer to a logic programming unit, a logic erasing unit, or consist of multiple consecutive or non-contiguous logical addresses. In addition, each of the logical units 612(0) to 612(D) may be mapped to one or more physical units. It should be noted that the memory management circuit 502 may not be configured with a logical unit mapped to the system area 603 to prevent the system data stored in the system area 603 from being modified by the user.

記憶體管理電路502會將邏輯單元與實體單元之間的映射資訊(亦稱為邏輯至實體映射資訊)記錄於至少一邏輯至實體映射表。此映射資訊可反映儲存區601中的某一個實體單元與某一個邏輯單元之間的映射關係。邏輯至實體映射表是儲存於系統區603的實體單元610(B+1)~610(C)中。記憶體管理電路502可根據此邏輯至實體映射表來執行對於記憶體儲存裝置10的資料存取操作。例如,記憶體管理電路502可根據某一個邏輯至實體映射表獲得儲存區601中的某一個實體單元與某一個邏輯單元之間的映射關係。記憶體管理電路502可根據此映射關係存取此實體單元。The memory management circuit 502 records the mapping information between logical units and physical units (also referred to as logical-to-physical mapping information) in at least one logical-to-physical mapping table. The mapping information can reflect the mapping relationship between a certain physical unit and a certain logical unit in the storage area 601. The logical-to-physical mapping table is stored in the physical units 610(B+1)~610(C) of the system area 603. The memory management circuit 502 can perform data access operations to the memory storage device 10 according to this logic-to-physical mapping table. For example, the memory management circuit 502 may obtain a mapping relationship between a certain physical unit and a certain logical unit in the storage area 601 according to a certain logic-to-entity mapping table. The memory management circuit 502 can access the physical unit according to the mapping relationship.

在本範例實施例中,有效資料是屬於某一個邏輯單元的最新資料,而無效資料則不是屬於任一個邏輯單元的最新資料。例如,若主機系統11將一筆新資料儲存至某一邏輯單元而覆蓋掉此邏輯單元原先儲存的舊資料(即,更新屬於此邏輯單元的資料),則儲存至儲存區601中的此筆新資料即為屬於此邏輯單元的最新資料並且會被標記為有效,而被覆蓋掉的舊資料可能仍然儲存在儲存區601中但被標記為無效。In this exemplary embodiment, valid data is the latest data belonging to a certain logical unit, and invalid data is not the latest data belonging to any logical unit. For example, if the host system 11 stores a new piece of data in a logical unit and overwrites the old data originally stored in the logical unit (ie, updates the data belonging to the logical unit), the new piece of data stored in the storage area 601 The data is the latest data belonging to this logical unit and will be marked as valid, while the old data that is overwritten may still be stored in the storage area 601 but marked as invalid.

在本範例實施例中,若屬於某一邏輯單元的資料被更新,則此邏輯單元與儲存有屬於此邏輯單元之舊資料的實體單元之間的映射關係會被移除,並且此邏輯單元與儲存有屬於此邏輯單元之最新資料的實體單元之間的映射關係會被建立。然而,在另一範例實施例中,若屬於某一邏輯單元的資料被更新,則此邏輯單元與儲存有屬於此邏輯單元之舊資料的實體單元之間的映射關係仍可被維持。In this exemplary embodiment, if the data belonging to a logical unit is updated, the mapping relationship between the logical unit and the physical unit storing the old data belonging to the logical unit is removed, and the logical unit and The mapping relationship between the physical units storing the latest data belonging to this logical unit will be established. However, in another exemplary embodiment, if the data belonging to a logical unit is updated, the mapping relationship between the logical unit and the physical unit storing the old data belonging to the logical unit can still be maintained.

當記憶體儲存裝置10出廠時,屬於閒置區602的實體單元的總數會是一個預設數目(例如,30)。在記憶體儲存裝置10的運作中,越來越多的實體單元會被從閒置區602選擇並且被關聯至儲存區601以儲存資料(例如,來自主機系統11的使用者資料)。因此,屬於閒置區602的實體單元的總數可隨著記憶體儲存裝置10的使用而逐漸減少。When the memory storage device 10 is shipped from the factory, the total number of physical units belonging to the idle area 602 will be a predetermined number (for example, 30). During the operation of the memory storage device 10, more and more physical units are selected from the idle area 602 and associated with the storage area 601 to store data (eg, user data from the host system 11). Therefore, the total number of physical units belonging to the idle area 602 may gradually decrease as the memory storage device 10 is used.

在記憶體儲存裝置10的運作中,記憶體管理電路502可持續更新屬於閒置區602的實體單元的總數。記憶體管理電路502可根據閒置區602中實體單元的數目(即,閒置實體單元的總數)執行資料整併操作。例如,記憶體管理電路502可判斷屬於閒置區602的實體單元的總數是否小於或等於一個門檻值(亦稱為第一門檻值)。此第一門檻值例如是2或者更大的值(例如,10),本發明不加以限制。若屬於閒置區602的實體單元的總數小於或等於第一門檻值,記憶體管理電路502可執行資料整併操作。在一範例實施例中,資料整併操作亦稱為垃圾收集(garbage collection)操作。During the operation of the memory storage device 10, the memory management circuit 502 can continuously update the total number of physical units belonging to the idle area 602. The memory management circuit 502 may perform data consolidation according to the number of physical units in the idle area 602 (ie, the total number of idle physical units). For example, the memory management circuit 502 can determine whether the total number of physical units belonging to the idle area 602 is less than or equal to a threshold (also referred to as a first threshold). The first threshold value is, for example, 2 or greater (for example, 10), which is not limited by the present invention. If the total number of physical units belonging to the idle area 602 is less than or equal to the first threshold, the memory management circuit 502 may perform data consolidation. In an exemplary embodiment, the data consolidation operation is also referred to as a garbage collection operation.

在資料整併操作中,記憶體管理電路502可從儲存區601中選擇至少一個實體單元作為來源節點。記憶體管理電路502可將有效資料從所選擇的實體單元(即來源節點)複製到作為回收節點的至少一個實體單元。用來儲存所複製之有效資料的實體單元(即回收節點)是從閒置區602中選擇並且會被關聯至儲存區601。若某一個實體單元所儲存的有效資料皆已被複製至回收節點,則此實體單元可被抹除並且被關聯至閒置區602。在一範例實施例中,將某一個實體單元從儲存區601重新關聯回閒置區602的操作(或抹除某一個實體單元的操作)亦稱為釋放一個閒置實體單元。藉由執行資料整併操作,一或多個閒置實體單元會被釋放並且使得屬於閒置區602的實體單元的總數逐漸增加。In the data consolidation operation, the memory management circuit 502 may select at least one physical unit from the storage area 601 as the source node. The memory management circuit 502 may copy the valid data from the selected physical unit (ie, the source node) to at least one physical unit as the recycling node. The physical unit (that is, the recycling node) used to store the copied valid data is selected from the idle area 602 and will be associated with the storage area 601. If all the valid data stored in a certain physical unit has been copied to the recycling node, the physical unit can be erased and associated with the idle area 602. In an exemplary embodiment, the operation of reassociating a certain physical unit from the storage area 601 back to the idle area 602 (or the operation of erasing a certain physical unit) is also called releasing an idle physical unit. By performing the data consolidation operation, one or more idle physical units are released and the total number of physical units belonging to the idle area 602 is gradually increased.

在開始執行資料整併操作後,若屬於閒置區602之實體單元符合一特定條件,資料整併操作可被停止。例如,記憶體管理電路502可判斷屬於閒置區602的實體單元的總數是否大於或等於一個門檻值(以下亦稱為第二門檻值)。例如,第二門檻值可以大於或等於第一門檻值。若屬於閒置區602的實體單元的總數大於或等於第二門檻值,記憶體管理電路502可停止資料整併操作。須注意的是,停止資料整併操作是指結束當前執行中的資料整併操作。在停止一個資料整併操作之後,若屬於閒置區602的實體單元的總數再次小於或等於第一門檻值,則下一個資料整併操作可再次被執行,以釋放新的閒置實體單元。After the data consolidation operation is started, if the physical unit belonging to the idle area 602 meets a specific condition, the data consolidation operation can be stopped. For example, the memory management circuit 502 can determine whether the total number of physical units belonging to the idle area 602 is greater than or equal to a threshold (hereinafter also referred to as a second threshold). For example, the second threshold value may be greater than or equal to the first threshold value. If the total number of physical units belonging to the idle area 602 is greater than or equal to the second threshold, the memory management circuit 502 may stop data consolidation and operation. It should be noted that stopping the data consolidation operation refers to ending the currently executing data consolidation operation. After stopping a data consolidation operation, if the total number of physical units belonging to the idle area 602 is again less than or equal to the first threshold, the next data consolidation operation can be executed again to release the new idle physical unit.

圖7是根據本發明的一範例實施例所繪示的資料整併操作的示意圖。7 is a schematic diagram of data consolidation operation according to an exemplary embodiment of the present invention.

請參照圖7,在資料整併操作中,記憶體管理電路502可指示從作為來源節點701的實體單元710(0)~710(E)中收集資料700並將資料700暫存於緩衝記憶體510。屬於來源節點701的實體單元710(0)~710(E)是從圖6的儲存區601中選擇。資料700為有效資料。然後,記憶體管理電路502可指示將資料700寫入至作為回收節點702的實體單元720(0)~720(F)。屬於回收節點702的實體單元720(0)~720(F)是從圖6的閒置區602中選擇。換言之,在資料整併操作中,資料700可被從作為來源節點701的實體單元710(0)~710(E)複製到作為回收節點702的實體單元720(0)~720(F)。Referring to FIG. 7, in the data consolidation operation, the memory management circuit 502 may instruct to collect data 700 from the physical units 710(0) to 710(E) as the source node 701 and temporarily store the data 700 in the buffer memory 510. The physical units 710(0) to 710(E) belonging to the source node 701 are selected from the storage area 601 of FIG. 6. The data 700 is valid data. Then, the memory management circuit 502 may instruct to write the data 700 to the physical units 720(0) to 720(F) as the recovery node 702. The physical units 720(0) to 720(F) belonging to the recycling node 702 are selected from the idle area 602 of FIG. 6. In other words, in the data consolidation operation, the data 700 can be copied from the physical units 710(0) to 710(E) as the source node 701 to the physical units 720(0) to 720(F) as the recycling node 702.

在一範例實施例中,記憶體管理電路502可根據圖6的儲存區601中多個實體單元之間的邏輯距離值來從儲存區601中選擇一或多個實體單元作為有效資料的來源節點701。例如,假設實體單元610(0)(亦稱為第一實體單元)映射至一或多個邏輯單元(亦稱為第一邏輯單元)且實體單元610(1)(亦稱為第二實體單元)映射至一或多個邏輯單元(亦稱為第二邏輯單元)。實體單元610(0)與610(1)之間的邏輯距離值(亦稱為第一邏輯距離值)可反映第一邏輯單元與第二邏輯單元之間的分散程度(亦稱為第一邏輯分散度)。例如,第一邏輯距離值可正相關於此邏輯分散度。例如,第一邏輯距離值越大,表示第一邏輯單元與第二邏輯單元之間的邏輯分散度越高。In an exemplary embodiment, the memory management circuit 502 may select one or more physical units from the storage area 601 as the source node of valid data according to the logical distance value between the multiple physical units in the storage area 601 of FIG. 6 701. For example, assume that physical unit 610(0) (also known as the first physical unit) maps to one or more logical units (also known as the first logical unit) and physical unit 610(1) (also known as the second physical unit) ) Maps to one or more logical units (also called second logical units). The logical distance value between physical units 610(0) and 610(1) (also called the first logical distance value) can reflect the degree of dispersion between the first logical unit and the second logical unit (also called the first logical unit) Dispersion). For example, the first logical distance value may be positively related to this logical dispersion. For example, the larger the first logical distance value, the higher the logical dispersion between the first logical unit and the second logical unit.

在一範例實施例中,第一邏輯單元與第二邏輯單元之間的邏輯分散度與第一邏輯單元與第二邏輯單元之編號的集中度(或接近度)有關。假設第一邏輯單元與第二邏輯單元的編號較集中或較接近(例如第一邏輯單元與第二邏輯單元的編號落於某一個編號範圍內),則可判定第一邏輯單元與第二邏輯單元的邏輯分散度較低。或者,假設第一邏輯單元與第二邏輯單元的編號較分散或較不接近(例如第一邏輯單元的編號落於某一編號範圍內,且第二邏輯單元的編號落於另一個編號範圍),則可判定第一邏輯單元與第二邏輯單元的邏輯分散度較高。在一範例實施例中,連續編號的多個邏輯單元具有較小的邏輯分散度,而不連續編號的多個邏輯單元具有較大的邏輯分散度。In an exemplary embodiment, the degree of logical dispersion between the first logical unit and the second logical unit is related to the number concentration (or proximity) of the first logical unit and the second logical unit. Assuming that the numbers of the first logical unit and the second logical unit are more concentrated or closer (for example, the numbers of the first logical unit and the second logical unit fall within a certain number range), the first logical unit and the second logical unit can be determined The logical dispersion of the unit is low. Or, assume that the numbers of the first logical unit and the second logical unit are more scattered or less close (for example, the number of the first logical unit falls within a certain number range, and the number of the second logical unit falls within another number range) , It can be determined that the logical dispersion of the first logical unit and the second logical unit is high. In an exemplary embodiment, multiple consecutively numbered logical units have a smaller degree of logical dispersion, and multiple consecutively numbered logical units have a larger degree of logical dispersion.

在一範例實施例中,記憶體管理電路502可優先選擇圖6的儲存區601中具有最小的邏輯距離值的多個實體單元作為來源節點701。在一範例實施例中,記憶體管理電路502可優先選擇圖6的儲存區601中具有較小的邏輯距離值的多個實體單元作為來源節點701。例如,假設實體單元610(0)與實體單元610(1)之間的邏輯距離值(即第一邏輯距離值)為5,且實體單元610(0)與實體單元610(A)(亦稱為第三實體單元)之間的邏輯距離值(亦稱為第二邏輯距離值)為1,則記憶體管理電路502可比較第一邏輯距離值與第二邏輯距離值。根據比較結果,記憶體管理電路502可優先選擇實體單元610(0)與實體單元610(A)作為來源節點701。或者,若實體單元610(0)與實體單元610(1)之間的邏輯距離值為2,且實體單元610(0)與實體單元610(A)之間的邏輯距離值為3,則記憶體管理電路502可優先選擇實體單元610(0)與實體單元610(1)作為來源節點701。In an exemplary embodiment, the memory management circuit 502 may preferentially select, as the source node 701, a plurality of physical units having the smallest logical distance value in the storage area 601 of FIG. 6. In an exemplary embodiment, the memory management circuit 502 may preferentially select, as the source node 701, a plurality of physical units having a smaller logical distance value in the storage area 601 of FIG. 6. For example, assume that the logical distance value (ie, the first logical distance value) between the physical unit 610(0) and the physical unit 610(1) is 5, and the physical unit 610(0) and the physical unit 610(A) (also known as If the logical distance value (also referred to as the second logical distance value) between the third physical units is 1, the memory management circuit 502 can compare the first logical distance value with the second logical distance value. According to the comparison result, the memory management circuit 502 may preferentially select the physical unit 610(0) and the physical unit 610(A) as the source node 701. Or, if the logical distance between the physical unit 610(0) and the physical unit 610(1) is 2, and the logical distance between the physical unit 610(0) and the physical unit 610(A) is 3, then remember The volume management circuit 502 may preferentially select the physical unit 610(0) and the physical unit 610(1) as the source node 701.

在一範例實施例中,記憶體管理電路502可優先選擇圖6的儲存區601中邏輯距離值小於一目標距離值的多個實體單元作為來源節點701。例如,假設目標距離值為3且實體單元610(0)與實體單元610(1)之間的邏輯距離值(即第一邏輯距離值)為2,則記憶體管理電路502可根據第一邏輯距離值與目標距離值的比較結果(即第一邏輯距離值不大於目標距離值)優先選擇實體單元610(0)與實體單元610(1)作為來源節點701。或者,若第一邏輯距離值(例如5)大於目標距離值(例如3),記憶體管理電路502可不選擇實體單元610(0)及/或實體單元610(1)作為來源節點701。In an exemplary embodiment, the memory management circuit 502 may preferentially select, as the source node 701, a plurality of physical units in the storage area 601 of FIG. 6 whose logical distance value is less than a target distance value. For example, assuming that the target distance value is 3 and the logical distance value (ie, the first logical distance value) between the physical unit 610(0) and the physical unit 610(1) is 2, the memory management circuit 502 may use the first logic The comparison result of the distance value and the target distance value (that is, the first logical distance value is not greater than the target distance value) preferentially selects the physical unit 610(0) and the physical unit 610(1) as the source node 701. Alternatively, if the first logical distance value (eg, 5) is greater than the target distance value (eg, 3), the memory management circuit 502 may not select the physical unit 610(0) and/or the physical unit 610(1) as the source node 701.

在一範例實施例中,記憶體管理電路502可根據圖6中實體單元610(0)與實體單元610(A)之間的邏輯距離值(即第二邏輯距離值)來設定目標距離值。例如,記憶體管理電路502可直接將第二邏輯距離值設定為目標距離值。或者,在一範例實施例中,記憶體管理電路502可根據圖6的儲存區601中所有或至少部分實體單元之間的邏輯距離值來設定目標距離值。例如,目標距離值可為儲存區601中所有或至少部分實體單元之間的邏輯距離值的平均值。記憶體管理電路502可根據實體單元610(0)與實體單元610(1)之間的邏輯距離值(即第一邏輯距離值)是否大於此目標距離值來決定是否選擇實體單元610(0)及/或實體單元610(1)作為來源節點701。In an exemplary embodiment, the memory management circuit 502 may set the target distance value according to the logical distance value (ie, the second logical distance value) between the physical unit 610(0) and the physical unit 610(A) in FIG. 6. For example, the memory management circuit 502 may directly set the second logical distance value as the target distance value. Alternatively, in an exemplary embodiment, the memory management circuit 502 may set the target distance value according to the logical distance value between all or at least part of the physical units in the storage area 601 in FIG. 6. For example, the target distance value may be an average value of the logical distance values between all or at least part of the physical units in the storage area 601. The memory management circuit 502 may determine whether to select the physical unit 610(0) according to whether the logical distance value (ie, the first logical distance value) between the physical unit 610(0) and the physical unit 610(1) is greater than the target distance value And/or physical unit 610(1) as source node 701.

在一範例實施例中,記憶體管理電路502還可考慮其他規則來從圖6的儲存區601中選擇一或多個實體單元作為來源節點701。例如,記憶體管理電路502可根據儲存區601中至少部分實體單元所儲存的有效資料的資料量以及此些實體單元之間的邏輯距離值來選擇一或多個實體單元作為來源節點701。例如,在一範例實施例中,記憶體管理電路502可根據儲存區601中至少部分實體單元所儲存的有效資料的資料量選擇多個實體單元作為候選實體單元。然後,記憶體管理電路502可根據此些候選實體單元之間的邏輯距離值從中選擇一或多個實體單元作為來源節點701。或者,在一範例實施例中,記憶體管理電路502可根據儲存區601中至少部分實體單元之間的邏輯距離值來選擇多個實體單元作為候選實體單元。然後,記憶體管理電路502可根據此些候選實體單元所儲存的有效資料的資料量從中選擇一或多個實體單元作為來源節點701。藉此,記憶體管理電路502可優先選擇邏輯距離值較小及/或儲存較少有效資料的實體單元作為來源節點701。In an exemplary embodiment, the memory management circuit 502 may also consider other rules to select one or more physical units from the storage area 601 of FIG. 6 as the source node 701. For example, the memory management circuit 502 may select one or more physical units as the source node 701 according to the amount of valid data stored in at least some of the physical units in the storage area 601 and the logical distance between the physical units. For example, in an exemplary embodiment, the memory management circuit 502 may select a plurality of physical units as candidate physical units according to the amount of valid data stored in at least part of the physical units in the storage area 601. Then, the memory management circuit 502 can select one or more physical units as the source node 701 according to the logical distance between the candidate physical units. Alternatively, in an exemplary embodiment, the memory management circuit 502 may select a plurality of physical units as candidate physical units according to the logical distance between at least some physical units in the storage area 601. Then, the memory management circuit 502 can select one or more physical units as the source node 701 according to the amount of valid data stored in the candidate physical units. In this way, the memory management circuit 502 can preferentially select the physical unit having a smaller logical distance value and/or storing less valid data as the source node 701.

在一範例實施例中,第一邏輯單元的邏輯至實體映射資訊記載於至少一個邏輯至實體映射表(亦稱為第一邏輯至實體映射表)。例如,第一邏輯單元的邏輯至實體映射資訊可反映第一邏輯單元與圖6的實體單元610(0)(即第一實體單元)之間的映射關係。第二邏輯單元的邏輯至實體映射資訊也記載於至少一個邏輯至實體映射表(亦稱為第二邏輯至實體映射表)。例如,第二邏輯單元的邏輯至實體映射資訊可反映第二邏輯單元與圖6的實體單元610(1)(即第二實體單元)之間的映射關係。在一範例實施例中,第一邏輯距離值更反映第一邏輯至實體映射表與第二邏輯至實體映射表之間的重疊程度。例如,若第一邏輯至實體映射表與第二邏輯至實體映射表之間越多表格是重覆的,則第一邏輯至實體映射表與第二邏輯至實體映射表之間的重疊程度越高。In an exemplary embodiment, the logic-to-entity mapping information of the first logic unit is recorded in at least one logic-to-entity mapping table (also referred to as the first logic-to-entity mapping table). For example, the logic-to-entity mapping information of the first logical unit may reflect the mapping relationship between the first logical unit and the physical unit 610(0) of FIG. 6 (ie, the first physical unit). The logic-to-entity mapping information of the second logic unit is also recorded in at least one logic-to-entity mapping table (also called the second logic-to-entity mapping table). For example, the logic-to-entity mapping information of the second logical unit may reflect the mapping relationship between the second logical unit and the physical unit 610(1) of FIG. 6 (ie, the second physical unit). In an exemplary embodiment, the first logical distance value further reflects the degree of overlap between the first logical-to-physical mapping table and the second logical-to-physical mapping table. For example, if the more tables between the first logical-to-physical mapping table and the second logical-to-physical mapping table are duplicates, the greater the degree of overlap between the first logical-to-physical mapping table and the second logical-to-physical mapping table high.

在一範例實施例中,第一邏輯至實體映射表與第二邏輯至實體映射表之間的重疊程度負相關於第一實體單元與第二實體單元之間的邏輯距離值。亦即,若第一邏輯至實體映射表與第二邏輯至實體映射表之間的重疊程度越高,則第一實體單元與第二實體單元之間的邏輯距離值越小。記憶體管理電路502可根據第一邏輯至實體映射表與第二邏輯至實體映射表之間的重疊程度選擇一或多個實體單元作為來源節點701並執行所述資料整併操作。In an exemplary embodiment, the degree of overlap between the first logical-to-physical mapping table and the second logical-to-physical mapping table is negatively related to the logical distance value between the first physical unit and the second physical unit. That is, the higher the degree of overlap between the first logical-to-physical mapping table and the second logical-to-physical mapping table, the smaller the logical distance value between the first physical unit and the second physical unit. The memory management circuit 502 may select one or more physical units as the source node 701 according to the degree of overlap between the first logical-to-physical mapping table and the second logical-to-physical mapping table and perform the data consolidation operation.

圖8是根據本發明的一範例實施例所繪示的表格映射資訊的示意圖。FIG. 8 is a schematic diagram of table mapping information according to an exemplary embodiment of the present invention.

請參照圖8,表格映射資訊801對應於實體單元810(0),且表格映射資訊802對應於實體單元810(1)。邏輯至實體映射表830可儲存於圖6的系統區603。邏輯至實體映射表830包含邏輯至實體映射表TB1 ~TBM 。邏輯至實體映射表TB1 ~TBM 分別用以記錄某一個編號範圍內的至少一邏輯單元的邏輯至實體映射資訊。Referring to FIG. 8, the table mapping information 801 corresponds to the physical unit 810(0), and the table mapping information 802 corresponds to the physical unit 810(1). The logical to physical mapping table 830 may be stored in the system area 603 of FIG. 6. The logical to physical mapping table 830 includes logical to physical mapping tables TB 1 ˜TB M. The logical-to-physical mapping tables TB 1 ~TB M are respectively used to record logical-to-physical mapping information of at least one logical unit within a certain number range.

表格映射資訊801可反映實體單元810(0)所映射的邏輯單元的邏輯至實體映射資訊是儲存於邏輯至實體映射表TB1 ~TBM 的至少其中之一。表格映射資訊802可反映實體單元810(1)所映射的邏輯單元的邏輯至實體映射資訊是儲存於邏輯至實體映射表TB1 ~TBM 的至少其中之一。例如,表格映射資訊801與802可皆具有位元b1 ~bM 。位元bi 的數值可為0或1,以反映邏輯至實體映射表TBi 是否被使用。數值i介於1與M之間。The table mapping information 801 may reflect that the logical-to-physical mapping information of the logical unit mapped by the physical unit 810(0) is stored in at least one of the logical-to-physical mapping tables TB 1 ˜TB M. The table mapping information 802 may reflect that the logical-to-physical mapping information of the logical unit mapped by the physical unit 810(1) is stored in at least one of the logical-to-physical mapping tables TB 1 ˜TB M. For example, both table mapping information 801 and 802 may have bits b 1 ~b M. The value of bit b i can be 0 or 1 to reflect whether the logical to physical mapping table TB i is used. The value i is between 1 and M.

在一範例實施例中,假設實體單元810(0)是映射至圖6的邏輯單元612(1)與612(3),則表格映射資訊801中的位元b1 與b3 的數值可為1(其餘位元可為0),以反映邏輯單元612(1)與612(3)的邏輯至實體映射資訊是記錄於邏輯至實體映射表TB1 與TB3 。邏輯至實體映射表TB1 與TB3 可被載入至圖5的緩衝記憶體510以存取實體單元810(0)。此外,假設實體單元810(1)是映射至圖6的邏輯單元612(1)、612(3)及612(8),則表格映射資訊802中的位元b1 、b3 及b8 的數值可為1(其餘位元可為0),以反映邏輯單元612(1)、612(3)及612(8)的邏輯至實體映射資訊是記錄於邏輯至實體映射表TB1 、TB3 及TB8 。邏輯至實體映射表TB1 、TB3 及TB8 可被載入至緩衝記憶體510以存取實體單元810(1)。In an exemplary embodiment, assuming that the physical unit 810(0) is mapped to the logical units 612(1) and 612(3) of FIG. 6, the values of bits b 1 and b 3 in the table mapping information 801 may be 1 (the remaining bits can be 0) to reflect the logical-to-physical mapping information of the logical units 612(1) and 612(3) is recorded in the logical-to-physical mapping tables TB 1 and TB 3 . The logical to physical mapping tables TB 1 and TB 3 can be loaded into the buffer memory 510 of FIG. 5 to access the physical unit 810(0). In addition, assuming that the physical unit 810(1) is mapped to the logical units 612(1), 612(3), and 612(8) of FIG. 6, the bits b 1 , b 3, and b 8 in the table mapping information 802 The value can be 1 (the remaining bits can be 0) to reflect the logical-to-physical mapping information of the logical units 612(1), 612(3), and 612(8) is recorded in the logical-to-physical mapping tables TB 1 , TB 3 And TB 8 . The logical to physical mapping tables TB 1 , TB 3 and TB 8 can be loaded into the buffer memory 510 to access the physical unit 810 (1 ).

在前述範例實施例中,表格映射資訊801與802中的位元b1 與b3 皆為1,表示用於存取實體單元810(0)與810(1)的多個邏輯至實體映射表中邏輯至實體映射表TB1 與TB3 是重複的。當存取實體單元810(0)時,邏輯至實體映射表TB1 與TB3 可被載入至緩衝記憶體510以查詢相關映射資訊。接著,若存取實體單元810(1),則只需要再額外載入邏輯至實體映射表TB8In the foregoing exemplary embodiment, the bits b 1 and b 3 in the table mapping information 801 and 802 are both 1, indicating multiple logical-to-physical mapping tables used to access the physical units 810(0) and 810(1) The logic to entity mapping tables TB 1 and TB 3 are repeated. When accessing the physical unit 810(0), the logical to physical mapping tables TB 1 and TB 3 can be loaded into the buffer memory 510 to query related mapping information. Then, if the physical unit 810(1) is accessed, only additional logic needs to be loaded into the physical mapping table TB 8 .

在圖7的一範例實施例中,記憶體管理電路502可根據對應於第一實體單元的表格映射資訊(亦稱為第一表格映射資訊)與對應於第二實體單元的表格映射資訊(亦稱為第二表格映射資訊)獲得第一邏輯距離值。根據第一邏輯距離值,記憶體管理電路502可選擇特定的實體單元作為來源節點701,以減少在資料整併操作中需要載入的邏輯至實體映射表的數目。例如,透過將圖6的儲存區601中的至少部分的實體單元之間的邏輯距離值與目標距離值進行比較並選擇符合條件的實體單元作為來源節點701,可有效減少對圖4的可複寫式非揮發性記憶體模組406的存取次數,且可延長可複寫式非揮發性記憶體模組406的使用壽命。In an exemplary embodiment of FIG. 7, the memory management circuit 502 may be based on table mapping information corresponding to the first physical unit (also called first table mapping information) and table mapping information corresponding to the second physical unit (also (Referred to as the second table mapping information) to obtain the first logical distance value. According to the first logical distance value, the memory management circuit 502 can select a specific physical unit as the source node 701 to reduce the number of logic-to-physical mapping tables that need to be loaded in the data consolidation operation. For example, by comparing the logical distance value between at least part of the physical units in the storage area 601 of FIG. 6 with the target distance value and selecting the physical unit that meets the condition as the source node 701, the rewriting of FIG. 4 can be effectively reduced Access times of the non-volatile memory module 406, and can extend the service life of the rewritable non-volatile memory module 406.

圖9A與圖9B是根據本發明的一範例實施例所繪示的獲得邏輯距離值的示意圖。9A and 9B are schematic diagrams of obtaining logical distance values according to an exemplary embodiment of the invention.

請參照圖9A,假設表格映射資訊901是對應於第一實體單元且表格映射資訊902是對應於第二實體單元。表格映射資訊901與902皆具有16個位元。表格映射資訊901中的位元b1 ~b4 為1,其反映邏輯至實體映射表TB1 ~TB4 可被查詢以存取第一實體單元。表格映射資訊902中的位元b1 ~b4 及b9 為1,其反映邏輯至實體映射表TB1 ~TB4 及TB9 可被查詢以存取第二實體單元。透過邏輯模組90對表格映射資訊901與902進行第一運算後,表格差異資訊910可被獲得。例如,邏輯模組90可對表格映射資訊901與902中的位元bj 進行異或(XOR)運算以獲得表格差異資訊910中的位元bj 。j介於1與16之間。表格差異資訊910可反映第一邏輯單元與第二邏輯單元之間的分散程度(即第一邏輯分散度)。此外,表格差異資訊910也可反映第一邏輯至實體映射表與第二邏輯至實體映射表之間的重疊程度。Referring to FIG. 9A, it is assumed that the table mapping information 901 corresponds to the first physical unit and the table mapping information 902 corresponds to the second physical unit. Both table mapping information 901 and 902 have 16 bits. Bits b 1 to b 4 in the table mapping information 901 are 1, which reflects the logic to physical mapping tables TB 1 to TB 4 can be queried to access the first physical unit. Bits b 1 to b 4 and b 9 in the table mapping information 902 are 1, which reflects the logical to physical mapping tables TB 1 to TB 4 and TB 9 can be queried to access the second physical unit. After performing the first operation on the table mapping information 901 and 902 through the logic module 90, the table difference information 910 can be obtained. For example, the logic module 90 may perform an exclusive OR (XOR) operation on the bit b j in the table mapping information 901 and 902 to obtain the bit b j in the table difference information 910. j is between 1 and 16. The table difference information 910 may reflect the degree of dispersion between the first logical unit and the second logical unit (ie, the first logical dispersion). In addition, the table difference information 910 may also reflect the degree of overlap between the first logical-to-physical mapping table and the second logical-to-physical mapping table.

第一實體單元與第二實體單元之間的第一邏輯距離值可根據表格差異資訊910而獲得。例如,可根據表格差異資訊910中的數值1的總數獲得第一邏輯距離值為1。在本範例實施例中,第一邏輯距離值可反映第一邏輯至實體映射表與第二邏輯至實體映射表之間只有1個邏輯至實體映射表(即邏輯至實體映射表TB9 )不重疊。The first logical distance value between the first physical unit and the second physical unit can be obtained according to the table difference information 910. For example, the first logical distance value may be 1 according to the total number of values 1 in the table difference information 910. In this exemplary embodiment, the first logical distance value may reflect that there is only one logical-to-physical mapping table between the first logical-to-physical mapping table and the second logical-to-physical mapping table (that is, the logical-to-physical mapping table TB 9 ). overlapping.

請參照圖9B,假設表格映射資訊903是對應於第三實體單元。表格映射資訊903也具有16個位元。表格映射資訊903中的位元b4 、b6 、b9 、b12 及b15 為1,其反映邏輯至實體映射表TB4 、TB6 、TB9 、TB12 及TB15 可被查詢以存取第三實體單元。換言之,表格映射資訊903可反映第三實體單元所映射的一或多個邏輯單元(亦稱為第三邏輯單元)的邏輯至實體映射資訊是記載於邏輯至實體映射表TB4 、TB6 、TB9 、TB12 及TB15 。透過邏輯模組90對表格映射資訊901與903執行第一運算後,表格差異資訊920可被獲得。例如,邏輯模組90可對表格映射資訊901與903中的位元bj 進行XOR運算以獲得表格差異資訊920中的位元bj 。j介於1與16之間。表格差異資訊920可反映第一邏輯單元與第三邏輯單元之間的分散程度(亦稱為第二邏輯分散度)。此外,表格差異資訊920也可反映第一邏輯至實體映射表與記載第三邏輯單元之邏輯至實體映射資訊的邏輯至實體映射表(亦稱為第三邏輯至實體映射表)之間的重疊程度。Please refer to FIG. 9B, assuming that the table mapping information 903 corresponds to the third physical unit. The table mapping information 903 also has 16 bits. Bits b 4 , b 6 , b 9 , b 12 and b 15 in the table mapping information 903 are 1, which reflects the logical to physical mapping tables TB 4 , TB 6 , TB 9 , TB 12 and TB 15 can be queried to Access the third physical unit. In other words, the table mapping information 903 may reflect the logical-to-physical mapping information of one or more logical units (also called third logical units) mapped by the third physical unit is recorded in the logical-to-physical mapping tables TB 4 , TB 6 , TB 9 , TB 12 and TB 15 . After performing the first operation on the table mapping information 901 and 903 through the logic module 90, the table difference information 920 can be obtained. For example, the logic module 90 may perform an XOR operation on the bit b j in the table mapping information 901 and 903 to obtain the bit b j in the table difference information 920. j is between 1 and 16. The table difference information 920 may reflect the degree of dispersion between the first logical unit and the third logical unit (also referred to as the second logical dispersion). In addition, the table difference information 920 may also reflect the overlap between the first logical-to-physical mapping table and the logical-to-physical mapping table (also called the third logical-to-physical mapping table) that records the logical-to-physical mapping information of the third logical unit degree.

第一實體單元與第三實體單元之間的第二邏輯距離值可根據表格差異資訊920而獲得。例如,可根據表格差異資訊920中的數值1的總數獲得第二邏輯距離值為7。在本範例實施例中,第二邏輯距離值可反映第一邏輯至實體映射表與第三邏輯至實體映射表之間有7個邏輯至實體映射表(即邏輯至實體映射表TB1 ~TB3 、TB6 、TB9 、TB12 及TB15 )不重疊。根據第一邏輯距離值與第二邏輯距離值,相對於第一實體單元與第三實體單元,第一實體單元與第二實體單元可優先被選擇作為有效資料的來源節點(例如圖7的來源節點701)。藉此,可減少在資料整併操作中對圖4的可複寫式非揮發性記憶體模組406的存取次數。The second logical distance value between the first physical unit and the third physical unit can be obtained according to the table difference information 920. For example, the second logical distance value is 7 according to the total number of values in the table difference information 920. In this exemplary embodiment, the second logical distance value can reflect that there are 7 logical-to-physical mapping tables between the first logical-to-physical mapping table and the third logical-to-physical mapping table (that is, the logical-to-physical mapping tables TB 1 ~TB 3, TB 6, TB 9, TB 12 and TB 15) do not overlap. According to the first logical distance value and the second logical distance value, relative to the first physical unit and the third physical unit, the first physical unit and the second physical unit may be preferentially selected as the source node of the valid data (such as the source of FIG. 7 Node 701). In this way, the number of accesses to the rewritable non-volatile memory module 406 of FIG. 4 during the data consolidation operation can be reduced.

圖10A與圖10B是根據本發明的一範例實施例所繪示的獲得邏輯距離值的示意圖。10A and 10B are schematic diagrams of obtaining logical distance values according to an exemplary embodiment of the invention.

請參照圖10A,在本範例實施例中,表格映射資訊901可被表格映射資訊1001取代,且表格映射資訊902可被表格映射資訊1002取代。表格映射資訊1001包括數值V11 ~V14 。表格映射資訊1002包括數值V21 ~V24 。數值V11 ~V14 分別反映表格映射資訊901中4個範圍1010~1040中數值1的總數。例如,數值V11 ~V14 分別為4、0、0、0。數值V21 ~V24 分別反映表格映射資訊902中4個範圍1010~1040中數值1的總數。例如,數值V21 ~V24 分別為4、0、1、0。Referring to FIG. 10A, in this exemplary embodiment, table mapping information 901 may be replaced by table mapping information 1001, and table mapping information 902 may be replaced by table mapping information 1002. The table mapping information 1001 includes values V 11 ~V 14 . The table mapping information 1002 includes values V 21 ~V 24 . The values V 11 ~V 14 respectively reflect the total number of values 1 in the four ranges 1010~1040 in the table mapping information 901. For example, the values V 11 to V 14 are 4, 0, 0, and 0, respectively. The values V 21 ~V 24 respectively reflect the total number of values 1 in the four ranges 1010~1040 in the table mapping information 902. For example, the values V 21 ~V 24 are 4, 0, 1, 0, respectively.

根據表格映射資訊1001與1002之間的N維距離(亦稱為N維空間距離),第一實體單元與第二實體單元之間的第一邏輯距離值可被獲得。在本範例實施例中,N為4。例如,可根據以下方程式(1)獲得表格映射資訊1001與1002之間的N維距離LD1。N維距離LD1可被決定為第一邏輯距離值。According to the N-dimensional distance (also referred to as N-dimensional spatial distance) between the table mapping information 1001 and 1002, the first logical distance value between the first physical unit and the second physical unit can be obtained. In this exemplary embodiment, N is 4. For example, the N-dimensional distance LD1 between the table mapping information 1001 and 1002 can be obtained according to the following equation (1). The N-dimensional distance LD1 can be determined as the first logical distance value.

Figure 02_image001
(1.1)
Figure 02_image001
(1.1)

請參照圖10B,在本範例實施例中,表格映射資訊903可被表格映射資訊1003取代。表格映射資訊1003包括數值V31 ~V34 。數值V31 ~V34 分別反映表格映射資訊903中4個範圍1010~1040中數值1的總數。例如,數值V31 ~V34 分別為1、1、2、1。根據表格映射資訊1001與1003之間的N維距離,第一實體單元與第三實體單元之間的第二邏輯距離值可被獲得。例如,可根據以下方程式(1.2)獲得表格映射資訊1001與1002之間的N維距離LD2。N維距離LD2可被決定為第二邏輯距離值。Referring to FIG. 10B, in this exemplary embodiment, the table mapping information 903 may be replaced by the table mapping information 1003. The table mapping information 1003 includes values V 31 ~V 34 . The values V 31 ~V 34 respectively reflect the total number of values 1 in the four ranges 1010~1040 in the table mapping information 903. For example, the values V 31 ~V 34 are 1, 1, 2, and 1, respectively. According to the N-dimensional distance between the table mapping information 1001 and 1003, the second logical distance value between the first physical unit and the third physical unit can be obtained. For example, the N-dimensional distance LD2 between the table mapping information 1001 and 1002 can be obtained according to the following equation (1.2). The N-dimensional distance LD2 can be determined as the second logical distance value.

Figure 02_image003
(1.2)
Figure 02_image003
(1.2)

根據第一邏輯距離值與第二邏輯距離值,第一實體單元與第二實體單元同樣可優先被選擇作為有效資料的來源節點(例如圖7的來源節點701)。藉此,可減少在資料整併操作中對圖4的可複寫式非揮發性記憶體模組406的存取次數。According to the first logical distance value and the second logical distance value, the first physical unit and the second physical unit can also be preferentially selected as the source node of the valid data (for example, the source node 701 of FIG. 7 ). In this way, the number of accesses to the rewritable non-volatile memory module 406 of FIG. 4 during the data consolidation operation can be reduced.

須注意的是,圖9A至圖10B的範例實施例僅為範例而非用以限制本發明。在另一範例實施例中,表格映射資訊所包含的位元的總數也可以是更多(例如32)或更少(例如8)。其他的參數也可以用於選擇資料整併操作中作為有效資料的來源節點的實體單元,只要可以減少在資料整併操作中對圖4的可複寫式非揮發性記憶體模組406的存取次數即可。此外,獲得第一邏輯距離值及/或第二邏輯距離值的操作可以在將第一實體單元決定為資料整併操作中的來源節點之前或之後執行,本發明不加以限制。It should be noted that the exemplary embodiments of FIGS. 9A to 10B are only examples and are not intended to limit the present invention. In another exemplary embodiment, the total number of bits included in the table mapping information may also be more (for example, 32) or less (for example, 8). Other parameters can also be used to select the physical unit that is the source node of valid data in the data consolidation operation, as long as the access to the rewritable non-volatile memory module 406 of FIG. 4 during the data consolidation operation can be reduced Times. In addition, the operation of obtaining the first logical distance value and/or the second logical distance value may be performed before or after determining the first physical unit as the source node in the data consolidation operation, which is not limited by the present invention.

圖11是根據本發明的一範例實施例所繪示的資料整併方法的流程圖。請參照圖11,在步驟S1101中,獲得第一實體單元與第二實體單元之間的第一邏輯距離值。在步驟S1102中,根據第一邏輯距離值執行資料整併操作,以將有效資料從來源節點複製到回收節點。FIG. 11 is a flowchart of a data consolidation method according to an exemplary embodiment of the invention. Referring to FIG. 11, in step S1101, a first logical distance value between the first physical unit and the second physical unit is obtained. In step S1102, a data consolidation operation is performed according to the first logical distance value to copy valid data from the source node to the recycling node.

圖12是根據本發明的一範例實施例所繪示的資料整併方法的流程圖。請參照圖12,在步驟S1201中,獲得第一實體單元與第二實體單元之間的第一邏輯距離值。在步驟S1202中,獲得第一實體單元與第三實體單元之間的第二邏輯距離值。在步驟S1203中,判斷第一邏輯距離值是否大於第二邏輯距離值。若第一邏輯距離值不大於第二邏輯距離值,在步驟S1204中,選擇第一實體單元與第二實體單元作為資料整併操作中的來源節點。然而,若第一邏輯距離值大於第二邏輯距離值,在步驟S1205中,選擇第一實體單元與第三實體單元作為資料整併操作中的來源節點。接著,可在資料整併操作將有效資料從來源節點複製到回收節點。須注意的是,在一範例實施例中,亦可以先執行步驟S1202再執行步驟S1201或者可同時執行步驟S1201與1202,本發明不加以限制。FIG. 12 is a flowchart of a data consolidation method according to an exemplary embodiment of the invention. Referring to FIG. 12, in step S1201, a first logical distance value between the first physical unit and the second physical unit is obtained. In step S1202, a second logical distance value between the first physical unit and the third physical unit is obtained. In step S1203, it is determined whether the first logical distance value is greater than the second logical distance value. If the first logical distance value is not greater than the second logical distance value, in step S1204, the first physical unit and the second physical unit are selected as the source nodes in the data consolidation operation. However, if the first logical distance value is greater than the second logical distance value, in step S1205, the first physical unit and the third physical unit are selected as the source nodes in the data consolidation operation. Then, valid data can be copied from the source node to the recovery node in the data consolidation operation. It should be noted that in an exemplary embodiment, step S1202 may be executed first and then step S1201 or steps S1201 and 1202 may be executed at the same time, which is not limited in the present invention.

圖13是根據本發明的一範例實施例所繪示的資料整併方法的流程圖。請參照圖13,在步驟S1301中,選擇第一實體單元作為資料整併操作中的來源節點。在步驟S1301之後,可將有效資料(亦稱為第一資料)從第一實體單元複製到回收節點。在步驟S1302中,獲得第一實體單元與第二實體單元之間的第一邏輯距離值。在步驟S1303中,獲得第一實體單元與第三實體單元之間的第二邏輯距離值。在步驟S1304中,判斷第一邏輯距離值是否大於第二邏輯距離值。若第一邏輯距離值不大於第二邏輯距離值,在步驟S1305中,選擇第二實體單元作為資料整併操作中的來源節點。在步驟S1305之後,可將有效資料(亦稱為第二資料)從第二實體單元複製到回收節點。然而,若第一邏輯距離值大於第二邏輯距離值,在步驟S1306中,選擇第三實體單元作為資料整併操作中的來源節點。在步驟S1306之後,可將有效資料(亦稱為第三資料)從第三實體單元複製到回收節點。須注意的是,在一範例實施例中,亦可以先執行步驟S1303再執行步驟S1302或者可同時執行步驟S1302與1303,本發明不加以限制。13 is a flowchart of a data consolidation method according to an exemplary embodiment of the invention. Referring to FIG. 13, in step S1301, the first physical unit is selected as the source node in the data consolidation operation. After step S1301, valid data (also called first data) can be copied from the first physical unit to the recycling node. In step S1302, a first logical distance value between the first physical unit and the second physical unit is obtained. In step S1303, a second logical distance value between the first physical unit and the third physical unit is obtained. In step S1304, it is determined whether the first logical distance value is greater than the second logical distance value. If the first logical distance value is not greater than the second logical distance value, in step S1305, the second physical unit is selected as the source node in the data consolidation operation. After step S1305, valid data (also called second data) can be copied from the second physical unit to the recycling node. However, if the first logical distance value is greater than the second logical distance value, in step S1306, the third physical unit is selected as the source node in the data consolidation operation. After step S1306, valid data (also called third data) may be copied from the third physical unit to the recycling node. It should be noted that in an exemplary embodiment, step S1303 may be executed before step S1302 or steps S1302 and 1303 may be executed at the same time, which is not limited in the present invention.

然而,圖11至圖13中各步驟已詳細說明如上,在此便不再贅述。須注意的是,圖11至圖13中各步驟可以實作為多個程式碼或是電路,本發明不加以限制。此外,圖11至圖13的方法可以搭配以上範例實施例使用,也可以單獨使用,本發明不加以限制。However, the steps in FIGS. 11 to 13 have been described in detail as above, and will not be repeated here. It should be noted that the steps in FIGS. 11 to 13 can be implemented as multiple codes or circuits, and the invention is not limited thereto. In addition, the methods of FIG. 11 to FIG. 13 can be used with the above exemplary embodiments or can be used alone, and the present invention is not limited.

綜上所述,透過考慮第一實體單元所映射的第一邏輯單元與第二實體單元所映射的第二邏輯單元之間的邏輯分散度,在資料整併程序中記憶體儲存裝置的存取次數可被有效減少,進而延長記憶體儲存裝置的使用壽命。In summary, by considering the logical dispersion between the first logical unit mapped by the first physical unit and the second logical unit mapped by the second physical unit, the memory storage device is accessed during the data consolidation process The number of times can be effectively reduced, thereby extending the service life of the memory storage device.

雖然本發明已以實施例揭露如上,然其並非用以限定本發明,任何所屬技術領域中具有通常知識者,在不脫離本發明的精神和範圍內,當可作些許的更動與潤飾,故本發明的保護範圍當視後附的申請專利範圍所界定者為準。Although the present invention has been disclosed as above with examples, it is not intended to limit the present invention. Any person with ordinary knowledge in the technical field can make some changes and modifications without departing from the spirit and scope of the present invention. The scope of protection of the present invention shall be subject to the scope defined in the appended patent application.

10、30:記憶體儲存裝置11、31:主機系統110:系統匯流排111:處理器112:隨機存取記憶體113:唯讀記憶體114:資料傳輸介面12:輸入/輸出(I/O)裝置20:主機板201:隨身碟202:記憶卡203:固態硬碟204:無線記憶體儲存裝置205:全球定位系統模組206:網路介面卡207:無線傳輸裝置208:鍵盤209:螢幕210:喇叭32:SD卡33:CF卡34:嵌入式儲存裝置341:嵌入式多媒體卡342:嵌入式多晶片封裝儲存裝置402:連接介面單元404:記憶體控制電路單元406:可複寫式非揮發性記憶體模組502:記憶體管理電路504:主機介面506:記憶體介面508:錯誤檢查與校正電路510:緩衝記憶體512:電源管理電路601:儲存區602:替換區603:儲存區610(0)~610(C)、710(0)~710(E)、720(0)~720(F)、810(0)、810(1):實體單元612(0)~612(D):邏輯單元700:資料701:來源節點702:回收節點801、802、901~903、1001~1003:表格映射資訊830:邏輯至實體映射表910、920:表格差異資訊90:邏輯模組1010~1040:範圍S1101:步驟(獲得第一實體單元與第二實體單元之間的第一邏輯距離值)S1102:步驟(根據第一邏輯距離值執行資料整併操作,以將有效資料從來源節點複製到回收節點)S1201:步驟(獲得第一實體單元與第二實體單元之間的第一邏輯距離值)S1202:步驟(獲得第一實體單元與第三實體單元之間的第二邏輯距離值)S1203:步驟(第一邏輯距離值是否大於第二邏輯距離值)S1204:步驟(選擇第一實體單元與第二實體單元作為來源節點)S1205:步驟(選擇第一實體單元與第三實體單元作為來源節點)S1301:步驟(選擇第一實體單元作為來源節點)S1302:步驟(,獲得第一實體單元與第二實體單元之間的第一邏輯距離值)S1303:步驟(獲得第一實體單元與第三實體單元之間的第二邏輯距離值)S1304:步驟(第一邏輯距離值是否大於第二邏輯距離值)S1305:步驟(選擇第二實體單元作為來源節點)S1306:步驟(選擇第三實體單元作為來源節點)10.30: Memory storage device 11, 31: Host system 110: System bus 111: Processor 112: Random access memory 113: Read only memory 114: Data transmission interface 12: Input/output (I/O ) Device 20: motherboard 201: flash drive 202: memory card 203: solid state drive 204: wireless memory storage device 205: global positioning system module 206: network interface card 207: wireless transmission device 208: keyboard 209: screen 210: speaker 32: SD card 33: CF card 34: embedded storage device 341: embedded multimedia card 342: embedded multi-chip package storage device 402: connection interface unit 404: memory control circuit unit 406: rewritable non-volatile Volatile memory module 502: memory management circuit 504: host interface 506: memory interface 508: error checking and correction circuit 510: buffer memory 512: power management circuit 601: storage area 602: replacement area 603: storage area 610(0)~610(C), 710(0)~710(E), 720(0)~720(F), 810(0), 810(1): physical unit 612(0)~612(D ): logic unit 700: data 701: source node 702: recycling node 801, 802, 901~903, 1001~1003: table mapping information 830: logic to physical mapping tables 910, 920: table difference information 90: logic module 1010 ~1040: Range S1101: Step (obtaining the first logical distance value between the first physical unit and the second physical unit) S1102: Step (perform data consolidation according to the first logical distance value to remove valid data from the source node Copy to recycle node) S1201: Step (obtain the first logical distance value between the first physical unit and the second physical unit) S1202: Step (obtain the second logical distance value between the first physical unit and the third physical unit S1203: Step (whether the first logical distance value is greater than the second logical distance value) S1204: Step (select the first physical unit and the second physical unit as the source node) S1205: Step (select the first physical unit and the third physical unit As source node) S1301: Step (select the first physical unit as the source node) S1302: Step (, obtain the first logical distance value between the first physical unit and the second physical unit) S1303: Step (obtain the first physical unit S1304: Step (whether the first logical distance value is greater than the second logical distance value) S1305: Step (select the second physical unit as the source node) S1306: Step (select the (Three physical units as source nodes)

圖1是根據本發明的一範例實施例所繪示的主機系統、記憶體儲存裝置及輸入/輸出(I/O)裝置的示意圖。 圖2是根據本發明的另一範例實施例所繪示的主機系統、記憶體儲存裝置及I/O裝置的示意圖。 圖3是根據本發明的另一範例實施例所繪示的主機系統與記憶體儲存裝置的示意圖。 圖4是根據本發明的一範例實施例所繪示的記憶體儲存裝置的概要方塊圖。 圖5是根據本發明的一範例實施例所繪示的記憶體控制電路單元的概要方塊圖。 圖6是根據本發明的一範例實施例所繪示的管理可複寫式非揮發性記憶體模組的示意圖。 圖7是根據本發明的一範例實施例所繪示的資料整併操作的示意圖。 圖8是根據本發明的一範例實施例所繪示的表格映射資訊的示意圖。 圖9A與圖9B是根據本發明的一範例實施例所繪示的獲得邏輯距離值的示意圖。 圖10A與圖10B是根據本發明的一範例實施例所繪示的獲得邏輯距離值的示意圖。 圖11是根據本發明的一範例實施例所繪示的資料整併方法的流程圖。 圖12是根據本發明的一範例實施例所繪示的資料整併方法的流程圖。 圖13是根據本發明的一範例實施例所繪示的資料整併方法的流程圖。FIG. 1 is a schematic diagram of a host system, a memory storage device, and an input/output (I/O) device according to an exemplary embodiment of the present invention. 2 is a schematic diagram of a host system, a memory storage device, and an I/O device according to another exemplary embodiment of the present invention. 3 is a schematic diagram of a host system and a memory storage device according to another exemplary embodiment of the present invention. FIG. 4 is a schematic block diagram of a memory storage device according to an exemplary embodiment of the invention. 5 is a schematic block diagram of a memory control circuit unit according to an exemplary embodiment of the invention. 6 is a schematic diagram of managing a rewritable non-volatile memory module according to an exemplary embodiment of the present invention. 7 is a schematic diagram of data consolidation operation according to an exemplary embodiment of the present invention. FIG. 8 is a schematic diagram of table mapping information according to an exemplary embodiment of the present invention. 9A and 9B are schematic diagrams of obtaining logical distance values according to an exemplary embodiment of the invention. 10A and 10B are schematic diagrams of obtaining logical distance values according to an exemplary embodiment of the invention. FIG. 11 is a flowchart of a data consolidation method according to an exemplary embodiment of the invention. FIG. 12 is a flowchart of a data consolidation method according to an exemplary embodiment of the invention. 13 is a flowchart of a data consolidation method according to an exemplary embodiment of the invention.

S1101:步驟(獲得第一實體單元與第二實體單元之間的第一邏輯距離值) S1101: Step (obtain the first logical distance value between the first physical unit and the second physical unit)

S1102:步驟(根據第一邏輯距離值執行資料整併操作,以將有效資料從來源節點複製到回收節點) S1102: Step (perform data consolidation according to the first logical distance value to copy valid data from the source node to the recycling node)

Claims (21)

一種資料整併方法,用於一可複寫式非揮發性記憶體模組,其中該可複寫式非揮發性記憶體模組包括多個實體單元,該資料整併方法包括: 獲得該些實體單元中的一第一實體單元與一第二實體單元之間的一第一邏輯距離值,其中該第一邏輯距離值反映該第一實體單元所映射的至少一第一邏輯單元與該第二實體單元所映射的至少一第二邏輯單元之間的一邏輯分散度;以及 根據該第一邏輯距離值執行一資料整併操作,以將一有效資料從該些實體單元中的一來源節點複製到該些實體單元中的一回收節點。A data consolidation method for a rewritable non-volatile memory module, wherein the rewritable non-volatile memory module includes multiple physical units, and the data consolidation method includes: obtaining the physical units A first logical distance between a first physical unit and a second physical unit, wherein the first logical distance value reflects at least a first logical unit and the second entity mapped by the first physical unit A logical dispersion between at least one second logical unit mapped by the unit; and performing a data consolidation operation according to the first logical distance value to copy a valid data from a source node in the physical units to A recycling node in the physical units. 如申請專利範圍第1項所述的資料整併方法,其中該至少一第一邏輯單元的一邏輯至實體映射資訊記載於至少一第一邏輯至實體映射表,該至少一第二邏輯單元的一邏輯至實體映射資訊記載於至少一第二邏輯至實體映射表,且該第一邏輯距離值更反映該至少一第一邏輯至實體映射表與該至少一第二邏輯至實體映射表之間的一重疊程度。The data consolidation method as described in item 1 of the patent application scope, wherein the logic-to-physical mapping information of the at least one first logical unit is recorded in at least one first-to-physical mapping table, and the at least one second logical unit A logical to physical mapping information is recorded in at least one second logical to physical mapping table, and the first logical distance value further reflects between the at least one first logical to physical mapping table and the at least one second logical to physical mapping table The degree of overlap. 如申請專利範圍第1項所述的資料整併方法,其中根據該第一邏輯距離值執行該資料整併操作的步驟包括: 若該第一邏輯距離值不大於一目標距離值,將該第一實體單元中的有效資料複製到該回收節點並將該第二實體單元中的有效資料複製到該回收節點;以及 若該邏輯距離值大於該目標距離值,將該第一實體單元中的該有效資料複製到該回收節點並將該些實體單元中的一第三實體單元中的有效資料複製到該回收節點。The data consolidation method as described in item 1 of the patent application scope, wherein the step of performing the data consolidation operation according to the first logical distance value includes: If the first logical distance value is not greater than a target distance value, the Valid data in a physical unit is copied to the recycling node and valid data in the second physical unit is copied to the recycling node; and if the logical distance value is greater than the target distance value, the The valid data is copied to the recycling node and the valid data in a third physical unit among the physical units is copied to the recycling node. 如申請專利範圍第3項所述的資料整併方法,更包括: 獲得該第一實體單元與該第三實體單元之間的一第二邏輯距離值,其中該目標距離值包括該第二邏輯距離值。The data consolidation method as described in item 3 of the patent application scope further includes: obtaining a second logical distance value between the first physical unit and the third physical unit, wherein the target distance value includes the second logic Distance value. 如申請專利範圍第1項所述的資料整併方法,其中獲得該些實體單元中的該第一實體單元與該第二實體單元之間的該第一邏輯距離值的步驟包括: 根據一第一表格映射資訊與一第二表格映射資訊獲得該第一邏輯距離值,其中該第一表格映射資訊反映該至少一第一邏輯單元的一邏輯至實體映射資訊記載於至少一第一邏輯至實體映射表,且該第二表格映射資訊反映該至少一第二邏輯單元的一邏輯至實體映射資訊記載於至少一第二邏輯至實體映射表。The data consolidation method as described in item 1 of the patent application scope, wherein the step of obtaining the first logical distance value between the first physical unit and the second physical unit among the physical units includes: according to a first A table mapping information and a second table mapping information obtain the first logical distance value, wherein the first table mapping information reflects a logical-to-physical mapping information of the at least one first logical unit recorded in at least a first logical-to-entity A mapping table, and the second table mapping information reflects a logical-to-physical mapping information of the at least one second logical unit recorded in at least a second logical-to-physical mapping table. 如申請專利範圍第5項所述的資料整併方法,其中該第一表格映射資訊包括一第一位元,該第二表格映射資訊包括一第二位元,且根據該第一表格映射資訊與該第二表格映射資訊獲得該第一邏輯距離值的步驟包括: 對該第一位元與該第二位元執行一第一運算以獲得一第三位元;以及 根據該第三位元獲得該第一邏輯距離值。The data consolidation method as described in item 5 of the patent application scope, wherein the first table mapping information includes a first bit, the second table mapping information includes a second bit, and the information is mapped according to the first table The step of obtaining the first logical distance value by mapping information with the second table includes: performing a first operation on the first bit and the second bit to obtain a third bit; and according to the third bit The first logical distance value is obtained. 如申請專利範圍第5項所述的資料整併方法,其中該第一表格映射資訊包括N個第一數值,該第二表格映射資訊包括N個第二數值,且根據該第一表格映射資訊與該第二表格映射資訊獲得該第一邏輯距離值的步驟包括: 獲得該N個第一數值與該N個第二數值之間的一N維距離;以及 根據該N維距離獲得該第一邏輯距離值。The data consolidation method as described in item 5 of the patent application scope, wherein the first table mapping information includes N first values, the second table mapping information includes N second values, and the information is mapped according to the first table The step of obtaining the first logical distance value by mapping information with the second table includes: obtaining an N-dimensional distance between the N first values and the N second values; and obtaining the first logical distance according to the N-dimensional distance Logical distance value. 一種記憶體儲存裝置,包括: 一連接介面單元,用以耦接至一主機系統; 一可複寫式非揮發性記憶體模組,其中該可複寫式非揮發性記憶體模組包括多個實體單元;以及 一記憶體控制電路單元,耦接至該連接介面單元與該可複寫式非揮發性記憶體模組, 其中該記憶體控制電路單元用以獲得該些實體單元中的一第一實體單元與一第二實體單元之間的一第一邏輯距離值,其中該第一邏輯距離值反映該第一實體單元所映射的至少一第一邏輯單元與該第二實體單元所映射的至少一第二邏輯單元之間的一邏輯分散度,並且 該記憶體控制電路單元更用以根據該第一邏輯距離值執行一資料整併操作,以將一有效資料從該些實體單元中的一來源節點複製到該些實體單元中的一回收節點。A memory storage device includes: a connection interface unit for coupling to a host system; a rewritable non-volatile memory module, wherein the rewritable non-volatile memory module includes multiple entities Unit; and a memory control circuit unit coupled to the connection interface unit and the rewritable non-volatile memory module, wherein the memory control circuit unit is used to obtain a first entity among the physical units A first logical distance value between the unit and a second physical unit, wherein the first logical distance value reflects at least one of the at least one first logical unit mapped by the first physical unit and the at least one mapped by the second physical unit A logical degree of dispersion between the second logical units, and the memory control circuit unit is further used to perform a data consolidation operation based on the first logical distance value to extract a valid data from a source in the physical units The node is copied to a recycling node in the physical units. 如申請專利範圍第8項所述的記憶體儲存裝置,其中該至少一第一邏輯單元的一邏輯至實體映射資訊記載於至少一第一邏輯至實體映射表,該至少一第二邏輯單元的一邏輯至實體映射資訊記載於至少一第二邏輯至實體映射表,且該第一邏輯距離值更反映該至少一第一邏輯至實體映射表與該至少一第二邏輯至實體映射表之間的一重疊程度。The memory storage device as described in item 8 of the patent application range, wherein the logic-to-physical mapping information of the at least one first logical unit is recorded in at least one first-to-physical mapping table, and the at least one second logical unit A logical to physical mapping information is recorded in at least one second logical to physical mapping table, and the first logical distance value further reflects between the at least one first logical to physical mapping table and the at least one second logical to physical mapping table The degree of overlap. 如申請專利範圍第8項所述的記憶體儲存裝置,其中該記憶體控制電路單元根據該第一邏輯距離值執行該資料整併操作的操作包括: 若該第一邏輯距離值不大於一目標距離值,指示將該第一實體單元中的有效資料複製到該回收節點並將該第二實體單元中的有效資料複製到該回收節點;以及 若該邏輯距離值大於該目標距離值,指示將該第一實體單元中的該有效資料複製到該回收節點並將該些實體單元中的一第三實體單元中的有效資料複製到該回收節點。The memory storage device as recited in item 8 of the patent application range, wherein the memory control circuit unit performs the data consolidation operation according to the first logical distance value including: if the first logical distance value is not greater than a target The distance value indicates that the valid data in the first physical unit is copied to the recycling node and the valid data in the second physical unit is copied to the recycling node; and if the logical distance value is greater than the target distance value, indicating that The valid data in the first physical unit is copied to the recycling node and the valid data in a third physical unit among the physical units is copied to the recycling node. 如申請專利範圍第10項所述的記憶體儲存裝置,其中該記憶體控制電路單元更用以獲得該第一實體單元與該第三實體單元之間的一第二邏輯距離值,且該目標距離值包括該第二邏輯距離值。The memory storage device of claim 10, wherein the memory control circuit unit is further used to obtain a second logical distance value between the first physical unit and the third physical unit, and the target The distance value includes the second logical distance value. 如申請專利範圍第8項所述的記憶體儲存裝置,其中該記憶體控制電路單元獲得該些實體單元中的該第一實體單元與該第二實體單元之間的該第一邏輯距離值的操作包括: 根據一第一表格映射資訊與一第二表格映射資訊獲得該第一邏輯距離值,其中該第一表格映射資訊反映該至少一第一邏輯單元的一邏輯至實體映射資訊記載於至少一第一邏輯至實體映射表,且該第二表格映射資訊反映該至少一第二邏輯單元的一邏輯至實體映射資訊記載於至少一第二邏輯至實體映射表。The memory storage device as recited in item 8 of the patent application range, wherein the memory control circuit unit obtains the value of the first logical distance between the first physical unit and the second physical unit of the physical units The operation includes: obtaining the first logical distance value according to a first table mapping information and a second table mapping information, wherein the first table mapping information reflects a logical-to-physical mapping information of the at least one first logical unit recorded in at least A first logical-to-physical mapping table, and the second table mapping information reflects a logical-to-physical mapping information of the at least one second logical unit recorded in at least one second logical-to-physical mapping table. 如申請專利範圍第12項所述的記憶體儲存裝置,其中該第一表格映射資訊包括一第一位元,該第二表格映射資訊包括一第二位元,且該記憶體控制電路單元根據該第一表格映射資訊與該第二表格映射資訊獲得該第一邏輯距離值的操作包括: 對該第一位元與該第二位元執行一第一運算以獲得一第三位元;以及 根據該第三位元獲得該第一邏輯距離值。The memory storage device according to item 12 of the patent application scope, wherein the first table mapping information includes a first bit, the second table mapping information includes a second bit, and the memory control circuit unit is based on The operations of obtaining the first logical distance value by the first table mapping information and the second table mapping information include: performing a first operation on the first bit and the second bit to obtain a third bit; and The first logical distance value is obtained according to the third bit. 如申請專利範圍第12項所述的記憶體儲存裝置,其中該第一表格映射資訊包括N個第一數值,該第二表格映射資訊包括N個第二數值,且該記憶體控制電路單元根據該第一表格映射資訊與該第二表格映射資訊獲得該第一邏輯距離值的操作包括: 獲得該N個第一數值與該N個第二數值之間的一N維距離;以及 根據該N維距離獲得該第一邏輯距離值。The memory storage device according to item 12 of the patent application, wherein the first table mapping information includes N first values, the second table mapping information includes N second values, and the memory control circuit unit is based on The operations of obtaining the first logical distance value by the first table mapping information and the second table mapping information include: obtaining an N-dimensional distance between the N first values and the N second values; and according to the N The dimension distance obtains the first logical distance value. 一種記憶體控制電路單元,用於控制一可複寫式非揮發性記憶體模組,其中該可複寫式非揮發性記憶體模組包括多個實體單元,其中該記憶體控制電路單元包括: 一主機介面,用以耦接至一主機系統; 一記憶體介面,用以耦接至該可複寫式非揮發性記憶體模組;以及 一記憶體管理電路,耦接至該主機介面與該記憶體介面, 其中該記憶體管理電路用以獲得該些實體單元中的一第一實體單元與一第二實體單元之間的一第一邏輯距離值,其中該第一邏輯距離值反映該第一實體單元所映射的至少一第一邏輯單元與該第二實體單元所映射的至少一第二邏輯單元之間的一邏輯分散度,並且 該記憶體管理電路更用以根據該第一邏輯距離值執行一資料整併操作,以將一有效資料從該些實體單元中的一來源節點複製到該些實體單元中的一回收節點。A memory control circuit unit for controlling a rewritable non-volatile memory module, wherein the rewritable non-volatile memory module includes a plurality of physical units, wherein the memory control circuit unit includes: a A host interface for coupling to a host system; a memory interface for coupling to the rewritable non-volatile memory module; and a memory management circuit for coupling to the host interface and the memory A body interface, wherein the memory management circuit is used to obtain a first logical distance value between a first physical unit and a second physical unit among the physical units, wherein the first logical distance value reflects the first A logical degree of dispersion between at least one first logical unit mapped by the physical unit and at least one second logical unit mapped by the second physical unit, and the memory management circuit is further used to determine the first logical distance value Perform a data consolidation operation to copy a valid data from a source node in the physical units to a recycling node in the physical units. 如申請專利範圍第15項所述的記憶體控制電路單元,其中該至少一第一邏輯單元的一邏輯至實體映射資訊記載於至少一第一邏輯至實體映射表,該至少一第二邏輯單元的一邏輯至實體映射資訊記載於至少一第二邏輯至實體映射表,且該第一邏輯距離值更反映該至少一第一邏輯至實體映射表與該至少一第二邏輯至實體映射表之間的一重疊程度。The memory control circuit unit according to item 15 of the patent application scope, wherein the logic-to-physical mapping information of the at least one first logic unit is recorded in at least one first-to-physical mapping table, and the at least one second logic unit A logical-to-physical mapping information is recorded in at least one second logical-to-physical mapping table, and the first logical distance value further reflects the at least one first logical-to-physical mapping table and the at least one second logical-to-physical mapping table. Degree of overlap. 如申請專利範圍第15項所述的記憶體控制電路單元,其中該記憶體管理電路根據該第一邏輯距離值執行該資料整併操作的操作包括: 若該第一邏輯距離值不大於一目標距離值,指示將該第一實體單元中的有效資料複製到該回收節點並將該第二實體單元中的有效資料複製到該回收節點;以及 若該邏輯距離值大於該目標距離值,指示將該第一實體單元中的該有效資料複製到該回收節點並將該些實體單元中的一第三實體單元中的有效資料複製到該回收節點。The memory control circuit unit according to item 15 of the patent application scope, wherein the memory management circuit performs the data consolidation operation according to the first logical distance value includes: if the first logical distance value is not greater than a target The distance value indicates that the valid data in the first physical unit is copied to the recycling node and the valid data in the second physical unit is copied to the recycling node; and if the logical distance value is greater than the target distance value, indicating that The valid data in the first physical unit is copied to the recycling node and the valid data in a third physical unit among the physical units is copied to the recycling node. 如申請專利範圍第17項所述的記憶體控制電路單元,其中該記憶體管理電路更用以獲得該第一實體單元與該第三實體單元之間的一第二邏輯距離值,且該目標距離值包括該第二邏輯距離值。The memory control circuit unit as described in item 17 of the patent application range, wherein the memory management circuit is further used to obtain a second logical distance value between the first physical unit and the third physical unit, and the target The distance value includes the second logical distance value. 如申請專利範圍第15項所述的記憶體控制電路單元,其中該記憶體管理電路獲得該些實體單元中的該第一實體單元與該第二實體單元之間的該第一邏輯距離值的操作包括: 根據一第一表格映射資訊與一第二表格映射資訊獲得該第一邏輯距離值,其中該第一表格映射資訊反映該至少一第一邏輯單元的一邏輯至實體映射資訊記載於至少一第一邏輯至實體映射表,且該第二表格映射資訊反映該至少一第二邏輯單元的一邏輯至實體映射資訊記載於至少一第二邏輯至實體映射表。The memory control circuit unit as described in item 15 of the patent application range, wherein the memory management circuit obtains the value of the first logical distance between the first physical unit and the second physical unit among the physical units The operation includes: obtaining the first logical distance value according to a first table mapping information and a second table mapping information, wherein the first table mapping information reflects a logical-to-physical mapping information of the at least one first logical unit recorded in at least A first logical-to-physical mapping table, and the second table mapping information reflects a logical-to-physical mapping information of the at least one second logical unit recorded in at least one second logical-to-physical mapping table. 如申請專利範圍第19項所述的記憶體控制電路單元,其中該第一表格映射資訊包括一第一位元,該第二表格映射資訊包括一第二位元,且該記憶體管理電路根據該第一表格映射資訊與該第二表格映射資訊獲得該第一邏輯距離值的操作包括: 對該第一位元與該第二位元執行一第一運算以獲得一第三位元;以及 根據該第三位元獲得該第一邏輯距離值。The memory control circuit unit of claim 19, wherein the first table mapping information includes a first bit, the second table mapping information includes a second bit, and the memory management circuit is based on The operations of obtaining the first logical distance value by the first table mapping information and the second table mapping information include: performing a first operation on the first bit and the second bit to obtain a third bit; and The first logical distance value is obtained according to the third bit. 如申請專利範圍第19項所述的記憶體控制電路單元,其中該第一表格映射資訊包括N個第一數值,該第二表格映射資訊包括N個第二數值,且該記憶體管理電路根據該第一表格映射資訊與該第二表格映射資訊獲得該第一邏輯距離值的操作包括: 獲得該N個第一數值與該N個第二數值之間的一N維距離;以及 根據該N維距離獲得該第一邏輯距離值。The memory control circuit unit of claim 19, wherein the first table mapping information includes N first values, the second table mapping information includes N second values, and the memory management circuit is based on The operations of obtaining the first logical distance value by the first table mapping information and the second table mapping information include: obtaining an N-dimensional distance between the N first values and the N second values; and according to the N The dimension distance obtains the first logical distance value.
TW107137810A 2018-10-25 2018-10-25 Data merge method, memory storage device and memory control circuit unit TWI676176B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
TW107137810A TWI676176B (en) 2018-10-25 2018-10-25 Data merge method, memory storage device and memory control circuit unit
US16/239,535 US10810121B2 (en) 2018-10-25 2019-01-04 Data merge method for rewritable non-volatile memory storage device and memory control circuit unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW107137810A TWI676176B (en) 2018-10-25 2018-10-25 Data merge method, memory storage device and memory control circuit unit

Publications (2)

Publication Number Publication Date
TWI676176B TWI676176B (en) 2019-11-01
TW202016937A true TW202016937A (en) 2020-05-01

Family

ID=69188799

Family Applications (1)

Application Number Title Priority Date Filing Date
TW107137810A TWI676176B (en) 2018-10-25 2018-10-25 Data merge method, memory storage device and memory control circuit unit

Country Status (2)

Country Link
US (1) US10810121B2 (en)
TW (1) TWI676176B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI766582B (en) * 2021-02-17 2022-06-01 群聯電子股份有限公司 Valid data merging method, memory storage device and memory control circuit unit

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI741779B (en) * 2020-09-04 2021-10-01 群聯電子股份有限公司 Data merge method, memory storage device and memory control circuit unit
CN112051971B (en) * 2020-09-10 2023-06-27 群联电子股份有限公司 Data merging method, memory storage device and memory control circuit unit
CN112799601B (en) * 2021-02-24 2023-06-13 群联电子股份有限公司 Effective data merging method, memory storage device and control circuit unit
CN113934370B (en) * 2021-09-09 2022-06-28 珠海海奇半导体有限公司 Wear-leveling method, device and medium for nonvolatile memory

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4206688B2 (en) * 2002-04-15 2009-01-14 ソニー株式会社 Data processing apparatus and data processing method
EP2097825B1 (en) * 2006-12-26 2013-09-04 SanDisk Technologies Inc. Use of a direct data file system with a continuous logical address space interface
TWI399644B (en) * 2009-12-24 2013-06-21 Univ Nat Taiwan Block management method for a non-volatile memory
TWI587136B (en) * 2011-05-06 2017-06-11 創惟科技股份有限公司 Flash memory system and managing and collection methods for flash memory with invalid page information thereof
TWI489274B (en) * 2012-09-11 2015-06-21 Etron Technology Inc Method capable of increasing performance of a memory and related memory system
TWI579693B (en) * 2016-04-29 2017-04-21 群聯電子股份有限公司 Mapping table loading method, memory control circuit unit and mempry storage apparatus
TWI653533B (en) * 2017-03-07 2019-03-11 慧榮科技股份有限公司 Data storage device and method of operation thereof
US10496293B2 (en) * 2017-03-14 2019-12-03 International Business Machines Corporation Techniques for selecting storage blocks for garbage collection based on longevity information

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI766582B (en) * 2021-02-17 2022-06-01 群聯電子股份有限公司 Valid data merging method, memory storage device and memory control circuit unit

Also Published As

Publication number Publication date
TWI676176B (en) 2019-11-01
US20200133844A1 (en) 2020-04-30
US10810121B2 (en) 2020-10-20

Similar Documents

Publication Publication Date Title
TWI592799B (en) Mapping table updating method, memory control circuit unit and memory storage device
TWI676176B (en) Data merge method, memory storage device and memory control circuit unit
CN110879793B (en) Memory management method, memory storage device and memory control circuit unit
TWI696073B (en) Memory control method, memory storage device and memory control circuit unit
TWI705331B (en) Valid data merging method, memory control circuit unit and memory storage device
TWI701552B (en) Memory control method, memory storage device and memory control circuit unit
TW201820145A (en) Data storage method, memory storage device and memory control circuit unit
TW201944421A (en) Wear leveling method, memory control circuit unit and memory storage apparatus
TW202318150A (en) Memory performance optimization method, memory control circuit unit and memory storage device
TWI641948B (en) Data storage method, memory control circuit unit and memory storage device
TWI702496B (en) Memory management method, memory storage device and memory control circuit unit
US11334273B1 (en) Valid data merging method, memory storage device and memory control circuit unit
TWI714840B (en) Memory management method, memory storage device and memory control circuit unit
TWI664528B (en) Memory management method, memory control circuit unit and memory storage apparatus
TWI688956B (en) Memory control method, memory storage device and memory control circuit unit
CN110308876B (en) Memory management method, memory storage device and memory control circuit unit
CN111767005B (en) Memory control method, memory storage device and memory control circuit unit
TWI653632B (en) Memory management method, memory control circuit unit and memory storage device
CN112799601B (en) Effective data merging method, memory storage device and control circuit unit
TWI712886B (en) Memory management method, memory storage device and memory control circuit unit
TWI653531B (en) Memory management method, memory storage device, and memory control circuit unit
CN112835536A (en) Memory control method, memory storage device and memory control circuit unit
CN111143230B (en) Data merging method, memory storage device and memory control circuit unit
TW202011179A (en) Memory management method, memory storage device and memory control circuit unit
TWI741779B (en) Data merge method, memory storage device and memory control circuit unit