%% DCI Decoding with ENB Structure
% Perform DCI decoding of a sample codeword and return the decoded vector, decodedDCIbits, of the length defined for the DCI Format 1 message. The lteDCIDecode function uses fields in enb to determine DCI length.

enb.NDLRB = 25;
enb.CellRefP = 1;
enb.DuplexMode = 'FDD';

dciInfo = lteDCIInfo(enb);
dcilen = dciInfo.Format1

ue.PDCCHFormat = 1;
ue.RNTI = 7;
ue.NDLRB = 25;

dciBits = zeros(dcilen,1);
cw = lteDCIEncode(ue,dciBits);

%
% Define the enb configuration structure for recovery of the DCI message and RNTI. Perform DCI decoding using enb.

enb.DCIFormat = 'Format1';

[decodedDCIbits,crcRNTI] = lteDCIDecode(enb,cw);

decodedDCIbitslen = size(decodedDCIbits)
crcRNTI

% The decodedDCIbits length matches the value of dcilen. The crcRNTI value recovered corresponds to and matches ue.RNTI, which is the RNTI value used in the CRC masking.
% Copyright 2012 The MathWorks, Inc.