Commit 459913de authored by Elena Lukashova's avatar Elena Lukashova

changes are mostly related to:

1. Introducing dlsch_16qam_llr_SIC.
2. New writing files format in file_output.c
3. Some comments addded.
parent f5c798e4
...@@ -1127,15 +1127,16 @@ int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue, ...@@ -1127,15 +1127,16 @@ int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue,
ue_pdsch_vars[eNB_id]->dl_ch_rho2_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); ue_pdsch_vars[eNB_id]->dl_ch_rho2_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
} }
const size_t num = 7*2*frame_parms->N_RB_DL*12+4;
for (k=0;k<8;k++) { //harq_pid for (k=0;k<8;k++) { //harq_pid
for (l=0;l<8;l++) { //round for (l=0;l<8;l++) { //round
ue_pdsch_vars[eNB_id]->rxdataF_comp1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); ue_pdsch_vars[eNB_id]->rxdataF_comp1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
// ue_pdsch_vars[eNB_id]->clean_x1[k][l] = (int16_t*)malloc16_clear( sizeof(int32_t) * num);
for (int i=0; i<frame_parms->nb_antennas_rx; i++) for (int i=0; i<frame_parms->nb_antennas_rx; i++)
for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++) for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
const int idx = (j<<1)+i; const int idx = (j<<1)+i;
const size_t num = 7*2*frame_parms->N_RB_DL*12+4;
ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
ue_pdsch_vars[eNB_id]->rxdataF_comp1[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); ue_pdsch_vars[eNB_id]->rxdataF_comp1[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
} }
......
...@@ -5897,7 +5897,7 @@ uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb) ...@@ -5897,7 +5897,7 @@ uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb)
pmi_im += meas->subband_pmi_im[eNB_id][i][aarx]; pmi_im += meas->subband_pmi_im[eNB_id][i][aarx];
//printf("meas->subband_pmi_im[eNB_id][i][%d]=%d\n",aarx, meas->subband_pmi_im[eNB_id][i][aarx]); //printf("meas->subband_pmi_im[eNB_id][i][%d]=%d\n",aarx, meas->subband_pmi_im[eNB_id][i][aarx]);
} }
if (((pmi_re >= pmi_im) && (pmi_re >= -pmi_im)) || ((pmi_re >= pmi_im) && (pmi_re <= -pmi_im))) if (((pmi_re >= pmi_im) && (pmi_re >= -pmi_im)) || ((pmi_re <= pmi_im) && (pmi_re >= -pmi_im)))
pmiq = PMI_2A_R1_11; pmiq = PMI_2A_R1_11;
else else
pmiq = PMI_2A_R1_1j; pmiq = PMI_2A_R1_1j;
......
...@@ -299,7 +299,7 @@ int dlsch_encoding(unsigned char *a, ...@@ -299,7 +299,7 @@ int dlsch_encoding(unsigned char *a,
printf("\n"); printf("\n");
*/ */
// Add 24-bit crc (polynomial A) to payload // Add 24-bit crc (polynomial A) to payload
crc = crc24a(a, crc = crc24a(a, //input bits for computation, A is a size of a
A)>>8; A)>>8;
a[A>>3] = ((uint8_t*)&crc)[2]; a[A>>3] = ((uint8_t*)&crc)[2];
a[1+(A>>3)] = ((uint8_t*)&crc)[1]; a[1+(A>>3)] = ((uint8_t*)&crc)[1];
...@@ -310,15 +310,15 @@ int dlsch_encoding(unsigned char *a, ...@@ -310,15 +310,15 @@ int dlsch_encoding(unsigned char *a,
// dlsch->harq_processes[harq_pid]->b = a; // dlsch->harq_processes[harq_pid]->b = a;
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4); memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4);
if (lte_segmentation(dlsch->harq_processes[harq_pid]->b, if (lte_segmentation(dlsch->harq_processes[harq_pid]->b, // bits after CRC attachement
dlsch->harq_processes[harq_pid]->c, dlsch->harq_processes[harq_pid]->c, // output from segmentation
dlsch->harq_processes[harq_pid]->B, dlsch->harq_processes[harq_pid]->B, //size of B=L+A
&dlsch->harq_processes[harq_pid]->C, &dlsch->harq_processes[harq_pid]->C, //number of codeblocks
&dlsch->harq_processes[harq_pid]->Cplus, &dlsch->harq_processes[harq_pid]->Cplus, //Number of segments of size K+
&dlsch->harq_processes[harq_pid]->Cminus, &dlsch->harq_processes[harq_pid]->Cminus,//Number of segments of size K_
&dlsch->harq_processes[harq_pid]->Kplus, &dlsch->harq_processes[harq_pid]->Kplus, //First segmentation size
&dlsch->harq_processes[harq_pid]->Kminus, &dlsch->harq_processes[harq_pid]->Kminus, //Second segmentation size
&dlsch->harq_processes[harq_pid]->F)<0) &dlsch->harq_processes[harq_pid]->F)<0) //Number of filler bits
return(-1); return(-1);
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) { for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
...@@ -399,7 +399,7 @@ int dlsch_encoding(unsigned char *a, ...@@ -399,7 +399,7 @@ int dlsch_encoding(unsigned char *a,
r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r], r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r],
G, //G G, //G
dlsch->harq_processes[harq_pid]->w[r], dlsch->harq_processes[harq_pid]->w[r],
dlsch->harq_processes[harq_pid]->e+r_offset, dlsch->harq_processes[harq_pid]->e+r_offset, // sequence of bits for transmission
dlsch->harq_processes[harq_pid]->C, // C dlsch->harq_processes[harq_pid]->C, // C
dlsch->Nsoft, // Nsoft, dlsch->Nsoft, // Nsoft,
dlsch->Mdlharq, dlsch->Mdlharq,
......
...@@ -58,8 +58,8 @@ ...@@ -58,8 +58,8 @@
//#define DEBUG_DLSCH_DEMOD 1 //#define DEBUG_DLSCH_DEMOD 1
int avg[4]; int avg[4];
int avg_0[4]; int avg_0[2];
int avg_1[4]; int avg_1[2];
// [MCS][i_mod (0,1,2) = (2,4,6)] // [MCS][i_mod (0,1,2) = (2,4,6)]
unsigned char offset_mumimo_llr_drange_fix=0; unsigned char offset_mumimo_llr_drange_fix=0;
...@@ -329,9 +329,8 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -329,9 +329,8 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++)
avgs = cmax(avgs,avg[(aatx<<1)+aarx]); avgs = cmax(avgs,avg[(aatx<<1)+aarx]);
// avgs = cmax(avgs,avg[(aarx<<1)+aatx]); // avgs = cmax(avgs,avg[(aarx<<1)+aatx]);
lte_ue_pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2); //+ interf_unaw_shift_tm1_mcs[dlsch0_harq->mcs];
lte_ue_pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2) + interf_unaw_shift_tm1_mcs[dlsch0_harq->mcs]; // printf("TM4 I-A log2_maxh0 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh);
} }
...@@ -349,9 +348,9 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -349,9 +348,9 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
lte_ue_pdsch_vars[eNB_id]->log2_maxh, lte_ue_pdsch_vars[eNB_id]->log2_maxh,
phy_measurements); // log2_maxh+I0_shift phy_measurements); // log2_maxh+I0_shift
if (symbol == 5) { /*if (symbol == 5) {
write_output("rxF_comp_d.m","rxF_c_d",&lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); write_output("rxF_comp_d.m","rxF_c_d",&lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
} } */
if ((rx_type==rx_IC_single_stream) && if ((rx_type==rx_IC_single_stream) &&
(eNB_id_i<phy_vars_ue->n_connected_eNB)) { (eNB_id_i<phy_vars_ue->n_connected_eNB)) {
...@@ -413,6 +412,10 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -413,6 +412,10 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
symbol, symbol,
nb_rb, nb_rb,
dlsch0_harq->mimo_mode); dlsch0_harq->mimo_mode);
// write_output("dlsch0_r0_aver_chan_1.m","dl_aver_ch1_r0_0",&avg_1[0],1,1,2);
if (rx_type>rx_standard) { if (rx_type>rx_standard) {
...@@ -438,7 +441,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -438,7 +441,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
//printf("TM4 I-UA log2_maxh1 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh1); //printf("TM4 I-UA log2_maxh1 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh1);
} }
} }
dlsch_channel_compensation_TM34(frame_parms, dlsch_channel_compensation_TM34(frame_parms,
lte_ue_pdsch_vars[eNB_id], lte_ue_pdsch_vars[eNB_id],
phy_measurements, phy_measurements,
...@@ -2961,7 +2964,7 @@ void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -2961,7 +2964,7 @@ void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp0 =lte_ue_pdsch_vars->rxdataF_comp0; int **rxdataF_comp0 =lte_ue_pdsch_vars->rxdataF_comp0;
int **rxdataF_comp1 =lte_ue_pdsch_vars->rxdataF_comp1[harq_pid][round]; int **rxdataF_comp1 =lte_ue_pdsch_vars->rxdataF_comp1[harq_pid][round];
int **dl_ch_rho_ext =lte_ue_pdsch_vars->dl_ch_rho_ext[harq_pid][round]; //for first stream int **dl_ch_rho_ext =lte_ue_pdsch_vars->dl_ch_rho_ext[harq_pid][round]; //for second stream
int **dl_ch_rho2_ext =lte_ue_pdsch_vars->dl_ch_rho2_ext; int **dl_ch_rho2_ext =lte_ue_pdsch_vars->dl_ch_rho2_ext;
int **dl_ch_mag0 = lte_ue_pdsch_vars->dl_ch_mag0; int **dl_ch_mag0 = lte_ue_pdsch_vars->dl_ch_mag0;
int **dl_ch_mag1 = lte_ue_pdsch_vars->dl_ch_mag1; int **dl_ch_mag1 = lte_ue_pdsch_vars->dl_ch_mag1;
...@@ -2990,8 +2993,8 @@ void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -2990,8 +2993,8 @@ void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms,
} } } }
// if (rho) { // if (rho) {
rho128_0 = (__m128i *) &dl_ch_rho_ext[0][symbol*frame_parms->N_RB_DL*12]; rho128_0 = (__m128i *) &dl_ch_rho2_ext[0][symbol*frame_parms->N_RB_DL*12];
rho128_1 = (__m128i *) &dl_ch_rho_ext[1][symbol*frame_parms->N_RB_DL*12]; rho128_1 = (__m128i *) &dl_ch_rho2_ext[1][symbol*frame_parms->N_RB_DL*12];
for (i=0;i<nb_rb*3;i++) { for (i=0;i<nb_rb*3;i++) {
// print_shorts("mrc rho0:",&rho128_0[i]); // print_shorts("mrc rho0:",&rho128_0[i]);
// print_shorts("mrc rho1:",&rho128_1[i]); // print_shorts("mrc rho1:",&rho128_1[i]);
...@@ -3001,8 +3004,8 @@ void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -3001,8 +3004,8 @@ void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms,
if (dual_stream_UE == 1) { if (dual_stream_UE == 1) {
rho128_i0 = (__m128i *) &dl_ch_rho2_ext[0][symbol*frame_parms->N_RB_DL*12]; rho128_i0 = (__m128i *) &dl_ch_rho_ext[0][symbol*frame_parms->N_RB_DL*12];
rho128_i1 = (__m128i *) &dl_ch_rho2_ext[1][symbol*frame_parms->N_RB_DL*12]; rho128_i1 = (__m128i *) &dl_ch_rho_ext[1][symbol*frame_parms->N_RB_DL*12];
rxdataF_comp128_i0 = (__m128i *)&rxdataF_comp1[0][symbol*frame_parms->N_RB_DL*12]; rxdataF_comp128_i0 = (__m128i *)&rxdataF_comp1[0][symbol*frame_parms->N_RB_DL*12];
rxdataF_comp128_i1 = (__m128i *)&rxdataF_comp1[1][symbol*frame_parms->N_RB_DL*12]; rxdataF_comp128_i1 = (__m128i *)&rxdataF_comp1[1][symbol*frame_parms->N_RB_DL*12];
dl_ch_mag128_i0 = (__m128i *)&dl_ch_mag1[0][symbol*frame_parms->N_RB_DL*12]; dl_ch_mag128_i0 = (__m128i *)&dl_ch_mag1[0][symbol*frame_parms->N_RB_DL*12];
...@@ -3056,6 +3059,7 @@ void dlsch_scale_channel(int **dl_ch_estimates_ext, ...@@ -3056,6 +3059,7 @@ void dlsch_scale_channel(int **dl_ch_estimates_ext,
ch_amp = ((pilots) ? (dlsch_ue[0]->sqrt_rho_b) : (dlsch_ue[0]->sqrt_rho_a)); ch_amp = ((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\n",symbol_mod,ch_amp); LOG_D(PHY,"Scaling PDSCH Chest in OFDM symbol %d by %d\n",symbol_mod,ch_amp);
// printf("Scaling PDSCH Chest in OFDM symbol %d by %d\n",symbol_mod,ch_amp);
ch_amp128 = _mm_set1_epi16(ch_amp); // Q3.13 ch_amp128 = _mm_set1_epi16(ch_amp); // Q3.13
...@@ -3147,7 +3151,7 @@ void dlsch_channel_level(int **dl_ch_estimates_ext, ...@@ -3147,7 +3151,7 @@ void dlsch_channel_level(int **dl_ch_estimates_ext,
((int*)&avg128D)[2] + ((int*)&avg128D)[2] +
((int*)&avg128D)[3])/(nb_rb*nre); ((int*)&avg128D)[3])/(nb_rb*nre);
// printf("Channel level : %d\n",avg[(aatx<<1)+aarx]); // printf("Channel level : %d\n",avg[(aatx<<1)+aarx]);
} }
_mm_empty(); _mm_empty();
...@@ -3313,14 +3317,15 @@ void dlsch_channel_level_TM34(int **dl_ch_estimates_ext, ...@@ -3313,14 +3317,15 @@ void dlsch_channel_level_TM34(int **dl_ch_estimates_ext,
prec2A_TM4_128(pmi_ext[rb],&dl_ch0_128_tmp,&dl_ch1_128_tmp); prec2A_TM4_128(pmi_ext[rb],&dl_ch0_128_tmp,&dl_ch1_128_tmp);
// mmtmpD2 = _mm_madd_epi16(dl_ch0_128_tmp,dl_ch0_128_tmp); // mmtmpD2 = _mm_madd_epi16(dl_ch0_128_tmp,dl_ch0_128_tmp);
avg_0_128D = _mm_add_epi32(avg_0_128D,_mm_madd_epi16(dl_ch0_128_tmp,dl_ch0_128_tmp));
avg_1_128D = _mm_add_epi32(avg_1_128D,_mm_madd_epi16(dl_ch1_128_tmp,dl_ch1_128_tmp)); avg_1_128D = _mm_add_epi32(avg_1_128D,_mm_madd_epi16(dl_ch1_128_tmp,dl_ch1_128_tmp));
avg_0_128D = _mm_add_epi32(avg_0_128D,_mm_madd_epi16(dl_ch0_128_tmp,dl_ch0_128_tmp));
dl_ch0_128+=3; dl_ch0_128+=3;
dl_ch1_128+=3; dl_ch1_128+=3;
} }
} }
avg_0[aarx] = (((int*)&avg_0_128D)[0])/(nb_rb*nre) + avg_0[aarx] = (((int*)&avg_0_128D)[0])/(nb_rb*nre) +
(((int*)&avg_0_128D)[1])/(nb_rb*nre) + (((int*)&avg_0_128D)[1])/(nb_rb*nre) +
...@@ -3332,17 +3337,19 @@ void dlsch_channel_level_TM34(int **dl_ch_estimates_ext, ...@@ -3332,17 +3337,19 @@ void dlsch_channel_level_TM34(int **dl_ch_estimates_ext,
(((int*)&avg_1_128D)[1])/(nb_rb*nre) + (((int*)&avg_1_128D)[1])/(nb_rb*nre) +
(((int*)&avg_1_128D)[2])/(nb_rb*nre) + (((int*)&avg_1_128D)[2])/(nb_rb*nre) +
(((int*)&avg_1_128D)[3])/(nb_rb*nre); (((int*)&avg_1_128D)[3])/(nb_rb*nre);
// printf("From Chan_level aver stream 1 %d =%d\n", aarx, avg_1[aarx]); // printf("From Chan_level aver stream 1 %d =%d\n", aarx, avg_1[aarx]);
} }
//avg_0[0] = max(avg_0[0],avg_0[1]); //avg_0[0] = max(avg_0[0],avg_0[1]);
//avg_1[0] = max(avg_1[0],avg_1[1]); //avg_1[0] = max(avg_1[0],avg_1[1]);
//avg_0[0]= max(avg_0[0], avg_1[0]); //avg_0[0]= max(avg_0[0], avg_1[0]);
avg_0[0] = avg_0[0] + avg_0[1]; avg_0[0] = avg_0[0] + avg_0[1];
// printf("From Chan_level aver stream 0 final =%d\n", avg_0[0]);
avg_1[0] = avg_1[0] + avg_1[1]; avg_1[0] = avg_1[0] + avg_1[1];
avg_0[0] = max (avg_0[0], avg_1[0]); // printf("From Chan_level aver stream 1 final =%d\n", avg_1[0]);
avg_1[0] = avg_0[0]; avg_0[0] = min (avg_0[0], avg_1[0]);
avg_1[0] = avg_0[0];
_mm_empty(); _mm_empty();
_m_empty(); _m_empty();
...@@ -4735,6 +4742,10 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per ...@@ -4735,6 +4742,10 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho2_ext[0],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho2_ext[0],12*N_RB_DL*nsymb,1,1);
// sprintf(fname,"dlsch%d_r%d_aver_chan_1.m",eNB_id,round);
// sprintf(vname,"dl_aver_ch1_r%d_%d",eNB_id,round);
// write_output(fname,vname,&avg_1[0],1,1,1);
sprintf(fname,"dlsch%d_rxF_r%d_comp0.m",eNB_id,round); sprintf(fname,"dlsch%d_rxF_r%d_comp0.m",eNB_id,round);
sprintf(vname,"dl%d_rxF_r%d_comp0",eNB_id,round); sprintf(vname,"dl%d_rxF_r%d_comp0",eNB_id,round);
write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb,1,1); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb,1,1);
......
...@@ -672,7 +672,7 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -672,7 +672,7 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
// printf("dlsch_qpsk_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust); // printf("dlsch_qpsk_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust);
//printf("ll32p=%p , dlsch_llr=%p, symbol=%d, flag=%d \n", llr32, dlsch_llr, symbol, first_symbol_flag);
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("llr %d : (%d,%d)\n",i,((int16_t*)llr32)[0],((int16_t*)llr32)[1]);
...@@ -686,13 +686,14 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -686,13 +686,14 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
} }
int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp, int32_t **rxdataF_comp,
mod_sym_t **sic_buffer, mod_sym_t **sic_buffer, //Q15
int **rho_i, int32_t **rho_i,
short *dlsch_llr, short *dlsch_llr,
uint8_t num_pdcch_symbols, uint8_t num_pdcch_symbols,
uint16_t nb_rb, uint16_t nb_rb,
uint16_t pbch_pss_sss_adjust, uint8_t subframe,
uint32_t rb_alloc,
LTE_UE_DLSCH_t *dlsch0) LTE_UE_DLSCH_t *dlsch0)
{ {
...@@ -706,12 +707,13 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -706,12 +707,13 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
//uint8_t pilots; //uint8_t pilots;
int len_acc=0; int len_acc=0;
uint16_t *sic_data; uint16_t *sic_data;
uint16_t pbch_pss_sss_adjust;
nsymb = (frame_parms->Ncp==0) ? 14:12; nsymb = (frame_parms->Ncp==0) ? 14:12;
for (symbol=num_pdcch_symbols; symbol<nsymb; symbol++) { for (symbol=num_pdcch_symbols; symbol<nsymb; symbol++) {
uint16_t *rxF = (uint16_t*)&rxdataF_comp[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]; uint16_t *rxF = (uint16_t*)(&rxdataF_comp[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]);
int16_t *rho_1=(int16_t*)&rho_i[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]; int16_t *rho_1=(int16_t*)(&rho_i[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]);
sic_data = (uint16_t*)&sic_buffer[0][((int16_t)len_acc)]; sic_data = (uint16_t*)&sic_buffer[0][((int16_t)len_acc)];
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;
...@@ -720,6 +722,8 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -720,6 +722,8 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
amp_tmp=dlsch0->sqrt_rho_b; amp_tmp=dlsch0->sqrt_rho_b;
else //pilots=0 else //pilots=0
amp_tmp=dlsch0->sqrt_rho_a; amp_tmp=dlsch0->sqrt_rho_a;
pbch_pss_sss_adjust=adjust_G2(frame_parms,rb_alloc,2,subframe,symbol);
// printf("amp_tmp=%d\n", amp_tmp); // printf("amp_tmp=%d\n", amp_tmp);
...@@ -731,44 +735,61 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -731,44 +735,61 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
} else { } else {
len = (nb_rb*12) - pbch_pss_sss_adjust; len = (nb_rb*12) - pbch_pss_sss_adjust;
} }
// printf("dlsch_qpsk_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust);
len_acc+=len; //accumulated length; this is done because in sic_buffer we have only data symbols len_acc+=len; //accumulated length; this is done because in sic_buffer we have only data symbols
multadd_complex_vector_real_scalar((int16_t *)sic_data, multadd_complex_vector_real_scalar((int16_t *)sic_data,
amp_tmp, amp_tmp,
(int16_t *)rho_amp_x0, (int16_t *)rho_amp_x0, //this is in Q13
1, 1,
len); len);
// printf ("Got x0*rho_a\n"); // printf ("Got x0*rho_a\n");
mult_cpx_vector((int16_t *)rho_amp_x0, mult_cpx_vector((int16_t *)rho_1, //Q15
(int16_t *)rho_1, (int16_t *)rho_amp_x0, //Q13
(int16_t*)rho_rho_amp_x0, (int16_t*)rho_rho_amp_x0,
len, len,
15); 13);
/* write_output("rho_for_multipl.m","rho_for_multipl", rho_1,len,1,
// write_output("rho_rho.m","rho2", rho_rho_amp_x0,len,1,1); symbol==num_pdcch_symbols ? 15 :
// printf ("Computed rho*rho_a*x0\n"); symbol==nsymb-1 ? 14 : 13);
write_output("rho_rho_in_llr.m","rho2", rho_rho_amp_x0,len,1,
symbol==num_pdcch_symbols ? 15 :
symbol==nsymb-1 ? 14 : 13);
// printf ("Computed rho*rho_a*x0\n");*/
//rho_rho_amp_x0_512 = (int16_t)((512*(int16_t *)rho_rho_amp_x0)>>15);
sub_cpx_vector16((int16_t *)rxF, sub_cpx_vector16((int16_t *)rxF,
(int16_t *)rho_rho_amp_x0, (int16_t *)rho_rho_amp_x0,
// (int16_t *)clean_x1, (int16_t *)clean_x1,
(int16_t *)rxF, //(int16_t *)rxF,
len*2); len*2);
// write_output("rxFdata_comp1_after.m","rxF_a", rxF,len,1,1);
// write_output("clean_x1.m","x1", clean_x1,len,1,1); // write_output("clean_x1.m","x1", clean_x1,len,1,1);
// printf ("Interference removed \n"); // printf ("Interference removed \n");
/* write_output("clean_x1.m","x1", clean_x1,len,1,
symbol==num_pdcch_symbols ? 15 :
symbol==nsymb-1 ? 14 : 13);
write_output("rxF_comp1.m","rxF_1_comp", rxF,len,1,
symbol==num_pdcch_symbols ? 15 :
symbol==nsymb-1 ? 14 : 13);*/
// printf("dlsch_qpsk_llr_SIC: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust); // printf("dlsch_qpsk_llr_SIC: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust);
//this is for QPSK only!!! //this is for QPSK only!!!
for (i=0; i<len*2; i++) { for (i=0; i<len*2; i++) {
*llr16 =rxF[i]; *llr16 =clean_x1[i];//(int16_t *)rxF[i]; //clean_x1[i];//(int16_t *)rxF[i];//clean_x1[i]; //(int16_t *)rxF[i];//; //rxF[i];
//printf("llr %d : (%d,%d)\n",i,((int16_t*)llr32)[0],((int16_t*)llr32)[1]); //printf("llr %d : (%d,%d)\n",i,((int16_t*)llr32)[0],((int16_t*)llr32)[1]);
llr16++; llr16++;
} }
...@@ -849,10 +870,13 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -849,10 +870,13 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
else else
*llr32p += (len<<2); *llr32p += (len<<2);
// printf("len=%d\n", len);
len_mod4 = len&3; len_mod4 = len&3;
// printf("len_mod4=%d\n", len_mod4);
len>>=2; // length in quad words (4 REs) len>>=2; // length in quad words (4 REs)
// printf("len>>=2=%d\n", len);
len+=(len_mod4==0 ? 0 : 1); len+=(len_mod4==0 ? 0 : 1);
// printf("len+=%d\n", len);
for (i=0; i<len; i++) { for (i=0; i<len; i++) {
#if defined(__x86_64__) || defined(__i386) #if defined(__x86_64__) || defined(__i386)
...@@ -905,68 +929,73 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -905,68 +929,73 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms, void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp, int32_t **rxdataF_comp,
mod_sym_t **sic_buffer, //Q15
int32_t **rho_i,
int16_t *dlsch_llr, int16_t *dlsch_llr,
uint8_t num_pdcch_symbols,
int32_t **dl_ch_mag, int32_t **dl_ch_mag,
uint8_t symbol,
uint8_t first_symbol_flag,
uint16_t nb_rb, uint16_t nb_rb,
uint16_t pbch_pss_sss_adjust, uint8_t subframe,
int16_t **llr32p) uint32_t rb_alloc,
LTE_UE_DLSCH_t *dlsch0
)
{ {
int16_t rho_amp_x0[2*frame_parms->N_RB_DL*12];
int16_t rho_rho_amp_x0[2*frame_parms->N_RB_DL*12];
int16_t clean_x1[2*frame_parms->N_RB_DL*12];
uint16_t amp_tmp;
uint32_t *llr32=(uint32_t*)dlsch_llr;
int i, len, nsymb;
uint8_t symbol, symbol_mod;
//uint8_t pilots;
int len_acc=0;
uint16_t *sic_data;
uint16_t pbch_pss_sss_adjust;
unsigned char len_mod4=0;
__m128i llr128[2];
__m128i *ch_mag;
nsymb = (frame_parms->Ncp==0) ? 14:12;
#if defined(__x86_64__) || defined(__i386__) for (symbol=num_pdcch_symbols; symbol<nsymb; symbol++) {
__m128i *rxF = (__m128i*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; uint16_t *rxF = (uint16_t*)(&rxdataF_comp[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]);
__m128i *ch_mag; int16_t *rho_1=(int16_t*)(&rho_i[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]);
__m128i llr128[2]; ch_mag = (__m128i*)(&dl_ch_mag[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]);
uint32_t *llr32; sic_data = (uint16_t*)(&sic_buffer[0][((int16_t)len_acc)]);
#elif defined(__arm__)
int16x8_t *rxF = (int16x8_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
int16x8_t *ch_mag;
int16x8_t xmm0;
int16_t *llr16;
#endif
int i,len;
unsigned char symbol_mod,len_mod4=0;
#if defined(__x86_64__) || defined(__i386__)
if (first_symbol_flag==1) {