BACKGROUND OF THE INVENTION

[0001]
1. Field of the Invention

[0002]
The invention relates in general to a memory and a 1bit error checking method thereof, and more particularly to a memory simplifying hardware configuration and saving memory space, and a 1bit error checking method thereof.

[0003]
2. Description of the Related Art

[0004]
Memory device has now been widely used in the storage of data. The completeness of data storage is essential in the design of memory. Conventionally, the above data completeness is achieved via the use of an error correction code (ECC). The error correction code is used in a data completeness checking method for detecting and correcting a 1bit error.

[0005]
Referring to FIG. 1A, a flowchart of a conventional memory 1bit error checking method is shown. Firstly, the method begins at step 100, at least one piece of data fragment whose size is 2^{n }bits is received, wherein n is an integer greater than or equal to 0. Next, the method proceeds to step 110, an error correction code whose size is 2n bits is generated according to the at least one piece of data fragment, wherein the error correction code is generated according to an error checking and correction algorithm (ECC algorithm). In order to avoid a 1bit error occurring to the error correction code, the error correction code further includes an error checking and correction (ECC) parity bit and its complement. The error correction code is an overhead bit for the at least one piece of data fragment.

[0006]
Then, the method proceeds to step 120, the at least one piece of data fragment and the error correction code are written in the memory. After that, the method proceeds to step 130, the at least one piece of data fragment is read from the memory and used as at least one piece of read data fragment. Next, the method proceeds to step 140, a new error correction code is generated according to the at least one piece of read data fragment by using the ECC algorithm. Then, the method proceeds to step 150, a determination as to whether the at least one piece of read data fragment is the same with the at least one piece of data fragment is made according to the error correction code and the new error correction code. Substantially, in step 150, according to the error checking and correction algorithm, an “exclusive or” operation is performed on the error correction code and the new error correction code, and if the result is 0, the at least one piece of read data fragment is determined to be the same with the at least one piece of data fragment.

[0007]
If the at least one piece of read data fragment is the same with the at least one piece of data fragment, then the method proceeds to step 160, the memory determines that the read operation is correct and outputs the at least one piece of read data fragment. If the at least one piece of read data fragment is different from the at least one piece of data fragment, then the method proceeds to step 170, if the memory determines that the read operation has a 1bit error, then the memory corrects the at least one piece of read data fragment as the at least one piece of data fragment according to the new error correction code and outputs the at least one piece of read data fragment.

[0008]
Referring to FIG. 1B, a schematic diagram of the error checking and correction algorithm is shown. As shown in FIG. 1B, at least one piece of data fragment whose size is 8 bits (D0˜D7) is exemplified. The 6bit error correction code of the at least one piece of data fragment is generated according to the ECC algorithm. The error correction code includes ECC parity bits P1, P2 and P4, and the complements P1′, P2′ and P4′. Likewise, the new error correction code also does. The equations of ECC parity bits P1, P2 and P4, and the complements P1′, P2′ and P4′ are described as below, wherein ⊕ means “exclusive or”.

[0000]
P4=D7⊕D6⊕D5⊕D4 (eq. 1)

[0000]
P2=D7⊕D6⊕D3⊕D2 (eq. 2)

[0000]
P1=D7⊕D5⊕D3⊕D1 (eq. 3)

[0000]
P4′=D3⊕D2⊕D1⊕D0 (eq. 4)

[0000]
P2′=D5⊕D4⊕D1⊕D0 (eq. 5)

[0000]
P1′=D6⊕D4⊕D2⊕D0 (eq. 6)

[0009]
In step 170, if the memory determines that the read operation has a 1bit error, that means the result of the “exclusive or” operation performed on the error correction code and the new error correction code is not all 0. The “exclusive or” result is the error location of the at least one piece of read data fragment. Then invert the error bit and the error is corrected.

[0010]
According to the conventional memory error checking method, despite the ECC algorithm is able to detect and correct a 1bit error. However, in checking the 1bit error of a memory, the size of the error correction code is 2n bits, not only make the overhead bit to occupy too much memory space, but also make it difficult to simplify the hardware configuration of the memory.
SUMMARY OF THE INVENTION

[0011]
The invention is directed to a memory and a 1bit error checking method thereof. By using a simpler 1bit error checking method, the memory is enabled to have a simple hardware configuration, hence saving memory space considerably.

[0012]
According to a first aspect of the present invention, a memory 1bit error checking method is provided. Firstly, at least one piece of data fragment whose side is 2^{n }bits is received. Next, an error correction code, a parity code and a data code are generated according to the at least one piece of data fragment and written in the memory. Then, the at least one piece of data fragment is read from the memory and used as at least one piece of read data fragment. Next, a new error correction code, a new parity code and a new data code are generated according to the at least one piece of read data fragment. Afterwards, a determination as to whether the at least one piece of read data fragment has a 1bit error corresponding to the at least one piece of data fragment is made according to the error correction code and the new error correction code, the parity code and the new parity code, and the data code and the new data code. After that, if the at least one piece of read data fragment does not have a 1bit error, then the at least one piece of read data fragment is outputted.

[0013]
According to a second aspect of the present invention, a memory including a memory array and an error correction circuit is provided. The memory array receives and stores at least one piece of data fragment. The at least one piece of data fragment is read from the memory array and used as at least one piece of read data fragment, wherein the size of both the at least one piece of data fragment and the at least one piece of read data fragment is 2^{n }bits, n is an integer greater than or equal to 0. An error correction code, a parity code and a data code are generated by the error correction circuit according to the at least one piece of data fragment, wherein the data code corresponds to the error correction code. Furthermore, a new error correction code, a new parity code and a new data code are generated according to the at least one piece of read data fragment, wherein the new data code corresponds to the new error correction code. A determination as to whether the at least one piece of read data fragment has a 1bit error corresponding to the at least one piece of data fragment is made by the memory according to the error correction code and the new error correction code, the parity code and the new parity code, and the data code and the new data code.

[0014]
The invention will become apparent from the following detailed description of the preferred but nonlimiting embodiments. The following description is made with reference to the accompanying drawings.
BRIEF DESCRIPTION OF THE DRAWINGS

[0015]
FIG. 1A (Prior Art) is a flowchart of a conventional memory 1bit error checking method;

[0016]
FIG. 1B (Prior Art) is a schematic diagram of the error checking and correction algorithm;

[0017]
FIG. 2 is a flowchart of a memory 1bit error checking method according to a preferred embodiment of the invention; and

[0018]
FIG. 3 is a block diagram of a memory according to a preferred embodiment of the invention.
DETAILED DESCRIPTION OF THE INVENTION

[0019]
The invention provides a memory and a 1bit error checking method thereof. The 1bit error checking method checks whether a 1bit error occurs to the data stored in the memory according to an error correction code having either an error checking and correction (ECC) parity bit or its compliment, and a 1bit parity code and a 1bit data code in a simpler way, so that the memory has a simple hardware configuration and saves memory space.

[0020]
Referring to FIG. 2, a flowchart of a memory 1bit error checking method according to a preferred embodiment of the invention is shown. The memory 1bit error checking method is used in a memory. Firstly, the method begins at step 200, at least one piece of data fragment whose size is 2^{n }bits is received, wherein n is an integer greater than or equal to 0. Then, the method proceeds to step 210, an error correction code, a parity code and a data code are generated according to the at least one piece of data fragment, wherein the data code corresponds to the error correction code. The error correction code whose size is n bits is generated according to an error checking and correction algorithm (ECC algorithm) and is either an ECC parity bit or its compliment. Take the at least one piece of data fragment whose size is 8 bits (D0˜D7) as exemplified hereinafter. The equations of ECC parity bits E1, E2 and E4, and the complements E1′, E2′ and E4′ are described as below, wherein ⊕ means “exclusive or”.

[0000]
E4=D7⊕D6⊕D5⊕D4 (eq. 7)

[0000]
E2=D7⊕D6⊕D3⊕D2 (eq. 8)

[0000]
E1=D7⊕D5⊕D3⊕D1 (eq. 9)

[0000]
E4′=D3⊕D2⊕D1⊕D0 (eq. 10)

[0000]
E2′=D5⊕D4⊕D1⊕D0 (eq. 11)

[0000]
E1′=D6⊕D4⊕D2⊕D0 (eq. 12)

[0021]
The parity code is generated by performing an “exclusive or” operation on all bits of the at least one piece of data fragment. That is, the parity code equals 0 if the at least one piece of data fragment has an even number of 1, and the parity code equals 1 if the at least one piece of data fragment has an odd number of 1. The equation of the parity code P or P′ is described as below.

[0000]
P or P′=D7⊕D6⊕D5⊕D4⊕D3⊕D2⊕D1⊕D0 (eq. 13)

[0022]
Besides, the data code corresponding to the error correction code is used to assure the completeness of the memory 1bit error checking method. When the error correction code is an ECC parity bit, the data code is the lowest bit among the at least one piece of data fragment; and when the error correction code is a complement to the ECC parity bit, the data code is the highest bit among the at least one piece of data fragment. The equation of the data code D or D′ is described as below.

[0000]
D=D0 (eq. 14)

[0000]
D′=D7 (eq. 15)

[0023]
Then, the method proceeds to step 220, the at least one piece of data fragment, the error correction code, and the parity code and the data code are written in a memory. The error correction code, the parity code and the data code are used as an overhead bit of the at least one piece of data fragment and written in the memory. Then, the method proceeds to step 230, the at least one piece of data fragment is read from the memory and used as at least one piece of read data fragment, wherein the size of the at least one piece of read data fragment is 2^{n }bits.

[0024]
Afterwards, the method proceeds to step 240, a new error correction code, a new parity code, and a new data code are generated according to the at least one piece of read data fragment, wherein the new data code corresponds to the new error correction code. A new error correction code whose size is n bits is generated according to an error checking and correction algorithm. When the error correction code is an ECC parity bit, the new error correction code is also an ECC parity bit; and when the error correction code is a complement to the ECC parity bit, the new error correction code is also a complement to the ECC parity bit. The new parity code is generated by performing an “exclusive or” operation on all bits of the at least one piece of read data fragment. Besides, when the new error correction code is an ECC parity bit, the new data code is the lowest bit among the at least one piece of read data fragment; and when the new error correction code is a complement to the ECC parity bit, the data code is the highest bit among the at least one piece of read data fragment.

[0025]
After that, the method proceeds to step 250, a determination as to whether the at least one piece of read data fragment has a 1bit error corresponding to the at least one piece of data fragment is made according to the error correction code and the new error correction code, the parity code and the new parity code, and the data code and the new data code. After that, the method proceeds to step 260, the at least one piece of read data fragment is outputted if the at least one piece of read data fragment does not have a 1bit error corresponding to the at least one piece of data fragment.

[0026]
In step 250, the determination as to whether at least one piece of read data fragment has a 1bit error is made by performing an “exclusive or” operation on the error correction code and the new error correction code, the parity code and the new parity code, and the data code and the new data code, respectively. Referring to Table One, an inquiry table for the memory 1bit error checking method according to the invention preferred embodiment is shown.

[0000]
TABLE ONE 

E 
P 
D 

0 
0 
X 
0 
1 
0 
0 
1 
1 
1 
0 
X 
1 
1 
X 


[0027]
In Table One, “E” denotes the result after the “exclusive or” operation is performed on the error correction code and the new error correction code; “P” denotes the result after the “exclusive or” operation is performed on the parity code and the new parity code; “D” denotes the result after the “exclusive or” operation is performed on the data code and the new data code; “X” denotes “don't care”, “1” denotes that at least one piece of read data fragment has a 1bit error; and “0” denotes that at least one piece of read data fragment does not have a 1bit error.

[0028]
When (E, P, D) equals (0, 0, X), this implies that the at least one piece of read data fragment is determined not to have a 1bit error both according to the error correction code and the new error correction code and according to the parity code and the new parity code, so that the at least one piece of read data fragment is the same with the at least one piece of data fragment. Meanwhile, if D is denoted by 1, this implies that an error occurs to the data code and the new data code.

[0029]
When (E, P) equals (0, 1), this implies that the at least one piece of read data fragment is determined not to have a 1bit error according to the error correction code and the new error correction code but is determined to have a 1bit error according to the parity code and the new parity code. Meanwhile, the data code and the new data code are checked for further determination. When (E, P, D) equals (0, 1, 1), this implies that the at least one piece of read data fragment is determined to have a 1bit error according to the data code and the new data code, so that the 1bit error is corrected. The 1bit error occurs to the bit that the data code and the new data code correspond to. When (E, P, D) equals (0, 1, 0), this implies that the at least one piece of read data fragment is determined not to have a 1bit error according to the data code and the new data code. That is, an error occurs to the parity code and the new parity code.

[0030]
When (E, P, D) equals (1, 0, X), this implies that the at least one piece of read data fragment is determined to have a 1bit error according to the error correction code and the new error correction code but is determined not to have a 1bit error according to the parity code and the new parity code. Under such circumstances, an error occurs to the error correction code and the new error correction code, and the at least one piece of read data fragment does not have a 1bit error corresponding to the at least one piece of data fragment.

[0031]
When (E, P, D) equals (1, 1, X), this implies that the at least one piece of read data fragment is determined to have a 1bit error both according to the error correction code and the new error correction code and according to the parity code and the new parity code. Under such circumstances, the at least one piece of read data fragment has a 1bit error, and the 1bit error occurring to the at least one piece of read data fragment is corrected according to the error correction code and the new error correction code according to the error checking and correction (ECC) algorithm.

[0032]
Take the at least one piece of data fragment be (00101011) and the at least one piece of read data fragment be (00101010) for example. According to the above memory 1bit error checking method, the at least one piece of data fragment has an error correction code (P4 P2 P1)=(111), a parity code 0 and a data code 1. The at least one piece of read data fragment has a new error correction code (P4 P2 P1)=(111), a new parity code 1 and a new data code 0. Hence (E, P, D) that equals (0, 1, 1) is obtained. That means the lowest bit among the at least one piece of read data fragment has a 1bit error. Then the at least one piece of read data fragment is corrected to (00101011).

[0033]
Referring to FIG. 3, a block diagram of a memory according to a preferred embodiment of the invention is shown. The memory 300 includes a memory array 310 and an error correction circuit 320. The memory array 310 receives and stores at least one piece of data fragment Data. The memory 300 reads at least one piece of data fragment Data from the memory array 310 and uses the at least one piece of data fragment Data as at least one piece of read data fragment DataR. The size of both the at least one piece of data fragment Data and the at least one piece of read data fragment DataR is 2^{n }bits, wherein n is an integer greater than or equal to 0.

[0034]
The error correction circuit 320 generates an error correction code, a parity cod, and a data code according to the at least one piece of data fragment Data, and generates a new error correction code, a new parity code and a new data code according to the at least one piece of read data fragment DataR, wherein the data code corresponds to the error correction code, and the new data code corresponds to the new error correction code.

[0035]
Both the error correction code and the new error correction code are an ECC parity bit or its compliment. The size of both the error correction code and the new error correction code is n bits. The size of both the parity code and the new parity code is 1 bit. The size of both the data code and the new data code is 1 bit. When the error correction code and the new error correction code are an ECC parity bit, the data code is the lowest bit among the at least one piece of data fragment, and the new data code is the lowest bit among the at least one piece of read data fragment. When the error correction code and the new error correction code are a complement to the ECC parity bit, the data code is the highest bit among the at least one piece of data fragment, and the new data code is the highest bit among the at least one piece of read data fragment.

[0036]
The memory 300 determines whether the at least one piece of read data fragment has a 1bit error corresponding to the at least one piece of data fragment according to the error correction code and the new error correction code, the parity code and the new parity code, and the data code and the new data code. Besides, the 1bit error checking method used in the memory 300 is already disclosed in the memory 1bit error checking method in the above embodiments of the invention, and is not repeated here.

[0037]
The memory and the 1bit error checking method thereof disclosed in the above embodiments of the invention check whether a 1bit error occurs to the data stored in the memory according to an error correction code having either an error checking and correction (ECC) parity bit or its compliment, a 1bit parity code, and a 1bit data code in a simpler way. Compared with the conventional memory 1bit error checking method in which the at least one piece of data fragment whose size is 2^{n }bits uses 2n bits of overhead bits, the memory 1bit error checking method disclosed in the invention only uses (n+2) bits of overhead bits, largely saving the memory space, and simplifying the hardware configuration for the memory.

[0038]
Besides, the data completeness is also achieved via the use of a Hamming code conventionally. Several check bits are added to the specific positions of the at least one piece of data fragment. For example, when the size of the at least one piece of data fragment is n bits, then k check bits are added to the 2^{0}, 2^{1}, 2^{2}, . . . and 2^{k1 }bit following the equation 7 described below, wherein k is an integer.

[0000]
2^{k} ≧=n+k+1 (eq. 7)

[0000]
The number of 1 that the check bit and the bits corresponding to the check bit have must be even. The check bits are used for detecting and correcting a 1bit error of the at least one piece of data fragment. However, all the memory bits are adjacent in the memory. The Hamming code has to add some check bits to the specific positions of the at least one piece of data fragment. Hence the Hamming code is not suitable for applying to the memory.

[0039]
While the invention has been described by way of example and in terms of a preferred embodiment, it is to be understood that the invention is not limited thereto. On the contrary, it is intended to cover various modifications and similar arrangements and procedures, and the scope of the appended claims therefore should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements and procedures.