5G LDPC Intel® FPGA IP User Guide

ID 683107
Date 4/01/2024
Public
Document Table of Contents

5.1. C++ and MATLAB Software Models

The C++ and MATLAB models represent the functionality of the 5G LDPC IP and can generate BLER vs. SNR graphs for different parameterizations.

The models allow you to:

  • Optimize the network performance.
  • Shorten the time to determine the channel coding parameters for 5G LDPC such as the base graph, the lifting size, and the code rate.
  • Tune the network for better throughput by allowing estimation of the maximum number of iterations needed to decode the majority of codewords under certain channel conditions.
Block Diagram of a Wireless Communication System Emulated with the 5G LDPC IP Software Models

Decoder C++ Model

The file is: LdpcDecoder_fxp.cpp.

Function signature:

int LdpcDecoder_fxp (
    // Outputs
    vector<int> &BitErrors, // comparison result of input: data vs output: DecodedBits
    vector<int> &DecodedBits, // decoded bits
    int &DecodedIters, // number of iterations used to decoded
    int &et_pass, // 1: early terminated
    // Inputs
    vector<int> &input, // LLRs
    int ExpFactor, // Z (lifting factor):  2,3,4,5,...,320,352,384
    int max_iter, // number of iterations allowed
    vector<int> &data, // expected data, to be used to compare with DecodedBits
    int BaseGraph, // 0: BG#1, 1: BG#2
    int CodeRate, // BG#1:         1: 1/3, 2: 2/5, 3: 1/2, 4: 2/3, 5: 3/4, 6: 5/6, 7: 8/9
                  // BG#2: 0: 1/5, 1: 1/3, 2: 2/5, 3: 1/2, 4: 2/3
    int in_width = 6, // bit width of input LLRs (2 of that are fractional bits)
    int llr_eq_0_as_negative = 0,// 3: treat LLR == 0 as negative-signed at internal and output (hard decision)
                                 // 2: treat LLR == 0 as negative-signed at internal
                                 // 1: treat LLR == 0 as negative-signed at output (hard decision)
                                   // 0: treat LLR == 0 as positive-signed
      int et_dis = 0, // disable early termination
      int skip_deg1 = 0 // syndrome check: 0: all layers, 1: first 4 layers only
)


Note:
  • BitErrors
    • size = max_iter
    • each element is the number of error comparing input data vs output DecodedBits after each iteration, e.g. BitErrors[1] is the number of errors after iteration 1
  • DecodedBits
    • size = max_iter * message length
    • DecodedBits[iter + i * max_iter] is the decoded bits after iteration iter at bit position i, e.g. DecodedBits[DecodedIters + i * max_iter] is the final decoded bits at bit position i

Encoder C++ Model

The file is: LdpcEncoder.c

Function signature:

void LdpcEncoder (
    // Inputs
    int z, // Lifting factor: 2,3,4,5,...,320,352,384
    int base_graph, // 0: BG#1, 1: BG#2
    int code_rate, // BG#1:         1: 1/3, 2: 2/5, 3: 1/2, 4: 2/3, 5: 3/4, 6: 5/6, 7: 8/9
                   // BG#2: 0: 1/5, 1: 1/3, 2: 2/5, 3: 1/2, 4: 2/3
    int kb, // BG#1: 22, BG#2: 10, 9, 8, 6
    int *msg, // msg array, each element is a symbol (0 or 1) in message
    // Outputs
    int *cw,// codeword array, each element is a symbol (0 or 1) in codeword
    int *cw_size // no. of valid elements in cw_int[]
);