## Syntax

``[headerBits,failHCS] = wlanDMGHeaderBitRecover(rxHeader,noiseVarEst,cfg) ``
``[headerBits,failHCS] = wlanDMGHeaderBitRecover(rxHeader,noiseVarEst,csi,cfg) ``
``[headerBits,failHCS] = wlanDMGHeaderBitRecover(___,Name,Value) ``

## Description

example

````[headerBits,failHCS] = wlanDMGHeaderBitRecover(rxHeader,noiseVarEst,cfg) `recovers the header information bits and tests the header check sequence (HCS) given the header field from a DMG transmission (OFDM, single-carrier, or control PHY), the noise variance estimate, and the DMG configuration object.```
````[headerBits,failHCS] = wlanDMGHeaderBitRecover(rxHeader,noiseVarEst,csi,cfg) `uses the channel state information specified in `csi` to enhance the demapping of OFDM subcarriers.```

example

````[headerBits,failHCS] = wlanDMGHeaderBitRecover(___,Name,Value) ` specifies algorithm options by using one or more name-value pair arguments. When you do not specify a name-value pair, the function uses the default value.```

## Examples

collapse all

Recover header information bits of the DMG header field from the control PHY.

Transmitter

Create the DMG configuration object with a modulation and coding scheme (MCS) for the control PHY.

`cfgDMG = wlanDMGConfig('MCS',0);`

Create the input sequence of data bits, specifying it as a column vector with `cfgDMG.PSDULength*8` elements. Generate the DMG transmission waveform.

```txBits = randi([0 1],cfgDMG.PSDULength*8,1,'int8'); tx = wlanWaveformGenerator(txBits,cfgDMG);```

Channel

Transmit the signal through a channel with no noise (zero noise variance).

```rx = tx; nVar = 0;```

Extract the header field by using the `wlanFieldIndices` function.

```ind = wlanFieldIndices(cfgDMG); rxHeader = rx(ind.DMGHeader(1):ind.DMGHeader(2));```

De-rotate the received signal by pi/2 and despread it with a spreading factor of 32. Use the `wlanGolaySequence` function to generate the Golay sequence.

```rxSym = rxHeader.*exp(-1i*pi/2*(0:size(rxHeader,1)-1).'); SF = 32; Ga = wlanGolaySequence(SF); rxDespread = reshape(rxSym,SF,length(rxSym)/SF)'*Ga/SF;```

`[rxBits,failHCS] = wlanDMGHeaderBitRecover(rxDespread,nVar,cfgDMG);`

Display the HCS check on the recovered header bits.

`disp(failHCS);`
``` 0 ```

Recover information bits from the DMG header in an OFDM transmission.

Transmitter

Create a DMG configuration object with a modulation and coding scheme (MCS) for OFDM PHY.

`cfg = wlanDMGConfig('MCS',14);`

Create the input sequence of data bits and generate a DMG waveform.

```txBits = randi([0 1],8*cfg.PSDULength,1,'int8'); tx = wlanWaveformGenerator(txBits,cfg);```

AWGN Channel

Set an SNR of 10 dB, calculate the noise power (noise variance), and add AWGN to the waveform by using the `awgn` function.

```snr = 10; nVar = 10^(-snr/10); rx = awgn(tx,snr);```

```ind = wlanFieldIndices(cfg); rxHeader = rx(ind.DMGHeader(1):ind.DMGHeader(2));```

Perform OFDM demodulation on the received header and extract the data subcarriers.

```sym = wlanDMGOFDMDemodulate(rxHeader); info = wlanDMGOFDMInfo; rxSym = sym(info.DataIndices,:);```

Recover the information bits from the DMG header.

`[rxBits,failHCS] = wlanDMGHeaderBitRecover(rxSym,nVar,cfg);`

Confirm that the recovered bits pass the HCS.

`disp(failHCS)`
``` 0 ```

Recover information bits from the DMG header in a single-carrier (SC) transmission.

Transmitter

Create a DMG configuration object with an MCS for an SC PHY configuration.

`cfg = wlanDMGConfig('MCS',10);`

Create the input sequence of data bits and generate a DMG waveform.

```txBits = randi([0 1],8*cfg.PSDULength,1,'int8'); tx = wlanWaveformGenerator(txBits,cfg);```

AWGN Channel

Set an SNR of 10 dB, calculate the noise power (noise variance), and add AWGN to the waveform by using the `awgn` function.

```snr = 10; nVar = 10^(-snr/10); rx = awgn(tx,snr);```

```ind = wlanFieldIndices(cfg); rxHeader = rx(ind.DMGHeader(1):ind.DMGHeader(2));```

Reshape the received waveform into blocks. Set the data block size to 512 and the guard interval length to 64. Remove the last guard interval from the received data waveform.

```blkSize = 512; Ngi = 64; rxHeader = reshape(rxHeader,blkSize,[]); rxSym = rxHeader(Ngi+1:end,:); disp(size(rxSym))```
``` 448 2 ```

Recover the header bits from the DMG header, specifying layered belief propagation LDPC decoding.

`[rxBits,failHCS] = wlanDMGHeaderBitRecover(rxSym,nVar,cfg,'LDPCDecodingMethod','layered-bp');`

Confirm that the recovered bits pass the HCS.

`disp(failHCS)`
``` 0 ```

## Input Arguments

collapse all

Received DMG header field signal, specified as a real or complex matrix. The contents and size of `rxHeader` depends on the physical layer (PHY):

• Single-Carrier PHY — `rxHeader` is the time-domain DMG header field signal, specified as a 448-by-NBLKS matrix of real or complex values. The value 448 is the number of symbols in a DMG header symbol and NBLKS is the number of DMG header blocks.

• OFDM PHY — `rxHeader` is the frequency-domain signal, specified as a 336-by-1 column vector of real or complex values. The value 336 is the number of data subcarriers in the DMG header field.

• Control PHY — `rxHeader` is the time-domain signal containing the header field, specified as an NB-by-1 column vector of real or complex values. NB is the number of despread symbols.

Data Types: `double`
Complex Number Support: Yes

Noise variance estimate, specified as a nonnegative scalar.

Data Types: `double`

DMG PPDU configuration, specified as a `wlanDMGConfig` object.

Channel state information, specified as a 336-by-1 real column vector. The value 336 specifies the number of data subcarriers in the DMG data field. `csi` is required only for OFDM PHY.

Data Types: `double`

### Name-Value Pair Arguments

Specify optional comma-separated pairs of `Name,Value` arguments. `Name` is the argument name and `Value` is the corresponding value. `Name` must appear inside quotes. You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

Example: `'MaximumLDPCIterationCount','12','EarlyTermination','false'` specifies a maximum of 12 LDPC decoding iterations and disables early termination so that the decoder completes the 12 iterations.

LDPC decoding algorithm, specified as one of these values:

• `'bp'` — Use the belief propagation (BP) decoding algorithm. For more information, see Belief Propagation Decoding.

• `'layered-bp'` — Use the layered BP decoding algorithm, suitable for quasi-cyclic parity check matrices (PCMs). For more information, see Layered Belief Propagation Decoding.

• `'norm-min-sum'` — Use the layered BP decoding algorithm with the normalized min-sum approximation. for more information, see Normalized Min-Sum Decoding.

• `'offset-min-sum'` — Use the layered BP decoding algorithm with the offset min-sum approximation. For more information, see Offset Min-Sum Decoding.

Data Types: `char` | `string`

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

#### Dependencies

To enable this argument, specify the `'``LDPCDecodingMethod``'` name-value pair argument as `'norm-min-sum'`.

Data Types: `double`

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

#### Dependencies

To enable this argument, specify the `'``LDPCDecodingMethod``'` name-value pair argument as `'offset-min-sum'`.

Data Types: `double`

Maximum number of LDPC decoding iterations, specified as a positive integer.

Data Types: `double`

Enable early termination of LDPC decoding, specified as `1` (`true`) or `0` (`false`).

• When you set this value to `0` (`false`), LDPC decoding completes the number of iterations specified by `'MaximumLDPCIterationCount'` regardless of parity check status.

• When you set this value to `1` (`true`), LDPC decoding terminates when all parity checks are satisfied.

Data Types: `logical`

## Output Arguments

collapse all

Recovered header information bits, returned as a column vector of 64 elements for OFDM and single-carrier PHYs and a column vector of 40 elements for control PHYs.

Data Types: `int8`

HCS check, returned as a logical. When `headerBits` fails the HCS check, `failHCS` is `true`.

Data Types: `logical`

collapse all

In the DMG format, the header field is different in size and content for every supported physical layer (PHY) modulation scheme. This field contains additional important information for the receiver.

The total size of the header field is 40 bits for control PHYs and 64 bits for SC and OFDM PHYs.

The most important fields common for the three PHY modes are:

• Scrambler initialization — Specifies the initial state for the scrambler.

• MCS — Specifies the modulation and coding scheme used in the data field. It is not present in control PHY.

• Length (data) — Specifies the length of the data field.

• Packet type — Specifies whether the beamforming training field is intended for the receiver or the transmitter.

• Training length — Specifies whether a beamforming training field is used and if so, its length.

• HCS — Provides a checksum per CRC for the header.

IEEE 802.11ad™-2012 specifies the detailed aspects of the DMG header field structure. In particular, the PHY modulation-specific aspects of the header field are specified in these sections:

• The DMG control PHY header structure is specified in Section 21.4.3.2.

• The DMG OFDM PHY header structure is specified in Section 21.5.3.1.

• The DMG SC PHY header structure is specified in Section 21.6.3.1.

## Algorithms

collapse all

The `wlanDMGHeaderBitRecover` function supports these four LDPC decoding algorithms.

### Belief Propagation Decoding

The `wlanDMGHeaderBitRecover` function implements the BP algorithm based on the decoding algorithm presented in [2]. For transmitted LDPC-encoded codeword $c=\left({c}_{0},{c}_{1},\dots ,{c}_{n-1}\right)$, the input to the LDPC decoder is the log-likelihood ratio (LLR) given by

.

In each iteration, the function updates the key components of the algorithm based on these equations:

$L\left({r}_{ji}\right)=2\text{\hspace{0.17em}}\text{atanh}\text{\hspace{0.17em}}\left(\prod _{{i}^{\prime }\in {V}_{j}\\left\{i\right\}}\mathrm{tanh}\left(\frac{1}{2}L\left({q}_{{i}^{\prime }j}\right)\right)\right)$,

$L\left({q}_{ij}\right)=L\left({c}_{i}\right)+\sum _{j\text{'}\in {C}_{i}\\left\{j\right\}}L\left({r}_{{j}^{\prime }i}\right)$, initialized as $L\left({q}_{ij}\right)=L\left({c}_{i}\right)$ before the first iteration, and

$L\left({Q}_{i}\right)=L\left({c}_{i}\right)+\sum _{{j}^{\prime }\in {C}_{i}}L\left({r}_{{j}^{\prime }i}\right)$.

At the end of each iteration, $L\left({Q}_{i}\right)$ is an updated estimate of the LLR value for the transmitted bit, ${c}_{i}$. The value $L\left({Q}_{i}\right)$ is the soft-decision output for ${c}_{i}$. If $L\left({Q}_{i}\right)$ is negative, the hard-decision output for ${c}_{i}$ is 1. Otherwise, the output is 0.

Index sets ${C}_{i}\\left\{j\right\}$ and ${V}_{j}\\left\{i\right\}$ are based on the PCM such that the sets ${C}_{i}$ and ${V}_{j}$ correspond to all nonzero elements in column i and row j of the PCM, respectively.

This figure demonstrates how to compute these index sets for PCM $H$ for the case i = 5 and j = 3.

To avoid infinite numbers in the algorithm equations, atanh(1) and atanh(–1) are set to 19.07 and –19.07, respectively. Due to finite precision, MATLAB® returns 1 for tanh(19.07) and –1 for tanh(–19.07).

When you specify the `'``EarlyTermination``'` name-value pair argument as `0` (`false`), the decoding terminates after the number of iterations specified by the `'``MaximumLDPCIterationCount``'` name-value pair argument. When you specify the `'``EarlyTermination``'` name-value pair argument as `1` (`true`), the decoding terminates when all parity checks are satisfied ($H{c}^{T}=0$) or after the number of iterations specified by the `'``MaximumLDPCIterationCount``'` name-value pair argument.

### Layered Belief Propagation Decoding

The `wlanDMGHeaderBitRecover` function implements the layered BP algorithm based on the decoding algorithm presented in Section II.A of [3]. The decoding loop iterates over subsets of rows (layers) of the PCM.

For each row, m, in a layer and each bit index, j, the implementation updates the key components of the algorithm based on these equations.

(1) $L\left({q}_{mj}\right)=L\left({q}_{j}\right)-{R}_{mj}$

(2) $\Psi \left(x\right)=\mathrm{log}\left(|\mathrm{tanh}\left(x/2\right)|\right)$

(3) ${A}_{mj}=\sum _{n\in N\left(m\right)\\left\{j\right\}}\Psi \left(L\left({q}_{mn}\right)\right)$

(4) ${s}_{mj}=\prod _{n\in N\left(m\right)\\left\{j\right\}}\mathrm{sgn}\left(L\left({q}_{mn}\right)\right)$

(5) ${R}_{mj}=-{s}_{mj}\Psi \left({A}_{mj}\right)$

(6) $L\left({q}_{j}\right)=L\left({q}_{mj}\right)+{R}_{mj}$

For each layer, the decoding equation (6) works on the combined input obtained from the current LLR inputs, $L\left({q}_{mj}\right)$, and the previous layer updates, ${R}_{mj}$.

Because the layered BP algorithm updates only a subset of the nodes in a layer, this algorithm is faster than the BP algorithm. To achieve the same error rate as attained with BP decoding, use half the number of decoding iterations when using the layered BP algorithm.

### Normalized Min-Sum Decoding

The `wlanDMGHeaderBitRecover` function implements the normalized min-sum decoding algorithm by following the layered BP algorithm with equation (3) replaced by

${A}_{mj}={\mathrm{min}}_{n\in N\left(m\right)\\left\{j\right\}}\left(\alpha |L\left({q}_{mn}\right)|\right)$,

where α is the scaling factor specified by the `'``MinSumScalingFactor``'` name-value pair argument. This equation is an adaptation of equation (4) presented in [4].

### Offset Min-Sum Decoding

The `wlanDMGHeaderBitRecover` function implements the offset min-sum decoding algorithm by following the layered BP algorithm with equation (3) replaced by

,

where β is the offset specified by the `'``MinSumOffset``'` name-value pair argument. This equation is an adaptation of equation (5) presented in [4].

## References

[1] IEEE STD 802.11ad-2012 (Amendment to IEEE Std 802.11™-2012, as amended by IEEE Std 802.11ae™-2012 and IEEE Std 802.11a™-2012). “Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications. Amendment 4: Enhancements for Very High Throughput Operation in Bands below 6 GHz.” IEEE Standard for Information technology — Telecommunications and information exchange between systems. Local and metropolitan area networks — Specific requirements.

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

[3] Hocevar, D.E. "A Reduced Complexity Decoder Architecture via Layered Decoding of LDPC Codes." In IEEE Workshop on Signal Processing Systems, 2004. SIPS 2004., 107-12. Austin, Texas, USA: IEEE, 2004. https://doi.org/10.1109/SIPS.2004.1363033.

[4] Jinghu Chen, 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., 449-53, 2005. https://doi.org/10.1109/ISIT.2005.1523374.