Recover bits from DMG Header field

## Syntax

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

## Description

example

````[headerBits,failHCS] = wlanDMGHeaderBitRecover(rxHeader,noiseVarEst,cfgDMG)` recovers `headerBits`, a column vector of bits, from `rxHeader`, the DMG Header field of a directional multi-gigaqbit (DMG) transmission. The function recovers `headerBits` by using noise variance estimate `noiseVarEst` and DMG transmission parameters `cfgDMG`.The function also returns `failHCS`, the result of the header check sequence (HCS) on the recovered bits.```

example

````[headerBits,failHCS] = wlanDMGHeaderBitRecover(rxHeader,noiseVarEst,csi,cfgDMG)` enhances the demapping of OFDM subcarriers by using channel state information `csi`. Use this syntax for DMG transmissions that use an orthogonal frequency-division multiplexing (OFDM) PHY configuration.```

example

````[headerBits,failHCS] = wlanDMGHeaderBitRecover(___,Name,Value) ` specifies algorithm options by using one or more name-value pair arguments, in addition to any input argument combination from previous syntaxes. For example, `'LDPCDecodingMethod','layered-bp'` specifies the layered belief propagation low-density parity-check (LDPC) decoding algorithm.```

## Examples

collapse all

Recover bits from the DMG Header field in a control transmission.

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

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

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

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

Pass the waveform through a noiseless channel.

`noiseVarEst = 0;`

Extract the DMG Header field by using the `wlanFieldIndices` function.

```ind = wlanFieldIndices(cfgDMG); rxSym = waveform(ind.DMGHeader(1):ind.DMGHeader(2));```

Rotate the received signal by 90 degrees.

`rxSymRotated = rxSym.*exp(-1i*(pi/2)*(0:size(rxSym,1) - 1).');`

Generate a Golay sequence of length 32 by using the `wlanGolaySequence` function.

```len = 32; Ga = wlanGolaySequence(len);```

Despread the signal with a factor equal to the golay sequence length.

`rxHeader = reshape(rxSymRotated,len,length(rxSymRotated)/len)'*Ga/len;`

Recover the bits from the DMG Header field.

`[headerBits,failHCS] = wlanDMGHeaderBitRecover(rxHeader,noiseVarEst,cfgDMG);`

Display the result of the HCS check.

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

Recover bits from the DMG Header field of an OFDM transmission.

Configure an OFDM transmission by creating a DMG configuration object with an MCS of `14`.

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

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

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

Pass the waveform through a channel, assuming additive white Gaussian noise (AWGN) for the specified signal-to-noise ratio (SNR).

```snr = 10; % SNR, in dB noiseVarEst = 10^(-snr/10); % Noise variance rxSig = awgn(waveform,snr);```

```ind = wlanFieldIndices(cfgDMG); rxSym = rxSig(ind.DMGHeader(1):ind.DMGHeader(2));```

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

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

Recover the bits from the DMG Header field, assuming a CSI estimate of all ones.

```csi = ones(length(info.DataIndices),1); [headerBits,failHCS] = wlanDMGHeaderBitRecover(rxHeader,noiseVarEst,csi,cfgDMG);```

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 column vector or matrix. The contents and size of this input depend on the PHY configuration you specify in the `cfgDMG` input.

• SC PHY — This input contains the time-domain DMG Header field signal in a 448-by-Nblks matrix. The value 448 is the number of symbols in a DMG Header block, and Nblks is the number of DMG Header blocks.

• OFDM PHY — This input contains the demodulated DMG Data field OFDM symbols in a column vector of length 336. The value 336 is the number of data subcarriers in the DMG Header field.

• Control PHY — This input contains the time-domain DMG Header field in a column vector of length Nb, where 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 transmission configuration, specified as a `wlanDMGConfig` object.

Channel state information, specified as a real-valued column vector of length 336. The value 336 specifies the number of data subcarriers in the DMG Header field.

#### Dependencies

To enable this input, specify an OFDM PHY configuration in the `cfgDMG` input.

Data Types: `double`

### Name-Value Arguments

Specify optional pairs of arguments as `Name1=Value1,...,NameN=ValueN`, where `Name` is the argument name and `Value` is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose `Name` in quotes.

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 the comma-separated pair consisting of `'LDPCDecodingMethod'` and 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 the comma-separated pair consisting of `'MinSumScalingFactor'` and 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 the comma-separated pair consisting of `'MinSumOffset'` and 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 the comma-separated pair consisting of `'MaximumLDPCIterationCount'` and a positive integer.

Data Types: `double`

Enable early termination of LDPC decoding, specified as the comma-separated pair consisting of `'EarlyTermination'` and `1` (`true`) or `0` (`false`).

• When you set this value to `0` (`false`), LDPC decoding completes the number of iterations specified in the `'``MaximumLDPCIterationCount``'` name-value pair argument 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

Bits recovered from the DMG Header field, returned as `1`, `0`, or a binary-valued column vector.

• If you specify an OFDM or SC PHY configuration in the `cfgDMG` input, this output contains 64 elements.

• If you specify a control PHY configuration in the `cfgDMG` input, this output contains 40 elements.

Data Types: `int8`

HCS check result, returned as `0` or `1`. When the bits recovered from the DMG Header fail the HCS check, the function returns this output as `1`. Otherwise, the function returns this output as `0`.

Data Types: `logical`

collapse all

In the DMG format, the DMG Header field is different in size and content for each supported PHY modulation scheme. This field contains additional information for the receiver.

The total size of the DMG Header field is 40 bits for control PHY configurations and 64 bits for SC and OFDM PHY configurations.

These fields are common for the three PHY modes.

• Scrambler initialization — Specifies the initial state for the scrambler

• MCS — Specifies the MCS for the DMG Data field (not present in control PHY)

• Length — 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 the presence of a beamforming training field, and, if present, the length of the field

• 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

This function supports these four LDPC decoding algorithms.

### Belief Propagation Decoding

The 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 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 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 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.

## Version History

Introduced in R2017b