Storage device and data storage method

A storage device adapted for receiving input data which includes a plurality of data units and each data unit includes a plurality of bits, includes a statistics unit computing a difference between “0” and “1” in each bit of the data units of the input data and providing a statistic result, a calculation unit producing transferable data according to the statistic result, and a transferring unit transferring the input data into programming data according to the transferrable data and storing the programming data and the transferrable data in the storage device.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention is related to a storage device and a data storage method, and more particularly to a non-volatile storage device and corresponding data storage method.

2. Description of the Related Art

With the increasing of the capacity of the flash memory and the decreasing of the price thereof, the Flash Memory device as of storage media is applicable in more environments. However, the reliability of the Flash Memory is lowered with the increased capacity of the Flash Memory. Accordingly, the research on the reliability of data storage via Flash Memory is more important to the research and development engineers.

A power supply unit of the Flash Memory will provide suitable voltage to the bit line and corresponding word line on the Flash Memory array when read/write Flash Memory. Due to the relationship between the structure of the memory cells array of the Flash Memory and the structure of the memory cell itself, memory cells are possibly affected by neighbored, charging/discharging memory cells which result in the quantity of electric charges stored in some memory cells is incorrect. Especially, when read/write some special data pattern (such as the data pattern with more “0”or the data pattern with more “1”), those neighbored memory cells are subject to disturbance which in turn affects correctness of storing the data in the Flash Memory.

Detailed structure and disturbs theory can be found in US Publication Nos. 20080065813, 20080205145 and 20080215798, all of which disclose programming methods for solving the reliability of storing data in Flash Memory. The main operating principle of these programming methods is to change the source into the random data pattern or avoids writing the data pattern with more “0”. However, these operating methods require complex managing methods for changing the source data to the random data pattern. Obviously, it is not efficient.

Hence, it is desired to provide a storage device with improved data storage reliability and corresponding data storage method to solve the above-described problems.

SUMMARY OF THE INVENTION

Accordingly, an objective of the present invention is to provide a storage device and a storage method which have reliable data storage.

A storage device in accordance with the present invention is adapted for receiving input data which includes a plurality of data units and each data unit includes a plurality of bits. The storage includes a statistics unit computing a difference between “0” and “1” in each bit of the data units of the input data and providing a statistic result, a calculation unit producing transferable data according to the statistic result, and a transferring unit transferring the input data into programming data according to the transferrable data and storing the programming data and the transferrable data in the storage device.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Reference will now be made in the detail to the preferred embodiments of the invention. While the present invention has been described with reference to a few specific embodiments, the description is illustrative of the invention and is not to be construed as limiting the invention. Various modifications to the present invention can be made to the preferred embodiments by those skilled in the art without departing from the true spirit and scope of the invention as defined by the appended claims.

Referring toFIG. 1, a storage device in accordance with the present invention comprise a controller11and a flash memory13. The controller11comprises a statistics unit111, calculation unit113, transferring unit115, a temporary storage unit117, system interface118and memory interface119. The system interface118is used to transfer orders or data between the storage device1and a host computer. The memory interface119is used to transfer orders or data between the controller11and the flash memory13.

Input data received by the storage device1includes one or more data units, each unit having a plurality of bits. For example, the data unit can be one byte and each byte has eight bits. Transferrable data is generated by compiling and calculating the input data. After the statistics, the input data is transferred to the programming data, in which the numeral difference between “0” and “1” is minimum. The transferrable data can be N bits data and N can be 4, 8, 16 or more, which depends on the requirement of precision or limitation to calculating capacity and the hardware. Every N bits from M bytes input data can be calculated with the transferrable data. After M/N times calculation, the M bytes input data is transferred to the programming data, in which the numeral difference between “0” and “1” is minimum. Understandably, M could be 512 or more.

In order to clearly illustrate the transferring method of the input data, an input data with 512 bytes is used as an example. The controller11of the storage device1stores the input data in the temporary storage unit117after receiving the input data. The statistics unit111cumulates the difference between “0” and “1” in each corresponding bit of every byte (bit0, bit1, bit2, bit3, bit4, bit5, bit6, bit7). As shownFIG. 2, every byte with 8 bits is regarded as a unit to cumulate the numeral differences of “0” and “1” on each bit (bit0, bit1. . . ) InFIG. 2, 24 bits are shown. The number of “0” of bit0is more than “1” by one. The number of “0” of bit1is more than “1” by three. The rest can be done in the same manner. Finally, the statistical result is generated.

If the input data with 512 bytes has been all stored in the temporary storage unit117, the statistics unit111can cumulate the numeral differences of “0” and “1” in each bit of all of the bytes. Then, the calculation unit113of the controller11performs a mathematics operation according to the statistic result and generates a transferable data with 1 byte. Consequently, the transferring unit115of the controller11calculates the transferrable data and the input data with one byte to generate programming data having minimum difference between “0” and “1” in the one byte.

It is assumed that final result is as follows: bit0: the number of “0” is more than the number of “1” by 48; bit1: the number of “0” is more than the number of “1” by 26; bit2: the number of “0” is less than the number of “1” by 33; bit3: the number of “0” is more than the number of “1” by 12; bit4: the number of “0” is less than the number of “1” by 50; bit5: the number of “0” is less than the number of “1” by 5; bit6: the number of “0” is more than the number of “1” by 27; bit7: the number of “0” is more than the number of “1” by 55. Details can be found in the following table:

The calculation unit113of the controller11calculates 48, 26, −33, 12, −50, −5, 27, 55 in order to get the transferrable data in which the summation of the eight differences is minimum (here, it is assumed that it is positive when “0>1”; however, it can be also assumed that it is positive when “0<1”, which is −48, −26, 33, −12, 50, 5, −27, −55). The controller11can use either mathematics operation or permutation and combination.

Now, a calculating operation is shown as an example in order to more clearly illustrate the data transferring principle. Understandably, the claimed scope of the present invention is not limited to this exemplary embodiment. It will get absolute values of the above-mentioned numbers which are 48, 26, 33, 12, 50, 5, 27, 55 and get corresponding symbol data 00101100. By a mathematics operation, it is minimum when +48+26−33−12−50−5−27+55=2. Therefore, according to that (48*(+1)+26*(+1)+33*(−1)+12*(−1)+50*(−1)+5*(−1)+27*(−1)+55*(+1)) the positive is equal to 0 and the negative is equal to 1, the calculation data is 00111110. Since the sequence of number has been output the absolute value, it is needed to XOR the calculation data with the symbol data. Finally, the result is 00010010 after 00101100 XOR 00111110, which is also the transferable data of this 512 bytes input data.

The transferrable data can be deemed as a mask of performing an inverting operation or not. It is selective to invert the special bit in the input data by XOR every byte input data and the transferable data. By such a manner, the programming data is generated in which the difference between “0” and “1” is the least. That is, each bit of the input data is calculated with the transferrable data. The transferred programming data realized the result of (48*(+1)+26*(+1)+33*(−1)+12*(−1)+50*(−1)+5*(−1)+27*(−1)+55*(+1)).

Therefore, the input data can be calculated with the transferrable data and then the programming data together with the transferrable data are transmitted to the flash memory. As for the present embodiment, the input data with 512 bytes and corresponding transferrable with one byte are transmitted to the flash memory. After reading the data and corresponding transferrable data, they will be subject to another reverting calculation. Consequently, the original input data is output.

A detailed introduction on the flow chart of storing the data in the flash memory will be given below. As shown inFIG. 3, the controller11receives the input data S101from the host computer system through the system interface118and stores the input data in the temporary storage unit117. Then, in the step of S103, the statistics unit111cumulates the differences between “0” and “1” in each bit of every N bits of M bytes input data. In the step of S105, the controller judges whether the M bytes input data has been received. If all of the M bytes input data are received, in the step of S107, the statistic unit111generates the statistic result of the differences between “0” and “1” in each bit of every N bits of the M bytes input data. In the step of S109, the calculation unit113generates the transferrable data with N bits according to the statistic result. It should be noted that the transferrable data, in which the summation of these differences is minimum, can be achieved by the calculation unit113either via performing a mathematics operation or via performing permutation and combination. The programming data is generated through the transferring unit115by calculating the input data and the transferrable data. In the step of S111, the programming data with N bits is generated by the above-described method. After that, the controller11will judge whether the input data with M bytes has been transferred to be the programming data in the step of S113. Then, in the step of S115, the controller11transmits the programming data and corresponding transferrable data to the flash memory13through the storage interface119. The data can also be transmitted after several programming data are generated.

The amounts of “0” and “1” of the data written in the flash memory13are average, which reduce the disturbances between the neighbored memory cells in the storage array that affected by the working voltages thereof.

It is to be understood, however, that even though numerous characteristics and advantages of the present invention have been set forth in the foregoing description, together with details of the structure and function of the invention, the disclosure is illustrated only, and changes may be made in detail, especially in matters of shape, size, and arrangement of parts within the principles of the invention to the full extent indicated by the broad general meaning of the terms in which the appended claims are expressed. For example, the Flash Memory is an exemplary embodiment in the description. As known to those having ordinary skills in the art, it is obvious that the Flash Memory is only one of the types of non-volatile storage device. In fact, the present invention can also be applied to other types of non-volatile storage device, such as EPROM (Erasable Programmable Read Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), PRAM (Phase-change Random Access Memory), MRAM (Magnetic Random Access Memory), FRAM (Ferroelectric Random Access Memory), etc.