| Author | Nnoduka Eruchalu |
| Date | 03/16/2014 |
| Author | He Guanchen |
| Date | 03/11/2022 |
本次实验参考了Nnoduka Eruchalu在Github上的代码。由于源代码已经完成了RS码的编码器与基于欧几里得算法的译码器,并且在多元对称信道已经完成了仿真,本人考虑将他的代码应用于BPSK调制后进入AWGN信道进行仿真。并且由于Berlekamp Massey算法在解递归方程组时效率更高,本人重新编写了基于BM算法的译码器。
核心代码已被修改,目前有效代码仅有main.cpp,reedSolomon.cpp,reedSolomon.h与primitives.h
The codes have been modified. The avalable codes now are only main.cpp, reedSolomon.h and primitives.h.
- C++
I implemented the t-error-correcting Reed-Solomon code of field size 2^m and
length n = 2^m -1, where m and t are variable input parameters. Note that k = n-2t.
This arithmetic is implemented over fields of characteristic 2.
-
alphais the root of primitive polynomial of orderm -
First the generator polynomial for the RS code is formed by following the equation:
g(x) = (x - alpha)(x - alpha^2)...(x - alpha^2t)Because we are working with mod2, - and + are interchangeable, so:
g(x) = (x + alpha)(x + alpha^2)...(x + alpha^2t) -
Given a message vector
m = (m_0, m_1,... m_(k-1))its corresponding message polynomial is:m(x) = m_0 + m_1*x + ... + m_(k-1)*x^(k-1)where each
m_iis in a Galois Field with2^melements,GF(2^m). The systematic encoding process produces a codeword defined by:c(x) = m(x)*x^(n-k) + [m(x)*x^(n-k)]%g(x)
Given a received vector rc(x) the algebraic decoding of the Reed-Solomon code
has the following steps:
-
Computation of the syndrome The syndromes are:
S_1 = rc(alpha)`; S_2 = rc(a^2); ... ; S_2t = rc(a^2t) ``` And the syndrome polynomial is: ``` s(x) = S_1 + S_2*x + ... + S_2t*x^(2t-1) ``` -
Determination of the error locator polynomial using the Euclidean Algorithm This runs the extended euclidean algorithm with:
a(x) = x^2tandb(x) = s(x), untildeg(r_i(x)) < t. At this terminating value ofi:- The error magnitude/value/evaluator polynomial:
omega(x) = r_i(x)/t_i(0) - The error locator polynomial:
lambda(x) = t_i(x)/t_i(0)
Below is the euclidean algorithm in pseudo-code:
Initialization: r_(-1)(x) = a(x); r_0(x) = b(x); s_(-1)(x) = 1; s_0(x) = 0 t_(-1)(x) = 0; t_0(x) = 1; while(deg(r_i(x)) >= t) { // compute quotient[q_i(x)] and remainder [r_i(x)] q_i(x) = r_(i-2)(x) / r_(i-1)(x) r_i(x) = r_(i-2)(x) % r_(i-1)(x) = r_(i-2)(x) - q_i(x)*r_(i-1)(x) s_i(x) = s_(i-2)(x) - q_i(x)*s_(i-1)(x) t_i(x) = t_(i-2)(x) - q_i(x)*t_(i-1)(x) } - The error magnitude/value/evaluator polynomial:
-
Finding the roots of the error locator polynomial using the Chien search The Chien search is an exhaustive search over all the elements in the field. Remember that the error locator polynomial is
lambda(x). So the Chien search goes through all the elements of theGF(2^m)field: (alpha^0toalpha^(n-1)) and iflambda(alpha^i) == 0then an error has been located at(alpha^i)^-1=alpha^(n-i)This can be interpreted as an error at location(n-i) -
Determine error values at error locations using Forney's Algorithm Forney's algorithm states that the error values for a Reed-Solomon code are computed by:
e_ik = omega(X_k^-1)/derivative[lambda(X_k^-1)]where
X_k^-1is a root oflambda(x) andi` is the index of the error location. -
Finally determine the decoded codeword The decoded codeword
dc(x)is determined with this logic:FOR all codewords indexed by i FROM 0 to n-1 if(at error location) dc_i = rc_i + e else dc_i = rc_i
The codewords (c_0, c_1, ..., c_(n-1)) are transmitted over a channel where symbol errors occur independently with probability Ps.
That is each received symbol rc_i = c_i + e_i, where rc_i, c_i, e_i are in GF(2^m) and
|1-Ps if a == 0
Prob(e_k = a) = |
|Ps/(2^m-1) if a != 0
I determined the performance of the Reed-Solomon codes for two different choices of code parameters:
m=7, t=60m=7, t=30
For each pair of m,t values the simulation outputs a plot of RS encoder/decoder's error rate as a function of the probability of channel error, Ps. This simulation showed that smaller t-values resulted in a faster rise to an error rate of 1 with increasing Ps values.
Read the following for more background information:
| Module | Description |
|---|---|
main.cpp |
Program's main loop that runs simulation |
primitives.h |
List of finite field primitive polynomials |
reedSolomon.h |
Class interface for RS encoder/decoder object |
reedSolomon.cpp |
Class implementation for RS encoder/decoder object |
simulation/ |
Folder containing screenshots of simulation |
In Terminal, enter g++ main.cpp reedSolomon.cpp -o main.exe to create the binary executable file main.exe
In Terminal, enter ./main.exe to run the code.
所有函数定义代码全部在 reedSolomon.cpp 文件中,main.cpp文件用于定义主程序,reedSolomon.h文件仅仅用于声明reedSolomon对象, primitives.h只用于存储本原多项式。



