Abstract:
A method for copying data in a non-volatile memory system is disclosed. The method includes calculating a number of errors of a first set of data from a source block of the non-volatile memory saved in the buffer of the controller, transmitting the first set of data saved in the buffer of the controller to a buffer of the non-volatile memory when the number of errors is lower than a threshold, and programming a destination block of the non-volatile memory with the first set of data saved in the buffer of the non-volatile memory when the number of errors is lower than the threshold.

Description:
BACKGROUND OF THE INVENTION  
       [0001]    1. Field of the Invention 
         [0002]    The present invention provides a method for copying data in a non-volatile memory system, and more particularly, a method for copying data in a non-volatile memory system with selective data correction. 
         [0003]    2. Description of the Prior Art 
         [0004]    A conventional non-volatile memory system comprises a controller and non-volatile memories. And the non-volatile memory system can be a flash memory system so that the flash memory system comprises a flash controller X and a flash memory Y. The flash controller X comprises an internal buffer W. The flash memory Y comprises an internal buffer Z. When the controller X copies data of a block A of the flash memory Y to another block B, the flash controller X has to do data correction on each page of the data stored in the block A, and then transmits the corrected data to the block B. 
         [0005]    The above-mentioned data copying is generally used when data of a block of the flash memory is amended. When a part of data of a block (such as a block A) needs to be amended, the flash memory controller X locates a new block (such as a block B) of the flash memory Y for inputting a part of data which needs to be amended, and then copy the data from the old block A, that need not be amended, into the new block B to complete the data amendment. 
         [0006]    Please refer to  FIG. 1 .  FIG. 1  is a flowchart illustrating a conventional method  100  for copying data of the flash memory system without using copy-back function (meaning the flash memory Y does not support copy-back command function or flash memory Y supports copy-back function, but doesn&#39;t use it). For brevity, it is assumed that the source of data is the block A, and the destination of data is the block B. The steps of the method  100  are described as follows: 
         [0007]    Step  101 : Start; 
         [0008]    Step  102 : The controller X uses read command to load data from the block A to the buffer Z; 
         [0009]    Step  103 : The data saved in the buffer Z is transmitted to the buffer W; 
         [0010]    Step  104 : The controller X determines if the data saved in the buffer W is correct; if yes, go to step  106 ; if not; go to step  105 ; 
         [0011]    Step  105 : The controller X corrects the data saved in the buffer W from the step  103 ; 
         [0012]    Step  106 : The controller transmits the corrected data in the buffer W to the buffer Z; 
         [0013]    Step  107 : The controller X programs the data saved in the buffer Z to the block B; 
         [0014]    Step  108 : End. 
         [0015]    The controller X repeats steps  102 ˜ 107  until all the pages of the block A are checked by the error correction code module (ECC module) and copied to the block B. 
         [0016]    In step  105 , the data correction process comprises 3 steps: A. Calculate the number of errors, B. Calculate the location and value of the errors, and C. Correct the data in the buffer W of the controller X according to the result of step B. 
         [0017]    Please refer to  FIG. 2 .  FIG. 2  is a flowchart illustrating a conventional method  200  for copying data of the flash memory system using copy-back function (meaning the flash memory Y supports copy-back command function and copy-back command is used). For brevity, it is assumed that the source of data is the block A, and the destination of data is the block B. The steps of the method  200  are described as follows: 
         [0018]    Step  201 : Start; 
         [0019]    Step  202 : The controller X uses copy-back read command to load data from the block A to the buffer Z; 
         [0020]    Step  203 : The data saved in the buffer Z is transmitted to the buffer W; 
         [0021]    Step  204 : The controller X determines if the data saved in the buffer W is correct; if yes, go to step  207 ; if not; go to step  205 ; 
         [0022]    Step  205 : The controller X corrects the data saved in the buffer W from the step  203 ; 
         [0023]    Step  206 : The controller X transmits the data in the buffer W to the buffer Z; 
         [0024]    Step  207 : The controller X programs the data saved in the buffer Z to the block B; 
         [0025]    Step  208 : End. 
         [0026]    The controller X repeats Steps  202 ˜ 207  until all the pages of the block A are checked by the error correction code module (ECC module) and copied to the block B. 
         [0027]    In step  205 , the data correction process comprises 3 steps: A. Calculate the number of errors, B. Calculate the location and value of the errors, and C. Correct the data in the buffer of the controller X according to the result of step B. 
         [0028]    In detail, in the method  100  and  200 , assuming each block comprises 64 pages, when the controller X copies data of the block A to the block B, the controller X has to program the flash memory for 64 times. Furthermore, if there are errors within the data, the controller X needs to correct the errors and re-input the corrected data into flash memory for program which is time-consuming and will decrease the performance of flash memory system. 
       SUMMARY OF THE INVENTION  
       [0029]    The present invention provides a method for copying data in a non-volatile memory system. The non-volatile memory system comprises a controller and a non-volatile memory. The method comprises calculating a number of errors of a first set of data from a source block of the non-volatile memory saved in the buffer of the controller, transmitting the first set of data saved in the buffer of the controller to a buffer of the non-volatile memory when the number of errors is lower than a threshold, and programming a destination block of the non-volatile memory with the first set of data saved in the buffer of the non-volatile memory when the number of errors is lower than the threshold. 
         [0030]    The present invention further provides a method for copying data in a non-volatile memory system. The non-volatile memory system comprises a controller and a non-volatile memory. The non-volatile memory supports copy-back function. The method comprises calculating a number of errors, error locations, and error values of a first set of data from a source block of the non-volatile memory saved in the buffer of the controller, correcting the first set of data saved in the buffer of the controller, and programming a destination block of the non-volatile memory with the first set of data saved in a buffer of the non-volatile memory when the number of errors is lower than a threshold. 
         [0031]    The present invention further provides a method for copying data in a non-volatile memory system. The non-volatile memory system comprises a controller and a non-volatile memory. The non-volatile memory supports copy-back function. The method comprises calculating a number of errors of a first set of data from a source block of the non-volatile memory saved in the buffer of the controller, and programming a destination block of the non-volatile memory with the first set of data saved in a buffer of the non-volatile memory when the number of errors is lower than a threshold. 
         [0032]    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. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS  
         [0033]      FIG. 1  is a flowchart illustrating a conventional method for copying data of the flash memory system without copy-back function. 
           [0034]      FIG. 2  is a flowchart illustrating a conventional method for copying data of the flash memory system with copy-back function. 
           [0035]      FIG. 3  is a flowchart illustrating a method for copying data of the flash memory system without copy-back function according to a first embodiment of the present invention. 
           [0036]      FIG. 4  is a flowchart illustrating a method for copying data of the flash memory system with copy-back function according to a second embodiment of the present invention. 
           [0037]      FIG. 5  is a flowchart illustrating a method for copying data of the flash memory system with copy-back function according to a third embodiment of the present invention. 
       
    
    
     DETAILED DESCRIPTION  
       [0038]    Please refer to  FIG. 3 .  FIG. 3  is a flowchart illustrating a method  300  for copying data of the flash memory system without using copy-back function according to a first embodiment of the present invention. For brevity, it is assumed that the source of data is the block A, and the destination of data is the block B. The steps of the method  300  are described as follows: 
         [0039]    Step  301 : Start; 
         [0040]    Step  302 : The controller X uses read command to load data from the block A to the buffer Z; 
         [0041]    Step  303 : The data saved in the buffer Z is transmitted to the buffer W; 
         [0042]    Step  304 : The controller X determines if the data saved in the buffer W is correct (from step  303 ); if yes, go to step  308 ; if no, go to step  305 ; 
         [0043]    Step  305 : The controller X calculates the number of errors N; 
         [0044]    Step  306 : The controller X determines if the number N is higher than a threshold Nt; if yes, go to step  307 ; if not, go to step  308 ; 
         [0045]    Step  307 : The controller X calculates error locations and error values and correct the data saved in the buffer W; 
         [0046]    Step  308 : The controller X transmits the data saved in the buffer W to the buffer Z; 
         [0047]    Step  309 : The controller X program the data saved in the buffer Z to the block B; 
         [0048]    Step  310 : End. 
         [0049]    The method  300  is only described with the copying steps for one page and the entire copy function for the block A to B is accomplished with repeating the method  300 . 
         [0050]    In the method  300 , when the number N of errors of the data is lower than the threshold Nt, the controller X does not have to calculate error location, error value, correct data (in step  307 ). And the data only has to be proceeded with data correction (in step  307 ) when the number N of error of the data is higher than the threshold Nt. Therefore, the steps  307  does not have to be executed each time. According to the prior art, the steps  307  cost the most working cycles. Therefore, the method  300  of the present invention reduces the entire working cycles of the copy function of the flash memory system, increasing the efficiency of the flash memory system. 
         [0051]    Please refer to  FIG. 4 .  FIG. 4  is a flowchart illustrating a method  400  for copying data of the non-volatile memory system using copy-back function according to a second embodiment of the present invention. For brevity, it is assumed that the source of data is the block A, and the destination of data is the block B. The steps of the method  400  are described as follows: 
         [0052]    Step  401 : Start; 
         [0053]    Step  402 : The controller X uses copy-back read command to load data from the block A to the buffer Z; 
         [0054]    Step  403 : The data saved in the buffer Z is transmitted to the buffer W; 
         [0055]    Step  404 : The controller X determines if the data saved in the buffer W is correct (from step  403 ); if yes, go to step  408 ; if no, go to step  405 ; 
         [0056]    Step  405 : The controller X calculates the number of errors N, error locations, and error values, and corrects the data saved in the buffer W; 
         [0057]    Step  406 : The controller X determines if the number N is higher than a threshold Nt; if yes, go to step  407 ; if not, go to step  408 ; 
         [0058]    Step  407 : The controller X transmits the data saved in the buffer W to the buffer Z; 
         [0059]    Step  408 : The controller X programs the data saved in the buffer Z to the block B; 
         [0060]    Step  409 : End. 
         [0061]    The method  400  is only described with the copying steps for one page and the entire copy function for the block A to B is accomplished with repeating the method  400 . 
         [0062]    In the method  400 , when the number N of errors of the data is lower than the threshold Nt, the step  407  can be skipped. Therefore, the step  407  does not have to be executed each time. Therefore, the method  400  of the present invention reduces the entire working cycles of the copy function of the flash memory system, increasing the efficiency of the flash memory system. 
         [0063]    Please refer to  FIG. 5 .  FIG. 5  is a flowchart illustrating a method  500  for copying data of the non-volatile memory system using copy-back function according to a third embodiment of the present invention. For brevity, it is assumed that the source of data is the block A, and the destination of data is the block B. The steps of the method  500  are described as follows: 
         [0064]    Step  501 : Start; 
         [0065]    Step  502 : The controller X uses copy-back read command to load data from the block A to the buffer Z; 
         [0066]    Step  503 : The data saved in the buffer Z is transmitted to the buffer W; 
         [0067]    Step  504 : The controller X determines if the data saved in the buffer W is correct (from step  503 ); if yes, go to step  509 ; if no, go to step  505 ; 
         [0068]    Step  505 : The controller X calculates the number of errors N; 
         [0069]    Step  506 : The controller X determines if the number N is higher than a threshold Nt; if yes, go to step  507 ; if not, go to step  509 ; 
         [0070]    Step  507 : The controller X calculates error locations and error values, and corrects the data saved in the buffer W; 
         [0071]    Step  508 : The controller X transmits the data saved in the buffer W to the buffer Z; 
         [0072]    Step  509 : The controller X programs the data saved in the buffer Z to the block B; 
         [0073]    Step  510 : End. 
         [0074]    The method  500  is only described with the copying steps for one page and the entire copy function for the block A to B is accomplished with repeating the method  500 . 
         [0075]    In the method  500 , when the number N of errors of the data is lower than the threshold Nt, the controller X does not have to calculate error location, error value, correct data (in step  507 ). And the data only has to be proceeded with data correction (in step  507 ) and to be transmitted from the buffer W to the buffer Z when the number N of error of the data is higher than the threshold Nt. In other words, the steps  507  and  508  can be skipped when the number N of errors of the data is lower than the threshold Nt. Therefore, the steps  507  and  508  do not have to be executed each time. According to the prior art, the steps  507  cost the most working cycles. Therefore, the method  500  of the present invention reduces the entire working cycles of the copy function of the flash memory system, increasing the efficiency of the flash memory system. 
         [0076]    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.