Commit 55c64483 authored by Sagar Parsawar's avatar Sagar Parsawar

Added PRS TD impulse response for Comb size 2 and 4

parent 8b4d21d9
...@@ -337,11 +337,13 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -337,11 +337,13 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
// PRS channel estimates // PRS channel estimates
ue->prs_ch_estimates = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); ue->prs_ch_estimates = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
AssertFatal(ue->prs_ch_estimates!=NULL, "NR UE init: PRS channel estimates malloc failed\n"); ue->prs_ch_estimates_time = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
AssertFatal(((ue->prs_ch_estimates!=NULL) || (ue->prs_ch_estimates_time!=NULL)), "NR UE init: PRS channel estimates malloc failed\n");
for (i=0; i<fp->nb_antennas_rx; i++) { for (i=0; i<fp->nb_antennas_rx; i++) {
ue->prs_ch_estimates[i] = (int32_t *)malloc16(2*fp->ofdm_symbol_size*NR_MAX_NUM_PRS_SYMB); ue->prs_ch_estimates[i] = (int32_t *)malloc16(2*fp->ofdm_symbol_size*NR_MAX_NUM_PRS_SYMB);
AssertFatal(ue->prs_ch_estimates[i]!=NULL, "NR UE init: PRS channel estimates malloc failed %d\n", i); ue->prs_ch_estimates_time[i] = (int32_t *)malloc16(2*fp->ofdm_symbol_size*NR_MAX_NUM_PRS_SYMB);
AssertFatal(((ue->prs_ch_estimates[i]!=NULL) || (ue->prs_ch_estimates_time[i]!=NULL)), "NR UE init: PRS channel estimates malloc failed %d\n", i);
} }
......
...@@ -41,6 +41,9 @@ short filt16a_mm1[16] = { ...@@ -41,6 +41,9 @@ short filt16a_mm1[16] = {
short filt16a_ml1[16] = { short filt16a_ml1[16] = {
-4096,0,4096,8192,12288,16384,12288,8192,4096,0,0,0,0,0,0,0}; -4096,0,4096,8192,12288,16384,12288,8192,4096,0,0,0,0,0,0,0};
short filt16a_mr1[16] = {
0,0,4096,8192,12288,16384,12288,8192,4096,0,-4096,-8192,0,0,0,0};
short filt16a_r1[16] = { short filt16a_r1[16] = {
0,0,0,0,0,0,4096,8192,12288,16384,20480,24576,0,0,0,0}; 0,0,0,0,0,0,4096,8192,12288,16384,20480,24576,0,0,0,0};
...@@ -56,6 +59,9 @@ short filt16a_mm2[16] = { ...@@ -56,6 +59,9 @@ short filt16a_mm2[16] = {
short filt16a_ml2[16] = { short filt16a_ml2[16] = {
-8192,-4096,0,4096,8192,12288,16384,12288,8192,4096,0,0,0,0,0,0}; -8192,-4096,0,4096,8192,12288,16384,12288,8192,4096,0,0,0,0,0,0};
short filt16a_mr2[16] = {
0,0,0,4096,8192,12288,16384,12288,8192,4096,0,-4096,0,0,0,0};
short filt16a_r2[16] = { short filt16a_r2[16] = {
0,0,0,0,0,0,0,4096,8192,12288,16384,20480,0,0,0,0}; 0,0,0,0,0,0,0,4096,8192,12288,16384,20480,0,0,0,0};
...@@ -169,7 +175,7 @@ short filt8_dcr0_h[8]= { ...@@ -169,7 +175,7 @@ short filt8_dcr0_h[8]= {
0,4096,8192,12288,16384,0,0,0}; 0,4096,8192,12288,16384,0,0,0};
short filt8_l1[8] = { short filt8_l1[8] = {
24576,16384,0,0,0,0,0,0}; 24576,16384,8192,0,0,0,0,0};
short filt8_ml1[8] = { short filt8_ml1[8] = {
-8192,0,8192,16384,8192,0,0,0}; -8192,0,8192,16384,8192,0,0,0};
......
...@@ -38,6 +38,8 @@ extern short filt16a_m1[16]; ...@@ -38,6 +38,8 @@ extern short filt16a_m1[16];
extern short filt16a_mm1[16]; extern short filt16a_mm1[16];
extern short filt16a_mr1[16];
extern short filt16a_ml1[16]; extern short filt16a_ml1[16];
extern short filt16a_l2[16]; extern short filt16a_l2[16];
...@@ -48,6 +50,8 @@ extern short filt16a_m2[16]; ...@@ -48,6 +50,8 @@ extern short filt16a_m2[16];
extern short filt16a_mm2[16]; extern short filt16a_mm2[16];
extern short filt16a_mr2[16];
extern short filt16a_ml2[16]; extern short filt16a_ml2[16];
extern short filt16a_l3[16]; extern short filt16a_l3[16];
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
//#define DEBUG_PDSCH //#define DEBUG_PDSCH
//#define DEBUG_PDCCH //#define DEBUG_PDCCH
//#define DEBUG_CH //#define DEBUG_CH
#define DEBUG_PRS_CHEST //#define DEBUG_PRS_CHEST
extern short nr_qpsk_mod_table[8]; extern short nr_qpsk_mod_table[8];
int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue, int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue,
...@@ -53,11 +53,13 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -53,11 +53,13 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue,
prs_data_t *prs_cfg = &ue->prs_cfg; prs_data_t *prs_cfg = &ue->prs_cfg;
int16_t *prs_chest, ch[2] = {0}, *rxF, *pil, *fl,*fm, *fmm, *fml, *fmr, *fr, mod_prs[NR_MAX_PRS_LENGTH<<1]; int16_t *prs_chest, ch[2] = {0}, *rxF, *pil, *fl,*fm, *fmm, *fml, *fmr, *fr, mod_prs[NR_MAX_PRS_LENGTH<<1];
int16_t k_prime = 0, k = 0; int16_t k_prime = 0, k = 0, re_offset;
uint8_t idx = prs_cfg->NPRSID; uint8_t idx = prs_cfg->NPRSID;
uint8_t rxAnt = 0; // ant 0 rxdataF for now uint8_t rxAnt = 0; // ant 0 rxdataF for now
int16_t *ch_intrp = (int16_t *)malloc16(frame_params->ofdm_symbol_size*2*sizeof(int16_t));
AssertFatal(ch_intrp != NULL, "nr_prs_channel_estimation: channel estimate buffer initialization failed!!");
int16_t *ch_init = ch_intrp;
printf("Inside nr_prs_channel_estimation proc->thread_id %d, proc->nr_slot_rx %d\n", proc->thread_id, proc->nr_slot_rx);
for(int l = prs_cfg->SymbolStart; l < prs_cfg->SymbolStart+prs_cfg->NumPRSSymbols; l++) for(int l = prs_cfg->SymbolStart; l < prs_cfg->SymbolStart+prs_cfg->NumPRSSymbols; l++)
{ {
int symInd = l-prs_cfg->SymbolStart; int symInd = l-prs_cfg->SymbolStart;
...@@ -74,10 +76,10 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -74,10 +76,10 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue,
k_prime = k_prime_table[3][symInd]; k_prime = k_prime_table[3][symInd];
} }
printf("PRS config l %d k_prime %d:\nprs_cfg->SymbolStart %d\nprs_cfg->NumPRSSymbols %d\nprs_cfg->NumRB %d\nprs_cfg->CombSize %d\n", l, k_prime, prs_cfg->SymbolStart, prs_cfg->NumPRSSymbols, prs_cfg->NumRB, prs_cfg->CombSize);
//re_offset //re_offset
k = (prs_cfg->REOffset+k_prime) % prs_cfg->CombSize + frame_params->first_carrier_offset; k = re_offset = (prs_cfg->REOffset+k_prime) % prs_cfg->CombSize + frame_params->first_carrier_offset;
printf("PRS config l %d k_prime %d, re_offset %d :\nprs_cfg->SymbolStart %d\nprs_cfg->NumPRSSymbols %d\nprs_cfg->NumRB %d\nprs_cfg->CombSize %d\n", l, k_prime, re_offset, prs_cfg->SymbolStart, prs_cfg->NumPRSSymbols, prs_cfg->NumRB, prs_cfg->CombSize);
// Pilots generation and modulation // Pilots generation and modulation
for (int m = 0; m < (12/prs_cfg->CombSize)*prs_cfg->NumRB; m++) for (int m = 0; m < (12/prs_cfg->CombSize)*prs_cfg->NumRB; m++)
...@@ -92,6 +94,7 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -92,6 +94,7 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue,
rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k]; rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k];
prs_chest = (int16_t *)&ue->prs_ch_estimates[rxAnt][l*frame_params->ofdm_symbol_size]; prs_chest = (int16_t *)&ue->prs_ch_estimates[rxAnt][l*frame_params->ofdm_symbol_size];
memset(prs_chest,0,4*(ue->frame_parms.ofdm_symbol_size)); memset(prs_chest,0,4*(ue->frame_parms.ofdm_symbol_size));
memset(ch_intrp,0,4*(ue->frame_parms.ofdm_symbol_size));
if(prs_cfg->CombSize == 2) if(prs_cfg->CombSize == 2)
{ {
...@@ -114,6 +117,7 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -114,6 +117,7 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue,
fm = filt8_m1; fm = filt8_m1;
fr = filt8_r1; fr = filt8_r1;
break; break;
default: default:
printf("nr=prs channel_estimation: k_prime=%d -> ERROR\n",k_prime); printf("nr=prs channel_estimation: k_prime=%d -> ERROR\n",k_prime);
return(-1); return(-1);
...@@ -123,126 +127,69 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -123,126 +127,69 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue,
//Start pilot //Start pilot
ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15); ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15);
ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15); ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15);
#ifdef DEBUG_PRS_CHEST
printf("pilIdx %d at k %d of l %d reIdx %d rxF %p %d %d ch[0] %d ch[1] %d\n", 0, k, l, (l*frame_params->ofdm_symbol_size + k), rxF, rxF[0], rxF[1], ch[0], ch[1]);
#endif
multadd_real_vector_complex_scalar(fl, multadd_real_vector_complex_scalar(fl,
ch, ch,
prs_chest, ch_intrp,
8); 8);
pil +=2; pil +=2;
k = (k+prs_cfg->CombSize) % frame_params->ofdm_symbol_size; k = (k+prs_cfg->CombSize) % frame_params->ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k]; rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k];
//Middle pilots
for(int pIdx = 1; pIdx < prs_cfg->NumRB*(12/prs_cfg->CombSize)-1; pIdx+=2)
{
ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15); ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15);
ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15); ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15);
#ifdef DEBUG_PRS_CHEST if(pIdx == 1) // 2nd pilot
printf("pilIdx %d at k %d of l %d reIdx %d rxF %p %d %d ch[0] %d ch[1] %d\n", 1, k, l, (l*frame_params->ofdm_symbol_size + k), rxF, rxF[0], rxF[1], ch[0], ch[1]); {
#endif
multadd_real_vector_complex_scalar(fml, multadd_real_vector_complex_scalar(fml,
ch, ch,
prs_chest, ch_intrp,
8);
pil +=2;
k = (k+prs_cfg->CombSize) % frame_params->ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k];
ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15);
ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15);
#ifdef DEBUG_PRS_CHEST
printf("pilIdx %d at k %d of l %d reIdx %d rxF %p %d %d ch[0] %d ch[1] %d\n", 2, k, l, (l*frame_params->ofdm_symbol_size + k), rxF, rxF[0], rxF[1], ch[0], ch[1]);
#endif
multadd_real_vector_complex_scalar(fmm,
ch,
prs_chest,
8); 8);
}
pil +=2; else
k = (k+prs_cfg->CombSize) % frame_params->ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k];
prs_chest +=8;
//Middle pilots
for(int pIdx = 3; pIdx < prs_cfg->NumRB*(12/prs_cfg->CombSize)-3; pIdx+=2)
{ {
ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15);
ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15);
#ifdef DEBUG_PRS_CHEST
printf("pilIdx %d at k %d of l %d reIdx %d rxF %p %d %d ch[0] %d ch[1] %d\n", pIdx, k, l, (l*frame_params->ofdm_symbol_size + k), rxF, rxF[0], rxF[1], ch[0], ch[1]);
#endif
multadd_real_vector_complex_scalar(fm, multadd_real_vector_complex_scalar(fm,
ch, ch,
prs_chest, ch_intrp,
8); 8);
}
pil +=2; pil +=2;
k = (k+prs_cfg->CombSize) % frame_params->ofdm_symbol_size; k = (k+prs_cfg->CombSize) % frame_params->ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k]; rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k];
ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15); ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15);
ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15); ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15);
#ifdef DEBUG_PRS_CHEST if(pIdx == (prs_cfg->NumRB*(12/prs_cfg->CombSize)-3)) // 2nd last pilot
printf("pilIdx %d at k %d of l %d reIdx %d rxF %p %d %d ch[0] %d ch[1] %d\n", pIdx+1, k, l, (l*frame_params->ofdm_symbol_size + k), rxF, rxF[0], rxF[1], ch[0], ch[1]); {
#endif multadd_real_vector_complex_scalar(fmr,
multadd_real_vector_complex_scalar(fmm,
ch, ch,
prs_chest, ch_intrp,
8); 8);
pil +=2;
k = (k+prs_cfg->CombSize) % frame_params->ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k];
prs_chest +=8;
} }
else
//End pilot {
ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15); multadd_real_vector_complex_scalar(fmm,
ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15);
#ifdef DEBUG_PRS_CHEST
printf("pilIdx %d at k %d of l %d reIdx %d rxF %p %d %d ch[0] %d ch[1] %d\n", 1, k, l, (l*frame_params->ofdm_symbol_size + k), rxF, rxF[0], rxF[1], ch[0], ch[1]);
#endif
multadd_real_vector_complex_scalar(fm,
ch,
prs_chest,
8);
pil +=2;
k = (k+prs_cfg->CombSize) % frame_params->ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k];
ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15);
ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15);
#ifdef DEBUG_PRS_CHEST
printf("pilIdx %d at k %d of l %d reIdx %d rxF %p %d %d ch[0] %d ch[1] %d\n", prs_cfg->NumRB*(12/prs_cfg->CombSize)-2, k, l, (l*frame_params->ofdm_symbol_size + k), rxF, rxF[0], rxF[1], ch[0], ch[1]);
#endif
multadd_real_vector_complex_scalar(fmr,
ch, ch,
prs_chest, ch_intrp,
8); 8);
}
pil +=2; pil +=2;
k = (k+prs_cfg->CombSize) % frame_params->ofdm_symbol_size; k = (k+prs_cfg->CombSize) % frame_params->ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k]; rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k];
prs_chest +=8; ch_intrp +=8;
}
//End pilot
ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15); ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15);
ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15); ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15);
#ifdef DEBUG_PRS_CHEST
printf("pilIdx %d at k %d of l %d reIdx %d rxF %p %d %d ch[0] %d ch[1] %d\n", prs_cfg->NumRB*(12/prs_cfg->CombSize)-1, k, l, (l*frame_params->ofdm_symbol_size + k), rxF, rxF[0], rxF[1], ch[0], ch[1]);
#endif
multadd_real_vector_complex_scalar(fr, multadd_real_vector_complex_scalar(fr,
ch, ch,
prs_chest, ch_intrp,
8); 8);
} }
...@@ -252,32 +199,36 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -252,32 +199,36 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue,
switch (k_prime) { switch (k_prime) {
case 0: case 0:
fl = filt16a_l0; fl = filt16a_l0;
fmm = filt16a_mm0;
fml = filt16a_mm0; fml = filt16a_mm0;
fmm = filt16a_mm0;
fmr = filt16a_m0;
fm = filt16a_m0; fm = filt16a_m0;
fr = filt16a_r0; fr = filt16a_r0;
break; break;
case 1: case 1:
fl = filt16a_l1; fl = filt16a_l1;
fmm = filt16a_mm1;
fml = filt16a_ml1; fml = filt16a_ml1;
fmm = filt16a_mm1;
fmr = filt16a_mr1;
fm = filt16a_m1; fm = filt16a_m1;
fr = filt16a_r1; fr = filt16a_r1;
break; break;
case 2: case 2:
fl = filt16a_l2; fl = filt16a_l2;
fmm = filt16a_mm2;
fml = filt16a_ml2; fml = filt16a_ml2;
fmm = filt16a_mm2;
fmr = filt16a_mr2;
fm = filt16a_m2; fm = filt16a_m2;
fr = filt16a_r2; fr = filt16a_r2;
break; break;
case 3: case 3:
fl = filt16a_l3; fl = filt16a_l3;
fmm = filt16a_mm3;
fml = filt16a_ml3; fml = filt16a_ml3;
fmm = filt16a_mm3;
fmr = filt16a_mm3;
fm = filt16a_m3; fm = filt16a_m3;
fr = filt16a_r3; fr = filt16a_r3;
break; break;
...@@ -291,13 +242,10 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -291,13 +242,10 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue,
//Start pilot //Start pilot
ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15); ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15);
ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15); ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15);
#ifdef DEBUG_PRS_CHEST
printf("pilIdx %d at k %d of l %d reIdx %d rxF %p %d %d ch[0] %d ch[1] %d\n", 0, k, l, (l*frame_params->ofdm_symbol_size + k), rxF, rxF[0], rxF[1], ch[0], ch[1]);
#endif
multadd_real_vector_complex_scalar(fl, multadd_real_vector_complex_scalar(fl,
ch, ch,
prs_chest, ch_intrp,
16); 16);
pil +=2; pil +=2;
...@@ -306,50 +254,41 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -306,50 +254,41 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15); ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15);
ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15); ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15);
#ifdef DEBUG_PRS_CHEST
printf("pilIdx %d at k %d of l %d reIdx %d rxF %p %d %d ch[0] %d ch[1] %d\n", 1, k, l, (l*frame_params->ofdm_symbol_size + k), rxF, rxF[0], rxF[1], ch[0], ch[1]);
#endif
multadd_real_vector_complex_scalar(fml, multadd_real_vector_complex_scalar(fml,
ch, ch,
prs_chest, ch_intrp,
16); 16);
pil +=2; pil +=2;
k = (k+prs_cfg->CombSize) % frame_params->ofdm_symbol_size; k = (k+prs_cfg->CombSize) % frame_params->ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k]; rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k];
prs_chest +=8; ch_intrp +=8;
//Middle pilots //Middle pilots
for(int pIdx = 2; pIdx < prs_cfg->NumRB*(12/prs_cfg->CombSize)-2; pIdx++) for(int pIdx = 2; pIdx < prs_cfg->NumRB*(12/prs_cfg->CombSize)-2; pIdx++)
{ {
ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15); ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15);
ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15); ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15);
#ifdef DEBUG_PRS_CHEST
printf("pilIdx %d at k %d of l %d reIdx %d rxF %p %d %d ch[0] %d ch[1] %d\n", pIdx, k, l, (l*frame_params->ofdm_symbol_size + k), rxF, rxF[0], rxF[1], ch[0], ch[1]);
#endif
multadd_real_vector_complex_scalar(fmm, multadd_real_vector_complex_scalar(fmm,
ch, ch,
prs_chest, ch_intrp,
16); 16);
pil +=2; pil +=2;
k = (k+prs_cfg->CombSize) % frame_params->ofdm_symbol_size; k = (k+prs_cfg->CombSize) % frame_params->ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k]; rxF = (int16_t *)&rxdataF[rxAnt][l*frame_params->ofdm_symbol_size + k];
prs_chest +=8; ch_intrp +=8;
} }
//End pilot //End pilot
ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15); ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15);
ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15); ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15);
#ifdef DEBUG_PRS_CHEST
printf("pilIdx %d at k %d of l %d reIdx %d rxF %p %d %d ch[0] %d ch[1] %d\n", prs_cfg->NumRB*(12/prs_cfg->CombSize)-2, k, l, (l*frame_params->ofdm_symbol_size + k), rxF, rxF[0], rxF[1], ch[0], ch[1]);
#endif
multadd_real_vector_complex_scalar(fm, multadd_real_vector_complex_scalar(fmr,
ch, ch,
prs_chest, ch_intrp,
16); 16);
pil +=2; pil +=2;
...@@ -358,23 +297,71 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -358,23 +297,71 @@ int nr_prs_channel_estimation(PHY_VARS_NR_UE *ue,
ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15); ch[0] = (int16_t)(((int32_t)rxF[0]*pil[0] + (int32_t)rxF[1]*pil[1])>>15);
ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15); ch[1] = (int16_t)(((int32_t)rxF[1]*pil[0] - (int32_t)rxF[0]*pil[1])>>15);
#ifdef DEBUG_PRS_CHEST
printf("pilIdx %d at k %d of l %d reIdx %d rxF %p %d %d ch[0] %d ch[1] %d\n", prs_cfg->NumRB*(12/prs_cfg->CombSize)-1, k, l, (l*frame_params->ofdm_symbol_size + k), rxF, rxF[0], rxF[1], ch[0], ch[1]);
#endif
multadd_real_vector_complex_scalar(fr, multadd_real_vector_complex_scalar(fr,
ch, ch,
prs_chest, ch_intrp,
16); 16);
} }
prs_chest = (int16_t *)&ue->prs_ch_estimates[rxAnt][l*frame_params->ofdm_symbol_size]; ch_intrp = ch_init;
for (int re = 0; re < prs_cfg->NumRB*12; re++) for (int re = 0; re < prs_cfg->NumRB*12; re++)
printf("prs_ch[%d] %d %d\n", re, prs_chest[re<<1], prs_chest[(re<<1)+1]); {
prs_chest[re_offset] = ch_intrp[re<<1];
prs_chest[re_offset+1] = ch_intrp[(re<<1)+1];
printf("prs_ch[%d] %d %d\n", re_offset, ch_intrp[re<<1], ch_intrp[(re<<1)+1]);
re_offset = (re_offset+1) % frame_params->ofdm_symbol_size;
}
// Time domain IMPULSE response
idft_size_idx_t idftsizeidx;
switch (frame_params->ofdm_symbol_size) {
case 128:
idftsizeidx = IDFT_128;
break;
case 256:
idftsizeidx = IDFT_256;
break;
case 512:
idftsizeidx = IDFT_512;
break;
case 1024:
idftsizeidx = IDFT_1024;
break;
case 1536:
idftsizeidx = IDFT_1536;
break;
case 2048:
idftsizeidx = IDFT_2048;
break;
case 3072:
idftsizeidx = IDFT_3072;
break;
case 4096:
idftsizeidx = IDFT_4096;
break;
default:
printf("unsupported ofdm symbol size \n");
assert(0);
}
idft(idftsizeidx,
(int16_t *)&ue->prs_ch_estimates[rxAnt][l*frame_params->ofdm_symbol_size],
(int16_t *)&ue->prs_ch_estimates_time[rxAnt][l*frame_params->ofdm_symbol_size],1);
} //for l } //for l
LOG_M("prsEst.m","prs_chest",&ue->prs_ch_estimates[rxAnt][prs_cfg->SymbolStart*frame_params->ofdm_symbol_size], prs_cfg->NumPRSSymbols*prs_cfg->NumRB*12,1,1); LOG_M("prsEst.m","prs_chest",&ue->prs_ch_estimates[rxAnt][prs_cfg->SymbolStart*frame_params->ofdm_symbol_size], frame_params->ofdm_symbol_size,1,1);
LOG_M("prsEst_time.m","prs_chest_time",&ue->prs_ch_estimates_time[rxAnt][prs_cfg->SymbolStart*frame_params->ofdm_symbol_size], frame_params->ofdm_symbol_size,1,1);
return(0); return(0);
} }
......
...@@ -824,6 +824,8 @@ typedef struct { ...@@ -824,6 +824,8 @@ typedef struct {
NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_gNB_MAX];
NR_UE_DLSCH_t *dlsch_MCH[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_MCH[NUMBER_OF_CONNECTED_gNB_MAX];
prs_data_t prs_cfg; prs_data_t prs_cfg;
int32_t **prs_ch_estimates;
int32_t **prs_ch_estimates_time;
//Paging parameters //Paging parameters
uint32_t IMSImod1024; uint32_t IMSImod1024;
...@@ -846,7 +848,6 @@ typedef struct { ...@@ -846,7 +848,6 @@ typedef struct {
#endif #endif
int32_t **prs_ch_estimates;
/// PBCH DMRS sequence /// PBCH DMRS sequence
uint32_t nr_gold_pbch[2][64][NR_PBCH_DMRS_LENGTH_DWORD]; uint32_t nr_gold_pbch[2][64][NR_PBCH_DMRS_LENGTH_DWORD];
......
...@@ -105,8 +105,8 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_ ...@@ -105,8 +105,8 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_
prs_data.PRSResourceSetPeriod[0]=40; // PRS resource slot period prs_data.PRSResourceSetPeriod[0]=40; // PRS resource slot period
prs_data.PRSResourceSetPeriod[1]=0; // resource slot offset prs_data.PRSResourceSetPeriod[1]=0; // resource slot offset
prs_data.SymbolStart=7; prs_data.SymbolStart=7;
prs_data.NumPRSSymbols=6; prs_data.NumPRSSymbols=4;
prs_data.NumRB=8; prs_data.NumRB=273;
prs_data.RBOffset=0; prs_data.RBOffset=0;
prs_data.CombSize=4; prs_data.CombSize=4;
prs_data.REOffset=0; prs_data.REOffset=0;
......
...@@ -154,7 +154,6 @@ int main(int argc, char **argv) ...@@ -154,7 +154,6 @@ int main(int argc, char **argv)
int **txdata; int **txdata;
double **s_re,**s_im,**r_re,**r_im; double **s_re,**s_im,**r_re,**r_im;
//double iqim = 0.0; //double iqim = 0.0;
double DS_TDL = .03;
double ip =0.0; double ip =0.0;
//unsigned char pbch_pdu[6]; //unsigned char pbch_pdu[6];
// int sync_pos, sync_pos_slot; // int sync_pos, sync_pos_slot;
...@@ -258,21 +257,6 @@ int main(int argc, char **argv) ...@@ -258,21 +257,6 @@ int main(int argc, char **argv)
channel_model=ETU; channel_model=ETU;
break; break;
case 'H':
channel_model = TDL_C;
DS_TDL = .030; // 30 ns
break;
case 'I':
channel_model = TDL_C;
DS_TDL = .3; // 300ns
break;
case 'J':
channel_model=TDL_D;
DS_TDL = .03;
break;
default: default:
printf("Unsupported channel model! Exiting.\n"); printf("Unsupported channel model! Exiting.\n");
exit(-1); exit(-1);
...@@ -521,8 +505,10 @@ int main(int argc, char **argv) ...@@ -521,8 +505,10 @@ int main(int argc, char **argv)
channel_model, channel_model,
fs, fs,
bw, bw,
DS_TDL, 300e-9,
0, 0, 0, 0); 0,
0,
0, 0);
if (gNB2UE==NULL) { if (gNB2UE==NULL) {
printf("Problem generating channel model. Exiting.\n"); printf("Problem generating channel model. Exiting.\n");
...@@ -670,8 +656,8 @@ int main(int argc, char **argv) ...@@ -670,8 +656,8 @@ int main(int argc, char **argv)
for (i=0; i<frame_length_complex_samples; i++) { for (i=0; i<frame_length_complex_samples; i++) {
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
s_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]); r_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
s_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]); r_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
} }
} }
...@@ -681,17 +667,8 @@ int main(int argc, char **argv) ...@@ -681,17 +667,8 @@ int main(int argc, char **argv)
n_errors_payload = 0; n_errors_payload = 0;
for (trial=0; trial<n_trials; trial++) { for (trial=0; trial<n_trials; trial++) {
if (channel_model != AWGN) {
// multipath channel // multipath channel
multipath_channel(gNB2UE,s_re,s_im,r_re,r_im,frame_length_complex_samples,0,0); //multipath_channel(gNB2UE,s_re,s_im,r_re,r_im,frame_length_complex_samples,0);
}
else {
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
memcpy(r_re[aa],s_re[aa],frame_length_complex_samples*sizeof(double));
memcpy(r_im[aa],s_im[aa],frame_length_complex_samples*sizeof(double));
}
}
//AWGN //AWGN
sigma2_dB = 20*log10((double)AMP/4)-SNR; sigma2_dB = 20*log10((double)AMP/4)-SNR;
...@@ -762,8 +739,8 @@ int main(int argc, char **argv) ...@@ -762,8 +739,8 @@ int main(int argc, char **argv)
UE->prs_cfg.PRSResourceSetPeriod[0]=40; // PRS resource slot period UE->prs_cfg.PRSResourceSetPeriod[0]=40; // PRS resource slot period
UE->prs_cfg.PRSResourceSetPeriod[1]=0; // resource slot offset UE->prs_cfg.PRSResourceSetPeriod[1]=0; // resource slot offset
UE->prs_cfg.SymbolStart=7; UE->prs_cfg.SymbolStart=7;
UE->prs_cfg.NumPRSSymbols=6; UE->prs_cfg.NumPRSSymbols=4;
UE->prs_cfg.NumRB=8; UE->prs_cfg.NumRB=273;
UE->prs_cfg.RBOffset=0; UE->prs_cfg.RBOffset=0;
UE->prs_cfg.CombSize=4; UE->prs_cfg.CombSize=4;
UE->prs_cfg.REOffset=0; UE->prs_cfg.REOffset=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