[go: up one dir, main page]

TWI844174B - Method and apparatus for searching for logical address ranges of host commands - Google Patents

Method and apparatus for searching for logical address ranges of host commands Download PDF

Info

Publication number
TWI844174B
TWI844174B TW111144899A TW111144899A TWI844174B TW I844174 B TWI844174 B TW I844174B TW 111144899 A TW111144899 A TW 111144899A TW 111144899 A TW111144899 A TW 111144899A TW I844174 B TWI844174 B TW I844174B
Authority
TW
Taiwan
Prior art keywords
logical address
logical
register
address
interval
Prior art date
Application number
TW111144899A
Other languages
Chinese (zh)
Other versions
TW202422345A (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 TW111144899A priority Critical patent/TWI844174B/en
Application granted granted Critical
Publication of TW202422345A publication Critical patent/TW202422345A/en
Publication of TWI844174B publication Critical patent/TWI844174B/en

Links

Images

Landscapes

  • Storage Device Security (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The invention is related to a method, a computer program product and an apparatus for searching logical address ranges of host commands. The method includes: inputting a first logical address range including a first start logical address to a first end logical address; inputting a second logical address range including a second start logical address to a second end logical address; outputting, by a first comparator, logic 0 to a NOR gate when detecting that the first end logical address is not less than the second start logical address; outputting, by a second comparator, logic 0 to the NOR gate when detecting that the second end logical address is not less than the first start logical address; and outputting, by the NOR gate, logic 1 to a match register to inform the processing unit that all or a portion of data of the first logical address range is temporarily stored in a random access memory (RAM), and outputting, by the NOR gate, logic 1 to output circuitry, thereby enabling the output circuitry to output a memory address in the RAM that stores the second logical address range to a resulting address register, when receiving logic 0 from both the first and the second comparators. With the arrangement of dedicated search engine, the processing unit could hand over the search tasks for logical address ranges requiring excessive comparisons to the search engine, and provide its computing resources to other tasks, thereby improving the overall performance of storage device.

Description

主機命令的邏輯位址區間搜索方法及裝置 Logical address interval search method and device for host commands

本發明涉及儲存裝置,尤指一種主機命令的邏輯位址區間搜索方法及裝置。 The present invention relates to a storage device, and more particularly to a method and device for searching a logical address range of a host command.

閃存通常分為NOR閃存與NAND閃存。NOR閃存為隨機存取裝置,主機端(Host Side)可於位址腳位上提供任何存取NOR閃存的位址,並及時地從NOR閃存的資料腳位上獲得儲存於該位址上的資料。相反地,NAND閃存並非隨機存取,而是序列存取。NAND閃存無法像NOR閃存一樣,可以存取任何隨機位址,主機端反而需要寫入序列的位元組(Bytes)的值到NAND閃存中,用於定義請求命令(Command)的類型(如,讀取、寫入、丟棄、抹除等),以及用在此命令上的位址。位址可指向一個頁面(閃存中寫入作業的最小資料塊)或一個區塊(閃存中抹除作業的最小資料塊)。 Flash memory is usually divided into NOR flash memory and NAND flash memory. NOR flash memory is a random access device. The host side can provide any address to access the NOR flash memory on the address pins and obtain the data stored at the address from the data pins of the NOR flash memory in a timely manner. In contrast, NAND flash memory is not randomly accessed, but sequentially accessed. NAND flash memory cannot access any random address like NOR flash memory. Instead, the host side needs to write the value of the sequence of bytes into the NAND flash memory to define the type of request command (such as read, write, discard, erase, etc.) and the address used in this command. The address can point to a page (the smallest data block for write operations in flash memory) or a block (the smallest data block for erase operations in flash memory).

然而,在實際更新閃存模組中儲存的資料之前,欲循序寫入的資料可先暫存在閃存控制器中的隨機存取記憶體一段時間。暫存的資料可能會被後續的主機讀取命令所讀取。如果能夠直接從隨機存取記憶體讀取暫存的資料並回覆主機端,而不是通過閃存介面從閃存模組執行實際的讀取操作,將縮短主機讀取命令的執行時間。或者,暫存的資料可能會被後續的主機資料更新命令(例如,寫入命令、抹除命令、丟棄命令等)所覆寫。如果能夠直接更新隨機存取記憶體暫存的命中資料,將縮短主機資料更新命令的執行時間。本發明提出一種主機命令的邏輯位址區間搜索方法及裝置,用於決定後續 主機命令的位址區間是否命中暫存資料的邏輯位址區間,從而縮短主機命令的執行時間。 However, before actually updating the data stored in the flash memory module, the data to be written sequentially may be temporarily stored in the random access memory in the flash memory controller for a period of time. The temporarily stored data may be read by a subsequent host read command. If the temporarily stored data can be read directly from the random access memory and replied to the host, rather than performing the actual read operation from the flash memory module through the flash memory interface, the execution time of the host read command will be shortened. Alternatively, the temporarily stored data may be overwritten by a subsequent host data update command (e.g., a write command, an erase command, a discard command, etc.). If the hit data temporarily stored in the random access memory can be directly updated, the execution time of the host data update command will be shortened. The present invention proposes a method and device for searching the logical address interval of a host command, which is used to determine whether the address interval of a subsequent host command hits the logical address interval of the temporarily stored data, thereby shortening the execution time of the host command.

有鑑於此,如何減輕或消除上述相關領域的缺失,實為有待解決的問題。 In view of this, how to alleviate or eliminate the deficiencies in the above-mentioned related areas is indeed a problem to be solved.

本說明書涉及一種主機命令的位址區間搜索方法,包含:輸入第一邏輯位址區間,包含第一開始邏輯位址至第一結束邏輯位址;輸入第二邏輯位址區間,包含第二開始邏輯位址至第二結束邏輯位址;當第一比較器偵測到第一結束邏輯位址不小於第二開始邏輯位址時,輸出邏輯”0”給或非閘;當第二比較器偵測到第二結束邏輯位址不小於第一開始邏輯位址時,輸出邏輯”0”給所述或非閘;以及當或非閘從第一比較器和第二比較器都接收到邏輯”0”時,輸出邏輯”1”給匹配寄存器,用以通知處理單元第一邏輯位址區間的全部或者一部分資料暫存於隨機存取記憶體,並且輸出邏輯”1”給輸出電路,用以讓輸出電路輸出隨機存取記憶體中儲存第二邏輯位址區間的記憶體位址至結果位址寄存器。 The present invention relates to an address interval search method for a host command, comprising: inputting a first logical address interval, including a first starting logical address to a first ending logical address; inputting a second logical address interval, including a second starting logical address to a second ending logical address; when a first comparator detects that the first ending logical address is not less than the second starting logical address, outputting a logical "0" to a NOR gate; when a second comparator detects that the second ending logical address is not less than the first starting logical address, outputting a logical "0" to a NOR gate; when a second comparator detects that the second ending logical address is not less than the first starting logical address, When the first comparator receives the logical address, the NOR gate outputs a logical "0" to the NOR gate; and when the NOR gate receives the logical "0" from both the first comparator and the second comparator, the NOR gate outputs a logical "1" to the matching register to notify the processing unit that all or part of the data in the first logical address interval is temporarily stored in the random access memory, and outputs a logical "1" to the output circuit to allow the output circuit to output the memory address of the second logical address interval stored in the random access memory to the result address register.

第二邏輯位址區間的待寫入資料暫存在隨機存取記憶體,並且尚未寫入到閃存模組。 The data to be written in the second logical address range is temporarily stored in the random access memory and has not yet been written to the flash memory module.

本說明書另涉及一種主機命令的位址區間搜索裝置,包含:第二開始寄存器;第二結束寄存器;第一比較器;第二比較器;或非閘;和輸出電路。第二開始寄存器儲存第二開始邏輯位址,並且第二結束寄存器儲存第二結束邏輯位址。第一比較器包含第一輸入端、第二輸入端和第一輸出端,第一輸入端耦接第一結束寄存器,第二輸入端耦接第二開始寄存器,並且第一輸出端設置以當第一結束寄存器中儲存的第一結束邏輯位址不小於第二開始邏輯位址時,輸出邏輯”0”給或非閘。第二比較器包含第三輸入端、第四輸入端和第二輸出端,第三輸入端耦接第二結束寄存器,第四輸入端耦接第一開 始寄存器,並且第二輸出端設置以當第二結束邏輯位址不小於第一開始寄存器中儲存的第一開始邏輯位址時,輸出邏輯”0”給或非閘。或非閘包含第五輸入端、第六輸入端和第三輸出端,第五輸入端耦接第一輸出端,第六輸入端耦接第二輸出端,第三輸出端設置以當第五輸入端和第六輸入端都接收到邏輯”0”時,輸出邏輯”1”給匹配寄存器,並且輸出邏輯”1”給輸出電路。輸出電路設置以當從或非閘接收到邏輯”1”時,輸出隨機存取記憶體中儲存第二邏輯位址區間的記憶體位址至結果位址寄存器,其中,第二邏輯位址區間包含第二開始邏輯位址至第二結束邏輯位址。 The present specification also relates to an address interval search device for host commands, comprising: a second start register; a second end register; a first comparator; a second comparator; an NOR gate; and an output circuit. The second start register stores a second start logical address, and the second end register stores a second end logical address. The first comparator comprises a first input terminal, a second input terminal and a first output terminal, the first input terminal is coupled to the first end register, the second input terminal is coupled to the second start register, and the first output terminal is configured to output a logical "0" to the NOR gate when the first end logical address stored in the first end register is not less than the second start logical address. The second comparator includes a third input terminal, a fourth input terminal and a second output terminal, the third input terminal is coupled to the second end register, the fourth input terminal is coupled to the first start register, and the second output terminal is set to output a logic "0" to the NOR gate when the second end logic address is not less than the first start logic address stored in the first start register. The NOR gate includes a fifth input terminal, a sixth input terminal and a third output terminal, the fifth input terminal is coupled to the first output terminal, the sixth input terminal is coupled to the second output terminal, and the third output terminal is set to output a logic "1" to the matching register when both the fifth input terminal and the sixth input terminal receive a logic "0", and output a logic "1" to the output circuit. The output circuit is configured to output the memory address of the second logical address interval stored in the random access memory to the result address register when a logical "1" is received from the NOR gate, wherein the second logical address interval includes the second start logical address to the second end logical address.

上述實施例的優點之一,通過如上所述的專屬搜索引擎的設置,讓處理單元可將需要大量比對的邏輯位址區間的搜索任務交給搜索引擎執行,而將其運算資源提供給其他的任務,從而提升儲存裝置的整體效能。 One of the advantages of the above embodiment is that, through the configuration of the above-mentioned dedicated search engine, the processing unit can hand over the search task of the logical address interval that requires a large number of comparisons to the search engine, and provide its computing resources for other tasks, thereby improving the overall performance of the storage device.

本發明的其他優點將搭配以下的說明和圖式進行更詳細的解說。 Other advantages of the present invention will be explained in more detail with the following description and diagrams.

10:電子裝置 10: Electronic devices

110:主機端 110: Host side

130:閃存控制器 130: Flash memory controller

131:主機介面 131: Host interface

132:匯流排 132: Bus

134:處理單元 134: Processing unit

135,135#0~135#7:搜索引擎 135,135#0~135#7:Search engine

136:隨機存取記憶體 136: Random Access Memory

138:直接記憶體存取控制器 138: Direct Memory Access Controller

139:閃存介面 139: Flash memory interface

150:閃存模組 150: Flash memory module

151:介面 151: Interface

153#0~153#15:NAND閃存單元 153#0~153#15: NAND flash memory unit

CH#0~CH#3:通道 CH#0~CH#3: Channel

CE#0~CE#3:致能訊號 CE#0~CE#3: Enable signal

310:循序寫入佇列 310: Sequential write queue

330:資料緩存器 330: Data Cache

410#0~410#7:寄存器組 410#0~410#7: Register group

511,523:開始寄存器 511,523: Start register

512,524:結束寄存器 512,524: End register

515:匹配寄存器 515: Matching register

516:結果位址寄存器 516: Result address register

521:啟動寄存器 521: Start register

525:項目位址寄存器 525: Project address register

526:狀態寄存器 526: Status register

551,553:比較器 551,553: Comparator

555:或非閘 555: or non-gate

580:記憶體存取控制器 580:Memory access controller

591:D正反器 591:D Flip-flop

593:輸出電路 593: Output circuit

S610~S660:方法步驟 S610~S660: Method steps

S710~S760:方法步驟 S710~S760: Method steps

圖1為依據本發明實施例的電子裝置的系統架構圖。 Figure 1 is a system architecture diagram of an electronic device according to an embodiment of the present invention.

圖2為依據本發明實施例的閃存模組的示意圖。 Figure 2 is a schematic diagram of a flash memory module according to an embodiment of the present invention.

圖3為依據本發明實施例的循序寫入佇列的範例項目以及資料緩存器的範例空間之間的關聯示意圖。 FIG3 is a schematic diagram showing the association between an example item of a sequential write queue and an example space of a data cache according to an embodiment of the present invention.

圖4為依據本發明實施例的多個搜索引擎和對應寄存器組的示意圖。 Figure 4 is a schematic diagram of multiple search engines and corresponding register groups according to an embodiment of the present invention.

圖5為依據本發明實施例的搜索引擎和周邊元件的方塊圖。 Figure 5 is a block diagram of a search engine and peripheral components according to an embodiment of the present invention.

圖6為依據本發明實施例的搭配搜索引擎的主機讀取命令的執行方法流程圖。 Figure 6 is a flow chart of the execution method of the host reading command with the search engine according to the embodiment of the present invention.

圖7為依據本發明實施例的搭配搜索引擎的主機寫入命令的執行方法流程圖。 Figure 7 is a flow chart of the execution method of the host write command with the search engine according to the embodiment of the present invention.

圖8為依據本發明實施例的執行範例主機寫入命令後的循序寫入佇列的範例項目以及資料緩存器的範例空間之間的關聯示意圖。 FIG8 is a schematic diagram showing the association between example items of a sequential write queue and example space of a data cache after executing an example host write command according to an embodiment of the present invention.

以下說明為完成發明的較佳實現方式,其目的在於描述本發明的基本精神,但並不用以限定本發明。實際的發明內容必須參考之後的權利要求範圍。 The following description is a preferred implementation method for completing the invention, and its purpose is to describe the basic spirit of the invention, but it is not intended to limit the invention. The actual content of the invention must refer to the scope of the subsequent claims.

必須了解的是,使用於本說明書中的「包含」、「包括」等詞,用以表示存在特定的技術特徵、數值、方法步驟、作業處理、元件以及/或組件,但並不排除可加上更多的技術特徵、數值、方法步驟、作業處理、元件、組件,或以上的任意組合。 It must be understood that the words "include", "comprising" and the like used in this specification are used to indicate the existence of specific technical features, values, method steps, operation processes, elements and/or components, but do not exclude the addition of more technical features, values, method steps, operation processes, elements, components, or any combination thereof.

於權利要求中使用如「第一」、「第二」、「第三」等詞是用來修飾權利要求中的元件,並非用來表示之間具有優先順序,前置關係,或者是一個元件先於另一個元件,或者是執行方法步驟時的時間先後順序,僅用來區別具有相同名字的元件。 The words "first", "second", "third" etc. used in the claims are used to modify the elements in the claims, and are not used to indicate a priority order, a precedence relationship, or that one element precedes another element, or a temporal sequence in performing method steps. They are only used to distinguish elements with the same name.

必須了解的是,當元件描述為「連接」或「耦接」至另一元件時,可以是直接連結、或耦接至其他元件,可能出現中間元件。相反地,當元件描述為「直接連接」或「直接耦接」至另一元件時,其中不存在任何中間元件。使用來描述元件之間關係的其他語詞也可類似方式解讀,例如「介於」相對於「直接介於」,或者是「鄰接」相對於「直接鄰接」等等。 It must be understood that when an element is described as being "connected" or "coupled" to another element, it can be directly connected or coupled to other elements, and there may be intermediate elements. Conversely, when an element is described as being "directly connected" or "directly coupled" to another element, there are no intermediate elements. Other words used to describe the relationship between elements can also be interpreted in a similar way, such as "between" versus "directly between", or "adjacent" versus "directly adjacent", etc.

參考圖1。電子裝置10包含主機端(Host Side)110、閃存控制器130及閃存模組150,並且閃存控制器130及閃存模組150可合稱為裝置端(Device Side)。電子裝置10可實施於個人電腦、筆記型電腦(Laptop PC)、平板電腦、手機、數位相機、數位攝影機、智慧電視、智慧電冰箱、車用電子系統(Automotive Electronics System)等電子產品之中。主機端110與閃存控制器130的主機介面(Host Interface)137可以通用序列匯流排(Universal Serial Bus,USB)、先進技術附著(advanced technology attachment,ATA)、序列先進技術附著(serial advanced technology attachment,SATA)、快速周 邊元件互聯(peripheral component interconnect express,PCI-E)、通用快閃記憶儲存(Universal Flash Storage UFS)、嵌入式多媒體卡(Embedded Multi-Media Card eMMC)等通訊協定彼此溝通。閃存控制器130的閃存介面(Flash Interface)139與閃存模組150可以雙倍資料率(Double Data Rate DDR)通訊協定彼此溝通,例如,開放NAND快閃(Open NAND Flash Interface ONFI)、雙倍資料率開關(DDR Toggle)或其他通訊協定。閃存控制器130包含處理單元134,可使用多種方式實施,如使用通用硬體(例如,單一處理器、具平行處理能力的多處理器、圖形處理器或其他具運算能力的處理器),並且在執行軟體以及/或韌體指令時,提供之後描述的功能。處理單元134通過主機介面131接收主機命令,例如讀取命令(Read Command)、寫入命令(Write Command)、丟棄命令(Discard Command)、抹寫命令(Erase Command)等,依據主機命令的類型和其中攜帶參數產生主機資料更新命令(Host Data-update Command),排程並執行這些命令。閃存控制器130另包含隨機存取記憶體(Random Access Memory,RAM)136,可實施為動態隨機存取記憶體(Dynamic Random Access Memory,DRAM)、靜態隨機存取記憶體(Static Random Access Memory,SRAM)或上述兩者的結合,用於配置空間作為資料緩存器(Data Buffer),儲存從主機端110讀取並即將寫入閃存模組150的使用者資料(也可稱為主機資料),以及從閃存模組150讀取並即將輸出給主機端110的使用者資料。隨機存取記憶體136另可儲存執行過程中需要的資料,例如,變數、資料表、主機-閃存對照表(Host-to-Flash H2F Table)、閃存-主機對照表(Flash-to-Host F2H Table)、循序更新佇列(Sequential Update Queue)等。閃存介面139包含NAND閃存控制器(NAND Flash Controller NFC),提供存取閃存模組150時需要的功能,例如命令序列器(Command Sequencer)、低密度奇偶校驗 (Low Density Parity Check LDPC)等。 Referring to FIG. 1 , the electronic device 10 includes a host side 110, a flash memory controller 130, and a flash memory module 150, and the flash memory controller 130 and the flash memory module 150 may be collectively referred to as a device side. The electronic device 10 may be implemented in electronic products such as personal computers, laptop computers, tablet computers, mobile phones, digital cameras, digital video cameras, smart TVs, smart refrigerators, and automotive electronic systems. The host interface 137 of the host end 110 and the flash memory controller 130 can communicate with each other using a communication protocol such as Universal Serial Bus (USB), advanced technology attachment (ATA), serial advanced technology attachment (SATA), peripheral component interconnect express (PCI-E), Universal Flash Storage (UFS), and embedded Multi-Media Card (eMMC). The flash interface 139 of the flash memory controller 130 and the flash memory module 150 can communicate with each other using a double data rate (DDR) communication protocol, such as Open NAND Flash Interface ONFI, double data rate switch (DDR Toggle), or other communication protocols. The flash memory controller 130 includes a processing unit 134, which can be implemented in a variety of ways, such as using general hardware (e.g., a single processor, a multi-processor with parallel processing capabilities, a graphics processor, or other processors with computing capabilities), and provides the functions described later when executing software and/or firmware instructions. The processing unit 134 receives host commands such as read commands, write commands, discard commands, and erase commands through the host interface 131, generates host data-update commands according to the type of host commands and the parameters carried therein, and schedules and executes these commands. The flash memory controller 130 further includes a random access memory (RAM) 136, which can be implemented as a dynamic random access memory (DRAM), a static random access memory (SRAM), or a combination of the two, and is used to configure space as a data buffer to store user data (also referred to as host data) read from the host end 110 and to be written to the flash memory module 150, as well as user data read from the flash memory module 150 and to be output to the host end 110. The random access memory 136 can also store data required during the execution process, such as variables, data tables, host-to-flash H2F Table, flash-to-host F2H Table, sequential update queue, etc. The flash memory interface 139 includes a NAND flash controller (NAND Flash Controller NFC), which provides the functions required when accessing the flash memory module 150, such as a command sequencer, a low density parity check (LDPC), etc.

閃存控制器130中可配置匯流排架構(Bus Architecture)132,用於讓元件之間彼此耦接以傳遞資料、位址、控制訊號等,這些元件包含主機介面131、處理單元134、RAM 136、直接記憶體存取(Direct Memory Access,DMA)控制器138、閃存介面139等。DMA控制器138可依據處理單元134的指令,通過匯流排架構132在元件間遷移資料,例如,將主機介面131或閃存介面139中特定資料緩存器(Data Buffer)的資料搬到RAM 136中的特定位址,將RAM 136中特定位址的資料搬到將主機介面131或閃存介面139中的特定資料緩存器等。 The flash memory controller 130 may be configured with a bus architecture 132 for coupling components to transmit data, addresses, control signals, etc. These components include a host interface 131, a processing unit 134, a RAM 136, a direct memory access (DMA) controller 138, a flash memory interface 139, etc. The DMA controller 138 may transfer data between components through the bus architecture 132 according to instructions from the processing unit 134, for example, moving data from a specific data buffer in the host interface 131 or the flash memory interface 139 to a specific address in the RAM 136, and moving data from a specific address in the RAM 136 to a specific data buffer in the host interface 131 or the flash memory interface 139, etc.

閃存模組150提供大量的儲存空間,通常是數百個千兆位元組(Gigabytes,GB),甚至是數個萬億位元組(Terabytes,TB),用於儲存大量的使用者資料,例如高解析度圖片、影片等。閃存模組150中包含控制電路以及記憶體陣列,記憶體陣列中的記憶單元可組態為單層式單元(Single Level Cells,SLCs)、多層式單元(Multiple Level Cells,MLCs)三層式單元(Triple Level Cells,TLCs)、四層式單元(Quad-Level Cells QLCs)或上述的任意組合。處理單元134通過閃存介面139寫入使用者資料到閃存模組150中的指定位址(目的位址),以及從閃存模組150中的指定位址(來源位址)讀取使用者資料。閃存介面139使用數個電子訊號來協調閃存控制器130與閃存模組150間的資料與命令傳遞,包含資料線(Data Line)、時脈訊號(Clock Signal)與控制訊號(Control Signal)。資料線可用於傳遞命令、位址、讀出及寫入的資料;控制訊號線可用於傳遞晶片致能(Chip Enable,CE)、位址提取致能(Address Latch Enable,ALE)、命令提取致能(Command Latch Enable,CLE)、寫入致能(Write Enable,WE)等控制訊號。 The flash memory module 150 provides a large amount of storage space, usually hundreds of Gigabytes (GB) or even several Terabytes (TB), for storing a large amount of user data, such as high-resolution pictures, videos, etc. The flash memory module 150 includes a control circuit and a memory array, and the memory cells in the memory array can be configured as single-level cells (SLCs), multiple-level cells (MLCs), triple-level cells (TLCs), quad-level cells (QLCs), or any combination thereof. The processing unit 134 writes user data to the specified address (destination address) in the flash memory module 150 through the flash memory interface 139, and reads user data from the specified address (source address) in the flash memory module 150. The flash memory interface 139 uses several electronic signals to coordinate the data and command transmission between the flash memory controller 130 and the flash memory module 150, including data lines (Data Line), clock signals (Clock Signal) and control signals (Control Signal). The data line can be used to transmit commands, addresses, read and write data; the control signal line can be used to transmit chip enable (Chip Enable, CE), address extraction enable (Address Latch Enable, ALE), command extraction enable (Command Latch Enable, CLE), write enable (Write Enable, WE) and other control signals.

參考圖2,閃存模組150中的介面151可包含四個輸出入通道(I/O channels,以下簡稱通道)CH#0至CH#3,每一個通道連接四個NAND閃存單元,例如,通道CH#0連接NAND閃存單元153#0、153#4、153#8及153#12。每個NAND閃存單元可封裝為獨立的芯片(die)。閃存介面139可通過介面151發出致能訊號CE#0至CE#3中的一個來致能NAND閃存單元153#0至153#3、153#4至153#7、153#8至153#11、或153#12至153#15,接著以並行的方式從致能的NAND閃存單元讀取使用者資料,或者寫入使用者資料至致能的NAND閃存單元。 Referring to FIG. 2 , the interface 151 in the flash memory module 150 may include four I/O channels (hereinafter referred to as channels) CH#0 to CH#3, each of which is connected to four NAND flash memory cells. For example, channel CH#0 is connected to NAND flash memory cells 153#0, 153#4, 153#8, and 153#12. Each NAND flash memory cell may be packaged as an independent die. The flash memory interface 139 can enable NAND flash memory cells 153#0 to 153#3, 153#4 to 153#7, 153#8 to 153#11, or 153#12 to 153#15 by sending one of the enable signals CE#0 to CE#3 through the interface 151, and then read user data from the enabled NAND flash memory cells or write user data to the enabled NAND flash memory cells in parallel.

處理單元134可從RAM 136載入並執行韌體轉換層(Firmware Translation Layer,FTL)的程式碼,執行主機端110發送的各種主機命令,以及執行用於提昇儲存裝置的整體效能的背景操作。背景操作可以是垃圾搜集(Garbage Collection,GC)、損耗磨平(Wear Leveling,WL)、讀取再生(read reclaim)、讀取刷新(read refresh)等程序。每次當FTL驅動主機介面131從主機端110獲取循序更新命令(Sequential Update Command)時,將循序更新命令攜帶的多個邏輯位址推入循序更新佇列,以及將循序更新命令的待寫入資料暫存在RAM 136的資料緩存器。接著,每次當FTL通過主機介面131從主機端110接收到主機命令(例如,讀取命令、寫入命令、抹除命令、丟棄命令等)的時候,搜索循序更新佇列中的項目以判斷循序更新佇列中是否已經記錄了此主機命令的邏輯位址,或者此主機命令的邏輯位址區間中的全部或者一部分位址。如果存在,則代表RAM 136中暫存了命中邏輯位址或者邏輯位址區間的資料,但這些資料尚未寫入閃存模組150。FTL可操作RAM 136中的暫存資料以加速此主機命令的執行。 The processing unit 134 can load and execute the code of the Firmware Translation Layer (FTL) from the RAM 136, execute various host commands sent by the host end 110, and execute background operations for improving the overall performance of the storage device. The background operations can be programs such as garbage collection (GC), wear leveling (WL), read reclaim, and read refresh. Every time the FTL drives the host interface 131 to obtain a sequential update command from the host end 110, the multiple logical addresses carried by the sequential update command are pushed into the sequential update queue, and the data to be written by the sequential update command is temporarily stored in the data buffer of the RAM 136. Then, each time the FTL receives a host command (e.g., a read command, a write command, an erase command, a discard command, etc.) from the host terminal 110 through the host interface 131, it searches the entry in the sequential update queue to determine whether the sequential update queue has recorded the logical address of the host command, or all or part of the address in the logical address range of the host command. If so, it means that the data hitting the logical address or the logical address range is temporarily stored in the RAM 136, but the data has not yet been written to the flash memory module 150. The FTL can operate the temporarily stored data in the RAM 136 to speed up the execution of the host command.

在一些實施方式中,循序更新佇列配置為在每個項目(Entry)中儲存一個邏輯位址。邏輯位址可為邏輯區塊位址編號(Logical Block Address,LBA Number),每個LBA編號指向一個512位元組的資料。 或者,邏輯位址可為主機頁面編號(Host Page Number),每個主機頁面編號指向一個4K位元組的資料。例如,如果循序更新命令指示閃存控制器130寫入LBA#0x1000至LBA#0x13FF的資料的時候,FTL在循序更新佇列中推入1024個項目,分別包含邏輯位址”0x1000”至”0x13FF”。然而,上述實施方式將配置RAM 136中大量的空間給循序更新佇列。此外,每次當FTL通過主機介面131從主機端110接收到主機命令時,也需要耗費大量的時間搜索循序更新佇列中的大量項目並逐一比對,用以判斷循序更新佇列中是否已經存在此主機命令中攜帶的至少一個邏輯位置。 In some embodiments, the sequential update queue is configured to store a logical address in each entry. The logical address may be a logical block address number (LBA Number), each LBA number pointing to a 512-byte data. Alternatively, the logical address may be a host page number (Host Page Number), each host page number pointing to a 4K-byte data. For example, if the sequential update command instructs the flash controller 130 to write data from LBA#0x1000 to LBA#0x13FF, the FTL pushes 1024 entries in the sequential update queue, each including logical addresses "0x1000" to "0x13FF". However, the above implementation will allocate a large amount of space in RAM 136 to the sequential update queue. In addition, each time the FTL receives a host command from the host end 110 through the host interface 131, it also takes a lot of time to search a large number of items in the sequential update queue and compare them one by one to determine whether at least one logical position carried in the host command already exists in the sequential update queue.

為了降低RAM 136的空間消耗,本發明實施例提出一種精簡資料結構,用於表示循序寫入佇列中的每個項目,其中,每個項目儲存一段邏輯位址區間,包含開始位址和結束位址。參考圖3所示的記憶體空間的配置示意圖。RAM 136配置空間給循序更新佇列310和資料緩存器330。循序更新佇列310用於依照循序更新命令到達閃存控制器130的時間順序,儲存主機端110發送的相應於循序更新命令的開始位址和結束位址。循序更新命令可包含邏輯位址的長度大於1的主機寫入命令、主機抹除命令、主機丟棄命令等。循序更新佇列310可儲存數百筆或者數千筆的循序更新命令的邏輯位址區間。循序更新佇列310的操作基本原則是由結束位置新增循序更新命令的邏輯位址區間(可稱為入列),並且由開始位置移出循序更新命令的邏輯位址區間(可稱為出列)。也就是說,第一個新增至佇列的邏輯位址區間,也將會是第一個被移出和處理的,符合先進先出(First-In First-Out,FIFO)的原則。例如,循序更新佇列310中的每個項目可儲存4個位元組的開始邏輯位址和4個位元組的結束邏輯位址,表示多個連續的邏輯位址。RAM 136的位址”0x41000”儲存第0個循序更新命令的開始邏輯位址”0x1000”和結束邏輯位址”0x13FF”,RAM 136的位址”0x41008”儲存第1個循序更新命令的 開始邏輯位址”0x8C0”和結束邏輯位址”0x8DF”,依此類推。開始邏輯位址”0x1000”和結束邏輯位址”0x13FF”表示1024個連續的邏輯位址,開始邏輯位址”0x8C0”和結束邏輯位址”0x8DF”表示32個連續的邏輯位址,依此類推。循序更新佇列310可設計為循環式佇列(Cyclical Queue)。 In order to reduce the space consumption of RAM 136, the embodiment of the present invention proposes a streamlined data structure for representing each item in the sequential write queue, wherein each item stores a logical address interval, including a start address and an end address. Refer to the configuration diagram of the memory space shown in FIG3. RAM 136 configures space for the sequential update queue 310 and the data buffer 330. The sequential update queue 310 is used to store the start address and the end address corresponding to the sequential update command sent by the host end 110 according to the time sequence of the sequential update command arriving at the flash memory controller 130. The sequential update command may include a host write command with a logical address length greater than 1, a host erase command, a host discard command, etc. The sequential update queue 310 can store hundreds or thousands of logical address intervals of sequential update commands. The basic operating principle of the sequential update queue 310 is to add a logical address interval of a sequential update command from the end position (which can be called enqueue), and to remove a logical address interval of a sequential update command from the start position (which can be called dequeue). In other words, the first logical address interval added to the queue will also be the first to be removed and processed, in accordance with the First-In First-Out (FIFO) principle. For example, each item in the sequential update queue 310 can store a 4-byte starting logical address and a 4-byte ending logical address, representing multiple consecutive logical addresses. The address "0x41000" of RAM 136 stores the start logic address "0x1000" and the end logic address "0x13FF" of the 0th sequential update command, and the address "0x41008" of RAM 136 stores the start logic address "0x8C0" and the end logic address "0x8DF" of the 1st sequential update command, and so on. The starting logical address "0x1000" and the ending logical address "0x13FF" represent 1024 consecutive logical addresses, the starting logical address "0x8C0" and the ending logical address "0x8DF" represent 32 consecutive logical addresses, and so on. The sequential update queue 310 can be designed as a cyclic queue (Cyclical Queue).

資料緩存器330用於儲存循序更新命令的待寫入資料。例如,資料緩存器330中的空間Buf#0儲存第0個主機寫入命令的待寫入資料,其邏輯位址區間為”0x1000”至”0x13FF”;空間Buf#1儲存第1個主機寫入命令的待寫入資料,其邏輯位址區間為”0x8C0”至”0x8DF”,依此類推。RAM 136更可儲存主機命令基本資料表(未顯示於圖3),包含多筆項目,每筆項目紀錄命令編號、命令類型、連續性、循序更新佇列310中儲存邏輯位址區間的開始記憶體位址、資料緩存器330中儲存待寫入資料的開始記憶體位址等。命令類型可包含讀取”R”、寫入”W”、抹除”E”、丟棄”D”等。連續性可包含循序”Sqt”、隨機”Rnd”等。FTL可通過主機命令基本資料表知道循序更新佇列310中的每個邏輯位址區間所對應到的待寫入資料實際儲存於資料緩存器330中的哪塊記憶體空間。 The data buffer 330 is used to store the data to be written by the sequential update command. For example, the space Buf#0 in the data buffer 330 stores the data to be written by the 0th host write command, and its logical address range is "0x1000" to "0x13FF"; the space Buf#1 stores the data to be written by the 1st host write command, and its logical address range is "0x8C0" to "0x8DF", and so on. RAM 136 can further store a host command basic data table (not shown in FIG. 3 ), including multiple entries, each of which records a command number, a command type, continuity, a start memory address of a logical address interval stored in a sequential update queue 310, a start memory address of data to be written stored in a data buffer 330, etc. Command types can include read “R”, write “W”, erase “E”, discard “D”, etc. Continuity can include sequential “Sqt”, random “Rnd”, etc. The FTL can know which memory space in the data cache 330 the to-be-written data corresponding to each logical address interval in the sequential update queue 310 is actually stored in through the host command basic data table.

參考圖4,閃存控制器130中可設置八個的專屬搜索引擎135#0至135#7和對應的寄存器組(Register Sets)410#0至410#7,讓處理單元134在執行韌體以處理主機命令時,可設定寄存器組410#0至410#7中的指定寄存器,用於驅動搜索引擎135#0至135#7並行地執行八個位址區間的搜索任務。當處理單元134驅動搜索引擎135#0至135#7開始工作後,可先中斷此主機命令的執行並且跳轉去執行不同的主機命令,或者背景操作,而不需要等待這八個搜索任務的執行結果。為了容易說明,整份揭露書中若提到搜索引擎135,則代表搜索引擎135#0至135#7中的任意一個。若提到寄存器組410,則代表寄存器組410#0至410#7中的任意一個或者相應一個。搜索引擎 135可獲取相應寄存器組410中的搜索邏輯位址區間,逐一比對循序寫入佇列310中的項目,直到發現搜索邏輯位址區間的全部或者一部分出現在任何項目為止,或者直到所有項目都比對完畢還沒有發現搜索邏輯位址區間為止。每當搜索引擎135發現搜索邏輯位址區間的全部或者一部分出現在任何項目時,設定相應寄存器組410中的指定寄存器,用以通知處理單元134搜索成功的訊息以及搜索到的項目。當搜索引擎135比對完所有項目還沒有發現搜索邏輯位址區間時,設定相應寄存器組410中的指定寄存器,用以通知處理單元134搜索失敗的訊息。處理單元134可在一段時間後從寄存器組410#0至410#7中的指定寄存器讀取搜索結果,並且根據搜索結果繼續執行此主機命令。由於處理單元134不需要執行這八個搜索任務而能夠將其運算資源提供給其他的任務,儲存裝置的整體效能得以提升。雖然揭露書中描述了八個的專屬搜索引擎和對應的寄存器組,所屬技術領域人員可依據不同的系統需求在閃存控制器130中設置更多或者更少的專屬搜索引擎和對應的寄存器組,本發明不應因此局限。 Referring to FIG. 4 , eight dedicated search engines 135#0 to 135#7 and corresponding register sets 410#0 to 410#7 can be set in the flash memory controller 130, so that when the processing unit 134 executes the firmware to process the host command, the specified registers in the register sets 410#0 to 410#7 can be set to drive the search engines 135#0 to 135#7 to execute the search tasks in eight address intervals in parallel. After the processing unit 134 drives the search engines 135#0 to 135#7 to start working, the execution of the host command can be interrupted first and jump to execute different host commands, or background operations, without waiting for the execution results of the eight search tasks. For ease of explanation, if the search engine 135 is mentioned in the entire disclosure, it means any one of the search engines 135#0 to 135#7. If the register set 410 is mentioned, it means any one of the register sets 410#0 to 410#7 or a corresponding one. The search engine 135 can obtain the search logic address interval in the corresponding register set 410, and compare the items written sequentially in the queue 310 one by one until all or part of the search logic address interval is found to appear in any item, or until all items are compared and the search logic address interval is not found. Whenever the search engine 135 finds that all or part of the search logic address interval appears in any item, it sets the specified register in the corresponding register set 410 to notify the processing unit 134 of the successful search and the searched items. When the search engine 135 has compared all items and has not found the search logic address range, the designated register in the corresponding register group 410 is set to notify the processing unit 134 of the search failure. The processing unit 134 can read the search results from the designated registers in the register group 410 #0 to 410 #7 after a period of time, and continue to execute the host command according to the search results. Since the processing unit 134 does not need to execute these eight search tasks and can provide its computing resources for other tasks, the overall performance of the storage device is improved. Although the disclosure describes eight dedicated search engines and corresponding register sets, those skilled in the art may set more or fewer dedicated search engines and corresponding register sets in the flash controller 130 according to different system requirements, and the present invention should not be limited thereto.

參考圖5所示的搜索引擎135和周邊元件的方塊圖。處理單元134可儲存如圖3所示的循序寫入佇列310的範例項目至RAM 136,並且分別設定開始寄存器511和結束寄存器512的值startA和endA以定義一段搜索的邏輯位址區間。處理單元134為加速接收到的主機命令的執行,可通過設定啟動寄存器521以驅動搜索引擎135。處理單元134還在可啟動計時器以計數一段時間之後,先中斷此主機命令的執行並開始其他任務的處理。開始寄存器511和結束寄存器512可整合在處理單元134或者搜索引擎135之中。 Refer to the block diagram of the search engine 135 and peripheral components shown in FIG5 . The processing unit 134 can store the example items of the sequential write queue 310 shown in FIG3 to the RAM 136, and respectively set the values startA and endA of the start register 511 and the end register 512 to define a logical address interval for a search. In order to accelerate the execution of the received host command, the processing unit 134 can drive the search engine 135 by setting the start register 521. The processing unit 134 can also start the timer to count for a period of time, interrupt the execution of the host command first, and start the processing of other tasks. The start register 511 and the end register 512 can be integrated into the processing unit 134 or the search engine 135.

初始時,匹配寄存器515和結果位址寄存器516儲存空值(NULL)。處理單元134設定啟動寄存器521為邏輯”1”後,啟動寄存器521輸出邏輯”1”給記憶體存取控制器580和D正反器591以致能(Enable)記 憶體存取控制器580和D正反器591。此外,啟動寄存器521輸出邏輯”1”給狀態寄存器526,代表搜索引擎135現在處於忙碌(Busy)狀態。在每次的時鐘訊號轉態時,記憶體存取控制器580從循序寫入佇列310的開始位址(例如,RAM 136的記憶體位址”0x41000”)起讀取8個位元組的資料,並且將前4個位元組的值儲存到開始寄存器523作為開始邏輯位址startB,將後4個位元組的值儲存到結束寄存器524作為結束邏輯位址endB。記憶體存取控制器580還將RAM 136中的開始讀取的位址儲存到項目位址寄存器525。比較器551判斷結束寄存器512的值endA是否小於開始寄存器523的值startB,如果是,則輸出邏輯”1”給或非閘(NOR gate)555,表示處理單元134欲搜索的邏輯位址區間和目前讀取項目中的邏輯位址區間沒有重疊(也就是沒有命中),否則,輸出邏輯”0”給或非閘555。比較器553判斷結束寄存器524的值endB是否小於開始寄存器511的值startA,如果是,則輸出邏輯”1”給或非閘555,表示處理單元134欲搜索的邏輯位址區間和目前讀取項目中的邏輯位址區間沒有重疊(也就是沒有命中),否則,輸出邏輯”0”給或非閘555。當或非閘555從比較器551或比較器553接收到邏輯”1”時,輸出邏輯”0”給D正反器591、輸出電路593和記憶體存取控制器580,用於讓D正反器591輸出邏輯”0”給匹配寄存器515(代表沒有命中),不讓輸出電路593輸出結果,以及讓記憶體存取控制器580繼續從循序寫入佇列310讀取下一個項目的邏輯位址區間。當或非閘555從比較器551和比較器553都接收到邏輯”0”時,輸出邏輯”1”給D正反器591、輸出電路593和記憶體存取控制器580,用於讓D正反器591輸出邏輯”1”給匹配寄存器515(代表命中),讓輸出電路593將項目位址寄存器525的值儲存到結果位址寄存器516作為搜索到的結果(也就是RAM 136中的命中項目的開始記憶體位址),以及不致能(Disable)記憶體存取控制器580。當記憶體存取控制器580搜索完循序寫入佇列310的最 後一個項目或者被不致能之後,輸出邏輯”0”給狀態寄存器526,代表搜索引擎135現在處於空閒(Idle)狀態。匹配寄存器515和結果位址寄存器516可整合在處理單元134或者搜索引擎135之中。 Initially, the match register 515 and the result address register 516 store NULL values. After the processing unit 134 sets the enable register 521 to logic "1", the enable register 521 outputs logic "1" to the memory access controller 580 and the D flip-flop 591 to enable the memory access controller 580 and the D flip-flop 591. In addition, the enable register 521 outputs logic "1" to the status register 526, indicating that the search engine 135 is now in a busy state. At each clock signal transition, the memory access controller 580 reads 8 bytes of data from the start address of the sequential write queue 310 (e.g., the memory address "0x41000" of the RAM 136), and stores the value of the first 4 bytes in the start register 523 as the start logical address startB, and stores the value of the second 4 bytes in the end register 524 as the end logical address endB. The memory access controller 580 also stores the start read address in the RAM 136 in the entry address register 525. The comparator 551 determines whether the value endA of the end register 512 is less than the value startB of the start register 523. If so, it outputs a logical "1" to the NOR gate 555, indicating that the logical address range to be searched by the processing unit 134 and the logical address range in the current read item do not overlap (that is, there is no hit); otherwise, it outputs a logical "0" to the NOR gate 555. The comparator 553 determines whether the value endB of the end register 524 is less than the value startA of the start register 511. If so, it outputs a logical "1" to the NOR gate 555, indicating that the logical address range to be searched by the processing unit 134 and the logical address range in the current read item do not overlap (that is, there is no hit); otherwise, it outputs a logical "0" to the NOR gate 555. When the NOR gate 555 receives a logical "1" from the comparator 551 or the comparator 553, it outputs a logical "0" to the D flip-flop 591, the output circuit 593 and the memory access controller 580, so as to allow the D flip-flop 591 to output a logical "0" to the matching register 515 (representing no hit), prevent the output circuit 593 from outputting the result, and allow the memory access controller 580 to continue reading the logical address interval of the next item from the sequential write queue 310. When the NOR gate 555 receives a logical "0" from both the comparator 551 and the comparator 553, it outputs a logical "1" to the D flip-flop 591, the output circuit 593 and the memory access controller 580, so as to allow the D flip-flop 591 to output a logical "1" to the match register 515 (representing a hit), so that the output circuit 593 stores the value of the item address register 525 in the result address register 516 as the searched result (that is, the starting memory address of the hit item in the RAM 136), and disables the memory access controller 580. When the memory access controller 580 searches for the last item in the sequential write queue 310 or is disabled, it outputs a logical "0" to the status register 526, indicating that the search engine 135 is now in an idle state. The matching register 515 and the result address register 516 can be integrated into the processing unit 134 or the search engine 135.

當計時器計數到這段時間後,處理單元134可檢查狀態寄存器526,判斷搜索引擎135現在處於忙碌狀態(代表搜索中)或者空閒狀態(代表搜索完畢)。如果搜索引擎135處於忙碌狀態,則處理單元134重設計時器以計數一段時間。如果搜索引擎135處於空閒狀態,則處理單元134讀取匹配寄存器515中的值。如果匹配寄存器515中的值為邏輯”0”,則代表循序寫入佇列310中找不到任何重疊於邏輯位址區間startA至endA的項目。如果匹配寄存器515中的值為邏輯”1”,則代表循序寫入佇列310中含有重疊於邏輯位址區間startA至endA的項目,處理單元134讀取結果位址寄存器516中儲存的記憶體位址。接著,處理單元134讀取RAM 136的此記憶體位址開始的8個位元組,用以取得命中的邏輯位址區間。 When the timer counts to this period of time, the processing unit 134 can check the status register 526 to determine whether the search engine 135 is now busy (indicating that the search is in progress) or idle (indicating that the search is completed). If the search engine 135 is busy, the processing unit 134 resets the timer to count a period of time. If the search engine 135 is idle, the processing unit 134 reads the value in the matching register 515. If the value in the matching register 515 is a logical "0", it means that no items overlapping the logical address interval startA to endA are found in the sequential write queue 310. If the value in the match register 515 is a logical "1", it means that the sequential write queue 310 contains items overlapping the logical address range startA to endA, and the processing unit 134 reads the memory address stored in the result address register 516. Then, the processing unit 134 reads the 8 bytes starting from this memory address of the RAM 136 to obtain the hit logical address range.

上述的專屬的搜索引擎135搭配循序寫入佇列310中的項目的精簡資料結構,能夠應用到主機讀取命令的執行過程。參考圖6所示的主機讀取命令的執行方法流程圖,此方法由處理單元134在載入和執行FTL時執行,用以反覆地從主機端110接收主機讀取命令,並且使用循序寫入佇列310和搜索引擎135來加速主機讀取命令的執行。詳細說明如下: The above-mentioned dedicated search engine 135, together with the streamlined data structure of the items in the sequential write queue 310, can be applied to the execution process of the host read command. Referring to the flowchart of the execution method of the host read command shown in FIG6, this method is executed by the processing unit 134 when loading and executing the FTL, and is used to repeatedly receive the host read command from the host end 110, and use the sequential write queue 310 and the search engine 135 to accelerate the execution of the host read command. The detailed description is as follows:

步驟S610:獲取主機讀取命令中攜帶的邏輯位址區間。 Step S610: Obtain the logical address interval carried in the host read command.

步驟S622:分別將邏輯位址區間的開始邏輯位址startA和結束邏輯位址endA設定到開始寄存器511和結束寄存器512。 Step S622: Set the start logical address startA and the end logical address endA of the logical address interval to the start register 511 and the end register 512 respectively.

步驟S624:設定啟動寄存器521以驅動搜索引擎135開始搜索循序寫入佇列310的內容,用於判斷此主機讀取命令的邏輯位址區間的全部或者一部分是否能夠在循序寫入佇列310中找到。 Step S624: Set the startup register 521 to drive the search engine 135 to start searching the contents of the sequential write queue 310 to determine whether all or part of the logical address range of the host read command can be found in the sequential write queue 310.

步驟S626:啟動計時器以計數一段時間。在這段時間中,FTL可跳 轉去執行其他的主機命令,或者背景操作,而不需要等待搜索引擎135的搜索結果。 Step S626: Start the timer to count a period of time. During this period of time, FTL can jump to execute other host commands or background operations without waiting for the search results of the search engine 135.

步驟S632:讀取狀態寄存器526的值以判斷搜索引擎135是否完成搜索。如果狀態寄存器526的值為邏輯”0”(代表搜索引擎135現在處於空閒狀態),則流程繼續進行步驟S634的處理。如果狀態寄存器526的值為邏輯”1”(代表搜索引擎135現在處於忙碌狀態),流程繼續進行S626的處理。 Step S632: Read the value of status register 526 to determine whether search engine 135 has completed the search. If the value of status register 526 is logical "0" (indicating that search engine 135 is currently in an idle state), the process continues with step S634. If the value of status register 526 is logical "1" (indicating that search engine 135 is currently in a busy state), the process continues with step S626.

步驟S634:讀取匹配寄存器515的值以判斷搜索引擎135是否搜索到暫存在RAM 136的相應於上述邏輯位址區間的資料。如果匹配寄存器515的值為邏輯”1”(代表搜索到暫存的資料),則流程繼續進行步驟S636的處理。如果匹配寄存器515的值為邏輯”0”(代表搜索不到暫存的資料),流程繼續進行S650的處理。 Step S634: Read the value of the matching register 515 to determine whether the search engine 135 has searched for the data corresponding to the above logical address interval temporarily stored in the RAM 136. If the value of the matching register 515 is logical "1" (indicating that the temporarily stored data has been searched), the process continues to process step S636. If the value of the matching register 515 is logical "0" (indicating that the temporarily stored data has not been searched), the process continues to process step S650.

步驟S636:判斷是否需要從閃存模組150讀取資料。如果是,則流程繼續進行步驟S642的處理。否則,流程繼續進行S660的處理。FTL可讀取結果位址寄存器516中儲存的記憶體位址,並且從RAM 136的此記憶體位址開始讀取4位元的開始邏輯位址startB和4位元的結束邏輯位址endB。FTL判斷邏輯位址區間startA至endA是否被完整包含在邏輯位址區間startB至endB之內。如果是,則代表邏輯位址區間startA至endA的資料完整地暫存在RAM 136之中,不需要再從閃存模組150讀取資料。否則,代表邏輯位址區間startA至endA的資料中有一部分沒有暫存在RAM 136之中,需要再從閃存模組150讀取。 Step S636: Determine whether data needs to be read from the flash memory module 150. If yes, the process continues to process step S642. Otherwise, the process continues to process S660. The FTL can read the memory address stored in the result address register 516, and read the 4-bit starting logical address startB and the 4-bit ending logical address endB starting from this memory address of the RAM 136. The FTL determines whether the logical address interval startA to endA is completely contained in the logical address interval startB to endB. If yes, it means that the data in the logical address interval startA to endA is completely temporarily stored in RAM 136, and there is no need to read the data from the flash memory module 150. Otherwise, it means that part of the data in the logical address interval startA to endA is not temporarily stored in RAM 136, and it needs to be read from the flash memory module 150.

步驟S642:驅動閃存介面139以從閃存模組150讀取所需的資料(也就是邏輯位址區間startA至endA和邏輯位址區間startB至endB之間不重疊的邏輯位址區間startC至endC的資料)。 Step S642: Drive the flash memory interface 139 to read the required data from the flash memory module 150 (that is, the data of the logical address interval startC to endC that does not overlap between the logical address interval startA to endA and the logical address interval startB to endB).

步驟S644:合併RAM 136中暫存的資料和從閃存模組150讀取的資料,並且驅動主機介面131將合併後的資料回覆給主機端110。 Step S644: Merge the data temporarily stored in RAM 136 and the data read from flash memory module 150, and drive host interface 131 to reply the merged data to host end 110.

步驟S650:驅動閃存介面139以從閃存模組150讀取所需的資料(也就是邏輯位址區間startA至endA的資料),並且驅動主機介面131將讀取的資料回覆給主機端110。 Step S650: Drive the flash memory interface 139 to read the required data (i.e., the data in the logical address range from startA to endA) from the flash memory module 150, and drive the host interface 131 to reply the read data to the host end 110.

步驟S660:從RAM 136讀取暫存的資料(也就是邏輯位址區間startA至endA的資料),並且驅動主機介面131將讀取的資料回覆給主機端110。 Step S660: Read the temporarily stored data (i.e. the data in the logical address range from startA to endA) from RAM 136, and drive the host interface 131 to reply the read data to the host end 110.

舉例來說,FTL收到請求讀取邏輯位址”0x800”到”0xFFF”的資料的主機讀取命令(步驟S610),設定開始寄存器511和結束寄存器512的值,讓startA=”0x800”,endA=”0xFFF”(步驟S622),接著將啟動寄存器521設為邏輯”1”以驅動搜索引擎135開始搜索循序寫入佇列310的內容,用於判斷此主機讀取命令的邏輯位址區間是否能夠在循序寫入佇列310中找到(步驟S624)。當FTL通過啟動寄存器521驅動搜索引擎135(步驟S624)並啟動計時器(步驟S626)之後,可先中斷此主機讀取命令的執行並開始其他任務的處理。當計時器計數完這段時間後,FTL通過讀取狀態寄存器526、匹配寄存器515和結果位址寄存器516中的值,知道請求搜索的邏輯位址區間startA=”0x800”至endA=”0xFFF”所命中的項目儲存在RAM 136中的記憶體位址”0x41008”。接著,FTL判斷出邏輯位址區間startA=”0x800”至endA=”0xFFF”部分重疊於第1個循序更新命令的邏輯位址區間startB=”0x8C0”至endB=”0x8DF”(步驟S636中“是”的路徑)。FTL搜索主機-閃存對照表以找出邏輯位址區間”0x800”至”0x8BF”和”0x8E0”至”0xFFF”的實體位址,並且驅動閃存介面139從閃存模組的這些實體位址讀取資料(步驟S642)。FTL還根據主機命令基本資料表的內容從資料緩存器330的空間Buf#1讀取邏輯位址區間”0x8C0”至”0x8DF”的待寫入資料,合併暫存的和讀取的資料,以及驅動主機介面131將合併後的資料回覆給主機端110(步驟S644)。 For example, the FTL receives a host read command requesting to read data from logical address "0x800" to "0xFFF" (step S610), sets the values of the start register 511 and the end register 512, so that startA="0x800", endA="0xFFF" (step S622), and then sets the start register 521 to logical "1" to drive the search engine 135 to start searching the contents of the sequential write queue 310 to determine whether the logical address range of this host read command can be found in the sequential write queue 310 (step S624). After the FTL drives the search engine 135 (step S624) and starts the timer (step S626) by starting the register 521, the execution of the host read command can be interrupted and other tasks can be processed. After the timer counts this period of time, the FTL knows that the item hit by the logical address range startA="0x800" to endA="0xFFF" requested to search is stored in the memory address "0x41008" in the RAM 136 by reading the values in the status register 526, the match register 515 and the result address register 516. Next, the FTL determines that the logical address interval startA="0x800" to endA="0xFFF" partially overlaps with the logical address interval startB="0x8C0" to endB="0x8DF" of the first sequential update command (the "yes" path in step S636). The FTL searches the host-flash memory comparison table to find the physical addresses of the logical address intervals "0x800" to "0x8BF" and "0x8E0" to "0xFFF", and drives the flash memory interface 139 to read data from these physical addresses of the flash memory module (step S642). The FTL also reads the data to be written in the logical address range "0x8C0" to "0x8DF" from the space Buf#1 of the data buffer 330 according to the content of the host command basic data table, merges the temporarily stored and read data, and drives the host interface 131 to reply the merged data to the host end 110 (step S644).

上述的專屬的搜索引擎135搭配循序寫入佇列310中的項目的精簡資料結構,能夠應用到主機寫入命令的執行過程。參考圖7所示的主機寫入命令的執行方法流程圖,此方法由處理單元134在載入和執行FTL時執行,用以反覆地從主機端110接收主機寫入命令,並且使用循序寫入佇列310和搜索引擎135來加速主機寫入命令的執行。詳細說明如下: The above-mentioned dedicated search engine 135, combined with the streamlined data structure of the items in the sequential write queue 310, can be applied to the execution process of the host write command. Referring to the flowchart of the host write command execution method shown in FIG. 7, this method is executed by the processing unit 134 when loading and executing the FTL, and is used to repeatedly receive the host write command from the host end 110, and use the sequential write queue 310 and the search engine 135 to accelerate the execution of the host write command. The detailed description is as follows:

步驟S710:獲取主機寫入命令中攜帶的邏輯位址區間。 Step S710: Obtain the logical address interval carried in the host write command.

步驟S722、S724、S726、S732、S734的技術細節可分別參考圖6的步驟S622、S624、S626、S632、S634的說明,為求簡明不再贅述。 The technical details of steps S722, S724, S726, S732, and S734 can be referred to the description of steps S622, S624, S626, S632, and S634 in Figure 6, respectively, and will not be elaborated for the sake of brevity.

步驟S736:判斷是否在循序寫入佇列310新增新的項目。如果是,則流程繼續進行步驟S742的處理。否則,流程繼續進行S760的處理。FTL可讀取結果位址寄存器516中儲存的記憶體位址,並且從RAM 136的此記憶體位址開始讀取4位元的開始邏輯位址startB和4位元的結束邏輯位址endB。FTL判斷邏輯位址區間startA至endA是否被完整包含在邏輯位址區間startB至endB之內。如果是,則代表邏輯位址區間startA至endA的資料完整地暫存在RAM 136之中,不需要新增新的項目到循序寫入佇列310。否則,代表邏輯位址區間startA至endA中有一部分邏輯位址區間的資料還沒有暫存在RAM 136之中,需要將這部分邏輯位址區間的資料暫存在資料緩存器330的未分配空間,並且新增新的項目到循序寫入佇列310以反映新暫存的待寫入資料。 Step S736: Determine whether a new item is added to the sequential write queue 310. If so, the process continues to process step S742. Otherwise, the process continues to process S760. The FTL can read the memory address stored in the result address register 516, and read the 4-bit starting logical address startB and the 4-bit ending logical address endB starting from this memory address of the RAM 136. The FTL determines whether the logical address interval startA to endA is completely contained in the logical address interval startB to endB. If yes, it means that the data in the logical address interval startA to endA is completely temporarily stored in RAM 136, and no new items need to be added to the sequential write queue 310. Otherwise, it means that part of the data in the logical address interval startA to endA has not been temporarily stored in RAM 136, and this part of the data in the logical address interval needs to be temporarily stored in the unallocated space of the data buffer 330, and a new item is added to the sequential write queue 310 to reflect the newly temporarily stored data to be written.

步驟S742:更新搜索到的在RAM 136中暫存的資料(也就是邏輯位址區間startA至endA和邏輯位址區間startB至endB之間重疊的邏輯位址區間startC至endC的資料)。 Step S742: Update the searched data temporarily stored in RAM 136 (that is, the data of the logical address interval startC to endC overlapping the logical address interval startA to endA and the logical address interval startB to endB).

步驟S744:儲存其餘的待寫入資料到資料緩存器330的新分配空間(也就是邏輯位址區間startA至endA和邏輯位址區間startB至endB之間不重疊的邏輯位址區間startD至endD的資料),並且新增相應的 項目到循序寫入佇列310。 Step S744: Store the remaining data to be written into the newly allocated space of the data buffer 330 (i.e., the data in the logical address range startD to endD that does not overlap between the logical address range startA to endA and the logical address range startB to endB), and add corresponding items to the sequential write queue 310.

步驟S750:儲存邏輯位址區間startA至endA的待寫入資料到資料緩存器330的新分配空間,並且新增相應的項目到循序寫入佇列310。 Step S750: Store the data to be written in the logical address range from startA to endA into the newly allocated space of the data buffer 330, and add corresponding items to the sequential write queue 310.

步驟S760:更新搜索到的在RAM 136中暫存的資料(也就是邏輯位址區間startA至endA的資料)。 Step S760: Update the searched data temporarily stored in RAM 136 (i.e. the data in the logical address range from startA to endA).

舉例來說,FTL收到請求寫入邏輯位址”0x7800”到”0x83FF”的資料的主機寫入命令(步驟S710),設定開始寄存器511和結束寄存器512的值,讓startA=”0x7800”,startB=”0x83FF”(步驟S722),接著將啟動寄存器521設為邏輯”1”以驅動搜索引擎135開始搜索循序寫入佇列310的內容,用於判斷此主機寫入命令的邏輯位址區間是否能夠在循序寫入佇列310中找到(步驟S724)。當FTL通過啟動寄存器521驅動搜索引擎135(步驟S724)並啟動計時器(步驟S726)之後,可先中斷此主機寫入命令的執行並開始其他任務的處理。當計時器計數完這段時間後,FTL通過讀取狀態寄存器526、匹配寄存器515和結果位址寄存器516中的值,知道請求搜索的邏輯位址區間startA=”0x7800”至endA=”0x83FF”所命中的項目儲存在RAM 136中的記憶體位址”0x41010”。接著,FTL判斷出邏輯位址區間startA=”0x7800”至endA=”0x83FF”部分重疊於第2個循序更新命令的邏輯位址區間startB=”0x8000”至endB=”0x9FFF”(步驟S736中“是”的路徑)。FTL更新資料緩存器330的空間Buf#2中的邏輯位址區間”0x8000”至”0x83FF”的暫存資料為此主機寫入命令的待寫入資料(步驟S742)。FTL還儲存邏輯位址區間”0x7800”至”0x7FFF”的待寫入資料到新分配空間Buff#4,並且新增第4個項目到循序寫入佇列310(步驟S744)。執行後的結果可參考圖8所示的記憶體空間的配置示意圖。 For example, the FTL receives a host write command requesting to write data from logical address "0x7800" to "0x83FF" (step S710), sets the values of the start register 511 and the end register 512, so that startA="0x7800", startB="0x83FF" (step S722), and then sets the start register 521 to logical "1" to drive the search engine 135 to start searching the contents of the sequential write queue 310 to determine whether the logical address range of this host write command can be found in the sequential write queue 310 (step S724). After the FTL drives the search engine 135 (step S724) and starts the timer (step S726) by starting the register 521, the execution of the host write command can be interrupted and the processing of other tasks can be started. After the timer counts this period of time, the FTL knows that the item hit by the logical address range startA="0x7800" to endA="0x83FF" requested to search is stored in the memory address "0x41010" in the RAM 136 by reading the values in the status register 526, the match register 515 and the result address register 516. Next, the FTL determines that the logical address interval startA="0x7800" to endA="0x83FF" partially overlaps with the logical address interval startB="0x8000" to endB="0x9FFF" of the second sequential update command (the "yes" path in step S736). The FTL updates the temporary data of the logical address interval "0x8000" to "0x83FF" in the space Buf#2 of the data buffer 330 as the data to be written by this host write command (step S742). FTL also stores the data to be written in the logical address range "0x7800" to "0x7FFF" to the newly allocated space Buff#4, and adds the 4th item to the sequential write queue 310 (step S744). The result after execution can be referred to the configuration diagram of the memory space shown in Figure 8.

本發明所述的方法中的全部或部分步驟可以計算機指令實現,例如儲存裝置中的韌體轉換層(Firmware Translation Layer,FTL)、特 定硬體的驅動程式等。此外,也可實現於其他類型程式。所屬技術領域具有通常知識者可將本發明實施例的方法撰寫成計算機指令,為求簡潔不再加以描述。依據本發明實施例方法實施的計算機指令可儲存於適當的電腦可讀取媒體,例如DVD、CD-ROM、USB碟、硬碟,亦可置於可通過網路(例如,網際網路,或其他適當載具)存取的網路伺服器。 All or part of the steps in the method described in the present invention can be implemented by computer instructions, such as the firmware translation layer (FTL) in the storage device, the driver of the specific hardware, etc. In addition, it can also be implemented in other types of programs. A person with ordinary knowledge in the relevant technical field can write the method of the embodiment of the present invention into computer instructions, and for the sake of brevity, it will not be described again. The computer instructions implemented according to the method of the embodiment of the present invention can be stored in a suitable computer-readable medium, such as a DVD, CD-ROM, USB disk, hard disk, or placed in a network server that can be accessed through a network (for example, the Internet, or other appropriate carriers).

雖然圖1、圖2、圖4、圖5中包含了以上描述的元件,但不排除在不違反發明的精神下,使用更多其他的附加元件,已達成更佳的技術效果。此外,雖然圖6至圖7的流程圖採用指定的順序來執行,但是在不違反發明精神的情況下,熟習此技藝人士可以在達到相同效果的前提下,修改這些步驟間的順序,所以,本發明並不侷限於僅使用如上所述的順序。此外,熟習此技藝人士亦可以將若干步驟整合為一個步驟,或者是除了這些步驟外,循序或平行地執行更多步驟,本發明亦不因此而侷限。 Although Figures 1, 2, 4, and 5 contain the elements described above, it is not excluded that more additional elements may be used to achieve better technical effects without violating the spirit of the invention. In addition, although the flowcharts of Figures 6 to 7 are executed in a specified sequence, a person skilled in the art may modify the sequence of these steps without violating the spirit of the invention, so the present invention is not limited to the sequence described above. In addition, a person skilled in the art may also integrate several steps into one step, or perform more steps sequentially or in parallel in addition to these steps, and the present invention is not limited thereto.

雖然本發明使用以上實施例進行說明,但需要注意的是,這些描述並非用以限縮本發明。相反地,此發明涵蓋了熟習此技藝人士顯而易見的修改與相似設置。所以,申請權利要求範圍須以最寬廣的方式解釋來包含所有顯而易見的修改與相似設置。 Although the present invention is described using the above embodiments, it should be noted that these descriptions are not intended to limit the present invention. On the contrary, the present invention covers modifications and similar arrangements that are obvious to those skilled in the art. Therefore, the scope of the claims should be interpreted in the broadest way to include all obvious modifications and similar arrangements.

310:循序寫入佇列 310: Sequential write queue

511,523:開始寄存器 511,523: Start register

512,524:結束寄存器 512,524: End register

515:匹配寄存器 515: Matching register

516:結果位址寄存器 516: Result address register

521:啟動寄存器 521: Start register

525:項目位址寄存器 525: Project address register

526:狀態寄存器 526: Status register

551,553:比較器 551,553: Comparator

555:或非閘 555: or non-gate

580:記憶體存取控制器 580:Memory access controller

591:D正反器 591:D Flip-flop

593:輸出電路 593: Output circuit

Claims (12)

一種主機命令的邏輯位址區間搜索裝置,包含:第二開始寄存器,儲存第二開始邏輯位址;第二結束寄存器,儲存第二結束邏輯位址;第一比較器包含第一輸入端、第二輸入端和第一輸出端,其中,所述第一輸入端耦接第一結束寄存器,所述第二輸入端耦接所述第二開始寄存器,並且所述第一輸出端設置以當所述第一結束寄存器中儲存的第一結束邏輯位址不小於所述第二開始邏輯位址時,輸出邏輯”0”給或非閘;第二比較器包含第三輸入端、第四輸入端和第二輸出端,其中,所述第三輸入端耦接所述第二結束寄存器,所述第四輸入端耦接第一開始寄存器,並且所述第二輸出端設置以當所述第二結束邏輯位址不小於所述第一開始寄存器中儲存的第一開始邏輯位址時,輸出邏輯”0”給所述或非閘;所述或非閘包含第五輸入端、第六輸入端和第三輸出端,其中,所述第五輸入端耦接所述第一輸出端,所述第六輸入端耦接所述第二輸出端,所述第三輸出端設置以當所述第五輸入端和所述第六輸入端都接收到邏輯”0”時,輸出邏輯”1”給匹配寄存器,並且輸出邏輯”1”給輸出電路,代表所述第一開始邏輯位址至所述第一結束邏輯位址的區間重疊於所述第二開始邏輯位址至所述第二結束邏輯位址的區間;以及所述輸出電路,設置以當從所述或非閘接收到邏輯”1”時,輸出隨機存取記憶體中儲存第二邏輯位址區間的記憶體位址至結果位址寄存器,其中,所述第二邏輯位址區間包含所述第二開始邏輯位址至所述第二結束邏輯位址。 A host command logic address interval search device comprises: a second start register storing a second start logic address; a second end register storing a second end logic address; a first comparator comprising a first input terminal, a second input terminal and a first output terminal, wherein the first input terminal is coupled to the first end register, the second input terminal is coupled to the second start register, and the first output terminal is configured to store the second end register when the first end register stores the second start logic address. When the first end logic address of the second end register is not less than the second start logic address, the logic "0" is output to the NOR gate; the second comparator includes a third input terminal, a fourth input terminal and a second output terminal, wherein the third input terminal is coupled to the second end register, the fourth input terminal is coupled to the first start register, and the second output terminal is set to when the second end logic address is not less than the first start logic address stored in the first start register, Output logic "0" to the NOR gate; the NOR gate includes a fifth input terminal, a sixth input terminal and a third output terminal, wherein the fifth input terminal is coupled to the first output terminal, the sixth input terminal is coupled to the second output terminal, and the third output terminal is set to output logic "1" to the matching register when the fifth input terminal and the sixth input terminal both receive logic "0", and output logic "1" to the output circuit, representing that the first switch The interval from the starting logical address to the first ending logical address overlaps the interval from the second starting logical address to the second ending logical address; and the output circuit is configured to output the memory address of the second logical address interval stored in the random access memory to the result address register when a logical "1" is received from the NOR gate, wherein the second logical address interval includes the second starting logical address to the second ending logical address. 如請求項1所述的主機命令的邏輯位址區間搜索裝置,包含:D正反器,包含第七輸入端和第四輸出端,其中,所述第七輸入端耦接所述第三輸出端,所述第四輸出端耦接所述匹配寄存器,所述第四輸出端設置以當所述第七輸入端接收到邏輯”0”時,輸出邏輯”0”給所述匹配寄存器,並且當所述第七輸入端接收到邏輯”1”時,輸出邏輯”1”給所述匹配寄存器。 The logical address interval search device of the host command as described in claim 1 comprises: a D flip-flop, comprising a seventh input terminal and a fourth output terminal, wherein the seventh input terminal is coupled to the third output terminal, the fourth output terminal is coupled to the matching register, and the fourth output terminal is configured to output a logical "0" to the matching register when the seventh input terminal receives a logical "0", and output a logical "1" to the matching register when the seventh input terminal receives a logical "1". 如請求項2所述的主機命令的邏輯位址區間搜索裝置,其中,當所述匹配寄存器儲存邏輯”0”時,表示所述第一開始邏輯位址至所述第一結束邏輯位址的第一邏輯位址區間的資料沒有暫存在所述隨機存取記憶體:以及其中,當所述匹配寄存器儲存邏輯”1”時,表示所述第一邏輯位址區間的全部或者部分資料暫存在所述隨機存取記憶體。 A logical address interval search device for host commands as described in claim 2, wherein, when the matching register stores a logical "0", it indicates that the data in the first logical address interval from the first start logical address to the first end logical address is not temporarily stored in the random access memory; and wherein, when the matching register stores a logical "1", it indicates that all or part of the data in the first logical address interval is temporarily stored in the random access memory. 如請求項2所述的主機命令的邏輯位址區間搜索裝置,包含:啟動寄存器,設置以讓處理單元設定以啟動所述主機命令的邏輯位址區間搜索裝置,並且在被設定時輸出致能訊號給所述D正反器,用於開始輸出訊號給所述匹配寄存器。 The logical address interval search device for host commands as described in claim 2 includes: an activation register, which is set to allow the processing unit to set to activate the logical address interval search device for the host commands, and when set, outputs an enable signal to the D flip-flop to start outputting a signal to the matching register. 如請求項4所述的主機命令的邏輯位址區間搜索裝置,包含:狀態寄存器,耦接所述啟動寄存器和所述或非閘,設置以在所述啟動寄存器被設定時,儲存邏輯”1”以代表所述主機命令的邏輯位址區間搜索裝置處於忙碌狀態;以及在所述或非閘輸出邏輯”1”時,儲存邏輯”0”以代表所述主機命令的邏輯位址區間搜索裝置處於空閒狀態。 The logical address interval search device for host commands as described in claim 4 comprises: a status register coupled to the activation register and the NOR gate, configured to store a logical "1" to represent that the logical address interval search device for host commands is in a busy state when the activation register is set; and to store a logical "0" to represent that the logical address interval search device for host commands is in an idle state when the NOR gate outputs a logical "1". 如請求項1所述的主機命令的邏輯位址區間搜索裝置, 其中,處理單元於執行主機命令時儲存所述第一開始邏輯位址到所述第一開始寄存器,以及儲存所述第一結束邏輯位址到所述第一結束寄存器;其中,第一邏輯位址區間包含所述第一開始邏輯位址至所述第一結束邏輯位址。 A logical address interval search device for a host command as described in claim 1, wherein the processing unit stores the first start logical address to the first start register and stores the first end logical address to the first end register when executing the host command; wherein the first logical address interval includes the first start logical address to the first end logical address. 如請求項4所述的主機命令的邏輯位址區間搜索裝置,包含:所述第一開始寄存器;以及所述第一結束寄存器。 The logical address interval search device of the host command as described in claim 4 comprises: the first start register; and the first end register. 如請求項1所述的主機命令的邏輯位址區間搜索裝置,包含:所述匹配寄存器;以及所述結果位址寄存器。 The logical address interval search device of the host command as described in claim 1 comprises: the matching register; and the result address register. 一種主機命令的邏輯位址區間搜索方法,包含:輸入第一邏輯位址區間,包含第一開始邏輯位址至第一結束邏輯位址;輸入第二邏輯位址區間,包含第二開始邏輯位址至第二結束邏輯位址,其中,所述第二邏輯位址區間的待寫入資料暫存在隨機存取記憶體,並且尚未寫入到閃存模組;當第一比較器偵測到所述第一結束邏輯位址不小於所述第二開始邏輯位址時,所述第一比較器輸出邏輯”0”給或非閘;當第二比較器偵測到所述第二結束邏輯位址不小於所述第一開始邏輯位址時,所述第二比較器輸出邏輯”0”給所述或非閘;當所述或非閘從所述第一比較器和所述第二比較器都接收到邏輯”0”時,輸出邏輯”1”給匹配寄存器,代表所述第一邏輯位址區間重疊於所述第二邏輯位址區間,用以通知處理單元所述第一邏 輯位址區間的全部或者一部分資料暫存於所述隨機存取記憶體;並且輸出邏輯”1”給輸出電路,用以讓所述輸出電路輸出所述隨機存取記憶體中儲存所述第二邏輯位址區間的記憶體位址至結果位址寄存器。 A method for searching a logical address interval of a host command comprises: inputting a first logical address interval, including a first starting logical address to a first ending logical address; inputting a second logical address interval, including a second starting logical address to a second ending logical address, wherein the data to be written in the second logical address interval is temporarily stored in a random access memory and has not yet been written to a flash memory module; when a first comparator detects that the first ending logical address is not less than the second starting logical address, the first comparator outputs a logical "0" to a NOR gate; when a second comparator detects that the second ending logical address is not less than the first starting logical address, the first comparator outputs a logical "0" to a NOR gate; when a second comparator detects that the second ending logical address is not less than the first starting logical address, the first comparator outputs a logical "0" to a NOR gate; When the first comparator receives a logical address, the second comparator outputs a logical "0" to the NOR gate; when the NOR gate receives a logical "0" from both the first comparator and the second comparator, it outputs a logical "1" to the matching register, indicating that the first logical address interval overlaps the second logical address interval, so as to notify the processing unit that all or part of the data in the first logical address interval is temporarily stored in the random access memory; and outputs a logical "1" to the output circuit, so as to allow the output circuit to output the memory address of the second logical address interval stored in the random access memory to the result address register. 如請求項9所述的主機命令的邏輯位址區間搜索方法,其中,當所述匹配寄存器儲存邏輯”0”時,表示所述第一邏輯位址區間的資料沒有暫存在所述隨機存取記憶體:以及其中,當所述匹配寄存器儲存邏輯”1”時,表示所述第一邏輯位址區間的全部或者部分資料暫存在所述隨機存取記憶體。 A method for searching a logical address interval of a host command as described in claim 9, wherein when the matching register stores a logical "0", it indicates that the data in the first logical address interval is not temporarily stored in the random access memory; and wherein, when the matching register stores a logical "1", it indicates that all or part of the data in the first logical address interval is temporarily stored in the random access memory. 如請求項9所述的主機命令的邏輯位址區間搜索方法,其中,所述第二邏輯位址區間的所述待寫入資料暫存在所述隨機存取記憶體中的資料緩存器。 A logical address interval search method for host commands as described in claim 9, wherein the data to be written in the second logical address interval is temporarily stored in a data cache in the random access memory. 如請求項9所述的主機命令的邏輯位址區間搜索方法,其中,所述第二邏輯位址區間儲存在所述隨機存取記憶體中的循序寫入佇列的項目。 A logical address interval search method for host commands as described in claim 9, wherein the second logical address interval is stored in an item of a sequential write queue in the random access memory.
TW111144899A 2022-11-24 2022-11-24 Method and apparatus for searching for logical address ranges of host commands TWI844174B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW111144899A TWI844174B (en) 2022-11-24 2022-11-24 Method and apparatus for searching for logical address ranges of host commands

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW111144899A TWI844174B (en) 2022-11-24 2022-11-24 Method and apparatus for searching for logical address ranges of host commands

Publications (2)

Publication Number Publication Date
TW202422345A TW202422345A (en) 2024-06-01
TWI844174B true TWI844174B (en) 2024-06-01

Family

ID=92540007

Family Applications (1)

Application Number Title Priority Date Filing Date
TW111144899A TWI844174B (en) 2022-11-24 2022-11-24 Method and apparatus for searching for logical address ranges of host commands

Country Status (1)

Country Link
TW (1) TWI844174B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070233933A1 (en) * 2005-12-28 2007-10-04 Jeremy Wang Hard disk drive cache memory and playback device
TW200745858A (en) * 2005-12-28 2007-12-16 Silicon Storage Tech Inc Unified memory and controller
US20090157946A1 (en) * 2007-12-12 2009-06-18 Siamak Arya Memory having improved read capability
TW201715401A (en) * 2015-10-29 2017-05-01 愛思開海力士有限公司 Data storage device and operating method thereof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070233933A1 (en) * 2005-12-28 2007-10-04 Jeremy Wang Hard disk drive cache memory and playback device
TW200745858A (en) * 2005-12-28 2007-12-16 Silicon Storage Tech Inc Unified memory and controller
TW200745851A (en) * 2005-12-28 2007-12-16 Silicon Storage Tech Inc Hard disk drive cache memory and playback device
US20090157946A1 (en) * 2007-12-12 2009-06-18 Siamak Arya Memory having improved read capability
TW201715401A (en) * 2015-10-29 2017-05-01 愛思開海力士有限公司 Data storage device and operating method thereof

Also Published As

Publication number Publication date
TW202422345A (en) 2024-06-01

Similar Documents

Publication Publication Date Title
CN112115067B (en) Flash memory physical resource set management device and method and computer readable storage medium
CN111897743B (en) Data storage device and loading method of logical-to-physical address mapping table
TWI668704B (en) Data management method and storage controller using the same
CN113778317B (en) Computer readable storage medium, method and device for scheduling host commands
CN115113799B (en) Host command execution method and device
CN108628754A (en) General and garbage collection data access method and device using same
CN108628543A (en) Garbage collection method and device using same
TWI844174B (en) Method and apparatus for searching for logical address ranges of host commands
TWI805505B (en) Method and computer program product and apparatus for scheduling and executing host data-update commands
CN114625307A (en) Computer readable storage medium, and data reading method and device of flash memory chip
TWI814647B (en) Method and computer program product and apparatus for executing host commands
CN115878022B (en) Method and device for writing data into flash memory
CN118193144A (en) Storage medium, method and device for executing host write command
CN118072792A (en) Logical address interval search method and device for host command
US12531125B2 (en) Method and non-transitory computer-readable storage medium and apparatus for executing host commands
TWI822517B (en) Method and computer program product and apparatus for executing host write commands
TWI822516B (en) Method and computer program product and apparatus for executing host write commands
CN111045961B (en) Data processing method and memory controller using the same
TWI810876B (en) Method and computer program product and apparatus for data access in response to host discard commands
TWI758745B (en) Computer program product and method and apparatus for scheduling executions of host commands
TWI818762B (en) Method and computer program product and apparatus for scheduling and executing host data-update commands
US20250123959A1 (en) Memory controllers and operation methods thereof and memory systems
US20250094053A1 (en) Memory controllers and operation methods thereof, memory systems, electronic devices
TWI835027B (en) Method and computer program product and apparatus for updating host-to-flash address mapping table
TWI906638B (en) Memory system and method performed thereby, controller and memory device