Web Simulation 

 

 

 

 

3GPP NR Polar Coding Tutorial 

This interactive tutorial visualizes 3GPP NR Polar Coding (TS 38.212): the encoding pipeline from information bits to codeword via mother code selection, interleaving, sub-channel mapping, and the polar transform. The flow is: Information → Interleaved (c′) → U-vector (Frozen/Info) → Polar Transform → Codeword (d).

 

Mathematical foundation

1. Mother code size N

Given payload length K (information bits) and rate-matching length E, 3GPP selects the mother code size N = 2n (5 ≤ n ≤ 9). The rule uses n1 from E (and a threshold), n2 from K, and clamps to the allowed range. N is the length of the U-vector and the codeword before rate matching.

2. Interleaving (PIIL)

The block interleaver (Table 5.3.1.1-1, PIIL_MAX) shuffles the K information bits into the sequence c′. The mapping is defined by the 3GPP table: for each output position, a source index is chosen from the last K entries of the sequence. The interleaver visualization shows these "strings" from input to output.

3. Sub-channel mapping (Q0Nmax)

The reliability sequence Q0Nmax (Table 5.3.1.2-1) orders sub-channels by reliability. The K most reliable positions (last K in the reliability order for length N) are used for information bits; the rest are frozen (set to 0). The heatmap shows reliability (color) and selected indices (blue border). The Master Sequence Explorer shows the full 1024-element table; Step Fwd animates each bit from the table into the u-vector.

4. Polar transform (butterfly)

The U-vector u of length N (info bits in selected positions, frozen elsewhere) is multiplied by the polar kernel matrix GN = F⊗n, where F = [1 0; 1 1]. This is implemented as a butterfly network: at each stage, pairs of bits are combined with XOR: ujujuj+step. The diagram shows input nodes (blue = info, grey = frozen), XOR nodes, and output codeword d. The Math Inspector displays the active XOR equation for the current step.

1. Mother Code 2. Interleaving 3. Sub-channel Mapping 4. Polar Transform 5. Output
Mother Code (3GPP)
E (rate match)108
K (payload)40
N (mother)128 (2^7)
Code rate K/E
0.370
Info bit Frozen bit

Set K and E, then click Generate Random Bits & Run. Mother code size N is computed per 3GPP.

Sub-channel mapping: the K most reliable positions (from Q0Nmax) carry information; others are frozen (0). Think of it as a Physical Mailbox system: Rank (reliability order) tells you which mailbox is best; you place your Info bits into the K best mailboxes and fill the rest with 0. Step Fwd animates each bit "flying" from the reliability table into its physical u-vector slot.

3GPP Master Sequence Explorer (Q0,Nmax)
Scanning Master Table for indices < 128
Table has N rows (Rank 0 to N−1). Scroll down to see Info rows (last K rows).
Polar Transform Evolution
Stage 7 / 7
XOR 1 / 64

Use Stage ± to select the stage; XOR ± or Step Bwd/Fwd to show each XOR (⊕) within that stage. Run animates through the XORs.

 

Usage

Use this simulation to explore 3GPP NR Polar Coding (TS 38.212):

  1. K (information bits): Payload length (1–164). E (rate matching length): Output length after rate matching. Enter values and click Generate Random Bits & Run to compute mother code size N and run the full pipeline. The 3GPP master table (Q0Nmax) is validated (1024 unique indices) before running.
  2. Step Fwd / Step Bwd: Move through the five stages: Mother Code → Interleaving → Sub-channel Mapping → Polar Transform → Output. Click a step label to jump to that stage.
  3. Mother Code table: Shows E, K, and selected N (2n, 5 ≤ n ≤ 9). Code rate K/E: Displayed below; turns red if K/E > 1 (invalid for decoding).
  4. Reliability heatmap: Sub-channels ordered by Q0Nmax. Blue border = selected info positions; others are frozen. Hover a cell for index and rank.
  5. Interleaver (Stage 2): Bezier curves show how input bits (left) map to interleaved positions (right) per PIIL_MAX. Use Step Bwd/Fwd or Animate Interleave.
  6. Sub-channel Mapping (Stage 3): Master 3GPP Sequence Explorer ribbon shows the full Q0,Nmax table; highlight and scroll sync with the current rank. Step Fwd animates each bit from the table row into the u-vector slot; Step Bwd / Reset reverse or clear.
  7. Butterfly (Stage 4): U-vector input nodes (blue = info, grey = frozen), XOR nodes (orange), and codeword output (green). Use Stage ± and XOR ± or Step Bwd/Fwd to advance; Math Inspector shows the active XOR equation. Optional Show GN matrix toggles the kernel heatmap.
  8. Output (Stage 5): Codeword d ribbon.

Tips: Start with K=40, E=108 for N=128 and a readable butterfly. Pipeline: Information → Interleaved (c′) → U-vector (Frozen/Info) → Polar Transform → Codeword (d).

Parameters

  • K: Number of information bits (payload). Max 164 per 3GPP interleaver table.
  • E: Rate matching length (codeword length after puncturing/repetition). Used with K to select mother code size N.
  • N (mother code size): Computed as 2n (5 ≤ n ≤ 9) from 3GPP rules. Length of U-vector and codeword before rate matching.
  • Generate Random Bits & Run: Fills K random bits, computes N, interleaves, maps to sub-channels, applies polar transform, and updates all visualizations.