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 @@ ...@@ -44,6 +44,7 @@
#include "PHY/vars.h" #include "PHY/vars.h"
#endif #endif
#include "assertions.h" #include "assertions.h"
//#define DEBUG_HARQ
//#define DEBUG_DCI //#define DEBUG_DCI
...@@ -1525,7 +1526,9 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -1525,7 +1526,9 @@ int generate_eNB_dlsch_params_from_dci(int frame,
dlsch1_harq->status = ACTIVE; dlsch1_harq->status = ACTIVE;
dlsch0_harq->codeword=0; dlsch0_harq->codeword=0;
dlsch1_harq->codeword=1; dlsch1_harq->codeword=1;
#ifdef DEBUG_HARQ
printf("\n ENB: BOTH ACTIVE\n"); printf("\n ENB: BOTH ACTIVE\n");
#endif
} }
else if (TB0_active && TB1_active && tbswap==1) { else if (TB0_active && TB1_active && tbswap==1) {
dlsch0=dlsch[0]; dlsch0=dlsch[0];
...@@ -1564,7 +1567,9 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -1564,7 +1567,9 @@ int generate_eNB_dlsch_params_from_dci(int frame,
dlsch1_harq->codeword = 0; dlsch1_harq->codeword = 0;
dlsch0=NULL; dlsch0=NULL;
dlsch0_harq = NULL; dlsch0_harq = NULL;
#ifdef DEBUG_HARQ
printf("\n ENB: TB0 is deactivated, retransmit TB1 transmit in TM6\n"); printf("\n ENB: TB0 is deactivated, retransmit TB1 transmit in TM6\n");
#endif
} }
if (dlsch0 != NULL){ if (dlsch0 != NULL){
...@@ -2800,8 +2805,15 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -2800,8 +2805,15 @@ int generate_eNB_dlsch_params_from_dci(int frame,
#endif #endif
// compute DL power control parameters // 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); 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); 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); return(0);
} }
...@@ -4879,6 +4891,9 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -4879,6 +4891,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
if ((rv2 == 1) && (mcs2 == 0)) { if ((rv2 == 1) && (mcs2 == 0)) {
TB1_active=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); //printf("RV TB0 = %d\n", rv1);
...@@ -4898,7 +4913,9 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -4898,7 +4913,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch1_harq->status = ACTIVE; dlsch1_harq->status = ACTIVE;
dlsch0_harq->codeword=0; dlsch0_harq->codeword=0;
dlsch1_harq->codeword=1; 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) { else if (TB0_active && TB1_active && tbswap==1) {
dlsch0=dlsch[0]; dlsch0=dlsch[0];
...@@ -4937,7 +4954,9 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -4937,7 +4954,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch1_harq->codeword = 0; dlsch1_harq->codeword = 0;
dlsch0=NULL; dlsch0=NULL;
dlsch0_harq = 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, ...@@ -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[1]= dlsch1_harq->rb_alloc_even[1];
dlsch1_harq->rb_alloc_odd[2]= dlsch1_harq->rb_alloc_even[2]; 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->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, ...@@ -5010,6 +5031,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
if (dlsch1_harq != NULL) if (dlsch1_harq != NULL)
dlsch1_harq->Nl = 1; dlsch1_harq->Nl = 1;
#ifdef DEBUG_HARQ
printf ("[DCI UE] tpmi = %d\n", tpmi);
#endif
if ((dlsch0 != NULL) && (dlsch1 != NULL)){ //two CW active if ((dlsch0 != NULL) && (dlsch1 != NULL)){ //two CW active
...@@ -5112,7 +5136,10 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -5112,7 +5136,10 @@ int generate_ue_dlsch_params_from_dci(int frame,
break; 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)) if ((frame_parms->mode1_flag == 1) && (dlsch0_harq != NULL))
dlsch0_harq->mimo_mode = SISO; dlsch0_harq->mimo_mode = SISO;
...@@ -5196,6 +5223,12 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -5196,6 +5223,12 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch1->rnti = rnti; 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; break;
...@@ -5869,11 +5902,19 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -5869,11 +5902,19 @@ int generate_ue_dlsch_params_from_dci(int frame,
} }
#endif #endif
dlsch[0]->active=1; //dlsch[0]->active=1;
// compute DL power control parameters // compute DL power control parameters
if (dlsch0_harq != NULL){
computeRhoA_UE(pdsch_config_dedicated, dlsch[0],dlsch0_harq->dl_power_off, frame_parms->nb_antennas_tx_eNB); 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); 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); return(0);
} }
......
...@@ -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
...@@ -139,12 +140,30 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -139,12 +140,30 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
break; break;
case PDSCH: case PDSCH:
lte_ue_pdsch_vars = &phy_vars_ue->lte_ue_pdsch_vars[eNB_id]; lte_ue_pdsch_vars = &phy_vars_ue->lte_ue_pdsch_vars[eNB_id];
dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id]; dlsch_ue = phy_vars_ue->dlsch_ue[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_TB0 = dlsch_ue[0]->harq_processes[harq_pid]->codeword;
codeword_TB1 = dlsch_ue[1]->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]; dlsch0_harq = dlsch_ue[codeword_TB0]->harq_processes[harq_pid];
dlsch1_harq = dlsch_ue[codeword_TB1]->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; break;
default: default:
...@@ -152,6 +171,10 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -152,6 +171,10 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_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;
...@@ -311,6 +334,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -311,6 +334,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
if (dlsch0_harq->mimo_mode<LARGE_CDD) {// SISO or ALAMOUTI if (dlsch0_harq->mimo_mode<LARGE_CDD) {// SISO or ALAMOUTI
dlsch_scale_channel(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext, dlsch_scale_channel(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms, frame_parms,
dlsch_ue, dlsch_ue,
...@@ -629,6 +653,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -629,6 +653,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
nb_rb); nb_rb);
if (first_symbol_flag==1) { 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, frame_parms,
avg, avg,
...@@ -645,12 +670,12 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -645,12 +670,12 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_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]);
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, 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_estimates_ext,
lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0, lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0,
...@@ -748,7 +773,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -748,7 +773,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_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)) {
dlsch_qpsk_llr(frame_parms, dlsch_qpsk_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
lte_ue_pdsch_vars[eNB_id]->llr[0], lte_ue_pdsch_vars[eNB_id]->llr[0],
...@@ -824,7 +849,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -824,7 +849,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
} }
break; break;
case 4 : case 4 :
if (rx_type==rx_standard) { if ((rx_type==rx_standard ) || (codeword_TB0 = 1) ) {
dlsch_16qam_llr(frame_parms, dlsch_16qam_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
lte_ue_pdsch_vars[eNB_id]->llr[0], lte_ue_pdsch_vars[eNB_id]->llr[0],
...@@ -833,7 +858,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -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), adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,4,subframe,symbol),
lte_ue_pdsch_vars[eNB_id]->llr128); 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) { if (dlsch1_harq->Qm == 2) {
dlsch_16qam_qpsk_llr(frame_parms, dlsch_16qam_qpsk_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
...@@ -907,7 +932,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -907,7 +932,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
} }
break; break;
case 6 : case 6 :
if (rx_type==rx_standard) { if ((rx_type==rx_standard) || (codeword_TB0 == -1)) {
dlsch_64qam_llr(frame_parms, dlsch_64qam_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
lte_ue_pdsch_vars[eNB_id]->llr[0], lte_ue_pdsch_vars[eNB_id]->llr[0],
...@@ -917,7 +942,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, ...@@ -917,7 +942,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,6,subframe,symbol), adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,6,subframe,symbol),
lte_ue_pdsch_vars[eNB_id]->llr128); 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) { if (dlsch1_harq->Qm == 2) {
dlsch_64qam_qpsk_llr(frame_parms, dlsch_64qam_qpsk_llr(frame_parms,
lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0,
......
...@@ -156,7 +156,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -156,7 +156,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *x0 = NULL; //dlsch0_harq->e; uint8_t *x0 = NULL; //dlsch0_harq->e;
MIMO_mode_t mimo_mode = dlsch0_harq->mimo_mode; MIMO_mode_t mimo_mode;//= dlsch0_harq->mimo_mode;
int first_layer0; //= dlsch0_harq->first_layer; int first_layer0; //= dlsch0_harq->first_layer;
int Nlayers0; // = dlsch0_harq->Nlayers; int Nlayers0; // = dlsch0_harq->Nlayers;
...@@ -1411,8 +1411,13 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1411,8 +1411,13 @@ int dlsch_modulation(int32_t **txdataF,
nsymb = (frame_parms->Ncp==0) ? 14:12; nsymb = (frame_parms->Ncp==0) ? 14:12;
if (dlsch0 != NULL){
amp_rho_a = (int16_t)(((int32_t)amp*dlsch0->sqrt_rho_a)>>13); //amp=512 in full scale; dlsch0->sqrt_rho_a=8192in Q2.13, 1 in full scale amp_rho_a = (int16_t)(((int32_t)amp*dlsch0->sqrt_rho_a)>>13); //amp=512 in full scale; dlsch0->sqrt_rho_a=8192in Q2.13, 1 in full scale
amp_rho_b = (int16_t)(((int32_t)amp*dlsch0->sqrt_rho_b)>>13); amp_rho_b = (int16_t)(((int32_t)amp*dlsch0->sqrt_rho_b)>>13);
} else{
amp_rho_a = (int16_t)(((int32_t)amp*dlsch1->sqrt_rho_a)>>13);
amp_rho_b = (int16_t)(((int32_t)amp*dlsch1->sqrt_rho_b)>>13);
}
if (mod_order0 == 4) if (mod_order0 == 4)
for (i=0; i<4; i++) { for (i=0; i<4; i++) {
...@@ -1445,6 +1450,7 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1445,6 +1450,7 @@ int dlsch_modulation(int32_t **txdataF,
// printf("num_pdcch_symbols %d, nsymb %d\n",num_pdcch_symbols,nsymb); // printf("num_pdcch_symbols %d, nsymb %d\n",num_pdcch_symbols,nsymb);
for (l=num_pdcch_symbols; l<nsymb; l++) { for (l=num_pdcch_symbols; l<nsymb; l++) {
if (dlsch0 != NULL ) {
#ifdef DEBUG_DLSCH_MODULATION #ifdef DEBUG_DLSCH_MODULATION
printf("Generating DLSCH (harq_pid %d,mimo %d, pmi_alloc0 %lx, mod0 %d, mod1 %d, rb_alloc[0] %d) in %d\n", printf("Generating DLSCH (harq_pid %d,mimo %d, pmi_alloc0 %lx, mod0 %d, mod1 %d, rb_alloc[0] %d) in %d\n",
harq_pid, harq_pid,
...@@ -1455,6 +1461,7 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1455,6 +1461,7 @@ int dlsch_modulation(int32_t **txdataF,
rb_alloc[0], rb_alloc[0],
len); len);
#endif #endif
}
if (frame_parms->Ncp==0) { // normal prefix if (frame_parms->Ncp==0) { // normal prefix
if ((l==4)||(l==11)) if ((l==4)||(l==11))
...@@ -1611,10 +1618,12 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1611,10 +1618,12 @@ int dlsch_modulation(int32_t **txdataF,
} }
} }
if (dlsch0) {
if (dlsch0_harq->Nlayers>1) { if (dlsch0_harq->Nlayers>1) {
msg("Nlayers %d: re_offset %d, symbol %d offset %d\n",dlsch0_harq->Nlayers,re_offset,l,symbol_offset); msg("Nlayers %d: re_offset %d, symbol %d offset %d\n",dlsch0_harq->Nlayers,re_offset,l,symbol_offset);
return(-1); return(-1);
} }
}
if (dlsch1) { if (dlsch1) {
if (dlsch1_harq->Nlayers>1) { if (dlsch1_harq->Nlayers>1) {
...@@ -1639,6 +1648,17 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1639,6 +1648,17 @@ int dlsch_modulation(int32_t **txdataF,
if (rb_alloc_ind > 0) { if (rb_alloc_ind > 0) {
// printf("Allocated rb %d/symbol %d, skip_half %d, subframe_offset %d, symbol_offset %d, re_offset %d, jj %d\n",rb,l,skip_half,subframe_offset,symbol_offset,re_offset,jj); // printf("Allocated rb %d/symbol %d, skip_half %d, subframe_offset %d, symbol_offset %d, re_offset %d, jj %d\n",rb,l,skip_half,subframe_offset,symbol_offset,re_offset,jj);
if (dlsch0 != NULL) {
get_pmi_temp = get_pmi(frame_parms->N_RB_DL,
dlsch0->harq_processes[harq_pid]->mimo_mode,
dlsch0->harq_processes[harq_pid]->pmi_alloc,
rb);
} else
get_pmi_temp = get_pmi(frame_parms->N_RB_DL,
dlsch1->harq_processes[harq_pid]->mimo_mode,
dlsch1->harq_processes[harq_pid]->pmi_alloc,
rb);
allocate_REs_in_RB(frame_parms, allocate_REs_in_RB(frame_parms,
txdataF, txdataF,
...@@ -1646,11 +1666,11 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1646,11 +1666,11 @@ int dlsch_modulation(int32_t **txdataF,
&jj2, &jj2,
re_offset, re_offset,
symbol_offset, symbol_offset,
dlsch0->harq_processes[harq_pid], (dlsch0 == NULL) ? NULL : dlsch0->harq_processes[harq_pid],
(dlsch1==NULL) ? NULL : dlsch1->harq_processes[harq_pid], (dlsch1 == NULL) ? NULL : dlsch1->harq_processes[harq_pid],
pilots, pilots,
((pilots) ? amp_rho_b : amp_rho_a), ((pilots) ? amp_rho_b : amp_rho_a),
get_pmi(frame_parms->N_RB_DL,dlsch0->harq_processes[harq_pid]->mimo_mode,dlsch0->harq_processes[harq_pid]->pmi_alloc,rb), get_pmi_temp,
qam_table_s0, qam_table_s0,
qam_table_s1, qam_table_s1,
&re_allocated, &re_allocated,
...@@ -1672,7 +1692,11 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1672,7 +1692,11 @@ int dlsch_modulation(int32_t **txdataF,
} }
#ifdef DEBUG_DLSCH_MODULATION #ifdef DEBUG_DLSCH_MODULATION
if (dlsch0 != NULL){
msg("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset)); msg("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset));
}else{
msg("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch1_harq->nb_rb,dlsch1_harq->rb_alloc,mod_order1,Nl1,2,0,subframe_offset));
}
#endif #endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION, VCD_FUNCTION_OUT);
......
...@@ -46,7 +46,7 @@ double get_pa_dB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated) ...@@ -46,7 +46,7 @@ double get_pa_dB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated)
} }
double computeRhoA_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, double computeRhoA_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
LTE_eNB_DLSCH_t *dlsch_eNB,int dl_power_off, uint8_t n_antenna_port){ LTE_eNB_DLSCH_t *dlsch_eNB, int dl_power_off, uint8_t n_antenna_port){
double rho_a_dB; double rho_a_dB;
double sqrt_rho_a_lin; double sqrt_rho_a_lin;
......
...@@ -1871,7 +1871,8 @@ double computeRhoA_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, ...@@ -1871,7 +1871,8 @@ double computeRhoA_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
double computeRhoB_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, double computeRhoB_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
PDSCH_CONFIG_COMMON *pdsch_config_common, PDSCH_CONFIG_COMMON *pdsch_config_common,
uint8_t n_antenna_port, uint8_t n_antenna_port,
LTE_eNB_DLSCH_t *dlsch_eNB,int dl_power_off); LTE_eNB_DLSCH_t *dlsch_eNB,
int dl_power_off);
double computeRhoA_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, double computeRhoA_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
LTE_UE_DLSCH_t *dlsch_ue, LTE_UE_DLSCH_t *dlsch_ue,
......
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
\warning \warning
*/ */
//#define DEBUG_HARQ
//#define PRINT_THROUGHPUT
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include <unistd.h> #include <unistd.h>
...@@ -163,6 +166,7 @@ int main(int argc, char **argv) ...@@ -163,6 +166,7 @@ int main(int argc, char **argv)
int n_users = 1; int n_users = 1;
int TB=0; int TB=0;
RX_type_t rx_type=rx_standard; RX_type_t rx_type=rx_standard;
unsigned char cur_harq_pid;
SCM_t channel_model=Rayleigh1; SCM_t channel_model=Rayleigh1;
...@@ -262,6 +266,7 @@ int main(int argc, char **argv) ...@@ -262,6 +266,7 @@ int main(int argc, char **argv)
double thr_cw0_tm4 = 0.0; double thr_cw0_tm4 = 0.0;
double thr_cw0_tm4_nonconst = 0.0; double thr_cw0_tm4_nonconst = 0.0;
double thr_cw0[4]={0,0,0,0}, thr_cw1[4]={0,0,0,0}, thr_cw0_tot = 0.0, thr_cw1_tot = 0.0; double thr_cw0[4]={0,0,0,0}, thr_cw1[4]={0,0,0,0}, thr_cw0_tot = 0.0, thr_cw1_tot = 0.0;
double tbs0_init=0.0, tbs1_init=0.0, rate0_init=0.0, rate1_init=0.0;
char channel_model_input[17]="I"; char channel_model_input[17]="I";
int TB0_active = 1; int TB0_active = 1;
...@@ -597,7 +602,7 @@ int main(int argc, char **argv) ...@@ -597,7 +602,7 @@ int main(int argc, char **argv)
printf("-o Sample offset for receiver\n"); printf("-o Sample offset for receiver\n");
printf("-s Starting SNR, runs from SNR to SNR+%.1fdB in steps of %.1fdB. If n_frames is 1 then just SNR is simulated and MATLAB/OCTAVE output is generated\n", snr_int, snr_step); printf("-s Starting SNR, runs from SNR to SNR+%.1fdB in steps of %.1fdB. If n_frames is 1 then just SNR is simulated and MATLAB/OCTAVE output is generated\n", snr_int, snr_step);
printf("-f step size of SNR, default value is 1.\n"); printf("-f step size of SNR, default value is 1.\n");
printf("-r ressource block allocation (see section 7.1.6.3 in 36.213\n"); printf("-r resource block allocation (see section 7.1.6.3 in 36.213\n");
printf("-g Channel model, possible values are 3GPP 25.814 SCM-A/B/C/D('A','B','C','D'), 36-101 EPA('E'), EVA ('F'),ETU('G'), Rayghleigh8 ('H'), Rayleigh1('I'), Rayleigh1_corr('J'), Rayleigh1_anticorr('K'), Rice8('L'), Rice1('M'), AWGN('N'), Rayleigh1_orthogonal('P'), Rayleigh1_orth_eff_ch_TM4_prec_real ('Q'), Rayleigh1_orth_eff_ch_TM4_prec_imag ('R'), Rayleigh8_orth_eff_ch_TM4_prec_real ('S'),Rayleigh8_orth_eff_ch_TM4_prec_imag ('T') \n"); printf("-g Channel model, possible values are 3GPP 25.814 SCM-A/B/C/D('A','B','C','D'), 36-101 EPA('E'), EVA ('F'),ETU('G'), Rayghleigh8 ('H'), Rayleigh1('I'), Rayleigh1_corr('J'), Rayleigh1_anticorr('K'), Rice8('L'), Rice1('M'), AWGN('N'), Rayleigh1_orthogonal('P'), Rayleigh1_orth_eff_ch_TM4_prec_real ('Q'), Rayleigh1_orth_eff_ch_TM4_prec_imag ('R'), Rayleigh8_orth_eff_ch_TM4_prec_real ('S'),Rayleigh8_orth_eff_ch_TM4_prec_imag ('T') \n");
printf("-F forgetting factor (0 new channel every trial, 1 channel constant\n"); printf("-F forgetting factor (0 new channel every trial, 1 channel constant\n");
printf("-x Transmission mode (1,2,6 for the moment)\n"); printf("-x Transmission mode (1,2,6 for the moment)\n");
...@@ -607,7 +612,7 @@ int main(int argc, char **argv) ...@@ -607,7 +612,7 @@ int main(int argc, char **argv)
printf("-R Number of HARQ rounds (fixed)\n"); printf("-R Number of HARQ rounds (fixed)\n");
printf("-A Turns on calibration mode for abstraction.\n"); printf("-A Turns on calibration mode for abstraction.\n");
printf("-N Determines the number of Channel Realizations in Abstraction mode. Default value is 1. \n"); printf("-N Determines the number of Channel Realizations in Abstraction mode. Default value is 1. \n");
printf("-O Set the percenatge of effective rate to testbench the modem performance (typically 30 and 70, range 1-100) \n"); printf("-O Set the percentage of effective rate to testbench the modem performance (typically 30 and 70, range 1-100) \n");
printf("-I Input filename for TrCH data (binary)\n"); printf("-I Input filename for TrCH data (binary)\n");
printf("-u Receiver type: 0=standard, 1 = single stream IC (for TM3,4,5,6), 2 = dual stream IC (for TM3,4), 3 = SIC (for TM3,4) \n"); printf("-u Receiver type: 0=standard, 1 = single stream IC (for TM3,4,5,6), 2 = dual stream IC (for TM3,4), 3 = SIC (for TM3,4) \n");
exit(1); exit(1);
...@@ -736,22 +741,26 @@ int main(int argc, char **argv) ...@@ -736,22 +741,26 @@ int main(int argc, char **argv)
sprintf(bler_fname,"bler_tx%d_rec%d_chan%d_nrx%d_mcs%d_mcsi%d_u%d_imod%d.csv",transmission_mode,rx_type,channel_model,n_rx,mcs1,mcs_i,rx_type,i_mod); sprintf(bler_fname,"bler_tx%d_rec%d_chan%d_nrx%d_mcs%d_mcsi%d_u%d_imod%d.csv",transmission_mode,rx_type,channel_model,n_rx,mcs1,mcs_i,rx_type,i_mod);
else if (abstx == 1) else if (abstx == 1)
if (perfect_ce==1) if (perfect_ce==1)
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_mcs%d_mcsi%d_ab_pce_sh%d_pnort_r45.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx,mcs1, mcs2,interf_unaw_shift ); sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_ab_pce_sh%d_rpmi4.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2,interf_unaw_shift );
else else
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_mcs%d_mcsi%d_ab_sh%d_pnort_r45.csv",transmission_mode,rx_type,channel_model, n_frames, n_rx,mcs1, mcs2,interf_unaw_shift ); sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_ab_sh%d_rtpmi4.csv",transmission_mode,rx_type,channel_model, n_frames, n_rx, num_rounds, mcs1, mcs2,interf_unaw_shift );
else //abstx=0 else //abstx=0
if (perfect_ce==1) if (perfect_ce==1)
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_mcs%d_mcsi%d_pce_sh%d_pnort_r45.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx,mcs1, mcs2, interf_unaw_shift); sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_pce_sh%d_rtpmi4.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2, interf_unaw_shift);
else else
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_mcs%d_mcsi%d_sh%d_pnort_r45.csv",transmission_mode,rx_type,channel_model,n_frames,n_rx,mcs1, mcs2, interf_unaw_shift); sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_sh%d_pnort_rtpmi4.csv",transmission_mode,rx_type,channel_model,n_frames,n_rx, num_rounds, mcs1, mcs2, interf_unaw_shift);
bler_fd = fopen(bler_fname,"w"); bler_fd = fopen(bler_fname,"w");
if (bler_fd==NULL) { if (bler_fd==NULL) {
fprintf(stderr,"Cannot create file %s!\n",bler_fname); fprintf(stderr,"Cannot create file %s!\n",bler_fname);
exit(-1); exit(-1);
} }
if ((transmission_mode != 3) && (transmission_mode != 4))
fprintf(bler_fd,"SNR; MCS1; MCS2; TBS1; TBS2; rate 0; rate 1; err0_st1; err0_st2 trials0; err1_st1; err1_st2; trials1; err2_st1; err2_st2; trials2; err3_st1; err3_st2; trials3; throug 0; throug 1; sum throug; dci_err\n"); fprintf(bler_fd,"SNR; MCS1; MCS2; TBS1; TBS2; rate 0; rate 1; err0_st1; err0_st2 trials0; err1_st1; err1_st2; trials1; err2_st1; err2_st2; trials2; err3_st1; err3_st2; trials3; throug 0; throug 1; sum throug; dci_err\n");
else
fprintf(bler_fd,"SNR; MCS1; MCS2; TBS1; TBS2; rate 0; rate 1; err0_st1; err0_st2; trials0 r0; trials1 r0; err1_st1; err1_st2; trials0_r1; trials1_r1;; err2_st1; err2_st2; trials0_r2; trials1_r2; err3_st1; err3_st2; trials0_r3; trials1_r3; th0_r0; th1_r0; th_sum_r0; th0_r1; th1_r1; th_sum_r1; th0_r2; th1_r2; th_sum_r2; th0_r3; th1_r3; th_sum_r3; tot_th\n");
if (test_perf != 0) { if (test_perf != 0) {
char hostname[1024]; char hostname[1024];
...@@ -791,104 +800,6 @@ int main(int argc, char **argv) ...@@ -791,104 +800,6 @@ int main(int argc, char **argv)
} }
} }
/*
//sprintf(tikz_fname, "second_bler_tx%d_u2=%d_mcs%d_chan%d_nsimus%d.tex",transmission_mode,dual_stream_UE,mcs,channel_model,n_frames);
sprintf(tikz_fname, "second_bler_tx%d_u2%d_mcs%d_chan%d_nsimus%d",transmission_mode,dual_stream_UE,mcs,channel_model,n_frames);
tikz_fd = fopesprintf(csv_fname,"dataout_tx%d_mcs%d_mcs_interf%d_chan%d_nsimus%d_R%d_abstr_old_perf_ce_llr.m",transmission_mode,mcs1,mcs2,channel_model,n_frames,num_rounds);
n(tikz_fname,"w");
//fprintf(tikz_fd,"\\addplot[color=red, mark=o] plot coordinates {");
switch (mcs)
{
case 0:
fprintf(tikz_fd,"\\addplot[color=blue, mark=star] plot coordinates {");
break;
case 1:
fprintf(tikz_fd,"\\addplot[color=red, mark=star] plot coordinates {");
break;
case 2:
fprintf(tikz_fd,"\\addplot[color=green, mark=star] plot coordinates {");
break;
case 3:
fprintf(tikz_fd,"\\addplot[color=yellow, mark=star] plot coordinates {");
break;
case 4:
fprintf(tikz_fd,"\\addplot[color=black, mark=star] plot coordinates {");
break;
case 5:
fprintf(tikz_fd,"\\addplot[color=blue, mark=o] plot coordinates {");
break;
case 6:
fprintf(tikz_fd,"\\addplot[color=red, mark=o] plot coordinates {");
break;
case 7:
fprintf(tikz_fd,"\\addplot[color=green, mark=o] plot coordinates {");
break;
case 8:
fprintf(tikz_fd,"\\addplot[color=yellow, mark=o] plot coordinates {");
break;
case 9:
fprintf(tikz_fd,"\\addplot[color=black, mark=o] plot coordinates {");
break;
case 10:
fprintf(tikz_fd,"\\addplot[color=blue, mark=square] plot coordinates {");
break;
case 11:
fprintf(tikz_fd,"\\addplot[color=red, mark=square] plot coordinates {");
break;
case 12:
fprintf(tikz_fd,"\\addplot[color=green, mark=square] plot coordinates {");
break;
case 13:
fprintf(tikz_fd,"\\addplot[color=yellow, mark=square] plot coordinates {");
break;
case 14:
fprintf(tikz_fd,"\\addplot[color=black, mark=square] plot coordinates {");
break;
case 15:
fprintf(tikz_fd,"\\addplot[color=blue, mark=diamond] plot coordinates {");
break;
case 16:
fprintf(tikz_fd,"\\addplot[color=red, mark=diamond] plot coordinates {");
break;
case 17:
fprintf(tikz_fd,"\\addplot[color=green, mark=diamond] plot coordinates {");
break;
case 18:
fprintf(tikz_fd,"\\addplot[color=yellow, mark=diamond] plot coordinates {");
break;
case 19:
fprintf(tikz_fd,"\\addplot[color=black, mark=diamond] plot coordinates {");
break;
case 20:
fprintf(tikz_fd,"\\addplot[color=blue, mark=x] plot coordinates {");
break;
case 21:
fprintf(tikz_fd,"\\addplot[color=red, mark=x] plot coordinates {");
break;
case 22:
fprintf(tikz_fd,"\\addplot[color=green, mark=x] plot coordinates {");
break;
case 23:
fprintf(tikz_fd,"\\addplot[color=yellow, mark=x] plot coordinates {");
break;
case 24:
fprintf(tikz_fd,"\\addplot[color=black, mark=x] plot coordinates {");
break;
case 25:
fprintf(tikz_fd,"\\addplot[color=blue, mark=x] plot coordinates {");
break;
case 26:
fprintf(tikz_fd,"\\addplot[color=red, mark=+] plot coordinates {");
break;
case 27:
fprintf(tikz_fd,"\\addplot[color=green, mark=+] plot coordinates {");
break;
case 28:
fprintf(tikz_fd,"\\addplot[color=yellow, mark=+] plot coordinates {");
break;
}
*/
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double)); s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double)); s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
...@@ -1048,15 +959,6 @@ n(tikz_fname,"w"); ...@@ -1048,15 +959,6 @@ n(tikz_fname,"w");
} }
if (input_fd==NULL) { if (input_fd==NULL) {
/*
// common DCI
memcpy(&dci_alloc[num_dci].dci_pdu[0],&CCCH_alloc_pdu,sizeof(DCI1A_5MHz_TDD_1_6_t));
dci_alloc[num_dci].dci_length = sizeof_DCI1A_5MHz_TDD_1_6_t;
dci_alloc[num_dci].L = 2;
dci_alloc[num_dci].rnti = SI_RNTI;
num_dci++;
num_common_dci++;
*/
// UE specific DCI // UE specific DCI
for(k=0; k<n_users; k++) { for(k=0; k<n_users; k++) {
...@@ -2132,10 +2034,16 @@ n(tikz_fname,"w"); ...@@ -2132,10 +2034,16 @@ n(tikz_fname,"w");
//printf("Trial %d\n",trials); //printf("Trial %d\n",trials);
fflush(stdout); fflush(stdout);
round = 0; round = 0;
#ifdef DEBUG_HARQ
printf("[DLSIM] TRIAL %d\n", trials);
#endif
for (i=0; i<frame_parms->nb_antennas_tx; i++) { for (i=0; i<frame_parms->nb_antennas_tx; i++) {
memset(sic_buffer[i], 0, FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t)); memset(sic_buffer[i], 0, FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t));
} }
//PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[PHY_vars_UE->dlsch_ue[0][1]->harq_processes[PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid]->codeword],
//memset(PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[0], 0, (8*((3*8*6144)+12))*sizeof(int16_t));
//memset(PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[1], 0, (8*((3*8*6144)+12))*sizeof(int16_t));
//if (trials%100==0) //if (trials%100==0)
eNB2UE[0]->first_run = 1; eNB2UE[0]->first_run = 1;
...@@ -2144,20 +2052,33 @@ n(tikz_fname,"w"); ...@@ -2144,20 +2052,33 @@ n(tikz_fname,"w");
resend_cw0_cw1=1; resend_cw0_cw1=1;
resend_cw1=0; resend_cw1=0;
TB0_active=1;
while (((transmission_mode == 3 || transmission_mode == 4) && while (((transmission_mode == 3 || transmission_mode == 4) &&
((round < num_rounds) && (ret[0] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations) && ((round < num_rounds) && ((ret[0] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations) ||
(ret[1] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations))) || (ret[1] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations)))) ||
((transmission_mode!=4 && transmission_mode != 3) && ((round< num_rounds) && ((transmission_mode!=4 && transmission_mode != 3) && ((round< num_rounds) &&
(ret[0] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations)))) { (ret[0] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations)))) {
#ifdef DEBUG_HARQ
printf("\n [DLSIM] On top round is %d\n", round);
#endif
//printf("Trial %d, round %d , ret[0] %d, ret[1] %d, round_trials %d\n",trials,round, ret[0], ret[1], round_trials[round]);
if (ret[0] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations)
round_trials[0][round]++; round_trials[0][round]++;
round_trials[1][round]++;
//printf("Trial %d, round %d , ret[0] %d, ret[1] %d, round_trials %d\n",trials,round, ret[0], ret[1], round_trials[round]);
if (ret[1] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations) /*if (ret[0] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations) {
round_trials[0][round]++;
round_trials[1][round]++; round_trials[1][round]++;
} else if ((ret[1] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations) && (ret[0] <= PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations))
round_trials[1][round]++;*/
#ifdef DEBUG_HARQ
printf("[DLSIM] Just after while loop TB0 status %d round %d\n", TB0_active, round);
#endif
// printf("Trial %d, round %d , ret[0] %d, ret[1] %d, round_trials TB0 = %d, round_trials TB1 = %d \n",trials,round, ret[0], ret[1], round_trials[0][round], round_trials[1][round]); // printf("Trial %d, round %d , ret[0] %d, ret[1] %d, round_trials TB0 = %d, round_trials TB1 = %d \n",trials,round, ret[0], ret[1], round_trials[0][round], round_trials[1][round]);
...@@ -2200,6 +2121,8 @@ n(tikz_fname,"w"); ...@@ -2200,6 +2121,8 @@ n(tikz_fname,"w");
if (transmission_mode == 3 || transmission_mode == 4) if (transmission_mode == 3 || transmission_mode == 4)
PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->rvidx = round&3; PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->rvidx = round&3;
//printf("TB0 status %d round %d \n ", TB0_active, round);
if (round == 0) { // First round if (round == 0) { // First round
TB0_active = 1; TB0_active = 1;
...@@ -2303,6 +2226,7 @@ n(tikz_fname,"w"); ...@@ -2303,6 +2226,7 @@ n(tikz_fname,"w");
break; break;
case 5: case 5:
case 6:
DLSCH_alloc_pdu2_1E[0].ndi = trials&1; DLSCH_alloc_pdu2_1E[0].ndi = trials&1;
DLSCH_alloc_pdu2_1E[0].rv = 0; DLSCH_alloc_pdu2_1E[0].rv = 0;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu2_1E[0],sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t)); memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu2_1E[0],sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
...@@ -2401,6 +2325,7 @@ n(tikz_fname,"w"); ...@@ -2401,6 +2325,7 @@ n(tikz_fname,"w");
} }
break; break;
case 5: case 5:
case 6:
DLSCH_alloc_pdu2_1E[0].ndi = trials&1; DLSCH_alloc_pdu2_1E[0].ndi = trials&1;
DLSCH_alloc_pdu2_1E[0].rv = 0; DLSCH_alloc_pdu2_1E[0].rv = 0;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu2_1E[0],sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t)); memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu2_1E[0],sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
...@@ -2512,7 +2437,7 @@ n(tikz_fname,"w"); ...@@ -2512,7 +2437,7 @@ n(tikz_fname,"w");
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3; ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3;
} }
else { // deactivate TB0 else { // deactivate TB0
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->tpmi = 2; ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[k])->tpmi = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0; ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1; ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi2 = trials&1; ((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi2 = trials&1;
...@@ -2528,14 +2453,29 @@ n(tikz_fname,"w"); ...@@ -2528,14 +2453,29 @@ n(tikz_fname,"w");
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3; ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3;
} }
else { // deactivate TB0 else { // deactivate TB0
printf("\n Requesting only TB1 from temp DCI\n"); #ifdef DEBUG_HARQ
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 2; printf("\n[DLSIM] Requesting only TB1 from temp DCI\n");
#endif
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 4;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0; ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1; ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi2 = trials&1; ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi2 = trials&1;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3; ((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3;
} }
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_5MHz_2A_TDD_t)); memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_5MHz_2A_TDD_t));
generate_eNB_dlsch_params_from_dci(0,
subframe,
&DLSCH_alloc_pdu_1[0],
n_rnti+k,
format2,
PHY_vars_eNB->dlsch_eNB[0],
&PHY_vars_eNB->lte_frame_parms,
PHY_vars_eNB->pdsch_config_dedicated,
SI_RNTI,
0,
P_RNTI,
PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single);
break; break;
case 50: case 50:
if (TB0_active==1) { if (TB0_active==1) {
...@@ -2545,7 +2485,7 @@ n(tikz_fname,"w"); ...@@ -2545,7 +2485,7 @@ n(tikz_fname,"w");
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3; ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3;
} }
else { // deactivate TB0 else { // deactivate TB0
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 2; ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0; ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1; ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi2 = trials&1; ((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi2 = trials&1;
...@@ -2561,7 +2501,7 @@ n(tikz_fname,"w"); ...@@ -2561,7 +2501,7 @@ n(tikz_fname,"w");
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3; ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3;
} }
else { // deactivate TB0 else { // deactivate TB0
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 2; ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0; ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1; ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi2 = trials&1; ((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi2 = trials&1;
...@@ -2573,6 +2513,7 @@ n(tikz_fname,"w"); ...@@ -2573,6 +2513,7 @@ n(tikz_fname,"w");
break; break;
case 5: case 5:
case 6:
DLSCH_alloc_pdu2_1E[0].ndi = trials&1; DLSCH_alloc_pdu2_1E[0].ndi = trials&1;
DLSCH_alloc_pdu2_1E[0].rv = round&3; DLSCH_alloc_pdu2_1E[0].rv = round&3;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu2_1E[0],sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t)); memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu2_1E[0],sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
...@@ -2696,14 +2637,28 @@ n(tikz_fname,"w"); ...@@ -2696,14 +2637,28 @@ n(tikz_fname,"w");
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3; ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3;
} }
else { // deactivate TB0 else { // deactivate TB0
printf("\n Requesting only TB1 from temp DCI\n"); #ifdef DEBUG_HARQ
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 2; printf("\n [DLSIM] Requesting only TB1 from temp DCI\n");
#endif
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 4;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0; ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1; ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi2 = trials&1; ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi2 = trials&1;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3; ((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3;
} }
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_5MHz_2A_FDD_t)); memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_5MHz_2A_FDD_t));
generate_eNB_dlsch_params_from_dci(0,
subframe,
&DLSCH_alloc_pdu_1[0],
n_rnti+k,
format2,
PHY_vars_eNB->dlsch_eNB[0],
&PHY_vars_eNB->lte_frame_parms,
PHY_vars_eNB->pdsch_config_dedicated,
SI_RNTI,
0,
P_RNTI,
PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single);
break; break;
case 50: case 50:
if (TB0_active==1) { if (TB0_active==1) {
...@@ -2713,7 +2668,7 @@ n(tikz_fname,"w"); ...@@ -2713,7 +2668,7 @@ n(tikz_fname,"w");
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3; ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3;
} }
else { // deactivate TB0 else { // deactivate TB0
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 2; ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0; ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0;
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1; ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1;
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi2 = trials&1; ((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi2 = trials&1;
...@@ -2729,7 +2684,7 @@ n(tikz_fname,"w"); ...@@ -2729,7 +2684,7 @@ n(tikz_fname,"w");
((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3; ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3;
} }
else { // deactivate TB0 else { // deactivate TB0
((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 2; ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0; ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0;
((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1; ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1;
((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi2 = trials&1; ((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi2 = trials&1;
...@@ -2742,6 +2697,7 @@ n(tikz_fname,"w"); ...@@ -2742,6 +2697,7 @@ n(tikz_fname,"w");
case 5: case 5:
case 6:
DLSCH_alloc_pdu2_1E[0].ndi = trials&1; DLSCH_alloc_pdu2_1E[0].ndi = trials&1;
DLSCH_alloc_pdu2_1E[0].rv = round&3; DLSCH_alloc_pdu2_1E[0].rv = round&3;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu2_1E[0],sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t)); memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu2_1E[0],sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
...@@ -2766,8 +2722,16 @@ n(tikz_fname,"w"); ...@@ -2766,8 +2722,16 @@ n(tikz_fname,"w");
for (k=0;k<n_users;k++) { for (k=0;k<n_users;k++) {
for (int TB=0; TB<Kmimo; TB++) { for (int TB=0; TB<Kmimo; TB++) {
if (PHY_vars_eNB->dlsch_eNB[0][TB] == NULL) if (TB0_active == 0){
continue; #ifdef DEBUG_HARQ
printf("[DLSIM ENC] Skip TB0 \n");
#endif
TB++;
}
#ifdef DEBUG_HARQ
printf("[DLSIM ENC] process TB %d \n", TB);
#endif
coded_bits_per_codeword[TB] = get_G(&PHY_vars_eNB->lte_frame_parms, coded_bits_per_codeword[TB] = get_G(&PHY_vars_eNB->lte_frame_parms,
PHY_vars_eNB->dlsch_eNB[k][TB]->harq_processes[0]->nb_rb, PHY_vars_eNB->dlsch_eNB[k][TB]->harq_processes[0]->nb_rb,
...@@ -2776,8 +2740,6 @@ n(tikz_fname,"w"); ...@@ -2776,8 +2740,6 @@ n(tikz_fname,"w");
PHY_vars_eNB->dlsch_eNB[k][TB]->harq_processes[0]->Nl, PHY_vars_eNB->dlsch_eNB[k][TB]->harq_processes[0]->Nl,
num_pdcch_symbols, num_pdcch_symbols,
0,subframe); 0,subframe);
#ifdef TBS_FIX // This is for MESH operation!!! #ifdef TBS_FIX // This is for MESH operation!!!
tbs[TB] = (double)3*TBStable[get_I_TBS(PHY_vars_eNB->dlsch_eNB[k][TB]->harq_processes[0]->mcs)][PHY_vars_eNB->dlsch_eNB[k][TB]->nb_rb-1]/4; tbs[TB] = (double)3*TBStable[get_I_TBS(PHY_vars_eNB->dlsch_eNB[k][TB]->harq_processes[0]->mcs)][PHY_vars_eNB->dlsch_eNB[k][TB]->nb_rb-1]/4;
#else #else
...@@ -2842,7 +2804,7 @@ n(tikz_fname,"w"); ...@@ -2842,7 +2804,7 @@ n(tikz_fname,"w");
subframe<<1); subframe<<1);
stop_meas(&PHY_vars_eNB->dlsch_scrambling_stats); stop_meas(&PHY_vars_eNB->dlsch_scrambling_stats);
if (n_frames==1) { if (n_frames==2) {
for (s=0;s<PHY_vars_eNB->dlsch_eNB[k][TB]->harq_processes[0]->C;s++) { for (s=0;s<PHY_vars_eNB->dlsch_eNB[k][TB]->harq_processes[0]->C;s++) {
if (s<PHY_vars_eNB->dlsch_eNB[k][TB]->harq_processes[0]->Cminus) if (s<PHY_vars_eNB->dlsch_eNB[k][TB]->harq_processes[0]->Cminus)
Kr = PHY_vars_eNB->dlsch_eNB[k][TB]->harq_processes[0]->Kminus; Kr = PHY_vars_eNB->dlsch_eNB[k][TB]->harq_processes[0]->Kminus;
...@@ -2859,11 +2821,19 @@ n(tikz_fname,"w"); ...@@ -2859,11 +2821,19 @@ n(tikz_fname,"w");
subframe, subframe,
&PHY_vars_eNB->lte_frame_parms, &PHY_vars_eNB->lte_frame_parms,
num_pdcch_symbols, num_pdcch_symbols,
PHY_vars_eNB->dlsch_eNB[k][0], ((TB0_active == 1)? PHY_vars_eNB->dlsch_eNB[k][0]: NULL),
PHY_vars_eNB->dlsch_eNB[k][1]); PHY_vars_eNB->dlsch_eNB[k][1]);
stop_meas(&PHY_vars_eNB->dlsch_modulation_stats); stop_meas(&PHY_vars_eNB->dlsch_modulation_stats);
} //n_users } //n_users
if (((transmission_mode == 3) || (transmission_mode == 4)) && (SNR == snr0) && (trials == 0) && (round == 0)){
rate0_init = rate[0];
rate1_init = rate[1];
tbs0_init=tbs[0];
tbs1_init=tbs[1];
}
generate_pilots(PHY_vars_eNB, generate_pilots(PHY_vars_eNB,
PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id],
AMP, AMP,
...@@ -2889,7 +2859,7 @@ n(tikz_fname,"w"); ...@@ -2889,7 +2859,7 @@ n(tikz_fname,"w");
(subframe*2)+2, (subframe*2)+2,
&PHY_vars_eNB->lte_frame_parms); &PHY_vars_eNB->lte_frame_parms);
if (n_frames==1) { if (n_frames==2) {
write_output("txsigF0.m","txsF0", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][0][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size],nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1); write_output("txsigF0.m","txsF0", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][0][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size],nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1);
if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1) if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1)
write_output("txsigF1.m","txsF1", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][1][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size],nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1); write_output("txsigF1.m","txsF1", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][1][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size],nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1);
...@@ -2903,7 +2873,7 @@ n(tikz_fname,"w"); ...@@ -2903,7 +2873,7 @@ n(tikz_fname,"w");
} }
tx_lev_dB = (unsigned int) dB_fixed(tx_lev); tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
if (n_frames==1) { if (n_frames==2) {
write_output("txsigF0.m","txsF0", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][0][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size],nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1); write_output("txsigF0.m","txsF0", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][0][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size],nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1);
if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1) if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1)
write_output("txsigF1.m","txsF1", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][1][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size],nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1); write_output("txsigF1.m","txsF1", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][1][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size],nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1);
...@@ -2917,7 +2887,7 @@ n(tikz_fname,"w"); ...@@ -2917,7 +2887,7 @@ n(tikz_fname,"w");
} }
tx_lev_dB = (unsigned int) dB_fixed(tx_lev); tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
if (n_frames==1) { if (n_frames==2) {
printf("tx_lev = %d (%d dB)\n",tx_lev,tx_lev_dB); printf("tx_lev = %d (%d dB)\n",tx_lev,tx_lev_dB);
write_output("txsig0.m","txs0", &PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][0][subframe* PHY_vars_eNB->lte_frame_parms.samples_per_tti], PHY_vars_eNB->lte_frame_parms.samples_per_tti,1,1); write_output("txsig0.m","txs0", &PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][0][subframe* PHY_vars_eNB->lte_frame_parms.samples_per_tti], PHY_vars_eNB->lte_frame_parms.samples_per_tti,1,1);
} }
...@@ -3061,7 +3031,7 @@ n(tikz_fname,"w"); ...@@ -3061,7 +3031,7 @@ n(tikz_fname,"w");
// This is the SNR on the PDSCH for OFDM symbols without pilots -> rho_A // This is the SNR on the PDSCH for OFDM symbols without pilots -> rho_A
sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size/(double)(NB_RB*12)) - SNR - get_pa_dB(PHY_vars_eNB->pdsch_config_dedicated); sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size/(double)(NB_RB*12)) - SNR - get_pa_dB(PHY_vars_eNB->pdsch_config_dedicated);
sigma2 = pow(10,sigma2_dB/10); sigma2 = pow(10,sigma2_dB/10);
if (n_frames==1) if (n_frames==2)
printf("Sigma2 %f (sigma2_dB %f,%f,%f )\n",sigma2,sigma2_dB,10*log10((double)PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size/(double)(NB_RB*12)),get_pa_dB(PHY_vars_eNB->pdsch_config_dedicated)); printf("Sigma2 %f (sigma2_dB %f,%f,%f )\n",sigma2,sigma2_dB,10*log10((double)PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size/(double)(NB_RB*12)),get_pa_dB(PHY_vars_eNB->pdsch_config_dedicated));
for (i=0; i<2*frame_parms->samples_per_tti; i++) { for (i=0; i<2*frame_parms->samples_per_tti; i++) {
...@@ -3094,7 +3064,7 @@ n(tikz_fname,"w"); ...@@ -3094,7 +3064,7 @@ n(tikz_fname,"w");
fclose(rx_frame_file); fclose(rx_frame_file);
*/ */
if (n_frames==1) { if (n_frames==2) {
printf("RX level in null symbol %d\n",dB_fixed(signal_energy(&PHY_vars_UE->lte_ue_common_vars.rxdata[0][160+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES],OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES/2))); printf("RX level in null symbol %d\n",dB_fixed(signal_energy(&PHY_vars_UE->lte_ue_common_vars.rxdata[0][160+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES],OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES/2)));
printf("RX level in data symbol %d\n",dB_fixed(signal_energy(&PHY_vars_UE->lte_ue_common_vars.rxdata[0][160+(2*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES)],OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES/2))); printf("RX level in data symbol %d\n",dB_fixed(signal_energy(&PHY_vars_UE->lte_ue_common_vars.rxdata[0][160+(2*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES)],OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES/2)));
printf("rx_level Null symbol %f\n",10*log10(signal_energy_fp(r_re,r_im,1,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES/2,256+(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES)))); printf("rx_level Null symbol %f\n",10*log10(signal_energy_fp(r_re,r_im,1,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES/2,256+(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES))));
...@@ -3116,7 +3086,7 @@ n(tikz_fname,"w"); ...@@ -3116,7 +3086,7 @@ n(tikz_fname,"w");
// Inner receiver scheduling for 3 slots // Inner receiver scheduling for 3 slots
for (Ns=(2*subframe);Ns<((2*subframe)+3);Ns++) { for (Ns=(2*subframe);Ns<((2*subframe)+3);Ns++) {
for (l=0;l<pilot2;l++) { for (l=0;l<pilot2;l++) {
if (n_frames==1) if (n_frames==2)
printf("Ns %d, l %d, l2 %d\n",Ns, l, l+(Ns%2)*pilot2); printf("Ns %d, l %d, l2 %d\n",Ns, l, l+(Ns%2)*pilot2);
/* /*
This function implements the OFDM front end processor (FEP). This function implements the OFDM front end processor (FEP).
...@@ -3213,6 +3183,7 @@ n(tikz_fname,"w"); ...@@ -3213,6 +3183,7 @@ n(tikz_fname,"w");
pmi_feedback = 0; pmi_feedback = 0;
hold_channel = 1; hold_channel = 1;
//printf ("trial %d pmi_feedback %d \n", trials, pmi_feedback); //printf ("trial %d pmi_feedback %d \n", trials, pmi_feedback);
//printf ("go to PMI feedback\n");
goto PMI_FEEDBACK; goto PMI_FEEDBACK;
} }
} }
...@@ -3251,7 +3222,7 @@ n(tikz_fname,"w"); ...@@ -3251,7 +3222,7 @@ n(tikz_fname,"w");
round=5; // this is meant to stop the "while" loop if DCI is wrong; round=5; // this is meant to stop the "while" loop if DCI is wrong;
errs[0][0]++; errs[0][0]++;
if (n_frames==1) if (n_frames==2)
printf("DCI error trial %d errs[0][0] %d\n",trials,errs[0][0]); printf("DCI error trial %d errs[0][0] %d\n",trials,errs[0][0]);
} }
} }
...@@ -3309,7 +3280,7 @@ n(tikz_fname,"w"); ...@@ -3309,7 +3280,7 @@ n(tikz_fname,"w");
errs[0][0]++; errs[0][0]++;
round=5; round=5;
if (n_frames==1) if (n_frames==2)
printf("DCI misdetection trial %d\n",trials); printf("DCI misdetection trial %d\n",trials);
} }
...@@ -3389,9 +3360,14 @@ n(tikz_fname,"w"); ...@@ -3389,9 +3360,14 @@ n(tikz_fname,"w");
} }
if (dlsch_active == 1) { if (dlsch_active == 1) {
if (TB0_active==1)
cur_harq_pid =PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid;
else
cur_harq_pid =PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid;
if ((Ns==(1+(2*subframe))) && (l==0)) {// process PDSCH symbols 1,2,3,4,5,(6 Normal Prefix if ((Ns==(1+(2*subframe))) && (l==0)) {// process PDSCH symbols 1,2,3,4,5,(6 Normal Prefix
if (transmission_mode == 5) { if (transmission_mode == 5) {
if ((PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->dl_power_off==0) && if ((PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[cur_harq_pid]->dl_power_off==0) &&
(openair_daq_vars.use_ia_receiver ==1)) { (openair_daq_vars.use_ia_receiver ==1)) {
rx_type = rx_IC_single_stream; rx_type = rx_IC_single_stream;
} else { } else {
...@@ -3403,6 +3379,7 @@ n(tikz_fname,"w"); ...@@ -3403,6 +3379,7 @@ n(tikz_fname,"w");
start_meas(&PHY_vars_UE->dlsch_llr_stats); start_meas(&PHY_vars_UE->dlsch_llr_stats);
for (m=PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols; m<pilot2; m++) { for (m=PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols; m<pilot2; m++) {
if (rx_pdsch(PHY_vars_UE, if (rx_pdsch(PHY_vars_UE,
PDSCH, PDSCH,
eNB_id, eNB_id,
...@@ -3412,7 +3389,7 @@ n(tikz_fname,"w"); ...@@ -3412,7 +3389,7 @@ n(tikz_fname,"w");
(m==PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols)?1:0, (m==PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols)?1:0,
rx_type, rx_type,
i_mod, i_mod,
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid)==-1){ cur_harq_pid)==-1){
dlsch_active = 0; dlsch_active = 0;
break; break;
} }
...@@ -3432,7 +3409,7 @@ n(tikz_fname,"w"); ...@@ -3432,7 +3409,7 @@ n(tikz_fname,"w");
0, 0,
rx_type, rx_type,
i_mod, i_mod,
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid)==-1){ cur_harq_pid)==-1){
dlsch_active=0; dlsch_active=0;
break; break;
} }
...@@ -3452,7 +3429,7 @@ n(tikz_fname,"w"); ...@@ -3452,7 +3429,7 @@ n(tikz_fname,"w");
0, 0,
rx_type, rx_type,
i_mod, i_mod,
PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid)==-1) { cur_harq_pid)==-1) {
dlsch_active=0; dlsch_active=0;
break; break;
} }
...@@ -3485,8 +3462,22 @@ n(tikz_fname,"w"); ...@@ -3485,8 +3462,22 @@ n(tikz_fname,"w");
for (TB=0; TB<Kmimo; TB++){ // may be we ll have to swap CW for (TB=0; TB<Kmimo; TB++){ // may be we ll have to swap CW
if (PHY_vars_UE->dlsch_ue[0][TB] == NULL) /* if (PHY_vars_UE->dlsch_ue[0][TB] == NULL){
printf("[DLSIM] PHY_vars_UE->dlsch_ue[0][TB] == NULL\n");
printf("HERE HERE HERE HERE\n");
continue; continue;
}*/
if (TB0_active == 0){
#ifdef DEBUG_HARQ
printf("[DLSIM] Skip TB0 \n");
#endif
TB++;
}
#ifdef DEBUG_HARQ
printf("[DLSIM] process TB %d \n", TB);
#endif
PHY_vars_UE->dlsch_ue[0][TB]->rnti = (common_flag==0) ? n_rnti: SI_RNTI; PHY_vars_UE->dlsch_ue[0][TB]->rnti = (common_flag==0) ? n_rnti: SI_RNTI;
coded_bits_per_codeword[TB] = get_G(&PHY_vars_eNB->lte_frame_parms, coded_bits_per_codeword[TB] = get_G(&PHY_vars_eNB->lte_frame_parms,
...@@ -3500,7 +3491,7 @@ n(tikz_fname,"w"); ...@@ -3500,7 +3491,7 @@ n(tikz_fname,"w");
PHY_vars_UE->dlsch_ue[0][TB]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid]->G = coded_bits_per_codeword[TB]; PHY_vars_UE->dlsch_ue[0][TB]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid]->G = coded_bits_per_codeword[TB];
PHY_vars_UE->dlsch_ue[0][TB]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid]->Qm = get_Qm(PHY_vars_eNB->dlsch_eNB[0][TB]->harq_processes[0]->mcs); PHY_vars_UE->dlsch_ue[0][TB]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid]->Qm = get_Qm(PHY_vars_eNB->dlsch_eNB[0][TB]->harq_processes[0]->mcs);
if (n_frames==1) { if (n_frames==2) {
printf("Kmimo=%d, TB=%d, G=%d, TBS=%d\n",Kmimo,TB,coded_bits_per_codeword[TB], printf("Kmimo=%d, TB=%d, G=%d, TBS=%d\n",Kmimo,TB,coded_bits_per_codeword[TB],
PHY_vars_UE->dlsch_ue[0][TB]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid]->TBS); PHY_vars_UE->dlsch_ue[0][TB]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid]->TBS);
...@@ -3551,7 +3542,7 @@ n(tikz_fname,"w"); ...@@ -3551,7 +3542,7 @@ n(tikz_fname,"w");
start_meas(&PHY_vars_UE->dlsch_decoding_stats); start_meas(&PHY_vars_UE->dlsch_decoding_stats);
ret[TB] = dlsch_decoding(PHY_vars_UE, ret[TB] = dlsch_decoding(PHY_vars_UE,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[TB], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[PHY_vars_UE->dlsch_ue[0][TB]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid]->codeword],
&PHY_vars_UE->lte_frame_parms, &PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->dlsch_ue[0][TB], PHY_vars_UE->dlsch_ue[0][TB],
PHY_vars_UE->dlsch_ue[0][TB]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid], PHY_vars_UE->dlsch_ue[0][TB]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid],
...@@ -3559,13 +3550,19 @@ n(tikz_fname,"w"); ...@@ -3559,13 +3550,19 @@ n(tikz_fname,"w");
PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid, PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid,
1,llr8_flag); 1,llr8_flag);
stop_meas(&PHY_vars_UE->dlsch_decoding_stats); stop_meas(&PHY_vars_UE->dlsch_decoding_stats);
#ifdef DEBUG_HARQ
printf("[DLSIM] ret[%d] = %d\n", TB, ret[TB]);
#endif
//printf("retr cw 0 = %d\n", ret[0]); //printf("retr cw 0 = %d\n", ret[0]);
//printf("current round = %d\n", PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_non_sic]->current_harq_pid]->round); //printf("current round = %d\n", PHY_vars_UE->dlsch_ue[0][cw_non_sic]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw_non_sic]->current_harq_pid]->round);
if (ret[TB] <= PHY_vars_UE->dlsch_ue[0][TB]->max_turbo_iterations ) { //if CW0 is decoded, approach CW1 if (ret[TB] <= PHY_vars_UE->dlsch_ue[0][TB]->max_turbo_iterations ) { //if CW0 is decoded, approach CW1
#ifdef DEBUG_HARQ
printf("[DLSIM] TB%d is decoded\n", TB);
#endif
/*avg_iter[TB] += ret[TB]; /*avg_iter[TB] += ret[TB];
iter_trials[TB]++;*/ iter_trials[TB]++;*/
...@@ -3690,8 +3687,11 @@ n(tikz_fname,"w"); ...@@ -3690,8 +3687,11 @@ n(tikz_fname,"w");
} }
if ((PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) && if ((PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) &&
(PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->mimo_mode <=DUALSTREAM_PUSCH_PRECODING) && (PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->mimo_mode <=DUALSTREAM_PUSCH_PRECODING) && (TB0_active == 1) &&
rx_type==rx_SIC_dual_stream) { (rx_type==rx_SIC_dual_stream)) {
#ifdef DEBUG_HARQ
printf("[DLSIM] Starting SIC procedure\n");
#endif
// printf("current round = %d\n", PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->round); // printf("current round = %d\n", PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->round);
...@@ -3699,10 +3699,14 @@ n(tikz_fname,"w"); ...@@ -3699,10 +3699,14 @@ n(tikz_fname,"w");
//printf("\n ret[TB0] = %d round %d\n", ret[TB], round); //printf("\n ret[TB0] = %d round %d\n", ret[TB], round);
for (round_sic = 0 ; round_sic < (round +1); round_sic++) { for (round_sic = 0 ; round_sic < (round +1); round_sic++) {
#ifdef DEBUG_HARQ
printf("[DLSIM] 0 Round sic = %d\n", round_sic);
#endif
//printf("I enter round_sic loop \n"); //printf("I enter round_sic loop \n");
//printf("round_sic= %d\n", round_sic); //printf("round_sic= %d\n", round_sic);
dlsch0_ue_harq = PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]; dlsch0_ue_harq = PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][1]->current_harq_pid];
dlsch0_eNB_harq = PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]; dlsch0_eNB_harq = PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][1]->current_harq_pid];
dlsch0_eNB_harq->mimo_mode = PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->mimo_mode; dlsch0_eNB_harq->mimo_mode = PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->mimo_mode;
dlsch0_eNB_harq->rb_alloc[0] = dlsch0_ue_harq->rb_alloc_even[0]; dlsch0_eNB_harq->rb_alloc[0] = dlsch0_ue_harq->rb_alloc_even[0];
...@@ -3730,7 +3734,7 @@ n(tikz_fname,"w"); ...@@ -3730,7 +3734,7 @@ n(tikz_fname,"w");
&PHY_vars_UE->dlsch_interleaving_stats); &PHY_vars_UE->dlsch_interleaving_stats);
coded_bits_per_codeword[TB]= get_G(&PHY_vars_UE->lte_frame_parms, coded_bits_per_codeword[0]= get_G(&PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_eNB[eNB_id]->current_harq_pid]->nb_rb, PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_eNB[eNB_id]->current_harq_pid]->nb_rb,
PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_eNB[eNB_id]->current_harq_pid]->rb_alloc, PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_eNB[eNB_id]->current_harq_pid]->rb_alloc,
get_Qm(PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_eNB[eNB_id]->current_harq_pid]->mcs), get_Qm(PHY_vars_UE->dlsch_eNB[eNB_id]->harq_processes[PHY_vars_UE->dlsch_eNB[eNB_id]->current_harq_pid]->mcs),
...@@ -3752,38 +3756,39 @@ n(tikz_fname,"w"); ...@@ -3752,38 +3756,39 @@ n(tikz_fname,"w");
num_pdcch_symbols, num_pdcch_symbols,
&PHY_vars_UE->dlsch_eNB[0][0], &PHY_vars_UE->dlsch_eNB[0][0],
NULL, NULL,
coded_bits_per_codeword[TB]); coded_bits_per_codeword[0]);
// write_output("sic_buffer.m","sic", *sic_buffer,re_allocated,1,1); // write_output("sic_buffer.m","sic", *sic_buffer,re_allocated,1,1);
// write_output("rxdataF_comp1.m","rxF_comp1", *PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],14*12*25,1,1); // write_output("rxdataF_comp1.m","rxF_comp1", *PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],14*12*25,1,1);
// write_output("rxdataF_rho.m","rho", *PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],14*12*25,1,1); // write_output("rxdataF_rho.m","rho", *PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round],14*12*25,1,1);
switch (get_Qm(PHY_vars_eNB->dlsch_eNB[0][TB+1]->harq_processes[0]->mcs)){ switch (get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)){
case 2: case 2:
dlsch_qpsk_llr_SIC(&PHY_vars_UE->lte_frame_parms, dlsch_qpsk_llr_SIC(&PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid][round_sic], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round_sic],
sic_buffer, sic_buffer,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid][round_sic], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round_sic],
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB+1]->current_harq_pid]->codeword], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[PHY_vars_UE->dlsch_ue[0][1]->harq_processes[PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid]->codeword],
num_pdcch_symbols, num_pdcch_symbols,
dlsch0_eNB_harq->nb_rb, dlsch0_eNB_harq->nb_rb,
subframe, subframe,
dlsch0_eNB_harq->rb_alloc[0], dlsch0_eNB_harq->rb_alloc[0],
get_Qm(PHY_vars_eNB->dlsch_eNB[0][TB]->harq_processes[0]->mcs), get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs),
PHY_vars_UE->dlsch_ue[eNB_id][TB]); PHY_vars_UE->dlsch_ue[eNB_id][0]);
break; break;
case 4: case 4:
dlsch_16qam_llr_SIC(&PHY_vars_UE->lte_frame_parms, dlsch_16qam_llr_SIC(&PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid][round_sic], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round_sic],
sic_buffer, sic_buffer,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid][round_sic], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round_sic],
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB+1]->current_harq_pid]->codeword], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[PHY_vars_UE->dlsch_ue[0][1]->harq_processes[PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid]->codeword],
num_pdcch_symbols, num_pdcch_symbols,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_mag1[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid][round_sic], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_mag1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round_sic],
dlsch0_eNB_harq->nb_rb, dlsch0_eNB_harq->nb_rb,
subframe, subframe,
dlsch0_eNB_harq->rb_alloc[0], dlsch0_eNB_harq->rb_alloc[0],
...@@ -3792,67 +3797,70 @@ n(tikz_fname,"w"); ...@@ -3792,67 +3797,70 @@ n(tikz_fname,"w");
break; break;
case 6: case 6:
dlsch_64qam_llr_SIC(&PHY_vars_UE->lte_frame_parms, dlsch_64qam_llr_SIC(&PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid][round_sic], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round_sic],
sic_buffer, sic_buffer,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid][round_sic], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round_sic],
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB+1]->current_harq_pid]->codeword], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[PHY_vars_UE->dlsch_ue[0][1]->harq_processes[PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid]->codeword],
num_pdcch_symbols, num_pdcch_symbols,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_mag1[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid][round_sic], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_mag1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round_sic],
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_magb1[PHY_vars_UE->dlsch_ue[0][TB]->current_harq_pid][round_sic], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->dl_ch_magb1[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid][round_sic],
dlsch0_eNB_harq->nb_rb, dlsch0_eNB_harq->nb_rb,
subframe, subframe,
dlsch0_eNB_harq->rb_alloc[0], dlsch0_eNB_harq->rb_alloc[0],
get_Qm(PHY_vars_eNB->dlsch_eNB[0][TB]->harq_processes[0]->mcs), get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs),
PHY_vars_UE->dlsch_ue[eNB_id][TB]); PHY_vars_UE->dlsch_ue[eNB_id][TB]);
break; break;
} }
} //}// rouns sic
#ifdef DEBUG_HARQ
printf("[DLSIM] TB1 is mapped into CW%d\n", PHY_vars_UE->dlsch_ue[0][1]->harq_processes[PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid]->codeword);
#endif
// write_output("rxdata_llr1.m","llr1", PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[1],re_allocated*2,1,0); // write_output("rxdata_llr1.m","llr1", PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[1],re_allocated*2,1,0);
// replace cw_sic with TB+1 // replace cw_sic with TB+1
PHY_vars_UE->dlsch_ue[0][TB+1]->rnti = (common_flag==0) ? n_rnti: SI_RNTI; PHY_vars_UE->dlsch_ue[0][1]->rnti = (common_flag==0) ? n_rnti: SI_RNTI;
coded_bits_per_codeword[TB+1]= get_G(&PHY_vars_eNB->lte_frame_parms, coded_bits_per_codeword[1]= get_G(&PHY_vars_eNB->lte_frame_parms,
PHY_vars_eNB->dlsch_eNB[0][TB+1]->harq_processes[0]->nb_rb, PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->nb_rb,
PHY_vars_eNB->dlsch_eNB[0][TB+1]->harq_processes[0]->rb_alloc, PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->rb_alloc,
get_Qm(PHY_vars_eNB->dlsch_eNB[0][TB+1]->harq_processes[0]->mcs), get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs),
PHY_vars_eNB->dlsch_eNB[0][TB+1]->harq_processes[0]->Nl, PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->Nl,
num_pdcch_symbols, num_pdcch_symbols,
0, 0,
subframe); subframe);
PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB+1]->current_harq_pid]->G = coded_bits_per_codeword[TB+1]; PHY_vars_UE->dlsch_ue[0][1]->harq_processes[PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid]->G = coded_bits_per_codeword[1];
PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB+1]->current_harq_pid]->Qm = get_Qm(PHY_vars_eNB->dlsch_eNB[0][TB+1]->harq_processes[0]->mcs); PHY_vars_UE->dlsch_ue[0][1]->harq_processes[PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid]->Qm = get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs);
if (n_frames==1) { if (n_frames==2) {
printf("Kmimo=%d, cw=%d, G=%d, TBS=%d\n",Kmimo,TB+1,coded_bits_per_codeword[TB+1], printf("Kmimo=%d, cw=%d, G=%d, TBS=%d\n",Kmimo,1,coded_bits_per_codeword[1],
PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB+1]->current_harq_pid]->TBS); PHY_vars_UE->dlsch_ue[0][1]->harq_processes[PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid]->TBS);
// calculate uncoded BER // calculate uncoded BER
uncoded_ber_bit = (short*) malloc(sizeof(short)*coded_bits_per_codeword[TB+1]); uncoded_ber_bit = (short*) malloc(sizeof(short)*coded_bits_per_codeword[1]);
AssertFatal(uncoded_ber_bit, "uncoded_ber_bit==NULL"); AssertFatal(uncoded_ber_bit, "uncoded_ber_bit==NULL");
sprintf(fname,"dlsch%d_rxF_r%d_cw%d_llr.m",eNB_id,round, TB+1); sprintf(fname,"dlsch%d_rxF_r%d_cw%d_llr.m",eNB_id,round,1);
sprintf(vname,"dl%d_r%d_cw%d_llr",eNB_id,round, TB+1); sprintf(vname,"dl%d_r%d_cw%d_llr",eNB_id,round, 1);
write_output(fname,vname, PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[TB+1],coded_bits_per_codeword[TB+1],1,0); write_output(fname,vname, PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[1],coded_bits_per_codeword[1],1,0);
sprintf(fname,"dlsch_cw%d_e.m", TB+1); sprintf(fname,"dlsch_cw%d_e.m", 1);
sprintf(vname,"dlschcw%d_e", TB+1); sprintf(vname,"dlschcw%d_e", 1);
write_output(fname, vname,PHY_vars_eNB->dlsch_eNB[0][TB+1]->harq_processes[0]->e,coded_bits_per_codeword[TB+1],1,4); write_output(fname, vname,PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->e,coded_bits_per_codeword[1],1,4);
uncoded_ber=0; uncoded_ber=0;
printf("trials=%d\n", trials); printf("trials=%d\n", trials);
for (i=0;i<coded_bits_per_codeword[TB+1];i++) for (i=0;i<coded_bits_per_codeword[1];i++)
if (PHY_vars_eNB->dlsch_eNB[0][TB+1]->harq_processes[0]->e[i] != (PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB+1]->current_harq_pid]->codeword][i]<0)) { if (PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->e[i] != (PHY_vars_UE->lte_ue_pdsch_vars[0]->llr[PHY_vars_UE->dlsch_ue[0][1]->harq_processes[PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid]->codeword][i]<0)) {
uncoded_ber_bit[i] = 1; uncoded_ber_bit[i] = 1;
uncoded_ber++; uncoded_ber++;
} }
else else
uncoded_ber_bit[i] = 0; uncoded_ber_bit[i] = 0;
uncoded_ber/=coded_bits_per_codeword[TB+1]; uncoded_ber/=coded_bits_per_codeword[1];
avg_ber += uncoded_ber; avg_ber += uncoded_ber;
sprintf(fname,"cw%d_uncoded_ber_bit.m", TB+1); sprintf(fname,"cw%d_uncoded_ber_bit.m", 1);
sprintf(vname,"uncoded_ber_bit_cw%d", TB+1); sprintf(vname,"uncoded_ber_bit_cw%d", 1);
write_output(fname, vname,uncoded_ber_bit,coded_bits_per_codeword[TB+1],1,0); write_output(fname, vname,uncoded_ber_bit,coded_bits_per_codeword[1],1,0);
printf("cw %d, uncoded ber %f\n",TB+1,uncoded_ber); printf("cw %d, uncoded ber %f\n",1,uncoded_ber);
free(uncoded_ber_bit); free(uncoded_ber_bit);
uncoded_ber_bit = NULL; uncoded_ber_bit = NULL;
} }
...@@ -3860,84 +3868,102 @@ n(tikz_fname,"w"); ...@@ -3860,84 +3868,102 @@ n(tikz_fname,"w");
start_meas(&PHY_vars_UE->dlsch_unscrambling_stats); start_meas(&PHY_vars_UE->dlsch_unscrambling_stats);
dlsch_unscrambling(&PHY_vars_UE->lte_frame_parms, dlsch_unscrambling(&PHY_vars_UE->lte_frame_parms,
0, 0,
PHY_vars_UE->dlsch_ue[0][TB+1], PHY_vars_UE->dlsch_ue[0][1],
coded_bits_per_codeword[TB+1], coded_bits_per_codeword[1],
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB+1]->current_harq_pid]->codeword], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[PHY_vars_UE->dlsch_ue[0][1]->harq_processes[PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid]->codeword],
TB+1, 1,
subframe<<1); subframe<<1);
stop_meas(&PHY_vars_UE->dlsch_unscrambling_stats); stop_meas(&PHY_vars_UE->dlsch_unscrambling_stats);
start_meas(&PHY_vars_UE->dlsch_decoding_stats); start_meas(&PHY_vars_UE->dlsch_decoding_stats);
ret[1] = dlsch_decoding(PHY_vars_UE, ret[1] = dlsch_decoding(PHY_vars_UE,
PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB+1]->current_harq_pid]->codeword], PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[PHY_vars_UE->dlsch_ue[0][1]->harq_processes[PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid]->codeword],
&PHY_vars_UE->lte_frame_parms, &PHY_vars_UE->lte_frame_parms,
PHY_vars_UE->dlsch_ue[0][TB+1], PHY_vars_UE->dlsch_ue[0][1],
PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[PHY_vars_UE->dlsch_ue[0][TB+1]->current_harq_pid], PHY_vars_UE->dlsch_ue[0][1]->harq_processes[PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid],
subframe, subframe,
PHY_vars_UE->dlsch_ue[0][TB+1]->current_harq_pid, PHY_vars_UE->dlsch_ue[0][1]->current_harq_pid,
1,llr8_flag); 1,llr8_flag);
stop_meas(&PHY_vars_UE->dlsch_decoding_stats); stop_meas(&PHY_vars_UE->dlsch_decoding_stats);
//printf("ret TB 1 = %d round %d \n", ret[1], round); #ifdef DEBUG_HARQ
printf("[DLSIM] Decoding TB1 in SIC: ret[1] = %d, round sic %d\n", ret[1], round_sic);
#endif
if (ret[TB+1] <= PHY_vars_UE->dlsch_ue[0][TB+1]->max_turbo_iterations ) { //printf("ret TB 1 = %d round %d \n", ret[1], round);
avg_iter[TB+1] += ret[TB+1]; if (ret[1] <= PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations ) {
iter_trials[TB+1]++; round_sic = round+1; // to exit round_sic
#ifdef DEBUG_HARQ
printf("[DLSIM] TB1 is decoded in SIC loop\n");
#endif
avg_iter[1] += ret[1];
iter_trials[1]++;
if (n_frames==1) { if (n_frames==2) {
printf("cw sic %d, round %d: No DLSCH errors found, uncoded ber %f\n",TB+1,round,uncoded_ber); printf("cw sic %d, round %d: No DLSCH errors found, uncoded ber %f\n",1,round,uncoded_ber);
#ifdef PRINT_BYTES #ifdef PRINT_BYTES
for (s=0;s<PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[0]->C;s++) { for (s=0;s<PHY_vars_UE->dlsch_ue[0][1]->harq_processes[0]->C;s++) {
if (s<PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[0]->Cminus) if (s<PHY_vars_UE->dlsch_ue[0][1]->harq_processes[0]->Cminus)
Kr = PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[0]->Kminus; Kr = PHY_vars_UE->dlsch_ue[0][1]->harq_processes[0]->Kminus;
else else
Kr = PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[0]->Kplus; Kr = PHY_vars_UE->dlsch_ue[0][1]->harq_processes[0]->Kplus;
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
printf("Decoded_output (Segment %d):\n",s); printf("Decoded_output (Segment %d):\n",s);
for (i=0;i<Kr_bytes;i++) for (i=0;i<Kr_bytes;i++)
printf("%d : %x (%x)\n",i,PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[0]->c[s][i], printf("%d : %x (%x)\n",i,PHY_vars_UE->dlsch_ue[0][1]->harq_processes[0]->c[s][i],
PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[0]->c[s][i]^PHY_vars_eNB->dlsch_eNB[0][TB+1]->harq_processes[0]->c[s][i]); PHY_vars_UE->dlsch_ue[0][1]->harq_processes[0]->c[s][i]^PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->c[s][i]);
} }
#endif #endif
} }
} else{ }
errs[TB+1][round]++; } //round_sic
if (ret[1] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations ){
errs[1][round]++;
#ifdef DEBUG_HARQ
printf("[DLSIM] TB1 is not decoded in SIC loop, errs[TB1][round %d] = %d\n",round, errs[1][round]);
#endif
// exit(0); // exit(0);
avg_iter[TB+1] += ret[TB+1]-1; avg_iter[1] += ret[1]-1;
iter_trials[TB+1]++; iter_trials[1]++;
if (n_frames==1) { if (n_frames==2) {
//if ((n_frames==1) || (SNR>=30)) { //if ((n_frames==1) || (SNR>=30)) {
printf("cw sic %d, round %d: DLSCH errors found, uncoded ber %f\n",TB+1,round,uncoded_ber); printf("cw sic %d, round %d: DLSCH errors found, uncoded ber %f\n",1,round,uncoded_ber);
#ifdef PRINT_BYTES #ifdef PRINT_BYTES
for (s=0;s<PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[0]->C;s++) { for (s=0;s<PHY_vars_UE->dlsch_ue[0][1]->harq_processes[0]->C;s++) {
if (s<PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[0]->Cminus) if (s<PHY_vars_UE->dlsch_ue[0][1]->harq_processes[0]->Cminus)
Kr = PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[0]->Kminus; Kr = PHY_vars_UE->dlsch_ue[0][1]->harq_processes[0]->Kminus;
else else
Kr = PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[0]->Kplus; Kr = PHY_vars_UE->dlsch_ue[0][1]->harq_processes[0]->Kplus;
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
printf("Decoded_output (Segment %d):\n",s); printf("Decoded_output (Segment %d):\n",s);
for (i=0;i<Kr_bytes;i++) for (i=0;i<Kr_bytes;i++)
printf("%d : %x (%x)\n",i,PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[0]->c[s][i], printf("%d : %x (%x)\n",i,PHY_vars_UE->dlsch_ue[0][1]->harq_processes[0]->c[s][i],
PHY_vars_UE->dlsch_ue[0][TB+1]->harq_processes[0]->c[s][i]^PHY_vars_eNB->dlsch_eNB[0][TB+1]->harq_processes[0]->c[s][i]); PHY_vars_UE->dlsch_ue[0][1]->harq_processes[0]->c[s][i]^PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->c[s][i]);
} }
#endif #endif
} //n_frames==1 } //n_frames==1
// exit(0); // exit(0);
} //if (ret > PHY_vars_UE->dlsch_ue[0][TB+1]->max_turbo_iterations ) } //if (ret > PHY_vars_UE->dlsch_ue[0][1]->max_turbo_iterations )
}//if SIC }//if SIC
} else { } else {
errs[TB][round]++; errs[TB][round]++;
#ifdef DEBUG_HARQ
printf("[DLSIM] TB%d is not decoded outside SIC loop, errs[TB%d][round %d] = %d\n", TB, TB, round, errs[TB][round]);
#endif
/*if (cw_non_sic==0) { /*if (cw_non_sic==0) {
...@@ -3947,17 +3973,21 @@ n(tikz_fname,"w"); ...@@ -3947,17 +3973,21 @@ n(tikz_fname,"w");
if ((PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) && if ((PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) &&
(PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->mimo_mode <=DUALSTREAM_PUSCH_PRECODING) && (PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->mimo_mode <=DUALSTREAM_PUSCH_PRECODING) &&
(rx_type==rx_SIC_dual_stream)) { (rx_type==rx_SIC_dual_stream) && (TB0_active ==1)) {
errs[TB+1][round]++; errs[1][round]++;
#ifdef DEBUG_HARQ
printf("[DLSIM] HERE OR NOT TB%d is not decoded outside SIC loop, errs[TB%d][round %d] = %d\n", 1, 1, round, errs[1][round]);
#endif
} }
/*if (cw_non_sic==1) { /*if (cw_non_sic==1) {
avg_iter[1] += ret[1]-1; avg_iter[1] += ret[1]-1;
iter_trials[1]++; iter_trials[1]++;
}*/ }*/
if (n_frames==1) { if (n_frames==2) {
//if ((n_frames==1) || (SNR>=30)) { //if ((n_frames==1) || (SNR>=30)) {
printf("cw %d, round %d: DLSCH errors found, uncoded ber %f\n",TB,round,uncoded_ber); printf("cw %d, round %d: DLSCH errors found, uncoded ber %f\n",TB,round,uncoded_ber);
#ifdef PRINT_BYTES #ifdef PRINT_BYTES
...@@ -3982,7 +4012,7 @@ n(tikz_fname,"w"); ...@@ -3982,7 +4012,7 @@ n(tikz_fname,"w");
stop_meas(&PHY_vars_UE->phy_proc_rx); stop_meas(&PHY_vars_UE->phy_proc_rx);
if (n_frames==1) { if (n_frames==2) {
//rxsig //rxsig
sprintf(fname,"rxsig0_r%d.m",round); sprintf(fname,"rxsig0_r%d.m",round);
...@@ -4068,10 +4098,11 @@ n(tikz_fname,"w"); ...@@ -4068,10 +4098,11 @@ n(tikz_fname,"w");
0,// UE_id 0,// UE_id
subframe); subframe);
} }
#ifdef DEBUG_HARQ
printf("[DLSIM] Errors errs[TB0][round %d] = %d, errs[TB1][round %d] = %d\n ", round, errs[0][round], round, errs[1][round]);
#endif
if ((transmission_mode != 3) && (transmission_mode !=4) && (ret[0] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations)){
if ((transmission_mode != 3 && transmission_mode !=4 ) && ret[0] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations){
//printf("flag 1 \n"); //printf("flag 1 \n");
round++; round++;
} }
...@@ -4083,20 +4114,23 @@ n(tikz_fname,"w"); ...@@ -4083,20 +4114,23 @@ n(tikz_fname,"w");
resend_cw0_cw1=1; //resend both cws resend_cw0_cw1=1; //resend both cws
resend_cw1=0; resend_cw1=0;
TB0_active=1; TB0_active=1;
//printf("flag 2 \n");
} }
if ((transmission_mode == 3 || transmission_mode == 4 ) && (ret[1] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations ) && (ret[0] <= PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations)){ if ((transmission_mode == 3 || transmission_mode == 4 ) && (ret[1] > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations ) && (ret[0] <= PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations)){
resend_one[round]++; resend_one[round]++;
round++;
resend_cw0_cw1=0; resend_cw0_cw1=0;
TB0_active=0; TB0_active=0;
//PHY_vars_UE->PHY_measurements.rank[eNB_id]=0; #ifdef DEBUG_HARQ
// printf("\n DLSIM TB0 disactivated\n"); printf("[DLSIM] ret[TB0] =%d, ret[TB1] =%d, trial %d \n", ret[0], ret[1], trials);
//printf("flag 3 \n"); printf("[DLSIM] TB0 deactivated\n");
#endif
round++;
} }
#ifdef DEBUG_HARQ
printf("[DLSIM] Now round is %d, trial %d\n" , round, trials);
#endif
} }
...@@ -4265,21 +4299,31 @@ n(tikz_fname,"w"); ...@@ -4265,21 +4299,31 @@ n(tikz_fname,"w");
if (transmission_mode == 3 || transmission_mode == 4) { if (transmission_mode == 3 || transmission_mode == 4) {
// FOR CW0 // FOR CW0
thr_cw0[0] = rate[0]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs)*(1-((double)errs[0][0]/(double)round_trials[0][0])); thr_cw0[0] = rate0_init*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs)*(1-((double)errs[0][0]/(double)round_trials[0][0]));
thr_cw0[1] = (rate[0]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs)/2)*(((double)errs[0][0] - (double)errs[0][1])/(double)round_trials[0][0]); thr_cw0[1] = (rate0_init*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs)/2)*(((double)errs[0][0] - (double)errs[0][1])/(double)round_trials[0][0]);
thr_cw0[2] = (rate[0]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs)/3)*(((double)errs[0][1] - (double)errs[0][2])/(double)round_trials[0][0]); thr_cw0[2] = (rate0_init*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs)/3)*(((double)errs[0][1] - (double)errs[0][2])/(double)round_trials[0][0]);
thr_cw0[3] = (rate[0]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs)/4)*(((double)errs[0][2] - (double)errs[0][3])/(double)round_trials[0][0]); thr_cw0[3] = (rate0_init*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs)/4)*(((double)errs[0][2] - (double)errs[0][3])/(double)round_trials[0][0]);
thr_cw0_tot = (double)thr_cw0[0]+(double)thr_cw0[1]+(double)thr_cw0[2]+(double)thr_cw0[3]; thr_cw0_tot = (double)thr_cw0[0]+(double)thr_cw0[1]+(double)thr_cw0[2]+(double)thr_cw0[3];
printf("\n Throughput cw0 sum = %f \n", thr_cw0_tot); #ifdef PRINT_THROUGHPUT
printf("rate %f \n", rate0_init);
printf("rate*mod_order %f \n", rate0_init*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs));
printf("Probability %f \n", (1-((double)errs[0][0]/(double)round_trials[0][0])));
printf("Throughput cw0 sum = %f \n", thr_cw0_tot);
printf("Throughput cw0 round 0 = %f \n", thr_cw0[0]);
printf("Throughput cw0 round 1 = %f \n", thr_cw0[1]);
printf("Throughput cw0 round 2 = %f \n", thr_cw0[2]);
printf("Throughput cw0 round 3 = %f \n", thr_cw0[3]);
printf("round_trials = %d, errs[0][0] = %d, round_trials[0][1] = %d, errs[0][1] = %d, round_trials[0][2] = %d, errs[0][2] = %d, \ printf("round_trials = %d, errs[0][0] = %d, round_trials[0][1] = %d, errs[0][1] = %d, round_trials[0][2] = %d, errs[0][2] = %d, \
round_trials[0][3] = %d, errs[0][3] = %d \n", round_trials[0][0], errs[0][0],round_trials[0][1], errs[0][1], round_trials[0][2], \ round_trials[0][3] = %d, errs[0][3] = %d \n", round_trials[0][0], errs[0][0],round_trials[0][1], errs[0][1], round_trials[0][2], \
errs[0][2], round_trials[0][3], errs[0][3]); errs[0][2], round_trials[0][3], errs[0][3]);
#endif
thr_cw1[0] = rate[0]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)*(1-((double)errs[1][0]/(double)round_trials[1][0])); thr_cw1[0] = rate1_init*get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)*(1-((double)errs[1][0]/(double)round_trials[1][0]));
thr_cw1[1] = (rate[0]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)/2)*(((double)errs[1][0] - (double)errs[1][1])/(double)round_trials[1][0]); thr_cw1[1] = (rate1_init*get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)/2)*(((double)errs[1][0] - (double)errs[1][1])/(double)round_trials[1][0]);
thr_cw1[2] = (rate[0]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)/3)*(((double)errs[1][1] - (double)errs[1][2])/(double)round_trials[1][0]); thr_cw1[2] = (rate1_init*get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)/3)*(((double)errs[1][1] - (double)errs[1][2])/(double)round_trials[1][0]);
thr_cw1[3] = (rate[0]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)/4)*(((double)errs[1][2] - (double)errs[1][3])/(double)round_trials[1][0]); thr_cw1[3] = (rate1_init*get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)/4)*(((double)errs[1][2] - (double)errs[1][3])/(double)round_trials[1][0]);
thr_cw1_tot = (double)thr_cw1[0]+(double)thr_cw1[1]+(double)thr_cw1[2]+(double)thr_cw1[3]; thr_cw1_tot = (double)thr_cw1[0]+(double)thr_cw1[1]+(double)thr_cw1[2]+(double)thr_cw1[3];
#ifdef PRINT_THROUGHPUT
printf("Throughput cw1 sum = %f \n", thr_cw1_tot); printf("Throughput cw1 sum = %f \n", thr_cw1_tot);
printf("Throughput cw1 round 0 = %f \n", thr_cw1[0]); printf("Throughput cw1 round 0 = %f \n", thr_cw1[0]);
printf("Throughput cw1 round 1 = %f \n", thr_cw1[1]); printf("Throughput cw1 round 1 = %f \n", thr_cw1[1]);
...@@ -4288,6 +4332,7 @@ n(tikz_fname,"w"); ...@@ -4288,6 +4332,7 @@ n(tikz_fname,"w");
printf("round_trials[1][0] = %d, errs[1][0] = %d, round_trials[1][1] = %d, errs[1][1] = %d, round_trials[1][2] = %d, errs[1][2] = %d, \ printf("round_trials[1][0] = %d, errs[1][0] = %d, round_trials[1][1] = %d, errs[1][1] = %d, round_trials[1][2] = %d, errs[1][2] = %d, \
round_trials[1][3] = %d, errs[1][3] = %d \n", round_trials[1][0], errs[1][0], round_trials[1][1], errs[1][1], round_trials[1][2], \ round_trials[1][3] = %d, errs[1][3] = %d \n", round_trials[1][0], errs[1][0], round_trials[1][1], errs[1][1], round_trials[1][2], \
errs[1][2], round_trials[1][3], errs[1][3]); errs[1][2], round_trials[1][3], errs[1][3]);
#endif
} }
#if 0 #if 0
...@@ -4494,27 +4539,39 @@ n(tikz_fname,"w"); ...@@ -4494,27 +4539,39 @@ n(tikz_fname,"w");
SNR, SNR,
mcs1, mcs1,
mcs2, mcs2,
PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS, tbs0_init,
PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->TBS, tbs1_init,
rate[0], rate0_init,
rate[1], rate1_init,
errs[0][0], errs[0][0],
errs[1][0], errs[1][0],
round_trials[0][0], round_trials[0][0],
round_trials[1][0],
errs[0][1], errs[0][1],
errs[1][1], errs[1][1],
round_trials[0][1], round_trials[0][1],
round_trials[1][1],
errs[0][2], errs[0][2],
errs[1][2], errs[1][2],
round_trials[0][2], round_trials[0][2],
round_trials[1][2],
errs[0][3], errs[0][3],
errs[1][3], errs[1][3],
round_trials[0][3], round_trials[0][3],
rate[0]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs)*(1-((double)errs[0][0]/(double)round_trials[0][0])), round_trials[1][3],
rate[1]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)*(1-((double)errs[1][0]/(double)round_trials[1][0])), thr_cw0[0],
rate[0]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs)*(1-((double)errs[0][0]/(double)round_trials[0][0]))+ thr_cw1[0],
rate[1]*get_Qm(PHY_vars_eNB->dlsch_eNB[0][1]->harq_processes[0]->mcs)*(1-((double)errs[1][0]/(double)round_trials[1][0])), thr_cw0[0]+thr_cw1[0],
dci_errors); thr_cw0[1],
thr_cw1[1],
thr_cw0[1]+thr_cw1[1],
thr_cw0[2],
thr_cw1[2],
thr_cw0[2]+thr_cw1[2],
thr_cw0[3],
thr_cw1[3],
thr_cw0[3]+thr_cw1[3],
thr_cw0[0]+thr_cw0[1]+thr_cw0[2]+thr_cw0[4]+thr_cw1[0]+thr_cw1[1]+thr_cw1[2]+ thr_cw1[3]);
} }
...@@ -4742,7 +4799,7 @@ n(tikz_fname,"w"); ...@@ -4742,7 +4799,7 @@ n(tikz_fname,"w");
} }
if (n_frames==1) if (n_frames==2)
break; break;
}// SNR }// SNR
......
...@@ -46,7 +46,7 @@ static unsigned int seed, iy, ir[98]; ...@@ -46,7 +46,7 @@ static unsigned int seed, iy, ir[98];
#define a 1664525lu #define a 1664525lu
#define mod 4294967296.0 /* is 2**32 */ #define mod 4294967296.0 /* is 2**32 */
#if 1
void randominit(unsigned seed_init) void randominit(unsigned seed_init)
{ {
int i; int i;
...@@ -70,9 +70,10 @@ void randominit(unsigned seed_init) ...@@ -70,9 +70,10 @@ void randominit(unsigned seed_init)
iy=1; iy=1;
} }
#endif
#if 0
/*void randominit(unsigned seed_init) void randominit(unsigned seed_init)
{ {
int i; int i;
// this need to be integrated with the existing rng, like taus: navid // this need to be integrated with the existing rng, like taus: navid
...@@ -90,14 +91,14 @@ void randominit(unsigned seed_init) ...@@ -90,14 +91,14 @@ void randominit(unsigned seed_init)
if (seed % 2 == 0) seed += 1; /* seed and mod are relative prime */ if (seed % 2 == 0) seed += 1; /* seed and mod are relative prime */
// for (i=1; i<=97; i++) { for (i=1; i<=97; i++) {
// seed = a*seed; /* mod 2**32 */ seed = a*seed; /* mod 2**32 */
// ir[i]= seed; /* initialize the shuffle table */ ir[i]= seed; /* initialize the shuffle table */
// } }
// iy=1;
//}
iy=1;
}
#endif
/*!\brief Uniform linear congruential random number generator on \f$[0,1)\f$. Returns a double-precision floating-point number.*/ /*!\brief Uniform linear congruential random number generator on \f$[0,1)\f$. Returns a double-precision floating-point number.*/
double uniformrandom(void) double uniformrandom(void)
......
...@@ -58,7 +58,7 @@ unsigned int taus(void) ...@@ -58,7 +58,7 @@ unsigned int taus(void)
s2 = (((s2 & 0xFFFFFFF0) << 17)^ b); s2 = (((s2 & 0xFFFFFFF0) << 17)^ b);
return s0 ^ s1 ^ s2; return s0 ^ s1 ^ s2;
} }
#if 1
void set_taus_seed(unsigned int seed_init) void set_taus_seed(unsigned int seed_init)
{ {
...@@ -88,8 +88,10 @@ void set_taus_seed(unsigned int seed_init) ...@@ -88,8 +88,10 @@ void set_taus_seed(unsigned int seed_init)
#endif #endif
} }
} }
#endif
/* void set_taus_seed(unsigned int seed_init) #if 0
void set_taus_seed(unsigned int seed_init)
{ {
#ifdef USER_MODE #ifdef USER_MODE
...@@ -113,18 +115,17 @@ void set_taus_seed(unsigned int seed_init) ...@@ -113,18 +115,17 @@ void set_taus_seed(unsigned int seed_init)
s2 = (unsigned int)0xfe1a133e; s2 = (unsigned int)0xfe1a133e;
#else #else
// Use reentrant version of rand48 to ensure that no conflicts with other generators occur */ // Use reentrant version of rand48 to ensure that no conflicts with other generators occur */
// srand48_r((long int)seed_init, &buffer); srand48_r((long int)seed_init, &buffer);
// mrand48_r(&buffer, (long int *)&result); mrand48_r(&buffer, (long int *)&result);
// s0 = result; s0 = result;
// mrand48_r(&buffer, (long int *)&result); mrand48_r(&buffer, (long int *)&result);
// s1 = result; s1 = result;
// mrand48_r(&buffer, (long int *)&result); mrand48_r(&buffer, (long int *)&result);
// s2 = result; s2 = result;
//#endif #endif
// } }
//} }
#endif
#ifdef MAIN #ifdef MAIN
......
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