Cyclic Codes
Cyclic Codes
Cyclic Codes
error S
0000000 000
0000001 001
0000010 010
0000100 100
0001000 011
0010000 110
0100000 111
1000000 101
Hamming Coding and Decoding
• Example: Hamming (7,4) code incur single error, if v= 1011001, find
bits transmitted
• Solution:
• 𝑠1 = 1+0+1+0 = 0
• 𝑠2 = 0+1+1+0 = 0
• 𝑠3 = 1+0+1+1 = 1
• S = 001 error = 0000001
• Bits transmitted = v + error = 1011001 + 0000001 = 1011000
Cyclic Codes
• Cyclic code is a linear code that has the property that a cyclic shift on
any of its code-word produces another code-word.
• CW = {𝐶𝑛−1 , 𝐶𝑛−2 , 𝐶𝑛−3 ,………, 𝐶1 , 𝐶0 }
• CW = {𝐶𝑛−3 , 𝐶𝑛−4 , ……….., 𝐶0 , 𝐶𝑛−1 , 𝐶𝑛−2 } Shift left
• CW = {𝐶1 , 𝐶0 , 𝐶𝑛−1 ,………, 𝐶3 , 𝐶2 } Shift right
• Example (7,4) Hamming code
• 0011101 Left shift by two places results in 1110100 is also a CW
• 0011101 Right shift by two places results in 0100111 is also a CW
Polynomial Representation
• An n-bit (𝑎𝑛−1 , 𝑎𝑛−2 , 𝑎𝑛−3 , ………, 𝑎1 , 𝑎0 ) word can be represented by the
polynomial
𝑃 𝑥 = 𝑎𝑛−1 𝑥 𝑛−1 + 𝑎𝑛−2 𝑥 𝑛−2 + 𝑎𝑛−3 𝑥 𝑛−3 +……… + 𝑎1 𝑥 1 + 𝑎0 𝑥 0
• Code-word 𝐶 𝑥 = 𝑖 𝑥 ∗ 𝐺 𝑥
• Example: if i = (0101), find code-word CW
• 𝑖 𝑥 = 𝑥2 + 1
• 𝐶 𝑥 = (𝑥 2 + 1)*(𝑥 3 +𝑥 + 1)
• 𝐶 𝑥 = 𝑥5 + 𝑥3 + 𝑥2 + 𝑥3 + 𝑥 + 1
• 𝐶 𝑥 = 𝑥 5 + 𝑥 2 + 𝑥 + 1 = 0100111
Systematic Cyclic Encoding
CW = 𝑖 𝑥 *𝑥 𝑛−𝑘 + 𝑅 𝑥
Systematic Cyclic Encoding
• Example: For (7,4) if 𝑖 = (0101), find code-word CW
• 𝑖 𝑥 = 𝑥2 + 1
• Step 01: 𝑖 𝑥 ∗𝑥 𝑛−𝑘 = (𝑥 2 + 1)*𝑥 3 = 𝑥 5 + 𝑥 3
• Step 02: 𝑥 5 + 𝑥 3 / 𝑥 3 + 𝑥 + 1 𝑅 𝑥 = 𝑥 2
• Step 03: 𝑖 𝑥 ∗𝑥 𝑛−𝑘 + 𝑅 𝑥 = 𝑥 5 + 𝑥 3 + 𝑥 2 = 0101100
Decoding cyclic codes
• If the received word is 𝑣 𝑥
• Step 01: find syndrome polynomial 𝑆 𝑥 = 𝑅′ 𝑥 = 𝑣 𝑥 / 𝐺 𝑥
• Note: For error-free 𝑣 𝑥 = 𝐶 𝑥 ⇒ 𝑆 𝑥 = 𝑅′ 𝑥 = 0
𝑣 𝑥 = 𝐶 𝑥 + 𝑒 𝑥 ⇒ 𝑅′ 𝑥 = 𝑣 𝑥 / 𝐺 𝑥
⇒ 𝑅′ 𝑥 = (𝐶 𝑥 + 𝑒 𝑥 ) / 𝐺 𝑥 = 𝑒 𝑥 / 𝐺 𝑥
𝐶′ 𝑥 = 𝑣 𝑥 + 𝑒 𝑥
Error- Syndrome table
error E(x) S(x)
0000000 0 0
0000001 1 1
0000010 𝑥 𝑥
0000100 𝑥2 𝑥2
0001000 𝑥3 𝑥+1
0010000 𝑥4 𝑥2 + 𝑥
0100000 𝑥5 𝑥2 + 𝑥 + 1
1000000 𝑥6 𝑥2 + 1
Decoding Cyclic codes
• Example: Decode the code-word 1010011 of (7,4) codes when error incurred
is 1000000
• Solution:
𝐶 𝑥 = 𝑥6 + 𝑥4 + 𝑥 + 1
𝑒 𝑥 = 𝑥6
𝑟𝑒𝑐𝑒𝑖𝑒𝑣𝑒𝑑 𝑠𝑖𝑔𝑛𝑎𝑙 = 𝑣 𝑥 = 𝐶 𝑥 + 𝑒 𝑥 = 𝑥 6 + 𝑥 4 + 𝑥 + 1 + 𝑥 6
= 𝑥 4 + 𝑥 + 1 = 0010011
Decoding: 𝑆 𝑥 = 𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟𝑜𝑓 𝑣 𝑥 / 𝐺 𝑥 = 𝑥 2 + 1
From table 𝑆 𝑥 = 𝑥 2 + 1 corresponds to 𝑒 𝑥 = 𝑥 6
So 𝐶 ′ 𝑥 = 𝑣 𝑥 + 𝑒 𝑥 = 𝑥 4 + 𝑥 + 1 + 𝑥 6 = 𝑥 6 + 𝑥 4 + 𝑥 + 1 = 1010011