Commit dd695beb authored by Raymond Knopp's avatar Raymond Knopp

functions up to Msg3 reception. Still a bug in decoding, signal is perfect,...

functions up to Msg3 reception. Still a bug in decoding, signal is perfect, but decoding fails. probably an issue in the descrambling
parent 7db69e3a
......@@ -177,9 +177,9 @@ void dci_encoding(uint8_t *a,
#endif
// encode dci
#ifdef DEBUG_DCI_ENCODING
printf("Doing DCI encoding for %d bits, e %p, rnti %x\n",A,e,rnti);
#endif
//#ifdef DEBUG_DCI_ENCODING
if (E>1000) printf("Doing DCI encoding for %d bits, e %p, rnti %x\n",A,e,rnti);
//#endif
memset((void *)d,LTE_NULL,96);
......@@ -197,42 +197,25 @@ void dci_encoding(uint8_t *a,
#endif
RCC = sub_block_interleaving_cc(D,d+96,w);
#ifdef DEBUG_DCI_ENCODING
printf("Doing DCI rate matching for %d channel bits, RCC %d, e %p\n",E,RCC,e);
#endif
//#ifdef DEBUG_DCI_ENCODING
if (E>1000) printf("Doing DCI rate matching for %d channel bits, RCC %d, e %p\n",E,RCC,e);
//#endif
lte_rate_matching_cc(RCC,E,w,e);
}
uint8_t *generate_dci0(uint8_t *dci,
uint8_t *e,
uint8_t DCI_LENGTH,
uint8_t aggregation_level,
uint8_t bitsperCCE,
uint16_t coded_bits,
uint16_t rnti)
{
uint16_t coded_bits;
uint8_t dci_flip[8];
AssertFatal((aggregation_level==1) ||
(aggregation_level==2) ||
(aggregation_level==4) ||
(aggregation_level==8)
#ifdef Rel14 // Added for EPDCCH/MPDCCH
||
(aggregation_level==16) ||
(aggregation_level==24) ||
(aggregation_level==32)
#endif
,
"generate_dci FATAL, illegal aggregation_level %d\n",aggregation_level);
coded_bits = bitsperCCE * aggregation_level;
/*
#ifdef DEBUG_DCI_ENCODING
......@@ -2293,8 +2276,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
e_ptr = generate_dci0(dci_alloc[i].dci_pdu,
e+(72*dci_alloc[i].firstCCE),
dci_alloc[i].dci_length,
dci_alloc[i].L,
72,
72*dci_alloc[i].L,
dci_alloc[i].rnti);
}
}
......
......@@ -164,12 +164,11 @@ int8_t delta_PUSCH_acc[4] = { -1, 0, 1, 3 };
int8_t *delta_PUCCH_lut = delta_PUSCH_acc;
void
conv_eMTC_rballoc (uint16_t resource_block_coding, uint32_t N_RB_DL, uint32_t * rb_alloc)
conv_eMTC_rballoc (uint8_t narrowband,uint16_t resource_block_coding, uint32_t N_RB_DL, uint32_t * rb_alloc)
{
int narrowband = resource_block_coding >> 5;
int RIV = resource_block_coding & 31;
int RIV = resource_block_coding;
int N_NB_DL = N_RB_DL / 6;
int i0 = (N_RB_DL >> 1) - (3 * N_NB_DL);
int first_rb = (6 * narrowband) + i0;
......@@ -177,6 +176,8 @@ conv_eMTC_rballoc (uint16_t resource_block_coding, uint32_t N_RB_DL, uint32_t *
int ind = first_rb >> 5;
int ind_mod = first_rb & 31;
AssertFatal(RIV<32,"RIV is %d > 31\n");
if (((N_RB_DL & 1) > 0) && (narrowband >= (N_NB_DL >> 1)))
first_rb++;
rb_alloc[0] = 0;
......@@ -2208,6 +2209,7 @@ fill_mdci_and_dlsch (PHY_VARS_eNB * eNB, eNB_rxtx_proc_t * proc, mDCI_ALLOC_t *
((DCI6_1A_10MHz_t *) dci_pdu)->type = 1;
((DCI6_1A_10MHz_t *) dci_pdu)->hopping = rel13->frequency_hopping_enabled_flag;
((DCI6_1A_10MHz_t *) dci_pdu)->rballoc = rel13->resource_block_coding;
((DCI6_1A_10MHz_t *) dci_pdu)->narrowband = rel13->mpdcch_narrow_band;
((DCI6_1A_10MHz_t *) dci_pdu)->mcs = rel13->mcs;
((DCI6_1A_10MHz_t *) dci_pdu)->rep = (rel13->pdsch_reptition_levels);
((DCI6_1A_10MHz_t *) dci_pdu)->harq_pid = rel13->harq_process;
......@@ -2218,8 +2220,22 @@ fill_mdci_and_dlsch (PHY_VARS_eNB * eNB, eNB_rxtx_proc_t * proc, mDCI_ALLOC_t *
((DCI6_1A_10MHz_t *) dci_pdu)->harq_ack_off = rel13->harq_resource_offset;
((DCI6_1A_10MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number;
LOG_I(PHY,"Frame %d, Subframe %d : Programming Format 6-1A DCI, mcs %d, rballoc %x, dci_rep r%d, L %d, narrowband %d, start_symbol %d, TPC %d, ra_flag %d, dci_type %d\n",
frame,subframe,rel13->mcs,rel13->resource_block_coding,1+rel13->dci_subframe_repetition_number,rel13->aggregation_level,rel13->mpdcch_narrow_band,dci_alloc->start_symbol,rel13->tpc,dci_alloc->ra_flag,rel13->rnti_type);
LOG_I(PHY,"Frame %d, Subframe %d : Programming Format 6-1A DCI, type %d, hopping %d, narrowband %d, rballoc %x, mcs %d, rep %d, harq_pid %d, ndi %d, rv %d, TPC %d, srs_req %d, harq_ack_off %d, dci_rep r%d => %x\n",
frame,subframe,
((DCI6_1A_10MHz_t *) dci_pdu)->type,
((DCI6_1A_10MHz_t *) dci_pdu)->hopping,
((DCI6_1A_10MHz_t *) dci_pdu)->narrowband,
((DCI6_1A_10MHz_t *) dci_pdu)->rballoc,
((DCI6_1A_10MHz_t *) dci_pdu)->mcs,
((DCI6_1A_10MHz_t *) dci_pdu)->rep,
((DCI6_1A_10MHz_t *) dci_pdu)->harq_pid,
((DCI6_1A_10MHz_t *) dci_pdu)->ndi,
((DCI6_1A_10MHz_t *) dci_pdu)->rv,
((DCI6_1A_10MHz_t *) dci_pdu)->TPC,
((DCI6_1A_10MHz_t *) dci_pdu)->srs_req,
((DCI6_1A_10MHz_t *) dci_pdu)->harq_ack_off,
((DCI6_1A_10MHz_t *) dci_pdu)->dci_rep,
((uint32_t*)dci_pdu)[0]);
break;
case 100:
dci_alloc->dci_length = sizeof_DCI6_1A_20MHz_t;
......@@ -2335,7 +2351,9 @@ fill_mdci_and_dlsch (PHY_VARS_eNB * eNB, eNB_rxtx_proc_t * proc, mDCI_ALLOC_t *
dlsch0->subframe_tx[(subframe + 2) % 10] = 1;
LOG_I(PHY,"PDSCH : resource_block_coding %x\n",rel13->resource_block_coding);
conv_eMTC_rballoc (rel13->resource_block_coding, fp->N_RB_DL, dlsch0_harq->rb_alloc);
conv_eMTC_rballoc (rel13->mpdcch_narrow_band,rel13->resource_block_coding,
fp->N_RB_DL,
dlsch0_harq->rb_alloc);
dlsch0_harq->nb_rb = RIV2nb_rb_LUT6[rel13->resource_block_coding & 31]; // this is the 6PRB RIV
......
......@@ -19,16 +19,16 @@
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/dci.c
* \brief Implements PDCCH physical channel TX/RX procedures (36.211) and DCI encoding/decoding (36.212/36.213). Current LTE compliance V8.6 2009-03.
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
/*! \file PHY/LTE_TRANSPORT/edci.c
* \brief Implements M/EPDCCH physical channel TX/RX procedures (36.211).
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#ifdef USER_MODE
#include <stdio.h>
#include <stdlib.h>
......@@ -84,15 +84,17 @@ void mpdcch_scrambling(LTE_DL_FRAME_PARMS * frame_parms, mDCI_ALLOC_t * mdci, ui
// rule for BL/CE UEs from Section 6.8.B2 in 36.211
x2 = ((((j0 + j) * Nacc) % 10) << 9) + mdci->dmrs_scrambling_init;
LOG_I(PHY,"MPDCCH cinit = %x (mdci->dmrs_scrambling_init = %d)\n",
x2,mdci->dmrs_scrambling_init);
LOG_I(PHY,"MPDCCH cinit = %x (mdci->dmrs_scrambling_init = %d), scrambling %d encoded DCI bits\n",
x2,mdci->dmrs_scrambling_init,length);
for (n = 0; n < length; n++) {
if ((i & 0x1f) == 0) {
if ((n & 0x1f) == 0) {
s = lte_gold_generic(&x1, &x2, reset);
//printf("lte_gold[%d]=%x\n",i,s);
reset = 0;
}
e[i] = (e[i] & 1) ^ ((s >> (i & 0x1f)) & 1);
e[n] = (e[n] & 1) ^ ((s >> (n & 0x1f)) & 1);
}
}
......@@ -101,12 +103,11 @@ void mpdcch_scrambling(LTE_DL_FRAME_PARMS * frame_parms, mDCI_ALLOC_t * mdci, ui
// 9 symbols without DMRS = 9*12*6 REs = 648 REs
// 4 symbols with DMRS (3 REs stolen per symbol = 4*9*6 REs = 216 REs
// Total = 648+216 = 864 REs = 1728 bits
static uint16_t mpdcch5ss1p107108tab[864];
static uint16_t mpdcch5ss1p109110tab[864];
static uint16_t mpdcch5ss1tab[864];
void init_mpdcch5ss1tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
{
int l, k, kmod, re107108 = 0, re109110 = 0;
int l, k, kmod, re=0;
LOG_I(PHY, "Inititalizing mpdcchss15tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n");
......@@ -114,20 +115,15 @@ void init_mpdcch5ss1tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
for (k = 0; k < 72; k++) {
kmod = k % 12;
if (((l != 5) && (l != 6) && (l != 12) && (l != 13)) || (kmod == 2) || (kmod == 3) || (kmod == 4) || (kmod == 7) || (kmod == 8) || (kmod == 9)) {
mpdcch5ss1p109110tab[re109110] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
mpdcch5ss1p107108tab[re107108] = mpdcch5ss1p109110tab[re109110];
re107108++;
re109110++;
printf("l %d, k %d (kmod %d) => re %d\n", l, k, kmod, re107108);
mpdcch5ss1tab[re] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
re++;
printf("l %d, k %d (kmod %d) => re %d\n", l, k, kmod, re);
} else if ((kmod == 0) || (kmod == 5) || (kmod == 10)) {
mpdcch5ss1p109110tab[re109110++] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
} else if ((kmod == 1) || (kmod == 6) || (kmod == 11)) {
mpdcch5ss1p107108tab[re107108++] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
printf("l %d, k %d (kmod %d) => re %d\n", l, k, kmod, re107108);
mpdcch5ss1tab[re++] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
}
}
}
AssertFatal(re107108 == 864, "RE count not equal to 864 (%d)\n", re107108);
AssertFatal(re == 864, "RE count not equal to 864 (%d)\n", re);
}
// this table is the allocation of modulated MPDCCH format 5 symbols to REs, antenna ports 107,108
......@@ -135,11 +131,11 @@ void init_mpdcch5ss1tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
// 8 symbols without DMRS = 8*12*6 REs = 576 REs
// 4 symbols with DMRS (3 REs stolen per symbol = 4*9*6 REs = 216 REs
// Total = 576+216 = 792 REs = 1584 bits
static uint16_t mpdcch5ss2p107108tab[792];
static uint16_t mpdcch5ss2p109110tab[792];
static uint16_t mpdcch5ss2tab[792];
void init_mpdcch5ss2tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
{
int l, k, kmod, re107108 = 0, re109110 = 0;
int l, k, kmod, re=0;
int nushift = eNB->frame_parms.Nid_cell % 6;
int nushiftp3 = (eNB->frame_parms.Nid_cell+3) % 6;
// NOTE : THIS IS FOR TM1 ONLY FOR NOW!!!!!!!
......@@ -149,24 +145,17 @@ void init_mpdcch5ss2tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
kmod = k % 12;
if ((((l == 4)||(l==11)) && (kmod != nushiftp3) && (kmod != (nushiftp3+6))) ||
((l == 7) && (kmod != nushift) &&(kmod != (nushift+6)))) { // CS RS
mpdcch5ss2p109110tab[re109110] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
mpdcch5ss2p107108tab[re107108] = mpdcch5ss2p109110tab[re109110];
re107108++;
re109110++;
printf("CSRS: l %d, k %d (kmod %d) => re %d\n", l, k, kmod, re107108);
mpdcch5ss2tab[re] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
re++;
}
if (((l!=4)&&(l!=7)&&(l!=11)) &&
(((l != 5) && (l != 6) && (l != 12) && (l != 13)) || (kmod == 2) || (kmod == 3) || (kmod == 4) || (kmod == 7) || (kmod == 8) || (kmod == 9))) {
mpdcch5ss2p109110tab[re109110] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
mpdcch5ss2p107108tab[re107108] = mpdcch5ss2p109110tab[re109110];
re107108++;
re109110++;
printf("l %d, k %d (kmod %d) => re %d\n", l, k, kmod, re107108);
mpdcch5ss2tab[re] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
re++;
}
}
}
AssertFatal(re107108 == 684, "RE count not equal to 684\n");
AssertFatal(re == 684, "RE count not equal to 684\n");
}
// this table is the allocation of modulated MPDCCH format 5 symbols to REs, antenna ports 107,108
......@@ -174,31 +163,24 @@ void init_mpdcch5ss2tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
// 7 symbols without DMRS = 7*12*6 REs = 504 REs
// 4 symbols with DMRS (3 REs stolen per symbol = 4*9*6 REs = 216 REs
// Total = 504+216 = 720 REs = 1440 bits
static uint16_t mpdcch5ss3p107108tab[720];
static uint16_t mpdcch5ss3p109110tab[720];
static uint16_t mpdcch5ss3tab[720];
void init_mpdcch5ss3tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
{
int l, k, kmod, re107108 = 0, re109110 = 0;
int l, k, kmod, re=0;
LOG_I(PHY, "Inititalizing mpdcch5ss3tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n");
for (l = 3; l < 14; l++) {
for (k = 0; k < 72; k++) {
kmod = k % 12;
if (((l != 5) && (l != 6) && (l != 12) && (l != 13)) || (kmod == 2) || (kmod == 3) || (kmod == 4) || (kmod == 7) || (kmod == 8) || (kmod == 9)) {
mpdcch5ss3p109110tab[re109110] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
mpdcch5ss3p107108tab[re107108] = mpdcch5ss3p109110tab[re109110];
re107108++;
re109110++;
printf("l %d, k %d (kmod %d) => re %d\n", l, k, kmod, re107108);
mpdcch5ss3tab[re] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
re++;
} else if ((kmod == 0) || (kmod == 5) || (kmod == 10)) {
mpdcch5ss3p109110tab[re109110++] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
} else if ((kmod == 1) || (kmod == 6) || (kmod == 11)) {
mpdcch5ss3p107108tab[re107108++] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
printf("l %d, k %d (kmod %d) => re %d\n", l, k, kmod, re107108);
mpdcch5ss3tab[re++] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
}
}
}
AssertFatal(re107108 == 720, "RE count not equal to 792\n");
AssertFatal(re == 720, "RE count not equal to 792\n");
}
// this table is the allocation of modulated MPDCCH format 3 symbols to REs, antenna ports 107,108
......@@ -206,20 +188,18 @@ void init_mpdcch5ss3tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
// 8 symbols without DMRS = 9*12*4 REs = 432 REs
// 4 symbols with DMRS (3 REs stolen per symbol = 4*9*4 REs = 144 REs
// Total = 432+144 = 576 = 16CCE*36RE/CCE
static uint16_t mpdcch3ss1p107108tab[576];
static uint16_t mpdcch3ss1p109110tab[576];
static uint16_t mpdcch3ss1tab[576];
void init_mpdcch3ss1tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
{
int l, k, kmod, re;
int l, k, kmod, re=0;
LOG_I(PHY, "Inititalizing mpdcch3ss1tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n");
for (l = 1, re = 0; l < 14; l++) {
for (k = 0; k < 48; k++) {
kmod = k % 12;
if (((l != 5) && (l != 6) && (l != 12) && (l != 13)) || (((l == 5) || (l == 6) || (l == 12) || (l == 13)) && (kmod != 0) && (kmod != 5) && (kmod != 10))) {
mpdcch3ss1p109110tab[re] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
mpdcch3ss1p107108tab[re] = 1 + mpdcch3ss1p109110tab[re];
mpdcch3ss1tab[re] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
re++;
}
}
......@@ -232,19 +212,18 @@ void init_mpdcch3ss1tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
// 8 symbols without DMRS = 9*12*2 REs = 216 REs
// 4 symbols with DMRS (3 REs stolen per symbol = 4*9*2 REs = 72 REs
// Total = 216+72 = 288 = 8CCE*36RE/CCE
static uint16_t mpdcch2ss1p107108tab[288];
static uint16_t mpdcch2ss1p109110tab[288];
static uint16_t mpdcch2ss1tab[288];
void init_mpdcch2ss1tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
{
int l, k, kmod, re;
int l, k, kmod, re=0;
LOG_I(PHY, "Inititalizing mpdcch2ss1tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n");
for (l = 1, re = 0; l < 14; l++) {
for (k = 0; k < 24; k++) {
kmod = k % 12;
if (((l != 5) && (l != 6) && (l != 12) && (l != 13)) || (((l == 5) || (l == 6) || (l == 12) || (l == 13)) && (kmod != 0) && (kmod != 5) && (kmod != 10))) {
mpdcch2ss1p109110tab[re] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
mpdcch2ss1p107108tab[re] = 1 + mpdcch2ss1p109110tab[re];
mpdcch2ss1tab[re] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
re++;
}
}
......@@ -255,7 +234,7 @@ void init_mpdcch2ss1tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
extern uint8_t *generate_dci0(uint8_t * dci, uint8_t * e, uint8_t DCI_LENGTH, uint8_t bitsperCCE, uint8_t aggregation_level, uint16_t rnti);
extern uint8_t *generate_dci0(uint8_t * dci, uint8_t * e, uint8_t DCI_LENGTH, uint16_t coded_bits, uint16_t rnti);
uint16_t mpdcch_dmrs_tab[12 * 6];
......@@ -307,6 +286,9 @@ void generate_mdci_top(PHY_VARS_eNB * eNB, int frame, int subframe, int16_t amp,
int symbol_offset = (uint32_t)fp->ofdm_symbol_size*(subframe*nsymb);
int wp[2][4] = {{1,1,1,1},{1,-1,1,-1}};
int *w;
LOG_I(PHY, "generate_mdci_top: num_dci %d\n", mpdcch->num_dci);
for (i = 0; i < mpdcch->num_dci; i++) {
......@@ -322,46 +304,41 @@ void generate_mdci_top(PHY_VARS_eNB * eNB, int frame, int subframe, int16_t amp,
// These are to avoid unimplemented things
AssertFatal(mdci->ce_mode == 1, "CE mode (%d) B not activated yet\n", mdci->ce_mode);
AssertFatal(mdci->L == 24, "Only 2+4 and aggregation 24 for now\n");
int a_index = mdci->rnti & 3;
LOG_I(PHY, "mdci %d, length %d: rnti %x, L %d, prb_pairs %d, ce_mode %d, i0 %d, ss %d Ant %d\n", i, mdci->dci_length,mdci->rnti, mdci->L, mdci->number_of_prb_pairs, mdci->ce_mode, mdci->i0, mdci->start_symbol,(a_index<2)?107:109);
int a_index=mdci->rnti & 3;
i0 = mdci->i0;
// antenna index
if ((mdci->start_symbol == 1) && (a_index < 2)) {
mpdcchtab = mpdcch5ss1p107108tab;
bitsperCCE = 72;
} else if ((mdci->start_symbol == 1) && (a_index > 1)) {
mpdcchtab = mpdcch5ss1p109110tab;
bitsperCCE = 72;
} else if ((mdci->start_symbol == 2) && (a_index < 2)) {
mpdcchtab = mpdcch5ss2p107108tab;
bitsperCCE = 66;
} else if ((mdci->start_symbol == 2) && (a_index > 1)) {
mpdcchtab = mpdcch5ss2p109110tab;
bitsperCCE = 66;
} else if ((mdci->start_symbol == 3) && (a_index < 2)) {
mpdcchtab = mpdcch5ss2p107108tab;
bitsperCCE = 60;
} else if ((mdci->start_symbol == 3) && (a_index < 2)) {
mpdcchtab = mpdcch5ss2p109110tab;
bitsperCCE = 60;
if (mdci->start_symbol == 1) {
mpdcchtab = mpdcch5ss1tab;
coded_bits = 756*2;
} else if (mdci->start_symbol == 2) {
mpdcchtab = mpdcch5ss2tab;
coded_bits=684*2;
} else if (mdci->start_symbol == 3) {
mpdcchtab = mpdcch5ss3tab;
coded_bits = 612*2;
} else
AssertFatal(1 == 0, "Illegal combination start_symbol %d, a_index %d\n", mdci->start_symbol, a_index);
LOG_I(PHY, "mdci %d, length %d: rnti %x, L %d, prb_pairs %d, ce_mode %d, i0 %d, ss %d ,coded_bits %d\n",
i, mdci->dci_length,mdci->rnti,
mdci->L, mdci->number_of_prb_pairs,
mdci->ce_mode, mdci->i0, mdci->start_symbol,
coded_bits);
// Note: We only have to run this every Nacc subframes during repetitions, data and scrambling are constant, but we do it for now to simplify during testing
generate_dci0(mdci->dci_pdu, mpdcch->e + (bitsperCCE * mdci->firstCCE), mdci->dci_length, mdci->L, bitsperCCE, mdci->rnti);
generate_dci0(mdci->dci_pdu, mpdcch->e, mdci->dci_length, coded_bits, mdci->rnti);
coded_bits = bitsperCCE * mdci->L;
// scrambling
uint16_t absSF = (frame * 10) + subframe;
AssertFatal(absSF < 10240, "Absolute subframe %d = %d*10 + %d > 10239\n", absSF, frame, subframe);
mpdcch_scrambling(fp, mdci, absSF, mpdcch->e + (bitsperCCE * mdci->firstCCE), coded_bits);
mpdcch_scrambling(fp, mdci, absSF, mpdcch->e, coded_bits);
// Modulation for PDCCH
if (fp->nb_antenna_ports_eNB == 1)
......@@ -398,7 +375,7 @@ void generate_mdci_top(PHY_VARS_eNB * eNB, int frame, int subframe, int16_t amp,
break;
}
int re_offset = fp->first_carrier_offset + (12 * nb_i0) + mdci->narrowband * 12 * 6;
int re_offset = fp->first_carrier_offset + (12 * nb_i0) + (mdci->narrowband * 12 * 6);
if (re_offset > fp->ofdm_symbol_size)
re_offset -= (fp->ofdm_symbol_size - 1);
int32_t *txF = &txdataF[0][symbol_offset+re_offset];
......@@ -410,15 +387,14 @@ void generate_mdci_top(PHY_VARS_eNB * eNB, int frame, int subframe, int16_t amp,
e_ptr++;
((int16_t *) & yIQ)[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
e_ptr++;
txF[mpdcchtab[i + ((bitsperCCE >> 1) * mdci->firstCCE)]] = yIQ;
//LOG_I(PHY,"Frame %d, subframe %d: mpdcch pos %d: %d => (%d,%d)\n",
// frame,subframe,i,mpdcchtab[i + ((bitsperCCE>>2) * mdci->firstCCE)],((int16_t *) & yIQ)[0],((int16_t *) & yIQ)[1]);
txF[mpdcchtab[i]] = yIQ;
LOG_D(PHY,"Frame %d, subframe %d: mpdcch pos %d (%d,%d) => (%d,%d)\n",
frame,subframe,i,mpdcchtab[i]+re_offset,mpdcchtab[i]/fp->ofdm_symbol_size,
((int16_t *) & yIQ)[0],((int16_t *) & yIQ)[1]);
}
if (a_index > 1)
off = 0;
else
off = 1;
if (mdci->transmission_type == 1) w=0; // distributed
else w = wp[a_index&1];
// pilot scrambling initiatlization (note: this is for a single repetition)
......@@ -449,22 +425,52 @@ void generate_mdci_top(PHY_VARS_eNB * eNB, int frame, int subframe, int16_t amp,
// add MPDCCH pilots
int reset = 1;
gain_lin_QPSK*=2;
for (i = 0; i < (24 * 6); i += 2) {
int first_prb = (mdci->narrowband*6) + nb_i0;
int last_prb = (mdci->narrowband*6) + nb_i0 + 5;
int soffset[4] = {5,6,12,13};
for (int lprime=0,i=0;lprime<4;lprime++) {
for (int nprb=0;nprb<110;nprb++) {
if (nprb<fp->N_RB_DL) {
re_offset = fp->first_carrier_offset + (12 * nprb);
if (re_offset > fp->ofdm_symbol_size)
re_offset -= (fp->ofdm_symbol_size - 1);
txF = &txdataF[0][symbol_offset + re_offset + fp->ofdm_symbol_size*soffset[lprime]];
}
for (int mprime=0;mprime<3;mprime++,i++) {
if ((i & 0x1f) == 0) {
s = lte_gold_generic(&x1, &x2, reset);
reset = 0;
}
// select PRBs corresponding to narrowband
if ((nprb>= first_prb) &&
(nprb<= last_prb)) {
((int16_t *) & yIQ)[0] = (((s >> (i & 0x1f)) & 1) == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
((int16_t *) & yIQ)[1] = (((s >> ((i + 1) & 0x1f)) & 1) == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
txF[mpdcch_dmrs_tab[(i >> 1)]] = yIQ;
txF[1+mpdcch_dmrs_tab[(i >> 1)]] = yIQ;
LOG_D(PHY, "mpdcch_dmrs pos %d: %d => (%d,%d)\n", i, off + mpdcch_dmrs_tab[(i >> 1)], ((int16_t *) & yIQ)[0], ((int16_t *) & yIQ)[1]);
if (mdci->transmission_type==1) { // same thing on both 107 and 109
txF[(5*mprime)] = yIQ;
txF[1+(5*mprime)] = yIQ;
}
else { // put on selected antenna port with w sequence
if (((mprime+nprb)&1) == 0)
txF[off+(5*mprime)] = yIQ*w[lprime];
else
txF[off+(5*mprime)] = yIQ*w[3-lprime];
}
LOG_I(PHY, "mpdcch_dmrs pos (dist %d, l %d,nprb %d,mprime %d) %d => (%d,%d)\n",
mdci->transmission_type, soffset[lprime],nprb,mprime,
re_offset + fp->ofdm_symbol_size*soffset[lprime]+(5*mprime),
((int16_t *) & yIQ)[0], ((int16_t *) & yIQ)[1]);
} // narrowband condition
} // RE (m') loop
} // nprb loop
} // symbol (l') loop
} // num_dci loop
}
void init_mpdcch(PHY_VARS_eNB * eNB)
......
......@@ -135,7 +135,7 @@ typedef struct DCI6_0A_10MHz DCI6_0A_10MHz_t;
/// basic DCI Format Type 6-1A (10 MHz, FDD primary carrier, 24 bits, 5 bit format, TM!=9,TM!=6, no scheduling enhancement)
struct DCI6_1A_10MHz {
/// padding to fill 32-bit word
uint32_t padding:4;
uint32_t padding:3;
/// DCI subframe repetition number
uint32_t dci_rep:2;
/// HARQ-ACK resource offset
......@@ -154,8 +154,10 @@ struct DCI6_1A_10MHz {
uint32_t rep:2;
/// Modulation and Coding Scheme and Redundancy Version
uint32_t mcs:4;
/// Resource block assignment (assignment flag = 0 for 10 MHz, ceil(log2(floor(N_RB_DL/6)))+5)
uint32_t rballoc:8;
/// Resource block assignment
uint32_t rballoc:5;
/// narroband index log2(floor(N_RB_DL/6))) bits
uint32_t narrowband:3;
/// Frequency hopping flag
uint32_t hopping:1;
/// 0/1A differentiator
......
......@@ -904,7 +904,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
//#ifdef DEBUG_ULSCH_DECODING
LOG_D(PHY,"Frame %d, Subframe %d: ulsch_decoding (Nid_cell %d, rnti %x, x2 %x): A %d, round %d, RV %d, O_r1 %d, O_RI %d, O_ACK %d, G %d\n",
LOG_I(PHY,"Frame %d, Subframe %d: ulsch_decoding (Nid_cell %d, rnti %x, x2 %x): A %d, round %d, RV %d, O_r1 %d, O_RI %d, O_ACK %d, G %d\n",
proc->frame_rx,subframe,
frame_parms->Nid_cell,ulsch->rnti,x2,
A,
......
......@@ -212,23 +212,7 @@ pdsch_procedures (PHY_VARS_eNB * eNB, eNB_rxtx_proc_t * proc, int harq_pid, LTE_
LOG_I (PHY,
"[eNB %" PRIu8 "][PDSCH %" PRIx16 "/%" PRIu8 "] Frame %d, subframe %d: Generating PDSCH/DLSCH with input size = %" PRIu16 ", pdsch_start %d, G %d, nb_rb %" PRIu16 ", rb0 %x, rb1 %x, TBS %"
PRIu16 ", pmi_alloc %" PRIx64 ", rv %" PRIu8 " (round %" PRIu8 ")\n", eNB->Mod_id, dlsch->rnti, harq_pid, frame, subframe, input_buffer_length, dlsch_harq->pdsch_start, get_G (fp,
dlsch_harq->
nb_rb,
dlsch_harq->
rb_alloc,
dlsch_harq->
Qm,
dlsch_harq->
Nl,
dlsch_harq->
pdsch_start,
frame,
subframe,
dlsch_harq->
mimo_mode ==
TM7 ? 7 : 0),
dlsch_harq->nb_rb, dlsch_harq->rb_alloc[0], dlsch_harq->rb_alloc[1], dlsch_harq->TBS, pmi2hex_2Ar1 (dlsch_harq->pmi_alloc), dlsch_harq->rvidx, dlsch_harq->round);
PRIu16 ", pmi_alloc %" PRIx64 ", rv %" PRIu8 " (round %" PRIu8 ")\n", eNB->Mod_id, dlsch->rnti, harq_pid, frame, subframe, input_buffer_length, dlsch_harq->pdsch_start, get_G(fp,dlsch_harq->nb_rb,dlsch_harq->rb_alloc,dlsch_harq->Qm,dlsch_harq->Nl,dlsch_harq->pdsch_start,frame,subframe,dlsch_harq->mimo_mode == TM7 ? 7 : 0),dlsch_harq->nb_rb, dlsch_harq->rb_alloc[0], dlsch_harq->rb_alloc[1], dlsch_harq->TBS, pmi2hex_2Ar1 (dlsch_harq->pmi_alloc), dlsch_harq->rvidx, dlsch_harq->round);
}
#if defined(MESSAGE_CHART_GENERATOR_PHY)
MSC_LOG_TX_MESSAGE (MSC_PHY_ENB, MSC_PHY_UE,
......@@ -399,9 +383,10 @@ phy_procedures_eNB_TX (PHY_VARS_eNB * eNB, eNB_rxtx_proc_t * proc, relaying_type
if (num_mdci > 0) {
LOG_I (PHY, "[eNB %" PRIu8 "] Frame %d, subframe %d: Calling generate_mdci_top (mpdcch) (num_dci %" PRIu8 ")\n", eNB->Mod_id, frame, subframe, num_mdci);
generate_mdci_top (eNB, frame, subframe, AMP*3/4, eNB->common_vars.txdataF);
//write_output("/tmp/mpdcch.m","mpdcch_txF",(void*)&eNB->common_vars.txdataF[0][subframe*14*1024],14*1024,1,1);
//exit(-1);
generate_mdci_top (eNB, frame, subframe, AMP, eNB->common_vars.txdataF);
/* write_output("/tmp/mpdcch.m","mpdcch_txF",(void*)&eNB->common_vars.txdataF[0][subframe*14*1024],14*1024,1,1);
exit(-1);*/
}
#endif
// Now scan UE specific DLSCH
......@@ -1130,8 +1115,11 @@ pusch_procedures (PHY_VARS_eNB * eNB, eNB_rxtx_proc_t * proc)
fill_crc_indication (eNB, i, frame, subframe, 1); // indicate NAK to MAC
fill_rx_indication (eNB, i, frame, subframe); // indicate SDU to MAC
LOG_D (PHY, "[eNB %d][PUSCH %d] frame %d subframe %d UE %d Error receiving ULSCH, round %d/%d (ACK %d,%d)\n",
LOG_I (PHY, "[eNB %d][PUSCH %d] frame %d subframe %d UE %d Error receiving ULSCH, round %d/%d (ACK %d,%d)\n",
eNB->Mod_id, harq_pid, frame, subframe, i, ulsch_harq->round - 1, ulsch->Mlimit, ulsch_harq->o_ACK[0], ulsch_harq->o_ACK[1]);
dump_ulsch(eNB,frame,subframe,i);
exit(-1);
if (ulsch_harq->round >= 3) {
ulsch_harq->status = SCH_IDLE;
ulsch_harq->handled = 0;
......
......@@ -247,7 +247,7 @@ generate_Msg2 (module_id_t module_idP, int CC_idP, frame_t frameP, sub_frame_t s
reps = (rmax <= 8) ? (1 << rep) : (rmax >> (3 - rep));
// get narrowband according to higher-layer config
num_nb = p[RA_template->rach_resource_type - 1]->mpdcch_NarrowbandsToMonitor_r13.list.count;
RA_template->msg2_narrowband = *p[RA_template->rach_resource_type - 1]->mpdcch_NarrowbandsToMonitor_r13.list.array[RA_template->preamble_index % num_nb];
RA_template->msg2_narrowband = *p[RA_template->rach_resource_type - 1]->mpdcch_NarrowbandsToMonitor_r13.list.array[RA_template->preamble_index % num_nb]-1;
first_rb = narrowband_to_first_rb (&cc[CC_idP], RA_template->msg2_narrowband);
if ((RA_template->msg2_mpdcch_repetition_cnt == 0) && (mpdcch_sf_condition (eNB, CC_idP, frameP, subframeP, rmax, TYPE2, -1) > 0)) {
......@@ -274,8 +274,9 @@ generate_Msg2 (module_id_t module_idP, int CC_idP, frame_t frameP, sub_frame_t s
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = cc[CC_idP].physCellId;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = 6000; // 0dB
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV (6, 0, 6) | (RA_template->msg2_narrowband<<5);
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 1; // adjust according to size of RAR, 208 bits with N1A_PRB=3
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = RA_template->msg2_narrowband;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV (6, 0, 6);
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 0; // adjust according to size of RAR, 208 bits with N1A_PRB=3
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = 4; // fix to 4 for now
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = 0;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = 0;
......@@ -286,7 +287,7 @@ generate_Msg2 (module_id_t module_idP, int CC_idP, frame_t frameP, sub_frame_t s
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi = 0;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = 0;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = rep;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 0; // N1A_PRB=2 (36.212);
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 1; // N1A_PRB=3 (36.212) => 56 bits
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = 0;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = 0;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = 0;
......@@ -628,7 +629,7 @@ generate_Msg4 (module_id_t module_idP, int CC_idP, frame_t frameP, sub_frame_t s
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = 6000; // 0dB
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV (6, 0, 6); // check if not getRIV(N_RB_DL,first_rb,6);
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 4; // adjust according to size of Msg4, 208 bits with N1A_PRB=3
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 0; // adjust according to size of Msg4, 208 bits with N1A_PRB=3
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = 4; // fix to 4 for now
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = 0;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = 0;
......@@ -639,7 +640,7 @@ generate_Msg4 (module_id_t module_idP, int CC_idP, frame_t frameP, sub_frame_t s
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi = 0;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = 0;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = rep;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 1; // N1A_PRB=3; => 208 bits
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 1; // N1A_PRB=3; =>
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = 0;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = 0;
dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = 0;
......@@ -1160,13 +1161,14 @@ initiate_ra_proc (module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
LOG_I (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d Initiating RA procedure for preamble index %d\n", module_idP, CC_id, frameP, subframeP, preamble_index);
#ifdef Rel14
LOG_I (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d PRACH resource type %d\n", module_idP, CC_id, frameP, subframeP, rach_resource_type);
#endif
if (prach_ParametersListCE_r13 && prach_ParametersListCE_r13->list.count < rach_resource_type) {
LOG_E (MAC, "[eNB %d][RAPROC] CC_id %d Received impossible PRACH resource type %d, only %d CE levels configured\n",
module_idP, CC_id, rach_resource_type, (int) prach_ParametersListCE_r13->list.count);
return;
}
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME (VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 1);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME (VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 0);
......
......@@ -139,7 +139,7 @@ unsigned short fill_rar_br(eNB_MAC_INST *eNB,
uint8_t *rar = (uint8_t *)(dlsch_buffer+1);
int i;
uint8_t nb,rballoc,reps;
uint8_t rballoc,reps;
uint8_t mcs,TPC,ULdelay,cqireq,mpdcch_nb_index;
int input_buffer_length;
......@@ -158,7 +158,7 @@ unsigned short fill_rar_br(eNB_MAC_INST *eNB,
// Copy the Msg2 narrowband
RA_template->msg34_narrowband = RA_template->msg2_narrowband;
RA_template->msg3_first_rb = ce_level;
RA_template->msg3_first_rb = 0;
RA_template->msg3_nb_rb = 2;
if (ce_level<2) { //CE Level 0,1, CEmodeA
......@@ -170,24 +170,24 @@ unsigned short fill_rar_br(eNB_MAC_INST *eNB,
rar[5] = (uint8_t)(RA_template->rnti&0xff);
//cc->RA_template[ra_idx].timing_offset = 0;
nb = 0;
reps = 0;
mcs = 7;
RA_template->msg3_mcs = 7;
TPC = 3; // no power increase
ULdelay = 0;
cqireq = 0;
mpdcch_nb_index = 0;
rballoc = mac_computeRIV(6,RA_template->msg3_first_rb,RA_template->msg3_nb_rb); // one PRB only for UL Grant in position 1+ce_level within Narrowband
rballoc = mac_computeRIV(6,RA_template->msg3_first_rb,RA_template->msg3_nb_rb);
unsigned int buffer = 0;
buffer |= N_NB_index << (16 + (4 - N_NB_index));
buffer |= RA_template->msg34_narrowband << (16 + (4 - N_NB_index));
buffer |= ((rballoc & 0xFF) << (12 + (4 - N_NB_index)));
buffer |= ((reps & 0x03) << (10 + (4 - N_NB_index)));
buffer |= ((mcs & 0x07) << (7 + (4 - N_NB_index)));
buffer |= ((RA_template->msg3_mcs & 0x07) << (7 + (4 - N_NB_index)));
buffer |= ((TPC & 0x07) << (4 + (4 - N_NB_index)));
buffer |= ((cqireq & 0x01) << (3 + (4 - N_NB_index)));
buffer |= ((ULdelay & 0x01) << (2 + (4 - N_NB_index)));
buffer |= ((ULdelay & 0x01) << (4 - N_NB_index));
rar[1] = (buffer>>12) & 0x0F;
buffer |= (mpdcch_nb_index << (4 - N_NB_index));
rar[1] = (buffer>>16) & 0x0F;
rar[2] = (buffer>>8) & 0xFF;
rar[3] = buffer&0xFF;
}
......
......@@ -256,7 +256,7 @@ eNBs =
numRepetitionPerPreambleAttempt_r13 = "n1"; #0
mpdcch_NumRepetition_RA_r13 = "r1"; #0
prach_HoppingConfig_r13 = "off"; #1
max_available_narrow_band = [2];
max_available_narrow_band = [3];
}
);
......@@ -355,7 +355,7 @@ eNBs =
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.12.26";
mme_ip_address = ( { ipv4 = "127.0.0.3";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
......@@ -365,10 +365,10 @@ eNBs =
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.150/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.150/24";
ENB_INTERFACE_NAME_FOR_S1_MME = "lo";
ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24";
ENB_INTERFACE_NAME_FOR_S1U = "lo";
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.4/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment