UNB ECE4253 Digital Communications
Department of Electrical and Computer Engineering - University of New Brunswick, Fredericton, NB, Canada

Polynomial Code Generator Tool

Given a generator polynomial G(x) of degree p and a binary input data size k, this online tool creates and displays a generator matrix G, a check matrix H, and a demonstration of the resulting systematic codewords for this (n,k) code, where n=p+k. The nature of G(x) and the value of k will determine the utility of the codewords in a error control scheme.

The mathematics of error control can be based on either a matrix or a polynomial approach. This page shows how any polynomial G(x) may be used to define an equivalent check matrix and generator matrix. Conversely, it is not always possible to find a polynomial G(x) corresponding to an arbitary generator matrix.

The generator polynomial G(x) can be up to degree p=36, and the input data size is limited to k=36 bits.


Polynomial G(x)

G(x) = x+1

(11)

This polynomial G(x) is degree 1, giving a 1-bit parity field. (See factors of G(x))

The systematic 8-bit codewords will have 7 data bits and 1 parity bits.


Sample (8,7) Codewords  (cyclic)

When codewords are cyclic the circular shift of a valid codeword produces another valid codeword.

For example, rotating the 8-bit codeword (01) left by one bit gives the codeword (02):

(01) = 00000011
(02) = 00000110

DATA = 00 : 00000000
DATA = 01 : 00000011
DATA = 02 : 00000101
DATA = 03 : 00000110
DATA = 04 : 00001001
DATA = 05 : 00001010
DATA = 06 : 00001100
DATA = 07 : 00001111
DATA = 08 : 00010001
DATA = 09 : 00010010
DATA = 10 : 00010100
DATA = 11 : 00010111
DATA = 12 : 00011000
DATA = 13 : 00011011
DATA = 14 : 00011101
DATA = 15 : 00011110
DATA = 16 : 00100001
DATA = 17 : 00100010
DATA = 18 : 00100100
DATA = 19 : 00100111
DATA = 20 : 00101000
DATA = 21 : 00101011
DATA = 22 : 00101101
DATA = 23 : 00101110
DATA = 24 : 00110000
DATA = 25 : 00110011
DATA = 26 : 00110101
DATA = 27 : 00110110
DATA = 28 : 00111001
DATA = 29 : 00111010
DATA = 30 : 00111100
DATA = 31 : 00111111
← less | more →

The polynomial P(x)= x+1 = (11) gives an ordinary one-bit (even) parity check.

When codewords are linear, any linear combination of codewords is another codeword. For example, the 8-bit codeword (01) is the sum (02)+(03)

(02) = 00000101
(03) = 00000110
(01) = 00000011


Distance Analysis

This sample subset of 8-bit codewords has a minimum distance D=2 and no error correction is possible. The codewords remain useful for single bit error detection.

 0001020304050607080910111213141516171819202122232425262728293031
00--02020202020204020202040204040402020204020404040204040404040406
0102--020202020402020204020402040402020402040204040402040404040604
020202--0202040202020402020404020402040202040402040404020404060404
03020202--04020202040202020404040204020202040404020404040206040404
0402020204--020202020404040202020402040404020202040404040602040404
050202040202--0202040204040202040204020404020204020404060404020404
06020402020202--02040402040204020204040204020402020406040404040204
0704020202020202--040404020402020204040402040202020604040404040402
080202020402040404--0202020202020402040404040404060202020402040404
09020204020402040402--02020202040204020404040406040202040204020404
1002040202040402040202--020204020204040204040604040204020204040204
110402020204040402020202--0402020204040402060404040402020204040402
12020404040202020402020204--02020204040406020404040204040402020204
1304020404020204020202040202--020204040604040204040402040402020402
140404020402040202020402020202--0204060404040402040404020402040202
15040404020402020204020202020202--06040404040404020404040204020202
1602020204020404040204040404040406--020202020202040202020402040404
170202040204020404040204040404060402--0202020204020202040204020404
18020402020404020404040204040604040202--02020402020204020204040204
1904020202040404020404040206040404020202--040202020402020204040402
200204040402020204040404060204040402020204--0202020204040402020204
21040204040202040204040604040204040202040202--02020402040402020402
2204040204020402020406040404040204020402020202--020404020402040202
230404040204020202060404040404040204020202020202--0404040204020202
24020404040404040602020204020404040202020402040404--02020202020204
2504020404040406040202040204020404020204020402040402--020202020402
260404020404060404020402020404020402040202040402040202--0202040202
27040404020604040404020202040404020402020204040402020202--04020202
2804040406020404040204040402020204020404040202020402020204--020202
290404060404020404040204040202040204020404020204020202040202--0202
30040604040404020404040204020402020404020402040202020402020202--02
3106040404040404020404040204020202040404020402020204020202020202--

This sampling of 32 codewords is not necessarily indicative of the error control performance of all 27 = 128 possible codewords.

To determine the minimum distance between any two codewords in a linear block code, it is sufficient to check every codeword once against the all-zero codeword. In other words, the Hamming distance of a code may be determined from the distances in row 00 only. Moreover, the distance from a given codeword to zero is found by the sum of the 1's in the codeword. The remaining codewords could be easily checked in this way.



Specify a new polynomial or a different number of data bits.

Model M20J GENERATOR POLYNOMIAL TOOL
Data Bits k =   G(x):

Discussion Codewords Generator Format
G = [Ik|P]
G = [P|Ik]
MATLAB Matrices

Examples

  1. (8,7) Simple Parity Bit (D=2) no error correction

  2. (7,4) Hamming Code (D=3) single bit error correction

  3. (15,11) Hamming Code (D=3) single bit error correction

  4. (15,10) Extended Hamming Code (D=4) single bit error correction

  5. (31,21) BCH Code (D=5) double bit error correction (notes)

  6. (15,5) BCH Code (D=7) triple bit error correction (notes)

  7. (23,12,7) Binary Golay Code (D=7) triple bit error correction

  8. (35,27) Fire Code specialized 3-bit burst error correction

  9. 16-bit CRC (CCITT) commonly used for error detection (notes)


2024-05-16 07:38:06 ADT
Last Updated: 2015-02-06
Richard Tervo [ tervo@unb.ca ] Back to the course homepage...