TWI653630B - Method for accessing flash memory module and related flash memory controller and electronic device - Google Patents

Method for accessing flash memory module and related flash memory controller and electronic device Download PDF

Info

Publication number
TWI653630B
TWI653630B TW107116229A TW107116229A TWI653630B TW I653630 B TWI653630 B TW I653630B TW 107116229 A TW107116229 A TW 107116229A TW 107116229 A TW107116229 A TW 107116229A TW I653630 B TWI653630 B TW I653630B
Authority
TW
Taiwan
Prior art keywords
data
flash memory
memory module
piece
page
Prior art date
Application number
TW107116229A
Other languages
Chinese (zh)
Other versions
TW201947594A (en
Inventor
林銘彥
歐旭斌
Original Assignee
慧榮科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 慧榮科技股份有限公司 filed Critical 慧榮科技股份有限公司
Priority to TW107116229A priority Critical patent/TWI653630B/en
Priority to CN201810741559.8A priority patent/CN110489054B/en
Application granted granted Critical
Publication of TWI653630B publication Critical patent/TWI653630B/en
Publication of TW201947594A publication Critical patent/TW201947594A/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Abstract

本發明揭露了一種存取一快閃記憶體模組的方法,包含有以下步驟:自一主裝置接收一第一筆資料;自該快閃記憶體模組中讀取一特定資料,並將該第一筆資料連同該特定資料暫存在一緩衝記憶體中後寫入至該快閃記憶體模組中的一第一資料頁;自該主裝置接收一第二筆資料;判斷該第二筆資料與該第一筆資料是否具有連續的邏輯位址;以及若是該第二筆資料與該第一筆資料具有連續的邏輯位址,在不讀取該快閃記憶體模組的情形下,將該第二筆資料連同暫存在該緩衝記憶體的該第一筆資料與該特定資料的一部份寫入至該快閃記憶體模組中的一第二資料頁。 The invention discloses a method for accessing a flash memory module, including the following steps: receiving a first piece of data from a main device; reading a specific data from the flash memory module, and The first data and the specific data are temporarily stored in a buffer memory and then written to a first data page in the flash memory module; receiving a second data from the host device; judging the second Whether the pen data and the first piece of data have consecutive logical addresses; and if the second piece of data and the first piece of data have consecutive logical addresses, without reading the flash memory module Writing the second data together with a portion of the first data and the specific data temporarily stored in the buffer memory to a second data page in the flash memory module.

Description

存取快閃記憶體模組的方法及相關的快閃記憶體控制器 及電子裝置 Method for accessing flash memory module and related flash memory controller And electronic devices

本發明係有關於快閃記憶體,尤指一種存取快閃記憶體模組的方法及相關的快閃記憶體控制器及電子裝置。 The present invention relates to flash memory, in particular to a method for accessing flash memory modules and related flash memory controllers and electronic devices.

在快閃記憶體模組的存取中,其特性是在於在資料寫入時是以資料頁(page)為單位,而資料抹除則是以區塊(block)為單位來進行。因此,若是寫入資料的邏輯位址並非位於資料頁的起始邏輯位址,則快閃記憶體控制器必需對此寫入資料補上頭尾的資料,之後才能寫入至快閃記憶體模組之中。舉例來說,假設一資料頁的大小為16千位元組(16KB),其可被區分為4個區段(sector),而寫入資料是用來更新該資料頁的第二個區段,則快閃記憶體控制器必需要將該資料頁的第一、三、四的區段的內容從快閃記憶體模組中讀出來,再連同寫入資料一併寫入至另一個資料頁中。如上所述,由於需要另外讀取快閃記憶體的內容來對寫入資料補上頭尾的資料,故會降低存取快閃記憶體的效率。此外,隨著近年來資料頁的大小越來越大的趨勢,欲寫入的資料對齊資料頁的起始邏輯位址的機率也越來越小,同時,補上頭尾資料的長度也隨之增加。 In the access of the flash memory module, the characteristic is that the data is written in units of pages, and the data erasing is performed in units of blocks. Therefore, if the logical address of the written data is not at the starting logical address of the data page, the flash memory controller must supplement the written data with the head and tail data before writing to the flash memory In the module. For example, assuming that the size of a data page is 16 kilobytes (16KB), it can be divided into 4 sectors, and writing data is used to update the second sector of the data page , Then the flash memory controller must read the contents of the first, third, and fourth sections of the data page from the flash memory module, and write it to another data together with the written data Page. As described above, since the content of the flash memory needs to be read separately to supplement the head and tail data of the written data, the efficiency of accessing the flash memory is reduced. In addition, with the trend of increasing size of data pages in recent years, the probability that the data to be written is aligned with the starting logical address of the data page is getting smaller and smaller, and at the same time, the length of the top and bottom data is also increased. Increase.

另一方面,針對某些具有較小緩衝記憶體電子裝置,例如行車紀錄器或是一些錄影裝置,通常會將一筆很大的連續性資料(例如,一百萬位元組)切割為多筆的小資料(例如,四千位元組),然而,這些多筆的小資料在每次寫入時都需要進行上述補上頭尾資料的操作,故快閃記憶體效能更會嚴重地降低。 On the other hand, for some electronic devices with small buffer memory, such as driving recorders or some recording devices, usually a large continuous data (for example, one million bytes) is cut into multiple Small data (for example, four thousand bytes), however, these multiple small data need to perform the above operation to fill the head and tail data each time it is written, so the performance of the flash memory will be seriously reduced .

因此,本發明的目的之一在於提供一種存取快閃記憶體模組的方法,其可以大幅降低上述需要讀取快閃記憶體模組來補上頭尾資料的次數,提升快閃記憶體效能,以解決先前技術中的問題。 Therefore, one of the objects of the present invention is to provide a method for accessing a flash memory module, which can greatly reduce the number of times that the flash memory module needs to be read to fill in the head and tail data and improve the flash memory Effectiveness to solve the problems in the prior art.

在本發明的一個實施例中,揭露了一種存取一快閃記憶體模組的方法,其中該快閃記憶體模組包含多個區塊,每一個區塊包含多個資料頁,且該方法包含有以下步驟:自一主裝置接收一第一筆資料;自該快閃記憶體模組中一特定資料頁中讀取特定資料,並將該第一筆資料連同該特定資料暫存在一緩衝記憶體中;將該第一筆資料連同該特定資料寫入至該快閃記憶體模組中的一第一資料頁;自該主裝置接收一第二筆資料;判斷該第二筆資料與該第一筆資料是否具有連續的邏輯位址以產生一判斷結果;以及若是該判斷結果指出該第二筆資料與該第一筆資料具有連續的邏輯位址,在不讀取該快閃記憶體模組的情形下,將該第二筆資料連同暫存在該緩衝記憶體的該第一筆資料與該特定資料的一部份寫入至該快閃記憶體模組中的一第二資料頁。 In one embodiment of the present invention, a method for accessing a flash memory module is disclosed, wherein the flash memory module includes a plurality of blocks, each block includes a plurality of data pages, and the The method includes the following steps: receiving a first data from a main device; reading specific data from a specific data page in the flash memory module, and temporarily storing the first data together with the specific data in a Buffer memory; write the first data together with the specific data to a first data page in the flash memory module; receive a second data from the host device; determine the second data Whether there is a continuous logical address with the first piece of data to produce a judgment result; and if the judgment result indicates that the second piece of data and the first piece of data have consecutive logical addresses, the flash is not read In the case of a memory module, the second data together with a portion of the first data and the specific data temporarily stored in the buffer memory is written to a second in the flash memory module Information page.

在本發明的另一個實施例中,揭露了一種快閃記憶體控制器,其中該快閃記憶體控制器係用來存取一快閃記憶體模組,該快閃記憶體模組包含多 個區塊,每一個區塊包含多個資料頁,且該快閃記憶體控制器包含有一唯讀記憶體以及一微處理器。該唯讀記憶體係用來儲存一程式碼,且該微處理器用來執行該程式碼以控制對該快閃記憶體模組之存取。在該快閃記憶體控制器的操作中,當該微處理器自一主裝置接收一第一筆資料時,該微處理器自該快閃記憶體模組中一特定資料頁中讀取特定資料,並將該第一筆資料連同該特定資料暫存在一緩衝記憶體中,以及將該第一筆資料連同該特定資料寫入至該快閃記憶體模組中的一第一資料頁;以及當該微處理器自該主裝置接收一第二筆資料時,該微處理器判斷該第二筆資料與該第一筆資料是否具有連續的邏輯位址以產生一判斷結果,且若是該判斷結果指出該第二筆資料與該第一筆資料具有連續的邏輯位址,在不讀取該快閃記憶體模組的情形下,該微處理器將該第二筆資料連同暫存在該緩衝記憶體的該第一筆資料與該特定資料的一部份寫入至該快閃記憶體模組中的一第二資料頁。 In another embodiment of the present invention, a flash memory controller is disclosed, wherein the flash memory controller is used to access a flash memory module, the flash memory module includes multiple Each block contains multiple data pages, and the flash memory controller includes a read-only memory and a microprocessor. The read-only memory system is used to store a code, and the microprocessor is used to execute the code to control access to the flash memory module. In the operation of the flash memory controller, when the microprocessor receives a first data from a host device, the microprocessor reads a specific data from a specific data page in the flash memory module Data, and temporarily store the first data and the specific data in a buffer memory, and write the first data and the specific data to a first data page in the flash memory module; And when the microprocessor receives a second piece of data from the host device, the microprocessor determines whether the second piece of data and the first piece of data have consecutive logical addresses to generate a judgment result, and if it is the The judgment result indicates that the second piece of data and the first piece of data have consecutive logical addresses. Without reading the flash memory module, the microprocessor temporarily stores the second piece of data together with the A part of the first data and the specific data of the buffer memory is written to a second data page in the flash memory module.

在本發明的另一個實施例中,揭露了一種電子裝置,其包含有一快閃記憶體模組以及一快閃記憶體控制器。在該電子裝置的操作中,當該快閃記憶體控制器自一主裝置接收一第一筆資料時,該快閃記憶體控制器自該快閃記憶體模組中一特定資料頁中讀取特定資料,並將該第一筆資料連同該特定資料暫存在一緩衝記憶體中,以及將該第一筆資料連同該特定資料寫入至該快閃記憶體模組中的一第一資料頁;以及當該快閃記憶體控制器自該主裝置接收一第二筆資料時,該快閃記憶體控制器判斷該第二筆資料與該第一筆資料是否具有連續的邏輯位址以產生一判斷結果,且若是該判斷結果指出該第二筆資料與該第一筆資料具有連續的邏輯位址,在不讀取該快閃記憶體模組的情形下,該快閃記憶體控制器將該第二筆資料連同暫存在該緩衝記憶體的該第一筆資料與該特定資料的一部份寫入至該快閃記憶體模組中的一第二資料頁。 In another embodiment of the present invention, an electronic device is disclosed, which includes a flash memory module and a flash memory controller. In the operation of the electronic device, when the flash memory controller receives a first piece of data from a host device, the flash memory controller reads from a specific data page in the flash memory module Fetch specific data, and temporarily store the first data and the specific data in a buffer memory, and write the first data and the specific data to a first data in the flash memory module Page; and when the flash memory controller receives a second piece of data from the host device, the flash memory controller determines whether the second piece of data and the first piece of data have consecutive logical addresses Generates a judgment result, and if the judgment result indicates that the second piece of data and the first piece of data have consecutive logical addresses, without reading the flash memory module, the flash memory controls The device writes the second data together with the first data temporarily stored in the buffer memory and a part of the specific data to a second data page in the flash memory module.

110‧‧‧快閃記憶體控制器 110‧‧‧Flash memory controller

112‧‧‧微處理器 112‧‧‧Microprocessor

112C‧‧‧程式碼 112C‧‧‧Code

112M‧‧‧唯讀記憶體 112M‧‧‧Read-only memory

114‧‧‧控制邏輯 114‧‧‧Control logic

116‧‧‧緩衝記憶體 116‧‧‧buffer memory

118‧‧‧介面邏輯 118‧‧‧Interface logic

120‧‧‧快閃記憶體模組 120‧‧‧Flash memory module

130‧‧‧主裝置 130‧‧‧Main device

132‧‧‧編碼器 132‧‧‧Encoder

134‧‧‧解碼器 134‧‧‧decoder

202‧‧‧特定資料頁 202‧‧‧Specific information page

210、220、230、240‧‧‧資料頁 210, 220, 230, 240 ‧‧‧ data page

D1~D4‧‧‧資料 D1 ~ D4‧‧‧Information

D1’‧‧‧第一筆資料 D1’‧‧‧ First document

D2’‧‧‧第二筆資料 D2’‧‧‧ Second data

D3’‧‧‧第三筆資料 D3’‧‧‧ Third data

D4’‧‧‧第四筆資料 D4’‧‧‧ Fourth data

第1圖為依據本發明一實施例之一種記憶裝置的示意圖。 FIG. 1 is a schematic diagram of a memory device according to an embodiment of the invention.

第2圖為根據本發明一實施例之主裝置將多筆資料寫入至記憶裝置的示意圖。 FIG. 2 is a schematic diagram of a host device writing multiple data to a memory device according to an embodiment of the invention.

第1圖為依據本發明一實施例之一種記憶裝置100的示意圖。記憶裝置100包含有一快閃記憶體(Flash Memory)模組120以及一快閃記憶體控制器110,且快閃記憶體控制器110用來存取快閃記憶體模組120。依據本實施例,快閃記憶體控制器110包含一微處理器112、一唯讀記憶體(Read Only Memory,ROM)112M、一控制邏輯114、一緩衝記憶體116、與一介面邏輯118。唯讀記憶體112M係用來儲存一程式碼112C,而微處理器112則用來執行程式碼112C以控制對快閃記憶體模組120之存取(Access)。控制邏輯114包含了一編碼器132以及一解碼器134,其中編碼器132用來對寫入到快閃記憶體模組120中的資料進行編碼以產生對應的校驗碼(或稱,錯誤更正碼(Error Correction Code),ECC),而解碼器134用來將從快閃記憶體模組120所讀出的資料進行解碼。 FIG. 1 is a schematic diagram of a memory device 100 according to an embodiment of the invention. The memory device 100 includes a flash memory module 120 and a flash memory controller 110, and the flash memory controller 110 is used to access the flash memory module 120. According to this embodiment, the flash memory controller 110 includes a microprocessor 112, a read only memory (Read Only Memory, ROM) 112M, a control logic 114, a buffer memory 116, and an interface logic 118. The read-only memory 112M is used to store a program code 112C, and the microprocessor 112 is used to execute the program code 112C to control access to the flash memory module 120 (Access). The control logic 114 includes an encoder 132 and a decoder 134, wherein the encoder 132 is used to encode the data written into the flash memory module 120 to generate a corresponding check code (or error correction) Error Correction Code (ECC), and the decoder 134 is used to decode the data read from the flash memory module 120.

於典型狀況下,快閃記憶體模組120包含了多個快閃記憶體晶片,而每一個快閃記憶體晶片包含複數個區塊(Block),而快閃記憶體控制器110對快閃記憶體模組120進行抹除資料運作係以區塊為單位來進行。另外,一區塊可記錄特定數量的資料頁(Page),其中快閃記憶體控制器110對快閃記憶體模組120進行寫入資料之運作係以資料頁為單位來進行寫入。在本實施例中,快閃記憶 體模組120為一立體NAND型快閃記憶體(3D NAND-type flash)模組。 Under typical conditions, the flash memory module 120 includes a plurality of flash memory chips, and each flash memory chip includes a plurality of blocks, and the flash memory controller 110 controls the flash memory. The operation of erasing data by the memory module 120 is performed in units of blocks. In addition, a block can record a specific number of data pages (Page), wherein the operation of the flash memory controller 110 writing data to the flash memory module 120 is performed in units of data pages. In this embodiment, flash memory The body module 120 is a 3D NAND-type flash memory (3D NAND-type flash) module.

實作上,透過微處理器112執行程式碼112C之快閃記憶體控制器110可利用其本身內部之元件來進行諸多控制運作,例如:利用控制邏輯114來控制快閃記憶體模組120之存取運作(尤其是對至少一區塊或至少一資料頁之存取運作)、利用緩衝記憶體116進行所需之緩衝處理、以及利用介面邏輯118來與一主裝置(Host Device)130溝通。緩衝記憶體116係以隨機存取記憶體(Random Access Memory,RAM)來實施。例如,緩衝記憶體116可以是靜態隨機存取記憶體(Static RAM,SRAM),但本發明不限於此。 In practice, the flash memory controller 110 that executes the program code 112C through the microprocessor 112 can use its own internal components to perform many control operations, such as: using the control logic 114 to control the flash memory module 120 Access operations (especially access operations on at least one block or at least one data page), using buffer memory 116 for required buffer processing, and using interface logic 118 to communicate with a host device (Host Device) 130 . The buffer memory 116 is implemented by random access memory (Random Access Memory, RAM). For example, the buffer memory 116 may be static random access memory (Static RAM, SRAM), but the invention is not limited thereto.

在一實施例中,記憶裝置100可以是可攜式記憶裝置(例如:符合SD/MMC、CF、MS、XD標準之記憶卡),且主裝置130為一可與記憶裝置連接的電子裝置,例如手機、筆記型電腦、桌上型電腦...等等。而在另一實施例中,記憶裝置100可以是固態硬碟或符合通用快閃記憶體儲存(Universal Flash Storage,UFS)或嵌入式多媒體記憶卡(Embedded Multi Media Card,EMMC)規格之嵌入式儲存裝置,以設置在一電子裝置中,例如設置在手機、筆記型電腦、桌上型電腦、錄影裝置或行車紀錄器之中,而此時主裝置130可以是該電子裝置的一處理器。 In an embodiment, the memory device 100 may be a portable memory device (for example, a memory card that conforms to SD / MMC, CF, MS, XD standards), and the host device 130 is an electronic device that can be connected to the memory device. For example, mobile phones, notebook computers, desktop computers ... and so on. In another embodiment, the memory device 100 may be a solid-state drive or an embedded storage that conforms to Universal Flash Storage (UFS) or Embedded Multi Media Card (EMMC) specifications The device may be installed in an electronic device, such as a mobile phone, a notebook computer, a desktop computer, a video recording device, or a driving recorder, and the main device 130 may be a processor of the electronic device.

第2圖為根據本發明一實施例之主裝置130將多筆資料寫入至記憶裝置100的示意圖,其中本實施例以分別對應到不同寫入命令的四筆資料D1’~D4’為例來進行說明,且四筆資料D1’~D4’的大小均為4KB,而快閃記憶體模組中每一個資料頁的大小則是16KB。在記憶裝置100的操作中,快閃記憶體控制器110根據一第一寫入命令自主裝置130接收第一筆資料D1’,接著,快閃記憶體控制 器110自快閃記憶體模組120中一特定區塊的一特定資料頁202中讀取資料D2~D4,並將第一筆資料D1’連同取資料D2~D4暫存在緩衝記憶體116中,之後再將第一筆資料D1’連同資料D2~D4寫入至快閃記憶體模組120中一區塊的一第一資料頁210。在本實施例中,第一筆資料D1’與特定資料頁202內的資料D1具有相同的邏輯位址(即,相同的邏輯資料頁),亦即第一筆資料D1’是用來更新資料D1的內容,但本發明並不以此為限。 FIG. 2 is a schematic diagram of the main device 130 writing multiple pieces of data to the memory device 100 according to an embodiment of the present invention, in which four pieces of data D1 ′ ~ D4 ′ corresponding to different write commands are taken as an example in this embodiment To illustrate, the size of the four data D1 '~ D4' is 4KB, and the size of each data page in the flash memory module is 16KB. During the operation of the memory device 100, the flash memory controller 110 receives the first data D1 'from the autonomous device 130 according to a first write command. Then, the flash memory controls The device 110 reads data D2 ~ D4 from a specific data page 202 of a specific block in the flash memory module 120, and temporarily stores the first data D1 'together with the retrieved data D2 ~ D4 in the buffer memory 116 , And then write the first data D1 'together with the data D2 ~ D4 to a first data page 210 of a block in the flash memory module 120. In this embodiment, the first data D1 'and the data D1 in the specific data page 202 have the same logical address (ie, the same logical data page), that is, the first data D1' is used to update the data The content of D1, but the invention is not limited to this.

接著,快閃記憶體控制器110根據一第二寫入命令自主裝置130接收第二筆資料D2’,此時微處理器112會判斷第二筆資料D2’與第一筆資料D1’是否具有連續的邏輯位址,在本實施例中係假設第二筆資料D2’與第一筆資料D1’具有連續的邏輯位址,因此微處理器112便直接使用第二筆資料D2’來更新目前暫存在緩衝記憶體116的資料D2,亦即緩衝記憶體116內所暫存的變為第一筆資料D1’、第二筆資料D2’以及之前從特定資料頁202所讀取的資料D3、D4。之後再將第一筆資料D1’、第二筆資料D2’連同資料D3、D4寫入至快閃記憶體模組120中該區塊的一第二資料頁220。需注意的是,在快閃記憶體控制器110自主裝置130接收第二筆資料D2’並將第二筆資料D2’寫入到快閃記憶體模組120的過程中,快閃記憶體控制器110會直接利用暫存在緩衝記憶體116的內容來對第二筆資料D2’進行補充頭尾資料的操作,亦即使用暫存在緩衝記憶體116的第一筆資料D1’來補充在第二筆資料D2’的前方,並使用暫存在緩衝記憶體116的資料D3、D4來補在第二筆資料D2’的後方,以構成一個完整資料頁的大小(即,16KB);此時快閃記憶體控制器110並不會讀取快閃記憶體模組120中的資料來對第二筆資料D2’進行補充頭尾資料的操作,以增進快閃記憶體控制器110的效率。 Then, the flash memory controller 110 receives the second data D2 'from the autonomous device 130 according to a second write command. At this time, the microprocessor 112 determines whether the second data D2' and the first data D1 'have Continuous logical addresses. In this embodiment, it is assumed that the second data D2 'and the first data D1' have continuous logical addresses, so the microprocessor 112 directly uses the second data D2 'to update the current The data D2 temporarily stored in the buffer memory 116, that is, the data temporarily stored in the buffer memory 116 becomes the first data D1 ', the second data D2', and the data D3 previously read from the specific data page 202, D4. Then, the first data D1 'and the second data D2' are written into a second data page 220 of the block in the flash memory module 120 together with the data D3 and D4. It should be noted that during the flash memory controller 110, the autonomous device 130 receives the second data D2 'and writes the second data D2' to the flash memory module 120, the flash memory controls The device 110 directly uses the contents of the temporary buffer memory 116 to supplement the head and tail data of the second data D2 ', that is, the first data D1' temporarily stored in the buffer memory 116 is used to supplement the second data D2 '. In front of the pen data D2 ', and use the data D3 and D4 temporarily stored in the buffer memory 116 to fill in the back of the second pen data D2' to form a complete data page size (ie, 16KB); flash at this time The memory controller 110 does not read the data in the flash memory module 120 to supplement the head and tail data of the second data D2 ', so as to improve the efficiency of the flash memory controller 110.

接著,快閃記憶體控制器110根據一第三寫入命令自主裝置130接收 第三筆資料D3’,此時微處理器112會判斷第三筆資料D3’與第二筆資料D2’是否具有連續的邏輯位址,在本實施例中係假設第三筆資料D3’與第二筆資料D2’具有連續的邏輯位址,因此微處理器112便直接使用第三筆資料D3’來更新目前暫存在緩衝記憶體116的資料D3,亦即緩衝記憶體116內所暫存的變為第一筆資料D1’、第二筆資料D2’、第三筆資料D3’及之前從特定資料頁202所讀取的資料D4。之後再將第一筆資料D1’、第二筆資料D2’、第三筆資料D3’連同資料D4寫入至快閃記憶體模組120中該區塊的一第三資料頁230。需注意的是,在快閃記憶體控制器110自主裝置130接收第三筆資料D3’並將第三筆資料D3’寫入到快閃記憶體模組120的過程中,快閃記憶體控制器110會直接利用暫存在緩衝記憶體116的內容來對第三筆資料D3’進行補充頭尾資料的操作,亦即使用暫存在緩衝記憶體116的第一筆資料D1’及第二筆資料D2’補充在第三筆資料D3’的前方,並使用暫存在緩衝記憶體116的資料D4來補在第三筆資料D3’的後方,以構成一個完整資料頁的大小(即,16KB);此時快閃記憶體控制器110並不會讀取快閃記憶體模組120中的資料來對第三筆資料D3’進行補充頭尾資料的操作。 Then, the flash memory controller 110 receives the autonomous device 130 according to a third write command The third piece of data D3 ', at this time the microprocessor 112 will determine whether the third piece of data D3' and the second piece of data D2 'have consecutive logical addresses. In this embodiment, it is assumed that the third piece of data D3' and The second data D2 'has a continuous logical address, so the microprocessor 112 directly uses the third data D3' to update the data D3 currently stored in the buffer memory 116, that is, the data temporarily stored in the buffer memory 116 Becomes the first data D1 ', the second data D2', the third data D3 'and the previously read data D4 from the specific data page 202. Then, the first data D1 ', the second data D2', the third data D3 ', and the data D4 are written to a third data page 230 of the block in the flash memory module 120. It should be noted that during the flash memory controller 110, the autonomous device 130 receives the third data D3 'and writes the third data D3' to the flash memory module 120, the flash memory controls The device 110 directly uses the content of the temporary buffer memory 116 to supplement the head and tail data of the third piece of data D3 ', that is, uses the first piece of data D1' and the second piece of data temporarily stored in the buffer memory 116 D2 'is added in front of the third data D3', and the data D4 temporarily stored in the buffer memory 116 is used to fill in the back of the third data D3 'to form a complete data page size (ie, 16KB); At this time, the flash memory controller 110 does not read the data in the flash memory module 120 to supplement the head and tail data of the third data D3 '.

最後,快閃記憶體控制器110根據一第四寫入命令自主裝置130接收第四筆資料D4’,此時微處理器112會判斷第四筆資料D4’與第三筆資料D3’是否具有連續的邏輯位址,在本實施例中係假設第四筆資料D4’與第三筆資料D3’具有連續的邏輯位址,因此微處理器112便直接使用第四筆資料D4’來更新目前暫存在緩衝記憶體116的資料D4,亦即緩衝記憶體116內所暫存的變為第一筆資料D1’、第二筆資料D2’、第三筆資料D3’及第四筆資料D4’。之後再將第一筆資料D1’、第二筆資料D2’、第三筆資料D3及第四筆資料D4’寫入至快閃記憶體模組120中該區塊的一第四資料頁240。需注意的是,在快閃記憶體控制器110自主裝置130接收第四筆資料D4’並將第四筆資料D4’寫入到快閃記憶體模組120的過程 中,快閃記憶體控制器110會直接利用暫存在緩衝記憶體116的內容來對第四筆資料D4’進行補充頭尾資料的操作,亦即使用暫存在緩衝記憶體116的第一筆資料D1’、第二筆資料D2’及第三筆資料D3’補充在第三筆資料D3’的前方,以構成一個完整資料頁的大小(即,16KB);此時快閃記憶體控制器110並不會讀取快閃記憶體模組120中的資料來對第四筆資料D4’進行補充頭尾資料的操作。 Finally, the flash memory controller 110 receives the fourth data D4 'from the autonomous device 130 according to a fourth write command. At this time, the microprocessor 112 determines whether the fourth data D4' and the third data D3 'have Continuous logical addresses. In this embodiment, it is assumed that the fourth data D4 'and the third data D3' have continuous logical addresses, so the microprocessor 112 directly uses the fourth data D4 'to update the current The data D4 temporarily stored in the buffer memory 116, that is, the data temporarily stored in the buffer memory 116 becomes the first data D1 ', the second data D2', the third data D3 ', and the fourth data D4' . Then write the first data D1 ', the second data D2', the third data D3 and the fourth data D4 'to a fourth data page 240 of the block in the flash memory module 120 . It should be noted that in the flash memory controller 110, the autonomous device 130 receives the fourth data D4 'and writes the fourth data D4' to the flash memory module 120 In the process, the flash memory controller 110 directly uses the content of the temporary buffer memory 116 to supplement the head and tail data of the fourth data D4 ', that is, the first data temporarily stored in the buffer memory 116 is used. D1 ', the second data D2' and the third data D3 'are added in front of the third data D3' to form a complete data page size (ie, 16KB); at this time, the flash memory controller 110 The data in the flash memory module 120 is not read to supplement the head and tail data of the fourth data D4 '.

如上所述,當快閃記憶體控制器110判斷自主裝置所接收到的資料具有連續的邏輯位址時,本實施例的快閃記憶體控制器110會在不讀取快閃記憶體模組120的情形下,直接使用暫存在緩衝記憶體116中的資料來進行補充頭尾資料的操作,因此可以增進快閃記憶體控制器110的效率。 As described above, when the flash memory controller 110 determines that the data received by the autonomous device has continuous logical addresses, the flash memory controller 110 of this embodiment does not read the flash memory module In the case of 120, the data temporarily stored in the buffer memory 116 is directly used to supplement the head and tail data, so the efficiency of the flash memory controller 110 can be improved.

需注意的是,本發明的主要概念是當快閃記憶體控制器110判斷所接收到的資料具有連續的邏輯位址時,會採用第2圖實施例所述的方法,以在盡可能不存取快閃記憶體模組120的情形下,直接使用暫存在緩衝記憶體116的內容來對要寫入的資料進行補充頭尾資料的操作。以上有關於第2圖的細節內容僅是作為範例說明,而非是作為本發明的限制。具體來說,第2圖所示的資料頁210、220、230、240可以位於相同的區塊或是不同的區塊、寫入的資料可以直接使用儲存在緩衝記憶體116內的資料而不需要在緩衝記憶體116中更新原有的資料、或是資料頁210、220、230、240中有部分資料頁可以一併寫入至快閃記憶體模組120而不必然要分批寫入,這些設計上的變化均應隸屬於本發明的範疇。 It should be noted that the main concept of the present invention is that when the flash memory controller 110 determines that the received data has continuous logical addresses, the method described in the embodiment of FIG. 2 will be used to In the case of accessing the flash memory module 120, the contents of the temporary buffer memory 116 are directly used to supplement the head-to-tail data of the data to be written. The above details about FIG. 2 are only for illustration, not for limitation of the present invention. Specifically, the data pages 210, 220, 230, and 240 shown in FIG. 2 can be located in the same block or different blocks. The written data can directly use the data stored in the buffer memory 116 without It is necessary to update the original data in the buffer memory 116, or some of the data pages in the data pages 210, 220, 230, 240 can be written to the flash memory module 120 together without necessarily writing in batches All of these design changes should belong to the scope of the present invention.

此外,當快閃記憶體控制器110判斷來自主裝置的一筆寫入資料與前一筆寫入資料具有不連續的邏輯位址時,該筆寫入資料的寫入方式則類似第2圖中寫入第一筆資料D1’的方式,亦即會先自另一個特定資料頁中讀取部分資料來 做補充頭尾資料的操作,之後再寫入到快閃記憶體模組120中。 In addition, when the flash memory controller 110 determines that the write data from the master device and the previous write data have discontinuous logical addresses, the write method of the write data is similar to the write in Figure 2 Into the first data D1 ', that is, some data will be read from another specific data page first The operation of supplementing the head and tail data is performed and then written into the flash memory module 120.

簡要歸納本發明,在本發明的存取快閃記憶體模組的方法,在寫入至快閃記憶體模組中的資料被判斷是連續時,可以直接使用暫存在緩衝記憶體的資料來進行補充頭尾資料的操作,因此可以大幅降低需要讀取快閃記憶體模組來補上頭尾資料的次數,提升快閃記憶體效能。以上所述僅為本發明之較佳實施例,凡依本發明申請專利範圍所做之均等變化與修飾,皆應屬本發明之涵蓋範圍。 To briefly summarize the present invention, in the method for accessing a flash memory module of the present invention, when the data written to the flash memory module is determined to be continuous, the data temporarily stored in the buffer memory can be used directly The operation of replenishing the head and tail data can greatly reduce the number of times the flash memory module needs to be read to fill in the head and tail data and improve the performance of the flash memory. The above are only the preferred embodiments of the present invention, and all changes and modifications made in accordance with the scope of the patent application of the present invention shall fall within the scope of the present invention.

Claims (10)

一種存取一快閃記憶體模組的方法,其中該快閃記憶體模組包含多個區塊,每一個區塊包含多個資料頁,且該方法包含有:自一主裝置接收一第一筆資料;自該快閃記憶體模組中一特定資料頁中讀取特定資料,並將該第一筆資料連同該特定資料暫存在一緩衝記憶體中;將該第一筆資料連同該特定資料寫入至該快閃記憶體模組中的一第一資料頁;自該主裝置接收一第二筆資料;判斷該第二筆資料與該第一筆資料是否具有連續的邏輯位址以產生一判斷結果;以及若是該判斷結果指出該第二筆資料與該第一筆資料具有連續的邏輯位址,在不讀取該快閃記憶體模組的情形下,將該第二筆資料連同暫存在該緩衝記憶體的該第一筆資料與該特定資料的一部份寫入至該快閃記憶體模組中的一第二資料頁。A method for accessing a flash memory module, wherein the flash memory module includes a plurality of blocks, each block includes a plurality of data pages, and the method includes: receiving a first A piece of data; read specific data from a specific data page in the flash memory module, and temporarily store the first data together with the specific data in a buffer memory; the first data together with the Write specific data to a first data page in the flash memory module; receive a second data from the host device; determine whether the second data and the first data have consecutive logical addresses To produce a judgment result; and if the judgment result indicates that the second piece of data and the first piece of data have consecutive logical addresses, the second piece of data is read without reading the flash memory module The data together with the first data temporarily stored in the buffer memory and a part of the specific data is written to a second data page in the flash memory module. 如申請專利範圍第1項所述之方法,其中將該第二筆資料連同暫存在該緩衝記憶體的該第一筆資料與該特定資料的該部份寫入至該快閃記憶體模組中的該第二資料頁的步驟包含有:直接使用該第二筆資料來更新暫存在該緩衝記憶體中的該特定資料,並將暫存在該緩衝記憶體的該第一筆資料與使用該第二筆資料更新後的該特定資料寫入至該快閃記憶體模組中的該第二資料頁。The method as described in item 1 of the patent application scope, wherein the second data together with the first data temporarily stored in the buffer memory and the part of the specific data is written to the flash memory module The steps of the second data page in include: directly use the second data to update the specific data temporarily stored in the buffer memory, and store the first data temporarily stored in the buffer memory and use the The specific data after the second data update is written to the second data page in the flash memory module. 如申請專利範圍第1項所述之方法,另包含有:若是該判斷結果指出該第二筆資料與該第一筆資料具有不連續的邏輯位址:自該快閃記憶體模組中另一特定資料頁中讀取另一特定資料,並將該二筆資料連同該另一特定資料暫存在該緩衝記憶體中;以及將該第二筆資料連同該另一特定資料寫入至該快閃記憶體模組中的該第二資料頁。The method as described in item 1 of the patent application scope also includes: if the judgment result indicates that the second piece of data and the first piece of data have a discontinuous logical address: from the flash memory module Reading another specific data from a specific data page, and temporarily storing the two data together with the other specific data in the buffer memory; and writing the second data together with the other specific data to the flash The second data page in the flash memory module. 如申請專利範圍第1項所述之方法,其中判斷該第二筆資料與該第一筆資料是否具有連續的邏輯位址以產生該判斷結果的步驟包含有:判斷該第二筆資料與該第一筆資料是否具有相同的邏輯區塊以及邏輯資料頁,以產生該判斷結果。The method as described in item 1 of the patent application scope, wherein the step of determining whether the second piece of data and the first piece of data have consecutive logical addresses to generate the determination result includes: determining the second piece of data and the Whether the first piece of data has the same logical block and logical data page to generate the judgment result. 如申請專利範圍第1項所述之方法,其中該第二筆資料與該第一筆資料對應到不同的寫入命令。The method as described in item 1 of the patent application scope, wherein the second data and the first data correspond to different write commands. 一種快閃記憶體控制器,其中該快閃記憶體控制器係用來存取一快閃記憶體模組,該快閃記憶體模組包含多個區塊,每一個區塊包含多個資料頁,且該快閃記憶體控制器包含有:一唯讀記憶體,用來儲存一程式碼;以及一微處理器,用來執行該程式碼以控制對該快閃記憶體模組之存取;其中當該微處理器自一主裝置接收一第一筆資料時,該微處理器自該快閃記憶體模組中一特定資料頁中讀取特定資料,並將該第一筆資料連同該特定資料暫存在一緩衝記憶體中,以及將該第一筆資料連同該特定資料寫入至該快閃記憶體模組中的一第一資料頁;以及當該微處理器自該主裝置接收一第二筆資料時,該微處理器判斷該第二筆資料與該第一筆資料是否具有連續的邏輯位址以產生一判斷結果,且若是該判斷結果指出該第二筆資料與該第一筆資料具有連續的邏輯位址,在不讀取該快閃記憶體模組的情形下,該微處理器將該第二筆資料連同暫存在該緩衝記憶體的該第一筆資料與該特定資料的一部份寫入至該快閃記憶體模組中的一第二資料頁。A flash memory controller, wherein the flash memory controller is used to access a flash memory module, the flash memory module includes multiple blocks, and each block contains multiple data Page, and the flash memory controller includes: a read-only memory for storing a program code; and a microprocessor for executing the code to control the storage of the flash memory module Fetch; wherein when the microprocessor receives a first data from a host device, the microprocessor reads specific data from a specific data page in the flash memory module and transfers the first data Temporarily stored in the buffer memory together with the specific data, and writing the first data together with the specific data to a first data page in the flash memory module; and when the microprocessor is from the host When the device receives a second piece of data, the microprocessor determines whether the second piece of data and the first piece of data have consecutive logical addresses to generate a judgment result, and if the judgment result indicates that the second piece of data and The first piece of data has a continuous logical address. Without reading the flash memory module, the microprocessor combines the second piece of data with the first piece of data temporarily stored in the buffer memory A part of the specific data is written to a second data page in the flash memory module. 如申請專利範圍第6項所述之快閃記憶體控制器,其中該微處理器直接使用該第二筆資料來更新暫存在該緩衝記憶體中的該特定資料,並將暫存在該緩衝記憶體的該第一筆資料與使用該第二筆資料更新後的該特定資料寫入至該快閃記憶體模組中的該第二資料頁。The flash memory controller as described in item 6 of the patent application scope, wherein the microprocessor directly uses the second data to update the specific data temporarily stored in the buffer memory and temporarily stores the buffer memory The first data of the body and the specific data updated using the second data are written to the second data page in the flash memory module. 如申請專利範圍第6項所述之快閃記憶體控制器,其中若是該判斷結果指出該第二筆資料與該第一筆資料具有不連續的邏輯位址,該微處理器自該快閃記憶體模組中另一特定資料頁中讀取另一特定資料,並將該二筆資料連同該另一特定資料暫存在該緩衝記憶體中,以及將該第二筆資料連同該另一特定資料寫入至該快閃記憶體模組中的該第二資料頁。The flash memory controller as described in item 6 of the patent application scope, wherein if the judgment result indicates that the second data and the first data have discontinuous logical addresses, the microprocessor flashes from the flash memory Reading another specific data from another specific data page in the memory module, temporarily storing the two data together with the other specific data in the buffer memory, and combining the second data with the other specific data The data is written to the second data page in the flash memory module. 如申請專利範圍第6項所述之快閃記憶體控制器,其中該微處理器判斷該第二筆資料與該第一筆資料是否具有相同的邏輯區塊以及邏輯資料頁,以產生該判斷結果。The flash memory controller as described in item 6 of the patent application scope, wherein the microprocessor determines whether the second data and the first data have the same logical block and logical data page to generate the judgment result. 一種電子裝置,包含有:一快閃記憶體模組;以及一快閃記憶體控制器,用來存取該快閃記憶體模組;其中當該快閃記憶體控制器自一主裝置接收一第一筆資料時,該快閃記憶體控制器自該快閃記憶體模組中一特定資料頁中讀取特定資料,並將該第一筆資料連同該特定資料暫存在一緩衝記憶體中,以及將該第一筆資料連同該特定資料寫入至該快閃記憶體模組中的一第一資料頁;以及當該快閃記憶體控制器自該主裝置接收一第二筆資料時,該快閃記憶體控制器判斷該第二筆資料與該第一筆資料是否具有連續的邏輯位址以產生一判斷結果,且若是該判斷結果指出該第二筆資料與該第一筆資料具有連續的邏輯位址,在不讀取該快閃記憶體模組的情形下,該快閃記憶體控制器將該第二筆資料連同暫存在該緩衝記憶體的該第一筆資料與該特定資料的一部份寫入至該快閃記憶體模組中的一第二資料頁。An electronic device includes: a flash memory module; and a flash memory controller for accessing the flash memory module; wherein when the flash memory controller receives from a host device For a first data, the flash memory controller reads specific data from a specific data page in the flash memory module, and temporarily stores the first data together with the specific data in a buffer memory , And writing the first data together with the specific data to a first data page in the flash memory module; and when the flash memory controller receives a second data from the host device At this time, the flash memory controller determines whether the second data and the first data have consecutive logical addresses to generate a judgment result, and if the judgment result indicates that the second data and the first data The data has continuous logical addresses. Without reading the flash memory module, the flash memory controller combines the second data with the first data temporarily stored in the buffer memory and A part of the specific data is written to a second data page in the flash memory module.
TW107116229A 2018-05-14 2018-05-14 Method for accessing flash memory module and related flash memory controller and electronic device TWI653630B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
TW107116229A TWI653630B (en) 2018-05-14 2018-05-14 Method for accessing flash memory module and related flash memory controller and electronic device
CN201810741559.8A CN110489054B (en) 2018-05-14 2018-07-06 Method for accessing flash memory module, related flash memory controller and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW107116229A TWI653630B (en) 2018-05-14 2018-05-14 Method for accessing flash memory module and related flash memory controller and electronic device

Publications (2)

Publication Number Publication Date
TWI653630B true TWI653630B (en) 2019-03-11
TW201947594A TW201947594A (en) 2019-12-16

Family

ID=66590759

Family Applications (1)

Application Number Title Priority Date Filing Date
TW107116229A TWI653630B (en) 2018-05-14 2018-05-14 Method for accessing flash memory module and related flash memory controller and electronic device

Country Status (2)

Country Link
CN (1) CN110489054B (en)
TW (1) TWI653630B (en)

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100866959B1 (en) * 2007-02-13 2008-11-05 삼성전자주식회사 Partial page data write method of non-volatile memory device
CN101833516A (en) * 2007-12-14 2010-09-15 创惟科技股份有限公司 Storage system and method for improving access efficiency of flash memory
WO2009129338A2 (en) * 2008-04-15 2009-10-22 Adtron, Inc. Flash management using sequential techniques
US8549209B2 (en) * 2008-11-04 2013-10-01 Mosaid Technologies Incorporated Bridging device having a configurable virtual page size
CN101859278B (en) * 2009-04-07 2013-02-13 群联电子股份有限公司 Data storage method and storage system for flash memory
TWI436212B (en) * 2011-07-21 2014-05-01 Phison Electronics Corp Data writing method, memory controller and memory storage apparatus
CN104423888B (en) * 2013-08-23 2017-10-03 群联电子股份有限公司 Method for writing data, memorizer control circuit unit and memory storage apparatus

Also Published As

Publication number Publication date
TW201947594A (en) 2019-12-16
CN110489054B (en) 2022-09-23
CN110489054A (en) 2019-11-22

Similar Documents

Publication Publication Date Title
TWI692690B (en) Method for accessing flash memory module and associated flash memory controller and electronic device
TWI650644B (en) Method for managing flash memory module and related flash memory controller and electronic device
CN110908925B (en) High-efficiency garbage collection method, data storage device and controller thereof
US10474573B2 (en) Method for managing flash memory module and associated flash memory controller and electronic device
TWI659304B (en) Method for accessing flash memory module and associated flash memory controller and electronic device
CN107590080B (en) Mapping table updating method, memory control circuit unit and memory storage device
CN102890655B (en) Memory storage device, memory controller and valid data recognition method thereof
US20190065361A1 (en) Method for writing data into flash memory module and associated flash memory controller and electronic device
US9037781B2 (en) Method for managing buffer memory, memory controllor, and memory storage device
US20190391916A1 (en) Method for managing flash memory module and associated flash memory controller and electronic device
US10990292B2 (en) Flash memory controller, control method of flash memory controller and associated electronic device
CN107943710B (en) Memory management method and memory controller using the same
CN109273033B (en) Memory management method, memory control circuit unit and memory storage device
TWI749279B (en) A data storage device and a data processing method
TWI657339B (en) Method for managing flash memory module and associated flash memory controller
TWI653630B (en) Method for accessing flash memory module and related flash memory controller and electronic device
TWI697778B (en) A data storage device and a data processing method
US8312205B2 (en) Method for identifying a page of a block of flash memory, and associated memory device
US11249676B2 (en) Electronic device, flash memory controller and associated control method
TWI670598B (en) Method for managing flash memory module and associated flash memory controller and electronic device
CN112181859A (en) Effective data merging method, memory control circuit unit and memory device