Vous êtes sur la page 1sur 5

International Conference on Advancements in Electronics and Power Engineering (ICAEPE'2011) Bangkok Dec.

, 2011

Efficient Hardware Implementation of Reed


Solomon Encoder and Decoder in FPGA using
Verilog
Aqib. Al Azad, Minhazul. Huq, Iqbalur. Rahman Rokon

Abstract In this paper, Reed Solomon (RS) Encoder and performs detection and correction of information (data)
Decoder and their hardware implementation in cyclone II Field symbols in a codeword. The RS encoded data is processed to
Programmable Gate Array (FPGA) is analyzed. RS codes are non- determine whether any errors have occurred during
binary cyclic error correcting block codes. Here redundant symbols transmission. Once the number of errors is determined, the
are generated in the encoder using a generator polynomial and added decoder decides if they are within the range of correction.
to the very end of the message symbols. Then RS Decoder
After determining this, the decoder corrects the errors in the
determines the locations and magnitudes of errors in the received
polynomial. The paper covers the RS encoding and decoding
received data.
algorithm, simulation results, basic FPGA technology and the k 2t
implementation details of the proposed RS encoder and decoder
architecture. Register transfer level (RTL) of RS encoder and decoder
is designed, simulated and implemented separately using Verilog in
s Data Parity
cyclone II FPGA. The design can also be synthesized to other FPGA
architectures.
n
Fig. 1 The Structure of a RS Codeword [4]
Keywords FPGA, RS, RTL,Verilog
The results constitute simulation of Verilog codes of
I. INTRODUCTION different modules of the Reed Solomon Encoder and Decoder
in Quartus II. The design was successfully implemented in the
R EED Solomon (RS) codes [1], encoders and decoders are
extremely powerful error correcting tools that increase
transmission quality to a great extent. RS codes operate on the
cyclone II FPGA using the Altera DE1 board.
This paper presents an efficient design and implementation
of RS Encoder and Decoder in FPGAs. The following
information by dividing the message stream into blocks of chronology is being followed to present the paper. In section
data, adding redundancy per block depending only on the II, the operation and architecture of RS Encoder is discussed.
current inputs. The symbols in RS coding are elements of a Then in section III, RS Decoding algorithm is given. Section
finite field or Galois Field (GF). A GF is a set that consists of IV deals with the design architecture. Design hierarchies for
finite number of elements. Encoding is achieved by affixing both RS Encoder and Decoder are shown and the basic blocks
the remainder of a GF polynomial division into the message. are described. Then in section V, we discussed
This division is accomplished by a Linear Feedback Shift implementation strategies where details of design architecture
Register (LFSR) implementation. The mathematics of RS and hardware blocks are shown. Further on, in section VI,
encoding is based on finite field arithmetic [2], [3]. GF implementation results are presented and in section VII,
multipliers are used for encoding the information block. The conclusion is drawn based on our results.
function of the decoder is to process the received codeword to
compute an estimate of the original message symbols. II. RS ENCODER
Typically about ten times more resources are required to
decode and correct the corrupted data. The codes are The Reed Solomon Encoder reads in k data symbols
represented by the format RS (n, k) where n is the total computes the n k symbols, append the parity symbols to the
number of s-bit wide symbols, and k is the number of s-bit k data symbols for a total of n symbols. The encoder is
wide information (data) symbols in a codeword. RS Decoder essentially a 2t tap shift register where each register is m bits
wide. The multiplier coefficients are the coefficients of the RS
Aqib Al Azad is a graduate student from Department of Electrical generator polynomial. The general idea is the construction of a
Engineering and Computer Science, North South University, Dhaka, polynomial, the coefficient produced will be symbols such that
Bangladesh (e-mail: aqibazad@ymail.com).
Minhazul Huq is a graduate student from Department of Electrical the generator polynomial will exactly divide the data/parity
Engineering and Computer Science, North South University, Dhaka, polynomial. [5]
Bangladesh (e-mail: minhazhuq@yahoo.com). The transmitted codeword is systematically encoded and
Iqbalur Rahman Rokon is a Faculty member in North South University, defined in as a function of the transmitted message m(x), the
Dhaka, Bangladesh. Former Sr. Engineer, VLSI Chip Research and
Development (R&D), Emulex Corporation, California, USA (Phone: +88-
generator polynomial g(x) and the number of parity symbols
01726246189 ; e-mail: irahman@northsouth.edu ). 2t as given below.

117
International Conference on Advancements in Electronics and Power Engineering (ICAEPE'2011) Bangkok Dec., 2011

c(x) = m(x) * 2t + m(x)modg(x) (1)


Where, g(x) is the generator polynomial of degree 2t and
given by,
g(x) = (x + i )(x + i +1 ) (x + i + 2t 2 )(x + i + 2t 1 ) (2)

A. Operation
RS codes are systematic, so for encoding, the
information symbols in the codeword are placed as the higher
power coefficients. This requires that information symbols
must be shifted from power level of (n-1) down to (n-k) and
the remaining positions from power (n-k-1) to 0 be filled with
zeros. Therefore any RS encoder design should effectively Fig. 2 Architecture of RS Encoder
perform the following two operations, namely division and
shifting. Both operations can be easily implemented using III. RS DECODER
Linear-Feedback Shift Registers [5], [6], [7]. The decoding procedure for Reed- Solomon codes
Reed-Solomon codes may be shortened by involves determining the locations and magnitudes of the
(conceptually) making a number of data symbols zero at the errors in the received polynomial R(x). Locations are those
encoder, not transmitting them, and then re-inserting them at powers of x (x2, x3, and others) in the received polynomials
the decoder. Encoder architecture is shown in Fig. 2. whose coefficients are in error. Magnitudes of the errors are
The Encoder architecture shows that one input to each symbols that are added to the corrupted symbol to find the
multiplier is a constant field element, which is a coefficient of original encoded symbol. These locations and magnitudes
the polynomial g(x). For a particular block, the information constitute the error polynomial. Also, if the decoder is built to
polynomial M(x) is given into the encoder symbol by symbol. support erasure decoding, then the erasure polynomial has to
These symbols appear at the output of the encoder after a be found. An erasure is an error with a known location. Thus,
desired latency, where control logic feeds it back through an only the magnitudes of the erasures have to be found for
adder to produce the related parity. This process continues erasure decoding. A RS (n, k) code can successfully correct as
until all of the k symbols of M(x) are input to the encoder. many as 2t = n-k erasures if no errors are present. With both
During this time, the control logic at the output enables only errors and erasures present, the decoder can successfully
the input data path, while keeping the parity path disabled. decode if n-k 2t +e, where t is the number of errors, and e is
With an output latency of about one clock cycle, the encoder the number of erasures [9].
outputs the last information symbol at (k+1)th clock pulse.
A. Operation
Also, during the first k clock cycles, the feedback control logic
feeds the adder output to the bus. After the last symbol has When a RS Decoder corrects a symbol, it replaces the
been input into the encoder (at the kth clock pulse), a wait incorrect symbol with the correct one, whether the error was
period of at least n-k clock cycles occurs. During this waiting caused by one bit being corrupted or all of the bits being
time, the feedback control logic disables the adder output from corrupted. Thus, if a symbol is wrong, it might as well be
being fed back and supplies a constant zero symbol to the bus. wrong in all of its bit positions. This gives RS codes
Also, the output control logic disables the input data path and tremendous burst-noise advantages over binary codes [10]. RS
allows the encoder to output the parity symbols (k+2th to Decoder mainly works on five steps:
n+1th clock pulse). Hence, a new block can be started at the 1. Calculate the syndromes.
n+1th clock pulse [6]. 2. Use the syndromes to determine the error
locator polynomial.
B. Architecture 3. Find the roots of the error locator
The encoder is architected using the Linear Feedback polynomial. The inverses of these roots give the
Shift Register Design. The coefficients , 0<i<15 are derived locations of errors.
as, 4. Use the syndromes, roots, and error locator
g(x) = x 16 + 59x 15 + 13x 14 + 104x 13 + 189x 12 + 68x 11 polynomial to determine the error magnitudes.
5. Use the information about error location and
+ 209x 10 + 30x 9 + 8x 8 + 163x 7 + 65x 6 (3)
magnitude to actually correct the errors.
+ 41x 5 + 229x 4 + 98x 3 + 50x 2 + 36x + 59
Each message is accompanied by a pulse signal, which The first step is to calculate the syndrom values [11]
indicates the beginning of a message. After 239 clock cycles, from the received codeword. These are then used to find the
the encoder starts concatenating the 16 calculated parities to coefficients of the error locator polynomial 1 .... v and the
the message to make a codeword of 255 symbols [8]. error magnitude polynomial 0 .... v-1 using the Euclidean
algorithm [12]. The error locations are figured out by the
Chien search [13] and the error magnitudes are calculated

118
International Conference on Advancements in Electronics and Power Engineering (ICAEPE'2011) Bangkok Dec., 2011

using Forney's method [14]. The error magnitude vector Y 3) Parity check: The parity check block allows the
comes out of the Chien/Forney block in reverse order, so it is encoder to output parity symbols.
passed through a FIFO block before it is added to the received
C. Block description of RS Decoder
codeword R(x). As these calculations involve all the symbols
of the received code word, it is necessary to restore the 1) SCBlock: At the end of received word, all cells store
message until the results of the calculation are available. Then, the syndrome values and Syndrome Computation (SC) block
to correct the errors, each error value is added (modulo 2) to sets its flag high if one or more syndrome values are not zero.
the symbol at the appropriate location in the received 2) KESBlock: The Key equation solver (KES) block
codeword [15]. provides two polynomial -error locator polynomial and error
magnitude polynomial.
B. Architecture 3) CSEEBlock: Chien Search and Error Evaluator
(CSEE) block identifies error location while computes its error
magnitude.
4) FIFO register: FIFO register stores 32 received
word symbols. To match the order of the bytes in error vector
and received codeword FIFO is applied as the error vector is
produced in the reverse order of the received codeword.
5) Controller: The controller provides synchronization
among all four modules -SC, KES, CSEE and FIFO Registers.

V. METHODOLOGY AND HARDWARE ARCHITECTURE


In this section we describe the design procedure and the
architecture of RS Encoder and Decoder. Fig. 6 shows the
Fig. 3 General Architecture of RS Decoder [11] different stages of our design. The Verilog model was
synthesized with Quartus II Software targeted for Cyclone II
IV. IMPLEMENTATION DETAILS OF BASIC BLOCKS (EP2C20F484C7) device and simulated with Modelsim.
FPGA technology was chosen because it provides some
A. Design hierarchy
important advantages over general purpose processors and
application specific integrated circuits (ASICs).

Fig. 4 Design hierarchy for RS Encoder

Fig. 5 Design hierarchy for RS Decoder Fig. 6 Implementation flow

B. Block description of RS Encoder Fig. 7 and Fig. 8 show the internal block diagram for
1) Polynomial generator: For the design we used the RS Encoder and Decoder respectively. Fig. 9 and Fig. 10
following field generator polynomial illustrate the implemented components inside the chip.
p(x) = x 8 + x 4 + x 3 + x 2 + x 1 + 1 (4)
Additionally, the interconnections of the components are
shown.
and the generator polynomial
g(x) = g 0 + g 1 (x) + g 2 (x 2 ) + + g 2t 1 (x 2t 1 ) + x 2t (5)
2) Data-rom: We provide a ROM as the message to
encode.

119
International Conference on Advancements in Electronics and Power Engineering (ICAEPE'2011) Bangkok Dec., 2011

VI. RESULTS
Table I and Table II show synthesis results of RS
Encoder and RS Decoder.
TABLE III
SYNTHESIS SUMMARY FOR RS ENCODER

Top-level Entity Name : encode


Family : Cyclone II
Device : EP2C20F484C7
Timing Models : Final
Total logic elements : 302 / 18,752 ( 2 % )
Total combinational functions : 302 / 18,752 ( 2 % )
Dedicated logic registers : 256 / 18,752 ( 1 % )
Total registers : 256
Total pins : 21 / 315 ( 7 % )
Total virtual pins : 0
Fig. 7 Internal block diagram of RS Encoder
Total memory bits : 0 / 239,616 ( 0 % )
Embedded Multiplier : 0 / 52 ( 0 % )
Total PLLs : 0/4(0%)

TABLE IV
SYNTHESIS SUMMARY FOR RS DECODER

Top-level Entity Name : RSDecoder


Family : Cyclone II
Device : EP2C20F484C7
Timing Models : Final
Total logic elements : 1,342 / 18,752 ( 7%)
Total combinational functions : 302 / 18,752 ( 2 % )
Dedicated logic registers : 256 / 18,752 ( 1 % )
Total registers : 256
Total pins : 21 / 315 ( 7 % )
Fig. 8 Internal block diagram of RS Decoder
Total virtual pins : 0
Total memory bits : 0 / 239,616 ( 0 % )
Embedded Multiplier : 0 / 52 ( 0 % )
Total PLLs : 0/4(0%)

Fig. 9 Technology Schematic of RS Encoder

Start of encoding input message Encoded output

Fig. 10 Technology Schematic of RS Decoder Fig. 11 Output of RS Encoder

120
International Conference on Advancements in Electronics and Power Engineering (ICAEPE'2011) Bangkok Dec., 2011

Fig. 11 and Fig. 12 describe the simulation waveform of error detection and correction techniques have been used
RS Encoder and Decoder. which are essential for reliable communication over a noisy
For RS Encoder, the simulation result verifies our channel. The results demonstrate that the Reed Solomon codes
design. The encoder has an error indicator that points out the are very efficient for the detection and correction of burst
presence of errors in the data. errors. RS codes are used significantly in Wireless
Communication (mobile phones, microwave links), Deep
Space and Satellite Communications Networks (CCSDS),
mass storage devices (hard disk drives, DVD, barcodes),
digital TV, digital video broadcasting (DVB), and Broadband
Modems (ADSL, VDSL, SDSL, HDSL etc). Technologies are
becoming smarter and compact day by day, so we hope our
work will add new dimension in that trend. This design will
play a remarkable role with its significant speed and
efficiency.

ACKNOWLEDGMENT
At first the authors would want to thank Allah for
giving them the opportunity to do this work. They would also
1st code 2nd code 1st recvd. 2nd recvd. 3rd code 3rdrecvd.
like to thank Dr. M Abdul Awal, Chairman of EECS
word word codeword codeword word codeword Department, North South University for providing the
facilities for the completion of this work.
Fig. 12 Output of RS Decoder

For RS Decoder the simulation waveform contains REFERENCES


three different received word vectors. First received word [1] I.S. Reed and G. Solomon, Polynomial Codes Over Certain Finite
contains no error symbol, second word contains 6 error Fields, SIAM Journal of Applied Mathematics, vol. 8, 1960, pp. 300
304.
symbols and the last word contains 8 error symbols. Our [2] R. J. McEliece, Finite Fields for Computer Scientists and Engineers.
decoder can correct up to 6 error symbols. Because the Boston, MA: Kluwer Academic, 1987.
number of errors is greater than correction capability in the [3] S. B. Wicker, Error Control Systems for Digital Communication and
Storage, Englewood Cliffs, N.J.: Prentice-Hall, 1994.
third received word, decoder will resume decoding failure in [4] M. Kaur and V. Sharma, Study of Forward Error Correction using
this case at the end of outputted received word. As decoding ReedSolomon Codes, International Journal of Electronics
failure is detected after all elements in GF have been evaluated Engineering, vol. 2, pp. 331 333, 2010.
, so uncorrectable word is summed with error values and it [5] Reed-Solomon (RS) Coding Overview, VOCAL Technologies, Ltd.,
Rev. 2.28n, 2010.
gives some wrong message at the output only in the case [6] S. Kaur VHDL Implementation of Reed-Solomon code, Thesis,
where the number of errors are greater than the decoder Thapar Institute of Engg, 2006.
correction capability. [7] J. Y. Chang and C. B. Shung, A high speed Reed-Solomon codec
chip using look forward architecture, IEEE APC CAS94, pp. 212-217,
Dec. 1994.
[8] K. C. C. Wai and S. J. Yang, Field Programmable Gate Array
Implementation of Reed-Solomon Code, RS (255, 239), New York
(2006).
[9] S. S. Shah, S. Yaqub, and F. Suleman, Self-correcting Codes Conquer
Noise Part 2: Reed-Solomon Codecs, EDN, Mar. 15, 2001, pp. 107-
120.
[10] B. Sklar. Digital Communications: Fundamentals and Applications, 2nd
ed., Upper Saddle River, NJ: Prentice-Hall, 2001. p. 441.
[11] C.K.P. Clarke. Reed-Solomon error correction, BBC R&D White
Paper,WHP 031, July 2002.
[12] M. Purser. Introduction to Error Correcting Codes. Artech House.
Boston-London, 1995.
[13] R. T. Chien. "Cyclic Decoding Procedure for the Bose- Chaudhuri-
Hocquenghem Codes." IEEE Transactions on Information Theory,
Volume IT-10, pp. 357-363, Oct. 1964.
[14] G. D. Forney. "On Decoding BCH Codes." IEEE Transactions on
Information Theory, Volume IT-11, pp. 549-557, Oct. 1965.
Fig. 13 FPGA implementation on Altera DE1 board [15] E. R. Berlekamp, R. E. Peile and S. P. Pope. The Application of Error
Control to Communications. IEEE Communications Magazine, vol. 25,
no. 4, pp. 44-57, Apr. 1987.
VII. CONCLUSIONS
In this work an efficient hardware implementation of
RS Encoder and Decoder was presented. The design was
implemented in real hardware with Cyclone II FPGA. Here

121

Vous aimerez peut-être aussi