Commit aa69c550 authored by lukashov's avatar lukashov

A bit of clean-up.

parent b8e9e188
......@@ -242,19 +242,17 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
first_re=6;
for (re=first_re; re<last_re; re++) {
// printf("element %d precoder_index for allocation %d\n",re, precoder_index );
if ((skip_dc == 1) && (re==6))
re_off=re_off - frame_parms->ofdm_symbol_size+1;
tti_offset = symbol_offset + re_off + re;
// check that RE is not from Cell-specific RS
//check that RE is not from Cell-specific RS
if (is_not_pilot(pilots,re,frame_parms->nushift,use2ndpilots)==1) {
// printf("re %d (jj %d)\n",re,*jj);
//printf("re %d (jj %d)\n",re,*jj);
if (mimo_mode == SISO) { //SISO mapping
......@@ -263,7 +261,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
switch (mod_order0) {
case 2: //QPSK
// printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
}
......@@ -276,7 +274,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
*jj = *jj + 1;
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break;
case 4: //16QAM
......@@ -308,8 +306,8 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s0[qam16_table_offset_re];
((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s0[qam16_table_offset_im];
// ((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
// ((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
//((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
//((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
}
break;
......@@ -393,7 +391,6 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
case 4: //16QAM
// Antenna 0 position n
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
......@@ -419,6 +416,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
if (x0[*jj] == 1)
qam16_table_offset_re+=2;
*jj=*jj+1;
......@@ -437,8 +435,8 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
break;
case 6: // 64-QAM
// Antenna 0
......@@ -515,20 +513,19 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
if (frame_parms->nb_antennas_tx == 2) {
switch (mod_order0) {
default:
LOG_E(PHY,"Unknown mod_order0 %d\n",mod_order0);
xx0_re=xx0_im=0;
break;
case 2: //QPSK
// printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
xx0_re = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
xx0_im = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break;
case 4: //16QAM
......@@ -582,22 +579,24 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
xx0_re = qam_table_s0[qam64_table_offset_re0];
xx0_im = qam_table_s0[qam64_table_offset_im0];
break;
}
switch (mod_order1) {
default:
LOG_E(PHY,"Unknown mod_order1 %d\n",mod_order1);
xx1_re=xx1_im=0;
break;
case 2: //QPSK
// printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
xx1_re = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj2 = *jj2 + 1;
xx1_im = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj2 = *jj2 + 1;
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break;
case 4: //16QAM
......@@ -649,7 +648,6 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
xx1_re = qam_table_s1[qam64_table_offset_re1];
xx1_im = qam_table_s1[qam64_table_offset_im1];
break;
}
......@@ -679,14 +677,14 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
amp = (int16_t)(((int32_t)tmp_amp*ONE_OVER_SQRT2_Q15)>>15);
switch (mod_order0) {
case 2: //QPSK
case 2:
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
// normalization for 2 tx antennas
//normalization for 2 tx antennas
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15);
......@@ -698,7 +696,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
break;
case 4: //16QAM
case 4:
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
......@@ -733,8 +731,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
break;
case 6: //64QAM
case 6:
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
......@@ -770,14 +767,12 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
}
break;
}
}
else if ((mimo_mode >= DUALSTREAM_UNIFORM_PRECODING1)&&(mimo_mode <= DUALSTREAM_PUSCH_PRECODING)) {
// this is for transmission mode 4 (1 layer)
*re_allocated = *re_allocated + 1;
if (precoder_index==0) {
precoder_index0 = 0; //[1 1]
precoder_index1 = 1; //[1 -1]
......@@ -792,18 +787,18 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
}
switch (mod_order0) {
case 2: //QPSK
case 2:
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
// normalization for 2 tx antennas
//normalization for 2 tx antennas
((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);
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//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);
......@@ -813,7 +808,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
break;
case 4: //16QAM
case 4:
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
......@@ -825,7 +820,6 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
qam16_table_offset_im+=2;
*jj=*jj+1;
if (x0[*jj] == 1)
qam16_table_offset_re+=1;
*jj=*jj+1;
......@@ -846,11 +840,11 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
break;
case 6: //64QAM
case 6:
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
if (x0[*jj] == 1)
qam64_table_offset_re+=4;
*jj=*jj+1;
......@@ -887,14 +881,15 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
if (dlsch1_harq) {
switch (mod_order1) {
case 2: //QPSK
case 2:
((int16_t*)&tmp_sample1)[0] = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj2 = *jj2 + 1;
((int16_t*)&tmp_sample1)[1] = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj2 = *jj2 + 1;
// normalization for 2 tx antennas
//normalization for 2 tx antennas
((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);
......@@ -906,7 +901,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
break;
case 4: //16QAM
case 4:
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
......@@ -939,8 +934,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
break;
case 6: //64QAM
case 6:
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
......@@ -1042,7 +1036,6 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
case 6: //64QAM
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
......@@ -1090,10 +1083,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
return(-1);
}
}
}
return(0);
}
......@@ -1145,14 +1135,14 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
tti_offset = symbol_offset + re_off + re;
// printf("re %d (jj %d)\n",re,*jj);
//printf("re %d (jj %d)\n",re,*jj);
*re_allocated = *re_allocated + 1;
switch (mod_order) {
case 2: //QPSK
case 2:
// printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++)
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
......@@ -1163,10 +1153,10 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
*jj = *jj + 1;
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break;
case 4: //16QAM
case 4:
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
......@@ -1195,14 +1185,13 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s[qam16_table_offset_re];
((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s[qam16_table_offset_im];
// ((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
// ((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
//((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
//((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
}
break;
case 6: //64QAM
case 6:
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
......@@ -1403,7 +1392,7 @@ int dlsch_modulation(int32_t **txdataF,
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb));
//for (aa=0;aa<frame_parms->nb_antennas_tx;aa++)
// memset(&txdataF[aa][symbol_offset],0,frame_parms->ofdm_symbol_size<<2);
//memset(&txdataF[aa][symbol_offset],0,frame_parms->ofdm_symbol_size<<2);
//printf("symbol_offset %d,subframe offset %d : pilots %d\n",symbol_offset,subframe_offset,pilots);
for (rb=0; rb<frame_parms->N_RB_DL; rb++) {
......@@ -1588,7 +1577,6 @@ int dlsch_modulation(int32_t **txdataF,
re_offset+=12; // go to next RB
// check if we crossed the symbol boundary and skip DC
if (re_offset >= frame_parms->ofdm_symbol_size) {
if (skip_dc == 0) //even number of RBs (doesn't straddle DC)
......@@ -1597,11 +1585,8 @@ int dlsch_modulation(int32_t **txdataF,
re_offset=7; // odd number of RBs
}
}
}
#ifdef DEBUG_DLSCH_MODULATION
msg("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset));
#endif
......@@ -1644,7 +1629,7 @@ int dlsch_modulation_SIC(int32_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);
//printf("gain=%d\n", gain_lin_QPSK);
jj = 0;
i = 0;
......@@ -1655,18 +1640,17 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
switch (mod_order0) {
case 2: //QPSK
/* TODO: handle more than 1 antenna */
// printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
((int16_t*)&sic_buffer[0][i])[0] += (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
((int16_t*)&sic_buffer[0][i])[0] = (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
jj = jj + 1;
((int16_t*)&sic_buffer[0][i])[1] += (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
((int16_t*)&sic_buffer[0][i])[1] = (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
jj = jj + 1;
// printf("recon %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++;
break;
......@@ -1705,8 +1689,7 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
break;
case 6: //64QAM
case 6:
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
......@@ -1814,7 +1797,6 @@ int mch_modulation(int32_t **txdataF,
}
if (mod_order == 4)
qam_table_s = qam16_table_a;
else if (mod_order == 6)
......@@ -1822,7 +1804,7 @@ int mch_modulation(int32_t **txdataF,
else
qam_table_s = NULL;
// printf("Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp);
//printf("Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp);
allocate_REs_in_RB_MCH(txdataF,
&jj,
re_offset,
......@@ -1838,7 +1820,6 @@ int mch_modulation(int32_t **txdataF,
re_offset+=12; // go to next RB
// check if we crossed the symbol boundary and skip DC
if (re_offset >= frame_parms->ofdm_symbol_size) {
if (skip_dc == 0) //even number of RBs (doesn't straddle DC)
......@@ -1849,10 +1830,6 @@ int mch_modulation(int32_t **txdataF,
}
}
#ifdef DEBUG_DLSCH_MODULATION
msg("generate_dlsch(MCH) : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->rb_alloc,mod_order,1,2,0,subframe_offset));
#endif
......
......@@ -238,7 +238,7 @@ int main(int argc, char **argv)
int common_flag=0,TPC=0;
double cpu_freq_GHz;
// time_stats_t ts;//,sts,usts;
//time_stats_t ts;//,sts,usts;
int avg_iter[2],iter_trials[2];
int rballocset=0;
int print_perf=0;
......@@ -435,19 +435,15 @@ int main(int argc, char **argv)
case 'B':
channel_model=SCM_B;
break;
case 'C':
channel_model=SCM_C;
break;
case 'D':
channel_model=SCM_D;
break;
case 'E':
channel_model=EPA;
break;
case 'F':
channel_model=EVA;
break;
......@@ -668,7 +664,6 @@ int main(int argc, char **argv)
n_users = 2;
eNB_id_i = PHY_vars_UE->n_connected_eNB;
//eNB_id_i=1;
}
else
eNB_id_i = eNB_id;
......@@ -1035,8 +1030,6 @@ n(tikz_fname,"w");
}
if (input_fd==NULL) {
/*
// common DCI
memcpy(&dci_alloc[num_dci].dci_pdu[0],&CCCH_alloc_pdu,sizeof(DCI1A_5MHz_TDD_1_6_t));
......@@ -1933,7 +1926,6 @@ n(tikz_fname,"w");
}
break;
case 5:
case 6:
memcpy(&dci_alloc[num_dci].dci_pdu[0],&DLSCH_alloc_pdu2_1E[k],sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
......@@ -1979,11 +1971,13 @@ n(tikz_fname,"w");
*/
}
if (n_frames==1) printf("num_pdcch_symbols %d, numCCE %d => ",num_pdcch_symbols,numCCE);
if (n_frames==1)
printf("num_pdcch_symbols %d, numCCE %d => ",num_pdcch_symbols,numCCE);
numCCE = get_nCCE(num_pdcch_symbols,&PHY_vars_eNB->lte_frame_parms,get_mi(&PHY_vars_eNB->lte_frame_parms,subframe));
if (n_frames==1) printf("%d\n",numCCE);
if (n_frames==1)
printf("%d\n",numCCE);
// apply RNTI-based nCCE allocation
memset(CCE_table,0,800*sizeof(int));
......@@ -2062,7 +2056,7 @@ n(tikz_fname,"w");
round_trials[i] = 0;
}
dci_errors=0;
// avg_ber = 0;
//avg_ber = 0;
round=0;
avg_iter[0] = 0;
......@@ -2127,7 +2121,7 @@ n(tikz_fname,"w");
ret[0] = PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations+1;
ret[1] = PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations+1;
while ((round < num_rounds) && (ret[0] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations)) {
// printf("Trial %d, round %d\n",trials,round);
//printf("Trial %d, round %d\n",trials,round);
round_trials[round]++;
if (transmission_mode == 4 || transmission_mode == 5 || transmission_mode == 6)
......@@ -2146,7 +2140,7 @@ n(tikz_fname,"w");
PMI_FEEDBACK:
// printf("Trial %d : Round %d, pmi_feedback %d \n",trials,round,pmi_feedback);
//printf("Trial %d : Round %d, pmi_feedback %d \n",trials,round,pmi_feedback);
for (aa=0; aa<PHY_vars_eNB->lte_frame_parms.nb_antennas_tx;aa++) {
memset(&PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][aa][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t));
}
......@@ -2366,8 +2360,6 @@ n(tikz_fname,"w");
PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->rvidx = round&3;
if (PHY_vars_eNB->lte_frame_parms.frame_type == TDD) {
switch (transmission_mode) {
case 1:
case 2:
......@@ -2722,11 +2714,11 @@ n(tikz_fname,"w");
0,subframe);
#ifdef TBS_FIX // This is for MESH operation!!!
#ifdef TBS_FIX // This is for MESH operation!!!
tbs = (double)3*TBStable[get_I_TBS(PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->mcs)][PHY_vars_eNB->dlsch_eNB[k][cw]->nb_rb-1]/4;
#else
#else
tbs = PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->TBS;
#endif
#endif
rate = (double)tbs/(double)coded_bits_per_codeword;
......@@ -2771,8 +2763,7 @@ n(tikz_fname,"w");
0,subframe,
&PHY_vars_eNB->dlsch_rate_matching_stats,
&PHY_vars_eNB->dlsch_turbo_encoding_stats,
&PHY_vars_eNB->dlsch_interleaving_stats
)<0)
&PHY_vars_eNB->dlsch_interleaving_stats)<0)
exit(-1);
......@@ -2877,7 +2868,6 @@ n(tikz_fname,"w");
if (n_frames==1) {
printf("tx_lev = %d (%d dB)\n",tx_lev,tx_lev_dB);
write_output("txsig0.m","txs0", &PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][0][subframe* PHY_vars_eNB->lte_frame_parms.samples_per_tti],
PHY_vars_eNB->lte_frame_parms.samples_per_tti,1,1);
}
}
......@@ -3103,20 +3093,19 @@ n(tikz_fname,"w");
if (PHY_vars_UE->perfect_ce==1) {
if (awgn_flag==0) {
for(k=0; k<NUMBER_OF_eNB_MAX; k++) {
for(aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
for (i=0; i<frame_parms->N_RB_DL*12; i++) {
((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[k][(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)(
eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP);
((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[k][(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)(
eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP);
((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[k][(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=
(int16_t)(eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP);
((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[k][(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=
(int16_t)(eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP);
}
}
}
}
} else {
}else {
if (transmission_mode==4) {
for (i=0; i<frame_parms->N_RB_DL*12; i++) {
((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][0])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(short)(AMP);
......@@ -3128,8 +3117,7 @@ n(tikz_fname,"w");
((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][3])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=-(short)(AMP);
((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][3])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=0;
}
}
else{
} else {
for(aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
for (i=0; i<frame_parms->N_RB_DL*12; i++) {
......@@ -3141,12 +3129,13 @@ n(tikz_fname,"w");
}
}
}
if ((Ns==((2*subframe))) && (l==0)) {
lte_ue_measurements(PHY_vars_UE,
subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti,
1,
0);
// printf ("Trial %d, Measurements are done \n", trials);
//printf ("Trial %d, Measurements are done \n", trials);
/*
debug_msg("RX RSSI %d dBm, digital (%d, %d) dB, linear (%d, %d), avg rx power %d dB (%d lin), RX gain %d dB\n",
PHY_vars_UE->PHY_measurements.rx_rssi_dBm[0] - ((PHY_vars_UE->lte_frame_parms.nb_antennas_rx==2) ? 3 : 0),
......@@ -3174,7 +3163,7 @@ n(tikz_fname,"w");
if (pmi_feedback == 1) {
pmi_feedback = 0;
hold_channel = 1;
// printf ("trial %d pmi_feedback %d \n", trials, pmi_feedback);
//printf ("trial %d pmi_feedback %d \n", trials, pmi_feedback);
goto PMI_FEEDBACK;
}
}
......@@ -3183,11 +3172,10 @@ n(tikz_fname,"w");
if ((Ns==(2*subframe)) && (l==pilot1)) {// process symbols 0,1,2
if (dci_flag == 1) {
PHY_vars_UE->UE_mode[0] = PUSCH;
start_meas(&PHY_vars_UE->dlsch_rx_pdcch_stats);
rx_pdcch(&PHY_vars_UE->lte_ue_common_vars,
PHY_vars_UE->lte_ue_pdcch_vars,
&PHY_vars_UE->lte_frame_parms,
......@@ -3196,6 +3184,7 @@ n(tikz_fname,"w");
(PHY_vars_UE->lte_frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI,
PHY_vars_UE->high_speed_flag,
0);
stop_meas(&PHY_vars_UE->dlsch_rx_pdcch_stats);
// overwrite number of pdcch symbols
PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols = num_pdcch_symbols;
......@@ -3204,7 +3193,7 @@ n(tikz_fname,"w");
dci_alloc_rx,1,
eNB_id,
subframe);
// printf("dci_cnt %d\n",dci_cnt);
//printf("dci_cnt %d\n",dci_cnt);
if (dci_cnt==0) {
dlsch_active = 0;
......@@ -3217,13 +3206,13 @@ n(tikz_fname,"w");
if (n_frames==1)
printf("DCI error trial %d errs[0][0] %d\n",trials,errs[0][0]);
}
// for (i=1;i<=round;i++)
// round_trials[i]--;
// round=5;
//for (i=1;i<=round;i++)
//round_trials[i]--;
//round=5;
}
for (i=0;i<dci_cnt;i++) {
// printf("Generating dlsch parameters for RNTI %x\n",dci_alloc_rx[i].rnti);
//printf("Generating dlsch parameters for RNTI %x\n",dci_alloc_rx[i].rnti);
if (round == 0) {
PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->first_tx=1;
PHY_vars_UE->dlsch_ue[0][1]->harq_processes[PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid]->first_tx=1;
......@@ -3247,7 +3236,8 @@ n(tikz_fname,"w");
get_Qm(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs),
PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->Nl,
PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols,
0,subframe);
0,
subframe);
/*
rate = (double)dlsch_tbs25[get_I_TBS(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs)][PHY_vars_UE->dlsch_ue[0][0]->nb_rb-1]/(coded_bits_per_codeword);
rate*=get_Qm(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs);
......@@ -3255,8 +3245,7 @@ n(tikz_fname,"w");
printf("num_pdcch_symbols %d, G %d, TBS %d\n",PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols,coded_bits_per_codeword,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->TBS);
dlsch_active = 1;
}
else {
} else {
dlsch_active = 0;
if (round==0) {
dci_errors++;
......@@ -3273,9 +3262,7 @@ n(tikz_fname,"w");
// round=5;
}
}
} // if dci_flag==1
else { //dci_flag == 0
} else { //dci_flag == 0
PHY_vars_UE->lte_ue_pdcch_vars[0]->crnti = n_rnti;
PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols = num_pdcch_symbols;
if (round == 0) {
......@@ -3298,7 +3285,7 @@ n(tikz_fname,"w");
P_RNTI);
break;
case 3:
// printf("Rate: TM3 (before) round %d (%d) first_tx %d\n",round,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->round,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->first_tx);
//printf("Rate: TM3 (before) round %d (%d) first_tx %d\n",round,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->round,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->first_tx);
generate_ue_dlsch_params_from_dci(0,
subframe,
&DLSCH_alloc_pdu_1[0],
......@@ -3310,7 +3297,7 @@ n(tikz_fname,"w");
SI_RNTI,
0,
P_RNTI);
// printf("Rate: TM3 (after) round %d (%d) first_tx %d\n",round,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->round,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->first_tx);
//printf("Rate: TM3 (after) round %d (%d) first_tx %d\n",round,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->round,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->first_tx);
break;
case 4:
generate_ue_dlsch_params_from_dci(0,
......@@ -3340,16 +3327,13 @@ n(tikz_fname,"w");
0,
P_RNTI);
break;
}
dlsch_active = 1;
} // if dci_flag == 1
}
if (dlsch_active == 1) {
if ((Ns==(1+(2*subframe))) && (l==0)) {// process PDSCH symbols 1,2,3,4,5,(6 Normal Prefix)
if ((Ns==(1+(2*subframe))) && (l==0)) {// process PDSCH symbols 1,2,3,4,5,(6 Normal Prefix
if (transmission_mode == 5) {
if ((PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->dl_power_off==0) &&
(openair_daq_vars.use_ia_receiver ==1)) {
......@@ -3362,10 +3346,7 @@ n(tikz_fname,"w");
start_meas(&PHY_vars_UE->dlsch_llr_stats);
for (m=PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols;
m<pilot2;
m++)
{
for (m=PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols; m<pilot2; m++) {
if (rx_pdsch(PHY_vars_UE,
PDSCH,
eNB_id,
......@@ -3375,8 +3356,7 @@ n(tikz_fname,"w");
(m==PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols)?1:0,
rx_type,
i_mod,
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid)==-1)
{
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid)==-1){
dlsch_active = 0;
break;
}
......@@ -3384,13 +3364,9 @@ n(tikz_fname,"w");
stop_meas(&PHY_vars_UE->dlsch_llr_stats);
}
if ((Ns==(1+(2*subframe))) && (l==pilot1))
{// process symbols (6 Extended Prefix),7,8,9
if ((Ns==(1+(2*subframe))) && (l==pilot1)){// process symbols (6 Extended Prefix),7,8,9
start_meas(&PHY_vars_UE->dlsch_llr_stats);
for (m=pilot2;
m<pilot3;
m++)
{
for (m=pilot2;m<pilot3; m++) {
if (rx_pdsch(PHY_vars_UE,
PDSCH,
eNB_id,
......@@ -3400,8 +3376,7 @@ n(tikz_fname,"w");
0,
rx_type,
i_mod,
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid)==-1)
{
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid)==-1){
dlsch_active=0;
break;
}
......@@ -3409,13 +3384,9 @@ n(tikz_fname,"w");
stop_meas(&PHY_vars_UE->dlsch_llr_stats);
}
if ((Ns==(2+(2*subframe))) && (l==0)) // process symbols 10,11,(12,13 Normal Prefix) do deinterleaving for TTI
{
if ((Ns==(2+(2*subframe))) && (l==0)) { // process symbols 10,11,(12,13 Normal Prefix) do deinterleaving for TTI
start_meas(&PHY_vars_UE->dlsch_llr_stats);
for (m=pilot3;
m<PHY_vars_UE->lte_frame_parms.symbols_per_tti;
m++)
{
for (m=pilot3; m<PHY_vars_UE->lte_frame_parms.symbols_per_tti; m++) {
if (rx_pdsch(PHY_vars_UE,
PDSCH,
eNB_id,
......@@ -3425,8 +3396,7 @@ n(tikz_fname,"w");
0,
rx_type,
i_mod,
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid)==-1)
{
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid)==-1) {
dlsch_active=0;
break;
}
......@@ -3535,7 +3505,7 @@ n(tikz_fname,"w");
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
#ifdef PRINT_BYTES
for (s=0;s<PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[0]->C;s++) {
if (s<PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[0]->Cminus)
Kr = PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[0]->Kminus;
......@@ -3549,7 +3519,7 @@ n(tikz_fname,"w");
printf("%d : %x (%x)\n",i,PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[0]->c[s][i],
PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[0]->c[s][i]^PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->c[s][i]);
}
#endif
#endif
}
PHY_vars_UE->total_TBS[eNB_id] = PHY_vars_UE->total_TBS[eNB_id] + PHY_vars_UE->dlsch_ue[eNB_id][cw_non_sic]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][cw_non_sic]->current_harq_pid]->TBS;
......@@ -3842,7 +3812,7 @@ n(tikz_fname,"w");
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
#ifdef PRINT_BYTES
for (s=0;s<PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[0]->C;s++) {
if (s<PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[0]->Cminus)
Kr = PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[0]->Kminus;
......@@ -3856,7 +3826,7 @@ n(tikz_fname,"w");
printf("%d : %x (%x)\n",i,PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[0]->c[s][i],
PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[0]->c[s][i]^PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->c[s][i]);
}
#endif
#endif
}
}
......@@ -3874,7 +3844,7 @@ n(tikz_fname,"w");
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
#ifdef PRINT_BYTES
for (s=0;s<PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[0]->C;s++) {
if (s<PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[0]->Cminus)
Kr = PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[0]->Kminus;
......@@ -3888,7 +3858,7 @@ n(tikz_fname,"w");
printf("%d : %x (%x)\n",i,PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[0]->c[s][i],
PHY_vars_UE->dlsch_ue[0][cw_sic]->harq_processes[0]->c[s][i]^PHY_vars_eNB->dlsch_eNB[0][cw_sic]->harq_processes[0]->c[s][i]);
}
#endif
#endif
} //n_frames==1
// exit(0);
} //if (ret > PHY_vars_UE->dlsch_ue[0][cw_sic]->max_turbo_iterations )
......@@ -3920,7 +3890,7 @@ n(tikz_fname,"w");
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
#ifdef PRINT_BYTES
for (s=0;s<PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[0]->C;s++) {
if (s<PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[0]->Cminus)
Kr = PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[0]->Kminus;
......@@ -3934,7 +3904,7 @@ n(tikz_fname,"w");
printf("%d : %x (%x)\n",i,PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[0]->c[s][i],
PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[0]->c[s][i]^PHY_vars_eNB->dlsch_eNB[0][cw_non_sic]->harq_processes[0]->c[s][i]);
}
#endif
#endif
}
}
}
......
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