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,
/// Antenna port mapping
//to be moved to init phase potentially, for now tx_layers 1-8 are mapped on antenna ports 1000-1007
/// DMRS QPSK modulation
for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; 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
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
}
#ifdef DEBUG_DLSCH
l0 = get_l0(rel15->dlDmrsSymbPos);
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 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");
}
......@@ -287,8 +286,8 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
delta = get_delta(ap, dmrs_Type);
l_prime = 0; // single symbol ap 0
l0 = get_l0(rel15->dlDmrsSymbPos);
uint8_t dmrs_symbol = l0+l_prime;
#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",
1+dmrs_Type,ap, Wt[0], Wt[1], Wf[0], Wf[1], delta, l_prime, l0, dmrs_symbol);
#endif
......@@ -296,54 +295,54 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
uint16_t m=0, n=0, dmrs_idx=0, k=0;
int txdataF_offset = (slot%2)*frame_parms->samples_per_slot_wCP;
for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) {
k = start_sc;
n = 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)
dmrs_idx = rel15->rbStart*6;
else
dmrs_idx = rel15->rbStart*4;
for (int i=0; i<rel15->rbSize*NR_NB_SC_PER_RB; i++) {
k = start_sc;
n = 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)
dmrs_idx = rel15->rbStart*6;
else
dmrs_idx = rel15->rbStart*4;
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
l_prime = 1;
else if (l>(l0+1)){//new DMRS pair
l0 = l;
l_prime = 0;
}
if (l==(l0+1)) //take into account the double DMRS symbols
l_prime = 1;
else if (l>(l0+1)) {//new DMRS pair
l0 = l;
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) + 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) + (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;
#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",
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)]);
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)],
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]);
#endif
dmrs_idx++;
k_prime++;
k_prime&=1;
n+=(k_prime)?0:1;
}
else {
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) + 1 + (2*txdataF_offset)] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15;
dmrs_idx++;
k_prime++;
k_prime&=1;
n+=(k_prime)?0:1;
} else {
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) + 1 + (2*txdataF_offset)] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15;
#ifdef DEBUG_DLSCH_MAPPING
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)],
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]);
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)],
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]);
#endif
m++;
}
}
if (++k >= frame_parms->ofdm_symbol_size)
k -= frame_parms->ofdm_symbol_size;
} //RE loop
m++;
}
}
if (++k >= frame_parms->ofdm_symbol_size)
k -= frame_parms->ofdm_symbol_size;
} //RE loop
} // symbol loop
}// layer loop
......
......@@ -685,86 +685,84 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
nr_pdsch_dmrs_rx(ue,Ns,ue->nr_gold_pdsch[eNB_offset][Ns][0], &pilot[0],1000+p,0,nb_rb_pdsch+rb_offset);
if (config_type == pdsch_dmrs_type1){
nushift = (p>>1)&1;
ue->frame_parms.nushift = nushift;
switch (delta) {
case 0://port 0,1
fl = filt8_l0;//left interpolation Filter for DMRS config. 1
fm = filt8_m0;//left middle interpolation Filter
fr = filt8_r0;//right interpolation Filter
fmm = filt8_mm0;;//middle middle interpolation Filter
fml = filt8_m0;//left middle interpolation Filter
fmr = filt8_mr0;//middle right interpolation Filter
fdcl = filt8_dcl0;//left DC interpolation Filter (even RB)
fdcr = filt8_dcr0;//right DC interpolation Filter (even RB)
fdclh = filt8_dcl0_h;//left DC interpolation Filter (odd RB)
fdcrh = filt8_dcr0_h;//right DC interpolation Filter (odd RB)
frl = NULL;
frr = NULL;
break;
case 1://port2,3
fl = filt8_l1;
fm = filt8_m1;
fr = filt8_r1;
fmm = filt8_mm1;
fml = filt8_ml1;
fmr = filt8_m1;
fdcl = filt8_dcl1;
fdcr = filt8_dcr1;
fdclh = filt8_dcl1_h;
fdcrh = filt8_dcr1_h;
frl = NULL;
frr = NULL;
break;
default:
msg("pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
return(-1);
break;
}
nushift = (p>>1)&1;
ue->frame_parms.nushift = nushift;
switch (delta) {
case 0://port 0,1
fl = filt8_l0;//left interpolation Filter for DMRS config. 1
fm = filt8_m0;//left middle interpolation Filter
fr = filt8_r0;//right interpolation Filter
fmm = filt8_mm0;;//middle middle interpolation Filter
fml = filt8_m0;//left middle interpolation Filter
fmr = filt8_mr0;//middle right interpolation Filter
fdcl = filt8_dcl0;//left DC interpolation Filter (even RB)
fdcr = filt8_dcr0;//right DC interpolation Filter (even RB)
fdclh = filt8_dcl0_h;//left DC interpolation Filter (odd RB)
fdcrh = filt8_dcr0_h;//right DC interpolation Filter (odd RB)
frl = NULL;
frr = NULL;
break;
case 1://port2,3
fl = filt8_l1;
fm = filt8_m1;
fr = filt8_r1;
fmm = filt8_mm1;
fml = filt8_ml1;
fmr = filt8_m1;
fdcl = filt8_dcl1;
fdcr = filt8_dcr1;
fdclh = filt8_dcl1_h;
fdcrh = filt8_dcr1_h;
frl = NULL;
frr = NULL;
break;
default:
msg("pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
return -1;
break;
}
} else {//pdsch_dmrs_type2
nushift = delta;
ue->frame_parms.nushift = nushift;
switch (delta) {
case 0://port 0,1
fl = filt8_l2;//left interpolation Filter should be fml
fr = filt8_r2;//right interpolation Filter should be fmr
fm = filt8_l2;
fmm = filt8_r2;
fml = filt8_ml2;
fmr = filt8_mr2;
frl = filt8_rl2;
frr = filt8_rm2;
fdcl = filt8_dcl1;
fdcr = filt8_dcr1;
fdclh = filt8_dcl1_h;
fdcrh = filt8_dcr1_h;
break;
case 2://port2,3
fl = filt8_l3;
fm = filt8_m2;
fr = filt8_r3;
fmm = filt8_mm2;
fml = filt8_l2;
fmr = filt8_r2;
frl = filt8_rl3;
frr = filt8_rr3;
fdcl = NULL;
fdcr = NULL;
fdclh = NULL;
fdcrh = NULL;
break;
default:
msg("pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
return(-1);
break;
}
nushift = delta;
ue->frame_parms.nushift = nushift;
switch (delta) {
case 0://port 0,1
fl = filt8_l2;//left interpolation Filter should be fml
fr = filt8_r2;//right interpolation Filter should be fmr
fm = filt8_l2;
fmm = filt8_r2;
fml = filt8_ml2;
fmr = filt8_mr2;
frl = filt8_rl2;
frr = filt8_rm2;
fdcl = filt8_dcl1;
fdcr = filt8_dcr1;
fdclh = filt8_dcl1_h;
fdcrh = filt8_dcr1_h;
break;
case 2://port2,3
fl = filt8_l3;
fm = filt8_m2;
fr = filt8_r3;
fmm = filt8_mm2;
fml = filt8_l2;
fmr = filt8_r2;
frl = filt8_rl3;
frr = filt8_rr3;
fdcl = NULL;
fdcr = NULL;
fdclh = NULL;
fdcrh = NULL;
break;
default:
msg("pdsch_channel_estimation: nushift=%d -> ERROR\n",nushift);
return -1;
break;
}
}
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
......@@ -971,225 +969,225 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
}
} else { //pdsch_dmrs_type2 |dmrs_r,dmrs_l,0,0,0,0,dmrs_r,dmrs_l,0,0,0,0|
// Treat first 4 pilots specially (left edge)
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
// Treat first 4 pilots specially (left edge)
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDSCH
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_l[0],ch_l[1],pil[0],pil[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_l[0],ch_l[1],pil[0],pil[1]);
#endif
pil+=2;
re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_r[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
ch[0] = (ch_l[0]+ch_r[0])>>1;
ch[1] = (ch_l[1]+ch_r[1])>>1;
dl_ch[(0+2*nushift)] = ch[0];
dl_ch[(1+2*nushift)] = ch[1];
dl_ch[2+2*nushift] = ch[0];
dl_ch[3+2*nushift] = ch[1];
multadd_real_vector_complex_scalar(fl,
ch,
dl_ch,
8);
pil+=2;
re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_r[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
ch[0] = (ch_l[0]+ch_r[0])>>1;
ch[1] = (ch_l[1]+ch_r[1])>>1;
multadd_real_vector_complex_scalar(fr,
ch,
dl_ch,
8);
dl_ch+=12;
dl_ch[0+2*nushift] = ch[0];
dl_ch[1+2*nushift] = ch[1];
dl_ch[2+2*nushift] = ch[0];
dl_ch[3+2*nushift] = ch[1];
dl_ch+=4;
for (pilot_cnt=4; pilot_cnt<4*nb_rb_pdsch; pilot_cnt+=4) {
multadd_real_vector_complex_scalar(fml,
ch,
dl_ch,
8);
pil+=2;
re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_r[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
ch[0] = (ch_l[0]+ch_r[0])>>1;
ch[1] = (ch_l[1]+ch_r[1])>>1;
dl_ch[(0+2*nushift)] = ch[0];
dl_ch[(1+2*nushift)] = ch[1];
dl_ch[2+2*nushift] = ch[0];
dl_ch[3+2*nushift] = ch[1];
multadd_real_vector_complex_scalar(fl,
ch,
dl_ch,
8);
pil+=2;
re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_r[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
ch[0] = (ch_l[0]+ch_r[0])>>1;
ch[1] = (ch_l[1]+ch_r[1])>>1;
multadd_real_vector_complex_scalar(fr,
ch,
dl_ch,
8);
dl_ch+=12;
dl_ch[0+2*nushift] = ch[0];
dl_ch[1+2*nushift] = ch[1];
dl_ch[2+2*nushift] = ch[0];
dl_ch[3+2*nushift] = ch[1];
dl_ch+=4;
for (pilot_cnt=4; pilot_cnt<4*nb_rb_pdsch; pilot_cnt+=4) {
multadd_real_vector_complex_scalar(fml,
ch,
dl_ch,
8);
pil+=2;
re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDSCH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch_l[0],ch_l[1],pil[0],pil[1]);
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt,rxF[0],rxF[1],ch_l[0],ch_l[1],pil[0],pil[1]);
#endif
pil+=2;
re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_r[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_r[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
ch[0] = (ch_l[0]+ch_r[0])>>1;
ch[1] = (ch_l[1]+ch_r[1])>>1;
ch[0] = (ch_l[0]+ch_r[0])>>1;
ch[1] = (ch_l[1]+ch_r[1])>>1;
#ifdef DEBUG_PDSCH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch_r[0],ch_r[1],pil[0],pil[1]);
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch_r[0],ch_r[1],pil[0],pil[1]);
#endif
multadd_real_vector_complex_scalar(fmr,
ch,
dl_ch,
8);
dl_ch+=8;
dl_ch[0+2*nushift] = ch[0];
dl_ch[1+2*nushift] = ch[1];
dl_ch[2+2*nushift] = ch[0];
dl_ch[3+2*nushift] = ch[1];
multadd_real_vector_complex_scalar(fm,
ch,
dl_ch,
8);
pil+=2;
re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_r[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
multadd_real_vector_complex_scalar(fmr,
ch,
dl_ch,
8);
dl_ch+=8;
dl_ch[0+2*nushift] = ch[0];
dl_ch[1+2*nushift] = ch[1];
dl_ch[2+2*nushift] = ch[0];
dl_ch[3+2*nushift] = ch[1];
multadd_real_vector_complex_scalar(fm,
ch,
dl_ch,
8);
pil+=2;
re_offset = (re_offset+5) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_l[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_l[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
pil+=2;
re_offset = (re_offset+1) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)];
ch_r[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch_r[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PDSCH
printf("pilot %d : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch_r[0],ch_r[1],pil[0],pil[1]);
printf("pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d) \n",pilot_cnt+1,rxF[0],rxF[1],ch_r[0],ch_r[1],pil[0],pil[1]);
#endif
ch[0] = (ch_l[0]+ch_r[0])>>1;
ch[1] = (ch_l[1]+ch_r[1])>>1;
multadd_real_vector_complex_scalar(fmm,
ch,
dl_ch,
8);
dl_ch+=12;
dl_ch[0+2*nushift] = ch[0];
dl_ch[1+2*nushift] = ch[1];
dl_ch[2+2*nushift] = ch[0];
dl_ch[3+2*nushift] = ch[1];
dl_ch+=4;
}
// Treat last 2 pilots specially (right edge)
// dl_ch-2+nushift<<1
multadd_real_vector_complex_scalar(frl,
dl_ch-2+2*nushift,
dl_ch,
8);
multadd_real_vector_complex_scalar(frr,
dl_ch-14+2*nushift,/*14*/
dl_ch,
8);
// check if PRB crosses DC and improve estimates around DC
if ((bwp_start_subcarrier < ue->frame_parms.ofdm_symbol_size) && (bwp_start_subcarrier+nb_rb_pdsch*12 >= ue->frame_parms.ofdm_symbol_size) && (p<2)) {
dl_ch = (int16_t *)&dl_ch_estimates[p*ue->frame_parms.nb_antennas_rx+aarx][ch_offset];
uint16_t idxDC = 2*(ue->frame_parms.ofdm_symbol_size - bwp_start_subcarrier);
dl_ch += (idxDC-8);
dl_ch = memset(dl_ch, 0, sizeof(int16_t)*20);
dl_ch -= 2;
ch_r[0] = dl_ch[0];
ch_r[1]= dl_ch[1] ;
dl_ch += 22;
ch_l[0] = dl_ch[0];
ch_l[1]= dl_ch[1] ;
// for proper allignment of SIMD vectors
if((ue->frame_parms.N_RB_DL&1)==0) {
dl_ch -= 20;
//Interpolate fdcrl1 with ch_r
multadd_real_vector_complex_scalar(filt8_dcrl1,
ch_r,
dl_ch,
8);
//Interpolate fdclh1 with ch_l
multadd_real_vector_complex_scalar(filt8_dclh1,
ch_l,
dl_ch,
8);
dl_ch += 16;
//Interpolate fdcrh1 with ch_r
multadd_real_vector_complex_scalar(filt8_dcrh1,
ch_r,
dl_ch,
8);
//Interpolate fdcll1 with ch_l
multadd_real_vector_complex_scalar(filt8_dcll1,
ch_l,
dl_ch,
8);
} else {
dl_ch -= 28;
//Interpolate fdcrl1 with ch_r
multadd_real_vector_complex_scalar(filt8_dcrl2,
ch_r,
dl_ch,
8);
//Interpolate fdclh1 with ch_l
multadd_real_vector_complex_scalar(filt8_dclh2,
ch_l,
dl_ch,
8);
dl_ch += 16;
//Interpolate fdcrh1 with ch_r
multadd_real_vector_complex_scalar(filt8_dcrh2,
ch_r,
dl_ch,
8);
//Interpolate fdcll1 with ch_l
multadd_real_vector_complex_scalar(filt8_dcll2,
ch_l,
dl_ch,
8);
}
}
ch[0] = (ch_l[0]+ch_r[0])>>1;
ch[1] = (ch_l[1]+ch_r[1])>>1;
multadd_real_vector_complex_scalar(fmm,
ch,
dl_ch,
8);
dl_ch+=12;
dl_ch[0+2*nushift] = ch[0];
dl_ch[1+2*nushift] = ch[1];
dl_ch[2+2*nushift] = ch[0];
dl_ch[3+2*nushift] = ch[1];
dl_ch+=4;
}
// Treat last 2 pilots specially (right edge)
// dl_ch-2+nushift<<1
multadd_real_vector_complex_scalar(frl,
dl_ch-2+2*nushift,
dl_ch,
8);
multadd_real_vector_complex_scalar(frr,
dl_ch-14+2*nushift,/*14*/
dl_ch,
8);
// check if PRB crosses DC and improve estimates around DC
if ((bwp_start_subcarrier < ue->frame_parms.ofdm_symbol_size) && (bwp_start_subcarrier+nb_rb_pdsch*12 >= ue->frame_parms.ofdm_symbol_size) && (p<2)) {
dl_ch = (int16_t *)&dl_ch_estimates[p*ue->frame_parms.nb_antennas_rx+aarx][ch_offset];
uint16_t idxDC = 2*(ue->frame_parms.ofdm_symbol_size - bwp_start_subcarrier);
dl_ch += (idxDC-8);
dl_ch = memset(dl_ch, 0, sizeof(int16_t)*20);
dl_ch -= 2;
ch_r[0] = dl_ch[0];
ch_r[1]= dl_ch[1] ;
dl_ch += 22;
ch_l[0] = dl_ch[0];
ch_l[1]= dl_ch[1] ;
// for proper allignment of SIMD vectors
if((ue->frame_parms.N_RB_DL&1)==0) {
dl_ch -= 20;
//Interpolate fdcrl1 with ch_r
multadd_real_vector_complex_scalar(filt8_dcrl1,
ch_r,
dl_ch,
8);
//Interpolate fdclh1 with ch_l
multadd_real_vector_complex_scalar(filt8_dclh1,
ch_l,
dl_ch,
8);
dl_ch += 16;
//Interpolate fdcrh1 with ch_r
multadd_real_vector_complex_scalar(filt8_dcrh1,
ch_r,
dl_ch,
8);
//Interpolate fdcll1 with ch_l
multadd_real_vector_complex_scalar(filt8_dcll1,
ch_l,
dl_ch,
8);
} else {
dl_ch -= 28;
//Interpolate fdcrl1 with ch_r
multadd_real_vector_complex_scalar(filt8_dcrl2,
ch_r,
dl_ch,
8);
//Interpolate fdclh1 with ch_l
multadd_real_vector_complex_scalar(filt8_dclh2,
ch_l,
dl_ch,
8);
dl_ch += 16;
//Interpolate fdcrh1 with ch_r
multadd_real_vector_complex_scalar(filt8_dcrh2,
ch_r,
dl_ch,
8);
//Interpolate fdcll1 with ch_l
multadd_real_vector_complex_scalar(filt8_dcll2,
ch_l,
dl_ch,
8);
}
}
}
#ifdef DEBUG_PDSCH
dl_ch = (int16_t *)&dl_ch_estimates[p*ue->frame_parms.nb_antennas_rx+aarx][ch_offset];
for(uint16_t idxP=0; idxP<ceil((float)nb_rb_pdsch*12/8); idxP++) {
for(uint8_t idxI=0; idxI<16; idxI+=2) {
printf("%d\t%d\t",dl_ch[idxP*16+idxI],dl_ch[idxP*16+idxI+1]);
}
printf("%d\n",idxP);
}
dl_ch = (int16_t *)&dl_ch_estimates[p*ue->frame_parms.nb_antennas_rx+aarx][ch_offset];
for(uint16_t idxP=0; idxP<ceil((float)nb_rb_pdsch*12/8); idxP++) {
for(uint8_t idxI=0; idxI<16; idxI+=2) {
printf("%d\t%d\t",dl_ch[idxP*16+idxI],dl_ch[idxP*16+idxI+1]);
}
printf("%d\n",idxP);
}
#endif
}
return(0);
......
......@@ -1818,15 +1818,15 @@ void nr_dlsch_scale_channel(int **dl_ch_estimates_ext,
short rb, ch_amp;
unsigned char aatx,aarx;
__m128i *dl_ch128, ch_amp128;
uint32_t nb_rb_0 = len/12 + ((len%12)?1:0);
// Determine scaling amplitude based the symbol
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);
// printf("Scaling PDSCH Chest in OFDM symbol %d by %d\n",symbol_mod,ch_amp);
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);
ch_amp128 = _mm_set1_epi16(ch_amp); // Q3.13
......@@ -2379,11 +2379,11 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
unsigned char j=0;
if (config_type==pdsch_dmrs_type1)
AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 1,
"nushift %d is illegal\n",frame_parms->nushift);
AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 1,
"nushift %d is illegal\n",frame_parms->nushift);
else
AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 2 || frame_parms->nushift == 4,
"nushift %d is illegal\n",frame_parms->nushift);
AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 2 || frame_parms->nushift == 4,
"nushift %d is illegal\n",frame_parms->nushift);
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
......@@ -2403,50 +2403,44 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
if (k>frame_parms->ofdm_symbol_size) {
k = k-frame_parms->ofdm_symbol_size;
rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))];
}
}
if (pilots==0) {
memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext));
memcpy((void*)dl_ch0_ext,(void*)dl_ch0,12*sizeof(*dl_ch0_ext));
dl_ch0_ext+=12;
rxF_ext+=12;
} else {//the symbol contains DMRS
j=0;
if (config_type==pdsch_dmrs_type1){
for (i = (1-frame_parms->nushift);
i<12;
i+=2) {
rxF_ext[j]=rxF[i];
dl_ch0_ext[j]=dl_ch0[i];
j++;
}
dl_ch0_ext+=6;
rxF_ext+=6;
} else {
for (i = (2+frame_parms->nushift);
i<6;
i++) {
rxF_ext[j]=rxF[i];
dl_ch0_ext[j]=dl_ch0[i];
j++;
}
for (i = (8+frame_parms->nushift);
i<12;
i++) {
rxF_ext[j]=rxF[i];
dl_ch0_ext[j]=dl_ch0[i];
j++;
}
dl_ch0_ext+= 8;
rxF_ext+= 8;
}
j=0;
if (config_type==pdsch_dmrs_type1){
for (i = (1-frame_parms->nushift); i<12; i+=2) {
rxF_ext[j]=rxF[i];
dl_ch0_ext[j]=dl_ch0[i];
j++;
}
dl_ch0_ext+=6;
rxF_ext+=6;
} else {
for (i = (2+frame_parms->nushift); i<6; i++) {
rxF_ext[j]=rxF[i];
dl_ch0_ext[j]=dl_ch0[i];
j++;
}
for (i = (8+frame_parms->nushift); i<12; i++) {
rxF_ext[j]=rxF[i];
dl_ch0_ext[j]=dl_ch0[i];
j++;
}
dl_ch0_ext+= 8;
rxF_ext+= 8;
}
}
dl_ch0+=12;
rxF+=12;
k+=12;
if (k>=frame_parms->ofdm_symbol_size) {
k=k-(frame_parms->ofdm_symbol_size);
rxF = &rxdataF[aarx][k+(symbol*(frame_parms->ofdm_symbol_size))];
k = k-(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,
unsigned short pmi,
unsigned char *pmi_ext,
unsigned char symbol,
uint8_t pilots,
uint8_t config_type,
unsigned short start_rb,
unsigned short nb_pdsch_rb,
uint8_t pilots,
uint8_t config_type,
unsigned short start_rb,
unsigned short nb_pdsch_rb,
unsigned char nr_tti_rx,
uint32_t high_speed_flag,
NR_DL_FRAME_PARMS *frame_parms);
......@@ -1003,8 +1003,8 @@ void nr_dlsch_scale_channel(int32_t **dl_ch_estimates_ext,
NR_DL_FRAME_PARMS *frame_parms,
NR_UE_DLSCH_t **dlsch_ue,
uint8_t symbol,
uint8_t start_symbol,
uint32_t len,
uint8_t start_symbol,
uint32_t len,
uint16_t nb_rb);
/** \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,
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_frame_rx = proc->frame_rx;//LOG_M
char filename[100];//LOG_M
int m;
int i_mod,eNB_id_i,dual_stream_UE;
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_
// do channel estimation for first DMRS only
for (m = s0; m < 3; m++) {
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
nr_pdsch_channel_estimation(ue,
0 /*eNB_id*/,
nr_tti_rx,
aatx /*p*/,
m,
ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12,
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);
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);//LOG_M
int **dl_ch_estimates = ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][0]->dl_ch_estimates;
//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);
}
}
break;
for (uint8_t aatx=0; aatx<1; aatx++) {//for MIMO Config: it shall loop over no_layers
nr_pdsch_channel_estimation(ue,
0 /*eNB_id*/,
nr_tti_rx,
aatx /*p*/,
m,
ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12,
pdsch_nb_rb);
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
///LOG_M: the channel estimation
int nr_frame_rx = proc->frame_rx;
char filename[100];
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;
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++) {
......
......@@ -23,7 +23,7 @@ gNBs =
ssb_SubcarrierOffset = 0;
pdsch_AntennaPorts = 1;
servingCellConfigCommon = (
{
#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