Commit 798c839b authored by Matthieu Kanj's avatar Matthieu Kanj

NPUSCH update

parent debb2cca
......@@ -51,7 +51,7 @@ void lte_sync_timefreq_NB_IoT(PHY_VARS_UE_NB_IoT *ue,int band,unsigned int DL_fr
int NB_IoT_est_timing_advance_pusch(PHY_VARS_eNB_NB_IoT* phy_vars_eNB,module_id_t UE_id);
////////// Vincent: NB-IoT specific adapted function for channel estimation ////////////////////
/*
int ul_channel_estimation_NB_IoT(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
uint8_t eNB_id,
......@@ -61,7 +61,7 @@ int ul_channel_estimation_NB_IoT(PHY_VARS_eNB *eNB,
uint8_t N_sc_RU,
uint8_t pilot_pos1,
uint8_t pilot_pos2,
uint8_t cooperation_flag);
uint8_t cooperation_flag); */
////////////////////////////////////////////////////////////////////////////////////////////////
int16_t lte_ul_freq_offset_estimation_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
......
......@@ -404,7 +404,7 @@ int ul_chequal_tmp_NB_IoT(int32_t **rxdataF_ext,
}
/////////////////////////////////////////////////////////////////////////////
/*
int32_t ul_channel_estimation_NB_IoT(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
uint8_t eNB_id,
......@@ -731,7 +731,7 @@ int32_t ul_channel_estimation_NB_IoT(PHY_VARS_eNB *eNB,
}
*/
......
......@@ -36,17 +36,42 @@
#include "PHY/LTE_TRANSPORT/proto_NB_IoT.h"
#include "PHY/LTE_TRANSPORT/extern_NB_IoT.h"
unsigned char get_Qm_ul_NB_IoT(unsigned char I_MCS, uint8_t N_sc_RU)
uint8_t get_Qm_UL_NB_IoT(unsigned char I_mcs, uint8_t N_sc_RU, uint8_t I_sc, uint8_t Msg3_flag)
{
// N_sc_RU = 1, 3, 6, 12
if (N_sc_RU > 1)
return(2);
else // case N_sc_RU = 1 , see table 16.5.1.2-1 , TS 36213
if (I_MCS<2)
return(1);
else
return(2);
if (Msg3_flag == 1) /////////////////////////// case of Msg3
{
if(I_mcs > 0)
{
return 2;
} else if (I_mcs == 0 && I_sc <12) {
return 1;
} else { ////// I_mcs == 0 && I_sc >11
return 2;
}
} else { /////////////////////// case of other NPUSCH config
if(N_sc_RU == 1)
{
if(I_mcs <2)
{
return 1;
} else {
return 2;
}
} else { /////////////// N_sc_RU > 1
return 2;
}
}
}
......
......@@ -237,13 +237,13 @@ uint8_t generate_dci_top_NB_IoT(NB_IoT_eNB_NPDCCH_t *npdcch,
@param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used
@returns 0 on success
*/
unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
/*unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
uint8_t UE_id,
uint8_t control_only_flag,
uint8_t Nbundled,
uint8_t llr8_flag);
*/
// NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB_IoT(uint8_t abstraction_flag);
......@@ -255,7 +255,6 @@ uint8_t subframe2harq_pid_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,
@param I_MCS */
//uint8_t get_Qm_ul_NB_IoT(uint8_t I_MCS);
unsigned char get_Qm_ul_NB_IoT(unsigned char I_MCS, uint8_t N_sc_RU);
/** \fn dlsch_encoding(PHY_VARS_eNB *eNB,
uint8_t *input_buffer,
......@@ -351,13 +350,7 @@ int32_t dlsch_encoding_NB_IoT(unsigned char *a,
unsigned int G); // G (number of available RE) is implicitly multiplied by 2 (since only QPSK modulation)
/////////////////////////////////////////////////////////////////
void rx_ulsch_NB_IoT(PHY_VARS_eNB *phy_vars_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 cooperation_flag);
uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
......@@ -378,7 +371,8 @@ uint8_t rx_ulsch_Gen_NB_IoT(PHY_VARS_eNB *eNB,
unsigned int A,
uint16_t counter_msg,
uint8_t subframerx,
uint8_t rvdx);
uint8_t rvdx,
uint8_t msg3_flag);
void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF,
int32_t **rxdataF_ext,
......@@ -426,6 +420,13 @@ int16_t* sub_sampling_NB_IoT(int16_t *input_buffer, uint32_t length_input, uint3
void filtering_signal(int16_t *input_buffer, int16_t *filtered_buffer, uint32_t FRAME_LENGTH_COMPLEX_SAMPLESx);
//************************************************************//
///////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//uint8_t get_UL_I_TBS_from_MCS_NB_IoT(uint8_t I_mcs, uint8_t N_sc_RU, uint8_t Msg3_flag);
uint8_t get_Qm_UL_NB_IoT(unsigned char I_mcs, uint8_t N_sc_RU, uint8_t I_sc, uint8_t Msg3_flag);
uint16_t get_UL_sc_start_NB_IoT(uint16_t I_sc);
uint16_t get_UL_sc_index_start_NB_IoT(uint8_t subcarrier_spacing, uint16_t I_sc, uint8_t npush_format);
......@@ -438,6 +439,10 @@ uint8_t get_numb_UL_sc_NB_IoT(uint8_t subcarrier_spacing, uint8_t I_sc, uint8_t
uint8_t get_UL_slots_per_RU_NB_IoT(uint8_t subcarrier_spacing, uint8_t subcarrier_indcation, uint8_t UL_format);
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
void generate_grouphop_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms);
void init_ul_hopping_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms);
......
......@@ -1117,7 +1117,7 @@ static inline unsigned int lte_gold_unscram_NB_IoT(unsigned int *x1, unsigned in
}
/*
unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
uint8_t UE_id,
......@@ -1183,9 +1183,9 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *eNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING0+harq_pid,0);
return 1+ulsch->max_turbo_iterations;
}
*/
/* ----------------------- Segmentation */
/*
// nb_rb = ulsch_harq->nb_rb; // nb_rb set but not used ??
//nb_rb = 1; // nb_rb set but not used ??
A = ulsch_harq->TBS;
......@@ -1248,7 +1248,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *eNB,
//mac_xface_NB_IoT->macphy_exit("ulsch_decoding.c: FATAL sumKr is 0!");
return(-1);
}
*/
// No control information in NB-IoT
// Compute Q_ri
// Qprime = ulsch_harq->O_RI*ulsch_harq->Msc_initial*ulsch_harq->Nsymb_initial * ulsch->beta_offset_ri_times8;
......@@ -1313,7 +1313,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *eNB,
// #endif
// G = G - Q_RI - Q_CQI;
ulsch_harq->G = G;
/* ulsch_harq->G = G;
if ((int)G < 0) {
LOG_E(PHY,"FATAL: ulsch_decoding.c G < 0 (%d) : Q_RI %d, Q_CQI %d\n",G,Q_RI,Q_CQI);
......@@ -1343,15 +1343,15 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *eNB,
// read in buffer and unscramble llrs for everything but placeholder bits
// llrs stored per symbol correspond to columns of interleaving matrix
s = lte_gold_unscram_NB_IoT(&x1, &x2, 1);
i2 = 0;
i2 = 0;*/
for (i=0; i<((Hpp*Q_m)>>5); i++) {
// for (i=0; i<((Hpp*Q_m)>>5); i++) {
/*
for (j=0; j<32; j++) {
cseq[i2++] = (int16_t)((((s>>j)&1)<<1)-1);
}
*/
#if defined(__x86_64__) || defined(__i386__)
/* #if defined(__x86_64__) || defined(__i386__)
#ifndef __AVX2__
((__m128i*)cseq)[i2++] = ((__m128i*)unscrambling_lut_NB_IoT)[(s&65535)<<1];
((__m128i*)cseq)[i2++] = ((__m128i*)unscrambling_lut_NB_IoT)[1+((s&65535)<<1)];
......@@ -1372,7 +1372,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *eNB,
s = lte_gold_unscram_NB_IoT(&x1, &x2, 0);
}
*/
// printf("after unscrambling c[%d] = %p\n",0,ulsch_harq->c[0]);
// if (frame_parms->Ncp == 0)
......@@ -1429,7 +1429,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *eNB,
// #endif
// j=(j+3)&3;
// }
/*
i = 0;
switch (Q_m) {
......@@ -1459,7 +1459,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *eNB,
}
break;
*/
// case 4:
// for (j=0; j<Cmux; j++) {
......@@ -1508,14 +1508,14 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *eNB,
// }
// break;
}
// }
// if (i!=(H+Q_RI))
if (i!=(H))
LOG_D(PHY,"ulsch_decoding.c: Error in input buffer length (j %d, H+Q_RI %d)\n",i,H+Q_RI);
// if (i!=(H))
// LOG_D(PHY,"ulsch_decoding.c: Error in input buffer length (j %d, H+Q_RI %d)\n",i,H+Q_RI);
// HARQ-ACK Bits (LLRs are nulled in overwritten bits after copying HARQ-ACK LLR)
......@@ -1629,8 +1629,8 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *eNB,
// printf("after RI2 c[%d] = %p\n",0,ulsch_harq->c[0]);
// CQI and Data bits
j = 0;
j2 = 0;
// j = 0;
// j2 = 0;
// r=0;
// if (Q_RI>0) {
......@@ -1726,9 +1726,9 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *eNB,
*((int16x8_t *)&ulsch_harq->e[iprime]) = *((int16x8_t *)&y[j2]);
#endif
*/
int16_t *yp,*ep;
// int16_t *yp,*ep;
for (iprime=0,yp=&y[j2],ep=&ulsch_harq->e[0];
/* 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];
......@@ -1741,7 +1741,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *eNB,
ep[7] = yp[7];
}
*/
//stop_meas_NB_IoT(&eNB->ulsch_demultiplexing_stats);
......@@ -1878,7 +1878,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *eNB,
*/
// Do ULSCH Decoding for data portion
/*
ret = eNB->td(eNB,UE_id,harq_pid,llr8_flag);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING0+harq_pid,0);
......@@ -1886,7 +1886,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB *eNB,
return(ret);
}
*/
/*
#ifdef PHY_ABSTRACTION
......
......@@ -534,7 +534,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
proc->frame_dscr_msg5 = framerx;
proc->subframe_dscr_msg5 = subframerx;
}
/*
rx_ulsch_Gen_NB_IoT(eNB,
proc,
0,//eNB_id, // this is the effective sector id
......@@ -554,7 +554,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
proc->counter_msg5,
subframerx, //current_rx_subframe,
0); // data (0) or control (1)
*/
proc->subframe_msg5++;
......@@ -581,7 +581,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
//printf("frame %d in demod NPUSCH = \n",frame);
/////////////////////////////////////////////////// NPUSH DEMOD ////////////////////////////////////
// LTE_eNB_COMMON *common_vars = &eNB->common_vars;
/*
rx_ulsch_Gen_NB_IoT(eNB,
proc,
0,//eNB_id, // this is the effective sector id
......@@ -601,7 +601,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
proc->counter_msg3,
subframerx,
0); // data (0) or control (1)
*/
proc->counter_msg3--;
}
......
......@@ -1616,7 +1616,6 @@ void npusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t data_or_c
nulsch->flag_scramble = 0;
}
/*
// UE has ULSCH scheduling
for (int rb=0; rb<=ulsch_harq->nb_rb; rb++)
......@@ -1632,6 +1631,8 @@ void npusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t data_or_c
ulsch_harq->V_UL_DAI,
ulsch_harq->nb_rb>20 ? 1 : 0);*/
// fill_ulsch_cqi_indication(eNB,frame,subframe,ulsch_harq,ulsch->rnti);
uint16_t N_slots = get_UL_slots_per_RU_NB_IoT(nulsch_harq->subcarrier_spacing, nulsch_harq->subcarrier_indication, nulsch->npusch_format)*get_UL_N_ru_NB_IoT(nulsch_harq->mcs,nulsch_harq->resource_assignment,nulsch->Msg3_flag);
rx_ulsch_Gen_NB_IoT(eNB,
proc,
0, // this is the effective sector id
......@@ -1643,19 +1644,18 @@ void npusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t data_or_c
nulsch->rnti, //= 65522
nulsch->Msg3_subframe, // first received subframe
nulsch->Msg3_frame, // first received frame
get_UL_slots_per_RU_NB_IoT(nulsch_harq->subcarrier_spacing, nulsch_harq->subcarrier_indication, nulsch->npusch_format)*get_UL_N_ru_NB_IoT(nulsch_harq->mcs,nulsch_harq->resource_assignment,nulsch->Msg3_flag), // total number of occupied slots = get_nb_slot_per_RU * NB_of_RU
N_slots, // total number of occupied slots = get_nb_slot_per_RU * NB_of_RU
get_UL_sc_index_start_NB_IoT(nulsch_harq->subcarrier_spacing,nulsch_harq->subcarrier_indication,nulsch->npusch_format),
1,
2,
get_UL_N_ru_NB_IoT(nulsch_harq->mcs,nulsch_harq->resource_assignment,nulsch->Msg3_flag), // N_RU
nulsch_harq->mcs, // I_mcs
nulsch_harq->TBS, // A = TBS
proc->counter_msg3, // this represents the number of Subframe after encoding the msg3 // proc->counter_msg3
N_slots/2, ///proc->counter_msg3, // this represents the number of Subframe after encoding the msg3 // proc->counter_msg3
subframerx,
0);
0,
nulsch->Msg3_flag);
}
} // for UE loop
}
\ No newline at end of file
......@@ -971,6 +971,31 @@ void maintain_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst, sched_temp_DL_NB_IoT_t
}
}
//// get I_TBS for any NPUSCH config
uint8_t I_TBS_index_single_tone[11]= {0,2,1,3,4,5,6,7,8,9,10};
uint8_t get_UL_I_TBS_from_MCS_NB_IoT(uint8_t I_mcs, uint8_t N_sc_RU, uint8_t Msg3_flag)
{
if(Msg3_flag == 1)
{
return I_mcs;
} else {
if(N_sc_RU == 1)
{
return I_TBS_index_single_tone[I_mcs];
} else {
return I_mcs;
}
}
}
/*Get MCS index*/
uint32_t get_I_mcs(int CE_level)
{
......
......@@ -291,8 +291,10 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
//contidition should be added to select either the UL_TBS_Table or t UL_TBS_table_msg3
//(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.size = UL_TBS_Table[((DCIFormatN0_t *)DCI_pdu)->mcs][((DCIFormatN0_t *)DCI_pdu)->ResAssign];
(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.size = UL_TBS_Table_msg3[((DCIFormatN0_t *)DCI_pdu)->mcs]; // for the case of MSG3
//(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.size = UL_TBS_Table[get_UL_I_TBS_from_MCS_NB_IoT(((DCIFormatN0_t *)DCI_pdu)->mcs, get_N_RU(), 0)][((DCIFormatN0_t *)DCI_pdu)->ResAssign];
// get_UL_I_TBS_from_MCS_NB_IoT() to be used to get the I_TBS for any NPUSCH format
(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.size = UL_TBS_Table_msg3[get_UL_I_TBS_from_MCS_NB_IoT(((DCIFormatN0_t *)DCI_pdu)->mcs, 0, 1)]; // for the case of MSG3
//LOG_D(MAC,"test\n");
(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.rnti = schedule_result_list_UL->rnti; //TODO : check if it is the right rnti // get from msg2
(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.subcarrier_indication = ((DCIFormatN0_t *)DCI_pdu)->scind;
......@@ -302,7 +304,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.repetition_number = ((DCIFormatN0_t *)DCI_pdu)->RepNum;
(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.new_data_indication = ((DCIFormatN0_t *)DCI_pdu)->ndi;
}else if(schedule_result_list_UL->npusch_format == 1){
} else if(schedule_result_list_UL->npusch_format == 1){
DCI_pdu = schedule_result_list_UL->DCI_pdu;
(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.nulsch_format = 1;
(ul_config_pdu + i) ->nulsch_pdu.nulsch_pdu_rel13.rnti = schedule_result_list_UL->rnti;
......
......@@ -186,6 +186,11 @@ uint32_t get_I_mcs(int CE_level);
uint32_t get_max_tbs(uint32_t I_tbs);
uint32_t get_tbs(uint32_t data_size, uint32_t I_tbs, uint32_t *I_sf);
uint32_t get_num_sf(uint32_t I_sf);
//////
uint8_t get_UL_I_TBS_from_MCS_NB_IoT(uint8_t I_mcs, uint8_t N_sc_RU, uint8_t Msg3_flag);
//////
uint32_t get_scheduling_delay(uint32_t I_delay, uint32_t R_max);
uint32_t get_HARQ_delay(int subcarrier_spacing, uint32_t HARQ_delay_index);
//void generate_scheduling_result_DL(uint32_t DCI_subframe, uint32_t NPDSCH_subframe, uint32_t HARQ_subframe, DCIFormatN1_t *DCI, rnti_t rnti, uint32_t TBS, uint8_t *DLSCH_pdu);
......
......@@ -60,7 +60,7 @@ const uint32_t mapped_mcs[3][8]={{1,5,9,10,3,7,11,12},
//TBS table for NPUSCH transmission TS 36.213 v14.2 table Table 16.5.1.2-2:
const int UL_TBS_Table[14][8]=
{
{16,2,56,88,120,152,208,256},
{16,32,56,88,120,152,208,256},
{24,56,88,144,176,208,256,344},
{32,72,144,176,208,256,328,424},
{40,104,176,208,256,328,440,568},
......
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