The present invention relates to an encoder. More particularly, the present invention relates to a multi-mode encoder for different BCH codes with any codelength, coderate or a number over GF(2m).
Bose-Chaudhuri-Hocquenghem (BCH) code is one of the most widely used error correction code (ECC) techniques in the storage and communication devices. BCH code can detect and correct random errors occurred due to channel noises and defects within memory devices. The encoding procedures of BCH codeword can be implemented by linear feedback shift register (LFSR) and some combination logics together. A conventional linear feedback shift register circuit is shown in
A detailed illustration about BCH encoding is provided below. For an encoded BCH codeword having n bits, it includes a k-bit message. During encoding processes, a generating polynomial below is applied:
g(x)=xR+g′R-1xR-1+gR-2xR-2+ . . . +g′2x2+g′1x1+g′0,
where R=n−k+1. When an encoder capable of processing encoding of p parallel computations synchronously is used, for a n-bit initial processing data including the k-bit message and being divided per p bits as R′(1), R′(2), . . . R′(n/p) (R′(n/p) is not necessary p bits), and inputted to the encoder per clock cycle sequentially for operation. In view of a general formula, in a jth clock cycle (1≦j≦n/p), the outputted computed values are as: Z(j)=Fp×[Z(j−1)+R′(j)]. It should be noticed that all elements in Z(0) are 0. In order to facilitate operation, it is denoted that
R′(j)=[r′0(j)r′1(j)r′2(j) . . . r′p-1(j)|0 . . . 0]1xRT.
R′(j) is the jth p bits. Z(j) has R bits denoting by Z0(j), Z1(j), . . . ZR-1(j), respectively. Other expressions in the above formula are further described as below:
Let F′=[first p columns of Fp|Fp], transpose of Z(j) can be obtained.
A circuit fulfills this operation can also achieve the encoding operation shown in
The pervious method can only be used for a fixed code rate and code length in the same GF(2m). For some applications, various code lengths, code rates, number of m in the GF(2m), and the values of the parallel parameter p may be required. Conventionally, those requirements can be implemented with specified BCH encoders. Thus, the hardware complexity will increase. To reduce the hardware complexity, some designers may insert a lot of multiplexers into the LFSR to share registers. However, the additional area and delay time due to those multiplexer insertions will harm the benefit.
Hence, a proposed method used to share one LFSR for various BCH codes and associated encoder is desired. Moreover, the method can enlarge searching space of common sub-expressions (CSEs) in one matrix to reduce the hardware logic area.
According to an aspect of the present invention, a method for encoding multi-modes of BCH codes includes the step of: building a number of encoding matrices; combining the encoding matrices with one side aligned to form a combined matrix; seeking common sub-expressions (CSEs) in the combined matrix, and encoding a message using the combined matrix. Each of the encoding matrix has a form of
For an n-bit initial processing data including a k-bit message and being divided per p bits, R is defined as R=n−k+1. g′R-1, g′R-2, . . . and g′0 are coefficients of a generating polynomial, g(x)=xR+g′R-1xR-1+g′R-2xR-2+ . . . +g′2x2+g′1x1+g′0. Any two encoding matrices have the same or different values of n and/or k.
Preferably, space in the combined matrix which is not filled by elements of the encoding matrices is filled with 0. One side of the combined matrix has encoding matrices arranged in sequence. At least one encoding matrix in the combined matrix utilizes CSEs in another encoding matrix in the combined matrix. When a space of the smallest encoding matrix in the combined matrix can be accommodated in a portion of a space of 0 formed adjacent to other encoding matrices, the smallest encoding matrix is relocated to the space of 0 with two sides adjacent to one encoding matrix, respectively. Two adjacent encoding matrices may be separated by a number of 0.
According to another aspect of the present invention, an encoder for encoding multi-modes of BCH codes has: a combined matrix unit, for providing a plurality of encoding matrices for multiplying elements thereof with one input data having p bits, and outputting the results as a calculated data in a first clock cycle; a linear feedback shift register (LFSR), for linearly shifting the calculated data as an output data, and outputting the output data in a second clock cycle; and an adder, for receiving the output data and a divided processing data having p bits, adding the output data and the divided processing data, and outputting the sum as another input data to the combined matrix unit in the second clock cycle. An n-bit initial processing data including a k-bit message and being divided per p bits is sequentially inputted to the adder as the divided processing data; an encoded codeword is obtained in [n/p] clock cycles.
The encoding matrices with one side aligned form a combined matrix in the combined matrix unit, and the combined matrix unit processes multiplying using elements in one encoding matrix or one encoding matrix with common sub-expressions (CSEs) in another encoding matrix according to corresponding BCH codes. Each of the encoding matrices has a form of
For an n-bit initial processing data including a k-bit message and being divided per p bits, R is defined as R=n−k+1. g′R-1, g′R-2, . . . and g′0 are coefficients of a generating polynomial, g(x)=xR+g′R-1xR-1+g′R-2xR-2+ . . . +g′2x2+g′1x1+g′0. Any two encoding matrices have the same or different values of n and/or k. The combined matrix unit further has a logic operation portion to processes the multiplying.
The present invention will now be described more specifically with reference to the following embodiments.
Please refer to
The combined matrix unit 100 is used to provide a number of encoding matrices for multiplying elements in one encoding matrix or in one encoding matrix with common sub-expressions (CSEs) in another encoding matrix with one input data which has p bits. It can further output the results as a calculated data in a first clock cycle. The encoding matrices with one side aligned form a combined matrix in the combined matrix unit 100. The combined matrix unit 100 processes multiplying according to corresponding BCH codes. The combined matrix is stored in a combined matrix portion 110. In order to have a better understanding of the combined matrix portion 110, please refer to
Space in the combined matrix which is not filled by elements of the encoding matrices is filled with 0 as shown in
According to the present invention, each of the encoding matrices can be used to multiply with a p-bit input data and then output the results. An n-bit initial processing data including a k-bit message and being divided per p bits is sequentially inputted to the adder as the divided processing data. The processes are the same as that described in the BACKGROUND OF THE INVENTION. It is not necessary to repeat it again. Thus, each of the encoding matrices has a form of
R is defined as R=n−k+1; g′R-1, g′R-2, . . . and g′0 are coefficients of a generating polynomial, g(x)=xR+g′R-1xR-1+g′R-2xR-2+ . . . +g′2x2+g′1x1+g′0. It is appreciated that any two encoding matrices may have the same or different values of n and/or k. It means the encoded codewords from each encoding matrix can have different code rate, code length or numerical m in GF(2m). In other words, the combined matrix is able to provide BCH codes with different modes as it is designed.
The combined matrix unit 100 further has a logic operation portion 120 to process the multiplying. According to the spirit of the present invention, some CSEs in two or more encoding matrices can be found out and utilized. For example, if F1 and F2 have CSEs, calculations of the multiplying for two different BCH codes can utilize the same CSEs in F1 by the logic operation portion 120. Namely, at least one encoding matrix in the combined matrix utilizes CSEs in another encoding matrix in the combined matrix. Thus, further multiplexers should be avoided to use in the LFSR 200. The advantages of such design are to avoid additional area and delay time due to insertions of the multiplexers. According to the present invention, there can be other encoding matrix which doesn't have CSEs, for example, F3. It is not necessary for all encoding matrices to have CSEs.
Like LFSRs wildly used, the LFSR 200 is able to linearly shift the calculated data as an output data, and then output the output data in a second clock cycle. The adder 300 receives the output data (shown by Z(j) in
In another embodiment, the two encoding matrices may have the same size of space. Please refer to
Of course, the number of encoding matrices is not limited to 3. It can be any number greater than or equal to 2. In
From the designer's point of view, it may be possible to add zeros (0) between two adjacent encoding matrices to identify each encoding matrix so that de-bug could be easier. Under this situation, two adjacent encoding matrices are separated by a number of 0. Please see
From the description above, a method for encoding multi-modes of BCH codes can be found. Please refer to
Definitions of n, k, R, g′R-1, g′R-2, . . . and g′0 have been illustrated above. Space in the combined matrix not filled by elements of the encoding matrices are filled with 0. One side of the combined matrix has encoding matrices arranged in sequence. At least one encoding matrix in the combined matrix utilizes CSEs in another encoding matrix in the combined matrix. When a space of the smallest encoding matrix in the combined matrix can be accommodated in a portion of a space of 0 formed adjacent to other encoding matrices, the smallest encoding matrix is located to the space of 0 with two sides adjacent to one encoding matrix, respectively. Two adjacent encoding matrices may be separated by a plurality of 0.
While the invention has been described in terms of what is presently considered to be the most practical and preferred embodiments, it is to be understood that the invention needs not be limited to the disclosed embodiments. On the contrary, it is intended to cover various modifications and similar arrangements included within the spirit and scope of the appended claims, which are to be accorded with the broadest interpretation so as to encompass all such modifications and similar structures.