Main Content

nrBCHDecode

Broadcast channel (BCH) decoding

Description

example

scrblk= nrBCHDecode(softbits,L)decodes the log-likelihood ratios (LLRs)softbitsin accordance with TS 38.212, Section 7.1[1]. The function returns the decoded scrambled BCH transport blockscrblk. The input argumentL是the list length used for polar decoding.

[scrblk,errFlag] = nrBCHDecode(softbits,L)返回一个错误标志,errFlag, to indicate whetherscrblkcontains an error after decoding.

[scrblk,errFlag,trblk,lsbofsfn,hrf,msbidxoffset] = nrBCHDecode(softbits,L,lssb,ncellid)also returns the decoded and unscrambled BCH transport blocktrblk. The additional input arguments are the number of candidate synchronization signal / physical broadcast channel (SS/PBCH) blocks,lssb, and the physical layer cell identity number,ncellid. The function also returns these information elements:

  • lsbofsfn, the four least significant bits (LSBs) of the system frame number

  • hrf, the half frame bit

  • msbidxoffset, the most significant bits (MSBs) of the index offset

Examples

collapse all

Generate a random sequence of binary values corresponding to a BCH transport block of 24 bits.

trblk = randi([0 1],24,1,'int8');

Specify the physical layer cell identity number as 321, the system frame number as 10, and the second half frame.

nid = 321; sfn = 10; hrf = 1;

Specify the number of candidate SS/PBCH blocks as 8. When you specify the number of candidate SS/PBCH blocks as4or8, you can specify the subcarrier offsetkssbas an input argument to the BCH encoder.

lssb = 8; kssb = 18;

Encode the BCH transport block using the specified arguments.

bch = nrBCH(trblk,sfn,hrf,lssb,kssb,nid);

Decode the encoded transport block and recover information by using a polar decoding list length of 8 bits.

listLen = 8; [~,errFlag,rxtrblk,rxSFN4lsb,rxHRF,rxKssb] = nrBCHDecode(...double(1-2*bch),listLen,lssb,nid);

Verify that the decoding has no errors.

errFlag
errFlag =uint320
是equal(trblk,rxtrblk)
ans =logical1
是equal(bit2int(rxSFN4lsb,4),mod(sfn,16))
ans =logical1
[isequal(hrf,rxHRF) isequal(int2bit(floor(kssb/16),1,false),rxKssb)]
ans =1x2 logical array1

Input Arguments

collapse all

Approximate log-likelihood ratio (LLR) soft bits, specified as an 864-by-1 real-valued column vector.

Data Types:single|double

Polar decoding list length, specified as a power of 2.

Data Types:double

Number of candidate SS/PBCH blocks in a half frame, specified as4,8, or64.

Data Types:double

Physical layer cell identity number, specified as an integer from 0 to 1007.

Data Types:double

Output Arguments

collapse all

Decoded scrambled BCH transport block, returned as a 32-by-1 binary column vector.

Data Types:int8

Error flag to indicate whetherscrblkcontains an error, returned as0or1. IferrFlag1, then an error has occurred.

Data Types:uint32

Decoded and unscrambled BCH transport block, returned as a 24-by-1 binary column vector. The outputtrblk是theBCCH-BCH-Message, as defined in TS 38.331 Section 6.2.1[2]. TheBCCH-BCH-Messagecontains the master information block (MIB), as defined in TS 38.331 Section 6.2.2.

Data Types:logical

The four LSBs of the system frame number, returned as a 4-by-1 column vector.

Data Types:logical

Half frame bit in SS/PBCH block transmissions, returned as0indicating the first half of a frame or1indicating the second half of a frame. For more information, see TS 38.214 Section 4.1[3].

Data Types:logical

MSBs of index offset, returned as a scalar or 3-by-1 column vector.

  • Iflssb4or8,msbidxoffset是the decoded MSB of the subcarrier index, returned as a scalar.

  • Iflssb64, the entries ofmsbidxoffsetare the three decoded MSBs of the SSB index, returned as a 3-by-1 column vector.

Data Types:logical

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.331. “NR; Radio Resource Control (RRC) protocol specification.”3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[3]3GPP TS 38.214. “NR; Physical layer procedures for data.”3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

Extended Capabilities

Version History

Introduced in R2018b

expand all

Behavior changed in R2020a

See Also

Functions