1. Field of the Invention
The present disclosure relates generally to memory control, and more specifically, to a page-level memory control method and related circuit.
2. Description of the Prior Art
Recently, Solid State Drives (SSD) (e.g. NAND flash memories) have consolidated their positions in the storage media market, and have been widely employed on personal computers and a variety of portable devices. Compared with conventional hard disk drives, the SSDs have no requirements with respect to any mechanical components, and are therefore free from latency caused by disk spin for searching data. As a result, the SSD consumes less power compared with conventional hard disk. However, the performance of a flash memory maybe affected by data payloads. For instance, there is performance discrepancy between a random read/write of the SSD and continuous read/write of the SSD. The Flash Translation Layer (FTL) is responsible for the translation between a virtual address and a physical address. Thus, the design of the FTL is critical to the performance of the SSD.
In conventional designs, a random access memory (RAM) is applied to an FTL to buffer a mapping table arranged to record the translation between virtual addresses and physical addresses. However, the size of the embedded RAM in the FTL grows as the capacity of the flash memory grows. Especially, if a relatively small page-level unit is employed by the FTL for address mapping, the chip size and production cost will rapidly increase. Hence, to cut down the hardware requirement for the RAM in the SSD system while maintaining SSD's random read/write performance, there is a need for a novel page-level memory control method.
Therefore, one of the objectives of the present invention is to provide a page-level memory control method and related circuit, to solve the aforementioned problem.
According to a first aspect of the present invention, an exemplary memory control method is disclosed. The exemplary memory control method includes: writing a write-in data which has a logical address into a write-in cache buffer; generating a write-in address mapping table which maps the logical address of the write-in data to a physical address of a main memory, and writing the write-in address mapping table into a cached data mapping table write buffer; writing the write-in data into the main memory according to the write-in address mapping table; and when an available storage space of the cached data mapping table write buffer is reduced to reach a predetermined threshold, writing the write-in address mapping table in the cached data mapping table write buffer into the main memory, and storing a corresponding main memory write-in address mapping table into a global mapping table buffer.
According to a second aspect of the present invention, an exemplary memory control method is disclosed. The exemplary memory control method includes: searching in a cached data mapping table write buffer for a read-out address mapping table which maps a logical address of a read-out data desired to be read to a physical address in a main memory; and when the read-out address mapping table is buffered in the cached data mapping table write buffer, reading the read-out data having the physical address from the main memory and writing the read-out data into a read-out cache buffer.
According to a third aspect of the present invention, an exemplary memory control circuit is disclosed. The exemplary memory control circuit includes a write-in cache buffer, a cached data mapping table write buffer, and a global mapping table buffer. The write-in cache buffer is arranged for buffering a write-in data having a logical address. The cached data mapping table write buffer is arranged for buffering a write-in address mapping table which maps the logical address of the write-in data to a physical address of a main memory. The global mapping table buffer is arranged for buffering a main memory write-in address mapping table corresponding to the write-in address mapping table of the cached data mapping table write buffer that is written into the main memory when an available storage space of the cached data mapping table write buffer is reduced to reach a predetermined threshold.
According to a fourth aspect of the present invention, an exemplary memory control circuit is disclosed. The exemplary memory control circuit includes a cached data mapping table read buffer, a read-out cache buffer, and a global mapping table buffer. The cached data mapping table read buffer is arranged for buffering a read-out address mapping table which maps a logical address of a read-out data desired to be read to a physical address of a main memory. The read-out cache buffer is arranged for buffering the read-out data having the physical address read from the main memory. The global mapping table buffer is arranged for obtaining the read-out address mapping table from the main memory.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
Certain terms are used throughout the description and following claims to refer to particular components. As one skilled in the art will appreciate, manufacturers may refer to a component by different names. This document does not intend to distinguish between components that differ in name but not function. In the following description and in the claims, the terms “include” and “comprise” are used in an open-ended fashion, and thus should be interpreted to mean “include, but not limited to . . . ”. Also, the term “couple” is intended to mean either an indirect or direct electrical connection. Accordingly, if one device is coupled to another device, that connection may be through a direct electrical connection, or through an indirect electrical connection via other devices and connections.
Please refer to
Step 100: write a write-in data which has a logical address into a write-in cache buffer;
Step 102: generate a write-in address mapping table which maps the logical address of the write-in data to a physical address of a main memory, and write the write-in address mapping table into a cached data mapping table write buffer;
Step 104: write the write-in data into the main memory according to the write-in address mapping table; and
Step 106: when an available storage space of the cached data mapping table write buffer is reduced to reach a predetermined threshold, write the write-in address mapping table in the cached data mapping table write buffer into the main memory, and store a corresponding main memory write-in address mapping table into a global mapping table buffer.
Regarding the memory control method for writing data into a memory as shown in
The size of the cached data mapping table write buffer 314 of the present invention is 64k bytes, wherein 4 bytes are arranged to act as the Physical Page Number (PPN); however, this is for illustrative purposes only, and is not meant to be a limitation of the present invention. If the available space of the cached data mapping table write buffer 314 is reduced to reach a write-in predetermined threshold T1, the write-in address mapping table in the cached data mapping table write buffer 314 will be grouped by a fixed number (e.g. 2048) of logically consecutive mappings in a page and then written into the NAND flash memory 322. Next, a corresponding main memory write-in address mapping table will be recorded and buffered in the global mapping table buffer 316 lastly, i.e. step 106. Please note that, in this embodiment, one-thousandth of the capacity of the NAND flash memory 322 (which is not a limitation of the present invention) is preserved for the write-in address mapping table. However, when writing the write-in address mapping table of the cached data mapping table write buffer 314 into the NAND flash memory 322, there is no need to write the write-in address mapping table into a specific region distinct from a normal region for normal data in the main memory. In other words, when the write-in address mapping table is stored into the NAND flash memory 322, the stored write-in address mapping table may be mixed with the stored normal data (i.e. the write-in address mapping table can be treated as a normal data). When the write-in address mapping table needs to be referenced, the corresponding write-in address mapping table can be found in accordance with the main memory write-in address mapping table buffered in the global mapping table buffer 316. In this way, it can prevent a certain region in the NAND flash memory 322 from being accessed frequently to have the number of access times higher than that of other regions, thus avoiding the wearing out of the lifetime of the certain region. In another aspect, in the conventional designs, all the write-in address mapping tables are required to be buffered in a buffer memory. However, along with the increasing size of the main memory, the size of the buffer memory tends to be increased to be couples or hundreds of MBytes. The present invention borrows a small part of the capacity from the NAND flash memory 322, which not only brings flexibility for hardware design but also dramatically cuts down the production cost.
Please refer to
Step 200: search in a cached data mapping table write buffer for an read-out address mapping table which maps a logical address of a data to a physical address in a main memory;
Step 202: when the read-out address mapping table is buffered in the cached data mapping table write buffer, read the data having the physical address from the main memory and write the data into a read-out cache buffer;
Step 204: when the read-out address mapping table is not buffered in the cached data mapping table write buffer, search in a cached data mapping table read buffer;
Step 206: when the read-out address mapping table is buffered in the cached data mapping table read buffer, read the data having the physical address from the main memory and write the data into the read-out cache buffer;
Step 208: when the read-out address mapping table is not buffered in the cached data mapping table write buffer and the cached data mapping table read buffer, search in a global mapping table buffer; and
Step 210: write the read-out address mapping table read from the main memory into the cached data mapping table read buffer through the global mapping table buffer; and read the data having the physical address from the main memory and then write the data into the read-out cache buffer.
Similarly, please refer to
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
102118632 | May 2013 | TW | national |
This application claims the benefit of U.S. provisional application No. 61/673,706, filed on Jul. 19, 2012 and incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
61673706 | Jul 2012 | US |