# nrUCIDecode

## Syntax

``ucibits = nrUCIDecode(softbits,A)``
``ucibits = nrUCIDecode(softbits,A,mod)``
``ucibits = nrUCIDecode(___,'ListLength',L)``
``[ucibits,err] = nrUCIDecode(___)``

## Description

````ucibits = nrUCIDecode(softbits,A)` decodes the input `softbits` and returns the decoded UCI bits of length `A`. The function implements the inverse of the encoding process specified in TS 38.212 Sections 6.3.1.2–6.3.1.5 for the physical uplink control channel (PUCCH) and in Sections 6.3.2.2–6.3.2.5 for the physical uplink shared channel (PUSCH) [1]. The decoding consists of rate recovery, channel decoding, and cyclic redundancy check (CRC) decoding per code block. The particular decoding scheme that the function implements depends on the decoded UCI message length, `A`. For more details, see Algorithms.```

example

````ucibits = nrUCIDecode(softbits,A,mod)` also specifies the modulation scheme for the decoding. The specified modulation scheme applies only when the length of `ucibits` is 1 or 2. When not specified, the modulation scheme defaults to QPSK.```
````ucibits = nrUCIDecode(___,'ListLength',L)` specifies the list length for polar decoding in addition to the input arguments in any of the previous syntaxes. The specified list length applies only for the successive cancellation list (SCL) decoding when `A` ≥ 12. When not specified, the list length defaults to 8.```

example

````[ucibits,err] = nrUCIDecode(___)` also returns an error flag. Use the input arguments in any of the previous syntaxes. A value of `1` in `err` indicates that an error occurred during code block decoding. The `err` output applies only for CRC-based decoding schemes. For more information, see Algorithms.```

## Examples

collapse all

Create a random sequence of binary values corresponding to a UCI message of 32 bits. Encode the message based on the specified length of the rate-matched UCI codeword.

```A = 32; E = 120; uciBits = randi([0 1],A,1); ucicw = nrUCIEncode(uciBits,E);```

Decode the soft bits representing UCI codeword `ucicw`. Set the length of the polar decoding list to 4. The error flag in the output indicates that no errors occurred during code block decoding.

```L = 4; [recBits,err] = nrUCIDecode(1-2*ucicw,A,'ListLength',L)```
```recBits = 32x1 int8 column vector 1 1 0 1 1 0 0 1 1 1 ⋮ ```
```err = logical 0 ```

Verify that the transmitted and received message bits are identical.

`isequal(recBits,uciBits)`
```ans = logical 1 ```

Create a random sequence of binary values corresponding to a two-bit UCI message.

```K = 2; uci = randi([0 1],K,1,'int8');```

Encode the message for the specified length of the rate-matched output and 16-QAM modulation scheme.

```mod = '16QAM'; E = 4*3; encUCI = nrUCIEncode(uci,E,mod);```

Replace placeholders -1 and -2 in the output through scrambling.

```encUCI(encUCI==-1) = 1; encUCI(encUCI==-2) = encUCI(find(encUCI==-2)-1);```

Modulate the encoded UCI message.

`modOut = nrSymbolModulate(encUCI,mod);`

Add white Gaussian noise (AWGN) to the modulated symbols using a signal-to-noise ratio of 0 dB.

```snrdB = 0; rxSig = awgn(modOut,snrdB);```

`rxSoftBits = nrSymbolDemodulate(rxSig,mod);`

Decode the soft bits representing the demodulated UCI codeword.

`decBits = nrUCIDecode(rxSoftBits,K,mod);`

Verify that the transmitted and received message bits are identical.

`isequal(decBits,uci) `
```ans = logical 1 ```

## Input Arguments

collapse all

Approximate log-likelihood ratio (LLR) soft bits corresponding to encoded UCI bits, specified as a real column vector.

Data Types: `double` | `single`

Length of decoded UCI message bits, specified as an integer from 1 to 1706.

Data Types: `double`

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

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

This input argument applies only when the input `A` is `1` or `2`.

Data Types: `char` | `string`

Length of polar decoding list, specified as `8` or a power of two.

Data Types: `double`

## Output Arguments

collapse all

Decoded UCI message bits, returned as an `A`-by-1 column vector of binary values.

Data Types: `int8`

Result of UCI code block decoding for each code block, returned as a logical scalar or logical vector of length 2. `1` in `err` indicates that an error has occurred during code block decoding.

Data Types: `logical`

## Algorithms

The particular UCI decoding scheme that `nrUCIDecode` implements depends on the specified output length `A`.

1–11N/AMaximum likelihoodN/A
12–19N/ACRC-aided SCL6
20–1706Depends on `A` and the length of `softbits`CRC-aided SCL11

## Compatibility Considerations

expand all

Behavior changed in R2020a

## References

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

## Extended Capabilities

Introduced in R2019a