Commit 949fdfe8 authored by Ubuntu 14.04's avatar Ubuntu 14.04

Fix for issue 35 on gitlab for TM1.

parent f2aed46f
......@@ -53,7 +53,7 @@
#endif
//#define DEBUG_PHY 1
//#define DEBUG_DLSCH_MOD 1
//#define DEBUG_DLSCH_DEMOD 1
int avg[4];
......@@ -3229,12 +3229,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 +3300,7 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
rxF_ext+=10;
}
nb_rb++;
}
dl_ch0+=12;
......@@ -3281,7 +3309,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 +3325,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))) {
......@@ -3352,55 +3384,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];
}
}
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 +3457,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 +3469,6 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
rxF_ext+=10;
}
}
nb_rb++;
}
dl_ch0+=12;
......@@ -3444,6 +3489,8 @@ 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))) {
......@@ -3473,7 +3520,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
// 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 +3545,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 +3557,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 +3567,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 +3592,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 +3643,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 +3653,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 +3711,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 +3725,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 +3736,6 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
rxF_ext+=10;
}
} // pilots=0
nb_rb++;
}
dl_ch0+=12;
......@@ -4126,7 +4194,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 +4232,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
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