top of page

LDPC Coding in 5G NR

  • Writer: Venkateshu Kamarthi
    Venkateshu Kamarthi
  • 17 minutes ago
  • 9 min read

1. Introduction

Channel coding is one of the most fundamental building blocks of the 5G NR physical layer. It directly determines:

  • Block Error Rate (BLER)

  • Throughput at high MCS

  • Latency predictability

  • UE power consumption

  • Hardware scalability in gNB and UE

Unlike LTE, which relied almost exclusively on Turbo codes, 5G NR deliberately replaced Turbo codes with Low Density Parity Check (LDPC) codes for data channels and Polar codes for control channels.

 

LDPC Coding Chain in 5G NR

The LDPC processing chain for a Transport Block is shown below,



Here's a detailed description of each stage in the LDPC processing chain:

1. Transport Block (TB)

The Transport Block is the input data payload that needs to be transmitted over the air interface. It contains the user data or control information that originates from higher protocol layers (MAC layer in 5G). The TB size varies based on the allocated resources, modulation and coding scheme (MCS), and channel conditions. This is essentially the raw information bits before any channel coding is applied.

 

2. TB CRC Attachment

A Cyclic Redundancy Check (CRC) code is appended to the entire Transport Block. In 5G NR, typically a 24-bit CRC is used for this purpose. This CRC serves as an error detection mechanism at the transport block level, allowing the receiver to verify whether the entire TB was decoded correctly. If the CRC check fails at the receiver, it indicates errors in the TB and triggers retransmission through HARQ (Hybrid Automatic Repeat Request) mechanisms.

 

3. Code Block Segmentation

When the TB (including its CRC) exceeds the maximum code block size that the LDPC encoder can handle (8448 bits in 5G NR), it must be segmented into multiple smaller Code Blocks (CBs). The segmentation is done such that all code blocks are approximately equal in size. If the TB is small enough, no segmentation occurs and it remains as a single code block. This step also includes adding filler bits if necessary to match the code block size requirements.

 

4. Code Block CRC Attachment

Each individual Code Block gets its own CRC attached (typically 24 bits). This provides error detection capability at the code block granularity. The advantage is that at the receiver, if only some code blocks fail their CRC check, the system can selectively request retransmission of only those failed blocks rather than the entire transport block, improving efficiency in the HARQ process.


5. LDPC Encoding

This is the core Forward Error Correction (FEC) step. Low-Density Parity-Check encoding adds redundancy bits (parity bits) to each code block based on a sparse parity-check matrix. 5G NR uses two base graphs (BG1 and BG2) for LDPC encoding depending on the code block size and code rate. The encoder generates systematic codewords where the original information bits are preserved and parity bits are appended. LDPC codes are chosen because they offer excellent error correction performance close to the Shannon limit with iterative decoding algorithms.


6. Rate Matching

Rate matching adapts the number of coded bits to fit the available physical channel resources. This involves:

  • Puncturing: Removing some parity bits to increase the code rate when resources are limited

  • Repetition: Repeating some coded bits to decrease the code rate when more resources are available

  • Bit selection: Choosing which bits from the LDPC codeword to transmit based on a circular buffer mechanism

The goal is to match the desired code rate based on link adaptation and channel quality feedback.


7. Scrambling

A pseudo-random scrambling sequence (generated using a Gold sequence in 5G) is XORed with the coded bit stream. Scrambling serves multiple purposes:

  • Randomizes the data to avoid long sequences of 0s or 1s

  • Reduces inter-cell interference by using cell-specific scrambling codes

  • Helps with synchronization and reduces peak-to-average power ratio (PAPR)

  • Whitens the spectrum of the transmitted signal

8. Modulation

The final step maps the scrambled binary bit stream onto complex-valued modulation symbols. 5G NR supports various modulation schemes:

  • QPSK (2 bits/symbol): Most robust, lowest spectral efficiency

  • 16-QAM (4 bits/symbol): Moderate robustness and efficiency

  • 64-QAM (6 bits/symbol): Good for medium to high SNR

  • 256-QAM (8 bits/symbol): Highest spectral efficiency, requires excellent channel conditions

The modulation scheme is selected based on channel quality (CQI reports) and resource allocation. These modulated symbols are then passed to subsequent layers for MIMO processing, OFDM symbol generation, and RF transmission.

 

 2. What Is LDPC Coding?

LDPC (Low Density Parity Check) codes are linear block codes defined by a sparse parity-check matrix (H).

The defining property:

  • Each parity equation involves only a small number of bits

  • The matrix contains mostly zeros → “low density”

This sparsity enables:

  • Efficient iterative decoding

  • Massive parallelization

  • Excellent performance for large block sizes.

 

LDPC in 5G NR is not a single code.It is a family of codes derived from two base graphs (BGs):

Base Graph

Optimized For

BG1

Large transport blocks, high code rates

BG2

Small/medium transport blocks, low code rates

The base graph determines:

  • Parity-check matrix structure

  • Decoder convergence behavior

  • Performance at different TB sizes and code rates

 

Base graph selection is done per transport block, before LDPC encoding.

Rule (simplified from 3GPP 38.212):

If TB size is large AND target code rate is high → BG1

Else → BG2

More precisely:

Condition

Selected BG

TB size > ~3840 bits AND R ≥ ~0.67

BG1

TB size ≤ ~3840 bits OR R < ~0.67

BG2

Mathematically, a valid LDPC codeword c satisfies:


Where:

  • H = parity-check matrix (sparse)

  • c = [data bits | parity bits]

The encoder’s job:

Given data bits, compute parity bits so all parity equations are satisfied.

 

LDPC Code ExampleStep 1: Define a Small LDPC Parity-Check Matrix

Assume:

  • Total codeword length n = 6

  • Data bits k = 3

  • Parity bits p = 3

Parity-check matrix H (3 × 6):


Each row = one parity equationEach column = one codeword bit

 

Step 2: Split Codeword Structure

We assume systematic LDPC:

Let input data bits be:

d1 = 1

d2 = 0

d3 = 1

So partial codeword:

c = [1 0 1 p1 p2 p3]

 

Step 3: Write Parity Equations from H

From row-wise parity constraints:

Equation 1 (Row 1)

Substitute:

 

Equation 2 (Row 2)

 

Equation 3 (Row 3)

 

Step 4: Final LDPC Codeword

This is a valid LDPC codeword because:

H.c^T = 0

  • All parity checks satisfied

  • Codeword ready for transmission

 

How the Receiver Uses This

At the receiver:

  • Each bit arrives with noise

  • Decoder checks parity equations

  • If equations don’t match → bits are flipped iteratively

  • Belief propagation continues until parity checks pass

 

3. Why LDPC Was Introduced in 5G NR

5G imposed constraints that Turbo codes could not satisfy:

3.1 Throughput Scalability

  • 5G supports up to 100 MHz bandwidth

  • Very large Transport Blocks (tens of thousands of bits)

  • Multiple users and layers simultaneously

Turbo decoding is inherently sequential and iteration-heavy, creating a throughput bottleneck.

LDPC decoding is:

  • Highly parallel

  • Scales linearly with block size

  • Friendly to ASICs, FPGAs, GPUs, and cloud RAN accelerators

 

3.2 Deterministic Latency

  • URLLC requires bounded, predictable decoding time

  • Turbo decoding needs many iterations, varying with SINR

LDPC decoding:

  • Uses belief-propagation with early stopping

  • More predictable convergence

  • Better HARQ timing alignment

 

3.3 Energy Efficiency

  • Turbo decoders consume more power due to many iterations

  • 5G UEs must handle high data rates without thermal throttling

LDPC decoding converges faster at high SNR → lower UE power per decoded bit.

 

4. Where LDPC Is Used in 5G NR

Physical Channel

Direction

Coding

PDSCH

Downlink

LDPC

PUSCH

Uplink

LDPC

All user data in 5G NR is LDPC-coded.

 

5. Transport Block to LDPC Code Blocks – Step-by-Step Example

Example Scenario

Assume:

  • Transport Block size = 8448 bits

  • TB CRC length = 24 bits

  • LDPC base graph = BG1 (used for large TBs, high rates)

  • Target code rate ≈ 0.5

 

Step 1: Transport Block CRC Attachment

TB_total= 8448+24= 8472 

Step 2: Code Block Segmentation

LDPC has a maximum code block size (depends on base graph and lifting size).

Assume:

  • Maximum CB size ≈ 3840 bits

Then:

8472 -> 3 code blocks

CB ≈ 2816 bits each 

Each code block will carry:

  • A portion of the TB

  • An additional 24-bit CB CRC

 

Step 3: Code Block CRC Attachment

Each segmented block:

CB input= 2816+24= 2840 bits

 

Step 4: LDPC Encoding

Each CB is encoded using:

  • One of two base graphs (BG1 or BG2)

  • A selected lifting size (Z)

In 3GPP TS 38.212 (Channel Coding and Modulation):

  • Base Graph selection, in this example, since TBtotal (8472) > 3840, BG1 is selected

    • K_b = number of information columns in the base graph

    • BG1 → K_b = 22

    • BG2 → K_b = 10

    • For LDPC base graph 1, a matrix of HBG has 46 rows with row indices i = 0,1,2,...,45 and 68 columns with column indices j = 0,1,2,...,67 .

    • For LDPC base graph 2, a matrix of HBG has 42 rows with row indices i = 0,1,2,...,41and 52 columns with column indices j = 0,1,2,...,51 .

    • The elements in HBG with row and column indices given in Table 5.3.2-2 (for LDPC base graph 1) and Table 5.3.2-3 (for LDPC base graph 2) are of value 1, and all other elements in HBG are of value 0.

 

  • Lifting size (Z) selection, Allowed Z values → Table 5.3.2-1

These two choices together define the actual LDPC parity-check matrix used for encoding/decoding.

 

Lifting Size (Z) Selection (38.212 -5.3.2.2)

For BG1:

  • K_b = 22

  • LDPC input size = 22 × Z

  • We must select the smallest allowed Z such that:

  • 22 × Z ≥ 2840

Try Allowed Z Values (Table 5.3.2-1)

Z

22 × Z

Valid?

96

2112

No

128

2816

No (too small)

144

3168

Yes

160

3520

Yes

Choose the smallest valid for Z = 144

  

Step-5: Final LDPC Input Structure

Item

Value

Base Graph

BG1

Lifting size

Z = 144

LDPC input capacity

22 × 144 = 3168 bits

Actual CB size

2840 bits

Padding

3168 − 2840 = 328 filler bits

Padding bits are set to known values and ignored at decoding.

 

Step-6: LDPC Codeword Generation

For BG1, the full LDPC codeword length is:

N = (K_b + parity_columns) × Z

Conceptually:

[ 3168 systematic bits | parity bits ]

Parity bits are generated so that:

H × cᵀ = 0

 

The mother codeword is the full LDPC-encoded output before rate matching.

Mother codeword length = 68 × Z

Mother LDPC codeword length= 68 × 144 = 9792 bits

In practice:

  • Only a subset of parity columns is usable for a given RV

  • Systematic bits + selected parity bits ≈ 60–70% of the full codeword

For BG1:

9792 × 0.65 ≈ 6360 bits

 

 

Step-7: Rate Matching

  1. Collects bits from the mother codeword into a circular buffer

  2. Selects bits depending on:

    • Target code rate

    • Redundancy Version (RV)

    • Number of available REs

It uses:

  • Puncturing → skip bits (increase rate)

  • Repetition → reuse bits (lower rate)

  • Parity prioritization → systematic bits first

 

To hit the target code rate:

  • Bits are punctured

  • Some parity bits may be skipped

Example:

Mother codeword ≈ ~6300 bits

After rate matching → ~4500 bits transmitted is the PDSCH capacity for that code block

And same is mapped onto PDSCH REs.

It can be shown finally as below,

6. Turbo Coding Algorithm (LTE Reference)

Turbo codes are based on:

  • Two Recursive Systematic Convolutional (RSC) encoders

  • An internal interleaver

Turbo Encoding Steps (Simplified)

  1. Input data → Encoder 1 (systematic + parity 1)

  2. Interleaved data → Encoder 2 (parity 2)

  3. Output = systematic + parity bits

Example:

  • Input: 1000 bits

  • Output: ~3000 bits (rate ≈ 1/3)

Turbo Decoding

  • Iterative MAP decoding

  • Soft information exchanged between decoders

  • 6–12 iterations typically required

 

7. Why Turbo Coding Was Replaced by LDPC

Aspect

Turbo

LDPC

Parallel decoding

Poor

Excellent

Large TB efficiency

Moderate

Excellent

Latency predictability

Poor

Good

Power efficiency

Lower

Higher

HW scalability

Limited

High

5G bandwidth support

No

Yes

Turbo codes were optimized for LTE-era bandwidths and DSPs, not 5G’s parallel, cloud-native PHY.

 

8. Why LDPC Is Used for PDSCH/PUSCH but NOT Control Channels

This is a design-driven decision, not a limitation.

8.1 Control Channels Have Short Payloads

  • PDCCH, PBCH, PUCCH carry very small messages

  • LDPC performs poorly at very short block lengths

8.2 Control Channels Need Ultra-High Reliability

  • False DCI decoding can break the entire link

  • Short-block optimality matters more than throughput

8.3 Polar Codes Are Better for Control

Polar codes:

  • Are mathematically optimal for short blocks

  • Provide excellent reliability with CRC-aided list decoding

  • Have deterministic decoding latency

Hence:

Channel Type

Coding

Data (PDSCH / PUSCH)

LDPC

Control (PDCCH, PBCH, PUCCH)

Polar

Turbo codes were excellent for LTE, but 5G demanded massive parallelism, deterministic latency, and energy efficiency at very high data rates. LDPC codes naturally fit these requirements for large transport blocks, making them ideal for PDSCH and PUSCH. However, for short, latency-critical control messages, Polar codes outperform LDPC. 5G NR therefore uses the right code for the right job, instead of forcing a single coding scheme everywhere.

 

9. Conclusion

LDPC coding is one of the quiet enablers of 5G’s multi-Gbps performance. Without replacing Turbo codes, 5G NR would not scale beyond LTE-Advanced Pro.

 

10. References

1.       3GPP TS 38.212 version 15.2.0 Release 15

2.       3GPP TS 38.214 version 15.2.0 Release 15

 

bottom of page