Implementation and Evaluation of Polar Codes in 5G
Total Page:16
File Type:pdf, Size:1020Kb
Implementation and evaluation of Polar Codes in 5G Implementation och evaluering av Polar Codes för 5G Tobias Rosenqvist Joël Sloof Faculty of Health, Science and Technology Computer Science 15 hp Supervisor: Stefan Alfredsson Examiner: Kerstin Andersson Date: 2019-06-12 Serial number: N/A Implementation and evaluation of Polar Codes in 5G Tobias Rosenqvist, Joël Sloof © 2019 The author(s) and Karlstad University This report is submitted in partial fulfillment of the requirements for the Bachelor’s degree in Computer Science. All material in this report which is not our own work has been identified and no material is included for which a degree has previously been conferred. Tobias Rosenqvist Joël Sloof Approved, Date of defense Advisor: Stefan Alfredsson Examiner: Kerstin Andersson iii Abstract In today’s society the ability to communicate with one another has grown, were a lot of focus is aimed towards speed in the telecommunication industry. For transmissions to become even faster, there are many ways to enhance transmission speeds of which error correction is one. Padding messages such that they are protected from noise, while using as few bits as possible and ensuring safe transmit is handled by error correction codes. Short codes with low complexity is a solution to faster transmission speeds. An error correction code which has gained a lot of attention since its first appearance in 2009 is Polar Codes. Polar Codes was chosen as the 3GPP standard for 5G control channel. The goal of the thesis is to develop and implement Polar Codes and rate matching according to the 3GPP standard 38.212. Polar Codes are then to be evaluated with different block sizes and rate matching settings. Finally Polar Code is compared with Convolutional code in a LTE-simulation environment. The performance evaluations are presented using BLER/(Eb=N0)-graphs. In this thesis a Polar encoder, rate matching and a Polar decoder (with Successive Can- cellation algorithm) were successfully implemented. The simulation results show that Polar Codes performs better with longer block sizes and also has a better BLER-performance than Convolutional Codes when given the same message lengths. v Contents 1 Introduction 1 1.1 Thesis goal ................................... 2 1.2 Results ...................................... 3 1.2.1 Expected results ............................ 3 1.2.2 Actual results .............................. 3 1.3 Thesis outline .................................. 3 2 Background 4 2.1 Introduction ................................... 4 2.2 Mobile broadband ............................... 5 2.2.1 Long Term Evolution .......................... 5 2.2.2 New Radio ............................... 5 2.3 Noise channels ................................. 6 2.3.1 AWGN ................................. 7 2.4 Phase-shift keying ............................... 8 2.5 Channel capacity ................................ 9 2.6 Interleaving ................................... 9 2.7 Rate matching ................................. 9 2.8 Error correction code .............................. 10 2.8.1 Convolutional Codes .......................... 10 2.8.2 Polar Codes ............................... 11 2.9 Eb=N0 ...................................... 11 2.10 Block error rate ................................. 11 2.11 MATLAB .................................... 12 2.12 Summary .................................... 12 vi 3 Project Design 13 3.1 Introduction ................................... 13 3.2 Convolutional Codes .............................. 14 3.3 Polar encoder .................................. 15 3.3.1 3GPP 38.212 .............................. 15 3.3.2 Encoding and channel polarisation .................. 16 3.4 Rate matching ................................. 19 3.4.1 Sub-block interleaving ......................... 19 3.4.2 Bit selection ............................... 20 3.5 Rate dematching ................................ 21 3.5.1 Bit deselection ............................. 21 3.5.2 Sub-block deinterleaving ........................ 22 3.6 Polar decode .................................. 22 3.6.1 Belief .................................. 23 3.6.2 Frozen bits ............................... 23 3.7 Successive Cancellation ............................. 24 3.7.1 Leaf state ................................ 25 3.7.2 Left state ................................ 26 3.7.3 Right state ............................... 26 3.7.4 Up state ................................. 27 3.8 Simulation .................................... 27 3.8.1 Parameters ............................... 28 3.8.2 Performance comparisons ....................... 29 3.9 Summary .................................... 29 4 Project Implementation 30 4.1 Introduction ................................... 30 4.2 Convolutional Codes .............................. 30 vii 4.3 Polar encoder .................................. 30 4.3.1 encode_polar.m ............................ 31 4.3.2 getReliabilitySeq.m ........................... 33 4.3.3 PolarEncode.m ............................. 33 4.3.4 getGn.m ................................. 34 4.4 Rate matching ................................. 35 4.4.1 rateMatch_polar.m ........................... 35 4.4.2 subBlock_interleaver.m ........................ 36 4.4.3 bit_selection.m ............................. 37 4.4.4 bit_interleaving.m ........................... 37 4.5 Rate dematching ................................ 38 4.5.1 DerateMatch_polar.m ......................... 39 4.5.2 bit_Deinterleaving.m .......................... 40 4.5.3 bit_Deselection.m ........................... 40 4.5.4 subBlock_Deinterleaver.m ....................... 41 4.6 Polar decoder: Successive Cancellation .................... 42 4.6.1 decode_polar.m ............................ 43 4.6.2 SC_Decode.m ............................. 45 4.6.3 SC_Decode_Node.m .......................... 46 4.7 Simulation .................................... 48 4.8 Summary .................................... 50 5 Results 51 5.1 Introduction ................................... 51 5.2 Polar Codes: Successive Cancellation performance .............. 51 5.3 Rate matching with repetition ......................... 52 5.4 Rate matching with puncturing ........................ 54 5.5 Rate matching with shortening ........................ 55 viii 5.6 Polar Codes vs Convolutional Codes ..................... 56 5.7 Summary .................................... 58 6 Conclusion 59 6.1 Introduction ................................... 59 6.2 Thesis evaluation ................................ 59 6.3 Future work ................................... 60 ix List of Figures 2.1 Effect of AWGN on a Signal of5 dB ..................... 7 2.2 Constellation diagram of 8-PSK (left) and BPSK (right) .......... 8 3.1 Simulation chain ................................ 13 3.2 Convolutional Codes design .......................... 14 3.3 Simulation chain, encoding block highlighted ................. 15 3.4 B-DMC channel ................................. 17 3.5 Polarisation of W into N virtual channels, Un: input bit, Gn: see equa- tion 3.5, Xn: bit after encoding, Yn: received bit ............... 17 3.6 Polarisation of W using G2 .......................... 18 3.7 Simulation chain, rate matching highlighted ................. 19 3.8 Bit selection: repetition, puncturing, shortening ............... 20 3.9 Simulation chain, rate dematching highlighted ................ 21 3.10 Simulation chain, decoding block highlighted ................. 22 3.11 Successive Cancellation binary tree, L(n) is beliefs in node where n is number of beliefs. u^i represent a decoded bit and 0:s are frozen bits. ........ 24 3.12 Pre-order depth-first binary tree ........................ 24 3.13 Simulation chain, included blocks highlighted ................ 27 4.1 Simulation chain, encode block highlighted .................. 30 4.2 Polar Encoding file scheme ........................... 31 4.3 MATLAB code for encode_polar CRC calculation .............. 32 4.4 MATLAB code for encode_polar, mapping information bits to reliable vir- tual channels .................................. 32 4.5 MATLAB code for getReliabilitySeq, collect the reliability sequence of size N ........................................ 33 4.6 MATLAB code for PolarEncode, encoding u_bits .............. 34 4.7 MATLAB code for getGn, generating Gi ................... 34 x 4.8 Simulation chain, rate matching block highlighted .............. 35 4.9 Rate matching file scheme ........................... 35 4.10 MATLAB code for subBlock_interleaver ................... 36 4.11 MATLAB code for bit_selection ........................ 37 4.12 MATLAB code for bit_interleaving ...................... 38 4.13 Simulation chain, rate dematching block highlighted ............. 38 4.14 Rate dematching file scheme .......................... 39 4.15 MATLAB code for bit_Deselection ...................... 41 4.16 MATLAB code for subBlock_Deinterleaver .................. 42 4.17 Simulation chain, Polar decoding block highlighted ............. 42 4.18 Decoding file scheme for Successive Cancellation ............... 43 4.19 MATLAB code for decode_polar ....................... 44 4.20 MATLAB code for SC_Decode ........................ 45 4.21 MATLAB code from SC_Decode_Node, leaf operation ........... 47 4.22 MATLAB code from SC_Decode_Node, left/right/up part. Functions SplitLeft and SplitRight are code derived from equation 3.7 and 3.9 ........ 48 4.23 MATLAB code from variable initialisation in testEnvironment ....... 49 4.24 MATLAB code