Introduction
The physical frame structure of LTE provides all the possible ways of resource allocation. It explain combination of Time Domain, Frequency Domain and modulation scheme. For example in frequency domain 100 Resource Blocks in case of 20 Mhz Bandwidth and if you think of all the possible permutation of these variables, the number of possible resource allocation will be very huge.
Then the question is, How can the receiver side can figure out exactly where in the slot and in which modulation scheme that the transmitter transmit the data in which subframe? And the answer is DCI Downlink Control Indicator.
It is DCI which carries all these informations
- Which resource block carries your data ?
- What kind of demodulation scheme you have to use to decode data ?
- Some other additional information.
Not only in LTE, but all wireless communication the reciever requires special information structure like DCI. For example, in 3G Slot format and TFCI carries those information
LTE DCI has a lot more additional information in it. In addition to resource allocation, it can carry Power Control Command, CSI Report Request or CQI Report Request etc.
Then Question would be which DCI format we have to use for a specific situation.
DCI carries the following information :
- UL Resource Allocation
- DL Data Transmitted to Ue
L1 signaling is done by DCI and Up to 8 DCIs can be configured in the PDCCH. These DCIs can have 6 formats :
- 1 format for UL scheduling
- 2 formats for Non-MIMO DL scheduling
- 1 format for MIMO DL Scheduling
- 2 formats for UL power control.
Python Script
This code is not a complete DCI decoder, here we are just unpacking the hex string into each DCI field based on dci structure
As a user you need to provide the correct DCI structure to code yourself.
The number of bits in a DCI may be different depending on factors (Bandwidth or TDD vs FDD or Resource Allocation Type or the number of Antenna). So even for the same DCI format, you may have to define multiple different structures.
I will try to add more specific DCI structure in future.
# The first Record (Row)
# the first field = Total Bit Length of the DCI,
# the second field = Data Type to be printed.
# the third field = the description of the field
# All the other records (Rows)
# the first field = Bit Length of the specified field,
# the second field = Data Type to be printed.
# If it is "BIN", the field is printed in Binary.
# If it is "DEC", the field is printed in Binary and Decimal.
# the third field = the description of the field
dci0_10M_FDD_NoHop_Rel8 = [
[25,"DEC","DCI 0 (Rel 8)"],
[1,"BIN","Format0-A-Flag"],
[1,"BIN","Frequency Hopping"],
[11,"DEC","RIV"],
[5,"DEC","MCS"],
[1,"BIN","NDI"],
[2,"DEC","TPC"],
[3,"DEC","Cyclic Shift"],
[1,"BIN","CQI Request"]
]
dci0_10M_FDD_Hop_Rel8 = [
[25,"DEC","DCI 0 (Rel 8)"],
[1,"BIN","Format0-A-Flag"],
[1,"BIN","Frequency Hopping"],
[2,"DEC","NUL-hop"],
[9,"DEC","RIV"],
[5,"DEC","MCS"],
[1,"BIN","NDI"],
[2,"DEC","TPC"],
[3,"DEC","Cyclic Shift"],
[1,"BIN","CQI Request"]
]
dci2_20M_FDD_4x4_RA0 = [
[54,"DEC","DCI 2"],
[1,"BIN","Resource allocation header"],
[25,"BIN","Resource block assignment for RA Type 0"],
[2,"BIN","TPC for PUCCH"],
[3,"DEC","HARQ Process"],
[1,"BIN","Transport block to codeword swap flag"],
[5,"DEC","MCS for Transport Block 1"],
[1,"BIN","NDI for Transport Block 1"],
[2,"DEC","RV for Transport Block 1"],
[5,"DEC","MCS for Transport Block 2"],
[1,"BIN","NDI for Transport Block 2"],
[2,"DEC","RV for Transport Block 2"],
[6,"DEC","Precoding Information"]
]
#dciStructure = dci0_10M_FDD_NoHop_Rel8
dciStructure = dci0_10M_FDD_Hop_Rel8
#dciStructure = dci2_20M_FDD_4x4_RA0
#dciStr='2584A800' #Test for dci0_10M_FDD_NoHop_Rel8
dciStr='48720800' #Test for dci0_10M_FDD_Hop_Rel8
#dciStr='7FFFFFD0808088' #dci2_20M_FDD_4x4_RA0
#dciStr='7FFFFFD2808088' #dci2_20M_FDD_4x4_RA0
#dciStr='7FFFFFC2848400' #dci2_20M_FDD_4x4_RA0
LengthInBytes = int(len(dciStr)/2)
dciNumbers = binascii.a2b_hex(dciStr)
PayloadByteArray = bytearray(dciNumbers)
PayloadBytes = PayloadByteArray[0:LengthInBytes]
PayloadInt = int.from_bytes(PayloadBytes, 'big')
PayloadBin = '{0:0{1}b}'.format(PayloadInt,LengthInBytes*8)
startBit = 0
for i in range(len(dciStructure)):
[length,pType,description] = dciStructure[i]
if(i == 0) :
print("====================================================================================");
print(description," : Payload Length = ",length);
print("====================================================================================");
print(dciStr,"(HEX)")
print(PayloadBin)
print("------------------------------------------------------------------------------------");
else :
fieldBits = PayloadBin[startBit : startBit + length]
if(pType == "BIN") :
print(fieldBits,"(BIN):",description)
else :
print(fieldBits,"(BIN) = ",int(fieldBits,2),"(DEC) :",description)
startBit = startBit + length
#print('{0:0{1}b}'.format(int(fieldBits,2),startBit),":",pType,":",description)
#startBit = startBit + length
print("------------------------------------------------------------------------------------");
print("Total Decoded Bits = ",startBit)
print("====================================================================================");
Output
============================================================================
DCI 0 (Rel 8) : Payload Length = 25
============================================================================
2584A800 (HEX)
00100101100001001010100000000000
--------------------------------------------------------------------------
0 (BIN): Format0-A-Flag
0 (BIN): Frequency Hopping
10010110000 (BIN) = 1200 (DEC) : RIV
10010 (BIN) = 18 (DEC) : MCS
1 (BIN): NDI
01 (BIN) = 1 (DEC) : TPC
000 (BIN) = 0 (DEC) : Cyclic Shift
0 (BIN): CQI Request
---------------------------------------------------------------------------
Total Decoded Bits = 25
============================================================================
============================================================================
DCI 0 (Rel 8) : Payload Length = 25
===========================================================================
48720800 (HEX)
01001000011100100000100000000000
----------------------------------------------------------------------------
0 (BIN): Format0-A-Flag
1 (BIN): Frequency Hopping
00 (BIN) = 0 (DEC) : NUL-hop
100001110 (BIN) = 270 (DEC) : RIV
01000 (BIN) = 8 (DEC) : MCS
0 (BIN): NDI
01 (BIN) = 1 (DEC) : TPC
000 (BIN) = 0 (DEC) : Cyclic Shift
0 (BIN): CQI Request
----------------------------------------------------------------------------
Total Decoded Bits = 25
===========================================================================
============================================================================
DCI 2 : Payload Length = 54
============================================================================
7FFFFFC2848400 (HEX)
01111111111111111111111111000010100001001000010000000000
----------------------------------------------------------------------------
0 (BIN): Resource allocation header
1111111111111111111111111 (BIN): Resource block assignment for RA Type 0
00 (BIN): TPC for PUCCH
001 (BIN) = 1 (DEC) : HARQ Process
0 (BIN): Transport block to codeword swap flag
10000 (BIN) = 16 (DEC) : MCS for Transport Block 1
1 (BIN): NDI for Transport Block 1
00 (BIN) = 0 (DEC) : RV for Transport Block 1
10000 (BIN) = 16 (DEC) : MCS for Transport Block 2
1 (BIN): NDI for Transport Block 2
00 (BIN) = 0 (DEC) : RV for Transport Block 2
000000 (BIN) = 0 (DEC) : Precoding Information
----------------------------------------------------------------------------
Total Decoded Bits = 54
============================================================================
============================================================================
DCI 2 : Payload Length = 54
============================================================================
7FFFFFD0808088 (HEX)
01111111111111111111111111010000100000001000000010001000
----------------------------------------------------------------------------
0 (BIN): Resource allocation header
1111111111111111111111111 (BIN): Resource block assignment for RA Type 0
01 (BIN): TPC for PUCCH
000 (BIN) = 0 (DEC) : HARQ Process
0 (BIN): Transport block to codeword swap flag
10000 (BIN) = 16 (DEC) : MCS for Transport Block 1
0 (BIN): NDI for Transport Block 1
00 (BIN) = 0 (DEC) : RV for Transport Block 1
10000 (BIN) = 16 (DEC) : MCS for Transport Block 2
0 (BIN): NDI for Transport Block 2
00 (BIN) = 0 (DEC) : RV for Transport Block 2
100010 (BIN) = 34 (DEC) : Precoding Information
----------------------------------------------------------------------------
Total Decoded Bits = 54
============================================================================
============================================================================
DCI 2 : Payload Length = 54
============================================================================
7FFFFFD2808088 (HEX)
01111111111111111111111111010010100000001000000010001000
----------------------------------------------------------------------------
0 (BIN): Resource allocation header
1111111111111111111111111 (BIN): Resource block assignment for RA Type 0
01 (BIN): TPC for PUCCH
001 (BIN) = 1 (DEC) : HARQ Process
0 (BIN): Transport block to codeword swap flag
10000 (BIN) = 16 (DEC) : MCS for Transport Block 1
0 (BIN): NDI for Transport Block 1
00 (BIN) = 0 (DEC) : RV for Transport Block 1
10000 (BIN) = 16 (DEC) : MCS for Transport Block 2
0 (BIN): NDI for Transport Block 2
00 (BIN) = 0 (DEC) : RV for Transport Block 2
100010 (BIN) = 34 (DEC) : Precoding Information
----------------------------------------------------------------------------
Total Decoded Bits = 54
============================================================================