[go: up one dir, main page]

CN103853666B - Memory, its storage controller and data writing method - Google Patents

Memory, its storage controller and data writing method Download PDF

Info

Publication number
CN103853666B
CN103853666B CN201210514676.3A CN201210514676A CN103853666B CN 103853666 B CN103853666 B CN 103853666B CN 201210514676 A CN201210514676 A CN 201210514676A CN 103853666 B CN103853666 B CN 103853666B
Authority
CN
China
Prior art keywords
data
type
memory
physical
physical programming
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201210514676.3A
Other languages
Chinese (zh)
Other versions
CN103853666A (en
Inventor
辜芳立
李国荣
许登钧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Phison Electronics Corp
Original Assignee
Phison Electronics Corp
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 Phison Electronics Corp filed Critical Phison Electronics Corp
Priority to CN201210514676.3A priority Critical patent/CN103853666B/en
Publication of CN103853666A publication Critical patent/CN103853666A/en
Application granted granted Critical
Publication of CN103853666B publication Critical patent/CN103853666B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Read Only Memory (AREA)

Abstract

The invention provides a memory, a memory controller and a data writing method thereof; the data writing method is used for a memory comprising a buffer memory and a rewritable nonvolatile memory module. The method includes receiving a plurality of sets of data, wherein the plurality of sets of data include a first type of data and at least a second type of data, wherein a capacity of the first type of data is less than a data size threshold. The method also includes temporarily storing the plurality of sets of data in a buffer memory, and programming the first type of data and at least a portion of the second type of data temporarily stored in the buffer memory to a set of physical programming units at the same time when the plurality of sets of data are determined to meet a predetermined condition, the set of physical programming units being composed of n physical programming units, n being a positive integer. The method further includes simultaneously obtaining the writing status of the first type data and at least a portion of the second type data.

Description

存储器、其存储控制器与数据写入方法Memory, its storage controller and data writing method

技术领域technical field

本发明是有关于一种数据写入方法,且特别是有关于一种用于可复写式非易失性存储器模块的存储器、其存储控制器与数据写入方法。The present invention relates to a data writing method, and in particular to a memory for a rewritable non-volatile memory module, its storage controller and a data writing method.

背景技术Background technique

可复写式非易失性存储器(rewritable non-volatile memory)具有数据非易失性、省电、体积小与无机械结构等特性,故被广泛地应用于数码相机、手机与MP3等各种可携式电子装置。而固态硬盘就是一种以闪存做为储存媒体的储存装置。Rewritable non-volatile memory (rewritable non-volatile memory) has the characteristics of data non-volatility, power saving, small size and no mechanical structure, so it is widely used in digital cameras, mobile phones and MP3 etc. Portable Electronic Devices. A solid state drive is a storage device that uses flash memory as a storage medium.

一般来说,闪存的闪存模块会划分为多个实体块,其中实体块还划分为多个实体页面,而实体块是闪存的擦除单位并且实体页面是闪存的写入单位。由于在编程闪存的存储单元时,仅能执行单向的编程(即,仅能将存储单元的值由1编程为0),因此无法对已编程的实体页面(即,存有旧数据的页面)直接进行写入,而是必须先将此实体页面擦除后方可重新编程。特别是,由于闪存的擦除是以实体块为单位,因此当欲将存有旧数据的实体页面执行擦除操作时,必须对此实体页面所属的整个实体块进行擦除。因此,闪存模块的实体块会被区分为数据区与闲置区,其中数据区的实体块是已被使用来储存数据的实体块,而备用区中的实体块是未被使用的实体块,其中当主机系统欲写入数据至闪存时,闪存的控制电路会从备用区中提取实体块来写入数据,并且将所提取的实体块会关联为数据区。并且,当数据区的实体块被执行擦除操作(eraseoperation)后,已擦除的实体块会被关联为备用区。Generally speaking, the flash memory module of the flash memory is divided into multiple physical blocks, wherein the physical block is further divided into multiple physical pages, and the physical block is the erasing unit of the flash memory and the physical page is the writing unit of the flash memory. Since only one-way programming (that is, the value of the memory cell can only be programmed from 1 to 0) can be performed when programming the memory cells of the flash memory, it is impossible to program the programmed entity pages (that is, the pages with old data) ) to write directly, but this physical page must be erased before reprogramming. In particular, since the flash memory is erased in units of physical blocks, when it is desired to perform an erase operation on a physical page storing old data, the entire physical block to which the physical page belongs must be erased. Therefore, the physical blocks of the flash memory module can be divided into data areas and idle areas, wherein the physical blocks in the data area are physical blocks that have been used to store data, and the physical blocks in the spare area are unused physical blocks, wherein When the host system intends to write data to the flash memory, the control circuit of the flash memory extracts a physical block from the spare area to write data, and associates the extracted physical block as a data area. Moreover, when the physical blocks in the data area are erased, the erased physical blocks will be associated as spare areas.

基于上述架构,对于采用闪存做为储存媒体并需要保障数据安全写入的应用来说,在处理每一个来自主机系统的写入指令时,为了使写入数据与实体页面对齐,往往需要从闪存读出旧有效数据来填补写入数据,并且在将数据编程至闪存后,将表示写入动作完成与否的信息传送回主机系统。进一步来说,就须确保数据安全写入的应用而言,需针对编程结果回传信息以让主机系统掌握数据写入的状态。不难想见,倘若主机系统连续下达数个写入指令,便必须针对每个写入指令执行上述程序,而由于每个写入指令都需耗费相当的编程时间(program time),因此难以在数据安全写入的机制下提升写入速度。Based on the above architecture, for applications that use flash memory as a storage medium and need to ensure safe data writing, when processing each write command from the host system, in order to align the written data with the physical page, it is often necessary to read from the flash memory. The old valid data is read out to fill the written data, and after the data is programmed into the flash memory, the information indicating whether the writing operation is completed or not is sent back to the host system. Furthermore, for applications that need to ensure safe writing of data, it is necessary to return information on the programming result so that the host system can grasp the status of data writing. It is not difficult to imagine that if the host system continuously issues several write commands, the above program must be executed for each write command, and since each write command consumes a considerable amount of programming time, it is difficult to write data in the data The writing speed is improved under the safe writing mechanism.

发明内容Contents of the invention

有鉴于此,本发明提供一种存储器、其存储控制器与数据写入方法,能在提升写入速度之余,保障数据被安全写入存储器。In view of this, the present invention provides a memory, its storage controller and a data writing method, which can ensure that data is safely written into the memory while increasing the writing speed.

本发明提出一种数据写入方法,用于存储器,此存储器包括缓冲存储器与可复写式非易失性存储器模块,而可复写式非易失性存储器模块具有多个实体擦除单元,且各实体擦除单元具有多个实体编程单元。此方法包括接收多组数据,其中这多组数据包含一第一类数据及至少一第二类数据,其中第一类数据的容量小于数据量临界值。此方法还包括将这多组数据暂存于缓冲存储器,当判断这多组数据符合预定条件后,将暂存于缓冲存储器的第一类数据及至少部分第二类数据同时编程至实体编程单元组,此实体编程单元组是由n个实体编程单元所组成,n为正整数。此方法还包括同时得知第一类数据及至少部分第二类数据的写入状态。The present invention proposes a data writing method, which is used in a memory, and the memory includes a buffer memory and a rewritable non-volatile memory module, and the rewritable non-volatile memory module has a plurality of physical erasing units, and each The physical erasing unit has multiple physical programming units. The method includes receiving multiple sets of data, wherein the multiple sets of data include a first type of data and at least one second type of data, wherein the capacity of the first type of data is less than the critical value of data volume. The method also includes temporarily storing the multiple sets of data in the buffer memory, and programming the first type of data and at least part of the second type of data temporarily stored in the buffer memory into the physical programming unit at the same time after judging that the multiple sets of data meet the predetermined conditions Group, this physical programming unit group is composed of n physical programming units, where n is a positive integer. The method also includes knowing the writing status of the first type of data and at least part of the second type of data at the same time.

在本发明的一实施例中,其中当暂存在缓冲存储器的多组数据的数据量到达实体编程单元组的容量时,判定多组数据符合预定条件。In an embodiment of the present invention, when the amount of the multiple sets of data temporarily stored in the buffer memory reaches the capacity of the physical programming unit set, it is determined that the multiple sets of data meet the predetermined condition.

在本发明的一实施例中,其中当存储器未接收到其他数据的时间超过时间临界值时,判定多组数据符合预定条件。In an embodiment of the present invention, when the memory does not receive other data for more than a time threshold, it is determined that the multiple sets of data meet the predetermined condition.

在本发明的一实施例中,其中各实体编程单元包括数据记录区与可用冗余区,而将暂存于缓冲存储器的第一类数据及至少部分第二类数据同时编程至实体编程单元组的步骤包括将第一类数据及至少部分第二类数据写入至组成实体编程单元组的n个实体编程单元的数据记录区,并且将第一类数据及至少部分第二类数据所个别对应的逻辑存取地址及扇区数量写入至组成实体编程单元组的n个实体编程单元的可用冗余区。In an embodiment of the present invention, each physical programming unit includes a data recording area and an available redundant area, and the first type of data and at least part of the second type of data temporarily stored in the buffer memory are programmed to the physical programming unit group at the same time The step includes writing the first type of data and at least part of the second type of data into the data recording area of n physical programming units constituting the physical programming unit group, and individually corresponding the first type of data and at least part of the second type of data The logical access address and the number of sectors are written into the available redundant area of the n physical programming units constituting the physical programming unit group.

在本发明的一实施例中,此数据写入方法还包括维护对应表,以记录被编程至实体编程单元组的第一类数据及至少部分第二类数据所个别对应的逻辑存取地址及扇区数量与实体编程单元组的对应关系,以及将对应表写入至所有实体擦除单元中的一特定实体擦除单元,其中特定实体擦除单元所具有的实体编程单元均不属于实体编程单元组。In an embodiment of the present invention, the data writing method further includes maintaining a correspondence table to record the respective logical access addresses and The corresponding relationship between the number of sectors and the physical programming unit group, and writing the corresponding table to a specific physical erasing unit among all the physical erasing units, wherein none of the physical programming units of the specific physical erasing unit belongs to physical programming unit group.

在本发明的一实施例中,其中第一类数据及至少部分第二类数据的写入状态被一并回复给发出多组数据的主机系统。In an embodiment of the present invention, the write statuses of the first type of data and at least part of the second type of data are collectively returned to the host system that sent multiple sets of data.

本发明提出一种存储控制器,以管理可复写式非易失性存储器模块,此存储控制器包括主机系统接口、存储器接口、缓冲存储器,以及存储器管理电路。其中主机系统接口用以电连接主机系统。存储器接口用以电连接可复写式非易失性存储器模块,其中可复写式非易失性存储器模块具有多个实体擦除单元,且各实体擦除单元具有多个实体编程单元。存储器管理电路电连接至主机系统接口、存储器接口以及缓冲存储器。其中存储器管理电路接收多组数据,这多组数据包含一第一类数据及至少一第二类数据,其中第一类数据的容量小于数据量临界值。存储器管理电路将这多组数据暂存于缓冲存储器,当判断这多组数据符合预定条件后,将暂存于缓冲存储器的第一类数据及至少部分第二类数据同时编程至实体编程单元组,此实体编程单元组是由n个实体编程单元所组成,n为正整数。存储器管理电路同时得知第一类数据及至少部分第二类数据的写入状态。The present invention proposes a storage controller to manage rewritable non-volatile memory modules. The storage controller includes a host system interface, a memory interface, a buffer memory, and a memory management circuit. The host system interface is used to electrically connect the host system. The memory interface is used to electrically connect the rewritable non-volatile memory module, wherein the rewritable non-volatile memory module has a plurality of physical erasing units, and each physical erasing unit has a plurality of physical programming units. The memory management circuit is electrically connected to the host system interface, the memory interface and the buffer memory. Wherein the memory management circuit receives multiple sets of data, the multiple sets of data include a first type of data and at least one second type of data, wherein the capacity of the first type of data is less than the critical value of data volume. The memory management circuit temporarily stores the multiple sets of data in the buffer memory, and when judging that the multiple sets of data meet the predetermined conditions, simultaneously programs the first type of data temporarily stored in the buffer memory and at least part of the second type of data into the physical programming unit group , the physical programming unit group is composed of n physical programming units, where n is a positive integer. The memory management circuit simultaneously knows the writing status of the first type of data and at least part of the second type of data.

在本发明的一实施例中,其中当暂存在缓冲存储器的多组数据的数据量到达实体编程单元组的容量时,存储器管理电路判定多组数据符合预定条件。In an embodiment of the present invention, when the amount of the multiple sets of data temporarily stored in the buffer memory reaches the capacity of the physical programming unit set, the memory management circuit determines that the multiple sets of data meet a predetermined condition.

在本发明的一实施例中,其中当存储器管理电路未接收到其他数据的时间超过时间临界值时,存储器管理电路判定多组数据符合预定条件。In an embodiment of the present invention, when the memory management circuit does not receive other data for a time exceeding a time threshold, the memory management circuit determines that multiple sets of data meet a predetermined condition.

在本发明的一实施例中,其中各实体编程单元包括数据记录区与可用冗余区,而存储器管理电路在将第一类数据及至少部分第二类数据同时编程至实体编程单元组时,将第一类数据及至少部分第二类数据写入至组成实体编程单元组的n个实体编程单元的数据记录区,并且将第一类数据及至少部分第二类数据所个别对应的逻辑存取地址及扇区数量写入至组成实体编程单元组的n个实体编程单元的可用冗余区。In an embodiment of the present invention, each physical programming unit includes a data recording area and an available redundant area, and when the memory management circuit simultaneously programs the first type of data and at least part of the second type of data into the physical programming unit group, Writing the first type of data and at least part of the second type of data into the data recording areas of the n physical programming units that make up the physical programming unit group, and individually corresponding to the logic storage of the first type of data and at least part of the second type of data The address and the number of sectors are taken and written into the available redundant area of the n physical programming units constituting the physical programming unit group.

在本发明的一实施例中,其中存储器管理电路还用以维护对应表,以记录被编程至实体编程单元组的第一类数据及至少部分第二类数据所个别对应的逻辑存取地址及扇区数量与实体编程单元组的对应关系,并将对应表写入至所有实体擦除单元中的一特定实体擦除单元,其中特定实体擦除单元所具有的实体编程单元均不属于实体编程单元组。In an embodiment of the present invention, the memory management circuit is also used to maintain a correspondence table to record the respective logical access addresses and The corresponding relationship between the number of sectors and the physical programming unit group, and write the corresponding table to a specific physical erasing unit in all physical erasing units, wherein the physical programming units of the specific physical erasing unit do not belong to physical programming unit group.

在本发明的一实施例中,其中第一类数据及至少部分第二类数据的写入状态被一并回复给发出多组数据的主机系统。In an embodiment of the present invention, the write statuses of the first type of data and at least part of the second type of data are collectively returned to the host system that sent multiple sets of data.

本发明提出一种存储器,包括可复写式非易失性存储器模块、连接器,以及存储控制器。其中可复写式非易失性存储器模块包括多个实体擦除单元,且各实体擦除单元具有多个实体编程单元。连接器用以电连接主机系统。存储控制器电连接至可复写式非易失性存储器模块与连接器,且存储控制器包括缓冲存储器。存储控制器接收多组数据,这多组数据包含一第一类数据及至少一第二类数据,其中第一类数据的容量小于数据量临界值。存储控制器将这多组数据暂存于缓冲存储器,当判断这多组数据符合预定条件后,将暂存于缓冲存储器的第一类数据及至少部分第二类数据同时编程至实体编程单元组,此实体编程单元组是由n个实体编程单元所组成,n为正整数。存储控制器同时得知第一类数据及至少部分第二类数据的写入状态。The invention provides a memory, including a rewritable non-volatile memory module, a connector, and a memory controller. Wherein the rewritable non-volatile memory module includes a plurality of physical erasing units, and each physical erasing unit has a plurality of physical programming units. The connector is used to electrically connect the host system. The storage controller is electrically connected to the rewritable non-volatile memory module and the connector, and the storage controller includes a buffer memory. The storage controller receives multiple sets of data, and the multiple sets of data include a first type of data and at least one second type of data, wherein the capacity of the first type of data is less than the critical value of data volume. The storage controller temporarily stores the multiple sets of data in the buffer memory, and when judging that the multiple sets of data meet the predetermined conditions, simultaneously programs the first type of data temporarily stored in the buffer memory and at least part of the second type of data into the physical programming unit group , the physical programming unit group is composed of n physical programming units, where n is a positive integer. The storage controller simultaneously learns the writing status of the first type of data and at least part of the second type of data.

在本发明的一实施例中,其中当暂存在缓冲存储器的多组数据的数据量到达实体编程单元组的容量时,存储控制器判定多组数据符合预定条件。In an embodiment of the present invention, when the amount of the multiple sets of data temporarily stored in the buffer memory reaches the capacity of the physical programming unit set, the storage controller determines that the multiple sets of data meet the predetermined condition.

在本发明的一实施例中,其中当存储控制器未接收到其他数据的时间超过时间临界值时,存储控制器判定多组数据符合预定条件。In an embodiment of the present invention, when the storage controller does not receive other data for more than a time threshold, the storage controller determines that the multiple sets of data meet the predetermined condition.

在本发明的一实施例中,其中各实体编程单元包括数据记录区与可用冗余区,而存储控制器在将第一类数据及至少部分第二类数据同时编程至实体编程单元组时,将第一类数据及至少部分第二类数据写入至组成实体编程单元组的n个实体编程单元的数据记录区,并且将第一类数据及至少部分第二类数据所个别对应的逻辑存取地址及扇区数量写入至组成实体编程单元组的n个实体编程单元的可用冗余区。In an embodiment of the present invention, each physical programming unit includes a data recording area and an available redundant area, and when the storage controller simultaneously programs the first type of data and at least part of the second type of data into the physical programming unit group, Writing the first type of data and at least part of the second type of data into the data recording areas of the n physical programming units that make up the physical programming unit group, and individually corresponding to the logic storage of the first type of data and at least part of the second type of data The address and the number of sectors are taken and written into the available redundant area of the n physical programming units constituting the physical programming unit group.

在本发明的一实施例中,其中存储控制器还用以维护对应表,以记录被编程至实体编程单元组的第一类数据及至少部分第二类数据所个别对应的逻辑存取地址及扇区数量与实体编程单元组的对应关系,并将对应表写入至所有实体擦除单元中的一特定实体擦除单元,其中特定实体擦除单元所具有的实体编程单元均不属于实体编程单元组。In an embodiment of the present invention, the memory controller is also used to maintain a correspondence table to record the logical access addresses and corresponding logical access addresses and The corresponding relationship between the number of sectors and the physical programming unit group, and write the corresponding table to a specific physical erasing unit in all physical erasing units, wherein the physical programming units of the specific physical erasing unit do not belong to physical programming unit group.

在本发明的一实施例中,其中第一类数据及至少部分第二类数据的写入状态被一并回复给发出多组数据的主机系统。In an embodiment of the present invention, the write statuses of the first type of data and at least part of the second type of data are collectively returned to the host system that sent multiple sets of data.

基于上述,本发明是先累积多组主机系统欲写入的少量数据,并在将上述数据一并成功地编程至可复写式非易失性存储器模块后,将数个写入完成信息同时回复给主机系统以回应上述数据所对应的数个写入指令。据此达到将数据快速且安全地写入存储器的目的。Based on the above, the present invention first accumulates a small amount of data to be written by multiple sets of host systems, and after the above data are successfully programmed into the rewritable non-volatile memory module, several write completion messages are simultaneously returned Respond to the host system with several write commands corresponding to the above data. Accordingly, the purpose of writing data into the memory quickly and safely is achieved.

为让本发明的上述特征和优点能更明显易懂,下文特举实施例,并配合附图作详细说明如下。In order to make the above-mentioned features and advantages of the present invention more comprehensible, the following specific embodiments are described in detail with reference to the accompanying drawings.

附图说明Description of drawings

图1A是根据本发明一实施例示出的使用存储器的主机系统的示意图;FIG. 1A is a schematic diagram of a host system using a memory according to an embodiment of the present invention;

图1B是根据本发明实施例所示出的电脑、输入/输出装置与存储器的示意图;FIG. 1B is a schematic diagram of a computer, an input/output device and a memory according to an embodiment of the present invention;

图1C是根据本发明另一实施例所示出的主机系统与存储器的示意图;FIG. 1C is a schematic diagram of a host system and a memory according to another embodiment of the present invention;

图2是示出图1A所示的存储器的概要方块图;FIG. 2 is a schematic block diagram showing the memory shown in FIG. 1A;

图3是根据本发明一实施例示出的存储控制器的概要方块图;FIG. 3 is a schematic block diagram of a storage controller according to an embodiment of the present invention;

图4、5是根据本发明的一实施例所示出的管理可复写式非易失性存储器模块的示意图;4 and 5 are schematic diagrams of a management rewritable non-volatile memory module shown according to an embodiment of the present invention;

图6是根据本发明的一实施例所示出的实体单元的示意图;Fig. 6 is a schematic diagram of a physical unit shown according to an embodiment of the present invention;

图7是根据本发明的一实施例所示出的实体编程单元的示意图;FIG. 7 is a schematic diagram of a physical programming unit shown according to an embodiment of the present invention;

图8是根据本发明的一实施例所示出的将数据编程至实体编程单元组的示意图;FIG. 8 is a schematic diagram of programming data into a physical programming unit group according to an embodiment of the present invention;

图9是根据本发明的一实施例所示出的数据写入方法的流程图。Fig. 9 is a flowchart of a data writing method according to an embodiment of the present invention.

附图标记说明:Explanation of reference signs:

1000:主机系统;1000: host system;

1100:电脑;1100: computer;

1102:微处理器;1102: microprocessor;

1104:随机存取存储器;1104: random access memory;

1106:输入/输出装置;1106: input/output device;

1108:系统总线;1108: system bus;

1110:数据传输接口;1110: data transmission interface;

1202:鼠标;1202: mouse;

1204:键盘;1204: keyboard;

1206:显示器;1206: display;

1208:打印机;1208: printer;

1212:U盘;1212: U disk;

1214:存储卡;1214: memory card;

1216:固态硬盘;1216: SSD;

1310:数码相机;1310: digital camera;

1312:SD卡;1312: SD card;

1314:MMC卡;1314: MMC card;

1316:记忆棒;1316: memory stick;

1318:CF卡;1318: CF card;

1320:嵌入式储存装置;1320: embedded storage device;

100:存储器;100: memory;

102:连接器;102: connector;

104:存储控制器;104: storage controller;

106:可复写式非易失性存储器模块;106: a rewritable non-volatile memory module;

1041:主机系统接口;1041: host system interface;

1043:存储器管理电路;1043: memory management circuit;

1045:存储器接口;1045: memory interface;

1047:缓冲存储器;1047: buffer memory;

3002:错误检查与校正电路;3002: error checking and correction circuit;

3006:电源管理电路;3006: power management circuit;

410(0)~410(N):实体擦除单元;410(0)~410(N): entity erasing unit;

502:数据区;502: data area;

504:闲置区;504: idle area;

506:系统区;506: system area;

508:取代区;508: Replacement area;

610(0)~610(L):逻辑单元;610(0)~610(L): logic unit;

710(0)~710(C)、710(D)~710(E):实体单元;710(0)~710(C), 710(D)~710(E): entity unit;

PF(0)~PF(127)、PF+1(0)~PF+1(127)、PF+2(0)~PF+2(127)、PF+3(0)~PF+3(127):实体编程单元; PF (0)~ PF (127), PF+1 (0)~ PF+1 (127), PF+2 (0)~ PF+2 (127), PF+3 (0 )~ PF+3 (127): Entity programming unit;

FP(0)、FP(1)、FP(2)、FP(127):实体编程单元组;FP(0), FP(1), FP(2), FP(127): entity programming unit group;

WD1:第一数据;WD 1 : first data;

WD2_1、WD2_2、WD2_3:第二数据;WD 2_1 , WD 2_2 , WD 2_3 : second data;

WD3:第三数据;WD 3 : third data;

DD1、DD2、DD3、DD4:填补数据;DD 1 , DD 2 , DD 3 , DD 4 : padding data;

S910~S930:步骤。S910-S930: steps.

具体实施方式detailed description

一般而言,存储器(也称,存储系统)包括可复写式非易失性存储器模块与存储控制器(也称,控制电路)。通常存储器是与主机系统一起使用,以使主机系统可将数据写入至存储器或从存储器中读取数据。Generally speaking, a memory (also called a storage system) includes a rewritable non-volatile memory module and a storage controller (also called a control circuit). Typically memory is used with a host system so that the host system can write data to and read data from the memory.

图1A是根据本发明一实施例示出的使用存储器的主机系统的示意图。FIG. 1A is a schematic diagram of a host system using a memory according to an embodiment of the present invention.

主机系统1000包括电脑1100与输入/输出(Input/Output,I/O)装置1106。电脑1100包括微处理器1102、随机存取存储器(Random AccessMemory,RAM)1104、系统总线1108以及数据传输接口1110。输入/输出装置1106包括如图1B所示的鼠标1202、键盘1204、显示器1206与打印机1208。必须了解的是,图1B所示的装置非限制输入/输出装置1106,输入/输出装置1106可还包括其他装置。The host system 1000 includes a computer 1100 and an input/output (I/O) device 1106 . The computer 1100 includes a microprocessor 1102 , a random access memory (Random Access Memory, RAM) 1104 , a system bus 1108 and a data transmission interface 1110 . The input/output device 1106 includes a mouse 1202, a keyboard 1204, a monitor 1206 and a printer 1208 as shown in FIG. 1B. It must be understood that the device shown in FIG. 1B is not limited to the I/O device 1106, and the I/O device 1106 may also include other devices.

在本发明实施例中,存储器100是通过数据传输接口1110与主机系统1000的其他元件电连接。通过微处理器1102、随机存取存储器1104以及输入/输出装置1106的操作,主机系统1000可将数据写入至存储器100,或从存储器100中读取数据。例如,存储器100可以是如图1B所示的存储卡1214、U盘1212、或固态硬盘(Solid State Drive,SSD)1216。In the embodiment of the present invention, the memory 100 is electrically connected with other components of the host system 1000 through the data transmission interface 1110 . Through the operations of the microprocessor 1102 , the random access memory 1104 and the input/output device 1106 , the host system 1000 can write data into the memory 100 or read data from the memory 100 . For example, the memory 100 may be a memory card 1214, a USB disk 1212, or a solid state drive (Solid State Drive, SSD) 1216 as shown in FIG. 1B.

一般而言,主机系统1000为可储存数据的任意系统。虽然在本实施例中主机系统1000是以电脑系统来作说明,然而,在本发明另一实施例中,主机系统1000也可以是手机、数码相机、摄像机、通信装置、音频播放器或视频播放器等系统。例如,在主机系统为数码相机1310时,存储器则为其所使用的安全数字(Secure Digital,SD)卡1312、多媒体存储(Multimedia Card,MMC)卡1314、记忆棒(Memory Stick)1316、紧凑式闪存(CompactFlash,CF)卡1318或嵌入式储存装置1320(如图1C所示)。嵌入式储存装置1320包括嵌入式多媒体卡(EmbeddedMMC,eMMC)。值得一提的是,嵌入式多媒体卡是直接电连接于主机系统的基板上。In general, host system 1000 is any system that can store data. Although the host system 1000 is described as a computer system in this embodiment, in another embodiment of the present invention, the host system 1000 can also be a mobile phone, a digital camera, a camcorder, a communication device, an audio player or a video player devices and other systems. For example, when the host system is a digital camera 1310, the storage is a Secure Digital (Secure Digital, SD) card 1312, a Multimedia Card (MMC) card 1314, a memory stick (Memory Stick) 1316, a compact A flash memory (CompactFlash, CF) card 1318 or an embedded storage device 1320 (as shown in FIG. 1C ). The embedded storage device 1320 includes an embedded multimedia card (EmbeddedMMC, eMMC). It is worth mentioning that the embedded multimedia card is directly electrically connected to the substrate of the host system.

图2是示出图1A所示的存储器的概要方块图。请参照图2,存储器100包括连接器102、存储控制器104与可复写式非易失性存储器模块106。FIG. 2 is a schematic block diagram showing the memory shown in FIG. 1A. Referring to FIG. 2 , the memory 100 includes a connector 102 , a memory controller 104 and a rewritable non-volatile memory module 106 .

连接器102电连接至存储控制器104,并且用以电连接主机系统1000。在本实施例中,连接器102所支持的传输接口种类为通用串行总线(Universal Serial Bus,USB)接口。然而在其他实施例中,连接器102的传输接口种类也可以是串行高级技术附件(SerialAdvancedTechnology Attachment,SATA)接口、多媒体卡(Multimedia Card,MMC)接口、并行高级技术附件(Parallel Advanced TechnologyAttachment,PATA)接口、电气和电子工程师协会(Institute of Electricaland Electronic Engineers,IEEE)1394接口、外设部件互连标准(PeripheralComponent Interconnect Express,PCI Express)接口、安全数字(SecureDigital,SD)接口、记忆棒(Memory Stick,MS)接口、紧凑式闪存(CompactFlash,CF)接口,或集成驱动器电子(Integrated Drive Electronics,IDE)接口等任何适用的接口,在此并不加以限制。The connector 102 is electrically connected to the storage controller 104 and used for electrically connecting the host system 1000 . In this embodiment, the type of transmission interface supported by the connector 102 is a Universal Serial Bus (USB) interface. However, in other embodiments, the transmission interface type of the connector 102 may also be a serial advanced technology attachment (Serial Advanced Technology Attachment, SATA) interface, a multimedia card (Multimedia Card, MMC) interface, a parallel advanced technology attachment (Parallel Advanced Technology Attachment, PATA ) interface, Institute of Electrical and Electronic Engineers (IEEE) 1394 interface, Peripheral Component Interconnect Express (PCI Express) interface, Secure Digital (SecureDigital, SD) interface, Memory Stick (Memory Stick , MS) interface, CompactFlash (CompactFlash, CF) interface, or any applicable interface such as Integrated Drive Electronics (Integrated Drive Electronics, IDE) interface, which is not limited here.

存储控制器104会执行以硬件型式或固件型式实现的多个逻辑门或控制指令,并根据主机系统1000的指令在可复写式非易失性存储器模块106中进行数据的写入、读取与擦除等操作。其中,存储控制器104还特别用以根据本实施例的数据写入方法来处理主机系统1000欲写入可复写式非易失性存储器模块106的数据。本实施例的数据写入方法将于后配合图示再作说明。The storage controller 104 executes a plurality of logic gates or control instructions implemented in hardware or firmware, and writes, reads, and writes data in the rewritable non-volatile memory module 106 according to the instructions of the host system 1000. Erase etc. Wherein, the storage controller 104 is also specially used for processing the data to be written into the rewritable non-volatile memory module 106 by the host system 1000 according to the data writing method of this embodiment. The data writing method of this embodiment will be described later with the illustrations.

可复写式非易失性存储器模块106电连接至存储控制器104。可复写式非易失性存储器模块106为多阶存储单元(Multi Level Cell,MLC)NAND闪存模块,但本发明不限于此,可复写式非易失性存储器模块106也可以是单阶存储单元(Single Level Cell,SLC)NAND闪存模块、其他闪存模块或任何具有相同特性的存储器模块。进一步来说,可复写式非易失性存储器模块106包括多个实体擦除单元,而每一实体擦除单元具有多个实体编程单元。属于同一个实体擦除单元的实体编程单元可被独立地写入且被同时地擦除。也就是说,实体擦除单元为擦除的最小单位。也即,每一实体擦除单元含有最小数目之一并被擦除的存储单元。实体编程单元为编程的最小单元。即,实体编程单元为写入数据的最小单元。在本实施例中,实体擦除单元为实体块,而实体编程单元为实体页面,但本发明不以此为限。The rewritable non-volatile memory module 106 is electrically connected to the storage controller 104 . The rewritable nonvolatile memory module 106 is a multi-level storage unit (Multi Level Cell, MLC) NAND flash memory module, but the present invention is not limited thereto, and the rewritable nonvolatile memory module 106 can also be a single-level storage unit (Single Level Cell, SLC) NAND flash memory modules, other flash memory modules, or any memory module with the same characteristics. Further, the rewritable non-volatile memory module 106 includes a plurality of physical erasing units, and each physical erasing unit has a plurality of physical programming units. Physical programming units belonging to the same physical erasing unit can be written independently and erased simultaneously. That is to say, the physical erasing unit is the smallest unit of erasing. That is, each physical erase unit contains a minimum number of memory cells that are erased. The entity programming unit is the smallest unit of programming. That is, the physical programming unit is the minimum unit for writing data. In this embodiment, the physical erasing unit is a physical block, and the physical programming unit is a physical page, but the invention is not limited thereto.

图3是根据本发明一实施例示出的存储控制器的概要方块图。请参照图3,存储控制器104包括主机系统接口1041、存储器管理电路1043、存储器接口1045,以及缓冲存储器1047。FIG. 3 is a schematic block diagram of a storage controller according to an embodiment of the present invention. Referring to FIG. 3 , the storage controller 104 includes a host system interface 1041 , a memory management circuit 1043 , a memory interface 1045 , and a buffer memory 1047 .

主机系统接口1041电连接至存储器管理电路1043,并通过连接器102以电连接主机系统1000。主机系统接口1041用以接收与识别主机系统1000所传送的指令与数据。据此,主机系统1000所传送的指令与数据会通过主机系统接口1041而传送至存储器管理电路1043。在本实施例中,主机系统接口1041对应连接器102而为USB接口,而在其他实施例中,主机系统接口1041也可以是SATA接口、MMC接口、PATA接口、IEEE 1394接口、PCI Express接口、SD接口、MS接口、CF接口、IDE接口或符合其他接口标准的接口。The host system interface 1041 is electrically connected to the memory management circuit 1043 and electrically connected to the host system 1000 through the connector 102 . The host system interface 1041 is used for receiving and identifying commands and data transmitted by the host system 1000 . Accordingly, the commands and data sent by the host system 1000 are sent to the memory management circuit 1043 through the host system interface 1041 . In this embodiment, the host system interface 1041 is a USB interface corresponding to the connector 102, and in other embodiments, the host system interface 1041 can also be a SATA interface, an MMC interface, a PATA interface, an IEEE 1394 interface, a PCI Express interface, SD interface, MS interface, CF interface, IDE interface or interfaces that meet other interface standards.

存储器管理电路1043用以控制存储控制器104的整体操作。具体来说,存储器管理电路1043具有多个控制指令,在存储器100被运行(power on)时,上述控制指令会被执行以实现本实施例的数据写入方法。The memory management circuit 1043 is used to control the overall operation of the memory controller 104 . Specifically, the memory management circuit 1043 has a plurality of control instructions, and when the memory 100 is powered on, the above control instructions will be executed to implement the data writing method of this embodiment.

在一实施例中,存储器管理电路1043的控制指令是以固件型式来实现。例如,存储器管理电路1043具有微处理器单元(未示出)与只读存储器(未示出),且上述控制指令是被刻录在只读存储器中。当存储器100操作时,上述控制指令会由微处理器单元来执行以完成本实施例的数据写入方法。In one embodiment, the control commands of the memory management circuit 1043 are implemented in firmware. For example, the memory management circuit 1043 has a microprocessor unit (not shown) and a read-only memory (not shown), and the above-mentioned control instructions are recorded in the read-only memory. When the memory 100 is in operation, the above control instructions will be executed by the microprocessor unit to complete the data writing method of this embodiment.

在本发明另一实施例中,存储器管理电路1043的控制指令也可以代码型式储存于可复写式非易失性存储器模块106的特定区域(例如,可复写式非易失性存储器模块106中专用于存放系统数据的系统区)中。此外,存储器管理电路1043具有微处理器单元(未示出)、只读存储器(未示出)及随机存取存储器(未示出)。其中,只读存储器具有驱动码段,并且当存储控制器104被致能时,微处理器单元会先执行此驱动码段来将储存于可复写式非易失性存储器模块106中的控制指令载入至存储器管理电路1043的随机存取存储器中。之后,微处理器单元会运行上述控制指令以执行本实施例的数据写入方法。In another embodiment of the present invention, the control instructions of the memory management circuit 1043 can also be stored in a specific area of the rewritable non-volatile memory module 106 in code form (for example, the special area in the rewritable non-volatile memory module 106 in the system area where system data is stored). In addition, the memory management circuit 1043 has a microprocessor unit (not shown), a read only memory (not shown), and a random access memory (not shown). Wherein, the read-only memory has a driving code segment, and when the storage controller 104 is enabled, the microprocessor unit will first execute the driving code segment to store the control instructions in the rewritable non-volatile memory module 106 Loaded into the random access memory of the memory management circuit 1043. Afterwards, the microprocessor unit executes the above control instructions to execute the data writing method of this embodiment.

此外,在本发明另一实施例中,存储器管理电路1043的控制指令也可以一硬件型式来实现。举例来说,存储器管理电路1043包括微控制器、存储器管理单元、存储器写入单元、存储器读取单元、存储器擦除单元与数据处理单元。存储器管理单元、存储器写入单元、存储器读取单元、存储器擦除单元与数据处理单元是电连接至微控制器。其中,存储器管理单元用以管理可复写式非易失性存储器模块106中的实体擦除单元。存储器写入单元用以对可复写式非易失性存储器模块106下达写入指令以将数据写入至可复写式非易失性存储器模块106中。存储器读取单元用以对可复写式非易失性存储器模块106下达读取指令以从可复写式非易失性存储器模块106中读取数据。存储器擦除单元用以对可复写式非易失性存储器模块106下达擦除指令以将数据从可复写式非易失性存储器模块106中擦除。而数据处理单元用以处理欲写入至可复写式非易失性存储器模块106的数据以及从可复写式非易失性存储器模块106中读取的数据。In addition, in another embodiment of the present invention, the control instructions of the memory management circuit 1043 can also be implemented in a hardware form. For example, the memory management circuit 1043 includes a microcontroller, a memory management unit, a memory writing unit, a memory reading unit, a memory erasing unit and a data processing unit. The memory management unit, the memory writing unit, the memory reading unit, the memory erasing unit and the data processing unit are electrically connected to the microcontroller. Wherein, the memory management unit is used for managing physical erasing units in the rewritable non-volatile memory module 106 . The memory writing unit is used for issuing a write command to the rewritable non-volatile memory module 106 to write data into the rewritable non-volatile memory module 106 . The memory reading unit is used for issuing a read command to the rewritable non-volatile memory module 106 to read data from the rewritable non-volatile memory module 106 . The memory erasing unit is used for issuing an erase command to the rewritable non-volatile memory module 106 to erase data from the rewritable non-volatile memory module 106 . The data processing unit is used for processing data to be written into the rewritable non-volatile memory module 106 and data read from the rewritable non-volatile memory module 106 .

存储器接口1045电连接至存储器管理电路1043,以使存储控制器104与可复写式非易失性存储器模块106电连接。据此,存储控制器104可对可复写式非易失性存储器模块106进行相关操作。也就是说,欲写入至可复写式非易失性存储器模块106的数据会通过存储器接口1045转换为可复写式非易失性存储器模块106所能接受的格式。The memory interface 1045 is electrically connected to the memory management circuit 1043 to electrically connect the memory controller 104 to the rewritable non-volatile memory module 106 . Accordingly, the storage controller 104 can perform related operations on the rewritable non-volatile memory module 106 . That is to say, the data to be written into the rewritable nonvolatile memory module 106 will be converted into a format acceptable to the rewritable nonvolatile memory module 106 through the memory interface 1045 .

缓冲存储器1047可以是静态随机存取存储器(Static Random AccessMemory,SRAM)、或动态随机存取存储器(Dynamic Random AccessMemory,DRAM)等,本发明并不加以限制。缓冲存储器1047电连接至存储器管理电路1043,用以暂存来自于主机系统1000的指令与数据,或暂存来自于可复写式非易失性存储器模块106的数据。The buffer memory 1047 may be a static random access memory (Static Random Access Memory, SRAM), or a dynamic random access memory (Dynamic Random Access Memory, DRAM), etc., which is not limited in the present invention. The buffer memory 1047 is electrically connected to the memory management circuit 1043 for temporarily storing instructions and data from the host system 1000 or temporarily storing data from the rewritable non-volatile memory module 106 .

在本发明的另一实施例中,存储控制器104还包括错误检查与校正电路3002。错误检查与校正电路3002电连接至存储器管理电路1043,用以执行错误检查与校正程序以确保数据的正确性。具体而言,当存储器管理电路1043接收到来自主机系统1000的写入指令时,错误检查与校正电路3002会为对应此写入指令的数据产生对应的错误检查与校正码(Error Checking and Correcting Code,ECC Code),且存储器管理电路1043会将对应此写入指令的数据与对应的错误检查与校正码写入至可复写式非易失性存储器模块106。之后当存储器管理电路1043从可复写式非易失性存储器模块106中读取数据时,会同时读取此数据对应的错误检查与校正码,且错误检查与校正电路3002会依据此错误检查与校正码对所读取的数据执行错误检查与校正程序,以识别该组数据是否存在错误字节。In another embodiment of the present invention, the storage controller 104 further includes an error checking and correction circuit 3002 . The error checking and correcting circuit 3002 is electrically connected to the memory management circuit 1043 for executing error checking and correcting procedures to ensure the correctness of data. Specifically, when the memory management circuit 1043 receives a write command from the host system 1000, the error checking and correcting circuit 3002 will generate a corresponding error checking and correcting code (Error Checking and Correcting Code) for the data corresponding to the write command. , ECC Code), and the memory management circuit 1043 will write the data corresponding to the write command and the corresponding ECC code into the rewritable non-volatile memory module 106 . Afterwards, when the memory management circuit 1043 reads data from the rewritable non-volatile memory module 106, it will simultaneously read the error checking and correction code corresponding to the data, and the error checking and correction circuit 3002 will read the error checking and correction code according to the error checking and correction code. The correction code executes error checking and correction procedures on the read data to identify whether there is an error byte in the set of data.

在本发明又一实施例中,存储控制器104还包括电源管理电路3006。电源管理电路3006电连接至存储器管理电路1043,用以控制存储器100的电源。In yet another embodiment of the present invention, the storage controller 104 further includes a power management circuit 3006 . The power management circuit 3006 is electrically connected to the memory management circuit 1043 for controlling the power of the memory 100 .

图4、5是根据本发明的一实施例所示出的管理可复写式非易失性存储器模块的示意图。4 and 5 are schematic diagrams of managing a rewritable non-volatile memory module according to an embodiment of the present invention.

在以下描述可复写式非易失性存储器模块106的实体擦除单元的操作时,以“提取”、“交换”、“分组”、“轮替”等词来操作实体擦除单元是逻辑上的概念。也就是说,可复写式非易失性存储器模块106的实体擦除单元的实际位置并未改动,而是逻辑上对可复写式非易失性存储器模块106的实体擦除单元进行上述操作。When describing the operation of the entity erasing unit of the rewritable non-volatile memory module 106 below, it is logical to operate the entity erasing unit with words such as "extract", "exchange", "group", and "rotate". the concept of. That is to say, the actual location of the physical erasing unit of the rewritable non-volatile memory module 106 is not changed, but the above operations are logically performed on the physical erasing unit of the rewritable non-volatile memory module 106 .

请参照图4,本实施例的可复写式非易失性存储器模块106包括实体擦除单元410(0)~410(N)。存储控制器104中的存储器管理电路1043会将实体擦除单元410(0)~410(N)逻辑地分组为数据区502、闲置区504、系统区506与取代区508。其中,图4所示的F、S、R与N为正整数,代表各区配置的实体擦除单元数量,其可由存储器100的制造商依据所使用的可复写式非易失性存储器模块106的容量来设定。Referring to FIG. 4 , the rewritable non-volatile memory module 106 of this embodiment includes physical erasing units 410 ( 0 )˜410 (N). The memory management circuit 1043 in the storage controller 104 logically groups the physical erasing units 410 ( 0 )˜ 410 (N) into a data area 502 , an idle area 504 , a system area 506 and a replacement area 508 . Wherein, F, S, R and N shown in FIG. 4 are positive integers, representing the number of entity erasing units configured in each region, which can be determined by the manufacturer of the memory 100 according to the used rewritable non-volatile memory module 106. capacity to set.

逻辑上属于数据区502与闲置区504的实体擦除单元是用以储存来自于主机系统1000的数据。举例来说,数据区502的实体擦除单元是被视为已储存数据的实体擦除单元,而闲置区504的实体擦除单元是用以写入新数据的实体擦除单元。换句话说,闲置区504的实体擦除单元为空或可使用的实体擦除单元(无记录数据或标记为已没用的无效数据)。当从主机系统1000接收到写入指令与欲写入的数据时,存储器管理电路1043会从闲置区504中提取实体擦除单元,并且将数据写入至所提取的实体擦除单元中,以替换数据区502的实体擦除单元。或者,当需要对一逻辑擦除单元执行数据合并程序时,存储器管理电路1043会从闲置区504提取实体擦除单元并将数据写入其中,以替换原先映射此逻辑擦除单元的实体擦除单元。The physical erase units logically belonging to the data area 502 and the free area 504 are used to store data from the host system 1000 . For example, the physical erasing unit of the data area 502 is regarded as the physical erasing unit of stored data, and the physical erasing unit of the spare area 504 is used for writing new data. In other words, the physical erasing unit of the spare area 504 is an empty or usable physical erasing unit (no recorded data or invalid data marked as useless). When receiving the write command and the data to be written from the host system 1000, the memory management circuit 1043 will extract the physical erasing unit from the spare area 504, and write the data into the extracted physical erasing unit, so as to The physical erase unit of the data area 502 is replaced. Or, when it is necessary to perform a data merging program on a logical erasing unit, the memory management circuit 1043 will extract the physical erasing unit from the spare area 504 and write data therein to replace the physical erasing unit previously mapped to this logical erasing unit. unit.

逻辑上属于系统区506的实体擦除单元是用以记录系统数据。举例来说,系统数据包括关于可复写式非易失性存储器模块106的制造商与型号、可复写式非易失性存储器模块106的实体擦除单元数、每一实体擦除单元的实体编程单元数等等。The physical erase units logically belonging to the system area 506 are used to record system data. For example, the system data includes information about the manufacturer and model of the rewritable nonvolatile memory module 106, the number of physically erased units of the rewritable nonvolatile memory module 106, and the physical programming of each physically erased unit. number of units and so on.

逻辑上属于取代区508的实体擦除单元是用以在数据区502、闲置区504或系统区506中的实体擦除单元损毁时,取代损坏的实体擦除单元。具体而言,在存储器100操作期间,若取代区508中仍存有正常的实体擦除单元且数据区502的实体擦除单元损坏时,存储器管理电路1043会从取代区508中提取正常的实体擦除单元来更换数据区502中损坏的实体擦除单元。倘若取代区508中无正常的实体擦除单元且发生实体擦除单元损毁时,则存储器管理电路1043会将整个存储器100宣告为写入保护(write protect)状态,而无法再写入数据。The physical erasing units logically belonging to the replacement area 508 are used to replace the damaged physical erasing units when the physical erasing units in the data area 502 , spare area 504 or system area 506 are damaged. Specifically, during the operation of the memory 100, if there are still normal physical erasing units in the replacement area 508 and the physical erasing units in the data area 502 are damaged, the memory management circuit 1043 will extract the normal physical erasing units from the replacement area 508. Erase units to replace damaged physically erased units in the data area 502 . If there is no normal physically erased unit in the replacement area 508 and the physically erased unit is damaged, the memory management circuit 1043 declares the entire memory 100 to be in a write protect state, and data cannot be written any more.

也因此,在存储器100的操作过程中,数据区502、闲置区504、系统区506与取代区508的实体擦除单元会动态地变动。例如,用以轮替储存数据的实体擦除单元会变动地属于数据区502或闲置区504。Therefore, during the operation of the memory 100 , the physical erase units of the data area 502 , the idle area 504 , the system area 506 and the replacement area 508 will change dynamically. For example, the physical erasing unit used to alternately store data may belong to the data area 502 or the idle area 504 .

请参照图5,存储器管理电路1043将数据区502的实体块410(0)~410(F-1)与闲置区504的实体块420(F)~420(S-1)分组为多个实体单元710(0)~710(C)、710(D)~710(E),并且以实体单元为单位来管理可复写式非易失性存储器模块106,其中各实体单元包括n个实体擦除单元,n为正整数。而C、D与E也为正整数,其数值与n、F、S的数值有关。在一实施例中,每一实体单元是由两个实体擦除单元所组成,倘若可复写式非易失性存储器模块106包括两个或两个以上的存储器晶粒(die),则这两个实体擦除单元可分别属于不同的存储器晶粒。然而,必须了解的是,本发明不限于此。在另一实施例中,每一实体单元可由一个实体擦除单元所组成。或者,在又一实施例中,每一实体单元也可由同一存储器晶粒或不同存储器晶粒中的至少一个实体擦除单元所组成。Please refer to FIG. 5, the memory management circuit 1043 groups the physical blocks 410(0)-410(F-1) of the data area 502 and the physical blocks 420(F)-420(S-1) of the spare area 504 into multiple entities Units 710(0)~710(C), 710(D)~710(E), and manage the rewritable non-volatile memory module 106 in units of physical units, wherein each physical unit includes n physical erasable Unit, n is a positive integer. C, D, and E are also positive integers, and their values are related to the values of n, F, and S. In one embodiment, each physical unit is composed of two physical erasable units. If the rewritable non-volatile memory module 106 includes two or more memory dies, the two The physical erase units may respectively belong to different memory dies. However, it must be understood that the present invention is not limited thereto. In another embodiment, each physical unit may consist of a physical erasing unit. Alternatively, in yet another embodiment, each physical unit may also be composed of at least one physical erasing unit in the same memory die or different memory dies.

为了让主机系统1000能对可复写式非易失性存储器模块106进行存取,存储器管理电路1043会配置数个逻辑单元610(0)~610(L)以映射数据区502中的实体单元710(0)~710(C)。其中,每一逻辑单元是由n个逻辑擦除单元所组成,而每一逻辑擦除单元包括数个逻辑编程单元。进一步来说,逻辑单元610(0)~610(L)中的逻辑编程单元会依序映射实体单元710(0)~710(C)中的实体编程单元。In order for the host system 1000 to access the rewritable non-volatile memory module 106, the memory management circuit 1043 configures several logical units 610(0)-610(L) to map the physical unit 710 in the data area 502 (0) ~ 710 (C). Wherein, each logical unit is composed of n logical erasing units, and each logical erasing unit includes several logical programming units. Further, the logical programming units in the logical units 610(0)˜610(L) are sequentially mapped to the physical programming units in the physical units 710(0)˜710(C).

存储器管理电路1043将所配置的逻辑单元610(0)~610(L)提供给主机系统1000,并维护逻辑地址-实体地址映射表以记录逻辑单元610(0)~610(L)与实体单元710(0)~710(C)的映射关系。当主机系统1000欲存取一逻辑存取地址时,存储器管理电路1043会确认此逻辑存取地址所对应的逻辑擦除单元与逻辑编程单元,再通过逻辑地址-实体地址映射表找到其所映射的实体编程单元来进行存取。The memory management circuit 1043 provides the configured logical units 610(0)-610(L) to the host system 1000, and maintains a logical address-physical address mapping table to record the logical units 610(0)-610(L) and physical units The mapping relationship of 710(0) to 710(C). When the host system 1000 intends to access a logical access address, the memory management circuit 1043 will confirm the logical erasing unit and the logical programming unit corresponding to the logical access address, and then find the mapped logical address through the logical address-physical address mapping table The physical programming unit for access.

在本实施例中,当主机系统1000欲将数组数据写入存储器100而连续或间断地下达多个写入指令时,存储器管理电路1043接收这多个写入指令对应的多组数据,并将这多组数据暂存在缓冲存储器1047,其中,这多组数据包括一组第一类数据及至少一组第二类数据,第一类数据的容量必须小于数据量临界值(例如是16千字节组,但本发明并不以此为限),而第二类数据的容量是否超过数据量临界值则不加以限制。当判定这多组数据符合预定条件之后,存储器管理电路1043才将目前暂存于缓冲存储器1047的第一类数据以及至少部分第二类数据同时编程至可复写式非易失性存储器模块106中的一实体编程单元组,此实体编程单元组是由n个实体编程单元所组成,n为正整数,也即实体编程单元组可具有1个实体编程单元或多数个实体编程单元。且存储器管理电路1043会同时得知被编程至可复写式非易失性存储器模块106的第一类数据及至少部分第二类数据的写入状态。In this embodiment, when the host system 1000 intends to write array data into the memory 100 and issues multiple write commands continuously or intermittently, the memory management circuit 1043 receives multiple sets of data corresponding to the multiple write commands, and These multiple sets of data are temporarily stored in buffer memory 1047, wherein these multiple sets of data include a set of first type data and at least one set of second type data, and the capacity of the first type of data must be less than the critical value of data volume (for example, 16 kilobytes) section group, but the present invention is not limited thereto), and whether the capacity of the second type of data exceeds the critical value of data volume is not limited. After judging that the sets of data meet the predetermined conditions, the memory management circuit 1043 simultaneously programs the first type of data temporarily stored in the buffer memory 1047 and at least part of the second type of data into the rewritable non-volatile memory module 106 A physical programming unit group, the physical programming unit group is composed of n physical programming units, n is a positive integer, that is, the physical programming unit group can have 1 physical programming unit or a plurality of physical programming units. And the memory management circuit 1043 will simultaneously know the writing status of the first type of data and at least part of the second type of data programmed into the rewritable non-volatile memory module 106 .

举例来说,假设每一实体单元是由4个实体擦除单元所组成(即,n等于4),且一个实体编程单元的容量为4千字节组。那么一个实体编程单元组便包括4个实体编程单元,且一个实体编程单元的容量为16千字节组。此外,在本实施例中是假设当暂存在缓冲存储器1047的多组数据的数据量到达实体编程单元组(即,4个实体编程单元)的容量时,存储器管理电路1043才判定这多组数据符合预定条件。For example, assume that each physical unit is composed of 4 physical erase units (ie, n is equal to 4), and the capacity of a physical program unit is 4 kilobytes. Then one physical programming unit group includes 4 physical programming units, and the capacity of one physical programming unit is 16 kilobytes. In addition, in this embodiment, it is assumed that the memory management circuit 1043 determines that the multiple sets of data are only determined when the data amount of the multiple sets of data temporarily stored in the buffer memory 1047 reaches the capacity of the physical programming unit group (that is, 4 physical programming units). Meet the predetermined conditions.

若主机系统1000欲写入三组数据,其中第一数据的数据量为9千字节组,第二数据的数据量为20千字节组,第三数据的数据量为11千字节组。在主机系统1000欲写入第一数据而下达第一写入指令时,若目前缓冲存储器1047尚未储存任何数据,则存储器管理电路1043并不会在此时将第一写入数据编程至可复写式非易失性存储器模块106,而是将第一数据暂存至缓冲存储器1047。此外,存储器管理电路1043也会将第一数据对应的逻辑存取地址及扇区数量记录在缓冲存储器1047。If the host system 1000 wants to write three sets of data, the data volume of the first data is 9 kilobytes, the data volume of the second data is 20 kilobytes, and the data volume of the third data is 11 kilobytes . When the host system 1000 intends to write the first data and issues the first write command, if the buffer memory 1047 has not stored any data, the memory management circuit 1043 will not program the first write data to be rewritable at this time. Instead, the first data is temporarily stored in the buffer memory 1047 instead of the non-volatile memory module 106 . In addition, the memory management circuit 1043 also records the logical access address and the number of sectors corresponding to the first data in the buffer memory 1047 .

之后,主机系统1000再下达对应第二与第三数据的写入指令。存储器管理电路1043在收到上述两个写入指令时,将对应的第二与第三数据暂存至缓冲存储器1047,并且将第二与第三数据各别对应的逻辑存取地址及扇区数量记录在缓冲存储器1047。由于此时暂存于缓冲存储器1047的多组数据的数据量已到达实体编程单元组的容量,存储器管理电路1043判定这多组数据符合预定条件,因而开始将数据实际地编程至实体编程单元组。Afterwards, the host system 1000 issues write commands corresponding to the second and third data. When the memory management circuit 1043 receives the above two write commands, it temporarily stores the corresponding second and third data in the buffer memory 1047, and stores the corresponding logical access addresses and sectors of the second and third data respectively. The number is recorded in the buffer memory 1047. Since the data volume of the multiple sets of data temporarily stored in the buffer memory 1047 has reached the capacity of the physical programming unit set, the memory management circuit 1043 judges that the multiple sets of data meet the predetermined conditions, and thus begins to actually program the data into the physical programming unit set .

如图6所示,在一实施例中,存储器管理电路1043会从闲置区504中提取实体单元710(D),假设实体单元710(D)包括实体擦除单元410(F)、410(F+1)、410(F+2)、410(F+3),且各实体擦除单元分别包括128个实体编程单元(即,实体编程单元PF(0)~PF(127)、PF+1(0)~PF+1(127)、PF+2(0)~PF+2(127)、PF+3(0)~PF+3(127))。由于在本实施例中,存储器管理电路1043是以实体单元为单位来管理可复写式非易失性存储器模块106,因此分别在实体擦除单元410(F)、410(F+1)、410(F+2)、410(F+3)中具有对应位置的实体编程单元会被配对而组成一个实体编程单元组。举例来说,实体编程单元PF(0)、PF+1(0)、PF+2(0)与PF+3(0)组成实体编程单元组FP(0)、实体编程单元PF(1)、PF+1(1)、PF+2(1)与PF+3(1)组成实体编程单元组FP(1),以此类推。换言之,当实体单元是由n个实体擦除单元所组成,则实体编程单元组便是由上述n个实体擦除单元中的n个实体编程单元所组成。在本实施例中,如图7所示,每一实体编程单元包括数据记录区D与可用冗余区RS,其用途之后再述。存储器管理电路1043会依序自实体单元710(D)取得实体编程单元组来写入数据,且属于相同实体编程单元组的所有实体编程单元会一起被写入数据。然而,由于每一实体编程单元的容量为4千字节组,因此要写入的数据必须补足为4千字节组的倍数。As shown in FIG. 6 , in one embodiment, the memory management circuit 1043 extracts a physical unit 710 (D) from the spare area 504, assuming that the physical unit 710 (D) includes physical erasing units 410 (F), 410 (F +1), 410(F+2), 410(F+3), and each physical erasing unit includes 128 physical programming units (that is, physical programming units PF (0)~ PF (127), P F+1 (0) to P F+1 (127), P F+2 (0) to P F+2 (127), P F+3 (0) to P F+3 (127)). Since in this embodiment, the memory management circuit 1043 manages the rewritable non-volatile memory module 106 in units of physical units, the physical erasing units 410 (F), 410 (F+1), and 410 The physical programming units with corresponding positions in (F+2), 410 (F+3) will be paired to form a physical programming unit group. For example, the physical programming units PF (0), PF +1 (0), PF +2 (0) and PF +3 (0) form the physical programming unit group FP ( 0 ), the physical programming unit P F (1), PF+ 1 (1), PF +2 (1) and PF +3 (1) form the physical programming unit group FP (1), and so on. In other words, when the physical unit is composed of n physical erasing units, the physical programming unit group is composed of n physical programming units among the above n physical erasing units. In this embodiment, as shown in FIG. 7 , each physical programming unit includes a data recording area D and an available redundant area RS, and their usages will be described later. The memory management circuit 1043 will sequentially obtain the physical programming unit group from the physical unit 710(D) to write data, and all the physical programming units belonging to the same physical programming unit group will be written with data together. However, since the capacity of each physical programming unit is 4 kilobytes, the data to be written must be a multiple of 4 kilobytes.

延续前述实施例,存储器管理电路1043在判定暂存于缓冲存储器1047的多组数据已符合预定条件后,便下达编程指令开始进行编程操作。如图8所示,首先,由于完整的第一数据WD1仅有9千字节组,为了将其补足为4千字节组的倍数,存储器管理电路1043额外填入3千字节组的填补数据DD1,进而将完整的第一数据WD1、额外填入的填补数据DD1,以及第一部分第二数据WD2_1(数据量为4千字节组)编程至实体编程单元组FP(0)。Continuing the foregoing embodiments, the memory management circuit 1043 issues a programming command to start programming operation after determining that multiple sets of data temporarily stored in the buffer memory 1047 meet predetermined conditions. As shown in FIG. 8, first, since the complete first data WD 1 has only 9 kilobyte groups, in order to complement it as a multiple of 4 kilobyte groups, the memory management circuit 1043 additionally fills in 3 kilobyte groups Fill the data DD 1 , and then program the complete first data WD 1 , the additional filling data DD 1 , and the first part of the second data WD 2_1 (the data volume is 4 kilobytes) to the physical programming unit group FP ( 0).

接着,存储器管理电路1043将第二部分第二数据WD2_2(数据量为14千字节组)与2千字节组的填补数据DD2编程至实体编程单元组FP(1),并且将第三部分第二数据WD2_3(数据量为2千字节组)与2千字节组的填补数据DD3,以及完整的第三数据WD3(数据量为11千字节组)与1千字节组的填补数据DD4编程至实体编程单元组FP(2)。Next, the memory management circuit 1043 programs the second part of the second data WD 2_2 (the data volume is 14 kilobytes) and the padding data DD 2 of 2 kilobytes into the physical programming unit group FP(1), and writes the second part Three parts of the second data WD 2_3 (data size is 2 kilobytes) and 2 kilobytes of padding data DD 3 , and the complete third data WD 3 (data size is 11 kilobytes) and 1 kilobytes The padding data DD 4 of the byte group is programmed into the physical programming unit group FP(2).

在完成对实体编程单元组FP(2)的编程操作后,存储器管理电路1043取得表示这三组数据都被正常地写入至可复写式非易失性存储器模块106的三个写入状态。在一实施例中,存储器管理电路1043会于此时将三个写入完成信息一并传送给主机系统1000以回应先前收到的三个写入指令。在另一实施例中,若这三组数据有至少其中之一未被正常地写入至可复写式非易失性存储器模块106,则存储器管理电路1043会将三个写入错误信息一并回复给主机系统1000,以使主机系统1000重新下达欲写入上述三组数据的数个写入指令。在又一实施例中,由于存储控制器104在可复写式非易失性存储器模块106受控执行编程操作之际仍可以接收来自主机系统1000的数据,因此为了避免主机系统1000因等待回应而延后传输数据,存储器管理电路1043会提前发出表示写入成功的信息,而在同时取得多组数据的写入状态后,在写入状态表示有错误发生时才将数组写入错误信息一并传送至主机系统1000。也就是说,存储器管理电路1043会将表示数个写入指令的写入状态的数个信息一并回复给主机系统1000,然而本发明并不限制回复信息的时间点。After completing the programming operation of the physical programming unit group FP( 2 ), the memory management circuit 1043 obtains three write states indicating that the three sets of data are normally written into the rewritable non-volatile memory module 106 . In one embodiment, the memory management circuit 1043 sends three write completion messages to the host system 1000 at this time in response to the three write commands previously received. In another embodiment, if at least one of the three sets of data is not normally written into the rewritable non-volatile memory module 106, the memory management circuit 1043 will combine the three write error messages Reply to the host system 1000, so that the host system 1000 re-issues several write commands to write the above three sets of data. In yet another embodiment, since the storage controller 104 can still receive data from the host system 1000 when the rewritable non-volatile memory module 106 is controlled to perform a programming operation, in order to prevent the host system 1000 from waiting for a response Delay the transmission of data, the memory management circuit 1043 will send out the information indicating that the writing is successful in advance, and after obtaining the writing status of multiple sets of data at the same time, when the writing status indicates that there is an error, the error information of the array will be written together. sent to the host system 1000. That is to say, the memory management circuit 1043 will reply to the host system 1000 together with several pieces of information indicating the writing states of the several write commands, but the present invention does not limit the time point of replying the information.

在上述将数据编程至实体编程单元组的过程中,存储器管理电路1043是将实际数据(即,上述实施例中的第一至第三数据)以及填补数据编程至组成实体编程单元组的实体编程单元的数据记录区,并且将实际数据对应的逻辑存取地址及扇区数量写入至组成实体编程单元组的实体编程单元的可用冗余区。以实体编程单元组FP(0)为例,其中实体编程单元PF(0)的数据记录区用以写入4千字节组的第一数据,而此部分的第一数据所对应的逻辑存取地址与扇区数量便写入在实体编程单元PF(0)的可用冗余区。实体编程单元PF+1(0)的数据记录区则用以写入另外4千字节组的第一数据,而此部分的第一数据所对应的逻辑存取地址与扇区数量便写入在实体编程单元PF+1(0)的可用冗余区。实体编程单元PF+2(0)的数据记录区则用以写入剩下的1千字节组的第一数据与3千字节组的填补数据,而此部分的第一数据所对应的逻辑存取地址与扇区数量便写入在实体编程单元PF+2(0)的可用冗余区。实体编程单元PF+3(0)的数据记录区则用以写入4千字节组的第二数据,而此部分的第二数据所对应的逻辑存取地址与扇区数量则写入在实体编程单元PF+3(0)的可用冗余区。In the above-mentioned process of programming data into the entity programming unit group, the memory management circuit 1043 programs the actual data (that is, the first to third data in the above-mentioned embodiment) and the padding data into the entity programming unit constituting the entity programming unit group. The data recording area of the unit, and write the logical access address and the number of sectors corresponding to the actual data into the available redundant area of the physical programming unit constituting the physical programming unit group. Taking the physical programming unit group FP (0) as an example, the data recording area of the physical programming unit PF (0) is used to write the first data of 4 kilobytes, and the logic corresponding to this part of the first data The access address and the number of sectors are then written into the available redundant area of the physical programming unit PF (0). The data recording area of the physical programming unit PF+1 (0) is used to write the first data of another 4 kilobyte group, and the logical access address and the number of sectors corresponding to the first data of this part can be written into the available redundant area in the physical programming unit PF+1 (0). The data recording area of the physical programming unit PF+2 (0) is used to write the first data of the remaining 1 kilobyte group and the padding data of the 3 kilobyte group, and the first data of this part corresponds to The logical access address and the number of sectors are written into the available redundant area in the physical programming unit PF+2 (0). The data recording area of the physical programming unit PF+3 (0) is used to write the second data of 4 kilobytes, and the logical access address and the number of sectors corresponding to the second data of this part are written In the available redundant area of the physical programming unit PF+3 (0).

除此之外,存储器管理电路1043还会维护一对应表,以记录被编程至某一实体编程单元组的第一类数据及至少部分第二类数据的逻辑存取地址及扇区数量与此实体编程单元组的对应关系,并且将对应表写入至实体擦除单元410(0)~410(N)中的一特定实体擦除单元,其中特定实体擦除单元所具有的实体编程单元均不属于实体编程单元组。延续图8的实施例,存储器管理电路1043会在对应表中记录完整的第一数据的逻辑存取地址及扇区数量以及前4千字节组的第二数据的逻辑存取地址及扇区数量系对应实体编程单元组FP(0)。另外14千字节组的第二数据的逻辑存取地址及扇区数量系对应实体编程单元组FP(1)。最后2千字节组的第二数据的逻辑存取地址及扇区数量以及完整的第三数据的逻辑存取地址及扇区数量系对应实体编程单元组FP(2)。此后当实体单元710(D)已被写满数据,或存储器100满足特定条件时,存储器管理电路1043可根据对应表执行数据合并程序。In addition, the memory management circuit 1043 also maintains a correspondence table to record the logical access addresses and sector numbers of the first type of data and at least part of the second type of data programmed into a certain physical programming unit group. The corresponding relationship of the physical programming unit group, and write the corresponding table to a specific physical erasing unit in the physical erasing unit 410 (0) ~ 410 (N), wherein the physical programming unit of the specific physical erasing unit is Not part of the entity programming unit group. Continuing the embodiment of FIG. 8, the memory management circuit 1043 will record the complete logical access address and sector number of the first data and the logical access address and sector of the second data of the first 4 kilobytes in the corresponding table The number corresponds to the physical programming unit group FP(0). In addition, the logical access address and the number of sectors of the second data of the 14-kilobyte group correspond to the physical programming unit group FP(1). The logical access address and sector number of the second data of the last 2 kilobyte group and the logical access address and sector number of the complete third data correspond to the physical programming unit group FP(2). Afterwards, when the physical unit 710(D) is full of data, or the memory 100 satisfies certain conditions, the memory management circuit 1043 can execute the data merging procedure according to the corresponding table.

值得一提的是,若因存储器100断电等因素使得存储器管理电路1043来不及将上述对应关系记录至对应表,存储器管理电路1043也可在存储器100复电时,读取实体单元710(D)中各实体编程单元组的实体编程单元的可用冗余区,以取得对应关系并将其写入对应表。It is worth mentioning that, if the memory management circuit 1043 has no time to record the above-mentioned correspondence in the correspondence table due to factors such as power failure of the memory 100, the memory management circuit 1043 can also read the physical unit 710 (D) when the memory 100 is powered on again. The available redundant area of the physical programming unit of each physical programming unit group in order to obtain the corresponding relationship and write it into the corresponding table.

在上述实施例中,不论所接收到的写入指令数量多少,在已接收到至少一组数据是属于第一类数据(即,容量小于数据量临界值)的情况下,当暂存在缓冲存储器1047的多组数据的数据量未到达一个实体编程单元组的容量(即,n个实体编程单元的容量)时,存储器管理电路1043便会继续将来自主机系统1000的写入数据暂存至缓冲存储器1047,直到所暂存的多组数据的数据量到达一个实体编程单元组的容量时,才将第一类数据以及至少部分其他已暂存的数据正式编程至实体编程单元组。相对于每收到一个写入指令便将其对应的写入数据编程至可复写式非易失性存储器模块106,本实施例所采用的方式能提高系统整体编程程序(program process)的效率,据此提高系统整体写入数据的速度及更有效率的使用可复写式非易失性存储器模块106。更进一步,存储器管理电路1043能同时得知第一类数据及至少部分其他已暂存数据的写入状态,并能在适当时间点将数个写入完成信息一并回复给主机系统1000以回应先前收到的数个写入指令,据此达到确保数据被安全写入存储器100的目的。In the above embodiment, regardless of the number of write instructions received, if at least one set of data has been received and belongs to the first type of data (that is, the capacity is less than the critical value of data volume), when temporarily stored in the buffer memory When the data volume of multiple sets of data in 1047 does not reach the capacity of one physical programming unit group (that is, the capacity of n physical programming units), the memory management circuit 1043 will continue to temporarily store the write data from the host system 1000 into the buffer The memory 1047 does not formally program the first type of data and at least part of other temporarily stored data into the physical programming unit group until the data volume of the temporarily stored multiple sets of data reaches the capacity of one physical programming unit group. Compared with programming the corresponding write data to the rewritable non-volatile memory module 106 every time a write command is received, the method adopted in this embodiment can improve the efficiency of the overall system programming procedure (program process), Accordingly, the speed of writing data in the whole system is improved and the rewritable non-volatile memory module 106 is used more efficiently. Furthermore, the memory management circuit 1043 can simultaneously know the writing status of the first type of data and at least part of other temporarily stored data, and can reply several writing completion messages to the host system 1000 at an appropriate time point to respond According to the previously received write commands, the purpose of ensuring that the data is safely written into the memory 100 is achieved.

在另一实施例中,若存储器管理电路1043已接收到一组第一类数据,且接收到一或多组第二类数据。存储器管理电路1043则会在未接收到其他数据的时间超过一时间临界值时,判定暂存在缓冲存储器1047的多组数据符合预定条件。此时,无论暂存在缓冲存储器1047的多组数据的数据量是否接近一个实体编程单元组的容量,存储器管理电路1043都会下达编程指令以将第一类数据及至少部分第二类数据编程至实体编程单元组。同样地,存储器管理电路1043会同时得知第一类数据及至少部分第二类数据的写入状态,且对应上述数据的写入状态的数个信息将被一并回复给主机系统1000。In another embodiment, if the memory management circuit 1043 has received a set of first-type data and received one or more sets of second-type data. The memory management circuit 1043 determines that the multiple sets of data temporarily stored in the buffer memory 1047 meet a predetermined condition when the time without receiving other data exceeds a time threshold. At this time, no matter whether the data amount of the multiple sets of data temporarily stored in the buffer memory 1047 is close to the capacity of a physical programming unit group, the memory management circuit 1043 will issue programming instructions to program the first type of data and at least part of the second type of data into the entity group of programming units. Likewise, the memory management circuit 1043 will simultaneously know the writing status of the first type of data and at least part of the second type of data, and several pieces of information corresponding to the writing status of the above data will be returned to the host system 1000 together.

在上述实施例中,存储器管理电路1043是从闲置区504提取一个专用的实体单元,并以其中的数个实体编程单元来组成一实体编程单元组。在此管理架构下,若主机系统1000所欲写入的数据是要对某组已存在的数据作修改,则存储器管理电路1043不会采用上述机制将数据编程至实体编程单元组。In the above embodiment, the memory management circuit 1043 extracts a dedicated physical unit from the idle area 504, and uses several physical programming units in it to form a physical programming unit group. Under this management framework, if the data to be written by the host system 1000 is to modify a certain set of existing data, the memory management circuit 1043 will not use the above mechanism to program the data into the physical programming unit group.

在另一实施例中,存储器管理电路1043并不会将可复写式非易失性存储器模块106中的实体擦除单元410(0)~410(N)进行如图4的逻辑上的分组。由此,存储器管理电路1043可从可复写式非易失性存储器模块106取得任意n个实体擦除单元,并以其中的n个实体编程单元来组成一实体编程单元组。然而,由于在接收到包括一第一类数据与至少一第二类数据的多组数据时,将上述数据暂存至缓冲存储器1047,并待这多组数据符合预定条件后,才将第一类数据及至少部分第二类数据同时编程至实体编程单元组,且同时得知实际编程的数据的写入状态的详细操作方式与前述实施例相同或相似,故在此不再赘述。In another embodiment, the memory management circuit 1043 does not logically group the physical erasing units 410 ( 0 )˜ 410 (N) in the rewritable non-volatile memory module 106 as shown in FIG. 4 . Thus, the memory management circuit 1043 can obtain any n physical erasing units from the rewritable non-volatile memory module 106 , and use n physical programming units among them to form a physical programming unit group. However, when multiple sets of data including a first type of data and at least one second type of data are received, the above data is temporarily stored in the buffer memory 1047, and the first The detailed operation of simultaneously programming the type data and at least part of the second type data into the physical programming unit group and knowing the writing status of the actually programmed data is the same as or similar to the above-mentioned embodiment, so it will not be repeated here.

图9是根据本发明的一实施例所示出的数据写入方法的流程图,请参阅图9。FIG. 9 is a flowchart of a data writing method according to an embodiment of the present invention, please refer to FIG. 9 .

首先如步骤S910所示,存储器管理电路1043接收来自主机系统1000的多组数据。这多组数据包含一第一类数据及至少一第二类数据,其中第一类数据的容量小于数据量临界值,第二类数据的容量则不加以限制。First, as shown in step S910 , the memory management circuit 1043 receives multiple sets of data from the host system 1000 . The multiple sets of data include a first type of data and at least one second type of data, wherein the capacity of the first type of data is less than the critical value of data volume, and the capacity of the second type of data is not limited.

接着在步骤S920中,存储器管理电路1043将这多组数据暂存于缓冲存储器1047,并且当判断这多组数据符合预定条件后,将暂存于缓冲存储器1047的第一类数据及至少部分第二类数据同时编程至实体编程单元组,其是由n个实体编程单元所组成。其中,预定条件例如是当这多组数据的数据量到达实体编程单元组的容量及/或当存储器管理电路1043未接收到其他数据的时间超过时间临界值。Then in step S920, the memory management circuit 1043 temporarily stores the multiple sets of data in the buffer memory 1047, and when it is judged that the multiple sets of data meet the predetermined conditions, the first type of data and at least part of the first type of data temporarily stored in the buffer memory 1047 The second type of data is simultaneously programmed into the physical programming unit group, which is composed of n physical programming units. Wherein, the predetermined condition is, for example, when the data amount of the multiple sets of data reaches the capacity of the physical programming unit group and/or when the memory management circuit 1043 does not receive other data for a time exceeding a time threshold.

最后如步骤S930所示,存储器管理电路1043同时得知被编程的第一类数据及至少部分第二类数据的写入状态。Finally, as shown in step S930 , the memory management circuit 1043 simultaneously obtains the write status of the programmed first type data and at least part of the second type data.

综上所述,本发明所述的存储器、其存储控制器与数据写入方法能在主机系统欲写入一组第一类数据以及至少一组第二类数据的情况下,将上述数据先暂存在缓冲存储器,直到判定所暂存的数据符合预定条件之际,才将第一类数据与至少部分第二类数据一并编程至可复写式非易失性存储器模块,据此可提高整体数据写入的效率。并且,本发明所述的存储器、其存储控制器与数据写入方法能同时得知被编程的数据的写入状态,并于适当时机将对应的数个信息传送至主机系统以回应之前收到的数个写入指令,如此确保数据能被安全写入存储器,达到兼具效率高与数据可靠的效果。To sum up, the memory, its storage controller and data writing method described in the present invention can first write the above-mentioned data when the host system wants to write a set of first-type data and at least one set of second-type data. Temporarily stored in the buffer memory, until it is determined that the temporarily stored data meets the predetermined conditions, the first type of data and at least part of the second type of data are programmed into the rewritable non-volatile memory module, thereby improving the overall Data writing efficiency. Moreover, the memory, its storage controller and data writing method described in the present invention can know the writing status of programmed data at the same time, and send corresponding pieces of information to the host system at an appropriate time in response to the received Several write instructions, so as to ensure that the data can be safely written into the memory, achieving the effect of high efficiency and data reliability.

最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than limiting them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: It is still possible to modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the various embodiments of the present invention. scope.

Claims (18)

1.一种数据写入方法,用于一存储器,该存储器包括一缓冲存储器与一可复写式非易失性存储器模块,而该可复写式非易失性存储器模块具有多个实体擦除单元,且各该些实体擦除单元具有多个实体编程单元,其特征在于,包括:1. A data writing method, used for a memory, the memory includes a buffer memory and a rewritable non-volatile memory module, and the rewritable non-volatile memory module has a plurality of physical erasing units , and each of these physical erasing units has a plurality of physical programming units, characterized in that, including: 接收多组数据,其中该多组数据包含一组第一类数据及至少一组第二类数据,其中该第一类数据的容量小于一数据量临界值;receiving multiple sets of data, wherein the multiple sets of data include a set of first-type data and at least one set of second-type data, wherein the capacity of the first-type data is less than a data volume threshold; 将该多组数据暂存于该缓冲存储器,当判断该多组数据符合一预定条件后,将暂存于该缓冲存储器的该第一类数据及至少部分该第二类数据同时编程至一实体编程单元组,其中该实体编程单元组是由n个实体编程单元所组成,n为正整数;以及Temporarily storing the multiple sets of data in the buffer memory, and programming the first type of data temporarily stored in the buffer memory and at least part of the second type of data into an entity when it is judged that the multiple sets of data meet a predetermined condition A programming unit group, wherein the physical programming unit group is composed of n physical programming units, where n is a positive integer; and 同时得知该第一类数据及该至少部分第二类数据的写入状态。At the same time, the writing status of the first type of data and the at least part of the second type of data is obtained. 2.根据权利要求1所述的数据写入方法,其特征在于,当暂存在该缓冲存储器的该多组数据的数据量到达该实体编程单元组的容量时,判定该多组数据符合该预定条件。2. The data writing method according to claim 1, characterized in that, when the data volume of the multiple sets of data temporarily stored in the buffer memory reaches the capacity of the physical programming unit set, it is determined that the multiple sets of data meet the predetermined condition. 3.根据权利要求1所述的数据写入方法,其特征在于,当该存储器未接收到其他数据的时间超过一时间临界值时,判定该多组数据符合该预定条件。3. The data writing method according to claim 1, wherein when the memory does not receive other data for a time exceeding a time threshold, it is determined that the multiple sets of data meet the predetermined condition. 4.根据权利要求1所述的数据写入方法,其特征在于,各该些实体编程单元包括一数据记录区与一可用冗余区,而将暂存于该缓冲存储器的该第一类数据及该至少部分第二类数据同时编程至该实体编程单元组的步骤包括:4. The data writing method according to claim 1, wherein each of the physical programming units includes a data recording area and an available redundant area, and the first type of data temporarily stored in the buffer memory And the step of simultaneously programming at least part of the second type of data into the physical programming unit group includes: 将该第一类数据及该至少部分第二类数据写入至组成该实体编程单元组的该n个实体编程单元的该数据记录区;以及writing the first type of data and the at least part of the second type of data into the data recording area of the n physical programming units constituting the physical programming unit group; and 将该第一类数据及该至少部分第二类数据所个别对应的一逻辑存取地址及一扇区数量写入至组成该实体编程单元组的该n个实体编程单元的该可用冗余区。Writing a logical access address and a sector number respectively corresponding to the first type of data and the at least part of the second type of data into the available redundant area of the n physical programming units constituting the physical programming unit group . 5.根据权利要求4所述的数据写入方法,其特征在于,还包括:5. The data writing method according to claim 4, further comprising: 维护一对应表,以记录被编程至该实体编程单元组的该第一类数据及该至少部分第二类数据所个别对应的该逻辑存取地址及该扇区数量与该实体编程单元组的一对应关系;以及maintaining a correspondence table to record the logical access address and the number of sectors respectively corresponding to the first type of data programmed into the physical programming unit group and the at least part of the second type of data and the physical programming unit group one-to-one correspondence; and 将该对应表写入至该些实体擦除单元中的一特定实体擦除单元,其中该特定实体擦除单元所具有的实体编程单元均不属于该实体编程单元组。The correspondence table is written into a specific physical erasing unit among the physical erasing units, wherein none of the physical programming units of the specific physical erasing unit belongs to the physical programming unit group. 6.根据权利要求1所述的数据写入方法,其特征在于,该第一类数据及该至少部分第二类数据的写入状态被一并回复给发出该多组数据的一主机系统。6 . The data writing method according to claim 1 , wherein the writing states of the first type of data and the at least part of the second type of data are collectively returned to a host system that sends out the multiple sets of data. 7 . 7.一种存储控制器,以管理一可复写式非易失性存储器模块,其特征在于,包括:7. A storage controller, to manage a rewritable non-volatile memory module, is characterized in that, comprising: 一主机系统接口,用以电连接一主机系统;a host system interface for electrically connecting a host system; 一存储器接口,用以电连接该可复写式非易失性存储器模块,其中该可复写式非易失性存储器模块具有多个实体擦除单元,且各该些实体擦除单元具有多个实体编程单元;A memory interface for electrically connecting the rewritable non-volatile memory module, wherein the rewritable non-volatile memory module has a plurality of physical erasing units, and each of the physical erasing units has a plurality of physical erasing units programming unit; 一缓冲存储器;以及a buffer memory; and 一存储器管理电路,电连接至该主机系统接口、该存储器接口、该缓冲存储器,a memory management circuit electrically connected to the host system interface, the memory interface, and the buffer memory, 其中该存储器管理电路接收多组数据,其中该多组数据包含一组第一类数据及至少一组第二类数据,其中该第一类数据的容量小于一数据量临界值,Wherein the memory management circuit receives multiple sets of data, wherein the multiple sets of data include a set of first type data and at least one set of second type data, wherein the capacity of the first type of data is less than a data volume threshold, 该存储器管理电路将该多组数据暂存于该缓冲存储器,当判断该多组数据符合一预定条件后,将暂存于该缓冲存储器的该第一类数据及至少部分该第二类数据同时编程至一实体编程单元组,其中该实体编程单元组是由n个实体编程单元所组成,n为正整数,The memory management circuit temporarily stores the multiple sets of data in the buffer memory, and when judging that the multiple sets of data meet a predetermined condition, simultaneously stores the first type of data and at least part of the second type of data temporarily stored in the buffer memory Programming to a physical programming unit group, wherein the physical programming unit group is composed of n physical programming units, n is a positive integer, 该存储器管理电路同时得知该第一类数据及该至少部分第二类数据的写入状态。The memory management circuit simultaneously knows the writing status of the first type of data and the at least part of the second type of data. 8.根据权利要求7所述的存储控制器,其特征在于,当暂存在该缓冲存储器的该多组数据的数据量到达该实体编程单元组的容量时,该存储器管理电路判定该多组数据符合该预定条件。8. The storage controller according to claim 7, wherein when the data amount of the multiple sets of data temporarily stored in the buffer memory reaches the capacity of the physical programming unit group, the memory management circuit determines that the multiple sets of data meet the predetermined conditions. 9.根据权利要求7项所述的存储控制器,其特征在于,当该存储器管理电路未接收到其他数据的时间超过一时间临界值时,该存储器管理电路判定该多组数据符合该预定条件。9. The memory controller according to claim 7, wherein when the memory management circuit does not receive other data for a time exceeding a time threshold, the memory management circuit determines that the multiple sets of data meet the predetermined condition . 10.根据权利要求7项所述的存储控制器,其特征在于,各该些实体编程单元包括一数据记录区与一可用冗余区,而该存储器管理电路在将暂存于该缓冲存储器的该第一类数据及该至少部分第二类数据同时编程至该实体编程单元组时,将该第一类数据及该至少部分第二类数据写入至组成该实体编程单元组的该n个实体编程单元的该数据记录区,并将该第一类数据及该至少部分第二类数据所个别对应的一逻辑存取地址及一扇区数量写入至组成该实体编程单元组的该n个实体编程单元的该可用冗余区。10. The storage controller according to claim 7, wherein each of the physical programming units includes a data recording area and an available redundant area, and the memory management circuit temporarily stores the data in the buffer memory When the first type of data and the at least part of the second type of data are programmed into the physical programming unit group at the same time, the first type of data and the at least part of the second type of data are written into the n pieces of the physical programming unit group the data recording area of the physical programming unit, and write a logical access address and a sector number respectively corresponding to the first type of data and the at least part of the second type of data into the n of the physical programming unit group The available redundant area of a physical programming unit. 11.根据权利要求10所述的存储控制器,其特征在于,该存储器管理电路还用以维护一对应表,以记录被编程至该实体编程单元组的该第一类数据及该至少部分第二类数据所个别对应的该逻辑存取地址及该扇区数量与该实体编程单元组的一对应关系,并将该对应表写入至该些实体擦除单元中的一特定实体擦除单元,其中该特定实体擦除单元所具有的实体编程单元均不属于该实体编程单元组。11. The memory controller according to claim 10, wherein the memory management circuit is further used to maintain a correspondence table to record the first type of data and at least part of the first type of data programmed into the physical programming unit group A corresponding relationship between the logical access address and the number of sectors corresponding to the two types of data and the physical programming unit group, and writing the correspondence table into a specific physical erasing unit among the physical erasing units , wherein none of the physical programming units of the specific physical erasing unit belongs to the physical programming unit group. 12.根据权利要求7所述的存储控制器,其特征在于,该第一类数据及该至少部分第二类数据的写入状态被一并回复给发出该多组数据的该主机系统。12 . The storage controller according to claim 7 , wherein the writing statuses of the first type of data and the at least part of the second type of data are collectively returned to the host system that sent the multiple sets of data. 13 . 13.一种存储器,其特征在于,包括:13. A memory, characterized in that it comprises: 一可复写式非易失性存储器模块,包括多个实体擦除单元,且各该些实体擦除单元具有多个实体编程单元;A rewritable non-volatile memory module, including a plurality of physical erasing units, and each of the physical erasing units has a plurality of physical programming units; 一连接器,用以电连接一主机系统;以及a connector for electrically connecting to a host system; and 一存储控制器,电连接至该可复写式非易失性存储器模块与该连接器,该存储控制器包括一缓冲存储器,a storage controller electrically connected to the rewritable non-volatile memory module and the connector, the storage controller includes a buffer memory, 该存储控制器接收多组数据,其中该多组数据包含一组第一类数据及至少一组第二类数据,其中该第一类数据的容量小于一数据量临界值,The storage controller receives multiple sets of data, wherein the multiple sets of data include a set of first-type data and at least one set of second-type data, wherein the capacity of the first-type data is less than a data volume threshold, 该存储控制器将该多组数据暂存于该缓冲存储器,当判断该多组数据符合一预定条件后,将暂存于该缓冲存储器的该第一类数据及至少部分该第二类数据同时编程至一实体编程单元组,其中该实体编程单元组是由n个实体编程单元所组成,n为正整数,The storage controller temporarily stores the multiple sets of data in the buffer memory, and when judging that the multiple sets of data meet a predetermined condition, simultaneously stores the first type of data and at least part of the second type of data temporarily stored in the buffer memory Programming to a physical programming unit group, wherein the physical programming unit group is composed of n physical programming units, n is a positive integer, 该存储控制器同时得知该第一类数据及该至少部分第二类数据的写入状态。The storage controller simultaneously knows the writing status of the first type of data and the at least part of the second type of data. 14.根据权利要求13所述的存储器,其特征在于,当暂存在该缓冲存储器的该多组数据的数据量到达该实体编程单元组的容量时,该存储控制器判定该多组数据符合该预定条件。14. The memory according to claim 13, wherein when the amount of the multiple sets of data temporarily stored in the buffer memory reaches the capacity of the physical programming unit set, the storage controller determines that the multiple sets of data conform to the Booking conditions. 15.根据权利要求13所述的存储器,其特征在于,当该存储控制器未接收到其他数据的时间超过一时间临界值时,该存储控制器判定该多组数据符合该预定条件。15. The memory according to claim 13, wherein when the memory controller does not receive other data for a time exceeding a time threshold, the memory controller determines that the sets of data meet the predetermined condition. 16.根据权利要求13所述的存储器,其特征在于,各该些实体编程单元包括一数据记录区与一可用冗余区,而该存储控制器在将暂存于该缓冲存储器的该第一类数据及该至少部分第二类数据同时编程至该实体编程单元组时,将该第一类数据及该至少部分第二类数据写入至组成该实体编程单元组的该n个实体编程单元的该数据记录区,并将该第一类数据及该至少部分第二类数据所个别对应的一逻辑存取地址及一扇区数量写入至组成该实体编程单元组的该n个实体编程单元的该可用冗余区。16. The memory according to claim 13, wherein each of the physical programming units includes a data recording area and an available redundant area, and the memory controller will temporarily store the first memory in the buffer memory When the type data and the at least part of the second type data are programmed into the physical programming unit group at the same time, the first type of data and the at least part of the second type of data are written into the n physical programming units constituting the physical programming unit group the data recording area, and write a logical access address and a sector number respectively corresponding to the first type of data and the at least part of the second type of data into the n physical programming units that make up the physical programming unit group The usable redundancy area of the unit. 17.根据权利要求16所述的存储器,其特征在于,该存储控制器还用以维护一对应表,以记录被编程至该实体编程单元组的该第一类数据及该至少部分第二类数据所个别对应的该逻辑存取地址及该扇区数量与该实体编程单元组的一对应关系,并将该对应表写入至该些实体擦除单元中的一特定实体擦除单元,其中该特定实体擦除单元所具有的实体编程单元均不属于该实体编程单元组。17. The memory according to claim 16, wherein the memory controller is further used to maintain a correspondence table to record the first type of data and the at least part of the second type of data programmed into the physical programming unit group A corresponding relationship between the logical access address and the number of sectors corresponding to the data and the physical programming unit group, and writing the correspondence table into a specific physical erasing unit among the physical erasing units, wherein None of the physical programming units of the specific physical erasing unit belongs to the physical programming unit group. 18.根据权利要求13所述的存储器,其特征在于,该第一类数据及该至少部分第二类数据的写入状态被一并回复给发出该多组数据的该主机系统。18. The memory according to claim 13, wherein the write statuses of the first type of data and the at least part of the second type of data are collectively returned to the host system that sent the multiple sets of data.
CN201210514676.3A 2012-12-04 2012-12-04 Memory, its storage controller and data writing method Active CN103853666B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210514676.3A CN103853666B (en) 2012-12-04 2012-12-04 Memory, its storage controller and data writing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210514676.3A CN103853666B (en) 2012-12-04 2012-12-04 Memory, its storage controller and data writing method

Publications (2)

Publication Number Publication Date
CN103853666A CN103853666A (en) 2014-06-11
CN103853666B true CN103853666B (en) 2016-12-21

Family

ID=50861343

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210514676.3A Active CN103853666B (en) 2012-12-04 2012-12-04 Memory, its storage controller and data writing method

Country Status (1)

Country Link
CN (1) CN103853666B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI641988B (en) * 2017-07-21 2018-11-21 慧榮科技股份有限公司 Method for performing programming management in a memory device, and associated memory device and controller thereof
TWI698749B (en) * 2019-03-13 2020-07-11 慧榮科技股份有限公司 A data storage device and a data processing method

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102193747A (en) * 2010-03-03 2011-09-21 群联电子股份有限公司 Data writing method, rewritable nonvolatile memory controller and system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7173852B2 (en) * 2003-10-03 2007-02-06 Sandisk Corporation Corrected data storage and handling methods
US8266334B2 (en) * 2010-02-12 2012-09-11 Phison Electronics Corp. Data writing method for non-volatile memory, and controller and storage system using the same

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102193747A (en) * 2010-03-03 2011-09-21 群联电子股份有限公司 Data writing method, rewritable nonvolatile memory controller and system

Also Published As

Publication number Publication date
CN103853666A (en) 2014-06-11

Similar Documents

Publication Publication Date Title
TWI479492B (en) Memory storage device, memory controller thereof, and method for programming data thereof
TWI526830B (en) Data writing method, memory control circuit unit and memory storage apparatus
CN104765568B (en) Data storage method, memory control circuit unit and memory storage device
TWI569139B (en) Valid data merging method, memory controller and memory storage apparatus
TWI490871B (en) Method for preventing read-disturb, memory control circuit unit and memory storage apparatus
TWI479314B (en) Method of storing system data, and memory controller and memory storage apparatus using the same
CN105320464B (en) Method for preventing read interference, memory control circuit unit and memory device
TWI479315B (en) Memory storage device, memory controller thereof, and method for programming data thereof
CN106469122A (en) Effective data merging method, memory controller and memory storage device
CN104866429A (en) Memory management method, memory control circuit unit and memory storage device
US9383929B2 (en) Data storing method and memory controller and memory storage device using the same
TW201508748A (en) Data writing method, memory controller and memory storage apparatus
US20130332653A1 (en) Memory management method, and memory controller and memory storage device using the same
CN103678162B (en) System data storage method, memory controller and memory storage device
US9778862B2 (en) Data storing method for preventing data losing during flush operation, memory control circuit unit and memory storage apparatus
CN103914391A (en) Data reading method, memory controller and memory storage device
CN103544118B (en) Memory storage device, its memory controller and data writing method
TWI550625B (en) Memory management method, memory storage device and memory controlling circuit unit
CN103853666B (en) Memory, its storage controller and data writing method
CN103218308A (en) Buffer memory management method, memory controller and memory storage device
TWI541809B (en) Data accessing method, memory controlling circuit unit and memory storage apparatus
CN102855192B (en) Memory erasing method, memory controller and memory storage device
CN106920572A (en) Memory management method, memory control circuit unit and memory storage device
CN104598167A (en) Memory erasing method, memory controller and memory storage device
CN110389708A (en) Wear leveling method, memory control circuit unit, and memory storage device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant