Commit 5f22cfb3 authored by hongzhi wang's avatar hongzhi wang

nr ue pdsch bug fix

parent 60ae0c15
...@@ -56,7 +56,7 @@ uint32_t nr_compute_tbs(uint8_t mcs, ...@@ -56,7 +56,7 @@ uint32_t nr_compute_tbs(uint8_t mcs,
// Intermediate number of information bits // Intermediate number of information bits
Ninfo = (double)((nb_re * R * Qm * Nl)/1024); Ninfo = (double)((nb_re * R * Qm * Nl)/1024);
//printf("Ninfo %d nbp_re %d nb_re %d Qm %d, R %d\n", Ninfo, nbp_re, nb_re, Qm, R); //printf("Ninfo %lf nbp_re %d nb_re %d mcs %d Qm %d, R %d\n", Ninfo, nbp_re, nb_re,mcs, Qm, R);
if (Ninfo <=3824) { if (Ninfo <=3824) {
...@@ -85,7 +85,7 @@ uint32_t nr_compute_tbs(uint8_t mcs, ...@@ -85,7 +85,7 @@ uint32_t nr_compute_tbs(uint8_t mcs,
} }
else { else {
nr_tbs = (uint32_t)(8 * ceil( (Np_info + 24)/8 ) - 24); nr_tbs = (uint32_t)(8 * ceil( (Np_info + 24)/8 ) - 24);
//printf("n %f Np_info %f pow %f ceil %f \n",n, Np_info,pow(2,6),ceil( (Np_info + 24)/8 )); //printf("n %lf Np_info %f pow %f ceil %f \n",n, Np_info,pow(2,6),ceil( (Np_info + 24)/8 ));
} }
} }
......
...@@ -54,6 +54,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -54,6 +54,8 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
uint16_t nb_rb_coreset = 24; uint16_t nb_rb_coreset = 24;
uint16_t bwp_start_subcarrier = frame_parms->first_carrier_offset+516; uint16_t bwp_start_subcarrier = frame_parms->first_carrier_offset+516;
uint16_t nb_rb_pdsch = 50; uint16_t nb_rb_pdsch = 50;
uint8_t p=0;
uint8_t l0 = 2;
void (*dft)(int16_t *,int16_t *, int); void (*dft)(int16_t *,int16_t *, int);
int tmp_dft_in[8192] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs int tmp_dft_in[8192] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs
...@@ -259,13 +261,18 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -259,13 +261,18 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
start_meas(&ue->dlsch_channel_estimation_stats); start_meas(&ue->dlsch_channel_estimation_stats);
#endif #endif
ue->frame_parms.nushift = (p>>1)&1;;
if (symbol ==l0)
nr_pdsch_channel_estimation(ue,eNB_id,0, nr_pdsch_channel_estimation(ue,eNB_id,0,
Ns, Ns,
0, p,
l, l,
symbol, symbol,
bwp_start_subcarrier, bwp_start_subcarrier,
nb_rb_pdsch); nb_rb_pdsch);
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(&ue->dlsch_channel_estimation_stats); stop_meas(&ue->dlsch_channel_estimation_stats);
#endif #endif
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h"
#include "filt16a_32.h" #include "filt16a_32.h"
#include "T.h" #include "T.h"
//#define DEBUG_CH //#define DEBUG_PDSCH
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
...@@ -286,7 +286,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -286,7 +286,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
k = coreset_start_subcarrier; k = coreset_start_subcarrier;
#ifdef DEBUG_CH #ifdef DEBUG_PDCCH
printf("PDCCH Channel Estimation : ThreadId %d, eNB_offset %d ch_offset %d, OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d symbol %d\n",ue->current_thread_id[Ns>>1], eNB_offset,ch_offset,ue->frame_parms.ofdm_symbol_size, printf("PDCCH Channel Estimation : ThreadId %d, eNB_offset %d ch_offset %d, OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d symbol %d\n",ue->current_thread_id[Ns>>1], eNB_offset,ch_offset,ue->frame_parms.ofdm_symbol_size,
ue->frame_parms.Ncp,l,Ns,k, symbol); ue->frame_parms.Ncp,l,Ns,k, symbol);
#endif #endif
...@@ -309,18 +309,18 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -309,18 +309,18 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
multadd_complex_vector_real_scalar(dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), multadd_complex_vector_real_scalar(dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),
ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),
1,ue->frame_parms.ofdm_symbol_size); 1,ue->frame_parms.ofdm_symbol_size);
//#ifdef DEBUG_CH #ifdef DEBUG_PDCCH
printf("pdcch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL); printf("pdcch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL);
printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset); printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset);
printf("rxF addr %p\n", rxF); printf("rxF addr %p\n", rxF);
printf("dl_ch addr %p\n",dl_ch); printf("dl_ch addr %p nushift %d\n",dl_ch,nushift);
//#endif #endif
if ((ue->frame_parms.N_RB_DL&1)==0) { if ((ue->frame_parms.N_RB_DL&1)==0) {
// Treat first 2 pilots specially (left edge) // Treat first 2 pilots specially (left edge)
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_CH #ifdef DEBUG_PDCCH
printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])); printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1]));
printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]); printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]);
#endif #endif
...@@ -335,7 +335,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -335,7 +335,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_CH #ifdef DEBUG_PDCCH
printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif #endif
multadd_real_vector_complex_scalar(fm, multadd_real_vector_complex_scalar(fm,
...@@ -348,7 +348,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -348,7 +348,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_CH #ifdef DEBUG_PDCCH
printf("pilot 2 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); printf("pilot 2 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif #endif
...@@ -357,7 +357,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -357,7 +357,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
dl_ch, dl_ch,
16); 16);
#ifdef DEBUG_CH #ifdef DEBUG_PDCCH
for (int m =0; m<12; m++) for (int m =0; m<12; m++)
printf("data : dl_ch -> (%d,%d)\n",dl_ch[0+2*m],dl_ch[1+2*m]); printf("data : dl_ch -> (%d,%d)\n",dl_ch[0+2*m],dl_ch[1+2*m]);
#endif #endif
...@@ -376,7 +376,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -376,7 +376,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_CH #ifdef DEBUG_PDCCH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif #endif
multadd_real_vector_complex_scalar(fl, multadd_real_vector_complex_scalar(fl,
...@@ -392,7 +392,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -392,7 +392,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_CH #ifdef DEBUG_PDCCH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif #endif
multadd_real_vector_complex_scalar(fm, multadd_real_vector_complex_scalar(fm,
...@@ -405,7 +405,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -405,7 +405,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_CH #ifdef DEBUG_PDCCH
printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif #endif
...@@ -448,8 +448,6 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -448,8 +448,6 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
//uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1]; //uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1];
uint8_t nushift; uint8_t nushift;
//int **dl_ch_estimates =ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].dl_ch_estimates[eNB_offset];
//int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF;
int **dl_ch_estimates =ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].dl_ch_estimates[eNB_offset]; int **dl_ch_estimates =ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].dl_ch_estimates[eNB_offset];
int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF; int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF;
...@@ -464,6 +462,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -464,6 +462,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
symbol_offset = ue->frame_parms.ofdm_symbol_size*symbol; symbol_offset = ue->frame_parms.ofdm_symbol_size*symbol;
k = bwp_start_subcarrier; k = bwp_start_subcarrier;
int re_offset = k;
//#ifdef DEBUG_CH //#ifdef DEBUG_CH
printf("PDSCH Channel Estimation : ThreadId %d, eNB_offset %d ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d symbol %d\n",ue->current_thread_id[Ns>>1], eNB_offset,ch_offset,symbol_offset,ue->frame_parms.ofdm_symbol_size, printf("PDSCH Channel Estimation : ThreadId %d, eNB_offset %d ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d symbol %d\n",ue->current_thread_id[Ns>>1], eNB_offset,ch_offset,symbol_offset,ue->frame_parms.ofdm_symbol_size,
...@@ -510,138 +509,142 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -510,138 +509,142 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
multadd_complex_vector_real_scalar(dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), multadd_complex_vector_real_scalar(dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),
ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),
1,ue->frame_parms.ofdm_symbol_size); 1,ue->frame_parms.ofdm_symbol_size);
//#ifdef DEBUG_CH #ifdef DEBUG_PDSCH
printf("ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL); printf("ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL);
printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset); printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset);
printf("rxF addr %p p %d\n", rxF,p); printf("rxF addr %p p %d\n", rxF,p);
printf("dl_ch addr %p\n",dl_ch); printf("dl_ch addr %p nushift %d\n",dl_ch,nushift);
//#endif #endif
//if ((ue->frame_parms.N_RB_DL&1)==0) { //if ((ue->frame_parms.N_RB_DL&1)==0) {
// Treat first 2 pilots specially (left edge) // Treat first 2 pilots specially (left edge)
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
//#ifdef DEBUG_CH #ifdef DEBUG_PDSCH
printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])); printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1]));
printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]); printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]);
//#endif printf("data 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[2],rxF[3],&rxF[2],ch[0],ch[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fl, multadd_real_vector_complex_scalar(fl,
ch, ch,
dl_ch, dl_ch,
8); 8);
pil+=2; pil+=2;
rxF+=4; re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
//for (int i= 0; i<8; i++) //for (int i= 0; i<8; i++)
//printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i)); //printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i));
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
//#ifdef DEBUG_CH #ifdef DEBUG_PDSCH
printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
//#endif #endif
multadd_real_vector_complex_scalar(fml, multadd_real_vector_complex_scalar(fml,
ch, ch,
dl_ch, dl_ch,
8); 8);
pil+=2; pil+=2;
rxF+=4; re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
printf("dl_ch addr %p\n",dl_ch); printf("dl_ch addr %p\n",dl_ch);
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
//#ifdef DEBUG_CH #ifdef DEBUG_PDSCH
printf("pilot 2 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); printf("pilot 2 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
//#endif #endif
multadd_real_vector_complex_scalar(fmm, multadd_real_vector_complex_scalar(fmm,
ch, ch,
dl_ch, dl_ch,
8); 8);
//for (int i= 0; i<16; i++)
//printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i));
pil+=2; pil+=2;
rxF+=4; re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
dl_ch+=8; dl_ch+=8;
k+=4;
printf("dl_ch addr %p\n",dl_ch);
for (pilot_cnt=3; pilot_cnt<6*(nb_rb_pdsch-1); pilot_cnt+=3) { for (pilot_cnt=3; pilot_cnt<(6*nb_rb_pdsch-3); pilot_cnt+=2) {
//if ((pilot_cnt%6)==0) //if ((pilot_cnt%6)==0)
//dl_ch+=4; //dl_ch+=4;
//printf("re_offset %d\n",re_offset);
if (k >= ue->frame_parms.ofdm_symbol_size){
k-=ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+nushift)];}
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
//#ifdef DEBUG_CH #ifdef DEBUG_PDSCH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
//#endif #endif
multadd_real_vector_complex_scalar(fm, multadd_real_vector_complex_scalar(fm,
ch, ch,
dl_ch, dl_ch,
8); 8);
pil+=2; pil+=2;
rxF+=4; re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
//#ifdef DEBUG_CH #ifdef DEBUG_PDSCH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
//#endif #endif
multadd_real_vector_complex_scalar(fmm, multadd_real_vector_complex_scalar(fmm,
ch, ch,
dl_ch, dl_ch,
8); 8);
pil+=2; pil+=2;
rxF+=4; re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
dl_ch+=8; dl_ch+=8;
k+=4;
} }
// Treat first 2 pilots specially (right edge) // Treat first 2 pilots specially (right edge)
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
//#ifdef DEBUG_CH #ifdef DEBUG_PDSCH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]); printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
//#endif #endif
multadd_real_vector_complex_scalar(fmm, multadd_real_vector_complex_scalar(fm,
ch, ch,
dl_ch, dl_ch,
8); 8);
//for (int i= 0; i<8; i++)
//printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i));
pil+=2; pil+=2;
rxF+=4; re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
//#ifdef DEBUG_CH #ifdef DEBUG_PDSCH
printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])); printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1]));
printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]); printf("pilot %d: rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]);
//#endif #endif
multadd_real_vector_complex_scalar(fmr, multadd_real_vector_complex_scalar(fmr,
ch, ch,
dl_ch, dl_ch,
8); 8);
pil+=2; pil+=2;
rxF+=4; re_offset = (re_offset+2)&(ue->frame_parms.ofdm_symbol_size-1);
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
dl_ch+=8; dl_ch+=8;
k+=4;
//for (int i= 0; i<8; i++) ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
//printf("dl_ch addr %p %d\n", dl_ch+i, *(dl_ch+i)); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDSCH
//ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); printf("pilot %d: rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+2,rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
//ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_CH
printf("pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],ch[0],ch[1],pil[0],pil[1]);
#endif #endif
multadd_real_vector_complex_scalar(fr, multadd_real_vector_complex_scalar(fr,
ch, ch,
dl_ch, dl_ch,
4); 8);
//pil+=2;
//rxF+=4;
//} //}
} }
......
...@@ -292,7 +292,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -292,7 +292,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, harq_process->Qm,harq_process->Nl); harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, harq_process->Qm,harq_process->Nl);
G = harq_process->G; G = harq_process->G;
//printf("DLSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d \n",harq_pid,A,G, harq_process->mcs, harq_process->Nl, nb_symb_sch); printf("DLSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d \n",harq_pid,A,G, harq_process->mcs, harq_process->Nl, nb_symb_sch);
if (harq_process->round == 0) { if (harq_process->round == 0) {
// This is a new packet, so compute quantities regarding segmentation // This is a new packet, so compute quantities regarding segmentation
......
...@@ -128,7 +128,13 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -128,7 +128,13 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
//to be updated higher layer //to be updated higher layer
unsigned short start_rb = 0; unsigned short start_rb = 0;
unsigned short nb_pdsch_rb = 106; unsigned short nb_rb_pdsch = 50;
int8_t *pllr_symbol_cw0;
int8_t *pllr_symbol_cw1;
int8_t *pllr_symbol_cw0_deint;
int8_t *pllr_symbol_cw1_deint;
uint32_t llr_offset_symbol;
uint16_t bundle_L = 2;
switch (type) { switch (type) {
case SI_PDSCH: case SI_PDSCH:
...@@ -148,7 +154,17 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -148,7 +154,17 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
case PDSCH: case PDSCH:
pdsch_vars = ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]]; pdsch_vars = ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]];
dlsch = ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id]; dlsch = ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id];
//printf("status TB0 = %d, status TB1 = %d \n", dlsch[0]->harq_processes[harq_pid]->status, dlsch[1]->harq_processes[harq_pid]->status);
//set active for testing -> to be removed
dlsch[0]->harq_processes[harq_pid]->status = ACTIVE;
dlsch[0]->harq_processes[harq_pid]->Qm = 2;
dlsch[0]->harq_processes[harq_pid]->mcs = 9;
dlsch[0]->harq_processes[harq_pid]->Nl=1;
dlsch[0]->harq_processes[harq_pid]->nb_rb = nb_rb_pdsch;
frame_parms->nushift = 0;
printf("status TB0 = %d, status TB1 = %d \n", dlsch[0]->harq_processes[harq_pid]->status, dlsch[1]->harq_processes[harq_pid]->status);
LOG_D(PHY,"AbsSubframe %d.%d / Sym %d harq_pid %d, harq status %d.%d \n", LOG_D(PHY,"AbsSubframe %d.%d / Sym %d harq_pid %d, harq status %d.%d \n",
frame,nr_tti_rx,symbol,harq_pid, frame,nr_tti_rx,symbol,harq_pid,
dlsch[0]->harq_processes[harq_pid]->status, dlsch[0]->harq_processes[harq_pid]->status,
...@@ -322,6 +338,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -322,6 +338,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
#endif #endif
if (beamforming_mode==0) { //else if nb_antennas_ports_eNB==1 && beamforming_mode == 0 if (beamforming_mode==0) { //else if nb_antennas_ports_eNB==1 && beamforming_mode == 0
printf("start nr dlsch extract nr_tti_rx %d thread id %d \n", nr_tti_rx, ue->current_thread_id[nr_tti_rx]);
nb_rb = nr_dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[nr_tti_rx]].rxdataF, nb_rb = nr_dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[nr_tti_rx]].rxdataF,
common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[nr_tti_rx]].dl_ch_estimates[eNB_id], common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[nr_tti_rx]].dl_ch_estimates[eNB_id],
pdsch_vars[eNB_id]->rxdataF_ext, pdsch_vars[eNB_id]->rxdataF_ext,
...@@ -331,7 +348,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -331,7 +348,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
rballoc, rballoc,
symbol, symbol,
start_rb, start_rb,
nb_pdsch_rb, nb_rb_pdsch,
nr_tti_rx, nr_tti_rx,
ue->high_speed_flag, ue->high_speed_flag,
frame_parms); frame_parms);
...@@ -516,14 +533,14 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -516,14 +533,14 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
symbol, symbol,
nb_rb);*/ nb_rb);*/
} }
#ifdef UE_DEBUG_TRACE //#ifdef UE_DEBUG_TRACE
LOG_D(PHY,"[DLSCH] AbsSubframe %d.%d log2_maxh = %d [log2_maxh0 %d log2_maxh1 %d] (%d,%d)\n", LOG_I(PHY,"[DLSCH] AbsSubframe %d.%d log2_maxh = %d [log2_maxh0 %d log2_maxh1 %d] (%d,%d)\n",
frame%1024,nr_tti_rx, pdsch_vars[eNB_id]->log2_maxh, frame%1024,nr_tti_rx, pdsch_vars[eNB_id]->log2_maxh,
pdsch_vars[eNB_id]->log2_maxh0, pdsch_vars[eNB_id]->log2_maxh0,
pdsch_vars[eNB_id]->log2_maxh1, pdsch_vars[eNB_id]->log2_maxh1,
avg[0],avgs); avg[0],avgs);
//LOG_D(PHY,"[DLSCH] mimo_mode = %d\n", dlsch0_harq->mimo_mode); //LOG_D(PHY,"[DLSCH] mimo_mode = %d\n", dlsch0_harq->mimo_mode);
#endif //#endif
//wait until pdcch is decoded //wait until pdcch is decoded
//proc->channel_level = 1; //proc->channel_level = 1;
...@@ -761,9 +778,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -761,9 +778,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]); stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]);
#if DISABLE_LOG_X #if DISABLE_LOG_X
//printf("[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n",frame,nr_tti_rx,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,proc->channel_level,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); printf("[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n",frame,nr_tti_rx,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,proc->channel_level,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0));
#else #else
//LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n",frame,nr_tti_rx,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,proc->channel_level,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0)); LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n",frame,nr_tti_rx,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,proc->channel_level,ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot].p_time/(cpuf*1000.0));
#endif #endif
#endif #endif
// MRC // MRC
...@@ -826,7 +843,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -826,7 +843,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
} }
#endif #endif
// printf("LLR"); printf("start compute LLR\n");
if ((dlsch0_harq->mimo_mode == LARGE_CDD) || if ((dlsch0_harq->mimo_mode == LARGE_CDD) ||
((dlsch0_harq->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) && ((dlsch0_harq->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) &&
(dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING))) { (dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING))) {
...@@ -840,7 +857,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -840,7 +857,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
} }
nb_re= (symbol==2)? (nb_rb*6):(nb_rb*12); nb_re= (symbol==2)? (nb_rb*6):(nb_rb*12);
pdsch_vars[eNB_id]->llr_offset[symbol] = nb_re*dlsch0_harq->Qm * 2; pdsch_vars[eNB_id]->llr_offset[symbol] = nb_re*dlsch0_harq->Qm;
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]); stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]);
...@@ -857,27 +874,31 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -857,27 +874,31 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
//printf("LLR dlsch0_harq->Qm %d rx_type %d cw0 %d cw1 %d symbol %d \n",dlsch0_harq->Qm,rx_type,codeword_TB0,codeword_TB1,symbol); //printf("LLR dlsch0_harq->Qm %d rx_type %d cw0 %d cw1 %d symbol %d \n",dlsch0_harq->Qm,rx_type,codeword_TB0,codeword_TB1,symbol);
// compute LLRs // compute LLRs
// -> // compute @pointer where llrs should filled for this ofdm-symbol // -> // compute @pointer where llrs should filled for this ofdm-symbol
int8_t *pllr_symbol_cw0;
int8_t *pllr_symbol_cw1;
int8_t *pllr_symbol_cw0_deint;
int8_t *pllr_symbol_cw1_deint;
uint32_t llr_offset_symbol;
uint32_t nb_rb_pdsch = 106;
uint16_t bundle_L = 2;
llr_offset_symbol = pdsch_vars[eNB_id]->llr_offset[symbol]; llr_offset_symbol = pdsch_vars[eNB_id]->llr_offset[symbol];
pllr_symbol_cw0_deint = (int8_t*)pdsch_vars[eNB_id]->llr[0]; //pllr_symbol_cw0_deint = (int8_t*)pdsch_vars[eNB_id]->llr[0];
pllr_symbol_cw1_deint = (int8_t*)pdsch_vars[eNB_id]->llr[1]; //pllr_symbol_cw1_deint = (int8_t*)pdsch_vars[eNB_id]->llr[1];
pllr_symbol_cw0 = (int8_t*)pdsch_vars[eNB_id]->llr[0];
pllr_symbol_cw1 = (int8_t*)pdsch_vars[eNB_id]->llr[1];
pllr_symbol_cw0 += llr_offset_symbol; pllr_symbol_cw0 += llr_offset_symbol;
pllr_symbol_cw1 += llr_offset_symbol; pllr_symbol_cw1 += llr_offset_symbol;
/*LOG_I(PHY,"compute LLRs [AbsSubframe %d.%d-%d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %x @LLR Buff(symb) %x\n", /*LOG_I(PHY,"compute LLRs [symbol %d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %x @LLR Buff(symb) %x\n",
proc->frame_rx, proc->subframe_rx,symbol, symbol,
nb_rb,dlsch0_harq->Qm,
pdsch_vars[eNB_id]->llr_length[symbol],
pdsch_vars[eNB_id]->llr_offset[symbol],
(int16_t*)pdsch_vars[eNB_id]->llr[0],
pllr_symbol_cw0);*/
printf("compute LLRs [symbol %d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %p @LLR Buff(symb) %p\n",
symbol,
nb_rb,dlsch0_harq->Qm, nb_rb,dlsch0_harq->Qm,
pdsch_vars[eNB_id]->llr_length[symbol], pdsch_vars[eNB_id]->llr_length[symbol],
pdsch_vars[eNB_id]->llr_offset[symbol], pdsch_vars[eNB_id]->llr_offset[symbol],
(int16_t*)pdsch_vars[eNB_id]->llr[0], (int16_t*)pdsch_vars[eNB_id]->llr[0],
pllr_symbol);*/ pllr_symbol_cw0);
switch (dlsch0_harq->Qm) { switch (dlsch0_harq->Qm) {
case 2 : case 2 :
...@@ -889,6 +910,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -889,6 +910,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
first_symbol_flag, first_symbol_flag,
nb_rb, nb_rb,
beamforming_mode); beamforming_mode);
printf("end llr symol %d\n",symbol);
} else if (codeword_TB0 == -1){ } else if (codeword_TB0 == -1){
...@@ -1197,7 +1219,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -1197,7 +1219,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
} }
} }
nr_dlsch_deinterleaving(symbol,bundle_L,(int16_t*)pllr_symbol_cw0,(int16_t*)pllr_symbol_cw0_deint, nb_rb_pdsch); //nr_dlsch_deinterleaving(symbol,bundle_L,(int16_t*)pllr_symbol_cw0,(int16_t*)pllr_symbol_cw0_deint, nb_rb_pdsch);
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]); stop_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]);
...@@ -1261,7 +1283,7 @@ void nr_dlsch_deinterleaving(uint8_t symbol, ...@@ -1261,7 +1283,7 @@ void nr_dlsch_deinterleaving(uint8_t symbol,
uint16_t L, uint16_t L,
uint16_t *llr, uint16_t *llr,
uint16_t *llr_deint, uint16_t *llr_deint,
uint32_t nb_rb_pdsch) uint16_t nb_rb_pdsch)
{ {
uint32_t bundle_idx, N_bundle, R, C, r,c; uint32_t bundle_idx, N_bundle, R, C, r,c;
...@@ -1329,8 +1351,6 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, ...@@ -1329,8 +1351,6 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext,
__m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b; __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b;
//if (frame_parms->mode1_flag==1) // 10 out of 12 so don't reduce size
if (symbol == 2){ if (symbol == 2){
pilots=1; pilots=1;
} }
...@@ -1846,7 +1866,7 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext, ...@@ -1846,7 +1866,7 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext,
#if defined(__x86_64__)||defined(__i386__) #if defined(__x86_64__)||defined(__i386__)
short rb; short rb;
unsigned char aatx,aarx,nre=12,symbol_mod; unsigned char aatx,aarx,nre=12;
__m128i *dl_ch128, avg128D; __m128i *dl_ch128, avg128D;
if (symbol==2) //assume start symbol 2 if (symbol==2) //assume start symbol 2
...@@ -1876,14 +1896,14 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext, ...@@ -1876,14 +1896,14 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext,
//avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[0],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[0], coeff128),15))); //avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[0],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[0], coeff128),15)));
//avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[1],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[1], coeff128),15))); //avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[1],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[1], coeff128),15)));
if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) { /*if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) {
dl_ch128+=2; dl_ch128+=2;
} }
else { else {*/
avg128D = _mm_add_epi32(avg128D,_mm_srai_epi16(_mm_madd_epi16(dl_ch128[2],dl_ch128[2]),x)); avg128D = _mm_add_epi32(avg128D,_mm_srai_epi16(_mm_madd_epi16(dl_ch128[2],dl_ch128[2]),x));
//avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[2],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[2], coeff128),15))); //avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[2],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[2], coeff128),15)));
dl_ch128+=3; dl_ch128+=3;
} // }
/* /*
if (rb==0) { if (rb==0) {
print_shorts("dl_ch128",&dl_ch128[0]); print_shorts("dl_ch128",&dl_ch128[0]);
...@@ -1975,53 +1995,53 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, ...@@ -1975,53 +1995,53 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
unsigned int *rb_alloc, unsigned int *rb_alloc,
unsigned char symbol, unsigned char symbol,
unsigned short start_rb, unsigned short start_rb,
unsigned short nb_pdsch_rb, unsigned short nb_rb_pdsch,
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) {
unsigned short k,rb,nb_rb=0; unsigned short k,rb;
unsigned char rb_alloc_ind; unsigned char i,aarx,l; //,nsymb,sss_symb,pss_symb=0;
unsigned char i,aarx,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 char symbol_mod,pilots=0,j=0,poffset=0; unsigned char pilots=0,j=0;
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;
pilots = (symbol==2) ? 1 : 0; //to updated from config pilots = (symbol==2) ? 1 : 0; //to updated from config
l=symbol; l=symbol;
nsymb = (frame_parms->Ncp==NORMAL) ? 14:12; //nsymb = (frame_parms->Ncp==NORMAL) ? 14:12;
k = frame_parms->first_carrier_offset + 516; //0
if (frame_parms->frame_type == TDD) { // TDD /* if (frame_parms->frame_type == TDD) { // TDD
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;
} }*/
if (symbol_mod==(4-frame_parms->Ncp))
poffset=3;
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
if (high_speed_flag == 1) if (high_speed_flag == 1)
dl_ch0 = &dl_ch_estimates[aarx][(symbol*(frame_parms->ofdm_symbol_size))]; dl_ch0 = &dl_ch_estimates[aarx][(2*(frame_parms->ofdm_symbol_size))];
else else
dl_ch0 = &dl_ch_estimates[aarx][0]; dl_ch0 = &dl_ch_estimates[aarx][0];
dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*(nb_pdsch_rb*12)]; dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*(nb_rb_pdsch*12)];
rxF_ext = &rxdataF_ext[aarx][symbol*(nb_pdsch_rb*12)]; rxF_ext = &rxdataF_ext[aarx][symbol*(nb_rb_pdsch*12)];
rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + (symbol*(frame_parms->ofdm_symbol_size)))]; rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))];
if ((frame_parms->N_RB_DL&1) == 0) // even number of RBs printf("extract single addr %p pilots %d symbol %d, l %d RB_DL %d nushift %d k %d\n", rxF, pilots, symbol, l, frame_parms->N_RB_DL,frame_parms->nushift,k);
for (rb=start_rb;rb<nb_pdsch_rb;rb++) { //if ((frame_parms->N_RB_DL&1) == 0){ // even number of RBs
for (rb=start_rb;rb<nb_rb_pdsch;rb++) {
// For second half of RBs skip DC carrier // For second half of RBs skip DC carrier
if (k>=frame_parms->ofdm_symbol_size) { if (k>=frame_parms->ofdm_symbol_size) {
...@@ -2042,8 +2062,11 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, ...@@ -2042,8 +2062,11 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
for (i=0; i<12; i++) { for (i=0; i<12; i++) {
rxF_ext[i]=rxF[i]; rxF_ext[i]=rxF[i];
dl_ch0_ext[i]=dl_ch0[i]; dl_ch0_ext[i]=dl_ch0[i];
/*printf("%d : (%d,%d)\n",(rxF+i-&rxdataF[aarx][( (symbol*(frame_parms->ofdm_symbol_size)))]), printf("rb %ld %p: (%d,%d)\n",(rxF+i-&rxdataF[aarx][( (symbol*(frame_parms->ofdm_symbol_size)))]),rxF,
((short*)&rxF[i])[0],((short*)&rxF[i])[1]);*/ ((short*)&rxF[i])[0],((short*)&rxF[i])[1]);
printf("rb %ld %p: dl_ch (%d,%d)\n",(rxF+i-&rxdataF[aarx][( (symbol*(frame_parms->ofdm_symbol_size)))]),rxF,
((short*)&dl_ch0[i])[0],((short*)&dl_ch0[i])[1]);
printf("re count %d\n",rb*12+i);
} }
dl_ch0_ext+=12; dl_ch0_ext+=12;
...@@ -2054,390 +2077,26 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, ...@@ -2054,390 +2077,26 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
for (i=0; i<12; i++) { for (i=0; i<12; i++) {
if ((i&1)!=frame_parms->nushift){ if ((i&1)!=frame_parms->nushift){
rxF_ext[j]=rxF[i]; rxF_ext[j]=rxF[i];
// printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); printf("extract rb %d, re %d => rxF (%d,%d) rxF ext (%d,%d) addr %p\n",rb,i,*(short *)&rxF[i],*(1+(short*)&rxF[i]),*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]),rxF_ext);
dl_ch0_ext[j++]=dl_ch0[i];
}
}
dl_ch0_ext+=6;
rxF_ext+=6;
}
dl_ch0+=12;
rxF+=12;
k+=12;
}
else { // Odd number of RBs
for (rb=0; rb<frame_parms->N_RB_DL>>1; rb++) {
#ifdef DEBUG_DLSCH_DEMOD
printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]);
#endif
skip_half=0;
if (rb_alloc_ind==1) {
#ifdef DEBUG_DLSCH_DEMOD
printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half);
#endif
if (pilots==0) {
// printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half);
if (skip_half==1) {
memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int));
for (i=0; i<6; i++) {
rxF_ext[i]=rxF[i];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
}
dl_ch0_ext+=6;
rxF_ext+=6;
} else if (skip_half==2) {
memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int));
for (i=0; i<6; i++) {
rxF_ext[i]=rxF[(i+6)];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
}
dl_ch0_ext+=6;
rxF_ext+=6;
} else {
memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int));
for (i=0; i<12; i++) {
rxF_ext[i]=rxF[i];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
}
dl_ch0_ext+=12;
rxF_ext+=12;
}
} else {
// printf("Extracting with pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half);
j=0;
if (skip_half==1) {
for (i=0; i<6; i++) {
if (i!=((frame_parms->nushift+poffset)%6)) {
rxF_ext[j]=rxF[i];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j++]=dl_ch0[i];
}
}
rxF_ext+=5;
dl_ch0_ext+=5;
} else if (skip_half==2) {
for (i=0; i<6; i++) {
if (i!=((frame_parms->nushift+poffset)%6)) {
rxF_ext[j]=rxF[(i+6)];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j++]=dl_ch0[i+6];
}
}
dl_ch0_ext+=5;
rxF_ext+=5;
} else {
for (i=0; i<12; i++) {
if ((i!=(frame_parms->nushift+poffset)) &&
(i!=((frame_parms->nushift+poffset+6)%12))) {
rxF_ext[j]=rxF[i];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j++]=dl_ch0[i];
}
}
dl_ch0_ext+=10;
rxF_ext+=10;
}
}
}
dl_ch0+=12;
rxF+=12;
} // first half loop
// Do middle RB (around DC)
if (rb < 32)
rb_alloc_ind = (rb_alloc[0]>>rb) & 1;
else if (rb < 64)
rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1;
else if (rb < 96)
rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1;
else if (rb < 100)
rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1;
else
rb_alloc_ind = 0;
if (rb_alloc_ind == 1)
nb_rb++;
// PBCH
if ((nr_tti_rx==0) &&
(l>=(nsymb>>1)) &&
(l<((nsymb>>1) + 4))) {
rb_alloc_ind = 0;
}
//SSS
if (((nr_tti_rx==0)||(nr_tti_rx==5)) && (l==sss_symb) ) {
rb_alloc_ind = 0;
}
if (frame_parms->frame_type == FDD) {
//PSS
if (((nr_tti_rx==0)||(nr_tti_rx==5)) && (l==pss_symb) ) {
rb_alloc_ind = 0;
}
}
//PSS
if ((frame_parms->frame_type == TDD) &&
(nr_tti_rx==6) &&
(l==pss_symb) ) {
rb_alloc_ind = 0;
}
// printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]);
// printf("DC rb %d (%p)\n",rb,rxF);
if (rb_alloc_ind==1) {
#ifdef DEBUG_DLSCH_DEMOD
printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half);
#endif
if (pilots==0) {
for (i=0; i<6; i++) {
dl_ch0_ext[i]=dl_ch0[i];
rxF_ext[i]=rxF[i];
}
rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))];
for (; i<12; i++) {
dl_ch0_ext[i]=dl_ch0[i];
rxF_ext[i]=rxF[(1+i-6)];
}
dl_ch0_ext+=12;
rxF_ext+=12;
} else { // pilots==1
j=0;
for (i=0; i<6; i++) {
if (i!=((frame_parms->nushift+poffset)%6)) {
dl_ch0_ext[j]=dl_ch0[i];
rxF_ext[j++]=rxF[i];
#ifdef DEBUG_DLSCH_DEMOD
printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1]));
#endif
}
}
rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))];
for (; i<12; i++) {
if (i!=((frame_parms->nushift+6+poffset)%12)) {
dl_ch0_ext[j]=dl_ch0[i]; dl_ch0_ext[j]=dl_ch0[i];
rxF_ext[j++]=rxF[(1+i-6)]; printf("rb %ld %p: dl_ch (%d,%d)\n",(rxF+i-&rxdataF[aarx][( (symbol*(frame_parms->ofdm_symbol_size)))]),rxF,
#ifdef DEBUG_DLSCH_DEMOD ((short*)&dl_ch0[i])[0],((short*)&dl_ch0[i])[1]);
printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); j++;
#endif
}
}
dl_ch0_ext+=10;
rxF_ext+=10;
} // symbol_mod==0
} // rballoc==1
else {
rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))];
} }
dl_ch0+=12;
rxF+=7;
rb++;
for (;rb<frame_parms->N_RB_DL;rb++) {
// printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]);
// printf("rb %d (%p)\n",rb,rxF);
skip_half=0;
if (rb < 32)
rb_alloc_ind = (rb_alloc[0]>>rb) & 1;
else if (rb < 64)
rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1;
else if (rb < 96)
rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1;
else if (rb < 100)
rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1;
else
rb_alloc_ind = 0;
if (rb_alloc_ind == 1)
nb_rb++;
// PBCH
if ((nr_tti_rx==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=nsymb>>1) && (l<((nsymb>>1) + 4))) {
rb_alloc_ind = 0;
}
//PBCH subframe 0, symbols nsymb>>1 ... nsymb>>1 + 3
if ((nr_tti_rx==0) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4)))
skip_half=1;
else if ((nr_tti_rx==0) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4)))
skip_half=2;
//SSS
if (((nr_tti_rx==0)||(nr_tti_rx==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) {
rb_alloc_ind = 0;
}
//SSS
if (((nr_tti_rx==0)||(nr_tti_rx==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==sss_symb))
skip_half=1;
else if (((nr_tti_rx==0)||(nr_tti_rx==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb))
skip_half=2;
if (frame_parms->frame_type == FDD) {
//PSS
if (((nr_tti_rx==0)||(nr_tti_rx==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) {
rb_alloc_ind = 0;
}
//PSS
if (((nr_tti_rx==0)||(nr_tti_rx==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb))
skip_half=1;
else if (((nr_tti_rx==0)||(nr_tti_rx==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb))
skip_half=2;
}
if ((frame_parms->frame_type == TDD) &&
(nr_tti_rx==6)) { //TDD Subframe 6
if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) {
rb_alloc_ind = 0;
}
if ((rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb))
skip_half=1;
else if ((rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb))
skip_half=2;
}
if (rb_alloc_ind==1) {
#ifdef DEBUG_DLSCH_DEMOD
printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half);
#endif
/*
printf("rb %d\n",rb);
for (i=0;i<12;i++)
printf("(%d %d)",((short *)dl_ch0)[i<<1],((short*)dl_ch0)[1+(i<<1)]);
printf("\n");
*/
if (pilots==0) {
// printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half);
if (skip_half==1) {
memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int));
for (i=0; i<6; i++) {
rxF_ext[i]=rxF[i];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
} }
dl_ch0_ext+=6;
rxF_ext+=6;
} else if (skip_half==2) {
memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int));
for (i=0; i<6; i++) {
rxF_ext[i]=rxF[(i+6)];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
}
dl_ch0_ext+=6; dl_ch0_ext+=6;
rxF_ext+=6; rxF_ext+=6;
} else {
memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int));
for (i=0; i<12; i++) {
rxF_ext[i]=rxF[i];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
}
dl_ch0_ext+=12;
rxF_ext+=12;
}
} else {
// printf("Extracting with pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half);
j=0;
if (skip_half==1) {
for (i=0; i<6; i++) {
if (i!=((frame_parms->nushift+poffset)%6)) {
rxF_ext[j]=rxF[i];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j++]=dl_ch0[i];
}
}
dl_ch0_ext+=5;
rxF_ext+=5;
} else if (skip_half==2) {
for (i=0; i<6; i++) {
if (i!=((frame_parms->nushift+poffset)%6)) {
rxF_ext[j]=rxF[(i+6)];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j++]=dl_ch0[i+6];
}
}
dl_ch0_ext+=5;
rxF_ext+=5;
} else {
for (i=0; i<12; i++) {
if ((i!=(frame_parms->nushift+poffset)) &&
(i!=((frame_parms->nushift+poffset+6)%12))) {
rxF_ext[j]=rxF[i];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j++]=dl_ch0[i];
}
}
dl_ch0_ext+=10;
rxF_ext+=10;
}
} // pilots=0
} }
dl_ch0+=12; dl_ch0+=12;
rxF+=12; rxF+=12;
} k+=12;
} }
} }
return(nb_rb/frame_parms->nb_antennas_rx); return(nb_rb_pdsch/frame_parms->nb_antennas_rx);
} }
//============================================================================================== //==============================================================================================
......
...@@ -660,7 +660,7 @@ int nr_dlsch_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms, ...@@ -660,7 +660,7 @@ int nr_dlsch_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
*/ */
for (i=0; i<len; i++) { for (i=0; i<len; i++) {
*llr32 = *rxF; *llr32 = *rxF;
//printf("llr %d : (%d,%d)\n",i,((int16_t*)llr32)[0],((int16_t*)llr32)[1]); printf("dlsch_qpsk_llr %d : (%d,%d)\n",i,((int16_t*)llr32)[0],((int16_t*)llr32)[1]);
rxF++; rxF++;
llr32++; llr32++;
} }
......
...@@ -182,17 +182,20 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -182,17 +182,20 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
/* process pss search on received buffer */ /* process pss search on received buffer */
sync_pos = pss_synchro_nr(ue, NO_RATE_CHANGE); sync_pos = pss_synchro_nr(ue, NO_RATE_CHANGE);
sync_pos_slot = (fp->samples_per_subframe/fp->slots_per_subframe) - 10*(fp->ofdm_symbol_size + fp->nb_prefix_samples);
if (sync_pos >= fp->nb_prefix_samples) if (sync_pos >= fp->nb_prefix_samples){
ue->ssb_offset = sync_pos - fp->nb_prefix_samples; ue->ssb_offset = sync_pos - fp->nb_prefix_samples;}
else else{
ue->ssb_offset = sync_pos + (fp->samples_per_subframe * 10) - fp->nb_prefix_samples; ue->ssb_offset = sync_pos + (fp->samples_per_subframe * 10) - fp->nb_prefix_samples;}
ue->rx_offset = ue->ssb_offset - sync_pos_slot;
//write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*fp->samples_per_subframe,1,1); //write_output("rxdata1.m","rxd1",ue->common_vars.rxdata[0],10*fp->samples_per_subframe,1,1);
#ifdef DEBUG_INITIAL_SYNCH #ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos,ue->common_vars.eNb_id); LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n", ue->Mod_id, sync_pos,ue->common_vars.eNb_id);
LOG_I(PHY,"sync_pos %d ssb_offset %d\n",sync_pos,ue->ssb_offset); LOG_I(PHY,"sync_pos %d ssb_offset %d sync_pos_slot %d \n",sync_pos,ue->ssb_offset,sync_pos_slot);
#endif #endif
/* check that SSS/PBCH block is continuous inside the received buffer */ /* check that SSS/PBCH block is continuous inside the received buffer */
......
...@@ -340,7 +340,7 @@ void qam64_qpsk(short *stream0_in, ...@@ -340,7 +340,7 @@ void qam64_qpsk(short *stream0_in,
@param nb_rb number of RBs for this allocation @param nb_rb number of RBs for this allocation
@param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS
@param llr16p pointer to pointer to symbol in dlsch_llr*/ @param llr16p pointer to pointer to symbol in dlsch_llr*/
int dlsch_64qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms, int nr_dlsch_64qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp, int **rxdataF_comp,
int **rxdataF_comp_i, int **rxdataF_comp_i,
int **dl_ch_mag, int **dl_ch_mag,
...@@ -397,7 +397,7 @@ void qam64_qam16_avx2(short *stream0_in, ...@@ -397,7 +397,7 @@ void qam64_qam16_avx2(short *stream0_in,
@param nb_rb number of RBs for this allocation @param nb_rb number of RBs for this allocation
@param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS
@param llr16p pointer to pointer to symbol in dlsch_llr*/ @param llr16p pointer to pointer to symbol in dlsch_llr*/
int dlsch_64qam_16qam_llr(NR_DL_FRAME_PARMS *frame_parms, int nr_dlsch_64qam_16qam_llr(NR_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp, int **rxdataF_comp,
int **rxdataF_comp_i, int **rxdataF_comp_i,
int **dl_ch_mag, int **dl_ch_mag,
...@@ -455,7 +455,7 @@ void qam64_qam64_avx2(int32_t *stream0_in, ...@@ -455,7 +455,7 @@ void qam64_qam64_avx2(int32_t *stream0_in,
@param nb_rb number of RBs for this allocation @param nb_rb number of RBs for this allocation
@param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS
@param llr16p pointer to pointer to symbol in dlsch_llr*/ @param llr16p pointer to pointer to symbol in dlsch_llr*/
int dlsch_64qam_64qam_llr(NR_DL_FRAME_PARMS *frame_parms, int nr_dlsch_64qam_64qam_llr(NR_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp, int **rxdataF_comp,
int **rxdataF_comp_i, int **rxdataF_comp_i,
int **dl_ch_mag, int **dl_ch_mag,
...@@ -829,7 +829,7 @@ void nr_dlsch_deinterleaving(uint8_t symbol, ...@@ -829,7 +829,7 @@ void nr_dlsch_deinterleaving(uint8_t symbol,
uint16_t L, uint16_t L,
uint16_t *llr, uint16_t *llr,
uint16_t *llr_deint, uint16_t *llr_deint,
uint32_t nb_rb_pdsch); uint16_t nb_rb_pdsch);
void dlsch_dual_stream_correlation(NR_DL_FRAME_PARMS *frame_parms, void dlsch_dual_stream_correlation(NR_DL_FRAME_PARMS *frame_parms,
unsigned char symbol, unsigned char symbol,
......
...@@ -4264,8 +4264,8 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -4264,8 +4264,8 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
if(dlsch1) if(dlsch1)
is_cw1_active = dlsch1->harq_processes[harq_pid]->status; is_cw1_active = dlsch1->harq_processes[harq_pid]->status;
LOG_D(PHY,"AbsSubframe %d.%d Start Turbo Decoder for CW0 [harq_pid %d] ? %d \n", frame_rx%1024, nr_tti_rx, harq_pid, is_cw0_active); LOG_D(PHY,"AbsSubframe %d.%d Start LDPC Decoder for CW0 [harq_pid %d] ? %d \n", frame_rx%1024, nr_tti_rx, harq_pid, is_cw0_active);
LOG_D(PHY,"AbsSubframe %d.%d Start Turbo Decoder for CW1 [harq_pid %d] ? %d \n", frame_rx%1024, nr_tti_rx, harq_pid, is_cw1_active); LOG_D(PHY,"AbsSubframe %d.%d Start LDPC Decoder for CW1 [harq_pid %d] ? %d \n", frame_rx%1024, nr_tti_rx, harq_pid, is_cw1_active);
if(is_cw0_active && is_cw1_active) if(is_cw0_active && is_cw1_active)
{ {
...@@ -5557,7 +5557,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN ...@@ -5557,7 +5557,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN
#endif #endif
//nr_gold_pdcch(ue,0, 2); //nr_gold_pdcch(ue,0, 2);
if (nr_tti_rx==2)
for (int l=0; l<2; l++) { for (int l=0; l<2; l++) {
if (abstraction_flag == 0) { if (abstraction_flag == 0) {
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
...@@ -5653,27 +5653,20 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN ...@@ -5653,27 +5653,20 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN
#endif #endif
//#if 0 //#if 0
LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, nr_tti_rx); LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, nr_tti_rx);
//set active for testing, to be removed
if (nr_tti_rx==2){ if (nr_tti_rx==2){
//to update from pdsch config //to update from pdsch config
nr_gold_pdsch(ue,2,0, 1); nr_gold_pdsch(ue,2,0, 1);
for (int m=2;m<6 ; m++)
int nb_prefix_samples0 = ue->frame_parms.nb_prefix_samples0;
ue->frame_parms.nb_prefix_samples0 = ue->frame_parms.nb_prefix_samples;
nr_slot_fep(ue, nr_slot_fep(ue,
2, //to be updated from higher layer m, //to be updated from higher layer
nr_tti_rx, nr_tti_rx,
0, 0,
0, 0,
1, 1,
NR_PDSCH_EST); NR_PDSCH_EST);
//set active for testing, to be removed
//put back nb_prefix_samples0
ue->frame_parms.nb_prefix_samples0 = nb_prefix_samples0;
ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active = 1; ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0]->active = 1;
} }
...@@ -5689,8 +5682,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN ...@@ -5689,8 +5682,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN
PDSCH, PDSCH,
ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0], ue->dlsch[ue->current_thread_id[nr_tti_rx]][eNB_id][0],
NULL, NULL,
ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->num_pdcch_symbols, 2, //ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->num_pdcch_symbols,
ue->frame_parms.symbols_per_tti>>1, 5, //ue->frame_parms.symbols_per_tti>>1,
abstraction_flag); abstraction_flag);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT);
...@@ -5741,7 +5734,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN ...@@ -5741,7 +5734,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN
abstraction_flag); abstraction_flag);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_OUT);
} }
//#if 0
LOG_D(PHY," ------ slot 1 Processing: AbsSubframe %d.%d ------ \n", frame_rx%1024, nr_tti_rx); LOG_D(PHY," ------ slot 1 Processing: AbsSubframe %d.%d ------ \n", frame_rx%1024, nr_tti_rx);
LOG_D(PHY," ------ --> FFT/ChannelEst/PDCCH slot 1: AbsSubframe %d.%d ------ \n", frame_rx%1024, nr_tti_rx); LOG_D(PHY," ------ --> FFT/ChannelEst/PDCCH slot 1: AbsSubframe %d.%d ------ \n", frame_rx%1024, nr_tti_rx);
...@@ -5792,7 +5785,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN ...@@ -5792,7 +5785,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN
#endif #endif
LOG_D(PHY," ------ end FFT/ChannelEst/PDCCH slot 1: AbsSubframe %d.%d ------ \n", frame_rx%1024, nr_tti_rx); //LOG_D(PHY," ------ end FFT/ChannelEst/PDCCH slot 1: AbsSubframe %d.%d ------ \n", frame_rx%1024, nr_tti_rx);
/*if ( (nr_tti_rx == 0) && (ue->decode_MIB == 1)) /*if ( (nr_tti_rx == 0) && (ue->decode_MIB == 1))
{ {
...@@ -5807,7 +5800,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN ...@@ -5807,7 +5800,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
start_meas(&ue->pdsch_procedures_stat[ue->current_thread_id[nr_tti_rx]]); start_meas(&ue->pdsch_procedures_stat[ue->current_thread_id[nr_tti_rx]]);
#endif #endif
nr_ue_pdsch_procedures(ue, /*nr_ue_pdsch_procedures(ue,
proc, proc,
eNB_id, eNB_id,
PDSCH, PDSCH,
...@@ -5817,11 +5810,14 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN ...@@ -5817,11 +5810,14 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eN
ue->frame_parms.symbols_per_tti-1, ue->frame_parms.symbols_per_tti-1,
abstraction_flag); abstraction_flag);
LOG_D(PHY," ------ end PDSCH ChannelComp/LLR slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, nr_tti_rx); LOG_D(PHY," ------ end PDSCH ChannelComp/LLR slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, nr_tti_rx);
LOG_D(PHY," ------ --> PDSCH Turbo Decoder slot 0/1: AbsSubframe %d.%d ------ \n", frame_rx%1024, nr_tti_rx); LOG_D(PHY," ------ --> PDSCH Turbo Decoder slot 0/1: AbsSubframe %d.%d ------ \n", frame_rx%1024, nr_tti_rx);*/
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(&ue->pdsch_procedures_stat[ue->current_thread_id[nr_tti_rx]]); stop_meas(&ue->pdsch_procedures_stat[ue->current_thread_id[nr_tti_rx]]);
start_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]]); start_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]]);
#endif #endif
//#endif //slot 1
nr_ue_dlsch_procedures(ue, nr_ue_dlsch_procedures(ue,
proc, proc,
eNB_id, eNB_id,
......
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