Commit b98bb25f authored by Elena Lukashova's avatar Elena Lukashova
Browse files

Merge branch 'feature-60-tm4-fork' into feature-59-tm4

1. TM4 works on dlsim_tm4.c with full HARQ support for both PIA and SIC.
parents 60eddd2c e88561e9
...@@ -1827,7 +1827,19 @@ target_link_libraries (oaisim_nos1 ${T_LIB}) ...@@ -1827,7 +1827,19 @@ target_link_libraries (oaisim_nos1 ${T_LIB})
# Unitary tests for each piece of L1: example, mbmssim is MBMS L1 simulator # Unitary tests for each piece of L1: example, mbmssim is MBMS L1 simulator
##################################### #####################################
foreach(myExe dlsim dlsim_tm4 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim) #special case for dlim TM4, which uses its own version of phy_scope code
add_executable(dlsim_tm4
${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR1_DIR}/SIMULATION/LTE_PHY/dlsim_tm4.c
${OPENAIR1_DIR}/PHY/TOOLS/lte_phy_scope_tm4.c
${T_SOURCE}
)
target_link_libraries (dlsim_tm4
-Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group
pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB}
)
foreach(myExe dlsim ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim)
add_executable(${myExe} add_executable(${myExe}
${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c ${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c
......
...@@ -952,8 +952,8 @@ void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS ...@@ -952,8 +952,8 @@ void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS
pdsch->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); pdsch->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
pdsch->dl_ch_mag0 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); pdsch->dl_ch_mag0 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
pdsch->dl_ch_magb0 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); pdsch->dl_ch_magb0 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
pdsch->dl_ch_mag1 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); //pdsch->dl_ch_mag1 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
pdsch->dl_ch_magb1 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); //pdsch->dl_ch_magb1 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
// the allocated memory size is fixed: // the allocated memory size is fixed:
AssertFatal( fp->nb_antennas_rx <= 2, "nb_antennas_rx > 2" ); AssertFatal( fp->nb_antennas_rx <= 2, "nb_antennas_rx > 2" );
...@@ -969,8 +969,8 @@ void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS ...@@ -969,8 +969,8 @@ void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS
pdsch->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_mag0[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_mag0[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_magb0[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_magb0[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_mag1[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); //pdsch->dl_ch_mag1[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_magb1[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); //pdsch->dl_ch_magb1[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
} }
} }
} }
...@@ -1079,30 +1079,37 @@ int phy_init_lte_ue(PHY_VARS_UE *ue, ...@@ -1079,30 +1079,37 @@ int phy_init_lte_ue(PHY_VARS_UE *ue,
pdsch_vars[eNB_id]->llr[1] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) ); pdsch_vars[eNB_id]->llr[1] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
pdsch_vars[eNB_id]->llr128_2ndstream = (int16_t**)malloc16_clear( sizeof(int16_t*) ); pdsch_vars[eNB_id]->llr128_2ndstream = (int16_t**)malloc16_clear( sizeof(int16_t*) );
pdsch_vars[eNB_id]->rho = (int32_t**)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t*) ); pdsch_vars[eNB_id]->rho = (int32_t**)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t*) );
for (int i=0; i<fp->nb_antennas_rx; i++) for (int i=0; i<fp->nb_antennas_rx; i++)
pdsch_vars[eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) ); pdsch_vars[eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) );
pdsch_vars[eNB_id]->dl_ch_rho2_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); pdsch_vars[eNB_id]->dl_ch_rho2_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
for (i=0; i<fp->nb_antennas_rx; i++) for (i=0; i<fp->nb_antennas_rx; i++)
for (j=0; j<4; j++) { for (j=0; j<4; j++) {
const int idx = (j<<1)+i; const int idx = (j<<1)+i;
const size_t num = 7*2*fp->N_RB_DL*12+4; const size_t num = 7*2*fp->N_RB_DL*12+4;
pdsch_vars[eNB_id]->dl_ch_rho2_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); pdsch_vars[eNB_id]->dl_ch_rho2_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
} }
const size_t num = 7*2*fp->N_RB_DL*12+4; const size_t num = 7*2*fp->N_RB_DL*12+4;
for (k=0;k<8;k++) { //harq_pid for (k=0;k<8;k++) { //harq_pid
for (l=0;l<8;l++) { //round for (l=0;l<8;l++) { //round
pdsch_vars[eNB_id]->rxdataF_comp1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); pdsch_vars[eNB_id]->rxdataF_comp1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
pdsch_vars[eNB_id]->dl_ch_rho_ext[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); pdsch_vars[eNB_id]->dl_ch_rho_ext[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
// pdsch_vars[eNB_id]->clean_x1[k][l] = (int16_t*)malloc16_clear( sizeof(int32_t) * num); pdsch_vars[eNB_id]->dl_ch_mag1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
pdsch_vars[eNB_id]->dl_ch_magb1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
for (int i=0; i<fp->nb_antennas_rx; i++) for (int i=0; i<fp->nb_antennas_rx; i++)
for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++) for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
const int idx = (j<<1)+i; const int idx = (j<<1)+i;
pdsch_vars[eNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); pdsch_vars[eNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch_vars[eNB_id]->rxdataF_comp1[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); pdsch_vars[eNB_id]->rxdataF_comp1[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch_vars[eNB_id]->dl_ch_mag1[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch_vars[eNB_id]->dl_ch_magb1[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
} }
} }
} }
......
This diff is collapsed.
...@@ -172,6 +172,8 @@ typedef struct { ...@@ -172,6 +172,8 @@ typedef struct {
uint8_t Nlayers; uint8_t Nlayers;
/// First layer for this PSCH transmission /// First layer for this PSCH transmission
uint8_t first_layer; uint8_t first_layer;
/// codeword this transport block is mapped to
uint8_t codeword;
} LTE_DL_eNB_HARQ_t; } LTE_DL_eNB_HARQ_t;
typedef struct { typedef struct {
...@@ -575,6 +577,8 @@ typedef struct { ...@@ -575,6 +577,8 @@ typedef struct {
uint32_t trials[8]; uint32_t trials[8];
/// error statistics per round /// error statistics per round
uint32_t errors[8]; uint32_t errors[8];
/// codeword this transport block is mapped to
uint8_t codeword;
} LTE_DL_UE_HARQ_t; } LTE_DL_UE_HARQ_t;
typedef struct { typedef struct {
......
...@@ -698,6 +698,7 @@ int dlsch_encoding(unsigned char *a, ...@@ -698,6 +698,7 @@ int dlsch_encoding(unsigned char *a,
nb_rb, nb_rb,
m); // r m); // r
stop_meas(rm_stats); stop_meas(rm_stats);
//printf("dlsch->harq_processes[harq_pid]->rvidx = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
#ifdef DEBUG_DLSCH_CODING #ifdef DEBUG_DLSCH_CODING
if (r==dlsch->harq_processes[harq_pid]->C-1) if (r==dlsch->harq_processes[harq_pid]->C-1)
......
...@@ -384,7 +384,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -384,7 +384,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
harq_process->round); harq_process->round);
#endif #endif
//printf("dlsch->harq_processes[harq_pid]->rvidx = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
if (lte_rate_matching_turbo_rx(harq_process->RTC[r], if (lte_rate_matching_turbo_rx(harq_process->RTC[r],
G, G,
harq_process->w[r], harq_process->w[r],
......
...@@ -37,8 +37,7 @@ ...@@ -37,8 +37,7 @@
* \note * \note
* \warning * \warning
*/ */
//#include "PHY/defs.h"
#include "PHY/defs.h"
#include "PHY/extern.h" #include "PHY/extern.h"
#include "defs.h" #include "defs.h"
#include "extern.h" #include "extern.h"
...@@ -51,6 +50,8 @@ ...@@ -51,6 +50,8 @@
#define NOCYGWIN_STATIC #define NOCYGWIN_STATIC
#endif #endif
//#define DEBUG_HARQ
//#undef LOG_D //#undef LOG_D
//#define LOG_D LOG_I //#define LOG_D LOG_I
...@@ -120,6 +121,8 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -120,6 +121,8 @@ int rx_pdsch(PHY_VARS_UE *ue,
int32_t **rxdataF_comp_ptr; int32_t **rxdataF_comp_ptr;
int32_t **dl_ch_mag_ptr; int32_t **dl_ch_mag_ptr;
int32_t codeword_TB0;
int32_t codeword_TB1;
...@@ -139,8 +142,30 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -139,8 +142,30 @@ int rx_pdsch(PHY_VARS_UE *ue,
case PDSCH: case PDSCH:
pdsch_vars = &ue->pdsch_vars[eNB_id]; pdsch_vars = &ue->pdsch_vars[eNB_id];
dlsch_ue = ue->dlsch[eNB_id]; dlsch_ue = ue->dlsch[eNB_id];
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];
#ifdef DEBUG_HARQ
printf("I am assuming both CW active\n");
#endif
}
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]; dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid];
dlsch1_harq = dlsch_ue[1]->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; break;
default: default:
...@@ -148,6 +173,10 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -148,6 +173,10 @@ int rx_pdsch(PHY_VARS_UE *ue,
return(-1); return(-1);
break; 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); DevAssert(dlsch0_harq);
round = dlsch0_harq->round; round = dlsch0_harq->round;
...@@ -274,7 +303,6 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -274,7 +303,6 @@ int rx_pdsch(PHY_VARS_UE *ue,
subframe, subframe,
ue->high_speed_flag, ue->high_speed_flag,
frame_parms); frame_parms);
else else
nb_rb = dlsch_extract_rbs_single(common_vars->rxdataF, nb_rb = dlsch_extract_rbs_single(common_vars->rxdataF,
common_vars->dl_ch_estimates[eNB_id], common_vars->dl_ch_estimates[eNB_id],
...@@ -306,7 +334,6 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -306,7 +334,6 @@ int rx_pdsch(PHY_VARS_UE *ue,
aarx = frame_parms->nb_antennas_rx; aarx = frame_parms->nb_antennas_rx;
if (dlsch0_harq->mimo_mode<LARGE_CDD) {// SISO or ALAMOUTI if (dlsch0_harq->mimo_mode<LARGE_CDD) {// SISO or ALAMOUTI
dlsch_scale_channel(pdsch_vars[eNB_id]->dl_ch_estimates_ext, dlsch_scale_channel(pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms, frame_parms,
dlsch_ue, dlsch_ue,
...@@ -334,7 +361,6 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -334,7 +361,6 @@ int rx_pdsch(PHY_VARS_UE *ue,
// printf("TM4 I-A log2_maxh0 = %d\n", pdsch_vars[eNB_id]->log2_maxh); // printf("TM4 I-A log2_maxh0 = %d\n", pdsch_vars[eNB_id]->log2_maxh);
} }
dlsch_channel_compensation(pdsch_vars[eNB_id]->rxdataF_ext, dlsch_channel_compensation(pdsch_vars[eNB_id]->rxdataF_ext,
pdsch_vars[eNB_id]->dl_ch_estimates_ext, pdsch_vars[eNB_id]->dl_ch_estimates_ext,
pdsch_vars[eNB_id]->dl_ch_mag0, pdsch_vars[eNB_id]->dl_ch_mag0,
...@@ -348,10 +374,10 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -348,10 +374,10 @@ int rx_pdsch(PHY_VARS_UE *ue,
nb_rb, nb_rb,
pdsch_vars[eNB_id]->log2_maxh, pdsch_vars[eNB_id]->log2_maxh,
measurements); // log2_maxh+I0_shift measurements); // log2_maxh+I0_shift
/*if (symbol == 5) { /*if (symbol == 5) {
write_output("rxF_comp_d.m","rxF_c_d",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); write_output("rxF_comp_d.m","rxF_c_d",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
} */ } */
if ((rx_type==rx_IC_single_stream) && if ((rx_type==rx_IC_single_stream) &&
(eNB_id_i<ue->n_connected_eNB)) { (eNB_id_i<ue->n_connected_eNB)) {
...@@ -372,7 +398,6 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -372,7 +398,6 @@ int rx_pdsch(PHY_VARS_UE *ue,
if (symbol == 5) { if (symbol == 5) {
write_output("rxF_comp_d.m","rxF_c_d",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); write_output("rxF_comp_d.m","rxF_c_d",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
write_output("rxF_comp_i.m","rxF_c_i",&pdsch_vars[eNB_id_i]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); write_output("rxF_comp_i.m","rxF_c_i",&pdsch_vars[eNB_id_i]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
} }
#endif #endif
...@@ -393,8 +418,6 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -393,8 +418,6 @@ int rx_pdsch(PHY_VARS_UE *ue,
// LOG_I(PHY,"Running PDSCH RX for TM3\n"); // LOG_I(PHY,"Running PDSCH RX for TM3\n");
if (frame_parms->nb_antennas_tx_eNB == 2) { if (frame_parms->nb_antennas_tx_eNB == 2) {
// scaling interfering channel (following for TM56) // scaling interfering channel (following for TM56)
dlsch_scale_channel(pdsch_vars[eNB_id]->dl_ch_estimates_ext, dlsch_scale_channel(pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms, frame_parms,
...@@ -418,7 +441,6 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -418,7 +441,6 @@ int rx_pdsch(PHY_VARS_UE *ue,
// write_output("dlsch0_r0_aver_chan_1.m","dl_aver_ch1_r0_0",&avg_1[0],1,1,2); // write_output("dlsch0_r0_aver_chan_1.m","dl_aver_ch1_r0_0",&avg_1[0],1,1,2);
if (rx_type>rx_standard) { if (rx_type>rx_standard) {
// Shifts are needed to avoid tails in SNR/BLER curves. // Shifts are needed to avoid tails in SNR/BLER curves.
// LUT will be introduced with mcs-dependent shift // LUT will be introduced with mcs-dependent shift
...@@ -464,7 +486,6 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -464,7 +486,6 @@ int rx_pdsch(PHY_VARS_UE *ue,
write_output("rxF_comp_d10.m","rxF_c_d10",&pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 write_output("rxF_comp_d10.m","rxF_c_d10",&pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0
write_output("rxF_comp_d11.m","rxF_c_d11",&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 write_output("rxF_comp_d11.m","rxF_c_d11",&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) // compute correlation between signal and interference channels (rho12 and rho21)
...@@ -497,8 +518,6 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -497,8 +518,6 @@ int rx_pdsch(PHY_VARS_UE *ue,
write_output("rho2_0.m","rho2_0",&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 write_output("rho2_0.m","rho2_0",&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
write_output("rho0_1.m.m","rho0_1",&pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round][1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 write_output("rho0_1.m.m","rho0_1",&pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round][1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0
write_output("rho2_1.m","rho2_1",&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 write_output("rho2_1.m","rho2_1",&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
} */ } */
} }
...@@ -512,7 +531,6 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -512,7 +531,6 @@ int rx_pdsch(PHY_VARS_UE *ue,
if ((rx_type==rx_IC_single_stream) && (eNB_id_i==ue->n_connected_eNB) && (dlsch0_harq->dl_power_off==0)) { // TM5 two-user if ((rx_type==rx_IC_single_stream) && (eNB_id_i==ue->n_connected_eNB) && (dlsch0_harq->dl_power_off==0)) { // TM5 two-user
// Scale the channel estimates for interfering stream // Scale the channel estimates for interfering stream
dlsch_scale_channel(pdsch_vars[eNB_id]->dl_ch_estimates_ext, dlsch_scale_channel(pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms, frame_parms,
dlsch_ue, dlsch_ue,
...@@ -583,7 +601,6 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -583,7 +601,6 @@ int rx_pdsch(PHY_VARS_UE *ue,
} }
dlsch_channel_compensation_TM56(pdsch_vars[eNB_id_i]->rxdataF_ext, dlsch_channel_compensation_TM56(pdsch_vars[eNB_id_i]->rxdataF_ext,
pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, pdsch_vars[eNB_id_i]->dl_ch_estimates_ext,
pdsch_vars[eNB_id_i]->dl_ch_mag0, pdsch_vars[eNB_id_i]->dl_ch_mag0,
...@@ -607,6 +624,7 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -607,6 +624,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
write_output("rxF_comp_i.m","rxF_c_i",&pdsch_vars[eNB_id_i]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); write_output("rxF_comp_i.m","rxF_c_i",&pdsch_vars[eNB_id_i]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
} }
#endif #endif
dlsch_dual_stream_correlation(frame_parms, dlsch_dual_stream_correlation(frame_parms,
symbol, symbol,
nb_rb, nb_rb,
...@@ -614,7 +632,6 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -614,7 +632,6 @@ int rx_pdsch(PHY_VARS_UE *ue,
pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, pdsch_vars[eNB_id_i]->dl_ch_estimates_ext,
pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round], pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
pdsch_vars[eNB_id]->log2_maxh); pdsch_vars[eNB_id]->log2_maxh);
} }
else if (dlsch0_harq->dl_power_off==1) { else if (dlsch0_harq->dl_power_off==1) {
...@@ -641,12 +658,9 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -641,12 +658,9 @@ int rx_pdsch(PHY_VARS_UE *ue,
avgs = cmax(avgs,avg[(aatx<<1)+aarx]); avgs = cmax(avgs,avg[(aatx<<1)+aarx]);
// avgs = cmax(avgs,avg[(aarx<<1)+aatx]); // avgs = cmax(avgs,avg[(aarx<<1)+aatx]);
pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2) + interf_unaw_shift_tm1_mcs[dlsch0_harq->mcs]; pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2) + 1;
pdsch_vars[eNB_id]->log2_maxh++;
} }
dlsch_channel_compensation_TM56(pdsch_vars[eNB_id]->rxdataF_ext, dlsch_channel_compensation_TM56(pdsch_vars[eNB_id]->rxdataF_ext,
pdsch_vars[eNB_id]->dl_ch_estimates_ext, pdsch_vars[eNB_id]->dl_ch_estimates_ext,
pdsch_vars[eNB_id]->dl_ch_mag0, pdsch_vars[eNB_id]->dl_ch_mag0,
...@@ -671,7 +685,6 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -671,7 +685,6 @@ int rx_pdsch(PHY_VARS_UE *ue,
((dlsch0_harq->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) && ((dlsch0_harq->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) &&
(dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING))){ // TM3 or TM4 (dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING))){ // TM3 or TM4
if (frame_parms->nb_antennas_tx_eNB == 2) { if (frame_parms->nb_antennas_tx_eNB == 2) {
dlsch_detection_mrc_TM34(frame_parms, dlsch_detection_mrc_TM34(frame_parms,
pdsch_vars[eNB_id], pdsch_vars[eNB_id],
harq_pid, harq_pid,
...@@ -734,7 +747,7 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -734,7 +747,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
((dlsch0_harq->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) && ((dlsch0_harq->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) &&
(dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING))) { (dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING))) {
rxdataF_comp_ptr = pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round]; rxdataF_comp_ptr = pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round];
dl_ch_mag_ptr = pdsch_vars[eNB_id]->dl_ch_mag1; dl_ch_mag_ptr = pdsch_vars[eNB_id]->dl_ch_mag1[harq_pid][round];
} }
else { else {
rxdataF_comp_ptr = pdsch_vars[eNB_id_i]->rxdataF_comp0; rxdataF_comp_ptr = pdsch_vars[eNB_id_i]->rxdataF_comp0;
...@@ -744,7 +757,7 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -744,7 +757,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
switch (dlsch0_harq->Qm) { switch (dlsch0_harq->Qm) {
case 2 : case 2 :
if (rx_type==rx_standard) { if ((rx_type==rx_standard) || (codeword_TB0 == -1) || (codeword_TB1 == -1)) {
dlsch_qpsk_llr(frame_parms, dlsch_qpsk_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0, pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[0], pdsch_vars[eNB_id]->llr[0],
...@@ -820,7 +833,7 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -820,7 +833,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
} }
break; break;
case 4 : case 4 :
if (rx_type==rx_standard) { if ((rx_type==rx_standard ) || (codeword_TB0 == -1) || (codeword_TB1 == -1)) {
dlsch_16qam_llr(frame_parms, dlsch_16qam_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0, pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[0], pdsch_vars[eNB_id]->llr[0],
...@@ -903,7 +916,7 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -903,7 +916,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
} }
break; break;
case 6 : case 6 :
if (rx_type==rx_standard) { if ((rx_type==rx_standard) || (codeword_TB0 == -1) || (codeword_TB1 == -1)) {
dlsch_64qam_llr(frame_parms, dlsch_64qam_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0, pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[0], pdsch_vars[eNB_id]->llr[0],
...@@ -1011,7 +1024,7 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -1011,7 +1024,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
dlsch_16qam_llr(frame_parms, dlsch_16qam_llr(frame_parms,
rxdataF_comp_ptr, rxdataF_comp_ptr,
pdsch_vars[eNB_id]->llr[1], pdsch_vars[eNB_id]->llr[1],
pdsch_vars[eNB_id]->dl_ch_mag1, pdsch_vars[eNB_id]->dl_ch_mag1[harq_pid][round],
symbol,first_symbol_flag,nb_rb, symbol,first_symbol_flag,nb_rb,
adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,4,subframe,symbol), adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,4,subframe,symbol),
pdsch_vars[eNB_id]->llr128_2ndstream); pdsch_vars[eNB_id]->llr128_2ndstream);
...@@ -1024,8 +1037,8 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -1024,8 +1037,8 @@ int rx_pdsch(PHY_VARS_UE *ue,
dlsch_64qam_llr(frame_parms, dlsch_64qam_llr(frame_parms,
rxdataF_comp_ptr, rxdataF_comp_ptr,
pdsch_vars[eNB_id]->llr[1], pdsch_vars[eNB_id]->llr[1],
pdsch_vars[eNB_id]->dl_ch_mag1, pdsch_vars[eNB_id]->dl_ch_mag1[harq_pid][round],
pdsch_vars[eNB_id]->dl_ch_magb1, pdsch_vars[eNB_id]->dl_ch_magb1[harq_pid][round],
symbol,first_symbol_flag,nb_rb, symbol,first_symbol_flag,nb_rb,
adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,6,subframe,symbol), adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,6,subframe,symbol),
pdsch_vars[eNB_id]->llr128_2ndstream); pdsch_vars[eNB_id]->llr128_2ndstream);
...@@ -1861,6 +1874,7 @@ void dlsch_channel_compensation_TM56(int **rxdataF_ext, ...@@ -1861,6 +1874,7 @@ void dlsch_channel_compensation_TM56(int **rxdataF_ext,
precoded_signal_strength += ((signal_energy_nodc(&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*Nre], precoded_signal_strength += ((signal_energy_nodc(&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*Nre],
(nb_rb*Nre))) - (measurements->n0_power[aarx])); (nb_rb*Nre))) - (measurements->n0_power[aarx]));
// rx_antennas // rx_antennas
} }
...@@ -1900,9 +1914,9 @@ void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1900,9 +1914,9 @@ void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms,
int **rxdataF_ext = pdsch_vars->rxdataF_ext; int **rxdataF_ext = pdsch_vars->rxdataF_ext;
int **dl_ch_estimates_ext = pdsch_vars->dl_ch_estimates_ext; int **dl_ch_estimates_ext = pdsch_vars->dl_ch_estimates_ext;
int **dl_ch_mag0 = pdsch_vars->dl_ch_mag0; int **dl_ch_mag0 = pdsch_vars->dl_ch_mag0;
int **dl_ch_mag1 = pdsch_vars->dl_ch_mag1; int **dl_ch_mag1 = pdsch_vars->dl_ch_mag1[harq_pid][round];
int **dl_ch_magb0 = pdsch_vars->dl_ch_magb0; int **dl_ch_magb0 = pdsch_vars->dl_ch_magb0;
int **dl_ch_magb1 = pdsch_vars->dl_ch_magb1; int **dl_ch_magb1 = pdsch_vars->dl_ch_magb1[harq_pid][round];
int **rxdataF_comp0 = pdsch_vars->rxdataF_comp0; int **rxdataF_comp0 = pdsch_vars->rxdataF_comp0;
int **rxdataF_comp1 = pdsch_vars->rxdataF_comp1[harq_pid][round]; int **rxdataF_comp1 = pdsch_vars->rxdataF_comp1[harq_pid][round];
unsigned char *pmi_ext = pdsch_vars->pmi_ext;