5G Channel Coding and Rate-Matching: Polar vs. LDPC Codes

“For block lengths of about 500, an IBM 7090 computer requires about 0.1 seconds per iteration to decode a block by probabilistic decoding scheme. Consequently, many hours of computation time are necessary to evaluate even a\(P(e)\)in the order of\({10^{-4}}\).” Robert G. Gallager, 1963 [7]

In this notebook, you will learn about the different coding schemes in 5G NR and how rate-matching works (cf. 3GPP TS 38.212 [3]). The coding schemes are compared under different length/rate settings and for different decoders.

You will learn about the following components:

  • 5G low-density parity-checks (LDPC) codes [7]. These codes support - without further segmentation - up tok=8448 information bits per codeword [3] for a wide range of coderates.

  • Polar codes [1] including CRC concatenation and rate-matching for 5G compliant en-/decoding is implemented for the Polar uplink control channel (UCI) [3]. Besides Polar codes, Reed-Muller (RM) codes and several decoders are available:

    • Successive cancellation (SC) decoding [1]

    • Successive cancellation list (SCL) decoding [2]

    • Hybrid SC / SCL decoding for enhanced throughput

    • Iterative belief propagation (BP) decoding [6]

Further, we will demonstrate the basic functionality of the Sionna forward error correction (FEC) module which also includes support for:

  • Convolutional codes with non-recursive encoding and Viterbi/BCJR decoding

  • Turbo codes and iterative BCJR decoding

  • Ordered statistics decoding (OSD) for any binary, linear code

  • Interleaving and scrambling

For additional technical background we refer the interested reader to [4,5,8].

Please note that block segmentation is not implemented as it only concatenates multiple code blocks without increasing the effective codewords length (from decoder’s perspective).

Some simulations in this notebook require severe simulation time, in particular if parameter sweeps are involved (e.g., different length comparisons). Please keep in mind that each cell in this notebook already contains the pre-computed outputs and no new execution is required to understand the examples.

Table of Contents

GPU Configuration and Imports

[1]:
importosifos.getenv("CUDA_VISIBLE_DEVICES")isNone:gpu_num=0# Use "" to use the CPUos.environ["CUDA_VISIBLE_DEVICES"]=f"{gpu_num}"os.environ['TF_CPP_MIN_LOG_LEVEL']='3'# Import Sionnatry:importsionna.phyexceptImportErrorase:importsysif'google.colab'insys.modules:# Install Sionna in Google Colabprint("Installing Sionna and restarting the runtime. Please run the cell again.")os.system("pip install sionna")os.kill(os.getpid(),5)else:raiseeimporttensorflowastf# Configure the notebook to use only a single GPU and allocate only as much memory as needed# For more details, see https://www.tensorflow.org/guide/gpugpus=tf.config.list_physical_devices('GPU')ifgpus:try:tf.config.experimental.set_memory_growth(gpus[0],True)exceptRuntimeErrorase:print(e)# Avoid warnings from TensorFlowtf.get_logger().setLevel('ERROR')# Set random seed for reproducibilitysionna.phy.config.seed=42# Load the required Sionna componentsfromsionna.phyimportBlockfromsionna.phy.mappingimportConstellation,Mapper,Demapper,BinarySourcefromsionna.phy.fec.polarimportPolarEncoder,Polar5GEncoder,PolarSCLDecoder,Polar5GDecoderfromsionna.phy.fec.ldpcimportLDPC5GEncoder,LDPC5GDecoderfromsionna.phy.fec.polar.utilsimportgenerate_5g_ranking,generate_rm_codefromsionna.phy.fec.convimportConvEncoder,ViterbiDecoderfromsionna.phy.fec.turboimportTurboEncoder,TurboDecoderfromsionna.phy.fec.linearimportOSDecoderfromsionna.phy.utilsimportcount_block_errors,ebnodb2no,PlotBERfromsionna.phy.channelimportAWGN
[2]:
%matplotlib inlineimportmatplotlib.pyplotaspltimportnumpyasnpimporttime# for throughput measurements

BER Performance of 5G Coding Schemes

Let us first focus on short length coding, e.g., for internet of things (IoT) and ultra-reliable low-latency communications (URLLC). We aim to reproduce similar results as in [9] for the coding schemes supported by Sionna.

For a detailed explanation of thePlotBER class, we refer to the example notebook onBit-Interleaved Coded Modulation.

The Sionna API allows to pass an encoder object/layer to the decoder initialization for the 5G decoders. This means that the decoder is directlyassociated to a specific encoder andknows all relevant code parameters. Please note that - of course - no data or information bits are exchanged between these two associated components. It just simplifies handling of the code parameters, in particular, if rate-matching is used.

Let us define the system model first. We use encoder and decoder as input parameter such that the model remains flexible w.r.t. the coding scheme.

[3]:
classSystem_Model(Block):"""System model for channel coding BER simulations.    This model allows to simulate BERs over an AWGN channel with    QAM modulation. Arbitrary FEC encoder/decoder layers can be used to    initialize the model.    Parameters    ----------        k: int            number of information bits per codeword.        n: int            codeword length.        num_bits_per_symbol: int            number of bits per QAM symbol.        encoder: Sionna Block            A Sionna Block that encodes information bit tensors.        decoder: Sionna Block            A Sionna Block layer that decodes llr tensors.        demapping_method: str            A string denoting the demapping method. Can be either "app" or "maxlog".        sim_esno: bool            A boolean defaults to False. If true, no rate-adjustment is done for the SNR calculation.         cw_estiamtes: bool            A boolean defaults to False. If true, codewords instead of information estimates are returned.    Input    -----        batch_size: int or tf.int            The batch_size used for the simulation.        ebno_db: float or tf.float            A float defining the simulation SNR.    Output    ------        (u, u_hat):            Tuple:        u: tf.float32            A tensor of shape `[batch_size, k] of 0s and 1s containing the transmitted information bits.        u_hat: tf.float32            A tensor of shape `[batch_size, k] of 0s and 1s containing the estimated information bits.    """def__init__(self,k,n,num_bits_per_symbol,encoder,decoder,demapping_method="app",sim_esno=False,cw_estimates=False):super().__init__()# store values internallyself.k=kself.n=nself.sim_esno=sim_esno# disable rate-adjustment for SNR calcself.cw_estimates=cw_estimates# if true codewords instead of info bits are returned# number of bit per QAM symbolself.num_bits_per_symbol=num_bits_per_symbol# init componentsself.source=BinarySource()# initialize mapper and demapper for constellation objectself.constellation=Constellation("qam",num_bits_per_symbol=self.num_bits_per_symbol)self.mapper=Mapper(constellation=self.constellation)self.demapper=Demapper(demapping_method,constellation=self.constellation)# the channel can be replaced by more sophisticated modelsself.channel=AWGN()# FEC encoder / decoderself.encoder=encoderself.decoder=decoder@tf.function()# enable graph mode for increased throughputsdefcall(self,batch_size,ebno_db):# calculate noise varianceifself.sim_esno:no=ebnodb2no(ebno_db,num_bits_per_symbol=1,coderate=1)else:no=ebnodb2no(ebno_db,num_bits_per_symbol=self.num_bits_per_symbol,coderate=self.k/self.n)u=self.source([batch_size,self.k])# generate random datac=self.encoder(u)# explicitly encodex=self.mapper(c)# map c to symbols xy=self.channel(x,no)# transmit over AWGN channelllr_ch=self.demapper(y,no)# demap y to LLRsu_hat=self.decoder(llr_ch)# run FEC decoder (incl. rate-recovery)ifself.cw_estimates:returnc,u_hatreturnu,u_hat

And let us define the codes to be simulated.

[4]:
# code parametersk=64# number of information bits per codewordn=128# desired codeword length# Create list of encoder/decoder pairs to be analyzed.# This allows automated evaluation of the whole list later.codes_under_test=[]# 5G LDPC codes with 20 BP iterationsenc=LDPC5GEncoder(k=k,n=n)dec=LDPC5GDecoder(enc,num_iter=20)name="5G LDPC BP-20"codes_under_test.append([enc,dec,name])# Polar Codes (SC decoding)enc=Polar5GEncoder(k=k,n=n)dec=Polar5GDecoder(enc,dec_type="SC")name="5G Polar+CRC SC"codes_under_test.append([enc,dec,name])# Polar Codes (SCL decoding) with list size 8.# The CRC is automatically added by the layer.enc=Polar5GEncoder(k=k,n=n)dec=Polar5GDecoder(enc,dec_type="SCL",list_size=8)name="5G Polar+CRC SCL-8"codes_under_test.append([enc,dec,name])### non-5G coding schemes# RM codes with SCL decodingf,_,_,_,_=generate_rm_code(3,7)# equals k=64 and n=128 codeenc=PolarEncoder(f,n)dec=PolarSCLDecoder(f,n,list_size=8)name="Reed Muller (RM) SCL-8"codes_under_test.append([enc,dec,name])# Conv. code with Viterbi decodingenc=ConvEncoder(rate=1/2,constraint_length=8)dec=ViterbiDecoder(gen_poly=enc.gen_poly,method="soft_llr")name="Conv. Code Viterbi (constraint length 8)"codes_under_test.append([enc,dec,name])# Turbo. codesenc=TurboEncoder(rate=1/2,constraint_length=4,terminate=False)# no termination used due to the rate lossdec=TurboDecoder(enc,num_iter=8)name="Turbo Code (constraint length 4)"codes_under_test.append([enc,dec,name])
Warning: 5G Polar codes use an integrated CRC that cannot be materialized with SC decoding and, thus, causes a degraded performance. Please consider SCL decoding instead.

Remark: some of the coding schemes are not 5G relevant, but are included in this comparison for the sake of completeness.

Generate a new BER plot figure to save and plot simulation results efficiently.

[5]:
ber_plot128=PlotBER(f"Performance of Short Length Codes (k={k}, n={n})")

And run the BER simulation for each code.

[6]:
num_bits_per_symbol=2# QPSKebno_db=np.arange(0,5,0.5)# sim SNR range# run ber simulations for each code we have added to the listforcodeincodes_under_test:print("\nRunning: "+code[2])# generate a new model with the given encoder/decodermodel=System_Model(k=k,n=n,num_bits_per_symbol=num_bits_per_symbol,encoder=code[0],decoder=code[1])# the first argument must be a callable (function) that yields u and u_hat for batch_size and ebnober_plot128.simulate(model,# the function have defined previouslyebno_dbs=ebno_db,# SNR to simulatelegend=code[2],# legend string for plottingmax_mc_iter=100,# run 100 Monte Carlo runs per SNR pointnum_target_block_errors=1000,# continue with next SNR point after 1000 bit errorsbatch_size=10000,# batch-size per Monte Carlo runsoft_estimates=False,# the model returns hard-estimatesearly_stop=True,# stop simulation if no error has been detected at current SNR pointshow_fig=False,# we show the figure after all results are simulatedadd_bler=True,# in case BLER is also interestingforward_keyboard_interrupt=True);# should be True in a loop# and show the figureber_plot128(ylim=(1e-5,1),show_bler=False)# we set the ylim to 1e-5 as otherwise more extensive simulations would be required for accurate curves.
Running: 5G LDPC BP-20EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.6585e-01 | 8.6430e-01 |      106147 |      640000 |         8643 |       10000 |         4.8 |reached target block errors      0.5 | 1.2742e-01 | 7.1230e-01 |       81551 |      640000 |         7123 |       10000 |         0.1 |reached target block errors      1.0 | 8.6669e-02 | 5.0330e-01 |       55468 |      640000 |         5033 |       10000 |         0.1 |reached target block errors      1.5 | 5.0348e-02 | 3.0320e-01 |       32223 |      640000 |         3032 |       10000 |         0.1 |reached target block errors      2.0 | 2.5697e-02 | 1.5470e-01 |       16446 |      640000 |         1547 |       10000 |         0.1 |reached target block errors      2.5 | 1.1046e-02 | 6.8650e-02 |       14139 |     1280000 |         1373 |       20000 |         0.2 |reached target block errors      3.0 | 3.6747e-03 | 2.2540e-02 |       11759 |     3200000 |         1127 |       50000 |         0.5 |reached target block errors      3.5 | 9.1285e-04 | 5.8389e-03 |       10516 |    11520000 |         1051 |      180000 |         1.8 |reached target block errors      4.0 | 2.0294e-04 | 1.3289e-03 |        9871 |    48640000 |         1010 |      760000 |         7.6 |reached target block errors      4.5 | 3.1813e-05 | 2.1100e-04 |        2036 |    64000000 |          211 |     1000000 |        10.0 |reached max iterationsRunning: 5G Polar+CRC SCEbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 4.0892e-01 | 9.5500e-01 |      261712 |      640000 |         9550 |       10000 |         6.1 |reached target block errors      0.5 | 3.7065e-01 | 8.9720e-01 |      237217 |      640000 |         8972 |       10000 |         0.1 |reached target block errors      1.0 | 3.1120e-01 | 7.9330e-01 |      199165 |      640000 |         7933 |       10000 |         0.1 |reached target block errors      1.5 | 2.4647e-01 | 6.5550e-01 |      157743 |      640000 |         6555 |       10000 |         0.1 |reached target block errors      2.0 | 1.7313e-01 | 4.8340e-01 |      110801 |      640000 |         4834 |       10000 |         0.1 |reached target block errors      2.5 | 1.0472e-01 | 3.0430e-01 |       67019 |      640000 |         3043 |       10000 |         0.1 |reached target block errors      3.0 | 6.0366e-02 | 1.7520e-01 |       38634 |      640000 |         1752 |       10000 |         0.1 |reached target block errors      3.5 | 2.5751e-02 | 7.7900e-02 |       32961 |     1280000 |         1558 |       20000 |         0.1 |reached target block errors      4.0 | 9.5281e-03 | 2.9200e-02 |       24392 |     2560000 |         1168 |       40000 |         0.3 |reached target block errors      4.5 | 3.0899e-03 | 9.3636e-03 |       21753 |     7040000 |         1030 |      110000 |         0.8 |reached target block errorsRunning: 5G Polar+CRC SCL-8EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 3.4186e-01 | 7.9810e-01 |      218790 |      640000 |         7981 |       10000 |        19.8 |reached target block errors      0.5 | 2.6526e-01 | 6.4420e-01 |      169766 |      640000 |         6442 |       10000 |         2.8 |reached target block errors      1.0 | 1.7327e-01 | 4.3300e-01 |      110895 |      640000 |         4330 |       10000 |         2.8 |reached target block errors      1.5 | 8.8950e-02 | 2.3300e-01 |       56928 |      640000 |         2330 |       10000 |         2.8 |reached target block errors      2.0 | 3.8095e-02 | 1.0260e-01 |       24381 |      640000 |         1026 |       10000 |         2.8 |reached target block errors      2.5 | 1.3091e-02 | 3.6067e-02 |       25134 |     1920000 |         1082 |       30000 |         8.3 |reached target block errors      3.0 | 2.7299e-03 | 7.8077e-03 |       22713 |     8320000 |         1015 |      130000 |        36.1 |reached target block errors      3.5 | 4.5666e-04 | 1.3184e-03 |       22212 |    48640000 |         1002 |      760000 |       211.3 |reached target block errors      4.0 | 4.4938e-05 | 1.4300e-04 |        2876 |    64000000 |          143 |     1000000 |       278.1 |reached max iterations      4.5 | 1.7031e-06 | 5.0000e-06 |         109 |    64000000 |            5 |     1000000 |       278.1 |reached max iterationsRunning: Reed Muller (RM) SCL-8EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 2.7355e-01 | 6.5610e-01 |      175071 |      640000 |         6561 |       10000 |        15.0 |reached target block errors      0.5 | 1.8974e-01 | 4.7000e-01 |      121436 |      640000 |         4700 |       10000 |         2.4 |reached target block errors      1.0 | 1.1422e-01 | 2.8730e-01 |       73098 |      640000 |         2873 |       10000 |         2.4 |reached target block errors      1.5 | 5.7861e-02 | 1.5170e-01 |       37031 |      640000 |         1517 |       10000 |         2.4 |reached target block errors      2.0 | 2.4055e-02 | 6.4750e-02 |       30791 |     1280000 |         1295 |       20000 |         4.9 |reached target block errors      2.5 | 7.6841e-03 | 2.0500e-02 |       24589 |     3200000 |         1025 |       50000 |        12.1 |reached target block errors      3.0 | 1.7790e-03 | 4.8000e-03 |       25048 |    14080000 |         1056 |      220000 |        53.3 |reached target block errors      3.5 | 3.0295e-04 | 8.6000e-04 |       19389 |    64000000 |          860 |     1000000 |       242.7 |reached max iterations      4.0 | 3.3656e-05 | 9.9000e-05 |        2154 |    64000000 |           99 |     1000000 |       242.7 |reached max iterations      4.5 | 2.2344e-06 | 6.0000e-06 |         143 |    64000000 |            6 |     1000000 |       242.7 |reached max iterationsRunning: Conv. Code Viterbi (constraint length 8)EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.6396e-01 | 6.9370e-01 |      104933 |      640000 |         6937 |       10000 |         4.8 |reached target block errors      0.5 | 1.0907e-01 | 5.5610e-01 |       69802 |      640000 |         5561 |       10000 |         1.1 |reached target block errors      1.0 | 6.3377e-02 | 4.0890e-01 |       40561 |      640000 |         4089 |       10000 |         1.1 |reached target block errors      1.5 | 3.2970e-02 | 2.8690e-01 |       21101 |      640000 |         2869 |       10000 |         1.1 |reached target block errors      2.0 | 1.6136e-02 | 1.8500e-01 |       10327 |      640000 |         1850 |       10000 |         1.1 |reached target block errors      2.5 | 8.5188e-03 | 1.2510e-01 |        5452 |      640000 |         1251 |       10000 |         1.1 |reached target block errors      3.0 | 3.8203e-03 | 7.3350e-02 |        4890 |     1280000 |         1467 |       20000 |         2.1 |reached target block errors      3.5 | 1.9307e-03 | 4.8500e-02 |        3707 |     1920000 |         1455 |       30000 |         3.2 |reached target block errors      4.0 | 1.0078e-03 | 3.0575e-02 |        2580 |     2560000 |         1223 |       40000 |         4.3 |reached target block errors      4.5 | 5.8750e-04 | 1.9300e-02 |        2256 |     3840000 |         1158 |       60000 |         6.4 |reached target block errorsRunning: Turbo Code (constraint length 4)<dtype: 'float32'>EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.0958e-01 | 7.9180e-01 |       70131 |      640000 |         7918 |       10000 |         5.5 |reached target block errors      0.5 | 7.6770e-02 | 6.0510e-01 |       49133 |      640000 |         6051 |       10000 |         2.3 |reached target block errors      1.0 | 4.5833e-02 | 3.9700e-01 |       29333 |      640000 |         3970 |       10000 |         2.3 |reached target block errors      1.5 | 2.3855e-02 | 2.1570e-01 |       15267 |      640000 |         2157 |       10000 |         2.3 |reached target block errors      2.0 | 9.4867e-03 | 9.2250e-02 |       12143 |     1280000 |         1845 |       20000 |         4.6 |reached target block errors      2.5 | 3.1203e-03 | 3.2400e-02 |        7988 |     2560000 |         1296 |       40000 |         9.2 |reached target block errors      3.0 | 8.1378e-04 | 9.5091e-03 |        5729 |     7040000 |         1046 |      110000 |        25.2 |reached target block errors      3.5 | 1.6844e-04 | 2.5025e-03 |        4312 |    25600000 |         1001 |      400000 |        91.7 |reached target block errors      4.0 | 3.4609e-05 | 6.7600e-04 |        2215 |    64000000 |          676 |     1000000 |       229.3 |reached max iterations      4.5 | 8.3281e-06 | 2.1500e-04 |         533 |    64000000 |          215 |     1000000 |       229.5 |reached max iterations
../../_images/phy_tutorials_5G_Channel_Coding_Polar_vs_LDPC_Codes_12_1.png

And let’s also look at the block-error-rate.

[7]:
ber_plot128(ylim=(1e-5,1),show_ber=False)
../../_images/phy_tutorials_5G_Channel_Coding_Polar_vs_LDPC_Codes_14_0.png

Please keep in mind that the decoding complexity differs significantly and should be also included in a fair comparison as shown in SectionThroughput and Decoding Complexity.

Performance under Optimal Decoding

The achievable error-rate performance of a coding scheme depends on the strength of the code construction and the performance of the actual decoding algorithm. We now approximate the maximum-likelihood performance of all previous coding schemes by using the ordered statistics decoder (OSD) [12].

[8]:
# overwrite existing legend entries for OSD simulationslegends=["5G LDPC","5G Polar+CRC","5G Polar+CRC","RM","Conv. Code","Turbo Code"]# run ber simulations for each code we have added to the listforidx,codeinenumerate(codes_under_test):ifidx==2:# skip second polar code (same code only different decoder)continueprint("\nRunning: "+code[2])# initialize encoderencoder=code[0]# encode dummy bits to init conv encoders (otherwise k is not defined)encoder(tf.zeros((1,k)))# OSD can be directly associated to an encoderdecoder=OSDecoder(encoder=encoder,t=4)# generate a new model with the given encoder/decodermodel=System_Model(k=k,n=n,num_bits_per_symbol=num_bits_per_symbol,encoder=encoder,decoder=decoder,cw_estimates=True)# OSD returns codeword estimates and not info bit estimates# the first argument must be a callable (function) that yields u and u_hat for batch_size and ebnober_plot128.simulate(tf.function(model,jit_compile=True),ebno_dbs=ebno_db,# SNR to simulatelegend=legends[idx]+f" OSD-{decoder.t} ",# legend string for plottingmax_mc_iter=1000,# run 100 Monte Carlo runs per SNR pointnum_target_block_errors=1000,# continue with next SNR point after 1000 bit errorsbatch_size=32,# batch-size per Monte Carlo runsoft_estimates=False,# the model returns hard-estimatesearly_stop=True,# stop simulation if no error has been detected at current SNR pointshow_fig=False,# we show the figure after all results are simulatedadd_bler=True,# in case BLER is also interestingforward_keyboard_interrupt=True);# should be True in a loop
Running: 5G LDPC BP-20Note: Required memory complexity is large for the given code parameters and t=4. Please consider small batch-sizes to keep the inference complexity small and activate XLA mode if possible.EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.0476e-01 | 4.5380e-01 |       29607 |      282624 |         1002 |        2208 |         9.7 |reached target block errors      0.5 | 5.5871e-02 | 2.5125e-01 |       28606 |      512000 |         1005 |        4000 |        11.5 |reached target block errors      1.0 | 2.6564e-02 | 1.2488e-01 |       27310 |     1028096 |         1003 |        8032 |        23.2 |reached target block errors      1.5 | 8.6319e-03 | 4.2633e-02 |       25916 |     3002368 |         1000 |       23456 |        67.8 |reached target block errors      2.0 | 2.1377e-03 | 1.1031e-02 |        8756 |     4096000 |          353 |       32000 |        92.5 |reached max iterations      2.5 | 3.4326e-04 | 2.0313e-03 |        1406 |     4096000 |           65 |       32000 |        92.4 |reached max iterations      3.0 | 4.1748e-05 | 2.8125e-04 |         171 |     4096000 |            9 |       32000 |        92.6 |reached max iterations      3.5 | 2.6855e-06 | 3.1250e-05 |          11 |     4096000 |            1 |       32000 |        92.6 |reached max iterations      4.0 | 0.0000e+00 | 0.0000e+00 |           0 |     4096000 |            0 |       32000 |        92.5 |reached max iterationsSimulation stopped as no error occurred @ EbNo = 4.0 dB.Running: 5G Polar+CRC SCNote: Required memory complexity is large for the given code parameters and t=4. Please consider small batch-sizes to keep the inference complexity small and activate XLA mode if possible.EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.0608e-01 | 4.4498e-01 |       30850 |      290816 |         1011 |        2272 |         9.8 |reached target block errors      0.5 | 5.9125e-02 | 2.5175e-01 |       30272 |      512000 |         1007 |        4000 |        11.5 |reached target block errors      1.0 | 2.5417e-02 | 1.1064e-01 |       29462 |     1159168 |         1002 |        9056 |        26.2 |reached target block errors      1.5 | 8.5110e-03 | 3.7787e-02 |       28830 |     3387392 |         1000 |       26464 |        76.4 |reached target block errors      2.0 | 1.8491e-03 | 8.5000e-03 |        7574 |     4096000 |          272 |       32000 |        92.6 |reached max iterations      2.5 | 2.6416e-04 | 1.1875e-03 |        1082 |     4096000 |           38 |       32000 |        92.5 |reached max iterations      3.0 | 3.2227e-05 | 1.5625e-04 |         132 |     4096000 |            5 |       32000 |        92.5 |reached max iterations      3.5 | 0.0000e+00 | 0.0000e+00 |           0 |     4096000 |            0 |       32000 |        92.7 |reached max iterationsSimulation stopped as no error occurred @ EbNo = 3.5 dB.Running: Reed Muller (RM) SCL-8Note: Required memory complexity is large for the given code parameters and t=4. Please consider small batch-sizes to keep the inference complexity small and activate XLA mode if possible.EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.0578e-01 | 5.0907e-01 |       26864 |      253952 |         1010 |        1984 |         8.8 |reached target block errors      0.5 | 6.0576e-02 | 3.1126e-01 |       25060 |      413696 |         1006 |        3232 |         9.3 |reached target block errors      1.0 | 2.7719e-02 | 1.5425e-01 |       23048 |      831488 |         1002 |        6496 |        18.8 |reached target block errors      1.5 | 9.8167e-03 | 5.8411e-02 |       21512 |     2191360 |         1000 |       17120 |        49.5 |reached target block errors      2.0 | 2.8555e-03 | 1.8344e-02 |       11696 |     4096000 |          587 |       32000 |        92.4 |reached max iterations      2.5 | 5.8301e-04 | 3.9062e-03 |        2388 |     4096000 |          125 |       32000 |        92.6 |reached max iterations      3.0 | 7.4219e-05 | 5.6250e-04 |         304 |     4096000 |           18 |       32000 |        92.6 |reached max iterations      3.5 | 7.8125e-06 | 6.2500e-05 |          32 |     4096000 |            2 |       32000 |        92.4 |reached max iterations      4.0 | 7.8125e-06 | 6.2500e-05 |          32 |     4096000 |            2 |       32000 |        92.5 |reached max iterations      4.5 | 0.0000e+00 | 0.0000e+00 |           0 |     4096000 |            0 |       32000 |        92.4 |reached max iterationsSimulation stopped as no error occurred @ EbNo = 4.5 dB.Running: Conv. Code Viterbi (constraint length 8)Note: Required memory complexity is large for the given code parameters and t=4. Please consider small batch-sizes to keep the inference complexity small and activate XLA mode if possible.EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 9.5746e-02 | 6.8614e-01 |       18040 |      188416 |         1010 |        1472 |         7.2 |reached target block errors      0.5 | 6.3395e-02 | 5.5263e-01 |       14801 |      233472 |         1008 |        1824 |         5.3 |reached target block errors      1.0 | 3.5827e-02 | 3.9794e-01 |       11593 |      323584 |         1006 |        2528 |         7.3 |reached target block errors      1.5 | 1.9942e-02 | 2.6843e-01 |        9557 |      479232 |         1005 |        3744 |        10.9 |reached target block errors      2.0 | 1.0320e-02 | 1.8731e-01 |        7059 |      684032 |         1001 |        5344 |        15.5 |reached target block errors      2.5 | 5.4446e-03 | 1.2575e-01 |        5553 |     1019904 |         1002 |        7968 |        23.1 |reached target block errors      3.0 | 2.7698e-03 | 7.8794e-02 |        4504 |     1626112 |         1001 |       12704 |        37.1 |reached target block errors      3.5 | 1.4696e-03 | 5.0617e-02 |        3720 |     2531328 |         1001 |       19776 |        57.5 |reached target block errors      4.0 | 8.0116e-04 | 3.1344e-02 |        3275 |     4087808 |         1001 |       31936 |        93.0 |reached target block errors      4.5 | 4.4287e-04 | 1.9094e-02 |        1814 |     4096000 |          611 |       32000 |        93.1 |reached max iterationsRunning: Turbo Code (constraint length 4)Note: Required memory complexity is large for the given code parameters and t=4. Please consider small batch-sizes to keep the inference complexity small and activate XLA mode if possible.EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.0139e-01 | 5.1691e-01 |       25333 |      249856 |         1009 |        1952 |         9.6 |reached target block errors      0.5 | 6.8530e-02 | 3.6628e-01 |       24140 |      352256 |         1008 |        2752 |         8.1 |reached target block errors      1.0 | 3.2117e-02 | 1.8787e-01 |       21969 |      684032 |         1004 |        5344 |        15.6 |reached target block errors      1.5 | 1.2682e-02 | 8.3195e-02 |       19531 |     1540096 |         1001 |       12032 |        35.3 |reached target block errors      2.0 | 4.0562e-03 | 3.0469e-02 |       16614 |     4096000 |          975 |       32000 |        93.6 |reached max iterations      2.5 | 9.3726e-04 | 9.6875e-03 |        3839 |     4096000 |          310 |       32000 |        94.0 |reached max iterations      3.0 | 2.8174e-04 | 3.5625e-03 |        1154 |     4096000 |          114 |       32000 |        93.9 |reached max iterations      3.5 | 8.0322e-05 | 1.4375e-03 |         329 |     4096000 |           46 |       32000 |        94.1 |reached max iterations      4.0 | 2.8809e-05 | 5.9375e-04 |         118 |     4096000 |           19 |       32000 |        93.8 |reached max iterations      4.5 | 4.3945e-06 | 9.3750e-05 |          18 |     4096000 |            3 |       32000 |        93.8 |reached max iterations

And let’s plot the results.

Remark: we define a custom plotting function to enable a nicer visualization of OSD vs. non-OSD results.

[9]:
# for simplicity, we only plot a subset of the simulated curves# focus on BLERplots_to_show=['5G LDPC BP-20 (BLER)','5G LDPC OSD-4  (BLER)','5G Polar+CRC SCL-8 (BLER)','5G Polar+CRC OSD-4  (BLER)','Reed Muller (RM) SCL-8 (BLER)','RM OSD-4  (BLER)','Conv. Code Viterbi (constraint length 8) (BLER)','Conv. Code OSD-4  (BLER)','Turbo Code (constraint length 4) (BLER)','Turbo Code OSD-4  (BLER)']# find indices of relevant curvesidx=[]forpinplots_to_show:fori,linenumerate(ber_plot128._legends):ifp==l:idx.append(i)# generate new figurefig,ax=plt.subplots(figsize=(16,12))plt.xticks(fontsize=18)plt.yticks(fontsize=18)plt.title(f"Performance under Ordered Statistic Decoding (k={k},n={n})",fontsize=25)plt.grid(which="both")plt.xlabel(r"$E_b/N_0$ (dB)",fontsize=25)plt.ylabel(r"BLER",fontsize=25)# plot pairs of BLER curves (non-osd vs. osd)foriinrange(int(len(idx)/2)):# non-OSDplt.semilogy(ebno_db,ber_plot128._bers[idx[2*i]],c='C%d'%(i),label=ber_plot128._legends[idx[2*i]].replace(" (BLER)",""),#remove "(BLER)" from labellinewidth=2)# OSDplt.semilogy(ebno_db,ber_plot128._bers[idx[2*i+1]],c='C%d'%(i),label=ber_plot128._legends[idx[2*i+1]].replace(" (BLER)",""),#remove "(BLER)" from labellinestyle="--",linewidth=2)plt.legend(fontsize=20)plt.xlim([0,4.5])plt.ylim([1e-4,1]);
../../_images/phy_tutorials_5G_Channel_Coding_Polar_vs_LDPC_Codes_19_0.png

As can be seen, the performance of Polar and Convolutional codes is in practice close to their ML performance. For other codes such as LDPC codes, there is a practical performance gap under BP decoding which tends to be smaller for longer codes.

Performance of Longer LDPC Codes

Now, let us have a look at the performance gains due to longer codewords. For this, we scale the length of the LDPC code and compare the results (same rate, same decoder, same channel).

[10]:
# init new figureber_plot_ldpc=PlotBER(f"BER/BLER Performance of LDPC Codes @ Fixed Rate=0.5")
[11]:
# code parameters to simulatens=[128,256,512,1000,2000,4000,8000,16000]# number of codeword bits per codewordrate=0.5# fixed coderate# create list of encoder/decoder pairs to be analyzedcodes_under_test=[]# 5G LDPC codesforninns:k=int(rate*n)# calculate k for given n and rateenc=LDPC5GEncoder(k=k,n=n)dec=LDPC5GDecoder(enc,num_iter=20)name=f"5G LDPC BP-20 (n={n})"codes_under_test.append([enc,dec,name,k,n])
[12]:
# and simulate the resultsnum_bits_per_symbol=2# QPSKebno_db=np.arange(0,5,0.25)# sim SNR range# note that the waterfall for long codes can be steep and requires a fine# SNR quantization# run ber simulations for each caseforcodeincodes_under_test:print("Running: "+code[2])model=System_Model(k=code[3],n=code[4],num_bits_per_symbol=num_bits_per_symbol,encoder=code[0],decoder=code[1])# the first argument must be a callable (function) that yields u and u_hat# for given batch_size and ebno# we fix the target number of BLOCK errors instead of the BER to# ensure that same accurate results for each block lengths is simulatedber_plot_ldpc.simulate(model,# the function have defined previouslyebno_dbs=ebno_db,legend=code[2],max_mc_iter=100,num_target_block_errors=500,# we fix the target block errorsbatch_size=1000,soft_estimates=False,early_stop=True,show_fig=False,forward_keyboard_interrupt=True);# should be True in a loop# and show figureber_plot_ldpc(ylim=(1e-5,1))
Running: 5G LDPC BP-20 (n=128)EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.6423e-01 | 8.6200e-01 |       10511 |       64000 |          862 |        1000 |         0.6 |reached target block errors     0.25 | 1.4313e-01 | 7.8100e-01 |        9160 |       64000 |          781 |        1000 |         0.0 |reached target block errors      0.5 | 1.3097e-01 | 7.2300e-01 |        8382 |       64000 |          723 |        1000 |         0.0 |reached target block errors     0.75 | 1.1205e-01 | 6.2600e-01 |        7171 |       64000 |          626 |        1000 |         0.0 |reached target block errors      1.0 | 8.3094e-02 | 4.9200e-01 |       10636 |      128000 |          984 |        2000 |         0.1 |reached target block errors     1.25 | 6.4156e-02 | 3.8500e-01 |        8212 |      128000 |          770 |        2000 |         0.1 |reached target block errors      1.5 | 5.2805e-02 | 3.1300e-01 |        6759 |      128000 |          626 |        2000 |         0.1 |reached target block errors     1.75 | 3.6354e-02 | 2.1700e-01 |        6980 |      192000 |          651 |        3000 |         0.1 |reached target block errors      2.0 | 2.4867e-02 | 1.4725e-01 |        6366 |      256000 |          589 |        4000 |         0.1 |reached target block errors     2.25 | 1.6969e-02 | 1.0060e-01 |        5430 |      320000 |          503 |        5000 |         0.2 |reached target block errors      2.5 | 1.0266e-02 | 6.4625e-02 |        5256 |      512000 |          517 |        8000 |         0.3 |reached target block errors     2.75 | 6.0703e-03 | 3.8000e-02 |        5439 |      896000 |          532 |       14000 |         0.6 |reached target block errors      3.0 | 3.4844e-03 | 2.1783e-02 |        5129 |     1472000 |          501 |       23000 |         0.9 |reached target block errors     3.25 | 1.7802e-03 | 1.1651e-02 |        4899 |     2752000 |          501 |       43000 |         1.7 |reached target block errors      3.5 | 8.5363e-04 | 5.7471e-03 |        4753 |     5568000 |          500 |       87000 |         3.5 |reached target block errors     3.75 | 4.6078e-04 | 3.0500e-03 |        2949 |     6400000 |          305 |      100000 |         4.0 |reached max iterations      4.0 | 1.7688e-04 | 1.2000e-03 |        1132 |     6400000 |          120 |      100000 |         4.0 |reached max iterations     4.25 | 6.7031e-05 | 4.3000e-04 |         429 |     6400000 |           43 |      100000 |         4.0 |reached max iterations      4.5 | 4.0469e-05 | 2.7000e-04 |         259 |     6400000 |           27 |      100000 |         4.0 |reached max iterations     4.75 | 1.6562e-05 | 9.0000e-05 |         106 |     6400000 |            9 |      100000 |         3.9 |reached max iterationsRunning: 5G LDPC BP-20 (n=256)EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.6431e-01 | 9.2700e-01 |       21032 |      128000 |          927 |        1000 |         0.6 |reached target block errors     0.25 | 1.4125e-01 | 8.5600e-01 |       18080 |      128000 |          856 |        1000 |         0.0 |reached target block errors      0.5 | 1.1600e-01 | 7.4900e-01 |       14848 |      128000 |          749 |        1000 |         0.0 |reached target block errors     0.75 | 9.6609e-02 | 6.6200e-01 |       12366 |      128000 |          662 |        1000 |         0.0 |reached target block errors      1.0 | 6.5867e-02 | 4.8850e-01 |       16862 |      256000 |          977 |        2000 |         0.1 |reached target block errors     1.25 | 4.7125e-02 | 3.6350e-01 |       12064 |      256000 |          727 |        2000 |         0.1 |reached target block errors      1.5 | 3.1721e-02 | 2.3433e-01 |       12181 |      384000 |          703 |        3000 |         0.1 |reached target block errors     1.75 | 1.7176e-02 | 1.3675e-01 |        8794 |      512000 |          547 |        4000 |         0.1 |reached target block errors      2.0 | 1.0333e-02 | 8.5833e-02 |        7936 |      768000 |          515 |        6000 |         0.2 |reached target block errors     2.25 | 4.7644e-03 | 4.1462e-02 |        7928 |     1664000 |          539 |       13000 |         0.5 |reached target block errors      2.5 | 2.0603e-03 | 1.8107e-02 |        7384 |     3584000 |          507 |       28000 |         1.1 |reached target block errors     2.75 | 7.8589e-04 | 7.3478e-03 |        6941 |     8832000 |          507 |       69000 |         2.8 |reached target block errors      3.0 | 2.9141e-04 | 3.0000e-03 |        3730 |    12800000 |          300 |      100000 |         4.0 |reached max iterations     3.25 | 1.0312e-04 | 9.5000e-04 |        1320 |    12800000 |           95 |      100000 |         3.9 |reached max iterations      3.5 | 3.0078e-05 | 3.5000e-04 |         385 |    12800000 |           35 |      100000 |         4.0 |reached max iterations     3.75 | 6.6406e-06 | 7.0000e-05 |          85 |    12800000 |            7 |      100000 |         4.0 |reached max iterations      4.0 | 1.5625e-07 | 1.0000e-05 |           2 |    12800000 |            1 |      100000 |         4.0 |reached max iterations     4.25 | 1.3281e-06 | 1.0000e-05 |          17 |    12800000 |            1 |      100000 |         4.0 |reached max iterations      4.5 | 2.7344e-06 | 2.0000e-05 |          35 |    12800000 |            2 |      100000 |         4.0 |reached max iterations     4.75 | 0.0000e+00 | 0.0000e+00 |           0 |    12800000 |            0 |      100000 |         4.0 |reached max iterationsSimulation stopped as no error occurred @ EbNo = 4.8 dB.Running: 5G LDPC BP-20 (n=512)EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.6237e-01 | 9.7800e-01 |       41568 |      256000 |          978 |        1000 |         0.6 |reached target block errors     0.25 | 1.3724e-01 | 9.3500e-01 |       35133 |      256000 |          935 |        1000 |         0.0 |reached target block errors      0.5 | 1.1005e-01 | 8.2000e-01 |       28172 |      256000 |          820 |        1000 |         0.1 |reached target block errors     0.75 | 7.7156e-02 | 6.4500e-01 |       19752 |      256000 |          645 |        1000 |         0.0 |reached target block errors      1.0 | 4.7484e-02 | 4.4350e-01 |       24312 |      512000 |          887 |        2000 |         0.1 |reached target block errors     1.25 | 2.9787e-02 | 2.8600e-01 |       15251 |      512000 |          572 |        2000 |         0.1 |reached target block errors      1.5 | 1.4099e-02 | 1.4875e-01 |       14437 |     1024000 |          595 |        4000 |         0.2 |reached target block errors     1.75 | 5.2300e-03 | 6.0222e-02 |       12050 |     2304000 |          542 |        9000 |         0.5 |reached target block errors      2.0 | 1.9348e-03 | 2.3364e-02 |       10897 |     5632000 |          514 |       22000 |         1.1 |reached target block errors     2.25 | 6.0620e-04 | 7.2754e-03 |       10708 |    17664000 |          502 |       69000 |         3.5 |reached target block errors      2.5 | 1.4883e-04 | 2.1500e-03 |        3810 |    25600000 |          215 |      100000 |         5.1 |reached max iterations     2.75 | 4.0469e-05 | 6.4000e-04 |        1036 |    25600000 |           64 |      100000 |         5.1 |reached max iterations      3.0 | 1.2539e-05 | 1.5000e-04 |         321 |    25600000 |           15 |      100000 |         5.1 |reached max iterations     3.25 | 2.3047e-06 | 4.0000e-05 |          59 |    25600000 |            4 |      100000 |         5.1 |reached max iterations      3.5 | 0.0000e+00 | 0.0000e+00 |           0 |    25600000 |            0 |      100000 |         5.2 |reached max iterationsSimulation stopped as no error occurred @ EbNo = 3.5 dB.Running: 5G LDPC BP-20 (n=1000)EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.6346e-01 | 1.0000e+00 |       81732 |      500000 |         1000 |        1000 |         0.7 |reached target block errors     0.25 | 1.3887e-01 | 9.8100e-01 |       69437 |      500000 |          981 |        1000 |         0.1 |reached target block errors      0.5 | 1.0672e-01 | 9.0800e-01 |       53360 |      500000 |          908 |        1000 |         0.1 |reached target block errors     0.75 | 6.7436e-02 | 7.3600e-01 |       33718 |      500000 |          736 |        1000 |         0.1 |reached target block errors      1.0 | 3.4010e-02 | 4.6200e-01 |       34010 |     1000000 |          924 |        2000 |         0.2 |reached target block errors     1.25 | 1.3759e-02 | 2.2000e-01 |       20638 |     1500000 |          660 |        3000 |         0.2 |reached target block errors      1.5 | 3.6260e-03 | 7.4429e-02 |       12691 |     3500000 |          521 |        7000 |         0.5 |reached target block errors     1.75 | 8.2222e-04 | 1.8852e-02 |       11100 |    13500000 |          509 |       27000 |         2.1 |reached target block errors      2.0 | 8.5160e-05 | 2.8100e-03 |        4258 |    50000000 |          281 |      100000 |         7.7 |reached max iterations     2.25 | 1.2380e-05 | 4.5000e-04 |         619 |    50000000 |           45 |      100000 |         7.7 |reached max iterations      2.5 | 1.6600e-06 | 8.0000e-05 |          83 |    50000000 |            8 |      100000 |         7.7 |reached max iterations     2.75 | 0.0000e+00 | 0.0000e+00 |           0 |    50000000 |            0 |      100000 |         7.7 |reached max iterationsSimulation stopped as no error occurred @ EbNo = 2.8 dB.Running: 5G LDPC BP-20 (n=2000)EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.5917e-01 | 1.0000e+00 |      159172 |     1000000 |         1000 |        1000 |         0.7 |reached target block errors     0.25 | 1.3574e-01 | 9.9800e-01 |      135741 |     1000000 |          998 |        1000 |         0.1 |reached target block errors      0.5 | 9.7605e-02 | 9.7000e-01 |       97605 |     1000000 |          970 |        1000 |         0.1 |reached target block errors     0.75 | 5.6636e-02 | 8.3400e-01 |       56636 |     1000000 |          834 |        1000 |         0.1 |reached target block errors      1.0 | 1.9398e-02 | 4.6850e-01 |       38795 |     2000000 |          937 |        2000 |         0.2 |reached target block errors     1.25 | 3.7817e-03 | 1.4750e-01 |       15127 |     4000000 |          590 |        4000 |         0.5 |reached target block errors      1.5 | 4.6852e-04 | 2.4524e-02 |        9839 |    21000000 |          515 |       21000 |         2.5 |reached target block errors     1.75 | 2.4910e-05 | 2.1800e-03 |        2491 |   100000000 |          218 |      100000 |        12.0 |reached max iterations      2.0 | 3.0600e-06 | 2.2000e-04 |         306 |   100000000 |           22 |      100000 |        12.0 |reached max iterations     2.25 | 0.0000e+00 | 0.0000e+00 |           0 |   100000000 |            0 |      100000 |        12.0 |reached max iterationsSimulation stopped as no error occurred @ EbNo = 2.2 dB.Running: 5G LDPC BP-20 (n=4000)EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.6171e-01 | 1.0000e+00 |      323428 |     2000000 |         1000 |        1000 |         0.8 |reached target block errors     0.25 | 1.3731e-01 | 1.0000e+00 |      274623 |     2000000 |         1000 |        1000 |         0.2 |reached target block errors      0.5 | 1.0117e-01 | 1.0000e+00 |      202343 |     2000000 |         1000 |        1000 |         0.2 |reached target block errors     0.75 | 5.0568e-02 | 9.2900e-01 |      101135 |     2000000 |          929 |        1000 |         0.2 |reached target block errors      1.0 | 1.1114e-02 | 5.3700e-01 |       22228 |     2000000 |          537 |        1000 |         0.2 |reached target block errors     1.25 | 8.8170e-04 | 1.0400e-01 |        8817 |    10000000 |          520 |        5000 |         1.0 |reached target block errors      1.5 | 2.2490e-05 | 4.9100e-03 |        4498 |   200000000 |          491 |      100000 |        20.9 |reached max iterations     1.75 | 1.0000e-06 | 1.1000e-04 |         200 |   200000000 |           11 |      100000 |        20.9 |reached max iterations      2.0 | 0.0000e+00 | 0.0000e+00 |           0 |   200000000 |            0 |      100000 |        20.9 |reached max iterationsSimulation stopped as no error occurred @ EbNo = 2.0 dB.Running: 5G LDPC BP-20 (n=8000)EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.3677e-01 | 1.0000e+00 |      547065 |     4000000 |         1000 |        1000 |         1.0 |reached target block errors     0.25 | 1.1156e-01 | 1.0000e+00 |      446245 |     4000000 |         1000 |        1000 |         0.5 |reached target block errors      0.5 | 7.1865e-02 | 1.0000e+00 |      287462 |     4000000 |         1000 |        1000 |         0.5 |reached target block errors     0.75 | 2.6992e-02 | 9.4400e-01 |      107966 |     4000000 |          944 |        1000 |         0.5 |reached target block errors      1.0 | 3.0941e-03 | 4.1550e-01 |       24753 |     8000000 |          831 |        2000 |         1.0 |reached target block errors     1.25 | 3.9833e-05 | 1.9148e-02 |        4302 |   108000000 |          517 |       27000 |        12.9 |reached target block errors      1.5 | 1.0000e-07 | 1.3000e-04 |          40 |   400000000 |           13 |      100000 |        47.5 |reached max iterations     1.75 | 0.0000e+00 | 0.0000e+00 |           0 |   400000000 |            0 |      100000 |        47.6 |reached max iterationsSimulation stopped as no error occurred @ EbNo = 1.8 dB.Running: 5G LDPC BP-20 (n=16000)EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 1.3711e-01 | 1.0000e+00 |     1096908 |     8000000 |         1000 |        1000 |         1.5 |reached target block errors     0.25 | 1.1128e-01 | 1.0000e+00 |      890264 |     8000000 |         1000 |        1000 |         1.0 |reached target block errors      0.5 | 7.0450e-02 | 1.0000e+00 |      563597 |     8000000 |         1000 |        1000 |         1.0 |reached target block errors     0.75 | 2.3747e-02 | 9.9500e-01 |      189977 |     8000000 |          995 |        1000 |         1.0 |reached target block errors      1.0 | 1.1759e-03 | 4.5400e-01 |       18815 |    16000000 |          908 |        2000 |         2.0 |reached target block errors     1.25 | 1.7050e-06 | 3.9200e-03 |        1364 |   800000000 |          392 |      100000 |        98.2 |reached max iterations      1.5 | 0.0000e+00 | 0.0000e+00 |           0 |   800000000 |            0 |      100000 |        98.2 |reached max iterationsSimulation stopped as no error occurred @ EbNo = 1.5 dB.
../../_images/phy_tutorials_5G_Channel_Coding_Polar_vs_LDPC_Codes_24_1.png

A Deeper Look into the Polar Code Module

A Polar code can be defined by a set offrozenbit andinformationbit positions [1]. The packagesionna.fec.polar.utils supports 5G-compliant Polar code design, but also Reed-Muller (RM) codes are available and can be used within the same encoder/decoder layer. If required, rate-matching and CRC concatenation are handled by the classsionna.fec.polar.Polar5GEncoder andsionna.fec.polar.Polar5GDecoder, respectively.

Further, the following decoders are available:

  • Successive cancellation (SC) decoding [1]

    • Fast and low-complexity

    • Sub-optimal error-rate performance

  • Successive cancellation list (SCL) decoding [2]

    • Excellent error-rate performance

    • High-complexity

    • CRC-aided decoding possible

  • Hybrid SCL decoder (combined SC and SCL decoder)

    • Pre-decode with SC and only apply SCL iff CRC fails

    • Excellent error-rate performance

    • Needs outer CRC (e.g., as done in 5G)

    • CPU-based implementation and, thus, no XLA support (+ increased decoding latency)

  • Iterative belief propagation (BP) decoding [6]

    • Produces soft-output estimates

    • Sub-optimal error-rate performance

Let us now generate a new Polar code.

[13]:
code_type="5G"# try also "RM"# Load the 5G compliant polar codeifcode_type=="5G":k=32n=64# load 5G compliant channel ranking [3]frozen_pos,info_pos=generate_5g_ranking(k,n)print("Generated Polar code of length n ={} and k ={}".format(n,k))print("Frozen codeword positions: ",frozen_pos)# Alternatively Reed-Muller code design is also availableelifcode_type=="RM":r=3m=7frozen_pos,info_pos,n,k,d_min=generate_rm_code(r,m)print("Generated ({},{}) Reed-Muller code of length n ={} and k ={} with minimum distance d_min ={}".format(r,m,n,k,d_min))print("Frozen codeword positions: ",frozen_pos)else:print("Code not found")
Generated Polar code of length n = 64 and k = 32Frozen codeword positions:  [ 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 16 17 18 19 20 21 24 25 26 32 33 34 35 36 37 40 48]

Now, we can initialize the encoder and aBinarySource to generate random Polar codewords.

[14]:
# init polar encoderencoder_polar=PolarEncoder(frozen_pos,n)# init binary source to generate information bitssource=BinarySource()# define a batch_sizebatch_size=1# generate random info bitsu=source([batch_size,k])# and encodec=encoder_polar(u)print("Information bits: ",u.numpy())print("Polar encoded bits: ",c.numpy())
Information bits:  [[1. 0. 0. 0. 0. 1. 1. 1. 1. 1. 1. 0. 0. 0. 1. 0. 1. 1. 0. 1. 0. 1. 1. 1.  0. 0. 0. 0. 1. 1. 0. 1.]]Polar encoded bits:  [[1. 1. 0. 1. 0. 0. 1. 0. 0. 0. 1. 0. 1. 1. 1. 0. 1. 0. 0. 0. 1. 0. 1. 1.  0. 0. 1. 0. 0. 0. 1. 0. 1. 0. 1. 1. 0. 1. 0. 0. 0. 1. 0. 0. 1. 0. 0. 0.  0. 0. 0. 1. 0. 0. 1. 0. 1. 0. 1. 1. 1. 0. 1. 1.]]

As can be seen, the length of the resulting code must be a power of 2. This brings us to the problem of rate-matching and we will now have a closer look how we can adapt the length of the code.

Rate-Matching and Rate-Recovery

The general task of rate-matching is to enable flexibility of the code w.r.t. the codeword length\(n\) and information bit input size\(k\) and, thereby, the rate\(r = \frac{k}{n}\). In modern communication standards such as 5G NR, these parameters can be adjusted on a bit-level granularity without - in a wider sense - redefining the (mother) code itself. This is enabled by a powerful rate-matching and the corresponding rate-recovery block which will be explained in the following.

The principle idea is to select a mother code as close as possible to the desired properties from a set of possible mother codes. For example for Polar codes, the codeword length must be a power of 2, i.e.,\(n = 32, 64, ..., 512, 1024\). For LDPC codes the codeword length is more flexible (due to the differentlifting factors), however, does not allow bit-wise granularity neither. Afterwards, the bit-level granularity is provided by shortening, puncturing and repetitions.

To summarize, the rate-matching procedure consists of:

  1. ) 5G NR defines multiplemother codes with similar properties (e.g., via base-graph lifting of LDPC code or sub-codes for Polar codes)

  2. ) Puncturing, shortening and repetitions of bits to allow bit-level rate adjustments

The following figure summarizes the principle for the 5G NR Polar code uplink control channel (UCI). The Fig. is inspired by Fig. 6 in [9].

Rate Match

For bit-wise length adjustments, the following techniques are commonly used:

  1. )Puncturing: A (\(k,n\)) mother code is punctured bynot transmitting\(p\) punctured codeword bits. Thus, the rate increases to\(r_{\text{pun}} = \frac{k}{n-p} > \frac{k}{n} \quad \forall p > 0\). At the decoder these codeword bits are treated as erasure (\(\ell_{\text{ch}} = 0\)).

  2. )Shortening: A (\(k,n\)) mother code is shortened by setting\(s\) information bits to a fixed (=known) value. Assuming systematic encoding, these\(s\) positions are not transmitted leading to a new code of rate\(r_{\text{short}} = \frac{k-s}{n-s}<\frac{k}{n}\). At the decoder these codeword bits are treated as known values (\(\ell_{\text{ch}} = \infty\)).

  3. )Repetitions can be used to lower the effective rate. For details we refer the interested reader to [11].

We will now simulate the performance of rate-matched 5G Polar codes for different lengths and rates. For this, we are interested in the required SNR to achieve a target BLER at\(10^{-3}\). Please note that this is a reproduction of the results from [Fig.13a, 4].

Note: This needs a bisection search as we usually simulate the BLER at fixed SNR and, thus, this is simulation takes some time. Please only execute the cell below if you have enough simulation capabilities.

[15]:
# find the EsNo in dB to achieve target_blerdeffind_threshold(model,# model to be testedbatch_size=1000,max_batch_iter=10,# simulate cws up to batch_size * max_batch_itermax_block_errors=100,# number of errors before stoptarget_bler=1e-3):# target error rate to simulate (same as in[4])"""Bisection search to find required SNR to reach target SNR."""# bisection parametersesno_db_min=-15# smallest possible search SNResno_db_max=15# largest possible search SNResno_interval=(esno_db_max-esno_db_min)/4# initial search interval sizeesno_db=2*esno_interval+esno_db_min# current test SNRmax_iters=12# number of iterations for bisection search# run bisectionforiinrange(max_iters):num_block_error=0num_cws=0forjinrange(max_batch_iter):# run model and evaluate BLERu,u_hat=model(tf.constant(batch_size,tf.int32),tf.constant(esno_db,tf.float32))num_block_error+=count_block_errors(u,u_hat)num_cws+=batch_size# early stop if target number of block errors is reachedifnum_block_error>max_block_errors:breakbler=num_block_error/num_cws# increase SNR if BLER was great than target# (larger SNR leads to decreases BLER)ifbler>target_bler:esno_db+=esno_intervalelse:# and decrease SNR otherwiseesno_db-=esno_intervalesno_interval=esno_interval/2# return final SNR after max_itersreturnesno_db
[16]:
# run simulations for multiple code parametersnum_bits_per_symbol=2# QPSK# we sweep over multiple values for k and nks=np.array([12,16,32,64,128,140,210,220,256,300,400,450,460,512,800,880,940])ns=np.array([160,240,480,960])# we use EsNo instead of EbNo to have the same results as in [4]esno=np.zeros([len(ns),len(ks)])forj,ninenumerate(ns):fori,kinenumerate(ks):ifk<n:# only simulate if code parameters are feasible (i.e., r < 1)print(f"Finding threshold of k ={k}, n ={n}")# initialize new encoder / decoder pairenc=Polar5GEncoder(k=k,n=n)dec=Polar5GDecoder(enc,dec_type="SCL",list_size=8)#build modelmodel=System_Model(k=k,n=n,num_bits_per_symbol=num_bits_per_symbol,encoder=enc,decoder=dec,sim_esno=True)# no rate adjustment# and find threshold via bisection searchesno[j,i]=find_threshold(model)print("Found threshold at: ",esno[j,i])
Finding threshold of k = 12, n = 160Warning: For 12<=k<=19 additional 3 parity-check bits are defined in 38.212. They are currently not implemented by this encoder and, thus, ignored.Found threshold at:  -4.420166015625Finding threshold of k = 16, n = 160Warning: For 12<=k<=19 additional 3 parity-check bits are defined in 38.212. They are currently not implemented by this encoder and, thus, ignored.Found threshold at:  -3.497314453125Finding threshold of k = 32, n = 160Found threshold at:  -0.333251953125Finding threshold of k = 64, n = 160Found threshold at:  2.471923828125Finding threshold of k = 128, n = 160Found threshold at:  6.763916015625Finding threshold of k = 140, n = 160Found threshold at:  8.192138671875Finding threshold of k = 12, n = 240Warning: For 12<=k<=19 additional 3 parity-check bits are defined in 38.212. They are currently not implemented by this encoder and, thus, ignored.Found threshold at:  -6.331787109375Finding threshold of k = 16, n = 240Warning: For 12<=k<=19 additional 3 parity-check bits are defined in 38.212. They are currently not implemented by this encoder and, thus, ignored.Found threshold at:  -5.211181640625Finding threshold of k = 32, n = 240Found threshold at:  -2.662353515625Finding threshold of k = 64, n = 240Found threshold at:  -0.047607421875Finding threshold of k = 128, n = 240Found threshold at:  3.270263671875Finding threshold of k = 140, n = 240Found threshold at:  3.812255859375Finding threshold of k = 210, n = 240Found threshold at:  7.613525390625Finding threshold of k = 220, n = 240Found threshold at:  8.638916015625Finding threshold of k = 12, n = 480Warning: For 12<=k<=19 additional 3 parity-check bits are defined in 38.212. They are currently not implemented by this encoder and, thus, ignored.Found threshold at:  -9.437255859375Finding threshold of k = 16, n = 480Warning: For 12<=k<=19 additional 3 parity-check bits are defined in 38.212. They are currently not implemented by this encoder and, thus, ignored.Found threshold at:  -8.404541015625Finding threshold of k = 32, n = 480Found threshold at:  -5.797119140625Finding threshold of k = 64, n = 480Found threshold at:  -3.519287109375Finding threshold of k = 128, n = 480Found threshold at:  -0.640869140625Finding threshold of k = 140, n = 480Found threshold at:  -0.333251953125Finding threshold of k = 210, n = 480Found threshold at:  1.666259765625Finding threshold of k = 220, n = 480Found threshold at:  1.929931640625Finding threshold of k = 256, n = 480Found threshold at:  2.838134765625Finding threshold of k = 300, n = 480Found threshold at:  3.848876953125Finding threshold of k = 400, n = 480Found threshold at:  6.478271484375Finding threshold of k = 450, n = 480Found threshold at:  8.587646484375Finding threshold of k = 460, n = 480Found threshold at:  9.356689453125Finding threshold of k = 12, n = 960Warning: For 12<=k<=19 additional 3 parity-check bits are defined in 38.212. They are currently not implemented by this encoder and, thus, ignored.Found threshold at:  -9.481201171875Finding threshold of k = 16, n = 960Warning: For 12<=k<=19 additional 3 parity-check bits are defined in 38.212. They are currently not implemented by this encoder and, thus, ignored.Found threshold at:  -8.682861328125Finding threshold of k = 32, n = 960Found threshold at:  -8.939208984375Finding threshold of k = 64, n = 960Found threshold at:  -6.617431640625Finding threshold of k = 128, n = 960Found threshold at:  -4.031982421875Finding threshold of k = 140, n = 960Found threshold at:  -3.687744140625Finding threshold of k = 210, n = 960Found threshold at:  -2.017822265625Finding threshold of k = 220, n = 960Found threshold at:  -1.776123046875Finding threshold of k = 256, n = 960Found threshold at:  -1.072998046875Finding threshold of k = 300, n = 960Found threshold at:  -0.369873046875Finding threshold of k = 400, n = 960Found threshold at:  1.226806640625Finding threshold of k = 450, n = 960Found threshold at:  1.710205078125Finding threshold of k = 460, n = 960Found threshold at:  1.842041015625Finding threshold of k = 512, n = 960Found threshold at:  2.501220703125Finding threshold of k = 800, n = 960Found threshold at:  6.148681640625Finding threshold of k = 880, n = 960Found threshold at:  7.738037109375Finding threshold of k = 940, n = 960Found threshold at:  10.074462890625
[17]:
# plot the resultsleg_str=[]forj,ninenumerate(ns):plt.plot(np.log2(ks[ks<n]),esno[j,ks<n])leg_str.append("n ={}".format(n))# define labels manuallyx_tick_labels=np.power(2,np.arange(3,11))plt.xticks(ticks=np.arange(3,11),labels=x_tick_labels,fontsize=18)# adjusted layout of figureplt.grid("both")plt.ylim([-10,15])plt.xlabel("Number of information bits $k$",fontsize=20)plt.yticks(fontsize=18)plt.ylabel("$E_s/N_0^*$ (dB)",fontsize=20)plt.legend(leg_str,fontsize=18);fig=plt.gcf()# get handle to current figurefig.set_size_inches(15,10)
../../_images/phy_tutorials_5G_Channel_Coding_Polar_vs_LDPC_Codes_37_0.png

This figure equals [Fig. 13a, 4] with a few small exception for extreme low-rate codes. This can be explained by the fact that the 3 explicit parity-bits bits are not implemented, however, these bits are only relevant for for\(12\leq k \leq20\). It also explains the degraded performance of the n=960, k=16 code.

Throughput and Decoding Complexity

In the last part of this notebook, you will compare the different computational complexity of the different codes and decoders. In theory the complexity is given as:

  • Successive cancellation list (SCL) decoding of Polar codes scales with\(\mathcal{O}(L \cdot n \cdot \operatorname{log} n)\) (with\(L=1\) for SC decoding)

  • Iterative belief propagation (BP) decoding of LDPC codes scales with\(\mathcal{O}(n)\). However, in particular for short codes a complexity comparison should be supported by empirical results.

We want to emphasize that the results strongly depend on the exact implementation and may differ for different implementations/optimizations. Implementing the SCL decoder in Tensorflow is a delicate task and requires several design trade-offs to enable a graph implementation which can lead to degraded throughput mainly caused by the missinglazy copy-mechanism. However, - inspired by [10] - the SCL decoder layer supportshybridSC decoding meaning that SC decoding is done first and asecond stage SCL decoder operates as afterburner iff the outer CRC check fails. Please note that this modus uses‘tf.py_function’ (due to the control flow and the dynamic shape of the decoding graph) and, thus, does not support XLA compilation.

[18]:
defget_throughput(batch_size,ebno_dbs,model,repetitions=1):""" Simulate throughput in bit/s per ebno_dbs point.    The results are average over `repetition` trials.    Input    -----    batch_size: tf.int32        Batch-size for evaluation.    ebno_dbs: tf.float32        A tensor containing SNR points to be evaluated.    model:        Function or model that yields the transmitted bits `u` and the        receiver's estimate `u_hat` for a given ``batch_size`` and        ``ebno_db``.    repetitions: int        An integer defining how many trails of the throughput        simulation are averaged.    """throughput=np.zeros_like(ebno_dbs)# call model once to be sure it is compile properly# otherwise time to build graph is measured as well.u,u_hat=model(tf.constant(batch_size,tf.int32),tf.constant(0.,tf.float32))foridx,ebno_dbinenumerate(ebno_dbs):t_start=time.perf_counter()# average over multiple runsfor_inrange(repetitions):u,u_hat=model(tf.constant(batch_size,tf.int32),tf.constant(ebno_db,tf.float32))t_stop=time.perf_counter()# throughput in bit/sthroughput[idx]=np.size(u.numpy())*repetitions/(t_stop-t_start)returnthroughput
[19]:
# plot throughput and ber together for ldpc codes# and simulate the resultsnum_bits_per_symbol=2# QPSKebno_db=[5]# SNR to simulatenum_bits_per_batch=5e6# must be reduced in case of out-of-memory errorsnum_repetitions=20# average throughput over multiple runs# run throughput simulations for each codethroughput=np.zeros(len(codes_under_test))code_length=np.zeros(len(codes_under_test))foridx,codeinenumerate(codes_under_test):print("Running: "+code[2])# save codeword length for plottingcode_length[idx]=code[4]# init new model for given encoder/decodermodel=System_Model(k=code[3],n=code[4],num_bits_per_symbol=num_bits_per_symbol,encoder=code[0],decoder=code[1])# scale batch_size such that same number of bits is simulated for all codesbatch_size=int(num_bits_per_batch/code[4])# and measure throughput of the modelthroughput[idx]=get_throughput(batch_size,ebno_db,model,repetitions=num_repetitions)
Running: 5G LDPC BP-20 (n=128)Running: 5G LDPC BP-20 (n=256)Running: 5G LDPC BP-20 (n=512)Running: 5G LDPC BP-20 (n=1000)Running: 5G LDPC BP-20 (n=2000)Running: 5G LDPC BP-20 (n=4000)Running: 5G LDPC BP-20 (n=8000)Running: 5G LDPC BP-20 (n=16000)
[20]:
# plot resultsplt.figure(figsize=(16,10))plt.xticks(fontsize=18)plt.yticks(fontsize=18)plt.title("Throughput LDPC BP Decoding @ rate=0.5",fontsize=25)plt.xlabel("Codeword length",fontsize=25)plt.ylabel("Throughput (Mbit/s)",fontsize=25)plt.grid(which="both")# and plot results (logarithmic scale in x-dim)x_tick_labels=code_length.astype(int)plt.xticks(ticks=np.log2(code_length),labels=x_tick_labels,fontsize=18)plt.plot(np.log2(code_length),throughput/1e6)
[20]:
[<matplotlib.lines.Line2D at 0x7fc677dbe1d0>]
../../_images/phy_tutorials_5G_Channel_Coding_Polar_vs_LDPC_Codes_42_1.png

As expected the throughput of BP decoding is (relatively) constant as the complexity scales linearly with\(\mathcal{O}(n)\) and, thus, the complexityper decoded bit remains constant. It is instructive to realize that the above plot is in the log-domain for the x-axis.

Let us have a look at what happens for different SNR values.

[21]:
# --- LDPC ---n=1000k=500encoder=LDPC5GEncoder(k,n)decoder=LDPC5GDecoder(encoder)# init a new modelmodel=System_Model(k=k,n=n,num_bits_per_symbol=num_bits_per_symbol,encoder=encoder,decoder=decoder)# run throughput tests at 2 dB and 5 dBebno_db=[2,5]batch_size=10000throughput=get_throughput(batch_size,ebno_db,# snr pointmodel,repetitions=num_repetitions)# and print the resultsforidx,snr_dbinenumerate(ebno_db):print(f"Throughput @{snr_db:.1f} dB:{throughput[idx]/1e6:.2f} Mbit/s")
Throughput @ 2.0 dB: 10.45 Mbit/sThroughput @ 5.0 dB: 10.45 Mbit/s

For most Sionna decoders the throughput is not SNR dependent as early stopping of individual samples within a batch is difficult to realize.

However, thehybridSCL decoder uses an internal NumPy SCL decoder only if the SC decoder failed similar to [10]. We will now benchmark this decoder for different SNR values.

[22]:
# --- Polar ---n=256k=128encoder=Polar5GEncoder(k,n)decoder=Polar5GDecoder(encoder,"hybSCL")# init a new modelmodel=System_Model(k=k,n=n,num_bits_per_symbol=num_bits_per_symbol,encoder=encoder,decoder=decoder)ebno_db=np.arange(0,5,0.5)# EbNo to evaluatebatch_size=1000throughput=get_throughput(batch_size,ebno_db,# snr pointmodel,repetitions=num_repetitions)# and print the resultsforidx,snr_dbinenumerate(ebno_db):print(f"Throughput @{snr_db:.1f} dB:{throughput[idx]/1e6:.3f} Mbit/s")
Throughput @ 0.0 dB: 0.010 Mbit/sThroughput @ 0.5 dB: 0.011 Mbit/sThroughput @ 1.0 dB: 0.013 Mbit/sThroughput @ 1.5 dB: 0.018 Mbit/sThroughput @ 2.0 dB: 0.031 Mbit/sThroughput @ 2.5 dB: 0.068 Mbit/sThroughput @ 3.0 dB: 0.168 Mbit/sThroughput @ 3.5 dB: 0.507 Mbit/sThroughput @ 4.0 dB: 0.843 Mbit/sThroughput @ 4.5 dB: 1.025 Mbit/s

We can overlay the throughput with the BLER of the SC decoder. This can be intuitively explained by the fact that hehybridSCL decoder consists of two decoding stages:

  • SC decoding for all received codewords.

  • SCL decodingiff the CRC does not hold, i.e., SC decoding did not yield the correct codeword.

Thus, the throughput directly depends on the BLER of the internal SC decoder.

[23]:
ber_plot_polar=PlotBER("Polar SC/SCL Decoding")ber_plot_polar.simulate(model,# the function have defined previouslyebno_dbs=ebno_db,legend="hybrid SCL decoding",max_mc_iter=100,num_target_block_errors=100,# we fix the target blerbatch_size=1000,soft_estimates=False,early_stop=True,add_ber=False,add_bler=True,show_fig=False,forward_keyboard_interrupt=False);# and add SC decodingdecoder2=Polar5GDecoder(encoder,"SC")model=System_Model(k=k,n=n,num_bits_per_symbol=num_bits_per_symbol,encoder=encoder,decoder=decoder2)ber_plot_polar.simulate(model,# the function have defined previouslyebno_dbs=ebno_db,legend="SC decoding",max_mc_iter=100,num_target_block_errors=100,# we fix the target blerbatch_size=1000,soft_estimates=False,early_stop=True,add_ber=False,# we only focus on BLERadd_bler=True,show_fig=False,forward_keyboard_interrupt=False);
EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 3.4096e-01 | 8.4400e-01 |       43643 |      128000 |          844 |        1000 |        12.3 |reached target block errors      0.5 | 2.3823e-01 | 6.3300e-01 |       30494 |      128000 |          633 |        1000 |        11.5 |reached target block errors      1.0 | 1.2420e-01 | 3.6200e-01 |       15897 |      128000 |          362 |        1000 |         9.7 |reached target block errors      1.5 | 3.4438e-02 | 1.1100e-01 |        4408 |      128000 |          111 |        1000 |         7.0 |reached target block errors      2.0 | 1.0393e-02 | 3.5000e-02 |        3991 |      384000 |          105 |        3000 |        12.8 |reached target block errors      2.5 | 1.3803e-03 | 5.3158e-03 |        3357 |     2432000 |          101 |       19000 |        36.8 |reached target block errors      3.0 | 9.9375e-05 | 4.3000e-04 |        1272 |    12800000 |           43 |      100000 |        75.6 |reached max iterations      3.5 | 8.4375e-06 | 4.0000e-05 |         108 |    12800000 |            4 |      100000 |        26.2 |reached max iterations      4.0 | 0.0000e+00 | 0.0000e+00 |           0 |    12800000 |            0 |      100000 |        17.4 |reached max iterationsSimulation stopped as no error occurred @ EbNo = 4.0 dB.Warning: 5G Polar codes use an integrated CRC that cannot be materialized with SC decoding and, thus, causes a degraded performance. Please consider SCL decoding instead.EbNo [dB] |        BER |       BLER |  bit errors |    num bits | block errors |  num blocks | runtime [s] |    status---------------------------------------------------------------------------------------------------------------------------------------      0.0 | 4.1442e-01 | 9.6000e-01 |       53046 |      128000 |          960 |        1000 |        13.4 |reached target block errors      0.5 | 3.5523e-01 | 9.1300e-01 |       45469 |      128000 |          913 |        1000 |         0.1 |reached target block errors      1.0 | 2.7141e-01 | 7.6400e-01 |       34741 |      128000 |          764 |        1000 |         0.1 |reached target block errors      1.5 | 1.8233e-01 | 5.4600e-01 |       23338 |      128000 |          546 |        1000 |         0.1 |reached target block errors      2.0 | 1.0466e-01 | 3.4200e-01 |       13396 |      128000 |          342 |        1000 |         0.1 |reached target block errors      2.5 | 4.6227e-02 | 1.5500e-01 |        5917 |      128000 |          155 |        1000 |         0.1 |reached target block errors      3.0 | 1.3242e-02 | 5.3500e-02 |        3390 |      256000 |          107 |        2000 |         0.2 |reached target block errors      3.5 | 3.9263e-03 | 1.6429e-02 |        3518 |      896000 |          115 |        7000 |         0.6 |reached target block errors      4.0 | 7.6953e-04 | 3.8462e-03 |        2561 |     3328000 |          100 |       26000 |         2.3 |reached target block errors      4.5 | 1.2547e-04 | 7.5000e-04 |        1606 |    12800000 |           75 |      100000 |         9.0 |reached max iterations

Let us visualize the results.

[24]:
ber_plot_polar()ax2=plt.gca().twinx()# new axisax2.plot(ebno_db,throughput,'g',label="Throughput hybSCL-8")ax2.legend(fontsize=20)ax2.set_ylabel("Throughput (bit/s)",fontsize=25);ax2.tick_params(labelsize=25)
../../_images/phy_tutorials_5G_Channel_Coding_Polar_vs_LDPC_Codes_50_0.png

You can also try:

  • Analyze different rates

  • What happens for different batch-sizes? Can you explain what happens?

  • What happens for higher order modulation. Why is the complexity increased?

References

[1] E. Arikan, “Channel polarization: A method for constructing capacity-achieving codes for symmetric binary-input memoryless channels,” IEEE Transactions on Information Theory, 2009.

[2] Ido Tal and Alexander Vardy, “List Decoding of Polar Codes.” IEEE Transactions on Information Theory, 2015.

[3] ETSI 3GPP TS 38.212 “5G NR Multiplexing and channel coding”, v.16.5.0, 2021-03.

[4] V. Bioglio, C. Condo, I. Land, “Design of Polar Codes in 5G New Radio.” IEEE Communications Surveys & Tutorials, 2020.

[5] D. Hui, S. Sandberg, Y. Blankenship, M. Andersson, L. Grosjean “Channel coding in 5G new radio: A Tutorial Overview and Performance Comparison with 4G LTE.” IEEE Vehicular Technology Magazine, 2018.

[6] E. Arikan, “A Performance Comparison of Polar Codes and Reed-Muller Codes,” IEEE Commun. Lett., vol. 12, no. 6, pp. 447–449, Jun. 2008.

[7] R. G. Gallager, Low-Density Parity-Check Codes, M.I.T. Press Classic Series, Cambridge MA, 1963.

[8] T. Richardson and S. Kudekar. “Design of low-density parity check codes for 5G new radio,” IEEE Communications Magazine 56.3, 2018.

[9] G. Liva, L. Gaudio, T. Ninacs, T. Jerkovits, “Code design for short blocks: A survey,” arXiv preprint arXiv:1610.00873, 2016.

[10] S. Cammerer, B. Leible, M. Stahl, J. Hoydis, and S ten Brink, “Combining Belief Propagation and Successive Cancellation List Decoding of Polar Codes on a GPU Platform,” IEEE ICASSP, 2017.

[11] V. Bioglio, F. Gabry, I. Land, “Low-complexity puncturing and shortening of polar codes,” IEEE Wireless Communications and Networking Conference Workshops (WCNCW), 2017.

[12] M. Fossorier, S. Lin, “Soft-Decision Decoding of Linear Block Codes Based on Ordered Statistics”, IEEE Transactions on Information Theory, vol. 41, no. 5, 1995.