Commit 10c62314 authored by Matthieu Kanj's avatar Matthieu Kanj

improving code structure

parent 3980842f
...@@ -59,6 +59,8 @@ int ul_channel_estimation_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -59,6 +59,8 @@ int ul_channel_estimation_NB_IoT(PHY_VARS_eNB *eNB,
unsigned char l, unsigned char l,
unsigned char Ns, unsigned char Ns,
uint8_t N_sc_RU, uint8_t N_sc_RU,
uint8_t pilot_pos1,
uint8_t pilot_pos2,
uint8_t cooperation_flag); uint8_t cooperation_flag);
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -145,15 +145,17 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext, ...@@ -145,15 +145,17 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext,
int32_t **ul_ch_estimates, int32_t **ul_ch_estimates,
uint8_t l, //symbol within slot uint8_t l, //symbol within slot
uint8_t Ns, uint8_t Ns,
uint8_t counter_msg3, uint8_t counter_msg3, /// should be replaced by the number of the received part of UL data
uint8_t pilot_pos1,
uint8_t pilot_pos2,
uint32_t I_sc,
uint8_t Qm,
LTE_DL_FRAME_PARMS *frame_parms) LTE_DL_FRAME_PARMS *frame_parms)
{ {
//int pilot_pos1 = 3, pilot_pos2 = 10; // holds for npusch format 1, and 15 kHz subcarrier bandwidth
int pilot_pos1 = 3, pilot_pos2 = 10; // holds for npusch format 1, and 15 kHz subcarrier bandwidth
uint16_t ul_sc_start; // subcarrier start index into UL RB uint16_t ul_sc_start; // subcarrier start index into UL RB
uint8_t Qm = 2; // needed to rotate the estimated channel //uint8_t Qm = 2; // needed to rotate the estimated channel
uint32_t u; //for group hopping uint32_t u; //for group hopping
uint32_t I_sc = 11;
int symbol_offset; int symbol_offset;
uint16_t aa,k,n; uint16_t aa,k,n;
//int32_t **ul_ch_estimates=pusch_vars->drs_ch_estimates[eNB_id]; //int32_t **ul_ch_estimates=pusch_vars->drs_ch_estimates[eNB_id];
...@@ -164,9 +166,10 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext, ...@@ -164,9 +166,10 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext,
int32_t *p_average_channel = (int32_t *)&average_channel; int32_t *p_average_channel = (int32_t *)&average_channel;
int16_t *ul_ch1, *ul_ch2; int16_t *ul_ch1, *ul_ch2;
u=0; //Ncell_ID%16; u= frame_parms->Nid_cell % 16; //Ncell_ID%16;
ul_sc_start = get_UL_sc_start_NB_IoT(I_sc); // NB-IoT: get the used subcarrier in RB ul_sc_start = get_UL_sc_start_NB_IoT(I_sc); // NB-IoT: get the used subcarrier in RB // I_sc = 11 for testing
symbol = l + 7*(Ns&1); symbol = l + 7*(Ns&1);
if (l == pilot_pos1) if (l == pilot_pos1)
{ {
symbol_offset = frame_parms->N_RB_UL*12*(l+(7*(Ns&1))); symbol_offset = frame_parms->N_RB_UL*12*(l+(7*(Ns&1)));
...@@ -223,12 +226,9 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext, ...@@ -223,12 +226,9 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext,
printf(" re_chest_av = %d im_chest_av = %d ",ul_ch2[k<<1],ul_ch2[1+(k<<1)]); printf(" re_chest_av = %d im_chest_av = %d ",ul_ch2[k<<1],ul_ch2[1+(k<<1)]);
} }
printf("\n");*/ printf("\n");*/
} }
} }
} }
return(0); return(0);
} }
...@@ -275,6 +275,8 @@ int32_t ul_channel_estimation_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -275,6 +275,8 @@ int32_t ul_channel_estimation_NB_IoT(PHY_VARS_eNB *eNB,
unsigned char l, unsigned char l,
unsigned char Ns, unsigned char Ns,
uint8_t N_sc_RU, uint8_t N_sc_RU,
uint8_t pilot_pos1,
uint8_t pilot_pos2,
uint8_t cooperation_flag) uint8_t cooperation_flag)
{ {
...@@ -300,7 +302,7 @@ int32_t ul_channel_estimation_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -300,7 +302,7 @@ int32_t ul_channel_estimation_NB_IoT(PHY_VARS_eNB *eNB,
int pilot_pos1_3_75k = 4, pilot_pos2_3_75k = 11; // holds for npusch format 1, and 3.75 kHz subcarrier bandwidth int pilot_pos1_3_75k = 4, pilot_pos2_3_75k = 11; // holds for npusch format 1, and 3.75 kHz subcarrier bandwidth
int pilot_pos_format2_3_75k[6] = {0,1,2,7,8,9}; // holds for npusch format 2, and 3.75 kHz subcarrier bandwidth int pilot_pos_format2_3_75k[6] = {0,1,2,7,8,9}; // holds for npusch format 2, and 3.75 kHz subcarrier bandwidth
int pilot_pos1, pilot_pos2; // holds for npusch format 1, and 15 kHz subcarrier bandwidth //int pilot_pos1, pilot_pos2; // holds for npusch format 1, and 15 kHz subcarrier bandwidth
int *pilot_pos_format2; // holds for npusch format 2, and 15 kHz subcarrier bandwidth int *pilot_pos_format2; // holds for npusch format 2, and 15 kHz subcarrier bandwidth
int16_t *ul_ch1=NULL, *ul_ch2=NULL, *ul_ch3=NULL, *ul_ch4=NULL, *ul_ch5=NULL, *ul_ch6=NULL; int16_t *ul_ch1=NULL, *ul_ch2=NULL, *ul_ch3=NULL, *ul_ch4=NULL, *ul_ch5=NULL, *ul_ch6=NULL;
int16_t average_channel[24]; // average channel over a RB and 2 slots int16_t average_channel[24]; // average channel over a RB and 2 slots
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/*! \file PHY/LTE_TRANSPORT/lte_mcs_NB_IoT.c /*! \file PHY/LTE_TRANSPORT/lte_mcs_NB_IoT.c
* \brief Some support routines for subcarrier start into UL RB for ULSCH * \brief Some support routines for subcarrier start into UL RB for ULSCH
* \author V. Savaux * \author V. Savaux, M. KANJ
* \date 2017 * \date 2017
* \version 0.1 * \version 0.1
* \company b<>com * \company b<>com
...@@ -38,23 +38,29 @@ ...@@ -38,23 +38,29 @@
uint16_t get_UL_sc_start_NB_IoT(uint16_t I_sc) uint16_t get_UL_sc_start_NB_IoT(uint16_t I_sc)
{ {
if (0<=I_sc && I_sc<=11){ if (0<=I_sc && I_sc<=11)
{
return I_sc; return I_sc;
}
if (12<=I_sc && I_sc<=15){ } else if (12<=I_sc && I_sc<=15) {
return 3*(I_sc-12); return 3*(I_sc-12);
}
if (16<=I_sc && I_sc<=17){ } else if (16<=I_sc && I_sc<=17) {
return 6*(I_sc-16); return 6*(I_sc-16);
}
if (I_sc==18){ } else if (I_sc==18){
return 0; return 0;
}
if (I_sc>18){ } else if (I_sc>18 || I_sc<0){
return -1;
return -1; /// error msg is needed for this case
} else { } else {
return -1; // this was added to remove warning since it is not a void function return -1; /// error msg is needed for this case
} }
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/*! \file PHY/LTE_TRANSPORT/lte_mcs_NB_IoT.c /*! \file PHY/LTE_TRANSPORT/lte_mcs_NB_IoT.c
* \brief Some support routines for MCS computations * \brief Some support routines for MCS computations
* \author V. Savaux * \author V. Savaux , M. KANJ
* \date 2017 * \date 2017
* \version 0.1 * \version 0.1
* \company b<>com * \company b<>com
...@@ -34,24 +34,17 @@ ...@@ -34,24 +34,17 @@
//#include "PHY/extern.h" //#include "PHY/extern.h"
#include "PHY/LTE_TRANSPORT/proto_NB_IoT.h" #include "PHY/LTE_TRANSPORT/proto_NB_IoT.h"
// 36213 Section 16.5.1.2, Table
unsigned char get_Qm_ul_NB_IoT(unsigned char I_MCS, uint8_t N_sc_RU) unsigned char get_Qm_ul_NB_IoT(unsigned char I_MCS, uint8_t N_sc_RU)
{ {
// N_sc_RU = 1, 3, 6, 12
if (N_sc_RU) if (N_sc_RU > 1)
return(2); return(2);
else else // case N_sc_RU = 1 , see table 16.5.1.2-1 , TS 36213
if (I_MCS<2) if (I_MCS<2)
return(1); return(1);
else else
return(2); return(2);
// if (I_MCS < 11)
// return(2);
// else if (I_MCS < 21)
// return(4);
// else
// return(6);
} }
...@@ -326,13 +326,30 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *phy_vars_eNB, ...@@ -326,13 +326,30 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
NB_IoT_eNB_NULSCH_t **ulsch, NB_IoT_eNB_NULSCH_t **ulsch,
uint8_t cooperation_flag); uint8_t cooperation_flag);
void rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
uint8_t eNB_id, // this is the effective sector id
uint8_t UE_id,
NB_IoT_eNB_NULSCH_t **ulsch,
uint8_t npusch_format, // 1, 2
uint16_t UL_RB_ID_NB_IoT, // 22 , to be included in // to be replaced by NB_IoT_start ??
uint8_t subcarrier_spacing, // 0 (3.75 KHz) or 1 (15 KHz)
uint32_t rnti_tmp, //= 65522
uint8_t scrambling_subframe_msg3,
uint32_t scrambling_frame_msg3,
uint16_t nb_slot, // total number of occupied slots
uint16_t I_sc,
uint16_t Nsc_RU,
uint16_t Mcs,
unsigned int A);
void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF, void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF,
int32_t **rxdataF_ext, int32_t **rxdataF_ext,
// uint32_t first_rb, // uint32_t first_rb,
uint16_t UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block !!! may be defined twice : in frame_parms and in NB_IoT_UL_eNB_HARQ_t uint16_t UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block !!! may be defined twice : in frame_parms and in NB_IoT_UL_eNB_HARQ_t
uint8_t N_sc_RU, // number of subcarriers in UL uint8_t N_sc_RU, // number of subcarriers in UL
uint8_t subframe,// uint32_t I_sc, // NB_IoT: subcarrier indication field: must be defined in higher layer uint8_t subframe,// uint32_t I_sc, // NB_IoT: subcarrier indication field: must be defined in higher layer
uint32_t nb_rb,
uint8_t l, uint8_t l,
uint8_t Ns, uint8_t Ns,
LTE_DL_FRAME_PARMS *frame_parms); LTE_DL_FRAME_PARMS *frame_parms);
...@@ -386,6 +403,7 @@ void rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -386,6 +403,7 @@ void rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB,
uint8_t UE_id, uint8_t UE_id,
uint8_t symbol, uint8_t symbol,
uint8_t counter_msg3, uint8_t counter_msg3,
uint32_t I_sc,
uint8_t Qm); uint8_t Qm);
void fill_rbs_zeros_NB_IoT(PHY_VARS_eNB *eNB, void fill_rbs_zeros_NB_IoT(PHY_VARS_eNB *eNB,
...@@ -408,6 +426,8 @@ int32_t ulsch_qpsk_llr_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -408,6 +426,8 @@ int32_t ulsch_qpsk_llr_NB_IoT(PHY_VARS_eNB *eNB,
int16_t *ulsch_llr, int16_t *ulsch_llr,
uint8_t symbol, uint8_t symbol,
uint8_t UE_id, uint8_t UE_id,
uint32_t I_sc,
uint8_t Nsc_RU,
int16_t *llrp); int16_t *llrp);
void rotate_bpsk_NB_IoT(PHY_VARS_eNB *eNB, void rotate_bpsk_NB_IoT(PHY_VARS_eNB *eNB,
...@@ -479,6 +499,10 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext, ...@@ -479,6 +499,10 @@ int ul_chest_tmp_NB_IoT(int32_t **rxdataF_ext,
uint8_t l, //symbol within slot uint8_t l, //symbol within slot
uint8_t Ns, uint8_t Ns,
uint8_t counter_msg3, uint8_t counter_msg3,
uint8_t pilot_pos1,
uint8_t pilot_pos2,
uint32_t I_sc,
uint8_t Qm,
LTE_DL_FRAME_PARMS *frame_parms); LTE_DL_FRAME_PARMS *frame_parms);
void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel, void rotate_channel_sc_tmp_NB_IoT(int16_t *estimated_channel,
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#include "PHY/extern_NB_IoT.h" #include "PHY/extern_NB_IoT.h"
#include "defs_NB_IoT.h" #include "defs_NB_IoT.h"
#include "extern_NB_IoT.h" #include "extern_NB_IoT.h"
//#include "PHY/CODING/lte_interleaver2.h"
#include "PHY/CODING/extern.h"
//#define DEBUG_ULSCH //#define DEBUG_ULSCH
//#include "PHY/sse_intrin.h" //#include "PHY/sse_intrin.h"
#include "PHY/LTE_ESTIMATION/defs_NB_IoT.h" #include "PHY/LTE_ESTIMATION/defs_NB_IoT.h"
...@@ -510,14 +512,16 @@ int32_t ulsch_qpsk_llr_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -510,14 +512,16 @@ int32_t ulsch_qpsk_llr_NB_IoT(PHY_VARS_eNB *eNB,
int16_t *ulsch_llr, int16_t *ulsch_llr,
uint8_t symbol, uint8_t symbol,
uint8_t UE_id, uint8_t UE_id,
uint32_t I_sc,
uint8_t Nsc_RU,
int16_t *llrp) int16_t *llrp)
{ {
int32_t *rxF; int32_t *rxF;
int32_t *llrp32; // = (int32_t *)llrp; int32_t *llrp32; // = (int32_t *)llrp;
uint32_t I_sc = 11;//eNB->ulsch_NB_IoT[UE_id]->harq_process->I_sc; // NB_IoT: subcarrier indication field: must be defined in higher layer //uint32_t I_sc = 11;//eNB->ulsch_NB_IoT[UE_id]->harq_process->I_sc; // NB_IoT: subcarrier indication field: must be defined in higher layer
uint16_t ul_sc_start; // subcarrier start index into UL RB uint16_t ul_sc_start; // subcarrier start index into UL RB
uint8_t Nsc_RU = 1;//eNB->ulsch_NB_IoT[UE_id]->harq_process->N_sc_RU; // Vincent: number of sc 1,3,6,12 //uint8_t Nsc_RU = 1;//eNB->ulsch_NB_IoT[UE_id]->harq_process->N_sc_RU; // Vincent: number of sc 1,3,6,12
int i; int i;
llrp32 = (int32_t *)&llrp[0]; llrp32 = (int32_t *)&llrp[0];
...@@ -610,8 +614,7 @@ void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF, ...@@ -610,8 +614,7 @@ void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF,
// uint32_t first_rb, // uint32_t first_rb,
uint16_t UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block !!! may be defined twice : in frame_parms and in NB_IoT_UL_eNB_HARQ_t uint16_t UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block !!! may be defined twice : in frame_parms and in NB_IoT_UL_eNB_HARQ_t
uint8_t N_sc_RU, // number of subcarriers in UL uint8_t N_sc_RU, // number of subcarriers in UL
uint8_t subframe,// uint32_t I_sc, // NB_IoT: subcarrier indication field: must be defined in higher layer uint8_t I_sc,// uint32_t I_sc, // NB_IoT: subcarrier indication field: must be defined in higher layer
uint32_t nb_rb,
uint8_t l, uint8_t l,
uint8_t Ns, uint8_t Ns,
LTE_DL_FRAME_PARMS *frame_parms) LTE_DL_FRAME_PARMS *frame_parms)
...@@ -627,6 +630,7 @@ void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF, ...@@ -627,6 +630,7 @@ void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF,
// ul_sc_start = get_UL_sc_start_NB_IoT(I_sc); // ul_sc_start = get_UL_sc_start_NB_IoT(I_sc);
//UL_RB_ID_NB_IoT = frame_parms->NB_IoT_RB_ID; //UL_RB_ID_NB_IoT = frame_parms->NB_IoT_RB_ID;
////////////////////////////////////////////////////// if NB_IoT_start is used , no need for nb_rb1 and nb_rb2
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
...@@ -634,6 +638,11 @@ void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF, ...@@ -634,6 +638,11 @@ void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF,
// 2 times no. RBs after the DC // 2 times no. RBs after the DC
// rxF_ext = &rxdataF_ext[aarx][(symbol*frame_parms->N_RB_UL*12)]; // rxF_ext = &rxdataF_ext[aarx][(symbol*frame_parms->N_RB_UL*12)];
/* for (n=0;n<12;n++){
rxdataF_ext[aarx][symbol*frame_parms->N_RB_UL*12 + n] = rxdataF[aarx][NB_IoT_start_UL + (symbol)*frame_parms->ofdm_symbol_size + n];
// since NB_IoT_start -1 is to apply for UPLINK, in this case the computation of start ul and dl should be done during the initializaiton
}*/
if (nb_rb1) { // RB NB-IoT is in the first half if (nb_rb1) { // RB NB-IoT is in the first half
...@@ -643,7 +652,7 @@ void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF, ...@@ -643,7 +652,7 @@ void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF,
// rxdataF_ext[aarx][symbol*frame_parms->N_RB_UL*12 + n] = rxdataF[aarx][UL_RB_ID_NB_IoT*12 + ul_sc_start + frame_parms->first_carrier_offset + symbol*frame_parms->ofdm_symbol_size + n]; // rxdataF_ext[aarx][symbol*frame_parms->N_RB_UL*12 + n] = rxdataF[aarx][UL_RB_ID_NB_IoT*12 + ul_sc_start + frame_parms->first_carrier_offset + symbol*frame_parms->ofdm_symbol_size + n];
rxdataF_ext[aarx][symbol*frame_parms->N_RB_UL*12 + n] = rxdataF[aarx][UL_RB_ID_NB_IoT*12 + frame_parms->first_carrier_offset + (symbol)*frame_parms->ofdm_symbol_size + n]; rxdataF_ext[aarx][symbol*frame_parms->N_RB_UL*12 + n] = rxdataF[aarx][UL_RB_ID_NB_IoT*12 + frame_parms->first_carrier_offset + (symbol)*frame_parms->ofdm_symbol_size + n];
//rxdataF_ext[aarx][symbol*12 + n] = rxdataF[aarx][UL_RB_ID_NB_IoT*12 + frame_parms->first_carrier_offset + symbol*frame_parms->ofdm_symbol_size + n]; //rxdataF_ext[aarx][symbol*12 + n] = rxdataF[aarx][UL_RB_ID_NB_IoT*12 + frame_parms->first_carrier_offset + symbol*frame_parms->ofdm_symbol_size + n];
//// RB 22
} }
// rxF = &rxdataF[aarx][(first_rb*12 + frame_parms->first_carrier_offset + symbol*frame_parms->ofdm_symbol_size)]; // rxF = &rxdataF[aarx][(first_rb*12 + frame_parms->first_carrier_offset + symbol*frame_parms->ofdm_symbol_size)];
...@@ -660,7 +669,7 @@ void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF, ...@@ -660,7 +669,7 @@ void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF,
// rxF_ext += nb_rb2*6; // rxF_ext += nb_rb2*6;
// } // }
} else { // RB NB-IoT is in the second half } else { // RB NB-IoT is in the second half
// RB 2
for (n=0;n<12;n++){ // extract whole RB of 12 subcarriers for (n=0;n<12;n++){ // extract whole RB of 12 subcarriers
// Note that FFT splits the RBs // Note that FFT splits the RBs
...@@ -1355,16 +1364,17 @@ void fill_rbs_zeros_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1355,16 +1364,17 @@ void fill_rbs_zeros_NB_IoT(PHY_VARS_eNB *eNB,
void rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB, void rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB,
LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp, int32_t **rxdataF_comp,
uint8_t UE_id, uint8_t UE_id, // to be removed ??? since not used
uint8_t symbol, //symbol within subframe uint8_t l, //symbol within subframe
uint8_t counter_msg3, uint8_t counter_msg3, /// to be replaced by the number of received part
uint32_t I_sc,
uint8_t Qm) uint8_t Qm)
{ {
uint32_t I_sc = 11;//eNB->ulsch_NB_IoT[UE_id]->harq_process->I_sc; // NB_IoT: subcarrier indication field: must be defined in higher layer //uint32_t I_sc = 11;//eNB->ulsch_NB_IoT[UE_id]->harq_process->I_sc; // NB_IoT: subcarrier indication field: must be defined in higher layer
uint16_t ul_sc_start; // subcarrier start index into UL RB uint16_t ul_sc_start; // subcarrier start index into UL RB
int16_t pi_2_re[2] = {32767 , 0}; int16_t pi_2_re[2] = {32767 , 0};
int16_t pi_2_im[2] = {0 , 32768}; int16_t pi_2_im[2] = {0 , 32767};
//int16_t pi_4_re[2] = {32767 , 25735}; //int16_t pi_4_re[2] = {32767 , 25735};
//int16_t pi_4_im[2] = {0 , 25736}; //int16_t pi_4_im[2] = {0 , 25736};
int16_t pi_4_re[2] = {32767 , 23170}; int16_t pi_4_re[2] = {32767 , 23170};
...@@ -1375,29 +1385,29 @@ void rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1375,29 +1385,29 @@ void rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB,
int16_t rxdataF_comp16_re, rxdataF_comp16_im,rxdataF_comp16_re_2,rxdataF_comp16_im_2; int16_t rxdataF_comp16_re, rxdataF_comp16_im,rxdataF_comp16_re_2,rxdataF_comp16_im_2;
ul_sc_start = get_UL_sc_start_NB_IoT(I_sc); // NB-IoT: get the used subcarrier in RB ul_sc_start = get_UL_sc_start_NB_IoT(I_sc); // NB-IoT: get the used subcarrier in RB
rxdataF_comp16 = (int16_t *)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12 + ul_sc_start]; rxdataF_comp16 = (int16_t *)&rxdataF_comp[0][l*frame_parms->N_RB_DL*12 + ul_sc_start];
rxdataF_comp16_re = rxdataF_comp16[0]; rxdataF_comp16_re = rxdataF_comp16[0];
rxdataF_comp16_im = rxdataF_comp16[1]; rxdataF_comp16_im = rxdataF_comp16[1];
rxdataF_comp16_re_2 = rxdataF_comp16_re; rxdataF_comp16_re_2 = rxdataF_comp16_re;
rxdataF_comp16_im_2 = rxdataF_comp16_re; rxdataF_comp16_im_2 = rxdataF_comp16_re;
if (Qm == 1){ if (Qm == 1){
rxdataF_comp16_re_2 = (int16_t)(((int32_t)pi_2_re[symbol%2] * (int32_t)rxdataF_comp16_re + rxdataF_comp16_re_2 = (int16_t)(((int32_t)pi_2_re[l%2] * (int32_t)rxdataF_comp16_re +
(int32_t)pi_2_im[symbol%2] * (int32_t)rxdataF_comp16_im)>>15); (int32_t)pi_2_im[l%2] * (int32_t)rxdataF_comp16_im)>>15);
rxdataF_comp16_im_2 = (int16_t)(((int32_t)pi_2_re[symbol%2] * (int32_t)rxdataF_comp16_im - rxdataF_comp16_im_2 = (int16_t)(((int32_t)pi_2_re[l%2] * (int32_t)rxdataF_comp16_im -
(int32_t)pi_2_im[symbol%2] * (int32_t)rxdataF_comp16_re)>>15); (int32_t)pi_2_im[l%2] * (int32_t)rxdataF_comp16_re)>>15);
} }
if(Qm == 2){ if(Qm == 2){
rxdataF_comp16_re_2 = (int16_t)(((int32_t)pi_4_re[symbol%2] * (int32_t)rxdataF_comp16_re + rxdataF_comp16_re_2 = (int16_t)(((int32_t)pi_4_re[l%2] * (int32_t)rxdataF_comp16_re +
(int32_t)pi_4_im[symbol%2] * (int32_t)rxdataF_comp16_im)>>15); (int32_t)pi_4_im[l%2] * (int32_t)rxdataF_comp16_im)>>15);
rxdataF_comp16_im_2 = (int16_t)(((int32_t)pi_4_re[symbol%2] * (int32_t)rxdataF_comp16_im - rxdataF_comp16_im_2 = (int16_t)(((int32_t)pi_4_re[l%2] * (int32_t)rxdataF_comp16_im -
(int32_t)pi_4_im[symbol%2] * (int32_t)rxdataF_comp16_re)>>15); (int32_t)pi_4_im[l%2] * (int32_t)rxdataF_comp16_re)>>15);
} }
rxdataF_comp16[0] = (int16_t)(((int32_t)e_phi_re[14*(8-counter_msg3) + symbol] * (int32_t)rxdataF_comp16_re_2 + rxdataF_comp16[0] = (int16_t)(((int32_t)e_phi_re[14*(8-counter_msg3) + l] * (int32_t)rxdataF_comp16_re_2 +
(int32_t)e_phi_im[14*(8-counter_msg3) + symbol] * (int32_t)rxdataF_comp16_im_2)>>15); (int32_t)e_phi_im[14*(8-counter_msg3) + l] * (int32_t)rxdataF_comp16_im_2)>>15);
rxdataF_comp16[1] = (int16_t)(((int32_t)e_phi_re[14*(8-counter_msg3) + symbol] * (int32_t)rxdataF_comp16_im_2 - rxdataF_comp16[1] = (int16_t)(((int32_t)e_phi_re[14*(8-counter_msg3) + l] * (int32_t)rxdataF_comp16_im_2 -
(int32_t)e_phi_im[14*(8-counter_msg3) + symbol] * (int32_t)rxdataF_comp16_re_2)>>15); (int32_t)e_phi_im[14*(8-counter_msg3) + l] * (int32_t)rxdataF_comp16_re_2)>>15);
/*rxdataF_comp16[0] = (int16_t)(((int32_t)e_phi_re[0] * (int32_t)rxdataF_comp16_re_2 + /*rxdataF_comp16[0] = (int16_t)(((int32_t)e_phi_re[0] * (int32_t)rxdataF_comp16_re_2 +
(int32_t)e_phi_im[0] * (int32_t)rxdataF_comp16_im_2)>>15); (int32_t)e_phi_im[0] * (int32_t)rxdataF_comp16_im_2)>>15);
rxdataF_comp16[1] = (int16_t)(((int32_t)e_phi_re[0] * (int32_t)rxdataF_comp16_im_2 - rxdataF_comp16[1] = (int16_t)(((int32_t)e_phi_re[0] * (int32_t)rxdataF_comp16_im_2 -
...@@ -1654,7 +1664,6 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1654,7 +1664,6 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *eNB,
22, //ulsch[UE_id]->harq_process->UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block 22, //ulsch[UE_id]->harq_process->UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block
ulsch[UE_id]->harq_process->N_sc_RU, // number of subcarriers in UL ulsch[UE_id]->harq_process->N_sc_RU, // number of subcarriers in UL
0,// ulsch[UE_id]->harq_process->I_sc, // subcarrier indication field 0,// ulsch[UE_id]->harq_process->I_sc, // subcarrier indication field
ulsch[UE_id]->harq_process->nb_rb,
l%(frame_parms->symbols_per_tti/2), l%(frame_parms->symbols_per_tti/2),
l/(frame_parms->symbols_per_tti/2), l/(frame_parms->symbols_per_tti/2),
frame_parms); frame_parms);
...@@ -1672,7 +1681,20 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1672,7 +1681,20 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *eNB,
l%(frame_parms->symbols_per_tti/2), l%(frame_parms->symbols_per_tti/2),
l/(frame_parms->symbols_per_tti/2), l/(frame_parms->symbols_per_tti/2),
1, 1,
0,
0,
cooperation_flag); cooperation_flag);
/* ul_channel_estimation_NB_IoT(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
uint8_t eNB_id,
uint8_t UE_id,
unsigned char l,
unsigned char Ns,
uint8_t N_sc_RU,
uint8_t pilot_pos1,
uint8_t pilot_pos2,
uint8_t cooperation_flag); */
} }
// if(cooperation_flag == 2) { // if(cooperation_flag == 2) {
...@@ -1925,7 +1947,16 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1925,7 +1947,16 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *eNB,
UE_id, UE_id,
l, l,
1, 1,
0,
Qm); Qm);
/* rotate_single_carrier_NB_IoT(PHY_VARS_eNB *eNB,
LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
uint8_t UE_id,
uint8_t symbol,
uint8_t counter_msg3,
uint32_t I_sc,
uint8_t Qm); */
} }
...@@ -1943,6 +1974,7 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1943,6 +1974,7 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *eNB,
UE_id, UE_id,
l, l,
1, 1,
0,
Qm); Qm);
...@@ -1976,16 +2008,466 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1976,16 +2008,466 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB *eNB,
pusch_vars->llr, pusch_vars->llr,
l, l,
UE_id, UE_id,
0,
0,
&llrp); &llrp);
/* ulsch_qpsk_llr_NB_IoT(PHY_VARS_eNB *eNB,
LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
int16_t *ulsch_llr,
uint8_t symbol,
uint8_t UE_id,
uint32_t I_sc,
uint8_t Nsc_RU,
int16_t *llrp);*/
break; break;
default: default:
#ifdef DEBUG_ULSCH #ifdef DEBUG_ULSCH
printf("ulsch_demodulation.c (rx_ulsch): Unknown Qm!!!!\n"); printf("ulsch_demodulation.c (rx_ulsch): Unknown Qm!!!!\n");
#endif //DEBUG_ULSCH #endif //DEBUG_ULSCH
break; break;
} }
} }
} }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////// generalization of RX procedures //////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
uint8_t eNB_id, // this is the effective sector id
uint8_t UE_id,
NB_IoT_eNB_NULSCH_t **ulsch,
uint8_t npusch_format, // 1, 2
uint16_t UL_RB_ID_NB_IoT, // 22 , to be included in // to be replaced by NB_IoT_start ??
uint8_t subcarrier_spacing, // 0 (3.75 KHz) or 1 (15 KHz)
uint32_t rnti_tmp, //= 65522
uint8_t scrambling_subframe_msg3, // first received subframe
uint32_t scrambling_frame_msg3, // first received frame
uint16_t nb_slot, // total number of occupied slots
uint16_t I_sc,
uint16_t Nsc_RU,
uint16_t Mcs,
unsigned int A)
{
//LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[UE_id];
LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[UE_id];
LTE_eNB_COMMON *common_vars = &eNB->common_vars;
//NB_IoT_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
// uint8_t Nsc_RU = eNB->ulsch_NB_IoT[UE_id]->harq_process->N_sc_RU; // Vincent: number of sc 1,3,6,12
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
NB_IoT_eNB_NULSCH_t **ulsch_NB_IoT = &eNB->ulsch_NB_IoT;//[0][0];
//int l;
int16_t *llrp;
//uint8_t nb_rb=1; //ulsch_NB_IoT[0]->harq_process->nb_rb, high level parameter always one, to take into account in case it is changed in the 3GPP spec
uint32_t l;//,i;
//int32_t avgs;
// uint8_t log2_maxh = 0,aarx;
//uint8_t harq_pid;
uint8_t Qm;
//int subframe = proc->subframe_rx;
//uint8_t npusch_format = 1; // NB-IoT: format 1 (data), or 2: ack. Should be defined in higher layer
//uint8_t subcarrier_spacing = frame_parms->subcarrier_spacing; // 15 kHz or 3.75 kHz
uint8_t pilot_pos1_format1_15k = 3, pilot_pos2_format1_15k = 10; // holds for npusch format 1, and 15 kHz subcarrier bandwidth
uint8_t pilot_pos1_format2_15k = 2, pilot_pos2_format2_15k = 9; // holds for npusch format 2, and 15 kHz subcarrier bandwidth
uint8_t pilot_pos1_format1_3_75k = 4, pilot_pos2_format1_3_75k = 11; // holds for npusch format 1, and 3.75 kHz subcarrier bandwidth
uint8_t pilot_pos1_format2_3_75k = 0,pilot_pos2_format2_3_75k = 7; // holds for npusch format 2, and 3.75 kHz subcarrier bandwidth
uint8_t pilot_pos1, pilot_pos2; // holds for npusch format 1, and 15 kHz subcarrier bandwidth
//int *pilot_pos_format2; // holds for npusch format 2, and 15 kHz subcarrier bandwidth
uint8_t pilots_slot=0;
/////////////// harq_pid = subframe2harq_pid_NB_IoT(frame_parms,proc->frame_rx,subframe);
//uint8_t I_sc = ulsch[UE_id]->harq_process->I_sc;
// Qm = get_Qm_ul_NB_IoT(ulsch[UE_id]->harq_process->mcs,Nsc_RU); // I_msc is in the UL grant
Qm = get_Qm_ul_NB_IoT(Mcs,Nsc_RU);
switch(npusch_format + subcarrier_spacing*2)
{
case 1:
pilot_pos1 = pilot_pos1_format1_3_75k;
pilot_pos2 = pilot_pos2_format1_3_75k;
pilots_slot=1;
break;
case 2:
pilot_pos1 = pilot_pos1_format2_3_75k;
pilot_pos2 = pilot_pos2_format2_3_75k;
pilots_slot=3;
break;
case 3:
pilot_pos1 = pilot_pos1_format1_15k;
pilot_pos2 = pilot_pos2_format1_15k;
pilots_slot=1;
break;
case 4:
pilot_pos1 = pilot_pos1_format2_15k;
pilot_pos2 = pilot_pos2_format2_15k;
pilots_slot=3;
break;
default:
printf("Error in rx_ulsch_NB_IoT");
break;
}
for (l=0; l<fp->symbols_per_tti; l++) {
ulsch_extract_rbs_single_NB_IoT(common_vars->rxdataF[eNB_id],
pusch_vars->rxdataF_ext[eNB_id],
UL_RB_ID_NB_IoT, //ulsch[UE_id]->harq_process->UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block
Nsc_RU, //1, //ulsch_NB_IoT[0]->harq_process->N_sc_RU, // number of subcarriers in UL //////////////// high level parameter
I_sc, //used??????? // ulsch[UE_id]->harq_process->I_sc, // subcarrier indication field
l%(fp->symbols_per_tti/2), // (0..13)
l/(fp->symbols_per_tti/2), // (0,1)
fp);
ul_chest_tmp_NB_IoT(pusch_vars->rxdataF_ext[eNB_id],
pusch_vars->drs_ch_estimates[eNB_id],
l%(fp->symbols_per_tti/2), //symbol within slot
l/(fp->symbols_per_tti/2),
proc->counter_msg3,
pilot_pos1,
pilot_pos2,
I_sc,
Qm,
fp);
}
for (l=0; l<fp->symbols_per_tti; l++)
{
/// Equalization
ul_chequal_tmp_NB_IoT(pusch_vars->rxdataF_ext[eNB_id],
pusch_vars->rxdataF_comp[eNB_id],
pusch_vars->drs_ch_estimates[eNB_id],
l%(fp->symbols_per_tti/2), //symbol within slot
l/(fp->symbols_per_tti/2),
fp);
}
for (l=0; l<fp->symbols_per_tti; l++)
{
/// In case of 1 subcarrier: BPSK and QPSK should be rotated by pi/2 and pi/4, respectively
rotate_single_carrier_NB_IoT(eNB,
fp,
pusch_vars->rxdataF_comp[eNB_id],
UE_id, // UE ID
l,
proc->counter_msg3,
I_sc,
Qm); // Qm
}
llrp = (int16_t*)&pusch_vars->llr[0+ (8-proc->counter_msg3)*24];
int ii=0;
for (l=0; l<fp->symbols_per_tti; l++)
{
if (l==pilot_pos1 || l==pilot_pos2) // skip pilots
{
l++;
}
ulsch_qpsk_llr_NB_IoT(eNB,
fp,
pusch_vars->rxdataF_comp[eNB_id],
pusch_vars->llr,
l,
UE_id, // UE ID
I_sc,
Nsc_RU,
&llrp[ii*2]); //// !!! Pensez à créer un buffer de longueur 8 subframes
ii++;
}
///////////////////////////////////////////////// NPUSH DECOD //////////////////////////////////////
if(proc->counter_msg3==1)
{
int16_t *ulsch_llr = eNB->pusch_vars[eNB_id]->llr; //UE_id=0
NB_IoT_UL_eNB_HARQ_t *ulsch_harq = ulsch_NB_IoT[UE_id]->harq_process;
//unsigned int A;
unsigned int j,j2; //i2,
int iprime;
//unsigned int ret = 0;
int r,Kr;
unsigned int sumKr=0;
unsigned int G,H,Hprime,Hpp,Cmux,Rmux_prime; // Q_CQI,Q_RI=0
uint32_t x1, x2, s=0;
//int16_t c;
int16_t y[6*14*1200] __attribute__((aligned(32)));
uint8_t ytag[14*1200];
//int16_t cseq[6*14*1200];
//uint32_t subframe = 1; // first subframe of Msg3 received // required for scrambling
//uint32_t rnti_tmp= 65522; // true rnti should be used
uint8_t reset;
// NB-IoT ///////////////////////////////////////////////
// x1 is set in lte_gold_generic
// x2 should not reinitialized each subframe
// x2 should be reinitialized according to 36.211 Sections 10.1.3.1 and 10.1.3.6
// A = ulsch_harq->TBS; //88; // // only for msg3 , should be replace by generic one
// Qm = get_Qm_ul_NB_IoT(I_MCS,Nsc_RU); // (2,1) ///// ulsch_harq->mcs,ulsch_harq->N_sc_RU // G_UL ??
G = (7-pilots_slot) * Qm * nb_slot; //(1 * Q_m) * 6 * 16; // Vincent : see 36.212, Section 5.1.4.1.2 // 16 slot(total number of slots) * 6 symboles (7-pilots_slot) * Qm*1
//G = ulsch_harq->N_sc_RU * Q_m) * ulsch_harq->Nsymb_UL * ulsch_harq->Nslot_UL; (= number of RE * 2 - pilots)
if (ulsch_harq->round == 0)
{
// This is a new packet, so compute quantities regarding segmentation
ulsch_harq->B = A+24;
lte_segmentation_NB_IoT(NULL,
NULL,
ulsch_harq->B,
&ulsch_harq->C,
&ulsch_harq->Cplus,
&ulsch_harq->Cminus,
&ulsch_harq->Kplus,
&ulsch_harq->Kminus,
&ulsch_harq->F);
}
sumKr = 0;
for (r=0; r<ulsch_harq->C; r++)
{
if (r<ulsch_harq->Cminus)
{
Kr = ulsch_harq->Kminus;
}else{
Kr = ulsch_harq->Kplus;
}
sumKr += Kr;
}
ulsch_harq->G = G;
H = G ;
Hprime = H/Qm;
// Demultiplexing/Deinterleaving of PUSCH/ACK/RI/CQI
Hpp = Hprime;
// Cmux = (ulsch_harq->Nsymb_UL-1)*ulsch_harq->Nslot_UL; // see definition in 36.212, Section 6.3.2, but not consistent with definition
// of RU in 36.211, Section 10.1.2.3. Maybe prefer the following:
Cmux = (7-pilots_slot) * nb_slot; // 6*16; //////////////(ulsch_harq->Nsymb_UL)*ulsch_harq->Nslot_UL;
Rmux_prime = Hpp/Cmux;
// Clear "tag" interleaving matrix to allow for CQI/DATA identification
memset(ytag,0,Cmux*Rmux_prime);
memset(y,LTE_NULL_NB_IoT,Qm*Hpp);
x2 = (rnti_tmp<<14) + (scrambling_subframe_msg3<<9) + ((scrambling_frame_msg3%2)<<13) + fp->Nid_cell; //this is c_init in 36.211 Sec 10.1.3.1
reset = 1;
switch (Qm)
{
case 1:
for (j=0; j<Cmux; j++)
{
//y[j] = cseq[j]*ulsch_llr[j]; /// To be defined for bpsk
}
break;
case 2:
for (j=0; j<Cmux*2; j++)
{
if (j%32==0)
{
s = lte_gold_generic(&x1, &x2, reset);
// printf("lte_gold[%d]=%x\n",i,s);
reset = 0;
}
if (((s>>(j%32))&1)==0)
{
y[j] = -ulsch_llr[j];
} else {
y[j] = ulsch_llr[j];
}
}
break;
}
j = 0;
j2 = 0;
int16_t *yp,*ep;
for (iprime=0,yp=&y[j2],ep=&ulsch_harq->e[0]; iprime<G; iprime+=8,j2+=8,ep+=8,yp+=8)
{
ep[0] = yp[0];
ep[1] = yp[1];
ep[2] = yp[2];
ep[3] = yp[3];
ep[4] = yp[4];
ep[5] = yp[5];
ep[6] = yp[6];
ep[7] = yp[7];
}
r=0;
Kr=0;
unsigned int r_offset=0,Kr_bytes,iind;
uint8_t crc_type;
int offset = 0;
int16_t dummy_w[MAX_NUM_ULSCH_SEGMENTS_NB_IoT][3*(6144+64)];
//NB_IoT_UL_eNB_HARQ_t *ulsch_harq = ulsch_NB_IoT[0]->harq_process; ///
int ret = 1;
unsigned int E;
uint8_t (*tc)(int16_t *y,
uint8_t *,
uint16_t,
uint16_t,
uint16_t,
uint8_t,
uint8_t,
uint8_t,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *);
tc = phy_threegpplte_turbo_decoder16;
for (r=0; r<ulsch_harq->C; r++)
{
// Get Turbo interleaver parameters
if (r<ulsch_harq->Cminus)
{
Kr = ulsch_harq->Kminus;
} else{
Kr = ulsch_harq->Kplus;
}
Kr_bytes = Kr>>3;
if (Kr_bytes<=64)
{
iind = (Kr_bytes-5);
} else if (Kr_bytes <=128) {
iind = 59 + ((Kr_bytes-64)>>1);
} else if (Kr_bytes <= 256) {
iind = 91 + ((Kr_bytes-128)>>2);
} else if (Kr_bytes <= 768) {
iind = 123 + ((Kr_bytes-256)>>3);
} else {
LOG_E(PHY,"ulsch_decoding: Illegal codeword size %d!!!\n",Kr_bytes);
//return(-1);
}
memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short));
ulsch_harq->RTC[r] = generate_dummy_w(4+(Kr_bytes*8),
(uint8_t*)&dummy_w[r][0],
(r==0) ? ulsch_harq->F : 0);
if (lte_rate_matching_turbo_rx(ulsch_harq->RTC[r],
G,
ulsch_harq->w[r],
(uint8_t*) &dummy_w[r][0],
ulsch_harq->e+r_offset,
ulsch_harq->C,
1, //////////////////////////////// not used
0, //Uplink
1,
0,//ulsch_harq->rvidx,
(ulsch_harq->round==0)?1:0, // clear
Qm, //2 //get_Qm_ul(ulsch_harq->mcs),
1,
r,
&E)==-1)
{
LOG_E(PHY,"ulsch_decoding.c: Problem in rate matching\n");
//return(-1);
}
r_offset += E;
sub_block_deinterleaving_turbo(4+Kr,
&ulsch_harq->d[r][96],
ulsch_harq->w[r]);
if (ulsch_harq->C == 1)
{
crc_type = CRC24_A;
}else{
crc_type = CRC24_B;
}
// turbo decoding and CRC
ret = tc(&ulsch_harq->d[r][96],
ulsch_harq->c[r],
Kr,
f1f2mat_old[iind*2],
f1f2mat_old[(iind*2)+1],
ulsch_NB_IoT[UE_id]->max_turbo_iterations, //MAX_TURBO_ITERATIONS,
crc_type,
(r==0) ? ulsch_harq->F : 0,
&eNB->ulsch_tc_init_stats,
&eNB->ulsch_tc_alpha_stats,
&eNB->ulsch_tc_beta_stats,
&eNB->ulsch_tc_gamma_stats,
&eNB->ulsch_tc_ext_stats,
&eNB->ulsch_tc_intl1_stats,
&eNB->ulsch_tc_intl2_stats);
if (ret != (1+ulsch_NB_IoT[UE_id]->max_turbo_iterations))
{
//printf("\n in last cdn \n");
if (r<ulsch_harq->Cminus)
{
Kr = ulsch_harq->Kminus;
} else {
Kr = ulsch_harq->Kplus;
Kr_bytes = Kr>>3;
}
if (r==0)
{
memcpy(ulsch_harq->b,
&ulsch_harq->c[0][(ulsch_harq->F>>3)],
Kr_bytes - (ulsch_harq->F>>3) - ((ulsch_harq->C>1)?3:0));
offset = Kr_bytes - (ulsch_harq->F>>3) - ((ulsch_harq->C>1)?3:0);
} else {
memcpy(ulsch_harq->b+offset,
ulsch_harq->c[r],
Kr_bytes - ((ulsch_harq->C>1)?3:0));
offset += (Kr_bytes- ((ulsch_harq->C>1)?3:0));
}
} else {
//printf("\n in last cdn break \n");
break;
}
} // r loop end
uint8_t *msg3 = &eNB->msg3_pdu[0];
// printf("pdu[0] = %d \n",ulsch_harq->b[0]);
int m =0;
for(m=0; m<6;m++)
{
msg3[m]=ulsch_harq->b[2+m];
}
proc->flag_DCI_msg4 =1 ;
proc->counter_DCI_msg4=4;
} // NPUSH decode end
/////////////////////////////////////////END/////////////////////////////////////////////////////////////////////////////////////
}
\ No newline at end of file
...@@ -561,7 +561,25 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -561,7 +561,25 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
//printf("frame %d in demod NPUSCH = \n",frame); //printf("frame %d in demod NPUSCH = \n",frame);
/////////////////////////////////////////////////// NPUSH DEMOD //////////////////////////////////// /////////////////////////////////////////////////// NPUSH DEMOD ////////////////////////////////////
// LTE_eNB_COMMON *common_vars = &eNB->common_vars; // LTE_eNB_COMMON *common_vars = &eNB->common_vars;
LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[0]; NB_IoT_eNB_NULSCH_t **ulsch_NB_IoT = &eNB->ulsch_NB_IoT;//[0][0];
rx_ulsch_Gen_NB_IoT(eNB,
proc,
0,//eNB_id, // this is the effective sector id
0,//UE_id,
ulsch_NB_IoT,
1,//npusch_format, // 1, 2
22,//UL_RB_ID_NB_IoT, // 22 , to be included in // to be replaced by NB_IoT_start ??
1,//subcarrier_spacing, // 0 (3.75 KHz) or 1 (15 KHz)
65522,//rnti_tmp, //= 65522
proc->subframe_dscr_msg3,//subframerx,//scrambling_subframe_msg3, // first received subframe
proc->frame_dscr_msg3,//framerx,// scrambling_frame_msg3, // first received frame
16,//nb_slot, // total number of occupied slots
11, // I_sc
1, // Nsc_RU
2, // Mcs
88); // A = TBS
/* LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[0];
//NB_IoT_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; //NB_IoT_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
NB_IoT_eNB_NULSCH_t **ulsch_NB_IoT = &eNB->ulsch_NB_IoT;//[0][0]; NB_IoT_eNB_NULSCH_t **ulsch_NB_IoT = &eNB->ulsch_NB_IoT;//[0][0];
int l; //i; int l; //i;
...@@ -583,8 +601,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -583,8 +601,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
// ulsch[UE_id]->harq_process->first_rb, // ulsch[UE_id]->harq_process->first_rb,
22, //ulsch[UE_id]->harq_process->UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block 22, //ulsch[UE_id]->harq_process->UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block
1, //ulsch_NB_IoT[0]->harq_process->N_sc_RU, // number of subcarriers in UL //////////////// high level parameter 1, //ulsch_NB_IoT[0]->harq_process->N_sc_RU, // number of subcarriers in UL //////////////// high level parameter
(uint8_t)proc->subframe_delay,//subframe,// ulsch[UE_id]->harq_process->I_sc, // subcarrier indication field I_sc,//subframe,// ulsch[UE_id]->harq_process->I_sc, // subcarrier indication field
nb_rb,
l%(fp->symbols_per_tti/2), l%(fp->symbols_per_tti/2),
l/(fp->symbols_per_tti/2), l/(fp->symbols_per_tti/2),
fp); fp);
...@@ -594,6 +611,10 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -594,6 +611,10 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
l%(fp->symbols_per_tti/2), //symbol within slot l%(fp->symbols_per_tti/2), //symbol within slot
l/(fp->symbols_per_tti/2), l/(fp->symbols_per_tti/2),
proc->counter_msg3, proc->counter_msg3,
pilot_pos1,
pilot_pos2,
I_sc,
Qm,
fp); fp);
} }
...@@ -618,23 +639,14 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -618,23 +639,14 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
rotate_single_carrier_NB_IoT(eNB, rotate_single_carrier_NB_IoT(eNB,
fp, fp,
pusch_vars->rxdataF_comp[0], pusch_vars->rxdataF_comp[0],
0, // UE ID UE_id, // UE ID
l, l,
proc->counter_msg3, proc->counter_msg3,
2); // Qm I_sc,
Qm); // Qm
} }
proc->subframe_delay++;
if(proc->subframe_delay==10) ///&& frame == ????
{
proc->subframe_delay=0;
}
proc->subframe_delay++;
///////// IDFT inverse precoding is done over the whole subframe of 14 - 2 (pilots) symbols ///////// IDFT inverse precoding is done over the whole subframe of 14 - 2 (pilots) symbols
//lte_idft_NB_IoT(fp, //lte_idft_NB_IoT(fp,
// (uint32_t*)pusch_vars->rxdataF_ext[0][0], // (uint32_t*)pusch_vars->rxdataF_ext[0][0],
...@@ -654,16 +666,19 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -654,16 +666,19 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
pusch_vars->rxdataF_comp[0], pusch_vars->rxdataF_comp[0],
pusch_vars->llr, pusch_vars->llr,
l, l,
0, // UE ID UE_id, // UE ID
I_sc,
Nsc_RU, // uint8_t Nsc_RU=1
&llrp[ii*2]); //// !!! Pensez à créer un buffer de longueur 8 subframes &llrp[ii*2]); //// !!! Pensez à créer un buffer de longueur 8 subframes
ii++; ii++;
} }
/*printf("\n"); // printf("\n");
for (l=0;l<24;l++){ // for (l=0;l<24;l++){
printf(" llr = %d ",pusch_vars->llr[(8-proc->counter_msg3)*24+l]); // printf(" llr = %d ",pusch_vars->llr[(8-proc->counter_msg3)*24+l]);
}*/ // }
*/
/*
/////////////////////////////////////////////////// NPUSH DECOD //////////////////////////////////// /////////////////////////////////////////////////// NPUSH DECOD ////////////////////////////////////
if(proc->counter_msg3==1) if(proc->counter_msg3==1)
{ {
...@@ -691,20 +706,6 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -691,20 +706,6 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
uint32_t rnti_tmp= 65522; // true rnti should be used uint32_t rnti_tmp= 65522; // true rnti should be used
uint8_t reset; uint8_t reset;
/*int16_t *Rx_buffer;
FILE *fich = fopen("xyzabc.txt","w");
Rx_buffer = &ulsch_llr[0]; // get the whole frame
memcpy(&buffer_npusch[0],&Rx_buffer[0],2*2*8*12);
int pp;
for (pp=0;pp<2*8*12;pp++)
{
fprintf(fich," %d ",buffer_npusch[pp]);
}
fclose(fich);
exit(0); */
// NB-IoT /////////////////////////////////////////////// // NB-IoT ///////////////////////////////////////////////
// x1 is set in lte_gold_generic // x1 is set in lte_gold_generic
// x2 should not reinitialized each subframe // x2 should not reinitialized each subframe
...@@ -792,10 +793,10 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -792,10 +793,10 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
} }
break; break;
} }
printf("\n \n"); // printf("\n \n");
/*for (j=0;j<140;j++){ // for (j=0;j<140;j++){
printf(" y = %d ",y[j]); // printf(" y = %d ",y[j]);
}*/ // }
// CQI and Data bits // CQI and Data bits
j = 0; j = 0;
j2 = 0; j2 = 0;
...@@ -812,10 +813,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -812,10 +813,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
ep[7] = yp[7]; ep[7] = yp[7];
} }
/*printf("\n \n");
for (j=0;j<140;j++){
printf(" e = %d ",ulsch_harq->e[j]);
}*/
// Do ULSCH Decoding for data portion // Do ULSCH Decoding for data portion
...@@ -906,19 +904,13 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -906,19 +904,13 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
} }
r_offset += E; r_offset += E;
/*printf("\n \n");
for (j=0;j<140;j++){
printf(" w = %d ",ulsch_harq->w[r][j]);
}*/
sub_block_deinterleaving_turbo(4+Kr, sub_block_deinterleaving_turbo(4+Kr,
&ulsch_harq->d[r][96], &ulsch_harq->d[r][96],
ulsch_harq->w[r]); ulsch_harq->w[r]);
/*printf("\n \n");
for (j=0;j<140;j++){
printf(" d = %d ",ulsch_harq->d[r][96+j]);
}*/
if (ulsch_harq->C == 1) if (ulsch_harq->C == 1)
{ {
...@@ -984,17 +976,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -984,17 +976,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
printf("pdu[2] = %d \n",ulsch_harq->b[8]); printf("pdu[2] = %d \n",ulsch_harq->b[8]);
printf("pdu[3] = %d \n",ulsch_harq->b[9]); printf("pdu[3] = %d \n",ulsch_harq->b[9]);
/*uint8_t xo = 128;
int m =0;
for(m=0; m<6;m++)
{
if((ulsch_harq->b[2+m]<<7) == 128)
{
msg3[m]= (ulsch_harq->b[3+m]>>1) ^ xo;
} else {
msg3[m]= (ulsch_harq->b[3+m]>>1);
}
}*/
int m =0; int m =0;
for(m=0; m<6;m++) for(m=0; m<6;m++)
{ {
...@@ -1007,7 +989,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ...@@ -1007,7 +989,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
proc->flag_DCI_msg4 =1 ; proc->flag_DCI_msg4 =1 ;
proc->counter_DCI_msg4=4; proc->counter_DCI_msg4=4;
} // NPUSH decode end } // NPUSH decode end */
proc->counter_msg3--; proc->counter_msg3--;
} }
...@@ -1086,7 +1068,7 @@ if(proc->flag_msg4 == 1 && proc->counter_msg4 > 0) ...@@ -1086,7 +1068,7 @@ if(proc->flag_msg4 == 1 && proc->counter_msg4 > 0)
dlsch_encoding_rar_NB_IoT(tab_rar, dlsch_encoding_rar_NB_IoT(tab_rar,
rar, rar,
2, ///// number_of_subframes_required 1, ///// number_of_subframes_required
236, 236,
1); //////////// G*2 // option =2 for msg4 1); //////////// G*2 // option =2 for msg4
...@@ -1215,16 +1197,16 @@ if(proc->flag_DCI_msg4 ==1 && proc->counter_DCI_msg4>0) ...@@ -1215,16 +1197,16 @@ if(proc->flag_DCI_msg4 ==1 && proc->counter_DCI_msg4>0)
uint8_t agr_level = 2; uint8_t agr_level = 2;
// uint8_t dci_number=1; // uint8_t dci_number=1;
uint8_t tab_a[3]; uint8_t tab_a[3];
/* tab_a[0]= 128; tab_a[0]= 128;
tab_a[1]= 66; tab_a[1]= 66;
tab_a[2]= 4; tab_a[2]= 4;
*/
// TBS =120 // TBS =120
tab_a[0]= 129; /* tab_a[0]= 129;
tab_a[1]= 130; tab_a[1]= 130;
tab_a[2]= 2; tab_a[2]= 2;
*/
/* // TBS =144 /* // TBS =144
tab_a[0]= 128; tab_a[0]= 128;
......
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