# nrULSCHDecoder

Apply UL-SCH decoder processing chain

## Description

The `nrULSCHDecoder` System object™ applies the uplink shared channel (UL-SCH) decoder processing chain to the soft bits corresponding to a UL-SCH-encoded transport block. The UL-SCH decoding process consists of rate recovery, low-density parity-check (LDPC) decoding, desegmentation, and cyclic redundancy check (CRC) decoding. The object implements the inverse operation of the UL-SCH encoding process specified in these sections of TS 38.212 [1]:

• Sections 6.2.1: Transport block CRC attachment

• Sections 6.2.2: LDPC base graph selection

• Sections 6.2.3: Code block segmentation and code block CRC attachment

• Sections 6.2.4: Channel coding of UL-SCH

• Sections 6.2.5: Rate matching

• Sections 6.2.6: Code block concatenation

To apply the UL-SCH decoder processing chain:

1. Create the `nrULSCHDecoder` object and set its properties.

2. Call the object with arguments, as if it were a function.

## Creation

### Syntax

``decUL = nrULSCHDecoder``
``decUL = nrULSCHDecoder(Name,Value)``

### Description

````decUL = nrULSCHDecoder` creates a UL-SCH decoder System object.```
````decUL = nrULSCHDecoder(Name,Value)` creates the object with properties set by using one or more name-value pairs. Enclose the property name inside quotes, followed by the specified value. Unspecified properties take default values.Example: For example, `nrULSCHDecoder('MultipleHARQProcesses',true)` creates the object and enables multiple hybrid automatic repeat-request (HARQ) processes.```

## Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the `release` function unlocks them.

If a property is tunable, you can change its value at any time.

Enable multiple HARQ processes, specified as `false` or `true`. When set to `false`, the object uses a single process. When set to `true`, the object uses multiple HARQ processes, at most 16. To enable soft combining of retransmissions before LDPC decoding, the object maintains a soft buffer for each HARQ process.

Data Types: `logical`

Target code rate, specified as a real number in the interval (0, 1). The default value corresponds to 526/1024.

Tunable: Yes

Data Types: `double`

Length of decoded transport block, in bits, specified as a positive integer.

Tunable: Yes

Data Types: `double`

Enable limited buffer rate recovery, specified as `false` or `true`. When set to `false`, the size of the internal buffer used for rate recovery is the full coded length of each code block. When set to `true`, you can specify the size of the internal buffer used for rate recovery by setting the `LimitedBufferSize` property.

Data Types: `logical`

Limited buffer size used for rate recovery, specified as a positive integer. The default value corresponds to 384×66, which is the maximum coded length of a code block. The default value implies no limit on the buffer size.

#### Dependencies

To enable this property, set `LimitedBufferRateRecovery` to `true`.

Data Types: `double`

Maximum LDPC decoding iterations, specified as a positive integer. Since early termination is enabled, decoding stops once parity-checks are satisfied. In this case, fewer iterations take place than the maximum specified by this argument.

Data Types: `double`

LDPC decoding algorithm, specified as one of these values:

• `'Belief propagation'` — Use this option to specify the belief-passing or message-passing algorithm.

• `'Layered belief propagation'` — Use this option to specify the layered belief-passing algorithm, which is suitable for quasi-cyclic parity-check matrices (PCMs).

• `'Normalized min-sum'` — Use this option to specify the layered belief propagation algorithm with normalized min-sum approximation.

• `'Offset min-sum'` — Use this option to specify the layered belief propagation algorithm with offset min-sum approximation.

Data Types: `char` | `string`

Scaling factor for normalized min-sum decoding, specified as a real scalar in the range (0, 1].

#### Dependencies

To enable this property, set the `LDPCDecodingAlgorithm` property to ```'Normalized min-sum'```.

Data Types: `double`

Offset for offset min-sum decoding, specified as a nonnegative finite real scalar.

#### Dependencies

To enable this property, set the `LDPCDecodingAlgorithm` property to ```'Offset min-sum'```.

Data Types: `double`

## Usage

### Syntax

``trblk = decUL(softbits,mod,nLayers,rv)``
``trblk = decUL(___,harqID)``
``[trblk,blkerr] = decUL(___)``

### Description

example

````trblk = decUL(softbits,mod,nLayers,rv)` applies the UL-SCH decoder processing chain to the input `softbits` and returns the decoded bits. `mod` specifies the modulation scheme. `nLayers` specifies the number of transmission layers. `rv` specifies the redundancy version of the transmission.```
````trblk = decUL(___,harqID)` specifies the HARQ process number `harqID` used with the current transport block in addition to the input arguments in the previous syntax. To use this syntax, set the `MultipleHARQProcesses` property to `true`. When the property is set to `false`, the object uses HARQ process number 0.When the object receives codewords with different redundancy version for an individual HARQ process, the object uses soft buffer state retention to enable soft combining of retransmissions. When you enable multiple HARQ processes, the object maintains independent buffers for each process.```
````[trblk,blkerr] = decUL(___)` returns an error flag, using the input arguments in any of the previous syntaxes. A value of 1 in `blkerr` indicates an error during transport block decoding.```

### Input Arguments

expand all

Approximate log-likelihood ratio (LLR) soft bits, corresponding to the UL-SCH-encoded transport block, specified as a real column vector.

Data Types: `single` | `double`

Modulation scheme, specified as `'pi/2-BPSK'`, `'QPSK'`, `'16QAM'`, `'64QAM'`, or `'256QAM'`. This modulation scheme determines the modulation type and number of bits used per modulation symbol.

Modulation SchemeNumber of Bits Per Symbol
`'pi/2-BPSK'`1
`'QPSK'`2
`'16QAM'`4
`'64QAM'`6
`'256QAM'`8

Data Types: `char` | `string`

Number of transmission layers, specified as an integer from 1 to 4. For more information, see TS 38.211 Section 6.3.1.3.

Data Types: `double`

Redundancy version, specified as an integer from 0 to 3.

Data Types: `double`

HARQ process number, specified as an integer from 0 to 15.

Data Types: `double`

### Output Arguments

expand all

Decoded UL-SCH transport block, returned as a binary column vector of length specified by the `TransportBlockLength` property.

Result of UL-SCH transport block decoding, returned as a logical scalar. A value of `1` indicates an error during transport block decoding.

Data Types: `logical`

## Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named `obj`, use this syntax:

`release(obj)`

expand all

 `resetSoftBuffer` Reset soft buffer for HARQ process in UL-SCH or DL-SCH decoder
 `step` Run System object algorithm `clone` Create duplicate System object `isLocked` Determine if System object is in use `release` Release resources and allow changes to System object property values and input characteristics `reset` Reset internal states of System object

## Examples

collapse all

Generate a random sequence of binary values corresponding to one transport block of length 5120.

```trBlkLen = 5120; trBlk = randi([0 1],trBlkLen,1,'int8');```

Create and configure an UL-SCH encoder System object with the specified target code rate.

```targetCodeRate = 567/1024; encUL = nrULSCH; encUL.TargetCodeRate = targetCodeRate;```

Load the transport block into the UL-SCH encoder.

`setTransportBlock(encUL,trBlk);`

Call the encoder with 64-QAM modulation scheme, 1 transmission layer, an output length of 10,240 bits, and redundancy version 0. The encoder applies the UL-SCH processing chain to the transport block loaded into the object.

```mod = '64QAM'; nLayers = 1; outlen = 10240; rv = 0; codedTrBlock = encUL(mod,nLayers,outlen,rv);```

Create and configure an UL-SCH decoder System object.

```decUL = nrULSCHDecoder; decUL.TargetCodeRate = targetCodeRate; decUL.TransportBlockLength = trBlkLen;```

Call the UL-SCH decoder on the soft bits representing the encoded transport block. Use the configuration parameters specified for the encoder. The error flag in the output indicates that the block decoding does not have errors.

```rxSoftBits = 1.0 - 2.0*double(codedTrBlock); [decbits,blkerr] = decUL(rxSoftBits,mod,nLayers,rv)```
```decbits = 5120x1 int8 column vector 1 1 0 1 1 0 0 1 1 1 ⋮ ```
```blkerr = logical 0 ```

Verify that the transmitted and received message bits are identical.

`isequal(decbits,trBlk)`
```ans = logical 1 ```

expand all

## References

[1] 3GPP TS 38.212. “NR; Multiplexing and channel coding.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[2] 3GPP TS 38.211. “NR; Physical channels and modulation.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[3] Gallager, Robert G. Low-Density Parity-Check Codes, Cambridge, MA, MIT Press, 1963.

[4] Hocevar, D.E. "A reduced complexity decoder architecture via layered decoding of LDPC codes." In IEEE Workshop on Signal Processing Systems, 2004. SIPS 2004. doi: 10.1109/SIPS.2004.1363033

[5] Chen, Jinghu, R.M. Tanner, C. Jones, and Yan Li. "Improved min-sum decoding algorithms for irregular LDPC codes." In Proceedings. International Symposium on Information Theory, 2005. ISIT 2005. doi: 10.1109/ISIT.2005.1523374

## Extended Capabilities

### Functions

Introduced in R2019a