Golay Code Implementation – Detecting Errors » History » Version 2
ABDALLAH, Hussein, 03/13/2016 12:30 PM
1 | 1 | ABDALLAH, Hussein | h1. Golay Code Implementation – Detecting Errors |
---|---|---|---|
2 | 1 | ABDALLAH, Hussein | |
3 | 1 | ABDALLAH, Hussein | It is easy to detect errors in a codeword. |
4 | 1 | ABDALLAH, Hussein | • Using the parity bit to check for odd numbers of errors |
5 | 1 | ABDALLAH, Hussein | If parity is correct |
6 | 1 | ABDALLAH, Hussein | • Computing the 23-bit syndrome of the codeword and check for zero |
7 | 1 | ABDALLAH, Hussein | The syndrome is the reminder left after the codeword is divided by the polynomial, modulo-2. It is equal to zero if the Golay code is valid, else non-zero. |
8 | 1 | ABDALLAH, Hussein | A hand computation example is shown below using the previous 686555h, bit reversed for the division process. |
9 | 2 | ABDALLAH, Hussein | AE3h _555h checkbits |
10 | 2 | ABDALLAH, Hussein | 101011100011 10101010101001100001011 |
11 | 1 | ABDALLAH, Hussein | 101011100011 (checkbits) |
12 | 1 | ABDALLAH, Hussein | ------------ <---------- Exclusive-OR |
13 | 1 | ABDALLAH, Hussein | 100100101100 |
14 | 1 | ABDALLAH, Hussein | 101011100011 |
15 | 1 | ABDALLAH, Hussein | ------------ |
16 | 1 | ABDALLAH, Hussein | 111100111100 |
17 | 1 | ABDALLAH, Hussein | 101011100011 |
18 | 1 | ABDALLAH, Hussein | ------------ |
19 | 1 | ABDALLAH, Hussein | 101110111111 |
20 | 1 | ABDALLAH, Hussein | 101011100011 |
21 | 1 | ABDALLAH, Hussein | ------------ |
22 | 1 | ABDALLAH, Hussein | 101011100011 |
23 | 1 | ABDALLAH, Hussein | 101011100011 |
24 | 1 | ABDALLAH, Hussein | ------------ |
25 | 1 | ABDALLAH, Hussein | 000000000000 <-- syndrome = 0 |
26 | 2 | ABDALLAH, Hussein | |
27 | 1 | ABDALLAH, Hussein | |
28 | 1 | ABDALLAH, Hussein | The routine in the next listing does the same sort of calculation. |
29 | 1 | ABDALLAH, Hussein | unsigned long syndrome(unsigned long cw) |
30 | 1 | ABDALLAH, Hussein | /* This function calculates and returns the syndrome |
31 | 1 | ABDALLAH, Hussein | of a [23,12] Golay codeword. */ |
32 | 1 | ABDALLAH, Hussein | { |
33 | 1 | ABDALLAH, Hussein | int i; |
34 | 1 | ABDALLAH, Hussein | cw&=0x7fffffl; |
35 | 1 | ABDALLAH, Hussein | for (i=1; i<=12; i++) /* examine each data bit */ |
36 | 1 | ABDALLAH, Hussein | { |
37 | 1 | ABDALLAH, Hussein | if (cw & 1) /* test data bit */ |
38 | 1 | ABDALLAH, Hussein | cw^=POLY; /* XOR polynomial */ |
39 | 1 | ABDALLAH, Hussein | cw>>=1; /* shift intermediate result */ |
40 | 1 | ABDALLAH, Hussein | } |
41 | 1 | ABDALLAH, Hussein | return(cw<<12); /* value pairs with upper bits of cw */ |
42 | 1 | ABDALLAH, Hussein | } |
43 | 1 | ABDALLAH, Hussein | These routines are all you need to implement a Golay error detection scheme. As above, you can detect up to 6 bit errors per codeword and, with the parity bit, all odd numbers of errors. |