Commit 6df0e462 authored by Elena Lukashova's avatar Elena Lukashova

Fixed bug in lte_ue_measurements.c for subband pmi calculation

parent 55c1f581
......@@ -614,6 +614,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
// For each RE in subband perform ch0 * conj(ch1)
// multiply by conjugated channel
#if defined(__x86_64__) || defined(__i386__)
mmtmpPMI0 = _mm_madd_epi16(dl_ch0_128[0],dl_ch1_128[0]);
mmtmpPMI1 = _mm_shufflelo_epi16(dl_ch1_128[0],_MM_SHUFFLE(2,3,0,1));//_MM_SHUFFLE(2,3,0,1)
mmtmpPMI1 = _mm_shufflehi_epi16(mmtmpPMI1,_MM_SHUFFLE(2,3,0,1));
mmtmpPMI1 = _mm_sign_epi16(mmtmpPMI1,*(__m128i*)&conjugate[0]);
......
......@@ -5786,7 +5786,7 @@ uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb)
int i, aarx;
uint16_t pmiq=0;
uint32_t pmivect = 0; // work with tyoe
uint32_t pmivect = 0;
uint8_t rank = meas->rank[eNB_id];
int pmi_re,pmi_im;
int nb_subbands=0;
......@@ -5841,21 +5841,23 @@ uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb)
pmi_re += meas->subband_pmi_re[eNB_id][i][aarx];
pmi_im += meas->subband_pmi_im[eNB_id][i][aarx];
}
if (pmi_re > pmi_im)
if (pmi_re >= pmi_im)
pmiq = PMI_2A_R1_11;
else //if (pmi_re < pmi_im)
pmiq = PMI_2A_R1_1j;
printf("subband %d, pmi_re %d, pmi_in %d, pmiq %d \n",i,pmi_re,pmi_im,pmiq);
// printf("subband %d, pmi_re %d, pmi_im %d, pmiq %d \n",i,pmi_re,pmi_im,pmiq);
// printf("subband %d, pmi%d \n",i,pmiq);
//According to Section 7.2.4 of 36.213
pmivect |= ((pmiq-1)<<(i)); //shift 1 since only one bit
}
else {
LOG_E(PHY,"PMI feedback for rank>1 not supported!\n");
pmivect = 0;
}
}
}
//printf( "pmivect %d \n", pmivect);
printf("subband %d pmivect %d \n",i, pmivect);
return(pmivect);
}
......
......@@ -203,7 +203,10 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
frame_parms,
dlsch0_harq->mimo_mode);
//#ifdef DEBUG_DLSCH_MOD
printf("dlsch: using pmi %lx, rb_alloc %x, pmi_ext %x\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),*rballoc,*lte_ue_pdsch_vars[eNB_id]->pmi_ext);
/* printf("dlsch: using pmi %lx, rb_alloc %x, pmi_ext ",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),*rballoc);
for (rb=0;rb<nb_rb;rb++)
printf("%d",lte_ue_pdsch_vars[eNB_id]->pmi_ext[rb]);
printf("\n");*/
//#endif
if (rx_type==rx_IC_single_stream) {
......@@ -4137,12 +4140,14 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
rxF = &rxdataF[aarx][prb_off2+
(symbol*(frame_parms->ofdm_symbol_size))];
}
/*
if (mimo_mode <= PUSCH_PRECODING1)
*pmi_loc = (pmi>>((prb>>2)<<1))&3;
else
*pmi_loc=(pmi>>prb)&1;
*pmi_loc=(pmi>>prb)&1;*/
*pmi_loc = get_pmi(frame_parms->N_RB_DL,mimo_mode,pmi,prb);
pmi_loc++;
......@@ -4279,12 +4284,13 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
#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
if (mimo_mode <= PUSCH_PRECODING1)
/* if (mimo_mode <= PUSCH_PRECODING1)
*pmi_loc = (pmi>>((prb>>2)<<1))&3;
else
*pmi_loc=(pmi>>prb)&1;
// 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,prb,prb>>2,*pmi_loc,pmi_loc,rxF,dl_ch0, dl_ch1, rxF_ext,dl_ch0_ext,dl_ch1_ext);
*/
*pmi_loc = get_pmi(frame_parms->N_RB_DL,mimo_mode,pmi,prb);
pmi_loc++;
if (prb != (frame_parms->N_RB_DL>>1)) { // This PRB is not around DC
......
......@@ -242,6 +242,8 @@ 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))
......@@ -1268,7 +1270,7 @@ uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb
if (mode <= PUSCH_PRECODING1)
return((pmi_alloc>>((rb>>2)<<1))&3);
else {
//printf("Getting pmi for RB %d => %d\n",rb,((pmi_alloc>>(rb>>2))&1));
// printf("Getting pmi for RB %d => %d\n",rb,((pmi_alloc>>(rb>>2))&1));
return((pmi_alloc>>(rb>>2))&1);
}
break;
......
......@@ -1651,18 +1651,18 @@ n(tikz_fname,"w");
case 6:
dci_length = sizeof_DCI2_1_5MHz_2A_TDD_t;
dci_length_bytes = sizeof(DCI2_1_5MHz_2A_TDD_t);
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc = DLSCH_RB_ALLOC;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->TPC = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->dai = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1 = mcs1;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1 = 1;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv1 = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2 = mcs2;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2 = 1;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv2 = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->tb_swap = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->tpmi = 1;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rballoc = DLSCH_RB_ALLOC;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->TPC = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->dai = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->harq_pid = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs1 = mcs1;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi1 = 1;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv1 = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->mcs2 = mcs2;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2 = 1;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv2 = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->tb_swap = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->tpmi = 2;
break;
case 25:
dci_length = sizeof_DCI2_5MHz_2A_TDD_t;
......@@ -1697,7 +1697,7 @@ n(tikz_fname,"w");
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2 = 1;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv2 = 0;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->tb_swap = 0;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->tpmi = 1;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->tpmi = 2;
break;
case 100:
......@@ -1713,7 +1713,7 @@ n(tikz_fname,"w");
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->ndi2 = 1;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->rv2 = 0;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->tb_swap = 0;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->tpmi = 1;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->tpmi = 2;
dci_length = sizeof_DCI2_20MHz_2A_TDD_t;
dci_length_bytes = sizeof(DCI2_20MHz_2A_TDD_t);
break;
......
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