Commit b98bb25f authored by Elena_Lukashova's avatar Elena_Lukashova

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

1. TM4 works on dlsim_tm4.c with full HARQ support for both PIA and SIC.
parents 60eddd2c e88561e9
...@@ -1827,7 +1827,19 @@ target_link_libraries (oaisim_nos1 ${T_LIB}) ...@@ -1827,7 +1827,19 @@ target_link_libraries (oaisim_nos1 ${T_LIB})
# Unitary tests for each piece of L1: example, mbmssim is MBMS L1 simulator # Unitary tests for each piece of L1: example, mbmssim is MBMS L1 simulator
##################################### #####################################
foreach(myExe dlsim dlsim_tm4 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim) #special case for dlim TM4, which uses its own version of phy_scope code
add_executable(dlsim_tm4
${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR1_DIR}/SIMULATION/LTE_PHY/dlsim_tm4.c
${OPENAIR1_DIR}/PHY/TOOLS/lte_phy_scope_tm4.c
${T_SOURCE}
)
target_link_libraries (dlsim_tm4
-Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group
pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB}
)
foreach(myExe dlsim ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim)
add_executable(${myExe} add_executable(${myExe}
${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c ${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c
......
...@@ -678,7 +678,7 @@ void phy_config_dedicated_eNB(uint8_t Mod_id, ...@@ -678,7 +678,7 @@ void phy_config_dedicated_eNB(uint8_t Mod_id,
break; break;
} }
LOG_I(PHY,"Transmission Mode (phy_config_dedicated_eNB) %d\n",eNB->transmission_mode[UE_id]); LOG_I(PHY,"Transmission Mode (phy_config_dedicated_eNB) %d\n",eNB->transmission_mode[UE_id]);
} else { } else {
LOG_D(PHY,"[eNB %d] : Received NULL radioResourceConfigDedicated->antennaInfo from eNB %d\n",Mod_id,UE_id); LOG_D(PHY,"[eNB %d] : Received NULL radioResourceConfigDedicated->antennaInfo from eNB %d\n",Mod_id,UE_id);
} }
...@@ -839,7 +839,7 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id, ...@@ -839,7 +839,7 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,
default: default:
LOG_E(PHY,"Unknown transmission mode!\n"); LOG_E(PHY,"Unknown transmission mode!\n");
break; break;
} }
} else { } else {
LOG_D(PHY,"[UE %d] Received NULL physicalConfigDedicated->antennaInfo from eNB %d\n",Mod_id, eNB_id); LOG_D(PHY,"[UE %d] Received NULL physicalConfigDedicated->antennaInfo from eNB %d\n",Mod_id, eNB_id);
} }
...@@ -952,8 +952,8 @@ void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS ...@@ -952,8 +952,8 @@ void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS
pdsch->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); pdsch->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
pdsch->dl_ch_mag0 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); pdsch->dl_ch_mag0 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
pdsch->dl_ch_magb0 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); pdsch->dl_ch_magb0 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
pdsch->dl_ch_mag1 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); //pdsch->dl_ch_mag1 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
pdsch->dl_ch_magb1 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); //pdsch->dl_ch_magb1 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
// the allocated memory size is fixed: // the allocated memory size is fixed:
AssertFatal( fp->nb_antennas_rx <= 2, "nb_antennas_rx > 2" ); AssertFatal( fp->nb_antennas_rx <= 2, "nb_antennas_rx > 2" );
...@@ -969,8 +969,8 @@ void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS ...@@ -969,8 +969,8 @@ void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS
pdsch->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_mag0[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_mag0[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_magb0[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_magb0[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_mag1[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); //pdsch->dl_ch_mag1[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_magb1[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); //pdsch->dl_ch_magb1[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
} }
} }
} }
...@@ -1079,30 +1079,37 @@ int phy_init_lte_ue(PHY_VARS_UE *ue, ...@@ -1079,30 +1079,37 @@ int phy_init_lte_ue(PHY_VARS_UE *ue,
pdsch_vars[eNB_id]->llr[1] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) ); pdsch_vars[eNB_id]->llr[1] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
pdsch_vars[eNB_id]->llr128_2ndstream = (int16_t**)malloc16_clear( sizeof(int16_t*) ); pdsch_vars[eNB_id]->llr128_2ndstream = (int16_t**)malloc16_clear( sizeof(int16_t*) );
pdsch_vars[eNB_id]->rho = (int32_t**)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t*) ); pdsch_vars[eNB_id]->rho = (int32_t**)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t*) );
for (int i=0; i<fp->nb_antennas_rx; i++) for (int i=0; i<fp->nb_antennas_rx; i++)
pdsch_vars[eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) ); pdsch_vars[eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) );
pdsch_vars[eNB_id]->dl_ch_rho2_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); pdsch_vars[eNB_id]->dl_ch_rho2_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
for (i=0; i<fp->nb_antennas_rx; i++) for (i=0; i<fp->nb_antennas_rx; i++)
for (j=0; j<4; j++) { for (j=0; j<4; j++) {
const int idx = (j<<1)+i; const int idx = (j<<1)+i;
const size_t num = 7*2*fp->N_RB_DL*12+4; const size_t num = 7*2*fp->N_RB_DL*12+4;
pdsch_vars[eNB_id]->dl_ch_rho2_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); pdsch_vars[eNB_id]->dl_ch_rho2_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
} }
const size_t num = 7*2*fp->N_RB_DL*12+4; const size_t num = 7*2*fp->N_RB_DL*12+4;
for (k=0;k<8;k++) { //harq_pid for (k=0;k<8;k++) { //harq_pid
for (l=0;l<8;l++) { //round for (l=0;l<8;l++) { //round
pdsch_vars[eNB_id]->rxdataF_comp1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); pdsch_vars[eNB_id]->rxdataF_comp1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
pdsch_vars[eNB_id]->dl_ch_rho_ext[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); pdsch_vars[eNB_id]->dl_ch_rho_ext[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
// pdsch_vars[eNB_id]->clean_x1[k][l] = (int16_t*)malloc16_clear( sizeof(int32_t) * num); pdsch_vars[eNB_id]->dl_ch_mag1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
pdsch_vars[eNB_id]->dl_ch_magb1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
for (int i=0; i<fp->nb_antennas_rx; i++)
for (int i=0; i<fp->nb_antennas_rx; i++)
for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++) for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
const int idx = (j<<1)+i; const int idx = (j<<1)+i;
pdsch_vars[eNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); pdsch_vars[eNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch_vars[eNB_id]->rxdataF_comp1[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); pdsch_vars[eNB_id]->rxdataF_comp1[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch_vars[eNB_id]->dl_ch_mag1[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
pdsch_vars[eNB_id]->dl_ch_magb1[k][l][idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
} }
} }
} }
...@@ -1200,7 +1207,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1200,7 +1207,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars; LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars;
LTE_eNB_SRS* const srs_vars = eNB->srs_vars; LTE_eNB_SRS* const srs_vars = eNB->srs_vars;
LTE_eNB_PRACH* const prach_vars = &eNB->prach_vars; LTE_eNB_PRACH* const prach_vars = &eNB->prach_vars;
int i, j, eNB_id, UE_id; int i, j, eNB_id, UE_id;
eNB->total_dlsch_bitrate = 0; eNB->total_dlsch_bitrate = 0;
eNB->total_transmitted_bits = 0; eNB->total_transmitted_bits = 0;
...@@ -1216,17 +1223,17 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1216,17 +1223,17 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
lte_gold(fp,eNB->lte_gold_table,fp->Nid_cell); lte_gold(fp,eNB->lte_gold_table,fp->Nid_cell);
generate_pcfich_reg_mapping(fp); generate_pcfich_reg_mapping(fp);
generate_phich_reg_mapping(fp); generate_phich_reg_mapping(fp);
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) { for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
eNB->first_run_timing_advance[UE_id] = eNB->first_run_timing_advance[UE_id] =
1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here. 1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here.
// clear whole structure // clear whole structure
bzero( &eNB->UE_stats[UE_id], sizeof(LTE_eNB_UE_stats) ); bzero( &eNB->UE_stats[UE_id], sizeof(LTE_eNB_UE_stats) );
eNB->physicalConfigDedicated[UE_id] = NULL; eNB->physicalConfigDedicated[UE_id] = NULL;
} }
eNB->first_run_I0_measurements = eNB->first_run_I0_measurements =
1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here. 1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here.
} }
...@@ -1234,12 +1241,12 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1234,12 +1241,12 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
{ {
eNB_id=0; eNB_id=0;
if (abstraction_flag==0) { if (abstraction_flag==0) {
// TX vars // TX vars
if (eNB->node_function != NGFI_RCC_IF4p5) if (eNB->node_function != NGFI_RCC_IF4p5)
common_vars->txdata[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_tx*sizeof(int32_t*) ); common_vars->txdata[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_tx*sizeof(int32_t*) );
common_vars->txdataF[eNB_id] = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t*) ); common_vars->txdataF[eNB_id] = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t*) );
for (i=0; i<fp->nb_antennas_tx; i++) { for (i=0; i<fp->nb_antennas_tx; i++) {
if (eNB->node_function != NGFI_RCC_IF4p5) if (eNB->node_function != NGFI_RCC_IF4p5)
common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) ); common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) );
...@@ -1251,67 +1258,67 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1251,67 +1258,67 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t)); fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t));
#endif #endif
} }
// RX vars // RX vars
if (eNB->node_function != NGFI_RCC_IF4p5) { if (eNB->node_function != NGFI_RCC_IF4p5) {
common_vars->rxdata[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); common_vars->rxdata[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
common_vars->rxdata_7_5kHz[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); common_vars->rxdata_7_5kHz[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
} }
common_vars->rxdataF[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); common_vars->rxdataF[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
for (i=0; i<fp->nb_antennas_rx; i++) { for (i=0; i<fp->nb_antennas_rx; i++) {
if (eNB->node_function != NGFI_RCC_IF4p5) { if (eNB->node_function != NGFI_RCC_IF4p5) {
common_vars->rxdata[eNB_id][i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) ); common_vars->rxdata[eNB_id][i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) );
common_vars->rxdata_7_5kHz[eNB_id][i] = (int32_t*)malloc16_clear( fp->samples_per_tti*sizeof(int32_t) ); common_vars->rxdata_7_5kHz[eNB_id][i] = (int32_t*)malloc16_clear( fp->samples_per_tti*sizeof(int32_t) );
} }
common_vars->rxdataF[eNB_id][i] = (int32_t*)malloc16_clear(sizeof(int32_t)*(fp->ofdm_symbol_size*fp->symbols_per_tti) ); common_vars->rxdataF[eNB_id][i] = (int32_t*)malloc16_clear(sizeof(int32_t)*(fp->ofdm_symbol_size*fp->symbols_per_tti) );
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
printf("[openair][LTE_PHY][INIT] common_vars->rxdata[%d][%d] = %p\n",eNB_id,i,common_vars->rxdata[eNB_id][i]); printf("[openair][LTE_PHY][INIT] common_vars->rxdata[%d][%d] = %p\n",eNB_id,i,common_vars->rxdata[eNB_id][i]);
printf("[openair][LTE_PHY][INIT] common_vars->rxdata_7_5kHz[%d][%d] = %p\n",eNB_id,i,common_vars->rxdata_7_5kHz[eNB_id][i]); printf("[openair][LTE_PHY][INIT] common_vars->rxdata_7_5kHz[%d][%d] = %p\n",eNB_id,i,common_vars->rxdata_7_5kHz[eNB_id][i]);
#endif #endif
} }
if (eNB->node_function != NGFI_RRU_IF4p5) { if (eNB->node_function != NGFI_RRU_IF4p5) {
// Channel estimates for SRS // Channel estimates for SRS
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) { for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
srs_vars[UE_id].srs_ch_estimates[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); srs_vars[UE_id].srs_ch_estimates[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
srs_vars[UE_id].srs_ch_estimates_time[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); srs_vars[UE_id].srs_ch_estimates_time[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
for (i=0; i<fp->nb_antennas_rx; i++) { for (i=0; i<fp->nb_antennas_rx; i++) {
srs_vars[UE_id].srs_ch_estimates[eNB_id][i] = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size ); srs_vars[UE_id].srs_ch_estimates[eNB_id][i] = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size );
srs_vars[UE_id].srs_ch_estimates_time[eNB_id][i] = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 ); srs_vars[UE_id].srs_ch_estimates_time[eNB_id][i] = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
} }
} //UE_id } //UE_id
common_vars->sync_corr[eNB_id] = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_tti ); common_vars->sync_corr[eNB_id] = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_tti );
} }
} else { //UPLINK abstraction = 1 } else { //UPLINK abstraction = 1
eNB->sinr_dB = (double*) malloc16_clear( fp->N_RB_DL*12*sizeof(double) ); eNB->sinr_dB = (double*) malloc16_clear( fp->N_RB_DL*12*sizeof(double) );
} }
} //eNB_id } //eNB_id
if (abstraction_flag==0) { if (abstraction_flag==0) {
if (eNB->node_function != NGFI_RRU_IF4p5) { if (eNB->node_function != NGFI_RRU_IF4p5) {
generate_ul_ref_sigs_rx(); generate_ul_ref_sigs_rx();
// SRS // SRS
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) { for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
srs_vars[UE_id].srs = (int32_t*)malloc16_clear(2*fp->ofdm_symbol_size*sizeof(int32_t)); srs_vars[UE_id].srs = (int32_t*)malloc16_clear(2*fp->ofdm_symbol_size*sizeof(int32_t));
} }
} }
} }
// ULSCH VARS, skip if NFGI_RRU_IF4 // ULSCH VARS, skip if NFGI_RRU_IF4
if (eNB->node_function!=NGFI_RRU_IF4p5) if (eNB->node_function!=NGFI_RRU_IF4p5)
prach_vars->prachF = (int16_t*)malloc16_clear( 1024*2*sizeof(int16_t) ); prach_vars->prachF = (int16_t*)malloc16_clear( 1024*2*sizeof(int16_t) );
/* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) */ /* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) */
AssertFatal(fp->nb_antennas_rx <= sizeof(prach_vars->rxsigF) / sizeof(prach_vars->rxsigF[0]), AssertFatal(fp->nb_antennas_rx <= sizeof(prach_vars->rxsigF) / sizeof(prach_vars->rxsigF[0]),
"nb_antennas_rx too large"); "nb_antennas_rx too large");
...@@ -1321,7 +1328,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1321,7 +1328,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
printf("[openair][LTE_PHY][INIT] prach_vars->rxsigF[%d] = %p\n",i,prach_vars->rxsigF[i]); printf("[openair][LTE_PHY][INIT] prach_vars->rxsigF[%d] = %p\n",i,prach_vars->rxsigF[i]);
#endif #endif
} }
if (eNB->node_function != NGFI_RRU_IF4p5) { if (eNB->node_function != NGFI_RRU_IF4p5) {
AssertFatal(fp->nb_antennas_rx <= sizeof(prach_vars->prach_ifft) / sizeof(prach_vars->prach_ifft[0]), AssertFatal(fp->nb_antennas_rx <= sizeof(prach_vars->prach_ifft) / sizeof(prach_vars->prach_ifft[0]),
"nb_antennas_rx too large"); "nb_antennas_rx too large");
...@@ -1333,13 +1340,13 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1333,13 +1340,13 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
} }
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) { for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
//FIXME //FIXME
pusch_vars[UE_id] = (LTE_eNB_PUSCH*)malloc16_clear( NUMBER_OF_UE_MAX*sizeof(LTE_eNB_PUSCH) ); pusch_vars[UE_id] = (LTE_eNB_PUSCH*)malloc16_clear( NUMBER_OF_UE_MAX*sizeof(LTE_eNB_PUSCH) );
if (abstraction_flag==0) { if (abstraction_flag==0) {
for (eNB_id=0; eNB_id<3; eNB_id++) { for (eNB_id=0; eNB_id<3; eNB_id++) {
pusch_vars[UE_id]->rxdataF_ext[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); pusch_vars[UE_id]->rxdataF_ext[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
pusch_vars[UE_id]->rxdataF_ext2[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); pusch_vars[UE_id]->rxdataF_ext2[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
pusch_vars[UE_id]->drs_ch_estimates[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); pusch_vars[UE_id]->drs_ch_estimates[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
...@@ -1347,7 +1354,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1347,7 +1354,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
pusch_vars[UE_id]->rxdataF_comp[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); pusch_vars[UE_id]->rxdataF_comp[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
pusch_vars[UE_id]->ul_ch_mag[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); pusch_vars[UE_id]->ul_ch_mag[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
pusch_vars[UE_id]->ul_ch_magb[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) ); pusch_vars[UE_id]->ul_ch_magb[eNB_id] = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
for (i=0; i<fp->nb_antennas_rx; i++) { for (i=0; i<fp->nb_antennas_rx; i++) {
// RK 2 times because of output format of FFT! // RK 2 times because of output format of FFT!
// FIXME We should get rid of this // FIXME We should get rid of this
...@@ -1360,17 +1367,17 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1360,17 +1367,17 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
pusch_vars[UE_id]->ul_ch_magb[eNB_id][i] = (int32_t*)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 ); pusch_vars[UE_id]->ul_ch_magb[eNB_id][i] = (int32_t*)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
} }
} //eNB_id } //eNB_id
pusch_vars[UE_id]->llr = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) ); pusch_vars[UE_id]->llr = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
} // abstraction_flag } // abstraction_flag
} //UE_id } //UE_id
if (abstraction_flag==0) { if (abstraction_flag==0) {
if (is_secondary_eNB) { if (is_secondary_eNB) {
for (eNB_id=0; eNB_id<3; eNB_id++) { for (eNB_id=0; eNB_id<3; eNB_id++) {
eNB->dl_precoder_SeNB[eNB_id] = (int **)malloc16(4*sizeof(int*)); eNB->dl_precoder_SeNB[eNB_id] = (int **)malloc16(4*sizeof(int*));
if (eNB->dl_precoder_SeNB[eNB_id]) { if (eNB->dl_precoder_SeNB[eNB_id]) {
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
printf("[openair][SECSYS_PHY][INIT] eNB->dl_precoder_SeNB[%d] allocated at %p\n",eNB_id, printf("[openair][SECSYS_PHY][INIT] eNB->dl_precoder_SeNB[%d] allocated at %p\n",eNB_id,
...@@ -1380,10 +1387,10 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1380,10 +1387,10 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
printf("[openair][SECSYS_PHY][INIT] eNB->dl_precoder_SeNB[%d] not allocated\n",eNB_id); printf("[openair][SECSYS_PHY][INIT] eNB->dl_precoder_SeNB[%d] not allocated\n",eNB_id);
return(-1); return(-1);
} }
for (j=0; j<fp->nb_antennas_tx; j++) { for (j=0; j<fp->nb_antennas_tx; j++) {
eNB->dl_precoder_SeNB[eNB_id][j] = (int *)malloc16(2*sizeof(int)*(fp->ofdm_symbol_size)); // repeated format (hence the '2*') eNB->dl_precoder_SeNB[eNB_id][j] = (int *)malloc16(2*sizeof(int)*(fp->ofdm_symbol_size)); // repeated format (hence the '2*')
if (eNB->dl_precoder_SeNB[eNB_id][j]) { if (eNB->dl_precoder_SeNB[eNB_id][j]) {
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
printf("[openair][LTE_PHY][INIT] eNB->dl_precoder_SeNB[%d][%d] allocated at %p\n",eNB_id,j, printf("[openair][LTE_PHY][INIT] eNB->dl_precoder_SeNB[%d][%d] allocated at %p\n",eNB_id,j,
...@@ -1395,14 +1402,14 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1395,14 +1402,14 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
return(-1); return(-1);
} }
} //for(j=...nb_antennas_tx } //for(j=...nb_antennas_tx
} //for(eNB_id... } //for(eNB_id...
} }
} }
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++)
eNB->UE_stats_ptr[UE_id] = &eNB->UE_stats[UE_id]; eNB->UE_stats_ptr[UE_id] = &eNB->UE_stats[UE_id];
eNB->pdsch_config_dedicated->p_a = dB0; //defaul value until overwritten by RRCConnectionReconfiguration eNB->pdsch_config_dedicated->p_a = dB0; //defaul value until overwritten by RRCConnectionReconfiguration
init_prach_tables(839); init_prach_tables(839);
......
...@@ -44,7 +44,8 @@ ...@@ -44,7 +44,8 @@
#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
uint32_t localRIV2alloc_LUT6[32]; uint32_t localRIV2alloc_LUT6[32];
...@@ -404,7 +405,7 @@ uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs) ...@@ -404,7 +405,7 @@ uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs)
} }
// Convert a DCI Format 1C RIV to a Format 1A RIV // Convert a DCI Format 1C RIV to a Format 1A RIV
// This extracts the start and length in PRBs from the 1C rballoc and // This extracts the start and length in PRBs from the 1C rballoc and
// recomputes the RIV as if it were the 1A rballoc // recomputes the RIV as if it were the 1A rballoc
uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL) { uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL) {
...@@ -448,7 +449,7 @@ uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL) { ...@@ -448,7 +449,7 @@ uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL) {
} }
// printf("RBpstart %d\n",RBpstart); // printf("RBpstart %d\n",RBpstart);
return(computeRIV(N_RB_DL,N_RB_step*RBpstart,N_RB_step*(LpCRBsm1+1))); return(computeRIV(N_RB_DL,N_RB_step*RBpstart,N_RB_step*(LpCRBsm1+1)));
} }
uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) { uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) {
...@@ -456,11 +457,11 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) { ...@@ -456,11 +457,11 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) {
int offset; int offset;
switch (N_RB_DL) { switch (N_RB_DL) {
case 6: case 6:
// N_RB_DL = tildeN_RB_DL = 6 // N_RB_DL = tildeN_RB_DL = 6
// Ngap = 4 , P=1, Nrow = 2, Nnull = 2 // Ngap = 4 , P=1, Nrow = 2, Nnull = 2
switch (vrb) { switch (vrb) {
case 0: // even: 0->0, 1->2, odd: 0->3, 1->5 case 0: // even: 0->0, 1->2, odd: 0->3, 1->5
case 1: case 1:
...@@ -471,13 +472,13 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) { ...@@ -471,13 +472,13 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) {
return ((3*odd_slot) + 2*(vrb&3) + 5)%6; return ((3*odd_slot) + 2*(vrb&3) + 5)%6;
break; break;
case 4: // even: 4->1, odd: 4->4 case 4: // even: 4->1, odd: 4->4
return ((3*odd_slot) + 1)%6; return ((3*odd_slot) + 1)%6;
case 5: // even: 5->4, odd: 5->1 case 5: // even: 5->4, odd: 5->1
return ((3*odd_slot) + 4)%6; return ((3*odd_slot) + 4)%6;
break; break;
} }
break; break;
case 15: case 15:
if (vrb<12) { if (vrb<12) {
if ((vrb&3) < 2) // even: 0->0, 1->4, 4->1, 5->5, 8->2, 9->6 odd: 0->7, 1->11 if ((vrb&3) < 2) // even: 0->0, 1->4, 4->1, 5->5, 8->2, 9->6 odd: 0->7, 1->11
...@@ -491,11 +492,11 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) { ...@@ -491,11 +492,11 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) {
return (10+(7*odd_slot)) % 14; return (10+(7*odd_slot)) % 14;
return 14; return 14;
break; break;
case 25: case 25:
return (((12*odd_slot) + 6*(vrb&3) + (vrb>>2))%24) + 24*(vrb/24); return (((12*odd_slot) + 6*(vrb&3) + (vrb>>2))%24) + 24*(vrb/24);
break; break;
case 50: // P=3 case 50: // P=3
if (Ngap==0) { if (Ngap==0) {
// Nrow=12,Nnull=2,NVRBDL=46,Ngap1= 27 // Nrow=12,Nnull=2,NVRBDL=46,Ngap1= 27
...@@ -528,7 +529,7 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) { ...@@ -528,7 +529,7 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) {
offset=18; offset=18;
else else
offset=0; offset=0;
if (vrb<12) { if (vrb<12) {
if ((vrb&3)>=2) if ((vrb&3)>=2)
return offset+((9*odd_slot) + 6*(vrb&3) + (vrb>>2) + 17)%18; return offset+((9*odd_slot) + 6*(vrb&3) + (vrb>>2) + 17)%18;
...@@ -543,19 +544,19 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) { ...@@ -543,19 +544,19 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) {
case 75: case 75:
// Ngap1 = 32, NVRBRL=64, P=4, Nrow= 16, Nnull=0 // Ngap1 = 32, NVRBRL=64, P=4, Nrow= 16, Nnull=0
if (Ngap ==0) { if (Ngap ==0) {
return ((32*odd_slot) + 16*(vrb&3) + (vrb>>2))%64 + (vrb/64); return ((32*odd_slot) + 16*(vrb&3) + (vrb>>2))%64 + (vrb/64);
} else { } else {
// Ngap2 = 16, NVRBDL=32, Nrow=8, Nnull=0 // Ngap2 = 16, NVRBDL=32, Nrow=8, Nnull=0
return ((16*odd_slot) + 8*(vrb&3) + (vrb>>2))%32 + (vrb/32); return ((16*odd_slot) + 8*(vrb&3) + (vrb>>2))%32 + (vrb/32);
} }
break; break;
case 100: case 100:
// Ngap1 = 48, NVRBDL=96, Nrow=24, Nnull=0 // Ngap1 = 48, NVRBDL=96, Nrow=24, Nnull=0
if (Ngap ==0) { if (Ngap ==0) {
return ((48*odd_slot) + 24*(vrb&3) + (vrb>>2))%96 + (vrb/96); return ((48*odd_slot) + 24*(vrb&3) + (vrb>>2))%96 + (vrb/96);
} else { } else {
// Ngap2 = 16, NVRBDL=32, Nrow=8, Nnull=0 // Ngap2 = 16, NVRBDL=32, Nrow=8, Nnull=0
return ((16*odd_slot) + 8*(vrb&3) + (vrb>>2))%32 + (vrb/32); return ((16*odd_slot) + 8*(vrb&3) + (vrb>>2))%32 + (vrb/32);
} }
break; break;
default: default:
...@@ -563,7 +564,7 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) { ...@@ -563,7 +564,7 @@ uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap) {
return 0; return 0;
} }
return 0; return 0;
} }
...@@ -860,7 +861,7 @@ uint8_t get_transmission_mode(module_id_t Mod_id, uint8_t CC_id, rnti_t rnti) ...@@ -860,7 +861,7 @@ uint8_t get_transmission_mode(module_id_t Mod_id, uint8_t CC_id, rnti_t rnti)
} }
int generate_eNB_dlsch_params_from_dci(int frame, int generate_eNB_dlsch_params_from_dci(int frame,
uint8_t subframe, uint8_t subframe,
void *dci_pdu, void *dci_pdu,
uint16_t rnti, uint16_t rnti,
DCI_format_t dci_format, DCI_format_t dci_format,
...@@ -871,14 +872,14 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -871,14 +872,14 @@ int generate_eNB_dlsch_params_from_dci(int frame,
uint16_t ra_rnti, uint16_t ra_rnti,
uint16_t p_rnti, uint16_t p_rnti,
uint16_t DL_pmi_single uint16_t DL_pmi_single
) )
{ {
uint8_t harq_pid = UINT8_MAX; uint8_t harq_pid = UINT8_MAX;
uint32_t rballoc = UINT32_MAX; uint32_t rballoc = UINT32_MAX;
uint32_t RIV_max = 0; uint32_t RIV_max = 0;
uint8_t NPRB,tbswap,tpmi=0; uint8_t NPRB,tbswap,tpmi=0;
LTE_eNB_DLSCH_t *dlsch0=NULL,*dlsch1; LTE_eNB_DLSCH_t *dlsch0=NULL,*dlsch1=NULL;
uint8_t frame_type=frame_parms->frame_type; uint8_t frame_type=frame_parms->frame_type;
uint8_t vrb_type=0; uint8_t vrb_type=0;
uint8_t mcs=0,mcs1=0,mcs2=0; uint8_t mcs=0,mcs1=0,mcs2=0;
...@@ -886,6 +887,7 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -886,6 +887,7 @@ int generate_eNB_dlsch_params_from_dci(int frame,
uint8_t rv=0,rv1=0,rv2=0; uint8_t rv=0,rv1=0,rv2=0;
uint8_t rah=0; uint8_t rah=0;
uint8_t TPC=0; uint8_t TPC=0;
uint8_t TB0_active=0,TB1_active=0;
LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL; LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL;
// printf("Generate eNB DCI, format %d, rnti %x (pdu %p)\n",dci_format,rnti,dci_pdu); // printf("Generate eNB DCI, format %d, rnti %x (pdu %p)\n",dci_format,rnti,dci_pdu);
...@@ -926,6 +928,7 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -926,6 +928,7 @@ int generate_eNB_dlsch_params_from_dci(int frame,
} }
dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
dlsch0_harq->codeword=0;
if (vrb_type==LOCALIZED) { if (vrb_type==LOCALIZED) {
dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT6[rballoc]; dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT6[rballoc];
...@@ -964,7 +967,7 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -964,7 +967,7 @@ int generate_eNB_dlsch_params_from_dci(int frame,
dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
if (vrb_type==LOCALIZED) { if (vrb_type==LOCALIZED) {
dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT25[rballoc]; dlsch0_harq->rb_alloc[0] = localRIV2alloc_LUT25[rballoc];
} }
...@@ -1216,6 +1219,7 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -1216,6 +1219,7 @@ int generate_eNB_dlsch_params_from_dci(int frame,
} }
dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
dlsch0_harq->codeword=0;
// printf("DCI: Setting subframe_tx for subframe %d\n",subframe); // printf("DCI: Setting subframe_tx for subframe %d\n",subframe);
dlsch[0]->subframe_tx[subframe] = 1; dlsch[0]->subframe_tx[subframe] = 1;
...@@ -1497,136 +1501,240 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -1497,136 +1501,240 @@ int generate_eNB_dlsch_params_from_dci(int frame,
// Flip the TB to codeword mapping as described in 5.3.3.1.5 of 36-212 V11.3.0 // Flip the TB to codeword mapping as described in 5.3.3.1.5 of 36-212 V11.3.0
// note that we must set tbswap=0 in eNB scheduler if one TB is deactivated // note that we must set tbswap=0 in eNB scheduler if one TB is deactivated
if (tbswap == 0) { TB0_active = 1;
dlsch0 = dlsch[0]; TB1_active = 1;
dlsch1 = dlsch[1];
} else { if ((rv1 == 1) && (mcs1 == 0)) {
dlsch0 = dlsch[1]; TB0_active=0;
dlsch1 = dlsch[0]; }
if ((rv2 == 1) && (mcs2 == 0)) {
TB1_active=0;
}
#ifdef DEBUG_HARQ
printf("RV0 = %d, RV1 = %d. MCS0 = %d, MCS1=%d\n", rv1, rv2, mcs1, mcs2);
#endif
if (TB0_active && TB1_active && tbswap==0) {
dlsch0=dlsch[0];
dlsch1=dlsch[1];
dlsch0->active = 1;
dlsch1->active = 1;
dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid];
dlsch0_harq->mcs = mcs1;
dlsch1_harq->mcs = mcs2;
dlsch0_harq->rvidx = rv1;
dlsch1_harq->rvidx = rv2;
dlsch0_harq->status = ACTIVE;
dlsch1_harq->status = ACTIVE;
dlsch0_harq->codeword=0;
dlsch1_harq->codeword=1;
#ifdef DEBUG_HARQ
printf("\n ENB: BOTH ACTIVE\n");
#endif
}
else if (TB0_active && TB1_active && tbswap==1) {
dlsch0=dlsch[0];
dlsch1=dlsch[1];
dlsch0->active = 1;
dlsch1->active = 1;
dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid];
dlsch0_harq->mcs = mcs1;
dlsch1_harq->mcs = mcs2;
dlsch0_harq->rvidx = rv1;
dlsch1_harq->rvidx = rv2;
dlsch0_harq->status = ACTIVE;
dlsch1_harq->status = ACTIVE;
dlsch0_harq->codeword=1;
dlsch1_harq->codeword=0;
}
else if (TB0_active && (TB1_active==0)) {
dlsch0=dlsch[0];
dlsch0->active = 1;
dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch0_harq->mcs = mcs1;
dlsch0_harq->rvidx = rv1;
dlsch0_harq->status = ACTIVE;
dlsch0_harq->codeword = 0;
dlsch1=NULL;
dlsch1_harq = NULL;
#ifdef DEBUG_HARQ
printf("\n ENB: TB1 is deactivated, retransmit TB0 transmit in TM6\n");
#endif
}
else if ((TB0_active==0) && TB1_active) {
dlsch1=dlsch[1];
dlsch1->active = 1;
dlsch1_harq = dlsch1->harq_processes[harq_pid];
dlsch1_harq->mcs = mcs2;
dlsch1_harq->rvidx = rv2;
dlsch1_harq->status = ACTIVE;
dlsch1_harq->codeword = 0;
dlsch0=NULL;
dlsch0_harq = NULL;
#ifdef DEBUG_HARQ
printf("\n ENB: TB0 is deactivated, retransmit TB1 transmit in TM6\n");
#endif
} }
dlsch0_harq = dlsch0->harq_processes[harq_pid]; if (dlsch0 != NULL){
dlsch1_harq = dlsch1->harq_processes[harq_pid]; dlsch0->subframe_tx[subframe] = 1;
dlsch0->subframe_tx[subframe] = 1; dlsch0->current_harq_pid = harq_pid;
dlsch0->harq_ids[subframe] = harq_pid;
}
dlsch0->current_harq_pid = harq_pid; if (dlsch1_harq != NULL){
dlsch1->current_harq_pid = harq_pid; dlsch1->current_harq_pid = harq_pid;
dlsch0->harq_ids[subframe] = harq_pid; dlsch1->harq_ids[subframe] = harq_pid;
dlsch1->harq_ids[subframe] = harq_pid; }
// printf("Setting DLSCH harq id %d to subframe %d\n",harq_pid,subframe);
conv_rballoc(rah, if (dlsch0 != NULL ){
rballoc, conv_rballoc(rah,
frame_parms->N_RB_DL, rballoc,
dlsch0_harq->rb_alloc); frame_parms->N_RB_DL,
dlsch0_harq->rb_alloc);
dlsch1_harq->rb_alloc[0] = dlsch0_harq->rb_alloc[0]; dlsch0_harq->nb_rb = conv_nprb(rah, rballoc, frame_parms->N_RB_DL);
dlsch0_harq->nb_rb = conv_nprb(rah, rballoc, frame_parms->N_RB_DL);
dlsch1_harq->nb_rb = dlsch0_harq->nb_rb;
if (dlsch0_harq->nb_rb == 0) if (dlsch1 != NULL){
return(-1); dlsch1_harq->rb_alloc[0] = dlsch0_harq->rb_alloc[0];
dlsch1_harq->nb_rb = dlsch0_harq->nb_rb;
}
} else if ((dlsch0 == NULL ) && (dlsch1 != NULL )){
conv_rballoc(rah,
rballoc,
frame_parms->N_RB_DL,
dlsch1_harq->rb_alloc);
dlsch1_harq->nb_rb = conv_nprb(rah, rballoc, frame_parms->N_RB_DL);
}
/*if (dlsch0_harq->nb_rb == 0)
return(-1);*/
dlsch0_harq->mcs = mcs1;
dlsch1_harq->mcs = mcs2;
dlsch0_harq->rvidx = rv1;
dlsch1_harq->rvidx = rv2;
// assume both TBs are active // assume both TBs are active
dlsch0_harq->Nl = 1; if (dlsch0_harq != NULL)
dlsch1_harq->Nl = 1; dlsch0_harq->Nl = 1;
dlsch0->active = 1; if (dlsch1_harq != NULL)
dlsch1->active = 1; dlsch1_harq->Nl = 1;
// check if either TB is disabled (see 36-213 V11.3 Section ) // check if either TB is disabled (see 36-213 V11.3 Section )
if ((dlsch0_harq->rvidx == 1) && (dlsch0_harq->mcs == 0)) {
dlsch0->active = 0;
}
if ((dlsch1_harq->rvidx == 1) && (dlsch1_harq->mcs == 0)) {
dlsch1->active = 0;
}
if (frame_parms->nb_antennas_tx == 2) { if (frame_parms->nb_antennas_tx == 2) {
if (dlsch1->active == 1) { // both TBs are active if ((dlsch0 != NULL) && (dlsch1 != NULL)) { //two CW active
dlsch0_harq->dl_power_off = 1; dlsch0_harq->dl_power_off = 1;
dlsch1_harq->dl_power_off = 1; dlsch1_harq->dl_power_off = 1;
dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1]; dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1];
dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch0_harq->nb_rb-1]; dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch1_harq->nb_rb-1];
switch (tpmi) { switch (tpmi) {
case 0: case 0:
dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODING1; dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODING1;
dlsch1_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODING1; dlsch1_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODING1;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,0,1); dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,0,1);
dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,0,1); dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,0,1);
break; break;
case 1: case 1:
dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj; dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj;
dlsch1_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj; dlsch1_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,1,1); dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,1,1);
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,1,1); dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,1,1);
break;
case 2: // PUSCH precoding
dlsch0_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING;
dlsch0_harq->pmi_alloc = DL_pmi_single;
dlsch1_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING;
dlsch1_harq->pmi_alloc = DL_pmi_single;
break;
default:
break;
}
} else if ((dlsch0 != NULL) && (dlsch1 == NULL)) { // only CW 0 active
dlsch0_harq->dl_power_off = 1;
dlsch0_harq->TBS= TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1];
switch (tpmi) {
case 0 :
dlsch0_harq->mimo_mode = ALAMOUTI;
break;
case 1:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING11;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,0,0);
break;
case 2:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1m1;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,1,0);
break;
case 3:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1j;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,2,0);
break;
case 4:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1mj;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,3,0);
break;
case 5:
dlsch0_harq->mimo_mode = PUSCH_PRECODING0;
dlsch0_harq->pmi_alloc = DL_pmi_single;
break;
case 6:
dlsch0_harq->mimo_mode = PUSCH_PRECODING1;
dlsch0_harq->pmi_alloc = DL_pmi_single;
break;
}
} else if ((dlsch0 == NULL) && (dlsch1 != NULL)) {
dlsch1_harq->dl_power_off = 1;
dlsch1_harq->TBS= TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch1_harq->nb_rb-1];
switch (tpmi) {
case 0 :
dlsch1_harq->mimo_mode = ALAMOUTI;
break;
case 1:
dlsch1_harq->mimo_mode = UNIFORM_PRECODING11;
dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,0,0);
break;
case 2:
dlsch1_harq->mimo_mode = UNIFORM_PRECODING1m1;
dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,1,0);
break;
case 3:
dlsch1_harq->mimo_mode = UNIFORM_PRECODING1j;
dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,2,0);
break;
case 4:
dlsch1_harq->mimo_mode = UNIFORM_PRECODING1mj;
dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,3,0);
break;
case 5:
dlsch1_harq->mimo_mode = PUSCH_PRECODING0;
dlsch1_harq->pmi_alloc = DL_pmi_single;
break;
case 6:
dlsch1_harq->mimo_mode = PUSCH_PRECODING1;
dlsch1_harq->pmi_alloc = DL_pmi_single;
break;
}
}
break;
case 2: // PUSCH precoding
dlsch0_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING;
dlsch0_harq->pmi_alloc = DL_pmi_single;
dlsch1_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING;
dlsch1_harq->pmi_alloc = DL_pmi_single;
break;
default:
break;
}
}
else { // only one is active
dlsch0_harq->dl_power_off = 1;
dlsch0_harq->TBS= TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1];
switch (tpmi) {
case 0 :
dlsch0_harq->mimo_mode = ALAMOUTI;
break;
case 1:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING11;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,0,0);
break;
case 2:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1m1;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,1,0);
break;
case 3:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1j;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,2,0);
break;
case 4:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1mj;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,3,0);
break;
case 5:
dlsch0_harq->mimo_mode = PUSCH_PRECODING0;
dlsch0_harq->pmi_alloc = DL_pmi_single;
break;
case 6:
dlsch0_harq->mimo_mode = PUSCH_PRECODING1;
dlsch0_harq->pmi_alloc = DL_pmi_single;
break;
}
}
} else if (frame_parms->nb_antennas_tx == 4) { } else if (frame_parms->nb_antennas_tx == 4) {
// fill in later // fill in later
} }
// reset HARQ process if this is the first transmission // reset HARQ process if this is the first transmission
if (dlsch0_harq->round == 0) /* if (dlsch0_harq->round == 0)
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
if (dlsch1_harq->round == 0) if (dlsch1_harq->round == 0)
dlsch1_harq->status = ACTIVE; dlsch1_harq->status = ACTIVE;*/
if (dlsch0_harq != NULL)
dlsch0->rnti = rnti; dlsch0->rnti = rnti;
dlsch1->rnti = rnti; if (dlsch1 != NULL)
dlsch1->rnti = rnti;
break; break;
...@@ -1836,7 +1944,8 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -1836,7 +1944,8 @@ int generate_eNB_dlsch_params_from_dci(int frame,
// Flip the TB to codeword mapping as described in 5.3.3.1.5 of 36-212 V11.3.0 // Flip the TB to codeword mapping as described in 5.3.3.1.5 of 36-212 V11.3.0
// note that we must set tbswap=0 in eNB scheduler if one TB is deactivated // note that we must set tbswap=0 in eNB scheduler if one TB is deactivated
if (tbswap == 0) { // This must be set as in TM4, does not work properly now.
if (tbswap == 0) {
dlsch0 = dlsch[0]; dlsch0 = dlsch[0];
dlsch1 = dlsch[1]; dlsch1 = dlsch[1];
} else { } else {
...@@ -1900,7 +2009,7 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -1900,7 +2009,7 @@ int generate_eNB_dlsch_params_from_dci(int frame,
dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch0_harq->nb_rb-1]; dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch0_harq->nb_rb-1];
if ((dlsch0->active==1) && (dlsch1->active==1)) { if ((dlsch0->active==1) && (dlsch1->active==1)) {
dlsch0_harq->mimo_mode = LARGE_CDD; dlsch0_harq->mimo_mode = LARGE_CDD;
dlsch1_harq->mimo_mode = LARGE_CDD; dlsch1_harq->mimo_mode = LARGE_CDD;
dlsch0_harq->dl_power_off = 1; dlsch0_harq->dl_power_off = 1;
...@@ -2121,11 +2230,15 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -2121,11 +2230,15 @@ int generate_eNB_dlsch_params_from_dci(int frame,
dlsch0_harq = dlsch0->harq_processes[harq_pid]; dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid]; dlsch1_harq = dlsch1->harq_processes[harq_pid];
// Needs to be checked
dlsch0_harq->codeword=0;
dlsch1_harq->codeword=1;
conv_rballoc(rah, conv_rballoc(rah,
rballoc, rballoc,
frame_parms->N_RB_DL, frame_parms->N_RB_DL,
dlsch0_harq->rb_alloc); dlsch0_harq->rb_alloc);
dlsch1_harq->rb_alloc[0] = dlsch0_harq->rb_alloc[0]; dlsch1_harq->rb_alloc[0] = dlsch0_harq->rb_alloc[0];
dlsch0_harq->nb_rb = conv_nprb(rah, dlsch0_harq->nb_rb = conv_nprb(rah,
...@@ -2282,6 +2395,10 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -2282,6 +2395,10 @@ int generate_eNB_dlsch_params_from_dci(int frame,
dlsch0_harq = dlsch0->harq_processes[harq_pid]; dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid]; dlsch1_harq = dlsch1->harq_processes[harq_pid];
// Needs to be checked
dlsch0_harq->codeword=0;
dlsch1_harq->codeword=1;
conv_rballoc(rah, conv_rballoc(rah,
rballoc, rballoc,
frame_parms->N_RB_DL, frame_parms->N_RB_DL,
...@@ -2454,6 +2571,10 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -2454,6 +2571,10 @@ int generate_eNB_dlsch_params_from_dci(int frame,
dlsch0_harq = dlsch0->harq_processes[harq_pid]; dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid]; dlsch1_harq = dlsch1->harq_processes[harq_pid];
// Needs to be checked
dlsch0_harq->codeword=0;
dlsch1_harq->codeword=1;
conv_rballoc(rah, conv_rballoc(rah,
rballoc, rballoc,
frame_parms->N_RB_DL, frame_parms->N_RB_DL,
...@@ -2535,6 +2656,8 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -2535,6 +2656,8 @@ int generate_eNB_dlsch_params_from_dci(int frame,
//dlsch1->harq_ids[subframe] = harq_pid; //dlsch1->harq_ids[subframe] = harq_pid;
// printf("Setting DLSCH harq id %d to subframe %d\n",harq_pid,subframe); // printf("Setting DLSCH harq id %d to subframe %d\n",harq_pid,subframe);
dlsch0_harq = dlsch0->harq_processes[harq_pid]; dlsch0_harq = dlsch0->harq_processes[harq_pid];
// Needs to be checked
dlsch0_harq->codeword=0;
conv_rballoc(((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rah, conv_rballoc(((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rah,
((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rballoc,frame_parms->N_RB_DL, ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rballoc,frame_parms->N_RB_DL,
...@@ -2644,7 +2767,7 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -2644,7 +2767,7 @@ int generate_eNB_dlsch_params_from_dci(int frame,
break; break;
} }
if (dlsch0_harq) { if (dlsch0_harq) {
dlsch0_harq->frame = frame; dlsch0_harq->frame = frame;
dlsch0_harq->subframe = subframe; dlsch0_harq->subframe = subframe;
...@@ -2670,11 +2793,32 @@ int generate_eNB_dlsch_params_from_dci(int frame, ...@@ -2670,11 +2793,32 @@ int generate_eNB_dlsch_params_from_dci(int frame,
printf("dlsch0 eNB: mimo_mode %d\n",dlsch0_harq->mimo_mode); printf("dlsch0 eNB: mimo_mode %d\n",dlsch0_harq->mimo_mode);
} }
if (dlsch1) {
printf("dlsch1 eNB: dlsch1 %p\n",dlsch1);
printf("dlsch1 eNB: rnti %x\n",dlsch1->rnti);
printf("dlsch1 eNB: NBRB %d\n",dlsch1_harq->nb_rb);
printf("dlsch1 eNB: rballoc %x\n",dlsch1_harq->rb_alloc[0]);
printf("dlsch1 eNB: harq_pid %d\n",harq_pid);
printf("dlsch1 eNB: round %d\n",dlsch1_harq->round);
printf("dlsch1 eNB: rvidx %d\n",dlsch1_harq->rvidx);
printf("dlsch1 eNB: TBS %d (NPRB %d)\n",dlsch1_harq->TBS,NPRB);
printf("dlsch1 eNB: mcs %d\n",dlsch1_harq->mcs);
printf("dlsch1 eNB: tpmi %d\n",tpmi);
printf("dlsch1 eNB: mimo_mode %d\n",dlsch1_harq->mimo_mode);
}
#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);
} }
...@@ -3068,37 +3212,37 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci) ...@@ -3068,37 +3212,37 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci)
((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT6[conv_1C_RIV(((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->rballoc,6)]); ((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT6[conv_1C_RIV(((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->rballoc,6)]);
LOG_D(PHY,"MCS %d\n",((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->mcs); LOG_D(PHY,"MCS %d\n",((DCI1C_1_5MHz_t *)&dci->dci_pdu[0])->mcs);
break; break;
case 25: case 25:
LOG_D(PHY,"DCI format1C (5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); LOG_D(PHY,"DCI format1C (5MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]);
LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_5MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[conv_1C_RIV(((DCI1C_5MHz_t *)&dci->dci_pdu[0])->rballoc,25)]); LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_5MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT25[conv_1C_RIV(((DCI1C_5MHz_t *)&dci->dci_pdu[0])->rballoc,25)]);
LOG_D(PHY,"MCS %d\n",((DCI1C_5MHz_t *)&dci->dci_pdu[0])->mcs); LOG_D(PHY,"MCS %d\n",((DCI1C_5MHz_t *)&dci->dci_pdu[0])->mcs);
break; break;
case 50: case 50:
LOG_D(PHY,"DCI format1C (10MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); LOG_D(PHY,"DCI format1C (10MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]);
LOG_D(PHY,"Ngap %d\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->Ngap); LOG_D(PHY,"Ngap %d\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->Ngap);
LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[conv_1C_RIV(((DCI1C_10MHz_t *)&dci->dci_pdu[0])->rballoc,50)]); LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[conv_1C_RIV(((DCI1C_10MHz_t *)&dci->dci_pdu[0])->rballoc,50)]);
LOG_D(PHY,"MCS %d\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->mcs); LOG_D(PHY,"MCS %d\n",((DCI1C_10MHz_t *)&dci->dci_pdu[0])->mcs);
break; break;
case 100: case 100:
LOG_D(PHY,"DCI format1C (20MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]); LOG_D(PHY,"DCI format1C (20MHz), rnti %x (%x)\n",dci->rnti,((uint32_t*)&dci->dci_pdu[0])[0]);
LOG_D(PHY,"Ngap %d\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->Ngap); LOG_D(PHY,"Ngap %d\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->Ngap);
LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[conv_1C_RIV(((DCI1C_20MHz_t *)&dci->dci_pdu[0])->rballoc,100)]); LOG_D(PHY,"RB_ALLOC %x (NB_RB %d)\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->rballoc,RIV2nb_rb_LUT50[conv_1C_RIV(((DCI1C_20MHz_t *)&dci->dci_pdu[0])->rballoc,100)]);
LOG_D(PHY,"MCS %d\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->mcs); LOG_D(PHY,"MCS %d\n",((DCI1C_20MHz_t *)&dci->dci_pdu[0])->mcs);
break; break;
default: default:
LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL); LOG_E(PHY,"Invalid N_RB_DL %d\n", frame_parms->N_RB_DL);
DevParam (frame_parms->N_RB_DL, 0, 0); DevParam (frame_parms->N_RB_DL, 0, 0);
break; break;
} }
break; break;
case format2: case format2:
if ((frame_parms->frame_type == TDD) && if ((frame_parms->frame_type == TDD) &&
...@@ -3794,7 +3938,7 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci) ...@@ -3794,7 +3938,7 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci)
int generate_ue_dlsch_params_from_dci(int frame, int generate_ue_dlsch_params_from_dci(int frame,
uint8_t subframe, uint8_t subframe,
void *dci_pdu, void *dci_pdu,
uint16_t rnti, uint16_t rnti,
DCI_format_t dci_format, DCI_format_t dci_format,
...@@ -3812,13 +3956,14 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -3812,13 +3956,14 @@ int generate_ue_dlsch_params_from_dci(int frame,
uint8_t vrb_type=0; uint8_t vrb_type=0;
uint8_t mcs=0,mcs1=0,mcs2=0; uint8_t mcs=0,mcs1=0,mcs2=0;
uint8_t rv=0,rv1=0,rv2=0; uint8_t rv=0,rv1=0,rv2=0;
uint8_t TB0_active=0,TB1_active=0;
uint8_t ndi=0,ndi1=0,ndi2=0; uint8_t ndi=0,ndi1=0,ndi2=0;
uint8_t rah=0; uint8_t rah=0;
uint8_t TPC=0; uint8_t TPC=0;
uint8_t NPRB=0,tbswap=0,tpmi=0; uint8_t NPRB=0,tbswap=0,tpmi=0;
uint8_t Ngap; uint8_t Ngap;
LTE_UE_DLSCH_t *dlsch0=NULL,*dlsch1=NULL; LTE_UE_DLSCH_t *dlsch0=NULL,*dlsch1=NULL;
LTE_DL_UE_HARQ_t *dlsch0_harq,*dlsch1_harq; LTE_DL_UE_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL;
#ifdef DEBUG_DCI #ifdef DEBUG_DCI
LOG_D(PHY,"dci_tools.c: Filling ue dlsch params -> rnti %x, dci_format %d\n",rnti,dci_format); LOG_D(PHY,"dci_tools.c: Filling ue dlsch params -> rnti %x, dci_format %d\n",rnti,dci_format);
...@@ -3868,6 +4013,8 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -3868,6 +4013,8 @@ int generate_ue_dlsch_params_from_dci(int frame,
} }
dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
NPRB = RIV2nb_rb_LUT6[rballoc]; NPRB = RIV2nb_rb_LUT6[rballoc];
dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3]; dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3];
dlsch[0]->g_pucch += delta_PUCCH_lut[TPC&3]; dlsch[0]->g_pucch += delta_PUCCH_lut[TPC&3];
...@@ -4123,6 +4270,9 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -4123,6 +4270,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0_harq->mimo_mode = frame_parms->mode1_flag == 1 ?SISO : ALAMOUTI; dlsch0_harq->mimo_mode = frame_parms->mode1_flag == 1 ?SISO : ALAMOUTI;
dlsch0_harq->dl_power_off = 1; //no power offset dlsch0_harq->dl_power_off = 1; //no power offset
// Needs to be checked
dlsch0_harq->codeword=0;
LOG_D(PHY,"UE (%x/%d): Subframe %d Format1A DCI: ndi %d, old_ndi %d (first tx %d) harq_status %d, round %d\n", LOG_D(PHY,"UE (%x/%d): Subframe %d Format1A DCI: ndi %d, old_ndi %d (first tx %d) harq_status %d, round %d\n",
dlsch[0]->rnti, dlsch[0]->rnti,
harq_pid, harq_pid,
...@@ -4163,7 +4313,7 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -4163,7 +4313,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
harq_pid = 0; harq_pid = 0;
dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
switch (frame_parms->N_RB_DL) { switch (frame_parms->N_RB_DL) {
case 6: case 6:
mcs = ((DCI1C_1_5MHz_t *)dci_pdu)->mcs; mcs = ((DCI1C_1_5MHz_t *)dci_pdu)->mcs;
...@@ -4183,7 +4333,7 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -4183,7 +4333,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_odd_LUT25[rballoc]; dlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_odd_LUT25[rballoc];
RIV_max = RIV_max25; RIV_max = RIV_max25;
// printf("Format1C : %x : mcs %d, rballoc %d=>%d=>%x\n",((uint32_t*)dci_pdu)[0], // printf("Format1C : %x : mcs %d, rballoc %d=>%d=>%x\n",((uint32_t*)dci_pdu)[0],
// mcs,((DCI1C_5MHz_t *)dci_pdu)->rballoc,rballoc,dlsch0_harq->rb_alloc_even[0]); // mcs,((DCI1C_5MHz_t *)dci_pdu)->rballoc,rballoc,dlsch0_harq->rb_alloc_even[0]);
break; break;
...@@ -4193,16 +4343,16 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -4193,16 +4343,16 @@ int generate_ue_dlsch_params_from_dci(int frame,
Ngap = ((DCI1C_10MHz_t *)dci_pdu)->Ngap; Ngap = ((DCI1C_10MHz_t *)dci_pdu)->Ngap;
dlsch0_harq->nb_rb = RIV2nb_rb_LUT50[rballoc]; dlsch0_harq->nb_rb = RIV2nb_rb_LUT50[rballoc];
if (Ngap == 0) { if (Ngap == 0) {
dlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap0_even_LUT50_0[rballoc]; dlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap0_even_LUT50_0[rballoc];
dlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap0_odd_LUT50_0[rballoc]; dlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap0_odd_LUT50_0[rballoc];
dlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap0_even_LUT50_1[rballoc]; dlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap0_even_LUT50_1[rballoc];
dlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap0_odd_LUT50_1[rballoc]; dlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap0_odd_LUT50_1[rballoc];
} }
else { else {
dlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap1_even_LUT50_0[rballoc]; dlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap1_even_LUT50_0[rballoc];
dlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap1_odd_LUT50_0[rballoc]; dlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap1_odd_LUT50_0[rballoc];
dlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap1_even_LUT50_1[rballoc]; dlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap1_even_LUT50_1[rballoc];
dlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap1_odd_LUT50_1[rballoc]; dlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap1_odd_LUT50_1[rballoc];
} }
RIV_max = RIV_max50; RIV_max = RIV_max50;
...@@ -4214,28 +4364,28 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -4214,28 +4364,28 @@ int generate_ue_dlsch_params_from_dci(int frame,
Ngap = ((DCI1C_20MHz_t *)dci_pdu)->Ngap; Ngap = ((DCI1C_20MHz_t *)dci_pdu)->Ngap;
dlsch0_harq->nb_rb = RIV2nb_rb_LUT100[rballoc]; dlsch0_harq->nb_rb = RIV2nb_rb_LUT100[rballoc];
if (Ngap==0) { if (Ngap==0) {
dlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap0_even_LUT100_0[rballoc]; dlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap0_even_LUT100_0[rballoc];
dlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap0_odd_LUT100_0[rballoc]; dlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap0_odd_LUT100_0[rballoc];
dlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap0_even_LUT100_1[rballoc]; dlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap0_even_LUT100_1[rballoc];
dlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap0_odd_LUT100_1[rballoc]; dlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap0_odd_LUT100_1[rballoc];
dlsch0_harq->rb_alloc_even[2] = distRIV2alloc_gap0_even_LUT100_2[rballoc]; dlsch0_harq->rb_alloc_even[2] = distRIV2alloc_gap0_even_LUT100_2[rballoc];
dlsch0_harq->rb_alloc_odd[2] = distRIV2alloc_gap0_odd_LUT100_2[rballoc]; dlsch0_harq->rb_alloc_odd[2] = distRIV2alloc_gap0_odd_LUT100_2[rballoc];
dlsch0_harq->rb_alloc_even[3] = distRIV2alloc_gap0_even_LUT100_3[rballoc]; dlsch0_harq->rb_alloc_even[3] = distRIV2alloc_gap0_even_LUT100_3[rballoc];
dlsch0_harq->rb_alloc_odd[3] = distRIV2alloc_gap0_odd_LUT100_3[rballoc]; dlsch0_harq->rb_alloc_odd[3] = distRIV2alloc_gap0_odd_LUT100_3[rballoc];
} }
else { else {
dlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap1_even_LUT100_0[rballoc]; dlsch0_harq->rb_alloc_even[0] = distRIV2alloc_gap1_even_LUT100_0[rballoc];
dlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap1_odd_LUT100_0[rballoc]; dlsch0_harq->rb_alloc_odd[0] = distRIV2alloc_gap1_odd_LUT100_0[rballoc];
dlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap1_even_LUT100_1[rballoc]; dlsch0_harq->rb_alloc_even[1] = distRIV2alloc_gap1_even_LUT100_1[rballoc];
dlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap1_odd_LUT100_1[rballoc]; dlsch0_harq->rb_alloc_odd[1] = distRIV2alloc_gap1_odd_LUT100_1[rballoc];
dlsch0_harq->rb_alloc_even[2] = distRIV2alloc_gap1_even_LUT100_2[rballoc]; dlsch0_harq->rb_alloc_even[2] = distRIV2alloc_gap1_even_LUT100_2[rballoc];
dlsch0_harq->rb_alloc_odd[2] = distRIV2alloc_gap1_odd_LUT100_2[rballoc]; dlsch0_harq->rb_alloc_odd[2] = distRIV2alloc_gap1_odd_LUT100_2[rballoc];
dlsch0_harq->rb_alloc_even[3] = distRIV2alloc_gap1_even_LUT100_3[rballoc]; dlsch0_harq->rb_alloc_even[3] = distRIV2alloc_gap1_even_LUT100_3[rballoc];
dlsch0_harq->rb_alloc_odd[3] = distRIV2alloc_gap1_odd_LUT100_3[rballoc]; dlsch0_harq->rb_alloc_odd[3] = distRIV2alloc_gap1_odd_LUT100_3[rballoc];
} }
RIV_max = RIV_max100; RIV_max = RIV_max100;
/* /*
printf("Format1C : %x : mcs %d, rballoc %d=>%d=>(%08x.%08x.%08x.%08x), Ngap %d\n",((uint32_t*)dci_pdu)[0], printf("Format1C : %x : mcs %d, rballoc %d=>%d=>(%08x.%08x.%08x.%08x), Ngap %d\n",((uint32_t*)dci_pdu)[0],
mcs,((DCI1C_20MHz_t *)dci_pdu)->rballoc,rballoc, mcs,((DCI1C_20MHz_t *)dci_pdu)->rballoc,rballoc,
dlsch0_harq->rb_alloc_even[0], dlsch0_harq->rb_alloc_even[0],
dlsch0_harq->rb_alloc_even[1], dlsch0_harq->rb_alloc_even[1],
...@@ -4244,8 +4394,8 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -4244,8 +4394,8 @@ int generate_ue_dlsch_params_from_dci(int frame,
Ngap Ngap
); );
*/ */
break; break;
default: default:
LOG_E(PHY,"Format 1C: Unknown N_RB_DL %d\n",frame_parms->N_RB_DL); LOG_E(PHY,"Format 1C: Unknown N_RB_DL %d\n",frame_parms->N_RB_DL);
return(-1); return(-1);
...@@ -4262,9 +4412,9 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -4262,9 +4412,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch[0]->current_harq_pid = harq_pid; dlsch[0]->current_harq_pid = harq_pid;
if (rnti==si_rnti) { // rule from Section 5.3.1 of 36.321 if (rnti==si_rnti) { // rule from Section 5.3.1 of 36.321
if (((frame&1) == 0) && (subframe == 5)) if (((frame&1) == 0) && (subframe == 5))
dlsch0_harq->rvidx = (((3*((frame>>1)&3))+1)>>1)&3; // SIB1 dlsch0_harq->rvidx = (((3*((frame>>1)&3))+1)>>1)&3; // SIB1
else else
dlsch0_harq->rvidx = (((3*(subframe&3))+1)>>1)&3; // other SIBs dlsch0_harq->rvidx = (((3*(subframe&3))+1)>>1)&3; // other SIBs
} }
else if ((rnti==p_rnti) || (rnti==ra_rnti)) { // Section 7.1.7.3 else if ((rnti==p_rnti) || (rnti==ra_rnti)) { // Section 7.1.7.3
...@@ -4276,6 +4426,9 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -4276,6 +4426,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0_harq->mimo_mode = frame_parms->mode1_flag == 1 ?SISO : ALAMOUTI; dlsch0_harq->mimo_mode = frame_parms->mode1_flag == 1 ?SISO : ALAMOUTI;
dlsch0_harq->dl_power_off = 1; //no power offset dlsch0_harq->dl_power_off = 1; //no power offset
// Needs to be checked
dlsch0_harq->codeword=0;
LOG_D(PHY,"UE (%x/%d): Subframe %d Format1C DCI: harq_status %d, round %d\n", LOG_D(PHY,"UE (%x/%d): Subframe %d Format1C DCI: harq_status %d, round %d\n",
dlsch[0]->rnti, dlsch[0]->rnti,
harq_pid, harq_pid,
...@@ -4425,6 +4578,9 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -4425,6 +4578,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0_harq->dl_power_off = 1; //no power offset dlsch0_harq->dl_power_off = 1; //no power offset
// Needs to be checked
dlsch0_harq->codeword=0;
LOG_D(PHY,"UE (%x/%d): Subframe %d Format1 DCI: ndi %d, old_ndi %d (first tx %d) harq_status %d\n",dlsch[0]->rnti,harq_pid,subframe,ndi,dlsch0_harq->DCINdi, LOG_D(PHY,"UE (%x/%d): Subframe %d Format1 DCI: ndi %d, old_ndi %d (first tx %d) harq_status %d\n",dlsch[0]->rnti,harq_pid,subframe,ndi,dlsch0_harq->DCINdi,
dlsch0_harq->first_tx,dlsch0_harq->status); dlsch0_harq->first_tx,dlsch0_harq->status);
...@@ -4728,244 +4884,375 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -4728,244 +4884,375 @@ int generate_ue_dlsch_params_from_dci(int frame,
return(-1); return(-1);
} }
if (frame_type == TDD) // check if either TB is disabled (see 36-213 V8.6 p. 26)
tbswap = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->tb_swap; TB0_active = 1;
else TB1_active = 1;
tbswap = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->tb_swap;
if (tbswap == 0) { if ((rv1 == 1) && (mcs1 == 0)) {
dlsch0 = dlsch[0]; TB0_active=0;
dlsch1 = dlsch[1]; }
} else { if ((rv2 == 1) && (mcs2 == 0)) {
dlsch0 = dlsch[1]; TB1_active=0;
dlsch1 = dlsch[0];
} }
#ifdef DEBUG_HARQ
printf("[DCI UE]: TB0 status %d , TB1 status %d\n", TB0_active, TB1_active);
#endif
dlsch0_harq = dlsch0->harq_processes[harq_pid]; //printf("RV TB0 = %d\n", rv1);
dlsch1_harq = dlsch1->harq_processes[harq_pid];
dlsch0->current_harq_pid = harq_pid;
dlsch1->current_harq_pid = harq_pid;
dlsch0->harq_ack[subframe].harq_id = harq_pid;
dlsch1->harq_ack[subframe].harq_id = harq_pid;
conv_rballoc(rah,
rballoc,
frame_parms->N_RB_DL,
dlsch0_harq->rb_alloc_even);
dlsch0_harq->rb_alloc_odd[0]= dlsch0_harq->rb_alloc_even[0]; if (TB0_active && TB1_active && tbswap==0) { //dlsch0, dlsch0_harq are at the TB level
dlsch0_harq->rb_alloc_odd[1]= dlsch0_harq->rb_alloc_even[1]; dlsch0=dlsch[0];
dlsch0_harq->rb_alloc_odd[2]= dlsch0_harq->rb_alloc_even[2]; dlsch1=dlsch[1];
dlsch0_harq->rb_alloc_odd[3]= dlsch0_harq->rb_alloc_even[3]; dlsch0->active = 1;
dlsch1->active = 1;
dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid];
dlsch0_harq->mcs = mcs1;
dlsch1_harq->mcs = mcs2;
dlsch0_harq->rvidx = rv1;
dlsch1_harq->rvidx = rv2;
dlsch0_harq->status = ACTIVE;
dlsch1_harq->status = ACTIVE;
dlsch0_harq->codeword=0;
dlsch1_harq->codeword=1;
#ifdef DEBUG_HARQ
printf("[DCI UE]: BOTH ACTIVE\n");
#endif
}
else if (TB0_active && TB1_active && tbswap==1) {
dlsch0=dlsch[0];
dlsch1=dlsch[1];
dlsch0->active = 1;
dlsch1->active = 1;
dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid];
dlsch0_harq->mcs = mcs1;
dlsch1_harq->mcs = mcs2;
dlsch0_harq->rvidx = rv1;
dlsch1_harq->rvidx = rv2;
dlsch0_harq->status = ACTIVE;
dlsch1_harq->status = ACTIVE;
dlsch0_harq->codeword=1;
dlsch1_harq->codeword=0;
}
else if (TB0_active && (TB1_active==0)) {
dlsch0=dlsch[0];
dlsch0->active = 1;
dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch0_harq->mcs = mcs1;
dlsch0_harq->rvidx = rv1;
dlsch0_harq->status = ACTIVE;
dlsch0_harq->codeword = 0;
dlsch1=NULL;
dlsch1_harq = NULL;
#ifdef DEBUG_HARQ
printf("[DCI UE]: TB1 is deactivated, retransmit TB0 transmit in TM6\n");
#endif
}
else if ((TB0_active==0) && TB1_active) {
dlsch1=dlsch[1];
dlsch1->active = 1;
dlsch1_harq = dlsch1->harq_processes[harq_pid];
dlsch1_harq->mcs = mcs2;
dlsch1_harq->rvidx = rv2;
dlsch1_harq->status = ACTIVE;
dlsch1_harq->codeword = 0;
dlsch0=NULL;
dlsch0_harq = NULL;
#ifdef DEBUG_HARQ
printf("[DCI UE]: TB0 is deactivated, retransmit TB1 transmit in TM6\n");
#endif
}
dlsch1_harq->rb_alloc_even[0]= dlsch0_harq->rb_alloc_even[0];
dlsch1_harq->rb_alloc_even[1]= dlsch0_harq->rb_alloc_even[1];
dlsch1_harq->rb_alloc_even[2]= dlsch0_harq->rb_alloc_even[2];
dlsch1_harq->rb_alloc_even[3]= dlsch0_harq->rb_alloc_even[3];
dlsch1_harq->rb_alloc_odd[0] = dlsch0_harq->rb_alloc_odd[0];
dlsch1_harq->rb_alloc_odd[1] = dlsch0_harq->rb_alloc_odd[1];
dlsch1_harq->rb_alloc_odd[2] = dlsch0_harq->rb_alloc_odd[2];
dlsch1_harq->rb_alloc_odd[3] = dlsch0_harq->rb_alloc_odd[3];
dlsch0_harq->nb_rb = conv_nprb(rah, if (dlsch0 != NULL){
rballoc, dlsch0->current_harq_pid = harq_pid;
frame_parms->N_RB_DL); dlsch0->harq_ack[subframe].harq_id = harq_pid;
dlsch1_harq->nb_rb = dlsch0_harq->nb_rb; }
dlsch0_harq->mcs = mcs1; if (dlsch1 != NULL){
dlsch1_harq->mcs = mcs2; dlsch1->current_harq_pid = harq_pid;
dlsch1->harq_ack[subframe].harq_id = harq_pid;
}
dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3]; if (dlsch0_harq != NULL){
dlsch1_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3]; conv_rballoc(rah,
dlsch[0]->g_pucch += delta_PUCCH_lut[TPC&3]; rballoc,
dlsch[1]->g_pucch += delta_PUCCH_lut[TPC&3]; frame_parms->N_RB_DL,
/* dlsch0_harq->rb_alloc_even);
if (dlsch0_harq->mcs>20) {
printf("dci_tools.c: mcs > 20 disabled for now (asked %d)\n",dlsch0_harq->mcs); dlsch0_harq->rb_alloc_odd[0]= dlsch0_harq->rb_alloc_even[0];
return(-1); dlsch0_harq->rb_alloc_odd[1]= dlsch0_harq->rb_alloc_even[1];
dlsch0_harq->rb_alloc_odd[2]= dlsch0_harq->rb_alloc_even[2];
dlsch0_harq->rb_alloc_odd[3]= dlsch0_harq->rb_alloc_even[3];
if (dlsch1_harq != NULL){
dlsch1_harq->rb_alloc_even[0]= dlsch0_harq->rb_alloc_even[0];
dlsch1_harq->rb_alloc_even[1]= dlsch0_harq->rb_alloc_even[1];
dlsch1_harq->rb_alloc_even[2]= dlsch0_harq->rb_alloc_even[2];
dlsch1_harq->rb_alloc_even[3]= dlsch0_harq->rb_alloc_even[3];
dlsch1_harq->rb_alloc_odd[0] = dlsch0_harq->rb_alloc_odd[0];
dlsch1_harq->rb_alloc_odd[1] = dlsch0_harq->rb_alloc_odd[1];
dlsch1_harq->rb_alloc_odd[2] = dlsch0_harq->rb_alloc_odd[2];
dlsch1_harq->rb_alloc_odd[3] = dlsch0_harq->rb_alloc_odd[3];
dlsch1_harq->nb_rb = dlsch0_harq->nb_rb;
} }
*/
dlsch0_harq->nb_rb = conv_nprb(rah,
rballoc,
frame_parms->N_RB_DL);
dlsch0_harq->rvidx = rv1; } else if ((dlsch0_harq == NULL) && (dlsch1_harq != NULL)){
dlsch1_harq->rvidx = rv2;
// assume both TBs are active conv_rballoc(rah,
dlsch0_harq->Nl = 1; rballoc,
dlsch1_harq->Nl = 1; frame_parms->N_RB_DL,
dlsch0->active = 1; dlsch1_harq->rb_alloc_even);
dlsch1->active = 1;
dlsch1_harq->rb_alloc_odd[0]= dlsch1_harq->rb_alloc_even[0];
// check if either TB is disabled (see 36-213 V8.6 p. 26) dlsch1_harq->rb_alloc_odd[1]= dlsch1_harq->rb_alloc_even[1];
dlsch1_harq->rb_alloc_odd[2]= dlsch1_harq->rb_alloc_even[2];
dlsch1_harq->rb_alloc_odd[3]= dlsch1_harq->rb_alloc_even[3];
dlsch1_harq->nb_rb = conv_nprb(rah,
rballoc,
frame_parms->N_RB_DL);
}
if ((dlsch0_harq->rvidx == 1) && (dlsch0_harq->mcs == 0)) {
dlsch0_harq->status = DISABLED; if (dlsch0_harq != NULL) {
dlsch0_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3];
dlsch0->g_pucch += delta_PUCCH_lut[TPC&3];
} }
if ((dlsch1_harq->rvidx == 1) && (dlsch1_harq->mcs == 0)) { if (dlsch1_harq != NULL) {
dlsch1_harq->status = DISABLED; dlsch1_harq->delta_PUCCH = delta_PUCCH_lut[TPC&3];
dlsch1->g_pucch += delta_PUCCH_lut[TPC&3];
} }
dlsch0_harq->Nl = 1; // assume one layer per codeword (2 antenna port case)
dlsch1_harq->Nl = 1; if (dlsch0_harq != NULL)
dlsch0_harq->Nl = 1;
// dlsch0->layer_index = tbswap; if (dlsch1_harq != NULL)
// dlsch1->layer_index = 1-tbswap; dlsch1_harq->Nl = 1;
#ifdef DEBUG_HARQ
printf ("[DCI UE] tpmi = %d\n", tpmi);
#endif
if (dlsch1->active==1) { //two codewords
dlsch0_harq->dl_power_off = 1; if ((dlsch0 != NULL) && (dlsch1 != NULL)){ //two CW active
dlsch1_harq->dl_power_off = 1;
switch (tpmi) {
case 0:
dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODING1;
dlsch1_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODING1;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,0, 1);
dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,0, 1);
break;
case 1:
dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj;
dlsch1_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,1,1);
dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,1, 1);
break;
case 2: // PUSCH precoding
dlsch0_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING;
dlsch0_harq->pmi_alloc = dlsch0->pmi_alloc;
dlsch1_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING;
dlsch1_harq->pmi_alloc = dlsch0->pmi_alloc^0x1555;
break;
default:
break;
}
}
else {
dlsch0_harq->dl_power_off = 1; dlsch0_harq->dl_power_off = 1;
dlsch1_harq->dl_power_off = 1;
switch (tpmi) { switch (tpmi) {
case 0 : case 0:
dlsch0_harq->mimo_mode = ALAMOUTI; dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODING1;
break; dlsch1_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODING1;
case 1: dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,0, 1);
dlsch0_harq->mimo_mode = UNIFORM_PRECODING11; dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,0, 1);
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,0, 0); break;
break; case 1:
case 2: dlsch0_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj;
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1m1; dlsch1_harq->mimo_mode = DUALSTREAM_UNIFORM_PRECODINGj;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,1, 0); dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,1, 1);
break; dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,1, 1);
case 3: break;
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1j; case 2: // PUSCH precoding
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,2, 0); dlsch0_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING;
break; dlsch1_harq->mimo_mode = DUALSTREAM_PUSCH_PRECODING;
case 4: if (tbswap==0){
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1mj; dlsch0_harq->pmi_alloc = dlsch0->pmi_alloc;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,3, 0); dlsch1_harq->pmi_alloc = dlsch0->pmi_alloc^0x1555;
break; } else {
case 5: dlsch1_harq->pmi_alloc = dlsch0->pmi_alloc;
dlsch0_harq->mimo_mode = PUSCH_PRECODING0; dlsch0_harq->pmi_alloc = dlsch0->pmi_alloc^0x1555;
// pmi stored from ulsch allocation routine }
dlsch0_harq->pmi_alloc = dlsch0->pmi_alloc; break;
//LOG_I(PHY,"XXX using PMI %x\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc)); default:
break; break;
case 6:
dlsch0_harq->mimo_mode = PUSCH_PRECODING1;
LOG_E(PHY,"Unsupported TPMI\n");
return(-1);
break;
} }
} } else if ((dlsch0 != NULL) && (dlsch1 == NULL)) { // only CW 0 active
dlsch0_harq->dl_power_off = 1;
switch (tpmi) {
case 0 :
dlsch0_harq->mimo_mode = ALAMOUTI;
break;
case 1:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING11;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,0, 0);
break;
case 2:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1m1;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,1, 0);
break;
case 3:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1j;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,2, 0);
break;
case 4:
dlsch0_harq->mimo_mode = UNIFORM_PRECODING1mj;
dlsch0_harq->pmi_alloc = pmi_extend(frame_parms,3, 0);
break;
case 5:
dlsch0_harq->mimo_mode = PUSCH_PRECODING0;
// pmi stored from ulsch allocation routine
// we need to extract the first column of precoding matrix (which was computed assuming rank==2)
dlsch0_harq->pmi_alloc = dlsch0->pmi_alloc;;//pmi_convert(frame_parms,dlsch0->pmi_alloc,0);
//LOG_I(PHY,"XXX using PMI %x\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc));
#ifdef DEBUG_HARQ
printf ("[DCI UE] I am calling from the UE side pmi_alloc_new = %d\n", dlsch0->pmi_alloc);
#endif
break;
case 6:
dlsch0_harq->mimo_mode = PUSCH_PRECODING1;
// we need to extract the second column of precoding matrix (which was computed assuming rank==2)
dlsch0_harq->pmi_alloc = dlsch0->pmi_alloc;;//pmi_convert(frame_parms,dlsch0->pmi_alloc,1);
#ifdef DEBUG_HARQ
printf ("[DCI UE] I am calling from the UE side pmi_alloc_new = %d\n", dlsch0->pmi_alloc);
#endif
break;
#ifdef DEBUG_HARQ
printf("[DCI UE] harq0 MIMO mode = %d\n", dlsch0_harq->mimo_mode);
#endif
}
} else {
dlsch1_harq->dl_power_off = 1;
switch (tpmi) {
case 0 :
dlsch1_harq->mimo_mode = ALAMOUTI;
break;
case 1:
dlsch1_harq->mimo_mode = UNIFORM_PRECODING11;
dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,0, 0);
break;
case 2:
dlsch1_harq->mimo_mode = UNIFORM_PRECODING1m1;
dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,1, 0);
break;
case 3:
dlsch1_harq->mimo_mode = UNIFORM_PRECODING1j;
dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,2, 0);
break;
case 4:
dlsch1_harq->mimo_mode = UNIFORM_PRECODING1mj;
dlsch1_harq->pmi_alloc = pmi_extend(frame_parms,3, 0);
break;
case 5:
dlsch1_harq->mimo_mode = PUSCH_PRECODING0;
// pmi stored from ulsch allocation routine
dlsch1_harq->pmi_alloc = dlsch1->pmi_alloc;
#ifdef DEBUG_HARQ
printf ("[DCI UE] I am calling from the UE side pmi_alloc_new = %d\n", dlsch1->pmi_alloc);
#endif
if (frame_parms->mode1_flag == 1) //LOG_I(PHY,"XXX using PMI %x\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc));
break;
case 6:
dlsch1_harq->mimo_mode = PUSCH_PRECODING1;
dlsch1_harq->pmi_alloc = dlsch1->pmi_alloc;
#ifdef DEBUG_HARQ
printf ("[DCI UE] I am calling from the UE side pmi_alloc_new = %d\n", dlsch1->pmi_alloc);
#endif
return(-1);
break;
}
#ifdef DEBUG_HARQ
printf("[DCI UE] harq1 MIMO mode = %d\n", dlsch1_harq->mimo_mode);
#endif
}
//printf(" UE DCI harq0 MIMO mode = %d\n", dlsch0_harq->mimo_mode);
if ((frame_parms->mode1_flag == 1) && (dlsch0_harq != NULL))
dlsch0_harq->mimo_mode = SISO; dlsch0_harq->mimo_mode = SISO;
if (dlsch0->active == 1) { if (dlsch0 != NULL) {
if ((ndi1!=dlsch0_harq->DCINdi) || if ((ndi1!=dlsch0_harq->DCINdi) || (dlsch0_harq->first_tx==1)) {
(dlsch0_harq->first_tx==1)) { dlsch0_harq->round = 0;
dlsch0_harq->round = 0; dlsch0_harq->status = ACTIVE;
dlsch0_harq->status = ACTIVE; dlsch0_harq->DCINdi = ndi1;
dlsch0_harq->DCINdi = ndi1;
if (dlsch0_harq->first_tx==1) { if ( dlsch0_harq->first_tx==1) {
LOG_D(PHY,"Format 2 DCI First TX0: Clearing flag\n"); LOG_D(PHY,"Format 2 DCI First TX0: Clearing flag\n");
dlsch0_harq->first_tx = 0; dlsch0_harq->first_tx = 0;
} }
} } else if (dlsch0_harq->status == SCH_IDLE) { // we got an Ndi = 0 for a previously decoded process,
else if (dlsch0_harq->status == SCH_IDLE) { // we got an Ndi = 0 for a previously decoded process,
// this happens if either another harq process in the same // this happens if either another harq process in the same
// is NAK or an ACK was not received // is NAK or an ACK was not received
dlsch0->harq_ack[subframe].ack = 1; dlsch0->harq_ack[subframe].ack = 1;
dlsch0->harq_ack[subframe].harq_id = harq_pid; dlsch0->harq_ack[subframe].harq_id = harq_pid;
dlsch0->harq_ack[subframe].send_harq_status = 1; dlsch0->harq_ack[subframe].send_harq_status = 1;
dlsch0->active = 0; dlsch0->active = 0;
} }
} }
if (dlsch1->active == 1) { if ((dlsch1 != NULL) && (dlsch1->active == 1 )) {
if ((ndi2!=dlsch1_harq->DCINdi) || if ((ndi2!=dlsch1_harq->DCINdi) || (dlsch1_harq->first_tx==1)) {
(dlsch1_harq->first_tx==1)) { dlsch1_harq->round = 0;
dlsch1_harq->round = 0; dlsch1_harq->status = ACTIVE;
dlsch1_harq->status = ACTIVE; dlsch1_harq->DCINdi = ndi2;
dlsch1_harq->DCINdi = ndi2; if (dlsch1_harq->first_tx==1) {
if (dlsch1_harq->first_tx==1) { LOG_D(PHY,"Format 2 DCI First TX1: Clearing flag\n");
LOG_D(PHY,"Format 2 DCI First TX1: Clearing flag\n"); dlsch1_harq->first_tx = 0;
dlsch1_harq->first_tx = 0; }
} }
} else if ((dlsch1 != NULL) && (dlsch1_harq->status == SCH_IDLE)) { // we got an Ndi = 0 for a previously decoded process,
else if (dlsch1_harq->status == SCH_IDLE) { // we got an Ndi = 0 for a previously decoded process,
// this happens if either another harq process in the same // this happens if either another harq process in the same
// is NAK or an ACK was not received // is NAK or an ACK was not received
dlsch1->harq_ack[subframe].ack = 1; dlsch1->harq_ack[subframe].ack = 1;
dlsch1->harq_ack[subframe].harq_id = harq_pid; dlsch1->harq_ack[subframe].harq_id = harq_pid;
dlsch1->harq_ack[subframe].send_harq_status = 1; dlsch1->harq_ack[subframe].send_harq_status = 1;
dlsch1->active = 0; dlsch1->active = 0;
} }
} }
dlsch0_harq->mcs = mcs1; if (dlsch0 != NULL){
if (dlsch0_harq->nb_rb>1) {
if (dlsch0_harq->nb_rb>1) { dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1];
dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1]; if (mcs1 <= 28)
if (mcs1 <= 28) dlsch0_harq->Qm = get_Qm(mcs1);
dlsch0_harq->Qm = get_Qm(mcs1); else if (mcs1<=31)
else if (mcs1<=31) dlsch0_harq->Qm = (mcs1-28)<<1;
dlsch0_harq->Qm = (mcs1-28)<<1; else
else LOG_E(PHY,"invalid mcs1 %d\n",mcs1);
LOG_E(PHY,"invalid mcs1 %d\n",mcs1); } else
dlsch0_harq->TBS =0;
} else
dlsch0_harq->TBS =0;
/*
if (dlsch0_harq->mcs > 18)
printf("mcs %d, TBS %d\n",dlsch0_harq->mcs,dlsch0_harq->TBS);
*/
if (dlsch1_harq->DCINdi != ndi2) { dlsch0->rnti = rnti;
dlsch1_harq->round=0;
dlsch1_harq->status = ACTIVE;
} }
dlsch1_harq->DCINdi = ndi2; if (dlsch1 != NULL) {
dlsch1_harq->mcs = mcs2; if (dlsch1_harq->DCINdi != ndi2) {
dlsch1_harq->round=0;
dlsch1_harq->status = ACTIVE;
}
if (dlsch1_harq->nb_rb>1) { dlsch1_harq->DCINdi = ndi2;
dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch1_harq->nb_rb-1];
if (mcs2 <= 28)
dlsch1_harq->Qm = get_Qm(mcs2);
else if (mcs1<=31)
dlsch1_harq->Qm = (mcs2-28)<<1;
else
LOG_E(PHY,"invalid mcs2 %d\n",mcs2);
} else
dlsch1_harq->TBS = 0;
if (dlsch1_harq->nb_rb>1) {
dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch1_harq->nb_rb-1];
if (mcs2 <= 28)
dlsch1_harq->Qm = get_Qm(mcs2);
else if (mcs1<=31)
dlsch1_harq->Qm = (mcs2-28)<<1;
else
LOG_E(PHY,"invalid mcs2 %d\n",mcs2);
} else
dlsch1_harq->TBS = 0;
dlsch0->rnti = rnti; dlsch1->rnti = rnti;
dlsch1->rnti = rnti; }
#ifdef DEBUG_HARQ
if (dlsch0 != NULL && dlsch1 != NULL)
printf("[DCI UE] dlsch0_harq status = %d, dlsch1_harq status = %d\n", dlsch0_harq->status, dlsch1_harq->status);
else if (dlsch0 == NULL && dlsch1 != NULL)
printf("[DCI UE] dlsch0_harq NULL dlsch1_harq status = %d\n", dlsch1_harq->status);
else if (dlsch0 != NULL && dlsch1 == NULL)
printf("[DCI UE] dlsch1_harq NULL dlsch0_harq status = %d\n", dlsch0_harq->status);
#endif
break; break;
...@@ -5208,6 +5495,7 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -5208,6 +5495,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
// Flip the TB to codeword mapping as described in 5.3.3.1.5 of 36-212 V11.3.0 // Flip the TB to codeword mapping as described in 5.3.3.1.5 of 36-212 V11.3.0
// note that we must set tbswap=0 in eNB scheduler if one TB is deactivated // note that we must set tbswap=0 in eNB scheduler if one TB is deactivated
//Needs to be done in the same manner as TM$.
if (tbswap == 0) { if (tbswap == 0) {
dlsch0 = dlsch[0]; dlsch0 = dlsch[0];
dlsch1 = dlsch[1]; dlsch1 = dlsch[1];
...@@ -5218,6 +5506,9 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -5218,6 +5506,9 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
dlsch1_harq = dlsch[1]->harq_processes[harq_pid]; dlsch1_harq = dlsch[1]->harq_processes[harq_pid];
// Needs to be checked
dlsch0_harq->codeword=0;
dlsch1_harq->codeword=1;
dlsch0->current_harq_pid = harq_pid; dlsch0->current_harq_pid = harq_pid;
dlsch1->current_harq_pid = harq_pid; dlsch1->current_harq_pid = harq_pid;
dlsch0->harq_ack[subframe].harq_id = harq_pid; dlsch0->harq_ack[subframe].harq_id = harq_pid;
...@@ -5341,7 +5632,7 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -5341,7 +5632,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch0_harq->nb_rb-1]; dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch0_harq->nb_rb-1];
if ((dlsch0->active==1) && (dlsch1->active==1)) { if ((dlsch0->active==1) && (dlsch1->active==1)) {
dlsch0_harq->mimo_mode = LARGE_CDD; dlsch0_harq->mimo_mode = LARGE_CDD;
dlsch1_harq->mimo_mode = LARGE_CDD; dlsch1_harq->mimo_mode = LARGE_CDD;
...@@ -5434,14 +5725,14 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -5434,14 +5725,14 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0_harq->Qm = (mcs1-28)<<1; dlsch0_harq->Qm = (mcs1-28)<<1;
else else
LOG_E(PHY,"invalid mcs1 %d\n",mcs1); LOG_E(PHY,"invalid mcs1 %d\n",mcs1);
if (mcs2 <= 28) if (mcs2 <= 28)
dlsch1_harq->Qm = get_Qm(mcs2); dlsch1_harq->Qm = get_Qm(mcs2);
else if (mcs2<=31) else if (mcs2<=31)
dlsch1_harq->Qm = (mcs2-28)<<1; dlsch1_harq->Qm = (mcs2-28)<<1;
else else
LOG_E(PHY,"invalid mcs2 %d\n",mcs2); LOG_E(PHY,"invalid mcs2 %d\n",mcs2);
// printf("Format 2A: NPRB=%d (rballoc %x,mcs1 %d, mcs2 %d, frame_type %d N_RB_DL %d,active %d/%d)\n",NPRB,rballoc,mcs1,mcs2,frame_parms->frame_type,frame_parms->N_RB_DL,dlsch0->active,dlsch1->active); // printf("Format 2A: NPRB=%d (rballoc %x,mcs1 %d, mcs2 %d, frame_type %d N_RB_DL %d,active %d/%d)\n",NPRB,rballoc,mcs1,mcs2,frame_parms->frame_type,frame_parms->N_RB_DL,dlsch0->active,dlsch1->active);
//printf("UE (%x/%d): Subframe %d Format2A DCI: ndi1 %d, old_ndi1 %d, ndi2 %d, old_ndi2 %d (first tx1 %d, first tx2 %d) harq_status1 %d, harq_status2 %d\n",dlsch0->rnti,harq_pid,subframe,ndi,dlsch0_harq->DCINdi, //printf("UE (%x/%d): Subframe %d Format2A DCI: ndi1 %d, old_ndi1 %d, ndi2 %d, old_ndi2 %d (first tx1 %d, first tx2 %d) harq_status1 %d, harq_status2 %d\n",dlsch0->rnti,harq_pid,subframe,ndi,dlsch0_harq->DCINdi,
// dlsch0_harq->first_tx,dlsch1_harq->first_tx,dlsch0_harq->status,dlsch1_harq->status); // dlsch0_harq->first_tx,dlsch1_harq->first_tx,dlsch0_harq->status,dlsch1_harq->status);
...@@ -5476,10 +5767,12 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -5476,10 +5767,12 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0 = dlsch[0]; dlsch0 = dlsch[0];
dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
// Needs to be checked
dlsch0_harq->codeword=0;
conv_rballoc(((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rah, conv_rballoc(((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rah,
((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rballoc,frame_parms->N_RB_DL, ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rballoc,frame_parms->N_RB_DL,
dlsch0_harq->rb_alloc_even); dlsch0_harq->rb_alloc_even);
dlsch0_harq->rb_alloc_odd[0] = dlsch0_harq->rb_alloc_even[0]; dlsch0_harq->rb_alloc_odd[0] = dlsch0_harq->rb_alloc_even[0];
dlsch0_harq->rb_alloc_odd[1] = dlsch0_harq->rb_alloc_even[1]; dlsch0_harq->rb_alloc_odd[1] = dlsch0_harq->rb_alloc_even[1];
dlsch0_harq->rb_alloc_odd[2] = dlsch0_harq->rb_alloc_even[2]; dlsch0_harq->rb_alloc_odd[2] = dlsch0_harq->rb_alloc_even[2];
...@@ -5633,11 +5926,19 @@ int generate_ue_dlsch_params_from_dci(int frame, ...@@ -5633,11 +5926,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
if (dlsch0_harq != NULL){
computeRhoA_UE(pdsch_config_dedicated, dlsch[0],dlsch0_harq->dl_power_off, frame_parms->nb_antennas_tx_eNB);
computeRhoB_UE(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[0],dlsch0_harq->dl_power_off);
}
if (dlsch1_harq != NULL) {
computeRhoA_UE(pdsch_config_dedicated, dlsch[1],dlsch1_harq->dl_power_off, frame_parms->nb_antennas_tx_eNB);
computeRhoB_UE(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[1],dlsch1_harq->dl_power_off);
}
// compute DL power control parameters
computeRhoA_UE(pdsch_config_dedicated, dlsch[0],dlsch0_harq->dl_power_off, frame_parms->nb_antennas_tx_eNB);
computeRhoB_UE(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[0],dlsch0_harq->dl_power_off);
return(0); return(0);
} }
...@@ -5790,6 +6091,52 @@ uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, ui ...@@ -5790,6 +6091,52 @@ uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, ui
} }
int32_t pmi_convert_rank1_from_rank2(uint16_t pmi_alloc, int tpmi, int nb_rb)
{
int nb_subbands = 0;
int32_t pmi_alloc_new = 0, pmi_new = 0, pmi_old = 0;
int i;
switch (nb_rb) {
case 6:
nb_subbands = 6;
break;
default:
case 25:
nb_subbands = 7;
break;
case 50:
nb_subbands = 9;
break;
case 100:
nb_subbands = 13;
break;
}
for (i = 0; i < nb_subbands; i++) {
pmi_old = (pmi_alloc >> i)&1;
if (pmi_old == 0)
if (tpmi == 5)
pmi_new = 0;
else
pmi_new = 1;
else
if (tpmi == 5)
pmi_new = 2;
else
pmi_new = 3;
pmi_alloc_new|=pmi_new<<(2*i);
}
#ifdef DEBUG_HARQ
printf(" [DCI UE] pmi_alloc_old %d, pmi_alloc_new %d pmi_old %d , pmi_new %d\n", pmi_alloc, pmi_alloc_new,pmi_old, pmi_new );
#endif
return(pmi_alloc_new);
}
uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb) uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb)
{ {
...@@ -5799,8 +6146,8 @@ uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb) ...@@ -5799,8 +6146,8 @@ uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb)
uint8_t rank = meas->rank[eNB_id]; uint8_t rank = meas->rank[eNB_id];
int pmi_re,pmi_im; int pmi_re,pmi_im;
int nb_subbands=0; int nb_subbands=0;
switch (nb_rb) { switch (nb_rb) {
case 6: case 6:
nb_subbands = 6; nb_subbands = 6;
...@@ -5816,7 +6163,7 @@ uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb) ...@@ -5816,7 +6163,7 @@ uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb)
nb_subbands = 13; nb_subbands = 13;
break; break;
} }
for (i=0; i<nb_subbands; i++) { for (i=0; i<nb_subbands; i++) {
pmi_re = 0; pmi_re = 0;
...@@ -5843,8 +6190,8 @@ uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb) ...@@ -5843,8 +6190,8 @@ uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb)
// printf("subband %d, pmi%d \n",i,pmiq); // printf("subband %d, pmi%d \n",i,pmiq);
pmivect |= (pmiq<<(2*i)); pmivect |= (pmiq<<(2*i));
} }
else if (rank==1) { else if (rank==1) {
for (aarx=0; aarx<meas->nb_antennas_rx; aarx++) { for (aarx=0; aarx<meas->nb_antennas_rx; aarx++) {
pmi_re += meas->subband_pmi_re[eNB_id][i][aarx]; pmi_re += meas->subband_pmi_re[eNB_id][i][aarx];
...@@ -5856,22 +6203,24 @@ uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb) ...@@ -5856,22 +6203,24 @@ uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_rb)
// this is orthogonal // this is orthogonal
//if (((pmi_re >= pmi_im) && (pmi_re >= -pmi_im)) || ((pmi_re <= pmi_im) && (pmi_re >= -pmi_im))) //if (((pmi_re >= pmi_im) && (pmi_re >= -pmi_im)) || ((pmi_re <= pmi_im) && (pmi_re >= -pmi_im)))
pmiq = PMI_2A_R1_11; pmiq = PMI_2A_R1_11;
else else
pmiq = PMI_2A_R1_1j; pmiq = PMI_2A_R1_1j;
// printf("subband %d, pmi_re %d, pmi_im %d, pmiq %d \n",i,pmi_re,pmi_im,pmiq); // printf("subband %d, pmi_re %d, pmi_im %d, pmiq %d \n",i,pmi_re,pmi_im,pmiq);
// printf("subband %d, pmi%d \n",i,pmiq); // printf("subband %d, pmi%d \n",i,pmiq);
//According to Section 7.2.4 of 36.213 //According to Section 7.2.4 of 36.213
pmivect |= ((pmiq-1)<<(i)); //shift 1 since only one bit pmivect |= ((pmiq-1)<<(i)); //shift 1 since only one bit
} }
else { else {
LOG_E(PHY,"PMI feedback for rank %d not possible!\n",rank); LOG_E(PHY,"PMI feedback for rank>1 not supported!\n");
} pmivect = 0;
}
}
// printf( "pmivect %d \n", pmivect);
}
#ifdef DEBUG_HARQ
printf( "quantize_subband_pmi pmivect %d \n", pmivect);
#endif
return(pmivect); return(pmivect);
} }
...@@ -6342,7 +6691,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, ...@@ -6342,7 +6691,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
uint8_t subframe, uint8_t subframe,
DCI_format_t dci_format, DCI_format_t dci_format,
PHY_VARS_UE *ue, PHY_VARS_UE *ue,
UE_rxtx_proc_t *proc, UE_rxtx_proc_t *proc,
uint16_t si_rnti, uint16_t si_rnti,
uint16_t ra_rnti, uint16_t ra_rnti,
uint16_t p_rnti, uint16_t p_rnti,
...@@ -7189,8 +7538,8 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, ...@@ -7189,8 +7538,8 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
} }
int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc, eNB_rxtx_proc_t *proc,
void *dci_pdu, void *dci_pdu,
uint16_t rnti, uint16_t rnti,
DCI_format_t dci_format, DCI_format_t dci_format,
uint8_t UE_id, uint8_t UE_id,
...@@ -7228,11 +7577,9 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -7228,11 +7577,9 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
harq_pid = subframe2harq_pid(frame_parms, harq_pid = subframe2harq_pid(frame_parms,
pdcch_alloc2ul_frame(frame_parms, pdcch_alloc2ul_frame(frame_parms,
proc->frame_tx, proc->frame_tx,
subframe), subframe),
pdcch_alloc2ul_subframe(frame_parms,subframe)); pdcch_alloc2ul_subframe(frame_parms,subframe));
switch (frame_parms->N_RB_DL) { switch (frame_parms->N_RB_DL) {
case 6: case 6:
if (frame_parms->frame_type == TDD) { if (frame_parms->frame_type == TDD) {
......
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
#define PMI_2A_1j 2 #define PMI_2A_1j 2
#define PMI_2A_1mj 3 #define PMI_2A_1mj 3
//2 layers //2 layers
#define PMI_2A_R1_10 0 #define PMI_2A_R1_10 0
#define PMI_2A_R1_11 1 #define PMI_2A_R1_11 1
#define PMI_2A_R1_1j 2 #define PMI_2A_R1_1j 2
...@@ -172,6 +172,8 @@ typedef struct { ...@@ -172,6 +172,8 @@ typedef struct {
uint8_t Nlayers; uint8_t Nlayers;
/// First layer for this PSCH transmission /// First layer for this PSCH transmission
uint8_t first_layer; uint8_t first_layer;
/// codeword this transport block is mapped to
uint8_t codeword;
} LTE_DL_eNB_HARQ_t; } LTE_DL_eNB_HARQ_t;
typedef struct { typedef struct {
...@@ -575,6 +577,8 @@ typedef struct { ...@@ -575,6 +577,8 @@ typedef struct {
uint32_t trials[8]; uint32_t trials[8];
/// error statistics per round /// error statistics per round
uint32_t errors[8]; uint32_t errors[8];
/// codeword this transport block is mapped to
uint8_t codeword;
} LTE_DL_UE_HARQ_t; } LTE_DL_UE_HARQ_t;
typedef struct { typedef struct {
......
...@@ -93,11 +93,11 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) ...@@ -93,11 +93,11 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch)
#endif #endif
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++) { for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++) {
#ifdef DEBUG_DLSCH_FREE #ifdef DEBUG_DLSCH_FREE
printf("Freeing dlsch process %d c[%d] (%p)\n",i,r,dlsch->harq_processes[i]->c[r]); printf("Freeing dlsch process %d c[%d] (%p)\n",i,r,dlsch->harq_processes[i]->c[r]);
#endif #endif
if (dlsch->harq_processes[i]->c[r]) { if (dlsch->harq_processes[i]->c[r]) {
free16(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768); free16(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
dlsch->harq_processes[i]->c[r] = NULL; dlsch->harq_processes[i]->c[r] = NULL;
...@@ -106,17 +106,17 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) ...@@ -106,17 +106,17 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch)
free16(dlsch->harq_processes[i]->d[r],(96+12+3+(3*6144))); free16(dlsch->harq_processes[i]->d[r],(96+12+3+(3*6144)));
dlsch->harq_processes[i]->d[r] = NULL; dlsch->harq_processes[i]->d[r] = NULL;
} }
} }
free16(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t)); free16(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t));
dlsch->harq_processes[i] = NULL; dlsch->harq_processes[i] = NULL;
} }
} }
free16(dlsch,sizeof(LTE_eNB_DLSCH_t)); free16(dlsch,sizeof(LTE_eNB_DLSCH_t));
dlsch = NULL; dlsch = NULL;
} }
} }
LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_t Nsoft,unsigned char N_RB_DL, uint8_t abstraction_flag) LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_t Nsoft,unsigned char N_RB_DL, uint8_t abstraction_flag)
...@@ -208,7 +208,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_ ...@@ -208,7 +208,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
if (dlsch->harq_processes[i]->d[r]) if (dlsch->harq_processes[i]->d[r])
dlsch->harq_processes[i]->d[r][j] = LTE_NULL; dlsch->harq_processes[i]->d[r][j] = LTE_NULL;
} }
} }
return(dlsch); return(dlsch);
...@@ -247,7 +247,7 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch) ...@@ -247,7 +247,7 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++) for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++)
if (dlsch->harq_processes[i]->d[r]) if (dlsch->harq_processes[i]->d[r])
dlsch->harq_processes[i]->d[r][j] = LTE_NULL; dlsch->harq_processes[i]->d[r][j] = LTE_NULL;
} }
} }
} }
...@@ -698,6 +698,7 @@ int dlsch_encoding(unsigned char *a, ...@@ -698,6 +698,7 @@ int dlsch_encoding(unsigned char *a,
nb_rb, nb_rb,
m); // r m); // r
stop_meas(rm_stats); stop_meas(rm_stats);
//printf("dlsch->harq_processes[harq_pid]->rvidx = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
#ifdef DEBUG_DLSCH_CODING #ifdef DEBUG_DLSCH_CODING
if (r==dlsch->harq_processes[harq_pid]->C-1) if (r==dlsch->harq_processes[harq_pid]->C-1)
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#include "SCHED/extern.h" #include "SCHED/extern.h"
#include "SIMULATION/TOOLS/defs.h" #include "SIMULATION/TOOLS/defs.h"
//#define DEBUG_DLSCH_DECODING //#define DEBUG_DLSCH_DECODING
void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch) void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
{ {
...@@ -340,7 +340,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -340,7 +340,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
for (r=0; r<harq_process->C; r++) { for (r=0; r<harq_process->C; r++) {
// Get Turbo interleaver parameters // Get Turbo interleaver parameters
if (r<harq_process->Cminus) if (r<harq_process->Cminus)
Kr = harq_process->Kminus; Kr = harq_process->Kminus;
...@@ -384,7 +384,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -384,7 +384,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
harq_process->round); harq_process->round);
#endif #endif
//printf("dlsch->harq_processes[harq_pid]->rvidx = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
if (lte_rate_matching_turbo_rx(harq_process->RTC[r], if (lte_rate_matching_turbo_rx(harq_process->RTC[r],
G, G,
harq_process->w[r], harq_process->w[r],
...@@ -478,7 +478,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -478,7 +478,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
stop_meas(dlsch_turbo_decoding_stats); stop_meas(dlsch_turbo_decoding_stats);
} }
#else #else
if ((harq_process->C == 1) || if ((harq_process->C == 1) ||
((r==harq_process->C-1) && (skipped_last==0))) { // last segment with odd number of segments ((r==harq_process->C-1) && (skipped_last==0))) { // last segment with odd number of segments
start_meas(dlsch_turbo_decoding_stats); start_meas(dlsch_turbo_decoding_stats);
...@@ -510,7 +510,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -510,7 +510,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
} }
else { else {
skipped_last=0; skipped_last=0;
if (Kr_last == Kr) { // decode 2 code segments with AVX2 version if (Kr_last == Kr) { // decode 2 code segments with AVX2 version
#ifdef DEBUG_DLSCH_DECODING #ifdef DEBUG_DLSCH_DECODING
printf("single decoding segment %d (%p)\n",r-1,&harq_process->d[r-1][96]); printf("single decoding segment %d (%p)\n",r-1,&harq_process->d[r-1][96]);
...@@ -557,7 +557,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -557,7 +557,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
exit(-1);*/ exit(-1);*/
stop_meas(dlsch_turbo_decoding_stats); stop_meas(dlsch_turbo_decoding_stats);
} }
else { // Kr_last != Kr else { // Kr_last != Kr
start_meas(dlsch_turbo_decoding_stats); start_meas(dlsch_turbo_decoding_stats);
ret = tc ret = tc
...@@ -577,7 +577,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -577,7 +577,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
&phy_vars_ue->dlsch_tc_intl1_stats, &phy_vars_ue->dlsch_tc_intl1_stats,
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1); &phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
stop_meas(dlsch_turbo_decoding_stats); stop_meas(dlsch_turbo_decoding_stats);
start_meas(dlsch_turbo_decoding_stats); start_meas(dlsch_turbo_decoding_stats);
ret = tc ret = tc
(&harq_process->d[r][96], (&harq_process->d[r][96],
...@@ -596,7 +596,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -596,7 +596,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
&phy_vars_ue->dlsch_tc_intl1_stats, &phy_vars_ue->dlsch_tc_intl1_stats,
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1); &phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
stop_meas(dlsch_turbo_decoding_stats); stop_meas(dlsch_turbo_decoding_stats);
} }
} }
} }
...@@ -718,7 +718,7 @@ int dlsch_abstraction_EESM(double* sinr_dB, uint8_t TM, uint32_t rb_alloc[4], ui ...@@ -718,7 +718,7 @@ int dlsch_abstraction_EESM(double* sinr_dB, uint8_t TM, uint32_t rb_alloc[4], ui
bler = interp(sinr_eff,&sinr_bler_map[mcs][0][0],&sinr_bler_map[mcs][1][0],table_length[mcs]); bler = interp(sinr_eff,&sinr_bler_map[mcs][0][0],&sinr_bler_map[mcs][1][0],table_length[mcs]);
#ifdef USER_MODE // need to be adapted for the emulation in the kernel space #ifdef USER_MODE // need to be adapted for the emulation in the kernel space
if (uniformrandom() < bler) { if (uniformrandom() < bler) {
LOG_I(OCM,"abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f, TM %d)\n",mcs,sinr_eff,bler, TM); LOG_I(OCM,"abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f, TM %d)\n",mcs,sinr_eff,bler, TM);
...@@ -801,7 +801,7 @@ int dlsch_abstraction_MIESM(double* sinr_dB,uint8_t TM, uint32_t rb_alloc[4], ui ...@@ -801,7 +801,7 @@ int dlsch_abstraction_MIESM(double* sinr_dB,uint8_t TM, uint32_t rb_alloc[4], ui
bler = interp(sinr_eff,&sinr_bler_map[mcs][0][0],&sinr_bler_map[mcs][1][0],table_length[mcs]); bler = interp(sinr_eff,&sinr_bler_map[mcs][0][0],&sinr_bler_map[mcs][1][0],table_length[mcs]);
#ifdef USER_MODE // need to be adapted for the emulation in the kernel space #ifdef USER_MODE // need to be adapted for the emulation in the kernel space
if (uniformrandom() < bler) { if (uniformrandom() < bler) {
LOG_N(OCM,"abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler); LOG_N(OCM,"abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -169,10 +169,10 @@ int allocate_REs_in_RB_no_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -169,10 +169,10 @@ int allocate_REs_in_RB_no_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *x0p; uint8_t *x0p;
if (skip_dc == 0) { if (skip_dc == 0) {
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0; for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0;
re<12; re<12;
re++,x0p+=4,tti_offset++) { re++,x0p+=4,tti_offset++) {
qam16_table_offset_re=TWO[x0p[0]]; qam16_table_offset_re=TWO[x0p[0]];
qam16_table_offset_im=TWO[x0p[1]]; qam16_table_offset_im=TWO[x0p[1]];
qam16_table_offset_re+=x0p[2]; qam16_table_offset_re+=x0p[2];
...@@ -182,11 +182,11 @@ int allocate_REs_in_RB_no_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -182,11 +182,11 @@ int allocate_REs_in_RB_no_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
} }
} }
else { else {
// 1st half of PRB // 1st half of PRB
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0; for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0;
re<6; re<6;
re++,x0p+=4,tti_offset++) { re++,x0p+=4,tti_offset++) {
qam16_table_offset_re=TWO[x0p[0]]; qam16_table_offset_re=TWO[x0p[0]];
qam16_table_offset_im=TWO[x0p[1]]; qam16_table_offset_im=TWO[x0p[1]];
qam16_table_offset_re+=x0p[2]; qam16_table_offset_re+=x0p[2];
...@@ -194,11 +194,11 @@ int allocate_REs_in_RB_no_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -194,11 +194,11 @@ int allocate_REs_in_RB_no_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam16_table_offset_re]; ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam16_table_offset_re];
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam16_table_offset_im]; ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam16_table_offset_im];
} }
// 2nd half of PRB // 2nd half of PRB
for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+7; for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+7;
re<12; re<12;
re++,x0p+=4,tti_offset++) { re++,x0p+=4,tti_offset++) {
qam16_table_offset_re=TWO[x0p[0]]; qam16_table_offset_re=TWO[x0p[0]];
qam16_table_offset_im=TWO[x0p[1]]; qam16_table_offset_im=TWO[x0p[1]];
qam16_table_offset_re+=x0p[2]; qam16_table_offset_re+=x0p[2];
...@@ -209,7 +209,7 @@ int allocate_REs_in_RB_no_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -209,7 +209,7 @@ int allocate_REs_in_RB_no_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
} }
*re_allocated = *re_allocated + 12; *re_allocated = *re_allocated + 12;
*jj=*jj + 48; *jj=*jj + 48;
return(0); return(0);
} }
...@@ -232,7 +232,7 @@ int allocate_REs_in_RB_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -232,7 +232,7 @@ int allocate_REs_in_RB_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
int *P1_SHIFT, int *P1_SHIFT,
int *P2_SHIFT) int *P2_SHIFT)
{ {
uint8_t *x0 = dlsch0_harq->e; uint8_t *x0 = dlsch0_harq->e;
uint32_t qam16_table_offset_re = 0; uint32_t qam16_table_offset_re = 0;
...@@ -245,10 +245,10 @@ int allocate_REs_in_RB_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -245,10 +245,10 @@ int allocate_REs_in_RB_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
if (skip_dc == 0) { if (skip_dc == 0) {
// printf("pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]); // printf("pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]);
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0]; for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0];
re<12; re<12;
x0p+=4) { x0p+=4) {
qam16_table_offset_re=TWO[x0p[0]]; qam16_table_offset_re=TWO[x0p[0]];
qam16_table_offset_im=TWO[x0p[1]]; qam16_table_offset_im=TWO[x0p[1]];
qam16_table_offset_re+=x0p[2]; qam16_table_offset_re+=x0p[2];
...@@ -261,10 +261,10 @@ int allocate_REs_in_RB_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -261,10 +261,10 @@ int allocate_REs_in_RB_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
} }
} }
else { else {
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0]; for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0];
re<6; re<6;
x0p+=4) { x0p+=4) {
qam16_table_offset_re=TWO[x0p[0]]; qam16_table_offset_re=TWO[x0p[0]];
qam16_table_offset_im=TWO[x0p[1]]; qam16_table_offset_im=TWO[x0p[1]];
qam16_table_offset_re+=x0p[2]; qam16_table_offset_re+=x0p[2];
...@@ -275,10 +275,10 @@ int allocate_REs_in_RB_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -275,10 +275,10 @@ int allocate_REs_in_RB_pilots_16QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
re+=P1_SHIFT[re+1]; re+=P1_SHIFT[re+1];
} }
for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+6+P1_SHIFT[6]; for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+6+P1_SHIFT[6];
re<12; re<12;
x0p+=4) { x0p+=4) {
qam16_table_offset_re=TWO[x0p[0]]; qam16_table_offset_re=TWO[x0p[0]];
qam16_table_offset_im=TWO[x0p[1]]; qam16_table_offset_im=TWO[x0p[1]];
qam16_table_offset_re+=x0p[2]; qam16_table_offset_re+=x0p[2];
...@@ -328,10 +328,10 @@ int allocate_REs_in_RB_no_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -328,10 +328,10 @@ int allocate_REs_in_RB_no_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
x0p=&x0[*jj],tti_offset=symbol_offset+re_offset; x0p=&x0[*jj],tti_offset=symbol_offset+re_offset;
/* for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0; /* for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0;
re<12; re<12;
re+=4,x0p+=24,tti_offset+=4) {*/ re+=4,x0p+=24,tti_offset+=4) {*/
qam64_table_offset_re=(x0p[0]<<2)|(x0p[2]<<1)|x0p[4]; qam64_table_offset_re=(x0p[0]<<2)|(x0p[2]<<1)|x0p[4];
qam64_table_offset_im=(x0p[1]<<2)|(x0p[3]<<1)|x0p[5]; qam64_table_offset_im=(x0p[1]<<2)|(x0p[3]<<1)|x0p[5];
((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam64_table_offset_re]; ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam64_table_offset_re];
...@@ -396,10 +396,10 @@ int allocate_REs_in_RB_no_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -396,10 +396,10 @@ int allocate_REs_in_RB_no_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
// } // }
} }
else { else {
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0; for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset,re=0;
re<6; re<6;
re++,x0p+=6,tti_offset++) { re++,x0p+=6,tti_offset++) {
qam64_table_offset_re=FOUR[x0p[0]]; qam64_table_offset_re=FOUR[x0p[0]];
qam64_table_offset_im=FOUR[x0p[1]]; qam64_table_offset_im=FOUR[x0p[1]];
qam64_table_offset_re+=TWO[x0p[2]]; qam64_table_offset_re+=TWO[x0p[2]];
...@@ -410,10 +410,10 @@ int allocate_REs_in_RB_no_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -410,10 +410,10 @@ int allocate_REs_in_RB_no_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam64_table_offset_im]; ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam64_table_offset_im];
} }
for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+7; for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+7;
re<12; re<12;
re++,x0p+=6,tti_offset++) { re++,x0p+=6,tti_offset++) {
qam64_table_offset_re=FOUR[x0p[0]]; qam64_table_offset_re=FOUR[x0p[0]];
qam64_table_offset_im=FOUR[x0p[1]]; qam64_table_offset_im=FOUR[x0p[1]];
qam64_table_offset_re+=TWO[x0p[2]]; qam64_table_offset_re+=TWO[x0p[2]];
...@@ -427,7 +427,7 @@ int allocate_REs_in_RB_no_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -427,7 +427,7 @@ int allocate_REs_in_RB_no_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
*re_allocated = *re_allocated + 12; *re_allocated = *re_allocated + 12;
*jj=*jj + 72; *jj=*jj + 72;
return(0); return(0);
} }
...@@ -450,7 +450,7 @@ int allocate_REs_in_RB_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -450,7 +450,7 @@ int allocate_REs_in_RB_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
int *P1_SHIFT, int *P1_SHIFT,
int *P2_SHIFT) int *P2_SHIFT)
{ {
uint8_t *x0 = dlsch0_harq->e; uint8_t *x0 = dlsch0_harq->e;
uint32_t qam64_table_offset_re = 0; uint32_t qam64_table_offset_re = 0;
...@@ -463,10 +463,10 @@ int allocate_REs_in_RB_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -463,10 +463,10 @@ int allocate_REs_in_RB_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
if (skip_dc == 0) { if (skip_dc == 0) {
// printf("pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]); // printf("pilots: P1_SHIFT[0] %d\n",P1_SHIFT[0]);
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0]; for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0];
re<12; re<12;
x0p+=6) { x0p+=6) {
qam64_table_offset_re=FOUR[x0p[0]]; qam64_table_offset_re=FOUR[x0p[0]];
qam64_table_offset_im=FOUR[x0p[1]]; qam64_table_offset_im=FOUR[x0p[1]];
qam64_table_offset_re+=TWO[x0p[2]]; qam64_table_offset_re+=TWO[x0p[2]];
...@@ -481,10 +481,10 @@ int allocate_REs_in_RB_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -481,10 +481,10 @@ int allocate_REs_in_RB_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
} }
} }
else { else {
for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0]; for (x0p=&x0[*jj],tti_offset=symbol_offset+re_offset+P1_SHIFT[0],re=P1_SHIFT[0];
re<6; re<6;
x0p+=6) { x0p+=6) {
qam64_table_offset_re=FOUR[x0p[0]]; qam64_table_offset_re=FOUR[x0p[0]];
qam64_table_offset_im=FOUR[x0p[1]]; qam64_table_offset_im=FOUR[x0p[1]];
qam64_table_offset_re+=TWO[x0p[2]]; qam64_table_offset_re+=TWO[x0p[2]];
...@@ -497,10 +497,10 @@ int allocate_REs_in_RB_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -497,10 +497,10 @@ int allocate_REs_in_RB_pilots_64QAM_siso(LTE_DL_FRAME_PARMS *frame_parms,
re+=P1_SHIFT[re+1]; re+=P1_SHIFT[re+1];
} }
for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+6+P1_SHIFT[6]; for (tti_offset=symbol_offset+re_offset-frame_parms->ofdm_symbol_size+6+P1_SHIFT[6];
re<12; re<12;
x0p+=6) { x0p+=6) {
qam64_table_offset_re=FOUR[x0p[0]]; qam64_table_offset_re=FOUR[x0p[0]];
qam64_table_offset_im=FOUR[x0p[1]]; qam64_table_offset_im=FOUR[x0p[1]];
qam64_table_offset_re+=TWO[x0p[2]]; qam64_table_offset_re+=TWO[x0p[2]];
...@@ -540,13 +540,13 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -540,13 +540,13 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
{ {
uint8_t *x0 = 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;
uint8_t mod_order0 = get_Qm(dlsch0_harq->mcs); uint8_t mod_order0; // = get_Qm(dlsch0_harq->mcs);
uint8_t mod_order1=2; uint8_t mod_order1; //=2;
uint8_t precoder_index0,precoder_index1; uint8_t precoder_index0,precoder_index1;
uint8_t *x1=NULL; uint8_t *x1=NULL;
...@@ -584,18 +584,48 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -584,18 +584,48 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15); gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15);
// if (mimo_mode == LARGE_CDD) gain_lin_QPSK>>=1; // if (mimo_mode == LARGE_CDD) gain_lin_QPSK>>=1;
if (dlsch1_harq) {
if ((dlsch0_harq != NULL) && (dlsch1_harq != NULL)) { //this is for TM3, TM4
x0 = dlsch0_harq->e;
mimo_mode = dlsch0_harq->mimo_mode;
first_layer0 = dlsch0_harq->first_layer;
Nlayers0 = dlsch0_harq->Nlayers;
mod_order0 = get_Qm(dlsch0_harq->mcs);
x1 = dlsch1_harq->e; x1 = dlsch1_harq->e;
// Fill these in later for TM8-10 // Fill these in later for TM8-10
// Nlayers1 = dlsch1_harq->Nlayers; // Nlayers1 = dlsch1_harq->Nlayers;
// first_layer1 = dlsch1_harq->first_layer; // first_layer1 = dlsch1_harq->first_layer;
mod_order1 = get_Qm(dlsch1_harq->mcs); mod_order1 = get_Qm(dlsch1_harq->mcs);
} else if ((dlsch0_harq != NULL) && (dlsch1_harq == NULL)){ //This is for SIS0 TM1, TM6, etc
x0 = dlsch0_harq->e;
mimo_mode = dlsch0_harq->mimo_mode;
first_layer0 = dlsch0_harq->first_layer;
Nlayers0 = dlsch0_harq->Nlayers;
mod_order0 = get_Qm(dlsch0_harq->mcs);
} else if ((dlsch0_harq == NULL) && (dlsch1_harq != NULL)){ // This is for TM4 retransmission
x0 = dlsch1_harq->e;
mimo_mode = dlsch1_harq->mimo_mode;
first_layer0 = dlsch1_harq->first_layer;
Nlayers0 = dlsch1_harq->Nlayers;
mod_order0 = get_Qm(dlsch1_harq->mcs);
} }
#ifdef DEBUG_DLSCH_MODULATION if (dlsch0_harq != NULL){
printf("allocate_re (mod %d): symbol_offset %d re_offset %d (%d,%d), jj %d -> %d,%d\n",mod_order0,symbol_offset,re_offset,skip_dc,skip_half,*jj, x0[*jj], x0[1+*jj]); #ifdef DEBUG_DLSCH_MODULATION
#endif printf("allocate_re (mod %d): symbol_offset %d re_offset %d (%d,%d), jj %d -> %d,%d\n",mod_order0,symbol_offset,re_offset,skip_dc,skip_half,*jj, x0[*jj], x0[1+*jj]);
#endif
} else{
#ifdef DEBUG_DLSCH_MODULATION
printf("allocate_re (mod %d): symbol_offset %d re_offset %d (%d,%d), jj %d -> %d,%d\n",mod_order0,symbol_offset,re_offset,skip_dc,skip_half,*jj, x0[*jj], x0[1+*jj]);
#endif
}
first_re=0; first_re=0;
last_re=12; last_re=12;
...@@ -723,7 +753,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -723,7 +753,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
else if (mimo_mode == ALAMOUTI) { else if (mimo_mode == ALAMOUTI) {
*re_allocated = *re_allocated + 1; *re_allocated = *re_allocated + 1;
amp = (int16_t)(((int32_t)tmp_amp*ONE_OVER_SQRT2_Q15)>>15); amp = (int16_t)(((int32_t)tmp_amp*ONE_OVER_SQRT2_Q15)>>15);
...@@ -749,23 +779,23 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -749,23 +779,23 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15);
break; break;
case 4: //16QAM case 4: //16QAM
// Antenna 0 position n // Antenna 0 position n
qam16_table_offset_re = 0; qam16_table_offset_re = 0;
qam16_table_offset_im = 0; qam16_table_offset_im = 0;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_re+=2; qam16_table_offset_re+=2;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_im+=2; qam16_table_offset_im+=2;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_re+=1; qam16_table_offset_re+=1;
*jj=*jj+1; *jj=*jj+1;
...@@ -775,12 +805,12 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -775,12 +805,12 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); ((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); ((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
//((int16_t *)&txdataF[0][tti_offset])[0]+=(qam_table_s0[qam16_table_offset_re]*ONE_OVER_SQRT2_Q15)>>15; //((int16_t *)&txdataF[0][tti_offset])[0]+=(qam_table_s0[qam16_table_offset_re]*ONE_OVER_SQRT2_Q15)>>15;
//((int16_t *)&txdataF[0][tti_offset])[1]+=(qam_table_s0[qam16_table_offset_im]*ONE_OVER_SQRT2_Q15)>>15; //((int16_t *)&txdataF[0][tti_offset])[1]+=(qam_table_s0[qam16_table_offset_im]*ONE_OVER_SQRT2_Q15)>>15;
// Antenna 1 position n Real part -> -x1* // Antenna 1 position n Real part -> -x1*
qam16_table_offset_re = 0; qam16_table_offset_re = 0;
qam16_table_offset_im = 0; qam16_table_offset_im = 0;
...@@ -790,8 +820,8 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -790,8 +820,8 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_im+=2; qam16_table_offset_im+=2;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_re+=1; qam16_table_offset_re+=1;
*jj=*jj+1; *jj=*jj+1;
...@@ -802,13 +832,13 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -802,13 +832,13 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); ((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); ((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
//((int16_t *)&txdataF[1][tti_offset])[0]+=-qam_table_s0[qam16_table_offset_re]; //((int16_t *)&txdataF[1][tti_offset])[0]+=-qam_table_s0[qam16_table_offset_re];
//((int16_t *)&txdataF[1][tti_offset])[1]+=qam_table_s0[qam16_table_offset_im]; //((int16_t *)&txdataF[1][tti_offset])[1]+=qam_table_s0[qam16_table_offset_im];
break; break;
case 6: // 64-QAM case 6: // 64-QAM
// Antenna 0 // Antenna 0
qam64_table_offset_re = 0; qam64_table_offset_re = 0;
qam64_table_offset_im = 0; qam64_table_offset_im = 0;
...@@ -831,11 +861,11 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -831,11 +861,11 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_im+=1; qam64_table_offset_im+=1;
*jj=*jj+1; *jj=*jj+1;
//((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); //((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
//((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); //((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
((int16_t *)&txdataF[0][tti_offset])[0]+=(qam_table_s0[qam64_table_offset_re]*ONE_OVER_SQRT2_Q15)>>15; ((int16_t *)&txdataF[0][tti_offset])[0]+=(qam_table_s0[qam64_table_offset_re]*ONE_OVER_SQRT2_Q15)>>15;
((int16_t *)&txdataF[0][tti_offset])[1]+=(qam_table_s0[qam64_table_offset_im]*ONE_OVER_SQRT2_Q15)>>15; ((int16_t *)&txdataF[0][tti_offset])[1]+=(qam_table_s0[qam64_table_offset_im]*ONE_OVER_SQRT2_Q15)>>15;
// Antenna 1 => -x1* // Antenna 1 => -x1*
qam64_table_offset_re = 0; qam64_table_offset_re = 0;
...@@ -861,12 +891,12 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -861,12 +891,12 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
//((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); //((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
//((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); //((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
((int16_t *)&txdataF[1][tti_offset])[0]+=-qam_table_s0[qam64_table_offset_re]; ((int16_t *)&txdataF[1][tti_offset])[0]+=-qam_table_s0[qam64_table_offset_re];
((int16_t *)&txdataF[1][tti_offset])[1]+=qam_table_s0[qam64_table_offset_im]; ((int16_t *)&txdataF[1][tti_offset])[1]+=qam_table_s0[qam64_table_offset_im];
break; break;
} }
// fill in the rest of the ALAMOUTI precoding // fill in the rest of the ALAMOUTI precoding
if (is_not_pilot(pilots,re + 1,frame_parms->nushift,use2ndpilots)==1) { if (is_not_pilot(pilots,re + 1,frame_parms->nushift,use2ndpilots)==1) {
((int16_t *)&txdataF[0][tti_offset+1])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1 ((int16_t *)&txdataF[0][tti_offset+1])[0] += -((int16_t *)&txdataF[1][tti_offset])[0]; //x1
((int16_t *)&txdataF[0][tti_offset+1])[1] += ((int16_t *)&txdataF[1][tti_offset])[1]; ((int16_t *)&txdataF[0][tti_offset+1])[1] += ((int16_t *)&txdataF[1][tti_offset])[1];
...@@ -900,9 +930,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -900,9 +930,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
*jj = *jj + 1; *jj = *jj + 1;
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break; break;
case 4: //16QAM case 4: //16QAM
qam16_table_offset_re0 = 0; qam16_table_offset_re0 = 0;
qam16_table_offset_im0 = 0; qam16_table_offset_im0 = 0;
if (x0[*jj] == 1) if (x0[*jj] == 1)
...@@ -911,25 +941,25 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -911,25 +941,25 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_im0+=2; qam16_table_offset_im0+=2;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_re0+=1; qam16_table_offset_re0+=1;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_im0+=1; qam16_table_offset_im0+=1;
*jj=*jj+1; *jj=*jj+1;
xx0_re = qam_table_s0[qam16_table_offset_re0]; xx0_re = qam_table_s0[qam16_table_offset_re0];
xx0_im = qam_table_s0[qam16_table_offset_im0]; xx0_im = qam_table_s0[qam16_table_offset_im0];
break; break;
case 6: //64QAM case 6: //64QAM
qam64_table_offset_re0 = 0; qam64_table_offset_re0 = 0;
qam64_table_offset_im0 = 0; qam64_table_offset_im0 = 0;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_re0+=4; qam64_table_offset_re0+=4;
*jj=*jj+1; *jj=*jj+1;
...@@ -953,7 +983,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -953,7 +983,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
xx0_im = qam_table_s0[qam64_table_offset_im0]; xx0_im = qam_table_s0[qam64_table_offset_im0];
break; break;
} }
switch (mod_order1) { switch (mod_order1) {
...@@ -965,15 +995,15 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -965,15 +995,15 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
case 2: //QPSK case 2: //QPSK
//printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
xx1_re = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; xx1_re = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj2 = *jj2 + 1; *jj2 = *jj2 + 1;
xx1_im = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; xx1_im = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj2 = *jj2 + 1; *jj2 = *jj2 + 1;
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break; break;
case 4: //16QAM case 4: //16QAM
qam16_table_offset_re1 = 0; qam16_table_offset_re1 = 0;
qam16_table_offset_im1 = 0; qam16_table_offset_im1 = 0;
if (x1[*jj2] == 1) if (x1[*jj2] == 1)
...@@ -993,12 +1023,12 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -993,12 +1023,12 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
xx1_im = qam_table_s1[qam16_table_offset_im1]; xx1_im = qam_table_s1[qam16_table_offset_im1];
break; break;
case 6: //64QAM case 6: //64QAM
qam64_table_offset_re1 = 0; qam64_table_offset_re1 = 0;
qam64_table_offset_im1 = 0; qam64_table_offset_im1 = 0;
if (x1[*jj2] == 1) if (x1[*jj2] == 1)
qam64_table_offset_re1+=4; qam64_table_offset_re1+=4;
*jj2 = *jj2 + 1; *jj2 = *jj2 + 1;
...@@ -1022,14 +1052,14 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1022,14 +1052,14 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
xx1_im = qam_table_s1[qam64_table_offset_im1]; xx1_im = qam_table_s1[qam64_table_offset_im1];
break; break;
} }
// This implements the Large CDD precoding for 2 TX antennas // This implements the Large CDD precoding for 2 TX antennas
// - - - - - - - - - - - - // - - - - - - - - - - - -
//| y0 | | 1 0 || 1 0 || 1 1 || x0 | | x0 + x1 | //| y0 | | 1 0 || 1 0 || 1 1 || x0 | | x0 + x1 |
//| y1 | = .5 | 0 1 || 0 (-1)^i || 1 -1 || x1 | = .5| (-1)^i(x0 - x1)| //| y1 | = .5 | 0 1 || 0 (-1)^i || 1 -1 || x1 | = .5| (-1)^i(x0 - x1)|
// - - - - - - - - - - - // - - - - - - - - - - -
// Note: Factor .5 is accounted for in amplitude when calling this function // Note: Factor .5 is accounted for in amplitude when calling this function
((int16_t *)&txdataF[0][tti_offset])[0]+=((xx0_re+xx1_re)>>1); ((int16_t *)&txdataF[0][tti_offset])[0]+=((xx0_re+xx1_re)>>1);
((int16_t *)&txdataF[1][tti_offset])[0]+=(s*((xx0_re-xx1_re)>>1)); ((int16_t *)&txdataF[1][tti_offset])[0]+=(s*((xx0_re-xx1_re)>>1));
...@@ -1044,9 +1074,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1044,9 +1074,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
s = -s; s = -s;
} }
} }
else if ((mimo_mode >= UNIFORM_PRECODING11)&&(mimo_mode <= PUSCH_PRECODING1)) { else if ((mimo_mode >= UNIFORM_PRECODING11)&&(mimo_mode <= PUSCH_PRECODING1)) {
// this is for transmission modes 5-6 (1 layer) // this is for transmission modes 5-6 (1 layer)
*re_allocated = *re_allocated + 1; *re_allocated = *re_allocated + 1;
amp = (int16_t)(((int32_t)tmp_amp*ONE_OVER_SQRT2_Q15)>>15); amp = (int16_t)(((int32_t)tmp_amp*ONE_OVER_SQRT2_Q15)>>15);
switch (mod_order0) { switch (mod_order0) {
...@@ -1068,9 +1098,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1068,9 +1098,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
} }
break; break;
case 4: case 4:
qam16_table_offset_re = 0; qam16_table_offset_re = 0;
qam16_table_offset_im = 0; qam16_table_offset_im = 0;
...@@ -1080,22 +1110,22 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1080,22 +1110,22 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_im+=2; qam16_table_offset_im+=2;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_re+=1; qam16_table_offset_re+=1;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_im+=1; qam16_table_offset_im+=1;
*jj=*jj+1; *jj=*jj+1;
((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam16_table_offset_re])); ((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam16_table_offset_re]));
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam16_table_offset_im])); ((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam16_table_offset_im]));
((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15);
if (frame_parms->nb_antennas_tx == 2) { if (frame_parms->nb_antennas_tx == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15);
...@@ -1103,7 +1133,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1103,7 +1133,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
} }
break; break;
case 6: case 6:
qam64_table_offset_re = 0; qam64_table_offset_re = 0;
...@@ -1126,25 +1156,25 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1126,25 +1156,25 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_im+=1; qam64_table_offset_im+=1;
*jj=*jj+1; *jj=*jj+1;
((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam64_table_offset_re])); ((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam64_table_offset_re]));
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam64_table_offset_im])); ((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam64_table_offset_im]));
((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15);
if (frame_parms->nb_antennas_tx == 2) { if (frame_parms->nb_antennas_tx == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15);
} }
break; break;
} }
} }
else if ((mimo_mode >= DUALSTREAM_UNIFORM_PRECODING1)&&(mimo_mode <= DUALSTREAM_PUSCH_PRECODING)) { else if ((mimo_mode >= DUALSTREAM_UNIFORM_PRECODING1)&&(mimo_mode <= DUALSTREAM_PUSCH_PRECODING)) {
// this is for transmission mode 4 (1 layer) // this is for transmission mode 4 (1 layer)
*re_allocated = *re_allocated + 1; *re_allocated = *re_allocated + 1;
if (precoder_index==0) { if (precoder_index==0) {
precoder_index0 = 0; //[1 1] precoder_index0 = 0; //[1 1]
...@@ -1172,7 +1202,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1172,7 +1202,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15); ((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
if (frame_parms->nb_antennas_tx == 2) { if (frame_parms->nb_antennas_tx == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0); layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15);
...@@ -1180,9 +1210,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1180,9 +1210,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
} }
break; break;
case 4: case 4:
qam16_table_offset_re = 0; qam16_table_offset_re = 0;
qam16_table_offset_im = 0; qam16_table_offset_im = 0;
...@@ -1192,19 +1222,19 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1192,19 +1222,19 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_im+=2; qam16_table_offset_im+=2;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_re+=1; qam16_table_offset_re+=1;
*jj=*jj+1; *jj=*jj+1;
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam16_table_offset_im+=1; qam16_table_offset_im+=1;
*jj=*jj+1; *jj=*jj+1;
((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam16_table_offset_re])); ((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam16_table_offset_re]));
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam16_table_offset_im])); ((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam16_table_offset_im]));
((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
if (frame_parms->nb_antennas_tx == 2) { if (frame_parms->nb_antennas_tx == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0); layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15);
...@@ -1212,9 +1242,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1212,9 +1242,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
} }
break; break;
case 6: case 6:
qam64_table_offset_re = 0; qam64_table_offset_re = 0;
qam64_table_offset_im = 0; qam64_table_offset_im = 0;
...@@ -1236,25 +1266,25 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1236,25 +1266,25 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
if (x0[*jj] == 1) if (x0[*jj] == 1)
qam64_table_offset_im+=1; qam64_table_offset_im+=1;
*jj=*jj+1; *jj=*jj+1;
((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam64_table_offset_re])); ((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s0[qam64_table_offset_re]));
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam64_table_offset_im])); ((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s0[qam64_table_offset_im]));
((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
if (frame_parms->nb_antennas_tx == 2) { if (frame_parms->nb_antennas_tx == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0); layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15);
} }
break; break;
} }
if (dlsch1_harq) { if (dlsch1_harq) {
switch (mod_order1) { switch (mod_order1) {
case 2: case 2:
((int16_t*)&tmp_sample1)[0] = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; ((int16_t*)&tmp_sample1)[0] = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
...@@ -1273,9 +1303,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1273,9 +1303,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
} }
break; break;
case 4: case 4:
qam16_table_offset_re = 0; qam16_table_offset_re = 0;
qam16_table_offset_im = 0; qam16_table_offset_im = 0;
...@@ -1285,20 +1315,20 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1285,20 +1315,20 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
if (x1[*jj2] == 1) if (x1[*jj2] == 1)
qam16_table_offset_im+=2; qam16_table_offset_im+=2;
*jj2=*jj2+1; *jj2=*jj2+1;
if (x1[*jj2] == 1) if (x1[*jj2] == 1)
qam16_table_offset_re+=1; qam16_table_offset_re+=1;
*jj2=*jj2+1; *jj2=*jj2+1;
if (x1[*jj2] == 1) if (x1[*jj2] == 1)
qam16_table_offset_im+=1; qam16_table_offset_im+=1;
*jj2=*jj2+1; *jj2=*jj2+1;
((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s1[qam16_table_offset_re])); ((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s1[qam16_table_offset_re]));
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s1[qam16_table_offset_im])); ((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s1[qam16_table_offset_im]));
((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
if (frame_parms->nb_antennas_tx == 2) { if (frame_parms->nb_antennas_tx == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index1); layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index1);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15);
...@@ -1306,9 +1336,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1306,9 +1336,9 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
} }
break; break;
case 6: case 6:
qam64_table_offset_re = 0; qam64_table_offset_re = 0;
qam64_table_offset_im = 0; qam64_table_offset_im = 0;
if (x1[*jj2] == 1) if (x1[*jj2] == 1)
...@@ -1329,20 +1359,20 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1329,20 +1359,20 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
if (x1[*jj2] == 1) if (x1[*jj2] == 1)
qam64_table_offset_im+=1; qam64_table_offset_im+=1;
*jj2=*jj2+1; *jj2=*jj2+1;
((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s1[qam64_table_offset_re])); ((int16_t*)&tmp_sample1)[0] = (int16_t)((qam_table_s1[qam64_table_offset_re]));
((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s1[qam64_table_offset_im])); ((int16_t*)&tmp_sample1)[1] = (int16_t)((qam_table_s1[qam64_table_offset_im]));
((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15); ((int16_t *)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
if (frame_parms->nb_antennas_tx == 2) { if (frame_parms->nb_antennas_tx == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index1); layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index1);
((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_2_Q15)>>15);
} }
break; break;
} }
} }
} }
...@@ -1460,7 +1490,6 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1460,7 +1490,6 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
return(0); return(0);
} }
int allocate_REs_in_RB_MCH(int32_t **txdataF, int allocate_REs_in_RB_MCH(int32_t **txdataF,
uint32_t *jj, uint32_t *jj,
uint16_t re_offset, uint16_t re_offset,
...@@ -1674,7 +1703,7 @@ inline int check_skip(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms ...@@ -1674,7 +1703,7 @@ inline int check_skip(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms
//SSS TDD //SSS TDD
if (((subframe_offset==0)||(subframe_offset==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==(nsymb-1)) ) { if (((subframe_offset==0)||(subframe_offset==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==(nsymb-1)) ) {
return(1); return(1);
} }
//PSS TDD //PSS TDD
if (((subframe_offset==1) || (subframe_offset==6)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==2) ) { if (((subframe_offset==1) || (subframe_offset==6)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==2) ) {
return(1); return(1);
...@@ -1710,7 +1739,7 @@ inline int check_skip(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms ...@@ -1710,7 +1739,7 @@ inline int check_skip(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms
(l==nsymb-1) ) { (l==nsymb-1) ) {
return(1); return(1);
} }
//PSS //PSS
if (((subframe_offset==1)|| if (((subframe_offset==1)||
(subframe_offset==6)) && (subframe_offset==6)) &&
...@@ -1724,7 +1753,7 @@ inline int check_skip(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms ...@@ -1724,7 +1753,7 @@ inline int check_skip(int rb,int subframe_offset,LTE_DL_FRAME_PARMS *frame_parms
if (((subframe_offset==0)||(subframe_offset==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==((nsymb>>1)-2)) ) { if (((subframe_offset==0)||(subframe_offset==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==((nsymb>>1)-2)) ) {
return(1); return(1);
} }
//PSS //PSS
if (((subframe_offset==0)||(subframe_offset==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==((nsymb>>1)-1)) ) { if (((subframe_offset==0)||(subframe_offset==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==((nsymb>>1)-1)) ) {
return(1); return(1);
...@@ -1804,21 +1833,22 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1804,21 +1833,22 @@ int dlsch_modulation(int32_t **txdataF,
{ {
uint8_t nsymb; uint8_t nsymb;
uint8_t harq_pid = dlsch0->current_harq_pid; uint8_t harq_pid; //= dlsch0->current_harq_pid;
LTE_DL_eNB_HARQ_t *dlsch0_harq = dlsch0->harq_processes[harq_pid]; LTE_DL_eNB_HARQ_t *dlsch0_harq;
LTE_DL_eNB_HARQ_t *dlsch1_harq; //= dlsch1->harq_processes[harq_pid]; LTE_DL_eNB_HARQ_t *dlsch1_harq; //= dlsch1->harq_processes[harq_pid];
uint32_t i,i2,jj,jj2,re_allocated,symbol_offset; uint32_t i,i2,jj,jj2,re_allocated,symbol_offset;
uint16_t l,rb,re_offset; uint16_t l,rb,re_offset;
uint32_t rb_alloc_ind; uint32_t rb_alloc_ind;
uint32_t *rb_alloc = dlsch0_harq->rb_alloc; uint32_t *rb_alloc; //=dlsch0_harq->rb_alloc;
uint8_t pilots=0; uint8_t pilots=0;
uint8_t skip_dc=0,skip_half=0; uint8_t skip_dc,skip_half;
uint8_t mod_order0 = get_Qm(dlsch0_harq->mcs); uint8_t mod_order0 = 0;
uint8_t mod_order1 = 0; uint8_t mod_order1 = 0;
int16_t amp_rho_a, amp_rho_b; int16_t amp_rho_a, amp_rho_b;
int16_t qam16_table_a0[4],qam64_table_a0[8],qam16_table_b0[4],qam64_table_b0[8]; int16_t qam16_table_a0[4],qam64_table_a0[8],qam16_table_b0[4],qam64_table_b0[8];
int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8]; int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8];
int16_t *qam_table_s0=NULL,*qam_table_s1=NULL;
int (*allocate_REs)(LTE_DL_FRAME_PARMS *, int (*allocate_REs)(LTE_DL_FRAME_PARMS *,
int **, int **,
uint32_t*, uint32_t*,
...@@ -1837,28 +1867,77 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1837,28 +1867,77 @@ int dlsch_modulation(int32_t **txdataF,
uint8_t, uint8_t,
int *, int *,
int *); int *);
int P1_SHIFT[13],P2_SHIFT[13]; int P1_SHIFT[13],P2_SHIFT[13];
int offset,nushiftmod3; int offset,nushiftmod3;
int16_t *qam_table_s0,*qam_table_s1;
uint8_t get_pmi_temp;
#ifdef DEBUG_DLSCH_MODULATION #ifdef DEBUG_DLSCH_MODULATION
uint8_t Nl0 = dlsch0_harq->Nl; uint8_t Nl0; //= dlsch0_harq->Nl;
uint8_t Nl1; uint8_t Nl1;
#endif #endif
if (dlsch1) { if ((dlsch0 != NULL) && (dlsch1 != NULL)){
harq_pid = dlsch0->current_harq_pid;
dlsch0_harq = dlsch0->harq_processes[harq_pid];
mod_order0 = get_Qm(dlsch0_harq->mcs);
rb_alloc = dlsch0_harq->rb_alloc;
#ifdef DEBUG_DLSCH_MODULATION
Nl0 = dlsch0_harq->Nl;
#endif
dlsch1_harq = dlsch1->harq_processes[harq_pid]; dlsch1_harq = dlsch1->harq_processes[harq_pid];
mod_order1 = get_Qm(dlsch1_harq->mcs); mod_order1 = get_Qm(dlsch1_harq->mcs);
#ifdef DEBUG_DLSCH_MODULATION #ifdef DEBUG_DLSCH_MODULATION
Nl1 = dlsch1_harq->Nl; Nl1 = dlsch1_harq->Nl;
#endif #endif
}else if ((dlsch0 != NULL) && (dlsch1 == NULL)){
harq_pid = dlsch0->current_harq_pid;
dlsch0_harq = dlsch0->harq_processes[harq_pid];
mod_order0 = get_Qm(dlsch0_harq->mcs);
rb_alloc = dlsch0_harq->rb_alloc;
#ifdef DEBUG_DLSCH_MODULATION
Nl0 = dlsch0_harq->Nl;
#endif
dlsch1_harq = NULL;
mod_order1 = 0;
#ifdef DEBUG_DLSCH_MODULATION
Nl1 = 0;
#endif
}else if ((dlsch0 == NULL) && (dlsch1 != NULL)){
harq_pid = dlsch1->current_harq_pid;
dlsch1_harq = dlsch1->harq_processes[harq_pid];
mod_order0 = get_Qm(dlsch1_harq->mcs);
rb_alloc = dlsch1_harq->rb_alloc;
#ifdef DEBUG_DLSCH_MODULATION
Nl0 = dlsch1_harq->Nl;
#endif
dlsch0_harq = NULL;
mod_order1 = 0;
#ifdef DEBUG_DLSCH_MODULATION
Nl1 = NULL;
#endif
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION, VCD_FUNCTION_IN);
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++) {
...@@ -1888,10 +1967,11 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1888,10 +1967,11 @@ int dlsch_modulation(int32_t **txdataF,
jj2=0; jj2=0;
re_allocated=0; re_allocated=0;
// 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,
...@@ -1902,6 +1982,7 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1902,6 +1982,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))
...@@ -1949,44 +2030,44 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1949,44 +2030,44 @@ int dlsch_modulation(int32_t **txdataF,
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb)); symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb));
allocate_REs = allocate_REs_in_RB; allocate_REs = allocate_REs_in_RB;
switch (mod_order0) { switch (mod_order0) {
case 2: case 2:
qam_table_s0 = NULL; qam_table_s0 = NULL;
break; break;
case 4: case 4:
if (pilots) { if (pilots) {
qam_table_s0 = qam16_table_b0; qam_table_s0 = qam16_table_b0;
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
allocate_REs_in_RB_pilots_16QAM_siso : allocate_REs_in_RB_pilots_16QAM_siso :
allocate_REs_in_RB; allocate_REs_in_RB;
} }
else { else {
qam_table_s0 = qam16_table_a0; qam_table_s0 = qam16_table_a0;
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
allocate_REs_in_RB_no_pilots_16QAM_siso : allocate_REs_in_RB_no_pilots_16QAM_siso :
allocate_REs_in_RB; allocate_REs_in_RB;
} }
break; break;
case 6: case 6:
if (pilots) { if (pilots) {
qam_table_s0 = qam64_table_b0; qam_table_s0 = qam64_table_b0;
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
allocate_REs_in_RB_pilots_64QAM_siso : allocate_REs_in_RB_pilots_64QAM_siso :
allocate_REs_in_RB; allocate_REs_in_RB;
} }
else { else {
qam_table_s0 = qam64_table_a0; qam_table_s0 = qam64_table_a0;
allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ?
allocate_REs_in_RB_no_pilots_64QAM_siso : allocate_REs_in_RB_no_pilots_64QAM_siso :
allocate_REs_in_RB; allocate_REs_in_RB;
} }
break; break;
} }
switch (mod_order1) { switch (mod_order1) {
case 2: case 2:
qam_table_s1 = NULL; qam_table_s1 = NULL;
...@@ -1994,7 +2075,7 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -1994,7 +2075,7 @@ int dlsch_modulation(int32_t **txdataF,
break; break;
case 4: case 4:
if (pilots) { if (pilots) {
qam_table_s1 = qam16_table_b1; qam_table_s1 = qam16_table_b1;
} }
else { else {
qam_table_s1 = qam16_table_a1; qam_table_s1 = qam16_table_a1;
...@@ -2002,13 +2083,13 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -2002,13 +2083,13 @@ int dlsch_modulation(int32_t **txdataF,
break; break;
case 6: case 6:
if (pilots) { if (pilots) {
qam_table_s1 = qam64_table_b1; qam_table_s1 = qam64_table_b1;
} }
else { else {
qam_table_s1 = qam64_table_a1; qam_table_s1 = qam64_table_a1;
} }
break; break;
} }
//for (aa=0;aa<frame_parms->nb_antennas_tx;aa++) //for (aa=0;aa<frame_parms->nb_antennas_tx;aa++)
...@@ -2032,11 +2113,14 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -2032,11 +2113,14 @@ int dlsch_modulation(int32_t **txdataF,
skip_half = check_skiphalf(rb,subframe_offset,frame_parms,l,nsymb); skip_half = check_skiphalf(rb,subframe_offset,frame_parms,l,nsymb);
skip_dc = check_skip_dc(rb,frame_parms); skip_dc = check_skip_dc(rb,frame_parms);
if (dlsch0_harq->Nlayers>1) {
printf("Nlayers %d: re_offset %d, symbol %d offset %d\n",dlsch0_harq->Nlayers,re_offset,l,symbol_offset);
return(-1); if (dlsch0) {
if (dlsch0_harq->Nlayers>1) {
msg("Nlayers %d: re_offset %d, symbol %d offset %d\n",dlsch0_harq->Nlayers,re_offset,l,symbol_offset);
return(-1);
}
} }
if (dlsch1) { if (dlsch1) {
...@@ -2050,18 +2134,30 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -2050,18 +2134,30 @@ 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);
allocate_REs(frame_parms, 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,
txdataF, txdataF,
&jj, &jj,
&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,
...@@ -2087,7 +2183,11 @@ int dlsch_modulation(int32_t **txdataF, ...@@ -2087,7 +2183,11 @@ int dlsch_modulation(int32_t **txdataF,
} }
#ifdef DEBUG_DLSCH_MODULATION #ifdef DEBUG_DLSCH_MODULATION
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)); 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));
}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);
...@@ -2129,29 +2229,29 @@ int dlsch_modulation_SIC(int32_t **sic_buffer, ...@@ -2129,29 +2229,29 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
amp=1; //we do full scale here for SIC amp=1; //we do full scale here for SIC
gain_lin_QPSK = (int16_t)((ONE_OVER_SQRT2_Q15)); gain_lin_QPSK = (int16_t)((ONE_OVER_SQRT2_Q15));
//printf("gain=%d\n", gain_lin_QPSK); //printf("gain=%d\n", gain_lin_QPSK);
jj = 0; jj = 0;
i = 0; i = 0;
while (jj <= G-1) { while (jj <= G-1) {
re_allocated = re_allocated + 1; re_allocated = re_allocated + 1;
switch (mod_order0) { switch (mod_order0) {
case 2: //QPSK case 2: //QPSK
/* TODO: handle more than 1 antenna */ /* TODO: handle more than 1 antenna */
//printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
((int16_t*)&sic_buffer[0][i])[0] = (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i ((int16_t*)&sic_buffer[0][i])[0] = (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
jj = jj + 1; jj = jj + 1;
((int16_t*)&sic_buffer[0][i])[1] = (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} ((int16_t*)&sic_buffer[0][i])[1] = (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
jj = jj + 1; jj = jj + 1;
//printf("recon %d,%d\n",((int16_t*)&sic_buffer[0][i])[0],((int16_t*)&sic_buffer[0][i])[1]); //printf("recon %d,%d\n",((int16_t*)&sic_buffer[0][i])[0],((int16_t*)&sic_buffer[0][i])[1]);
i++; i++;
break; break;
case 4: //16QAM case 4: //16QAM
...@@ -2183,8 +2283,8 @@ int dlsch_modulation_SIC(int32_t **sic_buffer, ...@@ -2183,8 +2283,8 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
((int16_t *)&sic_buffer[0][i])[0]+=qam16_table[qam16_table_offset_re]; ((int16_t *)&sic_buffer[0][i])[0]+=qam16_table[qam16_table_offset_re];
((int16_t *)&sic_buffer[0][i])[1]+=qam16_table[qam16_table_offset_im]; ((int16_t *)&sic_buffer[0][i])[1]+=qam16_table[qam16_table_offset_im];
i++; i++;
break; break;
...@@ -2226,12 +2326,12 @@ int dlsch_modulation_SIC(int32_t **sic_buffer, ...@@ -2226,12 +2326,12 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
((int16_t *)&sic_buffer[0][i])[0]+=(qam64_table[qam64_table_offset_re])>>1;//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); ((int16_t *)&sic_buffer[0][i])[0]+=(qam64_table[qam64_table_offset_re])>>1;//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
((int16_t *)&sic_buffer[0][i])[1]+=(qam64_table[qam64_table_offset_im])>>1;//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); ((int16_t *)&sic_buffer[0][i])[1]+=(qam64_table[qam64_table_offset_im])>>1;//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
i++; i++;
break; break;
} }
} }
......
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
double ratioPB[2][4]={{ 1.0,4.0/5.0,3.0/5.0,2.0/5.0}, double ratioPB[2][4]={{ 1.0,4.0/5.0,3.0/5.0,2.0/5.0},
{ 5.0/4.0,1.0,3.0/4.0,1.0/2.0}}; { 5.0/4.0,1.0,3.0/4.0,1.0/2.0}};
*/ */
double ratioPB[2][4]={{ 0.00000, -0.96910, -2.21849, -3.97940}, //in db double ratioPB[2][4]={{ 0.00000, -0.96910, -2.21849, -3.97940}, //in db
{ 0.96910, 0.00000, -1.24939, -3.01030}}; { 0.96910, 0.00000, -1.24939, -3.01030}};
double pa_values[8]={-6.0,-4.77,-3.0,-1.77,0.0,1.0,2.0,3.0}; //reported by higher layers double pa_values[8]={-6.0,-4.77,-3.0,-1.77,0.0,1.0,2.0,3.0}; //reported by higher layers
...@@ -45,21 +45,21 @@ double get_pa_dB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated) ...@@ -45,21 +45,21 @@ double get_pa_dB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated)
return(pa_values[pdsch_config_dedicated->p_a]); return(pa_values[pdsch_config_dedicated->p_a]);
} }
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;
rho_a_dB = pa_values[ pdsch_config_dedicated->p_a]; rho_a_dB = pa_values[ pdsch_config_dedicated->p_a];
if(!dl_power_off) //if dl_power_offset is 0, this is for MU-interference, TM5 if(!dl_power_off) //if dl_power_offset is 0, this is for MU-interference, TM5
rho_a_dB-=10*log10(2); rho_a_dB-=10*log10(2);
if(n_antenna_port==4) // see TS 36.213 Section 5.2 if(n_antenna_port==4) // see TS 36.213 Section 5.2
rho_a_dB=+10*log10(2); rho_a_dB=+10*log10(2);
sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB)); sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB));
dlsch_eNB->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13)); dlsch_eNB->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13));
#if DEBUG_PC #if DEBUG_PC
...@@ -78,9 +78,9 @@ double computeRhoB_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, ...@@ -78,9 +78,9 @@ double computeRhoB_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
double rho_a_dB, rho_b_dB; double rho_a_dB, rho_b_dB;
double sqrt_rho_b_lin; double sqrt_rho_b_lin;
rho_a_dB= computeRhoA_eNB(pdsch_config_dedicated,dlsch_eNB,dl_power_off, n_antenna_port); rho_a_dB= computeRhoA_eNB(pdsch_config_dedicated,dlsch_eNB,dl_power_off, n_antenna_port);
if(n_antenna_port>1) if(n_antenna_port>1)
rho_b_dB= ratioPB[1][pdsch_config_common->p_b] + rho_a_dB; rho_b_dB= ratioPB[1][pdsch_config_common->p_b] + rho_a_dB;
else else
...@@ -99,24 +99,24 @@ double computeRhoB_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, ...@@ -99,24 +99,24 @@ double computeRhoB_eNB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
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,
unsigned char dl_power_off, unsigned char dl_power_off,
uint8_t n_antenna_port uint8_t n_antenna_port
){ ){
double rho_a_dB; double rho_a_dB;
double sqrt_rho_a_lin; double sqrt_rho_a_lin;
rho_a_dB = pa_values[ pdsch_config_dedicated->p_a]; rho_a_dB = pa_values[ pdsch_config_dedicated->p_a];
if(!dl_power_off) if(!dl_power_off)
rho_a_dB-=10*log10(2); rho_a_dB-=10*log10(2);
//if dl_power_offset is 0, this is for MU-interference, TM5. But in practice UE may assume 16 or 64QAM TM4 as multiuser //if dl_power_offset is 0, this is for MU-interference, TM5. But in practice UE may assume 16 or 64QAM TM4 as multiuser
if(n_antenna_port==4) // see TS 36.213 Section 5.2 if(n_antenna_port==4) // see TS 36.213 Section 5.2
rho_a_dB=+10*log10(2); rho_a_dB=+10*log10(2);
sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB)); sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB));
dlsch_ue->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13)); dlsch_ue->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13));
#ifdef DEBUG_PC #ifdef DEBUG_PC
...@@ -135,9 +135,9 @@ double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, ...@@ -135,9 +135,9 @@ double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
double rho_a_dB, rho_b_dB; double rho_a_dB, rho_b_dB;
double sqrt_rho_b_lin; double sqrt_rho_b_lin;
rho_a_dB= computeRhoA_UE(pdsch_config_dedicated,dlsch_ue,dl_power_off, n_antenna_port); rho_a_dB= computeRhoA_UE(pdsch_config_dedicated,dlsch_ue,dl_power_off, n_antenna_port);
if(n_antenna_port>1) if(n_antenna_port>1)
rho_b_dB= ratioPB[1][pdsch_config_common->p_b] + rho_a_dB; rho_b_dB= ratioPB[1][pdsch_config_common->p_b] + rho_a_dB;
else else
......
...@@ -254,7 +254,7 @@ int32_t dlsch_modulation_SIC(int32_t **sic_buffer, ...@@ -254,7 +254,7 @@ int32_t dlsch_modulation_SIC(int32_t **sic_buffer,
uint8_t num_pdcch_symbols, uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch0, LTE_eNB_DLSCH_t *dlsch0,
LTE_eNB_DLSCH_t *dlsch1, LTE_eNB_DLSCH_t *dlsch1,
int G); int G);
/* /*
\brief This function is the top-level routine for generation of the sub-frame signal (frequency-domain) for MCH. \brief This function is the top-level routine for generation of the sub-frame signal (frequency-domain) for MCH.
@param txdataF Table of pointers for frequency-domain TX signals @param txdataF Table of pointers for frequency-domain TX signals
...@@ -755,15 +755,15 @@ int32_t dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -755,15 +755,15 @@ int32_t dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp, int **rxdataF_comp,
int32_t **sic_buffer, int32_t **sic_buffer,
int **rho_i, int **rho_i,
short *dlsch_llr, short *dlsch_llr,
uint8_t num_pdcch_symbols, uint8_t num_pdcch_symbols,
uint16_t nb_rb, uint16_t nb_rb,
uint8_t subframe, uint8_t subframe,
uint32_t rb_alloc, uint32_t rb_alloc,
uint16_t mod_order_0, uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0); LTE_UE_DLSCH_t *dlsch0);
void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp, int32_t **rxdataF_comp,
...@@ -788,30 +788,30 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -788,30 +788,30 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
*/ */
void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms, void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp, int32_t **rxdataF_comp,
int32_t **sic_buffer, //Q15 int32_t **sic_buffer, //Q15
int32_t **rho_i, int32_t **rho_i,
int16_t *dlsch_llr, int16_t *dlsch_llr,
uint8_t num_pdcch_symbols, uint8_t num_pdcch_symbols,
int32_t **dl_ch_mag, int32_t **dl_ch_mag,
uint16_t nb_rb, uint16_t nb_rb,
uint8_t subframe, uint8_t subframe,
uint32_t rb_alloc, uint32_t rb_alloc,
uint16_t mod_order_0, uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0); LTE_UE_DLSCH_t *dlsch0);
void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp, int32_t **rxdataF_comp,
int32_t **sic_buffer, //Q15 int32_t **sic_buffer, //Q15
int32_t **rho_i, int32_t **rho_i,
int16_t *dlsch_llr, int16_t *dlsch_llr,
uint8_t num_pdcch_symbols, uint8_t num_pdcch_symbols,
int32_t **dl_ch_mag, int32_t **dl_ch_mag,
int32_t **dl_ch_magb, int32_t **dl_ch_magb,
uint16_t nb_rb, uint16_t nb_rb,
uint8_t subframe, uint8_t subframe,
uint32_t rb_alloc, uint32_t rb_alloc,
uint16_t mod_order_0, uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0); LTE_UE_DLSCH_t *dlsch0);
void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
...@@ -924,12 +924,12 @@ void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -924,12 +924,12 @@ void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t dual_stream_UE); uint8_t dual_stream_UE);
void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms,
LTE_UE_PDSCH *lte_ue_pdsch_vars, LTE_UE_PDSCH *lte_ue_pdsch_vars,
int harq_pid, int harq_pid,
int round, int round,
unsigned char symbol, unsigned char symbol,
unsigned short nb_rb, unsigned short nb_rb,
unsigned char dual_stream_UE); unsigned char dual_stream_UE);
/** \fn dlsch_extract_rbs_single(int32_t **rxdataF, /** \fn dlsch_extract_rbs_single(int32_t **rxdataF,
int32_t **dl_ch_estimates, int32_t **dl_ch_estimates,
...@@ -1001,8 +1001,8 @@ uint16_t dlsch_extract_rbs_dual(int32_t **rxdataF, ...@@ -1001,8 +1001,8 @@ uint16_t dlsch_extract_rbs_dual(int32_t **rxdataF,
uint8_t symbol, uint8_t symbol,
uint8_t subframe, uint8_t subframe,
uint32_t high_speed_flag, uint32_t high_speed_flag,
LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_FRAME_PARMS *frame_parms,
MIMO_mode_t mimo_mode); MIMO_mode_t mimo_mode);
/** \brief This function performs channel compensation (matched filtering) on the received RBs for this allocation. In addition, it computes the squared-magnitude of the channel with weightings for 16QAM/64QAM detection as well as dual-stream detection (cross-correlation) /** \brief This function performs channel compensation (matched filtering) on the received RBs for this allocation. In addition, it computes the squared-magnitude of the channel with weightings for 16QAM/64QAM detection as well as dual-stream detection (cross-correlation)
@param rxdataF_ext Frequency-domain received signal in RBs to be demodulated @param rxdataF_ext Frequency-domain received signal in RBs to be demodulated
...@@ -1048,7 +1048,7 @@ void dlsch_dual_stream_correlationTM34(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1048,7 +1048,7 @@ void dlsch_dual_stream_correlationTM34(LTE_DL_FRAME_PARMS *frame_parms,
int **dl_ch_estimates_ext_i, int **dl_ch_estimates_ext_i,
int **dl_ch_rho_ext, int **dl_ch_rho_ext,
unsigned char output_shift0, unsigned char output_shift0,
unsigned char output_shift1); unsigned char output_shift1);
void dlsch_channel_compensation_TM56(int **rxdataF_ext, void dlsch_channel_compensation_TM56(int **rxdataF_ext,
int **dl_ch_estimates_ext, int **dl_ch_estimates_ext,
...@@ -1067,18 +1067,18 @@ void dlsch_channel_compensation_TM56(int **rxdataF_ext, ...@@ -1067,18 +1067,18 @@ void dlsch_channel_compensation_TM56(int **rxdataF_ext,
void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms,
LTE_UE_PDSCH *lte_ue_pdsch_vars, LTE_UE_PDSCH *lte_ue_pdsch_vars,
PHY_MEASUREMENTS *phy_measurements, PHY_MEASUREMENTS *phy_measurements,
int eNB_id, int eNB_id,
unsigned char symbol, unsigned char symbol,
unsigned char mod_order0, unsigned char mod_order0,
unsigned char mod_order1, unsigned char mod_order1,
int harq_pid, int harq_pid,
int round, int round,
MIMO_mode_t mimo_mode, MIMO_mode_t mimo_mode,
unsigned short nb_rb, unsigned short nb_rb,
unsigned char output_shift0, unsigned char output_shift0,
unsigned char output_shift1); unsigned char output_shift1);
/** \brief This function computes the average channel level over all allocated RBs and antennas (TX/RX) in order to compute output shift for compensated signal /** \brief This function computes the average channel level over all allocated RBs and antennas (TX/RX) in order to compute output shift for compensated signal
...@@ -1096,13 +1096,13 @@ void dlsch_channel_level(int32_t **dl_ch_estimates_ext, ...@@ -1096,13 +1096,13 @@ void dlsch_channel_level(int32_t **dl_ch_estimates_ext,
void dlsch_channel_level_TM34(int **dl_ch_estimates_ext, void dlsch_channel_level_TM34(int **dl_ch_estimates_ext,
LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_FRAME_PARMS *frame_parms,
unsigned char *pmi_ext, unsigned char *pmi_ext,
int *avg_0, int *avg_0,
int *avg_1, int *avg_1,
uint8_t symbol, uint8_t symbol,
unsigned short nb_rb, unsigned short nb_rb,
MIMO_mode_t mimo_mode); MIMO_mode_t mimo_mode);
void dlsch_channel_level_TM56(int32_t **dl_ch_estimates_ext, void dlsch_channel_level_TM56(int32_t **dl_ch_estimates_ext,
...@@ -1156,7 +1156,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue, ...@@ -1156,7 +1156,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
- RE extraction (pilot, PBCH, synch. signals) - RE extraction (pilot, PBCH, synch. signals)
- antenna combining (MRC, Alamouti, cycling) - antenna combining (MRC, Alamouti, cycling)
- LLR computation - LLR computation
This function supports TM1, 2, 3, 5, and 6. This function supports TM1, 2, 3, 5, and 6.
@param phy_vars_ue Pointer to PHY variables @param phy_vars_ue Pointer to PHY variables
@param type Type of PDSCH (SI_PDSCH,RA_PDSCH,PDSCH,PMCH) @param type Type of PDSCH (SI_PDSCH,RA_PDSCH,PDSCH,PMCH)
@param eNB_id eNb index (Nid1) 0,1,2 @param eNB_id eNb index (Nid1) 0,1,2
...@@ -1164,19 +1164,19 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue, ...@@ -1164,19 +1164,19 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
@param subframe Subframe number @param subframe Subframe number
@param symbol Symbol on which to act (within sub-frame) @param symbol Symbol on which to act (within sub-frame)
@param first_symbol_flag set to 1 on first DLSCH symbol @param first_symbol_flag set to 1 on first DLSCH symbol
@param rx_type. rx_type=RX_IC_single_stream will enable interference cancellation of a second stream when decoding the first stream. In case of TM1, 2, 5, and this can cancel interference from a neighbouring cell given by eNB_id_i. In case of TM5, eNB_id_i should be set to n_connected_eNB to perform multi-user interference cancellation. In case of TM3, eNB_id_i should be set to eNB_id to perform co-channel interference cancellation; this option should be used together with an interference cancellation step [...]. In case of TM3, if rx_type=RX_IC_dual_stream, both streams will be decoded by applying the IC single stream receiver twice. @param rx_type. rx_type=RX_IC_single_stream will enable interference cancellation of a second stream when decoding the first stream. In case of TM1, 2, 5, and this can cancel interference from a neighbouring cell given by eNB_id_i. In case of TM5, eNB_id_i should be set to n_connected_eNB to perform multi-user interference cancellation. In case of TM3, eNB_id_i should be set to eNB_id to perform co-channel interference cancellation; this option should be used together with an interference cancellation step [...]. In case of TM3, if rx_type=RX_IC_dual_stream, both streams will be decoded by applying the IC single stream receiver twice.
@param i_mod Modulation order of the interfering stream @param i_mod Modulation order of the interfering stream
*/ */
int32_t rx_pdsch(PHY_VARS_UE *phy_vars_ue, int32_t rx_pdsch(PHY_VARS_UE *phy_vars_ue,
PDSCH_t type, PDSCH_t type,
uint8_t eNB_id, uint8_t eNB_id,
uint8_t eNB_id_i, uint8_t eNB_id_i,
uint8_t subframe, uint8_t subframe,
uint8_t symbol, uint8_t symbol,
uint8_t first_symbol_flag, uint8_t first_symbol_flag,
RX_type_t rx_type, RX_type_t rx_type,
uint8_t i_mod, uint8_t i_mod,
uint8_t harq_pid); uint8_t harq_pid);
int32_t rx_pdcch(LTE_UE_COMMON *lte_ue_common_vars, int32_t rx_pdcch(LTE_UE_COMMON *lte_ue_common_vars,
LTE_UE_PDCCH **lte_ue_pdcch_vars, LTE_UE_PDCCH **lte_ue_pdcch_vars,
...@@ -1357,7 +1357,7 @@ uint32_t get_TBS_UL(uint8_t mcs, uint16_t nb_rb); ...@@ -1357,7 +1357,7 @@ uint32_t get_TBS_UL(uint8_t mcs, uint16_t nb_rb);
*/ */
uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap); uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap);
/* \brief Return prb for a given vrb index /* \brief Return prb for a given vrb index
@param vrb_type VRB type (0=localized,1=distributed) @param vrb_type VRB type (0=localized,1=distributed)
@param rb_alloc_dci rballoc field from DCI @param rb_alloc_dci rballoc field from DCI
*/ */
...@@ -1481,7 +1481,7 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame,uint8_t ...@@ -1481,7 +1481,7 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame,uint8_t
uint8_t subframe2harq_pid_eNBrx(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe); uint8_t subframe2harq_pid_eNBrx(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
int generate_ue_dlsch_params_from_dci(int frame, int generate_ue_dlsch_params_from_dci(int frame,
uint8_t subframe, uint8_t subframe,
void *dci_pdu, void *dci_pdu,
rnti_t rnti, rnti_t rnti,
DCI_format_t dci_format, DCI_format_t dci_format,
...@@ -1731,6 +1731,8 @@ void reset_cba_uci(void *o); ...@@ -1731,6 +1731,8 @@ void reset_cba_uci(void *o);
*/ */
uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_subbands); uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_subbands);
int32_t pmi_convert_rank1_from_rank2(uint16_t pmi_alloc, int tpmi, int nb_rb);
//uint16_t quantize_subband_pmi2(PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_t a_id,int nb_subbands); //uint16_t quantize_subband_pmi2(PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_t a_id,int nb_subbands);
uint64_t pmi2hex_2Ar1(uint32_t pmi); uint64_t pmi2hex_2Ar1(uint32_t pmi);
...@@ -1743,7 +1745,7 @@ uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs); ...@@ -1743,7 +1745,7 @@ uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs);
/** \brief This routine expands a single (wideband) PMI to subband PMI bitmap similar to the one used in the UCI and in the dlsch_modulation routine /** \brief This routine expands a single (wideband) PMI to subband PMI bitmap similar to the one used in the UCI and in the dlsch_modulation routine
@param frame_parms Pointer to DL frame configuration parameters @param frame_parms Pointer to DL frame configuration parameters
@param wideband_pmi (0,1,2,3 for rank 0 and 0,1 for rank 1) @param wideband_pmi (0,1,2,3 for rank 0 and 0,1 for rank 1)
@param rank (0 or 1) @param rank (0 or 1)
@returns subband PMI bitmap @returns subband PMI bitmap
*/ */
...@@ -1751,7 +1753,7 @@ uint32_t pmi_extend(LTE_DL_FRAME_PARMS *frame_parms,uint8_t wideband_pmi, uint8_ ...@@ -1751,7 +1753,7 @@ uint32_t pmi_extend(LTE_DL_FRAME_PARMS *frame_parms,uint8_t wideband_pmi, uint8_
/** \brief This routine extracts a single subband PMI from a bitmap coming from UCI or the pmi_extend function /** \brief This routine extracts a single subband PMI from a bitmap coming from UCI or the pmi_extend function
@param N_RB_DL number of resource blocks @param N_RB_DL number of resource blocks
@param mimo_mode @param mimo_mode
@param pmi_alloc subband PMI bitmap @param pmi_alloc subband PMI bitmap
@param rb resource block for which to extract PMI @param rb resource block for which to extract PMI
@returns subband PMI @returns subband PMI
...@@ -1759,11 +1761,11 @@ uint32_t pmi_extend(LTE_DL_FRAME_PARMS *frame_parms,uint8_t wideband_pmi, uint8_ ...@@ -1759,11 +1761,11 @@ uint32_t pmi_extend(LTE_DL_FRAME_PARMS *frame_parms,uint8_t wideband_pmi, uint8_
uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb); uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb);
int get_nCCE_offset_l1(int *CCE_table, int get_nCCE_offset_l1(int *CCE_table,
const unsigned char L, const unsigned char L,
const int nCCE, const int nCCE,
const int common_dci, const int common_dci,
const unsigned short rnti, const unsigned short rnti,
const unsigned char subframe); const unsigned char subframe);
uint16_t get_nCCE(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uint8_t mi); uint16_t get_nCCE(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uint8_t mi);
...@@ -1825,15 +1827,15 @@ void generate_pucch_emul(PHY_VARS_UE *phy_vars_ue, ...@@ -1825,15 +1827,15 @@ void generate_pucch_emul(PHY_VARS_UE *phy_vars_ue,
uint32_t rx_pucch(PHY_VARS_eNB *phy_vars_eNB, uint32_t rx_pucch(PHY_VARS_eNB *phy_vars_eNB,
PUCCH_FMT_t fmt, PUCCH_FMT_t fmt,
uint8_t UE_id, uint8_t UE_id,
uint16_t n1_pucch, uint16_t n1_pucch,
uint16_t n2_pucch, uint16_t n2_pucch,
uint8_t shortened_format, uint8_t shortened_format,
uint8_t *payload, uint8_t *payload,
int frame, int frame,
uint8_t subframe, uint8_t subframe,
uint8_t pucch1_thres); uint8_t pucch1_thres);
int32_t rx_pucch_emul(PHY_VARS_eNB *phy_vars_eNB, int32_t rx_pucch_emul(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc, eNB_rxtx_proc_t *proc,
...@@ -1843,7 +1845,6 @@ int32_t rx_pucch_emul(PHY_VARS_eNB *phy_vars_eNB, ...@@ -1843,7 +1845,6 @@ int32_t rx_pucch_emul(PHY_VARS_eNB *phy_vars_eNB,
uint8_t *payload); uint8_t *payload);
/*! /*!
\brief Check for PRACH TXop in subframe \brief Check for PRACH TXop in subframe
@param frame_parms Pointer to LTE_DL_FRAME_PARMS @param frame_parms Pointer to LTE_DL_FRAME_PARMS
...@@ -1935,18 +1936,19 @@ double get_pa_dB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated); ...@@ -1935,18 +1936,19 @@ 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, LTE_eNB_DLSCH_t *dlsch_eNB,
int dl_power_off, int dl_power_off,
uint8_t n_antenna_port); uint8_t n_antenna_port);
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,
uint8_t dl_power_off, uint8_t dl_power_off,
uint8_t n_antenna_port); uint8_t n_antenna_port);
double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
PDSCH_CONFIG_COMMON *pdsch_config_common, PDSCH_CONFIG_COMMON *pdsch_config_common,
...@@ -1960,7 +1962,7 @@ double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, ...@@ -1960,7 +1962,7 @@ double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
LTE_UE_DLSCH_t *dlsch_ue); LTE_UE_DLSCH_t *dlsch_ue);
*/ */
uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms, uint8_t tdd_mapindex, uint16_t Nf); uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms, uint8_t tdd_mapindex, uint16_t Nf);
uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n); uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n);
......
...@@ -151,10 +151,10 @@ enum transmission_access_mode { ...@@ -151,10 +151,10 @@ enum transmission_access_mode {
typedef enum { typedef enum {
eNodeB_3GPP=0, // classical eNodeB function eNodeB_3GPP=0, // classical eNodeB function
eNodeB_3GPP_BBU, // eNodeB with NGFI IF5 eNodeB_3GPP_BBU, // eNodeB with NGFI IF5
NGFI_RCC_IF4p5, // NGFI_RCC (NGFI radio cloud center) NGFI_RCC_IF4p5, // NGFI_RCC (NGFI radio cloud center)
NGFI_RAU_IF4p5, NGFI_RAU_IF4p5,
NGFI_RRU_IF5, // NGFI_RRU (NGFI remote radio-unit,IF5) NGFI_RRU_IF5, // NGFI_RRU (NGFI remote radio-unit,IF5)
NGFI_RRU_IF4p5 // NGFI_RRU (NGFI remote radio-unit,IF4p5) NGFI_RRU_IF4p5 // NGFI_RRU (NGFI remote radio-unit,IF4p5)
} eNB_func_t; } eNB_func_t;
typedef enum { typedef enum {
...@@ -559,7 +559,7 @@ typedef struct PHY_VARS_eNB_s { ...@@ -559,7 +559,7 @@ typedef struct PHY_VARS_eNB_s {
uint32_t total_transmitted_bits; uint32_t total_transmitted_bits;
uint32_t total_system_throughput; uint32_t total_system_throughput;
int hw_timing_advance; int hw_timing_advance;
time_stats_t phy_proc; time_stats_t phy_proc;
time_stats_t phy_proc_tx; time_stats_t phy_proc_tx;
...@@ -596,7 +596,7 @@ typedef struct PHY_VARS_eNB_s { ...@@ -596,7 +596,7 @@ typedef struct PHY_VARS_eNB_s {
#ifdef LOCALIZATION #ifdef LOCALIZATION
/// time state for localization /// time state for localization
time_stats_t localization_stats; time_stats_t localization_stats;
#endif #endif
int32_t pucch1_stats_cnt[NUMBER_OF_UE_MAX][10]; int32_t pucch1_stats_cnt[NUMBER_OF_UE_MAX][10];
int32_t pucch1_stats[NUMBER_OF_UE_MAX][10*1024]; int32_t pucch1_stats[NUMBER_OF_UE_MAX][10*1024];
...@@ -608,9 +608,9 @@ typedef struct PHY_VARS_eNB_s { ...@@ -608,9 +608,9 @@ typedef struct PHY_VARS_eNB_s {
int32_t pusch_stats_mcs[NUMBER_OF_UE_MAX][10240]; int32_t pusch_stats_mcs[NUMBER_OF_UE_MAX][10240];
int32_t pusch_stats_bsr[NUMBER_OF_UE_MAX][10240]; int32_t pusch_stats_bsr[NUMBER_OF_UE_MAX][10240];
int32_t pusch_stats_BO[NUMBER_OF_UE_MAX][10240]; int32_t pusch_stats_BO[NUMBER_OF_UE_MAX][10240];
/// RF and Interface devices per CC /// RF and Interface devices per CC
openair0_device rfdevice; openair0_device rfdevice;
openair0_device ifdevice; openair0_device ifdevice;
/// Pointer for ifdevice buffer struct /// Pointer for ifdevice buffer struct
if_buffer_t ifbuffer; if_buffer_t ifbuffer;
...@@ -869,7 +869,18 @@ typedef struct { ...@@ -869,7 +869,18 @@ typedef struct {
time_stats_t tx_prach; time_stats_t tx_prach;
/// RF and Interface devices per CC /// RF and Interface devices per CC
openair0_device rfdevice; openair0_device rfdevice;
time_stats_t dlsch_encoding_SIC_stats;
time_stats_t dlsch_scrambling_SIC_stats;
time_stats_t dlsch_modulation_SIC_stats;
time_stats_t dlsch_llr_stripping_unit_SIC_stats;
time_stats_t dlsch_unscrambling_SIC_stats;
#if ENABLE_RAL
hash_table_t *ral_thresholds_timed;
SLIST_HEAD(ral_thresholds_gen_poll_s, ral_threshold_phy_t) ral_thresholds_gen_polled[RAL_LINK_PARAM_GEN_MAX];
SLIST_HEAD(ral_thresholds_lte_poll_s, ral_threshold_phy_t) ral_thresholds_lte_polled[RAL_LINK_PARAM_LTE_MAX];
#endif
} PHY_VARS_UE; } PHY_VARS_UE;
...@@ -882,7 +893,7 @@ static inline int wait_on_condition(pthread_mutex_t *mutex,pthread_cond_t *cond, ...@@ -882,7 +893,7 @@ static inline int wait_on_condition(pthread_mutex_t *mutex,pthread_cond_t *cond,
exit_fun("nothing to add"); exit_fun("nothing to add");
return(-1); return(-1);
} }
while (*instance_cnt < 0) { while (*instance_cnt < 0) {
// most of the time the thread is waiting here // most of the time the thread is waiting here
// proc->instance_cnt_rxtx is -1 // proc->instance_cnt_rxtx is -1
...@@ -904,7 +915,7 @@ static inline int wait_on_busy_condition(pthread_mutex_t *mutex,pthread_cond_t * ...@@ -904,7 +915,7 @@ static inline int wait_on_busy_condition(pthread_mutex_t *mutex,pthread_cond_t *
exit_fun("nothing to add"); exit_fun("nothing to add");
return(-1); return(-1);
} }
while (*instance_cnt == 0) { while (*instance_cnt == 0) {
// most of the time the thread will skip this // most of the time the thread will skip this
// waits only if proc->instance_cnt_rxtx is 0 // waits only if proc->instance_cnt_rxtx is 0
...@@ -926,9 +937,9 @@ static inline int release_thread(pthread_mutex_t *mutex,int *instance_cnt,char * ...@@ -926,9 +937,9 @@ static inline int release_thread(pthread_mutex_t *mutex,int *instance_cnt,char *
exit_fun("nothing to add"); exit_fun("nothing to add");
return(-1); return(-1);
} }
*instance_cnt=*instance_cnt-1; *instance_cnt=*instance_cnt-1;
if (pthread_mutex_unlock(mutex) != 0) { if (pthread_mutex_unlock(mutex) != 0) {
LOG_E( PHY, "[SCHED][eNB] error unlocking mutex for %s\n",name); LOG_E( PHY, "[SCHED][eNB] error unlocking mutex for %s\n",name);
exit_fun("nothing to add"); exit_fun("nothing to add");
......
...@@ -793,7 +793,7 @@ typedef struct { ...@@ -793,7 +793,7 @@ typedef struct {
/// - first index: ? [0..7] (hard coded) accessed via \c harq_pid /// - first index: ? [0..7] (hard coded) accessed via \c harq_pid
/// - second index: ? [0..7] (hard coded) accessed via \c round /// - second index: ? [0..7] (hard coded) accessed via \c round
/// - third index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - third index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - fourth index: ? [0..168*N_RB_DL[ /// - fourth index: ? [0..168*N_RB_DL[
int32_t **rxdataF_comp1[8][8]; int32_t **rxdataF_comp1[8][8];
/// \brief Downlink channel estimates extracted in PRBS. /// \brief Downlink channel estimates extracted in PRBS.
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
...@@ -819,7 +819,7 @@ typedef struct { ...@@ -819,7 +819,7 @@ typedef struct {
/// \brief Magnitude of Downlink Channel second layer (16QAM level/First 64QAM level). /// \brief Magnitude of Downlink Channel second layer (16QAM level/First 64QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_DL[ /// - second index: ? [0..168*N_RB_DL[
int32_t **dl_ch_mag1; int32_t **dl_ch_mag1[8][8];
/// \brief Magnitude of Downlink Channel, first layer (2nd 64QAM level). /// \brief Magnitude of Downlink Channel, first layer (2nd 64QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_DL[ /// - second index: ? [0..168*N_RB_DL[
...@@ -827,7 +827,7 @@ typedef struct { ...@@ -827,7 +827,7 @@ typedef struct {
/// \brief Magnitude of Downlink Channel second layer (2nd 64QAM level). /// \brief Magnitude of Downlink Channel second layer (2nd 64QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_DL[ /// - second index: ? [0..168*N_RB_DL[
int32_t **dl_ch_magb1; int32_t **dl_ch_magb1[8][8];
/// \brief Cross-correlation of two eNB signals. /// \brief Cross-correlation of two eNB signals.
/// - first index: rx antenna [0..nb_antennas_rx[ /// - first index: rx antenna [0..nb_antennas_rx[
/// - second index: symbol [0..] /// - second index: symbol [0..]
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -183,6 +183,9 @@ typedef enum { ...@@ -183,6 +183,9 @@ typedef enum {
Rayleigh8_orth_eff_ch_TM4_prec_real, Rayleigh8_orth_eff_ch_TM4_prec_real,
Rayleigh8_orth_eff_ch_TM4_prec_imag, Rayleigh8_orth_eff_ch_TM4_prec_imag,
TS_SHIFT, TS_SHIFT,
EPA_low,
EPA_medium,
EPA_high,
} SCM_t; } SCM_t;
/** /**
......
/******************************************************************************* /*******************************************************************************
OpenAirInterface OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify OpenAirInterface is free software: you can redistribute it and/or modify
...@@ -14,15 +14,15 @@ ...@@ -14,15 +14,15 @@
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not, included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>. see <http://www.gnu.org/licenses/>.
Contact Information Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr OpenAirInterface Dev : openair4g-devel@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/ *******************************************************************************/
...@@ -82,28 +82,28 @@ void fill_channel_desc(channel_desc_t *chan_desc, ...@@ -82,28 +82,28 @@ void fill_channel_desc(channel_desc_t *chan_desc,
} }
else else
chan_desc->delays = delays; chan_desc->delays = delays;
chan_desc->Td = Td; chan_desc->Td = Td;
chan_desc->sampling_rate = sampling_rate; chan_desc->sampling_rate = sampling_rate;
chan_desc->channel_bandwidth = channel_bandwidth; chan_desc->channel_bandwidth = channel_bandwidth;
chan_desc->ricean_factor = ricean_factor; chan_desc->ricean_factor = ricean_factor;
chan_desc->aoa = aoa; chan_desc->aoa = aoa;
chan_desc->random_aoa = random_aoa; chan_desc->random_aoa = random_aoa;
chan_desc->forgetting_factor = forgetting_factor; chan_desc->forgetting_factor = forgetting_factor;
chan_desc->channel_offset = channel_offset; chan_desc->channel_offset = channel_offset;
chan_desc->path_loss_dB = path_loss_dB; chan_desc->path_loss_dB = path_loss_dB;
chan_desc->first_run = 1; chan_desc->first_run = 1;
chan_desc->ip = 0.0; chan_desc->ip = 0.0;
chan_desc->max_Doppler = max_Doppler; chan_desc->max_Doppler = max_Doppler;
chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->a = (struct complex**) malloc(nb_taps*sizeof(struct complex*)); chan_desc->a = (struct complex**) malloc(nb_taps*sizeof(struct complex*));
LOG_D(OCM,"[CHANNEL] Filling ch \n"); LOG_D(OCM,"[CHANNEL] Filling ch \n");
for (i = 0; i<nb_tx*nb_rx; i++) for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->ch[i] = (struct complex*) malloc(channel_length * sizeof(struct complex)); chan_desc->ch[i] = (struct complex*) malloc(channel_length * sizeof(struct complex));
for (i = 0; i<nb_tx*nb_rx; i++) for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex)); // allocate for up to 100 RBs, 12 samples per RB chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex)); // allocate for up to 100 RBs, 12 samples per RB
LOG_D(OCM,"[CHANNEL] Filling a (nb_taps %d)\n",nb_taps); LOG_D(OCM,"[CHANNEL] Filling a (nb_taps %d)\n",nb_taps);
...@@ -118,8 +118,8 @@ void fill_channel_desc(channel_desc_t *chan_desc, ...@@ -118,8 +118,8 @@ void fill_channel_desc(channel_desc_t *chan_desc,
for (i = 0; i<nb_taps; i++) { for (i = 0; i<nb_taps; i++) {
chan_desc->R_sqrt[i] = (struct complex*) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex)); chan_desc->R_sqrt[i] = (struct complex*) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex));
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) { for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
chan_desc->R_sqrt[i][j].x = 1.0; chan_desc->R_sqrt[i][j].x = 1.0;
chan_desc->R_sqrt[i][j].y = 0.0; chan_desc->R_sqrt[i][j].y = 0.0;
} }
} }
} }
...@@ -127,9 +127,9 @@ void fill_channel_desc(channel_desc_t *chan_desc, ...@@ -127,9 +127,9 @@ void fill_channel_desc(channel_desc_t *chan_desc,
chan_desc->R_sqrt = (struct complex**) calloc(nb_taps,sizeof(struct complex*)); chan_desc->R_sqrt = (struct complex**) calloc(nb_taps,sizeof(struct complex*));
for (i = 0; i<nb_taps; i++) { for (i = 0; i<nb_taps; i++) {
chan_desc->R_sqrt[i] = (struct complex*) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex)); chan_desc->R_sqrt[i] = (struct complex*) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex));
//chan_desc->R_sqrt = (struct complex*)&R_sqrt[i][0]; //chan_desc->R_sqrt = (struct complex*)&R_sqrt[i][0];
chan_desc->R_sqrt[i] = R_sqrt[0]; chan_desc->R_sqrt[i] = R_sqrt[0];
} }
} }
for (i = 0; i<nb_taps; i++) { for (i = 0; i<nb_taps; i++) {
...@@ -172,36 +172,36 @@ double default_amp_lin[] = {1}; ...@@ -172,36 +172,36 @@ double default_amp_lin[] = {1};
double ts_shift_delays[] = {0, 1/7.68}; double ts_shift_delays[] = {0, 1/7.68};
double ts_shift_amps[] = {0, 1}; double ts_shift_amps[] = {0, 1};
//correlation matrix for a 2x2 channel with full Tx correlation //correlation matrix for a 2x2 channel with full Tx correlation
struct complex R_sqrt_22_corr_tap[16] = {{0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, struct complex R_sqrt_22_corr_tap[16] = {{0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0},
{0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {0.70711,0},
{0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0},
{0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {0.70711,0}}; {0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {0.70711,0}};
struct complex *R_sqrt_22_corr[1] = {R_sqrt_22_corr_tap}; struct complex *R_sqrt_22_corr[1] = {R_sqrt_22_corr_tap};
//correlation matrix for a fully correlated 2x1 channel (h1==h2) //correlation matrix for a fully correlated 2x1 channel (h1==h2)
struct complex R_sqrt_21_corr_tap[4] = {{0.70711,0}, {0.70711,0}, {0.70711,0}, {0.70711,0}}; struct complex R_sqrt_21_corr_tap[4] = {{0.70711,0}, {0.70711,0}, {0.70711,0}, {0.70711,0}};
struct complex *R_sqrt_21_corr[1] = {R_sqrt_21_corr_tap}; struct complex *R_sqrt_21_corr[1] = {R_sqrt_21_corr_tap};
//correlation matrix for a 2x2 channel with full Tx anti-correlation //correlation matrix for a 2x2 channel with full Tx anti-correlation
struct complex R_sqrt_22_anticorr_tap[16] = {{0.70711,0}, {0.0, 0.0}, {-0.70711,0}, {0.0, 0.0}, struct complex R_sqrt_22_anticorr_tap[16] = {{0.70711,0}, {0.0, 0.0}, {-0.70711,0}, {0.0, 0.0},
{0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {-0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {-0.70711,0},
{-0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0}, {-0.70711,0}, {0.0, 0.0}, {0.70711,0}, {0.0, 0.0},
{0.0, 0.0}, {-0.70711,0}, {0.0, 0.0}, {0.70711,0}}; {0.0, 0.0}, {-0.70711,0}, {0.0, 0.0}, {0.70711,0}};
struct complex *R_sqrt_22_anticorr[1] = {R_sqrt_22_anticorr_tap}; struct complex *R_sqrt_22_anticorr[1] = {R_sqrt_22_anticorr_tap};
//correlation matrix for a fully anti-correlated 2x1 channel (h1==-h2) //correlation matrix for a fully anti-correlated 2x1 channel (h1==-h2)
struct complex R_sqrt_21_anticorr_tap[4] = {{0.70711,0}, {-0.70711,0}, {-0.70711,0}, {0.70711,0}}; struct complex R_sqrt_21_anticorr_tap[4] = {{0.70711,0}, {-0.70711,0}, {-0.70711,0}, {0.70711,0}};
struct complex *R_sqrt_21_anticorr[1] = {R_sqrt_21_anticorr_tap}; struct complex *R_sqrt_21_anticorr[1] = {R_sqrt_21_anticorr_tap};
struct complex **R_sqrt_ptr2; struct complex **R_sqrt_ptr2;
// full correlation matrix in vectorized form for 2x2 channel, where h1 is perfectly orthogonal to h2 // full correlation matrix in vectorized form for 2x2 channel, where h1 is perfectly orthogonal to h2
struct complex R_sqrt_22_orthogonal_tap[16] = {{0.70711,0.0}, {0.0, 0.0}, {0.0,0.0}, {0.0, 0.0}, struct complex R_sqrt_22_orthogonal_tap[16] = {{0.70711,0.0}, {0.0, 0.0}, {0.0,0.0}, {0.0, 0.0},
{0.0, 0.0}, {0.0,0.0}, {0.0, 0.0}, {0.0,0.0}, {0.0, 0.0}, {0.0,0.0}, {0.0, 0.0}, {0.0,0.0},
{0.0,0.0}, {0.0, 0.0}, {0.0,0.0}, {0.0, 0.0}, {0.0,0.0}, {0.0, 0.0}, {0.0,0.0}, {0.0, 0.0},
{0.0, 0.0}, {0.0,0.0}, {0.0, 0.0}, {0.70711,0.0}}; {0.0, 0.0}, {0.0,0.0}, {0.0, 0.0}, {0.70711,0.0}};
struct complex *R_sqrt_22_orthogonal[1] = {R_sqrt_22_orthogonal_tap}; struct complex *R_sqrt_22_orthogonal[1] = {R_sqrt_22_orthogonal_tap};
// full correlation matrix for TM4 to make orthogonal effective channel // full correlation matrix for TM4 to make orthogonal effective channel
...@@ -209,21 +209,40 @@ struct complex *R_sqrt_22_orthogonal[1] = {R_sqrt_22_orthogonal_tap}; ...@@ -209,21 +209,40 @@ struct complex *R_sqrt_22_orthogonal[1] = {R_sqrt_22_orthogonal_tap};
struct complex R_sqrt_22_orth_eff_ch_TM4_prec_real_tap[16] = {{0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0}, struct complex R_sqrt_22_orth_eff_ch_TM4_prec_real_tap[16] = {{0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0},
{0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0}, {-0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0}, {-0.70711,0.0},
{0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0},
{0.0, 0.0}, {-0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}}; {0.0, 0.0}, {-0.70711,0.0}, {0.0, 0.0}, {0.70711,0.0}};
struct complex *R_sqrt_22_orth_eff_ch_TM4_prec_real[1] = {R_sqrt_22_orth_eff_ch_TM4_prec_real_tap}; struct complex *R_sqrt_22_orth_eff_ch_TM4_prec_real[1] = {R_sqrt_22_orth_eff_ch_TM4_prec_real_tap};
struct complex R_sqrt_22_orth_eff_ch_TM4_prec_imag_tap[16] = {{0.70711,0.0}, {0.0,0.0}, {0.0, -0.70711}, {0.0,0.0}, struct complex R_sqrt_22_orth_eff_ch_TM4_prec_imag_tap[16] = {{0.70711,0.0}, {0.0,0.0}, {0.0, -0.70711}, {0.0,0.0},
{0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0}, {0.0,0.70711}, {0.0, 0.0}, {0.70711,0.0}, {0.0, 0.0}, {0.0,0.70711},
{0.0,-0.70711}, {0.0, 0.0}, {-0.70711,0.0}, {0.0, 0.0}, {0.0,-0.70711}, {0.0, 0.0}, {-0.70711,0.0}, {0.0, 0.0},
{0.0, 0.0}, {0.0,0.70711}, {0.0, 0.0}, {-0.70711,0.0}}; {0.0, 0.0}, {0.0,0.70711}, {0.0, 0.0}, {-0.70711,0.0}};
struct complex *R_sqrt_22_orth_eff_ch_TM4_prec_imag[1] = {R_sqrt_22_orth_eff_ch_TM4_prec_imag_tap}; struct complex *R_sqrt_22_orth_eff_ch_TM4_prec_imag[1] = {R_sqrt_22_orth_eff_ch_TM4_prec_imag_tap};
//Correlation matrix for EPA channel
struct complex R_sqrt_22_EPA_low_tap[16] = {{1.0,0.0}, {0.0,0.0}, {0.0,0.0}, {0.0,0.0},
{0.0,0.0}, {1.0,0.0}, {0.0,0.0}, {0.0,0.0},
{0.0,0.0}, {0.0,0.0}, {1.0,0.0}, {0.0,0.0},
{0.0,0.0}, {0.0,0.0}, {0.0,0.0}, {1.0,0.0}};
struct complex *R_sqrt_22_EPA_low[1] = {R_sqrt_22_EPA_low_tap};
struct complex R_sqrt_22_EPA_high_tap[16] = {{0.7179,0.0}, {0.4500,0.0}, {0.4500,0.0}, {0.2821,0.0},
{0.4500,0.0}, {0.7179,0.0}, {0.2821,0.0}, {0.4500,0.0},
{0.4500,0.0}, {0.2821,0.0}, {0.7179,0.0}, {0.4500,0.0},
{0.2821,0.0}, {0.4500,0.0}, {0.4500,0.0}, {0.7179,0.0}};
struct complex *R_sqrt_22_EPA_high[1] = {R_sqrt_22_EPA_high_tap};
struct complex R_sqrt_22_EPA_medium_tap[16] = {{0.8375,0.0}, {0.5249,0.0}, {0.1286,0.0}, {0.0806,0.0},
{0.5249,0.0}, {0.8375,0.0}, {0.0806,0.0}, {0.1286,0.0},
{0.1286,0.0}, {0.0806,0.0}, {0.8375,0.0}, {0.5249,0.0},
{0.0806,0.0}, {0.1286,0.0}, {0.5249,0.0}, {0.8375,0.0}};
struct complex *R_sqrt_22_EPA_medium[1] = {R_sqrt_22_EPA_medium_tap};
//Rayleigh1_orth_eff_ch_TM4 //Rayleigh1_orth_eff_ch_TM4
...@@ -232,7 +251,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -232,7 +251,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
uint8_t nb_rx, uint8_t nb_rx,
SCM_t channel_model, SCM_t channel_model,
double sampling_rate, double sampling_rate,
double channel_bandwidth, double channel_bandwidth,
double forgetting_factor, double forgetting_factor,
int32_t channel_offset, int32_t channel_offset,
double path_loss_dB) double path_loss_dB)
...@@ -244,15 +263,15 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -244,15 +263,15 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
double aoa,ricean_factor,Td,maxDoppler; double aoa,ricean_factor,Td,maxDoppler;
int channel_length,nb_taps; int channel_length,nb_taps;
chan_desc->nb_tx = nb_tx; chan_desc->nb_tx = nb_tx;
chan_desc->nb_rx = nb_rx; chan_desc->nb_rx = nb_rx;
chan_desc->sampling_rate = sampling_rate; chan_desc->sampling_rate = sampling_rate;
chan_desc->channel_bandwidth = channel_bandwidth; chan_desc->channel_bandwidth = channel_bandwidth;
chan_desc->forgetting_factor = forgetting_factor; chan_desc->forgetting_factor = forgetting_factor;
chan_desc->channel_offset = channel_offset; chan_desc->channel_offset = channel_offset;
chan_desc->path_loss_dB = path_loss_dB; chan_desc->path_loss_dB = path_loss_dB;
chan_desc->first_run = 1; chan_desc->first_run = 1;
chan_desc->ip = 0.0; chan_desc->ip = 0.0;
LOG_I(OCM,"Channel Model (inside of new_channel_desc_scm)=%d\n\n", channel_model); LOG_I(OCM,"Channel Model (inside of new_channel_desc_scm)=%d\n\n", channel_model);
...@@ -272,7 +291,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -272,7 +291,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
sum_amps = 0; sum_amps = 0;
chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double));
for (i = 0; i<chan_desc->nb_taps; i++) { for (i = 0; i<chan_desc->nb_taps; i++) {
chan_desc->amps[i] = pow(10,.1*scm_c_amps_dB[i]); chan_desc->amps[i] = pow(10,.1*scm_c_amps_dB[i]);
sum_amps += chan_desc->amps[i]; sum_amps += chan_desc->amps[i];
} }
for (i = 0; i<chan_desc->nb_taps; i++) for (i = 0; i<chan_desc->nb_taps; i++)
...@@ -284,34 +303,34 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -284,34 +303,34 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*)); chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*));
for (i = 0; i<nb_tx*nb_rx; i++) for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex)); chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex));
for (i = 0; i<nb_tx*nb_rx; i++) for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex)); chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex));
for (i = 0; i<chan_desc->nb_taps; i++) for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex)); chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex));
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**)); chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
if (nb_tx==2 && nb_rx==2) { if (nb_tx==2 && nb_rx==2) {
for (i = 0; i<6; i++) for (i = 0; i<6; i++)
chan_desc->R_sqrt[i] = (struct complex*) &R22_sqrt[i][0]; chan_desc->R_sqrt[i] = (struct complex*) &R22_sqrt[i][0];
} }
else if (nb_tx==2 && nb_rx==1) { else if (nb_tx==2 && nb_rx==1) {
for (i = 0; i<6; i++) for (i = 0; i<6; i++)
chan_desc->R_sqrt[i] = (struct complex*) &R21_sqrt[i][0]; chan_desc->R_sqrt[i] = (struct complex*) &R21_sqrt[i][0];
} }
else if (nb_tx==1 && nb_rx==2) { else if (nb_tx==1 && nb_rx==2) {
for (i = 0; i<6; i++) for (i = 0; i<6; i++)
chan_desc->R_sqrt[i] = (struct complex*) &R12_sqrt[i][0]; chan_desc->R_sqrt[i] = (struct complex*) &R12_sqrt[i][0];
} }
else { else {
for (i = 0; i<6; i++) { for (i = 0; i<6; i++) {
chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) { for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
chan_desc->R_sqrt[i][j].x = 1.0; chan_desc->R_sqrt[i][j].x = 1.0;
chan_desc->R_sqrt[i][j].y = 0.0; chan_desc->R_sqrt[i][j].y = 0.0;
} }
LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx); LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx);
} }
} }
break; break;
...@@ -323,7 +342,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -323,7 +342,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
sum_amps = 0; sum_amps = 0;
chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double));
for (i = 0; i<chan_desc->nb_taps; i++) { for (i = 0; i<chan_desc->nb_taps; i++) {
chan_desc->amps[i] = pow(10,.1*scm_c_amps_dB[i]); chan_desc->amps[i] = pow(10,.1*scm_c_amps_dB[i]);
sum_amps += chan_desc->amps[i]; sum_amps += chan_desc->amps[i];
} }
for (i = 0; i<chan_desc->nb_taps; i++) for (i = 0; i<chan_desc->nb_taps; i++)
...@@ -335,34 +354,34 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -335,34 +354,34 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*)); chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*));
for (i = 0; i<nb_tx*nb_rx; i++) for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex)); chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex));
for (i = 0; i<nb_tx*nb_rx; i++) for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex)); chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex));
for (i = 0; i<chan_desc->nb_taps; i++) for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex)); chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex));
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**)); chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
if (nb_tx==2 && nb_rx==2) { if (nb_tx==2 && nb_rx==2) {
for (i = 0; i<6; i++) for (i = 0; i<6; i++)
chan_desc->R_sqrt[i] = (struct complex*) &R22_sqrt[i][0]; chan_desc->R_sqrt[i] = (struct complex*) &R22_sqrt[i][0];
} }
else if (nb_tx==2 && nb_rx==1) { else if (nb_tx==2 && nb_rx==1) {
for (i = 0; i<6; i++) for (i = 0; i<6; i++)
chan_desc->R_sqrt[i] = (struct complex*) &R21_sqrt[i][0]; chan_desc->R_sqrt[i] = (struct complex*) &R21_sqrt[i][0];
} }
else if (nb_tx==1 && nb_rx==2) { else if (nb_tx==1 && nb_rx==2) {
for (i = 0; i<6; i++) for (i = 0; i<6; i++)
chan_desc->R_sqrt[i] = (struct complex*) &R12_sqrt[i][0]; chan_desc->R_sqrt[i] = (struct complex*) &R12_sqrt[i][0];
} }
else { else {
for (i = 0; i<6; i++) { for (i = 0; i<6; i++) {
chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) { for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
chan_desc->R_sqrt[i][j].x = 1.0; chan_desc->R_sqrt[i][j].x = 1.0;
chan_desc->R_sqrt[i][j].y = 0.0; chan_desc->R_sqrt[i][j].y = 0.0;
} }
LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx); LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx);
} }
} }
break; break;
...@@ -373,7 +392,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -373,7 +392,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
sum_amps = 0; sum_amps = 0;
chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double));
for (i = 0; i<chan_desc->nb_taps; i++) { for (i = 0; i<chan_desc->nb_taps; i++) {
chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]);
sum_amps += chan_desc->amps[i]; sum_amps += chan_desc->amps[i];
} }
for (i = 0; i<chan_desc->nb_taps; i++) for (i = 0; i<chan_desc->nb_taps; i++)
...@@ -385,28 +404,162 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -385,28 +404,162 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*)); chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*));
for (i = 0; i<nb_tx*nb_rx; i++) for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex)); chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex));
for (i = 0; i<nb_tx*nb_rx; i++) for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex)); chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex));
for (i = 0; i<chan_desc->nb_taps; i++) for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex)); chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex));
if (nb_tx==2 && nb_rx==2) { if (nb_tx==2 && nb_rx==2) {
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**)); chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
for (i = 0; i<6; i++) for (i = 0; i<6; i++)
chan_desc->R_sqrt[i] = (struct complex*) &R22_sqrt[i][0]; chan_desc->R_sqrt[i] = (struct complex*) &R22_sqrt[i][0];
}
else {
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
for (i = 0; i<6; i++) {
chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
chan_desc->R_sqrt[i][j].x = 1.0;
chan_desc->R_sqrt[i][j].y = 0.0;
}
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
}
}
break;
case EPA_low:
chan_desc->nb_taps = 7;
chan_desc->Td = .410;
chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td));
sum_amps = 0;
chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double));
for (i = 0; i<chan_desc->nb_taps; i++) {
chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]);
sum_amps += chan_desc->amps[i];
}
for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->amps[i] /= sum_amps;
chan_desc->delays = epa_delays;
chan_desc->ricean_factor = 1;
chan_desc->aoa = 0;
chan_desc->random_aoa = 0;
chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*));
for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex));
for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex));
for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex));
if (nb_tx==2 && nb_rx==2) {
chan_desc->R_sqrt = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex**));
for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->R_sqrt[i] = R_sqrt_22_EPA_low[0];
}
else {
printf("Correlation matrices are implemented for 2 x 2 only");
}
/*else {
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
for (i = 0; i<6; i++) {
chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
chan_desc->R_sqrt[i][j].x = 1.0;
chan_desc->R_sqrt[i][j].y = 0.0;
}
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
}
}*/
break;
case EPA_high:
chan_desc->nb_taps = 7;
chan_desc->Td = .410;
chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td));
sum_amps = 0;
chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double));
for (i = 0; i<chan_desc->nb_taps; i++) {
chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]);
sum_amps += chan_desc->amps[i];
}
for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->amps[i] /= sum_amps;
chan_desc->delays = epa_delays;
chan_desc->ricean_factor = 1;
chan_desc->aoa = 0;
chan_desc->random_aoa = 0;
chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*));
for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex));
for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex));
for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex));
if (nb_tx==2 && nb_rx==2) {
chan_desc->R_sqrt = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex**));
for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->R_sqrt[i] = R_sqrt_22_EPA_high[0];
} }
else { else {
printf("Correlation matrices are implemented for 2 x 2 only");
}
/*else {
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**)); chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
for (i = 0; i<6; i++) { for (i = 0; i<6; i++) {
chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) { for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
chan_desc->R_sqrt[i][j].x = 1.0; chan_desc->R_sqrt[i][j].x = 1.0;
chan_desc->R_sqrt[i][j].y = 0.0; chan_desc->R_sqrt[i][j].y = 0.0;
} }
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n"); LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
} }
}*/
break;
case EPA_medium:
chan_desc->nb_taps = 7;
chan_desc->Td = .410;
chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td));
sum_amps = 0;
chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double));
for (i = 0; i<chan_desc->nb_taps; i++) {
chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]);
sum_amps += chan_desc->amps[i];
} }
for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->amps[i] /= sum_amps;
chan_desc->delays = epa_delays;
chan_desc->ricean_factor = 1;
chan_desc->aoa = 0;
chan_desc->random_aoa = 0;
chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*));
for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex));
for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex));
for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex));
if (nb_tx==2 && nb_rx==2) {
chan_desc->R_sqrt = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex**));
for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->R_sqrt[i] = R_sqrt_22_EPA_medium[0];
} else {
printf("Correlation matrices are implemented for 2 x 2 only");
}
/*else {
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
for (i = 0; i<6; i++) {
chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
chan_desc->R_sqrt[i][j].x = 1.0;
chan_desc->R_sqrt[i][j].y = 0.0;
}
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
}
}*/
break; break;
case EVA: case EVA:
chan_desc->nb_taps = 9; chan_desc->nb_taps = 9;
...@@ -415,7 +568,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -415,7 +568,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
sum_amps = 0; sum_amps = 0;
chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double));
for (i = 0; i<chan_desc->nb_taps; i++) { for (i = 0; i<chan_desc->nb_taps; i++) {
chan_desc->amps[i] = pow(10,.1*eva_amps_dB[i]); chan_desc->amps[i] = pow(10,.1*eva_amps_dB[i]);
sum_amps += chan_desc->amps[i]; sum_amps += chan_desc->amps[i];
} }
for (i = 0; i<chan_desc->nb_taps; i++) for (i = 0; i<chan_desc->nb_taps; i++)
...@@ -427,26 +580,26 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -427,26 +580,26 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*)); chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*));
for (i = 0; i<nb_tx*nb_rx; i++) for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex)); chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex));
for (i = 0; i<nb_tx*nb_rx; i++) for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex)); chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex));
for (i = 0; i<chan_desc->nb_taps; i++) for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex)); chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex));
if (nb_tx==2 && nb_rx==2) { if (nb_tx==2 && nb_rx==2) {
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**)); chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
for (i = 0; i<6; i++) for (i = 0; i<6; i++)
chan_desc->R_sqrt[i] = (struct complex*) &R22_sqrt[i][0]; chan_desc->R_sqrt[i] = (struct complex*) &R22_sqrt[i][0];
} }
else { else {
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**)); chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
for (i = 0; i<6; i++) { for (i = 0; i<6; i++) {
chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) { for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
chan_desc->R_sqrt[i][j].x = 1.0; chan_desc->R_sqrt[i][j].x = 1.0;
chan_desc->R_sqrt[i][j].y = 0.0; chan_desc->R_sqrt[i][j].y = 0.0;
} }
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n"); LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
} }
} }
break; break;
...@@ -457,7 +610,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -457,7 +610,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
sum_amps = 0; sum_amps = 0;
chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double));
for (i = 0; i<chan_desc->nb_taps; i++) { for (i = 0; i<chan_desc->nb_taps; i++) {
chan_desc->amps[i] = pow(10,.1*etu_amps_dB[i]); chan_desc->amps[i] = pow(10,.1*etu_amps_dB[i]);
sum_amps += chan_desc->amps[i]; sum_amps += chan_desc->amps[i];
} }
for (i = 0; i<chan_desc->nb_taps; i++) for (i = 0; i<chan_desc->nb_taps; i++)
...@@ -469,26 +622,26 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -469,26 +622,26 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*)); chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*));
for (i = 0; i<nb_tx*nb_rx; i++) for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex)); chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex));
for (i = 0; i<nb_tx*nb_rx; i++) for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex)); chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex));
for (i = 0; i<chan_desc->nb_taps; i++) for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex)); chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex));
if (nb_tx==2 && nb_rx==2) { if (nb_tx==2 && nb_rx==2) {
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**)); chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
for (i = 0; i<6; i++) for (i = 0; i<6; i++)
chan_desc->R_sqrt[i] = (struct complex*) &R22_sqrt[i][0]; chan_desc->R_sqrt[i] = (struct complex*) &R22_sqrt[i][0];
} }
else { else {
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**)); chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex**));
for (i = 0; i<6; i++) { for (i = 0; i<6; i++) {
chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) { for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
chan_desc->R_sqrt[i][j].x = 1.0; chan_desc->R_sqrt[i][j].x = 1.0;
chan_desc->R_sqrt[i][j].y = 0.0; chan_desc->R_sqrt[i][j].y = 0.0;
} }
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n"); LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
} }
} }
break; break;
...@@ -499,7 +652,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -499,7 +652,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
sum_amps = 0; sum_amps = 0;
chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->amps = (double*) malloc(chan_desc->nb_taps*sizeof(double));
for (i = 0; i<chan_desc->nb_taps; i++) { for (i = 0; i<chan_desc->nb_taps; i++) {
chan_desc->amps[i] = pow(10,.1*mbsfn_amps_dB[i]); chan_desc->amps[i] = pow(10,.1*mbsfn_amps_dB[i]);
sum_amps += chan_desc->amps[i]; sum_amps += chan_desc->amps[i];
} }
for (i = 0; i<chan_desc->nb_taps; i++) for (i = 0; i<chan_desc->nb_taps; i++)
...@@ -511,19 +664,19 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -511,19 +664,19 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); chan_desc->ch = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*)); chan_desc->chF = (struct complex**) malloc(nb_tx*nb_rx*sizeof(struct complex*));
chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*)); chan_desc->a = (struct complex**) malloc(chan_desc->nb_taps*sizeof(struct complex*));
for (i = 0; i<nb_tx*nb_rx; i++) for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex)); chan_desc->ch[i] = (struct complex*) malloc(chan_desc->channel_length * sizeof(struct complex));
for (i = 0; i<nb_tx*nb_rx; i++) for (i = 0; i<nb_tx*nb_rx; i++)
chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex)); chan_desc->chF[i] = (struct complex*) malloc(1200 * sizeof(struct complex));
for (i = 0; i<chan_desc->nb_taps; i++) for (i = 0; i<chan_desc->nb_taps; i++)
chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex)); chan_desc->a[i] = (struct complex*) malloc(nb_tx*nb_rx * sizeof(struct complex));
chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex*)); chan_desc->R_sqrt = (struct complex**) malloc(6*sizeof(struct complex*));
for (i = 0; i<6; i++) { for (i = 0; i<6; i++) {
chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); chan_desc->R_sqrt[i] = (struct complex*) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex));
for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) { for (j = 0; j<nb_tx*nb_rx*nb_tx*nb_rx; j+=(nb_tx*nb_rx+1)) {
chan_desc->R_sqrt[i][j].x = 1.0; chan_desc->R_sqrt[i][j].x = 1.0;
chan_desc->R_sqrt[i][j].y = 0.0; chan_desc->R_sqrt[i][j].y = 0.0;
} }
LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n"); LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n");
} }
...@@ -538,23 +691,23 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -538,23 +691,23 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
maxDoppler = 0; maxDoppler = 0;
fill_channel_desc(chan_desc, fill_channel_desc(chan_desc,
nb_tx, nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amps_lin, default_amps_lin,
NULL, NULL,
NULL, NULL,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
0); 0);
break; break;
case Rice8: case Rice8:
...@@ -566,22 +719,22 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -566,22 +719,22 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
maxDoppler = 0; maxDoppler = 0;
fill_channel_desc(chan_desc,nb_tx, fill_channel_desc(chan_desc,nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amps_lin, default_amps_lin,
NULL, NULL,
NULL, NULL,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
1); 1);
break; break;
case Rayleigh1: case Rayleigh1:
...@@ -593,22 +746,22 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -593,22 +746,22 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
maxDoppler = 0; maxDoppler = 0;
fill_channel_desc(chan_desc,nb_tx, fill_channel_desc(chan_desc,nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amp_lin, default_amp_lin,
NULL, NULL,
NULL, NULL,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
0); 0);
break; break;
case Rayleigh1_800: case Rayleigh1_800:
...@@ -620,22 +773,22 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -620,22 +773,22 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
maxDoppler = 800; maxDoppler = 800;
fill_channel_desc(chan_desc,nb_tx, fill_channel_desc(chan_desc,nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amp_lin, default_amp_lin,
NULL, NULL,
NULL, NULL,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
0); 0);
break; break;
case Rayleigh1_corr: case Rayleigh1_corr:
...@@ -647,31 +800,31 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -647,31 +800,31 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
maxDoppler = 0; maxDoppler = 0;
if ((nb_tx==2) && (nb_rx==1)) { if ((nb_tx==2) && (nb_rx==1)) {
R_sqrt_ptr2 = R_sqrt_21_corr; R_sqrt_ptr2 = R_sqrt_21_corr;
} }
else if ((nb_tx==2) && (nb_rx==2)) { else if ((nb_tx==2) && (nb_rx==2)) {
R_sqrt_ptr2 = R_sqrt_22_corr; R_sqrt_ptr2 = R_sqrt_22_corr;
} }
else else
R_sqrt_ptr2 = NULL; R_sqrt_ptr2 = NULL;
fill_channel_desc(chan_desc,nb_tx, fill_channel_desc(chan_desc,nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amp_lin, default_amp_lin,
NULL, NULL,
R_sqrt_ptr2, R_sqrt_ptr2,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
0); 0);
break; break;
case Rayleigh1_anticorr: case Rayleigh1_anticorr:
...@@ -683,31 +836,31 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -683,31 +836,31 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
maxDoppler = 0; maxDoppler = 0;
if ((nb_tx==2) && (nb_rx==1)) { //check this if ((nb_tx==2) && (nb_rx==1)) { //check this
R_sqrt_ptr2 = R_sqrt_21_anticorr; R_sqrt_ptr2 = R_sqrt_21_anticorr;
} }
else if ((nb_tx==2) && (nb_rx==2)) { else if ((nb_tx==2) && (nb_rx==2)) {
R_sqrt_ptr2 = R_sqrt_22_anticorr; R_sqrt_ptr2 = R_sqrt_22_anticorr;
} }
else else
R_sqrt_ptr2 = NULL; R_sqrt_ptr2 = NULL;
fill_channel_desc(chan_desc,nb_tx, fill_channel_desc(chan_desc,nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amp_lin, default_amp_lin,
NULL, NULL,
R_sqrt_ptr2, R_sqrt_ptr2,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
0); 0);
break; break;
case Rice1: case Rice1:
...@@ -719,22 +872,22 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -719,22 +872,22 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
maxDoppler = 0; maxDoppler = 0;
fill_channel_desc(chan_desc,nb_tx, fill_channel_desc(chan_desc,nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amp_lin, default_amp_lin,
NULL, NULL,
NULL, NULL,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
0); 0);
break; break;
case AWGN: case AWGN:
...@@ -746,22 +899,22 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -746,22 +899,22 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
maxDoppler = 0; maxDoppler = 0;
fill_channel_desc(chan_desc,nb_tx, fill_channel_desc(chan_desc,nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amp_lin, default_amp_lin,
NULL, NULL,
NULL, NULL,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
0); 0);
printf("AWGN: ricean_factor %f\n",chan_desc->ricean_factor); printf("AWGN: ricean_factor %f\n",chan_desc->ricean_factor);
break; break;
...@@ -775,22 +928,22 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -775,22 +928,22 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
maxDoppler = 0; maxDoppler = 0;
fill_channel_desc(chan_desc,nb_tx, fill_channel_desc(chan_desc,nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
ts_shift_amps, ts_shift_amps,
ts_shift_delays, ts_shift_delays,
NULL, NULL,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
0); 0);
printf("TS_SHIFT: ricean_factor %f\n",chan_desc->ricean_factor); printf("TS_SHIFT: ricean_factor %f\n",chan_desc->ricean_factor);
break; break;
...@@ -804,31 +957,31 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -804,31 +957,31 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
maxDoppler = 0; maxDoppler = 0;
if ((nb_tx==2) && (nb_rx==1)) { if ((nb_tx==2) && (nb_rx==1)) {
R_sqrt_ptr2 = R_sqrt_21_corr; R_sqrt_ptr2 = R_sqrt_21_corr;
} }
else if ((nb_tx==2) && (nb_rx==2)) { else if ((nb_tx==2) && (nb_rx==2)) {
R_sqrt_ptr2 = R_sqrt_22_corr; R_sqrt_ptr2 = R_sqrt_22_corr;
} }
else else
R_sqrt_ptr2 = NULL; R_sqrt_ptr2 = NULL;
fill_channel_desc(chan_desc,nb_tx, fill_channel_desc(chan_desc,nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amp_lin, default_amp_lin,
NULL, NULL,
R_sqrt_ptr2, R_sqrt_ptr2,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
1); 1);
break; break;
case Rice1_anticorr: case Rice1_anticorr:
...@@ -840,33 +993,33 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -840,33 +993,33 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
maxDoppler = 0; maxDoppler = 0;
if ((nb_tx==2) && (nb_rx==1)) { if ((nb_tx==2) && (nb_rx==1)) {
R_sqrt_ptr2 = R_sqrt_21_anticorr; R_sqrt_ptr2 = R_sqrt_21_anticorr;
} }
else if ((nb_tx==2) && (nb_rx==2)) { else if ((nb_tx==2) && (nb_rx==2)) {
R_sqrt_ptr2 = R_sqrt_22_anticorr; R_sqrt_ptr2 = R_sqrt_22_anticorr;
} }
else else
R_sqrt_ptr2 = NULL; R_sqrt_ptr2 = NULL;
fill_channel_desc(chan_desc,nb_tx, fill_channel_desc(chan_desc,nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amp_lin, default_amp_lin,
NULL, NULL,
R_sqrt_ptr2, R_sqrt_ptr2,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
1); 1);
break; break;
case Rayleigh1_orthogonal: case Rayleigh1_orthogonal:
nb_taps = 1; nb_taps = 1;
Td = 0; Td = 0;
...@@ -875,32 +1028,32 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -875,32 +1028,32 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
aoa = 0.03; aoa = 0.03;
maxDoppler = 0; maxDoppler = 0;
if ((nb_tx==2) && (nb_rx==2)) { if ((nb_tx==2) && (nb_rx==2)) {
R_sqrt_ptr2 = R_sqrt_22_orthogonal; R_sqrt_ptr2 = R_sqrt_22_orthogonal;
} }
else else
R_sqrt_ptr2 = NULL; R_sqrt_ptr2 = NULL;
fill_channel_desc(chan_desc,nb_tx, fill_channel_desc(chan_desc,nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amp_lin, default_amp_lin,
NULL, NULL,
R_sqrt_ptr2, R_sqrt_ptr2,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
0); 0);
break; break;
case Rayleigh1_orth_eff_ch_TM4_prec_real: case Rayleigh1_orth_eff_ch_TM4_prec_real:
nb_taps = 1; nb_taps = 1;
Td = 0; Td = 0;
...@@ -909,32 +1062,32 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -909,32 +1062,32 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
aoa = 0.03; aoa = 0.03;
maxDoppler = 0; maxDoppler = 0;
if ((nb_tx==2) && (nb_rx==2)) { if ((nb_tx==2) && (nb_rx==2)) {
R_sqrt_ptr2 = R_sqrt_22_orth_eff_ch_TM4_prec_real; R_sqrt_ptr2 = R_sqrt_22_orth_eff_ch_TM4_prec_real;
} }
else else
R_sqrt_ptr2 = NULL; R_sqrt_ptr2 = NULL;
fill_channel_desc(chan_desc,nb_tx, fill_channel_desc(chan_desc,nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amp_lin, default_amp_lin,
NULL, NULL,
R_sqrt_ptr2, R_sqrt_ptr2,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
1); 1);
break; break;
case Rayleigh1_orth_eff_ch_TM4_prec_imag: case Rayleigh1_orth_eff_ch_TM4_prec_imag:
nb_taps = 1; nb_taps = 1;
Td = 0; Td = 0;
...@@ -943,42 +1096,42 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -943,42 +1096,42 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
aoa = 0.03; aoa = 0.03;
maxDoppler = 0; maxDoppler = 0;
if ((nb_tx==2) && (nb_rx==2)) { if ((nb_tx==2) && (nb_rx==2)) {
R_sqrt_ptr2 = R_sqrt_22_orth_eff_ch_TM4_prec_imag; R_sqrt_ptr2 = R_sqrt_22_orth_eff_ch_TM4_prec_imag;
} }
else else
R_sqrt_ptr2 = NULL; R_sqrt_ptr2 = NULL;
fill_channel_desc(chan_desc,nb_tx, fill_channel_desc(chan_desc,nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amp_lin, default_amp_lin,
NULL, NULL,
R_sqrt_ptr2, R_sqrt_ptr2,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
0); 0);
break; break;
case Rayleigh8_orth_eff_ch_TM4_prec_real: case Rayleigh8_orth_eff_ch_TM4_prec_real:
if ((nb_tx==2) && (nb_rx==2)) { if ((nb_tx==2) && (nb_rx==2)) {
R_sqrt_ptr2 = R_sqrt_22_orth_eff_ch_TM4_prec_real; R_sqrt_ptr2 = R_sqrt_22_orth_eff_ch_TM4_prec_real;
//R_sqrt_ptr2 = NULL; //R_sqrt_ptr2 = NULL;
} }
else else
R_sqrt_ptr2 = NULL; R_sqrt_ptr2 = NULL;
nb_taps = 8; nb_taps = 8;
Td = 0.8; Td = 0.8;
channel_length = (int)11+2*sampling_rate*Td; channel_length = (int)11+2*sampling_rate*Td;
...@@ -987,26 +1140,26 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -987,26 +1140,26 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
maxDoppler = 0; maxDoppler = 0;
fill_channel_desc(chan_desc, fill_channel_desc(chan_desc,
nb_tx, nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amps_lin, default_amps_lin,
NULL, NULL,
R_sqrt_ptr2, R_sqrt_ptr2,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
0); 0);
break; break;
case Rayleigh8_orth_eff_ch_TM4_prec_imag: case Rayleigh8_orth_eff_ch_TM4_prec_imag:
nb_taps = 8; nb_taps = 8;
Td = 0.8; Td = 0.8;
...@@ -1016,31 +1169,31 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -1016,31 +1169,31 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
maxDoppler = 0; maxDoppler = 0;
if ((nb_tx==2) && (nb_rx==2)) { if ((nb_tx==2) && (nb_rx==2)) {
R_sqrt_ptr2 = R_sqrt_22_orth_eff_ch_TM4_prec_imag; R_sqrt_ptr2 = R_sqrt_22_orth_eff_ch_TM4_prec_imag;
} }
else else
R_sqrt_ptr2 = NULL; R_sqrt_ptr2 = NULL;
fill_channel_desc(chan_desc, fill_channel_desc(chan_desc,
nb_tx, nb_tx,
nb_rx, nb_rx,
nb_taps, nb_taps,
channel_length, channel_length,
default_amps_lin, default_amps_lin,
NULL, NULL,
R_sqrt_ptr2, R_sqrt_ptr2,
Td, Td,
sampling_rate, sampling_rate,
channel_bandwidth, channel_bandwidth,
ricean_factor, ricean_factor,
aoa, aoa,
forgetting_factor, forgetting_factor,
maxDoppler, maxDoppler,
channel_offset, channel_offset,
path_loss_dB, path_loss_dB,
0); 0);
break; break;
default: default:
LOG_W(OCM,"channel model not yet supported\n"); LOG_W(OCM,"channel model not yet supported\n");
free(chan_desc); free(chan_desc);
...@@ -1057,12 +1210,12 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -1057,12 +1210,12 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
double s; double s;
int i,k,l,aarx,aatx; int i,k,l,aarx,aatx;
struct complex anew[NB_ANTENNAS_TX*NB_ANTENNAS_RX],acorr[NB_ANTENNAS_TX*NB_ANTENNAS_RX]; struct complex anew[NB_ANTENNAS_TX*NB_ANTENNAS_RX],acorr[NB_ANTENNAS_TX*NB_ANTENNAS_RX];
struct complex phase, alpha, beta; struct complex phase, alpha, beta;
if ((desc->nb_tx>NB_ANTENNAS_TX) || (desc->nb_rx > NB_ANTENNAS_RX)) { if ((desc->nb_tx>NB_ANTENNAS_TX) || (desc->nb_rx > NB_ANTENNAS_RX)) {
msg("random_channel.c: Error: temporary buffer for channel not big enough (%d,%d)\n",desc->nb_tx,desc->nb_rx); msg("random_channel.c: Error: temporary buffer for channel not big enough (%d,%d)\n",desc->nb_tx,desc->nb_rx);
return(-1); return(-1);
...@@ -1073,26 +1226,26 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { ...@@ -1073,26 +1226,26 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
for (aarx=0;aarx<desc->nb_rx;aarx++) { for (aarx=0;aarx<desc->nb_rx;aarx++) {
for (aatx=0;aatx<desc->nb_tx;aatx++) { for (aatx=0;aatx<desc->nb_tx;aatx++) {
anew[aarx+(aatx*desc->nb_rx)].x = sqrt(desc->ricean_factor*desc->amps[i]/2) * gaussdouble(0.0,1.0); anew[aarx+(aatx*desc->nb_rx)].x = sqrt(desc->ricean_factor*desc->amps[i]/2) * gaussdouble(0.0,1.0);
anew[aarx+(aatx*desc->nb_rx)].y = sqrt(desc->ricean_factor*desc->amps[i]/2) * gaussdouble(0.0,1.0); anew[aarx+(aatx*desc->nb_rx)].y = sqrt(desc->ricean_factor*desc->amps[i]/2) * gaussdouble(0.0,1.0);
if ((i==0) && (desc->ricean_factor != 1.0)) { if ((i==0) && (desc->ricean_factor != 1.0)) {
if (desc->random_aoa==1) { if (desc->random_aoa==1) {
desc->aoa = uniformrandom()*2*M_PI; desc->aoa = uniformrandom()*2*M_PI;
} }
// this assumes that both RX and TX have linear antenna arrays with lambda/2 antenna spacing. // this assumes that both RX and TX have linear antenna arrays with lambda/2 antenna spacing.
// Furhter it is assumed that the arrays are parallel to each other and that they are far enough apart so // Furhter it is assumed that the arrays are parallel to each other and that they are far enough apart so
// that we can safely assume plane wave propagation. // that we can safely assume plane wave propagation.
phase.x = cos(M_PI*((aarx-aatx)*sin(desc->aoa))); phase.x = cos(M_PI*((aarx-aatx)*sin(desc->aoa)));
phase.y = sin(M_PI*((aarx-aatx)*sin(desc->aoa))); phase.y = sin(M_PI*((aarx-aatx)*sin(desc->aoa)));
anew[aarx+(aatx*desc->nb_rx)].x += phase.x * sqrt(1.0-desc->ricean_factor); anew[aarx+(aatx*desc->nb_rx)].x += phase.x * sqrt(1.0-desc->ricean_factor);
anew[aarx+(aatx*desc->nb_rx)].y += phase.y * sqrt(1.0-desc->ricean_factor); anew[aarx+(aatx*desc->nb_rx)].y += phase.y * sqrt(1.0-desc->ricean_factor);
} }
#ifdef DEBUG_CH #ifdef DEBUG_CH
printf("(%d,%d,%d) %f->(%f,%f) (%f,%f) phase (%f,%f)\n",aarx,aatx,i,desc->amps[i],anew[aarx+(aatx*desc->nb_rx)].x,anew[aarx+(aatx*desc->nb_rx)].y,desc->aoa,desc->ricean_factor,phase.x,phase.y); printf("(%d,%d,%d) %f->(%f,%f) (%f,%f) phase (%f,%f)\n",aarx,aatx,i,desc->amps[i],anew[aarx+(aatx*desc->nb_rx)].x,anew[aarx+(aatx*desc->nb_rx)].y,desc->aoa,desc->ricean_factor,phase.x,phase.y);
#endif #endif
} //aatx } //aatx
} //aarx } //aarx
...@@ -1100,9 +1253,9 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { ...@@ -1100,9 +1253,9 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
// for debugging set a=anew; // for debugging set a=anew;
for (aarx=0;aarx<desc->nb_rx;aarx++) { for (aarx=0;aarx<desc->nb_rx;aarx++) {
for (aatx=0;aatx<desc->nb_tx;aatx++) { for (aatx=0;aatx<desc->nb_tx;aatx++) {
desc->a[i][aarx+(aatx*desc->nb_rx)].x = anew[aarx+(aatx*desc->nb_rx)].x; desc->a[i][aarx+(aatx*desc->nb_rx)].x = anew[aarx+(aatx*desc->nb_rx)].x;
desc->a[i][aarx+(aatx*desc->nb_rx)].y = anew[aarx+(aatx*desc->nb_rx)].y; desc->a[i][aarx+(aatx*desc->nb_rx)].y = anew[aarx+(aatx*desc->nb_rx)].y;
printf("anew(%d,%d) = %f+1j*%f\n",aatx,aarx,anew[aarx+(aatx*desc->nb_rx)].x, anew[aarx+(aatx*desc->nb_rx)].y); printf("anew(%d,%d) = %f+1j*%f\n",aatx,aarx,anew[aarx+(aatx*desc->nb_rx)].x, anew[aarx+(aatx*desc->nb_rx)].y);
} }
} }
*/ */
...@@ -1113,16 +1266,16 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { ...@@ -1113,16 +1266,16 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
beta.x = 0.0; beta.x = 0.0;
beta.y = 0.0; beta.y = 0.0;
cblas_zgemv(CblasRowMajor, CblasNoTrans, desc->nb_tx*desc->nb_rx, desc->nb_tx*desc->nb_rx, cblas_zgemv(CblasRowMajor, CblasNoTrans, desc->nb_tx*desc->nb_rx, desc->nb_tx*desc->nb_rx,
(void*) &alpha, (void*) desc->R_sqrt[i/3], desc->nb_rx*desc->nb_tx, (void*) &alpha, (void*) desc->R_sqrt[i/3], desc->nb_rx*desc->nb_tx,
(void*) anew, 1, (void*) &beta, (void*) acorr, 1); (void*) anew, 1, (void*) &beta, (void*) acorr, 1);
/* /*
for (aarx=0;aarx<desc->nb_rx;aarx++) { for (aarx=0;aarx<desc->nb_rx;aarx++) {
for (aatx=0;aatx<desc->nb_tx;aatx++) { for (aatx=0;aatx<desc->nb_tx;aatx++) {
desc->a[i][aarx+(aatx*desc->nb_rx)].x = acorr[aarx+(aatx*desc->nb_rx)].x; desc->a[i][aarx+(aatx*desc->nb_rx)].x = acorr[aarx+(aatx*desc->nb_rx)].x;
desc->a[i][aarx+(aatx*desc->nb_rx)].y = acorr[aarx+(aatx*desc->nb_rx)].y; desc->a[i][aarx+(aatx*desc->nb_rx)].y = acorr[aarx+(aatx*desc->nb_rx)].y;
printf("tap %d, acorr1(%d,%d) = %f+1j*%f\n",i,aatx,aarx,acorr[aarx+(aatx*desc->nb_rx)].x, acorr[aarx+(aatx*desc->nb_rx)].y); printf("tap %d, acorr1(%d,%d) = %f+1j*%f\n",i,aatx,aarx,acorr[aarx+(aatx*desc->nb_rx)].x, acorr[aarx+(aatx*desc->nb_rx)].y);
} }
} }
*/ */
...@@ -1148,18 +1301,18 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { ...@@ -1148,18 +1301,18 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
/* /*
for (aarx=0;aarx<desc->nb_rx;aarx++) { for (aarx=0;aarx<desc->nb_rx;aarx++) {
for (aatx=0;aatx<desc->nb_tx;aatx++) { for (aatx=0;aatx<desc->nb_tx;aatx++) {
//desc->a[i][aarx+(aatx*desc->nb_rx)].x = acorr[aarx+(aatx*desc->nb_rx)].x; //desc->a[i][aarx+(aatx*desc->nb_rx)].x = acorr[aarx+(aatx*desc->nb_rx)].x;
//desc->a[i][aarx+(aatx*desc->nb_rx)].y = acorr[aarx+(aatx*desc->nb_rx)].y; //desc->a[i][aarx+(aatx*desc->nb_rx)].y = acorr[aarx+(aatx*desc->nb_rx)].y;
printf("tap %d, a(%d,%d) = %f+1j*%f\n",i,aatx,aarx,desc->a[i][aarx+(aatx*desc->nb_rx)].x, desc->a[i][aarx+(aatx*desc->nb_rx)].y); printf("tap %d, a(%d,%d) = %f+1j*%f\n",i,aatx,aarx,desc->a[i][aarx+(aatx*desc->nb_rx)].x, desc->a[i][aarx+(aatx*desc->nb_rx)].y);
} }
} }
*/ */
} //nb_taps } //nb_taps
stop_meas(&desc->random_channel); stop_meas(&desc->random_channel);
//memset((void *)desc->ch[aarx+(aatx*desc->nb_rx)],0,(int)(desc->channel_length)*sizeof(struct complex)); //memset((void *)desc->ch[aarx+(aatx*desc->nb_rx)],0,(int)(desc->channel_length)*sizeof(struct complex));
if (abstraction_flag==0) { if (abstraction_flag==0) {
start_meas(&desc->interp_time); start_meas(&desc->interp_time);
...@@ -1188,10 +1341,10 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { ...@@ -1188,10 +1341,10 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
} //nb_taps } //nb_taps
#ifdef DEBUG_CH #ifdef DEBUG_CH
k=0; k=0;
printf("(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,desc->ch[aarx+(aatx*desc->nb_rx)][k].x,desc->ch[aarx+(aatx*desc->nb_rx)][k].y); printf("(%d,%d,%d)->(%f,%f)\n",k,aarx,aatx,desc->ch[aarx+(aatx*desc->nb_rx)][k].x,desc->ch[aarx+(aatx*desc->nb_rx)][k].y);
#endif #endif
} }
} //channel_length } //channel_length
} //aatx } //aatx
} //aarx } //aarx
...@@ -1211,22 +1364,22 @@ double N_RB2sampling_rate(uint16_t N_RB) ...@@ -1211,22 +1364,22 @@ double N_RB2sampling_rate(uint16_t N_RB)
case 6: case 6:
sampling_rate = 1.92; sampling_rate = 1.92;
break; break;
case 25: case 25:
sampling_rate = 7.68; sampling_rate = 7.68;
break; break;
case 50: case 50:
sampling_rate = 15.36; sampling_rate = 15.36;
break; break;
case 100: case 100:
sampling_rate = 30.72; sampling_rate = 30.72;
break; break;
default: default:
LOG_E(PHY,"Unknown N_PRB\n"); LOG_E(PHY,"Unknown N_PRB\n");
return(-1); return(-1);
} }
return(sampling_rate); return(sampling_rate);
...@@ -1239,22 +1392,22 @@ double N_RB2channel_bandwidth(uint16_t N_RB) ...@@ -1239,22 +1392,22 @@ double N_RB2channel_bandwidth(uint16_t N_RB)
case 6: case 6:
channel_bandwidth = 1.25; channel_bandwidth = 1.25;
break; break;
case 25: case 25:
channel_bandwidth = 5.00; channel_bandwidth = 5.00;
break; break;
case 50: case 50:
channel_bandwidth = 10.00; channel_bandwidth = 10.00;
break; break;
case 100: case 100:
channel_bandwidth = 20.00; channel_bandwidth = 20.00;
break; break;
default: default:
LOG_E(PHY,"Unknown N_PRB\n"); LOG_E(PHY,"Unknown N_PRB\n");
return(-1); return(-1);
} }
return(channel_bandwidth); return(channel_bandwidth);
} }
...@@ -1267,7 +1420,7 @@ main(int argc,char **argv) { ...@@ -1267,7 +1420,7 @@ main(int argc,char **argv) {
double amps[8] = {.8,.2,.1,.04,.02,.01,.005}; double amps[8] = {.8,.2,.1,.04,.02,.01,.005};
struct complex ch[(int)(1+2*sampling_rate*Td)],phase; struct complex ch[(int)(1+2*sampling_rate*Td)],phase;
int i; int i;
randominit(); randominit();
phase.x = 1.0; phase.x = 1.0;
phase.y = 0; phase.y = 0;
......
...@@ -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;
...@@ -69,17 +69,18 @@ void randominit(unsigned seed_init) ...@@ -69,17 +69,18 @@ void randominit(unsigned seed_init)
} }
iy=1; iy=1;
} }
#endif
/*void randominit(unsigned seed_init) #if 0
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
msg("Initializing random number generator, seed %x\n",seed_init); msg("Initializing random number generator, seed %x\n",seed_init);
seed_init = 62110; seed_init = 62110;
if (seed_init == 0) { if (seed_init == 0) {
srand((unsigned)time(NULL)); srand((unsigned)time(NULL));
...@@ -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)
{ {
...@@ -87,9 +87,11 @@ void set_taus_seed(unsigned int seed_init) ...@@ -87,9 +87,11 @@ void set_taus_seed(unsigned int seed_init)
s2 = result; s2 = result;
#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