%% Decode DCI Codeword
% Create a random sequence of binary values corresponding to a DCI message of 32 bits. Encode the message based on the specified RNTI and rate-matched DCI codeword length. The RNTI masks the CRC parity bits.

K = 32; 
rnti = 100; 
E = 240; 
dciBits = randi([0 1],K,1);
dcicw = nrDCIEncode(dciBits,rnti,E);

% Decode the soft bits representing the DCI codeword dcicw by specifying the RNTI used for the CRC masking. Set the length of the polar decoding list to 8.

L = 8;
[recBits,mask] = nrDCIDecode(1-2*dcicw,K,L,rnti)

% Verify that the transmitted and received message bits are identical.

isequal(recBits,dciBits)

% Verify that the decoding is without error. As the decoding specified the RNTI used for masking, a mask value of 0 indicates no error.

mask

% Copyright 2018 The MathWorks, Inc.