Reed Solomon codes are a class of non-binary linear block codes that are defined over finite fields GF(q)
, where q
is a power of a prime, usually 2. Ignoring (a lot of) details, this means:
GF(q)
) of two codewords is another codeword.GF(2^m)
, as opposed to binary codes which work over symbols from GF(2)
, i.e., binary digits. m
bits.Reed Solomon codes are usually speciefied by three parameters m, n, and k, where:
Take for example RS(15, 9) over GF(2^4):
Other codes in use:
Let,
The decoder tries to find a minimum weight error pattern e', such that v' = r - e' is a valid codeword.
Let t' be the actual number of errors. Then there are three possibilities:
Decoding error is thus a silent failure. Fortunately, for practical codes, it is very rare. Additional CRC in upper protocol layers also help.
Consider RS(n, k), with t = (n - k)/2.
Let, $X$ = number of (symbol) errors in the codeword (0 <= X <= n), and
$P_X(x)$ = PMF of X = $Pr\{X = x\}$
Also, let $Y$ = number of (symbol) errors in the codeword (0 <= Y <= n) post FEC.
Then, the probability of not-decoding-correctly is
$$ P_{ndc} = Pr\{X >= t + 1\} = \sum_{x = t+1}^{n} P_X(x) $$Also, the expected number of symbols errors is
$$ \begin{aligned} E[X] &= \sum_{x = 0}^{n} x \cdot P_X(x) \\ E[Y] &= \sum_{y = t+1}^{n} y \cdot P_X(y) \end{aligned} $$The pre and post FEC symbol-error rates and bit error rates can be calculated as $$ BER_{pre} = \frac{pe}{pe + 1 - pb}, \qquad SER_{pre} = \frac{E[X]}{n}, \qquad SER_{post} = \frac{E[Y]}{n}, \qquad BER_{post} = \frac{BER_{pre} * SER_{post}}{SER_{pre}}. $$
In [1]:
import numpy as np
import matplotlib.pyplot as plt
from scipy.misc import factorial
from errsim import *
%matplotlib inline
import matplotlib.pylab as pylab
pylab.rcParams['figure.figsize'] = 12, 10
In [6]:
# Error PMF, P(x, n) = Prob{x symbol errors in a block of n symbols}
# pe = Prob. of bit error in normal/good state
# pb = Prob. of bit error in burst/bad state
# m = Number of bits per symbol
# n = Number of symbols per block
# Simulated PMF: pe=1e-2, pb=0.5, m=4, n=15, nblks=1e6
np.random.seed(1)
spmf_1em2_0p5_4_15 = errhist(1e-2, 0.5, 4, 15, int(1e6)) / 1e6
# Analytical PMF: pe=1e-2, pb=0.5, m=4, n=15
apmf_1em2_0p5_4_15 = errpmf(1e-2, 0.5, 4, 15)
In [7]:
x = np.arange(16)
plt.semilogy(x, apmf_1em2_0p5_4_15[x], 'b-', label='Analytical 1e-2, 0.5, 4, 15')
plt.semilogy(x, spmf_1em2_0p5_4_15[x], 'ro--', label='Simulation 1e-2, 0.5, 4, 15')
plt.title('P(x, n) = Prob{x symbol errors in n symbol block}')
plt.xlabel('Symbols, x')
plt.ylabel('Probability')
plt.legend()
plt.grid()
In [ ]: