Abstract:
A data programming method for a data programming device having a non-volatile memory and a volatile memory, the method comprising determining whether data exceeds one page; if the data does not exceed one page and is insufficient for one page, storing the data into the volatile memory; determining whether next data is to be programmed into the same page as the data stored in the volatile memory; if the next data is to be programmed into the same page as the data stored in the volatile memory, programming the data and the next data into the non-volatile memory.

Description:
CROSS REFERENCE TO RELATED APPLICATIONS 
       [0001]    This application is a continuation of U.S. patent application Ser. No. 12/244,131, filed on Oct. 2, 2008, which claims the benefit of Taiwan application Serial No. 97126262 filed Jul. 11, 2008, the subject matter of which is incorporated herein by reference. 
     
    
     BACKGROUND OF THE INVENTION 
       [0002]    1. Field of the Invention 
         [0003]    The invention relates to a data programming method, and more particularly to a data programming method for reducing the time it takes for programming. 
         [0004]    2. Description of the Related Art 
         [0005]      FIG. 1  is a diagram of a conventional memory structure. A non-volatile memory, such as a flash memory, comprises at least one memory unit  100 , and the memory unit  100  comprises 1024 memory blocks Block 0 -Block 1023 . Each memory block comprises 64 pages, and each page comprises four sectors. As shown in  FIG. 1 , the memory block BlockM comprises 64 pages Page 0 -Page 63 , and the page PageN comprises four sectors Sector 0 -Sector 3 , wherein M is a positive integer from 0 to 1023, and N is a positive integer from 0 to 63. Each sector has 512-byte storage space, and one page is a unit for data programming. 
         [0006]    It is assumed that a conventional memory unit desires to program two data in the same page. The memory unit first receives first data to be programmed into the page Page 0  of the memory block BlockM. If the page Page 0  is empty, the memory unit programs the first data into the page Page 0 . After, when the memory unit receives second data to be programmed into the page Page 0 , the data of the other pages (such as Page 1 -Page 63 ) are backed up into volatile memory (not shown in  FIG. 1 ) or other memory blocks, and then the entire memory block BlockM is erased. Finally, the second data is programmed into the page Page 0  of the memory block BlockM, and the un-changed data is programmed back into the memory block BlockM from the volatile memory (not shown in  FIG. 1 ) or the other memory blocks. Since the time period taken by the memory unit to erase data is longest and next longest time period taken is the time period taken by the memory unit to program data, the time it takes for erasing data from the pages and programming data into pages can be decreased for shortening the time period for data programming. 
       BRIEF SUMMARY OF THE INVENTION 
       [0007]    An exemplary embodiment of a data programming method comprises the steps: (A) determining whether data exceeds one page; (B) if the data exceeds one page, programming a first portion of the data into a non-volatile memory and storing a second portion of the data, which is insufficient for one page, into a volatile memory; (C) if the data does not exceed one page, storing the data insufficient for one page into the volatile memory; (D) determining whether a next data is programmed into the same page as the data; (E) if the next data is programmed into the same page as the data, performing the step (A); and (F) if the next data is not programmed into the same page as the data, programming the second portion of data into the non-volatile memory and performing the step (A). 
         [0008]    An exemplary embodiment of a data programming device comprises a non-volatile memory, a volatile memory, and a memory control unit. The non-volatile memory is arranged for programming data. The volatile memory is arranged for temporarily storing data. The memory control unit is arranged for receiving data and determining whether the data is programmed into the non-volatile memory or stored into the volatile memory. If the data exceeds one page, the memory control unit programs a first portion of the data into the non-volatile memory and stores a second portion of the data, which is insufficient for one page, into the volatile memory. 
         [0009]    A detailed description is given in the following embodiments with reference to the accompanying drawings. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0010]    The invention can be more fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein: 
           [0011]      FIG. 1  is a diagram of a conventional memory structure; 
           [0012]      FIG. 2  shows an exemplary embodiment of a data programming device; 
           [0013]      FIG. 3  is a flow chart of an exemplary embodiment of a data programming method. 
       
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
       [0014]    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. 
         [0015]      FIG. 2  shows an exemplary embodiment of a data programming device  200 . The data programming device  200  comprises a memory control unit  210  and a memory unit  220 . The memory control unit  210  comprises a non-volatile memory  230  and a volatile memory  240 . In an embodiment, the volatile memory  240  is implemented by a cache memory, and the non-volatile memory  230  is implemented by a NAND flash memory. In another embodiment, the non-volatile memory  230  comprises at least one single-level cell (SLC), at least one multi-level cell (MLC), or a combination of at least one SLC and at least one MLC. The data programming device  200  can be a solid state drive (SSD) or a memory card device. According to memory specifications, if the number of programs (NOP) is equal to 1, each page of a memory programs data once after the page has been erased. Since the time period for erasing data is longest and the next longest time period is the time period for programming data for pages of a non-volatile memory, decreasing the times of erasing data or programming data for pages of a non-volatile is an objective of the present invention. 
         [0016]    In one embodiment, the memory control unit  210  receives data and a logic address from a host (not shown in  FIG. 2 ) and determines the data to be stored into the cache memory  240  or programmed into the flash memory  230  according to the logic address and the data length. If the data length exceeds one page, the memory control unit  210  programs the data into the flash memory  230 . In other words, the data of at least one page is programmed into the flash memory  230 , and the remaining data which is insufficient for one page is programmed into the cache memory  240 . If data is insufficient for one page, the memory control unit  210  stores the data insufficient for one page into the cache memory  240  and then determines whether the next data is to be programmed into the same page as the data already programmed into the cache memory  240 . If the next data is not determined to be suitable for programming into the same page as the data already stored in the cache memory  240 , the memory control unit  210  switches the data of the cache memory  240  to be programmed into the flash memory  230  and determines whether the next data exceeds one page to determine whether the next data should be programmed into to the flash memory  230 . If the next data is determined to be programmed into the same page as the data already programmed into the cache memory  240 , the memory control unit  210  determines whether the remaining data (in the cache memory  240 ) plus the next data exceeds one page to determine whether the remaining data plus the next data is programmed into to the flash memory  230 . Moreover, if the time period when the memory control unit  210  is waiting to program data exceeds a predetermined time period, the memory control unit  210  directly programs the remaining data of the cache memory  240  into the flash memory  230 . A data programming method in the memory is described in detail by the following embodiments. 
         [0017]      FIG. 3  is a flow chart of an exemplary embodiment of a data programming method. When the time period when the memory control unit  210  is waiting to program data exceeds a predetermined time period (step S 310 ), the memory control unit  210  finishes the data programming process. If the memory control unit  210  receives data in the predetermined time period, the memory control unit  210  determines that all data exceeds one page (step S 320 ). If all the data exceeds one page, the data of N pages is programmed into the flash memory  230  (step S 330 ), and the remaining data which is insufficient for one page is stored into the cache memory  240  (step S 340 ). If all the data is insufficient for one page, the memory control unit  210  stores the data insufficient for one page into the cache memory  240  (step S 340 ). Next, the memory control unit  210  waits for a next data. If the time for waiting for a next data exceeds the predetermined time period (step S 350 ), the memory control unit  210  programs the data of the cache memory  240  into the flash memory  230  (step S 360 ). If the memory control unit  210  receives the next data in the predetermined time period, the memory control unit  210  determines whether the next data is determined to be programmed into the same page as the remaining data already stored into the cache memory  240  (step S 370 ). If the next data should be programmed into the same page as the data of the cache memory  240 , the process proceeds to the step S 320  to determine whether the remaining data plus the next data exceeds one page or not. If the next data should not programmed into the same page as the data of the cache memory  240 , the memory control unit  210  programs the remaining data of the cache memory  240  into the flash memory  230  (step S 380 ), and the process proceeds to the step S 320  to determined whether all the data exceeds one page. 
         [0018]    According to the embodiments, the data insufficient for one page is stored into the cache memory  240 , and then, when all the data exceeds one page, the data of the cache memory is programmed into the flash memory  230 . Thus, the time period for programming and erasing data of the flash memory  230  is decreased, resulting in a shortened time period for programming data of the memory unit  100 . 
         [0019]    While the invention has been described by way of example and in terms of the preferred embodiments, it is to be understood that the invention is not limited to the disclosed embodiments. 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.