By Glenn A. Emelko
Total Page:16
File Type:pdf, Size:1020Kb
A NEW ALGORITHM FOR EFFICIENT SOFTWARE IMPLEMENTATION OF REED-SOLOMON ENCODERS FOR WIRELESS SENSOR NETWORKS by Glenn A. Emelko Submitted to the Office of Graduate Studies at Case Western Reserve University in partial fulfillment of the requirements for the degree of DOCTOR OF PHILOSOPHY in ELECTRICAL ENGINEERING Department of Electrical Engineering and Computer Science Case Western Reserve University Glennan 321, 10900 Euclid Ave. Cleveland, Ohio 44106 May 2009 CASE WESTERN RESERVE UNIVERSITY SCHOOL OF GRADUATE STUDIES We hereby approve the thesis/dissertation of _Glenn A. Emelko____________________________________ candidate for the _Doctor of Philosophy_ degree *. (signed)_Francis L. Merat______________________________ (chair of the committee) _Wyatt S. Newman______________________________ _H. Andy Podgurski_____________________________ _William L. Schultz______________________________ _David A. Singer________________________________ ________________________________________________ (date) _March 2, 2009__________ * We also certify that written approval has been obtained for any proprietary material contained therein. i Dedication For my loving wife Liz, and for my children Tom and Leigh Anne. I thank you for giving me love and support and for believing in me every step along my journey. ii Table of Contents Dedication........................................................................................................................... ii List of Figures......................................................................................................................4 Abstract................................................................................................................................5 Acknowledgements..............................................................................................................6 Chapters I: Introduction ..........................................................................................................9 Design Constraints.......................................................................................9 Need for Error Correction Implemented in Software................................10 Dissertation Purpose and Summary ..........................................................11 II: Background on Galois Field Arithmetic ...........................................................12 Galois Fields..............................................................................................13 Arithmetic Operations................................................................................15 Extension Fields.........................................................................................17 Operations in Extension Fields..................................................................18 Primitive Elements.....................................................................................20 III: Reed-Solomon Error Correction Codes...........................................................22 Properties...................................................................................................22 Notation......................................................................................................23 Shortened Codes ........................................................................................24 Reed-Solomon Fundamentals ....................................................................25 Computing a Generator .............................................................................26 Valid Code Blocks......................................................................................28 1 How Reed-Solomon Allows Errors to be Corrected..................................28 The (7,3) RS Code......................................................................................28 Encoding Messages in (7,3) RS Code........................................................30 Reed-Solomon Using an LFSR...................................................................32 Generalized Error Correction ...................................................................35 Limitations .................................................................................................35 IV: Other Relevant Work.......................................................................................36 V: Implementation of a Reed-Solomon Encoder in Software ...............................38 Initial Program Listing ..............................................................................39 Galois Field Multiplication Function ........................................................40 Computing the Generator Polynomial.......................................................41 Reed-Solomon Encoder Function and Test Program ................................42 Irreducible Polynomials for Other Fields..................................................43 VI: Improving Efficiency.......................................................................................45 Multiplication by Adding Logarithms........................................................46 Using Multiples of Two in the Field ..........................................................47 Identify the Code to Convert to Assembly Language.................................49 Loop Unrolling ..........................................................................................50 VII: A Software Row-Based Algorithm for Reed-Solomon Encoders..................53 Multiplying “Row-at-a-Time” ...................................................................54 Evaluation of the Original Algorithm........................................................55 Evaluation of the Improved Algorithm ......................................................57 Step-by-Step Analysis of the Improved Algorithm .....................................57 2 Summary of the Algorithm .........................................................................59 Quantified Improvement ............................................................................61 VIII: Generalizing the Improved Algorithm..........................................................62 Pseudo-Code Implementation of the Improved Algorithm ........................64 Implementation ..........................................................................................66 Execution Speed.........................................................................................68 Analysis and Improvements .......................................................................69 IX: Conclusion.......................................................................................................72 Appendix A: Code Timing.................................................................................................73 Appendix B: Listing of program to select RS Generator Polynomials..............................74 Reference List ....................................................................................................................79 3 List of Figures Figure 1: Addition and Multiplication in GF(5) ................................................................16 2 2 Figure 2a, 2b: Addition and Multiplication in GF(3 )x +1 .................................................19 3 3 Figure 3a, 3b: Addition and Multiplication in GF(2 )x +x+1 ...............................................30 Figure 4: Example of long division in GF(23) with reducing polynomial x2+x+1............31 Figure 5: Construction of a LFSR to compute Reed-Solomon residues............................33 Figures 6a-6e: Reed-Solomon Encoder source code in C for GF(22) through GF(231).................................................................................... 39-43 Figure 7: Output from Reed-Solomon Encoder.................................................................44 Figure 8: Graph of execution speed for C implementation of a Reed- Solomon Encoder.......................................................................................45 Figure 9: Improving the Efficiency of GFMult() by using Logarithm and Exponent tables ...................................................................................46 Figure 10: Graph of execution speed after Improvement with the Powers-of-2 table.......................................................................................47 Figure 11: Source Code for GFMult() implementing Powers-of-2 table ..........................48 Figure 12: GFMult() implemented in PIC assembly code using shift-and-add.................49 Figure 13: Graph of execution speed for PIC assembly implementation of shift-and-add..........................................................................................50 Figure 14: Galois multiplication in PIC assembly, using unrolled shift-and-add..............51 Figure 15: Implementation of the Reed-Solomon encoder in PIC assembly.....................52 Figure 16: Table of sums and multiplies in the base algorithm from Figure 6..................56 Figure 17: Using inline row rather than column operations during multiplication ...........60 Figure 18: Table of sums and multiplies for the improved algorithm ...............................62 Figure 19: Example of a CDROM (32,28) RS encoder with inline row operations..........66 Figure 20: Example of a (32,28) RS encoder using the recommended polynomials ........70 4 A New Algorithm for Efficient Software Implementation of Reed-Solomon Encoders for Wireless Sensor Networks Abstract by Glenn A. Emelko With the recent introduction and development of ad-hoc