The present invention relates to a flash memory controller.
When original data of a flash memory module needs to be updated, a flash memory controller writes updated data whose logical address is the same as that of the original data into another physical address of the flash memory module, and the original data stored in the flash memory module becomes invalid data. Therefore, if the flash memory module stores the data that is accessed and updated by an operating system frequently (i.e. the data is regarded as hot data), because the data is constantly updated and written into different physical addresses of the flash memory module, the data written into the flash memory module becomes invalid in a short time. Therefore, garbage collections are performed more often to release the memory space, a write amplification factor of the data within the flash memory module is increased, and life of the flash memory module is influenced.
In addition, the flash memory module may have one or more types of blocks such as single-level cell (SLC) blocks, multi-level cell (MLC) blocks, triple-level cell (TLC) blocks and/or quadruple-level cell (QLC) blocks, where the TLC blocks and the QLC blocks have larger storage capacity and shorter life. Therefore, if the above-mentioned hot data that is updated frequently is stored in the TLC block or QLC block, the TLC block or the QLC block will have much invalid data that may trigger the garbage collection operation to move the valid data to another block and erase all of the contents within the original block to release the memory space. Because the TLC/QLC block has much smaller erase count or smaller program/erase cycle (P/E cycle), this frequent erase operations may worsen the life of the flash memory module.
It is therefore an objective of the present invention to provide a flash memory controller, which can determine that if data that is to be written into the flash memory module is hot or cold, and write the hot data and the cold data into the appropriate blocks, to solve the above-mentioned problems.
In a first embodiment of the present invention, a flash memory controller comprising an artificial intelligence (AI) module and a microprocessor is disclosed. In the operations of the flash memory controller, the AI module receives data from a host device, and determines if the data is hot data or cold data to generate a determination result. The microprocessor is configured to selectively write the data into a first block or a second block within a flash memory module according to the determination result, wherein quantity of bits stored in each memory cell within the first block is different from quantity of bits stored in each memory cell within the second block.
In a second embodiment of the present invention, a method for accessing a flash memory module is disclosed, wherein the method comprises the steps of: receiving data from a host device; determining if the data is hot data or cold data to generate a determination result; selectively writing the data into a first block or a second block within a flash memory module according to the determination result, wherein quantity of bits stored in each memory cell within the first block is different from quantity of bits stored in each memory cell within the second block.
In a third embodiment of the present invention, an electronic device comprising a flash memory module and a flash memory controller is disclosed, wherein the flash memory controller comprising an AI module and a microprocessor is disclosed. In the operations of the flash memory controller, the AI module receives data from a host device, and determines if the data is hot data or cold data to generate a determination result. The microprocessor is configured to selectively write the data into a first block or a second block within a flash memory module according to the determination result, wherein quantity of bits stored in each memory cell within the first block is different from quantity of bits stored in each memory cell within the second block.
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.
The flash memory module 130 comprises at least one flash memory chip, each flash memory chip comprises a plurality blocks, each block comprises a plurality of pages. In the designs of the flash memory, each block is a minimum erasing unit, that is all the data within the block must be erased together, and only deleting a portion of the data of the block is not allowed. In addition, each page is a minimum writing unit. In addition, the flash memory module 130 comprises a plurality of first blocks with longer life and a plurality of second blocks with shorter life. For the convenience of the following descriptions, the first blocks are SLC blocks 210_1-210_N, and the second blocks are TLC blocks 220_1-220_M shown in
In the operations of the electronic device 100, when the host device 110 needs to write data into the flash memory module 130, the host device 110 transmits a write command and the data to the interface circuit 121 of the flash memory controller 120. Then, the AI module 122 determines if the data belongs to hot data or cold data to generate a determination result, wherein the hot data means that the data is updated frequently such as the data of the operating system or file system, and the cold data means that the data is updated infrequently such as video data, photo, and file etc. Then, the microprocessor 124 refers to the determination result to selectively write the data into the SLC blocks 210_1-210_N or the TLC blocks 220_1-220_M. Specifically, if the determination result indicates that the data is the hot data, microprocessor 124 directly writes the data into the SLC blocks 210_1-210_N via an encoder and a randomizer within the control logic 129. If the determination result indicates that the data is the cold data, microprocessor 124 writes the data into the TLC blocks 220_1-220_M via the control logic 129.
In light of above, the hot data updated frequently is directly stored into the SLC blocks 210_1-210_N having longer life and more allowable erase count, therefore, most of the data stored in the SLC blocks 210_1-210_N are the hot data, and these hot data will be updated and becomes invalid accordingly. Because the storage capacity of each of the SLC blocks 210_1-210_N is less than the TLC block, if the flash memory controller 120 performs the garbage collection operations upon the SLC blocks 210_1-210_N later, the amount the valid data required to be moved is decreased (compared with the TLC blocks 220_1-220_M), and the write amplification factor will be decreased to extend the life of the flash memory module 130. In addition, because the cold data updated infrequently is directly written into the TLC blocks 220_1-220_M having shorter life but greater storage capacity, so the space of the flash memory module 130 can be used efficiently.
In one embodiment, the AI module 122 refers to a write frequency of the data to determine if the data belongs to the hot data or the cold data. For example, the AI module 122 may calculate the write frequency according to a write count of a logical address corresponding to the data within a past period of time (e.g. several hours or one day), and determines that the data is hot if the write frequency of the data is greater than a threshold, and determines that the data is cold if the write frequency of the data is not greater than the threshold. In another embodiment, the AI module 122 may refer to the logical address of the data to determine if the data is hot or cold. For example, if the logical address of the data is within some ranges, the AI module 122 determines that the data is the hot data; otherwise, the AI module 122 determines that the data is the cold data. In addition, the AI module 122 may refer to a type of the data to determine if the data belongs to the hot data or the cold data. For example, if the amount of the data is minimum amount transmitted by the host device 110 (e.g. 4 kilobyte), the AI module 122 determines that the data is hot; otherwise, the AI module 122 determines that the data is cold.
In one embodiment, the AI module 122 is trained to determine a plurality of decision logics when the flash memory controller 120 is in an off-line state, and the AI module 122 uses the plurality of decision logics to determine if the data belongs to the hot data or cold data to generate the determination result when the flash memory controller 120 is in an on-line state. For example, when the flash memory controller 120 is in the off-line state (i.e. the flash memory controller 120 does not connect to the flash memory module 130 yet), engineers can input the simulated system data or other hot data into the AI module 122 for the training operations to determine a portion of the decision logics, where the portion of the decision logics may be the threshold of the write frequency for determining the hot data, and/or characteristics of the logic addresses of the hot data, and/or the type of the hot data, and/or the data amount distribution of the hot data. Similarly, the engineers may input the simulated photo, video data or other cold data into the AI module 122 for the training operations to determine another portion of the decision logics, where the portion of the decision logics may be the threshold of the write frequency for determining the cold data, and/or characteristics of the logic addresses of the cold data, and/or the type of the cold data, and/or the data amount distribution of the cold data.
It is noted that the SLC blocks 210_1-210_N and the TLC blocks 220_1-220_M included in the flash memory module 130 shown in
Step 300: the flow starts.
Step 302: receive data from a host device.
Step 304: determine if the data is hot data or cold data to generate a determination result. When the determination result indicates that the data is the hot data, the flow enters Step 306; and if the determination result indicates that the data is the cold data, the flow enters Step 308.
Step 306: write the data into a block whose memory cell stores less bits.
Step 308: write the data into another block whose memory cell stores more bits.
Briefly summarized, in the flash memory controller of the present invention, the AI module is provided to determine if the data from the host device is hot or cold, and the microprocessor refers to the determination result of the AI module to write the hot data into the block whose memory cell stores less bits (e.g. SLC block), and write the cold data into the block whose memory cell stores more bits (e.g. TLC block). By using the embodiments of the present invention, the life of the flash memory module can be extended.
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 |
---|---|---|---|
201811028072.1 | Sep 2018 | CN | national |