diff --git a/cmake_targets/autotests/README.txt b/cmake_targets/autotests/README.txt index a623be47510becc287a3d777296b63670f5606ca..c983933125cd8717cd1edc5e1b99fc45f3b5b608 100644 --- a/cmake_targets/autotests/README.txt +++ b/cmake_targets/autotests/README.txt @@ -73,6 +73,8 @@ Obj.# Case# Test# Description (Test 10: 5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)), (Test 10b: 5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)), (Test 11: 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)) + (TM2 Test 1 10 MHz, R.11 FDD (MCS 14), EVA5, 6.8 dB (70%)), + (TM2 Test 1b 20 MHz, R.11-2 FDD (MCS 13), EVA5, 5.9 dB (70%)), 01 51 01 ulsim Test cases. (Test 1, 5 MHz, FDD (MCS 5), AWGN, 6dB), (Test 2, 5 MHz, FDD (MCS 16), AWGN , 12dB (70%)), (Test 3, 10 MHz, R3.FDD (MCS 5), AWGN, 6dB (70%)), diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index c8d0c80f50a824ea4694423c0008d0cbcc67e1a2..1425eb56a993895bed1910237be9367ee467883d 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -716,7 +716,7 @@ <tags>test1 test5 test6 test6b test7 test7b test10 test10b test11 TM2_test1 TM2_test1b</tags> <search_expr_true>"passed"</search_expr_true> <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false> - <nruns>3</nruns> + <nruns>1</nruns> </testCase> <testCase id="015101"> @@ -742,7 +742,7 @@ <tags>test1 test2 test3 test4 test5 test6</tags> <search_expr_true>"passed"</search_expr_true> <search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false> - <nruns>3</nruns> + <nruns>1</nruns> </testCase> <testCase id="015500" > diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 7d33d2055ca19de983b7d914003efbc52ec623cd..af147d682af80063bfa910ae842f4ee04a02c7d3 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -47,6 +47,7 @@ PRINT_STATS="False" VCD_TIMING="False" REL="Rel10" HW="EXMIMO" +NOS1=0 EPC=0 VERBOSE_COMPILE=0 CFLAGS_PROCESSOR_USER="" @@ -329,7 +330,7 @@ function main() { cmake .. fi - if [ "$eNB" = "1" ] ; then + if [ "$eNB" = "1" -o "$UE" = "1" ] ; then echo_info "Compiling $lte_exec" compilations \ $lte_build_dir $lte_exec \ @@ -346,7 +347,7 @@ function main() { fi fi - if [ "$UE" = 1 ] ; then + if [ "$UE" = 1 -a "$NOS1" = "0" ] ; then # ue_ip driver compilation echo_info "Compiling UE specific part" compilations \ diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index 3dc325861cbdb9c0fd122504c98229dad92cb07b..de9acefb6ee3696609ff0001f915f209364bebc3 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -45,7 +45,6 @@ #include "PHY/sse_intrin.h" - #ifndef USER_MODE #define NOCYGWIN_STATIC static #else @@ -53,9 +52,9 @@ #endif //#define DEBUG_PHY 1 -//#define DEBUG_DLSCH_MOD 1 +//#define DEBUG_DLSCH_DEMOD 1 -int avg[4]; +int avg[4]; // [MCS][i_mod (0,1,2) = (2,4,6)] unsigned char offset_mumimo_llr_drange_fix=0; @@ -3091,19 +3090,21 @@ void dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, ch_mag1 = (__m128i *)&dl_ch_mag[2][jj]; ch_mag0b = (__m128i *)&dl_ch_magb[0][jj]; ch_mag1b = (__m128i *)&dl_ch_magb[2][jj]; - + for (rb=0; rb<nb_rb; rb++) { for (re=0; re<((pilots==0)?12:8); re+=2) { // Alamouti RX combining + // printf("Alamouti: symbol %d, rb %d, re %d: rxF0 (%d,%d,%d,%d), rxF1 (%d,%d,%d,%d)\n",symbol,rb,re,rxF0[0],rxF0[1],rxF0[2],rxF0[3],rxF1[0],rxF1[1],rxF1[2],rxF1[3]); rxF0[0] = rxF0[0] + rxF1[2]; - rxF0[1] = rxF0[1] - rxF1[3]; + rxF0[1] = rxF0[1] - rxF1[3]; rxF0[2] = rxF0[2] - rxF1[0]; rxF0[3] = rxF0[3] + rxF1[1]; + // printf("Alamouti: rxF0 after (%d,%d,%d,%d)\n",rxF0[0],rxF0[1],rxF0[2],rxF0[3]); rxF0+=4; rxF1+=4; @@ -3229,12 +3230,40 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, else rb_alloc_ind = 0; + if (rb_alloc_ind == 1) + nb_rb++; + // For second half of RBs skip DC carrier if (rb==(frame_parms->N_RB_DL>>1)) { rxF = &rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))]; //dl_ch0++; } + // PBCH + if ((subframe==0) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=nsymb>>1) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //SSS + if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) { + rb_alloc_ind = 0; + } + + + if (frame_parms->frame_type == FDD) { + //PSS + if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + if ((frame_parms->frame_type == TDD) && + (subframe==6)) { //TDD Subframe 6 + if ((rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + if (rb_alloc_ind==1) { *pmi_ext = (pmi>>((rb>>2)<<1))&3; memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); @@ -3272,7 +3301,7 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, rxF_ext+=10; } - nb_rb++; + } dl_ch0+=12; @@ -3281,7 +3310,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, } else { // Odd number of RBs for (rb=0; rb<frame_parms->N_RB_DL>>1; rb++) { - // printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]); +#ifdef DEBUG_DLSCH_DEMOD + printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]); +#endif skip_half=0; if (rb < 32) @@ -3295,6 +3326,8 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, else rb_alloc_ind = 0; + if (rb_alloc_ind == 1) + nb_rb++; // PBCH if ((subframe==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) { @@ -3328,7 +3361,10 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, //PSS in subframe 0/5 if FDD if (frame_parms->frame_type == FDD) { //FDD - if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + if (((subframe==0)||(subframe==5)) && + (rb>((frame_parms->N_RB_DL>>1)-3)) && + (rb<((frame_parms->N_RB_DL>>1)+3)) && + (l==pss_symb) ) { rb_alloc_ind = 0; } @@ -3352,55 +3388,68 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, if (rb_alloc_ind==1) { - // printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); - +#ifdef DEBUG_DLSCH_DEMOD + printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); +#endif if (pilots==0) { - // printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + // printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); if (skip_half==1) { memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int)); - for (i=0; i<6; i++) - rxF_ext[i]=rxF[i]; - + for (i=0; i<6; i++) { + rxF_ext[i]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } dl_ch0_ext+=6; rxF_ext+=6; } else if (skip_half==2) { memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int)); - for (i=0; i<6; i++) + for (i=0; i<6; i++) { rxF_ext[i]=rxF[(i+6)]; - +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } dl_ch0_ext+=6; rxF_ext+=6; } else { memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); - for (i=0; i<12; i++) + for (i=0; i<12; i++) { rxF_ext[i]=rxF[i]; - +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } dl_ch0_ext+=12; rxF_ext+=12; } } else { - // printf("Extracting with pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + // printf("Extracting with pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); j=0; if (skip_half==1) { for (i=0; i<6; i++) { if (i!=((frame_parms->nushift+poffset)%6)) { rxF_ext[j]=rxF[i]; - // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif dl_ch0_ext[j++]=dl_ch0[i]; } } - + rxF_ext+=5; dl_ch0_ext+=5; - rxF_ext+=5; } else if (skip_half==2) { for (i=0; i<6; i++) { if (i!=((frame_parms->nushift+poffset)%6)) { rxF_ext[j]=rxF[(i+6)]; - // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif dl_ch0_ext[j++]=dl_ch0[i+6]; } } @@ -3412,7 +3461,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, if ((i!=(frame_parms->nushift+poffset)) && (i!=((frame_parms->nushift+poffset+6)%12))) { rxF_ext[j]=rxF[i]; - // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif dl_ch0_ext[j++]=dl_ch0[i]; } @@ -3422,8 +3473,6 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, rxF_ext+=10; } } - - nb_rb++; } dl_ch0+=12; @@ -3444,36 +3493,42 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, rb_alloc_ind = 0; + if (rb_alloc_ind == 1) + nb_rb++; // PBCH - if ((subframe==0) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) { + if ((subframe==0) && + (l>=(nsymb>>1)) && + (l<((nsymb>>1) + 4))) { rb_alloc_ind = 0; } //SSS - if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) { + if (((subframe==0)||(subframe==5)) && (l==sss_symb) ) { rb_alloc_ind = 0; } if (frame_parms->frame_type == FDD) { //PSS - if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + if (((subframe==0)||(subframe==5)) && (l==pss_symb) ) { rb_alloc_ind = 0; } } + //PSS if ((frame_parms->frame_type == TDD) && - (subframe==6)) { - //PSS - if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { - rb_alloc_ind = 0; - } + (subframe==6) && + (l==pss_symb) ) { + rb_alloc_ind = 0; } + // printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]); // printf("DC rb %d (%p)\n",rb,rxF); if (rb_alloc_ind==1) { - // printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); +#ifdef DEBUG_DLSCH_DEMOD + printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); +#endif if (pilots==0) { for (i=0; i<6; i++) { dl_ch0_ext[i]=dl_ch0[i]; @@ -3496,7 +3551,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, if (i!=((frame_parms->nushift+poffset)%6)) { dl_ch0_ext[j]=dl_ch0[i]; rxF_ext[j++]=rxF[i]; - // printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); +#ifdef DEBUG_DLSCH_DEMOD + printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); +#endif } } @@ -3506,7 +3563,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, if (i!=((frame_parms->nushift+6+poffset)%12)) { dl_ch0_ext[j]=dl_ch0[i]; rxF_ext[j++]=rxF[(1+i-6)]; - // printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); +#ifdef DEBUG_DLSCH_DEMOD + printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); +#endif } } @@ -3514,7 +3573,6 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, rxF_ext+=10; } // symbol_mod==0 - nb_rb++; } // rballoc==1 else { rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; @@ -3540,7 +3598,8 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, else rb_alloc_ind = 0; - + if (rb_alloc_ind == 1) + nb_rb++; // PBCH if ((subframe==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=nsymb>>1) && (l<((nsymb>>1) + 4))) { @@ -3590,7 +3649,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, } if (rb_alloc_ind==1) { - // printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); +#ifdef DEBUG_DLSCH_DEMOD + printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); +#endif /* printf("rb %d\n",rb); for (i=0;i<12;i++) @@ -3598,43 +3659,54 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, printf("\n"); */ if (pilots==0) { - // printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + // printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); if (skip_half==1) { memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int)); - for (i=0; i<6; i++) + for (i=0; i<6; i++) { rxF_ext[i]=rxF[i]; - +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } dl_ch0_ext+=6; rxF_ext+=6; } else if (skip_half==2) { memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int)); - for (i=0; i<6; i++) + for (i=0; i<6; i++) { rxF_ext[i]=rxF[(i+6)]; - +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } dl_ch0_ext+=6; rxF_ext+=6; } else { memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); - for (i=0; i<12; i++) + for (i=0; i<12; i++) { rxF_ext[i]=rxF[i]; - +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } dl_ch0_ext+=12; rxF_ext+=12; } } else { - // printf("Extracting with pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + // printf("Extracting with pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); j=0; if (skip_half==1) { for (i=0; i<6; i++) { if (i!=((frame_parms->nushift+poffset)%6)) { rxF_ext[j]=rxF[i]; - // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif dl_ch0_ext[j++]=dl_ch0[i]; } } @@ -3645,7 +3717,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, for (i=0; i<6; i++) { if (i!=((frame_parms->nushift+poffset)%6)) { rxF_ext[j]=rxF[(i+6)]; - // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif dl_ch0_ext[j++]=dl_ch0[i+6]; } } @@ -3657,7 +3731,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, if ((i!=(frame_parms->nushift+poffset)) && (i!=((frame_parms->nushift+poffset+6)%12))) { rxF_ext[j]=rxF[i]; - // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif dl_ch0_ext[j++]=dl_ch0[i]; } } @@ -3666,8 +3742,6 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, rxF_ext+=10; } } // pilots=0 - - nb_rb++; } dl_ch0+=12; @@ -3749,52 +3823,58 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, rb_alloc_ind = (rb_alloc[3]>>(prb-96)) & 1; else rb_alloc_ind = 0; + + if (rb_alloc_ind == 1) + nb_rb++; - // PBCH - if ((subframe==0) && - (prb>((frame_parms->N_RB_DL>>1)-3)) && - (prb<((frame_parms->N_RB_DL>>1)+3)) && - (l>=(nsymb>>1)) && - (l<((nsymb>>1) + 4))) { - rb_alloc_ind = 0; - // printf("symbol %d / rb %d: skipping PBCH REs\n",symbol,prb); - } - - //SSS - - if (((subframe==0)||(subframe==5)) && - (prb>((frame_parms->N_RB_DL>>1)-3)) && - (prb<((frame_parms->N_RB_DL>>1)+3)) && - (l==sss_symb) ) { - rb_alloc_ind = 0; - // printf("symbol %d / rb %d: skipping SSS REs\n",symbol,prb); - } - - - - //PSS in subframe 0/5 if FDD - if (frame_parms->frame_type == FDD) { //FDD - if (((subframe==0)||(subframe==5)) && - (prb>((frame_parms->N_RB_DL>>1)-3)) && + + if ((frame_parms->N_RB_DL&1) == 0) { // even number of RBs + + // PBCH + if ((subframe==0) && + (prb>=((frame_parms->N_RB_DL>>1)-3)) && (prb<((frame_parms->N_RB_DL>>1)+3)) && - (l==pss_symb) ) { + (l>=(nsymb>>1)) && + (l<((nsymb>>1) + 4))) { rb_alloc_ind = 0; - // printf("symbol %d / rb %d: skipping PSS REs\n",symbol,prb); + // printf("symbol %d / rb %d: skipping PBCH REs\n",symbol,prb); } - } - - if ((frame_parms->frame_type == TDD) && - (subframe==6)) { //TDD Subframe 6 - if ((prb>=((frame_parms->N_RB_DL>>1)-3)) && - (prb<=((frame_parms->N_RB_DL>>1)+3)) && - (l==pss_symb) ) { + + //SSS + + if (((subframe==0)||(subframe==5)) && + (prb>=((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l==sss_symb) ) { rb_alloc_ind = 0; + // printf("symbol %d / rb %d: skipping SSS REs\n",symbol,prb); } - } - - if (rb_alloc_ind==1) { // PRB is allocated + + + + //PSS in subframe 0/5 if FDD + if (frame_parms->frame_type == FDD) { //FDD + if (((subframe==0)||(subframe==5)) && + (prb>=((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l==pss_symb) ) { + rb_alloc_ind = 0; + // printf("symbol %d / rb %d: skipping PSS REs\n",symbol,prb); + } + } + + if ((frame_parms->frame_type == TDD) && + (subframe==6)) { //TDD Subframe 6 + if ((prb>=((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + if (rb_alloc_ind==1) { // PRB is allocated + - if ((frame_parms->N_RB_DL&1) == 0) { // even number of RBs prb_off = 12*prb; prb_off2 = 1+(12*(prb-(frame_parms->N_RB_DL>>1))); @@ -3839,12 +3919,55 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, rxF_ext+=8; } // pilots==1 - nb_rb++; + } + } else { // Odd number of RBs - } else { // Odd number of RBs - skip_half=0; + // PBCH + if ((subframe==0) && + (prb>((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l>=(nsymb>>1)) && + (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + // printf("symbol %d / rb %d: skipping PBCH REs\n",symbol,prb); + } + + //SSS + + if (((subframe==0)||(subframe==5)) && + (prb>((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l==sss_symb) ) { + rb_alloc_ind = 0; + // printf("symbol %d / rb %d: skipping SSS REs\n",symbol,prb); + } + + + + //PSS in subframe 0/5 if FDD + if (frame_parms->frame_type == FDD) { //FDD + if (((subframe==0)||(subframe==5)) && + (prb>((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l==pss_symb) ) { + rb_alloc_ind = 0; + // printf("symbol %d / rb %d: skipping PSS REs\n",symbol,prb); + } + } + + if ((frame_parms->frame_type == TDD) && + ((subframe==1) || (subframe==6))) { //TDD Subframe 1-6 + if ((prb>((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + if (rb_alloc_ind == 1) { + skip_half=0; + //Check if we have to drop half a PRB due to PSS/SSS/PBCH // skip_half == 0 means full PRB // skip_half == 1 means first half is used (leftmost half-PRB from PSS/SSS/PBCH) @@ -3875,13 +3998,12 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, if (((frame_parms->frame_type == FDD) && (((subframe==0)||(subframe==5)))) || //FDD Subframes 0,5 ((frame_parms->frame_type == TDD) && - (((subframe==2) || (subframe==6))))) { //TDD Subframes 2,6 + (((subframe==1) || (subframe==6))))) { //TDD Subframes 1,6 if ((prb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) skip_half=1; - else if (((subframe==0)||(subframe==5)) && - (prb==((frame_parms->N_RB_DL>>1)+3)) && + else if ((prb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) skip_half=2; } @@ -3901,9 +4023,9 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, rxF = &rxdataF[aarx][prb_off2+ (symbol*(frame_parms->ofdm_symbol_size))]; } - - // printf("symbol %d / rb %d: alloc %d skip_half %d (rxF %p, rxF_ext %p) prb_off (%d,%d)\n",symbol,prb,rb_alloc_ind,skip_half,rxF,rxF_ext,prb_off,prb_off2); - +#ifdef DEBUG_DLSCH_DEMOD + printf("symbol %d / rb %d: alloc %d skip_half %d (rxF %p, rxF_ext %p) prb_off (%d,%d)\n",symbol,prb,rb_alloc_ind,skip_half,rxF,rxF_ext,prb_off,prb_off2); +#endif *pmi_loc = (pmi>>((prb>>2)<<1))&3; // printf("symbol_mod %d (pilots %d) rb %d, sb %d, pmi %d (pmi_loc %p,rxF %p, ch00 %p, ch01 %p, rxF_ext %p dl_ch0_ext %p dl_ch1_ext %p)\n",symbol_mod,pilots,rb,rb>>2,*pmi_loc,pmi_loc,rxF,dl_ch0, dl_ch1, rxF_ext,dl_ch0_ext,dl_ch1_ext); @@ -3915,6 +4037,10 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, memcpy(dl_ch0_ext,dl_ch0p,6*sizeof(int32_t)); memcpy(dl_ch1_ext,dl_ch1p,6*sizeof(int32_t)); memcpy(rxF_ext,rxF,6*sizeof(int32_t)); +#ifdef DEBUG_DLSCH_DEMOD + for (i=0;i<6;i++) + printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif dl_ch0_ext+=6; dl_ch1_ext+=6; rxF_ext+=6; @@ -3922,6 +4048,10 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, memcpy(dl_ch0_ext,dl_ch0p+6,6*sizeof(int32_t)); memcpy(dl_ch1_ext,dl_ch1p+6,6*sizeof(int32_t)); memcpy(rxF_ext,rxF+6,6*sizeof(int32_t)); +#ifdef DEBUG_DLSCH_DEMOD + for (i=0;i<6;i++) + printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif dl_ch0_ext+=6; dl_ch1_ext+=6; rxF_ext+=6; @@ -3929,8 +4059,10 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, memcpy(dl_ch0_ext,dl_ch0p,12*sizeof(int32_t)); memcpy(dl_ch1_ext,dl_ch1p,12*sizeof(int32_t)); memcpy(rxF_ext,rxF,12*sizeof(int32_t)); +#ifdef DEBUG_DLSCH_DEMOD for (i=0;i<12;i++) - // printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); + printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif dl_ch0_ext+=12; dl_ch1_ext+=12; rxF_ext+=12; @@ -3943,7 +4075,9 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, if ((i!=frame_parms->nushift) && (i!=((frame_parms->nushift+3)%6))) { rxF_ext[j]=rxF[i]; - // printf("(pilots,skip1)extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#ifdef DEBUG_DLSCH_DEMOD + printf("(pilots,skip1)extract rb %d, re %d (%d)=> (%d,%d)\n",prb,i,j,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif dl_ch0_ext[j]=dl_ch0p[i]; dl_ch1_ext[j++]=dl_ch1p[i]; } @@ -3956,15 +4090,17 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, if ((i!=frame_parms->nushift) && (i!=((frame_parms->nushift+3)%6))) { rxF_ext[j]=rxF[(i+6)]; - // printf("(pilots,skip2)extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#ifdef DEBUG_DLSCH_DEMOD + printf("(pilots,skip2)extract rb %d, re %d (%d) => (%d,%d)\n",prb,i,j,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif dl_ch0_ext[j]=dl_ch0p[i+6]; dl_ch1_ext[j++]=dl_ch1p[i+6]; } - - dl_ch0_ext+=4; - dl_ch1_ext+=4; - rxF_ext+=4; } + dl_ch0_ext+=4; + dl_ch1_ext+=4; + rxF_ext+=4; + } else { //skip_half==0 for (i=0; i<12; i++) { if ((i!=frame_parms->nushift) && @@ -3972,7 +4108,9 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, (i!=frame_parms->nushift+6) && (i!=((frame_parms->nushift+9)%12))) { rxF_ext[j]=rxF[i]; - // printf("(pilots)extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#ifdef DEBUG_DLSCH_DEMOD + printf("(pilots)extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif dl_ch0_ext[j] =dl_ch0p[i]; dl_ch1_ext[j++]=dl_ch1p[i]; } @@ -3982,31 +4120,33 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, rxF_ext+=8; } //skip_half==0 } //pilots==1 - nb_rb++; } else { // Do middle RB (around DC) if (pilots==0) { memcpy(dl_ch0_ext,dl_ch0p,6*sizeof(int32_t)); memcpy(dl_ch1_ext,dl_ch1p,6*sizeof(int32_t)); memcpy(rxF_ext,rxF,6*sizeof(int32_t)); - /* +#ifdef DEBUG_DLSCH_DEMOD for (i=0; i<6; i++) { printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); - }*/ + } +#endif rxF_ext+=6; dl_ch0_ext+=6; dl_ch1_ext+=6; dl_ch0p+=6; dl_ch1p+=6; - rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; + rxF = &rxdataF[aarx][1+((symbol*(frame_parms->ofdm_symbol_size)))]; memcpy(dl_ch0_ext,dl_ch0p,6*sizeof(int32_t)); memcpy(dl_ch1_ext,dl_ch1p,6*sizeof(int32_t)); memcpy(rxF_ext,rxF,6*sizeof(int32_t)); - /*for (i=0; i<6; i++) { +#ifdef DEBUG_DLSCH_DEMOD + for (i=0; i<6; i++) { printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); - }*/ + } +#endif rxF_ext+=6; dl_ch0_ext+=6; dl_ch1_ext+=6; @@ -4019,18 +4159,22 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, dl_ch0_ext[j]=dl_ch0p[i]; dl_ch1_ext[j]=dl_ch1p[i]; rxF_ext[j++]=rxF[i]; - //printf("(pilots)extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF[i],*(1+(short*)&rxF[i])); +#ifdef DEBUG_DLSCH_DEMOD + printf("(pilots)extract rb %d, re %d (%d) => (%d,%d)\n",prb,i,j,*(short *)&rxF[i],*(1+(short*)&rxF[i])); +#endif } } - rxF = &rxdataF[aarx][symbol*(frame_parms->ofdm_symbol_size)]; + rxF = &rxdataF[aarx][1+symbol*(frame_parms->ofdm_symbol_size)]; for (; i<12; i++) { if ((i!=((frame_parms->nushift+6)%12)) && (i!=((frame_parms->nushift+9)%12))) { dl_ch0_ext[j]=dl_ch0p[i]; dl_ch1_ext[j]=dl_ch1p[i]; - rxF_ext[j++]=rxF[(1+i-6)]; - //printf("(pilots)extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF[1+i-6],*(1+(short*)&rxF[1+i-6])); + rxF_ext[j++]=rxF[i-6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("(pilots)extract rb %d, re %d (%d) => (%d,%d)\n",prb,i,j,*(short *)&rxF[1+i-6],*(1+(short*)&rxF[1+i-6])); +#endif } } @@ -4038,7 +4182,6 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, dl_ch1_ext+=8; rxF_ext+=8; } //pilots==1 - nb_rb++; } // if Middle PRB } // if odd PRB } // if rballoc==1 @@ -4126,7 +4269,7 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per #endif #ifdef DEBUG_DLSCH_DEMOD - +/* void print_bytes(char *s,__m128i *x) { @@ -4164,5 +4307,5 @@ void print_ints(char *s,__m128i *x) printf("%s : %d,%d,%d,%d\n",s, tempb[0],tempb[1],tempb[2],tempb[3]); -} +}*/ #endif diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c index 7425a4ed65893e27d47d3d4f117f1cfdc47316a0..a35f89b8518baa2cdfc342a77045946702074621 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c @@ -662,16 +662,17 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, 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); + len = (nb_rb*8)- (2*pbch_pss_sss_adjust/3); else - len = (nb_rb*10);// - (5*pbch_pss_sss_adjust/6); + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); } 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); + // 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); for (i=0; i<len; i++) { *llr32 = *rxF; + // printf("llr %d : (%d,%d)\n",i,((int16_t*)llr32)[0],((int16_t*)llr32)[1]); rxF++; llr32++; } diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 28e7bc8216ecd57ff465250e9a0261c5c1b5d062..0e0dce370c9fcc2e7aa14f04c6682e59a377b3fd 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -777,6 +777,10 @@ int main(int argc, char **argv) sprintf(bler_fname,"bler_tx%d_chan%d_nrx%d_mcs%d.csv",transmission_mode,channel_model,n_rx,mcs1); bler_fd = fopen(bler_fname,"w"); + if (bler_fd==NULL) { + fprintf(stderr,"Cannot create file %s!\n",bler_fname); + exit(-1); + } fprintf(bler_fd,"SNR; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3; dci_err\n"); if (test_perf != 0) { @@ -784,12 +788,16 @@ int main(int argc, char **argv) hostname[1023] = '\0'; gethostname(hostname, 1023); printf("Hostname: %s\n", hostname); - char dirname[FILENAME_MAX]; - sprintf(dirname, "%s/SIMU/USER/pre-ci-logs-%s", getenv("OPENAIR_TARGETS"),hostname ); - sprintf(time_meas_fname,"%s/time_meas_prb%d_mcs%d_anttx%d_antrx%d_pdcch%d_channel%s_tx%d.csv", - dirname,N_RB_DL,mcs1,n_tx,n_rx,num_pdcch_symbols,channel_model_input,transmission_mode); - mkdir(dirname,0777); + //char dirname[FILENAME_MAX]; + //sprintf(dirname, "%s/SIMU/USER/pre-ci-logs-%s", getenv("OPENAIR_TARGETS"),hostname ); + sprintf(time_meas_fname,"time_meas_prb%d_mcs%d_anttx%d_antrx%d_pdcch%d_channel%s_tx%d.csv", + N_RB_DL,mcs1,n_tx,n_rx,num_pdcch_symbols,channel_model_input,transmission_mode); + //mkdir(dirname,0777); time_meas_fd = fopen(time_meas_fname,"w"); + if (time_meas_fd==NULL) { + fprintf(stderr,"Cannot create file %s!\n",time_meas_fname); + exit(-1); + } } if(abstx) { @@ -797,6 +805,10 @@ int main(int argc, char **argv) sprintf(csv_fname,"dataout_tx%d_u2%d_mcs%d_chan%d_nsimus%d_R%d.m",transmission_mode,dual_stream_UE,mcs1,channel_model,n_frames,num_rounds); csv_fd = fopen(csv_fname,"w"); fprintf(csv_fd,"data_all%d=[",mcs1); + if (csv_fd==NULL) { + fprintf(stderr,"Cannot create file %s!\n",csv_fname); + exit(-1); + } } /*