From cd07961aa509c0aab23134186c8efa0189efb915 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Wed, 21 Nov 2018 15:40:30 +0100 Subject: [PATCH] intermediate commit --- .../CODING/nrPolar_tools/nr_polar_decoder.c | 2 +- .../nrPolar_tools/nr_polar_decoding_tools.c | 2 +- .../CODING/nrPolar_tools/nr_polar_encoder.c | 3 ++- openair1/PHY/CODING/nr_polar_init.c | 8 +++--- openair1/PHY/INIT/nr_init.c | 25 ++++++++++--------- openair1/PHY/INIT/nr_init_ue.c | 2 +- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 6 ++--- openair1/PHY/defs_nr_UE.h | 1 + openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- openair1/SIMULATION/NR_PHY/dlsim.c | 6 ++++- 10 files changed, 33 insertions(+), 24 deletions(-) diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c index 2a2886dd2d..691b2191b6 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c @@ -1055,7 +1055,7 @@ void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) { else numbits=residue; for (int i=0;iinterleaving_pattern[(8*byte)+i]; -#if 1 +#if 0 printf("byte %d, i %d => ip %d\n",byte,i,ip); #endif ipmod64 = ip&63; diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c index b4159ad68a..bec322b946 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c @@ -219,8 +219,8 @@ decoder_node_t *add_nodes(int level,int first_leaf_index,t_nrPolar_params *pp) { decoder_node_t *new_node = new_decoder_node(first_leaf_index,level); #ifdef DEBUG_NEW_IMPL printf("New node %d order %d, level %d\n",pp->tree.num_nodes,Nv,level); - pp->tree.num_nodes++; #endif + pp->tree.num_nodes++; if (level==0) { #ifdef DEBUG_NEW_IMPL printf("leaf %d (%s)\n",first_leaf_index,pp->information_bit_pattern[first_leaf_index]==1 ? "information or crc" : "frozen"); diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c index bf5d76a19c..d25b96a7d6 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c @@ -317,7 +317,6 @@ void build_polar_tables(t_nrPolar_paramsPtr polarParams) { polarParams->cprime_tab1[byte][val] = 0; for (int i=0;ideinterleaving_pattern[(8*byte)+i]; - if (val==0) printf("%d => %d\n",(8*byte)+i,ip); AssertFatal(ip<128,"ip = %d\n",ip); bit_i=(val>>i)&1; if (ip<64) polarParams->cprime_tab0[byte][val] |= (((uint64_t)bit_i)< (%d:%d)\n",groupcnt,ccnt+1, firstingroup_in,firstingroup_in+ccnt, firstingroup_out,firstingroup_out+ccnt); +#endif if ((ccnt+1)encoderLength = NR_POLAR_PBCH_E; newPolarInitNode->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS; newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits);//G_P + printf("Initializing polar parameters for PBCH (K %d, E %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength); } else if (messageType == 1) { //DCI newPolarInitNode->n_max = NR_POLAR_DCI_N_MAX; newPolarInitNode->i_il = NR_POLAR_DCI_I_IL; @@ -87,6 +88,7 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams, newPolarInitNode->encoderLength = aggregation_level*108; newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS; newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P + printf("Initializing polar parameters for DCI (K %d, E %d, L %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength,aggregation_level); } else if (messageType == -1) { //UCI } else { diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 135d6099e0..b9b4ad38a9 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -124,10 +124,11 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, // PBCH DMRS gold sequences generation nr_init_pbch_dmrs(gNB); // Polar encoder init for PBCH + nr_polar_init(&gNB->nrPolar_params, - NR_POLAR_PBCH_MESSAGE_TYPE, - NR_POLAR_PBCH_PAYLOAD_BITS, - NR_POLAR_PBCH_AGGREGATION_LEVEL); + NR_POLAR_PBCH_MESSAGE_TYPE, + NR_POLAR_PBCH_PAYLOAD_BITS, + NR_POLAR_PBCH_AGGREGATION_LEVEL); //PDCCH DMRS init gNB->nr_gold_pdcch_dmrs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t**)); @@ -436,15 +437,15 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) fp->threequarter_fs = 0; LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,gNB_tx_antenna_ports %d,DL freq %u)\n", - Mod_id, - CC_id, - gNB_config->nfapi_config.rf_bands.rf_band[0], - gNB_config->rf_config.dl_carrier_bandwidth.value, - gNB_config->rf_config.ul_carrier_bandwidth.value, - gNB_config->sch_config.physical_cell_id.value, - gNB_config->rf_config.tx_antenna_ports.value, - fp->dl_CarrierFreq ); - + Mod_id, + CC_id, + gNB_config->nfapi_config.rf_bands.rf_band[0], + gNB_config->rf_config.dl_carrier_bandwidth.value, + gNB_config->rf_config.ul_carrier_bandwidth.value, + gNB_config->sch_config.physical_cell_id.value, + gNB_config->rf_config.tx_antenna_ports.value, + fp->dl_CarrierFreq ); + nr_init_frame_parms(gNB_config, fp); if (RC.gNB[Mod_id][CC_id]->configured == 1){ diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index a2385b998c..efc23e2793 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -955,7 +955,7 @@ void phy_init_nr_top(PHY_VARS_NR_UE *ue) generate_ul_reference_signal_sequences(SHRT_MAX); // Polar encoder init for PBCH - + ue->nrPolar_params = NULL; nr_polar_init(&ue->nrPolar_params, NR_POLAR_PBCH_MESSAGE_TYPE, diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 9c5ba6f1cb..ba96076969 100755 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -1426,9 +1426,9 @@ void nr_dci_decoding_procedure0(int s, uint32_t dci_estimation[4]={0}; - t_nrPolar_paramsPtr nrPolar_params = NULL; - nr_polar_init(&nrPolar_params, 1, 41, 8); - t_nrPolar_paramsPtr currentPtrDCI=nr_polar_params(nrPolar_params, 1, 41, 8); + t_nrPolar_paramsPtr nrPolar_params = pdcch_vars[eNB_id]->nrPolar_params; + nr_polar_init(&nrPolar_params, 1, sizeof_bits, L2); + t_nrPolar_paramsPtr currentPtrDCI=nr_polar_params(nrPolar_params, 1, sizeof_bits, L2); decoderState = polar_decoder_int16((int16_t*)&pdcch_vars[eNB_id]->e_rx[CCEind*9*6*2], dci_estimation, currentPtrDCI); diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 456ac0816f..ee9bae699a 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -893,6 +893,7 @@ typedef struct { //Check for specific DCIFormat and AgregationLevel uint8_t dciFormat; uint8_t agregationLevel; + t_nrPolar_paramsPtr nrPolar_params; #ifdef NR_PDCCH_DEFS_NR_UE int nb_searchSpaces; // CORESET structure, where maximum number of CORESETs to be handled is 3 (according to 38.331 V15.1.0) diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 86c49cd6d9..178a7256de 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -183,7 +183,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, num_dci = gNB->pdcch_vars.num_dci; if (num_dci) { - LOG_D(PHY, "[gNB %d] Frame %d subframe %d \ + LOG_I(PHY, "[gNB %d] Frame %d subframe %d \ Calling nr_generate_dci_top (number of DCI %d)\n", gNB->Mod_id, frame, subframe, num_dci); uint8_t slot_idx = gNB->pdcch_vars.dci_alloc[0].pdcch_params.first_slot; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index cc89f245fc..c7d1dc5bd5 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -375,6 +375,8 @@ int main(int argc, char **argv) RC.gNB = (PHY_VARS_gNB***) malloc(sizeof(PHY_VARS_gNB **)); RC.gNB[0] = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *)); RC.gNB[0][0] = malloc(sizeof(PHY_VARS_gNB)); + memset(RC.gNB[0][0],0,sizeof(PHY_VARS_gNB)); + gNB = RC.gNB[0][0]; gNB_config = &gNB->gNB_config; frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH) @@ -454,11 +456,12 @@ int main(int argc, char **argv) //configure UE UE = malloc(sizeof(PHY_VARS_NR_UE)); + memset((void*)UE,0,sizeof(PHY_VARS_NR_UE)); PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE**)); PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE*)); PHY_vars_UE_g[0][0] = UE; memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS)); - phy_init_nr_top(UE); + if (run_initial_sync==1) UE->is_synchronized = 0; else UE->is_synchronized = 1; @@ -562,6 +565,7 @@ int main(int argc, char **argv) } } + //Configure UE fapi_nr_dl_config_request_t dl_config; // Type0 PDCCH search space