Commit c4448a2f authored by Thomas Schlichter's avatar Thomas Schlichter

fix warnings and indentation

parent 9f841634
...@@ -248,20 +248,19 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, ...@@ -248,20 +248,19 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
/// Antenna port mapping /// Antenna port mapping
//to be moved to init phase potentially, for now tx_layers 1-8 are mapped on antenna ports 1000-1007 //to be moved to init phase potentially, for now tx_layers 1-8 are mapped on antenna ports 1000-1007
/// DMRS QPSK modulation /// DMRS QPSK modulation
for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) { for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) {
if (rel15->dlDmrsSymbPos & (1 << l)) if (rel15->dlDmrsSymbPos & (1 << l))
nr_modulation(pdsch_dmrs[l][0], n_dmrs, DMRS_MOD_ORDER, mod_dmrs[l]); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated nr_modulation(pdsch_dmrs[l][0], n_dmrs, DMRS_MOD_ORDER, mod_dmrs[l]); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
} }
#ifdef DEBUG_DLSCH #ifdef DEBUG_DLSCH
l0 = get_l0(rel15->dlDmrsSymbPos); l0 = get_l0(rel15->dlDmrsSymbPos);
printf("DMRS modulation (single symbol %d, %d symbols, type %d):\n", l0, n_dmrs>>1, dmrs_Type); printf("DMRS modulation (single symbol %d, %d symbols, type %d):\n", l0, n_dmrs>>1, dmrs_Type);
for (int i=0; i<n_dmrs>>4; i++) { for (int i=0; i<n_dmrs>>4; i++) {
for (int j=0; j<8; j++) { for (int j=0; j<8; j++) {
printf("%d %d\t", mod_dmrs[((i<<3)+j)<<1], mod_dmrs[(((i<<3)+j)<<1)+1]); printf("%d %d\t", mod_dmrs[((i<<3)+j)<<1], mod_dmrs[(((i<<3)+j)<<1)+1]);
} }
printf("\n"); printf("\n");
} }
...@@ -287,8 +286,8 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, ...@@ -287,8 +286,8 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
delta = get_delta(ap, dmrs_Type); delta = get_delta(ap, dmrs_Type);
l_prime = 0; // single symbol ap 0 l_prime = 0; // single symbol ap 0
l0 = get_l0(rel15->dlDmrsSymbPos); l0 = get_l0(rel15->dlDmrsSymbPos);
uint8_t dmrs_symbol = l0+l_prime;
#ifdef DEBUG_DLSCH_MAPPING #ifdef DEBUG_DLSCH_MAPPING
uint8_t dmrs_symbol = l0+l_prime;
printf("DMRS Type %d params for ap %d: Wt %d %d \t Wf %d %d \t delta %d \t l_prime %d \t l0 %d\tDMRS symbol %d\n", printf("DMRS Type %d params for ap %d: Wt %d %d \t Wf %d %d \t delta %d \t l_prime %d \t l0 %d\tDMRS symbol %d\n",
1+dmrs_Type,ap, Wt[0], Wt[1], Wf[0], Wf[1], delta, l_prime, l0, dmrs_symbol); 1+dmrs_Type,ap, Wt[0], Wt[1], Wf[0], Wf[1], delta, l_prime, l0, dmrs_symbol);
#endif #endif
...@@ -296,54 +295,54 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, ...@@ -296,54 +295,54 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
uint16_t m=0, n=0, dmrs_idx=0, k=0; uint16_t m=0, n=0, dmrs_idx=0, k=0;
int txdataF_offset = (slot%2)*frame_parms->samples_per_slot_wCP; int txdataF_offset = (slot%2)*frame_parms->samples_per_slot_wCP;
for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) { for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) {
k = start_sc; k = start_sc;
n = 0; n = 0;
k_prime = 0; k_prime = 0;
if (dmrs_Type == NFAPI_NR_DMRS_TYPE1) // another if condition to be included to check pdsch config type (reference of k) if (dmrs_Type == NFAPI_NR_DMRS_TYPE1) // another if condition to be included to check pdsch config type (reference of k)
dmrs_idx = rel15->rbStart*6; dmrs_idx = rel15->rbStart*6;
else else
dmrs_idx = rel15->rbStart*4; dmrs_idx = rel15->rbStart*4;
for (int i=0; i<rel15->rbSize*NR_NB_SC_PER_RB; i++) { for (int i=0; i<rel15->rbSize*NR_NB_SC_PER_RB; i++) {
if ((rel15->dlDmrsSymbPos & (1 << l)) && (k == ((start_sc+get_dmrs_freq_idx(n, k_prime, delta, dmrs_Type))%(frame_parms->ofdm_symbol_size)))) { if ((rel15->dlDmrsSymbPos & (1 << l)) && (k == ((start_sc+get_dmrs_freq_idx(n, k_prime, delta, dmrs_Type))%(frame_parms->ofdm_symbol_size)))) {
if (l==(l0+1)) //take into account the double DMRS symbols if (l==(l0+1)) //take into account the double DMRS symbols
l_prime = 1; l_prime = 1;
else if (l>(l0+1)){//new DMRS pair else if (l>(l0+1)) {//new DMRS pair
l0 = l; l0 = l;
l_prime = 0; l_prime = 0;
} }
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[l][dmrs_idx<<1]) >> 15; ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[l][dmrs_idx<<1]) >> 15;
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15; ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15;
#ifdef DEBUG_DLSCH_MAPPING #ifdef DEBUG_DLSCH_MAPPING
printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n", printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n",
dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)],
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]); ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]);
#endif #endif
dmrs_idx++; dmrs_idx++;
k_prime++; k_prime++;
k_prime&=1; k_prime&=1;
n+=(k_prime)?0:1; n+=(k_prime)?0:1;
}
} else {
else {
if( (!(rel15->dlDmrsSymbPos & (1 << l))) || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,frame_parms->ofdm_symbol_size,rel15->numDmrsCdmGrpsNoData,dmrs_Type)) { if( (!(rel15->dlDmrsSymbPos & (1 << l))) || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,frame_parms->ofdm_symbol_size,rel15->numDmrsCdmGrpsNoData,dmrs_Type)) {
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (amp * tx_layers[ap][m<<1]) >> 15; ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (amp * tx_layers[ap][m<<1]) >> 15;
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15; ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15;
#ifdef DEBUG_DLSCH_MAPPING #ifdef DEBUG_DLSCH_MAPPING
printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", printf("m %d\t l %d \t k %d \t txdataF: %d %d\n",
m, l, k, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], m, l, k, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)],
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]); ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]);
#endif #endif
m++; m++;
} }
} }
if (++k >= frame_parms->ofdm_symbol_size) if (++k >= frame_parms->ofdm_symbol_size)
k -= frame_parms->ofdm_symbol_size; k -= frame_parms->ofdm_symbol_size;
} //RE loop } //RE loop
} // symbol loop } // symbol loop
}// layer loop }// layer loop
......
...@@ -1818,15 +1818,15 @@ void nr_dlsch_scale_channel(int **dl_ch_estimates_ext, ...@@ -1818,15 +1818,15 @@ void nr_dlsch_scale_channel(int **dl_ch_estimates_ext,
short rb, ch_amp; short rb, ch_amp;
unsigned char aatx,aarx; unsigned char aatx,aarx;
__m128i *dl_ch128, ch_amp128; __m128i *dl_ch128, ch_amp128;
uint32_t nb_rb_0 = len/12 + ((len%12)?1:0); uint32_t nb_rb_0 = len/12 + ((len%12)?1:0);
// Determine scaling amplitude based the symbol // Determine scaling amplitude based the symbol
ch_amp = 1024*8; //((pilots) ? (dlsch_ue[0]->sqrt_rho_b) : (dlsch_ue[0]->sqrt_rho_a)); ch_amp = 1024*8; //((pilots) ? (dlsch_ue[0]->sqrt_rho_b) : (dlsch_ue[0]->sqrt_rho_a));
LOG_D(PHY,"Scaling PDSCH Chest in OFDM symbol %d by %d, pilots %d nb_rb %d NCP %d symbol %d\n",symbol,ch_amp,pilots,nb_rb,frame_parms->Ncp,symbol); LOG_D(PHY,"Scaling PDSCH Chest in OFDM symbol %d by %d, pilots %d nb_rb %d NCP %d symbol %d\n",symbol,ch_amp,pilots,nb_rb,frame_parms->Ncp,symbol);
// printf("Scaling PDSCH Chest in OFDM symbol %d by %d\n",symbol_mod,ch_amp); // printf("Scaling PDSCH Chest in OFDM symbol %d by %d\n",symbol_mod,ch_amp);
ch_amp128 = _mm_set1_epi16(ch_amp); // Q3.13 ch_amp128 = _mm_set1_epi16(ch_amp); // Q3.13
...@@ -2379,11 +2379,11 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, ...@@ -2379,11 +2379,11 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
unsigned char j=0; unsigned char j=0;
if (config_type==pdsch_dmrs_type1) if (config_type==pdsch_dmrs_type1)
AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 1, AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 1,
"nushift %d is illegal\n",frame_parms->nushift); "nushift %d is illegal\n",frame_parms->nushift);
else else
AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 2 || frame_parms->nushift == 4, AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 2 || frame_parms->nushift == 4,
"nushift %d is illegal\n",frame_parms->nushift); "nushift %d is illegal\n",frame_parms->nushift);
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
...@@ -2403,50 +2403,44 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, ...@@ -2403,50 +2403,44 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
if (k>frame_parms->ofdm_symbol_size) { if (k>frame_parms->ofdm_symbol_size) {
k = k-frame_parms->ofdm_symbol_size; k = k-frame_parms->ofdm_symbol_size;
rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))]; rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))];
} }
if (pilots==0) { if (pilots==0) {
memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext)); memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext));
memcpy((void*)dl_ch0_ext,(void*)dl_ch0,12*sizeof(*dl_ch0_ext)); memcpy((void*)dl_ch0_ext,(void*)dl_ch0,12*sizeof(*dl_ch0_ext));
dl_ch0_ext+=12; dl_ch0_ext+=12;
rxF_ext+=12; rxF_ext+=12;
} else {//the symbol contains DMRS } else {//the symbol contains DMRS
j=0; j=0;
if (config_type==pdsch_dmrs_type1){ if (config_type==pdsch_dmrs_type1){
for (i = (1-frame_parms->nushift); for (i = (1-frame_parms->nushift); i<12; i+=2) {
i<12; rxF_ext[j]=rxF[i];
i+=2) { dl_ch0_ext[j]=dl_ch0[i];
rxF_ext[j]=rxF[i]; j++;
dl_ch0_ext[j]=dl_ch0[i]; }
j++; dl_ch0_ext+=6;
} rxF_ext+=6;
dl_ch0_ext+=6; } else {
rxF_ext+=6; for (i = (2+frame_parms->nushift); i<6; i++) {
} else { rxF_ext[j]=rxF[i];
for (i = (2+frame_parms->nushift); dl_ch0_ext[j]=dl_ch0[i];
i<6; j++;
i++) { }
rxF_ext[j]=rxF[i]; for (i = (8+frame_parms->nushift); i<12; i++) {
dl_ch0_ext[j]=dl_ch0[i]; rxF_ext[j]=rxF[i];
j++; dl_ch0_ext[j]=dl_ch0[i];
} j++;
for (i = (8+frame_parms->nushift); }
i<12; dl_ch0_ext+= 8;
i++) { rxF_ext+= 8;
rxF_ext[j]=rxF[i]; }
dl_ch0_ext[j]=dl_ch0[i];
j++;
}
dl_ch0_ext+= 8;
rxF_ext+= 8;
}
} }
dl_ch0+=12; dl_ch0+=12;
rxF+=12; rxF+=12;
k+=12; k+=12;
if (k>=frame_parms->ofdm_symbol_size) { if (k>=frame_parms->ofdm_symbol_size) {
k=k-(frame_parms->ofdm_symbol_size); k = k-(frame_parms->ofdm_symbol_size);
rxF = &rxdataF[aarx][k+(symbol*(frame_parms->ofdm_symbol_size))]; rxF = &rxdataF[aarx][k+(symbol*(frame_parms->ofdm_symbol_size))];
} }
} }
} }
......
...@@ -714,10 +714,10 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, ...@@ -714,10 +714,10 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
unsigned short pmi, unsigned short pmi,
unsigned char *pmi_ext, unsigned char *pmi_ext,
unsigned char symbol, unsigned char symbol,
uint8_t pilots, uint8_t pilots,
uint8_t config_type, uint8_t config_type,
unsigned short start_rb, unsigned short start_rb,
unsigned short nb_pdsch_rb, unsigned short nb_pdsch_rb,
unsigned char nr_tti_rx, unsigned char nr_tti_rx,
uint32_t high_speed_flag, uint32_t high_speed_flag,
NR_DL_FRAME_PARMS *frame_parms); NR_DL_FRAME_PARMS *frame_parms);
...@@ -1003,8 +1003,8 @@ void nr_dlsch_scale_channel(int32_t **dl_ch_estimates_ext, ...@@ -1003,8 +1003,8 @@ void nr_dlsch_scale_channel(int32_t **dl_ch_estimates_ext,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
NR_UE_DLSCH_t **dlsch_ue, NR_UE_DLSCH_t **dlsch_ue,
uint8_t symbol, uint8_t symbol,
uint8_t start_symbol, uint8_t start_symbol,
uint32_t len, uint32_t len,
uint16_t nb_rb); uint16_t nb_rb);
/** \brief This is the top-level entry point for DLSCH decoding in UE. It should be replicated on several /** \brief This is the top-level entry point for DLSCH decoding in UE. It should be replicated on several
......
...@@ -715,8 +715,6 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, ...@@ -715,8 +715,6 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_id, PDSCH_t pdsch, NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1) { int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_id, PDSCH_t pdsch, NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1) {
int nr_tti_rx = proc->nr_tti_rx; int nr_tti_rx = proc->nr_tti_rx;
int nr_frame_rx = proc->frame_rx;//LOG_M
char filename[100];//LOG_M
int m; int m;
int i_mod,eNB_id_i,dual_stream_UE; int i_mod,eNB_id_i,dual_stream_UE;
int first_symbol_flag=0; int first_symbol_flag=0;
...@@ -740,23 +738,27 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ ...@@ -740,23 +738,27 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
// do channel estimation for first DMRS only // do channel estimation for first DMRS only
for (m = s0; m < 3; m++) { for (m = s0; m < 3; m++) {
if (((1<<m)&dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos) > 0) { if (((1<<m)&dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos) > 0) {
for (uint8_t aatx=0; aatx<1; aatx++) {//for MIMO Config: it shall loop over no_layers for (uint8_t aatx=0; aatx<1; aatx++) {//for MIMO Config: it shall loop over no_layers
nr_pdsch_channel_estimation(ue, nr_pdsch_channel_estimation(ue,
0 /*eNB_id*/, 0 /*eNB_id*/,
nr_tti_rx, nr_tti_rx,
aatx /*p*/, aatx /*p*/,
m, m,
ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12, ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12,
pdsch_nb_rb); pdsch_nb_rb);
///LOG_M: the channel estimation LOG_D(PHY,"PDSCH Channel estimation gNB id %d, PDSCH antenna port %d, slot %d, symbol %d\n",0,aatx,nr_tti_rx,m);
LOG_D(PHY,"PDSCH Channel estimation gNB id %d, PDSCH antenna port %d, slot %d, symbol %d\n",0,aatx,nr_tti_rx,m); #if 0
for (uint8_t aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { ///LOG_M: the channel estimation
sprintf(filename,"PDSCH_CHANNEL_frame%d_slot%d_sym%d_port%d_rx%d.m", nr_frame_rx, nr_tti_rx, m, aatx,aarx);//LOG_M int nr_frame_rx = proc->frame_rx;
int **dl_ch_estimates = ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][0]->dl_ch_estimates; char filename[100];
//LOG_M(filename,"channel_F",&dl_ch_estimates[aatx*ue->frame_parms.nb_antennas_rx+aarx][ue->frame_parms.ofdm_symbol_size*m],ue->frame_parms.ofdm_symbol_size, 1, 1); for (uint8_t aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
} sprintf(filename,"PDSCH_CHANNEL_frame%d_slot%d_sym%d_port%d_rx%d.m", nr_frame_rx, nr_tti_rx, m, aatx,aarx);
} int **dl_ch_estimates = ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][0]->dl_ch_estimates;
break; LOG_M(filename,"channel_F",&dl_ch_estimates[aatx*ue->frame_parms.nb_antennas_rx+aarx][ue->frame_parms.ofdm_symbol_size*m],ue->frame_parms.ofdm_symbol_size, 1, 1);
}
#endif
}
break;
} }
} }
for (m = s0; m < (s1 + s0); m++) { for (m = s0; m < (s1 + s0); m++) {
......
...@@ -23,7 +23,7 @@ gNBs = ...@@ -23,7 +23,7 @@ gNBs =
ssb_SubcarrierOffset = 0; ssb_SubcarrierOffset = 0;
pdsch_AntennaPorts = 1; pdsch_AntennaPorts = 1;
servingCellConfigCommon = ( servingCellConfigCommon = (
{ {
#spCellConfigCommon #spCellConfigCommon
......
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