Commit 7dc97108 authored by sfn's avatar sfn

Fix indentation issues in nr_dlsch_demodulation.c

parent 3a83e8df
......@@ -355,13 +355,12 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
symbol,
pilots,
config_type,
start_rb,
start_rb + dlsch0_harq->BWPStart,
nb_rb_pdsch,
dlsch0_harq->n_dmrs_cdm_groups,
dlsch0_harq->Nl,
frame_parms,
dlsch0_harq->dlDmrsSymbPos);
else// one layer
nb_rb = nr_dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF,
pdsch_vars[gNB_id]->dl_ch_estimates,
......@@ -375,10 +374,10 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
dlsch0_harq->n_dmrs_cdm_groups,
frame_parms,
dlsch0_harq->dlDmrsSymbPos);
} /*else if(beamforming_mode>7) {
}
else if(beamforming_mode>7) {
LOG_W(PHY,"dlsch_demodulation: beamforming mode not supported yet.\n");
}*/
}
//printf("nb_rb = %d, gNB_id %d\n",nb_rb,gNB_id);
if (nb_rb==0) {
......@@ -512,7 +511,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
nb_rb,
pdsch_vars[gNB_id]->log2_maxh,
measurements); // log2_maxh+I0_shift
} else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM){
}
else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) {
nr_dlsch_channel_compensation_core(pdsch_vars[gNB_id]->rxdataF_ext,
pdsch_vars[gNB_id]->dl_ch_estimates_ext,
pdsch_vars[gNB_id]->dl_ch_mag0,
......@@ -559,8 +560,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
n_rx,
symbol,
nb_rb);
if (n_tx == 2)
if (n_tx == 2)//Apply zero forcing for 2 Tx layers
nr_zero_forcing_rx_2layers(pdsch_vars[gNB_id]->rxdataF_comp0,
pdsch_vars[gNB_id]->dl_ch_mag0,
pdsch_vars[gNB_id]->dl_ch_magb0,
......@@ -570,8 +570,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
dlsch0_harq->Qm,
pdsch_vars[gNB_id]->log2_maxh,
symbol);
} else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM){
}
else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) {
nr_dlsch_detection_mrc_core(pdsch_vars[gNB_id]->rxdataF_comp0,
NULL,
pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round],
......@@ -866,6 +866,7 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext,
dl_ch_mag128b[0] = _mm_mulhi_epi16(dl_ch_mag128b[0],QAM_amp128b);
dl_ch_mag128b[0] = _mm_slli_epi16(dl_ch_mag128b[0],1);
dl_ch_mag128b[1] = _mm_mulhi_epi16(dl_ch_mag128b[1],QAM_amp128b);
dl_ch_mag128b[1] = _mm_slli_epi16(dl_ch_mag128b[1],1);
......@@ -904,6 +905,10 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext,
// print_ints("c0",&mmtmpD2);
// print_ints("c1",&mmtmpD3);
rxdataF_comp128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3);
//printf("arx%d atx%d rb_index %d symbol%d\n",aarx,aatx,rb,symbol);
// print_shorts("rx:",rxdataF128);
// print_shorts("ch:",dl_ch128);
// print_shorts("pack:",rxdataF_comp128);
//printf("arx%d atx%d rb_index %d symbol%d\n",aarx,aatx,rb,symbol);
//print_shorts("rx:",(int16_t*)&rxdataF128[0]);
......@@ -952,7 +957,8 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext,
dl_ch_mag128r+=3;
rxdataF128+=3;
rxdataF_comp128+=3;
} else { // we have a smaller PDSCH in symbols with pilots so skip last group of 4 REs and increment less
}
else { // we have a smaller PDSCH in symbols with pilots so skip last group of 4 REs and increment less
dl_ch128+=2;
dl_ch_mag128+=2;
dl_ch_mag128b+=2;
......@@ -1676,7 +1682,7 @@ void nr_dlsch_channel_level_median(int **dl_ch_estimates_ext,
int norm_pack;
__m128i *dl_ch128, norm128D;
for (aatx=0; aatx<n_tx; aatx++){
for (aatx=0; aatx<n_tx; aatx++) {
for (aarx=0; aarx<n_rx; aarx++) {
max = median[aatx*n_rx + aarx];//initialize the med point for max
min = median[aatx*n_rx + aarx];//initialize the med point for min
......@@ -1699,12 +1705,10 @@ void nr_dlsch_channel_level_median(int **dl_ch_estimates_ext,
max = norm_pack;//store values more than max
if (norm_pack < min)
min = norm_pack;//store values less than min
dl_ch128+=1;
}
median[aatx*n_rx + aarx] = (max+min)>>1;
//printf("Channel level median [%d]: %d max = %d min = %d\n",aatx*n_rx + aarx, median[aatx*n_rx + aarx],max,min);
}
}
......@@ -2068,7 +2072,7 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
unsigned char j=0;
if (config_type==pdsch_dmrs_type1){
if (config_type==pdsch_dmrs_type1) {
AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2,
"n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups);
nushift = n_dmrs_cdm_groups -1;//delta in Table 7.4.1.1.2-1
......@@ -2139,7 +2143,6 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
}
}
}
return(nb_rb_pdsch);
}
......@@ -2163,11 +2166,10 @@ unsigned short nr_dlsch_extract_rbs_multiple(int **rxdataF,
int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext;
int8_t validDmrsEst = 0; //store last DMRS Symbol index
if (config_type==pdsch_dmrs_type1){
if (config_type==pdsch_dmrs_type1) {
AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2,
"n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups);
nushift = n_dmrs_cdm_groups -1;//delta in Table 7.4.1.1.2-1
} else {
AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2 || n_dmrs_cdm_groups == 3,
"n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups);
......@@ -2190,8 +2192,8 @@ unsigned short nr_dlsch_extract_rbs_multiple(int **rxdataF,
dl_ch0 = &dl_ch_estimates[(aatx*frame_parms->nb_antennas_rx)+aarx][(validDmrsEst*(frame_parms->ofdm_symbol_size))];
dl_ch0_ext = &dl_ch_estimates_ext[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*(nb_rb_pdsch*NR_NB_SC_PER_RB)];
for (rb = 0; rb < nb_rb_pdsch; rb++) {
for (rb = 0; rb < nb_rb_pdsch; rb++)
{
if (pilots==0) {//data symbol only
if (aatx==0) {//Extract Rx signal only
memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext));
......@@ -2199,7 +2201,8 @@ unsigned short nr_dlsch_extract_rbs_multiple(int **rxdataF,
}
memcpy((void*)dl_ch0_ext,(void*)dl_ch0,12*sizeof(*dl_ch0_ext));//Extract Channel Estimate
dl_ch0_ext+=12;
} else {//the symbol contains DMRS
}
else {//the symbol contains DMRS
j=0;
if (config_type==pdsch_dmrs_type1) {
if (nushift == 0) {//data is multiplexed
......@@ -2211,7 +2214,8 @@ unsigned short nr_dlsch_extract_rbs_multiple(int **rxdataF,
dl_ch0_ext+=6;
if (aatx==0) rxF_ext+=6;
}
} else {//pdsch_dmrs_type2
}
else {//pdsch_dmrs_type2
for (i = (2+nushift); i<6; i++) {
if (aatx==0) rxF_ext[j]=rxF[i];
dl_ch0_ext[j]=dl_ch0[i];
......@@ -2239,7 +2243,6 @@ unsigned short nr_dlsch_extract_rbs_multiple(int **rxdataF,
}//rb
}//aatx
}//aarx
return(nb_rb_pdsch);
}
......@@ -2261,7 +2264,6 @@ void nr_dlsch_detection_mrc(int **rxdataF_comp,
rxdataF_comp128_0 = (__m128i *)&rxdataF_comp[(aatx*n_rx)][symbol*nb_rb*12];//aarx=0
dl_ch_mag128_0 = (__m128i *)&dl_ch_mag[(aatx*n_rx)][symbol*nb_rb*12];//aarx=0
dl_ch_mag128_0b = (__m128i *)&dl_ch_magb[(aatx*n_rx)][symbol*nb_rb*12];
for (aarx=1; aarx<n_rx; aarx++) {
rxdataF_comp128_1 = (__m128i *)&rxdataF_comp[(aatx*n_rx)+aarx][symbol*nb_rb*12];// aarx=1,..., n_rx-1
dl_ch_mag128_1 = (__m128i *)&dl_ch_mag[(aatx*n_rx)+aarx][symbol*nb_rb*12];
......@@ -2273,15 +2275,14 @@ void nr_dlsch_detection_mrc(int **rxdataF_comp,
dl_ch_mag128_0[i] = _mm_adds_epi16(dl_ch_mag128_0[i],dl_ch_mag128_1[i]);
dl_ch_mag128_0b[i] = _mm_adds_epi16(dl_ch_mag128_0b[i],dl_ch_mag128_1b[i]);
/*if (i==0) {
printf("atx%d symbol%d\n",aatx,symbol);
printf("mrc comp0 re: %d mrc comp0 im: %d \n",((int16_t*)&rxdataF_comp128_0[0])[0],((int16_t*)&rxdataF_comp128_0[0])[1]);
printf("mrc mag0 = %d = %d \n",((int16_t*)&dl_ch_mag128_0[0])[0],((int16_t*)&dl_ch_mag128_0[0])[1]);
printf("mrc mag0b = %d = %d \n",((int16_t*)&dl_ch_mag128_0b[0])[0],((int16_t*)&dl_ch_mag128_0b[0])[1]);
}*/
* printf("atx%d symbol%d\n",aatx,symbol);
* printf("mrc comp0 re: %d mrc comp0 im: %d \n",((int16_t*)&rxdataF_comp128_0[0])[0],((int16_t*)&rxdataF_comp128_0[0])[1]);
* printf("mrc mag0 = %d = %d \n",((int16_t*)&dl_ch_mag128_0[0])[0],((int16_t*)&dl_ch_mag128_0[0])[1]);
* printf("mrc mag0b = %d = %d \n",((int16_t*)&dl_ch_mag128_0b[0])[0],((int16_t*)&dl_ch_mag128_0b[0])[1]);
* }*/
}
}
}
if (rho) {
/*rho128_0 = (__m128i *) &rho[0][symbol*frame_parms->N_RB_DL*12];
rho128_1 = (__m128i *) &rho[1][symbol*frame_parms->N_RB_DL*12];
......@@ -2323,16 +2324,16 @@ void nr_det_HhH(int32_t *after_mf_00,//a
for (rb=0; rb<3*nb_rb; rb++) {
// complex multiplication (I_a+jQ_a)(I_d+jQ_d) = (I_aI_d - Q_aQ_d) + j(Q_aI_d + I_aQ_d)
// The imag part is often zero, we compute only the real part
//complex multiplication (I_a+jQ_a)(I_d+jQ_d) = (I_aI_d - Q_aQ_d) + j(Q_aI_d + I_aQ_d)
//The imag part is often zero, we compute only the real part
ad_re_128 = _mm_sign_epi16(after_mf_00_128[0],*(__m128i*)&nr_conjug2[0]);
ad_re_128 = _mm_madd_epi16(ad_re_128,after_mf_11_128[0]); //Re: I_a0*I_d0 - Q_a1*Q_d1
//ad_im_128 = _mm_shufflelo_epi16(after_mf_00_128[0],_MM_SHUFFLE(2,3,0,1));//permutes IQs for the low 64 bits as [I_a0 Q_a1 I_a2 Q_a3]_64bits to [Q_a1 I_a0 Q_a3 I_a2]_64bits
//ad_im_128 = _mm_shufflehi_epi16(ad_im_128,_MM_SHUFFLE(2,3,0,1));//permutes IQs for the high 64 bits as [I_a0 Q_a1 I_a2 Q_a3]_64bits to [Q_a1 I_a0 Q_a3 I_a2]_64bits
//ad_im_128 = _mm_madd_epi16(ad_im_128,after_mf_11_128[0]);//Im: (Q_aI_d + I_aQ_d)
// complex multiplication (I_b+jQ_b)(I_c+jQ_c) = (I_bI_c - Q_bQ_c) + j(Q_bI_c + I_bQ_c)
// The imag part is often zero, we compute only the real part
//complex multiplication (I_b+jQ_b)(I_c+jQ_c) = (I_bI_c - Q_bQ_c) + j(Q_bI_c + I_bQ_c)
//The imag part is often zero, we compute only the real part
bc_re_128 = _mm_sign_epi16(after_mf_01_128[0],*(__m128i*)&nr_conjug2[0]);
bc_re_128 = _mm_madd_epi16(bc_re_128,after_mf_10_128[0]); //Re: I_b0*I_c0 - Q_b1*Q_c1
//bc_im_128 = _mm_shufflelo_epi16(after_mf_01_128[0],_MM_SHUFFLE(2,3,0,1));//permutes IQs for the low 64 bits as [I_b0 Q_b1 I_b2 Q_b3]_64bits to [Q_b1 I_b0 Q_b3 I_b2]_64bits
......@@ -2354,11 +2355,11 @@ void nr_det_HhH(int32_t *after_mf_00,//a
det_fin_128[0] = _mm_abs_epi32(det_re_128);
/*if ((rb==0)&&(symbol==1)) {
printf("\n Computing det_HhH_inv \n");
print_ints("det_re_128:",(int32_t*)&det_re_128);
//print_ints("det_im_128:",(int32_t*)&det_im_128);
print_ints("det_fin_128:",(int32_t*)&det_fin_128[0]);
}*/
* printf("\n Computing det_HhH_inv \n");
* print_ints("det_re_128:",(int32_t*)&det_re_128);
* print_ints("det_im_128:",(int32_t*)&det_im_128);
* print_ints("det_fin_128:",(int32_t*)&det_fin_128[0]);
* }*/
det_fin_128+=1;
after_mf_00_128+=1;
......@@ -2370,7 +2371,6 @@ void nr_det_HhH(int32_t *after_mf_00,//a
_m_empty();
}
/* Zero Forcing Rx function: nr_inv_comp_muli
* Complex number multi: z = x*y
* = (x_re*y_re - x_im*y_im) + j(x_im*y_re + x_re*y_im)
......@@ -2395,7 +2395,6 @@ __m128i nr_inv_comp_muli(__m128i input_x,
xy_im_128 = _mm_madd_epi16(xy_im_128,input_y);//Im: (x_im*y_re + x_re*y_im)
//convert back to Q15 before packing
xy_re_128 = _mm_srai_epi32(xy_re_128,4);//(2^15/64*2*16)
xy_im_128 = _mm_srai_epi32(xy_im_128,4);
......@@ -2404,6 +2403,7 @@ __m128i nr_inv_comp_muli(__m128i input_x,
tmp_z1 = _mm_unpackhi_epi32(xy_re_128,xy_im_128);
//print_ints("unpack hi:",&tmp_z1[0]);
output_z = _mm_packs_epi32(tmp_z0,tmp_z1);
_mm_empty();
_m_empty();
return(output_z);
......
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