Communications Blockset    

Notes on Specific Block Coding Techniques

Although the Block Coding sublibrary is somewhat uniform in its look and feel, the various coding techniques are not identical. This section describes special options and restrictions that apply to parameters and signals for the coding technique categories in this sublibrary. You should read the part that applies to the coding technique you want to use: generic linear block code, cyclic code, Hamming code, BCH code, or Reed-Solomon code.

Generic Linear Block Codes

Encoding a message using a generic linear block code requires a generator matrix. Decoding the code requires the generator matrix and possibly a truth table. In order to use the Binary Linear Encoder and Binary Linear Decoder blocks, you must understand the Generator matrix and Error-correction truth table parameters.

Generator Matrix.   The process of encoding a message into an [N,K] linear block code is determined by a K-by-N generator matrix G. Specifically, a 1-by-K message vector v is encoded into the 1-by-N codeword vector vG. If G has the form [Ik, P] or [P, Ik], where P is some K-by-(N-K) matrix and Ik is the K-by-K identity matrix, then G is said to be in standard form. (Some authors, such as Clark and Cain [1], use the first standard form, while others, such as Lin and Costello [2], use the second.) The linear block coding blocks in this blockset require the Generator matrix mask parameter to be in standard form.

Decoding Table.   A decoding table tells a decoder how to correct errors that might have corrupted the code during transmission. Hamming codes can correct any single-symbol error in any codeword. Other codes can correct, or partially correct, errors that corrupt more than one symbol in a given codeword.

The Binary Linear Decoder block allows you to specify a decoding table in the Error-correction truth table parameter. Represent a decoding table as a matrix with N columns and 2N-K rows. Each row gives a correction vector for one received codeword vector.

If you do not want to specify a decoding table explicitly, set that parameter to 0. This causes the block to compute a decoding table using the syndtable function in the Communications Toolbox.

Cyclic Codes

For cyclic codes, the codeword length N must have the form 2M-1, where M is an integer greater than or equal to 3.

Generator Polynomials.   Cyclic codes have special algebraic properties that allow a polynomial to determine the coding process completely. This so-called generator polynomial is a degree-(N-K) divisor of the polynomial xN-1. Van Lint [4] explains how a generator polynomial determines a cyclic code.

The Binary Cyclic Encoder and Binary Cyclic Decoder blocks allow you to specify a generator polynomial as the second mask parameter, instead of specifying K there. The blocks represent a generator polynomial using a vector that lists the polynomial's coefficients in order of ascending powers of the variable. You can find generator polynomials for cyclic codes using the cyclpoly function in the Communications Toolbox.

If you do not want to specify a generator polynomial, set the second mask parameter to the value of K.

Hamming Codes

For Hamming codes, the codeword length N must have the form 2M-1, where M is an integer greater than or equal to 3. The message length K must equal N-M.

Primitive Polynomials.   Hamming codes rely on algebraic fields that have 2M elements (or, more generally, pM elements for a prime number p). Elements of such fields are named relative to a distinguished element of the field that is called a primitive element. The minimal polynomial of a primitive element is called a primitive polynomial. The Hamming Encoder and Hamming Decoder blocks allow you to specify a primitive polynomial for the finite field that they use for computations. If you want to specify this polynomial, do so in the second mask parameter field. The blocks represent a primitive polynomial using a vector that lists the polynomial's coefficients in order of ascending powers of the variable. You can find generator polynomials for Galois fields using the gfprimfd function in the Communications Toolbox.

If you do not want to specify a primitive polynomial, set the second mask parameter to the value of K.

BCH Codes

For BCH codes, the codeword length N must have the form 2M-1, where M is an integer greater than or equal to 3. The message length K can have only particular values. To see which values of K are valid for a given N, use the bchpoly function in the Communications Toolbox. For example, in the output below, the second column lists all possible message lengths that correspond to a codeword length of 31. The third column lists the corresponding error-correction capabilities.

No known analytic formula describes the relationship among the codeword length, message length, and error-correction capability for BCH codes.

Error Information.   The BCH Decoder block allows you to state the error-correction capability of the code as the Error-correction capability T parameter. Providing the value here speeds the computation. If you do not know the code's error-correction capability, setting this parameter to zero causes the block to calculate the error-correction capability when initializing. You can find out the error-correction capability using the bchpoly function in the Communications Toolbox.

The BCH Decoder block also returns error-related information during the simulation. The second output signal indicates the number of errors that the block detected in the input codeword. A negative integer in the second output indicates that the block detected more errors than it could correct using the coding scheme.

Reed-Solomon Codes

Reed-Solomon codes are useful for correcting errors that occur in bursts. In the simplest case, the length of codewords in a Reed-Solomon code is of the form N= 2M-1, where the 2M is the number of symbols for the code. The error correction capability of a Reed-Solomon code is floor((N-K)/2), where K is the length of message words. The difference N-K must be even.

It is sometimes convenient to use a shortened Reed-Solomon code in which N is less than 2M-1. In this case, the encoder appends 2M-1-N zero symbols to each message word and codeword. The error correction capability of a shortened Reed-Solomon code is also floor((N-K)/2)). The Communications Blockset Reed-Solomon blocks can implement shortened Reed-Solomon codes.

Effect of Nonbinary Symbols.   One difference between Reed-Solomon codes and the other codes supported in this blockset is that Reed-Solomon codes process symbols in GF(2M) instead of GF(2). Each such symbol is specified by M bits. The nonbinary nature of the Reed-Solomon code symbols causes the Reed-Solomon blocks to differ from other coding blocks in these ways:

Error Information.   The Reed-Solomon decoding blocks (Binary-Output RS Decoder and Integer-Output RS Decoder) return error-related information during the simulation. The second output signal indicates the number of errors that the block detected in the input codeword. A -1 in the second output indicates that the block detected more errors than it could correct using the coding scheme.


  Examples of Block Coding Selected Bibliography for Block Coding