The Study of Algorithm for RS(255, 239) Code and Decode
Gang Jin, Hui-lan Zou, Guo-ying Hu, Zhong-xun Wang, Yun-xue Liu,Peng-fei He
The Study of Algorithm for RS(255, 239) Code and Decode
1Gang Jin, 2Hui-lan Zou, 3Guo-ying Hu, 4Zhong-xun Wang, 5Yun-xue Liu, 6Peng-fei He
1Institute of Optical - electronic Engineering, Yantai University, China,
E-mail:[email protected]
2Physics and Electronics Engineering, Central University For Nationalities, China
3,4,5,6Institute of Optical - electronic Engineering, Yantai University, China
Abstract
Based on the ADSL for the Mine Communication System, constant-coefficient multipliers are
designed in GF(28). By using certain constant-coefficient multipliers, the variable-coefficient multiplier
and the inverse multiplier are achieved, the algorithm for Reed-Solomon code and decode are studied
and the corresponding simulation of the algorithm with language C program are also implemented.
Keywords: Reed-Solomon Code, Galois Field, Multiplier, ADSL, Mine Communication
1. Introduction
ADSL technology has become more and more mature. Underground image will be timely feedback
to the ground control center by using it in the mining communication. It can overcome harsh
environmental conditions while fiber-optic communication does not meet the mine electrical safety
standards in China. So it’s very significant to use ADSL technology in the mining communications.
Using ADSL system with twisted pair line in the mine communication may cause serious errors due
to the severe underground environment and the long transmission distance [1]. Therefore, appropriate
measures should be taken to reduce or even eliminate this error, and the RS code is then such a very
effective error-correcting code.
RS code is the abbreviation of Reed-Solomon code. It is a very effective error correction block code
[2]. In mobile communications and other fading channel, RS code is often used as the outer code of the
concatenated codes [3]. The key of RS code is decoding algorithm, and there many algorithm for RS
decode. In this article, constant-coefficient multipliers and a variable-coefficient multiplier are
designed in Galois Field based on the ADSL for the Mining Communication System. By using the
multipliers, the algorithm for RS(255,239) code and decode are studied in details as well as the
language C program simulation of the algorithm. The coder and decoder have simple logical
implementation, high speed performance, and low-cost and low-power processor design.
2. Finite Field Multiplier
2.1. Finite field constant-coefficient multipliers
The design of the finite field multiplier is the important part of RS code. According to RS(255, 239),
the primitive polynomial in GF (28 ) is defined as: P(x) x8 x4 x3 x2 1 (1)
It can get all elements in GF (28 ) from primitive polynomial. And the results of arithmetic operations
of the elements are still in the finite field [4].
According to RS (255,239) coding algorithm, 16 special constant-coefficient multipliers are needed
as follows: 11 X , 83 X , 100 X , 106 X , 107 X , 110 X , 113 X , 121 X ,
136 X , 158 X , 167 X , 181 X , 195 X , 201 X , 208 X , 240 X
International Journal of Digital Content Technology and its Applications(JDCTA) 91
Volume7,Number9,May 2013
doi:10.4156/jdcta.vol7.issue9.12
The Study of Algorithm for RS(255, 239) Code and Decode
Gang Jin, Hui-lan Zou, Guo-ying Hu, Zhong-xun Wang, Yun-xue Liu,Peng-fei He
And according to RS (255,239) decoding algorithm, 16 special constant coefficient multipliers are
designed as follows: 1 X , 2 X , , 16 X .
2 , and X is a variable in the finite field of GF(28) among 0 to 255.
2.2. Finite field constant-coefficient multipliers
It also needs finite field variable-coefficient multipliers in RS decoding process. If design the
specific variable multiplier, it needs more resources and makes more complex structure. So, to achieve
the variable multiplier by the existing constant multipliers can greatly simplify the multiplier’s
structure.
Suppose A , X and Y are the elements of GF (28 ) ,
A a7 7 a6 6 a5 5 a0 0 ,( a7 ~ a0 is “1” or “0”). (2)
Y=A X=(a7 7 a6 6 a0 0 ) X a7 7 X a6 6 X a0 0 X (3)
7 X , 6 X , , 0 X are constant multipliers designed before.
3. Finite Field Reciprocal Multiplier
For any element ‘A’ in the finite field GF(28) :
A A28 (4)
A1 A28 2 A2122 23 24 25 26 27 A21 A22 A23 A24 A25 A26 A27 (5)
A21 A A (6)
A22 A21 A21 (7)
A27 A26 A26 (8)
The finite field reciprocal multiplier can be achieved by variable-coefficient multiplier designed
before [5].
4. RS(255, 239) Code
RS(255,239) code can correct up to 8 errors, and the parameters of RS(255,239) code are as
follows:
Coded symbols: n 255 ; Errors corrected: t 8 ;
Actual errors corrected: v t ; Data symbols: k 239 ;
Parity symbols: n k 2t 16 ; 1 symbol = 8 bits.
The binary primitive polynomial’s defined as: P(x) x8 x4 x3 x2 1 (9)
The generator polynomial of RS(255,239) code is:
g(x) (x ) (x 2 ) (x 3 ) (x 16 )
x16 121x15 106 x14 110 x13 113 x12 107 x11 167 x10 83 x9 11x8
100 x7 x201 6 158 x5 181x4 195 x3 x208 2 x240 1 136 (10)
It can get encoder architecture from the generator polynomial shown as Figure 1. RS encoder can be
made by a group of linear feedback shift registers, finite field constant-coefficient multipliers, finite
field adders and the pulse switch.
92
The Study of Algorithm for RS(255, 239) Code and Decode
Gang Jin, Hui-lan Zou, Guo-ying Hu, Zhong-xun Wang, Yun-xue Liu,Peng-fei He
Figure1. RS(255,239) Encoder Architecture
Program flow chart of RS(255,239) encoder simulated with language C is shown as Figure 2.
Start
j=239 (j--)<0? N
i=16
Y
i=15
gf_out1[i]=gen[i]
N
NY Y
Return
Figure 2. Program flow chart of RS(255,239) encoder
gfk (x) ---- Finite field constant-coefficient multipliers, k 0,1,,15 .
gen[k] ---- Linear feedback shift registers.
gate ---- Sum of input symbol and Reg15.
gf _ in[i] ---- Input symbols, i 0,1,, 238 .
gf _ out[ j] ---- Output symbols, j 0,1,, 254 .
5. RS(255, 239) Decode
RS decode is the most complex part, and there are many methods for RS decoding in time domain
or frequency domain. Because the structure of decode in time domain is simple and it need not FFT,
we choose RS decode in time domain. There are four steps for RS decode [6]. Suppose:
n (11)
Send code vector: C(x) Cni xni
i 1
n (12)
Receive code vector: R(x) Rni xni
i 1
93
The Study of Algorithm for RS(255, 239) Code and Decode
Gang Jin, Hui-lan Zou, Guo-ying Hu, Zhong-xun Wang, Yun-xue Liu,Peng-fei He
n (13)
(14)
Channel error vector: E(x) Eni xni
i 1
Then R(x) C(x) E(x)
n nn (15)
So: Cni xni Rni xni Eni xni
i1 i1 i1
The actual number of errors v that can correct is less than t .
Suppose: E(x) Y1xl1 Y2 xl2 Yv xlv (16)
Error location number: xl1 , xl2 , , xlv .
Error values: Y1 , Y2 , , Yv .
Error locations: l1 , l2 , , lv .
The main task of decode is to calculate the error location Y and error value l from the received
code vector R(x) .
5.1. Syndrome calculator
The t errors correcting monitoring matrix of RS code:
n1 n2 1
1
( 2 )n1 ( 2)n2 2
H (17)
2t )n 1 ( 2t )n2 ( 2t ) 1 (18)
( (19)
The Syndrome of received code:
n1 n Rni ( 1 )ni
i 1
n2 1 Rn1 n Rni ( 2 )ni R( )
( )2 n1 ( 2 )n2 2 1 i 1
S Rn2 R( 2 )
n
( 2t )
( 2t )n2
( 2t )n1 1 R0 R( 2t )
Rni ( 2t )ni
i 1
[S1, S2 ,, S2t ]T
n
S j R( j ) Rni ( )j ni (((R0 R1) Rn2 ) Rn1 , ( j 1,2t)
i 1
The used 16 constant-coefficient multipliers are 1 X , 2 X , , 16 X .
Architecture of syndrome calculator is shown as figure 3.
K1 S15 S1
15 1
S16
K2
16
Figure3. Syndrome calculator architecture
94
The Study of Algorithm for RS(255, 239) Code and Decode
Gang Jin, Hui-lan Zou, Guo-ying Hu, Zhong-xun Wang, Yun-xue Liu,Peng-fei He
The program flow chart of syndrome calculator is shown as figure 4.
j 254 1 i 16, S _ add 0
i 16 S _ add S _ add S[i]
S[i] S[i] i (i ) 1?
S _ add 0?
S[i] S[i] gf _ out1[ j]
(i ) 1?
( j ) 0?
Figure4. Program flow chart of syndrome calculator
5.2. Berlekamp-Massey algorithm
1, 2t are roots of C(x) for each code polynomial, which are multiple of generator
polynomial. That is: C( j ) 0 (20)
R( j ) C( j ) E( j ) E( j ) . (21)
Substitute E(x) Y1xl1 Y2 xl2 Yv xlv , (22)
therefore E( j ) Y1(xl1 ) j Y2 (xl2 ) j Yv (xlv ) j S j , j 1, 2,2t (23)
Let X k xlk ,( k 1, 2,v ) (24)
(25)
v .
(26)
S j Yk (xlk ) j
k 1 (27)
(28)
That is (29)
S1 Y1 X1 Y2 X 2 Yv X v
S2
Y1 X12 Y2 X 2 Yv X 2 .
2 v
S1 Y1 X 2t Y2 X 2t Yv X 2t
1 2 v
Define the error locator polynomial:
(x) 1 1x t1xt1 t xt 0 ,
Then the reciprocal of its root is just the error location number.
tt t
So, Yk ( X k ) jt 1Yk ( X k ) jt1 tYk ( X k ) j 0
k 1 k 1 k 1
S jt 1S jt1 t S j 0 , ( j 1, 2,, t ).
Program flow chart of error polynomial is shown as figure 5.
95
The Study of Algorithm for RS(255, 239) Code and Decode
Gang Jin, Hui-lan Zou, Guo-ying Hu, Zhong-xun Wang, Yun-xue Liu,Peng-fei He
( j ) 0?
dn 0? ln t ?
n1(x) n (x) n1(x) n1(x) dndm1xnm n (x)
ln1 ln ln1 max[ln , n m lm ]
dn Sn1 Sn1n S n1ln lnn
n n 1
Figure 5. Program flow chart of error polynomial
5.3. Chien Search Error Location
According to the definition of the error locator polynomial (x) 0 , the error locator is the
reciprocal of the root (x) 0 which can use Chien search by putting 0 , 1, 255 to the
equation. Chien Search block architecture is shown as Figure 6.
Yni
1 2 3 4 5 6 7 8 8
1 2 3 4 5 6 7 8
i i
i 1
Figure 6. Chien Search Block Architecture
The Program flow chart of Chien Search is shown as Figure 7.
8
i
_ sum i i
i 1
_ sum 1?
i i i ( j ) 0?
(i ) 1?
Figure7. Program flow chart of Chien Search
96
The Study of Algorithm for RS(255, 239) Code and Decode
Gang Jin, Hui-lan Zou, Guo-ying Hu, Zhong-xun Wang, Yun-xue Liu,Peng-fei He
5.4. Error Corrector
When the actual number of errors v t ,
tv (30)
(x) (1 Xk x) i xi ,( 0 1, i 1, 2,, v ). (31)
i1 i0
(32)
(x) v (33)
1 Xkx (34)
Define ki xi (35)
k (x) , (36)
i0 (37)
(38)
v v v1
(39)
(x) k (x) (1 Xk x) (1 Xk x) ki xi ki xi kiXk xi ,
i0 i0 i0
k0 0 1,
i ki k (i1) X k
or ki i k(i1) X k , ( i 1, 2,, v 1 ),
v1 v1 v v v1 v 1
then
ki Svi ki ( Yj X vi ) Yj X v ( ki X i ) Y j X vj k ( X 1 ) ,
j j j j
i0 i0 j1 j1 i0 i0
ki Svi 0 , ( j k ),
v1 v1
kiSvi
Yk X vj ki ( X 1 ) Yk ki X vi ,
j k
i0 i0
v 1
ki Svi
i0
and therefore Yk v 1 .
X ei
ki k
i0
Program flow chart of error corrector is shown as Figure 8.
v1
xk
x vi1
ki k
i0
v1
kis vi
i0
Figure 8. Program flow chart of Error Corrector
6. Result of language C simulation
6.1.Rs(255,239) encoder
Generate 239 random symbols as message codes in finite field of GF(28) with function rand( ) in
language C. The message codes are encoded by RS(255,239) encoder, and generate 16 parity symbols
followed by 239 message code shown as Figure 9.
97
The Study of Algorithm for RS(255, 239) Code and Decode
Gang Jin, Hui-lan Zou, Guo-ying Hu, Zhong-xun Wang, Yun-xue Liu,Peng-fei He
Figure 9. Result of RS(255,239) encode
Codes with 8 random errors are shown as Figure10.
Figure 10. Codes with 8 errors in transmission
6.2.Rs(255,239) decoder
255 message codes are decoded by RS(255,239) decoder. There are 16 parity symbols followed by
239 code symbols shown as Figure 16. It proved that the algorithm of RS(255,239) can correct no
more than 8 errors. Results of RS(255,239) decode are shown as Figure11.
Figure 11. Result of RS(255,239) decode
7. Conclusions
In this paper we designed 31 constant-coefficient multipliers and achieved the variable-coefficient
multiplier and finite field reciprocal multiplier. And then we simulated the algorithm of RS(255,239)
98
The Study of Algorithm for RS(255, 239) Code and Decode
Gang Jin, Hui-lan Zou, Guo-ying Hu, Zhong-xun Wang, Yun-xue Liu,Peng-fei He
encode and decode in finite field GF (28 ) with language C. Table 1 shows the number of additions and
multiplications in RS(255,239) encode and decode in each block.
Table 1. The times of addition and multiplication
Block additions multiplications
Encode 2t k 3824 2 t k 3824
Syndrome calculator 2N t 8192 2 N t 8192
Error polynomial 2 t 2 512 2 t 2 512
Error locations N (t 1) 3840 N t 4096
Error correct 2 t 2 512 2 t 2 512
The times of addition and multiplication in encoding are much larger, so it’s quite useful designing
special constant-coefficient multipliers to make the speed of RS code much faster.
In decoding, the number of additions and multiplications of the Syndrome calculator block and the
error locations block are much larger too. Pipelining and parallel processing unit on DSP can be used
to improve the decoding speed and efficiency. We may choose the TMS320C64 series DSP processor
and complete the RS decoder, which are simulated with C language with CCS2.0 and debugged on
DSK.
8. Acknowledgements
This work was supported in part by National Natural Science Foundation of China (No. 61202399)
and Provincial Scientific Foundation of Shandong (No. ZR2010FM026).
9. References
[1] Long Teng, John M.Cioffi, xDSL Technology and Application, Beijing: Publishing House of
Electronics Industry, China, 2002.
[2] Berry Klomp, “Reed-Solomon error correction for wireless embedded systems”, BSc Thesis,
university of Twente, the Netherlands ,2004.
[3] Wang Xin-mei, Xiao Guo-zhen, Error-correcting codes-Principles and Methods, Xi-an:Xidian
University Press, China, 2002.
[4] Zhang Ming-rui, Zou Shi-kai, Coding theory, Beijing: Beijing University of Aeronautics &
Astronautics Press,1990.
[5] Wang Jin-xiang, Mao Zhi-gang ,Ye Yi-zheng, “Design of a Fast Multiplier and Inverse of
Multiplier in GF(28) ”,Chongqing: Microelectronics, 1998.
[6] Berlekamp ER, “Bit-serialreed-solomonen-coders”, IEEE Trans Information Theory, 1982.
[7] Guoyu Wang, Tao Jiang, Hongsheng Zhang, Mingying Lu, Guangyu Guo, Chao Zhang, “An ASIC
Implementation of the MP3 Decoder for a DAB and MP3 Combined Chip”, AISS, Vol. 5, No. 3,
pp. 380 ~ 387, 2013.
[8] Nasser N. Khmiss, Msc Huthaifa T. Akrm, “A New Approach of Digital Subscriber Line2
Initialization Process”, IJACT, Vol. 2, No. 1, pp. 16 ~ 32, 2010.
[9] Ahmed J. Jameel, “Performance Enhancement of Wireless Communication Systems using
Transmit and Receive diversity” , IJACT, Vol. 2, No. 3, pp. 163 ~ 171, 2010.
[10] Zhao Yang, Geng Xiang-ming, “Encoding and Decoding Algorithm for Shortened Codes and Its
Performance Analysis”, Communications Technology, No.2, pp.49 ~ 52, 2012.
[11] Song Wei, Xu Wei, Dong Shu-zhen, Luan Bing, “Realization of high-speed and parallel RS
encoder in GPON”, Information Technology, No.2, pp. 59 ~ 62, 2012.
[12] Hanho Lee, “High-speed VLSI architecture for parallel Reed-Solomon decoder”, IEEE
Transactions on Very Large Scale Integration(VLSI)Systems, 2003.
[13] Zhu Qi-yue, “RS code and decode Algorithm”, Chengdu: Telecommunication Engineering, Vol.39
Apr. 1999.
[14] Dilip V. Sarwate, “High-speed decoder of Reed_Solomon codes”, IEEE Trans Commun, 1993.
99