Commit 459913de authored by lukashov's avatar lukashov

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,
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 (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]->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 j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
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]->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)
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]);
}
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;
else
pmiq = PMI_2A_R1_1j;
......
......@@ -299,7 +299,7 @@ int dlsch_encoding(unsigned char *a,
printf("\n");
*/
// 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[A>>3] = ((uint8_t*)&crc)[2];
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
......@@ -310,15 +310,15 @@ int dlsch_encoding(unsigned char *a,
// dlsch->harq_processes[harq_pid]->b = a;
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4);
if (lte_segmentation(dlsch->harq_processes[harq_pid]->b,
dlsch->harq_processes[harq_pid]->c,
dlsch->harq_processes[harq_pid]->B,
&dlsch->harq_processes[harq_pid]->C,
&dlsch->harq_processes[harq_pid]->Cplus,
&dlsch->harq_processes[harq_pid]->Cminus,
&dlsch->harq_processes[harq_pid]->Kplus,
&dlsch->harq_processes[harq_pid]->Kminus,
&dlsch->harq_processes[harq_pid]->F)<0)
if (lte_segmentation(dlsch->harq_processes[harq_pid]->b, // bits after CRC attachement
dlsch->harq_processes[harq_pid]->c, // output from segmentation
dlsch->harq_processes[harq_pid]->B, //size of B=L+A
&dlsch->harq_processes[harq_pid]->C, //number of codeblocks
&dlsch->harq_processes[harq_pid]->Cplus, //Number of segments of size K+
&dlsch->harq_processes[harq_pid]->Cminus,//Number of segments of size K_
&dlsch->harq_processes[harq_pid]->Kplus, //First segmentation size
&dlsch->harq_processes[harq_pid]->Kminus, //Second segmentation size
&dlsch->harq_processes[harq_pid]->F)<0) //Number of filler bits
return(-1);
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
......@@ -399,7 +399,7 @@ int dlsch_encoding(unsigned char *a,
r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r],
G, //G
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->Nsoft, // Nsoft,
dlsch->Mdlharq,
......
......@@ -58,8 +58,8 @@
//#define DEBUG_DLSCH_DEMOD 1
int avg[4];
int avg_0[4];
int avg_1[4];
int avg_0[2];
int avg_1[2];
// [MCS][i_mod (0,1,2) = (2,4,6)]
unsigned char offset_mumimo_llr_drange_fix=0;
......@@ -329,9 +329,8 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++)
avgs = cmax(avgs,avg[(aatx<<1)+aarx]);
// 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,
lte_ue_pdsch_vars[eNB_id]->log2_maxh,
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);
}
} */
if ((rx_type==rx_IC_single_stream) &&
(eNB_id_i<phy_vars_ue->n_connected_eNB)) {
......@@ -413,6 +412,10 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
symbol,
nb_rb,
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) {
......@@ -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);
}
}
dlsch_channel_compensation_TM34(frame_parms,
lte_ue_pdsch_vars[eNB_id],
phy_measurements,
......@@ -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_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_mag0 = lte_ue_pdsch_vars->dl_ch_mag0;
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,
} }
// if (rho) {
rho128_0 = (__m128i *) &dl_ch_rho_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_0 = (__m128i *) &dl_ch_rho2_ext[0][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++) {
// print_shorts("mrc rho0:",&rho128_0[i]);
// print_shorts("mrc rho1:",&rho128_1[i]);
......@@ -3001,8 +3004,8 @@ void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms,
if (dual_stream_UE == 1) {
rho128_i0 = (__m128i *) &dl_ch_rho2_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_i0 = (__m128i *) &dl_ch_rho_ext[0][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_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];
......@@ -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));
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
......@@ -3147,7 +3151,7 @@ void dlsch_channel_level(int **dl_ch_estimates_ext,
((int*)&avg128D)[2] +
((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();
......@@ -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);
// 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_0_128D = _mm_add_epi32(avg_0_128D,_mm_madd_epi16(dl_ch0_128_tmp,dl_ch0_128_tmp));
dl_ch0_128+=3;
dl_ch1_128+=3;
}
}
avg_0[aarx] = (((int*)&avg_0_128D)[0])/(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,
(((int*)&avg_1_128D)[1])/(nb_rb*nre) +
(((int*)&avg_1_128D)[2])/(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_1[0] = max(avg_1[0],avg_1[1]);
//avg_0[0]= max(avg_0[0], avg_1[0]);
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_0[0] = max (avg_0[0], avg_1[0]);
avg_1[0] = avg_0[0];
// printf("From Chan_level aver stream 1 final =%d\n", avg_1[0]);
avg_0[0] = min (avg_0[0], avg_1[0]);
avg_1[0] = avg_0[0];
_mm_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
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(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);
......
......@@ -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("ll32p=%p , dlsch_llr=%p, symbol=%d, flag=%d \n", llr32, dlsch_llr, symbol, first_symbol_flag);
for (i=0; i<len; i++) {
*llr32 = *rxF;
// 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,
}
int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp,
mod_sym_t **sic_buffer,
int **rho_i,
int32_t **rxdataF_comp,
mod_sym_t **sic_buffer, //Q15
int32_t **rho_i,
short *dlsch_llr,
uint8_t num_pdcch_symbols,
uint16_t nb_rb,
uint16_t pbch_pss_sss_adjust,
uint8_t subframe,
uint32_t rb_alloc,
LTE_UE_DLSCH_t *dlsch0)
{
......@@ -706,12 +707,13 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
//uint8_t pilots;
int len_acc=0;
uint16_t *sic_data;
uint16_t pbch_pss_sss_adjust;
nsymb = (frame_parms->Ncp==0) ? 14:12;
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)];
int16_t *rho_1=(int16_t*)&rho_i[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)]);
sic_data = (uint16_t*)&sic_buffer[0][((int16_t)len_acc)];
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,
amp_tmp=dlsch0->sqrt_rho_b;
else //pilots=0
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);
......@@ -731,44 +735,61 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
} else {
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
multadd_complex_vector_real_scalar((int16_t *)sic_data,
amp_tmp,
(int16_t *)rho_amp_x0,
(int16_t *)rho_amp_x0, //this is in Q13
1,
len);
// printf ("Got x0*rho_a\n");
mult_cpx_vector((int16_t *)rho_amp_x0,
(int16_t *)rho_1,
mult_cpx_vector((int16_t *)rho_1, //Q15
(int16_t *)rho_amp_x0, //Q13
(int16_t*)rho_rho_amp_x0,
len,
15);
// write_output("rho_rho.m","rho2", rho_rho_amp_x0,len,1,1);
// printf ("Computed rho*rho_a*x0\n");
13);
/* write_output("rho_for_multipl.m","rho_for_multipl", rho_1,len,1,
symbol==num_pdcch_symbols ? 15 :
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,
(int16_t *)rho_rho_amp_x0,
// (int16_t *)clean_x1,
(int16_t *)rxF,
(int16_t *)clean_x1,
//(int16_t *)rxF,
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);
// 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);
//this is for QPSK only!!!
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]);
llr16++;
}
......@@ -849,10 +870,13 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
else
*llr32p += (len<<2);
// printf("len=%d\n", len);
len_mod4 = len&3;
// printf("len_mod4=%d\n", len_mod4);
len>>=2; // length in quad words (4 REs)
// printf("len>>=2=%d\n", len);
len+=(len_mod4==0 ? 0 : 1);
// printf("len+=%d\n", len);
for (i=0; i<len; i++) {
#if defined(__x86_64__) || defined(__i386)
......@@ -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,
int32_t **rxdataF_comp,
mod_sym_t **sic_buffer, //Q15
int32_t **rho_i,
int16_t *dlsch_llr,
uint8_t num_pdcch_symbols,
int32_t **dl_ch_mag,
uint8_t symbol,
uint8_t first_symbol_flag,
uint16_t nb_rb,
uint16_t pbch_pss_sss_adjust,
int16_t **llr32p)
uint8_t subframe,
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__)
__m128i *rxF = (__m128i*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
__m128i *ch_mag;
__m128i llr128[2];
uint32_t *llr32;
#elif defined(__arm__)
int16x8_t *rxF = (int16x8_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
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) {
llr32 = (uint32_t*)dlsch_llr;
} else {
llr32 = (uint32_t*)*llr32p;
}
#elif defined(__arm__)
if (first_symbol_flag==1) {
llr16 = (int16_t*)dlsch_llr;
} else {
llr16 = (int16_t*)*llr32p;
}
#endif
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
#if defined(__x86_64__) || defined(__i386__)
ch_mag = (__m128i*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)];
#elif defined(__arm__)
ch_mag = (int16x8_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)];
#endif
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
if (frame_parms->mode1_flag==0)
len = nb_rb*8 - (2*pbch_pss_sss_adjust/3);
else
len = nb_rb*10 - (5*pbch_pss_sss_adjust/6);
} else {
len = nb_rb*12 - pbch_pss_sss_adjust;
}
// update output pointer according to number of REs in this symbol (<<2 because 4 bits per RE)
if (first_symbol_flag == 1)
*llr32p = dlsch_llr + (len<<2);
else
*llr32p += (len<<2);
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)]);
int16_t *rho_1=(int16_t*)(&rho_i[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]);
ch_mag = (__m128i*)(&dl_ch_mag[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]);
sic_data = (uint16_t*)(&sic_buffer[0][((int16_t)len_acc)]);
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
pbch_pss_sss_adjust=adjust_G2(frame_parms,rb_alloc,4,subframe,symbol);
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
amp_tmp=dlsch0->sqrt_rho_b;
if (frame_parms->mode1_flag==0)
len = nb_rb*8 - (2*pbch_pss_sss_adjust/3);
else
len = nb_rb*10 - (5*pbch_pss_sss_adjust/6);
} else {
amp_tmp=dlsch0->sqrt_rho_a;
len = nb_rb*12 - pbch_pss_sss_adjust;
}
len_acc+=len;
multadd_complex_vector_real_scalar((int16_t *)sic_data,
amp_tmp,
(int16_t *)rho_amp_x0, //this is in Q13
1,
len);
mult_cpx_vector((int16_t *)rho_1, //Q15
(int16_t *)rho_amp_x0, //Q13
(int16_t*)rho_rho_amp_x0,
len,
13);
sub_cpx_vector16((int16_t *)rxF,
(int16_t *)rho_rho_amp_x0,
(int16_t *)clean_x1,
// (int16_t *)rxF,
len*2);
len_mod4 = len&3;
len>>=2; // length in quad words (4 REs)
len+=(len_mod4==0 ? 0 : 1);
......@@ -974,12 +1003,13 @@ void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
for (i=0; i<len; i++) {
#if defined(__x86_64__) || defined(__i386)
xmm0 = _mm_abs_epi16(rxF[i]);
__m128i *x1 = (__m128i*)&clean_x1;
xmm0 = _mm_abs_epi16(x1[i]);
xmm0 = _mm_subs_epi16(ch_mag[i],xmm0);
// lambda_1=y_R, lambda_2=|y_R|-|h|^2, lamda_3=y_I, lambda_4=|y_I|-|h|^2
llr128[0] = _mm_unpacklo_epi32(rxF[i],xmm0);
llr128[1] = _mm_unpackhi_epi32(rxF[i],xmm0);
llr128[0] = _mm_unpacklo_epi32(x1[i],xmm0);
llr128[1] = _mm_unpackhi_epi32(x1[i],xmm0);
llr32[0] = _mm_extract_epi32(llr128[0],0); //((uint32_t *)&llr128[0])[0];
llr32[1] = _mm_extract_epi32(llr128[0],1); //((uint32_t *)&llr128[0])[1];
llr32[2] = _mm_extract_epi32(llr128[0],2); //((uint32_t *)&llr128[0])[2];
......@@ -1020,6 +1050,7 @@ void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
_m_empty();
#endif
}
}
//----------------------------------------------------------------------------------------------
// 64-QAM
......@@ -1388,6 +1419,7 @@ int dlsch_qpsk_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
len = (nb_rb*12) - pbch_pss_sss_adjust;
}
// printf("dlsch_qpsk_qpsk_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust);
// printf("qpsk_qpsk: len %d, llr16 %p\n",len,llr16);
qpsk_qpsk((short *)rxF,
(short *)rxF_i,
......
......@@ -803,7 +803,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
if (frame_parms->nb_antennas_tx == 2) {
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
if (frame_parms->nb_antennas_tx == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15);
......@@ -1643,6 +1645,7 @@ int dlsch_modulation_SIC(mod_sym_t **sic_buffer,
amp=1; //we do full scale here for SIC
gain_lin_QPSK = (int16_t)((ONE_OVER_SQRT2_Q15));
// printf("gain=%d\n", gain_lin_QPSK);
jj = 0;
i = 0;
......@@ -1663,7 +1666,7 @@ int dlsch_modulation_SIC(mod_sym_t **sic_buffer,
jj = jj + 1;
// printf("%d,%d\n",((int16_t*)&sic_buffer[0][i])[0],((int16_t*)&sic_buffer[0][i])[1]);
// printf("recon %d,%d\n",((int16_t*)&sic_buffer[0][i])[0],((int16_t*)&sic_buffer[0][i])[1]);
i++;
......
......@@ -725,7 +725,8 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
short *dlsch_llr,
uint8_t num_pdcch_symbols,
uint16_t nb_rb,
uint16_t pbch_pss_sss_adjust,
uint8_t subframe,
uint32_t rb_alloc,
LTE_UE_DLSCH_t *dlsch0);
void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
......@@ -749,15 +750,17 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
@param nb_rb number of RBs for this allocation
@param pbch_pss_sss_adjust PBCH/PSS/SSS RE adjustment (in REs)
*/
void dlsch_16qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
int16_t *dlsch_llr,
int32_t **dl_ch_mag,
uint8_t symbol,
uint8_t first_symbol_flag,
uint16_t nb_rb,
uint16_t pbch_pss_sss_adjust,
int16_t **llr128p);
void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
mod_sym_t **sic_buffer, //Q15
int32_t **rho_i,
int16_t *dlsch_llr,
uint8_t num_pdcch_symbols,
int32_t **dl_ch_mag,
uint16_t nb_rb,
uint8_t subframe,
uint32_t rb_alloc,
LTE_UE_DLSCH_t *dlsch0);
void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
......
......@@ -189,7 +189,9 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l);
#endif
start_meas(&phy_vars_ue->dlsch_channel_estimation_stats);
lte_dl_channel_estimation(phy_vars_ue,eNB_id,0,
lte_dl_channel_estimation(phy_vars_ue,
eNB_id,
0,
Ns,
aa,
l,
......@@ -197,7 +199,9 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
stop_meas(&phy_vars_ue->dlsch_channel_estimation_stats);
for (i=0; i<phy_vars_ue->PHY_measurements.n_adj_cells; i++) {
lte_dl_channel_estimation(phy_vars_ue,eNB_id,i+1,
lte_dl_channel_estimation(phy_vars_ue,
eNB_id,
i+1,
Ns,
aa,
l,
......
......@@ -66,10 +66,10 @@ void multadd_complex_vector_real_scalar(int16_t *x,
if (zero_flag == 1)
for (n=0; n<N>>2; n++) {
//print_shorts("x_128[n]=", &x_128[n]);
//print_shorts("alpha_128", &alpha_128);
// print_shorts("x_128[n]=", &x_128[n]);
// print_shorts("alpha_128", &alpha_128);
y_128[n] = mulhi_int16(x_128[n],alpha_128);
//print_shorts("y_128[n]=", &y_128[n]); //Q2.13
// print_shorts("y_128[n]=", &y_128[n]);
}
else
......
......@@ -137,8 +137,8 @@ int mult_cpx_conj_vector(int16_t *x1,
}
int mult_cpx_vector(int16_t *x1,
int16_t *x2,
int mult_cpx_vector(int16_t *x1, //Q15
int16_t *x2,//Q13
int16_t *y,
uint32_t N,
int output_shift)
......@@ -174,26 +174,26 @@ int mult_cpx_vector(int16_t *x1,
//right shift by 13 while p_a * x0 and 15 while
// we compute 4 cpx multiply for each loop
for(i=0; i<(N>>2); i++) {
tmp_re = _mm_sign_epi16(*x1_128,*(__m128i*)&conjug2[0]);
tmp_re = _mm_sign_epi16(*x1_128,*(__m128i*)&conjug2[0]);// Q15
//print_shorts("tmp_re1:",&tmp_re[i]);
tmp_re = _mm_madd_epi16(tmp_re,*x2_128);
tmp_re = _mm_madd_epi16(tmp_re,*x2_128); //Q28
//print_ints("tmp_re2:",&tmp_re[i]);
tmp_im = _mm_shufflelo_epi16(*x1_128,_MM_SHUFFLE(2,3,0,1));
tmp_im = _mm_shufflelo_epi16(*x1_128,_MM_SHUFFLE(2,3,0,1)); //Q15
//print_shorts("tmp_im1:",&tmp_im[i]);
tmp_im = _mm_shufflehi_epi16(tmp_im,_MM_SHUFFLE(2,3,0,1));
tmp_im = _mm_shufflehi_epi16(tmp_im,_MM_SHUFFLE(2,3,0,1)); //Q15
//print_shorts("tmp_im2:",&tmp_im[i]);
tmp_im = _mm_madd_epi16(tmp_im, *x2_128);
tmp_im = _mm_madd_epi16(tmp_im, *x2_128); //Q28
//print_ints("tmp_im3:",&tmp_im[i]);
tmp_re = _mm_srai_epi32(tmp_re,output_shift);
tmp_re = _mm_srai_epi32(tmp_re,output_shift);//Q(28-shift)
//print_ints("tmp_re shifted:",&tmp_re[i]);
tmp_im = _mm_srai_epi32(tmp_im,output_shift);
tmp_im = _mm_srai_epi32(tmp_im,output_shift); //Q(28-shift)
//print_ints("tmp_im shifted:",&tmp_im[i]);
tmpy0 = _mm_unpacklo_epi32(tmp_re,tmp_im);
tmpy0 = _mm_unpacklo_epi32(tmp_re,tmp_im); //Q(28-shift)
//print_ints("unpack lo :",&tmpy0[i]);
tmpy1 = _mm_unpackhi_epi32(tmp_re,tmp_im);
tmpy1 = _mm_unpackhi_epi32(tmp_re,tmp_im); //Q(28-shift)
//print_ints("mrc rho0:",&tmpy1[i]);
*y_128 = _mm_packs_epi32(tmpy0,tmpy1);
*y_128 = _mm_packs_epi32(tmpy0,tmpy1); //must be Q15
//print_shorts("*y_128:",&y_128[i]);
x1_128++;
......
......@@ -43,9 +43,9 @@ int write_output(const char *fname,const char *vname,void *data,int length,int d
printf("Writing %d elements of type %d to %s\n",length,format,fname);
if (format == 10 || format ==11 || format == 12 ) {
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) {
fp = fopen(fname,"a+");
} else if (format != 10 && format !=11 && format != 12 ) {
} else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) {
fp = fopen(fname,"w+");
}
......@@ -56,7 +56,7 @@ int write_output(const char *fname,const char *vname,void *data,int length,int d
return(-1);
}
if (format != 10 && format !=11 && format != 12 )
if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14)
fprintf(fp,"%s = [",vname);
......@@ -70,7 +70,9 @@ int write_output(const char *fname,const char *vname,void *data,int length,int d
break;
case 1: // complex 16-bit
case 13:
case 14:
case 15:
for (i=0; i<length<<1; i+=(2*dec)) {
fprintf(fp,"%d + j*(%d)\n",((short *)data)[i],((short *)data)[i+1]);
......@@ -172,14 +174,13 @@ int write_output(const char *fname,const char *vname,void *data,int length,int d
fprintf(fp,"%d \n",((unsigned char *)&data)[0]);
break;
}
if (format != 10 && format !=11 && format !=12 ) {
if (format != 10 && format !=11 && format !=12 && format != 13 && format != 15) {
fprintf(fp,"];\n");
fclose(fp);
return(0);
} else if (format == 10 || format ==11 || format == 12 ) {
} else if (format == 10 || format ==11 || format == 12 || format == 13 || format == 15) {
fclose(fp);
return(0);
}
......
......@@ -523,7 +523,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
int16_t *pbch_comp;
float Re,Im,ymax=1;
int num_pdcch_symbols=3;
float *llr, *bit, *chest_f_abs, llr_pbch[1920], bit_pbch[1920], *llr_pdcch, *bit_pdcch;
float *llr0, *bit0, *llr1, *bit1, *chest_f_abs, llr_pbch[1920], bit_pbch[1920], *llr_pdcch, *bit_pdcch;
float *I, *Q;
float rxsig_t_dB[nb_antennas_rx][FRAME_LENGTH_COMPLEX_SAMPLES];
float **chest_t_abs;
......@@ -602,8 +602,10 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
chest_t_abs[arx] = (float*) calloc(frame_parms->ofdm_symbol_size,sizeof(float));
}
chest_f_abs = (float*) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float));
llr = (float*) calloc(coded_bits_per_codeword0,sizeof(float)); // init to zero
bit = malloc(coded_bits_per_codeword0*sizeof(float));
llr0 = (float*) calloc(coded_bits_per_codeword0,sizeof(float)); // init to zero
bit0 = malloc(coded_bits_per_codeword0*sizeof(float));
llr1 = (float*) calloc(coded_bits_per_codeword1,sizeof(float)); // init to zero
bit1 = malloc(coded_bits_per_codeword1*sizeof(float));
llr_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); // init to zero
bit_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float));
......@@ -769,12 +771,12 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
// PDSCH LLRs CW0
if (pdsch_llr != NULL) {
for (i=0; i<coded_bits_per_codeword0; i++) {
llr[i] = (float) pdsch_llr[i];
bit[i] = (float) i;
llr0[i] = (float) pdsch_llr[i];
bit0[i] = (float) i;
}
fl_set_xyplot_xbounds(form->pdsch_llr,0,coded_bits_per_codeword0);
fl_set_xyplot_data(form->pdsch_llr,bit,llr,coded_bits_per_codeword0,"","","");
fl_set_xyplot_data(form->pdsch_llr,bit0,llr0,coded_bits_per_codeword0,"","","");
}
......@@ -838,12 +840,12 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
// PDSCH LLRs CW1
if (pdsch_llr1 != NULL) {
for (i=0; i<coded_bits_per_codeword1; i++) {
llr[i] = (float) pdsch_llr1[i];
bit[i] = (float) i;
llr1[i] = (float) pdsch_llr1[i];
bit1[i] = (float) i;
}
fl_set_xyplot_xbounds(form->pdsch_llr1,0,coded_bits_per_codeword1);
fl_set_xyplot_data(form->pdsch_llr1,bit,llr,coded_bits_per_codeword1,"","","");
fl_set_xyplot_data(form->pdsch_llr1,bit1,llr1,coded_bits_per_codeword1,"","","");
}
// PDSCH I/Q of MF Output
......@@ -926,8 +928,10 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
free(I);
free(Q);
free(chest_f_abs);
free(llr);
free(bit);
free(llr0);
free(bit0);
free(llr1);
free(bit1);
free(bit_pdcch);
free(llr_pdcch);
for (arx=0;arx<nb_antennas_rx;arx++) {
......
......@@ -2120,7 +2120,9 @@ n(tikz_fname,"w");
// printf("Trial %d\n",trials);
fflush(stdout);
round=0;
for (i=0; i<frame_parms->nb_antennas_tx; i++) {
memset(sic_buffer[i], 0, FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
}
//if (trials%100==0)
eNB2UE[0]->first_run = 1;
......@@ -2774,6 +2776,9 @@ n(tikz_fname,"w");
&PHY_vars_eNB->dlsch_interleaving_stats
)<0)
exit(-1);
/*
if (transmission_mode == 3) {
if (dlsch_encoding(input_buffer1[k],
......@@ -3465,7 +3470,7 @@ n(tikz_fname,"w");
0,subframe);
PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_non_sic]->current_harq_pid]->G = coded_bits_per_codeword;
PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_non_sic]->current_harq_pid]->Qm = get_Qm(PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->mcs);
if (n_frames==1) {
if (n_frames==2) {
printf("Kmimo=%d, cw=%d, G=%d, TBS=%d\n",Kmimo,cw_non_sic,coded_bits_per_codeword,
PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_non_sic]->current_harq_pid]->TBS);
......@@ -3476,9 +3481,10 @@ n(tikz_fname,"w");
sprintf(vname,"dl%d_r%d_cw%d_llr",eNB_id,round, cw_non_sic);
write_output(fname,vname, PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[cw_non_sic],coded_bits_per_codeword,1,0);
sprintf(fname,"dlsch_cw%d_e.m", cw_non_sic);
sprintf(vname,"dlsch_cw%d_e", cw_non_sic);
sprintf(vname,"dlschcw%d_e", cw_non_sic);
write_output(fname, vname,PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->e,coded_bits_per_codeword,1,4);
uncoded_ber=0;
printf("trials=%d\n", trials);
for (i=0;i<coded_bits_per_codeword;i++)
if (PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->e[i] != (PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[cw_non_sic][i]<0)) {
uncoded_ber_bit[i] = 1;
......@@ -3529,7 +3535,7 @@ n(tikz_fname,"w");
iter_trials[0]++;
}
if (n_frames==1) {
if (n_frames==2) {
printf("cw non sic %d, round %d: No DLSCH errors found, uncoded ber %f\n",cw_non_sic,round,uncoded_ber);
#ifdef PRINT_BYTES
for (s=0;s<PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[0]->C;s++) {
......@@ -3651,6 +3657,7 @@ n(tikz_fname,"w");
if ((PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) &&
(PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->mimo_mode <=DUALSTREAM_PUSCH_PRECODING) &&
rx_type==rx_SIC_dual_stream) {
remove("rho_rho_in_llr.m");
// for (round = 0 ; round < 1 ; round++) {
dlsch0_ue_harq = PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid];
......@@ -3670,7 +3677,7 @@ n(tikz_fname,"w");
PHY_vars_UE->dlsch_eNB[eNB_id]->active = PHY_vars_UE->dlsch_ue[eNB_id][0]->active;
PHY_vars_UE->dlsch_eNB[eNB_id]->rnti = PHY_vars_UE->dlsch_ue[eNB_id][0]->rnti;
PHY_vars_UE->dlsch_eNB[eNB_id]->current_harq_pid = PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid;
dlsch_encoding(PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->b,
dlsch_encoding(input_buffer0[0], //PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->b,
&PHY_vars_UE->lte_frame_parms,
num_pdcch_symbols,
PHY_vars_UE->dlsch_eNB[eNB_id],
......@@ -3710,16 +3717,33 @@ n(tikz_fname,"w");
// write_output("rxdataF_comp1.m","rxF_comp1", *PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],14*12*25,1,1);
// write_output("rxdataF_rho.m","rho", *PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],14*12*25,1,1);
dlsch_qpsk_llr_SIC(&PHY_vars_UE->lte_frame_parms,
switch (get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)){
case 2:
dlsch_qpsk_llr_SIC(&PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],
sic_buffer,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[1],
num_pdcch_symbols,
dlsch0_eNB_harq->nb_rb,
adjust_G2(&PHY_vars_UE->lte_frame_parms,&dlsch0_eNB_harq->rb_alloc[0],2,subframe,num_pdcch_symbols),
subframe,
dlsch0_eNB_harq->rb_alloc[0],
PHY_vars_UE->dlsch_ue[eNB_id][0]);
break;
case 4:
dlsch_16qam_llr_SIC(&PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],
sic_buffer,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[1],
num_pdcch_symbols,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_mag1,
dlsch0_eNB_harq->nb_rb,
subframe,
dlsch0_eNB_harq->rb_alloc[0],
PHY_vars_UE->dlsch_ue[eNB_id][0]);
break;
}
// }// round
// write_output("rxdata_llr1.m","llr1", PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[1],re_allocated*2,1,0);
......@@ -3738,10 +3762,10 @@ n(tikz_fname,"w");
PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_sic]->current_harq_pid]->G = coded_bits_per_codeword;
PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_sic]->current_harq_pid]->Qm = get_Qm(PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->mcs);
if (n_frames==1) {
if (n_frames==2) {
printf("Kmimo=%d, cw=%d, G=%d, TBS=%d\n",Kmimo,cw_sic,coded_bits_per_codeword,
PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_sic]->current_harq_pid]->TBS);
// calculate uncoded BER
uncoded_ber_bit = (short*) malloc(sizeof(short)*coded_bits_per_codeword);
AssertFatal(uncoded_ber_bit, "uncoded_ber_bit==NULL");
......@@ -3749,9 +3773,10 @@ n(tikz_fname,"w");
sprintf(vname,"dl%d_r%d_cw%d_llr",eNB_id,round, cw_sic);
write_output(fname,vname, PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[cw_sic],coded_bits_per_codeword,1,0);
sprintf(fname,"dlsch_cw%d_e.m", cw_sic);
sprintf(vname,"dlsch_cw%d_e", cw_sic);
sprintf(vname,"dlschcw%d_e", cw_sic);
write_output(fname, vname,PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->e,coded_bits_per_codeword,1,4);
uncoded_ber=0;
printf("trials=%d\n", trials);
for (i=0;i<coded_bits_per_codeword;i++)
if (PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->e[i] != (PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[cw_sic][i]<0)) {
uncoded_ber_bit[i] = 1;
......@@ -3797,7 +3822,7 @@ n(tikz_fname,"w");
iter_trials[1]++;
if (n_frames==1) {
if (n_frames==2) {
printf("cw sic %d, round %d: No DLSCH errors found, uncoded ber %f\n",cw_sic,round,uncoded_ber);
#ifdef PRINT_BYTES
for (s=0;s<PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[0]->C;s++) {
......@@ -3821,13 +3846,14 @@ n(tikz_fname,"w");
else {
errs[cw_sic][round]++;
// exit(0);
if (cw_sic==1) {
avg_iter[1] += ret[1]-1;
iter_trials[1]++;
}
if (n_frames==1) {
if (n_frames==2) {
//if ((n_frames==1) || (SNR>=30)) {
printf("cw sic %d, round %d: DLSCH errors found, uncoded ber %f\n",cw_sic,round,uncoded_ber);
#ifdef PRINT_BYTES
......@@ -3846,6 +3872,7 @@ n(tikz_fname,"w");
}
#endif
} //n_frames==1
// exit(0);
} //if (ret > PHY_vars_UE->dlsch_ue[0][cw_sic]->max_turbo_iterations )
} //for (int cw_1=cw_to_decode_interf_free; cw_1<cw_to_decode_interf_free+1;cw_1++)
......@@ -3872,7 +3899,7 @@ n(tikz_fname,"w");
}
if (n_frames==1) {
if (n_frames==2) {
//if ((n_frames==1) || (SNR>=30)) {
printf("cw %d, round %d: DLSCH errors found, uncoded ber %f\n",cw_non_sic,round,uncoded_ber);
#ifdef PRINT_BYTES
......@@ -3896,7 +3923,7 @@ n(tikz_fname,"w");
stop_meas(&PHY_vars_UE->phy_proc_rx);
if (n_frames==1) {
if (n_frames==2) {
//rxsig
sprintf(fname,"rxsig0_r%d.m",round);
......@@ -4520,7 +4547,7 @@ n(tikz_fname,"w");
}
else {
if ((rx_type==rx_IC_dual_stream) || (rx_type==rx_standard)) {
if ((rx_type==rx_IC_dual_stream) || (rx_type==rx_standard) || (rx_type==rx_SIC_dual_stream)) {
if (((double)errs[0][0]/(round_trials[0]))<1e-3 && ((double)errs[1][0]/(round_trials[0]))<1e-3)
break;
}
......
......@@ -932,7 +932,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
maxDoppler,
channel_offset,
path_loss_dB,
0);
1);
break;
case Rayleigh1_orth_eff_ch_TM4_prec_imag:
......
......@@ -68,8 +68,35 @@ void randominit(unsigned seed_init)
ir[i]= seed; /* initialize the shuffle table */
}
iy=1;
}
iy=1;
}
/*void randominit(unsigned seed_init)
{
int i;
// this need to be integrated with the existing rng, like taus: navid
msg("Initializing random number generator, seed %x\n",seed_init);
seed_init = 62110;
if (seed_init == 0) {
srand((unsigned)time(NULL));
seed = (unsigned int) rand();
} else {
seed = seed_init;
}
if (seed % 2 == 0) seed += 1; /* seed and mod are relative prime */
// for (i=1; i<=97; i++) {
// seed = a*seed; /* mod 2**32 */
// ir[i]= seed; /* initialize the shuffle table */
// }
// iy=1;
//}
/*!\brief Uniform linear congruential random number generator on \f$[0,1)\f$. Returns a double-precision floating-point number.*/
......
......@@ -87,7 +87,44 @@ void set_taus_seed(unsigned int seed_init)
s2 = result;
#endif
}
}
}
/* void set_taus_seed(unsigned int seed_init)
{
#ifdef USER_MODE
struct drand48_data buffer;
unsigned long result = 0;
#endif
s0 = (unsigned int)0x1e23d852;
s1 = (unsigned int)0x81f38a1c;
s2 = (unsigned int)0xfe1a133e;
return;
if (seed_init == 0) {
s0 = (unsigned int)time(NULL);
s1 = (unsigned int)time(NULL);
s2 = (unsigned int)time(NULL);
} else {
#ifndef USER_MODE
s0 = (unsigned int)0x1e23d852;
s1 = (unsigned int)0x81f38a1c;
s2 = (unsigned int)0xfe1a133e;
#else
// Use reentrant version of rand48 to ensure that no conflicts with other generators occur */
// srand48_r((long int)seed_init, &buffer);
// mrand48_r(&buffer, (long int *)&result);
// s0 = result;
// mrand48_r(&buffer, (long int *)&result);
// s1 = result;
// mrand48_r(&buffer, (long int *)&result);
// s2 = result;
//#endif
// }
//}
#ifdef MAIN
......
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