This Application claims priority of Taiwan Patent Application No. 97139710, filed on Oct. 16, 2008, the entirety of which is incorporated by reference herein.
1. Field of the Invention
The invention relates to flash memories, and more particularly to writing data to flash memories.
2. Description of the Related Art
Presently available flash memories are divided into two categories. One category is referred to as single-level-cell (SLC) flash memories, and the other category is referred to as multiple-level-cell (MLC) flash memories. A single-level-cell flash memory comprises a plurality of blocks, wherein each of the blocks comprises a plurality of memory cells, and each of the memory cells only stores one-bit data. A multiple-level-cell flash memory also comprises a plurality of blocks, wherein each of the blocks comprises a plurality of memory cells, and each of the memory cells stores data of multiple bits.
Because memory cells of a single-level-cell memory store only one-bit data, a single-level-cell memory has a smaller data capacity than that of a multiple-level-cell memory. A single-level-cell memory, however, has a faster access speed and a higher endurable writing frequency than those of a multiple-level-cell memory. The single-level-cell memory and the multiple-level-cell memory therefore have different advantages suitable for different applications, and a system can determine which of a single-level-cell memory and a multiple-level-cell memory is chosen for data storage according to an application style thereof to improve performance of the system.
A conventional flash memory apparatus comprises only one of a single-level-cell memory and a multiple-level-cell memory. If a flash memory apparatus comprises both a single-level-cell memory and a multiple-level-cell memory, the flash memory apparatus can provide both advantages of the single-level-cell memory and the multiple-level-cell memory, such as large data capacity, fast access speed, and high endurable writing frequency. The flash memory apparatus comprising both a single-level-cell memory and a multiple-level-cell memory, however, is more complex and difficulty arises when accessing the two kinds of flash memories with different properties. Meanwhile, because the single-level-cell memory and the multiple-level-cell memory have different properties, the flash memory apparatus is required to determine whether data is stored in the single-level-cell memory or the multiple-level-cell memory according to the properties thereof. A method for operating a flash memory apparatus comprising both a single-level-cell memory and a multiple-level-cell memory is therefore provided.
The invention provides a method for operating a flash memory apparatus. In one embodiment, the flash memory apparatus comprises a single-level-cell memory and a multiple-level-cell memory. First, new data for updating a logical block address is received from a host. An update count corresponding to the logical block address is then compared with a threshold value. When the update count is greater than the threshold value, it is determined whether a first physical block address corresponding to the logical block address is pointing to a multiple-level-cell block of the multiple-level-cell memory. When the first physical block address is pointing to the multiple-level-cell block, a target single-level-cell block is then selected from the single-level-cell memory. A corresponding relationship between the logical block address and a second physical block address of the target single-level-cell block is then built. The new data is then written to the target single-level-cell block with the second physical block address.
The invention provides a flash memory apparatus. In one embodiment, the flash memory apparatus comprises a single-level-cell memory, a multiple-level-cell memory, and a controller. The single-level-cell memory comprises a plurality of single-level-cell blocks. The multiple-level-cell memory comprises a plurality of multiple-level-cell blocks. The controller receives new data for updating a logical block address from a host, compares an update count corresponding to the logical block address with a threshold value, determines whether a first physical block address corresponding to the logical block address is pointing to a multiple-level-cell block of the multiple-level-cell memory when the update count is greater than the threshold value, selects a target single-level-cell block from the single-level-cell memory when the first physical block address is pointing to the multiple-level-cell block, establishes a corresponding relationship between the logical block address and a second physical block address of the target single-level-cell block, and writes the new data to the target single-level-cell block with the second physical block address.
A detailed description is given in the following embodiments with reference to the accompanying drawings.
The invention can be more fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein:
The following description is of the best-contemplated mode of carrying out the invention. This description is made for the purpose of illustrating the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims.
Referring to
Referring to
In addition, two series of physical block addresses, comprising the physical block addresses 210 of the multiple-level-cell memory 110 and the physical block addresses 208 of the single-level-cell memory 108, coexist in the flash memory apparatus 104, thus complicating addressing in data accessing. For simplicity, the physical block addresses 210 of the single-level-cell memory 108 are virtually combined with the physical block addresses 208 of the multiple-level-cell memory 110 to form a series of virtual physical block addresses 204. In one embodiment, the controller 106 converts the physical block addresses 210 of the single-level-cell memory 108 to virtual physical block address 206 with the same format with the physical block addresses 208 of the multiple-level-cell memory 110, and the physical block addresses 208 of the multiple-level-cell memory 110 are the virtual physical block addresses 208 of the multiple-level-cell memory 110 without conversion.
For example, the physical block addresses SPBA0˜SPBAz of the single-level-cell memory 108 are converted to virtual physical block address MPBA0˜MPBAx with the same format with the physical block addresses MPBAx−1˜MPBAy of the multiple-level-cell memory 110. In addition, the virtual physical block addresses MPBA0˜MPBAx of the single-level-cell memory 108 have prior address sequence in the series, and the virtual physical block addresses MPBAx+1˜MPBAy of the multiple-level-cell memory 110 have subsequent sequence in the series. In one embodiment, the controller 106 records corresponding relationships between all logical block addresses LBA0˜LBAk and all virtual physical block addresses MPBA0˜MPBAy in an address link table. In another embodiment, the controller 106 also stores a corresponding relationship between the virtual physical block addresses MPBA0˜MPBAx and the physical block addresses SPBA0˜SPBAz of the single-level-cell memory 108 in an address conversion table.
Referring to
When the update count corresponding to the logical block address is greater than a threshold value (step 306), the logical block address to be updated has a high update frequency, and a block of the single-level-memory 108 is suitable for holding data with the logical block address. The controller 106 then determines a first physical block address corresponding to the logical block address (step 308), and then determines whether the first physical block address is pointing to a multiple-level-cell block of the multiple-level-cell memory 110 (step 310). In one embodiment, an address link table of the controller 106 records corresponding relationships between all logical block addresses and physical block addresses, and the controller 106 can look up the first physical block address in the address link table according to the logical block address in step 308. Because the physical block addresses 204 of the single-level-cell memory 108 has a prior sequence and the physical block addresses 208 of the multiple-level-cell memory 110 has a subsequent sequence as shown in
Because the single-level-cell memory 108 has a faster access speed and a higher endurable writing frequency than the multiple-level-cell memory 110, data with a high update count is suitable to be stored in the single-level-cell memory 108. If the first physical block address is pointing to a multiple-level-cell block of the multiple-level-cell memory 110 in step 310, the controller 106 stores the new data with a high update count in the single-level-cell memory 108 instead of the multiple-level-cell memory 110. The controller 106 therefore selects a single-level-cell block from the single-level-cell memory 108 (step 312), establishes a corresponding relationship between the logical block address of the new data and a second physical block address of the single-level-cell block (step 314), and then writes the new data to the single-level-cell block with the second physical block address (step 316). In one embodiment, an address link table of the controller 106 records corresponding relationships between all logical block addresses and physical block addresses, and the controller 106 modifies the address link table according to the logical block address and the second physical block address to establish the corresponding relationship therebetween in step 314.
The controller 106 can select a target single-level-cell block for storing the new data from the single-level-cell memory 108 in a variety of ways in step 312. In one embodiment, the controller 106 first determines update counts of a plurality of single-level-cell blocks of the single-level-cell memory 108, and then selects a single-level-cell block with a smallest update count from the plurality of single-level-cell blocks as the target single-level-cell block. In another embodiment, the controller 106 first determines update counts of a plurality of single-level-cell blocks of the single-level-cell memory 108, and then selects a single-level-cell block with an update count smaller than a threshold number from the plurality of single-level-cell blocks as the target single-level-cell block.
After the controller 106 selects the target single-level-cell block for storing the new data in step 312, the controller 106 must further determine whether old data has been stored in the target single-level-cell block. If so, the controller 106 has to make a backup copy of the old data before the new data is written to the target single-level-cell block in step 316. After the new data is written to the target single-level-cell block in step 316, the controller 106 then modifies the address link table to establish a corresponding relationship between a logical block address previously corresponding to the target single-level-cell block and the first physical block address of the multiple-level-cell block. The controller 106 then writes the old data to the multiple-level-cell block with the first physical block address. The old data previously stored in the target single-level-cell block is finally stored in the multiple-level-cell block, and the new data formerly determined to be stored in the multiple-level-cell block is finally stored in the target single-level-cell block, completing data exchange between the target single-level-cell block and the multiple-level-cell block.
In addition, because the single-level-cell memory 108 is suitable for storing data with a high update count, when the update count corresponding to the logical block address is not greater than the threshold value in step 306, the controller 106 does not differentiate whether a block corresponding to the logical block address belongs to the single-level-cell memory 108 or the multiple-level-cell memory 110 in steps 308 and 310, and directly writes the new data to the block corresponding to the logical block address (step 307). Accordingly, when the first physical block address is pointing to a single-level-cell block of the single-level-cell memory 108 in step 310, the controller 106 directly writes the new data to the single-level-cell block with the first physical block address in step 318 without further performing the steps 312˜316.
Referring to
The multiple-level-cell memory 404 comprises Y multiple-level-cell blocks respectively corresponding to logical block addresses MLBA0˜MLBAY. The multiple-level-cell block corresponding to the logical block address MLBA0 stores data DI and has an update count of 50. The multiple-level-cell block corresponding to the logical block address MLBA1 stores data DJ and has an update count of 199. The multiple-level-cell block corresponding to the logical block address MLBA2 stores data DK and has an update count of 80. The multiple-level-cell block corresponding to the logical block address MLBAY stores no data and has an update count of 0.
Referring to
Referring to
While the invention has been described by way of example and in terms of preferred embodiment, it is to be understood that the invention is not limited thereto. To the contrary, it is intended to cover various modifications and similar arrangements (as would be apparent to those skilled in the art). Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements.
Number | Date | Country | Kind |
---|---|---|---|
97139710 | Oct 2008 | TW | national |
This application claims the benefit of U.S. Provisional Application No. 61/073,784, filed on Jun. 19, 2008, the entirety of which is incorporated by reference herein.
Number | Date | Country | |
---|---|---|---|
61073784 | Jun 2008 | US |