-
Notifications
You must be signed in to change notification settings - Fork 334
Description
Creation of TBEncoder fails if provided target_tb_size close to maximum code block size.
Failing example:
import sionna
print(sionna.__version__)
from sionna.phy.nr import TBEncoder, TBDecoder
from sionna.phy.nr.utils import decode_mcs_index
# values within allowed range
target_tb_size=8424
mcs=18
mod_order, target_rate = \
decode_mcs_index(mcs_index=mcs, table_index=1, transform_precoding=True)
n = int(target_tb_size / target_rate)
n_aligned = (n + mod_order) - (n % mod_order)
encoder = TBEncoder(target_tb_size=target_tb_size, num_coded_bits=n_aligned, \
target_coderate=target_rate, num_bits_per_symbol=mod_order, \
verbose=True)
Output:
1.1.0
Modulation order: 6
Target coderate: 0.505
Effective coderate: 0.506
Number of layers: 1Info bits per TB: 8448
TB CRC length: 24
Total number of coded TB bits: 16686Info bits per CB: 8472
Number of CBs: 1
CB CRC length: 0
Output codeword lengths: [16686]
Note: actual tb_size=8448 is slightly different than requested target_tb_size=8424 due to quantization. Internal zero padding will be applied.
Traceback (most recent call last):
File "/var/tmp/qperrog/fecbench/fecbench/testengine/./sionna_tb_error.py", line 13, in
encoder = TBEncoder(target_tb_size=target_tb_size, num_coded_bits=n_aligned,
File "/var/tmp/qperrog/sionna_arm_env/lib/python3.10/site-packages/sionna/phy/nr/tb_encoder.py", line 237, in init
self._encoder = LDPC5GEncoder(self._cb_size,
File "/var/tmp/qperrog/sionna_arm_env/lib/python3.10/site-packages/sionna/phy/fec/ldpc/encoding.py", line 79, in init
raise ValueError("Unsupported code length (k too large).")
ValueError: Unsupported code length (k too large).
The TB encoder calculates a CB size of 8472 which is larger than allowed and fails in subsequent call to CB encoder.