Commit 9c652258 authored by Elena Lukashova's avatar Elena Lukashova

Full Support for TM4 HARQ, excpept for PUSCH precoder at this moment.

parent 630e39ae
......@@ -44,6 +44,7 @@
#include "PHY/vars.h"
#endif
#include "assertions.h"
//#define DEBUG_HARQ
//#define DEBUG_DCI
......@@ -1525,7 +1526,9 @@ int generate_eNB_dlsch_params_from_dci(int frame,
dlsch1_harq->status = ACTIVE;
dlsch0_harq->codeword=0;
dlsch1_harq->codeword=1;
#ifdef DEBUG_HARQ
printf("\n ENB: BOTH ACTIVE\n");
#endif
}
else if (TB0_active && TB1_active && tbswap==1) {
dlsch0=dlsch[0];
......@@ -1564,7 +1567,9 @@ int generate_eNB_dlsch_params_from_dci(int frame,
dlsch1_harq->codeword = 0;
dlsch0=NULL;
dlsch0_harq = NULL;
#ifdef DEBUG_HARQ
printf("\n ENB: TB0 is deactivated, retransmit TB1 transmit in TM6\n");
#endif
}
if (dlsch0 != NULL){
......@@ -2800,8 +2805,15 @@ int generate_eNB_dlsch_params_from_dci(int frame,
#endif
// compute DL power control parameters
if (dlsch0 != NULL){
computeRhoA_eNB(pdsch_config_dedicated, dlsch[0],dlsch0_harq->dl_power_off, frame_parms->nb_antennas_tx_eNB);
computeRhoB_eNB(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[0],dlsch0_harq->dl_power_off);
}
if (dlsch1 != NULL){
computeRhoA_eNB(pdsch_config_dedicated, dlsch[1],dlsch1_harq->dl_power_off, frame_parms->nb_antennas_tx_eNB);
computeRhoB_eNB(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[1],dlsch1_harq->dl_power_off);
}
return(0);
}
......@@ -4879,6 +4891,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
if ((rv2 == 1) && (mcs2 == 0)) {
TB1_active=0;
}
#ifdef DEBUG_HARQ
printf("[DCI UE]: TB0 status %d , TB1 status %d\n", TB0_active, TB1_active);
#endif
//printf("RV TB0 = %d\n", rv1);
......@@ -4898,7 +4913,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch1_harq->status = ACTIVE;
dlsch0_harq->codeword=0;
dlsch1_harq->codeword=1;
//printf("\n UE: BOTH ACTIVE\n");
#ifdef DEBUG_HARQ
printf("[DCI UE]: BOTH ACTIVE\n");
#endif
}
else if (TB0_active && TB1_active && tbswap==1) {
dlsch0=dlsch[0];
......@@ -4937,7 +4954,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch1_harq->codeword = 0;
dlsch0=NULL;
dlsch0_harq = NULL;
//printf("\n UE: TB0 is deactivated, retransmit TB1 transmit in TM6\n");
#ifdef DEBUG_HARQ
printf("[DCI UE]: TB0 is deactivated, retransmit TB1 transmit in TM6\n");
#endif
}
......@@ -4990,7 +5009,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch1_harq->rb_alloc_odd[1]= dlsch1_harq->rb_alloc_even[1];
dlsch1_harq->rb_alloc_odd[2]= dlsch1_harq->rb_alloc_even[2];
dlsch1_harq->rb_alloc_odd[3]= dlsch1_harq->rb_alloc_even[3];
dlsch1_harq->nb_rb = dlsch0_harq->nb_rb;
dlsch1_harq->nb_rb = conv_nprb(rah,
rballoc,
frame_parms->N_RB_DL);
}
......@@ -5010,6 +5031,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
if (dlsch1_harq != NULL)
dlsch1_harq->Nl = 1;
#ifdef DEBUG_HARQ
printf ("[DCI UE] tpmi = %d\n", tpmi);
#endif
if ((dlsch0 != NULL) && (dlsch1 != NULL)){ //two CW active
......@@ -5112,7 +5136,10 @@ int generate_ue_dlsch_params_from_dci(int frame,
break;
}
}
#ifdef DEBUG_HARQ
printf("[DCI UE] harq1 MIMO mode = %d\n", dlsch1_harq->mimo_mode);
#endif
//printf(" UE DCI harq0 MIMO mode = %d\n", dlsch0_harq->mimo_mode);
if ((frame_parms->mode1_flag == 1) && (dlsch0_harq != NULL))
dlsch0_harq->mimo_mode = SISO;
......@@ -5196,6 +5223,12 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch1->rnti = rnti;
}
#ifdef DEBUG_HARQ
if (dlsch0 != NULL)
printf("[DCI UE] dlsch0_harq status = %d, dlsch1_harq status = %d\n", dlsch0_harq->status, dlsch1_harq->status);
else
printf("[DCI UE] dlsch1_harq status = %d\n", dlsch1_harq->status);
#endif
break;
......@@ -5869,11 +5902,19 @@ int generate_ue_dlsch_params_from_dci(int frame,
}
#endif
dlsch[0]->active=1;
//dlsch[0]->active=1;
// compute DL power control parameters
computeRhoA_UE(pdsch_config_dedicated, dlsch[0],dlsch0_harq->dl_power_off, frame_parms->nb_antennas_tx_eNB);
computeRhoB_UE(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[0],dlsch0_harq->dl_power_off);
if (dlsch0_harq != NULL){
computeRhoA_UE(pdsch_config_dedicated, dlsch[0],dlsch0_harq->dl_power_off, frame_parms->nb_antennas_tx_eNB);
computeRhoB_UE(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[0],dlsch0_harq->dl_power_off);
}
if (dlsch1_harq != NULL) {
computeRhoA_UE(pdsch_config_dedicated, dlsch[1],dlsch1_harq->dl_power_off, frame_parms->nb_antennas_tx_eNB);
computeRhoB_UE(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[1],dlsch1_harq->dl_power_off);
}
return(0);
}
......
......@@ -37,8 +37,7 @@
* \note
* \warning
*/
#include "PHY/defs.h"
//#include "PHY/defs.h"
#include "PHY/extern.h"
#include "defs.h"
#include "extern.h"
......@@ -51,6 +50,8 @@
#define NOCYGWIN_STATIC
#endif
//#define DEBUG_HARQ
//#undef LOG_D
//#define LOG_D LOG_I
......@@ -68,9 +69,9 @@ uint8_t interf_unaw_shift1=0;
uint8_t interf_unaw_shift=0;
//inferference-free case
unsigned char interf_unaw_shift_tm4_mcs[29]={5, 3, 4, 3, 3, 2, 1, 1, 2, 0, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 0, 2, 1, 0, 1, 0, 1, 0, 0} ;
1, 1, 1, 1, 0, 2, 1, 0, 1, 0, 1, 0, 0} ;
unsigned char interf_unaw_shift_tm1_mcs[29]={5, 5, 4, 3, 3, 3, 2, 2, 4, 4, 2, 3, 3, 3, 1, 1,
0, 1, 1, 2, 5, 4, 4, 6, 5, 1, 0, 5, 6} ; // mcs 21, 26, 28 seem to be errorneous
0, 1, 1, 2, 5, 4, 4, 6, 5, 1, 0, 5, 6} ; // mcs 21, 26, 28 seem to be errorneous
/*
//original values from sebastion + same hand tuning
......@@ -139,12 +140,30 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
break;
case PDSCH:
lte_ue_pdsch_vars = &phy_vars_ue->lte_ue_pdsch_vars[eNB_id];
dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id];
codeword_TB0 = dlsch_ue[0]->harq_processes[harq_pid]->codeword;
codeword_TB1 = dlsch_ue[1]->harq_processes[harq_pid]->codeword;
dlsch0_harq = dlsch_ue[codeword_TB0]->harq_processes[harq_pid];
dlsch1_harq = dlsch_ue[codeword_TB1]->harq_processes[harq_pid];
if ((dlsch_ue[0]->harq_processes[harq_pid]->status == ACTIVE) &&
(dlsch_ue[1]->harq_processes[harq_pid]->status == ACTIVE)){
codeword_TB0 = dlsch_ue[0]->harq_processes[harq_pid]->codeword;
codeword_TB1 = dlsch_ue[1]->harq_processes[harq_pid]->codeword;
dlsch0_harq = dlsch_ue[codeword_TB0]->harq_processes[harq_pid];
dlsch1_harq = dlsch_ue[codeword_TB1]->harq_processes[harq_pid];
}
else if ((dlsch_ue[0]->harq_processes[harq_pid]->status == ACTIVE) &&
(dlsch_ue[1]->harq_processes[harq_pid]->status != ACTIVE) ) {
codeword_TB0 = dlsch_ue[0]->harq_processes[harq_pid]->codeword;
dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid];
dlsch1_harq = NULL;
codeword_TB1 = -1;
}
else if ((dlsch_ue[0]->harq_processes[harq_pid]->status != ACTIVE) &&
(dlsch_ue[1]->harq_processes[harq_pid]->status == ACTIVE) ){
codeword_TB1 = dlsch_ue[1]->harq_processes[harq_pid]->codeword;
dlsch0_harq = dlsch_ue[1]->harq_processes[harq_pid];
dlsch1_harq = NULL;
codeword_TB0 = -1;
}
break;
default:
......@@ -152,6 +171,10 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
return(-1);
break;
}
#ifdef DEBUG_HARQ
printf("[DEMOD] MIMO mode = %d\n", dlsch0_harq->mimo_mode);
printf("[DEMOD] cw for TB0 = %d, cw for TB1 = %d\n", codeword_TB0, codeword_TB1);
#endif
DevAssert(dlsch0_harq);
round = dlsch0_harq->round;
......@@ -216,11 +239,11 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
subframe,
phy_vars_ue->high_speed_flag,
frame_parms,
dlsch0_harq->mimo_mode);
dlsch0_harq->mimo_mode);
//#ifdef DEBUG_DLSCH_MOD
/* 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("%d",lte_ue_pdsch_vars[eNB_id]->pmi_ext[rb]);
printf("\n");*/
//#endif
......@@ -237,7 +260,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
subframe,
phy_vars_ue->high_speed_flag,
frame_parms,
dlsch0_harq->mimo_mode);
dlsch0_harq->mimo_mode);
else
nb_rb = dlsch_extract_rbs_dual(lte_ue_common_vars->rxdataF,
lte_ue_common_vars->dl_ch_estimates[eNB_id],
......@@ -250,7 +273,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
subframe,
phy_vars_ue->high_speed_flag,
frame_parms,
dlsch0_harq->mimo_mode);
dlsch0_harq->mimo_mode);
}
} // if n_tx>1
else {
......@@ -311,14 +334,15 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
if (dlsch0_harq->mimo_mode<LARGE_CDD) {// SISO or ALAMOUTI
dlsch_scale_channel(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
dlsch_ue,
symbol,
nb_rb);
frame_parms,
dlsch_ue,
symbol,
nb_rb);
if (first_symbol_flag==1) {
dlsch_channel_level(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
dlsch_channel_level(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
avg,
symbol,
......@@ -339,7 +363,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
}
dlsch_channel_compensation(lte_ue_pdsch_vars[eNB_id]->rxdataF_ext,
dlsch_channel_compensation(lte_ue_pdsch_vars[eNB_id]->rxdataF_ext,
lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0,
lte_ue_pdsch_vars[eNB_id]->dl_ch_magb0,
......@@ -359,7 +383,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
if ((rx_type==rx_IC_single_stream) &&
(eNB_id_i<phy_vars_ue->n_connected_eNB)) {
dlsch_channel_compensation(lte_ue_pdsch_vars[eNB_id_i]->rxdataF_ext,
dlsch_channel_compensation(lte_ue_pdsch_vars[eNB_id_i]->rxdataF_ext,
lte_ue_pdsch_vars[eNB_id_i]->dl_ch_estimates_ext,
lte_ue_pdsch_vars[eNB_id_i]->dl_ch_mag0,
lte_ue_pdsch_vars[eNB_id_i]->dl_ch_magb0,
......@@ -399,23 +423,23 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
if (frame_parms->nb_antennas_tx_eNB == 2) {
// scaling interfering channel (following for TM56)
dlsch_scale_channel(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
dlsch_ue,
symbol,
nb_rb);
// scaling interfering channel (following for TM56)
dlsch_scale_channel(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
dlsch_ue,
symbol,
nb_rb);
if (first_symbol_flag==1) {
// effective channel of desired user is always stronger than interfering eff. channel
dlsch_channel_level_TM34(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
lte_ue_pdsch_vars[eNB_id]->pmi_ext,
lte_ue_pdsch_vars[eNB_id]->pmi_ext,
avg_0,
avg_1,
symbol,
nb_rb,
avg_1,
symbol,
nb_rb,
dlsch0_harq->mimo_mode);
......@@ -423,27 +447,27 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
// write_output("dlsch0_r0_aver_chan_1.m","dl_aver_ch1_r0_0",&avg_1[0],1,1,2);
if (rx_type>rx_standard) {
// Shifts are needed to avoid tails in SNR/BLER curves.
// LUT will be introduced with mcs-dependent shift
avg_0[0] = (log2_approx(avg_0[0])/2) -13 + interf_unaw_shift;
avg_1[0] = (log2_approx(avg_1[0])/2) -13 + interf_unaw_shift;
lte_ue_pdsch_vars[eNB_id]->log2_maxh0 = cmax(avg_0[0],0);
lte_ue_pdsch_vars[eNB_id]->log2_maxh1 = cmax(avg_1[0],0);
//printf("TM4 I-A log2_maxh0 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh0);
//printf("TM4 I-A log2_maxh1 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh1);
}
else {
// Shifts are needed to avoid tails in SNR/BLER curves.
// LUT will be introduced with mcs-dependent shift
avg_0[0] = (log2_approx(avg_0[0])/2) - 13 + interf_unaw_shift;
avg_1[0] = (log2_approx(avg_1[0])/2) - 13 + interf_unaw_shift;
lte_ue_pdsch_vars[eNB_id]->log2_maxh0 = cmax(avg_0[0],0);
lte_ue_pdsch_vars[eNB_id]->log2_maxh1 = cmax(avg_1[0],0);
//printf("TM4 I-UA log2_maxh0 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh0);
//printf("TM4 I-UA log2_maxh1 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh1);
if (rx_type>rx_standard) {
// Shifts are needed to avoid tails in SNR/BLER curves.
// LUT will be introduced with mcs-dependent shift
avg_0[0] = (log2_approx(avg_0[0])/2) -13 + interf_unaw_shift;
avg_1[0] = (log2_approx(avg_1[0])/2) -13 + interf_unaw_shift;
lte_ue_pdsch_vars[eNB_id]->log2_maxh0 = cmax(avg_0[0],0);
lte_ue_pdsch_vars[eNB_id]->log2_maxh1 = cmax(avg_1[0],0);
//printf("TM4 I-A log2_maxh0 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh0);
//printf("TM4 I-A log2_maxh1 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh1);
}
else {
// Shifts are needed to avoid tails in SNR/BLER curves.
// LUT will be introduced with mcs-dependent shift
avg_0[0] = (log2_approx(avg_0[0])/2) - 13 + interf_unaw_shift;
avg_1[0] = (log2_approx(avg_1[0])/2) - 13 + interf_unaw_shift;
lte_ue_pdsch_vars[eNB_id]->log2_maxh0 = cmax(avg_0[0],0);
lte_ue_pdsch_vars[eNB_id]->log2_maxh1 = cmax(avg_1[0],0);
//printf("TM4 I-UA log2_maxh0 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh0);
//printf("TM4 I-UA log2_maxh1 = %d\n", lte_ue_pdsch_vars[eNB_id]->log2_maxh1);
}
}
......@@ -459,7 +483,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
dlsch0_harq->mimo_mode,
nb_rb,
lte_ue_pdsch_vars[eNB_id]->log2_maxh0,
lte_ue_pdsch_vars[eNB_id]->log2_maxh1);
lte_ue_pdsch_vars[eNB_id]->log2_maxh1);
/* if (symbol == 5) {
......@@ -469,11 +493,11 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
write_output("rxF_comp_d11.m","rxF_c_d11",&lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round][1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be QAM
} */
} */
// compute correlation between signal and interference channels (rho12 and rho21)
dlsch_dual_stream_correlation(frame_parms, // this is doing h11'*h12 and h21'*h22
dlsch_dual_stream_correlation(frame_parms, // this is doing h11'*h12 and h21'*h22
symbol,
nb_rb,
lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
......@@ -481,17 +505,17 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
lte_ue_pdsch_vars[eNB_id]->dl_ch_rho2_ext,
lte_ue_pdsch_vars[eNB_id]->log2_maxh0);
//printf("rho stream1 =%d\n", &lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round] );
//printf("rho stream1 =%d\n", &lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round] );
//to be optimized (just take complex conjugate)
dlsch_dual_stream_correlation(frame_parms, // this is doing h12'*h11 and h22'*h21
symbol,
nb_rb,
&(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[2]),
&(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[2]),
lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
lte_ue_pdsch_vars[eNB_id]->log2_maxh1);
lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
lte_ue_pdsch_vars[eNB_id]->log2_maxh1);
// printf("rho stream2 =%d\n",&lte_ue_pdsch_vars[eNB_id]->dl_ch_rho2_ext );
//printf("TM3 log2_maxh : %d\n",lte_ue_pdsch_vars[eNB_id]->log2_maxh);
......@@ -503,7 +527,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
write_output("rho2_1.m","rho2_1",&lte_ue_pdsch_vars[eNB_id]->dl_ch_rho2_ext[1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be QAM
} */
} */
}
else {
......@@ -534,11 +558,11 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
// effective channel of desired user is always stronger than interfering eff. channel
dlsch_channel_level_TM56(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
lte_ue_pdsch_vars[eNB_id]->pmi_ext,
avg,
symbol,
nb_rb);
frame_parms,
lte_ue_pdsch_vars[eNB_id]->pmi_ext,
avg,
symbol,
nb_rb);
// LOG_D(PHY,"llr_offset = %d\n",offset_mumimo_llr_drange[dlsch0_harq->mcs][(i_mod>>1)-1]);
avg[0] = log2_approx(avg[0]) - 13 + offset_mumimo_llr_drange[dlsch0_harq->mcs][(i_mod>>1)-1];
......@@ -623,13 +647,14 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
else if (dlsch0_harq->dl_power_off==1) {
dlsch_scale_channel(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
dlsch_ue,
symbol,
nb_rb);
frame_parms,
dlsch_ue,
symbol,
nb_rb);
if (first_symbol_flag==1) {
dlsch_channel_level(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
dlsch_channel_level(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
avg,
symbol,
......@@ -638,19 +663,19 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
LOG_D(PHY,"[DLSCH] avg[0] %d\n",avg[0]);
#endif
avgs = 0;
avgs = 0;
for (aatx=0;aatx<frame_parms->nb_antennas_tx_eNB;aatx++)
for (aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++)
avgs = cmax(avgs,avg[(aatx<<1)+aarx]);
// avgs = cmax(avgs,avg[(aarx<<1)+aatx]);
for (aatx=0;aatx<frame_parms->nb_antennas_tx_eNB;aatx++)
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) + 1;
lte_ue_pdsch_vars[eNB_id]->log2_maxh++;
}
dlsch_channel_compensation_TM56(lte_ue_pdsch_vars[eNB_id]->rxdataF_ext,
lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0,
......@@ -676,20 +701,20 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
(dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING))){ // TM3 or TM4
if (frame_parms->nb_antennas_tx_eNB == 2) {
dlsch_detection_mrc_TM34(frame_parms,
dlsch_detection_mrc_TM34(frame_parms,
lte_ue_pdsch_vars[eNB_id],
harq_pid,
harq_pid,
dlsch0_harq->round,
symbol,
nb_rb,
1);
symbol,
nb_rb,
1);
/* if (symbol == 5) {
write_output("rho0_mrc.m","rho0_0",&lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);// should be QAM
write_output("rho2_mrc.m","rho2_0",&lte_ue_pdsch_vars[eNB_id]->dl_ch_rho2_ext[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0
} */
} */
}
......@@ -748,7 +773,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
switch (dlsch0_harq->Qm) {
case 2 :
if (rx_type==rx_standard) {
if ((rx_type==rx_standard) || (codeword_TB0 = 1)) {
dlsch_qpsk_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
lte_ue_pdsch_vars[eNB_id]->llr[0],
......@@ -824,7 +849,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
}
break;
case 4 :
if (rx_type==rx_standard) {
if ((rx_type==rx_standard ) || (codeword_TB0 = 1) ) {
dlsch_16qam_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
lte_ue_pdsch_vars[eNB_id]->llr[0],
......@@ -833,7 +858,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,4,subframe,symbol),
lte_ue_pdsch_vars[eNB_id]->llr128);
}
else if (rx_type >= rx_IC_single_stream) {
else if ((rx_type >= rx_IC_single_stream) && (codeword_TB0 != -1)) {
if (dlsch1_harq->Qm == 2) {
dlsch_16qam_qpsk_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
......@@ -857,57 +882,57 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
}
}
else if (dlsch1_harq->Qm == 4) {
dlsch_16qam_16qam_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
rxdataF_comp_ptr,//i
lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0,
dl_ch_mag_ptr,//i
lte_ue_pdsch_vars[eNB_id]->dl_ch_rho2_ext,
lte_ue_pdsch_vars[eNB_id]->llr[0],
symbol,first_symbol_flag,nb_rb,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,4,subframe,symbol),
lte_ue_pdsch_vars[eNB_id]->llr128);
if (rx_type==rx_IC_dual_stream) {
dlsch_16qam_16qam_llr(frame_parms,
rxdataF_comp_ptr,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,//i
dl_ch_mag_ptr,
lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0,//i
lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
lte_ue_pdsch_vars[eNB_id]->llr[1],
symbol,first_symbol_flag,nb_rb,
adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,4,subframe,symbol),
lte_ue_pdsch_vars[eNB_id]->llr128_2ndstream);
}
dlsch_16qam_16qam_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
rxdataF_comp_ptr,//i
lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0,
dl_ch_mag_ptr,//i
lte_ue_pdsch_vars[eNB_id]->dl_ch_rho2_ext,
lte_ue_pdsch_vars[eNB_id]->llr[0],
symbol,first_symbol_flag,nb_rb,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,4,subframe,symbol),
lte_ue_pdsch_vars[eNB_id]->llr128);
if (rx_type==rx_IC_dual_stream) {
dlsch_16qam_16qam_llr(frame_parms,
rxdataF_comp_ptr,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,//i
dl_ch_mag_ptr,
lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0,//i
lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
lte_ue_pdsch_vars[eNB_id]->llr[1],
symbol,first_symbol_flag,nb_rb,
adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,4,subframe,symbol),
lte_ue_pdsch_vars[eNB_id]->llr128_2ndstream);
}
}
else {
dlsch_16qam_64qam_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
rxdataF_comp_ptr,//i
lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0,
dl_ch_mag_ptr,//i
lte_ue_pdsch_vars[eNB_id]->dl_ch_rho2_ext,
lte_ue_pdsch_vars[eNB_id]->llr[0],
symbol,first_symbol_flag,nb_rb,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,4,subframe,symbol),
lte_ue_pdsch_vars[eNB_id]->llr128);
if (rx_type==rx_IC_dual_stream) {
dlsch_64qam_16qam_llr(frame_parms,
rxdataF_comp_ptr,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
dl_ch_mag_ptr,
lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0,
lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
lte_ue_pdsch_vars[eNB_id]->llr[1],
symbol,first_symbol_flag,nb_rb,
adjust_G2(frame_parms,