Commit dd4f1ab7 authored by Thomas Laurent's avatar Thomas Laurent

coarse gain cleaning

parent 7d602d5c
...@@ -185,7 +185,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CU ...@@ -185,7 +185,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CU
# these changes are related to hardcoded path to include .h files # these changes are related to hardcoded path to include .h files
add_definitions(-DCMAKER) add_definitions(-DCMAKER)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O0")
set(GIT_BRANCH "UNKNOWN") set(GIT_BRANCH "UNKNOWN")
...@@ -2126,7 +2126,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr ...@@ -2126,7 +2126,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr
target_link_libraries (${myExe} target_link_libraries (${myExe}
-Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group -Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group
pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl
) )
endforeach(myExe) endforeach(myExe)
......
...@@ -782,7 +782,7 @@ int rx_pdsch(PHY_VARS_UE *ue, ...@@ -782,7 +782,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
#if DISABLE_LOG_X #if DISABLE_LOG_X
printf("[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n",frame,subframe,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,proc->channel_level,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); printf("[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n",frame,subframe,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,proc->channel_level,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0));
#else #else
LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n",frame,subframe,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,proc->channel_level,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d Channel Comp %5.2f \n",frame,subframe,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0));
#endif #endif
#endif #endif
// MRC // MRC
......
...@@ -52,8 +52,8 @@ void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name){ ...@@ -52,8 +52,8 @@ void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name){
if (ts->trials>0) { if (ts->trials>0) {
//fprintf(file_name,"Name %25s: Processing %15.3f ms for SF %d, diff_now %15.3f \n", name,(ts->diff_now/(cpu_freq_GHz*1000000.0)),subframe,ts->diff_now); //fprintf(file_name,"Name %25s: Processing %15.3f ms for SF %d, diff_now %15.3f \n", name,(ts->p_time/(cpu_freq_GHz*1000000.0)),subframe,ts->p_time);
fprintf(file_name,"%15.3f us, diff_now %15.3f \n",(ts->diff_now/(cpu_freq_GHz*1000.0)),(double)ts->diff_now); fprintf(file_name,"%15.3f us, diff_now %15.3f \n",(ts->p_time/(cpu_freq_GHz*1000.0)),(double)ts->p_time);
} }
} }
......
...@@ -40,7 +40,6 @@ typedef struct { ...@@ -40,7 +40,6 @@ typedef struct {
long long in; long long in;
long long diff; long long diff;
long long diff_now;
long long p_time; /*!< \brief absolute process duration */ long long p_time; /*!< \brief absolute process duration */
long long diff_square; /*!< \brief process duration square */ long long diff_square; /*!< \brief process duration square */
long long max; long long max;
...@@ -50,7 +49,6 @@ typedef struct { ...@@ -50,7 +49,6 @@ typedef struct {
#elif defined(__arm__) #elif defined(__arm__)
typedef struct { typedef struct {
uint32_t in; uint32_t in;
uint32_t diff_now;
uint32_t diff; uint32_t diff;
uint32_t p_time; /*!< \brief absolute process duration */ uint32_t p_time; /*!< \brief absolute process duration */
uint32_t diff_square; /*!< \brief process duration square */ uint32_t diff_square; /*!< \brief process duration square */
...@@ -116,9 +114,6 @@ static inline void stop_meas(time_stats_t *ts) ...@@ -116,9 +114,6 @@ static inline void stop_meas(time_stats_t *ts)
if (opp_enabled) { if (opp_enabled) {
long long out = rdtsc_oai(); long long out = rdtsc_oai();
ts->diff_now = (out-ts->in);
ts->diff_now = (out-ts->in);
ts->diff += (out-ts->in); ts->diff += (out-ts->in);
/// process duration is the difference between two clock points /// process duration is the difference between two clock points
ts->p_time = (out-ts->in); ts->p_time = (out-ts->in);
...@@ -135,7 +130,6 @@ static inline void reset_meas(time_stats_t *ts) { ...@@ -135,7 +130,6 @@ static inline void reset_meas(time_stats_t *ts) {
ts->trials=0; ts->trials=0;
ts->diff=0; ts->diff=0;
ts->diff_now=0;
ts->p_time=0; ts->p_time=0;
ts->diff_square=0; ts->diff_square=0;
ts->max=0; ts->max=0;
......
...@@ -412,7 +412,7 @@ void pdsch_procedures(PHY_VARS_eNB *eNB, ...@@ -412,7 +412,7 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,
&eNB->dlsch_turbo_encoding_wakeup_stats1, &eNB->dlsch_turbo_encoding_wakeup_stats1,
&eNB->dlsch_interleaving_stats); &eNB->dlsch_interleaving_stats);
stop_meas(&eNB->dlsch_encoding_stats); stop_meas(&eNB->dlsch_encoding_stats);
if(eNB->dlsch_encoding_stats.diff_now>500*3000 && opp_enabled == 1) if(eNB->dlsch_encoding_stats.p_time>500*3000 && opp_enabled == 1)
{ {
print_meas_now(&eNB->dlsch_encoding_stats,"total coding",stderr); print_meas_now(&eNB->dlsch_encoding_stats,"total coding",stderr);
} }
...@@ -1337,7 +1337,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) ...@@ -1337,7 +1337,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
ret, ret,
ulsch_harq->cqi_crc_status, ulsch_harq->cqi_crc_status,
ulsch_harq->O_ACK, ulsch_harq->O_ACK,
eNB->ulsch_decoding_stats.diff_now, eNB->ulsch_decoding_stats.max); eNB->ulsch_decoding_stats.p_time, eNB->ulsch_decoding_stats.max);
//compute the expected ULSCH RX power (for the stats) //compute the expected ULSCH RX power (for the stats)
ulsch_harq->delta_TF = get_hundred_times_delta_IF_eNB(eNB,i,harq_pid, 0); // 0 means bw_factor is not considered ulsch_harq->delta_TF = get_hundred_times_delta_IF_eNB(eNB,i,harq_pid, 0); // 0 means bw_factor is not considered
......
...@@ -160,7 +160,7 @@ static void *feptx_thread(void *param) { ...@@ -160,7 +160,7 @@ static void *feptx_thread(void *param) {
exit_fun( "ERROR pthread_cond_signal" ); exit_fun( "ERROR pthread_cond_signal" );
return NULL; return NULL;
} }
/*if(opp_enabled == 1 && ru->ofdm_mod_wakeup_stats.diff_now>30*3000){ /*if(opp_enabled == 1 && ru->ofdm_mod_wakeup_stats.p_time>30*3000){
print_meas_now(&ru->ofdm_mod_wakeup_stats,"fep wakeup",stderr); print_meas_now(&ru->ofdm_mod_wakeup_stats,"fep wakeup",stderr);
printf("delay in fep wakeup in frame_tx: %d subframe_rx: %d \n",proc->frame_tx,proc->subframe_tx); printf("delay in fep wakeup in frame_tx: %d subframe_rx: %d \n",proc->frame_tx,proc->subframe_tx);
}*/ }*/
...@@ -220,7 +220,7 @@ void feptx_ofdm_2thread(RU_t *ru) { ...@@ -220,7 +220,7 @@ void feptx_ofdm_2thread(RU_t *ru) {
start_meas(&ru->ofdm_mod_wait_stats); start_meas(&ru->ofdm_mod_wait_stats);
wait_on_busy_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"feptx thread"); wait_on_busy_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"feptx thread");
stop_meas(&ru->ofdm_mod_wait_stats); stop_meas(&ru->ofdm_mod_wait_stats);
/*if(opp_enabled == 1 && ru->ofdm_mod_wait_stats.diff_now>30*3000){ /*if(opp_enabled == 1 && ru->ofdm_mod_wait_stats.p_time>30*3000){
print_meas_now(&ru->ofdm_mod_wait_stats,"fep wakeup",stderr); print_meas_now(&ru->ofdm_mod_wait_stats,"fep wakeup",stderr);
printf("delay in feptx wait on codition in frame_rx: %d subframe_rx: %d \n",proc->frame_tx,proc->subframe_tx); printf("delay in feptx wait on codition in frame_rx: %d subframe_rx: %d \n",proc->frame_tx,proc->subframe_tx);
}*/ }*/
...@@ -467,7 +467,7 @@ static void *fep_thread(void *param) { ...@@ -467,7 +467,7 @@ static void *fep_thread(void *param) {
exit_fun( "ERROR pthread_cond_signal" ); exit_fun( "ERROR pthread_cond_signal" );
return NULL; return NULL;
} }
/*if(opp_enabled == 1 && ru->ofdm_demod_wakeup_stats.diff_now>30*3000){ /*if(opp_enabled == 1 && ru->ofdm_demod_wakeup_stats.p_time>30*3000){
print_meas_now(&ru->ofdm_demod_wakeup_stats,"fep wakeup",stderr); print_meas_now(&ru->ofdm_demod_wakeup_stats,"fep wakeup",stderr);
printf("delay in fep wakeup in frame_rx: %d subframe_rx: %d \n",proc->frame_rx,proc->subframe_rx); printf("delay in fep wakeup in frame_rx: %d subframe_rx: %d \n",proc->frame_rx,proc->subframe_rx);
}*/ }*/
...@@ -582,7 +582,7 @@ void ru_fep_full_2thread(RU_t *ru) { ...@@ -582,7 +582,7 @@ void ru_fep_full_2thread(RU_t *ru) {
start_meas(&ru->ofdm_demod_wait_stats); start_meas(&ru->ofdm_demod_wait_stats);
wait_on_busy_condition(&proc->mutex_fep,&proc->cond_fep,&proc->instance_cnt_fep,"fep thread"); wait_on_busy_condition(&proc->mutex_fep,&proc->cond_fep,&proc->instance_cnt_fep,"fep thread");
stop_meas(&ru->ofdm_demod_wait_stats); stop_meas(&ru->ofdm_demod_wait_stats);
if(opp_enabled == 1 && ru->ofdm_demod_wakeup_stats.diff_now>30*3000){ if(opp_enabled == 1 && ru->ofdm_demod_wakeup_stats.p_time>30*3000){
print_meas_now(&ru->ofdm_demod_wakeup_stats,"fep wakeup",stderr); print_meas_now(&ru->ofdm_demod_wakeup_stats,"fep wakeup",stderr);
printf("delay in fep wait on codition in frame_rx: %d subframe_rx: %d \n",proc->frame_rx,proc->subframe_rx); printf("delay in fep wait on codition in frame_rx: %d subframe_rx: %d \n",proc->frame_rx,proc->subframe_rx);
} }
......
/* /*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. except in compliance with the License.
* You may obtain a copy of the License at You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698 http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and See the License for the specific language governing permissions and
* limitations under the License. limitations under the License.
*------------------------------------------------------------------------------- -------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance: For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org contact@openairinterface.org
*/ */
/*! \file ulsim.c /*! \file ulsim.c
\brief Top-level UL simulator \brief Top-level UL simulator
\author R. Knopp \author R. Knopp
\date 2011 - 2014 \date 2011 - 2014
\version 0.1 \version 0.1
\company Eurecom \company Eurecom
\email: knopp@eurecom.fr \email: knopp@eurecom.fr
\note \note
\warning \warning
*/ */
#include <string.h> #include <string.h>
...@@ -58,21 +58,43 @@ ...@@ -58,21 +58,43 @@
#include "common/config/config_load_configmodule.h" #include "common/config/config_load_configmodule.h"
double cpuf; double cpuf;
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
//#define MCS_COUNT 23//added for PHY abstraction
static int cmpdouble(const void *p1, const void *p2) {
return *(double *)p1 > *(double *)p2;
}
double median(varArray_t *input) {
return *(double *)((uint8_t *)(input+1)+(input->size/2)*input->atomSize);
}
double q1(varArray_t *input) {
return *(double *)((uint8_t *)(input+1)+(input->size/4)*input->atomSize);
}
//#define MCS_COUNT 23//added for PHY abstraction double q3(varArray_t *input) {
return *(double *)((uint8_t *)(input+1)+(3*input->size/4)*input->atomSize);
}
void dumpVarArray(varArray_t *input) {
double *ptr=dataArray(input);
printf("dumping size=%ld\n", input->size);
for (int i=0; i < input->size; i++)
printf("%.1f:", *ptr++);
printf("\n");
}
channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX]; channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX]; channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
//Added for PHY abstraction //Added for PHY abstractionopenair1/PHY/TOOLS/lte_phy_scope.h
node_desc_t *enb_data[NUMBER_OF_eNB_MAX]; node_desc_t *enb_data[NUMBER_OF_eNB_MAX];
node_desc_t *ue_data[NUMBER_OF_UE_MAX]; node_desc_t *ue_data[NUMBER_OF_UE_MAX];
//double sinr_bler_map[MCS_COUNT][2][16]; //double sinr_bler_map[MCS_COUNT][2][16];
extern uint16_t beta_ack[16],beta_ri[16],beta_cqi[16]; extern uint16_t beta_ack[16],beta_ri[16],beta_cqi[16];
//extern char* namepointer_chMag ; //extern char* namepointer_chMag ;
int xforms=0; int xforms=0;
FD_lte_phy_scope_enb *form_enb; FD_lte_phy_scope_enb *form_enb;
char title[255]; char title[255];
...@@ -88,6 +110,8 @@ int nfapi_mode = 0; ...@@ -88,6 +110,8 @@ int nfapi_mode = 0;
extern void fep_full(RU_t *ru); extern void fep_full(RU_t *ru);
extern void ru_fep_full_2thread(RU_t *ru); extern void ru_fep_full_2thread(RU_t *ru);
extern void eNB_fep_full(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc);
extern void eNB_fep_full_2thread(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc);
nfapi_dl_config_request_t DL_req; nfapi_dl_config_request_t DL_req;
nfapi_ul_config_request_t UL_req; nfapi_ul_config_request_t UL_req;
...@@ -101,32 +125,29 @@ int codingw = 0; ...@@ -101,32 +125,29 @@ int codingw = 0;
void void
fill_nfapi_ulsch_config_request(nfapi_ul_config_request_pdu_t *ul_config_pdu, fill_nfapi_ulsch_config_request(nfapi_ul_config_request_pdu_t *ul_config_pdu,
uint8_t cqi_req, uint8_t cqi_req,
uint8_t p_eNB, uint8_t p_eNB,
uint8_t cqi_ReportModeAperiodic, uint8_t cqi_ReportModeAperiodic,
uint8_t betaOffset_CQI_Index, uint8_t betaOffset_CQI_Index,
uint8_t betaOffset_RI_Index, uint8_t betaOffset_RI_Index,
uint8_t dl_cqi_pmi_size, uint8_t dl_cqi_pmi_size,
uint8_t tmode, uint8_t tmode,
uint32_t handle, uint32_t handle,
uint16_t rnti, uint16_t rnti,
uint8_t resource_block_start, uint8_t resource_block_start,
uint8_t number_of_resource_blocks, uint8_t number_of_resource_blocks,
uint8_t modulation_type, uint8_t modulation_type,
uint8_t cyclic_shift_2_for_drms, uint8_t cyclic_shift_2_for_drms,
uint8_t frequency_hopping_enabled_flag, uint8_t frequency_hopping_enabled_flag,
uint8_t frequency_hopping_bits, uint8_t frequency_hopping_bits,
uint8_t new_data_indication, uint8_t new_data_indication,
uint8_t redundancy_version, uint8_t redundancy_version,
uint8_t harq_process_number, uint8_t harq_process_number,
uint8_t ul_tx_mode, uint8_t ul_tx_mode,
uint8_t current_tx_nb, uint8_t current_tx_nb,
uint8_t n_srs, uint8_t n_srs,
uint16_t size) uint16_t size) {
{
memset((void *) ul_config_pdu, 0, sizeof(nfapi_ul_config_request_pdu_t)); memset((void *) ul_config_pdu, 0, sizeof(nfapi_ul_config_request_pdu_t));
ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE; ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE;
ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_ul_config_ulsch_pdu)); ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_ul_config_ulsch_pdu));
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG; ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG;
...@@ -158,15 +179,15 @@ fill_nfapi_ulsch_config_request(nfapi_ul_config_request_pdu_t *ul_config_pdu, ...@@ -158,15 +179,15 @@ fill_nfapi_ulsch_config_request(nfapi_ul_config_request_pdu_t *ul_config_pdu,
LOG_D(MAC, "report_type %d\n",ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.report_type); LOG_D(MAC, "report_type %d\n",ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.report_type);
if (p_eNB <= 2 if (p_eNB <= 2
&& (tmode == 3 || tmode == 4 || tmode == 8 || tmode == 9 || tmode == 10)) && (tmode == 3 || tmode == 4 || tmode == 8 || tmode == 9 || tmode == 10))
ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 1; ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 1;
else if (p_eNB <= 2) ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 0; else if (p_eNB <= 2) ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 0;
else if (p_eNB == 4) ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 2; else if (p_eNB == 4) ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size = 2;
for (int ri = 0; for (int ri = 0;
ri < (1 << ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size); ri < (1 << ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].ri_size);
ri++) ri++)
ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size[ri] = dl_cqi_pmi_size; ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.aperiodic_cqi_pmi_ri_report.cc[0].dl_cqi_pmi_size[ri] = dl_cqi_pmi_size;
ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.delta_offset_cqi = betaOffset_CQI_Index; ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.delta_offset_cqi = betaOffset_CQI_Index;
ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.delta_offset_ri = betaOffset_RI_Index; ul_config_pdu->ulsch_cqi_ri_pdu.cqi_ri_information.cqi_ri_information_rel9.delta_offset_ri = betaOffset_RI_Index;
...@@ -174,585 +195,528 @@ fill_nfapi_ulsch_config_request(nfapi_ul_config_request_pdu_t *ul_config_pdu, ...@@ -174,585 +195,528 @@ fill_nfapi_ulsch_config_request(nfapi_ul_config_request_pdu_t *ul_config_pdu,
} }
void fill_ulsch_dci(PHY_VARS_eNB *eNB, void fill_ulsch_dci(PHY_VARS_eNB *eNB,
int frame, int frame,
int subframe, int subframe,
Sched_Rsp_t *sched_resp, Sched_Rsp_t *sched_resp,
uint16_t rnti, uint16_t rnti,
void *UL_dci, void *UL_dci,
int first_rb, int first_rb,
int nb_rb, int nb_rb,
int mcs, int mcs,
int modulation_type, int modulation_type,
int ndi, int ndi,
int TBS, int TBS,
int cqi_flag, int cqi_flag,
uint8_t beta_CQI, uint8_t beta_CQI,
uint8_t beta_RI, uint8_t beta_RI,
uint8_t cqi_size) { uint8_t cqi_size) {
nfapi_ul_config_request_body_t *ul_req=&sched_resp->UL_req->ul_config_request_body; nfapi_ul_config_request_body_t *ul_req=&sched_resp->UL_req->ul_config_request_body;
int harq_pid = ((frame*10)+subframe)&7; int harq_pid = ((frame*10)+subframe)&7;
//printf("ulsch in frame %d, subframe %d => harq_pid %d, mcs %d, ndi %d\n",frame,subframe,harq_pid,mcs,ndi); //printf("ulsch in frame %d, subframe %d => harq_pid %d, mcs %d, ndi %d\n",frame,subframe,harq_pid,mcs,ndi);
switch (eNB->frame_parms.N_RB_UL) { switch (eNB->frame_parms.N_RB_UL) {
case 6: case 6:
break; break;
case 25:
if (eNB->frame_parms.frame_type == TDD) {
((DCI0_5MHz_TDD_1_6_t*)UL_dci)->type = 0;
((DCI0_5MHz_TDD_1_6_t*)UL_dci)->rballoc = computeRIV(eNB->frame_parms.N_RB_UL,first_rb,nb_rb);// 12 RBs from position 8
//printf("nb_rb %d/%d, rballoc %d (dci %x)\n",nb_rb,eNB->frame_parms.N_RB_UL,((DCI0_5MHz_TDD_1_6_t*)UL_dci)->rballoc,*(uint32_t *)UL_dci);
((DCI0_5MHz_TDD_1_6_t*)UL_dci)->mcs = mcs;
((DCI0_5MHz_TDD_1_6_t*)UL_dci)->ndi = ndi;
((DCI0_5MHz_TDD_1_6_t*)UL_dci)->TPC = 0;
((DCI0_5MHz_TDD_1_6_t*)UL_dci)->cqi_req = cqi_flag&1;
((DCI0_5MHz_TDD_1_6_t*)UL_dci)->cshift = 0;
((DCI0_5MHz_TDD_1_6_t*)UL_dci)->dai = 1;
} else {
((DCI0_5MHz_FDD_t*)UL_dci)->type = 0;
((DCI0_5MHz_FDD_t*)UL_dci)->rballoc = computeRIV(eNB->frame_parms.N_RB_UL,first_rb,nb_rb);// 12 RBs from position 8
// printf("nb_rb %d/%d, rballoc %d (dci %x) (dcip %p)\n",nb_rb,eNB->frame_parms.N_RB_UL,((DCI0_5MHz_FDD_t*)UL_dci)->rballoc,*(uint32_t *)UL_dci,UL_dci);
((DCI0_5MHz_FDD_t*)UL_dci)->mcs = mcs;
((DCI0_5MHz_FDD_t*)UL_dci)->ndi = ndi;
((DCI0_5MHz_FDD_t*)UL_dci)->TPC = 0;
((DCI0_5MHz_FDD_t*)UL_dci)->cqi_req = cqi_flag&1;
((DCI0_5MHz_FDD_t*)UL_dci)->cshift = 0;
}
break; case 25:
if (eNB->frame_parms.frame_type == TDD) {
case 50: ((DCI0_5MHz_TDD_1_6_t *)UL_dci)->type = 0;
if (eNB->frame_parms.frame_type == TDD) { ((DCI0_5MHz_TDD_1_6_t *)UL_dci)->rballoc = computeRIV(eNB->frame_parms.N_RB_UL,first_rb,nb_rb); // 12 RBs from position 8
((DCI0_10MHz_TDD_1_6_t*)UL_dci)->type = 0; //printf("nb_rb %d/%d, rballoc %d (dci %x)\n",nb_rb,eNB->frame_parms.N_RB_UL,((DCI0_5MHz_TDD_1_6_t*)UL_dci)->rballoc,*(uint32_t *)UL_dci);
((DCI0_10MHz_TDD_1_6_t*)UL_dci)->rballoc = computeRIV(eNB->frame_parms.N_RB_UL,first_rb,nb_rb);// 12 RBs from position 8 ((DCI0_5MHz_TDD_1_6_t *)UL_dci)->mcs = mcs;
// printf("nb_rb %d/%d, rballoc %d (dci %x)\n",nb_rb,eNB->frame_parms.N_RB_UL,((DCI0_10MHz_TDD_1_6_t*)UL_dci)->rballoc,*(uint32_t *)UL_dci); ((DCI0_5MHz_TDD_1_6_t *)UL_dci)->ndi = ndi;
((DCI0_10MHz_TDD_1_6_t*)UL_dci)->mcs = mcs; ((DCI0_5MHz_TDD_1_6_t *)UL_dci)->TPC = 0;
((DCI0_10MHz_TDD_1_6_t*)UL_dci)->ndi = ndi; ((DCI0_5MHz_TDD_1_6_t *)UL_dci)->cqi_req = cqi_flag&1;
((DCI0_10MHz_TDD_1_6_t*)UL_dci)->TPC = 0; ((DCI0_5MHz_TDD_1_6_t *)UL_dci)->cshift = 0;
((DCI0_10MHz_TDD_1_6_t*)UL_dci)->cqi_req = cqi_flag&1; ((DCI0_5MHz_TDD_1_6_t *)UL_dci)->dai = 1;
((DCI0_10MHz_TDD_1_6_t*)UL_dci)->cshift = 0; } else {
((DCI0_10MHz_TDD_1_6_t*)UL_dci)->dai = 1; ((DCI0_5MHz_FDD_t *)UL_dci)->type = 0;
} else { ((DCI0_5MHz_FDD_t *)UL_dci)->rballoc = computeRIV(eNB->frame_parms.N_RB_UL,first_rb,nb_rb); // 12 RBs from position 8
((DCI0_10MHz_FDD_t*)UL_dci)->type = 0; // printf("nb_rb %d/%d, rballoc %d (dci %x) (dcip %p)\n",nb_rb,eNB->frame_parms.N_RB_UL,((DCI0_5MHz_FDD_t*)UL_dci)->rballoc,*(uint32_t *)UL_dci,UL_dci);
((DCI0_10MHz_FDD_t*)UL_dci)->rballoc = computeRIV(eNB->frame_parms.N_RB_UL,first_rb,nb_rb);// 12 RBs from position 8 ((DCI0_5MHz_FDD_t *)UL_dci)->mcs = mcs;
//printf("nb_rb %d/%d, rballoc %d (dci %x)\n",nb_rb,eNB->frame_parms.N_RB_UL,((DCI0_10MHz_FDD_t*)UL_dci)->rballoc,*(uint32_t *)UL_dci); ((DCI0_5MHz_FDD_t *)UL_dci)->ndi = ndi;
((DCI0_10MHz_FDD_t*)UL_dci)->mcs = mcs; ((DCI0_5MHz_FDD_t *)UL_dci)->TPC = 0;
((DCI0_10MHz_FDD_t*)UL_dci)->ndi = ndi; ((DCI0_5MHz_FDD_t *)UL_dci)->cqi_req = cqi_flag&1;
((DCI0_10MHz_FDD_t*)UL_dci)->TPC = 0; ((DCI0_5MHz_FDD_t *)UL_dci)->cshift = 0;
((DCI0_10MHz_FDD_t*)UL_dci)->cqi_req = cqi_flag&1; }
((DCI0_10MHz_FDD_t*)UL_dci)->cshift = 0;
}
break; break;
case 100: case 50:
if (eNB->frame_parms.frame_type == TDD) { if (eNB->frame_parms.frame_type == TDD) {
((DCI0_20MHz_TDD_1_6_t*)UL_dci)->type = 0; ((DCI0_10MHz_TDD_1_6_t *)UL_dci)->type = 0;
((DCI0_20MHz_TDD_1_6_t*)UL_dci)->rballoc = computeRIV(eNB->frame_parms.N_RB_UL,first_rb,nb_rb);// 12 RBs from position 8 ((DCI0_10MHz_TDD_1_6_t *)UL_dci)->rballoc = computeRIV(eNB->frame_parms.N_RB_UL,first_rb,nb_rb); // 12 RBs from position 8
// printf("nb_rb %d/%d, rballoc %d (dci %x)\n",nb_rb,eNB->frame_parms.N_RB_UL,((DCI0_20MHz_TDD_1_6_t*)UL_dci)->rballoc,*(uint32_t *)UL_dci); // printf("nb_rb %d/%d, rballoc %d (dci %x)\n",nb_rb,eNB->frame_parms.N_RB_UL,((DCI0_10MHz_TDD_1_6_t*)UL_dci)->rballoc,*(uint32_t *)UL_dci);
((DCI0_20MHz_TDD_1_6_t*)UL_dci)->mcs = mcs; ((DCI0_10MHz_TDD_1_6_t *)UL_dci)->mcs = mcs;
((DCI0_20MHz_TDD_1_6_t*)UL_dci)->ndi = ndi; ((DCI0_10MHz_TDD_1_6_t *)UL_dci)->ndi = ndi;
((DCI0_20MHz_TDD_1_6_t*)UL_dci)->TPC = 0; ((DCI0_10MHz_TDD_1_6_t *)UL_dci)->TPC = 0;
((DCI0_20MHz_TDD_1_6_t*)UL_dci)->cqi_req = cqi_flag&1; ((DCI0_10MHz_TDD_1_6_t *)UL_dci)->cqi_req = cqi_flag&1;
((DCI0_20MHz_TDD_1_6_t*)UL_dci)->cshift = 0; ((DCI0_10MHz_TDD_1_6_t *)UL_dci)->cshift = 0;
((DCI0_20MHz_TDD_1_6_t*)UL_dci)->dai = 1; ((DCI0_10MHz_TDD_1_6_t *)UL_dci)->dai = 1;
} else { } else {
((DCI0_20MHz_FDD_t*)UL_dci)->type = 0; ((DCI0_10MHz_FDD_t *)UL_dci)->type = 0;
((DCI0_20MHz_FDD_t*)UL_dci)->rballoc = computeRIV(eNB->frame_parms.N_RB_UL,first_rb,nb_rb);// 12 RBs from position 8 ((DCI0_10MHz_FDD_t *)UL_dci)->rballoc = computeRIV(eNB->frame_parms.N_RB_UL,first_rb,nb_rb); // 12 RBs from position 8
// printf("nb_rb %d/%d, rballoc %d (dci %x) (UL_dci %p)\n",nb_rb,eNB->frame_parms.N_RB_UL,((DCI0_20MHz_FDD_t*)UL_dci)->rballoc,*(uint32_t *)UL_dci,(void*)UL_dci); //printf("nb_rb %d/%d, rballoc %d (dci %x)\n",nb_rb,eNB->frame_parms.N_RB_UL,((DCI0_10MHz_FDD_t*)UL_dci)->rballoc,*(uint32_t *)UL_dci);
((DCI0_20MHz_FDD_t*)UL_dci)->mcs = mcs; ((DCI0_10MHz_FDD_t *)UL_dci)->mcs = mcs;
((DCI0_20MHz_FDD_t*)UL_dci)->ndi = ndi; ((DCI0_10MHz_FDD_t *)UL_dci)->ndi = ndi;
((DCI0_20MHz_FDD_t*)UL_dci)->TPC = 0; ((DCI0_10MHz_FDD_t *)UL_dci)->TPC = 0;
((DCI0_20MHz_FDD_t*)UL_dci)->cqi_req = cqi_flag&1; ((DCI0_10MHz_FDD_t *)UL_dci)->cqi_req = cqi_flag&1;
((DCI0_20MHz_FDD_t*)UL_dci)->cshift = 0; ((DCI0_10MHz_FDD_t *)UL_dci)->cshift = 0;
} }
break;
case 100:
if (eNB->frame_parms.frame_type == TDD) {
((DCI0_20MHz_TDD_1_6_t *)UL_dci)->type = 0;
((DCI0_20MHz_TDD_1_6_t *)UL_dci)->rballoc = computeRIV(eNB->frame_parms.N_RB_UL,first_rb,nb_rb); // 12 RBs from position 8
// printf("nb_rb %d/%d, rballoc %d (dci %x)\n",nb_rb,eNB->frame_parms.N_RB_UL,((DCI0_20MHz_TDD_1_6_t*)UL_dci)->rballoc,*(uint32_t *)UL_dci);
((DCI0_20MHz_TDD_1_6_t *)UL_dci)->mcs = mcs;
((DCI0_20MHz_TDD_1_6_t *)UL_dci)->ndi = ndi;
((DCI0_20MHz_TDD_1_6_t *)UL_dci)->TPC = 0;
((DCI0_20MHz_TDD_1_6_t *)UL_dci)->cqi_req = cqi_flag&1;
((DCI0_20MHz_TDD_1_6_t *)UL_dci)->cshift = 0;
((DCI0_20MHz_TDD_1_6_t *)UL_dci)->dai = 1;
} else {
((DCI0_20MHz_FDD_t *)UL_dci)->type = 0;
((DCI0_20MHz_FDD_t *)UL_dci)->rballoc = computeRIV(eNB->frame_parms.N_RB_UL,first_rb,nb_rb); // 12 RBs from position 8
// printf("nb_rb %d/%d, rballoc %d (dci %x) (UL_dci %p)\n",nb_rb,eNB->frame_parms.N_RB_UL,((DCI0_20MHz_FDD_t*)UL_dci)->rballoc,*(uint32_t *)UL_dci,(void*)UL_dci);
((DCI0_20MHz_FDD_t *)UL_dci)->mcs = mcs;
((DCI0_20MHz_FDD_t *)UL_dci)->ndi = ndi;
((DCI0_20MHz_FDD_t *)UL_dci)->TPC = 0;
((DCI0_20MHz_FDD_t *)UL_dci)->cqi_req = cqi_flag&1;
((DCI0_20MHz_FDD_t *)UL_dci)->cshift = 0;
}
break; break;
default: default:
break; break;
} }
fill_nfapi_ulsch_config_request(&ul_req->ul_config_pdu_list[0], fill_nfapi_ulsch_config_request(&ul_req->ul_config_pdu_list[0],
cqi_flag&1, cqi_flag&1,
1, // p_eNB 1, // p_eNB
0, // reportmode Aperiodic 0, // reportmode Aperiodic
beta_CQI, beta_CQI,
beta_RI, beta_RI,
cqi_size, cqi_size,
//cc, //cc,
//UE_template->physicalConfigDedicated, //UE_template->physicalConfigDedicated,
1, 1,
0, 0,
14, // rnti 14, // rnti
first_rb, // resource_block_start first_rb, // resource_block_start
nb_rb, // number_of_resource_blocks nb_rb, // number_of_resource_blocks
modulation_type, modulation_type,
0, // cyclic_shift_2_for_drms 0, // cyclic_shift_2_for_drms
0, // frequency_hopping_enabled_flag 0, // frequency_hopping_enabled_flag
0, // frequency_hopping_bits 0, // frequency_hopping_bits
ndi, // new_data_indication ndi, // new_data_indication
mcs>28?(mcs-28):0, // redundancy_version mcs>28?(mcs-28):0, // redundancy_version
harq_pid, // harq_process_number harq_pid, // harq_process_number
0, // ul_tx_mode 0, // ul_tx_mode
0, // current_tx_nb 0, // current_tx_nb
0, // n_srs 0, // n_srs
TBS); TBS);
sched_resp->UL_req->header.message_id = NFAPI_UL_CONFIG_REQUEST; sched_resp->UL_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
ul_req->number_of_pdus=1; ul_req->number_of_pdus=1;
ul_req->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; ul_req->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
}
void printStatIndent(time_stats_t *ptr, char *txt) {
printf("|__ %-50s %.2f us (%d trials)\n",
txt,
inMicroS(ptr->diff/ptr->trials),
ptr->trials);
} }
extern void eNB_fep_full(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc); void printStatIndent2(time_stats_t *ptr, char *txt, int turbo_iter) {
extern void eNB_fep_full_2thread(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc); double timeBase=1/(1000*cpu_freq_GHz);
printf(" |__ %-45s %.2f us (cycles/block %7g, %5d trials)\n",
txt,
((double)ptr->diff)/ptr->trials*timeBase,
round(((double)ptr->diff)/turbo_iter),
ptr->trials);
}
double squareRoot(time_stats_t *ptr) {
double timeBase=1/(1000*cpu_freq_GHz);
return sqrt((double)ptr->diff_square*pow(timeBase,2)/ptr->trials -
pow((double)ptr->diff/ptr->trials*timeBase,2));
}
void printDistribution(time_stats_t *ptr, varArray_t *sortedList, char *txt) {
double timeBase=1/(1000*cpu_freq_GHz);
printf("%-50s :%.2f us (%d trials)\n",
txt,
(double)ptr->diff/ptr->trials*timeBase,
ptr->trials);
printf("|__ Statistics std: %.2f us median %.2fus q1 %.2fus q3 %.2fus \n",
squareRoot(ptr), median(sortedList),q1(sortedList),q3(sortedList));
}
int main(int argc, char **argv) enum eTypes { eBool, eInt, eFloat, eText };
{ static int verbose,disable_bundling=0,cqi_flag=0, extended_prefix_flag=0, test_perf=0, subframe=3, transmission_m=1,n_rx=1;
char c; int main(int argc, char **argv) {
int i,j,aa,u;