An efficient encoding algorithm for (n, k) binary cyclic codes - CiteSeerX

30 downloads 8622 Views 568KB Size Report
encoding of linear binary cyclic codes is used which improves the encoding ... without involving computers after generating an encoding table for the code.
2757 Vol. 5 No.5

Indian Journal of Science and Technology

(May 2012)

ISSN: 0974- 6846

An efficient encoding algorithm for (n, k) binary cyclic codes Riaz Ahmad Qamar, Mohd Aizaini Maarof and Subariah Ibrahim

Computer Science and Information Systems, Universiti Teknologi, Malaysia, Skudai, Johor Bahru, Malaysia.

[email protected], [email protected], [email protected] Abstract In forward error correction (FEC) systems, basically two mechanisms namely block coding and convolutional coding are used for error-control coding. The error-control coding processes involve encoding and decoding information symbols to get rid of errors produced by noise in communication channels. In a binary block encoding technique, message words are arranged in blocks of k bits which are converted into code words of n bits, n> k , by adding redundancy bits. Encoding is a compulsory part of error correcting codes and without knowledge of encoding structure the decoding of code words is impossible. In this paper a very simple and most effective technique for systematic encoding of linear binary cyclic codes is used which improves the encoding speed by reducing the computational complexity. In addition to encoding speed, the encoding can be done by hand using XOR (modulo-2) operations without involving computers after generating an encoding table for the code. Keywords: Forward error correction, encoding, decoding, communication channels, linear cyclic codes, encoding table. Introduction In communication systems, two major schemes, depending upon the application, are used for error detection and correction. In two way communications (that is, a full duplex mode e.g.; telephonic conversations) codes are designed to detect errors only while error correction is carried out by repeating the message. A well-known scheme which is used for this purpose is known as automatic repeat request (ARQ) (Jerry, 2002). On the other hand, there are communication systems e.g.; mobile where text messages are sent, that do not allow a full duplex mode and hence retransmission is impossible if errors are detected. Thus, an errorcorrection algorithm is implemented on receiver side to decode the messages properly. This transmission scheme is said to be a forward error correction (FEC) (Shu & Daniel, 1983). An error correcting code consists of techniques and algorithms and has two fundamental operations: encoding and decoding (Moreira & Farrell, 2006). Encoding is a procedure in which redundancy is added to a message and transforms it into a codeword. This codeword is transmitted through a noisy channel, which changes the message. Decoding procedure removes the errors from erroneous codeword after detecting these errors and converts the message back into its original form. All forward error correcting codes work on the same principle. Error correcting codes are divided into two classes, such as block and convolutional codes, on the basis of the way in which redundancy is added to information. Block codes process the information block-by-block and treat each block independently, whereas, convolutional codes may process the information either block-by-block or bit-by-bit. The output of convolution encoder depends upon current input information as well as on previous inputs or outputs. There are many interesting subResearch article Indian Society for Education and Environment (iSee)

classes (Roth, 2006; Robert, 2006; Neubauer et al., 2007) of forward error correction codes based on the techniques used to obtain the redundancy, which are shown in Fig. 1. In order to correct transmission error(s) from information, a redundancy (called parity-check symbols) is added to information. A coded sequence, obtained by appending redundant symbols to information, is known as codeword. A basic codeword of block codes, in systematic form (Moreira & Farrell, 2006), is shown in Fig. 2. In a systematic codeword, all the information symbols appear either in the leftmost or rightmost k positions while the redundancy symbols are placed in the remaining n-k positions. A set of all code sequences, obtained in this way, is known as error correcting code. The redundancy symbols, which are a function of information symbols, are used for error detection and/or correction purposes. In block codes, information may be encoded in two Fig.1. Classification of forward error correcting codes . FEC Codes Block

Linear Cyclic

q-ary

“Forward err or correction” http://www.indjst.org

Perfect

Convolution

Non Linear LDPC

Binary

Fig.2. Systematic form of a codeword. n-k Symbols

k Symbols

Redundancy

Information n Symbols R.A.Qamar et al. Indian J.Sci.Technol.

2758 Vol. 5

Indian Journal of Science and Technology ways, systematic form and non-systematic form. An encoder generates an n-bit codeword from a k-bit data block by using mathematical techniques e.g.; matrices or polynomials. Some authors use lookup tables to form a codeword. A reduced size look up table approach for encoding is implemented in (Gary & Catherine, 2004). Cyclic block codes and generator polynomial

(May 2012)

ISSN: 0974- 6846

field GF(2), but a typical approach to compute g(X) consists of the following steps(Robert, 2006, Joseph, 2008):

i. Compute a primitive polynomial of degree m, where m is a positive integer number.

ii. Generate a Galois field GF(2m) by using primitive polynomial computed in step 1.

A linear cyclic block code, C(n,k), is said to be a cyclic code if (i) after the ith cyclic rotation, each of its code vectors transforms into another code vector of the same code (ii) the sum of two code vectors of this code is also a code vector of the same code. Let a code vector c = (c0, c1, ….., cn-1). After i-times right-shift rotation, the new code vector is c(i) = (cn-i, cni+1,…..,cn-1 , c0, c1, ….., cn-i-1). Polynomial representation of a code vector is ( ) ( ) (Hung et al., 2008). In binary field, the exponent j of Xj shows the position of 0’s or 1’s in the code vector. The relationship between the i-position right-shift rotated polynomial c(i)(X) of the original polynomial c(X) is () ( ) ( )( ) ( ) or it is equal to ( ) ( ) ( ) ( ). A non-zero minimum-degree polynomial of a given cyclic code is called a generator polynomial that is ( ) which generates a linear cycle code C(n,k). Also, r= n-k thus the generator polynomial becomes - ( ) . Any other - polynomial (except non-zero minimum-degree polynomial) in the cyclic code is of degree n-1 or less, so ( ) ( ) ( ) ( ) ( ) Where - are the bits of a message vector. The systematic form of a linear cyclic code C(n,k) can be achieved by multiplying the message polynomial, n-k m(X) by X and then dividing the product by g(X) (Moreira & Farrell, 2006). Computing generator polynomial of an (n,k) cyclic code A generator polynomial g(X) in a cyclic code C(n,k) is a unique polynomial and a factor of all code polynomials. Also, a generator polynomial of a cyclic code divides a polynomial Xn + 1. Therefore, a generator polynomial of a code of length n can be found by factoring the polynomial n X + 1 into its irreducible factor polynomials. A polynomial of the form Xn + 1 can be factorized with the help of Galois field elements which are generated by a primitive polynomial. A primitive polynomial of degree m (m is any positive integer number) defined over GF(2) {0,1} has no factor polynomial with degree higher than zero and lower than m and it is also a factor polynomial of Xn + 1 m when n is equal to 2 -1 only. There are different approaches to compute a generator polynomial, g(X), of a cyclic code over Galois Research article Indian Society for Education and Environment (iSee)

No.5

iii. Generate the cyclotomiccosets, Cs , modulo 2m-1 of

the code and then find conjugate elements of the code, .

iv. Compute factors of a polynomial of the form like Xn+1 as

( )

∏ (

)

v. Compute generator polynomial from the factors of Xn+1 as

( )

( )

∏ (

)

Systematic encoding of binary cyclic codes The binary block cyclic codes can be encoded in nonsystematic as well as in systematic form. In nonsystematic form, parity bits are inter-mixed with message bits in a codeword whilst in systematic codeword parity bits (also called redundancy bits) are separated from message bits. In systematic form of a codeword, normally, the redundancy bits are followed by message bits but it may be the other way round. Generally the following two algorithms are used for systematic encoding of an (n, k) cyclic code. Algorithm I (Stephen, 1995):

i. Compute a generator polynomial g(X) of cyclic code as

( )

ii. Multiply the message polynomial m(X) by Xn-k. iii. Divide the result of step ii by the generator polynomial g(X). Let p(X) be the remainder polynomial. iv. Set c(X) = Xn-k m(X) + p(X) to generate a systematic codeword. It may be noted that non-systematic encoding polynomial is c(X) = m(X) × g(X). Algorithm II (Moreira & Farrell, 2006):

i. Compute a Code generator polynomial g(X) as

( ) ii. Compute a Generator Matrix (G) polynomial g(x) of code:

“Forward err or correction” http://www.indjst.org

from generator R.A.Qamar et al. Indian J.Sci.Technol.

2759 Vol. 5

Indian Journal of Science and Technology

[

] iii. The generator matrix in step ii is converted in to systematic form by Gaussian elimination method (applying linear row/column operations over the matrix). It may looks like:

[

]

iv. Compute code words CW = M × Gk × n , where M is a message vector. For example, a systematic generator matrix (G) of a binary BCH(15,5,7) code is

[

]

and leta message vector to be encoded is M = 10110. Then code word CW = M1×k × Gk × n = 0 1 0 0 0 1 1 1 1 0 1 0 1 1 0.Hence the syndrome S is 0 1 0 0 0 1 1 1 1 0and message bits (vector M) are appeared at the end in the codeword, CW. Modified systematic encoding algorithm With the modified systematic encoding algorithm, the binary cyclic code (n,k) can be encoded in a simple and very effective way. This algorithm reduces the computational complexity and speeds up the encoding process. The algorithm first constructs a simple encoding table from the code generator polynomial and then computes a systematic code word from a message word. The steps involve in construction of an encoding table and then a systematic codeword are as follows: i.

Find generator polynomial g(x) as usual way, as explained in section 3. ii. Construct an encoding table as: a) Divide Xn-k+i by g(X), where i = 0, 1, 2,…….,k-1 and get remainder polynomial p(X). b) Write the remainder polynomial in binary form. c) In encoding table, under column labeled as 1-bit position, write values of i that indicates position of bit 1 in message vector M. d) In encoding table, under column labeled as parity vectors, write parity bits computed in b). Research article Indian Society for Education and Environment (iSee)

No.5

(May 2012)

ISSN: 0974- 6846

iii. Find positions of 1’s in a message vector, M. iv. Locate parity vectors Pi , where i’s are the positions of 1-bits in message vector M, against i-positions in encoding table. v. Add parity vectors Pi with modulo 2 to get syndrome S, e.g.; S = P1 P3 P4 . vi. Attach the message vector M at the end of S to obtain codeword, CW. For purpose of explaining the encoding algorithm, consider a binary BCH(15,5,7) cyclic code, with 10 9 8 6 5 2 generator polynomial g(X) = X +X +X +X +X +X +1.The encoding table for this code can be constructed as follows: Remainder polynomials of X10+i / g(X), where i = 0,1,2,3,4 can be determined in binary arithmetic as: REM ( X10/ g(X) ) = 1+X2+X5+X6+X8+X9. In binary form, it is equivalent to 1010011011. Thus parity vector P0 = 1010011011. 11 2 3 5 7 8 REM ( X / g(X) ) = 1+X+X +X +X +X +X , P1 = 1111010110 12 2 3 4 6 8 REM ( X / g(X) ) = X+X +X +X +X +X +X9 , P2 = 0111101011 REM ( X13/ g(X) ) = 1+X3+X4+X6+X7+X8 , P3 = 1001101110 REM ( X14/ g(X) ) = X+X4+X5+X7+X8+X9 , P4 = 0100110111

An encoding table, Table 1, can be constructed by arranging values of i’s and vector P’s in a tabular form as: Table 1. Encoding table of binary BCH(15,5,7) cyclic code. 1-bit position (i) 0 1 2 3 4

Parity vectors (P) 1010011011 1111010110 0111101011 1001101110 0100110111

For example, to encode a message vector M = 10110. The positions of 1’s in vector M are i = 0,2,3. From table 1, the values of parity vectors against i = 0, 2, 3 are P0 = 1010011011, P2 = 0111101011 and P3 = 1001101110 respectively. Then syndrome S can be found by adding vectors P0, P2, P3 with modulo 2 as: S= or S=0 1 0 0 0 1 1 1 1 0. A systematic code word can be obtained by attaching message vector M at the end of syndrome S e.g.; CW = 0 1 0 0 0 1 1 1 1 0 1 0 1 1 0. The encoding table with small changes can be utilized to build a simplified syndrome decoding table which is used for error correction purposes. For example, if we change the column labeled ‘1-bit position’ with label ‘error patterns’ and substituting actual vector showing bit ‘1’ at the mentioned position and all zeros ‘0’ at k-1 remaining positions. Then using the error patterns and parity vectors data, a program, written in C-sharp Fig.3, generates asyndrome decoding table for BCH(15,5) code with error correcting capacity equal to 3, as shown in Table 2.

“Forward err or correction” http://www.indjst.org

R.A.Qamar et al. Indian J.Sci.Technol.

2760 Vol. 5

Indian Journal of Science and Technology

Fig. 3. A program for computing a simplified syndrome decoding table for BCH(15,5,7) code. //This program Generates syndrome decoding //table for BCH(15,5,7) code with error //correcting capacity t = 3. using System; namespaceGenerating_Syndrome_Decoding_Table { class Program { static void Main(string[] args) { int[,] ep = new int[5, 5] // error Pattern data { {1,0,0,0,0}, {0,1,0,0,0}, {0,0,1,0,0}, {0,0,0,1,0}, {0,0,0,0,1} }; int[,] S = new int[5, 10]

//parity vectors

{ j++; for (i3 = 0; i3 < k; i3++) ept[j, i3] = ep[i, i3] ^ ep[i1, i3]; for (i4 = 0; i4 < n - k; i4++) St[j,i4] = S[i, i4] ^ S[i1, i4]; for (i2 = i1 + 1; i2 < k; i2++) { j++; for (i3 = 0; i3 < k; i3++) ept[j,i3]=ep[i,i3]^ ep[i1,i3]^ ep[i2, i3]; for (i4 = 0; i4 < n - k; i4++) St[j, i4] = S[i, i4] ^ S[i1, i4] ^ S[i2, i4]; } } j++; }

{ for (i1 = 0; i1 < k; i1++) Console.Write(" {0}", ept[i, i1]); Console.Write(" "); for (i2 = 0; i2 < n-k; i2++) Console.Write(" {0}", St[i, i2]); Console.WriteLine();

sum=0; k = 5; n = 15; t = 3;

}

//To find number of error patterns and //syndromes in a decoding table of the code

(Factorial(i) * Factorial(k - i))); } int[,] ept = new int[sum, 5]; int[,] St = new int[sum, 10]; for (i = 0; i< k; i++) { for (i3 = 0; i3 < k; i3++)

} //This method calculates factorial of a number. staticint Factorial(int number) { intFinalNumber = 1; for (inti = 1; i

Suggest Documents