5G NR
This module provides blocks and functions to support simulations of5G NR compliant features, in particular, the physical uplink shared channel (PUSCH). It provides implementations of a subset of the physical layer functionalities as described in the 3GPP specifications[3GPP38211],[3GPP38212], and[3GPP38214].
The best way to discover this module’s components is by having a look at the5G NR PUSCH Tutorial.
The following code snippet shows how you can make standard-compliantsimulations of the 5G NR PUSCH with a few lines of code:
# Create a PUSCH configuration with default settingspusch_config=PUSCHConfig()# Instantiate a PUSCHTransmitter from the PUSCHConfigpusch_transmitter=PUSCHTransmitter(pusch_config)# Create a PUSCHReceiver using the PUSCHTransmitterpusch_receiver=PUSCHReceiver(pusch_transmitter)# AWGN channelchannel=AWGN()# Simulate transmissions over the AWGN channelbatch_size=16no=0.1# Noise variancex,b=pusch_transmitter(batch_size)# Generate transmit signal and info bitsy=channel(x,no)# Simulate channel outputb_hat=pusch_receiver(y,no)# Recover the info bits# Compute BERprint("BER:",compute_ber(b,b_hat).numpy())
ThePUSCHTransmitter andPUSCHReceiver provide high-level abstractions of all required processing blocks. You can easily modify them according to your needs.
Carrier
- classsionna.phy.nr.CarrierConfig(**kwargs)[source]
The CarrierConfig objects sets parameters for a specific OFDM numerology,as described in Section 4[3GPP38211].
All configurable properties can be provided as keyword arguments during theinitialization or changed later.
Example
>>>carrier_config=CarrierConfig(n_cell_id=41)>>>carrier_config.subcarrier_spacing=30
- propertycyclic_prefix
Get/set cyclic prefix length
The option “normal” corresponds to 14 OFDM symbols per slot, while“extended” corresponds to 12 OFDM symbols. The latter option isonly possible with asubcarrier_spacing of 60 kHz.
- Type:
“normal” (default) | “extended”
- propertycyclic_prefix_length
Cyclic prefix length\(N_{\text{CP},l}^{\mu} \cdot T_{\text{c}}\) [s]
- Type:
float
- propertyframe_duration
Duration of a frame\(T_\text{f}\) [s]
- Type:
float, (default 10e-3)
- propertyframe_number
Get/set system frame number\(n_\text{f}\)
- Type:
int, (default 0), [0,…,1023]
- propertykappa
The constant\(\kappa = T_\text{s}/T_\text{c}\)
- Type:
float, (default 64)
- propertymu
Subcarrierspacing configuration,\(\Delta f = 2^\mu 15\) kHz
- Type:
int, (default 0) | 1 | 2 | 3 | 4 | 5 | 6
- propertyn_cell_id
Physical layer cell identity\(N_\text{ID}^\text{cell}\)
- Type:
int, (default 1) | [0,…,1007]
- propertyn_size_grid
Get/set number of resource blocksin the carrier resource grid\(N^{\text{size},\mu}_{\text{grid},x}\)
- Type:
int, (default 4) | [1,…,275]
- propertyn_start_grid
Get/set start of resource gridrelative to common resource block (CRB) 0\(N^{\text{start},\mu}_{\text{grid},x}\)
- Type:
int, (default 0) | [0,…,2199]
- propertynum_slots_per_frame
Numberof slots per frame\(N_\text{slot}^{\text{frame},\mu}\)
Depends on thesubcarrier_spacing.
- Type:
int, (default 10) | 20 | 40 | 80 | 160 | 320 | 640
- propertynum_slots_per_subframe
Number ofslots per subframe\(N_\text{slot}^{\text{subframe},\mu}\)
Depends on thesubcarrier_spacing.
- Type:
int, (default 1) | 2 | 4 | 8 | 16 | 32 | 64
- propertynum_symbols_per_slot
Number of OFDM symbols per slot\(N_\text{symb}^\text{slot}\)
Configured through thecyclic_prefix.
- Type:
int, (default 14) | 12
- propertyslot_number
Get/set slot numberwithin a frame\(n^\mu_{s,f}\)
- Type:
int, (default 0), [0,…,num_slots_per_frame]
- propertysub_frame_duration
Duration of a subframe\(T_\text{sf}\) [s]
- Type:
float, (default 1e-3), read-only
- propertysubcarrier_spacing
Get/setsubcarrier spacing\(\Delta f\) [kHz]
- Type:
float, (default 15) | 30 | 60 | 120 | 240 | 480 | 960
- propertyt_c
Sampling time\(T_\text{c}\) [s] forsubcarrier spacing 480kHz
- Type:
float, (default 0.509e-9)
- propertyt_s
Sampling time\(T_\text{s}\) [s] forsubcarrier spacing 15kHz
- Type:
float, (default 32.552e-9)
Layer Mapping
- classsionna.phy.nr.LayerMapper(num_layers=1,verbose=False,precision=None,**kwargs)[source]
Performs MIMO layer mapping of modulated symbols to layers as defined in[3GPP38211].
The LayerMapper supports PUSCH and PDSCH channels and follows the procedureas defined in Sec. 6.3.1.3 and Sec. 7.3.1.3 in[3GPP38211], respectively.
As specified in Tab. 7.3.1.3.-1[3GPP38211], the LayerMapper expects twoinput streams for multiplexing if more than 4 layers are active (onlyrelevant for PDSCH).
- Parameters:
num_layers (int, (default 1) | [1,…,8]) – Number of MIMO layers. If
num_layers>=4, a list of two inputs is expected.verbose (bool, (default False)) – If True, additional parameters are printed.
precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,
precisionis used.
- Input:
inputs ([…,n], or [[…,n1], […,n2]],tf.complex) – Sequence of symbols to be mapped. If
num_layers>=4, a list of two inputs is expected andn1/n2must be chosen as defined in Tab. 7.3.1.3.-1[3GPP38211].- Output:
[…,num_layers, n/num_layers], tf.complex – Sequence of symbols mapped to the MIMO layers
- propertynum_codewords
Number of input codewords for layer mapping.Can be either 1 or 2.
- Type:
int
- propertynum_layers
Number of MIMO layers
- Type:
int
- propertynum_layers0
Number of layers for first codeword (only relevant fornum_codewords =2)
- Type:
int
- propertynum_layers1
Number of layers for second codeword (only relevant fornum_codewords =2)
- Type:
int
- classsionna.phy.nr.LayerDemapper(layer_mapper,num_bits_per_symbol=1,precision=None,**kwargs)[source]
Demaps MIMO layers to coded transport block(s) by following Sec. 6.3.1.3and Sec. 7.3.1.3 in[3GPP38211].
This block must be associated to a
LayerMapperandperforms the inverse operation.It is assumed that
num_bits_per_symbolconsecutive LLRs belong toa single symbol position. This allows to apply the LayerDemapper afterdemapping symbols to LLR values.If the layer mapper is configured for dual codeword transmission, a list ofboth transport block streams is returned.
- Parameters:
layer_mapper (
LayerMapper) – Associated LayerMappernum_bits_per_symbol (int, (default 1)) – Modulation order. Defines how many consecutive LLRs are associatedto the same symbol position.
precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,
precisionis used.
- Input:
inputs ([…,num_layers, n/num_layers],tf.float) – MIMO layer data sequences
- Output:
[…,n], or [[…,n1], […,n2]],tf.float – Sequence of bits after layer demapping.If
num_codewords=2, a list of two transport blocks is returned.
Note
As it is more convenient to apply the layer demapper after demappingsymbols to LLRs, this block groups the input sequence into groups of
num_bits_per_symbolLLRs before restoring the original symbol sequence.This behavior can be deactivated by settingnum_bits_per_symbol=1.
PUSCH
- classsionna.phy.nr.PUSCHConfig(carrier_config=None,pusch_dmrs_config=None,tb_config=None,**kwargs)[source]
The PUSCHConfig objects sets parameters for a physical uplink sharedchannel (PUSCH), as described in Sections 6.3 and 6.4[3GPP38211].
All configurable properties can be provided as keyword arguments during theinitialization or changed later.
- Parameters:
carrier_config (
CarrierConfig|None) – IfNone, aCarrierConfiginstancewith default settings will be created.pusch_dmrs_config (
PUSCHDMRSConfig|None) – IfNone, aPUSCHDMRSConfiginstancewith default settings will be created.
Example
>>>pusch_config=PUSCHConfig(mapping_type="B")>>>pusch_config.dmrs.config_type=2>>>pusch_config.carrier.subcarrier_spacing=30
- c_init(l)[source]
Compute RNG initialization\(c_\text{init}\) as in Section 6.4.1.1.1.1[3GPP38211]
- Input:
l (int) – OFDM symbol index relative to a reference\(l\)
- Output:
c_init (int) – RNG initialization value
- propertycarrier
Carrier configuration
- Type:
- propertydmrs
PUSCH DMRSconfiguration
- Type:
- propertydmrs_grid
Emptyresource grid for each DMRS port, filled with DMRS signals
This property returns for each configured DMRS port an emptyresource grid filled with DMRS signals as defined inSection 6.4.1.1 [3GPP38211]. Not all possible options are implemented,e.g., frequency hopping and transform precoding are not available.
This property provides theunprecoded DMRS for each configured DMRS port.Precoding might be applied to map the DMRS to the antenna ports. However,in this case, the number of DMRS ports cannot be larger than the number oflayers.
- Type:
complex, [num_dmrs_ports, num_subcarriers, num_symbols_per_slot], read-only
- propertydmrs_mask
Maskedresource elements in the resource grid.True corresponds toresource elements on which no data is transmitted.
- Type:
bool, [num_subcarriers, num_symbols_per_slot], read-only
- propertydmrs_symbol_indices
Indices of DMRS symbols within a slot
- Type:
list,int, read-only
- propertyfrequency_hopping
Frequency hopping configuration
- Type:
str, “neither” (default), read-only
- propertyl_bar
List of possible values of\(\bar{l}\) used for DMRS generation
Defined in Tables 6.4.1.1.3-3 and 6.4.1.1.3-4[3GPP38211].
- Type:
list, elements in [0,…,11], read-only
- propertymapping_type
Mapping type
- Type:
str, “A” (default) | “B”
- propertyn_rnti
Radio network temporary identifier\(n_\text{RNTI}\)
- Type:
int, 1 (default), [0,…,65535]
- propertyn_size_bwp
Number of resource blocks inthe bandwidth part (BWP)\(N^{\text{size},\mu}_{\text{BWP},i}\)
If set toNone, the property
n_size_gridofcarrier will be used.- Type:
int,None (default) | [1,…,275]
- propertyn_start_bwp
Start of BWP relative tocommon resource block (CRB) 0\(N^{\text{start},\mu}_{\text{BWP},i}\)
- Type:
int, 0 (default) | [0,…,2199]
- propertynum_antenna_ports
Number of antenna ports
Must be larger than or equal to
num_layers.- Type:
int, 1 (default) | 2 | 4
- propertynum_coded_bits
Number of coded bits that fit into one PUSCH slot.
- Type:
int, read-only
- propertynum_layers
Number of transmission layers\(\nu\)
Must be smaller than or equal to
num_antenna_ports.- Type:
int, 1 (default) | 2 | 3 | 4
- propertynum_ov
Number of unused resource elementsdue to additional overhead as specified by higher layer.
- Type:
int, 0 (default), read-only
- propertynum_res_per_prb
Number of resource elements per PRBavailable for data
- Type:
int, read-only
- propertynum_resource_blocks
Number of allocated resource blocks for thePUSCH transmissions.
- Type:
int, read-only
- propertynum_subcarriers
Number of allocated subcarriers for thePUSCH transmissions
- Type:
int, read-only
- propertyprecoding
PUSCHtransmission scheme
- Type:
str, “non-codebook” (default), “codebook”
- propertyprecoding_matrix
Precoding matrix\(\mathbf{W}\) as defined inTables 6.3.1.5-1 to 6.3.1.5-7[3GPP38211].
Only relevant if
precodingis “codebook”.- Type:
nd_array,complex, [num_antenna_ports, numLayers]
- propertysymbol_allocation
PUSCH symbol allocation
The first elements denotes the start of the symbol allocation.The second denotes the positive number of allocated OFDM symbols.Formapping_type “A”, the first element must be zero.Formapping_type “B”, the first element must be in[0,…,13]. The second element must be such that the indexof the last allocated OFDM symbol is not larger than 13(for “normal” cyclic prefix) or 11 (for “extended” cyclic prefix).
- Type:
2-tuple,int, [0, 14] (default)
- propertytb_size
Transport block size, i.e., how many informationbits can be encoded into a slot for the given slot configuration
- Type:
int, read-only
- propertytpmi
Transmit precoding matrix indicator
The allowed value depends on the number of layers andthe number of antenna ports according to Table 6.3.1.5-1until Table 6.3.1.5-7[3GPP38211].
- Type:
int, 0 (default) | [0,…,27]
- propertytransform_precoding
Use transform precoding
- Type:
bool,False (default)
- classsionna.phy.nr.PUSCHDMRSConfig(**kwargs)[source]
The PUSCHDMRSConfig objects sets parameters related to the generationof demodulation reference signals (DMRS) for a physical uplink sharedchannel (PUSCH), as described in Section 6.4.1.1[3GPP38211].
All configurable properties can be provided as keyword arguments during theinitialization or changed later.
Example
>>>dmrs_config=PUSCHDMRSConfig(config_type=2)>>>dmrs_config.additional_position=1
- propertyadditional_position
Maximum number of additionalDMRS positions
The actual number of used DMRS positions depends onthe length of the PUSCH symbol allocation.
- Type:
int, 0 (default) | 1 | 2 | 3
- propertyallowed_dmrs_ports
List of nominalantenna ports
The maximum number of allowed antenna portsmax_num_dmrs_portsdepends on the DMRSconfig_type andlength. It can beequal to 4, 6, 8, or 12.
- Type:
list, [0,…,max_num_dmrs_ports-1], read-only
- propertybeta
Ratio of PUSCH energy per resource element(EPRE) to DMRS EPRE\(\beta^{\text{DMRS}}_\text{PUSCH}\)Table 6.2.2-1[3GPP38214]
- Type:
float, read-only
- propertycdm_groups
List of CDM groups\(\lambda\) for all portsin thedmrs_port_set as defined inTable 6.4.1.1.3-1 or 6.4.1.1.3-2[3GPP38211]
Depends on theconfig_type.
- Type:
list, elements in [0,1,2], read-only
- propertyconfig_type
DMRS configuration type
The configuration type determines the frequency density ofDMRS signals. With configuration type 1, six subcarriers per PRB areused for each antenna port, with configuration type 2, foursubcarriers are used.
- Type:
int, 1 (default) | 2
- propertydeltas
List of delta (frequency)shifts\(\Delta\) for all ports in theport_set as defined inTable 6.4.1.1.3-1 or 6.4.1.1.3-2[3GPP38211]
Depends on theconfig_type.
- Type:
list, elements in [0,1,2,4], read-only
- propertydmrs_port_set
List of used DMRS antenna ports
The elements in this list must all be from the list ofallowed_dmrs_ports which depends on theconfig_type as well asthelength. If set to[], the port set will be equal to[0,…,num_layers-1], where
num_layersis a property of theparentPUSCHConfiginstance.- Type:
list, [] (default) | [0,…,11]
- propertylength
Number of front-loaded DMRS symbolsA value of 1 corresponds to “single-symbol” DMRS, a valueof 2 corresponds to “double-symbol” DMRS.
- Type:
int, 1 (default) | 2
- propertyn_id
Scramblingidentities
Defines the scrambling identities\(N_\text{ID}^0\) and\(N_\text{ID}^1\) as a 2-tuple of integers. IfNone,the property
n_cell_idof theCarrierConfigis used.- Type:
2-tuple,None (default), [[0,…,65535], [0,…,65535]]
- propertyn_scid
DMRS scrambling initialization\(n_\text{SCID}\)
- Type:
int, 0 (default) | 1
- propertynum_cdm_groups_without_data
Number of CDM groups without data
This parameter controls how many REs are available for datatransmission in a DMRS symbol. It should be greater or equal tothe maximum configured number of CDM groups. A value of1 corresponds to CDM group 0, a value of 2 corresponds toCDM groups 0 and 1, and a value of 3 corresponds toCDM groups 0, 1, and 2.
- Type:
int, 2 (default) | 1 | 3
- propertytype_a_position
Position of first DMRS OFDM symbol
Defines the position of the first DMRS symbol within a slot.This parameter only applies if the property
mapping_typeofPUSCHConfigis equal to “A”.- Type:
int, 2 (default) | 3
- propertyw_f
Frequency weight vectors\(w_f(k')\) for all ports in the port set as defined inTable 6.4.1.1.3-1 or 6.4.1.1.3-2[3GPP38211]
- Type:
matrix, elements in [-1,1], read-only
- propertyw_t
Time weight vectors\(w_t(l')\) for all ports in the port set as defined inTable 6.4.1.1.3-1 or 6.4.1.1.3-2[3GPP38211]
- Type:
matrix, elements in [-1,1], read-only
- classsionna.phy.nr.PUSCHLSChannelEstimator(resource_grid,dmrs_length,dmrs_additional_position,num_cdm_groups_without_data,interpolation_type='nn',interpolator=None,precision=None,**kwargs)[source]
Block implementing least-squares (LS) channel estimation for NR PUSCH Transmissions
After LS channel estimation at the pilot positions, the channel estimatesand error variances are interpolated accross the entire resource grid usinga specified interpolation function.
The implementation is similar to that of
LSChannelEstimator.However, it additional takes into account the separation of streams in the same CDM groupas defined inPUSCHDMRSConfig. This is done throughfrequency and time averaging of adjacent LS channel estimates.- Parameters:
resource_grid (
ResourceGrid) – ResourceGrid to be useddmrs_length (int, 1 | 2) – Length of DMRS symbols. See
PUSCHDMRSConfig.dmrs_additional_position (int, 0 | 1 | 2 | 3) – Number of additional DMRS symbols.See
PUSCHDMRSConfig.num_cdm_groups_without_data (int, 1 | 2 | 3) – Number of CDM groups masked for data transmissions.See
PUSCHDMRSConfig.interpolation_type ("nn" (default)|"lin" |"lin_time_avg") – The interpolation method to be used.It is ignored if
interpolatoris notNone.Available options areNearestNeighborInterpolator(“nn”)orLinearInterpolatorwithout (“lin”) or withaveraging across OFDM symbols (“lin_time_avg”).interpolator (None (default) |
BaseChannelInterpolator) – Interpolator such asLMMSEInterpolator,orNone. In the latter case, the interpolator specifiedbyinterpolation_typeis used.Otherwise, theinterpolatoris used andinterpolation_typeis ignored.precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,
precisionis used.
- Input:
y ([batch_size, num_rx, num_rx_ant, num_ofdm_symbols,fft_size],tf.complex) – Observed resource grid
no ([batch_size, num_rx, num_rx_ant] or only the first n>=0 dims,tf.float) – Variance of the AWGN
- Output:
h_ls ([batch_size, num_rx, num_rx_ant, num_tx, num_streams_per_tx, num_ofdm_symbols,fft_size],tf.complex) – Channel estimates across the entire resource grid for alltransmitters and streams
err_var (Same shape as
h_ls,tf.float) – Channel estimation error variance across the entire resource gridfor all transmitters and streams
- classsionna.phy.nr.PUSCHPilotPattern(pusch_configs,precision=None)[source]
Class defining a pilot pattern for NR PUSCH
This class defines a
PilotPatternthat is used to configure an OFDMResourceGrid.For every transmitter, a separte
PUSCHConfigneeds to be provided from which the pilot pattern will be created.- Parameters:
pusch_configs (instance or list of
PUSCHConfig) – PUSCH Configurations according to which the pilot patternwill created. One configuration is needed for each transmitter.precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,
precisionis used.
- propertycdtype
Type for complex floating point numbers
- Type:
tf.complex
- propertymask
Mask of the pilot pattern
- Type:
[num_tx, num_streams_per_tx, num_ofdm_symbols, num_effective_subcarriers],bool
- propertynormalize
Get/set if the pilots are normalized or not
- Type:
bool
- propertynum_data_symbols
Number of data symbols per transmit stream
- Type:
int
- propertynum_effective_subcarriers
Number of effectvie subcarriers
- Type:
int
- propertynum_ofdm_symbols
Number of OFDM symbols
- Type:
int
- propertynum_pilot_symbols
Number of pilot symbols per transmit stream
- Type:
int
- propertynum_streams_per_tx
Number of streams per transmitter
- Type:
int
- propertynum_tx
Number of transmitters
- Type:
int
- propertypilots
Get/set thepossibly normalized tensor of pilot symbols. If pilots arenormalized, the normalization will be applied after new valuesfor pilots have been set. If this is not the desired behavior,turn normalization off.
- Type:
[num_tx, num_streams_per_tx, num_pilots],tf.complex
- propertyprecision
Precision used for all compuations
- Type:
str, “single” | “double”
- propertyrdtype
Type for real floating point numbers
- Type:
tf.float
- show(tx_ind=None,stream_ind=None,show_pilot_ind=False)
Visualizes the pilot patterns for some transmitters and streams.
- Input:
tx_ind (None (default) |int`| `list,int) – Indicates the indices of transmitters to be included.IfNone, all transmitters included.
stream_ind (None (default) |int`| `list,int) – Indicates the indices of streams to be included.IfNone, all streams included.
show_pilot_ind (bool, (defaultFalse)) – Indicates if the indices of the pilot symbols should be shown
- Output:
list (matplotlib.figure.Figure) – List of matplot figure objects showing each the pilot patternfrom a specific transmitter and stream
- classsionna.phy.nr.PUSCHPrecoder(precoding_matrices,precision=None,**kwargs)[source]
Precodes a batch of modulated symbols mapped onto a resource gridfor PUSCH transmissions.
Each transmitter is assumed to have itsown precoding matrix.
- Parameters:
precoding_matrices (list, [num_tx, num_antenna_ports, num_layers].tf.complex) – List of precoding matrices, one for each transmitter.All precoding matrices must have the same shape.
precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,
precisionis used.
- Input:
[batch_size, num_tx, num_layers, num_symbols_per_slot,num_subcarriers],tf.complex – Batch of resource grids to be precoded
- Output:
[batch_size, num_tx, num_antenna_ports, num_symbols_per_slot, num_subcarriers],tf.complex – Batch of precoded resource grids
- classsionna.phy.nr.PUSCHReceiver(pusch_transmitter,channel_estimator=None,mimo_detector=None,tb_decoder=None,return_tb_crc_status=False,stream_management=None,input_domain='freq',l_min=None,precision=None,**kwargs)[source]
This block implements a full receiver for batches of 5G NR PUSCH slots sentby multiple transmitters. Inputs can be in the time or frequency domain.Perfect channel state information can be optionally provided.Different channel estimatiors, MIMO detectors, and transport decoderscan be configured.
The block combines multiple processing blocks into a single blockas shown in the following figure. Blocks with dashed lines areoptional and depend on the configuration.

If the
input_domainequals “time”, the inputs\(\mathbf{y}\) are firsttransformed to resource grids with theOFDMDemodulator.Then channel estimation is performed, e.g., with the help of thePUSCHLSChannelEstimator. Ifchannel_estimatoris chosen to be “perfect”, this step is skipped and the input\(\mathbf{h}\)is used instead.Next, MIMO detection is carried out with an arbitraryOFDMDetector.The resulting LLRs for each layer are then combined to transport blockswith the help of theLayerDemapper.Finally, the transport blocks are decoded with theTBDecoder.- Parameters:
pusch_transmitter (
PUSCHTransmitter) – Transmitter used for the generation of the transmit signalschannel_estimator (None (default) |
BaseChannelEstimator| “perfect”) – Channel estimator to be used.IfNone, thePUSCHLSChannelEstimatorwithlinear interpolation is used.If “perfect”, no channel estimation is performed and the channel state informationhmust be provided as additional input.mimo_detector (None (default) |
OFDMDetector) – MIMO Detector to be used.IfNone, theLinearDetectorwithLMMSE detection is used.tb_decoder (None (default) |
TBDecoder) – Transport block decoder to be used.IfNone, theTBDecoderwith itsdefault settings is used.return_tb_crc_status (bool, (defaultFalse)) – IfTrue, the status of the transport block CRC is returnedas additional output.
stream_management (None (default) |
StreamManagement) – Stream management configuration to be used.IfNone, it is assumed that there is a single receiverwhich decodes all streams of all transmitters.input_domain ("freq" (default)|"time") – Domain of the input signal.Defaults to “freq”
l_min (None (default) |int) – Smallest time-lag for the discrete complex baseband channel.Only needed if
input_domainequals “time”.precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,
precisionis used.
- Input:
y ([batch size, num_rx, num_rx_ant, num_ofdm_symbols, fft_size],tf.complex, or [batch size, num_rx, num_rx_ant, num_time_samples + l_max - l_min],tf.complex) – Frequency- or time-domain input signal
no ([batch_size, num_rx, num_rx_ant] or only the first n>=0 dims,tf.float) – Variance of the AWGN
h ([batch size, num_rx, num_rx_ant, num_tx, num_tx_ant, num_ofdm_symbols, num_subcarriers],tf.complex, or [batch size, num_rx, num_rx_ant, num_tx, num_tx_ant, num_time_samples + l_max - l_min, l_max - l_min + 1],tf.complex) – Perfect channel state information in either frequency or time domain(depending on
input_domain) to be used for detection.Only required ifchannel_estimatorequals “perfect”.
- Output:
b_hat ([batch_size, num_tx, tb_size],tf.float) – Decoded information bits
tb_crc_status ([batch_size, num_tx],tf.bool) – Transport block CRC status
Example
>>>pusch_config=PUSCHConfig()>>>pusch_transmitter=PUSCHTransmitter(pusch_config)>>>pusch_receiver=PUSCHReceiver(pusch_transmitter)>>>channel=AWGN()>>>x,b=pusch_transmitter(16)>>>no=0.1>>>y=channel([x,no])>>>b_hat=pusch_receiver([x,no])>>>compute_ber(b,b_hat)<tf.Tensor: shape=(), dtype=float64, numpy=0.0>
- propertyresource_grid
OFDM resource grid underlying the PUSCH transmissions
- classsionna.phy.nr.PUSCHTransmitter(pusch_configs,return_bits=True,output_domain='freq',precision=None,verbose=False,**kwargs)[source]
This block generates batches of 5G NR PUSCH slots for multiple transmitterswith random or provided payloads. Frequency- or time-domain outputs can be generated.
It combines multiple processing blocks into a single layeras shown in the following figure. Blocks with dashed lines areoptional and depend on the configuration.

Information bits\(\mathbf{b}\) that are either randomly generated orprovided as input are encoded into a transport block by the
TBEncoder.The encoded bits are then mapped to QAM constellation symbols by theMapper.TheLayerMappersplits the modulated symbols into different layerswhich are then mapped onto OFDM resource grids by theResourceGridMapper.If precoding is enabled in thePUSCHConfig, the resource gridsare further precoded so that there is one for each transmitter and antenna port.Ifoutput_domainequals “freq”, these are the outputs\(\mathbf{x}\).Ifoutput_domainis chosen to be “time”, the resource grids are transformed intotime-domain signals by theOFDMModulator.- Parameters:
pusch_configs (instance orlist of
PUSCHConfig) – PUSCH Configurations according to which the resource grid and pilot patternwill created. One configuration is needed for each transmitter.return_bits (bool, (defaultTrue)) – If set toTrue, the block generates random information bitsto be transmitted and returns them together with the transmit signal.
output_domain ("freq" (default)|"time") – Domain of the output
precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,
precisionis used.verbose (bool, (defaultFalse)) – IfTrue, additional parameters are printed during initialization.
- Input:
One of
batch_size (int) – Batch size of random transmit signals to be generated,if
return_bitsisTrue.b ([batch_size, num_tx, tb_size],tf.float) – Information bits to be transmitted,if
return_bitsisFalse.
- Output:
x ([batch size, num_tx, num_tx_ant, num_ofdm_symbols, fft_size],tf.complex, or [batch size, num_tx, num_tx_ant, num_time_samples],tf.complex) – Transmit signal in either frequency or time domain, depending on
output_domain.b ([batch_size, num_tx, tb_size],tf.float) – Transmitted information bits.Only returned if
return_bitsisTrue.
Example
>>>pusch_config=PUSCHConfig()>>>pusch_transmitter=PUSCHTransmitter(pusch_config)>>>x,b=pusch_transmitter(16)>>>print("Shape of x:",x.shape)Shape of x: (16, 1, 1, 14, 48)>>>print("Shape of b:",b.shape)Shape of b: (16, 1, 1352)
- propertypilot_pattern
Aggregate pilot pattern of all transmitters
- propertyresource_grid
OFDM resource grid underlying the PUSCH transmissions
Transport Block
- classsionna.phy.nr.TBConfig(**kwargs)[source]
The TBConfig objects sets parameters related to the transport blockencoding, as described in TS 38.214[3GPP38214].
All configurable properties can be provided as keyword arguments during theinitialization or changed later.
The TBConfig is configured by selecting the modulation and coding scheme(MCS) tables and index.
Example
>>>tb_config=TBConfig(mcs_index=13)>>>tb_config.mcs_table=3>>>tb_config.channel_type="PUSCH">>>tb_config.show()
The following tables provide an overview of the corresponding coderates andmodulation orders.
Table 1MCS Index Table 1 (Table 5.1.3.1-1 in[3GPP38214]) MCS Index\(I_{MCS}\)Modulation Order\(Q_m\)Target Coderate\(R\times[1024]\)Spectral Efficiency0
2
120
0.2344
1
2
157
0.3066
2
2
193
0.3770
3
2
251
0.4902
4
2
308
0.6016
5
2
379
0.7402
6
2
449
0.8770
7
2
526
1.0273
8
2
602
1.1758
9
2
679
1.3262
10
4
340
1.3281
11
4
378
1.4766
12
4
434
1.6953
13
4
490
1.9141
14
4
553
2.1602
15
4
616
2.4063
16
4
658
2.5703
17
6
438
2.5664
18
6
466
2.7305
19
6
517
3.0293
20
6
567
3.3223
21
6
616
3.6094
22
6
666
3.9023
23
6
719
4.2129
24
6
772
4.5234
25
6
822
4.8164
26
6
873
5.1152
27
6
910
5.3320
28
6
948
5.5547
Table 2MCS Index Table 2 (Table 5.1.3.1-2 in[3GPP38214]) MCS Index\(I_{MCS}\)Modulation Order\(Q_m\)Target Coderate\(R\times[1024]\)Spectral Efficiency0
2
120
0.2344
1
2
193
0.3770
2
2
308
0.6016
3
2
449
0.8770
4
2
602
1.1758
5
4
378
1.4766
6
4
434
1.6953
7
4
490
1.9141
8
4
553
2.1602
9
4
616
2.4063
10
4
658
2.5703
11
6
466
2.7305
12
6
517
3.0293
13
6
567
3.3223
14
6
616
3.6094
15
6
666
3.9023
16
6
719
4.2129
17
6
772
4.5234
18
6
822
4.8164
19
6
873
5.1152
20
8
682.5
5.3320
21
8
711
5.5547
22
8
754
5.8906
23
8
797
6.2266
24
8
841
6.5703
25
8
885
6.9141
26
8
916.5
7.1602
27
8
948
7.4063
Table 3MCS Index Table 3 (Table 5.1.3.1-3 in[3GPP38214]) MCS Index\(I_{MCS}\)Modulation Order\(Q_m\)Target Coderate\(R\times[1024]\)Spectral Efficiency0
2
30
0.0586
1
2
40
0.0781
2
2
50
0.0977
3
2
64
0.1250
4
2
78
0.1523
5
2
99
0.1934
6
2
120
0.2344
7
2
157
0.3066
8
2
193
0.3770
9
2
251
0.4902
10
2
308
0.6016
11
2
379
0.7402
12
2
449
0.8770
13
2
526
1.0273
14
2
602
1.1758
15
4
340
1.3281
16
4
378
1.4766
17
4
434
1.6953
18
4
490
1.9141
19
4
553
2.1602
20
4
616
2.4063
21
6
438
2.5564
22
6
466
2.7305
23
6
517
3.0293
24
6
567
3.3223
25
6
616
3.6094
26
6
666
3.9023
27
6
719
4.2129
28
6
772
4.5234
Table 4MCS Index Table 4 (Table 5.1.3.1-4 in[3GPP38214]) MCS Index\(I_{MCS}\)Modulation Order\(Q_m\)Target Coderate\(R\times[1024]\)Spectral Efficiency0
2
120
0.2344
1
2
193
0.3770
2
2
449
0.8770
3
4
378
1.4766
4
4
490
1.9141
5
4
616
2.4063
6
6
466
2.7305
7
6
517
3.0293
8
6
567
3.3223
9
6
616
3.6094
10
6
666
3.9023
11
6
719
4.2129
12
6
772
4.5234
13
6
822
4.8154
14
6
873
5.1152
15
8
682.5
5.3320
16
8
711
5.5547
17
8
754
5.8906
18
8
797
6.2266
19
8
841
6.5703
20
8
885
6.9141
21
8
916.5
7.1602
22
8
948
7.4063
23
10
805.5
7.8662
24
10
853
8.3301
25
10
900.5
8.7939
26
10
948
9.2578
- propertychannel_type
5G NR physical channel type. Valid choices are “PDSCH” and “PUSCH”.
- propertymcs_index
Modulation and coding scheme (MCS) index (denoted as\(I_{MCS}\)in[3GPP38214])
- propertymcs_table
Indicates which MCS table from[3GPP38214] to use. Starts with “1”.
- propertyn_id
Data scrambling initialization\(n_\text{ID}\). Data Scrambling ID related to cell id andprovided by higher layer. IfNone, the
PUSCHConfigwill automatically set\(n_\text{ID}=N_\text{ID}^{cell}\).- Type:
int, None (default), [0, 1023]
- propertynum_bits_per_symbol
Modulation order as defined by the selected MCS
- Type:
int, read-only
- propertytarget_coderate
Target coderate of the TB as defined by the selectedMCS
- Type:
float, read-only
- propertytb_scaling
TB scaling factor for PDSCH asdefined in[3GPP38214] Tab. 5.1.3.2-2
- Type:
float, 1. (default), read-only
- classsionna.phy.nr.TBEncoder(target_tb_size,num_coded_bits,target_coderate,num_bits_per_symbol,num_layers=1,n_rnti=1,n_id=1,channel_type='PUSCH',codeword_index=0,use_scrambler=True,verbose=False,precision=None,**kwargs)[source]
5G NR transport block (TB) encoder as defined in TS 38.214[3GPP38214] and TS 38.211[3GPP38211]
The transport block (TB) encoder takes as input atransport block ofinformation bits and generates a sequence of codewords for transmission.For this, the information bit sequence is segmented into multiple codewords,protected by additional CRC checks and FEC encoded. Further, interleavingand scrambling is applied before a codeword concatenation generates thefinal bit sequence. Fig. 1 provides an overview of the TB encodingprocedure and we refer the interested reader to[3GPP38214] and[3GPP38211] for further details.

Fig. 15Fig. 1: Overview TB encoding (CB CRC does not always apply).
If
n_rntiandn_idare given as list, the TBEncoder encodesnum_tx = len(n_rnti) parallel input streams with differentscrambling sequences per user.- Parameters:
target_tb_size (int) – Target transport block size, i.e., how many information bits areencoded into the TB. Note that the effective TB size can beslightly different due to quantization. If required, zero paddingis internally applied.
num_coded_bits (int) – Number of coded bits after TB encoding
target_coderate (float) – Target coderate
num_bits_per_symbol (int) – Modulation order, i.e., number of bits per QAM symbol
num_layers (1 (default)|[1,...,8]) – Number of transmission layers
n_rnti (int orlist ofint, 1 (default) | [0,…,65335]) – RNTI identifier provided by higher layer. Defaults to 1 and must bein range[0, 65335]. Defines a part of the random seed of thescrambler. If provided as list, every list entry defines the RNTIof an independent input stream.
n_id (int orlist ofint, 1 (default) | [0,…,1023]) – Data scrambling ID\(n_\text{ID}\) related to cell id andprovided by higher layer.Defaults to 1 and must be in range[0, 1023]. If provided aslist, every list entry defines the scrambling id of an independentinput stream.
channel_type ("PUSCH" (default)|"PDSCH") – Can be either “PUSCH” or “PDSCH”.
codeword_index (0 (default)|1) – Scrambler can be configured for two codeword transmission.
codeword_indexcan be either 0 or 1. Must be 0 forchannel_type= “PUSCH”.use_scrambler (bool, (defaultTrue)) – If False, no data scrambling is applied (non standard-compliant).
verbose (bool, (defaultFalse)) – IfTrue, additional parameters are printed during initialization.
precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,
precisionis used.
- Input:
inputs ([…,target_tb_size] or […,num_tx,target_tb_size], tf.float) – 2+D tensor containing the information bits to be encoded. If
n_rntiandn_idare a list of sizenum_tx, the input mustbe of shape[…,num_tx,target_tb_size].- Output:
[…,num_coded_bits], tf.float – 2+D tensor containing the sequence of the encoded codeword bits ofthe transport block.
Note
The parameters
tb_sizeandnum_coded_bitscan be derived by thecalculate_tb_size()function orby accessing the correspondingPUSCHConfigattributes.- propertycb_crc_encoder
CB CRC encoder.None if no CB CRC is applied.
- propertycoderate
Effective coderate of the TB after rate-matching includingoverhead for the CRC
- Type:
float
- propertycw_lengths
Each list element defines the codeword length of each of thecodewords after LDPC encoding and rate-matching. The total number ofcoded bits is\(\sum\)cw_lengths.
- propertyk
Number of input information bits.Equalstb_size except for zero padding of the last positions if the
target_tb_sizeis quantized.- Type:
int
- propertyk_padding
Number of zero padded bits at the end of the TB
- Type:
int
- propertyldpc_encoder
LDPC encoder used for TB encoding
- propertyn
Total number of output bits
- Type:
int
- propertynum_cbs
Number code blocks
- Type:
int
- propertynum_tx
Number of independent streams
- Type:
int
- propertyoutput_perm_inv
Inverse interleaver pattern for output bit interleaver.
- propertyscrambler
Scrambler used for TB scrambling.None if no scrambler is used.
- propertytb_crc_encoder
TB CRC encoder
- propertytb_size
Effective number of information bits per TB.Note that (if required) internal zero padding can beapplied to match the request exact
target_tb_size.- Type:
int
- classsionna.phy.nr.TBDecoder(encoder,num_bp_iter=20,cn_type='boxplus-phi',precision=None,**kwargs)[source]
5G NR transport block (TB) decoder as defined in TS 38.214[3GPP38214].
The transport block decoder takes as input a sequence of noisy channelobservations and reconstructs the correspondingtransport block ofinformation bits. The detailed procedure is described in TS 38.214[3GPP38214] and TS 38.211[3GPP38211].
- Parameters:
encoder (
TBEncoder) – Associated transport block encoder used for encoding of the signalnum_bp_iter (20 (default) |int) – Number of BP decoder iterations
cn_update (str,"boxplus-phi" (default)|"boxplus" |"minsum" |"offset-minsum" |"identity" |callable) – Check node update rule to be used as described above.If a callable is provided, it will be used instead as CN update.The input of the function is a ragged tensor of v2c messages of shape[num_cns, None, batch_size] where the second dimension is ragged(i.e., depends on the individual CN degree).
vn_update (str,"sum" (default)|"identity" |callable) – Variable node update rule to be used.If a callable is provided, it will be used instead as VN update.The input of the function is a ragged tensor of c2v messages of shape[num_vns, None, batch_size] where the second dimension is ragged(i.e., depends on the individual VN degree).
precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone,
precisionis used.
- Input:
inputs ([…,num_coded_bits],tf.float) – 2+D tensor containing channel logits/llr values of the (noisy)channel observations.
- Output:
b_hat ([…,target_tb_size],tf.float) – 2+D tensor containing hard decided bit estimates of all informationbits of the transport block.
tb_crc_status ([…],tf.bool) – Transport block CRC status indicating if a transport block was(most likely) correctly recovered. Note that false positives arepossible.
- propertyk
Number of input information bits.Equals TB size.
- Type:
int
- propertyn
Total number of output codeword bits
- Type:
int
- propertytb_size
Number of information bits per TB
- Type:
int
Utils
- sionna.phy.nr.utils.calculate_tb_size(modulation_order,target_coderate,target_tb_size=None,num_coded_bits=None,num_prbs=None,num_ofdm_symbols=None,num_dmrs_per_prb=None,num_layers=1,num_ov=0,tb_scaling=1.0,return_cw_length=True,verbose=False,precision=None)[source]
Calculates the transport block (TB) size for given system parameters
This function follows the procedure defined in TS 38.214 Sec.5.1.3.2 and Sec. 6.1.4.2[3GPP38214]
- Input:
modulation_order ([…],tf.int |int) – Modulation order, i.e., number of bits per QAM symbol.
target_coderate ([…],tf.float |float) – Target coderate.
target_tb_size ([…],tf.float |float |None (default)) – Target transport block size, i.e., number of information bits that canbe encoded into a slot for the given slot configuration.
num_coded_bits ([…],tf.int |int |None (default)) – Number of coded bits can be fit into a given slot. If provided,
num_prbs,num_ofdm_symbolsandnum_dmrs_per_prbareignored.num_prbs ([…],tf.int |int |None (default)) – Total number of allocated PRBs per OFDM symbol, where 1 PRB equals 12subcarriers. Must not exceed 275.
num_ofdm_symbols ([…],tf.int |int |None (default)) – Number of OFDM symbols allocated for transmission. Cannot be largerthan 14.
num_dmrs_per_prb ([…],tf.int |int |None (default)) – Number of DMRS (i.e., pilot) symbols per PRB that arenot used for datatransmission, across all
num_ofdm_symbolsOFDM symbols.num_layers ([…],tf.int |int (default: 1)) – Number of MIMO layers.
num_ov ([…],tf.int |int |None (default)) – Number of unused resource elements due to additionaloverhead as specified by higher layer.
tb_scaling ([…],tf.float | {0.25, 0.5, 1.0} (default: 1.0)) – TB scaling factor for PDSCH as defined in TS 38.214 Tab. 5.1.3.2-2.
return_cw_length (bool (default:True)) – IfTrue, then the function returns
tb_size,cb_size,num_cb,tb_crc_length,cb_crc_length,cw_length.Else, it does not returncw_lengthto reduce computation time.verbose (bool, (default:False)) – IfTrue, then additional information is printed.
precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone, then
precisionis used
- Output:
tb_size ([…],tf.int32) – Transport block (TB) size, i.e., how many information bits can be encodedinto a slot for the given slot configuration
cb_size ([…],tf.int32) – Code block (CB) size, i.e., the number of information bits per codeword,including the TB/CB CRC parity bits
num_cb ([…],tf.int32) – Number of CBs that the TB is segmented into
tb_crc_length ([…],tf.int32) – Length of the TB CRC
cb_crc_length ([…],tf.int32) – Length of each CB CRC
cw_length ([…, N],tf.int32) – Codeword length of each of the
num_cbscodewords after LDPC encodingand rate-matching.Note that zeros are appended along the last axis to obtain a dense tensor.The total number of coded bits,num_coded_bits, is the sum ofcw_lengthacross its last axis.Only returned ifreturn_cw_lengthisTrue
- sionna.phy.nr.utils.generate_prng_seq(length,c_init)[source]
Implements pseudo-random sequence generator as defined in Sec. 5.2.1in[3GPP38211] based on a length-31 Gold sequence.
- Parameters:
length (int) – Desired output sequence length
c_init (int) – Initialization sequence of the PRNG. Must be in the range of 0 to\(2^{32}-1\).
- Output:
[
length],ndarray of 0s and 1s – Containing the scrambling sequence
Note
The initialization sequence
c_initis application specific and isusually provided be higher layer protocols.
- sionna.phy.nr.utils.decode_mcs_index(mcs_index,table_index=1,is_pusch=True,transform_precoding=False,pi2bpsk=False,check_index_validity=True,verbose=False)[source]
Returns the modulation order and target coderate for a given MCS index
Implements MCS tables as defined in[3GPP38214] for PUSCH and PDSCH.
- Input:
mcs_index ([…],tf.int32 |int) – MCS indices (denoted as\(I_{MCS}\) in[3GPP38214]). Accepted values are{0,1,…28}
table_index ([…],tf.int32 |int (default: 1)) – MCS table indices from[3GPP38214] to be used.Accepted values are{1,2,3,4}.
is_pusch ([…],tf.bool |bool (default:True)) – Specifies whether the 5G NR physical channel is of ‘PUSCH’ type. IfFalse, then the ‘PDSCH’ channel is considered.
transform_precoding ([…],tf.bool |bool (default:False)) – Specifies whether the MCS tables described inSec. 6.1.4.1 of[3GPP38214] are applied.Only relevant for “PUSCH”.
pi2bpsk ([…],tf.bool |bool |None (default)) – Specifies whether the higher-layer parametertp-pi2BPSKdescribed in Sec. 6.1.4.1 of[3GPP38214] is applied. Only relevant for“PUSCH”.
check_index_validity (bool (default:True)) – IfTrue, an ValueError is thrown is the input MCS indices are notvalid for the given configuration.
verbose (bool (default:False)) – IfTrue, then additional information is printed.
- Output:
modulation_order ([…],tf.int32) – Modulation order, i.e., number of bits per symbol,associated with the input MCS index
target_rate ([…],tf.float32) – Target coderate associated with the input MCS index
- sionna.phy.nr.utils.calculate_num_coded_bits(modulation_order,num_prbs,num_ofdm_symbols,num_dmrs_per_prb,num_layers,num_ov,tb_scaling,precision=None)[source]
Computes the number of coded bits that fit in a slot for the given resourcegrid structure
- Input:
modulation_order ([…],tf.int32) – Modulation order, i.e., number of bits per QAM symbol
num_prbs ([…],tf.int32 |int) – Total number of allocated PRBs per OFDM symbol, where 1 PRB equals 12subcarriers. Must not exceed 275.
num_ofdm_symbols ([…],tf.int32) – Number of OFDM symbols allocated for transmission. Cannot be largerthan 14.
num_dmrs_per_prb ([…],tf.int32) – Number of DMRS (i.e., pilot) symbols per PRB that arenot used fordata transmission, across all
num_ofdm_symbolsOFDM symbols.num_layers ([…],tf.int32) – Number of MIMO layers.
num_ov ([…],tf.int32) – Number of unused resource elements due to additionaloverhead as specified by higher layer.
tb_scaling ([…],tf.float) – TB scaling factor for PDSCH as defined in TS 38.214 Tab. 5.1.3.2-2. Mustcontain values in {0.25, 0.5, 1.0}.
precision (None (default) | “single” | “double”) – Precision used for internal calculations and outputs.If set toNone, then
precisionis used.
- Output:
num_coded_bits ([…],tf.int |int |None (default)) – Number of coded bits can be fit into a given slot for the fivenconfiguration.
- classsionna.phy.nr.utils.TransportBlockNR(*args,precision=None,**kwargs)[source]
Computes the number and size (measured in n. bits) of codeblocks within a 5G-NR compliant transport block, given the modulation order,coderate and the total number of coded bits of a transport block.Used in
PHYAbstraction. Inherits fromsionna.phy.utils.TransportBlockand wrapscalculate_tb_size()- Input:
modulation_order ([…],tf.int32) – Modulation order, i.e., number of bits per symbol,associated with the input MCS index.
target_rate ([…],tf.float32) – Target coderate.
num_coded_bits ([…],tf.float32) – Total number of coded bits across all codewords.
- Output:
cb_size ([…],tf.int32) – Code block (CB) size, i.e., the number of information bitsper code block.
num_cb ([…],tf.int32) – Number of code blocks that the transport block is segmented into.
- classsionna.phy.nr.utils.CodedAWGNChannelNR(num_bits_per_symbol=None,num_info_bits=None,target_coderate=None,num_iter_decoder=20,cn_update_decoder='boxplus-phi',precision=None,**kwargs)[source]
Simulates a 5G-NR compliant single-link coded AWGN channel.Inherits from
SingleLinkChannel- Parameters:
num_bits_per_symbol (int |None (default)) – Number of bits per symbol, i.e., modulation order.
num_info_bits (int |None (default)) – Number of information bits per code block.
target_coderate (float |None (default)) – Target code rate, i.e., the target ratio between the information and thecoded bits within a block
num_iter_decoder (int (default: 20)) – Number of decoder iterations. See
LDPC5GDecoderfor more details.cn_update ("boxplus-phi" (default)|"boxplus" |"minsum" |"offset-minsum" |"identity" |callable) – Check node update rule. See
LDPC5GDecoderfor more details.kwargs – Additional keyword arguments for
LDPC5GDecoder.
- Input:
batch_size (int) – Size of the simulation batches
ebno_db (float) –Eb/No value in dB
- Output:
bits ([
batch_size,num_info_bits],int) – Transmitted bitsbits_hat ([
batch_size,num_info_bits],int) – Decoded bits
- classsionna.phy.nr.utils.MCSDecoderNR(*args,precision=None,**kwargs)[source]
Maps a Modulation and Coding Scheme (MCS) index to thecorresponding modulation order, i.e., number of bits per symbol, andcoderate for 5G-NR networks. Wraps
decode_mcs_index()and inheritsfromMCSDecoder.- Input:
mcs_index ([…],tf.int32) – MCS index
mcs_table_index ([…],tf.int32) – MCS table index. Different tables contain different mappings.
mcs_category ([…],tf.int32) –0 for PUSCH,1 for PDSCH channel
check_index_validity (bool (default:True)) – IfTrue, an ValueError is thrown is the input mcs indices are notvalid for the given configuration.
transform_precoding ([…],tf.bool |bool (default:False)) – Specifies whether the MCS tables described inSec. 6.1.4.1 of[3GPP38214] are applied.Only relevant for “PUSCH”.
pi2bpsk ([…],tf.bool |bool |None (default)) – Specifies whether the higher-layer parametertp-pi2BPSKdescribed in Sec. 6.1.4.1 of[3GPP38214] is applied.Only relevant for “PUSCH”.
verbose (bool (default:False)) – IfTrue, then additional information is printed.
- Output:
modulation_order ([…],tf.int32) – Modulation order corresponding to the input MCS index
target_coderate ([…],tf.float) – Target coderate corresponding to the input MCS index