Commit a2d9f0d8 authored by Vincent Savaux's avatar Vincent Savaux

Modify NPPS for LTE pilots inband

parent 564268d0
...@@ -106,20 +106,20 @@ int rx_npdsch_NB_IoT(PHY_VARS_UE_NB_IoT *ue, ...@@ -106,20 +106,20 @@ int rx_npdsch_NB_IoT(PHY_VARS_UE_NB_IoT *ue,
NB_IoT_UE_DLSCH_t **dlsch; NB_IoT_UE_DLSCH_t **dlsch;
int avg[4]; int avg[4];
int avg_0[2]; // int avg_0[2];
int avg_1[2]; // int avg_1[2];
unsigned char aatx,aarx; unsigned char aatx,aarx;
unsigned short nb_rb = 0, round; unsigned short nb_rb = 0 , round;
int avgs, rb; int avgs /*,rb*/;
NB_IoT_DL_UE_HARQ_t *dlsch0_harq,*dlsch1_harq = 0; NB_IoT_DL_UE_HARQ_t *dlsch0_harq,*dlsch1_harq = 0;
uint8_t beamforming_mode; uint8_t beamforming_mode;
uint32_t *rballoc; uint32_t *rballoc;
int32_t **rxdataF_comp_ptr; // int32_t **rxdataF_comp_ptr;
int32_t **dl_ch_mag_ptr; // int32_t **dl_ch_mag_ptr;
int32_t codeword_TB0 = -1; int32_t codeword_TB0 = -1;
int32_t codeword_TB1 = -1; int32_t codeword_TB1 = -1;
...@@ -752,8 +752,8 @@ int rx_npdsch_NB_IoT(PHY_VARS_UE_NB_IoT *ue, ...@@ -752,8 +752,8 @@ int rx_npdsch_NB_IoT(PHY_VARS_UE_NB_IoT *ue,
// dl_ch_mag_ptr = pdsch_vars[eNB_id]->dl_ch_mag1[harq_pid][round]; // dl_ch_mag_ptr = pdsch_vars[eNB_id]->dl_ch_mag1[harq_pid][round];
// } // }
// else { // else {
rxdataF_comp_ptr = pdsch_vars[eNB_id_i]->rxdataF_comp0; // rxdataF_comp_ptr = pdsch_vars[eNB_id_i]->rxdataF_comp0;
dl_ch_mag_ptr = pdsch_vars[eNB_id_i]->dl_ch_mag0; // dl_ch_mag_ptr = pdsch_vars[eNB_id_i]->dl_ch_mag0;
//i_mod should have been passed as a parameter //i_mod should have been passed as a parameter
// } // }
...@@ -1161,7 +1161,7 @@ void dlsch_channel_compensation_NB_IoT(int **rxdataF_ext, ...@@ -1161,7 +1161,7 @@ void dlsch_channel_compensation_NB_IoT(int **rxdataF_ext,
unsigned short rb; unsigned short rb;
unsigned char aatx,aarx,symbol_mod,pilots=0; unsigned char aatx,aarx,symbol_mod,pilots=0;
__m128i *dl_ch128,*dl_ch128_2,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128,*rho128; __m128i *dl_ch128,*dl_ch128_2,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128,*rho128;
__m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b; __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3/*,QAM_amp128,QAM_amp128b*/;
// symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; // symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
symbol_mod = (symbol>=7) ? symbol-7 : symbol; symbol_mod = (symbol>=7) ? symbol-7 : symbol;
...@@ -4067,7 +4067,7 @@ unsigned short dlsch_extract_rbs_single_NB_IoT(int **rxdataF, ...@@ -4067,7 +4067,7 @@ unsigned short dlsch_extract_rbs_single_NB_IoT(int **rxdataF,
unsigned short rb,nb_rb=0; unsigned short rb,nb_rb=0;
unsigned char rb_alloc_ind; unsigned char rb_alloc_ind;
unsigned char i,aarx=0,/*l,*/nsymb,/*skip_half=0,*/sss_symb,pss_symb=0; unsigned char i,aarx=0/*,l,nsymb /*,skip_half=0,sss_symb,pss_symb=0*/;
int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext; int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext;
unsigned short UL_RB_ID_NB_IoT; // index of the NB-IoT RB unsigned short UL_RB_ID_NB_IoT; // index of the NB-IoT RB
uint8_t id_offset; // offset of pilot position in symbols: 0,1,2 uint8_t id_offset; // offset of pilot position in symbols: 0,1,2
...@@ -4080,7 +4080,7 @@ unsigned short dlsch_extract_rbs_single_NB_IoT(int **rxdataF, ...@@ -4080,7 +4080,7 @@ unsigned short dlsch_extract_rbs_single_NB_IoT(int **rxdataF,
crs_pilots = ((symbol_mod==0)||(symbol_mod==4)) ? 1 : 0; crs_pilots = ((symbol_mod==0)||(symbol_mod==4)) ? 1 : 0;
nrs_pilots = ((symbol_mod==5)||(symbol_mod==6)) ? 1 : 0; nrs_pilots = ((symbol_mod==5)||(symbol_mod==6)) ? 1 : 0;
// l=symbol; // l=symbol;
nsymb = 14; // normal CP in NB-IoT //nsymb = 14; // normal CP in NB-IoT
UL_RB_ID_NB_IoT = frame_parms->NB_IoT_RB_ID; // index of RB dedicated to NB-IoT UL_RB_ID_NB_IoT = frame_parms->NB_IoT_RB_ID; // index of RB dedicated to NB-IoT
id_offset = frame_parms->Nid_cell % 6; // frequency offset for NRS id_offset = frame_parms->Nid_cell % 6; // frequency offset for NRS
...@@ -4088,8 +4088,8 @@ unsigned short dlsch_extract_rbs_single_NB_IoT(int **rxdataF, ...@@ -4088,8 +4088,8 @@ unsigned short dlsch_extract_rbs_single_NB_IoT(int **rxdataF,
// sss_symb = nsymb-1; // sss_symb = nsymb-1;
// pss_symb = 2; // pss_symb = 2;
// } else { // } else {
sss_symb = (nsymb>>1)-2; // sss_symb = (nsymb>>1)-2;
pss_symb = (nsymb>>1)-1; // pss_symb = (nsymb>>1)-1;
// } // }
// Define the frequency offsets of CRS and NRS // Define the frequency offsets of CRS and NRS
...@@ -4160,7 +4160,7 @@ unsigned short dlsch_extract_rbs_single_NB_IoT(int **rxdataF, ...@@ -4160,7 +4160,7 @@ unsigned short dlsch_extract_rbs_single_NB_IoT(int **rxdataF,
// } // }
// } // }
if (rb_alloc_ind==1) { if (rb_alloc_ind==1) { // If subframe not including NPSS, NSSS
*pmi_ext = (pmi>>((rb>>2)<<1))&3; *pmi_ext = (pmi>>((rb>>2)<<1))&3;
memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int));
......
...@@ -21,6 +21,55 @@ ...@@ -21,6 +21,55 @@
//or #include "PHY/defs_nb_iot.h" //or #include "PHY/defs_nb_iot.h"
#include "PHY/LTE_REFSIG/primary_synch_NB_IoT.h" #include "PHY/LTE_REFSIG/primary_synch_NB_IoT.h"
// int generate_npss_NB_IoT(int32_t **txdataF,
// short amp,
// NB_IoT_DL_FRAME_PARMS *frame_parms,
// unsigned short symbol_offset, // symbol_offset should equal to 3 for NB-IoT
// unsigned short slot_offset,
// unsigned short RB_IoT_ID) // new attribute (values are between 0.. Max_RB_number-1), it does not exist for LTE
// {
// unsigned short c,aa,a,s;
// unsigned short slot_id;
// short *primary_sync;
// unsigned short NB_IoT_start; // Index of the first RE in the RB dedicated for NB-IoT
// unsigned short bandwidth_even_odd;
// slot_id = slot_offset; // The id(0..19) of the slot including the NPSS signal // For NB-IoT, slod_id should be 10 (SF5)
// primary_sync = primary_synch_NB_IoT; // primary_synch_NB_IoT[264] of primary_synch_NB_IoT.h
// // Signal amplitude
// a = (frame_parms->nb_antennas_tx == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15;
// // Testing if the total number of RBs is even or odd (i.e. Identification of the bandwidth: 1.4, 3, 5, 10, ... MHz)
// bandwidth_even_odd = frame_parms->N_RB_DL % 2; // 0 for even, 1 for odd
// for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
// if(RB_IoT_ID < (frame_parms->N_RB_DL/2))
// {
// NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
// } else {
// NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
// }
// // For the In-band or Stand-alone case the REs of NPSS signal have the same positions
// for (s=0; s<11; s++ ) // loop on OFDM symbols
// {
// for (c=0; c<12; c++) { // loop on NB-IoT carriers
// ((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )] =
// (a * primary_sync[2*c + (2*12*s)]) >> 15;
// ((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )+1] =
// (a * primary_sync[2*c + (2*12*s) + 1]) >> 15;
// }
// }
// }
// return(0);
// }
int generate_npss_NB_IoT(int32_t **txdataF, int generate_npss_NB_IoT(int32_t **txdataF,
short amp, short amp,
NB_IoT_DL_FRAME_PARMS *frame_parms, NB_IoT_DL_FRAME_PARMS *frame_parms,
...@@ -32,13 +81,18 @@ int generate_npss_NB_IoT(int32_t **txdataF, ...@@ -32,13 +81,18 @@ int generate_npss_NB_IoT(int32_t **txdataF,
unsigned short slot_id; unsigned short slot_id;
short *primary_sync; short *primary_sync;
unsigned short NB_IoT_start; // Index of the first RE in the RB dedicated for NB-IoT unsigned short NB_IoT_start; // Index of the first RE in the RB dedicated for NB-IoT
unsigned short bandwidth_even_odd; unsigned short bandwidth_even_odd;
unsigned short UL_RB_ID_NB_IoT; // index of the NB-IoT RB
unsigned char poffset=0, pilot=0; // poffset: base frequency offset of pilots; pilot: LTE pilot flag
UL_RB_ID_NB_IoT = frame_parms->NB_IoT_RB_ID; // index of RB dedicated to NB-IoT
slot_id = slot_offset; // The id(0..19) of the slot including the NPSS signal // For NB-IoT, slod_id should be 10 (SF5) slot_id = slot_offset; // The id(0..19) of the slot including the NPSS signal // For NB-IoT, slod_id should be 10 (SF5)
primary_sync = primary_synch_NB_IoT; // primary_synch_NB_IoT[264] of primary_synch_NB_IoT.h primary_sync = primary_synch_NB_IoT; // primary_synch_NB_IoT[264] of primary_synch_NB_IoT.h
// Signal amplitude // Signal amplitude
a = (frame_parms->nb_antennas_tx == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15; a = (frame_parms->nb_antennas_tx == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15_NB_IoT)>>15;
// Testing if the total number of RBs is even or odd (i.e. Identification of the bandwidth: 1.4, 3, 5, 10, ... MHz) // Testing if the total number of RBs is even or odd (i.e. Identification of the bandwidth: 1.4, 3, 5, 10, ... MHz)
bandwidth_even_odd = frame_parms->N_RB_DL % 2; // 0 for even, 1 for odd bandwidth_even_odd = frame_parms->N_RB_DL % 2; // 0 for even, 1 for odd
...@@ -46,24 +100,57 @@ int generate_npss_NB_IoT(int32_t **txdataF, ...@@ -46,24 +100,57 @@ int generate_npss_NB_IoT(int32_t **txdataF,
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
if(RB_IoT_ID < (frame_parms->N_RB_DL/2)) if(RB_IoT_ID < (frame_parms->N_RB_DL/2))
{ { // RB in first half (below DC)
NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2))); // NB_IoT_start = frame_parms->ofdm_symbol_size - 12*(frame_parms->N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
} else { NB_IoT_start = UL_RB_ID_NB_IoT*12 + frame_parms->first_carrier_offset;
NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2))); } else { // RB in the second half (above DC): DC is taken into account
// NB_IoT_start = 1+ (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(int)(ceil(frame_parms->N_RB_DL/(float)2)));
NB_IoT_start = 1 + bandwidth_even_odd*6 + 6*(2*UL_RB_ID_NB_IoT - (frame_parms->N_RB_DL+bandwidth_even_odd));
} }
// For the In-band or Stand-alone case the REs of NPSS signal have the same positions // For the In-band or Stand-alone case the REs of NPSS signal have the same positions
for (s=0; s<11; s++ ) // loop on OFDM symbols for (s=0; s<11; s++ ) // loop on OFDM symbols
{ {
for (c=0; c<12; c++) { // loop on NB-IoT carriers // CRS (LTE pilot) position within subframe in time
// Note that pilot position takes into account symbol_offset value
((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )] = if (frame_parms->mode1_flag==1){ // SISO mode
if (s==1 || s==4 || s==8){
(a * primary_sync[2*c + (2*12*s)]) >> 15; pilot = 1;
if (s==1 || s==8){
((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )+1] = poffset = 3;
}
(a * primary_sync[2*c + (2*12*s) + 1]) >> 15; }
}
if (pilot == 0){
for (c=0; c<12; c++) { // loop on NB-IoT carriers
((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )] =
(a * primary_sync[2*c + (2*12*s)]) >> 15;
((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )+1] =
(a * primary_sync[2*c + (2*12*s) + 1]) >> 15;
}
} }
else{
for (c=0; c<12; c++) { // loop on NB-IoT carriers
if ((c!=(frame_parms->nushift+poffset)) &&
(c!=((frame_parms->nushift+poffset+6)%12)))
{
((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )] =
(a * primary_sync[2*c + (2*12*s)]) >> 15;
((short*)txdataF[aa])[2*( (slot_id*7*frame_parms->ofdm_symbol_size) + ((symbol_offset+s)*frame_parms->ofdm_symbol_size) + NB_IoT_start + c )+1] =
(a * primary_sync[2*c + (2*12*s) + 1]) >> 15;
}
}
}
pilot = 0;
poffset = 0;
} }
} }
......
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